diff --git a/DEPS b/DEPS index 2304ae65..67c7c9d9 100644 --- a/DEPS +++ b/DEPS
@@ -195,11 +195,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': '2610e8261e9e8be23eeb8054f8aa4a148234d214', + 'skia_revision': '7b1620f36648c8c31a2e03dc4f5df18e6a9c700b', # 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': '49c0daeb8fdc713b3e13174d26373302430a4539', + 'v8_revision': '69e493145e02a3a292683e577892fedb6f4964fb', # 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. @@ -211,7 +211,7 @@ # 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': 'b33e0b36a08cc7a69e0b063ddc3602124d8227d9', + 'swiftshader_revision': 'fe878dedd5addbedab4033c0cb6b19bbbe04f8e4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -258,7 +258,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '511a82c95fc7a633cff6a3330ed82b13cdd77d41', + 'catapult_revision': 'cb190dce089bfc12883c4e9cda8dfc4bfe292093', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -266,7 +266,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': 'b87e7b7d3b0ba8a363286db0f5906485f3765851', + 'devtools_frontend_revision': 'f5ee7c40c31b322ce8d590593540b644957932c7', # 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. @@ -318,7 +318,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'dbd34449af20f2d026b1e7f959073e254066ec83', + 'dawn_revision': 'c2367695483858cf61d59f34a41c0ead0aac7776', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -876,7 +876,7 @@ # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '65fccf7b5f0490b105e5aa72208aaeb01a930207', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'b82a1e239de5cfca1beeeb54ea214e461883305f', 'condition': 'checkout_chromeos', }, @@ -1249,7 +1249,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'd1382ae74fac9c4971099a76e9381bb089872eda', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '3504e85b742c1d26f55eba5c0668610367d1fc20', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1327,7 +1327,7 @@ 'packages': [ { 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': 'MLN6wydhVVfCSNuviM5MM0WgsLkRmMdDzDFTBsNpytoC' + 'version': 'cw5KjATCqXEo2ji2ep1Vx88VOe8DdIMAsfq3dV86XzYC' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -1471,7 +1471,7 @@ }, 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'fa54364cea0be4ce3862bc1058ab58b935820de1', + Var('webrtc_git') + '/src.git' + '@' + '804db2dde3f13834891d11b47dc0f0e18b9d6320', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1543,7 +1543,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@0f21b6caeceae9a46cf5814b34345ec02c827bae', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@5d45ebc33fa8fcd0a9f656d12b98219b733f2820', 'condition': 'checkout_src_internal', }, @@ -1562,7 +1562,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'tmWwsSISDU41lQ4kf4xfmJyf0_fQYQlzfq_1EKE6E5MC', + 'version': 'zmwXsYnENXvIpO-aIRtYuL3CNQy4Zl9nUn3q_aulscEC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/WATCHLISTS b/WATCHLISTS index 1754a273..8a55f13 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -1317,6 +1317,9 @@ '|chromeos/services/secure_channel/'\ '|ui/webui/resources/cr_components/chromeos/multidevice_setup/' }, + 'multipaste': { + 'filepath': 'ash/clipboard/', + }, 'nacl': { 'filepath': 'chrome/nacl/|chrome/test/nacl/|'\ 'chrome/browser/nacl_host/|chrome/common/nacl|'\ @@ -2583,6 +2586,9 @@ 'nohle+watch-multidevice@chromium.org', 'themaxli+watch-multidevice@chromium.org', 'vecore+watch-multidevice@google.com'], + 'multipaste': ['andrewxu+watch-multipaste@google.com', + 'dmblack+watch-multipaste@google.com', + 'newcomer+watch-multipaste@google.com'], 'nacl': ['native-client-reviews@googlegroups.com'], 'native_client_sdk': ['binji+watch@chromium.org', 'sbc@chromium.org'],
diff --git a/android_webview/browser/aw_field_trials.cc b/android_webview/browser/aw_field_trials.cc index 248e204..8c5ff99 100644 --- a/android_webview/browser/aw_field_trials.cc +++ b/android_webview/browser/aw_field_trials.cc
@@ -12,11 +12,10 @@ void AwFieldTrials::SetupFieldTrials() { // https://crbug.com/1093420: enable for persistent metrics. - if (base::FeatureList::IsEnabled(base::kPersistentHistogramsFeature)) { - // Persistent histograms must be enabled as soon as possible. - base::FilePath metrics_dir; - if (base::PathService::Get(base::DIR_ANDROID_APP_DATA, &metrics_dir)) { - InstantiatePersistentHistograms(metrics_dir); - } + // Persistent histograms must be enabled as soon as possible. + base::FilePath metrics_dir; + if (base::PathService::Get(base::DIR_ANDROID_APP_DATA, &metrics_dir)) { + InstantiatePersistentHistograms(metrics_dir, + /*default_local_memory=*/true); } }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/devui/CrashesListFragmentTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/devui/CrashesListFragmentTest.java index deee8e9..b3b9220 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/devui/CrashesListFragmentTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/devui/CrashesListFragmentTest.java
@@ -35,6 +35,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -49,6 +50,7 @@ import androidx.test.espresso.intent.matcher.IntentMatchers; import androidx.test.espresso.intent.rule.IntentsTestRule; import androidx.test.filters.LargeTest; +import androidx.test.filters.MediumTest; import org.hamcrest.Description; import org.hamcrest.Matcher; @@ -59,6 +61,7 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.chromium.android_webview.common.PlatformServiceBridge; import org.chromium.android_webview.common.crash.CrashInfo; import org.chromium.android_webview.common.crash.CrashInfo.UploadState; import org.chromium.android_webview.common.crash.CrashUploadUtil; @@ -67,8 +70,11 @@ import org.chromium.android_webview.devui.CrashesListFragment; import org.chromium.android_webview.devui.MainActivity; import org.chromium.android_webview.devui.R; +import org.chromium.android_webview.devui.WebViewPackageError; import org.chromium.android_webview.devui.util.CrashBugUrlFactory; +import org.chromium.android_webview.devui.util.WebViewPackageHelper; import org.chromium.android_webview.test.AwJUnit4ClassRunner; +import org.chromium.base.Callback; import org.chromium.base.FileUtils; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.Feature; @@ -79,6 +85,8 @@ import java.io.FileWriter; import java.io.IOException; import java.util.Date; +import java.util.List; +import java.util.Locale; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -100,8 +108,11 @@ public void tearDown() { FileUtils.recursivelyDeleteFile(SystemWideCrashDirectories.getWebViewCrashDir(), null); FileUtils.recursivelyDeleteFile(SystemWideCrashDirectories.getWebViewCrashLogDir(), null); - // Tests are responsible for verifying every Intent they trigger. - assertNoUnverifiedIntents(); + // Activity is launched, i.e the test is not skipped. + if (mRule.getActivity() != null) { + // Tests are responsible for verifying every Intent they trigger. + assertNoUnverifiedIntents(); + } } private void launchCrashesFragment() { @@ -293,6 +304,26 @@ return bodyDataInteraction; } + private static class TestPlatformServiceBridge extends PlatformServiceBridge { + private boolean mCanUseGms; + private boolean mUserConsent; + + TestPlatformServiceBridge(boolean canUseGms, boolean userConsent) { + mCanUseGms = canUseGms; + mUserConsent = userConsent; + } + + @Override + public boolean canUseGms() { + return mCanUseGms; + } + + @Override + public void queryMetricsSetting(Callback<Boolean> callback) { + callback.onResult(mUserConsent); + } + } + @Test @Feature({"AndroidWebView"}) public void testShowingSingleCrashReport_uploaded() throws Throwable { @@ -859,4 +890,120 @@ // This a pending upload, nothing should be copied assertThat(getClipBoardTextOnUiThread(context), is("")); } + + @Test + @MediumTest + @Feature({"AndroidWebView"}) + public void testConsentErrorMessage_notShown_differentWebViewPackageIsShown() throws Throwable { + Context context = InstrumentationRegistry.getTargetContext(); + // Inject a dummy PackageInfo as the current WebView package to make sure it will always be + // different from the test's app package. + WebViewPackageHelper.setCurrentWebViewPackageForTesting( + HomeFragmentTest.FAKE_WEBVIEW_PACKAGE); + PlatformServiceBridge.injectInstance( + new TestPlatformServiceBridge(/*canUseGms=*/true, /*userConsent=*/false)); + launchCrashesFragment(); + + String expectedErrorMessage = String.format(Locale.US, + WebViewPackageError.DIFFERENT_WEBVIEW_PROVIDER_ERROR_MESSAGE, + WebViewPackageHelper.loadLabel(context)); + onView(withId(R.id.main_error_view)).check(matches(isDisplayed())); + onView(withId(R.id.error_text)).check(matches(withText(expectedErrorMessage))); + } + + @Test + @MediumTest + @Feature({"AndroidWebView"}) + public void testConsentErrorMessage_notShown_userConsented() throws Throwable { + Context context = InstrumentationRegistry.getTargetContext(); + // Inject test app package as the current WebView package. + WebViewPackageHelper.setCurrentWebViewPackageForTesting( + WebViewPackageHelper.getContextPackageInfo(context)); + PlatformServiceBridge.injectInstance( + new TestPlatformServiceBridge(/*canUseGms=*/true, /*userConsent=*/true)); + launchCrashesFragment(); + + onView(withId(R.id.main_error_view)).check(matches(not(isDisplayed()))); + } + + @Test + @MediumTest + @Feature({"AndroidWebView"}) + public void testConsentErrorMessage_shown_canUseGms() throws Throwable { + Context context = InstrumentationRegistry.getTargetContext(); + + Intent settingsIntent = + new Intent(CrashesListFragment.USAGE_AND_DIAGONSTICS_ACTIVITY_INTENT_ACTION); + List<ResolveInfo> intentResolveInfo = + context.getPackageManager().queryIntentActivities(settingsIntent, 0); + Assume.assumeTrue( + "This test assumes \"usage& diagonstics\" settings can be found on the device", + intentResolveInfo.size() > 0); + + // Inject test app package as the current WebView package. + WebViewPackageHelper.setCurrentWebViewPackageForTesting( + WebViewPackageHelper.getContextPackageInfo(context)); + PlatformServiceBridge.injectInstance( + new TestPlatformServiceBridge(/*canUseGms=*/true, /*userConsent=*/false)); + launchCrashesFragment(); + + onView(withId(R.id.main_error_view)).check(matches(isDisplayed())); + onView(withId(R.id.error_text)) + .check(matches( + withText(CrashesListFragment.CRASH_COLLECTION_DISABLED_ERROR_MESSAGE))); + onView(withId(R.id.action_button)) + .check(matches(withText("Open Settings"))) + .perform(click()); + intended(IntentMatchers.hasAction( + CrashesListFragment.USAGE_AND_DIAGONSTICS_ACTIVITY_INTENT_ACTION)); + } + + @Test + @MediumTest + @Feature({"AndroidWebView"}) + public void testConsentErrorMessage_shown_onlyInCrashFragment() throws Throwable { + Context context = InstrumentationRegistry.getTargetContext(); + // Inject test app package as the current WebView package. + WebViewPackageHelper.setCurrentWebViewPackageForTesting( + WebViewPackageHelper.getContextPackageInfo(context)); + PlatformServiceBridge.injectInstance( + new TestPlatformServiceBridge(/*canUseGms=*/true, /*userConsent=*/false)); + launchCrashesFragment(); + + onView(withId(R.id.main_error_view)).check(matches(isDisplayed())); + onView(withId(R.id.error_text)) + .check(matches( + withText(CrashesListFragment.CRASH_COLLECTION_DISABLED_ERROR_MESSAGE))); + + // CrashesListFragment -> FlagsFragment (Not shown) + onView(withId(R.id.navigation_flags_ui)).perform(click()); + onView(withId(R.id.main_error_view)).check(matches(not(isDisplayed()))); + // FlagsFragment -> HomeFragment (Not shown) + onView(withId(R.id.navigation_home)).perform(click()); + onView(withId(R.id.main_error_view)).check(matches(not(isDisplayed()))); + // HomeFragment -> CrashesListFragment (shown again) + onView(withId(R.id.navigation_crash_ui)).perform(click()); + onView(withId(R.id.main_error_view)).check(matches(isDisplayed())); + onView(withId(R.id.error_text)) + .check(matches( + withText(CrashesListFragment.CRASH_COLLECTION_DISABLED_ERROR_MESSAGE))); + } + + @Test + @MediumTest + @Feature({"AndroidWebView"}) + public void testConsentErrorMessage_shown_cannotUseGms() throws Throwable { + Context context = InstrumentationRegistry.getTargetContext(); + // Inject test app package as the current WebView package. + WebViewPackageHelper.setCurrentWebViewPackageForTesting( + WebViewPackageHelper.getContextPackageInfo(context)); + PlatformServiceBridge.injectInstance( + new TestPlatformServiceBridge(/*canUseGms=*/false, /*userConsent=*/false)); + launchCrashesFragment(); + + onView(withId(R.id.main_error_view)).check(matches(isDisplayed())); + onView(withId(R.id.error_text)) + .check(matches(withText(CrashesListFragment.NO_GMS_ERROR_MESSAGE))); + onView(withId(R.id.action_button)).check(matches(not(isDisplayed()))); + } }
diff --git a/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/CrashesListFragment.java b/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/CrashesListFragment.java index 06a2c5d..cea10c8 100644 --- a/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/CrashesListFragment.java +++ b/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/CrashesListFragment.java
@@ -68,6 +68,14 @@ public static final String NO_WIFI_DIALOG_MESSAGE = "You are connected to a metered network or cellular data." + " Do you want to proceed?"; + public static final String CRASH_COLLECTION_DISABLED_ERROR_MESSAGE = + "Crash collection is disabled. Please turn on 'Usage & diagnostics' " + + "from the three-dotted menu in Google settings."; + public static final String NO_GMS_ERROR_MESSAGE = + "Crash collection is not supported at the moment."; + + public static final String USAGE_AND_DIAGONSTICS_ACTIVITY_INTENT_ACTION = + "com.android.settings.action.EXTRA_SETTINGS"; // Max number of crashes to show in the crashes list. public static final int MAX_CRASHES_NUMBER = 20; @@ -484,11 +492,10 @@ private void buildCrashConsentError(PersistentErrorView errorView) { if (PlatformServiceBridge.getInstance().canUseGms()) { - errorView.setText("Crash collection is disabled. Please turn on 'Usage & diagnostics' " - + "from the three-dotted menu in Google settings."); + errorView.setText(CRASH_COLLECTION_DISABLED_ERROR_MESSAGE); // Open Google Settings activity, "Usage & diagnostics" activity is not exported and // cannot be opened directly. - Intent settingsIntent = new Intent("com.android.settings.action.EXTRA_SETTINGS"); + Intent settingsIntent = new Intent(USAGE_AND_DIAGONSTICS_ACTIVITY_INTENT_ACTION); List<ResolveInfo> intentResolveInfo = mContext.getPackageManager().queryIntentActivities(settingsIntent, 0); // Show a button to open GMS settings activity only if it exists. @@ -502,7 +509,7 @@ } } else { logCrashCollectionState(CollectionState.DISABLED_CANNOT_USE_GMS); - errorView.setText("Crash collection is not supported at the moment."); + errorView.setText(NO_GMS_ERROR_MESSAGE); } }
diff --git a/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/WebViewPackageError.java b/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/WebViewPackageError.java index 22c727f2..ac9cbbf7d 100644 --- a/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/WebViewPackageError.java +++ b/android_webview/nonembedded/java/src/org/chromium/android_webview/devui/WebViewPackageError.java
@@ -35,7 +35,7 @@ public static final String CHANGE_WEBVIEW_PROVIDER_BUTTON_TEXT = "Change provider"; // The developer UI application label should be used in the placeholder. public static final String DIFFERENT_WEBVIEW_PROVIDER_ERROR_MESSAGE = - "%s is not the system's current selected WebView provider"; + "%s is not the system's currently selected WebView provider"; // The developer UI application label should be used in the placeholder. public static final String DIFFERENT_WEBVIEW_PROVIDER_DIALOG_MESSAGE = "You are using DevTools for (%s) which is not the system's currently selected "
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index eb0f710e..6beb4cb 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -272,6 +272,8 @@ "capture_mode/stop_recording_button_tray.cc", "capture_mode/stop_recording_button_tray.h", "capture_mode/view_with_ink_drop.h", + "child_accounts/parent_access_controller_impl.cc", + "child_accounts/parent_access_controller_impl.h", "clipboard/clipboard_history.cc", "clipboard/clipboard_history.h", "clipboard/clipboard_history_controller.cc", @@ -541,8 +543,6 @@ "lock_screen_action/lock_screen_note_launcher.h", "login/login_screen_controller.cc", "login/login_screen_controller.h", - "login/parent_access_controller.cc", - "login/parent_access_controller.h", "login/security_token_request_controller.cc", "login/security_token_request_controller.h", "login/ui/access_code_input.cc", @@ -1016,6 +1016,8 @@ "system/model/update_model.h", "system/model/virtual_keyboard_model.cc", "system/model/virtual_keyboard_model.h", + "system/nearby_share/nearby_share_controller_impl.cc", + "system/nearby_share/nearby_share_controller_impl.h", "system/network/active_network_icon.cc", "system/network/active_network_icon.h", "system/network/auto_connect_notifier.cc", @@ -1862,6 +1864,7 @@ "autoclick/autoclick_drag_event_rewriter_unittest.cc", "autoclick/autoclick_unittest.cc", "capture_mode/capture_mode_unittests.cc", + "child_accounts/parent_access_controller_impl_unittest.cc", "clipboard/clipboard_history_resource_manager_unittest.cc", "clipboard/clipboard_history_unittest.cc", "clipboard/clipboard_history_util_unittest.cc", @@ -1938,7 +1941,6 @@ "login/login_screen_controller_unittest.cc", "login/mock_login_screen_client.cc", "login/mock_login_screen_client.h", - "login/parent_access_controller_unittest.cc", "login/security_token_request_controller_unittest.cc", "login/ui/fake_login_detachable_base_model.cc", "login/ui/fake_login_detachable_base_model.h",
diff --git a/ash/child_accounts/OWNERS b/ash/child_accounts/OWNERS new file mode 100644 index 0000000..3c504a4 --- /dev/null +++ b/ash/child_accounts/OWNERS
@@ -0,0 +1,3 @@ +agawronska@chromium.org +llin@chromium.org +michaelpg@chromium.org \ No newline at end of file
diff --git a/ash/login/parent_access_controller.cc b/ash/child_accounts/parent_access_controller_impl.cc similarity index 71% rename from ash/login/parent_access_controller.cc rename to ash/child_accounts/parent_access_controller_impl.cc index 6988c69..cb4dbe1f 100644 --- a/ash/login/parent_access_controller.cc +++ b/ash/child_accounts/parent_access_controller_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/login/parent_access_controller.h" +#include "ash/child_accounts/parent_access_controller_impl.h" #include "ash/login/login_screen_controller.h" #include "ash/session/session_controller_impl.h" @@ -66,19 +66,19 @@ } // namespace -ParentAccessController::ParentAccessController() {} +ParentAccessControllerImpl::ParentAccessControllerImpl() {} -ParentAccessController::~ParentAccessController() = default; +ParentAccessControllerImpl::~ParentAccessControllerImpl() = default; // static -constexpr char ParentAccessController::kUMAParentAccessCodeAction[]; +constexpr char ParentAccessControllerImpl::kUMAParentAccessCodeAction[]; // static -constexpr char ParentAccessController::kUMAParentAccessCodeUsage[]; +constexpr char ParentAccessControllerImpl::kUMAParentAccessCodeUsage[]; -void RecordParentAccessAction(ParentAccessController::UMAAction action) { - UMA_HISTOGRAM_ENUMERATION(ParentAccessController::kUMAParentAccessCodeAction, - action); +void RecordParentAccessAction(ParentAccessControllerImpl::UMAAction action) { + UMA_HISTOGRAM_ENUMERATION( + ParentAccessControllerImpl::kUMAParentAccessCodeAction, action); } void RecordParentAccessUsage(const AccountId& child_account_id, @@ -86,40 +86,41 @@ switch (action) { case SupervisedAction::kUnlockTimeLimits: { UMA_HISTOGRAM_ENUMERATION( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kTimeLimits); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kTimeLimits); return; } case SupervisedAction::kUpdateClock: { bool is_login = Shell::Get()->session_controller()->GetSessionState() == session_manager::SessionState::LOGIN_PRIMARY; UMA_HISTOGRAM_ENUMERATION( - ParentAccessController::kUMAParentAccessCodeUsage, - is_login ? ParentAccessController::UMAUsage::kTimeChangeLoginScreen - : ParentAccessController::UMAUsage::kTimeChangeInSession); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + is_login + ? ParentAccessControllerImpl::UMAUsage::kTimeChangeLoginScreen + : ParentAccessControllerImpl::UMAUsage::kTimeChangeInSession); return; } case SupervisedAction::kUpdateTimezone: { UMA_HISTOGRAM_ENUMERATION( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kTimezoneChange); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kTimezoneChange); return; } case SupervisedAction::kAddUser: UMA_HISTOGRAM_ENUMERATION( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kAddUserLoginScreen); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kAddUserLoginScreen); return; case SupervisedAction::kReauth: UMA_HISTOGRAM_ENUMERATION( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kReauhLoginScreen); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kReauhLoginScreen); return; } NOTREACHED() << "Unknown SupervisedAction"; } -PinRequestView::SubmissionResult ParentAccessController::OnPinSubmitted( +PinRequestView::SubmissionResult ParentAccessControllerImpl::OnPinSubmitted( const std::string& pin) { bool pin_is_valid = Shell::Get()->login_screen_controller()->ValidateParentAccessCode( @@ -128,12 +129,13 @@ if (pin_is_valid) { VLOG(1) << "Parent access code successfully validated"; RecordParentAccessAction( - ParentAccessController::UMAAction::kValidationSuccess); + ParentAccessControllerImpl::UMAAction::kValidationSuccess); return PinRequestView::SubmissionResult::kPinAccepted; } VLOG(1) << "Invalid parent access code entered"; - RecordParentAccessAction(ParentAccessController::UMAAction::kValidationError); + RecordParentAccessAction( + ParentAccessControllerImpl::UMAAction::kValidationError); PinRequestWidget::Get()->UpdateState( PinRequestViewState::kError, l10n_util::GetStringUTF16(IDS_ASH_LOGIN_PARENT_ACCESS_TITLE_ERROR), @@ -141,12 +143,13 @@ return PinRequestView::SubmissionResult::kPinError; } -void ParentAccessController::OnBack() { - RecordParentAccessAction(ParentAccessController::UMAAction::kCanceledByUser); +void ParentAccessControllerImpl::OnBack() { + RecordParentAccessAction( + ParentAccessControllerImpl::UMAAction::kCanceledByUser); } -void ParentAccessController::OnHelp(gfx::NativeWindow parent_window) { - RecordParentAccessAction(ParentAccessController::UMAAction::kGetHelp); +void ParentAccessControllerImpl::OnHelp(gfx::NativeWindow parent_window) { + RecordParentAccessAction(ParentAccessControllerImpl::UMAAction::kGetHelp); // TODO(https://crbug.com/999387): Remove this when handling touch // cancellation is fixed for system modal windows. base::ThreadTaskRunnerHandle::Get()->PostTask( @@ -159,7 +162,7 @@ parent_window)); } -bool ParentAccessController::ShowWidget( +bool ParentAccessControllerImpl::ShowWidget( const AccountId& child_account_id, PinRequest::OnPinRequestDone on_exit_callback, SupervisedAction action,
diff --git a/ash/child_accounts/parent_access_controller_impl.h b/ash/child_accounts/parent_access_controller_impl.h new file mode 100644 index 0000000..62fe66d --- /dev/null +++ b/ash/child_accounts/parent_access_controller_impl.h
@@ -0,0 +1,84 @@ +// Copyright 2020 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 ASH_CHILD_ACCOUNTS_PARENT_ACCESS_CONTROLLER_IMPL_H_ +#define ASH_CHILD_ACCOUNTS_PARENT_ACCESS_CONTROLLER_IMPL_H_ + +#include "ash/login/ui/pin_request_view.h" +#include "ash/login/ui/pin_request_widget.h" +#include "ash/public/cpp/child_accounts/parent_access_controller.h" +#include "base/memory/weak_ptr.h" +#include "base/time/time.h" +#include "components/account_id/account_id.h" + +namespace ash { + +// Implementation of ParentAccessController. It serves as a single point of +// access for PIN requests regarding parent access. It takes care of showing and +// hiding the PIN UI, as well as logging usage metrics. +class ASH_EXPORT ParentAccessControllerImpl : public ParentAccessController, + public PinRequestView::Delegate { + public: + // Actions that originated in parent access dialog. These values are persisted + // to metrics. Entries should not be renumbered and numeric values should + // never be reused. + enum class UMAAction { + kValidationSuccess = 0, + kValidationError = 1, + kCanceledByUser = 2, + kGetHelp = 3, + kMaxValue = kGetHelp, + }; + + // Context in which parent access code was used. These values are persisted to + // metrics. Entries should not be reordered and numeric values should never be + // reused. + enum class UMAUsage { + kTimeLimits = 0, + kTimeChangeLoginScreen = 1, + kTimeChangeInSession = 2, + kTimezoneChange = 3, + kAddUserLoginScreen = 4, + kReauhLoginScreen = 5, + kMaxValue = kReauhLoginScreen, + }; + + // Histogram to log actions that originated in parent access dialog. + static constexpr char kUMAParentAccessCodeAction[] = + "Supervision.ParentAccessCode.Action"; + + // Histogram to log context in which parent access code was used. + static constexpr char kUMAParentAccessCodeUsage[] = + "Supervision.ParentAccessCode.Usage"; + + ParentAccessControllerImpl(); + ParentAccessControllerImpl(const ParentAccessControllerImpl&) = delete; + ParentAccessControllerImpl& operator=(const ParentAccessControllerImpl&) = + delete; + ~ParentAccessControllerImpl() override; + + // PinRequestView::Delegate: + PinRequestView::SubmissionResult OnPinSubmitted( + const std::string& pin) override; + void OnBack() override; + void OnHelp(gfx::NativeWindow parent_window) override; + + // ParentAccessController: + bool ShowWidget(const AccountId& child_account_id, + PinRequest::OnPinRequestDone on_exit_callback, + SupervisedAction action, + bool extra_dimmer, + base::Time validation_time) override; + + private: + AccountId account_id_; + SupervisedAction action_ = SupervisedAction::kUnlockTimeLimits; + base::Time validation_time_; + + base::WeakPtrFactory<ParentAccessControllerImpl> weak_factory_{this}; +}; + +} // namespace ash + +#endif // ASH_CHILD_ACCOUNTS_PARENT_ACCESS_CONTROLLER_IMPL_H_
diff --git a/ash/login/parent_access_controller_unittest.cc b/ash/child_accounts/parent_access_controller_impl_unittest.cc similarity index 67% rename from ash/login/parent_access_controller_unittest.cc rename to ash/child_accounts/parent_access_controller_impl_unittest.cc index a499742..7948ea6 100644 --- a/ash/login/parent_access_controller_unittest.cc +++ b/ash/child_accounts/parent_access_controller_impl_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/login/parent_access_controller.h" +#include "ash/child_accounts/parent_access_controller_impl.h" #include "ash/login/mock_login_screen_client.h" #include "ash/login/ui/login_button.h" @@ -22,17 +22,16 @@ using ::testing::_; -class ParentAccessControllerTest : public LoginTestBase { +class ParentAccessControllerImplTest : public LoginTestBase { protected: - ParentAccessControllerTest() + ParentAccessControllerImplTest() : account_id_(AccountId::FromUserEmail("child@gmail.com")) {} - ~ParentAccessControllerTest() override = default; + ~ParentAccessControllerImplTest() override = default; // LoginScreenTest: void SetUp() override { LoginTestBase::SetUp(); login_client_ = std::make_unique<MockLoginScreenClient>(); - controller_ = std::make_unique<ParentAccessController>(); } void TearDown() override { @@ -63,9 +62,9 @@ void StartParentAccess(const AccountId& account_id, SupervisedAction action) { validation_time_ = base::Time::Now(); - controller_->ShowWidget( + ash::ParentAccessController::Get()->ShowWidget( account_id, - base::BindOnce(&ParentAccessControllerTest::OnFinished, + base::BindOnce(&ParentAccessControllerImplTest::OnFinished, base::Unretained(this)), action, false, validation_time_); view_ = @@ -73,14 +72,14 @@ } // Verifies expectation that UMA |action| was logged. - void ExpectUMAActionReported(ParentAccessController::UMAAction action, + void ExpectUMAActionReported(ParentAccessControllerImpl::UMAAction action, int bucket_count, int total_count) { histogram_tester_.ExpectBucketCount( - ParentAccessController::kUMAParentAccessCodeAction, action, + ParentAccessControllerImpl::kUMAParentAccessCodeAction, action, bucket_count); histogram_tester_.ExpectTotalCount( - ParentAccessController::kUMAParentAccessCodeAction, total_count); + ParentAccessControllerImpl::kUMAParentAccessCodeAction, total_count); } // Simulates entering a code. |success| determines whether the code will be @@ -99,8 +98,6 @@ } } - std::unique_ptr<ParentAccessController> controller_; - const AccountId account_id_; std::unique_ptr<MockLoginScreenClient> login_client_; @@ -118,12 +115,12 @@ PinRequestView* view_ = nullptr; // Owned by test widget view hierarchy. private: - DISALLOW_COPY_AND_ASSIGN(ParentAccessControllerTest); + DISALLOW_COPY_AND_ASSIGN(ParentAccessControllerImplTest); }; // Tests parent access dialog showing/hiding and focus behavior for parent // access. -TEST_F(ParentAccessControllerTest, ParentAccessDialogFocus) { +TEST_F(ParentAccessControllerImplTest, ParentAccessDialogFocus) { EXPECT_FALSE(PinRequestWidget::Get()); StartParentAccess(); @@ -139,105 +136,106 @@ } // Tests correct UMA reporting for parent access. -TEST_F(ParentAccessControllerTest, ParentAccessUMARecording) { +TEST_F(ParentAccessControllerImplTest, ParentAccessUMARecording) { StartParentAccess(SupervisedAction::kUnlockTimeLimits); histogram_tester_.ExpectBucketCount( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kTimeLimits, 1); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kTimeLimits, 1); SimulateButtonPress(PinRequestView::TestApi(view_).back_button()); - ExpectUMAActionReported(ParentAccessController::UMAAction::kCanceledByUser, 1, - 1); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kCanceledByUser, 1, 1); StartParentAccess(SupervisedAction::kUpdateTimezone); histogram_tester_.ExpectBucketCount( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kTimezoneChange, 1); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kTimezoneChange, 1); SimulateButtonPress(PinRequestView::TestApi(view_).back_button()); - ExpectUMAActionReported(ParentAccessController::UMAAction::kCanceledByUser, 2, - 2); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kCanceledByUser, 2, 2); // The below usage depends on the session state. GetSessionControllerClient()->SetSessionState( session_manager::SessionState::ACTIVE); StartParentAccess(SupervisedAction::kUpdateClock); histogram_tester_.ExpectBucketCount( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kTimeChangeInSession, 1); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kTimeChangeInSession, 1); SimulateButtonPress(PinRequestView::TestApi(view_).back_button()); - ExpectUMAActionReported(ParentAccessController::UMAAction::kCanceledByUser, 3, - 3); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kCanceledByUser, 3, 3); GetSessionControllerClient()->SetSessionState( session_manager::SessionState::LOGIN_PRIMARY); StartParentAccess(SupervisedAction::kUpdateClock); histogram_tester_.ExpectBucketCount( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kTimeChangeLoginScreen, 1); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kTimeChangeLoginScreen, 1); SimulateButtonPress(PinRequestView::TestApi(view_).back_button()); - ExpectUMAActionReported(ParentAccessController::UMAAction::kCanceledByUser, 4, - 4); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kCanceledByUser, 4, 4); GetSessionControllerClient()->SetSessionState( session_manager::SessionState::ACTIVE); StartParentAccess(SupervisedAction::kUpdateClock); histogram_tester_.ExpectBucketCount( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kTimeChangeInSession, 2); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kTimeChangeInSession, 2); SimulateButtonPress(PinRequestView::TestApi(view_).back_button()); - ExpectUMAActionReported(ParentAccessController::UMAAction::kCanceledByUser, 5, - 5); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kCanceledByUser, 5, 5); GetSessionControllerClient()->SetSessionState( session_manager::SessionState::LOGIN_PRIMARY); StartParentAccess(SupervisedAction::kReauth); histogram_tester_.ExpectBucketCount( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kReauhLoginScreen, 1); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kReauhLoginScreen, 1); SimulateButtonPress(PinRequestView::TestApi(view_).back_button()); - ExpectUMAActionReported(ParentAccessController::UMAAction::kCanceledByUser, 6, - 6); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kCanceledByUser, 6, 6); GetSessionControllerClient()->SetSessionState( session_manager::SessionState::LOGIN_PRIMARY); StartParentAccess(EmptyAccountId(), SupervisedAction::kAddUser); histogram_tester_.ExpectBucketCount( - ParentAccessController::kUMAParentAccessCodeUsage, - ParentAccessController::UMAUsage::kAddUserLoginScreen, 1); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, + ParentAccessControllerImpl::UMAUsage::kAddUserLoginScreen, 1); SimulateButtonPress(PinRequestView::TestApi(view_).back_button()); - ExpectUMAActionReported(ParentAccessController::UMAAction::kCanceledByUser, 7, - 7); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kCanceledByUser, 7, 7); histogram_tester_.ExpectTotalCount( - ParentAccessController::kUMAParentAccessCodeUsage, 7); + ParentAccessControllerImpl::kUMAParentAccessCodeUsage, 7); EXPECT_EQ(7, back_action_); } // Tests successful parent access validation flow. -TEST_F(ParentAccessControllerTest, ParentAccessSuccessfulValidation) { +TEST_F(ParentAccessControllerImplTest, ParentAccessSuccessfulValidation) { StartParentAccess(); SimulateValidation(true); EXPECT_EQ(1, successful_validation_); - ExpectUMAActionReported(ParentAccessController::UMAAction::kValidationSuccess, - 1, 1); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kValidationSuccess, 1, 1); } // Tests unsuccessful parent access flow, including help button and cancelling // the request. -TEST_F(ParentAccessControllerTest, ParentAccessUnsuccessfulValidation) { +TEST_F(ParentAccessControllerImplTest, ParentAccessUnsuccessfulValidation) { StartParentAccess(); SimulateValidation(false); - ExpectUMAActionReported(ParentAccessController::UMAAction::kValidationError, - 1, 1); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kValidationError, 1, 1); EXPECT_CALL(*login_client_, ShowParentAccessHelpApp(_)).Times(1); SimulateButtonPress(PinRequestView::TestApi(view_).help_button()); - ExpectUMAActionReported(ParentAccessController::UMAAction::kGetHelp, 1, 2); + ExpectUMAActionReported(ParentAccessControllerImpl::UMAAction::kGetHelp, 1, + 2); SimulateButtonPress(PinRequestView::TestApi(view_).back_button()); - ExpectUMAActionReported(ParentAccessController::UMAAction::kCanceledByUser, 1, - 3); + ExpectUMAActionReported( + ParentAccessControllerImpl::UMAAction::kCanceledByUser, 1, 3); } } // namespace
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc index a830052..ba3ed011e 100644 --- a/ash/login/login_screen_controller.cc +++ b/ash/login/login_screen_controller.cc
@@ -7,12 +7,10 @@ #include <utility> #include "ash/focus_cycler.h" -#include "ash/login/parent_access_controller.h" #include "ash/login/security_token_request_controller.h" #include "ash/login/ui/lock_screen.h" #include "ash/login/ui/login_data_dispatcher.h" #include "ash/public/cpp/ash_pref_names.h" -#include "ash/public/cpp/child_accounts/parent_access_controller.h" #include "ash/public/cpp/login_screen_client.h" #include "ash/public/cpp/toast_data.h" #include "ash/root_window_controller.h" @@ -351,18 +349,6 @@ ->GetScopedGuestButtonBlocker(); } -void LoginScreenController::ShowParentAccessWidget( - const AccountId& child_account_id, - base::OnceCallback<void(bool success)> callback, - SupervisedAction action, - bool extra_dimmer, - base::Time validation_time) { - DCHECK(!PinRequestWidget::Get()); - Shell::Get()->parent_access_controller()->ShowWidget( - child_account_id, std::move(callback), action, extra_dimmer, - validation_time); -} - void LoginScreenController::RequestSecurityTokenPin( SecurityTokenPinRequest request) { security_token_request_controller_.SetPinUiState(std::move(request));
diff --git a/ash/login/login_screen_controller.h b/ash/login/login_screen_controller.h index f53e8ca2..a885dc6 100644 --- a/ash/login/login_screen_controller.h +++ b/ash/login/login_screen_controller.h
@@ -118,14 +118,6 @@ std::unique_ptr<ScopedGuestButtonBlocker> GetScopedGuestButtonBlocker() override; - // TODO(agawronska): Change all callers of this to use - // Shell::Get()->parent_access_controller()->ShowWidget() directly and delete - // this method. - void ShowParentAccessWidget(const AccountId& child_account_id, - base::OnceCallback<void(bool success)> callback, - SupervisedAction action, - bool extra_dimmer, - base::Time validation_time) override; void RequestSecurityTokenPin(SecurityTokenPinRequest request) override; void ClearSecurityTokenPinRequest() override; bool SetLoginShelfGestureHandler(const base::string16& nudge_text,
diff --git a/ash/login/parent_access_controller.h b/ash/login/parent_access_controller.h deleted file mode 100644 index 33147b2..0000000 --- a/ash/login/parent_access_controller.h +++ /dev/null
@@ -1,96 +0,0 @@ -// Copyright 2020 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 ASH_LOGIN_PARENT_ACCESS_CONTROLLER_H_ -#define ASH_LOGIN_PARENT_ACCESS_CONTROLLER_H_ - -#include "ash/login/ui/pin_request_view.h" -#include "ash/login/ui/pin_request_widget.h" -#include "ash/public/cpp/child_accounts/parent_access_controller.h" - -namespace ash { - -// ParentAccessController serves as a single point of access for PIN requests -// regarding parent access. It takes care of showing and hiding the PIN UI, as -// well as logging usage metrics. -class ASH_EXPORT ParentAccessController : PinRequestView::Delegate { - public: - // Actions that originated in parent access dialog. These values are persisted - // to metrics. Entries should not be renumbered and numeric values should - // never be reused. - enum class UMAAction { - kValidationSuccess = 0, - kValidationError = 1, - kCanceledByUser = 2, - kGetHelp = 3, - kMaxValue = kGetHelp, - }; - - // Context in which parent access code was used. These values are persisted to - // metrics. Entries should not be reordered and numeric values should never be - // reused. - enum class UMAUsage { - kTimeLimits = 0, - kTimeChangeLoginScreen = 1, - kTimeChangeInSession = 2, - kTimezoneChange = 3, - kAddUserLoginScreen = 4, - kReauhLoginScreen = 5, - kMaxValue = kReauhLoginScreen, - }; - - // Histogram to log actions that originated in parent access dialog. - static constexpr char kUMAParentAccessCodeAction[] = - "Supervision.ParentAccessCode.Action"; - - // Histogram to log context in which parent access code was used. - static constexpr char kUMAParentAccessCodeUsage[] = - "Supervision.ParentAccessCode.Usage"; - - ParentAccessController(); - ParentAccessController(const ParentAccessController&) = delete; - ParentAccessController& operator=(const ParentAccessController&) = delete; - ~ParentAccessController() override; - - // PinRequestView::Delegate interface. - PinRequestView::SubmissionResult OnPinSubmitted( - const std::string& pin) override; - void OnBack() override; - void OnHelp(gfx::NativeWindow parent_window) override; - - // Shows a standalone parent access dialog. If |child_account_id| is valid, it - // validates the parent access code for that child only, when it is empty it - // validates the code for any child signed in the device. - // |on_exit_callback| is invoked when the back button is clicked or the - // correct code is entered. - // |action| contains information about why the parent - // access view is necessary, it is used to modify the view appearance by - // changing the title and description strings and background color. - // The parent access widget is a modal and already contains a dimmer, however - // when another modal is the parent of the widget, the dimmer will be placed - // behind the two windows. - // |extra_dimmer| will create an extra dimmer between the two. - // |validation_time| is the time that will be used to validate the - // code, if null the system's time will be used. Note: this is intended for - // children only. If a non child account id is provided, the validation will - // necessarily fail. - // Returns whether opening the dialog was successful. Will fail if another PIN - // dialog is already opened. - bool ShowWidget(const AccountId& child_account_id, - PinRequest::OnPinRequestDone on_exit_callback, - SupervisedAction action, - bool extra_dimmer, - base::Time validation_time); - - private: - AccountId account_id_; - SupervisedAction action_ = SupervisedAction::kUnlockTimeLimits; - base::Time validation_time_; - - base::WeakPtrFactory<ParentAccessController> weak_factory_{this}; -}; - -} // namespace ash - -#endif // ASH_LOGIN_PARENT_ACCESS_CONTROLLER_H_
diff --git a/ash/login/ui/lock_contents_view.cc b/ash/login/ui/lock_contents_view.cc index 201d479..f26e093 100644 --- a/ash/login/ui/lock_contents_view.cc +++ b/ash/login/ui/lock_contents_view.cc
@@ -13,7 +13,6 @@ #include "ash/focus_cycler.h" #include "ash/ime/ime_controller_impl.h" #include "ash/login/login_screen_controller.h" -#include "ash/login/parent_access_controller.h" #include "ash/login/ui/bottom_status_indicator.h" #include "ash/login/ui/lock_screen.h" #include "ash/login/ui/lock_screen_media_controls_view.h"
diff --git a/ash/login/ui/lock_contents_view_unittest.cc b/ash/login/ui/lock_contents_view_unittest.cc index 12d7e72..f593ce4 100644 --- a/ash/login/ui/lock_contents_view_unittest.cc +++ b/ash/login/ui/lock_contents_view_unittest.cc
@@ -9,10 +9,10 @@ #include <unordered_set> #include <utility> +#include "ash/child_accounts/parent_access_controller_impl.h" #include "ash/detachable_base/detachable_base_pairing_status.h" #include "ash/login/login_screen_controller.h" #include "ash/login/mock_login_screen_client.h" -#include "ash/login/parent_access_controller.h" #include "ash/login/ui/arrow_button_view.h" #include "ash/login/ui/fake_login_detachable_base_model.h" #include "ash/login/ui/lock_screen.h"
diff --git a/ash/public/cpp/BUILD.gn b/ash/public/cpp/BUILD.gn index b851f7d..cbdf588 100644 --- a/ash/public/cpp/BUILD.gn +++ b/ash/public/cpp/BUILD.gn
@@ -114,6 +114,7 @@ "caption_buttons/snap_controller.h", "cast_config_controller.cc", "cast_config_controller.h", + "child_accounts/parent_access_controller.cc", "child_accounts/parent_access_controller.h", "clipboard_image_model_factory.cc", "clipboard_image_model_factory.h", @@ -206,6 +207,8 @@ "message_center/arc_notifications_host_initializer.h", "metrics_util.cc", "metrics_util.h", + "nearby_share_controller.h", + "nearby_share_delegate.h", "network_config_service.cc", "network_config_service.h", "network_icon_image_source.cc", @@ -401,6 +404,8 @@ "test/test_image_downloader.h", "test/test_keyboard_controller_observer.cc", "test/test_keyboard_controller_observer.h", + "test/test_nearby_share_delegate.cc", + "test/test_nearby_share_delegate.h", "test/test_new_window_delegate.cc", "test/test_new_window_delegate.h", "test/test_system_tray_client.cc",
diff --git a/ash/public/cpp/child_accounts/parent_access_controller.cc b/ash/public/cpp/child_accounts/parent_access_controller.cc new file mode 100644 index 0000000..0173f77 --- /dev/null +++ b/ash/public/cpp/child_accounts/parent_access_controller.cc
@@ -0,0 +1,28 @@ +// Copyright 2020 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 "ash/public/cpp/child_accounts/parent_access_controller.h" + +#include "base/check_op.h" + +namespace ash { + +namespace { +ParentAccessController* g_instance = nullptr; +} + +ParentAccessController::ParentAccessController() { + DCHECK_EQ(nullptr, g_instance); + g_instance = this; +} + +ParentAccessController::~ParentAccessController() { + DCHECK_EQ(this, g_instance); + g_instance = nullptr; +} + +ParentAccessController* ParentAccessController::Get() { + return g_instance; +} +} // namespace ash \ No newline at end of file
diff --git a/ash/public/cpp/child_accounts/parent_access_controller.h b/ash/public/cpp/child_accounts/parent_access_controller.h index 4621950..d3d089c 100644 --- a/ash/public/cpp/child_accounts/parent_access_controller.h +++ b/ash/public/cpp/child_accounts/parent_access_controller.h
@@ -5,6 +5,12 @@ #ifndef ASH_PUBLIC_CPP_CHILD_ACCOUNTS_PARENT_ACCESS_CONTROLLER_H_ #define ASH_PUBLIC_CPP_CHILD_ACCOUNTS_PARENT_ACCESS_CONTROLLER_H_ +#include "ash/public/cpp/ash_public_export.h" +#include "base/callback_forward.h" +#include "base/time/time.h" + +class AccountId; + namespace ash { // Actions that might require parental approval. @@ -23,8 +29,41 @@ kReauth, }; -// TODO(crbug.com/1123722): Define ParentAccessController interface. +// ParentAccessController serves as a single point of access for PIN requests +// regarding parent access. It takes care of showing and hiding the PIN UI, as +// well as logging usage metrics. +class ASH_PUBLIC_EXPORT ParentAccessController { + public: + ParentAccessController(); + virtual ~ParentAccessController(); + // Get the instance of |ParentAccessController|. + static ParentAccessController* Get(); + + // Shows a standalone parent access dialog. If |child_account_id| is valid, it + // validates the parent access code for that child only, when it is empty it + // validates the code for any child signed in the device. + // |on_exit_callback| is invoked when the back button is clicked or the + // correct code is entered. + // |action| contains information about why the parent + // access view is necessary, it is used to modify the view appearance by + // changing the title and description strings and background color. + // The parent access widget is a modal and already contains a dimmer, however + // when another modal is the parent of the widget, the dimmer will be placed + // behind the two windows. + // |extra_dimmer| will create an extra dimmer between the two. + // |validation_time| is the time that will be used to validate the + // code, if null the system's time will be used. Note: this is intended for + // children only. If a non child account id is provided, the validation will + // necessarily fail. + // Returns whether opening the dialog was successful. Will fail if another PIN + // dialog is already opened. + virtual bool ShowWidget(const AccountId& child_account_id, + base::OnceCallback<void(bool success)> callback, + SupervisedAction action, + bool extra_dimmer, + base::Time validation_time) = 0; +}; } // namespace ash #endif // ASH_PUBLIC_CPP_CHILD_ACCOUNTS_PARENT_ACCESS_CONTROLLER_H_ \ No newline at end of file
diff --git a/ash/public/cpp/holding_space/holding_space_item.cc b/ash/public/cpp/holding_space/holding_space_item.cc index 129c5ff..e6a2842b 100644 --- a/ash/public/cpp/holding_space/holding_space_item.cc +++ b/ash/public/cpp/holding_space/holding_space_item.cc
@@ -78,17 +78,14 @@ DCHECK(version.has_value() && version.value() == kVersion); const Type type = static_cast<Type>(dict.FindIntPath(kTypePath).value()); - - const base::Optional<base::FilePath> file_path = - util::ValueToFilePath(dict.FindPath(kFilePathPath)); - DCHECK(file_path.has_value()); + const base::FilePath file_path = DeserializeFilePath(dict); // NOTE: `std::make_unique` does not work with private constructors. - return base::WrapUnique(new HoldingSpaceItem( - type, DeserializeId(dict), file_path.value(), - std::move(file_system_url_resolver).Run(file_path.value()), - file_path->BaseName().LossyDisplayName(), - std::move(image_resolver).Run(type, file_path.value()))); + return base::WrapUnique( + new HoldingSpaceItem(type, DeserializeId(dict), file_path, + std::move(file_system_url_resolver).Run(file_path), + file_path.BaseName().LossyDisplayName(), + std::move(image_resolver).Run(type, file_path))); } // static @@ -105,6 +102,21 @@ return *id; } +// static +// NOTE: This method must remain in sync with `Serialize()`. If multiple +// serialization versions are supported, care must be taken to handle each. +base::FilePath HoldingSpaceItem::DeserializeFilePath( + const base::DictionaryValue& dict) { + const base::Optional<int> version = dict.FindIntPath(kVersionPath); + DCHECK(version.has_value() && version.value() == kVersion); + + const base::Optional<base::FilePath> file_path = + util::ValueToFilePath(dict.FindPath(kFilePathPath)); + DCHECK(file_path.has_value()); + + return file_path.value(); +} + // NOTE: This method must remain in sync with `Deserialize()`. The // return value will be written to preferences so this implementation must // maintain backwards compatibility so long as `kVersion` remains unchanged.
diff --git a/ash/public/cpp/holding_space/holding_space_item.h b/ash/public/cpp/holding_space/holding_space_item.h index f7dbe64..8c9dc25 100644 --- a/ash/public/cpp/holding_space/holding_space_item.h +++ b/ash/public/cpp/holding_space/holding_space_item.h
@@ -67,9 +67,12 @@ FileSystemUrlResolver file_system_url_resolver, ImageResolver image_resolver); - // Deserializes id from a serialized `HoldingSpaceItem`. + // Deserializes `id_` from a serialized `HoldingSpaceItem`. static const std::string& DeserializeId(const base::DictionaryValue& dict); + // Deserializes `file_path_` from a serialized `HoldingSpaceItem`. + static base::FilePath DeserializeFilePath(const base::DictionaryValue& dict); + // Serializes from `HoldingSpaceItem` to `base::DictionaryValue`. base::DictionaryValue Serialize() const;
diff --git a/ash/public/cpp/login_screen.h b/ash/public/cpp/login_screen.h index ac9fe21..7ef3cb5 100644 --- a/ash/public/cpp/login_screen.h +++ b/ash/public/cpp/login_screen.h
@@ -10,9 +10,6 @@ #include "ash/public/cpp/ash_public_export.h" #include "ash/public/cpp/login_types.h" #include "base/callback_forward.h" -#include "base/time/time.h" - -class AccountId; namespace ash { @@ -20,8 +17,6 @@ class LoginScreenModel; class ScopedGuestButtonBlocker; -enum class SupervisedAction; - // Allows clients (e.g. the browser process) to send messages to the ash // login/lock/user-add screens. // TODO(estade): move more of mojom::LoginScreen here. @@ -62,27 +57,6 @@ // Shows or hides the parent access button on the login shelf. virtual void ShowParentAccessButton(bool show) = 0; - // Shows a standalone Parent Access dialog. If |child_account_id| is valid, it - // validates the parent access code for that child only, when it is empty it - // validates the code for any child signed in the device. |callback| is - // invoked when the back button is clicked or the correct code was entered. - // |action| contains information about why the parent access view is - // necessary, it is used to modify the view appearance by changing the title - // and description strings and background color. The parent access widget is a - // modal and already contains a dimmer, however when another modal is the - // parent of the widget, the dimmer will be placed behind the two windows. - // |extra_dimmer| will create an extra dimmer between the two. - // |validation_time| is the time that will be used to validate the code, if - // null the system's time will be used. Note: this is intended for children - // only. If a non child account id is provided, the validation will - // necessarily fail. - virtual void ShowParentAccessWidget( - const AccountId& child_account_id, - base::OnceCallback<void(bool success)> callback, - SupervisedAction action, - bool extra_dimmer, - base::Time validation_time) = 0; - // Sets if the guest button on the login shelf can be shown. Even if set to // true the button may still not be visible. virtual void SetAllowLoginAsGuest(bool allow_guest) = 0;
diff --git a/ash/public/cpp/nearby_share_controller.h b/ash/public/cpp/nearby_share_controller.h new file mode 100644 index 0000000..2fc3e855 --- /dev/null +++ b/ash/public/cpp/nearby_share_controller.h
@@ -0,0 +1,32 @@ +// Copyright 2020 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 ASH_PUBLIC_CPP_NEARBY_SHARE_CONTROLLER_H_ +#define ASH_PUBLIC_CPP_NEARBY_SHARE_CONTROLLER_H_ + +#include "ash/public/cpp/ash_public_export.h" + +namespace base { +class TimeDelta; +} // namespace base + +namespace ash { + +// Relays events from //chrome to //ash for Nearby Share. +class ASH_PUBLIC_EXPORT NearbyShareController { + public: + virtual ~NearbyShareController() = default; + + // To be called whenever Nearby Share's High Visibility state changes. + virtual void HighVisibilityEnabledChanged(bool enabled) = 0; + + // Called periodically while high visibility is on in order to update the + // Nearby Share pod button's countdown display. + virtual void HighVisibilityCountdownUpdate( + base::TimeDelta remaining_time) = 0; +}; + +} // namespace ash + +#endif // ASH_PUBLIC_CPP_NEARBY_SHARE_CONTROLLER_H_
diff --git a/ash/public/cpp/nearby_share_delegate.h b/ash/public/cpp/nearby_share_delegate.h new file mode 100644 index 0000000..dd8c07a --- /dev/null +++ b/ash/public/cpp/nearby_share_delegate.h
@@ -0,0 +1,50 @@ +// Copyright 2020 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 ASH_PUBLIC_CPP_NEARBY_SHARE_DELEGATE_H_ +#define ASH_PUBLIC_CPP_NEARBY_SHARE_DELEGATE_H_ + +#include "ash/public/cpp/ash_public_export.h" +#include "base/observer_list_types.h" +#include "base/optional.h" + +namespace base { +class TimeDelta; +} // namespace base + +namespace ash { + +// This delegate is a singleton used by the +// NearbyShareVisibilityFeaturePodButton in //ash to communicate with the +// NearbySharingService KeyedService in //chrome. +class ASH_PUBLIC_EXPORT NearbyShareDelegate { + public: + virtual ~NearbyShareDelegate() = default; + + // Used by the pod button to determine whether it should be visible. + virtual bool IsPodButtonVisible() const = 0; + + // Gets the current high visibility state from the NearbySharingService. + virtual bool IsHighVisibilityOn() const = 0; + + // If high visibility is on, returns the remaining duration until the delegate + // will turn it off, or nullopt if high visibility is off. + virtual base::Optional<base::TimeDelta> RemainingHighVisibilityTime() + const = 0; + + // Request high visibility be turned on. If Nearby Share is disabled in prefs, + // this will instead redirect the user to onboarding. + virtual void EnableHighVisibility() = 0; + + // Request high visibility be turned off. + virtual void DisableHighVisibility() = 0; + + // Open the settings page for Nearby Share, Used when the user clicks on the + // label under the pod button. + virtual void ShowNearbyShareSettings() const = 0; +}; + +} // namespace ash + +#endif // ASH_PUBLIC_CPP_NEARBY_SHARE_DELEGATE_H_
diff --git a/ash/public/cpp/test/test_nearby_share_delegate.cc b/ash/public/cpp/test/test_nearby_share_delegate.cc new file mode 100644 index 0000000..20d007e7 --- /dev/null +++ b/ash/public/cpp/test/test_nearby_share_delegate.cc
@@ -0,0 +1,32 @@ +// Copyright 2020 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 "ash/public/cpp/test/test_nearby_share_delegate.h" + +namespace ash { + +TestNearbyShareDelegate::TestNearbyShareDelegate() = default; + +TestNearbyShareDelegate::~TestNearbyShareDelegate() = default; + +bool TestNearbyShareDelegate::IsPodButtonVisible() const { + return false; +} + +bool TestNearbyShareDelegate::IsHighVisibilityOn() const { + return false; +} + +base::Optional<base::TimeDelta> +TestNearbyShareDelegate::RemainingHighVisibilityTime() const { + return base::nullopt; +} + +void TestNearbyShareDelegate::EnableHighVisibility() {} + +void TestNearbyShareDelegate::DisableHighVisibility() {} + +void TestNearbyShareDelegate::ShowNearbyShareSettings() const {} + +} // namespace ash
diff --git a/ash/public/cpp/test/test_nearby_share_delegate.h b/ash/public/cpp/test/test_nearby_share_delegate.h new file mode 100644 index 0000000..bb98f53 --- /dev/null +++ b/ash/public/cpp/test/test_nearby_share_delegate.h
@@ -0,0 +1,33 @@ +// Copyright 2020 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 ASH_PUBLIC_CPP_TEST_TEST_NEARBY_SHARE_DELEGATE_H_ +#define ASH_PUBLIC_CPP_TEST_TEST_NEARBY_SHARE_DELEGATE_H_ + +#include "ash/public/cpp/ash_public_export.h" +#include "ash/public/cpp/nearby_share_delegate.h" + +namespace ash { + +// A NearbyShareDelegate that does nothing. Used by TestShellDelegate. +class ASH_PUBLIC_EXPORT TestNearbyShareDelegate : public NearbyShareDelegate { + public: + TestNearbyShareDelegate(); + ~TestNearbyShareDelegate() override; + + TestNearbyShareDelegate(TestNearbyShareDelegate&) = delete; + TestNearbyShareDelegate& operator=(TestNearbyShareDelegate&) = delete; + + // NearbyShareDelegate + bool IsPodButtonVisible() const override; + bool IsHighVisibilityOn() const override; + base::Optional<base::TimeDelta> RemainingHighVisibilityTime() const override; + void EnableHighVisibility() override; + void DisableHighVisibility() override; + void ShowNearbyShareSettings() const override; +}; + +} // namespace ash + +#endif // ASH_PUBLIC_CPP_TEST_TEST_NEARBY_SHARE_DELEGATE_H_
diff --git a/ash/shell.cc b/ash/shell.cc index 2baf031..52536c1 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -24,6 +24,7 @@ #include "ash/assistant/assistant_controller_impl.h" #include "ash/autoclick/autoclick_controller.h" #include "ash/capture_mode/capture_mode_controller.h" +#include "ash/child_accounts/parent_access_controller_impl.h" #include "ash/clipboard/clipboard_history_controller.h" #include "ash/dbus/ash_dbus_services.h" #include "ash/detachable_base/detachable_base_handler.h" @@ -65,7 +66,6 @@ #include "ash/keyboard/keyboard_controller_impl.h" #include "ash/keyboard/ui/keyboard_ui_factory.h" #include "ash/login/login_screen_controller.h" -#include "ash/login/parent_access_controller.h" #include "ash/login_status.h" #include "ash/magnifier/docked_magnifier_controller_impl.h" #include "ash/magnifier/magnification_controller.h" @@ -80,6 +80,7 @@ #include "ash/public/cpp/ash_prefs.h" #include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/holding_space/holding_space_controller.h" +#include "ash/public/cpp/nearby_share_delegate.h" #include "ash/public/cpp/shelf_config.h" #include "ash/public/cpp/shelf_model.h" #include "ash/public/cpp/shell_window_ids.h" @@ -112,6 +113,7 @@ #include "ash/system/message_center/message_center_controller.h" #include "ash/system/model/system_tray_model.h" #include "ash/system/model/virtual_keyboard_model.h" +#include "ash/system/nearby_share/nearby_share_controller_impl.h" #include "ash/system/network/sms_observer.h" #include "ash/system/night_light/night_light_controller_impl.h" #include "ash/system/power/backlights_forced_off_setter.h" @@ -547,7 +549,7 @@ keyboard_brightness_control_delegate_( std::make_unique<KeyboardBrightnessController>()), locale_update_controller_(std::make_unique<LocaleUpdateControllerImpl>()), - parent_access_controller_(std::make_unique<ParentAccessController>()), + parent_access_controller_(std::make_unique<ParentAccessControllerImpl>()), session_controller_(std::make_unique<SessionControllerImpl>()), shell_delegate_(std::move(shell_delegate)), shutdown_controller_(std::make_unique<ShutdownControllerImpl>()), @@ -1155,6 +1157,9 @@ // to initialize itself. shelf_config_->Init(); + nearby_share_delegate_ = shell_delegate_->CreateNearbyShareDelegate(); + nearby_share_controller_ = std::make_unique<NearbyShareControllerImpl>(); + system_notification_controller_ = std::make_unique<SystemNotificationController>();
diff --git a/ash/shell.h b/ash/shell.h index 12b1562..52579f9 100644 --- a/ash/shell.h +++ b/ash/shell.h
@@ -139,6 +139,8 @@ class MouseCursorEventFilter; class MruWindowTracker; class MultiDeviceNotificationPresenter; +class NearbyShareController; +class NearbyShareDelegate; class NightLightControllerImpl; class OverlayEventFilter; class OverviewController; @@ -428,6 +430,12 @@ return mouse_cursor_filter_.get(); } MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } + NearbyShareController* nearby_share_controller() { + return nearby_share_controller_.get(); + } + NearbyShareDelegate* nearby_share_delegate() { + return nearby_share_delegate_.get(); + } NightLightControllerImpl* night_light_controller() { return night_light_controller_.get(); } @@ -694,6 +702,8 @@ std::unique_ptr<MruWindowTracker> mru_window_tracker_; std::unique_ptr<MultiDeviceNotificationPresenter> multidevice_notification_presenter_; + std::unique_ptr<NearbyShareController> nearby_share_controller_; + std::unique_ptr<NearbyShareDelegate> nearby_share_delegate_; std::unique_ptr<ParentAccessController> parent_access_controller_; std::unique_ptr<QuickAnswersController> quick_answers_controller_; std::unique_ptr<ResizeShadowController> resize_shadow_controller_;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index dfbdeb88..3df229c3 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h
@@ -34,6 +34,7 @@ class ScreenshotDelegate; class BackGestureContextualNudgeDelegate; class BackGestureContextualNudgeController; +class NearbyShareDelegate; // Delegate of the Shell. class ASH_EXPORT ShellDelegate { @@ -60,6 +61,9 @@ CreateBackGestureContextualNudgeDelegate( BackGestureContextualNudgeController* controller) = 0; + virtual std::unique_ptr<ash::NearbyShareDelegate> CreateNearbyShareDelegate() + const = 0; + // Check whether the current tab of the browser window can go back. virtual bool CanGoBack(gfx::NativeWindow window) const = 0;
diff --git a/ash/system/nearby_share/nearby_share_controller_impl.cc b/ash/system/nearby_share/nearby_share_controller_impl.cc new file mode 100644 index 0000000..64a31b2 --- /dev/null +++ b/ash/system/nearby_share/nearby_share_controller_impl.cc
@@ -0,0 +1,34 @@ +// Copyright 2020 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 "ash/system/nearby_share/nearby_share_controller_impl.h" + +namespace ash { + +NearbyShareControllerImpl::NearbyShareControllerImpl() = default; + +NearbyShareControllerImpl::~NearbyShareControllerImpl() = default; + +void NearbyShareControllerImpl::HighVisibilityCountdownUpdate( + base::TimeDelta remaining_time) { + for (auto& observer : observers_) { + observer.OnHighVisibilityCountdownUpdate(remaining_time); + } +} + +void NearbyShareControllerImpl::HighVisibilityEnabledChanged(bool enabled) { + for (auto& observer : observers_) { + observer.OnHighVisibilityEnabledChanged(enabled); + } +} + +void NearbyShareControllerImpl::AddObserver(Observer* obs) { + observers_.AddObserver(obs); +} + +void NearbyShareControllerImpl::RemoveObserver(Observer* obs) { + observers_.RemoveObserver(obs); +} + +} // namespace ash
diff --git a/ash/system/nearby_share/nearby_share_controller_impl.h b/ash/system/nearby_share/nearby_share_controller_impl.h new file mode 100644 index 0000000..7ab7a65 --- /dev/null +++ b/ash/system/nearby_share/nearby_share_controller_impl.h
@@ -0,0 +1,48 @@ +// Copyright 2020 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 ASH_SYSTEM_NEARBY_SHARE_NEARBY_SHARE_CONTROLLER_IMPL_H_ +#define ASH_SYSTEM_NEARBY_SHARE_NEARBY_SHARE_CONTROLLER_IMPL_H_ + +#include "ash/public/cpp/nearby_share_controller.h" +#include "base/observer_list.h" +#include "base/observer_list_types.h" + +namespace ash { + +// Handles Nearby Share events from //chrome, providing an observer interface +// within //ash. Singleton, lives on UI thread. +class NearbyShareControllerImpl : public NearbyShareController { + public: + class Observer : public base::CheckedObserver { + public: + // The delegate implementation maintains a timer and shuts off high + // visibility after a timeout. During that timeout, this event fires + // periodically to update the remaining time on the pod button UI. + virtual void OnHighVisibilityCountdownUpdate( + base::TimeDelta remaining_time) = 0; + + // Relays high visibility state changes from the service to the pod button. + virtual void OnHighVisibilityEnabledChanged(bool enabled) = 0; + }; + + NearbyShareControllerImpl(); + NearbyShareControllerImpl(NearbyShareControllerImpl&) = delete; + NearbyShareControllerImpl& operator=(NearbyShareControllerImpl&) = delete; + ~NearbyShareControllerImpl() override; + + // NearbyShareController + void HighVisibilityCountdownUpdate(base::TimeDelta remaining_time) override; + void HighVisibilityEnabledChanged(bool enabled) override; + + void AddObserver(Observer* obs); + void RemoveObserver(Observer* obs); + + private: + base::ObserverList<Observer> observers_; +}; + +} // namespace ash + +#endif // ASH_SYSTEM_NEARBY_SHARE_NEARBY_SHARE_CONTROLLER_IMPL_H_
diff --git a/ash/test_shell_delegate.cc b/ash/test_shell_delegate.cc index bd931414..d76facb 100644 --- a/ash/test_shell_delegate.cc +++ b/ash/test_shell_delegate.cc
@@ -8,6 +8,7 @@ #include "ash/accessibility/default_accessibility_delegate.h" #include "ash/capture_mode/test_capture_mode_delegate.h" +#include "ash/public/cpp/test/test_nearby_share_delegate.h" #include "ash/system/tray/system_tray_notifier.h" #include "ash/test_screenshot_delegate.h" #include "ash/wm/gestures/back_gesture/test_back_gesture_contextual_nudge_delegate.h" @@ -70,4 +71,9 @@ should_wait_for_touch_ack_ = should_wait_for_touch_ack; } +std::unique_ptr<NearbyShareDelegate> +TestShellDelegate::CreateNearbyShareDelegate() const { + return std::make_unique<TestNearbyShareDelegate>(); +} + } // namespace ash
diff --git a/ash/test_shell_delegate.h b/ash/test_shell_delegate.h index 50c7fd71..8da3aaff 100644 --- a/ash/test_shell_delegate.h +++ b/ash/test_shell_delegate.h
@@ -47,6 +47,8 @@ mojo::PendingReceiver< chromeos::multidevice_setup::mojom::MultiDeviceSetup> receiver) override; + std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate() + const override; void SetCanGoBack(bool can_go_back); void SetShouldWaitForTouchAck(bool should_wait_for_touch_ack);
diff --git a/ash/wm/window_cycle_controller_unittest.cc b/ash/wm/window_cycle_controller_unittest.cc index 0a00ac73..019aca1 100644 --- a/ash/wm/window_cycle_controller_unittest.cc +++ b/ash/wm/window_cycle_controller_unittest.cc
@@ -899,39 +899,55 @@ } // When a user hovers their mouse over an item, it should cycle to it. +// The items in the list should not move, only the focus ring. // If a user clicks on an item, it should complete cycling and activate // the hovered item. TEST_F(InteractiveWindowCycleControllerTest, MouseHoverAndSelect) { std::unique_ptr<Window> w0 = CreateTestWindow(); std::unique_ptr<Window> w1 = CreateTestWindow(); std::unique_ptr<Window> w2 = CreateTestWindow(); + std::unique_ptr<Window> w3 = CreateTestWindow(); + std::unique_ptr<Window> w4 = CreateTestWindow(); + std::unique_ptr<Window> w5 = CreateTestWindow(); + std::unique_ptr<Window> w6 = CreateTestWindow(); ui::test::EventGenerator* generator = GetEventGenerator(); WindowCycleController* controller = Shell::Get()->window_cycle_controller(); // Cycle to the third item, mouse over second item, and release alt-tab. - // Starting order of windows in cycle list is [2,1,0]. + // Starting order of windows in cycle list is [6,5,4,3,2,1,0]. controller->HandleCycleWindow(WindowCycleController::FORWARD); controller->HandleCycleWindow(WindowCycleController::FORWARD); - generator->MoveMouseTo( - GetWindowCycleItemViews()[1]->GetBoundsInScreen().CenterPoint()); + gfx::Point target_item_center = + GetWindowCycleItemViews()[1]->GetBoundsInScreen().CenterPoint(); + generator->MoveMouseTo(target_item_center); + EXPECT_EQ(target_item_center, + GetWindowCycleItemViews()[1]->GetBoundsInScreen().CenterPoint()); controller->CompleteCycling(); - EXPECT_TRUE(wm::IsActiveWindow(w1.get())); + EXPECT_TRUE(wm::IsActiveWindow(w5.get())); // Start cycle, mouse over third item, and release alt-tab. - // Starting order of windows in cycle list is [1,2,0]. + // Starting order of windows in cycle list is [5,6,4,3,2,1,0]. controller->StartCycling(); - generator->MoveMouseTo( - GetWindowCycleItemViews()[2]->GetBoundsInScreen().CenterPoint()); + target_item_center = + GetWindowCycleItemViews()[2]->GetBoundsInScreen().CenterPoint(); + generator->MoveMouseTo(target_item_center); + EXPECT_EQ(target_item_center, + GetWindowCycleItemViews()[2]->GetBoundsInScreen().CenterPoint()); controller->CompleteCycling(); - EXPECT_TRUE(wm::IsActiveWindow(w0.get())); + EXPECT_TRUE(wm::IsActiveWindow(w4.get())); - // Start cycle, mouse over second item, and click. - // Starting order of windows in cycle list is [0,1,2]. + // Start cycle, cycle to the fifth item, mouse over seventh item, and click. + // Starting order of windows in cycle list is [4,5,6,3,2,1,0]. controller->StartCycling(); - generator->MoveMouseTo( - GetWindowCycleItemViews()[1]->GetBoundsInScreen().CenterPoint()); + for (int i = 0; i < 5; i++) + controller->HandleCycleWindow(WindowCycleController::FORWARD); + target_item_center = + GetWindowCycleItemViews()[6]->GetBoundsInScreen().CenterPoint(); + generator->MoveMouseTo(target_item_center); + EXPECT_EQ(target_item_center, + GetWindowCycleItemViews()[6]->GetBoundsInScreen().CenterPoint()); generator->PressLeftButton(); - EXPECT_TRUE(wm::IsActiveWindow(w1.get())); + EXPECT_TRUE(wm::IsActiveWindow(w0.get())); } // Tests that the left and right keys cycle after the cycle list has been
diff --git a/ash/wm/window_cycle_list.cc b/ash/wm/window_cycle_list.cc index 222eee14..ecbb253 100644 --- a/ash/wm/window_cycle_list.cc +++ b/ash/wm/window_cycle_list.cc
@@ -313,7 +313,7 @@ layer()->SetOpacity(1.f); } - void SetTargetWindow(aura::Window* target) { + void SetTargetWindow(aura::Window* target, bool should_layout) { // Hide the focus border of the previous target window and show the focus // border of the new one. if (target_window_) { @@ -326,7 +326,7 @@ if (target_it != window_view_map_.end()) target_it->second->UpdateBorderState(/*show=*/true); - if (GetWidget()) { + if (GetWidget() && should_layout) { Layout(); if (target_window_) window_view_map_[target_window_]->RequestFocus(); @@ -348,7 +348,7 @@ // sure our own Layout() works correctly when it's calculating highlight // bounds. parent->Layout(); - SetTargetWindow(new_target); + SetTargetWindow(new_target, /*should_layout=*/true); } void DestroyContents() { @@ -514,45 +514,9 @@ Shell::Get()->frame_throttling_controller()->EndThrottling(); } -void WindowCycleList::Step(int offset) { - if (windows_.empty()) - return; - - // When there is only one window, we should give feedback to the user. If - // the window is minimized, we should also show it. - if (windows_.size() == 1) { - ::wm::AnimateWindow(windows_[0], ::wm::WINDOW_ANIMATION_TYPE_BOUNCE); - SelectWindow(windows_[0]); - return; - } - - DCHECK(static_cast<size_t>(current_index_) < windows_.size()); - - if (!cycle_view_ && current_index_ == 0) { - // Special case the situation where we're cycling forward but the MRU - // window is not active. This occurs when all windows are minimized. The - // starting window should be the first one rather than the second. - if (offset == 1 && !wm::IsActiveWindow(windows_[0])) - current_index_ = -1; - } - - current_index_ += offset; - - // Wrap to window list size. - current_index_ = (current_index_ + windows_.size()) % windows_.size(); - DCHECK(windows_[current_index_]); - - if (ShouldShowUi()) { - if (current_index_ > 1) - InitWindowCycleView(); - - if (cycle_view_) - cycle_view_->SetTargetWindow(windows_[current_index_]); - } -} - void WindowCycleList::Step(WindowCycleController::Direction direction) { - Step(direction == WindowCycleController::FORWARD ? 1 : -1); + Step(direction == WindowCycleController::FORWARD ? 1 : -1, + /*should_layout=*/true); } void WindowCycleList::StepToWindow(aura::Window* window) { @@ -560,7 +524,10 @@ DCHECK(target_window != windows_.end()); int target_index = std::distance(windows_.begin(), target_window); - Step(target_index - current_index_); + // If the user hovers over an item and the window cycle list scrolls, + // sometimes it can cause the mouse to not hover over the selected item. To + // avoid this, prevent scrolling and only move focus border. + Step(target_index - current_index_, /*should_layout=*/false); } bool WindowCycleList::IsEventInCycleView(ui::LocatedEvent* event) { @@ -627,7 +594,8 @@ return; cycle_view_ = new WindowCycleView(windows_); - cycle_view_->SetTargetWindow(windows_[current_index_]); + cycle_view_->SetTargetWindow(windows_[current_index_], + /*should_layout=*/true); // We need to activate the widget if ChromeVox is enabled as ChromeVox // relies on activation. @@ -698,6 +666,44 @@ window_selected_ = true; } +void WindowCycleList::Step(int offset, bool should_layout) { + if (windows_.empty()) + return; + + // When there is only one window, we should give feedback to the user. If + // the window is minimized, we should also show it. + if (windows_.size() == 1) { + ::wm::AnimateWindow(windows_[0], ::wm::WINDOW_ANIMATION_TYPE_BOUNCE); + SelectWindow(windows_[0]); + return; + } + + DCHECK(static_cast<size_t>(current_index_) < windows_.size()); + + if (!cycle_view_ && current_index_ == 0) { + // Special case the situation where we're cycling forward but the MRU + // window is not active. This occurs when all windows are minimized. The + // starting window should be the first one rather than the second. + if (offset == 1 && !wm::IsActiveWindow(windows_[0])) + current_index_ = -1; + } + + current_index_ += offset; + + // Wrap to window list size. + current_index_ = (current_index_ + windows_.size()) % windows_.size(); + DCHECK(windows_[current_index_]); + + if (ShouldShowUi()) { + if (current_index_ > 1) + InitWindowCycleView(); + + if (cycle_view_) + cycle_view_->SetTargetWindow(windows_[current_index_], + /*should_layout=*/should_layout); + } +} + const views::View::Views& WindowCycleList::GetWindowCycleItemViewsForTesting() const { return cycle_view_->GetPreviewViewsForTesting();
diff --git a/ash/wm/window_cycle_list.h b/ash/wm/window_cycle_list.h index 16b899b..4c0b47c 100644 --- a/ash/wm/window_cycle_list.h +++ b/ash/wm/window_cycle_list.h
@@ -42,10 +42,12 @@ WindowCycleList& operator=(const WindowCycleList&) = delete; ~WindowCycleList() override; - // Cycles to the next or previous window based on |direction|. + // Cycles to the next or previous window based on |direction| and re-layouts + // the window cycle list, scrolling the list. void Step(WindowCycleController::Direction direction); - // Skip window cycle list directly to |window|. + // Skip window cycle list directly to |window| and don't re-layout the window + // cycle list, only moving the focus ring. void StepToWindow(aura::Window* window); // Checks whether |event| occurs within the cycle view. Returns false if @@ -85,8 +87,12 @@ // PIP. void SelectWindow(aura::Window* window); - // Cycles windows by |offset|. - void Step(int offset); + // Cycles windows by |offset|. If |should_layout|, layouts the window cycle + // list and moves the focus border to the newly selected window. If not + // |should_layout|, just moves the focus border to the newly selected window. + // Should be called with |should_layout| if we want the Step() call to animate + // the window cycle list, scrolling it. + void Step(int offset, bool should_layout); // Returns the views for the window cycle list. const views::View::Views& GetWindowCycleItemViewsForTesting() const;
diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc index bb7d71cd..b11ce9d 100644 --- a/base/logging_unittest.cc +++ b/base/logging_unittest.cc
@@ -461,6 +461,11 @@ return nullptr; } +// Helper function to call pthread_exit(nullptr). +_Noreturn __NO_SAFESTACK void exception_pthread_exit() { + pthread_exit(nullptr); +} + // Runs the CrashThread function in a separate thread. void SpawnCrashThread(int death_location, uintptr_t* child_crash_addr) { zx::event event; @@ -496,7 +501,7 @@ sizeof(exception_info), 1, nullptr, nullptr); ASSERT_EQ(status, ZX_OK); - // Get the crash address. + // Get the crash address and point the thread towards exiting. zx::thread zircon_thread; status = exception.get_thread(&zircon_thread); ASSERT_EQ(status, ZX_OK); @@ -506,14 +511,26 @@ ASSERT_EQ(status, ZX_OK); #if defined(ARCH_CPU_X86_64) *child_crash_addr = static_cast<uintptr_t>(buffer.rip); + buffer.rip = reinterpret_cast<uintptr_t>(exception_pthread_exit); #elif defined(ARCH_CPU_ARM64) *child_crash_addr = static_cast<uintptr_t>(buffer.pc); + buffer.pc = reinterpret_cast<uintptr_t>(exception_pthread_exit); #else #error Unsupported architecture #endif + ASSERT_EQ(zircon_thread.write_state(ZX_THREAD_STATE_GENERAL_REGS, &buffer, + sizeof(buffer)), + ZX_OK); - status = zircon_thread.kill(); - ASSERT_EQ(status, ZX_OK); + // Clear the exception so the thread continues. + uint32_t state = ZX_EXCEPTION_STATE_HANDLED; + ASSERT_EQ( + exception.set_property(ZX_PROP_EXCEPTION_STATE, &state, sizeof(state)), + ZX_OK); + exception.reset(); + + // Join the exiting pthread. + ASSERT_EQ(pthread_join(thread, nullptr), 0); } TEST_F(LoggingTest, CheckCausesDistinctBreakpoints) {
diff --git a/base/metrics/dummy_histogram.cc b/base/metrics/dummy_histogram.cc index 45ae7f2..a238035 100644 --- a/base/metrics/dummy_histogram.cc +++ b/base/metrics/dummy_histogram.cc
@@ -18,8 +18,10 @@ // Helper classes for DummyHistogram. class DummySampleCountIterator : public SampleCountIterator { public: - DummySampleCountIterator() {} - ~DummySampleCountIterator() override {} + DummySampleCountIterator() = default; + DummySampleCountIterator(const DummySampleCountIterator&) = delete; + DummySampleCountIterator& operator=(const DummySampleCountIterator&) = delete; + ~DummySampleCountIterator() override = default; // SampleCountIterator: bool Done() const override { return true; } @@ -29,14 +31,13 @@ HistogramBase::Count* count) const override { NOTREACHED(); } - - private: - DISALLOW_COPY_AND_ASSIGN(DummySampleCountIterator); }; class DummyHistogramSamples : public HistogramSamples { public: - explicit DummyHistogramSamples() : HistogramSamples(0, new LocalMetadata()) {} + DummyHistogramSamples() : HistogramSamples(0, new LocalMetadata()) {} + DummyHistogramSamples(const DummyHistogramSamples&) = delete; + DummyHistogramSamples& operator=(const DummyHistogramSamples&) = delete; ~DummyHistogramSamples() override { delete static_cast<LocalMetadata*>(meta()); } @@ -56,9 +57,6 @@ bool AddSubtractImpl(SampleCountIterator* iter, Operator op) override { return true; } - - private: - DISALLOW_COPY_AND_ASSIGN(DummyHistogramSamples); }; } // namespace
diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h index 22168cc3..67c57ed1 100644 --- a/base/metrics/field_trial.h +++ b/base/metrics/field_trial.h
@@ -67,7 +67,6 @@ #include "base/command_line.h" #include "base/feature_list.h" #include "base/gtest_prod_util.h" -#include "base/macros.h" #include "base/memory/read_only_shared_memory_region.h" #include "base/memory/ref_counted.h" #include "base/memory/shared_memory_mapping.h" @@ -185,6 +184,9 @@ // assignment (and hence is not yet participating in the trial). static const int kNotFinalized; + FieldTrial(const FieldTrial&) = delete; + FieldTrial& operator=(const FieldTrial&) = delete; + // Disables this trial, meaning it always determines the default group // has been selected. May be called immediately after construction, or // at any time after initialization (should not be interleaved with @@ -290,6 +292,7 @@ Probability total_probability, const std::string& default_group_name, double entropy_value); + virtual ~FieldTrial(); // Return the default group name of the FieldTrial. @@ -380,8 +383,6 @@ // When benchmarking is enabled, field trials all revert to the 'default' // group. static bool enable_benchmarking_; - - DISALLOW_COPY_AND_ASSIGN(FieldTrial); }; //------------------------------------------------------------------------------ @@ -416,6 +417,8 @@ // |entropy_provider|. explicit FieldTrialList( std::unique_ptr<const FieldTrial::EntropyProvider> entropy_provider); + FieldTrialList(const FieldTrialList&) = delete; + FieldTrialList& operator=(const FieldTrialList&) = delete; // Destructor Release()'s references to all registered FieldTrial instances. ~FieldTrialList(); @@ -796,8 +799,6 @@ // Tracks whether CreateTrialsFromCommandLine() has been called. bool create_trials_from_command_line_called_ = false; - - DISALLOW_COPY_AND_ASSIGN(FieldTrialList); }; } // namespace base
diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc index 62c7934..6fbddd0 100644 --- a/base/metrics/field_trial_unittest.cc +++ b/base/metrics/field_trial_unittest.cc
@@ -63,12 +63,14 @@ SYNCHRONOUS, }; - TestFieldTrialObserver(Type type) : type_(type) { + explicit TestFieldTrialObserver(Type type) : type_(type) { if (type == SYNCHRONOUS) FieldTrialList::SetSynchronousObserver(this); else FieldTrialList::AddObserver(this); } + TestFieldTrialObserver(const TestFieldTrialObserver&) = delete; + TestFieldTrialObserver& operator=(const TestFieldTrialObserver&) = delete; ~TestFieldTrialObserver() override { if (type_ == SYNCHRONOUS) @@ -90,8 +92,6 @@ const Type type_; std::string trial_name_; std::string group_name_; - - DISALLOW_COPY_AND_ASSIGN(TestFieldTrialObserver); }; std::string MockEscapeQueryParamValue(const std::string& input) { @@ -103,6 +103,8 @@ class FieldTrialTest : public ::testing::Test { public: FieldTrialTest() : trial_list_(nullptr) {} + FieldTrialTest(const FieldTrialTest&) = delete; + FieldTrialTest& operator=(const FieldTrialTest&) = delete; private: test::TaskEnvironment task_environment_; @@ -110,8 +112,6 @@ // tests it's cleaner to start from scratch. test::ScopedFieldTrialListResetter trial_list_resetter_; FieldTrialList trial_list_; - - DISALLOW_COPY_AND_ASSIGN(FieldTrialTest); }; // Test registration, and also check that destructors are called for trials.
diff --git a/base/metrics/histogram_base_unittest.cc b/base/metrics/histogram_base_unittest.cc index 0314ef4d..5eded44 100644 --- a/base/metrics/histogram_base_unittest.cc +++ b/base/metrics/histogram_base_unittest.cc
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <limits> #include <vector> #include "base/metrics/histogram.h" @@ -15,15 +16,18 @@ namespace base { class HistogramBaseTest : public testing::Test { - protected: + public: HistogramBaseTest() { // Each test will have a clean state (no Histogram / BucketRanges // registered). ResetStatisticsRecorder(); } + HistogramBaseTest(const HistogramBaseTest&) = delete; + HistogramBaseTest& operator=(const HistogramBaseTest&) = delete; ~HistogramBaseTest() override = default; + protected: void ResetStatisticsRecorder() { // It is necessary to fully destruct any existing StatisticsRecorder // before creating a new one. @@ -33,8 +37,6 @@ private: std::unique_ptr<StatisticsRecorder> statistics_recorder_; - - DISALLOW_COPY_AND_ASSIGN(HistogramBaseTest); }; TEST_F(HistogramBaseTest, DeserializeHistogram) {
diff --git a/base/metrics/histogram_flattener.h b/base/metrics/histogram_flattener.h index ed81154..ccfb2d8a 100644 --- a/base/metrics/histogram_flattener.h +++ b/base/metrics/histogram_flattener.h
@@ -8,7 +8,6 @@ #include <map> #include <string> -#include "base/macros.h" #include "base/metrics/histogram.h" namespace base { @@ -19,6 +18,8 @@ // handles the logistics of gathering up available histograms for recording. class BASE_EXPORT HistogramFlattener { public: + HistogramFlattener(const HistogramFlattener&) = delete; + HistogramFlattener& operator=(const HistogramFlattener&) = delete; virtual ~HistogramFlattener() = default; virtual void RecordDelta(const HistogramBase& histogram, @@ -26,9 +27,6 @@ protected: HistogramFlattener() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(HistogramFlattener); }; } // namespace base
diff --git a/base/metrics/histogram_samples.h b/base/metrics/histogram_samples.h index 6908873c..d78b449 100644 --- a/base/metrics/histogram_samples.h +++ b/base/metrics/histogram_samples.h
@@ -12,7 +12,6 @@ #include <memory> #include "base/atomicops.h" -#include "base/macros.h" #include "base/metrics/histogram_base.h" namespace base { @@ -129,6 +128,8 @@ }; HistogramSamples(uint64_t id, Metadata* meta); + HistogramSamples(const HistogramSamples&) = delete; + HistogramSamples& operator=(const HistogramSamples&) = delete; virtual ~HistogramSamples(); virtual void Accumulate(HistogramBase::Sample value, @@ -203,8 +204,6 @@ // external storage in which case HistogramSamples class cannot take ownership // of Metadata*. Metadata* meta_; - - DISALLOW_COPY_AND_ASSIGN(HistogramSamples); }; class BASE_EXPORT SampleCountIterator {
diff --git a/base/metrics/histogram_snapshot_manager.cc b/base/metrics/histogram_snapshot_manager.cc index fa04b542..2d45d73 100644 --- a/base/metrics/histogram_snapshot_manager.cc +++ b/base/metrics/histogram_snapshot_manager.cc
@@ -21,16 +21,16 @@ // an error if the flag is already set. class MakeActive { public: - MakeActive(std::atomic<bool>* is_active) : is_active_(is_active) { + explicit MakeActive(std::atomic<bool>* is_active) : is_active_(is_active) { bool was_active = is_active_->exchange(true, std::memory_order_relaxed); CHECK(!was_active); } + MakeActive(const MakeActive&) = delete; + MakeActive& operator=(const MakeActive&) = delete; ~MakeActive() { is_active_->store(false, std::memory_order_relaxed); } private: std::atomic<bool>* is_active_; - - DISALLOW_COPY_AND_ASSIGN(MakeActive); }; } // namespace
diff --git a/base/metrics/sample_vector.h b/base/metrics/sample_vector.h index 278272da..0765e973 100644 --- a/base/metrics/sample_vector.h +++ b/base/metrics/sample_vector.h
@@ -17,7 +17,6 @@ #include "base/atomicops.h" #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" -#include "base/macros.h" #include "base/metrics/bucket_ranges.h" #include "base/metrics/histogram_base.h" #include "base/metrics/histogram_samples.h" @@ -32,6 +31,8 @@ SampleVectorBase(uint64_t id, Metadata* meta, const BucketRanges* bucket_ranges); + SampleVectorBase(const SampleVectorBase&) = delete; + SampleVectorBase& operator=(const SampleVectorBase&) = delete; ~SampleVectorBase() override; // HistogramSamples: @@ -107,8 +108,6 @@ // Shares the same BucketRanges with Histogram object. const BucketRanges* const bucket_ranges_; - - DISALLOW_COPY_AND_ASSIGN(SampleVectorBase); }; // A sample vector that uses local memory for the counts array. @@ -116,6 +115,8 @@ public: explicit SampleVector(const BucketRanges* bucket_ranges); SampleVector(uint64_t id, const BucketRanges* bucket_ranges); + SampleVector(const SampleVector&) = delete; + SampleVector& operator=(const SampleVector&) = delete; ~SampleVector() override; private: @@ -125,8 +126,6 @@ // Simple local storage for counts. mutable std::vector<HistogramBase::AtomicCount> local_counts_; - - DISALLOW_COPY_AND_ASSIGN(SampleVector); }; // A sample vector that uses persistent memory for the counts array. @@ -136,6 +135,8 @@ const BucketRanges* bucket_ranges, Metadata* meta, const DelayedPersistentAllocation& counts); + PersistentSampleVector(const PersistentSampleVector&) = delete; + PersistentSampleVector& operator=(const PersistentSampleVector&) = delete; ~PersistentSampleVector() override; private: @@ -145,8 +146,6 @@ // Persistent storage for counts. DelayedPersistentAllocation persistent_counts_; - - DISALLOW_COPY_AND_ASSIGN(PersistentSampleVector); }; // An iterator for sample vectors. This could be defined privately in the .cc
diff --git a/base/metrics/single_sample_metrics.h b/base/metrics/single_sample_metrics.h index b966cb1..c8fc1ee1 100644 --- a/base/metrics/single_sample_metrics.h +++ b/base/metrics/single_sample_metrics.h
@@ -5,10 +5,10 @@ #ifndef BASE_METRICS_SINGLE_SAMPLE_METRICS_H_ #define BASE_METRICS_SINGLE_SAMPLE_METRICS_H_ +#include <memory> #include <string> #include "base/base_export.h" -#include "base/macros.h" #include "base/metrics/histogram_base.h" namespace base { @@ -64,6 +64,10 @@ : public SingleSampleMetricsFactory { public: DefaultSingleSampleMetricsFactory() = default; + DefaultSingleSampleMetricsFactory(const DefaultSingleSampleMetricsFactory&) = + delete; + DefaultSingleSampleMetricsFactory& operator=( + const DefaultSingleSampleMetricsFactory&) = delete; ~DefaultSingleSampleMetricsFactory() override = default; // SingleSampleMetricsFactory: @@ -72,9 +76,6 @@ HistogramBase::Sample min, HistogramBase::Sample max, uint32_t bucket_count) override; - - private: - DISALLOW_COPY_AND_ASSIGN(DefaultSingleSampleMetricsFactory); }; class BASE_EXPORT DefaultSingleSampleMetric : public SingleSampleMetric {
diff --git a/base/metrics/sparse_histogram_unittest.cc b/base/metrics/sparse_histogram_unittest.cc index 47d8b81..4bada66 100644 --- a/base/metrics/sparse_histogram_unittest.cc +++ b/base/metrics/sparse_histogram_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> #include <string> +#include <vector> #include "base/logging.h" #include "base/metrics/histogram_base.h" @@ -29,11 +30,14 @@ // for histogram allocation. False will allocate histograms from the process // heap. class SparseHistogramTest : public testing::TestWithParam<bool> { + public: + SparseHistogramTest() : use_persistent_histogram_allocator_(GetParam()) {} + SparseHistogramTest(const SparseHistogramTest&) = delete; + SparseHistogramTest& operator=(const SparseHistogramTest&) = delete; + protected: const int32_t kAllocatorMemorySize = 8 << 20; // 8 MiB - SparseHistogramTest() : use_persistent_histogram_allocator_(GetParam()) {} - void SetUp() override { if (use_persistent_histogram_allocator_) CreatePersistentMemoryAllocator(); @@ -91,9 +95,6 @@ std::unique_ptr<StatisticsRecorder> statistics_recorder_; PersistentMemoryAllocator* allocator_ = nullptr; - - private: - DISALLOW_COPY_AND_ASSIGN(SparseHistogramTest); }; // Run all HistogramTest cases with both heap and persistent memory.
diff --git a/base/metrics/statistics_recorder_unittest.cc b/base/metrics/statistics_recorder_unittest.cc index b191dad..9610421f9 100644 --- a/base/metrics/statistics_recorder_unittest.cc +++ b/base/metrics/statistics_recorder_unittest.cc
@@ -30,14 +30,13 @@ // contained (i.e., do not affect other unit tests). class LogStateSaver { public: - LogStateSaver() : old_min_log_level_(logging::GetMinLogLevel()) {} - + LogStateSaver() = default; + LogStateSaver(const LogStateSaver&) = delete; + LogStateSaver& operator=(const LogStateSaver&) = delete; ~LogStateSaver() { logging::SetMinLogLevel(old_min_log_level_); } private: - int old_min_log_level_; - - DISALLOW_COPY_AND_ASSIGN(LogStateSaver); + int old_min_log_level_ = logging::GetMinLogLevel(); }; // Test implementation of RecordHistogramChecker interface. @@ -60,6 +59,10 @@ using testing::UnorderedElementsAre; class StatisticsRecorderTest : public testing::TestWithParam<bool> { + public: + StatisticsRecorderTest(const StatisticsRecorderTest&) = delete; + StatisticsRecorderTest& operator=(const StatisticsRecorderTest&) = delete; + protected: const int32_t kAllocatorMemorySize = 64 << 10; // 64 KiB @@ -122,8 +125,6 @@ private: LogStateSaver log_state_saver_; - - DISALLOW_COPY_AND_ASSIGN(StatisticsRecorderTest); }; // Run all HistogramTest cases with both heap and persistent memory. @@ -701,6 +702,8 @@ : allocator_(std::move(allocator)) { StatisticsRecorder::RegisterHistogramProvider(weak_factory_.GetWeakPtr()); } + TestHistogramProvider(const TestHistogramProvider&) = delete; + TestHistogramProvider& operator=(const TestHistogramProvider&) = delete; void MergeHistogramDeltas() override { PersistentHistogramAllocator::Iterator hist_iter(allocator_.get()); @@ -715,8 +718,6 @@ private: std::unique_ptr<PersistentHistogramAllocator> allocator_; WeakPtrFactory<TestHistogramProvider> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(TestHistogramProvider); }; TEST_P(StatisticsRecorderTest, ImportHistogramsTest) {
diff --git a/build/android/BUILD.gn b/build/android/BUILD.gn index 7fd790d6..94612f32 100644 --- a/build/android/BUILD.gn +++ b/build/android/BUILD.gn
@@ -16,6 +16,27 @@ create_cache = true } + android_library("lint_test_java") { + sources = [ "java/test/LintTest.java" ] + } + + android_apk("lint_test_apk") { + # This cannot be marked testonly since lint has special ignores for testonly + # targets. We need to test linting a normal apk target. + apk_name = "LintTest" + deps = [ ":lint_test_java" ] + android_manifest = "//build/android/AndroidManifest.xml" + } + + android_lint("lint_test") { + lint_expected_warnings = "InlinedApi,NewApi" + _test_apk_target = ":lint_test_apk" + deps = [ "${_test_apk_target}__java" ] + build_config_dep = "$_test_apk_target$build_config_target_suffix" + build_config = get_label_info(_test_apk_target, "target_gen_dir") + "/" + + get_label_info(_test_apk_target, "name") + ".build_config" + } + if (enable_jdk_library_desugaring) { dex_jdk_libs("all_jdk_libs") { output = "$target_out_dir/$target_name.l8.dex"
diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py index a93907a0..1eebe01 100755 --- a/build/android/gyp/lint.py +++ b/build/android/gyp/lint.py
@@ -8,6 +8,7 @@ from __future__ import print_function import argparse +import functools import logging import os import re @@ -141,6 +142,17 @@ root, encoding='utf-8')).toprettyxml(indent=' ')) +def _CheckLintWarning(expected_warnings, lint_output): + for expected_warning in expected_warnings.split(','): + expected_str = '[{}]'.format(expected_warning) + if expected_str not in lint_output: + raise Exception('Expected {!r} warning in lint output:\n{}.'.format( + expected_str, lint_output)) + + # Do not print warning + return '' + + def _RunLint(lint_binary_path, config_path, manifest_path, @@ -155,6 +167,7 @@ android_sdk_root, lint_gen_dir, baseline, + expected_warnings, testonly_target=False, warnings_as_errors=False): logging.info('Lint starting') @@ -239,6 +252,8 @@ # This filter is necessary for JDK11. stderr_filter = build_utils.FilterReflectiveAccessJavaWarnings stdout_filter = lambda x: build_utils.FilterLines(x, 'No issues found') + if expected_warnings: + stdout_filter = functools.partial(_CheckLintWarning, expected_warnings) start = time.time() logging.debug('Lint command %s', ' '.join(cmd)) @@ -325,6 +340,9 @@ parser.add_argument('--baseline', help='Baseline file to ignore existing errors and fail ' 'on new errors.') + parser.add_argument('--expected-warnings', + help='Comma separated list of warnings to test for in ' + 'the output, failing if not found.') args = parser.parse_args(build_utils.ExpandFileArgs(argv)) args.java_sources = build_utils.ParseGnList(args.java_sources) @@ -367,6 +385,7 @@ args.android_sdk_root, args.lint_gen_dir, args.baseline, + args.expected_warnings, testonly_target=args.testonly, warnings_as_errors=args.warnings_as_errors) logging.info('Creating stamp file')
diff --git a/build/android/lint/suppress.py b/build/android/lint/suppress.py deleted file mode 100755 index 5e36d289..0000000 --- a/build/android/lint/suppress.py +++ /dev/null
@@ -1,131 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (c) 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. - -"""Add all generated lint_result.xml files to suppressions.xml""" - -# pylint: disable=no-member - -from __future__ import print_function - -import argparse -import os -import re -import sys -from xml.dom import minidom - -_BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') -sys.path.append(_BUILD_ANDROID_DIR) - -_TMP_DIR_RE = re.compile(r'^/tmp/.*/(SRC_ROOT[0-9]+|PRODUCT_DIR)/') -_THIS_FILE = os.path.abspath(__file__) -_DEFAULT_CONFIG_PATH = os.path.join(os.path.dirname(_THIS_FILE), - 'suppressions.xml') -_INSERT_COMMENT = ('TODO: This line was added by suppress.py,' - ' please add an explanation.') - - -class _Issue(object): - - def __init__(self, dom_element): - self.regexps = set() - self.dom_element = dom_element - - -def _CollectIssuesFromDom(dom): - issues_dict = {} - for issue_element in dom.getElementsByTagName('issue'): - issue_id = issue_element.attributes['id'].value - issue = _Issue(issue_element) - issues_dict[issue_id] = issue - for child in issue_element.childNodes: - if child.nodeType != minidom.Node.ELEMENT_NODE: - continue - if child.tagName == 'ignore' and child.getAttribute('regexp'): - issue.regexps.add(child.getAttribute('regexp')) - - return issues_dict - - -def _TrimWhitespaceNodes(n): - """Remove all whitespace-only TEXT_NODEs.""" - rm_children = [] - for c in n.childNodes: - if c.nodeType == minidom.Node.TEXT_NODE and c.data.strip() == '': - rm_children.append(c) - else: - _TrimWhitespaceNodes(c) - - for c in rm_children: - n.removeChild(c) - - -def _ParseAndInsertNewSuppressions(result_path, config_path): - print('Parsing %s' % config_path) - config_dom = minidom.parse(config_path) - issues_dict = _CollectIssuesFromDom(config_dom) - print('Parsing and merging %s' % result_path) - dom = minidom.parse(result_path) - for issue_element in dom.getElementsByTagName('issue'): - issue_id = issue_element.attributes['id'].value - severity = issue_element.attributes['severity'].value - path = issue_element.getElementsByTagName( - 'location')[0].attributes['file'].value - # Strip temporary file path. - path = re.sub(_TMP_DIR_RE, '', path) - # Escape Java inner class name separator and suppress with regex instead - # of path. Doesn't use re.escape() as it is a bit too aggressive and - # escapes '_', causing trouble with PRODUCT_DIR. - regexp = path.replace('$', r'\$') - if issue_id not in issues_dict: - element = config_dom.createElement('issue') - element.attributes['id'] = issue_id - element.attributes['severity'] = severity - config_dom.documentElement.appendChild(element) - issue = _Issue(element) - issues_dict[issue_id] = issue - else: - issue = issues_dict[issue_id] - if issue.dom_element.getAttribute('severity') == 'ignore': - continue - - if regexp not in issue.regexps: - issue.regexps.add(regexp) - ignore_element = config_dom.createElement('ignore') - ignore_element.attributes['regexp'] = regexp - issue.dom_element.appendChild(config_dom.createComment(_INSERT_COMMENT)) - issue.dom_element.appendChild(ignore_element) - - for issue_id, issue in issues_dict.iteritems(): - if issue.dom_element.getAttribute('severity') == 'ignore': - print('Warning: [%s] is suppressed globally.' % issue_id) - - # toprettyxml inserts whitespace, so delete whitespace first. - _TrimWhitespaceNodes(config_dom.documentElement) - - with open(config_path, 'w') as f: - f.write(config_dom.toprettyxml(indent=' ', encoding='utf-8')) - print('Updated %s' % config_path) - - -def _Suppress(config_path, result_path): - _ParseAndInsertNewSuppressions(result_path, config_path) - - -def main(): - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument('--config', - help='Path to suppression.xml config file', - default=_DEFAULT_CONFIG_PATH) - parser.add_argument('result_path', - help='Lint results xml file', - metavar='RESULT_FILE') - args = parser.parse_args() - - _Suppress(args.config, args.result_path) - - -if __name__ == '__main__': - main()
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index 5290e4ad..bf9009cd 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -988,11 +988,9 @@ pool = "//build/toolchain:link_pool($default_toolchain)" } - # Lint only requires generated sources and generated resources from the - # build. Since turbine __header targets already depend on and generate all - # the generated sources, and the __assetres targets include all generated - # resources, lint only needs to depend on the header and assetres targets - # rather than the top level java targets. + # Lint requires generated sources and generated resources from the build. + # Turbine __header targets depend on all generated sources, and the + # __assetres targets depend on all generated resources. if (defined(invoker.deps)) { foreach(_dep, invoker.deps) { _target_label = get_label_info(_dep, "label_no_toolchain") @@ -1000,16 +998,12 @@ filter_exclude([ _target_label ], _java_resource_patterns) != []) { deps += [ - # Strictly speaking the __header target is sufficient, since they - # already depend on resources (due to srcjar deps), but prefer to - # be more explicit here since if/when __header targets stop - # depending on resources (e.g. if R.java generation moves to java - # targets), lint will not be affected. "${_target_label}__assetres", "${_target_label}__header", ] } else { - # Keep non-java deps as they may generate files used by lint. + # Keep non-java deps as they may generate files used only by lint. + # e.g. generated suppressions.xml files. deps += [ _dep ] } } @@ -1111,6 +1105,13 @@ # The full classpath is required for annotation checks like @IntDef. "--classpath=@FileArg($_rebased_build_config:deps_info:javac_full_interface_classpath)", ] + + if (defined(invoker.lint_expected_warnings)) { + args += [ + "--expected-warnings", + invoker.lint_expected_warnings, + ] + } } outputs = [ _stamp_path ]
diff --git a/cc/metrics/frame_sequence_metrics.cc b/cc/metrics/frame_sequence_metrics.cc index 67d182b..01c2a5f 100644 --- a/cc/metrics/frame_sequence_metrics.cc +++ b/cc/metrics/frame_sequence_metrics.cc
@@ -51,6 +51,13 @@ FrameSequenceTracker::GetFrameSequenceTrackerTypeName(type)}); } +std::string GetMissedDeadlineHistogramName(FrameSequenceTrackerType type, + const char* thread_name) { + return base::StrCat( + {"Graphics.Smoothness.PercentMissedDeadlineFrames.", thread_name, ".", + FrameSequenceTracker::GetFrameSequenceTrackerTypeName(type)}); +} + std::string GetFrameSequenceLengthHistogramName(FrameSequenceTrackerType type) { return base::StrCat( {"Graphics.Smoothness.FrameSequenceLength.", @@ -206,6 +213,10 @@ DCHECK_LE(main_throughput_.frames_produced, main_throughput_.frames_expected); DCHECK_LE(aggregated_throughput_.frames_produced, aggregated_throughput_.frames_expected); + DCHECK_LE(impl_throughput_.frames_ontime, impl_throughput_.frames_expected); + DCHECK_LE(main_throughput_.frames_ontime, main_throughput_.frames_expected); + DCHECK_LE(aggregated_throughput_.frames_ontime, + aggregated_throughput_.frames_expected); // Terminates |trace_data_| for all types of FrameSequenceTracker. trace_data_.Terminate(); @@ -221,50 +232,94 @@ return; } + const bool main_report = ThroughputData::CanReportHistogram( + this, ThreadType::kMain, main_throughput_); + const bool compositor_report = ThroughputData::CanReportHistogram( + this, ThreadType::kCompositor, impl_throughput_); + + base::Optional<int> impl_throughput_percent_dropped; + base::Optional<int> impl_throughput_percent_missed; + base::Optional<int> main_throughput_percent_dropped; + base::Optional<int> main_throughput_percent_missed; + // Report the throughput metrics. - base::Optional<int> impl_throughput_percent = ThroughputData::ReportHistogram( - this, ThreadType::kCompositor, - GetIndexForMetric(FrameSequenceMetrics::ThreadType::kCompositor, type_), - impl_throughput_); - base::Optional<int> main_throughput_percent = ThroughputData::ReportHistogram( - this, ThreadType::kMain, - GetIndexForMetric(FrameSequenceMetrics::ThreadType::kMain, type_), - main_throughput_); + if (compositor_report) { + impl_throughput_percent_dropped = + ThroughputData::ReportDroppedFramePercentHistogram( + this, ThreadType::kCompositor, + GetIndexForMetric(FrameSequenceMetrics::ThreadType::kCompositor, + type_), + impl_throughput_); + impl_throughput_percent_missed = + ThroughputData::ReportMissedDeadlineFramePercentHistogram( + this, ThreadType::kCompositor, + GetIndexForMetric(FrameSequenceMetrics::ThreadType::kCompositor, + type_), + impl_throughput_); + } + if (main_report) { + main_throughput_percent_dropped = + ThroughputData::ReportDroppedFramePercentHistogram( + this, ThreadType::kMain, + GetIndexForMetric(FrameSequenceMetrics::ThreadType::kMain, type_), + main_throughput_); + main_throughput_percent_missed = + ThroughputData::ReportMissedDeadlineFramePercentHistogram( + this, ThreadType::kMain, + GetIndexForMetric(FrameSequenceMetrics::ThreadType::kMain, type_), + main_throughput_); + } // Report for the 'scrolling thread' for the scrolling interactions. if (scrolling_thread_ != ThreadType::kUnknown) { - base::Optional<int> scrolling_thread_throughput; + base::Optional<int> scrolling_thread_throughput_dropped; + base::Optional<int> scrolling_thread_throughput_missed; switch (scrolling_thread_) { case ThreadType::kCompositor: - scrolling_thread_throughput = impl_throughput_percent; + scrolling_thread_throughput_dropped = impl_throughput_percent_dropped; + scrolling_thread_throughput_missed = impl_throughput_percent_missed; break; case ThreadType::kMain: - scrolling_thread_throughput = main_throughput_percent; + scrolling_thread_throughput_dropped = main_throughput_percent_dropped; + scrolling_thread_throughput_missed = main_throughput_percent_missed; break; case ThreadType::kUnknown: NOTREACHED(); break; } - if (scrolling_thread_throughput.has_value()) { - // It's OK to use the UMA histogram in the following code while still - // using |GetThroughputHistogramName()| to get the name of the metric, - // since the input-params to the function never change at runtime. + // It's OK to use the UMA histogram in the following code while still + // using |GetThroughputHistogramName()| to get the name of the metric, + // since the input-params to the function never change at runtime. + if (scrolling_thread_throughput_dropped.has_value() && + scrolling_thread_throughput_missed.has_value()) { if (type_ == FrameSequenceTrackerType::kWheelScroll) { UMA_HISTOGRAM_PERCENTAGE( GetThroughputHistogramName(FrameSequenceTrackerType::kWheelScroll, "ScrollingThread"), - scrolling_thread_throughput.value()); + scrolling_thread_throughput_dropped.value()); + UMA_HISTOGRAM_PERCENTAGE( + GetMissedDeadlineHistogramName( + FrameSequenceTrackerType::kWheelScroll, "ScrollingThread"), + scrolling_thread_throughput_missed.value()); } else if (type_ == FrameSequenceTrackerType::kTouchScroll) { UMA_HISTOGRAM_PERCENTAGE( GetThroughputHistogramName(FrameSequenceTrackerType::kTouchScroll, "ScrollingThread"), - scrolling_thread_throughput.value()); + scrolling_thread_throughput_dropped.value()); + UMA_HISTOGRAM_PERCENTAGE( + GetMissedDeadlineHistogramName( + FrameSequenceTrackerType::kTouchScroll, "ScrollingThread"), + scrolling_thread_throughput_missed.value()); } else { DCHECK_EQ(type_, FrameSequenceTrackerType::kScrollbarScroll); UMA_HISTOGRAM_PERCENTAGE( GetThroughputHistogramName( FrameSequenceTrackerType::kScrollbarScroll, "ScrollingThread"), - scrolling_thread_throughput.value()); + scrolling_thread_throughput_dropped.value()); + UMA_HISTOGRAM_PERCENTAGE( + GetMissedDeadlineHistogramName( + FrameSequenceTrackerType::kScrollbarScroll, "ScrollingThread"), + scrolling_thread_throughput_missed.value()); } } } @@ -315,10 +370,9 @@ jank_reporter_->AddPresentedFrame(presentation_time, frame_interval); } -base::Optional<int> FrameSequenceMetrics::ThroughputData::ReportHistogram( +bool FrameSequenceMetrics::ThroughputData::CanReportHistogram( FrameSequenceMetrics* metrics, ThreadType thread_type, - int metric_index, const ThroughputData& data) { const auto sequence_type = metrics->type(); DCHECK_LT(sequence_type, FrameSequenceTrackerType::kMaxType); @@ -326,7 +380,26 @@ // All video frames are compositor thread only. if (sequence_type == FrameSequenceTrackerType::kVideo && thread_type == ThreadType::kMain) - return base::nullopt; + return false; + + if (data.frames_expected < kMinFramesForThroughputMetric) + return false; + + const bool is_animation = + ShouldReportForAnimation(sequence_type, thread_type); + + return is_animation || IsInteractionType(sequence_type) || + sequence_type == FrameSequenceTrackerType::kVideo; +} + +int FrameSequenceMetrics::ThroughputData::ReportDroppedFramePercentHistogram( + FrameSequenceMetrics* metrics, + ThreadType thread_type, + int metric_index, + const ThroughputData& data) { + const auto sequence_type = metrics->type(); + DCHECK_LT(sequence_type, FrameSequenceTrackerType::kMaxType); + DCHECK(CanReportHistogram(metrics, thread_type, data)); if (metrics->GetEffectiveThread() == thread_type) { STATIC_HISTOGRAM_POINTER_GROUP( @@ -339,9 +412,6 @@ base::HistogramBase::kUmaTargetedHistogramFlag)); } - if (data.frames_expected < kMinFramesForThroughputMetric) - return base::nullopt; - // Throughput means the percent of frames that was expected to show on the // screen but didn't. In other words, the lower the throughput is, the // smoother user experience. @@ -393,15 +463,9 @@ } } - if (!is_animation && !IsInteractionType(sequence_type) && - sequence_type != FrameSequenceTrackerType::kVideo) { - return base::nullopt; - } - - const char* thread_name = - thread_type == ThreadType::kCompositor - ? "CompositorThread" - : thread_type == ThreadType::kMain ? "MainThread" : "SlowerThread"; + const char* thread_name = thread_type == ThreadType::kCompositor + ? "CompositorThread" + : "MainThread"; STATIC_HISTOGRAM_POINTER_GROUP( GetThroughputHistogramName(sequence_type, thread_name), metric_index, kMaximumHistogramIndex, Add(percent), @@ -411,6 +475,66 @@ return percent; } +int FrameSequenceMetrics::ThroughputData:: + ReportMissedDeadlineFramePercentHistogram(FrameSequenceMetrics* metrics, + ThreadType thread_type, + int metric_index, + const ThroughputData& data) { + const auto sequence_type = metrics->type(); + DCHECK_LT(sequence_type, FrameSequenceTrackerType::kMaxType); + + // Throughput means the percent of frames that was expected to show on the + // screen but didn't. In other words, the lower the throughput is, the + // smoother user experience. + const int percent = data.MissedDeadlineFramePercent(); + + const bool is_animation = + ShouldReportForAnimation(sequence_type, thread_type); + const bool is_interaction = ShouldReportForInteraction(metrics, thread_type); + + if (is_animation) { + TRACE_EVENT_INSTANT2( + "cc,benchmark", "PercentMissedDeadlineFrames.AllAnimations", + TRACE_EVENT_SCOPE_THREAD, "frames_expected", data.frames_expected, + "frames_ontime", data.frames_ontime); + + UMA_HISTOGRAM_PERCENTAGE( + "Graphics.Smoothness.PercentMissedDeadlineFrames.AllAnimations", + percent); + } + + if (is_interaction) { + TRACE_EVENT_INSTANT2( + "cc,benchmark", "PercentMissedDeadlineFrames.AllInteractions", + TRACE_EVENT_SCOPE_THREAD, "frames_expected", data.frames_expected, + "frames_ontime", data.frames_ontime); + UMA_HISTOGRAM_PERCENTAGE( + "Graphics.Smoothness.PercentMissedDeadlineFrames.AllInteractions", + percent); + } + + if (is_animation || is_interaction) { + TRACE_EVENT_INSTANT2( + "cc,benchmark", "PercentMissedDeadlineFrames.AllSequences", + TRACE_EVENT_SCOPE_THREAD, "frames_expected", data.frames_expected, + "frames_ontime", data.frames_ontime); + UMA_HISTOGRAM_PERCENTAGE( + "Graphics.Smoothness.PercentMissedDeadlineFrames.AllSequences", + percent); + } + + const char* thread_name = thread_type == ThreadType::kCompositor + ? "CompositorThread" + : "MainThread"; + STATIC_HISTOGRAM_POINTER_GROUP( + GetMissedDeadlineHistogramName(sequence_type, thread_name), metric_index, + kMaximumHistogramIndex, Add(percent), + base::LinearHistogram::FactoryGet( + GetMissedDeadlineHistogramName(sequence_type, thread_name), 1, 100, + 101, base::HistogramBase::kUmaTargetedHistogramFlag)); + return percent; +} + std::unique_ptr<base::trace_event::TracedValue> FrameSequenceMetrics::ThroughputData::ToTracedValue( const ThroughputData& impl, @@ -420,9 +544,11 @@ if (effective_thread == ThreadType::kMain) { dict->SetInteger("main-frames-produced", main.frames_produced); dict->SetInteger("main-frames-expected", main.frames_expected); + dict->SetInteger("main-frames-ontime", main.frames_ontime); } else { dict->SetInteger("impl-frames-produced", impl.frames_produced); dict->SetInteger("impl-frames-expected", impl.frames_expected); + dict->SetInteger("impl-frames-ontime", impl.frames_ontime); } return dict; }
diff --git a/cc/metrics/frame_sequence_metrics.h b/cc/metrics/frame_sequence_metrics.h index 17a8285..3725d1d 100644 --- a/cc/metrics/frame_sequence_metrics.h +++ b/cc/metrics/frame_sequence_metrics.h
@@ -49,16 +49,27 @@ const ThroughputData& main, ThreadType effective_thred); - // Returns the throughput in percent, a return value of base::nullopt - // indicates that no throughput metric is reported. - static base::Optional<int> ReportHistogram(FrameSequenceMetrics* metrics, - ThreadType thread_type, - int metric_index, - const ThroughputData& data); + static bool CanReportHistogram(FrameSequenceMetrics* metrics, + ThreadType thread_type, + const ThroughputData& data); + + // Returns the dropped throughput in percent + static int ReportDroppedFramePercentHistogram(FrameSequenceMetrics* metrics, + ThreadType thread_type, + int metric_index, + const ThroughputData& data); + + // Returns the missed deadline throughput in percent + static int ReportMissedDeadlineFramePercentHistogram( + FrameSequenceMetrics* metrics, + ThreadType thread_type, + int metric_index, + const ThroughputData& data); void Merge(const ThroughputData& data) { frames_expected += data.frames_expected; frames_produced += data.frames_produced; + frames_ontime += data.frames_ontime; #if DCHECK_IS_ON() frames_processed += data.frames_processed; frames_received += data.frames_received; @@ -72,6 +83,13 @@ static_cast<double>(frames_expected)); } + int MissedDeadlineFramePercent() const { + if (frames_produced == 0) + return 0; + return std::ceil(100 * (frames_produced - frames_ontime) / + static_cast<double>(frames_produced)); + } + // Tracks the number of frames that were expected to be shown during this // frame-sequence. uint32_t frames_expected = 0; @@ -80,6 +98,10 @@ // during this frame-sequence. uint32_t frames_produced = 0; + // Tracks the number of frames that were actually presented to the user + // that didn't miss the vsync deadline during this frame-sequence. + uint32_t frames_ontime = 0; + #if DCHECK_IS_ON() // Tracks the number of frames that is either submitted or reported as no // damage.
diff --git a/cc/metrics/frame_sequence_metrics_unittest.cc b/cc/metrics/frame_sequence_metrics_unittest.cc index 6f514d1..9189f571 100644 --- a/cc/metrics/frame_sequence_metrics_unittest.cc +++ b/cc/metrics/frame_sequence_metrics_unittest.cc
@@ -19,12 +19,15 @@ nullptr); first.impl_throughput().frames_expected = 200u; first.impl_throughput().frames_produced = 190u; + first.impl_throughput().frames_ontime = 120u; first.aggregated_throughput().frames_expected = 170u; first.aggregated_throughput().frames_produced = 150u; + first.aggregated_throughput().frames_ontime = 100u; first.ReportMetrics(); EXPECT_EQ(first.aggregated_throughput().frames_expected, 0u); EXPECT_EQ(first.aggregated_throughput().frames_produced, 0u); + EXPECT_EQ(first.aggregated_throughput().frames_ontime, 0u); } TEST(FrameSequenceMetricsTest, MergeMetrics) { @@ -33,6 +36,7 @@ FrameSequenceMetrics first(FrameSequenceTrackerType::kTouchScroll, nullptr); first.impl_throughput().frames_expected = 20; first.impl_throughput().frames_produced = 10; + first.impl_throughput().frames_ontime = 5; EXPECT_FALSE(first.HasEnoughDataForReporting()); // Create a second metric with too few frames to report any metrics. @@ -40,6 +44,7 @@ FrameSequenceTrackerType::kTouchScroll, nullptr); second->impl_throughput().frames_expected = 90; second->impl_throughput().frames_produced = 60; + second->impl_throughput().frames_ontime = 50; EXPECT_FALSE(second->HasEnoughDataForReporting()); // Merge the two metrics. The result should have enough frames to report @@ -54,12 +59,14 @@ first.SetScrollingThread(FrameSequenceMetrics::ThreadType::kCompositor); first.impl_throughput().frames_expected = 20; first.impl_throughput().frames_produced = 10; + first.impl_throughput().frames_ontime = 10; auto second = std::make_unique<FrameSequenceMetrics>( FrameSequenceTrackerType::kTouchScroll, nullptr); second->SetScrollingThread(FrameSequenceMetrics::ThreadType::kMain); second->main_throughput().frames_expected = 50; second->main_throughput().frames_produced = 10; + second->main_throughput().frames_ontime = 10; ASSERT_DEATH(first.Merge(std::move(second)), ""); } @@ -71,8 +78,10 @@ FrameSequenceMetrics first(FrameSequenceTrackerType::kVideo, nullptr); first.impl_throughput().frames_expected = 120; first.impl_throughput().frames_produced = 80; + first.impl_throughput().frames_ontime = 80; first.main_throughput().frames_expected = 0; first.main_throughput().frames_produced = 0; + first.main_throughput().frames_ontime = 0; first.ReportMetrics(); histograms.ExpectTotalCount("Graphics.Smoothness.FrameSequenceLength.Video", 1u); @@ -86,8 +95,10 @@ FrameSequenceMetrics first(FrameSequenceTrackerType::kTouchScroll, nullptr); first.impl_throughput().frames_expected = 120; first.impl_throughput().frames_produced = 80; + first.impl_throughput().frames_ontime = 60; first.main_throughput().frames_expected = 20; first.main_throughput().frames_produced = 10; + first.main_throughput().frames_ontime = 5; EXPECT_TRUE(first.HasEnoughDataForReporting()); first.ReportMetrics(); @@ -98,6 +109,13 @@ 1u); histograms.ExpectTotalCount( "Graphics.Smoothness.PercentDroppedFrames.MainThread.TouchScroll", 0u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.CompositorThread." + "TouchScroll", + 1u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.MainThread.TouchScroll", + 0u); // There should still be data left over for the main-thread. EXPECT_TRUE(first.HasDataLeftForReporting()); @@ -106,7 +124,9 @@ FrameSequenceTrackerType::kTouchScroll, nullptr); second->impl_throughput().frames_expected = 110; second->impl_throughput().frames_produced = 100; + second->impl_throughput().frames_ontime = 80; second->main_throughput().frames_expected = 90; + second->main_throughput().frames_ontime = 70; first.Merge(std::move(second)); EXPECT_TRUE(first.HasEnoughDataForReporting()); first.ReportMetrics(); @@ -115,6 +135,13 @@ 2u); histograms.ExpectTotalCount( "Graphics.Smoothness.PercentDroppedFrames.MainThread.TouchScroll", 1u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.CompositorThread." + "TouchScroll", + 2u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.MainThread.TouchScroll", + 1u); // All the metrics have now been reported. No data should be left over. EXPECT_FALSE(first.HasDataLeftForReporting()); } @@ -128,8 +155,10 @@ nullptr); first.impl_throughput().frames_expected = 120; first.impl_throughput().frames_produced = 80; + first.impl_throughput().frames_ontime = 70; first.main_throughput().frames_expected = 120; first.main_throughput().frames_produced = 80; + first.main_throughput().frames_ontime = 70; EXPECT_TRUE(first.HasEnoughDataForReporting()); first.ReportMetrics(); @@ -146,18 +175,34 @@ "Graphics.Smoothness.PercentDroppedFrames.SlowerThread." "CompositorAnimation", 0u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.CompositorThread." + "CompositorAnimation", + 1u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.MainThread." + "CompositorAnimation", + 0u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.SlowerThread." + "CompositorAnimation", + 0u); // Not reported, but the data should be reset. EXPECT_EQ(first.impl_throughput().frames_expected, 0u); EXPECT_EQ(first.impl_throughput().frames_produced, 0u); + EXPECT_EQ(first.impl_throughput().frames_ontime, 0u); EXPECT_EQ(first.main_throughput().frames_expected, 0u); EXPECT_EQ(first.main_throughput().frames_produced, 0u); + EXPECT_EQ(first.main_throughput().frames_ontime, 0u); FrameSequenceMetrics second(FrameSequenceTrackerType::kRAF, nullptr); second.impl_throughput().frames_expected = 120; second.impl_throughput().frames_produced = 80; + second.impl_throughput().frames_ontime = 70; second.main_throughput().frames_expected = 120; second.main_throughput().frames_produced = 80; + second.main_throughput().frames_ontime = 70; EXPECT_TRUE(second.HasEnoughDataForReporting()); second.ReportMetrics(); @@ -169,6 +214,13 @@ "Graphics.Smoothness.PercentDroppedFrames.MainThread.RAF", 1u); histograms.ExpectTotalCount( "Graphics.Smoothness.PercentDroppedFrames.SlowerThread.RAF", 0u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.CompositorThread.RAF", + 0u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.MainThread.RAF", 1u); + histograms.ExpectTotalCount( + "Graphics.Smoothness.PercentMissedDeadlineFrames.SlowerThread.RAF", 0u); } TEST(FrameSequenceMetricsTest, ScrollingThreadMetricsReportedForInteractions) { @@ -177,8 +229,10 @@ FrameSequenceTrackerType::kTouchScroll, nullptr); metrics->impl_throughput().frames_expected = 100; metrics->impl_throughput().frames_produced = 80; + metrics->impl_throughput().frames_ontime = 70; metrics->main_throughput().frames_expected = 100; metrics->main_throughput().frames_produced = 60; + metrics->main_throughput().frames_ontime = 50; return metrics; };
diff --git a/cc/metrics/frame_sequence_tracker.cc b/cc/metrics/frame_sequence_tracker.cc index 56019f9..9e851e3d 100644 --- a/cc/metrics/frame_sequence_tracker.cc +++ b/cc/metrics/frame_sequence_tracker.cc
@@ -361,6 +361,9 @@ DCHECK_GT(impl_throughput().frames_expected, impl_throughput().frames_produced) << TRACKER_DCHECK_MSG; + DCHECK_GE(impl_throughput().frames_produced, + impl_throughput().frames_ontime) + << TRACKER_DCHECK_MSG; --impl_throughput().frames_expected; #if DCHECK_IS_ON() ++impl_throughput().frames_processed; @@ -437,9 +440,28 @@ uint32_t impl_frames_produced = 0; uint32_t main_frames_produced = 0; + uint32_t impl_frames_ontime = 0; + uint32_t main_frames_ontime = 0; + + const auto& vsync_interval = + (feedback.interval.is_zero() ? viz::BeginFrameArgs::DefaultInterval() + : feedback.interval) * + 1.5; + DCHECK(!vsync_interval.is_zero()) << TRACKER_DCHECK_MSG; + base::TimeTicks safe_deadline_for_frame = + last_frame_presentation_timestamp_ + vsync_interval; const bool was_presented = !feedback.failed(); if (was_presented && submitted_frame_since_last_presentation) { + if (!last_frame_presentation_timestamp_.is_null() && + (safe_deadline_for_frame < feedback.timestamp)) { + DCHECK_LE(impl_throughput().frames_ontime, + impl_throughput().frames_produced) + << TRACKER_DCHECK_MSG; + ++impl_throughput().frames_ontime; + ++impl_frames_ontime; + } + DCHECK_LT(impl_throughput().frames_produced, impl_throughput().frames_expected) << TRACKER_DCHECK_MSG; @@ -474,6 +496,16 @@ metrics()->ComputeJank(FrameSequenceMetrics::ThreadType::kMain, feedback.timestamp, feedback.interval); } + if (main_frames_.size() < size_before_erase) { + if (!last_frame_presentation_timestamp_.is_null() && + (safe_deadline_for_frame < feedback.timestamp)) { + DCHECK_LE(main_throughput().frames_ontime, + main_throughput().frames_produced) + << TRACKER_DCHECK_MSG; + ++main_throughput().frames_ontime; + ++main_frames_ontime; + } + } if (impl_frames_produced > 0) { // If there is no main frame presented, then we need to see whether or not @@ -492,6 +524,7 @@ // frames produced so that we can apply that to aggregated throughput // if the main frame reports no-damage later on. impl_frames_produced_while_expecting_main_ += impl_frames_produced; + impl_frames_ontime_while_expecting_main_ += impl_frames_ontime; } else { // TODO(https://crbug.com/1066455): Determine why this DCHECK is // causing PageLoadMetricsBrowserTests to flake, and re-enable. @@ -499,10 +532,14 @@ // << TRACKER_DCHECK_MSG; aggregated_throughput().frames_produced += impl_frames_produced; impl_frames_produced_while_expecting_main_ = 0; + aggregated_throughput().frames_ontime += impl_frames_ontime; + impl_frames_ontime_while_expecting_main_ = 0; } } else { aggregated_throughput().frames_produced += main_frames_produced; impl_frames_produced_while_expecting_main_ = 0; + aggregated_throughput().frames_ontime += main_frames_ontime; + impl_frames_ontime_while_expecting_main_ = 0; while (!expecting_main_when_submit_impl_.empty() && !viz::FrameTokenGT(expecting_main_when_submit_impl_.front(), frame_token)) { @@ -511,6 +548,8 @@ } } + last_frame_presentation_timestamp_ = feedback.timestamp; + if (checkerboarding_.last_frame_had_checkerboarding) { DCHECK(!checkerboarding_.last_frame_timestamp.is_null()) << TRACKER_DCHECK_MSG; @@ -608,6 +647,8 @@ DCHECK_GT(main_throughput().frames_expected, main_throughput().frames_produced) << TRACKER_DCHECK_MSG; + DCHECK_GE(main_throughput().frames_produced, main_throughput().frames_ontime) + << TRACKER_DCHECK_MSG; last_no_main_damage_sequence_ = args.frame_id.sequence_number; --main_throughput().frames_expected; // Compute the number of actually expected compositor frames during this main @@ -634,6 +675,9 @@ aggregated_throughput().frames_produced += impl_frames_produced_while_expecting_main_; impl_frames_produced_while_expecting_main_ = 0; + aggregated_throughput().frames_ontime += + impl_frames_ontime_while_expecting_main_; + impl_frames_ontime_while_expecting_main_ = 0; expecting_main_when_submit_impl_.clear(); }
diff --git a/cc/metrics/frame_sequence_tracker.h b/cc/metrics/frame_sequence_tracker.h index 5d1d92e..3c59aea 100644 --- a/cc/metrics/frame_sequence_tracker.h +++ b/cc/metrics/frame_sequence_tracker.h
@@ -214,6 +214,9 @@ // scheduled to report histogram. base::TimeTicks first_frame_timestamp_; + // Tracks the presentation timestamp of the previous frame. + base::TimeTicks last_frame_presentation_timestamp_; + // Keeps track of whether the impl-frame being processed did not have any // damage from the compositor (i.e. 'impl damage'). bool frame_had_no_compositor_damage_ = false; @@ -244,6 +247,7 @@ // presented because if that main frame ends up with no-damage, then we should // count the impl frames that were produced in the meantime. uint32_t impl_frames_produced_while_expecting_main_ = 0; + uint32_t impl_frames_ontime_while_expecting_main_ = 0; // Each entry is a frame token, inserted at ReportSubmitFrame. base::circular_deque<uint32_t> expecting_main_when_submit_impl_;
diff --git a/cc/test/test_skcanvas.h b/cc/test/test_skcanvas.h index f56fda1b..b64a89c 100644 --- a/cc/test/test_skcanvas.h +++ b/cc/test/test_skcanvas.h
@@ -46,7 +46,6 @@ void onDrawRect(const SkRect& rect, const SkPaint& paint) override { OnDrawRectWithColor(paint.getColor()); } - GrContext* getGrContext() override { return context_.get(); } GrRecordingContext* recordingContext() override { return context_.get(); } MOCK_METHOD1(OnDrawPaintWithColor, void(SkColor));
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 4a830079..bacc3f40 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -1265,7 +1265,7 @@ "java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java", "java/src/org/chromium/chrome/browser/payments/SettingsAutofillAndPaymentsObserver.java", "java/src/org/chromium/chrome/browser/payments/ShippingStrings.java", - "java/src/org/chromium/chrome/browser/payments/SkipToGPayHelper.java", + "java/src/org/chromium/chrome/browser/payments/SkipToGPayHelperUtil.java", "java/src/org/chromium/chrome/browser/payments/TwaPackageManagerDelegate.java", "java/src/org/chromium/chrome/browser/payments/UrlUtils.java", "java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerActionModeCallback.java",
diff --git a/chrome/android/chrome_junit_test_java_sources.gni b/chrome/android/chrome_junit_test_java_sources.gni index f15b0ac..1177175 100644 --- a/chrome/android/chrome_junit_test_java_sources.gni +++ b/chrome/android/chrome_junit_test_java_sources.gni
@@ -234,6 +234,7 @@ "junit/src/org/chromium/chrome/browser/tasks/EngagementTimeUtilTest.java", "junit/src/org/chromium/chrome/browser/tasks/JourneyManagerTest.java", "junit/src/org/chromium/chrome/browser/toolbar/LocationBarFocusScrimHandlerTest.java", + "junit/src/org/chromium/chrome/browser/toolbar/LocationBarModelTest.java", "junit/src/org/chromium/chrome/browser/toolbar/ToolbarTabControllerImplTest.java", "junit/src/org/chromium/chrome/browser/toolbar/load_progress/LoadProgressMediatorTest.java", "junit/src/org/chromium/chrome/browser/toolbar/menu_button/MenuButtonCoordinatorTest.java",
diff --git a/chrome/android/expectations/lint-suppressions.xml b/chrome/android/expectations/lint-suppressions.xml index 0190b8b..9954977 100644 --- a/chrome/android/expectations/lint-suppressions.xml +++ b/chrome/android/expectations/lint-suppressions.xml
@@ -176,12 +176,8 @@ <ignore regexp="Static interface method requires API level 24"/> <!-- 1: TaskInfo is refactored at API 29. --> <ignore regexp="Field requires API level .*`android.app.TaskInfo"/> - <!-- 1: TODO(crbug.com/1082222): Fix --> - <ignore regexp="chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderView.java"/> <!-- 1: TODO(crbug.com/1085410): Fix --> <ignore regexp="components/content_capture/android/java/src/org/chromium/components/content_capture"/> - <!-- 1: TODO(wnwen): File bugs to fix --> - <ignore regexp="android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/BoundaryInterfaceReflectionUtil.java"/> <!-- Endnote: Please specify number of suppressions when adding more --> </issue> <!-- This warning just adds a lot of false positives. -->
diff --git a/chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc b/chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc index d826c8ca..5d764048 100644 --- a/chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc +++ b/chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc
@@ -145,6 +145,10 @@ bool expect_message_start_ = true; }; +typedef std::pair<std::array<uint8_t, device::cablev2::kNonceSize>, + std::array<uint8_t, device::kCableEphemeralIdSize>> + NonceAndEID; + // AuthenticatorState contains the keys for a caBLE v2 authenticator. struct AuthenticatorState { // pairing_data contains long-term keys, and information that is potentially @@ -156,13 +160,13 @@ // pairing_advert contains information about the BLE advert that is sent based // on the long-term keys. - device::cablev2::NonceAndEID pairing_advert; + NonceAndEID pairing_advert; // If doing a QR pairing, the following two members will be present. // qr_advert contains information about the BLE advert that is sent based on // QR pairing keys. - base::Optional<device::cablev2::NonceAndEID> qr_advert; + base::Optional<NonceAndEID> qr_advert; // qr_psk_gen_key contains the PSK generating key derived from the QR secret. base::Optional<device::CablePskGeneratorKey> qr_psk_gen_key; // peer_identity is the public-key of the desktop from the scanned QR code. @@ -869,7 +873,7 @@ CableInterface() = default; void StartAdvertising(const device::CableEidGeneratorKey& eid_gen_key, - device::cablev2::NonceAndEID* out_nonce_and_eid) { + NonceAndEID* out_nonce_and_eid) { std::array<uint8_t, device::kCableNonceSize> nonce; crypto::RandBytes(nonce);
diff --git a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceNoTabsTest.java b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceNoTabsTest.java new file mode 100644 index 0000000..464462e --- /dev/null +++ b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceNoTabsTest.java
@@ -0,0 +1,202 @@ +// Copyright 2020 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.features.start_surface; + +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.ViewMatchers.Visibility.GONE; +import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; +import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility; +import static androidx.test.espresso.matcher.ViewMatchers.withId; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import static org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil.TAB_SWITCHER_ON_RETURN_MS; + +import android.content.Intent; + +import androidx.test.filters.MediumTest; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.params.ParameterAnnotations; +import org.chromium.base.test.params.ParameterAnnotations.UseRunnerDelegate; +import org.chromium.base.test.params.ParameterSet; +import org.chromium.base.test.params.ParameterizedRunner; +import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.Feature; +import org.chromium.base.test.util.Restriction; +import org.chromium.chrome.browser.flags.CachedFeatureFlags; +import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.flags.ChromeSwitches; +import org.chromium.chrome.browser.tasks.ReturnToChromeExperimentsUtil; +import org.chromium.chrome.start_surface.R; +import org.chromium.chrome.test.ChromeActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; +import org.chromium.chrome.test.util.browser.Features.EnableFeatures; +import org.chromium.content_public.browser.test.util.CriteriaHelper; +import org.chromium.ui.test.util.UiRestriction; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +/** + * Integration tests of the {@link StartSurface} for cases where there are no tabs. See {@link + * StartSurfaceTest} for test that have tabs. + */ +@RunWith(ParameterizedRunner.class) +@UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) +@Restriction( + {UiRestriction.RESTRICTION_TYPE_PHONE, Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE}) +@EnableFeatures({ChromeFeatureList.START_SURFACE_ANDROID + "<Study"}) +@CommandLineFlags. +Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, "force-fieldtrials=Study/Group"}) +public class StartSurfaceNoTabsTest { + @ParameterAnnotations.ClassParameter + private static List<ParameterSet> sClassParams = + Arrays.asList(new ParameterSet().value(false, false).name("NoInstant_NoReturn"), + new ParameterSet().value(true, false).name("Instant_NoReturn"), + new ParameterSet().value(false, true).name("NoInstant_Return"), + new ParameterSet().value(true, true).name("Instant_Return")); + + private static final String BASE_PARAMS = + "force-fieldtrial-params=Study.Group:start_surface_variation"; + + @Rule + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); + + private final boolean mImmediateReturn; + + public StartSurfaceNoTabsTest(boolean useInstantStart, boolean immediateReturn) { + CachedFeatureFlags.setForTesting(ChromeFeatureList.INSTANT_START, useInstantStart); + + mImmediateReturn = immediateReturn; + } + + /** + * Only launch Chrome without waiting for a current tab. + * This test could not use {@link ChromeActivityTestRule#startMainActivityFromLauncher()} + * because of its {@link org.chromium.chrome.browser.tab.Tab} dependency. + */ + private void startMainActivityFromLauncher() { + Intent intent = new Intent(Intent.ACTION_MAIN); + intent.addCategory(Intent.CATEGORY_LAUNCHER); + mActivityTestRule.prepareUrlIntent(intent, null); + mActivityTestRule.startActivityCompletely(intent); + } + + @Before + public void setUp() throws IOException { + if (mImmediateReturn) { + TAB_SWITCHER_ON_RETURN_MS.setForTesting(0); + assertEquals(0, ReturnToChromeExperimentsUtil.TAB_SWITCHER_ON_RETURN_MS.getValue()); + assertTrue(ReturnToChromeExperimentsUtil.shouldShowTabSwitcher(-1)); + } else { + assertFalse(ReturnToChromeExperimentsUtil.shouldShowTabSwitcher(-1)); + } + + startMainActivityFromLauncher(); + } + + @Test + @MediumTest + @Feature({"StartSurface"}) + // clang-format off + @CommandLineFlags.Add({BASE_PARAMS + "/single"}) + public void testShow_SingleAsHomepage_NoTabs() { + // clang-format on + CriteriaHelper.pollUiThread( + () + -> mActivityTestRule.getActivity().getLayoutManager() != null + && mActivityTestRule.getActivity().getLayoutManager().overviewVisible()); + + onView(withId(R.id.primary_tasks_surface_view)).check(matches(isDisplayed())); + onView(withId(R.id.search_box_text)).check(matches(isDisplayed())); + onView(withId(org.chromium.chrome.tab_ui.R.id.mv_tiles_container)) + .check(matches(isDisplayed())); + onView(withId(org.chromium.chrome.tab_ui.R.id.tab_switcher_title)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.carousel_tab_switcher_container)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.more_tabs)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.tasks_surface_body)) + .check(matches(isDisplayed())); + onView(withId(org.chromium.chrome.tab_ui.R.id.trendy_terms_recycler_view)) + .check(matches(withEffectiveVisibility(GONE))); + } + + @Test + @MediumTest + @Feature({"StartSurface"}) + // clang-format off + @CommandLineFlags.Add({BASE_PARAMS + "/single/exclude_mv_tiles/true" + + "/show_last_active_tab_only/true/show_stack_tab_switcher/true" + + "/open_ntp_instead_of_start/true"}) + public void testShow_SingleAsHomepage_V2_NoTabs() { + // clang-format on + CriteriaHelper.pollUiThread( + () + -> mActivityTestRule.getActivity().getLayoutManager() != null + && mActivityTestRule.getActivity().getLayoutManager().overviewVisible()); + + onView(withId(R.id.primary_tasks_surface_view)).check(matches(isDisplayed())); + onView(withId(R.id.search_box_text)).check(matches(isDisplayed())); + onView(withId(org.chromium.chrome.tab_ui.R.id.mv_tiles_container)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.tab_switcher_title)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.carousel_tab_switcher_container)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.single_tab_view)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.tasks_surface_body)) + .check(matches(isDisplayed())); + onView(withId(org.chromium.chrome.tab_ui.R.id.trendy_terms_recycler_view)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.incognito_switch)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.more_tabs)) + .check(matches(withEffectiveVisibility(GONE))); + } + + @Test + @MediumTest + @Feature({"StartSurface"}) + // clang-format off + @CommandLineFlags.Add({BASE_PARAMS + "/single/exclude_mv_tiles/true" + + "/show_last_active_tab_only/true/open_ntp_instead_of_start/true"}) + public void testShow_SingleAsHomepage_SingleTabSwitcher_NoTabs() { + // clang-format on + CriteriaHelper.pollUiThread( + () + -> mActivityTestRule.getActivity().getLayoutManager() != null + && mActivityTestRule.getActivity().getLayoutManager().overviewVisible()); + + onView(withId(R.id.primary_tasks_surface_view)).check(matches(isDisplayed())); + onView(withId(R.id.search_box_text)).check(matches(isDisplayed())); + onView(withId(org.chromium.chrome.tab_ui.R.id.mv_tiles_container)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.tab_switcher_title)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.carousel_tab_switcher_container)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.single_tab_view)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.more_tabs)) + .check(matches(withEffectiveVisibility(GONE))); + onView(withId(org.chromium.chrome.tab_ui.R.id.tasks_surface_body)) + .check(matches(isDisplayed())); + onView(withId(org.chromium.chrome.tab_ui.R.id.trendy_terms_recycler_view)) + .check(matches(withEffectiveVisibility(GONE))); + } +}
diff --git a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java index 05f5af53..65dc1a6 100644 --- a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java +++ b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java
@@ -103,7 +103,10 @@ import java.util.List; import java.util.concurrent.ExecutionException; -/** Integration tests of the {@link StartSurface}. */ +/** + * Integration tests of the {@link StartSurface} for cases with tabs. See {@link + * StartSurfaceNoTabsTest} for test that have no tabs. + */ @RunWith(ParameterizedRunner.class) @UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) @Restriction(
diff --git a/chrome/android/features/start_surface/internal/javatests/start_surface_test_java_sources.gni b/chrome/android/features/start_surface/internal/javatests/start_surface_test_java_sources.gni index 92bb05ab..5683e2d9 100644 --- a/chrome/android/features/start_surface/internal/javatests/start_surface_test_java_sources.gni +++ b/chrome/android/features/start_surface/internal/javatests/start_surface_test_java_sources.gni
@@ -9,6 +9,7 @@ "//chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/SecondaryTasksSurfaceViewBinderTest.java", "//chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutPerfTest.java", "//chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceLayoutTest.java", + "//chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceNoTabsTest.java", "//chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java", "//chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/TasksSurfaceViewBinderTest.java", ]
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java b/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java index 81a2f619..6efc9f7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java
@@ -27,7 +27,6 @@ import org.chromium.base.task.AsyncTask; import org.chromium.chrome.R; import org.chromium.chrome.browser.app.ChromeActivity; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.toolbar.ControlContainer; import org.chromium.components.embedder_support.util.UrlConstants; @@ -333,12 +332,9 @@ public void createSpareRenderProcessHost(Profile profile) { ThreadUtils.assertOnUiThread(); if (!LibraryLoader.getInstance().isInitialized()) return; - if (ChromeFeatureList.isEnabled(ChromeFeatureList.OMNIBOX_SPARE_RENDERER)) { - // Spare WebContents should not be used with spare RenderProcessHosts, but if one - // has been created, destroy it in order not to consume too many processes. - destroySpareWebContents(); - WarmupManagerJni.get().warmupSpareRenderer(profile); - } + + destroySpareWebContents(); + WarmupManagerJni.get().warmupSpareRenderer(profile); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIncognitoManager.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIncognitoManager.java index 1c03ebc..bd7a3cc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIncognitoManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIncognitoManager.java
@@ -7,10 +7,12 @@ import android.view.WindowManager; import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import org.chromium.base.CommandLine; import org.chromium.base.UnownedUserData; import org.chromium.base.UnownedUserDataKey; +import org.chromium.base.annotations.CheckDiscard; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider; import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController; @@ -36,6 +38,8 @@ */ @ActivityScope public class CustomTabIncognitoManager implements NativeInitObserver, Destroyable, UnownedUserData { + private static CustomTabIncognitoManager sCustomTabIncognitoManagerUsedForTesting; + private static final String TAG = "CctIncognito"; /** The key for accessing this object on an {@link org.chromium.base.UnownedUserDataHost}. */ private static final UnownedUserDataKey<CustomTabIncognitoManager> KEY = @@ -69,6 +73,13 @@ attach(mWindowAndroid, this); } + @CheckDiscard("Test-only setter.") + @VisibleForTesting + public static void setCustomTabIncognitoManagerUsedForTesting( + CustomTabIncognitoManager customTabIncognitoManager) { + sCustomTabIncognitoManagerUsedForTesting = customTabIncognitoManager; + } + /** * Get the Activity's {@link CustomTabIncognitoManager} from the provided {@link * WindowAndroid}. @@ -76,6 +87,10 @@ * @return The Activity's {@link CustomTabIncognitoManager}. */ public static @Nullable CustomTabIncognitoManager from(WindowAndroid window) { + if (sCustomTabIncognitoManagerUsedForTesting != null) { + return sCustomTabIncognitoManagerUsedForTesting; + } + return KEY.retrieveDataFromHost(window.getUnownedUserDataHost()); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java index 2d18938..9e60efb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java
@@ -13,9 +13,12 @@ import androidx.collection.ArraySet; import org.chromium.base.Log; +import org.chromium.base.ThreadUtils; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.NativeMethods; +import org.chromium.base.task.PostTask; import org.chromium.chrome.browser.WarmupManager; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.ntp.NewTabPage; import org.chromium.chrome.browser.omnibox.OmniboxSuggestionType; import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteResult.GroupDetails; @@ -25,6 +28,7 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.components.omnibox.SuggestionAnswer; import org.chromium.components.query_tiles.QueryTile; +import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.WebContents; import org.chromium.url.GURL; @@ -168,10 +172,23 @@ assert mListener != null : "Ensure a listener is set prior to calling."; if (profile == null || TextUtils.isEmpty(url)) return; - if (!NewTabPage.isNTPUrl(url)) { - // Proactively start up a renderer, to reduce the time to display search results, - // especially if a Service Worker is used. - WarmupManager.getInstance().createSpareRenderProcessHost(profile); + // Proactively start up a renderer, to reduce the time to display search results, + // especially if a Service Worker is used. This is done in a PostTask with a + // experiment-configured delay so that the CPU usage associated with starting a new renderer + // process does not impact the Omnibox initialization. Note that there's a small chance the + // renderer will be started after the next navigation if the delay is too long, but the + // spare renderer will probably get used anyways by a later navigation. + if (!NewTabPage.isNTPUrl(url) + && ChromeFeatureList.isEnabled(ChromeFeatureList.OMNIBOX_SPARE_RENDERER)) { + PostTask.postDelayedTask(UiThreadTaskTraits.BEST_EFFORT, + () + -> { + ThreadUtils.assertOnUiThread(); + WarmupManager.getInstance().createSpareRenderProcessHost(profile); + }, + ChromeFeatureList.getFieldTrialParamByFeatureAsInt( + ChromeFeatureList.OMNIBOX_SPARE_RENDERER, + "omnibox_spare_renderer_delay_ms", 0)); } mNativeAutocompleteControllerAndroid = AutocompleteControllerJni.get().init(AutocompleteController.this, profile);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java index 6752028..08409974 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -57,6 +57,7 @@ import org.chromium.components.payments.PaymentUIsObserver; import org.chromium.components.payments.PaymentValidator; import org.chromium.components.payments.Section; +import org.chromium.components.payments.SkipToGPayHelper; import org.chromium.components.payments.UrlUtil; import org.chromium.content_public.browser.RenderFrameHost; import org.chromium.content_public.browser.WebContents; @@ -252,10 +253,10 @@ assert details != null; boolean googlePayBridgeActivated = googlePayBridgeEligible - && SkipToGPayHelper.canActivateExperiment(mWebContents, rawMethodData); + && SkipToGPayHelperUtil.canActivateExperiment(mWebContents, rawMethodData); - Map<String, PaymentMethodData> methodData = getValidatedMethodData( - rawMethodData, googlePayBridgeActivated, mPaymentUIsManager.getCardEditor()); + Map<String, PaymentMethodData> methodData = + getValidatedMethodData(rawMethodData, googlePayBridgeActivated); if (methodData == null) { mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER); @@ -280,10 +281,8 @@ mSpec = PaymentRequestSpec.createAndValidate( details, mPaymentOptions, methodData, LocaleUtils.getDefaultLocaleString()); - if (mSpec != null && parseAndValidateDetailsForSkipToGPayHelper(details)) { - mPaymentUIsManager.updateDetailsOnPaymentRequestUI( - details, mSpec.getRawTotal(), mSpec.getRawLineItems()); - } else { + if (mSpec == null + || !parseAndValidateDetailsForSkipToGPayHelper(mSpec.getPaymentDetails())) { mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER); disconnectFromClientWithDebugMessage(ErrorStrings.INVALID_PAYMENT_DETAILS); return false; @@ -295,6 +294,9 @@ return false; } + mPaymentUIsManager.updateDetailsOnPaymentRequestUI( + mSpec.getPaymentDetails(), mSpec.getRawTotal(), mSpec.getRawLineItems()); + // The first time initializations and validation of all of the parameters of {@link // PaymentRequestParams} should be done before {@link // PaymentRequestLifeCycleObserver#onPaymentRequestParamsInitiated}. @@ -532,8 +534,7 @@ } private static Map<String, PaymentMethodData> getValidatedMethodData( - PaymentMethodData[] methodData, boolean googlePayBridgeEligible, - CardEditor paymentMethodsCollector) { + PaymentMethodData[] methodData, boolean googlePayBridgeEligible) { // Payment methodData are required. assert methodData != null; if (methodData.length == 0) return null; @@ -554,8 +555,6 @@ } } result.put(method, methodData[i]); - - paymentMethodsCollector.addAcceptedPaymentMethodIfRecognized(methodData[i]); } return Collections.unmodifiableMap(result); @@ -755,16 +754,15 @@ return; } - if (mSpec.parseAndValidateDetails(details) - && parseAndValidateDetailsForSkipToGPayHelper(details)) { - mPaymentUIsManager.updateDetailsOnPaymentRequestUI( - details, mSpec.getRawTotal(), mSpec.getRawLineItems()); - } else { + if (!mSpec.parseAndValidateDetails(details) + || !parseAndValidateDetailsForSkipToGPayHelper(details)) { mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER); disconnectFromClientWithDebugMessage(ErrorStrings.INVALID_PAYMENT_DETAILS); return; } mSpec.updateWith(details); + mPaymentUIsManager.updateDetailsOnPaymentRequestUI( + mSpec.getPaymentDetails(), mSpec.getRawTotal(), mSpec.getRawLineItems()); if (mInvokedPaymentApp != null && mInvokedPaymentApp.isWaitingForPaymentDetailsUpdate()) { // After a payment app has been invoked, all of the merchant's calls to update the price @@ -804,16 +802,15 @@ return; } - if (mSpec.parseAndValidateDetails(details) - && parseAndValidateDetailsForSkipToGPayHelper(details)) { - mPaymentUIsManager.updateDetailsOnPaymentRequestUI( - details, mSpec.getRawTotal(), mSpec.getRawLineItems()); - } else { + if (!mSpec.parseAndValidateDetails(details) + || !parseAndValidateDetailsForSkipToGPayHelper(details)) { mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER); disconnectFromClientWithDebugMessage(ErrorStrings.INVALID_PAYMENT_DETAILS); return; } mSpec.updateWith(details); + mPaymentUIsManager.updateDetailsOnPaymentRequestUI( + mSpec.getPaymentDetails(), mSpec.getRawTotal(), mSpec.getRawLineItems()); if (!TextUtils.isEmpty(details.error)) { mJourneyLogger.setNotShown(NotShownReason.OTHER);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/SkipToGPayHelperUtil.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/SkipToGPayHelperUtil.java new file mode 100644 index 0000000..c9cc2b12 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/SkipToGPayHelperUtil.java
@@ -0,0 +1,57 @@ +// Copyright 2020 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; + +import androidx.collection.ArrayMap; + +import org.chromium.components.payments.MethodStrings; +import org.chromium.components.payments.PaymentFeatureList; +import org.chromium.components.payments.SkipToGPayHelper; +import org.chromium.content_public.browser.WebContents; +import org.chromium.payments.mojom.PaymentMethodData; + +import java.util.Map; + +/** + * This class contains all static utility methods for {@link SkipToGPayHelper}. This class should be + * combined into {@link SkipToGPayHelper} once all browser dependencies (e.g., {@link + * AutofillPaymentAppFactory}) are removed. + */ +public final class SkipToGPayHelperUtil { + /** + * Returns whether the skip-to-GPay experiment should be enabled. + * @param webContents The WebContents that triggered the PaymentRequest. + * @param rawMethodData The PaymentMethodData[] provided to PaymentRequest constructor. + * @return True if either of the two skip-to-GPay experiment flow can be enabled. + */ + public static boolean canActivateExperiment( + WebContents webContents, PaymentMethodData[] rawMethodData) { + if (rawMethodData == null || rawMethodData.length == 0) return false; + + Map<String, PaymentMethodData> methodData = new ArrayMap<>(); + for (int i = 0; i < rawMethodData.length; i++) { + String method = rawMethodData[i].supportedMethod; + if (method.equals(MethodStrings.BASIC_CARD)) { + methodData.put(method, rawMethodData[i]); + break; + } + } + if (methodData.isEmpty()) return false; + + // V2 experiment: enable skip-to-GPay regardless of usable basic-card. + if (PaymentFeatureList.isEnabledOrExperimentalFeaturesEnabled( + PaymentFeatureList.PAYMENT_REQUEST_SKIP_TO_GPAY)) { + return true; + } + + // V1 experiment: only enable skip-to-GPay if no usable basic-card exists. + // This check for autofill card is duplicate work if skip-to-GPay ends up not being + // enabled and adds a small delay (average ~3ms with first time ) to all hybrid request + // flows. However, this is the cleanest way to implement SKIP_TO_GPAY_IF_NO_CARD. + return !AutofillPaymentAppFactory.hasUsableAutofillCard(webContents, methodData) + && PaymentFeatureList.isEnabledOrExperimentalFeaturesEnabled( + PaymentFeatureList.PAYMENT_REQUEST_SKIP_TO_GPAY_IF_NO_CARD); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUIsManager.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUIsManager.java index 369c3e0..68985cf9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUIsManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUIsManager.java
@@ -73,6 +73,7 @@ import org.chromium.payments.mojom.PaymentDetails; import org.chromium.payments.mojom.PaymentDetailsModifier; import org.chromium.payments.mojom.PaymentItem; +import org.chromium.payments.mojom.PaymentMethodData; import org.chromium.payments.mojom.PaymentOptions; import org.chromium.payments.mojom.PaymentShippingOption; import org.chromium.payments.mojom.PaymentValidationErrors; @@ -559,6 +560,9 @@ // Implement PaymentRequestLifecycleObserver: @Override public void onPaymentRequestParamsInitiated(PaymentRequestParams params) { + for (PaymentMethodData method : params.getMethodData().values()) { + mCardEditor.addAcceptedPaymentMethodIfRecognized(method); + } // Checks whether the merchant supports autofill cards before show is called. mMerchantSupportsAutofillCards = BasicCardUtils.merchantSupportsBasicCard(params.getMethodData());
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetMediator.java index 9a8bae9..c0fcd1b3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetMediator.java
@@ -196,6 +196,8 @@ signIn(); } else if (viewState == ViewState.NO_ACCOUNTS) { addAccount(); + } else if (viewState == ViewState.SIGNIN_AUTH_ERROR) { + updateCredentials(); } } @@ -221,4 +223,13 @@ } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } + + private void updateCredentials() { + mAccountPickerDelegate.updateCredentials(mSelectedAccountName, (isSuccess) -> { + if (isSuccess) { + mModel.set(AccountPickerBottomSheetProperties.VIEW_STATE, + ViewState.COLLAPSED_ACCOUNT_LIST); + } + }); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetView.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetView.java index 4747deeb..df898d63 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetView.java
@@ -139,10 +139,15 @@ * Collapses the account list to the selected account. */ void collapseAccountList() { + mLogoImage.setImageResource(R.drawable.chrome_sync_logo); + mAccountPickerTitle.setText(R.string.signin_account_picker_dialog_title); + mAccountPickerSubtitle.setText(R.string.signin_account_picker_bottom_sheet_subtitle); + mHorizontalDivider.setVisibility(View.VISIBLE); mSelectedAccountView.setVisibility(View.VISIBLE); mContinueAsButton.setVisibility(View.VISIBLE); mAccountListView.setVisibility(View.GONE); + mSpinnerView.setVisibility(View.GONE); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetViewBinder.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetViewBinder.java index 1f60fc1..e5e93f4c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetViewBinder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerBottomSheetViewBinder.java
@@ -22,6 +22,12 @@ @ViewState int viewState = model.get(AccountPickerBottomSheetProperties.VIEW_STATE); switchToState(view, viewState); + if (viewState == ViewState.COLLAPSED_ACCOUNT_LIST) { + // This is needed when the view state changes from SIGNIN_AUTH_ERROR to + // COLLAPSED_ACCOUNT_LIST + view.updateSelectedAccount( + model.get(AccountPickerBottomSheetProperties.SELECTED_ACCOUNT_DATA)); + } } else if (propertyKey == AccountPickerBottomSheetProperties.SELECTED_ACCOUNT_DATA) { DisplayableProfileData profileData = model.get(AccountPickerBottomSheetProperties.SELECTED_ACCOUNT_DATA);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerDelegate.java index 9338c82..e09bbf6f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerDelegate.java
@@ -24,6 +24,7 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabCreator; import org.chromium.components.signin.AccountManagerFacadeProvider; +import org.chromium.components.signin.AccountUtils; import org.chromium.components.signin.base.CoreAccountInfo; import org.chromium.components.signin.base.GoogleServiceAuthError; import org.chromium.content_public.browser.LoadUrlParams; @@ -37,6 +38,7 @@ */ public class AccountPickerDelegate implements WebSigninBridge.Listener { private final WindowAndroid mWindowAndroid; + private final Activity mActivity; private final Tab mCurrentTab; private final TabCreator mIncognitoTabCreator; private final WebSigninBridge.Factory mWebSigninBridgeFactory; @@ -49,6 +51,8 @@ TabCreator incognitoTabCreator, WebSigninBridge.Factory webSigninBridgeFactory, String continueUrl) { mWindowAndroid = windowAndroid; + mActivity = mWindowAndroid.getActivity().get(); + assert mActivity != null : "Activity should not be null!"; mCurrentTab = currentTab; mIncognitoTabCreator = incognitoTabCreator; mWebSigninBridgeFactory = webSigninBridgeFactory; @@ -62,9 +66,8 @@ */ public IncognitoInterstitialDelegate getIncognitoInterstitialDelegate() { IncognitoInterstitialDelegate incognitoInterstitialDelegate = - new IncognitoInterstitialDelegate(mWindowAndroid.getActivity().get(), - mIncognitoTabCreator, HelpAndFeedback.getInstance(), - mCurrentTab.getUrlString()); + new IncognitoInterstitialDelegate(mActivity, mIncognitoTabCreator, + HelpAndFeedback.getInstance(), mCurrentTab.getUrlString()); return incognitoInterstitialDelegate; } @@ -123,12 +126,22 @@ } else { // AccountManagerFacade couldn't create intent, use SigninUtils to open // settings instead. - SigninUtils.openSettingsForAllAccounts(mWindowAndroid.getContext().get()); + SigninUtils.openSettingsForAllAccounts(mActivity); } }); } /** + * Updates credentials of the given account name. + */ + public void updateCredentials( + String accountName, Callback<Boolean> onUpdateCredentialsCallback) { + AccountManagerFacadeProvider.getInstance().updateCredentials( + AccountUtils.createAccountFromName(accountName), mActivity, + onUpdateCredentialsCallback); + } + + /** * Sign-in completed successfully and the primary account is available in the cookie jar. */ @MainThread
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 ad8386b1..394bdad6 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
@@ -43,7 +43,6 @@ import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.InfoBarUtil; import org.chromium.chrome.test.util.browser.Features; -import org.chromium.components.download.DownloadState; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.DOMUtils; @@ -55,9 +54,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; import java.util.List; -import java.util.Set; /** * Tests Chrome download feature by attempting to download some files. @@ -108,18 +105,6 @@ } } - static class TestDownloadInfoBarController extends DownloadInfoBarController { - public TestDownloadInfoBarController() { - super(false); - } - - @Override - protected void showInfoBar( - @DownloadInfoBarState int state, DownloadProgressInfoBarData info) { - // Do nothing, so we don't impact other info bars. - } - } - public DownloadTest(boolean useDownloadOfflineContentProvider) { mUseDownloadOfflineContentProvider = useDownloadOfflineContentProvider; } @@ -146,15 +131,6 @@ mDownloadTestRule.startMainActivityOnBlankPage(); } - void waitForLastDownloadToFinish() { - CriteriaHelper.pollUiThread(() -> { - List<DownloadItem> downloads = mDownloadTestRule.getAllDownloads(); - Criteria.checkThat(downloads.size(), Matchers.greaterThanOrEqualTo(1)); - Criteria.checkThat(downloads.get(downloads.size() - 1).getDownloadInfo().state(), - Matchers.is(DownloadState.COMPLETE)); - }); - } - @Test @MediumTest @Feature({"Downloads"}) @@ -259,39 +235,28 @@ @Test @MediumTest @Feature({"Downloads"}) + @DisabledTest(message = "crbug.com/597230") public void testDuplicateHttpPostDownload_Cancel() { - // Remove download progress info bar. - TestThreadUtils.runOnUiThreadBlocking( - () - -> DownloadManagerService.getDownloadManagerService() - .setInfoBarControllerForTesting( - new TestDownloadInfoBarController())); - // Download a file. mDownloadTestRule.loadUrl(mTestServer.getURL(TEST_DOWNLOAD_DIRECTORY + "post.html")); waitForFocus(); View currentView = mDownloadTestRule.getActivity().getActivityTab().getView(); + int callCount = mDownloadTestRule.getChromeDownloadCallCount(); TouchCommon.singleClickView(currentView); - waitForLastDownloadToFinish(); - int downloadCount = mDownloadTestRule.getAllDownloads().size(); + Assert.assertTrue("Failed to finish downloading file for the first time.", + mDownloadTestRule.waitForChromeDownloadToFinish(callCount)); // Download a file with the same name. mDownloadTestRule.loadUrl(mTestServer.getURL(TEST_DOWNLOAD_DIRECTORY + "post.html")); waitForFocus(); currentView = mDownloadTestRule.getActivity().getActivityTab().getView(); + callCount = mDownloadTestRule.getChromeDownloadCallCount(); TouchCommon.singleClickView(currentView); assertPollForInfoBarSize(1); - Assert.assertTrue("CANCEL button wasn't found", + Assert.assertTrue("CREATE NEW button wasn't found", InfoBarUtil.clickSecondaryButton(mDownloadTestRule.getInfoBars().get(0))); - InfoBarUtil.waitUntilNoInfoBarsExist(mDownloadTestRule.getInfoBars()); - // The download should be canceled. - List<DownloadItem> downloads = mDownloadTestRule.getAllDownloads(); - Assert.assertEquals(downloads.size(), downloadCount + 1); - Set<Integer> states = - new HashSet<>(Arrays.asList(downloads.get(downloadCount).getDownloadInfo().state(), - downloads.get(downloadCount - 1).getDownloadInfo().state())); - Assert.assertEquals(states, - new HashSet<>(Arrays.asList(DownloadState.COMPLETE, DownloadState.CANCELLED))); + Assert.assertFalse("Download should not happen when clicking cancel button", + mDownloadTestRule.waitForChromeDownloadToFinish(callCount)); } @Test @@ -326,6 +291,56 @@ mDownloadTestRule.hasDownload(FILENAME_TEXT_1, SUPERBO_CONTENTS)); } + @Test + @MediumTest + @Feature({"Downloads"}) + @DisabledTest(message = "crbug.com/597230") + public void testDuplicateHttpPostDownload_AllowMultipleInfoBars() throws Exception { + Assert.assertFalse(mDownloadTestRule.hasDownload(FILENAME_TEXT, SUPERBO_CONTENTS)); + // Download a file. + mDownloadTestRule.loadUrl(mTestServer.getURL(TEST_DOWNLOAD_DIRECTORY + "post.html")); + waitForFocus(); + View currentView = mDownloadTestRule.getActivity().getActivityTab().getView(); + int callCount = mDownloadTestRule.getChromeDownloadCallCount(); + TouchCommon.singleClickView(currentView); + Assert.assertTrue("Failed to finish downloading file for the first time.", + mDownloadTestRule.waitForChromeDownloadToFinish(callCount)); + + // Download the file for the second time. + mDownloadTestRule.loadUrl(mTestServer.getURL(TEST_DOWNLOAD_DIRECTORY + "post.html")); + waitForFocus(); + currentView = mDownloadTestRule.getActivity().getActivityTab().getView(); + TouchCommon.singleClickView(currentView); + assertPollForInfoBarSize(1); + + // Download the file for the third time. + mDownloadTestRule.loadUrl(mTestServer.getURL(TEST_DOWNLOAD_DIRECTORY + "post.html")); + waitForFocus(); + currentView = mDownloadTestRule.getActivity().getActivityTab().getView(); + TouchCommon.singleClickView(currentView); + assertPollForInfoBarSize(2); + + // Now create two new files by clicking on the infobars. + callCount = mDownloadTestRule.getChromeDownloadCallCount(); + Assert.assertTrue("CREATE NEW button wasn't found", + InfoBarUtil.clickSecondaryButton(mDownloadTestRule.getInfoBars().get(0))); + Assert.assertTrue("Failed to finish downloading the second file.", + mDownloadTestRule.waitForChromeDownloadToFinish(callCount)); + assertPollForInfoBarSize(1); + callCount = mDownloadTestRule.getChromeDownloadCallCount(); + Assert.assertTrue("CREATE NEW button wasn't found", + InfoBarUtil.clickSecondaryButton(mDownloadTestRule.getInfoBars().get(0))); + Assert.assertTrue("Failed to finish downloading the third file.", + mDownloadTestRule.waitForChromeDownloadToFinish(callCount)); + + Assert.assertTrue("Missing first download", + mDownloadTestRule.hasDownload(FILENAME_TEXT, SUPERBO_CONTENTS)); + Assert.assertTrue("Missing second download", + mDownloadTestRule.hasDownload(FILENAME_TEXT_1, SUPERBO_CONTENTS)); + Assert.assertTrue("Missing third download", + mDownloadTestRule.hasDownload(FILENAME_TEXT_2, SUPERBO_CONTENTS)); + } + 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 19dff4e..6c2e3c8 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
@@ -51,7 +51,6 @@ public static final long UPDATE_DELAY_MILLIS = 1000; private final CustomMainActivityStart mActivityStart; - private List<DownloadItem> mAllDownloads; public DownloadTestRule(CustomMainActivityStart action) { super(ChromeActivity.class); @@ -187,18 +186,10 @@ return eventReceived; } - public List<DownloadItem> getAllDownloads() { - TestThreadUtils.runOnUiThreadBlocking(() -> { - DownloadManagerService.getDownloadManagerService().getAllDownloads(false); - }); - return mAllDownloads; - } - private class TestDownloadManagerServiceObserver implements DownloadManagerService.DownloadObserver { @Override public void onAllDownloadsRetrieved(final List<DownloadItem> list, boolean isOffTheRecord) { - mAllDownloads = list; } @Override
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/SkipToGPayHelperTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/SkipToGPayHelperTest.java index 15f4687..cf840e5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/SkipToGPayHelperTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/SkipToGPayHelperTest.java
@@ -73,7 +73,7 @@ void assertCanActivateExperiment(boolean expected) { TestThreadUtils.runOnUiThreadBlocking(() -> { Assert.assertEquals(expected, - SkipToGPayHelper.canActivateExperiment( + SkipToGPayHelperUtil.canActivateExperiment( mRule.getWebContents(), mTestMethodData)); }); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetTest.java index 9d078c4..b092c41 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetTest.java
@@ -368,6 +368,34 @@ @Test @MediumTest + public void testSigninAgainButtonOnSigninAuthErrorSheet() { + CoreAccountInfo coreAccountInfo = + mAccountManagerTestRule.toCoreAccountInfo(PROFILE_DATA1.getAccountName()); + // Throws an auth error during the sign-in action + doAnswer(invocation -> { + Callback<GoogleServiceAuthError> onSignInErrorCallback = invocation.getArgument(1); + onSignInErrorCallback.onResult( + new GoogleServiceAuthError(State.INVALID_GAIA_CREDENTIALS)); + return null; + }) + .when(mAccountPickerDelegateMock) + .signIn(eq(coreAccountInfo), any()); + + buildAndShowCollapsedBottomSheet(); + clickContinueButtonAndWaitForErrorSheet(); + doAnswer(invocation -> { + Callback<Boolean> callback = invocation.getArgument(1); + callback.onResult(true); + return null; + }) + .when(mAccountPickerDelegateMock) + .updateCredentials(eq(PROFILE_DATA1.getAccountName()), any()); + onView(withText(R.string.auth_error_card_button)).perform(click()); + checkCollapsedAccountList(PROFILE_DATA1); + } + + @Test + @MediumTest public void testAddAccountOnExpandedSheet() { buildAndShowExpandedBottomSheet(); onView(withText(R.string.signin_add_account_to_device)).perform(click());
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 ce5239f..4595b54d 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
@@ -4,45 +4,33 @@ package org.chromium.chrome.browser.toolbar; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import android.content.Intent; import android.support.test.InstrumentationRegistry; import androidx.test.filters.MediumTest; +import androidx.test.filters.SmallTest; import org.junit.Assert; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.base.ContextUtils; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeTabbedActivity; -import org.chromium.chrome.browser.IntentHandler; -import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; -import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils; import org.chromium.chrome.browser.omnibox.UrlBarData; -import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.MockTab; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.toolbar.top.ToolbarLayout; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; -import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.content_public.browser.test.util.TestThreadUtils; -import java.util.concurrent.TimeoutException; - /** * Tests for LocationBarModel. */ @@ -52,8 +40,10 @@ @Rule public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); - @Rule - public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); + @Before + public void setUp() throws InterruptedException { + mActivityTestRule.startMainActivityOnBlankPage(); + } /** * After closing all {@link Tab}s, the {@link LocationBarModel} should know that it is not @@ -63,7 +53,6 @@ @Feature({"Android-Toolbar"}) @MediumTest public void testClosingLastTabReflectedInModel() { - mActivityTestRule.startMainActivityOnBlankPage(); Assert.assertNotSame("No current tab", Tab.INVALID_TAB_ID, getCurrentTabId(mActivityTestRule.getActivity())); ChromeTabUtils.closeCurrentTab( @@ -75,12 +64,10 @@ } @Test - @MediumTest + @SmallTest public void testDisplayAndEditText() { - mActivityTestRule.startMainActivityOnBlankPage(); TestThreadUtils.runOnUiThreadBlocking(() -> { - boolean incognito = false; - TestLocationBarModel model = new TestLocationBarModel(getMockTab(incognito), incognito); + TestLocationBarModel model = new TestLocationBarModel(); model.mUrl = UrlConstants.NTP_URL; assertDisplayAndEditText(model, "", null); @@ -101,75 +88,6 @@ }); } - @Test - @MediumTest - @DisabledTest(message = "crbug/1128073") - public void testGetProfileOnNullTabInIncognito() { - mActivityTestRule.startMainActivityOnBlankPage(); - TestThreadUtils.runOnUiThreadBlocking(() -> { - boolean incognito = true; - TestLocationBarModel model = new TestLocationBarModel(null, incognito); - Profile profile = model.getProfile(); - assertTrue(profile.isPrimaryOTRProfile()); - }); - } - - @Test - @MediumTest - @DisabledTest(message = "crbug/1128073") - public void testGetProfileOnMockTabInIncognito() { - mActivityTestRule.startMainActivityOnBlankPage(); - TestThreadUtils.runOnUiThreadBlocking(() -> { - boolean incognito = true; - TestLocationBarModel model = new TestLocationBarModel(getMockTab(incognito), incognito); - Profile profile = model.getProfile(); - assertTrue(profile.isPrimaryOTRProfile()); - }); - } - - @Test - @MediumTest - @Features.EnableFeatures({ChromeFeatureList.CCT_INCOGNITO}) - public void testGetProfileOnMockTabInIncognitoCCT() throws TimeoutException { - IncognitoDataTestUtils.fireAndWaitForCctWarmup(); - - // Create an launch an incognito CCT. - Intent intent = CustomTabsTestUtils.createMinimalCustomTabIntent( - InstrumentationRegistry.getContext(), "about:blank"); - intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, true); - mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent); - - TestThreadUtils.runOnUiThreadBlocking(() -> { - boolean incognito = true; - // Setup LocationBarModel - Tab tab = mCustomTabActivityTestRule.getActivity().getActivityTab(); - TestLocationBarModel model = new TestLocationBarModel(tab, incognito); - - Profile profile = model.getProfile(); - assertFalse(profile.isPrimaryOTRProfile()); - }); - } - - @Test - @MediumTest - @DisabledTest(message = "crbug/1128073") - public void testGetProfileOnMockTabInRegularCCT() { - // Create an launch a regular CCT. - Intent intent = CustomTabsTestUtils.createMinimalCustomTabIntent( - InstrumentationRegistry.getContext(), "about:blank"); - mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent); - - TestThreadUtils.runOnUiThreadBlocking(() -> { - boolean incognito = true; - // Setup LocationBarModel - Tab tab = mCustomTabActivityTestRule.getActivity().getActivityTab(); - TestLocationBarModel model = new TestLocationBarModel(tab, incognito); - - Profile profile = model.getProfile(); - assertTrue(profile.isPrimaryOTRProfile()); - }); - } - private void assertDisplayAndEditText( ToolbarDataProvider dataProvider, String displayText, String editText) { TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -194,30 +112,27 @@ return tab != null ? tab.getId() : Tab.INVALID_TAB_ID; } - public static Tab getMockTab(boolean incognito) { - Tab tab = new MockTab(0, incognito) { - @Override - public boolean isInitialized() { - return true; - } - - @Override - public boolean isFrozen() { - return false; - } - }; - return tab; - } - private class TestLocationBarModel extends LocationBarModel { private String mDisplayUrl; private String mFullUrl; private String mUrl; - public TestLocationBarModel(Tab tab, boolean incognito) { + public TestLocationBarModel() { super(ContextUtils.getApplicationContext()); initializeWithNative(); - setTab(tab, incognito); + + Tab tab = new MockTab(0, false) { + @Override + public boolean isInitialized() { + return true; + } + + @Override + public boolean isFrozen() { + return false; + } + }; + setTab(tab, false); } @Override
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 616bb6f..d8ca18af 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
@@ -81,6 +81,7 @@ private TestBottomSheetContent mNonPeekableContent; private TestBottomSheetContent mBackInterceptingContent; private ScrimCoordinator mScrimCoordinator; + private int mSuppressionToken; @Before public void setUp() throws Exception { @@ -577,6 +578,37 @@ BottomSheetController.SheetState.PEEK, mSheetController.getSheetState()); } + @Test + @MediumTest + public void testSheetPriorityDuringSuppression() throws TimeoutException { + requestContentInSheet(mLowPriorityContent, true); + + ThreadUtils.runOnUiThreadBlocking(() -> { + mSheetController.expandSheet(); + mTestSupport.endAllAnimations(); + }); + + assertTrue("The sheet should be open.", mSheetController.isSheetOpen()); + + ThreadUtils.runOnUiThreadBlocking(() -> { + mSuppressionToken = + mTestSupport.suppressSheet(BottomSheetController.StateChangeReason.NONE); + }); + + assertEquals("The sheet should be hidden.", BottomSheetController.SheetState.HIDDEN, + mSheetController.getSheetState()); + + requestContentInSheet(mHighPriorityContent, true); + + assertEquals("The sheet should still be hidden.", BottomSheetController.SheetState.HIDDEN, + mSheetController.getSheetState()); + + ThreadUtils.runOnUiThreadBlocking(() -> mTestSupport.unsuppressSheet(mSuppressionToken)); + + assertEquals("The high priority content should be shown.", mHighPriorityContent, + mSheetController.getCurrentSheetContent()); + } + /** * Request content be shown in the bottom sheet and end animations. * @param content The content to show.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetTest.java index 4ead0e6..2ce4a784 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetTest.java
@@ -260,8 +260,19 @@ /** @param content The content to show in the bottom sheet. */ private void showContent(BottomSheetContent content, @SheetState int targetState) { - runOnUiThreadBlocking(() -> { mSheetController.requestShowContent(content, false); }); - mTestSupport.setSheetState(targetState, false); - pollUiThread(() -> mSheetController.getSheetState() == targetState); + runOnUiThreadBlocking(() -> { + boolean shown = mSheetController.requestShowContent(content, false); + if (shown) { + mTestSupport.setSheetState(targetState, false); + } else { + assertEquals("The sheet should still be hidden.", SheetState.HIDDEN, + mSheetController.getSheetState()); + } + }); + + // If the content switched, wait for the desired state. + if (mSheetController.getCurrentSheetContent() == content) { + pollUiThread(() -> mSheetController.getSheetState() == targetState); + } } }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerDelegateTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerDelegateTest.java index 7bf936fc..62628c0 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerDelegateTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/signin/account_picker/AccountPickerDelegateTest.java
@@ -15,6 +15,8 @@ import android.accounts.Account; +import androidx.fragment.app.FragmentActivity; + import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -25,6 +27,7 @@ import org.mockito.Captor; import org.mockito.InOrder; import org.mockito.Mock; +import org.robolectric.Robolectric; import org.chromium.base.Callback; import org.chromium.base.test.BaseRobolectricTestRunner; @@ -42,6 +45,8 @@ import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.ui.base.WindowAndroid; +import java.lang.ref.WeakReference; + /** * This class tests the {@link AccountPickerDelegate}. */ @@ -76,6 +81,8 @@ @Captor private ArgumentCaptor<LoadUrlParams> mLoadUrlParamsCaptor; + private FragmentActivity mActivity; + private AccountPickerDelegate mDelegate; private final IdentityManager mIdentityManager = @@ -84,6 +91,9 @@ @Before public void setUp() { initMocks(this); + mActivity = Robolectric.setupActivity(FragmentActivity.class); + when(mWindowAndroidMock.getActivity()).thenReturn(new WeakReference<>(mActivity)); + Profile.setLastUsedProfileForTesting(mProfileMock); IdentityServicesProvider.setInstanceForTests(mock(IdentityServicesProvider.class)); when(IdentityServicesProvider.get().getIdentityManager(any())).thenReturn(mIdentityManager);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/toolbar/LocationBarModelTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/toolbar/LocationBarModelTest.java new file mode 100644 index 0000000..277cbe16 --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/toolbar/LocationBarModelTest.java
@@ -0,0 +1,128 @@ +// Copyright 2020 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.toolbar; + +import static org.mockito.Mockito.when; + +import androidx.test.filters.MediumTest; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import org.chromium.base.ContextUtils; +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.chrome.browser.customtabs.CustomTabIncognitoManager; +import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.ui.base.WindowAndroid; + +/** + * Unit tests for the LocationBarModel. + */ +@RunWith(BaseRobolectricTestRunner.class) +public class LocationBarModelTest { + @Mock + private Tab mIncognitoTabMock; + + @Mock + private Tab mRegularTabMock; + + @Mock + private WindowAndroid mWindowAndroidMock; + + @Mock + private CustomTabIncognitoManager mCustomTabIncognitoManagerMock; + + @Mock + private Profile mRegularProfileMock; + + @Mock + private Profile mPrimaryOTRProfileMock; + + @Mock + private Profile mNonPrimaryOTRProfileMock; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + Profile.setLastUsedProfileForTesting(mRegularProfileMock); + CustomTabIncognitoManager.setCustomTabIncognitoManagerUsedForTesting( + mCustomTabIncognitoManagerMock); + + when(mCustomTabIncognitoManagerMock.getProfile()).thenReturn(mNonPrimaryOTRProfileMock); + when(mRegularProfileMock.hasPrimaryOTRProfile()).thenReturn(true); + when(mRegularProfileMock.getPrimaryOTRProfile()).thenReturn(mPrimaryOTRProfileMock); + when(mIncognitoTabMock.getWindowAndroid()).thenReturn(mWindowAndroidMock); + when(mIncognitoTabMock.isIncognito()).thenReturn(true); + } + + @After + public void tearDown() { + Profile.setLastUsedProfileForTesting(null); + CustomTabIncognitoManager.setCustomTabIncognitoManagerUsedForTesting(null); + } + + private static class TestIncognitoLocationBarModel extends LocationBarModel { + public TestIncognitoLocationBarModel(Tab tab) { + super(ContextUtils.getApplicationContext()); + setTab(tab, /*incognito=*/true); + } + } + + private static class TestRegularLocationBarModel extends LocationBarModel { + public TestRegularLocationBarModel(Tab tab) { + super(ContextUtils.getApplicationContext()); + setTab(tab, /*incognito=*/false); + } + } + + @Test + @MediumTest + public void getProfile_IncognitoTab_ReturnsPrimaryOTRProfile() { + when(mCustomTabIncognitoManagerMock.getProfile()).thenReturn(null); + LocationBarModel incognitoLocationBarModel = + new TestIncognitoLocationBarModel(mIncognitoTabMock); + Profile otrProfile = incognitoLocationBarModel.getProfile(); + Assert.assertEquals(mPrimaryOTRProfileMock, otrProfile); + } + + @Test + @MediumTest + public void getProfile_IncognitoCCT_ReturnsNonPrimaryOTRProfile() { + LocationBarModel incognitoLocationBarModel = + new TestIncognitoLocationBarModel(mIncognitoTabMock); + Profile otrProfile = incognitoLocationBarModel.getProfile(); + Assert.assertEquals(mNonPrimaryOTRProfileMock, otrProfile); + } + + @Test + @MediumTest + public void getProfile_NullTab_ReturnsPrimaryOTRProfile() { + LocationBarModel incognitoLocationBarModel = new TestIncognitoLocationBarModel(null); + Profile otrProfile = incognitoLocationBarModel.getProfile(); + Assert.assertEquals(mPrimaryOTRProfileMock, otrProfile); + } + + @Test + @MediumTest + public void getProfile_RegularTab_ReturnsRegularProfile() { + LocationBarModel regularLocationBarModel = new TestRegularLocationBarModel(mRegularTabMock); + Profile profile = regularLocationBarModel.getProfile(); + Assert.assertEquals(mRegularProfileMock, profile); + } + + @Test + @MediumTest + public void getProfile_NullTab_ReturnsRegularProfile() { + LocationBarModel regularLocationBarModel = new TestRegularLocationBarModel(null); + Profile profile = regularLocationBarModel.getProfile(); + Assert.assertEquals(mRegularProfileMock, profile); + } +}
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index e897344..57c4860 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -9356,6 +9356,9 @@ </message> <!-- Live caption. --> + <message name="IDS_LIVE_CAPTION_BUBBLE_TITLE" desc="Title of the Live Caption bubble"> + Live Caption + </message> <message name="IDS_LIVE_CAPTION_BUBBLE_CLOSE" desc="Tooltip for the Live Caption close button"> Turn off Live Caption for now </message> @@ -9368,9 +9371,6 @@ <message name="IDS_LIVE_CAPTION_BUBBLE_ERROR" desc="Error message for the Live Caption bubble when Live Captions are unavailable."> Live Caption is not available right now </message> - <message name="IDS_LIVE_CAPTION_BUBBLE_ACCESSIBLE_NAME" desc="Label of the Live Caption bubble for accessibility."> - Live Caption - </message> <!-- Caret browsing. --> <if expr="not chromeos">
diff --git a/chrome/app/generated_resources_grd/IDS_LIVE_CAPTION_BUBBLE_ACCESSIBLE_NAME.png.sha1 b/chrome/app/generated_resources_grd/IDS_LIVE_CAPTION_BUBBLE_ACCESSIBLE_NAME.png.sha1 deleted file mode 100644 index beda8c7..0000000 --- a/chrome/app/generated_resources_grd/IDS_LIVE_CAPTION_BUBBLE_ACCESSIBLE_NAME.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -5230947232906708b0262c0f093cbe3e7617b65e \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_LIVE_CAPTION_BUBBLE_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_LIVE_CAPTION_BUBBLE_TITLE.png.sha1 index dd1b2633..cb4e21d 100644 --- a/chrome/app/generated_resources_grd/IDS_LIVE_CAPTION_BUBBLE_TITLE.png.sha1 +++ b/chrome/app/generated_resources_grd/IDS_LIVE_CAPTION_BUBBLE_TITLE.png.sha1
@@ -1 +1 @@ -23623f3947076791ead1af3b2c0435977a59e2a0 \ No newline at end of file +1feaf983c48f99f60c7b6b29339b553ecaf5f424 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 0d8dc11..9bec634 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -4188,6 +4188,8 @@ "metrics/perf/random_selector.h", "metrics/perf/windowed_incognito_observer.cc", "metrics/perf/windowed_incognito_observer.h", + "nearby_sharing/nearby_share_delegate_impl.cc", + "nearby_sharing/nearby_share_delegate_impl.h", "nearby_sharing/sharesheet/nearby_share_action.cc", "nearby_sharing/sharesheet/nearby_share_action.h", "notifications/arc_application_notifier_controller.cc",
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 189ac6ad..e2201ad7 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd
@@ -53,6 +53,7 @@ </structures> <includes> <if expr="is_win or is_macosx or desktop_linux or chromeos"> + <include name="IDR_COMMANDER_HTML" file="resources\commander\commander.html" type="BINDATA" /> <include name="IDR_DISCARDS_MOJO_API_JS" file="resources\discards\mojo_api.js" type="BINDATA" /> <include name="IDR_DISCARDS_DATABASE_TAB_JS" file="${root_gen_dir}\chrome\browser\resources\discards\database_tab.js" use_base_dir="false" type="BINDATA" /> <include name="IDR_DISCARDS_DISCARDS_MAIN_JS" file="${root_gen_dir}\chrome\browser\resources\discards\discards_main.js" use_base_dir="false" type="BINDATA" />
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 053b562e..0ab65ee0 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -180,6 +180,7 @@ "//chromeos/login/auth", "//chromeos/login/login_state", "//chromeos/login/session", + "//chromeos/memory", "//chromeos/network", "//chromeos/resources:diagnostics_app_resources_grit", "//chromeos/resources:media_app_resources_grit", @@ -1059,6 +1060,8 @@ "dbus/lock_to_single_user_service_provider.h", "dbus/machine_learning_decision_service_provider.cc", "dbus/machine_learning_decision_service_provider.h", + "dbus/memory_pressure_service_provider.cc", + "dbus/memory_pressure_service_provider.h", "dbus/metrics_event_service_provider.cc", "dbus/metrics_event_service_provider.h", "dbus/plugin_vm_service_provider.cc", @@ -2870,6 +2873,7 @@ "dbus/org.chromium.LibvdaService.conf", "dbus/org.chromium.LockToSingleUser.conf", "dbus/org.chromium.MachineLearningDecisionService.conf", + "dbus/org.chromium.MemoryPressure.conf", "dbus/org.chromium.MetricsEventService.conf", "dbus/org.chromium.NetworkProxyService.conf", "dbus/org.chromium.PluginVmService.conf",
diff --git a/chrome/browser/chromeos/arc/arc_optin_uma.cc b/chrome/browser/chromeos/arc/arc_optin_uma.cc index d79edca..eae03a7a 100644 --- a/chrome/browser/chromeos/arc/arc_optin_uma.cc +++ b/chrome/browser/chromeos/arc/arc_optin_uma.cc
@@ -153,21 +153,26 @@ } void UpdateAuthTiming(const char* histogram_name, - base::TimeDelta elapsed_time) { - base::UmaHistogramCustomTimes(histogram_name, elapsed_time, - base::TimeDelta::FromSeconds(1) /* minimum */, - base::TimeDelta::FromMinutes(3) /* maximum */, - 50 /* bucket_count */); + base::TimeDelta elapsed_time, + const Profile* profile) { + base::UmaHistogramCustomTimes( + GetHistogramNameByUserType(histogram_name, profile), elapsed_time, + base::TimeDelta::FromSeconds(1) /* minimum */, + base::TimeDelta::FromMinutes(3) /* maximum */, 50 /* bucket_count */); } -void UpdateAuthCheckinAttempts(int32_t num_attempts) { - base::UmaHistogramSparse("ArcAuth.CheckinAttempts", num_attempts); +void UpdateAuthCheckinAttempts(int32_t num_attempts, const Profile* profile) { + base::UmaHistogramSparse( + GetHistogramNameByUserType("ArcAuth.CheckinAttempts", profile), + num_attempts); } -void UpdateAuthAccountCheckStatus(mojom::AccountCheckStatus status) { +void UpdateAuthAccountCheckStatus(mojom::AccountCheckStatus status, + const Profile* profile) { DCHECK_LE(status, mojom::AccountCheckStatus::CHECK_FAILED); UMA_HISTOGRAM_ENUMERATION( - "ArcAuth.AccountCheckStatus", static_cast<int>(status), + GetHistogramNameByUserType("ArcAuth.AccountCheckStatus", profile), + static_cast<int>(status), static_cast<int>(mojom::AccountCheckStatus::CHECK_FAILED) + 1); }
diff --git a/chrome/browser/chromeos/arc/arc_optin_uma.h b/chrome/browser/chromeos/arc/arc_optin_uma.h index 1cab643..cc02cd5 100644 --- a/chrome/browser/chromeos/arc/arc_optin_uma.h +++ b/chrome/browser/chromeos/arc/arc_optin_uma.h
@@ -251,9 +251,12 @@ mojom::SupervisionChangeStatus result); void UpdateReauthorizationSilentAuthCodeUMA(OptInSilentAuthCode state); void UpdateSecondaryAccountSilentAuthCodeUMA(OptInSilentAuthCode state); -void UpdateAuthTiming(const char* histogram_name, base::TimeDelta elapsed_time); -void UpdateAuthCheckinAttempts(int32_t num_attempts); -void UpdateAuthAccountCheckStatus(mojom::AccountCheckStatus status); +void UpdateAuthTiming(const char* histogram_name, + base::TimeDelta elapsed_time, + const Profile* profile); +void UpdateAuthCheckinAttempts(int32_t num_attempts, const Profile* profile); +void UpdateAuthAccountCheckStatus(mojom::AccountCheckStatus status, + const Profile* profile); void UpdateMainAccountResolutionStatus( const Profile* profile, mojom::MainAccountResolutionStatus status);
diff --git a/chrome/browser/chromeos/arc/auth/arc_auth_service.cc b/chrome/browser/chromeos/arc/auth/arc_auth_service.cc index 1d7d0d4..090b96c0 100644 --- a/chrome/browser/chromeos/arc/auth/arc_auth_service.cc +++ b/chrome/browser/chromeos/arc/auth/arc_auth_service.cc
@@ -406,29 +406,29 @@ switch (metrics_type) { case mojom::MetricsType::NETWORK_WAITING_TIME_MILLISECONDS: UpdateAuthTiming("ArcAuth.NetworkWaitTime", - base::TimeDelta::FromMilliseconds(value)); + base::TimeDelta::FromMilliseconds(value), profile_); break; case mojom::MetricsType::CHECKIN_ATTEMPTS: - UpdateAuthCheckinAttempts(value); + UpdateAuthCheckinAttempts(value, profile_); break; case mojom::MetricsType::CHECKIN_TIME_MILLISECONDS: UpdateAuthTiming("ArcAuth.CheckinTime", - base::TimeDelta::FromMilliseconds(value)); + base::TimeDelta::FromMilliseconds(value), profile_); break; case mojom::MetricsType::SIGNIN_TIME_MILLISECONDS: UpdateAuthTiming("ArcAuth.SignInTime", - base::TimeDelta::FromMilliseconds(value)); + base::TimeDelta::FromMilliseconds(value), profile_); break; case mojom::MetricsType::ACCOUNT_CHECK_MILLISECONDS: UpdateAuthTiming("ArcAuth.AccountCheckTime", - base::TimeDelta::FromMilliseconds(value)); + base::TimeDelta::FromMilliseconds(value), profile_); break; } } void ArcAuthService::ReportAccountCheckStatus( mojom::AccountCheckStatus status) { - UpdateAuthAccountCheckStatus(status); + UpdateAuthAccountCheckStatus(status, profile_); } void ArcAuthService::ReportSupervisionChangeStatus(
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 3796d84..3ec72bd5 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -56,6 +56,7 @@ #include "chrome/browser/chromeos/dbus/libvda_service_provider.h" #include "chrome/browser/chromeos/dbus/lock_to_single_user_service_provider.h" #include "chrome/browser/chromeos/dbus/machine_learning_decision_service_provider.h" +#include "chrome/browser/chromeos/dbus/memory_pressure_service_provider.h" #include "chrome/browser/chromeos/dbus/metrics_event_service_provider.h" #include "chrome/browser/chromeos/dbus/plugin_vm_service_provider.h" #include "chrome/browser/chromeos/dbus/printers_service_provider.h" @@ -355,6 +356,12 @@ CrosDBusService::CreateServiceProviderList( std::make_unique<LockToSingleUserServiceProvider>())); + memory_pressure_service_ = CrosDBusService::Create( + system_bus, memory_pressure::kMemoryPressureServiceName, + dbus::ObjectPath(memory_pressure::kMemoryPressureServicePath), + CrosDBusService::CreateServiceProviderList( + std::make_unique<MemoryPressureServiceProvider>())); + if (arc::IsArcVmEnabled()) { libvda_service_ = CrosDBusService::Create( system_bus, libvda::kLibvdaServiceName, @@ -415,6 +422,7 @@ drive_file_stream_service_.reset(); cryptohome_key_delegate_service_.reset(); lock_to_single_user_service_.reset(); + memory_pressure_service_.reset(); ProcessDataCollector::Shutdown(); PowerDataCollector::Shutdown(); PowerPolicyController::Shutdown(); @@ -444,6 +452,7 @@ std::unique_ptr<CrosDBusService> machine_learning_decision_service_; std::unique_ptr<CrosDBusService> smb_fs_service_; std::unique_ptr<CrosDBusService> lock_to_single_user_service_; + std::unique_ptr<CrosDBusService> memory_pressure_service_; DISALLOW_COPY_AND_ASSIGN(DBusServices); };
diff --git a/chrome/browser/chromeos/crosapi/browser_manager.cc b/chrome/browser/chromeos/crosapi/browser_manager.cc index c21dc31..5d5094a 100644 --- a/chrome/browser/chromeos/crosapi/browser_manager.cc +++ b/chrome/browser/chromeos/crosapi/browser_manager.cc
@@ -33,6 +33,7 @@ #include "chrome/browser/chromeos/crosapi/test_mojo_connection_manager.h" #include "chrome/browser/component_updater/cros_component_manager.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_switches.h" #include "components/prefs/pref_service.h" @@ -212,6 +213,8 @@ void BrowserManager::Start() { DCHECK_EQ(state_, State::STOPPED); DCHECK(!lacros_path_.empty()); + // Ensure we're not trying to open a window before the shelf is initialized. + DCHECK(ChromeLauncherController::instance()); state_ = State::CREATING_LOG_FILE; @@ -351,10 +354,15 @@ SetLaunchOnLoginPref(false); } -void BrowserManager::OnUserSessionStarted(bool is_primary_user) { +void BrowserManager::OnSessionStateChanged() { DCHECK_EQ(state_, State::NOT_INITIALIZED); - // Ensure this isn't called multiple times. + // Wait for session to become active. + auto* session_manager = session_manager::SessionManager::Get(); + if (session_manager->session_state() != session_manager::SessionState::ACTIVE) + return; + + // Ensure this isn't run multiple times. session_manager::SessionManager::Get()->RemoveObserver(this); // Must be checked after user session start because it depends on user type.
diff --git a/chrome/browser/chromeos/crosapi/browser_manager.h b/chrome/browser/chromeos/crosapi/browser_manager.h index a5234ee..2751e744 100644 --- a/chrome/browser/chromeos/crosapi/browser_manager.h +++ b/chrome/browser/chromeos/crosapi/browser_manager.h
@@ -121,8 +121,7 @@ void OnLacrosChromeTerminated(); // session_manager::SessionManagerObserver: - // Starts to load the lacros-chrome executable. - void OnUserSessionStarted(bool is_primary_user) override; + void OnSessionStateChanged() override; // Called on load completion. void OnLoadComplete(const base::FilePath& path);
diff --git a/chrome/browser/chromeos/crosapi/browser_util.cc b/chrome/browser/chromeos/crosapi/browser_util.cc index 8a8c1d6..48a987a9 100644 --- a/chrome/browser/chromeos/crosapi/browser_util.cc +++ b/chrome/browser/chromeos/crosapi/browser_util.cc
@@ -14,6 +14,7 @@ #include "base/system/sys_info.h" #include "chrome/common/channel_info.h" #include "chrome/common/chrome_paths.h" +#include "components/exo/shell_surface_util.h" #include "components/prefs/pref_registry_simple.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" @@ -95,6 +96,16 @@ } } +bool IsLacrosWindow(const aura::Window* window) { + const std::string* app_id = exo::GetShellApplicationId(window); + if (!app_id) + return false; + // TODO(jamescook): Move this constant to //chromeos/crosapi/cpp and share it + // with //ui/ozone/wayland. + const char kLacrosAppIdPrefix[] = "org.chromium.lacros"; + return base::StartsWith(*app_id, kLacrosAppIdPrefix); +} + mojo::Remote<crosapi::mojom::LacrosChromeService> SendMojoInvitationToLacrosChrome( mojo::PlatformChannelEndpoint local_endpoint,
diff --git a/chrome/browser/chromeos/crosapi/browser_util.h b/chrome/browser/chromeos/crosapi/browser_util.h index abde75cd..d9be4bbde 100644 --- a/chrome/browser/chromeos/crosapi/browser_util.h +++ b/chrome/browser/chromeos/crosapi/browser_util.h
@@ -12,6 +12,10 @@ class PrefRegistrySimple; +namespace aura { +class Window; +} // namespace aura + namespace base { class FilePath; } // namespace base @@ -44,6 +48,10 @@ // As above, but takes a channel. Exposed for testing. bool IsLacrosAllowed(version_info::Channel channel); +// Returns true if |window| is an exo ShellSurface window representing a Lacros +// browser. +bool IsLacrosWindow(const aura::Window* window); + // Invite the lacros-chrome to the mojo universe. // Queue messages to establish the mojo connection, so that the passed IPC is // available already when lacros-chrome accepts the invitation.
diff --git a/chrome/browser/chromeos/dbus/memory_pressure_service_provider.cc b/chrome/browser/chromeos/dbus/memory_pressure_service_provider.cc new file mode 100644 index 0000000..16c997f --- /dev/null +++ b/chrome/browser/chromeos/dbus/memory_pressure_service_provider.cc
@@ -0,0 +1,69 @@ +// Copyright 2020 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 "chrome/browser/chromeos/dbus/memory_pressure_service_provider.h" + +#include "base/bind.h" +#include "base/logging.h" +#include "chromeos/memory/pressure/pressure.h" +#include "dbus/bus.h" +#include "dbus/message.h" +#include "third_party/cros_system_api/dbus/service_constants.h" + +namespace chromeos { + +MemoryPressureServiceProvider::MemoryPressureServiceProvider() = default; + +MemoryPressureServiceProvider::~MemoryPressureServiceProvider() = default; + +void MemoryPressureServiceProvider::Start( + scoped_refptr<dbus::ExportedObject> exported_object) { + exported_object->ExportMethod( + memory_pressure::kMemoryPressureInterface, + memory_pressure::kGetAvailableMemoryKBMethod, + base::BindRepeating(&MemoryPressureServiceProvider::GetAvailableMemoryKB, + weak_ptr_factory_.GetWeakPtr()), + base::BindRepeating(&MemoryPressureServiceProvider::OnExported, + weak_ptr_factory_.GetWeakPtr())); + exported_object->ExportMethod( + memory_pressure::kMemoryPressureInterface, + memory_pressure::kGetMemoryMarginKBMethod, + base::BindRepeating(&MemoryPressureServiceProvider::GetMemoryMarginsKB, + weak_ptr_factory_.GetWeakPtr()), + base::BindRepeating(&MemoryPressureServiceProvider::OnExported, + weak_ptr_factory_.GetWeakPtr())); +} + +void MemoryPressureServiceProvider::OnExported( + const std::string& interface_name, + const std::string& method_name, + bool success) { + LOG_IF(ERROR, !success) << "Failed to export " << interface_name << "." + << method_name; +} + +void MemoryPressureServiceProvider::GetAvailableMemoryKB( + dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender) { + std::unique_ptr<dbus::Response> response = + dbus::Response::FromMethodCall(method_call); + dbus::MessageWriter writer(response.get()); + writer.AppendUint64(chromeos::memory::pressure::GetAvailableMemoryKB()); + std::move(response_sender).Run(std::move(response)); +} + +void MemoryPressureServiceProvider::GetMemoryMarginsKB( + dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender) { + std::unique_ptr<dbus::Response> response = + dbus::Response::FromMethodCall(method_call); + dbus::MessageWriter writer(response.get()); + std::pair<uint64_t, uint64_t> margins = + chromeos::memory::pressure::GetMemoryMarginsKB(); + writer.AppendUint64(margins.first); + writer.AppendUint64(margins.second); + std::move(response_sender).Run(std::move(response)); +} + +} // namespace chromeos
diff --git a/chrome/browser/chromeos/dbus/memory_pressure_service_provider.h b/chrome/browser/chromeos/dbus/memory_pressure_service_provider.h new file mode 100644 index 0000000..359ac0c2 --- /dev/null +++ b/chrome/browser/chromeos/dbus/memory_pressure_service_provider.h
@@ -0,0 +1,60 @@ +// Copyright 2020 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 CHROME_BROWSER_CHROMEOS_DBUS_MEMORY_PRESSURE_SERVICE_PROVIDER_H_ +#define CHROME_BROWSER_CHROMEOS_DBUS_MEMORY_PRESSURE_SERVICE_PROVIDER_H_ + +#include <string> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/memory/weak_ptr.h" +#include "chromeos/dbus/services/cros_dbus_service.h" +#include "dbus/exported_object.h" + +namespace dbus { +class MethodCall; +} + +namespace chromeos { + +// This class exports D-Bus methods for handling memory pressure. +// +// This service can be manually tested using dbus-send: +// % dbus-send --system --type=method_call --print-reply +// --dest=org.chromium.MemoryPressure /org/chromium/MemoryPressure +// org.chromium.MemoryPressure.GetAvailableMemoryKB +class MemoryPressureServiceProvider + : public CrosDBusService::ServiceProviderInterface { + public: + MemoryPressureServiceProvider(); + MemoryPressureServiceProvider& operator=( + const MemoryPressureServiceProvider&) = delete; + MemoryPressureServiceProvider(const MemoryPressureServiceProvider&) = delete; + ~MemoryPressureServiceProvider() override; + + // CrosDBusService::ServiceProviderInterface overrides: + void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; + + private: + void OnExported(const std::string& interface_name, + const std::string& method_name, + bool success); + + void GetAvailableMemoryKB( + dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender); + + void GetMemoryMarginsKB(dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender); + + // TODO(b/149833548): Implement signals CriticalMemoryPressure and + // ModerateMemoryPressure. + + base::WeakPtrFactory<MemoryPressureServiceProvider> weak_ptr_factory_{this}; +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_DBUS_MEMORY_PRESSURE_SERVICE_PROVIDER_H_
diff --git a/chrome/browser/chromeos/dbus/org.chromium.MemoryPressure.conf b/chrome/browser/chromeos/dbus/org.chromium.MemoryPressure.conf new file mode 100644 index 0000000..61ae3cd --- /dev/null +++ b/chrome/browser/chromeos/dbus/org.chromium.MemoryPressure.conf
@@ -0,0 +1,26 @@ +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<!-- + Copyright 2020 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. +--> +<busconfig> + <policy user="chronos"> + <allow own="org.chromium.MemoryPressure"/> + <allow receive_sender="org.chromium.MemoryPressure" + receive_interface="org.chromium.MemoryPressure"/> + </policy> + + <!-- + Handling memory pressure. + --> + <policy user="chronos"> + <allow send_destination="org.chromium.MemoryPressure" + send_interface="org.chromium.MemoryPressure"/> + </policy> + <policy user="root"> + <allow send_destination="org.chromium.MemoryPressure" + send_interface="org.chromium.MemoryPressure"/> + </policy> +</busconfig>
diff --git a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.cc b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.cc index d0a8ff3..6f2ad19f 100644 --- a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.cc +++ b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.cc
@@ -283,8 +283,12 @@ resolved_address = net::AddressList::CopyWithPort(resolved_address, kHttpPort); + // TODO(crbug.com/1123197): Pass non-null NetworkQualityEstimator. + net::NetworkQualityEstimator* network_quality_estimator = nullptr; + sockets_.emplace_back(client_socket_factory_->CreateTransportClientSocket( - resolved_address, nullptr, net_log_.net_log(), net_log_.source())); + resolved_address, nullptr, network_quality_estimator, + net_log_.net_log(), net_log_.source())); } // Connect the sockets.
diff --git a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine_unittest.cc index 2006be2..6c71c9f 100644 --- a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine_unittest.cc +++ b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine_unittest.cc
@@ -144,6 +144,7 @@ std::unique_ptr<net::TransportClientSocket> CreateTransportClientSocket( const net::AddressList& addresses, std::unique_ptr<net::SocketPerformanceWatcher> socket_performance_watcher, + net::NetworkQualityEstimator* network_quality_estimator, net::NetLog* net_log, const net::NetLogSource& source) override { net::SocketDataProvider* socket_data_provider =
diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index 18594d6c..650e041f 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
@@ -63,8 +63,12 @@ "mac"; #elif defined(OS_WIN) "win"; -#else // OS_LINUX, etc. TODO(viettrungluu): Separate out Chrome OS and Android? +#elif defined(OS_CHROMEOS) + "cros"; +#elif defined(OS_LINUX) "linux"; +#else +#error This file should only be included for supported platforms. #endif // Name of the Widevine CDM architecture in the component manifest. @@ -73,8 +77,12 @@ "x86"; #elif defined(ARCH_CPU_X86_64) "x64"; -#else // TODO(viettrungluu): Support an ARM check? - "???"; +#elif defined(ARCH_CPU_ARMEL) + "arm"; +#elif defined(ARCH_CPU_ARM64) + "arm64"; +#else +#error This file should only be included for supported architecture. #endif // Widevine CDM is packaged as a multi-CRX. Widevine CDM binaries are located in
diff --git a/chrome/browser/devtools/device/adb/adb_client_socket.cc b/chrome/browser/devtools/device/adb/adb_client_socket.cc index 006fcb5..a41b6e1 100644 --- a/chrome/browser/devtools/device/adb/adb_client_socket.cc +++ b/chrome/browser/devtools/device/adb/adb_client_socket.cc
@@ -189,8 +189,8 @@ net::AddressList address_list = net::AddressList::CreateFromIPAddress(ip_address, port_); - socket_.reset( - new net::TCPClientSocket(address_list, NULL, NULL, net::NetLogSource())); + socket_.reset(new net::TCPClientSocket(address_list, nullptr, nullptr, + nullptr, net::NetLogSource())); connect_callback_ = std::move(callback); int result = socket_->Connect(base::BindOnce( &AdbClientSocket::RunConnectCallback, base::Unretained(this)));
diff --git a/chrome/browser/devtools/device/port_forwarding_controller.cc b/chrome/browser/devtools/device/port_forwarding_controller.cc index 3b54c9d..4ee5b2e 100644 --- a/chrome/browser/devtools/device/port_forwarding_controller.cc +++ b/chrome/browser/devtools/device/port_forwarding_controller.cc
@@ -256,8 +256,8 @@ void OnResolved(net::AddressList resolved_addresses) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - host_socket_.reset(new net::TCPClientSocket(resolved_addresses, nullptr, - nullptr, net::NetLogSource())); + host_socket_.reset(new net::TCPClientSocket( + resolved_addresses, nullptr, nullptr, nullptr, net::NetLogSource())); int result = host_socket_->Connect( base::BindOnce(&SocketTunnel::OnConnected, base::Unretained(this))); if (result != net::ERR_IO_PENDING)
diff --git a/chrome/browser/devtools/device/tcp_device_provider.cc b/chrome/browser/devtools/device/tcp_device_provider.cc index d163412..8bfbed26 100644 --- a/chrome/browser/devtools/device/tcp_device_provider.cc +++ b/chrome/browser/devtools/device/tcp_device_provider.cc
@@ -79,8 +79,9 @@ delete this; return; } - std::unique_ptr<net::StreamSocket> socket(new net::TCPClientSocket( - resolved_addresses.value(), nullptr, nullptr, net::NetLogSource())); + std::unique_ptr<net::StreamSocket> socket( + new net::TCPClientSocket(resolved_addresses.value(), nullptr, nullptr, + nullptr, net::NetLogSource())); net::StreamSocket* socket_ptr = socket.get(); net::CompletionRepeatingCallback on_connect = base::AdaptCallbackForRepeating(
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc index e94a49a..a31b77e 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.cc +++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -1283,7 +1283,7 @@ if (!(boundary_value >= 0 && boundary_value <= 100 && sample >= 0 && sample < boundary_value)) { // TODO(nick): Replace with chrome::bad_message::ReceivedBadMessage(). - frontend_host_->BadMessageRecieved(); + frontend_host_->BadMessageReceived(); return; } @@ -1308,7 +1308,7 @@ name == kDevToolsGridOverlayOpenedFromHistogram) base::UmaHistogramExactLinear(name, sample, boundary_value); else - frontend_host_->BadMessageRecieved(); + frontend_host_->BadMessageReceived(); } void DevToolsUIBindings::RecordPerformanceHistogram(const std::string& name,
diff --git a/chrome/browser/enterprise/connectors/common.cc b/chrome/browser/enterprise/connectors/common.cc index 58cc550..ad799634 100644 --- a/chrome/browser/enterprise/connectors/common.cc +++ b/chrome/browser/enterprise/connectors/common.cc
@@ -82,4 +82,9 @@ return TriggeredRule::ACTION_UNSPECIFIED; } +const char ScanResult::kKey[] = "enterprise_connectors.scan_result_key"; +ScanResult::ScanResult(const ContentAnalysisResponse& response) + : response(response) {} +ScanResult::~ScanResult() = default; + } // namespace enterprise_connectors
diff --git a/chrome/browser/enterprise/connectors/common.h b/chrome/browser/enterprise/connectors/common.h index d4211f0..de53775d 100644 --- a/chrome/browser/enterprise/connectors/common.h +++ b/chrome/browser/enterprise/connectors/common.h
@@ -8,6 +8,7 @@ #include <set> #include <string> +#include "base/supports_user_data.h" #include "components/enterprise/common/proto/connectors.pb.h" #include "url/gurl.h" @@ -80,6 +81,15 @@ const TriggeredRule::Action& action_1, const TriggeredRule::Action& action_2); +// User data class to persist ContentAnalysisResponses in base::SupportsUserData +// objects. +struct ScanResult : public base::SupportsUserData::Data { + explicit ScanResult(const ContentAnalysisResponse& response); + ~ScanResult() override; + static const char kKey[]; + ContentAnalysisResponse response; +}; + } // namespace enterprise_connectors #endif // CHROME_BROWSER_ENTERPRISE_CONNECTORS_COMMON_H_
diff --git a/chrome/browser/enterprise/connectors/connectors_manager_unittest.cc b/chrome/browser/enterprise/connectors/connectors_manager_unittest.cc index 5525ebc3..49733f61 100644 --- a/chrome/browser/enterprise/connectors/connectors_manager_unittest.cc +++ b/chrome/browser/enterprise/connectors/connectors_manager_unittest.cc
@@ -184,10 +184,7 @@ public testing::WithParamInterface<std::tuple<AnalysisConnector, T>> { public: ConnectorsManagerLegacyPoliciesTest<T>() { - scoped_feature_list_.InitWithFeatures( - {safe_browsing::kContentComplianceEnabled, - safe_browsing::kMalwareScanEnabled}, - {}); + scoped_feature_list_.InitWithFeatures({}, {}); } AnalysisConnector connector() const { return std::get<0>(this->GetParam()); }
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc index 81268ed3..df75b66bc 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
@@ -498,7 +498,8 @@ } } -IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, TabSpecificBrowserActionState) { +IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, + TabSpecificBrowserActionState) { ASSERT_TRUE(RunExtensionTest("browser_action/tab_specific_state")) << message_; const Extension* extension = GetSingleLoadedExtension(); @@ -530,7 +531,7 @@ // Test that calling chrome.browserAction.setPopup() can enable and change // a popup. -IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionAddPopup) { +IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, BrowserActionAddPopup) { ASSERT_TRUE(RunExtensionTest("browser_action/add_popup")) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; @@ -585,7 +586,7 @@ } // Test that calling chrome.browserAction.setPopup() can remove a popup. -IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionRemovePopup) { +IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, BrowserActionRemovePopup) { // Load the extension, which has a browser action with a default popup. ASSERT_TRUE(RunExtensionTest("browser_action/remove_popup")) << message_; const Extension* extension = GetSingleLoadedExtension(); @@ -737,7 +738,7 @@ // Tests that events are dispatched to the correct profile for split mode // extensions. -IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoSplit) { +IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, IncognitoSplit) { ResultCatcher catcher; const Extension* extension = LoadExtensionWithFlags( test_data_dir_.AppendASCII("browser_action/split_mode"), @@ -817,7 +818,7 @@ action->GetExplicitlySetBadgeText(ExtensionAction::kDefaultTabId)); } -IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BadgeBackgroundColor) { +IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, BadgeBackgroundColor) { ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(RunExtensionTest("browser_action/color")) << message_; const Extension* extension = GetSingleLoadedExtension(); @@ -866,7 +867,7 @@ action->GetBadgeBackgroundColor(ExtensionAction::kDefaultTabId)); } -IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, Getters) { +IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, Getters) { ASSERT_TRUE(RunExtensionTest("browser_action/getters")) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; @@ -887,7 +888,7 @@ } // Verify triggering browser action. -IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, TestTriggerBrowserAction) { +IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, TestTriggerBrowserAction) { ASSERT_TRUE(embedded_test_server()->Start()); ASSERT_TRUE(RunExtensionTest("trigger_actions/browser_action")) << message_; @@ -923,7 +924,8 @@ EXPECT_EQ(result, "red"); } -IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionWithRectangularIcon) { +IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, + BrowserActionWithRectangularIcon) { ExtensionTestMessageListener ready_listener("ready", true); const Extension* extension = LoadExtension(
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc index 62c8364..eaa3838 100644 --- a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc
@@ -535,8 +535,6 @@ if (!IsRealtimeReportingEnabled()) return; - DCHECK_EQ("dlp", result.tag); - ReportRealtimeEvent( kKeySensitiveDataEvent, base::BindOnce(
diff --git a/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc b/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc index c64bdc4..ff673e3 100644 --- a/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc +++ b/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
@@ -505,6 +505,7 @@ std::unique_ptr<net::TransportClientSocket> CreateTransportClientSocket( const net::AddressList&, std::unique_ptr<net::SocketPerformanceWatcher>, + net::NetworkQualityEstimator* network_quality_estimator, net::NetLog*, const net::NetLogSource&) override { providers_.push_back(std::make_unique<net::StaticSocketDataProvider>(
diff --git a/chrome/browser/extensions/extension_geolocation_apitest.cc b/chrome/browser/extensions/extension_geolocation_apitest.cc index d37d8b2..9ea0111 100644 --- a/chrome/browser/extensions/extension_geolocation_apitest.cc +++ b/chrome/browser/extensions/extension_geolocation_apitest.cc
@@ -13,6 +13,7 @@ // InProcessBrowserTest void SetUpOnMainThread() override { + ExtensionApiTest::SetUpOnMainThread(); geolocation_overrider_ = std::make_unique<device::ScopedGeolocationOverrider>(0, 0); } @@ -21,16 +22,12 @@ std::unique_ptr<device::ScopedGeolocationOverrider> geolocation_overrider_; }; -// http://crbug.com/68287 -IN_PROC_BROWSER_TEST_F(GeolocationApiTest, - DISABLED_ExtensionGeolocationAccessFail) { +IN_PROC_BROWSER_TEST_F(GeolocationApiTest, ExtensionGeolocationAccessFail) { // Test that geolocation cannot be accessed from extension without permission. ASSERT_TRUE(RunExtensionTest("geolocation/no_permission")) << message_; } -// Timing out. http://crbug.com/128412 -IN_PROC_BROWSER_TEST_F(GeolocationApiTest, - DISABLED_ExtensionGeolocationAccessPass) { +IN_PROC_BROWSER_TEST_F(GeolocationApiTest, ExtensionGeolocationAccessPass) { // Test that geolocation can be accessed from extension with permission. ASSERT_TRUE(RunExtensionTest("geolocation/has_permission")) << message_; }
diff --git a/chrome/browser/extensions/extension_icon_source_apitest.cc b/chrome/browser/extensions/extension_icon_source_apitest.cc index 706dc16..f5e113f 100644 --- a/chrome/browser/extensions/extension_icon_source_apitest.cc +++ b/chrome/browser/extensions/extension_icon_source_apitest.cc
@@ -18,14 +18,7 @@ using ExtensionIconSourceTest = extensions::ExtensionApiTest; -// Times out on Mac and Win. http://crbug.com/238705 -#if defined(OS_WIN) || defined(OS_MAC) -#define MAYBE_IconsLoaded DISABLED_IconsLoaded -#else -#define MAYBE_IconsLoaded IconsLoaded -#endif - -IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, MAYBE_IconsLoaded) { +IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoaded) { base::FilePath basedir = test_data_dir_.AppendASCII("icons"); ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_with_permission"))); ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_no_permission"))); @@ -69,14 +62,7 @@ EXPECT_EQ(result, "invalid (96\xC3\x97""96)"); } -// Times out on Mac and Win. http://crbug.com/238705 -#if defined(OS_WIN) || defined(OS_MAC) -#define MAYBE_IconsLoadedIncognito DISABLED_IconsLoadedIncognito -#else -#define MAYBE_IconsLoadedIncognito IconsLoadedIncognito -#endif - -IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, MAYBE_IconsLoadedIncognito) { +IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoadedIncognito) { base::FilePath basedir = test_data_dir_.AppendASCII("icons"); ASSERT_TRUE(LoadExtensionIncognito( basedir.AppendASCII("extension_with_permission")));
diff --git a/chrome/browser/extensions/extension_override_apitest.cc b/chrome/browser/extensions/extension_override_apitest.cc index 6c8068577..8d5a177 100644 --- a/chrome/browser/extensions/extension_override_apitest.cc +++ b/chrome/browser/extensions/extension_override_apitest.cc
@@ -240,13 +240,7 @@ EXPECT_FALSE(ExtensionControlsPage(active_tab, extension1_id)); } -#if defined(OS_MAC) -// Hangy: http://crbug.com/70511 -#define MAYBE_OverrideNewTabIncognito DISABLED_OverrideNewTabIncognito -#else -#define MAYBE_OverrideNewTabIncognito OverrideNewTabIncognito -#endif -IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, MAYBE_OverrideNewTabIncognito) { +IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, OverrideNewTabIncognito) { LoadExtension(data_dir().AppendASCII("newtab")); // Navigate an incognito tab to the new tab page. We should get the actual
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index f810a0b3..92680b1 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -3679,10 +3679,10 @@ const char kChromeOSDirectVideoDecoderDescription[] = "Enables the hardware-accelerated ChromeOS direct media::VideoDecoder " "implementation. Note that this might be entirely disallowed by the " - "--force-disable-new-accelerated-video-decoder command line switch which " - "is added for platforms where said direct VideoDecoder does not work or is " - "not well tested (see the disable_cros_video_decoder USE flag in Chrome " - "OS)"; + "--platform-disallows-chromeos-direct-video-decoder command line switch " + "which is added for platforms where said direct VideoDecoder does not work " + "or is not well tested (see the disable_cros_video_decoder USE flag in " + "Chrome OS)"; #endif // defined(OS_CHROMEOS) && BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) const char kCdmFactoryDaemonName[] = "CDM Factory Daemon";
diff --git a/chrome/browser/nearby_sharing/nearby_share_delegate_impl.cc b/chrome/browser/nearby_sharing/nearby_share_delegate_impl.cc new file mode 100644 index 0000000..83008f15 --- /dev/null +++ b/chrome/browser/nearby_sharing/nearby_share_delegate_impl.cc
@@ -0,0 +1,59 @@ +// Copyright 2020 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 "chrome/browser/nearby_sharing/nearby_share_delegate_impl.h" + +#include "base/time/time.h" +#include "chrome/browser/nearby_sharing/logging/logging.h" +#include "chrome/browser/nearby_sharing/nearby_sharing_service.h" +#include "chrome/browser/nearby_sharing/nearby_sharing_service_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/settings_window_manager_chromeos.h" +#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h" + +NearbyShareDelegateImpl::NearbyShareDelegateImpl() = default; + +NearbyShareDelegateImpl::~NearbyShareDelegateImpl() = default; + +bool NearbyShareDelegateImpl::IsPodButtonVisible() const { + return GetService() != nullptr; +} + +bool NearbyShareDelegateImpl::IsHighVisibilityOn() const { + NearbySharingService* service = GetService(); + return service && service->IsInHighVisibility(); +} + +base::Optional<base::TimeDelta> +NearbyShareDelegateImpl::RemainingHighVisibilityTime() const { + if (!IsHighVisibilityOn()) + return base::nullopt; + + return shutoff_time_ - base::TimeTicks::Now(); +} + +void NearbyShareDelegateImpl::EnableHighVisibility() { + NOTIMPLEMENTED(); +} + +void NearbyShareDelegateImpl::DisableHighVisibility() { + NOTIMPLEMENTED(); +} + +NearbySharingService* NearbyShareDelegateImpl::GetService() const { + return NearbySharingServiceFactory::GetForBrowserContext( + ProfileManager::GetPrimaryUserProfile()); +} + +void NearbyShareDelegateImpl::ShowNearbyShareSettings() const { + settings_opener_->ShowSettingsPage( + chromeos::settings::mojom::kNearbyShareSubpagePath); +} + +void NearbyShareDelegateImpl::SettingsOpener::ShowSettingsPage( + const std::string& sub_page) { + chrome::SettingsWindowManager::GetInstance()->ShowOSSettings( + ProfileManager::GetActiveUserProfile(), sub_page); +}
diff --git a/chrome/browser/nearby_sharing/nearby_share_delegate_impl.h b/chrome/browser/nearby_sharing/nearby_share_delegate_impl.h new file mode 100644 index 0000000..6524e55d --- /dev/null +++ b/chrome/browser/nearby_sharing/nearby_share_delegate_impl.h
@@ -0,0 +1,60 @@ +// Copyright 2020 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 CHROME_BROWSER_NEARBY_SHARING_NEARBY_SHARE_DELEGATE_IMPL_H_ +#define CHROME_BROWSER_NEARBY_SHARING_NEARBY_SHARE_DELEGATE_IMPL_H_ + +#include <memory> +#include <string> + +#include "ash/public/cpp/nearby_share_delegate.h" + +class NearbySharingService; + +namespace base { +class TimeDelta; +class TimeTicks; +} // namespace base + +// Delegate injected into |ash::Shell| to provide a communication channel +// between the system tray and the |NearbyShareService|. Singleton owned by the +// Shell, lives on the UI thread. +class NearbyShareDelegateImpl : public ash::NearbyShareDelegate { + public: + // For testing. Allows overriding |ShowSettingsPage|. + class SettingsOpener { + public: + SettingsOpener() = default; + SettingsOpener(SettingsOpener&) = delete; + SettingsOpener& operator=(SettingsOpener&) = delete; + virtual ~SettingsOpener() = default; + + // Open the chromeos settings page at the given uri, using + // |chrome::SettingsWindowManager| by default. + virtual void ShowSettingsPage(const std::string& sub_page); + }; + + NearbyShareDelegateImpl(); + NearbyShareDelegateImpl(NearbyShareDelegateImpl&) = delete; + NearbyShareDelegateImpl& operator=(NearbyShareDelegateImpl&) = delete; + ~NearbyShareDelegateImpl() override; + + // ash::NearbyShareDelegate + bool IsPodButtonVisible() const override; + bool IsHighVisibilityOn() const override; + base::Optional<base::TimeDelta> RemainingHighVisibilityTime() const override; + void EnableHighVisibility() override; + void DisableHighVisibility() override; + void ShowNearbyShareSettings() const override; + + private: + NearbySharingService* GetService() const; + + std::unique_ptr<SettingsOpener> settings_opener_; + + // The time when high visibility is scheduled to be shut off. + base::TimeTicks shutoff_time_; +}; + +#endif // CHROME_BROWSER_NEARBY_SHARING_NEARBY_SHARE_DELEGATE_IMPL_H_
diff --git a/chrome/browser/nearby_sharing/nearby_share_delegate_impl_unittest.cc b/chrome/browser/nearby_sharing/nearby_share_delegate_impl_unittest.cc new file mode 100644 index 0000000..c9f3e4d3 --- /dev/null +++ b/chrome/browser/nearby_sharing/nearby_share_delegate_impl_unittest.cc
@@ -0,0 +1,77 @@ +// Copyright 2020 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 "chrome/browser/nearby_sharing/nearby_share_delegate_impl.h" + +#include "ash/public/cpp/nearby_share_controller.h" +#include "ash/public/cpp/session/session_controller.h" +#include "base/time/clock.h" +#include "chrome/browser/nearby_sharing/common/nearby_share_prefs.h" +#include "chrome/browser/nearby_sharing/mock_nearby_sharing_service.h" +#include "chrome/browser/nearby_sharing/nearby_share_settings.h" +#include "chrome/browser/ui/ash/test_session_controller.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" +#include "content/public/test/browser_task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +class MockSettingsOpener : public NearbyShareDelegateImpl::SettingsOpener { + public: + MOCK_METHOD(void, ShowSettingsPage, (const std::string&), (override)); +}; + +class MockNearbyShareController : public ash::NearbyShareController { + public: + MOCK_METHOD(void, + HighVisibilityCountdownUpdate, + (base::TimeDelta), + (override)); + MOCK_METHOD(void, HighVisibilityEnabledChanged, (bool), (override)); +}; + +// TODO(crbug.com/1127940): Refactor these tests to avoid use of GMock. +class NearbyShareDelegateImplTest : public ::testing::Test { + public: + NearbyShareDelegateImplTest() + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} + + ~NearbyShareDelegateImplTest() override = default; + + base::Time Now() const { return task_environment_.GetMockClock()->Now(); } + + // Fast-forwards mock time by |delta| and fires relevant timers. + void FastForward(base::TimeDelta delta) { + task_environment_.FastForwardBy(delta); + } + + protected: + content::BrowserTaskEnvironment task_environment_; + MockNearbySharingService nearby_share_service_; + MockSettingsOpener* settings_opener_; + MockNearbyShareController controller_; + NearbyShareDelegateImpl delegate_; +}; + +TEST_F(NearbyShareDelegateImplTest, StartHighVisibilityAndTimeout) { + // TODO(cclem) +} + +TEST_F(NearbyShareDelegateImplTest, StartStopHighVisibility) { + // TODO(cclem) +} + +TEST_F(NearbyShareDelegateImplTest, ShowOnboardingAndTurnOnHighVisibility) { + // TODO(cclem) +} + +TEST_F(NearbyShareDelegateImplTest, ShowOnboardingAndTimeout) { + // TODO(cclem) +} + +TEST_F(NearbyShareDelegateImplTest, StopHighVisibilityOnScreenLock) { + // TODO(cclem) +} + +TEST_F(NearbyShareDelegateImplTest, ShowNearbyShareSettings) { + // TODO(cclem) +}
diff --git a/chrome/browser/payments/ssl_validity_checker.cc b/chrome/browser/payments/ssl_validity_checker.cc index a8e21d7..ad1fce25 100644 --- a/chrome/browser/payments/ssl_validity_checker.cc +++ b/chrome/browser/payments/ssl_validity_checker.cc
@@ -15,21 +15,6 @@ #include "url/gurl.h" namespace payments { -namespace { - -// Returns the security level of |web_contents|. The |web_contents| parameter -// should not be null. -security_state::SecurityLevel GetSecurityLevel( - content::WebContents* web_contents) { - DCHECK(web_contents); - SecurityStateTabHelper::CreateForWebContents(web_contents); - SecurityStateTabHelper* helper = - SecurityStateTabHelper::FromWebContents(web_contents); - DCHECK(helper); - return helper->GetSecurityLevel(); -} - -} // namespace // static std::string std::string SslValidityChecker::GetInvalidSslCertificateErrorMessage( @@ -97,4 +82,15 @@ return true; } +// static +security_state::SecurityLevel SslValidityChecker::GetSecurityLevel( + content::WebContents* web_contents) { + DCHECK(web_contents); + SecurityStateTabHelper::CreateForWebContents(web_contents); + SecurityStateTabHelper* helper = + SecurityStateTabHelper::FromWebContents(web_contents); + DCHECK(helper); + return helper->GetSecurityLevel(); +} + } // namespace payments
diff --git a/chrome/browser/payments/ssl_validity_checker.h b/chrome/browser/payments/ssl_validity_checker.h index 7cd70d5a..f73a49a 100644 --- a/chrome/browser/payments/ssl_validity_checker.h +++ b/chrome/browser/payments/ssl_validity_checker.h
@@ -8,6 +8,7 @@ #include <string> #include "base/macros.h" +#include "components/security_state/core/security_state.h" namespace content { class WebContents; @@ -33,6 +34,11 @@ static bool IsValidPageInPaymentHandlerWindow( content::WebContents* web_contents); + // Returns the security level of `web_contents`. The `web_contents` parameter + // should not be null. + static security_state::SecurityLevel GetSecurityLevel( + content::WebContents* web_contents); + private: DISALLOW_IMPLICIT_CONSTRUCTORS(SslValidityChecker); };
diff --git a/chrome/browser/prerender/isolated/isolated_prerender_test_utils.cc b/chrome/browser/prerender/isolated/isolated_prerender_test_utils.cc index 3292ed7..b4ed372 100644 --- a/chrome/browser/prerender/isolated/isolated_prerender_test_utils.cc +++ b/chrome/browser/prerender/isolated/isolated_prerender_test_utils.cc
@@ -112,7 +112,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); client_socket_ = std::make_unique<net::TCPClientSocket>( net::AddressList(net::IPEndPoint(net::IPAddress::IPv4Localhost(), port)), - nullptr, nullptr, net::NetLogSource()); + nullptr, nullptr, nullptr, net::NetLogSource()); int result = client_socket_->Connect(base::BindOnce( &TestProxyTunnelConnection::HandleConnectResult, base::Unretained(this)));
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/options/options_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/options/options_test.js index fd77bb7..4f882247 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/options/options_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/options/options_test.js
@@ -73,52 +73,63 @@ }); }); -TEST_F('ChromeVoxOptionsTest', 'punctuationEchoSelect', function() { - this.runOnOptionsPage((mockFeedback, evt) => { - const PUNCTUATION_ECHO_NONE = '0'; - const PUNCTUATION_ECHO_SOME = '1'; - const PUNCTUATION_ECHO_ALL = '2'; - const punctuationEchoSelect = evt.target.find({ - role: chrome.automation.RoleType.POP_UP_BUTTON, - attributes: {name: 'Punctuation echo:'} +// TODO(crbug.com/1128926): Test times out flakily in MSAN builds. +TEST_F_WITH_PREAMBLE( + ` +#if defined(MEMORY_SANITIZER) +#define MAYBE_PunctuationEchoSelect DISABLED_PunctuationEchoSelect +#else +#define MAYBE_PunctuationEchoSelect PunctuationEchoSelect +#endif +`, + 'ChromeVoxOptionsTest', 'MAYBE_PunctuationEchoSelect', function() { + this.runOnOptionsPage((mockFeedback, evt) => { + const PUNCTUATION_ECHO_NONE = '0'; + const PUNCTUATION_ECHO_SOME = '1'; + const PUNCTUATION_ECHO_ALL = '2'; + const punctuationEchoSelect = evt.target.find({ + role: chrome.automation.RoleType.POP_UP_BUTTON, + attributes: {name: 'Punctuation echo:'} + }); + assertNotNullNorUndefined(punctuationEchoSelect); + mockFeedback + .call(punctuationEchoSelect.focus.bind(punctuationEchoSelect)) + .expectSpeech('Punctuation echo:', 'None', 'Collapsed') + .call(punctuationEchoSelect.doDefault.bind(punctuationEchoSelect)) + .expectSpeech('Expanded') + + // Before selecting the menu option. + .call(() => { + assertEquals( + PUNCTUATION_ECHO_NONE, + localStorage[AbstractTts.PUNCTUATION_ECHO]); + }) + + .call(press(KeyCode.DOWN)) + .expectSpeech('Some', 'List item', ' 2 of 3 ') + .call(press(KeyCode.RETURN)) + + // TODO(josiahk): The underlying select behavior here is unexpected + // because we never get a new focus event for the select (moving us + // away from the menu item). We simply repeat the menu item. + .expectSpeech('Some', ' 2 of 3 ') + .call(() => { + assertEquals( + PUNCTUATION_ECHO_SOME, + localStorage[AbstractTts.PUNCTUATION_ECHO]); + }) + + .call(press(KeyCode.DOWN)) + .expectSpeech('All', ' 3 of 3 ') + .call(() => { + assertEquals( + PUNCTUATION_ECHO_ALL, + localStorage[AbstractTts.PUNCTUATION_ECHO]); + }) + + .replay(); + }); }); - assertNotNullNorUndefined(punctuationEchoSelect); - mockFeedback.call(punctuationEchoSelect.focus.bind(punctuationEchoSelect)) - .expectSpeech('Punctuation echo:', 'None', 'Collapsed') - .call(punctuationEchoSelect.doDefault.bind(punctuationEchoSelect)) - .expectSpeech('Expanded') - - // Before selecting the menu option. - .call(() => { - assertEquals( - PUNCTUATION_ECHO_NONE, - localStorage[AbstractTts.PUNCTUATION_ECHO]); - }) - - .call(press(KeyCode.DOWN)) - .expectSpeech('Some', 'List item', ' 2 of 3 ') - .call(press(KeyCode.RETURN)) - - // TODO(josiahk): The underlying select behavior here is unexpected - // because we never get a new focus event for the select (moving us - // away from the menu item). We simply repeat the menu item. - .expectSpeech('Some', ' 2 of 3 ') - .call(() => { - assertEquals( - PUNCTUATION_ECHO_SOME, - localStorage[AbstractTts.PUNCTUATION_ECHO]); - }) - - .call(press(KeyCode.DOWN)) - .expectSpeech('All', ' 3 of 3 ') - .call(() => { - assertEquals( - PUNCTUATION_ECHO_ALL, localStorage[AbstractTts.PUNCTUATION_ECHO]); - }) - - .replay(); - }); -}); TEST_F('ChromeVoxOptionsTest', 'SmartStickyMode', function() { this.runOnOptionsPage((mockFeedback, evt) => {
diff --git a/chrome/browser/resources/commander/OWNERS b/chrome/browser/resources/commander/OWNERS new file mode 100644 index 0000000..475a305c --- /dev/null +++ b/chrome/browser/resources/commander/OWNERS
@@ -0,0 +1,4 @@ +lgrey@chromium.org +ellyjones@chromium.org + +# COMPONENT: UI>Browser
diff --git a/chrome/browser/resources/commander/commander.html b/chrome/browser/resources/commander/commander.html new file mode 100644 index 0000000..3c35635 --- /dev/null +++ b/chrome/browser/resources/commander/commander.html
@@ -0,0 +1,9 @@ +<!doctype html> +<html dir="$i18n{textdirection}"> +<head> + <meta charset="utf-8"> +</head> +<body> +Hello, commander! +</body> +</html>
diff --git a/chrome/browser/resources/extensions/BUILD.gn b/chrome/browser/resources/extensions/BUILD.gn index b68df10..c7563df 100644 --- a/chrome/browser/resources/extensions/BUILD.gn +++ b/chrome/browser/resources/extensions/BUILD.gn
@@ -4,51 +4,85 @@ import("//chrome/common/features.gni") import("//third_party/closure_compiler/compile_js.gni") -import("//tools/grit/grit_rule.gni") +import("//tools/grit/preprocess_grit.gni") import("//tools/polymer/html_to_js.gni") import("../optimize_webui.gni") if (optimize_webui) { - extensions_pak_file = "extensions_resources.pak" - unpak_folder = "extensions_resources.unpak" + preprocess_folder = "preprocessed" optimize_webui("build") { host = "extensions" - input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir) + input = rebase_path("$target_gen_dir/$preprocess_folder", root_build_dir) js_out_files = [ "extensions.rollup.js" ] js_module_in_files = [ "extensions.js" ] deps = [ - ":unpak", + ":preprocess", + ":preprocess_generated", "../../../../ui/webui/resources:preprocess", ] excludes = [ "chrome://resources/js/cr.m.js" ] } - unpak("unpak") { - pak_file = extensions_pak_file - out_folder = unpak_folder + preprocess_grit("preprocess") { + in_folder = "./" + out_folder = "$target_gen_dir/$preprocess_folder" + in_files = [ + "drag_and_drop_handler.js", + "extensions.js", + "item_behavior.js", + "item_util.js", + "keyboard_shortcut_delegate.js", + "navigation_helper.js", + "service.js", + "shortcut_util.js", + ] - deps = [ ":flattened_resources" ] + if (is_chromeos) { + in_files += [ "kiosk_browser_proxy.js" ] + } } - grit("flattened_resources") { - source = "extensions_resources.grd" - - grit_flags = [ - "-E", - "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), - ] - + preprocess_grit("preprocess_generated") { deps = [ ":web_components" ] - defines = chrome_grit_defines - outputs = [ - "grit/extensions_resources.h", - "grit/extensions_resources_map.cc", - "grit/extensions_resources_map.h", - extensions_pak_file, + in_folder = target_gen_dir + out_folder = "$target_gen_dir/$preprocess_folder" + in_files = [ + "checkup.js", + "code_section.js", + "activity_log/activity_log_history_item.js", + "activity_log/activity_log_history.js", + "activity_log/activity_log.js", + "activity_log/activity_log_stream_item.js", + "activity_log/activity_log_stream.js", + "detail_view.js", + "drop_overlay.js", + "error_page.js", + "host_permissions_toggle_list.js", + "icons.js", + "install_warnings_dialog.js", + "item.js", + "item_list.js", + "keyboard_shortcuts.js", + "load_error.js", + "manager.js", + "options_dialog.js", + "pack_dialog_alert.js", + "pack_dialog.js", + "runtime_host_permissions.js", + "runtime_hosts_dialog.js", + "shared_style.js", + "shared_vars.js", + "shortcut_input.js", + "sidebar.js", + "toggle_row.js", + "toolbar.js", ] - output_dir = "$root_gen_dir/chrome/browser/resources/extensions" + + if (is_chromeos) { + in_files += [ "kiosk_dialog.js" ] + } } }
diff --git a/chrome/browser/resources/extensions/extensions_resources.grd b/chrome/browser/resources/extensions/extensions_resources.grd index f149dd7f..b77dcf0 100644 --- a/chrome/browser/resources/extensions/extensions_resources.grd +++ b/chrome/browser/resources/extensions/extensions_resources.grd
@@ -14,144 +14,134 @@ <includes> <include name="IDR_EXTENSIONS_CODE_SECTION_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/code_section.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/activity_log/activity_log.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/activity_log/activity_log_history.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_HISTORY_ITEM_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/activity_log/activity_log_history_item.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/activity_log/activity_log_stream.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_STREAM_ITEM_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/activity_log/activity_log_stream_item.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_CHECKUP_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/checkup.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_DETAIL_VIEW_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/detail_view.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_DROP_OVERLAY_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/drop_overlay.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_ERROR_PAGE_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/error_page.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_KEYBOARD_SHORTCUTS_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/keyboard_shortcuts.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <if expr="chromeos"> <include name="IDR_EXTENSIONS_KIOSK_DIALOG_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/kiosk_dialog.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> </if> <include name="IDR_EXTENSIONS_MANAGER_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/manager.js" - preprocess="true" use_base_dir="false" compress="false" type="BINDATA" /> + preprocess="true" use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_ICONS_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/icons.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_INSTALL_WARNINGS_DIALOG_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/install_warnings_dialog.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_ITEM_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/item.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_ITEM_LIST_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/item_list.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_LOAD_ERROR_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/load_error.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_HOST_PERMISSIONS_TOGGLE_LIST_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/host_permissions_toggle_list.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_OPTIONS_DIALOG_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/options_dialog.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_PACK_DIALOG_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/pack_dialog.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_PACK_DIALOG_ALERT_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/pack_dialog_alert.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_RUNTIME_HOST_PERMISSIONS_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/runtime_host_permissions.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_RUNTIME_HOSTS_DIALOG_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/runtime_hosts_dialog.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_SHARED_STYLE_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/shared_style.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_SHARED_VARS_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/shared_vars.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_SHORTCUT_INPUT_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/shortcut_input.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_SIDEBAR_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/sidebar.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_TOGGLE_ROW_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/toggle_row.js" - use_base_dir="false" compress="false" type="BINDATA" /> + use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_TOOLBAR_JS" file="${root_gen_dir}/chrome/browser/resources/extensions/toolbar.js" - preprocess="true" use_base_dir="false" compress="false" type="BINDATA" /> + preprocess="true" use_base_dir="false" type="BINDATA" /> <include name="IDR_EXTENSIONS_CHECKUP_IMAGE" - file="checkup_image.svg" compress="false" type="BINDATA" /> + file="checkup_image.svg" type="BINDATA" /> <include name="IDR_EXTENSIONS_CHECKUP_IMAGE_DARK" - file="checkup_image_dark.svg" compress="false" type="BINDATA" /> + file="checkup_image_dark.svg" type="BINDATA" /> </includes> <structures> <structure name="IDR_EXTENSIONS_ITEM_BEHAVIOR_JS" file="item_behavior.js" - compress="false" type="chrome_html" /> <structure name="IDR_EXTENSIONS_EXTENSIONS_HTML" file="extensions.html" - compress="false" type="chrome_html" /> <structure name="IDR_EXTENSIONS_DRAG_AND_DROP_HANDLER_JS" file="drag_and_drop_handler.js" - compress="false" type="chrome_html" /> <structure name="IDR_EXTENSIONS_EXTENSIONS_JS" file="extensions.js" preprocess="true" - compress="false" type="chrome_html" /> <structure name="IDR_EXTENSIONS_KEYBOARD_SHORTCUT_DELEGATE_JS" file="keyboard_shortcut_delegate.js" - compress="false" type="chrome_html" /> <if expr="chromeos"> <structure name="IDR_EXTENSIONS_KIOSK_BROWSER_PROXY_JS" file="kiosk_browser_proxy.js" - compress="false" type="chrome_html" /> </if> <structure name="IDR_EXTENSIONS_ITEM_UTIL_JS" file="item_util.js" - compress="false" type="chrome_html" /> <structure name="IDR_EXTENSIONS_NAVIGATION_HELPER_JS" file="navigation_helper.js" - compress="false" type="chrome_html" /> <structure name="IDR_EXTENSIONS_SERVICE_JS" file="service.js" - compress="false" type="chrome_html" /> <structure name="IDR_EXTENSIONS_SHORTCUT_UTIL_JS" file="shortcut_util.js" - compress="false" type="chrome_html" /> </structures> </release>
diff --git a/chrome/browser/resources/inline_login/BUILD.gn b/chrome/browser/resources/inline_login/BUILD.gn index cf86b87..3028b89 100644 --- a/chrome/browser/resources/inline_login/BUILD.gn +++ b/chrome/browser/resources/inline_login/BUILD.gn
@@ -22,6 +22,7 @@ deps = [ ":inline_login_browser_proxy", "//chrome/browser/resources/gaia_auth_host:authenticator.m", + "//third_party/polymer/v3_0/components-chromium/paper-spinner:paper-spinner-lite", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:web_ui_listener_behavior.m",
diff --git a/chrome/browser/resources/inline_login/inline_login_app.js b/chrome/browser/resources/inline_login/inline_login_app.js index 7b9d167..29dae27 100644 --- a/chrome/browser/resources/inline_login/inline_login_app.js +++ b/chrome/browser/resources/inline_login/inline_login_app.js
@@ -219,9 +219,9 @@ return isRTL() ? 'cr:chevron-right' : 'cr:chevron-left'; }, - /** @param {!Authenticator} authExtHost */ + /** @param {Object} authExtHost */ setAuthExtHostForTest(authExtHost) { - this.authExtHost_ = authExtHost; + this.authExtHost_ = /** @type {!Authenticator} */ (authExtHost); this.addAuthExtHostListeners_(); }, });
diff --git a/chrome/browser/resources/pdf/elements/viewer-pdf-sidenav.html b/chrome/browser/resources/pdf/elements/viewer-pdf-sidenav.html index 73117f3..ac4681f 100644 --- a/chrome/browser/resources/pdf/elements/viewer-pdf-sidenav.html +++ b/chrome/browser/resources/pdf/elements/viewer-pdf-sidenav.html
@@ -69,11 +69,13 @@ <div id="icons" hidden$="[[!bookmarks.length]]"> <div class$="button-wrapper [[thumbnailButtonClass_(thumbnailView_)]]"> <cr-icon-button iron-icon="pdf:thumbnails" role="tab" + aria-selected$="[[getAriaSelectedThumbnails_(thumbnailView_)]]" title="$i18n{tooltipThumbnails}" on-click="onThumbnailClick_"> </cr-icon-button> </div> <div class$="button-wrapper [[outlineButtonClass_(thumbnailView_)]]"> <cr-icon-button iron-icon="pdf:doc-outline" role="tab" + aria-selected$="[[getAriaSelectedOutline_(thumbnailView_)]]" title="$i18n{tooltipDocumentOutline}" on-click="onOutlineClick_"> </cr-icon-button> </div>
diff --git a/chrome/browser/resources/pdf/elements/viewer-pdf-sidenav.js b/chrome/browser/resources/pdf/elements/viewer-pdf-sidenav.js index 6957b2e..1e02d0e 100644 --- a/chrome/browser/resources/pdf/elements/viewer-pdf-sidenav.js +++ b/chrome/browser/resources/pdf/elements/viewer-pdf-sidenav.js
@@ -68,6 +68,22 @@ thumbnailButtonClass_() { return this.thumbnailView_ ? 'selected' : ''; } + + /** + * @return {string} + * @private + */ + getAriaSelectedThumbnails_() { + return this.thumbnailView_ ? 'true' : 'false'; + } + + /** + * @return {string} + * @private + */ + getAriaSelectedOutline_() { + return this.thumbnailView_ ? 'false' : 'true'; + } } customElements.define(ViewerPdfSidenavElement.is, ViewerPdfSidenavElement);
diff --git a/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.html b/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.html index b81eeb0..2ebca03 100644 --- a/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.html +++ b/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.html
@@ -167,7 +167,10 @@ <div id="toolbar"> <div id="start"> <cr-icon-button id="sidenavToggle" iron-icon="cr20:menu" - disabled="[[annotationMode]]" on-click="onSidenavToggleClick_"> +<if expr="chromeos"> + disabled="[[annotationMode]]" +</if> + on-click="onSidenavToggleClick_"> </cr-icon-button> <span id="title">[[docTitle]]</span> </div> @@ -193,8 +196,11 @@ on-click="onFitToButtonClick_"> </cr-icon-button> <cr-icon-button iron-icon="pdf:rotate-left" - disabled="[[annotationMode]]" aria-label$="$i18n{tooltipRotateCCW}" - title="$i18n{tooltipRotateCCW}" on-click="onRotateClick_"> +<if expr="chromeos"> + disabled="[[annotationMode]]" +</if> + aria-label$="$i18n{tooltipRotateCCW}" title="$i18n{tooltipRotateCCW}" + on-click="onRotateClick_"> </cr-icon-button> </div> <div id="end"> @@ -224,8 +230,10 @@ <cr-action-menu> <button id="two-page-view-button" - class="dropdown-item" on-click="toggleTwoPageViewClick_" - role="checkbox" + class="dropdown-item" on-click="toggleTwoPageViewClick_" role="checkbox" +<if expr="chromeos"> + disabled="[[annotationMode]]" +</if> aria-checked="[[getTwoPageViewAriaChecked_(twoUpViewEnabled_)]]"> <span class="check-container"> <iron-icon icon="pdf:check" hidden="[[!twoUpViewEnabled_]]"></iron-icon>
diff --git a/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.js b/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.js index 20ffefc..705662ed 100644 --- a/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.js +++ b/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.js
@@ -37,12 +37,12 @@ return { // <if expr="chromeos"> annotationAvailable: Boolean, - // </if> annotationMode: { type: Boolean, value: false, reflectToAttribute: true, }, + // </if> docTitle: String, docLength: Number, hasEdits: Boolean,
diff --git a/chrome/browser/resources/pdf/pdf_viewer.js b/chrome/browser/resources/pdf/pdf_viewer.js index 67d1d27c..101c975 100644 --- a/chrome/browser/resources/pdf/pdf_viewer.js +++ b/chrome/browser/resources/pdf/pdf_viewer.js
@@ -105,7 +105,7 @@ annotationAvailable_: { type: Boolean, computed: 'computeAnnotationAvailable_(' + - 'hadPassword_, rotated_, canSerializeDocument_)', + 'hadPassword_, rotated_, canSerializeDocument_, twoUpViewEnabled_)', }, annotationMode_: { @@ -140,6 +140,8 @@ title_: String, + twoUpViewEnabled_: Boolean, + isFormFieldFocused_: Boolean, pdfViewerUpdateEnabled_: Boolean, @@ -195,6 +197,9 @@ this.title_ = ''; /** @private {boolean} */ + this.twoUpViewEnabled_ = false; + + /** @private {boolean} */ this.isFormFieldFocused_ = false; // <if expr="chromeos"> @@ -620,13 +625,12 @@ * @private */ onTwoUpViewChanged_(e) { - const twoUpViewEnabled = e.detail; - this.currentController.setTwoUpView(twoUpViewEnabled); + this.twoUpViewEnabled_ = e.detail; + this.currentController.setTwoUpView(this.twoUpViewEnabled_); if (!this.pdfViewerUpdateEnabled_) { this.toolbarManager_.forceHideTopToolbar(); } - this.getToolbar_().annotationAvailable = !twoUpViewEnabled; - PDFMetrics.recordTwoUpViewEnabled(twoUpViewEnabled); + PDFMetrics.recordTwoUpViewEnabled(this.twoUpViewEnabled_); } /** @@ -1042,7 +1046,8 @@ * @private */ computeAnnotationAvailable_() { - return this.canSerializeDocument_ && !this.rotated_ && !this.hadPassword_; + return this.canSerializeDocument_ && !this.rotated_ && !this.hadPassword_ && + !this.twoUpViewEnabled_; } /** @override */
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc index 0655ddf6b..30bde10 100644 --- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc +++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc
@@ -224,6 +224,10 @@ auto results = ContentAnalysisResponseToResults(response); for (auto result : results) { + // Only report results with triggered rules. + if (result.triggers.empty()) + continue; + extensions::SafeBrowsingPrivateEventRouterFactory::GetForProfile(profile) ->OnAnalysisConnectorWarningBypassed( url, file_name, download_digest_sha256, mime_type, trigger,
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc index 08b1105d..61d264c8 100644 --- a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc +++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc
@@ -269,6 +269,10 @@ extensions::SafeBrowsingPrivateEventRouter::kTriggerFileDownload, DeepScanAccessPoint::DOWNLOAD, item_->GetTotalBytes(), result, response, event_result); + + item_->SetUserData( + enterprise_connectors::ScanResult::kKey, + std::make_unique<enterprise_connectors::ScanResult>(response)); } FinishRequest(download_result);
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc index 6f2f99c7..83d2e39 100644 --- a/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc
@@ -169,35 +169,17 @@ void EnableAllFeatures() { SetFeatures({enterprise_connectors::kEnterpriseConnectorsEnabled}, - {kMalwareScanEnabled, kContentComplianceEnabled, - extensions::SafeBrowsingPrivateEventRouter:: + {extensions::SafeBrowsingPrivateEventRouter:: kRealtimeReportingFeature}); } void DisableAllFeatures() { SetFeatures( {}, - {kMalwareScanEnabled, kContentComplianceEnabled, - extensions::SafeBrowsingPrivateEventRouter::kRealtimeReportingFeature, + {extensions::SafeBrowsingPrivateEventRouter::kRealtimeReportingFeature, enterprise_connectors::kEnterpriseConnectorsEnabled}); } - const std::vector<base::Feature> DlpFeatures() { - return {enterprise_connectors::kEnterpriseConnectorsEnabled}; - } - - const std::vector<base::Feature> MalwareFeatures() { - return {enterprise_connectors::kEnterpriseConnectorsEnabled}; - } - - const std::vector<base::Feature> DisabledMalwareFeatures() { - return {kMalwareScanEnabled}; - } - - const std::vector<base::Feature> DisabledDlpFeatures() { - return {kContentComplianceEnabled}; - } - void ValidateDefaultSettings( const base::Optional<enterprise_connectors::AnalysisSettings>& settings) { ASSERT_TRUE(settings.has_value()); @@ -295,39 +277,6 @@ request.Start(); expect_dlp_and_malware_tags(); } - { - SetFeatures(/*enabled*/ DlpFeatures(), - /*disabled*/ DisabledMalwareFeatures()); - DeepScanningRequest request( - &item_, DeepScanningRequest::DeepScanTrigger::TRIGGER_POLICY, - base::DoNothing(), &download_protection_service_, - dlp_and_malware_settings()); - request.Start(); - expect_dlp_and_malware_tags(); - } - { - SetFeatures(/*enabled*/ MalwareFeatures(), - /*disabled*/ DisabledDlpFeatures()); - DeepScanningRequest request( - &item_, DeepScanningRequest::DeepScanTrigger::TRIGGER_POLICY, - base::DoNothing(), &download_protection_service_, - dlp_and_malware_settings()); - request.Start(); - expect_dlp_and_malware_tags(); - } - { - // Validate that the Connector feature still allows scanning if the other - // two flags are off. - SetFeatures( - /*enabled*/ {enterprise_connectors::kEnterpriseConnectorsEnabled}, - /*disabled*/ {kMalwareScanEnabled, kContentComplianceEnabled}); - DeepScanningRequest request( - &item_, DeepScanningRequest::DeepScanTrigger::TRIGGER_POLICY, - base::DoNothing(), &download_protection_service_, - dlp_and_malware_settings()); - request.Start(); - expect_dlp_and_malware_tags(); - } } TEST_F(DeepScanningRequestTest, GeneratesCorrectRequestFromPolicy) { @@ -794,8 +743,8 @@ } TEST_F(DeepScanningRequestTest, ShouldUploadBinary_MalwareListPolicy) { - SetFeatures(/*enabled*/ MalwareFeatures(), - /*disabled*/ {kContentComplianceEnabled}); + SetFeatures(/*enabled*/ {enterprise_connectors::kEnterpriseConnectorsEnabled}, + /*disabled*/ {}); SetMalwarePolicyForConnectors(SEND_UPLOADS_AND_DOWNLOADS); ClearUrlsToCheckComplianceOfDownloadsForConnectors();
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc index 792dd28..73d20b88 100644 --- a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
@@ -3011,8 +3011,7 @@ } TEST_P(DeepScanningDownloadTest, PasswordProtectedArchivesBlockedByPreference) { - if (!base::FeatureList::IsEnabled(kMalwareScanEnabled) && - !base::FeatureList::IsEnabled(kContentComplianceEnabled)) + if (!flag_enabled()) return; base::FilePath test_zip; @@ -3071,8 +3070,7 @@ } TEST_P(DeepScanningDownloadTest, LargeFileBlockedByPreference) { - if (!base::FeatureList::IsEnabled(kMalwareScanEnabled) && - !base::FeatureList::IsEnabled(kContentComplianceEnabled)) + if (!flag_enabled()) return; base::FilePath test_zip; @@ -3134,8 +3132,7 @@ } TEST_P(DeepScanningDownloadTest, UnsupportedFiletypeBlockedByPreference) { - if (!base::FeatureList::IsEnabled(kMalwareScanEnabled) && - !base::FeatureList::IsEnabled(kContentComplianceEnabled)) + if (!flag_enabled()) return; base::FilePath test_file;
diff --git a/chrome/browser/safe_browsing/download_protection/download_reporter.cc b/chrome/browser/safe_browsing/download_protection/download_reporter.cc index c02ce6c..0aeff87f 100644 --- a/chrome/browser/safe_browsing/download_protection/download_reporter.cc +++ b/chrome/browser/safe_browsing/download_protection/download_reporter.cc
@@ -7,6 +7,7 @@ #include "base/strings/string_number_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/download/simple_download_manager_coordinator_factory.h" +#include "chrome/browser/enterprise/connectors/common.h" #include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h" #include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_factory.h" #include "chrome/browser/profiles/profile_key.h" @@ -16,7 +17,6 @@ #include "components/download/public/common/download_danger_type.h" #include "components/download/public/common/download_item.h" #include "components/download/public/common/simple_download_manager_coordinator.h" -#include "components/safe_browsing/core/proto/webprotect.pb.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_item_utils.h" @@ -93,14 +93,19 @@ Profile* profile = Profile::FromBrowserContext(browser_context); if (profile) { std::string raw_digest_sha256 = download->GetHash(); - extensions::SafeBrowsingPrivateEventRouterFactory::GetForProfile(profile) - ->OnAnalysisConnectorWarningBypassed( - download->GetURL(), download->GetTargetFilePath().AsUTF8Unsafe(), - base::HexEncode(raw_digest_sha256.data(), raw_digest_sha256.size()), - download->GetMimeType(), - extensions::SafeBrowsingPrivateEventRouter::kTriggerFileDownload, - DeepScanAccessPoint::DOWNLOAD, ContentAnalysisScanResult(), - download->GetTotalBytes()); + enterprise_connectors::ScanResult* stored_result = + static_cast<enterprise_connectors::ScanResult*>( + download->GetUserData(enterprise_connectors::ScanResult::kKey)); + + ReportAnalysisConnectorWarningBypass( + profile, download->GetURL(), + download->GetTargetFilePath().AsUTF8Unsafe(), + base::HexEncode(raw_digest_sha256.data(), raw_digest_sha256.size()), + download->GetMimeType(), + extensions::SafeBrowsingPrivateEventRouter::kTriggerFileDownload, + DeepScanAccessPoint::DOWNLOAD, download->GetTotalBytes(), + stored_result ? stored_result->response + : enterprise_connectors::ContentAnalysisResponse()); } }
diff --git a/chrome/browser/supervised_user/supervised_user_features.cc b/chrome/browser/supervised_user/supervised_user_features.cc index 49dde757..ee323320 100644 --- a/chrome/browser/supervised_user/supervised_user_features.cc +++ b/chrome/browser/supervised_user/supervised_user_features.cc
@@ -13,4 +13,6 @@ "SupervisedUserInitiatedExtensionInstall", base::FEATURE_ENABLED_BY_DEFAULT}; +const base::Feature kEduCoexistenceFlowV2{"kEduCoexistenceV2", + base::FEATURE_DISABLED_BY_DEFAULT}; } // namespace supervised_users
diff --git a/chrome/browser/supervised_user/supervised_user_features.h b/chrome/browser/supervised_user/supervised_user_features.h index f62989e1..cc1212a2 100644 --- a/chrome/browser/supervised_user/supervised_user_features.h +++ b/chrome/browser/supervised_user/supervised_user_features.h
@@ -13,6 +13,8 @@ extern const base::Feature kSupervisedUserInitiatedExtensionInstall; +extern const base::Feature kEduCoexistenceFlowV2; + } // namespace supervised_users #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_FEATURES_H_
diff --git a/chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc b/chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc index e9eb0b4..a07bc1f 100644 --- a/chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc +++ b/chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc
@@ -275,12 +275,13 @@ GURL manually_blocked_url = embedded_test_server()->GetURL( kExampleHost2, "/supervised_user/with_iframes.html"); - ui_test_utils::NavigateToURL(browser(), - GURL(chrome::kChromeUIEDUCoexistenceLoginURL)); + ui_test_utils::NavigateToURL( + browser(), GURL(SupervisedUserService::GetEduCoexistenceLoginUrl())); // Get the top level WebContents. content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - EXPECT_EQ(contents->GetURL(), GURL(chrome::kChromeUIEDUCoexistenceLoginURL)); + EXPECT_EQ(contents->GetURL(), + GURL(SupervisedUserService::GetEduCoexistenceLoginUrl())); InnerWebContentsAttachedWaiter web_contents_attached_waiter( browser()->tab_strip_model()->GetActiveWebContents());
diff --git a/chrome/browser/supervised_user/supervised_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc index 97623a7a..f03a87c 100644 --- a/chrome/browser/supervised_user/supervised_user_service.cc +++ b/chrome/browser/supervised_user/supervised_user_service.cc
@@ -39,6 +39,7 @@ #include "chrome/browser/supervised_user/supervised_user_site_list.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" +#include "chrome/common/webui_url_constants.h" #include "chrome/grit/generated_resources.h" #include "components/policy/core/browser/url_util.h" #include "components/pref_registry/pref_registry_syncable.h" @@ -277,6 +278,13 @@ supervised_users::kSupervisedUserIframeFilter); } +// static +std::string SupervisedUserService::GetEduCoexistenceLoginUrl() { + return base::FeatureList::IsEnabled(supervised_users::kEduCoexistenceFlowV2) + ? chrome::kChromeUIEDUCoexistenceLoginURLV2 + : chrome::kChromeUIEDUCoexistenceLoginURLV1; +} + bool SupervisedUserService::IsChild() const { return profile_->IsChild(); }
diff --git a/chrome/browser/supervised_user/supervised_user_service.h b/chrome/browser/supervised_user/supervised_user_service.h index 5227473..46b355a 100644 --- a/chrome/browser/supervised_user/supervised_user_service.h +++ b/chrome/browser/supervised_user/supervised_user_service.h
@@ -159,6 +159,8 @@ bool IsSupervisedUserIframeFilterEnabled() const; + static std::string GetEduCoexistenceLoginUrl(); + // Returns true if the user is a type of Family Link Child account, // but will not return true for a Legacy Supervised user (or non child users). bool IsChild() const;
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.cc b/chrome/browser/supervised_user/supervised_user_url_filter.cc index 3b46cbf3..72541ef 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter.cc +++ b/chrome/browser/supervised_user/supervised_user_url_filter.cc
@@ -26,8 +26,11 @@ #include "base/task/thread_pool.h" #include "base/task_runner_util.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/supervised_user/kids_management_url_checker_client.h" #include "chrome/browser/supervised_user/supervised_user_denylist.h" +#include "chrome/browser/supervised_user/supervised_user_service.h" +#include "chrome/browser/supervised_user/supervised_user_service_factory.h" #include "chrome/common/chrome_features.h" #include "chrome/common/webui_url_constants.h" #include "components/policy/core/browser/url_util.h" @@ -239,7 +242,7 @@ contents->GetOutermostWebContents(); return outer_most_content->GetURL() == - GURL(chrome::kChromeUIEDUCoexistenceLoginURL); + GURL(SupervisedUserService::GetEduCoexistenceLoginUrl()); } // static
diff --git a/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc b/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc index fb112d97..a253481a 100644 --- a/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc
@@ -588,7 +588,8 @@ NewSyncDataShouldReplaceExistingData) { GetFakeServer()->SetWalletData( {CreateSyncWalletCard(/*name=*/"card-1", /*last_four=*/"0001", - kDefaultBillingAddressID, /*nickname=*/""), + kDefaultBillingAddressID, /*nickname=*/"", + /*instrument_id=*/123), CreateSyncWalletAddress(/*name=*/"address-1", /*company=*/"Company-1"), CreateDefaultSyncPaymentsCustomerData(), CreateSyncCreditCardCloudTokenData(/*cloud_token_data_id=*/"data-1")}); @@ -600,6 +601,7 @@ std::vector<CreditCard*> cards = pdm->GetCreditCards(); ASSERT_EQ(1uL, cards.size()); EXPECT_EQ(ASCIIToUTF16("0001"), cards[0]->LastFourDigits()); + EXPECT_EQ(123, cards[0]->instrument_id()); // When no nickname is returned from Sync server, credit card's nickname is // empty. EXPECT_TRUE(cards[0]->nickname().empty()); @@ -617,7 +619,7 @@ GetFakeServer()->SetWalletData( {CreateSyncWalletCard(/*name=*/"new-card", /*last_four=*/"0002", kDefaultBillingAddressID, - /*nickname=*/"Grocery Card"), + /*nickname=*/"Grocery Card", /*instrument_id=*/321), CreateSyncWalletAddress(/*name=*/"new-address", /*company=*/"Company-2"), CreateSyncPaymentsCustomerData(/*customer_id=*/"different"), CreateSyncCreditCardCloudTokenData(/*cloud_token_data_id=*/"data-2")}); @@ -628,6 +630,7 @@ cards = pdm->GetCreditCards(); ASSERT_EQ(1uL, cards.size()); EXPECT_EQ(ASCIIToUTF16("0002"), cards[0]->LastFourDigits()); + EXPECT_EQ(321, cards[0]->instrument_id()); EXPECT_EQ(ASCIIToUTF16("Grocery Card"), cards[0]->nickname()); profiles = pdm->GetServerProfiles(); ASSERT_EQ(1uL, profiles.size());
diff --git a/chrome/browser/sync/test/integration/wallet_helper.cc b/chrome/browser/sync/test/integration/wallet_helper.cc index 2d9f9e1..2b87d779 100644 --- a/chrome/browser/sync/test/integration/wallet_helper.cc +++ b/chrome/browser/sync/test/integration/wallet_helper.cc
@@ -347,7 +347,8 @@ sync_pb::SyncEntity CreateSyncWalletCard(const std::string& name, const std::string& last_four, const std::string& billing_address_id, - const std::string& nickname) { + const std::string& nickname, + int instrument_id) { sync_pb::SyncEntity entity; entity.set_name(name); entity.set_id_string(name); @@ -368,6 +369,7 @@ credit_card->set_name_on_card(kDefaultCardName); credit_card->set_status(sync_pb::WalletMaskedCreditCard::VALID); credit_card->set_type(kDefaultCardType); + credit_card->set_instrument_id(instrument_id); if (!billing_address_id.empty()) { credit_card->set_billing_address_id(billing_address_id); }
diff --git a/chrome/browser/sync/test/integration/wallet_helper.h b/chrome/browser/sync/test/integration/wallet_helper.h index 7aa6ff39..125b7ace 100644 --- a/chrome/browser/sync/test/integration/wallet_helper.h +++ b/chrome/browser/sync/test/integration/wallet_helper.h
@@ -90,7 +90,8 @@ sync_pb::SyncEntity CreateSyncWalletCard(const std::string& name, const std::string& last_four, const std::string& billing_address_id, - const std::string& nickname = ""); + const std::string& nickname = "", + int instrument_id = 1); sync_pb::SyncEntity CreateSyncPaymentsCustomerData( const std::string& customer_id);
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 90579987..86b4c9d 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1304,6 +1304,10 @@ "webui/bookmarks/bookmarks_ui.h", "webui/chrome_web_contents_handler.cc", "webui/chrome_web_contents_handler.h", + "webui/commander/commander_handler.cc", + "webui/commander/commander_handler.h", + "webui/commander/commander_ui.cc", + "webui/commander/commander_ui.h", "webui/customize_themes/chrome_customize_themes_handler.cc", "webui/customize_themes/chrome_customize_themes_handler.h", "webui/devtools_ui.cc",
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 80336be..13ce4f9 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chrome/browser/chromeos/multidevice_setup/multidevice_setup_service_factory.h" +#include "chrome/browser/nearby_sharing/nearby_share_delegate_impl.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/ash/back_gesture_contextual_nudge_delegate.h" @@ -199,3 +200,8 @@ ash::BackGestureContextualNudgeController* controller) { return std::make_unique<BackGestureContextualNudgeDelegate>(controller); } + +std::unique_ptr<ash::NearbyShareDelegate> +ChromeShellDelegate::CreateNearbyShareDelegate() const { + return std::make_unique<NearbyShareDelegateImpl>(); +}
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h index 99ed39d7..3637d809 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -45,6 +45,8 @@ chromeos::multidevice_setup::mojom::MultiDeviceSetup> receiver) override; media_session::mojom::MediaSessionService* GetMediaSessionService() override; + std::unique_ptr<ash::NearbyShareDelegate> CreateNearbyShareDelegate() + const override; private: DISALLOW_COPY_AND_ASSIGN(ChromeShellDelegate);
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_file_system_delegate.cc b/chrome/browser/ui/ash/holding_space/holding_space_file_system_delegate.cc index 9eb7c8a6..e90c3bd 100644 --- a/chrome/browser/ui/ash/holding_space/holding_space_file_system_delegate.cc +++ b/chrome/browser/ui/ash/holding_space/holding_space_file_system_delegate.cc
@@ -10,6 +10,7 @@ #include "base/sequence_checker.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" +#include "chrome/browser/ui/ash/holding_space/holding_space_util.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" @@ -89,18 +90,31 @@ weak_factory_.GetWeakPtr())); } -// TODO(dmblack): Watch `item`'s parent directory instead of its backing file so -// that we can reuse the same watcher across multiple holding space items. void HoldingSpaceFileSystemDelegate::OnHoldingSpaceItemAdded( const HoldingSpaceItem* item) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - AddWatch(item->file_path()); + + // Watch the directory containing `items`'s backing file. If the directory is + // already being watched, this will no-op. + AddWatch(item->file_path().DirName()); } void HoldingSpaceFileSystemDelegate::OnHoldingSpaceItemRemoved( const HoldingSpaceItem* item) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - RemoveWatch(item->file_path()); + + // Since we were watching the directory containing `item`'s backing file and + // not the backing file itself, we only need to remove the associated watch if + // there are no other holding space items backed by the same directory. + const bool remove_watch = + std::none_of(model()->items().begin(), model()->items().end(), + [removed_item = item](const auto& item) { + return item->file_path().DirName() == + removed_item->file_path().DirName(); + }); + + if (remove_watch) + RemoveWatch(item->file_path().DirName()); } void HoldingSpaceFileSystemDelegate::OnFilePathChanged( @@ -109,8 +123,31 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(!error); - // Currently `OnFilePathChanged()` is only called on removal of `file_path`. - file_removed_callback_.Run(file_path); + // The `file_path` that changed is a directory containing backing files for + // one or more holding space items. Changes to this directory may indicate + // that some, all, or none of these backing files have been removed. We need + // to verify the existence of these backing files and remove any holding space + // items that no longer exist. + + std::vector<base::FilePath> file_paths; + for (const auto& item : model()->items()) { + if (file_path.IsParent(item->file_path())) + file_paths.push_back(item->file_path()); + } + + holding_space_util::PartitionFilePathsByExistence( + profile(), std::move(file_paths), + base::BindOnce( + [](const base::WeakPtr<HoldingSpaceFileSystemDelegate>& weak_ptr, + std::vector<base::FilePath> existing_file_paths, + std::vector<base::FilePath> non_existing_file_paths) { + if (weak_ptr) { + auto file_removed_callback = weak_ptr->file_removed_callback_; + for (const auto& non_existing_file_path : non_existing_file_paths) + file_removed_callback.Run(non_existing_file_path); + } + }, + weak_factory_.GetWeakPtr())); } void HoldingSpaceFileSystemDelegate::AddWatch(const base::FilePath& file_path) {
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_persistence_delegate.cc b/chrome/browser/ui/ash/holding_space/holding_space_persistence_delegate.cc index 332eaed..018b385 100644 --- a/chrome/browser/ui/ash/holding_space/holding_space_persistence_delegate.cc +++ b/chrome/browser/ui/ash/holding_space/holding_space_persistence_delegate.cc
@@ -88,6 +88,8 @@ } std::vector<HoldingSpaceItemPtr> holding_space_items; + std::vector<base::FilePath> holding_space_file_paths; + for (const auto& persisted_holding_space_item : persisted_holding_space_items->GetList()) { holding_space_items.push_back(HoldingSpaceItem::Deserialize( @@ -96,36 +98,38 @@ base::Unretained(profile())), base::BindOnce(&holding_space_util::ResolveImage, base::Unretained(thumbnail_loader_)))); + holding_space_file_paths.push_back(holding_space_items.back()->file_path()); } - holding_space_util::PartitionItemsByExistence( - profile(), std::move(holding_space_items), + holding_space_util::PartitionFilePathsByExistence( + profile(), std::move(holding_space_file_paths), base::BindOnce(&HoldingSpacePersistenceDelegate::RestoreModelByExistence, - weak_factory_.GetWeakPtr())); + weak_factory_.GetWeakPtr(), + std::move(holding_space_items))); } void HoldingSpacePersistenceDelegate::RestoreModelByExistence( - std::vector<HoldingSpaceItemPtr> existing_items, - std::vector<HoldingSpaceItemPtr> non_existing_items) { + std::vector<HoldingSpaceItemPtr> holding_space_items, + std::vector<base::FilePath> existing_file_paths, + std::vector<base::FilePath> non_existing_file_paths) { DCHECK(model()->items().empty()); // Restore existing holding space items. - for (auto& holding_space_item : existing_items) - item_restored_callback_.Run(std::move(holding_space_item)); + for (auto& holding_space_item : holding_space_items) { + if (base::Contains(existing_file_paths, holding_space_item->file_path())) + item_restored_callback_.Run(std::move(holding_space_item)); + } // Clean up non-existing holding space items from persistence. - if (!non_existing_items.empty()) { + if (!non_existing_file_paths.empty()) { ListPrefUpdate update(profile()->GetPrefs(), kPersistencePath); - update->EraseListValueIf([&non_existing_items]( - const base::Value& persisted_item) { - const std::string& persisted_item_id = HoldingSpaceItem::DeserializeId( - base::Value::AsDictionaryValue(persisted_item)); - return std::any_of( - non_existing_items.begin(), non_existing_items.end(), - [&persisted_item_id](const HoldingSpaceItemPtr& non_existing_item) { - return non_existing_item->id() == persisted_item_id; - }); - }); + update->EraseListValueIf( + [&non_existing_file_paths](const base::Value& persisted_item) { + base::FilePath persisted_file_path = + HoldingSpaceItem::DeserializeFilePath( + base::Value::AsDictionaryValue(persisted_item)); + return base::Contains(non_existing_file_paths, persisted_file_path); + }); } // Notify completion of persistence restoration.
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_persistence_delegate.h b/chrome/browser/ui/ash/holding_space/holding_space_persistence_delegate.h index b30bedf..910e80a 100644 --- a/chrome/browser/ui/ash/holding_space/holding_space_persistence_delegate.h +++ b/chrome/browser/ui/ash/holding_space/holding_space_persistence_delegate.h
@@ -11,6 +11,10 @@ #include "base/callback.h" #include "chrome/browser/ui/ash/holding_space/holding_space_keyed_service_delegate.h" +namespace base { +class FilePath; +} // namespace base + namespace user_prefs { class PrefRegistrySyncable; } // namespace user_prefs @@ -64,8 +68,9 @@ // Restores the holding space model from persistent storage. void RestoreModelFromPersistence(); void RestoreModelByExistence( - std::vector<HoldingSpaceItemPtr> existing_items, - std::vector<HoldingSpaceItemPtr> non_existing_items); + std::vector<HoldingSpaceItemPtr> holding_space_items, + std::vector<base::FilePath> existing_file_paths, + std::vector<base::FilePath> non_existing_file_paths); // Owned by `HoldingSpaceKeyedService`. HoldingSpaceThumbnailLoader* const thumbnail_loader_;
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_util.cc b/chrome/browser/ui/ash/holding_space/holding_space_util.cc index e332814..8ca9328 100644 --- a/chrome/browser/ui/ash/holding_space/holding_space_util.cc +++ b/chrome/browser/ui/ash/holding_space/holding_space_util.cc
@@ -4,8 +4,6 @@ #include "chrome/browser/ui/ash/holding_space/holding_space_util.h" -#include <map> - #include "ash/public/cpp/file_icon_util.h" #include "ash/public/cpp/holding_space/holding_space_constants.h" #include "ash/public/cpp/holding_space/holding_space_image.h" @@ -51,19 +49,19 @@ // Utilities ------------------------------------------------------------------- -void ItemExists(Profile* profile, - const HoldingSpaceItem* item, - ItemExistsCallback callback) { - if (!item) { +void FilePathExists(Profile* profile, + const base::FilePath& file_path, + FilePathExistsCallback callback) { + if (file_path.empty()) { std::move(callback).Run(/*exists=*/false); return; } file_manager::util::GetMetadataForPath( file_manager::util::GetFileSystemContextForExtensionId( profile, file_manager::kFileManagerAppId), - item->file_path(), storage::FileSystemOperation::GET_METADATA_FIELD_NONE, + file_path, storage::FileSystemOperation::GET_METADATA_FIELD_NONE, base::BindOnce( - [](ItemExistsCallback callback, base::File::Error result, + [](FilePathExistsCallback callback, base::File::Error result, const base::File::Info& file_info) { // Absence of error is confirmation of existence. bool exists = result == base::File::Error::FILE_OK; @@ -72,76 +70,73 @@ std::move(callback))); } -void PartitionItemsByExistence(Profile* profile, - HoldingSpaceItemPtrList items, - PartitionItemsByExistenceCallback callback) { - if (items.empty()) { - std::move(callback).Run(/*existing_items=*/{}, /*non_existing_items=*/{}); +void PartitionFilePathsByExistence( + Profile* profile, + FilePathList file_paths, + PartitionFilePathsByExistenceCallback callback) { + if (file_paths.empty()) { + std::move(callback).Run(/*existing_file_paths=*/{}, + /*non_existing_file_paths=*/{}); return; } - // Cache the original indices of the `items` being partitioned so that we can - // return them back in the same order after checking for existence. - std::map<std::string, size_t> indices_by_id; - for (size_t i = 0; i < items.size(); ++i) - indices_by_id[items.at(i)->id()] = i; + auto existing_file_paths = std::make_unique<FilePathList>(); + auto non_existing_file_paths = std::make_unique<FilePathList>(); - auto existing_items = std::make_unique<HoldingSpaceItemPtrList>(); - auto non_existing_items = std::make_unique<HoldingSpaceItemPtrList>(); - - auto* existing_items_ptr = existing_items.get(); - auto* non_existing_items_ptr = non_existing_items.get(); + auto* existing_file_paths_ptr = existing_file_paths.get(); + auto* non_existing_file_paths_ptr = non_existing_file_paths.get(); // This `barrier_closure` will be run after verifying the existence of all - // holding space `items`. It is expected that both `existing_items` and - // `non_existing_items` will have been populated by the time of invocation. + // `file_paths`. It is expected that both `existing_file_paths` and + // `non_existing_file_paths` will have been populated by the time of + // invocation. base::RepeatingClosure barrier_closure = base::BarrierClosure( - items.size(), + file_paths.size(), base::BindOnce( - [](std::unique_ptr<HoldingSpaceItemPtrList> existing_items, - std::unique_ptr<HoldingSpaceItemPtrList> non_existing_items, - std::map<std::string, size_t> indices_by_id, - PartitionItemsByExistenceCallback callback) { + [](FilePathList sorted_file_paths, + std::unique_ptr<FilePathList> existing_file_paths, + std::unique_ptr<FilePathList> non_existing_file_paths, + PartitionFilePathsByExistenceCallback callback) { // We need to sort our partitioned vectors to match the original // order that was provided at call time. This is necessary as the // original order may have been lost due to race conditions when - // checking for item existence. - auto sort = [&indices_by_id](HoldingSpaceItemPtrList* items) { - std::sort(items->begin(), items->end(), - [&indices_by_id](const auto& a, const auto& b) { - return indices_by_id[a->id()] < - indices_by_id[b->id()]; - }); + // checking for file path existence. + auto sort = [&sorted_file_paths](FilePathList* file_paths) { + FilePathList temp_file_paths; + temp_file_paths.swap(*file_paths); + for (const auto& file_path : sorted_file_paths) { + if (base::Contains(temp_file_paths, file_path)) + file_paths->push_back(file_path); + } }; - sort(existing_items.get()); - sort(non_existing_items.get()); + sort(existing_file_paths.get()); + sort(non_existing_file_paths.get()); // Ownership of the partitioned vectors is passed to `callback`. - std::move(callback).Run(std::move(*existing_items), - std::move(*non_existing_items)); + std::move(callback).Run(std::move(*existing_file_paths), + std::move(*non_existing_file_paths)); }, - std::move(existing_items), std::move(non_existing_items), - std::move(indices_by_id), std::move(callback))); + /*sorted_file_paths=*/file_paths, std::move(existing_file_paths), + std::move(non_existing_file_paths), std::move(callback))); - // Verify existence of each holding space `item`. Upon successful check of - // existence, each `item` should be pushed into either `existing_items` or - // `non_existing_items` as appropriate. - for (auto& item : items) { - HoldingSpaceItem* item_ptr = item.get(); - ItemExists(profile, item_ptr, - base::BindOnce( - [](HoldingSpaceItemPtr item, - HoldingSpaceItemPtrList* existing_items, - HoldingSpaceItemPtrList* non_existing_items, - base::RepeatingClosure barrier_closure, bool exists) { - if (exists) - existing_items->push_back(std::move(item)); - else - non_existing_items->push_back(std::move(item)); - barrier_closure.Run(); - }, - std::move(item), base::Unretained(existing_items_ptr), - base::Unretained(non_existing_items_ptr), barrier_closure)); + // Verify existence of each `file_path`. Upon successful check of existence, + // each `file_path` should be pushed into either `existing_file_paths` or + // `non_existing_file_paths` as appropriate. + for (auto& file_path : file_paths) { + FilePathExists( + profile, file_path, + base::BindOnce( + [](base::FilePath file_path, FilePathList* existing_file_paths, + FilePathList* non_existing_file_paths, + base::RepeatingClosure barrier_closure, bool exists) { + if (exists) + existing_file_paths->push_back(file_path); + else + non_existing_file_paths->push_back(file_path); + barrier_closure.Run(); + }, + file_path, base::Unretained(existing_file_paths_ptr), + base::Unretained(non_existing_file_paths_ptr), barrier_closure)); } }
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_util.h b/chrome/browser/ui/ash/holding_space/holding_space_util.h index 79bd6443..08900e3b 100644 --- a/chrome/browser/ui/ash/holding_space/holding_space_util.h +++ b/chrome/browser/ui/ash/holding_space/holding_space_util.h
@@ -23,26 +23,26 @@ class HoldingSpaceImage; class HoldingSpaceThumbnailLoader; -using HoldingSpaceItemPtr = std::unique_ptr<HoldingSpaceItem>; -using HoldingSpaceItemPtrList = std::vector<HoldingSpaceItemPtr>; - // A utility for holding space. namespace holding_space_util { -// Checks `item` existence, returning the result via `callback`. -using ItemExistsCallback = base::OnceCallback<void(bool)>; -void ItemExists(Profile* profile, - const HoldingSpaceItem* item, - ItemExistsCallback callback); +using FilePathList = std::vector<base::FilePath>; -// Partitions `items` into `existing_items` and `non_existing_items`, returning -// the result via `callback`. -using PartitionItemsByExistenceCallback = - base::OnceCallback<void(HoldingSpaceItemPtrList existing_items, - HoldingSpaceItemPtrList non_existing_items)>; -void PartitionItemsByExistence(Profile* profile, - HoldingSpaceItemPtrList items, - PartitionItemsByExistenceCallback callback); +// Checks `file_path` existence, returning the result via `callback`. +using FilePathExistsCallback = base::OnceCallback<void(bool)>; +void FilePathExists(Profile* profile, + const base::FilePath& file_path, + FilePathExistsCallback callback); + +// Partitions `file_paths` into `existing_file_paths` and +// `non_existing_file_paths`, returning the result via `callback`. +using PartitionFilePathsByExistenceCallback = + base::OnceCallback<void(FilePathList existing_file_paths, + FilePathList non_existing_file_paths)>; +void PartitionFilePathsByExistence( + Profile* profile, + FilePathList file_paths, + PartitionFilePathsByExistenceCallback callback); // Resolves the file system URL associated with the specified `file_path`. GURL ResolveFileSystemUrl(Profile* profile, const base::FilePath& file_path);
diff --git a/chrome/browser/ui/ash/launcher/app_service/app_service_app_window_browsertest.cc b/chrome/browser/ui/ash/launcher/app_service/app_service_app_window_browsertest.cc index 3946f27..57d599e6 100644 --- a/chrome/browser/ui/ash/launcher/app_service/app_service_app_window_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/app_service/app_service_app_window_browsertest.cc
@@ -24,6 +24,7 @@ #include "chrome/browser/web_applications/test/web_app_test.h" #include "chrome/common/chrome_features.h" #include "chrome/common/web_application_info.h" +#include "chromeos/constants/chromeos_features.h" #include "components/arc/arc_service_manager.h" #include "components/arc/arc_util.h" #include "components/arc/session/arc_bridge_service.h" @@ -34,6 +35,7 @@ #include "content/public/test/browser_test.h" #include "content/public/test/test_navigation_observer.h" #include "extensions/browser/app_window/app_window.h" +#include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/display/display.h" @@ -112,14 +114,30 @@ logical_window_id.c_str(), shelf_group_id.c_str()); } +// Creates an exo app window and sets its shell application id. The returned +// Widget is owned by its NativeWidget (the underlying aura::Window). +views::Widget* CreateExoWindow(const std::string& window_app_id) { + views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); + params.bounds = gfx::Rect(5, 5, 20, 20); + params.context = ash::Shell::GetPrimaryRootWindow(); + views::Widget* widget = new views::Widget(); + widget->Init(std::move(params)); + // Set app id before showing the window to be recognized in + // AppServiceAppWindowLauncherController. + exo::SetShellApplicationId(widget->GetNativeWindow(), window_app_id); + widget->Show(); + widget->Activate(); + return widget; +} + } // namespace class AppServiceAppWindowBrowserTest : public extensions::PlatformAppBrowserTest { protected: - AppServiceAppWindowBrowserTest() : controller_(nullptr) {} + AppServiceAppWindowBrowserTest() = default; - ~AppServiceAppWindowBrowserTest() override {} + ~AppServiceAppWindowBrowserTest() override = default; void SetUp() override { extensions::PlatformAppBrowserTest::SetUp(); @@ -289,6 +307,51 @@ EXPECT_EQ(0u, windows.size()); } +class AppServiceAppWindowLacrosBrowserTest + : public AppServiceAppWindowBrowserTest { + public: + AppServiceAppWindowLacrosBrowserTest() { + feature_list_.InitAndEnableFeature(chromeos::features::kLacrosSupport); + } + ~AppServiceAppWindowLacrosBrowserTest() override = default; + + private: + base::test::ScopedFeatureList feature_list_; +}; + +IN_PROC_BROWSER_TEST_F(AppServiceAppWindowLacrosBrowserTest, LacrosWindow) { + // Create a fake Lacros window. The native window owns the widget. + views::Widget* widget = CreateExoWindow("org.chromium.lacros.12345"); + + using extension_misc::kLacrosAppId; + auto windows = + app_service_proxy_->InstanceRegistry().GetWindows(kLacrosAppId); + EXPECT_EQ(1u, windows.size()); + EXPECT_EQ(apps::InstanceState::kStarted | apps::InstanceState::kRunning | + apps::InstanceState::kActive | apps::InstanceState::kVisible, + GetAppInstanceState(kLacrosAppId, *windows.begin())); + + // Find the Lacros shelf item. + int lacros_index = shelf_model()->ItemIndexByAppID(kLacrosAppId); + ASSERT_NE(-1, lacros_index); + const ash::ShelfItem& item = shelf_model()->items()[lacros_index]; + + // Since it is already active, clicking it should minimize. + SelectItem(item.id); + EXPECT_EQ(apps::InstanceState::kStarted | apps::InstanceState::kRunning, + GetAppInstanceState(kLacrosAppId, *windows.begin())); + + // Click the item again to activate the window. + SelectItem(item.id); + EXPECT_EQ(apps::InstanceState::kStarted | apps::InstanceState::kRunning | + apps::InstanceState::kActive | apps::InstanceState::kVisible, + GetAppInstanceState(kLacrosAppId, *windows.begin())); + + widget->CloseNow(); + windows = app_service_proxy_->InstanceRegistry().GetWindows(kLacrosAppId); + EXPECT_EQ(0u, windows.size()); +} + class AppServiceAppWindowWebAppBrowserTest : public AppServiceAppWindowBrowserTest, public ::testing::WithParamInterface<web_app::ProviderType> { @@ -490,21 +553,6 @@ arc_session_manager()->Shutdown(); } - // Creates app window and set optional ARC application id. - views::Widget* CreateArcWindow(const std::string& window_app_id) { - views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); - params.bounds = gfx::Rect(5, 5, 20, 20); - params.context = ash::Shell::GetPrimaryRootWindow(); - views::Widget* widget = new views::Widget(); - widget->Init(std::move(params)); - // Set ARC id before showing the window to be recognized in - // ArcAppWindowLauncherController. - exo::SetShellApplicationId(widget->GetNativeWindow(), window_app_id); - widget->Show(); - widget->Activate(); - return widget; - } - ArcAppListPrefs* app_prefs() { return ArcAppListPrefs::Get(profile()); } // Returns as AppHost interface in order to access to private implementation @@ -531,7 +579,7 @@ SendPackageAdded(kTestAppPackage, false); // Create the window for app1. - views::Widget* arc_window1 = CreateArcWindow("org.chromium.arc.1"); + views::Widget* arc_window1 = CreateExoWindow("org.chromium.arc.1"); const std::string app_id1 = GetTestApp1Id(kTestAppPackage); // Simulate task creation so the app is marked as running/open. @@ -561,7 +609,7 @@ info = app_prefs()->GetApp(app_id2); app_host()->OnTaskCreated(2, info->package_name, info->activity, info->name, info->intent_uri); - views::Widget* arc_window2 = CreateArcWindow("org.chromium.arc.2"); + views::Widget* arc_window2 = CreateExoWindow("org.chromium.arc.2"); EXPECT_TRUE(controller_->GetItem(ash::ShelfID(app_id2))); // Check the window state in instance for app2 @@ -620,8 +668,8 @@ SendPackageAdded(kTestAppPackage, false); // Create the windows for the app. - views::Widget* arc_window1 = CreateArcWindow("org.chromium.arc.1"); - views::Widget* arc_window2 = CreateArcWindow("org.chromium.arc.2"); + views::Widget* arc_window1 = CreateExoWindow("org.chromium.arc.1"); + views::Widget* arc_window2 = CreateExoWindow("org.chromium.arc.2"); // Simulate task creation so the app is marked as running/open. const std::string app_id = GetTestApp1Id(kTestAppPackage);
diff --git a/chrome/browser/ui/ash/launcher/app_service/app_service_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/app_service/app_service_app_window_launcher_controller.cc index 6b3b5897..064ee66c 100644 --- a/chrome/browser/ui/ash/launcher/app_service/app_service_app_window_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/app_service/app_service_app_window_launcher_controller.cc
@@ -14,6 +14,7 @@ #include "base/stl_util.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/chromeos/arc/arc_util.h" +#include "chrome/browser/chromeos/crosapi/browser_util.h" #include "chrome/browser/chromeos/crostini/crostini_features.h" #include "chrome/browser/chromeos/crostini/crostini_shelf_utils.h" #include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h" @@ -595,6 +596,9 @@ ash::ShelfID AppServiceAppWindowLauncherController::GetShelfId( aura::Window* window) const { + if (crosapi::browser_util::IsLacrosWindow(window)) + return ash::ShelfID(extension_misc::kLacrosAppId); + if (crostini_tracker_) { std::string shelf_app_id; shelf_app_id = crostini_tracker_->GetShelfAppId(window);
diff --git a/chrome/browser/ui/ash/login_screen_client.cc b/chrome/browser/ui/ash/login_screen_client.cc index 49f4cca..2adc1562 100644 --- a/chrome/browser/ui/ash/login_screen_client.cc +++ b/chrome/browser/ui/ash/login_screen_client.cc
@@ -176,7 +176,7 @@ supervised_action)) { // Show the client native parent access widget and processed to GAIA signin // flow in |OnParentAccessValidation| when validation success. - ash::LoginScreen::Get()->ShowParentAccessWidget( + ash::ParentAccessController::Get()->ShowWidget( prefilled_account, base::BindOnce(&LoginScreenClient::OnParentAccessValidation, weak_ptr_factory_.GetWeakPtr(), prefilled_account),
diff --git a/chrome/browser/ui/ash/test_login_screen.cc b/chrome/browser/ui/ash/test_login_screen.cc index 2f19b34..47003fc 100644 --- a/chrome/browser/ui/ash/test_login_screen.cc +++ b/chrome/browser/ui/ash/test_login_screen.cc
@@ -47,13 +47,6 @@ void TestLoginScreen::ShowParentAccessButton(bool show) {} -void TestLoginScreen::ShowParentAccessWidget( - const AccountId& child_account_id, - base::OnceCallback<void(bool success)> callback, - ash::SupervisedAction action, - bool extra_dimmer, - base::Time validation_time) {} - void TestLoginScreen::SetAllowLoginAsGuest(bool allow_guest) {} std::unique_ptr<ash::ScopedGuestButtonBlocker>
diff --git a/chrome/browser/ui/ash/test_login_screen.h b/chrome/browser/ui/ash/test_login_screen.h index 383aabf..ddb6e32 100644 --- a/chrome/browser/ui/ash/test_login_screen.h +++ b/chrome/browser/ui/ash/test_login_screen.h
@@ -35,11 +35,6 @@ void EnableShutdownButton(bool enable) override; void ShowGuestButtonInOobe(bool show) override; void ShowParentAccessButton(bool show) override; - void ShowParentAccessWidget(const AccountId& child_account_id, - base::OnceCallback<void(bool success)> callback, - ash::SupervisedAction action, - bool extra_dimmer, - base::Time validation_time) override; void SetAllowLoginAsGuest(bool allow_guest) override; std::unique_ptr<ash::ScopedGuestButtonBlocker> GetScopedGuestButtonBlocker() override;
diff --git a/chrome/browser/ui/commander/fuzzy_finder.cc b/chrome/browser/ui/commander/fuzzy_finder.cc index 9aba2cf5..9e12b1f 100644 --- a/chrome/browser/ui/commander/fuzzy_finder.cc +++ b/chrome/browser/ui/commander/fuzzy_finder.cc
@@ -5,6 +5,136 @@ #include "chrome/browser/ui/commander/fuzzy_finder.h" #include "base/i18n/case_conversion.h" +#include "base/i18n/char_iterator.h" +#include "base/strings/string_util.h" + +namespace { +// Used only for exact matches. +static const double kMaxScore = 1.0; +// When needle is a prefix of haystack. +static const double kPrefixScore = .99; +// When a heuristic determines that the match should score highly, +// but it is *not* an exact match or prefix. +static const double kVeryHighScore = .95; + +struct MatchRecord { + MatchRecord(int start, int end, bool is_boundary, int gap_before) + : range(start, end), gap_before(gap_before), is_boundary(is_boundary) {} + gfx::Range range; + int gap_before; + bool is_boundary; +}; + +// Scores matches identified by ConsecutiveMatchWithGaps(). See that comment +// for details. +double ScoreForMatches(const std::vector<MatchRecord>& matches, + size_t needle_size, + size_t haystack_size) { + // |base_score| is the maximum per match, so total should not exceed 1.0. + const double base_score = 1.0 / needle_size; + const double gap_penalty = 1.0 / haystack_size; + static const double kRegularMultiplier = .5; + static const double kWordBoundaryMultiplier = .8; + static const double kInitialMultiplier = 1.0; + double score = 0; + + for (size_t i = 0; i < matches.size(); i++) { + MatchRecord match = matches[i]; + // The first character of the match is special; it gets a relative bonus + // if it is on a boundary. Otherwise, it is penalized by the distance + // between it and the previous match. + if (match.is_boundary) { + score += + base_score * (i == 0 ? kInitialMultiplier : kWordBoundaryMultiplier); + } else { + double penalty_multiplier = 1 - (gap_penalty * match.gap_before); + DCHECK_GT(penalty_multiplier, 0); + score += base_score * kRegularMultiplier * penalty_multiplier; + } + // ...then the rest of a contiguous match. + score += (match.range.length() - 1) * base_score * kRegularMultiplier; + } + DCHECK(score <= 1.0); + return score; +} + +// Returns a positive score if every code point in |needle| is present in +// |haystack| in the same order. The match *need not* be contiguous. Matches in +// special positions are given extra weight, and noncontiguous matches are +// penalized based on the size of the gaps between. +// This is not guaranteed to return the best possible match; for example, given +// needle = "orange" and haystack = "William of Orange", this function will +// match as "William [o]f O[range]" rather than "William of [Orange]". It's main +// use is to filter nonmatches before a more comprehensive algorithm, and as a +// fallback for when the inputs are too high for a more comprehensive algorithm +// to be performant. +double ConsecutiveMatchWithGaps(const base::string16& needle, + const base::string16& haystack, + std::vector<gfx::Range>* matched_ranges) { + DCHECK(needle == base::i18n::FoldCase(needle)); + DCHECK(haystack == base::i18n::FoldCase(haystack)); + DCHECK(matched_ranges->empty()); + // Special case for prefix. + if (base::StartsWith(haystack, needle)) { + matched_ranges->emplace_back(0, needle.size()); + return kPrefixScore; + } + base::i18n::UTF16CharIterator n_iter(&needle); + base::i18n::UTF16CharIterator h_iter(&haystack); + + std::vector<MatchRecord> matches; + int gap_size_before_match = 0; + int match_began_on_boundary = true; + bool in_match = false; + int match_start = -1; + + // Find matching ranges. + while (!n_iter.end() && !h_iter.end()) { + if (n_iter.get() == h_iter.get()) { + // There's a match. + if (!in_match) { + // Match start. + in_match = true; + match_start = h_iter.array_pos(); + match_began_on_boundary = + h_iter.start() || + base::IsUnicodeWhitespace(h_iter.PreviousCodePoint()); + } + h_iter.Advance(); + n_iter.Advance(); + } else { + if (in_match) { + DCHECK(match_start != -1); + in_match = false; + matches.emplace_back(match_start, h_iter.array_pos(), + match_began_on_boundary, gap_size_before_match); + gap_size_before_match = 1; + match_start = -1; + } else { + gap_size_before_match++; + } + h_iter.Advance(); + } + } + if (!n_iter.end()) { + // Didn't match all of |needle|. + matched_ranges->clear(); + return 0; + } + if (in_match) { + DCHECK(match_start != -1); + matches.emplace_back(match_start, h_iter.array_pos(), + match_began_on_boundary, gap_size_before_match); + } + for (const MatchRecord& match : matches) { + matched_ranges->push_back(match.range); + } + double score = ScoreForMatches(matches, needle.size(), haystack.size()); + score *= kPrefixScore; // Normalize so that a prefix always wins. + return score; +} + +} // namespace namespace commander { @@ -14,18 +144,75 @@ DCHECK(needle == base::i18n::FoldCase(needle)); matched_ranges->clear(); const base::string16& folded = base::i18n::FoldCase(haystack); - if (folded == needle) { - matched_ranges->emplace_back(0, needle.length()); - return 1.0; - } - size_t substring_position = folded.find(needle); - if (substring_position == std::string::npos) + size_t m = needle.size(); + size_t n = folded.size(); + // Special case 0: M > N. We don't allow skipping anything in |needle|, so + // no match possible. + if (m > n) { return 0; - matched_ranges->emplace_back(substring_position, needle.length()); - if (substring_position == 0) - return .99; - return std::min(1 - static_cast<double>(substring_position) / folded.length(), - 0.01); + } + // Special case 1: M == N. It must be either an exact match, + // or a non-match. + if (m == n) { + if (folded == needle) { + matched_ranges->emplace_back(0, needle.length()); + return kMaxScore; + } else { + return 0; + } + } + // Special case 2: M == 1. Scan through all matches, and return: + // no match -> + // 0 + // prefix match -> + // kPrefixScore + // word boundary match (e.g. needle: j, haystack "Orange [J]uice") -> + // kVeryHighScore + // any other match -> + // Scored based on how far into haystack needle is found, normalized by + // haystack length. + if (m == 1) { + size_t substring_position = folded.find(needle); + while (substring_position != std::string::npos) { + if (substring_position == 0) { + // Prefix match. + matched_ranges->emplace_back(0, 1); + return kPrefixScore; + } else { + wchar_t previous = folded.at(substring_position - 1); + if (base::IsUnicodeWhitespace(previous)) { + // Word boundary. Since we've eliminated prefix by now, this is as + // good as we're going to get, so we can return. + matched_ranges->clear(); + matched_ranges->emplace_back(substring_position, + substring_position + 1); + return kVeryHighScore; + // Internal match. If |matched_ranges| is already populated, we've + // seen another internal match previously, so ignore this one. + } else if (matched_ranges->empty()) { + matched_ranges->emplace_back(substring_position, + substring_position + 1); + } + } + substring_position = folded.find(needle, substring_position + 1); + } + if (matched_ranges->empty()) { + return 0; + } else { + // First internal match. + DCHECK_EQ(matched_ranges->size(), 1u); + double position = static_cast<double>(matched_ranges->back().start()); + return std::min(1 - position / folded.length(), 0.01); + } + } + // This has two purposes: + // 1. If there's no match here, we should bail instead of wasting time on the + // full O(mn) matching algorithm. + // 2. If m * n is too big, we will use this result instead of doing the full + // full O(mn) matching algorithm. + // ***TEMPORARY***: The full algorithm isn't implemented yet, so we will use + // this unconditionally for now. + return ConsecutiveMatchWithGaps(needle, folded, matched_ranges); } } // namespace commander
diff --git a/chrome/browser/ui/commander/fuzzy_finder.h b/chrome/browser/ui/commander/fuzzy_finder.h index 4b01797..0b61576 100644 --- a/chrome/browser/ui/commander/fuzzy_finder.h +++ b/chrome/browser/ui/commander/fuzzy_finder.h
@@ -12,21 +12,15 @@ namespace commander { -// TODO(lgrey): Make this actually fuzzy find. // Returns a score from 0 to 1 based on how well |needle| matches |haystack|. // 0 means no match. |matched_ranges| will be filled with the ranges of // |haystack| that match |needle| so they can be highlighted in the UI; see // comment on commander::CommandItem |matched_ranges| for a worked example. -// *** TEMPORARY *** -// Temporarily, a non-zero match means that |needle| is a substring of -// |haystack|, with a penalty applied based on how far into |haystack| -// |needle| begins. Exact matches are 1.0 (vs. a max of .99 for non-exact -// prefix). -// This will be replaced with a more sophisticated implementation in the -// near future. -// *** END TEMPORARY *** // |needle| is expected to already be case folded (this is DCHECKED) to save -// redundant processing, as the needle will be checked with many haystacks. +// redundant processing, as one needle will be checked against many haystacks. +// TODO(lgrey): This currently uses an algorithm which is not guaranteed to +// return the optimal match. Update this to use a more comprehensive method +// when inputs are small enough. double FuzzyFind(const base::string16& needle, const base::string16& haystack, std::vector<gfx::Range>* matched_ranges);
diff --git a/chrome/browser/ui/commander/fuzzy_finder_unittest.cc b/chrome/browser/ui/commander/fuzzy_finder_unittest.cc index 362aa4f..6536cf0 100644 --- a/chrome/browser/ui/commander/fuzzy_finder_unittest.cc +++ b/chrome/browser/ui/commander/fuzzy_finder_unittest.cc
@@ -26,6 +26,44 @@ EXPECT_EQ(ranges, std::vector<gfx::Range>({{0, 6}})); } +// This ensures coverage for a fast path. Successful match is +// tested in ExactMatchIsOne() above. +TEST(CommanderFuzzyFinder, NeedleHaystackSameLength) { + std::vector<gfx::Range> ranges; + EXPECT_EQ(0, FuzzyFind(base::ASCIIToUTF16("ranges"), + base::ASCIIToUTF16("orange"), &ranges)); + EXPECT_TRUE(ranges.empty()); +} + +// This ensures coverage for a fast path (just making sure the path has +// coverage rather than ensuring the path is taken). +TEST(CommanderFuzzyFinder, SingleCharNeedle) { + std::vector<gfx::Range> ranges; + + double prefix_score = + FuzzyFind(base::ASCIIToUTF16("o"), base::ASCIIToUTF16("orange"), &ranges); + EXPECT_EQ(ranges, std::vector<gfx::Range>({{0, 1}})); + double internal_score = + FuzzyFind(base::ASCIIToUTF16("o"), base::ASCIIToUTF16("phone"), &ranges); + EXPECT_EQ(ranges, std::vector<gfx::Range>({{2, 3}})); + double boundary_score = FuzzyFind( + base::ASCIIToUTF16("o"), base::ASCIIToUTF16("phone operator"), &ranges); + EXPECT_EQ(ranges, std::vector<gfx::Range>({{6, 7}})); + + // Expected ordering: + // - Prefix should rank highest. + // - Word boundary matches that are not the prefix should rank next + // highest, even if there's an internal match earlier in the haystack. + // - Internal matches should rank lowest. + EXPECT_GT(prefix_score, boundary_score); + EXPECT_GT(boundary_score, internal_score); + + // ...and non-matches should have score = 0. + EXPECT_EQ(0, FuzzyFind(base::ASCIIToUTF16("o"), + base::ASCIIToUTF16("aquarium"), &ranges)); + EXPECT_TRUE(ranges.empty()); +} + TEST(CommanderFuzzyFinder, CaseInsensitive) { std::vector<gfx::Range> ranges; EXPECT_EQ(1, FuzzyFind(base::ASCIIToUTF16("orange"), @@ -38,12 +76,9 @@ double prefix_rank = FuzzyFind(base::ASCIIToUTF16("orange"), base::ASCIIToUTF16("Orange juice"), &ranges); - EXPECT_EQ(ranges, std::vector<gfx::Range>({{0, 6}})); - double non_prefix_rank = FuzzyFind(base::ASCIIToUTF16("orange"), base::ASCIIToUTF16("William of Orange"), &ranges); - EXPECT_EQ(ranges, std::vector<gfx::Range>({{11, 6}})); EXPECT_GT(prefix_rank, 0); EXPECT_GT(non_prefix_rank, 0); @@ -51,4 +86,20 @@ EXPECT_LT(non_prefix_rank, 1); EXPECT_GT(prefix_rank, non_prefix_rank); } + +TEST(CommanderFuzzyFinder, NeedleLongerThanHaystack) { + std::vector<gfx::Range> ranges; + EXPECT_EQ(0, FuzzyFind(base::ASCIIToUTF16("orange juice"), + base::ASCIIToUTF16("orange"), &ranges)); + EXPECT_TRUE(ranges.empty()); +} + +TEST(CommanderFuzzyFinder, Noncontiguous) { + std::vector<gfx::Range> ranges; + EXPECT_GT(FuzzyFind(base::ASCIIToUTF16("tuot"), + base::UTF8ToUTF16("Tlön, Uqbar, Orbis Tertius"), &ranges), + 0); + EXPECT_EQ(ranges, + std::vector<gfx::Range>({{0, 1}, {6, 7}, {13, 14}, {19, 20}})); +} } // namespace commander
diff --git a/chrome/browser/ui/global_media_controls/presentation_request_notification_item.cc b/chrome/browser/ui/global_media_controls/presentation_request_notification_item.cc index 2c72f47..99668ed 100644 --- a/chrome/browser/ui/global_media_controls/presentation_request_notification_item.cc +++ b/chrome/browser/ui/global_media_controls/presentation_request_notification_item.cc
@@ -4,22 +4,19 @@ #include "chrome/browser/ui/global_media_controls/presentation_request_notification_item.h" -#include <utility> - +#include "base/unguessable_token.h" #include "chrome/browser/media/router/presentation/presentation_service_delegate_impl.h" #include "chrome/browser/ui/global_media_controls/media_notification_service.h" PresentationRequestNotificationItem::PresentationRequestNotificationItem( - const std::string& id, MediaNotificationService* notification_service, const content::PresentationRequest& request, std::unique_ptr<media_router::StartPresentationContext> context) - : id_(id), + : id_(base::UnguessableToken::Create().ToString()), notification_service_(notification_service), context_(std::move(context)) { // TODO(jrw): Save a copy of |request| once it is actually used. DCHECK(!context || request == context->presentation_request()); - notification_service_->ShowNotification(id_); } PresentationRequestNotificationItem::~PresentationRequestNotificationItem() {
diff --git a/chrome/browser/ui/global_media_controls/presentation_request_notification_item.h b/chrome/browser/ui/global_media_controls/presentation_request_notification_item.h index dd097b98..4a7b01f2 100644 --- a/chrome/browser/ui/global_media_controls/presentation_request_notification_item.h +++ b/chrome/browser/ui/global_media_controls/presentation_request_notification_item.h
@@ -23,7 +23,6 @@ : public media_message_center::MediaNotificationItem { public: PresentationRequestNotificationItem( - const std::string& id, MediaNotificationService* notification_service, const content::PresentationRequest& request, std::unique_ptr<media_router::StartPresentationContext> context);
diff --git a/chrome/browser/ui/global_media_controls/presentation_request_notification_provider.cc b/chrome/browser/ui/global_media_controls/presentation_request_notification_provider.cc index 0afdd4f3..61260c8 100644 --- a/chrome/browser/ui/global_media_controls/presentation_request_notification_provider.cc +++ b/chrome/browser/ui/global_media_controls/presentation_request_notification_provider.cc
@@ -6,7 +6,6 @@ #include <utility> -#include "base/unguessable_token.h" #include "chrome/browser/media/router/media_router.h" #include "chrome/browser/media/router/media_router_factory.h" #include "chrome/browser/media/router/presentation/presentation_service_delegate_impl.h" @@ -137,6 +136,6 @@ std::unique_ptr<media_router::StartPresentationContext> context) { // This may replace an existing item, which is the right thing to do if we've // reached this point. - item_.emplace(base::UnguessableToken().ToString(), notification_service_, - request, std::move(context)); + item_.emplace(notification_service_, request, std::move(context)); + notification_service_->ShowNotification(item_->id()); }
diff --git a/chrome/browser/ui/views/accessibility/caption_bubble.cc b/chrome/browser/ui/views/accessibility/caption_bubble.cc index cabc3ff3..0491581 100644 --- a/chrome/browser/ui/views/accessibility/caption_bubble.cc +++ b/chrome/browser/ui/views/accessibility/caption_bubble.cc
@@ -324,6 +324,12 @@ // set the truncate_length to 0 to ensure that it never truncates. label->SetTruncateLength(0); + auto title = std::make_unique<views::Label>(); + title->SetEnabledColor(gfx::kGoogleGrey500); + title->SetBackgroundColor(SK_ColorTRANSPARENT); + title->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT); + title->SetText(l10n_util::GetStringUTF16(IDS_LIVE_CAPTION_BUBBLE_TITLE)); + auto error_text = std::make_unique<views::Label>(); error_text->SetEnabledColor(SK_ColorWHITE); error_text->SetBackgroundColor(SK_ColorTRANSPARENT); @@ -353,6 +359,7 @@ auto close_button = BuildImageButton(vector_icons::kCloseRoundedIcon, IDS_LIVE_CAPTION_BUBBLE_CLOSE); + title_ = content_container->AddChildView(std::move(title)); label_ = content_container->AddChildView(std::move(label)); error_icon_ = error_message->AddChildView(std::move(error_icon)); @@ -466,12 +473,10 @@ node_data->SetName(model_->GetFullText()); node_data->SetNameFrom(ax::mojom::NameFrom::kContents); } else { - node_data->SetName( - l10n_util::GetStringUTF16(IDS_LIVE_CAPTION_BUBBLE_ACCESSIBLE_NAME)); + node_data->SetName(title_->GetText()); node_data->SetNameFrom(ax::mojom::NameFrom::kContents); } - node_data->SetDescription( - l10n_util::GetStringUTF16(IDS_LIVE_CAPTION_BUBBLE_ACCESSIBLE_NAME)); + node_data->SetDescription(title_->GetText()); node_data->role = ax::mojom::Role::kCaption; } @@ -520,7 +525,7 @@ void CaptionBubble::OnTextChanged() { DCHECK(model_); label_->SetText(base::UTF8ToUTF16(model_->GetFullText())); - UpdateBubbleVisibility(); + UpdateBubbleAndTitleVisibility(); } void CaptionBubble::OnErrorChanged() { @@ -542,6 +547,14 @@ Redraw(); } +void CaptionBubble::UpdateBubbleAndTitleVisibility() { + // Show the title if there is room for it and no error. + title_->SetVisible(model_ && !model_->HasError() && + GetNumLinesInLabel() < + static_cast<size_t>(GetNumLinesVisible())); + UpdateBubbleVisibility(); +} + void CaptionBubble::UpdateBubbleVisibility() { DCHECK(GetWidget()); if (!model_) { @@ -603,9 +616,11 @@ gfx::Font::FontStyle::NORMAL, kFontSizePx * textScaleFactor, gfx::Font::Weight::NORMAL); label_->SetFontList(font_list); + title_->SetFontList(font_list); error_text_->SetFontList(font_list); label_->SetLineHeight(kLineHeightDip * textScaleFactor); + title_->SetLineHeight(kLineHeightDip * textScaleFactor); error_text_->SetLineHeight(kLineHeightDip * textScaleFactor); error_icon_->SetImageSize(gfx::Size(kErrorImageSizeDip * textScaleFactor, kErrorImageSizeDip * textScaleFactor)); @@ -617,8 +632,12 @@ (model_ && model_->HasError()) ? kLineHeightDip * text_scale_factor : kLineHeightDip * GetNumLinesVisible() * text_scale_factor; + // The title takes up 1 line. + int label_height = title_->GetVisible() + ? content_height - kLineHeightDip * text_scale_factor + : content_height; label_->SetPreferredSize( - gfx::Size(kMaxWidthDip - kSidePaddingDip, content_height)); + gfx::Size(kMaxWidthDip - kSidePaddingDip, label_height)); content_container_->SetPreferredSize(gfx::Size(kMaxWidthDip, content_height)); SetPreferredSize( gfx::Size(kMaxWidthDip, content_height + @@ -627,7 +646,7 @@ } void CaptionBubble::Redraw() { - UpdateBubbleVisibility(); + UpdateBubbleAndTitleVisibility(); UpdateContentSize(); SizeToContents(); }
diff --git a/chrome/browser/ui/views/accessibility/caption_bubble.h b/chrome/browser/ui/views/accessibility/caption_bubble.h index a123083..0f8d6dc5 100644 --- a/chrome/browser/ui/views/accessibility/caption_bubble.h +++ b/chrome/browser/ui/views/accessibility/caption_bubble.h
@@ -112,6 +112,8 @@ // The caption bubble manages its own visibility based on whether there's // space for it to be shown, and if it has an error or text to display. void UpdateBubbleVisibility(); + void UpdateBubbleAndTitleVisibility(); + double GetTextScaleFactor(); int GetNumLinesVisible(); void UpdateTextSize(); @@ -123,6 +125,7 @@ // Unowned. Owned by views hierarchy. views::Label* label_; + views::Label* title_; views::Label* error_text_; views::ImageView* error_icon_; views::View* error_message_;
diff --git a/chrome/browser/ui/views/accessibility/caption_bubble_controller_views_browsertest.cc b/chrome/browser/ui/views/accessibility/caption_bubble_controller_views_browsertest.cc index 46ad8e7..cd5c6ff 100644 --- a/chrome/browser/ui/views/accessibility/caption_bubble_controller_views_browsertest.cc +++ b/chrome/browser/ui/views/accessibility/caption_bubble_controller_views_browsertest.cc
@@ -61,6 +61,10 @@ return controller_ ? controller_->caption_bubble_->label_ : nullptr; } + views::Label* GetTitle() { + return controller_ ? controller_->caption_bubble_->title_ : nullptr; + } + views::Button* GetCloseButton() { return controller_ ? controller_->caption_bubble_->close_button_ : nullptr; } @@ -156,10 +160,10 @@ OnPartialTranscription("Taylor"); EXPECT_TRUE(IsWidgetVisible()); EXPECT_EQ("Taylor", GetLabelText()); - OnPartialTranscription( - "Taylor Alison Swift (born December 13, " - "1989)"); - EXPECT_EQ("Taylor Alison Swift (born December 13, 1989)", GetLabelText()); + EXPECT_TRUE(GetTitle()->GetVisible()); + OnPartialTranscription("Taylor Alison Swift\n(born December 13, 1989)"); + EXPECT_EQ("Taylor Alison Swift\n(born December 13, 1989)", GetLabelText()); + EXPECT_FALSE(GetTitle()->GetVisible()); // Hides the bubble when set to the empty string. OnPartialTranscription(""); @@ -206,6 +210,27 @@ EXPECT_EQ(bubble_width, bubble_bounds.width()); } +IN_PROC_BROWSER_TEST_F(CaptionBubbleControllerViewsTest, + CaptionTitleShownAtFirst) { + // With one line of text, the title is visible and positioned between the + // top of the bubble and top of the label. + OnPartialTranscription("Cats rock"); + EXPECT_TRUE(GetTitle()->GetVisible()); + EXPECT_EQ(GetTitle()->GetBoundsInScreen().bottom(), + GetLabel()->GetBoundsInScreen().y()); + + OnPartialTranscription("Cats rock\nDogs too"); + EXPECT_FALSE(GetTitle()->GetVisible()); + + OnPartialTranscription( + "Taylor Alison Swift (born December 13, 1989) is an American " + "singer-songwriter. She is known for narrative songs about her personal " + "life, which have received widespread media coverage. At age 14, Swift " + "became the youngest artist signed by the Sony/ATV Music publishing " + "house and, at age 15, she signed her first record deal."); + EXPECT_FALSE(GetTitle()->GetVisible()); +} + IN_PROC_BROWSER_TEST_F(CaptionBubbleControllerViewsTest, BubblePositioning) { int bubble_width = 536; gfx::Insets bubble_margins(6); @@ -342,15 +367,18 @@ IN_PROC_BROWSER_TEST_F(CaptionBubbleControllerViewsTest, ShowsAndHidesError) { OnPartialTranscription("Elephants' trunks average 6 feet long."); + EXPECT_TRUE(GetTitle()->GetVisible()); EXPECT_TRUE(GetLabel()->GetVisible()); EXPECT_FALSE(GetErrorMessage()->GetVisible()); OnError(0); + EXPECT_FALSE(GetTitle()->GetVisible()); EXPECT_FALSE(GetLabel()->GetVisible()); EXPECT_TRUE(GetErrorMessage()->GetVisible()); // Setting text during an error shouldn't cause the error to disappear. OnPartialTranscription("Elephant tails average 4-5 feet long."); + EXPECT_FALSE(GetTitle()->GetVisible()); EXPECT_FALSE(GetLabel()->GetVisible()); EXPECT_TRUE(GetErrorMessage()->GetVisible()); @@ -358,11 +386,13 @@ InsertNewTab(); ActivateTabAt(1); OnPartialTranscription("Elephants are vegetarians."); + EXPECT_TRUE(GetTitle()->GetVisible()); EXPECT_TRUE(GetLabel()->GetVisible()); EXPECT_FALSE(GetErrorMessage()->GetVisible()); // The error should still be visible when switching back to the tab. ActivateTabAt(0); + EXPECT_FALSE(GetTitle()->GetVisible()); EXPECT_FALSE(GetLabel()->GetVisible()); EXPECT_TRUE(GetErrorMessage()->GetVisible()); @@ -371,6 +401,7 @@ content::WaitForLoadStop( browser()->tab_strip_model()->GetActiveWebContents()); OnPartialTranscription("Elephants can communicate through seismic signals."); + EXPECT_TRUE(GetTitle()->GetVisible()); EXPECT_TRUE(GetLabel()->GetVisible()); EXPECT_FALSE(GetErrorMessage()->GetVisible()); } @@ -392,7 +423,8 @@ IN_PROC_BROWSER_TEST_F(CaptionBubbleControllerViewsTest, MovesWithArrowsWhenFocused) { - OnPartialTranscription("Nearly all ants are female."); + OnPartialTranscription( + "Honeybees have tiny hairs on their eyes to help them collect pollen"); // Not focused initially. EXPECT_FALSE(GetBubble()->HasFocus()); @@ -509,7 +541,9 @@ GetController()->UpdateCaptionStyle(base::nullopt); OnPartialTranscription("Hamsters' teeth never stop growing"); EXPECT_EQ(textSize, GetLabel()->font_list().GetFontSize()); + EXPECT_EQ(textSize, GetTitle()->font_list().GetFontSize()); EXPECT_EQ(lineHeight, GetLabel()->GetLineHeight()); + EXPECT_EQ(lineHeight, GetTitle()->GetLineHeight()); EXPECT_GT(GetBubble()->GetPreferredSize().height(), bubbleHeight); // Set the text size to 200%. @@ -517,34 +551,44 @@ caption_style.text_size = "200%"; GetController()->UpdateCaptionStyle(caption_style); EXPECT_EQ(textSize * 2, GetLabel()->font_list().GetFontSize()); + EXPECT_EQ(textSize * 2, GetTitle()->font_list().GetFontSize()); EXPECT_EQ(lineHeight * 2, GetLabel()->GetLineHeight()); + EXPECT_EQ(lineHeight * 2, GetTitle()->GetLineHeight()); EXPECT_GT(GetBubble()->GetPreferredSize().height(), bubbleHeight * 2); // Set the text size to the empty string. caption_style.text_size = ""; GetController()->UpdateCaptionStyle(caption_style); EXPECT_EQ(textSize, GetLabel()->font_list().GetFontSize()); + EXPECT_EQ(textSize, GetTitle()->font_list().GetFontSize()); EXPECT_EQ(lineHeight, GetLabel()->GetLineHeight()); + EXPECT_EQ(lineHeight, GetTitle()->GetLineHeight()); EXPECT_GT(GetBubble()->GetPreferredSize().height(), bubbleHeight); // Set the text size to 50% !important. caption_style.text_size = "50% !important"; GetController()->UpdateCaptionStyle(caption_style); EXPECT_EQ(textSize / 2, GetLabel()->font_list().GetFontSize()); + EXPECT_EQ(textSize / 2, GetTitle()->font_list().GetFontSize()); EXPECT_EQ(lineHeight / 2, GetLabel()->GetLineHeight()); + EXPECT_EQ(lineHeight / 2, GetTitle()->GetLineHeight()); EXPECT_GT(GetBubble()->GetPreferredSize().height(), bubbleHeight / 2); // Set the text size to a bad string. caption_style.text_size = "Ostriches can run up to 45mph"; GetController()->UpdateCaptionStyle(caption_style); EXPECT_EQ(textSize, GetLabel()->font_list().GetFontSize()); + EXPECT_EQ(textSize, GetTitle()->font_list().GetFontSize()); EXPECT_EQ(lineHeight, GetLabel()->GetLineHeight()); + EXPECT_EQ(lineHeight, GetTitle()->GetLineHeight()); EXPECT_GT(GetBubble()->GetPreferredSize().height(), bubbleHeight); // Set the caption style to nullopt. GetController()->UpdateCaptionStyle(base::nullopt); EXPECT_EQ(textSize, GetLabel()->font_list().GetFontSize()); + EXPECT_EQ(textSize, GetTitle()->font_list().GetFontSize()); EXPECT_EQ(lineHeight, GetLabel()->GetLineHeight()); + EXPECT_EQ(lineHeight, GetTitle()->GetLineHeight()); EXPECT_GT(GetBubble()->GetPreferredSize().height(), bubbleHeight); // Set the error message. @@ -796,28 +840,27 @@ OnPartialTranscription("Seahorses are monogamous"); EXPECT_TRUE(GetExpandButton()->GetVisible()); EXPECT_FALSE(GetCollapseButton()->GetVisible()); - EXPECT_EQ(2 * line_height, GetLabel()->GetBoundsInScreen().height()); + EXPECT_EQ(line_height, GetLabel()->GetBoundsInScreen().height()); ClickButton(GetExpandButton()); EXPECT_TRUE(GetCollapseButton()->GetVisible()); EXPECT_FALSE(GetExpandButton()->GetVisible()); - EXPECT_EQ(8 * line_height, GetLabel()->GetBoundsInScreen().height()); + EXPECT_EQ(7 * line_height, GetLabel()->GetBoundsInScreen().height()); // Switch tabs. The bubble should remain expanded. InsertNewTab(); ActivateTabAt(1); EXPECT_FALSE(IsWidgetVisible()); - OnPartialTranscription( - "Honeybees have tiny hairs on their eyes to help them collect pollen"); + OnPartialTranscription("Nearly all ants are female."); EXPECT_TRUE(GetCollapseButton()->GetVisible()); EXPECT_FALSE(GetExpandButton()->GetVisible()); - EXPECT_EQ(8 * line_height, GetLabel()->GetBoundsInScreen().height()); + EXPECT_EQ(7 * line_height, GetLabel()->GetBoundsInScreen().height()); ClickButton(GetCollapseButton()); EXPECT_TRUE(GetExpandButton()->GetVisible()); EXPECT_FALSE(GetCollapseButton()->GetVisible()); - EXPECT_EQ(2 * line_height, GetLabel()->GetBoundsInScreen().height()); + EXPECT_EQ(line_height, GetLabel()->GetBoundsInScreen().height()); } IN_PROC_BROWSER_TEST_F(CaptionBubbleControllerViewsTest, NonAsciiCharacter) {
diff --git a/chrome/browser/ui/views/chrome_typography.cc b/chrome/browser/ui/views/chrome_typography.cc index 71e8206..1b90797 100644 --- a/chrome/browser/ui/views/chrome_typography.cc +++ b/chrome/browser/ui/views/chrome_typography.cc
@@ -66,7 +66,7 @@ *size_delta = GetFontSizeDeltaBoundedByAvailableHeight(height, height); break; } - case CONTEXT_WEB_UI_TAB_COUNTER: { + case CONTEXT_TAB_COUNTER: { *size_delta = GetFontSizeDeltaIgnoringUserOrLocaleSettings(14); *weight = gfx::Font::Weight::BOLD; break;
diff --git a/chrome/browser/ui/views/chrome_typography.h b/chrome/browser/ui/views/chrome_typography.h index 2a53405..b01bcb6f 100644 --- a/chrome/browser/ui/views/chrome_typography.h +++ b/chrome/browser/ui/views/chrome_typography.h
@@ -31,8 +31,8 @@ // Text of the page title in the tab hover card. CONTEXT_TAB_HOVER_CARD_TITLE, - // Text of the number of tabs in the webui tab counter. - CONTEXT_WEB_UI_TAB_COUNTER, + // Text of the number of tabs in the tab counter used in tablet mode. + CONTEXT_TAB_COUNTER, // Text in the location bar entry, and primary text in the omnibox dropdown. CONTEXT_OMNIBOX_PRIMARY,
diff --git a/chrome/browser/ui/views/chrome_typography_provider.cc b/chrome/browser/ui/views/chrome_typography_provider.cc index 4ddd43b9..0b2628e 100644 --- a/chrome/browser/ui/views/chrome_typography_provider.cc +++ b/chrome/browser/ui/views/chrome_typography_provider.cc
@@ -76,6 +76,18 @@ font_weight = gfx::Font::Weight::SEMIBOLD; } + if (context == CONTEXT_TAB_COUNTER && + style == views::style::STYLE_SECONDARY) { + // Secondary font is for double-digit counts. Because we have control over + // system fonts on ChromeOS, we can just choose a condensed font. For other + // platforms we adjust size. +#if defined(OS_CHROMEOS) + typeface = "Roboto Condensed"; +#else + size_delta -= 2; +#endif + } + if (style == STYLE_EMPHASIZED || style == STYLE_EMPHASIZED_SECONDARY) { // Limit emphasizing text to contexts where it's obviously correct. If you // hit this DCHECK, ensure it's sane and UX-approved to extend it to your
diff --git a/chrome/browser/ui/views/commander_frontend_views.cc b/chrome/browser/ui/views/commander_frontend_views.cc index df6bcea..7eac887 100644 --- a/chrome/browser/ui/views/commander_frontend_views.cc +++ b/chrome/browser/ui/views/commander_frontend_views.cc
@@ -11,13 +11,13 @@ #include "chrome/browser/ui/commander/commander_view_model.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/theme_copying_widget.h" +#include "chrome/browser/ui/webui/commander/commander_ui.h" +#include "chrome/common/webui_url_constants.h" #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" #include "ui/views/controls/webview/webview.h" #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" -#include "base/debug/stack_trace.h" - namespace { // TODO(lgrey): Temporary constexpr gfx::Size kDefaultSize(400, 30); @@ -98,6 +98,11 @@ web_view_->set_owner(parent); web_view_->SetSize(kDefaultSize); + web_view_->LoadInitialURL(GURL(chrome::kChromeUICommanderURL)); + CommanderUI* controller = static_cast<CommanderUI*>( + web_view_->GetWebContents()->GetWebUI()->GetController()); + controller->handler()->set_delegate(this); + web_view_ptr_ = widget_->SetContentsView(std::move(web_view_)); widget_->CenterWindow(kDefaultSize); @@ -145,6 +150,10 @@ web_view_ptr_->SetSize(size); } +void CommanderFrontendViews::OnHandlerEnabled(bool is_enabled) { + is_handler_enabled_ = is_enabled; +} + void CommanderFrontendViews::OnViewModelUpdated( commander::CommanderViewModel view_model) { DCHECK(is_showing()); @@ -152,6 +161,13 @@ Hide(); return; } + if (!is_handler_enabled_) + // TODO(lgrey): Think through whether it makes sense to stash the view model + // and send it when the handler becomes available again. + return; + CommanderUI* controller = static_cast<CommanderUI*>( + web_view_->GetWebContents()->GetWebUI()->GetController()); + controller->handler()->ViewModelUpdated(std::move(view_model)); // TODO(lgrey): Pass view model to WebUI. }
diff --git a/chrome/browser/ui/views/commander_frontend_views.h b/chrome/browser/ui/views/commander_frontend_views.h index 08d3586..7a096ede 100644 --- a/chrome/browser/ui/views/commander_frontend_views.h +++ b/chrome/browser/ui/views/commander_frontend_views.h
@@ -11,6 +11,7 @@ #include "base/memory/weak_ptr.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/webui/commander/commander_handler.h" class CommanderWebView; @@ -28,7 +29,8 @@ // this class is responsible for setting up the infrastructure to host the // WebUI in its own widget and mediating between the WebUI implementation and // the controller. -class CommanderFrontendViews : public commander::CommanderFrontend { +class CommanderFrontendViews : public commander::CommanderFrontend, + public CommanderHandler::Delegate { public: explicit CommanderFrontendViews(commander::CommanderBackend* backend); ~CommanderFrontendViews() override; @@ -37,17 +39,12 @@ void Show(Browser* browser) override; void Hide() override; - // TODO(lgrey): When the WebUI layer is added, these declarations should - // be moved to the CommanderHandler::Delegate interface. - // Called when the text is changed in the WebUI interface. - void OnTextChanged(const base::string16& text); - // Called when an option is selected (clicked or enter pressed) in the WebUI - // interface. - void OnOptionSelected(size_t option_index, int result_set_id); - // Called when the WebUI interface wants to dismiss the UI. - void OnDismiss(); - // Called when the WebUI interface's content height has changed. - void OnHeightChanged(int new_height); + // CommanderHandler::Delegate overrides; + void OnTextChanged(const base::string16& text) override; + void OnOptionSelected(size_t option_index, int result_set_id) override; + void OnDismiss() override; + void OnHeightChanged(int new_height) override; + void OnHandlerEnabled(bool is_enabled) override; private: // Receives view model updates from |backend_|. @@ -83,7 +80,8 @@ std::unique_ptr<CommanderWebView> web_view_; // The browser |widget_| is attached to. Browser* browser_; - + // Whether the web UI interface is loaded and ready to accept view models. + bool is_handler_enabled_ = false; base::WeakPtrFactory<CommanderFrontendViews> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc index 3a9f287..b72dc7d 100644 --- a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc +++ b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc
@@ -13,6 +13,7 @@ #include "ui/views/controls/button/checkbox.h" #include "ui/views/controls/tabbed_pane/tabbed_pane.h" #include "ui/views/controls/table/table_view.h" +#include "ui/views/controls/table/table_view_observer.h" namespace { @@ -57,6 +58,9 @@ // within a larger view would be breakage-prone; just ask the TableView to // to select. GetTableView()->Select(index); + if (double_click) { + GetTableView()->observer()->OnDoubleClick(); + } } }
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_unittest.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_unittest.cc index 4e4017d..df0462e 100644 --- a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_unittest.cc +++ b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_unittest.cc
@@ -12,6 +12,8 @@ #include "base/command_line.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" +#include "base/task/post_task.h" +#include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "chrome/browser/media/webrtc/desktop_media_picker_manager.h" #include "chrome/browser/media/webrtc/fake_desktop_media_list.h" @@ -200,6 +202,11 @@ test_api_.GetAudioShareCheckbox()->SetChecked(false); test_api_.PressMouseOnSourceAtIndex(0, true); + + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, + run_loop_.QuitClosure()); + run_loop_.Run(); + EXPECT_FALSE(picked_id().has_value()); }
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.cc index c1252d7..5987db8 100644 --- a/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.cc +++ b/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.cc
@@ -91,7 +91,6 @@ explicit TabListViewObserver(DesktopMediaListController* controller); void OnSelectionChanged() override; - void OnDoubleClick() override; void OnKeyDown(ui::KeyboardCode virtual_keycode) override; private: @@ -108,10 +107,6 @@ controller_->OnSourceSelectionChanged(); } -void TabListViewObserver::OnDoubleClick() { - controller_->AcceptSource(); -} - void TabListViewObserver::OnKeyDown(ui::KeyboardCode virtual_keycode) { if (virtual_keycode == ui::VKEY_RETURN) controller_->AcceptSource();
diff --git a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc index 52297cd..9a1dceb 100644 --- a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc +++ b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc
@@ -360,6 +360,10 @@ ~DragToOpenHandler() override { drag_handle_->RemovePreTargetHandler(this); } + // Cancels any current drag. + void CancelDrag() { drag_in_progress_ = false; } + + // ui::EventHandler: void OnGestureEvent(ui::GestureEvent* event) override { switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: { @@ -508,11 +512,12 @@ WebUITabStripContainerView::WebUITabStripContainerView( BrowserView* browser_view, views::View* tab_contents_container, - views::View* drag_handle, + views::View* top_container, views::View* omnibox) : browser_(browser_view->browser()), web_view_(AddChildView( std::make_unique<WebUITabStripWebView>(browser_->profile()))), + top_container_(top_container), tab_contents_container_(tab_contents_container), auto_closer_(std::make_unique<AutoCloser>( base::Bind(&WebUITabStripContainerView::CloseForEventOutsideTabStrip, @@ -521,7 +526,7 @@ tab_contents_container, omnibox)), drag_to_open_handler_( - std::make_unique<DragToOpenHandler>(this, drag_handle)), + std::make_unique<DragToOpenHandler>(this, top_container)), iph_controller_(std::make_unique<IPHController>( browser_, browser_view->feature_promo_controller())) { @@ -559,6 +564,7 @@ DCHECK(tab_contents_container); view_observer_.Add(tab_contents_container_); + view_observer_.Add(top_container_); TabStripUI* const tab_strip_ui = static_cast<TabStripUI*>( web_view_->GetWebContents()->GetWebUI()->GetController()); @@ -879,17 +885,23 @@ } void WebUITabStripContainerView::OnViewBoundsChanged(View* observed_view) { - if (observed_view != tab_contents_container_) - return; + if (observed_view == top_container_) { + if (old_top_container_width_ != top_container_->width()) { + old_top_container_width_ = top_container_->width(); + // If somehow we're in the middle of a drag, abort. + drag_to_open_handler_->CancelDrag(); + CloseContainer(); + } + } else if (observed_view == tab_contents_container_) { + // TODO(pbos): PreferredSizeChanged seems to cause infinite recursion with + // BrowserView::ChildPreferredSizeChanged. InvalidateLayout here should be + // replaceable with PreferredSizeChanged. + InvalidateLayout(); - // TODO(pbos): PreferredSizeChanged seems to cause infinite recursion with - // BrowserView::ChildPreferredSizeChanged. InvalidateLayout here should be - // replaceable with PreferredSizeChanged. - InvalidateLayout(); - - TabStripUI* const tab_strip_ui = static_cast<TabStripUI*>( - web_view_->GetWebContents()->GetWebUI()->GetController()); - tab_strip_ui->LayoutChanged(); + TabStripUI* const tab_strip_ui = static_cast<TabStripUI*>( + web_view_->GetWebContents()->GetWebUI()->GetController()); + tab_strip_ui->LayoutChanged(); + } } void WebUITabStripContainerView::OnViewIsDeleting(View* observed_view) { @@ -899,8 +911,6 @@ tab_counter_ = nullptr; else if (observed_view == tab_contents_container_) tab_contents_container_ = nullptr; - else - NOTREACHED(); } bool WebUITabStripContainerView::SetPaneFocusAndFocusDefault() {
diff --git a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h index 22112d5..83a71b4 100644 --- a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h +++ b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h
@@ -51,7 +51,7 @@ public: WebUITabStripContainerView(BrowserView* browser_view, views::View* tab_contents_container, - views::View* drag_handle, + views::View* top_container, views::View* omnibox); ~WebUITabStripContainerView() override; @@ -137,9 +137,15 @@ Browser* const browser_; views::WebView* const web_view_; + views::View* const top_container_; views::View* tab_contents_container_; views::View* tab_counter_ = nullptr; + // If the user interacts with Windows in a way that changes the width of the + // window, close the top container. This is similar to the auto-close when the + // user touches outside the tabstrip. + int old_top_container_width_ = 0; + base::Optional<float> current_drag_height_; // When opened, if currently open. Used to calculate metric for how
diff --git a/chrome/browser/ui/views/payments/payment_handler_header_view_ui_browsertest.cc b/chrome/browser/ui/views/payments/payment_handler_header_view_ui_browsertest.cc new file mode 100644 index 0000000..9d5f4118 --- /dev/null +++ b/chrome/browser/ui/views/payments/payment_handler_header_view_ui_browsertest.cc
@@ -0,0 +1,83 @@ +// Copyright 2020 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 "base/test/scoped_feature_list.h" +#include "build/build_config.h" +#include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" +#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" +#include "components/autofill/core/browser/autofill_test_utils.h" +#include "components/omnibox/browser/buildflags.h" +#include "components/payments/core/features.h" +#include "content/public/test/browser_test.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace payments { +namespace { + +class PaymentHandlerHeaderViewUITest + : public PaymentRequestBrowserTestBase, + public testing::WithParamInterface<bool> { + public: + PaymentHandlerHeaderViewUITest() { + if (GetParam()) { + features_.InitAndEnableFeature(features::kPaymentHandlerSecurityIcon); + } else { + features_.InitAndDisableFeature(features::kPaymentHandlerSecurityIcon); + } + } + ~PaymentHandlerHeaderViewUITest() override = default; + + void SetUpOnMainThread() override { + PaymentRequestBrowserTestBase::SetUpOnMainThread(); + NavigateTo("/payment_handler.html"); + } + + private: + base::test::ScopedFeatureList features_; +}; + +IN_PROC_BROWSER_TEST_P(PaymentHandlerHeaderViewUITest, + EnablePaymentHandlerSecurityIcon) { + autofill::AutofillProfile profile(autofill::test::GetFullProfile()); + AddAutofillProfile(profile); + autofill::CreditCard card(autofill::test::GetCreditCard()); + card.set_billing_address_id(profile.guid()); + AddCreditCard(card); + + EXPECT_EQ("success", content::EvalJs(GetActiveWebContents(), "install()")); + + ResetEventWaiterForDialogOpened(); + EXPECT_EQ( + "success", + content::EvalJs(GetActiveWebContents(), + "paymentRequestWithOptions({requestShipping: true})")); + WaitForObservedEvent(); + + EXPECT_TRUE(IsPayButtonEnabled()); + EXPECT_FALSE(IsViewVisible(DialogViewID::PAYMENT_APP_OPENED_WINDOW_SHEET)); + + ResetEventWaiterForSequence({DialogEvent::PROCESSING_SPINNER_SHOWN, + DialogEvent::PROCESSING_SPINNER_HIDDEN, + DialogEvent::PAYMENT_HANDLER_WINDOW_OPENED}); + ClickOnDialogViewAndWait(DialogViewID::PAY_BUTTON); + + EXPECT_TRUE(IsViewVisible(DialogViewID::BACK_BUTTON)); + EXPECT_TRUE(IsViewVisible(DialogViewID::PAYMENT_APP_OPENED_WINDOW_SHEET)); + + auto* top = dialog_view()->view_stack_for_testing()->top(); + if (GetParam()) { + EXPECT_NE(nullptr, top->GetViewByID( + static_cast<int>(DialogViewID::SECURITY_ICON_VIEW))); + } else { + EXPECT_EQ(nullptr, top->GetViewByID( + static_cast<int>(DialogViewID::SECURITY_ICON_VIEW))); + } + NavigateTo("/payment_handler.html"); +} + +// Run all tests with both values for +// features::kPaymentHandlerSecurityIcon +INSTANTIATE_TEST_SUITE_P(All, PaymentHandlerHeaderViewUITest, testing::Bool()); +} // namespace +} // namespace payments
diff --git a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc index 7cd2eb1f..336ed228 100644 --- a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc +++ b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc
@@ -10,14 +10,21 @@ #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/payments/ssl_validity_checker.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/omnibox/omnibox_theme.h" #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" #include "chrome/browser/ui/views/payments/payment_request_views_util.h" #include "chrome/grit/generated_resources.h" +#include "components/omnibox/browser/location_bar_model_util.h" #include "components/payments/content/icon/icon_size.h" +#include "components/payments/core/features.h" #include "components/payments/core/native_error_strings.h" +#include "components/payments/core/payments_experimental_features.h" #include "components/payments/core/url_util.h" +#include "components/security_state/core/security_state.h" +#include "components/vector_icons/vector_icons.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" #include "content/public/browser/navigation_handle.h" @@ -29,6 +36,7 @@ #include "ui/gfx/color_palette.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/image/image_skia.h" +#include "ui/gfx/paint_vector_icon.h" #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/controls/image_view.h" @@ -63,6 +71,8 @@ ReadOnlyOriginView(const base::string16& page_title, const GURL& origin, const SkBitmap* icon_bitmap, + Profile* profile, + security_state::SecurityLevel security_level, SkColor background_color, views::ButtonListener* site_settings_listener) { auto title_origin_container = std::make_unique<views::View>(); @@ -90,8 +100,28 @@ title_label->SetEnabledColor(foreground); } - title_origin_layout->StartRow(views::GridLayout::kFixedSize, 0); - auto* origin_label = title_origin_layout->AddView( + auto origin_container = std::make_unique<views::View>(); + views::GridLayout* origin_layout = origin_container->SetLayoutManager( + std::make_unique<views::GridLayout>()); + + columns = origin_layout->AddColumnSet(0); + columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, + 1.0, views::GridLayout::ColumnSize::kUsePreferred, 0, 0); + columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, + 1.0, views::GridLayout::ColumnSize::kUsePreferred, 0, 0); + origin_layout->StartRow(views::GridLayout::kFixedSize, 0); + if (PaymentsExperimentalFeatures::IsEnabled( + features::kPaymentHandlerSecurityIcon)) { + auto security_icon = std::make_unique<views::ImageView>(); + const ui::ThemeProvider& theme_provider = + ThemeService::GetThemeProviderForProfile(profile); + security_icon->SetImage(gfx::CreateVectorIcon( + location_bar_model::GetSecurityVectorIcon(security_level), 16, + GetOmniboxSecurityChipColor(&theme_provider, security_level))); + security_icon->SetID(static_cast<int>(DialogViewID::SECURITY_ICON_VIEW)); + origin_layout->AddView(std::move(security_icon)); + } + auto* origin_label = origin_layout->AddView( std::make_unique<views::Label>(base::UTF8ToUTF16(origin.host()))); origin_label->SetElideBehavior(gfx::ELIDE_HEAD); if (!title_is_valid) { @@ -108,6 +138,8 @@ origin_label->SetAutoColorReadabilityEnabled(false); origin_label->SetEnabledColor(foreground); origin_label->SetBackgroundColor(background_color); + title_origin_layout->StartRow(views::GridLayout::kFixedSize, 0); + title_origin_layout->AddView(std::move(origin_container)); views::GridLayout* top_level_layout = SetLayoutManager(std::make_unique<views::GridLayout>()); @@ -238,7 +270,10 @@ GetHeaderBackground(header_view); return std::make_unique<ReadOnlyOriginView>( GetPaymentHandlerDialogTitle(web_contents()), origin, - state()->selected_app()->icon_bitmap(), background->get_color(), this); + state()->selected_app()->icon_bitmap(), profile_, + web_contents() ? SslValidityChecker::GetSecurityLevel(web_contents()) + : security_state::NONE, + background->get_color(), this); } std::unique_ptr<views::Background> @@ -267,8 +302,11 @@ void PaymentHandlerWebFlowViewController::VisibleSecurityStateChanged( content::WebContents* source) { DCHECK_EQ(source, web_contents()); - if (!SslValidityChecker::IsValidPageInPaymentHandlerWindow(source)) + if (!SslValidityChecker::IsValidPageInPaymentHandlerWindow(source)) { AbortPayment(); + } else { + UpdateHeaderView(); + } } void PaymentHandlerWebFlowViewController::DidStartNavigation(
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h b/chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h index a1f8c86..5bc831c 100644 --- a/chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h +++ b/chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h
@@ -14,7 +14,8 @@ enum class DialogViewID : int { VIEW_ID_NONE = autofill::MAX_VALID_FIELD_TYPE, - CONTENT_VIEW, // The main content view filled by each sheet + CONTENT_VIEW, // The main content view filled by each sheet + SECURITY_ICON_VIEW, // The view indicates security state of the page // The following are views::Button (clickable). PAYMENT_SHEET_CONTACT_INFO_SECTION,
diff --git a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc index af48d19..5f2dc153 100644 --- a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc +++ b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc
@@ -42,6 +42,7 @@ #include "ui/views/controls/throbber.h" #include "ui/views/layout/flex_layout.h" #include "ui/views/layout/layout_provider.h" +#include "ui/views/style/typography.h" #include "ui/views/view_class_properties.h" namespace { @@ -57,15 +58,10 @@ // tab counter border, the font shrinks when the count is 10 or higher. class NumberLabel : public views::Label { public: - NumberLabel() : Label(base::string16(), CONTEXT_WEB_UI_TAB_COUNTER) { - // Use the default font for single-digit tab counts. + NumberLabel() : Label(base::string16(), CONTEXT_TAB_COUNTER) { single_digit_font_ = font_list(); - - // Use a size adjustment of -2 because -1 makes the font impossible to - // center in the view. - constexpr int kDoubleDigitSizeAdjustment = -2; - double_digit_font_ = - single_digit_font_.DeriveWithSizeDelta(kDoubleDigitSizeAdjustment); + double_digit_font_ = views::style::GetFont(CONTEXT_TAB_COUNTER, + views::style::STYLE_SECONDARY); } ~NumberLabel() override {}
diff --git a/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc b/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc index 7124d4f..8053fd1 100644 --- a/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc +++ b/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc
@@ -181,8 +181,10 @@ uint8_t out_buf[QRCode::V5::kInputBytes], base::span<const uint8_t, 32> qr_generator_key) { const int64_t current_tick = device::CableDiscoveryData::CurrentTimeTick(); + // TODO(agl): fix this. Currently doing this in order to split up CLs. + device::QRGeneratorKey temp_key = {0}; const device::CableQRData qr_data = - device::CableDiscoveryData::DeriveQRData(qr_generator_key, current_tick); + device::CableDiscoveryData::DeriveQRData(temp_key, current_tick); std::string base64_qr_data; base::Base64UrlEncode(
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 80c304a..b53e225 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -34,6 +34,7 @@ #include "chrome/browser/ui/webui/chromeos/account_manager/account_migration_welcome_ui.h" #include "chrome/browser/ui/webui/chromeos/chrome_url_disabled/chrome_url_disabled_ui.h" #include "chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.h" +#include "chrome/browser/ui/webui/commander/commander_ui.h" #include "chrome/browser/ui/webui/components/components_ui.h" #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/browser/ui/webui/crashes_ui.h" @@ -557,6 +558,8 @@ // Bookmarks are part of NTP on Android. if (url.host_piece() == chrome::kChromeUIBookmarksHost) return &NewWebUI<BookmarksUI>; + if (url.host_piece() == chrome::kChromeUICommanderHost) + return &NewWebUI<CommanderUI>; // Downloads list on Android uses the built-in download manager. if (url.host_piece() == chrome::kChromeUIDownloadsHost) return &NewWebUI<DownloadsUI>;
diff --git a/chrome/browser/ui/webui/chromeos/set_time_ui.cc b/chrome/browser/ui/webui/chromeos/set_time_ui.cc index d0ed058..1bdc576 100644 --- a/chrome/browser/ui/webui/chromeos/set_time_ui.cc +++ b/chrome/browser/ui/webui/chromeos/set_time_ui.cc
@@ -142,7 +142,7 @@ account_id = user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); } - ash::LoginScreen::Get()->ShowParentAccessWidget( + ash::ParentAccessController::Get()->ShowWidget( account_id, base::BindOnce(&SetTimeMessageHandler::OnParentAccessValidation, weak_factory_.GetWeakPtr()),
diff --git a/chrome/browser/ui/webui/commander/commander_handler.cc b/chrome/browser/ui/webui/commander/commander_handler.cc new file mode 100644 index 0000000..6b6173e --- /dev/null +++ b/chrome/browser/ui/webui/commander/commander_handler.cc
@@ -0,0 +1,89 @@ +// Copyright 2020 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 "chrome/browser/ui/webui/commander/commander_handler.h" + +#include "base/bind.h" +#include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ui/commander/commander_view_model.h" + +const char CommanderHandler::Delegate::kKey[] = + "CommanderHandler::Delegate::kKey"; +CommanderHandler::CommanderHandler() = default; +CommanderHandler::~CommanderHandler() = default; + +void CommanderHandler::RegisterMessages() { + web_ui()->RegisterMessageCallback( + "textChanged", base::BindRepeating(&CommanderHandler::HandleTextChanged, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "optionSelected", + base::BindRepeating(&CommanderHandler::HandleOptionSelected, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "dismiss", base::BindRepeating(&CommanderHandler::HandleDismiss, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "heightChanged", + base::BindRepeating(&CommanderHandler::HandleHeightChanged, + base::Unretained(this))); +} + +void CommanderHandler::OnJavascriptDisallowed() { + if (delegate_) + delegate_->OnHandlerEnabled(false); +} + +void CommanderHandler::OnJavascriptAllowed() { + if (delegate_) + delegate_->OnHandlerEnabled(true); +} + +void CommanderHandler::HandleTextChanged(const base::ListValue* args) { + AllowJavascript(); + CHECK_EQ(1u, args->GetSize()); + std::string text = args->GetList()[0].GetString(); + if (delegate_) + delegate_->OnTextChanged(base::UTF8ToUTF16(text)); +} + +void CommanderHandler::HandleOptionSelected(const base::ListValue* args) { + AllowJavascript(); + CHECK_EQ(2u, args->GetSize()); + int index = args->GetList()[0].GetInt(); + int result_set_id = args->GetList()[1].GetInt(); + if (delegate_) + delegate_->OnOptionSelected(index, result_set_id); +} + +void CommanderHandler::HandleDismiss(const base::ListValue* args) { + if (delegate_) + delegate_->OnDismiss(); +} + +void CommanderHandler::HandleHeightChanged(const base::ListValue* args) { + CHECK_EQ(1u, args->GetSize()); + int new_height = args->GetList()[0].GetInt(); + if (delegate_) + delegate_->OnHeightChanged(new_height); +} + +void CommanderHandler::ViewModelUpdated( + commander::CommanderViewModel view_model) { + if (view_model.action == + commander::CommanderViewModel::Action::kDisplayResults) { + base::Value list(base::Value::Type::LIST); + for (commander::CommandItemViewModel& item : view_model.items) { + // TODO(lgrey): This is temporary, just so we can display something. + // We will also need to pass on the result set id, and match ranges for + // each item. + list.Append(item.title); + } + FireWebUIListener("view-model-updated", list); + } else { + DCHECK_EQ(view_model.action, + commander::CommanderViewModel::Action::kPrompt); + // TODO(lgrey): Handle kPrompt. kDismiss is handled higher up the stack. + } +}
diff --git a/chrome/browser/ui/webui/commander/commander_handler.h b/chrome/browser/ui/webui/commander/commander_handler.h new file mode 100644 index 0000000..ce89400 --- /dev/null +++ b/chrome/browser/ui/webui/commander/commander_handler.h
@@ -0,0 +1,73 @@ +// Copyright 2020 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 CHROME_BROWSER_UI_WEBUI_COMMANDER_COMMANDER_HANDLER_H_ +#define CHROME_BROWSER_UI_WEBUI_COMMANDER_COMMANDER_HANDLER_H_ + +#include "chrome/browser/ui/commander/commander_view_model.h" +#include "content/public/browser/web_ui.h" +#include "content/public/browser/web_ui_message_handler.h" + +// Handles serializing and unserializing communication between the commander +// backend and WebUI interface. +class CommanderHandler : public content::WebUIMessageHandler { + public: + // The delegate allows CommanderHandler to send messages up to the + // browser-side commander system. + class Delegate { + public: + // The key under which the delegate is expected to be stashed in the + // containing web contents. + static const char kKey[]; + // Called when the text is changed in the WebUI interface. + virtual void OnTextChanged(const base::string16& text) = 0; + // Called when an option is selected (clicked or enter pressed) in the WebUI + // interface. + virtual void OnOptionSelected(size_t option_index, int result_set_id) = 0; + // Called when the WebUI interface wants to dismiss the UI. + virtual void OnDismiss() = 0; + // Called when the WebUI interface's content height has changed. + virtual void OnHeightChanged(int new_height) = 0; + // Called when the web interface's availability changes (for example, if + // the renderer crashes, this should be called with false). + virtual void OnHandlerEnabled(bool is_enabled) = 0; + }; + CommanderHandler(); + ~CommanderHandler() override; + + // Called when a new view model should be displayed. + void ViewModelUpdated(commander::CommanderViewModel view_model); + + void set_delegate(Delegate* delegate) { delegate_ = delegate; } + + // WebUIMessageHandler overrides. + void RegisterMessages() override; + void OnJavascriptAllowed() override; + void OnJavascriptDisallowed() override; + + private: + // WebUI message handlers + + // Handles text changes in the primary textfield. Expects a single string + // argument. + void HandleTextChanged(const base::ListValue* args); + + // Handles the user selecting one of the available command options. + // Expects two numeric argument representing the index of the chosen command, + // and the result set id of the active view model (see documentation in + // commander::CommanderViewModel). + void HandleOptionSelected(const base::ListValue* args); + + // Handles the user pressing "Escape", or otherwise indicating they would + // like to dismiss the UI. No arguments expected. + void HandleDismiss(const base::ListValue* args); + + // Handles the display height of the UI changing. Expects one numeric argument + // representing the new height. + void HandleHeightChanged(const base::ListValue* args); + + Delegate* delegate_ = nullptr; +}; + +#endif // CHROME_BROWSER_UI_WEBUI_COMMANDER_COMMANDER_HANDLER_H_
diff --git a/chrome/browser/ui/webui/commander/commander_ui.cc b/chrome/browser/ui/webui/commander/commander_ui.cc new file mode 100644 index 0000000..f4b5a5c --- /dev/null +++ b/chrome/browser/ui/webui/commander/commander_ui.cc
@@ -0,0 +1,30 @@ +// Copyright 2020 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 "chrome/browser/ui/webui/commander/commander_ui.h" + +#include <memory> + +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/webui/commander/commander_handler.h" +#include "chrome/common/webui_url_constants.h" +#include "chrome/grit/browser_resources.h" +#include "content/public/browser/web_ui_data_source.h" + +CommanderUI::CommanderUI(content::WebUI* web_ui) + : content::WebUIController(web_ui) { + auto handler = std::make_unique<CommanderHandler>(); + handler_ = handler.get(); + web_ui->AddMessageHandler(std::move(handler)); + + content::WebUIDataSource* source = + content::WebUIDataSource::Create(chrome::kChromeUICommanderHost); + source->AddResourcePath("index.html", IDR_COMMANDER_HTML); + source->SetDefaultResource(IDR_COMMANDER_HTML); + + Profile* profile = Profile::FromWebUI(web_ui); + content::WebUIDataSource::Add(profile, source); +} + +CommanderUI::~CommanderUI() = default;
diff --git a/chrome/browser/ui/webui/commander/commander_ui.h b/chrome/browser/ui/webui/commander/commander_ui.h new file mode 100644 index 0000000..1a922f7 --- /dev/null +++ b/chrome/browser/ui/webui/commander/commander_ui.h
@@ -0,0 +1,28 @@ +// Copyright 2020 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 CHROME_BROWSER_UI_WEBUI_COMMANDER_COMMANDER_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_COMMANDER_COMMANDER_UI_H_ + +#include "content/public/browser/web_ui_controller.h" + +class CommanderHandler; + +// Entry point for the Commander WebUI interface. +class CommanderUI : public content::WebUIController { + public: + explicit CommanderUI(content::WebUI* web_ui); + ~CommanderUI() override; + + // Disallow copy and assign + CommanderUI(const CommanderUI& other) = delete; + CommanderUI& operator=(const CommanderUI& other) = delete; + + CommanderHandler* handler() { return handler_; } + + private: + CommanderHandler* handler_; +}; + +#endif // CHROME_BROWSER_UI_WEBUI_COMMANDER_COMMANDER_UI_H_
diff --git a/chrome/browser/ui/webui/commander/commander_ui_browsertest.cc b/chrome/browser/ui/webui/commander/commander_ui_browsertest.cc new file mode 100644 index 0000000..79922b9 --- /dev/null +++ b/chrome/browser/ui/webui/commander/commander_ui_browsertest.cc
@@ -0,0 +1,137 @@ +// Copyright 2020 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 "chrome/browser/ui/webui/commander/commander_ui.h" + +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/commander/commander_view_model.h" +#include "chrome/browser/ui/webui/commander/commander_handler.h" +#include "chrome/common/chrome_isolated_world_ids.h" +#include "chrome/common/webui_url_constants.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "content/public/browser/navigation_controller.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_web_ui.h" + +namespace { + +class TestCommanderHandler : public CommanderHandler { + public: + explicit TestCommanderHandler(content::WebUI* web_ui) { set_web_ui(web_ui); } +}; + +} // namespace + +// This actually tests the whole WebUI communication layer as a unit: +// CommanderUI and CommanderHandler. +class CommanderUITest : public InProcessBrowserTest, + public CommanderHandler::Delegate { + public: + void SetUpOnMainThread() override { + contents_ = content::WebContents::Create( + content::WebContents::CreateParams(browser()->profile())); + contents_->GetController().LoadURL( + GURL(chrome::kChromeUICommanderURL), content::Referrer(), + ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); + CommanderUI* controller = + static_cast<CommanderUI*>(contents_->GetWebUI()->GetController()); + controller->handler()->set_delegate(this); + + ASSERT_TRUE(content::WaitForLoadStop(contents_.get())); + EXPECT_EQ(contents_->GetLastCommittedURL().host(), + chrome::kChromeUICommanderHost); + } + void TearDownOnMainThread() override { + contents_.reset(); + dismiss_invocation_count_ = 0; + text_changed_invocations_.clear(); + option_selected_invocations_.clear(); + height_changed_invocations_.clear(); + } + + protected: + void ExecuteJS(std::string js) { + ASSERT_TRUE(content::ExecuteScript(contents_.get(), js)); + } + // CommanderHandler::Delegate implementation. + void OnTextChanged(const base::string16& text) override { + text_changed_invocations_.push_back(text); + } + void OnOptionSelected(size_t option_index, int result_set_id) override { + option_selected_invocations_.emplace_back(option_index, result_set_id); + } + + void OnDismiss() override { dismiss_invocation_count_++; } + + void OnHeightChanged(int new_height) override { + height_changed_invocations_.emplace_back(new_height); + } + void OnHandlerEnabled(bool enabled) override {} + + const std::vector<base::string16> text_changed_invocations() { + return text_changed_invocations_; + } + const std::vector<std::pair<size_t, int>> option_selected_invocations() { + return option_selected_invocations_; + } + const std::vector<int> height_changed_invocations() { + return height_changed_invocations_; + } + + size_t dismiss_invocation_count() { return dismiss_invocation_count_; } + + private: + std::unique_ptr<content::WebContents> contents_; + size_t dismiss_invocation_count_ = 0; + std::vector<base::string16> text_changed_invocations_; + std::vector<std::pair<size_t, int>> option_selected_invocations_; + std::vector<int> height_changed_invocations_; +}; + +IN_PROC_BROWSER_TEST_F(CommanderUITest, Dismiss) { + EXPECT_EQ(dismiss_invocation_count(), 0u); + ExecuteJS("chrome.send('dismiss')"); + EXPECT_EQ(dismiss_invocation_count(), 1u); +} + +IN_PROC_BROWSER_TEST_F(CommanderUITest, HeightChanged) { + EXPECT_EQ(height_changed_invocations().size(), 0u); + ExecuteJS("chrome.send('heightChanged', [42])"); + ASSERT_EQ(height_changed_invocations().size(), 1u); + ASSERT_EQ(height_changed_invocations().back(), 42); +} + +IN_PROC_BROWSER_TEST_F(CommanderUITest, TextChanged) { + EXPECT_EQ(text_changed_invocations().size(), 0u); + ExecuteJS("chrome.send('textChanged', ['orange'])"); + ASSERT_EQ(text_changed_invocations().size(), 1u); + ASSERT_EQ(text_changed_invocations().back(), base::ASCIIToUTF16("orange")); +} + +IN_PROC_BROWSER_TEST_F(CommanderUITest, OptionSelected) { + EXPECT_EQ(option_selected_invocations().size(), 0u); + ExecuteJS("chrome.send('optionSelected', [13, 586])"); + ASSERT_EQ(option_selected_invocations().size(), 1u); + std::pair<size_t, int> expected({13, 586}); + ASSERT_EQ(option_selected_invocations().back(), expected); +} + +TEST(CommanderHandlerTest, ViewModelPassed) { + content::TestWebUI test_web_ui; + auto handler = std::make_unique<TestCommanderHandler>(&test_web_ui); + commander::CommanderViewModel vm; + vm.action = commander::CommanderViewModel::Action::kDisplayResults; + base::string16 item_title = base::ASCIIToUTF16("Test item"); + std::vector<gfx::Range> item_ranges; + vm.items.emplace_back(item_title, item_ranges); + handler->AllowJavascriptForTesting(); + handler->ViewModelUpdated(std::move(vm)); + const content::TestWebUI::CallData& call_data = + *test_web_ui.call_data().back(); + EXPECT_EQ("cr.webUIListenerCallback", call_data.function_name()); + EXPECT_EQ("view-model-updated", call_data.arg1()->GetString()); + EXPECT_EQ("Test item", call_data.arg2()->GetList()[0].GetString()); +}
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 690f13a..c720e96 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -970,10 +970,13 @@ web_app_provider_->registry_controller().SetAppInstallTime(app_id, base::Time::Now()); web_app::InstallOsHooksOptions options; - options.add_to_applications_menu = true; options.add_to_desktop = true; options.add_to_quick_launch_bar = false; - options.run_on_os_login = false; + options.os_hooks[web_app::OsHookType::kShortcuts] = true; + options.os_hooks[web_app::OsHookType::kShortcutsMenu] = true; + options.os_hooks[web_app::OsHookType::kFileHandlers] = true; + options.os_hooks[web_app::OsHookType::kRunOnOsLogin] = false; + web_app_provider_->os_integration_manager().InstallOsHooks( app_id, base::BindOnce(&AppLauncherHandler::OnOsHooksInstalled,
diff --git a/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc b/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc index 89998f4..11f169b 100644 --- a/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc +++ b/chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc
@@ -150,7 +150,7 @@ return; } - ash::LoginScreen::Get()->ShowParentAccessWidget( + ash::ParentAccessController::Get()->ShowWidget( user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(), base::BindOnce(&DateTimeHandler::OnParentAccessValidation, weak_ptr_factory_.GetWeakPtr()),
diff --git a/chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.cc b/chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.cc index e112feb4..c41be39b 100644 --- a/chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.cc +++ b/chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.cc
@@ -16,6 +16,8 @@ #include "chrome/browser/chromeos/arc/arc_util.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/supervised_user/supervised_user_service.h" +#include "chrome/browser/supervised_user/supervised_user_service_factory.h" #include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h" #include "chrome/common/webui_url_constants.h" #include "chromeos/constants/chromeos_pref_names.h" @@ -86,7 +88,8 @@ source == InlineLoginDialogChromeOS::Source::kArc) { return GURL(chrome::kChromeUIAccountManagerErrorURL); } - return GetUrlWithEmailParam(chrome::kChromeUIEDUCoexistenceLoginURL, email); + return GetUrlWithEmailParam( + SupervisedUserService::GetEduCoexistenceLoginUrl(), email); } } // namespace
diff --git a/chrome/browser/web_applications/components/os_integration_manager.cc b/chrome/browser/web_applications/components/os_integration_manager.cc index b7d8edf..a31704c 100644 --- a/chrome/browser/web_applications/components/os_integration_manager.cc +++ b/chrome/browser/web_applications/components/os_integration_manager.cc
@@ -22,6 +22,10 @@ namespace web_app { +InstallOsHooksOptions::InstallOsHooksOptions() = default; +InstallOsHooksOptions::InstallOsHooksOptions( + const InstallOsHooksOptions& other) = default; + // This is adapted from base/barrier_closure.cc. os_hooks_results is maintained // to track install results from different OS hooks callers class OsHooksBarrierInfo { @@ -114,7 +118,7 @@ // TODO(ortuno): Make adding a shortcut to the applications menu independent // from adding a shortcut to desktop. - if (options.add_to_applications_menu && + if (options.os_hooks[OsHookType::kShortcuts] && shortcut_manager_->CanCreateShortcuts()) { const bool add_to_desktop = options.add_to_desktop; shortcut_manager_->CreateShortcuts( @@ -272,15 +276,18 @@ // TODO(crbug.com/1087219): callback should be run after all hooks are // deployed, need to refactor filehandler to allow this. - file_handler_manager_->EnableAndRegisterOsFileHandlers(app_id); + if (options.os_hooks[OsHookType::kFileHandlers]) + file_handler_manager_->EnableAndRegisterOsFileHandlers(app_id); barrier_callback.Run(OsHookType::kFileHandlers, /*completed=*/true); - if (options.add_to_quick_launch_bar && + if (options.os_hooks[OsHookType::kShortcuts] && + options.add_to_quick_launch_bar && ui_manager_->CanAddAppToQuickLaunchBar()) { ui_manager_->AddAppToQuickLaunchBar(app_id); } - if (shortcuts_created && base::FeatureList::IsEnabled( - features::kDesktopPWAsAppIconShortcutsMenu)) { + if (shortcuts_created && options.os_hooks[OsHookType::kShortcutsMenu] && + base::FeatureList::IsEnabled( + features::kDesktopPWAsAppIconShortcutsMenu)) { if (web_app_info) { if (web_app_info->shortcuts_menu_item_infos.empty()) { barrier_callback.Run(OsHookType::kShortcutsMenu, /*completed=*/false); @@ -300,16 +307,16 @@ barrier_callback.Run(OsHookType::kShortcutsMenu, /*completed=*/false); } - if (base::FeatureList::IsEnabled(features::kDesktopPWAsRunOnOsLogin) && - options.run_on_os_login) { + if (options.os_hooks[OsHookType::kRunOnOsLogin] && + base::FeatureList::IsEnabled(features::kDesktopPWAsRunOnOsLogin)) { // TODO(crbug.com/897302): Implement Run on OS Login mode selection. // Currently it is set to be the default: RunOnOsLoginMode::kWindowed RegisterRunOnOsLogin( app_id, base::BindOnce(barrier_callback, OsHookType::kRunOnOsLogin)); } else { base::SequencedTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(barrier_callback, OsHookType::kRunOnOsLogin, false)); + FROM_HERE, base::BindOnce(barrier_callback, OsHookType::kRunOnOsLogin, + /*completed=*/false)); } }
diff --git a/chrome/browser/web_applications/components/os_integration_manager.h b/chrome/browser/web_applications/components/os_integration_manager.h index e0adf76..49d7275 100644 --- a/chrome/browser/web_applications/components/os_integration_manager.h +++ b/chrome/browser/web_applications/components/os_integration_manager.h
@@ -33,12 +33,15 @@ // OsHooksResults contains the result of all Os hook deployments using OsHooksResults = std::bitset<OsHookType::kMaxValue + 1>; -// Used to pass install options configured from upstream caller +// Used to pass install options configured from upstream caller. +// All options are disabled by default. struct InstallOsHooksOptions { - bool add_to_applications_menu = false; + InstallOsHooksOptions(); + InstallOsHooksOptions(const InstallOsHooksOptions& other); + + OsHooksResults os_hooks; bool add_to_desktop = false; bool add_to_quick_launch_bar = false; - bool run_on_os_login = false; }; // Callback made after InstallOsHooks is finished.
diff --git a/chrome/browser/web_applications/pending_app_install_task.cc b/chrome/browser/web_applications/pending_app_install_task.cc index 63fcb39..05f21c3 100644 --- a/chrome/browser/web_applications/pending_app_install_task.cc +++ b/chrome/browser/web_applications/pending_app_install_task.cc
@@ -256,10 +256,17 @@ return; } InstallOsHooksOptions options; - options.add_to_applications_menu = install_options_.add_to_applications_menu; + options.os_hooks[OsHookType::kShortcuts] = + install_options_.add_to_applications_menu; options.add_to_desktop = install_options_.add_to_desktop; options.add_to_quick_launch_bar = install_options_.add_to_quick_launch_bar; - options.run_on_os_login = install_options_.run_on_os_login; + options.os_hooks[OsHookType::kRunOnOsLogin] = + install_options_.run_on_os_login; + + // TODO(crbug.com/1087219): Determine if |register_file_handlers| should be + // configured from somewhere else rather than always true. + options.os_hooks[OsHookType::kFileHandlers] = true; + options.os_hooks[OsHookType::kShortcutsMenu] = true; os_integration_manager_->InstallOsHooks( app_id,
diff --git a/chrome/browser/web_applications/test/test_os_integration_manager.cc b/chrome/browser/web_applications/test/test_os_integration_manager.cc index 23bb190c..e860827 100644 --- a/chrome/browser/web_applications/test/test_os_integration_manager.cc +++ b/chrome/browser/web_applications/test/test_os_integration_manager.cc
@@ -46,7 +46,7 @@ did_add_to_desktop_ = options.add_to_desktop; - if (options.add_to_applications_menu && can_create_shortcuts_) { + if (options.os_hooks[OsHookType::kShortcuts] && can_create_shortcuts_) { bool success = true; auto it = next_create_shortcut_results_.find(app_id); if (it != next_create_shortcut_results_.end()) { @@ -59,7 +59,7 @@ } } - if (options.run_on_os_login) { + if (options.os_hooks[OsHookType::kRunOnOsLogin]) { ++num_register_run_on_os_login_calls_; os_hooks_results[OsHookType::kRunOnOsLogin] = true; }
diff --git a/chrome/browser/web_applications/web_app_install_task.cc b/chrome/browser/web_applications/web_app_install_task.cc index 9eadf76..1ddd446e9 100644 --- a/chrome/browser/web_applications/web_app_install_task.cc +++ b/chrome/browser/web_applications/web_app_install_task.cc
@@ -776,22 +776,28 @@ InstallOsHooksOptions options; - options.add_to_applications_menu = true; + options.os_hooks[OsHookType::kShortcuts] = true; options.add_to_desktop = true; options.add_to_quick_launch_bar = kAddAppsToQuickLaunchBarByDefault; - options.run_on_os_login = web_app_info->run_on_os_login; + options.os_hooks[OsHookType::kRunOnOsLogin] = web_app_info->run_on_os_login; if (install_source_ == WebappInstallSource::SYNC) options.add_to_quick_launch_bar = false; if (install_params_) { - options.add_to_applications_menu = + options.os_hooks[OsHookType::kShortcuts] = install_params_->add_to_applications_menu; options.add_to_desktop = install_params_->add_to_desktop; options.add_to_quick_launch_bar = install_params_->add_to_quick_launch_bar; - options.run_on_os_login = install_params_->run_on_os_login; + options.os_hooks[OsHookType::kRunOnOsLogin] = + install_params_->run_on_os_login; } + // TODO(crbug.com/1087219): Determine if file handlers should be + // configured from somewhere else rather than always true. + options.os_hooks[OsHookType::kFileHandlers] = true; + options.os_hooks[OsHookType::kShortcutsMenu] = true; + auto hooks_created_callback = base::BindOnce( &WebAppInstallTask::OnOsHooksCreated, weak_ptr_factory_.GetWeakPtr(), web_app_info->open_as_window, app_id);
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model.h b/chrome/browser/webauthn/authenticator_request_dialog_model.h index e2fb2172..d3bc583 100644 --- a/chrome/browser/webauthn/authenticator_request_dialog_model.h +++ b/chrome/browser/webauthn/authenticator_request_dialog_model.h
@@ -362,7 +362,10 @@ } base::span<const uint8_t, 32> qr_generator_key() const { - return *qr_generator_key_; + // TODO(agl): return the true generator key. This is currently broken to + // allow CLs to be split up reasonably. + static_assert(EXTENT(*qr_generator_key_) >= 32, ""); + return base::span<const uint8_t, 32>(qr_generator_key_->data(), 32); } void CollectPIN(base::Optional<int> attempts,
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 51ecc49c..358c88c84 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-master-1600257341-cdcb93ba007df24b60057506da5b299c67d8a739.profdata +chrome-linux-master-1600273595-fec2fba6dfa6bd9b7e3dd69b0eab2bf1cda7b0a9.profdata
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc index 202d666..1e492055 100644 --- a/chrome/common/webui_url_constants.cc +++ b/chrome/common/webui_url_constants.cc
@@ -68,7 +68,9 @@ const char kChromeUIDownloadsHost[] = "downloads"; const char kChromeUIDownloadsURL[] = "chrome://downloads/"; const char kChromeUIDriveInternalsHost[] = "drive-internals"; -const char kChromeUIEDUCoexistenceLoginURL[] = "chrome://chrome-signin/edu"; +const char kChromeUIEDUCoexistenceLoginURLV1[] = "chrome://chrome-signin/edu"; +const char kChromeUIEDUCoexistenceLoginURLV2[] = + "chrome://chrome-signin/edu-coexistence"; const char kChromeUIExtensionIconHost[] = "extension-icon"; const char kChromeUIExtensionIconURL[] = "chrome://extension-icon/"; const char kChromeUIExtensionsHost[] = "extensions"; @@ -379,6 +381,8 @@ #endif #if !defined(OS_ANDROID) +const char kChromeUICommanderHost[] = "commander"; +const char kChromeUICommanderURL[] = "chrome://commander"; const char kChromeUITabSearchHost[] = "tab-search"; const char kChromeUITabSearchURL[] = "chrome://tab-search/"; #endif
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h index b97d699..2fbc40d 100644 --- a/chrome/common/webui_url_constants.h +++ b/chrome/common/webui_url_constants.h
@@ -71,7 +71,8 @@ extern const char kChromeUIDownloadsHost[]; extern const char kChromeUIDownloadsURL[]; extern const char kChromeUIDriveInternalsHost[]; -extern const char kChromeUIEDUCoexistenceLoginURL[]; +extern const char kChromeUIEDUCoexistenceLoginURLV1[]; +extern const char kChromeUIEDUCoexistenceLoginURLV2[]; extern const char kChromeUIExtensionIconHost[]; extern const char kChromeUIExtensionIconURL[]; extern const char kChromeUIExtensionsHost[]; @@ -333,6 +334,8 @@ #endif #if !defined(OS_ANDROID) +extern const char kChromeUICommanderHost[]; +extern const char kChromeUICommanderURL[]; extern const char kChromeUITabSearchHost[]; extern const char kChromeUITabSearchURL[]; #endif
diff --git a/chrome/renderer/lite_video/lite_video_hint_agent.cc b/chrome/renderer/lite_video/lite_video_hint_agent.cc index 3c1e7e0..fe5ba2c 100644 --- a/chrome/renderer/lite_video/lite_video_hint_agent.cc +++ b/chrome/renderer/lite_video/lite_video_hint_agent.cc
@@ -38,11 +38,20 @@ if (!HasLiteVideoHint()) return base::TimeDelta(); + if (ShouldDisableLiteVideoForCacheControlNoTransform() && + response_head.headers && + response_head.headers->HasHeaderValue("cache-control", "no-transform")) { + return base::TimeDelta(); + } + int64_t recv_bytes = response_head.content_length; if (recv_bytes == -1) recv_bytes = response_head.encoded_body_length; - if (recv_bytes == -1) + if (recv_bytes == -1 && !ShouldThrottleLiteVideoMissingContentLength()) { return base::TimeDelta(); + } else if (recv_bytes == -1) { + recv_bytes = 0; + } if (kilobytes_buffered_before_throttle_ < *kilobytes_to_buffer_before_throttle_) { @@ -52,9 +61,9 @@ // The total RTT for this media response should be based on how much time it // took to transfer the packet in the target bandwidth, and the per RTT - // latency. For example, assuming 100KBPS target bandwidth and target RTT of 1 - // second, an 400KB response should have total delay of 5 seconds - // (400/100 + 1). + // latency. For example, assuming 100KBPS target bandwidth and target RTT of + // 1 second, an 400KB response should have total delay of 5 seconds (400/100 + // + 1). auto delay_for_throttled_response = base::TimeDelta::FromSecondsD( recv_bytes / (*target_downlink_bandwidth_kbps_ * 1024.0)) +
diff --git a/chrome/renderer/lite_video/lite_video_hint_agent_browsertest.cc b/chrome/renderer/lite_video/lite_video_hint_agent_browsertest.cc index e47bb632..7162843 100644 --- a/chrome/renderer/lite_video/lite_video_hint_agent_browsertest.cc +++ b/chrome/renderer/lite_video/lite_video_hint_agent_browsertest.cc
@@ -67,6 +67,21 @@ scoped_feature_list_.InitAndDisableFeature(features::kLiteVideo); } + void SetDisableForNoTransform() { + scoped_feature_list_.Reset(); + scoped_feature_list_.InitWithFeaturesAndParameters( + {{features::kLiteVideo, + {{"disable_for_cache_control_no_transform", "true"}}}}, + {}); + } + + void SetDisableForMissingContentLength() { + scoped_feature_list_.Reset(); + scoped_feature_list_.InitWithFeaturesAndParameters( + {{features::kLiteVideo, {{"throttle_missing_content_length", "true"}}}}, + {}); + } + std::unique_ptr<LiteVideoURLLoaderThrottle> CreateLiteVideoURLLoaderThrottle( blink::mojom::RequestContextType request_context_type) { blink::WebURLRequest request; @@ -79,7 +94,8 @@ std::unique_ptr<MediaLoaderThrottleInfo> CreateThrottleAndSendResponse( net::HttpStatusCode response_code, const std::string& mime_type, - int content_length) { + int content_length, + bool set_cache_control_no_transform = false) { auto throttle_info = std::make_unique<MediaLoaderThrottleInfo>( CreateLiteVideoURLLoaderThrottle( blink::mojom::RequestContextType::FETCH)); @@ -88,9 +104,13 @@ response_head->mime_type = mime_type; response_head->mime_type = mime_type; response_head->content_length = content_length; + response_head->encoded_body_length = content_length; response_head->network_accessed = true; response_head->was_fetched_via_cache = false; + if (set_cache_control_no_transform) + response_head->headers->SetHeader("Cache-Control", "no-transform"); + throttle_info->SendResponse(response_head.get()); return throttle_info; } @@ -160,6 +180,60 @@ histogram_tester().ExpectTotalCount("LiteVideo.URLLoader.ThrottleLatency", 0); } +TEST_F(LiteVideoHintAgentTest, CacheControlNoTransformNotThrottled) { + histogram_tester().ExpectUniqueSample("LiteVideo.HintAgent.HasHint", true, 1); + + // Initial k media bytes will not be throttled. + auto throttle_info = + CreateThrottleAndSendResponse(net::HTTP_OK, "video/mp4", 11000); + EXPECT_FALSE(throttle_info->is_throttled()); + histogram_tester().ExpectTotalCount("LiteVideo.URLLoader.ThrottleLatency", 0); + EXPECT_TRUE(GetActiveThrottledResponses().empty()); + + // Without the finch param, no-transform will get throttled. + throttle_info = + CreateThrottleAndSendResponse(net::HTTP_OK, "video/mp4", 11000, + true /* set_cache_control_no_transform */); + histogram_tester().ExpectTotalCount("LiteVideo.URLLoader.ThrottleLatency", 1); + EXPECT_TRUE(throttle_info->is_throttled()); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); + base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(throttle_info->is_throttled()); + + // With the finch param, no-transform should not get throttled. + SetDisableForNoTransform(); + throttle_info = + CreateThrottleAndSendResponse(net::HTTP_OK, "video/mp4", 11000, + true /* set_cache_control_no_transform */); + histogram_tester().ExpectTotalCount("LiteVideo.URLLoader.ThrottleLatency", 1); + EXPECT_FALSE(throttle_info->is_throttled()); +} + +TEST_F(LiteVideoHintAgentTest, MissingContentLengthResponseThrottled) { + histogram_tester().ExpectUniqueSample("LiteVideo.HintAgent.HasHint", true, 1); + + // Initial k media bytes will not be throttled. + auto throttle_info = + CreateThrottleAndSendResponse(net::HTTP_OK, "video/mp4", 11000); + EXPECT_FALSE(throttle_info->is_throttled()); + histogram_tester().ExpectTotalCount("LiteVideo.URLLoader.ThrottleLatency", 0); + EXPECT_TRUE(GetActiveThrottledResponses().empty()); + + // Without the finch param, no-transform should not get throttled. + throttle_info = CreateThrottleAndSendResponse(net::HTTP_OK, "video/mp4", -1); + histogram_tester().ExpectTotalCount("LiteVideo.URLLoader.ThrottleLatency", 0); + EXPECT_FALSE(throttle_info->is_throttled()); + + // With the finch param, missing CL will get throttled. + SetDisableForMissingContentLength(); + throttle_info = CreateThrottleAndSendResponse(net::HTTP_OK, "video/mp4", -1); + histogram_tester().ExpectTotalCount("LiteVideo.URLLoader.ThrottleLatency", 1); + EXPECT_TRUE(throttle_info->is_throttled()); + task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(10)); + base::RunLoop().RunUntilIdle(); + EXPECT_FALSE(throttle_info->is_throttled()); +} + TEST_F(LiteVideoHintAgentTest, FailedMediaResponseNotThrottled) { histogram_tester().ExpectUniqueSample("LiteVideo.HintAgent.HasHint", true, 1);
diff --git a/chrome/renderer/lite_video/lite_video_util.cc b/chrome/renderer/lite_video/lite_video_util.cc index 69c483c..c16dd65d 100644 --- a/chrome/renderer/lite_video/lite_video_util.cc +++ b/chrome/renderer/lite_video/lite_video_util.cc
@@ -14,4 +14,14 @@ blink::WebNetworkStateNotifier::SaveDataEnabled(); } +bool ShouldDisableLiteVideoForCacheControlNoTransform() { + return base::GetFieldTrialParamByFeatureAsBool( + ::features::kLiteVideo, "disable_for_cache_control_no_transform", false); +} + +bool ShouldThrottleLiteVideoMissingContentLength() { + return base::GetFieldTrialParamByFeatureAsBool( + ::features::kLiteVideo, "throttle_missing_content_length", false); +} + } // namespace lite_video
diff --git a/chrome/renderer/lite_video/lite_video_util.h b/chrome/renderer/lite_video/lite_video_util.h index 35c4603b..4f433ba 100644 --- a/chrome/renderer/lite_video/lite_video_util.h +++ b/chrome/renderer/lite_video/lite_video_util.h
@@ -10,6 +10,13 @@ // Returns whether LiteVideo is enabled. bool IsLiteVideoEnabled(); +// Returns whether LiteVideo should be disabled for cache-control: no-transform +// responses. +bool ShouldDisableLiteVideoForCacheControlNoTransform(); + +// Returns whether LiteVideo should throttle responses without content-length. +bool ShouldThrottleLiteVideoMissingContentLength(); + } // namespace lite_video #endif // CHROME_RENDERER_LITE_VIDEO_LITE_VIDEO_UTIL_H_
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 0bcf9cc6..f497bedc 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1472,6 +1472,7 @@ "../browser/ui/webui/chromeos/bluetooth_pairing_dialog_browsertest-inl.h", "../browser/ui/webui/chromeos/machine_learning/machine_learning_internals_browsertest.cc", "../browser/ui/webui/chromeos/machine_learning/machine_learning_internals_browsertest.h", + "../browser/ui/webui/commander/commander_ui_browsertest.cc", "../browser/ui/webui/constrained_web_dialog_ui_browsertest.cc", "../browser/ui/webui/extensions/extension_settings_browsertest.cc", "../browser/ui/webui/extensions/extension_settings_browsertest.h", @@ -2227,6 +2228,10 @@ } } + if ((!is_android || enable_vr) && !is_ios) { + sources += [ "../browser/ui/views/payments/payment_handler_header_view_ui_browsertest.cc" ] + } + if ((is_linux || is_chromeos) && !is_component_build) { # Set rpath to find the CDM adapter even in a non-component build. configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] @@ -3046,6 +3051,8 @@ ":browser_tests_runner", ":test_support", ] + + data_deps = [ "//chrome:packed_resources" ] } } @@ -3889,6 +3896,7 @@ sources += [ "../../chromeos/memory/userspace_swap/userspace_swap.cc", "../browser/device_identity/chromeos/device_oauth2_token_store_chromeos_unittest.cc", + "../browser/nearby_sharing/nearby_share_delegate_impl_unittest.cc", "../browser/ui/webui/certificate_provisioning_ui_handler_unittest.cc", "../browser/ui/webui/chromeos/add_supervision/add_supervision_handler_utils_unittest.cc", "../browser/ui/webui/chromeos/edu_account_login_handler_unittest.cc",
diff --git a/chrome/test/chromedriver/net/adb_client_socket.cc b/chrome/test/chromedriver/net/adb_client_socket.cc index 1c92767..f4527957 100644 --- a/chrome/test/chromedriver/net/adb_client_socket.cc +++ b/chrome/test/chromedriver/net/adb_client_socket.cc
@@ -505,8 +505,8 @@ net::AddressList address_list = net::AddressList::CopyWithPort( ip_list, port_); - socket_.reset(new net::TCPClientSocket(address_list, NULL, NULL, - net::NetLogSource())); + socket_.reset(new net::TCPClientSocket(address_list, nullptr, nullptr, + nullptr, net::NetLogSource())); net::CompletionRepeatingCallback copyable_callback = base::AdaptCallbackForRepeating(std::move(callback));
diff --git a/chrome/test/chromedriver/net/websocket.cc b/chrome/test/chromedriver/net/websocket.cc index 158d204a..2462ae8 100644 --- a/chrome/test/chromedriver/net/websocket.cc +++ b/chrome/test/chromedriver/net/websocket.cc
@@ -107,7 +107,8 @@ } net::NetLogSource source; - socket_.reset(new net::TCPClientSocket(addresses, nullptr, nullptr, source)); + socket_.reset( + new net::TCPClientSocket(addresses, nullptr, nullptr, nullptr, source)); state_ = CONNECTING; connect_callback_ = std::move(callback);
diff --git a/chrome/test/data/pdf/annotations_feature_enabled_test.js b/chrome/test/data/pdf/annotations_feature_enabled_test.js index 838b87e..47741d1 100644 --- a/chrome/test/data/pdf/annotations_feature_enabled_test.js +++ b/chrome/test/data/pdf/annotations_feature_enabled_test.js
@@ -386,9 +386,12 @@ }, function testHidingAnnotationsExitsAnnotationsMode() { testAsync(async () => { + document.body.innerHTML = ''; const toolbar = document.createElement('viewer-pdf-toolbar-new'); document.body.appendChild(toolbar); toolbar.toggleAnnotation(); + // This is normally done by the parent in response to the event fired by + // toggleAnnotation(). toolbar.annotationMode = true; await toolbar.addEventListener('display-annotations-changed', async e => { @@ -400,6 +403,7 @@ }); }, function testEnteringAnnotationsModeShowsAnnotations() { + document.body.innerHTML = ''; const toolbar = document.createElement('viewer-pdf-toolbar-new'); document.body.appendChild(toolbar); chrome.test.assertFalse(toolbar.annotationMode); @@ -412,5 +416,19 @@ chrome.test.succeed(); }); toolbar.toggleAnnotation(); + }, + function testEnteringAnnotationsModeDisablesTwoUp() { + document.body.innerHTML = ''; + const toolbar = document.createElement('viewer-pdf-toolbar-new'); + document.body.appendChild(toolbar); + chrome.test.assertFalse(toolbar.annotationMode); + + toolbar.toggleAnnotation(); + // This is normally done by the parent in response to the event fired by + // toggleAnnotation(). + toolbar.annotationMode = true; + chrome.test.assertTrue( + toolbar.shadowRoot.querySelector('#two-page-view-button').disabled); + chrome.test.succeed(); } ]);
diff --git a/chrome/test/data/pdf/viewer_pdf_sidenav_test.js b/chrome/test/data/pdf/viewer_pdf_sidenav_test.js index 64b42cb..d91645c 100644 --- a/chrome/test/data/pdf/viewer_pdf_sidenav_test.js +++ b/chrome/test/data/pdf/viewer_pdf_sidenav_test.js
@@ -30,8 +30,8 @@ ]; const content = sidenav.shadowRoot.querySelector('#content'); - const buttons = /** @type {!NodeList<!CrIconButtonElement>} */ ( - sidenav.shadowRoot.querySelectorAll('cr-icon-button')); + const [thumbnailButton, outlineButton] = + sidenav.shadowRoot.querySelectorAll('cr-icon-button'); const thumbnailBar = /** @type {!ViewerThumbnailBarElement} */ ( @@ -42,27 +42,34 @@ // Sidebar starts on thumbnail view. chrome.test.assertTrue( - buttons[0].parentNode.classList.contains('selected')); + thumbnailButton.parentNode.classList.contains('selected')); + chrome.test.assertEq('true', thumbnailButton.getAttribute('aria-selected')); chrome.test.assertFalse( - buttons[1].parentNode.classList.contains('selected')); + outlineButton.parentNode.classList.contains('selected')); + chrome.test.assertEq('false', outlineButton.getAttribute('aria-selected')); chrome.test.assertFalse(thumbnailBar.hidden); chrome.test.assertTrue(outline.hidden); // Click on outline view. - buttons[1].click(); + outlineButton.click(); chrome.test.assertFalse( - buttons[0].parentNode.classList.contains('selected')); + thumbnailButton.parentNode.classList.contains('selected')); + chrome.test.assertEq( + 'false', thumbnailButton.getAttribute('aria-selected')); chrome.test.assertTrue( - buttons[1].parentNode.classList.contains('selected')); + outlineButton.parentNode.classList.contains('selected')); + chrome.test.assertEq('true', outlineButton.getAttribute('aria-selected')); chrome.test.assertTrue(thumbnailBar.hidden); chrome.test.assertFalse(outline.hidden); // Return to thumbnail view. - buttons[0].click(); + thumbnailButton.click(); chrome.test.assertTrue( - buttons[0].parentNode.classList.contains('selected')); + thumbnailButton.parentNode.classList.contains('selected')); + chrome.test.assertEq('true', thumbnailButton.getAttribute('aria-selected')); chrome.test.assertFalse( - buttons[1].parentNode.classList.contains('selected')); + outlineButton.parentNode.classList.contains('selected')); + chrome.test.assertEq('false', outlineButton.getAttribute('aria-selected')); chrome.test.assertFalse(thumbnailBar.hidden); chrome.test.assertTrue(outline.hidden);
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index b464ca16..acb2dee 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -450,6 +450,7 @@ ":closure_compile_local", "cr_components:closure_compile", "cr_elements:closure_compile", + "inline_login:closure_compile", "nearby_share:closure_compile", "nearby_share/shared:closure_compile", "new_tab_page:closure_compile",
diff --git a/chrome/test/data/webui/inline_login/BUILD.gn b/chrome/test/data/webui/inline_login/BUILD.gn new file mode 100644 index 0000000..444558e --- /dev/null +++ b/chrome/test/data/webui/inline_login/BUILD.gn
@@ -0,0 +1,39 @@ +# Copyright 2020 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/closure_compiler/compile_js.gni") + +js_type_check("closure_compile") { + is_polymer3 = true + closure_flags = default_closure_args + [ + "browser_resolver_prefix_replacements=\"chrome://chrome-signin/=../../chrome/browser/resources/inline_login/\"", + "js_module_root=../../chrome/test/data/webui/", + "js_module_root=./gen/chrome/test/data/webui/", + "js_module_root=../../chrome/browser/resources/gaia_auth_host/", + "js_module_root=./gen/chrome/browser/resources/gaia_auth_host/", + ] + deps = [ + ":inline_login_test", + ":inline_login_test_util", + ] +} + +js_library("inline_login_test") { + deps = [ + ":inline_login_test_util", + "..:chai_assert", + "//chrome/browser/resources/inline_login:inline_login_app", + "//ui/webui/resources/js:assert.m", + ] + externs_list = [ "$externs_path/mocha-2.5.js" ] +} + +js_library("inline_login_test_util") { + deps = [ + "..:test_browser_proxy.m", + "//chrome/browser/resources/gaia_auth_host:authenticator.m", + "//chrome/browser/resources/inline_login:inline_login_browser_proxy", + "//ui/webui/resources/js/cr:event_target.m", + ] +}
diff --git a/chrome/test/data/webui/inline_login/inline_login_test.js b/chrome/test/data/webui/inline_login/inline_login_test.js index 11aa9b50..832d335b 100644 --- a/chrome/test/data/webui/inline_login/inline_login_test.js +++ b/chrome/test/data/webui/inline_login/inline_login_test.js
@@ -11,10 +11,10 @@ import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {assertDeepEquals, assertEquals, assertFalse, assertTrue} from '../chai_assert.js'; - import {getFakeAccountsList, TestAuthenticator, TestInlineLoginBrowserProxy} from './inline_login_test_util.js'; window.inline_login_test = {}; +const inline_login_test = window.inline_login_test; inline_login_test.suiteName = 'InlineLoginTest'; /** @enum {string} */ @@ -34,10 +34,12 @@ let testAuthenticator; setup(() => { + document.body.innerHTML = ''; testBrowserProxy = new TestInlineLoginBrowserProxy(); InlineLoginBrowserProxyImpl.instance_ = testBrowserProxy; document.body.innerHTML = ''; - inlineLoginComponent = document.createElement('inline-login-app'); + inlineLoginComponent = /** @type {InlineLoginAppElement} */ ( + document.createElement('inline-login-app')); document.body.appendChild(inlineLoginComponent); testAuthenticator = new TestAuthenticator(); inlineLoginComponent.setAuthExtHostForTest(testAuthenticator); @@ -64,14 +66,15 @@ assertEquals(fakeAuthExtensionData, testAuthenticator.data); assertEquals(fakeAuthExtensionData.authMode, testAuthenticator.authMode); - const fakeLstFetchResults = '{result: "fakeLstFetchResults"}'; - webUIListenerCallback('send-lst-fetch-results', fakeLstFetchResults); - assertEquals( - 1, - testBrowserProxy.getCallCount('lstFetchResults', fakeLstFetchResults)); - webUIListenerCallback('close-dialog'); assertEquals(1, testBrowserProxy.getCallCount('dialogClose')); + + const fakeLstFetchResults = '{result: "fakeLstFetchResults"}'; + webUIListenerCallback('send-lst-fetch-results', fakeLstFetchResults); + assertEquals(1, testBrowserProxy.getCallCount('lstFetchResults')); + return testBrowserProxy.whenCalled('lstFetchResults').then(args => { + assertEquals(fakeLstFetchResults, args); + }); }); test(assert(inline_login_test.TestNames.AuthExtHostCallbacks), async () => { @@ -101,7 +104,7 @@ testAuthenticator.dispatchEvent(new Event('getAccounts')); assertEquals(1, testBrowserProxy.getCallCount('getAccounts')); - testBrowserProxy.whenCalled('getAccounts').then(function() { + return testBrowserProxy.whenCalled('getAccounts').then(function() { assertEquals(1, testAuthenticator.getAccountsResponseCalls); assertDeepEquals( getFakeAccountsList(), testAuthenticator.getAccountsResponseResult); @@ -117,10 +120,10 @@ } let backInWebviewCalls = 0; - inlineLoginComponent.$.signinFrame.back = () => backInWebviewCalls++; + inlineLoginComponent.$$('#signinFrame').back = () => backInWebviewCalls++; // If we cannot go back in the webview - we should close the dialog. - inlineLoginComponent.$.signinFrame.canGoBack = () => false; + inlineLoginComponent.$$('#signinFrame').canGoBack = () => false; backButton.click(); assertEquals(1, testBrowserProxy.getCallCount('dialogClose')); assertEquals(0, backInWebviewCalls); @@ -128,7 +131,7 @@ testBrowserProxy.reset(); // Go back in the webview if possible. - inlineLoginComponent.$.signinFrame.canGoBack = () => true; + inlineLoginComponent.$$('#signinFrame').canGoBack = () => true; backButton.click(); assertEquals(0, testBrowserProxy.getCallCount('dialogClose')); assertEquals(1, backInWebviewCalls);
diff --git a/chrome/test/data/webui/inline_login/inline_login_test_util.js b/chrome/test/data/webui/inline_login/inline_login_test_util.js index 3691ea1..0a3fd56 100644 --- a/chrome/test/data/webui/inline_login/inline_login_test_util.js +++ b/chrome/test/data/webui/inline_login/inline_login_test_util.js
@@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {AuthMode, AuthParams} from 'chrome://chrome-signin/gaia_auth_host/authenticator.m.js'; import {InlineLoginBrowserProxy} from 'chrome://chrome-signin/inline_login_browser_proxy.js'; import {NativeEventTarget as EventTarget} from 'chrome://resources/js/cr/event_target.m.js'; @@ -16,9 +15,20 @@ export class TestAuthenticator extends EventTarget { constructor() { super(); - /** @type {?AuthMode} */ + // Note: We cannot import types from authenticator.m.js because we replace + // "chrome://chrome-signin/" with "chrome/browser/resources/inline_login/" + // and authenticator is in "chrome/browser/resources/gaia_auth_host/" + // folder. + + /** + * Type AuthMode (see Authenticator). + * @type {?Object} + */ this.authMode = null; - /** @type {?AuthParams} */ + /** + * Type AuthParams (see Authenticator). + * @type {?Object} + */ this.data = null; /** @type {number} */ this.loadCalls = 0; @@ -29,8 +39,9 @@ } /** - * @param {AuthMode} authMode Authorization mode. - * @param {AuthParams} data Parameters for the authorization flow. + * @param {Object} authMode Authorization mode (type AuthMode). + * @param {Object} data Parameters for the authorization flow (type + * AuthParams). */ load(authMode, data) { this.loadCalls++;
diff --git a/chrome/tools/build/win/resedit.py b/chrome/tools/build/win/resedit.py index e0971cf..723c4b0 100755 --- a/chrome/tools/build/win/resedit.py +++ b/chrome/tools/build/win/resedit.py
@@ -197,7 +197,7 @@ # Raise an error on failure. if ret == 0: error = win32api.GetLastError() - print "error", error + print ("error", error) raise RuntimeError(error) self._modified = True
diff --git a/chrome/updater/win/BUILD.gn b/chrome/updater/win/BUILD.gn index 09fb0110..f81f91e 100644 --- a/chrome/updater/win/BUILD.gn +++ b/chrome/updater/win/BUILD.gn
@@ -13,6 +13,7 @@ deps = [ ":updater", "//chrome/updater/win/installer:installer", + "//chrome/updater/win/signing", ] }
diff --git a/chrome/updater/win/signing/.style.yapf b/chrome/updater/win/signing/.style.yapf new file mode 100644 index 0000000..557fa7b --- /dev/null +++ b/chrome/updater/win/signing/.style.yapf
@@ -0,0 +1,2 @@ +[style] +based_on_style = pep8
diff --git a/chrome/updater/win/signing/BUILD.gn b/chrome/updater/win/signing/BUILD.gn new file mode 100644 index 0000000..3a4f7ed --- /dev/null +++ b/chrome/updater/win/signing/BUILD.gn
@@ -0,0 +1,12 @@ +# Copyright 2020 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. + +copy("signing") { + sources = [ + "//chrome/tools/build/win/resedit.py", + "sign.py", + ] + + outputs = [ "$root_out_dir/Updater Signing/{{source_file_part}}" ] +}
diff --git a/chrome/updater/win/signing/PRESUBMIT.py b/chrome/updater/win/signing/PRESUBMIT.py new file mode 100644 index 0000000..e939e77 --- /dev/null +++ b/chrome/updater/win/signing/PRESUBMIT.py
@@ -0,0 +1,20 @@ +# Copyright 2020 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. +"""Presubmit script for chrome/updater/win/signing/. + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into depot_tools. +""" + + +def CommonChecks(input_api, output_api): + return input_api.canned_checks.RunPylint(input_api, output_api) + + +def CheckChangeOnUpload(input_api, output_api): + return CommonChecks(input_api, output_api) + + +def CheckChangeOnCommit(input_api, output_api): + return CommonChecks(input_api, output_api)
diff --git a/chrome/updater/win/signing/sign.py b/chrome/updater/win/signing/sign.py new file mode 100755 index 0000000..32383f8 --- /dev/null +++ b/chrome/updater/win/signing/sign.py
@@ -0,0 +1,132 @@ +#!/usr/bin/python3 +# Copyright 2020 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 tool for signing an updater metainstaller and contained code. + +For example: +python3 sign.py --in_file UpdaterSetup.exe --out_file UpdaterSetup.signed.exe + +To run locally: + 1. Create a self-signed developer certificate if you haven't yet by executing + `New-SelfSignedCertificate -DnsName id@domain.tld -Type CodeSigning + -CertStoreLocation cert:\CurrentUser\My` in powershell. + 2. Run `autoninja -C .\out\yourBuildDir chrome/updater`. + 3. cd to your build dir and execute this script. +""" + +import argparse +import os.path +import shutil +import subprocess +import tempfile + +import resedit + + +class SigningError(Exception): + """Module exception class.""" + pass + + +class Signer(object): + """A container for a signing operation.""" + + def __init__(self, tmpdir, lzma_exe, signtool_exe, tagging_exe, identity): + """Inits a signer with the necessary tools.""" + self._tmpdir = tmpdir + self._lzma_exe = lzma_exe + self._signtool_exe = signtool_exe + self._tagging_exe = tagging_exe + self._identity = identity + + def _add_tagging_cert(self, in_file): + """Adds the tagging cert. Returns the path to the tagged file.""" + out_file = os.path.join(tempfile.mkdtemp(dir=self._tmpdir), + 'tagged_file') + subprocess.run([ + self._tagging_exe, '--set-superfluous-cert-tag=Gact2.0Omaha', + '--padded-length=8206', + '--out=%s' % out_file, in_file + ], + check=True) + return out_file + + def _sign_item(self, in_file): + """Sign an executable in-place.""" + # Retries may be required: lore states the timestamp server is flaky. + command = [ + self._signtool_exe, 'sign', '/v', '/tr', + 'http://timestamp.digicert.com', '/td', 'SHA256', '/fd', 'SHA256', + '/s', 'my', '/n', self._identity, in_file + ] + subprocess.run(command, check=True) + + def _sign_7z(self, in_file): + """Extract, sign, and rearchive the contents of a 7z archive.""" + tmp = tempfile.mkdtemp(dir=self._tmpdir) + subprocess.run([self._lzma_exe, 'x', in_file, + '-o%s' % tmp], + check=True) + signable_exts = frozenset([ + '.exe', '.dll', '.msi', '.cat', '.ps1', '.psm1', '.psd1', '.ps1xml' + ]) + for root, _, files in os.walk(tmp): + for f in files: + ext = os.path.splitext(f)[1].lower() + if ext in signable_exts: + self._sign_item(os.path.join(root, f)) + elif ext == '.7z': + self._sign_7z(os.path.join(root, f)) + subprocess.run([self._lzma_exe, 'a', in_file, '*'], + check=True, + cwd=tmp) + + def sign_metainstaller(self, in_file): + """Return a path to a signed copy of an updater metainstaller.""" + workdir = tempfile.mkdtemp(dir=self._tmpdir) + out_metainstaller = os.path.join(workdir, "metainstaller.exe") + resed = resedit.ResourceEditor(in_file, out_metainstaller) + resource = 'updater.packed.7z' + extracted_7z = os.path.join(workdir, resource) + resed.ExtractResource('B7', 1033, resource, extracted_7z) + self._sign_7z(extracted_7z) + resed.UpdateResource('B7', 1033, resource, extracted_7z) + resed.Commit() + self._sign_item(out_metainstaller) + return self._add_tagging_cert(out_metainstaller) + + +def main(): + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument('--in_file', + required=True, + help='The path to the metainstaller.') + parser.add_argument('--out_file', + required=True, + help='The path to save the signed metainstaller to.') + parser.add_argument('--lzma_7z', + default='7z.exe', + help='The path to the 7z executable.') + parser.add_argument( + '--signtool', + default='signtool.exe', + help='The path to the signtool executable. Look in depot_tools.') + parser.add_argument('--certificate_tag', + default='.\certificate_tag.exe', + help='The path to the certificate_tag executable.') + parser.add_argument('--identity', + default='Google', + help='The signing identity to use.') + args = parser.parse_args() + with tempfile.TemporaryDirectory() as tmpdir: + shutil.move( + Signer(tmpdir, args.lzma_7z, args.signtool, args.certificate_tag, + args.identity).sign_metainstaller(args.in_file), + args.out_file) + + +if __name__ == '__main__': + main()
diff --git a/chromecast/media/audio/mixer_service/audio_socket_service_tcp.cc b/chromecast/media/audio/mixer_service/audio_socket_service_tcp.cc index ad73b2b..c1bb8084 100644 --- a/chromecast/media/audio/mixer_service/audio_socket_service_tcp.cc +++ b/chromecast/media/audio/mixer_service/audio_socket_service_tcp.cc
@@ -28,8 +28,9 @@ const std::string& endpoint, int port) { net::IPEndPoint ip_endpoint(net::IPAddress::IPv4Localhost(), port); - return std::make_unique<net::TCPClientSocket>( - net::AddressList(ip_endpoint), nullptr, nullptr, net::NetLogSource()); + return std::make_unique<net::TCPClientSocket>(net::AddressList(ip_endpoint), + nullptr, nullptr, nullptr, + net::NetLogSource()); } AudioSocketService::AudioSocketService(const std::string& endpoint,
diff --git a/chromecast/media/cma/backend/saved_volumes.cc b/chromecast/media/cma/backend/saved_volumes.cc index fe55f52..b9c9e49 100644 --- a/chromecast/media/cma/backend/saved_volumes.cc +++ b/chromecast/media/cma/backend/saved_volumes.cc
@@ -62,25 +62,30 @@ LOG(INFO) << "No saved volumes found"; // If saved_volumes does not exist, use per-device default if it exists. - JSONFileValueDeserializer cast_audio_deserializer( - media::CastAudioJson::GetFilePath()); - auto cast_audio_config = deserializer.Deserialize(nullptr, nullptr); + auto path = media::CastAudioJson::GetFilePath(); + JSONFileValueDeserializer cast_audio_deserializer(path); + auto cast_audio_config = + cast_audio_deserializer.Deserialize(nullptr, nullptr); if (!cast_audio_config || !cast_audio_config->is_dict()) { + LOG(INFO) << "Invalid JSON from " << path; return volumes; } const base::Value* default_volume_dict = cast_audio_config->FindDictKey(kKeyDefaultVolume); if (!default_volume_dict) { + LOG(INFO) << "No default volumes specified in " << path; return volumes; } for (auto type : types) { - auto v = default_volume_dict->FindDoublePath(ContentTypeToDbFSKey(type)); + std::string key = ContentTypeToDbFSKey(type); + auto v = default_volume_dict->FindDoublePath(key); if (v) { - LOG(INFO) << "Using default volume for " << ContentTypeToDbFSKey(type) - << " of " << v.value(); + LOG(INFO) << "Using default volume for " << key << " of " << v.value(); volumes[type] = v.value(); + } else { + LOG(INFO) << "No default volume for " << key; } } return volumes;
diff --git a/chromeos/memory/pressure/pressure.cc b/chromeos/memory/pressure/pressure.cc index f3112ed..87152a8 100644 --- a/chromeos/memory/pressure/pressure.cc +++ b/chromeos/memory/pressure/pressure.cc
@@ -173,6 +173,11 @@ ram_swap_weight); } +std::pair<uint64_t, uint64_t> GetMemoryMarginsKB() { + // TODO(b/149833548): Implement this function. + return {0, 0}; +} + void UpdateMemoryParameters() { reserved_free = GetReservedMemoryKB(); min_filelist = ReadFileToUint64(base::FilePath(kMinFilelist));
diff --git a/chromeos/memory/pressure/pressure.h b/chromeos/memory/pressure/pressure.h index e5c7055..b7b057bc 100644 --- a/chromeos/memory/pressure/pressure.h +++ b/chromeos/memory/pressure/pressure.h
@@ -7,6 +7,7 @@ #include <cstdint> #include <string> +#include <utility> #include "base/process/process_metrics.h" #include "chromeos/chromeos_export.h" @@ -26,7 +27,12 @@ uint64_t ram_swap_weight); // GetAvailableMemoryKB returns the available memory in KiB. -uint64_t GetAvailableMemoryKB(); +CHROMEOS_EXPORT uint64_t GetAvailableMemoryKB(); + +// GetMemoryMarginsKB returns a pair of uint64_t. The first value is the +// critical memory pressure level, the second value is the moderate memory +// pressure level. +CHROMEOS_EXPORT std::pair<uint64_t, uint64_t> GetMemoryMarginsKB(); // The memory parameters are saved for optimization. If these memory // parameters are changed, call this function to update the saved values.
diff --git a/chromeos/profiles/orderfile.newest.txt b/chromeos/profiles/orderfile.newest.txt index ae1b643..a33b16d 100644 --- a/chromeos/profiles/orderfile.newest.txt +++ b/chromeos/profiles/orderfile.newest.txt
@@ -1 +1 @@ -chromeos-chrome-orderfile-field-86-4240.27-1600081136-benchmark-86.0.4240.36-r1.orderfile.xz +chromeos-chrome-orderfile-field-87-4183.84-1598867895-benchmark-87.0.4247.0-r1.orderfile.xz
diff --git a/chromeos/services/secure_channel/bluetooth_helper.h b/chromeos/services/secure_channel/bluetooth_helper.h index a9aeb438..4bea41ade 100644 --- a/chromeos/services/secure_channel/bluetooth_helper.h +++ b/chromeos/services/secure_channel/bluetooth_helper.h
@@ -22,6 +22,9 @@ // Provides the ability to generate BLE advertisement service data and, given // service data that has been received in a BLE discovery session, identify the // device which sent the advertisement. +// +// Also provides functionality to retrieve the Bluetooth public address for a +// device for use in Bluetooth Classic connections. class BluetoothHelper { public: virtual ~BluetoothHelper(); @@ -43,6 +46,10 @@ const std::string& service_data, const DeviceIdPairSet& device_id_pair_set); + // Note: An empty string is returned if there is no known public address. + virtual std::string GetBluetoothPublicAddress( + const std::string& device_id) = 0; + protected: BluetoothHelper();
diff --git a/chromeos/services/secure_channel/bluetooth_helper_impl.cc b/chromeos/services/secure_channel/bluetooth_helper_impl.cc index c0dca08..1ad5f31 100644 --- a/chromeos/services/secure_channel/bluetooth_helper_impl.cc +++ b/chromeos/services/secure_channel/bluetooth_helper_impl.cc
@@ -130,6 +130,16 @@ return base::nullopt; } +std::string BluetoothHelperImpl::GetBluetoothPublicAddress( + const std::string& device_id) { + base::Optional<multidevice::RemoteDeviceRef> device = + remote_device_cache_->GetRemoteDevice(base::nullopt /* instance_id */, + device_id /* legacy_device_id */); + if (device) + return device->bluetooth_public_address(); + return std::string(); +} + base::Optional<BluetoothHelper::DeviceWithBackgroundBool> BluetoothHelperImpl::PerformIdentifyRemoteDevice( const std::string& service_data,
diff --git a/chromeos/services/secure_channel/bluetooth_helper_impl.h b/chromeos/services/secure_channel/bluetooth_helper_impl.h index f3e6eda..86161674 100644 --- a/chromeos/services/secure_channel/bluetooth_helper_impl.h +++ b/chromeos/services/secure_channel/bluetooth_helper_impl.h
@@ -57,6 +57,7 @@ base::Optional<DeviceWithBackgroundBool> PerformIdentifyRemoteDevice( const std::string& service_data, const DeviceIdPairSet& device_id_pair_set) override; + std::string GetBluetoothPublicAddress(const std::string& device_id) override; base::Optional<BluetoothHelper::DeviceWithBackgroundBool> PerformIdentifyRemoteDevice(
diff --git a/chromeos/services/secure_channel/bluetooth_helper_impl_unittest.cc b/chromeos/services/secure_channel/bluetooth_helper_impl_unittest.cc index aeb1cd9..2c65cd74 100644 --- a/chromeos/services/secure_channel/bluetooth_helper_impl_unittest.cc +++ b/chromeos/services/secure_channel/bluetooth_helper_impl_unittest.cc
@@ -83,6 +83,7 @@ .SetInstanceId("local instance id " + base::NumberToString(id)) .SetPublicKey("local public key " + base::NumberToString(id)) .SetBeaconSeeds(CreateFakeBeaconSeeds(id)) + .SetBluetoothPublicAddress(base::NumberToString(id)) .Build(); } @@ -304,6 +305,12 @@ EXPECT_FALSE(device_with_background_bool); } +TEST_F(SecureChannelBluetoothHelperImplTest, BluetoothPublicAddress) { + EXPECT_EQ("1", test_local_device_1_.bluetooth_public_address()); + EXPECT_EQ("1", helper_->GetBluetoothPublicAddress( + test_local_device_1_.GetDeviceId())); +} + } // namespace secure_channel } // namespace chromeos
diff --git a/chromeos/services/secure_channel/fake_bluetooth_helper.cc b/chromeos/services/secure_channel/fake_bluetooth_helper.cc index 0b92899..45cab15 100644 --- a/chromeos/services/secure_channel/fake_bluetooth_helper.cc +++ b/chromeos/services/secure_channel/fake_bluetooth_helper.cc
@@ -34,6 +34,13 @@ is_background_advertisement)}); } +void FakeBluetoothHelper::SetBluetoothPublicAddress( + const std::string& device_id, + const std::string& bluetooth_public_address) { + device_id_to_bluetooth_public_address_map_[device_id] = + bluetooth_public_address; +} + std::unique_ptr<DataWithTimestamp> FakeBluetoothHelper::GenerateForegroundAdvertisement( const DeviceIdPair& device_id_pair) { @@ -56,6 +63,11 @@ return service_data_to_device_with_background_bool_map_.at(service_data); } +std::string FakeBluetoothHelper::GetBluetoothPublicAddress( + const std::string& device_id) { + return device_id_to_bluetooth_public_address_map_[device_id]; +} + } // namespace secure_channel } // namespace chromeos
diff --git a/chromeos/services/secure_channel/fake_bluetooth_helper.h b/chromeos/services/secure_channel/fake_bluetooth_helper.h index f028d81..a71ed6e1 100644 --- a/chromeos/services/secure_channel/fake_bluetooth_helper.h +++ b/chromeos/services/secure_channel/fake_bluetooth_helper.h
@@ -37,6 +37,10 @@ multidevice::RemoteDeviceRef identified_device, bool is_background_advertisement); + // Sets the data to be returned by a GetBluetoothPublicAddress() call. + void SetBluetoothPublicAddress(const std::string& device_id, + const std::string& bluetooth_public_address); + private: // BluetoothHelper: std::unique_ptr<DataWithTimestamp> GenerateForegroundAdvertisement( @@ -44,6 +48,7 @@ base::Optional<DeviceWithBackgroundBool> PerformIdentifyRemoteDevice( const std::string& service_data, const DeviceIdPairSet& device_id_pair_set) override; + std::string GetBluetoothPublicAddress(const std::string& device_id) override; std::unordered_map<DeviceIdPair, DataWithTimestamp, DeviceIdPairHash> device_id_pair_to_service_data_map_; @@ -51,6 +56,9 @@ std::unordered_map<std::string, DeviceWithBackgroundBool> service_data_to_device_with_background_bool_map_; + std::unordered_map<std::string, std::string> + device_id_to_bluetooth_public_address_map_; + DISALLOW_COPY_AND_ASSIGN(FakeBluetoothHelper); };
diff --git a/components/autofill/core/browser/autofill_test_utils.cc b/components/autofill/core/browser/autofill_test_utils.cc index 67cdd64..59461e39 100644 --- a/components/autofill/core/browser/autofill_test_utils.cc +++ b/components/autofill/core/browser/autofill_test_utils.cc
@@ -487,6 +487,7 @@ "2109" /* Mastercard */, NextMonth().c_str(), NextYear().c_str(), "1"); credit_card.SetNetworkForMaskedCard(kMasterCard); + credit_card.set_instrument_id(1); return credit_card; } @@ -707,6 +708,7 @@ card.set_record_type(CreditCard::MASKED_SERVER_CARD); card.SetNumber(card.LastFourDigits()); card.SetNetworkForMaskedCard(card.network()); + card.set_instrument_id(card.instrument_id()); } table->SetServerCreditCards(as_masked_cards);
diff --git a/components/autofill/core/browser/data_model/autofill_profile.cc b/components/autofill/core/browser/data_model/autofill_profile.cc index 0713aeea..16560512 100644 --- a/components/autofill/core/browser/data_model/autofill_profile.cc +++ b/components/autofill/core/browser/data_model/autofill_profile.cc
@@ -461,6 +461,30 @@ return 1; } + if (base::FeatureList::IsEnabled( + features::kAutofillAddressEnhancementVotes)) { + const ServerFieldType new_types[] = { + ADDRESS_HOME_HOUSE_NUMBER, + ADDRESS_HOME_STREET_NAME, + ADDRESS_HOME_DEPENDENT_STREET_NAME, + ADDRESS_HOME_PREMISE_NAME, + ADDRESS_HOME_SUBPREMISE, + }; + for (ServerFieldType type : new_types) { + int comparison = GetRawInfo(type).compare(profile.GetRawInfo(type)); + if (comparison != 0) { + return comparison; + } + } + + for (ServerFieldType type : new_types) { + if (GetVerificationStatus(type) < profile.GetVerificationStatus(type)) + return -1; + if (GetVerificationStatus(type) > profile.GetVerificationStatus(type)) + return 1; + } + } + return 0; }
diff --git a/components/autofill/core/browser/data_model/credit_card.cc b/components/autofill/core/browser/data_model/credit_card.cc index a9a17ff7..b8ad297 100644 --- a/components/autofill/core/browser/data_model/credit_card.cc +++ b/components/autofill/core/browser/data_model/credit_card.cc
@@ -120,7 +120,8 @@ expiration_month_(0), expiration_year_(0), server_status_(OK), - card_issuer_(ISSUER_UNKNOWN) {} + card_issuer_(ISSUER_UNKNOWN), + instrument_id_(0) {} CreditCard::CreditCard(RecordType type, const std::string& server_id) : CreditCard() {
diff --git a/components/autofill/core/browser/webdata/autofill_sync_bridge_util.cc b/components/autofill/core/browser/webdata/autofill_sync_bridge_util.cc index badd7f1..48dc9b3 100644 --- a/components/autofill/core/browser/webdata/autofill_sync_bridge_util.cc +++ b/components/autofill/core/browser/webdata/autofill_sync_bridge_util.cc
@@ -103,6 +103,7 @@ static_cast<CreditCard::Issuer>(card.card_issuer().issuer())); if (!card.nickname().empty()) result.SetNickname(base::UTF8ToUTF16(card.nickname())); + result.set_instrument_id(card.instrument_id()); return result; } @@ -247,6 +248,7 @@ wallet_card->set_nickname(base::UTF16ToUTF8(card.nickname())); wallet_card->mutable_card_issuer()->set_issuer( static_cast<sync_pb::CardIssuer::Issuer>(card.card_issuer())); + wallet_card->set_instrument_id(card.instrument_id()); } void SetAutofillWalletSpecificsFromPaymentsCustomerData(
diff --git a/components/autofill/core/browser/webdata/autofill_table.cc b/components/autofill/core/browser/webdata/autofill_table.cc index 10e5914..029b31da 100644 --- a/components/autofill/core/browser/webdata/autofill_table.cc +++ b/components/autofill/core/browser/webdata/autofill_table.cc
@@ -1434,7 +1434,8 @@ "metadata.billing_address_id," // 10 "bank_name," // 11 "nickname," // 12 - "card_issuer " // 13 + "card_issuer," // 13 + "instrument_id " // 14 "FROM masked_credit_cards masked " "LEFT OUTER JOIN unmasked_credit_cards USING (id) " "LEFT OUTER JOIN server_card_metadata metadata USING (id)")); @@ -1480,6 +1481,7 @@ card->SetNickname(s.ColumnString16(index++)); card->set_card_issuer( static_cast<CreditCard::Issuer>(s.ColumnInt(index++))); + card->set_instrument_id(s.ColumnInt64(index++)); credit_cards->push_back(std::move(card)); } return s.Succeeded(); @@ -1730,17 +1732,18 @@ // Add all the masked cards. sql::Statement masked_insert( db_->GetUniqueStatement("INSERT INTO masked_credit_cards(" - "id," // 0 - "network," // 1 - "status," // 2 - "name_on_card," // 3 - "last_four," // 4 - "exp_month," // 5 - "exp_year," // 6 - "bank_name," // 7 - "nickname," // 8 - "card_issuer)" // 9 - "VALUES (?,?,?,?,?,?,?,?,?,?)")); + "id," // 0 + "network," // 1 + "status," // 2 + "name_on_card," // 3 + "last_four," // 4 + "exp_month," // 5 + "exp_year," // 6 + "bank_name," // 7 + "nickname," // 8 + "card_issuer," // 9 + "instrument_id)" // 10 + "VALUES (?,?,?,?,?,?,?,?,?,?,?)")); int index; for (const CreditCard& card : credit_cards) { DCHECK_EQ(CreditCard::MASKED_SERVER_CARD, card.record_type()); @@ -1757,6 +1760,7 @@ masked_insert.BindString(index++, card.bank_name()); masked_insert.BindString16(index++, card.nickname()); masked_insert.BindInt(index++, static_cast<int>(card.card_issuer())); + masked_insert.BindInt64(index++, card.instrument_id()); masked_insert.Run(); masked_insert.Reset(true); } @@ -3378,17 +3382,18 @@ DCHECK_GT(db_->transaction_nesting(), 0); sql::Statement masked_insert( db_->GetUniqueStatement("INSERT INTO masked_credit_cards(" - "id," // 0 - "network," // 1 - "status," // 2 - "name_on_card," // 3 - "last_four," // 4 - "exp_month," // 5 - "exp_year," // 6 - "bank_name," // 7 - "nickname," // 8 - "card_issuer)" // 9 - "VALUES (?,?,?,?,?,?,?,?,?,?)")); + "id," // 0 + "network," // 1 + "status," // 2 + "name_on_card," // 3 + "last_four," // 4 + "exp_month," // 5 + "exp_year," // 6 + "bank_name," // 7 + "nickname," // 8 + "card_issuer," // 9 + "instrument_id)" // 10 + "VALUES (?,?,?,?,?,?,?,?,?,?,?)")); int index; for (const CreditCard& card : credit_cards) { DCHECK_EQ(CreditCard::MASKED_SERVER_CARD, card.record_type()); @@ -3405,6 +3410,7 @@ masked_insert.BindString(index++, card.bank_name()); masked_insert.BindString16(index++, card.nickname()); masked_insert.BindInt(index++, static_cast<int>(card.card_issuer())); + masked_insert.BindInt(index++, card.instrument_id()); masked_insert.Run(); masked_insert.Reset(true);
diff --git a/components/autofill/core/browser/webdata/autofill_table_unittest.cc b/components/autofill/core/browser/webdata/autofill_table_unittest.cc index a0df43ad..5c7b07808 100644 --- a/components/autofill/core/browser/webdata/autofill_table_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_table_unittest.cc
@@ -2447,6 +2447,7 @@ inputs[0].SetRawInfo(CREDIT_CARD_EXP_MONTH, ASCIIToUTF16("1")); inputs[0].SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, ASCIIToUTF16("2020")); inputs[0].SetRawInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("4111111111111111")); + inputs[0].set_instrument_id(321); inputs.push_back(CreditCard(CreditCard::MASKED_SERVER_CARD, "b456")); inputs[1].SetRawInfo(CREDIT_CARD_NAME_FULL, ASCIIToUTF16("Rick Roman")); @@ -2458,6 +2459,7 @@ base::string16 nickname = ASCIIToUTF16("Grocery card"); inputs[1].SetNickname(nickname); inputs[1].set_card_issuer(CreditCard::Issuer::GOOGLE); + inputs[1].set_instrument_id(123); test::SetServerCreditCards(table_.get(), inputs); @@ -2488,6 +2490,9 @@ EXPECT_EQ(CreditCard::Issuer::ISSUER_UNKNOWN, outputs[0]->card_issuer()); EXPECT_EQ(CreditCard::Issuer::GOOGLE, outputs[1]->card_issuer()); + + EXPECT_EQ(321, outputs[0]->instrument_id()); + EXPECT_EQ(123, outputs[1]->instrument_id()); } TEST_F(AutofillTableTest, SetGetRemoveServerCardMetadata) { @@ -2697,6 +2702,7 @@ inputs[0].SetNetworkForMaskedCard(kVisaCard); inputs[0].SetServerStatus(CreditCard::EXPIRED); inputs[0].SetNickname(ASCIIToUTF16("Grocery card")); + inputs[0].set_instrument_id(1); table_->SetServerCardsData(inputs); // Make sure the card was added correctly.
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc index 3d4b6c1f..0af9de6e 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_sync_bridge_unittest.cc
@@ -882,6 +882,7 @@ EXPECT_EQ(card.billing_address_id(), cards[0]->billing_address_id()); EXPECT_EQ(card.nickname(), cards[0]->nickname()); EXPECT_EQ(card.card_issuer(), cards[0]->card_issuer()); + EXPECT_EQ(card.instrument_id(), cards[0]->instrument_id()); // Also make sure that those types are not empty, to exercice all the code // paths. @@ -890,6 +891,7 @@ EXPECT_NE(0, card.expiration_month()); EXPECT_NE(0, card.expiration_year()); EXPECT_FALSE(card.nickname().empty()); + EXPECT_NE(0, card.instrument_id()); } // Test that all field values for a cloud token data sent from the server are
diff --git a/components/browser_ui/android/bottomsheet/internal/java/src/org/chromium/components/browser_ui/bottomsheet/BottomSheet.java b/components/browser_ui/android/bottomsheet/internal/java/src/org/chromium/components/browser_ui/bottomsheet/BottomSheet.java index efcf562..e44d3a2 100644 --- a/components/browser_ui/android/bottomsheet/internal/java/src/org/chromium/components/browser_ui/bottomsheet/BottomSheet.java +++ b/components/browser_ui/android/bottomsheet/internal/java/src/org/chromium/components/browser_ui/bottomsheet/BottomSheet.java
@@ -497,7 +497,6 @@ * Show content in the bottom sheet's content area. * @param content The {@link BottomSheetContent} to show, or null if no content should be shown. */ - @VisibleForTesting void showContent(@Nullable final BottomSheetContent content) { // If the desired content is already showing, do nothing. if (mSheetContent == content) return;
diff --git a/components/browser_ui/android/bottomsheet/internal/java/src/org/chromium/components/browser_ui/bottomsheet/BottomSheetControllerImpl.java b/components/browser_ui/android/bottomsheet/internal/java/src/org/chromium/components/browser_ui/bottomsheet/BottomSheetControllerImpl.java index 7e31f24..68685b6 100644 --- a/components/browser_ui/android/bottomsheet/internal/java/src/org/chromium/components/browser_ui/bottomsheet/BottomSheetControllerImpl.java +++ b/components/browser_ui/android/bottomsheet/internal/java/src/org/chromium/components/browser_ui/bottomsheet/BottomSheetControllerImpl.java
@@ -386,7 +386,7 @@ // If already showing the requested content, do nothing. if (content == mBottomSheet.getCurrentSheetContent()) return true; - boolean shouldSuppressExistingContent = mBottomSheet.getCurrentSheetContent() != null + boolean shouldSwapForPriorityContent = mBottomSheet.getCurrentSheetContent() != null && content.getPriority() < mBottomSheet.getCurrentSheetContent().getPriority() && canBottomSheetSwitchContent(); @@ -394,13 +394,20 @@ // necessary. If already hidden, |showNextContent| will handle the request. mContentQueue.add(content); - if (mBottomSheet.getCurrentSheetContent() == null) { + if (mBottomSheet.getCurrentSheetContent() == null && !mSuppressionTokens.hasTokens()) { showNextContent(animate); return true; - } else if (shouldSuppressExistingContent) { + } else if (shouldSwapForPriorityContent) { mContentQueue.add(mBottomSheet.getCurrentSheetContent()); - mBottomSheet.setSheetState(SheetState.HIDDEN, animate); - return true; + if (!mSuppressionTokens.hasTokens()) { + mBottomSheet.setSheetState(SheetState.HIDDEN, animate); + return true; + } else { + // Since the sheet is already suppressed and hidden, clear the sheet's content if + // the requested content is higher priority. The unsuppression logic will figure out + // which content to show next. + mBottomSheet.showContent(null); + } } return false; }
diff --git a/components/cast/named_message_port_connector/BUILD.gn b/components/cast/named_message_port_connector/BUILD.gn deleted file mode 100644 index 6db6a65..0000000 --- a/components/cast/named_message_port_connector/BUILD.gn +++ /dev/null
@@ -1,33 +0,0 @@ -# Copyright 2020 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("//tools/grit/grit_rule.gni") - -source_set("named_message_port_connector") { - sources = [ - "named_message_port_connector.cc", - "named_message_port_connector.h", - ] - - deps = [ - "//base", - "//components/cast:export", - ] - - public_deps = [ - ":resources", - "//third_party/blink/public/common", - ] -} - -grit("resources") { - source = "named_message_port_connector_resources.grd" - outputs = [ - "grit/named_message_port_connector_resources.h", - "named_message_port_connector_resources.pak", - ] - - # Allow GRIT to assign IDs using its default set of base IDs. - resource_ids = "" -}
diff --git a/components/cast/named_message_port_connector/DEPS b/components/cast/named_message_port_connector/DEPS deleted file mode 100644 index 018d44d5..0000000 --- a/components/cast/named_message_port_connector/DEPS +++ /dev/null
@@ -1,4 +0,0 @@ -include_rules = [ - "+third_party/blink/public/common/messaging", - "+ui/base/resource", -]
diff --git a/components/cast/named_message_port_connector/named_message_port_connector.cc b/components/cast/named_message_port_connector/named_message_port_connector.cc deleted file mode 100644 index 3f5c312..0000000 --- a/components/cast/named_message_port_connector/named_message_port_connector.cc +++ /dev/null
@@ -1,59 +0,0 @@ -// Copyright 2020 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/cast/named_message_port_connector/named_message_port_connector.h" - -#include <string> -#include <utility> - -#include "base/logging.h" -#include "base/strings/string16.h" -#include "base/strings/utf_string_conversions.h" - -namespace cast_api_bindings { - -NamedMessagePortConnector::NamedMessagePortConnector() = default; - -NamedMessagePortConnector::~NamedMessagePortConnector() = default; - -void NamedMessagePortConnector::RegisterPortHandler( - PortConnectedCallback handler) { - handler_ = std::move(handler); -} - -// Receives the MessagePort and forwards ports to their corresponding binding -// handlers. -bool NamedMessagePortConnector::OnMessage( - blink::WebMessagePort::Message message) { - if (message.ports.size() != 1) { - DLOG(FATAL) << "Only one control port should be provided"; - return false; - } - - // Read the port ID. - base::string16 data_utf16 = std::move(message.data); - std::string binding_id; - if (!base::UTF16ToUTF8(data_utf16.data(), data_utf16.size(), &binding_id)) - return false; - - return handler_.Run(binding_id, std::move(message.ports[0])); -} - -blink::WebMessagePort::Message NamedMessagePortConnector::GetConnectMessage() { - constexpr char kControlPortConnectMessage[] = "cast.master.connect"; - - // Pass the control message port into the page as an HTML5 MessageChannel - // message. - auto port_pair = blink::WebMessagePort::CreatePair(); - - control_port_ = std::move(port_pair.first); - control_port_.SetReceiver(this, base::ThreadTaskRunnerHandle::Get()); - - blink::WebMessagePort::Message connect_message; - connect_message.data = base::UTF8ToUTF16(kControlPortConnectMessage); - connect_message.ports.push_back(std::move(port_pair.second)); - return connect_message; -} - -} // namespace cast_api_bindings
diff --git a/components/cast/named_message_port_connector/named_message_port_connector.h b/components/cast/named_message_port_connector/named_message_port_connector.h deleted file mode 100644 index 6ebe36e..0000000 --- a/components/cast/named_message_port_connector/named_message_port_connector.h +++ /dev/null
@@ -1,54 +0,0 @@ -// Copyright 2020 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_CAST_NAMED_MESSAGE_PORT_CONNECTOR_NAMED_MESSAGE_PORT_CONNECTOR_H_ -#define COMPONENTS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_NAMED_MESSAGE_PORT_CONNECTOR_H_ - -#include "base/callback.h" -#include "base/strings/string_piece.h" -#include "third_party/blink/public/common/messaging/web_message_port.h" - -namespace cast_api_bindings { - -// Injects an API into |frame| through which it can connect MessagePorts to one -// or more services registered by the caller. -// Platform specific details, such as how the script resources are injected, and -// how the connection message is posted to the page, are delegated to the -// caller. -// TODO(crbug.com/1126571): Migrate off Blink::WebMessagePort to a -// platform-agnostic MessagePort abstraction. -class NamedMessagePortConnector - : public blink::WebMessagePort::MessageReceiver { - public: - // Signature of callback to be invoked when a port is connected. - // The callback should return true if the connection request was valid. - using PortConnectedCallback = - base::RepeatingCallback<bool(base::StringPiece, blink::WebMessagePort)>; - - NamedMessagePortConnector(); - ~NamedMessagePortConnector() override; - - NamedMessagePortConnector(const NamedMessagePortConnector&) = delete; - NamedMessagePortConnector& operator=(const NamedMessagePortConnector&) = - delete; - - // Sets the callback which will be invoked when a port is connected. - void RegisterPortHandler(PortConnectedCallback handler); - - // Returns a connection message which should be posted to the page on - // every navigation. - // Calling this method will drop any preexisting connections made to the page. - blink::WebMessagePort::Message GetConnectMessage(); - - private: - // blink::WebMessagePort::MessageReceiver implementation: - bool OnMessage(blink::WebMessagePort::Message message) override; - - PortConnectedCallback handler_; - blink::WebMessagePort control_port_; -}; - -} // namespace cast_api_bindings - -#endif // COMPONENTS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_NAMED_MESSAGE_PORT_CONNECTOR_H_
diff --git a/components/cast/named_message_port_connector/named_message_port_connector.js b/components/cast/named_message_port_connector/named_message_port_connector.js deleted file mode 100644 index 6ce9a3e..0000000 --- a/components/cast/named_message_port_connector/named_message_port_connector.js +++ /dev/null
@@ -1,78 +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. - -'use strict'; - -if (!cast) { - // eslint-disable-next-line no-var - var cast = new Object; -} - -if (!cast.__platform__) { - cast.__platform__ = new Object; -} - -// Creates named HTML5 MessagePorts that are connected to native code. -cast.__platform__.PortConnector = new class { - constructor() { - this.controlPort_ = null; - - // A map of ports waiting to be published to the controlPort_, keyed by - // string IDs. - this.pendingPorts_ = {}; - - this.listener = this.onMessageEvent.bind(this); - window.addEventListener( - 'message', this.listener, - true // Let the listener handle events before they hit the DOM tree. - ); - } - - // Returns a MessagePort whose channel will be passed to the native code. - // The channel can be used immediately after construction. Outgoing messages - // will be automatically buffered until the connection is established. - bind(id) { - const channel = new MessageChannel(); - if (this.controlPort_) { - this.sendPort(id, channel.port2); - } else { - this.pendingPorts_[id] = channel.port2; - } - - return channel.port1; - } - - sendPort(portId, port) { - this.controlPort_.postMessage(portId, [port]); - } - - // Receives a control port from native code. - onMessageEvent(e) { - // Only process window.onmessage events which are intended for this class. - if (e.data != 'cast.master.connect') { - return; - } - - if (e.ports.length != 1) { - console.error( - 'Expected only one MessagePort, got ' + e.ports.length + ' instead.'); - for (const i in e.ports) { - e.ports[i].close(); - } - return; - } - - this.controlPort_ = e.ports[0]; - for (const portId in this.pendingPorts_) { - this.sendPort(portId, this.pendingPorts_[portId]); - } - this.pendingPorts_ = null; - - e.stopPropagation(); - - // No need to receive more onmessage events. - window.removeEventListener('message', this.listener); - } -} -();
diff --git a/components/cast/named_message_port_connector/named_message_port_connector_resources.grd b/components/cast/named_message_port_connector/named_message_port_connector_resources.grd deleted file mode 100644 index d70601d5..0000000 --- a/components/cast/named_message_port_connector/named_message_port_connector_resources.grd +++ /dev/null
@@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<grit latest_public_release="0" current_release="1" output_all_resource_defines="false"> - <outputs> - <output filename="grit/named_message_port_connector_resources.h" type="rc_header"> - <emit emit_type='prepend'></emit> - </output> - <output filename="named_message_port_connector_resources.pak" type="data_package" /> - </outputs> - <release seq="1"> - <includes> - <include name="IDR_PORT_CONNECTOR_JS" file="named_message_port_connector.js" type="BINDATA" /> - </includes> - </release> -</grit>
diff --git a/components/cast_channel/cast_socket_unittest.cc b/components/cast_channel/cast_socket_unittest.cc index f7e8ea6..934039e 100644 --- a/components/cast_channel/cast_socket_unittest.cc +++ b/components/cast_channel/cast_socket_unittest.cc
@@ -37,6 +37,7 @@ #include "net/base/address_list.h" #include "net/base/net_errors.h" #include "net/cert/pem.h" +#include "net/socket/client_socket_factory.h" #include "net/socket/socket_test_util.h" #include "net/socket/ssl_client_socket.h" #include "net/socket/ssl_server_socket.h" @@ -298,6 +299,7 @@ std::unique_ptr<net::TransportClientSocket> CreateTransportClientSocket( const net::AddressList&, std::unique_ptr<net::SocketPerformanceWatcher>, + net::NetworkQualityEstimator*, net::NetLog*, const net::NetLogSource&) override { if (tcp_client_socket_) @@ -489,7 +491,7 @@ ASSERT_EQ(net::OK, tcp_server_socket_->GetLocalAddress(&server_address)); tcp_client_socket_.reset( new net::TCPClientSocket(net::AddressList(server_address), nullptr, - nullptr, net::NetLogSource())); + nullptr, nullptr, net::NetLogSource())); std::unique_ptr<net::StreamSocket> accepted_socket; accept_result_ = tcp_server_socket_->Accept(
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc index 6c14def..4ca1923e 100644 --- a/components/exo/shell_surface.cc +++ b/components/exo/shell_surface.cc
@@ -140,7 +140,7 @@ void ShellSurface::SetParent(ShellSurface* parent) { TRACE_EVENT1("exo", "ShellSurface::SetParent", "parent", - parent ? base::UTF16ToASCII(parent->title_) : "null"); + parent ? base::UTF16ToASCII(parent->GetWindowTitle()) : "null"); SetParentWindow(parent ? parent->GetWidget()->GetNativeWindow() : nullptr); }
diff --git a/components/exo/shell_surface_base.cc b/components/exo/shell_surface_base.cc index 1a71e2bf..ecd10962 100644 --- a/components/exo/shell_surface_base.cc +++ b/components/exo/shell_surface_base.cc
@@ -316,6 +316,8 @@ SetRootSurface(surface); host_window()->Show(); set_owned_by_client(); + + SetShowTitle(false); } ShellSurfaceBase::~ShellSurfaceBase() { @@ -352,18 +354,12 @@ void ShellSurfaceBase::SetTitle(const base::string16& title) { TRACE_EVENT1("exo", "ShellSurfaceBase::SetTitle", "title", base::UTF16ToUTF8(title)); - - title_ = title; - if (widget_) - widget_->UpdateWindowTitle(); + WidgetDelegate::SetTitle(title); } void ShellSurfaceBase::SetIcon(const gfx::ImageSkia& icon) { TRACE_EVENT0("exo", "ShellSurfaceBase::SetIcon"); - - icon_ = icon; - if (widget_) - widget_->UpdateWindowIcon(); + WidgetDelegate::SetIcon(icon); } void ShellSurfaceBase::SetSystemModal(bool system_modal) { @@ -521,7 +517,7 @@ ShellSurfaceBase::AsTracedValue() const { std::unique_ptr<base::trace_event::TracedValue> value( new base::trace_event::TracedValue()); - value->SetString("title", base::UTF16ToUTF8(title_)); + value->SetString("title", base::UTF16ToUTF8(GetWindowTitle())); if (GetWidget() && GetWidget()->GetNativeWindow()) { const std::string* application_id = GetShellApplicationId(GetWidget()->GetNativeWindow()); @@ -694,18 +690,6 @@ return !parent_ && can_minimize_; } -base::string16 ShellSurfaceBase::GetWindowTitle() const { - return title_; -} - -bool ShellSurfaceBase::ShouldShowWindowTitle() const { - return false; -} - -gfx::ImageSkia ShellSurfaceBase::GetWindowIcon() { - return icon_; -} - bool ShellSurfaceBase::OnCloseRequested( views::Widget::ClosedReason close_reason) { if (!pre_close_callback_.is_null())
diff --git a/components/exo/shell_surface_base.h b/components/exo/shell_surface_base.h index 9e821c99..b8f67fc 100644 --- a/components/exo/shell_surface_base.h +++ b/components/exo/shell_surface_base.h
@@ -159,9 +159,6 @@ bool CanResize() const override; bool CanMaximize() const override; bool CanMinimize() const override; - base::string16 GetWindowTitle() const override; - bool ShouldShowWindowTitle() const override; - gfx::ImageSkia GetWindowIcon() override; bool OnCloseRequested(views::Widget::ClosedReason close_reason) override; void WindowClosing() override; views::Widget* GetWidget() override; @@ -269,7 +266,6 @@ int64_t pending_display_id_ = display::kInvalidDisplayId; base::Optional<gfx::Rect> shadow_bounds_; bool shadow_bounds_changed_ = false; - base::string16 title_; SurfaceFrameType frame_type_ = SurfaceFrameType::NONE; bool is_popup_ = false; bool has_grab_ = false; @@ -309,7 +305,6 @@ base::OnceClosure surface_destroyed_callback_; bool system_modal_ = false; bool non_system_modal_window_was_active_ = false; - gfx::ImageSkia icon_; gfx::Size minimum_size_; gfx::Size pending_minimum_size_; gfx::Size maximum_size_;
diff --git a/components/feed/features.gni b/components/feed/features.gni index 004f897..25745a1 100644 --- a/components/feed/features.gni +++ b/components/feed/features.gni
@@ -2,11 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//chrome/android/channel.gni") - declare_args() { enable_feed_in_chrome = is_android - - # TODO(crbug.com/1119406): Temporarily disable on canary for testing. - enable_feed_v2 = is_android && android_channel != "canary" + enable_feed_v2 = is_android }
diff --git a/components/metrics/persistent_histograms.cc b/components/metrics/persistent_histograms.cc index e77f48b0..2bb4ec1 100644 --- a/components/metrics/persistent_histograms.cc +++ b/components/metrics/persistent_histograms.cc
@@ -84,7 +84,8 @@ // Check for feature enabling the use of persistent histogram storage and // enable the global allocator if so. -void InstantiatePersistentHistograms(const base::FilePath& metrics_dir) { +void InstantiatePersistentHistograms(const base::FilePath& metrics_dir, + bool default_local_memory) { // Create a directory for storing completed metrics files. Files in this // directory must have embedded system profiles. If the directory can't be // created, the file will just be deleted below. @@ -148,7 +149,7 @@ storage = kLocalMemory; // Create a global histogram allocator using the desired storage type. - if (storage.empty() || storage == kMappedFile) { + if (storage == kMappedFile || (storage.empty() && !default_local_memory)) { if (!base::PathExists(upload_dir)) { // Handle failure to create the directory. result = kNoUploadDir; @@ -177,7 +178,8 @@ &base::GlobalHistogramAllocator::CreateSpareFile), std::move(spare_file), kAllocSize), base::TimeDelta::FromSeconds(kSpareFileCreateDelaySeconds)); - } else if (storage == kLocalMemory) { + } else if (storage == kLocalMemory || + (default_local_memory && storage.empty())) { // Use local memory for storage even though it will not persist across // an unclean shutdown. This sets the result but the actual creation is // done below.
diff --git a/components/metrics/persistent_histograms.h b/components/metrics/persistent_histograms.h index 72ef923d..c0b27d4 100644 --- a/components/metrics/persistent_histograms.h +++ b/components/metrics/persistent_histograms.h
@@ -15,6 +15,7 @@ extern const char kBrowserMetricsName[]; // Do all the checking and work necessary to enable persistent histograms. -void InstantiatePersistentHistograms(const base::FilePath& metrics_dir); +void InstantiatePersistentHistograms(const base::FilePath& metrics_dir, + bool default_local_memory = false); #endif // COMPONENTS_METRICS_PERSISTENT_HISTOGRAMS_H_
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn index 4a0d2e8f..f726647 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn
@@ -280,6 +280,8 @@ "location_bar_model_delegate.h", "location_bar_model_impl.cc", "location_bar_model_impl.h", + "location_bar_model_util.cc", + "location_bar_model_util.h", ] public_deps = [ @@ -515,6 +517,10 @@ "zero_suggest_verbatim_match_provider_unittest.cc", ] + if ((!is_android || enable_vr) && !is_ios) { + sources += [ "location_bar_model_util_unittest.cc" ] + } + deps = [ ":browser", ":test_support", @@ -547,6 +553,14 @@ "//ui/gfx:test_support", "//url", ] + + if ((!is_android || enable_vr) && !is_ios) { + deps += [ + ":buildflags", + "//components/omnibox/browser:vector_icons", + "//components/vector_icons:vector_icons", + ] + } } fuzzer_test("autocomplete_input_fuzzer") {
diff --git a/components/omnibox/browser/location_bar_model_impl.cc b/components/omnibox/browser/location_bar_model_impl.cc index 5270e37..4fe8d91 100644 --- a/components/omnibox/browser/location_bar_model_impl.cc +++ b/components/omnibox/browser/location_bar_model_impl.cc
@@ -15,6 +15,7 @@ #include "components/dom_distiller/core/url_utils.h" #include "components/omnibox/browser/buildflags.h" #include "components/omnibox/browser/location_bar_model_delegate.h" +#include "components/omnibox/browser/location_bar_model_util.h" #include "components/omnibox/common/omnibox_features.h" #include "components/search_engines/template_url_service.h" #include "components/security_state/core/security_state.h" @@ -29,7 +30,6 @@ #if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS) #include "components/omnibox/browser/vector_icons.h" // nogncheck -#include "components/vector_icons/vector_icons.h" // nogncheck #endif using metrics::OmniboxEventProto; @@ -205,35 +205,9 @@ if (IsOfflinePage()) return omnibox::kOfflinePinIcon; - - security_state::SecurityLevel security_level = GetSecurityLevel(); - switch (security_level) { - case security_state::NONE: - return omnibox::kHttpIcon; - case security_state::WARNING: - // When kMarkHttpAsParameterDangerWarning is enabled, show a danger - // triangle icon. - if (security_state::ShouldShowDangerTriangleForWarningLevel()) { - return omnibox::kNotSecureWarningIcon; - } - return omnibox::kHttpIcon; - case security_state::SECURE: - return omnibox::kHttpsValidIcon; - case security_state::SECURE_WITH_POLICY_INSTALLED_CERT: - return vector_icons::kBusinessIcon; - case security_state::DANGEROUS: - return omnibox::kNotSecureWarningIcon; - case security_state::SECURITY_LEVEL_COUNT: - NOTREACHED(); - return omnibox::kHttpIcon; - } - NOTREACHED(); - return omnibox::kHttpIcon; -#else - NOTREACHED(); - static const gfx::VectorIcon dummy = {}; - return dummy; #endif + + return location_bar_model::GetSecurityVectorIcon(GetSecurityLevel()); } base::string16 LocationBarModelImpl::GetSecureDisplayText() const {
diff --git a/components/omnibox/browser/location_bar_model_util.cc b/components/omnibox/browser/location_bar_model_util.cc new file mode 100644 index 0000000..a67d14c6 --- /dev/null +++ b/components/omnibox/browser/location_bar_model_util.cc
@@ -0,0 +1,51 @@ +// Copyright 2020 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/omnibox/browser/location_bar_model_util.h" + +#include "build/build_config.h" +#include "components/omnibox/browser/buildflags.h" +#include "ui/gfx/vector_icon_types.h" + +#if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS) +#include "components/omnibox/browser/vector_icons.h" // nogncheck +#include "components/vector_icons/vector_icons.h" // nogncheck +#endif + +namespace location_bar_model { + +const gfx::VectorIcon& GetSecurityVectorIcon( + security_state::SecurityLevel security_level) { +#if (!defined(OS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !defined(OS_IOS) + switch (security_level) { + case security_state::NONE: + return omnibox::kHttpIcon; + case security_state::WARNING: + // When kMarkHttpAsParameterDangerWarning is enabled, show a danger + // triangle icon. + if (security_state::ShouldShowDangerTriangleForWarningLevel()) { + return omnibox::kNotSecureWarningIcon; + } + NOTREACHED(); + return omnibox::kHttpIcon; + case security_state::SECURE: + return omnibox::kHttpsValidIcon; + case security_state::SECURE_WITH_POLICY_INSTALLED_CERT: + return vector_icons::kBusinessIcon; + case security_state::DANGEROUS: + return omnibox::kNotSecureWarningIcon; + case security_state::SECURITY_LEVEL_COUNT: + NOTREACHED(); + return omnibox::kHttpIcon; + } + NOTREACHED(); + return omnibox::kHttpIcon; +#else + NOTREACHED(); + static const gfx::VectorIcon dummy = {}; + return dummy; +#endif +} + +} // namespace location_bar_model
diff --git a/components/omnibox/browser/location_bar_model_util.h b/components/omnibox/browser/location_bar_model_util.h new file mode 100644 index 0000000..00803fc --- /dev/null +++ b/components/omnibox/browser/location_bar_model_util.h
@@ -0,0 +1,23 @@ +// Copyright 2020 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_OMNIBOX_BROWSER_LOCATION_BAR_MODEL_UTIL_H_ +#define COMPONENTS_OMNIBOX_BROWSER_LOCATION_BAR_MODEL_UTIL_H_ + +#include "components/security_state/core/security_state.h" + +namespace gfx { +struct VectorIcon; +} // namespace gfx + +namespace location_bar_model { + +// Get the vector icon according to security level. +// It indicates security state of the page. +const gfx::VectorIcon& GetSecurityVectorIcon( + security_state::SecurityLevel security_level); + +} // namespace location_bar_model + +#endif // COMPONENTS_OMNIBOX_BROWSER_LOCATION_BAR_MODEL_UTIL_H_
diff --git a/components/omnibox/browser/location_bar_model_util_unittest.cc b/components/omnibox/browser/location_bar_model_util_unittest.cc new file mode 100644 index 0000000..b484cd8 --- /dev/null +++ b/components/omnibox/browser/location_bar_model_util_unittest.cc
@@ -0,0 +1,45 @@ +// Copyright 2020 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/omnibox/browser/location_bar_model_util.h" + +#include "components/omnibox/browser/vector_icons.h" +#include "components/vector_icons/vector_icons.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/vector_icon_types.h" + +TEST(LocationBarModelUtilTest, GetSecurityVectorIconWithNoneLevel) { + const gfx::VectorIcon& icon = location_bar_model::GetSecurityVectorIcon( + security_state::SecurityLevel::NONE); + EXPECT_EQ(icon.name, omnibox::kHttpIcon.name); +} + +TEST(LocationBarModelUtilTest, GetSecurityVectorIconWithSecureLevel) { + const gfx::VectorIcon& icon = location_bar_model::GetSecurityVectorIcon( + security_state::SecurityLevel::SECURE); + EXPECT_EQ(icon.name, omnibox::kHttpsValidIcon.name); +} + +TEST(LocationBarModelUtilTest, + GetSecurityVectorIconWithSecureWithPolicyInstalledCertLevel) { + const gfx::VectorIcon& icon = location_bar_model::GetSecurityVectorIcon( + security_state::SecurityLevel::SECURE_WITH_POLICY_INSTALLED_CERT); + EXPECT_EQ(icon.name, vector_icons::kBusinessIcon.name); +} + +TEST(LocationBarModelUtilTest, GetSecurityVectorIconWithDangerousLevel) { + const gfx::VectorIcon& icon = location_bar_model::GetSecurityVectorIcon( + security_state::SecurityLevel::DANGEROUS); + EXPECT_EQ(icon.name, omnibox::kNotSecureWarningIcon.name); +} + +TEST(LocationBarModelUtilTest, GetSecurityVectorIconWithWarningLevel) { + const gfx::VectorIcon& icon = location_bar_model::GetSecurityVectorIcon( + security_state::SecurityLevel::WARNING); + if (security_state::ShouldShowDangerTriangleForWarningLevel()) { + EXPECT_EQ(icon.name, omnibox::kNotSecureWarningIcon.name); + } else { + EXPECT_EQ(icon.name, omnibox::kHttpIcon.name); + } +}
diff --git a/components/on_load_script_injector/browser/BUILD.gn b/components/on_load_script_injector/browser/BUILD.gn index 247857a3..c4ce673 100644 --- a/components/on_load_script_injector/browser/BUILD.gn +++ b/components/on_load_script_injector/browser/BUILD.gn
@@ -20,4 +20,10 @@ "//mojo/public/cpp/bindings", "//third_party/blink/public/common", ] + + visibility = [ + "//chromecast/bindings:bindings_manager_cast", + "//chromecast/browser:browser", + "//fuchsia/engine:web_engine_core", + ] }
diff --git a/components/on_load_script_injector/renderer/BUILD.gn b/components/on_load_script_injector/renderer/BUILD.gn index 0676a3e..bb9ee65 100644 --- a/components/on_load_script_injector/renderer/BUILD.gn +++ b/components/on_load_script_injector/renderer/BUILD.gn
@@ -21,4 +21,9 @@ "//mojo/public/cpp/bindings", "//third_party/blink/public/common", ] + + visibility = [ + "//chromecast/renderer/*", + "//fuchsia/engine:web_engine_core", + ] }
diff --git a/components/paint_preview/player/android/player_compositor_delegate_android.cc b/components/paint_preview/player/android/player_compositor_delegate_android.cc index aa3edbf..1b92341 100644 --- a/components/paint_preview/player/android/player_compositor_delegate_android.cc +++ b/components/paint_preview/player/android/player_compositor_delegate_android.cc
@@ -78,16 +78,17 @@ const JavaParamRef<jstring>& j_url_spec, const JavaParamRef<jstring>& j_directory_key, const JavaParamRef<jobject>& j_compositor_error_callback) - : PlayerCompositorDelegate( - paint_preview_service, - GURL(base::android::ConvertJavaStringToUTF8(env, j_url_spec)), - DirectoryKey{ - base::android::ConvertJavaStringToUTF8(env, j_directory_key)}, - base::BindOnce( - &base::android::RunIntCallbackAndroid, - ScopedJavaGlobalRef<jobject>(j_compositor_error_callback))), + : PlayerCompositorDelegate(), request_id_(0), startup_timestamp_(base::TimeTicks::Now()) { + PlayerCompositorDelegate::Initialize( + paint_preview_service, + GURL(base::android::ConvertJavaStringToUTF8(env, j_url_spec)), + DirectoryKey{ + base::android::ConvertJavaStringToUTF8(env, j_directory_key)}, + base::BindOnce( + &base::android::RunIntCallbackAndroid, + ScopedJavaGlobalRef<jobject>(j_compositor_error_callback))); java_ref_.Reset(env, j_object); } @@ -203,12 +204,11 @@ "paint_preview", "PlayerCompositorDelegateAndroid::RequestBitmap", TRACE_ID_LOCAL(request_id_)); - gfx::Rect clip_rect = - gfx::Rect(j_clip_x, j_clip_y, j_clip_width, j_clip_height); PlayerCompositorDelegate::RequestBitmap( base::android::UnguessableTokenAndroid::FromJavaUnguessableToken( env, j_frame_guid), - clip_rect, j_scale_factor, + gfx::Rect(j_clip_x, j_clip_y, j_clip_width, j_clip_height), + j_scale_factor, base::BindOnce(&PlayerCompositorDelegateAndroid::OnBitmapCallback, weak_factory_.GetWeakPtr(), ScopedJavaGlobalRef<jobject>(j_bitmap_callback), @@ -228,32 +228,34 @@ TRACE_ID_LOCAL(request_id), "status", static_cast<int>(status), "bytes", sk_bitmap.computeByteSize()); - if (status == mojom::PaintPreviewCompositor::BitmapStatus::kSuccess && - !sk_bitmap.isNull()) { - base::ThreadPool::PostTaskAndReplyWithResult( - FROM_HERE, {base::TaskPriority::USER_VISIBLE}, - base::BindOnce(&ConvertToJavaBitmap, sk_bitmap), - base::BindOnce(base::BindOnce( - [](const ScopedJavaGlobalRef<jobject>& j_bitmap_callback, - const ScopedJavaGlobalRef<jobject>& j_error_callback, - const ScopedJavaGlobalRef<jobject>& j_bitmap) { - if (!j_bitmap) { - base::android::RunRunnableAndroid(j_error_callback); - return; - } - base::android::RunObjectCallbackAndroid(j_bitmap_callback, - j_bitmap); - }, - j_bitmap_callback, j_error_callback))); - if (request_id == 0) { - auto delta = base::TimeTicks::Now() - startup_timestamp_; - if (delta.InMicroseconds() >= 0) { - base::UmaHistogramTimes("Browser.PaintPreview.Player.TimeToFirstBitmap", - delta); - } - } - } else { + if (status != mojom::PaintPreviewCompositor::BitmapStatus::kSuccess || + sk_bitmap.isNull()) { base::android::RunRunnableAndroid(j_error_callback); + return; + } + + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::TaskPriority::USER_VISIBLE}, + base::BindOnce(&ConvertToJavaBitmap, sk_bitmap), + base::BindOnce(base::BindOnce( + [](const ScopedJavaGlobalRef<jobject>& j_bitmap_callback, + const ScopedJavaGlobalRef<jobject>& j_error_callback, + const ScopedJavaGlobalRef<jobject>& j_bitmap) { + if (!j_bitmap) { + base::android::RunRunnableAndroid(j_error_callback); + return; + } + base::android::RunObjectCallbackAndroid(j_bitmap_callback, + j_bitmap); + }, + j_bitmap_callback, j_error_callback))); + + if (request_id == 0) { + auto delta = base::TimeTicks::Now() - startup_timestamp_; + if (delta.InMicroseconds() >= 0) { + base::UmaHistogramTimes("Browser.PaintPreview.Player.TimeToFirstBitmap", + delta); + } } } @@ -268,6 +270,7 @@ gfx::Rect(static_cast<int>(j_x), static_cast<int>(j_y), 1U, 1U)); if (res.empty()) return base::android::ConvertUTF8ToJavaString(env, ""); + base::UmaHistogramBoolean("Browser.PaintPreview.Player.LinkClicked", true); // TODO(crbug/1061435): Resolve cases where there are multiple links. // For now just return the first in the list.
diff --git a/components/paint_preview/player/player_compositor_delegate.cc b/components/paint_preview/player/player_compositor_delegate.cc index 3f14d43..759aaa4 100644 --- a/components/paint_preview/player/player_compositor_delegate.cc +++ b/components/paint_preview/player/player_compositor_delegate.cc
@@ -96,43 +96,11 @@ } // namespace -PlayerCompositorDelegate::PlayerCompositorDelegate( - PaintPreviewBaseService* paint_preview_service, - const GURL& expected_url, - const DirectoryKey& key, - base::OnceCallback<void(int)> compositor_error, - bool skip_service_launch) - : compositor_error_(std::move(compositor_error)), - paint_preview_service_(paint_preview_service), - key_(key), - compress_on_close_(true), - paint_preview_compositor_service_(nullptr, +PlayerCompositorDelegate::PlayerCompositorDelegate() + : paint_preview_compositor_service_(nullptr, base::OnTaskRunnerDeleter(nullptr)), paint_preview_compositor_client_(nullptr, - base::OnTaskRunnerDeleter(nullptr)) { - if (skip_service_launch) { - paint_preview_service_->GetCapturedPaintPreviewProto( - key, base::nullopt, - base::BindOnce(&PlayerCompositorDelegate::OnProtoAvailable, - weak_factory_.GetWeakPtr(), expected_url)); - return; - } - TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("paint_preview", - "PlayerCompositorDelegate CreateCompositor", - TRACE_ID_LOCAL(this)); - paint_preview_compositor_service_ = - WarmCompositor::GetInstance()->GetOrStartCompositorService(base::BindOnce( - &PlayerCompositorDelegate::OnCompositorServiceDisconnected, - weak_factory_.GetWeakPtr())); - - paint_preview_compositor_client_ = - paint_preview_compositor_service_->CreateCompositor( - base::BindOnce(&PlayerCompositorDelegate::OnCompositorClientCreated, - weak_factory_.GetWeakPtr(), expected_url, key)); - paint_preview_compositor_client_->SetDisconnectHandler( - base::BindOnce(&PlayerCompositorDelegate::OnCompositorClientDisconnected, - weak_factory_.GetWeakPtr())); -} + base::OnTaskRunnerDeleter(nullptr)) {} PlayerCompositorDelegate::~PlayerCompositorDelegate() { if (compress_on_close_) { @@ -143,12 +111,92 @@ } } +void PlayerCompositorDelegate::Initialize( + PaintPreviewBaseService* paint_preview_service, + const GURL& expected_url, + const DirectoryKey& key, + base::OnceCallback<void(int)> compositor_error) { + TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("paint_preview", + "PlayerCompositorDelegate CreateCompositor", + TRACE_ID_LOCAL(this)); + paint_preview_compositor_service_ = + WarmCompositor::GetInstance()->GetOrStartCompositorService(base::BindOnce( + &PlayerCompositorDelegate::OnCompositorServiceDisconnected, + weak_factory_.GetWeakPtr())); + + InitializeInternal(paint_preview_service, expected_url, key, + std::move(compositor_error)); +} + +void PlayerCompositorDelegate::InitializeWithFakeServiceForTest( + PaintPreviewBaseService* paint_preview_service, + const GURL& expected_url, + const DirectoryKey& key, + base::OnceCallback<void(int)> compositor_error, + std::unique_ptr<PaintPreviewCompositorService, base::OnTaskRunnerDeleter> + fake_compositor_service) { + paint_preview_compositor_service_ = std::move(fake_compositor_service); + paint_preview_compositor_service_->SetDisconnectHandler( + base::BindOnce(&PlayerCompositorDelegate::OnCompositorServiceDisconnected, + weak_factory_.GetWeakPtr())); + + InitializeInternal(paint_preview_service, expected_url, key, + std::move(compositor_error)); +} + +void PlayerCompositorDelegate::InitializeInternal( + PaintPreviewBaseService* paint_preview_service, + const GURL& expected_url, + const DirectoryKey& key, + base::OnceCallback<void(int)> compositor_error) { + compositor_error_ = std::move(compositor_error); + paint_preview_service_ = paint_preview_service; + key_ = key; + + paint_preview_compositor_client_ = + paint_preview_compositor_service_->CreateCompositor( + base::BindOnce(&PlayerCompositorDelegate::OnCompositorClientCreated, + weak_factory_.GetWeakPtr(), expected_url, key)); + paint_preview_compositor_client_->SetDisconnectHandler( + base::BindOnce(&PlayerCompositorDelegate::OnCompositorClientDisconnected, + weak_factory_.GetWeakPtr())); +} + +void PlayerCompositorDelegate::RequestBitmap( + const base::UnguessableToken& frame_guid, + const gfx::Rect& clip_rect, + float scale_factor, + base::OnceCallback<void(mojom::PaintPreviewCompositor::BitmapStatus, + const SkBitmap&)> callback) { + DCHECK(IsInitialized()); + if (!paint_preview_compositor_client_) { + std::move(callback).Run( + mojom::PaintPreviewCompositor::BitmapStatus::kMissingFrame, SkBitmap()); + return; + } + + paint_preview_compositor_client_->BitmapForSeparatedFrame( + frame_guid, clip_rect, scale_factor, std::move(callback)); +} + +std::vector<const GURL*> PlayerCompositorDelegate::OnClick( + const base::UnguessableToken& frame_guid, + const gfx::Rect& rect) { + DCHECK(IsInitialized()); + std::vector<const GURL*> urls; + auto it = hit_testers_.find(frame_guid); + if (it != hit_testers_.end()) + it->second->HitTest(rect, &urls); + + return urls; +} + void PlayerCompositorDelegate::OnCompositorReadyStatusAdapter( mojom::PaintPreviewCompositor::BeginCompositeStatus status, mojom::PaintPreviewBeginCompositeResponsePtr composite_response) { CompositorStatus new_status; switch (status) { - // falltrhough + // fallthrough case mojom::PaintPreviewCompositor::BeginCompositeStatus::kSuccess: case mojom::PaintPreviewCompositor::BeginCompositeStatus::kPartialSuccess: new_status = CompositorStatus::OK; @@ -191,7 +239,6 @@ const GURL& expected_url, PaintPreviewBaseService::ProtoReadStatus proto_status, std::unique_ptr<PaintPreviewProto> proto) { - // TODO(crbug.com/1021590): Handle initialization errors. if (proto_status == PaintPreviewBaseService::ProtoReadStatus::kExpired) { OnCompositorReady(CompositorStatus::CAPTURE_EXPIRED, nullptr); return; @@ -233,8 +280,6 @@ return; } - hit_testers_ = BuildHitTesters(*proto); - if (!paint_preview_compositor_client_) { OnCompositorReady(CompositorStatus::COMPOSITOR_CLIENT_DISCONNECT, nullptr); return; @@ -242,9 +287,10 @@ paint_preview_compositor_client_->SetRootFrameUrl(proto_url); + proto_ = std::move(proto); base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, - base::BindOnce(&PrepareCompositeRequest, *proto), + base::BindOnce(&PrepareCompositeRequest, *proto_), base::BindOnce(&PlayerCompositorDelegate::SendCompositeRequest, weak_factory_.GetWeakPtr())); } @@ -261,6 +307,11 @@ std::move(begin_composite_request), base::BindOnce(&PlayerCompositorDelegate::OnCompositorReadyStatusAdapter, weak_factory_.GetWeakPtr())); + + // Defer building hit testers so it happens in parallel with preparing the + // compositor. + hit_testers_ = BuildHitTesters(*proto_); + proto_.reset(); } void PlayerCompositorDelegate::OnCompositorClientDisconnected() { @@ -271,30 +322,4 @@ } } -void PlayerCompositorDelegate::RequestBitmap( - const base::UnguessableToken& frame_guid, - const gfx::Rect& clip_rect, - float scale_factor, - base::OnceCallback<void(mojom::PaintPreviewCompositor::BitmapStatus, - const SkBitmap&)> callback) { - if (!paint_preview_compositor_client_) { - std::move(callback).Run( - mojom::PaintPreviewCompositor::BitmapStatus::kMissingFrame, SkBitmap()); - return; - } - - paint_preview_compositor_client_->BitmapForSeparatedFrame( - frame_guid, clip_rect, scale_factor, std::move(callback)); -} - -std::vector<const GURL*> PlayerCompositorDelegate::OnClick( - const base::UnguessableToken& frame_guid, - const gfx::Rect& rect) { - std::vector<const GURL*> urls; - auto it = hit_testers_.find(frame_guid); - if (it != hit_testers_.end()) - it->second->HitTest(rect, &urls); - return urls; -} - } // namespace paint_preview
diff --git a/components/paint_preview/player/player_compositor_delegate.h b/components/paint_preview/player/player_compositor_delegate.h index 85a24c7..375d927 100644 --- a/components/paint_preview/player/player_compositor_delegate.h +++ b/components/paint_preview/player/player_compositor_delegate.h
@@ -28,20 +28,31 @@ class DirectoryKey; +// Class to facilitate a player creating and communicating with an instance of +// PaintPreviewCompositor. class PlayerCompositorDelegate { public: - PlayerCompositorDelegate(PaintPreviewBaseService* paint_preview_service, - const GURL& url, - const DirectoryKey& key, - base::OnceCallback<void(int)> compositor_error, - bool skip_service_launch = false); + PlayerCompositorDelegate(); virtual ~PlayerCompositorDelegate(); PlayerCompositorDelegate(const PlayerCompositorDelegate&) = delete; PlayerCompositorDelegate& operator=(const PlayerCompositorDelegate&) = delete; + // Initializes the compositor. + void Initialize(PaintPreviewBaseService* paint_preview_service, + const GURL& url, + const DirectoryKey& key, + base::OnceCallback<void(int)> compositor_error); + + // Returns whether initialization has happened. + bool IsInitialized() const { return paint_preview_service_; } + + // Overrides whether to compress the directory when the player is closed. By + // default compression will happen. void SetCompressOnClose(bool compress) { compress_on_close_ = compress; } + // Implementations should override this to handle alternative compositor ready + // situations. virtual void OnCompositorReady( CompositorStatus compositor_status, mojom::PaintPreviewBeginCompositeResponsePtr composite_response) {} @@ -59,12 +70,34 @@ std::vector<const GURL*> OnClick(const base::UnguessableToken& frame_guid, const gfx::Rect& rect); + // Test methods: + + // Initializes the compositor without a real service for testing purposes. + void InitializeWithFakeServiceForTest( + PaintPreviewBaseService* paint_preview_service, + const GURL& expected_url, + const DirectoryKey& key, + base::OnceCallback<void(int)> compositor_error, + std::unique_ptr<PaintPreviewCompositorService, base::OnTaskRunnerDeleter> + fake_compositor_service); + + PaintPreviewCompositorService* GetCompositorServiceForTest() { + return paint_preview_compositor_service_.get(); + } + + PaintPreviewCompositorClient* GetClientForTest() { + return paint_preview_compositor_client_.get(); + } + protected: base::OnceCallback<void(int)> compositor_error_; - PaintPreviewBaseService* paint_preview_service_; - DirectoryKey key_; private: + void InitializeInternal(PaintPreviewBaseService* paint_preview_service, + const GURL& expected_url, + const DirectoryKey& key, + base::OnceCallback<void(int)> compositor_error); + void OnCompositorReadyStatusAdapter( mojom::PaintPreviewCompositor::BeginCompositeStatus status, mojom::PaintPreviewBeginCompositeResponsePtr composite_response); @@ -73,21 +106,26 @@ void OnCompositorClientCreated(const GURL& expected_url, const DirectoryKey& key); + void OnCompositorClientDisconnected(); void OnProtoAvailable(const GURL& expected_url, PaintPreviewBaseService::ProtoReadStatus proto_status, std::unique_ptr<PaintPreviewProto> proto); + void SendCompositeRequest( mojom::PaintPreviewBeginCompositeRequestPtr begin_composite_request); - bool compress_on_close_; + PaintPreviewBaseService* paint_preview_service_{nullptr}; + DirectoryKey key_; + bool compress_on_close_{true}; std::unique_ptr<PaintPreviewCompositorService, base::OnTaskRunnerDeleter> paint_preview_compositor_service_; std::unique_ptr<PaintPreviewCompositorClient, base::OnTaskRunnerDeleter> paint_preview_compositor_client_; base::flat_map<base::UnguessableToken, std::unique_ptr<HitTester>> hit_testers_; + std::unique_ptr<PaintPreviewProto> proto_; base::WeakPtrFactory<PlayerCompositorDelegate> weak_factory_{this}; };
diff --git a/components/paint_preview/player/player_compositor_delegate_unittest.cc b/components/paint_preview/player/player_compositor_delegate_unittest.cc index b1690b3..e3dccbb 100644 --- a/components/paint_preview/player/player_compositor_delegate_unittest.cc +++ b/components/paint_preview/player/player_compositor_delegate_unittest.cc
@@ -25,20 +25,248 @@ namespace paint_preview { -TEST(PlayerCompositorDelegate, OnClick) { - base::test::TaskEnvironment env; - base::ScopedTempDir temp_dir; - ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); +namespace { - PaintPreviewBaseService service(temp_dir.GetPath(), "test", nullptr, false); - auto file_manager = service.GetFileManager(); +class FakePaintPreviewCompositorClient : public PaintPreviewCompositorClient { + public: + explicit FakePaintPreviewCompositorClient( + scoped_refptr<base::SingleThreadTaskRunner> task_runner) + : response_status_( + mojom::PaintPreviewCompositor::BeginCompositeStatus::kSuccess), + token_(base::UnguessableToken::Create()), + task_runner_(task_runner) {} + ~FakePaintPreviewCompositorClient() override = default; + + FakePaintPreviewCompositorClient(const FakePaintPreviewCompositorClient&) = + delete; + FakePaintPreviewCompositorClient& operator=( + const FakePaintPreviewCompositorClient&) = delete; + + const base::Optional<base::UnguessableToken>& Token() const override { + return token_; + } + + void SetDisconnectHandler(base::OnceClosure closure) override { + disconnect_handler_ = std::move(closure); + } + + void BeginSeparatedFrameComposite( + mojom::PaintPreviewBeginCompositeRequestPtr request, + mojom::PaintPreviewCompositor::BeginSeparatedFrameCompositeCallback + callback) override { + auto response = mojom::PaintPreviewBeginCompositeResponse::New(); + response->root_frame_guid = base::UnguessableToken::Create(); + task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), response_status_, + std::move(response))); + } + + void BitmapForSeparatedFrame( + const base::UnguessableToken& frame_guid, + const gfx::Rect& clip_rect, + float scale_factor, + mojom::PaintPreviewCompositor::BitmapForSeparatedFrameCallback callback) + override { + SkBitmap bitmap; + bitmap.allocPixels( + SkImageInfo::MakeN32Premul(clip_rect.width(), clip_rect.height())); + task_runner_->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), + mojom::PaintPreviewCompositor::BitmapStatus::kSuccess, + bitmap)); + } + + void BeginMainFrameComposite( + mojom::PaintPreviewBeginCompositeRequestPtr request, + mojom::PaintPreviewCompositor::BeginMainFrameCompositeCallback callback) + override { + NOTREACHED(); + } + + void BitmapForMainFrame( + const gfx::Rect& clip_rect, + float scale_factor, + mojom::PaintPreviewCompositor::BitmapForMainFrameCallback callback) + override { + NOTREACHED(); + } + + void SetRootFrameUrl(const GURL& url) override { + // no-op + } + + void SetBeginSeparatedFrameResponseStatus( + mojom::PaintPreviewCompositor::BeginCompositeStatus status) { + response_status_ = status; + } + + void Disconnect() { + if (disconnect_handler_) + std::move(disconnect_handler_).Run(); + } + + private: + mojom::PaintPreviewCompositor::BeginCompositeStatus response_status_; + base::Optional<base::UnguessableToken> token_; + base::OnceClosure disconnect_handler_; + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; +}; + +class FakePaintPreviewCompositorService : public PaintPreviewCompositorService { + public: + explicit FakePaintPreviewCompositorService( + scoped_refptr<base::SingleThreadTaskRunner> task_runner) + : task_runner_(task_runner) {} + ~FakePaintPreviewCompositorService() override = default; + + FakePaintPreviewCompositorService(const FakePaintPreviewCompositorService&) = + delete; + FakePaintPreviewCompositorService& operator=( + const FakePaintPreviewCompositorService&) = delete; + + std::unique_ptr<PaintPreviewCompositorClient, base::OnTaskRunnerDeleter> + CreateCompositor(base::OnceClosure connected_closure) override { + task_runner_->PostTask(FROM_HERE, std::move(connected_closure)); + return std::unique_ptr<FakePaintPreviewCompositorClient, + base::OnTaskRunnerDeleter>( + new FakePaintPreviewCompositorClient(task_runner_), + base::OnTaskRunnerDeleter(task_runner_)); + } + + bool HasActiveClients() const override { + NOTREACHED(); + return false; + } + + void SetDisconnectHandler(base::OnceClosure disconnect_handler) override { + disconnect_handler_ = std::move(disconnect_handler); + } + + void Disconnect() { + if (disconnect_handler_) + std::move(disconnect_handler_).Run(); + } + + private: + base::OnceClosure disconnect_handler_; + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; +}; + +FakePaintPreviewCompositorClient* AsFakeClient( + PaintPreviewCompositorClient* client) { + return reinterpret_cast<FakePaintPreviewCompositorClient*>(client); +} + +FakePaintPreviewCompositorService* AsFakeService( + PaintPreviewCompositorService* service) { + return reinterpret_cast<FakePaintPreviewCompositorService*>(service); +} + +class PlayerCompositorDelegateImpl : public PlayerCompositorDelegate { + public: + PlayerCompositorDelegateImpl() = default; + ~PlayerCompositorDelegateImpl() override = default; + + PlayerCompositorDelegateImpl(const PlayerCompositorDelegateImpl&) = delete; + PlayerCompositorDelegateImpl& operator=(const PlayerCompositorDelegateImpl&) = + delete; + + void SetExpectedStatus(CompositorStatus status) { + expected_status_ = status; + status_checked_ = false; + } + + bool WasStatusChecked() const { return status_checked_; } + + void OnCompositorReady(CompositorStatus compositor_status, + mojom::PaintPreviewBeginCompositeResponsePtr + composite_response) override { + // Cast to int for easier debugging. + EXPECT_EQ(static_cast<int>(expected_status_), + static_cast<int>(compositor_status)); + status_checked_ = true; + } + + private: + CompositorStatus expected_status_{CompositorStatus::OK}; + bool status_checked_{false}; +}; + +} // namespace + +class PlayerCompositorDelegateTest : public testing::Test { + protected: + void SetUp() override { + ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); + service_ = std::make_unique<PaintPreviewBaseService>( + temp_dir.GetPath(), "test", nullptr, false); + } + + PaintPreviewBaseService* GetBaseService() { return service_.get(); } + + std::unique_ptr<PaintPreviewCompositorService, base::OnTaskRunnerDeleter> + CreateCompositorService() { + return std::unique_ptr<FakePaintPreviewCompositorService, + base::OnTaskRunnerDeleter>( + new FakePaintPreviewCompositorService(env.GetMainThreadTaskRunner()), + base::OnTaskRunnerDeleter(env.GetMainThreadTaskRunner())); + } + + PaintPreviewProto CreateValidProto(const GURL& url) { + PaintPreviewProto proto; + auto* metadata = proto.mutable_metadata(); + metadata->set_url(url.spec()); + metadata->set_version(kPaintPreviewVersion); + + auto root_frame_id = base::UnguessableToken::Create(); + auto* root_frame = proto.mutable_root_frame(); + root_frame->set_embedding_token_high( + root_frame_id.GetHighForSerialization()); + root_frame->set_embedding_token_low(root_frame_id.GetLowForSerialization()); + root_frame->set_is_main_frame(true); + + return proto; + } + + void SerializeProtoAndCreateRootSkp(PaintPreviewProto* proto, + const DirectoryKey& key) { + auto file_manager = GetBaseService()->GetFileManager(); + base::RunLoop loop; + file_manager->GetTaskRunner()->PostTask( + FROM_HERE, + base::BindOnce( + [](base::OnceClosure quit, scoped_refptr<FileManager> file_manager, + PaintPreviewProto* proto, const DirectoryKey& key) { + auto directory = file_manager->CreateOrGetDirectory(key, true); + + std::string fake_data = "Hello World!"; + auto root_file = directory->AppendASCII("0.skp"); + proto->mutable_root_frame()->set_file_path( + root_file.AsUTF8Unsafe()); + base::WriteFile(root_file, fake_data.data(), fake_data.size()); + + file_manager->SerializePaintPreviewProto(key, *proto, false); + std::move(quit).Run(); + }, + loop.QuitClosure(), file_manager, proto, key)); + loop.Run(); + } + + base::test::TaskEnvironment env; + + private: + std::unique_ptr<PaintPreviewBaseService> service_; + base::ScopedTempDir temp_dir; +}; + +TEST_F(PlayerCompositorDelegateTest, OnClick) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); auto key = file_manager->CreateKey(1U); GURL url("www.example.com"); - PaintPreviewProto proto; - auto* metadata = proto.mutable_metadata(); - metadata->set_url(url.spec()); - metadata->set_version(kPaintPreviewVersion); + PaintPreviewProto proto = CreateValidProto(url); GURL root_frame_link("www.chromium.org"); auto root_frame_id = base::UnguessableToken::Create(); @@ -46,7 +274,6 @@ auto* root_frame = proto.mutable_root_frame(); root_frame->set_embedding_token_high(root_frame_id.GetHighForSerialization()); root_frame->set_embedding_token_low(root_frame_id.GetLowForSerialization()); - root_frame->set_is_main_frame(true); auto* root_frame_link_proto = root_frame->add_links(); root_frame_link_proto->set_url(root_frame_link.spec()); auto* root_frame_rect_proto = root_frame_link_proto->mutable_rect(); @@ -75,18 +302,33 @@ FROM_HERE, base::BindOnce( [](base::OnceClosure quit, scoped_refptr<FileManager> file_manager, - const PaintPreviewProto& proto, const DirectoryKey& key) { - file_manager->CreateOrGetDirectory(key, true); - file_manager->SerializePaintPreviewProto(key, proto, false); + PaintPreviewProto* proto, const DirectoryKey& key) { + auto directory = file_manager->CreateOrGetDirectory(key, true); + + std::string fake_data = "Hello World!"; + auto root_file = directory->AppendASCII("0.skp"); + proto->mutable_root_frame()->set_file_path( + root_file.AsUTF8Unsafe()); + base::WriteFile(root_file, fake_data.data(), fake_data.size()); + + auto subframe_file = directory->AppendASCII("1.skp"); + proto->mutable_subframes(0)->set_file_path( + subframe_file.AsUTF8Unsafe()); + base::WriteFile(subframe_file, fake_data.data(), fake_data.size()); + + file_manager->SerializePaintPreviewProto(key, *proto, false); std::move(quit).Run(); }, - loop.QuitClosure(), file_manager, proto, key)); + loop.QuitClosure(), file_manager, &proto, key)); loop.Run(); { - PlayerCompositorDelegate player_compositor_delegate( - &service, url, key, base::DoNothing(), true); + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus(CompositorStatus::OK); + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, url, key, base::DoNothing(), CreateCompositorService()); env.RunUntilIdle(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); auto res = player_compositor_delegate.OnClick(root_frame_id, gfx::Rect(10, 20, 1, 1)); @@ -105,13 +347,214 @@ env.RunUntilIdle(); } -TEST(PlayerCompositorDelegate, CompressOnClose) { - base::test::TaskEnvironment env; - base::ScopedTempDir temp_dir; - ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); +TEST_F(PlayerCompositorDelegateTest, BadProto) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); + auto key = file_manager->CreateKey(1U); + base::RunLoop loop; + file_manager->GetTaskRunner()->PostTask( + FROM_HERE, + base::BindOnce( + [](base::OnceClosure quit, scoped_refptr<FileManager> file_manager, + const DirectoryKey& key) { + auto directory = file_manager->CreateOrGetDirectory(key, true); + std::string fake_data = "Hello World!"; + auto proto_file = directory->AppendASCII("proto.pb"); + base::WriteFile(proto_file, fake_data.data(), fake_data.size()); + }, + loop.QuitClosure(), file_manager, key)); - PaintPreviewBaseService service(temp_dir.GetPath(), "test", nullptr, false); - auto file_manager = service.GetFileManager(); + { + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus( + CompositorStatus::PROTOBUF_DESERIALIZATION_ERROR); + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, GURL(), key, base::DoNothing(), CreateCompositorService()); + env.RunUntilIdle(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); + } + env.RunUntilIdle(); +} + +TEST_F(PlayerCompositorDelegateTest, OldVersion) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); + auto key = file_manager->CreateKey(1U); + GURL url("https://www.chromium.org/"); + auto proto = CreateValidProto(url); + proto.mutable_metadata()->set_version(kPaintPreviewVersion - 1); + SerializeProtoAndCreateRootSkp(&proto, key); + { + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus(CompositorStatus::OLD_VERSION); + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, url, key, base::DoNothing(), CreateCompositorService()); + player_compositor_delegate.SetCompressOnClose(false); + env.RunUntilIdle(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); + } + env.RunUntilIdle(); +} + +TEST_F(PlayerCompositorDelegateTest, URLMismatch) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); + auto key = file_manager->CreateKey(1U); + GURL url("https://www.chromium.org/"); + auto proto = CreateValidProto(url); + SerializeProtoAndCreateRootSkp(&proto, key); + { + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus( + CompositorStatus::URL_MISMATCH); + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, GURL(), key, base::DoNothing(), CreateCompositorService()); + env.RunUntilIdle(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); + } + env.RunUntilIdle(); +} + +TEST_F(PlayerCompositorDelegateTest, ServiceDisconnect) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); + auto key = file_manager->CreateKey(1U); + GURL url("https://www.chromium.org/"); + auto proto = CreateValidProto(url); + SerializeProtoAndCreateRootSkp(&proto, key); + { + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus(CompositorStatus::OK); + bool called = false; + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, url, key, + base::BindOnce( + [](bool* called, int status) { + EXPECT_EQ(static_cast<int>( + CompositorStatus::COMPOSITOR_SERVICE_DISCONNECT), + status); + *called = true; + }, + &called), + CreateCompositorService()); + env.RunUntilIdle(); + AsFakeService(player_compositor_delegate.GetCompositorServiceForTest()) + ->Disconnect(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); + EXPECT_TRUE(called); + } + env.RunUntilIdle(); +} + +TEST_F(PlayerCompositorDelegateTest, ClientDisconnect) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); + auto key = file_manager->CreateKey(1U); + GURL url("https://www.chromium.org/"); + auto proto = CreateValidProto(url); + SerializeProtoAndCreateRootSkp(&proto, key); + { + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus(CompositorStatus::OK); + bool called = false; + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, url, key, + base::BindOnce( + [](bool* called, int status) { + EXPECT_EQ(static_cast<int>( + CompositorStatus::COMPOSITOR_CLIENT_DISCONNECT), + status); + *called = true; + }, + &called), + CreateCompositorService()); + env.RunUntilIdle(); + AsFakeClient(player_compositor_delegate.GetClientForTest())->Disconnect(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); + EXPECT_TRUE(called); + } + env.RunUntilIdle(); +} + +TEST_F(PlayerCompositorDelegateTest, InvalidCompositeRequest) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); + auto key = file_manager->CreateKey(1U); + GURL url("https://www.chromium.org/"); + auto proto = CreateValidProto(url); + base::RunLoop loop; + file_manager->GetTaskRunner()->PostTask( + FROM_HERE, + base::BindOnce( + [](base::OnceClosure quit, scoped_refptr<FileManager> file_manager, + PaintPreviewProto* proto, const DirectoryKey& key) { + file_manager->CreateOrGetDirectory(key, true); + file_manager->SerializePaintPreviewProto(key, *proto, false); + std::move(quit).Run(); + }, + loop.QuitClosure(), file_manager, &proto, key)); + loop.Run(); + { + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus( + CompositorStatus::INVALID_REQUEST); + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, url, key, base::DoNothing(), CreateCompositorService()); + env.RunUntilIdle(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); + } + env.RunUntilIdle(); +} + +TEST_F(PlayerCompositorDelegateTest, CompositorDeserializationError) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); + auto key = file_manager->CreateKey(1U); + GURL url("https://www.chromium.org/"); + auto proto = CreateValidProto(url); + SerializeProtoAndCreateRootSkp(&proto, key); + { + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus( + CompositorStatus::COMPOSITOR_DESERIALIZATION_ERROR); + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, url, key, base::DoNothing(), CreateCompositorService()); + AsFakeClient(player_compositor_delegate.GetClientForTest()) + ->SetBeginSeparatedFrameResponseStatus( + mojom::PaintPreviewCompositor::BeginCompositeStatus:: + kDeserializingFailure); + env.RunUntilIdle(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); + } + env.RunUntilIdle(); +} + +TEST_F(PlayerCompositorDelegateTest, InvalidRootSkp) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); + auto key = file_manager->CreateKey(1U); + GURL url("https://www.chromium.org/"); + auto proto = CreateValidProto(url); + SerializeProtoAndCreateRootSkp(&proto, key); + { + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus( + CompositorStatus::INVALID_ROOT_FRAME_SKP); + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, url, key, base::DoNothing(), CreateCompositorService()); + AsFakeClient(player_compositor_delegate.GetClientForTest()) + ->SetBeginSeparatedFrameResponseStatus( + mojom::PaintPreviewCompositor::BeginCompositeStatus:: + kCompositingFailure); + env.RunUntilIdle(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); + } + env.RunUntilIdle(); +} + +TEST_F(PlayerCompositorDelegateTest, CompressOnClose) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); auto key = file_manager->CreateKey(1U); base::FilePath dir; file_manager->GetTaskRunner()->PostTaskAndReplyWithResult( @@ -129,12 +572,47 @@ EXPECT_TRUE( base::WriteFile(dir.AppendASCII("test_file"), data.data(), data.size())); { - PlayerCompositorDelegate player_compositor_delegate( - &service, GURL(), key, base::DoNothing(), true); + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus(CompositorStatus::NO_CAPTURE); + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, GURL(), key, base::DoNothing(), CreateCompositorService()); env.RunUntilIdle(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); } env.RunUntilIdle(); EXPECT_TRUE(base::PathExists(dir.AddExtensionASCII(".zip"))); } +TEST_F(PlayerCompositorDelegateTest, RequestBitmapSuccess) { + auto* service = GetBaseService(); + auto file_manager = service->GetFileManager(); + auto key = file_manager->CreateKey(1U); + { + // This test skips setting up files as the fakes don't use them. In normal + // execution the files are required by the service or no bitmap will be + // created. + PlayerCompositorDelegateImpl player_compositor_delegate; + player_compositor_delegate.SetExpectedStatus(CompositorStatus::NO_CAPTURE); + player_compositor_delegate.InitializeWithFakeServiceForTest( + service, GURL(), key, base::DoNothing(), CreateCompositorService()); + env.RunUntilIdle(); + EXPECT_TRUE(player_compositor_delegate.WasStatusChecked()); + + base::RunLoop loop; + player_compositor_delegate.RequestBitmap( + base::UnguessableToken::Create(), gfx::Rect(10, 20, 30, 40), 1.0, + base::BindOnce( + [](base::OnceClosure quit, + mojom::PaintPreviewCompositor::BitmapStatus status, + const SkBitmap& bitmap) { + EXPECT_EQ(mojom::PaintPreviewCompositor::BitmapStatus::kSuccess, + status); + std::move(quit).Run(); + }, + loop.QuitClosure())); + loop.Run(); + } + env.RunUntilIdle(); +} + } // namespace paint_preview
diff --git a/components/password_manager/core/browser/password_reuse_detection_manager.cc b/components/password_manager/core/browser/password_reuse_detection_manager.cc index 4e50a99..5d90a43 100644 --- a/components/password_manager/core/browser/password_reuse_detection_manager.cc +++ b/components/password_manager/core/browser/password_reuse_detection_manager.cc
@@ -84,10 +84,7 @@ const base::string16 text_to_check = is_committed ? input_characters_ : input_characters_ + text; - PasswordStore* store = client_->GetProfilePasswordStore(); - if (!store) - return; - store->CheckReuse(text_to_check, main_frame_url_.GetOrigin().spec(), this); + CheckStoresForReuse(text_to_check); } void PasswordReuseDetectionManager::OnPaste(const base::string16 text) { @@ -97,10 +94,8 @@ base::string16 input = std::move(text); if (input.size() > kMaxNumberOfCharactersToStore) input = input.substr(input.size() - kMaxNumberOfCharactersToStore); - PasswordStore* store = client_->GetProfilePasswordStore(); - if (!store) - return; - store->CheckReuse(input, main_frame_url_.GetOrigin().spec(), this); + + CheckStoresForReuse(input); } void PasswordReuseDetectionManager::OnReuseCheckDone( @@ -109,18 +104,30 @@ base::Optional<PasswordHashData> reused_protected_password_hash, const std::vector<MatchingReusedCredential>& matching_reused_credentials, int saved_passwords) { - if (!is_reuse_found) + // Cache the results. + all_matching_reused_credentials_.insert(matching_reused_credentials.begin(), + matching_reused_credentials.end()); + reuse_on_this_page_was_found_ |= is_reuse_found; + + // If we're still waiting for more results, nothing to be done yet. + if (--wait_counter_ > 0) return; - reuse_on_this_page_was_found_ = true; + + // If no reuse was found, we're done. + if (!reuse_on_this_page_was_found_) { + all_matching_reused_credentials_.clear(); + return; + } + metrics_util::PasswordType reused_password_type = GetReusedPasswordType( - reused_protected_password_hash, matching_reused_credentials.size()); + reused_protected_password_hash, all_matching_reused_credentials_.size()); if (password_manager_util::IsLoggingActive(client_)) { BrowserSavePasswordProgressLogger logger(client_->GetLogManager()); std::vector<std::string> domains_to_log; - domains_to_log.reserve(matching_reused_credentials.size()); + domains_to_log.reserve(all_matching_reused_credentials_.size()); for (const MatchingReusedCredential& credential : - matching_reused_credentials) { + all_matching_reused_credentials_) { domains_to_log.push_back(credential.signon_realm); } switch (reused_password_type) { @@ -153,7 +160,7 @@ : false; metrics_util::LogPasswordReuse(password_length, saved_passwords, - matching_reused_credentials.size(), + all_matching_reused_credentials_.size(), password_field_detected, reused_password_type); #if defined(PASSWORD_REUSE_WARNING_ENABLED) if (reused_password_type == @@ -166,10 +173,12 @@ ? reused_protected_password_hash->username : ""; - client_->CheckProtectedPasswordEntry(reused_password_type, username, - matching_reused_credentials, - password_field_detected); + client_->CheckProtectedPasswordEntry( + reused_password_type, username, + std::move(all_matching_reused_credentials_).extract(), + password_field_detected); #endif + all_matching_reused_credentials_.clear(); } void PasswordReuseDetectionManager::SetClockForTesting(base::Clock* clock) { @@ -194,4 +203,19 @@ } } +void PasswordReuseDetectionManager::CheckStoresForReuse( + const base::string16& input) { + PasswordStore* profile_store = client_->GetProfilePasswordStore(); + if (profile_store) { + ++wait_counter_; + profile_store->CheckReuse(input, main_frame_url_.GetOrigin().spec(), this); + } + + PasswordStore* account_store = client_->GetAccountPasswordStore(); + if (account_store) { + ++wait_counter_; + account_store->CheckReuse(input, main_frame_url_.GetOrigin().spec(), this); + } +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_reuse_detection_manager.h b/components/password_manager/core/browser/password_reuse_detection_manager.h index 022d6c9..e78cd64 100644 --- a/components/password_manager/core/browser/password_reuse_detection_manager.h +++ b/components/password_manager/core/browser/password_reuse_detection_manager.h
@@ -5,6 +5,7 @@ #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTION_MANAGER_H_ #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTION_MANAGER_H_ +#include "base/containers/flat_set.h" #include "base/macros.h" #include "base/strings/string16.h" #include "base/time/time.h" @@ -52,6 +53,9 @@ metrics_util::PasswordType GetReusedPasswordType( base::Optional<PasswordHashData> reused_protected_password_hash, size_t match_domain_count); + + void CheckStoresForReuse(const base::string16& input); + PasswordManagerClient* client_; base::string16 input_characters_; GURL main_frame_url_; @@ -60,6 +64,11 @@ base::Clock* clock_; bool reuse_on_this_page_was_found_ = false; + // Caches the results returned from each store until all stores + // respond. All credentials are then forwarded to the `client_`. + base::flat_set<MatchingReusedCredential> all_matching_reused_credentials_; + int wait_counter_ = 0; + DISALLOW_COPY_AND_ASSIGN(PasswordReuseDetectionManager); };
diff --git a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc index f3a0528..ebe63a8 100644 --- a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc +++ b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
@@ -33,6 +33,13 @@ ~MockPasswordManagerClient() override = default; MOCK_CONST_METHOD0(GetProfilePasswordStore, PasswordStore*()); + MOCK_CONST_METHOD0(GetAccountPasswordStore, PasswordStore*()); + + MOCK_METHOD4(CheckProtectedPasswordEntry, + void(metrics_util::PasswordType, + const std::string&, + const std::vector<MatchingReusedCredential>&, + bool)); private: DISALLOW_COPY_AND_ASSIGN(MockPasswordManagerClient); @@ -199,6 +206,42 @@ } } +TEST_F(PasswordReuseDetectionManagerTest, + CheckReuseCalledOnPasteTwiceProduceNoDuplicates) { + const GURL kURL("https://www.example.com"); + const base::string16 kInput = + base::ASCIIToUTF16("1234567890abcdefghijklmnopqrstuvxyz"); + + EXPECT_CALL(client_, GetProfilePasswordStore()) + .WillRepeatedly(testing::Return(store_.get())); + PasswordReuseDetectionManager manager(&client_); + + manager.DidNavigateMainFrame(kURL); + EXPECT_CALL(*store_, CheckReuse(kInput, kURL.GetOrigin().spec(), &manager)) + .Times(2); + // The user paste the text twice before the store gets to respond. + manager.OnPaste(kInput); + manager.OnPaste(kInput); + testing::Mock::VerifyAndClearExpectations(store_.get()); + + std::vector<MatchingReusedCredential> reused_credentials = { + {.signon_realm = "www.example2.com", + .username = base::ASCIIToUTF16("username1"), + .in_store = autofill::PasswordForm::Store::kProfileStore}}; + + // CheckProtectedPasswordEntry should get called once, and the reused + // credentials get used reported once in this call. + EXPECT_CALL(client_, + CheckProtectedPasswordEntry(_, _, reused_credentials, _)); + // Simulate 2 responses from the store with the same reused credentials. + manager.OnReuseCheckDone(/*is_reuse_found=*/true, /*password_length=*/10, + /*reused_protected_password_hash=*/base::nullopt, + reused_credentials, /*saved_passwords=*/1); + manager.OnReuseCheckDone(/*is_reuse_found=*/true, /*password_length=*/10, + /*reused_protected_password_hash=*/base::nullopt, + reused_credentials, /*saved_passwords=*/1); +} + #if defined(OS_ANDROID) TEST_F(PasswordReuseDetectionManagerTest, CheckReusedCalledWithUncommittedText) { @@ -225,6 +268,152 @@ } #endif +class PasswordReuseDetectionManagerWithTwoStoresTest + : public PasswordReuseDetectionManagerTest { + public: + PasswordReuseDetectionManagerWithTwoStoresTest() = default; + void SetUp() override { + PasswordReuseDetectionManagerTest::SetUp(); + account_store_ = new testing::StrictMock<MockPasswordStore>; + CHECK(account_store_->Init(nullptr)); + } + void TearDown() override { + account_store_->ShutdownOnUIThread(); + account_store_ = nullptr; + PasswordReuseDetectionManagerTest::TearDown(); + } + + protected: + scoped_refptr<MockPasswordStore> account_store_; +}; + +TEST_F(PasswordReuseDetectionManagerWithTwoStoresTest, + CheckReuseCalledOnPasteReuseExistsInBothStores) { + const GURL kURL("https://www.example.com"); + const base::string16 kInput = + base::ASCIIToUTF16("1234567890abcdefghijklmnopqrstuvxyz"); + + EXPECT_CALL(client_, GetProfilePasswordStore()) + .WillRepeatedly(testing::Return(store_.get())); + EXPECT_CALL(client_, GetAccountPasswordStore()) + .WillRepeatedly(testing::Return(account_store_.get())); + + PasswordReuseDetectionManager manager(&client_); + + manager.DidNavigateMainFrame(kURL); + EXPECT_CALL(*store_, CheckReuse(kInput, kURL.GetOrigin().spec(), &manager)); + EXPECT_CALL(*account_store_, + CheckReuse(kInput, kURL.GetOrigin().spec(), &manager)); + manager.OnPaste(kInput); + testing::Mock::VerifyAndClearExpectations(store_.get()); + testing::Mock::VerifyAndClearExpectations(account_store_.get()); + + std::vector<MatchingReusedCredential> profile_reused_credentials = { + {.signon_realm = "www.example2.com", + .username = base::ASCIIToUTF16("username1"), + .in_store = autofill::PasswordForm::Store::kProfileStore}}; + // Simulate response from the profile store. + manager.OnReuseCheckDone(/*is_reuse_found=*/true, /*password_length=*/10, + /*reused_protected_password_hash=*/base::nullopt, + profile_reused_credentials, /*saved_passwords=*/1); + + std::vector<MatchingReusedCredential> account_reused_credentials{ + {.signon_realm = "www.example2.com", + .username = base::ASCIIToUTF16("username2"), + .in_store = autofill::PasswordForm::Store::kAccountStore}}; + + // The callback is run only after both stores respond. + EXPECT_CALL(client_, + CheckProtectedPasswordEntry( + _, _, + testing::UnorderedElementsAre(profile_reused_credentials[0], + account_reused_credentials[0]), + _)); + // Simulate response from the account store. + manager.OnReuseCheckDone(/*is_reuse_found=*/true, /*password_length=*/10, + /*reused_protected_password_hash=*/base::nullopt, + account_reused_credentials, /*saved_passwords=*/1); +} + +TEST_F(PasswordReuseDetectionManagerWithTwoStoresTest, + CheckReuseCalledOnPasteReuseExistsInFirstStoreResponse) { + const GURL kURL("https://www.example.com"); + const base::string16 kInput = + base::ASCIIToUTF16("1234567890abcdefghijklmnopqrstuvxyz"); + + EXPECT_CALL(client_, GetProfilePasswordStore()) + .WillRepeatedly(testing::Return(store_.get())); + EXPECT_CALL(client_, GetAccountPasswordStore()) + .WillRepeatedly(testing::Return(account_store_.get())); + + PasswordReuseDetectionManager manager(&client_); + + manager.DidNavigateMainFrame(kURL); + EXPECT_CALL(*store_, CheckReuse(kInput, kURL.GetOrigin().spec(), &manager)); + EXPECT_CALL(*account_store_, + CheckReuse(kInput, kURL.GetOrigin().spec(), &manager)); + manager.OnPaste(kInput); + testing::Mock::VerifyAndClearExpectations(store_.get()); + testing::Mock::VerifyAndClearExpectations(account_store_.get()); + + std::vector<MatchingReusedCredential> profile_reused_credentials = { + {.signon_realm = "www.example2.com", + .username = base::ASCIIToUTF16("username1"), + .in_store = autofill::PasswordForm::Store::kProfileStore}}; + // Simulate response from the profile store. + manager.OnReuseCheckDone(/*is_reuse_found=*/true, /*password_length=*/10, + /*reused_protected_password_hash=*/base::nullopt, + profile_reused_credentials, /*saved_passwords=*/1); + + // The callback is run only after both stores respond. + EXPECT_CALL(client_, + CheckProtectedPasswordEntry(_, _, profile_reused_credentials, _)); + // Simulate response from the account store with no reuse found. + manager.OnReuseCheckDone(/*is_reuse_found=*/false, /*password_length=*/0, + /*reused_protected_password_hash=*/base::nullopt, {}, + /*saved_passwords=*/0); +} + +TEST_F(PasswordReuseDetectionManagerWithTwoStoresTest, + CheckReuseCalledOnPasteReuseExistsInSecondStoreResponse) { + const GURL kURL("https://www.example.com"); + const base::string16 kInput = + base::ASCIIToUTF16("1234567890abcdefghijklmnopqrstuvxyz"); + + EXPECT_CALL(client_, GetProfilePasswordStore()) + .WillRepeatedly(testing::Return(store_.get())); + EXPECT_CALL(client_, GetAccountPasswordStore()) + .WillRepeatedly(testing::Return(account_store_.get())); + + PasswordReuseDetectionManager manager(&client_); + + manager.DidNavigateMainFrame(kURL); + EXPECT_CALL(*store_, CheckReuse(kInput, kURL.GetOrigin().spec(), &manager)); + EXPECT_CALL(*account_store_, + CheckReuse(kInput, kURL.GetOrigin().spec(), &manager)); + manager.OnPaste(kInput); + testing::Mock::VerifyAndClearExpectations(store_.get()); + testing::Mock::VerifyAndClearExpectations(account_store_.get()); + + // Simulate response from the account store with no reuse found. + manager.OnReuseCheckDone(/*is_reuse_found=*/false, /*password_length=*/0, + /*reused_protected_password_hash=*/base::nullopt, {}, + /*saved_passwords=*/0); + + std::vector<MatchingReusedCredential> profile_reused_credentials = { + {.signon_realm = "www.example2.com", + .username = base::ASCIIToUTF16("username1"), + .in_store = autofill::PasswordForm::Store::kProfileStore}}; + + // The callback is run only after both stores respond. + EXPECT_CALL(client_, + CheckProtectedPasswordEntry(_, _, profile_reused_credentials, _)); + // Simulate response from the profile store. + manager.OnReuseCheckDone(/*is_reuse_found=*/true, /*password_length=*/10, + /*reused_protected_password_hash=*/base::nullopt, + profile_reused_credentials, /*saved_passwords=*/1); +} + } // namespace } // namespace password_manager
diff --git a/components/payments/content/android/BUILD.gn b/components/payments/content/android/BUILD.gn index 46b75b2..f85d0ab 100644 --- a/components/payments/content/android/BUILD.gn +++ b/components/payments/content/android/BUILD.gn
@@ -109,6 +109,7 @@ "java/src/org/chromium/components/payments/PaymentRequestUpdateEventListener.java", "java/src/org/chromium/components/payments/PaymentUIsObserver.java", "java/src/org/chromium/components/payments/PaymentValidator.java", + "java/src/org/chromium/components/payments/SkipToGPayHelper.java", "java/src/org/chromium/components/payments/SslValidityChecker.java", "java/src/org/chromium/components/payments/SupportedDelegations.java", "java/src/org/chromium/components/payments/UrlUtil.java",
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestSpec.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestSpec.java index cbf9366..d87d13b 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestSpec.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestSpec.java
@@ -41,9 +41,11 @@ private List<PaymentItem> mRawLineItems; private PaymentItem mRawTotal; private long mNativePointer; + private PaymentDetails mPaymentDetails; /** - * Creates a valid instance of PaymentRequestSpec. + * Creates a valid instance of PaymentRequestSpec with payment parameters, and saves the + * parameters in the instance. * @param details The payment details, e.g., the total amount. * @param options The payment options, e.g., whether shipping is requested. * @param methodData The map of supported payment method identifiers and corresponding payment @@ -53,21 +55,22 @@ @Nullable public static PaymentRequestSpec createAndValidate(PaymentDetails details, PaymentOptions options, Map<String, PaymentMethodData> methodData, String appLocale) { - PaymentRequestSpec spec = new PaymentRequestSpec(details.id, methodData); + PaymentRequestSpec spec = new PaymentRequestSpec(details, methodData); if (!spec.parseAndValidateDetails(details)) return null; - spec.createNative(details, options, appLocale); + spec.createNative(options, appLocale); return spec; } - private PaymentRequestSpec(String id, Map<String, PaymentMethodData> methodData) { - mId = id; + private PaymentRequestSpec(PaymentDetails details, Map<String, PaymentMethodData> methodData) { + mPaymentDetails = details; + mId = mPaymentDetails.id; mMethodData = methodData; } - private void createNative(PaymentDetails details, PaymentOptions options, String appLocale) { + private void createNative(PaymentOptions options, String appLocale) { assert mNativePointer == 0; mNativePointer = - PaymentRequestSpecJni.get().create(options.serialize(), details.serialize(), + PaymentRequestSpecJni.get().create(options.serialize(), mPaymentDetails.serialize(), MojoStructCollection.serialize(mMethodData.values()), appLocale); } @@ -127,6 +130,11 @@ return mRawTotal; } + /** @return The payment details specified in the payment request. */ + public PaymentDetails getPaymentDetails() { + return mPaymentDetails; + } + /** * Sets the total, display line items, and shipping options based on input and returns the * status boolean. That status is true for valid data, false for invalid data. If the input is @@ -178,6 +186,7 @@ * @param details The updated payment details, e.g., the updated total amount. */ public void updateWith(PaymentDetails details) { + mPaymentDetails = details; PaymentRequestSpecJni.get().updateWith(mNativePointer, details.serialize()); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/SkipToGPayHelper.java b/components/payments/content/android/java/src/org/chromium/components/payments/SkipToGPayHelper.java similarity index 81% rename from chrome/android/java/src/org/chromium/chrome/browser/payments/SkipToGPayHelper.java rename to components/payments/content/android/java/src/org/chromium/components/payments/SkipToGPayHelper.java index 8094476..2695dd0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/SkipToGPayHelper.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/SkipToGPayHelper.java
@@ -2,26 +2,18 @@ // 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; - -import androidx.collection.ArrayMap; +package org.chromium.components.payments; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; -import org.chromium.components.payments.MethodStrings; -import org.chromium.components.payments.PaymentFeatureList; -import org.chromium.content_public.browser.WebContents; import org.chromium.payments.mojom.GooglePaymentMethodData; import org.chromium.payments.mojom.PaymentAddress; import org.chromium.payments.mojom.PaymentDetails; -import org.chromium.payments.mojom.PaymentMethodData; import org.chromium.payments.mojom.PaymentOptions; import org.chromium.payments.mojom.PaymentResponse; -import java.util.Map; - /** * A helper to manage the request / response patching for the Skip-to-GPay experimental flow. * TODO(crbug.com/984694): Retire this helper after general delegation of shipping and contact @@ -50,41 +42,6 @@ private String mSelectedShippingOptionId; /** - * Returns whether the skip-to-GPay experiment should be enabled. - * @param webContents The WebContents that triggered the PaymentRequest. - * @param rawMethodData The PaymentMethodData[] provided to PaymentRequest constructor. - * @return True if either of the two skip-to-GPay experiment flow can be enabled. - */ - public static boolean canActivateExperiment( - WebContents webContents, PaymentMethodData[] rawMethodData) { - if (rawMethodData == null || rawMethodData.length == 0) return false; - - Map<String, PaymentMethodData> methodData = new ArrayMap<>(); - for (int i = 0; i < rawMethodData.length; i++) { - String method = rawMethodData[i].supportedMethod; - if (method.equals(MethodStrings.BASIC_CARD)) { - methodData.put(method, rawMethodData[i]); - break; - } - } - if (methodData.isEmpty()) return false; - - // V2 experiment: enable skip-to-GPay regardless of usable basic-card. - if (PaymentFeatureList.isEnabledOrExperimentalFeaturesEnabled( - PaymentFeatureList.PAYMENT_REQUEST_SKIP_TO_GPAY)) { - return true; - } - - // V1 experiment: only enable skip-to-GPay if no usable basic-card exists. - // This check for autofill card is duplicate work if skip-to-GPay ends up not being - // enabled and adds a small delay (average ~3ms with first time ) to all hybrid request - // flows. However, this is the cleanest way to implement SKIP_TO_GPAY_IF_NO_CARD. - return !AutofillPaymentAppFactory.hasUsableAutofillCard(webContents, methodData) - && PaymentFeatureList.isEnabledOrExperimentalFeaturesEnabled( - PaymentFeatureList.PAYMENT_REQUEST_SKIP_TO_GPAY_IF_NO_CARD); - } - - /** * Constructs a SkipToGPayHeper. * @param options The PaymentOptions specified by the merchant when constructing the * PaymentRequest. The |request*| fields indicate which shipping or contact information the
diff --git a/components/payments/core/features.cc b/components/payments/core/features.cc index 8a603aa..1b599ef 100644 --- a/components/payments/core/features.cc +++ b/components/payments/core/features.cc
@@ -73,6 +73,9 @@ "AllowJITInstallationWhenAppIconIsMissing", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kPaymentHandlerSecurityIcon{ + "PaymentHandlerSecurityIcon", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kEnforceFullDelegation{"EnforceFullDelegation", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/components/payments/core/features.h b/components/payments/core/features.h index a2884772a..106b00a 100644 --- a/components/payments/core/features.h +++ b/components/payments/core/features.h
@@ -76,6 +76,11 @@ // Used to test icon refetch for JIT installed apps with missing icons. extern const base::Feature kAllowJITInstallationWhenAppIconIsMissing; +// Desktop only, if enabled the security icon would be showed next to the +// payment handler's URL bar. It indicate that only secure content is +// allowed inside the payment handler. +extern const base::Feature kPaymentHandlerSecurityIcon; + // Used to reject the apps with partial delegation. extern const base::Feature kEnforceFullDelegation;
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index db31d51..fa2bd2a3 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -23117,7 +23117,7 @@ 'desc': '''This feature enables suggestions for new content to explore. Includes apps, webpages, and more. If this policy is set to True, then suggestions for new content to explore will be enabled. If this policy is set to False, then suggestions for new content to explore will be disabled. - If this policy is left unset, then suggestions for new content to explore will be disabled for managed users. + If this policy is left unset, then suggestions for new content to explore will be disabled for managed users and enabled for other users. ''' }, { @@ -23527,7 +23527,6 @@ 'DeviceUnaffiliatedCrostiniAllowed': 'device_unaffiliated_crostini_allowed.device_unaffiliated_crostini_allowed', 'PluginVmAllowed': 'plugin_vm_allowed.plugin_vm_allowed', 'DeviceLoginScreenAutoSelectCertificateForUrls': 'device_login_screen_auto_select_certificate_for_urls.login_screen_auto_select_certificate_rules', - 'DeviceWiFiFastTransitionEnabled': 'device_wifi_fast_transition_enabled.enabled', 'DeviceTransferSAMLCookies': 'saml_settings.transfer_saml_cookies', 'LoginVideoCaptureAllowedUrls': 'login_video_capture_allowed_urls.urls', 'DeviceHostnameTemplate': 'network_hostname.device_hostname_template',
diff --git a/components/safe_browsing/core/features.cc b/components/safe_browsing/core/features.cc index 3ff1185..946af2b 100644 --- a/components/safe_browsing/core/features.cc +++ b/components/safe_browsing/core/features.cc
@@ -37,9 +37,6 @@ "SafeBrowsingClientSideDetectionForAndroid", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kContentComplianceEnabled{ - "SafeBrowsingContentComplianceEnabled", base::FEATURE_DISABLED_BY_DEFAULT}; - const base::Feature kDelayedWarnings{"SafeBrowsingDelayedWarnings", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -65,9 +62,6 @@ const base::Feature kLimitedListSizeForIOS{"SafeBrowsingLimitedListSizeForIOS", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kMalwareScanEnabled{"SafeBrowsingMalwareScanEnabled", - base::FEATURE_DISABLED_BY_DEFAULT}; - const base::Feature kPasswordProtectionForSavedPasswords{ "SafeBrowsingPasswordProtectionForSavedPasswords", base::FEATURE_ENABLED_BY_DEFAULT}; @@ -167,12 +161,10 @@ {&kAdSamplerTriggerFeature, false}, {&kCaptureInlineJavascriptForGoogleAds, true}, {&kClientSideDetectionForAndroid, true}, - {&kContentComplianceEnabled, true}, {&kDelayedWarnings, true}, {&kDownloadRequestWithToken, true}, {&kEnhancedProtection, true}, {&kLimitedListSizeForIOS, true}, - {&kMalwareScanEnabled, true}, {&kPasswordProtectionForSavedPasswords, true}, {&kPasswordProtectionShowDomainsForSavedPasswords, true}, {&kPasswordProtectionForSignedInUsers, true},
diff --git a/components/safe_browsing/core/features.h b/components/safe_browsing/core/features.h index dc5749c..c19b8fd 100644 --- a/components/safe_browsing/core/features.h +++ b/components/safe_browsing/core/features.h
@@ -37,11 +37,6 @@ // Enables client side detection on Android. extern const base::Feature kClientSideDetectionForAndroid; -// Controls whether to do deep scanning for DLP. If both this feature and -// the enterprise policies are enabled, the downloaded and uploaded files are -// sent for scanning. -extern const base::Feature kContentComplianceEnabled; - // Enable the addition of access tokens to download pings for enhanced // protection users. extern const base::Feature kDownloadRequestWithToken; @@ -53,11 +48,6 @@ // limits the number of entries stored in each Safe Browsing list. extern const base::Feature kLimitedListSizeForIOS; -// Controls whether to do deep scanning for malware. If both this feature and -// the enterprise policies are enabled, the downloaded and uploaded files are -// sent for scanning. -extern const base::Feature kMalwareScanEnabled; - // Enable password protection for non-Google accounts. extern const base::Feature kPasswordProtectionForSavedPasswords;
diff --git a/components/sync_device_info/BUILD.gn b/components/sync_device_info/BUILD.gn index 9938111..32cb3a9 100644 --- a/components/sync_device_info/BUILD.gn +++ b/components/sync_device_info/BUILD.gn
@@ -4,6 +4,12 @@ import("//build/config/features.gni") +# Reset sources_assignment_filter for the BUILD.gn file to prevent +# regression during the migration of Chromium away from the feature. +# See docs/no_sources_assignment_filter.md for more information. +# TODO(crbug.com/1018739): remove this when migration is done. +set_sources_assignment_filter([]) + static_library("sync_device_info") { sources = [ "device_count_metrics_provider.cc", @@ -28,11 +34,6 @@ "local_device_info_provider_impl.h", "local_device_info_util.cc", "local_device_info_util.h", - "local_device_info_util_android.cc", - "local_device_info_util_ios.mm", - "local_device_info_util_linux.cc", - "local_device_info_util_mac.mm", - "local_device_info_util_win.cc", ] configs += [ "//build/config:precompiled_headers" ] @@ -53,13 +54,30 @@ configs += [ "//build/config/compiler:wexit_time_destructors" ] + if (is_android) { + sources += [ "local_device_info_util_android.cc" ] + } + + if (is_ios) { + sources += [ "local_device_info_util_ios.mm" ] + } + + if (is_linux) { + sources += [ "local_device_info_util_linux.cc" ] + } + if (is_mac) { + sources += [ "local_device_info_util_mac.mm" ] frameworks = [ "CoreFoundation.framework", "SystemConfiguration.framework", # For local_device_info_util_mac.mm. ] } + if (is_win) { + sources += [ "local_device_info_util_win.cc" ] + } + if (is_chromeos) { # Required by device_info_util_linux.cc on Chrome OS. deps += [ "//chromeos/constants" ]
diff --git a/components/ui_devtools/devtools_server_unittest.cc b/components/ui_devtools/devtools_server_unittest.cc index 44e97e5..07a30f7 100644 --- a/components/ui_devtools/devtools_server_unittest.cc +++ b/components/ui_devtools/devtools_server_unittest.cc
@@ -50,7 +50,7 @@ net::AddressList addr( net::IPEndPoint(net::IPAddress(127, 0, 0, 1), fake_port)); auto client_socket = std::make_unique<net::TCPClientSocket>( - addr, nullptr, nullptr, net::NetLogSource()); + addr, nullptr, nullptr, nullptr, net::NetLogSource()); net::TestCompletionCallback callback; int connect_result = callback.GetResult(client_socket->Connect(callback.callback()));
diff --git a/components/update_client/BUILD.gn b/components/update_client/BUILD.gn index d46cb7f..b674843 100644 --- a/components/update_client/BUILD.gn +++ b/components/update_client/BUILD.gn
@@ -5,6 +5,12 @@ import("//net/features.gni") import("//testing/libfuzzer/fuzzer_test.gni") +# Reset sources_assignment_filter for the BUILD.gn file to prevent +# regression during the migration of Chromium away from the feature. +# See docs/no_sources_assignment_filter.md for more information. +# TODO(crbug.com/1018739): remove this when migration is done. +set_sources_assignment_filter([]) + source_set("network_impl") { sources = [ "net/network_chromium.h", @@ -58,8 +64,6 @@ "action_runner.cc", "action_runner.h", "activity_data_service.h", - "background_downloader_win.cc", - "background_downloader_win.h", "command_line_config_policy.cc", "command_line_config_policy.h", "component.cc", @@ -120,8 +124,6 @@ "update_query_params_delegate.h", "updater_state.cc", "updater_state.h", - "updater_state_mac.mm", - "updater_state_win.cc", "url_fetcher_downloader.cc", "url_fetcher_downloader.h", "utils.cc", @@ -139,6 +141,18 @@ "//crypto", "//url", ] + + if (is_win) { + sources += [ + "background_downloader_win.cc", + "background_downloader_win.h", + "updater_state_win.cc", + ] + } + + if (is_mac) { + sources += [ "updater_state_mac.mm" ] + } } static_library("test_support") {
diff --git a/components/url_formatter/BUILD.gn b/components/url_formatter/BUILD.gn index fb476a27..32fb520c 100644 --- a/components/url_formatter/BUILD.gn +++ b/components/url_formatter/BUILD.gn
@@ -6,6 +6,12 @@ import("//build/config/android/rules.gni") } +# Reset sources_assignment_filter for the BUILD.gn file to prevent +# regression during the migration of Chromium away from the feature. +# See docs/no_sources_assignment_filter.md for more information. +# TODO(crbug.com/1018739): remove this when migration is done. +set_sources_assignment_filter([]) + static_library("skeleton_generator") { sources = [ "spoof_checks/skeleton_generator.cc", @@ -27,7 +33,6 @@ "url_fixer.h", "url_formatter.cc", "url_formatter.h", - "url_formatter_android.cc", ] configs += [ @@ -54,6 +59,7 @@ public_deps = [ "//third_party/icu" ] if (is_android) { + sources += [ "url_formatter_android.cc" ] deps += [ "android:jni_headers", "//url:gurl_android",
diff --git a/content/app/BUILD.gn b/content/app/BUILD.gn index 5adcc19..77bc07b 100644 --- a/content/app/BUILD.gn +++ b/content/app/BUILD.gn
@@ -92,8 +92,7 @@ check_includes = false sources = [ - "content_service_manager_main_delegate.cc", - "content_service_manager_main_delegate.h", + "content_main.cc", "mojo/mojo_init.cc", "mojo/mojo_init.h", "service_manager_environment.cc", @@ -118,7 +117,7 @@ sources += [ "android/content_child_process_service_delegate.cc", "android/content_jni_onload.cc", - "android/content_main.cc", + "android/content_main_android.cc", "android/library_loader_hooks.cc", "android/library_loader_hooks.h", ] @@ -126,8 +125,15 @@ "//mojo/public/java/system:native_support", "//ui/gl", ] - } else { - sources += [ "content_main.cc" ] + } + + if (is_mac) { + sources += [ + "mac_init.h", + "mac_init.mm", + ] + + frameworks = [ "Foundation.framework" ] } }
diff --git a/content/app/DEPS b/content/app/DEPS index 6337fd0..86a432d5 100644 --- a/content/app/DEPS +++ b/content/app/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+components/discardable_memory", "+components/download", + "+components/tracing/common", "+content", "+device/bluetooth", "+device/gamepad",
diff --git a/content/app/android/content_main.cc b/content/app/android/content_main_android.cc similarity index 68% rename from content/app/android/content_main.cc rename to content/app/android/content_main_android.cc index ac600d9..04f39f18 100644 --- a/content/app/android/content_main.cc +++ b/content/app/android/content_main_android.cc
@@ -5,13 +5,13 @@ #include <memory> #include "base/lazy_instance.h" +#include "base/no_destructor.h" #include "base/trace_event/trace_event.h" -#include "content/app/content_service_manager_main_delegate.h" #include "content/public/android/content_jni_headers/ContentMain_jni.h" #include "content/public/app/content_main.h" #include "content/public/app/content_main_delegate.h" +#include "content/public/app/content_main_runner.h" #include "content/public/common/content_client.h" -#include "services/service_manager/embedder/main.h" using base::LazyInstance; using base::android::JavaParamRef; @@ -20,8 +20,11 @@ namespace { -LazyInstance<std::unique_ptr<service_manager::MainDelegate>>::DestructorAtExit - g_service_manager_main_delegate = LAZY_INSTANCE_INITIALIZER; +ContentMainRunner* GetContentMainRunner() { + static base::NoDestructor<std::unique_ptr<ContentMainRunner>> runner{ + ContentMainRunner::Create()}; + return runner->get(); +} LazyInstance<std::unique_ptr<ContentMainDelegate>>::DestructorAtExit g_content_main_delegate = LAZY_INSTANCE_INITIALIZER; @@ -44,22 +47,9 @@ static jint JNI_ContentMain_Start(JNIEnv* env, jboolean start_service_manager_only) { TRACE_EVENT0("startup", "content::Start"); - - DCHECK(!g_service_manager_main_delegate.Get() || !start_service_manager_only); - - if (!g_service_manager_main_delegate.Get()) { - g_service_manager_main_delegate.Get() = - std::make_unique<ContentServiceManagerMainDelegate>( - ContentMainParams(g_content_main_delegate.Get().get())); - } - - static_cast<ContentServiceManagerMainDelegate*>( - g_service_manager_main_delegate.Get().get()) - ->SetStartServiceManagerOnly(start_service_manager_only); - - service_manager::MainParams main_params( - g_service_manager_main_delegate.Get().get()); - return service_manager::Main(main_params); + ContentMainParams params(g_content_main_delegate.Get().get()); + params.minimal_browser_mode = start_service_manager_only; + return RunContentProcess(params, GetContentMainRunner()); } void SetContentMainDelegate(ContentMainDelegate* delegate) {
diff --git a/content/app/content_main.cc b/content/app/content_main.cc index 72c771d5..31ff9c0 100644 --- a/content/app/content_main.cc +++ b/content/app/content_main.cc
@@ -4,19 +4,401 @@ #include "content/public/app/content_main.h" -#include "content/app/content_service_manager_main_delegate.h" -#include "services/service_manager/embedder/main.h" +#include "base/allocator/buildflags.h" +#include "base/at_exit.h" +#include "base/base_switches.h" +#include "base/command_line.h" +#include "base/debug/activity_tracker.h" +#include "base/debug/debugger.h" +#include "base/debug/stack_trace.h" +#include "base/i18n/icu_util.h" +#include "base/logging.h" +#include "base/memory/shared_memory_hooks.h" +#include "base/message_loop/message_pump_type.h" +#include "base/optional.h" +#include "base/process/launch.h" +#include "base/process/memory.h" +#include "base/process/process.h" +#include "base/run_loop.h" +#include "base/stl_util.h" +#include "base/task/single_thread_task_executor.h" +#include "base/task/thread_pool/thread_pool_instance.h" +#include "base/threading/thread.h" +#include "base/trace_event/trace_config.h" +#include "base/trace_event/trace_log.h" +#include "build/build_config.h" +#include "components/tracing/common/trace_to_console.h" +#include "components/tracing/common/tracing_switches.h" +#include "content/app/content_main_runner_impl.h" +#include "content/common/mojo_core_library_support.h" +#include "content/public/app/content_main_delegate.h" +#include "content/public/common/content_switches.h" +#include "mojo/core/embedder/configuration.h" +#include "mojo/core/embedder/embedder.h" +#include "mojo/core/embedder/scoped_ipc_support.h" +#include "mojo/public/cpp/base/shared_memory_utils.h" +#include "mojo/public/cpp/platform/platform_channel.h" +#include "mojo/public/cpp/system/dynamic_library_support.h" +#include "sandbox/policy/sandbox_type.h" +#include "services/service_manager/embedder/set_process_title.h" +#include "services/service_manager/embedder/shared_file_util.h" +#include "services/service_manager/embedder/switches.h" +#include "ui/base/ui_base_paths.h" +#include "ui/base/ui_base_switches.h" + +#if defined(OS_WIN) +#include <windows.h> + +#include "base/win/process_startup_helper.h" +#include "base/win/win_util.h" +#include "base/win/windows_version.h" +#include "ui/base/win/atl_module.h" +#endif + +#if defined(OS_POSIX) && !defined(OS_ANDROID) +#include <locale.h> +#include <signal.h> + +#include "base/file_descriptor_store.h" +#include "base/posix/global_descriptors.h" +#endif + +#if defined(OS_MAC) +#include "base/mac/scoped_nsautorelease_pool.h" +#include "content/app/mac_init.h" + +#if BUILDFLAG(USE_ALLOCATOR_SHIM) +#include "base/allocator/allocator_shim.h" +#endif +#endif // defined(OS_MAC) namespace content { -int ContentMain(const ContentMainParams& params) { - ContentServiceManagerMainDelegate delegate(params); - service_manager::MainParams main_params(&delegate); -#if !defined(OS_WIN) && !defined(OS_ANDROID) - main_params.argc = params.argc; - main_params.argv = params.argv; +namespace { + +// Maximum message size allowed to be read from a Mojo message pipe in any +// service manager embedder process. +constexpr size_t kMaximumMojoMessageSize = 128 * 1024 * 1024; + +#if defined(OS_POSIX) && !defined(OS_ANDROID) + +// Setup signal-handling state: resanitize most signals, ignore SIGPIPE. +void SetupSignalHandlers() { + // Always ignore SIGPIPE. We check the return value of write(). + CHECK_NE(SIG_ERR, signal(SIGPIPE, SIG_IGN)); + + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + service_manager::switches::kDisableInProcessStackTraces)) { + // Don't interfere with sanitizer signal handlers. + return; + } + + // Sanitise our signal handling state. Signals that were ignored by our + // parent will also be ignored by us. We also inherit our parent's sigmask. + sigset_t empty_signal_set; + CHECK_EQ(0, sigemptyset(&empty_signal_set)); + CHECK_EQ(0, sigprocmask(SIG_SETMASK, &empty_signal_set, nullptr)); + + struct sigaction sigact; + memset(&sigact, 0, sizeof(sigact)); + sigact.sa_handler = SIG_DFL; + static const int signals_to_reset[] = {SIGHUP, SIGINT, SIGQUIT, SIGILL, + SIGABRT, SIGFPE, SIGSEGV, SIGALRM, + SIGTERM, SIGCHLD, SIGBUS, SIGTRAP}; + for (int signal_to_reset : signals_to_reset) + CHECK_EQ(0, sigaction(signal_to_reset, &sigact, nullptr)); +} + +void PopulateFDsFromCommandLine() { + const std::string& shared_file_param = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + service_manager::switches::kSharedFiles); + if (shared_file_param.empty()) + return; + + base::Optional<std::map<int, std::string>> shared_file_descriptors = + service_manager::ParseSharedFileSwitchValue(shared_file_param); + if (!shared_file_descriptors) + return; + + for (const auto& descriptor : *shared_file_descriptors) { + base::MemoryMappedFile::Region region; + const std::string& key = descriptor.second; + base::ScopedFD fd = base::GlobalDescriptors::GetInstance()->TakeFD( + descriptor.first, ®ion); + base::FileDescriptorStore::GetInstance().Set(key, std::move(fd), region); + } +} + +#endif // defined(OS_POSIX) && !defined(OS_ANDROID) + +bool IsSubprocess() { + auto type = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kProcessType); + return type == switches::kGpuProcess || + type == switches::kPpapiBrokerProcess || + type == switches::kPpapiPluginProcess || + type == switches::kRendererProcess || + type == switches::kUtilityProcess || + type == service_manager::switches::kZygoteProcess; +} + +void CommonSubprocessInit() { +#if defined(OS_WIN) + // HACK: Let Windows know that we have started. This is needed to suppress + // the IDC_APPSTARTING cursor from being displayed for a prolonged period + // while a subprocess is starting. + if (base::win::IsUser32AndGdi32Available()) { + PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0); + MSG msg; + PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE); + } #endif - return service_manager::Main(main_params); + +#if !defined(OFFICIAL_BUILD) && defined(OS_WIN) + base::RouteStdioToConsole(false); + LoadLibraryA("dbghelp.dll"); +#endif +} + +void InitializeMojo(mojo::core::Configuration* config) { + // If this is the browser process and there's no Mojo invitation pipe on the + // command line, we will serve as the global Mojo broker. + const auto& command_line = *base::CommandLine::ForCurrentProcess(); + const bool is_browser = !command_line.HasSwitch(switches::kProcessType); + if (is_browser) { + if (mojo::PlatformChannel::CommandLineHasPassedEndpoint(command_line)) { + config->is_broker_process = false; + config->force_direct_shared_memory_allocation = true; + } else { + config->is_broker_process = true; + } + } else { +#if defined(OS_WIN) + if (base::win::GetVersion() >= base::win::Version::WIN8_1) { + // On Windows 8.1 and later it's not necessary to broker shared memory + // allocation, as even sandboxed processes can allocate their own without + // trouble. + config->force_direct_shared_memory_allocation = true; + } +#endif + } + + if (!IsMojoCoreSharedLibraryEnabled()) { + mojo::core::Init(*config); + return; + } + + if (!is_browser) { + // Note that when dynamic Mojo Core is used, initialization for child + // processes happens elsewhere. See ContentMainRunnerImpl::Run() and + // ChildProcess construction. + return; + } + + MojoInitializeFlags flags = MOJO_INITIALIZE_FLAG_NONE; + if (config->is_broker_process) + flags |= MOJO_INITIALIZE_FLAG_AS_BROKER; + if (config->force_direct_shared_memory_allocation) + flags |= MOJO_INITIALIZE_FLAG_FORCE_DIRECT_SHARED_MEMORY_ALLOCATION; + MojoResult result = + mojo::LoadAndInitializeCoreLibrary(GetMojoCoreSharedLibraryPath(), flags); + CHECK_EQ(MOJO_RESULT_OK, result); +} + +} // namespace + +int RunContentProcess(const ContentMainParams& params, + ContentMainRunner* content_main_runner) { + ContentMainParams content_main_params(params); + + int exit_code = -1; + base::debug::GlobalActivityTracker* tracker = nullptr; +#if defined(OS_MAC) + std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool; +#endif + + // A flag to indicate whether Main() has been called before. On Android, we + // may re-run Main() without restarting the browser process. This flag + // prevents initializing things more than once. + static bool is_initialized = false; +#if !defined(OS_ANDROID) + DCHECK(!is_initialized); +#endif + if (!is_initialized) { + is_initialized = true; +#if defined(OS_MAC) && BUILDFLAG(USE_ALLOCATOR_SHIM) + base::allocator::InitializeAllocatorShim(); +#endif + base::EnableTerminationOnOutOfMemory(); + +#if defined(OS_LINUX) || defined(OS_CHROMEOS) + // The various desktop environments set this environment variable that + // allows the dbus client library to connect directly to the bus. When this + // variable is not set (test environments like xvfb-run), the dbus client + // library will fall back to auto-launch mode. Auto-launch is dangerous as + // it can cause hangs (crbug.com/715658) . This one line disables the dbus + // auto-launch, by clobbering the DBUS_SESSION_BUS_ADDRESS env variable if + // not already set. The old auto-launch behavior, if needed, can be restored + // by setting DBUS_SESSION_BUS_ADDRESS="autolaunch:" before launching + // chrome. + const int kNoOverrideIfAlreadySet = 0; + setenv("DBUS_SESSION_BUS_ADDRESS", "disabled:", kNoOverrideIfAlreadySet); +#endif + +#if defined(OS_WIN) + base::win::RegisterInvalidParamHandler(); + ui::win::CreateATLModuleIfNeeded(); +#endif // defined(OS_WIN) + +#if !defined(OS_ANDROID) + // On Android, the command line is initialized when library is loaded. + int argc = 0; + const char** argv = nullptr; + +#if !defined(OS_WIN) + // argc/argv are ignored on Windows; see command_line.h for details. + argc = params.argc; + argv = params.argv; +#endif + + base::CommandLine::Init(argc, argv); + +#if defined(OS_POSIX) + PopulateFDsFromCommandLine(); +#endif + + base::EnableTerminationOnHeapCorruption(); + + service_manager::SetProcessTitleFromCommandLine(argv); +#endif // !defined(OS_ANDROID) + +// On Android setlocale() is not supported, and we don't override the signal +// handlers so we can get a stack trace when crashing. +#if defined(OS_POSIX) && !defined(OS_ANDROID) + // Set C library locale to make sure CommandLine can parse + // argument values in the correct encoding and to make sure + // generated file names (think downloads) are in the file system's + // encoding. + setlocale(LC_ALL, ""); + // For numbers we never want the C library's locale sensitive + // conversion from number to string because the only thing it + // changes is the decimal separator which is not good enough for + // the UI and can be harmful elsewhere. User interface number + // conversions need to go through ICU. Other conversions need to + // be locale insensitive so we force the number locale back to the + // default, "C", locale. + setlocale(LC_NUMERIC, "C"); + + SetupSignalHandlers(); +#endif + +#if defined(OS_WIN) + base::win::SetupCRT(*base::CommandLine::ForCurrentProcess()); +#endif + +#if defined(OS_MAC) + // We need this pool for all the objects created before we get to the event + // loop, but we don't want to leave them hanging around until the app quits. + // Each "main" needs to flush this pool right before it goes into its main + // event loop to get rid of the cruft. + autorelease_pool = std::make_unique<base::mac::ScopedNSAutoreleasePool>(); + content_main_params.autorelease_pool = autorelease_pool.get(); + InitializeMac(); +#endif + + mojo::core::Configuration mojo_config; + mojo_config.max_message_num_bytes = kMaximumMojoMessageSize; + InitializeMojo(&mojo_config); + + ui::RegisterPathProvider(); + tracker = base::debug::GlobalActivityTracker::Get(); + exit_code = content_main_runner->Initialize(content_main_params); + + if (exit_code >= 0) { + if (tracker) { + tracker->SetProcessPhase( + base::debug::GlobalActivityTracker::PROCESS_LAUNCH_FAILED); + tracker->process_data().SetInt("exit-code", exit_code); + } + return exit_code; + } + + // Note #1: the installed shared memory hooks require a live instance of + // mojo::core::ScopedIPCSupport to function, which is instantiated below by + // the process type's main function. However, some Content embedders + // allocate within the ContentMainRunner::Initialize call above, so the + // hooks cannot be installed before that or the shared memory allocation + // will simply fail. + // + // Note #2: some platforms can directly allocated shared memory in a + // sandboxed process. The defines below must be in sync with the + // implementation of mojo::NodeController::CreateSharedBuffer(). +#if !defined(OS_MAC) && !defined(OS_NACL_SFI) && !defined(OS_FUCHSIA) + if (sandbox::policy::IsUnsandboxedSandboxType( + sandbox::policy::SandboxTypeFromCommandLine( + *base::CommandLine::ForCurrentProcess()))) { + // Unsandboxed processes don't need shared memory brokering... because + // they're not sandboxed. + } else if (mojo_config.force_direct_shared_memory_allocation) { + // Don't bother with hooks if direct shared memory allocation has been + // requested. + } else { + // Sanity check, since installing the shared memory hooks in a broker + // process will lead to infinite recursion. + DCHECK(!mojo_config.is_broker_process); + // Otherwise, this is a sandboxed process that will need brokering to + // allocate shared memory. + mojo::SharedMemoryUtils::InstallBaseHooks(); + } +#endif // !defined(OS_MAC) && !defined(OS_NACL_SFI) && !defined(OS_FUCHSIA) + +#if defined(OS_WIN) + // Route stdio to parent console (if any) or create one. + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableLogging)) { + base::RouteStdioToConsole(true); + } +#endif + + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + ::switches::kTraceToConsole)) { + base::trace_event::TraceConfig trace_config = + tracing::GetConfigForTraceToConsole(); + base::trace_event::TraceLog::GetInstance()->SetEnabled( + trace_config, base::trace_event::TraceLog::RECORDING_MODE); + } + } + + if (IsSubprocess()) + CommonSubprocessInit(); + exit_code = content_main_runner->Run(params.minimal_browser_mode); + + if (tracker) { + if (exit_code == 0) { + tracker->SetProcessPhaseIfEnabled( + base::debug::GlobalActivityTracker::PROCESS_EXITED_CLEANLY); + } else { + tracker->SetProcessPhaseIfEnabled( + base::debug::GlobalActivityTracker::PROCESS_EXITED_WITH_CODE); + tracker->process_data().SetInt("exit-code", exit_code); + } + } + +#if defined(OS_MAC) + autorelease_pool.reset(); +#endif + +#if !defined(OS_ANDROID) + content_main_runner->Shutdown(); +#endif + + return exit_code; +} + +int ContentMain(const ContentMainParams& params) { + auto runner = ContentMainRunner::Create(); + return RunContentProcess(params, runner.get()); } } // namespace content
diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc index 35683362..2491c673 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc
@@ -543,8 +543,8 @@ } // static -ContentMainRunnerImpl* ContentMainRunnerImpl::Create() { - return new ContentMainRunnerImpl(); +std::unique_ptr<ContentMainRunnerImpl> ContentMainRunnerImpl::Create() { + return std::make_unique<ContentMainRunnerImpl>(); } ContentMainRunnerImpl::ContentMainRunnerImpl() { @@ -1012,7 +1012,7 @@ } // static -ContentMainRunner* ContentMainRunner::Create() { +std::unique_ptr<ContentMainRunner> ContentMainRunner::Create() { return ContentMainRunnerImpl::Create(); }
diff --git a/content/app/content_main_runner_impl.h b/content/app/content_main_runner_impl.h index 50797fdc..3eb986f 100644 --- a/content/app/content_main_runner_impl.h +++ b/content/app/content_main_runner_impl.h
@@ -39,7 +39,7 @@ class ContentMainRunnerImpl : public ContentMainRunner { public: - static ContentMainRunnerImpl* Create(); + static std::unique_ptr<ContentMainRunnerImpl> Create(); ContentMainRunnerImpl(); ~ContentMainRunnerImpl() override;
diff --git a/content/app/content_service_manager_main_delegate.cc b/content/app/content_service_manager_main_delegate.cc deleted file mode 100644 index 7cb0c25..0000000 --- a/content/app/content_service_manager_main_delegate.cc +++ /dev/null
@@ -1,119 +0,0 @@ -// Copyright 2017 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 "content/app/content_service_manager_main_delegate.h" - -#include "base/command_line.h" -#include "content/app/content_main_runner_impl.h" -#include "content/common/mojo_core_library_support.h" -#include "content/public/app/content_main_delegate.h" -#include "content/public/common/content_switches.h" -#include "mojo/core/embedder/embedder.h" -#include "mojo/public/cpp/platform/platform_channel.h" -#include "mojo/public/cpp/system/dynamic_library_support.h" -#include "services/service_manager/embedder/switches.h" - -#if defined(OS_WIN) -#include "base/win/windows_version.h" -#endif - -namespace content { - -ContentServiceManagerMainDelegate::ContentServiceManagerMainDelegate( - const ContentMainParams& params) - : content_main_params_(params), - content_main_runner_(ContentMainRunnerImpl::Create()) {} - -ContentServiceManagerMainDelegate::~ContentServiceManagerMainDelegate() = - default; - -int ContentServiceManagerMainDelegate::Initialize( - const InitializeParams& params) { -#if defined(OS_ANDROID) - // May be called twice on Android due to the way browser startup requests are - // dispatched by the system. - if (initialized_) - return -1; -#endif - -#if defined(OS_MAC) - content_main_params_.autorelease_pool = params.autorelease_pool; -#endif - - return content_main_runner_->Initialize(content_main_params_); -} - -bool ContentServiceManagerMainDelegate::IsEmbedderSubprocess() { - auto type = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kProcessType); - return type == switches::kGpuProcess || - type == switches::kPpapiBrokerProcess || - type == switches::kPpapiPluginProcess || - type == switches::kRendererProcess || - type == switches::kUtilityProcess || - type == service_manager::switches::kZygoteProcess; -} - -int ContentServiceManagerMainDelegate::RunEmbedderProcess() { - return content_main_runner_->Run(start_service_manager_only_); -} - -void ContentServiceManagerMainDelegate::ShutDownEmbedderProcess() { -#if !defined(OS_ANDROID) - content_main_runner_->Shutdown(); -#endif -} - -void ContentServiceManagerMainDelegate::InitializeMojo( - mojo::core::Configuration* config) { - // If this is the browser process and there's no Mojo invitation pipe on the - // command line, we will serve as the global Mojo broker. - const auto& command_line = *base::CommandLine::ForCurrentProcess(); - const bool is_browser = !command_line.HasSwitch(switches::kProcessType); - if (is_browser) { - if (mojo::PlatformChannel::CommandLineHasPassedEndpoint(command_line)) { - config->is_broker_process = false; - config->force_direct_shared_memory_allocation = true; - } else { - config->is_broker_process = true; - } - } else { -#if defined(OS_WIN) - if (base::win::GetVersion() >= base::win::Version::WIN8_1) { - // On Windows 8.1 and later it's not necessary to broker shared memory - // allocation, as even sandboxed processes can allocate their own without - // trouble. - config->force_direct_shared_memory_allocation = true; - } -#endif - } - - if (!IsMojoCoreSharedLibraryEnabled()) { - mojo::core::Init(*config); - return; - } - - if (!is_browser) { - // Note that when dynamic Mojo Core is used, initialization for child - // processes happens elsewhere. See ContentMainRunnerImpl::Run() and - // ChildProcess construction. - return; - } - - MojoInitializeFlags flags = MOJO_INITIALIZE_FLAG_NONE; - if (config->is_broker_process) - flags |= MOJO_INITIALIZE_FLAG_AS_BROKER; - if (config->force_direct_shared_memory_allocation) - flags |= MOJO_INITIALIZE_FLAG_FORCE_DIRECT_SHARED_MEMORY_ALLOCATION; - MojoResult result = - mojo::LoadAndInitializeCoreLibrary(GetMojoCoreSharedLibraryPath(), flags); - CHECK_EQ(MOJO_RESULT_OK, result); -} - -void ContentServiceManagerMainDelegate::SetStartServiceManagerOnly( - bool start_service_manager_only) { - start_service_manager_only_ = start_service_manager_only; -} - -} // namespace content
diff --git a/content/app/content_service_manager_main_delegate.h b/content/app/content_service_manager_main_delegate.h deleted file mode 100644 index eb7768b..0000000 --- a/content/app/content_service_manager_main_delegate.h +++ /dev/null
@@ -1,51 +0,0 @@ -// Copyright 2017 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 CONTENT_APP_CONTENT_SERVICE_MANAGER_MAIN_DELEGATE_H_ -#define CONTENT_APP_CONTENT_SERVICE_MANAGER_MAIN_DELEGATE_H_ - -#include <memory> - -#include "base/macros.h" -#include "content/public/app/content_main.h" -#include "services/service_manager/embedder/main_delegate.h" - -namespace content { - -class ContentMainRunnerImpl; - -class ContentServiceManagerMainDelegate : public service_manager::MainDelegate { - public: - explicit ContentServiceManagerMainDelegate(const ContentMainParams& params); - ~ContentServiceManagerMainDelegate() override; - - // service_manager::MainDelegate: - int Initialize(const InitializeParams& params) override; - bool IsEmbedderSubprocess() override; - int RunEmbedderProcess() override; - void ShutDownEmbedderProcess() override; - void InitializeMojo(mojo::core::Configuration* config) override; - - // Sets the flag whether to start the Service Manager without starting the - // full browser. - void SetStartServiceManagerOnly(bool start_service_manager_only); - - private: - ContentMainParams content_main_params_; - std::unique_ptr<ContentMainRunnerImpl> content_main_runner_; - -#if defined(OS_ANDROID) - bool initialized_ = false; -#endif - - // Indicates whether to start the Service Manager without starting the full - // browser. - bool start_service_manager_only_ = false; - - DISALLOW_COPY_AND_ASSIGN(ContentServiceManagerMainDelegate); -}; - -} // namespace content - -#endif // CONTENT_APP_CONTENT_SERVICE_MANAGER_MAIN_DELEGATE_H_
diff --git a/content/app/mac_init.h b/content/app/mac_init.h new file mode 100644 index 0000000..422e9de --- /dev/null +++ b/content/app/mac_init.h
@@ -0,0 +1,15 @@ +// Copyright 2017 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 CONTENT_APP_MAC_INIT_H_ +#define CONTENT_APP_MAC_INIT_H_ + +namespace content { + +// Perform any necessary Mac initialization. +void InitializeMac(); + +} // namespace content + +#endif // CONTENT_APP_MAC_INIT_H_
diff --git a/services/service_manager/embedder/mac_init.mm b/content/app/mac_init.mm similarity index 89% rename from services/service_manager/embedder/mac_init.mm rename to content/app/mac_init.mm index 21497a4..230fb937 100644 --- a/services/service_manager/embedder/mac_init.mm +++ b/content/app/mac_init.mm
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "services/service_manager/embedder/mac_init.h" +#include "content/app/mac_init.h" #import <Cocoa/Cocoa.h> -namespace service_manager { +namespace content { void InitializeMac() { [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @@ -28,4 +28,4 @@ }]; } -} // namespace service_manager +} // namespace content
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 82805124..14edfa0 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1066,8 +1066,6 @@ "loader/navigation_url_loader_factory.h", "loader/navigation_url_loader_impl.cc", "loader/navigation_url_loader_impl.h", - "loader/non_network_url_loader_factory_base.cc", - "loader/non_network_url_loader_factory_base.h", "loader/prefetch_url_loader.cc", "loader/prefetch_url_loader.h", "loader/prefetch_url_loader_service.cc",
diff --git a/content/browser/about_url_loader_factory.h b/content/browser/about_url_loader_factory.h index 24c25f1..46200ca 100644 --- a/content/browser/about_url_loader_factory.h +++ b/content/browser/about_url_loader_factory.h
@@ -6,7 +6,7 @@ #define CONTENT_BROWSER_ABOUT_URL_LOADER_FACTORY_H_ #include "base/macros.h" -#include "content/browser/loader/non_network_url_loader_factory_base.h" +#include "content/public/browser/non_network_url_loader_factory_base.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/content/browser/accessibility/accessibility_tree_formatter_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_mac.mm index 2c197ef..044ff07 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_mac.mm +++ b/content/browser/accessibility/accessibility_tree_formatter_mac.mm
@@ -170,7 +170,19 @@ std::unique_ptr<base::DictionaryValue> AccessibilityTreeFormatterMac::BuildAccessibilityTreeForPattern( const base::StringPiece& pattern) { - NOTREACHED(); + NSArray* windows = (NSArray*)CGWindowListCopyWindowInfo( + kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, + kCGNullWindowID); + + for (NSDictionary* window_info in windows) { + NSString* window_name = + (NSString*)[window_info objectForKey:@"kCGWindowOwnerName"]; + if (SysNSStringToUTF8(window_name) == pattern) { + NSNumber* pid = + (NSNumber*)[window_info objectForKey:@"kCGWindowOwnerPID"]; + return BuildAccessibilityTreeForWindow([pid intValue]); + } + } return nullptr; }
diff --git a/content/browser/android/content_url_loader_factory.h b/content/browser/android/content_url_loader_factory.h index 376a04d..f45782e 100644 --- a/content/browser/android/content_url_loader_factory.h +++ b/content/browser/android/content_url_loader_factory.h
@@ -8,8 +8,8 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" -#include "content/browser/loader/non_network_url_loader_factory_base.h" #include "content/common/content_export.h" +#include "content/public/browser/non_network_url_loader_factory_base.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/content/browser/browser_interface_binders.cc b/content/browser/browser_interface_binders.cc index d59b3571..6a54d0c 100644 --- a/content/browser/browser_interface_binders.cc +++ b/content/browser/browser_interface_binders.cc
@@ -18,9 +18,6 @@ #include "content/browser/cookie_store/cookie_store_context.h" #include "content/browser/eye_dropper_chooser_impl.h" #include "content/browser/feature_observer.h" -#include "content/browser/frame_host/clipboard_host_impl.h" -#include "content/browser/frame_host/raw_clipboard_host_impl.h" -#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/browser/image_capture/image_capture_impl.h" #include "content/browser/keyboard_lock/keyboard_lock_service_impl.h" @@ -30,8 +27,11 @@ #include "content/browser/picture_in_picture/picture_in_picture_service_impl.h" #include "content/browser/process_internals/process_internals.mojom.h" #include "content/browser/process_internals/process_internals_ui.h" +#include "content/browser/renderer_host/clipboard_host_impl.h" #include "content/browser/renderer_host/media/media_devices_dispatcher_host.h" #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" +#include "content/browser/renderer_host/raw_clipboard_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/screen_enumeration/screen_enumeration_impl.h" #include "content/browser/service_worker/service_worker_host.h"
diff --git a/content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.mm b/content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.mm index 1df3725..e1f84cf 100644 --- a/content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.mm +++ b/content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.mm
@@ -4,7 +4,7 @@ #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_mac.h" #include "content/public/browser/render_widget_host.h"
diff --git a/content/browser/browser_url_handler_impl.cc b/content/browser/browser_url_handler_impl.cc index 88bc53e9..cb3a420 100644 --- a/content/browser/browser_url_handler_impl.cc +++ b/content/browser/browser_url_handler_impl.cc
@@ -8,7 +8,7 @@ #include "base/stl_util.h" #include "base/strings/string_util.h" -#include "content/browser/frame_host/debug_urls.h" +#include "content/browser/renderer_host/debug_urls.h" #include "content/browser/webui/web_ui_impl.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_client.h"
diff --git a/content/browser/browsing_data/browsing_data_remover_impl.cc b/content/browser/browsing_data/browsing_data_remover_impl.cc index 465e5f0..6df50f9d 100644 --- a/content/browser/browsing_data/browsing_data_remover_impl.cc +++ b/content/browser/browsing_data/browsing_data_remover_impl.cc
@@ -22,7 +22,7 @@ #include "base/time/time.h" #include "base/trace_event/trace_event.h" #include "content/browser/browsing_data/browsing_data_filter_builder_impl.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h"
diff --git a/content/browser/data_url_loader_factory.h b/content/browser/data_url_loader_factory.h index ac4dea0..f0d7471 100644 --- a/content/browser/data_url_loader_factory.h +++ b/content/browser/data_url_loader_factory.h
@@ -6,7 +6,7 @@ #define CONTENT_BROWSER_DATA_URL_LOADER_FACTORY_H_ #include "base/macros.h" -#include "content/browser/loader/non_network_url_loader_factory_base.h" +#include "content/public/browser/non_network_url_loader_factory_base.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/content/browser/devtools/devtools_frontend_host_impl.cc b/content/browser/devtools/devtools_frontend_host_impl.cc index 808b77a..c77e99a 100644 --- a/content/browser/devtools/devtools_frontend_host_impl.cc +++ b/content/browser/devtools/devtools_frontend_host_impl.cc
@@ -86,7 +86,7 @@ DevToolsFrontendHostImpl::~DevToolsFrontendHostImpl() = default; -void DevToolsFrontendHostImpl::BadMessageRecieved() { +void DevToolsFrontendHostImpl::BadMessageReceived() { bad_message::ReceivedBadMessage(web_contents_->GetMainFrame()->GetProcess(), bad_message::DFH_BAD_EMBEDDER_MESSAGE); }
diff --git a/content/browser/devtools/devtools_frontend_host_impl.h b/content/browser/devtools/devtools_frontend_host_impl.h index 76e52a73..061f9be5 100644 --- a/content/browser/devtools/devtools_frontend_host_impl.h +++ b/content/browser/devtools/devtools_frontend_host_impl.h
@@ -22,7 +22,7 @@ const HandleMessageCallback& handle_message_callback); ~DevToolsFrontendHostImpl() override; - void BadMessageRecieved() override; + void BadMessageReceived() override; private: // blink::mojom::DevToolsFrontendHost implementation.
diff --git a/content/browser/file_system/file_system_url_loader_factory.cc b/content/browser/file_system/file_system_url_loader_factory.cc index 7a28f39..3c18635 100644 --- a/content/browser/file_system/file_system_url_loader_factory.cc +++ b/content/browser/file_system/file_system_url_loader_factory.cc
@@ -22,9 +22,9 @@ #include "build/build_config.h" #include "components/services/filesystem/public/mojom/types.mojom.h" #include "content/browser/child_process_security_policy_impl.h" -#include "content/browser/loader/non_network_url_loader_factory_base.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/non_network_url_loader_factory_base.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/child_process_host.h"
diff --git a/content/browser/find_in_page_client.cc b/content/browser/find_in_page_client.cc index 50b7a19..8a15a57 100644 --- a/content/browser/find_in_page_client.cc +++ b/content/browser/find_in_page_client.cc
@@ -7,7 +7,7 @@ #include <utility> #include "content/browser/find_request_manager.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "mojo/public/cpp/bindings/pending_remote.h" namespace content {
diff --git a/content/browser/find_request_manager.cc b/content/browser/find_request_manager.cc index 0828eae..194b5a0 100644 --- a/content/browser/find_request_manager.cc +++ b/content/browser/find_request_manager.cc
@@ -11,7 +11,7 @@ #include "base/containers/queue.h" #include "content/browser/browser_plugin/browser_plugin_guest.h" #include "content/browser/find_in_page_client.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/frame_messages.h"
diff --git a/content/browser/host_zoom_map_impl.cc b/content/browser/host_zoom_map_impl.cc index 3d071a4..8cd4a24680 100644 --- a/content/browser/host_zoom_map_impl.cc +++ b/content/browser/host_zoom_map_impl.cc
@@ -13,7 +13,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/time/default_clock.h" #include "base/values.h" -#include "content/browser/frame_host/navigation_entry_impl.h" +#include "content/browser/renderer_host/navigation_entry_impl.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
diff --git a/content/browser/keyboard_lock/keyboard_lock_service_impl.cc b/content/browser/keyboard_lock/keyboard_lock_service_impl.cc index 4b76ca0..49c98cc 100644 --- a/content/browser/keyboard_lock/keyboard_lock_service_impl.cc +++ b/content/browser/keyboard_lock/keyboard_lock_service_impl.cc
@@ -13,8 +13,8 @@ #include "base/containers/flat_set.h" #include "base/metrics/histogram_macros.h" #include "base/optional.h" -#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/keyboard_lock/keyboard_lock_metrics.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_widget_host.h"
diff --git a/content/browser/loader/cached_navigation_url_loader.cc b/content/browser/loader/cached_navigation_url_loader.cc index 88e233d3f..9c13e2a 100644 --- a/content/browser/loader/cached_navigation_url_loader.cc +++ b/content/browser/loader/cached_navigation_url_loader.cc
@@ -4,10 +4,10 @@ #include "content/browser/loader/cached_navigation_url_loader.h" -#include "content/browser/frame_host/navigation_request_info.h" #include "content/browser/loader/navigation_url_loader_delegate.h" #include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/navigation_subresource_loader_params.h" +#include "content/browser/renderer_host/navigation_request_info.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/global_request_id.h"
diff --git a/content/browser/loader/content_security_notifier.cc b/content/browser/loader/content_security_notifier.cc index c2e27e7..d15c712 100644 --- a/content/browser/loader/content_security_notifier.cc +++ b/content/browser/loader/content_security_notifier.cc
@@ -4,7 +4,7 @@ #include "content/browser/loader/content_security_notifier.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" namespace content {
diff --git a/content/browser/loader/file_url_loader_factory.h b/content/browser/loader/file_url_loader_factory.h index ee2bf71..b06fc50d 100644 --- a/content/browser/loader/file_url_loader_factory.h +++ b/content/browser/loader/file_url_loader_factory.h
@@ -10,8 +10,8 @@ #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" #include "base/task/task_traits.h" -#include "content/browser/loader/non_network_url_loader_factory_base.h" #include "content/common/content_export.h" +#include "content/public/browser/non_network_url_loader_factory_base.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/content/browser/loader/navigation_url_loader.cc b/content/browser/loader/navigation_url_loader.cc index ab426e24..2ff77b5 100644 --- a/content/browser/loader/navigation_url_loader.cc +++ b/content/browser/loader/navigation_url_loader.cc
@@ -7,11 +7,11 @@ #include <utility> #include "base/command_line.h" -#include "content/browser/frame_host/navigation_request_info.h" #include "content/browser/loader/cached_navigation_url_loader.h" #include "content/browser/loader/navigation_loader_interceptor.h" #include "content/browser/loader/navigation_url_loader_factory.h" #include "content/browser/loader/navigation_url_loader_impl.h" +#include "content/browser/renderer_host/navigation_request_info.h" #include "content/browser/web_package/prefetched_signed_exchange_cache.h" #include "content/public/browser/navigation_ui_data.h" #include "services/network/public/cpp/features.h"
diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc index c4ed2ec..d31d70bd 100644 --- a/content/browser/loader/navigation_url_loader_impl.cc +++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -27,14 +27,14 @@ #include "content/browser/data_url_loader_factory.h" #include "content/browser/devtools/devtools_instrumentation.h" #include "content/browser/file_system/file_system_url_loader_factory.h" -#include "content/browser/frame_host/frame_tree_node.h" -#include "content/browser/frame_host/navigation_request.h" -#include "content/browser/frame_host/navigation_request_info.h" #include "content/browser/loader/file_url_loader_factory.h" #include "content/browser/loader/navigation_loader_interceptor.h" #include "content/browser/loader/navigation_url_loader_delegate.h" #include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/navigation_subresource_loader_params.h" +#include "content/browser/renderer_host/frame_tree_node.h" +#include "content/browser/renderer_host/navigation_request.h" +#include "content/browser/renderer_host/navigation_request_info.h" #include "content/browser/service_worker/service_worker_container_host.h" #include "content/browser/service_worker/service_worker_main_resource_handle.h" #include "content/browser/service_worker/service_worker_main_resource_handle_core.h"
diff --git a/content/browser/loader/prefetch_url_loader_service.cc b/content/browser/loader/prefetch_url_loader_service.cc index b3da44a..1e3c810 100644 --- a/content/browser/loader/prefetch_url_loader_service.cc +++ b/content/browser/loader/prefetch_url_loader_service.cc
@@ -7,8 +7,8 @@ #include "base/bind.h" #include "base/feature_list.h" #include "base/time/default_tick_clock.h" -#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/loader/prefetch_url_loader.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/url_loader_factory_getter.h" #include "content/browser/web_package/prefetched_signed_exchange_cache.h" #include "content/public/browser/content_browser_client.h"
diff --git a/content/browser/manifest/manifest_manager_host.cc b/content/browser/manifest/manifest_manager_host.cc index bca8465..0b6a743 100644 --- a/content/browser/manifest/manifest_manager_host.cc +++ b/content/browser/manifest/manifest_manager_host.cc
@@ -7,7 +7,7 @@ #include <stdint.h> #include "base/bind.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
diff --git a/content/browser/net/cross_origin_opener_policy_reporter.cc b/content/browser/net/cross_origin_opener_policy_reporter.cc index 76e8339..4cd619b7 100644 --- a/content/browser/net/cross_origin_opener_policy_reporter.cc +++ b/content/browser/net/cross_origin_opener_policy_reporter.cc
@@ -5,9 +5,9 @@ #include "content/browser/net/cross_origin_opener_policy_reporter.h" #include "base/values.h" -#include "content/browser/frame_host/frame_tree_node.h" -#include "content/browser/frame_host/render_frame_host_impl.h" -#include "content/browser/frame_host/render_frame_proxy_host.h" +#include "content/browser/renderer_host/frame_tree_node.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_proxy_host.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/storage_partition.h"
diff --git a/content/browser/network_service_client.cc b/content/browser/network_service_client.cc index 0a776d5..ffcf3d8 100644 --- a/content/browser/network_service_client.cc +++ b/content/browser/network_service_client.cc
@@ -14,8 +14,8 @@ #include "base/unguessable_token.h" #include "content/browser/browsing_data/clear_site_data_handler.h" #include "content/browser/devtools/devtools_instrumentation.h" -#include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/loader/webrtc_connections_observer.h" +#include "content/browser/renderer_host/frame_tree_node.h" #include "content/browser/ssl/ssl_manager.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_context.h"
diff --git a/content/browser/payments/payment_app_info_fetcher.cc b/content/browser/payments/payment_app_info_fetcher.cc index 4663848..c78a22a6 100644 --- a/content/browser/payments/payment_app_info_fetcher.cc +++ b/content/browser/payments/payment_app_info_fetcher.cc
@@ -12,7 +12,7 @@ #include "base/optional.h" #include "base/task/post_task.h" #include "components/payments/content/icon/icon_size.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_task_traits.h"
diff --git a/content/browser/payments/payment_instrument_icon_fetcher.cc b/content/browser/payments/payment_instrument_icon_fetcher.cc index a1c5e2a..bca98c20 100644 --- a/content/browser/payments/payment_instrument_icon_fetcher.cc +++ b/content/browser/payments/payment_instrument_icon_fetcher.cc
@@ -11,7 +11,7 @@ #include "base/bind_helpers.h" #include "base/task/post_task.h" #include "components/payments/content/icon/icon_size.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/storage_partition_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_task_traits.h"
diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc index 2591866..ddd6656 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc
@@ -7,7 +7,7 @@ #include "content/browser/permissions/permission_controller_impl.h" #include "base/bind.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/common/content_export.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/permission_controller_delegate.h"
diff --git a/content/browser/picture_in_picture/picture_in_picture_service_impl.cc b/content/browser/picture_in_picture/picture_in_picture_service_impl.cc index 1112a9c..3398a13 100644 --- a/content/browser/picture_in_picture/picture_in_picture_service_impl.cc +++ b/content/browser/picture_in_picture/picture_in_picture_service_impl.cc
@@ -6,9 +6,9 @@ #include <utility> -#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/picture_in_picture/picture_in_picture_session.h" #include "content/browser/picture_in_picture/picture_in_picture_window_controller_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/public/browser/web_contents_delegate.h" namespace content {
diff --git a/content/browser/portal/portal.cc b/content/browser/portal/portal.cc index c7192bda..e4a1e64 100644 --- a/content/browser/portal/portal.cc +++ b/content/browser/portal/portal.cc
@@ -12,11 +12,11 @@ #include "content/browser/bad_message.h" #include "content/browser/child_process_security_policy_impl.h" #include "content/browser/devtools/devtools_instrumentation.h" -#include "content/browser/frame_host/navigation_request.h" -#include "content/browser/frame_host/navigator.h" -#include "content/browser/frame_host/render_frame_host_impl.h" -#include "content/browser/frame_host/render_frame_host_manager.h" -#include "content/browser/frame_host/render_frame_proxy_host.h" +#include "content/browser/renderer_host/navigation_request.h" +#include "content/browser/renderer_host/navigator.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_manager.h" +#include "content/browser/renderer_host/render_frame_proxy_host.h" #include "content/browser/renderer_host/render_widget_host_input_event_router.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/render_widget_host_iterator.h"
diff --git a/content/browser/portal/portal_navigation_throttle.cc b/content/browser/portal/portal_navigation_throttle.cc index 8da08e6..2fd4309 100644 --- a/content/browser/portal/portal_navigation_throttle.cc +++ b/content/browser/portal/portal_navigation_throttle.cc
@@ -7,8 +7,8 @@ #include "base/feature_list.h" #include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" -#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/portal/portal.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/navigation_handle.h" #include "content/public/common/url_utils.h"
diff --git a/content/browser/renderer_host/clipboard_host_impl.cc b/content/browser/renderer_host/clipboard_host_impl.cc index cf19103..29887892 100644 --- a/content/browser/renderer_host/clipboard_host_impl.cc +++ b/content/browser/renderer_host/clipboard_host_impl.cc
@@ -89,14 +89,12 @@ // |render_frame_host| may be null in unit tests. if (render_frame_host) { render_frame_routing_id_ = render_frame_host->GetRoutingID(); - render_frame_pid_ = render_frame_host->GetProcess()->GetID(); + render_process_id_ = render_frame_host->GetProcess()->GetID(); clipboard_writer_ = std::make_unique<ui::ScopedClipboardWriter>( ui::ClipboardBuffer::kCopyPaste, std::make_unique<ui::ClipboardDataEndpoint>( render_frame_host->GetLastCommittedOrigin())); } else { - render_frame_routing_id_ = MSG_ROUTING_NONE; - render_frame_pid_ = ChildProcessHost::kInvalidUniqueID; clipboard_writer_ = std::make_unique<ui::ScopedClipboardWriter>( ui::ClipboardBuffer::kCopyPaste); } @@ -386,7 +384,7 @@ std::string data) { // May not have a RenderFrameHost in tests. RenderFrameHostImpl* render_frame_host = - RenderFrameHostImpl::FromID(render_frame_pid_, render_frame_routing_id_); + RenderFrameHostImpl::FromID(render_process_id_, render_frame_routing_id_); if (render_frame_host) { render_frame_host->IsClipboardPasteAllowed( data_type, data, @@ -418,7 +416,7 @@ std::unique_ptr<ui::ClipboardDataEndpoint> ClipboardHostImpl::CreateDataEndpoint() { RenderFrameHostImpl* render_frame_host = - RenderFrameHostImpl::FromID(render_frame_pid_, render_frame_routing_id_); + RenderFrameHostImpl::FromID(render_process_id_, render_frame_routing_id_); if (render_frame_host) { return std::make_unique<ui::ClipboardDataEndpoint>( render_frame_host->GetLastCommittedOrigin());
diff --git a/content/browser/renderer_host/clipboard_host_impl.h b/content/browser/renderer_host/clipboard_host_impl.h index bfa99a3..8ef374e 100644 --- a/content/browser/renderer_host/clipboard_host_impl.h +++ b/content/browser/renderer_host/clipboard_host_impl.h
@@ -182,8 +182,8 @@ mojo::Receiver<blink::mojom::ClipboardHost> receiver_; ui::Clipboard* const clipboard_; // Not owned - int render_frame_routing_id_; - int render_frame_pid_; + int render_frame_routing_id_ = MSG_ROUTING_NONE; + int render_process_id_ = ChildProcessHost::kInvalidUniqueID; std::unique_ptr<ui::ScopedClipboardWriter> clipboard_writer_; // Outstanding is allowed requests per clipboard contents. Maps a clipboard
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index f49fbbaf..bd8466d 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -2296,12 +2296,6 @@ if (created && GetLocalRenderWidgetHost()) { GetLocalRenderWidgetHost()->input_router()->SetFrameTreeNodeId( frame_tree_node_->frame_tree_node_id()); - mojo::Remote<viz::mojom::InputTargetClient> input_target_client; - remote_interfaces_->GetInterface( - input_target_client.BindNewPipeAndPassReceiver()); - input_target_client_ = input_target_client.get(); - GetLocalRenderWidgetHost()->SetInputTargetClient( - std::move(input_target_client)); GetLocalRenderWidgetHost()->InitForFrame(); }
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 7076efe..7db77fc5 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -89,7 +89,6 @@ #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/trust_tokens.mojom.h" #include "services/service_manager/public/mojom/interface_provider.mojom.h" -#include "services/viz/public/mojom/hit_test/input_target_client.mojom.h" #include "third_party/blink/public/common/feature_policy/document_policy.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h" #include "third_party/blink/public/common/loader/previews_state.h" @@ -462,10 +461,6 @@ void PerformAction(const ui::AXActionData& data) override; bool RequiresPerformActionPointInPixels() const override; - viz::mojom::InputTargetClient* GetInputTargetClient() { - return input_target_client_; - } - // Creates a RenderFrame in the renderer process. bool CreateRenderFrame( int previous_routing_id, @@ -2971,8 +2966,6 @@ // IPC-friendly token that represents this host. const base::UnguessableToken frame_token_; - viz::mojom::InputTargetClient* input_target_client_ = nullptr; - // Binding to remote implementation of mojom::RenderAccessibility. Note that // this binding is done on-demand (in UpdateAccessibilityMode()) and will only // be connected (i.e. bound) to the other endpoint in the renderer while there
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index d766168..add80b7 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -4575,10 +4575,6 @@ // It should not be possible for a process death notification to come in // while we are dying. - if (deleting_soon_) { - // TODO(crbug.com/1115216): Temporary to debug crbug.com/1115216. - base::debug::DumpWithoutCrashing(); - } DCHECK(!deleting_soon_); // child_process_launcher_ can be NULL in single process mode or if fast
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 29c6cecd..84a72371 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -605,6 +605,8 @@ if (blink_frame_widget_) { widget_input_handler_->GetFrameWidgetInputHandler( frame_widget_input_handler_.BindNewEndpointAndPassReceiver()); + blink_frame_widget_->BindInputTargetClient( + input_target_client_.BindNewPipeAndPassReceiver()); } SendScreenRects(); @@ -650,6 +652,7 @@ blink_frame_widget_host_receiver_.reset(); blink_frame_widget_.reset(); frame_widget_input_handler_.reset(); + input_target_client_.reset(); widget_compositor_.reset(); return std::make_pair( blink_frame_widget_host_receiver_.BindNewEndpointAndPassRemote(), @@ -665,6 +668,7 @@ blink_frame_widget_host_receiver_.reset(); blink_frame_widget_.reset(); frame_widget_input_handler_.reset(); + input_target_client_.reset(); widget_compositor_.reset(); blink_frame_widget_host_receiver_.Bind(std::move(frame_widget_host)); blink_frame_widget_.Bind(std::move(frame_widget)); @@ -684,6 +688,8 @@ input_router_->BindNewHost()); widget_input_handler_->GetFrameWidgetInputHandler( frame_widget_input_handler_.BindNewEndpointAndPassReceiver()); + blink_frame_widget_->BindInputTargetClient( + input_target_client_.BindNewPipeAndPassReceiver()); } if (view_) @@ -3291,7 +3297,7 @@ input_router_->SetForceEnableZoom(enabled); } -void RenderWidgetHostImpl::SetInputTargetClient( +void RenderWidgetHostImpl::SetInputTargetClientForTesting( mojo::Remote<viz::mojom::InputTargetClient> input_target_client) { input_target_client_ = std::move(input_target_client); }
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index dfdf771..ca28636 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -702,7 +702,7 @@ return input_target_client_; } - void SetInputTargetClient( + void SetInputTargetClientForTesting( mojo::Remote<viz::mojom::InputTargetClient> input_target_client); // InputRouterImplClient overrides.
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router_unittest.cc b/content/browser/renderer_host/render_widget_host_input_event_router_unittest.cc index 8e2552e..d26652b 100644 --- a/content/browser/renderer_host/render_widget_host_input_event_router_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_input_event_router_unittest.cc
@@ -261,7 +261,8 @@ mojo::Remote<viz::mojom::InputTargetClient> input_target_client; input_target_client_root_ = std::make_unique<MockInputTargetClient>( input_target_client.BindNewPipeAndPassReceiver()); - widget_host_root_->SetInputTargetClient(std::move(input_target_client)); + widget_host_root_->SetInputTargetClientForTesting( + std::move(input_target_client)); EXPECT_EQ(view_root_.get(), rwhier()->FindViewFromFrameSinkId(view_root_->GetFrameSinkId()));
diff --git a/content/browser/scoped_active_url.cc b/content/browser/scoped_active_url.cc index 6f041252..4020ee0 100644 --- a/content/browser/scoped_active_url.cc +++ b/content/browser/scoped_active_url.cc
@@ -4,10 +4,10 @@ #include "content/browser/scoped_active_url.h" -#include "content/browser/frame_host/frame_tree.h" -#include "content/browser/frame_host/frame_tree_node.h" -#include "content/browser/frame_host/render_frame_host_impl.h" -#include "content/browser/frame_host/render_frame_proxy_host.h" +#include "content/browser/renderer_host/frame_tree.h" +#include "content/browser/renderer_host/frame_tree_node.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_proxy_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h"
diff --git a/content/browser/site_per_process_hit_test_browsertest.cc b/content/browser/site_per_process_hit_test_browsertest.cc index 75e009de..da5520e5 100644 --- a/content/browser/site_per_process_hit_test_browsertest.cc +++ b/content/browser/site_per_process_hit_test_browsertest.cc
@@ -6674,16 +6674,20 @@ gfx::PointF returned_point; base::OnceClosure quit_closure = content::GetDeferredQuitTaskForRunLoop(&run_loop); - DCHECK_NE(child_node->current_frame_host()->GetInputTargetClient(), - nullptr); - child_node->current_frame_host()->GetInputTargetClient()->FrameSinkIdAt( - point_in_child, 0, - base::BindLambdaForTesting( - [&](const viz::FrameSinkId& id, const gfx::PointF& point) { - received_frame_sink_id = id; - returned_point = point; - std::move(quit_closure).Run(); - })); + DCHECK(child_node->current_frame_host() + ->GetRenderWidgetHost() + ->input_target_client()); + child_node->current_frame_host() + ->GetRenderWidgetHost() + ->input_target_client() + ->FrameSinkIdAt( + point_in_child, 0, + base::BindLambdaForTesting( + [&](const viz::FrameSinkId& id, const gfx::PointF& point) { + received_frame_sink_id = id; + returned_point = point; + std::move(quit_closure).Run(); + })); content::RunThisRunLoop(&run_loop); // |point_in_child| should hit test to the view for |child_node|. ASSERT_EQ(rwhv_child->GetFrameSinkId(), received_frame_sink_id); @@ -6697,16 +6701,20 @@ gfx::PointF returned_point; base::OnceClosure quit_closure = content::GetDeferredQuitTaskForRunLoop(&run_loop); - DCHECK_NE(child_node->current_frame_host()->GetInputTargetClient(), - nullptr); - child_node->current_frame_host()->GetInputTargetClient()->FrameSinkIdAt( - point_in_nested_child_transformed, 0, - base::BindLambdaForTesting( - [&](const viz::FrameSinkId& id, const gfx::PointF& point) { - received_frame_sink_id = id; - returned_point = point; - std::move(quit_closure).Run(); - })); + DCHECK(child_node->current_frame_host() + ->GetRenderWidgetHost() + ->input_target_client()); + child_node->current_frame_host() + ->GetRenderWidgetHost() + ->input_target_client() + ->FrameSinkIdAt( + point_in_nested_child_transformed, 0, + base::BindLambdaForTesting( + [&](const viz::FrameSinkId& id, const gfx::PointF& point) { + received_frame_sink_id = id; + returned_point = point; + std::move(quit_closure).Run(); + })); content::RunThisRunLoop(&run_loop); // |point_in_nested_child_transformed| should hit test to |rwhv_grandchild|. ASSERT_EQ(rwhv_grandchild->GetFrameSinkId(), received_frame_sink_id); @@ -6760,13 +6768,16 @@ gfx::PointF point_in_border = child_origin + gfx::Vector2dF(-30, -30); base::RunLoop run_loop; viz::FrameSinkId received_frame_sink_id; - root->current_frame_host()->GetInputTargetClient()->FrameSinkIdAt( - point_in_border, 0, - base::BindLambdaForTesting( - [&](const viz::FrameSinkId& id, const gfx::PointF& point) { - received_frame_sink_id = id; - run_loop.Quit(); - })); + root->current_frame_host() + ->GetRenderWidgetHost() + ->input_target_client() + ->FrameSinkIdAt( + point_in_border, 0, + base::BindLambdaForTesting( + [&](const viz::FrameSinkId& id, const gfx::PointF& point) { + received_frame_sink_id = id; + run_loop.Quit(); + })); run_loop.Run(); EXPECT_EQ(rwhv_parent->GetFrameSinkId(), received_frame_sink_id); } @@ -6775,13 +6786,16 @@ gfx::PointF point_in_padding = child_origin + gfx::Vector2dF(-10, -10); base::RunLoop run_loop; viz::FrameSinkId received_frame_sink_id; - root->current_frame_host()->GetInputTargetClient()->FrameSinkIdAt( - point_in_padding, 0, - base::BindLambdaForTesting( - [&](const viz::FrameSinkId& id, const gfx::PointF& point) { - received_frame_sink_id = id; - run_loop.Quit(); - })); + root->current_frame_host() + ->GetRenderWidgetHost() + ->input_target_client() + ->FrameSinkIdAt( + point_in_padding, 0, + base::BindLambdaForTesting( + [&](const viz::FrameSinkId& id, const gfx::PointF& point) { + received_frame_sink_id = id; + run_loop.Quit(); + })); run_loop.Run(); EXPECT_EQ(rwhv_parent->GetFrameSinkId(), received_frame_sink_id); } @@ -6790,13 +6804,16 @@ gfx::PointF point_in_content_box = child_origin + gfx::Vector2dF(10, 10); base::RunLoop run_loop; viz::FrameSinkId received_frame_sink_id; - root->current_frame_host()->GetInputTargetClient()->FrameSinkIdAt( - point_in_content_box, 0, - base::BindLambdaForTesting( - [&](const viz::FrameSinkId& id, const gfx::PointF& point) { - received_frame_sink_id = id; - run_loop.Quit(); - })); + root->current_frame_host() + ->GetRenderWidgetHost() + ->input_target_client() + ->FrameSinkIdAt( + point_in_content_box, 0, + base::BindLambdaForTesting( + [&](const viz::FrameSinkId& id, const gfx::PointF& point) { + received_frame_sink_id = id; + run_loop.Quit(); + })); run_loop.Run(); EXPECT_EQ(rwhv_child->GetFrameSinkId(), received_frame_sink_id); }
diff --git a/content/browser/url_loader_factory_params_helper.cc b/content/browser/url_loader_factory_params_helper.cc index 96c3c889..06dd5c4 100644 --- a/content/browser/url_loader_factory_params_helper.cc +++ b/content/browser/url_loader_factory_params_helper.cc
@@ -6,7 +6,7 @@ #include "base/command_line.h" #include "base/optional.h" -#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/storage_partition_impl.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/render_process_host.h"
diff --git a/content/browser/webui/web_ui_url_loader_factory.cc b/content/browser/webui/web_ui_url_loader_factory.cc index bc5420e..a2e9bed 100644 --- a/content/browser/webui/web_ui_url_loader_factory.cc +++ b/content/browser/webui/web_ui_url_loader_factory.cc
@@ -16,7 +16,6 @@ #include "content/browser/bad_message.h" #include "content/browser/blob_storage/blob_internals_url_loader.h" #include "content/browser/blob_storage/chrome_blob_storage_context.h" -#include "content/browser/loader/non_network_url_loader_factory_base.h" #include "content/browser/renderer_host/frame_tree_node.h" #include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/webui/network_error_url_loader.h" @@ -24,6 +23,7 @@ #include "content/browser/webui/url_data_source_impl.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/non_network_url_loader_factory_base.h" #include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h" #include "mojo/public/cpp/bindings/message.h"
diff --git a/content/common/content_switches_internal.cc b/content/common/content_switches_internal.cc index 2dfb2310..fa9f7897 100644 --- a/content/common/content_switches_internal.cc +++ b/content/common/content_switches_internal.cc
@@ -18,7 +18,6 @@ #include "build/build_config.h" #include "content/public/common/content_switches.h" #include "content/public/common/use_zoom_for_dsf_policy.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom.h" #if defined(OS_ANDROID) #include "base/debug/debugger.h"
diff --git a/content/public/app/content_main.h b/content/public/app/content_main.h index 6d6f312..7384f32 100644 --- a/content/public/app/content_main.h +++ b/content/public/app/content_main.h
@@ -29,6 +29,7 @@ class BrowserMainParts; class ContentMainDelegate; +class ContentMainRunner; using CreatedMainPartsClosure = base::OnceCallback<void(BrowserMainParts*)>; @@ -57,12 +58,19 @@ // BrowserMainParts has been created and before PreEarlyInitialization(). CreatedMainPartsClosure* created_main_parts_closure = nullptr; + // Indicates whether to run in a minimal browser mode where most subsystems + // are left uninitialized. + bool minimal_browser_mode = false; + #if defined(OS_MAC) // The outermost autorelease pool to pass to main entry points. base::mac::ScopedNSAutoreleasePool* autorelease_pool = nullptr; #endif }; +CONTENT_EXPORT int RunContentProcess(const ContentMainParams& params, + ContentMainRunner* content_main_runner); + #if defined(OS_ANDROID) // In the Android, the content main starts from ContentMain.java, This function // provides a way to set the |delegate| as ContentMainDelegate for @@ -79,7 +87,7 @@ // ContentMain should be called from the embedder's main() function to do the // initial setup for every process. The embedder has a chance to customize // startup using the ContentMainDelegate interface. The embedder can also pass -// in NULL for |delegate| if they don't want to override default startup. +// in null for |delegate| if they don't want to override default startup. CONTENT_EXPORT int ContentMain(const ContentMainParams& params); #endif
diff --git a/content/public/app/content_main_runner.h b/content/public/app/content_main_runner.h index 308c22d..d61c91b4 100644 --- a/content/public/app/content_main_runner.h +++ b/content/public/app/content_main_runner.h
@@ -5,6 +5,8 @@ #ifndef CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_ #define CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_ +#include <memory> + #include "build/build_config.h" #include "content/common/content_export.h" @@ -17,7 +19,7 @@ virtual ~ContentMainRunner() {} // Create a new ContentMainRunner object. - static ContentMainRunner* Create(); + static std::unique_ptr<ContentMainRunner> Create(); // Initialize all necessary content state. virtual int Initialize(const ContentMainParams& params) = 0;
diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn index d450163..53e97db 100644 --- a/content/public/browser/BUILD.gn +++ b/content/public/browser/BUILD.gn
@@ -244,6 +244,8 @@ "network_context_client_base.h", "network_quality_observer_factory.h", "network_service_instance.h", + "non_network_url_loader_factory_base.cc", + "non_network_url_loader_factory_base.h", "notification_database_data.cc", "notification_database_data.h", "notification_details.h",
diff --git a/content/public/browser/devtools_frontend_host.h b/content/public/browser/devtools_frontend_host.h index 9df2396..73a0c20 100644 --- a/content/public/browser/devtools_frontend_host.h +++ b/content/public/browser/devtools_frontend_host.h
@@ -42,7 +42,7 @@ CONTENT_EXPORT virtual ~DevToolsFrontendHost() {} - CONTENT_EXPORT virtual void BadMessageRecieved() {} + CONTENT_EXPORT virtual void BadMessageReceived() {} // Returns bundled DevTools frontend resource by |path|. Returns null if // |path| does not correspond to any frontend resource.
diff --git a/content/browser/loader/non_network_url_loader_factory_base.cc b/content/public/browser/non_network_url_loader_factory_base.cc similarity index 93% rename from content/browser/loader/non_network_url_loader_factory_base.cc rename to content/public/browser/non_network_url_loader_factory_base.cc index 9ba845f..f66b0eb 100644 --- a/content/browser/loader/non_network_url_loader_factory_base.cc +++ b/content/public/browser/non_network_url_loader_factory_base.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/loader/non_network_url_loader_factory_base.h" +#include "content/public/browser/non_network_url_loader_factory_base.h" #include <utility>
diff --git a/content/browser/loader/non_network_url_loader_factory_base.h b/content/public/browser/non_network_url_loader_factory_base.h similarity index 85% rename from content/browser/loader/non_network_url_loader_factory_base.h rename to content/public/browser/non_network_url_loader_factory_base.h index 2195f90..67a16eea 100644 --- a/content/browser/loader/non_network_url_loader_factory_base.h +++ b/content/public/browser/non_network_url_loader_factory_base.h
@@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_LOADER_NON_NETWORK_URL_LOADER_FACTORY_BASE_H_ -#define CONTENT_BROWSER_LOADER_NON_NETWORK_URL_LOADER_FACTORY_BASE_H_ +#ifndef CONTENT_PUBLIC_BROWSER_NON_NETWORK_URL_LOADER_FACTORY_BASE_H_ +#define CONTENT_PUBLIC_BROWSER_NON_NETWORK_URL_LOADER_FACTORY_BASE_H_ #include "base/macros.h" #include "base/threading/thread_checker.h" +#include "content/common/content_export.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver_set.h" @@ -27,7 +28,8 @@ // - TODO(lukasza): Responding with file contents: duplicated across // FileURLLoaderFactory, ContentURLLoaderFactory (with some additional // code sharing probably possible with ExtensionURLLoaderFactory). -class NonNetworkURLLoaderFactoryBase : public network::mojom::URLLoaderFactory { +class CONTENT_EXPORT NonNetworkURLLoaderFactoryBase + : public network::mojom::URLLoaderFactory { protected: // Constructs NonNetworkURLLoaderFactoryBase object that will self-delete once // all receivers disconnect (including |factory_receiver| below as well as @@ -54,4 +56,4 @@ } // namespace content -#endif // CONTENT_BROWSER_LOADER_NON_NETWORK_URL_LOADER_FACTORY_BASE_H_ +#endif // CONTENT_PUBLIC_BROWSER_NON_NETWORK_URL_LOADER_FACTORY_BASE_H_
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h index eb26646b..7c64516 100644 --- a/content/public/common/common_param_traits_macros.h +++ b/content/public/common/common_param_traits_macros.h
@@ -22,7 +22,6 @@ #include "third_party/blink/public/mojom/devtools/console_message.mojom.h" #include "third_party/blink/public/mojom/permissions/permission_status.mojom.h" #include "third_party/blink/public/mojom/renderer_preferences.mojom.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom.h" #include "third_party/blink/public/mojom/window_features/window_features.mojom.h" #include "third_party/blink/public/platform/web_history_scroll_restoration_type.h" #include "third_party/blink/public/platform/web_rect.h"
diff --git a/content/public/test/fake_frame_widget.h b/content/public/test/fake_frame_widget.h index 9576585..8b45f54e 100644 --- a/content/public/test/fake_frame_widget.h +++ b/content/public/test/fake_frame_widget.h
@@ -68,6 +68,8 @@ void BindWidgetCompositor( mojo::PendingReceiver<blink::mojom::WidgetCompositor> receiver) override { } + void BindInputTargetClient( + mojo::PendingReceiver<viz::mojom::InputTargetClient> receiver) override {} mojo::AssociatedReceiver<blink::mojom::FrameWidget> receiver_; base::i18n::TextDirection text_direction_ =
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index bdac1fb..ce6b534 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn
@@ -85,8 +85,6 @@ "impression_conversions.h", "in_process_renderer_thread.cc", "in_process_renderer_thread.h", - "input/input_target_client_impl.cc", - "input/input_target_client_impl.h", "internal_document_state_data.cc", "internal_document_state_data.h", "java/gin_java_bridge_dispatcher.cc",
diff --git a/content/renderer/input/OWNERS b/content/renderer/input/OWNERS deleted file mode 100644 index 4b3d57a..0000000 --- a/content/renderer/input/OWNERS +++ /dev/null
@@ -1,6 +0,0 @@ -dtapuska@chromium.org -tdresser@chromium.org -nzolghadr@chromium.org - -# TEAM: input-dev@chromium.org -# COMPONENT: Blink>Input
diff --git a/content/renderer/input/input_target_client_impl.cc b/content/renderer/input/input_target_client_impl.cc deleted file mode 100644 index 021c306..0000000 --- a/content/renderer/input/input_target_client_impl.cc +++ /dev/null
@@ -1,41 +0,0 @@ -// Copyright 2017 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 "content/renderer/input/input_target_client_impl.h" - -#include "base/bind.h" -#include "base/check.h" -#include "content/renderer/render_frame_impl.h" -#include "content/renderer/render_widget.h" - -namespace content { - -InputTargetClientImpl::InputTargetClientImpl(RenderFrameImpl* render_frame) - : render_frame_(render_frame) {} - -InputTargetClientImpl::~InputTargetClientImpl() {} - -void InputTargetClientImpl::BindToReceiver( - mojo::PendingReceiver<viz::mojom::InputTargetClient> receiver) { - DCHECK(!receiver_.is_bound()); - receiver_.Bind(std::move(receiver), render_frame_->GetTaskRunner( - blink::TaskType::kInternalDefault)); -} - -void InputTargetClientImpl::FrameSinkIdAt(const gfx::PointF& point, - const uint64_t trace_id, - FrameSinkIdAtCallback callback) { - TRACE_EVENT_WITH_FLOW1("viz,benchmark", "Event.Pipeline", - TRACE_ID_GLOBAL(trace_id), - TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, - "step", "FrameSinkIdAt"); - - gfx::PointF local_point; - viz::FrameSinkId id = - render_frame_->GetLocalRootRenderWidget()->GetFrameSinkIdAtPoint( - point, &local_point); - std::move(callback).Run(id, local_point); -} - -} // namespace content
diff --git a/content/renderer/input/input_target_client_impl.h b/content/renderer/input/input_target_client_impl.h deleted file mode 100644 index 4db6ca0..0000000 --- a/content/renderer/input/input_target_client_impl.h +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2017 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 CONTENT_RENDERER_INPUT_INPUT_TARGET_CLIENT_IMPL_H_ -#define CONTENT_RENDERER_INPUT_INPUT_TARGET_CLIENT_IMPL_H_ - -#include "mojo/public/cpp/bindings/receiver.h" -#include "services/viz/public/mojom/hit_test/input_target_client.mojom.h" - -namespace content { - -class RenderFrameImpl; - -// This class provides an implementation of InputTargetClient mojo interface. -class InputTargetClientImpl : public viz::mojom::InputTargetClient { - public: - explicit InputTargetClientImpl(RenderFrameImpl* render_frame); - ~InputTargetClientImpl() override; - - void BindToReceiver( - mojo::PendingReceiver<viz::mojom::InputTargetClient> receiver); - - // viz::mojom::InputTargetClient: - void FrameSinkIdAt(const gfx::PointF& point, - const uint64_t trace_id, - FrameSinkIdAtCallback callback) override; - - private: - RenderFrameImpl* const render_frame_; - - mojo::Receiver<viz::mojom::InputTargetClient> receiver_{this}; - - DISALLOW_COPY_AND_ASSIGN(InputTargetClientImpl); -}; - -} // namespace content - -#endif // CONTENT_RENDERER_INPUT_INPUT_TARGET_CLIENT_IMPL_H_
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 40f800d..9321f1e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -99,7 +99,6 @@ #include "content/renderer/history_entry.h" #include "content/renderer/history_serialization.h" #include "content/renderer/impression_conversions.h" -#include "content/renderer/input/input_target_client_impl.h" #include "content/renderer/internal_document_state_data.h" #include "content/renderer/loader/navigation_body_loader.h" #include "content/renderer/loader/request_extra_data.h" @@ -1952,7 +1951,6 @@ this, base::BindRepeating(&RenderFrameImpl::RequestOverlayRoutingToken, base::Unretained(this))), - input_target_client_impl_(this), devtools_frame_token_(params.devtools_frame_token) { DCHECK(RenderThread::IsMainThread()); // The InterfaceProvider to access Mojo services exposed by the RFHI must be @@ -6496,10 +6494,6 @@ GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( &RenderFrameImpl::BindFullscreen, weak_factory_.GetWeakPtr())); - registry_.AddInterface( - base::BindRepeating(&InputTargetClientImpl::BindToReceiver, - base::Unretained(&input_target_client_impl_))); - GetAssociatedInterfaceRegistry()->AddInterface(base::BindRepeating( &RenderFrameImpl::BindMhtmlFileWriter, base::Unretained(this)));
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 8d93428..c3d11c6b 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -49,7 +49,6 @@ #include "content/public/renderer/websocket_handshake_throttle_provider.h" #include "content/renderer/content_security_policy_util.h" #include "content/renderer/frame_blame_context.h" -#include "content/renderer/input/input_target_client_impl.h" #include "content/renderer/loader/child_url_loader_factory_bundle.h" #include "content/renderer/media/media_factory.h" #include "content/renderer/render_widget.h" @@ -1474,8 +1473,6 @@ // AndroidOverlay routing token from the browser, if we have one yet. base::Optional<base::UnguessableToken> overlay_routing_token_; - InputTargetClientImpl input_target_client_impl_; - // Used for devtools instrumentation and trace-ability. This token is // used to tag calls and requests in order to attribute them to the context // frame.
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc index d32f9938..fd45c07 100644 --- a/content/renderer/render_frame_proxy.cc +++ b/content/renderer/render_frame_proxy.cc
@@ -332,6 +332,10 @@ SynchronizeVisualProperties(); } +viz::FrameSinkId RenderFrameProxy::GetFrameSinkId() { + return frame_sink_id_; +} + void RenderFrameProxy::DidChangeVisibleViewportSize( const gfx::Size& visible_viewport_size) { DCHECK(ancestor_render_widget_);
diff --git a/content/renderer/render_frame_proxy.h b/content/renderer/render_frame_proxy.h index 6ce13d7..68070242 100644 --- a/content/renderer/render_frame_proxy.h +++ b/content/renderer/render_frame_proxy.h
@@ -172,8 +172,6 @@ return pending_visual_properties_.screen_info; } - const viz::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } - // blink::WebRemoteFrameClient implementation: void FrameDetached(DetachType type) override; blink::AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override; @@ -198,6 +196,7 @@ void UpdateCaptureSequenceNumber(uint32_t capture_sequence_number) override; void PageScaleFactorChanged(float page_scale_factor, bool is_pinch_gesture_active) override; + viz::FrameSinkId GetFrameSinkId() override; void DidStartLoading();
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 1545ffe2..2515a47 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -212,20 +212,6 @@ } #endif -viz::FrameSinkId GetRemoteFrameSinkId(const blink::WebHitTestResult& result) { - const blink::WebNode& node = result.GetNode(); - DCHECK(!node.IsNull()); - blink::WebFrame* result_frame = blink::WebFrame::FromFrameOwnerElement(node); - if (!result_frame || !result_frame->IsWebRemoteFrame()) - return viz::FrameSinkId(); - - blink::WebRemoteFrame* remote_frame = result_frame->ToWebRemoteFrame(); - if (remote_frame->IsIgnoredForHitTest() || !result.ContentBoxContainsPoint()) - return viz::FrameSinkId(); - - return RenderFrameProxy::FromWebFrame(remote_frame)->frame_sink_id(); -} - } // namespace // RenderWidget --------------------------------------------------------------- @@ -502,38 +488,6 @@ layer_tree_host_->SetNeedsCommitWithForcedRedraw(); } -viz::FrameSinkId RenderWidget::GetFrameSinkIdAtPoint(const gfx::PointF& point, - gfx::PointF* local_point) { - blink::WebHitTestResult result = GetHitTestResultAtPoint(point); - - blink::WebNode result_node = result.GetNode(); - *local_point = gfx::PointF(point); - - // TODO(crbug.com/797828): When the node is null the caller may - // need to do extra checks. Like maybe update the layout and then - // call the hit-testing API. Either way it might be better to have - // a DCHECK for the node rather than a null check here. - if (result_node.IsNull()) { - return GetFrameSinkId(); - } - - viz::FrameSinkId frame_sink_id = GetRemoteFrameSinkId(result); - if (frame_sink_id.is_valid()) { - *local_point = gfx::PointF(result.LocalPointWithoutContentBoxOffset()); - if (compositor_deps()->IsUseZoomForDSFEnabled()) { - *local_point = gfx::ConvertPointToDIP( - GetWebWidget()->GetOriginalScreenInfo().device_scale_factor, - *local_point); - } - return frame_sink_id; - } - - // Return the FrameSinkId for the current widget if the point did not hit - // test to a remote frame, or the point is outside of the remote frame's - // content box, or the remote frame doesn't have a valid FrameSinkId yet. - return GetFrameSinkId(); -} - void RenderWidget::SetActive(bool active) { if (delegate()) delegate()->SetActiveForWidget(active); @@ -1145,17 +1099,6 @@ synchronous_resize_mode_for_testing_ = enable; } -blink::WebHitTestResult RenderWidget::GetHitTestResultAtPoint( - const gfx::PointF& point) { - gfx::PointF point_in_pixel(point); - if (compositor_deps()->IsUseZoomForDSFEnabled()) { - point_in_pixel = gfx::ConvertPointToPixel( - GetWebWidget()->GetOriginalScreenInfo().device_scale_factor, - point_in_pixel); - } - return GetWebWidget()->HitTestResultAt(point_in_pixel); -} - void RenderWidget::SetDeviceScaleFactorForTesting(float factor) { DCHECK(for_frame()); GetFrameWidget()->SetDeviceScaleFactorForTesting(factor);
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index c7175053..911fcde0 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h
@@ -303,18 +303,12 @@ void DidNavigate(ukm::SourceId source_id, const GURL& url); - viz::FrameSinkId GetFrameSinkIdAtPoint(const gfx::PointF& point, - gfx::PointF* local_point); - void SetActive(bool active); void UseSynchronousResizeModeForTesting(bool enable); void SetDeviceScaleFactorForTesting(float factor); void SetWindowRectSynchronouslyForTesting(const gfx::Rect& new_window_rect); - // Do a hit test for a given point in viewport coordinate. - blink::WebHitTestResult GetHitTestResultAtPoint(const gfx::PointF& point); - // Forces a redraw and invokes the callback once the frame's been displayed // to the user in the display compositor. using PresentationTimeCallback =
diff --git a/content/renderer/render_widget_browsertest.cc b/content/renderer/render_widget_browsertest.cc index 415efc76..b99ee42 100644 --- a/content/renderer/render_widget_browsertest.cc +++ b/content/renderer/render_widget_browsertest.cc
@@ -177,39 +177,44 @@ // Hit the root EXPECT_EQ(GetCompositorElementId(), widget() - ->GetHitTestResultAtPoint(gfx::PointF(10, 10)) + ->GetWebWidget() + ->HitTestResultAt(gfx::PointF(10, 10)) .GetScrollableContainerId()); // Hit non-scrollable div EXPECT_EQ(GetCompositorElementId(), widget() - ->GetHitTestResultAtPoint(GetCenterPointOfElement("green")) + ->GetWebWidget() + ->HitTestResultAt(GetCenterPointOfElement("green")) .GetScrollableContainerId()); // Hit scrollable div EXPECT_EQ(GetCompositorElementId("red"), widget() - ->GetHitTestResultAtPoint(GetCenterPointOfElement("red")) + ->GetWebWidget() + ->HitTestResultAt(GetCenterPointOfElement("red")) .GetScrollableContainerId()); // Hit overflow:hidden div EXPECT_EQ(GetCompositorElementId(), widget() - ->GetHitTestResultAtPoint(GetCenterPointOfElement("blue")) + ->GetWebWidget() + ->HitTestResultAt(GetCenterPointOfElement("blue")) .GetScrollableContainerId()); // Hit position fixed div EXPECT_EQ(GetCompositorElementId(), widget() - ->GetHitTestResultAtPoint(GetCenterPointOfElement("yellow")) + ->GetWebWidget() + ->HitTestResultAt(GetCenterPointOfElement("yellow")) .GetScrollableContainerId()); // Hit inner scroller inside another scroller - EXPECT_EQ( - GetCompositorElementId("cyan"), - widget() - ->GetHitTestResultAtPoint(GetCenterPointOfElement("cyan-parent")) - .GetScrollableContainerId()); + EXPECT_EQ(GetCompositorElementId("cyan"), + widget() + ->GetWebWidget() + ->HitTestResultAt(GetCenterPointOfElement("cyan-parent")) + .GetScrollableContainerId()); } } @@ -243,48 +248,11 @@ ->GetDocument() .GetVisualViewportScrollingElementIdForTesting(), widget() - ->GetHitTestResultAtPoint(GetCenterPointOfElement("white")) + ->GetWebWidget() + ->HitTestResultAt(GetCenterPointOfElement("white")) .GetScrollableContainerId()); } -TEST_F(RenderWidgetTest, FrameSinkIdHitTestAPI) { - LoadHTML( - R"HTML( - <style> - html, body { - margin :0px; - padding: 0px; - } - </style> - - <div style='background: green; padding: 100px; margin: 0px;'> - <iframe style='width: 200px; height: 100px;' - srcdoc='<body style="margin : 0px; height : 100px; width : 200px;"> - </body>'> - </iframe> - </div> - - )HTML"); - - gfx::PointF point; - viz::FrameSinkId main_frame_sink_id = - widget()->GetFrameSinkIdAtPoint(gfx::PointF(10.43, 10.74), &point); - EXPECT_EQ(static_cast<uint32_t>(widget()->routing_id()), - main_frame_sink_id.sink_id()); - EXPECT_EQ(static_cast<uint32_t>(RenderThreadImpl::Get()->GetClientId()), - main_frame_sink_id.client_id()); - EXPECT_EQ(gfx::PointF(10.43, 10.74), point); - - // Targeting a child frame should also return the FrameSinkId for the main - // widget. - viz::FrameSinkId frame_sink_id = - widget()->GetFrameSinkIdAtPoint(gfx::PointF(150.27, 150.25), &point); - EXPECT_EQ(static_cast<uint32_t>(widget()->routing_id()), - frame_sink_id.sink_id()); - EXPECT_EQ(main_frame_sink_id.client_id(), frame_sink_id.client_id()); - EXPECT_EQ(gfx::PointF(150.27, 150.25), point); -} - TEST_F(RenderWidgetTest, GetCompositionRangeValidComposition) { LoadHTML( "<div contenteditable>EDITABLE</div>"
diff --git a/content/web_test/renderer/web_view_test_proxy.cc b/content/web_test/renderer/web_view_test_proxy.cc index 82e3792..276ff5f 100644 --- a/content/web_test/renderer/web_view_test_proxy.cc +++ b/content/web_test/renderer/web_view_test_proxy.cc
@@ -11,7 +11,6 @@ #include "content/web_test/renderer/test_runner.h" #include "content/web_test/renderer/web_frame_test_proxy.h" #include "net/base/filename_util.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom.h" #include "third_party/blink/public/platform/file_path_conversion.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/public/web/web_frame.h" @@ -145,8 +144,8 @@ test_runner_->SetIsWebPlatformTestsMode(); GetWebView()->GetSettings()->SetV8CacheOptions( - is_devtools_test ? blink::mojom::V8CacheOptions::kNone - : blink::mojom::V8CacheOptions::kDefault); + is_devtools_test ? blink::WebSettings::V8CacheOptions::kNone + : blink::WebSettings::V8CacheOptions::kDefault); if (starting_test) { DCHECK(GetMainRenderFrame());
diff --git a/device/fido/cable/cable_discovery_data.cc b/device/fido/cable/cable_discovery_data.cc index 005b551..1e99915 100644 --- a/device/fido/cable/cable_discovery_data.cc +++ b/device/fido/cable/cable_discovery_data.cc
@@ -7,6 +7,7 @@ #include <cstring> #include "base/time/time.h" +#include "components/cbor/values.h" #include "crypto/random.h" #include "device/fido/cable/v2_handshake.h" #include "device/fido/fido_parsing_utils.h" @@ -26,7 +27,7 @@ IDENTITY_KEY_SEED = 1, }; -void DeriveQRValue(base::span<const uint8_t, 32> qr_generator_key, +void DeriveQRValue(base::span<const uint8_t, kCableQRDataSize> qr_generator_key, const int64_t tick, QRValue type, base::span<uint8_t> out) { @@ -157,7 +158,7 @@ // static std::array<uint8_t, kCableQRSecretSize> CableDiscoveryData::DeriveQRSecret( - base::span<const uint8_t, 32> qr_generator_key, + base::span<const uint8_t, kCableQRDataSize> qr_generator_key, const int64_t tick) { std::array<uint8_t, kCableQRSecretSize> ret; DeriveQRValue(qr_generator_key, tick, QRValue::QR_SECRET, ret); @@ -166,7 +167,7 @@ // static CableIdentityKeySeed CableDiscoveryData::DeriveIdentityKeySeed( - base::span<const uint8_t, 32> qr_generator_key, + base::span<const uint8_t, kCableQRDataSize> qr_generator_key, const int64_t tick) { std::array<uint8_t, kCableIdentityKeySeedSize> ret; DeriveQRValue(qr_generator_key, tick, QRValue::IDENTITY_KEY_SEED, ret); @@ -175,7 +176,7 @@ // static CableQRData CableDiscoveryData::DeriveQRData( - base::span<const uint8_t, 32> qr_generator_key, + base::span<const uint8_t, kCableQRDataSize> qr_generator_key, const int64_t tick) { auto identity_key_seed = DeriveIdentityKeySeed(qr_generator_key, tick); bssl::UniquePtr<EC_GROUP> p256( @@ -229,4 +230,59 @@ DCHECK(ok); } +namespace cablev2 { + +Pairing::Pairing() = default; +Pairing::~Pairing() = default; + +// static +base::Optional<std::unique_ptr<Pairing>> Pairing::Parse( + const cbor::Value& cbor, + uint32_t tunnel_server_domain, + base::span<const uint8_t, kCableIdentityKeySeedSize> local_identity_seed, + base::span<const uint8_t, 32> handshake_hash) { + if (!cbor.is_map()) { + return base::nullopt; + } + + const cbor::Value::MapValue& map = cbor.GetMap(); + auto pairing = std::make_unique<Pairing>(); + + const std::array<cbor::Value::MapValue::const_iterator, 5> its = { + map.find(cbor::Value(1)), map.find(cbor::Value(2)), + map.find(cbor::Value(3)), map.find(cbor::Value(4)), + map.find(cbor::Value(6))}; + const cbor::Value::MapValue::const_iterator name_it = + map.find(cbor::Value(5)); + if (name_it == map.end() || !name_it->second.is_string() || + std::any_of( + &its[0], &its[its.size()], + [&map](const cbor::Value::MapValue::const_iterator& it) -> bool { + return it == map.end() || !it->second.is_bytestring(); + }) || + its[3]->second.GetBytestring().size() != + std::tuple_size<decltype(pairing->peer_public_key_x962)>::value) { + } + + pairing->tunnel_server_domain = + tunnelserver::DecodeDomain(tunnel_server_domain), + pairing->contact_id = its[0]->second.GetBytestring(); + pairing->id = its[1]->second.GetBytestring(); + pairing->secret = its[2]->second.GetBytestring(); + const std::vector<uint8_t>& peer_public_key = its[3]->second.GetBytestring(); + std::copy(peer_public_key.begin(), peer_public_key.end(), + pairing->peer_public_key_x962.begin()); + pairing->name = name_it->second.GetString(); + + if (!VerifyPairingSignature(local_identity_seed, + pairing->peer_public_key_x962, handshake_hash, + its[4]->second.GetBytestring())) { + return base::nullopt; + } + + return pairing; +} + +} // namespace cablev2 + } // namespace device
diff --git a/device/fido/cable/cable_discovery_data.h b/device/fido/cable/cable_discovery_data.h index 54bde8a2..4326ee9 100644 --- a/device/fido/cable/cable_discovery_data.h +++ b/device/fido/cable/cable_discovery_data.h
@@ -10,8 +10,13 @@ #include "base/component_export.h" #include "base/containers/span.h" +#include "base/optional.h" #include "device/fido/fido_constants.h" +namespace cbor { +class Value; +} + namespace device { constexpr size_t kCableEphemeralIdSize = 16; @@ -26,10 +31,9 @@ using CableEidArray = std::array<uint8_t, kCableEphemeralIdSize>; using CableSessionPreKeyArray = std::array<uint8_t, kCableSessionPreKeySize>; -// QRGeneratorKey is a random, AES-256 key that is used by -// |CableDiscoveryData::DeriveQRKeyMaterial| to encrypt a coarse timestamp and -// generate QR secrets, EIDs, etc. -using QRGeneratorKey = std::array<uint8_t, 32>; +// QRGeneratorKey is a hang-over from old code that hasn't been renamed yet. +// TODO(agl): remove +using QRGeneratorKey = std::array<uint8_t, kCableQRDataSize>; // CableNonce is a nonce used in BLE handshaking. using CableNonce = std::array<uint8_t, 8>; // CableEidGeneratorKey is an AES-256 key that is used to encrypt a 64-bit nonce @@ -105,20 +109,20 @@ // DeriveQRKeyMaterial returns a QR-secret given a generating key and a // timestamp. static std::array<uint8_t, kCableQRSecretSize> DeriveQRSecret( - base::span<const uint8_t, 32> qr_generator_key, + base::span<const uint8_t, kCableQRDataSize> qr_generator_key, const int64_t tick); // DeriveIdentityKeySeed returns a seed that can be used to create a P-256 // identity key for a handshake using |EC_KEY_derive_from_secret|. static CableIdentityKeySeed DeriveIdentityKeySeed( - base::span<const uint8_t, 32> qr_generator_key, + base::span<const uint8_t, kCableQRDataSize> qr_generator_key, const int64_t tick); // DeriveQRData returns the QR data, a combination of QR secret and public // identity key. This is base64url-encoded and placed in a caBLE v2 QR code // with a prefix prepended. static CableQRData DeriveQRData( - base::span<const uint8_t, 32> qr_generator_key, + base::span<const uint8_t, kCableQRDataSize> qr_generator_key, const int64_t tick); // version indicates whether v1 or v2 data is contained in this object. @@ -156,6 +160,47 @@ base::span<const uint8_t, kCableQRSecretSize> qr_secret); }; +namespace cablev2 { + +// Pairing represents information previously received from a caBLEv2 +// authenticator that enables future interactions to skip scanning a QR code. +struct COMPONENT_EXPORT(DEVICE_FIDO) Pairing { + Pairing(); + ~Pairing(); + Pairing(const Pairing&) = delete; + Pairing& operator=(const Pairing&) = delete; + + // Parse builds a |Pairing| from an authenticator message. The signature + // within the structure is validated by using |local_identity_seed| and + // |handshake_hash|. + static base::Optional<std::unique_ptr<Pairing>> Parse( + const cbor::Value& cbor, + uint32_t tunnel_server_domain, + base::span<const uint8_t, kCableIdentityKeySeedSize> local_identity_seed, + base::span<const uint8_t, 32> handshake_hash); + + // tunnel_server_domain is known to be a valid hostname as it's constructed + // from the 22-bit value in the BLE advert rather than being parsed as a + // string from the authenticator. + std::string tunnel_server_domain; + // contact_id is an opaque value that is sent to the tunnel service in order + // to identify the caBLEv2 authenticator. + std::vector<uint8_t> contact_id; + // id is an opaque identifier that is sent via the tunnel service, to the + // authenticator, to identify this specific pairing. + std::vector<uint8_t> id; + // secret is the shared secret that authenticates the desktop to the + // authenticator. + std::vector<uint8_t> secret; + // peer_public_key_x962 is the authenticator's public key. + std::array<uint8_t, kP256X962Length> peer_public_key_x962; + // name is a human-friendly name for the authenticator, specified by that + // authenticator. (For example "Pixel 3".) + std::string name; +}; + +} // namespace cablev2 + } // namespace device #endif // DEVICE_FIDO_CABLE_CABLE_DISCOVERY_DATA_H_
diff --git a/device/fido/cable/fido_cable_discovery.cc b/device/fido/cable/fido_cable_discovery.cc index f4e8c2f..9f81e146 100644 --- a/device/fido/cable/fido_cable_discovery.cc +++ b/device/fido/cable/fido_cable_discovery.cc
@@ -526,9 +526,9 @@ !network_context_) { return; } - AddDevice(std::make_unique<cablev2::FidoTunnelDevice>( - network_context_, *result->discovery_data.v2, result->eid, - *result->decrypted_eid)); + // Disabled in order to make each step of a multi-CL change compile. + // TODO(agl): reenable + // AddDevice(...); break; }
diff --git a/device/fido/cable/fido_cable_discovery_unittest.cc b/device/fido/cable/fido_cable_discovery_unittest.cc index 9ac27ec..82bd101d 100644 --- a/device/fido/cable/fido_cable_discovery_unittest.cc +++ b/device/fido/cable/fido_cable_discovery_unittest.cc
@@ -343,8 +343,8 @@ device, nonce, discovery_data.v1->session_pre_key); } - static std::array<uint8_t, 32> BogusQRGeneratorKey() { - std::array<uint8_t, 32> ret; + static std::array<uint8_t, kCableQRDataSize> BogusQRGeneratorKey() { + std::array<uint8_t, kCableQRDataSize> ret; memset(ret.data(), 0, ret.size()); return ret; }
diff --git a/device/fido/cable/fido_tunnel_device.cc b/device/fido/cable/fido_tunnel_device.cc index 457971a0b..ce2d9816 100644 --- a/device/fido/cable/fido_tunnel_device.cc +++ b/device/fido/cable/fido_tunnel_device.cc
@@ -5,16 +5,43 @@ #include "device/fido/cable/fido_tunnel_device.h" #include "base/strings/string_number_conversions.h" +#include "base/threading/thread_task_runner_handle.h" +#include "components/cbor/values.h" +#include "components/cbor/writer.h" #include "components/device_event_log/device_event_log.h" #include "crypto/random.h" +#include "device/fido/cable/cable_discovery_data.h" +#include "device/fido/cbor_extract.h" #include "device/fido/fido_constants.h" +#include "device/fido/fido_parsing_utils.h" #include "net/traffic_annotation/network_traffic_annotation.h" +#include "third_party/boringssl/src/include/openssl/aes.h" #include "third_party/boringssl/src/include/openssl/digest.h" #include "third_party/boringssl/src/include/openssl/hkdf.h" +using device::cbor_extract::IntKey; +using device::cbor_extract::Is; +using device::cbor_extract::StepOrByte; +using device::cbor_extract::Stop; + namespace device { namespace cablev2 { +namespace { + +std::array<uint8_t, 8> RandomId() { + std::array<uint8_t, 8> ret; + crypto::RandBytes(ret); + return ret; +} + +} // namespace + +FidoTunnelDevice::QRInfo::QRInfo() = default; +FidoTunnelDevice::QRInfo::~QRInfo() = default; +FidoTunnelDevice::PairedInfo::PairedInfo() = default; +FidoTunnelDevice::PairedInfo::~PairedInfo() = default; + constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = net::DefineNetworkTrafficAnnotation("cablev2_websocket_from_client", R"( semantics { @@ -45,29 +72,32 @@ FidoTunnelDevice::FidoTunnelDevice( network::mojom::NetworkContext* network_context, - const CableDiscoveryData::V2Data& v2data, + base::OnceCallback<void(std::unique_ptr<Pairing>)> pairing_callback, + base::span<const uint8_t> secret, + base::span<const uint8_t, kCableIdentityKeySeedSize> local_identity_seed, const CableEidArray& eid, const CableEidArray& decrypted_eid) - : v2data_(v2data) { + : info_(absl::in_place_type<QRInfo>), id_(RandomId()) { DCHECK(eid::IsValid(decrypted_eid)); - crypto::RandBytes(id_); - const eid::Components components = eid::ToComponents(decrypted_eid); - nonce_and_eid_.first = components.nonce; - nonce_and_eid_.second = eid; + + QRInfo& info = absl::get<QRInfo>(info_); + info.pairing_callback = std::move(pairing_callback); + info.eid = eid; + info.local_identity_seed = + fido_parsing_utils::Materialize(local_identity_seed); + info.tunnel_server_domain = components.tunnel_server_domain; + + info.psk = Derive<EXTENT(info.psk)>(secret, components.nonce, + DerivedValueType::kPSK); std::array<uint8_t, 16> tunnel_id; - bool ok = HKDF(tunnel_id.data(), tunnel_id.size(), EVP_sha256(), - v2data_.tunnel_id_gen_key.data(), - v2data_.tunnel_id_gen_key.size(), components.nonce.data(), - components.nonce.size(), /*info=*/nullptr, 0); - DCHECK(ok); + tunnel_id = Derive<EXTENT(tunnel_id)>(secret, components.nonce, + DerivedValueType::kTunnelID); - const GURL url(cablev2::tunnelserver::GetURL( - components.tunnel_server_domain, cablev2::tunnelserver::Action::kConnect, - tunnel_id)); - FIDO_LOG(DEBUG) << "Connecting caBLEv2 tunnel: " << url - << " shard: " << static_cast<int>(components.shard_id); + const GURL url(tunnelserver::GetConnectURL(components.tunnel_server_domain, + components.routing_id, tunnel_id)); + FIDO_LOG(DEBUG) << GetId() << ": connecting caBLEv2 tunnel: " << url; websocket_client_ = std::make_unique<device::cablev2::WebSocketAdapter>( base::BindOnce(&FidoTunnelDevice::OnTunnelReady, base::Unretained(this)), @@ -84,20 +114,102 @@ mojo::NullRemote()); } +FidoTunnelDevice::FidoTunnelDevice( + network::mojom::NetworkContext* network_context, + std::unique_ptr<Pairing> pairing) + : info_(absl::in_place_type<PairedInfo>), id_(RandomId()) { + uint8_t client_nonce[kClientNonceSize]; + crypto::RandBytes(client_nonce); + + cbor::Value::MapValue client_payload; + client_payload.emplace(1, pairing->id); + client_payload.emplace(2, base::span<const uint8_t>(client_nonce)); + const base::Optional<std::vector<uint8_t>> client_payload_bytes = + cbor::Writer::Write(cbor::Value(std::move(client_payload))); + CHECK(client_payload_bytes.has_value()); + const std::string client_payload_hex = base::HexEncode(*client_payload_bytes); + + PairedInfo& info = absl::get<PairedInfo>(info_); + info.eid_encryption_key = Derive<EXTENT(info.eid_encryption_key)>( + pairing->secret, client_nonce, DerivedValueType::kEIDKey); + info.peer_identity = pairing->peer_public_key_x962; + info.secret = pairing->secret; + + const GURL url = tunnelserver::GetContactURL(pairing->tunnel_server_domain, + pairing->contact_id); + FIDO_LOG(DEBUG) << GetId() << ": connecting caBLEv2 tunnel: " << url; + + websocket_client_ = std::make_unique<device::cablev2::WebSocketAdapter>( + base::BindOnce(&FidoTunnelDevice::OnTunnelReady, base::Unretained(this)), + base::BindRepeating(&FidoTunnelDevice::OnTunnelData, + base::Unretained(this))); + std::vector<network::mojom::HttpHeaderPtr> headers; + headers.emplace_back(network::mojom::HttpHeader::New( + kCableClientPayloadHeader, client_payload_hex)); + network_context->CreateWebSocket( + url, {kCableWebSocketProtocol}, net::SiteForCookies(), + net::IsolationInfo(), std::move(headers), + network::mojom::kBrowserProcessId, + /*render_frame_id=*/0, url::Origin::Create(url), + network::mojom::kWebSocketOptionBlockAllCookies, + net::MutableNetworkTrafficAnnotationTag(kTrafficAnnotation), + websocket_client_->BindNewHandshakeClientPipe(), mojo::NullRemote(), + mojo::NullRemote()); +} + FidoTunnelDevice::~FidoTunnelDevice() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } +bool FidoTunnelDevice::MatchEID(const CableEidArray& eid) { + PairedInfo& info = absl::get<PairedInfo>(info_); + + AES_KEY key; + CHECK(AES_set_decrypt_key(info.eid_encryption_key.data(), + /*bits=*/8 * info.eid_encryption_key.size(), + &key) == 0); + CableEidArray plaintext; + static_assert(EXTENT(plaintext) == AES_BLOCK_SIZE, "EIDs are not AES blocks"); + AES_decrypt(/*in=*/eid.data(), /*out=*/plaintext.data(), &key); + + if (!eid::IsValid(plaintext)) { + return false; + } + + const eid::Components components = eid::ToComponents(plaintext); + static_assert(EXTENT(components.routing_id) == 3, ""); + if (components.routing_id[0] || components.routing_id[1] || + components.routing_id[2]) { + return false; + } + + info.eid = eid; + info.psk = Derive<EXTENT(*info.psk)>(info.secret, components.nonce, + DerivedValueType::kPSK); + + if (state_ == State::kWaitingForEID) { + // The handshake message has already been received. It can now be answered. + ProcessHandshake(*info.handshake_message); + } + + return true; +} + FidoDevice::CancelToken FidoTunnelDevice::DeviceTransact( std::vector<uint8_t> command, DeviceCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!callback_); - pending_message_ = std::move(command); - callback_ = std::move(callback); - if (state_ == State::kHandshakeProcessed || state_ == State::kReady) { - MaybeFlushPendingMessage(); + if (state_ == State::kError) { + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), base::nullopt)); + } else { + pending_message_ = std::move(command); + callback_ = std::move(callback); + if (state_ == State::kHandshakeProcessed || state_ == State::kReady) { + MaybeFlushPendingMessage(); + } } // TODO: cancelation would be useful, but it depends on the GMSCore action @@ -124,12 +236,19 @@ return weak_factory_.GetWeakPtr(); } +// This is a dummy function to allow things to compile at each step of a +// multi-CL sequence. void FidoTunnelDevice::OnTunnelReady(bool ok, - base::Optional<uint8_t> shard_id) { + base::Optional<uint8_t> routing_id) {} + +void FidoTunnelDevice::OnTunnelReady_Future( + bool ok, + base::Optional<std::array<uint8_t, kRoutingIdSize>> routing_id) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_EQ(State::kConnecting, state_); if (!ok) { + FIDO_LOG(DEBUG) << GetId() << ": tunnel failed to connect"; OnError(); return; } @@ -148,29 +267,15 @@ switch (state_) { case State::kError: + break; + case State::kConnecting: - NOTREACHED(); + case State::kWaitingForEID: + OnError(); break; case State::kConnected: { - std::vector<uint8_t> response; - base::Optional<std::pair<std::unique_ptr<Crypter>, std::vector<uint8_t>>> - result(cablev2::RespondToHandshake( - v2data_.psk_gen_key, nonce_and_eid_, v2data_.local_identity_seed, - base::nullopt, *data, &response)); - if (!result || result->second.empty()) { - FIDO_LOG(ERROR) << "caBLEv2 handshake failed"; - OnError(); - return; - } - - FIDO_LOG(DEBUG) << "caBLEv2 handshake successful"; - websocket_client_->Write(response); - crypter_ = std::move(result->first); - getinfo_response_bytes_ = std::move(result->second); - state_ = State::kHandshakeProcessed; - - MaybeFlushPendingMessage(); + ProcessHandshake(*data); break; } @@ -179,18 +284,34 @@ // information. std::vector<uint8_t> decrypted; if (!crypter_->Decrypt(*data, &decrypted)) { - FIDO_LOG(ERROR) << "decryption failed for caBLE pairing message"; + FIDO_LOG(ERROR) << GetId() + << ": decryption failed for caBLE pairing message"; OnError(); return; } base::Optional<cbor::Value> payload = DecodePaddedCBORMap(decrypted); - if (!payload) { - FIDO_LOG(ERROR) << "decode failed for caBLE pairing message"; + if (!payload || !payload->is_map()) { + FIDO_LOG(ERROR) << GetId() + << ": decode failed for caBLE pairing message"; OnError(); return; } - // TODO: pairing not yet handled. + // The map may be empty if the peer doesn't wish to send pairing + // information. + if (!payload->GetMap().empty()) { + QRInfo& info = absl::get<QRInfo>(info_); + base::Optional<std::unique_ptr<Pairing>> maybe_pairing = + Pairing::Parse(*payload, info.tunnel_server_domain, + info.local_identity_seed, *info.handshake_hash); + if (!maybe_pairing) { + FIDO_LOG(ERROR) << GetId() << ": invalid caBLE pairing message"; + OnError(); + return; + } + + std::move(info.pairing_callback).Run(std::move(*maybe_pairing)); + } state_ = State::kReady; break; @@ -204,7 +325,7 @@ std::vector<uint8_t> plaintext; if (!crypter_->Decrypt(*data, &plaintext)) { - FIDO_LOG(ERROR) << "decryption failed for caBLE message"; + FIDO_LOG(ERROR) << GetId() << ": decryption failed for caBLE message"; OnError(); return; } @@ -215,6 +336,57 @@ } } +void FidoTunnelDevice::ProcessHandshake(base::span<const uint8_t> data) { + DCHECK(state_ == State::kWaitingForEID || state_ == State::kConnected); + + std::vector<uint8_t> response; + base::Optional<ResponderResult> result; + + if (auto* info = absl::get_if<QRInfo>(&info_)) { + base::Optional<ResponderResult> inner_result(cablev2::RespondToHandshake( + info->psk, info->eid, info->local_identity_seed, base::nullopt, data, + &response)); + if (inner_result) { + result.emplace(std::move(*inner_result)); + } + state_ = State::kHandshakeProcessed; + } else if (auto* info = absl::get_if<PairedInfo>(&info_)) { + if (!info->eid) { + DCHECK_EQ(state_, State::kConnected); + state_ = State::kWaitingForEID; + info->handshake_message = fido_parsing_utils::Materialize(data); + return; + } + + base::Optional<ResponderResult> inner_result( + cablev2::RespondToHandshake(*info->psk, *info->eid, + /*local_identity=*/base::nullopt, + info->peer_identity, data, &response)); + if (inner_result) { + result.emplace(std::move(*inner_result)); + } + state_ = State::kReady; + } else { + CHECK(false); + } + + if (!result || result->getinfo_bytes.empty()) { + FIDO_LOG(ERROR) << GetId() << ": caBLEv2 handshake failed"; + OnError(); + return; + } + + FIDO_LOG(DEBUG) << GetId() << ": caBLEv2 handshake successful"; + websocket_client_->Write(response); + if (auto* info = absl::get_if<QRInfo>(&info_)) { + info->handshake_hash = result->handshake_hash; + } + crypter_ = std::move(result->crypter); + getinfo_response_bytes_ = std::move(result->getinfo_bytes); + + MaybeFlushPendingMessage(); +} + void FidoTunnelDevice::OnError() { state_ = State::kError; websocket_client_.reset(); @@ -238,7 +410,8 @@ reply.push_back(static_cast<uint8_t>(CtapDeviceResponseCode::kSuccess)); reply.insert(reply.end(), getinfo_response_bytes_.begin(), getinfo_response_bytes_.end()); - std::move(callback_).Run(std::move(reply)); + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback_), std::move(reply))); } else if (crypter_->Encrypt(&pending)) { websocket_client_->Write(pending); }
diff --git a/device/fido/cable/fido_tunnel_device.h b/device/fido/cable/fido_tunnel_device.h index 6e9e8be8..c08255d 100644 --- a/device/fido/cable/fido_tunnel_device.h +++ b/device/fido/cable/fido_tunnel_device.h
@@ -7,11 +7,12 @@ #include <vector> +#include "base/callback_forward.h" #include "base/sequence_checker.h" -#include "device/fido/cable/cable_discovery_data.h" #include "device/fido/cable/v2_handshake.h" #include "device/fido/cable/websocket_adapter.h" #include "device/fido/fido_device.h" +#include "third_party/abseil-cpp/absl/types/variant.h" namespace network { namespace mojom { @@ -24,15 +25,30 @@ class Crypter; class WebSocketAdapter; +struct Pairing; class COMPONENT_EXPORT(DEVICE_FIDO) FidoTunnelDevice : public FidoDevice { public: + // This constructor is used for QR-initiated connections. + FidoTunnelDevice( + network::mojom::NetworkContext* network_context, + base::OnceCallback<void(std::unique_ptr<Pairing>)> pairing_callback, + base::span<const uint8_t> secret, + base::span<const uint8_t, kCableIdentityKeySeedSize> local_identity_seed, + const CableEidArray& eid, + const CableEidArray& decrypted_eid); + + // This constructor is used for pairing-initiated connections. FidoTunnelDevice(network::mojom::NetworkContext* network_context, - const CableDiscoveryData::V2Data& v2data, - const CableEidArray& eid, - const CableEidArray& decrypted_eid); + std::unique_ptr<Pairing> pairing); + ~FidoTunnelDevice() override; + // MatchEID is only valid for a pairing-initiated connection. It returns true + // if the given |eid| matched this pending tunnel and thus this device is now + // ready. + bool MatchEID(const CableEidArray& eid); + // FidoDevice: CancelToken DeviceTransact(std::vector<uint8_t> command, DeviceCallback callback) override; @@ -45,20 +61,54 @@ enum class State { kConnecting, kConnected, + kWaitingForEID, kHandshakeProcessed, kReady, kError, }; - void OnTunnelReady(bool ok, base::Optional<uint8_t> shard_id); + struct QRInfo { + QRInfo(); + ~QRInfo(); + QRInfo(const QRInfo&) = delete; + QRInfo& operator=(const QRInfo&) = delete; + + CableEidArray eid; + std::array<uint8_t, 32> psk; + base::OnceCallback<void(std::unique_ptr<Pairing>)> pairing_callback; + std::array<uint8_t, kCableIdentityKeySeedSize> local_identity_seed; + uint32_t tunnel_server_domain; + base::Optional<HandshakeHash> handshake_hash; + }; + + struct PairedInfo { + PairedInfo(); + ~PairedInfo(); + PairedInfo(const PairedInfo&) = delete; + PairedInfo& operator=(const PairedInfo&) = delete; + + std::array<uint8_t, 32> eid_encryption_key; + std::array<uint8_t, kP256X962Length> peer_identity; + std::vector<uint8_t> secret; + base::Optional<CableEidArray> eid; + base::Optional<std::array<uint8_t, 32>> psk; + base::Optional<std::vector<uint8_t>> handshake_message; + }; + + // This is a dummy function to allow things to compile at each step of a + // multi-CL sequence. + void OnTunnelReady(bool ok, base::Optional<uint8_t> routing_id); + void OnTunnelReady_Future( + bool ok, + base::Optional<std::array<uint8_t, kRoutingIdSize>> routing_id); void OnTunnelData(base::Optional<base::span<const uint8_t>> data); + void ProcessHandshake(base::span<const uint8_t> data); void OnError(); void MaybeFlushPendingMessage(); State state_ = State::kConnecting; - std::array<uint8_t, 8> id_; - const CableDiscoveryData::V2Data v2data_; - cablev2::NonceAndEID nonce_and_eid_; + absl::variant<QRInfo, PairedInfo> info_; + const std::array<uint8_t, 8> id_; std::unique_ptr<WebSocketAdapter> websocket_client_; std::unique_ptr<Crypter> crypter_; std::vector<uint8_t> getinfo_response_bytes_;
diff --git a/device/fido/cable/noise.cc b/device/fido/cable/noise.cc index 7926500..a2bdf416 100644 --- a/device/fido/cable/noise.cc +++ b/device/fido/cable/noise.cc
@@ -124,6 +124,10 @@ return plaintext; } +std::array<uint8_t, 32> Noise::handshake_hash() const { + return h_; +} + void Noise::MixHashPoint(const EC_POINT* point) { uint8_t x962[kP256X962Length]; bssl::UniquePtr<EC_GROUP> p256(
diff --git a/device/fido/cable/noise.h b/device/fido/cable/noise.h index 0372f45..2cd5840 100644 --- a/device/fido/cable/noise.h +++ b/device/fido/cable/noise.h
@@ -41,6 +41,7 @@ std::vector<uint8_t> EncryptAndHash(base::span<const uint8_t> plaintext); base::Optional<std::vector<uint8_t>> DecryptAndHash( base::span<const uint8_t> ciphertext); + std::array<uint8_t, 32> handshake_hash() const; // MaxHashPoint calls |MixHash| with the uncompressed, X9.62 serialization of // |point|.
diff --git a/device/fido/cable/v2_handshake.cc b/device/fido/cable/v2_handshake.cc index 41c12e9..a4fb8163e 100644 --- a/device/fido/cable/v2_handshake.cc +++ b/device/fido/cable/v2_handshake.cc
@@ -7,9 +7,11 @@ #include <array> #include <type_traits> +#include "base/base64url.h" #include "base/bits.h" #include "base/numerics/safe_math.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/string_piece.h" #include "components/cbor/reader.h" #include "components/cbor/values.h" #include "components/cbor/writer.h" @@ -23,10 +25,15 @@ #include "third_party/boringssl/src/include/openssl/ec_key.h" #include "third_party/boringssl/src/include/openssl/ecdh.h" #include "third_party/boringssl/src/include/openssl/hkdf.h" +#include "third_party/boringssl/src/include/openssl/hmac.h" +#include "third_party/boringssl/src/include/openssl/mem.h" #include "third_party/boringssl/src/include/openssl/obj.h" #include "third_party/boringssl/src/include/openssl/sha.h" #include "url/gurl.h" +namespace device { +namespace cablev2 { + namespace { // Maximum value of a sequence number. Exceeding this causes all operations to @@ -47,16 +54,39 @@ return true; } +std::array<uint8_t, 32> PairingSignature( + const EC_KEY* identity_key, + base::span<const uint8_t, kP256X962Length> peer_public_key_x962, + base::span<const uint8_t, std::tuple_size<HandshakeHash>::value> + handshake_hash) { + const EC_GROUP* const p256 = EC_KEY_get0_group(identity_key); + bssl::UniquePtr<EC_POINT> peer_public_key(EC_POINT_new(p256)); + CHECK(EC_POINT_oct2point(p256, peer_public_key.get(), + peer_public_key_x962.data(), + peer_public_key_x962.size(), + /*ctx=*/nullptr)); + uint8_t shared_secret[32]; + CHECK(ECDH_compute_key(shared_secret, sizeof(shared_secret), + peer_public_key.get(), identity_key, + /*kdf=*/nullptr) == sizeof(shared_secret)); + + std::array<uint8_t, SHA256_DIGEST_LENGTH> expected_signature; + unsigned expected_signature_len = 0; + CHECK(HMAC(EVP_sha256(), /*key=*/shared_secret, sizeof(shared_secret), + handshake_hash.data(), handshake_hash.size(), + expected_signature.data(), &expected_signature_len) != nullptr); + CHECK_EQ(expected_signature_len, EXTENT(expected_signature)); + return expected_signature; +} + } // namespace -namespace device { -namespace cablev2 { - namespace tunnelserver { -GURL GetURL(uint32_t domain, Action action, base::span<const uint8_t, 16> id) { - std::string ret = "wss://"; +std::string DecodeDomain(uint32_t domain) { static const char kBase32Chars[33] = "abcdefghijklmnopqrstuvwxyz234567"; + + std::string ret; ret.push_back(kBase32Chars[(domain >> 17) & 0x1f]); ret.push_back(kBase32Chars[(domain >> 12) & 0x1f]); ret.push_back(kBase32Chars[(domain >> 7) & 0x1f]); @@ -66,72 +96,113 @@ static const char kTLDs[4][5] = {"com", "org", "net", "info"}; ret += kTLDs[domain & 3]; - switch (action) { - case Action::kNew: - ret += "/cable/new/"; - break; - case Action::kConnect: - ret += "/cable/connect/"; - break; - } + return ret; +} + +GURL GetNewTunnelURL(uint32_t domain, base::span<const uint8_t, 16> id) { + std::string ret = "wss://" + DecodeDomain(domain) + "/cable/new/"; ret += base::HexEncode(id); const GURL url(ret); DCHECK(url.is_valid()); return url; } + +GURL GetConnectURL(uint32_t domain, + std::array<uint8_t, kRoutingIdSize> routing_id, + base::span<const uint8_t, 16> id) { + std::string ret = "wss://" + DecodeDomain(domain) + "/cable/connect/"; + + ret += base::HexEncode(routing_id); + ret += "/"; + ret += base::HexEncode(id); + + const GURL url(ret); + DCHECK(url.is_valid()); + return url; +} + +GURL GetContactURL(const std::string& tunnel_server, + base::span<const uint8_t> contact_id) { + std::string contact_id_base64; + base::Base64UrlEncode( + base::StringPiece(reinterpret_cast<const char*>(contact_id.data()), + contact_id.size()), + base::Base64UrlEncodePolicy::OMIT_PADDING, &contact_id_base64); + GURL ret(std::string("wss://") + tunnel_server + "/cable/contact/" + + contact_id_base64); + DCHECK(ret.is_valid()); + return ret; +} + } // namespace tunnelserver namespace eid { CableEidArray FromComponents(const Components& components) { DCHECK_EQ(components.tunnel_server_domain >> 22, 0u); - DCHECK_EQ(components.shard_id >> 6, 0); - const uint32_t header = components.tunnel_server_domain | - (static_cast<uint32_t>(components.shard_id) << 22); CableEidArray eid; - constexpr size_t eid_size = - std::tuple_size<std::remove_reference<decltype(eid)>::type>::value; - memset(eid.data(), 0, eid.size()); - static_assert(eid_size >= sizeof(header), "EID too small"); - memcpy(eid.data(), &header, sizeof(header)); - static_assert(eid_size == 6 + kNonceSize, "EID wrong size"); - static_assert( - std::tuple_size<decltype(components.nonce)>::value == kNonceSize, - "Nonce wrong size"); - memcpy(eid.data() + 6, components.nonce.data(), kNonceSize); + static_assert(EXTENT(eid) == 16, ""); + eid[0] = components.tunnel_server_domain; + eid[1] = components.tunnel_server_domain >> 8; + eid[2] = components.tunnel_server_domain >> 16; + static_assert(EXTENT(components.routing_id) == 3, ""); + eid[3] = components.routing_id[0]; + eid[4] = components.routing_id[1]; + eid[5] = components.routing_id[2]; + eid[6] = 0; + eid[7] = 0; + static_assert(EXTENT(eid) == 8 + kNonceSize, ""); + memcpy(&eid[8], components.nonce.data(), kNonceSize); + return eid; } bool IsValid(const CableEidArray& eid) { - static_assert( - std::tuple_size<std::remove_reference<decltype(eid)>::type>::value >= 6, - "EID too small"); - return (eid[3] & 0xc0) == 0 && eid[4] == 0 && eid[5] == 0; + static_assert(EXTENT(eid) >= 8, ""); + return eid[6] == 0 && eid[7] == 0 && (eid[2] >> 6) == 0; } Components ToComponents(const CableEidArray& eid) { DCHECK(IsValid(eid)); - constexpr size_t eid_size = - std::tuple_size<std::remove_reference<decltype(eid)>::type>::value; Components ret; - uint32_t header; - static_assert(eid_size >= sizeof(header), "EID too small"); - memcpy(&header, eid.data(), sizeof(header)); - ret.shard_id = (header >> 22) & 0x3f; - ret.tunnel_server_domain = header & 0x3fffff; - static_assert(eid_size == 6 + std::tuple_size<decltype(ret.nonce)>::value, - "EID too small"); - memcpy(ret.nonce.data(), eid.data() + 6, ret.nonce.size()); + static_assert(EXTENT(eid) == 16, ""); + ret.tunnel_server_domain = static_cast<uint32_t>(eid[0]) | + (static_cast<uint32_t>(eid[1]) << 8) | + ((static_cast<uint32_t>(eid[2]) & 0x3f) << 16); + ret.routing_id[0] = eid[3]; + ret.routing_id[1] = eid[4]; + ret.routing_id[2] = eid[5]; + + static_assert(EXTENT(eid) == 8 + kNonceSize, ""); + memcpy(ret.nonce.data(), &eid[8], kNonceSize); return ret; } } // namespace eid +namespace internal { + +void Derive(uint8_t* out, + size_t out_len, + base::span<const uint8_t> secret, + base::span<const uint8_t> nonce, + DerivedValueType type) { + static_assert(sizeof(DerivedValueType) <= sizeof(uint32_t), ""); + const uint32_t type32 = static_cast<uint32_t>(type); + + HKDF(out, out_len, EVP_sha256(), secret.data(), secret.size(), + /*salt=*/nonce.data(), nonce.size(), + /*info=*/reinterpret_cast<const uint8_t*>(&type32), sizeof(type32)); +} + +} // namespace internal + base::Optional<std::vector<uint8_t>> EncodePaddedCBORMap( cbor::Value::MapValue map) { + // TODO: this should pad to 1K, not 256 bytes. base::Optional<std::vector<uint8_t>> cbor_bytes = cbor::Writer::Write(cbor::Value(std::move(map))); if (!cbor_bytes) { @@ -273,15 +344,12 @@ } HandshakeInitiator::HandshakeInitiator( - base::span<const uint8_t, 32> psk_gen_key, - base::span<const uint8_t, kNonceSize> nonce, + base::span<const uint8_t, 32> psk, base::Optional<base::span<const uint8_t, kP256X962Length>> peer_identity, bssl::UniquePtr<EC_KEY> local_identity) - : local_identity_(std::move(local_identity)) { + : psk_(fido_parsing_utils::Materialize(psk)), + local_identity_(std::move(local_identity)) { DCHECK(peer_identity.has_value() ^ static_cast<bool>(local_identity_)); - HKDF(psk_.data(), psk_.size(), EVP_sha256(), psk_gen_key.data(), - psk_gen_key.size(), /*salt=*/nonce.data(), nonce.size(), - /*info=*/nullptr, 0); if (peer_identity) { peer_identity_ = fido_parsing_utils::Materialize<kP256X962Length>(*peer_identity); @@ -359,8 +427,8 @@ return handshake_message; } -base::Optional<std::unique_ptr<Crypter>> HandshakeInitiator::ProcessResponse( - base::span<const uint8_t> response) { +base::Optional<std::pair<std::unique_ptr<Crypter>, HandshakeHash>> +HandshakeInitiator::ProcessResponse(base::span<const uint8_t> response) { if (response.size() < kP256X962Length) { FIDO_LOG(DEBUG) << "Handshake response truncated (" << response.size() << " bytes)"; @@ -405,13 +473,22 @@ std::array<uint8_t, 32> read_key, write_key; std::tie(write_key, read_key) = noise_.traffic_keys(); - return std::make_unique<cablev2::Crypter>(read_key, write_key); + return std::make_pair(std::make_unique<cablev2::Crypter>(read_key, write_key), + noise_.handshake_hash()); } -base::Optional<std::pair<std::unique_ptr<Crypter>, std::vector<uint8_t>>> -RespondToHandshake( - base::span<const uint8_t, 32> psk_gen_key, - const NonceAndEID& nonce_and_eid, +ResponderResult::ResponderResult(std::unique_ptr<Crypter> in_crypter, + std::vector<uint8_t> in_getinfo_bytes, + HandshakeHash in_handshake_hash) + : crypter(std::move(in_crypter)), + getinfo_bytes(std::move(in_getinfo_bytes)), + handshake_hash(in_handshake_hash) {} +ResponderResult::~ResponderResult() = default; +ResponderResult::ResponderResult(ResponderResult&&) = default; + +base::Optional<ResponderResult> RespondToHandshake( + base::span<const uint8_t, 32> psk, + base::span<const uint8_t, kCableEphemeralIdSize> eid, base::Optional<base::span<const uint8_t, kCableIdentityKeySeedSize>> identity_seed, base::Optional<base::span<const uint8_t, kP256X962Length>> peer_identity, @@ -435,9 +512,8 @@ } Noise noise; - uint8_t prologue[1 + kCableEphemeralIdSize]; - DCHECK_EQ(nonce_and_eid.second.size(), kCableEphemeralIdSize); - memcpy(&prologue[1], nonce_and_eid.second.data(), kCableEphemeralIdSize); + uint8_t prologue[1 + EXTENT(eid)]; + memcpy(&prologue[1], eid.data(), eid.size()); if (identity) { noise.Init(device::Noise::HandshakeType::kNKpsk0); prologue[0] = 0; @@ -450,12 +526,6 @@ noise.MixHash(*peer_identity); } - std::array<uint8_t, 32> psk; - HKDF(psk.data(), psk.size(), EVP_sha256(), psk_gen_key.data(), - psk_gen_key.size(), - /*salt=*/nonce_and_eid.first.data(), nonce_and_eid.first.size(), - /*info=*/nullptr, 0); - noise.MixKeyAndHash(psk); noise.MixHash(peer_point_bytes); noise.MixKey(peer_point_bytes); @@ -541,9 +611,39 @@ std::array<uint8_t, 32> read_key, write_key; std::tie(read_key, write_key) = noise.traffic_keys(); - return std::make_pair( + return base::make_optional<ResponderResult>( std::make_unique<Crypter>(read_key, write_key), - std::vector<uint8_t>(getinfo_it->second.GetBytestring())); + getinfo_it->second.GetBytestring(), noise.handshake_hash()); +} + +bool VerifyPairingSignature( + base::span<const uint8_t, kCableIdentityKeySeedSize> identity_seed, + base::span<const uint8_t, kP256X962Length> peer_public_key_x962, + base::span<const uint8_t, std::tuple_size<HandshakeHash>::value> + handshake_hash, + base::span<const uint8_t> signature) { + bssl::UniquePtr<EC_GROUP> p256( + EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1)); + bssl::UniquePtr<EC_KEY> identity_key(EC_KEY_derive_from_secret( + p256.get(), identity_seed.data(), identity_seed.size())); + + std::array<uint8_t, SHA256_DIGEST_LENGTH> expected_signature = + PairingSignature(identity_key.get(), peer_public_key_x962, + handshake_hash); + return signature.size() == EXTENT(expected_signature) && + CRYPTO_memcmp(expected_signature.data(), signature.data(), + EXTENT(expected_signature)) == 0; +} + +std::vector<uint8_t> CalculatePairingSignature( + const EC_KEY* identity_key, + base::span<const uint8_t, kP256X962Length> peer_public_key_x962, + base::span<const uint8_t, std::tuple_size<HandshakeHash>::value> + handshake_hash) { + std::array<uint8_t, SHA256_DIGEST_LENGTH> expected_signature = + PairingSignature(identity_key, peer_public_key_x962, handshake_hash); + return std::vector<uint8_t>(expected_signature.begin(), + expected_signature.end()); } } // namespace cablev2
diff --git a/device/fido/cable/v2_handshake.h b/device/fido/cable/v2_handshake.h index 8027edb..7327d7f6 100644 --- a/device/fido/cable/v2_handshake.h +++ b/device/fido/cable/v2_handshake.h
@@ -16,6 +16,7 @@ #include "components/cbor/values.h" #include "device/fido/cable/cable_discovery_data.h" #include "device/fido/cable/noise.h" +#include "device/fido/cable/v2_constants.h" #include "device/fido/fido_constants.h" #include "third_party/boringssl/src/include/openssl/base.h" @@ -24,8 +25,6 @@ namespace device { namespace cablev2 { -constexpr size_t kNonceSize = 10; - namespace tunnelserver { // Base32Ord converts |c| into its base32 value, as defined in @@ -62,26 +61,41 @@ tld_value; } -// Action enumerates the two possible requests that can be made of a tunnel -// server: to create a new tunnel or to connect to an existing one. -enum class Action { - kNew, - kConnect, -}; +// DecodeDomain converts a 22-bit tunnel server domain (as encoded by +// |EncodeDomain|) into a string in dotted form. +COMPONENT_EXPORT(DEVICE_FIDO) std::string DecodeDomain(uint32_t domain); -// GetURL converts a 22-bit tunnel server domain (as encoded by |EncodeDomain|), -// an action, and a tunnel ID, into a WebSockets-based URL. +// GetNewTunnelURL converts a 22-bit tunnel server domain (as encoded by +// |EncodeDomain|), and a tunnel ID, into a WebSockets-based URL for creating a +// new tunnel. COMPONENT_EXPORT(DEVICE_FIDO) -GURL GetURL(uint32_t domain, Action action, base::span<const uint8_t, 16> id); +GURL GetNewTunnelURL(uint32_t domain, base::span<const uint8_t, 16> id); + +// GetConnectURL converts a 22-bit tunnel server domain (as encoded by +// |EncodeDomain|), a routing-ID, and a tunnel ID, into a WebSockets-based URL +// for connecting to an existing tunnel. +COMPONENT_EXPORT(DEVICE_FIDO) +GURL GetConnectURL(uint32_t domain, + std::array<uint8_t, kRoutingIdSize> routing_id, + base::span<const uint8_t, 16> id); + +// GetContactURL gets a URL for contacting a previously-paired authenticator. +// The |tunnel_server| is assumed to be a valid domain name and should have been +// taken from a previous call to |DecodeDomain|. +COMPONENT_EXPORT(DEVICE_FIDO) +GURL GetContactURL(const std::string& tunnel_server, + base::span<const uint8_t> contact_id); } // namespace tunnelserver namespace eid { +// TODO(agl): this could probably be a class. + // Components contains the parts of a decrypted EID. struct Components { - uint8_t shard_id; uint32_t tunnel_server_domain; + std::array<uint8_t, kRoutingIdSize> routing_id; std::array<uint8_t, kNonceSize> nonce; }; @@ -102,6 +116,39 @@ } // namespace eid +// DerivedValueType enumerates the different types of values that might be +// derived in caBLEv2 from some secret. The values this this enum are protocol +// constants and thus must not change over time. +enum class DerivedValueType : uint32_t { + kEIDKey = 1, + kTunnelID = 2, + kPSK = 3, + kPairedSecret = 4, + kIdentityKeySeed = 5, +}; + +namespace internal { +COMPONENT_EXPORT(DEVICE_FIDO) +void Derive(uint8_t* out, + size_t out_len, + base::span<const uint8_t> secret, + base::span<const uint8_t> nonce, + DerivedValueType type); +} // namespace internal + +// Derive derives a sub-secret from a secret and nonce. It is not possible to +// learn anything about |secret| from the value of the sub-secret, assuming that +// |secret| has sufficient size to prevent full enumeration of the +// possibilities. +template <size_t N> +std::array<uint8_t, N> Derive(base::span<const uint8_t> secret, + base::span<const uint8_t> nonce, + DerivedValueType type) { + std::array<uint8_t, N> ret; + internal::Derive(ret.data(), N, secret, nonce, type); + return ret; +} + // EncodePaddedCBORMap encodes the given map and pads it to 256 bytes in such a // way that |DecodePaddedCBORMap| can decode it. The padding is done on the // assumption that the returned bytes will be encrypted and the encoded size of @@ -117,12 +164,6 @@ base::Optional<cbor::Value> DecodePaddedCBORMap( base::span<const uint8_t> input); -// NonceAndEID contains both the random nonce chosen for an advert, as well as -// the EID that was generated from it. -typedef std::pair<std::array<uint8_t, kNonceSize>, - std::array<uint8_t, device::kCableEphemeralIdSize>> - NonceAndEID; - // Crypter handles the post-handshake encryption of CTAP2 messages. class COMPONENT_EXPORT(DEVICE_FIDO) Crypter { public: @@ -153,18 +194,20 @@ uint32_t write_sequence_num_ = 0; }; +// HandshakeHash is the hashed transcript of a handshake. This can be used as a +// channel-binding value. See +// http://www.noiseprotocol.org/noise.html#channel-binding. +using HandshakeHash = std::array<uint8_t, 32>; + // HandshakeInitiator starts a caBLE v2 handshake and processes the single // response message from the other party. The handshake is always initiated from // the phone. class COMPONENT_EXPORT(DEVICE_FIDO) HandshakeInitiator { public: HandshakeInitiator( - // psk_gen_key is either derived from QR-code secrets or comes from - // pairing data. - base::span<const uint8_t, 32> psk_gen_key, - // nonce is randomly generated per advertisement and ensures that BLE - // adverts are non-deterministic. - base::span<const uint8_t, kNonceSize> nonce, + // psk is derived from the connection nonce and either QR-code secrets + // pairing secrets. + base::span<const uint8_t, 32> psk, // peer_identity, if not nullopt, specifies that this is a QR handshake // and then contains a P-256 public key for the peer. Otherwise this is a // paired handshake. @@ -190,9 +233,9 @@ // ProcessResponse processes the handshake response from the peer. If // successful it returns a |Crypter| for protecting future messages on the - // connection. - base::Optional<std::unique_ptr<Crypter>> ProcessResponse( - base::span<const uint8_t> response); + // connection and a handshake transcript for signing over if needed. + base::Optional<std::pair<std::unique_ptr<Crypter>, HandshakeHash>> + ProcessResponse(base::span<const uint8_t> response); private: Noise noise_; @@ -203,17 +246,33 @@ bssl::UniquePtr<EC_KEY> ephemeral_key_; }; -// RespondToHandshake responds to a caBLE v2 handshake started by a peer. It -// returns a Crypter for encrypting and decrypting future messages, as well as -// the getInfo response from the phone. +// ResponderResult is the result of a successful handshake from the responder's +// side. It contains a Crypter for protecting future messages, the contents of +// the getInfo response given by the peer, and a hash of the handshake +// transcript. +struct COMPONENT_EXPORT(DEVICE_FIDO) ResponderResult { + ResponderResult(std::unique_ptr<Crypter>, + std::vector<uint8_t> getinfo_bytes, + HandshakeHash); + ~ResponderResult(); + ResponderResult(const ResponderResult&) = delete; + ResponderResult(ResponderResult&&); + ResponderResult& operator=(const ResponderResult&) = delete; + + std::unique_ptr<Crypter> crypter; + std::vector<uint8_t> getinfo_bytes; + const HandshakeHash handshake_hash; +}; + +// RespondToHandshake responds to a caBLE v2 handshake started by a peer. COMPONENT_EXPORT(DEVICE_FIDO) -base::Optional<std::pair<std::unique_ptr<Crypter>, std::vector<uint8_t>>> -RespondToHandshake( - // For the first two arguments see |HandshakeInitiator| comments about - // |psk_gen_key| and |nonce|, and the |BuildInitialMessage| comment about - // |eid|. - base::span<const uint8_t, 32> psk_gen_key, - const NonceAndEID& nonce_and_eid, +base::Optional<ResponderResult> RespondToHandshake( + // psk is derived from the connection nonce and either QR-code secrets or + // pairing secrets. + base::span<const uint8_t, 32> psk, + // eid is the EID that was advertised for this handshake. This is checked + // as part of the handshake. + base::span<const uint8_t, kCableEphemeralIdSize> eid, // identity_seed, if not nullopt, specifies that this is a QR handshake and // contains the seed for QR key for this client. base::Optional<base::span<const uint8_t, kCableIdentityKeySeedSize>> @@ -226,6 +285,27 @@ // out_response is set to the response handshake message, if successful. std::vector<uint8_t>* out_response); +// VerifyPairingSignature checks that |signature| is a valid signature of +// |handshake_hash| by |peer_public_key_x962|. This is used by a phone to prove +// possession of |peer_public_key_x962| since the |handshake_hash| encloses +// random values generated by the desktop and thus is a fresh value. +COMPONENT_EXPORT(DEVICE_FIDO) +bool VerifyPairingSignature( + base::span<const uint8_t, kCableIdentityKeySeedSize> identity_seed, + base::span<const uint8_t, kP256X962Length> peer_public_key_x962, + base::span<const uint8_t, std::tuple_size<HandshakeHash>::value> + handshake_hash, + base::span<const uint8_t> signature); + +// CalculatePairingSignature generates a value that will satisfy +// |VerifyPairingSignature|. +COMPONENT_EXPORT(DEVICE_FIDO) +std::vector<uint8_t> CalculatePairingSignature( + const EC_KEY* identity_key, + base::span<const uint8_t, kP256X962Length> peer_public_key_x962, + base::span<const uint8_t, std::tuple_size<HandshakeHash>::value> + handshake_hash); + } // namespace cablev2 } // namespace device
diff --git a/device/fido/cable/v2_handshake_fuzzer.cc b/device/fido/cable/v2_handshake_fuzzer.cc index 6dd63595..bdc47dd9 100644 --- a/device/fido/cable/v2_handshake_fuzzer.cc +++ b/device/fido/cable/v2_handshake_fuzzer.cc
@@ -17,13 +17,11 @@ namespace { -constexpr std::array<uint8_t, 32> kTestPSKGeneratorKey = { +constexpr std::array<uint8_t, 32> kTestPSK = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; -constexpr std::array<uint8_t, cablev2::kNonceSize> kTestNonce = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; constexpr std::array<uint8_t, 16> kTestEphemeralID = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; constexpr std::array<uint8_t, 65> kTestPeerIdentity = { @@ -66,16 +64,13 @@ } if (initiate) { - cablev2::HandshakeInitiator handshaker(kTestPSKGeneratorKey, kTestNonce, - peer_identity, std::move(local_key)); + cablev2::HandshakeInitiator handshaker(kTestPSK, peer_identity, + std::move(local_key)); handshaker.BuildInitialMessage(kTestEphemeralID, kTestGetInfoBytes); handshaker.ProcessResponse(input); } else { - cablev2::NonceAndEID nonce_and_eid; - nonce_and_eid.first = kTestNonce; - nonce_and_eid.second = kTestEphemeralID; std::vector<uint8_t> response; - cablev2::RespondToHandshake(kTestPSKGeneratorKey, nonce_and_eid, local_seed, + cablev2::RespondToHandshake(kTestPSK, kTestEphemeralID, local_seed, peer_identity, input, &response); }
diff --git a/device/fido/cable/v2_handshake_unittest.cc b/device/fido/cable/v2_handshake_unittest.cc index e6a7b2b..74fe01b 100644 --- a/device/fido/cable/v2_handshake_unittest.cc +++ b/device/fido/cable/v2_handshake_unittest.cc
@@ -3,8 +3,8 @@ // found in the LICENSE file. #include "device/fido/cable/v2_handshake.h" -#include "base/rand_util.h" #include "components/cbor/values.h" +#include "crypto/random.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/boringssl/src/include/openssl/ec.h" #include "third_party/boringssl/src/include/openssl/ec_key.h" @@ -21,21 +21,21 @@ constexpr uint32_t encoded = tunnelserver::EncodeDomain("abcd", tunnelserver::TLD::NET); uint8_t tunnel_id[16] = {0}; - const GURL url = - tunnelserver::GetURL(encoded, tunnelserver::Action::kNew, tunnel_id); + const GURL url = tunnelserver::GetNewTunnelURL(encoded, tunnel_id); EXPECT_TRUE(url.spec().find("//abcd.net/") != std::string::npos) << url; } TEST(CableV2Encoding, EIDs) { eid::Components components; components.tunnel_server_domain = 0x010203; - components.shard_id = 42; - base::RandBytes(components.nonce.data(), components.nonce.size()); + components.routing_id = {9, 10, 11}; + crypto::RandBytes(components.nonce); CableEidArray eid = eid::FromComponents(components); + EXPECT_TRUE(eid::IsValid(eid)); eid::Components components2 = eid::ToComponents(eid); - EXPECT_EQ(components.shard_id, components2.shard_id); + EXPECT_EQ(components.routing_id, components2.routing_id); EXPECT_EQ(components.tunnel_server_domain, components2.tunnel_server_domain); EXPECT_EQ(components.nonce, components2.nonce); @@ -68,13 +68,56 @@ EXPECT_EQ(1u, decoded->GetMap().size()); } +std::array<uint8_t, kP256X962Length> PublicKeyOf(const EC_KEY* private_key) { + std::array<uint8_t, kP256X962Length> ret; + CHECK_EQ(ret.size(), + EC_POINT_point2oct(EC_KEY_get0_group(private_key), + EC_KEY_get0_public_key(private_key), + POINT_CONVERSION_UNCOMPRESSED, ret.data(), + ret.size(), /*ctx=*/nullptr)); + return ret; +} + +TEST(CableV2Encoding, HandshakeSignatures) { + static const uint8_t kSeed0[kCableIdentityKeySeedSize] = {0}; + static const uint8_t kSeed1[kCableIdentityKeySeedSize] = {1}; + + bssl::UniquePtr<EC_GROUP> group( + EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1)); + bssl::UniquePtr<EC_KEY> authenticator_key( + EC_KEY_derive_from_secret(group.get(), kSeed0, sizeof(kSeed0))); + bssl::UniquePtr<EC_KEY> client_key( + EC_KEY_derive_from_secret(group.get(), kSeed1, sizeof(kSeed1))); + + const std::array<uint8_t, kP256X962Length> authenticator_public_key = + PublicKeyOf(authenticator_key.get()); + const std::array<uint8_t, kP256X962Length> client_public_key = + PublicKeyOf(client_key.get()); + + HandshakeHash handshake_hash = {1}; + + std::vector<uint8_t> signature = CalculatePairingSignature( + authenticator_key.get(), client_public_key, handshake_hash); + EXPECT_TRUE(VerifyPairingSignature(kSeed1, authenticator_public_key, + handshake_hash, signature)); + + handshake_hash[0] ^= 1; + EXPECT_FALSE(VerifyPairingSignature(kSeed1, authenticator_public_key, + handshake_hash, signature)); + handshake_hash[0] ^= 1; + + signature[0] ^= 1; + EXPECT_FALSE(VerifyPairingSignature(kSeed1, authenticator_public_key, + handshake_hash, signature)); + signature[0] ^= 1; +} + class CableV2HandshakeTest : public ::testing::Test { public: CableV2HandshakeTest() { - std::fill(psk_gen_key_.begin(), psk_gen_key_.end(), 0); - std::fill(nonce_and_eid_.first.begin(), nonce_and_eid_.first.end(), 1); - std::fill(nonce_and_eid_.second.begin(), nonce_and_eid_.second.end(), 2); - std::fill(identity_seed_.begin(), identity_seed_.end(), 3); + std::fill(psk_.begin(), psk_.end(), 0); + std::fill(eid_.begin(), eid_.end(), 1); + std::fill(identity_seed_.begin(), identity_seed_.end(), 2); bssl::UniquePtr<EC_GROUP> group( EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1)); @@ -88,8 +131,8 @@ } protected: - std::array<uint8_t, 32> psk_gen_key_; - NonceAndEID nonce_and_eid_; + std::array<uint8_t, 32> psk_; + CableEidArray eid_; bssl::UniquePtr<EC_KEY> identity_key_; std::array<uint8_t, kP256X962Length> identity_public_; std::array<uint8_t, kCableIdentityKeySeedSize> identity_seed_; @@ -123,34 +166,33 @@ } TEST_F(CableV2HandshakeTest, QRHandshake) { - std::array<uint8_t, 32> wrong_psk_gen_key = psk_gen_key_; - wrong_psk_gen_key[0] ^= 1; + std::array<uint8_t, 32> wrong_psk = psk_; + wrong_psk[0] ^= 1; uint8_t kGetInfoBytes[] = {1, 2, 3, 4, 5}; for (const bool use_correct_key : {false, true}) { - HandshakeInitiator initiator( - use_correct_key ? psk_gen_key_ : wrong_psk_gen_key, - nonce_and_eid_.first, identity_public_, - /*local_identity=*/nullptr); + HandshakeInitiator initiator(use_correct_key ? psk_ : wrong_psk, + identity_public_, + /*local_identity=*/nullptr); std::vector<uint8_t> message = - initiator.BuildInitialMessage(nonce_and_eid_.second, kGetInfoBytes); + initiator.BuildInitialMessage(eid_, kGetInfoBytes); std::vector<uint8_t> response; - base::Optional<std::pair<std::unique_ptr<Crypter>, std::vector<uint8_t>>> - responder_result(RespondToHandshake( - psk_gen_key_, nonce_and_eid_, identity_seed_, - /*peer_identity=*/base::nullopt, message, &response)); + base::Optional<ResponderResult> responder_result(RespondToHandshake( + psk_, eid_, identity_seed_, + /*peer_identity=*/base::nullopt, message, &response)); ASSERT_EQ(responder_result.has_value(), use_correct_key); if (!use_correct_key) { continue; } - base::Optional<std::unique_ptr<Crypter>> initiator_result( - initiator.ProcessResponse(response)); + base::Optional<std::pair<std::unique_ptr<Crypter>, HandshakeHash>> + initiator_result(initiator.ProcessResponse(response)); ASSERT_TRUE(initiator_result.has_value()); - EXPECT_TRUE(responder_result->first->IsCounterpartyOfForTesting( - *initiator_result.value())); - ASSERT_EQ(responder_result->second.size(), sizeof(kGetInfoBytes)); - EXPECT_EQ(0, memcmp(responder_result->second.data(), kGetInfoBytes, + EXPECT_EQ(initiator_result->second, responder_result->handshake_hash); + EXPECT_TRUE(responder_result->crypter->IsCounterpartyOfForTesting( + *initiator_result->first)); + ASSERT_EQ(responder_result->getinfo_bytes.size(), sizeof(kGetInfoBytes)); + EXPECT_EQ(0, memcmp(responder_result->getinfo_bytes.data(), kGetInfoBytes, sizeof(kGetInfoBytes))); } } @@ -166,30 +208,28 @@ EC_KEY* const key = use_correct_key ? identity_key_.get() : wrong_key.get(); EC_KEY_up_ref(key); - HandshakeInitiator initiator(psk_gen_key_, nonce_and_eid_.first, + HandshakeInitiator initiator(psk_, /*peer_identity=*/base::nullopt, bssl::UniquePtr<EC_KEY>(key)); std::vector<uint8_t> message = - initiator.BuildInitialMessage(nonce_and_eid_.second, kGetInfoBytes); + initiator.BuildInitialMessage(eid_, kGetInfoBytes); std::vector<uint8_t> response; - base::Optional<std::pair<std::unique_ptr<Crypter>, std::vector<uint8_t>>> - responder_result(RespondToHandshake(psk_gen_key_, nonce_and_eid_, - /*identity_seed=*/base::nullopt, - identity_public_, message, - &response)); + base::Optional<ResponderResult> responder_result(RespondToHandshake( + psk_, eid_, + /*identity_seed=*/base::nullopt, identity_public_, message, &response)); ASSERT_EQ(responder_result.has_value(), use_correct_key); if (!use_correct_key) { continue; } - base::Optional<std::unique_ptr<Crypter>> initiator_result( - initiator.ProcessResponse(response)); + base::Optional<std::pair<std::unique_ptr<Crypter>, HandshakeHash>> + initiator_result(initiator.ProcessResponse(response)); ASSERT_TRUE(initiator_result.has_value()); - EXPECT_TRUE(responder_result->first->IsCounterpartyOfForTesting( - *initiator_result.value())); - ASSERT_EQ(responder_result->second.size(), sizeof(kGetInfoBytes)); - EXPECT_EQ(0, memcmp(responder_result->second.data(), kGetInfoBytes, + EXPECT_TRUE(responder_result->crypter->IsCounterpartyOfForTesting( + *initiator_result->first)); + ASSERT_EQ(responder_result->getinfo_bytes.size(), sizeof(kGetInfoBytes)); + EXPECT_EQ(0, memcmp(responder_result->getinfo_bytes.data(), kGetInfoBytes, sizeof(kGetInfoBytes))); } }
diff --git a/device/fido/fido_constants.h b/device/fido/fido_constants.h index dcf5ef5..c4e4a210 100644 --- a/device/fido/fido_constants.h +++ b/device/fido/fido_constants.h
@@ -378,8 +378,19 @@ // kCableShardIdHeader is the name of an HTTP header that is sent in the reply // from the tunnel server and which specifies the server's chosen shard number. +// TODO(agl): remove. Only being kept around to allow things to compile. constexpr char kCableShardIdHeader[] = "X-caBLE-Shard"; +// kCableRoutingIdHeader is the name of an HTTP header that is sent in the reply +// from the tunnel server and which specifies the server's chosen routing ID +// which other parties can use to reach the same tunnel server. +constexpr char kCableRoutingIdHeader[] = "X-caBLE-Routing-ID"; + +// kCableClientPayloadHeader is the name of an HTTP header that is to +// the tunnel server when performing a state-assisted handshake and which +// includes the client's nonce and pairing ID. +constexpr char kCableClientPayloadHeader[] = "X-caBLE-Client-Payload"; + // Maximum wait time before client error outs on device. COMPONENT_EXPORT(DEVICE_FIDO) extern const base::TimeDelta kDeviceTimeout;
diff --git a/fuchsia/base/message_port.cc b/fuchsia/base/message_port.cc index 22457729..345f6e3 100644 --- a/fuchsia/base/message_port.cc +++ b/fuchsia/base/message_port.cc
@@ -24,9 +24,6 @@ using BlinkMessage = blink::WebMessagePort::Message; -// Converts a fuchsia::web::WebMessage to a BlinkMessage. -// An empty result indicates that conversion was successful. -// Data validation errors are returned as a FrameError. base::Optional<fuchsia::web::FrameError> BlinkMessageFromFidl( fuchsia::web::WebMessage fidl_message, BlinkMessage* blink_message) { @@ -53,17 +50,41 @@ blink_message->ports.push_back( BlinkMessagePortFromFidl(std::move(transferrable.message_port()))); } - } else if (fidl_message.has_incoming_transfer()) { - for (fuchsia::web::IncomingTransferable& incoming : - *fidl_message.mutable_incoming_transfer()) { - blink_message->ports.push_back( - BlinkMessagePortFromFidl(std::move(incoming.message_port()))); - } } return base::nullopt; } +base::Optional<fuchsia::web::WebMessage> FidlWebMessageFromBlink( + BlinkMessage blink_message) { + fuchsia::web::WebMessage fidl_message; + if (!blink_message.ports.empty()) { + std::vector<fuchsia::web::IncomingTransferable> transferables; + for (blink::WebMessagePort& port : blink_message.ports) { + fuchsia::web::IncomingTransferable incoming; + incoming.set_message_port(FidlMessagePortFromBlink(std::move(port))); + transferables.push_back(std::move(incoming)); + } + fidl_message.set_incoming_transfer(std::move(transferables)); + blink_message.ports.clear(); + } + + base::string16 data_utf16 = std::move(blink_message.data); + std::string data_utf8; + if (!base::UTF16ToUTF8(data_utf16.data(), data_utf16.size(), &data_utf8)) + return base::nullopt; + + base::STLClearObject(&data_utf16); + + fuchsia::mem::Buffer data = + cr_fuchsia::MemBufferFromString(data_utf8, "cr-web-message-from-blink"); + if (!data.vmo) + return base::nullopt; + + fidl_message.set_data(std::move(data)); + return fidl_message; +} + // Defines a MessagePortAdapter, which translates and routes messages between a // FIDL MessagePort and a blink::WebMessagePort. Every MessagePortAdapter has // exactly one FIDL MessagePort and one blink::WebMessagePort. @@ -108,8 +129,7 @@ // blink::WebMessagePort::MessageReceiver implementation: bool OnMessage(BlinkMessage message) override { base::Optional<fuchsia::web::WebMessage> message_converted = - FidlWebMessageFromBlink(std::move(message), - TransferableHostType::kLocal); + FidlWebMessageFromBlink(std::move(message)); if (!message_converted) { DLOG(ERROR) << "Couldn't decode WebMessage from blink::WebMessagePort."; Destroy(); @@ -151,10 +171,6 @@ }); } - fidl::InterfaceRequest<fuchsia::web::MessagePort> NewRequest() { - return port_.NewRequest(); - } - private: ~FidlMessagePortClientAdapter() override = default; @@ -291,24 +307,12 @@ DISALLOW_COPY_AND_ASSIGN(FidlMessagePortServerAdapter); }; -fidl::InterfaceRequest<fuchsia::web::MessagePort> -RemoteFidlMessagePortFromBlink(blink::WebMessagePort blink_port) { - fidl::InterfaceHandle<fuchsia::web::MessagePort> fidl_handle; - auto request = fidl_handle.NewRequest(); - new FidlMessagePortClientAdapter(std::move(blink_port), - std::move(fidl_handle)); - return request; -} - } // namespace -// Methods for constructing MessagePortAdapters for various port types and -// origins. The adapters manage their own lifetimes and will self-delete when -// either endpoint of their channels are disconnected. - blink::WebMessagePort BlinkMessagePortFromFidl( fidl::InterfaceRequest<fuchsia::web::MessagePort> fidl_port) { auto port_pair = blink::WebMessagePort::CreatePair(); + // The adapter cleans itself up when either of the associated ports is closed. new FidlMessagePortServerAdapter(std::move(port_pair.first), std::move(fidl_port)); return std::move(port_pair.second); @@ -317,6 +321,7 @@ blink::WebMessagePort BlinkMessagePortFromFidl( fidl::InterfaceHandle<fuchsia::web::MessagePort> fidl_port) { auto port_pair = blink::WebMessagePort::CreatePair(); + // The adapter cleans itself up when either of the associated ports is closed. new FidlMessagePortClientAdapter(std::move(port_pair.first), std::move(fidl_port)); return std::move(port_pair.second); @@ -328,49 +333,4 @@ return adapter->NewBinding(); } -base::Optional<fuchsia::web::WebMessage> FidlWebMessageFromBlink( - BlinkMessage blink_message, - TransferableHostType port_type) { - fuchsia::web::WebMessage fidl_message; - - if (!blink_message.ports.empty()) { - switch (port_type) { - case TransferableHostType::kLocal: - for (blink::WebMessagePort& port : blink_message.ports) { - fuchsia::web::IncomingTransferable incoming; - incoming.set_message_port(FidlMessagePortFromBlink(std::move(port))); - fidl_message.mutable_incoming_transfer()->push_back( - std::move(incoming)); - } - break; - case TransferableHostType::kRemote: - for (blink::WebMessagePort& port : blink_message.ports) { - fuchsia::web::OutgoingTransferable outgoing; - outgoing.set_message_port( - RemoteFidlMessagePortFromBlink(std::move(port))); - fidl_message.mutable_outgoing_transfer()->push_back( - std::move(outgoing)); - } - break; - } - blink_message.ports.clear(); - } - - base::string16 data_utf16 = std::move(blink_message.data); - std::string data_utf8; - if (!base::UTF16ToUTF8(data_utf16.data(), data_utf16.size(), &data_utf8)) - return base::nullopt; - - base::STLClearObject(&data_utf16); - - constexpr char kBufferVmoName[] = "cr-web-message-from-blink"; - fuchsia::mem::Buffer data_buffer = - cr_fuchsia::MemBufferFromString(data_utf8, kBufferVmoName); - if (!data_buffer.vmo) - return base::nullopt; - - fidl_message.set_data(std::move(data_buffer)); - return fidl_message; -} - } // namespace cr_fuchsia
diff --git a/fuchsia/base/message_port.h b/fuchsia/base/message_port.h index 1902f50..8baf242 100644 --- a/fuchsia/base/message_port.h +++ b/fuchsia/base/message_port.h
@@ -29,21 +29,6 @@ fidl::InterfaceHandle<fuchsia::web::MessagePort> FidlMessagePortFromBlink( blink::WebMessagePort blink_port); -// Specifies the location of the MessagePort FIDL service that handles messages -// sent over the Transferable. -enum class TransferableHostType { - // The MessagePort FIDL service is hosted in-process. - kLocal, - - // The MessagePort FIDL service is hosted remotely. - kRemote, -}; - -// Converts a BlinkMessage to a fuchsia::web::WebMessage. -base::Optional<fuchsia::web::WebMessage> FidlWebMessageFromBlink( - blink::WebMessagePort::Message blink_message, - TransferableHostType port_type); - } // namespace cr_fuchsia #endif // FUCHSIA_BASE_MESSAGE_PORT_H_
diff --git a/fuchsia/engine/browser/frame_impl.cc b/fuchsia/engine/browser/frame_impl.cc index 96077f4..faee6acd 100644 --- a/fuchsia/engine/browser/frame_impl.cc +++ b/fuchsia/engine/browser/frame_impl.cc
@@ -690,9 +690,11 @@ return; } - // Convert and pass along any MessagePorts contained in the message. + // Include outgoing MessagePorts in the message. std::vector<blink::WebMessagePort> message_ports; if (message.has_outgoing_transfer()) { + // Verify that all the Transferables are valid before we start allocating + // resources to them. for (const fuchsia::web::OutgoingTransferable& outgoing : message.outgoing_transfer()) { if (!outgoing.is_message_port()) {
diff --git a/fuchsia/engine/web_engine_integration_test.cc b/fuchsia/engine/web_engine_integration_test.cc index 22653a1..3337c2e5 100644 --- a/fuchsia/engine/web_engine_integration_test.cc +++ b/fuchsia/engine/web_engine_integration_test.cc
@@ -437,7 +437,7 @@ net::TCPClientSocket connecting_socket( net::AddressList(net::IPEndPoint(net::IPAddress::IPv4Localhost(), remote_debugging_port)), - nullptr, nullptr, net::NetLogSource()); + nullptr, nullptr, nullptr, net::NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); connect_result = connect_callback.GetResult(connect_result);
diff --git a/fuchsia/runners/BUILD.gn b/fuchsia/runners/BUILD.gn index 7ddaa53d..4b1a7c74 100644 --- a/fuchsia/runners/BUILD.gn +++ b/fuchsia/runners/BUILD.gn
@@ -62,21 +62,16 @@ "cast/cast_runner.h", "cast/cast_streaming.cc", "cast/cast_streaming.h", - "cast/named_message_port_connector_fuchsia.cc", - "cast/named_message_port_connector_fuchsia.h", + "cast/named_message_port_connector.cc", + "cast/named_message_port_connector.h", "cast/pending_cast_component.cc", "cast/pending_cast_component.h", ] - data = [ - "cast/data/receiver.html", - "${root_gen_dir}/components/cast/named_message_port_connector/named_message_port_connector_resources.pak", - ] + data_deps = [ "//chromecast/bindings:named_message_port_connector_resources" ] + data = [ "cast/data" ] deps = [ "//base", - "//components/cast/named_message_port_connector:named_message_port_connector", - "//components/cast/named_message_port_connector:resources", "//fuchsia/base", - "//fuchsia/base:message_port", "//fuchsia/base:modular", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.modular", "//third_party/fuchsia-sdk/sdk/pkg/scenic_cpp", @@ -100,10 +95,7 @@ ":common", "//base", "//fuchsia/base", - "//mojo/core/embedder", # TODO(crbug.com/1126571): Remove when MPP lands. - "//ui/base", ] - data_deps = [ ":cast_runner_core" ] visibility = [ ":*" ] } @@ -165,9 +157,7 @@ ":cast_runner_test_core", "//base/test:run_all_unittests", "//base/test:test_support", - "//components/cast/named_message_port_connector:resources", "//fuchsia/base:test_support", - "//mojo/core/embedder", # TODO(crbug.com/1126571): Remove when MPP lands. "//net:test_support", "//testing/gtest", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.camera3", @@ -175,9 +165,7 @@ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.modular", "//third_party/fuchsia-sdk/sdk/pkg/scenic_cpp", "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp", - "//ui/base", ] - data_deps = [ ":cast_runner_core" ] package_deps = [ [ "//fuchsia/engine:web_engine", "web_engine", @@ -187,7 +175,7 @@ test("cast_runner_browsertests") { sources = [ "cast/api_bindings_client_browsertest.cc", - "cast/named_message_port_connector_fuchsia_browsertest.cc", + "cast/named_message_port_connector_browsertest.cc", ] defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] data = [ "cast/testdata" ] @@ -198,7 +186,6 @@ "//content/public/browser", "//content/test:test_support", "//fuchsia/base", - "//fuchsia/base:message_port", "//fuchsia/base:test_support", "//fuchsia/engine:browsertest_core", "//testing/gmock",
diff --git a/fuchsia/runners/cast/DEPS b/fuchsia/runners/cast/DEPS index c51cea95..3d2534c 100644 --- a/fuchsia/runners/cast/DEPS +++ b/fuchsia/runners/cast/DEPS
@@ -1,6 +1,3 @@ include_rules = [ - "+components/cast/named_message_port_connector", "+content/public/test", - "+mojo/core/embedder", - "+ui/base/resource", -] +] \ No newline at end of file
diff --git a/fuchsia/runners/cast/api_bindings_client.cc b/fuchsia/runners/cast/api_bindings_client.cc index 88f02f8a..9cd338c 100644 --- a/fuchsia/runners/cast/api_bindings_client.cc +++ b/fuchsia/runners/cast/api_bindings_client.cc
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/fuchsia/fuchsia_logging.h" #include "base/strings/string_piece.h" -#include "fuchsia/base/message_port.h" namespace { @@ -36,7 +35,7 @@ ApiBindingsClient::~ApiBindingsClient() { if (connector_ && frame_) { - connector_->RegisterPortHandler({}); + connector_->Register({}); // Remove all injected scripts using their automatically enumerated IDs. for (uint64_t i = 0; i < bindings_->size(); ++i) @@ -44,10 +43,9 @@ } } -void ApiBindingsClient::AttachToFrame( - fuchsia::web::Frame* frame, - cast_api_bindings::NamedMessagePortConnector* connector, - base::OnceClosure on_error_callback) { +void ApiBindingsClient::AttachToFrame(fuchsia::web::Frame* frame, + NamedMessagePortConnector* connector, + base::OnceClosure on_error_callback) { DCHECK(!frame_) << "AttachToFrame() was called twice."; DCHECK(frame); DCHECK(connector); @@ -64,8 +62,8 @@ std::move(on_error_callback).Run(); }); - connector_->RegisterPortHandler(base::BindRepeating( - &ApiBindingsClient::OnPortConnected, base::Unretained(this))); + connector_->Register(base::BindRepeating(&ApiBindingsClient::OnPortConnected, + base::Unretained(this))); // Enumerate and inject all scripts in |bindings|. uint64_t bindings_id = kBindingsIdStart; @@ -89,15 +87,11 @@ return bindings_.has_value(); } -bool ApiBindingsClient::OnPortConnected(base::StringPiece port_name, - blink::WebMessagePort port) { - if (!bindings_service_) - return false; - - bindings_service_->Connect( - port_name.as_string(), - cr_fuchsia::FidlMessagePortFromBlink(std::move(port))); - return true; +void ApiBindingsClient::OnPortConnected( + base::StringPiece port_name, + fidl::InterfaceHandle<fuchsia::web::MessagePort> port) { + if (bindings_service_) + bindings_service_->Connect(port_name.as_string(), std::move(port)); } void ApiBindingsClient::OnBindingsReceived(
diff --git a/fuchsia/runners/cast/api_bindings_client.h b/fuchsia/runners/cast/api_bindings_client.h index 7ca8c1a..219e419 100644 --- a/fuchsia/runners/cast/api_bindings_client.h +++ b/fuchsia/runners/cast/api_bindings_client.h
@@ -10,8 +10,8 @@ #include "base/macros.h" #include "base/optional.h" -#include "components/cast/named_message_port_connector/named_message_port_connector.h" #include "fuchsia/fidl/chromium/cast/cpp/fidl.h" +#include "fuchsia/runners/cast/named_message_port_connector.h" // Injects scripts received from the ApiBindings service, and provides connected // ports to the Agent. @@ -31,7 +31,7 @@ // lost connection to the Agent). The callback must remain valid for the // entire lifetime of |this|. void AttachToFrame(fuchsia::web::Frame* frame, - cast_api_bindings::NamedMessagePortConnector* connector, + NamedMessagePortConnector* connector, base::OnceClosure on_error_callback); // Indicates that the Frame is no longer live, preventing the API bindings @@ -45,15 +45,17 @@ // TODO(crbug.com/1082821): Move this method back to private once the Cast // Streaming Receiver component has been implemented. // Called when |connector_| has connected a port. - bool OnPortConnected(base::StringPiece port_name, blink::WebMessagePort port); + void OnPortConnected(base::StringPiece port_name, + fidl::InterfaceHandle<fuchsia::web::MessagePort> port); private: // Called when ApiBindings::GetAll() has responded. void OnBindingsReceived(std::vector<chromium::cast::ApiBinding> bindings); + base::Optional<std::vector<chromium::cast::ApiBinding>> bindings_; fuchsia::web::Frame* frame_ = nullptr; - cast_api_bindings::NamedMessagePortConnector* connector_ = nullptr; + NamedMessagePortConnector* connector_ = nullptr; chromium::cast::ApiBindingsPtr bindings_service_; base::OnceClosure on_initialization_complete_;
diff --git a/fuchsia/runners/cast/api_bindings_client_browsertest.cc b/fuchsia/runners/cast/api_bindings_client_browsertest.cc index 7223552..f6cd01d 100644 --- a/fuchsia/runners/cast/api_bindings_client_browsertest.cc +++ b/fuchsia/runners/cast/api_bindings_client_browsertest.cc
@@ -5,24 +5,17 @@ #include <fuchsia/web/cpp/fidl.h> #include <lib/fidl/cpp/binding.h> -#include "base/barrier_closure.h" -#include "base/base_paths_fuchsia.h" -#include "base/files/file_util.h" -#include "base/path_service.h" #include "base/test/bind_test_util.h" #include "content/public/test/browser_test.h" #include "fuchsia/base/fit_adapter.h" #include "fuchsia/base/frame_test_util.h" #include "fuchsia/base/mem_buffer_util.h" -#include "fuchsia/base/message_port.h" #include "fuchsia/base/result_receiver.h" #include "fuchsia/base/test_navigation_listener.h" #include "fuchsia/engine/test/web_engine_browser_test.h" #include "fuchsia/runners/cast/api_bindings_client.h" -#include "fuchsia/runners/cast/named_message_port_connector_fuchsia.h" #include "fuchsia/runners/cast/test_api_bindings.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/resource/resource_bundle.h" namespace { @@ -34,8 +27,6 @@ ~ApiBindingsClientTest() override = default; - void SetUp() override { cr_fuchsia::WebEngineBrowserTest::SetUp(); } - protected: void StartClient() { base::ScopedAllowBlockingForTesting allow_blocking; @@ -50,23 +41,7 @@ frame_ = WebEngineBrowserTest::CreateFrame(&navigation_listener_); frame_->GetNavigationController(controller_.NewRequest()); - - static bool g_js_resources_loaded = false; - if (!g_js_resources_loaded) { - base::FilePath pak_file; - bool result = base::PathService::Get(base::DIR_ASSETS, &pak_file); - DCHECK(result); - pak_file = pak_file.Append( - FILE_PATH_LITERAL("components/cast/named_message_port_connector/" - "named_message_port_connector_resources.pak")); - DCHECK(base::PathExists(pak_file)); - ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( - pak_file, ui::ScaleFactor::SCALE_FACTOR_NONE); - g_js_resources_loaded = true; - } - connector_ = - std::make_unique<NamedMessagePortConnectorFuchsia>(frame_.get()); - + connector_ = std::make_unique<NamedMessagePortConnector>(frame_.get()); client_->AttachToFrame(frame_.get(), connector_.get(), base::MakeExpectedNotRunClosure(FROM_HERE)); } @@ -82,7 +57,7 @@ } fuchsia::web::FramePtr frame_; - std::unique_ptr<NamedMessagePortConnectorFuchsia> connector_; + std::unique_ptr<NamedMessagePortConnector> connector_; TestApiBindings api_service_; fidl::Binding<chromium::cast::ApiBindings> api_service_binding_; std::unique_ptr<ApiBindingsClient> client_; @@ -92,11 +67,7 @@ DISALLOW_COPY_AND_ASSIGN(ApiBindingsClientTest); }; -// Tests API registration, injection, and message IPC. -// Registers a port that echoes messages received over a MessagePort back to the -// sender. IN_PROC_BROWSER_TEST_F(ApiBindingsClientTest, EndToEnd) { - // Define the injected bindings. std::vector<chromium::cast::ApiBinding> binding_list; chromium::cast::ApiBinding echo_binding; echo_binding.set_before_load_script(cr_fuchsia::MemBufferFromString( @@ -104,41 +75,24 @@ "test")); binding_list.emplace_back(std::move(echo_binding)); api_service_.set_bindings(std::move(binding_list)); - StartClient(); - base::RunLoop post_message_responses_loop; - base::RepeatingClosure post_message_response_closure = - base::BarrierClosure(2, post_message_responses_loop.QuitClosure()); - - // Navigate to a test page that makes use of the injected bindings. const GURL test_url = embedded_test_server()->GetURL("/echo.html"); EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse( controller_.get(), fuchsia::web::LoadUrlParams(), test_url.spec())); navigation_listener_.RunUntilUrlEquals(test_url); - frame_->PostMessage("*", - std::move(*cr_fuchsia::FidlWebMessageFromBlink( - connector_->GetConnectMessage(), - cr_fuchsia::TransferableHostType::kRemote)), - [&post_message_response_closure]( - fuchsia::web::Frame_PostMessage_Result result) { - ASSERT_TRUE(result.is_response()); - post_message_response_closure.Run(); - }); + connector_->OnPageLoad(); - // Connect to the echo service hosted by the page and send a ping to it. - fuchsia::web::WebMessage message; - message.set_data(cr_fuchsia::MemBufferFromString("ping", "ping-msg")); fuchsia::web::MessagePortPtr port = api_service_.RunUntilMessagePortReceived("echoService").Bind(); + + fuchsia::web::WebMessage message; + message.set_data(cr_fuchsia::MemBufferFromString("ping", "ping-msg")); port->PostMessage(std::move(message), - [&post_message_response_closure]( - fuchsia::web::MessagePort_PostMessage_Result result) { - ASSERT_TRUE(result.is_response()); - post_message_response_closure.Run(); + [](fuchsia::web::MessagePort_PostMessage_Result result) { + EXPECT_TRUE(result.is_response()); }); - // Handle the ping response. base::RunLoop response_loop; cr_fuchsia::ResultReceiver<fuchsia::web::WebMessage> response( response_loop.QuitClosure()); @@ -150,9 +104,6 @@ EXPECT_TRUE( cr_fuchsia::StringFromMemBuffer(response->data(), &response_string)); EXPECT_EQ("ack ping", response_string); - - // Ensure that we've received acks for all messages. - post_message_responses_loop.Run(); } } // namespace
diff --git a/fuchsia/runners/cast/cast_component.cc b/fuchsia/runners/cast/cast_component.cc index a0e98425..7bd5ed4 100644 --- a/fuchsia/runners/cast/cast_component.cc +++ b/fuchsia/runners/cast/cast_component.cc
@@ -7,7 +7,6 @@ #include <lib/fidl/cpp/binding.h> #include <lib/ui/scenic/cpp/view_ref_pair.h> #include <algorithm> -#include <string> #include <utility> #include "base/auto_reset.h" @@ -18,7 +17,6 @@ #include "base/task/current_thread.h" #include "fuchsia/base/agent_manager.h" #include "fuchsia/base/mem_buffer_util.h" -#include "fuchsia/base/message_port.h" #include "fuchsia/fidl/chromium/cast/cpp/fidl.h" #include "fuchsia/runners/cast/cast_runner.h" #include "fuchsia/runners/cast/cast_streaming.h" @@ -80,7 +78,7 @@ WebComponent::StartComponent(); - connector_ = std::make_unique<NamedMessagePortConnectorFuchsia>(frame()); + connector_ = std::make_unique<NamedMessagePortConnector>(frame()); url_rewrite_rules_provider_.set_error_handler([this](zx_status_t status) { ZX_LOG_IF(ERROR, status != ZX_OK, status) @@ -117,9 +115,8 @@ fuchsia::sys::TerminationReason::INTERNAL_ERROR); } }); - api_bindings_client_->OnPortConnected( - kCastStreamingMessagePortName, - cr_fuchsia::BlinkMessagePortFromFidl(std::move(message_port))); + api_bindings_client_->OnPortConnected(kCastStreamingMessagePortName, + std::move(message_port)); } api_bindings_client_->AttachToFrame( @@ -169,7 +166,6 @@ // frame() is about to be destroyed, so there is no need to perform cleanup // such as removing before-load JavaScripts. api_bindings_client_->DetachFromFrame(frame()); - connector_->DetachFromFrame(); WebComponent::DestroyComponent(exit_code, reason); } @@ -185,18 +181,8 @@ void CastComponent::OnNavigationStateChanged( fuchsia::web::NavigationState change, OnNavigationStateChangedCallback callback) { - if (change.has_is_main_document_loaded() && - change.is_main_document_loaded()) { - // Send the NamedMessagePortConnector handshake to the page. - frame()->PostMessage("*", - *cr_fuchsia::FidlWebMessageFromBlink( - connector_->GetConnectMessage(), - cr_fuchsia::TransferableHostType::kRemote), - [](fuchsia::web::Frame_PostMessage_Result result) { - DCHECK(result.is_response()); - }); - } - + if (change.has_is_main_document_loaded() && change.is_main_document_loaded()) + connector_->OnPageLoad(); WebComponent::OnNavigationStateChanged(std::move(change), std::move(callback)); }
diff --git a/fuchsia/runners/cast/cast_component.h b/fuchsia/runners/cast/cast_component.h index ff3646e..b158933 100644 --- a/fuchsia/runners/cast/cast_component.h +++ b/fuchsia/runners/cast/cast_component.h
@@ -17,7 +17,7 @@ #include "fuchsia/fidl/chromium/cast/cpp/fidl.h" #include "fuchsia/runners/cast/api_bindings_client.h" #include "fuchsia/runners/cast/application_controller_impl.h" -#include "fuchsia/runners/cast/named_message_port_connector_fuchsia.h" +#include "fuchsia/runners/cast/named_message_port_connector.h" #include "fuchsia/runners/common/web_component.h" namespace cr_fuchsia { @@ -108,7 +108,7 @@ std::vector<fuchsia::web::UrlRequestRewriteRule> initial_url_rewrite_rules_; bool constructor_active_ = false; - std::unique_ptr<NamedMessagePortConnectorFuchsia> connector_; + std::unique_ptr<NamedMessagePortConnector> connector_; std::unique_ptr<ApiBindingsClient> api_bindings_client_; std::unique_ptr<ApplicationControllerImpl> application_controller_; chromium::cast::ApplicationContextPtr application_context_;
diff --git a/fuchsia/runners/cast/cast_runner_integration_test.cc b/fuchsia/runners/cast/cast_runner_integration_test.cc index 7211c89..d8589a0b 100644 --- a/fuchsia/runners/cast/cast_runner_integration_test.cc +++ b/fuchsia/runners/cast/cast_runner_integration_test.cc
@@ -16,7 +16,6 @@ #include "base/base_paths_fuchsia.h" #include "base/callback_helpers.h" -#include "base/files/file_util.h" #include "base/fuchsia/file_utils.h" #include "base/fuchsia/filtered_service_directory.h" #include "base/fuchsia/fuchsia_logging.h" @@ -43,11 +42,9 @@ #include "fuchsia/runners/cast/cast_runner.h" #include "fuchsia/runners/cast/fake_application_config_manager.h" #include "fuchsia/runners/cast/test_api_bindings.h" -#include "mojo/core/embedder/embedder.h" #include "net/test/embedded_test_server/default_handlers.h" #include "net/test/embedded_test_server/http_request.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/resource/resource_bundle.h" namespace { @@ -227,23 +224,6 @@ CastRunnerIntegrationTest& operator=(const CastRunnerIntegrationTest&) = delete; - void SetUp() override { - mojo::core::Init(); - - static bool g_resources_loaded = false; - if (!g_resources_loaded) { - base::FilePath pak_file; - bool result = base::PathService::Get(base::DIR_ASSETS, &pak_file); - DCHECK(result); - pak_file = pak_file.Append( - FILE_PATH_LITERAL("components/cast/named_message_port_connector/" - "named_message_port_connector_resources.pak")); - DCHECK(base::PathExists(pak_file)); - ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); - g_resources_loaded = true; - } - } - void TearDown() override { if (component_controller_) ShutdownComponent();
diff --git a/fuchsia/runners/cast/main.cc b/fuchsia/runners/cast/main.cc index 51756d1..df486ac 100644 --- a/fuchsia/runners/cast/main.cc +++ b/fuchsia/runners/cast/main.cc
@@ -9,7 +9,6 @@ #include "base/fuchsia/scoped_service_binding.h" #include "base/message_loop/message_pump_type.h" #include "base/optional.h" -#include "base/path_service.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/values.h" @@ -19,8 +18,6 @@ #include "fuchsia/base/init_logging.h" #include "fuchsia/base/inspect.h" #include "fuchsia/runners/cast/cast_runner.h" -#include "mojo/core/embedder/embedder.h" -#include "ui/base/resource/resource_bundle.h" namespace { @@ -49,16 +46,6 @@ return false; } -void LoadResources() { - base::FilePath pak_file; - bool result = base::PathService::Get(base::DIR_ASSETS, &pak_file); - DCHECK(result); - pak_file = pak_file.Append( - FILE_PATH_LITERAL("components/cast_api_bindings/" - "named_message_port_connector_resources.pak")); - ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); -} - } // namespace int main(int argc, char** argv) { @@ -72,10 +59,6 @@ *base::CommandLine::ForCurrentProcess())) << "Failed to initialize logging."; - mojo::core::Init(); - - LoadResources(); - cr_fuchsia::RegisterFuchsiaDirScheme(); sys::OutgoingDirectory* const outgoing_directory =
diff --git a/fuchsia/runners/cast/named_message_port_connector.cc b/fuchsia/runners/cast/named_message_port_connector.cc new file mode 100644 index 0000000..76b80b3 --- /dev/null +++ b/fuchsia/runners/cast/named_message_port_connector.cc
@@ -0,0 +1,123 @@ +// 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. + +#include "fuchsia/runners/cast/named_message_port_connector.h" + +#include <memory> +#include <utility> +#include <vector> + +#include "base/callback.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/logging.h" +#include "base/macros.h" +#include "base/path_service.h" +#include "base/strings/string_piece.h" +#include "base/strings/string_split.h" +#include "fuchsia/base/mem_buffer_util.h" +#include "fuchsia/runners/cast/cast_platform_bindings_ids.h" + +namespace { + +const char kBindingsJsPath[] = FILE_PATH_LITERAL( + "chromecast/bindings/resources/named_message_port_connector.js"); +const char kControlPortConnectMessage[] = "cast.master.connect"; + +} // namespace + +NamedMessagePortConnector::NamedMessagePortConnector(fuchsia::web::Frame* frame) + : frame_(frame) { + DCHECK(frame_); + + // Inject the script providing the connection API into the Frame. + base::FilePath assets_path; + bool path_service_result = + base::PathService::Get(base::DIR_ASSETS, &assets_path); + DCHECK(path_service_result); + fuchsia::mem::Buffer bindings_script_ = cr_fuchsia::MemBufferFromFile( + base::File(assets_path.AppendASCII(kBindingsJsPath), + base::File::FLAG_OPEN | base::File::FLAG_READ)); + + std::vector<std::string> origins = {"*"}; + frame_->AddBeforeLoadJavaScript( + static_cast<uint64_t>( + CastPlatformBindingsId::NAMED_MESSAGE_PORT_CONNECTOR), + std::move(origins), + cr_fuchsia::CloneBuffer(bindings_script_, "cast-bindings-js"), + [](fuchsia::web::Frame_AddBeforeLoadJavaScript_Result result) { + CHECK(result.is_response()) << "Couldn't inject bindings."; + }); +} + +NamedMessagePortConnector::~NamedMessagePortConnector() { + if (frame_) { + // Don't attempt to remove before-load JavaScript when being deleted because + // the Frame has disconnected. + frame_->RemoveBeforeLoadJavaScript(static_cast<uint64_t>( + CastPlatformBindingsId::NAMED_MESSAGE_PORT_CONNECTOR)); + } +} + +void NamedMessagePortConnector::Register(DefaultPortConnectedCallback handler) { + default_handler_ = std::move(handler); +} + +void NamedMessagePortConnector::OnPageLoad() { + control_port_.Unbind(); + + fuchsia::web::WebMessage message; + message.set_data(cr_fuchsia::MemBufferFromString(kControlPortConnectMessage, + "cast-connect-message")); + std::vector<fuchsia::web::OutgoingTransferable> outgoing_vector(1); + outgoing_vector[0].set_message_port(control_port_.NewRequest()); + message.set_outgoing_transfer(std::move(outgoing_vector)); + + frame_->PostMessage("*", std::move(message), + [](fuchsia::web::Frame_PostMessage_Result result) { + DCHECK(result.is_response()); + }); + + ReceiveNextConnectRequest(); +} + +void NamedMessagePortConnector::ReceiveNextConnectRequest() { + DCHECK(control_port_); + + control_port_->ReceiveMessage( + fit::bind_member(this, &NamedMessagePortConnector::OnConnectRequest)); +} + +void NamedMessagePortConnector::OnConnectRequest( + fuchsia::web::WebMessage message) { + std::string port_name; + if (!message.has_data() || + !cr_fuchsia::StringFromMemBuffer(message.data(), &port_name)) { + LOG(ERROR) << "Couldn't read from message VMO."; + control_port_.Unbind(); + return; + } + + size_t num_transfers = message.has_incoming_transfer() ? + message.incoming_transfer().size() : 0U; + if (num_transfers != 1) { + LOG(ERROR) << "Expected one Transferable, got " << num_transfers + << " instead."; + control_port_.Unbind(); + return; + } + + fuchsia::web::IncomingTransferable& transferable = + (*message.mutable_incoming_transfer())[0]; + if (!transferable.is_message_port()) { + LOG(ERROR) << "Transferable is not a MessagePort."; + control_port_.Unbind(); + return; + } + + DCHECK(default_handler_); + default_handler_.Run(port_name, std::move(transferable.message_port())); + + ReceiveNextConnectRequest(); +}
diff --git a/fuchsia/runners/cast/named_message_port_connector.h b/fuchsia/runners/cast/named_message_port_connector.h new file mode 100644 index 0000000..db04a75 --- /dev/null +++ b/fuchsia/runners/cast/named_message_port_connector.h
@@ -0,0 +1,52 @@ +// 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. + +#ifndef FUCHSIA_RUNNERS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_H_ +#define FUCHSIA_RUNNERS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_H_ + +#include <fuchsia/web/cpp/fidl.h> +#include <lib/fidl/cpp/interface_handle.h> +#include <map> +#include <string> + +#include "base/callback.h" +#include "base/macros.h" + +// Injects an API into |frame| through which it can connect MessagePorts to one +// or more services registered by the caller. +class NamedMessagePortConnector { + public: + using DefaultPortConnectedCallback = base::RepeatingCallback<void( + base::StringPiece, + fidl::InterfaceHandle<fuchsia::web::MessagePort>)>; + + explicit NamedMessagePortConnector(fuchsia::web::Frame* frame); + ~NamedMessagePortConnector(); + + // Sets the handler that is called for connected ports which aren't + // registered in advance. + void Register(DefaultPortConnectedCallback handler); + + // Invoked by the caller after every |frame_| page load. + // Half-connected ports from prior page generations will be discarded. + void OnPageLoad(); + + private: + // Gets the next port from |control_port_|. + void ReceiveNextConnectRequest(); + + // Handles a port received from |control_port_|. + void OnConnectRequest(fuchsia::web::WebMessage message); + + fuchsia::web::Frame* const frame_; + + // Invoked for ports which weren't previously Register()'ed. + DefaultPortConnectedCallback default_handler_; + + fuchsia::web::MessagePortPtr control_port_; + + DISALLOW_COPY_AND_ASSIGN(NamedMessagePortConnector); +}; + +#endif // FUCHSIA_RUNNERS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_H_
diff --git a/fuchsia/runners/cast/named_message_port_connector_fuchsia_browsertest.cc b/fuchsia/runners/cast/named_message_port_connector_browsertest.cc similarity index 65% rename from fuchsia/runners/cast/named_message_port_connector_fuchsia_browsertest.cc rename to fuchsia/runners/cast/named_message_port_connector_browsertest.cc index d6ea6186d..d0151eb3 100644 --- a/fuchsia/runners/cast/named_message_port_connector_fuchsia_browsertest.cc +++ b/fuchsia/runners/cast/named_message_port_connector_browsertest.cc
@@ -9,54 +9,38 @@ #include "base/files/file_util.h" #include "base/macros.h" #include "base/path_service.h" +#include "base/threading/thread_restrictions.h" #include "content/public/test/browser_test.h" #include "fuchsia/base/fit_adapter.h" #include "fuchsia/base/frame_test_util.h" #include "fuchsia/base/mem_buffer_util.h" -#include "fuchsia/base/message_port.h" #include "fuchsia/base/result_receiver.h" #include "fuchsia/base/test_navigation_listener.h" #include "fuchsia/engine/test/web_engine_browser_test.h" -#include "fuchsia/runners/cast/named_message_port_connector_fuchsia.h" +#include "fuchsia/runners/cast/named_message_port_connector.h" #include "testing/gmock/include/gmock/gmock-matchers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/resource/resource_bundle.h" #include "url/url_constants.h" -class NamedMessagePortConnectorFuchsiaTest - : public cr_fuchsia::WebEngineBrowserTest { +class NamedMessagePortConnectorTest : public cr_fuchsia::WebEngineBrowserTest { public: - NamedMessagePortConnectorFuchsiaTest() { + NamedMessagePortConnectorTest() { set_test_server_root(base::FilePath("fuchsia/runners/cast/testdata")); - navigation_listener_.SetBeforeAckHook(base::BindRepeating( - &NamedMessagePortConnectorFuchsiaTest::OnBeforeAckHook, - base::Unretained(this))); + navigation_listener_.SetBeforeAckHook( + base::BindRepeating(&NamedMessagePortConnectorTest::OnBeforeAckHook, + base::Unretained(this))); } - ~NamedMessagePortConnectorFuchsiaTest() override = default; + ~NamedMessagePortConnectorTest() override = default; protected: // BrowserTestBase implementation. void SetUpOnMainThread() override { cr_fuchsia::WebEngineBrowserTest::SetUpOnMainThread(); frame_ = WebEngineBrowserTest::CreateFrame(&navigation_listener_); - - static bool g_js_resources_loaded = false; - if (!g_js_resources_loaded) { - base::FilePath pak_file; - bool result = base::PathService::Get(base::DIR_ASSETS, &pak_file); - DCHECK(result); - pak_file = pak_file.Append( - FILE_PATH_LITERAL("components/cast/named_message_port_connector/" - "named_message_port_connector_resources.pak")); - DCHECK(base::PathExists(pak_file)); - ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( - pak_file, ui::ScaleFactor::SCALE_FACTOR_NONE); - g_js_resources_loaded = true; - } - connector_ = - std::make_unique<NamedMessagePortConnectorFuchsia>(frame_.get()); + base::ScopedAllowBlockingForTesting allow_blocking; + connector_ = std::make_unique<NamedMessagePortConnector>(frame_.get()); } // Intercepts the page load event to trigger the injection of |connector_|'s @@ -66,15 +50,8 @@ fuchsia::web::NavigationEventListener::OnNavigationStateChangedCallback callback) { if (change.has_is_main_document_loaded() && - change.is_main_document_loaded()) { - frame_->PostMessage("*", - std::move(*cr_fuchsia::FidlWebMessageFromBlink( - connector_->GetConnectMessage(), - cr_fuchsia::TransferableHostType::kRemote)), - [](fuchsia::web::Frame_PostMessage_Result result) { - DCHECK(result.is_response()); - }); - } + change.is_main_document_loaded()) + connector_->OnPageLoad(); // Allow the TestNavigationListener's usual navigation event processing flow // to continue. @@ -83,42 +60,36 @@ std::unique_ptr<base::RunLoop> navigate_run_loop_; fuchsia::web::FramePtr frame_; - std::unique_ptr<NamedMessagePortConnectorFuchsia> connector_; + std::unique_ptr<NamedMessagePortConnector> connector_; cr_fuchsia::TestNavigationListener navigation_listener_; - DISALLOW_COPY_AND_ASSIGN(NamedMessagePortConnectorFuchsiaTest); + DISALLOW_COPY_AND_ASSIGN(NamedMessagePortConnectorTest); }; -IN_PROC_BROWSER_TEST_F(NamedMessagePortConnectorFuchsiaTest, EndToEnd) { +IN_PROC_BROWSER_TEST_F(NamedMessagePortConnectorTest, EndToEnd) { ASSERT_TRUE(embedded_test_server()->Start()); GURL test_url(embedded_test_server()->GetURL("/connector.html")); fuchsia::web::NavigationControllerPtr controller; frame_->GetNavigationController(controller.NewRequest()); - std::string received_port_name; fidl::InterfaceHandle<fuchsia::web::MessagePort> received_port; base::RunLoop receive_port_run_loop; - connector_->RegisterPortHandler(base::BindRepeating( - [](std::string* received_port_name, - fidl::InterfaceHandle<fuchsia::web::MessagePort>* received_port, - base::RunLoop* receive_port_run_loop, base::StringPiece port_name, - blink::WebMessagePort port) -> bool { - *received_port_name = port_name.as_string(); - *received_port = cr_fuchsia::FidlMessagePortFromBlink(std::move(port)); + connector_->Register(base::BindRepeating( + [](fidl::InterfaceHandle<fuchsia::web::MessagePort>* received_port, + base::RunLoop* receive_port_run_loop, base::StringPiece name, + fidl::InterfaceHandle<fuchsia::web::MessagePort> message_port) { + *received_port = std::move(message_port); receive_port_run_loop->Quit(); - return true; }, - base::Unretained(&received_port_name), base::Unretained(&received_port), + base::Unretained(&received_port), base::Unretained(&receive_port_run_loop))); EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse( controller.get(), fuchsia::web::LoadUrlParams(), test_url.spec())); navigation_listener_.RunUntilUrlEquals(test_url); - // The JS code in connector.html should connect to the port "echo". receive_port_run_loop.Run(); - EXPECT_EQ(received_port_name, "echo"); fuchsia::web::MessagePortPtr message_port = received_port.Bind(); @@ -159,11 +130,9 @@ } } -// Tests that the NamedMessagePortConnectorFuchsia can receive more than one -// port over its lifetime. -IN_PROC_BROWSER_TEST_F(NamedMessagePortConnectorFuchsiaTest, MultiplePorts) { - constexpr size_t kExpectedPortCount = 3; - +// Tests that the NamedMessagePortConnector can receive more than one port over +// its lifetime. +IN_PROC_BROWSER_TEST_F(NamedMessagePortConnectorTest, MultiplePorts) { ASSERT_TRUE(embedded_test_server()->Start()); GURL test_url( embedded_test_server()->GetURL("/connector_multiple_ports.html")); @@ -173,18 +142,15 @@ std::vector<fidl::InterfaceHandle<fuchsia::web::MessagePort>> received_ports; base::RunLoop receive_ports_run_loop; - connector_->RegisterPortHandler(base::BindRepeating( + connector_->Register(base::BindRepeating( [](std::vector<fidl::InterfaceHandle<fuchsia::web::MessagePort>>* received_ports, - base::RunLoop* receive_ports_run_loop, base::StringPiece, - blink::WebMessagePort port) -> bool { - received_ports->push_back( - cr_fuchsia::FidlMessagePortFromBlink(std::move(port))); + base::RunLoop* receive_ports_run_loop, base::StringPiece name, + fidl::InterfaceHandle<fuchsia::web::MessagePort> message_port) { + received_ports->push_back(std::move(message_port)); - if (received_ports->size() == kExpectedPortCount) + if (received_ports->size() == 3) receive_ports_run_loop->Quit(); - - return true; }, base::Unretained(&received_ports), base::Unretained(&receive_ports_run_loop))); @@ -192,6 +158,7 @@ EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse( controller.get(), fuchsia::web::LoadUrlParams(), test_url.spec())); navigation_listener_.RunUntilUrlEquals(test_url); + receive_ports_run_loop.Run(); for (fidl::InterfaceHandle<fuchsia::web::MessagePort>& message_port :
diff --git a/fuchsia/runners/cast/named_message_port_connector_fuchsia.cc b/fuchsia/runners/cast/named_message_port_connector_fuchsia.cc deleted file mode 100644 index 9d76743..0000000 --- a/fuchsia/runners/cast/named_message_port_connector_fuchsia.cc +++ /dev/null
@@ -1,57 +0,0 @@ -// Copyright 2020 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 "fuchsia/runners/cast/named_message_port_connector_fuchsia.h" - -#include <fuchsia/web/cpp/fidl.h> -#include <memory> -#include <string> -#include <utility> -#include <vector> - -#include "base/logging.h" -#include "components/cast/named_message_port_connector/grit/named_message_port_connector_resources.h" -#include "fuchsia/base/mem_buffer_util.h" -#include "ui/base/resource/resource_bundle.h" - -namespace { -constexpr uint64_t kPortConnectorBindingsId = 1000; -} // namespace - -NamedMessagePortConnectorFuchsia::NamedMessagePortConnectorFuchsia( - fuchsia::web::Frame* frame) - : frame_(frame) { - DCHECK(frame_); - - std::string bindings_script_string = - ui::ResourceBundle::GetSharedInstance().LoadDataResourceString( - IDR_PORT_CONNECTOR_JS); - DCHECK(!bindings_script_string.empty()) - << "NamedMessagePortConnector resources not loaded."; - - // Inject the JS connection API into the Frame. - constexpr char kBindingsScriptVmoName[] = "port-connector-js"; - fuchsia::mem::Buffer bindings_script = cr_fuchsia::MemBufferFromString( - std::move(bindings_script_string), kBindingsScriptVmoName); - - std::vector<std::string> origins = {"*"}; - frame_->AddBeforeLoadJavaScript( - kPortConnectorBindingsId, std::move(origins), std::move(bindings_script), - [](fuchsia::web::Frame_AddBeforeLoadJavaScript_Result result) { - CHECK(result.is_response()) - << "Couldn't inject port connector bindings."; - }); -} - -NamedMessagePortConnectorFuchsia::~NamedMessagePortConnectorFuchsia() { - // Nothing to do if there is no attached Frame. - if (!frame_) - return; - - frame_->RemoveBeforeLoadJavaScript(kPortConnectorBindingsId); -} - -void NamedMessagePortConnectorFuchsia::DetachFromFrame() { - frame_ = nullptr; -}
diff --git a/fuchsia/runners/cast/named_message_port_connector_fuchsia.h b/fuchsia/runners/cast/named_message_port_connector_fuchsia.h deleted file mode 100644 index 75742a5..0000000 --- a/fuchsia/runners/cast/named_message_port_connector_fuchsia.h +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2020 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 FUCHSIA_RUNNERS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_FUCHSIA_H_ -#define FUCHSIA_RUNNERS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_FUCHSIA_H_ - -#include "components/cast/named_message_port_connector/named_message_port_connector.h" - -namespace fuchsia { -namespace web { -class Frame; -} -} // namespace fuchsia - -// Publishes NamedMessagePortConnector services to documents loaded in |frame|. -// OnFrameDisconnect() should be called if the FramePtr is torn down before -// |this|. -class NamedMessagePortConnectorFuchsia - : public cast_api_bindings::NamedMessagePortConnector { - public: - explicit NamedMessagePortConnectorFuchsia(fuchsia::web::Frame* frame); - ~NamedMessagePortConnectorFuchsia() override; - - NamedMessagePortConnectorFuchsia(const NamedMessagePortConnectorFuchsia&) = - delete; - void operator=(const NamedMessagePortConnectorFuchsia&) = delete; - - // Called when the peer Frame connection has terminated. - void DetachFromFrame(); - - private: - fuchsia::web::Frame* frame_ = nullptr; -}; - -#endif // FUCHSIA_RUNNERS_CAST_NAMED_MESSAGE_PORT_CONNECTOR_FUCHSIA_H_
diff --git a/fuchsia/runners/cast/testdata/connector.html b/fuchsia/runners/cast/testdata/connector.html index d6341858..2e505f7a 100644 --- a/fuchsia/runners/cast/testdata/connector.html +++ b/fuchsia/runners/cast/testdata/connector.html
@@ -2,7 +2,7 @@ <head><title>bindings</title></head> <body> <script> - var testChannel = cast.__platform__.PortConnector.bind('echo'); + var testChannel = cast.__platform__.PortConnector.bind('hello'); testChannel.onmessage = function(msg) { testChannel.postMessage('ack ' + msg.data); return true;
diff --git a/gpu/tools/compositor_model_bench/BUILD.gn b/gpu/tools/compositor_model_bench/BUILD.gn index 11f5dc66..004884b 100644 --- a/gpu/tools/compositor_model_bench/BUILD.gn +++ b/gpu/tools/compositor_model_bench/BUILD.gn
@@ -24,6 +24,7 @@ deps = [ "//base", + "//ui/base/x", "//ui/gfx/x", "//ui/gl", "//ui/gl/init",
diff --git a/gpu/tools/compositor_model_bench/DEPS b/gpu/tools/compositor_model_bench/DEPS new file mode 100644 index 0000000..8d59099 --- /dev/null +++ b/gpu/tools/compositor_model_bench/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+ui/base/x", +]
diff --git a/gpu/tools/compositor_model_bench/compositor_model_bench.cc b/gpu/tools/compositor_model_bench/compositor_model_bench.cc index ce74e51..3a6fbb5 100644 --- a/gpu/tools/compositor_model_bench/compositor_model_bench.cc +++ b/gpu/tools/compositor_model_bench/compositor_model_bench.cc
@@ -34,15 +34,16 @@ #include "gpu/tools/compositor_model_bench/render_model_utils.h" #include "gpu/tools/compositor_model_bench/render_models.h" #include "gpu/tools/compositor_model_bench/render_tree.h" +#include "ui/base/x/x11_util.h" #include "ui/gfx/x/connection.h" #include "ui/gfx/x/x11.h" #include "ui/gfx/x/xproto.h" #include "ui/gfx/x/xproto_util.h" #include "ui/gl/init/gl_factory.h" -using base::TimeTicks; using base::DirectoryExists; using base::PathExists; +using base::TimeTicks; using std::string; struct SimulationSpecification { @@ -64,7 +65,6 @@ : output_path_(output_path), seconds_per_test_(seconds_per_test), display_(nullptr), - window_(0), gl_context_(nullptr), window_width_(WINDOW_WIDTH), window_height_(WINDOW_HEIGHT) {} @@ -75,7 +75,7 @@ glXDestroyContext(display_, gl_context_); // Destroy window and display. - XDestroyWindow(display_, window_); + connection_->DestroyWindow({window_}); XCloseDisplay(display_); } @@ -87,8 +87,9 @@ // name, but that's not really harmful (we'll still warn about it though.) spec.simulation_name = path.BaseName().RemoveExtension().MaybeAsASCII(); if (spec.simulation_name.empty()) { - LOG(WARNING) << "Simulation for path " << path.LossyDisplayName() << - " will have a blank simulation name, since the file name isn't ASCII"; + LOG(WARNING) << "Simulation for path " << path.LossyDisplayName() + << " will have a blank simulation name, since the file name " + "isn't ASCII"; } spec.input_path = path; spec.model_under_test = ForwardRenderModel; @@ -155,21 +156,31 @@ return false; } - // Get properties of the screen. - int screen = XDefaultScreen(display_); - int root_window = XDefaultRootWindow(display_); - // Creates the window. - window_ = XCreateSimpleWindow( - display_, root_window, 1, 1, window_width_, window_height_, 0, - XBlackPixel(display_, screen), XBlackPixel(display_, screen)); - XStoreName(display_, window_, "Compositor Model Bench"); + auto black_pixel = connection_->default_screen().black_pixel; + window_ = connection_->GenerateId<x11::Window>(); + connection_->CreateWindow({ + .wid = window_, + .parent = connection_->default_root(), + .x = 1, + .y = 1, + .width = window_width_, + .height = window_height_, + .background_pixel = black_pixel, + .border_pixel = black_pixel, + .event_mask = x11::EventMask::Exposure | x11::EventMask::KeyPress | + x11::EventMask::StructureNotify, + }); + ui::SetStringProperty(window_, x11::Atom::WM_NAME, x11::Atom::STRING, + "Compositor Model Bench"); - XSelectInput(display_, window_, - ExposureMask | KeyPressMask | StructureNotifyMask); - XMapWindow(display_, window_); + connection_->MapWindow({window_}); - XResizeWindow(display_, window_, WINDOW_WIDTH, WINDOW_HEIGHT); + connection_->ConfigureWindow({ + .window = window_, + .width = WINDOW_WIDTH, + .height = WINDOW_HEIGHT, + }); return true; } @@ -181,10 +192,9 @@ return false; } - XWindowAttributes attributes; - XGetWindowAttributes(display_, window_, &attributes); XVisualInfo visual_info_template; - visual_info_template.visualid = XVisualIDFromVisual(attributes.visual); + if (auto reply = connection_->GetWindowAttributes({window_}).Sync()) + visual_info_template.visualid = static_cast<uint32_t>(reply->visual); int visual_info_count = 0; constexpr int kVisualIdMask = 1; XVisualInfo* visual_info_list = XGetVisualInfo( @@ -200,7 +210,8 @@ return false; } - if (!glXMakeCurrent(display_, window_, gl_context_)) { + if (!glXMakeCurrent(display_, static_cast<uint32_t>(window_), + gl_context_)) { glXDestroyContext(display_, gl_context_); gl_context_ = nullptr; return false; @@ -239,7 +250,7 @@ if (current_sim_) current_sim_->Update(); - glXSwapBuffers(display_, window_); + glXSwapBuffers(display_, static_cast<uint32_t>(window_)); auto window = static_cast<x11::Window>(window_); x11::ExposeEvent ev{ @@ -272,13 +283,12 @@ while (sims_completed_.size()) { SimulationSpecification i = sims_completed_.front(); fprintf(f, - "\t\t{\"simulation_name\":\"%s\",\n" - "\t\t\t\"render_model\":\"%s\",\n" - "\t\t\t\"frames_drawn\":%d\n" - "\t\t},\n", - i.simulation_name.c_str(), - ModelToString(i.model_under_test), - i.frames_rendered); + "\t\t{\"simulation_name\":\"%s\",\n" + "\t\t\t\"render_model\":\"%s\",\n" + "\t\t\t\"frames_drawn\":%d\n" + "\t\t},\n", + i.simulation_name.c_str(), ModelToString(i.model_under_test), + i.frames_rendered); sims_completed_.pop(); } @@ -296,7 +306,7 @@ } if (sims_remaining_.size() && - sims_remaining_.front().simulation_start_time.is_null()) { + sims_remaining_.front().simulation_start_time.is_null()) { while (sims_remaining_.size() && !InitializeNextTest()) { sims_remaining_.pop(); } @@ -334,7 +344,7 @@ // GUI data std::unique_ptr<x11::Connection> connection_; Display* display_; - Window window_; + x11::Window window_ = x11::Window::None; GLXContext gl_context_; int window_width_; int window_height_; @@ -346,17 +356,18 @@ const base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); if (argc != 3 && argc != 4) { - LOG(INFO) << "Usage: \n" << - cl->GetProgram().BaseName().LossyDisplayName() << - "--in=[input path] --out=[output path] (duration=[seconds])\n" - "The input path specifies either a JSON configuration file or\n" - "a directory containing only these files\n" - "(if a directory is specified, simulations will be run for\n" - "all files in that directory and subdirectories)\n" - "The optional duration parameter specifies the (integer)\n" - "number of seconds to be spent on each simulation.\n" - "Performance measurements for the specified simulation(s) are\n" - "written to the output path."; + LOG(INFO) + << "Usage: \n" + << cl->GetProgram().BaseName().LossyDisplayName() + << "--in=[input path] --out=[output path] (duration=[seconds])\n" + "The input path specifies either a JSON configuration file or\n" + "a directory containing only these files\n" + "(if a directory is specified, simulations will be run for\n" + "all files in that directory and subdirectories)\n" + "The optional duration parameter specifies the (integer)\n" + "number of seconds to be spent on each simulation.\n" + "Performance measurements for the specified simulation(s) are\n" + "written to the output path."; return -1; }
diff --git a/gpu/vulkan/x/vulkan_surface_x11.cc b/gpu/vulkan/x/vulkan_surface_x11.cc index 86de02b..5c5b006 100644 --- a/gpu/vulkan/x/vulkan_surface_x11.cc +++ b/gpu/vulkan/x/vulkan_surface_x11.cc
@@ -47,38 +47,40 @@ std::unique_ptr<VulkanSurfaceX11> VulkanSurfaceX11::Create( VkInstance vk_instance, x11::Window parent_window) { - XDisplay* display = gfx::GetXDisplay(); - XWindowAttributes attributes; - if (!XGetWindowAttributes(display, static_cast<uint32_t>(parent_window), - &attributes)) { - LOG(ERROR) << "XGetWindowAttributes failed for window " + auto* connection = x11::Connection::Get(); + auto geometry = connection->GetGeometry({parent_window}).Sync(); + if (!geometry) { + LOG(ERROR) << "GetGeometry failed for window " << static_cast<uint32_t>(parent_window) << "."; return nullptr; } - Window window = XCreateWindow( - display, static_cast<uint32_t>(parent_window), 0, 0, attributes.width, - attributes.height, 0, static_cast<int>(x11::WindowClass::CopyFromParent), - static_cast<int>(x11::WindowClass::InputOutput), nullptr, 0, nullptr); - if (!window) { - LOG(ERROR) << "XCreateWindow failed."; + + auto window = connection->GenerateId<x11::Window>(); + connection->CreateWindow({ + .wid = window, + .parent = parent_window, + .width = geometry->width, + .height = geometry->height, + .c_class = x11::WindowClass::InputOutput, + }); + if (connection->MapWindow({window}).Sync().error) { + LOG(ERROR) << "Failed to create or map window."; return nullptr; } - XMapWindow(display, window); - XFlush(display); VkSurfaceKHR vk_surface; VkXlibSurfaceCreateInfoKHR surface_create_info = { VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR}; - surface_create_info.dpy = display; - surface_create_info.window = window; + surface_create_info.dpy = connection->display(); + surface_create_info.window = static_cast<uint32_t>(window); VkResult result = vkCreateXlibSurfaceKHR(vk_instance, &surface_create_info, nullptr, &vk_surface); if (VK_SUCCESS != result) { DLOG(ERROR) << "vkCreateXlibSurfaceKHR() failed: " << result; return nullptr; } - return std::make_unique<VulkanSurfaceX11>( - vk_instance, vk_surface, parent_window, static_cast<x11::Window>(window)); + return std::make_unique<VulkanSurfaceX11>(vk_instance, vk_surface, + parent_window, window); } VulkanSurfaceX11::VulkanSurfaceX11(VkInstance vk_instance, @@ -99,10 +101,10 @@ VulkanSurface::Destroy(); expose_event_forwarder_.reset(); if (window_ != x11::Window::None) { - Display* display = gfx::GetXDisplay(); - XDestroyWindow(display, static_cast<uint32_t>(window_)); + auto* connection = x11::Connection::Get(); + connection->DestroyWindow({window_}); window_ = x11::Window::None; - XFlush(display); + connection->Flush(); } }
diff --git a/infra/config/generated/commit-queue.cfg b/infra/config/generated/commit-queue.cfg index 1e472892..136903b 100644 --- a/infra/config/generated/commit-queue.cfg +++ b/infra/config/generated/commit-queue.cfg
@@ -282,6 +282,10 @@ includable_only: true } builders { + name: "chromium/try/android-pie-arm64-wpt-rel-non-cq" + includable_only: true + } + builders { name: "chromium/try/android-pie-x86-rel" includable_only: true }
diff --git a/infra/config/generated/cr-buildbucket.cfg b/infra/config/generated/cr-buildbucket.cfg index 80559927..ad4a557 100644 --- a/infra/config/generated/cr-buildbucket.cfg +++ b/infra/config/generated/cr-buildbucket.cfg
@@ -17954,6 +17954,43 @@ } } builders { + name: "android-pie-arm64-wpt-rel-non-cq" + swarming_host: "chromium-swarm.appspot.com" + swarming_tags: "vpython:native-python-wrapper" + dimensions: "builderless:1" + dimensions: "cores:8" + dimensions: "cpu:x86-64" + dimensions: "os:Ubuntu-16.04" + dimensions: "pool:luci.chromium.try" + dimensions: "ssd:0" + exe { + cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" + cipd_version: "refs/heads/master" + cmd: "recipes" + } + properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"tryserver.chromium.android\",\"recipe\":\"chromium_trybot\"}" + execution_timeout_secs: 14400 + expiration_secs: 7200 + caches { + name: "win_toolchain" + path: "win_toolchain" + } + build_numbers: YES + service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com" + task_template_canary_percentage { + value: 5 + } + resultdb { + enable: true + bq_exports { + project: "luci-resultdb" + dataset: "chromium" + table: "try_test_results" + test_results {} + } + } + } + builders { name: "android-pie-x86-rel" swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper"
diff --git a/infra/config/generated/luci-milo.cfg b/infra/config/generated/luci-milo.cfg index bcd416b..834bb387 100644 --- a/infra/config/generated/luci-milo.cfg +++ b/infra/config/generated/luci-milo.cfg
@@ -12210,6 +12210,9 @@ name: "buildbucket/luci.chromium.try/android-pie-arm64-rel" } builders { + name: "buildbucket/luci.chromium.try/android-pie-arm64-wpt-rel-non-cq" + } + builders { name: "buildbucket/luci.chromium.try/android-pie-x86-rel" } builders { @@ -13111,6 +13114,9 @@ name: "buildbucket/luci.chromium.try/android-pie-arm64-rel" } builders { + name: "buildbucket/luci.chromium.try/android-pie-arm64-wpt-rel-non-cq" + } + builders { name: "buildbucket/luci.chromium.try/android-pie-x86-rel" } builders {
diff --git a/infra/config/generated/realms.cfg b/infra/config/generated/realms.cfg index de9b896..735c6e0 100644 --- a/infra/config/generated/realms.cfg +++ b/infra/config/generated/realms.cfg
@@ -272,6 +272,11 @@ principals: "user:findit-for-me@appspot.gserviceaccount.com" principals: "user:tricium-prod@appspot.gserviceaccount.com" } + bindings { + role: "role/swarming.taskTriggerer" + principals: "group:chromium-led-users" + principals: "user:infra-try-recipes-tester@chops-service-accounts.iam.gserviceaccount.com" + } } realms { name: "webrtc"
diff --git a/infra/config/subprojects/chromium/try.star b/infra/config/subprojects/chromium/try.star index da0d6b39..69ed38f11 100644 --- a/infra/config/subprojects/chromium/try.star +++ b/infra/config/subprojects/chromium/try.star
@@ -341,6 +341,10 @@ ) try_.chromium_android_builder( + name = "android-pie-arm64-wpt-rel-non-cq", +) + +try_.chromium_android_builder( name = "android-weblayer-pie-x86-fyi-rel", )
diff --git a/infra/config/swarming.star b/infra/config/swarming.star index f035bfcc..80edcf4 100644 --- a/infra/config/swarming.star +++ b/infra/config/swarming.star
@@ -83,6 +83,20 @@ ], ) +# LED users that can trigger try builds via LED. +swarming.task_triggerers( + builder_realm = "try-m85", + pool_realm = "pools/try", + groups = [ + "chromium-led-users", + ], + users = [ + # An account used by "Build Recipes Tester" builder infra/try bucket + # used to tests changes to Chromium recipes using LED before commit. + "infra-try-recipes-tester@chops-service-accounts.iam.gserviceaccount.com", + ], +) + # Realm with bots that run isolated tests. # # Tasks here are triggered directly on Swarming (not via Buildbucket) by various
diff --git a/ios/build/bots/scripts/PRESUBMIT.py b/ios/build/bots/scripts/PRESUBMIT.py index 7538c4a..d5425d7 100644 --- a/ios/build/bots/scripts/PRESUBMIT.py +++ b/ios/build/bots/scripts/PRESUBMIT.py
@@ -10,7 +10,7 @@ def _RunTestRunnerUnitTests(input_api, output_api): """ Runs iOS test runner unit tests """ - # TODO(crbug.com/1056457): Replace whitelist with regex ".*_test.py" once + # TODO(crbug.com/1056457): Replace the list with regex ".*_test.py" once # all test files are fixed. files = [ 'coverage_util_test.py', @@ -26,7 +26,7 @@ ] return input_api.canned_checks.RunUnitTestsInDirectory( - input_api, output_api, '.', whitelist=files) + input_api, output_api, '.', files_to_check=files) def CheckChange(input_api, output_api):
diff --git a/ios/build/bots/scripts/test_runner.py b/ios/build/bots/scripts/test_runner.py index 9bb7ddc2..34f40e6 100644 --- a/ios/build/bots/scripts/test_runner.py +++ b/ios/build/bots/scripts/test_runner.py
@@ -569,11 +569,26 @@ # target. For simulators, '--xctest' is passed to test runner scripts to # make it run XCTest based unit test. if self.xctest: - test_app = test_apps.SimulatorXCTestUnitTestsApp( - self.app_path, - included_tests=self.test_cases, - env_vars=self.env_vars, - test_args=self.test_args) + # TODO(crbug.com/1085603): Pass in test runner an arg to determine if it's + # device test or simulator test and test the arg here. + if self.__class__.__name__ == 'SimulatorTestRunner': + test_app = test_apps.SimulatorXCTestUnitTestsApp( + self.app_path, + included_tests=self.test_cases, + env_vars=self.env_vars, + test_args=self.test_args) + elif self.__class__.__name__ == 'DeviceTestRunner': + test_app = test_apps.DeviceXCTestUnitTestsApp( + self.app_path, + included_tests=self.test_cases, + env_vars=self.env_vars, + test_args=self.test_args) + else: + raise XCTestConfigError('Wrong config. TestRunner.launch() called from' + ' an unexpected class.') + + # TODO(crbug.com/1085603): Remove when device unit tests have xctest in + # configs. elif self.xctest_path: if self.__class__.__name__ == 'DeviceTestRunner': @@ -1086,7 +1101,9 @@ Returns: A list of strings forming the command to launch the test. """ - if self.xctest_path: + # TODO(crbug.com/1085603): Remove self.xctest_path check when device unit + # tests have xctest in configs. + if self.xctest_path or self.xctest: return test_app.command(out_dir, destination, shards) cmd = [
diff --git a/ios/chrome/browser/ui/authentication/signin/BUILD.gn b/ios/chrome/browser/ui/authentication/signin/BUILD.gn index d11ec40..2b0c670 100644 --- a/ios/chrome/browser/ui/authentication/signin/BUILD.gn +++ b/ios/chrome/browser/ui/authentication/signin/BUILD.gn
@@ -50,6 +50,7 @@ "//ios/chrome/browser/signin", "//ios/chrome/browser/ui/authentication/signin/add_account_signin", "//ios/chrome/browser/ui/authentication/signin/advanced_settings_signin", + "//ios/chrome/browser/ui/authentication/signin/consistency_promo_signin", "//ios/chrome/browser/ui/authentication/signin/trusted_vault_reauthentication", "//ios/chrome/browser/ui/authentication/signin/user_signin", "//ios/chrome/browser/ui/authentication/signin/user_signin/logging",
diff --git a/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_coordinator.mm b/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_coordinator.mm index 775c71c..1c0d126 100644 --- a/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_coordinator.mm +++ b/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_coordinator.mm
@@ -148,13 +148,14 @@ #pragma mark - AddAccountSigninManagerDelegate -- (void)addAccountSigninManagerFailedWithError:(NSError*)error { +- (void)addAccountSigninManagerFailedWithError:(NSError*)error + identity:(ChromeIdentity*)identity { DCHECK(error); __weak AddAccountSigninCoordinator* weakSelf = self; ProceduralBlock dismissAction = ^{ [weakSelf addAccountSigninManagerFinishedWithSigninResult: SigninCoordinatorResultCanceledByUser - identity:nil]; + identity:identity]; }; self.alertCoordinator = ErrorCoordinator(
diff --git a/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager.h b/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager.h index 4999dbc2..5b6ce0e 100644 --- a/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager.h +++ b/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager.h
@@ -23,7 +23,9 @@ // Shows alert modal dialog and interrupts sign-in operation. // |error| is the error to be displayed. -- (void)addAccountSigninManagerFailedWithError:(NSError*)error; +// |identity| is the identity of the account that failed to add. +- (void)addAccountSigninManagerFailedWithError:(NSError*)error + identity:(ChromeIdentity*)identity; // Completes the sign-in operation. // |signinResult| is the state of sign-in at add account flow completion.
diff --git a/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager.mm b/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager.mm index e57ecb72..476ad2f 100644 --- a/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager.mm +++ b/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager.mm
@@ -95,15 +95,14 @@ error:(NSError*)error { SigninCoordinatorResult signinResult; if (error) { - DCHECK(!identity); // Filter out errors handled internally by ChromeIdentity. if (ShouldHandleSigninError(error)) { - [self.delegate addAccountSigninManagerFailedWithError:error]; + [self.delegate addAccountSigninManagerFailedWithError:error + identity:identity]; return; } signinResult = SigninCoordinatorResultCanceledByUser; } else { - DCHECK(identity); signinResult = self.signinInterrupted ? SigninCoordinatorResultInterrupted : SigninCoordinatorResultSuccess; }
diff --git a/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager_unittest.mm b/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager_unittest.mm index e9f38d5..97528ad 100644 --- a/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager_unittest.mm +++ b/ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_manager_unittest.mm
@@ -153,7 +153,7 @@ OCMExpect([signin_manager_delegate_ addAccountSigninManagerFinishedWithSigninResult: SigninCoordinatorResultCanceledByUser - identity:nil]); + identity:fake_identity_]); [signin_manager_ showSigninWithIntent:AddAccountSigninIntentAddSecondaryAccount]; @@ -172,7 +172,8 @@ // Verify that completion was called with canceled result state and an error // is shown. OCMExpect([signin_manager_delegate_ - addAccountSigninManagerFailedWithError:[OCMArg any]]); + addAccountSigninManagerFailedWithError:[OCMArg any] + identity:fake_identity_]); [signin_manager_ showSigninWithIntent:AddAccountSigninIntentAddSecondaryAccount]; @@ -221,7 +222,7 @@ OCMExpect([signin_manager_delegate_ addAccountSigninManagerFinishedWithSigninResult: SigninCoordinatorResultCanceledByUser - identity:nil]); + identity:fake_identity_]); [signin_manager_ showSigninWithIntent:AddAccountSigninIntentReauthPrimaryAccount]; @@ -240,7 +241,8 @@ // Verify that completion was called with canceled result state and an error // is shown. OCMExpect([signin_manager_delegate_ - addAccountSigninManagerFailedWithError:[OCMArg any]]); + addAccountSigninManagerFailedWithError:[OCMArg any] + identity:fake_identity_]); [signin_manager_ showSigninWithIntent:AddAccountSigninIntentReauthPrimaryAccount];
diff --git a/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/BUILD.gn b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/BUILD.gn new file mode 100644 index 0000000..71d4222 --- /dev/null +++ b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/BUILD.gn
@@ -0,0 +1,21 @@ +# Copyright 2020 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("//build/config/chrome_build.gni") + +source_set("consistency_promo_signin") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "consistency_promo_signin_coordinator.h", + "consistency_promo_signin_coordinator.mm", + ] + deps = [ + "//ios/chrome/browser/browser_state", + "//ios/chrome/browser/main:public", + "//ios/chrome/browser/ui/authentication/signin:signin_protected", + "//ios/chrome/browser/ui/authentication/unified_consent/identity_chooser", + ] + public_deps = + [ "//ios/chrome/browser/ui/authentication/signin:signin_headers" ] +}
diff --git a/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.h b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.h new file mode 100644 index 0000000..f0f8bf8 --- /dev/null +++ b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.h
@@ -0,0 +1,16 @@ +// Copyright 2020 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 IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_CONSISTENCY_PROMO_SIGNIN_CONSISTENCY_PROMO_SIGNIN_COORDINATOR_H_ +#define IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_CONSISTENCY_PROMO_SIGNIN_CONSISTENCY_PROMO_SIGNIN_COORDINATOR_H_ + +#import "ios/chrome/browser/ui/authentication/signin/signin_coordinator.h" + +// Enabled with |signin::kMobileIdentityConsistency| experiment flag. +// Coordinates various Identity options in Chrome including signing in +// using accounts on the device, opening Incognito, and adding an account. +@interface ConsistencyPromoSigninCoordinator : SigninCoordinator +@end + +#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_CONSISTENCY_PROMO_SIGNIN_CONSISTENCY_PROMO_SIGNIN_COORDINATOR_H_
diff --git a/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.mm b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.mm new file mode 100644 index 0000000..f67fb56 --- /dev/null +++ b/ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.mm
@@ -0,0 +1,113 @@ +// Copyright 2020 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 "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.h" + +#import "ios/chrome/browser/browser_state/chrome_browser_state.h" +#import "ios/chrome/browser/main/browser.h" +#import "ios/chrome/browser/ui/authentication/signin/signin_coordinator+protected.h" +#import "ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.h" +#import "ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator_delegate.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface ConsistencyPromoSigninCoordinator () < + IdentityChooserCoordinatorDelegate> + +// Identity chooser coordinator. +@property(nonatomic, strong) + IdentityChooserCoordinator* identityChooserCoordinator; + +@end + +@implementation ConsistencyPromoSigninCoordinator + +#pragma mark - Public + +- (instancetype)initWithBaseViewController:(UIViewController*)viewController + browser:(Browser*)browser { + return [super initWithBaseViewController:viewController browser:browser]; +} + +#pragma mark - SigninCoordinator + +- (void)interruptWithAction:(SigninCoordinatorInterruptAction)action + completion:(ProceduralBlock)completion { + [self.identityChooserCoordinator stop]; + self.identityChooserCoordinator.delegate = nil; + self.identityChooserCoordinator = nil; + + __weak ConsistencyPromoSigninCoordinator* weakSelf = self; + ProceduralBlock interruptCompletion = ^{ + [weakSelf + runCompletionCallbackWithSigninResult:SigninCoordinatorResultInterrupted + identity:nil + showAdvancedSettingsSignin:NO]; + if (completion) { + completion(); + } + }; + + switch (action) { + case SigninCoordinatorInterruptActionNoDismiss: { + interruptCompletion(); + break; + } + case SigninCoordinatorInterruptActionDismissWithoutAnimation: { + [self.baseViewController + dismissViewControllerAnimated:NO + completion:interruptCompletion]; + break; + } + case SigninCoordinatorInterruptActionDismissWithAnimation: { + [self.baseViewController + dismissViewControllerAnimated:YES + completion:interruptCompletion]; + break; + } + } +} + +#pragma mark - ChromeCoordinator + +- (void)start { + [super start]; + self.identityChooserCoordinator = [[IdentityChooserCoordinator alloc] + initWithBaseViewController:self.baseViewController + browser:self.browser]; + self.identityChooserCoordinator.delegate = self; + [self.identityChooserCoordinator start]; +} + +#pragma mark - IdentityChooserCoordinatorDelegate + +- (void)identityChooserCoordinatorDidClose: + (IdentityChooserCoordinator*)coordinator { + CHECK_EQ(self.identityChooserCoordinator, coordinator); + [self.identityChooserCoordinator stop]; + self.identityChooserCoordinator.delegate = nil; + self.identityChooserCoordinator = nil; + + [self runCompletionCallbackWithSigninResult:SigninCoordinatorResultSuccess + identity:nil + showAdvancedSettingsSignin:NO]; +} + +- (void)identityChooserCoordinatorDidTapOnAddAccount: + (IdentityChooserCoordinator*)coordinator { + CHECK_EQ(self.identityChooserCoordinator, coordinator); + // TODO(crbug.com/1125631): Add action for tapping on "Add account" button. + NOTIMPLEMENTED(); +} + +- (void)identityChooserCoordinator:(IdentityChooserCoordinator*)coordinator + didSelectIdentity:(ChromeIdentity*)identity { + CHECK_EQ(self.identityChooserCoordinator, coordinator); + // TODO(crbug.com/1125631): Add sign-in action for tapping on an identity. + NOTIMPLEMENTED(); +} + +@end
diff --git a/ios/chrome/browser/ui/authentication/signin/signin_coordinator+protected.h b/ios/chrome/browser/ui/authentication/signin/signin_coordinator+protected.h index 564bb5a..c1084f7 100644 --- a/ios/chrome/browser/ui/authentication/signin/signin_coordinator+protected.h +++ b/ios/chrome/browser/ui/authentication/signin/signin_coordinator+protected.h
@@ -14,7 +14,8 @@ // Runs the sign-in completion callback. // |signinResult| is the state of sign-in at add account flow completion. -// |identity| is the identity of the added account. +// |identity| is the identity of the added account. Can be nil in the case that +// sign-in is interrupted or canceled before the user has selected an identity. // |showAdvancedSettingsSignin| is YES if the user wants to open the // advanced settings signin. - (void)runCompletionCallbackWithSigninResult:
diff --git a/ios/chrome/browser/ui/authentication/signin/signin_coordinator.h b/ios/chrome/browser/ui/authentication/signin/signin_coordinator.h index c683209..db3c89b9 100644 --- a/ios/chrome/browser/ui/authentication/signin/signin_coordinator.h +++ b/ios/chrome/browser/ui/authentication/signin/signin_coordinator.h
@@ -112,6 +112,14 @@ KeyRetrievalTriggerForUMA) retrievalTrigger; +// Returns a coordinator to display the account consistency promo with a list +// of accounts available on the device for sign-in. +// |viewController| presents the promo. ++ (instancetype) + consistencyPromoSigninCoordinatorWithBaseViewController: + (UIViewController*)viewController + browser:(Browser*)browser; + // Interrupts the sign-in flow. // |signinCompletion(SigninCoordinatorResultInterrupted, nil)| is guaranteed to // be called before |completion()|.
diff --git a/ios/chrome/browser/ui/authentication/signin/signin_coordinator.mm b/ios/chrome/browser/ui/authentication/signin/signin_coordinator.mm index 5aa6af7..e0623500 100644 --- a/ios/chrome/browser/ui/authentication/signin/signin_coordinator.mm +++ b/ios/chrome/browser/ui/authentication/signin/signin_coordinator.mm
@@ -7,6 +7,7 @@ #include "base/notreached.h" #import "ios/chrome/browser/ui/authentication/signin/add_account_signin/add_account_signin_coordinator.h" #import "ios/chrome/browser/ui/authentication/signin/advanced_settings_signin/advanced_settings_signin_coordinator.h" +#import "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.h" #import "ios/chrome/browser/ui/authentication/signin/trusted_vault_reauthentication/trusted_vault_reauthentication_coordinator.h" #import "ios/chrome/browser/ui/authentication/signin/user_signin/logging/first_run_signin_logger.h" #import "ios/chrome/browser/ui/authentication/signin/user_signin/logging/upgrade_signin_logger.h" @@ -120,6 +121,15 @@ retrievalTrigger:retrievalTrigger]; } ++ (instancetype) + consistencyPromoSigninCoordinatorWithBaseViewController: + (UIViewController*)viewController + browser:(Browser*)browser { + return [[ConsistencyPromoSigninCoordinator alloc] + initWithBaseViewController:viewController + browser:browser]; +} + - (void)dealloc { // -[SigninCoordinator runCompletionCallbackWithSigninResult:identity: // showAdvancedSettingsSignin:] has to be called by the subclass before
diff --git a/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_view_controller.mm b/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_view_controller.mm index d82c24c..ab37774 100644 --- a/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_view_controller.mm
@@ -461,7 +461,7 @@ if (base::FeatureList::IsEnabled(kPointerSupport)) { button.pointerInteractionEnabled = YES; button.pointerStyleProvider = - CreateTransparentButtonPointerStyleProvider(); + CreateOpaqueOrTransparentButtonPointerStyleProvider(); } } #endif // defined(__IPHONE_13_4)
diff --git a/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm b/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm index 7476ca29..f863112 100644 --- a/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm +++ b/ios/chrome/browser/ui/location_bar/location_bar_view_controller.mm
@@ -226,27 +226,6 @@ [self switchToEditing:NO]; } -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - [self updateCachedClipboardState]; - - [NSNotificationCenter.defaultCenter - addObserver:self - selector:@selector(pasteboardDidChange:) - name:UIPasteboardChangedNotification - object:nil]; - - // The pasteboard changed notification doesn't fire if the clipboard changes - // while the app is in the background, so update the state whenever the app - // becomes active. - [NSNotificationCenter.defaultCenter - addObserver:self - selector:@selector(applicationDidBecomeActive:) - name:UIApplicationDidBecomeActiveNotification - object:nil]; -} - - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; @@ -553,21 +532,17 @@ RecordAction(UserMetricsAction("MobileToolbarShareMenu")); } -- (void)pasteboardDidChange:(NSNotification*)notification { - [self updateCachedClipboardState]; -} - -- (void)applicationDidBecomeActive:(NSNotification*)notification { - [self updateCachedClipboardState]; -} - -- (void)updateCachedClipboardState { +// Updates the cached clipboard content type and calls |completion| when the +// update process is finished. If this is called while an update is already in +// progress, it will return NO and the completion will never be called. +// Otherwise, returns YES. +- (BOOL)updateCachedClipboardStateWithCompletion:(void (^)(void))completion { // Sometimes, checking the clipboard state itself causes the clipboard to // emit a UIPasteboardChangedNotification, leading to an infinite loop. For // now, just prevent re-checking the clipboard state, but hopefully this will // be fixed in a future iOS version (see crbug.com/1049053 for crash details). if (self.isUpdatingCachedClipboardState) { - return; + return NO; } self.isUpdatingCachedClipboardState = YES; self.hasCopiedContent = NO; @@ -594,7 +569,9 @@ weakSelf.copiedContentType = ClipboardContentType::Text; } weakSelf.isUpdatingCachedClipboardState = NO; + completion(); })); + return YES; } #pragma mark - UIMenu @@ -614,17 +591,19 @@ initWithTitle:l10n_util::GetNSString(IDS_IOS_SEARCH_COPIED_TEXT) action:@selector(searchCopiedText:)]); - if (@available(iOS 13, *)) { - [menu showMenuFromView:self.view rect:self.locationBarSteadyView.frame]; - } else { - [menu setTargetRect:self.locationBarSteadyView.frame inView:self.view]; - [menu setMenuVisible:YES animated:YES]; - } - // When the menu is manually presented, it doesn't get focused by - // Voiceover. This notification forces voiceover to select the - // presented menu. - UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, - menu); + DCHECK([self updateCachedClipboardStateWithCompletion:^() { + if (@available(iOS 13, *)) { + [menu showMenuFromView:self.view rect:self.locationBarSteadyView.frame]; + } else { + [menu setTargetRect:self.locationBarSteadyView.frame inView:self.view]; + [menu setMenuVisible:YES animated:YES]; + } + // When the menu is manually presented, it doesn't get focused by + // Voiceover. This notification forces voiceover to select the + // presented menu. + UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, + menu); + }]); } } @@ -634,9 +613,10 @@ return YES; } - if (action == @selector(searchCopiedImage:) || - action == @selector(visitCopiedLink:) || - action == @selector(searchCopiedText:)) { + BOOL isClipboardAction = action == @selector(searchCopiedImage:) || + action == @selector(visitCopiedLink:) || + action == @selector(searchCopiedText:); + if (self.locationBarSteadyView.isFirstResponder && isClipboardAction) { if (!self.hasCopiedContent) { return NO; }
diff --git a/ios/chrome/browser/ui/main/scene_controller.mm b/ios/chrome/browser/ui/main/scene_controller.mm index 02500b5..130ab9e8 100644 --- a/ios/chrome/browser/ui/main/scene_controller.mm +++ b/ios/chrome/browser/ui/main/scene_controller.mm
@@ -1026,7 +1026,11 @@ - (void)showConsistencyPromoFromViewController: (UIViewController*)baseViewController { DCHECK(!self.signinCoordinator); - // TODO(crbug.com/1125631): Add new consistency promo UI to enable sign-in. + self.signinCoordinator = [SigninCoordinator + consistencyPromoSigninCoordinatorWithBaseViewController:baseViewController + browser:self.mainInterface + .browser]; + [self startSigninCoordinatorWithCompletion:nil]; } - (void)setIncognitoContentVisible:(BOOL)incognitoContentVisible {
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_view_controller.mm b/ios/chrome/browser/ui/omnibox/omnibox_view_controller.mm index a5791c9..01afec1 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_view_controller.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_view_controller.mm
@@ -167,8 +167,6 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - [self updateCachedClipboardState]; - [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(pasteboardDidChange:) @@ -299,6 +297,8 @@ // change). In this case, OnDidBeginEditing will be called multiple times. // If that becomes an issue a boolean should be added to track editing state. - (void)textFieldDidBeginEditing:(UITextField*)textField { + [self updateCachedClipboardState]; + // Update the clear button state. [self updateClearButtonVisibility]; [self.view setLeadingImage:self.textField.text.length
diff --git a/ios/public/provider/chrome/browser/signin/fake_chrome_identity_interaction_manager.mm b/ios/public/provider/chrome/browser/signin/fake_chrome_identity_interaction_manager.mm index 50e263fc..2b0272a 100644 --- a/ios/public/provider/chrome/browser/signin/fake_chrome_identity_interaction_manager.mm +++ b/ios/public/provider/chrome/browser/signin/fake_chrome_identity_interaction_manager.mm
@@ -169,7 +169,7 @@ // Ensure self is not destroyed in the callback. NS_VALID_UNTIL_END_OF_SCOPE FakeChromeIdentityInteractionManager* strongSelf = self; - _completionCallback(error ? nil : _fakeIdentity, error); + _completionCallback(_fakeIdentity, error); _completionCallback = nil; } }
diff --git a/jingle/glue/fake_ssl_client_socket_unittest.cc b/jingle/glue/fake_ssl_client_socket_unittest.cc index 7f017e5..34464b3 100644 --- a/jingle/glue/fake_ssl_client_socket_unittest.cc +++ b/jingle/glue/fake_ssl_client_socket_unittest.cc
@@ -108,7 +108,7 @@ std::unique_ptr<net::StreamSocket> MakeClientSocket() { return mock_client_socket_factory_.CreateTransportClientSocket( - net::AddressList(), NULL, NULL, net::NetLogSource()); + net::AddressList(), nullptr, nullptr, nullptr, net::NetLogSource()); } void SetData(const net::MockConnect& mock_connect,
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index 272bc79..e8d633a 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc
@@ -193,8 +193,7 @@ // specific configurations that are signalled via this command line flag. // TODO(b/159825227): remove when the "old" video decoder is fully launched. const char kPlatformDisallowsChromeOSDirectVideoDecoder[] = - // TODO(mcasas): Rename the flag string when crrev.com/c/2268600 lands. - "force-disable-new-accelerated-video-decoder"; + "platform-disallows-chromeos-direct-video-decoder"; #endif namespace autoplay {
diff --git a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm index ce66ba8e..ce5ade8 100644 --- a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm +++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
@@ -28,6 +28,10 @@ namespace { +// Logitech 4K Pro +constexpr NSString* kModelIdLogitech4KPro = + @"UVC Camera VendorID_1133 ProductID_2175"; + constexpr int kTimeToWaitBeforeStoppingStillImageCaptureInSeconds = 60; constexpr FourCharCode kDefaultFourCCPixelFormat = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; // NV12 (a.k.a. 420v) @@ -261,11 +265,16 @@ } if (best_fourcc == kCMVideoCodecType_JPEG_OpenDML) { - // Capturing MJPEG directly never worked. Request a conversion to what has - // historically been the default pixel format. - // TODO(https://crbug.com/1124884): Investigate the performance of - // performing MJPEG ourselves. - best_fourcc = kCMPixelFormat_422YpCbCr8; + // Capturing MJPEG for some cameras directly doesn't work (they don't + // forward frames to our sample callback), but for some reason macOS is able + // to pull it off without extreme latency introduced if we specify UYVY + // output format. + // TODO(crbugs.com/1124884): figure out if there's another workaround. + if ([[_captureDevice modelID] isEqualToString:kModelIdLogitech4KPro]) { + LOG(WARNING) << "Activating MJPEG workaround for camera " + << base::SysNSStringToUTF8(kModelIdLogitech4KPro); + best_fourcc = kCMPixelFormat_422YpCbCr8; + } } VLOG(2) << __func__ << ": configuring '" << MacFourCCToString(best_fourcc)
diff --git a/media/cdm/cdm_paths_unittest.cc b/media/cdm/cdm_paths_unittest.cc index 8886555..02eca59 100644 --- a/media/cdm/cdm_paths_unittest.cc +++ b/media/cdm/cdm_paths_unittest.cc
@@ -51,6 +51,8 @@ "x64"; #elif defined(ARCH_CPU_ARMEL) "arm"; +#elif defined(ARCH_CPU_ARM64) + "arm64"; #else "unsupported_arch"; #endif
diff --git a/media/gpu/vaapi/vaapi_wrapper.cc b/media/gpu/vaapi/vaapi_wrapper.cc index 2ad0b997..e30d1df 100644 --- a/media/gpu/vaapi/vaapi_wrapper.cc +++ b/media/gpu/vaapi/vaapi_wrapper.cc
@@ -409,6 +409,8 @@ // Implementation of Initialize() called only once. bool InitializeOnce() EXCLUSIVE_LOCKS_REQUIRED(va_lock_); + bool InitializeVaDisplay_Locked() EXCLUSIVE_LOCKS_REQUIRED(va_lock_); + bool InitializeVaDriver_Locked() EXCLUSIVE_LOCKS_REQUIRED(va_lock_); int refcount_ GUARDED_BY(va_lock_); @@ -472,11 +474,7 @@ return success; } -bool VADisplayState::InitializeOnce() { - static_assert( - VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 1), - "Requires VA-API >= 1.1.0"); - +bool VADisplayState::InitializeVaDisplay_Locked() { switch (gl::GetGLImplementation()) { case gl::kGLImplementationEGLGLES2: va_display_ = vaGetDisplayDRM(drm_fd_.get()); @@ -519,25 +517,10 @@ return false; } - // Set VA logging level and driver name, unless already set. - constexpr char libva_log_level_env[] = "LIBVA_MESSAGING_LEVEL"; - std::unique_ptr<base::Environment> env(base::Environment::Create()); - if (!env->HasVar(libva_log_level_env)) - env->SetVar(libva_log_level_env, "1"); + return true; +} -#if defined(USE_X11) - if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE) { - DCHECK(!features::IsUsingOzonePlatform()); - constexpr char libva_driver_impl_env[] = "LIBVA_DRIVER_NAME"; - // TODO(crbug/1116703) The libva intel-media driver has a known segfault in - // vaPutSurface, so until this is fixed, fall back to the i965 driver. There - // is discussion of the issue here: - // https://github.com/intel/media-driver/issues/818 - if (!env->HasVar(libva_driver_impl_env)) - env->SetVar(libva_driver_impl_env, "i965"); - } -#endif // USE_X11 - +bool VADisplayState::InitializeVaDriver_Locked() { // The VAAPI version. int major_version, minor_version; VAStatus va_res = vaInitialize(va_display_, &major_version, &minor_version); @@ -545,9 +528,6 @@ LOG(ERROR) << "vaInitialize failed: " << vaErrorStr(va_res); return false; } - - va_initialized_ = true; - const std::string va_vendor_string = vaQueryVendorString(va_display_); DLOG_IF(WARNING, va_vendor_string.empty()) << "Vendor string empty or error reading."; @@ -555,6 +535,8 @@ << va_vendor_string; implementation_type_ = VendorStringToImplementationType(va_vendor_string); + va_initialized_ = true; + // The VAAPI version is determined from what is loaded on the system by // calling vaInitialize(). Since the libva is now ABI-compatible, relax the // version check which helps in upgrading the libva, without breaking any @@ -571,6 +553,45 @@ return true; } +bool VADisplayState::InitializeOnce() { + static_assert( + VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 1), + "Requires VA-API >= 1.1.0"); + + // Set VA logging level, unless already set. + constexpr char libva_log_level_env[] = "LIBVA_MESSAGING_LEVEL"; + std::unique_ptr<base::Environment> env(base::Environment::Create()); + if (!env->HasVar(libva_log_level_env)) + env->SetVar(libva_log_level_env, "1"); + + if (!InitializeVaDisplay_Locked() || !InitializeVaDriver_Locked()) + return false; + +#if defined(USE_X11) + if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE && + implementation_type_ == VAImplementation::kIntelIHD) { + DCHECK(!features::IsUsingOzonePlatform()); + constexpr char libva_driver_impl_env[] = "LIBVA_DRIVER_NAME"; + // TODO(crbug/1116703) The libva intel-media driver has a known segfault in + // vaPutSurface, so until this is fixed, fall back to the i965 driver. There + // is discussion of the issue here: + // https://github.com/intel/media-driver/issues/818 + if (!env->HasVar(libva_driver_impl_env)) + env->SetVar(libva_driver_impl_env, "i965"); + + // Re-initialize with the new driver. + va_display_ = nullptr; + va_initialized_ = false; + implementation_type_ = VAImplementation::kInvalid; + + if (!InitializeVaDisplay_Locked() || !InitializeVaDriver_Locked()) + return false; + } +#endif // USE_X11 + + return true; +} + VAStatus VADisplayState::Deinitialize() { base::AutoLock auto_lock(va_lock_); VAStatus va_res = VA_STATUS_SUCCESS;
diff --git a/net/dns/address_sorter_posix_unittest.cc b/net/dns/address_sorter_posix_unittest.cc index 35053c7..a96abce2 100644 --- a/net/dns/address_sorter_posix_unittest.cc +++ b/net/dns/address_sorter_posix_unittest.cc
@@ -155,6 +155,7 @@ std::unique_ptr<TransportClientSocket> CreateTransportClientSocket( const AddressList&, std::unique_ptr<SocketPerformanceWatcher>, + net::NetworkQualityEstimator*, NetLog*, const NetLogSource&) override { NOTIMPLEMENTED();
diff --git a/net/dns/dns_socket_allocator.cc b/net/dns/dns_socket_allocator.cc index 0c1c9245..a2928124 100644 --- a/net/dns/dns_socket_allocator.cc +++ b/net/dns/dns_socket_allocator.cc
@@ -68,8 +68,12 @@ const NetLogSource& source) { DCHECK_LT(server_index, nameservers_.size()); + // TODO(https://crbug.com/1123197): Pass a non-null NetworkQualityEstimator. + NetworkQualityEstimator* network_quality_estimator = nullptr; + return socket_factory_->CreateTransportClientSocket( - AddressList(nameservers_[server_index]), nullptr, net_log_, source); + AddressList(nameservers_[server_index]), nullptr, + network_quality_estimator, net_log_, source); } } // namespace net
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index 4e2dd0b..db039ef 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc
@@ -680,10 +680,13 @@ int FtpNetworkTransaction::DoCtrlConnect() { next_state_ = STATE_CTRL_CONNECT_COMPLETE; + // TODO(https://crbug.com/1123197): Pass a non-null NetworkQualityEstimator. + NetworkQualityEstimator* network_quality_estimator = nullptr; + DCHECK(resolve_request_ && resolve_request_->GetAddressResults()); ctrl_socket_ = socket_factory_->CreateTransportClientSocket( resolve_request_->GetAddressResults().value(), nullptr, - net_log_.net_log(), net_log_.source()); + network_quality_estimator, net_log_.net_log(), net_log_.source()); net_log_.AddEventReferencingSource(NetLogEventType::FTP_CONTROL_CONNECTION, ctrl_socket_->NetLog().source()); return ctrl_socket_->Connect(io_callback_); @@ -1235,8 +1238,12 @@ return Stop(rv); data_address = AddressList::CreateFromIPAddress( ip_endpoint.address(), data_connection_port_); + // TODO(https://crbug.com/1123197): Pass a non-null NetworkQualityEstimator. + NetworkQualityEstimator* network_quality_estimator = nullptr; + data_socket_ = socket_factory_->CreateTransportClientSocket( - data_address, nullptr, net_log_.net_log(), net_log_.source()); + data_address, nullptr, network_quality_estimator, net_log_.net_log(), + net_log_.source()); net_log_.AddEventReferencingSource(NetLogEventType::FTP_DATA_CONNECTION, data_socket_->NetLog().source()); return data_socket_->Connect(io_callback_);
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc index 833cc54..4101e82 100644 --- a/net/server/http_server_unittest.cc +++ b/net/server/http_server_unittest.cc
@@ -64,7 +64,8 @@ int ConnectAndWait(const IPEndPoint& address) { AddressList addresses(address); NetLogSource source; - socket_.reset(new TCPClientSocket(addresses, nullptr, nullptr, source)); + socket_.reset( + new TCPClientSocket(addresses, nullptr, nullptr, nullptr, source)); TestCompletionCallback callback; int rv = socket_->Connect(callback.callback());
diff --git a/net/socket/client_socket_factory.cc b/net/socket/client_socket_factory.cc index 1a165c8d..875861af 100644 --- a/net/socket/client_socket_factory.cc +++ b/net/socket/client_socket_factory.cc
@@ -37,10 +37,12 @@ std::unique_ptr<TransportClientSocket> CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, NetLog* net_log, const NetLogSource& source) override { return std::make_unique<TCPClientSocket>( - addresses, std::move(socket_performance_watcher), net_log, source); + addresses, std::move(socket_performance_watcher), + network_quality_estimator, net_log, source); } std::unique_ptr<SSLClientSocket> CreateSSLClientSocket(
diff --git a/net/socket/client_socket_factory.h b/net/socket/client_socket_factory.h index 4d70620..6965261a4 100644 --- a/net/socket/client_socket_factory.h +++ b/net/socket/client_socket_factory.h
@@ -29,6 +29,7 @@ class ProxyDelegate; class ProxyServer; class HttpAuthController; +class NetworkQualityEstimator; // An interface used to instantiate StreamSocket objects. Used to facilitate // testing code with mock socket implementations. @@ -43,9 +44,13 @@ NetLog* net_log, const NetLogSource& source) = 0; + // |network_quality_estimator| is optional. If not specified, the network + // quality will not be considered when determining TCP connect handshake + // timeouts, or when histogramming the handshake duration. virtual std::unique_ptr<TransportClientSocket> CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, NetLog* net_log, const NetLogSource& source) = 0;
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 29e27ab..1f41a499 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -241,6 +241,7 @@ const AddressList& addresses, std::unique_ptr< SocketPerformanceWatcher> /* socket_performance_watcher */, + NetworkQualityEstimator* /* network_quality_estimator */, NetLog* /* net_log */, const NetLogSource& /*source*/) override { allocation_count_++; @@ -375,7 +376,7 @@ int ConnectInternal() override { AddressList ignored; client_socket_factory_->CreateTransportClientSocket( - ignored, nullptr, nullptr, NetLogSource()); + ignored, nullptr, nullptr, nullptr, NetLogSource()); switch (job_type_) { case kMockJob: return DoConnect(true /* successful */, false /* sync */,
diff --git a/net/socket/fuzzed_socket_factory.cc b/net/socket/fuzzed_socket_factory.cc index fb2d12c..fc7da365 100644 --- a/net/socket/fuzzed_socket_factory.cc +++ b/net/socket/fuzzed_socket_factory.cc
@@ -123,6 +123,7 @@ FuzzedSocketFactory::CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, NetLog* net_log, const NetLogSource& source) { std::unique_ptr<FuzzedSocket> socket(
diff --git a/net/socket/fuzzed_socket_factory.h b/net/socket/fuzzed_socket_factory.h index c0dd972d..5d1940a 100644 --- a/net/socket/fuzzed_socket_factory.h +++ b/net/socket/fuzzed_socket_factory.h
@@ -42,6 +42,7 @@ std::unique_ptr<TransportClientSocket> CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, NetLog* net_log, const NetLogSource& source) override;
diff --git a/net/socket/sequenced_socket_data_unittest.cc b/net/socket/sequenced_socket_data_unittest.cc index f70c3a7..0586b15 100644 --- a/net/socket/sequenced_socket_data_unittest.cc +++ b/net/socket/sequenced_socket_data_unittest.cc
@@ -250,7 +250,8 @@ socket_factory_.AddSocketDataProvider(data_.get()); sock_ = socket_factory_.CreateTransportClientSocket( AddressList(IPEndPoint(IPAddress::IPv4Localhost(), 443)), - nullptr /* socket_performance_watcher */, nullptr /* net_log */, + nullptr /* socket_performance_watcher */, + nullptr /* network_quality_estimator */, nullptr /* net_log */, NetLogSource()); TestCompletionCallback callback; EXPECT_EQ(OK, sock_->Connect(callback.callback()));
diff --git a/net/socket/socket_bio_adapter_unittest.cc b/net/socket/socket_bio_adapter_unittest.cc index f45056b..8c367f8b 100644 --- a/net/socket/socket_bio_adapter_unittest.cc +++ b/net/socket/socket_bio_adapter_unittest.cc
@@ -50,7 +50,7 @@ data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); factory_.AddSocketDataProvider(data); std::unique_ptr<StreamSocket> socket = factory_.CreateTransportClientSocket( - AddressList(), nullptr, nullptr, NetLogSource()); + AddressList(), nullptr, nullptr, nullptr, NetLogSource()); CHECK_EQ(OK, socket->Connect(CompletionOnceCallback())); return socket; }
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 4a55738b..ce05c02 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc
@@ -791,6 +791,7 @@ MockClientSocketFactory::CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, NetLog* net_log, const NetLogSource& source) { SocketDataProvider* data_provider = mock_tcp_data_.GetNextWithoutAsserting(); @@ -2179,7 +2180,7 @@ last_request_priority_ = priority; std::unique_ptr<StreamSocket> socket = client_socket_factory_->CreateTransportClientSocket( - AddressList(), nullptr, net_log.net_log(), NetLogSource()); + AddressList(), nullptr, nullptr, net_log.net_log(), NetLogSource()); MockConnectJob* job = new MockConnectJob( std::move(socket), handle, socket_tag, std::move(callback), priority); job_list_.push_back(base::WrapUnique(job)); @@ -2339,11 +2340,13 @@ MockTaggingClientSocketFactory::CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, NetLog* net_log, const NetLogSource& source) { std::unique_ptr<MockTaggingStreamSocket> socket(new MockTaggingStreamSocket( MockClientSocketFactory::CreateTransportClientSocket( - addresses, std::move(socket_performance_watcher), net_log, source))); + addresses, std::move(socket_performance_watcher), + network_quality_estimator, net_log, source))); tcp_socket_ = socket.get(); return std::move(socket); }
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 387ab63..31244509 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h
@@ -689,6 +689,7 @@ std::unique_ptr<TransportClientSocket> CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, NetLog* net_log, const NetLogSource& source) override; std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( @@ -1403,6 +1404,7 @@ std::unique_ptr<TransportClientSocket> CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, NetLog* net_log, const NetLogSource& source) override;
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 67fe1435..9063ef48 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc
@@ -835,7 +835,7 @@ const HostPortPair& host_port_pair, int* result) { std::unique_ptr<StreamSocket> transport( - new TCPClientSocket(addr_, nullptr, &log_, NetLogSource())); + new TCPClientSocket(addr_, nullptr, nullptr, &log_, NetLogSource())); int rv = callback_.GetResult(transport->Connect(callback_.callback())); if (rv != OK) { LOG(ERROR) << "Could not connect to SpawnedTestServer"; @@ -938,10 +938,12 @@ std::unique_ptr<TransportClientSocket> CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, NetLog* net_log, const NetLogSource& source) override { return factory_->CreateTransportClientSocket( - addresses, std::move(socket_performance_watcher), net_log, source); + addresses, std::move(socket_performance_watcher), + network_quality_estimator, net_log, source); } std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( @@ -1139,7 +1141,7 @@ CHECK(spawned_test_server()); std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<FakeBlockingStreamSocket> transport( new FakeBlockingStreamSocket(std::move(real_transport))); int rv = callback->GetResult(transport->Connect(callback->callback())); @@ -1333,7 +1335,7 @@ ssl_config.early_data_enabled = early_data_enabled; real_transport_.reset( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<FakeBlockingStreamSocket> transport( new FakeBlockingStreamSocket(std::move(real_transport_))); FakeBlockingStreamSocket* raw_transport = transport.get(); @@ -1469,7 +1471,7 @@ TestCompletionCallback callback; RecordingTestNetLog log; std::unique_ptr<StreamSocket> transport( - new TCPClientSocket(addr(), nullptr, &log, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, &log, NetLogSource())); int rv = callback.GetResult(transport->Connect(callback.callback())); EXPECT_THAT(rv, IsOk()); @@ -1546,8 +1548,8 @@ ssl_client_session_cache_.get(), nullptr); TestCompletionCallback callback; - auto transport = - std::make_unique<TCPClientSocket>(addr(), nullptr, &log_, NetLogSource()); + auto transport = std::make_unique<TCPClientSocket>(addr(), nullptr, nullptr, + &log_, NetLogSource()); int rv = callback.GetResult(transport->Connect(callback.callback())); ASSERT_THAT(rv, IsOk()); @@ -1670,7 +1672,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); EXPECT_EQ(0, transport->GetTotalReceivedBytes()); int rv = callback.GetResult(transport->Connect(callback.callback())); @@ -1727,7 +1729,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<SynchronousErrorStreamSocket> transport( new SynchronousErrorStreamSocket(std::move(real_transport))); int rv = callback.GetResult(transport->Connect(callback.callback())); @@ -1754,7 +1756,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<SynchronousErrorStreamSocket> transport( new SynchronousErrorStreamSocket(std::move(real_transport))); int rv = callback.GetResult(transport->Connect(callback.callback())); @@ -1804,7 +1806,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); // Note: |error_socket|'s ownership is handed to |transport|, but a pointer // is retained in order to configure additional errors. std::unique_ptr<SynchronousErrorStreamSocket> error_socket( @@ -1869,7 +1871,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); // Note: intermediate sockets' ownership are handed to |sock|, but a pointer // is retained in order to query them. std::unique_ptr<SynchronousErrorStreamSocket> error_socket( @@ -1971,7 +1973,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); // Note: |error_socket|'s ownership is handed to |transport|, but a pointer // is retained in order to configure additional errors. std::unique_ptr<SynchronousErrorStreamSocket> error_socket( @@ -2055,7 +2057,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); // Note: |error_socket|'s ownership is handed to |transport|, but a pointer // is retained in order to configure additional errors. std::unique_ptr<SynchronousErrorStreamSocket> error_socket( @@ -2144,7 +2146,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<SynchronousErrorStreamSocket> transport( new SynchronousErrorStreamSocket(std::move(real_transport))); int rv = callback.GetResult(transport->Connect(callback.callback())); @@ -2170,7 +2172,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<SynchronousErrorStreamSocket> transport( new SynchronousErrorStreamSocket(std::move(real_transport))); int rv = callback.GetResult(transport->Connect(callback.callback())); @@ -2201,7 +2203,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<SynchronousErrorStreamSocket> error_socket( new SynchronousErrorStreamSocket(std::move(real_transport))); SynchronousErrorStreamSocket* raw_error_socket = error_socket.get(); @@ -2288,7 +2290,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<ReadBufferingStreamSocket> transport( new ReadBufferingStreamSocket(std::move(real_transport))); ReadBufferingStreamSocket* raw_transport = transport.get(); @@ -2364,7 +2366,7 @@ RecordingTestNetLog log; log.SetObserverCaptureMode(NetLogCaptureMode::kEverything); std::unique_ptr<StreamSocket> transport( - new TCPClientSocket(addr(), nullptr, &log, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, &log, NetLogSource())); int rv = callback.GetResult(transport->Connect(callback.callback())); EXPECT_THAT(rv, IsOk()); @@ -2472,7 +2474,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); int rv = callback.GetResult(transport->Connect(callback.callback())); EXPECT_THAT(rv, IsOk()); @@ -3031,7 +3033,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<FakeBlockingStreamSocket> transport( new FakeBlockingStreamSocket(std::move(real_transport))); FakeBlockingStreamSocket* raw_transport = transport.get(); @@ -3093,7 +3095,7 @@ // Using a different HostPortPair uses a different session cache key. std::unique_ptr<StreamSocket> transport( - new TCPClientSocket(addr(), nullptr, &log_, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, &log_, NetLogSource())); TestCompletionCallback callback; ASSERT_THAT(callback.GetResult(transport->Connect(callback.callback())), IsOk()); @@ -3151,7 +3153,7 @@ SCOPED_TRACE(i); std::unique_ptr<StreamSocket> transport( - new TCPClientSocket(addr(), nullptr, &log_, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, &log_, NetLogSource())); TestCompletionCallback callback; ASSERT_THAT(callback.GetResult(transport->Connect(callback.callback())), IsOk()); @@ -4639,7 +4641,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<FakeBlockingStreamSocket> transport( new FakeBlockingStreamSocket(std::move(real_transport))); FakeBlockingStreamSocket* raw_transport = transport.get(); @@ -4674,7 +4676,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<FakeBlockingStreamSocket> transport( new FakeBlockingStreamSocket(std::move(real_transport))); FakeBlockingStreamSocket* raw_transport = transport.get(); @@ -4723,7 +4725,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<FakeBlockingStreamSocket> transport( new FakeBlockingStreamSocket(std::move(real_transport))); FakeBlockingStreamSocket* raw_transport = transport.get(); @@ -4773,7 +4775,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<FakeBlockingStreamSocket> transport( new FakeBlockingStreamSocket(std::move(real_transport))); FakeBlockingStreamSocket* raw_transport = transport.get(); @@ -4825,7 +4827,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<FakeBlockingStreamSocket> transport( new FakeBlockingStreamSocket(std::move(real_transport))); FakeBlockingStreamSocket* raw_transport = transport.get(); @@ -4872,7 +4874,7 @@ TestCompletionCallback callback; std::unique_ptr<StreamSocket> real_transport( - new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, nullptr, NetLogSource())); std::unique_ptr<FakeBlockingStreamSocket> transport( new FakeBlockingStreamSocket(std::move(real_transport))); FakeBlockingStreamSocket* raw_transport = transport.get(); @@ -5331,7 +5333,7 @@ TestCompletionCallback client_callback; std::unique_ptr<TCPClientSocket> client_transport(new TCPClientSocket( - AddressList(server_address), nullptr, nullptr, NetLogSource())); + AddressList(server_address), nullptr, nullptr, nullptr, NetLogSource())); int client_rv = client_transport->Connect(client_callback.callback()); EXPECT_THAT(server_callback.GetResult(server_rv), IsOk()); @@ -5433,7 +5435,7 @@ TestCompletionCallback client_callback; auto client_transport = std::make_unique<TCPClientSocket>( - AddressList(server_address), nullptr, nullptr, NetLogSource()); + AddressList(server_address), nullptr, nullptr, nullptr, NetLogSource()); int client_rv = client_transport->Connect(client_callback.callback()); ASSERT_THAT(server_callback.GetResult(server_rv), IsOk()); @@ -5495,7 +5497,7 @@ RecordingTestNetLog log; std::unique_ptr<StreamSocket> transport( - new TCPClientSocket(addr(), nullptr, &log, NetLogSource())); + new TCPClientSocket(addr(), nullptr, nullptr, &log, NetLogSource())); MockTaggingStreamSocket* tagging_sock = new MockTaggingStreamSocket(std::move(transport));
diff --git a/net/socket/tcp_client_socket.cc b/net/socket/tcp_client_socket.cc index 551fc96..b822d3ed 100644 --- a/net/socket/tcp_client_socket.cc +++ b/net/socket/tcp_client_socket.cc
@@ -30,6 +30,7 @@ TCPClientSocket::TCPClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, net::NetLog* net_log, const net::NetLogSource& source) : TCPClientSocket( @@ -38,14 +39,18 @@ source), addresses, -1 /* current_address_index */, - nullptr /* bind_address */) {} + nullptr /* bind_address */, + network_quality_estimator) {} TCPClientSocket::TCPClientSocket(std::unique_ptr<TCPSocket> connected_socket, const IPEndPoint& peer_address) : TCPClientSocket(std::move(connected_socket), AddressList(peer_address), 0 /* current_address_index */, - nullptr /* bind_address */) {} + nullptr /* bind_address */, + // TODO(https://crbug.com/1123197: Pass non-null + // NetworkQualityEstimator + nullptr /* network_quality_estimator */) {} TCPClientSocket::~TCPClientSocket() { Disconnect(); @@ -57,10 +62,11 @@ std::unique_ptr<TCPClientSocket> TCPClientSocket::CreateFromBoundSocket( std::unique_ptr<TCPSocket> bound_socket, const AddressList& addresses, - const IPEndPoint& bound_address) { + const IPEndPoint& bound_address, + NetworkQualityEstimator* network_quality_estimator) { return base::WrapUnique(new TCPClientSocket( std::move(bound_socket), addresses, -1 /* current_address_index */, - std::make_unique<IPEndPoint>(bound_address))); + std::make_unique<IPEndPoint>(bound_address), network_quality_estimator)); } int TCPClientSocket::Bind(const IPEndPoint& address) { @@ -131,10 +137,12 @@ return rv; } -TCPClientSocket::TCPClientSocket(std::unique_ptr<TCPSocket> socket, - const AddressList& addresses, - int current_address_index, - std::unique_ptr<IPEndPoint> bind_address) +TCPClientSocket::TCPClientSocket( + std::unique_ptr<TCPSocket> socket, + const AddressList& addresses, + int current_address_index, + std::unique_ptr<IPEndPoint> bind_address, + NetworkQualityEstimator* network_quality_estimator) : socket_(std::move(socket)), bind_address_(std::move(bind_address)), addresses_(addresses),
diff --git a/net/socket/tcp_client_socket.h b/net/socket/tcp_client_socket.h index 306c6b35..7efea43e 100644 --- a/net/socket/tcp_client_socket.h +++ b/net/socket/tcp_client_socket.h
@@ -44,6 +44,7 @@ class NetLog; struct NetLogSource; class SocketPerformanceWatcher; +class NetworkQualityEstimator; // A client socket that uses TCP as the transport layer. class NET_EXPORT TCPClientSocket : public TransportClientSocket, @@ -55,6 +56,7 @@ TCPClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, + NetworkQualityEstimator* network_quality_estimator, net::NetLog* net_log, const net::NetLogSource& source); @@ -67,7 +69,8 @@ static std::unique_ptr<TCPClientSocket> CreateFromBoundSocket( std::unique_ptr<TCPSocket> bound_socket, const AddressList& addresses, - const IPEndPoint& bound_address); + const IPEndPoint& bound_address, + NetworkQualityEstimator* network_quality_estimator); ~TCPClientSocket() override; @@ -135,7 +138,8 @@ TCPClientSocket(std::unique_ptr<TCPSocket> socket, const AddressList& addresses, int current_address_index, - std::unique_ptr<IPEndPoint> bind_address); + std::unique_ptr<IPEndPoint> bind_address, + NetworkQualityEstimator* network_quality_estimator); // A helper method shared by Read() and ReadIfReady(). If |read_if_ready| is // set to true, ReadIfReady() will be used instead of Read().
diff --git a/net/socket/tcp_client_socket_unittest.cc b/net/socket/tcp_client_socket_unittest.cc index 69b62f0..e1797ca2 100644 --- a/net/socket/tcp_client_socket_unittest.cc +++ b/net/socket/tcp_client_socket_unittest.cc
@@ -93,7 +93,7 @@ ASSERT_THAT(server_socket->GetLocalAddress(&server_address), IsOk()); *client_socket = std::make_unique<TCPClientSocket>( - AddressList(server_address), nullptr, nullptr, NetLogSource()); + AddressList(server_address), nullptr, nullptr, nullptr, NetLogSource()); EXPECT_THAT((*client_socket)->Bind(IPEndPoint(local_address, 0)), IsOk()); @@ -135,7 +135,7 @@ IPEndPoint server_address; ASSERT_THAT(server.GetLocalAddress(&server_address), IsOk()); - TCPClientSocket socket(AddressList(server_address), nullptr, nullptr, + TCPClientSocket socket(AddressList(server_address), nullptr, nullptr, nullptr, NetLogSource()); EXPECT_THAT(socket.Bind(IPEndPoint(lo_address, 0)), IsOk()); @@ -167,7 +167,7 @@ TEST_F(TCPClientSocketTest, BindLoopbackToExternal) { IPAddress external_ip(72, 14, 213, 105); TCPClientSocket socket(AddressList::CreateFromIPAddress(external_ip, 80), - nullptr, nullptr, NetLogSource()); + nullptr, nullptr, nullptr, NetLogSource()); EXPECT_THAT(socket.Bind(IPEndPoint(IPAddress::IPv4Localhost(), 0)), IsOk()); @@ -193,7 +193,7 @@ IPEndPoint server_address; ASSERT_THAT(server.GetLocalAddress(&server_address), IsOk()); - TCPClientSocket socket(AddressList(server_address), nullptr, nullptr, + TCPClientSocket socket(AddressList(server_address), nullptr, nullptr, nullptr, NetLogSource()); EXPECT_THAT(socket.Bind(IPEndPoint(IPAddress::IPv4Localhost(), 0)), IsOk()); @@ -211,7 +211,7 @@ IPEndPoint server_address; ASSERT_THAT(server.GetLocalAddress(&server_address), IsOk()); - TCPClientSocket socket(AddressList(server_address), nullptr, nullptr, + TCPClientSocket socket(AddressList(server_address), nullptr, nullptr, nullptr, NetLogSource()); EXPECT_FALSE(socket.WasEverUsed()); @@ -291,7 +291,7 @@ TCPClientSocket socket( AddressList::CreateFromIPAddressList(ip_list, "example.com"), - std::move(watcher), nullptr, NetLogSource()); + std::move(watcher), nullptr, nullptr, NetLogSource()); EXPECT_THAT(socket.Bind(IPEndPoint(IPAddress::IPv4Localhost(), 0)), IsOk()); @@ -319,7 +319,7 @@ AddressList addr_list; ASSERT_TRUE(test_server.GetAddressList(&addr_list)); - TCPClientSocket s(addr_list, NULL, NULL, NetLogSource()); + TCPClientSocket s(addr_list, nullptr, nullptr, nullptr, NetLogSource()); // Verify TCP connect packets are tagged and counted properly. int32_t tag_val1 = 0x12345678; @@ -376,7 +376,7 @@ AddressList addr_list; ASSERT_TRUE(test_server.GetAddressList(&addr_list)); - TCPClientSocket s(addr_list, NULL, NULL, NetLogSource()); + TCPClientSocket s(addr_list, nullptr, nullptr, nullptr, NetLogSource()); // Connect socket. TestCompletionCallback connect_callback; @@ -430,7 +430,7 @@ IPEndPoint server_address; ASSERT_THAT(server.GetLocalAddress(&server_address), IsOk()); - TCPClientSocket socket(AddressList(server_address), nullptr, nullptr, + TCPClientSocket socket(AddressList(server_address), nullptr, nullptr, nullptr, NetLogSource()); EXPECT_THAT(socket.Bind(IPEndPoint(lo_address, 0)), IsOk()); @@ -471,6 +471,7 @@ const net::NetLogSource& source) : TCPClientSocket(addresses, std::move(socket_performance_watcher), + nullptr, net_log, source) {}
diff --git a/net/socket/tcp_server_socket_unittest.cc b/net/socket/tcp_server_socket_unittest.cc index 12bd035..05b2528 100644 --- a/net/socket/tcp_server_socket_unittest.cc +++ b/net/socket/tcp_server_socket_unittest.cc
@@ -74,7 +74,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); TestCompletionCallback accept_callback; @@ -111,7 +111,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); EXPECT_THAT(connect_callback.GetResult(connect_result), IsOk()); @@ -137,7 +137,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); EXPECT_THAT(connect_callback.GetResult(connect_result), IsOk()); @@ -167,12 +167,12 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); TestCompletionCallback connect_callback2; TCPClientSocket connecting_socket2(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result2 = connecting_socket2.Connect(connect_callback2.callback()); @@ -209,7 +209,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); TestCompletionCallback accept_callback; @@ -237,7 +237,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); TestCompletionCallback accept_callback;
diff --git a/net/socket/tcp_socket_unittest.cc b/net/socket/tcp_socket_unittest.cc index 5205c77..c211c6b 100644 --- a/net/socket/tcp_socket_unittest.cc +++ b/net/socket/tcp_socket_unittest.cc
@@ -135,7 +135,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); EXPECT_THAT(connect_callback.GetResult(connect_result), IsOk()); @@ -236,7 +236,7 @@ // TODO(yzshen): Switch to use TCPSocket when it supports client socket // operations. TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); TestCompletionCallback accept_callback; @@ -273,7 +273,7 @@ // TODO(yzshen): Switch to use TCPSocket when it supports client socket // operations. TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); TestCompletionCallback accept_callback; @@ -329,12 +329,12 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); TestCompletionCallback connect_callback2; TCPClientSocket connecting_socket2(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result2 = connecting_socket2.Connect(connect_callback2.callback()); @@ -368,7 +368,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); int connect_result = connecting_socket.Connect(connect_callback.callback()); TestCompletionCallback accept_callback; @@ -610,7 +610,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); // Immediately after creation, the socket should not be connected. EXPECT_FALSE(connecting_socket.IsConnected()); @@ -689,7 +689,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); connecting_socket.SetBeforeConnectCallback(base::BindLambdaForTesting([&] { EXPECT_FALSE(connecting_socket.IsConnected()); @@ -734,7 +734,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); // Set a callback that returns a nonsensical error, and make sure it's // returned. @@ -762,7 +762,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); // Non-connected sockets should not be able to set KeepAlive. ASSERT_FALSE(connecting_socket.IsConnected()); @@ -794,7 +794,7 @@ TestCompletionCallback connect_callback; TCPClientSocket connecting_socket(local_address_list(), nullptr, nullptr, - NetLogSource()); + nullptr, NetLogSource()); // Non-connected sockets should not be able to set NoDelay. ASSERT_FALSE(connecting_socket.IsConnected());
diff --git a/net/socket/transport_client_socket_pool_test_util.cc b/net/socket/transport_client_socket_pool_test_util.cc index cdaecf2..eafee64 100644 --- a/net/socket/transport_client_socket_pool_test_util.cc +++ b/net/socket/transport_client_socket_pool_test_util.cc
@@ -392,6 +392,7 @@ MockTransportClientSocketFactory::CreateTransportClientSocket( const AddressList& addresses, std::unique_ptr<SocketPerformanceWatcher> /* socket_performance_watcher */, + NetworkQualityEstimator* /* network_quality_estimator */, NetLog* /* net_log */, const NetLogSource& /* source */) { allocation_count_++;
diff --git a/net/socket/transport_client_socket_pool_test_util.h b/net/socket/transport_client_socket_pool_test_util.h index e545f7d..f6dfb7b 100644 --- a/net/socket/transport_client_socket_pool_test_util.h +++ b/net/socket/transport_client_socket_pool_test_util.h
@@ -83,6 +83,7 @@ const AddressList& addresses, std::unique_ptr< SocketPerformanceWatcher> /* socket_performance_watcher */, + NetworkQualityEstimator* /* network_quality_estimator */, NetLog* /* net_log */, const NetLogSource& /* source */) override;
diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc index b7cf052f..efcd1600 100644 --- a/net/socket/transport_client_socket_unittest.cc +++ b/net/socket/transport_client_socket_unittest.cc
@@ -118,8 +118,8 @@ AddressList addr = AddressList::CreateFromIPAddress( IPAddress::IPv4Localhost(), listen_port_); - sock_ = socket_factory_->CreateTransportClientSocket(addr, nullptr, &net_log_, - NetLogSource()); + sock_ = socket_factory_->CreateTransportClientSocket( + addr, nullptr, nullptr, &net_log_, NetLogSource()); } int TransportClientSocketTest::DrainClientSocket(
diff --git a/net/socket/transport_connect_job.cc b/net/socket/transport_connect_job.cc index 14aa2783..8d25667e 100644 --- a/net/socket/transport_connect_job.cc +++ b/net/socket/transport_connect_job.cc
@@ -323,8 +323,8 @@ } transport_socket_ = client_socket_factory()->CreateTransportClientSocket( request_->GetAddressResults().value(), - std::move(socket_performance_watcher), net_log().net_log(), - net_log().source()); + std::move(socket_performance_watcher), network_quality_estimator(), + net_log().net_log(), net_log().source()); // If the list contains IPv6 and IPv4 addresses, and the first address // is IPv6, the IPv4 addresses will be tried as fallback addresses, per @@ -412,7 +412,7 @@ fallback_transport_socket_ = client_socket_factory()->CreateTransportClientSocket( *fallback_addresses_, std::move(socket_performance_watcher), - net_log().net_log(), net_log().source()); + network_quality_estimator(), net_log().net_log(), net_log().source()); fallback_connect_start_time_ = base::TimeTicks::Now(); int rv = fallback_transport_socket_->Connect(base::BindOnce( &TransportConnectJob::DoIPv6FallbackTransportConnectComplete,
diff --git a/net/socket/websocket_transport_connect_sub_job.cc b/net/socket/websocket_transport_connect_sub_job.cc index 40bbb3a..21c8a53 100644 --- a/net/socket/websocket_transport_connect_sub_job.cc +++ b/net/socket/websocket_transport_connect_sub_job.cc
@@ -238,8 +238,12 @@ // ConnectInterval. next_state_ = STATE_TRANSPORT_CONNECT_COMPLETE; AddressList one_address(CurrentAddress()); + // TODO(https://crbug.com/1123197): Pass a non-null NetworkQualityEstimator. + NetworkQualityEstimator* network_quality_estimator = nullptr; + transport_socket_ = client_socket_factory()->CreateTransportClientSocket( - one_address, nullptr, net_log().net_log(), net_log().source()); + one_address, nullptr, network_quality_estimator, net_log().net_log(), + net_log().source()); // This use of base::Unretained() is safe because transport_socket_ is // destroyed in the destructor. return transport_socket_->Connect(base::BindOnce(
diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc index 6508c1a3..295f8c2 100644 --- a/net/test/embedded_test_server/embedded_test_server_unittest.cc +++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc
@@ -299,7 +299,7 @@ std::unique_ptr<StreamSocket> socket = ClientSocketFactory::GetDefaultFactory()->CreateTransportClientSocket( - address_list, nullptr, &net_log, NetLogSource()); + address_list, nullptr, nullptr, &net_log, NetLogSource()); TestCompletionCallback callback; ASSERT_THAT(callback.GetResult(socket->Connect(callback.callback())), IsOk());
diff --git a/remoting/protocol/stream_packet_socket.cc b/remoting/protocol/stream_packet_socket.cc index ee71827..9580090 100644 --- a/remoting/protocol/stream_packet_socket.cc +++ b/remoting/protocol/stream_packet_socket.cc
@@ -153,7 +153,8 @@ } auto socket = std::make_unique<net::TCPClientSocket>( - net::AddressList(remote_endpoint), nullptr, nullptr, net::NetLogSource()); + net::AddressList(remote_endpoint), nullptr, nullptr, nullptr, + net::NetLogSource()); int result = socket->Bind(local_endpoint); if (result != net::OK) {
diff --git a/services/device/nfc/README.md b/services/device/nfc/README.md index cffded3..23d6ca58 100644 --- a/services/device/nfc/README.md +++ b/services/device/nfc/README.md
@@ -19,8 +19,7 @@ NDEFWriteOptions. The NDEFReader interface has the scan method to try to read data from any NFC tag -that comes within proximity. Once there is some data found to be matching the -filtering criteria provided by web developers in NDEFScanOptions, an +that comes within proximity. Once there is some data found an NDEFReadingEvent carrying the data will be dispatched to the NDEFReader. The most important classes for Android adaptation are
diff --git a/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java b/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java index 8e3fe97..67eba4c7 100644 --- a/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java +++ b/services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java
@@ -16,7 +16,6 @@ import android.nfc.TagLostException; import android.os.Process; import android.os.Vibrator; -import android.util.SparseArray; import org.chromium.base.Callback; import org.chromium.base.ContextUtils; @@ -25,8 +24,6 @@ import org.chromium.device.mojom.NdefErrorType; import org.chromium.device.mojom.NdefMessage; import org.chromium.device.mojom.NdefRecord; -import org.chromium.device.mojom.NdefRecordTypeCategory; -import org.chromium.device.mojom.NdefScanOptions; import org.chromium.device.mojom.NdefWriteOptions; import org.chromium.device.mojom.Nfc; import org.chromium.device.mojom.NfcClient; @@ -97,14 +94,7 @@ */ private NfcClient mClient; - /** - * Map of watchId <-> NdefScanOptions. All NdefScanOptions are matched against tag that is in - * proximity, when match algorithm (@see #matchesWatchOptions) returns true, watcher with - * corresponding ID would be notified using NfcClient interface. - * @see NfcClient#onWatch(int[] id, String serial_number, NdefMessage message) - */ - private final SparseArray<NdefScanOptions> mWatchers = new SparseArray<>(); - + private final List<Integer> mWatchIds = new ArrayList<Integer>(); /** * Vibrator. @see android.os.Vibrator */ @@ -173,8 +163,8 @@ /** * Sets NfcClient. NfcClient interface is used to notify mojo NFC service client when NFC - * device is in proximity and has NdefMessage that matches NdefScanOptions criteria. - * @see Nfc#watch(NdefScanOptions options, int id, WatchResponse callback) + * device is in proximity and has NdefMessage. + * @see Nfc#watch(int id, WatchResponse callback) * * @param client @see NfcClient */ @@ -232,27 +222,25 @@ } /** - * Watch method allows to set filtering criteria for NdefMessages that are found when NFC device - * is within proximity. When NdefMessage that matches NdefScanOptions is found, it is passed to - * NfcClient interface together with corresponding watch ID. + * When NdefMessages that are found when NFC device is within proximity, it + * is passed to NfcClient interface together with corresponding watch ID. * @see NfcClient#onWatch(int[] id, String serial_number, NdefMessage message) * - * @param options used to filter NdefMessages, @see NdefScanOptions. * @param id request ID from Blink which will be the watch ID if succeeded. * @param callback that is used to notify caller when watch() is completed. */ @Override - public void watch(NdefScanOptions options, int id, WatchResponse callback) { + public void watch(int id, WatchResponse callback) { if (!checkIfReady(callback)) return; // We received a duplicate |id| here that should never happen, in such a case we should // report a bad message to Mojo but unfortunately Mojo bindings for Java does not support // this feature yet. So, we just passes back a generic error instead. - if (mWatchers.indexOfKey(id) >= 0) { + if (mWatchIds.contains(id)) { callback.call(createError(NdefErrorType.NOT_READABLE, "Cannot start because the received scan request is duplicate.")); return; } - mWatchers.put(id, options); + mWatchIds.add(id); callback.call(null); enableReaderModeIfNeeded(); processPendingWatchOperations(); @@ -268,11 +256,11 @@ public void cancelWatch(int id, CancelWatchResponse callback) { if (!checkIfReady(callback)) return; - if (mWatchers.indexOfKey(id) < 0) { + if (!mWatchIds.contains(id)) { callback.call( createError(NdefErrorType.NOT_FOUND, "No pending scan operation to cancel.")); } else { - mWatchers.remove(id); + mWatchIds.remove(mWatchIds.indexOf(id)); callback.call(null); disableReaderModeIfNeeded(); } @@ -287,11 +275,11 @@ public void cancelAllWatches(CancelAllWatchesResponse callback) { if (!checkIfReady(callback)) return; - if (mWatchers.size() == 0) { + if (mWatchIds.size() == 0) { callback.call( createError(NdefErrorType.NOT_FOUND, "No pending scan operation to cancel.")); } else { - mWatchers.clear(); + mWatchIds.clear(); callback.call(null); disableReaderModeIfNeeded(); } @@ -432,7 +420,7 @@ if (mReaderCallbackHandler != null || mActivity == null || mNfcAdapter == null) return; // Do not enable reader mode, if there are no active push / watch operations. - if (mPendingPushOperation == null && mWatchers.size() == 0) return; + if (mPendingPushOperation == null && mWatchIds.size() == 0) return; mReaderCallbackHandler = new ReaderCallbackHandler(this); mNfcAdapter.enableReaderMode(mActivity, mReaderCallbackHandler, @@ -462,7 +450,7 @@ * whenever necessary. */ private void disableReaderModeIfNeeded() { - if (mPendingPushOperation == null && mWatchers.size() == 0) { + if (mPendingPushOperation == null && mWatchIds.size() == 0) { disableReaderMode(); } } @@ -531,7 +519,7 @@ * Reads NdefMessage from a tag and forwards message to matching method. */ private void processPendingWatchOperations() { - if (mTagHandler == null || mClient == null || mWatchers.size() == 0) return; + if (mTagHandler == null || mClient == null || mWatchIds.size() == 0) return; if (mTagHandler.isTagOutOfRange()) { mTagHandler = null; @@ -546,11 +534,11 @@ // Let's create one with no records so that watchers can be notified. NdefMessage webNdefMessage = new NdefMessage(); webNdefMessage.data = new NdefRecord[0]; - notifyMatchingWatchers(webNdefMessage); + notifyWatchers(webNdefMessage); return; } NdefMessage webNdefMessage = NdefMessageUtils.toNdefMessage(message); - notifyMatchingWatchers(webNdefMessage); + notifyWatchers(webNdefMessage); } catch (UnsupportedEncodingException e) { Log.w(TAG, "Cannot read data from NFC tag. Cannot convert to NdefMessage:" @@ -572,71 +560,25 @@ * Notify all active watchers that an error happened when trying to read the tag coming nearby. */ private void notifyErrorToAllWatchers(NdefError error) { - for (int i = 0; i < mWatchers.size(); i++) { + for (int i = 0; i < mWatchIds.size(); i++) { mClient.onError(error); } } /** - * Iterates through active watchers and if any of those match NdefScanOptions criteria, - * delivers NdefMessage to the client. + * Iterates through active watchers and delivers NdefMessage to the client. */ - private void notifyMatchingWatchers(NdefMessage message) { - List<Integer> watchIds = new ArrayList<Integer>(); - for (int i = 0; i < mWatchers.size(); i++) { - NdefScanOptions options = mWatchers.valueAt(i); - if (matchesWatchOptions(message, options)) { - watchIds.add(mWatchers.keyAt(i)); - } - } - - if (watchIds.size() != 0) { - int[] ids = new int[watchIds.size()]; - for (int i = 0; i < watchIds.size(); ++i) { - ids[i] = watchIds.get(i).intValue(); + private void notifyWatchers(NdefMessage message) { + if (mWatchIds.size() != 0) { + int[] ids = new int[mWatchIds.size()]; + for (int i = 0; i < mWatchIds.size(); ++i) { + ids[i] = mWatchIds.get(i).intValue(); } mClient.onWatch(ids, mTagHandler.serialNumber(), message); } } /** - * Implements matching algorithm. - * https://w3c.github.io/web-nfc/#dispatching-nfc-content - */ - private boolean matchesWatchOptions(NdefMessage message, NdefScanOptions options) { - // A message with no records is to notify that the tag is already formatted to support NDEF - // but does not contain a message yet. We always dispatch it for all options. - if (message.data.length == 0) return true; - - for (int i = 0; i < message.data.length; i++) { - if (options.id != null && !options.id.equals(message.data[i].id)) { - continue; - } - if (options.recordType != null) { - if (message.data[i].category == NdefRecordTypeCategory.EXTERNAL) { - // The spec https://w3c.github.io/web-nfc/#the-record-type-string says "Two - // external types MUST be compared character by character, in case-insensitive - // manner". - if (options.recordType.compareToIgnoreCase(message.data[i].recordType) != 0) { - continue; - } - // All other types should be compared in case-sensitive manner. - } else if (!options.recordType.equals(message.data[i].recordType)) { - continue; - } - } - if (options.mediaType != null && !options.mediaType.equals(message.data[i].mediaType)) { - continue; - } - - // Found one record matches, means the message matches. - return true; - } - - return false; - } - - /** * Called by ReaderCallbackHandler when NFC tag is in proximity. */ public void onTagDiscovered(Tag tag) {
diff --git a/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java b/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java index 2e8b0f3..cc29884d 100644 --- a/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java +++ b/services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java
@@ -49,7 +49,6 @@ import org.chromium.device.mojom.NdefMessage; import org.chromium.device.mojom.NdefRecord; import org.chromium.device.mojom.NdefRecordTypeCategory; -import org.chromium.device.mojom.NdefScanOptions; import org.chromium.device.mojom.NdefWriteOptions; import org.chromium.device.mojom.Nfc.CancelAllWatchesResponse; import org.chromium.device.mojom.Nfc.CancelPushResponse; @@ -208,7 +207,7 @@ TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate); mDelegate.invokeCallback(); WatchResponse mockCallback = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), mNextWatchId, mockCallback); + nfc.watch(mNextWatchId, mockCallback); verify(mockCallback).call(mErrorCaptor.capture()); assertNull(mErrorCaptor.getValue()); } @@ -1104,7 +1103,7 @@ mDelegate.invokeCallback(); nfc.setClient(mNfcClient); WatchResponse mockCallback = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), mNextWatchId, mockCallback); + nfc.watch(mNextWatchId, mockCallback); nfc.suspendNfcOperations(); verify(mNfcAdapter, times(1)).disableReaderMode(mActivity); nfc.resumeNfcOperations(); @@ -1173,7 +1172,7 @@ nfc.setClient(mNfcClient); int watchId1 = mNextWatchId++; WatchResponse mockWatchCallback1 = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), watchId1, mockWatchCallback1); + nfc.watch(watchId1, mockWatchCallback1); // Check that watch requests were completed successfully. verify(mockWatchCallback1).call(mErrorCaptor.capture()); @@ -1181,7 +1180,7 @@ int watchId2 = mNextWatchId++; WatchResponse mockWatchCallback2 = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), watchId2, mockWatchCallback2); + nfc.watch(watchId2, mockWatchCallback2); verify(mockWatchCallback2).call(mErrorCaptor.capture()); assertNull(mErrorCaptor.getValue()); @@ -1207,7 +1206,7 @@ nfc.setClient(mNfcClient); int watchId = mNextWatchId++; WatchResponse mockWatchCallback = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), watchId, mockWatchCallback); + nfc.watch(watchId, mockWatchCallback); verify(mockWatchCallback).call(mErrorCaptor.capture()); assertNull(mErrorCaptor.getValue()); @@ -1223,129 +1222,6 @@ } /** - * Test that Nfc.watch() matching function works correctly. - */ - @Test - @Feature({"NFCTest"}) - public void testWatchMatching() { - TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate); - mDelegate.invokeCallback(); - nfc.setClient(mNfcClient); - - // Should match by record id (exact match). - NdefScanOptions options1 = createNdefScanOptions(); - options1.id = DUMMY_RECORD_ID; - int watchId1 = mNextWatchId++; - WatchResponse mockWatchCallback1 = mock(WatchResponse.class); - nfc.watch(options1, watchId1, mockWatchCallback1); - verify(mockWatchCallback1).call(mErrorCaptor.capture()); - assertNull(mErrorCaptor.getValue()); - - // Should match by media type. - NdefScanOptions options2 = createNdefScanOptions(); - int watchId2 = mNextWatchId++; - WatchResponse mockWatchCallback2 = mock(WatchResponse.class); - nfc.watch(options2, watchId2, mockWatchCallback2); - verify(mockWatchCallback2).call(mErrorCaptor.capture()); - assertNull(mErrorCaptor.getValue()); - - // Should match by record type. - NdefScanOptions options3 = createNdefScanOptions(); - options3.recordType = NdefMessageUtils.RECORD_TYPE_URL; - int watchId3 = mNextWatchId++; - WatchResponse mockWatchCallback3 = mock(WatchResponse.class); - nfc.watch(options3, watchId3, mockWatchCallback3); - verify(mockWatchCallback3).call(mErrorCaptor.capture()); - assertNull(mErrorCaptor.getValue()); - - // Should not match - NdefScanOptions options4 = createNdefScanOptions(); - options4.id = "random_record_id"; - int watchId4 = mNextWatchId++; - WatchResponse mockWatchCallback4 = mock(WatchResponse.class); - nfc.watch(options4, watchId4, mockWatchCallback4); - verify(mockWatchCallback4).call(mErrorCaptor.capture()); - assertNull(mErrorCaptor.getValue()); - - // Should not match because the record type must match case-sensitive. - NdefScanOptions options5 = createNdefScanOptions(); - options5.recordType = "Url"; - int watchId5 = mNextWatchId++; - WatchResponse mockWatchCallback5 = mock(WatchResponse.class); - nfc.watch(options5, watchId5, mockWatchCallback5); - verify(mockWatchCallback5).call(mErrorCaptor.capture()); - assertNull(mErrorCaptor.getValue()); - - nfc.processPendingOperationsForTesting(mNfcTagHandler); - - // Check that client was notified and watch with correct id was triggered. - verify(mNfcClient, times(1)) - .onWatch(mOnWatchCallbackCaptor.capture(), nullable(String.class), - any(NdefMessage.class)); - assertEquals(3, mOnWatchCallbackCaptor.getValue().length); - assertEquals(watchId1, mOnWatchCallbackCaptor.getValue()[0]); - assertEquals(watchId2, mOnWatchCallbackCaptor.getValue()[1]); - assertEquals(watchId3, mOnWatchCallbackCaptor.getValue()[2]); - } - - /** - * Test that Nfc.watch() matching function compares 2 external types in case-insensitive manner. - */ - @Test - @Feature({"NFCTest"}) - public void testWatchMatchingExternalType() { - TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate); - mDelegate.invokeCallback(); - nfc.setClient(mNfcClient); - - // Prepare the external type record. - android.nfc.NdefMessage extNdefMessage = new android.nfc.NdefMessage( - NdefMessageUtils.createPlatformExternalRecord(DUMMY_EXTERNAL_TYPE, DUMMY_RECORD_ID, - ApiCompatibilityUtils.getBytesUtf8(TEST_TEXT), null /* payloadMessage */)); - try { - doReturn(extNdefMessage).when(mNfcTagHandler).read(); - } catch (IOException | FormatException e) { - } - - // Should match, the record type is exactly equal. - NdefScanOptions options1 = createNdefScanOptions(); - options1.recordType = DUMMY_EXTERNAL_TYPE; - int watchId1 = mNextWatchId++; - WatchResponse mockWatchCallback1 = mock(WatchResponse.class); - nfc.watch(options1, watchId1, mockWatchCallback1); - verify(mockWatchCallback1).call(mErrorCaptor.capture()); - assertNull(mErrorCaptor.getValue()); - - // Should match, the record type is equal in case-insensitive manner. - NdefScanOptions options2 = createNdefScanOptions(); - options2.recordType = "aBc.com:xyZ"; - int watchId2 = mNextWatchId++; - WatchResponse mockWatchCallback2 = mock(WatchResponse.class); - nfc.watch(options2, watchId2, mockWatchCallback2); - verify(mockWatchCallback2).call(mErrorCaptor.capture()); - assertNull(mErrorCaptor.getValue()); - - // Should not match, the record type is NOT equal even in case-insensitive manner. - NdefScanOptions options3 = createNdefScanOptions(); - options3.recordType = "abcd.com:xyz"; - int watchId3 = mNextWatchId++; - WatchResponse mockWatchCallback3 = mock(WatchResponse.class); - nfc.watch(options3, watchId3, mockWatchCallback3); - verify(mockWatchCallback3).call(mErrorCaptor.capture()); - assertNull(mErrorCaptor.getValue()); - - nfc.processPendingOperationsForTesting(mNfcTagHandler); - - // Check that client was notified and watch with correct id was triggered. - verify(mNfcClient, times(1)) - .onWatch(mOnWatchCallbackCaptor.capture(), nullable(String.class), - any(NdefMessage.class)); - assertEquals(2, mOnWatchCallbackCaptor.getValue().length); - assertEquals(watchId1, mOnWatchCallbackCaptor.getValue()[0]); - assertEquals(watchId2, mOnWatchCallbackCaptor.getValue()[1]); - } - - /** * Test that Nfc.watch() can be cancelled with Nfc.cancelWatch(). */ @Test @@ -1354,7 +1230,7 @@ TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate); mDelegate.invokeCallback(); WatchResponse mockWatchCallback = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback); + nfc.watch(mNextWatchId, mockWatchCallback); verify(mockWatchCallback).call(mErrorCaptor.capture()); assertNull(mErrorCaptor.getValue()); @@ -1382,11 +1258,11 @@ mDelegate.invokeCallback(); WatchResponse mockWatchCallback1 = mock(WatchResponse.class); WatchResponse mockWatchCallback2 = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), mNextWatchId++, mockWatchCallback1); + nfc.watch(mNextWatchId++, mockWatchCallback1); verify(mockWatchCallback1).call(mErrorCaptor.capture()); assertNull(mErrorCaptor.getValue()); - nfc.watch(createNdefScanOptions(), mNextWatchId++, mockWatchCallback2); + nfc.watch(mNextWatchId++, mockWatchCallback2); verify(mockWatchCallback2).call(mErrorCaptor.capture()); assertNull(mErrorCaptor.getValue()); @@ -1407,7 +1283,7 @@ TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate); mDelegate.invokeCallback(); WatchResponse mockWatchCallback = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback); + nfc.watch(mNextWatchId, mockWatchCallback); verify(mockWatchCallback).call(mErrorCaptor.capture()); assertNull(mErrorCaptor.getValue()); @@ -1447,7 +1323,7 @@ nfc.setClient(mNfcClient); // Prepare at least one watcher, otherwise the error won't be notified. WatchResponse mockWatchCallback = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback); + nfc.watch(mNextWatchId, mockWatchCallback); // Start a push. PushResponse mockCallback = mock(PushResponse.class); nfc.push(createMojoNdefMessage(), createNdefWriteOptions(), mockCallback); @@ -1482,7 +1358,7 @@ nfc.setClient(mNfcClient); // Prepare at least one watcher, otherwise the error won't be notified. WatchResponse mockWatchCallback = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback); + nfc.watch(mNextWatchId, mockWatchCallback); // Start a push. PushResponse mockCallback = mock(PushResponse.class); nfc.push(createMojoNdefMessage(), createNdefWriteOptions(), mockCallback); @@ -1540,7 +1416,7 @@ mDelegate.invokeCallback(); nfc.setClient(mNfcClient); WatchResponse mockWatchCallback = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback); + nfc.watch(mNextWatchId, mockWatchCallback); // Force read operation to fail doThrow(IllegalStateException.class).when(mNfcTagHandler).read(); @@ -1679,7 +1555,7 @@ TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate); mDelegate.invokeCallback(); WatchResponse mockWatchCallback = mock(WatchResponse.class); - nfc.watch(createNdefScanOptions(), mNextWatchId, mockWatchCallback); + nfc.watch(mNextWatchId, mockWatchCallback); PushResponse mockPushCallback = mock(PushResponse.class); nfc.push(createMojoNdefMessage(), createNdefWriteOptions(), mockPushCallback); @@ -1740,11 +1616,6 @@ return pushOptions; } - private NdefScanOptions createNdefScanOptions() { - NdefScanOptions options = new NdefScanOptions(); - return options; - } - private NdefMessage createMojoNdefMessage() { NdefMessage message = new NdefMessage(); message.data = new NdefRecord[1];
diff --git a/services/device/public/mojom/nfc.mojom b/services/device/public/mojom/nfc.mojom index c45dc3ef..0eff58a 100644 --- a/services/device/public/mojom/nfc.mojom +++ b/services/device/public/mojom/nfc.mojom
@@ -103,20 +103,6 @@ bool overwrite; }; -struct NDEFScanOptions { - // Defines record id filtering constraint. Null means don't filter, empty - // string means must match on empty. - string? id; - - // Defines record type filtering constraint. Null means don't filter, empty - // string means must match on empty. - string? record_type; - - // Defines media type filtering constraint. Null means don't filter, empty - // string means must match on empty. - string? media_type; -}; - interface NFC { // NFCClient interface is used to notify |client| when NDEFMessage matches one // or more pending watch operations. @@ -129,10 +115,9 @@ // Cancels pending push request. CancelPush() => (NDEFError? error); - // Starts watching for nearby NFC devices with data that matches - // NDEFScanOptions filtering criteria. |id| identifies each watch request on - // the current Mojo connection. - Watch(NDEFScanOptions options, uint32 id) => (NDEFError? error); + // Starts watching for nearby NFC devices. |id| identifies each watch request + // on the current Mojo connection. + Watch(uint32 id) => (NDEFError? error); // Cancels watch operation with provided id. CancelWatch (uint32 id) => (NDEFError? error);
diff --git a/services/network/proxy_auto_config_library_unittest.cc b/services/network/proxy_auto_config_library_unittest.cc index 6230085..0b8974f 100644 --- a/services/network/proxy_auto_config_library_unittest.cc +++ b/services/network/proxy_auto_config_library_unittest.cc
@@ -250,6 +250,7 @@ std::unique_ptr<net::TransportClientSocket> CreateTransportClientSocket( const net::AddressList& addresses, std::unique_ptr<net::SocketPerformanceWatcher> socket_performance_watcher, + net::NetworkQualityEstimator* network_quality_estimator, net::NetLog* net_log, const net::NetLogSource& source) override { ADD_FAILURE() << "Called CreateTransportClientSocket()";
diff --git a/services/network/socket_data_pump_unittest.cc b/services/network/socket_data_pump_unittest.cc index e40ba6f6..af34268 100644 --- a/services/network/socket_data_pump_unittest.cc +++ b/services/network/socket_data_pump_unittest.cc
@@ -91,7 +91,8 @@ send_handle_ = std::move(send_pipe.producer_handle); socket_ = mock_client_socket_factory_.CreateTransportClientSocket( net::AddressList(), nullptr /*socket_performance_watcher*/, - nullptr /*netlog*/, net::NetLogSource()); + nullptr /*network_quality_estimator*/, nullptr /*netlog*/, + net::NetLogSource()); net::TestCompletionCallback callback; int result = socket_->Connect(callback.callback()); if (result == net::ERR_IO_PENDING)
diff --git a/services/network/tcp_bound_socket.cc b/services/network/tcp_bound_socket.cc index d2d2226..8f24a14 100644 --- a/services/network/tcp_bound_socket.cc +++ b/services/network/tcp_bound_socket.cc
@@ -123,7 +123,7 @@ nullptr /* client_socket_factory */, traffic_annotation_); connecting_socket_->ConnectWithSocket( net::TCPClientSocket::CreateFromBoundSocket( - std::move(socket_), remote_addr_list, bind_address_), + std::move(socket_), remote_addr_list, bind_address_, nullptr), std::move(tcp_connected_socket_options), base::BindOnce(&TCPBoundSocket::OnConnectComplete, base::Unretained(this)));
diff --git a/services/network/tcp_connected_socket.cc b/services/network/tcp_connected_socket.cc index 50950e5..b204de3 100644 --- a/services/network/tcp_connected_socket.cc +++ b/services/network/tcp_connected_socket.cc
@@ -113,10 +113,13 @@ DCHECK(!socket_); DCHECK(callback); + // TODO(https://crbug.com/1123197): Pass a non-null NetworkQualityEstimator. + net::NetworkQualityEstimator* network_quality_estimator = nullptr; + std::unique_ptr<net::TransportClientSocket> socket = client_socket_factory_->CreateTransportClientSocket( - remote_addr_list, nullptr /*socket_performance_watcher*/, net_log_, - net::NetLogSource()); + remote_addr_list, nullptr /*socket_performance_watcher*/, + network_quality_estimator, net_log_, net::NetLogSource()); if (local_addr) { int result = socket->Bind(local_addr.value());
diff --git a/services/service_manager/embedder/BUILD.gn b/services/service_manager/embedder/BUILD.gn index 2379f07f..0abfeb7a 100644 --- a/services/service_manager/embedder/BUILD.gn +++ b/services/service_manager/embedder/BUILD.gn
@@ -10,28 +10,15 @@ # problematic. component("embedder") { public = [ - "main.h", - "main_delegate.h", "set_process_title.h", "shared_file_util.h", ] sources = [ - "main.cc", - "main_delegate.cc", "set_process_title.cc", "shared_file_util.cc", ] - if (is_mac) { - sources += [ - "mac_init.h", - "mac_init.mm", - ] - - frameworks = [ "Foundation.framework" ] - } - deps = [ "//base:base_static", "//base:i18n",
diff --git a/services/service_manager/embedder/mac_init.h b/services/service_manager/embedder/mac_init.h deleted file mode 100644 index 8999d02..0000000 --- a/services/service_manager/embedder/mac_init.h +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2017 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 SERVICES_SERVICE_MANAGER_EMBEDDER_MAC_INIT_H_ -#define SERVICES_SERVICE_MANAGER_EMBEDDER_MAC_INIT_H_ - -namespace service_manager { - -// Perform any necessary Mac initialization. -void InitializeMac(); - -} // namespace service_manager - -#endif // SERVICES_SERVICE_MANAGER_EMBEDDER_MAC_INIT_H_
diff --git a/services/service_manager/embedder/main.cc b/services/service_manager/embedder/main.cc deleted file mode 100644 index 1c84ca5..0000000 --- a/services/service_manager/embedder/main.cc +++ /dev/null
@@ -1,343 +0,0 @@ -// Copyright 2017 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 "services/service_manager/embedder/main.h" - -#include "base/allocator/buildflags.h" -#include "base/at_exit.h" -#include "base/base_switches.h" -#include "base/command_line.h" -#include "base/debug/activity_tracker.h" -#include "base/debug/debugger.h" -#include "base/debug/stack_trace.h" -#include "base/i18n/icu_util.h" -#include "base/logging.h" -#include "base/memory/shared_memory_hooks.h" -#include "base/message_loop/message_pump_type.h" -#include "base/optional.h" -#include "base/process/launch.h" -#include "base/process/memory.h" -#include "base/process/process.h" -#include "base/run_loop.h" -#include "base/stl_util.h" -#include "base/task/single_thread_task_executor.h" -#include "base/task/thread_pool/thread_pool_instance.h" -#include "base/threading/thread.h" -#include "base/trace_event/trace_config.h" -#include "base/trace_event/trace_log.h" -#include "build/build_config.h" -#include "components/tracing/common/trace_to_console.h" -#include "components/tracing/common/tracing_switches.h" -#include "mojo/core/embedder/configuration.h" -#include "mojo/core/embedder/embedder.h" -#include "mojo/core/embedder/scoped_ipc_support.h" -#include "mojo/public/cpp/base/shared_memory_utils.h" -#include "sandbox/policy/sandbox_type.h" -#include "services/service_manager/embedder/main_delegate.h" -#include "services/service_manager/embedder/set_process_title.h" -#include "services/service_manager/embedder/shared_file_util.h" -#include "services/service_manager/embedder/switches.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/ui_base_paths.h" -#include "ui/base/ui_base_switches.h" - -#if defined(OS_WIN) -#include <windows.h> - -#include "base/win/process_startup_helper.h" -#include "base/win/win_util.h" -#include "ui/base/win/atl_module.h" -#endif - -#if defined(OS_POSIX) && !defined(OS_ANDROID) -#include <locale.h> -#include <signal.h> - -#include "base/file_descriptor_store.h" -#include "base/posix/global_descriptors.h" -#endif - -#if defined(OS_MAC) -#include "base/mac/scoped_nsautorelease_pool.h" -#include "services/service_manager/embedder/mac_init.h" - -#if BUILDFLAG(USE_ALLOCATOR_SHIM) -#include "base/allocator/allocator_shim.h" -#endif -#endif // defined(OS_MAC) - -namespace service_manager { - -namespace { - -// Maximum message size allowed to be read from a Mojo message pipe in any -// service manager embedder process. -constexpr size_t kMaximumMojoMessageSize = 128 * 1024 * 1024; - -#if defined(OS_POSIX) && !defined(OS_ANDROID) - -// Setup signal-handling state: resanitize most signals, ignore SIGPIPE. -void SetupSignalHandlers() { - // Always ignore SIGPIPE. We check the return value of write(). - CHECK_NE(SIG_ERR, signal(SIGPIPE, SIG_IGN)); - - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableInProcessStackTraces)) { - // Don't interfere with sanitizer signal handlers. - return; - } - - // Sanitise our signal handling state. Signals that were ignored by our - // parent will also be ignored by us. We also inherit our parent's sigmask. - sigset_t empty_signal_set; - CHECK_EQ(0, sigemptyset(&empty_signal_set)); - CHECK_EQ(0, sigprocmask(SIG_SETMASK, &empty_signal_set, NULL)); - - struct sigaction sigact; - memset(&sigact, 0, sizeof(sigact)); - sigact.sa_handler = SIG_DFL; - static const int signals_to_reset[] = { - SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, - SIGALRM, SIGTERM, SIGCHLD, SIGBUS, SIGTRAP}; - for (unsigned i = 0; i < base::size(signals_to_reset); i++) { - CHECK_EQ(0, sigaction(signals_to_reset[i], &sigact, NULL)); - } -} - -void PopulateFDsFromCommandLine() { - const std::string& shared_file_param = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kSharedFiles); - if (shared_file_param.empty()) - return; - - base::Optional<std::map<int, std::string>> shared_file_descriptors = - service_manager::ParseSharedFileSwitchValue(shared_file_param); - if (!shared_file_descriptors) - return; - - for (const auto& descriptor : *shared_file_descriptors) { - base::MemoryMappedFile::Region region; - const std::string& key = descriptor.second; - base::ScopedFD fd = base::GlobalDescriptors::GetInstance()->TakeFD( - descriptor.first, ®ion); - base::FileDescriptorStore::GetInstance().Set(key, std::move(fd), region); - } -} - -#endif // defined(OS_POSIX) && !defined(OS_ANDROID) - -void CommonSubprocessInit() { -#if defined(OS_WIN) - // HACK: Let Windows know that we have started. This is needed to suppress - // the IDC_APPSTARTING cursor from being displayed for a prolonged period - // while a subprocess is starting. - if (base::win::IsUser32AndGdi32Available()) { - PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0); - MSG msg; - PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); - } -#endif - -#if !defined(OFFICIAL_BUILD) && defined(OS_WIN) - base::RouteStdioToConsole(false); - LoadLibraryA("dbghelp.dll"); -#endif -} - -} // namespace - -MainParams::MainParams(MainDelegate* delegate) : delegate(delegate) {} - -MainParams::~MainParams() {} - -int Main(const MainParams& params) { - MainDelegate* delegate = params.delegate; - DCHECK(delegate); - - int exit_code = -1; - base::debug::GlobalActivityTracker* tracker = nullptr; -#if defined(OS_MAC) - std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool; -#endif - - // A flag to indicate whether Main() has been called before. On Android, we - // may re-run Main() without restarting the browser process. This flag - // prevents initializing things more than once. - static bool is_initialized = false; -#if !defined(OS_ANDROID) - DCHECK(!is_initialized); -#endif - if (!is_initialized) { - is_initialized = true; -#if defined(OS_MAC) && BUILDFLAG(USE_ALLOCATOR_SHIM) - base::allocator::InitializeAllocatorShim(); -#endif - base::EnableTerminationOnOutOfMemory(); - -#if defined(OS_LINUX) || defined(OS_CHROMEOS) - // The various desktop environments set this environment variable that - // allows the dbus client library to connect directly to the bus. When this - // variable is not set (test environments like xvfb-run), the dbus client - // library will fall back to auto-launch mode. Auto-launch is dangerous as - // it can cause hangs (crbug.com/715658) . This one line disables the dbus - // auto-launch, by clobbering the DBUS_SESSION_BUS_ADDRESS env variable if - // not already set. The old auto-launch behavior, if needed, can be restored - // by setting DBUS_SESSION_BUS_ADDRESS="autolaunch:" before launching - // chrome. - const int kNoOverrideIfAlreadySet = 0; - setenv("DBUS_SESSION_BUS_ADDRESS", "disabled:", kNoOverrideIfAlreadySet); -#endif - -#if defined(OS_WIN) - base::win::RegisterInvalidParamHandler(); - ui::win::CreateATLModuleIfNeeded(); -#endif // defined(OS_WIN) - -#if !defined(OS_ANDROID) - // On Android, the command line is initialized when library is loaded. - int argc = 0; - const char** argv = nullptr; - -#if !defined(OS_WIN) - // argc/argv are ignored on Windows; see command_line.h for details. - argc = params.argc; - argv = params.argv; -#endif - - base::CommandLine::Init(argc, argv); - -#if defined(OS_POSIX) - PopulateFDsFromCommandLine(); -#endif - - base::EnableTerminationOnHeapCorruption(); - - SetProcessTitleFromCommandLine(argv); -#endif // !defined(OS_ANDROID) - -// On Android setlocale() is not supported, and we don't override the signal -// handlers so we can get a stack trace when crashing. -#if defined(OS_POSIX) && !defined(OS_ANDROID) - // Set C library locale to make sure CommandLine can parse - // argument values in the correct encoding and to make sure - // generated file names (think downloads) are in the file system's - // encoding. - setlocale(LC_ALL, ""); - // For numbers we never want the C library's locale sensitive - // conversion from number to string because the only thing it - // changes is the decimal separator which is not good enough for - // the UI and can be harmful elsewhere. User interface number - // conversions need to go through ICU. Other conversions need to - // be locale insensitive so we force the number locale back to the - // default, "C", locale. - setlocale(LC_NUMERIC, "C"); - - SetupSignalHandlers(); -#endif - -#if defined(OS_WIN) - base::win::SetupCRT(*base::CommandLine::ForCurrentProcess()); -#endif - - MainDelegate::InitializeParams init_params; - -#if defined(OS_MAC) - // We need this pool for all the objects created before we get to the event - // loop, but we don't want to leave them hanging around until the app quits. - // Each "main" needs to flush this pool right before it goes into its main - // event loop to get rid of the cruft. - autorelease_pool = std::make_unique<base::mac::ScopedNSAutoreleasePool>(); - init_params.autorelease_pool = autorelease_pool.get(); - InitializeMac(); -#endif - - mojo::core::Configuration mojo_config; - mojo_config.max_message_num_bytes = kMaximumMojoMessageSize; - delegate->InitializeMojo(&mojo_config); - - ui::RegisterPathProvider(); - - tracker = base::debug::GlobalActivityTracker::Get(); - exit_code = delegate->Initialize(init_params); - if (exit_code >= 0) { - if (tracker) { - tracker->SetProcessPhase( - base::debug::GlobalActivityTracker::PROCESS_LAUNCH_FAILED); - tracker->process_data().SetInt("exit-code", exit_code); - } - return exit_code; - } - - // Note #1: the installed shared memory hooks require a live instance of - // mojo::core::ScopedIPCSupport to function, which is instantiated below by - // the process type's main function. However, some implementations of the - // service_manager::MainDelegate::Initialize() delegate method allocate - // shared memory, so the hooks cannot be installed before the Initialize() - // call above, or the shared memory allocation will simply fail. - // - // Note #2: some platforms can directly allocated shared memory in a - // sandboxed process. The defines below must be in sync with the - // implementation of mojo::NodeController::CreateSharedBuffer(). -#if !defined(OS_MAC) && !defined(OS_NACL_SFI) && !defined(OS_FUCHSIA) - if (sandbox::policy::IsUnsandboxedSandboxType( - sandbox::policy::SandboxTypeFromCommandLine( - *base::CommandLine::ForCurrentProcess()))) { - // Unsandboxed processes don't need shared memory brokering... because - // they're not sandboxed. - } else if (mojo_config.force_direct_shared_memory_allocation) { - // Don't bother with hooks if direct shared memory allocation has been - // requested. - } else { - // Sanity check, since installing the shared memory hooks in a broker - // process will lead to infinite recursion. - DCHECK(!mojo_config.is_broker_process); - // Otherwise, this is a sandboxed process that will need brokering to - // allocate shared memory. - mojo::SharedMemoryUtils::InstallBaseHooks(); - } -#endif // !defined(OS_MAC) && !defined(OS_NACL_SFI) && !defined(OS_FUCHSIA) - -#if defined(OS_WIN) - // Route stdio to parent console (if any) or create one. - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableLogging)) { - base::RouteStdioToConsole(true); - } -#endif - - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - ::switches::kTraceToConsole)) { - base::trace_event::TraceConfig trace_config = - tracing::GetConfigForTraceToConsole(); - base::trace_event::TraceLog::GetInstance()->SetEnabled( - trace_config, base::trace_event::TraceLog::RECORDING_MODE); - } - } - - if (delegate->IsEmbedderSubprocess()) - CommonSubprocessInit(); - exit_code = delegate->RunEmbedderProcess(); - - if (tracker) { - if (exit_code == 0) { - tracker->SetProcessPhaseIfEnabled( - base::debug::GlobalActivityTracker::PROCESS_EXITED_CLEANLY); - } else { - tracker->SetProcessPhaseIfEnabled( - base::debug::GlobalActivityTracker::PROCESS_EXITED_WITH_CODE); - tracker->process_data().SetInt("exit-code", exit_code); - } - } - -#if defined(OS_MAC) - autorelease_pool.reset(); -#endif - - delegate->ShutDownEmbedderProcess(); - - return exit_code; -} - -} // namespace service_manager
diff --git a/services/service_manager/embedder/main.h b/services/service_manager/embedder/main.h deleted file mode 100644 index 57e88aa..0000000 --- a/services/service_manager/embedder/main.h +++ /dev/null
@@ -1,33 +0,0 @@ -// Copyright 2017 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 SERVICES_SERVICE_MANAGER_EMBEDDER_MAIN_H_ -#define SERVICES_SERVICE_MANAGER_EMBEDDER_MAIN_H_ - -#include "base/component_export.h" -#include "build/build_config.h" - -namespace service_manager { - -class MainDelegate; - -struct COMPONENT_EXPORT(SERVICE_MANAGER_EMBEDDER) MainParams { - explicit MainParams(MainDelegate* delegate); - ~MainParams(); - - MainDelegate* const delegate; - -#if !defined(OS_WIN) && !defined(OS_ANDROID) - int argc = 0; - const char** argv = nullptr; -#endif -}; - -// Main function which should be called as early as possible by any executable -// embedding the service manager. -int COMPONENT_EXPORT(SERVICE_MANAGER_EMBEDDER) Main(const MainParams& params); - -} // namespace service_manager - -#endif // SERVICES_SERVICE_MANAGER_EMBEDDER_MAIN_H_
diff --git a/services/service_manager/embedder/main_delegate.cc b/services/service_manager/embedder/main_delegate.cc deleted file mode 100644 index 011b386..0000000 --- a/services/service_manager/embedder/main_delegate.cc +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright 2017 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 "services/service_manager/embedder/main_delegate.h" - -namespace service_manager { - -MainDelegate::MainDelegate() = default; - -MainDelegate::~MainDelegate() = default; - -bool MainDelegate::IsEmbedderSubprocess() { - return false; -} - -int MainDelegate::RunEmbedderProcess() { - return 0; -} - -void MainDelegate::ShutDownEmbedderProcess() {} - -void MainDelegate::InitializeMojo(mojo::core::Configuration* config) {} - -} // namespace service_manager
diff --git a/services/service_manager/embedder/main_delegate.h b/services/service_manager/embedder/main_delegate.h deleted file mode 100644 index 27da85656..0000000 --- a/services/service_manager/embedder/main_delegate.h +++ /dev/null
@@ -1,64 +0,0 @@ -// Copyright 2017 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 SERVICES_SERVICE_MANAGER_EMBEDDER_MAIN_DELEGATE_H_ -#define SERVICES_SERVICE_MANAGER_EMBEDDER_MAIN_DELEGATE_H_ - -#include "base/component_export.h" -#include "mojo/core/embedder/configuration.h" - -namespace base { -namespace mac { -class ScopedNSAutoreleasePool; -} -} - -namespace service_manager { - -// An interface which must be implemented by Service Manager embedders to -// control basic process initialization and shutdown, as well as early branching -// to run specific types of subprocesses. -class COMPONENT_EXPORT(SERVICE_MANAGER_EMBEDDER) MainDelegate { - public: - // Extra parameters passed to MainDelegate::Initialize. - struct InitializeParams { -#if defined(OS_MAC) - // The outermost autorelease pool, allocated by internal service manager - // logic. This is guaranteed to live throughout the extent of Run(). - base::mac::ScopedNSAutoreleasePool* autorelease_pool = nullptr; -#endif - }; - - MainDelegate(); - virtual ~MainDelegate(); - - // Perform early process initialization. Returns -1 if successful, or the exit - // code with which the process should be terminated due to initialization - // failure. - virtual int Initialize(const InitializeParams& params) = 0; - - // Indicates whether this (embedder) process should be treated as a subprocess - // for the sake of some platform-specific environment initialization details. - virtual bool IsEmbedderSubprocess(); - - // Runs the embedder's own main process logic. Called exactly once after a - // successful call to Initialize(), and only if the Service Manager core does - // not know what to do otherwise -- i.e., if it is not starting a new Service - // Manager instance or launching an embedded service. - // - // Returns the exit code to use when terminating the process after - // RunEmbedderProcess() (and then ShutDown()) completes. - virtual int RunEmbedderProcess(); - - // Called just before process exit if RunEmbedderProcess() was called. - virtual void ShutDownEmbedderProcess(); - - // Allows the embedder to override the process-wide Mojo configuration and - // initialization. - virtual void InitializeMojo(mojo::core::Configuration* config); -}; - -} // namespace service_manager - -#endif // SERVICES_SERVICE_MANAGER_EMBEDDER_MAIN_DELEGATE_H_
diff --git a/services/video_capture/broadcasting_receiver.cc b/services/video_capture/broadcasting_receiver.cc index 16346c6c..9765d18e 100644 --- a/services/video_capture/broadcasting_receiver.cc +++ b/services/video_capture/broadcasting_receiver.cc
@@ -56,11 +56,6 @@ #endif } -void CloneGpuMemoryBufferHandle(const gfx::GpuMemoryBufferHandle& source, - media::mojom::VideoBufferHandlePtr* target) { - (*target)->set_gpu_memory_buffer_handle(source.Clone()); -} - } // anonymous namespace BroadcastingReceiver::ClientContext::ClientContext( @@ -134,13 +129,21 @@ media::mojom::VideoBufferHandlePtr result = media::mojom::VideoBufferHandle::New(); - // If the source uses mailbox hanldes, i.e. textures, we pass those through + // If the source uses mailbox handles, i.e. textures, we pass those through // without conversion, no matter what clients requested. if (buffer_handle_->is_mailbox_handles()) { result->set_mailbox_handles(buffer_handle_->get_mailbox_handles()->Clone()); return result; } + // If the source uses GpuMemoryBuffer handles, we pass those through without + // conversion, no matter what clients requested. + if (buffer_handle_->is_gpu_memory_buffer_handle()) { + result->set_gpu_memory_buffer_handle( + buffer_handle_->get_gpu_memory_buffer_handle().Clone()); + return result; + } + switch (target_buffer_type) { case media::VideoCaptureBufferType::kMailboxHolder: NOTREACHED() << "Cannot convert buffer type to kMailboxHolder from " @@ -171,8 +174,7 @@ } break; case media::VideoCaptureBufferType::kGpuMemoryBuffer: - CloneGpuMemoryBufferHandle(buffer_handle_->get_gpu_memory_buffer_handle(), - &result); + NOTREACHED() << "Unexpected GpuMemoryBuffer handle type"; break; } return result;
diff --git a/styleguide/inclusive_code.md b/styleguide/inclusive_code.md index 22a0343..2626653 100644 --- a/styleguide/inclusive_code.md +++ b/styleguide/inclusive_code.md
@@ -105,9 +105,9 @@ For a long list of changes, see [this bug](https://crbug.com/842296). Some examples: -* ["Blacklist"->"Blocklist" in interventions-internals UI.](https://crrev.com/1055905) -* [Remove "whitelist" and "blacklist" from extension docs.](https://crrev.com/1056027) -* [Declarative Net Request: Replace usages of 'blacklist' and 'whitelist'.](https://crrev.com/1094141) +* ["Blacklist"->"Blocklist" in interventions-internals UI.](https://crrev.com/c/1055905) +* [Remove "whitelist" and "blacklist" from extension docs.](https://crrev.com/c/1056027) +* [Declarative Net Request: Replace usages of 'blacklist' and 'whitelist'.](https://crrev.com/c/1094141) ## Thanks
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 7a7ec271..cd442f1 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -4275,6 +4275,18 @@ "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/" }, { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "lacros_chrome_browsertests", + "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/" + }, + { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/lacros.unit_tests.filter" ], @@ -4873,6 +4885,18 @@ "can_use_on_swarming_builders": true, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "lacros_chrome_browsertests", + "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "latency_unittests", "test_id_prefix": "ninja://ui/latency:latency_unittests/" },
diff --git a/testing/buildbot/chromium.ci.json b/testing/buildbot/chromium.ci.json index e089db4d..3224778 100644 --- a/testing/buildbot/chromium.ci.json +++ b/testing/buildbot/chromium.ci.json
@@ -242179,6 +242179,1596 @@ "empty_main" ] }, + "linux-inverse-fieldtrials-fyi-rel": { + "gtest_tests": [ + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "absl_hardening_tests", + "test_id_prefix": "ninja://third_party/abseil-cpp:absl_hardening_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "accessibility_unittests", + "test_id_prefix": "ninja://ui/accessibility:accessibility_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "angle_unittests", + "test_id_prefix": "ninja://third_party/angle/src/tests:angle_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "app_shell_unittests", + "test_id_prefix": "ninja://extensions/shell:app_shell_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "aura_unittests", + "test_id_prefix": "ninja://ui/aura:aura_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "base_unittests", + "test_id_prefix": "ninja://base:base_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "base_util_unittests", + "test_id_prefix": "ninja://base/util:base_util_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_common_unittests", + "test_id_prefix": "ninja://third_party/blink/common:blink_common_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_fuzzer_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/platform:blink_fuzzer_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_heap_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/platform/heap:blink_heap_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_platform_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/platform:blink_platform_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "webkit_unit_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/controller:blink_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "boringssl_crypto_tests", + "test_id_prefix": "ninja://third_party/boringssl:boringssl_crypto_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "boringssl_ssl_tests", + "test_id_prefix": "ninja://third_party/boringssl:boringssl_ssl_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 10 + }, + "test": "browser_tests", + "test_id_prefix": "ninja://chrome/test:browser_tests/" + }, + { + "args": [ + "--gtest_filter=-*UsingRealWebcam*" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "capture_unittests", + "test_id_prefix": "ninja://media/capture:capture_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "cast_unittests", + "test_id_prefix": "ninja://media/cast:cast_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "cc_unittests", + "test_id_prefix": "ninja://cc:cc_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "chrome_app_unittests", + "test_id_prefix": "ninja://chrome/test:chrome_app_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "chromedriver_unittests", + "test_id_prefix": "ninja://chrome/test/chromedriver:chromedriver_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "components_browsertests", + "test_id_prefix": "ninja://components:components_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "components_unittests", + "test_id_prefix": "ninja://components:components_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "compositor_unittests", + "test_id_prefix": "ninja://ui/compositor:compositor_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 6 + }, + "test": "content_browsertests", + "test_id_prefix": "ninja://content/test:content_browsertests/" + }, + { + "args": [ + "--enable-features=StorageServiceOutOfProcess" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "storage_service_content_browsertests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 2 + }, + "test": "content_browsertests", + "test_id_prefix": "ninja://content/test:content_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "content_unittests", + "test_id_prefix": "ninja://content/test:content_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "crashpad_tests", + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "cronet_tests", + "test_id_prefix": "ninja://components/cronet:cronet_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "cronet_unittests", + "test_id_prefix": "ninja://components/cronet:cronet_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "crypto_unittests", + "test_id_prefix": "ninja://crypto:crypto_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "dbus_unittests", + "test_id_prefix": "ninja://dbus:dbus_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "device_unittests", + "test_id_prefix": "ninja://device:device_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "display_unittests", + "test_id_prefix": "ninja://ui/display:display_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "events_unittests", + "test_id_prefix": "ninja://ui/events:events_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "extensions_browsertests", + "test_id_prefix": "ninja://extensions:extensions_browsertests/" + }, + { + "args": [ + "--enable-features=StorageServiceOutOfProcess" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "storage_service_extensions_browsertests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "extensions_browsertests", + "test_id_prefix": "ninja://extensions:extensions_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "extensions_unittests", + "test_id_prefix": "ninja://extensions:extensions_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "filesystem_service_unittests", + "test_id_prefix": "ninja://components/services/filesystem:filesystem_service_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gcm_unit_tests", + "test_id_prefix": "ninja://google_apis/gcm:gcm_unit_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gfx_unittests", + "test_id_prefix": "ninja://ui/gfx:gfx_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gin_unittests", + "test_id_prefix": "ninja://gin:gin_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "google_apis_unittests", + "test_id_prefix": "ninja://google_apis:google_apis_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gpu_unittests", + "test_id_prefix": "ninja://gpu:gpu_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gwp_asan_unittests", + "test_id_prefix": "ninja://components/gwp_asan:gwp_asan_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "headless_browsertests", + "test_id_prefix": "ninja://headless:headless_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "headless_unittests", + "test_id_prefix": "ninja://headless:headless_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 3 + }, + "test": "interactive_ui_tests", + "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/" + }, + { + "args": [ + "--enable-features=StorageServiceOutOfProcess" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "storage_service_interactive_ui_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 3 + }, + "test": "interactive_ui_tests", + "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "ipc_tests", + "test_id_prefix": "ninja://ipc:ipc_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "jingle_unittests", + "test_id_prefix": "ninja://jingle:jingle_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "latency_unittests", + "test_id_prefix": "ninja://ui/latency:latency_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "libjingle_xmpp_unittests", + "test_id_prefix": "ninja://third_party/libjingle_xmpp:libjingle_xmpp_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "media_blink_unittests", + "test_id_prefix": "ninja://media/blink:media_blink_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "media_unittests", + "test_id_prefix": "ninja://media:media_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "message_center_unittests", + "test_id_prefix": "ninja://ui/message_center:message_center_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "midi_unittests", + "test_id_prefix": "ninja://media/midi:midi_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "mojo_core_unittests", + "test_id_prefix": "ninja://mojo/core:mojo_core_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "mojo_unittests", + "test_id_prefix": "ninja://mojo:mojo_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "nacl_helper_nonsfi_unittests", + "test_id_prefix": "ninja://components/nacl/loader:nacl_helper_nonsfi_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "nacl_loader_unittests", + "test_id_prefix": "ninja://components/nacl/loader:nacl_loader_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "native_theme_unittests", + "test_id_prefix": "ninja://ui/native_theme:native_theme_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "net_unittests", + "test_id_prefix": "ninja://net:net_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pdf_unittests", + "test_id_prefix": "ninja://pdf:pdf_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "perfetto_unittests", + "test_id_prefix": "ninja://third_party/perfetto:perfetto_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "ppapi_unittests", + "test_id_prefix": "ninja://ppapi:ppapi_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "printing_unittests", + "test_id_prefix": "ninja://printing:printing_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "remoting_unittests", + "test_id_prefix": "ninja://remoting:remoting_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "sandbox_linux_unittests", + "test_id_prefix": "ninja://sandbox/linux:sandbox_linux_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "service_manager_unittests", + "test_id_prefix": "ninja://services/service_manager/tests:service_manager_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "services_unittests", + "test_id_prefix": "ninja://services:services_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "shell_dialogs_unittests", + "test_id_prefix": "ninja://ui/shell_dialogs:shell_dialogs_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "skia_unittests", + "test_id_prefix": "ninja://skia:skia_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "snapshot_unittests", + "test_id_prefix": "ninja://ui/snapshot:snapshot_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "sql_unittests", + "test_id_prefix": "ninja://sql:sql_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "storage_unittests", + "test_id_prefix": "ninja://storage:storage_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "sync_integration_tests", + "test_id_prefix": "ninja://chrome/test:sync_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "traffic_annotation_auditor_unittests", + "test_id_prefix": "ninja://tools/traffic_annotation/auditor:traffic_annotation_auditor_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "ui_base_unittests", + "test_id_prefix": "ninja://ui/base:ui_base_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "ui_touch_selection_unittests", + "test_id_prefix": "ninja://ui/touch_selection:ui_touch_selection_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "unit_tests", + "test_id_prefix": "ninja://chrome/test:unit_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "url_unittests", + "test_id_prefix": "ninja://url:url_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "views_unittests", + "test_id_prefix": "ninja://ui/views:views_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "viz_unittests", + "test_id_prefix": "ninja://components/viz:viz_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "vr_common_unittests", + "test_id_prefix": "ninja://chrome/browser/vr:vr_common_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "vr_pixeltests", + "test_id_prefix": "ninja://chrome/browser/vr:vr_pixeltests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "weblayer_browsertests", + "test_id_prefix": "ninja://weblayer/test:weblayer_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "weblayer_unittests", + "test_id_prefix": "ninja://weblayer/test:weblayer_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "wm_unittests", + "test_id_prefix": "ninja://ui/wm:wm_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "wtf_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/platform/wtf:wtf_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "x11_unittests", + "test_id_prefix": "ninja://ui/platform_window/x11:x11_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "xr_browser_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "xr_browser_tests", + "test_id_prefix": "ninja://chrome/test:xr_browser_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "zlib_unittests", + "test_id_prefix": "ninja://third_party/zlib:zlib_unittests/" + } + ] + }, "linux-lacros-rel": { "additional_compile_targets": [ "gn_all" @@ -242232,6 +243822,18 @@ "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/" }, { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "lacros_chrome_browsertests", + "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/" + }, + { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/lacros.unit_tests.filter" ], @@ -243111,6 +244713,24 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "lacros_chrome_browsertests", + "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04", + "ssd": "0" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "latency_unittests", "test_id_prefix": "ninja://ui/latency:latency_unittests/" }, @@ -244331,6 +245951,18 @@ "can_use_on_swarming_builders": true, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "lacros_chrome_browsertests", + "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "latency_unittests", "test_id_prefix": "ninja://ui/latency:latency_unittests/" },
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 9b6fa1c..fa456a41 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -45063,6 +45063,1596 @@ } ] }, + "linux-inverse-fieldtrials-fyi-rel": { + "gtest_tests": [ + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "absl_hardening_tests", + "test_id_prefix": "ninja://third_party/abseil-cpp:absl_hardening_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "accessibility_unittests", + "test_id_prefix": "ninja://ui/accessibility:accessibility_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "angle_unittests", + "test_id_prefix": "ninja://third_party/angle/src/tests:angle_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "app_shell_unittests", + "test_id_prefix": "ninja://extensions/shell:app_shell_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "aura_unittests", + "test_id_prefix": "ninja://ui/aura:aura_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "base_unittests", + "test_id_prefix": "ninja://base:base_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "base_util_unittests", + "test_id_prefix": "ninja://base/util:base_util_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_common_unittests", + "test_id_prefix": "ninja://third_party/blink/common:blink_common_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_fuzzer_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/platform:blink_fuzzer_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_heap_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/platform/heap:blink_heap_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_platform_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/platform:blink_platform_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "webkit_unit_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "blink_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/controller:blink_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "boringssl_crypto_tests", + "test_id_prefix": "ninja://third_party/boringssl:boringssl_crypto_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "boringssl_ssl_tests", + "test_id_prefix": "ninja://third_party/boringssl:boringssl_ssl_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 10 + }, + "test": "browser_tests", + "test_id_prefix": "ninja://chrome/test:browser_tests/" + }, + { + "args": [ + "--gtest_filter=-*UsingRealWebcam*" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "capture_unittests", + "test_id_prefix": "ninja://media/capture:capture_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "cast_unittests", + "test_id_prefix": "ninja://media/cast:cast_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "cc_unittests", + "test_id_prefix": "ninja://cc:cc_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "chrome_app_unittests", + "test_id_prefix": "ninja://chrome/test:chrome_app_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "chromedriver_unittests", + "test_id_prefix": "ninja://chrome/test/chromedriver:chromedriver_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "components_browsertests", + "test_id_prefix": "ninja://components:components_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "components_unittests", + "test_id_prefix": "ninja://components:components_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "compositor_unittests", + "test_id_prefix": "ninja://ui/compositor:compositor_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 6 + }, + "test": "content_browsertests", + "test_id_prefix": "ninja://content/test:content_browsertests/" + }, + { + "args": [ + "--enable-features=StorageServiceOutOfProcess" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "storage_service_content_browsertests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 2 + }, + "test": "content_browsertests", + "test_id_prefix": "ninja://content/test:content_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "content_unittests", + "test_id_prefix": "ninja://content/test:content_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "crashpad_tests", + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "cronet_tests", + "test_id_prefix": "ninja://components/cronet:cronet_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "cronet_unittests", + "test_id_prefix": "ninja://components/cronet:cronet_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "crypto_unittests", + "test_id_prefix": "ninja://crypto:crypto_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "dbus_unittests", + "test_id_prefix": "ninja://dbus:dbus_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "device_unittests", + "test_id_prefix": "ninja://device:device_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "display_unittests", + "test_id_prefix": "ninja://ui/display:display_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "events_unittests", + "test_id_prefix": "ninja://ui/events:events_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "extensions_browsertests", + "test_id_prefix": "ninja://extensions:extensions_browsertests/" + }, + { + "args": [ + "--enable-features=StorageServiceOutOfProcess" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "storage_service_extensions_browsertests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "extensions_browsertests", + "test_id_prefix": "ninja://extensions:extensions_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "extensions_unittests", + "test_id_prefix": "ninja://extensions:extensions_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "filesystem_service_unittests", + "test_id_prefix": "ninja://components/services/filesystem:filesystem_service_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gcm_unit_tests", + "test_id_prefix": "ninja://google_apis/gcm:gcm_unit_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gfx_unittests", + "test_id_prefix": "ninja://ui/gfx:gfx_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gin_unittests", + "test_id_prefix": "ninja://gin:gin_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "google_apis_unittests", + "test_id_prefix": "ninja://google_apis:google_apis_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gpu_unittests", + "test_id_prefix": "ninja://gpu:gpu_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "gwp_asan_unittests", + "test_id_prefix": "ninja://components/gwp_asan:gwp_asan_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "headless_browsertests", + "test_id_prefix": "ninja://headless:headless_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "headless_unittests", + "test_id_prefix": "ninja://headless:headless_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 3 + }, + "test": "interactive_ui_tests", + "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/" + }, + { + "args": [ + "--enable-features=StorageServiceOutOfProcess" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "storage_service_interactive_ui_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 3 + }, + "test": "interactive_ui_tests", + "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "ipc_tests", + "test_id_prefix": "ninja://ipc:ipc_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "jingle_unittests", + "test_id_prefix": "ninja://jingle:jingle_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "latency_unittests", + "test_id_prefix": "ninja://ui/latency:latency_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "libjingle_xmpp_unittests", + "test_id_prefix": "ninja://third_party/libjingle_xmpp:libjingle_xmpp_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "media_blink_unittests", + "test_id_prefix": "ninja://media/blink:media_blink_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "media_unittests", + "test_id_prefix": "ninja://media:media_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "message_center_unittests", + "test_id_prefix": "ninja://ui/message_center:message_center_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "midi_unittests", + "test_id_prefix": "ninja://media/midi:midi_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "mojo_core_unittests", + "test_id_prefix": "ninja://mojo/core:mojo_core_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "mojo_unittests", + "test_id_prefix": "ninja://mojo:mojo_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "nacl_helper_nonsfi_unittests", + "test_id_prefix": "ninja://components/nacl/loader:nacl_helper_nonsfi_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "nacl_loader_unittests", + "test_id_prefix": "ninja://components/nacl/loader:nacl_loader_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "native_theme_unittests", + "test_id_prefix": "ninja://ui/native_theme:native_theme_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "net_unittests", + "test_id_prefix": "ninja://net:net_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pdf_unittests", + "test_id_prefix": "ninja://pdf:pdf_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "perfetto_unittests", + "test_id_prefix": "ninja://third_party/perfetto:perfetto_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "ppapi_unittests", + "test_id_prefix": "ninja://ppapi:ppapi_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "printing_unittests", + "test_id_prefix": "ninja://printing:printing_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "remoting_unittests", + "test_id_prefix": "ninja://remoting:remoting_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "sandbox_linux_unittests", + "test_id_prefix": "ninja://sandbox/linux:sandbox_linux_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "service_manager_unittests", + "test_id_prefix": "ninja://services/service_manager/tests:service_manager_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "services_unittests", + "test_id_prefix": "ninja://services:services_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "shell_dialogs_unittests", + "test_id_prefix": "ninja://ui/shell_dialogs:shell_dialogs_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "skia_unittests", + "test_id_prefix": "ninja://skia:skia_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "snapshot_unittests", + "test_id_prefix": "ninja://ui/snapshot:snapshot_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "sql_unittests", + "test_id_prefix": "ninja://sql:sql_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "storage_unittests", + "test_id_prefix": "ninja://storage:storage_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "sync_integration_tests", + "test_id_prefix": "ninja://chrome/test:sync_integration_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "traffic_annotation_auditor_unittests", + "test_id_prefix": "ninja://tools/traffic_annotation/auditor:traffic_annotation_auditor_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "ui_base_unittests", + "test_id_prefix": "ninja://ui/base:ui_base_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "ui_touch_selection_unittests", + "test_id_prefix": "ninja://ui/touch_selection:ui_touch_selection_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "unit_tests", + "test_id_prefix": "ninja://chrome/test:unit_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "url_unittests", + "test_id_prefix": "ninja://url:url_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "views_unittests", + "test_id_prefix": "ninja://ui/views:views_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "viz_unittests", + "test_id_prefix": "ninja://components/viz:viz_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "vr_common_unittests", + "test_id_prefix": "ninja://chrome/browser/vr:vr_common_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "vr_pixeltests", + "test_id_prefix": "ninja://chrome/browser/vr:vr_pixeltests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "weblayer_browsertests", + "test_id_prefix": "ninja://weblayer/test:weblayer_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "weblayer_unittests", + "test_id_prefix": "ninja://weblayer/test:weblayer_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "wm_unittests", + "test_id_prefix": "ninja://ui/wm:wm_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "wtf_unittests", + "test_id_prefix": "ninja://third_party/blink/renderer/platform/wtf:wtf_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "x11_unittests", + "test_id_prefix": "ninja://ui/platform_window/x11:x11_unittests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "name": "xr_browser_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "xr_browser_tests", + "test_id_prefix": "ninja://chrome/test:xr_browser_tests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "zlib_unittests", + "test_id_prefix": "ninja://third_party/zlib:zlib_unittests/" + } + ] + }, "linux-lacros-tester-fyi-rel": { "additional_compile_targets": [ "chrome", @@ -45926,6 +47516,24 @@ ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, + "test": "lacros_chrome_browsertests", + "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04", + "ssd": "0" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, "test": "latency_unittests", "test_id_prefix": "ninja://ui/latency:latency_unittests/" },
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index 070a41f..7c8dfe91 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -1050,6 +1050,10 @@ "label": "//ash/keyboard/ui:keyboard_unittests", "type": "windowed_test_launcher", }, + "lacros_chrome_browsertests": { + "label": "//chrome/test:lacros_chrome_browsertests", + "type": "windowed_test_launcher", + }, "latency_unittests": { "label": "//ui/latency:latency_unittests", "type": "console_test_launcher",
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 496287a..2212826 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -3434,9 +3434,14 @@ 'shards': 3, }, }, + 'lacros_chrome_browsertests': {}, 'unit_tests': {}, }, + 'linux_lacros_specific_gtests': { + 'lacros_chrome_browsertests': {}, + }, + 'linux_ozone_common_gtests': { 'content_unittests': {}, 'events_unittests': {}, @@ -5466,12 +5471,14 @@ # This is: # linux_chromeos_gtests # - linux_chromeos_specific_gtests + # + linux_lacros_specific_gtests 'aura_gtests', 'chromium_gtests', 'chromium_gtests_for_devices_with_graphical_output', 'chromium_gtests_for_linux_and_chromeos_only', 'chromium_gtests_for_win_and_linux_only', 'linux_flavor_specific_chromium_gtests', + 'linux_lacros_specific_gtests', 'non_android_chromium_gtests', 'storage_service_gtests', ],
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index fce1e62..919b9df7 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -2394,6 +2394,14 @@ 'gtest_tests': 'fieldtrial_browser_tests', }, }, + 'linux-inverse-fieldtrials-fyi-rel': { + 'mixins': [ + 'linux-xenial', + ], + 'test_suites': { + 'gtest_tests': 'chromium_linux_gtests', + }, + }, 'linux-lacros-tester-fyi-rel': { 'additional_compile_targets': [ 'chrome',
diff --git a/testing/scripts/common.py b/testing/scripts/common.py index ea67b5c..0d0811a 100644 --- a/testing/scripts/common.py +++ b/testing/scripts/common.py
@@ -324,6 +324,9 @@ def clean_up_after_test_run(self): pass + def do_pre_test_run_tasks(self): + pass + def do_post_test_run_tasks(self): pass @@ -331,6 +334,8 @@ self.parse_args() cmd = self.generate_isolated_script_cmd() + self.do_pre_test_run_tasks() + env = os.environ.copy() # Assume we want to set up the sandbox environment variables all the
diff --git a/testing/scripts/run_wpt_tests.py b/testing/scripts/run_wpt_tests.py index 73aee342..c4300196 100755 --- a/testing/scripts/run_wpt_tests.py +++ b/testing/scripts/run_wpt_tests.py
@@ -37,7 +37,8 @@ "--venv=../../", "--skip-venv-setup", "run", - "chrome", + "chrome" + ] + self.options.test_list + [ "--binary=../../out/Release/chrome", "--binary-arg=--host-resolver-rules=" "MAP nonexistent.*.test ~NOTFOUND, MAP *.test 127.0.0.1", @@ -80,19 +81,25 @@ ]) return rest_args -def main(): - # First, generate WPT metadata files. - common.run_command([ - sys.executable, - os.path.join(wpt_common.BLINK_TOOLS_DIR, 'build_wpt_metadata.py'), - "--metadata-output-dir", - WPT_METADATA_OUTPUT_DIR, - "--additional-expectations", - WPT_OVERRIDE_EXPECTATIONS_PATH, - "--checked-in-metadata-dir", - WPT_CHECKED_IN_METADATA_DIR - ]) + def add_extra_arguments(self, parser): + parser.add_argument('test_list', nargs="*", + help="List of tests or test directories to run") + def do_pre_test_run_tasks(self): + # Generate WPT metadata files. + common.run_command([ + sys.executable, + os.path.join(wpt_common.BLINK_TOOLS_DIR, 'build_wpt_metadata.py'), + "--metadata-output-dir", + WPT_METADATA_OUTPUT_DIR, + "--additional-expectations", + WPT_OVERRIDE_EXPECTATIONS_PATH, + "--checked-in-metadata-dir", + WPT_CHECKED_IN_METADATA_DIR + ]) + + +def main(): adapter = WPTTestAdapter() return adapter.run_test()
diff --git a/third_party/blink/common/web_preferences/web_preferences.cc b/third_party/blink/common/web_preferences/web_preferences.cc index f383200..d28ac17b 100644 --- a/third_party/blink/common/web_preferences/web_preferences.cc +++ b/third_party/blink/common/web_preferences/web_preferences.cc
@@ -8,7 +8,6 @@ #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "third_party/blink/public/common/features.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/web/web_settings.h" #include "ui/base/ui_base_switches_util.h" @@ -30,6 +29,10 @@ // "Zyyy" is the ISO 15924 script code for undetermined script aka Common. const char kCommonScript[] = "Zyyy"; +#define STATIC_ASSERT_ENUM(a, b) \ + static_assert(static_cast<int>(a) == static_cast<int>(b), \ + "mismatching enums: " #a) + STATIC_ASSERT_ENUM(EDITING_BEHAVIOR_MAC, WebSettings::EditingBehavior::kMac); STATIC_ASSERT_ENUM(EDITING_BEHAVIOR_WIN, WebSettings::EditingBehavior::kWin); STATIC_ASSERT_ENUM(EDITING_BEHAVIOR_UNIX, WebSettings::EditingBehavior::kUnix); @@ -38,6 +41,17 @@ STATIC_ASSERT_ENUM(EDITING_BEHAVIOR_CHROMEOS, WebSettings::EditingBehavior::kChromeOS); +STATIC_ASSERT_ENUM(blink::mojom::V8CacheOptions::kDefault, + WebSettings::V8CacheOptions::kDefault); +STATIC_ASSERT_ENUM(blink::mojom::V8CacheOptions::kNone, + WebSettings::V8CacheOptions::kNone); +STATIC_ASSERT_ENUM(blink::mojom::V8CacheOptions::kCode, + WebSettings::V8CacheOptions::kCode); +STATIC_ASSERT_ENUM(blink::mojom::V8CacheOptions::kCodeWithoutHeatCheck, + WebSettings::V8CacheOptions::kCodeWithoutHeatCheck); +STATIC_ASSERT_ENUM(blink::mojom::V8CacheOptions::kFullCodeWithoutHeatCheck, + WebSettings::V8CacheOptions::kFullCodeWithoutHeatCheck); + STATIC_ASSERT_ENUM(IMAGE_ANIMATION_POLICY_ALLOWED, WebSettings::ImageAnimationPolicy::kAllowed); STATIC_ASSERT_ENUM(IMAGE_ANIMATION_POLICY_ANIMATION_ONCE, @@ -167,7 +181,7 @@ #endif spatial_navigation_enabled(false), navigate_on_drag_drop(true), - v8_cache_options(mojom::blink::V8CacheOptions::kDefault), + v8_cache_options(blink::mojom::V8CacheOptions::kDefault), record_whole_document(false), cookie_enabled(true), accelerated_video_decode_enabled(false),
diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h index 94716578a5..7da6f4d 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h
@@ -15,7 +15,7 @@ #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" #include "third_party/blink/public/common/css/preferred_color_scheme.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-forward.h" +#include "third_party/blink/public/mojom/v8_cache_options.mojom.h" #include "ui/base/pointer/pointer_device.h" #include "url/gurl.h"
diff --git a/third_party/blink/public/mojom/page/widget.mojom b/third_party/blink/public/mojom/page/widget.mojom index 0774f572..2d458823 100644 --- a/third_party/blink/public/mojom/page/widget.mojom +++ b/third_party/blink/public/mojom/page/widget.mojom
@@ -9,6 +9,7 @@ import "mojo/public/mojom/base/string16.mojom"; import "mojo/public/mojom/base/text_direction.mojom"; import "services/viz/public/mojom/compositing/local_surface_id_allocation.mojom"; +import "services/viz/public/mojom/hit_test/input_target_client.mojom"; import "third_party/blink/public/mojom/frame/intrinsic_sizing_info.mojom"; import "third_party/blink/public/mojom/input/input_handler.mojom"; import "third_party/blink/public/mojom/page/drag.mojom"; @@ -102,6 +103,9 @@ // Binds an WidgetCompositor interface. BindWidgetCompositor(pending_receiver<WidgetCompositor> host); + + // Binds an InputTargetClient interface. + BindInputTargetClient(pending_receiver<viz.mojom.InputTargetClient> host); }; // Implemented in Browser, this interface defines frame-widget-specific methods that
diff --git a/third_party/blink/public/web/web_hit_test_result.h b/third_party/blink/public/web/web_hit_test_result.h index c1056f93..1893e76 100644 --- a/third_party/blink/public/web/web_hit_test_result.h +++ b/third_party/blink/public/web/web_hit_test_result.h
@@ -53,13 +53,6 @@ // The node that was hit (only one for point-based tests). BLINK_EXPORT WebNode GetNode() const; - // Coordinates of the point that was hit. Relative to the node, but with - // ContentBoxOffset removed if the node has box layout. - BLINK_EXPORT gfx::PointF LocalPointWithoutContentBoxOffset() const; - - // Returns whether the content box contains the hit test point. - BLINK_EXPORT bool ContentBoxContainsPoint() const; - // If a link (eg. anchor or area tag) is hit, return the element. // Return null otheriwse. BLINK_EXPORT WebElement UrlElement() const;
diff --git a/third_party/blink/public/web/web_remote_frame_client.h b/third_party/blink/public/web/web_remote_frame_client.h index 23c5555..6aa5968 100644 --- a/third_party/blink/public/web/web_remote_frame_client.h +++ b/third_party/blink/public/web/web_remote_frame_client.h
@@ -7,6 +7,7 @@ #include "base/optional.h" #include "cc/paint/paint_canvas.h" +#include "components/viz/common/surfaces/frame_sink_id.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/mojom/blob/blob_url_store.mojom-shared.h" #include "third_party/blink/public/mojom/frame/lifecycle.mojom-shared.h" @@ -84,6 +85,11 @@ virtual void DidChangeVisibleViewportSize( const gfx::Size& visible_viewport_size) {} + virtual viz::FrameSinkId GetFrameSinkId() { + NOTREACHED(); + return viz::FrameSinkId(); + } + protected: virtual ~WebRemoteFrameClient() = default; };
diff --git a/third_party/blink/public/web/web_settings.h b/third_party/blink/public/web/web_settings.h index 5db081d3..65625b3c 100644 --- a/third_party/blink/public/web/web_settings.h +++ b/third_party/blink/public/web/web_settings.h
@@ -36,7 +36,6 @@ #include "third_party/blink/public/common/css/navigation_controls.h" #include "third_party/blink/public/common/css/preferred_color_scheme.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-forward.h" #include "third_party/blink/public/platform/pointer_properties.h" #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_effective_connection_type.h" @@ -57,6 +56,14 @@ enum class EditingBehavior { kMac, kWin, kUnix, kAndroid, kChromeOS }; + enum class V8CacheOptions { + kDefault, + kNone, + kCode, + kCodeWithoutHeatCheck, + kFullCodeWithoutHeatCheck + }; + // Selection strategy defines how the selection granularity changes when the // selection extent is moved. enum class SelectionStrategyType { @@ -248,7 +255,7 @@ virtual void SetUseLegacyBackgroundSizeShorthandBehavior(bool) = 0; virtual void SetViewportStyle(WebViewportStyle) = 0; virtual void SetUseWideViewport(bool) = 0; - virtual void SetV8CacheOptions(mojom::V8CacheOptions) = 0; + virtual void SetV8CacheOptions(V8CacheOptions) = 0; virtual void SetValidationMessageTimerMagnification(int) = 0; virtual void SetViewportEnabled(bool) = 0; virtual void SetViewportMetaEnabled(bool) = 0;
diff --git a/third_party/blink/renderer/bindings/bindings.gni b/third_party/blink/renderer/bindings/bindings.gni index 03a710ea..20ca0bb 100644 --- a/third_party/blink/renderer/bindings/bindings.gni +++ b/third_party/blink/renderer/bindings/bindings.gni
@@ -121,6 +121,7 @@ "core/v8/v0_custom_element_constructor_builder.h", "core/v8/v8_binding_for_core.cc", "core/v8/v8_binding_for_core.h", + "core/v8/v8_cache_options.h", "core/v8/v8_code_cache.cc", "core/v8/v8_code_cache.h", "core/v8/v8_context_snapshot.cc",
diff --git a/third_party/blink/renderer/bindings/core/v8/module_record.cc b/third_party/blink/renderer/bindings/core/v8/module_record.cc index a7d216ef..9c359c2 100644 --- a/third_party/blink/renderer/bindings/core/v8/module_record.cc +++ b/third_party/blink/renderer/bindings/core/v8/module_record.cc
@@ -5,7 +5,6 @@ #include "third_party/blink/renderer/bindings/core/v8/module_record.h" #include "base/feature_list.h" #include "third_party/blink/public/common/features.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/boxed_v8_module.h" #include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" @@ -94,7 +93,7 @@ const ScriptFetchOptions& options, const TextPosition& text_position, ExceptionState& exception_state, - mojom::blink::V8CacheOptions v8_cache_options, + V8CacheOptions v8_cache_options, SingleCachedMetadataHandler* cache_handler, ScriptSourceLocationType source_location_type, ModuleRecordProduceCacheData** out_produce_cache_data) { @@ -102,11 +101,10 @@ v8::Local<v8::Module> module; // Module scripts currently don't support |kEagerCompile| which can be - // used for |mojom::blink::V8CacheOptions::kFullCodeWithoutHeatCheck|, so use - // |mojom::blink::V8CacheOptions::kCodeWithoutHeatCheck| instead. - if (v8_cache_options == - mojom::blink::V8CacheOptions::kFullCodeWithoutHeatCheck) { - v8_cache_options = mojom::blink::V8CacheOptions::kCodeWithoutHeatCheck; + // used for |kV8CacheOptionsFullCodeWithoutHeatCheck|, so use + // |kV8CacheOptionsCodeWithoutHeatCheck| instead. + if (v8_cache_options == kV8CacheOptionsFullCodeWithoutHeatCheck) { + v8_cache_options = kV8CacheOptionsCodeWithoutHeatCheck; } v8::ScriptCompiler::CompileOptions compile_options;
diff --git a/third_party/blink/renderer/bindings/core/v8/module_record.h b/third_party/blink/renderer/bindings/core/v8/module_record.h index b1c69aef2..4a1ed78 100644 --- a/third_party/blink/renderer/bindings/core/v8/module_record.h +++ b/third_party/blink/renderer/bindings/core/v8/module_record.h
@@ -109,7 +109,7 @@ const ScriptFetchOptions&, const TextPosition&, ExceptionState&, - mojom::blink::V8CacheOptions = mojom::blink::V8CacheOptions::kDefault, + V8CacheOptions = kV8CacheOptionsDefault, SingleCachedMetadataHandler* = nullptr, ScriptSourceLocationType source_location_type = ScriptSourceLocationType::kInternal,
diff --git a/third_party/blink/renderer/bindings/core/v8/script_controller.cc b/third_party/blink/renderer/bindings/core/v8/script_controller.cc index 67c6e557b..5b3824e 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_controller.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_controller.cc
@@ -36,7 +36,6 @@ #include <utility> #include "base/bind_helpers.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/web/web_settings.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" @@ -100,8 +99,7 @@ GetFrame(), source.Url().GetString(), source.StartPosition())); v8::Local<v8::Value> result; { - mojom::blink::V8CacheOptions v8_cache_options = - mojom::blink::V8CacheOptions::kDefault; + V8CacheOptions v8_cache_options = kV8CacheOptionsDefault; if (const Settings* settings = GetFrame()->GetSettings()) v8_cache_options = settings->GetV8CacheOptions(); @@ -115,7 +113,7 @@ if (!V8ScriptRunner::CompileAndRunScript( GetIsolate(), ScriptState::From(context), GetFrame()->DomWindow(), source, base_url, sanitize_script_errors, fetch_options, - std::move(v8_cache_options)) + v8_cache_options) .ToLocal(&result)) { return result; }
diff --git a/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc b/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc index a8b60a11..9579f34 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc
@@ -233,8 +233,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); EXPECT_TRUE(V8ScriptRunner::CompileScript( scope.GetScriptState(), source_code, SanitizeScriptErrors::kDoNotSanitize, compile_options, @@ -270,8 +269,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); EXPECT_FALSE(V8ScriptRunner::CompileScript( scope.GetScriptState(), source_code, SanitizeScriptErrors::kDoNotSanitize, compile_options, @@ -422,8 +420,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); EXPECT_TRUE(V8ScriptRunner::CompileScript( scope.GetScriptState(), source_code, SanitizeScriptErrors::kDoNotSanitize, compile_options, @@ -458,8 +455,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); EXPECT_TRUE(V8ScriptRunner::CompileScript( scope.GetScriptState(), source_code, SanitizeScriptErrors::kDoNotSanitize, compile_options, @@ -495,8 +491,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); EXPECT_TRUE(V8ScriptRunner::CompileScript( scope.GetScriptState(), source_code, SanitizeScriptErrors::kDoNotSanitize, compile_options,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_cache_options.h b/third_party/blink/renderer/bindings/core/v8/v8_cache_options.h new file mode 100644 index 0000000..8f71e72 --- /dev/null +++ b/third_party/blink/renderer/bindings/core/v8/v8_cache_options.h
@@ -0,0 +1,48 @@ +/* + * Copyright (C) 2014 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_CACHE_OPTIONS_H_ +#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_CACHE_OPTIONS_H_ + +namespace blink { + +enum V8CacheOptions { + kV8CacheOptionsDefault, // Use whatever the current default is. + kV8CacheOptionsNone, // V8 caching turned off. + kV8CacheOptionsCode, // Use code caching. + // Generate the code cache in the first load. + kV8CacheOptionsCodeWithoutHeatCheck, + // Generate the full code cache in the first load. + kV8CacheOptionsFullCodeWithoutHeatCheck, +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_CACHE_OPTIONS_H_
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc b/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc index 44c1182..11d6e43 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc
@@ -6,7 +6,6 @@ #include "base/optional.h" #include "build/build_config.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/web/web_settings.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" #include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" @@ -89,7 +88,7 @@ std::tuple<v8::ScriptCompiler::CompileOptions, V8CodeCache::ProduceCacheOptions, v8::ScriptCompiler::NoCacheReason> -V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions cache_options, +V8CodeCache::GetCompileOptions(V8CacheOptions cache_options, const ScriptSourceCode& source) { return GetCompileOptions(cache_options, source.CacheHandler(), source.Source().length(), @@ -99,7 +98,7 @@ std::tuple<v8::ScriptCompiler::CompileOptions, V8CodeCache::ProduceCacheOptions, v8::ScriptCompiler::NoCacheReason> -V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions cache_options, +V8CodeCache::GetCompileOptions(V8CacheOptions cache_options, const SingleCachedMetadataHandler* cache_handler, size_t source_text_length, ScriptSourceLocationType source_location_type) { @@ -130,7 +129,7 @@ no_cache_reason); } - if (cache_options == mojom::blink::V8CacheOptions::kNone) { + if (cache_options == kV8CacheOptionsNone) { no_cache_reason = v8::ScriptCompiler::kNoCacheBecauseCachingDisabled; return std::make_tuple(v8::ScriptCompiler::kNoCompileOptions, ProduceCacheOptions::kNoProduceCache, @@ -153,11 +152,11 @@ // If the resource is served from CacheStorage, generate the V8 code cache in // the first load. if (cache_handler->IsServedFromCacheStorage()) - cache_options = mojom::blink::V8CacheOptions::kCodeWithoutHeatCheck; + cache_options = kV8CacheOptionsCodeWithoutHeatCheck; switch (cache_options) { - case mojom::blink::V8CacheOptions::kDefault: - case mojom::blink::V8CacheOptions::kCode: + case kV8CacheOptionsDefault: + case kV8CacheOptionsCode: if (!IsResourceHotForCaching(cache_handler)) { return std::make_tuple(v8::ScriptCompiler::kNoCompileOptions, ProduceCacheOptions::kSetTimeStamp, @@ -167,17 +166,17 @@ v8::ScriptCompiler::kNoCompileOptions, ProduceCacheOptions::kProduceCodeCache, v8::ScriptCompiler::kNoCacheBecauseDeferredProduceCodeCache); - case mojom::blink::V8CacheOptions::kCodeWithoutHeatCheck: + case kV8CacheOptionsCodeWithoutHeatCheck: return std::make_tuple( v8::ScriptCompiler::kNoCompileOptions, ProduceCacheOptions::kProduceCodeCache, v8::ScriptCompiler::kNoCacheBecauseDeferredProduceCodeCache); - case mojom::blink::V8CacheOptions::kFullCodeWithoutHeatCheck: + case kV8CacheOptionsFullCodeWithoutHeatCheck: return std::make_tuple( v8::ScriptCompiler::kEagerCompile, ProduceCacheOptions::kProduceCodeCache, v8::ScriptCompiler::kNoCacheBecauseDeferredProduceCodeCache); - case mojom::blink::V8CacheOptions::kNone: + case kV8CacheOptionsNone: // Shouldn't happen, as this is handled above. // Case is here so that compiler can check all cases are handled. NOTREACHED(); @@ -366,4 +365,13 @@ return cached_metadata; } +STATIC_ASSERT_ENUM(WebSettings::V8CacheOptions::kDefault, + kV8CacheOptionsDefault); +STATIC_ASSERT_ENUM(WebSettings::V8CacheOptions::kNone, kV8CacheOptionsNone); +STATIC_ASSERT_ENUM(WebSettings::V8CacheOptions::kCode, kV8CacheOptionsCode); +STATIC_ASSERT_ENUM(WebSettings::V8CacheOptions::kCodeWithoutHeatCheck, + kV8CacheOptionsCodeWithoutHeatCheck); +STATIC_ASSERT_ENUM(WebSettings::V8CacheOptions::kFullCodeWithoutHeatCheck, + kV8CacheOptionsFullCodeWithoutHeatCheck); + } // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_code_cache.h b/third_party/blink/renderer/bindings/core/v8/v8_code_cache.h index f7bb3dc..b2fdcfe 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_code_cache.h +++ b/third_party/blink/renderer/bindings/core/v8/v8_code_cache.h
@@ -7,8 +7,8 @@ #include <stdint.h> -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_location_type.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/v8_binding_macros.h" @@ -55,11 +55,11 @@ static std::tuple<v8::ScriptCompiler::CompileOptions, ProduceCacheOptions, v8::ScriptCompiler::NoCacheReason> - GetCompileOptions(mojom::blink::V8CacheOptions, const ScriptSourceCode&); + GetCompileOptions(V8CacheOptions, const ScriptSourceCode&); static std::tuple<v8::ScriptCompiler::CompileOptions, ProduceCacheOptions, v8::ScriptCompiler::NoCacheReason> - GetCompileOptions(mojom::blink::V8CacheOptions, + GetCompileOptions(V8CacheOptions, const SingleCachedMetadataHandler*, size_t source_text_length, ScriptSourceLocationType);
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc b/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc index 223c8e0..79fdcb5 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc
@@ -28,7 +28,6 @@ #include "base/feature_list.h" #include "build/build_config.h" #include "third_party/blink/public/common/features.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/binding_security.h" #include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" @@ -372,7 +371,7 @@ const KURL& base_url, SanitizeScriptErrors sanitize_script_errors, const ScriptFetchOptions& fetch_options, - mojom::blink::V8CacheOptions v8_cache_options) { + V8CacheOptions v8_cache_options) { DCHECK_EQ(isolate, script_state->GetIsolate()); // Omit storing base URL if it is same as source URL. @@ -433,8 +432,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); // Currently internal scripts don't have cache handlers. So we should not // produce cache for them. DCHECK_EQ(produce_cache_options,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_script_runner.h b/third_party/blink/renderer/bindings/core/v8/v8_script_runner.h index 46f480299..42d9eb8 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_script_runner.h +++ b/third_party/blink/renderer/bindings/core/v8/v8_script_runner.h
@@ -26,8 +26,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_SCRIPT_RUNNER_H_ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_SCRIPT_RUNNER_H_ -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/forward.h" @@ -77,7 +77,7 @@ const KURL&, SanitizeScriptErrors, const ScriptFetchOptions&, - mojom::blink::V8CacheOptions); + V8CacheOptions); static v8::MaybeLocal<v8::Value> CompileAndRunInternalScript( v8::Isolate*, ScriptState*,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc b/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc index d9d550e..acfd0cca 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc
@@ -61,7 +61,7 @@ bool CompileScript(v8::Isolate* isolate, ScriptState* script_state, const ScriptSourceCode& source_code, - mojom::blink::V8CacheOptions cache_options) { + V8CacheOptions cache_options) { v8::ScriptCompiler::CompileOptions compile_options; V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; @@ -158,9 +158,9 @@ ScriptSourceCode source_code(Code(), ScriptSourceLocationType::kInternal, nullptr /* cache_handler */, Url()); EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, mojom::blink::V8CacheOptions::kNone)); + source_code, kV8CacheOptionsNone)); EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, mojom::blink::V8CacheOptions::kCode)); + source_code, kV8CacheOptionsCode)); } TEST_F(V8ScriptRunnerTest, emptyResourceDoesNotHaveCacheHandler) { @@ -177,7 +177,7 @@ SetCacheTimeStamp(cache_handler); EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, mojom::blink::V8CacheOptions::kCode)); + source_code, kV8CacheOptionsCode)); EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); // The cached data is associated with the encoding. @@ -200,7 +200,7 @@ // Warm run - should produce code cache. EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, mojom::blink::V8CacheOptions::kCode)); + source_code, kV8CacheOptionsCode)); // Check the produced cache is for code cache. EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); @@ -210,8 +210,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); EXPECT_EQ(produce_cache_options, V8CodeCache::ProduceCacheOptions::kNoProduceCache); EXPECT_EQ(compile_options, @@ -235,7 +234,7 @@ // Warm run - should produce code cache. EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, mojom::blink::V8CacheOptions::kCode)); + source_code, kV8CacheOptionsCode)); // Check the produced cache is for code cache. EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); @@ -247,8 +246,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); EXPECT_EQ(1, counter.GetTotal()); EXPECT_EQ(1, counter.GetPresent()); EXPECT_EQ(produce_cache_options, @@ -277,16 +275,14 @@ // Cold run - should set the timestamp. EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, - mojom::blink::V8CacheOptions::kDefault)); + source_code, kV8CacheOptionsDefault)); EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForTimeStamp(cache_handler))); EXPECT_FALSE( cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); // Warm run - should produce code cache. EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, - mojom::blink::V8CacheOptions::kDefault)); + source_code, kV8CacheOptionsDefault)); EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); // Hot run - should consume code cache. @@ -294,8 +290,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); EXPECT_EQ(produce_cache_options, V8CodeCache::ProduceCacheOptions::kNoProduceCache); EXPECT_EQ(compile_options, @@ -317,16 +312,14 @@ // Cold run - should set the timestamp. EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, - mojom::blink::V8CacheOptions::kDefault)); + source_code, kV8CacheOptionsDefault)); EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForTimeStamp(cache_handler))); EXPECT_FALSE( cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); // Warm run - should produce code cache. EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, - mojom::blink::V8CacheOptions::kDefault)); + source_code, kV8CacheOptionsDefault)); EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForCodeCache(cache_handler))); // Hot run - should consume code cache. @@ -334,8 +327,7 @@ V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(mojom::blink::V8CacheOptions::kDefault, - source_code); + V8CodeCache::GetCompileOptions(kV8CacheOptionsDefault, source_code); EXPECT_EQ(produce_cache_options, V8CodeCache::ProduceCacheOptions::kNoProduceCache); EXPECT_EQ(compile_options, @@ -374,8 +366,7 @@ EXPECT_FALSE( cache_handler->GetCachedMetadata(TagForTimeStamp(cache_handler))); EXPECT_TRUE(CompileScript(scope.GetIsolate(), scope.GetScriptState(), - source_code, - mojom::blink::V8CacheOptions::kDefault)); + source_code, kV8CacheOptionsDefault)); EXPECT_TRUE(cache_handler->GetCachedMetadata(TagForTimeStamp(cache_handler))); base::HistogramTester tester; HistogramCounter counter(tester);
diff --git a/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc b/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc index cb3ee3b..b1f64a2 100644 --- a/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc +++ b/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc
@@ -315,7 +315,7 @@ ClassicEvaluationResult WorkerOrWorkletScriptController::EvaluateAndReturnValue( const ScriptSourceCode& source_code, SanitizeScriptErrors sanitize_script_errors, - mojom::blink::V8CacheOptions v8_cache_options, + V8CacheOptions v8_cache_options, RethrowErrorsOption rethrow_errors) { if (IsExecutionForbidden()) return ClassicEvaluationResult();
diff --git a/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h b/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h index 14ce99f..23fc7bdfc 100644 --- a/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h +++ b/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h
@@ -32,12 +32,12 @@ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_WORKER_OR_WORKLET_SCRIPT_CONTROLLER_H_ #include "base/macros.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/classic_evaluation_result.h" #include "third_party/blink/renderer/bindings/core/v8/rejected_promises.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" @@ -99,7 +99,7 @@ ClassicEvaluationResult EvaluateAndReturnValue( const ScriptSourceCode&, SanitizeScriptErrors sanitize_script_errors, - mojom::blink::V8CacheOptions = mojom::blink::V8CacheOptions::kDefault, + V8CacheOptions = kV8CacheOptionsDefault, RethrowErrorsOption = RethrowErrorsOption::DoNotRethrow()); // Prevents future JavaScript execution.
diff --git a/third_party/blink/renderer/core/exported/web_hit_test_result.cc b/third_party/blink/renderer/core/exported/web_hit_test_result.cc index 371f2347..508c5b0 100644 --- a/third_party/blink/renderer/core/exported/web_hit_test_result.cc +++ b/third_party/blink/renderer/core/exported/web_hit_test_result.cc
@@ -61,26 +61,6 @@ return WebNode(private_->Result().InnerNode()); } -gfx::PointF WebHitTestResult::LocalPointWithoutContentBoxOffset() const { - FloatPoint local_point = FloatPoint(private_->Result().LocalPoint()); - LayoutObject* object = private_->Result().GetLayoutObject(); - if (object->IsBox()) { - LayoutBox* box = ToLayoutBox(object); - local_point.MoveBy(-FloatPoint(box->PhysicalContentBoxOffset())); - } - return local_point; -} - -bool WebHitTestResult::ContentBoxContainsPoint() const { - LayoutObject* object = private_->Result().GetLayoutObject(); - DCHECK(object); - if (!object->IsBox()) - return false; - - IntPoint local_point = RoundedIntPoint(private_->Result().LocalPoint()); - return ToLayoutBox(object)->ComputedCSSContentBoxRect().Contains(local_point); -} - WebElement WebHitTestResult::UrlElement() const { return WebElement(private_->Result().URLElement()); }
diff --git a/third_party/blink/renderer/core/exported/web_settings_impl.cc b/third_party/blink/renderer/core/exported/web_settings_impl.cc index 603c329..eb5f6065 100644 --- a/third_party/blink/renderer/core/exported/web_settings_impl.cc +++ b/third_party/blink/renderer/core/exported/web_settings_impl.cc
@@ -660,8 +660,8 @@ dev_tools_emulator_->SetMainFrameResizesAreOrientationChanges(enabled); } -void WebSettingsImpl::SetV8CacheOptions(mojom::blink::V8CacheOptions options) { - settings_->SetV8CacheOptions(options); +void WebSettingsImpl::SetV8CacheOptions(V8CacheOptions options) { + settings_->SetV8CacheOptions(static_cast<blink::V8CacheOptions>(options)); } void WebSettingsImpl::SetViewportStyle(WebViewportStyle style) {
diff --git a/third_party/blink/renderer/core/exported/web_settings_impl.h b/third_party/blink/renderer/core/exported/web_settings_impl.h index f38a70a4..d796fea 100644 --- a/third_party/blink/renderer/core/exported/web_settings_impl.h +++ b/third_party/blink/renderer/core/exported/web_settings_impl.h
@@ -31,7 +31,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EXPORTED_WEB_SETTINGS_IMPL_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_EXPORTED_WEB_SETTINGS_IMPL_H_ -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/web/web_settings.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/heap/persistent.h" @@ -184,7 +183,7 @@ void SetUseLegacyBackgroundSizeShorthandBehavior(bool) override; void SetViewportStyle(WebViewportStyle) override; void SetUseWideViewport(bool) override; - void SetV8CacheOptions(mojom::blink::V8CacheOptions) override; + void SetV8CacheOptions(V8CacheOptions) override; void SetValidationMessageTimerMagnification(int) override; void SetViewportEnabled(bool) override; void SetViewportMetaEnabled(bool) override;
diff --git a/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc b/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc index 104e677..e15c6f29 100644 --- a/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc +++ b/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc
@@ -42,7 +42,6 @@ #include "third_party/blink/public/mojom/loader/fetch_client_settings_object.mojom-blink.h" #include "third_party/blink/public/mojom/script/script_type.mojom-blink.h" #include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom-blink.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_content_settings_client.h" @@ -51,6 +50,7 @@ #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/public/platform/web_worker_fetch_context.h" #include "third_party/blink/public/web/web_settings.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/events/message_event.h" #include "third_party/blink/renderer/core/inspector/console_message.h" @@ -266,7 +266,7 @@ std::move(content_settings)), base::nullopt /* response_address_space */, nullptr /* origin_trial_tokens */, devtools_worker_token, - std::move(worker_settings), mojom::blink::V8CacheOptions::kDefault, + std::move(worker_settings), kV8CacheOptionsDefault, nullptr /* worklet_module_response_map */, std::move(browser_interface_broker), BeginFrameProviderParams(), nullptr /* parent_feature_policy */, base::UnguessableToken());
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 8fba56a..4e29b67 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -1996,7 +1996,8 @@ settings->SetSelectionIncludesAltImageText(true); - settings->SetV8CacheOptions(prefs.v8_cache_options); + settings->SetV8CacheOptions( + static_cast<WebSettings::V8CacheOptions>(prefs.v8_cache_options)); settings->SetImageAnimationPolicy( static_cast<WebSettings::ImageAnimationPolicy>(prefs.animation_policy));
diff --git a/third_party/blink/renderer/core/frame/DEPS b/third_party/blink/renderer/core/frame/DEPS index 396843d..9e96bfb 100644 --- a/third_party/blink/renderer/core/frame/DEPS +++ b/third_party/blink/renderer/core/frame/DEPS
@@ -5,6 +5,9 @@ "frame_view.cc": [ "+ui/gfx/transform.h" ], + "frame_test_helpers.h": [ + "+components/viz/common/surfaces/frame_sink_id.h" + ], "local_frame_back_forward_cache_test.cc": [ "+base/run_loop.h", ], @@ -30,6 +33,7 @@ "+cc/trees/swap_promise.h", ], "web_frame_widget_base.h": [ + "+services/viz/public/mojom/hit_test/input_target_client.mojom-blink.h", "+ui/base/mojom/ui_base_types.mojom-shared.h", ], "web_frame_widget_test.cc": [
diff --git a/third_party/blink/renderer/core/frame/frame_test_helpers.cc b/third_party/blink/renderer/core/frame/frame_test_helpers.cc index 0ba9a9e..3140210 100644 --- a/third_party/blink/renderer/core/frame/frame_test_helpers.cc +++ b/third_party/blink/renderer/core/frame/frame_test_helpers.cc
@@ -117,6 +117,9 @@ return owned_client.get(); } +// A static increasing count of frame sinks created so they are all unique. +static uint32_t s_frame_sink_count = 0; + } // namespace cc::LayerTreeSettings GetSynchronousSingleThreadLayerTreeSettings() { @@ -747,7 +750,8 @@ self_owned_.reset(); } -TestWebWidgetClient::TestWebWidgetClient() = default; +TestWebWidgetClient::TestWebWidgetClient() + : frame_sink_id_(viz::FrameSinkId(++s_frame_sink_count, 1)) {} void TestWebWidgetClient::SetFrameWidget( WebFrameWidget* widget, @@ -781,7 +785,7 @@ } viz::FrameSinkId TestWebWidgetClient::GetFrameSinkId() { - return viz::FrameSinkId(); + return frame_sink_id_; } void TestWebWidgetClient::RequestNewLayerTreeFrameSink(
diff --git a/third_party/blink/renderer/core/frame/frame_test_helpers.h b/third_party/blink/renderer/core/frame/frame_test_helpers.h index 396e417..2a9f90c5 100644 --- a/third_party/blink/renderer/core/frame/frame_test_helpers.h +++ b/third_party/blink/renderer/core/frame/frame_test_helpers.h
@@ -40,6 +40,7 @@ #include "base/memory/weak_ptr.h" #include "cc/test/test_task_graph_runner.h" #include "cc/trees/layer_tree_host.h" +#include "components/viz/common/surfaces/frame_sink_id.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" @@ -257,6 +258,7 @@ injected_scroll_events_; std::unique_ptr<TestWidgetInputHandlerHost> widget_input_handler_host_; bool animation_scheduled_ = false; + viz::FrameSinkId frame_sink_id_; mojo::AssociatedReceiver<mojom::blink::WidgetHost> receiver_{this}; };
diff --git a/third_party/blink/renderer/core/frame/remote_frame.cc b/third_party/blink/renderer/core/frame/remote_frame.cc index e8e417d..71e311e5 100644 --- a/third_party/blink/renderer/core/frame/remote_frame.cc +++ b/third_party/blink/renderer/core/frame/remote_frame.cc
@@ -753,6 +753,10 @@ &RemoteFrame::BindToMainFrameReceiver, WrapWeakPersistent(this))); } +viz::FrameSinkId RemoteFrame::GetFrameSinkId() { + return Client()->GetFrameSinkId(); +} + bool RemoteFrame::IsIgnoredForHitTest() const { HTMLFrameOwnerElement* owner = DeprecatedLocalOwner(); if (!owner || !owner->GetLayoutObject())
diff --git a/third_party/blink/renderer/core/frame/remote_frame.h b/third_party/blink/renderer/core/frame/remote_frame.h index ce345fa3..64cb32d 100644 --- a/third_party/blink/renderer/core/frame/remote_frame.h +++ b/third_party/blink/renderer/core/frame/remote_frame.h
@@ -23,6 +23,10 @@ class Layer; } +namespace viz { +class FrameSinkId; +} + namespace blink { class AssociatedInterfaceProvider; @@ -188,6 +192,8 @@ return RemoteFrameToken(GetFrameToken()); } + viz::FrameSinkId GetFrameSinkId(); + private: // Frame protected overrides: void DetachImpl(FrameDetachType) override;
diff --git a/third_party/blink/renderer/core/frame/remote_frame_client.h b/third_party/blink/renderer/core/frame/remote_frame_client.h index acf457d..b7906f4 100644 --- a/third_party/blink/renderer/core/frame/remote_frame_client.h +++ b/third_party/blink/renderer/core/frame/remote_frame_client.h
@@ -15,6 +15,10 @@ #include "third_party/blink/renderer/core/frame/frame_types.h" #include "third_party/blink/renderer/platform/graphics/touch_action.h" +namespace viz { +class FrameSinkId; +} + namespace blink { class AssociatedInterfaceProvider; class IntRect; @@ -62,6 +66,8 @@ const ViewportIntersectionState& intersection_state) = 0; virtual AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() = 0; + + virtual viz::FrameSinkId GetFrameSinkId() = 0; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/frame/remote_frame_client_impl.cc b/third_party/blink/renderer/core/frame/remote_frame_client_impl.cc index 724d334..862b567 100644 --- a/third_party/blink/renderer/core/frame/remote_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/remote_frame_client_impl.cc
@@ -148,4 +148,8 @@ return web_frame_->Client()->GetRemoteAssociatedInterfaces(); } +viz::FrameSinkId RemoteFrameClientImpl::GetFrameSinkId() { + return web_frame_->Client()->GetFrameSinkId(); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/frame/remote_frame_client_impl.h b/third_party/blink/renderer/core/frame/remote_frame_client_impl.h index f6ce586d..137bed97 100644 --- a/third_party/blink/renderer/core/frame/remote_frame_client_impl.h +++ b/third_party/blink/renderer/core/frame/remote_frame_client_impl.h
@@ -46,6 +46,7 @@ void UpdateRemoteViewportIntersection( const ViewportIntersectionState& intersection_state) override; AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override; + viz::FrameSinkId GetFrameSinkId() override; WebRemoteFrameImpl* GetWebFrame() const { return web_frame_; }
diff --git a/third_party/blink/renderer/core/frame/settings.h b/third_party/blink/renderer/core/frame/settings.h index 2d0c7fc..ca4fd6c 100644 --- a/third_party/blink/renderer/core/frame/settings.h +++ b/third_party/blink/renderer/core/frame/settings.h
@@ -34,10 +34,10 @@ #include "third_party/blink/public/common/css/navigation_controls.h" #include "third_party/blink/public/common/css/preferred_color_scheme.h" #include "third_party/blink/public/mojom/manifest/display_mode.mojom-shared.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/pointer_properties.h" #include "third_party/blink/public/platform/web_effective_connection_type.h" #include "third_party/blink/public/platform/web_viewport_style.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/events/add_event_listener_options_defaults.h" #include "third_party/blink/renderer/core/editing/editing_behavior_types.h"
diff --git a/third_party/blink/renderer/core/frame/settings.json5 b/third_party/blink/renderer/core/frame/settings.json5 index d50cf1c..c9e585f 100644 --- a/third_party/blink/renderer/core/frame/settings.json5 +++ b/third_party/blink/renderer/core/frame/settings.json5
@@ -612,8 +612,8 @@ // V8 supports different types of caching. Used by V8 bindings. { name: "v8CacheOptions", - initial: "mojom::blink::V8CacheOptions::kDefault", - type: "mojom::blink::V8CacheOptions", + initial: "kV8CacheOptionsDefault", + type: "V8CacheOptions", }, // These values are bit fields for the properties of available pointing devices
diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_base.cc b/third_party/blink/renderer/core/frame/web_frame_widget_base.cc index c263311..234c556b 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_base.cc +++ b/third_party/blink/renderer/core/frame/web_frame_widget_base.cc
@@ -35,12 +35,14 @@ #include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/frame/visual_viewport.h" #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" +#include "third_party/blink/renderer/core/html/html_frame_owner_element.h" #include "third_party/blink/renderer/core/html/portal/document_portals.h" #include "third_party/blink/renderer/core/html/portal/portal_contents.h" #include "third_party/blink/renderer/core/input/context_menu_allowed_scope.h" #include "third_party/blink/renderer/core/input/event_handler.h" #include "third_party/blink/renderer/core/layout/hit_test_location.h" #include "third_party/blink/renderer/core/layout/hit_test_request.h" +#include "third_party/blink/renderer/core/layout/layout_box.h" #include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/core/loader/interactive_detector.h" #include "third_party/blink/renderer/core/page/context_menu_controller.h" @@ -122,6 +124,28 @@ } } +viz::FrameSinkId GetRemoteFrameSinkId(const HitTestResult& result) { + Node* node = result.InnerNode(); + auto* frame_owner = DynamicTo<HTMLFrameOwnerElement>(node); + if (!frame_owner || !frame_owner->ContentFrame() || + !frame_owner->ContentFrame()->IsRemoteFrame()) + return viz::FrameSinkId(); + + RemoteFrame* remote_frame = To<RemoteFrame>(frame_owner->ContentFrame()); + if (remote_frame->IsIgnoredForHitTest()) + return viz::FrameSinkId(); + LayoutObject* object = result.GetLayoutObject(); + DCHECK(object); + if (!object->IsBox()) + return viz::FrameSinkId(); + + IntPoint local_point = RoundedIntPoint(result.LocalPoint()); + if (!ToLayoutBox(object)->ComputedCSSContentBoxRect().Contains(local_point)) + return viz::FrameSinkId(); + + return remote_frame->GetFrameSinkId(); +} + } // namespace // Ensure that the WebDragOperation enum values stay in sync with the original @@ -376,6 +400,64 @@ widget_base_->BindWidgetCompositor(std::move(receiver)); } +void WebFrameWidgetBase::BindInputTargetClient( + mojo::PendingReceiver<viz::mojom::blink::InputTargetClient> receiver) { + DCHECK(!input_target_receiver_.is_bound()); + input_target_receiver_.Bind( + std::move(receiver), + local_root_->GetTaskRunner(TaskType::kInternalDefault)); +} + +void WebFrameWidgetBase::FrameSinkIdAt(const gfx::PointF& point, + const uint64_t trace_id, + FrameSinkIdAtCallback callback) { + TRACE_EVENT_WITH_FLOW1("viz,benchmark", "Event.Pipeline", + TRACE_ID_GLOBAL(trace_id), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "step", "FrameSinkIdAt"); + + gfx::PointF local_point; + viz::FrameSinkId id = GetFrameSinkIdAtPoint(point, &local_point); + std::move(callback).Run(id, local_point); +} + +viz::FrameSinkId WebFrameWidgetBase::GetFrameSinkIdAtPoint( + const gfx::PointF& point_in_dips, + gfx::PointF* local_point_in_dips) { + HitTestResult result = + CoreHitTestResultAt(widget_base_->DIPsToBlinkSpace(point_in_dips)); + + Node* result_node = result.InnerNode(); + *local_point_in_dips = gfx::PointF(point_in_dips); + + // TODO(crbug.com/797828): When the node is null the caller may + // need to do extra checks. Like maybe update the layout and then + // call the hit-testing API. Either way it might be better to have + // a DCHECK for the node rather than a null check here. + if (!result_node) { + return client_->GetFrameSinkId(); + } + + viz::FrameSinkId frame_sink_id = GetRemoteFrameSinkId(result); + if (frame_sink_id.is_valid()) { + FloatPoint local_point = FloatPoint(result.LocalPoint()); + LayoutObject* object = result.GetLayoutObject(); + if (object->IsBox()) { + LayoutBox* box = ToLayoutBox(object); + local_point.MoveBy(-FloatPoint(box->PhysicalContentBoxOffset())); + } + + *local_point_in_dips = + widget_base_->BlinkSpaceToDIPs(gfx::PointF(local_point)); + return frame_sink_id; + } + + // Return the FrameSinkId for the current widget if the point did not hit + // test to a remote frame, or the point is outside of the remote frame's + // content box, or the remote frame doesn't have a valid FrameSinkId yet. + return client_->GetFrameSinkId(); +} + void WebFrameWidgetBase::SetActive(bool active) { View()->SetIsActive(active); } @@ -506,6 +588,7 @@ visitor->Trace(current_drag_data_); visitor->Trace(frame_widget_host_); visitor->Trace(receiver_); + visitor->Trace(input_target_receiver_); } void WebFrameWidgetBase::SetNeedsRecalculateRasterScales() {
diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_base.h b/third_party/blink/renderer/core/frame/web_frame_widget_base.h index d0a3c31..27f8e34 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_base.h +++ b/third_party/blink/renderer/core/frame/web_frame_widget_base.h
@@ -11,6 +11,7 @@ #include "cc/input/layer_selection_bound.h" #include "cc/input/overscroll_behavior.h" #include "cc/trees/layer_tree_host.h" +#include "services/viz/public/mojom/hit_test/input_target_client.mojom-blink.h" #include "third_party/blink/public/common/input/web_coalesced_input_event.h" #include "third_party/blink/public/common/input/web_gesture_device.h" #include "third_party/blink/public/mojom/manifest/display_mode.mojom-blink.h" @@ -27,6 +28,7 @@ #include "third_party/blink/renderer/platform/heap/member.h" #include "third_party/blink/renderer/platform/mojo/heap_mojo_associated_receiver.h" #include "third_party/blink/renderer/platform/mojo/heap_mojo_associated_remote.h" +#include "third_party/blink/renderer/platform/mojo/heap_mojo_receiver.h" #include "third_party/blink/renderer/platform/mojo/heap_mojo_wrapper_mode.h" #include "third_party/blink/renderer/platform/text/text_direction.h" #include "third_party/blink/renderer/platform/timer.h" @@ -58,6 +60,7 @@ public WebFrameWidget, public WidgetBaseClient, public mojom::blink::FrameWidget, + public viz::mojom::blink::InputTargetClient, public FrameWidget { public: WebFrameWidgetBase( @@ -416,6 +419,15 @@ void BindWidgetCompositor( mojo::PendingReceiver<mojom::blink::WidgetCompositor> receiver) override; + void BindInputTargetClient( + mojo::PendingReceiver<viz::mojom::blink::InputTargetClient> receiver) + override; + + // viz::mojom::blink::InputTargetClient: + void FrameSinkIdAt(const gfx::PointF& point, + const uint64_t trace_id, + FrameSinkIdAtCallback callback) override; + // Called when the FrameView for this Widget's local root is created. virtual void DidCreateLocalRootView() {} @@ -539,6 +551,8 @@ virtual ScreenMetricsEmulator* DeviceEmulator() { return nullptr; } void SetWindowSegments(const std::vector<gfx::Rect>& window_segments); + viz::FrameSinkId GetFrameSinkIdAtPoint(const gfx::PointF& point, + gfx::PointF* local_point); protected: enum DragAction { kDragEnter, kDragOver }; @@ -647,6 +661,10 @@ WebFrameWidgetBase, HeapMojoWrapperMode::kWithoutContextObserver> receiver_{this, nullptr}; + HeapMojoReceiver<viz::mojom::blink::InputTargetClient, + WebFrameWidgetBase, + HeapMojoWrapperMode::kWithoutContextObserver> + input_target_receiver_{this, nullptr}; // Different consumers in the browser process makes different assumptions, so // must always send the first IPC regardless of value.
diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_test.cc b/third_party/blink/renderer/core/frame/web_frame_widget_test.cc index fb9d9b7fd..5fea59ee 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_widget_test.cc
@@ -6,6 +6,7 @@ #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" #include "third_party/blink/renderer/core/frame/web_view_frame_widget.h" +#include "third_party/blink/renderer/core/testing/sim/sim_request.h" #include "third_party/blink/renderer/core/testing/sim/sim_test.h" namespace blink { @@ -52,4 +53,42 @@ ->new_local_surface_id_request_for_testing()); } +TEST_F(WebFrameWidgetSimTest, FrameSinkIdHitTestAPI) { + SimRequest request("https://example.com/test.html", "text/html"); + LoadURL("https://example.com/test.html"); + request.Complete( + R"HTML( + <style> + html, body { + margin :0px; + padding: 0px; + } + </style> + + <div style='background: green; padding: 100px; margin: 0px;'> + <iframe style='width: 200px; height: 100px;' + srcdoc='<body style="margin : 0px; height : 100px; width : 200px;"> + </body>'> + </iframe> + </div> + + )HTML"); + + gfx::PointF point; + viz::FrameSinkId main_frame_sink_id = + WebView().MainFrameWidgetBase()->GetFrameSinkIdAtPoint( + gfx::PointF(10.43, 10.74), &point); + EXPECT_EQ(WebView().MainFrameWidgetBase()->Client()->GetFrameSinkId(), + main_frame_sink_id); + EXPECT_EQ(gfx::PointF(10.43, 10.74), point); + + // Targeting a child frame should also return the FrameSinkId for the main + // widget. + viz::FrameSinkId frame_sink_id = + WebView().MainFrameWidgetBase()->GetFrameSinkIdAtPoint( + gfx::PointF(150.27, 150.25), &point); + EXPECT_EQ(main_frame_sink_id, frame_sink_id); + EXPECT_EQ(gfx::PointF(150.27, 150.25), point); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/html/link_rel_attribute.cc b/third_party/blink/renderer/core/html/link_rel_attribute.cc index acdd004..42dff89 100644 --- a/third_party/blink/renderer/core/html/link_rel_attribute.cc +++ b/third_party/blink/renderer/core/html/link_rel_attribute.cc
@@ -71,10 +71,7 @@ is_alternate_ = true; } else if (EqualIgnoringASCIICase(link_type, "icon")) { // This also allows "shortcut icon" since we just ignore the non-standard - // "shortcut" token. - // FIXME: This doesn't really follow the spec that requires "shortcut - // icon" to be the entire string - // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#rel-icon + // "shortcut" token (in accordance with the spec). icon_type_ = mojom::blink::FaviconIconType::kFavicon; } else if (EqualIgnoringASCIICase(link_type, "prefetch")) { is_link_prefetch_ = true;
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.h b/third_party/blink/renderer/core/inspector/inspector_page_agent.h index 1aca7c5d..840d25c 100644 --- a/third_party/blink/renderer/core/inspector/inspector_page_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.h
@@ -32,7 +32,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_INSPECTOR_INSPECTOR_PAGE_AGENT_H_ #include "base/macros.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/inspector/inspector_base_agent.h" #include "third_party/blink/renderer/core/inspector/protocol/Page.h"
diff --git a/third_party/blink/renderer/core/layout/flexible_box_algorithm.cc b/third_party/blink/renderer/core/layout/flexible_box_algorithm.cc index 049fcda..04df60f2 100644 --- a/third_party/blink/renderer/core/layout/flexible_box_algorithm.cc +++ b/third_party/blink/renderer/core/layout/flexible_box_algorithm.cc
@@ -746,9 +746,6 @@ : child.StyleRef().MinHeight(); bool main_axis_is_childs_block_axis = IsHorizontalFlow() != child.StyleRef().IsHorizontalWritingMode(); - // TODO(dgrogan) Move this closer to ng_flex_layout_algorithm.cc:616. - if (child.IsTable() && !main_axis_is_childs_block_axis) - return true; bool intrinsic_in_childs_block_axis = main_axis_is_childs_block_axis && (min.IsMinContent() || min.IsMaxContent() || min.IsMinIntrinsic() ||
diff --git a/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc index 3166e9d..83f8b22 100644 --- a/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc +++ b/third_party/blink/renderer/core/layout/ng/custom/layout_worklet_global_scope_proxy.cc
@@ -49,7 +49,7 @@ frame->Client()->CreateWorkerContentSettingsClient(), window->AddressSpace(), OriginTrialContext::GetTokens(window).get(), base::UnguessableToken::Create(), nullptr /* worker_settings */, - mojom::blink::V8CacheOptions::kDefault, module_responses_map, + kV8CacheOptionsDefault, module_responses_map, mojo::NullRemote() /* browser_interface_broker */, BeginFrameProviderParams(), nullptr /* parent_feature_policy */, window->GetAgentClusterID(), window->GetExecutionContextToken());
diff --git a/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc index 5477bc77e..0bec22e96 100644 --- a/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/flex/ng_flex_layout_algorithm.cc
@@ -614,111 +614,97 @@ const Length& min = is_horizontal_flow_ ? child.Style().MinWidth() : child.Style().MinHeight(); if (algorithm_->ShouldApplyMinSizeAutoForChild(*child.GetLayoutBox())) { - // TODO(dgrogan): This should probably apply to column flexboxes also, - // but that's not what legacy does. - if (child.IsTable() && !is_column_) { - MinMaxSizes table_preferred_widths = - ComputeMinAndMaxContentContribution( - Style(), child, - MinMaxSizesInput(child_percentage_size_.block_size, - MinMaxSizesType::kIntrinsic)) - .sizes; - min_max_sizes_in_main_axis_direction.min_size = - table_preferred_widths.min_size; + LayoutUnit content_size_suggestion; + if (MainAxisIsInlineAxis(child)) { + content_size_suggestion = + MinMaxSizesFunc(MinMaxSizesType::kContent).sizes.min_size; } else { - LayoutUnit content_size_suggestion; - if (MainAxisIsInlineAxis(child)) { - content_size_suggestion = - MinMaxSizesFunc(MinMaxSizesType::kContent).sizes.min_size; + LayoutUnit intrinsic_block_size; + if (child.IsReplaced()) { + base::Optional<LayoutUnit> computed_inline_size; + base::Optional<LayoutUnit> computed_block_size; + child.IntrinsicSize(&computed_inline_size, &computed_block_size); + + // The 150 is for replaced elements that have no size, which SVG + // can have (maybe others?). + intrinsic_block_size = + computed_block_size.value_or(LayoutUnit(150)) + + border_padding_in_child_writing_mode.BlockSum(); } else { - LayoutUnit intrinsic_block_size; - if (child.IsReplaced()) { - base::Optional<LayoutUnit> computed_inline_size; - base::Optional<LayoutUnit> computed_block_size; - child.IntrinsicSize(&computed_inline_size, &computed_block_size); - - // The 150 is for replaced elements that have no size, which SVG - // can have (maybe others?). - intrinsic_block_size = - computed_block_size.value_or(LayoutUnit(150)) + - border_padding_in_child_writing_mode.BlockSum(); - } else { - intrinsic_block_size = IntrinsicBlockSizeFunc(); - } - content_size_suggestion = intrinsic_block_size; + intrinsic_block_size = IntrinsicBlockSizeFunc(); } - DCHECK_GE(content_size_suggestion, main_axis_border_padding); - - if (child.HasAspectRatio()) { - content_size_suggestion = - AdjustChildSizeForAspectRatioCrossAxisMinAndMax( - child, content_size_suggestion, - min_max_sizes_in_cross_axis_direction.min_size, - min_max_sizes_in_cross_axis_direction.max_size, - main_axis_border_padding, cross_axis_border_padding); - } - - LayoutUnit specified_size_suggestion = LayoutUnit::Max(); - // If the item’s computed main size property is definite, then the - // specified size suggestion is that size. - if (MainAxisIsInlineAxis(child)) { - if (!specified_length_in_main_axis.IsAuto()) { - // TODO(dgrogan): Optimization opportunity: we may have already - // resolved specified_length_in_main_axis in the flex basis - // calculation. Reuse that if possible. - specified_size_suggestion = ResolveMainInlineLength( - flex_basis_space, child_style, - border_padding_in_child_writing_mode, MinMaxSizesFunc, - specified_length_in_main_axis); - } - } else if (!BlockLengthUnresolvable(flex_basis_space, - specified_length_in_main_axis, - LengthResolvePhase::kLayout)) { - specified_size_suggestion = ResolveMainBlockLength( - flex_basis_space, child_style, - border_padding_in_child_writing_mode, - specified_length_in_main_axis, IntrinsicBlockSizeFunc, - LengthResolvePhase::kLayout); - DCHECK_NE(specified_size_suggestion, kIndefiniteSize); - } - - LayoutUnit transferred_size_suggestion = LayoutUnit::Max(); - if (specified_size_suggestion == LayoutUnit::Max() && - child.HasAspectRatio()) { - const Length& cross_axis_length = - is_horizontal_flow_ ? child_style.Height() : child_style.Width(); - if (IsItemCrossAxisLengthDefinite(child, cross_axis_length)) { - LayoutUnit cross_axis_size; - if (MainAxisIsInlineAxis(child)) { - cross_axis_size = ResolveMainBlockLength( - flex_basis_space, child_style, - border_padding_in_child_writing_mode, cross_axis_length, - kIndefiniteSize, LengthResolvePhase::kLayout); - DCHECK_NE(cross_axis_size, kIndefiniteSize); - } else { - cross_axis_size = - ResolveMainInlineLength(flex_basis_space, child_style, - border_padding_in_child_writing_mode, - MinMaxSizesFunc, cross_axis_length); - } - double ratio = GetMainOverCrossAspectRatio(child); - transferred_size_suggestion = LayoutUnit( - main_axis_border_padding + - ratio * - (min_max_sizes_in_cross_axis_direction.ClampSizeToMinAndMax( - cross_axis_size) - - cross_axis_border_padding)); - } - } - - DCHECK(specified_size_suggestion == LayoutUnit::Max() || - transferred_size_suggestion == LayoutUnit::Max()); - - min_max_sizes_in_main_axis_direction.min_size = - std::min({specified_size_suggestion, content_size_suggestion, - transferred_size_suggestion, - min_max_sizes_in_main_axis_direction.max_size}); + content_size_suggestion = intrinsic_block_size; } + DCHECK_GE(content_size_suggestion, main_axis_border_padding); + + if (child.HasAspectRatio()) { + content_size_suggestion = + AdjustChildSizeForAspectRatioCrossAxisMinAndMax( + child, content_size_suggestion, + min_max_sizes_in_cross_axis_direction.min_size, + min_max_sizes_in_cross_axis_direction.max_size, + main_axis_border_padding, cross_axis_border_padding); + } + + LayoutUnit specified_size_suggestion = LayoutUnit::Max(); + // If the item’s computed main size property is definite, then the + // specified size suggestion is that size. + if (MainAxisIsInlineAxis(child)) { + if (!specified_length_in_main_axis.IsAuto()) { + // TODO(dgrogan): Optimization opportunity: we may have already + // resolved specified_length_in_main_axis in the flex basis + // calculation. Reuse that if possible. + specified_size_suggestion = ResolveMainInlineLength( + flex_basis_space, child_style, + border_padding_in_child_writing_mode, MinMaxSizesFunc, + specified_length_in_main_axis); + } + } else if (!BlockLengthUnresolvable(flex_basis_space, + specified_length_in_main_axis, + LengthResolvePhase::kLayout)) { + specified_size_suggestion = ResolveMainBlockLength( + flex_basis_space, child_style, border_padding_in_child_writing_mode, + specified_length_in_main_axis, IntrinsicBlockSizeFunc, + LengthResolvePhase::kLayout); + DCHECK_NE(specified_size_suggestion, kIndefiniteSize); + } + + LayoutUnit transferred_size_suggestion = LayoutUnit::Max(); + if (specified_size_suggestion == LayoutUnit::Max() && + child.HasAspectRatio()) { + const Length& cross_axis_length = + is_horizontal_flow_ ? child_style.Height() : child_style.Width(); + if (IsItemCrossAxisLengthDefinite(child, cross_axis_length)) { + LayoutUnit cross_axis_size; + if (MainAxisIsInlineAxis(child)) { + cross_axis_size = ResolveMainBlockLength( + flex_basis_space, child_style, + border_padding_in_child_writing_mode, cross_axis_length, + kIndefiniteSize, LengthResolvePhase::kLayout); + DCHECK_NE(cross_axis_size, kIndefiniteSize); + } else { + cross_axis_size = + ResolveMainInlineLength(flex_basis_space, child_style, + border_padding_in_child_writing_mode, + MinMaxSizesFunc, cross_axis_length); + } + double ratio = GetMainOverCrossAspectRatio(child); + transferred_size_suggestion = LayoutUnit( + main_axis_border_padding + + ratio * + (min_max_sizes_in_cross_axis_direction.ClampSizeToMinAndMax( + cross_axis_size) - + cross_axis_border_padding)); + } + } + + DCHECK(specified_size_suggestion == LayoutUnit::Max() || + transferred_size_suggestion == LayoutUnit::Max()); + + min_max_sizes_in_main_axis_direction.min_size = + std::min({specified_size_suggestion, content_size_suggestion, + transferred_size_suggestion, + min_max_sizes_in_main_axis_direction.max_size}); } else if (MainAxisIsInlineAxis(child)) { min_max_sizes_in_main_axis_direction.min_size = ResolveMinInlineLength( flex_basis_space, child_style, border_padding_in_child_writing_mode, @@ -728,6 +714,23 @@ flex_basis_space, child_style, border_padding_in_child_writing_mode, min, LengthResolvePhase::kLayout); } + // Flex needs to never give a table a flexed main size that is less than its + // min-content size, so floor min-width by min-content size. + // TODO(dgrogan): This should probably apply to column flexboxes also, + // but that's not what legacy does. + if (child.IsTable() && !is_column_) { + MinMaxSizes table_intrinsic_widths = + child + .ComputeMinMaxSizes( + ConstraintSpace().GetWritingMode(), + MinMaxSizesInput(child_percentage_size_.block_size, + MinMaxSizesType::kContent)) + .sizes; + + min_max_sizes_in_main_axis_direction.Encompass( + table_intrinsic_widths.min_size); + } + min_max_sizes_in_main_axis_direction -= main_axis_border_padding; DCHECK_GE(min_max_sizes_in_main_axis_direction.min_size, 0); DCHECK_GE(min_max_sizes_in_main_axis_direction.max_size, 0);
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_script_loader_test.cc b/third_party/blink/renderer/core/loader/modulescript/module_script_loader_test.cc index 97041858..fa95bf9 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_script_loader_test.cc +++ b/third_party/blink/renderer/core/loader/modulescript/module_script_loader_test.cc
@@ -218,8 +218,7 @@ nullptr /* worker_clients */, nullptr /* content_settings_client */, network::mojom::IPAddressSpace::kLocal, nullptr /* origin_trial_token */, base::UnguessableToken::Create(), nullptr /* worker_settings */, - mojom::blink::V8CacheOptions::kDefault, - MakeGarbageCollected<WorkletModuleResponsesMap>(), + kV8CacheOptionsDefault, MakeGarbageCollected<WorkletModuleResponsesMap>(), mojo::NullRemote() /* browser_interface_broker */, BeginFrameProviderParams(), nullptr /* parent_feature_policy */, base::UnguessableToken::Create() /* agent_cluster_id */);
diff --git a/third_party/blink/renderer/core/script/document_modulator_impl.cc b/third_party/blink/renderer/core/script/document_modulator_impl.cc index 56d50a7..9f1699c90 100644 --- a/third_party/blink/renderer/core/script/document_modulator_impl.cc +++ b/third_party/blink/renderer/core/script/document_modulator_impl.cc
@@ -26,12 +26,12 @@ return false; } -mojom::blink::V8CacheOptions DocumentModulatorImpl::GetV8CacheOptions() const { +V8CacheOptions DocumentModulatorImpl::GetV8CacheOptions() const { LocalDOMWindow* window = To<LocalDOMWindow>(GetExecutionContext()); const Settings* settings = window->GetFrame()->GetSettings(); if (settings) return settings->GetV8CacheOptions(); - return mojom::blink::V8CacheOptions::kDefault; + return kV8CacheOptionsDefault; } } // namespace blink
diff --git a/third_party/blink/renderer/core/script/document_modulator_impl.h b/third_party/blink/renderer/core/script/document_modulator_impl.h index e453b4f0..a0eac9f5 100644 --- a/third_party/blink/renderer/core/script/document_modulator_impl.h +++ b/third_party/blink/renderer/core/script/document_modulator_impl.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/core/script/modulator_impl_base.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -31,7 +30,7 @@ private: // Implements ModulatorImplBase. bool IsDynamicImportForbidden(String* reason) override; - mojom::blink::V8CacheOptions GetV8CacheOptions() const override; + V8CacheOptions GetV8CacheOptions() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/script/modulator.h b/third_party/blink/renderer/core/script/modulator.h index 2a672794..356a30b3 100644 --- a/third_party/blink/renderer/core/script/modulator.h +++ b/third_party/blink/renderer/core/script/modulator.h
@@ -113,7 +113,7 @@ virtual ScriptState* GetScriptState() = 0; - virtual mojom::blink::V8CacheOptions GetV8CacheOptions() const = 0; + virtual V8CacheOptions GetV8CacheOptions() const = 0; // https://html.spec.whatwg.org/C/#concept-bc-noscript // "scripting is disabled for settings's responsible browsing context"
diff --git a/third_party/blink/renderer/core/script/worker_modulator_impl.cc b/third_party/blink/renderer/core/script/worker_modulator_impl.cc index 1851c0c..6541c78 100644 --- a/third_party/blink/renderer/core/script/worker_modulator_impl.cc +++ b/third_party/blink/renderer/core/script/worker_modulator_impl.cc
@@ -55,7 +55,7 @@ return true; } -mojom::blink::V8CacheOptions WorkerModulatorImpl::GetV8CacheOptions() const { +V8CacheOptions WorkerModulatorImpl::GetV8CacheOptions() const { auto* scope = To<WorkerGlobalScope>(GetExecutionContext()); return scope->GetV8CacheOptions(); }
diff --git a/third_party/blink/renderer/core/script/worker_modulator_impl.h b/third_party/blink/renderer/core/script/worker_modulator_impl.h index db1b378..3e90e712 100644 --- a/third_party/blink/renderer/core/script/worker_modulator_impl.h +++ b/third_party/blink/renderer/core/script/worker_modulator_impl.h
@@ -27,7 +27,7 @@ private: // Implements ModulatorImplBase. bool IsDynamicImportForbidden(String* reason) override; - mojom::blink::V8CacheOptions GetV8CacheOptions() const override; + V8CacheOptions GetV8CacheOptions() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/script/worklet_modulator_impl.cc b/third_party/blink/renderer/core/script/worklet_modulator_impl.cc index 23d4c58..7b77edd 100644 --- a/third_party/blink/renderer/core/script/worklet_modulator_impl.cc +++ b/third_party/blink/renderer/core/script/worklet_modulator_impl.cc
@@ -27,7 +27,7 @@ return true; } -mojom::blink::V8CacheOptions WorkletModulatorImpl::GetV8CacheOptions() const { +V8CacheOptions WorkletModulatorImpl::GetV8CacheOptions() const { auto* scope = To<WorkletGlobalScope>(GetExecutionContext()); return scope->GetV8CacheOptions(); }
diff --git a/third_party/blink/renderer/core/script/worklet_modulator_impl.h b/third_party/blink/renderer/core/script/worklet_modulator_impl.h index e5c80fc..cfd769b 100644 --- a/third_party/blink/renderer/core/script/worklet_modulator_impl.h +++ b/third_party/blink/renderer/core/script/worklet_modulator_impl.h
@@ -29,7 +29,7 @@ private: // Implements ModulatorImplBase. bool IsDynamicImportForbidden(String* reason) override; - mojom::blink::V8CacheOptions GetV8CacheOptions() const override; + V8CacheOptions GetV8CacheOptions() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/testing/dummy_modulator.cc b/third_party/blink/renderer/core/testing/dummy_modulator.cc index 98e6b66..21a16bd 100644 --- a/third_party/blink/renderer/core/testing/dummy_modulator.cc +++ b/third_party/blink/renderer/core/testing/dummy_modulator.cc
@@ -52,8 +52,8 @@ return nullptr; } -mojom::blink::V8CacheOptions DummyModulator::GetV8CacheOptions() const { - return mojom::blink::V8CacheOptions::kDefault; +V8CacheOptions DummyModulator::GetV8CacheOptions() const { + return kV8CacheOptionsDefault; } bool DummyModulator::IsScriptingDisabled() const {
diff --git a/third_party/blink/renderer/core/testing/dummy_modulator.h b/third_party/blink/renderer/core/testing/dummy_modulator.h index aa8b01f..6d01b7b 100644 --- a/third_party/blink/renderer/core/testing/dummy_modulator.h +++ b/third_party/blink/renderer/core/testing/dummy_modulator.h
@@ -32,7 +32,7 @@ ModuleRecordResolver* GetModuleRecordResolver() override; base::SingleThreadTaskRunner* TaskRunner() override; ScriptState* GetScriptState() override; - mojom::blink::V8CacheOptions GetV8CacheOptions() const override; + V8CacheOptions GetV8CacheOptions() const override; bool IsScriptingDisabled() const override; bool ImportMapsEnabled() const override;
diff --git a/third_party/blink/renderer/core/testing/internals.cc b/third_party/blink/renderer/core/testing/internals.cc index 089902427..cadd4a2c 100644 --- a/third_party/blink/renderer/core/testing/internals.cc +++ b/third_party/blink/renderer/core/testing/internals.cc
@@ -3526,4 +3526,19 @@ ReportingContext::From(document_->domWindow())->QueueReport(report); } +void Internals::setIsAdSubframe(HTMLIFrameElement* iframe, + ExceptionState& exception_state) { + if (!iframe->ContentFrame() || !iframe->ContentFrame()->IsLocalFrame()) { + exception_state.ThrowDOMException(DOMExceptionCode::kNotSupportedError, + "Frame cannot be accessed."); + return; + } + LocalFrame* parent_frame = iframe->GetDocument().GetFrame(); + LocalFrame* child_frame = To<LocalFrame>(iframe->ContentFrame()); + bool parent_is_ad = parent_frame && parent_frame->IsAdSubframe(); + child_frame->SetIsAdSubframe(parent_is_ad + ? blink::mojom::AdFrameType::kChildAd + : blink::mojom::AdFrameType::kRootAd); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/testing/internals.h b/third_party/blink/renderer/core/testing/internals.h index 8c78d63..4dc7737 100644 --- a/third_party/blink/renderer/core/testing/internals.h +++ b/third_party/blink/renderer/core/testing/internals.h
@@ -611,6 +611,9 @@ void generateTestReport(const String& message); + void setIsAdSubframe(HTMLIFrameElement* iframe, + ExceptionState& exception_state); + private: Document* ContextDocument() const; Vector<String> IconURLs(Document*, int icon_types_mask) const;
diff --git a/third_party/blink/renderer/core/testing/internals.idl b/third_party/blink/renderer/core/testing/internals.idl index 4ee77c0..fd393d1b 100644 --- a/third_party/blink/renderer/core/testing/internals.idl +++ b/third_party/blink/renderer/core/testing/internals.idl
@@ -450,4 +450,6 @@ // Request generation of a Reporting report. void generateTestReport(DOMString message); + + [RaisesException] void setIsAdSubframe(HTMLIFrameElement iframe); };
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker.cc b/third_party/blink/renderer/core/workers/dedicated_worker.cc index 70ec512..73a8db6 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker.cc
@@ -444,8 +444,7 @@ MakeGarbageCollected<WorkerClients>(), CreateWebContentSettingsClient(), response_address_space, OriginTrialContext::GetTokens(GetExecutionContext()).get(), - parent_devtools_token, std::move(settings), - mojom::blink::V8CacheOptions::kDefault, + parent_devtools_token, std::move(settings), kV8CacheOptionsDefault, nullptr /* worklet_module_responses_map */, std::move(browser_interface_broker_), CreateBeginFrameProviderParams(), GetExecutionContext()->GetSecurityContext().GetFeaturePolicy(),
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc index 4522b9a..66e0439 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc
@@ -9,9 +9,9 @@ #include "base/optional.h" #include "services/network/public/mojom/fetch_api.mojom-blink.h" #include "third_party/blink/public/common/features.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_worker_options.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/events/error_event.h"
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_test.cc b/third_party/blink/renderer/core/workers/dedicated_worker_test.cc index df3b904..7de7a6e2 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_test.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_test.cc
@@ -9,9 +9,9 @@ #include "base/single_thread_task_runner.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/events/message_event.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/inspector/console_message_storage.h" @@ -139,7 +139,7 @@ nullptr /* worker_clients */, nullptr /* content_settings_client */, network::mojom::IPAddressSpace::kLocal, nullptr /* origin_trial_tokens */, base::UnguessableToken::Create(), - std::move(worker_settings), mojom::blink::V8CacheOptions::kDefault, + std::move(worker_settings), kV8CacheOptionsDefault, nullptr /* worklet_module_responses_map */); params->parent_context_token = GetExecutionContext()->GetExecutionContextToken();
diff --git a/third_party/blink/renderer/core/workers/global_scope_creation_params.cc b/third_party/blink/renderer/core/workers/global_scope_creation_params.cc index 77fb76e..c47af601 100644 --- a/third_party/blink/renderer/core/workers/global_scope_creation_params.cc +++ b/third_party/blink/renderer/core/workers/global_scope_creation_params.cc
@@ -31,7 +31,7 @@ const Vector<String>* origin_trial_tokens, const base::UnguessableToken& parent_devtools_token, std::unique_ptr<WorkerSettings> worker_settings, - mojom::blink::V8CacheOptions v8_cache_options, + V8CacheOptions v8_cache_options, WorkletModuleResponsesMap* module_responses_map, mojo::PendingRemote<mojom::blink::BrowserInterfaceBroker> browser_interface_broker,
diff --git a/third_party/blink/renderer/core/workers/global_scope_creation_params.h b/third_party/blink/renderer/core/workers/global_scope_creation_params.h index af807289..879a050 100644 --- a/third_party/blink/renderer/core/workers/global_scope_creation_params.h +++ b/third_party/blink/renderer/core/workers/global_scope_creation_params.h
@@ -17,9 +17,9 @@ #include "third_party/blink/public/common/user_agent/user_agent_metadata.h" #include "third_party/blink/public/mojom/browser_interface_broker.mojom-blink-forward.h" #include "third_party/blink/public/mojom/script/script_type.mojom-blink-forward.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/web_content_settings_client.h" #include "third_party/blink/public/platform/web_worker_fetch_context.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/workers/worker_clients.h" @@ -58,7 +58,7 @@ const Vector<String>* origin_trial_tokens, const base::UnguessableToken& parent_devtools_token, std::unique_ptr<WorkerSettings>, - mojom::blink::V8CacheOptions, + V8CacheOptions, WorkletModuleResponsesMap*, mojo::PendingRemote<mojom::blink::BrowserInterfaceBroker> browser_interface_broker = mojo::NullRemote(), @@ -147,7 +147,7 @@ std::unique_ptr<WorkerSettings> worker_settings; - mojom::blink::V8CacheOptions v8_cache_options; + V8CacheOptions v8_cache_options; CrossThreadPersistent<WorkletModuleResponsesMap> module_responses_map;
diff --git a/third_party/blink/renderer/core/workers/main_thread_worklet_test.cc b/third_party/blink/renderer/core/workers/main_thread_worklet_test.cc index cadbf885..819c002 100644 --- a/third_party/blink/renderer/core/workers/main_thread_worklet_test.cc +++ b/third_party/blink/renderer/core/workers/main_thread_worklet_test.cc
@@ -69,7 +69,7 @@ nullptr /* worker_clients */, nullptr /* content_settings_client */, window->AddressSpace(), OriginTrialContext::GetTokens(window).get(), base::UnguessableToken::Create(), nullptr /* worker_settings */, - mojom::blink::V8CacheOptions::kDefault, + kV8CacheOptionsDefault, MakeGarbageCollected<WorkletModuleResponsesMap>(), mojo::NullRemote() /* browser_interface_broker */, BeginFrameProviderParams(), nullptr /* parent_feature_policy */,
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc b/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc index a68a972..340014c 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc +++ b/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc
@@ -7,8 +7,8 @@ #include "base/single_thread_task_runner.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "third_party/blink/public/mojom/script/script_type.mojom-blink.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/execution_context/security_context.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" @@ -69,7 +69,7 @@ window->AddressSpace(), OriginTrialContext::GetTokens(window).get(), base::UnguessableToken::Create(), std::make_unique<WorkerSettings>(window->GetFrame()->GetSettings()), - mojom::blink::V8CacheOptions::kDefault, module_responses_map, + kV8CacheOptionsDefault, module_responses_map, mojo::NullRemote() /* browser_interface_broker */, BeginFrameProviderParams(), nullptr /* parent_feature_policy */, window->GetAgentClusterID(), window->GetExecutionContextToken());
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_test.cc b/third_party/blink/renderer/core/workers/threaded_worklet_test.cc index b322cff..5ac26b69 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_test.cc +++ b/third_party/blink/renderer/core/workers/threaded_worklet_test.cc
@@ -5,8 +5,8 @@ #include <bitset> #include "base/single_thread_task_runner.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/inspector/console_message_storage.h" #include "third_party/blink/renderer/core/inspector/thread_debugger.h" @@ -217,7 +217,7 @@ GetExecutionContext()->AddressSpace(), OriginTrialContext::GetTokens(GetExecutionContext()).get(), base::UnguessableToken::Create(), std::move(worker_settings), - mojom::blink::V8CacheOptions::kDefault, + kV8CacheOptionsDefault, MakeGarbageCollected<WorkletModuleResponsesMap>(), mojo::NullRemote() /* browser_interface_broker */, BeginFrameProviderParams(), nullptr /* parent_feature_policy */,
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc index 143e26f..5d87ff52 100644 --- a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc
@@ -182,7 +182,7 @@ Agent* agent, const String& name, const base::UnguessableToken& parent_devtools_token, - mojom::blink::V8CacheOptions v8_cache_options, + V8CacheOptions v8_cache_options, WorkerClients* worker_clients, std::unique_ptr<WebContentSettingsClient> content_settings_client, scoped_refptr<WebWorkerFetchContext> web_worker_fetch_context,
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h index 8a96391..ce096d3 100644 --- a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h +++ b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h
@@ -11,9 +11,9 @@ #include "services/network/public/mojom/fetch_api.mojom-blink-forward.h" #include "services/network/public/mojom/web_sandbox_flags.mojom-blink-forward.h" #include "third_party/blink/public/mojom/loader/resource_load_info_notifier.mojom-shared.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/cross_variant_mojo_util.h" #include "third_party/blink/public/platform/web_url_request.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/events/event_target.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" @@ -52,7 +52,7 @@ Agent* agent, const String& name, const base::UnguessableToken& parent_devtools_token, - mojom::blink::V8CacheOptions, + V8CacheOptions, WorkerClients*, std::unique_ptr<WebContentSettingsClient>, scoped_refptr<WebWorkerFetchContext>, @@ -141,9 +141,7 @@ WorkerOrWorkletScriptController* ScriptController() { return script_controller_.Get(); } - mojom::blink::V8CacheOptions GetV8CacheOptions() const { - return v8_cache_options_; - } + V8CacheOptions GetV8CacheOptions() const { return v8_cache_options_; } WorkerReportingProxy& ReportingProxy() { return reporting_proxy_; } @@ -236,7 +234,7 @@ Member<SubresourceFilter> subresource_filter_; Member<WorkerOrWorkletScriptController> script_controller_; - const mojom::blink::V8CacheOptions v8_cache_options_; + const V8CacheOptions v8_cache_options_; // TODO(hiroshige): Pass outsideSettings-CSP via // outsideSettings-FetchClientSettingsObject.
diff --git a/third_party/blink/renderer/core/workers/worker_thread_test.cc b/third_party/blink/renderer/core/workers/worker_thread_test.cc index b59483cc..67ecf55 100644 --- a/third_party/blink/renderer/core/workers/worker_thread_test.cc +++ b/third_party/blink/renderer/core/workers/worker_thread_test.cc
@@ -11,7 +11,7 @@ #include "services/network/public/mojom/ip_address_space.mojom-blink.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/inspector/inspector_task_runner.h" #include "third_party/blink/renderer/core/inspector/worker_devtools_params.h" @@ -397,8 +397,7 @@ network::mojom::IPAddressSpace::kLocal, nullptr /* originTrialToken */, base::UnguessableToken::Create(), std::make_unique<WorkerSettings>(std::make_unique<Settings>().get()), - mojom::blink::V8CacheOptions::kDefault, - nullptr /* worklet_module_responses_map */); + kV8CacheOptionsDefault, nullptr /* worklet_module_responses_map */); // Set wait_for_debugger so that the worker thread can pause // on initialization to run debugger tasks.
diff --git a/third_party/blink/renderer/core/workers/worker_thread_test_helper.h b/third_party/blink/renderer/core/workers/worker_thread_test_helper.h index 2fc8f3a..f9cbd174b 100644 --- a/third_party/blink/renderer/core/workers/worker_thread_test_helper.h +++ b/third_party/blink/renderer/core/workers/worker_thread_test_helper.h
@@ -12,8 +12,8 @@ #include "services/metrics/public/cpp/ukm_source_id.h" #include "services/network/public/mojom/ip_address_space.mojom-blink.h" #include "testing/gmock/include/gmock/gmock.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" @@ -150,8 +150,7 @@ network::mojom::IPAddressSpace::kLocal, nullptr, base::UnguessableToken::Create(), std::make_unique<WorkerSettings>(std::make_unique<Settings>().get()), - mojom::blink::V8CacheOptions::kDefault, - nullptr /* worklet_module_responses_map */); + kV8CacheOptionsDefault, nullptr /* worklet_module_responses_map */); // Create a dummy parent context. creation_params->parent_context_token = LocalFrameToken();
diff --git a/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc b/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc index b1be9f9..6c5c19a 100644 --- a/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc +++ b/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc
@@ -6,12 +6,12 @@ #include "base/synchronization/waitable_event.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/script/classic_script.h"
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc index 6e910e1..2229321 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope_proxy.cc
@@ -48,7 +48,7 @@ frame->Client()->CreateWorkerContentSettingsClient(), window->AddressSpace(), OriginTrialContext::GetTokens(window).get(), base::UnguessableToken::Create(), nullptr /* worker_settings */, - mojom::blink::V8CacheOptions::kDefault, module_responses_map, + kV8CacheOptionsDefault, module_responses_map, mojo::NullRemote() /* browser_interface_broker */, BeginFrameProviderParams(), nullptr /* parent_feature_policy */, window->GetAgentClusterID(), window->GetExecutionContextToken());
diff --git a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc index bfd79bc1..2c6ad69 100644 --- a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc +++ b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc
@@ -221,7 +221,7 @@ nullptr /* OriginTrialTokens */, worker_start_data->devtools_worker_token, std::move(worker_settings), // Generate the full code cache in the first execution of the script. - mojom::blink::V8CacheOptions::kFullCodeWithoutHeatCheck, + kV8CacheOptionsFullCodeWithoutHeatCheck, nullptr /* worklet_module_respones_map */, std::move(browser_interface_broker), BeginFrameProviderParams(), nullptr /* parent_feature_policy */,
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reader.cc b/third_party/blink/renderer/modules/nfc/ndef_reader.cc index df9dfaa..82d73c04 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_reader.cc +++ b/third_party/blink/renderer/modules/nfc/ndef_reader.cc
@@ -162,7 +162,7 @@ UseCounter::Count(GetExecutionContext(), WebFeature::kWebNfcAPI); GetNfcProxy()->StartReading( - this, options, + this, WTF::Bind(&NDEFReader::OnScanRequestCompleted, WrapPersistent(this))); }
diff --git a/third_party/blink/renderer/modules/nfc/ndef_scan_options.idl b/third_party/blink/renderer/modules/nfc/ndef_scan_options.idl index cf20cf59..767635a 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_scan_options.idl +++ b/third_party/blink/renderer/modules/nfc/ndef_scan_options.idl
@@ -4,8 +4,5 @@ // https://w3c.github.io/web-nfc/#the-ndefscanoptions-dictionary dictionary NDEFScanOptions { - USVString id; - USVString recordType; - USVString mediaType; AbortSignal? signal; };
diff --git a/third_party/blink/renderer/modules/nfc/nfc_proxy.cc b/third_party/blink/renderer/modules/nfc/nfc_proxy.cc index 08001ab..2cf4c85 100644 --- a/third_party/blink/renderer/modules/nfc/nfc_proxy.cc +++ b/third_party/blink/renderer/modules/nfc/nfc_proxy.cc
@@ -49,14 +49,13 @@ } void NFCProxy::StartReading(NDEFReader* reader, - const NDEFScanOptions* options, device::mojom::blink::NFC::WatchCallback callback) { DCHECK(reader); DCHECK(!readers_.Contains(reader)); EnsureMojoConnection(); nfc_remote_->Watch( - device::mojom::blink::NDEFScanOptions::From(options), next_watch_id_, + next_watch_id_, WTF::Bind(&NFCProxy::OnReaderRegistered, WrapPersistent(this), WrapPersistent(reader), next_watch_id_, std::move(callback))); readers_.insert(reader, next_watch_id_);
diff --git a/third_party/blink/renderer/modules/nfc/nfc_proxy.h b/third_party/blink/renderer/modules/nfc/nfc_proxy.h index d9f6235..2054198 100644 --- a/third_party/blink/renderer/modules/nfc/nfc_proxy.h +++ b/third_party/blink/renderer/modules/nfc/nfc_proxy.h
@@ -17,7 +17,6 @@ namespace blink { class LocalDOMWindow; -class NDEFScanOptions; class NDEFReader; class NDEFWriter; @@ -41,7 +40,6 @@ void AddWriter(NDEFWriter*); void StartReading(NDEFReader*, - const NDEFScanOptions*, device::mojom::blink::NFC::WatchCallback); void StopReading(NDEFReader*); bool IsReading(const NDEFReader*);
diff --git a/third_party/blink/renderer/modules/nfc/nfc_proxy_test.cc b/third_party/blink/renderer/modules/nfc/nfc_proxy_test.cc index a28a9c2..da17025 100644 --- a/third_party/blink/renderer/modules/nfc/nfc_proxy_test.cc +++ b/third_party/blink/renderer/modules/nfc/nfc_proxy_test.cc
@@ -79,18 +79,8 @@ if (!client_ || !tag_message_) return; - // Only match the watches using |id| in options. - WTF::Vector<uint32_t> ids; - for (auto& pair : watches_) { - if (pair.second->id == tag_message_->data[0]->id) { - ids.push_back(pair.first); - } - } - - if (!ids.IsEmpty()) { - client_->OnWatch(std::move(ids), kFakeNfcTagSerialNumber, - tag_message_.Clone()); - } + client_->OnWatch(std::move(watchIDs_), kFakeNfcTagSerialNumber, + tag_message_.Clone()); } void set_tag_message(device::mojom::blink::NDEFMessagePtr message) { @@ -101,13 +91,7 @@ watch_error_ = std::move(error); } - WTF::Vector<uint32_t> GetWatches() { - WTF::Vector<uint32_t> ids; - for (auto& pair : watches_) { - ids.push_back(pair.first); - } - return ids; - } + WTF::Vector<uint32_t> GetWatches() { return watchIDs_; } private: // Override methods from device::mojom::blink::NFC. @@ -124,33 +108,34 @@ void CancelPush(CancelPushCallback callback) override { std::move(callback).Run(nullptr); } - void Watch(device::mojom::blink::NDEFScanOptionsPtr options, - uint32_t id, - WatchCallback callback) override { + void Watch(uint32_t id, WatchCallback callback) override { if (watch_error_) { std::move(callback).Run(watch_error_.Clone()); return; } - watches_.emplace(id, std::move(options)); + if (watchIDs_.Find(id) == kNotFound) + watchIDs_.push_back(id); std::move(callback).Run(nullptr); } void CancelWatch(uint32_t id, CancelWatchCallback callback) override { - if (watches_.erase(id) < 1) { + size_t index = watchIDs_.Find(id); + if (index == kNotFound) { std::move(callback).Run(device::mojom::blink::NDEFError::New( device::mojom::blink::NDEFErrorType::NOT_FOUND, "")); } else { + watchIDs_.EraseAt(index); std::move(callback).Run(nullptr); } } void CancelAllWatches(CancelAllWatchesCallback callback) override { - watches_.clear(); + watchIDs_.clear(); std::move(callback).Run(nullptr); } device::mojom::blink::NDEFErrorPtr watch_error_; device::mojom::blink::NDEFMessagePtr tag_message_; mojo::Remote<device::mojom::blink::NFCClient> client_; - std::map<uint32_t, device::mojom::blink::NDEFScanOptionsPtr> watches_; + WTF::Vector<uint32_t> watchIDs_; mojo::Receiver<device::mojom::blink::NFC> receiver_; }; @@ -181,13 +166,11 @@ TEST_F(NFCProxyTest, SuccessfulPath) { auto* window = GetFrame().DomWindow(); auto* nfc_proxy = NFCProxy::From(*window); - auto* scan_options = NDEFScanOptions::Create(); - scan_options->setId(kFakeRecordId); auto* reader = MakeGarbageCollected<MockNDEFReader>(window); { base::RunLoop loop; - nfc_proxy->StartReading(reader, scan_options, + nfc_proxy->StartReading(reader, base::BindLambdaForTesting( [&](device::mojom::blink::NDEFErrorPtr error) { EXPECT_TRUE(error.is_null()); @@ -234,8 +217,6 @@ TEST_F(NFCProxyTest, ErrorPath) { auto* window = GetFrame().DomWindow(); auto* nfc_proxy = NFCProxy::From(*window); - auto* scan_options = NDEFScanOptions::Create(); - scan_options->setId(kFakeRecordId); auto* reader = MakeGarbageCollected<MockNDEFReader>(window); // Make the fake NFC service return an error for the incoming watch request. @@ -243,7 +224,7 @@ device::mojom::blink::NDEFErrorType::NOT_READABLE, "")); base::RunLoop loop; nfc_proxy->StartReading( - reader, scan_options, + reader, base::BindLambdaForTesting([&](device::mojom::blink::NDEFErrorPtr error) { // We got the error prepared before. EXPECT_FALSE(error.is_null());
diff --git a/third_party/blink/renderer/modules/nfc/nfc_type_converters.cc b/third_party/blink/renderer/modules/nfc/nfc_type_converters.cc index d05ec7b8..b1d727b7 100644 --- a/third_party/blink/renderer/modules/nfc/nfc_type_converters.cc +++ b/third_party/blink/renderer/modules/nfc/nfc_type_converters.cc
@@ -8,7 +8,6 @@ #include <utility> #include "services/device/public/mojom/nfc.mojom-blink.h" -#include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_scan_options.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_ndef_write_options.h" #include "third_party/blink/renderer/modules/nfc/ndef_message.h" #include "third_party/blink/renderer/modules/nfc/ndef_record.h" @@ -19,8 +18,6 @@ using device::mojom::blink::NDEFMessagePtr; using device::mojom::blink::NDEFRecord; using device::mojom::blink::NDEFRecordPtr; -using device::mojom::blink::NDEFScanOptions; -using device::mojom::blink::NDEFScanOptionsPtr; using device::mojom::blink::NDEFWriteOptions; using device::mojom::blink::NDEFWriteOptionsPtr; @@ -64,27 +61,4 @@ return write_options_ptr; } -NDEFScanOptionsPtr -TypeConverter<NDEFScanOptionsPtr, const blink::NDEFScanOptions*>::Convert( - const blink::NDEFScanOptions* scan_options) { - // https://w3c.github.io/web-nfc/#dom-ndefscanoptions - // Default values for NDEFScanOptions dictionary are: - // id = undefined, recordType = undefined, mediaType = undefined - NDEFScanOptionsPtr scan_options_ptr = NDEFScanOptions::New(); - - if (scan_options->hasId()) { - scan_options_ptr->id = scan_options->id(); - } - - if (scan_options->hasRecordType()) { - scan_options_ptr->record_type = scan_options->recordType(); - } - - if (scan_options->hasMediaType()) { - scan_options_ptr->media_type = scan_options->mediaType(); - } - - return scan_options_ptr; -} - } // namespace mojo
diff --git a/third_party/blink/renderer/modules/nfc/nfc_type_converters.h b/third_party/blink/renderer/modules/nfc/nfc_type_converters.h index 1343c15..55fd828 100644 --- a/third_party/blink/renderer/modules/nfc/nfc_type_converters.h +++ b/third_party/blink/renderer/modules/nfc/nfc_type_converters.h
@@ -13,7 +13,6 @@ class NDEFRecord; class NDEFMessage; -class NDEFScanOptions; class NDEFWriteOptions; } // namespace blink @@ -41,13 +40,6 @@ const ::blink::NDEFWriteOptions* writeOptions); }; -template <> -struct TypeConverter<device::mojom::blink::NDEFScanOptionsPtr, - const ::blink::NDEFScanOptions*> { - static device::mojom::blink::NDEFScanOptionsPtr Convert( - const ::blink::NDEFScanOptions* scanOptions); -}; - } // namespace mojo #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_NFC_NFC_TYPE_CONVERTERS_H_
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc b/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc index 463db2d..84804fd 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc
@@ -8,7 +8,6 @@ #include "base/synchronization/waitable_event.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" @@ -19,6 +18,7 @@ #include "third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" @@ -77,7 +77,7 @@ nullptr /* worker_clients */, nullptr /* content_settings_client */, window->AddressSpace(), OriginTrialContext::GetTokens(window).get(), base::UnguessableToken::Create(), nullptr /* worker_settings */, - mojom::blink::V8CacheOptions::kDefault, + kV8CacheOptionsDefault, MakeGarbageCollected<WorkletModuleResponsesMap>(), mojo::NullRemote() /* browser_interface_broker */, BeginFrameProviderParams(), nullptr /* parent_feature_policy */,
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc b/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc index f2c5bdb2..6786b5db 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc
@@ -16,12 +16,12 @@ #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" @@ -97,7 +97,7 @@ nullptr /* worker_clients */, nullptr /* content_settings_client */, window->AddressSpace(), OriginTrialContext::GetTokens(window).get(), base::UnguessableToken::Create(), nullptr /* worker_settings */, - mojom::blink::V8CacheOptions::kDefault, + kV8CacheOptionsDefault, MakeGarbageCollected<WorkletModuleResponsesMap>(), mojo::NullRemote() /* browser_interface_broker */, BeginFrameProviderParams(), nullptr /* parent_feature_policy */, @@ -318,12 +318,12 @@ // for a real-time context. {true, false, true, base::ThreadPriority::REALTIME_AUDIO}, - // OfflineAudioWorkletThread is always a BACKGROUND priority no matter what + // OfflineAudioWorkletThread is always a NORMAL priority no matter what // the flag setting or the originating frame level is. - {false, true, true, base::ThreadPriority::BACKGROUND}, - {false, true, false, base::ThreadPriority::BACKGROUND}, - {false, false, true, base::ThreadPriority::BACKGROUND}, - {false, false, false, base::ThreadPriority::BACKGROUND}, + {false, true, true, base::ThreadPriority::NORMAL}, + {false, true, false, base::ThreadPriority::NORMAL}, + {false, false, true, base::ThreadPriority::NORMAL}, + {false, false, false, base::ThreadPriority::NORMAL}, }; class AudioWorkletThreadPriorityTest
diff --git a/third_party/blink/renderer/modules/webaudio/offline_audio_worklet_thread.cc b/third_party/blink/renderer/modules/webaudio/offline_audio_worklet_thread.cc index 2f65ee9..7673535f 100644 --- a/third_party/blink/renderer/modules/webaudio/offline_audio_worklet_thread.cc +++ b/third_party/blink/renderer/modules/webaudio/offline_audio_worklet_thread.cc
@@ -24,8 +24,8 @@ ThreadCreationParams params = ThreadCreationParams(ThreadType::kOfflineAudioWorkletThread); - // OfflineAudioWorkletThread always uses a BACKGROUND priority thread. - params.thread_priority = base::ThreadPriority::BACKGROUND; + // OfflineAudioWorkletThread always uses a NORMAL priority thread. + params.thread_priority = base::ThreadPriority::NORMAL; if (++s_ref_count_ == 1) EnsureSharedBackingThread(params);
diff --git a/third_party/blink/renderer/modules/webaudio/offline_audio_worklet_thread.h b/third_party/blink/renderer/modules/webaudio/offline_audio_worklet_thread.h index 767e36b..586531e 100644 --- a/third_party/blink/renderer/modules/webaudio/offline_audio_worklet_thread.h +++ b/third_party/blink/renderer/modules/webaudio/offline_audio_worklet_thread.h
@@ -16,7 +16,7 @@ // OfflineAudioWorkletThread is a per-AudioWorkletGlobalScope object that has a // reference count to the backing thread that performs AudioWorklet tasks. -// Its backing thread uses BACKGROUND priority no matter what the environment +// Its backing thread uses NORMAL priority no matter what the environment // or the feature flag setting is. class MODULES_EXPORT OfflineAudioWorkletThread final : public WorkerThread { public:
diff --git a/third_party/blink/renderer/modules/worklet/worklet_thread_test_common.cc b/third_party/blink/renderer/modules/worklet/worklet_thread_test_common.cc index 4aa6a6fa..667c448 100644 --- a/third_party/blink/renderer/modules/worklet/worklet_thread_test_common.cc +++ b/third_party/blink/renderer/modules/worklet/worklet_thread_test_common.cc
@@ -38,7 +38,7 @@ nullptr /* content_settings_client */, window->AddressSpace(), OriginTrialContext::GetTokens(window).get(), base::UnguessableToken::Create(), nullptr /* worker_settings */, - mojom::blink::V8CacheOptions::kDefault, + kV8CacheOptionsDefault, MakeGarbageCollected<WorkletModuleResponsesMap>(), mojo::NullRemote() /* browser_interface_broker */, BeginFrameProviderParams(), nullptr /* parent_feature_policy */,
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource.cc b/third_party/blink/renderer/platform/graphics/canvas_resource.cc index 3fb1bc22..289f86f 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_resource.cc
@@ -762,7 +762,7 @@ // Ensure Dawn wire is initialized. webgpu->RequestAdapterAsync(gpu::webgpu::PowerPreference::kHighPerformance, base::DoNothing()); - WGPUDeviceProperties properties; + WGPUDeviceProperties properties{}; webgpu->RequestDeviceAsync(0, properties, base::DoNothing()); owning_thread_data().shared_image_mailbox = shared_image_mailbox;
diff --git a/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier.cc b/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier.cc index fecf1fe..28f59dc 100644 --- a/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier.cc +++ b/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier.cc
@@ -8,6 +8,7 @@ #include "base/memory/singleton.h" #include "base/optional.h" +#include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/graphics/darkmode/darkmode_classifier.h" #include "third_party/skia/include/utils/SkNullCanvas.h" @@ -183,14 +184,18 @@ int num_blocks_x = kMaxBlocks; int num_blocks_y = kMaxBlocks; - if (num_sampled_pixels > src.width() * src.height()) - num_sampled_pixels = src.width() * src.height(); + // Crash reports indicate that the src can be less than 1, so make + // sure it goes to 1. We know it is not 0 because GetBitmap above + // will return false for zero-sized src. + IntSize rounded_src(ceil(src.width()), ceil(src.height())); - if (num_blocks_x > src.width()) - num_blocks_x = floor(src.width()); + if (num_sampled_pixels > rounded_src.Width() * rounded_src.Height()) + num_sampled_pixels = rounded_src.Width() * rounded_src.Height(); - if (num_blocks_y > src.height()) - num_blocks_y = floor(src.height()); + if (num_blocks_x > rounded_src.Width()) + num_blocks_x = rounded_src.Width(); + if (num_blocks_y > rounded_src.Height()) + num_blocks_y = rounded_src.Height(); int pixels_per_block = num_sampled_pixels / (num_blocks_x * num_blocks_y);
diff --git a/third_party/blink/renderer/platform/widget/widget_base.cc b/third_party/blink/renderer/platform/widget/widget_base.cc index 472e3070..c63f893 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.cc +++ b/third_party/blink/renderer/platform/widget/widget_base.cc
@@ -33,6 +33,7 @@ #include "third_party/blink/renderer/platform/widget/input/widget_input_handler_manager.h" #include "third_party/blink/renderer/platform/widget/widget_base_client.h" #include "ui/base/ime/mojom/text_input_state.mojom-blink.h" +#include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/presentation_feedback.h" namespace blink { @@ -1167,4 +1168,17 @@ #endif } +gfx::PointF WidgetBase::DIPsToBlinkSpace(const gfx::PointF& point) { + if (!use_zoom_for_dsf_) + return point; + return gfx::ConvertPointToPixel( + client_->GetOriginalScreenInfo().device_scale_factor, point); +} + +gfx::PointF WidgetBase::BlinkSpaceToDIPs(const gfx::PointF& point) { + if (!use_zoom_for_dsf_) + return point; + return gfx::ConvertPointToDIP( + client_->GetOriginalScreenInfo().device_scale_factor, point); +} } // namespace blink
diff --git a/third_party/blink/renderer/platform/widget/widget_base.h b/third_party/blink/renderer/platform/widget/widget_base.h index b992a35f..84b66b8 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.h +++ b/third_party/blink/renderer/platform/widget/widget_base.h
@@ -259,6 +259,14 @@ visible_viewport_size_ = size; } + // Converts from DIPs to Blink coordinate space (ie. Viewport/Physical + // pixels). + gfx::PointF DIPsToBlinkSpace(const gfx::PointF& point); + + // Converts from Blink coordinate space (ie. Viewport/Physical pixels) to + // DIPS. + gfx::PointF BlinkSpaceToDIPs(const gfx::PointF& point); + // Returns whether Zoom for DSF is enabled for the widget. bool UseZoomForDsf() { return use_zoom_for_dsf_; }
diff --git a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py index 727afeb..a2fab294 100755 --- a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py +++ b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
@@ -592,6 +592,7 @@ 'cc::TaskGraphRunner', 'gfx::DisplayColorSpaces', 'ui::ImeTextSpan', + 'viz::FrameSinkId', 'viz::LocalSurfaceIdAllocation', ], },
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng index 390666c..54217d87 100644 --- a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng +++ b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng
@@ -676,5 +676,7 @@ crbug.com/958381 external/wpt/css/css-flexbox/table-as-item-wide-content.html [ Failure ] crbug.com/958381 external/wpt/css/css-flexbox/table-as-item-fixed-min-width.html [ Failure ] +crbug.com/1128262 external/wpt/css/css-flexbox/table-as-item-fixed-min-width-3.html [ Failure ] + # math display values are only supported when MathML Core is enabled. crbug.com/6606 external/wpt/css/css-display/display-math-on-non-mathml-elements.html [ Failure ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 060e507..a27b8ad 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -728,6 +728,7 @@ crbug.com/807497 external/wpt/css/css-flexbox/anonymous-flex-item-005.html [ Failure ] crbug.com/1111708 external/wpt/css/css-flexbox/flexbox_justifycontent-center-overflow.html [ Failure ] crbug.com/1111128 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-min-height-auto-002b.html [ Failure ] +crbug.com/1128262 external/wpt/css/css-flexbox/table-as-item-specified-width.html [ Failure ] # These have some incorrect expectations and will supposedly be deleted soon (Sep 2020) by mozilla. crbug.com/704294 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-003.html [ Failure ]
diff --git a/third_party/blink/web_tests/android/ChromiumWPTExpectations b/third_party/blink/web_tests/android/ChromiumWPTExpectations index d136ed1..62197a0 100644 --- a/third_party/blink/web_tests/android/ChromiumWPTExpectations +++ b/third_party/blink/web_tests/android/ChromiumWPTExpectations
@@ -1566,8 +1566,14 @@ crbug.com/1050754 external/wpt/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/experimental-features/unsized-media.tentative.https.sub.html [ Failure ] -crbug.com/1050754 external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html [ Timeout ] -crbug.com/1050754 external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html [ Timeout ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-blank.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-auto.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-block.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-swap.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-blank.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-auto.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-block.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-swap.tentative.html [ Failure ] crbug.com/1050754 external/wpt/document-policy/reporting/oversized-images-reporting-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html [ Timeout ] @@ -4192,7 +4198,6 @@ crbug.com/1050754 external/wpt/web-locks/steal.tentative.https.any.sharedworker.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFMessage_constructor.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFReader_scan.https.html [ Failure ] -crbug.com/1050754 external/wpt/web-nfc/NDEFReader_scan_filter.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFReader_scan_iframe.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFReadingEvent_constructor.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFRecord_constructor.https.html [ Failure ]
diff --git a/third_party/blink/web_tests/android/WeblayerWPTExpectations b/third_party/blink/web_tests/android/WeblayerWPTExpectations index c2c9d278..d0b3bec4 100644 --- a/third_party/blink/web_tests/android/WeblayerWPTExpectations +++ b/third_party/blink/web_tests/android/WeblayerWPTExpectations
@@ -1475,8 +1475,14 @@ crbug.com/1050754 external/wpt/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/experimental-features/unsized-media.tentative.https.sub.html [ Failure ] -crbug.com/1050754 external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html [ Timeout ] -crbug.com/1050754 external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html [ Timeout ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-blank.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-auto.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-block.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-swap.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-blank.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-auto.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-block.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-swap.tentative.html [ Failure ] crbug.com/1050754 external/wpt/document-policy/reporting/oversized-images-reporting-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html [ Timeout ] @@ -4183,7 +4189,6 @@ crbug.com/1050754 external/wpt/web-locks/steal.tentative.https.any.sharedworker.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFMessage_constructor.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFReader_scan.https.html [ Failure Timeout ] -crbug.com/1050754 external/wpt/web-nfc/NDEFReader_scan_filter.https.html [ Failure Timeout ] crbug.com/1050754 external/wpt/web-nfc/NDEFReader_scan_iframe.https.html [ Failure Timeout ] crbug.com/1050754 external/wpt/web-nfc/NDEFReadingEvent_constructor.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFRecord_constructor.https.html [ Failure ]
diff --git a/third_party/blink/web_tests/android/WebviewWPTExpectations b/third_party/blink/web_tests/android/WebviewWPTExpectations index c8ab373b..eb223a5 100644 --- a/third_party/blink/web_tests/android/WebviewWPTExpectations +++ b/third_party/blink/web_tests/android/WebviewWPTExpectations
@@ -1599,8 +1599,14 @@ crbug.com/1050754 external/wpt/document-policy/experimental-features/layout-animations-disabled-violation-report-js-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/experimental-features/layout-animations-disabled-violation-report-keyframes-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/experimental-features/unsized-media.tentative.https.sub.html [ Failure ] -crbug.com/1050754 external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html [ Timeout ] -crbug.com/1050754 external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html [ Timeout ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-blank.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-auto.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-block.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/reporting-swap.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-blank.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-auto.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-block.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/document-policy/font-display/report-only-swap.tentative.html [ Failure ] crbug.com/1050754 external/wpt/document-policy/reporting/oversized-images-reporting-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/reporting/lossy-images-max-bpp-reporting-onload-tentative.html [ Timeout ] crbug.com/1050754 external/wpt/document-policy/reporting/lossy-images-max-bpp-reporting-tentative.html [ Timeout ] @@ -4508,7 +4514,6 @@ crbug.com/1050754 external/wpt/web-locks/steal.tentative.https.any.sharedworker.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFMessage_constructor.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFReader_scan.https.html [ Failure ] -crbug.com/1050754 external/wpt/web-nfc/NDEFReader_scan_filter.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFReader_scan_iframe.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFReadingEvent_constructor.https.html [ Failure ] crbug.com/1050754 external/wpt/web-nfc/NDEFRecord_constructor.https.html [ Failure ]
diff --git a/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width-2.html b/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width-2.html new file mode 100644 index 0000000..f04f9e5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width-2.html
@@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>table is flex item</title> +<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#layout-algorithm" title="9. Flex Layout Algorithm"> +<link rel="help" href="https://drafts.csswg.org/css-tables-3/#used-min-width-of-table"> +<link rel="match" href="../reference/ref-filled-green-100px-square.xht"> +<meta name="assert" content="Flex item table's min-width is honored when it is larger than the table's min-content width"> + +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> + +<div style="display: flex; width: 100px;"> + <div style="display: table; min-width: 100px; background: green;"> + <div style="display:table-cell;"> + <div style="width: 50px; height: 100px;"></div> + </div> + </div> + <div style="height: 100px; background: red; flex-basis: 100px; min-width: 0px;"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width-3.html b/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width-3.html new file mode 100644 index 0000000..a13a94f5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width-3.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<title>table is flex item</title> +<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#layout-algorithm" title="9. Flex Layout Algorithm"> +<link rel="help" href="https://drafts.csswg.org/css-tables-3/#used-min-width-of-table"> +<link rel="match" href="../reference/ref-filled-green-100px-square.xht"> +<meta name="assert" content="Flex item table's min-content width is honored when it is larger than the table's specified min-width, and the sum of the flex base sizes are greater than the container's available size."> + +<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> + +<!-- This test passed in Chrome 83, was broken in 84 and 85, and will start to pass again in 86. --> + +<div style="display: flex; width: 100px;"> + <div style="display: table; min-width: 50px; background: green;"> + <div style="display:table-cell;"> + <div style="width: 100px; height: 100px;"></div> + </div> + </div> + <div style="height: 100px; background: red; flex-basis: 100px; min-width: 0px;"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width.html b/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width.html index 3a676bab..83f05110 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width.html +++ b/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-fixed-min-width.html
@@ -3,8 +3,12 @@ <link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> <link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org"> <link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#layout-algorithm" title="9. Flex Layout Algorithm"> +<link rel="help" href="https://drafts.csswg.org/css-tables-3/#used-min-width-of-table"> <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> +<meta name="assert" content="Flex item table's min-content width takes precedence over used max-width."> + <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> + <div style="display:flex; width:100px; background:red;"> <div style="display:table; min-width: 5px; width: 10px; max-width:10px; height:100px; background:green;"> <div style="width:100px; height:10px; background:green;"></div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-specified-width.html b/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-specified-width.html new file mode 100644 index 0000000..a4b370e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-flexbox/table-as-item-specified-width.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>table is flex item</title> +<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org"> +<link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#layout-algorithm" title="9. Flex Layout Algorithm"> +<link rel="help" href="https://drafts.csswg.org/css-tables-3/#used-min-width-of-table"> +<link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="Table's specified width does not count as another min-width for the purposes of the flexbox algorithm."> + +<p>Test passes if there is a filled green square.</p> + +<!-- This test passed until Chrome 84 but has been broken since. Firefox also fails it. --> + +<div style="display: flex;"> + <div style="display: table; width: 500px; height: 100px; background: green; flex: 0 0 100px;"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html deleted file mode 100644 index 03fa5b68..0000000 --- a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html +++ /dev/null
@@ -1,72 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Test for font-display-late-swap feature policy set to report-only</title> - <link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md"> - <script src='/resources/testharness.js'></script> - <script src='/resources/testharnessreport.js'></script> - <style> - </style> - </head> - <body> - <p> - Tests if the correct number of violation reports are generated and each report corresponds to this feature. - 4 reports should be created out of the 6 options below (reports for all except for 'fallback' and 'optional'). - </p> - <table id="container"> - <tr> - <th>not-set</th> - <th>auto</th> - <th>block</th> - <th>swap</th> - <th>fallback</th> - <th>optional</th> - </tr> - </table> - <script> -const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional']; -const table = document.getElementById('container'); - -function makeFontFaceDeclaration(family, display) { - url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over - return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }'; -} - -window.onload = () => { - let tr = document.createElement('tr'); - for (let display of fontDisplayValues) { - const family = display + '-face'; - const rule = makeFontFaceDeclaration(family, display); - document.styleSheets[0].insertRule(rule, 0); - let td = document.createElement('td'); - td.textContent = 'a'; - td.style.fontFamily = family + ', Arial'; - tr.appendChild(td); - } - table.appendChild(tr); -} - -let reportCounter = 4; -let t = async_test('font-display-late-swap Report Format'); - -let check_report_format = (reports, observer) => { - reportCounter -= reports.length; - for (let report of reports) { - assert_equals(report.type, 'document-policy-violation'); - assert_equals(report.url, document.location.href, 'Report URL'); - assert_equals(report.body.featureId, 'font-display-late-swap'); - assert_equals(report.body.disposition, 'report'); - assert_true('sourceFile' in report.body); - assert_true('lineNumber' in report.body); - assert_true('columnNumber' in report.body); - } - // Test is done when we have exactly 4 reports for the following - // font-display values: not set, 'auto', 'block', 'swap' - if (reportCounter == 0) t.done(); -}; - -new ReportingObserver(t.step_func(check_report_format), - {types: ['document-policy-violation'], buffered: true}).observe(); - </script> - </body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html deleted file mode 100644 index db871d1..0000000 --- a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html +++ /dev/null
@@ -1,72 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>Test for font-display-late-swap feature policy set to reporting</title> - <link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md"> - <script src='/resources/testharness.js'></script> - <script src='/resources/testharnessreport.js'></script> - <style> - </style> - </head> - <body> - <p> - Tests if the correct number of violation reports are generated and each report corresponds to this feature. - 4 reports should be created out of the 6 options below (reports for all except for 'fallback' and 'optional'). - </p> - <table id="container"> - <tr> - <th>not-set</th> - <th>auto</th> - <th>block</th> - <th>swap</th> - <th>fallback</th> - <th>optional</th> - </tr> - </table> - <script> -const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional']; -const table = document.getElementById('container'); - -function makeFontFaceDeclaration(family, display) { - url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over - return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }'; -} - -window.onload = () => { - let tr = document.createElement('tr'); - for (let display of fontDisplayValues) { - const family = display + '-face'; - const rule = makeFontFaceDeclaration(family, display); - document.styleSheets[0].insertRule(rule, 0); - let td = document.createElement('td'); - td.textContent = 'a'; - td.style.fontFamily = family + ', Arial'; - tr.appendChild(td); - } - table.appendChild(tr); -} - -let reportCounter = 4; -let t = async_test('font-display-late-swap Report Format'); - -let check_report_format = (reports, observer) => { - reportCounter -= reports.length; - for (let report of reports) { - assert_equals(report.type, 'document-policy-violation'); - assert_equals(report.url, document.location.href, 'Report URL'); - assert_equals(report.body.featureId, 'font-display-late-swap'); - assert_equals(report.body.disposition, 'enforce'); - assert_true('sourceFile' in report.body); - assert_true('lineNumber' in report.body); - assert_true('columnNumber' in report.body); - } - // Test is done when we have exactly 4 reports for the following - // font-display values: not set, 'auto', 'block', 'swap' - if (reportCounter == 0) t.done(); -}; - -new ReportingObserver(t.step_func(check_report_format), - {types: ['document-policy-violation'], buffered: true}).observe(); - </script> - </body> -</html> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-01.tentative-ref.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/override-to-optional.tentative-ref.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-01.tentative-ref.html rename to third_party/blink/web_tests/external/wpt/document-policy/font-display/override-to-optional.tentative-ref.html
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-01.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/override-to-optional.tentative.html similarity index 94% rename from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-01.tentative.html rename to third_party/blink/web_tests/external/wpt/document-policy/font-display/override-to-optional.tentative.html index cad4c18..26927bb 100644 --- a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-01.tentative.html +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/override-to-optional.tentative.html
@@ -2,7 +2,7 @@ <html class="reftest-wait"> <title>Test for no-font-display-late-swap document policy behavior</title> <link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md"> -<link rel="match" href="font-display-document-policy-01.tentative-ref.html"> +<link rel="match" href="override-to-optional.tentative-ref.html"> <style> </style> <p>Tests if font-display is set to optional for each option except for when it is set to fallback</p>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-01.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/override-to-optional.tentative.html.headers similarity index 100% rename from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-01.tentative.html.headers rename to third_party/blink/web_tests/external/wpt/document-policy/font-display/override-to-optional.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-auto.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-auto.tentative.html new file mode 100644 index 0000000..9eea350 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-auto.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'auto'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testFontDisplayPolicyReportOnlyGenerated('auto'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-auto.tentative.html.headers similarity index 100% rename from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers rename to third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-auto.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-blank.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-blank.tentative.html new file mode 100644 index 0000000..628dbcc --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-blank.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value empty</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testFontDisplayPolicyReportOnlyGenerated(''); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-blank.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-blank.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-block.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-block.tentative.html new file mode 100644 index 0000000..a383695 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-block.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'block'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testFontDisplayPolicyReportOnlyGenerated('block'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-block.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-block.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-fallback.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-fallback.tentative.html new file mode 100644 index 0000000..a03015e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-fallback.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'fallback'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testCompliantWithFontDisplayPolicy('fallback'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-fallback.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-fallback.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-optional.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-optional.tentative.html new file mode 100644 index 0000000..2a4673f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-optional.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'optional'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testCompliantWithFontDisplayPolicy('optional'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-optional.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-optional.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-swap.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-swap.tentative.html new file mode 100644 index 0000000..ad1f437f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-swap.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'swap'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testFontDisplayPolicyReportOnlyGenerated('swap'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-swap.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-report-only.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/report-only-swap.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-auto.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-auto.tentative.html new file mode 100644 index 0000000..01857dd --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-auto.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'auto'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testFontDisplayPolicyViolationGenerated('auto'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-auto.tentative.html.headers similarity index 100% rename from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers rename to third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-auto.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-blank.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-blank.tentative.html new file mode 100644 index 0000000..6521ae1 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-blank.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value empty</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testFontDisplayPolicyViolationGenerated(''); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-blank.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-blank.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-block.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-block.tentative.html new file mode 100644 index 0000000..60403c6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-block.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'block'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testFontDisplayPolicyViolationGenerated('block'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-block.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-block.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-fallback.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-fallback.tentative.html new file mode 100644 index 0000000..a03015e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-fallback.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'fallback'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testCompliantWithFontDisplayPolicy('fallback'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-fallback.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-fallback.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-optional.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-optional.tentative.html new file mode 100644 index 0000000..2a4673f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-optional.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'optional'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testCompliantWithFontDisplayPolicy('optional'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-optional.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-optional.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-swap.tentative.html b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-swap.tentative.html new file mode 100644 index 0000000..53d823f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-swap.tentative.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<title>Test for font-display-late-swap document policy with font display value 'swap'</title> +<link rel="help" href="https://github.com/w3c/webappsec-permissions-policy/blob/master/policies/font-display-late-swap.md"> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='resources/font-display-reporting-helper.js'></script> +<script> + testFontDisplayPolicyViolationGenerated('swap'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers b/third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-swap.tentative.html.headers similarity index 100% copy from third_party/blink/web_tests/external/wpt/document-policy/font-display/font-display-document-policy-reporting.tentative.html.headers copy to third_party/blink/web_tests/external/wpt/document-policy/font-display/reporting-swap.tentative.html.headers
diff --git a/third_party/blink/web_tests/external/wpt/document-policy/font-display/resources/font-display-reporting-helper.js b/third_party/blink/web_tests/external/wpt/document-policy/font-display/resources/font-display-reporting-helper.js new file mode 100644 index 0000000..f3c8a22 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/document-policy/font-display/resources/font-display-reporting-helper.js
@@ -0,0 +1,81 @@ +function check_report_format(report, expected_url, expected_disposition) { + assert_equals(report.type, 'document-policy-violation'); + assert_equals(report.url, expected_url); + assert_equals(report.body.featureId, 'font-display-late-swap'); + assert_equals(report.body.disposition, expected_disposition); + assert_true('sourceFile' in report.body); + assert_true('lineNumber' in report.body); + assert_true('columnNumber' in report.body); +} + +function check_violation_report_format(report, expected_url) { + check_report_format(report, expected_url, 'enforce'); +} + +function check_report_only_report_format(report, expected_url) { + check_report_format(report, expected_url, 'report'); +} + +function makeFontFaceDeclaration(family, display) { + url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over + return `@font-face { font-family: ${family}; src: url("${url}"); font-display: ${display}; }`; +} + +/** + * Run font-display test with given parameters. + * + * A violation report is expected with fontDisplayValue set to + * ['', 'auto', 'block', 'swap'] + * + * No violation report is expected with fontDisplayValue set to + * ['fallback', 'optional'] + + * @param {String} fontDisplayValue + * @param {(Report, String) => () | undefined} format_check pass a callback to + * check report format if a violation report is expected. If no report is + * expected to be generated, leave this argument undefined. + */ +function runTest(fontDisplayValue, format_check) { + window.onload = () => { + const family = fontDisplayValue + '-face'; + const rule = makeFontFaceDeclaration(family, fontDisplayValue); + + const style = document.createElement('style'); + style.innerHTML = rule; + document.body.appendChild(style); + + const div = document.createElement('div'); + div.textContent = 'a'; + div.style.fontFamily = family + ', Arial'; + document.body.appendChild(div); + }; + + const t = async_test('font-display-late-swap Report Format'); + + new ReportingObserver( + t.step_func_done((reports, _) => { + assert_equals(reports.length, 1); + assert_true(!!format_check); + format_check(reports[0], document.location.href); + }), { + types: ['document-policy-violation'], + buffered: true + } + ).observe(); + + t.step_timeout(t.step_func_done(() => { + assert_false(!!format_check, 'Expected violation report but did not get one.'); + }), 400); // 400ms should be sufficient to observe the violation report. +} + +function testFontDisplayPolicyViolationGenerated(fontDisplayValue) { + runTest(fontDisplayValue, check_violation_report_format); +} + +function testFontDisplayPolicyReportOnlyGenerated(fontDisplayValue) { + runTest(fontDisplayValue, check_report_only_report_format); +} + +function testCompliantWithFontDisplayPolicy(fontDisplayValue) { + runTest(fontDisplayValue); +} \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/lint.ignore b/third_party/blink/web_tests/external/wpt/lint.ignore index a3b91f1..457f36f8 100644 --- a/third_party/blink/web_tests/external/wpt/lint.ignore +++ b/third_party/blink/web_tests/external/wpt/lint.ignore
@@ -302,7 +302,7 @@ SET TIMEOUT: css/css-fonts/font-display/font-display-feature-policy-01.tentative.html SET TIMEOUT: css/css-fonts/font-display/font-display-feature-policy-02.tentative.html SET TIMEOUT: css/css-fonts/font-display/font-display-preload.html -SET TIMEOUT: document-policy/font-display/font-display-document-policy-01.tentative.html +SET TIMEOUT: document-policy/font-display/override-to-optional.tentative.html SET TIMEOUT: feature-policy/experimental-features/resources/focus-without-user-activation-iframe-tentative.html SET TIMEOUT: html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html SET TIMEOUT: html/cross-origin-embedder-policy/resources/navigate-none.sub.html
diff --git a/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js b/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js index 4c5f68b..aa94257e 100644 --- a/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js +++ b/third_party/blink/web_tests/external/wpt/resources/chromium/nfc-mock.js
@@ -118,33 +118,6 @@ } } -// Checks whether NDEFReaderOptions are matched with given message. -function matchesWatchOptions(message, options) { - // A message with no records is to notify that the tag is already formatted to - // support NDEF but does not contain a message yet. We always dispatch it for - // all options. - if (message.records.length == 0) - return true; - - for (let record of message.records) { - if (options.id != null && options.id !== record.id) { - continue; - } - if (options.recordType != null && - options.recordType !== record.recordType) { - continue; - } - if (options.mediaType != null && options.mediaType !== record.mediaType) { - continue; - } - - // Found one record matches, means the message matches. - return true; - } - - return false; -} - function createNDEFError(type) { return { error: type != null ? @@ -220,23 +193,21 @@ this.client_ = client; } - async watch(options, id) { + async watch(id) { assert_true(id > 0); let error = this.getHWError(); if (error) { return error; } - this.watchers_.push({id: id, options: options}); + this.watchers_.push({id: id}); // Ignores reading if NFC operation is suspended // or the NFC tag does not expose NDEF technology. if (!this.operations_suspended_) { // Triggers onWatch if the new watcher matches existing messages. for (let message of this.reading_messages_) { - if (matchesWatchOptions(message, options)) { - this.client_.onWatch( - [id], fake_tag_serial_number, toMojoNDEFMessage(message)); - } + this.client_.onWatch( + [id], fake_tag_serial_number, toMojoNDEFMessage(message)); } } @@ -325,11 +296,9 @@ return; // Triggers onWatch if the new message matches existing watchers. for (let watcher of this.watchers_) { - if (matchesWatchOptions(message, watcher.options)) { - this.client_.onWatch( - [watcher.id], fake_tag_serial_number, - toMojoNDEFMessage(message)); - } + this.client_.onWatch( + [watcher.id], fake_tag_serial_number, + toMojoNDEFMessage(message)); } } @@ -345,11 +314,9 @@ // Resumes pending NFC reading. for (let watcher of this.watchers_) { for (let message of this.reading_messages_) { - if (matchesWatchOptions(message, watcher.options)) { - this.client_.onWatch( - [watcher.id], fake_tag_serial_number, - toMojoNDEFMessage(message)); - } + this.client_.onWatch( + [watcher.id], fake_tag_serial_number, + toMojoNDEFMessage(message)); } } // Resumes pending push operation.
diff --git a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_scan_filter.https.html b/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_scan_filter.https.html deleted file mode 100644 index 1fea243..0000000 --- a/third_party/blink/web_tests/external/wpt/web-nfc/NDEFReader_scan_filter.https.html +++ /dev/null
@@ -1,165 +0,0 @@ -<!DOCTYPE html> -<meta charset=utf-8> -<title>Web NFC: NDEFReader.scan() filter tests</title> -<link rel="author" title="Intel" href="http://www.intel.com"/> -<link rel="help" href="https://w3c.github.io/web-nfc/"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/nfc-helpers.js"></script> -<script> - -'use strict'; - -const multiScanOptionsTests = - [ - { - desc: "Test that reading data succeed when NDEFScanOptions'" + - " recordType is set to 'empty'.", - scanOptions: {recordType: "empty"}, - unmatchedScanOptions: {recordType: "mime"}, - message: createMessage([createRecord('empty')]) - }, - { - desc: "Test that reading data succeed when NDEFScanOptions'" + - " recordType is set to 'mime'.", - scanOptions: {recordType: "mime"}, - unmatchedScanOptions: {recordType: "url"}, - message: createMessage([createMimeRecord(test_buffer_data)]) - }, - { - desc: "Test that reading data succeed when NDEFScanOptions'" + - " recordType is set to 'unknown'.", - scanOptions: {recordType: "unknown"}, - unmatchedScanOptions: {recordType: "mime"}, - message: createMessage([createUnknownRecord(test_buffer_data)]) - }, - { - desc: "Test that reading data succeed when NDEFScanOptions'" + - " recordType is set to 'text'.", - scanOptions: {recordType: "text"}, - unmatchedScanOptions: {recordType: "url"}, - message: createMessage([createTextRecord(test_text_data)]) - }, - { - desc: "Test that reading data succeed when NDEFScanOptions'" + - " recordType is set to 'url'.", - scanOptions: {recordType: "url"}, - unmatchedScanOptions: {recordType: "absolute-url"}, - message: createMessage([createUrlRecord(test_url_data)]) - }, - { - desc: "Test that reading data succeed when NDEFScanOptions'" + - " recordType is set to 'absolute-url'.", - scanOptions: {recordType: "absolute-url"}, - unmatchedScanOptions: {recordType: "url"}, - message: createMessage([createUrlRecord(test_url_data, true)]) - }, - { - desc: "Test that reading data succeed when NDEFScanOptions'" + - " recordType is set to a custom type for external type records.", - scanOptions: {recordType: "w3.org:xyz"}, - unmatchedScanOptions: {recordType: "mime"}, - message: createMessage([createRecord('w3.org:xyz', test_buffer_data)]) - }, - { - desc: "Test that the id of NDEFScanOptions filters relevant data" + - " sources correctly.", - scanOptions: {id: test_record_id}, - unmatchedScanOptions: {id: 'non_sense_id'}, - message: {records: [createTextRecord(test_text_data)]} - }, - { - desc: "Test that the mediaType of NDEFScanOptions filters relevant data" + - " sources correctly.", - scanOptions: {mediaType: "application/octet-stream"}, - unmatchedScanOptions: {mediaType: "application/json"}, - message: createMessage([createMimeRecord(test_buffer_data)]) - } - ]; - -const multiMessagesTests = - [ - { - desc: "Test that filtering 'empty' record from different messages" + - " correctly with NDEFScanOptions' recordType is set to 'empty'.", - scanOptions: {recordType: "empty"}, - message: createMessage([createRecord('empty')]), - unmatchedMessage: createMessage([createMimeRecordFromJson(test_json_data)]), - }, - { - desc: "Test that filtering 'mime' record from different messages" + - " correctly with NDEFScanOptions' recordType is set to 'mime'.", - scanOptions: {recordType: "mime"}, - message: createMessage([createMimeRecord(test_buffer_data)]), - unmatchedMessage: createMessage([createUnknownRecord(test_buffer_data)]) - }, - { - desc: "Test that filtering 'unknown' record from different messages" + - " correctly with NDEFScanOptions' recordType is set to 'unknown'.", - scanOptions: {recordType: "unknown"}, - message: createMessage([createUnknownRecord(test_buffer_data)]), - unmatchedMessage: createMessage([createUrlRecord(test_url_data)]) - }, - { - desc: "Test that filtering 'text' record from different messages" + - " correctly with NDEFScanOptions' recordType is set to 'text'.", - scanOptions: {recordType: "text"}, - message: createMessage([createTextRecord(test_text_data)]), - unmatchedMessage: createMessage([createUrlRecord(test_url_data)]) - }, - { - desc: "Test that filtering 'url' record from different messages" + - " correctly with NDEFScanOptions' recordType is set to 'url'.", - scanOptions: {recordType: "url"}, - message: createMessage([createUrlRecord(test_url_data)]), - unmatchedMessage: createMessage([createTextRecord(test_text_data)]) - }, - { - desc: "Test that filtering 'absolute-url' record from different messages" + - " correctly with NDEFScanOptions' recordType is set to 'absolute-url'.", - scanOptions: {recordType: "absolute-url"}, - message: createMessage([createUrlRecord(test_url_data, true)]), - unmatchedMessage: createMessage([createTextRecord(test_text_data)]) - }, - { - desc: "Test that filtering external record from different messages" + - " correctly with NDEFScanOptions' recordType is set to the custom type.", - scanOptions: {recordType: "w3.org:xyz"}, - message: createMessage([createRecord('w3.org:xyz', test_buffer_data)]), - unmatchedMessage: createMessage([createTextRecord(test_text_data)]) - }, - { - desc: "Test that filtering 'text' record from different messages" + - " correctly with NDEFScanOptions' id set.", - scanOptions: {id: test_record_id}, - message: {records: [createTextRecord(test_text_data)]}, - unmatchedMessage: {records: [createRecord('url', test_url_data, 'random_record_id')]} - }, - { - desc: "Test that filtering 'mime' record from different messages" + - " correctly with NDEFScanOptions' mediaType set.", - scanOptions: {mediaType: "application/octet-stream"}, - message: createMessage([createMimeRecord(test_buffer_data)]), - unmatchedMessage: createMessage([createMimeRecordFromJson(test_json_data)]) - } - ]; - -for (let multiScanOptionsTest of multiScanOptionsTests) { - testMultiScanOptions( - multiScanOptionsTest.message, - multiScanOptionsTest.scanOptions, - multiScanOptionsTest.unmatchedScanOptions, - multiScanOptionsTest.desc - ); -} - -for (let multiMessagesTest of multiMessagesTests) { - testMultiMessages( - multiMessagesTest.message, - multiMessagesTest.scanOptions, - multiMessagesTest.unmatchedMessage, - multiMessagesTest.desc - ); -} - -</script>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/navigated-heavy-ad.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/navigated-heavy-ad.js index 1a87b9a..0c8658c 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/page/navigated-heavy-ad.js +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/navigated-heavy-ad.js
@@ -4,24 +4,21 @@ await dp.Page.enable(); session.evaluate(` if (window.testRunner) { - // Inject a subresource filter to mark 'ad-iframe-writer.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["ad-iframe-writer.js"], false /* block_subresources */); testRunner.setHighlightAds(); } - // Script must be loaded after disallowed paths are set to be marked as an ad. - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "../resources/ad-iframe-writer.js"; - ad_script.onload = function () { - ad_frame = createAdFrame(); - ad_frame.width = 100; - ad_frame.height = 200; - }; - document.body.appendChild(ad_script); + let ad_frame = document.createElement('iframe'); + document.body.appendChild(ad_frame); + internals.setIsAdSubframe(ad_frame); + ad_frame.width = 100; + ad_frame.height = 200; + ad_frame.src = "about:blank"; `); + + // The first navigation will occur before the frame is set as an ad subframe. + // So, we wait for the second navigation before logging the adFrameType. + await dp.Page.onceFrameNavigated(); const { params } = await dp.Page.onceFrameNavigated(); testRunner.log({ adFrameType: params.frame.adFrameType }); - testRunner.completeTest(); })
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/resources/ad-iframe-writer.js b/third_party/blink/web_tests/http/tests/inspector-protocol/resources/ad-iframe-writer.js deleted file mode 100644 index 5b321dd2..0000000 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/resources/ad-iframe-writer.js +++ /dev/null
@@ -1,7 +0,0 @@ -// Creates and iframe and appends it to the body element. Make sure the caller -// has a body element! -function createAdFrame() { - let ad_frame = document.createElement('iframe'); - document.body.appendChild(ad_frame); - return ad_frame; -}
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight-frame-larger-than-viewport.html b/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight-frame-larger-than-viewport.html index bedd11d..17a1f5e 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight-frame-larger-than-viewport.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight-frame-larger-than-viewport.html
@@ -7,35 +7,27 @@ margin: 0; } </style> +<script src="resources/ad-iframe-writer.js"></script> </head> <body> <script type="text/javascript"> if (window.testRunner) { - // Inject a subresource filter to mark 'ad-iframe-writer.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["ad-iframe-writer.js"], false /* block_subresources */); testRunner.setHighlightAds(); } -// Script must be loaded after disallowed paths are set to be marked as an ad. -let ad_script = document.createElement("script"); -ad_script.async = false; -ad_script.src = "resources/ad-iframe-writer.js"; -ad_script.onload = function () { - ad_frame = createAdFrame(); - ad_frame.style.borderWidth = 0; - ad_frame.width = 100; - ad_frame.height = 1000; - // Scroll down to verify that the overlay is drawn correctly for the portion of the - // frame that is larger than the viewport. - window.scrollTo(0, 400); - // Finish the test once the ad frame is loaded. - ad_frame.onload = function () { - if (window.testRunner) - testRunner.notifyDone(); - } - ad_frame.src = "about:blank"; -}; -document.body.appendChild(ad_script); +ad_frame = createAdFrame(); +ad_frame.style.borderWidth = 0; +ad_frame.width = 100; +ad_frame.height = 1000; +// Scroll down to verify that the overlay is drawn correctly for the portion of the +// frame that is larger than the viewport. +window.scrollTo(0, 400); +// Finish the test once the ad frame is loaded. +ad_frame.onload = function () { + if (window.testRunner) + testRunner.notifyDone(); +} +ad_frame.src = "about:blank"; if (window.testRunner) testRunner.waitUntilDone();
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight-frame-resized.html b/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight-frame-resized.html index f451e4d..5a194f60 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight-frame-resized.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight-frame-resized.html
@@ -1,31 +1,23 @@ <!DOCTYPE html> <html> +<head><script src="resources/ad-iframe-writer.js"></script></head> <body> <script type="text/javascript"> if (window.testRunner) { - // Inject a subresource filter to mark 'ad-iframe-writer.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["ad-iframe-writer.js"], false /* block_subresources */); testRunner.setHighlightAds(); } -// Script must be loaded after disallowed paths are set to be marked as an ad. -let ad_script = document.createElement("script"); -ad_script.async = false; -ad_script.src = "resources/ad-iframe-writer.js"; -ad_script.onload = function () { - ad_frame = createAdFrame(); - ad_frame.width = 100; - ad_frame.height = 200; - // Finish the test once the ad frame is loaded. - ad_frame.onload = function () { - // Resize the frame to verify that the highlight is also resized. - ad_frame.width = 300; - if (window.testRunner) - testRunner.notifyDone(); - } - ad_frame.src = "about:blank"; -}; -document.body.appendChild(ad_script); +ad_frame = createAdFrame(); +ad_frame.width = 100; +ad_frame.height = 200; +// Finish the test once the ad frame is loaded. +ad_frame.onload = function () { + // Resize the frame to verify that the highlight is also resized. + ad_frame.width = 300; + if (window.testRunner) + testRunner.notifyDone(); +} +ad_frame.src = "about:blank"; if (window.testRunner) testRunner.waitUntilDone();
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight.html b/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight.html index 5cc7d17..7d5e4f55 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/ad-highlight.html
@@ -1,29 +1,21 @@ <!DOCTYPE html> <html> +<head><script src="resources/ad-iframe-writer.js"></script></head> <body> <script type="text/javascript"> if (window.testRunner) { - // Inject a subresource filter to mark 'ad-iframe-writer.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["ad-iframe-writer.js"], false /* block_subresources */); testRunner.setHighlightAds(); } -// Script must be loaded after disallowed paths are set to be marked as an ad. -let ad_script = document.createElement("script"); -ad_script.async = false; -ad_script.src = "resources/ad-iframe-writer.js"; -ad_script.onload = function () { - ad_frame = createAdFrame(); - ad_frame.width = 100; - ad_frame.height = 200; - // Finish the test once the ad frame is loaded. - ad_frame.onload = function () { - if (window.testRunner) - testRunner.notifyDone(); - } - ad_frame.src = "about:blank"; -}; -document.body.appendChild(ad_script); +ad_frame = createAdFrame(); +ad_frame.width = 100; +ad_frame.height = 200; +// Finish the test once the ad frame is loaded. +ad_frame.onload = function () { + if (window.testRunner) + testRunner.notifyDone(); +} +ad_frame.src = "about:blank"; if (window.testRunner) testRunner.waitUntilDone();
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-bottom-fixed-position.html b/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-bottom-fixed-position.html index 1e7ea38..1238d23 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-bottom-fixed-position.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-bottom-fixed-position.html
@@ -23,6 +23,7 @@ </style> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/large-sticky-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> <!-- To trigger the first contentful paint at the very start --> @@ -30,58 +31,43 @@ <!-- To be positioned further down in the main page to make the page scrollable --> <div class="bottom"></div> <script> +async_test(async function(t) { + // Create the large-sticky-ad. + appendAdFrameTo(document.body); -if (window.testRunner) { - // Inject a subresource filter to mark 'large-sticky-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["large-sticky-ad-testharness.js"], false /* block_subresources */); -} + // After 1500ms, force a layout update so that the sticky ad detector is + // aware of the sticky ad candidate. + await timeout(1500); + await forceLayoutUpdate(); -promise_test(() => { - return new Promise((resolve, reject) => { - - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/large-sticky-ad-testharness.js"; - ad_script.onload = async() => { - // Create the large-sticky-ad. - appendAdFrameTo(document.body); - - // After 1500ms, force a layout update so that the sticky ad detector is - // aware of the sticky ad candidate. - await timeout(1500); - await forceLayoutUpdate(); - if (internals.isUseCounted(document, kLargeStickyAd)) { - reject(); - } - - // Scroll down to 1px. - window.scrollTo(0, 1); - - // After 1500ms, force a layout update. At this point the scrolling - // position hasn't changed much since the detector first saw the - // candidate, so we expect no use counter for kLargeStickyAd. - await timeout(1500); - await forceLayoutUpdate(); - if (internals.isUseCounted(document, kLargeStickyAd)) { - reject(); - } - - // Scroll down to 5000px. - window.scrollTo(0, 5000); - - // After 1500ms, force a layout update. At this point the scrolling - // position has changed by a distance greater than the candidate's height, - // so the use counter kLargeStickyAd should be recorded. - await timeout(1500); - await forceLayoutUpdate(); - if (!internals.isUseCounted(document, kLargeStickyAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + t.step(function () { + assert_false(internals.isUseCounted(document, kLargeStickyAd)); }); + + // Scroll down to 1px. + window.scrollTo(0, 1); + + // After 1500ms, force a layout update. At this point the scrolling + // position hasn't changed much since the detector first saw the + // candidate, so we expect no use counter for kLargeStickyAd. + await timeout(1500); + await forceLayoutUpdate(); + t.step(function () { + assert_false(internals.isUseCounted(document, kLargeStickyAd)); + }); + + // Scroll down to 5000px. + window.scrollTo(0, 5000); + + // After 1500ms, force a layout update. At this point the scrolling + // position has changed by a distance greater than the candidate's height, + // so the use counter kLargeStickyAd should be recorded. + await timeout(1500); + await forceLayoutUpdate(); + t.step(function () { + assert_true(internals.isUseCounted(document, kLargeStickyAd)); + }); + t.done(); }, "Test UseCounter for large-sticky-ad at the bottom when the frame itself has a fixed position."); </script> </body>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-bottom-frequent-reposition.html b/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-bottom-frequent-reposition.html index 1dc3674..91b71808 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-bottom-frequent-reposition.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-bottom-frequent-reposition.html
@@ -23,6 +23,7 @@ </style> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/large-sticky-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> <!-- To trigger the first contentful paint at the very start --> @@ -30,51 +31,36 @@ <!-- To be positioned further down in the main page to make the page scrollable --> <div class="bottom"></div> <script> +async_test(async function(t) { + // Create the large-sticky-ad. + appendAdFrameTo(document.body); -if (window.testRunner) { - // Inject a subresource filter to mark 'large-sticky-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["large-sticky-ad-testharness.js"], false /* block_subresources */); -} + let ad_candidate = document.getElementsByTagName("iframe")[0]; + let initial_margin_top = parseInt(window.getComputedStyle(ad_candidate).marginTop, 10); -promise_test(() => { - return new Promise((resolve, reject) => { - - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/large-sticky-ad-testharness.js"; - ad_script.onload = async() => { - // Create the large-sticky-ad. - appendAdFrameTo(document.body); - - let ad_candidate = document.getElementsByTagName("iframe")[0]; - let initial_margin_top = parseInt(window.getComputedStyle(ad_candidate).marginTop, 10); - - // After 1500ms, force a layout update so that the sticky ad detector is - // aware of the sticky ad candidate. - await timeout(1500); - await forceLayoutUpdate(); - if (internals.isUseCounted(document, kLargeStickyAd)) { - reject(); - } - - // Scroll down to 5000px. Reset the frame's position w.r.t. the viewport - // to its initial position. - window.scrollTo(0, 5000); - ad_candidate.style.marginTop = initial_margin_top + window.scrollY + 'px'; - - // After 1500ms, force a layout update. At this point the scrolling - // position has changed by a distance greater than the candidate's height, - // so the use counter kLargeStickyAd should be recorded. - await timeout(1500); - await forceLayoutUpdate(); - if (!internals.isUseCounted(document, kLargeStickyAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // After 1500ms, force a layout update so that the sticky ad detector is + // aware of the sticky ad candidate. + await timeout(1500); + await forceLayoutUpdate(); + t.step(function () { + assert_false(internals.isUseCounted(document, kLargeStickyAd)); }); + + // Scroll down to 5000px. Reset the frame's position w.r.t. the viewport + // to its initial position. + window.scrollTo(0, 5000); + ad_candidate.style.marginTop = initial_margin_top + window.scrollY + 'px'; + + // After 1500ms, force a layout update. At this point the scrolling + // position has changed by a distance greater than the candidate's height, + // so the use counter kLargeStickyAd should be recorded. + await timeout(1500); + await forceLayoutUpdate(); + t.step(function() { + assert_true(internals.isUseCounted(document, kLargeStickyAd)); + }); + + t.done(); }, "Test UseCounter for large-sticky-ad at the bottom when the frame itself has an absolute position, and along with scrolling the ad's position w.r.t. the browser viewport gets frequently reset to the initial postion."); </script> </body>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-center-no-use-counter.html b/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-center-no-use-counter.html index a9297e29..9d1d3e1 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-center-no-use-counter.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/large-sticky-ad-center-no-use-counter.html
@@ -23,6 +23,7 @@ </style> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/large-sticky-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> <!-- To trigger the first contentful paint at the very start --> @@ -30,45 +31,30 @@ <!-- To be positioned further down in the main page to make the page scrollable --> <div class="bottom"></div> <script> +async_test(async function(t) { + // Create the large-sticky-ad. + appendAdFrameTo(document.body); -if (window.testRunner) { - // Inject a subresource filter to mark 'large-sticky-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["large-sticky-ad-testharness.js"], false /* block_subresources */); -} - -promise_test(() => { - return new Promise((resolve, reject) => { - - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/large-sticky-ad-testharness.js"; - ad_script.onload = async() => { - // Create the large-sticky-ad. - appendAdFrameTo(document.body); - - // After 1500ms, force a layout update. - await timeout(1500); - await forceLayoutUpdate(); - if (internals.isUseCounted(document, kLargeStickyAd)) { - reject(); - } - - // Scroll down to 5000px. - window.scrollTo(0, 5000); - - // After 1500ms, force a layout update. At this point the scrolling - // position has changed by a distance greater than the candidate's height. - // We expect no kLargeStickyAd use counter. - await timeout(1500); - await forceLayoutUpdate(); - if (internals.isUseCounted(document, kLargeStickyAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // After 1500ms, force a layout update. + await timeout(1500); + await forceLayoutUpdate(); + t.step(function () { + assert_false(internals.isUseCounted(document, kLargeStickyAd)); }); + + // Scroll down to 5000px. + window.scrollTo(0, 5000); + + // After 1500ms, force a layout update. At this point the scrolling + // position has changed by a distance greater than the candidate's height. + // We expect no kLargeStickyAd use counter. + await timeout(1500); + await forceLayoutUpdate(); + t.step(function () { + assert_false(internals.isUseCounted(document, kLargeStickyAd)); + }); + + t.done(); }, "Test a large-sticky-ad at the center. In this case, we expect no use counter for kLargeStickyAd."); </script> </body>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-body-overflow-hidden.html b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-body-overflow-hidden.html index 16f646d0..be2f39249 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-body-overflow-hidden.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-body-overflow-hidden.html
@@ -20,6 +20,7 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0" overflow="hidden"> @@ -31,43 +32,32 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // After 1500ms, force a layout update so that the interstitial detector - // is aware of the first meaningful paint, and future overlay candidates - // will be considered for pop-ups rather than for prestitials. - await timeout(1500); - await forceLayoutUpdate(); +async_test(async function(t) { + // After 1500ms, force a layout update so that the interstitial detector + // is aware of the first meaningful paint, and future overlay candidates + // will be considered for pop-ups rather than for prestitials. + await timeout(1500); + await forceLayoutUpdate(); - document.body.style.overflow = "hidden"; + document.body.style.overflow = "hidden"; - // Create the overlay pop-up ad. - appendAdFrameTo(document.getElementsByTagName('div')[0]); + // Create the overlay pop-up ad. + appendAdFrameTo(document.getElementsByTagName('div')[0]); - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate. + await forceLayoutUpdate(); - // Expect the OverlayPopupAd UseCounter. - if (!internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect the OverlayPopupAd UseCounter. + t.step(function () { + assert_true(internals.isUseCounted(document, kOverlayPopupAd)); }); -}, "Test UseCounter for overlay-popup-ad when the frame has position:absolute and the <body> has overflow:hidden."); + t.done(); +}, "Test UseCounter for overlay-popup-ad when the frame has position:absolute and the <body> has overflow:hidden."); </script> </body> </html>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-created-with-gesture.html b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-created-with-gesture.html index 3a986f99..8ec2c7b 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-created-with-gesture.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-created-with-gesture.html
@@ -27,6 +27,7 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -41,54 +42,44 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // After 1500ms, force a layout update so that the interstitial detector - // is aware of the first meaningful paint, and future overlay candidates - // will be considered for pop-ups rather than for prestitials. - await timeout(1500); - await forceLayoutUpdate(); +async_test(async function(t) { + // After 1500ms, force a layout update so that the interstitial detector + // is aware of the first meaningful paint, and future overlay candidates + // will be considered for pop-ups rather than for prestitials. + await timeout(1500); + await forceLayoutUpdate(); - // Ensure a user gesture happened in the main frame. - if (window.eventSender) { - eventSender.mouseMoveTo(1, 1); - eventSender.mouseDown(1, 1); - eventSender.mouseUp(1, 1); - } + // Ensure a user gesture happened in the main frame. + if (window.eventSender) { + eventSender.mouseMoveTo(1, 1); + eventSender.mouseDown(1, 1); + eventSender.mouseUp(1, 1); + } - // Create the overlay pop-up ad. - appendAdFrameTo(document.getElementsByTagName('div')[0]); + // Create the overlay pop-up ad. + appendAdFrameTo(document.getElementsByTagName('div')[0]); - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate. + await forceLayoutUpdate(); - // Hide the pop-up. - document.getElementsByTagName('iframe')[0].style.display = 'none'; + // Hide the pop-up. + document.getElementsByTagName('iframe')[0].style.display = 'none'; - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate's dismissal. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate's dismissal. + await forceLayoutUpdate(); - // Expect no OverlayPopupAd UseCounter as the popup was created with user - // gesture. - if (internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect no OverlayPopupAd UseCounter as the popup was created with user + // gesture. + t.step(function() { + assert_false(internals.isUseCounted(document, kOverlayPopupAd)); }); + + t.done(); }, "Test overlay-popup-ad when the frame itself has a fixed position and it's created with user gesture. In this case, we expect no use counter for kOverlayPopupAd."); </script>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-fixed-position.html b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-fixed-position.html index 5e0e747d..a9475f9 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-fixed-position.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-fixed-position.html
@@ -27,6 +27,7 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -41,46 +42,36 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // After 1500ms, force a layout update so that the interstitial detector - // is aware of the first meaningful paint, and future overlay candidates - // will be considered for pop-ups rather than for prestitials. - await timeout(1500); - await forceLayoutUpdate(); +async_test(async function(t) { + // After 1500ms, force a layout update so that the interstitial detector + // is aware of the first meaningful paint, and future overlay candidates + // will be considered for pop-ups rather than for prestitials. + await timeout(1500); + await forceLayoutUpdate(); - // Create the overlay pop-up ad. - appendAdFrameTo(document.getElementsByTagName('div')[0]); + // Create the overlay pop-up ad. + appendAdFrameTo(document.getElementsByTagName('div')[0]); - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate. + await forceLayoutUpdate(); - // Hide the pop-up. - document.getElementsByTagName('iframe')[0].style.display = 'none'; + // Hide the pop-up. + document.getElementsByTagName('iframe')[0].style.display = 'none'; - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate's dismissal. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate's dismissal. + await forceLayoutUpdate(); - // Expect the OverlayPopupAd UseCounter. - if (!internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect the OverlayPopupAd UseCounter. + t.step(function() { + assert_true(internals.isUseCounted(document, kOverlayPopupAd)); }); + + t.done(); }, "Test UseCounter for overlay-popup-ad when the frame itself has a fixed position."); </script>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-outer-div-fixed-position.html b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-outer-div-fixed-position.html index 83c2b6193..ffc802f 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-outer-div-fixed-position.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-outer-div-fixed-position.html
@@ -27,6 +27,7 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -41,46 +42,36 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // After 1500ms, force a layout update so that the interstitial detector - // is aware of the first meaningful paint, and future overlay candidates - // will be considered for pop-ups rather than for prestitials. - await timeout(1500); - await forceLayoutUpdate(); +async_test(async function(t) { + // After 1500ms, force a layout update so that the interstitial detector + // is aware of the first meaningful paint, and future overlay candidates + // will be considered for pop-ups rather than for prestitials. + await timeout(1500); + await forceLayoutUpdate(); - // Create the overlay pop-up ad. - appendAdFrameTo(document.getElementsByTagName('div')[0]); + // Create the overlay pop-up ad. + appendAdFrameTo(document.getElementsByTagName('div')[0]); - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate. + await forceLayoutUpdate(); - // Hide the pop-up. - document.getElementsByTagName('iframe')[0].style.display = 'none'; + // Hide the pop-up. + document.getElementsByTagName('iframe')[0].style.display = 'none'; - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate's dismissal. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate's dismissal. + await forceLayoutUpdate(); - // Expect the OverlayPopupAd UseCounter. - if (!internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect the OverlayPopupAd UseCounter. + t.step(function() { + assert_true(internals.isUseCounted(document, kOverlayPopupAd)); }); + + t.done(); }, "Test UseCounter for overlay-popup-ad when the frame's outer div has a fixed position."); </script>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-size-too-small.html b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-size-too-small.html index a43078e7..4dab2f42 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-size-too-small.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-size-too-small.html
@@ -27,6 +27,7 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -41,47 +42,37 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // After 1500ms, force a layout update so that the interstitial detector - // is aware of the first meaningful paint, and future overlay candidates - // will be considered for pop-ups rather than for prestitials. - await timeout(1500); - await forceLayoutUpdate(); +async_test(async function(t) { + // After 1500ms, force a layout update so that the interstitial detector + // is aware of the first meaningful paint, and future overlay candidates + // will be considered for pop-ups rather than for prestitials. + await timeout(1500); + await forceLayoutUpdate(); - // Create the overlay pop-up ad. - appendAdFrameTo(document.getElementsByTagName('div')[0]); + // Create the overlay pop-up ad. + appendAdFrameTo(document.getElementsByTagName('div')[0]); - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate. + await forceLayoutUpdate(); - // Hide the pop-up. - document.getElementsByTagName('iframe')[0].style.display = 'none'; + // Hide the pop-up. + document.getElementsByTagName('iframe')[0].style.display = 'none'; - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate's dismissal. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate's dismissal. + await forceLayoutUpdate(); - // Expect that the use counter kOverlayPopupAd is not recorded, as the - // ad size is too small relative to the viewport size. - if (internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect that the use counter kOverlayPopupAd is not recorded, as the + // ad size is too small relative to the viewport size. + t.step(function() { + assert_false(internals.isUseCounted(document, kOverlayPopupAd)); }); + + t.done(); }, "Test overlay-popup-ad when the frame itself has a fixed position and the size is less than 10% of the viewport size. In this case, we expect no use counter for kOverlayPopupAd."); </script>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-video-midrolls.html b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-video-midrolls.html index c5bea78..d7e7c873 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-video-midrolls.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-video-midrolls.html
@@ -28,6 +28,7 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -42,50 +43,40 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // After 1500ms, force a layout update so that the interstitial detector - // would have been aware of the first meaningful paint (hadn't we skipped - // the detection in fullscreen video scenario). - await timeout(1500); - await forceLayoutUpdate(); +async_test(async function(t) { + // After 1500ms, force a layout update so that the interstitial detector + // would have been aware of the first meaningful paint (hadn't we skipped + // the detection in fullscreen video scenario). + await timeout(1500); + await forceLayoutUpdate(); - // Create the overlay pop-up ad. - appendAdFrameTo(document.body); + // Create the overlay pop-up ad. + appendAdFrameTo(document.body); - // Force a layout update, so that the interstitial detector would have - // been aware of the overlay candidate (hadn't we skipped the detection in - // fullscreen video scenario). - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector would have + // been aware of the overlay candidate (hadn't we skipped the detection in + // fullscreen video scenario). + await forceLayoutUpdate(); - // Hide the pop-up. - document.getElementsByTagName('iframe')[0].style.display = 'none'; + // Hide the pop-up. + document.getElementsByTagName('iframe')[0].style.display = 'none'; - // Force a layout update, so that the interstitial detector would have - // been aware of the overlay candidate's dismissal (hadn't we skipped the - // detection in fullscreen video scenario). - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector would have + // been aware of the overlay candidate's dismissal (hadn't we skipped the + // detection in fullscreen video scenario). + await forceLayoutUpdate(); - // Expect that the use counter kOverlayPopupAd is not recorded, as we - // skipped all previous detection due to there was a fullscreen video - // element. - if (internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect that the use counter kOverlayPopupAd is not recorded, as we + // skipped all previous detection due to there was a fullscreen video + // element. + t.step(function () { + assert_false(internals.isUseCounted(document, kOverlayPopupAd)); }); + + t.done(); }, "Test that we will skip the overlay-popup-ad detection if there's a dominant video element in the page."); </script>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-viewport-resize.html b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-viewport-resize.html index 16ced8a0..21d6649 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-viewport-resize.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-ad-viewport-resize.html
@@ -26,6 +26,7 @@ </style> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -38,81 +39,71 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // After 1500ms, force a layout update so that the interstitial detector - // is aware of the first meaningful paint, and future overlay candidates - // will be considered for pop-ups rather than for prestitials. - await timeout(1500); - await forceLayoutUpdate(); +async_test(async function(t) { + // After 1500ms, force a layout update so that the interstitial detector + // is aware of the first meaningful paint, and future overlay candidates + // will be considered for pop-ups rather than for prestitials. + await timeout(1500); + await forceLayoutUpdate(); - // Create the overlay pop-up ad. - appendAdFrameTo(document.getElementsByTagName('div')[0]); + // Create the overlay pop-up ad. + appendAdFrameTo(document.getElementsByTagName('div')[0]); - // Make the page unscrollable so that future overlay candidates can be - // determined immediately rather than at dismissal time. - document.body.style.overflow = "hidden"; + // Make the page unscrollable so that future overlay candidates can be + // determined immediately rather than at dismissal time. + document.body.style.overflow = "hidden"; - // Force a layout update, so that the interstitial detector is aware of - // the current viewport size. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the current viewport size. + await forceLayoutUpdate(); - // Expect no OverlayPopupAd usage, as the ad frame is not in the center of - // the viewport. - if (internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - // Resize the window to to make the overlay iframe centered and large - // relative to the viewport. - testRunner.useUnfortunateSynchronousResizeMode(); - testRunner.waitUntilDone(); - window.resizeTo(150, 150); - - // Force a layout update, so that the interstitial detector - // is aware of the updated viewport size, and the overlay ad iframe. - await forceLayoutUpdate(); - - // Expect no OverlayPopupAd usage, as the viewport has just been resized - // so we have skipped this detection. - if (internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - // Force a layout update, to trigger another detection event. - await forceLayoutUpdate(); - - // Expect no OverlayPopupAd usage, as the overlay has been marked - // unqualified. - if (internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - // Create another overlay pop-up ad. - appendAdFrameTo(document.getElementsByTagName('div')[0]); - - // Force a layout update so that the interstitial detector is aware of - // the new overlay ad iframe. - await forceLayoutUpdate(); - - // Expect OverlayPopupAd usage due to the appearance of the new overlay. - if (!internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect no OverlayPopupAd usage, as the ad frame is not in the center of + // the viewport. + t.step(function () { + assert_false(internals.isUseCounted(document, kOverlayPopupAd)); }); + + // Resize the window to to make the overlay iframe centered and large + // relative to the viewport. + testRunner.useUnfortunateSynchronousResizeMode(); + testRunner.waitUntilDone(); + window.resizeTo(150, 150); + + // Force a layout update, so that the interstitial detector + // is aware of the updated viewport size, and the overlay ad iframe. + await forceLayoutUpdate(); + + // Expect no OverlayPopupAd usage, as the viewport has just been resized + // so we have skipped this detection. + t.step(function () { + assert_false(internals.isUseCounted(document, kOverlayPopupAd)); + }); + + // Force a layout update, to trigger another detection event. + await forceLayoutUpdate(); + + // Expect no OverlayPopupAd usage, as the overlay has been marked + // unqualified. + t.step(function () { + assert_false(internals.isUseCounted(document, kOverlayPopupAd)); + }); + + // Create another overlay pop-up ad. + appendAdFrameTo(document.getElementsByTagName('div')[0]); + + // Force a layout update so that the interstitial detector is aware of + // the new overlay ad iframe. + await forceLayoutUpdate(); + + // Expect OverlayPopupAd usage due to the appearance of the new overlay. + t.step(function () { + assert_true(internals.isUseCounted(document, kOverlayPopupAd)); + }); + + t.done(); }, "Test overlay-popup-ad when the ad appears before (no use counter) & after (use counter) resizing the viewport."); </script> </body>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-non-ad-followed-by-ad.html b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-non-ad-followed-by-ad.html index ff24d33..bf3d14a 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-non-ad-followed-by-ad.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-popup-non-ad-followed-by-ad.html
@@ -33,6 +33,7 @@ </style> <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -45,71 +46,61 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // After 1500ms, force a layout update so that the interstitial detector - // is aware of the first meaningful paint, and future overlay candidates - // will be considered for pop-ups rather than for prestitials. - await timeout(1500); - await forceLayoutUpdate(); +async_test(async function(t) { + // After 1500ms, force a layout update so that the interstitial detector + // is aware of the first meaningful paint, and future overlay candidates + // will be considered for pop-ups rather than for prestitials. + await timeout(1500); + await forceLayoutUpdate(); - // Create a overlay pop-up <form> element. - let form = document.createElement('form'); - document.getElementsByTagName('div')[0].appendChild(form); + // Create a overlay pop-up <form> element. + let form = document.createElement('form'); + document.getElementsByTagName('div')[0].appendChild(form); - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate. + await forceLayoutUpdate(); - // Hide the pop-up. - document.getElementsByTagName('form')[0].style.display = 'none'; + // Hide the pop-up. + document.getElementsByTagName('form')[0].style.display = 'none'; - // Force a layout update, so that the interstitial detector is aware of - // the overlay candidate's dismissal. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay candidate's dismissal. + await forceLayoutUpdate(); - // Expect use counter kOverlayPopup. - if (!internals.isUseCounted(document, kOverlayPopup)) { - reject(); - } - - // Expect use counter kOverlayPopupAd is NOT recorded. - if (internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - // Create the overlay pop-up ad. - appendAdFrameTo(document.getElementsByTagName('div')[0]); - - // Force a layout update, so that the interstitial detector is aware of - // the overlay ad candidate. - await forceLayoutUpdate(); - - // Hide the pop-up ad. - document.getElementsByTagName('iframe')[0].style.display = 'none'; - - // Force a layout update, so that the interstitial detector is aware of - // the overlay ad candidate's dismissal. - await forceLayoutUpdate(); - - // Expect use counter kOverlayPopupAd. - if (!internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect use counter kOverlayPopup. + t.step(function () { + assert_true(internals.isUseCounted(document, kOverlayPopup)); }); + + // Expect use counter kOverlayPopupAd is NOT recorded. + t.step(function () { + assert_false(internals.isUseCounted(document, kOverlayPopupAd)); + }); + + // Create the overlay pop-up ad. + appendAdFrameTo(document.getElementsByTagName('div')[0]); + + // Force a layout update, so that the interstitial detector is aware of + // the overlay ad candidate. + await forceLayoutUpdate(); + + // Hide the pop-up ad. + document.getElementsByTagName('iframe')[0].style.display = 'none'; + + // Force a layout update, so that the interstitial detector is aware of + // the overlay ad candidate's dismissal. + await forceLayoutUpdate(); + + // Expect use counter kOverlayPopupAd. + t.step(function () { + assert_true(internals.isUseCounted(document, kOverlayPopupAd)); + }); + + t.done(); }, "Test UseCounter for overlay-popup non-ad element followed by an ad element."); </script> </body>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-prestitial-ad.html b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-prestitial-ad.html index 600cd3c..b7a6b52 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/overlay-prestitial-ad.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/overlay-prestitial-ad.html
@@ -16,6 +16,7 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -24,46 +25,36 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // Create the overlay pop-up ad. - let ad_frame = appendAdFrameTo(document.body); +async_test(async function(t) { + // Create the overlay pop-up ad. + let ad_frame = appendAdFrameTo(document.body); - // After 1500ms, force a layout update so that the interstitial detector - // is aware of the first meaningful paint and the prestitial. - await timeout(1500); - await forceLayoutUpdate(); + // After 1500ms, force a layout update so that the interstitial detector + // is aware of the first meaningful paint and the prestitial. + await timeout(1500); + await forceLayoutUpdate(); - // Ensure the detection is triggered at least once after the first - // meaningful paint is seen. - await forceLayoutUpdate(); + // Ensure the detection is triggered at least once after the first + // meaningful paint is seen. + await forceLayoutUpdate(); - // Hide the pop-up. - document.getElementsByTagName('iframe')[0].style.display = 'none'; + // Hide the pop-up. + document.getElementsByTagName('iframe')[0].style.display = 'none'; - // Force a layout update, so that the interstitial detector is aware of - // the overlay ad candidate's dismissal. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay ad candidate's dismissal. + await forceLayoutUpdate(); - // Expect no kOverlayPopupAd UseCounter as the candidate is considered to - // be 'prestitial' instead of 'pop-up'. - if (internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect no kOverlayPopupAd UseCounter as the candidate is considered to + // be 'prestitial' instead of 'pop-up'. + t.step(function () { + assert_false(internals.isUseCounted(document, kOverlayPopupAd)); }); + + t.done(); }, "Test overlay-prestitial-ad when the frame itself has a fixed position. In this case we expect no use counter for kOverlayPopupAd."); </script>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/parallax-ad-no-large-sticky-ad-use-counter.html b/third_party/blink/web_tests/http/tests/subresource_filter/parallax-ad-no-large-sticky-ad-use-counter.html index 2afce29..48c4701 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/parallax-ad-no-large-sticky-ad-use-counter.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/parallax-ad-no-large-sticky-ad-use-counter.html
@@ -40,6 +40,7 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/large-sticky-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -51,50 +52,37 @@ <div class="content2">some content</div> <script> -if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["large-sticky-ad-testharness.js"], false /* block_subresources */); -} +async_test(async function(t) { + // Create the large-sticky-ad. + appendAdFrameTo(document.body); -promise_test(() => { - return new Promise((resolve, reject) => { + // Scroll down to the position where the parallax-ad is no longer + // covered by "content1" and becomes visible. + window.scrollTo(0, window.innerHeight); - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/large-sticky-ad-testharness.js"; - ad_script.onload = async() => { - // Create the large-sticky-ad. - appendAdFrameTo(document.body); - - // Scroll down to the position where the parallax-ad is no longer - // covered by "content1" and becomes visible. - window.scrollTo(0, window.innerHeight); - - // After 1500ms, force a layout update so that the large-sticky-ad - // detector is aware of the candidate. - await timeout(1500); - await forceLayoutUpdate(); - if (internals.isUseCounted(document, kLargeStickyAd)) { - reject(); - } - - // Scroll further down to the position where the parallax-ad is covered by - // "content2" and becomes invisible again. - window.scrollTo(0, window.innerHeight * 2); - - // After 1500ms, force a layout update so that the large-sticky-ad - // detector is aware of the dismissal of the candidate. We expect no use - // counter for kLargeStickyAd. - await timeout(1500); - await forceLayoutUpdate(); - if (internals.isUseCounted(document, kLargeStickyAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // After 1500ms, force a layout update so that the large-sticky-ad + // detector is aware of the candidate. + await timeout(1500); + await forceLayoutUpdate(); + t.step(function () { + assert_false(internals.isUseCounted(document, kLargeStickyAd)); }); + + // Scroll further down to the position where the parallax-ad is covered by + // "content2" and becomes invisible again. + window.scrollTo(0, window.innerHeight * 2); + + // After 1500ms, force a layout update so that the large-sticky-ad + // detector is aware of the dismissal of the candidate. We expect no use + // counter for kLargeStickyAd. + await timeout(1500); + await forceLayoutUpdate(); + + t.step(function () { + assert_false(internals.isUseCounted(document, kLargeStickyAd)); + }); + + t.done(); }, "Test parallax-ad while scrolling over the page. In this case, we expect no use counter for kLargeStickyAd."); </script>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/parallax-ad-no-overlay-popup-ad-use-counter.html b/third_party/blink/web_tests/http/tests/subresource_filter/parallax-ad-no-overlay-popup-ad-use-counter.html index 038ce9c77..6a95e88 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/parallax-ad-no-overlay-popup-ad-use-counter.html +++ b/third_party/blink/web_tests/http/tests/subresource_filter/parallax-ad-no-overlay-popup-ad-use-counter.html
@@ -40,6 +40,7 @@ <script src="../resources/testharness.js"></script> <script src="../resources/testharnessreport.js"></script> +<script src="resources/overlay-interstitial-ad-testharness.js"></script> </head> <body marginwidth="0" marginheight="0"> @@ -52,53 +53,43 @@ <script> if (window.testRunner) { - // Inject a subresource filter to mark 'overlay-interstitial-ad-testharness.js' as a would be disallowed resource. - testRunner.setDisallowedSubresourcePathSuffixes(["overlay-interstitial-ad-testharness.js"], false /* block_subresources */); internals.DisableFrequencyCappingForOverlayPopupDetection(); } -promise_test(() => { - return new Promise((resolve, reject) => { - let ad_script = document.createElement("script"); - ad_script.async = false; - ad_script.src = "resources/overlay-interstitial-ad-testharness.js"; - ad_script.onload = async() => { - // After 1500ms, force a layout update so that the interstitial detector - // is aware of the first meaningful paint, and future overlay candidates - // will be considered for pop-ups rather than for prestitials. - await timeout(1500); - await forceLayoutUpdate(); +async_test(async function(t) { + // After 1500ms, force a layout update so that the interstitial detector + // is aware of the first meaningful paint, and future overlay candidates + // will be considered for pop-ups rather than for prestitials. + await timeout(1500); + await forceLayoutUpdate(); - // Create the parallax-ad, which is below the "content" div and above the - // "empty" div. - appendAdFrameTo(document.body); + // Create the parallax-ad, which is below the "content" div and above the + // "empty" div. + appendAdFrameTo(document.body); - // Scroll down to the position where the parallax-ad is no longer covered - // by "content1" and becomes visible. - window.scrollTo(0, document.documentElement.clientHeight); + // Scroll down to the position where the parallax-ad is no longer covered + // by "content1" and becomes visible. + window.scrollTo(0, document.documentElement.clientHeight); - // Force a layout update, so that the interstitial detector is aware of - // the overlay ad candidate. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay ad candidate. + await forceLayoutUpdate(); - // Scroll further down to the position where the parallax-ad is covered by - // "content2" and becomes invisible again. - window.scrollTo(0, document.documentElement.clientHeight * 2); + // Scroll further down to the position where the parallax-ad is covered by + // "content2" and becomes invisible again. + window.scrollTo(0, document.documentElement.clientHeight * 2); - // Force a layout update, so that the interstitial detector is aware of - // the overlay ad candidate's dismissal. - await forceLayoutUpdate(); + // Force a layout update, so that the interstitial detector is aware of + // the overlay ad candidate's dismissal. + await forceLayoutUpdate(); - // Expect no kOverlayPopupAd UseCounter as the scroll offset has changed - // since the candidate's appearance. - if (internals.isUseCounted(document, kOverlayPopupAd)) { - reject(); - } - - resolve(); - }; - document.body.appendChild(ad_script); + // Expect no kOverlayPopupAd UseCounter as the scroll offset has changed + // since the candidate's appearance. + t.step(function () { + assert_false(internals.isUseCounted(document, kOverlayPopupAd)); }); + + t.done(); }, "Test parallax-ad while scrolling over the page. In this case, we expect no use counter for kOverlayPopupAd."); </script>
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/resources/ad-iframe-writer.js b/third_party/blink/web_tests/http/tests/subresource_filter/resources/ad-iframe-writer.js index 5b321dd2..58432b9a 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/resources/ad-iframe-writer.js +++ b/third_party/blink/web_tests/http/tests/subresource_filter/resources/ad-iframe-writer.js
@@ -3,5 +3,6 @@ function createAdFrame() { let ad_frame = document.createElement('iframe'); document.body.appendChild(ad_frame); + internals.setIsAdSubframe(ad_frame); return ad_frame; }
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/resources/large-sticky-ad-testharness.js b/third_party/blink/web_tests/http/tests/subresource_filter/resources/large-sticky-ad-testharness.js index 6d8c5dd..7003ffb 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/resources/large-sticky-ad-testharness.js +++ b/third_party/blink/web_tests/http/tests/subresource_filter/resources/large-sticky-ad-testharness.js
@@ -12,4 +12,5 @@ function appendAdFrameTo(parent) { let ad_frame = document.createElement('iframe'); parent.appendChild(ad_frame); + internals.setIsAdSubframe(ad_frame); }
diff --git a/third_party/blink/web_tests/http/tests/subresource_filter/resources/overlay-interstitial-ad-testharness.js b/third_party/blink/web_tests/http/tests/subresource_filter/resources/overlay-interstitial-ad-testharness.js index f854715..d17ea73 100644 --- a/third_party/blink/web_tests/http/tests/subresource_filter/resources/overlay-interstitial-ad-testharness.js +++ b/third_party/blink/web_tests/http/tests/subresource_filter/resources/overlay-interstitial-ad-testharness.js
@@ -15,5 +15,6 @@ function appendAdFrameTo(parent) { let ad_frame = document.createElement('iframe'); parent.appendChild(ad_frame); + internals.setIsAdSubframe(ad_frame); return ad_frame; }
diff --git a/tools/accessibility/inspect/README.md b/tools/accessibility/inspect/README.md index f3c0831..5e2d9ea6 100644 --- a/tools/accessibility/inspect/README.md +++ b/tools/accessibility/inspect/README.md
@@ -22,9 +22,13 @@ ### Run -To dump accessibility tree of application, run +On Windows run `ax_dump_tree --window=id` -where `id` is HWND on Windows, PID on Linux and Mac. +where `id` is HWND of a window to dump accessible tree for. + +On Mac and Linux, run +`ax_dump_tree --pid=id` +where `pid` is process id of an application to dump accessible tree for. Alternatively, you can indicate an application by its title: `ax_dump_tree --pattern=title` @@ -32,7 +36,7 @@ Notes: * To use a hex window handle prefix it with `0x`. * For json output, use the `--json` option -* To filter certain properties, use `--filters=[path-to-filters.txt]` where the filters text file has a series of `@ALLOW` and/or `@DENY` lines. See example-tree-filters.txt in tools/accessibility/inspect. +* To filter certain properties, use `--filters=[absolute-path-to-filters.txt]` where the filters text file has a series of `@ALLOW` and/or `@DENY` lines. See example-tree-filters.txt in tools/accessibility/inspect. * [Mac] You have to turn on Accessibility for Terminal in Security & Privacy System Preferences. ## Convenience PowerShell scripts
diff --git a/tools/accessibility/inspect/ax_dump_tree.cc b/tools/accessibility/inspect/ax_dump_tree.cc index f0e5269..701edad3 100644 --- a/tools/accessibility/inspect/ax_dump_tree.cc +++ b/tools/accessibility/inspect/ax_dump_tree.cc
@@ -12,10 +12,16 @@ #include "build/build_config.h" #include "tools/accessibility/inspect/ax_tree_server.h" -char kWindowSwitch[] = "window"; +char kIdSwitch[] = +#if defined(WINDOWS) + "window"; +#else + "pid"; +#endif char kPatternSwitch[] = "pattern"; char kFiltersSwitch[] = "filters"; char kJsonSwitch[] = "json"; +char kHelpSwitch[] = "help"; // Convert from string to int, whether in 0x hex format or decimal format. bool StringToInt(std::string str, unsigned* result) { @@ -44,46 +50,67 @@ #endif } +void PrintHelp() { + printf( + "ax_dump_tree is a tool designed to dump platform accessible trees " + "of running applications.\n"); + printf("\nusage: ax_dump_tree <options>\n"); + printf("options:\n"); +#if defined(WINDOWS) + printf(" --window\tHWND of a window to dump accessible tree for\n"); +#else + printf( + " --pid\t\tprocess id of an application to dump accessible tree for\n"); +#endif + printf(" --pattern\ttitle of an application to dump accessible tree for\n"); + printf( + " --filters\tfile containing property filters used to filter out\n" + " \t\taccessible tree, see example-tree-filters.txt as an example\n"); + printf(" --json\toutputs tree in JSON format\n"); +} + int main(int argc, char** argv) { logging::SetLogMessageHandler(AXDumpTreeLogMessageHandler); base::AtExitManager at_exit_manager; base::CommandLine::Init(argc, argv); + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); + + if (command_line->HasSwitch(kHelpSwitch)) { + PrintHelp(); + return 0; + } base::FilePath filters_path = - base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( - kFiltersSwitch); + command_line->GetSwitchValuePath(kFiltersSwitch); - bool use_json = - base::CommandLine::ForCurrentProcess()->HasSwitch(kJsonSwitch); + bool use_json = command_line->HasSwitch(kJsonSwitch); - std::string window_str = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - kWindowSwitch); - if (!window_str.empty()) { - unsigned window_id; - if (!StringToInt(window_str, &window_id)) { + std::string id_str = command_line->GetSwitchValueASCII(kIdSwitch); + if (!id_str.empty()) { + unsigned hwnd_or_pid; + if (!StringToInt(id_str, &hwnd_or_pid)) { LOG(ERROR) << "* Error: Could not convert window id string to integer."; return 1; } - gfx::AcceleratedWidget widget(CastToAcceleratedWidget(window_id)); + gfx::AcceleratedWidget widget(CastToAcceleratedWidget(hwnd_or_pid)); std::unique_ptr<content::AXTreeServer> server( new content::AXTreeServer(widget, filters_path, use_json)); return 0; } - std::string pattern_str = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - kPatternSwitch); + std::string pattern_str = command_line->GetSwitchValueASCII(kPatternSwitch); if (!pattern_str.empty()) { std::unique_ptr<content::AXTreeServer> server( new content::AXTreeServer(pattern_str, filters_path, use_json)); return 0; } - LOG(ERROR) << "* Error: Neither window handle (--window=[window-handle]) " - "nor pattern (--pattern=[pattern]) provided."; + LOG(ERROR) + << "* Error: no accessible tree was identified to dump. Run with --help " + "for help."; return 1; }
diff --git a/tools/binary_size/libsupersize/console.py b/tools/binary_size/libsupersize/console.py index 5dc225a..76e5420 100644 --- a/tools/binary_size/libsupersize/console.py +++ b/tools/binary_size/libsupersize/console.py
@@ -323,6 +323,15 @@ tool_prefix = self._ToolPrefixForSymbol(size_info) elf_path = self._ElfPathForSymbol(size_info, container, tool_prefix, elf_path) + # Always use Android NDK's objdump because llvm-objdump does not seem to + # correctly disassemble. + output_directory_finder = self._output_directory_finder + if not output_directory_finder.Tentative(): + output_directory_finder = path_util.OutputDirectoryFinder( + any_path_within_output_directory=elf_path) + tool_prefix = path_util.ToolPrefixFinder( + output_directory_finder=output_directory_finder, + linker_name='ld').Finalized() args = [ path_util.GetObjDumpPath(tool_prefix),
diff --git a/tools/mb/mb.py b/tools/mb/mb.py index ef16de7..4e68367 100755 --- a/tools/mb/mb.py +++ b/tools/mb/mb.py
@@ -496,7 +496,8 @@ self.Print('') if self.args.swarmed: - return self._RunUnderSwarming(self.args.path, self.args.target) + cmd, _ = self.GetIsolateCommand(self.args.target, vals) + return self._RunUnderSwarming(self.args.path, self.args.target, cmd) else: return self._RunLocallyIsolated(self.args.path, self.args.target) @@ -527,7 +528,7 @@ if zip_dir: self.RemoveDirectory(zip_dir) - def _RunUnderSwarming(self, build_dir, target): + def _RunUnderSwarming(self, build_dir, target, isolate_cmd): isolate_server = 'isolateserver.appspot.com' namespace = 'default-gzip' swarming_server = 'chromium-swarm.appspot.com' @@ -598,15 +599,21 @@ cmd = [ self.executable, self.PathJoin('tools', 'swarming_client', 'swarming.py'), - 'run', - '-s', isolated_hash, - '-I', isolate_server, - '--namespace', namespace, - '-S', swarming_server, - '--tags=purpose:user-debug-mb', - ] + tags + dimensions + 'run', + '-s', + isolated_hash, + '-I', + isolate_server, + '--namespace', + namespace, + '-S', + swarming_server, + '--tags=purpose:user-debug-mb', + '--relative-cwd', + self.ToSrcRelPath(build_dir), + ] + tags + dimensions + ['--raw-cmd', '--'] + list(isolate_cmd) if self.args.extra_args: - cmd += ['--'] + self.args.extra_args + cmd += self.args.extra_args self.Print('') ret, _, _ = self.Run(cmd, force_verbose=True, buffer_output=False) return ret
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 412582b..611dc16 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -737,6 +737,7 @@ 'android-oreo-arm64-cts-networkservice-dbg': 'android_debug_trybot_arm64', 'android-pie-arm64-coverage-rel': 'android_release_trybot_arm64_webview_google_native_coverage', 'android-pie-arm64-rel': 'android_release_trybot_arm64_webview_google_expectations', + 'android-pie-arm64-wpt-rel-non-cq': 'android_release_trybot_arm64', 'android-pie-x86-rel': 'android_release_trybot_x86_fastbuild_webview_google', 'android-weblayer-pie-x86-fyi-rel': 'android_release_trybot_x86_fastbuild_webview_google', 'android-webview-pie-arm64-fyi-rel': 'android_release_trybot_arm64_webview_google',
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 2794902..95406fe 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -9777,14 +9777,19 @@ </summary> </histogram> -<histogram name="ArcAuth.AccountCheckStatus" enum="ArcAuthAccountCheckStatus" - expires_after="M77"> - <owner>elijahtaylor@google.com</owner> +<histogram base="true" name="ArcAuth.AccountCheckStatus" + enum="ArcAuthAccountCheckStatus" expires_after="2021-08-19"> +<!-- Name completed by histogram_suffixes name="ArcUserTypes" --> + + <owner>mhasank@google.com</owner> + <owner>arc-core@google.com</owner> <summary>The status of account check before GMS Sign-in.</summary> </histogram> -<histogram name="ArcAuth.AccountCheckTime" units="ms" +<histogram base="true" name="ArcAuth.AccountCheckTime" units="ms" expires_after="2021-08-19"> +<!-- Name completed by histogram_suffixes name="ArcUserTypes" --> + <owner>mhasank@google.com</owner> <owner>arc-core@google.com</owner> <summary> @@ -9793,9 +9798,12 @@ </summary> </histogram> -<histogram name="ArcAuth.CheckinAttempts" units="attempts" - expires_after="2021-11-01"> - <owner>elijahtaylor@chromium.org</owner> +<histogram base="true" name="ArcAuth.CheckinAttempts" units="attempts" + expires_after="2021-09-15"> +<!-- Name completed by histogram_suffixes name="ArcUserTypes" --> + + <owner>mhasank@google.com</owner> + <owner>arc-core@google.com</owner> <summary> Number of attempts done while waiting for the check-in task to be completed. 0 means that device was already checked-in. This is recorded in case @@ -9803,8 +9811,12 @@ </summary> </histogram> -<histogram name="ArcAuth.CheckinTime" units="ms" expires_after="2021-11-01"> - <owner>elijahtaylor@chromium.org</owner> +<histogram base="true" name="ArcAuth.CheckinTime" units="ms" + expires_after="2021-09-15"> +<!-- Name completed by histogram_suffixes name="ArcUserTypes" --> + + <owner>mhasank@google.com</owner> + <owner>arc-core@google.com</owner> <summary> Elapsed time waiting for the check-in task to be completed. This is recorded in case check-in task is completed successfully. @@ -9813,21 +9825,29 @@ <histogram name="ArcAuth.MainAccountResolutionStatus" enum="ArcAuthMainAccountResolutionStatus" expires_after="2021-08-11"> - <owner>khmel@chromium.org</owner> - <owner>jhorwich@chromium.org</owner> + <owner>mhasank@google.com</owner> + <owner>arc-core@google.com</owner> <summary>Contains the status of main account resolution.</summary> </histogram> -<histogram name="ArcAuth.NetworkWaitTime" units="ms" expires_after="M77"> - <owner>elijahtaylor@chromium.org</owner> +<histogram base="true" name="ArcAuth.NetworkWaitTime" units="ms" + expires_after="2021-09-15"> +<!-- Name completed by histogram_suffixes name="ArcUserTypes" --> + + <owner>mhasank@google.com</owner> + <owner>arc-core@google.com</owner> <summary> Elapsed time waiting for network connection before starting other authorization operations. </summary> </histogram> -<histogram name="ArcAuth.SignInTime" units="ms" expires_after="2021-11-01"> - <owner>elijahtaylor@chromium.org</owner> +<histogram base="true" name="ArcAuth.SignInTime" units="ms" + expires_after="2021-09-15"> +<!-- Name completed by histogram_suffixes name="ArcUserTypes" --> + + <owner>mhasank@google.com</owner> + <owner>arc-core@google.com</owner> <summary>Elapsed time waiting for GMS sign-in to complete.</summary> </histogram> @@ -68729,6 +68749,82 @@ </summary> </histogram> +<histogram base="true" name="Graphics.Smoothness.PercentMissedDeadlineFrames" + units="%" expires_after="2020-12-31"> + <owner>sadrul@chromium.org</owner> + <owner>graphics-dev@chromium.org</owner> + <summary> + Tracks the percent of frames that missed the deadline for a particular + sequence of frames (e.g. during scroll, animation, etc.). This is reported + in various sub-metrics with suffixes describing the type of the sequence + (e.g. TouchScroll etc.). + + PercentMissedDeadlineFrames is measured by tracking the number of frames + which were displayed on screen but missed the vsync interval. + + Note that this metric is reported only when there are sufficient number of + frames (>= 100). If there are sequences with fewer frames, then these are + aggregated until there are enough frames to produce the metric. + </summary> +</histogram> + +<histogram name="Graphics.Smoothness.PercentMissedDeadlineFrames.AllAnimations" + units="%" expires_after="2020-12-31"> + <owner>sadrul@chromium.org</owner> + <owner>graphics-dev@chromium.org</owner> + <summary> + Tracks the percent of frames that missed the deadline for a particular + sequence of frames for all animations. This metric is reported for all + animations (e.g. comositor-driven animations, main-thread driven animations, + and raf-driven animations). + + PercentMissedDeadlineFrames is measured by tracking the number of frames + which were displayed on screen but missed the vsync interval. + + Note that this metric is reported only when there are sufficient number of + frames (>= 100). If there are sequences with fewer frames, then these are + aggregated until there are enough frames to produce the metric. + </summary> +</histogram> + +<histogram + name="Graphics.Smoothness.PercentMissedDeadlineFrames.AllInteractions" + units="%" expires_after="2020-12-31"> + <owner>sadrul@chromium.org</owner> + <owner>graphics-dev@chromium.org</owner> + <summary> + Tracks the percent of frames that missed the deadline for a particular + sequence of frames where a user-input (e.g. scroll, pinch) is active. This + metric is reported for all sources of user-input (i.e. both touchscreen and + touchpad/mouse-wheel). + + PercentMissedDeadlineFrames is measured by tracking the number of frames + which were displayed on screen but missed the vsync interval. + + Note that this metric is reported only when there are sufficient number of + frames (>= 100). If there are sequences with fewer frames, then these are + aggregated until there are enough frames to produce the metric. + </summary> +</histogram> + +<histogram name="Graphics.Smoothness.PercentMissedDeadlineFrames.AllSequences" + units="%" expires_after="2020-12-31"> + <owner>sadrul@chromium.org</owner> + <owner>graphics-dev@chromium.org</owner> + <summary> + Tracks the percent of frames that missed the deadline for a particular + sequence of frames. This metric is reported for all animations and all + interactions. + + PercentMissedDeadlineFrames is measured by tracking the number of frames + which were displayed on screen but missed the vsync interval. + + Note that this metric is reported only when there are sufficient number of + frames (>= 100). If there are sequences with fewer frames, then these are + aggregated until there are enough frames to produce the metric. + </summary> +</histogram> + <histogram name="Graphics.Smoothness.Throughput" units="%" expires_after="2020-12-31"> <obsolete> @@ -201751,7 +201847,13 @@ <affected-histogram name="Arc.UiAvailable.AlreadyProvisioned.TimeDelta"/> <affected-histogram name="Arc.UiAvailable.InSessionProvisioning.TimeDelta"/> <affected-histogram name="Arc.UiAvailable.OobeProvisioning.TimeDelta"/> + <affected-histogram name="ArcAuth.AccountCheckStatus"/> + <affected-histogram name="ArcAuth.AccountCheckTime"/> + <affected-histogram name="ArcAuth.CheckinAttempts"/> + <affected-histogram name="ArcAuth.CheckinTime"/> <affected-histogram name="ArcAuth.MainAccountResolutionStatus"/> + <affected-histogram name="ArcAuth.NetworkWaitTime"/> + <affected-histogram name="ArcAuth.SignInTime"/> </histogram_suffixes> <histogram_suffixes name="AshAssistantAnimationSmoothness" separator="."> @@ -218215,6 +218317,12 @@ deprecated. </obsolete> </affected-histogram> + <affected-histogram + name="Graphics.Smoothness.PercentMissedDeadlineFrames.CompositorThread"/> + <affected-histogram + name="Graphics.Smoothness.PercentMissedDeadlineFrames.MainThread"/> + <affected-histogram + name="Graphics.Smoothness.PercentMissedDeadlineFrames.ScrollingThread"/> <affected-histogram name="SingleThreadedCompositorLatency"/> <affected-histogram name="SingleThreadedCompositorLatency.MissedFrame"/> <affected-histogram @@ -218245,6 +218353,12 @@ deprecated. </obsolete> </affected-histogram> + <affected-histogram + name="Graphics.Smoothness.PercentMissedDeadlineFrames.CompositorThread"/> + <affected-histogram + name="Graphics.Smoothness.PercentMissedDeadlineFrames.MainThread"/> + <affected-histogram + name="Graphics.Smoothness.PercentMissedDeadlineFrames.ScrollingThread"/> </histogram_suffixes> <histogram_suffixes name="SmoothnessThreadTypes" separator="."> @@ -218261,6 +218375,7 @@ </obsolete> </suffix> <affected-histogram name="Graphics.Smoothness.PercentDroppedFrames"/> + <affected-histogram name="Graphics.Smoothness.PercentMissedDeadlineFrames"/> </histogram_suffixes> <histogram_suffixes name="SmoothnessThreadTypes.Jank" separator=".">
diff --git a/tools/traffic_annotation/auditor/BUILD.gn b/tools/traffic_annotation/auditor/BUILD.gn index a94d5c6..4d8e036 100644 --- a/tools/traffic_annotation/auditor/BUILD.gn +++ b/tools/traffic_annotation/auditor/BUILD.gn
@@ -58,6 +58,7 @@ "traffic_annotation_id_checker.h", ] data = [ + "//chrome/VERSION", "safe_list.txt", "traffic_annotation_extractor_switches.txt", ] @@ -81,6 +82,7 @@ test("traffic_annotation_auditor_unittests") { sources = [ "traffic_annotation_auditor_unittest.cc" ] data = [ + "//chrome/VERSION", "../summary/annotations.xml", "tests/annotations_diff12.txt", "tests/annotations_diff13.txt",
diff --git a/tools/traffic_annotation/auditor/auditor_result.cc b/tools/traffic_annotation/auditor/auditor_result.cc index a275a212..6d4aada 100644 --- a/tools/traffic_annotation/auditor/auditor_result.cc +++ b/tools/traffic_annotation/auditor/auditor_result.cc
@@ -24,7 +24,8 @@ type == AuditorResult::Type::ERROR_REPEATED_ID || type == AuditorResult::Type::ERROR_MERGE_FAILED || type == AuditorResult::Type::ERROR_ANNOTATIONS_XML_UPDATE || - type == AuditorResult::Type::ERROR_INVALID_OS); + type == AuditorResult::Type::ERROR_INVALID_OS || + type == AuditorResult::Type::ERROR_INVALID_ADDED_IN); DCHECK(!message.empty() || type == AuditorResult::Type::RESULT_OK || type == AuditorResult::Type::RESULT_IGNORE || type == AuditorResult::Type::ERROR_MISSING_TAG_USED || @@ -33,6 +34,7 @@ type == AuditorResult::Type::ERROR_DIRECT_ASSIGNMENT || type == AuditorResult::Type::ERROR_TEST_ANNOTATION || type == AuditorResult::Type::ERROR_INVALID_OS || + type == AuditorResult::Type::ERROR_INVALID_ADDED_IN || type == AuditorResult::Type::ERROR_MUTABLE_TAG); if (!message.empty()) details_.push_back(message); @@ -190,6 +192,11 @@ "at %s.", details_[0].c_str(), file_path_.c_str()); + case AuditorResult::Type::ERROR_INVALID_ADDED_IN: + return base::StringPrintf( + "Invalid or missing added_in_milestone '%s' in annotation '%s' at %s", + details_[0].c_str(), details_[1].c_str(), file_path_.c_str()); + case AuditorResult::Type::ERROR_MUTABLE_TAG: return base::StringPrintf( "Calling CreateMutableNetworkTrafficAnnotationTag() is not "
diff --git a/tools/traffic_annotation/auditor/auditor_result.h b/tools/traffic_annotation/auditor/auditor_result.h index 8521823f..899fccb 100644 --- a/tools/traffic_annotation/auditor/auditor_result.h +++ b/tools/traffic_annotation/auditor/auditor_result.h
@@ -52,6 +52,7 @@ ERROR_INVALID_OS, // Invalid 'os_list' in annotations.xml ERROR_DEPRECATED_WITH_OS, // Marked deprecated, but 'os_list' is not // empty in annotations.xml. + ERROR_INVALID_ADDED_IN, // "added_in_milestone" attribute is invalid. // This is the python_script equivalent of ERROR_DIRECT_ASSIGNMENT. //
diff --git a/tools/traffic_annotation/auditor/instance.cc b/tools/traffic_annotation/auditor/instance.cc index 97513aff..dd75eccf 100644 --- a/tools/traffic_annotation/auditor/instance.cc +++ b/tools/traffic_annotation/auditor/instance.cc
@@ -557,7 +557,8 @@ int content_hash_code, const std::set<int>& semantics_fields, const std::set<int>& policy_fields, - const std::string& file_path) { + const std::string& file_path, + int added_in_milestone) { AnnotationInstance annotation; annotation.is_loaded_from_archive = true; @@ -565,6 +566,7 @@ annotation.proto.set_unique_id(unique_id); annotation.proto.mutable_source()->set_file(file_path); annotation.unique_id_hash_code = unique_id_hash_code; + annotation.archive_added_in_milestone = added_in_milestone; if (annotation.NeedsTwoIDs()) { annotation.second_id_hash_code = second_id_hash_code;
diff --git a/tools/traffic_annotation/auditor/instance.h b/tools/traffic_annotation/auditor/instance.h index c07fba34..13e5c4c 100644 --- a/tools/traffic_annotation/auditor/instance.h +++ b/tools/traffic_annotation/auditor/instance.h
@@ -7,6 +7,7 @@ #include <vector> +#include "base/version.h" #include "tools/traffic_annotation/auditor/auditor_result.h" #include "tools/traffic_annotation/traffic_annotation.pb.h" @@ -73,7 +74,8 @@ int content_hash_code, const std::set<int>& semantics_fields, const std::set<int>& policy_fields, - const std::string& file_path); + const std::string& file_path, + int added_in_milestone); // Checks if an annotation has all required fields. AuditorResult IsComplete() const; @@ -135,6 +137,10 @@ // The hash code of annotation content for archived annotations. int archive_content_hash_code; + // The milestone (Chrome version) where this annotation was first added to + // Chromium code. + int archive_added_in_milestone; + // Flag stating if annotation is loaded from annotations.xml. bool is_loaded_from_archive;
diff --git a/tools/traffic_annotation/auditor/tests/annotations_diff12.txt b/tools/traffic_annotation/auditor/tests/annotations_diff12.txt index 2239195..ec386d6 100644 --- a/tools/traffic_annotation/auditor/tests/annotations_diff12.txt +++ b/tools/traffic_annotation/auditor/tests/annotations_diff12.txt
@@ -1,5 +1,5 @@ - Add line: ' <item id="A" hash_code="1" content_hash_code="10" os_list="linux,windows"/>' - Add line: ' <item id="E" hash_code="5" content_hash_code="50" os_list="linux,windows"/>' - Add line: ' <item id="Z" hash_code="9" content_hash_code="90" os_list="linux,windows"/>' - Update line: ' <item id="M" hash_code="6" content_hash_code="60" os_list="linux,windows"/>' --> ' <item id="M" hash_code="7" content_hash_code="70" os_list="linux,windows"/>' \ No newline at end of file + Add line: ' <item id="A" added_in_milestone="62" hash_code="1" content_hash_code="10" os_list="linux,windows"/>' + Add line: ' <item id="E" added_in_milestone="62" hash_code="5" content_hash_code="50" os_list="linux,windows"/>' + Add line: ' <item id="Z" added_in_milestone="62" hash_code="9" content_hash_code="90" os_list="linux,windows"/>' + Update line: ' <item id="M" added_in_milestone="62" hash_code="6" content_hash_code="60" os_list="linux,windows"/>' --> ' <item id="M" added_in_milestone="62" hash_code="7" content_hash_code="70" os_list="linux,windows"/>' \ No newline at end of file
diff --git a/tools/traffic_annotation/auditor/tests/annotations_diff13.txt b/tools/traffic_annotation/auditor/tests/annotations_diff13.txt index 7a4b7c8e..5edb985 100644 --- a/tools/traffic_annotation/auditor/tests/annotations_diff13.txt +++ b/tools/traffic_annotation/auditor/tests/annotations_diff13.txt
@@ -1,5 +1,5 @@ - Add line: ' <item id="G" hash_code="4" content_hash_code="40" os_list="linux,windows"/>' - Remove line: ' <item id="C" hash_code="3" content_hash_code="30" os_list="linux,windows"/>' - Remove line: ' <item id="M" hash_code="6" content_hash_code="60" os_list="linux,windows"/>' - Remove line: ' <item id="X" hash_code="8" content_hash_code="80" os_list="linux,windows"/>' \ No newline at end of file + Add line: ' <item id="G" added_in_milestone="62" hash_code="4" content_hash_code="40" os_list="linux,windows"/>' + Remove line: ' <item id="C" added_in_milestone="62" hash_code="3" content_hash_code="30" os_list="linux,windows"/>' + Remove line: ' <item id="M" added_in_milestone="62" hash_code="6" content_hash_code="60" os_list="linux,windows"/>' + Remove line: ' <item id="X" added_in_milestone="62" hash_code="8" content_hash_code="80" os_list="linux,windows"/>' \ No newline at end of file
diff --git a/tools/traffic_annotation/auditor/tests/annotations_diff23.txt b/tools/traffic_annotation/auditor/tests/annotations_diff23.txt index 978b221..84ec48c5 100644 --- a/tools/traffic_annotation/auditor/tests/annotations_diff23.txt +++ b/tools/traffic_annotation/auditor/tests/annotations_diff23.txt
@@ -1,8 +1,8 @@ - Add line: ' <item id="G" hash_code="4" content_hash_code="40" os_list="linux,windows"/>' - Remove line: ' <item id="A" hash_code="1" content_hash_code="10" os_list="linux,windows"/>' - Remove line: ' <item id="C" hash_code="3" content_hash_code="30" os_list="linux,windows"/>' - Remove line: ' <item id="E" hash_code="5" content_hash_code="50" os_list="linux,windows"/>' - Remove line: ' <item id="M" hash_code="7" content_hash_code="70" os_list="linux,windows"/>' - Remove line: ' <item id="X" hash_code="8" content_hash_code="80" os_list="linux,windows"/>' - Remove line: ' <item id="Z" hash_code="9" content_hash_code="90" os_list="linux,windows"/>' \ No newline at end of file + Add line: ' <item id="G" added_in_milestone="62" hash_code="4" content_hash_code="40" os_list="linux,windows"/>' + Remove line: ' <item id="A" added_in_milestone="62" hash_code="1" content_hash_code="10" os_list="linux,windows"/>' + Remove line: ' <item id="C" added_in_milestone="62" hash_code="3" content_hash_code="30" os_list="linux,windows"/>' + Remove line: ' <item id="E" added_in_milestone="62" hash_code="5" content_hash_code="50" os_list="linux,windows"/>' + Remove line: ' <item id="M" added_in_milestone="62" hash_code="7" content_hash_code="70" os_list="linux,windows"/>' + Remove line: ' <item id="X" added_in_milestone="62" hash_code="8" content_hash_code="80" os_list="linux,windows"/>' + Remove line: ' <item id="Z" added_in_milestone="62" hash_code="9" content_hash_code="90" os_list="linux,windows"/>' \ No newline at end of file
diff --git a/tools/traffic_annotation/auditor/tests/annotations_sample1.xml b/tools/traffic_annotation/auditor/tests/annotations_sample1.xml index 57bdef0..5ca46a1 100644 --- a/tools/traffic_annotation/auditor/tests/annotations_sample1.xml +++ b/tools/traffic_annotation/auditor/tests/annotations_sample1.xml
@@ -8,7 +8,7 @@ --> <annotations> - <item id="C" hash_code="3" content_hash_code="30" os_list="linux,windows"/> - <item id="M" hash_code="6" content_hash_code="60" os_list="linux,windows"/> - <item id="X" hash_code="8" content_hash_code="80" os_list="linux,windows"/> + <item id="C" added_in_milestone="62" hash_code="3" content_hash_code="30" os_list="linux,windows"/> + <item id="M" added_in_milestone="62" hash_code="6" content_hash_code="60" os_list="linux,windows"/> + <item id="X" added_in_milestone="62" hash_code="8" content_hash_code="80" os_list="linux,windows"/> </annotations>
diff --git a/tools/traffic_annotation/auditor/tests/annotations_sample2.xml b/tools/traffic_annotation/auditor/tests/annotations_sample2.xml index 7e0ed0e..be5a1e6 100644 --- a/tools/traffic_annotation/auditor/tests/annotations_sample2.xml +++ b/tools/traffic_annotation/auditor/tests/annotations_sample2.xml
@@ -8,10 +8,10 @@ --> <annotations> - <item id="A" hash_code="1" content_hash_code="10" os_list="linux,windows"/> - <item id="C" hash_code="3" content_hash_code="30" os_list="linux,windows"/> - <item id="E" hash_code="5" content_hash_code="50" os_list="linux,windows"/> - <item id="M" hash_code="7" content_hash_code="70" os_list="linux,windows"/> - <item id="X" hash_code="8" content_hash_code="80" os_list="linux,windows"/> - <item id="Z" hash_code="9" content_hash_code="90" os_list="linux,windows"/> + <item id="A" added_in_milestone="62" hash_code="1" content_hash_code="10" os_list="linux,windows"/> + <item id="C" added_in_milestone="62" hash_code="3" content_hash_code="30" os_list="linux,windows"/> + <item id="E" added_in_milestone="62" hash_code="5" content_hash_code="50" os_list="linux,windows"/> + <item id="M" added_in_milestone="62" hash_code="7" content_hash_code="70" os_list="linux,windows"/> + <item id="X" added_in_milestone="62" hash_code="8" content_hash_code="80" os_list="linux,windows"/> + <item id="Z" added_in_milestone="62" hash_code="9" content_hash_code="90" os_list="linux,windows"/> </annotations>
diff --git a/tools/traffic_annotation/auditor/tests/annotations_sample3.xml b/tools/traffic_annotation/auditor/tests/annotations_sample3.xml index eff397b..5bf36c9 100644 --- a/tools/traffic_annotation/auditor/tests/annotations_sample3.xml +++ b/tools/traffic_annotation/auditor/tests/annotations_sample3.xml
@@ -8,5 +8,5 @@ --> <annotations> - <item id="G" hash_code="4" content_hash_code="40" os_list="linux,windows"/> + <item id="G" added_in_milestone="62" hash_code="4" content_hash_code="40" os_list="linux,windows"/> </annotations>
diff --git a/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc b/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc index f41f004..4d33c2a 100644 --- a/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc +++ b/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc
@@ -727,7 +727,7 @@ item.second.type, item.first, item.second.unique_id_hash_code, item.second.second_id_hash_code, item.second.content_hash_code, item.second.semantics_fields, item.second.policy_fields, - item.second.file_path)); + item.second.file_path, item.second.added_in_milestone)); } } }
diff --git a/tools/traffic_annotation/auditor/traffic_annotation_exporter.cc b/tools/traffic_annotation/auditor/traffic_annotation_exporter.cc index 324e85fb..be7fa1b 100644 --- a/tools/traffic_annotation/auditor/traffic_annotation_exporter.cc +++ b/tools/traffic_annotation/auditor/traffic_annotation_exporter.cc
@@ -40,6 +40,10 @@ .Append(FILE_PATH_LITERAL("summary")) .Append(FILE_PATH_LITERAL("grouping.xml")); +const base::FilePath kChromeVersionPath = + base::FilePath(FILE_PATH_LITERAL("chrome")) + .Append(FILE_PATH_LITERAL("VERSION")); + // Extracts annotation id from a line of XML. Expects to have the line in the // following format: <... id="..." .../> // TODO(rhalavati): Use real XML parsing. @@ -68,6 +72,23 @@ } } +// Parses the contents of the chrome/VERSION file, which contains the current +// chrome version. Returns the number on the MAJOR=... line, i.e. the milestone +// number. +// +// If parsing fails, returns -1. +int GetMajorVersion(const std::string& version_file_contents) { + static const char prefix[] = "MAJOR="; + size_t pos = version_file_contents.find(prefix); + if (pos == std::string::npos) + return -1; + int version = 0; + base::StringToInt( + base::StringPiece(version_file_contents.c_str() + pos + strlen(prefix)), + &version); + return version > 0 ? version : -1; +} + } // namespace TrafficAnnotationExporter::ArchivedAnnotation::ArchivedAnnotation() @@ -99,6 +120,21 @@ TrafficAnnotationExporter::~TrafficAnnotationExporter() = default; bool TrafficAnnotationExporter::LoadAnnotationsXML() { + std::string version_file_contents; + base::FilePath version_file_path = + base::MakeAbsoluteFilePath(source_path_.Append(kChromeVersionPath)); + if (!base::ReadFileToString(version_file_path, &version_file_contents)) { + LOG(ERROR) << "Could not load '" << source_path_.Append(kChromeVersionPath) + << "'."; + return false; + } + current_milestone_ = GetMajorVersion(version_file_contents); + if (current_milestone_ <= 0) { + LOG(ERROR) << "Failed to parse '" << source_path_.Append(kChromeVersionPath) + << "'."; + return false; + } + archive_.clear(); XmlReader reader; if (!reader.LoadFile( @@ -162,6 +198,13 @@ all_ok &= reader.NodeAttribute("file_path", &item.file_path); + std::string added_in_str; + if (reader.NodeAttribute("added_in_milestone", &added_in_str)) { + base::StringToInt(added_in_str, &item.added_in_milestone); + } else { + item.added_in_milestone = -1; + } + if (!all_ok) { LOG(ERROR) << "Unexpected format in annotations.xml."; break; @@ -231,6 +274,7 @@ new_item.second_id_hash_code = annotation.second_id_hash_code; new_item.content_hash_code = content_hash_code; new_item.os_list = all_supported_platforms_; + new_item.added_in_milestone = current_milestone_; if (annotation.type != AnnotationInstance::Type::ANNOTATION_COMPLETE) { annotation.GetSemanticsFieldNumbers(&new_item.semantics_fields); annotation.GetPolicyFieldNumbers(&new_item.policy_fields); @@ -291,6 +335,9 @@ for (const auto& item : archive_) { writer.StartElement("item"); writer.AddAttribute("id", item.first); + writer.AddAttribute("added_in_milestone", + base::NumberToString(item.second.added_in_milestone)); + writer.AddAttribute( "hash_code", base::StringPrintf("%i", item.second.unique_id_hash_code)); writer.AddAttribute("type", base::StringPrintf("%i", item.second.type)); @@ -405,6 +452,18 @@ } } } + + // Check for consistency of "added_in_milestone" attribute. + for (const auto& pair : archive_) { + if (pair.second.added_in_milestone < 62) { + AuditorResult error(AuditorResult::Type::ERROR_INVALID_ADDED_IN, + std::string(), kAnnotationsXmlPath.MaybeAsASCII(), + AuditorResult::kNoCodeLineSpecified); + error.AddDetail(base::NumberToString(pair.second.added_in_milestone)); + error.AddDetail(pair.first); + errors->push_back(std::move(error)); + } + } } unsigned TrafficAnnotationExporter::GetXMLItemsCountForTesting() {
diff --git a/tools/traffic_annotation/auditor/traffic_annotation_exporter.h b/tools/traffic_annotation/auditor/traffic_annotation_exporter.h index 62786fe..339cd14 100644 --- a/tools/traffic_annotation/auditor/traffic_annotation_exporter.h +++ b/tools/traffic_annotation/auditor/traffic_annotation_exporter.h
@@ -32,6 +32,8 @@ std::set<int> semantics_fields; std::set<int> policy_fields; std::string file_path; + + int added_in_milestone = 0; }; TrafficAnnotationExporter(const base::FilePath& source_path); @@ -39,7 +41,8 @@ TrafficAnnotationExporter(const TrafficAnnotationExporter&) = delete; TrafficAnnotationExporter(TrafficAnnotationExporter&&) = delete; - // Loads annotations from annotations.xml file into |archive_|. + // Loads annotations from annotations.xml file into |archive_|, and populates + // |current_milestone_|. bool LoadAnnotationsXML(); // Updates |archive_| with current set of extracted annotations and reserved @@ -98,6 +101,7 @@ std::map<std::string, ArchivedAnnotation> archive_; const base::FilePath source_path_; std::string current_platform_; + int current_milestone_; bool modified_; };
diff --git a/tools/traffic_annotation/bin/README.md b/tools/traffic_annotation/bin/README.md index 70f49ba..11912b9 100644 --- a/tools/traffic_annotation/bin/README.md +++ b/tools/traffic_annotation/bin/README.md
@@ -59,4 +59,4 @@ The following line will be updated by the above script, and the modified README should be committed along with the updated .sha1 checksums. -LASTCHANGE=e3aec06168fddef3f2a085fb1f6282b2b9920480-refs/heads/master@{#799083} +LASTCHANGE=867d00314f887c1ea046d068ef7d9029a3f44fbf-refs/heads/master@{#807115}
diff --git a/tools/traffic_annotation/bin/linux64/traffic_annotation_auditor.sha1 b/tools/traffic_annotation/bin/linux64/traffic_annotation_auditor.sha1 index 33b0768..9b396a5 100644 --- a/tools/traffic_annotation/bin/linux64/traffic_annotation_auditor.sha1 +++ b/tools/traffic_annotation/bin/linux64/traffic_annotation_auditor.sha1
@@ -1 +1 @@ -a44815de25a30e5d6f3d69a3af2dd7edf4eb892f \ No newline at end of file +92b1ddf7d9e20a91e3147c442a602a12976bf9f1 \ No newline at end of file
diff --git a/tools/traffic_annotation/bin/win32/traffic_annotation_auditor.exe.sha1 b/tools/traffic_annotation/bin/win32/traffic_annotation_auditor.exe.sha1 index fed088db..fd1a49d 100644 --- a/tools/traffic_annotation/bin/win32/traffic_annotation_auditor.exe.sha1 +++ b/tools/traffic_annotation/bin/win32/traffic_annotation_auditor.exe.sha1
@@ -1 +1 @@ -25d618085c40322fa9ef47bae8631b9fe43bfa65 \ No newline at end of file +78398902112510645b07a808000221ecaf69a409 \ No newline at end of file
diff --git a/tools/traffic_annotation/summary/annotations.xml b/tools/traffic_annotation/summary/annotations.xml index 1e1301d4..a06af23 100644 --- a/tools/traffic_annotation/summary/annotations.xml +++ b/tools/traffic_annotation/summary/annotations.xml
@@ -8,355 +8,355 @@ --> <annotations> - <item id="CRD_relay_session_request" hash_code="24058523" type="0" deprecated="2019-07-22" content_hash_code="36997811" file_path=""/> - <item id="accounts_image_fetcher" hash_code="98658519" type="0" content_hash_code="45432230" os_list="linux,windows" file_path="components/signin/internal/identity_manager/account_fetcher_service.cc"/> - <item id="adb_client_socket" hash_code="87775794" type="0" content_hash_code="56654828" os_list="linux,windows" file_path="chrome/browser/devtools/device/adb/adb_client_socket.cc"/> - <item id="affiliation_lookup" hash_code="111904019" type="0" content_hash_code="81061452" os_list="linux,windows" file_path="components/password_manager/core/browser/android_affiliation/affiliation_fetcher.cc"/> - <item id="android_device_manager_socket" hash_code="37249086" type="0" content_hash_code="6436865" os_list="linux,windows" file_path="chrome/browser/devtools/device/android_device_manager.cc"/> - <item id="android_web_socket" hash_code="39356976" type="0" content_hash_code="12310113" os_list="linux,windows" file_path="chrome/browser/devtools/device/android_web_socket.cc"/> - <item id="appcache_update_job" hash_code="25790702" type="0" content_hash_code="27424887" os_list="linux,windows" file_path="content/browser/appcache/appcache_update_url_loader_request.cc"/> - <item id="autofill_query" hash_code="88863520" type="0" content_hash_code="15563339" os_list="linux,windows" file_path="components/autofill/core/browser/autofill_download_manager.cc"/> - <item id="autofill_upload" hash_code="104798869" type="0" content_hash_code="110634763" os_list="linux,windows" file_path="components/autofill/core/browser/autofill_download_manager.cc"/> - <item id="backdrop_collection_images_download" hash_code="34767164" type="0" content_hash_code="62971406" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc"/> - <item id="backdrop_collection_names_download" hash_code="49246286" type="0" content_hash_code="93501319" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc"/> - <item id="backdrop_next_image_download" hash_code="7754485" type="0" content_hash_code="98537970" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc"/> - <item id="background_fetch_context" hash_code="16469669" type="0" content_hash_code="52235434" os_list="linux,windows" file_path="content/browser/background_fetch/background_fetch_delegate_proxy.cc"/> - <item id="background_performance_tracer" hash_code="84575287" type="0" content_hash_code="120154250" os_list="linux,windows" file_path="chrome/browser/tracing/crash_service_uploader.cc"/> - <item id="bidirectional_stream" hash_code="108665132" type="0" content_hash_code="130038340" os_list="linux,windows" file_path="net/http/bidirectional_stream.cc"/> - <item id="blink_extension_resource_loader" hash_code="84165821" type="0" content_hash_code="63536185" os_list="linux,windows" file_path="content/renderer/loader/web_url_loader_impl.cc"/> - <item id="blink_resource_loader" hash_code="101845102" type="0" content_hash_code="75331172" os_list="linux,windows" file_path="content/renderer/loader/web_url_loader_impl.cc"/> - <item id="blob_read" hash_code="112303907" type="0" deprecated="2019-08-09" content_hash_code="135449692" file_path=""/> - <item id="blob_reader" hash_code="5154306" type="0" deprecated="2018-06-14" content_hash_code="39702178" file_path=""/> - <item id="bluetooth_socket" hash_code="94099818" type="0" content_hash_code="30932349" os_list="linux,windows" file_path="device/bluetooth/bluetooth_socket_net.cc"/> - <item id="brandcode_config" hash_code="109679553" type="0" content_hash_code="128843792" os_list="linux,windows" file_path="chrome/browser/profile_resetter/brandcode_config_fetcher.cc"/> - <item id="browser_switcher_ieem_sitelist" hash_code="97159948" type="0" content_hash_code="129062966" os_list="linux,windows" file_path="chrome/browser/browser_switcher/browser_switcher_service.cc"/> - <item id="cablev2_websocket_from_client" hash_code="3464399" type="0" content_hash_code="46324469" os_list="windows,linux" file_path="device/fido/cable/fido_tunnel_device.cc"/> - <item id="captive_portal_service" hash_code="88754904" type="0" content_hash_code="70737580" os_list="linux,windows" file_path="components/captive_portal/content/captive_portal_service.cc"/> - <item id="cast_channel_send" hash_code="103172229" type="0" deprecated="2018-08-23" content_hash_code="33946302" file_path=""/> - <item id="cast_keep_alive_delegate" hash_code="134755844" type="0" deprecated="2018-08-23" content_hash_code="66118796" file_path=""/> - <item id="cast_message_handler" hash_code="87558948" type="0" deprecated="2018-08-23" content_hash_code="49684899" file_path=""/> - <item id="cast_socket" hash_code="115192205" type="0" content_hash_code="42881651" os_list="linux,windows" file_path="components/cast_channel/cast_socket.cc"/> - <item id="cast_udp_socket" hash_code="22573197" type="0" content_hash_code="75328301" os_list="linux,windows" file_path="components/mirroring/service/udp_socket_client.cc"/> - <item id="cast_udp_transport" hash_code="5576536" type="0" content_hash_code="107643273" os_list="linux,windows" file_path="media/cast/net/udp_transport_impl.cc"/> - <item id="certificate_verifier_url_loader" hash_code="80134684" type="0" content_hash_code="92630208" os_list="linux,windows" file_path="services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader.cc"/> - <item id="certificate_verifier_url_request" hash_code="85988208" type="0" content_hash_code="59262468" os_list="linux,windows" file_path="net/cert_net/cert_net_fetcher_url_request.cc"/> - <item id="chrome_HaTS_service" hash_code="136028241" type="0" content_hash_code="68990360" os_list="linux,windows" file_path="chrome/browser/ui/hats/hats_survey_status_checker.cc"/> - <item id="chrome_apps_socket_api" hash_code="8591273" type="0" content_hash_code="130709397" os_list="linux,windows" file_path="extensions/browser/api/socket/socket.cc"/> - <item id="chrome_cleaner" hash_code="27071967" type="0" content_hash_code="111240292" os_list="windows" file_path="chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc"/> - <item id="chrome_cleanup_report" hash_code="71102679" type="0" content_hash_code="130565656" os_list="windows" file_path="chrome/chrome_cleaner/logging/cleaner_logging_service.cc"/> - <item id="chrome_feedback_report_app" hash_code="134729048" type="0" content_hash_code="73916972" os_list="linux,windows" file_path="components/feedback/feedback_uploader.cc"/> - <item id="chrome_variations_service" hash_code="115188287" type="0" content_hash_code="32485683" os_list="linux,windows" file_path="components/variations/service/variations_service.cc"/> - <item id="client_download_request" hash_code="125522256" type="0" content_hash_code="23897505" os_list="linux,windows" file_path="chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc"/> - <item id="cloud_print" hash_code="111712433" type="2" content_hash_code="60926140" os_list="linux,windows" semantics_fields="1,5" policy_fields="-1,3,4" file_path="chrome/service/cloud_print/cloud_print_url_fetcher.cc"/> - <item id="cloud_print_backend" hash_code="71578042" type="1" second_id="111712433" content_hash_code="85425333" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/cloud_print_proxy_backend.cc"/> - <item id="cloud_print_credential_update" hash_code="137420486" type="0" content_hash_code="1179808" os_list="linux,windows" file_path="chrome/service/cloud_print/cloud_print_proxy_backend.cc"/> - <item id="cloud_print_privet_register" hash_code="24978481" type="0" content_hash_code="131359002" os_list="linux,windows" file_path="chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc"/> - <item id="cloud_print_proxy" hash_code="50859288" type="1" second_id="111712433" content_hash_code="90868083" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/cloud_print_proxy.cc"/> - <item id="cloud_print_search" hash_code="132055347" type="0" content_hash_code="123783474" os_list="linux,windows" file_path="chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc"/> - <item id="cloud_speech_recognition" hash_code="15750036" type="0" deprecated="2020-05-27" content_hash_code="114921835" file_path="chrome/services/speech/cloud_speech_recognition_client.cc"/> - <item id="content_hash_verification_job" hash_code="64733114" type="0" content_hash_code="127912411" os_list="linux,windows" file_path="extensions/browser/content_hash_fetcher.cc"/> - <item id="content_resource_fetcher" hash_code="70796791" type="0" deprecated="2017-09-16" content_hash_code="135648626" file_path=""/> - <item id="content_suggestion_get_favicon" hash_code="16653985" type="0" content_hash_code="134280933" os_list="linux,windows" file_path="components/ntp_snippets/content_suggestions_service.cc"/> - <item id="conversion_measurement_report" hash_code="113422320" type="0" content_hash_code="60688877" os_list="linux,windows" file_path="content/browser/conversions/conversion_network_sender_impl.cc"/> - <item id="credenential_avatar" hash_code="53695122" type="0" content_hash_code="113035371" os_list="linux,windows" file_path="chrome/browser/ui/passwords/account_avatar_fetcher.cc"/> - <item id="cros_recovery_image_download" hash_code="101725581" type="0" content_hash_code="10999698" os_list="linux,windows" file_path="chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc"/> - <item id="cryptauth_device_sync_tickle" hash_code="96565489" type="1" second_id="29188932" deprecated="2018-03-15" content_hash_code="115714668" file_path=""/> - <item id="cryptauth_enrollment_flow_finish" hash_code="54836939" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="17060642" file_path=""/> - <item id="cryptauth_enrollment_flow_setup" hash_code="84889397" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="128348931" file_path=""/> - <item id="cryptauth_find_eligible_for_promotion" hash_code="20053290" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="93687383" file_path=""/> - <item id="cryptauth_find_eligible_unlock_devices" hash_code="120000562" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="46773475" file_path=""/> - <item id="cryptauth_get_my_devices" hash_code="136498680" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="73842435" file_path=""/> - <item id="cryptauth_toggle_easyunlock" hash_code="25204343" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="13570943" file_path=""/> - <item id="data_reduction_proxy_config" hash_code="485305" type="0" content_hash_code="134075813" os_list="linux,windows" file_path="components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc"/> - <item id="data_reduction_proxy_pingback" hash_code="68561428" type="0" deprecated="2019-09-17" content_hash_code="78407792" file_path=""/> - <item id="data_reduction_proxy_secure_proxy_check" hash_code="131236802" type="0" deprecated="2020-03-13" content_hash_code="122297136" file_path=""/> - <item id="data_reduction_proxy_warmup" hash_code="8250451" type="0" deprecated="2020-03-13" content_hash_code="6321249" file_path=""/> - <item id="desktop_ios_promotion" hash_code="13694792" type="0" deprecated="2018-11-04" content_hash_code="19776951" file_path=""/> - <item id="device_geolocation_request" hash_code="77673751" type="0" deprecated="2017-10-20" content_hash_code="97181773" file_path=""/> - <item id="device_management_service" hash_code="117782019" type="0" content_hash_code="104419970" os_list="linux,windows" file_path="components/policy/core/common/cloud/device_management_service.cc"/> - <item id="devtools_free_data_source" hash_code="22774132" type="0" content_hash_code="35733000" os_list="linux,windows" file_path="chrome/browser/ui/webui/devtools_ui_data_source.cc"/> - <item id="devtools_handle_front_end_messages" hash_code="135636011" type="0" content_hash_code="76808593" os_list="linux,windows" file_path="content/shell/browser/shell_devtools_bindings.cc"/> - <item id="devtools_hard_coded_data_source" hash_code="111565057" type="0" content_hash_code="75183720" os_list="linux,windows" file_path="chrome/browser/ui/webui/devtools_ui_data_source.cc"/> - <item id="devtools_http_handler" hash_code="49160454" type="0" content_hash_code="88414393" os_list="linux,windows" file_path="content/browser/devtools/devtools_http_handler.cc"/> - <item id="devtools_interceptor" hash_code="98123737" type="0" deprecated="2019-07-31" content_hash_code="64591843" file_path=""/> - <item id="devtools_network_resource" hash_code="129652775" type="0" content_hash_code="32810159" os_list="linux,windows" file_path="chrome/browser/devtools/devtools_ui_bindings.cc"/> - <item id="devtools_proxy_config" hash_code="79904729" type="0" content_hash_code="31996982" os_list="linux,windows" file_path="content/browser/devtools/protocol/target_handler.cc"/> - <item id="dial_get_app_info" hash_code="15952025" type="0" deprecated="2018-02-27" content_hash_code="90542080" file_path=""/> - <item id="dial_get_device_description" hash_code="50422598" type="0" deprecated="2018-02-27" content_hash_code="129827780" file_path=""/> - <item id="dial_url_fetcher" hash_code="41424546" type="0" content_hash_code="129828432" os_list="linux,windows" file_path="chrome/browser/media/router/discovery/dial/dial_url_fetcher.cc"/> - <item id="dns_over_https" hash_code="79895226" type="0" content_hash_code="45123510" os_list="linux,windows" file_path="net/dns/dns_transaction.cc"/> - <item id="dns_transaction" hash_code="79227717" type="0" content_hash_code="132206495" os_list="linux,windows" file_path="net/dns/dns_transaction.cc"/> - <item id="dom_distiller" hash_code="3989826" type="0" content_hash_code="106153970" os_list="linux,windows" file_path="components/dom_distiller/core/distiller_url_fetcher.cc"/> - <item id="domain_reliability_report_upload" hash_code="108804096" type="0" content_hash_code="35902036" os_list="linux,windows" file_path="components/domain_reliability/uploader.cc"/> - <item id="domain_security_policy" hash_code="77597059" type="0" content_hash_code="30916983" os_list="linux,windows" file_path="services/network/network_context.cc"/> - <item id="doodle_fetcher" hash_code="97199008" type="0" deprecated="2017-08-28" content_hash_code="87981692" file_path=""/> - <item id="doodle_service" hash_code="41154842" type="0" deprecated="2017-08-28" content_hash_code="28273962" file_path=""/> - <item id="download_internals_webui_source" hash_code="38670228" type="0" content_hash_code="129391056" os_list="linux,windows" file_path="chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc"/> - <item id="download_manager_resume" hash_code="35380758" type="0" content_hash_code="41227674" os_list="linux,windows" file_path="components/download/internal/common/download_item_impl.cc"/> - <item id="download_recovery_component" hash_code="131711536" type="0" content_hash_code="3243311" os_list="windows" file_path="chrome/chrome_cleaner/components/recovery_component.cc"/> - <item id="download_web_contents_frame" hash_code="56351037" type="0" content_hash_code="3657889" os_list="linux,windows" file_path="content/browser/web_contents/web_contents_impl.cc"/> - <item id="downloads_api_run_async" hash_code="121068967" type="0" content_hash_code="9280914" os_list="linux,windows" file_path="chrome/browser/extensions/api/downloads/downloads_api.cc"/> - <item id="downloads_dom_handler" hash_code="95951029" type="0" content_hash_code="137150731" os_list="linux,windows" file_path="chrome/browser/ui/webui/downloads/downloads_dom_handler.cc"/> - <item id="drag_download_file" hash_code="95910019" type="0" content_hash_code="126492858" os_list="linux,windows" file_path="content/browser/download/drag_download_file.cc"/> - <item id="enterprise_safe_browsing_realtime_url_lookup" hash_code="22262963" type="0" content_hash_code="14052810" os_list="linux,windows" file_path="chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.cc"/> - <item id="expect_ct_reporter" hash_code="57276415" type="0" deprecated="2018-06-20" content_hash_code="130492494" file_path="services/network/expect_ct_reporter.cc"/> - <item id="extension_blacklist" hash_code="59592717" type="0" content_hash_code="116742516" os_list="linux,windows" file_path="chrome/browser/extensions/blocklist_state_fetcher.cc"/> - <item id="extension_crx_fetcher" hash_code="21145003" type="0" content_hash_code="79150319" os_list="linux,windows" file_path="extensions/browser/updater/extension_downloader.cc"/> - <item id="extension_install_signer" hash_code="50464499" type="0" content_hash_code="106712014" os_list="linux,windows" file_path="chrome/browser/extensions/install_signer.cc"/> - <item id="extension_manifest_fetcher" hash_code="5151071" type="0" content_hash_code="93862569" os_list="linux,windows" file_path="extensions/browser/updater/extension_downloader.cc"/> - <item id="external_policy_fetcher" hash_code="9459438" type="0" content_hash_code="64260484" os_list="linux,windows" file_path="components/policy/core/common/cloud/external_policy_data_fetcher.cc"/> - <item id="family_info" hash_code="30913825" type="0" deprecated="2019-07-30" content_hash_code="25369370" file_path=""/> - <item id="favicon_loader" hash_code="112189210" type="0" content_hash_code="70773116" os_list="linux,windows" file_path="content/renderer/loader/web_url_loader_impl.cc"/> - <item id="feed_image_fetcher" hash_code="87439531" type="0" deprecated="2019-01-04" content_hash_code="26756208" file_path=""/> - <item id="floc_id_provider_impl" hash_code="103052331" type="1" second_id="13704791" content_hash_code="41421380" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="3" file_path="chrome/browser/federated_learning/floc_id_provider_impl.cc"/> - <item id="floc_remote_permission_service" hash_code="13704791" type="2" content_hash_code="86293622" os_list="linux,windows" semantics_fields="1,5" policy_fields="1,2,4" file_path="chrome/browser/federated_learning/floc_remote_permission_service.cc"/> - <item id="ftl_messaging_client_ack_messages" hash_code="55663676" type="0" content_hash_code="20913627" os_list="linux,windows" file_path="remoting/signaling/ftl_messaging_client.cc"/> - <item id="ftl_messaging_client_receive_messages" hash_code="136248372" type="0" content_hash_code="36609143" os_list="linux,windows" file_path="remoting/signaling/ftl_messaging_client.cc"/> - <item id="ftl_messaging_client_send_messages" hash_code="48924790" type="0" content_hash_code="6841587" os_list="linux,windows" file_path="remoting/signaling/ftl_messaging_client.cc"/> - <item id="ftl_registration_manager" hash_code="38256901" type="0" content_hash_code="12581281" os_list="linux,windows" file_path="remoting/signaling/ftl_registration_manager.cc"/> - <item id="gaia_auth_check_connection_info" hash_code="4598626" type="0" content_hash_code="57347000" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_auth_exchange_cookies" hash_code="134289752" type="0" deprecated="2018-09-11" content_hash_code="66433230" file_path=""/> - <item id="gaia_auth_exchange_device_id" hash_code="39877119" type="0" content_hash_code="61857947" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_auth_fetch_for_uber" hash_code="97978464" type="0" content_hash_code="28006265" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_auth_get_user_info" hash_code="82167736" type="0" content_hash_code="4695017" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_auth_list_accounts" hash_code="35565745" type="0" content_hash_code="93669150" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_auth_log_out" hash_code="116426676" type="0" content_hash_code="91154233" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_auth_login" hash_code="91597383" type="0" content_hash_code="111911548" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_auth_merge_sessions" hash_code="26216847" type="0" content_hash_code="30423843" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_auth_multilogin" hash_code="31445884" type="0" content_hash_code="77730858" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_auth_revoke_token" hash_code="133982351" type="0" content_hash_code="96665330" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_cookie_manager_external_cc_result" hash_code="4300475" type="0" content_hash_code="31188375" os_list="linux,windows" file_path="components/signin/internal/identity_manager/gaia_cookie_manager_service.cc"/> - <item id="gaia_create_reauth_proof_token_for_parent" hash_code="67750043" type="0" content_hash_code="103500636" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> - <item id="gaia_oauth_client_get_token_info" hash_code="32585152" type="0" content_hash_code="128143346" os_list="linux,windows" file_path="google_apis/gaia/gaia_oauth_client.cc"/> - <item id="gaia_oauth_client_get_tokens" hash_code="5637379" type="0" content_hash_code="12099176" os_list="linux,windows" file_path="google_apis/gaia/gaia_oauth_client.cc"/> - <item id="gaia_oauth_client_get_user_info" hash_code="83476155" type="0" content_hash_code="35159007" os_list="linux,windows" file_path="google_apis/gaia/gaia_oauth_client.cc"/> - <item id="gaia_oauth_client_refresh_token" hash_code="82462683" type="0" content_hash_code="22305252" os_list="linux,windows" file_path="google_apis/gaia/gaia_oauth_client.cc"/> - <item id="gcd_rest_client" hash_code="105985951" type="0" deprecated="2018-10-17" content_hash_code="70710803" file_path="remoting/host/gcd_rest_client.cc"/> - <item id="gcm_channel_status_request" hash_code="18300705" type="0" deprecated="2020-01-24" content_hash_code="53862393" file_path=""/> - <item id="gcm_checkin" hash_code="65957842" type="0" content_hash_code="98259579" os_list="linux,windows" file_path="google_apis/gcm/engine/checkin_request.cc"/> - <item id="gcm_connection_factory" hash_code="29057242" type="0" content_hash_code="75279835" os_list="linux,windows" file_path="google_apis/gcm/engine/connection_factory_impl.cc"/> - <item id="gcm_registration" hash_code="61656965" type="0" content_hash_code="113670632" os_list="linux,windows" file_path="google_apis/gcm/engine/registration_request.cc"/> - <item id="gcm_subscription" hash_code="56434025" type="0" deprecated="2019-04-10" content_hash_code="61632174" file_path=""/> - <item id="gcm_unregistration" hash_code="119542033" type="0" content_hash_code="30144127" os_list="linux,windows" file_path="google_apis/gcm/engine/unregistration_request.cc"/> - <item id="geo_language_provider" hash_code="52821843" type="1" second_id="96590038" content_hash_code="65327456" os_list="linux,windows" semantics_fields="1" policy_fields="3,4" file_path="components/language/content/browser/geo_language_provider.cc"/> - <item id="google_url_tracker" hash_code="5492492" type="0" deprecated="2019-08-01" content_hash_code="54474899" file_path=""/> - <item id="gstatic_change_password_override_urls" hash_code="135799714" type="0" content_hash_code="133151871" os_list="linux,windows" file_path="components/password_manager/core/browser/change_password_url_service_impl.cc"/> - <item id="headless_url_request" hash_code="29865866" type="0" deprecated="2018-07-10" content_hash_code="76700151" file_path=""/> - <item id="heartbeat_sender" hash_code="4883150" type="0" content_hash_code="131927805" os_list="linux,windows" file_path="remoting/host/heartbeat_sender.cc"/> - <item id="hintsfetcher_gethintsrequest" hash_code="34557599" type="0" content_hash_code="57003380" os_list="linux,windows" file_path="components/optimization_guide/hints_fetcher.cc"/> - <item id="history_notice_utils_notice" hash_code="102595701" type="1" second_id="110307337" content_hash_code="130829410" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc"/> - <item id="history_notice_utils_popup" hash_code="80832574" type="1" second_id="110307337" content_hash_code="30618510" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc"/> - <item id="history_ui_favicon_request_handler_get_favicon" hash_code="17562717" type="0" content_hash_code="64054629" os_list="linux,windows" file_path="components/favicon/core/history_ui_favicon_request_handler_impl.cc"/> - <item id="http_server_error_response" hash_code="32197336" type="0" content_hash_code="61082230" os_list="linux,windows" file_path="net/server/http_server.cc"/> - <item id="https_server_previews_navigation" hash_code="35725390" type="0" deprecated="2020-04-23" content_hash_code="84423109" file_path="chrome/browser/previews/previews_lite_page_redirect_serving_url_loader.cc"/> - <item id="ice_config_fetcher" hash_code="137093034" type="0" content_hash_code="60051202" os_list="linux,windows" file_path="chrome/browser/sharing/webrtc/ice_config_fetcher.cc"/> - <item id="icon_cacher" hash_code="103133150" type="0" content_hash_code="116368348" os_list="linux,windows" file_path="components/ntp_tiles/icon_cacher_impl.cc"/> - <item id="icon_catcher_get_large_icon" hash_code="44494884" type="0" content_hash_code="98262037" os_list="linux,windows" file_path="components/ntp_tiles/icon_cacher_impl.cc"/> - <item id="image_annotation" hash_code="107881858" type="0" content_hash_code="76229990" os_list="linux,windows" file_path="services/image_annotation/annotator.cc"/> - <item id="indexed_db_internals_handler" hash_code="131180348" type="0" content_hash_code="59026406" os_list="linux,windows" file_path="content/browser/indexed_db/indexed_db_internals_ui.cc"/> - <item id="interest_feed_send" hash_code="76717919" type="0" content_hash_code="6240898" os_list="linux,windows" file_path="components/feed/core/feed_networking_host.cc"/> - <item id="interest_feedv2_image_send" hash_code="92245202" type="0" content_hash_code="107508312" os_list="linux,windows" file_path="components/feed/core/v2/image_fetcher.cc"/> - <item id="interest_feedv2_send" hash_code="85742023" type="0" content_hash_code="49706671" os_list="linux,windows" file_path="components/feed/core/v2/feed_network_impl.cc"/> - <item id="intranet_redirect_detector" hash_code="21785164" type="0" content_hash_code="62025595" os_list="linux,windows" file_path="chrome/browser/intranet_redirect_detector.cc"/> - <item id="invalidation_service" hash_code="72354423" type="0" deprecated="2020-01-23" content_hash_code="78425687" file_path=""/> - <item id="isolated_prerender_canary_check" hash_code="60914954" type="0" content_hash_code="2991117" os_list="linux,windows" file_path="chrome/browser/prerender/isolated/isolated_prerender_origin_prober.cc"/> - <item id="isolated_prerender_loader" hash_code="2181152" type="0" content_hash_code="113933667" os_list="linux,windows" file_path="chrome/browser/prerender/isolated/isolated_prerender_url_loader.cc"/> - <item id="isolated_prerender_probe" hash_code="115160522" type="0" content_hash_code="75211055" os_list="linux,windows" file_path="chrome/browser/prerender/isolated/isolated_prerender_origin_prober.cc"/> - <item id="javascript_report_error" hash_code="109607776" type="0" content_hash_code="30837893" os_list="linux,windows" file_path="components/crash/content/browser/error_reporting/send_javascript_error_report.cc"/> - <item id="kaleidoscope_service" hash_code="49759694" type="0" content_hash_code="14307563" os_list="linux,windows" file_path="chrome/browser/media/kaleidoscope/kaleidoscope_service.cc"/> - <item id="kids_chrome_management_client_classify_url" hash_code="109987793" type="0" deprecated="2019-07-30" content_hash_code="112740597" file_path=""/> - <item id="lib_address_input" hash_code="50816767" type="0" content_hash_code="57977576" os_list="linux,windows" file_path="third_party/libaddressinput/chromium/chrome_metadata_source.cc"/> - <item id="load_autofill_gstatic_data" hash_code="119416099" type="0" content_hash_code="8433621" os_list="linux,windows" file_path="chrome/browser/autofill/autofill_gstatic_reader.cc"/> - <item id="logo_service" hash_code="35473769" type="0" content_hash_code="20271299" os_list="linux,windows" file_path="components/search_provider_logos/logo_service_impl.cc"/> - <item id="logo_tracker" hash_code="36859107" type="0" deprecated="2018-12-07" content_hash_code="67588075" file_path=""/> - <item id="lookup_single_password_leak" hash_code="16927377" type="0" content_hash_code="12158296" os_list="linux,windows" file_path="components/password_manager/core/browser/leak_detection/leak_detection_request.cc"/> - <item id="media_feeds" hash_code="116778918" type="0" content_hash_code="48909601" os_list="linux,windows" file_path="chrome/browser/media/feeds/media_feeds_fetcher.cc"/> - <item id="media_feeds_checker" hash_code="107707089" type="0" content_hash_code="125348528" os_list="linux,windows" file_path="chrome/browser/media/feeds/media_feeds_service.cc"/> - <item id="media_router_global_media_controls_image" hash_code="95983790" type="0" content_hash_code="48851217" os_list="linux,windows" file_path="chrome/browser/ui/global_media_controls/cast_media_notification_item.cc"/> - <item id="metrics_report_ukm" hash_code="727478" type="0" content_hash_code="8746987" os_list="linux,windows" file_path="components/metrics/net/net_metrics_log_uploader.cc"/> - <item id="metrics_report_uma" hash_code="727528" type="0" content_hash_code="10176197" os_list="linux,windows" file_path="components/metrics/net/net_metrics_log_uploader.cc"/> - <item id="mirroring_get_setup_info" hash_code="78447809" type="0" content_hash_code="64839410" os_list="windows,linux" file_path="components/mirroring/service/receiver_setup_querier.cc"/> - <item id="missing" hash_code="77012883" type="0" reserved="1" os_list="linux,windows" file_path=""/> - <item id="mojo_context_state" hash_code="93232258" type="0" deprecated="2017-10-20" content_hash_code="124821232" file_path=""/> - <item id="navigation_predictor_srp_prefetch" hash_code="57773453" type="0" content_hash_code="38811322" os_list="linux,windows" file_path="chrome/browser/prerender/isolated/isolated_prerender_tab_helper.cc"/> - <item id="navigation_url_loader" hash_code="63171670" type="0" content_hash_code="129352907" os_list="linux,windows" file_path="content/browser/loader/navigation_url_loader_impl.cc"/> - <item id="nearby_share_contacts" hash_code="91999155" type="1" second_id="29188932" content_hash_code="74684570" os_list="linux,windows" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc"/> - <item id="nearby_share_list_public_certificates" hash_code="123714070" type="1" second_id="29188932" content_hash_code="24145546" os_list="linux,windows" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc"/> - <item id="nearby_share_update_device" hash_code="30656793" type="1" second_id="29188932" content_hash_code="30624346" os_list="linux,windows" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc"/> - <item id="nearby_webrtc_connection" hash_code="37994740" type="0" content_hash_code="118366066" os_list="linux,windows" file_path="chrome/services/sharing/nearby/platform_v2/webrtc.cc"/> - <item id="net_error_helper" hash_code="60071001" type="0" deprecated="2020-07-10" content_hash_code="68322861" file_path=""/> - <item id="network_location_provider" hash_code="23472048" type="1" second_id="96590038" content_hash_code="41087976" os_list="linux,windows" semantics_fields="1" policy_fields="3,4" file_path="services/device/geolocation/network_location_provider.cc"/> - <item id="network_location_request" hash_code="96590038" type="2" content_hash_code="80741011" os_list="linux,windows" semantics_fields="2,3,4,5" policy_fields="-1" file_path="services/device/geolocation/network_location_request.cc"/> - <item id="network_time_component" hash_code="46188932" type="0" content_hash_code="28051857" os_list="linux,windows" file_path="components/network_time/network_time_tracker.cc"/> - <item id="new_tab_page_handler" hash_code="48673144" type="0" content_hash_code="49174657" os_list="linux,windows" file_path="chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc"/> - <item id="notification_client" hash_code="78479125" type="0" content_hash_code="129874070" os_list="linux,windows" file_path="remoting/client/notification/notification_client.cc"/> - <item id="ntp_contextual_suggestions_fetch" hash_code="95711309" type="0" deprecated="2019-04-18" content_hash_code="107035434" file_path=""/> - <item id="ntp_custom_background" hash_code="92125886" type="0" content_hash_code="61176452" os_list="linux,windows" file_path="chrome/browser/search/instant_service.cc"/> - <item id="ntp_custom_link_checker_request" hash_code="78408551" type="0" deprecated="2018-10-26" content_hash_code="13407730" file_path=""/> - <item id="ntp_icon_source" hash_code="29197139" type="0" content_hash_code="16399294" os_list="linux,windows" file_path="chrome/browser/search/ntp_icon_source.cc"/> - <item id="ntp_snippets_fetch" hash_code="15418154" type="0" content_hash_code="10078959" os_list="linux,windows" file_path="components/ntp_snippets/remote/json_request.cc"/> - <item id="nux_ntp_background_preview" hash_code="124847649" type="0" content_hash_code="31404656" os_list="linux,windows" file_path="chrome/browser/ui/webui/welcome/ntp_background_fetcher.cc"/> - <item id="oauth2_access_token_fetcher" hash_code="27915688" type="0" content_hash_code="33501872" os_list="linux,windows" file_path="google_apis/gaia/oauth2_access_token_fetcher_impl.cc"/> - <item id="oauth2_api_call_flow" hash_code="29188932" type="2" content_hash_code="108831236" os_list="linux,windows" policy_fields="-1" file_path="google_apis/gaia/oauth2_api_call_flow.cc"/> - <item id="oauth2_mint_token_flow" hash_code="1112842" type="1" second_id="29188932" content_hash_code="91581432" os_list="linux,windows" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="google_apis/gaia/oauth2_mint_token_flow.cc"/> - <item id="ocsp_start_url_loader" hash_code="3646641" type="0" deprecated="2020-04-28" content_hash_code="106270072" file_path=""/> - <item id="ocsp_start_url_request" hash_code="60921996" type="0" deprecated="2020-04-28" content_hash_code="6288676" file_path=""/> - <item id="offline_prefetch" hash_code="19185953" type="0" content_hash_code="112039446" os_list="linux,windows" file_path="components/offline_pages/core/prefetch/prefetch_request_fetcher.cc"/> - <item id="omnibox_documentsuggest" hash_code="6055066" type="0" content_hash_code="126973249" os_list="linux,windows" file_path="components/omnibox/browser/document_suggestions_service.cc"/> - <item id="omnibox_navigation_observer" hash_code="61684939" type="0" content_hash_code="70941231" os_list="linux,windows" file_path="chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc"/> - <item id="omnibox_result_change" hash_code="73107389" type="0" content_hash_code="24802647" os_list="linux,windows" file_path="chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc"/> - <item id="omnibox_suggest" hash_code="47815025" type="0" content_hash_code="86297726" os_list="linux,windows" file_path="components/omnibox/browser/search_provider.cc"/> - <item id="omnibox_suggest_deletion" hash_code="84212388" type="0" content_hash_code="24981550" os_list="linux,windows" file_path="components/omnibox/browser/base_search_provider.cc"/> - <item id="omnibox_zerosuggest" hash_code="7687691" type="0" content_hash_code="119419625" os_list="linux,windows" file_path="components/omnibox/browser/remote_suggestions_service.cc"/> - <item id="one_google_bar_service" hash_code="78917933" type="0" content_hash_code="46527252" os_list="linux,windows" file_path="chrome/browser/search/one_google_bar/one_google_bar_loader_impl.cc"/> - <item id="open_screen_message" hash_code="95250780" type="0" deprecated="2020-02-13" content_hash_code="39027953" file_path=""/> - <item id="open_screen_tls_message" hash_code="61695471" type="0" deprecated="2020-02-13" content_hash_code="28355565" file_path=""/> - <item id="open_search" hash_code="107267424" type="0" content_hash_code="83025542" os_list="linux,windows" file_path="components/search_engines/template_url_fetcher.cc"/> - <item id="openscreen_message" hash_code="23036184" type="0" content_hash_code="124395439" os_list="linux,windows" file_path="components/openscreen_platform/udp_socket.cc"/> - <item id="openscreen_tls_message" hash_code="40127335" type="0" content_hash_code="15991338" os_list="linux,windows" file_path="components/openscreen_platform/tls_connection_factory.cc"/> - <item id="optimization_guide_model" hash_code="106373593" type="0" content_hash_code="32403047" os_list="linux,windows" file_path="chrome/browser/optimization_guide/prediction/prediction_model_fetcher.cc"/> - <item id="origin_policy_loader" hash_code="6483617" type="0" content_hash_code="134028975" os_list="linux,windows" file_path="services/network/origin_policy/origin_policy_fetcher.cc"/> - <item id="parallel_download_job" hash_code="135118587" type="0" content_hash_code="105330419" os_list="linux,windows" file_path="components/download/internal/common/parallel_download_job.cc"/> - <item id="password_protection_request" hash_code="66322287" type="0" content_hash_code="25596947" os_list="linux,windows" file_path="components/safe_browsing/content/password_protection/password_protection_request.cc"/> - <item id="password_requirements_spec_fetch" hash_code="69585116" type="0" content_hash_code="5591260" os_list="linux,windows" file_path="components/password_manager/core/browser/generation/password_requirements_spec_fetcher_impl.cc"/> - <item id="payment_instrument_icon_fetcher" hash_code="73309970" type="0" deprecated="2017-09-16" content_hash_code="84709873" file_path=""/> - <item id="payment_manifest_downloader" hash_code="84045030" type="0" content_hash_code="19293316" os_list="linux,windows" file_path="components/payments/core/payment_manifest_downloader.cc"/> - <item id="payments_sync_cards" hash_code="95588446" type="0" content_hash_code="56526513" os_list="linux,windows" file_path="components/autofill/core/browser/payments/payments_client.cc"/> - <item id="pdf_plugin_placeholder" hash_code="56866367" type="0" content_hash_code="16907221" os_list="linux,windows" file_path="chrome/browser/plugins/pdf_plugin_placeholder_observer.cc"/> - <item id="pepper_tcp_socket" hash_code="120623198" type="0" content_hash_code="27489892" os_list="linux,windows" file_path="content/browser/renderer_host/pepper/pepper_socket_utils.cc"/> - <item id="pepper_udp_socket" hash_code="53512439" type="0" content_hash_code="7268418" os_list="linux,windows" file_path="content/browser/renderer_host/pepper/pepper_socket_utils.cc"/> - <item id="per_user_topic_registration_request" hash_code="10498172" type="0" content_hash_code="57098847" os_list="linux,windows" file_path="components/invalidation/impl/per_user_topic_subscription_request.cc"/> - <item id="permission_reporting" hash_code="131741641" type="0" deprecated="2018-03-06" content_hash_code="7213535" file_path=""/> - <item id="permission_request_creator" hash_code="43206794" type="0" deprecated="2019-07-30" content_hash_code="73571699" file_path=""/> - <item id="persist_blob_to_indexed_db" hash_code="32030464" type="0" deprecated="2018-08-13" content_hash_code="35410079" file_path=""/> - <item id="plugins_resource_service" hash_code="49601082" type="0" content_hash_code="6877335" os_list="linux,windows" file_path="chrome/browser/plugins/plugins_resource_service.cc"/> - <item id="policy_blacklist_service" hash_code="49799644" type="0" content_hash_code="57843386" os_list="linux,windows" file_path="components/policy/content/policy_blocklist_service.cc"/> - <item id="popular_sites_fetch" hash_code="50755044" type="0" content_hash_code="6910083" os_list="linux,windows" file_path="components/ntp_tiles/popular_sites_impl.cc"/> - <item id="port_forwarding_controller_socket" hash_code="95075845" type="0" content_hash_code="122163428" os_list="linux,windows" file_path="chrome/browser/devtools/device/port_forwarding_controller.cc"/> - <item id="ppapi_download_request" hash_code="135967426" type="0" content_hash_code="110461402" os_list="linux,windows" file_path="chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc"/> - <item id="predictive_prefetch" hash_code="72157052" type="0" content_hash_code="69511160" os_list="linux,windows" file_path="chrome/browser/predictors/prefetch_manager.cc"/> - <item id="prefetch_download" hash_code="44583172" type="0" content_hash_code="21424542" os_list="linux,windows" file_path="components/offline_pages/core/prefetch/prefetch_downloader_impl.cc"/> - <item id="prefetch_visuals" hash_code="91068704" type="0" content_hash_code="90439946" os_list="linux,windows" file_path="components/offline_pages/core/prefetch/visuals_fetch_by_url.cc"/> - <item id="previews_litepage_origin_prober" hash_code="33703614" type="0" deprecated="2020-04-23" content_hash_code="116235355" file_path="chrome/browser/previews/previews_lite_page_redirect_url_loader.cc"/> - <item id="previews_litepage_prober" hash_code="33813109" type="0" deprecated="2020-04-23" content_hash_code="52572789" file_path="chrome/browser/previews/previews_lite_page_redirect_decider.cc"/> - <item id="previews_prober" hash_code="41010697" type="0" deprecated="2019-07-24" content_hash_code="51581107" file_path=""/> - <item id="printer_job_handler" hash_code="67638271" type="1" second_id="111712433" content_hash_code="75712693" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/printer_job_handler.cc"/> - <item id="privet_http_impl" hash_code="71251498" type="0" content_hash_code="107348604" os_list="linux,windows" file_path="chrome/browser/printing/cloud_print/privet_http_impl.cc"/> - <item id="profile_avatar" hash_code="51164680" type="0" content_hash_code="113550845" os_list="linux,windows" file_path="chrome/browser/profiles/profile_avatar_downloader.cc"/> - <item id="profile_resetter_upload" hash_code="105330607" type="0" content_hash_code="129329171" os_list="linux,windows" file_path="chrome/browser/profile_resetter/reset_report_uploader.cc"/> - <item id="promo_service" hash_code="67052219" type="0" content_hash_code="32939033" os_list="linux,windows" file_path="chrome/browser/search/promos/promo_service.cc"/> - <item id="proxy_config_direct" hash_code="119015679" type="0" content_hash_code="119931568" os_list="linux,windows" file_path="net/proxy_resolution/proxy_config_with_annotation.cc"/> - <item id="proxy_config_headless" hash_code="133221587" type="0" content_hash_code="77459277" os_list="linux,windows" file_path="headless/lib/browser/headless_request_context_manager.cc"/> - <item id="proxy_config_settings" hash_code="136468456" type="0" content_hash_code="19527377" os_list="linux,windows" file_path="components/proxy_config/pref_proxy_config_tracker_impl.cc"/> - <item id="proxy_config_system" hash_code="11258689" type="0" content_hash_code="77057929" os_list="linux,windows" file_path="net/proxy_resolution/configured_proxy_resolution_service.cc"/> - <item id="proxy_config_windows_resolver" hash_code="13924805" type="0" content_hash_code="123023599" os_list="windows" file_path="net/proxy_resolution/win/windows_system_proxy_resolution_request.cc"/> - <item id="proxy_script_fetcher" hash_code="37531401" type="0" deprecated="2018-03-16" content_hash_code="31866133" file_path=""/> - <item id="puch_client_channel" hash_code="34459548" type="0" deprecated="2020-01-23" content_hash_code="92475475" file_path=""/> - <item id="qr_code_save" hash_code="87963126" type="0" content_hash_code="72717245" os_list="linux,windows" file_path="chrome/browser/ui/views/qrcode_generator/qrcode_generator_bubble.cc"/> - <item id="query_tiles_fetcher" hash_code="10243490" type="0" content_hash_code="16824373" os_list="linux,windows" file_path="components/query_tiles/internal/tile_fetcher.cc"/> - <item id="query_tiles_image_loader" hash_code="95103115" type="0" content_hash_code="75070538" os_list="linux,windows" file_path="components/query_tiles/internal/cached_image_loader.cc"/> - <item id="quic_chromium_incoming_pending_session" hash_code="120830730" type="0" content_hash_code="52904665" os_list="linux,windows" file_path="net/quic/quic_chromium_client_session.cc"/> - <item id="quic_chromium_incoming_session" hash_code="87635401" type="0" content_hash_code="78573093" os_list="linux,windows" file_path="net/quic/quic_chromium_client_session.cc"/> - <item id="quic_chromium_packet_writer" hash_code="20153177" type="0" content_hash_code="29657765" os_list="linux,windows" file_path="net/quic/quic_chromium_packet_writer.cc"/> - <item id="ranker_url_fetcher" hash_code="95682324" type="0" content_hash_code="45958626" os_list="linux,windows" file_path="components/assist_ranker/ranker_url_fetcher.cc"/> - <item id="rappor_report" hash_code="44606780" type="0" content_hash_code="111287826" os_list="linux,windows" file_path="components/rappor/log_uploader.cc"/> - <item id="receive_messages_express" hash_code="29506140" type="0" content_hash_code="38581365" os_list="linux,windows" file_path="chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc"/> - <item id="refresh_token_annotation_request" hash_code="7433837" type="1" second_id="29188932" deprecated="2018-01-17" content_hash_code="137103383" file_path=""/> - <item id="remote_copy_message_handler" hash_code="80255301" type="0" content_hash_code="117673331" os_list="linux,windows" file_path="chrome/browser/sharing/shared_clipboard/remote_copy_message_handler.cc"/> - <item id="remote_suggestions_provider" hash_code="49544361" type="0" content_hash_code="126329742" os_list="linux,windows" file_path="components/ntp_snippets/remote/cached_image_fetcher.cc"/> - <item id="remoting_directory_delete_host" hash_code="89093734" type="0" content_hash_code="65893931" os_list="linux,windows" file_path="remoting/base/directory_service_client.cc"/> - <item id="remoting_directory_get_host_list" hash_code="93434368" type="0" content_hash_code="59980448" os_list="linux,windows" file_path="remoting/base/directory_service_client.cc"/> - <item id="remoting_directory_register_host" hash_code="117688925" type="0" content_hash_code="74224493" os_list="linux,windows" file_path="remoting/base/directory_service_client.cc"/> - <item id="remoting_ice_config_request" hash_code="88945310" type="0" content_hash_code="94742293" os_list="linux,windows" file_path="remoting/protocol/remoting_ice_config_request.cc"/> - <item id="remoting_log_to_server" hash_code="99742369" type="0" content_hash_code="117118166" os_list="linux,windows" file_path="remoting/signaling/remoting_log_to_server.cc"/> - <item id="remoting_register_support_host_request" hash_code="67117364" type="0" content_hash_code="15955284" os_list="linux,windows" file_path="remoting/host/remoting_register_support_host_request.cc"/> - <item id="remoting_telemetry_log_writer" hash_code="107268760" type="0" content_hash_code="81741595" os_list="linux,windows" file_path="remoting/base/telemetry_log_writer.cc"/> - <item id="render_view_context_menu" hash_code="25844439" type="0" content_hash_code="69471170" os_list="linux,windows" file_path="chrome/browser/renderer_context_menu/render_view_context_menu.cc"/> - <item id="renderer_initiated_download" hash_code="116443055" type="0" content_hash_code="37846436" os_list="linux,windows" file_path="content/browser/renderer_host/render_frame_host_impl.cc"/> - <item id="reporting" hash_code="109891200" type="0" content_hash_code="125758928" os_list="linux,windows" file_path="net/reporting/reporting_uploader.cc"/> - <item id="resource_dispatcher_host" hash_code="81157007" type="0" deprecated="2019-07-30" content_hash_code="35725167" file_path=""/> - <item id="resource_prefetch" hash_code="110815970" type="0" deprecated="2018-02-28" content_hash_code="39251261" file_path=""/> - <item id="rlz_ping" hash_code="99279418" type="0" content_hash_code="102108802" os_list="windows" file_path="rlz/lib/financial_ping.cc"/> - <item id="safe_browsing_backup_request" hash_code="106980485" type="0" deprecated="2018-08-14" content_hash_code="101760679" file_path=""/> - <item id="safe_browsing_binary_upload" hash_code="71663319" type="0" content_hash_code="105913171" os_list="linux,windows" file_path="chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc"/> - <item id="safe_browsing_cache_collector" hash_code="115907811" type="0" content_hash_code="62296373" os_list="linux,windows" file_path="components/safe_browsing/content/browser/threat_details_cache.cc"/> - <item id="safe_browsing_certificate_error_reporting" hash_code="66590631" type="0" content_hash_code="26108454" os_list="linux,windows" file_path="chrome/browser/ssl/certificate_error_reporter.cc"/> - <item id="safe_browsing_chunk_backup_request" hash_code="79957943" type="0" deprecated="2018-08-14" content_hash_code="133850277" file_path=""/> - <item id="safe_browsing_client_side_malware_detector" hash_code="102935425" type="0" deprecated="2019-12-07" content_hash_code="79591279" file_path=""/> - <item id="safe_browsing_client_side_phishing_detector" hash_code="1313982" type="0" content_hash_code="50199143" os_list="linux,windows" file_path="chrome/browser/safe_browsing/client_side_detection_service.cc"/> - <item id="safe_browsing_extended_reporting" hash_code="42848942" type="0" content_hash_code="81193513" os_list="linux,windows" file_path="components/safe_browsing/core/ping_manager.cc"/> - <item id="safe_browsing_feedback" hash_code="44583821" type="0" content_hash_code="27116846" os_list="linux,windows" file_path="chrome/browser/safe_browsing/download_protection/download_feedback.cc"/> - <item id="safe_browsing_get_full_hash" hash_code="68745894" type="0" deprecated="2018-08-14" content_hash_code="21739198" file_path=""/> - <item id="safe_browsing_incident" hash_code="124950347" type="0" content_hash_code="7306531" os_list="linux,windows" file_path="chrome/browser/safe_browsing/incident_reporting/incident_report_uploader_impl.cc"/> - <item id="safe_browsing_module_loader" hash_code="6019475" type="0" content_hash_code="49511650" os_list="linux,windows" file_path="chrome/browser/safe_browsing/client_side_model_loader.cc"/> - <item id="safe_browsing_realtime_url_lookup" hash_code="119324658" type="0" content_hash_code="71236226" os_list="linux,windows" file_path="components/safe_browsing/core/realtime/url_lookup_service.cc"/> - <item id="safe_browsing_v4_get_hash" hash_code="8561691" type="0" content_hash_code="132435617" os_list="linux,windows" file_path="components/safe_browsing/core/db/v4_get_hash_protocol_manager.cc"/> - <item id="safe_browsing_v4_update" hash_code="82509217" type="0" content_hash_code="5247849" os_list="linux,windows" file_path="components/safe_browsing/core/db/v4_update_protocol_manager.cc"/> - <item id="safety_check_update_connectivity" hash_code="137724067" type="0" content_hash_code="30977369" os_list="linux,windows" file_path="components/safety_check/update_check_helper.cc"/> - <item id="sanitized_image_source" hash_code="36944304" type="0" content_hash_code="39770427" os_list="linux,windows" file_path="chrome/browser/ui/webui/sanitized_image_source.cc"/> - <item id="save_file_manager" hash_code="56275203" type="0" content_hash_code="56692339" os_list="linux,windows" file_path="content/browser/download/save_file_manager.cc"/> - <item id="sdch_dictionary_fetch" hash_code="47152935" type="0" deprecated="2017-09-16" content_hash_code="16764294" file_path=""/> - <item id="search_suggest_service" hash_code="57785193" type="0" content_hash_code="132247652" os_list="linux,windows" file_path="chrome/browser/search/search_suggest/search_suggest_loader_impl.cc"/> - <item id="security_key_socket" hash_code="31074955" type="0" content_hash_code="13741232" os_list="linux,windows" file_path="remoting/host/security_key/security_key_socket.cc"/> - <item id="send_message_express" hash_code="23527666" type="0" content_hash_code="96850228" os_list="linux,windows" file_path="chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc"/> - <item id="service_worker_navigation_preload" hash_code="129872904" type="0" content_hash_code="79473248" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_fetch_dispatcher.cc"/> - <item id="service_worker_update_checker" hash_code="130931413" type="0" content_hash_code="46608086" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_single_script_update_checker.cc"/> - <item id="services_http_server_error_response" hash_code="59302801" type="0" content_hash_code="127774041" os_list="linux,windows" file_path="services/network/public/cpp/server/http_server.cc"/> - <item id="sigined_exchange_cert_fetcher" hash_code="79442849" type="0" content_hash_code="8138156" os_list="linux,windows" file_path="content/browser/web_package/signed_exchange_cert_fetcher.cc"/> - <item id="sigined_exchange_validity_pinger" hash_code="57114284" type="0" content_hash_code="119482488" os_list="linux,windows" file_path="content/browser/web_package/signed_exchange_validity_pinger.cc"/> - <item id="signed_in_profile_avatar" hash_code="108903331" type="0" content_hash_code="72850619" os_list="linux,windows" file_path="chrome/browser/profiles/profile_downloader.cc"/> - <item id="socket_bio_adapter" hash_code="516551" type="0" content_hash_code="21643352" os_list="linux,windows" file_path="net/socket/socket_bio_adapter.cc"/> - <item id="spdy_push_stream" hash_code="36915753" type="0" content_hash_code="69224629" os_list="linux,windows" file_path="net/spdy/spdy_session.cc"/> - <item id="spdy_session_control" hash_code="57143548" type="0" content_hash_code="29815792" os_list="linux,windows" file_path="net/spdy/spdy_session.cc"/> - <item id="speech_recognition_downstream" hash_code="26096088" type="0" content_hash_code="120733233" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc"/> - <item id="speech_recognition_upstream" hash_code="66846958" type="0" content_hash_code="7706219" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc"/> - <item id="spellcheck_hunspell_dictionary" hash_code="117649486" type="0" content_hash_code="45660952" os_list="linux,windows" file_path="chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc"/> - <item id="spellcheck_lookup" hash_code="132553989" type="0" content_hash_code="120395045" os_list="linux,windows" file_path="components/spellcheck/browser/spelling_service_client.cc"/> - <item id="ssl_hmac_channel_authenticator" hash_code="106124561" type="0" content_hash_code="110454877" os_list="linux,windows" file_path="remoting/protocol/ssl_hmac_channel_authenticator.cc"/> - <item id="ssl_name_mismatch_lookup" hash_code="114468207" type="0" content_hash_code="97619078" os_list="linux,windows" file_path="components/security_interstitials/content/common_name_mismatch_handler.cc"/> - <item id="stream_message_pipe_adapter" hash_code="71837756" type="0" content_hash_code="66212605" os_list="linux,windows" file_path="remoting/protocol/stream_message_pipe_adapter.cc"/> - <item id="stream_packet_socket" hash_code="38197513" type="0" content_hash_code="55116994" os_list="linux,windows" file_path="remoting/protocol/stream_packet_socket.cc"/> - <item id="suggestions_image_manager" hash_code="13211343" type="0" deprecated="2018-11-28" content_hash_code="36271280" file_path=""/> - <item id="suggestions_service" hash_code="35370363" type="0" content_hash_code="66296423" os_list="linux,windows" file_path="components/suggestions/suggestions_service_impl.cc"/> - <item id="supervised_user_refresh_token_fetcher" hash_code="136117054" type="0" deprecated="2018-04-18" content_hash_code="101636136" file_path=""/> - <item id="supervised_user_url_filter" hash_code="14257952" type="0" deprecated="2019-07-30" content_hash_code="30470003" file_path=""/> - <item id="supervised_users_blacklist" hash_code="78544924" type="0" deprecated="2019-07-30" content_hash_code="10924669" file_path=""/> - <item id="sync_attachment_downloader" hash_code="26372521" type="0" deprecated="2018-02-08" content_hash_code="70097603" file_path=""/> - <item id="sync_attachment_uploader" hash_code="132657055" type="0" deprecated="2018-02-08" content_hash_code="25152853" file_path=""/> - <item id="sync_file_system" hash_code="102819690" type="0" content_hash_code="52153962" os_list="linux,windows" file_path="chrome/browser/sync_file_system/drive_backend/sync_engine.cc"/> - <item id="sync_http_bridge" hash_code="57144960" type="0" content_hash_code="32868346" os_list="linux,windows" file_path="components/sync/engine/net/http_bridge.cc"/> - <item id="sync_stop_reporter" hash_code="5021348" type="0" content_hash_code="56902850" os_list="linux,windows" file_path="components/sync/driver/sync_stopped_reporter.cc"/> - <item id="test" hash_code="3556498" type="0" reserved="1" os_list="linux,windows" file_path=""/> - <item id="test_partial" hash_code="22096011" type="0" reserved="1" os_list="linux,windows" file_path=""/> - <item id="tethering_handler_socket" hash_code="113065062" type="0" content_hash_code="986296" os_list="linux,windows" file_path="content/browser/devtools/protocol/tethering_handler.cc"/> - <item id="thumbnail_source" hash_code="135251783" type="0" deprecated="2018-11-27" content_hash_code="31086298" file_path=""/> - <item id="translate_url_fetcher" hash_code="137116619" type="0" content_hash_code="104217506" os_list="linux,windows" file_path="components/translate/core/browser/translate_url_fetcher.cc"/> - <item id="ui_devtools_server" hash_code="4986170" type="0" content_hash_code="62670263" os_list="linux,windows" file_path="components/ui_devtools/devtools_server.cc"/> - <item id="undefined" hash_code="45578882" type="0" reserved="1" os_list="linux,windows" file_path=""/> - <item id="unwanted_software_report" hash_code="43759504" type="0" content_hash_code="59154788" os_list="windows" file_path="chrome/chrome_cleaner/logging/reporter_logging_service.cc"/> - <item id="update_client" hash_code="54845618" type="0" content_hash_code="86129031" os_list="linux,windows" file_path="components/update_client/net/network_impl.cc"/> - <item id="url_fetcher_downloader" hash_code="113231892" type="0" deprecated="2019-02-09" content_hash_code="61085066" file_path=""/> - <item id="url_prevision_fetcher" hash_code="118389509" type="0" content_hash_code="66145513" os_list="linux,windows" file_path="content/browser/media/url_provision_fetcher.cc"/> - <item id="user_info_fetcher" hash_code="22265491" type="0" content_hash_code="72016232" os_list="linux,windows" file_path="components/policy/core/common/cloud/user_info_fetcher.cc"/> - <item id="viz_devtools_server" hash_code="16292315" type="0" content_hash_code="70061664" os_list="linux,windows" file_path="components/ui_devtools/devtools_server.cc"/> - <item id="web_bundle_loader" hash_code="114615359" type="0" content_hash_code="57390734" os_list="linux,windows" file_path="content/browser/web_package/web_bundle_utils.cc"/> - <item id="web_history_counter" hash_code="137457845" type="1" second_id="110307337" content_hash_code="49663381" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/counters/history_counter.cc"/> - <item id="web_history_delete_url" hash_code="41749213" type="1" second_id="110307337" content_hash_code="25943026" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc"/> - <item id="web_history_expire" hash_code="60946824" type="1" second_id="110307337" content_hash_code="92626030" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc"/> - <item id="web_history_expire_between_dates" hash_code="126122632" type="1" second_id="110307337" content_hash_code="34304787" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc"/> - <item id="web_history_query" hash_code="17400350" type="1" second_id="110307337" content_hash_code="36075147" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc"/> - <item id="web_history_service" hash_code="110307337" type="2" content_hash_code="16140045" os_list="linux,windows" semantics_fields="1,5" policy_fields="-1,3" file_path="components/history/core/browser/web_history_service.cc"/> - <item id="web_push_message" hash_code="39886742" type="0" content_hash_code="110064650" os_list="linux,windows" file_path="chrome/browser/sharing/web_push/web_push_sender.cc"/> - <item id="webrtc_event_log_uploader" hash_code="24186190" type="0" content_hash_code="11005245" os_list="linux,windows" file_path="chrome/browser/media/webrtc/webrtc_event_log_uploader.cc"/> - <item id="webrtc_log_upload" hash_code="62443804" type="0" content_hash_code="33661169" os_list="linux,windows" file_path="chrome/browser/media/webrtc/webrtc_log_uploader.cc"/> - <item id="webrtc_peer_connection" hash_code="63497370" type="0" content_hash_code="60553259" os_list="linux,windows" file_path="third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc"/> - <item id="websocket_basic_stream" hash_code="51586722" type="0" content_hash_code="68121427" os_list="linux,windows" file_path="net/websockets/websocket_basic_stream.cc"/> - <item id="websocket_stream" hash_code="17188928" type="0" content_hash_code="7250776" os_list="linux,windows" file_path="content/browser/websockets/websocket_connector_impl.cc"/> - <item id="webstore_data_fetcher" hash_code="26302604" type="0" content_hash_code="24000746" os_list="linux,windows" file_path="chrome/browser/extensions/webstore_data_fetcher.cc"/> - <item id="webstore_install_helper" hash_code="25921771" type="0" content_hash_code="10206361" os_list="linux,windows" file_path="chrome/browser/extensions/webstore_install_helper.cc"/> - <item id="webstore_installer" hash_code="18764319" type="0" content_hash_code="70871152" os_list="linux,windows" file_path="chrome/browser/extensions/webstore_installer.cc"/> - <item id="webui_content_scripts_download" hash_code="100545943" type="0" content_hash_code="119898059" os_list="linux,windows" file_path="extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.cc"/> - <item id="well_known_path_that_should_not_exist" hash_code="134618785" type="0" content_hash_code="55913167" os_list="linux,windows" file_path="components/password_manager/core/browser/well_known_change_password_state.cc"/> - <item id="worker_script_load" hash_code="72087791" type="0" content_hash_code="24889169" os_list="linux,windows" file_path="content/browser/worker_host/worker_script_fetcher.cc"/> - <item id="xmpp_signal_strategy" hash_code="88906454" type="0" deprecated="2019-07-16" content_hash_code="88958321" file_path=""/> + <item id="CRD_relay_session_request" added_in_milestone="62" hash_code="24058523" type="0" deprecated="2019-07-22" content_hash_code="36997811" file_path=""/> + <item id="accounts_image_fetcher" added_in_milestone="66" hash_code="98658519" type="0" content_hash_code="45432230" os_list="linux,windows" file_path="components/signin/internal/identity_manager/account_fetcher_service.cc"/> + <item id="adb_client_socket" added_in_milestone="65" hash_code="87775794" type="0" content_hash_code="56654828" os_list="linux,windows" file_path="chrome/browser/devtools/device/adb/adb_client_socket.cc"/> + <item id="affiliation_lookup" added_in_milestone="62" hash_code="111904019" type="0" content_hash_code="81061452" os_list="linux,windows" file_path="components/password_manager/core/browser/android_affiliation/affiliation_fetcher.cc"/> + <item id="android_device_manager_socket" added_in_milestone="65" hash_code="37249086" type="0" content_hash_code="6436865" os_list="linux,windows" file_path="chrome/browser/devtools/device/android_device_manager.cc"/> + <item id="android_web_socket" added_in_milestone="65" hash_code="39356976" type="0" content_hash_code="12310113" os_list="linux,windows" file_path="chrome/browser/devtools/device/android_web_socket.cc"/> + <item id="appcache_update_job" added_in_milestone="62" hash_code="25790702" type="0" content_hash_code="27424887" os_list="linux,windows" file_path="content/browser/appcache/appcache_update_url_loader_request.cc"/> + <item id="autofill_query" added_in_milestone="62" hash_code="88863520" type="0" content_hash_code="15563339" os_list="linux,windows" file_path="components/autofill/core/browser/autofill_download_manager.cc"/> + <item id="autofill_upload" added_in_milestone="62" hash_code="104798869" type="0" content_hash_code="110634763" os_list="linux,windows" file_path="components/autofill/core/browser/autofill_download_manager.cc"/> + <item id="backdrop_collection_images_download" added_in_milestone="68" hash_code="34767164" type="0" content_hash_code="62971406" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc"/> + <item id="backdrop_collection_names_download" added_in_milestone="68" hash_code="49246286" type="0" content_hash_code="93501319" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc"/> + <item id="backdrop_next_image_download" added_in_milestone="77" hash_code="7754485" type="0" content_hash_code="98537970" os_list="linux,windows" file_path="chrome/browser/search/background/ntp_background_service.cc"/> + <item id="background_fetch_context" added_in_milestone="62" hash_code="16469669" type="0" content_hash_code="52235434" os_list="linux,windows" file_path="content/browser/background_fetch/background_fetch_delegate_proxy.cc"/> + <item id="background_performance_tracer" added_in_milestone="62" hash_code="84575287" type="0" content_hash_code="120154250" os_list="linux,windows" file_path="chrome/browser/tracing/crash_service_uploader.cc"/> + <item id="bidirectional_stream" added_in_milestone="67" hash_code="108665132" type="0" content_hash_code="130038340" os_list="linux,windows" file_path="net/http/bidirectional_stream.cc"/> + <item id="blink_extension_resource_loader" added_in_milestone="63" hash_code="84165821" type="0" content_hash_code="63536185" os_list="linux,windows" file_path="content/renderer/loader/web_url_loader_impl.cc"/> + <item id="blink_resource_loader" added_in_milestone="62" hash_code="101845102" type="0" content_hash_code="75331172" os_list="linux,windows" file_path="content/renderer/loader/web_url_loader_impl.cc"/> + <item id="blob_read" added_in_milestone="62" hash_code="112303907" type="0" deprecated="2019-08-09" content_hash_code="135449692" file_path=""/> + <item id="blob_reader" added_in_milestone="62" hash_code="5154306" type="0" deprecated="2018-06-14" content_hash_code="39702178" file_path=""/> + <item id="bluetooth_socket" added_in_milestone="65" hash_code="94099818" type="0" content_hash_code="30932349" os_list="linux,windows" file_path="device/bluetooth/bluetooth_socket_net.cc"/> + <item id="brandcode_config" added_in_milestone="62" hash_code="109679553" type="0" content_hash_code="128843792" os_list="linux,windows" file_path="chrome/browser/profile_resetter/brandcode_config_fetcher.cc"/> + <item id="browser_switcher_ieem_sitelist" added_in_milestone="72" hash_code="97159948" type="0" content_hash_code="129062966" os_list="linux,windows" file_path="chrome/browser/browser_switcher/browser_switcher_service.cc"/> + <item id="cablev2_websocket_from_client" added_in_milestone="86" hash_code="3464399" type="0" content_hash_code="46324469" os_list="windows,linux" file_path="device/fido/cable/fido_tunnel_device.cc"/> + <item id="captive_portal_service" added_in_milestone="62" hash_code="88754904" type="0" content_hash_code="70737580" os_list="linux,windows" file_path="components/captive_portal/content/captive_portal_service.cc"/> + <item id="cast_channel_send" added_in_milestone="66" hash_code="103172229" type="0" deprecated="2018-08-23" content_hash_code="33946302" file_path=""/> + <item id="cast_keep_alive_delegate" added_in_milestone="66" hash_code="134755844" type="0" deprecated="2018-08-23" content_hash_code="66118796" file_path=""/> + <item id="cast_message_handler" added_in_milestone="66" hash_code="87558948" type="0" deprecated="2018-08-23" content_hash_code="49684899" file_path=""/> + <item id="cast_socket" added_in_milestone="66" hash_code="115192205" type="0" content_hash_code="42881651" os_list="linux,windows" file_path="components/cast_channel/cast_socket.cc"/> + <item id="cast_udp_socket" added_in_milestone="66" hash_code="22573197" type="0" content_hash_code="75328301" os_list="linux,windows" file_path="components/mirroring/service/udp_socket_client.cc"/> + <item id="cast_udp_transport" added_in_milestone="65" hash_code="5576536" type="0" content_hash_code="107643273" os_list="linux,windows" file_path="media/cast/net/udp_transport_impl.cc"/> + <item id="certificate_verifier_url_loader" added_in_milestone="80" hash_code="80134684" type="0" content_hash_code="92630208" os_list="linux,windows" file_path="services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader.cc"/> + <item id="certificate_verifier_url_request" added_in_milestone="80" hash_code="85988208" type="0" content_hash_code="59262468" os_list="linux,windows" file_path="net/cert_net/cert_net_fetcher_url_request.cc"/> + <item id="chrome_HaTS_service" added_in_milestone="83" hash_code="136028241" type="0" content_hash_code="68990360" os_list="linux,windows" file_path="chrome/browser/ui/hats/hats_survey_status_checker.cc"/> + <item id="chrome_apps_socket_api" added_in_milestone="65" hash_code="8591273" type="0" content_hash_code="130709397" os_list="linux,windows" file_path="extensions/browser/api/socket/socket.cc"/> + <item id="chrome_cleaner" added_in_milestone="63" hash_code="27071967" type="0" content_hash_code="111240292" os_list="windows" file_path="chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc"/> + <item id="chrome_cleanup_report" added_in_milestone="70" hash_code="71102679" type="0" content_hash_code="130565656" os_list="windows" file_path="chrome/chrome_cleaner/logging/cleaner_logging_service.cc"/> + <item id="chrome_feedback_report_app" added_in_milestone="62" hash_code="134729048" type="0" content_hash_code="73916972" os_list="linux,windows" file_path="components/feedback/feedback_uploader.cc"/> + <item id="chrome_variations_service" added_in_milestone="62" hash_code="115188287" type="0" content_hash_code="32485683" os_list="linux,windows" file_path="components/variations/service/variations_service.cc"/> + <item id="client_download_request" added_in_milestone="62" hash_code="125522256" type="0" content_hash_code="23897505" os_list="linux,windows" file_path="chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc"/> + <item id="cloud_print" added_in_milestone="65" hash_code="111712433" type="2" content_hash_code="60926140" os_list="linux,windows" semantics_fields="1,5" policy_fields="-1,3,4" file_path="chrome/service/cloud_print/cloud_print_url_fetcher.cc"/> + <item id="cloud_print_backend" added_in_milestone="62" hash_code="71578042" type="1" second_id="111712433" content_hash_code="85425333" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/cloud_print_proxy_backend.cc"/> + <item id="cloud_print_credential_update" added_in_milestone="66" hash_code="137420486" type="0" content_hash_code="1179808" os_list="linux,windows" file_path="chrome/service/cloud_print/cloud_print_proxy_backend.cc"/> + <item id="cloud_print_privet_register" added_in_milestone="62" hash_code="24978481" type="0" content_hash_code="131359002" os_list="linux,windows" file_path="chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc"/> + <item id="cloud_print_proxy" added_in_milestone="62" hash_code="50859288" type="1" second_id="111712433" content_hash_code="90868083" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/cloud_print_proxy.cc"/> + <item id="cloud_print_search" added_in_milestone="62" hash_code="132055347" type="0" content_hash_code="123783474" os_list="linux,windows" file_path="chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc"/> + <item id="cloud_speech_recognition" added_in_milestone="85" hash_code="15750036" type="0" deprecated="2020-05-27" content_hash_code="114921835" file_path="chrome/services/speech/cloud_speech_recognition_client.cc"/> + <item id="content_hash_verification_job" added_in_milestone="62" hash_code="64733114" type="0" content_hash_code="127912411" os_list="linux,windows" file_path="extensions/browser/content_hash_fetcher.cc"/> + <item id="content_resource_fetcher" added_in_milestone="63" hash_code="70796791" type="0" deprecated="2017-09-16" content_hash_code="135648626" file_path=""/> + <item id="content_suggestion_get_favicon" added_in_milestone="62" hash_code="16653985" type="0" content_hash_code="134280933" os_list="linux,windows" file_path="components/ntp_snippets/content_suggestions_service.cc"/> + <item id="conversion_measurement_report" added_in_milestone="84" hash_code="113422320" type="0" content_hash_code="60688877" os_list="linux,windows" file_path="content/browser/conversions/conversion_network_sender_impl.cc"/> + <item id="credenential_avatar" added_in_milestone="62" hash_code="53695122" type="0" content_hash_code="113035371" os_list="linux,windows" file_path="chrome/browser/ui/passwords/account_avatar_fetcher.cc"/> + <item id="cros_recovery_image_download" added_in_milestone="62" hash_code="101725581" type="0" content_hash_code="10999698" os_list="linux,windows" file_path="chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc"/> + <item id="cryptauth_device_sync_tickle" added_in_milestone="62" hash_code="96565489" type="1" second_id="29188932" deprecated="2018-03-15" content_hash_code="115714668" file_path=""/> + <item id="cryptauth_enrollment_flow_finish" added_in_milestone="62" hash_code="54836939" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="17060642" file_path=""/> + <item id="cryptauth_enrollment_flow_setup" added_in_milestone="62" hash_code="84889397" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="128348931" file_path=""/> + <item id="cryptauth_find_eligible_for_promotion" added_in_milestone="62" hash_code="20053290" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="93687383" file_path=""/> + <item id="cryptauth_find_eligible_unlock_devices" added_in_milestone="62" hash_code="120000562" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="46773475" file_path=""/> + <item id="cryptauth_get_my_devices" added_in_milestone="62" hash_code="136498680" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="73842435" file_path=""/> + <item id="cryptauth_toggle_easyunlock" added_in_milestone="62" hash_code="25204343" type="1" second_id="29188932" deprecated="2018-04-04" content_hash_code="13570943" file_path=""/> + <item id="data_reduction_proxy_config" added_in_milestone="62" hash_code="485305" type="0" content_hash_code="134075813" os_list="linux,windows" file_path="components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.cc"/> + <item id="data_reduction_proxy_pingback" added_in_milestone="62" hash_code="68561428" type="0" deprecated="2019-09-17" content_hash_code="78407792" file_path=""/> + <item id="data_reduction_proxy_secure_proxy_check" added_in_milestone="62" hash_code="131236802" type="0" deprecated="2020-03-13" content_hash_code="122297136" file_path=""/> + <item id="data_reduction_proxy_warmup" added_in_milestone="62" hash_code="8250451" type="0" deprecated="2020-03-13" content_hash_code="6321249" file_path=""/> + <item id="desktop_ios_promotion" added_in_milestone="63" hash_code="13694792" type="0" deprecated="2018-11-04" content_hash_code="19776951" file_path=""/> + <item id="device_geolocation_request" added_in_milestone="62" hash_code="77673751" type="0" deprecated="2017-10-20" content_hash_code="97181773" file_path=""/> + <item id="device_management_service" added_in_milestone="62" hash_code="117782019" type="0" content_hash_code="104419970" os_list="linux,windows" file_path="components/policy/core/common/cloud/device_management_service.cc"/> + <item id="devtools_free_data_source" added_in_milestone="62" hash_code="22774132" type="0" content_hash_code="35733000" os_list="linux,windows" file_path="chrome/browser/ui/webui/devtools_ui_data_source.cc"/> + <item id="devtools_handle_front_end_messages" added_in_milestone="62" hash_code="135636011" type="0" content_hash_code="76808593" os_list="linux,windows" file_path="content/shell/browser/shell_devtools_bindings.cc"/> + <item id="devtools_hard_coded_data_source" added_in_milestone="62" hash_code="111565057" type="0" content_hash_code="75183720" os_list="linux,windows" file_path="chrome/browser/ui/webui/devtools_ui_data_source.cc"/> + <item id="devtools_http_handler" added_in_milestone="66" hash_code="49160454" type="0" content_hash_code="88414393" os_list="linux,windows" file_path="content/browser/devtools/devtools_http_handler.cc"/> + <item id="devtools_interceptor" added_in_milestone="62" hash_code="98123737" type="0" deprecated="2019-07-31" content_hash_code="64591843" file_path=""/> + <item id="devtools_network_resource" added_in_milestone="62" hash_code="129652775" type="0" content_hash_code="32810159" os_list="linux,windows" file_path="chrome/browser/devtools/devtools_ui_bindings.cc"/> + <item id="devtools_proxy_config" added_in_milestone="85" hash_code="79904729" type="0" content_hash_code="31996982" os_list="linux,windows" file_path="content/browser/devtools/protocol/target_handler.cc"/> + <item id="dial_get_app_info" added_in_milestone="65" hash_code="15952025" type="0" deprecated="2018-02-27" content_hash_code="90542080" file_path=""/> + <item id="dial_get_device_description" added_in_milestone="62" hash_code="50422598" type="0" deprecated="2018-02-27" content_hash_code="129827780" file_path=""/> + <item id="dial_url_fetcher" added_in_milestone="67" hash_code="41424546" type="0" content_hash_code="129828432" os_list="linux,windows" file_path="chrome/browser/media/router/discovery/dial/dial_url_fetcher.cc"/> + <item id="dns_over_https" added_in_milestone="66" hash_code="79895226" type="0" content_hash_code="45123510" os_list="linux,windows" file_path="net/dns/dns_transaction.cc"/> + <item id="dns_transaction" added_in_milestone="65" hash_code="79227717" type="0" content_hash_code="132206495" os_list="linux,windows" file_path="net/dns/dns_transaction.cc"/> + <item id="dom_distiller" added_in_milestone="62" hash_code="3989826" type="0" content_hash_code="106153970" os_list="linux,windows" file_path="components/dom_distiller/core/distiller_url_fetcher.cc"/> + <item id="domain_reliability_report_upload" added_in_milestone="62" hash_code="108804096" type="0" content_hash_code="35902036" os_list="linux,windows" file_path="components/domain_reliability/uploader.cc"/> + <item id="domain_security_policy" added_in_milestone="62" hash_code="77597059" type="0" content_hash_code="30916983" os_list="linux,windows" file_path="services/network/network_context.cc"/> + <item id="doodle_fetcher" added_in_milestone="62" hash_code="97199008" type="0" deprecated="2017-08-28" content_hash_code="87981692" file_path=""/> + <item id="doodle_service" added_in_milestone="62" hash_code="41154842" type="0" deprecated="2017-08-28" content_hash_code="28273962" file_path=""/> + <item id="download_internals_webui_source" added_in_milestone="66" hash_code="38670228" type="0" content_hash_code="129391056" os_list="linux,windows" file_path="chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc"/> + <item id="download_manager_resume" added_in_milestone="62" hash_code="35380758" type="0" content_hash_code="41227674" os_list="linux,windows" file_path="components/download/internal/common/download_item_impl.cc"/> + <item id="download_recovery_component" added_in_milestone="71" hash_code="131711536" type="0" content_hash_code="3243311" os_list="windows" file_path="chrome/chrome_cleaner/components/recovery_component.cc"/> + <item id="download_web_contents_frame" added_in_milestone="62" hash_code="56351037" type="0" content_hash_code="3657889" os_list="linux,windows" file_path="content/browser/web_contents/web_contents_impl.cc"/> + <item id="downloads_api_run_async" added_in_milestone="62" hash_code="121068967" type="0" content_hash_code="9280914" os_list="linux,windows" file_path="chrome/browser/extensions/api/downloads/downloads_api.cc"/> + <item id="downloads_dom_handler" added_in_milestone="73" hash_code="95951029" type="0" content_hash_code="137150731" os_list="linux,windows" file_path="chrome/browser/ui/webui/downloads/downloads_dom_handler.cc"/> + <item id="drag_download_file" added_in_milestone="62" hash_code="95910019" type="0" content_hash_code="126492858" os_list="linux,windows" file_path="content/browser/download/drag_download_file.cc"/> + <item id="enterprise_safe_browsing_realtime_url_lookup" added_in_milestone="86" hash_code="22262963" type="0" content_hash_code="14052810" os_list="linux,windows" file_path="chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.cc"/> + <item id="expect_ct_reporter" added_in_milestone="69" hash_code="57276415" type="0" deprecated="2018-06-20" content_hash_code="130492494" file_path="services/network/expect_ct_reporter.cc"/> + <item id="extension_blacklist" added_in_milestone="62" hash_code="59592717" type="0" content_hash_code="116742516" os_list="linux,windows" file_path="chrome/browser/extensions/blocklist_state_fetcher.cc"/> + <item id="extension_crx_fetcher" added_in_milestone="62" hash_code="21145003" type="0" content_hash_code="79150319" os_list="linux,windows" file_path="extensions/browser/updater/extension_downloader.cc"/> + <item id="extension_install_signer" added_in_milestone="62" hash_code="50464499" type="0" content_hash_code="106712014" os_list="linux,windows" file_path="chrome/browser/extensions/install_signer.cc"/> + <item id="extension_manifest_fetcher" added_in_milestone="62" hash_code="5151071" type="0" content_hash_code="93862569" os_list="linux,windows" file_path="extensions/browser/updater/extension_downloader.cc"/> + <item id="external_policy_fetcher" added_in_milestone="62" hash_code="9459438" type="0" content_hash_code="64260484" os_list="linux,windows" file_path="components/policy/core/common/cloud/external_policy_data_fetcher.cc"/> + <item id="family_info" added_in_milestone="62" hash_code="30913825" type="0" deprecated="2019-07-30" content_hash_code="25369370" file_path=""/> + <item id="favicon_loader" added_in_milestone="63" hash_code="112189210" type="0" content_hash_code="70773116" os_list="linux,windows" file_path="content/renderer/loader/web_url_loader_impl.cc"/> + <item id="feed_image_fetcher" added_in_milestone="68" hash_code="87439531" type="0" deprecated="2019-01-04" content_hash_code="26756208" file_path=""/> + <item id="floc_id_provider_impl" added_in_milestone="85" hash_code="103052331" type="1" second_id="13704791" content_hash_code="41421380" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="3" file_path="chrome/browser/federated_learning/floc_id_provider_impl.cc"/> + <item id="floc_remote_permission_service" added_in_milestone="85" hash_code="13704791" type="2" content_hash_code="86293622" os_list="linux,windows" semantics_fields="1,5" policy_fields="1,2,4" file_path="chrome/browser/federated_learning/floc_remote_permission_service.cc"/> + <item id="ftl_messaging_client_ack_messages" added_in_milestone="86" hash_code="55663676" type="0" content_hash_code="20913627" os_list="linux,windows" file_path="remoting/signaling/ftl_messaging_client.cc"/> + <item id="ftl_messaging_client_receive_messages" added_in_milestone="86" hash_code="136248372" type="0" content_hash_code="36609143" os_list="linux,windows" file_path="remoting/signaling/ftl_messaging_client.cc"/> + <item id="ftl_messaging_client_send_messages" added_in_milestone="86" hash_code="48924790" type="0" content_hash_code="6841587" os_list="linux,windows" file_path="remoting/signaling/ftl_messaging_client.cc"/> + <item id="ftl_registration_manager" added_in_milestone="86" hash_code="38256901" type="0" content_hash_code="12581281" os_list="linux,windows" file_path="remoting/signaling/ftl_registration_manager.cc"/> + <item id="gaia_auth_check_connection_info" added_in_milestone="62" hash_code="4598626" type="0" content_hash_code="57347000" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_auth_exchange_cookies" added_in_milestone="62" hash_code="134289752" type="0" deprecated="2018-09-11" content_hash_code="66433230" file_path=""/> + <item id="gaia_auth_exchange_device_id" added_in_milestone="62" hash_code="39877119" type="0" content_hash_code="61857947" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_auth_fetch_for_uber" added_in_milestone="62" hash_code="97978464" type="0" content_hash_code="28006265" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_auth_get_user_info" added_in_milestone="62" hash_code="82167736" type="0" content_hash_code="4695017" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_auth_list_accounts" added_in_milestone="62" hash_code="35565745" type="0" content_hash_code="93669150" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_auth_log_out" added_in_milestone="62" hash_code="116426676" type="0" content_hash_code="91154233" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_auth_login" added_in_milestone="62" hash_code="91597383" type="0" content_hash_code="111911548" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_auth_merge_sessions" added_in_milestone="62" hash_code="26216847" type="0" content_hash_code="30423843" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_auth_multilogin" added_in_milestone="70" hash_code="31445884" type="0" content_hash_code="77730858" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_auth_revoke_token" added_in_milestone="62" hash_code="133982351" type="0" content_hash_code="96665330" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_cookie_manager_external_cc_result" added_in_milestone="62" hash_code="4300475" type="0" content_hash_code="31188375" os_list="linux,windows" file_path="components/signin/internal/identity_manager/gaia_cookie_manager_service.cc"/> + <item id="gaia_create_reauth_proof_token_for_parent" added_in_milestone="80" hash_code="67750043" type="0" content_hash_code="103500636" os_list="linux,windows" file_path="google_apis/gaia/gaia_auth_fetcher.cc"/> + <item id="gaia_oauth_client_get_token_info" added_in_milestone="62" hash_code="32585152" type="0" content_hash_code="128143346" os_list="linux,windows" file_path="google_apis/gaia/gaia_oauth_client.cc"/> + <item id="gaia_oauth_client_get_tokens" added_in_milestone="62" hash_code="5637379" type="0" content_hash_code="12099176" os_list="linux,windows" file_path="google_apis/gaia/gaia_oauth_client.cc"/> + <item id="gaia_oauth_client_get_user_info" added_in_milestone="62" hash_code="83476155" type="0" content_hash_code="35159007" os_list="linux,windows" file_path="google_apis/gaia/gaia_oauth_client.cc"/> + <item id="gaia_oauth_client_refresh_token" added_in_milestone="62" hash_code="82462683" type="0" content_hash_code="22305252" os_list="linux,windows" file_path="google_apis/gaia/gaia_oauth_client.cc"/> + <item id="gcd_rest_client" added_in_milestone="71" hash_code="105985951" type="0" deprecated="2018-10-17" content_hash_code="70710803" file_path="remoting/host/gcd_rest_client.cc"/> + <item id="gcm_channel_status_request" added_in_milestone="62" hash_code="18300705" type="0" deprecated="2020-01-24" content_hash_code="53862393" file_path=""/> + <item id="gcm_checkin" added_in_milestone="62" hash_code="65957842" type="0" content_hash_code="98259579" os_list="linux,windows" file_path="google_apis/gcm/engine/checkin_request.cc"/> + <item id="gcm_connection_factory" added_in_milestone="66" hash_code="29057242" type="0" content_hash_code="75279835" os_list="linux,windows" file_path="google_apis/gcm/engine/connection_factory_impl.cc"/> + <item id="gcm_registration" added_in_milestone="62" hash_code="61656965" type="0" content_hash_code="113670632" os_list="linux,windows" file_path="google_apis/gcm/engine/registration_request.cc"/> + <item id="gcm_subscription" added_in_milestone="62" hash_code="56434025" type="0" deprecated="2019-04-10" content_hash_code="61632174" file_path=""/> + <item id="gcm_unregistration" added_in_milestone="62" hash_code="119542033" type="0" content_hash_code="30144127" os_list="linux,windows" file_path="google_apis/gcm/engine/unregistration_request.cc"/> + <item id="geo_language_provider" added_in_milestone="65" hash_code="52821843" type="1" second_id="96590038" content_hash_code="65327456" os_list="linux,windows" semantics_fields="1" policy_fields="3,4" file_path="components/language/content/browser/geo_language_provider.cc"/> + <item id="google_url_tracker" added_in_milestone="62" hash_code="5492492" type="0" deprecated="2019-08-01" content_hash_code="54474899" file_path=""/> + <item id="gstatic_change_password_override_urls" added_in_milestone="86" hash_code="135799714" type="0" content_hash_code="133151871" os_list="linux,windows" file_path="components/password_manager/core/browser/change_password_url_service_impl.cc"/> + <item id="headless_url_request" added_in_milestone="62" hash_code="29865866" type="0" deprecated="2018-07-10" content_hash_code="76700151" file_path=""/> + <item id="heartbeat_sender" added_in_milestone="86" hash_code="4883150" type="0" content_hash_code="131927805" os_list="linux,windows" file_path="remoting/host/heartbeat_sender.cc"/> + <item id="hintsfetcher_gethintsrequest" added_in_milestone="75" hash_code="34557599" type="0" content_hash_code="57003380" os_list="linux,windows" file_path="components/optimization_guide/hints_fetcher.cc"/> + <item id="history_notice_utils_notice" added_in_milestone="62" hash_code="102595701" type="1" second_id="110307337" content_hash_code="130829410" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc"/> + <item id="history_notice_utils_popup" added_in_milestone="62" hash_code="80832574" type="1" second_id="110307337" content_hash_code="30618510" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/history_notice_utils.cc"/> + <item id="history_ui_favicon_request_handler_get_favicon" added_in_milestone="77" hash_code="17562717" type="0" content_hash_code="64054629" os_list="linux,windows" file_path="components/favicon/core/history_ui_favicon_request_handler_impl.cc"/> + <item id="http_server_error_response" added_in_milestone="66" hash_code="32197336" type="0" content_hash_code="61082230" os_list="linux,windows" file_path="net/server/http_server.cc"/> + <item id="https_server_previews_navigation" added_in_milestone="74" hash_code="35725390" type="0" deprecated="2020-04-23" content_hash_code="84423109" file_path="chrome/browser/previews/previews_lite_page_redirect_serving_url_loader.cc"/> + <item id="ice_config_fetcher" added_in_milestone="81" hash_code="137093034" type="0" content_hash_code="60051202" os_list="linux,windows" file_path="chrome/browser/sharing/webrtc/ice_config_fetcher.cc"/> + <item id="icon_cacher" added_in_milestone="62" hash_code="103133150" type="0" content_hash_code="116368348" os_list="linux,windows" file_path="components/ntp_tiles/icon_cacher_impl.cc"/> + <item id="icon_catcher_get_large_icon" added_in_milestone="62" hash_code="44494884" type="0" content_hash_code="98262037" os_list="linux,windows" file_path="components/ntp_tiles/icon_cacher_impl.cc"/> + <item id="image_annotation" added_in_milestone="73" hash_code="107881858" type="0" content_hash_code="76229990" os_list="linux,windows" file_path="services/image_annotation/annotator.cc"/> + <item id="indexed_db_internals_handler" added_in_milestone="62" hash_code="131180348" type="0" content_hash_code="59026406" os_list="linux,windows" file_path="content/browser/indexed_db/indexed_db_internals_ui.cc"/> + <item id="interest_feed_send" added_in_milestone="67" hash_code="76717919" type="0" content_hash_code="6240898" os_list="linux,windows" file_path="components/feed/core/feed_networking_host.cc"/> + <item id="interest_feedv2_image_send" added_in_milestone="86" hash_code="92245202" type="0" content_hash_code="107508312" os_list="linux,windows" file_path="components/feed/core/v2/image_fetcher.cc"/> + <item id="interest_feedv2_send" added_in_milestone="83" hash_code="85742023" type="0" content_hash_code="49706671" os_list="linux,windows" file_path="components/feed/core/v2/feed_network_impl.cc"/> + <item id="intranet_redirect_detector" added_in_milestone="62" hash_code="21785164" type="0" content_hash_code="62025595" os_list="linux,windows" file_path="chrome/browser/intranet_redirect_detector.cc"/> + <item id="invalidation_service" added_in_milestone="62" hash_code="72354423" type="0" deprecated="2020-01-23" content_hash_code="78425687" file_path=""/> + <item id="isolated_prerender_canary_check" added_in_milestone="85" hash_code="60914954" type="0" content_hash_code="2991117" os_list="linux,windows" file_path="chrome/browser/prerender/isolated/isolated_prerender_origin_prober.cc"/> + <item id="isolated_prerender_loader" added_in_milestone="81" hash_code="2181152" type="0" content_hash_code="113933667" os_list="linux,windows" file_path="chrome/browser/prerender/isolated/isolated_prerender_url_loader.cc"/> + <item id="isolated_prerender_probe" added_in_milestone="83" hash_code="115160522" type="0" content_hash_code="75211055" os_list="linux,windows" file_path="chrome/browser/prerender/isolated/isolated_prerender_origin_prober.cc"/> + <item id="javascript_report_error" added_in_milestone="87" hash_code="109607776" type="0" content_hash_code="30837893" os_list="linux,windows" file_path="components/crash/content/browser/error_reporting/send_javascript_error_report.cc"/> + <item id="kaleidoscope_service" added_in_milestone="87" hash_code="49759694" type="0" content_hash_code="14307563" os_list="linux,windows" file_path="chrome/browser/media/kaleidoscope/kaleidoscope_service.cc"/> + <item id="kids_chrome_management_client_classify_url" added_in_milestone="77" hash_code="109987793" type="0" deprecated="2019-07-30" content_hash_code="112740597" file_path=""/> + <item id="lib_address_input" added_in_milestone="62" hash_code="50816767" type="0" content_hash_code="57977576" os_list="linux,windows" file_path="third_party/libaddressinput/chromium/chrome_metadata_source.cc"/> + <item id="load_autofill_gstatic_data" added_in_milestone="78" hash_code="119416099" type="0" content_hash_code="8433621" os_list="linux,windows" file_path="chrome/browser/autofill/autofill_gstatic_reader.cc"/> + <item id="logo_service" added_in_milestone="73" hash_code="35473769" type="0" content_hash_code="20271299" os_list="linux,windows" file_path="components/search_provider_logos/logo_service_impl.cc"/> + <item id="logo_tracker" added_in_milestone="62" hash_code="36859107" type="0" deprecated="2018-12-07" content_hash_code="67588075" file_path=""/> + <item id="lookup_single_password_leak" added_in_milestone="78" hash_code="16927377" type="0" content_hash_code="12158296" os_list="linux,windows" file_path="components/password_manager/core/browser/leak_detection/leak_detection_request.cc"/> + <item id="media_feeds" added_in_milestone="83" hash_code="116778918" type="0" content_hash_code="48909601" os_list="linux,windows" file_path="chrome/browser/media/feeds/media_feeds_fetcher.cc"/> + <item id="media_feeds_checker" added_in_milestone="84" hash_code="107707089" type="0" content_hash_code="125348528" os_list="linux,windows" file_path="chrome/browser/media/feeds/media_feeds_service.cc"/> + <item id="media_router_global_media_controls_image" added_in_milestone="81" hash_code="95983790" type="0" content_hash_code="48851217" os_list="linux,windows" file_path="chrome/browser/ui/global_media_controls/cast_media_notification_item.cc"/> + <item id="metrics_report_ukm" added_in_milestone="62" hash_code="727478" type="0" content_hash_code="8746987" os_list="linux,windows" file_path="components/metrics/net/net_metrics_log_uploader.cc"/> + <item id="metrics_report_uma" added_in_milestone="62" hash_code="727528" type="0" content_hash_code="10176197" os_list="linux,windows" file_path="components/metrics/net/net_metrics_log_uploader.cc"/> + <item id="mirroring_get_setup_info" added_in_milestone="68" hash_code="78447809" type="0" content_hash_code="64839410" os_list="windows,linux" file_path="components/mirroring/service/receiver_setup_querier.cc"/> + <item id="missing" added_in_milestone="62" hash_code="77012883" type="0" reserved="1" os_list="linux,windows" file_path=""/> + <item id="mojo_context_state" added_in_milestone="63" hash_code="93232258" type="0" deprecated="2017-10-20" content_hash_code="124821232" file_path=""/> + <item id="navigation_predictor_srp_prefetch" added_in_milestone="81" hash_code="57773453" type="0" content_hash_code="38811322" os_list="linux,windows" file_path="chrome/browser/prerender/isolated/isolated_prerender_tab_helper.cc"/> + <item id="navigation_url_loader" added_in_milestone="62" hash_code="63171670" type="0" content_hash_code="129352907" os_list="linux,windows" file_path="content/browser/loader/navigation_url_loader_impl.cc"/> + <item id="nearby_share_contacts" added_in_milestone="86" hash_code="91999155" type="1" second_id="29188932" content_hash_code="74684570" os_list="linux,windows" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc"/> + <item id="nearby_share_list_public_certificates" added_in_milestone="86" hash_code="123714070" type="1" second_id="29188932" content_hash_code="24145546" os_list="linux,windows" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc"/> + <item id="nearby_share_update_device" added_in_milestone="86" hash_code="30656793" type="1" second_id="29188932" content_hash_code="30624346" os_list="linux,windows" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc"/> + <item id="nearby_webrtc_connection" added_in_milestone="86" hash_code="37994740" type="0" content_hash_code="118366066" os_list="linux,windows" file_path="chrome/services/sharing/nearby/platform_v2/webrtc.cc"/> + <item id="net_error_helper" added_in_milestone="63" hash_code="60071001" type="0" deprecated="2020-07-10" content_hash_code="68322861" file_path=""/> + <item id="network_location_provider" added_in_milestone="64" hash_code="23472048" type="1" second_id="96590038" content_hash_code="41087976" os_list="linux,windows" semantics_fields="1" policy_fields="3,4" file_path="services/device/geolocation/network_location_provider.cc"/> + <item id="network_location_request" added_in_milestone="65" hash_code="96590038" type="2" content_hash_code="80741011" os_list="linux,windows" semantics_fields="2,3,4,5" policy_fields="-1" file_path="services/device/geolocation/network_location_request.cc"/> + <item id="network_time_component" added_in_milestone="62" hash_code="46188932" type="0" content_hash_code="28051857" os_list="linux,windows" file_path="components/network_time/network_time_tracker.cc"/> + <item id="new_tab_page_handler" added_in_milestone="84" hash_code="48673144" type="0" content_hash_code="49174657" os_list="linux,windows" file_path="chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc"/> + <item id="notification_client" added_in_milestone="79" hash_code="78479125" type="0" content_hash_code="129874070" os_list="linux,windows" file_path="remoting/client/notification/notification_client.cc"/> + <item id="ntp_contextual_suggestions_fetch" added_in_milestone="62" hash_code="95711309" type="0" deprecated="2019-04-18" content_hash_code="107035434" file_path=""/> + <item id="ntp_custom_background" added_in_milestone="76" hash_code="92125886" type="0" content_hash_code="61176452" os_list="linux,windows" file_path="chrome/browser/search/instant_service.cc"/> + <item id="ntp_custom_link_checker_request" added_in_milestone="71" hash_code="78408551" type="0" deprecated="2018-10-26" content_hash_code="13407730" file_path=""/> + <item id="ntp_icon_source" added_in_milestone="69" hash_code="29197139" type="0" content_hash_code="16399294" os_list="linux,windows" file_path="chrome/browser/search/ntp_icon_source.cc"/> + <item id="ntp_snippets_fetch" added_in_milestone="62" hash_code="15418154" type="0" content_hash_code="10078959" os_list="linux,windows" file_path="components/ntp_snippets/remote/json_request.cc"/> + <item id="nux_ntp_background_preview" added_in_milestone="74" hash_code="124847649" type="0" content_hash_code="31404656" os_list="linux,windows" file_path="chrome/browser/ui/webui/welcome/ntp_background_fetcher.cc"/> + <item id="oauth2_access_token_fetcher" added_in_milestone="62" hash_code="27915688" type="0" content_hash_code="33501872" os_list="linux,windows" file_path="google_apis/gaia/oauth2_access_token_fetcher_impl.cc"/> + <item id="oauth2_api_call_flow" added_in_milestone="65" hash_code="29188932" type="2" content_hash_code="108831236" os_list="linux,windows" policy_fields="-1" file_path="google_apis/gaia/oauth2_api_call_flow.cc"/> + <item id="oauth2_mint_token_flow" added_in_milestone="62" hash_code="1112842" type="1" second_id="29188932" content_hash_code="91581432" os_list="linux,windows" semantics_fields="1,2,3,4,5" policy_fields="3,4" file_path="google_apis/gaia/oauth2_mint_token_flow.cc"/> + <item id="ocsp_start_url_loader" added_in_milestone="81" hash_code="3646641" type="0" deprecated="2020-04-28" content_hash_code="106270072" file_path=""/> + <item id="ocsp_start_url_request" added_in_milestone="62" hash_code="60921996" type="0" deprecated="2020-04-28" content_hash_code="6288676" file_path=""/> + <item id="offline_prefetch" added_in_milestone="62" hash_code="19185953" type="0" content_hash_code="112039446" os_list="linux,windows" file_path="components/offline_pages/core/prefetch/prefetch_request_fetcher.cc"/> + <item id="omnibox_documentsuggest" added_in_milestone="69" hash_code="6055066" type="0" content_hash_code="126973249" os_list="linux,windows" file_path="components/omnibox/browser/document_suggestions_service.cc"/> + <item id="omnibox_navigation_observer" added_in_milestone="62" hash_code="61684939" type="0" content_hash_code="70941231" os_list="linux,windows" file_path="chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc"/> + <item id="omnibox_result_change" added_in_milestone="62" hash_code="73107389" type="0" content_hash_code="24802647" os_list="linux,windows" file_path="chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc"/> + <item id="omnibox_suggest" added_in_milestone="62" hash_code="47815025" type="0" content_hash_code="86297726" os_list="linux,windows" file_path="components/omnibox/browser/search_provider.cc"/> + <item id="omnibox_suggest_deletion" added_in_milestone="62" hash_code="84212388" type="0" content_hash_code="24981550" os_list="linux,windows" file_path="components/omnibox/browser/base_search_provider.cc"/> + <item id="omnibox_zerosuggest" added_in_milestone="62" hash_code="7687691" type="0" content_hash_code="119419625" os_list="linux,windows" file_path="components/omnibox/browser/remote_suggestions_service.cc"/> + <item id="one_google_bar_service" added_in_milestone="62" hash_code="78917933" type="0" content_hash_code="46527252" os_list="linux,windows" file_path="chrome/browser/search/one_google_bar/one_google_bar_loader_impl.cc"/> + <item id="open_screen_message" added_in_milestone="78" hash_code="95250780" type="0" deprecated="2020-02-13" content_hash_code="39027953" file_path=""/> + <item id="open_screen_tls_message" added_in_milestone="80" hash_code="61695471" type="0" deprecated="2020-02-13" content_hash_code="28355565" file_path=""/> + <item id="open_search" added_in_milestone="62" hash_code="107267424" type="0" content_hash_code="83025542" os_list="linux,windows" file_path="components/search_engines/template_url_fetcher.cc"/> + <item id="openscreen_message" added_in_milestone="83" hash_code="23036184" type="0" content_hash_code="124395439" os_list="linux,windows" file_path="components/openscreen_platform/udp_socket.cc"/> + <item id="openscreen_tls_message" added_in_milestone="83" hash_code="40127335" type="0" content_hash_code="15991338" os_list="linux,windows" file_path="components/openscreen_platform/tls_connection_factory.cc"/> + <item id="optimization_guide_model" added_in_milestone="79" hash_code="106373593" type="0" content_hash_code="32403047" os_list="linux,windows" file_path="chrome/browser/optimization_guide/prediction/prediction_model_fetcher.cc"/> + <item id="origin_policy_loader" added_in_milestone="69" hash_code="6483617" type="0" content_hash_code="134028975" os_list="linux,windows" file_path="services/network/origin_policy/origin_policy_fetcher.cc"/> + <item id="parallel_download_job" added_in_milestone="62" hash_code="135118587" type="0" content_hash_code="105330419" os_list="linux,windows" file_path="components/download/internal/common/parallel_download_job.cc"/> + <item id="password_protection_request" added_in_milestone="62" hash_code="66322287" type="0" content_hash_code="25596947" os_list="linux,windows" file_path="components/safe_browsing/content/password_protection/password_protection_request.cc"/> + <item id="password_requirements_spec_fetch" added_in_milestone="69" hash_code="69585116" type="0" content_hash_code="5591260" os_list="linux,windows" file_path="components/password_manager/core/browser/generation/password_requirements_spec_fetcher_impl.cc"/> + <item id="payment_instrument_icon_fetcher" added_in_milestone="62" hash_code="73309970" type="0" deprecated="2017-09-16" content_hash_code="84709873" file_path=""/> + <item id="payment_manifest_downloader" added_in_milestone="62" hash_code="84045030" type="0" content_hash_code="19293316" os_list="linux,windows" file_path="components/payments/core/payment_manifest_downloader.cc"/> + <item id="payments_sync_cards" added_in_milestone="62" hash_code="95588446" type="0" content_hash_code="56526513" os_list="linux,windows" file_path="components/autofill/core/browser/payments/payments_client.cc"/> + <item id="pdf_plugin_placeholder" added_in_milestone="63" hash_code="56866367" type="0" content_hash_code="16907221" os_list="linux,windows" file_path="chrome/browser/plugins/pdf_plugin_placeholder_observer.cc"/> + <item id="pepper_tcp_socket" added_in_milestone="65" hash_code="120623198" type="0" content_hash_code="27489892" os_list="linux,windows" file_path="content/browser/renderer_host/pepper/pepper_socket_utils.cc"/> + <item id="pepper_udp_socket" added_in_milestone="70" hash_code="53512439" type="0" content_hash_code="7268418" os_list="linux,windows" file_path="content/browser/renderer_host/pepper/pepper_socket_utils.cc"/> + <item id="per_user_topic_registration_request" added_in_milestone="68" hash_code="10498172" type="0" content_hash_code="57098847" os_list="linux,windows" file_path="components/invalidation/impl/per_user_topic_subscription_request.cc"/> + <item id="permission_reporting" added_in_milestone="62" hash_code="131741641" type="0" deprecated="2018-03-06" content_hash_code="7213535" file_path=""/> + <item id="permission_request_creator" added_in_milestone="62" hash_code="43206794" type="0" deprecated="2019-07-30" content_hash_code="73571699" file_path=""/> + <item id="persist_blob_to_indexed_db" added_in_milestone="62" hash_code="32030464" type="0" deprecated="2018-08-13" content_hash_code="35410079" file_path=""/> + <item id="plugins_resource_service" added_in_milestone="62" hash_code="49601082" type="0" content_hash_code="6877335" os_list="linux,windows" file_path="chrome/browser/plugins/plugins_resource_service.cc"/> + <item id="policy_blacklist_service" added_in_milestone="70" hash_code="49799644" type="0" content_hash_code="57843386" os_list="linux,windows" file_path="components/policy/content/policy_blocklist_service.cc"/> + <item id="popular_sites_fetch" added_in_milestone="62" hash_code="50755044" type="0" content_hash_code="6910083" os_list="linux,windows" file_path="components/ntp_tiles/popular_sites_impl.cc"/> + <item id="port_forwarding_controller_socket" added_in_milestone="65" hash_code="95075845" type="0" content_hash_code="122163428" os_list="linux,windows" file_path="chrome/browser/devtools/device/port_forwarding_controller.cc"/> + <item id="ppapi_download_request" added_in_milestone="62" hash_code="135967426" type="0" content_hash_code="110461402" os_list="linux,windows" file_path="chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc"/> + <item id="predictive_prefetch" added_in_milestone="85" hash_code="72157052" type="0" content_hash_code="69511160" os_list="linux,windows" file_path="chrome/browser/predictors/prefetch_manager.cc"/> + <item id="prefetch_download" added_in_milestone="62" hash_code="44583172" type="0" content_hash_code="21424542" os_list="linux,windows" file_path="components/offline_pages/core/prefetch/prefetch_downloader_impl.cc"/> + <item id="prefetch_visuals" added_in_milestone="75" hash_code="91068704" type="0" content_hash_code="90439946" os_list="linux,windows" file_path="components/offline_pages/core/prefetch/visuals_fetch_by_url.cc"/> + <item id="previews_litepage_origin_prober" added_in_milestone="78" hash_code="33703614" type="0" deprecated="2020-04-23" content_hash_code="116235355" file_path="chrome/browser/previews/previews_lite_page_redirect_url_loader.cc"/> + <item id="previews_litepage_prober" added_in_milestone="78" hash_code="33813109" type="0" deprecated="2020-04-23" content_hash_code="52572789" file_path="chrome/browser/previews/previews_lite_page_redirect_decider.cc"/> + <item id="previews_prober" added_in_milestone="77" hash_code="41010697" type="0" deprecated="2019-07-24" content_hash_code="51581107" file_path=""/> + <item id="printer_job_handler" added_in_milestone="62" hash_code="67638271" type="1" second_id="111712433" content_hash_code="75712693" os_list="linux,windows" semantics_fields="2,3,4" file_path="chrome/service/cloud_print/printer_job_handler.cc"/> + <item id="privet_http_impl" added_in_milestone="62" hash_code="71251498" type="0" content_hash_code="107348604" os_list="linux,windows" file_path="chrome/browser/printing/cloud_print/privet_http_impl.cc"/> + <item id="profile_avatar" added_in_milestone="62" hash_code="51164680" type="0" content_hash_code="113550845" os_list="linux,windows" file_path="chrome/browser/profiles/profile_avatar_downloader.cc"/> + <item id="profile_resetter_upload" added_in_milestone="62" hash_code="105330607" type="0" content_hash_code="129329171" os_list="linux,windows" file_path="chrome/browser/profile_resetter/reset_report_uploader.cc"/> + <item id="promo_service" added_in_milestone="72" hash_code="67052219" type="0" content_hash_code="32939033" os_list="linux,windows" file_path="chrome/browser/search/promos/promo_service.cc"/> + <item id="proxy_config_direct" added_in_milestone="67" hash_code="119015679" type="0" content_hash_code="119931568" os_list="linux,windows" file_path="net/proxy_resolution/proxy_config_with_annotation.cc"/> + <item id="proxy_config_headless" added_in_milestone="67" hash_code="133221587" type="0" content_hash_code="77459277" os_list="linux,windows" file_path="headless/lib/browser/headless_request_context_manager.cc"/> + <item id="proxy_config_settings" added_in_milestone="67" hash_code="136468456" type="0" content_hash_code="19527377" os_list="linux,windows" file_path="components/proxy_config/pref_proxy_config_tracker_impl.cc"/> + <item id="proxy_config_system" added_in_milestone="67" hash_code="11258689" type="0" content_hash_code="77057929" os_list="linux,windows" file_path="net/proxy_resolution/configured_proxy_resolution_service.cc"/> + <item id="proxy_config_windows_resolver" added_in_milestone="86" hash_code="13924805" type="0" content_hash_code="123023599" os_list="windows" file_path="net/proxy_resolution/win/windows_system_proxy_resolution_request.cc"/> + <item id="proxy_script_fetcher" added_in_milestone="62" hash_code="37531401" type="0" deprecated="2018-03-16" content_hash_code="31866133" file_path=""/> + <item id="puch_client_channel" added_in_milestone="67" hash_code="34459548" type="0" deprecated="2020-01-23" content_hash_code="92475475" file_path=""/> + <item id="qr_code_save" added_in_milestone="84" hash_code="87963126" type="0" content_hash_code="72717245" os_list="linux,windows" file_path="chrome/browser/ui/views/qrcode_generator/qrcode_generator_bubble.cc"/> + <item id="query_tiles_fetcher" added_in_milestone="84" hash_code="10243490" type="0" content_hash_code="16824373" os_list="linux,windows" file_path="components/query_tiles/internal/tile_fetcher.cc"/> + <item id="query_tiles_image_loader" added_in_milestone="83" hash_code="95103115" type="0" content_hash_code="75070538" os_list="linux,windows" file_path="components/query_tiles/internal/cached_image_loader.cc"/> + <item id="quic_chromium_incoming_pending_session" added_in_milestone="73" hash_code="120830730" type="0" content_hash_code="52904665" os_list="linux,windows" file_path="net/quic/quic_chromium_client_session.cc"/> + <item id="quic_chromium_incoming_session" added_in_milestone="66" hash_code="87635401" type="0" content_hash_code="78573093" os_list="linux,windows" file_path="net/quic/quic_chromium_client_session.cc"/> + <item id="quic_chromium_packet_writer" added_in_milestone="66" hash_code="20153177" type="0" content_hash_code="29657765" os_list="linux,windows" file_path="net/quic/quic_chromium_packet_writer.cc"/> + <item id="ranker_url_fetcher" added_in_milestone="62" hash_code="95682324" type="0" content_hash_code="45958626" os_list="linux,windows" file_path="components/assist_ranker/ranker_url_fetcher.cc"/> + <item id="rappor_report" added_in_milestone="62" hash_code="44606780" type="0" content_hash_code="111287826" os_list="linux,windows" file_path="components/rappor/log_uploader.cc"/> + <item id="receive_messages_express" added_in_milestone="85" hash_code="29506140" type="0" content_hash_code="38581365" os_list="linux,windows" file_path="chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc"/> + <item id="refresh_token_annotation_request" added_in_milestone="62" hash_code="7433837" type="1" second_id="29188932" deprecated="2018-01-17" content_hash_code="137103383" file_path=""/> + <item id="remote_copy_message_handler" added_in_milestone="80" hash_code="80255301" type="0" content_hash_code="117673331" os_list="linux,windows" file_path="chrome/browser/sharing/shared_clipboard/remote_copy_message_handler.cc"/> + <item id="remote_suggestions_provider" added_in_milestone="62" hash_code="49544361" type="0" content_hash_code="126329742" os_list="linux,windows" file_path="components/ntp_snippets/remote/cached_image_fetcher.cc"/> + <item id="remoting_directory_delete_host" added_in_milestone="86" hash_code="89093734" type="0" content_hash_code="65893931" os_list="linux,windows" file_path="remoting/base/directory_service_client.cc"/> + <item id="remoting_directory_get_host_list" added_in_milestone="86" hash_code="93434368" type="0" content_hash_code="59980448" os_list="linux,windows" file_path="remoting/base/directory_service_client.cc"/> + <item id="remoting_directory_register_host" added_in_milestone="86" hash_code="117688925" type="0" content_hash_code="74224493" os_list="linux,windows" file_path="remoting/base/directory_service_client.cc"/> + <item id="remoting_ice_config_request" added_in_milestone="86" hash_code="88945310" type="0" content_hash_code="94742293" os_list="linux,windows" file_path="remoting/protocol/remoting_ice_config_request.cc"/> + <item id="remoting_log_to_server" added_in_milestone="86" hash_code="99742369" type="0" content_hash_code="117118166" os_list="linux,windows" file_path="remoting/signaling/remoting_log_to_server.cc"/> + <item id="remoting_register_support_host_request" added_in_milestone="86" hash_code="67117364" type="0" content_hash_code="15955284" os_list="linux,windows" file_path="remoting/host/remoting_register_support_host_request.cc"/> + <item id="remoting_telemetry_log_writer" added_in_milestone="86" hash_code="107268760" type="0" content_hash_code="81741595" os_list="linux,windows" file_path="remoting/base/telemetry_log_writer.cc"/> + <item id="render_view_context_menu" added_in_milestone="62" hash_code="25844439" type="0" content_hash_code="69471170" os_list="linux,windows" file_path="chrome/browser/renderer_context_menu/render_view_context_menu.cc"/> + <item id="renderer_initiated_download" added_in_milestone="62" hash_code="116443055" type="0" content_hash_code="37846436" os_list="linux,windows" file_path="content/browser/renderer_host/render_frame_host_impl.cc"/> + <item id="reporting" added_in_milestone="62" hash_code="109891200" type="0" content_hash_code="125758928" os_list="linux,windows" file_path="net/reporting/reporting_uploader.cc"/> + <item id="resource_dispatcher_host" added_in_milestone="62" hash_code="81157007" type="0" deprecated="2019-07-30" content_hash_code="35725167" file_path=""/> + <item id="resource_prefetch" added_in_milestone="62" hash_code="110815970" type="0" deprecated="2018-02-28" content_hash_code="39251261" file_path=""/> + <item id="rlz_ping" added_in_milestone="63" hash_code="99279418" type="0" content_hash_code="102108802" os_list="windows" file_path="rlz/lib/financial_ping.cc"/> + <item id="safe_browsing_backup_request" added_in_milestone="62" hash_code="106980485" type="0" deprecated="2018-08-14" content_hash_code="101760679" file_path=""/> + <item id="safe_browsing_binary_upload" added_in_milestone="78" hash_code="71663319" type="0" content_hash_code="105913171" os_list="linux,windows" file_path="chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc"/> + <item id="safe_browsing_cache_collector" added_in_milestone="62" hash_code="115907811" type="0" content_hash_code="62296373" os_list="linux,windows" file_path="components/safe_browsing/content/browser/threat_details_cache.cc"/> + <item id="safe_browsing_certificate_error_reporting" added_in_milestone="62" hash_code="66590631" type="0" content_hash_code="26108454" os_list="linux,windows" file_path="chrome/browser/ssl/certificate_error_reporter.cc"/> + <item id="safe_browsing_chunk_backup_request" added_in_milestone="62" hash_code="79957943" type="0" deprecated="2018-08-14" content_hash_code="133850277" file_path=""/> + <item id="safe_browsing_client_side_malware_detector" added_in_milestone="62" hash_code="102935425" type="0" deprecated="2019-12-07" content_hash_code="79591279" file_path=""/> + <item id="safe_browsing_client_side_phishing_detector" added_in_milestone="62" hash_code="1313982" type="0" content_hash_code="50199143" os_list="linux,windows" file_path="chrome/browser/safe_browsing/client_side_detection_service.cc"/> + <item id="safe_browsing_extended_reporting" added_in_milestone="62" hash_code="42848942" type="0" content_hash_code="81193513" os_list="linux,windows" file_path="components/safe_browsing/core/ping_manager.cc"/> + <item id="safe_browsing_feedback" added_in_milestone="62" hash_code="44583821" type="0" content_hash_code="27116846" os_list="linux,windows" file_path="chrome/browser/safe_browsing/download_protection/download_feedback.cc"/> + <item id="safe_browsing_get_full_hash" added_in_milestone="62" hash_code="68745894" type="0" deprecated="2018-08-14" content_hash_code="21739198" file_path=""/> + <item id="safe_browsing_incident" added_in_milestone="62" hash_code="124950347" type="0" content_hash_code="7306531" os_list="linux,windows" file_path="chrome/browser/safe_browsing/incident_reporting/incident_report_uploader_impl.cc"/> + <item id="safe_browsing_module_loader" added_in_milestone="62" hash_code="6019475" type="0" content_hash_code="49511650" os_list="linux,windows" file_path="chrome/browser/safe_browsing/client_side_model_loader.cc"/> + <item id="safe_browsing_realtime_url_lookup" added_in_milestone="78" hash_code="119324658" type="0" content_hash_code="71236226" os_list="linux,windows" file_path="components/safe_browsing/core/realtime/url_lookup_service.cc"/> + <item id="safe_browsing_v4_get_hash" added_in_milestone="62" hash_code="8561691" type="0" content_hash_code="132435617" os_list="linux,windows" file_path="components/safe_browsing/core/db/v4_get_hash_protocol_manager.cc"/> + <item id="safe_browsing_v4_update" added_in_milestone="70" hash_code="82509217" type="0" content_hash_code="5247849" os_list="linux,windows" file_path="components/safe_browsing/core/db/v4_update_protocol_manager.cc"/> + <item id="safety_check_update_connectivity" added_in_milestone="84" hash_code="137724067" type="0" content_hash_code="30977369" os_list="linux,windows" file_path="components/safety_check/update_check_helper.cc"/> + <item id="sanitized_image_source" added_in_milestone="86" hash_code="36944304" type="0" content_hash_code="39770427" os_list="linux,windows" file_path="chrome/browser/ui/webui/sanitized_image_source.cc"/> + <item id="save_file_manager" added_in_milestone="62" hash_code="56275203" type="0" content_hash_code="56692339" os_list="linux,windows" file_path="content/browser/download/save_file_manager.cc"/> + <item id="sdch_dictionary_fetch" added_in_milestone="62" hash_code="47152935" type="0" deprecated="2017-09-16" content_hash_code="16764294" file_path=""/> + <item id="search_suggest_service" added_in_milestone="73" hash_code="57785193" type="0" content_hash_code="132247652" os_list="linux,windows" file_path="chrome/browser/search/search_suggest/search_suggest_loader_impl.cc"/> + <item id="security_key_socket" added_in_milestone="66" hash_code="31074955" type="0" content_hash_code="13741232" os_list="linux,windows" file_path="remoting/host/security_key/security_key_socket.cc"/> + <item id="send_message_express" added_in_milestone="85" hash_code="23527666" type="0" content_hash_code="96850228" os_list="linux,windows" file_path="chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc"/> + <item id="service_worker_navigation_preload" added_in_milestone="63" hash_code="129872904" type="0" content_hash_code="79473248" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_fetch_dispatcher.cc"/> + <item id="service_worker_update_checker" added_in_milestone="71" hash_code="130931413" type="0" content_hash_code="46608086" os_list="linux,windows" file_path="content/browser/service_worker/service_worker_single_script_update_checker.cc"/> + <item id="services_http_server_error_response" added_in_milestone="68" hash_code="59302801" type="0" content_hash_code="127774041" os_list="linux,windows" file_path="services/network/public/cpp/server/http_server.cc"/> + <item id="sigined_exchange_cert_fetcher" added_in_milestone="66" hash_code="79442849" type="0" content_hash_code="8138156" os_list="linux,windows" file_path="content/browser/web_package/signed_exchange_cert_fetcher.cc"/> + <item id="sigined_exchange_validity_pinger" added_in_milestone="75" hash_code="57114284" type="0" content_hash_code="119482488" os_list="linux,windows" file_path="content/browser/web_package/signed_exchange_validity_pinger.cc"/> + <item id="signed_in_profile_avatar" added_in_milestone="62" hash_code="108903331" type="0" content_hash_code="72850619" os_list="linux,windows" file_path="chrome/browser/profiles/profile_downloader.cc"/> + <item id="socket_bio_adapter" added_in_milestone="66" hash_code="516551" type="0" content_hash_code="21643352" os_list="linux,windows" file_path="net/socket/socket_bio_adapter.cc"/> + <item id="spdy_push_stream" added_in_milestone="67" hash_code="36915753" type="0" content_hash_code="69224629" os_list="linux,windows" file_path="net/spdy/spdy_session.cc"/> + <item id="spdy_session_control" added_in_milestone="66" hash_code="57143548" type="0" content_hash_code="29815792" os_list="linux,windows" file_path="net/spdy/spdy_session.cc"/> + <item id="speech_recognition_downstream" added_in_milestone="62" hash_code="26096088" type="0" content_hash_code="120733233" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc"/> + <item id="speech_recognition_upstream" added_in_milestone="62" hash_code="66846958" type="0" content_hash_code="7706219" os_list="linux,windows" file_path="content/browser/speech/speech_recognition_engine.cc"/> + <item id="spellcheck_hunspell_dictionary" added_in_milestone="62" hash_code="117649486" type="0" content_hash_code="45660952" os_list="linux,windows" file_path="chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc"/> + <item id="spellcheck_lookup" added_in_milestone="62" hash_code="132553989" type="0" content_hash_code="120395045" os_list="linux,windows" file_path="components/spellcheck/browser/spelling_service_client.cc"/> + <item id="ssl_hmac_channel_authenticator" added_in_milestone="66" hash_code="106124561" type="0" content_hash_code="110454877" os_list="linux,windows" file_path="remoting/protocol/ssl_hmac_channel_authenticator.cc"/> + <item id="ssl_name_mismatch_lookup" added_in_milestone="62" hash_code="114468207" type="0" content_hash_code="97619078" os_list="linux,windows" file_path="components/security_interstitials/content/common_name_mismatch_handler.cc"/> + <item id="stream_message_pipe_adapter" added_in_milestone="66" hash_code="71837756" type="0" content_hash_code="66212605" os_list="linux,windows" file_path="remoting/protocol/stream_message_pipe_adapter.cc"/> + <item id="stream_packet_socket" added_in_milestone="84" hash_code="38197513" type="0" content_hash_code="55116994" os_list="linux,windows" file_path="remoting/protocol/stream_packet_socket.cc"/> + <item id="suggestions_image_manager" added_in_milestone="62" hash_code="13211343" type="0" deprecated="2018-11-28" content_hash_code="36271280" file_path=""/> + <item id="suggestions_service" added_in_milestone="62" hash_code="35370363" type="0" content_hash_code="66296423" os_list="linux,windows" file_path="components/suggestions/suggestions_service_impl.cc"/> + <item id="supervised_user_refresh_token_fetcher" added_in_milestone="62" hash_code="136117054" type="0" deprecated="2018-04-18" content_hash_code="101636136" file_path=""/> + <item id="supervised_user_url_filter" added_in_milestone="62" hash_code="14257952" type="0" deprecated="2019-07-30" content_hash_code="30470003" file_path=""/> + <item id="supervised_users_blacklist" added_in_milestone="62" hash_code="78544924" type="0" deprecated="2019-07-30" content_hash_code="10924669" file_path=""/> + <item id="sync_attachment_downloader" added_in_milestone="62" hash_code="26372521" type="0" deprecated="2018-02-08" content_hash_code="70097603" file_path=""/> + <item id="sync_attachment_uploader" added_in_milestone="62" hash_code="132657055" type="0" deprecated="2018-02-08" content_hash_code="25152853" file_path=""/> + <item id="sync_file_system" added_in_milestone="62" hash_code="102819690" type="0" content_hash_code="52153962" os_list="linux,windows" file_path="chrome/browser/sync_file_system/drive_backend/sync_engine.cc"/> + <item id="sync_http_bridge" added_in_milestone="62" hash_code="57144960" type="0" content_hash_code="32868346" os_list="linux,windows" file_path="components/sync/engine/net/http_bridge.cc"/> + <item id="sync_stop_reporter" added_in_milestone="62" hash_code="5021348" type="0" content_hash_code="56902850" os_list="linux,windows" file_path="components/sync/driver/sync_stopped_reporter.cc"/> + <item id="test" added_in_milestone="62" hash_code="3556498" type="0" reserved="1" os_list="linux,windows" file_path=""/> + <item id="test_partial" added_in_milestone="62" hash_code="22096011" type="0" reserved="1" os_list="linux,windows" file_path=""/> + <item id="tethering_handler_socket" added_in_milestone="65" hash_code="113065062" type="0" content_hash_code="986296" os_list="linux,windows" file_path="content/browser/devtools/protocol/tethering_handler.cc"/> + <item id="thumbnail_source" added_in_milestone="62" hash_code="135251783" type="0" deprecated="2018-11-27" content_hash_code="31086298" file_path=""/> + <item id="translate_url_fetcher" added_in_milestone="62" hash_code="137116619" type="0" content_hash_code="104217506" os_list="linux,windows" file_path="components/translate/core/browser/translate_url_fetcher.cc"/> + <item id="ui_devtools_server" added_in_milestone="66" hash_code="4986170" type="0" content_hash_code="62670263" os_list="linux,windows" file_path="components/ui_devtools/devtools_server.cc"/> + <item id="undefined" added_in_milestone="62" hash_code="45578882" type="0" reserved="1" os_list="linux,windows" file_path=""/> + <item id="unwanted_software_report" added_in_milestone="70" hash_code="43759504" type="0" content_hash_code="59154788" os_list="windows" file_path="chrome/chrome_cleaner/logging/reporter_logging_service.cc"/> + <item id="update_client" added_in_milestone="74" hash_code="54845618" type="0" content_hash_code="86129031" os_list="linux,windows" file_path="components/update_client/net/network_impl.cc"/> + <item id="url_fetcher_downloader" added_in_milestone="62" hash_code="113231892" type="0" deprecated="2019-02-09" content_hash_code="61085066" file_path=""/> + <item id="url_prevision_fetcher" added_in_milestone="62" hash_code="118389509" type="0" content_hash_code="66145513" os_list="linux,windows" file_path="content/browser/media/url_provision_fetcher.cc"/> + <item id="user_info_fetcher" added_in_milestone="62" hash_code="22265491" type="0" content_hash_code="72016232" os_list="linux,windows" file_path="components/policy/core/common/cloud/user_info_fetcher.cc"/> + <item id="viz_devtools_server" added_in_milestone="72" hash_code="16292315" type="0" content_hash_code="70061664" os_list="linux,windows" file_path="components/ui_devtools/devtools_server.cc"/> + <item id="web_bundle_loader" added_in_milestone="84" hash_code="114615359" type="0" content_hash_code="57390734" os_list="linux,windows" file_path="content/browser/web_package/web_bundle_utils.cc"/> + <item id="web_history_counter" added_in_milestone="62" hash_code="137457845" type="1" second_id="110307337" content_hash_code="49663381" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/browsing_data/core/counters/history_counter.cc"/> + <item id="web_history_delete_url" added_in_milestone="74" hash_code="41749213" type="1" second_id="110307337" content_hash_code="25943026" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc"/> + <item id="web_history_expire" added_in_milestone="62" hash_code="60946824" type="1" second_id="110307337" content_hash_code="92626030" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc"/> + <item id="web_history_expire_between_dates" added_in_milestone="62" hash_code="126122632" type="1" second_id="110307337" content_hash_code="34304787" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/history_service.cc"/> + <item id="web_history_query" added_in_milestone="62" hash_code="17400350" type="1" second_id="110307337" content_hash_code="36075147" os_list="linux,windows" semantics_fields="2,3,4" policy_fields="4" file_path="components/history/core/browser/browsing_history_service.cc"/> + <item id="web_history_service" added_in_milestone="65" hash_code="110307337" type="2" content_hash_code="16140045" os_list="linux,windows" semantics_fields="1,5" policy_fields="-1,3" file_path="components/history/core/browser/web_history_service.cc"/> + <item id="web_push_message" added_in_milestone="77" hash_code="39886742" type="0" content_hash_code="110064650" os_list="linux,windows" file_path="chrome/browser/sharing/web_push/web_push_sender.cc"/> + <item id="webrtc_event_log_uploader" added_in_milestone="67" hash_code="24186190" type="0" content_hash_code="11005245" os_list="linux,windows" file_path="chrome/browser/media/webrtc/webrtc_event_log_uploader.cc"/> + <item id="webrtc_log_upload" added_in_milestone="62" hash_code="62443804" type="0" content_hash_code="33661169" os_list="linux,windows" file_path="chrome/browser/media/webrtc/webrtc_log_uploader.cc"/> + <item id="webrtc_peer_connection" added_in_milestone="66" hash_code="63497370" type="0" content_hash_code="60553259" os_list="linux,windows" file_path="third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc"/> + <item id="websocket_basic_stream" added_in_milestone="66" hash_code="51586722" type="0" content_hash_code="68121427" os_list="linux,windows" file_path="net/websockets/websocket_basic_stream.cc"/> + <item id="websocket_stream" added_in_milestone="62" hash_code="17188928" type="0" content_hash_code="7250776" os_list="linux,windows" file_path="content/browser/websockets/websocket_connector_impl.cc"/> + <item id="webstore_data_fetcher" added_in_milestone="62" hash_code="26302604" type="0" content_hash_code="24000746" os_list="linux,windows" file_path="chrome/browser/extensions/webstore_data_fetcher.cc"/> + <item id="webstore_install_helper" added_in_milestone="62" hash_code="25921771" type="0" content_hash_code="10206361" os_list="linux,windows" file_path="chrome/browser/extensions/webstore_install_helper.cc"/> + <item id="webstore_installer" added_in_milestone="62" hash_code="18764319" type="0" content_hash_code="70871152" os_list="linux,windows" file_path="chrome/browser/extensions/webstore_installer.cc"/> + <item id="webui_content_scripts_download" added_in_milestone="62" hash_code="100545943" type="0" content_hash_code="119898059" os_list="linux,windows" file_path="extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.cc"/> + <item id="well_known_path_that_should_not_exist" added_in_milestone="86" hash_code="134618785" type="0" content_hash_code="55913167" os_list="linux,windows" file_path="components/password_manager/core/browser/well_known_change_password_state.cc"/> + <item id="worker_script_load" added_in_milestone="72" hash_code="72087791" type="0" content_hash_code="24889169" os_list="linux,windows" file_path="content/browser/worker_host/worker_script_fetcher.cc"/> + <item id="xmpp_signal_strategy" added_in_milestone="66" hash_code="88906454" type="0" deprecated="2019-07-16" content_hash_code="88958321" file_path=""/> </annotations>
diff --git a/ui/base/ime/win/tsf_text_store.cc b/ui/base/ime/win/tsf_text_store.cc index 838bb47..0ff57b5 100644 --- a/ui/base/ime/win/tsf_text_store.cc +++ b/ui/base/ime/win/tsf_text_store.cc
@@ -631,6 +631,7 @@ if (string_pending_insertion_.empty()) { if (!text_input_client_->HasCompositionText()) { if (has_composition_range_ && on_start_composition_called_) { + is_tic_write_in_progress_ = true; // Remove replacing text first before starting composition. if (new_text_inserted_ && !replace_text_range_.is_empty() && !replace_text_size_) { @@ -640,6 +641,7 @@ string_pending_insertion_ = string_buffer_document_.substr( composition_range_.GetMin(), composition_range_.length()); StartCompositionOnExistingText(); + is_tic_write_in_progress_ = false; } else { composition_start_ = selection_.start(); CalculateTextandSelectionDiffAndNotifyIfNeeded(); @@ -684,8 +686,10 @@ text_input_client_->HasCompositionText()) || !has_composition_range_) && text_input_client_) { + is_tic_write_in_progress_ = true; CommitTextAndEndCompositionIfAny(last_composition_start, new_composition_start); + is_tic_write_in_progress_ = false; } const base::string16& composition_string = string_buffer_document_.substr( @@ -715,6 +719,7 @@ // We need to remove replacing text first before starting new composition if // there are any. + is_tic_write_in_progress_ = true; if (new_text_inserted_ && !replace_text_range_.is_empty() && !text_input_client_->HasCompositionText() && last_composition_start > replace_text_range_.start()) { @@ -723,6 +728,7 @@ } StartCompositionOnNewText(new_composition_start, composition_string); + is_tic_write_in_progress_ = false; } ResetCacheAfterEditSession(); @@ -1108,7 +1114,8 @@ // If this is a re-entrant call, then bail out early so we don't end up // in an infinite loop of sending notifications as TSF calls back into us // when we send a text/selection change notification. - if (!text_input_client_ || is_notification_in_progress_) + if (!text_input_client_ || is_notification_in_progress_ || + is_tic_write_in_progress_) return; gfx::Range latest_buffer_range_from_client; @@ -1122,6 +1129,13 @@ &latest_selection_from_client) && latest_selection_from_client.IsBoundedBy( latest_buffer_range_from_client)) { + gfx::Range latest_composition_from_client; + if (text_input_client_->HasCompositionText() && + text_input_client_->GetCompositionTextRange( + &latest_composition_from_client)) + composition_from_client_ = latest_composition_from_client; + else + composition_from_client_ = latest_selection_from_client; // if the text and selection from text input client is the same as the text // and buffer we got last time, either the state hasn't changed since last // time we synced or the change hasn't completed yet. Either case we don't @@ -1276,6 +1290,8 @@ previous_composition_selection_range_ = gfx::Range::InvalidRange(); previous_text_spans_.clear(); string_pending_insertion_.clear(); + selection_ = gfx::Range(composition_from_client_.end(), + composition_from_client_.end()); composition_start_ = selection_.end(); return TerminateComposition();
diff --git a/ui/base/ime/win/tsf_text_store.h b/ui/base/ime/win/tsf_text_store.h index 70455c7..63b6091 100644 --- a/ui/base/ime/win/tsf_text_store.h +++ b/ui/base/ime/win/tsf_text_store.h
@@ -386,6 +386,10 @@ // TextInputClient::GetEditableSelectionRange(); gfx::Range selection_from_client_; + // |composition_range_from_client_| indicates the composition range returned + // from TextInputClient::GetCompositionTextRange(); + gfx::Range composition_from_client_; + // |wparam_keydown_cached_| and |lparam_keydown_cached_| contains key event // info that is used to synthesize key event during composition. // |wparam_keydown_fired_| indicates if a keydown event has been fired. @@ -422,6 +426,9 @@ // Checks for re-entrancy while notifying changes to TSF. bool is_notification_in_progress_ = false; + // Checks for re-entrancy while writing to text input client. + bool is_tic_write_in_progress_ = false; + // The type of current lock. // 0: No lock. // TS_LF_READ: read-only lock.
diff --git a/ui/base/ime/win/tsf_text_store_unittest.cc b/ui/base/ime/win/tsf_text_store_unittest.cc index 25db5d4..2e5ec79e 100644 --- a/ui/base/ime/win/tsf_text_store_unittest.cc +++ b/ui/base/ime/win/tsf_text_store_unittest.cc
@@ -191,6 +191,12 @@ return true; } + bool GetCompositionTextRange(gfx::Range* range) { + range->set_start(composition_range_.start()); + range->set_end(composition_range_.end()); + return true; + } + protected: // Accessors to the internal state of TSFTextStore. bool* edit_flag() { return &text_store_->edit_flag_; } @@ -371,6 +377,11 @@ selection_range_.set_end(end); } + void SetCompositionTextRange(uint32_t start, uint32_t end) { + composition_range_.set_start(start); + composition_range_.set_end(end); + } + void SetTextBuffer(const wchar_t* buffer) { text_buffer_.clear(); text_buffer_.assign(buffer); @@ -379,6 +390,7 @@ bool has_composition_text_ = false; gfx::Range text_range_; gfx::Range selection_range_; + gfx::Range composition_range_; base::string16 text_buffer_ = L""; scoped_refptr<TSFTextStore> text_store_; @@ -706,6 +718,10 @@ .WillOnce( Invoke(&callback, &RequestLockTextChangeTestCallback::GetTextRange)); + ON_CALL(text_input_client_, GetCompositionTextRange(_)) + .WillByDefault(Invoke( + &callback, &TSFTextStoreTestCallback::GetCompositionTextRange)); + HRESULT result = kInvalidResult; EXPECT_EQ(S_OK, text_store_->RequestLock(TS_LF_READWRITE, &result)); EXPECT_EQ(S_OK, result); @@ -2347,6 +2363,10 @@ .WillOnce( Invoke(&callback, &DiffingAlgorithmTestCallback::LockGranted14b)); + ON_CALL(text_input_client_, GetCompositionTextRange(_)) + .WillByDefault(Invoke( + &callback, &TSFTextStoreTestCallback::GetCompositionTextRange)); + ON_CALL(text_input_client_, GetTextRange(_)) .WillByDefault( Invoke(&callback, &TSFTextStoreTestCallback::GetTextRange)); @@ -3640,6 +3660,156 @@ EXPECT_EQ(S_OK, result); } +// |ConfirmComposition| should set selection to the end of compositiont text. +class RegressionTest10Callback : public TSFTextStoreTestCallback { + public: + explicit RegressionTest10Callback(TSFTextStore* text_store) + : TSFTextStoreTestCallback(text_store) {} + + HRESULT LockGranted1(DWORD flags) { + SetTextTest(0, 0, L"abcd", S_OK); + SetSelectionTest(0, 4, S_OK); + + text_spans()->clear(); + ImeTextSpan text_span; + text_span.start_offset = 0; + text_span.end_offset = 4; + text_span.underline_color = SK_ColorBLACK; + text_span.thickness = ImeTextSpan::Thickness::kThin; + text_span.background_color = SK_ColorTRANSPARENT; + text_spans()->push_back(text_span); + *edit_flag() = true; + *composition_start() = 0; + composition_range()->set_start(0); + composition_range()->set_end(4); + text_store_->OnKeyTraceDown(65u, 1966081u); + *has_composition_range() = true; + + return S_OK; + } + + void SetCompositionText1(const ui::CompositionText& composition) { + EXPECT_EQ(L"abcd", composition.text); + EXPECT_EQ(0u, composition.selection.start()); + EXPECT_EQ(4u, composition.selection.end()); + ASSERT_EQ(1u, composition.ime_text_spans.size()); + EXPECT_EQ(0u, composition.ime_text_spans[0].start_offset); + EXPECT_EQ(4u, composition.ime_text_spans[0].end_offset); + SetHasCompositionText(true); + SetCompositionTextRange(0, 4); + } + + HRESULT LockGranted2(DWORD flags) { + SetSelectionTest(2, 2, S_OK); + GetTextTest(0, -1, L"abcd", 4); + + text_spans()->clear(); + ImeTextSpan text_span_1; + text_span_1.start_offset = 0; + text_span_1.end_offset = 2; + text_span_1.underline_color = SK_ColorBLACK; + text_span_1.thickness = ImeTextSpan::Thickness::kThick; + text_span_1.background_color = SK_ColorTRANSPARENT; + text_spans()->push_back(text_span_1); + ImeTextSpan text_span_2; + text_span_2.start_offset = 2; + text_span_2.end_offset = 4; + text_span_2.underline_color = SK_ColorBLACK; + text_span_2.thickness = ImeTextSpan::Thickness::kThin; + text_span_2.background_color = SK_ColorTRANSPARENT; + text_spans()->push_back(text_span_2); + *edit_flag() = true; + *composition_start() = 0; + composition_range()->set_start(0); + composition_range()->set_end(4); + text_store_->OnKeyTraceDown(65u, 1966081u); + *has_composition_range() = true; + + text_store_->OnKeyTraceUp(65u, 1966081u); + text_store_->OnKeyTraceDown(65u, 1966081u); + return S_OK; + } + + void SetCompositionText2(const ui::CompositionText& composition) { + EXPECT_EQ(L"abcd", composition.text); + EXPECT_EQ(2u, composition.selection.start()); + EXPECT_EQ(2u, composition.selection.end()); + ASSERT_EQ(2u, composition.ime_text_spans.size()); + EXPECT_EQ(0u, composition.ime_text_spans[0].start_offset); + EXPECT_EQ(2u, composition.ime_text_spans[0].end_offset); + EXPECT_EQ(2u, composition.ime_text_spans[1].start_offset); + EXPECT_EQ(4u, composition.ime_text_spans[1].end_offset); + SetHasCompositionText(true); + } + + HRESULT LockGranted3(DWORD flags) { + GetTextTest(0, -1, L"abcd", 4); + GetSelectionTest(2, 2); + *edit_flag() = false; + return S_OK; + } + + HRESULT LockGranted4(DWORD flags) { + GetTextTest(0, -1, L"abcd", 4); + GetSelectionTest(4, 4); + return S_OK; + } + + private: + DISALLOW_COPY_AND_ASSIGN(RegressionTest10Callback); +}; + +TEST_F(TSFTextStoreTest, RegressionTest10) { + RegressionTest10Callback callback(text_store_.get()); + EXPECT_CALL(text_input_client_, SetCompositionText(_)) + .WillOnce( + Invoke(&callback, &RegressionTest10Callback::SetCompositionText1)) + .WillOnce( + Invoke(&callback, &RegressionTest10Callback::SetCompositionText2)); + + EXPECT_CALL(*sink_, OnLockGranted(_)) + .WillOnce(Invoke(&callback, &RegressionTest10Callback::LockGranted1)) + .WillOnce(Invoke(&callback, &RegressionTest10Callback::LockGranted2)) + .WillOnce(Invoke(&callback, &RegressionTest10Callback::LockGranted3)) + .WillOnce(Invoke(&callback, &RegressionTest10Callback::LockGranted4)); + + ON_CALL(text_input_client_, GetCompositionTextRange(_)) + .WillByDefault(Invoke( + &callback, &TSFTextStoreTestCallback::GetCompositionTextRange)); + + ON_CALL(text_input_client_, GetTextRange(_)) + .WillByDefault( + Invoke(&callback, &TSFTextStoreTestCallback::GetTextRange)); + + ON_CALL(text_input_client_, GetTextFromRange(_, _)) + .WillByDefault( + Invoke(&callback, &TSFTextStoreTestCallback::GetTextFromRange)); + + ON_CALL(text_input_client_, GetEditableSelectionRange(_)) + .WillByDefault(Invoke( + &callback, &TSFTextStoreTestCallback::GetEditableSelectionRange)); + + ON_CALL(text_input_client_, HasCompositionText()) + .WillByDefault( + Invoke(&callback, &TSFTextStoreTestCallback::HasCompositionText)); + + HRESULT result = kInvalidResult; + EXPECT_EQ(S_OK, text_store_->RequestLock(TS_LF_READWRITE, &result)); + EXPECT_EQ(S_OK, result); + result = kInvalidResult; + EXPECT_EQ(S_OK, text_store_->RequestLock(TS_LF_READWRITE, &result)); + EXPECT_EQ(S_OK, result); + result = kInvalidResult; + EXPECT_EQ(S_OK, text_store_->RequestLock(TS_LF_READWRITE, &result)); + EXPECT_EQ(S_OK, result); + + text_store_->ConfirmComposition(); + + result = kInvalidResult; + EXPECT_EQ(S_OK, text_store_->RequestLock(TS_LF_READWRITE, &result)); + EXPECT_EQ(S_OK, result); +} + // Test multiple |SetText| call in one edit session. class MultipleSetTextCallback : public TSFTextStoreTestCallback { public: @@ -3727,5 +3897,137 @@ EXPECT_EQ(S_OK, result); } +// Test re-entrancy scanerio while writing to text input client. +class TextInputClientReentrancyTestCallback : public TSFTextStoreTestCallback { + public: + explicit TextInputClientReentrancyTestCallback(TSFTextStore* text_store) + : TSFTextStoreTestCallback(text_store) {} + + HRESULT LockGranted1(DWORD flags) { + SetTextTest(0, 0, L"a", S_OK); + SetSelectionTest(0, 1, S_OK); + + text_spans()->clear(); + ImeTextSpan text_span; + text_span.start_offset = 0; + text_span.end_offset = 1; + text_span.underline_color = SK_ColorBLACK; + text_span.thickness = ImeTextSpan::Thickness::kThin; + text_span.background_color = SK_ColorTRANSPARENT; + text_spans()->push_back(text_span); + *edit_flag() = true; + *composition_start() = 0; + composition_range()->set_start(0); + composition_range()->set_end(1); + text_store_->OnKeyTraceDown(65u, 1966081u); + *has_composition_range() = true; + + return S_OK; + } + + void SetCompositionText1(const ui::CompositionText& composition) { + EXPECT_EQ(L"a", composition.text); + EXPECT_EQ(0u, composition.selection.start()); + EXPECT_EQ(1u, composition.selection.end()); + ASSERT_EQ(1u, composition.ime_text_spans.size()); + EXPECT_EQ(0u, composition.ime_text_spans[0].start_offset); + EXPECT_EQ(1u, composition.ime_text_spans[0].end_offset); + SetHasCompositionText(true); + SetTextRange(0, 1); + SetTextBuffer(L"a"); + SetSelectionRange(0, 1); + } + + HRESULT LockGranted2(DWORD flags) { + GetTextTest(0, -1, L"a", 1); + + text_spans()->clear(); + *edit_flag() = true; + *composition_start() = 1; + composition_range()->set_start(0); + composition_range()->set_end(0); + + *has_composition_range() = false; + return S_OK; + } + + void InsertText2(const base::string16& text) { + EXPECT_EQ(L"a", text); + SetHasCompositionText(false); + SetSelectionRange(1, 1); + SetTextBuffer(L"b"); + HRESULT result = kInvalidResult; + EXPECT_EQ(S_OK, text_store_->RequestLock(TS_LF_READWRITE, &result)); + EXPECT_EQ(S_OK, result); + } + + HRESULT LockGranted3(DWORD flags) { + GetTextTest(0, -1, L"a", 1); + *edit_flag() = false; + return S_OK; + } + + HRESULT LockGranted4(DWORD flags) { + GetTextTest(0, -1, L"b", 1); + *edit_flag() = false; + return S_OK; + } + + private: + DISALLOW_COPY_AND_ASSIGN(TextInputClientReentrancyTestCallback); +}; + +TEST_F(TSFTextStoreTest, TextInputClientReentrancTest) { + TextInputClientReentrancyTestCallback callback(text_store_.get()); + EXPECT_CALL(*sink_, OnLockGranted(_)) + .WillOnce(Invoke(&callback, + &TextInputClientReentrancyTestCallback::LockGranted1)) + .WillOnce(Invoke(&callback, + &TextInputClientReentrancyTestCallback::LockGranted2)) + .WillOnce(Invoke(&callback, + &TextInputClientReentrancyTestCallback::LockGranted3)) + .WillOnce(Invoke(&callback, + &TextInputClientReentrancyTestCallback::LockGranted4)); + + EXPECT_CALL(text_input_client_, InsertText(_)) + .WillOnce(Invoke(&callback, + &TextInputClientReentrancyTestCallback::InsertText2)); + + EXPECT_CALL(text_input_client_, SetCompositionText(_)) + .WillOnce( + Invoke(&callback, + &TextInputClientReentrancyTestCallback::SetCompositionText1)); + + ON_CALL(text_input_client_, GetTextRange(_)) + .WillByDefault( + Invoke(&callback, &TSFTextStoreTestCallback::GetTextRange)); + + ON_CALL(text_input_client_, GetTextFromRange(_, _)) + .WillByDefault( + Invoke(&callback, &TSFTextStoreTestCallback::GetTextFromRange)); + + ON_CALL(text_input_client_, GetEditableSelectionRange(_)) + .WillByDefault(Invoke( + &callback, &TSFTextStoreTestCallback::GetEditableSelectionRange)); + + ON_CALL(text_input_client_, HasCompositionText()) + .WillByDefault( + Invoke(&callback, &TSFTextStoreTestCallback::HasCompositionText)); + + ON_CALL(text_input_client_, GetCompositionTextRange(_)) + .WillByDefault(Invoke( + &callback, &TSFTextStoreTestCallback::GetCompositionTextRange)); + + HRESULT result = kInvalidResult; + EXPECT_EQ(S_OK, text_store_->RequestLock(TS_LF_READWRITE, &result)); + EXPECT_EQ(S_OK, result); + result = kInvalidResult; + EXPECT_EQ(S_OK, text_store_->RequestLock(TS_LF_READWRITE, &result)); + EXPECT_EQ(S_OK, result); + result = kInvalidResult; + EXPECT_EQ(S_OK, text_store_->RequestLock(TS_LF_READWRITE, &result)); + EXPECT_EQ(S_OK, result); +} + } // namespace } // namespace ui
diff --git a/ui/compositor/test/test_compositor_host_x11.cc b/ui/compositor/test/test_compositor_host_x11.cc index f55ea3a..ef869ad 100644 --- a/ui/compositor/test/test_compositor_host_x11.cc +++ b/ui/compositor/test/test_compositor_host_x11.cc
@@ -10,6 +10,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "ui/events/x/x11_window_event_manager.h" +#include "ui/gfx/x/xproto.h" namespace ui { @@ -26,23 +27,24 @@ TestCompositorHostX11::~TestCompositorHostX11() = default; void TestCompositorHostX11::Show() { - XDisplay* display = gfx::GetXDisplay(); - XSetWindowAttributes swa; - swa.override_redirect = true; - window_ = static_cast<x11::Window>(XCreateWindow( - display, XDefaultRootWindow(display), // parent - bounds_.x(), bounds_.y(), bounds_.width(), bounds_.height(), - 0, // border width - static_cast<int>(x11::WindowClass::CopyFromParent), // depth - static_cast<int>(x11::WindowClass::InputOutput), - nullptr, // visual - CWOverrideRedirect, &swa)); + auto* connection = x11::Connection::Get(); + window_ = connection->GenerateId<x11::Window>(); + connection->CreateWindow({ + .wid = window_, + .parent = connection->default_root(), + .x = bounds_.x(), + .y = bounds_.y(), + .width = bounds_.width(), + .height = bounds_.height(), + .c_class = x11::WindowClass::InputOutput, + .override_redirect = x11::Bool32(true), + }); window_events_ = std::make_unique<XScopedEventSelector>(window_, ExposureMask); - XMapWindow(display, static_cast<uint32_t>(window_)); + connection->MapWindow({window_}); // Since this window is override-redirect, syncing is sufficient // to ensure the map is complete. - XSync(display, false); + connection->Sync(); allocator_.GenerateId(); compositor_.SetAcceleratedWidget( static_cast<gfx::AcceleratedWidget>(window_));
diff --git a/ui/events/ozone/evdev/capture_device_capabilities.py b/ui/events/ozone/evdev/capture_device_capabilities.py index e45d3d0..fea45085 100755 --- a/ui/events/ozone/evdev/capture_device_capabilities.py +++ b/ui/events/ozone/evdev/capture_device_capabilities.py
@@ -17,16 +17,16 @@ def bits_to_groups(bits): - return (bits + TEST_DATA_GROUP_SIZE - 1) / TEST_DATA_GROUP_SIZE + return (bits + TEST_DATA_GROUP_SIZE - 1) // TEST_DATA_GROUP_SIZE # As in /sys/class/input/input*/capabilities/* def serialize_bitfield(bitfield, max_bit): result = "" group_count = bits_to_groups(max_bit) - for group in xrange(group_count - 1, -1, -1): + for group in range(group_count - 1, -1, -1): group_val = 0 - for group_bit in xrange(TEST_DATA_GROUP_SIZE): + for group_bit in range(TEST_DATA_GROUP_SIZE): code = group * TEST_DATA_GROUP_SIZE + group_bit if code in bitfield: group_val |= (1 << group_bit)
diff --git a/ui/events/ozone/evdev/capture_test_events.py b/ui/events/ozone/evdev/capture_test_events.py index cc941d1..4fc4815d 100755 --- a/ui/events/ozone/evdev/capture_test_events.py +++ b/ui/events/ozone/evdev/capture_test_events.py
@@ -35,7 +35,7 @@ 'code': CODE_NAMES[event.code], 'value': event.value }) - except KeyboardInterrupt, e: + except KeyboardInterrupt as e: pass out.write('};\n')
diff --git a/ui/gfx/x/x11.h b/ui/gfx/x/x11.h index 1fb997c..25668fd 100644 --- a/ui/gfx/x/x11.h +++ b/ui/gfx/x/x11.h
@@ -297,28 +297,6 @@ int XUngrabKey(Display*, int, unsigned int, Window); int XSelectInput(Display*, Window, long); int XSetWindowBackgroundPixmap(Display*, Window, Pixmap); -Window XCreateWindow(Display*, - Window, - int, - int, - unsigned int, - unsigned int, - unsigned int, - int, - unsigned int, - Visual*, - unsigned long, - XSetWindowAttributes*); -Window XCreateSimpleWindow(Display*, - Window, - int, - int, - unsigned int, - unsigned int, - unsigned int, - unsigned long, - unsigned long); -int XDestroyWindow(Display*, Window); Status XGetWindowAttributes(Display*, Window, XWindowAttributes*); VisualID XVisualIDFromVisual(Visual*); int XResizeWindow(Display*, Window, unsigned int, unsigned int);
diff --git a/ui/gl/gl_context_glx_unittest.cc b/ui/gl/gl_context_glx_unittest.cc index 67cdb91..2b230ea 100644 --- a/ui/gl/gl_context_glx_unittest.cc +++ b/ui/gl/gl_context_glx_unittest.cc
@@ -6,9 +6,11 @@ #include "base/memory/scoped_refptr.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/x/connection.h" #include "ui/gfx/x/x11.h" #include "ui/gfx/x/x11_error_tracker.h" #include "ui/gfx/x/x11_types.h" +#include "ui/gfx/x/xproto.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_surface_glx_x11.h" #include "ui/gl/init/gl_factory.h" @@ -26,28 +28,26 @@ #endif TEST(GLContextGLXTest, MAYBE_DoNotDestroyOnFailedMakeCurrent) { - auto* xdisplay = gfx::GetXDisplay(); - ASSERT_TRUE(xdisplay); + auto* connection = x11::Connection::Get(); + ASSERT_TRUE(connection && connection->Ready()); gfx::X11ErrorTracker error_tracker; - XSetWindowAttributes swa; - memset(&swa, 0, sizeof(swa)); - swa.background_pixmap = 0; - swa.override_redirect = true; - auto xwindow = static_cast<x11::Window>(XCreateWindow( - xdisplay, XDefaultRootWindow(xdisplay), 0, 0, 10, - 10, // x, y, width, height - 0, // border width - static_cast<int>(x11::WindowClass::CopyFromParent), // depth - static_cast<int>(x11::WindowClass::InputOutput), - nullptr, // visual - CWBackPixmap | CWOverrideRedirect, &swa)); + auto xwindow = connection->GenerateId<x11::Window>(); + connection->CreateWindow({ + .wid = xwindow, + .parent = connection->default_root(), + .width = 10, + .height = 10, + .c_class = x11::WindowClass::InputOutput, + .background_pixmap = x11::Pixmap::None, + .override_redirect = x11::Bool32(true), + }); - XMapWindow(xdisplay, static_cast<uint32_t>(xwindow)); + connection->MapWindow({xwindow}); // Since this window is override-redirect, syncing is sufficient // to ensure the map is complete. - XSync(xdisplay, false); + connection->Sync(); GLImageTestSupport::InitializeGL(base::nullopt); auto surface = gl::InitializeGLSurface(base::MakeRefCounted<GLSurfaceGLXX11>( @@ -61,10 +61,10 @@ EXPECT_TRUE(context->GetHandle()); context->ReleaseCurrent(surface.get()); - XDestroyWindow(xdisplay, static_cast<uint32_t>(xwindow)); + connection->DestroyWindow({xwindow}); // Since this window is override-redirect, syncing is sufficient // to ensure the window is destroyed and unmapped. - XSync(xdisplay, false); + connection->Sync(); ASSERT_FALSE(error_tracker.FoundNewError()); if (context->MakeCurrent(surface.get())) { @@ -83,7 +83,8 @@ // not destroyed. ASSERT_TRUE(context->GetHandle()); surface = nullptr; - XSync(xdisplay, true); + connection->Sync(); + connection->events().clear(); } } // namespace gl
diff --git a/ui/gl/gl_surface_egl_x11.cc b/ui/gl/gl_surface_egl_x11.cc index f801cd3..ac6252e 100644 --- a/ui/gl/gl_surface_egl_x11.cc +++ b/ui/gl/gl_surface_egl_x11.cc
@@ -19,7 +19,7 @@ class XrandrIntervalOnlyVSyncProvider : public gfx::VSyncProvider { public: - explicit XrandrIntervalOnlyVSyncProvider(Display* display) + explicit XrandrIntervalOnlyVSyncProvider() : interval_(base::TimeDelta::FromSeconds(1 / 60.)) {} void GetVSyncParameters(UpdateVSyncCallback callback) override { @@ -86,8 +86,9 @@ // views::DesktopWindowTreeHostX11::InitX11Window back to None for the // XWindow associated to this surface after the first SwapBuffers has // happened, to avoid showing a weird white background while resizing. - if (GetXNativeDisplay() && !has_swapped_buffers_) { - XSetWindowBackgroundPixmap(GetXNativeDisplay(), window_, 0); + if (GetXNativeConnection()->display() && !has_swapped_buffers_) { + XSetWindowBackgroundPixmap(GetXNativeConnection()->display(), window_, 0); + GetXNativeConnection()->Flush(); has_swapped_buffers_ = true; } return result; @@ -97,13 +98,13 @@ Destroy(); } -Display* NativeViewGLSurfaceEGLX11::GetXNativeDisplay() const { - return reinterpret_cast<Display*>(GetNativeDisplay()); +x11::Connection* NativeViewGLSurfaceEGLX11::GetXNativeConnection() const { + return x11::Connection::Get(); } std::unique_ptr<gfx::VSyncProvider> NativeViewGLSurfaceEGLX11::CreateVsyncProviderInternal() { - return std::make_unique<XrandrIntervalOnlyVSyncProvider>(GetXNativeDisplay()); + return std::make_unique<XrandrIntervalOnlyVSyncProvider>(); } bool NativeViewGLSurfaceEGLX11::DispatchXEvent(x11::Event* x11_event) {
diff --git a/ui/gl/gl_surface_egl_x11.h b/ui/gl/gl_surface_egl_x11.h index 01dbe8d..14a2fb5 100644 --- a/ui/gl/gl_surface_egl_x11.h +++ b/ui/gl/gl_surface_egl_x11.h
@@ -35,7 +35,7 @@ protected: ~NativeViewGLSurfaceEGLX11() override; - Display* GetXNativeDisplay() const; + x11::Connection* GetXNativeConnection() const; private: // NativeViewGLSurfaceEGL overrides:
diff --git a/ui/gl/gl_surface_egl_x11_gles2.cc b/ui/gl/gl_surface_egl_x11_gles2.cc index 354a99b..f7c54e5 100644 --- a/ui/gl/gl_surface_egl_x11_gles2.cc +++ b/ui/gl/gl_surface_egl_x11_gles2.cc
@@ -6,6 +6,7 @@ #include "ui/base/x/x11_util.h" #include "ui/gfx/x/x11.h" +#include "ui/gfx/x/xproto.h" #include "ui/gfx/x/xproto_util.h" #include "ui/gl/egl_util.h" @@ -19,33 +20,33 @@ : NativeViewGLSurfaceEGLX11(x11::Window::None), parent_window_(window) {} bool NativeViewGLSurfaceEGLX11GLES2::InitializeNativeWindow() { - Display* x11_display = GetXNativeDisplay(); - XWindowAttributes attributes; - if (!XGetWindowAttributes(x11_display, static_cast<uint32_t>(parent_window_), - &attributes)) { - LOG(ERROR) << "XGetWindowAttributes failed for window " + auto* connection = GetXNativeConnection(); + auto geometry = connection->GetGeometry({parent_window_}).Sync(); + if (!geometry) { + LOG(ERROR) << "GetGeometry failed for window " << static_cast<uint32_t>(parent_window_) << "."; return false; } - size_ = gfx::Size(attributes.width, attributes.height); + size_ = gfx::Size(geometry->width, geometry->height); // Create a child window, with a CopyFromParent visual (to avoid inducing // extra blits in the driver), that we can resize exactly in Resize(), // correctly ordered with GL, so that we don't have invalid transient states. // See https://crbug.com/326995. - XSetWindowAttributes swa; - memset(&swa, 0, sizeof(swa)); - swa.background_pixmap = 0; - swa.bit_gravity = NorthWestGravity; - window_ = XCreateWindow(x11_display, static_cast<uint32_t>(parent_window_), 0, - 0, size_.width(), size_.height(), 0, - static_cast<int>(x11::WindowClass::CopyFromParent), - static_cast<int>(x11::WindowClass::InputOutput), - nullptr, CWBackPixmap | CWBitGravity, &swa); - XMapWindow(x11_display, window_); - XSelectInput(x11_display, window_, ExposureMask); - XFlush(x11_display); + set_window(connection->GenerateId<x11::Window>()); + connection->CreateWindow({ + .wid = window(), + .parent = parent_window_, + .width = size_.width(), + .height = size_.height(), + .c_class = x11::WindowClass::InputOutput, + .background_pixmap = x11::Pixmap::None, + .bit_gravity = x11::Gravity::NorthWest, + .event_mask = x11::EventMask::Exposure, + }); + connection->MapWindow({window()}); + connection->Flush(); return true; } @@ -54,10 +55,10 @@ NativeViewGLSurfaceEGLX11::Destroy(); if (window_) { - Display* x11_display = GetXNativeDisplay(); - XDestroyWindow(x11_display, window_); + auto* connection = GetXNativeConnection(); + connection->DestroyWindow({window()}); window_ = 0; - XFlush(x11_display); + connection->Flush(); } } @@ -65,10 +66,10 @@ if (!config_) { // Get a config compatible with the window DCHECK(window_); - XWindowAttributes win_attribs; - if (!XGetWindowAttributes(GetXNativeDisplay(), window_, &win_attribs)) { + auto* connection = GetXNativeConnection(); + auto geometry = connection->GetGeometry({window()}).Sync(); + if (!geometry) return nullptr; - } // Try matching the window depth with an alpha channel, // because we're worried the destination alpha width could @@ -90,7 +91,7 @@ EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, EGL_NONE}; - config_attribs[kBufferSizeOffset] = win_attribs.depth; + config_attribs[kBufferSizeOffset] = geometry->depth; EGLDisplay display = GetHardwareDisplay(); EGLint num_configs; @@ -109,7 +110,7 @@ return nullptr; } - if (config_depth == win_attribs.depth) { + if (config_depth == geometry->depth) { return config_; } } @@ -140,7 +141,13 @@ size_ = size; eglWaitGL(); - XResizeWindow(GetXNativeDisplay(), window_, size.width(), size.height()); + auto* connection = GetXNativeConnection(); + connection->ConfigureWindow({ + .window = window(), + .width = size.width(), + .height = size.height(), + }); + connection->Flush(); eglWaitNative(EGL_CORE_NATIVE_ENGINE); return true;
diff --git a/ui/gl/gl_surface_egl_x11_gles2.h b/ui/gl/gl_surface_egl_x11_gles2.h index f52dddd..73b9b4a 100644 --- a/ui/gl/gl_surface_egl_x11_gles2.h +++ b/ui/gl/gl_surface_egl_x11_gles2.h
@@ -34,6 +34,11 @@ protected: ~NativeViewGLSurfaceEGLX11GLES2() override; + x11::Window window() const { return static_cast<x11::Window>(window_); } + void set_window(x11::Window window) { + window_ = static_cast<uint32_t>(window); + } + private: // XEventDispatcher: bool DispatchXEvent(x11::Event* xev) override;
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc index 1fa2399..a4a2f2b 100644 --- a/ui/gl/gl_surface_glx.cc +++ b/ui/gl/gl_surface_glx.cc
@@ -66,9 +66,10 @@ int g_depth = static_cast<int>(x11::WindowClass::CopyFromParent); x11::ColorMap g_colormap{}; -GLXFBConfig GetConfigForWindow(Display* display, - gfx::AcceleratedWidget window) { - DCHECK(window != gfx::kNullAcceleratedWidget); +GLXFBConfig GetConfigForWindow(x11::Connection* connection, + x11::Window window) { + DCHECK_NE(window, x11::Window::None); + auto* display = connection->display(); // This code path is expensive, but we only take it when // attempting to use GLX_ARB_create_context_robustness, in which @@ -123,33 +124,34 @@ return nullptr; } -bool CreateDummyWindow(Display* display) { - DCHECK(display); - auto parent_window = ui::GetX11RootWindow(); - gfx::AcceleratedWidget window = static_cast<gfx::AcceleratedWidget>( - XCreateWindow(display, static_cast<uint32_t>(parent_window), 0, 0, 1, 1, - 0, static_cast<int>(x11::WindowClass::CopyFromParent), - static_cast<int>(x11::WindowClass::InputOutput), nullptr, 0, - nullptr)); - if (window == gfx::kNullAcceleratedWidget) { - LOG(ERROR) << "XCreateWindow failed"; - return false; - } - GLXFBConfig config = GetConfigForWindow(display, window); +bool CreateDummyWindow(x11::Connection* conn) { + DCHECK(conn); + auto* display = conn->display(); + auto parent_window = conn->default_root(); + auto window = conn->GenerateId<x11::Window>(); + conn->CreateWindow({ + .wid = window, + .parent = parent_window, + .width = 1, + .height = 1, + .c_class = x11::WindowClass::InputOutput, + }); + GLXFBConfig config = GetConfigForWindow(conn, window); if (!config) { LOG(ERROR) << "Failed to get GLXConfig"; - XDestroyWindow(display, static_cast<uint32_t>(window)); + conn->DestroyWindow({window}); return false; } + GLXWindow glx_window = glXCreateWindow(display, config, static_cast<uint32_t>(window), nullptr); if (!glx_window) { LOG(ERROR) << "glXCreateWindow failed"; - XDestroyWindow(display, static_cast<uint32_t>(window)); + conn->DestroyWindow({window}); return false; } glXDestroyWindow(display, glx_window); - XDestroyWindow(display, static_cast<uint32_t>(window)); + conn->DestroyWindow({window}); return true; } @@ -253,14 +255,15 @@ // Create a connection to the X server for use on g_video_sync_thread before // the sandbox starts. static bool InitializeBeforeSandboxStarts() { - auto* display = GetDisplayImpl(); - if (!display) + auto* connection = GetConnectionImpl(); + if (!connection || !connection->Ready()) return false; - if (!CreateDummyWindow(display)) { + if (!CreateDummyWindow(connection)) { LOG(ERROR) << "CreateDummyWindow(display) failed"; return false; } + connection->DetachFromSequence(); return true; } @@ -272,16 +275,16 @@ return g_video_sync_thread; } - Display* GetDisplay() { + x11::Connection* GetConnection() { DCHECK(task_runner()->BelongsToCurrentThread()); - return GetDisplayImpl(); + return GetConnectionImpl(); } void MaybeCreateGLXContext(GLXFBConfig config) { DCHECK(task_runner()->BelongsToCurrentThread()); if (!context_) { - context_ = glXCreateNewContext(GetDisplay(), config, GLX_RGBA_TYPE, - nullptr, true); + context_ = glXCreateNewContext(GetConnection()->display(), config, + GLX_RGBA_TYPE, nullptr, true); } LOG_IF(ERROR, !context_) << "video_sync: glXCreateNewContext failed"; } @@ -290,7 +293,7 @@ void CleanUp() override { DCHECK(task_runner()->BelongsToCurrentThread()); if (context_) - glXDestroyContext(GetDisplay(), context_); + glXDestroyContext(GetConnection()->display(), context_); } GLXContext GetGLXContext() { @@ -311,12 +314,14 @@ Stop(); } - static Display* GetDisplayImpl() { - static Display* display = gfx::CloneXDisplay(gfx::GetXDisplay()); - return display; + static x11::Connection* GetConnectionImpl() { + if (!g_connection) + g_connection = x11::Connection::Get()->Clone().release(); + return g_connection; } static SGIVideoSyncThread* g_video_sync_thread; + static x11::Connection* g_connection; GLXContext context_ = nullptr; THREAD_CHECKER(thread_checker_); @@ -330,7 +335,6 @@ SGIVideoSyncThread* vsync_thread) : parent_window_(parent_window), vsync_thread_(vsync_thread), - window_(gfx::kNullAcceleratedWidget), glx_window_(0), task_runner_(base::ThreadTaskRunnerHandle::Get()), cancel_vsync_flag_(), @@ -341,13 +345,12 @@ } ~SGIVideoSyncProviderThreadShim() { + auto* connection = vsync_thread_->GetConnection(); if (glx_window_) - glXDestroyWindow(vsync_thread_->GetDisplay(), glx_window_); + glXDestroyWindow(connection->display(), glx_window_); - if (window_ != gfx::kNullAcceleratedWidget) { - XDestroyWindow(vsync_thread_->GetDisplay(), - static_cast<uint32_t>(window_)); - } + if (window_ != x11::Window::None) + connection->DestroyWindow({window_}); } base::AtomicFlag* cancel_vsync_flag() { return &cancel_vsync_flag_; } @@ -355,25 +358,30 @@ base::Lock* vsync_lock() { return &vsync_lock_; } void Initialize() { - DCHECK(vsync_thread_->GetDisplay()); + auto* connection = vsync_thread_->GetConnection(); + DCHECK(connection); - window_ = static_cast<gfx::AcceleratedWidget>(XCreateWindow( - vsync_thread_->GetDisplay(), static_cast<uint32_t>(parent_window_), 0, - 0, 1, 1, 0, static_cast<int>(x11::WindowClass::CopyFromParent), - static_cast<int>(x11::WindowClass::InputOutput), nullptr, 0, nullptr)); - if (window_ == gfx::kNullAcceleratedWidget) { + auto window = connection->GenerateId<x11::Window>(); + auto req = connection->CreateWindow({ + .wid = window, + .parent = static_cast<x11::Window>(parent_window_), + .width = 1, + .height = 1, + .c_class = x11::WindowClass::InputOutput, + }); + if (req.Sync().error) { LOG(ERROR) << "video_sync: XCreateWindow failed"; return; } + window_ = window; - GLXFBConfig config = - GetConfigForWindow(vsync_thread_->GetDisplay(), window_); + GLXFBConfig config = GetConfigForWindow(connection, window_); if (!config) { LOG(ERROR) << "video_sync: Failed to get GLXConfig"; return; } - glx_window_ = glXCreateWindow(vsync_thread_->GetDisplay(), config, + glx_window_ = glXCreateWindow(connection->display(), config, static_cast<uint32_t>(window_), nullptr); if (!glx_window_) { LOG(ERROR) << "video_sync: glXCreateWindow failed"; @@ -392,7 +400,8 @@ base::TimeDelta interval = ui::GetPrimaryDisplayRefreshIntervalFromXrandr(); - glXMakeContextCurrent(vsync_thread_->GetDisplay(), glx_window_, glx_window_, + glXMakeContextCurrent(vsync_thread_->GetConnection()->display(), + glx_window_, glx_window_, vsync_thread_->GetGLXContext()); unsigned int retrace_count = 0; @@ -402,7 +411,8 @@ base::TimeTicks now = base::TimeTicks::Now(); TRACE_EVENT_INSTANT0("gpu", "vblank", TRACE_EVENT_SCOPE_THREAD); - glXMakeContextCurrent(vsync_thread_->GetDisplay(), 0, 0, nullptr); + glXMakeContextCurrent(vsync_thread_->GetConnection()->display(), 0, 0, + nullptr); task_runner_->PostTask(FROM_HERE, base::BindOnce(std::move(callback), now, interval)); @@ -411,7 +421,7 @@ private: gfx::AcceleratedWidget parent_window_; SGIVideoSyncThread* vsync_thread_; - gfx::AcceleratedWidget window_; + x11::Window window_ = x11::Window::None; GLXWindow glx_window_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; @@ -495,6 +505,7 @@ }; SGIVideoSyncThread* SGIVideoSyncThread::g_video_sync_thread = nullptr; +x11::Connection* SGIVideoSyncThread::g_connection = nullptr; } // namespace @@ -541,8 +552,8 @@ // Unfortunately some fds e.g. /dev/nvidia0 are cached per thread and because // we can't start threads before the sandbox is set up, these are accessed // through the broker process. See GpuProcessPolicy::InitGpuBrokerProcess. - if (!CreateDummyWindow(gfx::GetXDisplay())) { - LOG(ERROR) << "CreateDummyWindow(gfx::GetXDisplay()) failed"; + if (!CreateDummyWindow(x11::Connection::Get())) { + LOG(ERROR) << "CreateDummyWindow() failed"; return false; } @@ -672,7 +683,7 @@ NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window) : parent_window_(window), - window_(gfx::kNullAcceleratedWidget), + window_(x11::Window::None), glx_window_(0), config_(nullptr), has_swapped_buffers_(false) {} @@ -689,11 +700,10 @@ size_ = gfx::Size(attributes.width, attributes.height); auto* conn = x11::Connection::Get(); - auto window = conn->GenerateId<x11::Window>(); - window_ = static_cast<uint32_t>(window); + window_ = conn->GenerateId<x11::Window>(); x11::CreateWindowRequest req{ .depth = g_depth, - .wid = window, + .wid = window_, .parent = static_cast<x11::Window>(parent_window_), .width = size_.width(), .height = size_.height(), @@ -717,7 +727,7 @@ req.background_pixel = 0; // ARGB(0,0,0,0) for compositing WM } conn->CreateWindow(req); - conn->MapWindow({window}); + conn->MapWindow({window_}); RegisterEvents(); conn->Sync(); @@ -769,11 +779,11 @@ glXDestroyWindow(gfx::GetXDisplay(), glx_window_); glx_window_ = 0; } - if (window_ != gfx::kNullAcceleratedWidget) { + if (window_ != x11::Window::None) { UnregisterEvents(); - XDestroyWindow(gfx::GetXDisplay(), static_cast<uint32_t>(window_)); - window_ = gfx::kNullAcceleratedWidget; - XFlush(gfx::GetXDisplay()); + x11::Connection::Get()->DestroyWindow({window_}); + window_ = x11::Window::None; + x11::Connection::Get()->Flush(); } } @@ -830,7 +840,7 @@ void* NativeViewGLSurfaceGLX::GetConfig() { if (!config_) - config_ = GetConfigForWindow(gfx::GetXDisplay(), window_); + config_ = GetConfigForWindow(x11::Connection::Get(), window_); return config_; } @@ -900,7 +910,7 @@ const gfx::Size& size) : size_(size), config_(nullptr), - window_(gfx::kNullAcceleratedWidget), + window_(x11::Window::None), glx_window_(0) { // Ensure that we don't create a window with zero size. if (size_.GetArea() == 0) @@ -908,16 +918,15 @@ } bool UnmappedNativeViewGLSurfaceGLX::Initialize(GLSurfaceFormat format) { - DCHECK_EQ(window_, gfx::kNullAcceleratedWidget); + DCHECK_EQ(window_, x11::Window::None); auto parent_window = ui::GetX11RootWindow(); auto* conn = x11::Connection::Get(); - auto window = conn->GenerateId<x11::Window>(); - window_ = static_cast<uint32_t>(window); + window_ = conn->GenerateId<x11::Window>(); conn->CreateWindow({ .depth = g_depth, - .wid = window, + .wid = window_, .parent = parent_window, .width = size_.width(), .height = size_.height(), @@ -947,9 +956,9 @@ glXDestroyWindow(gfx::GetXDisplay(), glx_window_); glx_window_ = 0; } - if (window_ != gfx::kNullAcceleratedWidget) { - XDestroyWindow(gfx::GetXDisplay(), static_cast<uint32_t>(window_)); - window_ = gfx::kNullAcceleratedWidget; + if (window_ != x11::Window::None) { + x11::Connection::Get()->DestroyWindow({window_}); + window_ = x11::Window::None; } } @@ -973,7 +982,7 @@ void* UnmappedNativeViewGLSurfaceGLX::GetConfig() { if (!config_) - config_ = GetConfigForWindow(gfx::GetXDisplay(), window_); + config_ = GetConfigForWindow(x11::Connection::Get(), window_); return config_; }
diff --git a/ui/gl/gl_surface_glx.h b/ui/gl/gl_surface_glx.h index f09b345..88a1e337 100644 --- a/ui/gl/gl_surface_glx.h +++ b/ui/gl/gl_surface_glx.h
@@ -106,7 +106,9 @@ // Checks if event is Expose for child window. bool CanHandleEvent(x11::Event* xevent); - gfx::AcceleratedWidget window() const { return window_; } + gfx::AcceleratedWidget window() const { + return static_cast<gfx::AcceleratedWidget>(window_); + } private: // The handle for the drawable to make current or swap. @@ -116,7 +118,7 @@ gfx::AcceleratedWidget parent_window_; // Child window, used to control resizes so that they're in-order with GL. - gfx::AcceleratedWidget window_; + x11::Window window_; // GLXDrawable for the window. GLXWindow glx_window_; @@ -155,7 +157,7 @@ gfx::Size size_; GLXFBConfig config_; // Unmapped dummy window, used to provide a compatible surface. - gfx::AcceleratedWidget window_; + x11::Window window_; // GLXDrawable for the window. GLXWindow glx_window_;
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc index b6132216..589cbc8 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc
@@ -337,6 +337,7 @@ return false; } + DisableConnectedConnectorsToCrtcs(resources); ResetConnectorsCache(resources); unsigned int num_crtcs_with_out_fence_ptr = 0; @@ -393,4 +394,27 @@ return true; } +void HardwareDisplayPlaneManager::DisableConnectedConnectorsToCrtcs( + const ScopedDrmResourcesPtr& resources) { + // Should only be called when no CRTC state has been set yet because we + // hard-disable CRTCs. + DCHECK(crtc_state_.empty()); + + for (int i = 0; i < resources->count_connectors; ++i) { + ScopedDrmConnectorPtr connector = + drm_->GetConnector(resources->connectors[i]); + if (!connector) + continue; + // Disable Zombie connectors (disconnected connectors but holding to an + // encoder). + if (connector->encoder_id && + connector->connection == DRM_MODE_DISCONNECTED) { + ScopedDrmEncoderPtr encoder( + drmModeGetEncoder(drm_->get_fd(), connector->encoder_id)); + if (encoder) + drm_->DisableCrtc(encoder->crtc_id); + } + } +} + } // namespace ui
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h index b2443c9..196d3d5 100644 --- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h
@@ -184,6 +184,16 @@ bool InitializeCrtcState(); + // As the CRTC is being initialized, all connectors connected to it should + // be disabled. This is a workaround for a bug on Hatch where Puff enables + // a connector in dev mode before Chrome even starts. The kernel maps the HW + // state at initial modeset (with a dangling connector attached to a CRTC). + // When an Atomic Modeset is performed, it fails to modeset as the CRTC is + // already attached to another dead connector. (Analysis: crbug/1067121#c5) + // TODO(b/168154314): Remove this call when the bug is fixed. + void DisableConnectedConnectorsToCrtcs( + const ScopedDrmResourcesPtr& resources); + virtual bool InitializePlanes() = 0; virtual bool SetPlaneData(HardwareDisplayPlaneList* plane_list,
diff --git a/ui/views/README.md b/ui/views/README.md new file mode 100644 index 0000000..f7c8b19d --- /dev/null +++ b/ui/views/README.md
@@ -0,0 +1,10 @@ +# Views UI Toolkit +The Views UI Toolkit (aka Views) powers the UI on Windows, Mac, Linux, and +ChromeOS. + +# Documentation +Find the documentation for Views at the [Chromium UI Platform Doc site](/docs/ui/index.md). + +# Contact +Need to contact the team? +E-mail [views@chromium.org](mailto:views@chromium.org).
diff --git a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc index 055114c9..667bded1 100644 --- a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc +++ b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
@@ -24,6 +24,7 @@ #include "ui/gfx/x/x11.h" #include "ui/gfx/x/x11_atom_cache.h" #include "ui/gfx/x/x11_path.h" +#include "ui/gfx/x/xproto.h" #include "ui/views/test/widget_test.h" #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" #include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h" @@ -144,11 +145,13 @@ // Creates and shows an X window with |bounds|. x11::Window CreateAndShowXWindow(const gfx::Rect& bounds) { x11::Window root = ui::GetX11RootWindow(); - x11::Window window = static_cast<x11::Window>( - XCreateSimpleWindow(xdisplay(), static_cast<uint32_t>(root), 0, 0, 1, 1, - 0, // border_width - 0, // border - 0)); // background + auto window = connection()->GenerateId<x11::Window>(); + connection()->CreateWindow({ + .wid = window, + .parent = root, + .width = 1, + .height = 1, + }); ui::SetUseOSWindowFrame(window, false); ShowAndSetXWindowBounds(window, bounds); @@ -168,6 +171,7 @@ CWX | CWY | CWWidth | CWHeight, &changes); } + x11::Connection* connection() { return x11::Connection::Get(); } Display* xdisplay() { return gfx::GetXDisplay(); } // Returns the topmost X window at the passed in screen position. @@ -261,7 +265,7 @@ EXPECT_EQ(window1, FindTopmostLocalProcessWindowWithIgnore(150, 195, window3)); - XDestroyWindow(xdisplay(), static_cast<uint32_t>(x11_window2)); + connection()->DestroyWindow({x11_window2}); } // Test that the minimized state is properly handled. @@ -298,7 +302,7 @@ EXPECT_NE(x11_window1, FindTopmostXWindowAt(350, 150)); EXPECT_NE(x11_window2, FindTopmostXWindowAt(350, 150)); - XDestroyWindow(xdisplay(), static_cast<uint32_t>(x11_window2)); + connection()->DestroyWindow({x11_window2}); } // Test that non-rectangular windows are properly handled. @@ -342,7 +346,7 @@ EXPECT_NE(window1, FindTopmostXWindowAt(305, 105)); EXPECT_NE(window2, FindTopmostXWindowAt(305, 105)); - XDestroyWindow(xdisplay(), static_cast<uint32_t>(window2)); + connection()->DestroyWindow({window2}); } // Test that a window with an empty shape are properly handled. @@ -399,19 +403,19 @@ x11::Window window = CreateAndShowXWindow(gfx::Rect(100, 100, 100, 100)); x11::Window root = ui::GetX11RootWindow(); - XSetWindowAttributes swa; - swa.override_redirect = true; - x11::Window menu_window = static_cast<x11::Window>(XCreateWindow( - xdisplay(), static_cast<uint32_t>(root), 0, 0, 1, 1, - 0, // border width - static_cast<int>(x11::WindowClass::CopyFromParent), // depth - static_cast<int>(x11::WindowClass::InputOutput), - nullptr, // visual - CWOverrideRedirect, &swa)); - { - ui::SetAtomProperty(menu_window, "_NET_WM_WINDOW_TYPE", "ATOM", - gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU")); - } + auto menu_window = connection()->GenerateId<x11::Window>(); + connection()->CreateWindow({ + .wid = menu_window, + .parent = root, + .width = 1, + .height = 1, + .c_class = x11::WindowClass::CopyFromParent, + .override_redirect = x11::Bool32(true), + }); + + ui::SetAtomProperty(menu_window, "_NET_WM_WINDOW_TYPE", "ATOM", + gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU")); + ui::SetUseOSWindowFrame(menu_window, false); ShowAndSetXWindowBounds(menu_window, gfx::Rect(140, 110, 100, 100)); ui::X11EventSource::GetInstance()->DispatchXEvents(); @@ -425,8 +429,8 @@ EXPECT_EQ(menu_window, FindTopmostXWindowAt(150, 120)); EXPECT_EQ(menu_window, FindTopmostXWindowAt(210, 120)); - XDestroyWindow(xdisplay(), static_cast<uint32_t>(window)); - XDestroyWindow(xdisplay(), static_cast<uint32_t>(menu_window)); + connection()->DestroyWindow({window}); + connection()->DestroyWindow({menu_window}); } } // namespace views
diff --git a/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/SiteSettingsTest.java b/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/SiteSettingsTest.java index bfba019..b6849c73 100644 --- a/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/SiteSettingsTest.java +++ b/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/SiteSettingsTest.java
@@ -28,6 +28,8 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.chromium.base.test.util.DisabledTest; + /** * Tests the behavior of the Site Settings UI. */ @@ -100,6 +102,7 @@ @Test @SmallTest @MinWebLayerVersion(84) + @DisabledTest(message = "TODO(crbug.com/1128184): Fix flakiness.") public void testSingleSiteLocationAccess() throws InterruptedException { try { Intents.init();
diff --git a/weblayer/browser/download_browsertest.cc b/weblayer/browser/download_browsertest.cc index c05a0eba..c44c8c8 100644 --- a/weblayer/browser/download_browsertest.cc +++ b/weblayer/browser/download_browsertest.cc
@@ -24,6 +24,7 @@ #include "weblayer/public/navigation_controller.h" #include "weblayer/shell/browser/shell.h" #include "weblayer/test/test_navigation_observer.h" +#include "weblayer/test/weblayer_browser_test_utils.h" namespace weblayer { @@ -284,7 +285,10 @@ // Add an initial navigation to avoid the tab being deleted if the first // navigation is a download, since we use the tab for convenience in the // lambda. + OneShotNavigationObserver observer(shell()); shell()->tab()->GetNavigationController()->Navigate(GURL("about:blank")); + observer.WaitForNavigation(); + set_started_callback(base::BindLambdaForTesting([&](Download* download) { download->Pause(); GURL url = embedded_test_server()->GetURL(
diff --git a/weblayer/browser/navigation_browsertest.cc b/weblayer/browser/navigation_browsertest.cc index ba8caf7c..d05458f 100644 --- a/weblayer/browser/navigation_browsertest.cc +++ b/weblayer/browser/navigation_browsertest.cc
@@ -84,59 +84,6 @@ Callback failed_callback_; }; -class OneShotNavigationObserver : public NavigationObserver { - public: - explicit OneShotNavigationObserver(Shell* shell) : tab_(shell->tab()) { - tab_->GetNavigationController()->AddObserver(this); - } - - ~OneShotNavigationObserver() override { - tab_->GetNavigationController()->RemoveObserver(this); - } - - void WaitForNavigation() { run_loop_.Run(); } - - bool completed() { return completed_; } - bool is_error_page() { return is_error_page_; } - bool is_download() { return is_download_; } - bool is_reload() { return is_reload_; } - bool was_stop_called() { return was_stop_called_; } - Navigation::LoadError load_error() { return load_error_; } - int http_status_code() { return http_status_code_; } - NavigationState navigation_state() { return navigation_state_; } - - private: - // NavigationObserver implementation: - void NavigationCompleted(Navigation* navigation) override { - completed_ = true; - Finish(navigation); - } - - void NavigationFailed(Navigation* navigation) override { Finish(navigation); } - - void Finish(Navigation* navigation) { - is_error_page_ = navigation->IsErrorPage(); - is_download_ = navigation->IsDownload(); - is_reload_ = navigation->IsReload(); - was_stop_called_ = navigation->WasStopCalled(); - load_error_ = navigation->GetLoadError(); - http_status_code_ = navigation->GetHttpStatusCode(); - navigation_state_ = navigation->GetState(); - run_loop_.Quit(); - } - - base::RunLoop run_loop_; - Tab* tab_; - bool completed_ = false; - bool is_error_page_ = false; - bool is_download_ = false; - bool is_reload_ = false; - bool was_stop_called_ = false; - Navigation::LoadError load_error_ = Navigation::kNoError; - int http_status_code_ = 0; - NavigationState navigation_state_ = NavigationState::kWaitingResponse; -}; - } // namespace class NavigationBrowserTest : public WebLayerBrowserTest {
diff --git a/weblayer/browser/weblayer_variations_http_browsertest.cc b/weblayer/browser/weblayer_variations_http_browsertest.cc index 5b6ea6d..6db7051 100644 --- a/weblayer/browser/weblayer_variations_http_browsertest.cc +++ b/weblayer/browser/weblayer_variations_http_browsertest.cc
@@ -12,59 +12,11 @@ #include "net/test/embedded_test_server/http_response.h" #include "weblayer/public/navigation.h" #include "weblayer/public/navigation_controller.h" -#include "weblayer/public/navigation_observer.h" #include "weblayer/public/tab.h" #include "weblayer/shell/browser/shell.h" #include "weblayer/test/weblayer_browser_test_utils.h" namespace weblayer { -namespace { - -class OneShotNavigationObserver : public NavigationObserver { - public: - explicit OneShotNavigationObserver(Shell* shell) : tab_(shell->tab()) { - tab_->GetNavigationController()->AddObserver(this); - } - - ~OneShotNavigationObserver() override { - tab_->GetNavigationController()->RemoveObserver(this); - } - - void WaitForNavigation() { run_loop_.Run(); } - - bool completed() { return completed_; } - bool is_error_page() { return is_error_page_; } - Navigation::LoadError load_error() { return load_error_; } - int http_status_code() { return http_status_code_; } - NavigationState navigation_state() { return navigation_state_; } - - private: - // NavigationObserver implementation: - void NavigationCompleted(Navigation* navigation) override { - completed_ = true; - Finish(navigation); - } - - void NavigationFailed(Navigation* navigation) override { Finish(navigation); } - - void Finish(Navigation* navigation) { - is_error_page_ = navigation->IsErrorPage(); - load_error_ = navigation->GetLoadError(); - http_status_code_ = navigation->GetHttpStatusCode(); - navigation_state_ = navigation->GetState(); - run_loop_.Quit(); - } - - base::RunLoop run_loop_; - Tab* tab_; - bool completed_ = false; - bool is_error_page_ = false; - Navigation::LoadError load_error_ = Navigation::kNoError; - int http_status_code_ = 0; - NavigationState navigation_state_ = NavigationState::kWaitingResponse; -}; - -} // namespace // The purpose of this test is to verify Variations code is correctly wired up // for WebLayer. It's not intended to replicate VariationsHttpHeadersBrowserTest
diff --git a/weblayer/test/weblayer_browser_test_utils.cc b/weblayer/test/weblayer_browser_test_utils.cc index cc5607f..4d920f8 100644 --- a/weblayer/test/weblayer_browser_test_utils.cc +++ b/weblayer/test/weblayer_browser_test_utils.cc
@@ -95,4 +95,37 @@ std::make_unique<StubAutofillProvider>(on_received_form_data)); } +OneShotNavigationObserver::OneShotNavigationObserver(Shell* shell) + : tab_(shell->tab()) { + tab_->GetNavigationController()->AddObserver(this); +} + +OneShotNavigationObserver::~OneShotNavigationObserver() { + tab_->GetNavigationController()->RemoveObserver(this); +} + +void OneShotNavigationObserver::WaitForNavigation() { + run_loop_.Run(); +} + +void OneShotNavigationObserver::NavigationCompleted(Navigation* navigation) { + completed_ = true; + Finish(navigation); +} + +void OneShotNavigationObserver::NavigationFailed(Navigation* navigation) { + Finish(navigation); +} + +void OneShotNavigationObserver::Finish(Navigation* navigation) { + is_error_page_ = navigation->IsErrorPage(); + is_download_ = navigation->IsDownload(); + is_reload_ = navigation->IsReload(); + was_stop_called_ = navigation->WasStopCalled(); + load_error_ = navigation->GetLoadError(); + http_status_code_ = navigation->GetHttpStatusCode(); + navigation_state_ = navigation->GetState(); + run_loop_.Quit(); +} + } // namespace weblayer
diff --git a/weblayer/test/weblayer_browser_test_utils.h b/weblayer/test/weblayer_browser_test_utils.h index f3dd48b1..b5878b8 100644 --- a/weblayer/test/weblayer_browser_test_utils.h +++ b/weblayer/test/weblayer_browser_test_utils.h
@@ -7,8 +7,11 @@ #include "base/callback_forward.h" #include "base/optional.h" +#include "base/run_loop.h" #include "base/strings/string16.h" #include "base/values.h" +#include "weblayer/public/navigation.h" +#include "weblayer/public/navigation_observer.h" class GURL; @@ -61,6 +64,42 @@ const base::RepeatingCallback<void(const autofill::FormData&)>& on_received_form_data); +class OneShotNavigationObserver : public NavigationObserver { + public: + explicit OneShotNavigationObserver(Shell* shell); + + ~OneShotNavigationObserver() override; + + void WaitForNavigation(); + + bool completed() { return completed_; } + bool is_error_page() { return is_error_page_; } + bool is_download() { return is_download_; } + bool is_reload() { return is_reload_; } + bool was_stop_called() { return was_stop_called_; } + Navigation::LoadError load_error() { return load_error_; } + int http_status_code() { return http_status_code_; } + NavigationState navigation_state() { return navigation_state_; } + + private: + // NavigationObserver implementation: + void NavigationCompleted(Navigation* navigation) override; + void NavigationFailed(Navigation* navigation) override; + + void Finish(Navigation* navigation); + + base::RunLoop run_loop_; + Tab* tab_; + bool completed_ = false; + bool is_error_page_ = false; + bool is_download_ = false; + bool is_reload_ = false; + bool was_stop_called_ = false; + Navigation::LoadError load_error_ = Navigation::kNoError; + int http_status_code_ = 0; + NavigationState navigation_state_ = NavigationState::kWaitingResponse; +}; + } // namespace weblayer #endif // WEBLAYER_TEST_WEBLAYER_BROWSER_TEST_UTILS_H_