diff --git a/DEPS b/DEPS index 86b8c2b..4d475ca 100644 --- a/DEPS +++ b/DEPS
@@ -310,7 +310,7 @@ # 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': 'b1d73cf5f0581e3bc06bd212565e90c816e5a8df', + 'skia_revision': 'a9130b2e6906d6834f5b6a237ca9ed37fe38a8bf', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # 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 ANGLE # and whatever else without interference from each other. - 'angle_revision': '0630644c23299e541b15c61c4ca9fba281145b0e', + 'angle_revision': '493bab09b564f9cfa6333f92baf3abadcb5a57db', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -326,7 +326,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '3c226cd176f7cf0fb8a3c7d50c5b23d0968c5ed7', + 'pdfium_revision': 'e10b8b664f8ad24e89a0ab46c42e20ac82a7e7aa', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -361,7 +361,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. - 'freetype_revision': '8e68439a6ffc9e489a70f2c278a016fe15394abf', + 'freetype_revision': '33ceac2afc3608be2d12b3dece071a91e34c3062', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. @@ -381,7 +381,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': '14d227abed32499b0038bb58050a952d0d9c0c32', + 'catapult_revision': 'fcf15b9b7bb20025fee0cff0c7c4ec8b867faf7a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -389,7 +389,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': 'fd2ae9a89decd8c56f67b0e897096add49bbefcc', + 'devtools_frontend_revision': 'e7e4b5774494c5a8614c76d8fab9461262c17361', # 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. @@ -425,7 +425,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': 'a9a36e064101ebe70e65de3da7175bdd6d297a02', + 'dawn_revision': '91fc1fd57e50f3825f7ee1ba6166a9e5e1093797', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -493,7 +493,7 @@ # If you change this, also update the libc++ revision in # //buildtools/deps_revisions.gni. - 'libcxx_revision': 'e2f63a1a48a3cdcacbfc212236050ca5deeacc30', + 'libcxx_revision': 'e73c46522412e2e53f4bfa2a9caf14fa0e0c7cd8', # GN CIPD package version. 'gn_version': 'git_revision:cc28efe62ef0c2fb32455f414a29c4a55bb7fbc4', @@ -975,7 +975,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': 'Is8uteQpDOZkyPAYfFDv2xzhwkI22rad5XI774XLUqMC', + 'version': 't9JpmXB7WnNcqmS_a_S1Kj6oXo0GGgo1R7ba8dTZXKgC', }, ], 'condition': 'checkout_android', @@ -1218,13 +1218,13 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'dca14bc463857bd2a0fee59c86ffa289b535d5d3', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '421c4fe8d0a7782de576b8440a6ca32dc48c3782', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), 'src/third_party/devtools-frontend-internal': { - 'url': 'https://chrome-internal.googlesource.com/devtools/devtools-internal.git' + '@' + '0ee54b41e8ae6c9b6d422673021e4ba2c5beb6ea', + 'url': 'https://chrome-internal.googlesource.com/devtools/devtools-internal.git' + '@' + 'e63bf854096c3f99a4e823149da3b5c74b9cc4d5', 'condition': 'checkout_src_internal', }, @@ -1793,10 +1793,10 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'd1b65aa5a88f6efd900604dfcda840154e9f16e2', 'src/third_party/webgpu-cts/src': - Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'fc6864066b49a7c49f15bb354155af416e9f2e0c', + Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '0fee76f32e7bf08d5799ea2b073bc70e313f6d06', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'babdaa862321bb53a45f38167d3cb84f3de246c6', + Var('webrtc_git') + '/src.git' + '@' + 'acd375723b14a418402260a04fbd525fe8592fe9', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1826,7 +1826,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/linux-amd64', - 'version': 'XXyhhDL9TuGs6KyzXXakE4eaVnpYMXz8DKbnU5Ew3aAC', + 'version': 'C6ORhWPGTAD-OiqYaLuZ-zJBwdBndRNTjCdUCVDJ5qkC', }, ], 'dep_type': 'cipd', @@ -1836,7 +1836,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/windows-amd64', - 'version': 'DCjjZXPp2-aMyq92DomOu_HdsBScNrumV-n3sIRYCfAC', + 'version': 'JC-5wBqTAlkmWfg6n74WF5jgf2HxvHT7fx-wTfz0OqYC', }, ], 'dep_type': 'cipd', @@ -1847,7 +1847,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/mac-amd64', - 'version': 'FyHlZdO9A-oMbWsU1rxpkz2dOtU4aOPBSJx9YQF_CLoC', + 'version': 'BPDLaVlOGtQ_hg6yiAr4PXk0x_7MHKrF6eCMos2EsGUC', }, ], 'dep_type': 'cipd', @@ -1858,7 +1858,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/mac-arm64', - 'version': 'K3uVqbmFCdJI0hGDotZSM9kPdXQNp7oIGy7pykJInqAC', + 'version': 'jlDLLpfmnZhh8JXbe-APEB1MB3rL8A_DZRfgESIFivsC', }, ], 'dep_type': 'cipd', @@ -1869,7 +1869,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@147252ebc94d20ca285c5a9eb1a49eabf1dd43db', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@03d138205eabdf59ec3aaec4e015ac60d9e71c8c', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/docs/developer-ui.md b/android_webview/docs/developer-ui.md index b9682c0..ec55c69 100644 --- a/android_webview/docs/developer-ui.md +++ b/android_webview/docs/developer-ui.md
@@ -155,39 +155,21 @@ Finch experiment), we **highly encourage** you to [add to ProductionSupportedFlagList](/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java): -1. Since ProductionSupportedFlagList is in Java, you will need to autogenerate - a Java constant for your flag. See [these - docs](/docs/android_accessing_cpp_features_in_java.md) if your code is behind - a `base::Feature` or [these - docs](/docs/android_accessing_cpp_switches_in_java.md) if it is behind a - commandline switch ([example - CL](https://chromium-review.googlesource.com/c/chromium/src/+/2429252)). -2. Add your switch/feature to the list with a brief description (this - description will be visible to users). If your feature depends on enabling a - different feature too, this is a good spot to call that out. -3. Run `android_webview/tools/generate_flag_labels.py` to generate labels for - `enums.xml` ([example - CL](https://chromium-review.googlesource.com/c/chromium/src/+/3016396)). Note - that this is only a best-effort attempt to generate correct labels, so you - may need to [modify the - script](https://source.chromium.org/chromium/chromium/src/+/main:android_webview/tools/generate_flag_labels.py;l=46;drc=cf0fb02287669436154b83bf862b4be38226016c) - if you think it made a mistake. See +1. You can list the feature flag name directly. This will be autochecked when + sending a Finch change to ensure it's not misspelt. +2. See [this doc](/tools/metrics/histograms/README.md#Flag-Histograms) for more info - about flag labels. + about flag labels if you want histogram data about usage. Exposing your feature this way has several benefits: - This improves the manual test process. Testers can enable your feature with a button click instead of an adb command. -- Typo-free: someone could mistype a flag or feature name in the commandline, - but this UI ensures flag names are always spelled correctly. - Because this works on production Android devices, test team can validate your feature on devices from other OEMs. - You (and teammates) can dogfood your feature. - If users or third-party app developers report bugs, this UI is the only way they can toggle your feature to help root-cause the regression. -- You can see metrics for your feature's adoption with the - "Launch.FlagsAtStartup" histogram. ### See also
diff --git a/android_webview/java/src/org/chromium/android_webview/common/OWNERS b/android_webview/java/src/org/chromium/android_webview/common/OWNERS new file mode 100644 index 0000000..0251193 --- /dev/null +++ b/android_webview/java/src/org/chromium/android_webview/common/OWNERS
@@ -0,0 +1 @@ +per-file ProductionSupportedFlagList.java=*
diff --git a/android_webview/java/src/org/chromium/android_webview/common/PRESUBMIT.py b/android_webview/java/src/org/chromium/android_webview/common/PRESUBMIT.py deleted file mode 100644 index f74be996..0000000 --- a/android_webview/java/src/org/chromium/android_webview/common/PRESUBMIT.py +++ /dev/null
@@ -1,25 +0,0 @@ -# Copyright 2020 The Chromium Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -"""Presubmit tests for ProductionSupportedFlagList.java -""" - -USE_PYTHON3 = True - - -import os -import sys - -def _SetupImportPath(input_api): - android_webview_common_dir = input_api.PresubmitLocalPath() - _CHROMIUM_SRC = os.path.join(android_webview_common_dir, os.pardir, os.pardir, - os.pardir, os.pardir, os.pardir, os.pardir, os.pardir) - sys.path.append(os.path.join(_CHROMIUM_SRC, 'android_webview', 'tools')) - -def CheckChangeOnUpload(input_api, output_api): - _SetupImportPath(input_api) - import generate_flag_labels - results = [] - results.extend(generate_flag_labels.CheckMissingWebViewEnums(input_api, - output_api)) - return results
diff --git a/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java b/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java index a2ec8d3..576f059 100644 --- a/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java +++ b/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java
@@ -165,13 +165,6 @@ "Enables parsing dependent locality fields (e.g. Bairros in Brazil)."), Flag.baseFeature(AutofillFeatures.AUTOFILL_ENABLE_RANKING_FORMULA, "Enables new autofill suggestion ranking formula"), - Flag.baseFeature(AutofillFeatures.AUTOFILL_ENABLE_SUPPORT_FOR_MORE_STRUCTURE_IN_NAMES, - "Enables support for names with a rich structure including multiple last " - + "names."), - Flag.baseFeature( - AutofillFeatures.AUTOFILL_ENABLE_SUPPORT_FOR_MORE_STRUCTURE_IN_ADDRESSES, - "Enables support for address with a rich structure including separate street " - + "names and house numberse."), Flag.baseFeature(AutofillFeatures.AUTOFILL_ENABLE_AUGMENTED_PHONE_COUNTRY_CODE, "Enables support for phone code number fields with additional text."), Flag.baseFeature(AutofillFeatures.AUTOFILL_ENFORCE_DELAYS_IN_STRIKE_DATABASE,
diff --git a/android_webview/tools/generate_flag_labels.py b/android_webview/tools/generate_flag_labels.py deleted file mode 100755 index 8f89acf4..0000000 --- a/android_webview/tools/generate_flag_labels.py +++ /dev/null
@@ -1,327 +0,0 @@ -#!/usr/bin/env vpython3 -# -# Copyright 2020 The Chromium Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -"""Helps generate enums.xml from ProductionSupportedFlagList. - -This is only a best-effort attempt to generate enums.xml values for the -LoginCustomFlags enum. You need to verify this script picks the right string -value for the new features and double check the hash value by running -"AboutFlagsHistogramTest.*". -""" - -from __future__ import print_function - -import argparse -import os -import re -import hashlib -import ctypes -import xml.etree.ElementTree as ET -import logging -import sys - -_CHROMIUM_SRC = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) -sys.path.append(os.path.join(_CHROMIUM_SRC, 'third_party', 'catapult', 'devil')) -from devil.utils import logging_common # pylint: disable=wrong-import-position - -_FLAG_LIST_FILE = os.path.join(_CHROMIUM_SRC, 'android_webview', 'java', 'src', - 'org', 'chromium', 'android_webview', 'common', - 'ProductionSupportedFlagList.java') -_ENUMS_XML_FILE = os.path.join(_CHROMIUM_SRC, 'tools', 'metrics', 'histograms', - 'enums.xml') -_SCRIPT_PATH = '//android_webview/tools/generate_flag_labels.py' - -# This script tries to guess the commandline switch/base::Feature name from the -# generated Java constant (assuming the constant name follows typical -# conventions), but sometimes the script generates the incorrect name. -# Once you update the KNOWN_MISTAKES dictionary, re-run the tool (either invoke -# this script directly or run the git-cl presubmit check) and it should generate -# the correct integer hash value for enums.xml. -# -# Keys are the names autogenerated by this script's logic, values are the actual -# string names used to define the base::Feature or commandline switch in C++ -# code. -# -# pylint: disable=line-too-long -# yapf: disable -KNOWN_MISTAKES = { - # 'AutogeneratedName': 'CorrectName', - 'WebViewAccelerateSmallCanvases': 'WebviewAccelerateSmallCanvases', - 'Canvas2dStaysGpuOnReadback': 'Canvas2dStaysGPUOnReadback', - 'EnableSharedImageForWebView': 'EnableSharedImageForWebview', - 'GmsCoreEmoji': 'GMSCoreEmoji', - 'KeyboardAccessoryPaymentVirtualCardFeature': 'IPH_KeyboardAccessoryPaymentVirtualCard', - 'CompositeBgColorAnimation': 'CompositeBGColorAnimation', - 'enable-http2-grease-settings': 'http2-grease-settings', - 'AvoidUnnecessaryBeforeUnloadCheckPostTask': 'AvoidUnnecessaryBeforeUnloadCheck', - 'AutofillShadowDom': 'AutofillShadowDOM', - 'HtmlParamElementUrlSupport': 'HTMLParamElementUrlSupport', - 'webview-mp-arch-fenced-frames': 'webview-mparch-fenced-frames', - 'ThrottleIntersectionObserverUma': 'ThrottleIntersectionObserverUMA', - 'RemoveCanceledTasksInTaskQueue': 'RemoveCanceledTasksInTaskQueue2', - 'CssOverflowForReplacedElements': 'CSSOverflowForReplacedElements', - # The final entry should have a trailing comma for cleaner diffs. You may - # remove the entry from this dictionary when it's time to delete the - # corresponding base::Feature or commandline switch. -} -# yapf: enable -# pylint: enable=line-too-long - - -def GetSwitchId(label): - """Generate a hash consistent with flags_ui::GetSwitchUMAId().""" - digest = hashlib.md5(label.encode('utf-8')).hexdigest() - first_eight_bytes = digest[:16] - long_value = int(first_eight_bytes, 16) - signed_32bit = ctypes.c_int(long_value).value - return signed_32bit - - -def _Capitalize(value): - value = value[0].upper() + value[1:].lower() - if value == 'Webview': - value = 'WebView' - return value - - -def FormatName(name, convert_to_pascal_case): - """Converts name to the correct format. - - If name is shouty-case (ex. 'SOME_NAME') like a Java constant, then: - * it converts to pascal case (camel case, with the first letter capitalized) - if convert_to_pascal_case == True (ex. 'SomeName') - * it converts to hyphenates name and converts to lower case (ex. - 'some-name') - raises - ValueError if name contains quotation marks like a Java literal (ex. - '"SomeName"') - """ - has_quotes_re = re.compile(r'".*"') - if has_quotes_re.match(name): - raise ValueError('String literals are not supported (got {})'.format(name)) - name = re.sub(r'^[^.]+\.', '', name) - sections = name.split('_') - - if convert_to_pascal_case: - sections = [_Capitalize(section) for section in sections] - return ''.join(sections) - - sections = [section.lower() for section in sections] - return '-'.join(sections) - - -def ConvertNameIfNecessary(name): - """Fixes any names which are known to be autogenerated incorrectly.""" - if name in KNOWN_MISTAKES.keys(): - return KNOWN_MISTAKES.get(name) - return name - - -class Flag: - """Simplified python equivalent of the Flag java class. - - See //android_webview/java/src/org/chromium/android_webview/common/Flag.java - """ - - def __init__(self, name, is_base_feature): - self.name = name - self.is_base_feature = is_base_feature - - -class EnumValue: - """Represents a label/value pair consistent with enums.xml.""" - - def __init__(self, label): - self.label = label - self.value = GetSwitchId(label) - - def ToXml(self): - return '<int value="{value}" label="{label}"/>'.format(value=self.value, - label=self.label) - - -class UncheckedEnumValue(EnumValue): - """Like an EnumValue, but value may not be correct.""" - - def __init__(self, label, value): - super().__init__(label) - self.label = label - self.value = value - - -def _GetExistingFlagEnums(): - with open(_ENUMS_XML_FILE) as f: - root = ET.fromstring(f.read()) - all_enums = root.find('enums') - login_custom_flags = all_enums.find('enum[@name="LoginCustomFlags"]') - return { - UncheckedEnumValue(item.get('label'), int(item.get('value'))) - for item in login_custom_flags - } - - -def _RemoveDuplicates(enums, existing_labels): - return [enum for enum in enums if enum.label not in existing_labels] - - -def ExtractFlagsFromJavaLines(lines): - flags = [] - - hanging_name_re = re.compile( - r'(?:\s*Flag\.(?:baseFeature|commandLine)\()?(\S+),') - pending_feature = False - pending_commandline = False - - for line in lines: - if 'baseFeature(' in line: - pending_feature = True - if 'commandLine(' in line: - pending_commandline = True - - if pending_feature and pending_commandline: - raise RuntimeError('Somehow this is both a baseFeature and commandLine ' - 'switch: ({})'.format(line)) - - # This means we saw Flag.baseFeature() or Flag.commandLine() on this or a - # previous line but haven't found that flag's name yet. Check if we can - # find a name in this line. - if pending_feature or pending_commandline: - m = hanging_name_re.search(line) - if m: - name = m.group(1) - try: - formatted_name = FormatName(name, pending_feature) - formatted_name = ConvertNameIfNecessary(formatted_name) - flags.append(Flag(formatted_name, pending_feature)) - pending_feature = False - pending_commandline = False - except ValueError: - logging.warning('String literals are not supported, skipping %s', - name) - return flags - - -def _GetIncorrectWebViewEnums(): - """Find incorrect WebView EnumValue pairs and return the correct output - - This iterates through both ProductionSupportedFlagList and enums.xml and - returns EnumValue pairs for: - - * Any ProductionSupportedFlagList entries which are already in enums.xml but - with the wrong integer hash value - * Any ProductionSupportedFlagList entries which are not yet in enums.xml - - Returns the tuple (enums_need_fixing, enums_to_add): - enums_need_fixing: a set of (correct) EnumValues for any existing enums.xml - values which are currently incorrect. - enums_to_add: a set of EnumValues for anything which isn't already in - enums.xml. - """ - with open(_FLAG_LIST_FILE, 'r') as f: - lines = f.readlines() - flags = ExtractFlagsFromJavaLines(lines) - - enums = [] - for flag in flags: - if flag.is_base_feature: - enums.append(EnumValue(flag.name + ':enabled')) - enums.append(EnumValue(flag.name + ':disabled')) - else: - enums.append(EnumValue(flag.name)) - production_supported_flag_labels = {enum.label for enum in enums} - - # Don't bother checking non-WebView flags. Folks modifying - # ProductionSupportedFlagList shouldn't be responsible for updating - # non-WebView flags. - def is_webview_flag(unchecked_enum): - return unchecked_enum.label in production_supported_flag_labels - - existing_flag_enums = set(filter(is_webview_flag, _GetExistingFlagEnums())) - - # Find the invalid enums and generate the corresponding correct enums - def is_invalid_enum(unchecked_enum): - correct_enum = EnumValue(unchecked_enum.label) - return correct_enum.value != unchecked_enum.value - - enums_need_fixing = { - EnumValue(unchecked_enum.label) - for unchecked_enum in filter(is_invalid_enum, existing_flag_enums) - } - - existing_labels = {enum.label for enum in existing_flag_enums} - enums_to_add = _RemoveDuplicates(enums, existing_labels) - return (enums_need_fixing, enums_to_add) - - -def _GenerateEnumFlagMessage(enums_need_fixing, enums_to_add): - output = '' - enums_path = '//tools/metrics/histograms/enums.xml' - if enums_need_fixing: - output += """\ -It looks like some flags in enums.xml have the wrong 'int value'. This is -probably a mistake in {enums_path}. Please update these flags in enums.xml -to use the following (correct) int values: - -""".format(enums_path=enums_path) - output += '\n'.join( - sorted([' ' + enum.ToXml() for enum in enums_need_fixing])) - - if enums_to_add: - output += """\ -It looks like you added flags to ProductionSupportedFlagList but didn't yet add -the flags to {enums_path}. Please double-check that the following flag labels -are spelled correctly (case-sensitive). You can correct any spelling mistakes by -editing KNOWN_MISTAKES in {script_path}. -Once the spelling is correct, please run this tool again and add the following -to enums.xml: - -""".format(enums_path=enums_path, script_path=_SCRIPT_PATH) - output += '\n'.join(sorted([' ' + enum.ToXml() for enum in enums_to_add])) - - output += """ - -You can run this check again by running the {script_path} tool. -""".format(script_path=_SCRIPT_PATH) - - return output - - -def CheckMissingWebViewEnums(input_api, output_api): - """A presubmit check to find missing flag enums.""" - sources = input_api.AffectedSourceFiles( - lambda affected_file: input_api.FilterSourceFile( - affected_file, - files_to_check=(r'.*\bProductionSupportedFlagList\.java$', ))) - if not sources: - return [] - - enums_need_fixing, enums_to_add = _GetIncorrectWebViewEnums() - if not enums_need_fixing and not enums_to_add: - # Return empty list to tell git-cl presubmit there were no errors. - return [] - - return [ - output_api.PresubmitPromptWarning( - _GenerateEnumFlagMessage(enums_need_fixing, enums_to_add)) - ] - - -def main(): - parser = argparse.ArgumentParser() - - logging_common.AddLoggingArguments(parser) - args = parser.parse_args() - logging_common.InitializeLogging(args) - - enums_need_fixing, enums_to_add = _GetIncorrectWebViewEnums() - if not enums_need_fixing and not enums_to_add: - print('enums.xml is already up-to-date!') - return - - print(_GenerateEnumFlagMessage(enums_need_fixing, enums_to_add)) - - -if __name__ == '__main__': - main()
diff --git a/android_webview/tools/generate_flag_labels_test.py b/android_webview/tools/generate_flag_labels_test.py deleted file mode 100755 index 7585a94..0000000 --- a/android_webview/tools/generate_flag_labels_test.py +++ /dev/null
@@ -1,71 +0,0 @@ -#!/usr/bin/env vpython3 -# -# Copyright 2020 The Chromium Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import unittest - -import generate_flag_labels as gen_labels - - -class _GenerateFlagLabelsTest(unittest.TestCase): - """Unittests for the generate_flag_labels module. - """ - - def testGetSwitchId(self): - # Arbitrarily, this test verifies the WebViewExtraHeadersSameOriginOnly - # feature since we know from field metrics this is logged correctly. - self.assertEqual( - -1988840552, - gen_labels.GetSwitchId('WebViewExtraHeadersSameOriginOnly:disabled')) - - def testFormatName_baseFeature(self): - self.assertEqual('SomeFeature', - gen_labels.FormatName('FooFeatures.SOME_FEATURE', True)) - self.assertEqual( - 'SomeWebViewFeature', - gen_labels.FormatName('FooFeatures.SOME_WEBVIEW_FEATURE', True)) - - def testFormatName_commandLine(self): - self.assertEqual('some-switch', - gen_labels.FormatName('FooSwitches.SOME_SWITCH', False)) - self.assertEqual( - 'some-webview-switch', - gen_labels.FormatName('FooSwitches.SOME_WEBVIEW_SWITCH', False)) - - def testExtractFlagsFromJavaLines(self): - test_data = """ -// Same line -Flag.commandLine(FooSwitches.SOME_SWITCH, - "Some description"), - -// Different line -Flag.commandLine( - FooSwitches.SOME_OTHER_SWITCH, - "Some other description"), - -// Same line -Flag.baseFeature(FooFeatures.SOME_FEATURE, - "Some description"), - -// Different line -Flag.baseFeature( - FooFeatures.SOME_OTHER_FEATURE, - "Some other description"), -""".split('\n') - flags = gen_labels.ExtractFlagsFromJavaLines(test_data) - - self.assertEqual(4, len(flags)) - self.assertEqual('some-switch', flags[0].name) - self.assertFalse(flags[0].is_base_feature) - self.assertEqual('some-other-switch', flags[1].name) - self.assertFalse(flags[1].is_base_feature) - self.assertEqual('SomeFeature', flags[2].name) - self.assertTrue(flags[2].is_base_feature) - self.assertEqual('SomeOtherFeature', flags[3].name) - self.assertTrue(flags[3].is_base_feature) - - -if __name__ == '__main__': - unittest.main()
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 530478b..279d7d6 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1007,6 +1007,10 @@ "style/icon_switch.h", "style/pill_button.cc", "style/pill_button.h", + "style/rounded_label.cc", + "style/rounded_label.h", + "style/rounded_label_widget.cc", + "style/rounded_label_widget.h", "style/scoped_light_mode_as_default.cc", "style/style_util.cc", "style/style_util.h", @@ -2068,10 +2072,6 @@ "wm/overview/overview_wallpaper_controller.h", "wm/overview/overview_window_drag_controller.cc", "wm/overview/overview_window_drag_controller.h", - "wm/overview/rounded_label.cc", - "wm/overview/rounded_label.h", - "wm/overview/rounded_label_widget.cc", - "wm/overview/rounded_label_widget.h", "wm/overview/scoped_overview_animation_settings.cc", "wm/overview/scoped_overview_animation_settings.h", "wm/overview/scoped_overview_hide_windows.cc",
diff --git a/ash/app_list/views/app_list_page.cc b/ash/app_list/views/app_list_page.cc index 7b0aa5fe..55ceb1b 100644 --- a/ash/app_list/views/app_list_page.cc +++ b/ash/app_list/views/app_list_page.cc
@@ -47,7 +47,7 @@ this, GetWidget(), true /* reverse */, false /* dont_loop */); } -void AppListPage::AnimateOpacity(float current_progress, +void AppListPage::AnimateOpacity(AppListViewState current_view_state, AppListViewState target_view_state, const OpacityAnimator& animator) { animator.Run(this, target_view_state != AppListViewState::kClosed);
diff --git a/ash/app_list/views/app_list_page.h b/ash/app_list/views/app_list_page.h index 83f4173..8763ac27 100644 --- a/ash/app_list/views/app_list_page.h +++ b/ash/app_list/views/app_list_page.h
@@ -96,11 +96,10 @@ // Called when the app list view state changes to |target_view_state| to // animate the app list page opacity. - // |current_progress| - the current app list transition progress. // |animator| - callback that when run starts the opacity animation. using OpacityAnimator = base::RepeatingCallback<void(views::View* view, bool target_visibility)>; - virtual void AnimateOpacity(float current_progress, + virtual void AnimateOpacity(AppListViewState current_view_state, AppListViewState target_view_state, const OpacityAnimator& animator);
diff --git a/ash/app_list/views/app_list_view.cc b/ash/app_list/views/app_list_view.cc index 48d0762..fdf3242 100644 --- a/ash/app_list/views/app_list_view.cc +++ b/ash/app_list/views/app_list_view.cc
@@ -573,22 +573,6 @@ } // static -float AppListView::GetTransitionProgressForState(AppListViewState state) { - switch (state) { - case AppListViewState::kClosed: - return 0.0f; - case AppListViewState::kPeeking: - case AppListViewState::kHalf: - return 1.0f; - case AppListViewState::kFullscreenAllApps: - case AppListViewState::kFullscreenSearch: - return 2.0f; - } - NOTREACHED(); - return 0.0f; -} - -// static void AppListView::SetSkipPageResetTimerForTesting(bool enabled) { skip_page_reset_timer_for_testing = enabled; } @@ -1701,60 +1685,6 @@ return current_height; } -float AppListView::GetAppListTransitionProgress(int flags) const { - // During transition between home and overview in tablet mode, the app list - // widget gets scaled down from full screen state - if this is the case, - // the app list layout should match the current app list state, so return - // the progress for the current app list state. - const gfx::Transform transform = GetWidget()->GetLayer()->transform(); - if (delegate_->IsInTabletMode() && transform.IsScaleOrTranslation() && - !transform.IsIdentityOrTranslation()) { - return GetTransitionProgressForState(app_list_state_); - } - - int current_height = GetCurrentAppListHeight(); - if (flags & kProgressFlagWithTransform) { - current_height -= - GetWidget()->GetLayer()->transform().To2dTranslation().y(); - } - - const int fullscreen_height = GetFullscreenStateHeight(); - const int baseline_height = std::min( - fullscreen_height, - (flags & kProgressFlagSearchResults) ? kHalfHeight : kPeekingHeight); - - // If vertical space is limited, the baseline and fullscreen height might be - // the same. To handle this case, if the height has reached the - // baseline/fullscreen height, return either 1.0 or 2.0 progress, depending on - // the current target state. - if (baseline_height == fullscreen_height && - current_height >= fullscreen_height) { - return GetTransitionProgressForState(app_list_state_); - } - - if (current_height <= baseline_height) { - // Currently transition progress is between closed and peeking state. - // Calculate the progress of this transition. - const float shelf_height = - GetScreenBottom() - GetDisplayNearestView().work_area().bottom(); - - // When screen is rotated, the current height might be smaller than shelf - // height for just one moment, which results in negative progress. So force - // the progress to be non-negative. - return std::max(0.0f, (current_height - shelf_height) / - (baseline_height - shelf_height)); - } - - // Currently transition progress is between peeking and fullscreen state. - // Calculate the progress of this transition. - const float fullscreen_height_above_baseline = - fullscreen_height - baseline_height; - const float current_height_above_baseline = current_height - baseline_height; - DCHECK_GT(fullscreen_height_above_baseline, 0); - DCHECK_LE(current_height_above_baseline, fullscreen_height_above_baseline); - return 1 + current_height_above_baseline / fullscreen_height_above_baseline; -} - int AppListView::GetHeightForState(AppListViewState state) const { switch (app_list_state_) { case AppListViewState::kFullscreenAllApps:
diff --git a/ash/app_list/views/app_list_view.h b/ash/app_list/views/app_list_view.h index 5a16a2a..8111fd5 100644 --- a/ash/app_list/views/app_list_view.h +++ b/ash/app_list/views/app_list_view.h
@@ -144,11 +144,6 @@ // after starting. static void SetSkipPageResetTimerForTesting(bool enabled); - // Returns the app list transition progress value associated with a app list - // view state. This matches the values GetAppListTransitionProgress() is - // expected to return when app list view is exactly in the provided state. - static float GetTransitionProgressForState(AppListViewState state); - // Initializes the view, only done once per session. void InitView(gfx::NativeView parent); @@ -264,33 +259,6 @@ // Returns current app list height above display bottom. int GetCurrentAppListHeight() const; - // Flags that can be passed to GetAppListTransitionProgress(). For more - // details, see GetAppListTransitionProgress() documentation. - static constexpr int kProgressFlagNone = 0; - static constexpr int kProgressFlagSearchResults = 1; - static constexpr int kProgressFlagWithTransform = 1 << 1; - - // The progress of app list height transitioning from closed to fullscreen - // state. [0.0, 1.0] means the progress between closed and peeking state, - // while [1.0, 2.0] means the progress between peeking and fullscreen state. - // - // By default, this calculates progress for drag operation while app list - // is AppListState::kApps state, relative to the current app list view bounds. - // The |flags| argument can be used to amend this behavior: - // * Use |kProgressFlagNone| for default behavior. - // * If |kProgressFlagSearchResult| flag is set, the progress will be - // calculated using kHalf state height as baseline. This should be used - // when calculating contents layout for search results state. - // * If |kProgressFlagWithTransform| is set, the progress will be calculated - // for the app list height offset by the current app list view transform. - // This should be used when setting up transform animations for views - // whose bounds depend on the app list height - in particular when the - // animation is implemented by setting up target bounds first, and then - // animating view layer transform from one that matches current bounds to - // an identity transform. This flag is needed to properly calculate the - // initial animation transform. - float GetAppListTransitionProgress(int flags) const; - // Returns the expected app list view height (measured from the screen bottom) // in the provided state. int GetHeightForState(AppListViewState state) const;
diff --git a/ash/app_list/views/apps_container_view.cc b/ash/app_list/views/apps_container_view.cc index 7061d46..28d4c6f 100644 --- a/ash/app_list/views/apps_container_view.cc +++ b/ash/app_list/views/apps_container_view.cc
@@ -88,20 +88,12 @@ // * number of columns in portrait mode constexpr int kPreferredGridRows = 4; -// The range of app list transition progress in which the suggestion chips' -// opacity changes from 0 to 1. -constexpr float kSuggestionChipOpacityStartProgress = 0.66; -constexpr float kSuggestionChipOpacityEndProgress = 1; - // Range of the height of centerline above screen bottom that all apps should // change opacity. NOTE: this is used to change page switcher's opacity as // well. constexpr float kAppsOpacityChangeStart = 8.0f; constexpr float kAppsOpacityChangeEnd = 144.0f; -// The app list transition progress value for fullscreen state. -constexpr float kAppListFullscreenProgressValue = 2.0; - // The amount by which the apps container UI should be offset downwards when // shown on non apps page UI. constexpr int kNonAppsStateVerticalOffset = 24; @@ -891,7 +883,7 @@ } } -void AppsContainerView::AnimateOpacity(float current_progress, +void AppsContainerView::AnimateOpacity(AppListViewState current_view_state, AppListViewState target_view_state, const OpacityAnimator& animator) { if (suggestion_chip_container_view_) { @@ -907,7 +899,8 @@ apps_grid_view_->UpdateOpacity(true /*restore_opacity*/, kAppsOpacityChangeStart, kAppsOpacityChangeEnd); - apps_grid_view_->layer()->SetOpacity(current_progress > 1.0f ? 1.0f : 0.0f); + apps_grid_view_->layer()->SetOpacity( + current_view_state != AppListViewState::kClosed ? 1.0f : 0.0f); } const bool target_grid_visibility = @@ -920,28 +913,18 @@ void AppsContainerView::AnimateYPosition(AppListViewState target_view_state, const TransformAnimator& animator, float default_offset) { - // Apps container position is calculated for app list progress relative to - // peeking state, which may not match the progress value used to calculate - // |default_offset| - when showing search results page, the transform offset - // is calculated using progress relative to AppListViewState::kHalf. - const float progress = - contents_view_->app_list_view()->GetAppListTransitionProgress( - AppListView::kProgressFlagNone | - AppListView::kProgressFlagWithTransform); - const int current_suggestion_chip_y = GetExpectedSuggestionChipY(progress); - const int target_suggestion_chip_y = GetExpectedSuggestionChipY( - AppListView::GetTransitionProgressForState(target_view_state)); - const int offset = current_suggestion_chip_y - target_suggestion_chip_y; + const int target_suggestion_chip_y = + GetExpectedSuggestionChipY(target_view_state); if (suggestion_chip_container_view_) { suggestion_chip_container_view_->SetY(target_suggestion_chip_y); - animator.Run(offset, suggestion_chip_container_view_->layer()); + animator.Run(default_offset, suggestion_chip_container_view_->layer()); } scrollable_container_->SetY(target_suggestion_chip_y + chip_grid_y_distance_); - animator.Run(offset, scrollable_container_->layer()); + animator.Run(default_offset, scrollable_container_->layer()); page_switcher_->SetY(target_suggestion_chip_y + chip_grid_y_distance_); - animator.Run(offset, page_switcher_->layer()); + animator.Run(default_offset, page_switcher_->layer()); } void AppsContainerView::OnTabletModeChanged(bool started) { @@ -960,8 +943,7 @@ // Layout suggestion chips. gfx::Rect chip_container_rect = rect; chip_container_rect.set_y(GetExpectedSuggestionChipY( - contents_view_->app_list_view()->GetAppListTransitionProgress( - AppListView::kProgressFlagNone))); + contents_view_->app_list_view()->app_list_state())); if (suggestion_chip_container_view_) { chip_container_rect.set_height(kSuggestionChipContainerHeight); @@ -992,9 +974,10 @@ // fullscreen and peeking state to avoid resizing the view during // animation and dragging, which is an expensive operation. rect.set_y(chip_container_rect.bottom()); - rect.set_height(rect.height() - - GetExpectedSuggestionChipY(kAppListFullscreenProgressValue) - - chip_container_rect.height()); + rect.set_height( + rect.height() - + GetExpectedSuggestionChipY(AppListViewState::kFullscreenAllApps) - + chip_container_rect.height()); // Layout apps grid. const gfx::Insets grid_insets = apps_grid_view_->GetInsets(); @@ -1286,10 +1269,7 @@ bool restore_opacity) { UpdateContainerOpacityForState(state); - const float progress = - contents_view_->app_list_view()->GetAppListTransitionProgress( - AppListView::kProgressFlagNone); - UpdateContentsOpacity(progress, restore_opacity); + UpdateContentsOpacity(restore_opacity); } void AppsContainerView::UpdatePageBoundsForState( @@ -1299,10 +1279,7 @@ AppListPage::UpdatePageBoundsForState(state, contents_bounds, search_box_bounds); - const float progress = - contents_view_->app_list_view()->GetAppListTransitionProgress( - AppListView::kProgressFlagNone); - UpdateContentsYPosition(progress); + UpdateContentsYPosition(contents_view_->app_list_view()->app_list_state()); } gfx::Rect AppsContainerView::GetPageBoundsForState( @@ -1512,8 +1489,7 @@ layer()->SetOpacity(target_opacity); } -void AppsContainerView::UpdateContentsOpacity(float progress, - bool restore_opacity) { +void AppsContainerView::UpdateContentsOpacity(bool restore_opacity) { apps_grid_view_->UpdateOpacity(restore_opacity, kAppsOpacityChangeStart, kAppsOpacityChangeEnd); @@ -1533,20 +1509,18 @@ if (suggestion_chip_container_view_) { // Changes the opacity of suggestion chips between 0 and 1 when app list - // transition progress changes between |kSuggestionChipOpacityStartProgress| - // and |kSuggestionChipOpacityEndProgress|. - float chips_opacity = - base::clamp((progress - kSuggestionChipOpacityStartProgress) / - (kSuggestionChipOpacityEndProgress - - kSuggestionChipOpacityStartProgress), - 0.0f, 1.0f); + // transition progress changes. + float chips_opacity = contents_view_->app_list_view()->app_list_state() != + AppListViewState::kClosed + ? 1.0f + : 0.0f; suggestion_chip_container_view_->layer()->SetOpacity( restore_opacity ? 1.0 : chips_opacity); } } -void AppsContainerView::UpdateContentsYPosition(float progress) { - const int current_suggestion_chip_y = GetExpectedSuggestionChipY(progress); +void AppsContainerView::UpdateContentsYPosition(AppListViewState state) { + const int current_suggestion_chip_y = GetExpectedSuggestionChipY(state); if (suggestion_chip_container_view_) suggestion_chip_container_view_->SetY(current_suggestion_chip_y); scrollable_container_->SetY(current_suggestion_chip_y + @@ -1575,10 +1549,10 @@ SetViewIgnoredForAccessibility(page_switcher_, disabled); } -int AppsContainerView::GetExpectedSuggestionChipY(float progress) { +int AppsContainerView::GetExpectedSuggestionChipY(AppListViewState state) { const gfx::Rect search_box_bounds = - contents_view_->GetSearchBoxExpectedBoundsForProgress( - AppListState::kStateApps, progress); + contents_view_->GetSearchBoxBoundsForViewState(AppListState::kStateApps, + state); if (!suggestion_chip_container_view_) return search_box_bounds.bottom();
diff --git a/ash/app_list/views/apps_container_view.h b/ash/app_list/views/apps_container_view.h index 6ca546f..af50215a 100644 --- a/ash/app_list/views/apps_container_view.h +++ b/ash/app_list/views/apps_container_view.h
@@ -143,7 +143,7 @@ AppListState state, const gfx::Rect& contents_bounds, const gfx::Rect& search_box_bounds) const override; - void AnimateOpacity(float current_progress, + void AnimateOpacity(AppListViewState current_view_state, AppListViewState target_view_state, const OpacityAnimator& animator) override; void AnimateYPosition(AppListViewState target_view_state, @@ -261,23 +261,24 @@ // Updates the opacity of the apps container elements for the current app list // view position. - // |progress| - The current app list view drag progress. - // |restore_opacity| - Whether the opacity should be restored to the non-drag - // state. - void UpdateContentsOpacity(float progress, bool restore_opacity); + // |restore_opacity| - Whether the opacity should be restored. + + // TODO(crbug.com/1356674): Maybe remove this method or remove + // |restore_opacity| as parameter. + void UpdateContentsOpacity(bool restore_opacity); // Updates the y position of the apps container elements for the current app // list view position. - // |progress| - The current app list view drag progress. - void UpdateContentsYPosition(float progress); + // |view_state| - The app list view state. + void UpdateContentsYPosition(AppListViewState view_state); // Suggestion chips and apps grid view become unfocusable if |disabled| is // true. This is used to trap focus within the folder when it is opened. void DisableFocusForShowingActiveFolder(bool disabled); // Returns expected suggestion chip container's y position based on the app - // list transition progress. - int GetExpectedSuggestionChipY(float progress); + // list view_state. + int GetExpectedSuggestionChipY(AppListViewState view_state); struct GridLayout { int columns;
diff --git a/ash/app_list/views/apps_grid_view.cc b/ash/app_list/views/apps_grid_view.cc index 26cc10c..3ceba9b 100644 --- a/ash/app_list/views/apps_grid_view.cc +++ b/ash/app_list/views/apps_grid_view.cc
@@ -1997,6 +1997,15 @@ UpdatePaging(); ClearDragState(); + if (GetWidget()) { + // Normally Layout() cancels any animations. At this point there may be a + // pending Layout(), force it now so that one isn't triggered part way + // through the animation. Further, ignore this layout so that the position + // isn't reset. + DCHECK(!ignore_layout_); + base::AutoReset<bool> auto_reset(&ignore_layout_, true); + GetWidget()->LayoutRootViewIfNecessary(); + } if (cardified_state_) MaybeEndCardifiedView();
diff --git a/ash/app_list/views/apps_grid_view_unittest.cc b/ash/app_list/views/apps_grid_view_unittest.cc index 0941611..10f3516 100644 --- a/ash/app_list/views/apps_grid_view_unittest.cc +++ b/ash/app_list/views/apps_grid_view_unittest.cc
@@ -5395,5 +5395,57 @@ EXPECT_EQ(shadow_with_keyboard, shadow_after_type); } +// Test that root level item animations run correctly after quickly dragging and +// dropping an item from a folder into the root level grid. +TEST_P(AppsGridViewClamshellAndTabletTest, QuickDragToRemoveItemFromFolder) { + model_->PopulateApps(9); + model_->CreateAndPopulateFolderWithApps(2); + UpdateLayout(); + + AppListItemView* folder_item_view = GetItemViewInTopLevelGrid(9); + + // Open the folder. + EXPECT_TRUE(folder_item_view->is_folder()); + SimulateLeftClickOrTapAt(folder_item_view->GetBoundsInScreen().CenterPoint()); + ASSERT_TRUE(GetAppListTestHelper()->IsInFolderView()); + ASSERT_EQ(2u, folder_apps_grid_view()->view_model()->view_size()); + + AppListItemView* item_in_folder = folder_apps_grid_view()->GetItemViewAt(0); + + // Enable animation times once the folder is open, to test animations when + // dragging items out. + ui::ScopedAnimationDurationScaleMode non_zero_duration_mode( + ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + + // Begin dragging the first item in the folder. + GetEventGenerator()->MoveMouseTo( + item_in_folder->GetBoundsInScreen().CenterPoint()); + GetEventGenerator()->PressLeftButton(); + item_in_folder->FireMouseDragTimerForTest(); + + // Drag item outside of the folder, to slot 0. + const gfx::Point to = + apps_grid_view_->GetItemViewAt(0)->GetIconBoundsInScreen().left_center(); + GetEventGenerator()->MoveMouseTo(to); + + ASSERT_TRUE(folder_apps_grid_view()->has_dragged_item()); + ASSERT_TRUE(folder_apps_grid_view()->IsDragging()); + + // Release drag. + ASSERT_TRUE(folder_apps_grid_view()->FireFolderItemReparentTimerForTest()); + GetEventGenerator()->ReleaseLeftButton(); + ASSERT_FALSE(GetAppListTestHelper()->IsInFolderView()); + EXPECT_EQ(folder_item_view->item()->ChildItemCount(), 1u); + + apps_grid_view_->GetWidget()->LayoutRootViewIfNecessary(); + + // After releasing drag, check that the root item views are still animating. + for (size_t i = 1; i < apps_grid_view_->view_model()->view_size(); i++) { + auto* item_view = apps_grid_view_->view_model()->view_at(i); + EXPECT_TRUE(item_view->layer()->GetAnimator()->is_animating() || + apps_grid_view_->IsAnimatingView(item_view)); + } +} + } // namespace test } // namespace ash
diff --git a/ash/app_list/views/contents_view.cc b/ash/app_list/views/contents_view.cc index 032f284..4ffdbdd 100644 --- a/ash/app_list/views/contents_view.cc +++ b/ash/app_list/views/contents_view.cc
@@ -67,11 +67,6 @@ constexpr int kSearchBoxTopMarginInPeekingAppsPage = 84; constexpr int kSearchBarMinWidth = 440; -// Range of the fraction of app list from collapsed to peeking that search box -// should change opacity. -constexpr float kSearchBoxOpacityStartProgress = 0.11f; -constexpr float kSearchBoxOpacityEndProgress = 1.0f; - // Duration for page transition. constexpr base::TimeDelta kPageTransitionDuration = base::Milliseconds(250); @@ -79,20 +74,6 @@ constexpr base::TimeDelta kOverscrollPageTransitionDuration = base::Milliseconds(50); -// Calculates opacity value for the current app list progress. -// |progress| - The target app list view progress - a value in [0.0, 2.0] -// interval that describes the app list view position relative to -// peeking and fullscreen state. -// |transition_start| - The app list view progress at which opacity equals 0.0. -// |transition_end| - The app list view progress at which opacity equals 1.0. -float GetOpacityForProgress(float progress, - float transition_start, - float transition_end) { - return base::clamp( - (progress - transition_start) / (transition_end - transition_start), 0.0f, - 1.0f); -} - } // namespace ContentsView::ContentsView(AppListView* app_list_view) @@ -503,25 +484,6 @@ size); } -gfx::Rect ContentsView::GetSearchBoxExpectedBoundsForProgress( - AppListState state, - float progress) const { - AppListViewState baseline_state = state == AppListState::kStateSearchResults - ? AppListViewState::kHalf - : AppListViewState::kPeeking; - gfx::Rect bounds = GetSearchBoxBoundsForViewState(state, baseline_state); - - if (progress <= 1) { - bounds.set_y(gfx::Tween::IntValueBetween(progress, 0, bounds.y())); - } else { - const int fullscreen_y = GetSearchBoxTopForViewState( - state, AppListViewState::kFullscreenAllApps); - bounds.set_y( - gfx::Tween::IntValueBetween(progress - 1, bounds.y(), fullscreen_y)); - } - return bounds; -} - bool ContentsView::Back() { // If the virtual keyboard is visible, dismiss the keyboard and return early auto* const keyboard_controller = keyboard::KeyboardUIController::Get(); @@ -645,14 +607,8 @@ ConvertRectToWidgetWithoutTransform(search_box_bounds)); search_box->GetWidget()->SetBounds(search_rect); - float progress = - AppListView::GetTransitionProgressForState(target_view_state()); const bool restore_opacity = target_view_state() != AppListViewState::kClosed; - const float search_box_opacity = - restore_opacity - ? 1.0f - : GetOpacityForProgress(progress, kSearchBoxOpacityStartProgress, - kSearchBoxOpacityEndProgress); + const float search_box_opacity = restore_opacity ? 1.0f : 0.0f; search_box->layer()->SetOpacity(search_box_opacity); for (AppListPage* page : app_list_pages_) { @@ -743,14 +699,8 @@ const AppListState selected_page = target_page_for_last_view_state_update_.value_or( GetStateForPageIndex(pagination_model_.selected_page())); - const int progress_baseline_flag = - selected_page == AppListState::kStateSearchResults - ? AppListView::kProgressFlagSearchResults - : AppListView::kProgressFlagNone; - const float progress = app_list_view_->GetAppListTransitionProgress( - AppListView::kProgressFlagWithTransform | progress_baseline_flag); - const gfx::Rect current_search_box_bounds = - GetSearchBoxExpectedBoundsForProgress(selected_page, progress); + const gfx::Rect current_search_box_bounds = GetSearchBoxBoundsForViewState( + selected_page, app_list_view_->app_list_state()); const int y_offset = current_search_box_bounds.y() - @@ -768,7 +718,7 @@ page->UpdatePageBoundsForState(target_page, GetContentsBounds(), target_search_box_bounds); - page->AnimateOpacity(progress, target_view_state, + page->AnimateOpacity(app_list_view_->app_list_state(), target_view_state, base::BindRepeating(animate_opacity, duration)); page->AnimateYPosition(target_view_state, base::BindRepeating(animate_transform, duration),
diff --git a/ash/app_list/views/contents_view.h b/ash/app_list/views/contents_view.h index b9df6e6..0712846 100644 --- a/ash/app_list/views/contents_view.h +++ b/ash/app_list/views/contents_view.h
@@ -168,12 +168,6 @@ gfx::Rect GetSearchBoxBoundsForViewState(AppListState state, AppListViewState view_state) const; - // Returns the expected search box bounds based on the app list transition - // progress. - // TODO(crbug.com/1356674): Remove |progress| from parameters. - gfx::Rect GetSearchBoxExpectedBoundsForProgress(AppListState state, - float progress) const; - // Performs the 'back' action for the active page. Returns whether the action // was handled. bool Back();
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index ff20a6b..a0fabd2 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -1080,6 +1080,9 @@ <message name="IDS_ASH_SELECT_TO_SPEAK_MENU" desc="The name of the Select-to-speak floating menu."> Select-to-speak menu </message> + <message name="IDS_ASH_SELECT_TO_SPEAK_SPEED_MENU" is_accessibility_with_no_ui="true" desc="The name of the Select-to-speak sub-menu which allows the user to adjust the speed at which text is spoken."> + Speech rate + </message> <message name="IDS_ASH_SWITCH_ACCESS_BACK_BUTTON_DESCRIPTION" desc="The tooltip text for the Switch Access back button. The back button allows users to exit the feature's current focus area."> Back button </message> @@ -1312,7 +1315,7 @@ <!-- Holding space tray--> <message name="IDS_ASH_HOLDING_SPACE_A11Y_NAME" desc="A11y name of the holding space tray and bubble."> - Tote: recent screen captures, downloads, and pinned files + <ph name="HOLDING_SPACE_TITLE">$1</ph>: recent screen captures, downloads, and pinned files </message> <message name="IDS_ASH_HOLDING_SPACE_TITLE" desc="Title of the holding space tray and bubble."> Tote
diff --git a/ash/ash_strings_grd/IDS_ASH_HOLDING_SPACE_A11Y_NAME.png.sha1 b/ash/ash_strings_grd/IDS_ASH_HOLDING_SPACE_A11Y_NAME.png.sha1 index fdde242a..4d9e9a14 100644 --- a/ash/ash_strings_grd/IDS_ASH_HOLDING_SPACE_A11Y_NAME.png.sha1 +++ b/ash/ash_strings_grd/IDS_ASH_HOLDING_SPACE_A11Y_NAME.png.sha1
@@ -1 +1 @@ -92b881183adeee722264758040b985931d297c76 \ No newline at end of file +14321b7b8cd8a7562d793ab777ec09314e7a4bdd \ No newline at end of file
diff --git a/ash/components/settings/cros_settings_names.cc b/ash/components/settings/cros_settings_names.cc index 0757604..963fa4e 100644 --- a/ash/components/settings/cros_settings_names.cc +++ b/ash/components/settings/cros_settings_names.cc
@@ -578,4 +578,7 @@ const char kDeviceEncryptedReportingPipelineEnabled[] = "cros.device.encrypted_reporting_pipeline_enabled"; +// A boolean pref that indicates whether reporting XDR events is enabled or not. +const char kDeviceReportXDREvents[] = "cros.device.device_report_xdr_events"; + } // namespace ash
diff --git a/ash/components/settings/cros_settings_names.h b/ash/components/settings/cros_settings_names.h index 4e119f3..5f6fc379 100644 --- a/ash/components/settings/cros_settings_names.h +++ b/ash/components/settings/cros_settings_names.h
@@ -327,6 +327,9 @@ COMPONENT_EXPORT(ASH_SETTINGS) extern const char kDeviceEncryptedReportingPipelineEnabled[]; +COMPONENT_EXPORT(ASH_SETTINGS) +extern const char kDeviceReportXDREvents[]; + } // namespace ash namespace chromeos {
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index 94475be..583a42a 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -1373,7 +1373,7 @@ // Enables or disables the Quick Settings Network revamp, which updates Network // Quick Settings UI and related infrastructure. See https://crbug.com/1169479. const base::Feature kQuickSettingsNetworkRevamp{ - "QuickSettingsNetworkRevamp", base::FEATURE_DISABLED_BY_DEFAULT}; + "QuickSettingsNetworkRevamp", base::FEATURE_ENABLED_BY_DEFAULT}; // Enables or disables fingerprint quick unlock. const base::Feature kQuickUnlockFingerprint{"QuickUnlockFingerprint",
diff --git a/ash/quick_pair/keyed_service/quick_pair_mediator.cc b/ash/quick_pair/keyed_service/quick_pair_mediator.cc index 928fc9e..b5d84ab3 100644 --- a/ash/quick_pair/keyed_service/quick_pair_mediator.cc +++ b/ash/quick_pair/keyed_service/quick_pair_mediator.cc
@@ -179,6 +179,11 @@ void Mediator::OnRetroactivePairFound(scoped_refptr<Device> device) { QP_LOG(INFO) << __func__ << ": " << device; + // SFUL metrics will cause a crash if Fast Pair is disabled when we + // retroactive pair, so prevent a notification from popping up. + // TODO(b/247148054): Look into moving this elsewhere. + if (!feature_status_tracker_->IsFastPairEnabled()) + return; ui_broker_->ShowAssociateAccount(std::move(device)); }
diff --git a/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc b/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc index 2bbf2fc..ad0f240 100644 --- a/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc +++ b/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc
@@ -413,6 +413,12 @@ fake_retroactive_pairing_detector_->NotifyRetroactivePairFound(device_); } +TEST_F(MediatorTest, DoesntInvokeShowAssociateAccount_FastPairDisabled) { + feature_status_tracker_->SetIsFastPairEnabled(false); + EXPECT_CALL(*mock_ui_broker_, ShowAssociateAccount).Times(0); + fake_retroactive_pairing_detector_->NotifyRetroactivePairFound(device_); +} + TEST_F(MediatorTest, RemoveNotificationOnPaired) { feature_status_tracker_->SetIsFastPairEnabled(true); EXPECT_CALL(*mock_ui_broker_, RemoveNotifications);
diff --git a/ash/wm/overview/rounded_label.cc b/ash/style/rounded_label.cc similarity index 97% rename from ash/wm/overview/rounded_label.cc rename to ash/style/rounded_label.cc index f5edafe..97993ea 100644 --- a/ash/wm/overview/rounded_label.cc +++ b/ash/style/rounded_label.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/wm/overview/rounded_label.h" +#include "ash/style/rounded_label.h" #include "ash/constants/ash_features.h" #include "ash/public/cpp/style/color_provider.h"
diff --git a/ash/wm/overview/rounded_label.h b/ash/style/rounded_label.h similarity index 87% rename from ash/wm/overview/rounded_label.h rename to ash/style/rounded_label.h index 925cc31..975c6f1 100644 --- a/ash/wm/overview/rounded_label.h +++ b/ash/style/rounded_label.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_WM_OVERVIEW_ROUNDED_LABEL_H_ -#define ASH_WM_OVERVIEW_ROUNDED_LABEL_H_ +#ifndef ASH_STYLE_ROUNDED_LABEL_H_ +#define ASH_STYLE_ROUNDED_LABEL_H_ #include "ui/views/controls/label.h" @@ -34,4 +34,4 @@ } // namespace ash -#endif // ASH_WM_OVERVIEW_ROUNDED_LABEL_H_ +#endif // ASH_STYLE_ROUNDED_LABEL_H_
diff --git a/ash/wm/overview/rounded_label_widget.cc b/ash/style/rounded_label_widget.cc similarity index 95% rename from ash/wm/overview/rounded_label_widget.cc rename to ash/style/rounded_label_widget.cc index 8e6e131..836e92f 100644 --- a/ash/wm/overview/rounded_label_widget.cc +++ b/ash/style/rounded_label_widget.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/wm/overview/rounded_label_widget.h" +#include "ash/style/rounded_label_widget.h" #include <memory> #include "ash/public/cpp/window_properties.h" -#include "ash/wm/overview/rounded_label.h" +#include "ash/style/rounded_label.h" #include "ash/wm/overview/scoped_overview_animation_settings.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h"
diff --git a/ash/wm/overview/rounded_label_widget.h b/ash/style/rounded_label_widget.h similarity index 90% rename from ash/wm/overview/rounded_label_widget.h rename to ash/style/rounded_label_widget.h index 36e3c715..9176ee67 100644 --- a/ash/wm/overview/rounded_label_widget.h +++ b/ash/style/rounded_label_widget.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_WM_OVERVIEW_ROUNDED_LABEL_WIDGET_H_ -#define ASH_WM_OVERVIEW_ROUNDED_LABEL_WIDGET_H_ +#ifndef ASH_STYLE_ROUNDED_LABEL_WIDGET_H_ +#define ASH_STYLE_ROUNDED_LABEL_WIDGET_H_ #include <string> @@ -50,4 +50,4 @@ } // namespace ash -#endif // ASH_WM_OVERVIEW_ROUNDED_LABEL_WIDGET_H_ +#endif // ASH_STYLE_ROUNDED_LABEL_WIDGET_H_
diff --git a/ash/system/accessibility/select_to_speak/select_to_speak_speed_bubble_controller.cc b/ash/system/accessibility/select_to_speak/select_to_speak_speed_bubble_controller.cc index 6f1772e7..3d5048d 100644 --- a/ash/system/accessibility/select_to_speak/select_to_speak_speed_bubble_controller.cc +++ b/ash/system/accessibility/select_to_speak/select_to_speak_speed_bubble_controller.cc
@@ -9,12 +9,14 @@ #include "ash/public/cpp/accessibility_controller_enums.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" +#include "ash/strings/grit/ash_strings.h" #include "ash/system/accessibility/floating_menu_utils.h" #include "ash/system/accessibility/select_to_speak/select_to_speak_constants.h" #include "ash/system/accessibility/select_to_speak/select_to_speak_speed_view.h" #include "ash/system/tray/tray_background_view.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/unified/unified_system_tray_view.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/compositor/layer.h" #include "ui/wm/public/activation_client.h" @@ -94,6 +96,11 @@ return bubble_widget_ && bubble_widget_->IsVisible(); } +std::u16string +SelectToSpeakSpeedBubbleController::GetAccessibleNameForBubble() { + return l10n_util::GetStringUTF16(IDS_ASH_SELECT_TO_SPEAK_SPEED_MENU); +} + void SelectToSpeakSpeedBubbleController::BubbleViewDestroyed() { bubble_view_ = nullptr; bubble_widget_ = nullptr;
diff --git a/ash/system/accessibility/select_to_speak/select_to_speak_speed_bubble_controller.h b/ash/system/accessibility/select_to_speak/select_to_speak_speed_bubble_controller.h index b6b640d..8c1a5f7 100644 --- a/ash/system/accessibility/select_to_speak/select_to_speak_speed_bubble_controller.h +++ b/ash/system/accessibility/select_to_speak/select_to_speak_speed_bubble_controller.h
@@ -40,6 +40,7 @@ friend class SelectToSpeakSpeedBubbleControllerTest; // TrayBubbleView::Delegate: + std::u16string GetAccessibleNameForBubble() override; void BubbleViewDestroyed() override; // ::wm::ActivationChangeObserver:
diff --git a/ash/system/holding_space/holding_space_tray.cc b/ash/system/holding_space/holding_space_tray.cc index f307822..9a5f6aa 100644 --- a/ash/system/holding_space/holding_space_tray.cc +++ b/ash/system/holding_space/holding_space_tray.cc
@@ -299,7 +299,11 @@ } std::u16string HoldingSpaceTray::GetAccessibleNameForTray() { - return l10n_util::GetStringUTF16(IDS_ASH_HOLDING_SPACE_A11Y_NAME); + return l10n_util::GetStringFUTF16( + IDS_ASH_HOLDING_SPACE_A11Y_NAME, + features::IsHoldingSpaceRebrandEnabled() + ? l10n_util::GetStringUTF16(IDS_ASH_HOLDING_SPACE_TITLE_REBRAND) + : l10n_util::GetStringUTF16(IDS_ASH_HOLDING_SPACE_TITLE)); } views::View* HoldingSpaceTray::GetTooltipHandlerForPoint(
diff --git a/ash/system/holding_space/holding_space_tray_unittest.cc b/ash/system/holding_space/holding_space_tray_unittest.cc index c70f426..7bbebe1 100644 --- a/ash/system/holding_space/holding_space_tray_unittest.cc +++ b/ash/system/holding_space/holding_space_tray_unittest.cc
@@ -3582,6 +3582,37 @@ pinned_files_bubble)); } +// Base class for tests of the holding space accessibility text parameterized by +// a boolean for the kHoldingSpaceRebrand feature flag. +class HoldingSpaceTrayAccessibilityTest + : public HoldingSpaceTrayTestBase, + public ::testing::WithParamInterface<bool> { + public: + HoldingSpaceTrayAccessibilityTest() { + scoped_feature_list_.InitWithFeatureState(features::kHoldingSpaceRebrand, + IsHoldingSpaceRebrandEnabled()); + } + + bool IsHoldingSpaceRebrandEnabled() const { return GetParam(); } + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +INSTANTIATE_TEST_SUITE_P(All, + HoldingSpaceTrayAccessibilityTest, + ::testing::Bool()); + +TEST_P(HoldingSpaceTrayAccessibilityTest, CheckTrayAccessibilityText) { + StartSession(/*pre_mark_time_of_first_add=*/true); + GetTray()->FirePreviewsUpdateTimerIfRunningForTesting(); + EXPECT_EQ( + GetTray()->GetAccessibleNameForTray(), + IsHoldingSpaceRebrandEnabled() + ? u"Quick Files: recent screen captures, downloads, and pinned files" + : u"Tote: recent screen captures, downloads, and pinned files"); +} + // Base class for tests of the holding space icon parameterized by a boolean for // the kHoldingSpaceRebrand feature flag. class HoldingSpaceTrayIconTest : public HoldingSpaceTrayTestBase,
diff --git a/ash/wallpaper/wallpaper_controller_impl.cc b/ash/wallpaper/wallpaper_controller_impl.cc index d247c1e..cdac69f 100644 --- a/ash/wallpaper/wallpaper_controller_impl.cc +++ b/ash/wallpaper/wallpaper_controller_impl.cc
@@ -2138,16 +2138,20 @@ void WallpaperControllerImpl::OnWallpaperVariantsFetched( WallpaperType type, + bool start_daily_refresh_timer, SetWallpaperCallback callback, absl::optional<OnlineWallpaperParams> params) { DCHECK(type == WallpaperType::kDaily || type == WallpaperType::kOnline); if (params) { SetOnlineWallpaper(*params, std::move(callback)); - // The Daily Refresh timer depends on the value of the user WallpaperInfo. - // it after setting the wallpaper value. - if (type == WallpaperType::kDaily) + // This callback may be invoked when the system color's mode changes and + // updates the variant of the same wallpaper. In this case, the caller is + // expected to set |start_daily_refresh_timer| to false to prevent the daily + // timer from getting reset and daily wallpaper getting stuck indefinitely. + if (type == WallpaperType::kDaily && start_daily_refresh_timer) { StartDailyRefreshTimer(); + } return; } @@ -3087,6 +3091,7 @@ OnlineWallpaperVariantInfoFetcher::FetchParamsCallback fetch_callback = base::BindOnce(&WallpaperControllerImpl::OnWallpaperVariantsFetched, set_wallpaper_weak_factory_.GetWeakPtr(), info.type, + /*start_daily_refresh_timer=*/true, std::move(callback)); // Fetch can fail if wallpaper_controller_client has been cleared or // |info| is malformed. @@ -3273,7 +3278,8 @@ return; OnlineWallpaperVariantInfoFetcher::FetchParamsCallback callback = base::BindOnce(&WallpaperControllerImpl::OnWallpaperVariantsFetched, - weak_factory_.GetWeakPtr(), info.type, base::DoNothing()); + weak_factory_.GetWeakPtr(), info.type, + /*start_daily_refresh_timer=*/true, base::DoNothing()); if (!variant_info_fetcher_->FetchDailyWallpaper( account_id, info, GetColorMode(), std::move(callback))) { NOTREACHED() << "Fetch of daily wallpaper info failed."; @@ -3325,9 +3331,12 @@ return; } + // Set |start_daily_refresh_timer| to false as this does not set a new + // wallpaper, but updates the variant of the same wallpaper. OnlineWallpaperVariantInfoFetcher::FetchParamsCallback callback = base::BindOnce(&WallpaperControllerImpl::OnWallpaperVariantsFetched, - weak_factory_.GetWeakPtr(), info.type, base::DoNothing()); + weak_factory_.GetWeakPtr(), info.type, + /*start_daily_refresh_timer=*/false, base::DoNothing()); variant_info_fetcher_->FetchOnlineWallpaper(account_id, info, GetColorMode(), std::move(callback));
diff --git a/ash/wallpaper/wallpaper_controller_impl.h b/ash/wallpaper/wallpaper_controller_impl.h index fa44f45..81f2ea82 100644 --- a/ash/wallpaper/wallpaper_controller_impl.h +++ b/ash/wallpaper/wallpaper_controller_impl.h
@@ -468,6 +468,7 @@ // Handler to receive Fetch*Wallpaper variants callbacks. void OnWallpaperVariantsFetched(WallpaperType type, + bool start_daily_refresh_timer, SetWallpaperCallback callback, absl::optional<OnlineWallpaperParams> params);
diff --git a/ash/wallpaper/wallpaper_controller_unittest.cc b/ash/wallpaper/wallpaper_controller_unittest.cc index 25590f0..7235038 100644 --- a/ash/wallpaper/wallpaper_controller_unittest.cc +++ b/ash/wallpaper/wallpaper_controller_unittest.cc
@@ -4008,6 +4008,62 @@ } TEST_F(WallpaperControllerTest, + UpdateDailyWallpaperVariantOnColorModeChanged_RefreshTimerDoesntReset) { + using base::Time; + + SimulateUserLogin(account_id_1); + // Resets the count as user will start with a default image after login. + ClearWallpaperCount(); + + std::vector<OnlineWallpaperVariant> variants; + variants.emplace_back(kAssetId, GURL(kDummyUrl), + backdrop::Image::IMAGE_TYPE_DARK_MODE); + variants.emplace_back(kAssetId2, GURL(kDummyUrl2), + backdrop::Image::IMAGE_TYPE_LIGHT_MODE); + const OnlineWallpaperParams& params = + OnlineWallpaperParams(account_id_1, kAssetId, GURL(kDummyUrl), + TestWallpaperControllerClient::kDummyCollectionId, + WALLPAPER_LAYOUT_CENTER_CROPPED, + /*preview_mode=*/false, /*from_user=*/true, + /*daily_refresh_enabled=*/true, kUnitId, variants); + const WallpaperInfo info = WallpaperInfo(params); + pref_manager_->SetUserWallpaperInfo(account_id_1, info); + + // Set a new daily wallpaper. + controller_->UpdateDailyRefreshWallpaperForTesting(); + RunAllTasksUntilIdle(); + + Time run_time = + controller_->GetUpdateWallpaperTimerForTesting().desired_run_time(); + base::TimeDelta delay = run_time - Time::Now(); + base::TimeDelta one_day = base::Days(1); + // Leave a little wiggle room, as well as account for the hour fuzzing that + // we do. + EXPECT_GE(delay, one_day - base::Minutes(1)); + EXPECT_LE(delay, one_day + base::Minutes(61)); + + EXPECT_EQ(1, GetWallpaperCount()); + EXPECT_EQ(controller_->GetWallpaperType(), WallpaperType::kDaily); + + // Fast forward by one hour and attempt a system's color mode change. + task_environment()->FastForwardBy(base::Hours(1)); + Shell::Get()->session_controller()->GetActivePrefService()->SetBoolean( + prefs::kDarkModeEnabled, true); + controller_->OnColorModeChanged(true); + RunAllTasksUntilIdle(); + // TODO(crbug.com/1362424): Figure out why this is flaky. + // EXPECT_EQ(2, GetWallpaperCount()); + // Expect the refresh timer doesn't reset. + EXPECT_EQ( + run_time, + controller_->GetUpdateWallpaperTimerForTesting().desired_run_time()); + + WallpaperInfo actual; + EXPECT_TRUE(pref_manager_->GetUserWallpaperInfo(account_id_1, &actual)); + EXPECT_EQ(info, actual); +} + +TEST_F(WallpaperControllerTest, UpdateWallpaperInfoWithOnlineWallpaperVariants) { SimulateUserLogin(account_id_1);
diff --git a/ash/webui/common/resources/BUILD.gn b/ash/webui/common/resources/BUILD.gn index 590f56b..2d251b0 100644 --- a/ash/webui/common/resources/BUILD.gn +++ b/ash/webui/common/resources/BUILD.gn
@@ -32,6 +32,7 @@ "multidevice_setup/setup_succeeded_page.js", "multidevice_setup/start_setup_page.js", "multidevice_setup/ui_page.js", + "traffic_counters/traffic_counters.js", ] non_web_component_files = [ @@ -46,6 +47,7 @@ "post_message_api/post_message_api_client.js", "post_message_api/post_message_api_request_handler.js", "post_message_api/post_message_api_server.js", + "traffic_counters/traffic_counters_adapter.js", ] icons_html_files = [ @@ -160,12 +162,15 @@ } checked_in_dts_files = [ - "cr_picture/cr_camera.d.ts", - "cr_picture/cr_picture_pane.d.ts", "fake_method_resolver.d.ts", "page_toolbar.d.ts", "navigation_view_panel.d.ts", "navigation_selector.d.ts", + + "cr_picture/cr_camera.d.ts", + "cr_picture/cr_picture_pane.d.ts", + "traffic_counters/traffic_counters_adapter.d.ts", + "traffic_counters/traffic_counters.d.ts", ] copy("copy_checked_in_dts_files") { @@ -179,6 +184,7 @@ "cr_picture:closure_compile_module", "multidevice_setup:closure_compile_module", "post_message_api:closure_compile", + "traffic_counters:closure_compile_module", ] }
diff --git a/ui/webui/resources/cr_components/chromeos/traffic_counters/BUILD.gn b/ash/webui/common/resources/traffic_counters/BUILD.gn similarity index 88% rename from ui/webui/resources/cr_components/chromeos/traffic_counters/BUILD.gn rename to ash/webui/common/resources/traffic_counters/BUILD.gn index 25bfa43..e0efbe41 100644 --- a/ui/webui/resources/cr_components/chromeos/traffic_counters/BUILD.gn +++ b/ash/webui/common/resources/traffic_counters/BUILD.gn
@@ -3,9 +3,8 @@ # found in the LICENSE file. import("//third_party/closure_compiler/compile_js.gni") -import("//tools/polymer/html_to_js.gni") -assert(is_chromeos, "Only ChromeOS components belong here.") +assert(is_chromeos_ash, "Only ChromeOS components belong here.") # JS type check for Polymer 3 js_type_check("closure_compile_module") { @@ -41,7 +40,3 @@ "//ui/webui/resources/cr_elements:i18n_behavior", ] } - -html_to_js("web_components") { - js_files = [ "traffic_counters.js" ] -}
diff --git a/ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters.d.ts b/ash/webui/common/resources/traffic_counters/traffic_counters.d.ts similarity index 100% rename from ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters.d.ts rename to ash/webui/common/resources/traffic_counters/traffic_counters.d.ts
diff --git a/ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters.html b/ash/webui/common/resources/traffic_counters/traffic_counters.html similarity index 100% rename from ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters.html rename to ash/webui/common/resources/traffic_counters/traffic_counters.html
diff --git a/ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters.js b/ash/webui/common/resources/traffic_counters/traffic_counters.js similarity index 97% rename from ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters.js rename to ash/webui/common/resources/traffic_counters/traffic_counters.js index bd562e3..87c9ad4 100644 --- a/ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters.js +++ b/ash/webui/common/resources/traffic_counters/traffic_counters.js
@@ -8,8 +8,9 @@ import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/cr_elements/i18n_behavior.js'; import {CrosNetworkConfig} from 'chrome://resources/mojo/chromeos/services/network_config/public/mojom/cros_network_config.mojom-webui.js'; import {NetworkType} from 'chrome://resources/mojo/chromeos/services/network_config/public/mojom/network_types.mojom-webui.js'; -import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {getTemplate} from './traffic_counters.html.js'; import {TrafficCountersAdapter} from './traffic_counters_adapter.js'; /** @@ -106,7 +107,7 @@ } static get template() { - return html`{__html_template__}`; + return getTemplate(); } static get properties() {
diff --git a/ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters_adapter.d.ts b/ash/webui/common/resources/traffic_counters/traffic_counters_adapter.d.ts similarity index 100% rename from ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters_adapter.d.ts rename to ash/webui/common/resources/traffic_counters/traffic_counters_adapter.d.ts
diff --git a/ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters_adapter.js b/ash/webui/common/resources/traffic_counters/traffic_counters_adapter.js similarity index 100% rename from ui/webui/resources/cr_components/chromeos/traffic_counters/traffic_counters_adapter.js rename to ash/webui/common/resources/traffic_counters/traffic_counters_adapter.js
diff --git a/ash/wm/desks/desks_bar_view.cc b/ash/wm/desks/desks_bar_view.cc index 111d7c5..b37ddcd 100644 --- a/ash/wm/desks/desks_bar_view.cc +++ b/ash/wm/desks/desks_bar_view.cc
@@ -559,6 +559,9 @@ } bool DesksBarView::IsZeroState() const { + // TODO(crbug.com/1363382): This function should not be checking if the + // templates grid is visible. Return what the state is, rather than what it + // should be. See corresponding TODO in `OverviewGrid`. if (overview_grid_->IsShowingDesksTemplatesGrid()) return false; return mini_views_.empty() && DesksController::Get()->desks().size() == 1; @@ -1297,7 +1300,7 @@ if (IsDeskNameBeingModified()) DeskNameView::CommitChanges(GetWidget()); overview_grid_->overview_session()->ShowDesksTemplatesGrids( - IsZeroState(), base::GUID(), /*saved_desk_name=*/u"", + base::GUID(), /*saved_desk_name=*/u"", GetWidget()->GetNativeWindow()->GetRootWindow()); }
diff --git a/ash/wm/desks/templates/saved_desk_grid_view.cc b/ash/wm/desks/templates/saved_desk_grid_view.cc index c18c2ba..322b077 100644 --- a/ash/wm/desks/templates/saved_desk_grid_view.cc +++ b/ash/wm/desks/templates/saved_desk_grid_view.cc
@@ -89,27 +89,8 @@ SavedDeskGridView::~SavedDeskGridView() = default; -void SavedDeskGridView::PopulateGridUI( - const std::vector<const DeskTemplate*>& desk_templates, - const base::GUID& last_saved_template_uuid) { - DCHECK(grid_items_.empty()); - - // TODO(richui|sammiequon): See if this can be removed as this function should - // only be called once per overview session. - if (desk_templates.empty()) { - RemoveAllChildViews(); - grid_items_.clear(); - return; - } - - AddOrUpdateTemplates(desk_templates, - /*initializing_grid_view=*/true, - last_saved_template_uuid); -} - -void SavedDeskGridView::SortTemplateGridItems( - const base::GUID& last_saved_template_uuid) { - // Sort the `grid_items_` into alphabetical order based on template name. +void SavedDeskGridView::SortEntries(const base::GUID& order_first_uuid) { + // Sort the `grid_items_` into alphabetical order based on saved desk name. // Note that this doesn't update the order of the child views, but just sorts // the vector. `Layout` is responsible for placing the views in the correct // locations in the grid. @@ -117,23 +98,22 @@ std::unique_ptr<icu::Collator> collator( icu::Collator::createInstance(error_code)); // Use current ICU locale. DCHECK(U_SUCCESS(error_code)); - // If there is a newly saved template, move that template to the front of the - // grid, and sort the rest of the templates after it. - std::sort(grid_items_.begin(), grid_items_.end(), - [&collator, last_saved_template_uuid](const SavedDeskItemView* a, - const SavedDeskItemView* b) { - if (last_saved_template_uuid.is_valid() && - a->uuid() == last_saved_template_uuid) { - return true; - } - if (last_saved_template_uuid.is_valid() && - b->uuid() == last_saved_template_uuid) { - return false; - } - return base::i18n::CompareString16WithCollator( - *collator, a->name_view()->GetAccessibleName(), - b->name_view()->GetAccessibleName()) < 0; - }); + // If there is a uuid that is to be placed first, move that saved desk to the + // front of the grid, and sort the rest of the entries after it. + std::sort( + grid_items_.begin(), grid_items_.end(), + [&collator, &order_first_uuid](const SavedDeskItemView* a, + const SavedDeskItemView* b) { + if (order_first_uuid.is_valid() && a->uuid() == order_first_uuid) { + return true; + } + if (order_first_uuid.is_valid() && b->uuid() == order_first_uuid) { + return false; + } + return base::i18n::CompareString16WithCollator( + *collator, a->name_view()->GetAccessibleName(), + b->name_view()->GetAccessibleName()) < 0; + }); // A11y traverses views based on the order of the children, so we need to // manually reorder the child views to match the order that they are @@ -149,10 +129,10 @@ Layout(); } -void SavedDeskGridView::AddOrUpdateTemplates( +void SavedDeskGridView::AddOrUpdateEntries( const std::vector<const DeskTemplate*>& entries, - bool initializing_grid_view, - const base::GUID& last_saved_template_uuid) { + const base::GUID& order_first_uuid, + bool animate) { std::vector<SavedDeskItemView*> new_grid_items; for (const DeskTemplate* entry : entries) { @@ -165,22 +145,19 @@ SavedDeskItemView* grid_item = AddChildView(std::make_unique<SavedDeskItemView>(entry->Clone())); grid_items_.push_back(grid_item); - if (!initializing_grid_view) + if (animate) new_grid_items.push_back(grid_item); } } - // Sort the `grid_items_` into alphabetical order based on template name. If a - // given uuid is valid, it'll push that template item to the front of the grid - // and sort the remaining templates after it. - SortTemplateGridItems(last_saved_template_uuid); + SortEntries(order_first_uuid); - if (!initializing_grid_view) + if (animate) AnimateGridItems(new_grid_items); } -void SavedDeskGridView::DeleteTemplates(const std::vector<base::GUID>& uuids, - bool delete_animation) { +void SavedDeskGridView::DeleteEntries(const std::vector<base::GUID>& uuids, + bool delete_animation) { OverviewHighlightController* highlight_controller = Shell::Get() ->overview_controller()
diff --git a/ash/wm/desks/templates/saved_desk_grid_view.h b/ash/wm/desks/templates/saved_desk_grid_view.h index 76d34b8..d37958d 100644 --- a/ash/wm/desks/templates/saved_desk_grid_view.h +++ b/ash/wm/desks/templates/saved_desk_grid_view.h
@@ -40,29 +40,25 @@ // Sets the grid to show items in landscape or portrait mode. void set_layout_mode(LayoutMode layout_mode) { layout_mode_ = layout_mode; } - // Updates the UI by creating a grid layout and populating the grid with the - // provided list of saved desks. - void PopulateGridUI(const std::vector<const DeskTemplate*>& desk_templates, - const base::GUID& last_saved_template_uuid); - - // Updates `grid_items_` to ensure the saved desk grid is sorted. - void SortTemplateGridItems(const base::GUID& last_saved_template_uuid); + // Sorts entries in alphabetical order. If `order_first_uuid` is valid, the + // corresponding entry will be placed first. + void SortEntries(const base::GUID& order_first_uuid); // Updates existing saved desks and adds new saved desks to the grid. Also - // sorts `grid_items_` in alphabetical order. This will animate the - // `grid_items_` to their final positions if `initializing_grid_view` is - // false. Currently only allows a maximum of 6 saved desks to be shown in the - // grid. - void AddOrUpdateTemplates(const std::vector<const DeskTemplate*>& entries, - bool initializing_grid_view, - const base::GUID& last_saved_template_uuid); + // sorts entries in alphabetical order. If `order_first_uuid` is valid, the + // corresponding entry will be placed first. This will animate the entries to + // their final positions if `animate` is true. Currently only allows a maximum + // of 6 saved desks to be shown in the grid. + void AddOrUpdateEntries(const std::vector<const DeskTemplate*>& entries, + const base::GUID& order_first_uuid, + bool animate); - // Removes templates from the grid by UUID. Will trigger an animation to + // Removes saved desks from the grid by UUID. Will trigger an animation to // shuffle `grid_items_` to their final positions. If `delete_animation` is // false, then deleted items will simply disappear (shuffled items will still // animate). - void DeleteTemplates(const std::vector<base::GUID>& uuids, - bool delete_animation); + void DeleteEntries(const std::vector<base::GUID>& uuids, + bool delete_animation); // Returns true if a template name is being modified using an item view's // `SavedDeskNameView` in this grid.
diff --git a/ash/wm/desks/templates/saved_desk_item_view.cc b/ash/wm/desks/templates/saved_desk_item_view.cc index 05f6091..b163e0a 100644 --- a/ash/wm/desks/templates/saved_desk_item_view.cc +++ b/ash/wm/desks/templates/saved_desk_item_view.cc
@@ -11,6 +11,7 @@ #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" +#include "ash/style/ash_color_id.h" #include "ash/style/ash_color_provider.h" #include "ash/style/close_button.h" #include "ash/style/pill_button.h" @@ -140,10 +141,8 @@ .SetUseDefaultFillLayout(true) .SetAccessibleName(template_name) .SetCallback(std::move(launch_template_callback)) - .SetBackground(views::CreateRoundedRectBackground( - color_provider->GetBaseLayerColor( - AshColorProvider::BaseLayerType::kTransparent80), - kCornerRadius)) + .SetBackground(views::CreateThemedRoundedRectBackground( + kColorAshShieldAndBase80, kCornerRadius)) .SetBorder(std::make_unique<views::HighlightBorder>( kCornerRadius, views::HighlightBorder::Type::kHighlightBorder1, /*use_light_colors=*/false)) @@ -421,8 +420,6 @@ void SavedDeskItemView::OnThemeChanged() { views::View::OnThemeChanged(); auto* color_provider = AshColorProvider::Get(); - GetBackground()->SetNativeControlColor(color_provider->GetBaseLayerColor( - AshColorProvider::BaseLayerType::kTransparent80)); time_view_->SetBackgroundColor(SK_ColorTRANSPARENT); time_view_->SetEnabledColor(color_provider->GetContentLayerColor( @@ -515,8 +512,7 @@ if (SavedDeskLibraryView* library_view = overview_grid->GetSavedDeskLibraryView()) { for (auto* grid_view : library_view->grid_views()) { - grid_view->SortTemplateGridItems( - /*last_saved_template_uuid=*/base::GUID()); + grid_view->SortEntries(/*order_first_uuid=*/{}); } } }
diff --git a/ash/wm/desks/templates/saved_desk_library_view.cc b/ash/wm/desks/templates/saved_desk_library_view.cc index c741578..32eb85fb 100644 --- a/ash/wm/desks/templates/saved_desk_library_view.cc +++ b/ash/wm/desks/templates/saved_desk_library_view.cc
@@ -16,6 +16,7 @@ #include "ash/strings/grit/ash_strings.h" #include "ash/style/ash_color_provider.h" #include "ash/style/pill_button.h" +#include "ash/style/rounded_label.h" #include "ash/wm/desks/desk_mini_view.h" #include "ash/wm/desks/desk_preview_view.h" #include "ash/wm/desks/templates/saved_desk_grid_view.h" @@ -25,7 +26,6 @@ #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_grid_event_handler.h" -#include "ash/wm/overview/rounded_label.h" #include "base/notreached.h" #include "ui/aura/window.h" #include "ui/aura/window_targeter.h" @@ -355,50 +355,29 @@ return nullptr; } -void SavedDeskLibraryView::PopulateGridUI( +void SavedDeskLibraryView::AddOrUpdateEntries( const std::vector<const DeskTemplate*>& entries, - const gfx::Rect& grid_bounds, - const base::GUID& last_saved_desk_uuid) { - GetWidget()->SetBounds(grid_bounds); - + const base::GUID& order_first_uuid, + bool animate) { SavedDesks grouped_entries = Group(entries); if (desk_template_grid_view_) { - desk_template_grid_view_->PopulateGridUI(grouped_entries.desk_templates, - last_saved_desk_uuid); + desk_template_grid_view_->AddOrUpdateEntries(grouped_entries.desk_templates, + order_first_uuid, animate); } if (save_and_recall_grid_view_) { - save_and_recall_grid_view_->PopulateGridUI(grouped_entries.save_and_recall, - last_saved_desk_uuid); + save_and_recall_grid_view_->AddOrUpdateEntries( + grouped_entries.save_and_recall, order_first_uuid, animate); } Layout(); } -void SavedDeskLibraryView::AddOrUpdateTemplates( - const std::vector<const DeskTemplate*>& entries, - bool initializing_grid_view, - const base::GUID& last_saved_desk_uuid) { - SavedDesks grouped_entries = Group(entries); - if (desk_template_grid_view_) { - desk_template_grid_view_->AddOrUpdateTemplates( - grouped_entries.desk_templates, initializing_grid_view, - last_saved_desk_uuid); - } - if (save_and_recall_grid_view_) { - save_and_recall_grid_view_->AddOrUpdateTemplates( - grouped_entries.save_and_recall, initializing_grid_view, - last_saved_desk_uuid); - } - - Layout(); -} - -void SavedDeskLibraryView::DeleteTemplates(const std::vector<base::GUID>& uuids, - bool delete_animation) { +void SavedDeskLibraryView::DeleteEntries(const std::vector<base::GUID>& uuids, + bool delete_animation) { if (desk_template_grid_view_) - desk_template_grid_view_->DeleteTemplates(uuids, delete_animation); + desk_template_grid_view_->DeleteEntries(uuids, delete_animation); if (save_and_recall_grid_view_) - save_and_recall_grid_view_->DeleteTemplates(uuids, delete_animation); + save_and_recall_grid_view_->DeleteEntries(uuids, delete_animation); Layout(); } @@ -450,7 +429,7 @@ .SetOpacity(item_layer, 0.0f); // Delete the existing saved desk item without animation. - DeleteTemplates({uuid}, /*delete_animation=*/false); + DeleteEntries({uuid}, /*delete_animation=*/false); } bool SavedDeskLibraryView::IsAnimating() {
diff --git a/ash/wm/desks/templates/saved_desk_library_view.h b/ash/wm/desks/templates/saved_desk_library_view.h index c614e58..d878023 100644 --- a/ash/wm/desks/templates/saved_desk_library_view.h +++ b/ash/wm/desks/templates/saved_desk_library_view.h
@@ -47,22 +47,22 @@ const std::vector<SavedDeskGridView*>& grid_views() { return grid_views_; } - // Retrieve the item view for a given saved desk, or nullptr. + // Retrieves the item view for a given saved desk, or nullptr. SavedDeskItemView* GetItemForUUID(const base::GUID& uuid); - // TODO(dandersson): Look into unifying this and `AddOrUpdateTemplates`. - void PopulateGridUI(const std::vector<const DeskTemplate*>& entries, - const gfx::Rect& grid_bounds, - const base::GUID& last_saved_desk_uuid); + // Updates existing saved desks and adds new saved desks to the grid. Also + // sorts entries in alphabetical order. If `order_first_uuid` is valid, the + // corresponding entry will be placed first. This will animate the entries to + // their final positions if `animate` is true. Currently only allows a maximum + // of 6 saved desks to be shown in the grid. + void AddOrUpdateEntries(const std::vector<const DeskTemplate*>& entries, + const base::GUID& order_first_uuid, + bool animate); - void AddOrUpdateTemplates(const std::vector<const DeskTemplate*>& entries, - bool initializing_grid_view, - const base::GUID& last_saved_desk_uuid); - - // Delete all templates identified by `uuids`. If `delete_animation` is false, + // Deletes all entries identified by `uuids`. If `delete_animation` is false, // then the respective item views will just disappear instead of fading out. - void DeleteTemplates(const std::vector<base::GUID>& uuids, - bool delete_animation); + void DeleteEntries(const std::vector<base::GUID>& uuids, + bool delete_animation); // This performs the launch animation for Save & Recall. The `DeskItemView` // identified by `uuid` is animated up into the position of the desk preview
diff --git a/ash/wm/desks/templates/saved_desk_presenter.cc b/ash/wm/desks/templates/saved_desk_presenter.cc index c0620f3..b062a46 100644 --- a/ash/wm/desks/templates/saved_desk_presenter.cc +++ b/ash/wm/desks/templates/saved_desk_presenter.cc
@@ -245,11 +245,8 @@ } // Show the library, this should highlight the newly saved item. - OverviewGrid* overview_grid = - overview_session->GetGridWithRootWindow(root_window_); - overview_session->ShowDesksTemplatesGrids( - overview_grid->desks_bar_view()->IsZeroState(), saved_desk_guid_, - saved_desk_name_, root_window_); + overview_session->ShowDesksTemplatesGrids(saved_desk_guid_, + saved_desk_name_, root_window_); // Remove the current desk, this will be done without animation. if (remove_desk) { @@ -318,8 +315,6 @@ auto* desk_model = GetDeskModel(); desk_model_observation_.Observe(desk_model); - GetAllEntries(base::GUID(), /*saved_desk_name=*/u"", - Shell::GetPrimaryRootWindow()); should_show_templates_ui_ = !Shell::Get()->tablet_mode_controller()->InTabletMode() && @@ -511,9 +506,9 @@ // Populate `SavedDeskLibraryView` with the desk template entries. if (SavedDeskLibraryView* library_view = overview_grid->GetSavedDeskLibraryView()) { - library_view->PopulateGridUI(result.entries, - overview_grid->GetGridEffectiveBounds(), - /*last_saved_desk_uuid=*/item_to_focus); + library_view->AddOrUpdateEntries(result.entries, item_to_focus, + /*animate=*/false); + SavedDeskItemView* item_view = library_view->GetItemForUUID(item_to_focus); if (!item_view) @@ -647,8 +642,6 @@ OverviewGrid* overview_grid = overview_session_->GetGridWithRootWindow(root_window); DCHECK(overview_grid); - DCHECK(overview_grid->desks_bar_view()); - const bool is_zero_state = overview_grid->desks_bar_view()->IsZeroState(); if (auto* library_view = overview_grid->GetSavedDeskLibraryView()) { // TODO(dandersson): Rework literally all of this. This path is only taken @@ -658,7 +651,7 @@ if (!was_update) { // Shows the grid if it was hidden. This will not call `GetAllEntries`. - overview_session_->ShowDesksTemplatesGrids(is_zero_state, base::GUID(), + overview_session_->ShowDesksTemplatesGrids(base::GUID(), /*saved_desk_name=*/u"", root_window); if (SavedDeskItemView* item_view = @@ -673,8 +666,8 @@ } else if (desk_template->type() != DeskTemplateType::kSaveAndRecall) { // This will update the templates button and save as desks button too. This // will call `GetAllEntries`. - overview_session_->ShowDesksTemplatesGrids( - is_zero_state, desk_template->uuid(), saved_desk_name, root_window); + overview_session_->ShowDesksTemplatesGrids(desk_template->uuid(), + saved_desk_name, root_window); } if (!was_update) { @@ -726,9 +719,8 @@ for (auto& overview_grid : overview_session_->grid_list()) { if (auto* library_view = overview_grid->GetSavedDeskLibraryView()) { - library_view->AddOrUpdateTemplates( - new_entries, /*initializing_grid_view=*/false, - /*last_saved_template_uuid=*/base::GUID()); + library_view->AddOrUpdateEntries(new_entries, /*order_first_uuid=*/{}, + /*animate=*/true); } } @@ -746,7 +738,7 @@ for (auto& overview_grid : overview_session_->grid_list()) { // Remove the entries from `SavedDeskLibraryView`. if (auto* library_view = overview_grid->GetSavedDeskLibraryView()) - library_view->DeleteTemplates(uuids, /*delete_animation=*/true); + library_view->DeleteEntries(uuids, /*delete_animation=*/true); } if (on_update_ui_closure_for_testing_)
diff --git a/ash/wm/overview/overview_grid.cc b/ash/wm/overview/overview_grid.cc index b4b88db..8d5a716 100644 --- a/ash/wm/overview/overview_grid.cc +++ b/ash/wm/overview/overview_grid.cc
@@ -1730,10 +1730,25 @@ SavedDeskNameView::CommitChanges(saved_desk_library_widget_.get()); } -void OverviewGrid::ShowDesksTemplatesGrid(bool was_zero_state) { +void OverviewGrid::ShowDesksTemplatesGrid() { + // TODO(crbug.com/1363382): This bool is defined here, way above where it is + // actually used, because `IsZeroState` will return false if the saved desk + // library is visible. See corresponding TODO in `DesksBarView`. + DCHECK(desks_bar_view_); + const bool was_zero_state = desks_bar_view_->IsZeroState(); + if (!saved_desk_library_widget_) { saved_desk_library_widget_ = SavedDeskLibraryView::CreateSavedDeskLibraryWidget(root_window_); + + // Compute bounds for the library using the expanded height of the desk + // bar. `GetGridEffectiveBounds` will not be the correct bounds for the + // library if we are currently in the zero state mode. + gfx::Rect library_bounds = bounds_; + library_bounds.Inset(gfx::Insets::TLBR( + DesksBarView::GetExpandedBarHeight(root_window_), 0, 0, 0)); + + saved_desk_library_widget_->SetBounds(library_bounds); } for (auto& overview_mode_item : window_list_)
diff --git a/ash/wm/overview/overview_grid.h b/ash/wm/overview/overview_grid.h index fad2cb8..3a968648 100644 --- a/ash/wm/overview/overview_grid.h +++ b/ash/wm/overview/overview_grid.h
@@ -12,9 +12,9 @@ #include "ash/public/cpp/wallpaper/wallpaper_controller_observer.h" #include "ash/rotator/screen_rotation_animator_observer.h" +#include "ash/style/rounded_label_widget.h" #include "ash/wm/desks/templates/saved_desk_save_desk_button_container.h" #include "ash/wm/overview/overview_session.h" -#include "ash/wm/overview/rounded_label_widget.h" #include "ash/wm/splitview/split_view_controller.h" #include "ash/wm/splitview/split_view_drag_indicators.h" #include "ash/wm/splitview/split_view_observer.h" @@ -343,9 +343,9 @@ // Commits any on-going name changes if any. void CommitNameChanges(); - // Shows the grid of the desks templates. Creates the widget if needed. If - // `was_zero_state` is true then we will expand the desks bar. - void ShowDesksTemplatesGrid(bool was_zero_state); + // Shows the grid of the desks templates. Creates the widget if needed. The + // desks bar will be expanded if it isn't already. + void ShowDesksTemplatesGrid(); // Hides the grid of desks templates and reshow the overview items. Updates // the templates button if we are not exiting overview.
diff --git a/ash/wm/overview/overview_item.cc b/ash/wm/overview/overview_item.cc index e4a7454..d0db1df4 100644 --- a/ash/wm/overview/overview_item.cc +++ b/ash/wm/overview/overview_item.cc
@@ -16,6 +16,7 @@ #include "ash/strings/grit/ash_strings.h" #include "ash/style/default_color_constants.h" #include "ash/style/default_colors.h" +#include "ash/style/rounded_label_widget.h" #include "ash/style/system_shadow.h" #include "ash/wm/desks/desks_util.h" #include "ash/wm/desks/templates/saved_desk_animations.h" @@ -30,7 +31,6 @@ #include "ash/wm/overview/overview_types.h" #include "ash/wm/overview/overview_utils.h" #include "ash/wm/overview/overview_window_drag_controller.h" -#include "ash/wm/overview/rounded_label_widget.h" #include "ash/wm/overview/scoped_overview_animation_settings.h" #include "ash/wm/overview/scoped_overview_transform_window.h" #include "ash/wm/splitview/split_view_constants.h"
diff --git a/ash/wm/overview/overview_session.cc b/ash/wm/overview/overview_session.cc index b243538..65759531 100644 --- a/ash/wm/overview/overview_session.cc +++ b/ash/wm/overview/overview_session.cc
@@ -1015,7 +1015,6 @@ } void OverviewSession::ShowDesksTemplatesGrids( - bool was_zero_state, const base::GUID& item_to_focus, const std::u16string& saved_desk_name, aura::Window* const root_window) { @@ -1032,7 +1031,8 @@ AccessibilityAlert::SAVED_DESKS_MODE_ENTERED); for (auto& grid : grid_list_) - grid->ShowDesksTemplatesGrid(was_zero_state); + grid->ShowDesksTemplatesGrid(); + // Only ask for all entries if it is the first time creating the grid widgets. // Otherwise, add or update the entries one at a time. if (created_grid_widgets) {
diff --git a/ash/wm/overview/overview_session.h b/ash/wm/overview/overview_session.h index 11c3017..aa66421 100644 --- a/ash/wm/overview/overview_session.h +++ b/ash/wm/overview/overview_session.h
@@ -290,11 +290,10 @@ // |active_window_before_overview_|. bool IsWindowActiveWindowBeforeOverview(aura::Window* window) const; - // Shows the desks templates grids on all displays. If `was_zero_state` is - // true then we will expand the desks bars. Focuses the item which matches + // Shows the desks templates grids on all displays. This will expand desk bars + // if they are not already expanded. Focuses the item which matches // `item_to_focus` on the display associated with `root_window`. - void ShowDesksTemplatesGrids(bool was_zero_state, - const base::GUID& item_to_focus, + void ShowDesksTemplatesGrids(const base::GUID& item_to_focus, const std::u16string& saved_desk_name, aura::Window* const root_window);
diff --git a/ash/wm/overview/overview_session_unittest.cc b/ash/wm/overview/overview_session_unittest.cc index fc6f2bc..dc8593b5 100644 --- a/ash/wm/overview/overview_session_unittest.cc +++ b/ash/wm/overview/overview_session_unittest.cc
@@ -31,6 +31,7 @@ #include "ash/shelf/shelf_view_test_api.h" #include "ash/shell.h" #include "ash/style/close_button.h" +#include "ash/style/rounded_label_widget.h" #include "ash/test/ash_test_base.h" #include "ash/test/test_window_builder.h" #include "ash/wm/desks/desks_bar_view.h" @@ -53,7 +54,6 @@ #include "ash/wm/overview/overview_utils.h" #include "ash/wm/overview/overview_wallpaper_controller.h" #include "ash/wm/overview/overview_window_drag_controller.h" -#include "ash/wm/overview/rounded_label_widget.h" #include "ash/wm/overview/scoped_overview_transform_window.h" #include "ash/wm/resize_shadow.h" #include "ash/wm/resize_shadow_controller.h"
diff --git a/buildtools/deps_revisions.gni b/buildtools/deps_revisions.gni index f2e557b..6209dbe 100644 --- a/buildtools/deps_revisions.gni +++ b/buildtools/deps_revisions.gni
@@ -5,5 +5,5 @@ declare_args() { # Used to cause full rebuilds on libc++ rolls. This should be kept in sync # with the libcxx_revision vars in //DEPS. - libcxx_revision = "e2f63a1a48a3cdcacbfc212236050ca5deeacc30" + libcxx_revision = "e73c46522412e2e53f4bfa2a9caf14fa0e0c7cd8" }
diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc index 3e7af0a..16c23b8b 100644 --- a/cc/layers/texture_layer.cc +++ b/cc/layers/texture_layer.cc
@@ -78,6 +78,14 @@ SetNeedsCommit(); } +void TextureLayer::SetHDRMetadata( + absl::optional<gfx::HDRMetadata> hdr_metadata) { + if (hdr_metadata_.Read(*this) == hdr_metadata) + return; + hdr_metadata_.Write(*this) = hdr_metadata; + SetNeedsCommit(); +} + void TextureLayer::SetPremultipliedAlpha(bool premultiplied_alpha) { if (premultiplied_alpha_.Read(*this) == premultiplied_alpha) return; @@ -207,6 +215,7 @@ texture_layer->SetPremultipliedAlpha(premultiplied_alpha_.Read(*this)); texture_layer->SetBlendBackgroundColor(blend_background_color_.Read(*this)); texture_layer->SetForceTextureToOpaque(force_texture_to_opaque_.Read(*this)); + texture_layer->SetHDRMetadata(hdr_metadata_.Read(*this)); if (needs_set_resource_.Read(*this)) { viz::TransferableResource resource; viz::ReleaseCallback release_callback;
diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h index e58e8af..58878c7e 100644 --- a/cc/layers/texture_layer.h +++ b/cc/layers/texture_layer.h
@@ -20,6 +20,8 @@ #include "cc/resources/shared_bitmap_id_registrar.h" #include "components/viz/common/resources/release_callback.h" #include "components/viz/common/resources/transferable_resource.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/gfx/hdr_metadata.h" namespace gpu { struct SyncToken; @@ -123,6 +125,9 @@ void SetTransferableResource(const viz::TransferableResource& resource, viz::ReleaseCallback release_callback); + // Set or unset HDR metadata. + void SetHDRMetadata(absl::optional<gfx::HDRMetadata> hdr_metadata); + void SetLayerTreeHost(LayerTreeHost* layer_tree_host) override; bool Update() override; bool IsSnappedToPixelGridInTarget() const override; @@ -174,6 +179,7 @@ ProtectedSequenceReadable<bool> premultiplied_alpha_; ProtectedSequenceReadable<bool> blend_background_color_; ProtectedSequenceReadable<bool> force_texture_to_opaque_; + ProtectedSequenceWritable<absl::optional<gfx::HDRMetadata>> hdr_metadata_; ProtectedSequenceWritable<scoped_refptr<TransferableResourceHolder>> resource_holder_;
diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc index 2384c04..10e490fc 100644 --- a/cc/layers/texture_layer_impl.cc +++ b/cc/layers/texture_layer_impl.cc
@@ -59,6 +59,7 @@ texture_layer->SetBlendBackgroundColor(blend_background_color_); texture_layer->SetForceTextureToOpaque(force_texture_to_opaque_); texture_layer->SetNearestNeighbor(nearest_neighbor_); + texture_layer->SetHDRMetadata(hdr_metadata_); if (own_resource_) { texture_layer->SetTransferableResource(transferable_resource_, std::move(release_callback_)); @@ -154,6 +155,7 @@ nearest_neighbor_, /*secure_output=*/false, gfx::ProtectedVideoType::kClear); quad->set_resource_size_in_pixels(transferable_resource_.size); + quad->hdr_metadata = hdr_metadata_; ValidateQuadResources(quad); } @@ -229,6 +231,11 @@ uv_bottom_right_ = bottom_right; } +void TextureLayerImpl::SetHDRMetadata( + absl::optional<gfx::HDRMetadata> hdr_metadata) { + hdr_metadata_ = hdr_metadata; +} + void TextureLayerImpl::SetTransferableResource( const viz::TransferableResource& resource, viz::ReleaseCallback release_callback) {
diff --git a/cc/layers/texture_layer_impl.h b/cc/layers/texture_layer_impl.h index 4b8f0088..d4853af 100644 --- a/cc/layers/texture_layer_impl.h +++ b/cc/layers/texture_layer_impl.h
@@ -17,6 +17,8 @@ #include "cc/resources/cross_thread_shared_bitmap.h" #include "components/viz/common/resources/release_callback.h" #include "components/viz/common/resources/transferable_resource.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/gfx/hdr_metadata.h" namespace cc { @@ -56,6 +58,7 @@ void SetNearestNeighbor(bool nearest_neighbor); void SetUVTopLeft(const gfx::PointF& top_left); void SetUVBottomRight(const gfx::PointF& bottom_right); + void SetHDRMetadata(absl::optional<gfx::HDRMetadata> hdr_metadata); void SetTransferableResource(const viz::TransferableResource& resource, viz::ReleaseCallback release_callback); @@ -87,6 +90,7 @@ bool nearest_neighbor_ = false; gfx::PointF uv_top_left_ = gfx::PointF(); gfx::PointF uv_bottom_right_ = gfx::PointF(1.f, 1.f); + absl::optional<gfx::HDRMetadata> hdr_metadata_; // True while the |transferable_resource_| is owned by this layer, and // becomes false once it is passed to another layer or to the
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index 96bda64..8bbd999 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc
@@ -220,6 +220,8 @@ gfx::PointF(0.25f, 0.25f), gfx::PointF(0.75f, 0.75f))); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetPremultipliedAlpha(false)); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBlendBackgroundColor(true)); + EXPECT_SET_NEEDS_COMMIT(0, test_layer->SetHDRMetadata(absl::nullopt)); + EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHDRMetadata(gfx::HDRMetadata())); } class RunOnCommitLayerTreeHostClient : public FakeLayerTreeHostClient {
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index 377b2eb..d5c56fd 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc
@@ -106,6 +106,7 @@ #include "chrome/install_static/install_util.h" #include "components/browser_watcher/extended_crash_reporting.h" #include "sandbox/win/src/sandbox.h" +#include "sandbox/win/src/sandbox_factory.h" #include "ui/base/resource/resource_bundle_win.h" #endif @@ -1615,6 +1616,13 @@ } #endif +#if BUILDFLAG(IS_WIN) + if (IsExtensionPointDisableSet()) { + sandbox::SandboxFactory::GetBrokerServices()->SetStartingMitigations( + sandbox::MITIGATION_EXTENSION_POINT_DISABLE); + } +#endif + // Do not interrupt startup. return absl::nullopt; }
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index 856d482..6c52d44 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd
@@ -1582,6 +1582,12 @@ <message name="IDS_HIGH_EFFICIENCY_DIALOG_BODY" desc="Body text for a dialog describing that Memory Saver mode will use less memory from inactive tabs and that this is a setting the user can control."> As needed, Chromium reclaims memory from tabs you aren't actively using. You can change this anytime in settings. </message> + <message name="IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TITLE" desc="The title for the high efficiency info mode in-product promo bubble."> + Chromium turned on Memory Saver + </message> + <message name="IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TEXT" desc="The text shown for the high efficiency info mode in-product promo bubble."> + To make your browsing faster, Chromium reclaims memory from tabs you aren't using. + </message> </if> </messages> </release>
diff --git a/chrome/app/chromium_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TEXT.png.sha1 b/chrome/app/chromium_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TEXT.png.sha1 new file mode 100644 index 0000000..939bc29b --- /dev/null +++ b/chrome/app/chromium_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TEXT.png.sha1
@@ -0,0 +1 @@ +66ca1b2333bd7ae6c7c0a813fc486b271857b714 \ No newline at end of file
diff --git a/chrome/app/chromium_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TITLE.png.sha1 b/chrome/app/chromium_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TITLE.png.sha1 new file mode 100644 index 0000000..939bc29b --- /dev/null +++ b/chrome/app/chromium_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TITLE.png.sha1
@@ -0,0 +1 @@ +66ca1b2333bd7ae6c7c0a813fc486b271857b714 \ No newline at end of file
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 623a630..f3ded22f 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -7545,6 +7545,9 @@ <message name="IDS_BATTERY_SAVER_MODE_PROMO_ACTION_TEXT" desc="The custom action button text for the battery saver mode in-product promo bubble."> Settings </message> + <message name="IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_ACTION_TEXT" desc="The custom action button text for the high efficiency info mode in-product promo bubble."> + Settings + </message> <!-- User Education Tutorial Strings --> <if expr="use_titlecase">
diff --git a/chrome/app/generated_resources_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_ACTION_TEXT.png.sha1 b/chrome/app/generated_resources_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_ACTION_TEXT.png.sha1 new file mode 100644 index 0000000..87aaed0 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_ACTION_TEXT.png.sha1
@@ -0,0 +1 @@ +7fa4851d0323a4604896adb9dfd3ec5ff313c964 \ No newline at end of file
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index 31621b4..3703be6 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd
@@ -1684,6 +1684,12 @@ <message name="IDS_HIGH_EFFICIENCY_DIALOG_BODY" desc="Body text for a dialog describing that Memory Saver mode will use less memory from inactive tabs and that this is a setting the user can control."> As needed, Chrome reclaims memory from tabs you aren't actively using. You can change this anytime in settings. </message> + <message name="IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TITLE" desc="The title for the high efficiency info mode in-product promo bubble."> + Chrome turned on Memory Saver + </message> + <message name="IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TEXT" desc="The text shown for the high efficiency info mode in-product promo bubble."> + To make your browsing faster, Chrome reclaims memory from tabs you aren't using. + </message> </if> </messages> </release>
diff --git a/chrome/app/google_chrome_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TEXT.png.sha1 b/chrome/app/google_chrome_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TEXT.png.sha1 new file mode 100644 index 0000000..87aaed0 --- /dev/null +++ b/chrome/app/google_chrome_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TEXT.png.sha1
@@ -0,0 +1 @@ +7fa4851d0323a4604896adb9dfd3ec5ff313c964 \ No newline at end of file
diff --git a/chrome/app/google_chrome_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TITLE.png.sha1 b/chrome/app/google_chrome_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TITLE.png.sha1 new file mode 100644 index 0000000..87aaed0 --- /dev/null +++ b/chrome/app/google_chrome_strings_grd/IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TITLE.png.sha1
@@ -0,0 +1 @@ +7fa4851d0323a4604896adb9dfd3ec5ff313c964 \ No newline at end of file
diff --git a/chrome/app/main_dll_loader_win.cc b/chrome/app/main_dll_loader_win.cc index 9a8ce98..880ee82d 100644 --- a/chrome/app/main_dll_loader_win.cc +++ b/chrome/app/main_dll_loader_win.cc
@@ -32,6 +32,7 @@ #include "base/win/windows_version.h" #include "build/branding_buildflags.h" #include "chrome/browser/active_use_util.h" +#include "chrome/chrome_elf/chrome_elf_main.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_result_codes.h" @@ -138,7 +139,10 @@ // For child processes that are running as --no-sandbox, don't initialize // the sandbox info, otherwise they'll be treated as brokers (as if they // were the browser). - content::InitializeSandboxInfo(&sandbox_info); + content::InitializeSandboxInfo( + &sandbox_info, IsExtensionPointDisableSet() + ? sandbox::MITIGATION_EXTENSION_POINT_DISABLE + : 0); } base::FilePath file;
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index c6fd8022..e4bb253 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -5482,6 +5482,8 @@ "chromeos/policy/dlp/dlp_warn_notifier.h", "chromeos/reporting/device_reporting_settings_lacros.cc", "chromeos/reporting/device_reporting_settings_lacros.h", + "chromeos/reporting/metric_reporting_manager_lacros.cc", + "chromeos/reporting/metric_reporting_manager_lacros.h", "feedback/show_feedback_page_lacros.cc", "lacros/account_manager/account_cache.cc", "lacros/account_manager/account_cache.h",
diff --git a/chrome/browser/android/explore_sites/get_catalog_task.cc b/chrome/browser/android/explore_sites/get_catalog_task.cc index 7634a97..4c51b99 100644 --- a/chrome/browser/android/explore_sites/get_catalog_task.cc +++ b/chrome/browser/android/explore_sites/get_catalog_task.cc
@@ -110,7 +110,8 @@ if (update_current) { DVLOG(1) << "Updating current catalog from " << catalog_version_token; sql::Transaction transaction(db); - transaction.Begin(); + if (!transaction.Begin()) + return std::make_pair(GetCatalogStatus::kFailed, nullptr); catalog_version_token = UpdateCurrentCatalogIfNewer(&meta_table, catalog_version_token); if (catalog_version_token == "")
diff --git a/chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.cc b/chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.cc index c7f03ee4..da88b51 100644 --- a/chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.cc +++ b/chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.cc
@@ -4,11 +4,10 @@ #include "chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.h" -#include <algorithm> - #include "ash/constants/ash_pref_names.h" #include "base/containers/contains.h" #include "base/logging.h" +#include "base/ranges/algorithm.h" #include "chrome/browser/ash/account_manager/account_manager_util.h" #include "chrome/browser/ash/child_accounts/edu_coexistence_tos_store_utils.h" #include "chrome/browser/profiles/profile.h" @@ -90,12 +89,9 @@ continue; } - auto iterator = - std::find_if(current_edu_account_consent_list.begin(), - current_edu_account_consent_list.end(), - [&account](const edu_coexistence::UserConsentInfo& info) { - return info.edu_account_gaia_id == account.key.id(); - }); + auto iterator = base::ranges::find( + current_edu_account_consent_list, account.key.id(), + &edu_coexistence::UserConsentInfo::edu_account_gaia_id); // If account exists in |current_edu_account_consent_list| copy the entry // over.
diff --git a/chrome/browser/ash/arc/accessibility/auto_complete_handler_unittest.cc b/chrome/browser/ash/arc/accessibility/auto_complete_handler_unittest.cc index f0830e8..88a9077 100644 --- a/chrome/browser/ash/arc/accessibility/auto_complete_handler_unittest.cc +++ b/chrome/browser/ash/arc/accessibility/auto_complete_handler_unittest.cc
@@ -10,6 +10,7 @@ #include "ash/components/arc/mojom/accessibility_helper.mojom.h" #include "base/containers/contains.h" +#include "base/ranges/algorithm.h" #include "chrome/browser/ash/arc/accessibility/accessibility_info_data_wrapper.h" #include "chrome/browser/ash/arc/accessibility/accessibility_node_info_data_wrapper.h" #include "chrome/browser/ash/arc/accessibility/accessibility_window_info_data_wrapper.h" @@ -207,12 +208,10 @@ AutoCompleteHandler::CreateIfNecessary(tree_source(), *event_data); ASSERT_EQ(2U, create_result.size()); - auto editable1_handler = - std::find_if(create_result.begin(), create_result.end(), - [](const auto& p) { return p.first == 1; }); - auto editable2_handler = - std::find_if(create_result.begin(), create_result.end(), - [](const auto& p) { return p.first == 2; }); + auto editable1_handler = base::ranges::find( + create_result, 1, &AutoCompleteHandler::IdAndHandler::first); + auto editable2_handler = base::ranges::find( + create_result, 2, &AutoCompleteHandler::IdAndHandler::first); ASSERT_NE(editable1_handler, create_result.end()); ASSERT_NE(editable2_handler, create_result.end());
diff --git a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc index f8cc6b2..be5dfbee 100644 --- a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc +++ b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -28,6 +28,7 @@ #include "base/logging.h" #include "base/memory/singleton.h" #include "base/posix/eintr_wrapper.h" +#include "base/ranges/algorithm.h" #include "base/task/thread_pool.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" @@ -281,9 +282,7 @@ RemoteGattAttribute* FindGattAttributeByUuid( const std::vector<RemoteGattAttribute*>& attributes, const BluetoothUUID& uuid) { - auto it = std::find_if( - attributes.begin(), attributes.end(), - [uuid](RemoteGattAttribute* attr) { return attr->GetUUID() == uuid; }); + auto it = base::ranges::find(attributes, uuid, &RemoteGattAttribute::GetUUID); return it != attributes.end() ? *it : nullptr; }
diff --git a/chrome/browser/ash/arc/input_method_manager/arc_input_method_state.cc b/chrome/browser/ash/arc/input_method_manager/arc_input_method_state.cc index 82f634b5..7520fe4 100644 --- a/chrome/browser/ash/arc/input_method_manager/arc_input_method_state.cc +++ b/chrome/browser/ash/arc/input_method_manager/arc_input_method_state.cc
@@ -4,13 +4,12 @@ #include "chrome/browser/ash/arc/input_method_manager/arc_input_method_state.h" -#include <algorithm> - #include "ash/components/arc/mojom/input_method_manager.mojom.h" #include "ash/public/cpp/keyboard/keyboard_switches.h" #include "ash/public/cpp/tablet_mode.h" #include "base/command_line.h" #include "base/metrics/histogram_macros.h" +#include "base/ranges/algorithm.h" #include "components/prefs/pref_service.h" #include "mojo/public/cpp/bindings/struct_ptr.h" #include "ui/base/ime/ash/extension_ime_util.h" @@ -66,10 +65,8 @@ void ArcInputMethodState::SetInputMethodEnabled(const std::string& ime_id, bool enabled) { - auto it = std::find_if(installed_imes_.begin(), installed_imes_.end(), - [&ime_id](const InputMethodEntry& entry) { - return ime_id == entry.ime_id_; - }); + auto it = + base::ranges::find(installed_imes_, ime_id, &InputMethodEntry::ime_id_); if (it == installed_imes_.end()) { // Ignore the request to enable/disable not-installed IME. return;
diff --git a/chrome/browser/ash/borealis/borealis_disk_manager_impl.cc b/chrome/browser/ash/borealis/borealis_disk_manager_impl.cc index e9ae1c7a..9601c60 100644 --- a/chrome/browser/ash/borealis/borealis_disk_manager_impl.cc +++ b/chrome/browser/ash/borealis/borealis_disk_manager_impl.cc
@@ -4,12 +4,12 @@ #include "chrome/browser/ash/borealis/borealis_disk_manager_impl.h" -#include <algorithm> #include <string> #include "ash/constants/ash_features.h" #include "base/bind.h" #include "base/logging.h" +#include "base/ranges/algorithm.h" #include "base/strings/string_number_conversions.h" #include "base/system/sys_info.h" #include "base/task/thread_pool.h" @@ -177,9 +177,8 @@ return; } const std::string& vm_name = context_->vm_name(); - auto image = - std::find_if(response->images().begin(), response->images().end(), - [&vm_name](const auto& a) { return a.name() == vm_name; }); + auto image = base::ranges::find(response->images(), vm_name, + &vm_tools::concierge::VmDiskInfo::name); if (image == response->images().end()) { Fail(Described<BorealisGetDiskInfoResult>( BorealisGetDiskInfoResult::kConciergeFailed,
diff --git a/chrome/browser/ash/crosapi/browser_version_service_ash.cc b/chrome/browser/ash/crosapi/browser_version_service_ash.cc index aed1dfb4..1abecaf8 100644 --- a/chrome/browser/ash/crosapi/browser_version_service_ash.cc +++ b/chrome/browser/ash/crosapi/browser_version_service_ash.cc
@@ -3,6 +3,8 @@ // found in the LICENSE file. #include "chrome/browser/ash/crosapi/browser_version_service_ash.h" + +#include "base/ranges/algorithm.h" #include "chrome/browser/ash/crosapi/browser_util.h" namespace { @@ -10,11 +12,8 @@ absl::optional<component_updater::ComponentInfo> GetComponent( const std::vector<component_updater::ComponentInfo>& components, const std::string& id) { - auto it = std::find_if( - components.begin(), components.end(), - [id](const component_updater::ComponentInfo& component_info) { - return component_info.id == id; - }); + auto it = + base::ranges::find(components, id, &component_updater::ComponentInfo::id); if (it != components.end()) return *it;
diff --git a/chrome/browser/ash/crostini/crostini_disk.cc b/chrome/browser/ash/crostini/crostini_disk.cc index 52d672c..c732d82f 100644 --- a/chrome/browser/ash/crostini/crostini_disk.cc +++ b/chrome/browser/ash/crostini/crostini_disk.cc
@@ -4,12 +4,12 @@ #include "chrome/browser/ash/crostini/crostini_disk.h" -#include <algorithm> #include <cmath> #include <utility> #include "base/bind.h" #include "base/metrics/histogram_functions.h" +#include "base/ranges/algorithm.h" #include "base/strings/utf_string_conversions.h" #include "base/system/sys_info.h" #include "base/task/thread_pool.h" @@ -141,9 +141,8 @@ return; } auto disk_info = std::make_unique<CrostiniDiskInfo>(); - auto image = - std::find_if(response->images().begin(), response->images().end(), - [&vm_name](const auto& a) { return a.name() == vm_name; }); + auto image = base::ranges::find(response->images(), vm_name, + &vm_tools::concierge::VmDiskInfo::name); if (image == response->images().end()) { // No match found for the VM: LOG(ERROR) << "No VM found with name " << vm_name;
diff --git a/chrome/browser/ash/crostini/crostini_port_forwarder.cc b/chrome/browser/ash/crostini/crostini_port_forwarder.cc index 582da6d..c6a075f 100644 --- a/chrome/browser/ash/crostini/crostini_port_forwarder.cc +++ b/chrome/browser/ash/crostini/crostini_port_forwarder.cc
@@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <fcntl.h> - #include "chrome/browser/ash/crostini/crostini_port_forwarder.h" +#include <fcntl.h> + #include "base/bind.h" #include "base/callback_helpers.h" #include "base/no_destructor.h" +#include "base/ranges/algorithm.h" #include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/crostini/crostini_util.h" @@ -108,9 +109,9 @@ PrefService* pref_service = profile_->GetPrefs(); ListPrefUpdate update(pref_service, crostini::prefs::kCrostiniPortForwarding); base::Value::List& update_list = update->GetList(); - auto it = std::find_if( - update_list.begin(), update_list.end(), - [&key, this](const auto& dict) { return MatchPortRuleDict(dict, key); }); + auto it = base::ranges::find_if(update_list, [&key, this](const auto& dict) { + return MatchPortRuleDict(dict, key); + }); if (it == update_list.end()) return false; update_list.erase(it); @@ -122,9 +123,9 @@ PrefService* pref_service = profile_->GetPrefs(); const base::Value::List& all_ports = pref_service->GetList(crostini::prefs::kCrostiniPortForwarding); - auto it = std::find_if( - all_ports.begin(), all_ports.end(), - [&key, this](const auto& dict) { return MatchPortRuleDict(dict, key); }); + auto it = base::ranges::find_if(all_ports, [&key, this](const auto& dict) { + return MatchPortRuleDict(dict, key); + }); if (it == all_ports.end()) { return absl::nullopt; }
diff --git a/chrome/browser/ash/dbus/chrome_features_service_provider.cc b/chrome/browser/ash/dbus/chrome_features_service_provider.cc index 891d7a8..66f03c12 100644 --- a/chrome/browser/ash/dbus/chrome_features_service_provider.cc +++ b/chrome/browser/ash/dbus/chrome_features_service_provider.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/ash/dbus/chrome_features_service_provider.h" -#include <algorithm> #include <iterator> #include <memory> #include <string> @@ -17,6 +16,7 @@ #include "base/bind.h" #include "base/feature_list.h" #include "base/metrics/field_trial.h" +#include "base/ranges/algorithm.h" #include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" @@ -200,10 +200,7 @@ } auto* const* it = - std::find_if(std::begin(kFeatureLookup), std::end(kFeatureLookup), - [&feature_name](const base::Feature* feature) -> bool { - return feature_name == feature->name; - }); + base::ranges::find(kFeatureLookup, feature_name, &base::Feature::name); if (it != std::end(kFeatureLookup)) { SendResponse(method_call, std::move(response_sender), base::FeatureList::IsEnabled(**it));
diff --git a/chrome/browser/ash/dbus/vm/vm_permission_service_provider.cc b/chrome/browser/ash/dbus/vm/vm_permission_service_provider.cc index 95d2327..e5d41d4 100644 --- a/chrome/browser/ash/dbus/vm/vm_permission_service_provider.cc +++ b/chrome/browser/ash/dbus/vm/vm_permission_service_provider.cc
@@ -71,7 +71,7 @@ VmPermissionServiceProvider::VmMap::iterator VmPermissionServiceProvider::FindVm(const std::string& owner_id, const std::string& name) { - return std::find_if(vms_.begin(), vms_.end(), [&](const auto& vm) { + return base::ranges::find_if(vms_, [&](const auto& vm) { return vm.second->owner_id == owner_id && vm.second->name == name; }); }
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc index 4bd1348..1fb91fc5 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc
@@ -6,7 +6,6 @@ #include <stddef.h> -#include <algorithm> #include <memory> #include <utility> @@ -3342,13 +3341,8 @@ } // Ignore known WebContents. - bool found = - std::find_if(swa_web_contents_.begin(), swa_web_contents_.end(), - [web_contents](const auto& pair) { - return pair.second == web_contents; - }) != swa_web_contents_.end(); - - if (!found) { + if (!base::Contains(swa_web_contents_, web_contents, + &IdToWebContents::value_type::second)) { return web_contents; } }
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.h b/chrome/browser/ash/file_manager/file_manager_browsertest_base.h index da743ac..2915e0a 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.h +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.h
@@ -175,6 +175,8 @@ void StartTest(); private: + using IdToWebContents = std::map<std::string, content::WebContents*>; + class MockFileTasksObserver; // Launches the test extension with manifest |manifest_name|. The extension @@ -248,7 +250,7 @@ // Maps the app_id to WebContents* for all launched SWA apps. NOTE: if the // window is closed in the JS the WebContents* will remain invalid here. - std::map<std::string, content::WebContents*> swa_web_contents_; + IdToWebContents swa_web_contents_; std::unique_ptr<base::test::ScopedFeatureList> feature_list_; crostini::FakeCrostiniFeatures crostini_features_;
diff --git a/chrome/browser/ash/file_manager/file_manager_test_util.cc b/chrome/browser/ash/file_manager/file_manager_test_util.cc index 8731134d..4325b28c 100644 --- a/chrome/browser/ash/file_manager/file_manager_test_util.cc +++ b/chrome/browser/ash/file_manager/file_manager_test_util.cc
@@ -7,6 +7,7 @@ #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/path_service.h" +#include "base/ranges/algorithm.h" #include "base/test/bind.h" #include "chrome/browser/ash/file_manager/app_id.h" #include "chrome/browser/ash/file_manager/path_util.h" @@ -54,10 +55,8 @@ } OpenOperationResult FolderInMyFiles::Open(const base::FilePath& file) { - const auto& it = std::find_if(files_.begin(), files_.end(), - [file](const base::FilePath& i) { - return i.BaseName() == file.BaseName(); - }); + const auto& it = + base::ranges::find(files_, file.BaseName(), &base::FilePath::BaseName); EXPECT_FALSE(it == files_.end()); if (it == files_.end()) return platform_util::OPEN_FAILED_PATH_NOT_FOUND;
diff --git a/chrome/browser/ash/file_manager/file_tasks.cc b/chrome/browser/ash/file_manager/file_tasks.cc index dae1a5d..7bdc7ed 100644 --- a/chrome/browser/ash/file_manager/file_tasks.cc +++ b/chrome/browser/ash/file_manager/file_tasks.cc
@@ -19,6 +19,7 @@ #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" +#include "base/ranges/algorithm.h" #include "base/strings/strcat.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" @@ -213,8 +214,8 @@ void AdjustTasksForMediaApp(const std::vector<extensions::EntryInfo>& entries, std::vector<FullTaskDescriptor>* tasks) { const auto task_for_app = [&](const std::string& app_id) { - return std::find_if(tasks->begin(), tasks->end(), [&](const auto& task) { - return task.task_descriptor.app_id == app_id; + return base::ranges::find(*tasks, app_id, [](const auto& task) { + return task.task_descriptor.app_id; }); }; @@ -350,9 +351,8 @@ // app. We want both tasks to be available, so add the office task if the // WebDrive task is available. // TODO(petermarshall): Find a better way to enable both tasks. - auto it = std::find_if( - result_list->begin(), result_list->end(), - [](const FullTaskDescriptor& task) { + auto it = + base::ranges::find_if(*result_list, [](const FullTaskDescriptor& task) { if (!IsFilesAppId(task.task_descriptor.app_id)) { return false; }
diff --git a/chrome/browser/ash/file_manager/file_tasks_browsertest.cc b/chrome/browser/ash/file_manager/file_tasks_browsertest.cc index 09253872..6e5af78 100644 --- a/chrome/browser/ash/file_manager/file_tasks_browsertest.cc +++ b/chrome/browser/ash/file_manager/file_tasks_browsertest.cc
@@ -7,6 +7,7 @@ #include "base/callback_helpers.h" #include "base/files/file_util.h" #include "base/path_service.h" +#include "base/ranges/algorithm.h" #include "base/strings/string_util.h" #include "base/test/bind.h" #include "base/test/scoped_feature_list.h" @@ -71,8 +72,7 @@ --*remaining; auto default_task = - std::find_if(result->begin(), result->end(), - [](const auto& task) { return task.is_default; }); + base::ranges::find_if(*result, &FullTaskDescriptor::is_default); // Early exit for the uncommon situation where no default should be set. if (!expectation.app_id) {
diff --git a/chrome/browser/ash/file_manager/trash_io_task.cc b/chrome/browser/ash/file_manager/trash_io_task.cc index e9f1e6b..9b7c067 100644 --- a/chrome/browser/ash/file_manager/trash_io_task.cc +++ b/chrome/browser/ash/file_manager/trash_io_task.cc
@@ -7,7 +7,9 @@ #include <sys/xattr.h> #include "base/callback.h" +#include "base/containers/adapters.h" #include "base/files/file_util.h" +#include "base/ranges/algorithm.h" #include "base/strings/strcat.h" #include "base/system/sys_info.h" #include "base/task/bind_post_task.h" @@ -176,10 +178,10 @@ // however in the case of nested directories, reverse lexicographical order is // preferred to ensure the closer parent path by depth is chosen. const trash::TrashPathsMap::reverse_iterator& trash_parent_path_it = - std::find_if(free_space_map_.rbegin(), free_space_map_.rend(), - [&source_path](const auto& it) -> bool { - return it.first.IsParent(source_path); - }); + base::ranges::find_if(base::Reversed(free_space_map_), + [&source_path](const auto& it) { + return it.first.IsParent(source_path); + }); if (trash_parent_path_it == free_space_map_.rend()) { // The `source_path` is not parented at a supported Trash location, bail
diff --git a/chrome/browser/ash/guest_os/guest_id.cc b/chrome/browser/ash/guest_os/guest_id.cc index 6db8950..7e12279 100644 --- a/chrome/browser/ash/guest_os/guest_id.cc +++ b/chrome/browser/ash/guest_os/guest_id.cc
@@ -10,6 +10,7 @@ #include "base/containers/contains.h" #include "base/logging.h" #include "base/no_destructor.h" +#include "base/ranges/algorithm.h" #include "chrome/browser/ash/guest_os/guest_os_pref_names.h" #include "chrome/browser/profiles/profile.h" #include "chromeos/ash/components/dbus/vm_applications/apps.pb.h" @@ -129,10 +130,9 @@ const GuestId& container_id, base::Value::Dict properties) { ListPrefUpdate updater(profile->GetPrefs(), prefs::kGuestOsContainers); - auto it = std::find_if( - updater->GetListDeprecated().begin(), updater->GetListDeprecated().end(), - [&](const auto& dict) { return MatchContainerDict(dict, container_id); }); - if (it != updater->GetListDeprecated().end()) { + if (base::ranges::any_of(updater->GetListDeprecated(), [&](const auto& dict) { + return MatchContainerDict(dict, container_id); + })) { return; }
diff --git a/chrome/browser/ash/input_method/input_method_manager_impl.cc b/chrome/browser/ash/input_method/input_method_manager_impl.cc index 42c10b8..cb47a890 100644 --- a/chrome/browser/ash/input_method/input_method_manager_impl.cc +++ b/chrome/browser/ash/input_method/input_method_manager_impl.cc
@@ -6,7 +6,6 @@ #include <stdint.h> -#include <algorithm> // std::find #include <memory> #include <set> #include <sstream> @@ -21,6 +20,7 @@ #include "base/location.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/ranges/algorithm.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -652,8 +652,7 @@ switch_to_pending = true; const auto currently_enabled_iter = - std::find(enabled_input_method_ids_.begin(), - enabled_input_method_ids_.end(), entry.first); + base::ranges::find(enabled_input_method_ids_, entry.first); bool currently_enabled = currently_enabled_iter != enabled_input_method_ids_.end(); @@ -764,12 +763,9 @@ std::unique_ptr<InputMethodDescriptors> sorted_enabled_input_methods = GetEnabledInputMethodsSortedByLocalizedDisplayNames(); - auto iter = std::find_if( - sorted_enabled_input_methods->begin(), - sorted_enabled_input_methods->end(), - [¤t_input_method_id](const InputMethodDescriptor& input_method) { - return current_input_method_id == input_method.id(); - }); + auto iter = + base::ranges::find(*sorted_enabled_input_methods, current_input_method_id, + &InputMethodDescriptor::id); if (iter != sorted_enabled_input_methods->end()) ++iter; @@ -792,8 +788,7 @@ } const auto iter = - std::find(enabled_input_method_ids_.begin(), - enabled_input_method_ids_.end(), last_used_input_method_id_); + base::ranges::find(enabled_input_method_ids_, last_used_input_method_id_); if (iter == enabled_input_method_ids_.end()) { // last_used_input_method_id_ is not supported. SwitchToNextInputMethod();
diff --git a/chrome/browser/ash/input_method/ui/candidate_view_unittest.cc b/chrome/browser/ash/input_method/ui/candidate_view_unittest.cc index 9cf8119..6be3a84 100644 --- a/chrome/browser/ash/input_method/ui/candidate_view_unittest.cc +++ b/chrome/browser/ash/input_method/ui/candidate_view_unittest.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include "base/check.h" +#include "base/ranges/algorithm.h" #include "base/strings/utf_string_conversions.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" @@ -90,9 +91,8 @@ int GetHighlightedIndex() const { const auto& children = container_->children(); - const auto it = - std::find_if(children.cbegin(), children.cend(), - [](const views::View* v) { return !!v->background(); }); + const auto it = base::ranges::find_if( + children, [](const views::View* v) { return !!v->background(); }); return (it == children.cend()) ? -1 : std::distance(children.cbegin(), it); }
diff --git a/chrome/browser/ash/input_method/ui/suggestion_window_view_unittest.cc b/chrome/browser/ash/input_method/ui/suggestion_window_view_unittest.cc index b767513..d5d5861 100644 --- a/chrome/browser/ash/input_method/ui/suggestion_window_view_unittest.cc +++ b/chrome/browser/ash/input_method/ui/suggestion_window_view_unittest.cc
@@ -6,6 +6,7 @@ #include <string> +#include "base/ranges/algorithm.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/ash/input_method/assistive_window_properties.h" #include "chrome/browser/ash/input_method/ui/assistive_delegate.h" @@ -79,9 +80,8 @@ const auto& children = suggestion_window_view_->multiple_candidate_area_for_testing() ->children(); - const auto it = - std::find_if(children.cbegin(), children.cend(), - [](const views::View* v) { return !!v->background(); }); + const auto it = base::ranges::find_if( + children, [](const views::View* v) { return !!v->background(); }); return (it == children.cend()) ? absl::nullopt : absl::make_optional(std::distance(children.cbegin(), it));
diff --git a/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc b/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc index cb8aba5..8cdb0f48 100644 --- a/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc +++ b/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/containers/flat_map.h" +#include "base/ranges/algorithm.h" #include "base/strings/escape.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" @@ -460,9 +461,8 @@ kerberos::ErrorType error) { // Reset the |runner|. Note that |updated_principal| is passed by value, // not by reference, since |runner| owns the reference. - auto it = std::find_if( - add_account_runners_.begin(), add_account_runners_.end(), - [runner](const auto& runner_ptr) { return runner_ptr.get() == runner; }); + auto it = base::ranges::find(add_account_runners_, runner, + &std::unique_ptr<KerberosAddAccountRunner>::get); // Semantically, this `CHECK()` should never trigger. However, it protects // the `erase()` call from semantically incorrect changes to this class.
diff --git a/chrome/browser/ash/login/users/fake_chrome_user_manager.cc b/chrome/browser/ash/login/users/fake_chrome_user_manager.cc index 3bf0492..7531495 100644 --- a/chrome/browser/ash/login/users/fake_chrome_user_manager.cc +++ b/chrome/browser/ash/login/users/fake_chrome_user_manager.cc
@@ -11,6 +11,7 @@ #include "ash/constants/ash_switches.h" #include "base/callback.h" #include "base/command_line.h" +#include "base/ranges/algorithm.h" #include "base/system/sys_info.h" #include "base/task/single_thread_task_runner.h" #include "chrome/browser/ash/login/users/avatar/mock_user_image_manager.h" @@ -296,10 +297,7 @@ ProfileHelper::Get()->RemoveUserFromListForTesting(account_id); const user_manager::UserList::iterator it = - std::find_if(users_.begin(), users_.end(), - [&account_id](const user_manager::User* user) { - return user->GetAccountId() == account_id; - }); + base::ranges::find(users_, account_id, &user_manager::User::GetAccountId); if (it != users_.end()) { if (primary_user_ == *it) primary_user_ = nullptr;
diff --git a/chrome/browser/ash/ownership/owner_settings_service_ash.cc b/chrome/browser/ash/ownership/owner_settings_service_ash.cc index a7f043e..cd4bf712 100644 --- a/chrome/browser/ash/ownership/owner_settings_service_ash.cc +++ b/chrome/browser/ash/ownership/owner_settings_service_ash.cc
@@ -660,6 +660,7 @@ // kAccountsPrefTransferSAMLCookies // kDeviceAttestationEnabled // kDeviceOwner + // kDeviceReportXDREvents // kHeartbeatEnabled // kHeartbeatFrequency // kReleaseChannelDelegated
diff --git a/chrome/browser/ash/policy/core/device_policy_decoder.cc b/chrome/browser/ash/policy/core/device_policy_decoder.cc index 49050d51..446d1da 100644 --- a/chrome/browser/ash/policy/core/device_policy_decoder.cc +++ b/chrome/browser/ash/policy/core/device_policy_decoder.cc
@@ -2070,6 +2070,16 @@ nullptr); } } + + if (policy.has_device_report_xdr_events()) { + const em::DeviceReportXDREventsProto& container( + policy.device_report_xdr_events()); + if (container.has_enabled()) { + policies->Set(policy::key::kDeviceReportXDREvents, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, + base::Value(container.enabled()), nullptr); + } + } } } // namespace
diff --git a/chrome/browser/ash/policy/core/device_policy_decoder_unittest.cc b/chrome/browser/ash/policy/core/device_policy_decoder_unittest.cc index d0b71963..e30a4d5e 100644 --- a/chrome/browser/ash/policy/core/device_policy_decoder_unittest.cc +++ b/chrome/browser/ash/policy/core/device_policy_decoder_unittest.cc
@@ -449,4 +449,17 @@ std::move(autofill_saml_username_value)); } +TEST_F(DevicePolicyDecoderTest, DeviceReportXDREvents) { + em::ChromeDeviceSettingsProto device_policy; + + DecodeUnsetDevicePolicyTestHelper(device_policy, key::kDeviceReportXDREvents); + + base::Value device_report_xdr_events_value(true); + device_policy.mutable_device_report_xdr_events()->set_enabled( + device_report_xdr_events_value.GetBool()); + + DecodeDevicePolicyTestHelper(device_policy, key::kDeviceReportXDREvents, + std::move(device_report_xdr_events_value)); +} + } // namespace policy
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/network/network_telemetry_sampler.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/network/network_telemetry_sampler.cc index 26d6f5c..7b4ad0b3 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/network/network_telemetry_sampler.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/network/network_telemetry_sampler.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/ash/policy/reporting/metrics_reporting/network/network_telemetry_sampler.h" -#include <algorithm> #include <string> #include <utility> #include <vector> @@ -12,6 +11,7 @@ #include "base/containers/contains.h" #include "base/containers/queue.h" #include "base/logging.h" +#include "base/ranges/algorithm.h" #include "base/task/bind_post_task.h" #include "base/threading/sequenced_task_runner_handle.h" #include "chrome/browser/ash/policy/reporting/metrics_reporting/network/wifi_signal_strength_rssi_fetcher.h" @@ -60,8 +60,8 @@ const auto& interface_info_list = cros_healthd_telemetry->network_interface_result ->get_network_interface_info(); - const auto& interface_info_it = std::find_if( - interface_info_list.begin(), interface_info_list.end(), + const auto& interface_info_it = base::ranges::find_if( + interface_info_list, [&interface_name](const NetworkInterfaceInfoPtr& interface_info) { return !interface_info.is_null() && interface_info->is_wireless_interface_info() &&
diff --git a/chrome/browser/ash/printing/oauth2/authorization_zone_impl.cc b/chrome/browser/ash/printing/oauth2/authorization_zone_impl.cc index f3f82d1..a8734be 100644 --- a/chrome/browser/ash/printing/oauth2/authorization_zone_impl.cc +++ b/chrome/browser/ash/printing/oauth2/authorization_zone_impl.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/ash/printing/oauth2/authorization_zone_impl.h" -#include <algorithm> #include <memory> #include <string> #include <type_traits> @@ -17,6 +16,7 @@ #include "base/containers/adapters.h" #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" +#include "base/ranges/algorithm.h" #include "base/strings/strcat.h" #include "base/strings/string_util.h" #include "base/types/expected.h" @@ -380,11 +380,8 @@ StatusCode status, const std::string& data) { // Find the session for which the request was completed. - auto it_session = std::find_if( - sessions_.begin(), sessions_.end(), - [&session](const std::unique_ptr<AuthorizationServerSession>& as) { - return as.get() == session; - }); + auto it_session = base::ranges::find( + sessions_, session, &std::unique_ptr<AuthorizationServerSession>::get); DCHECK(it_session != sessions_.end()); // Get the list of callbacks to run and copy the data. @@ -541,9 +538,8 @@ const std::string& state, base::flat_set<std::string>& scopes, std::string& code_verifier) { - std::list<PendingAuthorization>::iterator it = std::find_if( - pending_authorizations_.begin(), pending_authorizations_.end(), - [&state](const PendingAuthorization& pa) { return pa.state == state; }); + std::list<PendingAuthorization>::iterator it = base::ranges::find( + pending_authorizations_, state, &PendingAuthorization::state); if (it == pending_authorizations_.end()) { return false; }
diff --git a/chrome/browser/ash/printing/printer_info_cups.cc b/chrome/browser/ash/printing/printer_info_cups.cc index 83d78d9..c3e9927 100644 --- a/chrome/browser/ash/printing/printer_info_cups.cc +++ b/chrome/browser/ash/printing/printer_info_cups.cc
@@ -4,13 +4,13 @@ #include "chrome/browser/ash/printing/printer_info.h" -#include <algorithm> #include <array> #include <string> #include "base/bind.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" +#include "base/ranges/algorithm.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "base/version.h" @@ -67,9 +67,8 @@ } const auto target = MajorMinor(components[0], components[1]); - const VersionEntry* iter = std::find_if( - kVersions.cbegin(), kVersions.cend(), - [target](const VersionEntry& entry) { return entry.first == target; }); + const VersionEntry* iter = + base::ranges::find(kVersions, target, &VersionEntry::first); if (iter == kVersions.end()) { return IppVersion::kUnknown; @@ -80,13 +79,9 @@ // Returns true if any of the |ipp_versions| are greater than or equal to 2.0. bool AllowedIpp(const std::vector<base::Version>& ipp_versions) { - auto found = - std::find_if(ipp_versions.begin(), ipp_versions.end(), - [](const base::Version& version) { - return version.IsValid() && version.components()[0] >= 2; - }); - - return found != ipp_versions.end(); + return base::ranges::any_of(ipp_versions, [](const base::Version& version) { + return version.IsValid() && version.components()[0] >= 2; + }); } // Returns true if |mime_type| is one of the supported types. @@ -97,8 +92,7 @@ // Returns true if |formats| contains one of the supported printer description // languages for an autoconf printer identified by MIME type. bool SupportsRequiredPDLS(const std::vector<std::string>& formats) { - auto found = std::find_if(formats.begin(), formats.end(), &SupportedMime); - return found != formats.end(); + return base::ranges::any_of(formats, &SupportedMime); } // Returns true if |info| describes a printer for which we want to attempt
diff --git a/chrome/browser/ash/profiles/profile_helper.cc b/chrome/browser/ash/profiles/profile_helper.cc index e8c5811..5917b9c 100644 --- a/chrome/browser/ash/profiles/profile_helper.cc +++ b/chrome/browser/ash/profiles/profile_helper.cc
@@ -14,6 +14,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/command_line.h" +#include "base/ranges/algorithm.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" @@ -426,8 +427,8 @@ const std::string username_hash = ProfileHelper::GetUserIdHashFromProfile(profile); const user_manager::UserList& users = user_manager->GetLoggedInUsers(); - const user_manager::UserList::const_iterator pos = std::find_if( - users.begin(), users.end(), UsernameHashMatcher(username_hash)); + const user_manager::UserList::const_iterator pos = + base::ranges::find_if(users, UsernameHashMatcher(username_hash)); if (pos != users.end()) return *pos; @@ -467,11 +468,8 @@ void ProfileHelperImpl::RemoveUserFromListForTesting( const AccountId& account_id) { - auto it = - std::find_if(user_list_for_testing_.begin(), user_list_for_testing_.end(), - [&account_id](const user_manager::User* user) { - return user->GetAccountId() == account_id; - }); + auto it = base::ranges::find(user_list_for_testing_, account_id, + &user_manager::User::GetAccountId); if (it != user_list_for_testing_.end()) user_list_for_testing_.erase(it); }
diff --git a/chrome/browser/ash/remote_apps/remote_apps_impl.cc b/chrome/browser/ash/remote_apps/remote_apps_impl.cc index 63f286c..3014a2bb 100644 --- a/chrome/browser/ash/remote_apps/remote_apps_impl.cc +++ b/chrome/browser/ash/remote_apps/remote_apps_impl.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/containers/contains.h" +#include "base/ranges/algorithm.h" #include "chrome/browser/ash/remote_apps/remote_apps_manager.h" #include "chrome/browser/ash/remote_apps/remote_apps_manager_factory.h" #include "chrome/browser/profiles/profile.h" @@ -176,11 +177,8 @@ } void RemoteAppsImpl::DisconnectHandler(mojo::RemoteSetElementId id) { - const auto& it = std::find_if( - source_id_to_remote_id_map_.begin(), source_id_to_remote_id_map_.end(), - [&id](const std::pair<std::string, mojo::RemoteSetElementId>& pair) { - return pair.second == id; - }); + const auto& it = base::ranges::find(source_id_to_remote_id_map_, id, + &SourceToRemoteIds::value_type::second); if (it == source_id_to_remote_id_map_.end()) return;
diff --git a/chrome/browser/ash/remote_apps/remote_apps_impl.h b/chrome/browser/ash/remote_apps/remote_apps_impl.h index a555ea5..d1b6331 100644 --- a/chrome/browser/ash/remote_apps/remote_apps_impl.h +++ b/chrome/browser/ash/remote_apps/remote_apps_impl.h
@@ -71,6 +71,8 @@ void OnAppLaunched(const std::string& source_id, const std::string& app_id); private: + using SourceToRemoteIds = std::map<std::string, mojo::RemoteSetElementId>; + void OnAppAdded(AddAppCallback callback, const std::string& app_id, RemoteAppsError error); @@ -78,7 +80,7 @@ void DisconnectHandler(mojo::RemoteSetElementId id); RemoteAppsManager* manager_ = nullptr; - std::map<std::string, mojo::RemoteSetElementId> source_id_to_remote_id_map_; + SourceToRemoteIds source_id_to_remote_id_map_; mojo::ReceiverSet<chromeos::remote_apps::mojom::RemoteApps> receivers_; // Observers with an associated source in `source_id_to_remote_id_map_`. mojo::RemoteSet<chromeos::remote_apps::mojom::RemoteAppLaunchObserver>
diff --git a/chrome/browser/ash/settings/cros_settings.cc b/chrome/browser/ash/settings/cros_settings.cc index 6de1af2..d563534f 100644 --- a/chrome/browser/ash/settings/cros_settings.cc +++ b/chrome/browser/ash/settings/cros_settings.cc
@@ -13,6 +13,7 @@ #include "base/check_op.h" #include "base/command_line.h" #include "base/notreached.h" +#include "base/ranges/algorithm.h" #include "base/strings/string_util.h" #include "base/values.h" #include "chrome/browser/ash/settings/device_settings_provider.h" @@ -290,11 +291,8 @@ std::unique_ptr<CrosSettingsProvider> CrosSettings::RemoveSettingsProvider( CrosSettingsProvider* provider) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - auto it = std::find_if( - providers_.begin(), providers_.end(), - [provider](const std::unique_ptr<CrosSettingsProvider>& ptr) { - return ptr.get() == provider; - }); + auto it = base::ranges::find(providers_, provider, + &std::unique_ptr<CrosSettingsProvider>::get); if (it != providers_.end()) { std::unique_ptr<CrosSettingsProvider> ptr = std::move(*it); providers_.erase(it);
diff --git a/chrome/browser/ash/settings/device_settings_provider.cc b/chrome/browser/ash/settings/device_settings_provider.cc index 9e6d10f..a7b333b 100644 --- a/chrome/browser/ash/settings/device_settings_provider.cc +++ b/chrome/browser/ash/settings/device_settings_provider.cc
@@ -174,6 +174,7 @@ kUsbDetachableAllowlist, kVariationsRestrictParameter, kVirtualMachinesAllowed, + kDeviceReportXDREvents, }; constexpr char InvalidCombinationsOfAllowedUsersPoliciesHistogram[] = @@ -1246,6 +1247,15 @@ base::Value(container.enabled())); } } + + if (policy.has_device_report_xdr_events()) { + const em::DeviceReportXDREventsProto& container( + policy.device_report_xdr_events()); + if (container.has_enabled()) { + new_values_cache->SetValue(kDeviceReportXDREvents, + base::Value(container.enabled())); + } + } } void DecodeLogUploadPolicies(const em::ChromeDeviceSettingsProto& policy,
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_integration_browsertest.cc b/chrome/browser/ash/web_applications/help_app/help_app_integration_browsertest.cc index de967eb..b3159b9 100644 --- a/chrome/browser/ash/web_applications/help_app/help_app_integration_browsertest.cc +++ b/chrome/browser/ash/web_applications/help_app/help_app_integration_browsertest.cc
@@ -13,6 +13,7 @@ #include "ash/webui/help_app_ui/search/search_handler.h" #include "ash/webui/help_app_ui/url_constants.h" #include "ash/webui/web_applications/test/sandboxed_web_ui_test_base.h" +#include "base/ranges/algorithm.h" #include "base/run_loop.h" #include "base/test/bind.h" #include "base/test/metrics/histogram_tester.h" @@ -706,12 +707,8 @@ auto& tasks = GetManager().GetBackgroundTasksForTesting(); // Find the help app's background task. - const auto& help_task = std::find_if( - tasks.begin(), tasks.end(), - [&bg_task_url]( - const std::unique_ptr<ash::SystemWebAppBackgroundTask>& x) { - return x->url_for_testing() == bg_task_url; - }); + const auto& help_task = base::ranges::find( + tasks, bg_task_url, &ash::SystemWebAppBackgroundTask::url_for_testing); ASSERT_NE(help_task, tasks.end()); auto* timer = help_task->get()->get_timer_for_testing();
diff --git a/chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl.cc b/chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl.cc index 0eef0261..34c4020fa 100644 --- a/chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl.cc +++ b/chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl.h" -#include <algorithm> #include <string> #include <utility> #include <vector> @@ -26,6 +25,7 @@ #include "base/logging.h" #include "base/memory/ref_counted_memory.h" #include "base/notreached.h" +#include "base/ranges/algorithm.h" #include "chrome/browser/ash/web_applications/personalization_app/personalization_app_manager.h" #include "chrome/browser/ash/web_applications/personalization_app/personalization_app_manager_factory.h" #include "chrome/browser/ash/web_applications/personalization_app/personalization_app_metrics.h" @@ -536,9 +536,8 @@ ash::PersonalAlbum* PersonalizationAppAmbientProviderImpl::FindPersonalAlbumById( const std::string& album_id) { - auto it = std::find_if( - personal_albums_.albums.begin(), personal_albums_.albums.end(), - [&album_id](const auto& album) { return album.album_id == album_id; }); + auto it = base::ranges::find(personal_albums_.albums, album_id, + &ash::PersonalAlbum::album_id); if (it == personal_albums_.albums.end()) return nullptr; @@ -548,9 +547,8 @@ ash::ArtSetting* PersonalizationAppAmbientProviderImpl::FindArtAlbumById( const std::string& album_id) { - auto it = std::find_if( - settings_->art_settings.begin(), settings_->art_settings.end(), - [&album_id](const auto& album) { return album.album_id == album_id; }); + auto it = base::ranges::find(settings_->art_settings, album_id, + &ash::ArtSetting::album_id); // Album does not exist any more. if (it == settings_->art_settings.end()) return nullptr;
diff --git a/chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl_unittest.cc b/chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl_unittest.cc index 2816208..82c5954 100644 --- a/chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl_unittest.cc +++ b/chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl_unittest.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/ash/web_applications/personalization_app/personalization_app_ambient_provider_impl.h" -#include <algorithm> #include <memory> #include <vector> @@ -16,6 +15,7 @@ #include "ash/public/cpp/ambient/fake_ambient_backend_controller_impl.h" #include "ash/webui/personalization_app/mojom/personalization_app.mojom.h" #include "base/callback_helpers.h" +#include "base/ranges/algorithm.h" #include "base/test/bind.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" @@ -707,8 +707,7 @@ // The fake data has album '1' as selected. std::vector<std::string> selected_ids = SelectedAlbumIds(); - auto it = std::find(selected_ids.begin(), selected_ids.end(), "1"); - EXPECT_NE(it, selected_ids.end()); + EXPECT_TRUE(base::Contains(selected_ids, "1")); ash::personalization_app::mojom::AmbientModeAlbumPtr album = ash::personalization_app::mojom::AmbientModeAlbum::New(); @@ -730,8 +729,7 @@ selected_ids = SelectedAlbumIds(); EXPECT_EQ(1u, selected_ids.size()); - it = std::find(selected_ids.begin(), selected_ids.end(), "1"); - EXPECT_NE(it, selected_ids.end()); + EXPECT_TRUE(base::Contains(selected_ids, "1")); EXPECT_EQ(ash::AmbientModeTopicSource::kGooglePhotos, TopicSource()); } @@ -741,8 +739,7 @@ // The fake data has art setting '0' as enabled. std::vector<ash::ArtSetting> art_settings = ArtSettings(); - auto it = std::find_if(art_settings.begin(), art_settings.end(), - [](const auto& setting) { return setting.enabled; }); + auto it = base::ranges::find_if(art_settings, &ash::ArtSetting::enabled); EXPECT_NE(it, art_settings.end()); EXPECT_EQ(it->album_id, "0"); @@ -754,9 +751,7 @@ SetAlbumSelected(album->id, album->topic_source, album->checked); art_settings = ArtSettings(); - it = std::find_if(art_settings.begin(), art_settings.end(), - [](const auto& setting) { return setting.enabled; }); - EXPECT_EQ(it, art_settings.end()); + EXPECT_TRUE(base::ranges::none_of(art_settings, &ash::ArtSetting::enabled)); album = ash::personalization_app::mojom::AmbientModeAlbum::New(); album->id = '1'; @@ -765,8 +760,7 @@ SetAlbumSelected(album->id, album->topic_source, album->checked); art_settings = ArtSettings(); - it = std::find_if(art_settings.begin(), art_settings.end(), - [](const auto& setting) { return setting.enabled; }); + it = base::ranges::find_if(art_settings, &ash::ArtSetting::enabled); EXPECT_NE(it, art_settings.end()); EXPECT_EQ(it->album_id, "1"); }
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc index 02a0530..a676a2291 100644 --- a/chrome/browser/autofill/autofill_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -203,6 +203,7 @@ content::EvalJsResult r = content::EvalJs(execution_target, script); DCHECK(r.value.is_list()) << r.error; std::vector<FieldValue> fields; + for (const base::Value& field : r.value.GetListDeprecated()) { fields.push_back({.id = *field.FindStringKey("id"), .value = *field.FindStringKey("value")}); @@ -2541,17 +2542,7 @@ ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); ASSERT_TRUE(AutofillFlow(GetElementById("NAME_FIRST"), this)); - // In the legacy implementation for names, the initial is always created - // without a trailing dot even if the user explicitely used a dot. - // For structured names, we leave the choice to the user. - // TODO(crbug.com/1103421): Clean legacy implementation once structured names - // are fully launched. - if (base::FeatureList::IsEnabled( - features::kAutofillEnableSupportForMoreStructureInNames)) { - EXPECT_EQ("C.", GetFieldValueById("NAME_MIDDLE")); - } else { - EXPECT_EQ("C", GetFieldValueById("NAME_MIDDLE")); - } + EXPECT_EQ("C.", GetFieldValueById("NAME_MIDDLE")); } // Test forms with multiple email addresses are filled properly.
diff --git a/chrome/browser/autofill/autofill_server_browsertest.cc b/chrome/browser/autofill/autofill_server_browsertest.cc index 4fe789c3..76d6c45 100644 --- a/chrome/browser/autofill/autofill_server_browsertest.cc +++ b/chrome/browser/autofill/autofill_server_browsertest.cc
@@ -258,33 +258,18 @@ // The resulting bit mask in this test is hard-coded to capture regressions in // the calculation of the mask. - // TODO(crbug.com/1103421): Clean legacy implementation once structured names - // are fully launched. - // For structured names, there is additional data for new name types present. - - const bool structured_names = base::FeatureList::IsEnabled( - features::kAutofillEnableSupportForMoreStructureInNames); - const bool structured_address = base::FeatureList::IsEnabled( - features::kAutofillEnableSupportForMoreStructureInAddresses); const bool honorific_prefix = base::FeatureList::IsEnabled( features::kAutofillEnableSupportForHonorificPrefixes); // Combinations of honorific_prefix without structured_names are omitted // because honorific_prefix can only be enabled on top of structured_names. std::string data_present; - if (structured_names && !structured_address && !honorific_prefix) { - data_present = "1f7e0003780000080004000000040018"; - } else if (structured_names && honorific_prefix && !structured_address) { - data_present = "1f7e0003780000080004000000040418"; - } else if (structured_names && !honorific_prefix && structured_address) { + if (!honorific_prefix) { data_present = "1f7e0003780000080004000001c40018"; - } else if (structured_names && honorific_prefix && structured_address) { - data_present = "1f7e0003780000080004000001c40418"; - } else if (!structured_names && !honorific_prefix && structured_address) { - data_present = "1f7e0003780000080004000001c00018"; } else { - data_present = "1f7e0003780000080004000000000018"; + data_present = "1f7e0003780000080004000001c40418"; } + // TODO(crbug.com/1311937): Additional phone number trunk types are present // if AutofillEnableSupportForPhoneNumberTrunkTypes is enabled. Clean-up // implementation when launched.
diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc index ab1444b4..2d3ce28 100644 --- a/chrome/browser/autofill/form_structure_browsertest.cc +++ b/chrome/browser/autofill/form_structure_browsertest.cc
@@ -207,10 +207,6 @@ // Enabled {// TODO(crbug.com/1187842): Remove once experiment is over. features::kAutofillAcrossIframes, - // TODO(crbug.com/1098943): Remove once experiment is over. - features::kAutofillEnableSupportForMoreStructureInNames, - // TODO(crbug.com/1125978): Remove once launched. - features::kAutofillEnableSupportForMoreStructureInAddresses, // TODO(crbug.com/1076175) Remove once launched. features::kAutofillUseNewSectioningMethod, // Remove once launched
diff --git a/chrome/browser/browsing_topics/browsing_topics_service_browsertest.cc b/chrome/browser/browsing_topics/browsing_topics_service_browsertest.cc index 0fde877..e61d907 100644 --- a/chrome/browser/browsing_topics/browsing_topics_service_browsertest.cc +++ b/chrome/browser/browsing_topics/browsing_topics_service_browsertest.cc
@@ -437,6 +437,7 @@ privacy_sandbox::PrivacySandboxSettings* privacy_sandbox_settings = PrivacySandboxSettingsFactory::GetForProfile(profile); + privacy_sandbox_settings->SetPrivacySandboxEnabled(true); history::HistoryService* history_service = HistoryServiceFactory::GetForProfile(
diff --git a/chrome/browser/chromeos/reporting/metric_reporting_manager_lacros.cc b/chrome/browser/chromeos/reporting/metric_reporting_manager_lacros.cc new file mode 100644 index 0000000..1af01f40 --- /dev/null +++ b/chrome/browser/chromeos/reporting/metric_reporting_manager_lacros.cc
@@ -0,0 +1,225 @@ +// Copyright 2022 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/reporting/metric_reporting_manager_lacros.h" + +#include <memory> +#include <string> + +#include "base/bind.h" +#include "base/location.h" +#include "base/sequence_checker.h" +#include "base/time/time.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/chromeos/reporting/device_reporting_settings_lacros.h" +#include "chrome/browser/chromeos/reporting/metric_default_utils.h" +#include "chrome/browser/chromeos/reporting/network/network_bandwidth_sampler.h" +#include "chrome/browser/policy/chrome_browser_policy_connector.h" +#include "chromeos/lacros/lacros_service.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" +#include "components/policy/policy_constants.h" + +namespace reporting::metrics { +namespace { + +// Factory implementation for the `MetricReportingManagerLacros` for a given +// `BrowserContext`. +class MetricReportingManagerLacrosFactory + : public BrowserContextKeyedServiceFactory { + public: + MetricReportingManagerLacrosFactory(); + MetricReportingManagerLacrosFactory( + const MetricReportingManagerLacrosFactory&) = delete; + MetricReportingManagerLacrosFactory& operator=( + const MetricReportingManagerLacrosFactory&) = delete; + ~MetricReportingManagerLacrosFactory() override; + + // Returns an instance of `MetricReportingManagerLacros` for the + // given profile. + MetricReportingManagerLacros* GetForProfile(Profile* profile); + + private: + KeyedService* BuildServiceInstanceFor( + content::BrowserContext* context) const override; +}; + +MetricReportingManagerLacrosFactory::MetricReportingManagerLacrosFactory() + : BrowserContextKeyedServiceFactory( + "MetricReportingManagerLacros", + BrowserContextDependencyManager::GetInstance()) {} + +MetricReportingManagerLacrosFactory::~MetricReportingManagerLacrosFactory() = + default; + +MetricReportingManagerLacros* +MetricReportingManagerLacrosFactory::GetForProfile(Profile* profile) { + DCHECK(profile); + if (!profile->IsMainProfile()) { + // We only report metrics and events for main profile today. + return nullptr; + } + return static_cast<MetricReportingManagerLacros*>( + GetServiceForBrowserContext(profile, true)); +} + +KeyedService* MetricReportingManagerLacrosFactory::BuildServiceInstanceFor( + content::BrowserContext* context) const { + auto* const profile = Profile::FromBrowserContext(context); + return new MetricReportingManagerLacros( + profile, std::make_unique<MetricReportingManagerLacros::Delegate>()); +} +} // namespace + +void MetricReportingManagerLacros::Delegate::CheckDeviceDeprovisioned( + crosapi::mojom::DeviceSettingsService::IsDeviceDeprovisionedCallback + callback) { + auto* const lacros_service = ::chromeos::LacrosService::Get(); + if (!lacros_service || + !lacros_service->IsRegistered<crosapi::mojom::DeviceSettingsService>() || + !lacros_service->IsAvailable<crosapi::mojom::DeviceSettingsService>()) { + // We should rarely get here since Lacros is initialized via Ash on ChromeOS + // devices, but we return false anyway. + std::move(callback).Run(false); + return; + } + + lacros_service->GetRemote<crosapi::mojom::DeviceSettingsService>() + ->IsDeviceDeprovisioned(std::move(callback)); +} + +std::unique_ptr<DeviceReportingSettingsLacros> +MetricReportingManagerLacros::Delegate::CreateDeviceReportingSettings() { + return DeviceReportingSettingsLacros::Create(); +} + +void MetricReportingManagerLacros::Delegate::RegisterObserverWithCrosApiClient( + MetricReportingManagerLacros* const instance) { + g_browser_process->browser_policy_connector() + ->device_settings_lacros() + ->AddObserver(instance); +} + +// static +MetricReportingManagerLacros* MetricReportingManagerLacros::GetForProfile( + Profile* profile) { + static base::NoDestructor<MetricReportingManagerLacrosFactory> g_factory; + auto* const metric_reporting_manager_factory = + static_cast<MetricReportingManagerLacrosFactory*>(g_factory.get()); + return metric_reporting_manager_factory->GetForProfile(profile); +} + +MetricReportingManagerLacros::MetricReportingManagerLacros( + Profile* profile, + std::unique_ptr<MetricReportingManagerLacros::Delegate> delegate) + : profile_(profile), + delegate_(std::move(delegate)), + device_reporting_settings_(delegate_->CreateDeviceReportingSettings()), + is_device_deprovisioned_(false) { + if (!delegate_->IsAffiliated(profile_)) { + // We only report data for affiliated users on managed devices as of today. + return; + } + + // Update cached device deprovisioned state and initialize appropriate + // components. + auto is_deprovisioned_callback = base::BindOnce( + [](base::WeakPtr<MetricReportingManagerLacros> instance, + bool is_deprovisioned) { + if (!instance) { + return; + } + + DCHECK_CALLED_ON_VALID_SEQUENCE(instance->sequence_checker_); + instance->is_device_deprovisioned_ = is_deprovisioned; + if (is_deprovisioned) { + return; + } + + instance->telemetry_report_queue_ = + instance->delegate_->CreateMetricReportQueue( + EventType::kUser, Destination::TELEMETRY_METRIC, + Priority::SLOW_BATCH); + + instance->delegate_->RegisterObserverWithCrosApiClient(instance.get()); + instance->delayed_init_timer_.Start( + FROM_HERE, instance->delegate_->GetInitDelay(), + base::BindOnce(&MetricReportingManagerLacros::DelayedInit, + instance)); + }, + weak_ptr_factory_.GetWeakPtr()); + delegate_->CheckDeviceDeprovisioned(std::move(is_deprovisioned_callback)); +} + +MetricReportingManagerLacros::~MetricReportingManagerLacros() = default; + +void MetricReportingManagerLacros::OnDeviceSettingsUpdated() { + // Update cached device deprovisioned state and trigger shutdown if needed. + auto is_deprovisioned_callback = base::BindOnce( + [](base::WeakPtr<MetricReportingManagerLacros> instance, + bool is_deprovisioned) { + if (!instance) { + return; + } + + DCHECK_CALLED_ON_VALID_SEQUENCE(instance->sequence_checker_); + instance->is_device_deprovisioned_ = is_deprovisioned; + if (is_deprovisioned) { + instance->Shutdown(); + } + }, + weak_ptr_factory_.GetWeakPtr()); + delegate_->CheckDeviceDeprovisioned(std::move(is_deprovisioned_callback)); +} + +void MetricReportingManagerLacros::Shutdown() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + samplers_.clear(); + periodic_collectors_.clear(); + telemetry_report_queue_.reset(); +} + +void MetricReportingManagerLacros::DelayedInit() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (is_device_deprovisioned_) { + return; + } + + InitNetworkCollectors(); +} + +void MetricReportingManagerLacros::InitNetworkCollectors() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + auto network_bandwidth_sampler = std::make_unique<NetworkBandwidthSampler>( + g_browser_process->network_quality_tracker(), profile_); + + // Network bandwidth telemetry. + InitPeriodicCollector( + std::move(network_bandwidth_sampler), telemetry_report_queue_.get(), + /*enable_setting_path=*/::policy::key::kReportDeviceNetworkStatus, + kReportDeviceNetworkStatusDefaultValue, + ::policy::key::kReportDeviceNetworkTelemetryCollectionRateMs, + GetDefaultCollectionRate(kDefaultNetworkTelemetryCollectionRate)); +} + +void MetricReportingManagerLacros::InitPeriodicCollector( + std::unique_ptr<Sampler> sampler, + MetricReportQueue* metric_report_queue, + const std::string& enable_setting_path, + bool setting_enabled_default_value, + const std::string& rate_setting_path, + base::TimeDelta default_rate, + int rate_unit_to_ms) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + auto* const sampler_ptr = sampler.get(); + samplers_.emplace_back(std::move(sampler)); + if (!metric_report_queue) { + return; + } + periodic_collectors_.emplace_back(delegate_->CreatePeriodicCollector( + sampler_ptr, metric_report_queue, device_reporting_settings_.get(), + enable_setting_path, setting_enabled_default_value, rate_setting_path, + default_rate, rate_unit_to_ms)); +} +} // namespace reporting::metrics
diff --git a/chrome/browser/chromeos/reporting/metric_reporting_manager_lacros.h b/chrome/browser/chromeos/reporting/metric_reporting_manager_lacros.h new file mode 100644 index 0000000..601f8527 --- /dev/null +++ b/chrome/browser/chromeos/reporting/metric_reporting_manager_lacros.h
@@ -0,0 +1,118 @@ +// Copyright 2022 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_REPORTING_METRIC_REPORTING_MANAGER_LACROS_H_ +#define CHROME_BROWSER_CHROMEOS_REPORTING_METRIC_REPORTING_MANAGER_LACROS_H_ + +#include <memory> + +#include "base/memory/raw_ptr.h" +#include "base/memory/weak_ptr.h" +#include "base/sequence_checker.h" +#include "base/thread_annotations.h" +#include "base/timer/timer.h" +#include "build/chromeos_buildflags.h" +#include "chrome/browser/chromeos/reporting/device_reporting_settings_lacros.h" +#include "chrome/browser/chromeos/reporting/metric_reporting_manager_delegate_base.h" +#include "chrome/browser/profiles/profile.h" +#include "chromeos/crosapi/mojom/device_settings_service.mojom.h" +#include "components/keyed_service/core/keyed_service.h" +#include "components/reporting/metrics/metric_data_collector.h" +#include "components/reporting/metrics/metric_report_queue.h" + +static_assert(BUILDFLAG(IS_CHROMEOS_LACROS), "For Lacros only"); + +namespace reporting::metrics { + +// Manages the initialization, collection and reporting of certain user event, +// info and telemetry metrics in Lacros. +class MetricReportingManagerLacros : public KeyedService, + public DeviceSettingsLacros::Observer { + public: + // Delegate that implements certain functional components (like device + // deprovisioning checks, etc.) required by the reporting manager and can be + // stubbed for testing purposes. + class Delegate : public MetricReportingManagerDelegateBase { + public: + Delegate() = default; + Delegate(const Delegate& other) = delete; + Delegate& operator=(const Delegate& other) = delete; + ~Delegate() override = default; + + // Checks if the device is deprovisioned via crosapi and triggers the + // supplied callback with the corresponding result. + virtual void CheckDeviceDeprovisioned( + crosapi::mojom::DeviceSettingsService::IsDeviceDeprovisionedCallback + callback); + + // Creates a relevant `DeviceReportingSettingsLacros` instance that can be + // used by this reporting manager to fetch device reporting settings. + virtual std::unique_ptr<DeviceReportingSettingsLacros> + CreateDeviceReportingSettings(); + + // Registers the specified instance so it can start listening to device + // setting updates. + virtual void RegisterObserverWithCrosApiClient( + MetricReportingManagerLacros* const instance); + }; + + // Retrieves the `MetricReportingManagerLacros` for the given + // profile. + static MetricReportingManagerLacros* GetForProfile(Profile* profile); + + MetricReportingManagerLacros( + Profile* profile, + std::unique_ptr<MetricReportingManagerLacros::Delegate> delegate); + MetricReportingManagerLacros(const MetricReportingManagerLacros& other) = + delete; + MetricReportingManagerLacros& operator=( + const MetricReportingManagerLacros& other) = delete; + ~MetricReportingManagerLacros() override; + + // DeviceSettingsLacros::Observer: + void OnDeviceSettingsUpdated() override; + + private: + void Shutdown() override; + + // Init collectors that need to start on startup after a delay, should + // only be scheduled once on construction. + void DelayedInit(); + + void InitNetworkCollectors(); + + void InitPeriodicCollector(std::unique_ptr<Sampler> sampler, + MetricReportQueue* metric_report_queue, + const std::string& enable_setting_path, + bool setting_enabled_default_value, + const std::string& rate_setting_path, + base::TimeDelta default_rate, + int rate_unit_to_ms = 1); + + SEQUENCE_CHECKER(sequence_checker_); + + const raw_ptr<Profile> profile_; + const std::unique_ptr<MetricReportingManagerLacros::Delegate> delegate_; + const std::unique_ptr<DeviceReportingSettingsLacros> + device_reporting_settings_; + + std::vector<std::unique_ptr<Sampler>> samplers_ + GUARDED_BY_CONTEXT(sequence_checker_); + std::vector<std::unique_ptr<CollectorBase>> periodic_collectors_ + GUARDED_BY_CONTEXT(sequence_checker_); + std::unique_ptr<MetricReportQueue> telemetry_report_queue_ + GUARDED_BY_CONTEXT(sequence_checker_); + + // Cache device deprovisioned state so we minimize crosapi calls. Updated on + // device settings updates. + bool is_device_deprovisioned_ GUARDED_BY_CONTEXT(sequence_checker_); + + base::OneShotTimer delayed_init_timer_; + base::OneShotTimer initial_upload_timer_; + + base::WeakPtrFactory<MetricReportingManagerLacros> weak_ptr_factory_{this}; +}; +} // namespace reporting::metrics + +#endif // CHROME_BROWSER_CHROMEOS_REPORTING_METRIC_REPORTING_MANAGER_LACROS_H_
diff --git a/chrome/browser/chromeos/reporting/metric_reporting_manager_lacros_unittest.cc b/chrome/browser/chromeos/reporting/metric_reporting_manager_lacros_unittest.cc new file mode 100644 index 0000000..c34fd864 --- /dev/null +++ b/chrome/browser/chromeos/reporting/metric_reporting_manager_lacros_unittest.cc
@@ -0,0 +1,254 @@ +// Copyright 2022 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/reporting/metric_reporting_manager_lacros.h" + +#include <memory> +#include <string> + +#include "base/callback_helpers.h" +#include "base/memory/raw_ptr.h" +#include "base/test/bind.h" +#include "chrome/browser/chromeos/reporting/device_reporting_settings_lacros.h" +#include "chrome/browser/chromeos/reporting/metric_default_utils.h" +#include "chrome/test/base/testing_browser_process.h" +#include "chrome/test/base/testing_profile_manager.h" +#include "chromeos/crosapi/mojom/device_settings_service.mojom.h" +#include "components/policy/policy_constants.h" +#include "components/reporting/metrics/fake_metric_report_queue.h" +#include "components/reporting/metrics/metric_data_collector.h" +#include "content/public/test/browser_task_environment.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using ::testing::_; +using ::testing::ByMove; +using ::testing::Invoke; +using ::testing::IsNull; +using ::testing::NiceMock; +using ::testing::Return; + +namespace reporting { +namespace { + +constexpr char kUserId[] = "123"; + +class FakeCollector : public CollectorBase { + public: + explicit FakeCollector(int* collector_count) + : CollectorBase(nullptr, nullptr), collector_count_(collector_count) { + ++(*collector_count_); + } + + FakeCollector(const FakeCollector& other) = delete; + FakeCollector& operator=(const FakeCollector& other) = delete; + + ~FakeCollector() override { --(*collector_count_); } + + protected: + void OnMetricDataCollected(absl::optional<MetricData>) override {} + + private: + raw_ptr<int> collector_count_; +}; + +class MockDelegate : public metrics::MetricReportingManagerLacros::Delegate { + public: + MockDelegate() = default; + MockDelegate(const MockDelegate& other) = delete; + MockDelegate& operator=(const MockDelegate& other) = delete; + ~MockDelegate() override = default; + + MOCK_METHOD(bool, IsAffiliated, (Profile * profile), (const, override)); + + MOCK_METHOD( + void, + CheckDeviceDeprovisioned, + (crosapi::mojom::DeviceSettingsService::IsDeviceDeprovisionedCallback + callback), + (override)); + + MOCK_METHOD(std::unique_ptr<DeviceReportingSettingsLacros>, + CreateDeviceReportingSettings, + (), + (override)); + + MOCK_METHOD(void, + RegisterObserverWithCrosApiClient, + (metrics::MetricReportingManagerLacros* const), + (override)); + + MOCK_METHOD(std::unique_ptr<MetricReportQueue>, + CreateMetricReportQueue, + (EventType event_type, + Destination destination, + Priority priority), + (override)); + + MOCK_METHOD(std::unique_ptr<CollectorBase>, + CreatePeriodicCollector, + (Sampler * sampler, + MetricReportQueue* metric_report_queue, + ReportingSettings* reporting_settings, + const std::string& enable_setting_path, + bool setting_enabled_default_value, + const std::string& rate_setting_path, + base::TimeDelta default_rate, + int rate_unit_to_ms), + (override)); +}; + +struct MetricReportingSettingData { + std::string enable_setting_path; + bool setting_enabled_default_value; + std::string rate_setting_path; + int rate_unit_to_ms; +}; + +const MetricReportingSettingData network_telemetry_settings = { + ::policy::key::kReportDeviceNetworkStatus, + metrics::kReportDeviceNetworkStatusDefaultValue, + ::policy::key::kReportDeviceNetworkTelemetryCollectionRateMs, 1}; + +struct TestCase { + std::string test_name; + bool is_affiliated; + MetricReportingSettingData setting_data; + int expected_count; +}; + +class MetricReportingManagerLacrosTest + : public ::testing::TestWithParam<TestCase> { + protected: + MetricReportingManagerLacrosTest() + : profile_manager_(TestingBrowserProcess::GetGlobal()) {} + + void SetUp() override { + ASSERT_TRUE(profile_manager_.SetUp()); + profile_ = profile_manager_.CreateTestingProfile(kUserId); + delegate_ = std::make_unique<NiceMock<MockDelegate>>(); + telemetry_queue_ = std::make_unique<test::FakeMetricReportQueue>(); + + ON_CALL(*delegate_, RegisterObserverWithCrosApiClient) + .WillByDefault([]() { /** Do nothing **/ }); + + ON_CALL(*delegate_, CreateDeviceReportingSettings) + .WillByDefault(Return( + ByMove(std::unique_ptr<DeviceReportingSettingsLacros>(nullptr)))); + + ON_CALL(*delegate_, CheckDeviceDeprovisioned(_)) + .WillByDefault([](crosapi::mojom::DeviceSettingsService:: + IsDeviceDeprovisionedCallback callback) { + std::move(callback).Run(false); + }); + } + + content::BrowserTaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + TestingProfileManager profile_manager_; + raw_ptr<TestingProfile> profile_; + std::unique_ptr<MockDelegate> delegate_; + std::unique_ptr<test::FakeMetricReportQueue> telemetry_queue_; +}; + +TEST_F(MetricReportingManagerLacrosTest, InitiallyDeprovisioned) { + int periodic_collector_count = 0; + + ON_CALL(*delegate_, CreateMetricReportQueue(EventType::kUser, + Destination::TELEMETRY_METRIC, + Priority::SLOW_BATCH)) + .WillByDefault(Return(ByMove(std::move(telemetry_queue_)))); + + ON_CALL(*delegate_, IsAffiliated(profile_.get())).WillByDefault(Return(true)); + + ON_CALL(*delegate_, CheckDeviceDeprovisioned(_)) + .WillByDefault([](crosapi::mojom::DeviceSettingsService:: + IsDeviceDeprovisionedCallback callback) { + std::move(callback).Run(true); + }); + + ON_CALL(*delegate_, CreatePeriodicCollector) + .WillByDefault([&periodic_collector_count]() { + return std::make_unique<FakeCollector>(&periodic_collector_count); + }); + + auto* const delegate_ptr = delegate_.get(); + metrics::MetricReportingManagerLacros metric_reporting_manager( + profile_.get(), std::move(delegate_)); + + task_environment_.FastForwardBy(delegate_ptr->GetInitDelay()); + task_environment_.RunUntilIdle(); + EXPECT_EQ(periodic_collector_count, 0); +} + +TEST_F(MetricReportingManagerLacrosTest, SecondaryUserProfiles) { + auto* const secondary_profile = + profile_manager_.CreateTestingProfile("secondary_profile"); + const auto* const metric_reporting_manager = + metrics::MetricReportingManagerLacros::GetForProfile(secondary_profile); + EXPECT_THAT(metric_reporting_manager, IsNull()); +} + +class MetricReportingManagerLacrosTelemetryTest + : public MetricReportingManagerLacrosTest {}; + +TEST_P(MetricReportingManagerLacrosTelemetryTest, Default) { + const TestCase& test_case = GetParam(); + auto* const telemetry_queue_ptr = telemetry_queue_.get(); + int periodic_collector_count = 0; + + ON_CALL(*delegate_, CreateMetricReportQueue(EventType::kUser, + Destination::TELEMETRY_METRIC, + Priority::SLOW_BATCH)) + .WillByDefault(Return(ByMove(std::move(telemetry_queue_)))); + + ON_CALL(*delegate_, CreatePeriodicCollector( + _, telemetry_queue_ptr, _, + test_case.setting_data.enable_setting_path, + test_case.setting_data.setting_enabled_default_value, + test_case.setting_data.rate_setting_path, _, + test_case.setting_data.rate_unit_to_ms)) + .WillByDefault([&periodic_collector_count]() { + return std::make_unique<FakeCollector>(&periodic_collector_count); + }); + + ON_CALL(*delegate_, IsAffiliated(profile_.get())) + .WillByDefault(Return(test_case.is_affiliated)); + + auto* const delegate_ptr = delegate_.get(); + metrics::MetricReportingManagerLacros metric_reporting_manager( + profile_.get(), std::move(delegate_)); + + task_environment_.FastForwardBy(delegate_ptr->GetInitDelay()); + task_environment_.RunUntilIdle(); + ASSERT_EQ(periodic_collector_count, test_case.expected_count); + + // Simulate device deprovisioning and verify collectors are destroyed. + EXPECT_CALL(*delegate_ptr, CheckDeviceDeprovisioned(_)) + .WillRepeatedly([](crosapi::mojom::DeviceSettingsService:: + IsDeviceDeprovisionedCallback callback) { + std::move(callback).Run(true); + }); + metric_reporting_manager.OnDeviceSettingsUpdated(); + task_environment_.RunUntilIdle(); + EXPECT_EQ(periodic_collector_count, 0); +} + +INSTANTIATE_TEST_SUITE_P( + MetricReportingManagerLacrosTelemetryTests, + MetricReportingManagerLacrosTelemetryTest, + ::testing::ValuesIn<TestCase>({ + {"NetworkTelemetry_Unaffiliated", + /*is_affiliated=*/false, network_telemetry_settings, + /*expected_count=*/0}, + {"NetworkTelemetry_Affiliated", + /*is_affiliated=*/true, network_telemetry_settings, + /*expected_count=*/1}, + }), + [](const ::testing::TestParamInfo< + MetricReportingManagerLacrosTest::ParamType>& info) { + return info.param.test_name; + }); +} // namespace +} // namespace reporting
diff --git a/chrome/browser/extensions/activity_log/database_string_table_unittest.cc b/chrome/browser/extensions/activity_log/database_string_table_unittest.cc index 2fe2949..4ad822e 100644 --- a/chrome/browser/extensions/activity_log/database_string_table_unittest.cc +++ b/chrome/browser/extensions/activity_log/database_string_table_unittest.cc
@@ -142,7 +142,7 @@ // Wrap the lookups in a transaction to improve performance. sql::Transaction transaction(&db_); - transaction.Begin(); + ASSERT_TRUE(transaction.Begin()); for (int i = 0; i < 2000; i++) { int64_t id; ASSERT_TRUE(table.StringToInt(&db_, base::StringPrintf("value-%d", i),
diff --git a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc index 2cc5705..01d3952c 100644 --- a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc +++ b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
@@ -50,6 +50,7 @@ #include "chrome/browser/extensions/tab_helper.h" #include "chrome/browser/net/profile_network_context_service.h" #include "chrome/browser/net/profile_network_context_service_factory.h" +#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" @@ -57,6 +58,7 @@ #include "chrome/common/webui_url_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "components/prefs/pref_service.h" +#include "components/privacy_sandbox/privacy_sandbox_settings.h" #include "components/proxy_config/proxy_config_dictionary.h" #include "components/proxy_config/proxy_config_pref_names.h" #include "components/web_package/web_bundle_builder.h" @@ -6479,6 +6481,9 @@ ASSERT_TRUE(https_server()->Start()); + PrivacySandboxSettingsFactory::GetForProfile(profile()) + ->SetPrivacySandboxEnabled(true); + ASSERT_TRUE( ui_test_utils::NavigateToURL(browser(), https_server()->GetURL("/echo")));
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index 045ff62..832fb8c 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -888,7 +888,7 @@ base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kTabSwitcherOnReturn{"TabSwitcherOnReturn", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kTabToGTSAnimation{"TabToGTSAnimation", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/chrome/browser/interest_group/interest_group_permissions_browsertest.cc b/chrome/browser/interest_group/interest_group_permissions_browsertest.cc index 3fa62ef5..e4e22c6 100644 --- a/chrome/browser/interest_group/interest_group_permissions_browsertest.cc +++ b/chrome/browser/interest_group/interest_group_permissions_browsertest.cc
@@ -7,6 +7,7 @@ #include "base/test/bind.h" #include "base/test/test_timeouts.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" +#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" @@ -15,6 +16,7 @@ #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/pref_names.h" #include "components/prefs/pref_service.h" +#include "components/privacy_sandbox/privacy_sandbox_settings.h" #include "content/public/common/content_features.h" #include "content/public/test/browser_test.h" #include "net/dns/mock_host_resolver.h" @@ -44,6 +46,8 @@ https_server_->AddDefaultHandlers(GetChromeTestDataDir()); ASSERT_TRUE(https_server_->Start()); + PrivacySandboxSettingsFactory::GetForProfile(browser()->profile()) + ->SetPrivacySandboxEnabled(true); // Prime the interest groups if the API is enabled. ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url())); if (HasInterestGroupApi(web_contents()) &&
diff --git a/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service.cc b/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service.cc index 2d77f89c..1f78f86 100644 --- a/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service.cc +++ b/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service.cc
@@ -30,6 +30,7 @@ #include "components/media_router/common/media_sink.h" #include "components/media_router/common/mojom/media_router.mojom.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/network_service_instance.h" #include "mojo/public/cpp/bindings/callback_helpers.h" namespace media_router { @@ -261,6 +262,15 @@ absl::nullopt); return; } + if (content::GetNetworkConnectionTracker()->IsOffline()) { + LogWarning( + "We are not either not connected to a valid network or not connected " + "to any network.", + ""); + std::move(callback).Run(AddSinkResultCode::SERVICE_NOT_PRESENT, + absl::nullopt); + return; + } discovery_server_interface_ = std::make_unique<AccessCodeCastDiscoveryInterface>( profile_, access_code, media_router_->GetLogger(), identity_manager_);
diff --git a/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service_unittest.cc b/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service_unittest.cc index e0f0fe1..7526b73f 100644 --- a/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service_unittest.cc +++ b/chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service_unittest.cc
@@ -43,6 +43,7 @@ #include "content/public/test/browser_task_environment.h" #include "content/public/test/test_renderer_host.h" #include "content/public/test/test_utils.h" +#include "services/network/test/test_network_connection_tracker.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -79,6 +80,11 @@ delete; void SetUp() override { + content::SetNetworkConnectionTrackerForTesting( + network::TestNetworkConnectionTracker::GetInstance()); + network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( + network::mojom::ConnectionType::CONNECTION_WIFI); + feature_list_.InitWithFeatures({features::kAccessCodeCastRememberDevices}, {}); GetTestingPrefs()->SetManagedPref(::prefs::kEnableMediaRouter, @@ -1245,4 +1251,19 @@ access_code_cast_sink_service_->pref_updater_->GetDevicesDict().empty()); } +TEST_F(AccessCodeCastSinkServiceTest, TestOfflineDiscoverSink) { + // Test to ensure that discover sink triggers a network error callback if we + // are offline. + MockAddSinkResultCallback mock_callback; + + network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( + network::mojom::ConnectionType::CONNECTION_NONE); + EXPECT_CALL(mock_callback, + Run(AddSinkResultCode::SERVICE_NOT_PRESENT, Eq(absl::nullopt))); + + access_code_cast_sink_service_->DiscoverSink("", mock_callback.Get()); + + mock_time_task_runner()->FastForwardUntilNoTasksRemain(); +} + } // namespace media_router
diff --git a/chrome/browser/payments/empty_parameters_browsertest.cc b/chrome/browser/payments/empty_parameters_browsertest.cc index 38013dd..b168db27 100644 --- a/chrome/browser/payments/empty_parameters_browsertest.cc +++ b/chrome/browser/payments/empty_parameters_browsertest.cc
@@ -28,8 +28,8 @@ content::BrowserContext* context = GetActiveWebContents()->GetBrowserContext(); auto downloader = std::make_unique<TestDownloader>( - context->GetDefaultStoragePartition() - ->GetURLLoaderFactoryForBrowserProcess()); + GetCSPCheckerForTests(), context->GetDefaultStoragePartition() + ->GetURLLoaderFactoryForBrowserProcess()); downloader->AddTestServerURL("https://kylepay.com/", kylepay_server_.GetURL("kylepay.com", "/")); ServiceWorkerPaymentAppFinder::GetOrCreateForCurrentDocument(
diff --git a/chrome/browser/payments/manifest_verifier_browsertest.cc b/chrome/browser/payments/manifest_verifier_browsertest.cc index 81edfd3..6c66d43 100644 --- a/chrome/browser/payments/manifest_verifier_browsertest.cc +++ b/chrome/browser/payments/manifest_verifier_browsertest.cc
@@ -15,6 +15,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "components/payments/content/payment_manifest_web_data_service.h" #include "components/payments/content/utility/payment_manifest_parser.h" +#include "components/payments/core/const_csp_checker.h" #include "components/payments/core/test_payment_manifest_downloader.h" #include "components/webdata_services/web_data_service_wrapper_factory.h" #include "content/public/browser/browser_context.h" @@ -55,7 +56,9 @@ content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); content::BrowserContext* context = web_contents->GetBrowserContext(); + ConstCSPChecker const_csp_checker(/*allow=*/true); auto downloader = std::make_unique<TestDownloader>( + const_csp_checker.GetWeakPtr(), context->GetDefaultStoragePartition() ->GetURLLoaderFactoryForBrowserProcess()); downloader->AddTestServerURL("https://", https_server_->GetURL("/"));
diff --git a/chrome/browser/payments/service_worker_payment_app_finder_browsertest.cc b/chrome/browser/payments/service_worker_payment_app_finder_browsertest.cc index 7836573c..15efab53 100644 --- a/chrome/browser/payments/service_worker_payment_app_finder_browsertest.cc +++ b/chrome/browser/payments/service_worker_payment_app_finder_browsertest.cc
@@ -140,7 +140,9 @@ content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); content::BrowserContext* context = web_contents->GetBrowserContext(); + ConstCSPChecker const_csp_checker(/*allow=*/true); auto downloader = std::make_unique<TestDownloader>( + const_csp_checker.GetWeakPtr(), context->GetDefaultStoragePartition() ->GetURLLoaderFactoryForBrowserProcess()); downloader->AddTestServerURL("https://alicepay.com/",
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 6bb050b..7687478 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -1337,6 +1337,9 @@ { key::kDevicePrintingClientNameTemplate, prefs::kPrintingClientNameTemplate, base::Value::Type::STRING }, + { key::kCalendarIntegrationEnabled, + ash::prefs::kCalendarIntegrationEnabled, + base::Value::Type::BOOLEAN }, #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_LINUX)
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index d1244c7..bfee1b2 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -3262,21 +3262,19 @@ bool RenderViewContextMenu::IsRegionSearchEnabled() const { #if BUILDFLAG(GOOGLE_CHROME_BRANDING) + if (!GetBrowser()) + return false; + TemplateURLService* service = TemplateURLServiceFactory::GetForProfile(GetProfile()); if (!service) return false; -#if BUILDFLAG(IS_CHROMEOS) - if (IsFrameInPdfViewer(GetRenderFrameHost())) - return false; -#else if (!base::FeatureList::IsEnabled( lens::features::kEnableRegionSearchOnPdfViewer) && IsFrameInPdfViewer(GetRenderFrameHost())) { return false; } -#endif // BUILDFLAG(IS_CHROMEOS) const TemplateURL* provider = service->GetDefaultSearchProvider(); const bool provider_supports_image_search = @@ -3621,15 +3619,14 @@ #if BUILDFLAG(GOOGLE_CHROME_BRANDING) if (!lens_region_search_controller_) { Browser* browser = GetBrowser(); + CHECK(browser); WebContents* web_contents = source_web_contents_; -#if !BUILDFLAG(IS_CHROMEOS) if (base::FeatureList::IsEnabled( lens::features::kEnableRegionSearchOnPdfViewer)) { // We don't use `source_web_contents_` here because it doesn't work with // the PDF reader. web_contents = browser->tab_strip_model()->GetActiveWebContents(); } -#endif // !BUILDFLAG(IS_CHROMEOS) lens_region_search_controller_ = std::make_unique<lens::LensRegionSearchController>(web_contents, browser);
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.h b/chrome/browser/renderer_context_menu/render_view_context_menu.h index 0156137c..1963c6ed 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h
@@ -130,8 +130,9 @@ protected: Profile* GetProfile() const; - // This may return nullptr (e.g. for WebUI dialogs). - Browser* GetBrowser() const; + // This may return nullptr (e.g. for WebUI dialogs). Virtual to allow tests to + // override. + virtual Browser* GetBrowser() const; // Returns a (possibly truncated) version of the current selection text // suitable for putting in the title of a menu item.
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc index 9931260..8004b31 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc
@@ -106,6 +106,16 @@ return -1; } +void TestRenderViewContextMenu::SetBrowser(Browser* browser) { + browser_ = browser; +} + +Browser* TestRenderViewContextMenu::GetBrowser() const { + if (browser_) + return browser_; + return RenderViewContextMenu::GetBrowser(); +} + void TestRenderViewContextMenu::Show() { }
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h b/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h index 3bb5894e..ef84aaf 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h
@@ -10,6 +10,7 @@ #include <memory> #include "base/files/file_path.h" +#include "base/memory/raw_ptr.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" #include "components/custom_handlers/protocol_handler_registry.h" @@ -98,15 +99,29 @@ using RenderViewContextMenu::AppendImageItems; + // RenderViewContextMenu: void Show() override; - #if BUILDFLAG(IS_CHROMEOS) const policy::DlpRulesManager* GetDlpRulesManager() const override; +#endif +#if BUILDFLAG(IS_CHROMEOS) void set_dlp_rules_manager(policy::DlpRulesManager* dlp_rules_manager); #endif + // If `browser` is not null, sets it as the return value of GetBrowser(), + // overriding the base class behavior. If the Browser object is destroyed + // before this class is, then SetBrowser(nullptr) should be called. If + // `browser` is null, restores the base class behavior of GetBrowser(). + void SetBrowser(Browser* browser); + + protected: + // RenderViewContextMenu: + Browser* GetBrowser() const override; + private: + raw_ptr<Browser> browser_ = nullptr; + #if BUILDFLAG(IS_CHROMEOS) policy::DlpRulesManager* dlp_rules_manager_ = nullptr; #endif
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc index c8c1b25..1097386 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc
@@ -26,12 +26,14 @@ #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/common/pref_names.h" #include "chrome/common/webui_url_constants.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/scoped_testing_local_state.h" #include "chrome/test/base/search_test_utils.h" +#include "chrome/test/base/test_browser_window.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "components/autofill/core/browser/autofill_test_utils.h" @@ -473,6 +475,7 @@ } void TearDown() override { + browser_.reset(); registry_.reset(); ChromeRenderViewHostTestHarness::TearDown(); testing_local_state_.reset(); @@ -514,10 +517,21 @@ PrefService* local_state() { return testing_local_state_->Get(); } + Browser* GetBrowser() { + if (!browser_) { + Browser::CreateParams create_params(profile(), true); + auto test_window = std::make_unique<TestBrowserWindow>(); + create_params.window = test_window.get(); + browser_.reset(Browser::Create(create_params)); + } + return browser_.get(); + } + private: std::unique_ptr<custom_handlers::ProtocolHandlerRegistry> registry_; std::unique_ptr<ScopedTestingLocalState> testing_local_state_; raw_ptr<TemplateURLService> template_url_service_; + std::unique_ptr<Browser> browser_; }; // Verifies when Incognito Mode is not available (disabled by policy), @@ -1044,6 +1058,7 @@ content::ContextMenuParams params = CreateParams(MenuItem::PAGE); TestRenderViewContextMenu menu(*web_contents()->GetPrimaryMainFrame(), params); + menu.SetBrowser(GetBrowser()); menu.Init(); EXPECT_TRUE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_LENS_REGION_SEARCH)); @@ -1063,18 +1078,13 @@ GURL("chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai"))); content::ContextMenuParams params = CreateParams(MenuItem::PAGE); TestRenderViewContextMenu menu(*render_frame_host, params); + menu.SetBrowser(GetBrowser()); menu.Init(); EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_LENS_REGION_SEARCH)); } -#if BUILDFLAG(IS_CHROMEOS) -#define MAYBE_LensRegionSearchPdfEnabled DISABLED_LensRegionSearchPdfEnabled -#else -#define MAYBE_LensRegionSearchPdfEnabled LensRegionSearchPdfEnabled -#endif -// TODO(https://crbug.com/1354637): Re-enable on ChromeOS. -TEST_F(RenderViewContextMenuPrefsTest, MAYBE_LensRegionSearchPdfEnabled) { +TEST_F(RenderViewContextMenuPrefsTest, LensRegionSearchPdfEnabled) { base::test::ScopedFeatureList features; features.InitWithFeatures({lens::features::kLensStandalone, lens::features::kEnableRegionSearchOnPdfViewer}, @@ -1089,6 +1099,7 @@ GURL("chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai"))); content::ContextMenuParams params = CreateParams(MenuItem::PAGE); TestRenderViewContextMenu menu(*render_frame_host, params); + menu.SetBrowser(GetBrowser()); menu.Init(); EXPECT_TRUE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_LENS_REGION_SEARCH)); @@ -1107,6 +1118,7 @@ content::ContextMenuParams params = CreateParams(MenuItem::PAGE); TestRenderViewContextMenu menu(*web_contents()->GetPrimaryMainFrame(), params); + menu.SetBrowser(GetBrowser()); menu.Init(); EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_LENS_REGION_SEARCH)); @@ -1123,12 +1135,36 @@ params.has_image_contents = true; TestRenderViewContextMenu menu(*web_contents()->GetPrimaryMainFrame(), params); + menu.SetBrowser(GetBrowser()); AppendImageItems(&menu); EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_LENS_REGION_SEARCH)); EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_WEB_REGION_SEARCH)); } +// Verify that the Lens Region Search menu item is disabled when there is no +// browser. +TEST_F(RenderViewContextMenuPrefsTest, LensRegionSearchPdfDisabledNoBrowser) { + base::test::ScopedFeatureList features; + features.InitWithFeatures({lens::features::kLensStandalone, + lens::features::kEnableRegionSearchOnPdfViewer}, + {}); + SetUserSelectedDefaultSearchProvider("https://www.google.com", + /*supports_image_search=*/true); + content::RenderFrameHost* render_frame_host = + web_contents()->GetPrimaryMainFrame(); + OverrideLastCommittedOrigin( + render_frame_host, + url::Origin::Create( + GURL("chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai"))); + content::ContextMenuParams params = CreateParams(MenuItem::PAGE); + TestRenderViewContextMenu menu(*render_frame_host, params); + menu.Init(); + + EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_LENS_REGION_SEARCH)); + EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_WEB_REGION_SEARCH)); +} + // Verify that the web region search menu item is enabled for a non-Google // search engine that supports visual search. TEST_F(RenderViewContextMenuPrefsTest, @@ -1140,6 +1176,7 @@ content::ContextMenuParams params = CreateParams(MenuItem::PAGE); TestRenderViewContextMenu menu(*web_contents()->GetPrimaryMainFrame(), params); + menu.SetBrowser(GetBrowser()); menu.Init(); EXPECT_TRUE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_WEB_REGION_SEARCH)); @@ -1157,6 +1194,7 @@ content::ContextMenuParams params = CreateParams(MenuItem::PAGE); TestRenderViewContextMenu menu(*web_contents()->GetPrimaryMainFrame(), params); + menu.SetBrowser(GetBrowser()); menu.Init(); EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_WEB_REGION_SEARCH)); @@ -1173,6 +1211,7 @@ content::ContextMenuParams params = CreateParams(MenuItem::PAGE); TestRenderViewContextMenu menu(*web_contents()->GetPrimaryMainFrame(), params); + menu.SetBrowser(GetBrowser()); menu.Init(); EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_LENS_REGION_SEARCH)); @@ -1189,6 +1228,7 @@ params.page_url = GURL(chrome::kChromeUISettingsURL); TestRenderViewContextMenu menu(*web_contents()->GetPrimaryMainFrame(), params); + menu.SetBrowser(GetBrowser()); menu.Init(); EXPECT_FALSE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_LENS_REGION_SEARCH));
diff --git a/chrome/browser/resources/chromeos/assistant_optin/browser_proxy.html b/chrome/browser/resources/chromeos/assistant_optin/browser_proxy.html index c7195ee..92e7ad5b 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/browser_proxy.html +++ b/chrome/browser/resources/chromeos/assistant_optin/browser_proxy.html
@@ -4,5 +4,5 @@ found in the LICENSE file. --> -<link rel="import" href="chrome://resources/html/cr.html"> +<script src="chrome://resources/js/cr.js"> <script src="browser_proxy.js"></script>
diff --git a/chrome/browser/resources/chromeos/network_ui/network_ui.js b/chrome/browser/resources/chromeos/network_ui/network_ui.js index 06fa172..d17c2e8 100644 --- a/chrome/browser/resources/chromeos/network_ui/network_ui.js +++ b/chrome/browser/resources/chromeos/network_ui/network_ui.js
@@ -5,7 +5,7 @@ import 'chrome://resources/cr_components/chromeos/network/network_select.js'; import 'chrome://resources/cr_components/chromeos/network_health/network_diagnostics.js'; import 'chrome://resources/cr_components/chromeos/network_health/network_health_summary.js'; -import 'chrome://resources/cr_components/chromeos/traffic_counters/traffic_counters.js'; +import 'chrome://resources/ash/common/traffic_counters/traffic_counters.js'; import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_input/cr_input.js'; import 'chrome://resources/cr_elements/cr_tabs/cr_tabs.js';
diff --git a/chrome/browser/resources/chromeos/network_ui/network_ui_browser_proxy.html b/chrome/browser/resources/chromeos/network_ui/network_ui_browser_proxy.html deleted file mode 100644 index 69eb71d..0000000 --- a/chrome/browser/resources/chromeos/network_ui/network_ui_browser_proxy.html +++ /dev/null
@@ -1,2 +0,0 @@ -<link rel="import" href="chrome://resources/html/cr.html"> -<script src="network_ui_browser_proxy.js"></script>
diff --git a/chrome/browser/resources/nearby_share/shared/BUILD.gn b/chrome/browser/resources/nearby_share/shared/BUILD.gn index d850bb9..0b25a31 100644 --- a/chrome/browser/resources/nearby_share/shared/BUILD.gn +++ b/chrome/browser/resources/nearby_share/shared/BUILD.gn
@@ -6,7 +6,6 @@ import("//tools/grit/preprocess_if_expr.gni") import("//tools/polymer/html_to_wrapper.gni") import("//ui/webui/resources/tools/generate_grd.gni") -import("./nearby_shared.gni") assert(is_chromeos, "Nearby Share is CrOS only")
diff --git a/chrome/browser/resources/nearby_share/shared/nearby_shared.gni b/chrome/browser/resources/nearby_share/shared/nearby_shared.gni deleted file mode 100644 index cdfa8b3..0000000 --- a/chrome/browser/resources/nearby_share/shared/nearby_shared.gni +++ /dev/null
@@ -1,23 +0,0 @@ -# Copyright 2020 The Chromium Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -nearby_shared_auto_imports = [ - "chrome/browser/resources/nearby_share/shared/nearby_share_settings.html|getNearbyShareSettings", - "chrome/browser/resources/nearby_share/shared/nearby_share_settings_behavior.html|NearbyShareSettingsBehavior,NearbySettings", - "chrome/browser/resources/nearby_share/shared/nearby_contact_manager.html|getContactManager,observeContactManager", - "ui/webui/resources/html/assert.html|assert,assertNotReached", - "ui/webui/resources/html/cr.html|sendWithPromise", - "chrome/browser/resources/nearby_share/shared/nearby_metrics_logger.html|processOnboardingInitiatedMetrics,processOnboardingCompleteMetrics,processOnboardingCancelledMetrics,NearbyShareOnboardingFinalState,processOnePageOnboardingInitiatedMetrics,processOnePageOnboardingCancelledMetrics,processOnePageOnboardingCompleteMetrics,processOnePageOnboardingVisibilityButtonOnInitialPageClickedMetrics,processOnePageOnboardingVisibilityPageShownMetrics,processOnePageOnboardingManageContactsMetrics", -] - -nearby_shared_namespace_rewrites = [ - "nearby_share.NearbySettings|NearbySettings", - "nearby_share.NearbyShareSettingsBehavior|NearbyShareSettingsBehavior", - "nearby_share.getNearbyShareSettings|getNearbyShareSettings", - "nearby_share.observeNearbyShareSettings|observeNearbyShareSettings", - "nearby_share.setNearbyShareSettingsForTesting|setNearbyShareSettingsForTesting", - "nearby_share.getContactManager|getContactManager", - "nearby_share.observeContactManager|observeContactManager", - "nearby_share.setContactManagerForTesting|setContactManagerForTesting", -]
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn index 0efd349..ee50408 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/internet_page/BUILD.gn
@@ -91,6 +91,7 @@ ":network_proxy_section", ":settings_traffic_counters", ":tether_connection_dialog", + "//ash/webui/common/resources/traffic_counters:traffic_counters", "//chrome/browser/resources/settings:router", "//chrome/browser/resources/settings/chromeos:deep_linking_behavior", "//chrome/browser/resources/settings/chromeos:metrics_recorder", @@ -115,7 +116,6 @@ "//ui/webui/resources/cr_components/chromeos/network:network_siminfo", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo", "//ui/webui/resources/cr_components/chromeos/network_health:network_health_container", - "//ui/webui/resources/cr_components/chromeos/traffic_counters:traffic_counters", "//ui/webui/resources/cr_elements:i18n_behavior", "//ui/webui/resources/cr_elements:web_ui_listener_behavior", "//ui/webui/resources/js:assert.m", @@ -267,6 +267,7 @@ js_library("network_summary_item") { deps = [ + "//ash/webui/common/resources/traffic_counters:traffic_counters", "//third_party/polymer/v3_0/components-chromium/iron-flex-layout:iron-flex-layout-classes", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_components/chromeos/network:cellular_utils", @@ -274,7 +275,6 @@ "//ui/webui/resources/cr_components/chromeos/network:network_icon", "//ui/webui/resources/cr_components/chromeos/network:network_siminfo", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo", - "//ui/webui/resources/cr_components/chromeos/traffic_counters:traffic_counters", "//ui/webui/resources/cr_elements:i18n_behavior", "//ui/webui/resources/cr_elements/policy:cr_policy_indicator_behavior", "//ui/webui/resources/js:assert.m", @@ -380,12 +380,12 @@ js_library("settings_traffic_counters") { deps = [ ":internet_shared_css", + "//ash/webui/common/resources/traffic_counters:traffic_counters", + "//ash/webui/common/resources/traffic_counters:traffic_counters_adapter", "//chromeos/services/network_config/public/mojom:mojom_webui_js", "//chromeos/services/network_config/public/mojom:network_types_webui_js", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo", - "//ui/webui/resources/cr_components/chromeos/traffic_counters:traffic_counters", - "//ui/webui/resources/cr_components/chromeos/traffic_counters:traffic_counters_adapter", "//ui/webui/resources/cr_elements:i18n_behavior", ] externs_list =
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/settings_traffic_counters.js b/chrome/browser/resources/settings/chromeos/internet_page/settings_traffic_counters.js index 233b35a..8b7d389f 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/settings_traffic_counters.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/settings_traffic_counters.js
@@ -11,9 +11,9 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.js'; import 'chrome://resources/cr_elements/cr_toggle/cr_toggle.js'; import 'chrome://resources/cr_elements/md_select.css.js'; -import 'chrome://resources/cr_components/chromeos/traffic_counters/traffic_counters.js'; +import 'chrome://resources/ash/common/traffic_counters/traffic_counters.js'; -import {Network, TrafficCountersAdapter} from 'chrome://resources/cr_components/chromeos/traffic_counters/traffic_counters_adapter.js'; +import {Network, TrafficCountersAdapter} from 'chrome://resources/ash/common/traffic_counters/traffic_counters_adapter.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/cr_elements/i18n_behavior.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/chromeos/multidevice_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/multidevice_page/BUILD.gn index 50df7e9b..22d8923 100644 --- a/chrome/browser/resources/settings/chromeos/multidevice_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/multidevice_page/BUILD.gn
@@ -4,7 +4,6 @@ import("//third_party/closure_compiler/compile_js.gni") import("//tools/polymer/html_to_js.gni") -import("../../../nearby_share/shared/nearby_shared.gni") import("../os_settings.gni") js_type_check("closure_compile_module") {
diff --git a/chrome/browser/resources/settings/chromeos/nearby_share_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/nearby_share_page/BUILD.gn index c16b99e..c7f320fb3 100644 --- a/chrome/browser/resources/settings/chromeos/nearby_share_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/nearby_share_page/BUILD.gn
@@ -4,7 +4,6 @@ import("//third_party/closure_compiler/compile_js.gni") import("//tools/polymer/html_to_js.gni") -import("../../../nearby_share/shared/nearby_shared.gni") import("../os_settings.gni") js_type_check("closure_compile") {
diff --git a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.js b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.js index 64a4984..a63dc5b 100644 --- a/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.js +++ b/chrome/browser/resources/settings/chromeos/os_bluetooth_page/os_bluetooth_device_detail_subpage.js
@@ -19,9 +19,10 @@ import {BatteryType} from 'chrome://resources/cr_components/chromeos/bluetooth/bluetooth_types.js'; import {getBatteryPercentage, getDeviceName, hasAnyDetailedBatteryInfo, hasDefaultImage, hasTrueWirelessImages} from 'chrome://resources/cr_components/chromeos/bluetooth/bluetooth_utils.js'; import {getBluetoothConfig} from 'chrome://resources/cr_components/chromeos/bluetooth/cros_bluetooth_config.js'; -import {assertNotReached} from 'chrome://resources/js/assert.m.js'; import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/cr_elements/i18n_behavior.js'; import {WebUIListenerBehavior, WebUIListenerBehaviorInterface} from 'chrome://resources/cr_elements/web_ui_listener_behavior.js'; +import {assertNotReached} from 'chrome://resources/js/assert.m.js'; +import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {AudioOutputCapability, BluetoothSystemProperties, DeviceConnectionState, DeviceType, PairedBluetoothDeviceProperties} from 'chrome://resources/mojo/chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom-webui.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -642,7 +643,11 @@ /** @private */ onForgetButtonClicked_() { - this.shouldShowForgetDeviceDialog_ = true; + if (loadTimeData.getBoolean('enableFastPairFlag')) { + this.shouldShowForgetDeviceDialog_ = true; + } else { + getBluetoothConfig().forget(this.deviceId_); + } } /** @private */
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java index d98944e..7cabae6 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhone.java
@@ -1070,7 +1070,11 @@ // Only transition theme colors if in static tab mode that is not the NTP. In practice // this only runs when you focus the omnibox on a web page. - if (!isLocationBarShownInNTP() && mTabSwitcherState == STATIC_TAB) { + // But for the mShouldShowModernizeVisualUpdate, toolbar and locationbar will have + // different color when they are focused than in NTP, so the color need to be updated in + // this case. + if ((mShouldShowModernizeVisualUpdate || !isLocationBarShownInNTP()) + && mTabSwitcherState == STATIC_TAB) { int defaultColor = getToolbarDefaultColor(); int defaultLocationBarColor = getLocationBarDefaultColorForToolbarColor(defaultColor);
diff --git a/chrome/browser/ui/ash/desks/desks_client.cc b/chrome/browser/ui/ash/desks/desks_client.cc index fb31e62..a289bcf3 100644 --- a/chrome/browser/ui/ash/desks/desks_client.cc +++ b/chrome/browser/ui/ash/desks/desks_client.cc
@@ -602,11 +602,9 @@ DCHECK(overview_session); } - auto* overview_grid = overview_session->GetGridWithRootWindow( - ash::Shell::GetPrimaryRootWindow()); overview_session->ShowDesksTemplatesGrids( - overview_grid->desks_bar_view()->IsZeroState(), desk_template->uuid(), - desk_template->template_name(), ash::Shell::GetPrimaryRootWindow()); + desk_template->uuid(), desk_template->template_name(), + ash::Shell::GetPrimaryRootWindow()); // We have successfully created a *new* desk template for Save & Recall, // so we are now going to close all the windows on the active desk and
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 5be6f5a..d72dbd0 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,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/run_loop.h" +#include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" @@ -89,6 +90,58 @@ return DesktopMediaID::Type::TYPE_NONE; } +std::string GetTypeAsTestNameString(const DesktopMediaList::Type& type) { + switch (type) { + case DesktopMediaList::Type::kScreen: + return "Screen"; + case DesktopMediaList::Type::kWindow: + return "Window"; + case DesktopMediaList::Type::kWebContents: + return "Tab"; + case DesktopMediaList::Type::kCurrentTab: + return "CurrentTab"; + case DesktopMediaList::Type::kNone: + return "None"; + } + NOTREACHED(); + return "None"; +} + +struct PickerConfiguration { + const bool prefer_current_tab; + const bool new_order; + + // Overload the << operator so that gtest can pretty-print this struct. + friend std::ostream& operator<<(std::ostream& os, + const PickerConfiguration& config) { + return os << config.DebugString(); + } + + std::string DebugString() const { + return base::StrCat({"Prefer Current Tab: ", + // Intentionally put an extra space after true so that + // the strings are the same length. + prefer_current_tab ? "True, " : "False, ", + "New Order: ", new_order ? "True" : "False"}); + } + + std::string TestNameString() const { + return base::StrCat({new_order ? "NewOrder_" : "OldOrder_", + prefer_current_tab ? "PreferCurrentTab" : "Standard"}); + } + + std::vector<DesktopMediaList::Type> GetSourceTypes() const { + return ::views::GetSourceTypes(prefer_current_tab, new_order); + } +}; + +namespace { +constexpr std::array<PickerConfiguration, 3> kDefaultProductSourceConfigs = { + PickerConfiguration{.prefer_current_tab = false, .new_order = false}, + PickerConfiguration{.prefer_current_tab = true, .new_order = false}, + PickerConfiguration{.prefer_current_tab = false, .new_order = true}}; +} // namespace + class DesktopMediaPickerViewsTestBase : public testing::Test { public: explicit DesktopMediaPickerViewsTestBase( @@ -205,24 +258,21 @@ class DesktopMediaPickerViewsTest : public DesktopMediaPickerViewsTestBase, - public testing::WithParamInterface<std::tuple<bool, bool>> { + public testing::WithParamInterface<PickerConfiguration> { public: DesktopMediaPickerViewsTest() - : DesktopMediaPickerViewsTestBase( - GetSourceTypes(PreferCurrentTab(), NewOrder())) {} + : DesktopMediaPickerViewsTestBase(config().GetSourceTypes()) {} ~DesktopMediaPickerViewsTest() override = default; - bool PreferCurrentTab() const { return std::get<0>(GetParam()); } - bool NewOrder() const { return std::get<1>(GetParam()); } + PickerConfiguration config() const { return GetParam(); } + + bool PreferCurrentTab() const { return config().prefer_current_tab; } + bool NewOrder() const { return config().new_order; } }; -INSTANTIATE_TEST_SUITE_P( - All, - DesktopMediaPickerViewsTest, - testing::Values( - std::make_tuple(/*PreferCurrentTab=*/false, /*NewOrder=*/false), - std::make_tuple(/*PreferCurrentTab=*/true, /*NewOrder=*/false), - std::make_tuple(/*PreferCurrentTab=*/false, /*NewOrder=*/true))); +INSTANTIATE_TEST_SUITE_P(All, + DesktopMediaPickerViewsTest, + testing::ValuesIn(kDefaultProductSourceConfigs)); TEST_P(DesktopMediaPickerViewsTest, DoneCallbackCalledWhenWindowClosed) { GetPickerDialogView()->GetWidget()->Close(); @@ -248,31 +298,6 @@ EXPECT_EQ(kFakeId, WaitForPickerDone()); } -// Verifies that a MediaSourceView is selected with mouse left click and -// original selected MediaSourceView gets unselected. -TEST_P(DesktopMediaPickerViewsTest, SelectMediaSourceViewOnSingleClick) { - for (const DesktopMediaList::Type source_type : source_types()) { - const auto source_id_type = GetSourceIdType(source_type); - - test_api_.SelectTabForSourceType(source_type); - media_lists_[source_type]->AddSourceByFullMediaID( - DesktopMediaID(source_id_type, 10)); - media_lists_[source_type]->AddSourceByFullMediaID( - DesktopMediaID(source_id_type, 20)); - - // By default, nothing should be selected. - EXPECT_FALSE(test_api_.GetSelectedSourceId().has_value()); - - test_api_.PressMouseOnSourceAtIndex(0); - ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); - EXPECT_EQ(10, test_api_.GetSelectedSourceId().value()); - - test_api_.PressMouseOnSourceAtIndex(1); - ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); - EXPECT_EQ(20, test_api_.GetSelectedSourceId().value()); - } -} - // Regression test for https://crbug.com/1102153 TEST_P(DesktopMediaPickerViewsTest, DoneCallbackNotCalledOnDoubleTap) { const DesktopMediaID kFakeId(DesktopMediaID::TYPE_SCREEN, 222); @@ -293,77 +318,6 @@ GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL)); } -// Verifies that the MediaSourceView is added or removed when |media_list_| is -// updated. -TEST_P(DesktopMediaPickerViewsTest, AddAndRemoveMediaSource) { - for (const DesktopMediaList::Type source_type : source_types()) { - const auto source_id_type = GetSourceIdType(source_type); - - test_api_.SelectTabForSourceType(source_type); - // No media source at first. - EXPECT_FALSE(test_api_.HasSourceAtIndex(0)); - - for (int i = 0; i < 3; ++i) { - media_lists_[source_type]->AddSourceByFullMediaID( - DesktopMediaID(source_id_type, i)); - EXPECT_TRUE(test_api_.HasSourceAtIndex(i)); - } - - for (int i = 2; i >= 0; --i) { - media_lists_[source_type]->RemoveSource(i); - EXPECT_FALSE(test_api_.HasSourceAtIndex(i)); - } - } -} - -// Verifies that focusing the MediaSourceView marks it selected and the -// original selected MediaSourceView gets unselected. -TEST_P(DesktopMediaPickerViewsTest, FocusMediaSourceViewToSelect) { - for (const DesktopMediaList::Type source_type : source_types()) { - const auto source_id_type = GetSourceIdType(source_type); - - test_api_.SelectTabForSourceType(source_type); - media_lists_[source_type]->AddSourceByFullMediaID( - DesktopMediaID(source_id_type, 10)); - media_lists_[source_type]->AddSourceByFullMediaID( - DesktopMediaID(source_id_type, 20)); - - test_api_.FocusSourceAtIndex(0); - ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); - EXPECT_EQ(10, test_api_.GetSelectedSourceId().value()); - - if (test_api_.AudioSupported(source_type)) { - test_api_.FocusAudioCheckbox(); - ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); - EXPECT_EQ(10, test_api_.GetSelectedSourceId().value()); - } - - test_api_.FocusSourceAtIndex(1); - ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); - EXPECT_EQ(20, test_api_.GetSelectedSourceId().value()); - } -} - -TEST_P(DesktopMediaPickerViewsTest, OkButtonDisabledWhenNoSelection) { - for (const DesktopMediaList::Type source_type : source_types()) { - const auto source_id_type = GetSourceIdType(source_type); - - test_api_.SelectTabForSourceType(source_type); - media_lists_[source_type]->AddSourceByFullMediaID( - DesktopMediaID(source_id_type, 111)); - EXPECT_FALSE( - GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); - - test_api_.FocusSourceAtIndex(0); - EXPECT_TRUE( - GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); - - media_lists_[source_type]->RemoveSource(0); - EXPECT_FALSE( - GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); - } -} - TEST_P(DesktopMediaPickerViewsTest, AudioCheckboxDefaultStates) { if (test_api_.AudioSupported(DesktopMediaList::Type::kScreen)) { test_api_.SelectTabForSourceType(DesktopMediaList::Type::kScreen); @@ -504,30 +458,152 @@ EXPECT_EQ(fake_id, WaitForPickerDone()); } -// Verifies that the controller can successfully clear the selection when asked -// to do so. -TEST_P(DesktopMediaPickerViewsTest, ClearSelection) { - for (const DesktopMediaList::Type source_type : source_types()) { - const auto source_id_type = GetSourceIdType(source_type); +class DesktopMediaPickerViewsPerTypeTest + : public DesktopMediaPickerViewsTestBase, + public testing::WithParamInterface< + std::tuple<PickerConfiguration, DesktopMediaList::Type>> { + public: + DesktopMediaPickerViewsPerTypeTest() + : DesktopMediaPickerViewsTestBase(config().GetSourceTypes()), + source_id_type_(GetSourceIdType(type())) {} + ~DesktopMediaPickerViewsPerTypeTest() override = default; - test_api_.SelectTabForSourceType(source_type); - media_lists_[source_type]->AddSourceByFullMediaID( - DesktopMediaID(source_id_type, 10)); - media_lists_[source_type]->AddSourceByFullMediaID( - DesktopMediaID(source_id_type, 20)); + void SetUp() override { + // We must first call the base class SetUp, as if we skip without doing so, + // then teardown will fail. + DesktopMediaPickerViewsTestBase::SetUp(); - // By default, nothing should be selected. - EXPECT_FALSE(test_api_.GetSelectedSourceId().has_value()); + if (!base::Contains(source_types(), type())) { + GTEST_SKIP(); + } - // Select a Source ID. - test_api_.PressMouseOnSourceAtIndex(0); + test_api_.SelectTabForSourceType(type()); + } + + PickerConfiguration config() const { return std::get<0>(GetParam()); } + DesktopMediaList::Type type() const { return std::get<1>(GetParam()); } + DesktopMediaID::Type source_id_type() const { return source_id_type_; } + + static std::string GetDescription( + const testing::TestParamInfo< + DesktopMediaPickerViewsPerTypeTest::ParamType>& info) { + const PickerConfiguration& config = std::get<0>(info.param); + const DesktopMediaList::Type& type = std::get<1>(info.param); + + return base::StrCat({config.TestNameString(), + "_", // Ensure config and type strings are separated. + GetTypeAsTestNameString(type)}); + } + + private: + const DesktopMediaID::Type source_id_type_; +}; + +INSTANTIATE_TEST_SUITE_P( + All, + DesktopMediaPickerViewsPerTypeTest, + testing::Combine(testing::ValuesIn(kDefaultProductSourceConfigs), + testing::Values(DesktopMediaList::Type::kCurrentTab, + DesktopMediaList::Type::kWebContents, + DesktopMediaList::Type::kWindow, + DesktopMediaList::Type::kScreen)), + &DesktopMediaPickerViewsPerTypeTest::GetDescription); + +// Verifies that a MediaSourceView is selected with mouse left click and +// original selected MediaSourceView gets unselected. +TEST_P(DesktopMediaPickerViewsPerTypeTest, SelectMediaSourceViewOnSingleClick) { + media_lists_[type()]->AddSourceByFullMediaID( + DesktopMediaID(source_id_type(), 10)); + media_lists_[type()]->AddSourceByFullMediaID( + DesktopMediaID(source_id_type(), 20)); + + // By default, nothing should be selected. + EXPECT_FALSE(test_api_.GetSelectedSourceId().has_value()); + + test_api_.PressMouseOnSourceAtIndex(0); + ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); + EXPECT_EQ(10, test_api_.GetSelectedSourceId().value()); + + test_api_.PressMouseOnSourceAtIndex(1); + ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); + EXPECT_EQ(20, test_api_.GetSelectedSourceId().value()); +} + +// Verifies that the MediaSourceView is added or removed when |media_list_| is +// updated. +TEST_P(DesktopMediaPickerViewsPerTypeTest, AddAndRemoveMediaSource) { + // No media source at first. + EXPECT_FALSE(test_api_.HasSourceAtIndex(0)); + + for (int i = 0; i < 3; ++i) { + media_lists_[type()]->AddSourceByFullMediaID( + DesktopMediaID(source_id_type(), i)); + EXPECT_TRUE(test_api_.HasSourceAtIndex(i)); + } + + for (int i = 2; i >= 0; --i) { + media_lists_[type()]->RemoveSource(i); + EXPECT_FALSE(test_api_.HasSourceAtIndex(i)); + } +} + +// Verifies that focusing the MediaSourceView marks it selected and the +// original selected MediaSourceView gets unselected. +TEST_P(DesktopMediaPickerViewsPerTypeTest, FocusMediaSourceViewToSelect) { + media_lists_[type()]->AddSourceByFullMediaID( + DesktopMediaID(source_id_type(), 10)); + media_lists_[type()]->AddSourceByFullMediaID( + DesktopMediaID(source_id_type(), 20)); + + test_api_.FocusSourceAtIndex(0); + ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); + EXPECT_EQ(10, test_api_.GetSelectedSourceId().value()); + + if (test_api_.AudioSupported(type())) { + test_api_.FocusAudioCheckbox(); ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); EXPECT_EQ(10, test_api_.GetSelectedSourceId().value()); - - // Clear the selection and assert that nothing is selected. - test_api_.GetSelectedController()->ClearSelection(); - EXPECT_FALSE(test_api_.GetSelectedSourceId().has_value()); } + + test_api_.FocusSourceAtIndex(1); + ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); + EXPECT_EQ(20, test_api_.GetSelectedSourceId().value()); +} + +TEST_P(DesktopMediaPickerViewsPerTypeTest, OkButtonDisabledWhenNoSelection) { + media_lists_[type()]->AddSourceByFullMediaID( + DesktopMediaID(source_id_type(), 111)); + EXPECT_FALSE( + GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); + + test_api_.FocusSourceAtIndex(0); + EXPECT_TRUE( + GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); + + media_lists_[type()]->RemoveSource(0); + EXPECT_FALSE( + GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); +} + +// Verifies that the controller can successfully clear the selection when asked +// to do so. +TEST_P(DesktopMediaPickerViewsPerTypeTest, ClearSelection) { + media_lists_[type()]->AddSourceByFullMediaID( + DesktopMediaID(source_id_type(), 10)); + media_lists_[type()]->AddSourceByFullMediaID( + DesktopMediaID(source_id_type(), 20)); + + // By default, nothing should be selected. + EXPECT_FALSE(test_api_.GetSelectedSourceId().has_value()); + + // Select a Source ID. + test_api_.PressMouseOnSourceAtIndex(0); + ASSERT_TRUE(test_api_.GetSelectedSourceId().has_value()); + EXPECT_EQ(10, test_api_.GetSelectedSourceId().value()); + + // Clear the selection and assert that nothing is selected. + test_api_.GetSelectedController()->ClearSelection(); + EXPECT_FALSE(test_api_.GetSelectedSourceId().has_value()); } class DesktopMediaPickerViewsSystemAudioTest
diff --git a/chrome/browser/ui/views/lens/lens_region_search_instructions_view.cc b/chrome/browser/ui/views/lens/lens_region_search_instructions_view.cc index 5361b5a..7b27427 100644 --- a/chrome/browser/ui/views/lens/lens_region_search_instructions_view.cc +++ b/chrome/browser/ui/views/lens/lens_region_search_instructions_view.cc
@@ -18,6 +18,7 @@ #include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/controls/button/image_button_factory.h" +#include "ui/views/controls/highlight_path_generator.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/layout/flex_layout.h" @@ -169,6 +170,9 @@ close_button_->SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER); close_button_->SetProperty( views::kMarginsKey, gfx::Insets::TLBR(0, kCloseButtonExtraMargin, 0, 0)); + // Make sure the hover background behind the button is a circle, rather than a + // rounded square. + views::InstallCircleHighlightPathGenerator(close_button_.get()); constructed_close_button_ = AddChildView(std::move(close_button_)); }
diff --git a/chrome/browser/ui/views/omnibox/omnibox_text_view.cc b/chrome/browser/ui/views/omnibox/omnibox_text_view.cc index 7780ea35..8a20126 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_text_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_text_view.cc
@@ -304,7 +304,9 @@ font_height_ = std::max(height_normal, height_bold); font_height_ += kVerticalPadding; + render_text_->SetElideBehavior(gfx::NO_ELIDE); SetPreferredSize(CalculatePreferredSize()); + render_text_->SetElideBehavior(gfx::ELIDE_TAIL); SchedulePaint(); }
diff --git a/chrome/browser/ui/views/payments/payment_handler_icon_refetch_browsertest.cc b/chrome/browser/ui/views/payments/payment_handler_icon_refetch_browsertest.cc index 3491d5d..c81ea50 100644 --- a/chrome/browser/ui/views/payments/payment_handler_icon_refetch_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_handler_icon_refetch_browsertest.cc
@@ -43,8 +43,8 @@ content::BrowserContext* context = GetActiveWebContents()->GetBrowserContext(); auto downloader = std::make_unique<TestDownloader>( - context->GetDefaultStoragePartition() - ->GetURLLoaderFactoryForBrowserProcess()); + GetCSPCheckerForTests(), context->GetDefaultStoragePartition() + ->GetURLLoaderFactoryForBrowserProcess()); downloader->AddTestServerURL("https://kylepay.com/", kylepay_server_.GetURL("kylepay.com", "/")); ServiceWorkerPaymentAppFinder::GetOrCreateForCurrentDocument(
diff --git a/chrome/browser/ui/views/payments/payment_method_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/payment_method_view_controller_browsertest.cc index 3cc0abe..ea691f6 100644 --- a/chrome/browser/ui/views/payments/payment_method_view_controller_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_method_view_controller_browsertest.cc
@@ -51,8 +51,8 @@ content::BrowserContext* context = GetActiveWebContents()->GetBrowserContext(); auto downloader = std::make_unique<TestDownloader>( - context->GetDefaultStoragePartition() - ->GetURLLoaderFactoryForBrowserProcess()); + GetCSPCheckerForTests(), context->GetDefaultStoragePartition() + ->GetURLLoaderFactoryForBrowserProcess()); downloader->AddTestServerURL("https://kylepay.com/", kylepay_server_.GetURL("kylepay.com", "/")); downloader->AddTestServerURL("https://google.com/",
diff --git a/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc b/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc index 28b0eb17..023f7a6 100644 --- a/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc +++ b/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
@@ -905,6 +905,11 @@ event_waiter_->Wait(); } +base::WeakPtr<CSPChecker> +PaymentRequestBrowserTestBase::GetCSPCheckerForTests() { + return const_csp_checker_.GetWeakPtr(); +} + } // namespace payments std::ostream& operator<<(
diff --git a/chrome/browser/ui/views/payments/payment_request_browsertest_base.h b/chrome/browser/ui/views/payments/payment_request_browsertest_base.h index d3ba8dc7..d15a27a 100644 --- a/chrome/browser/ui/views/payments/payment_request_browsertest_base.h +++ b/chrome/browser/ui/views/payments/payment_request_browsertest_base.h
@@ -21,6 +21,7 @@ #include "components/autofill/core/browser/personal_data_manager_observer.h" #include "components/autofill/core/browser/test_event_waiter.h" #include "components/payments/content/payment_request.h" +#include "components/payments/core/const_csp_checker.h" #include "components/sync/test/test_sync_service.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "content/public/browser/web_contents_observer.h" @@ -285,6 +286,9 @@ // Wait for the event(s) passed to ResetEventWaiter*() to occur. void WaitForObservedEvent(); + // Return a weak pointer to a Content Security Policy (CSP) checker for tests. + base::WeakPtr<CSPChecker> GetCSPCheckerForTests(); + private: std::unique_ptr<autofill::EventWaiter<DialogEvent>> event_waiter_; std::unique_ptr<net::EmbeddedTestServer> https_server_; @@ -297,6 +301,7 @@ bool is_browser_window_active_ = true; bool skip_ui_for_basic_card_ = false; std::vector<base::WeakPtr<PaymentRequest>> requests_; + ConstCSPChecker const_csp_checker_{/*allow=*/true}; base::WeakPtrFactory<PaymentRequestBrowserTestBase> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ui/views/payments/payment_request_payment_app_browsertest.cc b/chrome/browser/ui/views/payments/payment_request_payment_app_browsertest.cc index 9aa09717..b18ec64b 100644 --- a/chrome/browser/ui/views/payments/payment_request_payment_app_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_request_payment_app_browsertest.cc
@@ -126,9 +126,9 @@ content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); auto downloader = std::make_unique<TestDownloader>( - web_contents->GetBrowserContext() - ->GetDefaultStoragePartition() - ->GetURLLoaderFactoryForBrowserProcess()); + GetCSPCheckerForTests(), web_contents->GetBrowserContext() + ->GetDefaultStoragePartition() + ->GetURLLoaderFactoryForBrowserProcess()); downloader->AddTestServerURL("https://alicepay.com/", alicepay_.GetURL("alicepay.com", "/")); downloader->AddTestServerURL("https://bobpay.com/",
diff --git a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.cc b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.cc index 8afe216..a060cca 100644 --- a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.cc +++ b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.cc
@@ -3,16 +3,22 @@ // found in the LICENSE file. #include "chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h" +#include "base/time/time.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_element_identifiers.h" +#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/performance_controls/tab_discard_tab_helper.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/toolbar_button_provider.h" +#include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "chrome/browser/ui/views/performance_controls/high_efficiency_bubble_view.h" #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" +#include "components/feature_engagement/public/event_constants.h" +#include "components/feature_engagement/public/feature_constants.h" +#include "components/performance_manager/public/features.h" #include "components/prefs/pref_service.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" @@ -21,10 +27,16 @@ namespace { // The duration that the chip should be expanded for. -constexpr base::TimeDelta kChipAnimationDuration = base::Milliseconds(12000); +constexpr base::TimeDelta kChipAnimationDuration = base::Seconds(12); +// The delay before the IPH should be potentially shown. This should be less +// than kChipAnimationDuration but longer than kIconLabelAnimationDurationMs. +constexpr base::TimeDelta kIPHDelayDuration = base::Seconds(1); // The number of times a user should see the expanded chip. constexpr int kChipAnimationCount = 3; +// We want this to show up before the chip finishes animating. +static_assert(kIPHDelayDuration < kChipAnimationDuration); + } // namespace HighEfficiencyChipView::HighEfficiencyChipView( @@ -65,7 +77,6 @@ TabDiscardTabHelper::FromWebContents(web_contents); if (tab_helper->IsChipVisible()) { SetVisible(true); - if (tab_helper->ShouldIconAnimate()) { // Only animate the chip to the expanded view the first 3 times it is // viewed. @@ -79,6 +90,13 @@ times_rendered + 1); } } + + if (performance_manager::features::kHighEfficiencyModeDefaultState.Get()) { + // Delay the IPH to ensure the chip is not animating when it appears. + timer_.Start(FROM_HERE, kIPHDelayDuration, + base::BindOnce(&HighEfficiencyChipView::MaybeShowIPH, + weak_ptr_factory_.GetWeakPtr())); + } } else { AnimateOut(); ResetSlideAnimation(false); @@ -92,6 +110,10 @@ View* anchor_view = browser_view->toolbar_button_provider()->GetAnchorView( PageActionIconType::kHighEfficiency); bubble_ = HighEfficiencyBubbleView::ShowBubble(browser_, anchor_view, this); + if (browser_->window() != nullptr) { + browser_->window()->NotifyFeatureEngagementEvent( + feature_engagement::events::kHighEfficiencyDialogShown); + } } const gfx::VectorIcon& HighEfficiencyChipView::GetVectorIcon() const { @@ -107,5 +129,18 @@ return l10n_util::GetStringUTF16(IDS_HIGH_EFFICIENCY_CHIP_ACCNAME); } +void HighEfficiencyChipView::MaybeShowIPH() { + if (browser_->window() != nullptr) { + bool const promo_shown = browser_->window()->MaybeShowFeaturePromo( + feature_engagement::kIPHHighEfficiencyInfoModeFeature, {}, + base::BindOnce(&HighEfficiencyChipView::UnpauseAnimation, + weak_ptr_factory_.GetWeakPtr())); + // While the IPH is showing, pause the animation of the chip so it doesn't + // animate closed. + if (promo_shown) + PauseAnimation(); + } +} + BEGIN_METADATA(HighEfficiencyChipView, PageActionIconView) END_METADATA
diff --git a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h index e2c05026..a76a193 100644 --- a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h +++ b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h
@@ -40,7 +40,11 @@ private: const raw_ptr<Browser> browser_; + base::OneShotTimer timer_; raw_ptr<views::BubbleDialogModelHost> bubble_ = nullptr; + base::WeakPtrFactory<HighEfficiencyChipView> weak_ptr_factory_{this}; + + void MaybeShowIPH(); }; #endif // CHROME_BROWSER_UI_VIEWS_PERFORMANCE_CONTROLS_HIGH_EFFICIENCY_CHIP_VIEW_H_
diff --git a/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_browsertest.cc b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_browsertest.cc new file mode 100644 index 0000000..704afb4 --- /dev/null +++ b/chrome/browser/ui/views/performance_controls/high_efficiency_chip_view_browsertest.cc
@@ -0,0 +1,139 @@ +// Copyright 2022 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/bind.h" +#include "base/test/bind.h" +#include "chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h" +#include "chrome/browser/ui/browser_element_identifiers.h" +#include "chrome/browser/ui/performance_controls/tab_discard_tab_helper.h" +#include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/views/page_action/page_action_icon_controller.h" +#include "chrome/browser/ui/views/page_action/page_action_icon_view.h" +#include "chrome/browser/ui/views/performance_controls/high_efficiency_chip_view.h" +#include "chrome/browser/ui/views/toolbar/toolbar_view.h" +#include "chrome/browser/ui/views/user_education/browser_feature_promo_controller.h" +#include "chrome/common/webui_url_constants.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "components/feature_engagement/public/feature_constants.h" +#include "components/feature_engagement/public/feature_list.h" +#include "components/performance_manager/public/features.h" +#include "components/performance_manager/public/user_tuning/prefs.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_view.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/mock_navigation_handle.h" +#include "content/public/test/test_navigation_observer.h" +#include "ui/views/interaction/interaction_test_util_views.h" + +class DiscardMockNavigationHandle : public content::MockNavigationHandle { + public: + void SetWasDiscarded(bool was_discarded) { was_discarded_ = was_discarded; } + bool ExistingDocumentWasDiscarded() const override { return was_discarded_; } + + private: + bool was_discarded_ = false; +}; + +class HighEfficiencyChipViewBrowserTest : public InProcessBrowserTest { + public: + HighEfficiencyChipViewBrowserTest() = default; + ~HighEfficiencyChipViewBrowserTest() override = default; + + void SetUp() override { + feature_list_.InitWithFeaturesAndParameters( + {{feature_engagement::kIPHDemoMode, + {{feature_engagement::kIPHDemoModeFeatureChoiceParam, + feature_engagement::kIPHHighEfficiencyInfoModeFeature.name}}}, + {feature_engagement::kIPHHighEfficiencyInfoModeFeature, {}}, + {performance_manager::features::kHighEfficiencyModeAvailable, + {{"default_state", "true"}, {"time_before_discard", "5s"}}}}, + {}); + + InProcessBrowserTest::SetUp(); + } + + void TearDown() override { InProcessBrowserTest::TearDown(); } + + BrowserFeaturePromoController* GetFeaturePromoController() { + auto* promo_controller = static_cast<BrowserFeaturePromoController*>( + browser()->window()->GetFeaturePromoController()); + return promo_controller; + } + + PageActionIconView* GetPageActionIconView() { + BrowserView* browser_view = + BrowserView::GetBrowserViewForBrowser(browser()); + return browser_view->GetLocationBarView() + ->page_action_icon_controller() + ->GetIconView(PageActionIconType::kHighEfficiency); + } + + void PressButton(views::Button* button) { + views::test::InteractionTestUtilSimulatorViews::PressButton( + button, ui::test::InteractionTestUtil::InputType::kMouse); + } + + void SetTabDiscardState(bool is_discarded) { + TabDiscardTabHelper* tab_helper = TabDiscardTabHelper::FromWebContents( + browser()->tab_strip_model()->GetWebContentsAt(0)); + std::unique_ptr<DiscardMockNavigationHandle> navigation_handle = + std::make_unique<DiscardMockNavigationHandle>(); + navigation_handle.get()->SetWasDiscarded(is_discarded); + tab_helper->DidStartNavigation(navigation_handle.get()); + + BrowserView* browser_view = + BrowserView::GetBrowserViewForBrowser(browser()); + browser_view->GetLocationBarView() + ->page_action_icon_controller() + ->UpdateAll(); + } + + void WaitForIPHToShow() { + base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed); + base::RepeatingTimer timer; + timer.Start( + FROM_HERE, base::Milliseconds(200), base::BindLambdaForTesting([&]() { + if (GetFeaturePromoController()->IsPromoActive( + feature_engagement::kIPHHighEfficiencyInfoModeFeature)) { + timer.Stop(); + run_loop.Quit(); + } + })); + // This will time out if the promo is never active. + run_loop.Run(); + } + + private: + base::test::ScopedFeatureList feature_list_; +}; + +IN_PROC_BROWSER_TEST_F(HighEfficiencyChipViewBrowserTest, + PromoCustomActionClicked) { + auto lock = BrowserFeaturePromoController::BlockActiveWindowCheckForTesting(); + auto* const promo_controller = GetFeaturePromoController(); + + EXPECT_FALSE(GetFeaturePromoController()->IsPromoActive( + feature_engagement::kIPHHighEfficiencyInfoModeFeature)); + + SetTabDiscardState(true); + PageActionIconView* icon = GetPageActionIconView(); + EXPECT_TRUE(icon->GetVisible()); + + WaitForIPHToShow(); + + EXPECT_TRUE(GetFeaturePromoController()->IsPromoActive( + feature_engagement::kIPHHighEfficiencyInfoModeFeature)); + + content::TestNavigationObserver navigation_observer( + browser()->tab_strip_model()->GetWebContentsAt(0)); + auto* promo_bubble = promo_controller->promo_bubble_for_testing() + ->AsA<user_education::HelpBubbleViews>() + ->bubble_view(); + auto* custom_action_button = promo_bubble->GetNonDefaultButtonForTesting(0); + PressButton(custom_action_button); + navigation_observer.Wait(); + + GURL expected(chrome::kChromeUIPerformanceSettingsURL); + EXPECT_EQ(expected.host(), navigation_observer.last_navigation_url().host()); +}
diff --git a/chrome/browser/ui/views/sharing_hub/sharing_hub_bubble_view_impl.cc b/chrome/browser/ui/views/sharing_hub/sharing_hub_bubble_view_impl.cc index 515fb2ce..dedba93 100644 --- a/chrome/browser/ui/views/sharing_hub/sharing_hub_bubble_view_impl.cc +++ b/chrome/browser/ui/views/sharing_hub/sharing_hub_bubble_view_impl.cc
@@ -173,10 +173,10 @@ views::style::CONTEXT_DIALOG_BODY_TEXT); share_link_label->SetLineHeight(kLabelLineHeight); share_link_label->SetMultiLine(true); - share_link_label->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); + share_link_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); share_link_label->SizeToFit(views::DISTANCE_BUBBLE_PREFERRED_WIDTH); share_link_label->SetBorder( - views::CreateEmptyBorder(gfx::Insets::TLBR(0, kIndent, 0, 0))); + views::CreateEmptyBorder(gfx::Insets::TLBR(0, kIndent, 0, kIndent))); share_link_label_ = action_list_view->AddChildView(share_link_label); for (const auto& action : third_party_actions) {
diff --git a/chrome/browser/ui/views/user_education/browser_user_education_service.cc b/chrome/browser/ui/views/user_education/browser_user_education_service.cc index 80300416..03e763d 100644 --- a/chrome/browser/ui/views/user_education/browser_user_education_service.cc +++ b/chrome/browser/ui/views/user_education/browser_user_education_service.cc
@@ -20,6 +20,7 @@ #include "chrome/common/webui_url_constants.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" +#include "chrome/grit/google_chrome_strings.h" #include "components/feature_engagement/public/feature_constants.h" #include "components/strings/grit/components_strings.h" #include "components/user_education/common/feature_promo_handle.h" @@ -293,6 +294,24 @@ })) .SetBubbleTitleText(IDS_BATTERY_SAVER_MODE_PROMO_TITLE) .SetBubbleArrow(HelpBubbleArrow::kTopRight))); + + // kIPHHighEfficiencyInfoModeFeature: + registry.RegisterFeature(std::move( + FeaturePromoSpecification::CreateForCustomAction( + feature_engagement::kIPHHighEfficiencyInfoModeFeature, + kHighEfficiencyChipElementId, + IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TEXT, + IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_ACTION_TEXT, + base::BindRepeating( + [](ui::ElementContext ctx, + user_education::FeaturePromoHandle promo_handle) { + auto* browser = chrome::FindBrowserWithUiElementContext(ctx); + if (browser) + chrome::ShowSettingsSubPage(browser, + chrome::kPerformanceSubPage); + })) + .SetBubbleTitleText(IDS_HIGH_EFFICIENCY_INFO_MODE_PROMO_TITLE) + .SetBubbleArrow(HelpBubbleArrow::kTopCenter))); } void MaybeRegisterChromeTutorials(
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc index 12e5d0b..5cedd5a 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc
@@ -61,7 +61,13 @@ helper_.CheckPlatformShortcutAndIcon(Site::kStandalone); } -IN_PROC_BROWSER_TEST_F(WebAppIntegration, CheckSiteHandlesFile) { +// TODO(crbug.com/1357214): Flaky on MacOS 12 ARM +#if BUILDFLAG(IS_MAC) +#define MAYBE_CheckSiteHandlesFile DISABLED_CheckSiteHandlesFile +#else +#define MAYBE_CheckSiteHandlesFile CheckSiteHandlesFile +#endif +IN_PROC_BROWSER_TEST_F(WebAppIntegration, MAYBE_CheckSiteHandlesFile) { helper_.InstallMenuOption(InstallableSite::kMinimalUi); helper_.CheckSiteHandlesFile(Site::kMinimalUi, "qux"); helper_.CheckSiteHandlesFile(Site::kMinimalUi, "quux");
diff --git a/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler_browsertest.cc b/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler_browsertest.cc index d0420a06..a04d08b 100644 --- a/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler_browsertest.cc +++ b/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler_browsertest.cc
@@ -9,6 +9,7 @@ #endif #include "chrome/browser/media/router/discovery/access_code/access_code_cast_constants.h" #include "components/sessions/content/session_tab_helper.h" +#include "services/network/test/test_network_connection_tracker.h" #include "testing/gtest/include/gtest/gtest.h" namespace media_router { @@ -33,12 +34,17 @@ SetUpPrimaryAccountWithHostedDomain(signin::ConsentLevel::kSync, browser()->profile()); + network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( + network::mojom::ConnectionType::CONNECTION_NONE); + auto* dialog_contents = ShowDialog(); SetAccessCode("abcdef", dialog_contents); PressSubmit(dialog_contents); // This error code corresponds to - // ErrorMessage.NETWORK::AddSinkResultCode.SERVER_ERROR + // ErrorMessage.NETWORK::AddSinkResultCode.SERVICE_NOT_PRESENT. This error + // code 3 refers to the ErrorMessage described within + // chrome/browser/resources/access_code_cast/error_message/error_message.ts EXPECT_EQ(3, WaitForAddSinkErrorCode(dialog_contents)); CloseDialog(dialog_contents); } @@ -116,7 +122,9 @@ PressSubmit(dialog_contents); // This error code corresponds to - // ErrorMessage.GENERIC::AddSinkResultCode.PROFILE_SYNC_ERROR + // ErrorMessage.GENERIC::AddSinkResultCode.PROFILE_SYNC_ERROR. This error code + // 1 refers to the ErrorMessage described within + // chrome/browser/resources/access_code_cast/error_message/error_message.ts EXPECT_EQ(1, WaitForAddSinkErrorCode(dialog_contents)); CloseDialog(dialog_contents); }
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index c23a5c2..57e9342 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1663351186-78eb8dc64f75cb9f8b65eb73f09a91b6a2776749.profdata +chrome-win64-main-1663361926-00a1ccbcedf7015278e3787b59772bfe0f325e4b.profdata
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 5e4b93b..78f9029 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3392,6 +3392,7 @@ "../browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc", "../browser/ui/views/payments/shipping_option_view_controller_browsertest.cc", "../browser/ui/views/performance_controls/battery_saver_button_browsertest.cc", + "../browser/ui/views/performance_controls/high_efficiency_chip_view_browsertest.cc", "../browser/ui/views/permissions/permission_prompt_bubble_view_browsertest.cc", "../browser/ui/views/permissions/permission_request_chip_browsertest.cc", "../browser/ui/views/profiles/profile_menu_view_browsertest.cc", @@ -7573,6 +7574,7 @@ "../browser/chromeos/policy/dlp/mock_dlp_rules_manager.cc", "../browser/chromeos/policy/dlp/mock_dlp_rules_manager.h", "../browser/chromeos/reporting/device_reporting_settings_lacros_unittest.cc", + "../browser/chromeos/reporting/metric_reporting_manager_lacros_unittest.cc", "../browser/lacros/account_manager/account_manager_util_unittest.cc", "../browser/lacros/account_manager/account_profile_mapper_unittest.cc", "../browser/lacros/account_manager/get_account_information_helper_unittest.cc", @@ -7614,6 +7616,8 @@ "//chromeos/ui/wm", "//components/account_manager_core", "//components/account_manager_core:test_support", + "//components/reporting/metrics:metrics_data_collection", + "//components/reporting/metrics:test_support", ] }
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 4be05fd1..3ea8614 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -12390,6 +12390,9 @@ "ReportDeviceSignalStrengthEventDrivenTelemetry": { "reason_for_missing_test": "Maps into CrosSettings" }, + "DeviceReportXDREvents": { + "reason_for_missing_test": "Maps into CrosSettings" + }, "DeviceAllowNewUsers": { "reason_for_missing_test": "Maps into CrosSettings" }, @@ -19557,6 +19560,39 @@ } ] }, + "CalendarIntegrationEnabled": { + "os": ["chromeos_ash"], + "policy_pref_mapping_tests": [ + { + "policies": {}, + "prefs": { + "ash.calendar_integration_enabled": { + "value": false + } + } + }, + { + "policies": { + "CalendarIntegrationEnabled": false + }, + "prefs": { + "ash.calendar_integration_enabled": { + "value": false + } + } + }, + { + "policies": { + "CalendarIntegrationEnabled": true + }, + "prefs": { + "ash.calendar_integration_enabled": { + "value": true + } + } + } + ] + }, "OsColorMode": { "os": [ "chromeos_ash"
diff --git a/chrome/test/data/webui/access_code_cast/access_code_cast_browsertest.js b/chrome/test/data/webui/access_code_cast/access_code_cast_browsertest.js index 710a87e..26006e6 100644 --- a/chrome/test/data/webui/access_code_cast/access_code_cast_browsertest.js +++ b/chrome/test/data/webui/access_code_cast/access_code_cast_browsertest.js
@@ -62,13 +62,15 @@ mocha.run(); }); -var AccessCodeCastPasscodeInputTest = class extends AccessCodeCastBrowserTest { - /** @override */ - get browsePreload() { - return 'chrome://access-code-cast/test_loader.html?module=access_code_cast/passcode_input_test.js'; - } -}; +// PasscodeInputTest has started acting flaky (crbug/1363398). Disabling for now pending investigation. -TEST_F('AccessCodeCastPasscodeInputTest', 'All', function() { - mocha.run(); -}); +// var AccessCodeCastPasscodeInputTest = class extends AccessCodeCastBrowserTest { +// /** @override */ +// get browsePreload() { +// return 'chrome://access-code-cast/test_loader.html?module=access_code_cast/passcode_input_test.js'; +// } +// }; + +// TEST_F('AccessCodeCastPasscodeInputTest', 'All', function() { +// mocha.run(); +// });
diff --git a/chrome/test/data/webui/cr_components/chromeos/traffic_counters/BUILD.gn b/chrome/test/data/webui/cr_components/chromeos/traffic_counters/BUILD.gn index c94d20c8..623b4114 100644 --- a/chrome/test/data/webui/cr_components/chromeos/traffic_counters/BUILD.gn +++ b/chrome/test/data/webui/cr_components/chromeos/traffic_counters/BUILD.gn
@@ -21,6 +21,7 @@ js_library("traffic_counters_test") { deps = [ "../../..:chai_assert", + "//ash/webui/common/resources/traffic_counters:traffic_counters", "//chrome/test/data/webui/chromeos:fake_network_config_mojom", "//chromeos/services/network_config/public/mojom:mojom_webui_js", "//chromeos/services/network_config/public/mojom:network_types_webui_js", @@ -28,7 +29,6 @@ "//ui/webui/resources/cr_components/chromeos/network:mojo_interface_provider", "//ui/webui/resources/cr_components/chromeos/network:onc_mojo", "//ui/webui/resources/cr_components/chromeos/network_health:network_health_container", - "//ui/webui/resources/cr_components/chromeos/traffic_counters:traffic_counters", "//ui/webui/resources/cr_elements:i18n_behavior", ] externs_list = [ "$externs_path/mocha-2.5.js" ]
diff --git a/chrome/test/data/webui/cr_components/chromeos/traffic_counters/traffic_counters_test.js b/chrome/test/data/webui/cr_components/chromeos/traffic_counters/traffic_counters_test.js index bd78f52..9438a24 100644 --- a/chrome/test/data/webui/cr_components/chromeos/traffic_counters/traffic_counters_test.js +++ b/chrome/test/data/webui/cr_components/chromeos/traffic_counters/traffic_counters_test.js
@@ -5,9 +5,9 @@ // clang-format off import 'chrome://network/strings.m.js'; +import {TrafficCountersElement} from 'chrome://resources/ash/common/traffic_counters/traffic_counters.js'; import {MojoInterfaceProviderImpl} from 'chrome://resources/cr_components/chromeos/network/mojo_interface_provider.js'; import {OncMojo} from 'chrome://resources/cr_components/chromeos/network/onc_mojo.js'; -import {TrafficCountersElement} from 'chrome://resources/cr_components/chromeos/traffic_counters/traffic_counters.js'; import {CrosNetworkConfig} from 'chrome://resources/mojo/chromeos/services/network_config/public/mojom/cros_network_config.mojom-webui.js'; import {NetworkType} from 'chrome://resources/mojo/chromeos/services/network_config/public/mojom/network_types.mojom-webui.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/test/data/webui/settings/chromeos/os_bluetooth_device_detail_subpage_tests.js b/chrome/test/data/webui/settings/chromeos/os_bluetooth_device_detail_subpage_tests.js index e27b425..7e7b7b39 100644 --- a/chrome/test/data/webui/settings/chromeos/os_bluetooth_device_detail_subpage_tests.js +++ b/chrome/test/data/webui/settings/chromeos/os_bluetooth_device_detail_subpage_tests.js
@@ -627,7 +627,9 @@ getBluetoothConnectDisconnectBtn().textContent.trim()); }); + test('Connect/Disconnect/forget states and error message', async function() { + loadTimeData.overrideValues({'enableFastPairFlag': false}); init(); bluetoothConfig.setBluetoothEnabledState(/*enabled=*/ true); @@ -825,8 +827,6 @@ // Forget device. getBluetoothForgetBtn().click(); - await flushAsync(); - bluetoothDeviceDetailPage.$$('#forgetDeviceDialog').$$('#forget').click(); await flushAsync(); bluetoothConfig.completeForget(/*success=*/ true); @@ -836,4 +836,52 @@ assertFalse(!!bluetoothDeviceDetailPage.getDeviceForTest()); assertFalse(!!bluetoothDeviceDetailPage.getDeviceIdForTest()); }); + + test('Forget button with Fast Pair flag', async function() { + loadTimeData.overrideValues({'enableFastPairFlag': true}); + init(); + bluetoothConfig.setBluetoothEnabledState(/*enabled=*/ true); + + const windowPopstatePromise = eventToPromise('popstate', window); + + const getBluetoothForgetBtn = () => + bluetoothDeviceDetailPage.shadowRoot.querySelector('#forgetBtn'); + const getBluetoothDialogForgetButton = () => + bluetoothDeviceDetailPage.shadowRoot + .querySelector('#forgetDeviceDialog') + .shadowRoot.querySelector('#forget'); + const id = '12//345&6789'; + + const device1 = createDefaultBluetoothDevice( + /*id=*/ id, + /*publicName=*/ 'BeatsX', + /*connectionState=*/ + DeviceConnectionState.kConnecting, + /*opt_nickname=*/ 'device1', + /*opt_audioCapability=*/ + AudioOutputCapability.kCapableOfAudioOutput, + /*opt_deviceType=*/ DeviceType.kMouse); + + bluetoothConfig.appendToPairedDeviceList([device1]); + await flushAsync(); + + const params = new URLSearchParams(); + params.append('id', id); + Router.getInstance().navigateTo(routes.BLUETOOTH_DEVICE_DETAIL, params); + + await flushAsync(); + + // Forget device. + getBluetoothForgetBtn().click(); + await flushAsync(); + getBluetoothDialogForgetButton().click(); + await flushAsync(); + + bluetoothConfig.completeForget(/*success=*/ true); + await windowPopstatePromise; + + // Device and device Id should be null after navigating backward. + assertFalse(!!bluetoothDeviceDetailPage.getDeviceForTest()); + assertFalse(!!bluetoothDeviceDetailPage.getDeviceIdForTest()); + }); });
diff --git a/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.cc b/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.cc index 1d84b96..91bd807 100644 --- a/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.cc +++ b/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.cc
@@ -181,6 +181,13 @@ void AccessCodeCastIntegrationBrowserTest::SetUpOnMainThread() { InProcessBrowserTest::SetUpOnMainThread(); + network_connection_tracker_ = + network::TestNetworkConnectionTracker::CreateInstance(); + content::SetNetworkConnectionTrackerForTesting(nullptr); + content::SetNetworkConnectionTrackerForTesting( + network_connection_tracker_.get()); + network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType( + network::mojom::ConnectionType::CONNECTION_WIFI); url_loader_interceptor_ = std::make_unique<content::URLLoaderInterceptor>(base::BindRepeating( &AccessCodeCastIntegrationBrowserTest::InterceptRequest,
diff --git a/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.h b/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.h index bc336a0..205a5af3 100644 --- a/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.h +++ b/chrome/test/media_router/access_code_cast/access_code_cast_integration_browsertest.h
@@ -32,6 +32,7 @@ #include "content/public/test/url_loader_interceptor.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" +#include "services/network/test/test_network_connection_tracker.h" #include "services/network/test/test_shared_url_loader_factory.h" #include "services/network/test/test_url_loader_factory.h" #include "testing/gtest/include/gtest/gtest.h" @@ -139,6 +140,9 @@ base::test::ScopedFeatureList feature_list_; base::CallbackListSubscription subscription_; + std::unique_ptr<network::TestNetworkConnectionTracker> + network_connection_tracker_; + protected: raw_ptr<media_router::MockMediaRouter> media_router_ = nullptr; std::vector<MediaSinksObserver*> media_sinks_observers_;
diff --git a/chrome/test/payments/payment_request_platform_browsertest_base.cc b/chrome/test/payments/payment_request_platform_browsertest_base.cc index e7d573af..d0752f7 100644 --- a/chrome/test/payments/payment_request_platform_browsertest_base.cc +++ b/chrome/test/payments/payment_request_platform_browsertest_base.cc
@@ -104,8 +104,8 @@ content::BrowserContext* context = GetActiveWebContents()->GetBrowserContext(); auto downloader = std::make_unique<TestDownloader>( - context->GetDefaultStoragePartition() - ->GetURLLoaderFactoryForBrowserProcess()); + GetCSPCheckerForTests(), context->GetDefaultStoragePartition() + ->GetURLLoaderFactoryForBrowserProcess()); for (const auto& method : payment_methods) { downloader->AddTestServerURL("https://" + method.first + "/", method.second->GetURL(method.first, "/")); @@ -182,6 +182,11 @@ std::move(event_sequence), false /* wait_for_single_event*/); } +base::WeakPtr<CSPChecker> +PaymentRequestPlatformBrowserTestBase::GetCSPCheckerForTests() { + return const_csp_checker_.GetWeakPtr(); +} + void PaymentRequestPlatformBrowserTestBase::WaitForObservedEvent() { event_waiter_->Wait(); }
diff --git a/chrome/test/payments/payment_request_platform_browsertest_base.h b/chrome/test/payments/payment_request_platform_browsertest_base.h index 8c0f721..d0f568fd 100644 --- a/chrome/test/payments/payment_request_platform_browsertest_base.h +++ b/chrome/test/payments/payment_request_platform_browsertest_base.h
@@ -17,6 +17,7 @@ #include "chrome/test/payments/personal_data_manager_test_util.h" #include "chrome/test/payments/test_event_waiter.h" #include "components/autofill/core/browser/autofill_test_utils.h" +#include "components/payments/core/const_csp_checker.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" @@ -98,6 +99,10 @@ void ResetEventWaiterForSingleEvent(TestEvent event); void ResetEventWaiterForEventSequence(std::list<TestEvent> event_sequence); + // Return a weak pointer to a Content Security Policy (CSP) checker for + // tests. + base::WeakPtr<CSPChecker> GetCSPCheckerForTests(); + // Wait for the event(s) passed to ResetEventWaiter*() to occur. void WaitForObservedEvent(); @@ -119,6 +124,7 @@ std::unique_ptr<EventWaiter> event_waiter_; std::unique_ptr<net::EmbeddedTestServer> https_server_; PaymentRequestTestController test_controller_; + ConstCSPChecker const_csp_checker_{/*allow=*/true}; }; } // namespace payments
diff --git a/chromeos/ash/services/libassistant/audio/audio_input_impl.cc b/chromeos/ash/services/libassistant/audio/audio_input_impl.cc index 3c5a800..68e637b 100644 --- a/chromeos/ash/services/libassistant/audio/audio_input_impl.cc +++ b/chromeos/ash/services/libassistant/audio/audio_input_impl.cc
@@ -483,10 +483,6 @@ OnCaptureDataArrived(); } -AudioInputStream* AudioInputImpl::GetOpenAudioStreamForTesting() { - return open_audio_stream_ ? open_audio_stream_.get() : nullptr; -} - void AudioInputImpl::StartRecording() { DCHECK(task_runner_->RunsTasksInCurrentSequence()); DCHECK(!HasOpenAudioStream());
diff --git a/chromeos/ash/services/libassistant/audio/audio_input_impl.h b/chromeos/ash/services/libassistant/audio/audio_input_impl.h index d5bc445..02436e2 100644 --- a/chromeos/ash/services/libassistant/audio/audio_input_impl.h +++ b/chromeos/ash/services/libassistant/audio/audio_input_impl.h
@@ -95,10 +95,6 @@ absl::optional<bool> IsUsingDeadStreamDetectionForTesting() const; // Calls |OnCaptureDataArrived| to simulate audio input. void OnCaptureDataArrivedForTesting(); - // Returns a pointer of current open stream. Note that this can get destroyed - // in |AudioInputImpl| at any time, i.e. do not access it unless you are sure - // the object is alive. - AudioInputStream* GetOpenAudioStreamForTesting(); private: void RecreateStateManager();
diff --git a/chromeos/ash/services/libassistant/audio_input_controller_unittest.cc b/chromeos/ash/services/libassistant/audio_input_controller_unittest.cc index cdfbf0b..610e514 100644 --- a/chromeos/ash/services/libassistant/audio_input_controller_unittest.cc +++ b/chromeos/ash/services/libassistant/audio_input_controller_unittest.cc
@@ -14,22 +14,47 @@ #include "chromeos/ash/services/libassistant/public/mojom/audio_input_controller.mojom.h" #include "chromeos/ash/services/libassistant/test_support/fake_platform_delegate.h" #include "media/audio/audio_device_description.h" +#include "media/mojo/mojom/audio_data_pipe.mojom.h" +#include "media/mojo/mojom/audio_stream_factory.mojom.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" +#include "services/audio/public/cpp/fake_stream_factory.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos { namespace libassistant { namespace { using mojom::LidState; +using testing::_; using Resolution = assistant_client::ConversationStateListener::Resolution; constexpr char kNormalDeviceId[] = "normal-device-id"; constexpr char kHotwordDeviceId[] = "hotword-device-id"; constexpr char kSkipForNonDspMessage[] = "This test case is for DSP"; +class MockStreamFactory : public audio::FakeStreamFactory { + public: + MOCK_METHOD( + void, + CreateInputStream, + (mojo::PendingReceiver<::media::mojom::AudioInputStream> stream_receiver, + mojo::PendingRemote<media::mojom::AudioInputStreamClient> client, + mojo::PendingRemote<::media::mojom::AudioInputStreamObserver> observer, + mojo::PendingRemote<::media::mojom::AudioLog> log, + const std::string& device_id, + const media::AudioParameters& params, + uint32_t shared_memory_count, + bool enable_agc, + base::ReadOnlySharedMemoryRegion key_press_count_buffer, + media::mojom::AudioProcessingConfigPtr processing_config, + CreateInputStreamCallback callback), + (override)); +}; + class FakeAudioInputObserver : public assistant_client::AudioInput::Observer { public: FakeAudioInputObserver() = default; @@ -157,6 +182,30 @@ return audio_input().IsUsingDeadStreamDetectionForTesting().value_or(false); } + bool HasCreateInputStreamCalled(MockStreamFactory* mock_stream_factory) { + EXPECT_CALL(*mock_stream_factory, + CreateInputStream(_, _, _, _, _, _, _, _, _, _, _)) + .WillOnce(testing::Invoke( + [](testing::Unused, testing::Unused, testing::Unused, + testing::Unused, testing::Unused, testing::Unused, + testing::Unused, testing::Unused, testing::Unused, + testing::Unused, + media::mojom::AudioStreamFactory::CreateInputStreamCallback + callback) { + // Invoke the callback as it becomes error if the callback never + // gets invoked. + std::move(callback).Run(nullptr, false, absl::nullopt); + })); + + mojo::PendingReceiver<media::mojom::AudioStreamFactory> pending_receiver = + platform_delegate_.stream_factory_receiver(); + EXPECT_TRUE(pending_receiver.is_valid()); + mock_stream_factory->receiver_.Bind(std::move(pending_receiver)); + mock_stream_factory->receiver_.FlushForTesting(); + + return testing::Mock::VerifyAndClearExpectations(mock_stream_factory); + } + std::string GetOpenDeviceId() { return audio_input().GetOpenDeviceIdForTesting().value_or("<none>"); } @@ -463,8 +512,7 @@ EXPECT_EQ(false, IsRecordingAudio()); } -// Disabled due to excessive flakiness. http://crbug.com/1363156 -TEST_P(AssistantAudioInputControllerTest, DISABLED_DSPTrigger) { +TEST_P(AssistantAudioInputControllerTest, DSPTrigger) { if (!IsEnableDspFlagOn()) { GTEST_SKIP() << kSkipForNonDspMessage; } @@ -474,10 +522,14 @@ SetHotwordEnabled(true); AssertHotwordAvailableState(); ASSERT_EQ(true, IsRecordingHotword()); - ASSERT_NE(nullptr, audio_input().GetOpenAudioStreamForTesting()); - ash::libassistant::AudioInputStream* open_audio_stream = - audio_input().GetOpenAudioStreamForTesting(); + MockStreamFactory mock_stream_factory; + EXPECT_TRUE(HasCreateInputStreamCalled(&mock_stream_factory)); + + // Until the conversation ends, no new input stream should be created. + EXPECT_CALL(mock_stream_factory, + CreateInputStream(_, _, _, _, _, _, _, _, _, _, _)) + .Times(0); // Simulate DSP hotword activation. When DSP detects a hotword, it starts // sending audio data until the channel gets closed. @@ -495,20 +547,20 @@ // During the conversation, an audio stream used for detecting the hotword // should be used. - EXPECT_EQ(open_audio_stream, audio_input().GetOpenAudioStreamForTesting()); EXPECT_TRUE(IsRecordingHotword()); + testing::Mock::VerifyAndClearExpectations(&mock_stream_factory); OnConversationTurnFinished(); // Once the converstation ends, the old audio stream will get closed and a new // one should be created. - EXPECT_NE(open_audio_stream, audio_input().GetOpenAudioStreamForTesting()); + mock_stream_factory.ResetReceiver(); + EXPECT_TRUE(HasCreateInputStreamCalled(&mock_stream_factory)); EXPECT_TRUE(IsRecordingHotword()); EXPECT_EQ(GetOpenDeviceId(), kHotwordDeviceId); } -// Disabled due to excessive flakiness. http://crbug.com/1363156 -TEST_P(AssistantAudioInputControllerTest, DISABLED_DSPTriggerredButSoftwareRejection) { +TEST_P(AssistantAudioInputControllerTest, DSPTriggerredButSoftwareRejection) { if (!IsEnableDspFlagOn()) { GTEST_SKIP() << kSkipForNonDspMessage; } @@ -518,10 +570,9 @@ SetHotwordEnabled(true); AssertHotwordAvailableState(); ASSERT_EQ(true, IsRecordingHotword()); - ASSERT_NE(nullptr, audio_input().GetOpenAudioStreamForTesting()); - ash::libassistant::AudioInputStream* open_audio_stream = - audio_input().GetOpenAudioStreamForTesting(); + MockStreamFactory mock_stream_factory; + EXPECT_TRUE(HasCreateInputStreamCalled(&mock_stream_factory)); // Simulate DSP hotword activation. When DSP detects a hotword, it starts // sending audio data until the channel gets closed. @@ -535,7 +586,8 @@ environment_.RunUntilIdle(); // If it's rejected by libassistant, DSP audio stream should be re-created. - EXPECT_NE(open_audio_stream, audio_input().GetOpenAudioStreamForTesting()); + mock_stream_factory.ResetReceiver(); + EXPECT_TRUE(HasCreateInputStreamCalled(&mock_stream_factory)); EXPECT_TRUE(IsRecordingHotword()); EXPECT_EQ(GetOpenDeviceId(), kHotwordDeviceId); }
diff --git a/chromeos/tast_control.gni b/chromeos/tast_control.gni index e3bc7ec..27eaf88 100644 --- a/chromeos/tast_control.gni +++ b/chromeos/tast_control.gni
@@ -242,6 +242,13 @@ "dlp.DataLeakPreventionRulesListPrivacyScreen", "dlp.DataLeakPreventionRulesListScreenshot.ash_allowed", "dlp.DataLeakPreventionRulesListScreenshot.ash_blocked", + + # https://crbug.com/1364721 + "inputs.InputMethodShelfInputs.lacros", + "inputs.VirtualKeyboardTypingIME", + "inputs.VirtualKeyboardHandwriting.floating", + "inputs.VirtualKeyboardLoginScreen.tablet", + "inputs.VirtualKeyboardTypingUserMode.incognito", ] # To create filters to be used on specific builders add them like this:
diff --git a/components/autofill/core/browser/address_profile_save_manager_unittest.cc b/components/autofill/core/browser/address_profile_save_manager_unittest.cc index a416d462..fe4d286 100644 --- a/components/autofill/core/browser/address_profile_save_manager_unittest.cc +++ b/components/autofill/core/browser/address_profile_save_manager_unittest.cc
@@ -191,10 +191,8 @@ .did_remove_invalid_phone_number = std::get<2>(GetParam())}; // Enable both explicit save prompts and structured names. // The latter is needed to test the concept of silent updates. - scoped_feature_list_.InitWithFeatures( - {features::kAutofillAddressProfileSavePrompt, - features::kAutofillEnableSupportForMoreStructureInNames}, - {}); + scoped_feature_list_.InitAndEnableFeature( + features::kAutofillAddressProfileSavePrompt); } void BlockProfileForUpdates(const std::string& guid) {
diff --git a/components/autofill/core/browser/autocomplete_history_manager.cc b/components/autofill/core/browser/autocomplete_history_manager.cc index bc4b7ec..2001ad46 100644 --- a/components/autofill/core/browser/autocomplete_history_manager.cc +++ b/components/autofill/core/browser/autocomplete_history_manager.cc
@@ -96,7 +96,7 @@ IsInAutofillSuggestionsDisabledExperiment()) { SendSuggestions({}, QueryHandler(query_id, autoselect_first_suggestion, field.value, handler)); - uma_recorder_.OnGetAutocompleteSuggestions(field.name, + uma_recorder_.OnGetAutocompleteSuggestions(field.global_id(), 0 /* pending_query_handle */); return true; } @@ -104,7 +104,7 @@ if (profile_database_) { auto query_handle = profile_database_->GetFormValuesForElementName( field.name, field.value, kMaxAutocompleteMenuItems, this); - uma_recorder_.OnGetAutocompleteSuggestions(field.name, query_handle); + uma_recorder_.OnGetAutocompleteSuggestions(field.global_id(), query_handle); // We can simply insert, since |query_handle| is always unique. pending_queries_.insert( @@ -236,21 +236,21 @@ } void AutocompleteHistoryManager::UMARecorder::OnGetAutocompleteSuggestions( - const std::u16string& name, + const FieldGlobalId& field_global_id, WebDataServiceBase::Handle pending_query_handle) { - // log only if the current field is different than the latest one that has - // been logged. we assume that user works at the same field if - // measuring_name_ is same as the name of current field. - bool should_log_query = measuring_name_ != name; + // Log only if the current field is different than the latest one that has + // been logged. We determine this by comparing the global ID of the current + // field against `measuring_field_global_id_`. + bool should_log_query = measuring_field_global_id_ != field_global_id; if (should_log_query) { AutofillMetrics::LogAutocompleteQuery(pending_query_handle /* created */); - measuring_name_ = name; + measuring_field_global_id_ = field_global_id; } // We should track the query and log the suggestions, only if - // - query has been logged. - // - or, the query we previously tracked has been cancelled - // The previous query must be cancelled if measuring_query_handle_ isn't + // - query has been logged, or + // - the query we previously tracked has been cancelled + // The previous query must be cancelled if `measuring_query_handle_` isn't // reset. if (should_log_query || measuring_query_handle_) measuring_query_handle_ = pending_query_handle;
diff --git a/components/autofill/core/browser/autocomplete_history_manager.h b/components/autofill/core/browser/autocomplete_history_manager.h index b8fceb4..2c189ae 100644 --- a/components/autofill/core/browser/autocomplete_history_manager.h +++ b/components/autofill/core/browser/autocomplete_history_manager.h
@@ -18,6 +18,7 @@ #include "components/autofill/core/browser/webdata/autofill_entry.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/autofill/core/common/form_data.h" +#include "components/autofill/core/common/unique_ids.h" #include "components/keyed_service/core/keyed_service.h" #include "components/prefs/pref_member.h" #include "components/prefs/pref_service.h" @@ -95,7 +96,7 @@ ~UMARecorder() = default; void OnGetAutocompleteSuggestions( - const std::u16string& name, + const FieldGlobalId& global_id, WebDataServiceBase::Handle pending_query_handle); void OnWebDataServiceRequestDone( WebDataServiceBase::Handle pending_query_handle, @@ -105,9 +106,10 @@ // The query handle should be measured for UMA. WebDataServiceBase::Handle measuring_query_handle_ = 0; - // The name of field that is currently measured, we don't repeatedly measure - // the query of the same field while user is filling the field. - std::u16string measuring_name_; + // The global id of the field that is currently being measured, saved so + // that we don't repeatedly measure the query of the same field while the + // user is filling the field. + FieldGlobalId measuring_field_global_id_; }; // Sends the autocomplete |suggestions| to the |query_handler|'s handler for
diff --git a/components/autofill/core/browser/autocomplete_history_manager_unittest.cc b/components/autofill/core/browser/autocomplete_history_manager_unittest.cc index f00c2b9..c8cea8b 100644 --- a/components/autofill/core/browser/autocomplete_history_manager_unittest.cc +++ b/components/autofill/core/browser/autocomplete_history_manager_unittest.cc
@@ -1049,8 +1049,8 @@ mocked_db_query_id_one, std::move(mocked_results_one)); } -// // Verify that no autocomplete suggestion is returned for textarea and UMA is -// // logged correctly. +// Verify that no autocomplete suggestion is returned for textarea and UMA is +// logged correctly. TEST_F(AutocompleteHistoryManagerTest, NoAutocompleteSuggestionsForTextarea) { FormData form; form.name = u"MyForm"; @@ -1076,8 +1076,8 @@ histogram_tester.ExpectBucketCount("Autofill.AutocompleteQuery", 1, 0); } -// // Verify that autocomplete suggestion is returned and suggestions is logged -// // correctly. +// Verify that autocomplete suggestion is returned and suggestions is logged +// correctly. TEST_F(AutocompleteHistoryManagerTest, AutocompleteUMAQueryCreated) { auto suggestions_handler = std::make_unique<MockSuggestionsHandler>(); FormFieldData field; @@ -1089,7 +1089,8 @@ EXPECT_CALL(*web_data_service_, GetFormValuesForElementName(field.name, field.value, _, autocomplete_manager_.get())) - .WillOnce(Return(mock_handle)); + .Times(2) + .WillRepeatedly(Return(mock_handle)); // Verify that the query has been created. base::HistogramTester histogram_tester; @@ -1109,12 +1110,20 @@ AUTOFILL_VALUE_RESULT, std::vector<AutofillEntry>()); autocomplete_manager_->OnWebDataServiceRequestDone(mock_handle, std::move(result)); - histogram_tester.ExpectBucketCount("Autofill.AutocompleteSuggestions", 0, 1); histogram_tester.ExpectBucketCount("Autofill.AutocompleteSuggestions", 1, 0); + // Verify that querying autocomplete suggestions twice for the same field does + // not log the corresponding metrics twice. + EXPECT_TRUE(autocomplete_manager_->OnGetSingleFieldSuggestions( + 0, /*is_autocomplete_enabled=*/true, + /*autoselect_first_suggestion=*/false, field, + suggestions_handler->GetWeakPtr(), SuggestionsContext())); + histogram_tester.ExpectBucketCount("Autofill.AutocompleteQuery", 1, 1); + histogram_tester.ExpectBucketCount("Autofill.AutocompleteQuery", 0, 0); + // Changed the returned handle - // Changed field's name to trigger UMA again. + // Created a new field, which will have a new global id to trigger UMA again. mock_handle = 2; test::CreateTestFormField("Address", "address1", "", "text", &field);
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index e3206553..794baaec 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -253,7 +253,10 @@ class AutofillManagerTest : public testing::Test { public: - AutofillManagerTest() = default; + AutofillManagerTest() { + scoped_feature_list_async_parse_form_.InitWithFeatureState( + features::kAutofillParseAsync, true); + } void SetUp() override { client_.SetPrefs(test::PrefServiceForTesting()); @@ -267,7 +270,7 @@ } protected: - base::test::ScopedFeatureList scoped_feature_list_; + base::test::ScopedFeatureList scoped_feature_list_async_parse_form_; base::test::TaskEnvironment task_environment_; test::AutofillEnvironment autofill_environment_; NiceMock<MockAutofillClient> client_;
diff --git a/components/autofill/core/browser/autofill_profile_import_process_unittest.cc b/components/autofill/core/browser/autofill_profile_import_process_unittest.cc index 32598f0..32458b97 100644 --- a/components/autofill/core/browser/autofill_profile_import_process_unittest.cc +++ b/components/autofill/core/browser/autofill_profile_import_process_unittest.cc
@@ -446,11 +446,6 @@ TEST_F(AutofillProfileImportProcessTest, SilentlyUpdateProfile) { TestAutofillClock test_clock; - // Silent updates need structured names to be enabled. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AutofillProfile observed_profile = test::StandardProfile(); // The profile should be updateable with the observed profile. AutofillProfile updateable_profile = test::UpdateableStandardProfile(); @@ -499,11 +494,6 @@ // existing profile while another already existing profile can be silently // updated. In this test, the users accepts the merge. TEST_F(AutofillProfileImportProcessTest, BothMergeAndSilentUpdate_Accepted) { - // Silent updates need structured names to be enabled. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AutofillProfile observed_profile = test::StandardProfile(); // The profile should be updateable with the observed profile. AutofillProfile updateable_profile = test::UpdateableStandardProfile(); @@ -547,11 +537,6 @@ // existing profile while another already existing profile can be silently // updated. In this test, the users declines the merge. TEST_F(AutofillProfileImportProcessTest, BothMergeAndSilentUpdate_Rejected) { - // Silent updates need structured names to be enabled. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AutofillProfile observed_profile = test::StandardProfile(); // The profile should be updateable with the observed profile. AutofillProfile updateable_profile = test::UpdateableStandardProfile(); @@ -595,11 +580,6 @@ // existing profile for which updates are blocked while another already existing // profile can be silently updated. TEST_F(AutofillProfileImportProcessTest, BlockedMergeAndSilentUpdate) { - // Silent updates need structured names to be enabled. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AutofillProfile observed_profile = test::StandardProfile(); // The profile should be updateable with the observed profile. AutofillProfile updateable_profile = test::UpdateableStandardProfile(); @@ -644,11 +624,6 @@ // Tests the scenario in which an observed profile can be merged with an // existing profile for which updates are blocked. TEST_F(AutofillProfileImportProcessTest, BlockedMerge) { - // Silent updates need structured names to be enabled. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AutofillProfile observed_profile = test::StandardProfile(); // This profile should be mergeable with the observed profile. AutofillProfile mergeable_profile = test::SubsetOfStandardProfile(); @@ -688,11 +663,6 @@ SilentlyUpdateProfile_WithIncompleteProfile) { TestAutofillClock test_clock; - // Silent updates need structured names to be enabled. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AutofillProfile observed_profile = test::StandardProfile(); // The profile should be updateable with the observed profile. AutofillProfile updateable_profile = test::UpdateableStandardProfile(); @@ -742,11 +712,6 @@ TEST_F(AutofillProfileImportProcessTest, SilentlyUpdateProfile_WithNewProfile) { TestAutofillClock test_clock; - // Silent updates need structured names to be enabled. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AutofillProfile observed_profile = test::StandardProfile(); std::vector<AutofillProfile> existing_profiles = {}; @@ -778,11 +743,6 @@ // updated since the import process allows for silent update only TEST_F(AutofillProfileImportProcessTest, SilentlyUpdateProfile_NoMergeOnlySilentUpdate) { - // Silent updates need structured names to be enabled. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AutofillProfile observed_profile = test::StandardProfile(); // The profile should be updateable with the observed profile. AutofillProfile updateable_profile = test::UpdateableStandardProfile();
diff --git a/components/autofill/core/browser/autofill_profile_sync_util_unittest.cc b/components/autofill/core/browser/autofill_profile_sync_util_unittest.cc index 9b699eeb..8afa9ab5 100644 --- a/components/autofill/core/browser/autofill_profile_sync_util_unittest.cc +++ b/components/autofill/core/browser/autofill_profile_sync_util_unittest.cc
@@ -284,16 +284,13 @@ // the server. TEST_F(AutofillProfileSyncUtilTest, CreateEntityDataFromAutofillProfile) { base::test::ScopedFeatureList structured_names_feature; - // With those four features enabled, the AutofillProfile supports all tokens - // and statuses assignable in the specifics. If one of those features is + // With this feature enabled, the AutofillProfile supports all tokens + // and statuses assignable in the specifics. If this feature is // disabled, for some tokens // AutofillProfile::GetRawInfo(AutofillProfile::SetRawInfo()) is not the // identify function. The same is true for the verification status. - structured_names_feature.InitWithFeatures( - {features::kAutofillEnableSupportForMoreStructureInAddresses, - features::kAutofillEnableSupportForMoreStructureInNames, - features::kAutofillEnableSupportForHonorificPrefixes}, - {}); + structured_names_feature.InitAndEnableFeature( + features::kAutofillEnableSupportForHonorificPrefixes); AutofillProfile profile = ConstructCompleteProfile(); AutofillProfileSpecifics specifics = ConstructCompleteSpecifics(); @@ -309,17 +306,6 @@ // Test that fields not set for the input are empty in the output. TEST_F(AutofillProfileSyncUtilTest, CreateEntityDataFromAutofillProfile_Empty) { - base::test::ScopedFeatureList structured_names_feature; - // With those two features enabled, the AutofillProfile supports all tokens - // and statuses assignable in the specifics. If one of those features is - // disabled, for some tokens - // AutofillProfile::GetRawInfo(AutofillProfile::SetRawInfo()) is not the - // identify function. The same is true for the verification status. - structured_names_feature.InitWithFeatures( - {features::kAutofillEnableSupportForMoreStructureInAddresses, - features::kAutofillEnableSupportForMoreStructureInNames}, - {}); - AutofillProfile profile(kGuid, std::string()); ASSERT_FALSE(profile.HasRawInfo(NAME_FULL)); ASSERT_FALSE(profile.HasRawInfo(COMPANY_NAME));
diff --git a/components/autofill/core/browser/autofill_suggestion_generator_unittest.cc b/components/autofill/core/browser/autofill_suggestion_generator_unittest.cc index f2151adb..14f8c86 100644 --- a/components/autofill/core/browser/autofill_suggestion_generator_unittest.cc +++ b/components/autofill/core/browser/autofill_suggestion_generator_unittest.cc
@@ -22,6 +22,7 @@ #include "components/autofill/core/browser/ui/suggestion.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/autofill/core/common/autofill_clock.h" +#include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/autofill_payments_features.h" #include "components/strings/grit/components_strings.h" #include "testing/gtest/include/gtest/gtest.h" @@ -36,7 +37,10 @@ // browser_autofill_manager_unittest.cc. class AutofillSuggestionGeneratorTest : public testing::Test { public: - AutofillSuggestionGeneratorTest() = default; + AutofillSuggestionGeneratorTest() { + scoped_feature_list_async_parse_form_.InitWithFeatureState( + features::kAutofillParseAsync, true); + } void SetUp() override { autofill_client_.SetPrefs(test::PrefServiceForTesting()); @@ -59,10 +63,8 @@ TestPersonalDataManager* personal_data() { return &personal_data_; } - protected: - base::test::ScopedFeatureList scoped_feature_list_; - private: + base::test::ScopedFeatureList scoped_feature_list_async_parse_form_; base::test::TaskEnvironment task_environment_{ base::test::TaskEnvironment::TimeSource::SYSTEM_TIME}; test::AutofillEnvironment autofill_environment_; @@ -352,7 +354,8 @@ // popup. TEST_F(AutofillSuggestionGeneratorTest, CreateCreditCardSuggestion_PopupWithMetadata_VirtualCardNameField) { - scoped_feature_list_.InitAndEnableFeature( + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature( features::kAutofillEnableVirtualCardMetadata); // Create a server card. @@ -406,7 +409,8 @@ // Autofill popup. TEST_F(AutofillSuggestionGeneratorTest, CreateCreditCardSuggestion_PopupWithMetadata_VirtualCardNumberField) { - scoped_feature_list_.InitAndEnableFeature( + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature( features::kAutofillEnableVirtualCardMetadata); // Create a server card. @@ -441,7 +445,8 @@ // Autofill popup. TEST_F(AutofillSuggestionGeneratorTest, CreateCreditCardSuggestion_PopupWithMetadata_NonVirtualCardNameField) { - scoped_feature_list_.InitAndEnableFeature( + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature( features::kAutofillEnableVirtualCardMetadata); // Create a server card. @@ -494,7 +499,8 @@ // Autofill popup. TEST_F(AutofillSuggestionGeneratorTest, CreateCreditCardSuggestion_PopupWithMetadata_NonVirtualCardNumberField) { - scoped_feature_list_.InitAndEnableFeature( + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature( features::kAutofillEnableVirtualCardMetadata); // Create a server card.
diff --git a/components/autofill/core/browser/browser_autofill_manager_unittest.cc b/components/autofill/core/browser/browser_autofill_manager_unittest.cc index cc47030..59c1ee5 100644 --- a/components/autofill/core/browser/browser_autofill_manager_unittest.cc +++ b/components/autofill/core/browser/browser_autofill_manager_unittest.cc
@@ -387,7 +387,10 @@ class BrowserAutofillManagerTest : public testing::Test { public: - BrowserAutofillManagerTest() = default; + BrowserAutofillManagerTest() { + scoped_feature_list_async_parse_form_.InitWithFeatureState( + features::kAutofillParseAsync, true); + } void SetUp() override { autofill_client_.SetPrefs(test::PrefServiceForTesting()); @@ -818,7 +821,6 @@ std::unique_ptr<MockIBANManager> iban_manager_; std::unique_ptr<MockMerchantPromoCodeManager> merchant_promo_code_manager_; raw_ptr<MockSingleFieldFormFillRouter> single_field_form_fill_router_; - base::test::ScopedFeatureList scoped_feature_list_; raw_ptr<TestStrikeDatabase> strike_database_; raw_ptr<payments::TestPaymentsClient> payments_client_; raw_ptr<TestFormDataImporter> test_form_data_importer_; @@ -880,6 +882,9 @@ credit_card3.set_guid("00000000-0000-0000-0000-000000000006"); personal_data().AddCreditCard(credit_card3); } + + private: + base::test::ScopedFeatureList scoped_feature_list_async_parse_form_; }; class SuggestionMatchingTest @@ -2659,7 +2664,8 @@ TEST_F(BrowserAutofillManagerTest, ShouldNotShowCreditCardsSuggestionsIfCreditCardAutofillDisabled) { - DisableAutofillViaAblation(scoped_feature_list_, /*for_addresses=*/false, + base::test::ScopedFeatureList scoped_feature_list; + DisableAutofillViaAblation(scoped_feature_list, /*for_addresses=*/false, /*for_credit_cards=*/true); // Set up our form data. @@ -2677,7 +2683,8 @@ TEST_F(BrowserAutofillManagerTest, ShouldNotShowAddressSuggestionsIfAddressAutofillDisabled) { - DisableAutofillViaAblation(scoped_feature_list_, /*for_addresses=*/true, + base::test::ScopedFeatureList scoped_feature_list; + DisableAutofillViaAblation(scoped_feature_list, /*for_addresses=*/true, /*for_credit_cards=*/false); // Set up our form data. @@ -2764,7 +2771,8 @@ personal_data().ClearAllLocalData(); } - DisableAutofillViaAblation(scoped_feature_list_, /*for_addresses=*/true, + base::test::ScopedFeatureList scoped_feature_list; + DisableAutofillViaAblation(scoped_feature_list, /*for_addresses=*/true, /*for_credit_cards=*/true); TestAutofillTickClock clock(AutofillTickClock::NowTicks()); base::HistogramTester histogram_tester; @@ -9490,6 +9498,9 @@ "Expires on 04/99", kVisaCard, browser_autofill_manager_->GetPackedCreditCardID(7))); } + + private: + base::test::ScopedFeatureList scoped_feature_list_; }; // Ensures the "Use a virtual card number" option should not be shown when @@ -9745,7 +9756,6 @@ } bool has_active_screen_reader_; - base::test::ScopedFeatureList scoped_feature_list_; }; TEST_P(OnFocusOnFormFieldTest, AddressSuggestions) { @@ -9800,7 +9810,8 @@ } TEST_P(OnFocusOnFormFieldTest, AddressSuggestions_Ablation) { - DisableAutofillViaAblation(scoped_feature_list_, /*for_addresses=*/true, + base::test::ScopedFeatureList scoped_feature_list; + DisableAutofillViaAblation(scoped_feature_list, /*for_addresses=*/true, /*for_credit_cards=*/false); // Set up our form data. @@ -9847,7 +9858,8 @@ } TEST_P(OnFocusOnFormFieldTest, CreditCardSuggestions_Ablation) { - DisableAutofillViaAblation(scoped_feature_list_, /*for_addresses=*/false, + base::test::ScopedFeatureList scoped_feature_list; + DisableAutofillViaAblation(scoped_feature_list, /*for_addresses=*/false, /*for_credit_cards=*/true); // Set up our form data. @@ -10042,7 +10054,8 @@ TEST_P(BrowserAutofillManagerRefillTest, RefillModifiedCreditCardExpirationDates) { RefillTestCase test_case = GetParam(); - scoped_feature_list_.InitAndEnableFeature( + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature( features::kAutofillRefillModifiedCreditCardExpirationDates); // Set up a CC form with name, cc number and expiration date.
diff --git a/components/autofill/core/browser/data_model/address_unittest.cc b/components/autofill/core/browser/data_model/address_unittest.cc index 9f944d5..6432783e 100644 --- a/components/autofill/core/browser/data_model/address_unittest.cc +++ b/components/autofill/core/browser/data_model/address_unittest.cc
@@ -20,34 +20,14 @@ namespace autofill { -class AddressTest : public testing::Test, - public testing::WithParamInterface<bool> { +class AddressTest : public testing::Test { public: AddressTest() { CountryNames::SetLocaleString("en-US"); } - - bool StructuredAddresses() const { return structured_addresses_enabled_; } - - private: - void SetUp() override { InitializeFeatures(); } - - void InitializeFeatures() { - structured_addresses_enabled_ = GetParam(); - if (structured_addresses_enabled_) { - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - } else { - scoped_feature_list_.InitAndDisableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - } - } - - bool structured_addresses_enabled_; - base::test::ScopedFeatureList scoped_feature_list_; }; // Test that country data can be properly returned as either a country code or a // localized country name. -TEST_P(AddressTest, GetCountry) { +TEST_F(AddressTest, GetCountry) { Address address; EXPECT_EQ(std::u16string(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); @@ -79,7 +59,7 @@ // Test that country data can be properly returned as either a country code or a // full country name that can even be localized. -TEST_P(AddressTest, SetHtmlCountryCodeTypeWithFullCountryName) { +TEST_F(AddressTest, SetHtmlCountryCodeTypeWithFullCountryName) { Address address; EXPECT_EQ(std::u16string(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); @@ -127,7 +107,7 @@ } // Test that we properly detect country codes appropriate for each country. -TEST_P(AddressTest, SetCountry) { +TEST_F(AddressTest, SetCountry) { Address address; EXPECT_EQ(std::u16string(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); @@ -186,7 +166,7 @@ } // Test setting and getting the new structured address tokens -TEST_P(AddressTest, StructuredAddressTokens) { +TEST_F(AddressTest, StructuredAddressTokens) { Address address; // Set the address tokens. @@ -207,7 +187,7 @@ } // Test that we properly match typed values to stored country data. -TEST_P(AddressTest, IsCountry) { +TEST_F(AddressTest, IsCountry) { Address address; address.SetRawInfo(ADDRESS_HOME_COUNTRY, u"US"); @@ -238,7 +218,7 @@ } // Verifies that Address::GetInfo() correctly combines address lines. -TEST_P(AddressTest, GetStreetAddress) { +TEST_F(AddressTest, GetStreetAddress) { const AutofillType type = AutofillType(ADDRESS_HOME_STREET_ADDRESS); // Address has no address lines. @@ -301,7 +281,7 @@ // Verifies that overwriting an address with N lines with one that has fewer // than N lines does not result in an address with blank lines at the end. -TEST_P(AddressTest, GetStreetAddressAfterOverwritingLongAddressWithShorterOne) { +TEST_F(AddressTest, GetStreetAddressAfterOverwritingLongAddressWithShorterOne) { // Start with an address that has two lines. Address address; address.SetRawInfo(ADDRESS_HOME_LINE1, u"123 Example Ave."); @@ -318,7 +298,7 @@ } // Verifies that Address::SetRawInfo() is able to split address lines correctly. -TEST_P(AddressTest, SetRawStreetAddress) { +TEST_F(AddressTest, SetRawStreetAddress) { const std::u16string empty_street_address; const std::u16string short_street_address = u"456 Nowhere Ln."; const std::u16string long_street_address = @@ -349,7 +329,7 @@ } // Street addresses should be set properly. -TEST_P(AddressTest, SetStreetAddress) { +TEST_F(AddressTest, SetStreetAddress) { const std::u16string empty_street_address; const std::u16string multi_line_street_address = u"789 Fancy Pkwy.\n" @@ -393,7 +373,7 @@ // Verifies that Address::SetInfio() rejects setting data for // ADDRESS_HOME_STREET_ADDRESS if the data has any interior blank lines. -TEST_P(AddressTest, SetStreetAddressRejectsAddressesWithInteriorBlankLines) { +TEST_F(AddressTest, SetStreetAddressRejectsAddressesWithInteriorBlankLines) { // Start with a non-empty address. Address address; address.SetRawInfo(ADDRESS_HOME_LINE1, u"123 Example Ave."); @@ -416,7 +396,7 @@ // Verifies that Address::SetInfio() rejects setting data for // ADDRESS_HOME_STREET_ADDRESS if the data has any leading blank lines. -TEST_P(AddressTest, SetStreetAddressRejectsAddressesWithLeadingBlankLines) { +TEST_F(AddressTest, SetStreetAddressRejectsAddressesWithLeadingBlankLines) { // Start with a non-empty address. Address address; address.SetRawInfo(ADDRESS_HOME_LINE1, u"123 Example Ave."); @@ -439,7 +419,7 @@ // Verifies that Address::SetInfio() rejects setting data for // ADDRESS_HOME_STREET_ADDRESS if the data has any trailing blank lines. -TEST_P(AddressTest, SetStreetAddressRejectsAddressesWithTrailingBlankLines) { +TEST_F(AddressTest, SetStreetAddressRejectsAddressesWithTrailingBlankLines) { // Start with a non-empty address. Address address; address.SetRawInfo(ADDRESS_HOME_LINE1, u"123 Example Ave."); @@ -462,11 +442,7 @@ // Verifies that the merging-related methods for structured addresses are // implemented correctly. This is not a test of the merging logic itself. -TEST_P(AddressTest, TestMergeStructuredAddresses) { - // This test is only applicable for structured addresses. - if (!StructuredAddresses()) - return; - +TEST_F(AddressTest, TestMergeStructuredAddresses) { Address address1; Address address2; @@ -501,11 +477,7 @@ // Tests that if only one of the structured addresses in a merge operation has // country information, it is used as their common country during comparison and // for rewriting rules. -TEST_P(AddressTest, TestMergeStructuredAddressesMissingCountry) { - // This test is only applicable for structured addresses. - if (!StructuredAddresses()) - return; - +TEST_F(AddressTest, TestMergeStructuredAddressesMissingCountry) { Address address1; Address address2; @@ -528,11 +500,7 @@ } // Tests the retrieval of the structured address. -TEST_P(AddressTest, TestGettingTheStructuredAddress) { - // This test is only applicable for structured addresses. - if (!StructuredAddresses()) - return; - +TEST_F(AddressTest, TestGettingTheStructuredAddress) { // Create the address and set a test value. Address address1; address1.SetRawInfo(ADDRESS_HOME_ZIP, u"12345"); @@ -545,11 +513,7 @@ // For structured address, test that the structured information is wiped // correctly when the unstructured street address changes. -TEST_P(AddressTest, ResetStructuredTokens) { - // This test is only applicable for structured addresses. - if (!StructuredAddresses()) - return; - +TEST_F(AddressTest, ResetStructuredTokens) { Address address; // Set a structured address line and call the finalization routine. address.SetRawInfoWithVerificationStatus( @@ -602,10 +566,4 @@ structured_address::VerificationStatus::kNoStatus); } -// Runs the suite with the feature -// |kAutofillSupportForStructuredStructuredNames| enabled and disabled. -// TODO(crbug.com/1130194): Remove parameterized test once structured addresses -// are fully launched. -INSTANTIATE_TEST_SUITE_P(, AddressTest, testing::Bool()); - } // namespace autofill
diff --git a/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc b/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc index 6369ab3..1cc7828 100644 --- a/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc +++ b/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc
@@ -64,9 +64,7 @@ const char kLocale[] = "en-US"; -class AutofillProfileComparatorTest - : public testing::Test, - public testing::WithParamInterface<std::tuple<bool, bool>> { +class AutofillProfileComparatorTest : public testing::Test { public: // Expose the protected methods of autofill::AutofillProfileComparator for // testing. @@ -309,8 +307,7 @@ EXPECT_EQ(expected.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), kLocale), actual.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), kLocale)); - if (check_structured_address_tokens && - autofill::structured_address::StructuredAddressesEnabled()) { + if (check_structured_address_tokens) { EXPECT_EQ(expected.GetInfo( AutofillType(autofill::ADDRESS_HOME_STREET_NAME), kLocale), actual.GetInfo(AutofillType(autofill::ADDRESS_HOME_STREET_NAME), @@ -339,56 +336,18 @@ } AutofillProfileComparator comparator_{kLocale}; - - protected: - void SetUp() override { InitializeFeatures(); } - - void InitializeFeatures() { - structured_names_enabled_ = std::get<0>(GetParam()); - structured_addresses_enabled_ = std::get<1>(GetParam()); - - std::vector<base::Feature> enabled_features; - std::vector<base::Feature> disabled_features; - - if (structured_names_enabled_) { - enabled_features.push_back( - autofill::features::kAutofillEnableSupportForMoreStructureInNames); - } else { - disabled_features.push_back( - autofill::features::kAutofillEnableSupportForMoreStructureInNames); - } - - if (structured_addresses_enabled_) { - enabled_features.push_back( - autofill::features:: - kAutofillEnableSupportForMoreStructureInAddresses); - } else { - disabled_features.push_back( - autofill::features:: - kAutofillEnableSupportForMoreStructureInAddresses); - } - - scoped_features_.InitWithFeatures(enabled_features, disabled_features); - } - - bool StructuredAddresses() const { return structured_addresses_enabled_; } - bool StructuredNames() const { return structured_names_enabled_; } - - bool structured_names_enabled_; - bool structured_addresses_enabled_; - base::test::ScopedFeatureList scoped_features_; }; } // namespace -TEST_P(AutofillProfileComparatorTest, UniqueTokens) { +TEST_F(AutofillProfileComparatorTest, UniqueTokens) { std::u16string kInput = u"a b a a b"; std::vector<std::u16string> tokens = {u"a", u"b"}; EXPECT_EQ(std::set<base::StringPiece16>(tokens.begin(), tokens.end()), comparator_.UniqueTokens(kInput)); } -TEST_P(AutofillProfileComparatorTest, CompareTokens) { +TEST_F(AutofillProfileComparatorTest, CompareTokens) { std::u16string kEmptyStr = u""; std::u16string kHello = u"hello"; std::u16string kHelloThere = u"hello there"; @@ -411,7 +370,7 @@ comparator_.CompareTokens(kHelloThereBob, kHelloThereAlice)); } -TEST_P(AutofillProfileComparatorTest, Compare) { +TEST_F(AutofillProfileComparatorTest, Compare) { // Checks the empty case. EXPECT_TRUE( comparator_.Compare(std::u16string(), std::u16string(), @@ -481,7 +440,7 @@ AutofillProfileComparator::DISCARD_WHITESPACE)); } -TEST_P(AutofillProfileComparatorTest, NormalizeForComparison) { +TEST_F(AutofillProfileComparatorTest, NormalizeForComparison) { EXPECT_EQ(u"timothe", comparator_.NormalizeForComparison(u"Timothé")); EXPECT_EQ(u"sven ake", comparator_.NormalizeForComparison(u" sven-åke ")); EXPECT_EQ(u"c 㸐", comparator_.NormalizeForComparison(u"Ç 㸐")); @@ -521,7 +480,7 @@ AutofillProfileComparator::DISCARD_WHITESPACE)); } -TEST_P(AutofillProfileComparatorTest, GetNamePartVariants) { +TEST_F(AutofillProfileComparatorTest, GetNamePartVariants) { std::set<std::u16string> expected_variants = { u"timothe noel", u"timothe n", u"timothe", u"t noel", u"t n", u"t", u"noel", u"n", u"", u"tn", @@ -531,7 +490,7 @@ comparator_.GetNamePartVariants(u"timothe noel")); } -TEST_P(AutofillProfileComparatorTest, IsNameVariantOf) { +TEST_F(AutofillProfileComparatorTest, IsNameVariantOf) { const std::u16string kNormalizedFullName = u"timothe noel etienne perier"; EXPECT_TRUE( @@ -551,7 +510,7 @@ comparator_.IsNameVariantOf(kNormalizedFullName, u"etienne noel perier")); } -TEST_P(AutofillProfileComparatorTest, HaveMergeableNames) { +TEST_F(AutofillProfileComparatorTest, HaveMergeableNames) { AutofillProfile empty = CreateProfileWithName("", "", ""); AutofillProfile p1 = CreateProfileWithName("sven-åke", "", "larsson"); @@ -617,7 +576,7 @@ EXPECT_FALSE(comparator_.HaveMergeableNames(different, initials)); } -TEST_P(AutofillProfileComparatorTest, HaveMergeableEmailAddresses) { +TEST_F(AutofillProfileComparatorTest, HaveMergeableEmailAddresses) { AutofillProfile empty = CreateProfileWithEmail(""); AutofillProfile p1 = CreateProfileWithEmail("FOO@BAR.COM"); AutofillProfile p2 = CreateProfileWithEmail("foo@bar.com"); @@ -632,7 +591,7 @@ EXPECT_FALSE(comparator_.HaveMergeableEmailAddresses(different, p1)); } -TEST_P(AutofillProfileComparatorTest, HaveMergeableCompanyNames) { +TEST_F(AutofillProfileComparatorTest, HaveMergeableCompanyNames) { AutofillProfile empty = CreateProfileWithCompanyName(""); AutofillProfile p1 = CreateProfileWithCompanyName("Nestlé S.A."); AutofillProfile p2 = CreateProfileWithCompanyName("Nestle"); @@ -647,7 +606,7 @@ EXPECT_FALSE(comparator_.HaveMergeableCompanyNames(different, p1)); } -TEST_P(AutofillProfileComparatorTest, HaveMergeablePhoneNumbers) { +TEST_F(AutofillProfileComparatorTest, HaveMergeablePhoneNumbers) { AutofillProfile empty = CreateProfileWithPhoneNumber(""); AutofillProfile p1 = CreateProfileWithPhoneNumber("+1 (800) 670-8700"); AutofillProfile p2 = CreateProfileWithPhoneNumber("6708700"); @@ -666,7 +625,7 @@ EXPECT_FALSE(comparator_.HaveMergeablePhoneNumbers(different, p1)); } -TEST_P(AutofillProfileComparatorTest, HaveMergeableAddresses) { +TEST_F(AutofillProfileComparatorTest, HaveMergeableAddresses) { // TODO(rogerm): Replace some of the tokens to also test the address // normalization string replacement rules. For example: // - State/Province abbreviations @@ -722,7 +681,7 @@ EXPECT_FALSE(comparator_.HaveMergeableAddresses(p1, differentSortingCode)); } -TEST_P(AutofillProfileComparatorTest, HaveMergeableBirthdates) { +TEST_F(AutofillProfileComparatorTest, HaveMergeableBirthdates) { // Birthdates are mergeable if the components are either equal or one of them // is empty. AutofillProfile p1 = CreateProfileWithBirthdate("14", "", "1997"); @@ -742,7 +701,7 @@ EXPECT_TRUE(comparator_.HaveMergeableBirthdates(p3, p3)); } -TEST_P(AutofillProfileComparatorTest, AreMergeable) { +TEST_F(AutofillProfileComparatorTest, AreMergeable) { AutofillProfile p(base::GenerateGUID(), "https://www.example.com/"); autofill::test::SetProfileInfo(&p, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", @@ -784,11 +743,7 @@ EXPECT_FALSE(comparator_.AreMergeable(p, not_mergeable_by_phone_number)); } -TEST_P(AutofillProfileComparatorTest, MergeStructuredNames_WithPermutation) { - // This test is only applicable to structured names. - if (!StructuredNames()) - return; - +TEST_F(AutofillProfileComparatorTest, MergeNames_WithPermutation) { // The first name has an observed structure. NameInfo name1; name1.SetRawInfoWithVerificationStatus( @@ -834,7 +789,7 @@ autofill::structured_address::VerificationStatus::kObserved); } -TEST_P(AutofillProfileComparatorTest, MergeNames) { +TEST_F(AutofillProfileComparatorTest, MergeNames) { NameInfo name1; name1.SetRawInfo(NAME_FULL, u"John Quincy Public"); name1.SetRawInfo(NAME_FIRST, u"John"); @@ -911,7 +866,7 @@ MergeNamesAndExpect(p5, p5, synthesized); // We flesh out missing data. } -TEST_P(AutofillProfileComparatorTest, MergeCJKNames) { +TEST_F(AutofillProfileComparatorTest, MergeCJKNames) { // Korean names that are all mergeable, but constructed differently. NameInfo name1 = CreateNameInfo(u"호", u"", u"이영", u"이영 호"); NameInfo name2 = CreateNameInfo(u"이영호", u"", u"", u"이영호"); @@ -946,19 +901,6 @@ MergeNamesAndExpect(p1, p4, CreateNameInfo(u"호", u"", u"이영", u"이영 호")); MergeNamesAndExpect(p1, p5, CreateNameInfo(u"호", u"", u"이영", u"이영 호")); - // The following tests are not applicable to the logic of the new structured - // name. Because we consider not having a surname a valid option for the user. - // If a user encounters this scenario, they must correct us and we will - // learn from the most recent profile. - if (!base::FeatureList::IsEnabled( - autofill::features::kAutofillEnableSupportForMoreStructureInNames)) { - // |p2| is more recent than |p3|, |p4|, and |p5|. However, it does not - // have a surname entry (it was probably parsed with the old logic), so - // the other profiles are used as the source for given/surname. - MergeNamesAndExpect(p2, p3, CreateNameInfo(u"영호", u"", u"이", u"이영호")); - MergeNamesAndExpect(p2, p4, CreateNameInfo(u"영호", u"", u"이", u"이영호")); - MergeNamesAndExpect(p2, p5, CreateNameInfo(u"영호", u"", u"이", u"이영호")); - } // |p3| is more recent than |p4| and |p5|. MergeNamesAndExpect(p3, p4, CreateNameInfo(u"영호", u"", u"이", u"이영호")); MergeNamesAndExpect(p3, p5, CreateNameInfo(u"영호", u"", u"이", u"이영호")); @@ -972,7 +914,7 @@ CreateNameInfo(u"ビル", u"", u"ゲイツ", u"ゲイツ・ビル")); } -TEST_P(AutofillProfileComparatorTest, MergeEmailAddresses) { +TEST_F(AutofillProfileComparatorTest, MergeEmailAddresses) { static const char kEmailA[] = "testaccount@domain.net"; static const char16_t kEmailA16[] = u"testaccount@domain.net"; static const char kEmailB[] = "TestAccount@Domain.Net"; @@ -994,7 +936,7 @@ MergeEmailAddressesAndExpect(profile_b, profile_a, email_b); } -TEST_P(AutofillProfileComparatorTest, MergeCompanyNames) { +TEST_F(AutofillProfileComparatorTest, MergeCompanyNames) { static const char kCompanyA[] = "Some Company"; static const char16_t kCompanyA16[] = u"Some Company"; static const char kCompanyB[] = "SÔMÈ ÇÖMPÁÑÝ"; @@ -1050,7 +992,7 @@ MergeCompanyNamesAndExpect(profile_d, profile_d, company_d); } -TEST_P(AutofillProfileComparatorTest, MergePhoneNumbers_NA) { +TEST_F(AutofillProfileComparatorTest, MergePhoneNumbers_NA) { AutofillProfile profile_a = CreateProfileWithPhoneNumber("5550199"); AutofillProfile profile_b = CreateProfileWithPhoneNumber("555.0199"); AutofillProfile profile_c = CreateProfileWithPhoneNumber("8005550199"); @@ -1071,7 +1013,7 @@ MergePhoneNumbersAndExpect(profile_c, profile_c, u"8005550199"); } -TEST_P(AutofillProfileComparatorTest, MergePhoneNumbers_Intl) { +TEST_F(AutofillProfileComparatorTest, MergePhoneNumbers_Intl) { AutofillProfile profile_a = CreateProfileWithPhoneNumber("+49492180185611"); AutofillProfile profile_b = CreateProfileWithPhoneNumber("+49 4921 801 856-11"); @@ -1097,7 +1039,7 @@ MergePhoneNumbersAndExpect(profile_c, profile_c, u"04921 80185611"); } -TEST_P(AutofillProfileComparatorTest, MergeAddresses) { +TEST_F(AutofillProfileComparatorTest, MergeAddresses) { AutofillProfile p1 = CreateProfileWithAddress( "1 Some Street", "Unit 3", "Carver", "CA - California", "90210", "US"); AutofillProfile p2 = CreateProfileWithAddress( @@ -1111,16 +1053,14 @@ expected.SetRawInfo(ADDRESS_HOME_ZIP, u"90210-1234"); expected.SetRawInfo(ADDRESS_HOME_COUNTRY, u"US"); - if (autofill::structured_address::StructuredAddressesEnabled()) { - expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"1"); - expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"Some Street"); - } + expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"1"); + expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"Some Street"); MergeAddressesAndExpect(p1, p2, expected, /*check_structured_address_tokens=*/false); } -TEST_P(AutofillProfileComparatorTest, MergeAddressesMostUniqueTokens) { +TEST_F(AutofillProfileComparatorTest, MergeAddressesMostUniqueTokens) { AutofillProfile p1 = CreateProfileWithAddress( "1 Some Street", "Unit 3", "Carver", "CA - California", "90210", "US"); @@ -1153,7 +1093,7 @@ MergeAddressesAndExpect(p2, p1, expected); } -TEST_P(AutofillProfileComparatorTest, MergeAddressesWithStructure) { +TEST_F(AutofillProfileComparatorTest, MergeAddressesWithStructure) { AutofillProfile p1 = CreateProfileWithAddress( "6543 CH BACON", "APP 3", "MONTRÉAL", "QUÉBEC", "HHH999", "ca"); @@ -1186,7 +1126,7 @@ MergeAddressesAndExpect(p2, p1, expected); } -TEST_P(AutofillProfileComparatorTest, MergeAddressesWithRewrite) { +TEST_F(AutofillProfileComparatorTest, MergeAddressesWithRewrite) { AutofillProfile p1 = CreateProfileWithAddress( "6543 CH BACON", "APP 3", "MONTRÉAL", "QUÉBEC", "HHH999", "ca"); @@ -1220,7 +1160,7 @@ MergeAddressesAndExpect(p2, p1, expected); } -TEST_P(AutofillProfileComparatorTest, +TEST_F(AutofillProfileComparatorTest, MergeAddressesDependendLocalityAndSortingCode) { AutofillProfile p1 = CreateProfileWithAddress( "6543 CH BACON", "APP 3", "MONTRÉAL", "QUÉBEC", "HHH999", "ca"); @@ -1247,7 +1187,7 @@ MergeAddressesAndExpect(p2, p1, expected); } -TEST_P(AutofillProfileComparatorTest, MergeBirthdates) { +TEST_F(AutofillProfileComparatorTest, MergeBirthdates) { AutofillProfile profile1 = CreateProfileWithBirthdate("14", "", "1997"); AutofillProfile profile2 = CreateProfileWithBirthdate("", "3", "1997"); @@ -1265,7 +1205,7 @@ // Checks for various scenarios for determining mergeability of profiles w.r.t. // the state. -TEST_P(AutofillProfileComparatorTest, CheckStatesMergeability) { +TEST_F(AutofillProfileComparatorTest, CheckStatesMergeability) { base::test::ScopedFeatureList feature; feature.InitAndEnableFeature( autofill::features::kAutofillUseAlternativeStateNameMap); @@ -1297,7 +1237,7 @@ // Tests if determining if two profiles have at least one different settings // visible value works. -TEST_P(AutofillProfileComparatorTest, +TEST_F(AutofillProfileComparatorTest, ProfilesHaveDifferentSettingsVisibleValues) { AutofillProfile existing_profile(base::GenerateGUID(), "http://www.example.com/"); @@ -1331,10 +1271,6 @@ existing_profile, new_profile, kLocale)); } - // The rest of the test is only applicable for structured names. - if (!StructuredNames()) - return; - AutofillProfile new_profile = existing_profile; // Now change the first name which is not visible in the settings to upper // case. Note, the value was converted to upper case to maintain the name @@ -1346,7 +1282,7 @@ existing_profile, new_profile, kLocale)); } -TEST_P(AutofillProfileComparatorTest, GetProfileDifference) { +TEST_F(AutofillProfileComparatorTest, GetProfileDifference) { AutofillProfile existing_profile(base::GenerateGUID(), "http://www.example.com/"); autofill::test::SetProfileInfo( @@ -1373,7 +1309,7 @@ expected_difference); } -TEST_P(AutofillProfileComparatorTest, GetProfileDifferenceMap) { +TEST_F(AutofillProfileComparatorTest, GetProfileDifferenceMap) { AutofillProfile existing_profile(base::GenerateGUID(), "http://www.example.com/"); autofill::test::SetProfileInfo( @@ -1401,7 +1337,7 @@ expected_difference); } -TEST_P(AutofillProfileComparatorTest, GetSettingsVisibleProfileDifference) { +TEST_F(AutofillProfileComparatorTest, GetSettingsVisibleProfileDifference) { AutofillProfile existing_profile(base::GenerateGUID(), "http://www.example.com/"); autofill::test::SetProfileInfo( @@ -1435,7 +1371,7 @@ expected_difference); } -TEST_P(AutofillProfileComparatorTest, GetSettingsVisibleProfileDifferenceMap) { +TEST_F(AutofillProfileComparatorTest, GetSettingsVisibleProfileDifferenceMap) { AutofillProfile existing_profile(base::GenerateGUID(), "http://www.example.com/"); autofill::test::SetProfileInfo( @@ -1468,18 +1404,13 @@ expected_difference); } -TEST_P(AutofillProfileComparatorTest, IsMergeCandidate) { +TEST_F(AutofillProfileComparatorTest, IsMergeCandidate) { AutofillProfile existing_profile(base::GenerateGUID(), "http://www.example.com/"); autofill::test::SetProfileInfo( &existing_profile, "firstName", "middleName", "lastName", "mail@mail.com", "company", "line1", "line2", "the city", "state", "zip", "US", "phone"); - // Explicitly set the full name if the structured name feature is not enabled. - if (!StructuredNames()) { - existing_profile.SetRawInfo(NAME_FULL, u"fistName middleName lastName"); - } - AutofillProfileComparator comparator("en_US"); // A profile is not a merge candidate to itself. @@ -1519,18 +1450,13 @@ } // Test the correct determination of a merge candidate. -TEST_P(AutofillProfileComparatorTest, GetMergeCandidate) { +TEST_F(AutofillProfileComparatorTest, GetMergeCandidate) { AutofillProfile existing_profile(base::GenerateGUID(), "http://www.example.com/"); autofill::test::SetProfileInfo( &existing_profile, "firstName", "middleName", "lastName", "mail@mail.com", "company", "line1", "line2", "city", "state", "zip", "US", "phone"); - // Explicitly set the full name if the structured name feature is not enabled. - if (!StructuredNames()) { - existing_profile.SetRawInfo(NAME_FULL, u"fistName middleName lastName"); - } - // A profile should never be a merge candidate to itself because all values // are the same. EXPECT_EQ(AutofillProfileComparator::GetAutofillProfileMergeCandidate( @@ -1579,7 +1505,7 @@ } // Tests that the profiles are merged when they have common states. -TEST_P(AutofillProfileComparatorTest, MergeProfilesBasedOnState) { +TEST_F(AutofillProfileComparatorTest, MergeProfilesBasedOnState) { base::test::ScopedFeatureList feature; feature.InitAndEnableFeature( autofill::features::kAutofillUseAlternativeStateNameMap); @@ -1614,10 +1540,3 @@ MergeAddressesAndExpect(p3, p4, expected); MergeAddressesAndExpect(p4, p3, expected); } - -INSTANTIATE_TEST_SUITE_P( - All, - AutofillProfileComparatorTest, - testing::Combine(testing::Bool(), - testing::Bool())); // Test with and without structured - // name and structured addresses.
diff --git a/components/autofill/core/browser/data_model/autofill_profile_unittest.cc b/components/autofill/core/browser/data_model/autofill_profile_unittest.cc index a2515d5d..b3f4be5 100644 --- a/components/autofill/core/browser/data_model/autofill_profile_unittest.cc +++ b/components/autofill/core/browser/data_model/autofill_profile_unittest.cc
@@ -61,32 +61,9 @@ } // namespace -class AutofillProfileTest : public testing::Test, - public testing::WithParamInterface<bool> { - protected: - void SetUp() override { InitializeFeatures(); } - - void InitializeFeatures() { - structured_names_enabled_ = GetParam(); - if (structured_names_enabled_) { - scoped_features_.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - } else { - scoped_features_.InitAndDisableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - } - } - - bool StructuredNames() const { return structured_names_enabled_; } - - private: - bool structured_names_enabled_; - base::test::ScopedFeatureList scoped_features_; -}; - // Tests different possibilities for summary string generation. // Based on existence of first name, last name, and address line 1. -TEST_P(AutofillProfileTest, PreviewSummaryString) { +TEST(AutofillProfileTest, PreviewSummaryString) { // Case 0/null: "" AutofillProfile profile0(base::GenerateGUID(), test::kEmptyOrigin); // Empty profile - nothing to update. @@ -185,7 +162,7 @@ EXPECT_EQ(u"Marion Mitchell Morrison, 123 Zoo St., marion@me.xyz", summary7a); } -TEST_P(AutofillProfileTest, AdjustInferredLabels) { +TEST(AutofillProfileTest, AdjustInferredLabels) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -281,7 +258,7 @@ EXPECT_EQ(u"John Doe, 666 Erebus St., CO, johndoe@styx.com", labels[4]); } -TEST_P(AutofillProfileTest, CreateInferredLabelsI18n_CH) { +TEST(AutofillProfileTest, CreateInferredLabelsI18n_CH) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -314,7 +291,7 @@ } } -TEST_P(AutofillProfileTest, CreateInferredLabelsI18n_FR) { +TEST(AutofillProfileTest, CreateInferredLabelsI18n_FR) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -348,7 +325,7 @@ } } -TEST_P(AutofillProfileTest, CreateInferredLabelsI18n_KR) { +TEST(AutofillProfileTest, CreateInferredLabelsI18n_KR) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -392,7 +369,7 @@ } } -TEST_P(AutofillProfileTest, CreateInferredLabelsI18n_JP_Latn) { +TEST(AutofillProfileTest, CreateInferredLabelsI18n_JP_Latn) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -429,7 +406,7 @@ } } -TEST_P(AutofillProfileTest, CreateInferredLabelsI18n_JP_ja) { +TEST(AutofillProfileTest, CreateInferredLabelsI18n_JP_ja) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -462,7 +439,7 @@ } } -TEST_P(AutofillProfileTest, CreateInferredLabels) { +TEST(AutofillProfileTest, CreateInferredLabels) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -563,7 +540,7 @@ // Test that we fall back to using the full name if there are no other // distinguishing fields, but only if it makes sense given the suggested fields. -TEST_P(AutofillProfileTest, CreateInferredLabelsFallsBackToFullName) { +TEST(AutofillProfileTest, CreateInferredLabelsFallsBackToFullName) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -600,7 +577,7 @@ } // Test that we do not show duplicate fields in the labels. -TEST_P(AutofillProfileTest, CreateInferredLabelsNoDuplicatedFields) { +TEST(AutofillProfileTest, CreateInferredLabelsNoDuplicatedFields) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -626,7 +603,7 @@ } // Make sure that empty fields are not treated as distinguishing fields. -TEST_P(AutofillProfileTest, CreateInferredLabelsSkipsEmptyFields) { +TEST(AutofillProfileTest, CreateInferredLabelsSkipsEmptyFields) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -663,7 +640,7 @@ } // Test that labels that would otherwise have multiline values are flattened. -TEST_P(AutofillProfileTest, CreateInferredLabelsFlattensMultiLineValues) { +TEST(AutofillProfileTest, CreateInferredLabelsFlattensMultiLineValues) { std::vector<std::unique_ptr<AutofillProfile>> profiles; profiles.push_back(std::make_unique<AutofillProfile>(base::GenerateGUID(), test::kEmptyOrigin)); @@ -683,7 +660,7 @@ EXPECT_EQ(u"88 Nowhere Ave., Apt. 42", labels[0]); } -TEST_P(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentMiddleNames) { +TEST(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentMiddleNames) { AutofillProfile profile1 = AutofillProfile(base::GenerateGUID(), test::kEmptyOrigin); test::SetProfileInfo(&profile1, "Genevieve", "", "Fox", "", "", "", "", "", @@ -734,7 +711,7 @@ {NAME_MIDDLE})); } -TEST_P(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentFirstNames) { +TEST(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentFirstNames) { AutofillProfile profile1 = AutofillProfile(base::GenerateGUID(), test::kEmptyOrigin); test::SetProfileInfo(&profile1, "Cynthia", "", "Fox", "", "", "", "", "", "", @@ -757,7 +734,7 @@ {NAME_FIRST})); } -TEST_P(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentLastNames) { +TEST(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentLastNames) { AutofillProfile profile1 = AutofillProfile(base::GenerateGUID(), test::kEmptyOrigin); test::SetProfileInfo(&profile1, "Genevieve", "", "Fuller", "", "", "", "", "", @@ -800,7 +777,7 @@ comparator, profile1, "en-US", {NAME_FULL, ADDRESS_HOME_STREET_ADDRESS})); } -TEST_P(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentNonStreetAddresses) { +TEST(AutofillProfileTest, IsSubsetOfForFieldSet_DifferentNonStreetAddresses) { AutofillProfile profile1 = AutofillProfile(base::GenerateGUID(), test::kEmptyOrigin); test::SetProfileInfo(&profile1, "Genevieve", "", "Fox", "", "", "274 Main St", @@ -963,11 +940,7 @@ comparator, profile2, "pt-BR", {NAME_FULL, PHONE_HOME_CITY_AND_NUMBER})); } -TEST_P(AutofillProfileTest, TestFinalizeAfterImport) { - base::test::ScopedFeatureList structured_addresses_feature; - structured_addresses_feature.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - +TEST(AutofillProfileTest, TestFinalizeAfterImport) { // A profile with just a full name should be finalizeable. { AutofillProfile profile; @@ -996,11 +969,7 @@ } } -TEST_P(AutofillProfileTest, SetAndGetRawInfoWithValidationStatus) { - base::test::ScopedFeatureList structured_addresses_feature; - structured_addresses_feature.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - +TEST(AutofillProfileTest, SetAndGetRawInfoWithValidationStatus) { AutofillProfile profile; // An unsupported type should return |kNoStatus|. EXPECT_EQ(profile.GetVerificationStatus(UNKNOWN_TYPE), @@ -1025,11 +994,7 @@ EXPECT_EQ(profile.GetVerificationStatusInt(NAME_FULL), 2); } -TEST_P(AutofillProfileTest, SetAndGetInfoWithValidationStatus) { - base::test::ScopedFeatureList structured_addresses_feature; - structured_addresses_feature.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - +TEST(AutofillProfileTest, SetAndGetInfoWithValidationStatus) { AutofillProfile profile; // An unsupported type should return |kNoStatus|. EXPECT_EQ(profile.GetVerificationStatus(UNKNOWN_TYPE), @@ -1071,7 +1036,7 @@ EXPECT_EQ(profile.GetRawInfo(NAME_MIDDLE_INITIAL), u"CS"); } -TEST_P(AutofillProfileTest, MergeDataFrom_DifferentProfile) { +TEST(AutofillProfileTest, MergeDataFrom_DifferentProfile) { AutofillProfile a; SetupTestProfile(a); @@ -1108,7 +1073,7 @@ EXPECT_EQ("en", a.language_code()); } -TEST_P(AutofillProfileTest, MergeDataFrom_SameProfile) { +TEST(AutofillProfileTest, MergeDataFrom_SameProfile) { AutofillProfile a; SetupTestProfile(a); @@ -1117,10 +1082,8 @@ // For the new structured profiles, the profile must be altered for the // merging to have an effect. The verification status of the full name is set // to user verified. - if (StructuredNames()) { - b.SetRawInfoWithVerificationStatus(NAME_FULL, b.GetRawInfo(NAME_FULL), - VerificationStatus::kUserVerified); - } + b.SetRawInfoWithVerificationStatus(NAME_FULL, b.GetRawInfo(NAME_FULL), + VerificationStatus::kUserVerified); b.set_guid(base::GenerateGUID()); EXPECT_TRUE(a.MergeDataFrom(b, "en-US")); // Merge has modified profile a, the validation is not updated. @@ -1136,7 +1099,7 @@ EXPECT_EQ(3u, a.use_count()); } -TEST_P(AutofillProfileTest, OverwriteName_AddNameFull) { +TEST(AutofillProfileTest, OverwriteName_AddNameFull) { AutofillProfile a; a.SetRawInfo(NAME_FIRST, u"Marion"); @@ -1160,7 +1123,7 @@ // Tests that OverwriteName overwrites the name parts if they have different // case. -TEST_P(AutofillProfileTest, OverwriteName_DifferentCase) { +TEST(AutofillProfileTest, OverwriteName_DifferentCase) { AutofillProfile a; AutofillProfile b = a; @@ -1187,7 +1150,7 @@ EXPECT_EQ(u"Morrison", a.GetRawInfo(NAME_LAST)); } -TEST_P(AutofillProfileTest, AssignmentOperator) { +TEST(AutofillProfileTest, AssignmentOperator) { AutofillProfile a(base::GenerateGUID(), test::kEmptyOrigin); test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", @@ -1203,7 +1166,7 @@ EXPECT_TRUE(a == b); } -TEST_P(AutofillProfileTest, Copy) { +TEST(AutofillProfileTest, Copy) { AutofillProfile a(base::GenerateGUID(), test::kEmptyOrigin); test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", @@ -1214,7 +1177,7 @@ EXPECT_TRUE(a == b); } -TEST_P(AutofillProfileTest, Compare) { +TEST(AutofillProfileTest, Compare) { AutofillProfile a(base::GenerateGUID(), std::string()); AutofillProfile b(base::GenerateGUID(), std::string()); @@ -1262,7 +1225,7 @@ EXPECT_LT(0, b.Compare(a)); } -TEST_P(AutofillProfileTest, IsPresentButInvalid) { +TEST(AutofillProfileTest, IsPresentButInvalid) { AutofillProfile profile(base::GenerateGUID(), test::kEmptyOrigin); EXPECT_FALSE(profile.IsPresentButInvalid(ADDRESS_HOME_STATE)); EXPECT_FALSE(profile.IsPresentButInvalid(ADDRESS_HOME_ZIP)); @@ -1292,7 +1255,7 @@ EXPECT_FALSE(profile.IsPresentButInvalid(PHONE_HOME_WHOLE_NUMBER)); } -TEST_P(AutofillProfileTest, SetRawInfoPreservesLineBreaks) { +TEST(AutofillProfileTest, SetRawInfoPreservesLineBreaks) { AutofillProfile profile(base::GenerateGUID(), test::kEmptyOrigin); profile.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, @@ -1304,7 +1267,7 @@ profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS)); } -TEST_P(AutofillProfileTest, SetInfoPreservesLineBreaks) { +TEST(AutofillProfileTest, SetInfoPreservesLineBreaks) { AutofillProfile profile(base::GenerateGUID(), test::kEmptyOrigin); profile.SetInfo(ADDRESS_HOME_STREET_ADDRESS, @@ -1317,21 +1280,21 @@ profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS)); } -TEST_P(AutofillProfileTest, SetRawInfoDoesntTrimWhitespace) { +TEST(AutofillProfileTest, SetRawInfoDoesntTrimWhitespace) { AutofillProfile profile(base::GenerateGUID(), test::kEmptyOrigin); profile.SetRawInfo(EMAIL_ADDRESS, u"\tuser@example.com "); EXPECT_EQ(u"\tuser@example.com ", profile.GetRawInfo(EMAIL_ADDRESS)); } -TEST_P(AutofillProfileTest, SetInfoTrimsWhitespace) { +TEST(AutofillProfileTest, SetInfoTrimsWhitespace) { AutofillProfile profile(base::GenerateGUID(), test::kEmptyOrigin); profile.SetInfo(EMAIL_ADDRESS, u"\tuser@example.com ", "en-US"); EXPECT_EQ(u"user@example.com", profile.GetRawInfo(EMAIL_ADDRESS)); } -TEST_P(AutofillProfileTest, FullAddress) { +TEST(AutofillProfileTest, FullAddress) { AutofillProfile profile(base::GenerateGUID(), test::kEmptyOrigin); test::SetProfileInfo(&profile, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", @@ -1370,11 +1333,7 @@ EXPECT_TRUE(profile.GetInfo(full_address, "en-US").empty()); } -TEST_P(AutofillProfileTest, SaveAdditionalInfo_Verified_MergeStructure) { - // This test is only applicable for structured names. - if (!StructuredNames()) - return; - +TEST(AutofillProfileTest, SaveAdditionalInfo_Verified_MergeStructure) { AutofillProfile a; a.SetRawInfoWithVerificationStatus(NAME_FULL, u"Marion Mitchell Morrison", VerificationStatus::kUserVerified); @@ -1417,7 +1376,7 @@ EXPECT_EQ(a.GetRawInfo(NAME_LAST), u"Morrison"); } -TEST_P(AutofillProfileTest, SaveAdditionalInfo_Name_AddingNameFull) { +TEST(AutofillProfileTest, SaveAdditionalInfo_Name_AddingNameFull) { AutofillProfile a; a.SetRawInfo(NAME_FIRST, u"Marion"); @@ -1438,7 +1397,7 @@ EXPECT_EQ(u"Marion Mitchell Morrison", a.GetRawInfo(NAME_FULL)); } -TEST_P(AutofillProfileTest, SaveAdditionalInfo_Name_KeepNameFull) { +TEST(AutofillProfileTest, SaveAdditionalInfo_Name_KeepNameFull) { AutofillProfile a; a.SetRawInfo(NAME_FIRST, u"Marion"); @@ -1459,8 +1418,8 @@ // Tests the merging of two similar profiles results in the second profile's // non-empty fields overwriting the initial profiles values. -TEST_P(AutofillProfileTest, - SaveAdditionalInfo_Name_DifferentCaseAndDiacriticsNoNameFull) { +TEST(AutofillProfileTest, + SaveAdditionalInfo_Name_DifferentCaseAndDiacriticsNoNameFull) { AutofillProfile a; a.SetRawInfoWithVerificationStatus(NAME_FIRST, u"marion", kObserved); @@ -1485,18 +1444,14 @@ EXPECT_EQ(u"Märion", a.GetRawInfo(NAME_FIRST)); EXPECT_EQ(u"Mitchéll", a.GetRawInfo(NAME_MIDDLE)); EXPECT_EQ(u"Morrison", a.GetRawInfo(NAME_LAST)); - if (!StructuredNames()) { - EXPECT_EQ(u"Märion Mitchéll Morrison", a.GetRawInfo(NAME_FULL)); - } else { - // In the new merging logic the observed lower-case value should remain - // because the upper-case-diacritic version is only formatted. - EXPECT_EQ(u"marion mitchell morrison", a.GetRawInfo(NAME_FULL)); - } + // In the merging logic the observed lower-case value should remain + // because the upper-case-diacritic version is only formatted. + EXPECT_EQ(u"marion mitchell morrison", a.GetRawInfo(NAME_FULL)); } // Tests that no loss of information happens when SavingAdditionalInfo with a // profile with an empty name part. -TEST_P(AutofillProfileTest, SaveAdditionalInfo_Name_LossOfInformation) { +TEST(AutofillProfileTest, SaveAdditionalInfo_Name_LossOfInformation) { AutofillProfile a; a.SetRawInfo(NAME_FIRST, u"Marion"); @@ -1515,7 +1470,7 @@ // Tests that merging two complementary profiles for names results in a profile // with a complete name. -TEST_P(AutofillProfileTest, SaveAdditionalInfo_Name_ComplementaryInformation) { +TEST(AutofillProfileTest, SaveAdditionalInfo_Name_ComplementaryInformation) { AutofillProfile a; a.SetRawInfo(NAME_FIRST, u"Marion"); @@ -1538,7 +1493,7 @@ } // Test that the label is correctly set and retrieved from the profile. -TEST_P(AutofillProfileTest, SetAndGetProfileLabels) { +TEST(AutofillProfileTest, SetAndGetProfileLabels) { AutofillProfile p; EXPECT_EQ(p.profile_label(), std::string()); @@ -1546,7 +1501,7 @@ EXPECT_EQ(p.profile_label(), "my label"); } -TEST_P(AutofillProfileTest, LabelsInAssignmentAndComparisonOperator) { +TEST(AutofillProfileTest, LabelsInAssignmentAndComparisonOperator) { AutofillProfile p1; p1.set_profile_label("my label"); @@ -1564,7 +1519,7 @@ // Test that the state to disallow confirmable merges is correctly set and // retrieved from the profile. -TEST_P(AutofillProfileTest, SetAndGetProfileDisallowConfirmableMergestate) { +TEST(AutofillProfileTest, SetAndGetProfileDisallowConfirmableMergestate) { AutofillProfile p; EXPECT_EQ(p.disallow_settings_visible_updates(), false); @@ -1572,7 +1527,7 @@ EXPECT_EQ(p.disallow_settings_visible_updates(), true); } -TEST_P(AutofillProfileTest, LockStateInAssignmentAndComparisonOperator) { +TEST(AutofillProfileTest, LockStateInAssignmentAndComparisonOperator) { AutofillProfile p1; p1.set_disallow_settings_visible_updates(true); @@ -1591,7 +1546,7 @@ EXPECT_NE(p1, p2); } -TEST_P(AutofillProfileTest, GetMetadata) { +TEST(AutofillProfileTest, GetMetadata) { AutofillProfile local_profile = test::GetFullProfile(); local_profile.set_use_count(2); local_profile.set_use_date(base::Time::FromDoubleT(25)); @@ -1613,7 +1568,7 @@ EXPECT_EQ(server_profile.use_date(), server_metadata.use_date); } -TEST_P(AutofillProfileTest, SetMetadata_MatchingId) { +TEST(AutofillProfileTest, SetMetadata_MatchingId) { AutofillProfile local_profile = test::GetFullProfile(); AutofillMetadata local_metadata; local_metadata.id = local_profile.guid(); @@ -1639,7 +1594,7 @@ EXPECT_EQ(server_metadata.use_date, server_profile.use_date()); } -TEST_P(AutofillProfileTest, SetMetadata_NotMatchingId) { +TEST(AutofillProfileTest, SetMetadata_NotMatchingId) { AutofillProfile local_profile = test::GetFullProfile(); AutofillMetadata local_metadata; local_metadata.id = "WrongId"; @@ -1666,7 +1621,7 @@ } // Tests that the profile is only deletable if it is not verified. -TEST_P(AutofillProfileTest, IsDeletable) { +TEST(AutofillProfileTest, IsDeletable) { // Set up an arbitrary time, as setup the current time to just above the // threshold later than that time. const base::Time kArbitraryTime = base::Time::FromDoubleT(25000000000); @@ -1691,7 +1646,7 @@ // Tests that the |HasStructuredData| returns whether the profile has structured // data or not. -TEST_P(AutofillProfileTest, HasStructuredData) { +TEST(AutofillProfileTest, HasStructuredData) { AutofillProfile profile; profile.SetRawInfoWithVerificationStatus( NAME_FULL, u"marion mitchell morrison", kObserved); @@ -1703,7 +1658,7 @@ EXPECT_TRUE(profile.HasStructuredData()); } -TEST_P(AutofillProfileTest, RemoveInaccessibleProfileValues) { +TEST(AutofillProfileTest, RemoveInaccessibleProfileValues) { // Returns true if at least one field was removed. auto RemoveInaccessibleProfileValues = [](AutofillProfile& profile) { const ServerFieldTypeSet inaccessible_fields = @@ -1742,6 +1697,4 @@ enum Expectation { GREATER, LESS, EQUAL }; -INSTANTIATE_TEST_SUITE_P(All, AutofillProfileTest, testing::Bool()); - } // namespace autofill
diff --git a/components/autofill/core/browser/data_model/contact_info_unittest.cc b/components/autofill/core/browser/data_model/contact_info_unittest.cc index 11c5c38..7dee883 100644 --- a/components/autofill/core/browser/data_model/contact_info_unittest.cc +++ b/components/autofill/core/browser/data_model/contact_info_unittest.cc
@@ -52,12 +52,10 @@ name.GetInfo(AutofillType(NAME_FULL), "en-US")); } -TEST(NameInfoTest, GetMatchingTypesForStructuredNameWithPrefix) { +TEST(NameInfoTest, GetMatchingTypesWithPrefix) { base::test::ScopedFeatureList structured_name_feature; - structured_name_feature.InitWithFeatures( - {features::kAutofillEnableSupportForMoreStructureInNames, - features::kAutofillEnableSupportForHonorificPrefixes}, - {}); + structured_name_feature.InitAndEnableFeature( + features::kAutofillEnableSupportForHonorificPrefixes); NameInfo name; test::FormGroupValues name_values = { @@ -111,11 +109,10 @@ NAME_HONORIFIC_PREFIX})); } -TEST(NameInfoTest, GetMatchingTypesForStructuredName) { +TEST(NameInfoTest, GetMatchingTypes) { base::test::ScopedFeatureList structured_name_feature; - structured_name_feature.InitWithFeatures( - {features::kAutofillEnableSupportForMoreStructureInNames}, - {features::kAutofillEnableSupportForHonorificPrefixes}); + structured_name_feature.InitAndDisableFeature( + features::kAutofillEnableSupportForHonorificPrefixes); NameInfo name; @@ -176,142 +173,14 @@ FullNameTestCase{"Mr. John Smith MD", "John", "", "Smith"}, FullNameTestCase{"William Hubert J.R.", "William", "Hubert", "J.R."}, FullNameTestCase{"John Ma", "John", "", "Ma"}, - !structured_address::StructuredNamesEnabled() - ? FullNameTestCase{"John Jacob Jingleheimer Smith", "John Jacob", - "Jingleheimer", "Smith"} - : FullNameTestCase{"John Jacob Jingleheimer Smith", "John", - "Jacob Jingleheimer", "Smith"}, - !structured_address::StructuredNamesEnabled() - ? FullNameTestCase{"Virgil", "Virgil", "", ""} - : FullNameTestCase{"Virgil", "", "", "Virgil"}, + FullNameTestCase{"John Jacob Jingleheimer Smith", "John", + "Jacob Jingleheimer", "Smith"}, + FullNameTestCase{"Virgil", "", "", "Virgil"}, FullNameTestCase{"Murray Gell-Mann", "Murray", "", "Gell-Mann"}, FullNameTestCase{"Mikhail Yevgrafovich Saltykov-Shchedrin", "Mikhail", "Yevgrafovich", "Saltykov-Shchedrin"}, - !structured_address::StructuredNamesEnabled() - ? FullNameTestCase{"Arthur Ignatius Conan Doyle", "Arthur Ignatius", - "Conan", "Doyle"} - : FullNameTestCase{"Arthur Ignatius Conan Doyle", "Arthur", - "Ignatius Conan", "Doyle"})); - -TEST(NameInfoTest, GetFullName) { - // This test is not applicable to more-structured names because the logic of - // handling the duality between first,middle,last and the full name works - // differently. - if (structured_address::StructuredNamesEnabled()) - return; - - NameInfo name; - name.SetRawInfo(NAME_FIRST, u"First"); - name.SetRawInfo(NAME_MIDDLE, std::u16string()); - name.SetRawInfo(NAME_LAST, std::u16string()); - name.FinalizeAfterImport(); - EXPECT_EQ(u"First", name.GetRawInfo(NAME_FIRST)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_MIDDLE)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_LAST)); - EXPECT_EQ(u"First", name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - name = NameInfo(); - name.SetRawInfo(NAME_FIRST, std::u16string()); - name.SetRawInfo(NAME_MIDDLE, u"Middle"); - name.SetRawInfo(NAME_LAST, std::u16string()); - name.FinalizeAfterImport(); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_FIRST)); - EXPECT_EQ(u"Middle", name.GetRawInfo(NAME_MIDDLE)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_LAST)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_FULL)); - EXPECT_EQ(u"Middle", name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - name = NameInfo(); - name.SetRawInfo(NAME_FIRST, std::u16string()); - name.SetRawInfo(NAME_MIDDLE, std::u16string()); - name.SetRawInfo(NAME_LAST, u"Last"); - name.FinalizeAfterImport(); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_FIRST)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_MIDDLE)); - EXPECT_EQ(u"Last", name.GetRawInfo(NAME_LAST)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_FULL)); - EXPECT_EQ(u"Last", name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - name = NameInfo(); - name.SetRawInfo(NAME_FIRST, u"First"); - name.SetRawInfo(NAME_MIDDLE, u"Middle"); - name.SetRawInfo(NAME_LAST, std::u16string()); - name.FinalizeAfterImport(); - EXPECT_EQ(u"First", name.GetRawInfo(NAME_FIRST)); - EXPECT_EQ(u"Middle", name.GetRawInfo(NAME_MIDDLE)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_LAST)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_FULL)); - EXPECT_EQ(u"First Middle", name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - name = NameInfo(); - name.SetRawInfo(NAME_FIRST, u"First"); - name.SetRawInfo(NAME_MIDDLE, std::u16string()); - name.SetRawInfo(NAME_LAST, u"Last"); - name.FinalizeAfterImport(); - EXPECT_EQ(u"First", name.GetRawInfo(NAME_FIRST)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_MIDDLE)); - EXPECT_EQ(u"Last", name.GetRawInfo(NAME_LAST)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_FULL)); - EXPECT_EQ(u"First Last", name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - name = NameInfo(); - name.SetRawInfo(NAME_FIRST, std::u16string()); - name.SetRawInfo(NAME_MIDDLE, u"Middle"); - name.SetRawInfo(NAME_LAST, u"Last"); - name.FinalizeAfterImport(); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_FIRST)); - EXPECT_EQ(u"Middle", name.GetRawInfo(NAME_MIDDLE)); - EXPECT_EQ(u"Last", name.GetRawInfo(NAME_LAST)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_FULL)); - EXPECT_EQ(u"Middle Last", name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - name = NameInfo(); - name.SetRawInfo(NAME_FIRST, u"First"); - name.SetRawInfo(NAME_MIDDLE, u"Middle"); - name.SetRawInfo(NAME_LAST, u"Last"); - name.FinalizeAfterImport(); - EXPECT_EQ(u"First", name.GetRawInfo(NAME_FIRST)); - EXPECT_EQ(u"Middle", name.GetRawInfo(NAME_MIDDLE)); - EXPECT_EQ(u"Last", name.GetRawInfo(NAME_LAST)); - EXPECT_EQ(std::u16string(), name.GetRawInfo(NAME_FULL)); - EXPECT_EQ(u"First Middle Last", - name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - name.SetRawInfo(NAME_FULL, u"First Middle Last, MD"); - EXPECT_EQ(name.GetRawInfo(NAME_FIRST), u"First"); - EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), u"Middle"); - EXPECT_EQ(name.GetRawInfo(NAME_LAST), u"Last"); - EXPECT_EQ(name.GetRawInfo(NAME_FULL), u"First Middle Last, MD"); - EXPECT_EQ(u"First Middle Last, MD", - name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - // Setting a name to the value it already has: no change. - name.SetInfo(AutofillType(NAME_FIRST), u"First", "en-US"); - EXPECT_EQ(name.GetRawInfo(NAME_FIRST), u"First"); - EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), u"Middle"); - EXPECT_EQ(name.GetRawInfo(NAME_LAST), u"Last"); - EXPECT_EQ(name.GetRawInfo(NAME_FULL), u"First Middle Last, MD"); - EXPECT_EQ(u"First Middle Last, MD", - name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - // Setting raw info: no change. (Even though this leads to a slightly - // inconsistent state.) - name.SetRawInfo(NAME_FIRST, u"Second"); - EXPECT_EQ(name.GetRawInfo(NAME_FIRST), u"Second"); - EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), u"Middle"); - EXPECT_EQ(name.GetRawInfo(NAME_LAST), u"Last"); - EXPECT_EQ(name.GetRawInfo(NAME_FULL), u"First Middle Last, MD"); - EXPECT_EQ(u"First Middle Last, MD", - name.GetInfo(AutofillType(NAME_FULL), "en-US")); - - // Changing something (e.g., the first name) clears the stored full name. - name.SetInfo(AutofillType(NAME_FIRST), u"Third", "en-US"); - EXPECT_EQ(name.GetRawInfo(NAME_FIRST), u"Third"); - EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), u"Middle"); - EXPECT_EQ(name.GetRawInfo(NAME_LAST), u"Last"); - EXPECT_EQ(u"Third Middle Last", - name.GetInfo(AutofillType(NAME_FULL), "en-US")); -} + FullNameTestCase{"Arthur Ignatius Conan Doyle", "Arthur", + "Ignatius Conan", "Doyle"})); TEST(CompanyTest, CompanyName) { AutofillProfile profile;
diff --git a/components/autofill/core/browser/form_data_importer_unittest.cc b/components/autofill/core/browser/form_data_importer_unittest.cc index 1f5ad47f..501fb72 100644 --- a/components/autofill/core/browser/form_data_importer_unittest.cc +++ b/components/autofill/core/browser/form_data_importer_unittest.cc
@@ -728,10 +728,7 @@ std::get<1>(GetParam()); // Enable all those features by default. - std::vector<base::Feature> enabled_features{ - features::kAutofillEnableSupportForMoreStructureInAddresses, - features::kAutofillEnableSupportForMoreStructureInNames}; - + std::vector<base::Feature> enabled_features; std::vector<base::Feature> disabled_features; (support_for_apartment_numbers_ ? enabled_features : disabled_features) @@ -899,10 +896,6 @@ // ImportAddressProfiles tests. TEST_P(FormDataImporterTest, ImportStructuredNameProfile) { - base::test::ScopedFeatureList structured_addresses_feature; - structured_addresses_feature.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - FormData form; form.url = GURL("https://wwww.foo.com"); @@ -945,10 +938,6 @@ TEST_P(FormDataImporterTest, ImportStructuredAddressProfile_StreetNameAndHouseNumber) { - base::test::ScopedFeatureList structured_addresses_feature; - structured_addresses_feature.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - FormData form; form.url = GURL("https://wwww.foo.com"); @@ -996,11 +985,8 @@ TEST_P( FormDataImporterTest, ImportStructuredAddressProfile_StreetNameAndHouseNumberAndApartmentNumber) { - // This test is only applicable for enabled structured addresses and support - // for apartment numbers. + // This test is only applicable for enabled support for apartment numbers. if (!base::FeatureList::IsEnabled( - features::kAutofillEnableSupportForMoreStructureInAddresses) || - !base::FeatureList::IsEnabled( features::kAutofillEnableSupportForApartmentNumbers)) { return; } @@ -1099,10 +1085,6 @@ // ImportAddressProfiles tests. TEST_P(FormDataImporterTest, ImportStructuredNameAddressProfile) { - base::test::ScopedFeatureList structured_addresses_feature; - structured_addresses_feature.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - FormData form; form.url = GURL("https://wwww.foo.com"); @@ -1765,11 +1747,6 @@ TEST_P(FormDataImporterTest, IncorporateStructuredNameInformationInVerifiedProfile) { - // This test is only applicable to structured names. - if (!structured_address::StructuredNamesEnabled()) { - return; - } - // Start with a verified profile. AutofillProfile profile(base::GenerateGUID(), kSettingsOrigin); test::SetProfileInfo(&profile, "Marion", "Mitchell", "Morrison", @@ -1855,11 +1832,6 @@ TEST_P(FormDataImporterTest, IncorporateStructuredAddressInformationInVerififedProfile) { - // This test is only applicable to structured addresses. - if (!structured_address::StructuredAddressesEnabled()) { - return; - } - // Start with a verified profile. AutofillProfile profile(base::GenerateGUID(), kSettingsOrigin); test::SetProfileInfo(&profile, "Marion", "Mitchell", "Morrison",
diff --git a/components/autofill/core/browser/form_parsing/address_field_unittest.cc b/components/autofill/core/browser/form_parsing/address_field_unittest.cc index 772ad0d..68912c55 100644 --- a/components/autofill/core/browser/form_parsing/address_field_unittest.cc +++ b/components/autofill/core/browser/form_parsing/address_field_unittest.cc
@@ -72,11 +72,6 @@ // |ADDRESS_HOME_HOUSE_NUMBER| when they are labeled accordingly and // both are present. TEST_P(AddressFieldTest, ParseStreetNameAndHouseNumber) { - // TODO(crbug.com/1125978): Remove once launched. - base::test::ScopedFeatureList enabled; - enabled.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - AddTextFormFieldData("street", "Street", ADDRESS_HOME_STREET_NAME); AddTextFormFieldData("house-number", "House number", ADDRESS_HOME_HOUSE_NUMBER); @@ -89,10 +84,8 @@ TEST_P(AddressFieldTest, ParseStreetNameAndHouseNumberAndApartmentNumber) { // TODO(crbug.com/1125978): Remove once launched. base::test::ScopedFeatureList enabled; - enabled.InitWithFeatures( - {features::kAutofillEnableSupportForMoreStructureInAddresses, - features::kAutofillEnableSupportForApartmentNumbers}, - {}); + enabled.InitAndEnableFeature( + features::kAutofillEnableSupportForApartmentNumbers); AddTextFormFieldData("street", "Street", ADDRESS_HOME_STREET_NAME); AddTextFormFieldData("house-number", "House number", @@ -105,11 +98,6 @@ // |ADDRESS_HOME_HOUSE_NUMBER| combination is classified as // |ADDRESS_HOME_LINE2| instead of |ADDRESS_HOME_LINE1|. TEST_P(AddressFieldTest, ParseAsAddressLine2AfterStreetName) { - // TODO(crbug.com/1125978): Remove once launched. - base::test::ScopedFeatureList structured_addresses; - structured_addresses.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - AddTextFormFieldData("street", "Street", ADDRESS_HOME_STREET_NAME); AddTextFormFieldData("house-number", "House no.", ADDRESS_HOME_HOUSE_NUMBER); AddTextFormFieldData("address", "Address", ADDRESS_HOME_LINE2); @@ -120,10 +108,6 @@ // it is labeled accordingly but an adjacent field classified as // |ADDRESS_HOME_HOUSE_NUMBER| is absent. TEST_P(AddressFieldTest, NotParseStreetNameWithoutHouseNumber) { - // TODO(crbug.com/1125978): Remove once launched. - base::test::ScopedFeatureList enabled; - enabled.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); AddTextFormFieldData("street", "Street", ADDRESS_HOME_LINE1); ClassifyAndVerify(); } @@ -132,11 +116,6 @@ // it is labeled accordingly but adjacent field classified as // |ADDRESS_HOME_STREET_NAME| is absent. TEST_P(AddressFieldTest, NotParseHouseNumberWithoutStreetName) { - // TODO(crbug.com/1125978): Remove once launched. - base::test::ScopedFeatureList enabled; - enabled.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - AddTextFormFieldData("house-number", "House number", UNKNOWN_TYPE); ClassifyAndVerify(ParseResult::NOT_PARSED); }
diff --git a/components/autofill/core/browser/form_parsing/name_field_unittest.cc b/components/autofill/core/browser/form_parsing/name_field_unittest.cc index c06055f..4c86a85 100644 --- a/components/autofill/core/browser/form_parsing/name_field_unittest.cc +++ b/components/autofill/core/browser/form_parsing/name_field_unittest.cc
@@ -56,13 +56,6 @@ // Test that a field for a honorific title is parsed correctly. TEST_P(NameFieldTest, HonorificPrefixFirstLast) { - // With support for two last names, the parsing should find the first name - // field and the two last name fields. - // TODO(crbug.com/1098943): Remove once launched. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AddTextFormFieldData("salutation", "", NAME_HONORIFIC_PREFIX); AddTextFormFieldData("first_name", "", NAME_FIRST); AddTextFormFieldData("last_name", "", NAME_LAST); @@ -159,13 +152,6 @@ // Tests that a website with a first and second surname field is parsed // correctly. TEST_P(NameFieldTest, HonorificPrefixAndFirstNameAndHispanicLastNames) { - // With support for two last names, the parsing should find the first name - // field and the two last name fields. - // TODO(crbug.com/1098943): Remove once launched. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AddTextFormFieldData("tratamiento", "tratamiento", NAME_HONORIFIC_PREFIX); AddTextFormFieldData("nombre", "nombre", NAME_FIRST); AddTextFormFieldData("apellido paterno", "apellido_paterno", NAME_LAST_FIRST); @@ -178,12 +164,6 @@ // Tests that a website with a first and second surname field is parsed // correctly. TEST_P(NameFieldTest, FirstNameAndOptionalMiddleNameAndHispanicLastNames) { - // With support for two last names, the parsing should find the first name - // field and the two last name fields. - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - AddTextFormFieldData("nombre", "nombre", NAME_FIRST); AddTextFormFieldData("middle_name", "middle name", NAME_MIDDLE); AddTextFormFieldData("apellido_paterno", "apellido paterno", NAME_LAST_FIRST);
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc index 1f55e41..8ced6b93 100644 --- a/components/autofill/core/browser/form_structure_unittest.cc +++ b/components/autofill/core/browser/form_structure_unittest.cc
@@ -5104,10 +5104,6 @@ // predictions. TEST_F(FormStructureTestImpl, ParseQueryResponse_HeuristicsOverrideSpanishLastNameTypes) { - base::test::ScopedFeatureList scoped_feature; - scoped_feature.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - FormData form_data; FormFieldData field; form_data.url = GURL("http://foo.com"); @@ -5163,39 +5159,12 @@ EXPECT_EQ(form.field(0)->Type().GetStorableType(), NAME_FIRST); EXPECT_EQ(form.field(1)->Type().GetStorableType(), NAME_LAST_FIRST); EXPECT_EQ(form.field(2)->Type().GetStorableType(), NAME_LAST_SECOND); - - // Now disable the feature and process the query again. - scoped_feature.Reset(); - scoped_feature.InitAndDisableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - - std::vector<FormStructure*> forms2{&form}; - FormStructure::ParseApiQueryResponse(response_string, forms2, - test::GetEncodedSignatures(forms2), - nullptr, nullptr); - ASSERT_EQ(form.field_count(), 3U); - - // Validate the heuristic and server predictions. - EXPECT_EQ(NAME_LAST_FIRST, form.field(1)->heuristic_type()); - EXPECT_EQ(NAME_LAST_SECOND, form.field(2)->heuristic_type()); - EXPECT_EQ(NAME_LAST, form.field(1)->server_type()); - EXPECT_EQ(NAME_LAST, form.field(2)->server_type()); - - // Validate that the heuristic prediction does not win for the two last name - // fields. - EXPECT_EQ(form.field(0)->Type().GetStorableType(), NAME_FIRST); - EXPECT_EQ(form.field(1)->Type().GetStorableType(), NAME_LAST); - EXPECT_EQ(form.field(2)->Type().GetStorableType(), NAME_LAST); } // Test the heuristic prediction for ADDRESS_HOME_STREET_NAME and // ADDRESS_HOME_HOUSE_NUMBER overrides server predictions. TEST_F(FormStructureTestImpl, ParseQueryResponse_HeuristicsOverrideStreetNameAndHouseNumberTypes) { - base::test::ScopedFeatureList scoped_feature; - scoped_feature.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - FormData form_data; FormFieldData field; form_data.url = GURL("http://foo.com"); @@ -5257,28 +5226,6 @@ // number. EXPECT_EQ(form.field(1)->Type().GetStorableType(), ADDRESS_HOME_STREET_NAME); EXPECT_EQ(form.field(2)->Type().GetStorableType(), ADDRESS_HOME_HOUSE_NUMBER); - - // Now disable the feature and process the query again. - scoped_feature.Reset(); - scoped_feature.InitAndDisableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - - std::vector<FormStructure*> forms2{&form}; - FormStructure::ParseApiQueryResponse(response_string, forms2, - test::GetEncodedSignatures(forms2), - nullptr, nullptr); - ASSERT_EQ(form.field_count(), 4U); - - // Validate the heuristic and server predictions. - EXPECT_EQ(ADDRESS_HOME_STREET_NAME, form.field(1)->heuristic_type()); - EXPECT_EQ(ADDRESS_HOME_HOUSE_NUMBER, form.field(2)->heuristic_type()); - EXPECT_EQ(ADDRESS_HOME_LINE1, form.field(1)->server_type()); - EXPECT_EQ(ADDRESS_HOME_LINE2, form.field(2)->server_type()); - - // Validate that the heuristic prediction does not win for the street name and - // house number. - EXPECT_EQ(form.field(1)->Type().GetStorableType(), ADDRESS_HOME_LINE1); - EXPECT_EQ(form.field(2)->Type().GetStorableType(), ADDRESS_HOME_LINE2); } // Tests proper resolution heuristic, server and html field types when the
diff --git a/components/autofill/core/browser/merchant_promo_code_manager.cc b/components/autofill/core/browser/merchant_promo_code_manager.cc index 31b3ca4..6254d022 100644 --- a/components/autofill/core/browser/merchant_promo_code_manager.cc +++ b/components/autofill/core/browser/merchant_promo_code_manager.cc
@@ -46,7 +46,7 @@ context.form_structure->main_frame_origin().GetURL()); if (!promo_code_offers.empty()) { SendPromoCodeSuggestions( - promo_code_offers, field.name, + promo_code_offers, field.global_id(), QueryHandler(query_id, autoselect_first_suggestion, field.value, handler)); return true; @@ -84,12 +84,12 @@ } void MerchantPromoCodeManager::UMARecorder::OnOffersSuggestionsShown( - const std::u16string& name, + const FieldGlobalId& field_global_id, const std::vector<const AutofillOfferData*>& offers) { // Log metrics related to the showing of overall offers suggestions popup. autofill_metrics::LogOffersSuggestionsPopupShown( - /*first_time_being_logged=*/most_recent_suggestions_shown_field_name_ != - name); + /*first_time_being_logged=*/ + most_recent_suggestions_shown_field_global_id_ != field_global_id); // Log metrics related to the showing of individual offers in the offers // suggestions popup. @@ -102,14 +102,14 @@ // We log that this individual offer suggestion was shown once for this // field while autofilling if it is the first time being logged. - if (most_recent_suggestions_shown_field_name_ != name) { + if (most_recent_suggestions_shown_field_global_id_ != field_global_id) { autofill_metrics::LogIndividualOfferSuggestionEvent( autofill_metrics::OffersSuggestionsEvent::kOfferSuggestionShownOnce, offer->GetOfferType()); } } - most_recent_suggestions_shown_field_name_ = name; + most_recent_suggestions_shown_field_global_id_ = field_global_id; } void MerchantPromoCodeManager::UMARecorder::OnOfferSuggestionSelected( @@ -123,8 +123,8 @@ // We log that this individual offer suggestion was selected once for this // field while autofilling if it is the first time being logged. - if (most_recent_suggestion_selected_field_name_ != - most_recent_suggestions_shown_field_name_) { + if (most_recent_suggestion_selected_field_global_id_ != + most_recent_suggestions_shown_field_global_id_) { autofill_metrics::LogIndividualOfferSuggestionEvent( autofill_metrics::OffersSuggestionsEvent:: kOfferSuggestionSelectedOnce, @@ -142,8 +142,8 @@ // We log that this individual see offer details suggestion in the footer // was selected once for this field while autofilling if it is the first // time being logged. - if (most_recent_suggestion_selected_field_name_ != - most_recent_suggestions_shown_field_name_) { + if (most_recent_suggestion_selected_field_global_id_ != + most_recent_suggestions_shown_field_global_id_) { autofill_metrics::LogIndividualOfferSuggestionEvent( autofill_metrics::OffersSuggestionsEvent:: kOfferSuggestionSeeOfferDetailsSelectedOnce, @@ -151,13 +151,13 @@ } } - most_recent_suggestion_selected_field_name_ = - most_recent_suggestions_shown_field_name_; + most_recent_suggestion_selected_field_global_id_ = + most_recent_suggestions_shown_field_global_id_; } void MerchantPromoCodeManager::SendPromoCodeSuggestions( const std::vector<const AutofillOfferData*>& promo_code_offers, - const std::u16string& field_name, + const FieldGlobalId& field_global_id, const QueryHandler& query_handler) { if (!query_handler.handler_) { // Either the handler has been destroyed, or it is invalid. @@ -186,7 +186,7 @@ promo_code_offers)); // Log that promo code autofill suggestions were shown. - uma_recorder_.OnOffersSuggestionsShown(field_name, promo_code_offers); + uma_recorder_.OnOffersSuggestionsShown(field_global_id, promo_code_offers); } } // namespace autofill
diff --git a/components/autofill/core/browser/merchant_promo_code_manager.h b/components/autofill/core/browser/merchant_promo_code_manager.h index 218e412..51a2fbc 100644 --- a/components/autofill/core/browser/merchant_promo_code_manager.h +++ b/components/autofill/core/browser/merchant_promo_code_manager.h
@@ -8,6 +8,7 @@ #include "components/autofill/core/browser/autofill_subject.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/single_field_form_filler.h" +#include "components/autofill/core/common/unique_ids.h" #include "components/keyed_service/core/keyed_service.h" #include "components/webdata/common/web_data_service_consumer.h" @@ -78,28 +79,28 @@ ~UMARecorder() = default; void OnOffersSuggestionsShown( - const std::u16string& name, + const FieldGlobalId& field_global_id, const std::vector<const AutofillOfferData*>& offers); void OnOfferSuggestionSelected(int frontend_id); private: - // The name of the field that most recently had suggestions shown. - std::u16string most_recent_suggestions_shown_field_name_; + // The global id of the field that most recently had suggestions shown. + FieldGlobalId most_recent_suggestions_shown_field_global_id_; - // The name of the field that most recently had a suggestion selected. - std::u16string most_recent_suggestion_selected_field_name_; + // The global id of the field that most recently had a suggestion selected. + FieldGlobalId most_recent_suggestion_selected_field_global_id_; }; - // Sends suggestions for |promo_code_offers| to the |query_handler|'s handler + // Sends suggestions for `promo_code_offers` to the `query_handler`'s handler // for display in the associated Autofill popup. If suggestions were // displayed, this function also logs metrics for promo code suggestions - // shown. |field_name| is used for this metrics logging, as it checks whether - // the field where promo code suggestions are being shown has just had + // shown. `field_global_id` is used for this metrics logging, as it checks + // whether the field where promo code suggestions are being shown has just had // suggestions shown. This ensures we to log to the correct histogram, as we // have separate histograms for unique shows and repetitive shows. void SendPromoCodeSuggestions( const std::vector<const AutofillOfferData*>& promo_code_offers, - const std::u16string& field_name, + const FieldGlobalId& field_global_id, const QueryHandler& query_handler); raw_ptr<PersonalDataManager> personal_data_manager_ = nullptr;
diff --git a/components/autofill/core/browser/merchant_promo_code_manager_unittest.cc b/components/autofill/core/browser/merchant_promo_code_manager_unittest.cc index 65db0a5..8d75fbb 100644 --- a/components/autofill/core/browser/merchant_promo_code_manager_unittest.cc +++ b/components/autofill/core/browser/merchant_promo_code_manager_unittest.cc
@@ -10,6 +10,7 @@ #include "components/autofill/core/browser/metrics/payments/offers_metrics.h" #include "components/autofill/core/browser/suggestions_context.h" #include "components/autofill/core/browser/test_personal_data_manager.h" +#include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/autofill_payments_features.h" #include "components/autofill/core/common/form_data.h" #include "components/strings/grit/components_strings.h" @@ -56,6 +57,8 @@ class MerchantPromoCodeManagerTest : public testing::Test { protected: MerchantPromoCodeManagerTest() { + scoped_feature_list_async_parse_form_.InitWithFeatureState( + features::kAutofillParseAsync, true); personal_data_manager_ = std::make_unique<TestPersonalDataManager>(); merchant_promo_code_manager_ = std::make_unique<MerchantPromoCodeManager>(); merchant_promo_code_manager_->Init(personal_data_manager_.get(), @@ -89,6 +92,7 @@ out->focused_field = &autofill_field_; } + base::test::ScopedFeatureList scoped_feature_list_async_parse_form_; test::AutofillEnvironment autofill_environment_; std::unique_ptr<MerchantPromoCodeManager> merchant_promo_code_manager_; std::unique_ptr<TestPersonalDataManager> personal_data_manager_;
diff --git a/components/autofill/core/browser/metrics/autofill_metrics_test_base.cc b/components/autofill/core/browser/metrics/autofill_metrics_test_base.cc index 801259d9..951171b 100644 --- a/components/autofill/core/browser/metrics/autofill_metrics_test_base.cc +++ b/components/autofill/core/browser/metrics/autofill_metrics_test_base.cc
@@ -8,6 +8,7 @@ #include "components/autofill/core/browser/data_model/credit_card.h" #include "components/autofill/core/browser/payments/credit_card_access_manager.h" #include "components/autofill/core/common/autofill_clock.h" +#include "components/autofill/core/common/autofill_features.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #if !BUILDFLAG(IS_IOS) @@ -30,7 +31,10 @@ MockAutofillClient::~MockAutofillClient() = default; AutofillMetricsBaseTest::AutofillMetricsBaseTest(bool is_in_any_main_frame) - : is_in_any_main_frame_(is_in_any_main_frame) {} + : is_in_any_main_frame_(is_in_any_main_frame) { + scoped_feature_list_async_parse_form_.InitAndEnableFeature( + features::kAutofillParseAsync); +} AutofillMetricsBaseTest::~AutofillMetricsBaseTest() = default;
diff --git a/components/autofill/core/browser/metrics/autofill_metrics_test_base.h b/components/autofill/core/browser/metrics/autofill_metrics_test_base.h index dede3ef4..061f5ae 100644 --- a/components/autofill/core/browser/metrics/autofill_metrics_test_base.h +++ b/components/autofill/core/browser/metrics/autofill_metrics_test_base.h
@@ -133,11 +133,11 @@ syncer::TestSyncService sync_service_; std::unique_ptr<TestAutofillDriver> autofill_driver_; raw_ptr<AutofillExternalDelegate> external_delegate_; - base::test::ScopedFeatureList scoped_feature_list_; private: void CreateTestAutofillProfiles(); + base::test::ScopedFeatureList scoped_feature_list_async_parse_form_; CreditCard credit_card_ = test::GetMaskedServerCard(); };
diff --git a/components/autofill/core/browser/metrics/autofill_metrics_unittest.cc b/components/autofill/core/browser/metrics/autofill_metrics_unittest.cc index eace38f5..2b70e09 100644 --- a/components/autofill/core/browser/metrics/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/metrics/autofill_metrics_unittest.cc
@@ -470,7 +470,8 @@ // autocomplete attribute at submission time. TEST_F(AutofillMetricsTest, NumberOfAutofilledFieldsWithAutocompleteUnrecognizedAtSubmission) { - scoped_feature_list_.InitAndEnableFeature( + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature( features::kAutofillFillAndImportFromMoreFields); // Set up our form data with two autofilled fields. FormData form = @@ -4431,7 +4432,8 @@ // Test that we log preflight calls for credit card unmasking. TEST_F(AutofillMetricsTest, CreditCardUnmaskingPreflightCall) { - scoped_feature_list_.InitAndEnableFeature( + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); std::string preflight_call_metric = "Autofill.BetterAuth.CardUnmaskPreflightCalled"; @@ -7154,9 +7156,6 @@ // Test that we log the verification status of name tokens. TEST_F(AutofillMetricsTest, LogVerificationStatusesOfNameTokens) { - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - base::HistogramTester histogram_tester; AutofillProfile profile; profile.SetRawInfoWithVerificationStatus( @@ -7198,9 +7197,6 @@ // Test that we log the verification status of address tokens.. TEST_F(AutofillMetricsTest, LogVerificationStatusesOfAddressTokens) { - scoped_feature_list_.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInAddresses); - base::HistogramTester histogram_tester; AutofillProfile profile; profile.SetRawInfoWithVerificationStatus(
diff --git a/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc b/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc index 36a00ea..e5d98500 100644 --- a/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_save_manager_unittest.cc
@@ -168,6 +168,11 @@ class CreditCardSaveManagerTest : public testing::Test { public: + CreditCardSaveManagerTest() { + scoped_feature_list_async_parse_form_.InitWithFeatureState( + features::kAutofillParseAsync, true); + } + void SetUp() override { autofill_client_.SetPrefs(test::PrefServiceForTesting()); std::unique_ptr<TestStrikeDatabase> test_strike_database = @@ -418,6 +423,8 @@ NOTREACHED(); return 0; } + + base::test::ScopedFeatureList scoped_feature_list_async_parse_form_; }; // Tests that credit card data are saved for forms on https
diff --git a/components/autofill/core/browser/single_field_form_fill_router_unittest.cc b/components/autofill/core/browser/single_field_form_fill_router_unittest.cc index 02ad6be..c341bf66 100644 --- a/components/autofill/core/browser/single_field_form_fill_router_unittest.cc +++ b/components/autofill/core/browser/single_field_form_fill_router_unittest.cc
@@ -61,6 +61,9 @@ class SingleFieldFormFillRouterTest : public testing::Test { protected: SingleFieldFormFillRouterTest() { + scoped_feature_list_async_parse_form_.InitWithFeatureState( + features::kAutofillParseAsync, true); + prefs_ = test::PrefServiceForTesting(); // Mock such that we don't trigger the cleanup. @@ -85,6 +88,7 @@ "SomeType", &test_field_); } + base::test::ScopedFeatureList scoped_feature_list_async_parse_form_; base::test::SingleThreadTaskEnvironment task_environment_; test::AutofillEnvironment autofill_environment_; std::unique_ptr<SingleFieldFormFillRouter> single_field_form_fill_router_;
diff --git a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc index b6a3ee4c..352a769 100644 --- a/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_profile_sync_bridge_unittest.cc
@@ -261,16 +261,15 @@ } // namespace -class AutofillProfileSyncBridgeTestBase : public testing::Test { +class AutofillProfileSyncBridgeTest : public testing::Test { public: - AutofillProfileSyncBridgeTestBase() = default; + AutofillProfileSyncBridgeTest() = default; - AutofillProfileSyncBridgeTestBase(const AutofillProfileSyncBridgeTestBase&) = - delete; - AutofillProfileSyncBridgeTestBase& operator=( - const AutofillProfileSyncBridgeTestBase&) = delete; + AutofillProfileSyncBridgeTest(const AutofillProfileSyncBridgeTest&) = delete; + AutofillProfileSyncBridgeTest& operator=( + const AutofillProfileSyncBridgeTest&) = delete; - ~AutofillProfileSyncBridgeTestBase() override = default; + ~AutofillProfileSyncBridgeTest() override = default; void SetUp() override { // Fix a time for implicitly constructed use_dates in AutofillProfile. @@ -382,37 +381,7 @@ std::unique_ptr<AutofillProfileSyncBridge> bridge_; }; -// This class performs the sync bridge test with and without structured names -// enabled. -class AutofillProfileSyncBridgeTest : public AutofillProfileSyncBridgeTestBase, - public testing::WithParamInterface<bool> { - public: - void SetUp() override { - InitializeFeatures(); - AutofillProfileSyncBridgeTestBase::SetUp(); - } - - void InitializeFeatures() { - bool structured_names_enabled = GetParam(); - if (structured_names_enabled) { - scoped_features_.InitAndEnableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - } else { - scoped_features_.InitAndDisableFeature( - features::kAutofillEnableSupportForMoreStructureInNames); - } - } - - bool UsingStructuredNames() const { - return base::FeatureList::IsEnabled( - features::kAutofillEnableSupportForMoreStructureInNames); - } - - private: - base::test::ScopedFeatureList scoped_features_; -}; - -TEST_P(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Added) { +TEST_F(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Added) { StartSyncing({}); AutofillProfile local(kGuidA, kHttpsOrigin); @@ -431,7 +400,7 @@ } // Language code in autofill profiles should be synced to the server. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Added_LanguageCodePropagates) { StartSyncing({}); @@ -450,7 +419,7 @@ } // Validity state bitfield in autofill profiles should be synced to the server. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Added_LocalValidityBitfieldPropagates) { StartSyncing({}); @@ -468,7 +437,7 @@ } // Local updates should be properly propagated to the server. -TEST_P(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Updated) { +TEST_F(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Updated) { StartSyncing({}); AutofillProfile local(kGuidA, kHttpsOrigin); @@ -486,7 +455,7 @@ } // Usage stats should be updated by the client. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Updated_UsageStatsOverwrittenByClient) { // Remote data has a profile with usage stats. AutofillProfileSpecifics remote = @@ -517,7 +486,7 @@ } // Server profile updates should be ignored. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Updated_IgnoreServerProfiles) { StartSyncing({}); @@ -530,7 +499,7 @@ bridge()->AutofillProfileChanged(change); } -TEST_P(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Deleted) { +TEST_F(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Deleted) { StartSyncing({}); AutofillProfile local(kGuidB, kHttpsOrigin); @@ -545,7 +514,7 @@ } // Server profile updates should be ignored. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, AutofillProfileChanged_Deleted_IgnoreServerProfiles) { StartSyncing({}); @@ -558,7 +527,7 @@ bridge()->AutofillProfileChanged(change); } -TEST_P(AutofillProfileSyncBridgeTest, GetAllDataForDebugging) { +TEST_F(AutofillProfileSyncBridgeTest, GetAllDataForDebugging) { AutofillProfile local1 = AutofillProfile(kGuidA, kHttpsOrigin); local1.SetRawInfo(NAME_FIRST, u"John"); local1.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, u"1 1st st"); @@ -572,7 +541,7 @@ EXPECT_THAT(GetAllLocalData(), UnorderedElementsAre(local1, local2)); } -TEST_P(AutofillProfileSyncBridgeTest, GetData) { +TEST_F(AutofillProfileSyncBridgeTest, GetData) { AutofillProfile local1 = AutofillProfile(kGuidA, kHttpsOrigin); local1.SetRawInfo(NAME_FIRST, u"John"); local1.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, u"1 1st st"); @@ -597,7 +566,7 @@ EXPECT_THAT(data, ElementsAre(local1)); } -TEST_P(AutofillProfileSyncBridgeTest, MergeSyncData) { +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData) { AutofillProfile local1 = AutofillProfile(kGuidA, kHttpOrigin); local1.SetRawInfo(NAME_FIRST, u"John"); local1.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, u"1 1st st"); @@ -647,11 +616,7 @@ // Tests the profile migration that is performed after specifics are converted // to profiles. -TEST_P(AutofillProfileSyncBridgeTest, ProfileMigration) { - // This test is only applicable when structured names are enabled. - if (!UsingStructuredNames()) - return; - +TEST_F(AutofillProfileSyncBridgeTest, ProfileMigration) { AutofillProfile remote1 = AutofillProfile(kGuidC, kHttpOrigin); remote1.SetRawInfo(NAME_FIRST, u"Thomas"); remote1.SetRawInfo(NAME_MIDDLE, u"Neo"); @@ -690,7 +655,7 @@ // Ensure that all profile fields are able to be synced up from the client to // the server. -TEST_P(AutofillProfileSyncBridgeTest, MergeSyncData_SyncAllFieldsToServer) { +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_SyncAllFieldsToServer) { AutofillProfile local = ConstructCompleteProfile(); local.FinalizeAfterImport(); AddAutofillProfilesToTable({local}); @@ -708,7 +673,7 @@ // Ensure that all profile fields are able to be synced down from the server to // the client (and nothing gets uploaded back). -TEST_P(AutofillProfileSyncBridgeTest, MergeSyncData_SyncAllFieldsToClient) { +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_SyncAllFieldsToClient) { EXPECT_CALL(mock_processor(), Put).Times(0); EXPECT_CALL(*backend(), CommitChanges()); StartSyncing({ConstructCompleteSpecifics()}); @@ -717,7 +682,7 @@ ElementsAre(WithUsageStats(ConstructCompleteProfile()))); } -TEST_P(AutofillProfileSyncBridgeTest, MergeSyncData_IdenticalProfiles) { +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_IdenticalProfiles) { AutofillProfile local1 = AutofillProfile(kGuidA, kHttpOrigin); local1.SetRawInfoWithVerificationStatus( NAME_FIRST, u"John", structured_address::VerificationStatus::kObserved); @@ -772,7 +737,7 @@ CreateAutofillProfile(merged2))); } -TEST_P(AutofillProfileSyncBridgeTest, MergeSyncData_NonSimilarProfiles) { +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_NonSimilarProfiles) { AutofillProfile local = ConstructCompleteProfile(); local.set_guid(kGuidA); local.SetRawInfo(NAME_FULL, u"John K. Doe, Jr."); @@ -806,7 +771,7 @@ UnorderedElementsAre(local, CreateAutofillProfile(remote))); } -TEST_P(AutofillProfileSyncBridgeTest, MergeSyncData_SimilarProfiles) { +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_SimilarProfiles) { AutofillProfile local1 = AutofillProfile(kGuidA, kHttpOrigin); local1.SetRawInfo(NAME_FIRST, u"John"); local1.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, u"1 1st st"); @@ -847,16 +812,9 @@ // should never overwrite a verified one. AutofillProfileSpecifics merged1(remote1_specifics); merged1.set_origin(kHttpOrigin); - // For the legacy implementation, the full name field gets popluated by the - // merging operation and must be added to the expectation. - // For structured names, the full name is already populated by calling - // |FinalizeAfterImport()|. - if (UsingStructuredNames()) { - ASSERT_GT(merged1.name_full_size(), 0); - ASSERT_EQ(merged1.name_full(0), "John"); - } else { - merged1.set_name_full(0, "John"); - } + ASSERT_GT(merged1.name_full_size(), 0); + ASSERT_EQ(merged1.name_full(0), "John"); + // Merging two profile takes their max use count. merged1.set_use_count(27); @@ -878,7 +836,7 @@ // Tests that MergeSimilarProfiles keeps the most recent use date of the two // profiles being merged. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_SimilarProfiles_OlderUseDate) { // Different guids, same origin, difference in the phone number. AutofillProfile local(kGuidA, kHttpOrigin); @@ -903,7 +861,7 @@ // Tests that MergeSimilarProfiles keeps the most recent use date of the two // profiles being merged. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_SimilarProfiles_NewerUseDate) { // Different guids, same origin, difference in the phone number. AutofillProfile local(kGuidA, kHttpOrigin); @@ -927,7 +885,7 @@ // Tests that MergeSimilarProfiles saves the max of the use counts of the two // profiles in |remote|. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_SimilarProfiles_NonZeroUseCounts) { // Different guids, same origin, difference in the phone number. AutofillProfile local(kGuidA, kHttpOrigin); @@ -951,7 +909,7 @@ // Tests that when merging similar profiles for initial sync, we add the // additional information of |local| into |remote|. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_SimilarProfiles_LocalOriginPreserved) { AutofillProfile local(kGuidA, kHttpsOrigin); local.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"650234567"); @@ -980,7 +938,7 @@ // Sync data without origin should not overwrite existing origin in local // autofill profile. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_SimilarProfiles_LocalExistingOriginPreserved) { AutofillProfile local(kGuidA, kHttpsOrigin); local.FinalizeAfterImport(); @@ -1008,7 +966,7 @@ // Ensure that no Sync events are generated to fill in missing origins from Sync // with explicitly present empty ones. This ensures that the migration to add // origins to profiles does not generate lots of needless Sync updates. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, MergeSyncData_SimilarProfiles_LocalMissingOriginPreserved) { AutofillProfile local = AutofillProfile(kGuidA, std::string()); local.SetRawInfo(NAME_FIRST, u"John"); @@ -1030,7 +988,7 @@ EXPECT_THAT(GetAllLocalData(), ElementsAre(local)); } -TEST_P(AutofillProfileSyncBridgeTest, ApplySyncChanges) { +TEST_F(AutofillProfileSyncBridgeTest, ApplySyncChanges) { AutofillProfile local = AutofillProfile(kGuidA, kHttpsOrigin); local.FinalizeAfterImport(); AddAutofillProfilesToTable({local}); @@ -1057,7 +1015,7 @@ } // Ensure that entries with invalid specifics are ignored. -TEST_P(AutofillProfileSyncBridgeTest, ApplySyncChanges_OmitsInvalidSpecifics) { +TEST_F(AutofillProfileSyncBridgeTest, ApplySyncChanges_OmitsInvalidSpecifics) { StartSyncing({}); AutofillProfileSpecifics remote_valid = @@ -1081,7 +1039,7 @@ // Verifies that setting the street address field also sets the (deprecated) // address line 1 and line 2 fields. -TEST_P(AutofillProfileSyncBridgeTest, StreetAddress_SplitAutomatically) { +TEST_F(AutofillProfileSyncBridgeTest, StreetAddress_SplitAutomatically) { AutofillProfile local; local.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, u"123 Example St.\nApt. 42"); EXPECT_EQ(u"123 Example St.", local.GetRawInfo(ADDRESS_HOME_LINE1)); @@ -1098,7 +1056,7 @@ // Verifies that setting the (deprecated) address line 1 and line 2 fields also // sets the street address. -TEST_P(AutofillProfileSyncBridgeTest, StreetAddress_JointAutomatically) { +TEST_F(AutofillProfileSyncBridgeTest, StreetAddress_JointAutomatically) { AutofillProfile local; local.SetRawInfo(ADDRESS_HOME_LINE1, u"123 Example St."); local.SetRawInfo(ADDRESS_HOME_LINE2, u"Apt. 42"); @@ -1115,7 +1073,7 @@ // Ensure that the street address field takes precedence over the (deprecated) // address line 1 and line 2 fields, even though these are expected to always be // in sync in practice. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_StreetAddress_TakesPrecedenceOverAddressLines) { // Create remote entry with conflicting address data in the street address // field vs. the address line 1 and address line 2 fields. @@ -1151,7 +1109,7 @@ // the line1 and line2 fields. This ensures that the migration to add the // street address field to profiles does not generate lots of needless Sync // updates. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_StreetAddress_NoUpdateToEmptyStreetAddressSyncedUp) { AutofillProfile local(kGuidA, kHttpsOrigin); local.SetRawInfoWithVerificationStatus( @@ -1175,7 +1133,7 @@ } // Missing language code field should not generate sync events. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_LanguageCode_MissingCodesNoSync) { AutofillProfile local(kGuidA, kHttpsOrigin); ASSERT_TRUE(local.language_code().empty()); @@ -1194,7 +1152,7 @@ } // Empty language code should be overwritten by sync. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_LanguageCode_ExistingRemoteWinsOverMissingLocal) { AutofillProfile local(kGuidA, kHttpsOrigin); ASSERT_TRUE(local.language_code().empty()); @@ -1213,7 +1171,7 @@ } // Local language code should be overwritten by remote one. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_LanguageCode_ExistingRemoteWinsOverExistingLocal) { AutofillProfile local(kGuidA, kHttpsOrigin); local.set_language_code("de"); @@ -1233,7 +1191,7 @@ // Sync data without language code should not overwrite existing language code // in local autofill profile. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_LanguageCode_ExistingLocalWinsOverMissingRemote) { // Local autofill profile has "en" language code. AutofillProfile local(kGuidA, kHttpsOrigin); @@ -1261,7 +1219,7 @@ } // Missing validity state bitifield should not generate sync events. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_ValidityState_DefaultValueNoSync) { AutofillProfile local(kGuidA, kHttpsOrigin); AddAutofillProfilesToTable({local}); @@ -1280,7 +1238,7 @@ } // Default validity state bitfield should be overwritten by sync. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_ValidityState_ExistingRemoteWinsOverMissingLocal) { AutofillProfile local(kGuidA, kHttpsOrigin); AddAutofillProfilesToTable({local}); @@ -1299,7 +1257,7 @@ } // Local validity state bitfield should be overwritten by sync. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_ValidityState_ExistingRemoteWinsOverExistingLocal) { AutofillProfile local(kGuidA, kHttpsOrigin); AddAutofillProfilesToTable({local}); @@ -1319,7 +1277,7 @@ // Sync data without a default validity state bitfield should not overwrite // an existing validity state bitfield in local autofill profile. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_ValidityState_ExistingLocalWinsOverMissingRemote) { AutofillProfile local(kGuidA, kHttpsOrigin); AddAutofillProfilesToTable({local}); @@ -1343,7 +1301,7 @@ } // Missing full name field should not generate sync events. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_FullName_MissingValueNoSync) { // Local autofill profile has an empty full name. AutofillProfile local(kGuidA, kHttpsOrigin); @@ -1368,7 +1326,7 @@ // However, this is not a valid use case for structured names as name structures // must be either merged or fully maintained. For structured names, this test // verifies that the names are merged. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_FullName_ExistingLocalWinsOverMissingRemote) { // Local autofill profile has a full name. AutofillProfile local(kGuidA, kHttpsOrigin); @@ -1378,16 +1336,14 @@ local.FinalizeAfterImport(); AddAutofillProfilesToTable({local}); - if (UsingStructuredNames()) { - // After finalization, the first, middle and last name should have the - // status |kParsed|. - ASSERT_EQ(local.GetVerificationStatus(NAME_FIRST), - structured_address::VerificationStatus::kParsed); - ASSERT_EQ(local.GetVerificationStatus(NAME_MIDDLE), - structured_address::VerificationStatus::kParsed); - ASSERT_EQ(local.GetVerificationStatus(NAME_LAST), - structured_address::VerificationStatus::kParsed); - } + // After finalization, the first, middle and last name should have the + // status |kParsed|. + ASSERT_EQ(local.GetVerificationStatus(NAME_FIRST), + structured_address::VerificationStatus::kParsed); + ASSERT_EQ(local.GetVerificationStatus(NAME_MIDDLE), + structured_address::VerificationStatus::kParsed); + ASSERT_EQ(local.GetVerificationStatus(NAME_LAST), + structured_address::VerificationStatus::kParsed); // Remote data does not have a full name value. AutofillProfile remote_profile = AutofillProfile(kGuidA, kHttpsOrigin); @@ -1422,7 +1378,7 @@ } // Missing use_count/use_date fields should not generate sync events. -TEST_P(AutofillProfileSyncBridgeTest, +TEST_F(AutofillProfileSyncBridgeTest, RemoteWithSameGuid_UsageStats_MissingValueNoSync) { // Local autofill profile has 0 for use_count/use_date. AutofillProfile local(kGuidA, kHttpsOrigin); @@ -1455,7 +1411,7 @@ }; class AutofillProfileSyncBridgeUpdatesUsageStatsTest - : public AutofillProfileSyncBridgeTestBase, + : public AutofillProfileSyncBridgeTest, public testing::WithParamInterface<UpdatesUsageStatsTestCase> { public: AutofillProfileSyncBridgeUpdatesUsageStatsTest() {} @@ -1502,9 +1458,6 @@ EXPECT_THAT(GetAllLocalData(), ElementsAre(WithUsageStats(merged))); } -// Test the sync bridge with and without structured names. -INSTANTIATE_TEST_SUITE_P(, AutofillProfileSyncBridgeTest, testing::Bool()); - INSTANTIATE_TEST_SUITE_P( AutofillProfileSyncBridgeTest, AutofillProfileSyncBridgeUpdatesUsageStatsTest,
diff --git a/components/browsing_topics/browsing_topics_calculator_unittest.cc b/components/browsing_topics/browsing_topics_calculator_unittest.cc index 9074e74..9c91b58 100644 --- a/components/browsing_topics/browsing_topics_calculator_unittest.cc +++ b/components/browsing_topics/browsing_topics_calculator_unittest.cc
@@ -70,6 +70,7 @@ std::move(privacy_sandbox_delegate), host_content_settings_map_.get(), cookie_settings_, &prefs_, /*incognito_profile=*/false); + privacy_sandbox_settings_->SetPrivacySandboxEnabled(true); topics_site_data_manager_ = std::make_unique<content::TesterBrowsingTopicsSiteDataManager>(
diff --git a/components/browsing_topics/browsing_topics_service_impl_unittest.cc b/components/browsing_topics/browsing_topics_service_impl_unittest.cc index c32b2c8..7ba445f 100644 --- a/components/browsing_topics/browsing_topics_service_impl_unittest.cc +++ b/components/browsing_topics/browsing_topics_service_impl_unittest.cc
@@ -182,6 +182,7 @@ std::move(privacy_sandbox_delegate), host_content_settings_map_.get(), cookie_settings_, &prefs_, /*incognito_profile=*/false); + privacy_sandbox_settings_->SetPrivacySandboxEnabled(true); history_service_ = std::make_unique<history::HistoryService>(); history_service_->Init(
diff --git a/components/commerce/core/shopping_bookmark_model_observer.cc b/components/commerce/core/shopping_bookmark_model_observer.cc index ca2a95a..21cec1d 100644 --- a/components/commerce/core/shopping_bookmark_model_observer.cc +++ b/components/commerce/core/shopping_bookmark_model_observer.cc
@@ -13,6 +13,7 @@ #include "components/commerce/core/price_tracking_utils.h" #include "components/commerce/core/shopping_service.h" #include "components/commerce/core/subscriptions/commerce_subscription.h" +#include "components/commerce/core/subscriptions/subscriptions_manager.h" #include "components/power_bookmarks/core/power_bookmark_utils.h" #include "components/power_bookmarks/core/proto/power_bookmark_meta.pb.h" #include "components/power_bookmarks/core/proto/shopping_specifics.pb.h" @@ -21,8 +22,10 @@ ShoppingBookmarkModelObserver::ShoppingBookmarkModelObserver( bookmarks::BookmarkModel* model, - ShoppingService* shopping_service) - : shopping_service_(shopping_service) { + ShoppingService* shopping_service, + SubscriptionsManager* subscriptions_manager) + : shopping_service_(shopping_service), + subscriptions_manager_(subscriptions_manager) { scoped_observation_.Observe(model); } @@ -40,17 +43,30 @@ void ShoppingBookmarkModelObserver::BookmarkNodeChanged( bookmarks::BookmarkModel* model, const bookmarks::BookmarkNode* node) { - if (node_to_url_map_[node->id()] != node->url()) { - // If the URL did change, clear the power bookmark shopping meta and - // unsubscribe if needed. - std::unique_ptr<power_bookmarks::PowerBookmarkMeta> meta = - power_bookmarks::GetNodePowerBookmarkMeta(model, node); + std::unique_ptr<power_bookmarks::PowerBookmarkMeta> meta = + power_bookmarks::GetNodePowerBookmarkMeta(model, node); - if (meta && meta->has_shopping_specifics()) { - power_bookmarks::ShoppingSpecifics* specifics = - meta->mutable_shopping_specifics(); + if (meta && meta->has_shopping_specifics()) { + power_bookmarks::ShoppingSpecifics* specifics = + meta->mutable_shopping_specifics(); + uint64_t cluster_id = specifics->product_cluster_id(); - uint64_t cluster_id = specifics->product_cluster_id(); + // If the changed bookmark is a shopping item, we check its tracking status + // with local subscriptions and if inconsistent, we need to sync local + // subscriptions with the server. This is mainly used to keep local + // subscriptions up to date when users operate on multiple devices. + if (subscriptions_manager_) { + CommerceSubscription sub( + SubscriptionType::kPriceTrack, IdentifierType::kProductClusterId, + base::NumberToString(cluster_id), ManagementType::kUserManaged); + + subscriptions_manager_->VerifyIfSubscriptionExists( + std::move(sub), specifics->is_price_tracked()); + } + + if (node_to_url_map_[node->id()] != node->url()) { + // If the URL did change, clear the power bookmark shopping meta and + // unsubscribe if needed. meta->clear_shopping_specifics(); power_bookmarks::SetNodePowerBookmarkMeta(model, node, std::move(meta));
diff --git a/components/commerce/core/shopping_bookmark_model_observer.h b/components/commerce/core/shopping_bookmark_model_observer.h index 4cbf0b6..3bda2db 100644 --- a/components/commerce/core/shopping_bookmark_model_observer.h +++ b/components/commerce/core/shopping_bookmark_model_observer.h
@@ -22,6 +22,7 @@ namespace commerce { class ShoppingService; +class SubscriptionsManager; // A utility class that watches for changes in bookmark URLs. In the case that // the bookmark was a shopping item, the meta should be removed since we can't @@ -34,7 +35,8 @@ : public bookmarks::BaseBookmarkModelObserver { public: ShoppingBookmarkModelObserver(bookmarks::BookmarkModel* model, - ShoppingService* shopping_service); + ShoppingService* shopping_service, + SubscriptionsManager* subscriptions_manager); ShoppingBookmarkModelObserver(const ShoppingBookmarkModelObserver&) = delete; ShoppingBookmarkModelObserver& operator=( const ShoppingBookmarkModelObserver&) = delete; @@ -58,6 +60,8 @@ private: base::raw_ptr<ShoppingService> shopping_service_; + base::raw_ptr<SubscriptionsManager> subscriptions_manager_; + // A map of bookmark ID to its current URL. This is used to detect incoming // changes to the URL since there isn't an explicit event for it. std::map<int64_t, GURL> node_to_url_map_;
diff --git a/components/commerce/core/shopping_service.cc b/components/commerce/core/shopping_service.cc index 7b266d0..e51138e 100644 --- a/components/commerce/core/shopping_service.cc +++ b/components/commerce/core/shopping_service.cc
@@ -109,7 +109,8 @@ if (bookmark_model) { shopping_bookmark_observer_ = - std::make_unique<ShoppingBookmarkModelObserver>(bookmark_model, this); + std::make_unique<ShoppingBookmarkModelObserver>( + bookmark_model, this, subscriptions_manager_.get()); } if (power_bookmark_service_ && IsProductInfoApiEnabled()) {
diff --git a/components/commerce/core/shopping_service.h b/components/commerce/core/shopping_service.h index 356e109..b0bdd035 100644 --- a/components/commerce/core/shopping_service.h +++ b/components/commerce/core/shopping_service.h
@@ -336,6 +336,8 @@ std::unique_ptr<AccountChecker> account_checker_; + std::unique_ptr<SubscriptionsManager> subscriptions_manager_; + raw_ptr<power_bookmarks::PowerBookmarkService> power_bookmark_service_; // The service's means of observing the bookmark model which is automatically @@ -354,8 +356,6 @@ std::tuple<uint32_t, bool, std::unique_ptr<ProductInfo>>> product_info_cache_; - std::unique_ptr<SubscriptionsManager> subscriptions_manager_; - std::unique_ptr<BookmarkUpdateManager> bookmark_update_manager_; // Ensure certain functions are being executed on the same thread.
diff --git a/components/commerce/core/subscriptions/subscriptions_manager.cc b/components/commerce/core/subscriptions/subscriptions_manager.cc index de7b223..30b3ed1 100644 --- a/components/commerce/core/subscriptions/subscriptions_manager.cc +++ b/components/commerce/core/subscriptions/subscriptions_manager.cc
@@ -232,6 +232,26 @@ } } +void SubscriptionsManager::VerifyIfSubscriptionExists( + CommerceSubscription subscription, + bool should_exist) { + storage_->IsSubscribed( + std::move(subscription), + base::BindOnce( + &SubscriptionsManager::HandleCheckLocalSubscriptionResponse, + weak_ptr_factory_.GetWeakPtr(), should_exist)); +} + +void SubscriptionsManager::HandleCheckLocalSubscriptionResponse( + bool should_exist, + bool is_subscribed) { + // Don't init if there is already a request running to avoid redundant server + // calls. + if (should_exist != is_subscribed && !has_request_running_) { + InitSubscriptions(); + } +} + void SubscriptionsManager::OnPrimaryAccountChanged( const signin::PrimaryAccountChangeEvent& event_details) { InitSubscriptions();
diff --git a/components/commerce/core/subscriptions/subscriptions_manager.h b/components/commerce/core/subscriptions/subscriptions_manager.h index 5eec6d69..a94a519e5 100644 --- a/components/commerce/core/subscriptions/subscriptions_manager.h +++ b/components/commerce/core/subscriptions/subscriptions_manager.h
@@ -57,6 +57,13 @@ std::unique_ptr<std::vector<CommerceSubscription>> subscriptions, base::OnceCallback<void(bool)> callback); + // If a |subscription| should exist but we cannot find it in local + // subscriptions, or vice versa, we should sync local subscriptions with the + // server. This is mainly used to keep local subscriptions up to date when + // users operate on multiple devices. + void VerifyIfSubscriptionExists(CommerceSubscription subscription, + bool should_exist); + // For tests only, return init_succeeded_. bool GetInitSucceededForTesting(); @@ -95,6 +102,7 @@ // Fetch all backend subscriptions and sync with local storage. This should // only be called on manager instantiation and user primary account changed. + // TODO(crbug.com/1364806): Rename to SyncSubscriptions. void InitSubscriptions(); // Check if there is any request running. If not, process the next request in @@ -126,6 +134,9 @@ base::OnceCallback<void(bool)> callback, bool succeeded); + void HandleCheckLocalSubscriptionResponse(bool should_exisit, + bool is_subscribed); + void OnPrimaryAccountChanged( const signin::PrimaryAccountChangeEvent& event_details) override;
diff --git a/components/commerce/core/subscriptions/subscriptions_manager_unittest.cc b/components/commerce/core/subscriptions/subscriptions_manager_unittest.cc index 53bed7c8..3fcb367 100644 --- a/components/commerce/core/subscriptions/subscriptions_manager_unittest.cc +++ b/components/commerce/core/subscriptions/subscriptions_manager_unittest.cc
@@ -39,6 +39,14 @@ return subscriptions; } +// Return one subscription with given id. +commerce::CommerceSubscription BuildSubscription(std::string subscription_id) { + return commerce::CommerceSubscription( + commerce::SubscriptionType::kPriceTrack, + commerce::IdentifierType::kProductClusterId, subscription_id, + commerce::ManagementType::kUserManaged); +} + // Check whether the passing subscription list contains exactly one subscription // with |expected_id|. MATCHER_P(AreExpectedSubscriptions, expected_id, "") { @@ -128,6 +136,11 @@ std::unique_ptr<std::vector<CommerceSubscription>> remote_subscriptions), (override)); MOCK_METHOD(void, DeleteAll, (), (override)); + MOCK_METHOD(void, + IsSubscribed, + (CommerceSubscription subscription, + base::OnceCallback<void(bool)> callback), + (override)); // Mock the local fetch responses for Get* requests. |subscription_id| is used // to generate a CommerceSubscription to be returned. @@ -159,6 +172,15 @@ std::move(callback).Run(succeeded); }); } + + void MockIsSubscribedResponses(bool is_subscribed) { + ON_CALL(*this, IsSubscribed) + .WillByDefault( + [is_subscribed](CommerceSubscription subscription, + base::OnceCallback<void(bool)> callback) { + std::move(callback).Run(is_subscribed); + }); + } }; class SubscriptionsManagerTest : public testing::Test { @@ -540,4 +562,65 @@ signin::ConsentLevel::kSync); } +TEST_F(SubscriptionsManagerTest, TestVerifyIfSubscriptionExists_Consistent) { + SetAccountStatus(true, true); + mock_server_proxy_->MockGetResponses("111"); + mock_storage_->MockUpdateResponses(true); + mock_storage_->MockIsSubscribedResponses(true); + + EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); + EXPECT_CALL(*mock_server_proxy_, Get).Times(1); + EXPECT_CALL(*mock_storage_, + UpdateStorage(_, _, AreExpectedSubscriptions("111"))) + .Times(1); + + CreateManagerAndVerify(true); + subscriptions_manager_->VerifyIfSubscriptionExists(BuildSubscription("222"), + true); +} + +TEST_F(SubscriptionsManagerTest, TestVerifyIfSubscriptionExists_Inconsistent) { + SetAccountStatus(true, true); + mock_server_proxy_->MockGetResponses("111"); + mock_storage_->MockUpdateResponses(true); + mock_storage_->MockIsSubscribedResponses(false); + + { + InSequence s; + // First init on manager instantiation. + EXPECT_CALL(*mock_storage_, DeleteAll); + EXPECT_CALL(*mock_server_proxy_, Get); + EXPECT_CALL(*mock_storage_, + UpdateStorage(_, _, AreExpectedSubscriptions("111"))); + // Second init since local subscriptions are out of sync. + EXPECT_CALL(*mock_storage_, DeleteAll); + EXPECT_CALL(*mock_server_proxy_, Get); + EXPECT_CALL(*mock_storage_, + UpdateStorage(_, _, AreExpectedSubscriptions("111"))); + } + + CreateManagerAndVerify(true); + subscriptions_manager_->VerifyIfSubscriptionExists(BuildSubscription("222"), + true); +} + +TEST_F(SubscriptionsManagerTest, + TestVerifyIfSubscriptionExists_InconsistentWithRunningRequest) { + SetAccountStatus(true, true); + mock_server_proxy_->MockGetResponses("111"); + mock_storage_->MockUpdateResponses(true); + mock_storage_->MockIsSubscribedResponses(false); + + EXPECT_CALL(*mock_storage_, DeleteAll).Times(1); + EXPECT_CALL(*mock_server_proxy_, Get).Times(1); + EXPECT_CALL(*mock_storage_, + UpdateStorage(_, _, AreExpectedSubscriptions("111"))) + .Times(1); + + CreateManagerAndVerify(true); + MockHasRequestRunning(true); + subscriptions_manager_->VerifyIfSubscriptionExists(BuildSubscription("222"), + true); +} + } // namespace commerce
diff --git a/components/commerce/core/subscriptions/subscriptions_storage.cc b/components/commerce/core/subscriptions/subscriptions_storage.cc index 8142e55..7fce960 100644 --- a/components/commerce/core/subscriptions/subscriptions_storage.cc +++ b/components/commerce/core/subscriptions/subscriptions_storage.cc
@@ -226,4 +226,17 @@ std::move(callback).Run(all_succeeded); } +void SubscriptionsStorage::IsSubscribed( + CommerceSubscription subscription, + base::OnceCallback<void(bool)> callback) { + proto_db_->LoadOneEntry( + GetSubscriptionKey(subscription), + base::BindOnce( + [](base::OnceCallback<void(bool)> callback, bool succeeded, + CommerceSubscriptions data) { + std::move(callback).Run(succeeded && data.size() > 0); + }, + std::move(callback))); +} + } // namespace commerce
diff --git a/components/commerce/core/subscriptions/subscriptions_storage.h b/components/commerce/core/subscriptions/subscriptions_storage.h index 6b3617d..16b3c169 100644 --- a/components/commerce/core/subscriptions/subscriptions_storage.h +++ b/components/commerce/core/subscriptions/subscriptions_storage.h
@@ -68,6 +68,10 @@ // Delete all local subscriptions. virtual void DeleteAll(); + // Check if the given subscription is in local storage. + virtual void IsSubscribed(CommerceSubscription subscription, + base::OnceCallback<void(bool)> callback); + private: std::string GetSubscriptionKey(const CommerceSubscription& subscription);
diff --git a/components/commerce/core/subscriptions/subscriptions_storage_unittest.cc b/components/commerce/core/subscriptions/subscriptions_storage_unittest.cc index d6342d6..01ec499 100644 --- a/components/commerce/core/subscriptions/subscriptions_storage_unittest.cc +++ b/components/commerce/core/subscriptions/subscriptions_storage_unittest.cc
@@ -193,6 +193,22 @@ std::move(callback).Run(succeeded); }); } + + void MockLoadOneEntryResponse(bool succeeded, bool empty_response) { + ON_CALL(*this, LoadOneEntry) + .WillByDefault( + [succeeded, empty_response]( + const std::string& key, + SessionProtoStorage<commerce::CommerceSubscriptionProto>:: + LoadCallback callback) { + std::move(callback).Run( + succeeded, + empty_response + ? std::vector<SessionProtoStorage< + commerce::CommerceSubscriptionProto>::KeyAndValue>() + : MockDbLoadResponse()); + }); + } }; } // namespace @@ -340,4 +356,61 @@ run_loop.Run(); } +TEST_F(SubscriptionsStorageTest, TestIsSubscribed) { + proto_db_->MockLoadOneEntryResponse(true, false); + EXPECT_CALL(*proto_db_, LoadOneEntry(kKey1, _)).Times(1); + + base::RunLoop run_loop; + storage_->IsSubscribed( + CommerceSubscription(SubscriptionType::kPriceTrack, + IdentifierType::kProductClusterId, kMockId1, + ManagementType::kUserManaged), + base::BindOnce( + [](base::RunLoop* run_loop, bool is_subscribed) { + ASSERT_EQ(true, is_subscribed); + + run_loop->Quit(); + }, + &run_loop)); + run_loop.Run(); +} + +TEST_F(SubscriptionsStorageTest, TestIsSubscribed_Failed) { + proto_db_->MockLoadOneEntryResponse(false, false); + EXPECT_CALL(*proto_db_, LoadOneEntry(kKey1, _)).Times(1); + + base::RunLoop run_loop; + storage_->IsSubscribed( + CommerceSubscription(SubscriptionType::kPriceTrack, + IdentifierType::kProductClusterId, kMockId1, + ManagementType::kUserManaged), + base::BindOnce( + [](base::RunLoop* run_loop, bool is_subscribed) { + ASSERT_EQ(false, is_subscribed); + + run_loop->Quit(); + }, + &run_loop)); + run_loop.Run(); +} + +TEST_F(SubscriptionsStorageTest, TestIsSubscribed_EmptyResponse) { + proto_db_->MockLoadOneEntryResponse(true, true); + EXPECT_CALL(*proto_db_, LoadOneEntry(kKey1, _)).Times(1); + + base::RunLoop run_loop; + storage_->IsSubscribed( + CommerceSubscription(SubscriptionType::kPriceTrack, + IdentifierType::kProductClusterId, kMockId1, + ManagementType::kUserManaged), + base::BindOnce( + [](base::RunLoop* run_loop, bool is_subscribed) { + ASSERT_EQ(false, is_subscribed); + + run_loop->Quit(); + }, + &run_loop)); + run_loop.Run(); +} + } // namespace commerce
diff --git a/components/feature_engagement/public/event_constants.cc b/components/feature_engagement/public/event_constants.cc index f7a9b60..9b4af70 100644 --- a/components/feature_engagement/public/event_constants.cc +++ b/components/feature_engagement/public/event_constants.cc
@@ -49,6 +49,8 @@ const char kBatterySaverDialogShown[] = "battery_saver_info_shown"; +const char kHighEfficiencyDialogShown[] = "high_efficiency_info_shown"; + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
diff --git a/components/feature_engagement/public/event_constants.h b/components/feature_engagement/public/event_constants.h index 16aa8b2..b1b6b99 100644 --- a/components/feature_engagement/public/event_constants.h +++ b/components/feature_engagement/public/event_constants.h
@@ -79,6 +79,9 @@ // The user has opened the battery saver bubble dialog extern const char kBatterySaverDialogShown[]; +// The user has opened the high efficiency page action chip +extern const char kHighEfficiencyDialogShown[]; + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
diff --git a/components/feature_engagement/public/feature_configurations.cc b/components/feature_engagement/public/feature_configurations.cc index ba26fea..acffa85 100644 --- a/components/feature_engagement/public/feature_configurations.cc +++ b/components/feature_engagement/public/feature_configurations.cc
@@ -138,6 +138,19 @@ return config; } + if (kIPHHighEfficiencyInfoModeFeature.name == feature->name) { + absl::optional<FeatureConfig> config = FeatureConfig(); + config->valid = true; + config->availability = Comparator(ANY, 0); + config->session_rate = Comparator(ANY, 0); + // Show the promo once a year if the page action chip was not opened. + config->trigger = EventConfig("high_efficiency_info_trigger", + Comparator(EQUAL, 0), 360, 360); + config->used = EventConfig("high_efficiency_info_shown", + Comparator(EQUAL, 0), 360, 360); + return config; + } + #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || // BUILDFLAG(IS_CHROMEOS)
diff --git a/components/feature_engagement/public/feature_constants.cc b/components/feature_engagement/public/feature_constants.cc index d3e1443..a79b955b 100644 --- a/components/feature_engagement/public/feature_constants.cc +++ b/components/feature_engagement/public/feature_constants.cc
@@ -37,6 +37,8 @@ "IPH_FocusHelpBubbleScreenReaderPromo", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kIPHGMCCastStartStopFeature{ "IPH_GMCCastStartStop", base::FEATURE_ENABLED_BY_DEFAULT}; +const base::Feature kIPHHighEfficiencyInfoModeFeature{ + "IPH_HighEfficiencyInfoMode", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kIPHLiveCaptionFeature{"IPH_LiveCaption", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kIPHTabAudioMutingFeature{"IPH_TabAudioMuting",
diff --git a/components/feature_engagement/public/feature_constants.h b/components/feature_engagement/public/feature_constants.h index ad688d4..7d3b0c43 100644 --- a/components/feature_engagement/public/feature_constants.h +++ b/components/feature_engagement/public/feature_constants.h
@@ -39,6 +39,7 @@ extern const base::Feature kIPHExtensionsMenuFeature; extern const base::Feature kIPHFocusHelpBubbleScreenReaderPromoFeature; extern const base::Feature kIPHGMCCastStartStopFeature; +extern const base::Feature kIPHHighEfficiencyInfoModeFeature; extern const base::Feature kIPHLiveCaptionFeature; extern const base::Feature kIPHTabAudioMutingFeature; extern const base::Feature kIPHPasswordsAccountStorageFeature;
diff --git a/components/feature_engagement/public/feature_list.cc b/components/feature_engagement/public/feature_list.cc index c13d2b2..245392e 100644 --- a/components/feature_engagement/public/feature_list.cc +++ b/components/feature_engagement/public/feature_list.cc
@@ -124,6 +124,7 @@ &kIPHExtensionsMenuFeature, &kIPHFocusHelpBubbleScreenReaderPromoFeature, &kIPHGMCCastStartStopFeature, + &kIPHHighEfficiencyInfoModeFeature, &kIPHLiveCaptionFeature, &kIPHTabAudioMutingFeature, &kIPHPasswordsAccountStorageFeature,
diff --git a/components/feature_engagement/public/feature_list.h b/components/feature_engagement/public/feature_list.h index d0321019e..dcfae8bb 100644 --- a/components/feature_engagement/public/feature_list.h +++ b/components/feature_engagement/public/feature_list.h
@@ -224,6 +224,8 @@ DEFINE_VARIATION_PARAM(kIPHFocusModeFeature, "IPH_FocusMode"); DEFINE_VARIATION_PARAM(kIPHGlobalMediaControls, "IPH_GlobalMediaControls"); DEFINE_VARIATION_PARAM(kIPHGMCCastStartStopFeature, "IPH_GMCCastStartStop"); +DEFINE_VARIATION_PARAM(kIPHHighEfficiencyInfoModeFeature, + "IPH_HighEfficiencyInfoMode"); DEFINE_VARIATION_PARAM(kIPHLiveCaption, "IPH_LiveCaption"); DEFINE_VARIATION_PARAM(kIPHPasswordsAccountStorageFeature, "IPH_PasswordsAccountStorage"); @@ -362,6 +364,7 @@ VARIATION_ENTRY(kIPHFocusModeFeature), VARIATION_ENTRY(kIPHGlobalMediaControls), VARIATION_ENTRY(kIPHGMCCastStartStopFeature), + VARIATION_ENTRY(kIPHHighEfficiencyInfoModeFeature), VARIATION_ENTRY(kIPHLiveCaption), VARIATION_ENTRY(kIPHPasswordsAccountStorageFeature), VARIATION_ENTRY(kIPHReadingListDiscoveryFeature),
diff --git a/components/history/core/browser/top_sites_database.cc b/components/history/core/browser/top_sites_database.cc index d8f217b..d7a5035 100644 --- a/components/history/core/browser/top_sites_database.cc +++ b/components/history/core/browser/top_sites_database.cc
@@ -335,7 +335,7 @@ void TopSitesDatabase::ApplyDelta(const TopSitesDelta& delta) { sql::Transaction transaction(db_.get()); // TODO: consider returning early if `Begin()` returns false. - transaction.Begin(); + std::ignore = transaction.Begin(); for (const auto& deleted : delta.deleted) { if (!RemoveURLNoTransaction(deleted))
diff --git a/components/history/core/browser/top_sites_database_unittest.cc b/components/history/core/browser/top_sites_database_unittest.cc index 171db14..40acca9e 100644 --- a/components/history/core/browser/top_sites_database_unittest.cc +++ b/components/history/core/browser/top_sites_database_unittest.cc
@@ -123,7 +123,7 @@ EXPECT_EQ(kUrl0, urls[0].url); // [0] because of url_rank. sql::Transaction transaction(db.db_.get()); - transaction.Begin(); + ASSERT_TRUE(transaction.Begin()); ASSERT_TRUE(db.RemoveURLNoTransaction(urls[1])); transaction.Commit();
diff --git a/components/payments/content/android/payment_manifest_downloader_android.cc b/components/payments/content/android/payment_manifest_downloader_android.cc index e711eda..33aa50d2 100644 --- a/components/payments/content/android/payment_manifest_downloader_android.cc +++ b/components/payments/content/android/payment_manifest_downloader_android.cc
@@ -76,7 +76,9 @@ PaymentManifestDownloaderAndroid::PaymentManifestDownloaderAndroid( std::unique_ptr<ErrorLogger> log, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) - : downloader_(std::move(log), std::move(url_loader_factory)) {} + : downloader_(std::move(log), + const_csp_checker_.GetWeakPtr(), + std::move(url_loader_factory)) {} PaymentManifestDownloaderAndroid::~PaymentManifestDownloaderAndroid() {}
diff --git a/components/payments/content/android/payment_manifest_downloader_android.h b/components/payments/content/android/payment_manifest_downloader_android.h index f60576f..10e3239 100644 --- a/components/payments/content/android/payment_manifest_downloader_android.h +++ b/components/payments/content/android/payment_manifest_downloader_android.h
@@ -10,6 +10,7 @@ #include "base/android/jni_android.h" #include "base/memory/ref_counted.h" +#include "components/payments/core/const_csp_checker.h" #include "components/payments/core/payment_manifest_downloader.h" namespace network { @@ -54,6 +55,9 @@ const base::android::JavaParamRef<jobject>& jcaller); private: + // TODO(https://crbug.com/1349091): Check the CSP in the renderer instead. + ConstCSPChecker const_csp_checker_{/*allow=*/true}; + PaymentManifestDownloader downloader_; };
diff --git a/components/payments/content/service_worker_payment_app_finder.cc b/components/payments/content/service_worker_payment_app_finder.cc index 80b52b5b..0fa0ee4 100644 --- a/components/payments/content/service_worker_payment_app_finder.cc +++ b/components/payments/content/service_worker_payment_app_finder.cc
@@ -407,6 +407,7 @@ } else { downloader = std::make_unique<payments::PaymentManifestDownloader>( std::make_unique<DeveloperConsoleLogger>(web_contents), + const_csp_checker_.GetWeakPtr(), render_frame_host() .GetBrowserContext() ->GetDefaultStoragePartition()
diff --git a/components/payments/content/service_worker_payment_app_finder.h b/components/payments/content/service_worker_payment_app_finder.h index 4dc0838d..f138725 100644 --- a/components/payments/content/service_worker_payment_app_finder.h +++ b/components/payments/content/service_worker_payment_app_finder.h
@@ -12,6 +12,7 @@ #include "base/callback.h" #include "components/payments/content/web_app_manifest.h" +#include "components/payments/core/const_csp_checker.h" #include "content/public/browser/document_user_data.h" #include "content/public/browser/global_routing_id.h" #include "content/public/browser/installed_payment_apps_finder.h" @@ -110,6 +111,9 @@ std::set<std::string> ignored_methods_; std::unique_ptr<PaymentManifestDownloader> test_downloader_; + + // TODO(https://crbug.com/1349091): Check the CSP in the renderer instead. + ConstCSPChecker const_csp_checker_{/*allow=*/true}; }; } // namespace payments
diff --git a/components/payments/core/BUILD.gn b/components/payments/core/BUILD.gn index c3c49ba..aec4125d 100644 --- a/components/payments/core/BUILD.gn +++ b/components/payments/core/BUILD.gn
@@ -12,6 +12,9 @@ "android_app_description_tools.h", "can_make_payment_query.cc", "can_make_payment_query.h", + "const_csp_checker.cc", + "const_csp_checker.h", + "csp_checker.h", "currency_formatter.cc", "currency_formatter.h", "error_logger.cc", @@ -158,6 +161,7 @@ sources = [ "android_app_description_tools_unittest.cc", "can_make_payment_query_unittest.cc", + "const_csp_checker_unittest.cc", "currency_formatter_unittest.cc", "journey_logger_unittest.cc", "payment_currency_amount_unittest.cc",
diff --git a/components/payments/core/const_csp_checker.cc b/components/payments/core/const_csp_checker.cc new file mode 100644 index 0000000..1b56a49 --- /dev/null +++ b/components/payments/core/const_csp_checker.cc
@@ -0,0 +1,27 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/payments/core/const_csp_checker.h" + +#include "base/callback.h" + +namespace payments { + +ConstCSPChecker::ConstCSPChecker(bool allow) : allow_(allow) {} + +ConstCSPChecker::~ConstCSPChecker() = default; + +void ConstCSPChecker::AllowConnectToSource( + const GURL& url, + const GURL& url_before_redirects, + bool did_follow_redirect, + base::OnceCallback<void(bool)> result_callback) { + std::move(result_callback).Run(allow_); +} + +base::WeakPtr<ConstCSPChecker> ConstCSPChecker::GetWeakPtr() { + return weak_ptr_factory_.GetWeakPtr(); +} + +} // namespace payments
diff --git a/components/payments/core/const_csp_checker.h b/components/payments/core/const_csp_checker.h new file mode 100644 index 0000000..f82f0c5 --- /dev/null +++ b/components/payments/core/const_csp_checker.h
@@ -0,0 +1,41 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_PAYMENTS_CORE_CONST_CSP_CHECKER_H_ +#define COMPONENTS_PAYMENTS_CORE_CONST_CSP_CHECKER_H_ + +#include "base/memory/weak_ptr.h" +#include "components/payments/core/csp_checker.h" + +namespace payments { + +// A stub class for either always allowing or always denying connections, +// depending on the input parameter for the constructor. +// TODO(crbug.com/1349091): Make this class test-only after production code +// stops using it. +class ConstCSPChecker : public CSPChecker { + public: + explicit ConstCSPChecker(bool allow); + ~ConstCSPChecker() override; + + ConstCSPChecker(const ConstCSPChecker& other) = delete; + ConstCSPChecker& operator=(const ConstCSPChecker& other) = delete; + + // CSPChecker: + void AllowConnectToSource( + const GURL& url, + const GURL& url_before_redirects, + bool did_follow_redirect, + base::OnceCallback<void(bool)> result_callback) override; + + base::WeakPtr<ConstCSPChecker> GetWeakPtr(); + + private: + bool allow_ = false; + base::WeakPtrFactory<ConstCSPChecker> weak_ptr_factory_{this}; +}; + +} // namespace payments + +#endif // COMPONENTS_PAYMENTS_CORE_CONST_CSP_CHECKER_H_
diff --git a/components/payments/core/const_csp_checker_unittest.cc b/components/payments/core/const_csp_checker_unittest.cc new file mode 100644 index 0000000..aedc9c5 --- /dev/null +++ b/components/payments/core/const_csp_checker_unittest.cc
@@ -0,0 +1,54 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/payments/core/const_csp_checker.h" + +#include "base/bind.h" +#include "base/callback.h" +#include "base/run_loop.h" +#include "base/test/task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace payments { +namespace { + +TEST(ConstCSPCheckerTest, AlwaysAllow) { + ConstCSPChecker checker(/*allow=*/true); + base::test::SingleThreadTaskEnvironment task_environment; + base::RunLoop run_loop; + + checker.AllowConnectToSource( + /*url=*/GURL(), /*url_before_redirects=*/GURL(), + /*did_follow_redirect=*/false, + base::BindOnce( + [](base::RepeatingClosure quit_closure, bool actual_allow) { + EXPECT_TRUE(actual_allow); + quit_closure.Run(); + }, + run_loop.QuitClosure())); + + run_loop.Run(); +} + +TEST(ConstCSPCheckerTest, AlwaysDeny) { + ConstCSPChecker checker(/*allow=*/false); + base::test::SingleThreadTaskEnvironment task_environment; + base::RunLoop run_loop; + + checker.AllowConnectToSource( + /*url=*/GURL(), /*url_before_redirects=*/GURL(), + /*did_follow_redirect=*/false, + base::BindOnce( + [](base::RepeatingClosure quit_closure, bool actual_allow) { + EXPECT_FALSE(actual_allow); + quit_closure.Run(); + }, + run_loop.QuitClosure())); + + run_loop.Run(); +} + +} // namespace +} // namespace payments
diff --git a/components/payments/core/csp_checker.h b/components/payments/core/csp_checker.h new file mode 100644 index 0000000..2950966 --- /dev/null +++ b/components/payments/core/csp_checker.h
@@ -0,0 +1,31 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_PAYMENTS_CORE_CSP_CHECKER_H_ +#define COMPONENTS_PAYMENTS_CORE_CSP_CHECKER_H_ + +#include "base/callback_forward.h" + +class GURL; + +namespace payments { + +// Interface for checking Content Security Policy (CSP). +class CSPChecker { + public: + virtual ~CSPChecker() = default; + + // Checks whether CSP connect-src directive allows the given `url`. The + // parameters match ContentSecurityPolicy::AllowConnectToSource() in: + // third_party/blink/renderer/core/frame/csp/content_security_policy.h + virtual void AllowConnectToSource( + const GURL& url, + const GURL& url_before_redirects, + bool did_follow_redirect, + base::OnceCallback<void(bool)> result_callback) = 0; +}; + +} // namespace payments + +#endif // COMPONENTS_PAYMENTS_CORE_CSP_CHECKER_H_
diff --git a/components/payments/core/native_error_strings.cc b/components/payments/core/native_error_strings.cc index 0838640..fde0641 100644 --- a/components/payments/core/native_error_strings.cc +++ b/components/payments/core/native_error_strings.cc
@@ -97,6 +97,9 @@ const char kPaymentManifestDownloadFailed[] = "Unable to download payment manifest \"$1\"."; +const char kPaymentManifestCSPDenied[] = + "Content Security Policy denied the download of payment manifest \"$1\"."; + const char kPaymentDetailsNotObject[] = "Payment app returned invalid response. \"details\" field is not a " "dictionary.";
diff --git a/components/payments/core/native_error_strings.h b/components/payments/core/native_error_strings.h index ae2dbdf6..2f164bf3 100644 --- a/components/payments/core/native_error_strings.h +++ b/components/payments/core/native_error_strings.h
@@ -125,6 +125,11 @@ // be used with base::ReplaceStringPlaceholders(fmt, {A}, nullptr). extern const char kPaymentManifestDownloadFailed[]; +// Used when Content Security Policy (CSP) denied downloading payment manifest +// URL A. This format should be used with base::ReplaceStringPlaceholders(fmt, +// {A}, nullptr). +extern const char kPaymentManifestCSPDenied[]; + // Payment handler passed a non-object field "details" in response to the // "paymentrequest" event. extern const char kPaymentDetailsNotObject[];
diff --git a/components/payments/core/payment_manifest_downloader.cc b/components/payments/core/payment_manifest_downloader.cc index 4623eea..9430578 100644 --- a/components/payments/core/payment_manifest_downloader.cc +++ b/components/payments/core/payment_manifest_downloader.cc
@@ -15,6 +15,7 @@ #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "components/link_header_util/link_header_util.h" +#include "components/payments/core/csp_checker.h" #include "components/payments/core/error_logger.h" #include "components/payments/core/native_error_strings.h" #include "components/payments/core/url_util.h" @@ -108,8 +109,11 @@ PaymentManifestDownloader::PaymentManifestDownloader( std::unique_ptr<ErrorLogger> log, + base::WeakPtr<CSPChecker> csp_checker, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) - : log_(std::move(log)), url_loader_factory_(std::move(url_loader_factory)) { + : log_(std::move(log)), + csp_checker_(csp_checker), + url_loader_factory_(std::move(url_loader_factory)) { DCHECK(log_); DCHECK(url_loader_factory_); } @@ -122,7 +126,8 @@ PaymentManifestDownloadCallback callback) { DCHECK(UrlUtil::IsValidManifestUrl(url)); // Restrict number of redirects for efficiency and breaking circle. - InitiateDownload(merchant_origin, url, + InitiateDownload(merchant_origin, url, /*url_before_redirects=*/url, + /*did_follow_redirect=*/false, Download::Type::RESPONSE_BODY_OR_LINK_HEADER, /*allowed_number_of_redirects=*/3, std::move(callback)); } @@ -133,7 +138,8 @@ PaymentManifestDownloadCallback callback) { DCHECK(UrlUtil::IsValidManifestUrl(url)); InitiateDownload(payment_method_manifest_origin, url, - Download::Type::RESPONSE_BODY, + /*url_before_redirects=*/url, + /*did_follow_redirect=*/false, Download::Type::RESPONSE_BODY, /*allowed_number_of_redirects=*/0, std::move(callback)); } @@ -141,9 +147,14 @@ return url; } -PaymentManifestDownloader::Download::Download() {} +void PaymentManifestDownloader::SetCSPCheckerForTesting( + base::WeakPtr<CSPChecker> csp_checker) { + NOTREACHED(); +} -PaymentManifestDownloader::Download::~Download() {} +PaymentManifestDownloader::Download::Download() = default; + +PaymentManifestDownloader::Download::~Download() = default; void PaymentManifestDownloader::OnURLLoaderRedirect( network::SimpleURLLoader* url_loader, @@ -168,10 +179,13 @@ download->original_url, redirect_url, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) { // Redirects preserve the original request initiator. - InitiateDownload(download->request_initiator, redirect_url, - Download::Type::RESPONSE_BODY_OR_LINK_HEADER, - --download->allowed_number_of_redirects, - std::move(download->callback)); + InitiateDownload( + download->request_initiator, redirect_url, + /*url_before_redirects=*/download->url_before_redirects, + /*did_follow_redirect=*/true, + Download::Type::RESPONSE_BODY_OR_LINK_HEADER, + --download->allowed_number_of_redirects, + std::move(download->callback)); return; } error_message = base::ReplaceStringPlaceholders( @@ -295,7 +309,8 @@ // https://github.com/w3c/webappsec-fetch-metadata/issues/30 InitiateDownload( url::Origin::Create(final_url), payment_method_manifest_url, - Download::Type::RESPONSE_BODY, + /*url_before_redirects=*/download->url_before_redirects, + /*did_follow_redirect=*/false, Download::Type::RESPONSE_BODY, /*allowed_number_of_redirects=*/0, std::move(download->callback)); return; } @@ -318,6 +333,8 @@ void PaymentManifestDownloader::InitiateDownload( const url::Origin& request_initiator, const GURL& url, + const GURL& url_before_redirects, + bool did_follow_redirect, Download::Type download_type, int allowed_number_of_redirects, PaymentManifestDownloadCallback callback) { @@ -356,27 +373,50 @@ std::unique_ptr<network::SimpleURLLoader> loader = network::SimpleURLLoader::Create(std::move(resource_request), traffic_annotation); - loader->SetOnRedirectCallback( - base::BindRepeating(&PaymentManifestDownloader::OnURLLoaderRedirect, - weak_ptr_factory_.GetWeakPtr(), loader.get())); - - loader->DownloadToString( - url_loader_factory_.get(), - base::BindOnce(&PaymentManifestDownloader::OnURLLoaderComplete, - weak_ptr_factory_.GetWeakPtr(), loader.get()), - kMaxManifestSize); auto download = std::make_unique<Download>(); download->request_initiator = request_initiator; download->type = download_type; download->original_url = url; + download->url_before_redirects = url_before_redirects; + download->did_follow_redirect = did_follow_redirect; download->loader = std::move(loader); download->callback = std::move(callback); download->allowed_number_of_redirects = allowed_number_of_redirects; - const network::SimpleURLLoader* identifier = download->loader.get(); + if (!csp_checker_) { // Can be null when the webpage closes. + RespondWithError(errors::kPaymentManifestDownloadFailed, + download->original_url, *log_, + std::move(download->callback)); + return; + } + + csp_checker_->AllowConnectToSource( + url, url_before_redirects, did_follow_redirect, + base::BindOnce(&PaymentManifestDownloader::OnCSPCheck, + weak_ptr_factory_.GetWeakPtr(), std::move(download))); +} + +void PaymentManifestDownloader::OnCSPCheck(std::unique_ptr<Download> download, + bool csp_allowed) { + if (!csp_allowed) { + RespondWithError(errors::kPaymentManifestCSPDenied, download->original_url, + *log_, std::move(download->callback)); + return; + } + + network::SimpleURLLoader* loader = download->loader.get(); + loader->SetOnRedirectCallback( + base::BindRepeating(&PaymentManifestDownloader::OnURLLoaderRedirect, + weak_ptr_factory_.GetWeakPtr(), loader)); + loader->DownloadToString( + url_loader_factory_.get(), + base::BindOnce(&PaymentManifestDownloader::OnURLLoaderComplete, + weak_ptr_factory_.GetWeakPtr(), loader), + kMaxManifestSize); + auto insert_result = - downloads_.insert(std::make_pair(identifier, std::move(download))); + downloads_.insert(std::make_pair(loader, std::move(download))); DCHECK(insert_result.second); // Whether the insert has succeeded. }
diff --git a/components/payments/core/payment_manifest_downloader.h b/components/payments/core/payment_manifest_downloader.h index bc0961e..09b2cebc 100644 --- a/components/payments/core/payment_manifest_downloader.h +++ b/components/payments/core/payment_manifest_downloader.h
@@ -29,6 +29,7 @@ namespace payments { +class CSPChecker; class ErrorLogger; // Called on completed download of a manifest |contents| from |url|, which is @@ -75,6 +76,7 @@ public: PaymentManifestDownloader( std::unique_ptr<ErrorLogger> log, + base::WeakPtr<CSPChecker> csp_checker, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); PaymentManifestDownloader(const PaymentManifestDownloader&) = delete; @@ -126,10 +128,13 @@ // default implementation here simply returns |url|. virtual GURL FindTestServerURL(const GURL& url) const; + // Overridden in TestDownloader to allow modifying CSP. Should not be called + // in production. + virtual void SetCSPCheckerForTesting(base::WeakPtr<CSPChecker> csp_checker); + private: - friend class PaymentMethodManifestDownloaderTest; + friend class PaymentManifestDownloaderTestBase; friend class TestDownloader; - friend class WebAppManifestDownloaderTest; // Information about an ongoing download request. struct Download { @@ -145,6 +150,8 @@ Type type = Type::RESPONSE_BODY; url::Origin request_initiator; GURL original_url; + GURL url_before_redirects; + bool did_follow_redirect = false; std::unique_ptr<network::SimpleURLLoader> loader; PaymentManifestDownloadCallback callback; }; @@ -176,11 +183,16 @@ // Overridden in TestDownloader. virtual void InitiateDownload(const url::Origin& request_initiator, const GURL& url, + const GURL& url_before_redirects, + bool did_follow_redirect, Download::Type download_type, int allowed_number_of_redirects, PaymentManifestDownloadCallback callback); + void OnCSPCheck(std::unique_ptr<Download> download, bool csp_allowed); + std::unique_ptr<ErrorLogger> log_; + base::WeakPtr<CSPChecker> csp_checker_; scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; // Downloads are identified by network::SimpleURLLoader pointers, because
diff --git a/components/payments/core/payment_manifest_downloader_unittest.cc b/components/payments/core/payment_manifest_downloader_unittest.cc index 6ba34106..098e82a4 100644 --- a/components/payments/core/payment_manifest_downloader_unittest.cc +++ b/components/payments/core/payment_manifest_downloader_unittest.cc
@@ -4,10 +4,14 @@ #include "components/payments/core/payment_manifest_downloader.h" +#include <memory> +#include <utility> + #include "base/bind.h" #include "base/strings/stringprintf.h" #include "base/test/task_environment.h" #include "base/threading/thread_task_runner_handle.h" +#include "components/payments/core/const_csp_checker.h" #include "components/payments/core/error_logger.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" @@ -32,24 +36,24 @@ } // namespace -class PaymentMethodManifestDownloaderTest : public testing::Test { - protected: +class PaymentManifestDownloaderTestBase : public testing::Test { + public: enum class Headers { kSend, kOmit, }; - PaymentMethodManifestDownloaderTest() + PaymentManifestDownloaderTestBase() : test_url_("https://bobpay.com"), shared_url_loader_factory_( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_factory_)), - downloader_(std::make_unique<ErrorLogger>(), - shared_url_loader_factory_) { - downloader_.DownloadPaymentMethodManifest( - url::Origin::Create(GURL("https://chromium.org")), test_url_, - base::BindOnce(&PaymentMethodManifestDownloaderTest::OnManifestDownload, - base::Unretained(this))); + const_csp_checker_(std::make_unique<ConstCSPChecker>(/*allow=*/true)) {} + + void InitDownloader() { + downloader_ = std::make_unique<PaymentManifestDownloader>( + std::make_unique<ErrorLogger>(), const_csp_checker_->GetWeakPtr(), + shared_url_loader_factory_); } MOCK_METHOD3(OnManifestDownload, @@ -74,31 +78,53 @@ headers->SetHeader("Link", *link_header); } - downloader_.OnURLLoaderCompleteInternal( - downloader_.GetLoaderForTesting(), - downloader_.GetLoaderOriginalURLForTesting(), response_body, headers, + downloader_->OnURLLoaderCompleteInternal( + downloader_->GetLoaderForTesting(), + downloader_->GetLoaderOriginalURLForTesting(), response_body, headers, net_error); } + void ServerResponse(int response_code, + const std::string& response_body, + int net_error) { + ServerResponse(response_code, Headers::kSend, /*link_header=*/absl::nullopt, + response_body, net_error); + } + void ServerRedirect(int redirect_code, const GURL& new_url) { net::RedirectInfo redirect_info; redirect_info.status_code = redirect_code; redirect_info.new_url = new_url; std::vector<std::string> to_be_removed_headers; - downloader_.OnURLLoaderRedirect( - downloader_.GetLoaderForTesting(), redirect_info, + downloader_->OnURLLoaderRedirect( + downloader_->GetLoaderForTesting(), redirect_info, network::mojom::URLResponseHead(), &to_be_removed_headers); } - GURL GetOriginalURL() { return downloader_.GetLoaderOriginalURLForTesting(); } + GURL GetOriginalURL() { + return downloader_->GetLoaderOriginalURLForTesting(); + } - private: + protected: GURL test_url_; base::test::TaskEnvironment task_environment_; network::TestURLLoaderFactory test_factory_; scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_; - PaymentManifestDownloader downloader_; + std::unique_ptr<ConstCSPChecker> const_csp_checker_; + std::unique_ptr<PaymentManifestDownloader> downloader_; +}; + +class PaymentMethodManifestDownloaderTest + : public PaymentManifestDownloaderTestBase { + public: + PaymentMethodManifestDownloaderTest() { + InitDownloader(); + downloader_->DownloadPaymentMethodManifest( + url::Origin::Create(GURL("https://chromium.org")), test_url_, + base::BindOnce(&PaymentMethodManifestDownloaderTest::OnManifestDownload, + base::Unretained(this))); + } }; TEST_F(PaymentMethodManifestDownloaderTest, FirstHttpResponse404IsFailure) { @@ -533,52 +559,15 @@ ServerRedirect(301, GURL("https://alicepay.com")); } -class WebAppManifestDownloaderTest : public testing::Test { +class WebAppManifestDownloaderTest : public PaymentManifestDownloaderTestBase { public: - WebAppManifestDownloaderTest() - : test_url_("https://bobpay.com"), - shared_url_loader_factory_( - base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( - &test_factory_)), - downloader_(std::make_unique<ErrorLogger>(), - shared_url_loader_factory_) { - downloader_.DownloadWebAppManifest( + WebAppManifestDownloaderTest() { + InitDownloader(); + downloader_->DownloadWebAppManifest( url::Origin::Create(test_url_), test_url_, base::BindOnce(&WebAppManifestDownloaderTest::OnManifestDownload, base::Unretained(this))); } - - WebAppManifestDownloaderTest(const WebAppManifestDownloaderTest&) = delete; - WebAppManifestDownloaderTest& operator=(const WebAppManifestDownloaderTest&) = - delete; - - ~WebAppManifestDownloaderTest() override {} - - MOCK_METHOD3(OnManifestDownload, - void(const GURL& url, - const std::string& content, - const std::string& error_message)); - - void ServerResponse(int response_code, - const std::string& response_body, - int net_error) { - scoped_refptr<net::HttpResponseHeaders> headers = - base::MakeRefCounted<net::HttpResponseHeaders>(std::string()); - headers->ReplaceStatusLine(base::StringPrintf( - "HTTP/1.1 %d %s", response_code, - net::GetHttpReasonPhrase( - static_cast<net::HttpStatusCode>(response_code)))); - downloader_.OnURLLoaderCompleteInternal(downloader_.GetLoaderForTesting(), - test_url_, response_body, headers, - net_error); - } - - private: - GURL test_url_; - base::test::TaskEnvironment task_environment_; - network::TestURLLoaderFactory test_factory_; - scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_; - PaymentManifestDownloader downloader_; }; TEST_F(WebAppManifestDownloaderTest, HttpGetResponse404IsFailure) { @@ -617,4 +606,73 @@ ServerResponse(200, "manifest content", net::ERR_INSUFFICIENT_RESOURCES); } +using PaymentManifestDownloaderCSPTest = PaymentManifestDownloaderTestBase; + +// Download fails when CSP checker is gone, e.g., during shutdown. +TEST_F(PaymentManifestDownloaderCSPTest, + PaymentMethodManifestCSPCheckerMissing) { + InitDownloader(); + const_csp_checker_.reset(); + + EXPECT_CALL( + *this, + OnManifestDownload( + _, kNoContent, + "Unable to download payment manifest \"https://bobpay.com/\".")); + + downloader_->DownloadPaymentMethodManifest( + url::Origin::Create(GURL("https://chromium.org")), test_url_, + base::BindOnce(&PaymentManifestDownloaderCSPTest::OnManifestDownload, + base::Unretained(this))); +} + +// Download fails when CSP checker is gone, e.g., during shutdown. +TEST_F(PaymentManifestDownloaderCSPTest, WebAppManifestCSPCheckerMissing) { + InitDownloader(); + const_csp_checker_.reset(); + + EXPECT_CALL( + *this, + OnManifestDownload( + _, kNoContent, + "Unable to download payment manifest \"https://bobpay.com/\".")); + + downloader_->DownloadWebAppManifest( + url::Origin::Create(test_url_), test_url_, + base::BindOnce(&PaymentManifestDownloaderCSPTest::OnManifestDownload, + base::Unretained(this))); +} + +// Download fails when CSP checker denies it. +TEST_F(PaymentManifestDownloaderCSPTest, PaymentMethodManifestCSPDenied) { + const_csp_checker_ = std::make_unique<ConstCSPChecker>(/*allow=*/false); + InitDownloader(); + + EXPECT_CALL(*this, OnManifestDownload( + _, kNoContent, + "Content Security Policy denied the download of " + "payment manifest \"https://bobpay.com/\".")); + + downloader_->DownloadPaymentMethodManifest( + url::Origin::Create(GURL("https://chromium.org")), test_url_, + base::BindOnce(&PaymentManifestDownloaderCSPTest::OnManifestDownload, + base::Unretained(this))); +} + +// Download fails when CSP checker denies it. +TEST_F(PaymentManifestDownloaderCSPTest, WebAppManifestCSPDenied) { + const_csp_checker_ = std::make_unique<ConstCSPChecker>(/*allow=*/false); + InitDownloader(); + + EXPECT_CALL(*this, OnManifestDownload( + _, kNoContent, + "Content Security Policy denied the download of " + "payment manifest \"https://bobpay.com/\".")); + + downloader_->DownloadWebAppManifest( + url::Origin::Create(test_url_), test_url_, + base::BindOnce(&PaymentManifestDownloaderCSPTest::OnManifestDownload, + base::Unretained(this))); +} + } // namespace payments
diff --git a/components/payments/core/test_payment_manifest_downloader.cc b/components/payments/core/test_payment_manifest_downloader.cc index a51a055..35aa43b 100644 --- a/components/payments/core/test_payment_manifest_downloader.cc +++ b/components/payments/core/test_payment_manifest_downloader.cc
@@ -15,8 +15,10 @@ namespace payments { TestDownloader::TestDownloader( + base::WeakPtr<CSPChecker> csp_checker, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) : PaymentManifestDownloader(std::make_unique<ErrorLogger>(), + csp_checker, url_loader_factory) {} TestDownloader::~TestDownloader() {} @@ -26,17 +28,6 @@ test_server_url_[prefix] = test_server_url; } -void TestDownloader::InitiateDownload( - const url::Origin& request_initiator, - const GURL& url, - Download::Type download_type, - int allowed_number_of_redirects, - PaymentManifestDownloadCallback callback) { - PaymentManifestDownloader::InitiateDownload( - request_initiator, FindTestServerURL(url), download_type, - allowed_number_of_redirects, std::move(callback)); -} - GURL TestDownloader::FindTestServerURL(const GURL& url) const { // Find the first key in |test_server_url_| that is a prefix of |url|. If // found, then replace this prefix in the |url| with the URL of the test @@ -54,4 +45,23 @@ return url; } +void TestDownloader::SetCSPCheckerForTesting( + base::WeakPtr<CSPChecker> csp_checker) { + csp_checker_ = csp_checker; +} + +void TestDownloader::InitiateDownload( + const url::Origin& request_initiator, + const GURL& url, + const GURL& url_before_redirects, + bool did_follow_redirect, + Download::Type download_type, + int allowed_number_of_redirects, + PaymentManifestDownloadCallback callback) { + PaymentManifestDownloader::InitiateDownload( + request_initiator, FindTestServerURL(url), + FindTestServerURL(url_before_redirects), did_follow_redirect, + download_type, allowed_number_of_redirects, std::move(callback)); +} + } // namespace payments
diff --git a/components/payments/core/test_payment_manifest_downloader.h b/components/payments/core/test_payment_manifest_downloader.h index a33f550..8c13289 100644 --- a/components/payments/core/test_payment_manifest_downloader.h +++ b/components/payments/core/test_payment_manifest_downloader.h
@@ -9,6 +9,7 @@ #include <memory> #include <string> +#include "base/memory/weak_ptr.h" #include "components/payments/core/payment_manifest_downloader.h" class GURL; @@ -22,11 +23,13 @@ namespace payments { +class CSPChecker; + // Downloads payment method manifests from the test server. // // Sample usage #1: // -// TestDownloader downloader(context); +// TestDownloader downloader(csp_checker, url_loader_factory); // downloader.AddTestServerURL("https://", "https://127.0.0.1:7070"); // // Actual URL downloaded is https://127.0.0.1:7070/alicepay.com/webpay. // downloader.DownloadPaymentMethodManifest( @@ -34,7 +37,7 @@ // // Sample usage #2: // -// TestDownloader downloader(context); +// TestDownloader downloader(csp_checker, url_loader_factory); // downloader.AddTestServerURL( // "https://alicepay.com", "https://127.0.0.1:8080"); // downloader.AddTestServerURL( @@ -47,7 +50,8 @@ // "https://bobpay.com/webpay", callback); class TestDownloader : public PaymentManifestDownloader { public: - explicit TestDownloader( + TestDownloader( + base::WeakPtr<CSPChecker> csp_checker, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); TestDownloader(const TestDownloader&) = delete; @@ -69,7 +73,7 @@ // https://127.0.0.1:7070/alicepay.com/webpay, which is a file located at // components/test/data/payments/alicepay.com/webpay. // - // For anoter example, if AddTestServerURL("https://alicepay.com", + // For another example, if AddTestServerURL("https://alicepay.com", // "https://127.0.0.1:8080") is called, then all calls to // DownloadPaymentMethodManifest(some_url, callback) will replace the // "https://alicepay.com" prefix of some_url with "https://127.0.0.1:8080". @@ -90,16 +94,26 @@ // AddTestServerURL("x");AddTestServerURL("xy"); is not. void AddTestServerURL(const std::string& prefix, const GURL& test_server_url); + private: // PaymentManifestDownloader: // // The reverse operation as AddTestServerURL: converts |url| back to a test // server URL so it can be fetched as a normal resource outside of this class. GURL FindTestServerURL(const GURL& url) const override; - private: - // PaymentManifestDownloader implementation. + // PaymentManifestDownloader: + // + // Overrides the Content-Security-Policy (CSP) checker being used. + void SetCSPCheckerForTesting(base::WeakPtr<CSPChecker> csp_checker) override; + + // PaymentManifestDownloader: + // + // Replaces the given URLs with the test server URLs before initiating + // download. void InitiateDownload(const url::Origin& request_initiator, const GURL& url, + const GURL& url_before_redirects, + bool did_follow_redirect, Download::Type download_type, int allowed_number_of_redirects, PaymentManifestDownloadCallback callback) override;
diff --git a/components/policy/proto/chrome_device_policy.proto b/components/policy/proto/chrome_device_policy.proto index 7f7a29d..abb0d5d 100644 --- a/components/policy/proto/chrome_device_policy.proto +++ b/components/policy/proto/chrome_device_policy.proto
@@ -1700,6 +1700,10 @@ optional bool enabled = 1 [default = true]; } +message DeviceReportXDREventsProto { + optional bool enabled = 1 [default = false]; +} + message ChromeDeviceSettingsProto { reserved 61, 71, 90; optional DevicePolicyRefreshRateProto device_policy_refresh_rate = 1; @@ -1879,4 +1883,5 @@ optional StringListPolicyProto device_login_screen_context_aware_access_signals_allowlist = 136; optional StringPolicyProto device_printing_client_name_template = 137; + optional DeviceReportXDREventsProto device_report_xdr_events = 138; }
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 1ea9a318..32c8a051 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -1005,6 +1005,7 @@ 'ReportDeviceNetworkTelemetryEventCheckingRateMs', 'ReportDeviceAudioStatusCheckingRateMs', 'ReportDeviceSignalStrengthEventDrivenTelemetry', + 'DeviceReportXDREvents' ], }, { @@ -1106,6 +1107,7 @@ 'caption': '''Date and time''', 'desc': '''Controls clock and time zone settings.''', 'policies': [ + 'CalendarIntegrationEnabled', 'SystemTimezone', 'SystemTimezoneAutomaticDetection', 'SystemUse24HourClock', @@ -3964,6 +3966,37 @@ (For <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph>, see DeviceMetricsReportingEnabled.)''', }, { + 'name': 'DeviceReportXDREvents', + 'owners': ['cros-reporting-team@google.com', 'jrhilke@google.com'], + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'future_on': ['chrome_os'], + 'supported_chrome_os_management': ['google_cloud'], + 'device_only': True, + 'features': { + 'dynamic_refresh': True, + }, + 'default': False, + 'items': [ + { + 'value': True, + 'caption': 'Report information about extended detection and response (XDR) events', + }, + { + 'value': False, + 'caption': 'Do not report information about about extended detection and response (XDR) events', + }, + ], + 'example_value': False, + 'id': 1016, + 'caption': '''Report extended detection and response (XDR) events''', + 'tags': ['admin-sharing'], + 'desc': '''Setting the policy to True has enrolled devices report information related to extended detection and response (XDR) events. + + Setting the policy to False or leaving it unset means enrolled devices don't report extended detection and response (XDR) events.''', + 'arc_support': 'This policy has no effect on the logging done by Android.', + }, + { 'name': 'PasswordManagerEnabled', 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], 'type': 'main', @@ -10715,6 +10748,7 @@ }, ], 'default': True, + 'deprecated': True, 'example_value': True, 'id': 989, 'caption': '''Allow policy scope detection on <ph name="MAC_OS_NAME">macOS</ph>''', @@ -16383,6 +16417,40 @@ It is up to the admins to set policies in all platforms they care about. It's recommended to set this policy to one value in all platforms.''', }, { + 'name': 'CalendarIntegrationEnabled', + 'owners': ['ramyagopalan@google.com', 'jiamingc@google.com'], + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'future_on': ['chrome_os'], + 'features': { + 'dynamic_refresh': True, + 'per_profile': True, + }, + 'items': [ + { + 'value': True, + 'caption': '''Enable <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> Integration.''', + }, + { + 'value': False, + 'caption': '''Disable <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> Integration.''', + }, + ], + 'default': True, + 'example_value': True, + 'default_for_enterprise_users': False, + 'id': 1015, + 'caption': '''Enable <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> Integration''', + 'tags': [], + 'desc': '''Enable <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> integration which allows <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> users to fetch events from <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> to populate <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> calendar widget in system status bar. + + If this policy is enabled, <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> device can retrieve <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> events to populate <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> calendar widget in system status bar for the logged in user. + + If this policy is disabled, <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> device cannot retrieve <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> events to populate <ph name="PRODUCT_OS_NAME">$2<ex>Google ChromeOS</ex></ph> calendar widget in system status bar for the logged in user. + + If this policy is left unset, the <ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph> feature is disabled by default for enterprise users.''', + }, + { 'name': 'DeviceLoginScreenDefaultScreenMagnifierType', 'owners': ['file://components/policy/resources/OWNERS', 'rsorokin@chromium.org'], 'type': 'int-enum', @@ -33814,6 +33882,7 @@ 'DeviceAutofillSAMLUsername': 'saml_username.url_parameter_to_autofill_saml_username', 'DeviceLoginScreenContextAwareAccessSignalsAllowlist': 'device_login_screen_context_aware_access_signals_allowlist.value', 'DevicePrintingClientNameTemplate': 'device_printing_client_name_template.client_name_template', + 'DeviceReportXDREvents': 'device_report_xdr_events.enabled', }, 'policy_atomic_group_definitions': [ { @@ -34227,6 +34296,7 @@ 'HeartbeatFrequency', 'LogUploadEnabled', 'DeviceMetricsReportingEnabled', + 'DeviceReportXDREvents' ], }, { @@ -34255,6 +34325,7 @@ 'name': 'DateAndTime', 'caption': '''Date and time''', 'policies': [ + 'CalendarIntegrationEnabled', 'SystemTimezone', 'SystemTimezoneAutomaticDetection', ] @@ -34345,6 +34416,6 @@ 'placeholders': [], 'deleted_policy_ids': [114, 115, 204, 205, 206, 341, 412, 438, 476, 544, 546, 562, 569, 578, 583, 585, 586, 587, 588, 589, 590, 591, 600, 668, 669, 872], 'deleted_atomic_policy_group_ids': [19], - 'highest_id_currently_used': 1014, + 'highest_id_currently_used': 1016, 'highest_atomic_group_id_currently_used': 43 }
diff --git a/components/prefs/scoped_user_pref_update.h b/components/prefs/scoped_user_pref_update.h index cad00b0..586dd39c 100644 --- a/components/prefs/scoped_user_pref_update.h +++ b/components/prefs/scoped_user_pref_update.h
@@ -65,7 +65,7 @@ class COMPONENTS_PREFS_EXPORT ScopedDictPrefUpdate : public subtle::ScopedUserPrefUpdateBase { public: - // The underlying dictionary must not be removed from `servuce` service during + // The underlying dictionary must not be removed from `service` during // the lifetime of the created ScopedDictPrefUpdate. ScopedDictPrefUpdate(PrefService* service, const std::string& path) : ScopedUserPrefUpdateBase(service, path) {} @@ -81,7 +81,7 @@ // - is (silently) created and written to the user pref store if none existed // before. // - // Calling Get() will result in an an update notification automatically + // Calling Get() will result in an update notification automatically // being triggered at destruction time. // // The ownership of the return value remains with the user pref store. @@ -100,7 +100,7 @@ class COMPONENTS_PREFS_EXPORT ScopedListPrefUpdate : public subtle::ScopedUserPrefUpdateBase { public: - // The underlying dictionary must not be removed from `servuce` service during + // The underlying list must not be removed from `service` during // the lifetime of the created ScopedListPrefUpdate. ScopedListPrefUpdate(PrefService* service, const std::string& path) : ScopedUserPrefUpdateBase(service, path) {} @@ -116,7 +116,7 @@ // - is (silently) created and written to the user pref store if none existed // before. // - // Calling Get() will result in an an update notification automatically + // Calling Get() will result in an update notification automatically // being triggered at destruction time. // // The ownership of the return value remains with the user pref store. @@ -153,7 +153,7 @@ // - is (silently) created and written to the user pref store if none existed // before. // - // Calling Get() will result in an an update notification automatically + // Calling Get() will result in an update notification automatically // being triggered at destruction time. // // The ownership of the return value remains with the user pref store.
diff --git a/components/privacy_sandbox/privacy_sandbox_features.cc b/components/privacy_sandbox/privacy_sandbox_features.cc index 7390cba..d326936f 100644 --- a/components/privacy_sandbox/privacy_sandbox_features.cc +++ b/components/privacy_sandbox/privacy_sandbox_features.cc
@@ -6,8 +6,14 @@ namespace privacy_sandbox { -const base::Feature kPrivacySandboxSettings3{"PrivacySandboxSettings3", - base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kPrivacySandboxSettings3 { + "PrivacySandboxSettings3", +#if !BUILDFLAG(IS_ANDROID) + base::FEATURE_ENABLED_BY_DEFAULT +#else + base::FEATURE_DISABLED_BY_DEFAULT +#endif +}; const base::FeatureParam<bool> kPrivacySandboxSettings3ConsentRequired{ &kPrivacySandboxSettings3, "consent-required", false}; const base::FeatureParam<bool> kPrivacySandboxSettings3NoticeRequired{
diff --git a/components/tracing/common/background_tracing_metrics_provider.cc b/components/tracing/common/background_tracing_metrics_provider.cc index c8059f1..a74b33c 100644 --- a/components/tracing/common/background_tracing_metrics_provider.cc +++ b/components/tracing/common/background_tracing_metrics_provider.cc
@@ -4,8 +4,8 @@ #include "components/tracing/common/background_tracing_metrics_provider.h" +#include "base/metrics/histogram_functions.h" #include "base/time/time.h" - #include "components/metrics/content/gpu_metrics_provider.h" #include "components/metrics/cpu_metrics_provider.h" #include "content/public/browser/background_tracing_manager.h" @@ -38,6 +38,9 @@ std::move(done_callback).Run(false); return; } + + base::UmaHistogramCounts100000("Tracing.Background.UploadingTraceSizeInKB", + serialized_trace.size() / 1024); metrics::TraceLog* log = uma_proto->add_trace_log(); log->set_raw_data(std::move(serialized_trace));
diff --git a/content/app/sandbox_helper_win.cc b/content/app/sandbox_helper_win.cc index d1f6a2e..07ef39e 100644 --- a/content/app/sandbox_helper_win.cc +++ b/content/app/sandbox_helper_win.cc
@@ -4,23 +4,28 @@ #include "content/public/app/sandbox_helper_win.h" -#include "sandbox/win/src/process_mitigations.h" +#include "sandbox/win/src/sandbox.h" #include "sandbox/win/src/sandbox_factory.h" namespace content { -void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* info) { +void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* info, + sandbox::MitigationFlags starting_mitigations) { info->broker_services = sandbox::SandboxFactory::GetBrokerServices(); - if (!info->broker_services) { - info->target_services = sandbox::SandboxFactory::GetTargetServices(); - } else { + if (info->broker_services) { + info->broker_services->SetStartingMitigations(starting_mitigations); + // Ensure the proper mitigations are enforced for the browser process. - sandbox::ApplyProcessMitigationsToCurrentProcess( + info->broker_services->RatchetDownSecurityMitigations( sandbox::MITIGATION_DEP | sandbox::MITIGATION_DEP_NO_ATL_THUNK | sandbox::MITIGATION_HARDEN_TOKEN_IL_POLICY); // Note: these mitigations are "post-startup". Some mitigations that need // to be enabled sooner (e.g. MITIGATION_EXTENSION_POINT_DISABLE) are done // so in Chrome_ELF. + } else { + // There should be no starting mitigations for child processes passed in. + DCHECK_EQ(starting_mitigations, uint64_t{0}); + info->target_services = sandbox::SandboxFactory::GetTargetServices(); } }
diff --git a/content/browser/accessibility/accessibility_tree_formatter_uia_win.cc b/content/browser/accessibility/accessibility_tree_formatter_uia_win.cc index ce6a3fc..450eff35 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_uia_win.cc +++ b/content/browser/accessibility/accessibility_tree_formatter_uia_win.cc
@@ -474,7 +474,7 @@ GetUIAElementFromDelegate(start, uia_.Get(), &start_element); RECT root_bounds = GetUIARootBounds(start, uia_.Get()); - base::DictionaryValue tree; + base::Value::Dict tree; if (start_element.Get()) { // Build an accessibility tree starting from that element. RecursiveBuildTree(start_element.Get(), root_bounds.left, root_bounds.top, @@ -502,13 +502,14 @@ RecursiveBuildTree(non_pane_descendant.Get(), root_bounds.left, root_bounds.top, &tree); } - return std::move(tree); + return base::Value(std::move(tree)); } base::Value AccessibilityTreeFormatterUia::BuildTreeForSelector( const AXTreeSelector& selector) const { HWND hwnd = GetHWNDBySelector(selector); + base::Value::Dict tree; if (hwnd) { Microsoft::WRL::ComPtr<IUIAutomationElement> root; uia_->ElementFromHandle(hwnd, &root); @@ -517,12 +518,10 @@ RECT root_bounds = {0}; root->get_CurrentBoundingRectangle(&root_bounds); - base::DictionaryValue tree; RecursiveBuildTree(root.Get(), root_bounds.left, root_bounds.top, &tree); - return std::move(tree); } - return base::Value(base::Value::Type::DICTIONARY); + return base::Value(std::move(tree)); } base::Value AccessibilityTreeFormatterUia::BuildNode( @@ -537,16 +536,16 @@ CHECK(uia_element.Get()); RECT root_bounds = GetUIARootBounds(node, uia_.Get()); - base::DictionaryValue tree; + base::Value::Dict tree; AddProperties(uia_element.Get(), root_bounds.left, root_bounds.top, &tree); - return tree; + return base::Value(std::move(tree)); } void AccessibilityTreeFormatterUia::RecursiveBuildTree( IUIAutomationElement* uncached_node, int root_x, int root_y, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { // Process this node. AddProperties(uncached_node, root_x, root_y, dict); @@ -558,20 +557,18 @@ if (!SUCCEEDED(parent->GetCachedChildren(&children)) || !children) return; // Process children. - auto child_list = std::make_unique<base::ListValue>(); + base::Value::List child_list; int child_count; children->get_Length(&child_count); for (int i = 0; i < child_count; i++) { Microsoft::WRL::ComPtr<IUIAutomationElement> child; - std::unique_ptr<base::DictionaryValue> child_dict = - std::make_unique<base::DictionaryValue>(); + base::Value::Dict child_dict; if (SUCCEEDED(children->GetElement(i, &child))) { - RecursiveBuildTree(child.Get(), root_x, root_y, child_dict.get()); + RecursiveBuildTree(child.Get(), root_x, root_y, &child_dict); } else { - child_dict->SetStringKey("error", "[Error retrieving child]"); + child_dict.Set("error", "[Error retrieving child]"); } - child_list->GetList().Append( - base::Value::FromUniquePtrValue(std::move(child_dict))); + child_list.Append(std::move(child_dict)); } dict->Set(kChildrenDictAttr, std::move(child_list)); } @@ -580,7 +577,7 @@ IUIAutomationElement* uncached_node, int root_x, int root_y, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { // Update the cache for this node's information. Microsoft::WRL::ComPtr<IUIAutomationElement> node; uncached_node->BuildUpdatedCache(element_cache_request_.Get(), &node); @@ -611,7 +608,7 @@ void AccessibilityTreeFormatterUia::AddAnnotationProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationAnnotationPattern> annotation_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_AnnotationPatternId, IID_PPV_ARGS(&annotation_pattern))) && @@ -636,20 +633,21 @@ type_id_string = "Unknown"; break; } - dict->SetStringPath("Annotation.AnnotationTypeId", type_id_string); + dict->SetByDottedPath("Annotation.AnnotationTypeId", type_id_string); } base::win::ScopedBstr type_name; if (SUCCEEDED(annotation_pattern->get_CachedAnnotationTypeName( - type_name.Receive()))) - dict->SetStringPath("Annotation.AnnotationTypeName", - BstrToUTF8(type_name.Get())); + type_name.Receive()))) { + dict->SetByDottedPath("Annotation.AnnotationTypeName", + BstrToUTF8(type_name.Get())); + } } } void AccessibilityTreeFormatterUia::AddExpandCollapseProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationExpandCollapsePattern> expand_collapse_pattern; if (SUCCEEDED( @@ -674,96 +672,98 @@ state = "LeafNode"; break; } - dict->SetStringPath("ExpandCollapse.ExpandCollapseState", state); + dict->SetByDottedPath("ExpandCollapse.ExpandCollapseState", state); } } } void AccessibilityTreeFormatterUia::AddGridProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationGridPattern> grid_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_GridPatternId, IID_PPV_ARGS(&grid_pattern))) && grid_pattern) { int column_count; - if (SUCCEEDED(grid_pattern->get_CachedColumnCount(&column_count))) - dict->SetIntPath("Grid.ColumnCount", column_count); - + if (SUCCEEDED(grid_pattern->get_CachedColumnCount(&column_count))) { + dict->SetByDottedPath("Grid.ColumnCount", column_count); + } int row_count; - if (SUCCEEDED(grid_pattern->get_CachedRowCount(&row_count))) - dict->SetIntPath("Grid.RowCount", row_count); + if (SUCCEEDED(grid_pattern->get_CachedRowCount(&row_count))) { + dict->SetByDottedPath("Grid.RowCount", row_count); + } } } void AccessibilityTreeFormatterUia::AddGridItemProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationGridItemPattern> grid_item_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_GridItemPatternId, IID_PPV_ARGS(&grid_item_pattern))) && grid_item_pattern) { int column; - if (SUCCEEDED(grid_item_pattern->get_CachedColumn(&column))) - dict->SetIntPath("GridItem.Column", column); - + if (SUCCEEDED(grid_item_pattern->get_CachedColumn(&column))) { + dict->SetByDottedPath("GridItem.Column", column); + } int column_span; - if (SUCCEEDED(grid_item_pattern->get_CachedColumnSpan(&column_span))) - dict->SetIntPath("GridItem.ColumnSpan", column_span); - + if (SUCCEEDED(grid_item_pattern->get_CachedColumnSpan(&column_span))) { + dict->SetByDottedPath("GridItem.ColumnSpan", column_span); + } int row; - if (SUCCEEDED(grid_item_pattern->get_CachedRow(&row))) - dict->SetIntPath("GridItem.Row", row); - + if (SUCCEEDED(grid_item_pattern->get_CachedRow(&row))) { + dict->SetByDottedPath("GridItem.Row", row); + } int row_span; - if (SUCCEEDED(grid_item_pattern->get_CachedRowSpan(&row_span))) - dict->SetIntPath("GridItem.RowSpan", row_span); + if (SUCCEEDED(grid_item_pattern->get_CachedRowSpan(&row_span))) { + dict->SetByDottedPath("GridItem.RowSpan", row_span); + } Microsoft::WRL::ComPtr<IUIAutomationElement> containing_grid; if (SUCCEEDED( grid_item_pattern->get_CachedContainingGrid(&containing_grid))) { - dict->SetStringPath("GridItem.ContainingGrid", - GetNodeName(containing_grid.Get())); - ; + dict->SetByDottedPath("GridItem.ContainingGrid", + GetNodeName(containing_grid.Get())); } } } void AccessibilityTreeFormatterUia::AddRangeValueProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationRangeValuePattern> range_value_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_RangeValuePatternId, IID_PPV_ARGS(&range_value_pattern))) && range_value_pattern) { BOOL is_read_only; - if (SUCCEEDED(range_value_pattern->get_CachedIsReadOnly(&is_read_only))) - dict->SetBoolPath("RangeValue.IsReadOnly", is_read_only); - + if (SUCCEEDED(range_value_pattern->get_CachedIsReadOnly(&is_read_only))) { + dict->SetByDottedPath("RangeValue.IsReadOnly", !!is_read_only); + } double large_change; - if (SUCCEEDED(range_value_pattern->get_CachedLargeChange(&large_change))) - dict->SetDoublePath("RangeValue.LargeChange", large_change); - + if (SUCCEEDED(range_value_pattern->get_CachedLargeChange(&large_change))) { + dict->SetByDottedPath("RangeValue.LargeChange", large_change); + } double small_change; - if (SUCCEEDED(range_value_pattern->get_CachedSmallChange(&small_change))) - dict->SetDoublePath("RangeValue.SmallChange", small_change); - + if (SUCCEEDED(range_value_pattern->get_CachedSmallChange(&small_change))) { + dict->SetByDottedPath("RangeValue.SmallChange", small_change); + } double maximum; - if (SUCCEEDED(range_value_pattern->get_CachedMaximum(&maximum))) - dict->SetDoublePath("RangeValue.Maximum", maximum); - + if (SUCCEEDED(range_value_pattern->get_CachedMaximum(&maximum))) { + dict->SetByDottedPath("RangeValue.Maximum", maximum); + } double minimum; - if (SUCCEEDED(range_value_pattern->get_CachedMinimum(&minimum))) - dict->SetDoublePath("RangeValue.Minimum", minimum); - + if (SUCCEEDED(range_value_pattern->get_CachedMinimum(&minimum))) { + dict->SetByDottedPath("RangeValue.Minimum", minimum); + } double value; - if (SUCCEEDED(range_value_pattern->get_CachedValue(&value))) - dict->SetDoublePath("RangeValue.Value", value); + if (SUCCEEDED(range_value_pattern->get_CachedValue(&value))) { + dict->SetByDottedPath("RangeValue.Value", value); + } } } void AccessibilityTreeFormatterUia::AddScrollProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationScrollPattern> scroll_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_ScrollPatternId, IID_PPV_ARGS(&scroll_pattern))) && @@ -771,83 +771,89 @@ double horizontal_scroll_percent; if (SUCCEEDED(scroll_pattern->get_CachedHorizontalScrollPercent( &horizontal_scroll_percent))) { - dict->SetDoublePath("Scroll.HorizontalScrollPercent", - horizontal_scroll_percent); + dict->SetByDottedPath("Scroll.HorizontalScrollPercent", + horizontal_scroll_percent); } double horizontal_view_size; if (SUCCEEDED(scroll_pattern->get_CachedHorizontalViewSize( - &horizontal_view_size))) - dict->SetDoublePath("Scroll.HorizontalViewSize", horizontal_view_size); - + &horizontal_view_size))) { + dict->SetByDottedPath("Scroll.HorizontalViewSize", horizontal_view_size); + } BOOL horizontally_scrollable; if (SUCCEEDED(scroll_pattern->get_CachedHorizontallyScrollable( &horizontally_scrollable))) { - dict->SetBoolPath("Scroll.HorizontallyScrollable", - horizontally_scrollable); + dict->SetByDottedPath("Scroll.HorizontallyScrollable", + !!horizontally_scrollable); } double vertical_scroll_percent; if (SUCCEEDED(scroll_pattern->get_CachedVerticalScrollPercent( - &vertical_scroll_percent))) - dict->SetDoublePath("Scroll.VerticalScrollPercent", - vertical_scroll_percent); + &vertical_scroll_percent))) { + dict->SetByDottedPath("Scroll.VerticalScrollPercent", + vertical_scroll_percent); + } double vertical_view_size; if (SUCCEEDED( - scroll_pattern->get_CachedVerticalViewSize(&vertical_view_size))) - dict->SetDoublePath("Scroll.VerticalViewSize", vertical_view_size); - + scroll_pattern->get_CachedVerticalViewSize(&vertical_view_size))) { + dict->SetByDottedPath("Scroll.VerticalViewSize", vertical_view_size); + } BOOL vertically_scrollable; if (SUCCEEDED(scroll_pattern->get_CachedVerticallyScrollable( - &vertically_scrollable))) - dict->SetBoolPath("Scroll.VerticallyScrollable", vertically_scrollable); + &vertically_scrollable))) { + dict->SetByDottedPath("Scroll.VerticallyScrollable", + !!vertically_scrollable); + } } } void AccessibilityTreeFormatterUia::AddSelectionProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationSelectionPattern> selection_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_SelectionPatternId, IID_PPV_ARGS(&selection_pattern))) && selection_pattern) { BOOL can_select_multiple; if (SUCCEEDED(selection_pattern->get_CachedCanSelectMultiple( - &can_select_multiple))) - dict->SetBoolPath("Selection.CanSelectMultiple", can_select_multiple); - + &can_select_multiple))) { + dict->SetByDottedPath("Selection.CanSelectMultiple", + !!can_select_multiple); + } BOOL is_selection_required; if (SUCCEEDED(selection_pattern->get_CachedIsSelectionRequired( - &is_selection_required))) - dict->SetBoolPath("Selection.IsSelectionRequired", is_selection_required); + &is_selection_required))) { + dict->SetByDottedPath("Selection.IsSelectionRequired", + !!is_selection_required); + } } } void AccessibilityTreeFormatterUia::AddSelectionItemProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationSelectionItemPattern> selection_item_pattern; if (SUCCEEDED(node->GetCachedPatternAs( UIA_SelectionItemPatternId, IID_PPV_ARGS(&selection_item_pattern))) && selection_item_pattern) { BOOL is_selected; - if (SUCCEEDED(selection_item_pattern->get_CachedIsSelected(&is_selected))) - dict->SetBoolPath("SelectionItem.IsSelected", is_selected); - + if (SUCCEEDED(selection_item_pattern->get_CachedIsSelected(&is_selected))) { + dict->SetByDottedPath("SelectionItem.IsSelected", !!is_selected); + } Microsoft::WRL::ComPtr<IUIAutomationElement> selection_container; if (SUCCEEDED(selection_item_pattern->get_CachedSelectionContainer( &selection_container))) { - dict->SetStringPath("SelectionItem.SelectionContainer", - GetNodeName(selection_container.Get())); + dict->SetByDottedPath("SelectionItem.SelectionContainer", + GetNodeName(selection_container.Get())); } } } void AccessibilityTreeFormatterUia::AddTableProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationTablePattern> table_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_TablePatternId, IID_PPV_ARGS(&table_pattern))) && @@ -867,14 +873,14 @@ row_or_column_string = "Indeterminate"; break; } - dict->SetStringPath("Table.RowOrColumnMajor", row_or_column_string); + dict->SetByDottedPath("Table.RowOrColumnMajor", row_or_column_string); } } } void AccessibilityTreeFormatterUia::AddToggleProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationTogglePattern> toggle_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_TogglePatternId, IID_PPV_ARGS(&toggle_pattern))) && @@ -893,38 +899,40 @@ toggle_state_string = "Indeterminate"; break; } - dict->SetStringPath("Toggle.ToggleState", toggle_state_string); + dict->SetByDottedPath("Toggle.ToggleState", toggle_state_string); } } } void AccessibilityTreeFormatterUia::AddValueProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationValuePattern> value_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_ValuePatternId, IID_PPV_ARGS(&value_pattern))) && value_pattern) { BOOL is_read_only; - if (SUCCEEDED(value_pattern->get_CachedIsReadOnly(&is_read_only))) - dict->SetBoolPath("Value.IsReadOnly", is_read_only); - + if (SUCCEEDED(value_pattern->get_CachedIsReadOnly(&is_read_only))) { + dict->SetByDottedPath("Value.IsReadOnly", !!is_read_only); + } base::win::ScopedBstr value; - if (SUCCEEDED(value_pattern->get_CachedValue(value.Receive()))) - dict->SetStringPath("Value.Value", BstrToUTF8(value.Get())); + if (SUCCEEDED(value_pattern->get_CachedValue(value.Receive()))) { + dict->SetByDottedPath("Value.Value", BstrToUTF8(value.Get())); + } } } void AccessibilityTreeFormatterUia::AddWindowProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { Microsoft::WRL::ComPtr<IUIAutomationWindowPattern> window_pattern; if (SUCCEEDED(node->GetCachedPatternAs(UIA_WindowPatternId, IID_PPV_ARGS(&window_pattern))) && window_pattern) { BOOL is_modal; - if (SUCCEEDED(window_pattern->get_CachedIsModal(&is_modal))) - dict->SetBoolPath("Window.IsModal", is_modal); + if (SUCCEEDED(window_pattern->get_CachedIsModal(&is_modal))) { + dict->SetByDottedPath("Window.IsModal", !!is_modal); + } } } @@ -936,7 +944,7 @@ void AccessibilityTreeFormatterUia::AddCustomProperties( IUIAutomationElement* node, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { // Custom properties need to be added separately. for (const auto& property : GetCustomPropertiesMap()) { base::win::ScopedVariant variant; @@ -952,16 +960,16 @@ // We cannot infer the property name from a custom property id, so we get it // from the map we created manually in `BuildCustomPropertiesMap()`. auto property = GetCustomPropertiesMap().find(property_id); - if (property != GetCustomPropertiesMap().end()) + if (property != GetCustomPropertiesMap().end()) { return property->second; - + } return UiaIdentifierToCondensedString(property_id); } void AccessibilityTreeFormatterUia::WriteProperty( long propertyId, const base::win::ScopedVariant& var, - base::DictionaryValue* dict, + base::Value::Dict* dict, int root_x, int root_y) const { switch (var.type()) { @@ -969,36 +977,37 @@ case VT_NULL: break; case VT_I2: - dict->SetIntPath(GetPropertyName(propertyId), var.ptr()->iVal); + dict->SetByDottedPath(GetPropertyName(propertyId), var.ptr()->iVal); break; case VT_I4: WriteI4Property(propertyId, var.ptr()->lVal, dict); break; case VT_R4: - dict->SetDoublePath(GetPropertyName(propertyId), var.ptr()->fltVal); + dict->SetByDottedPath(GetPropertyName(propertyId), var.ptr()->fltVal); break; case VT_R8: - dict->SetDoublePath(GetPropertyName(propertyId), var.ptr()->dblVal); + dict->SetByDottedPath(GetPropertyName(propertyId), var.ptr()->dblVal); break; case VT_I1: - dict->SetIntPath(GetPropertyName(propertyId), var.ptr()->cVal); + dict->SetByDottedPath(GetPropertyName(propertyId), var.ptr()->cVal); break; case VT_UI1: - dict->SetIntPath(GetPropertyName(propertyId), var.ptr()->bVal); + dict->SetByDottedPath(GetPropertyName(propertyId), var.ptr()->bVal); break; case VT_UI2: - dict->SetIntPath(GetPropertyName(propertyId), var.ptr()->uiVal); + dict->SetByDottedPath(GetPropertyName(propertyId), var.ptr()->uiVal); break; case VT_UI4: - dict->SetIntPath(GetPropertyName(propertyId), var.ptr()->ulVal); + dict->SetByDottedPath(GetPropertyName(propertyId), + static_cast<int>(var.ptr()->ulVal)); break; case VT_BSTR: - dict->SetStringPath(GetPropertyName(propertyId), - BstrToUTF8(var.ptr()->bstrVal)); + dict->SetByDottedPath(GetPropertyName(propertyId), + BstrToUTF8(var.ptr()->bstrVal)); break; case VT_BOOL: - dict->SetBoolPath(GetPropertyName(propertyId), - var.ptr()->boolVal == VARIANT_TRUE ? true : false); + dict->SetByDottedPath(GetPropertyName(propertyId), + var.ptr()->boolVal == VARIANT_TRUE ? true : false); break; case VT_UNKNOWN: WriteUnknownProperty(propertyId, var.ptr()->punkVal, dict); @@ -1018,22 +1027,23 @@ void AccessibilityTreeFormatterUia::WriteI4Property( long propertyId, long lval, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { switch (propertyId) { case UIA_ControlTypePropertyId: - dict->SetStringPath(GetPropertyName(propertyId), - UiaIdentifierToCondensedString(lval)); + dict->SetByDottedPath(GetPropertyName(propertyId), + UiaIdentifierToCondensedString(lval)); break; case UIA_OrientationPropertyId: - dict->SetStringPath(GetPropertyName(propertyId), - base::WideToUTF8(UiaOrientationToString(lval))); + dict->SetByDottedPath(GetPropertyName(propertyId), + base::WideToUTF8(UiaOrientationToString(lval))); break; case UIA_LiveSettingPropertyId: - dict->SetStringPath(GetPropertyName(propertyId), - base::WideToUTF8(UiaLiveSettingToString(lval))); + dict->SetByDottedPath(GetPropertyName(propertyId), + base::WideToUTF8(UiaLiveSettingToString(lval))); break; default: - dict->SetIntPath(GetPropertyName(propertyId), lval); + dict->SetByDottedPath(GetPropertyName(propertyId), + static_cast<int>(lval)); break; } } @@ -1041,7 +1051,7 @@ void AccessibilityTreeFormatterUia::WriteUnknownProperty( long propertyId, IUnknown* unk, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { switch (propertyId) { case UIA_ControllerForPropertyId: case UIA_DescribedByPropertyId: @@ -1055,8 +1065,8 @@ case UIA_LabeledByPropertyId: { Microsoft::WRL::ComPtr<IUIAutomationElement> node; if (unk && SUCCEEDED(unk->QueryInterface(IID_PPV_ARGS(&node)))) { - dict->SetStringPath(GetPropertyName(propertyId), - GetNodeName(node.Get())); + dict->SetByDottedPath(GetPropertyName(propertyId), + GetNodeName(node.Get())); } break; } @@ -1070,18 +1080,18 @@ const VARIANT& value, int root_x, int root_y, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { CHECK(value.vt == (VT_ARRAY | VT_R8)); double* data = nullptr; SafeArrayAccessData(value.parray, reinterpret_cast<void**>(&data)); - auto rectangle = std::make_unique<base::DictionaryValue>(); - rectangle->SetIntKey("left", data[0] - root_x); - rectangle->SetIntKey("top", data[1] - root_y); - rectangle->SetIntKey("width", data[2]); - rectangle->SetIntKey("height", data[3]); - dict->Set(GetPropertyName(propertyId), std::move(rectangle)); + base::Value::Dict rectangle; + rectangle.Set("left", static_cast<int>(data[0] - root_x)); + rectangle.Set("top", static_cast<int>(data[1] - root_y)); + rectangle.Set("width", static_cast<int>(data[2])); + rectangle.Set("height", static_cast<int>(data[3])); + dict->SetByDottedPath(GetPropertyName(propertyId), std::move(rectangle)); SafeArrayUnaccessData(value.parray); } @@ -1089,7 +1099,7 @@ void AccessibilityTreeFormatterUia::WriteElementArray( long propertyId, IUIAutomationElementArray* array, - base::DictionaryValue* dict) const { + base::Value::Dict* dict) const { int count; array->get_Length(&count); std::u16string element_list; @@ -1108,8 +1118,9 @@ element_list += name; } } - if (!element_list.empty()) - dict->SetStringPath(GetPropertyName(propertyId), element_list); + if (!element_list.empty()) { + dict->SetByDottedPath(GetPropertyName(propertyId), element_list); + } } std::u16string AccessibilityTreeFormatterUia::GetNodeName( @@ -1173,23 +1184,26 @@ } std::string AccessibilityTreeFormatterUia::ProcessTreeForOutput( - const base::DictionaryValue& dict) const { - std::unique_ptr<base::DictionaryValue> tree; + const base::DictionaryValue& node) const { std::string line; + const base::Value::Dict& dict = node.GetDict(); // Always show control type, and show it first. - std::string control_type_value; - dict.GetString(GetPropertyName(UIA_ControlTypePropertyId), - &control_type_value); - WriteAttribute(true, control_type_value, &line); + const std::string* control_type_value = + dict.FindStringByDottedPath(GetPropertyName(UIA_ControlTypePropertyId)); + if (control_type_value) { + WriteAttribute(true, *control_type_value, &line); + } // Properties. - for (long i : properties_) + for (long i : properties_) { ProcessPropertyForOutput(GetPropertyName(i), dict, line); + } // Custom properties. - for (const auto& i : GetCustomPropertiesMap()) + for (const auto& i : GetCustomPropertiesMap()) { ProcessPropertyForOutput(GetPropertyName(i.first), dict, line); + } // Patterns. const std::string pattern_property_names[] = { @@ -1232,53 +1246,49 @@ void AccessibilityTreeFormatterUia::ProcessPropertyForOutput( const std::string& property_name, - const base::DictionaryValue& dict, + const base::Value::Dict& dict, std::string& line) const { - // - const base::Value* value; - if (dict.Get(property_name, &value)) - ProcessValueForOutput(property_name, value, line); + const base::Value* value = dict.FindByDottedPath(property_name); + if (value) { + ProcessValueForOutput(property_name, *value, line); + } } void AccessibilityTreeFormatterUia::ProcessValueForOutput( const std::string& name, - const base::Value* value, + const base::Value& value, std::string& line) const { - switch (value->type()) { + switch (value.type()) { case base::Value::Type::STRING: { WriteAttribute(false, base::StringPrintf("%s='%s'", name.c_str(), - value->GetString().c_str()), + value.GetString().c_str()), &line); break; } case base::Value::Type::BOOLEAN: { WriteAttribute(false, base::StringPrintf("%s=%s", name.c_str(), - (value->GetBool() ? "true" : "false")), + (value.GetBool() ? "true" : "false")), &line); break; } case base::Value::Type::INTEGER: { WriteAttribute(false, - base::StringPrintf("%s=%d", name.c_str(), - value->GetIfInt().value_or(0)), + base::StringPrintf("%s=%d", name.c_str(), value.GetInt()), &line); break; } case base::Value::Type::DOUBLE: { - const double double_value = value->GetIfDouble().value_or(0.0); - WriteAttribute(false, - base::StringPrintf("%s=%.2f", name.c_str(), double_value), - &line); + WriteAttribute( + false, base::StringPrintf("%s=%.2f", name.c_str(), value.GetDouble()), + &line); break; } - case base::Value::Type::DICTIONARY: { - const base::DictionaryValue* dict_value = nullptr; - value->GetAsDictionary(&dict_value); + case base::Value::Type::DICT: { if (name == "BoundingRectangle") { WriteAttribute(false, - FormatRectangle(*dict_value, "BoundingRectangle", "left", + FormatRectangle(value, "BoundingRectangle", "left", "top", "width", "height"), &line); }
diff --git a/content/browser/accessibility/accessibility_tree_formatter_uia_win.h b/content/browser/accessibility/accessibility_tree_formatter_uia_win.h index 5365b71..ec132e69b 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_uia_win.h +++ b/content/browser/accessibility/accessibility_tree_formatter_uia_win.h
@@ -41,68 +41,68 @@ void RecursiveBuildTree(IUIAutomationElement* node, int root_x, int root_y, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void BuildCacheRequests(); void BuildCustomPropertiesMap(); void AddProperties(IUIAutomationElement* node, int root_x, int root_y, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddAnnotationProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddExpandCollapseProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddGridProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddGridItemProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddRangeValueProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddScrollProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddSelectionProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddSelectionItemProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddTableProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddToggleProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddValueProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddWindowProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void AddCustomProperties(IUIAutomationElement* node, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; std::string GetPropertyName(long property_id) const; void WriteProperty(long propertyId, const base::win::ScopedVariant& var, - base::DictionaryValue* dict, + base::Value::Dict* dict, int root_x = 0, int root_y = 0) const; // UIA enums have type I4, print formatted string for these when possible void WriteI4Property(long propertyId, long lval, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void WriteUnknownProperty(long propertyId, IUnknown* unk, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void WriteRectangleProperty(long propertyId, const VARIANT& value, int root_x, int root_y, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; void WriteElementArray(long propertyId, IUIAutomationElementArray* array, - base::DictionaryValue* dict) const; + base::Value::Dict* dict) const; std::u16string GetNodeName(IUIAutomationElement* node) const; std::string ProcessTreeForOutput( const base::DictionaryValue& node) const override; void ProcessPropertyForOutput(const std::string& property_name, - const base::DictionaryValue& dict, + const base::Value::Dict& dict, std::string& line) const; void ProcessValueForOutput(const std::string& name, - const base::Value* value, + const base::Value& value, std::string& line) const; std::map<long, std::string>& GetCustomPropertiesMap() const;
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index c90af89..e9267dc2 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -189,6 +189,7 @@ #include "content/browser/renderer_host/dwrite_font_lookup_table_builder_win.h" #include "net/base/winsock_init.h" #include "sandbox/policy/win/sandbox_win.h" +#include "sandbox/win/src/sandbox.h" #endif #if BUILDFLAG(IS_CHROMEOS_ASH) @@ -587,11 +588,11 @@ #endif #if BUILDFLAG(IS_WIN) - if (!parsed_command_line_.HasSwitch(switches::kSingleProcess)) { - if (base::FeatureList::IsEnabled(kBrowserDynamicCodeDisabled)) { - sandbox::ApplyProcessMitigationsToCurrentProcess( - sandbox::MITIGATION_DYNAMIC_CODE_DISABLE_WITH_OPT_OUT); - } + if (!parsed_command_line_.HasSwitch(switches::kSingleProcess) && + base::FeatureList::IsEnabled(kBrowserDynamicCodeDisabled) && + parameters_.sandbox_info && parameters_.sandbox_info->broker_services) { + parameters_.sandbox_info->broker_services->RatchetDownSecurityMitigations( + sandbox::MITIGATION_DYNAMIC_CODE_DISABLE_WITH_OPT_OUT); } #endif
diff --git a/content/browser/loader/cross_site_document_blocking_browsertest.cc b/content/browser/loader/cross_site_document_blocking_browsertest.cc index b6a12b5..e500bcb 100644 --- a/content/browser/loader/cross_site_document_blocking_browsertest.cc +++ b/content/browser/loader/cross_site_document_blocking_browsertest.cc
@@ -73,12 +73,18 @@ kShouldBeBlocked = 1 << 0, kShouldBeSniffed = 1 << 1, + kBlockResourcesAsError = 1 << 2, + kShouldBeAllowedWithoutSniffing = 0, kShouldBeBlockedWithoutSniffing = kShouldBeBlocked, kShouldBeSniffedAndAllowed = kShouldBeSniffed, kShouldBeSniffedAndBlocked = kShouldBeSniffed | kShouldBeBlocked, }; +constexpr CorbExpectations BlockAsError(const CorbExpectations expectations) { + return CorbExpectations(expectations | kBlockResourcesAsError); +} + std::ostream& operator<<(std::ostream& os, const CorbExpectations& value) { if (value == 0) { os << "(none)"; @@ -90,6 +96,8 @@ os << "kShouldBeBlocked "; if (0 != (value & kShouldBeSniffed)) os << "kShouldBeSniffed "; + if (0 != (value & kBlockResourcesAsError)) + os << "kBlockResourcesAsError "; os << ")"; return os; } @@ -250,20 +258,31 @@ void Verify(CorbExpectations expectations, const std::string& expected_resource_body) { if (0 != (expectations & kShouldBeBlocked)) { - ASSERT_EQ(net::OK, completion_status().error_code); - // Verify that the body is empty. EXPECT_EQ("", response_body()); EXPECT_EQ(0, completion_status().decoded_body_length); - // Verify that other response parts have been sanitized. - EXPECT_EQ(0u, response_head()->content_length); - const std::string& headers = response_head()->headers->raw_headers(); - EXPECT_THAT(headers, Not(HasSubstr("Content-Length"))); - EXPECT_THAT(headers, Not(HasSubstr("Content-Type"))); - // Verify that the console message would have been printed. EXPECT_TRUE(completion_status().should_report_corb_blocking); + + // Verify the response code & headers, which depends on whether the + // response is blocked as an error, or as an empty response. + if (0 != (expectations & kBlockResourcesAsError)) { + ASSERT_EQ(net::ERR_BLOCKED_BY_ORB, completion_status().error_code); + ASSERT_FALSE(response_head()); + } else { + ASSERT_EQ(net::OK, completion_status().error_code); + + // Verify that response has no content. + EXPECT_EQ(0u, response_head()->content_length); + + // Verify that response headers have been sanitized. + size_t iter = 0; + std::string name, value; + EXPECT_FALSE(response_head()->headers->EnumerateHeaderLines( + &iter, &name, &value)); + EXPECT_EQ(iter, 0u); + } } else { ASSERT_EQ(net::OK, completion_status().error_code); EXPECT_FALSE(completion_status().should_report_corb_blocking); @@ -475,6 +494,7 @@ kWithCORBProtectionSniffing, kWithoutCORBProtectionSniffing, kWithORBv01, + kWithORBv02, }; struct ImgTestParams { const char* resource; @@ -492,18 +512,30 @@ /* enabled_features= */ {network::features:: kCORBProtectionSniffing}, /* disabled_features= */ { - network::features::kOpaqueResponseBlockingV01}); + network::features::kOpaqueResponseBlockingV01, + network::features::kOpaqueResponseBlockingV02}); break; case TestMode::kWithoutCORBProtectionSniffing: scoped_feature_list_.InitWithFeatures( /* enabled_features= */ {}, /* disabled_features= */ { network::features::kCORBProtectionSniffing, - network::features::kOpaqueResponseBlockingV01}); + network::features::kOpaqueResponseBlockingV01, + network::features::kOpaqueResponseBlockingV02}); break; case TestMode::kWithORBv01: - scoped_feature_list_.InitAndEnableFeature( - network::features::kOpaqueResponseBlockingV01); + scoped_feature_list_.InitWithFeatures( + /* enabled_features= */ {network::features:: + kOpaqueResponseBlockingV01}, + /* disabled_features= */ { + network::features::kOpaqueResponseBlockingV02}); + break; + case TestMode::kWithORBv02: + scoped_feature_list_.InitWithFeatures( + /* enabled_features= */ + {network::features::kOpaqueResponseBlockingV01, + network::features::kOpaqueResponseBlockingV02}, + /* disabled_features= */ {}); break; } } @@ -594,24 +626,32 @@ INSTANTIATE_TEST_SUITE_P( \ ORBv01_##tag, CrossSiteDocumentBlockingImgElementTest, \ ::testing::Values( \ - ImgTestParams{resource, expectations, TestMode::kWithORBv01})); + ImgTestParams{resource, expectations, TestMode::kWithORBv01})); \ + INSTANTIATE_TEST_SUITE_P( \ + ORBv02_##tag, CrossSiteDocumentBlockingImgElementTest, \ + ::testing::Values(ImgTestParams{resource, BlockAsError(expectations), \ + TestMode::kWithORBv02})); -#define IMG_TEST_WITH_DIFFERENT_ORB_EXPECTATIONS( \ - tag, resource, corb_expectations, orb_expectations) \ - INSTANTIATE_TEST_SUITE_P(ProtectionSniffingOn_##tag, \ - CrossSiteDocumentBlockingImgElementTest, \ - ::testing::Values(ImgTestParams{ \ - resource, corb_expectations, \ - TestMode::kWithoutCORBProtectionSniffing})); \ - INSTANTIATE_TEST_SUITE_P(ProtectionSniffingOff_##tag, \ - CrossSiteDocumentBlockingImgElementTest, \ - ::testing::Values(ImgTestParams{ \ - resource, corb_expectations, \ - TestMode::kWithCORBProtectionSniffing})); \ - INSTANTIATE_TEST_SUITE_P( \ - ORBv01_##tag, CrossSiteDocumentBlockingImgElementTest, \ - ::testing::Values( \ - ImgTestParams{resource, orb_expectations, TestMode::kWithORBv01})); +#define IMG_TEST_WITH_DIFFERENT_ORB_EXPECTATIONS( \ + tag, resource, corb_expectations, orb_expectations) \ + INSTANTIATE_TEST_SUITE_P(ProtectionSniffingOn_##tag, \ + CrossSiteDocumentBlockingImgElementTest, \ + ::testing::Values(ImgTestParams{ \ + resource, corb_expectations, \ + TestMode::kWithoutCORBProtectionSniffing})); \ + INSTANTIATE_TEST_SUITE_P(ProtectionSniffingOff_##tag, \ + CrossSiteDocumentBlockingImgElementTest, \ + ::testing::Values(ImgTestParams{ \ + resource, corb_expectations, \ + TestMode::kWithCORBProtectionSniffing})); \ + INSTANTIATE_TEST_SUITE_P( \ + ORBv01_##tag, CrossSiteDocumentBlockingImgElementTest, \ + ::testing::Values( \ + ImgTestParams{resource, orb_expectations, TestMode::kWithORBv01})); \ + INSTANTIATE_TEST_SUITE_P( \ + ORBv02_##tag, CrossSiteDocumentBlockingImgElementTest, \ + ::testing::Values(ImgTestParams{ \ + resource, BlockAsError(orb_expectations), TestMode::kWithORBv02})); // The following are files under content/test/data/site_isolation. All // should be disallowed for cross site XHR under the document blocking policy. @@ -730,8 +770,18 @@ network::features::kCORBProtectionSniffing); break; case TestMode::kWithORBv01: - scoped_feature_list_.InitAndEnableFeature( - network::features::kOpaqueResponseBlockingV01); + scoped_feature_list_.InitWithFeatures( + /* enabled_features= */ {network::features:: + kOpaqueResponseBlockingV01}, + /* disabled_features= */ { + network::features::kOpaqueResponseBlockingV02}); + break; + case TestMode::kWithORBv02: + scoped_feature_list_.InitWithFeatures( + /* enabled_features= */ + {network::features::kOpaqueResponseBlockingV01, + network::features::kOpaqueResponseBlockingV02}, + /* disabled_features= */ {}); break; } }
diff --git a/content/browser/net/sandboxed_socket_broker_browsertest.cc b/content/browser/net/sandboxed_socket_broker_browsertest.cc index 579c3d5..95675e6 100644 --- a/content/browser/net/sandboxed_socket_broker_browsertest.cc +++ b/content/browser/net/sandboxed_socket_broker_browsertest.cc
@@ -146,18 +146,28 @@ } // Creates a TCPConnectedSocket that attempts one GET request to -// `embedded_test_server`. +// `embedded_test_server`. If `use_options` is true then a set of options are +// set for the socket. void RunTcpEndToEndTest( network::mojom::NetworkContext* network_context, - net::test_server::EmbeddedTestServer& embedded_test_server) { + net::test_server::EmbeddedTestServer& embedded_test_server, + bool use_options) { mojo::PendingRemote<network::mojom::TCPConnectedSocket> tcp_connected_socket_remote; net::AddressList addr; ASSERT_TRUE(embedded_test_server.GetAddressList(&addr)); + network::mojom::TCPConnectedSocketOptionsPtr tcp_connected_socket_options = + network::mojom::TCPConnectedSocketOptions::New(); + + tcp_connected_socket_options->send_buffer_size = 32 * 1024; + tcp_connected_socket_options->receive_buffer_size = 64 * 1024; + tcp_connected_socket_options->no_delay = false; + base::RunLoop run_loop; network_context->CreateTCPConnectedSocket( - absl::nullopt, addr, nullptr, + absl::nullopt, addr, + use_options ? std::move(tcp_connected_socket_options) : nullptr, net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS), tcp_connected_socket_remote.InitWithNewPipeAndPassReceiver(), mojo::NullRemote(), base::BindOnce(&OnConnected, run_loop.QuitClosure())); @@ -174,7 +184,22 @@ ->GetNetworkContext(); ASSERT_TRUE(network_context); - RunTcpEndToEndTest(network_context, embedded_test_server_); + RunTcpEndToEndTest(network_context, embedded_test_server_, + /*use_options=*/false); +} + +IN_PROC_BROWSER_TEST_F(SandboxedSocketBrokerBrowserTest, + TcpEndToEndDefaultContextWithOptions) { + network::mojom::NetworkContext* network_context = + shell() + ->web_contents() + ->GetBrowserContext() + ->GetDefaultStoragePartition() + ->GetNetworkContext(); + ASSERT_TRUE(network_context); + + RunTcpEndToEndTest(network_context, embedded_test_server_, + /*use_options=*/true); } // Implementation of network::mojom::SocketBroker that tracks the number of @@ -221,7 +246,8 @@ network_context.BindNewPipeAndPassReceiver(), std::move(network_context_params)); - RunTcpEndToEndTest(network_context.get(), embedded_test_server_); + RunTcpEndToEndTest(network_context.get(), embedded_test_server_, + /*use_options=*/false); EXPECT_EQ(socket_broker.tcp_socket_count(), 1); } @@ -235,7 +261,8 @@ ASSERT_TRUE(network_context.is_bound()); // Run test on the first network context. - RunTcpEndToEndTest(network_context.get(), embedded_test_server_); + RunTcpEndToEndTest(network_context.get(), embedded_test_server_, + /*use_options=*/false); SimulateNetworkServiceCrash(); @@ -243,7 +270,8 @@ ASSERT_TRUE(network_context2.is_bound()); // Run the test again, in the new network service. - RunTcpEndToEndTest(network_context2.get(), embedded_test_server_); + RunTcpEndToEndTest(network_context2.get(), embedded_test_server_, + /*use_options=*/false); } } // namespace
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index f4199621..274c38b 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -1751,19 +1751,19 @@ begin_params_->impression.has_value()); if (begin_params_->is_form_submission) { - if (commit_params_->is_browser_initiated && - !commit_params_->post_content_type.empty()) { - // This is a form resubmit, so make sure to set the Content-Type header. + // During form resubmit, `commit_params_->post_content_type` is populated + // from the history. Use it. + if (!commit_params_->post_content_type.empty()) { headers.SetHeaderIfMissing(net::HttpRequestHeaders::kContentType, commit_params_->post_content_type); - } else if (!commit_params_->is_browser_initiated) { - // Save the Content-Type in case the form is resubmitted. This will get - // sent back to the renderer in the CommitNavigation IPC. The renderer - // will then send it back with the post body so that we can access it - // along with the body in FrameNavigationEntry::page_state_. - headers.GetHeader(net::HttpRequestHeaders::kContentType, - &commit_params_->post_content_type); } + + // Save the Content-Type in case the form is resubmitted. This will get + // sent back to the renderer in the CommitNavigation IPC. The renderer + // will then send it back with the post body so that we can access it + // along with the body in FrameNavigationEntry::page_state_. + headers.GetHeader(net::HttpRequestHeaders::kContentType, + &commit_params_->post_content_type); } }
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityNodeInfoUtils.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityNodeInfoUtils.java index d8402f9c..3936e3fe 100644 --- a/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityNodeInfoUtils.java +++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityNodeInfoUtils.java
@@ -352,8 +352,8 @@ continue; } - // Exclude css display for now - // TODO: remove this exclusion and update tests + // CSS Display is very noisy and currently unused, so we exclude it here because we + // don't have a way to filter it for certain tests. if (key.equals(EXTRAS_KEY_CSS_DISPLAY)) { continue; }
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java index b90bafd..d60e17d 100644 --- a/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java
@@ -138,7 +138,7 @@ // Constants defined for AccessibilityNodeInfo Bundle extras keys. public static final String EXTRAS_KEY_CHROME_ROLE = "AccessibilityNodeInfo.chromeRole"; public static final String EXTRAS_KEY_CLICKABLE_SCORE = "AccessibilityNodeInfo.clickableScore"; - public static final String EXTRAS_KEY_CSS_DISPLAY = "AccessibilityNodeInfo.blockDisplay"; + public static final String EXTRAS_KEY_CSS_DISPLAY = "AccessibilityNodeInfo.cssDisplay"; public static final String EXTRAS_KEY_HAS_IMAGE = "AccessibilityNodeInfo.hasImage"; public static final String EXTRAS_KEY_HINT = "AccessibilityNodeInfo.hint"; public static final String EXTRAS_KEY_IMAGE_DATA = "AccessibilityNodeInfo.imageData";
diff --git a/content/public/app/BUILD.gn b/content/public/app/BUILD.gn index de6cc0ea..8a1db1d6 100644 --- a/content/public/app/BUILD.gn +++ b/content/public/app/BUILD.gn
@@ -35,10 +35,6 @@ "initialize_mojo_core.h", ] -if (is_win) { - public_app_shared_sources += [ "sandbox_helper_win.h" ] -} - public_app_shared_public_deps = [ "//content:export", "//third_party/abseil-cpp:absl", @@ -54,6 +50,11 @@ "//content/public/utility:utility_sources", ] +if (is_win) { + public_app_shared_sources += [ "sandbox_helper_win.h" ] + public_app_shared_deps += [ "//sandbox/win:common" ] +} + if (is_component_build) { source_set("app_sources") { # Only the main content shared library can pull this in.
diff --git a/content/public/app/sandbox_helper_win.h b/content/public/app/sandbox_helper_win.h index b4b5cee..a4b75e8e 100644 --- a/content/public/app/sandbox_helper_win.h +++ b/content/public/app/sandbox_helper_win.h
@@ -5,17 +5,27 @@ #ifndef CONTENT_PUBLIC_APP_SANDBOX_HELPER_WIN_H_ #define CONTENT_PUBLIC_APP_SANDBOX_HELPER_WIN_H_ +#include "sandbox/win/src/security_level.h" + namespace sandbox { struct SandboxInterfaceInfo; } namespace content { -// Initializes the sandbox code and turns on DEP. Note: This function +// Initialize the sandbox code Note: This function // must be *statically* linked into the executable (along with the static // sandbox library); it will not work correctly if it is exported from a // DLL and linked in. -void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* sandbox_info); +// starting_mitigations are the mitigations which were applied early in +// startup, but not at startup. If a wrong value is sent in, additional +// mitigations may fail to be applied. +// In particular, child processes must have a value of 0 here since they +// use mitigations applied in process creation. If you have additional +// mitigations you need at startup, please add them to +// GenerateConfigForSandboxedProcess in sandbox_win.cc +void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* sandbox_info, + sandbox::MitigationFlags starting_mitigations = 0); } // namespace content
diff --git a/content/test/gpu/gpu_tests/gpu_integration_test.py b/content/test/gpu/gpu_tests/gpu_integration_test.py index 2bc6a98..33c63353 100644 --- a/content/test/gpu/gpu_tests/gpu_integration_test.py +++ b/content/test/gpu/gpu_tests/gpu_integration_test.py
@@ -145,14 +145,6 @@ action='store_true', default=False, help='Disables uploads of logs to cloud storage') - # TODO(skbug.com/12149): Remove this once Gold-based tests no longer clobber - # earlier results on retry attempts. - parser.add_option( - '--has-test-filter', - action='store_true', - default=False, - help=('Whether a test filter has been applied. Can be used as a proxy ' - 'for whether this is a retry without patch on a trybot.')) parser.add_option('--extra-intel-device-id-with-overlays', dest='extra_intel_device_id_with_overlays', help='The extra Intel device id with overlays')
diff --git a/content/test/gpu/gpu_tests/pixel_test_pages.py b/content/test/gpu/gpu_tests/pixel_test_pages.py index 74f17f8..addf9ae 100644 --- a/content/test/gpu/gpu_tests/pixel_test_pages.py +++ b/content/test/gpu/gpu_tests/pixel_test_pages.py
@@ -205,7 +205,8 @@ 'pixel_webgl_sad_canvas.html', base_name + '_WebGLSadCanvas', test_rect=[0, 0, 300, 300], - optional_action='CrashGpuProcessTwiceWaitForContextRestored'), + optional_action='CrashGpuProcessTwiceWaitForContextRestored', + grace_period_end=date(2022, 9, 20)), PixelTestPage('pixel_scissor.html', base_name + '_ScissorTestWithPreserveDrawingBuffer', test_rect=[0, 0, 300, 300]),
diff --git a/docs/README.md b/docs/README.md index 79111e4..cd01d5c 100644 --- a/docs/README.md +++ b/docs/README.md
@@ -150,6 +150,9 @@ Visualizing view trees during debugging * [Bitmap Pipeline](bitmap_pipeline.md) - How bitmaps are moved from the renderer to the screen. +* [Flag Guarding Guidelines](flag_guarding_guidelines.md) - When to use + server controlled kill switches and A/B experiments to safely roll out + changes. * [Using the Origin Trials Framework](origin_trials_integration.md) - A framework for conditionally enabling experimental APIs for testing. * [Chrome Sync](https://source.chromium.org/chromium/chromium/src/+/main:docs/website/site/developers/design-documents/sync) -
diff --git a/docs/enterprise/description_guidelines.md b/docs/enterprise/description_guidelines.md index e0ac51f..ad390233 100644 --- a/docs/enterprise/description_guidelines.md +++ b/docs/enterprise/description_guidelines.md
@@ -10,6 +10,7 @@ * Linux: `<ph name="LINUX_OS_NAME">Linux</ph>` * Internet Explorer: `<ph name="IE_PRODUCT_NAME">Internet® Explorer®</ph>` * Google Admin console: `<ph name="GOOGLE_ADMIN_CONSOLE_PRODUCT_NAME">Google Admin console</ph>` +* Google Calendar: `<ph name="GOOGLE_CALENDAR_NAME">Google Calendar</ph>` * Google Cast: `<ph name="PRODUCT_NAME">Google Cast</ph>` * Google Cloud Print: `<ph name="CLOUD_PRINT_NAME">Google Cloud Print</ph>` * Google Drive: `<ph name="GOOGLE_DRIVE_NAME">Google Drive</ph>`
diff --git a/docs/flag_guarding_guidelines.md b/docs/flag_guarding_guidelines.md new file mode 100644 index 0000000..83ae766 --- /dev/null +++ b/docs/flag_guarding_guidelines.md
@@ -0,0 +1,73 @@ +# Chromium Flag Guarding Guidelines + +This document describes using [`base::Feature`](/base/feature_list.h) flags which +can be remotely via a server. This applies to both A/B experiments +([internal link](http://go/finch101)) (disabled by default) and to kill switches +([internal link](http://go/finch-killswitch)) (enabled by default). + +Google maintains its own server which you'll see referenced by its internal name +Finch. Other embedders can and do run their own server for their products. + +[TOC] + +## Goals +* Prevent large scale outages and reduce the response time latency of outages of +Chromium and Android WebView +* Reduce the need for a binary respin to address problems in the field +* Catch regressions in core product vitals + +## Non-Goals +* Require a flag per CL/bug without consideration. This is not scalable. See the +next section for guidance of when flags should be used. +* Flag-guarding of ChromeOS-specific features. +* Add a lot of long-lived server-configurable flags across the code base. New +flags generated by this proposal should be removed 1-2 milestones after launch. +* Mandate that all changes be rolled out via server side configurations. + +## When is a flag required? +* Every project/feature launch shall use a flag unless it’s not [feasible](#feasible) +* Every feature going through Launch Process (Note, you do not need a launch bug +to use a flag) +* Every feature using origin trials, per existing [guidelines](https://www.chromium.org/blink/origin-trials/running-an-origin-trial/#is-your-feature-ready-to-be-an-origin-trial:~:text=Have%20a%20way%20to%20remotely%20disable%20the%20feature) +* Every deprecation/addition of web platform APIs +* Very large structural changes that have very different paths (e.g. navigation +rewrite in PlzNavigate, networking rewrite in Network Service, Out-of-process +Rasterization etc.). +* Refactorings in code paths that have historically been risky or prone to +accidental breakages should also be treated the same as a new feature. +* Regardless of whether it is a new feature, refactoring, or bug fix, there is +no minimum size that dictates whether a flag is required (either for isolated +CLs or for many CLs that form a project/feature). A one line change with +potential to impact stability, performance, usability is just as required to use +a flag as a multi-thousand line feature. +* {#feasible}If, as a CL author, you are uncertain whether a flag can/should be +used, talk to the relevant TL/Uber-TL and if still unsure, just use a flag. + +## When is a flag not required? +* Targeted/micro performance optimizations: projects like V8/Skia/decoders etc. +that have their own large correctness and performance test suites to not have to +use server rollouts since they have large confidence based on their tests +* Changes to core data structures where it would almost be impossible to +maintain both worlds (e.g. V8 pointer compression where adding a branch in each +dereference would not be practical). +* Features shipped via component updater: if we ship a bad component we can +update to a fixed one +* Chrome A/B binary experiments: we can use Omaha/AppStore/Play to update users +from bad builds +* Non-chromium-repo binary drops: e.g. SwiftShader +* Rolling/Updating third party dependencies (e.g. libvpx, libwebp etc.) +* Mechanical/automated refactorings +* Changes to internal API naming +* Simple parameter changes (adding params, changing the type etc.) +* Isolated refactorings where test coverage with high test coverage / confidence + + +## What type of flag rollout to use? +* If a change has the potential to affect performance or memory +([internal link](http://go/chrome-browser-guiding-metrics)), or you want to +analyze the impact of the launch on feature-specific metrics, use a +disabled-by-default base::Feature flag and run an A/B experiment. +Non-Googler committers will need to work with owners of the code that work at +Google to launch and monitor the experiment. +* Otherwise it should be guarded minimally by an enabled-by-default +base::Feature flag, which can be remotely disabled by a server configuration.
diff --git a/infra/config/dev/subprojects/chromium/ci.star b/infra/config/dev/subprojects/chromium/ci.star index b324ea5..73a1648 100644 --- a/infra/config/dev/subprojects/chromium/ci.star +++ b/infra/config/dev/subprojects/chromium/ci.star
@@ -50,6 +50,9 @@ "chromium-ci-builder-dev@chops-service-accounts.iam.gserviceaccount.com", ) +# TODO(crbug.com/1362440): remove this. +defaults.omit_python2.set(False) + def ci_builder(*, name, resultdb_bigquery_exports = None, **kwargs): resultdb_bigquery_exports = resultdb_bigquery_exports or [] resultdb_bigquery_exports.extend([
diff --git a/infra/config/generated/builders/ci/android-perfetto-rel/properties.json b/infra/config/generated/builders/ci/android-perfetto-rel/properties.json new file mode 100644 index 0000000..b232002 --- /dev/null +++ b/infra/config/generated/builders/ci/android-perfetto-rel/properties.json
@@ -0,0 +1,16 @@ +{ + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 250, + "metrics_project": "chromium-reclient-metrics" + }, + "$recipe_engine/resultdb/test_presentation": { + "column_keys": [], + "grouping_keys": [ + "status", + "v.test_suite" + ] + }, + "builder_group": "chromium.fyi", + "recipe": "chromium" +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/mac-perfetto-rel/properties.json b/infra/config/generated/builders/ci/mac-perfetto-rel/properties.json new file mode 100644 index 0000000..b232002 --- /dev/null +++ b/infra/config/generated/builders/ci/mac-perfetto-rel/properties.json
@@ -0,0 +1,16 @@ +{ + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 250, + "metrics_project": "chromium-reclient-metrics" + }, + "$recipe_engine/resultdb/test_presentation": { + "column_keys": [], + "grouping_keys": [ + "status", + "v.test_suite" + ] + }, + "builder_group": "chromium.fyi", + "recipe": "chromium" +} \ No newline at end of file
diff --git a/infra/config/generated/builders/ci/win-perfetto-rel/properties.json b/infra/config/generated/builders/ci/win-perfetto-rel/properties.json new file mode 100644 index 0000000..b232002 --- /dev/null +++ b/infra/config/generated/builders/ci/win-perfetto-rel/properties.json
@@ -0,0 +1,16 @@ +{ + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 250, + "metrics_project": "chromium-reclient-metrics" + }, + "$recipe_engine/resultdb/test_presentation": { + "column_keys": [], + "grouping_keys": [ + "status", + "v.test_suite" + ] + }, + "builder_group": "chromium.fyi", + "recipe": "chromium" +} \ No newline at end of file
diff --git a/infra/config/generated/builders/try/android-perfetto-rel/properties.json b/infra/config/generated/builders/try/android-perfetto-rel/properties.json new file mode 100644 index 0000000..d90599c --- /dev/null +++ b/infra/config/generated/builders/try/android-perfetto-rel/properties.json
@@ -0,0 +1,17 @@ +{ + "$build/goma": { + "enable_ats": true, + "rpc_extra_params": "?prod", + "server_host": "goma.chromium.org", + "use_luci_auth": true + }, + "$recipe_engine/resultdb/test_presentation": { + "column_keys": [], + "grouping_keys": [ + "status", + "v.test_suite" + ] + }, + "builder_group": "tryserver.chromium.android", + "recipe": "chromium_trybot" +} \ No newline at end of file
diff --git a/infra/config/generated/builders/try/linux-blink-optional-highdpi-rel/properties.json b/infra/config/generated/builders/try/linux-blink-optional-highdpi-rel/properties.json deleted file mode 100644 index 42e7c9c..0000000 --- a/infra/config/generated/builders/try/linux-blink-optional-highdpi-rel/properties.json +++ /dev/null
@@ -1,55 +0,0 @@ -{ - "$build/chromium_tests_builder_config": { - "builder_config": { - "builder_db": { - "entries": [ - { - "builder_id": { - "bucket": "try", - "builder": "linux-blink-optional-highdpi-rel", - "project": "chromium" - }, - "builder_spec": { - "builder_group": "tryserver.blink", - "execution_mode": "COMPILE_AND_TEST", - "legacy_chromium_config": { - "apply_configs": [ - "mb" - ], - "build_config": "Release", - "config": "chromium", - "target_bits": 64 - }, - "legacy_gclient_config": { - "config": "chromium" - } - } - } - ] - }, - "builder_ids": [ - { - "bucket": "try", - "builder": "linux-blink-optional-highdpi-rel", - "project": "chromium" - } - ], - "retry_failed_shards": false - } - }, - "$build/goma": { - "enable_ats": true, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true - }, - "$recipe_engine/resultdb/test_presentation": { - "column_keys": [], - "grouping_keys": [ - "status", - "v.test_suite" - ] - }, - "builder_group": "tryserver.blink", - "recipe": "chromium_trybot" -} \ No newline at end of file
diff --git a/infra/config/generated/builders/try/linux-lacros-rel/properties.json b/infra/config/generated/builders/try/linux-lacros-rel/properties.json index 95dc0a0..8a5373c 100644 --- a/infra/config/generated/builders/try/linux-lacros-rel/properties.json +++ b/infra/config/generated/builders/try/linux-lacros-rel/properties.json
@@ -81,6 +81,9 @@ ] } }, + "$build/flakiness": { + "check_for_flakiness": true + }, "$build/goma": { "enable_ats": true, "jobs": 300,
diff --git a/infra/config/generated/builders/try/mac-perfetto-rel/properties.json b/infra/config/generated/builders/try/mac-perfetto-rel/properties.json new file mode 100644 index 0000000..1112f12 --- /dev/null +++ b/infra/config/generated/builders/try/mac-perfetto-rel/properties.json
@@ -0,0 +1,16 @@ +{ + "$build/goma": { + "rpc_extra_params": "?prod", + "server_host": "goma.chromium.org", + "use_luci_auth": true + }, + "$recipe_engine/resultdb/test_presentation": { + "column_keys": [], + "grouping_keys": [ + "status", + "v.test_suite" + ] + }, + "builder_group": "tryserver.chromium.mac", + "recipe": "chromium_trybot" +} \ No newline at end of file
diff --git a/infra/config/generated/builders/try/mac-rel-compilator/properties.json b/infra/config/generated/builders/try/mac-rel-compilator/properties.json index 58b78d4..2495be26 100644 --- a/infra/config/generated/builders/try/mac-rel-compilator/properties.json +++ b/infra/config/generated/builders/try/mac-rel-compilator/properties.json
@@ -185,6 +185,10 @@ } }, "$build/code_coverage": { + "coverage_test_types": [ + "overall", + "unit" + ], "use_clang_coverage": true }, "$build/flakiness": {
diff --git a/infra/config/generated/builders/try/mac-rel/properties.json b/infra/config/generated/builders/try/mac-rel/properties.json index 0d3a2dc..fd28db35 100644 --- a/infra/config/generated/builders/try/mac-rel/properties.json +++ b/infra/config/generated/builders/try/mac-rel/properties.json
@@ -189,6 +189,10 @@ } }, "$build/code_coverage": { + "coverage_test_types": [ + "overall", + "unit" + ], "use_clang_coverage": true }, "$build/flakiness": {
diff --git a/infra/config/generated/builders/try/mac10.13-blink-rel/properties.json b/infra/config/generated/builders/try/mac10.13-blink-rel/properties.json index 58e5963..7dfd023 100644 --- a/infra/config/generated/builders/try/mac10.13-blink-rel/properties.json +++ b/infra/config/generated/builders/try/mac10.13-blink-rel/properties.json
@@ -34,7 +34,7 @@ "project": "chromium" } ], - "retry_failed_shards": false + "retry_failed_shards": true } }, "$build/goma": {
diff --git a/infra/config/generated/builders/try/mac10.14-blink-rel/properties.json b/infra/config/generated/builders/try/mac10.14-blink-rel/properties.json index 319b82a..a13b979 100644 --- a/infra/config/generated/builders/try/mac10.14-blink-rel/properties.json +++ b/infra/config/generated/builders/try/mac10.14-blink-rel/properties.json
@@ -34,7 +34,7 @@ "project": "chromium" } ], - "retry_failed_shards": false + "retry_failed_shards": true } }, "$build/goma": {
diff --git a/infra/config/generated/builders/try/mac10.15-blink-rel/properties.json b/infra/config/generated/builders/try/mac10.15-blink-rel/properties.json index 6f5407e0..48b4c55 100644 --- a/infra/config/generated/builders/try/mac10.15-blink-rel/properties.json +++ b/infra/config/generated/builders/try/mac10.15-blink-rel/properties.json
@@ -34,7 +34,7 @@ "project": "chromium" } ], - "retry_failed_shards": false + "retry_failed_shards": true } }, "$build/goma": {
diff --git a/infra/config/generated/builders/try/mac11.0-blink-rel/properties.json b/infra/config/generated/builders/try/mac11.0-blink-rel/properties.json index 33c2f1a..993899d 100644 --- a/infra/config/generated/builders/try/mac11.0-blink-rel/properties.json +++ b/infra/config/generated/builders/try/mac11.0-blink-rel/properties.json
@@ -34,7 +34,7 @@ "project": "chromium" } ], - "retry_failed_shards": false + "retry_failed_shards": true } }, "$build/goma": {
diff --git a/infra/config/generated/builders/try/mac11.0.arm64-blink-rel/properties.json b/infra/config/generated/builders/try/mac11.0.arm64-blink-rel/properties.json index 260e055..8617c2d 100644 --- a/infra/config/generated/builders/try/mac11.0.arm64-blink-rel/properties.json +++ b/infra/config/generated/builders/try/mac11.0.arm64-blink-rel/properties.json
@@ -35,7 +35,7 @@ "project": "chromium" } ], - "retry_failed_shards": false + "retry_failed_shards": true } }, "$build/goma": {
diff --git a/infra/config/generated/builders/try/win-perfetto-rel/properties.json b/infra/config/generated/builders/try/win-perfetto-rel/properties.json new file mode 100644 index 0000000..d4fde02b --- /dev/null +++ b/infra/config/generated/builders/try/win-perfetto-rel/properties.json
@@ -0,0 +1,17 @@ +{ + "$build/goma": { + "enable_ats": false, + "rpc_extra_params": "?prod", + "server_host": "goma.chromium.org", + "use_luci_auth": true + }, + "$recipe_engine/resultdb/test_presentation": { + "column_keys": [], + "grouping_keys": [ + "status", + "v.test_suite" + ] + }, + "builder_group": "tryserver.chromium.win", + "recipe": "chromium_trybot" +} \ No newline at end of file
diff --git a/infra/config/generated/luci/commit-queue.cfg b/infra/config/generated/luci/commit-queue.cfg index decd9f2..1c33499 100644 --- a/infra/config/generated/luci/commit-queue.cfg +++ b/infra/config/generated/luci/commit-queue.cfg
@@ -700,6 +700,10 @@ includable_only: true } builders { + name: "chromium/try/android-perfetto-rel" + includable_only: true + } + builders { name: "chromium/try/android-pie-arm64-coverage-experimental-rel" experiment_percentage: 3 location_regexp: ".*" @@ -2548,10 +2552,6 @@ includable_only: true } builders { - name: "chromium/try/linux-blink-optional-highdpi-rel" - includable_only: true - } - builders { name: "chromium/try/linux-blink-rel" location_regexp: ".+/[+]/cc/.+" location_regexp: ".+/[+]/third_party/blink/renderer/core/paint/.+" @@ -3541,6 +3541,10 @@ includable_only: true } builders { + name: "chromium/try/mac-perfetto-rel" + includable_only: true + } + builders { name: "chromium/try/mac-rel" location_regexp: ".*" location_regexp_exclude: ".+/[+]/docs/.+" @@ -3989,6 +3993,10 @@ includable_only: true } builders { + name: "chromium/try/win-perfetto-rel" + includable_only: true + } + builders { name: "chromium/try/win-swangle-chromium-try-x86" includable_only: true }
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index f0b9c9f..2653d86 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -23713,10 +23713,6 @@ build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" experiments { - key: "luci.buildbucket.omit_python2" - value: 0 - } - experiments { key: "luci.recipes.use_python3" value: 100 } @@ -27434,6 +27430,87 @@ } } builders { + name: "android-perfetto-rel" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builderless:1" + dimensions: "cores:8" + dimensions: "cpu:x86-64" + dimensions: "free_space:standard" + dimensions: "os:Ubuntu-18.04" + dimensions: "pool:luci.chromium.ci" + dimensions: "ssd:0" + exe { + cipd_package: "infra/chromium/bootstrapper/${platform}" + cipd_version: "latest" + cmd: "bootstrapper" + } + properties: + '{' + ' "$bootstrap/exe": {' + ' "exe": {' + ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' + ' "cipd_version": "refs/heads/main",' + ' "cmd": [' + ' "luciexe"' + ' ]' + ' }' + ' },' + ' "$bootstrap/properties": {' + ' "properties_file": "infra/config/generated/builders/ci/android-perfetto-rel/properties.json",' + ' "top_level_project": {' + ' "ref": "refs/heads/main",' + ' "repo": {' + ' "host": "chromium.googlesource.com",' + ' "project": "chromium/src"' + ' }' + ' }' + ' },' + ' "builder_group": "chromium.fyi",' + ' "led_builder_is_bootstrapped": true,' + ' "recipe": "chromium"' + '}' + priority: 35 + execution_timeout_secs: 36000 + build_numbers: YES + service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "ci_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_ci_test_results" + test_results { + predicate { + test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_ci_test_results" + test_results { + predicate { + test_id_regexp: "(ninja://[^/]*blink_web_tests/.+)|(ninja://[^/]*blink_wpt_tests/.+)" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + } + builders { name: "android-pie-arm64-coverage-experimental-rel" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" @@ -41935,6 +42012,85 @@ } } builders { + name: "mac-perfetto-rel" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builder:mac-perfetto-rel" + dimensions: "cores:8" + dimensions: "cpu:x86-64" + dimensions: "os:Mac-12" + dimensions: "pool:luci.chromium.ci" + exe { + cipd_package: "infra/chromium/bootstrapper/${platform}" + cipd_version: "latest" + cmd: "bootstrapper" + } + properties: + '{' + ' "$bootstrap/exe": {' + ' "exe": {' + ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' + ' "cipd_version": "refs/heads/main",' + ' "cmd": [' + ' "luciexe"' + ' ]' + ' }' + ' },' + ' "$bootstrap/properties": {' + ' "properties_file": "infra/config/generated/builders/ci/mac-perfetto-rel/properties.json",' + ' "top_level_project": {' + ' "ref": "refs/heads/main",' + ' "repo": {' + ' "host": "chromium.googlesource.com",' + ' "project": "chromium/src"' + ' }' + ' }' + ' },' + ' "builder_group": "chromium.fyi",' + ' "led_builder_is_bootstrapped": true,' + ' "recipe": "chromium"' + '}' + priority: 35 + execution_timeout_secs: 36000 + build_numbers: YES + service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "ci_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_ci_test_results" + test_results { + predicate { + test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_ci_test_results" + test_results { + predicate { + test_id_regexp: "(ninja://[^/]*blink_web_tests/.+)|(ninja://[^/]*blink_wpt_tests/.+)" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + } + builders { name: "mac-swangle-chromium-x64" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" @@ -44303,6 +44459,85 @@ } } builders { + name: "win-perfetto-rel" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builder:win-perfetto-rel" + dimensions: "cores:8" + dimensions: "cpu:x86-64" + dimensions: "os:Windows-10" + dimensions: "pool:luci.chromium.ci" + exe { + cipd_package: "infra/chromium/bootstrapper/${platform}" + cipd_version: "latest" + cmd: "bootstrapper" + } + properties: + '{' + ' "$bootstrap/exe": {' + ' "exe": {' + ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' + ' "cipd_version": "refs/heads/main",' + ' "cmd": [' + ' "luciexe"' + ' ]' + ' }' + ' },' + ' "$bootstrap/properties": {' + ' "properties_file": "infra/config/generated/builders/ci/win-perfetto-rel/properties.json",' + ' "top_level_project": {' + ' "ref": "refs/heads/main",' + ' "repo": {' + ' "host": "chromium.googlesource.com",' + ' "project": "chromium/src"' + ' }' + ' }' + ' },' + ' "builder_group": "chromium.fyi",' + ' "led_builder_is_bootstrapped": true,' + ' "recipe": "chromium"' + '}' + priority: 35 + execution_timeout_secs: 36000 + build_numbers: YES + service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "ci_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_ci_test_results" + test_results { + predicate { + test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_ci_test_results" + test_results { + predicate { + test_id_regexp: "(ninja://[^/]*blink_web_tests/.+)|(ninja://[^/]*blink_wpt_tests/.+)" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + } + builders { name: "win-swangle-chromium-x86" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" @@ -51834,7 +52069,7 @@ ' "recipe": "reviver/chromium/runner"' '}' execution_timeout_secs: 21600 - service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" + service_account: "reviver-builder@chops-service-accounts.iam.gserviceaccount.com" experiments { key: "luci.recipes.use_python3" value: 100 @@ -55969,6 +56204,100 @@ } } builders { + name: "android-perfetto-rel" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builderless:1" + dimensions: "cores:8" + dimensions: "cpu:x86-64" + dimensions: "os:Ubuntu-18.04" + dimensions: "pool:luci.chromium.try" + dimensions: "ssd:0" + exe { + cipd_package: "infra/chromium/bootstrapper/${platform}" + cipd_version: "latest" + cmd: "bootstrapper" + } + properties: + '{' + ' "$bootstrap/exe": {' + ' "exe": {' + ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' + ' "cipd_version": "refs/heads/main",' + ' "cmd": [' + ' "luciexe"' + ' ]' + ' }' + ' },' + ' "$bootstrap/properties": {' + ' "properties_file": "infra/config/generated/builders/try/android-perfetto-rel/properties.json",' + ' "top_level_project": {' + ' "ref": "refs/heads/main",' + ' "repo": {' + ' "host": "chromium.googlesource.com",' + ' "project": "chromium/src"' + ' }' + ' }' + ' },' + ' "builder_group": "tryserver.chromium.android",' + ' "led_builder_is_bootstrapped": true,' + ' "recipe": "chromium_trybot"' + '}' + execution_timeout_secs: 14400 + expiration_secs: 7200 + grace_period { + seconds: 120 + } + 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 + } + experiments { + key: "chromium_swarming.expose_merge_script_failures" + value: 1 + } + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "try_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_try_test_results" + test_results { + predicate { + test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_try_test_results" + test_results { + predicate { + test_id_regexp: "(ninja://[^/]*blink_web_tests/.+)|(ninja://[^/]*blink_wpt_tests/.+)" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + } + builders { name: "android-pie-arm64-coverage-experimental-rel" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" @@ -70927,100 +71256,6 @@ } } builders { - name: "linux-blink-optional-highdpi-rel" - swarming_host: "chromium-swarm.appspot.com" - dimensions: "builderless:1" - dimensions: "cores:8" - dimensions: "cpu:x86-64" - dimensions: "os:Ubuntu-18.04" - dimensions: "pool:luci.chromium.try" - dimensions: "ssd:0" - exe { - cipd_package: "infra/chromium/bootstrapper/${platform}" - cipd_version: "latest" - cmd: "bootstrapper" - } - properties: - '{' - ' "$bootstrap/exe": {' - ' "exe": {' - ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' - ' "cipd_version": "refs/heads/main",' - ' "cmd": [' - ' "luciexe"' - ' ]' - ' }' - ' },' - ' "$bootstrap/properties": {' - ' "properties_file": "infra/config/generated/builders/try/linux-blink-optional-highdpi-rel/properties.json",' - ' "top_level_project": {' - ' "ref": "refs/heads/main",' - ' "repo": {' - ' "host": "chromium.googlesource.com",' - ' "project": "chromium/src"' - ' }' - ' }' - ' },' - ' "builder_group": "tryserver.blink",' - ' "led_builder_is_bootstrapped": true,' - ' "recipe": "chromium_trybot"' - '}' - execution_timeout_secs: 14400 - expiration_secs: 7200 - grace_period { - seconds: 120 - } - 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 - } - experiments { - key: "chromium_swarming.expose_merge_script_failures" - value: 1 - } - experiments { - key: "luci.recipes.use_python3" - value: 100 - } - resultdb { - enable: true - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "try_test_results" - test_results {} - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "gpu_try_test_results" - test_results { - predicate { - test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" - } - } - } - bq_exports { - project: "chrome-luci-data" - dataset: "chromium" - table: "blink_web_tests_try_test_results" - test_results { - predicate { - test_id_regexp: "(ninja://[^/]*blink_web_tests/.+)|(ninja://[^/]*blink_wpt_tests/.+)" - } - } - } - history_options { - use_invocation_timestamp: true - } - } - } - builders { name: "linux-blink-rel" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1" @@ -79282,6 +79517,99 @@ } } builders { + name: "mac-perfetto-rel" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builderless:1" + dimensions: "cpu:x86-64" + dimensions: "os:Mac" + dimensions: "pool:luci.chromium.try" + dimensions: "ssd:1" + exe { + cipd_package: "infra/chromium/bootstrapper/${platform}" + cipd_version: "latest" + cmd: "bootstrapper" + } + properties: + '{' + ' "$bootstrap/exe": {' + ' "exe": {' + ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' + ' "cipd_version": "refs/heads/main",' + ' "cmd": [' + ' "luciexe"' + ' ]' + ' }' + ' },' + ' "$bootstrap/properties": {' + ' "properties_file": "infra/config/generated/builders/try/mac-perfetto-rel/properties.json",' + ' "top_level_project": {' + ' "ref": "refs/heads/main",' + ' "repo": {' + ' "host": "chromium.googlesource.com",' + ' "project": "chromium/src"' + ' }' + ' }' + ' },' + ' "builder_group": "tryserver.chromium.mac",' + ' "led_builder_is_bootstrapped": true,' + ' "recipe": "chromium_trybot"' + '}' + execution_timeout_secs: 14400 + expiration_secs: 7200 + grace_period { + seconds: 120 + } + 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 + } + experiments { + key: "chromium_swarming.expose_merge_script_failures" + value: 1 + } + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "try_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_try_test_results" + test_results { + predicate { + test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_try_test_results" + test_results { + predicate { + test_id_regexp: "(ninja://[^/]*blink_web_tests/.+)|(ninja://[^/]*blink_wpt_tests/.+)" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + } + builders { name: "mac-rel" swarming_host: "chromium-swarm.appspot.com" dimensions: "cores:2" @@ -83442,6 +83770,100 @@ } } builders { + name: "win-perfetto-rel" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builderless:1" + dimensions: "cores:8" + dimensions: "cpu:x86-64" + dimensions: "os:Windows-10" + dimensions: "pool:luci.chromium.try" + dimensions: "ssd:0" + exe { + cipd_package: "infra/chromium/bootstrapper/${platform}" + cipd_version: "latest" + cmd: "bootstrapper" + } + properties: + '{' + ' "$bootstrap/exe": {' + ' "exe": {' + ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' + ' "cipd_version": "refs/heads/main",' + ' "cmd": [' + ' "luciexe"' + ' ]' + ' }' + ' },' + ' "$bootstrap/properties": {' + ' "properties_file": "infra/config/generated/builders/try/win-perfetto-rel/properties.json",' + ' "top_level_project": {' + ' "ref": "refs/heads/main",' + ' "repo": {' + ' "host": "chromium.googlesource.com",' + ' "project": "chromium/src"' + ' }' + ' }' + ' },' + ' "builder_group": "tryserver.chromium.win",' + ' "led_builder_is_bootstrapped": true,' + ' "recipe": "chromium_trybot"' + '}' + execution_timeout_secs: 14400 + expiration_secs: 7200 + grace_period { + seconds: 120 + } + 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 + } + experiments { + key: "chromium_swarming.expose_merge_script_failures" + value: 1 + } + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "try_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_try_test_results" + test_results { + predicate { + test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_try_test_results" + test_results { + predicate { + test_id_regexp: "(ninja://[^/]*blink_web_tests/.+)|(ninja://[^/]*blink_wpt_tests/.+)" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + } + builders { name: "win-swangle-chromium-try-x86" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1"
diff --git a/infra/config/generated/luci/luci-milo.cfg b/infra/config/generated/luci/luci-milo.cfg index 32ce8474..2aac844 100644 --- a/infra/config/generated/luci/luci-milo.cfg +++ b/infra/config/generated/luci/luci-milo.cfg
@@ -7945,6 +7945,10 @@ category: "mac" } builders { + name: "buildbucket/luci.chromium.ci/mac-perfetto-rel" + category: "mac" + } + builders { name: "buildbucket/luci.chromium.ci/Mac Builder Next" category: "mac" short_name: "bld" @@ -8267,6 +8271,10 @@ category: "android" } builders { + name: "buildbucket/luci.chromium.ci/android-perfetto-rel" + category: "android" + } + builders { name: "buildbucket/luci.chromium.ci/Comparison Android (reclient)" category: "android" short_name: "cmp" @@ -8415,6 +8423,10 @@ category: "win" } builders { + name: "buildbucket/luci.chromium.ci/win-perfetto-rel" + category: "win" + } + builders { name: "buildbucket/luci.chromium.ci/win10-rel-no-external-ip" category: "win" } @@ -16429,6 +16441,9 @@ name: "buildbucket/luci.chromium.try/android-oreo-arm64-dbg" } builders { + name: "buildbucket/luci.chromium.try/android-perfetto-rel" + } + builders { name: "buildbucket/luci.chromium.try/android-pie-arm64-coverage-experimental-rel" } builders { @@ -16906,9 +16921,6 @@ name: "buildbucket/luci.chromium.try/linux-blink-heap-verification-try" } builders { - name: "buildbucket/luci.chromium.try/linux-blink-optional-highdpi-rel" - } - builders { name: "buildbucket/luci.chromium.try/linux-blink-rel" } builders { @@ -17170,6 +17182,9 @@ name: "buildbucket/luci.chromium.try/mac-osxbeta-rel" } builders { + name: "buildbucket/luci.chromium.try/mac-perfetto-rel" + } + builders { name: "buildbucket/luci.chromium.try/mac-rel" } builders { @@ -17305,6 +17320,9 @@ name: "buildbucket/luci.chromium.try/win-official" } builders { + name: "buildbucket/luci.chromium.try/win-perfetto-rel" + } + builders { name: "buildbucket/luci.chromium.try/win-swangle-chromium-try-x86" } builders { @@ -17406,9 +17424,6 @@ id: "tryserver.blink" name: "tryserver.blink" builders { - name: "buildbucket/luci.chromium.try/linux-blink-optional-highdpi-rel" - } - builders { name: "buildbucket/luci.chromium.try/linux-blink-rel" } builders { @@ -17589,6 +17604,9 @@ name: "buildbucket/luci.chromium.try/android-oreo-arm64-dbg" } builders { + name: "buildbucket/luci.chromium.try/android-perfetto-rel" + } + builders { name: "buildbucket/luci.chromium.try/android-pie-arm64-coverage-experimental-rel" } builders { @@ -18314,6 +18332,9 @@ name: "buildbucket/luci.chromium.try/mac-osxbeta-rel" } builders { + name: "buildbucket/luci.chromium.try/mac-perfetto-rel" + } + builders { name: "buildbucket/luci.chromium.try/mac-rel" } builders { @@ -18533,6 +18554,9 @@ name: "buildbucket/luci.chromium.try/win-libfuzzer-asan-rel" } builders { + name: "buildbucket/luci.chromium.try/win-perfetto-rel" + } + builders { name: "buildbucket/luci.chromium.try/win10_chromium_inverse_fieldtrials_x64_fyi_rel_ng" } builders {
diff --git a/infra/config/generated/luci/luci-scheduler.cfg b/infra/config/generated/luci/luci-scheduler.cfg index 64e202a..586cfd27 100644 --- a/infra/config/generated/luci/luci-scheduler.cfg +++ b/infra/config/generated/luci/luci-scheduler.cfg
@@ -4784,6 +4784,17 @@ } } job { + id: "android-perfetto-rel" + realm: "ci" + schedule: "triggered" + acl_sets: "ci" + buildbucket { + server: "cr-buildbucket.appspot.com" + bucket: "ci" + builder: "android-perfetto-rel" + } +} +job { id: "android-pie-arm64-coverage-experimental-rel" realm: "ci" acl_sets: "ci" @@ -6795,6 +6806,17 @@ } } job { + id: "mac-perfetto-rel" + realm: "ci" + schedule: "triggered" + acl_sets: "ci" + buildbucket { + server: "cr-buildbucket.appspot.com" + bucket: "ci" + builder: "mac-perfetto-rel" + } +} +job { id: "mac-swangle-chromium-x64" realm: "ci" acl_sets: "ci" @@ -7142,6 +7164,17 @@ } } job { + id: "win-perfetto-rel" + realm: "ci" + schedule: "triggered" + acl_sets: "ci" + buildbucket { + server: "cr-buildbucket.appspot.com" + bucket: "ci" + builder: "win-perfetto-rel" + } +} +job { id: "win-swangle-chromium-x86" realm: "ci" acl_sets: "ci"
diff --git a/infra/config/generated/luci/realms.cfg b/infra/config/generated/luci/realms.cfg index d948a02..5557491 100644 --- a/infra/config/generated/luci/realms.cfg +++ b/infra/config/generated/luci/realms.cfg
@@ -508,7 +508,6 @@ name: "reviver" bindings { role: "role/buildbucket.builderServiceAccount" - principals: "user:chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" principals: "user:reviver-builder@chops-service-accounts.iam.gserviceaccount.com" } bindings {
diff --git a/infra/config/lib/builders.star b/infra/config/lib/builders.star index 111dcae..edf69f1e 100644 --- a/infra/config/lib/builders.star +++ b/infra/config/lib/builders.star
@@ -369,6 +369,10 @@ reclient_cache_silo = None, reclient_ensure_verified = None, + # This is to enable luci.buildbucket.omit_python2 experiment. + # TODO(crbug.com/1362440): remove this after enabling this in all builders. + omit_python2 = True, + # Provide vars for bucket and executable so users don't have to # unnecessarily make wrapper functions bucket = args.COMPUTE, @@ -426,6 +430,7 @@ reclient_publish_trace = args.DEFAULT, reclient_cache_silo = None, reclient_ensure_verified = None, + omit_python2 = args.DEFAULT, **kwargs): """Define a builder. @@ -597,6 +602,9 @@ remote caching. Has no effect if reclient_instance is not set. reclient_ensure_verified: If True, it verifies build artifacts. Has no effect if reclient_instance is not set. + omit_python2: If True, set luci.buildbucket.omit_python2 experiment. + TODO(crbug.com/1362440): remove this after enabling this in all + builders. **kwargs: Additional keyword arguments to forward on to `luci.builder`. Returns: @@ -778,6 +786,13 @@ if triggered_by != args.COMPUTE: kwargs["triggered_by"] = triggered_by + experiments = kwargs.pop("experiments", None) or {} + + # TODO: remove this after this experiment is removed from + # cr-buildbucket/settings.cfg (http://shortn/_cz2s9ql61X). + if defaults.get_value("omit_python2", omit_python2): + experiments["luci.buildbucket.omit_python2"] = 100 + builder = branches.builder( name = name, branch_selector = branch_selector, @@ -791,6 +806,7 @@ ), history_options = history_options, ), + experiments = experiments, **kwargs )
diff --git a/infra/config/subprojects/chromium/angle.try.star b/infra/config/subprojects/chromium/angle.try.star index 6eb6f8f..c7fcf009 100644 --- a/infra/config/subprojects/chromium/angle.try.star +++ b/infra/config/subprojects/chromium/angle.try.star
@@ -30,6 +30,8 @@ service_account = "chromium-try-gpu-builder@chops-service-accounts.iam.gserviceaccount.com", subproject_list_view = "luci.chromium.try", task_template_canary_percentage = 5, + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) def angle_mac_builder(*, name, **kwargs):
diff --git a/infra/config/subprojects/chromium/ci/chromium.accessibility.star b/infra/config/subprojects/chromium/ci/chromium.accessibility.star index 7dbdeba..72d185b5 100644 --- a/infra/config/subprojects/chromium/ci/chromium.accessibility.star +++ b/infra/config/subprojects/chromium/ci/chromium.accessibility.star
@@ -19,6 +19,9 @@ reclient_jobs = reclient.jobs.HIGH_JOBS_FOR_CI, reclient_instance = reclient.instance.DEFAULT_TRUSTED, service_account = ci.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.android.fyi.star b/infra/config/subprojects/chromium/ci/chromium.android.fyi.star index e2d287b7..6dbcedb 100644 --- a/infra/config/subprojects/chromium/ci/chromium.android.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.android.fyi.star
@@ -19,6 +19,9 @@ service_account = ci.DEFAULT_SERVICE_ACCOUNT, reclient_jobs = reclient.jobs.DEFAULT, reclient_instance = reclient.instance.DEFAULT_TRUSTED, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.android.star b/infra/config/subprojects/chromium/ci/chromium.android.star index 516c0d5..e355086b 100644 --- a/infra/config/subprojects/chromium/ci/chromium.android.star +++ b/infra/config/subprojects/chromium/ci/chromium.android.star
@@ -21,6 +21,9 @@ reclient_jobs = reclient.jobs.HIGH_JOBS_FOR_CI, service_account = ci.DEFAULT_SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.ANDROID, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.angle.star b/infra/config/subprojects/chromium/ci/chromium.angle.star index 4c91a36..eff1a9e 100644 --- a/infra/config/subprojects/chromium/ci/chromium.angle.star +++ b/infra/config/subprojects/chromium/ci/chromium.angle.star
@@ -21,6 +21,9 @@ service_account = ci.gpu.SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.ANGLE, thin_tester_cores = 2, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.chromiumos.star b/infra/config/subprojects/chromium/ci/chromium.chromiumos.star index ba85e049..7219d1e 100644 --- a/infra/config/subprojects/chromium/ci/chromium.chromiumos.star +++ b/infra/config/subprojects/chromium/ci/chromium.chromiumos.star
@@ -22,6 +22,9 @@ service_account = ci.DEFAULT_SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM, tree_closing = True, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.clang.star b/infra/config/subprojects/chromium/ci/chromium.clang.star index d1ab213..e9dc590a 100644 --- a/infra/config/subprojects/chromium/ci/chromium.clang.star +++ b/infra/config/subprojects/chromium/ci/chromium.clang.star
@@ -24,6 +24,9 @@ }, service_account = ci.DEFAULT_SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM_CLANG, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.dawn.star b/infra/config/subprojects/chromium/ci/chromium.dawn.star index 9a17e4a..16183e9 100644 --- a/infra/config/subprojects/chromium/ci/chromium.dawn.star +++ b/infra/config/subprojects/chromium/ci/chromium.dawn.star
@@ -18,6 +18,9 @@ pool = ci.gpu.POOL, service_account = ci.gpu.SERVICE_ACCOUNT, thin_tester_cores = 2, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.fuchsia.fyi.star b/infra/config/subprojects/chromium/ci/chromium.fuchsia.fyi.star index 95d633b..625d0406 100644 --- a/infra/config/subprojects/chromium/ci/chromium.fuchsia.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.fuchsia.fyi.star
@@ -20,6 +20,9 @@ pool = ci.DEFAULT_POOL, service_account = ci.DEFAULT_SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.FUCHSIA, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.fuchsia.star b/infra/config/subprojects/chromium/ci/chromium.fuchsia.star index 59d67ad..4130ab1 100644 --- a/infra/config/subprojects/chromium/ci/chromium.fuchsia.star +++ b/infra/config/subprojects/chromium/ci/chromium.fuchsia.star
@@ -25,6 +25,9 @@ service_account = ci.DEFAULT_SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM, tree_closing = True, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.fuzz.star b/infra/config/subprojects/chromium/ci/chromium.fuzz.star index b03e8f8c..4984f97 100644 --- a/infra/config/subprojects/chromium/ci/chromium.fuzz.star +++ b/infra/config/subprojects/chromium/ci/chromium.fuzz.star
@@ -18,6 +18,9 @@ os = os.LINUX_DEFAULT, pool = ci.DEFAULT_POOL, service_account = ci.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.fyi.star b/infra/config/subprojects/chromium/ci/chromium.fyi.star index ae9ef87..330146f 100644 --- a/infra/config/subprojects/chromium/ci/chromium.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.fyi.star
@@ -19,6 +19,9 @@ pool = ci.DEFAULT_POOL, priority = ci.DEFAULT_FYI_PRIORITY, service_account = ci.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view( @@ -746,6 +749,19 @@ ) ci.builder( + name = "android-perfetto-rel", + console_view_entry = consoles.console_view_entry( + category = "android", + ), + schedule = "triggered", + triggered_by = [], + os = os.LINUX_DEFAULT, + goma_backend = None, + reclient_jobs = reclient.jobs.DEFAULT, + reclient_instance = reclient.instance.DEFAULT_TRUSTED, +) + +ci.builder( name = "linux-perfetto-rel", console_view_entry = consoles.console_view_entry( category = "linux", @@ -757,6 +773,19 @@ ) ci.builder( + name = "mac-perfetto-rel", + console_view_entry = consoles.console_view_entry( + category = "mac", + ), + schedule = "triggered", + triggered_by = [], + os = os.MAC_DEFAULT, + goma_backend = None, + reclient_jobs = reclient.jobs.DEFAULT, + reclient_instance = reclient.instance.DEFAULT_TRUSTED, +) + +ci.builder( name = "linux-wpt-content-shell-fyi-rel", console_view_entry = consoles.console_view_entry( category = "linux", @@ -967,6 +996,19 @@ reclient_instance = reclient.instance.DEFAULT_TRUSTED, ) +ci.builder( + name = "win-perfetto-rel", + console_view_entry = consoles.console_view_entry( + category = "win", + ), + schedule = "triggered", + triggered_by = [], + os = os.WINDOWS_DEFAULT, + goma_backend = None, + reclient_jobs = reclient.jobs.DEFAULT, + reclient_instance = reclient.instance.DEFAULT_TRUSTED, +) + # TODO(crbug.com/1320004): Remove this builder after experimentation. ci.builder( name = "win10-rel-no-external-ip",
diff --git a/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star b/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star index 1b1ae51..1a60e91 100644 --- a/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.gpu.fyi.star
@@ -21,6 +21,9 @@ service_account = ci.gpu.SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM_GPU, thin_tester_cores = 2, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.gpu.star b/infra/config/subprojects/chromium/ci/chromium.gpu.star index a2cbbfd..fc62996 100644 --- a/infra/config/subprojects/chromium/ci/chromium.gpu.star +++ b/infra/config/subprojects/chromium/ci/chromium.gpu.star
@@ -23,6 +23,9 @@ tree_closing = True, tree_closing_notifiers = ci.gpu.TREE_CLOSING_NOTIFIERS, thin_tester_cores = 2, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.linux.star b/infra/config/subprojects/chromium/ci/chromium.linux.star index 9ecc450..10e60b1 100644 --- a/infra/config/subprojects/chromium/ci/chromium.linux.star +++ b/infra/config/subprojects/chromium/ci/chromium.linux.star
@@ -24,6 +24,9 @@ service_account = ci.DEFAULT_SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM, tree_closing = True, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.mac.star b/infra/config/subprojects/chromium/ci/chromium.mac.star index 0f49039b..8e9bf3c 100644 --- a/infra/config/subprojects/chromium/ci/chromium.mac.star +++ b/infra/config/subprojects/chromium/ci/chromium.mac.star
@@ -23,9 +23,6 @@ sheriff_rotations = sheriff_rotations.CHROMIUM, thin_tester_cores = 8, tree_closing = True, - experiments = { - "luci.buildbucket.omit_python2": 100, - }, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.memory.star b/infra/config/subprojects/chromium/ci/chromium.memory.star index 1e973e36..c1ff466 100644 --- a/infra/config/subprojects/chromium/ci/chromium.memory.star +++ b/infra/config/subprojects/chromium/ci/chromium.memory.star
@@ -23,6 +23,9 @@ service_account = ci.DEFAULT_SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM, tree_closing = True, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.packager.star b/infra/config/subprojects/chromium/ci/chromium.packager.star index 3e4b1f20..f059828 100644 --- a/infra/config/subprojects/chromium/ci/chromium.packager.star +++ b/infra/config/subprojects/chromium/ci/chromium.packager.star
@@ -14,6 +14,9 @@ os = os.LINUX_DEFAULT, pool = ci.DEFAULT_POOL, service_account = "chromium-cipd-builder@chops-service-accounts.iam.gserviceaccount.com", + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.rust.star b/infra/config/subprojects/chromium/ci/chromium.rust.star index 977f1a1..d5fa1e0 100644 --- a/infra/config/subprojects/chromium/ci/chromium.rust.star +++ b/infra/config/subprojects/chromium/ci/chromium.rust.star
@@ -19,6 +19,9 @@ service_account = ci.DEFAULT_SERVICE_ACCOUNT, os = os.LINUX_DEFAULT, notifies = ["chrome-rust-experiments"], + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.star b/infra/config/subprojects/chromium/ci/chromium.star index b1791cd..1321b87 100644 --- a/infra/config/subprojects/chromium/ci/chromium.star +++ b/infra/config/subprojects/chromium/ci/chromium.star
@@ -20,6 +20,9 @@ pool = ci.DEFAULT_POOL, service_account = ci.DEFAULT_SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.swangle.star b/infra/config/subprojects/chromium/ci/chromium.swangle.star index f8ed387..2385725 100644 --- a/infra/config/subprojects/chromium/ci/chromium.swangle.star +++ b/infra/config/subprojects/chromium/ci/chromium.swangle.star
@@ -16,6 +16,9 @@ pool = ci.gpu.POOL, service_account = ci.gpu.SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM_GPU, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.updater.star b/infra/config/subprojects/chromium/ci/chromium.updater.star index 24b3aa7..13026dc 100644 --- a/infra/config/subprojects/chromium/ci/chromium.updater.star +++ b/infra/config/subprojects/chromium/ci/chromium.updater.star
@@ -18,6 +18,9 @@ os = os.LINUX_DEFAULT, pool = ci.DEFAULT_POOL, service_account = ci.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/ci/chromium.win.star b/infra/config/subprojects/chromium/ci/chromium.win.star index 171b93a..3741d94 100644 --- a/infra/config/subprojects/chromium/ci/chromium.win.star +++ b/infra/config/subprojects/chromium/ci/chromium.win.star
@@ -23,9 +23,6 @@ service_account = ci.DEFAULT_SERVICE_ACCOUNT, sheriff_rotations = sheriff_rotations.CHROMIUM, tree_closing = True, - experiments = { - "luci.buildbucket.omit_python2": 100, - }, ) consoles.console_view( @@ -351,8 +348,7 @@ ), executable = "recipe:swarming/deterministic_build", execution_timeout = 12 * time.hour, + # TODO(https://crbug.com/1362440): remove this and use default value. - experiments = { - "luci.buildbucket.omit_python2": 0, - }, + omit_python2 = False, )
diff --git a/infra/config/subprojects/chromium/ci/metadata.exporter.star b/infra/config/subprojects/chromium/ci/metadata.exporter.star index d22e1b5..943caad 100644 --- a/infra/config/subprojects/chromium/ci/metadata.exporter.star +++ b/infra/config/subprojects/chromium/ci/metadata.exporter.star
@@ -12,6 +12,9 @@ execution_timeout = ci.DEFAULT_EXECUTION_TIMEOUT, os = os.LINUX_DEFAULT, pool = ci.DEFAULT_POOL, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/gpu.try.star b/infra/config/subprojects/chromium/gpu.try.star index d7196975..204745f 100644 --- a/infra/config/subprojects/chromium/gpu.try.star +++ b/infra/config/subprojects/chromium/gpu.try.star
@@ -27,6 +27,8 @@ service_account = "chromium-try-gpu-builder@chops-service-accounts.iam.gserviceaccount.com", subproject_list_view = "luci.chromium.try", task_template_canary_percentage = 5, + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) # Builders appear after the function used to define them, with all builders
diff --git a/infra/config/subprojects/chromium/infra.star b/infra/config/subprojects/chromium/infra.star index 64bcc0bf..cfa248d 100644 --- a/infra/config/subprojects/chromium/infra.star +++ b/infra/config/subprojects/chromium/infra.star
@@ -10,6 +10,8 @@ build_numbers = True, cores = 8, cpu = cpu.X86_64, + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/chromium/swangle.try.star b/infra/config/subprojects/chromium/swangle.try.star index 1d597436..7b2c0ab05 100644 --- a/infra/config/subprojects/chromium/swangle.try.star +++ b/infra/config/subprojects/chromium/swangle.try.star
@@ -30,6 +30,8 @@ service_account = "chromium-try-gpu-builder@chops-service-accounts.iam.gserviceaccount.com", subproject_list_view = "luci.chromium.try", task_template_canary_percentage = 5, + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/presubmit.star b/infra/config/subprojects/chromium/try/presubmit.star index 36d74f4..53d115f 100644 --- a/infra/config/subprojects/chromium/try/presubmit.star +++ b/infra/config/subprojects/chromium/try/presubmit.star
@@ -23,6 +23,9 @@ # when addressing outages priority = 25, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.blink.star b/infra/config/subprojects/chromium/try/tryserver.blink.star index bc0f6be0..2a1e808 100644 --- a/infra/config/subprojects/chromium/try/tryserver.blink.star +++ b/infra/config/subprojects/chromium/try/tryserver.blink.star
@@ -16,6 +16,9 @@ execution_timeout = try_.DEFAULT_EXECUTION_TIMEOUT, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view( @@ -35,28 +38,6 @@ ) try_.builder( - name = "linux-blink-optional-highdpi-rel", - builder_spec = builder_config.builder_spec( - gclient_config = builder_config.gclient_config( - config = "chromium", - ), - chromium_config = builder_config.chromium_config( - config = "chromium", - apply_configs = [ - "mb", - ], - build_config = builder_config.build_config.RELEASE, - target_bits = 64, - ), - ), - try_settings = builder_config.try_settings( - retry_failed_shards = False, - ), - goma_backend = goma.backend.RBE_PROD, - os = os.LINUX_DEFAULT, -) - -try_.builder( name = "linux-blink-rel", branch_selector = branches.STANDARD_MILESTONE, builder_spec = builder_config.builder_spec( @@ -152,7 +133,7 @@ ), ), try_settings = builder_config.try_settings( - retry_failed_shards = False, + retry_failed_shards = True, ), ) @@ -172,7 +153,7 @@ ), ), try_settings = builder_config.try_settings( - retry_failed_shards = False, + retry_failed_shards = True, ), ) @@ -192,7 +173,7 @@ ), ), try_settings = builder_config.try_settings( - retry_failed_shards = False, + retry_failed_shards = True, ), ) @@ -212,7 +193,7 @@ ), ), try_settings = builder_config.try_settings( - retry_failed_shards = False, + retry_failed_shards = True, ), builderless = False, ) @@ -234,7 +215,7 @@ build_gs_bucket = "chromium-fyi-archive", ), try_settings = builder_config.try_settings( - retry_failed_shards = False, + retry_failed_shards = True, ), )
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.accessibility.star b/infra/config/subprojects/chromium/try/tryserver.chromium.accessibility.star index e27e1838..de1381b2 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.accessibility.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.accessibility.star
@@ -18,6 +18,9 @@ os = os.LINUX_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.android.star b/infra/config/subprojects/chromium/try/tryserver.chromium.android.star index 9266e5a..c8228a3 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.android.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.android.star
@@ -22,6 +22,9 @@ os = os.LINUX_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view( @@ -374,6 +377,10 @@ ) try_.builder( + name = "android-perfetto-rel", +) + +try_.builder( name = "android-pie-arm64-dbg", branch_selector = branches.STANDARD_MILESTONE, builderless = False,
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.angle.star b/infra/config/subprojects/chromium/try/tryserver.chromium.angle.star index b12accb..7369fde 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.angle.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.angle.star
@@ -20,6 +20,9 @@ os = os.LINUX_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.gpu.SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.chromiumos.star b/infra/config/subprojects/chromium/try/tryserver.chromium.chromiumos.star index 744398c..d39a71c 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.chromiumos.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.chromiumos.star
@@ -21,6 +21,9 @@ os = os.LINUX_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view( @@ -299,8 +302,7 @@ ], branch_selector = branches.STANDARD_MILESTONE, builderless = not settings.is_main, - # TODO(sshrimp): Re-enable when there's less traffic on the test bots - check_for_flakiness = False, + check_for_flakiness = True, cores = 16, ssd = True, goma_jobs = goma.jobs.J300,
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.dawn.star b/infra/config/subprojects/chromium/try/tryserver.chromium.dawn.star index 29f33fa..124b69ce 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.dawn.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.dawn.star
@@ -17,6 +17,9 @@ os = os.LINUX_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.gpu.SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.fuchsia.star b/infra/config/subprojects/chromium/try/tryserver.chromium.fuchsia.star index 20c9084..dd40f03f 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.fuchsia.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.fuchsia.star
@@ -22,6 +22,9 @@ os = os.LINUX_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star b/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star index 3054f739..651b4ac 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.linux.star
@@ -24,6 +24,9 @@ os = os.LINUX_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.mac.star b/infra/config/subprojects/chromium/try/tryserver.chromium.mac.star index f27ff2d..1c9f312 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.mac.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.mac.star
@@ -21,6 +21,9 @@ pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, ssd = True, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) def ios_builder(*, name, **kwargs): @@ -80,6 +83,10 @@ builderless = False, ) +try_.builder( + name = "mac-perfetto-rel", +) + try_.orchestrator_builder( name = "mac-rel", compilator = "mac-rel-compilator", @@ -99,6 +106,7 @@ ), main_list_view = "try", use_clang_coverage = True, + coverage_test_types = ["overall", "unit"], tryjob = try_.job(), experiments = { "remove_src_checkout_experiment": 100,
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.packager.star b/infra/config/subprojects/chromium/try/tryserver.chromium.packager.star index fbd5ef7..a35bbf0 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.packager.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.packager.star
@@ -13,6 +13,9 @@ execution_timeout = try_.DEFAULT_EXECUTION_TIMEOUT, pool = try_.DEFAULT_POOL, service_account = "chromium-cipd-try-builder@chops-service-accounts.iam.gserviceaccount.com", + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.rust.star b/infra/config/subprojects/chromium/try/tryserver.chromium.rust.star index 9c75985..8d94738d 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.rust.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.rust.star
@@ -17,6 +17,9 @@ os = os.LINUX_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.star b/infra/config/subprojects/chromium/try/tryserver.chromium.star index 12e6806..8987686 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.star
@@ -18,6 +18,9 @@ os = os.LINUX_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.tricium.star b/infra/config/subprojects/chromium/try/tryserver.chromium.tricium.star index cc09b2b..690e5681 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.tricium.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.tricium.star
@@ -23,6 +23,9 @@ # Make each bot specify its own OS, since we have a variety of these in this # file. + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.updater.star b/infra/config/subprojects/chromium/try/tryserver.chromium.updater.star index 59e8e49..608c79b1 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.updater.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.updater.star
@@ -15,6 +15,9 @@ goma_backend = goma.backend.RBE_PROD, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view(
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.win.star b/infra/config/subprojects/chromium/try/tryserver.chromium.win.star index ec19598..b004a78 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.win.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.win.star
@@ -22,6 +22,9 @@ os = os.WINDOWS_DEFAULT, pool = try_.DEFAULT_POOL, service_account = try_.DEFAULT_SERVICE_ACCOUNT, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.list_view( @@ -233,6 +236,10 @@ mirrors = ["ci/win-fieldtrial-rel"], ) +try_.builder( + name = "win-perfetto-rel", +) + try_.gpu.optional_tests_builder( name = "win_optional_gpu_tests_rel", builder_spec = builder_config.builder_spec(
diff --git a/infra/config/subprojects/codesearch/codesearch.star b/infra/config/subprojects/codesearch/codesearch.star index 8ff813f..e585d406 100644 --- a/infra/config/subprojects/codesearch/codesearch.star +++ b/infra/config/subprojects/codesearch/codesearch.star
@@ -46,6 +46,9 @@ ), ]) +# TODO(crbug.com/1362440): remove this. +try_.defaults.omit_python2.set(False) + consoles.list_view( name = "tryserver.chromium.codesearch", )
diff --git a/infra/config/subprojects/findit/findit.star b/infra/config/subprojects/findit/findit.star index 14eafbf..696e11a 100644 --- a/infra/config/subprojects/findit/findit.star +++ b/infra/config/subprojects/findit/findit.star
@@ -53,6 +53,9 @@ ), ]) +# TODO(crbug.com/1362440): remove this. +defaults.omit_python2.set(False) + # Builders are defined in lexicographic order by name # Same as findit_variable, except now with a specified recipe, as this is no
diff --git a/infra/config/subprojects/flakiness/flakiness.star b/infra/config/subprojects/flakiness/flakiness.star index b2e2433..30dc712 100644 --- a/infra/config/subprojects/flakiness/flakiness.star +++ b/infra/config/subprojects/flakiness/flakiness.star
@@ -16,6 +16,9 @@ # below for bucket ACL service_account = "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com", free_space = builders.free_space.standard, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) luci.bucket(
diff --git a/infra/config/subprojects/flakiness/reproducer.star b/infra/config/subprojects/flakiness/reproducer.star index 5daea9a..de2d491 100644 --- a/infra/config/subprojects/flakiness/reproducer.star +++ b/infra/config/subprojects/flakiness/reproducer.star
@@ -38,4 +38,7 @@ category = "flakiness", short_name = "reproducer", ), + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, )
diff --git a/infra/config/subprojects/goma/goma.star b/infra/config/subprojects/goma/goma.star index 240c15f..72016da 100644 --- a/infra/config/subprojects/goma/goma.star +++ b/infra/config/subprojects/goma/goma.star
@@ -38,6 +38,9 @@ ) defaults.triggered_by.set(["chromium-gitiles-trigger"]) +# TODO(crbug.com/1362440): remove this. +defaults.omit_python2.set(False) + # Builders appear after the function used to define them, with all builders # defined using the same function ordered lexicographically by name # Builder functions are defined in lexicographic order by name ignoring the
diff --git a/infra/config/subprojects/reclient/reclient.star b/infra/config/subprojects/reclient/reclient.star index 06841ae6..f9bda02 100644 --- a/infra/config/subprojects/reclient/reclient.star +++ b/infra/config/subprojects/reclient/reclient.star
@@ -42,6 +42,9 @@ ), triggered_by = ["chromium-gitiles-trigger"], free_space = builders.free_space.standard, + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) consoles.console_view(
diff --git a/infra/config/subprojects/reviver/reviver.star b/infra/config/subprojects/reviver/reviver.star index 5958c8ee..088c664 100644 --- a/infra/config/subprojects/reviver/reviver.star +++ b/infra/config/subprojects/reviver/reviver.star
@@ -37,6 +37,9 @@ bucket = "reviver", list_view = "reviver", service_account = "reviver-builder@chops-service-accounts.iam.gserviceaccount.com", + + # TODO(crbug.com/1362440): remove this. + omit_python2 = False, ) def target_builder(*, name, dimensions): @@ -83,9 +86,6 @@ auto_builder_dimension = False, execution_timeout = 6 * time.hour, pool = ci.DEFAULT_POOL, - # TODO(crbug/1346396) Remove this once the reviver service account has - # necessary permissions - service_account = ci.DEFAULT_SERVICE_ACCOUNT, resultdb_bigquery_exports = [ resultdb.export_test_results( bq_table = "chrome-luci-data.chromium.reviver_test_results",
diff --git a/infra/config/subprojects/webrtc/webrtc.fyi.star b/infra/config/subprojects/webrtc/webrtc.fyi.star index 5a04ad3..2c24dd5 100644 --- a/infra/config/subprojects/webrtc/webrtc.fyi.star +++ b/infra/config/subprojects/webrtc/webrtc.fyi.star
@@ -45,6 +45,9 @@ defaults.service_account.set("chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com") defaults.triggered_by.set(["webrtc-gitiles-trigger"]) +# TODO(crbug.com/1362440): remove this. +defaults.omit_python2.set(False) + # Builders are defined in lexicographic order by name builder(
diff --git a/infra/config/subprojects/webrtc/webrtc.star b/infra/config/subprojects/webrtc/webrtc.star index 0ebc5073..bb39db39 100644 --- a/infra/config/subprojects/webrtc/webrtc.star +++ b/infra/config/subprojects/webrtc/webrtc.star
@@ -41,6 +41,9 @@ "perf_dashboard_machine_group": "ChromiumWebRTC", }) +# TODO(crbug.com/1362440): remove this. +defaults.omit_python2.set(False) + # Builders are defined in lexicographic order by name builder(
diff --git a/ios/chrome/browser/autofill/autofill_tab_helper.h b/ios/chrome/browser/autofill/autofill_tab_helper.h index 6ec776d..70c52b9 100644 --- a/ios/chrome/browser/autofill/autofill_tab_helper.h +++ b/ios/chrome/browser/autofill/autofill_tab_helper.h
@@ -32,11 +32,6 @@ ~AutofillTabHelper() override; - // Create an AutofillTabHelper and attaches it to the given `web_state`. - static void CreateForWebState( - web::WebState* web_state, - password_manager::PasswordManager* password_manager); - // Sets a weak reference to the view controller used to present UI. void SetBaseViewController(UIViewController* base_view_controller);
diff --git a/ios/chrome/browser/autofill/autofill_tab_helper.mm b/ios/chrome/browser/autofill/autofill_tab_helper.mm index f05ff49..d6964ae 100644 --- a/ios/chrome/browser/autofill/autofill_tab_helper.mm +++ b/ios/chrome/browser/autofill/autofill_tab_helper.mm
@@ -19,18 +19,6 @@ AutofillTabHelper::~AutofillTabHelper() = default; -// static -void AutofillTabHelper::CreateForWebState( - web::WebState* web_state, - password_manager::PasswordManager* password_manager) { - DCHECK(web_state); - if (!FromWebState(web_state)) { - web_state->SetUserData( - UserDataKey(), - base::WrapUnique(new AutofillTabHelper(web_state, password_manager))); - } -} - void AutofillTabHelper::SetBaseViewController( UIViewController* base_view_controller) { autofill_client_->SetBaseViewController(base_view_controller);
diff --git a/ios/chrome/browser/autofill/form_structure_browsertest.mm b/ios/chrome/browser/autofill/form_structure_browsertest.mm index 36597bd..bd21869 100644 --- a/ios/chrome/browser/autofill/form_structure_browsertest.mm +++ b/ios/chrome/browser/autofill/form_structure_browsertest.mm
@@ -198,12 +198,8 @@ web_state_ = web::WebState::Create(params); feature_list_.InitWithFeatures( // Enabled - {// TODO(crbug.com/1098943): Remove once experiment is over. - features::kAutofillEnableSupportForMoreStructureInNames, - // TODO(crbug.com/1125978): Remove once launched. - features::kAutofillEnableSupportForMoreStructureInAddresses, - // TODO(crbug.com/1076175) Remove once launched. - features::kAutofillUseNewSectioningMethod, + {// TODO(crbug.com/1076175) Remove once launched. + autofill::features::kAutofillUseNewSectioningMethod, // TODO(crbug.com/1150890) Remove once launched features::kAutofillEnableAugmentedPhoneCountryCode, // TODO(crbug.com/1157405) Remove once launched.
diff --git a/ios/chrome/browser/autofill/form_suggestion_tab_helper.h b/ios/chrome/browser/autofill/form_suggestion_tab_helper.h index 8c5a02a..196cdafb 100644 --- a/ios/chrome/browser/autofill/form_suggestion_tab_helper.h +++ b/ios/chrome/browser/autofill/form_suggestion_tab_helper.h
@@ -24,10 +24,6 @@ ~FormSuggestionTabHelper() override; - // Creates a FormSuggestionTabHelper and attaches it to the given `web_state`. - static void CreateForWebState(web::WebState* web_state, - NSArray<id<FormSuggestionProvider>>* providers); - // Returns an object that can provide an input accessory view from the // FormSuggestionController. id<FormInputSuggestionsProvider> GetAccessoryViewProvider();
diff --git a/ios/chrome/browser/autofill/form_suggestion_tab_helper.mm b/ios/chrome/browser/autofill/form_suggestion_tab_helper.mm index ba1a0728..6736b6b 100644 --- a/ios/chrome/browser/autofill/form_suggestion_tab_helper.mm +++ b/ios/chrome/browser/autofill/form_suggestion_tab_helper.mm
@@ -14,18 +14,6 @@ FormSuggestionTabHelper::~FormSuggestionTabHelper() = default; -// static -void FormSuggestionTabHelper::CreateForWebState( - web::WebState* web_state, - NSArray<id<FormSuggestionProvider>>* providers) { - DCHECK(web_state); - if (!FromWebState(web_state)) { - web_state->SetUserData( - UserDataKey(), - base::WrapUnique(new FormSuggestionTabHelper(web_state, providers))); - } -} - id<FormInputSuggestionsProvider> FormSuggestionTabHelper::GetAccessoryViewProvider() { return controller_;
diff --git a/ios/chrome/browser/ntp/new_tab_page_tab_helper.h b/ios/chrome/browser/ntp/new_tab_page_tab_helper.h index 2e0402c..de886d2 100644 --- a/ios/chrome/browser/ntp/new_tab_page_tab_helper.h +++ b/ios/chrome/browser/ntp/new_tab_page_tab_helper.h
@@ -28,8 +28,6 @@ ~NewTabPageTabHelper() override; - static void CreateForWebState(web::WebState* web_state); - // Sets the NTP's NavigationItem title and virtualURL to the appropriate // string and chrome://newtab respectively. static void UpdateItem(web::NavigationItem* item);
diff --git a/ios/chrome/browser/ntp/new_tab_page_tab_helper.mm b/ios/chrome/browser/ntp/new_tab_page_tab_helper.mm index faacd32..2513cb0 100644 --- a/ios/chrome/browser/ntp/new_tab_page_tab_helper.mm +++ b/ios/chrome/browser/ntp/new_tab_page_tab_helper.mm
@@ -44,14 +44,6 @@ #pragma mark - Static -void NewTabPageTabHelper::CreateForWebState(web::WebState* web_state) { - DCHECK(web_state); - if (!FromWebState(web_state)) { - web_state->SetUserData( - UserDataKey(), base::WrapUnique(new NewTabPageTabHelper(web_state))); - } -} - void NewTabPageTabHelper::UpdateItem(web::NavigationItem* item) { if (item && item->GetURL() == GURL(kChromeUIAboutNewTabURL)) { item->SetVirtualURL(GURL(kChromeUINewTabURL));
diff --git a/ios/chrome/browser/promos_manager/promos_manager.mm b/ios/chrome/browser/promos_manager/promos_manager.mm index f1dee11..ff139c0 100644 --- a/ios/chrome/browser/promos_manager/promos_manager.mm +++ b/ios/chrome/browser/promos_manager/promos_manager.mm
@@ -364,10 +364,10 @@ std::vector<promos_manager::Promo> active_promos_sorted_by_least_recently_shown; - // If there are no active promos or impression history, return an empty array. - // (This is seldom expected to happen, if ever, as Promos Manager will launch - // with promos_manager::Promo::DefaultBrowser continuously running.) - if (active_promos.empty() || sorted_impressions.empty()) + // If there are no active promos, and no impression history, return an empty + // array. (This is seldom expected to happen, if ever, as Promos Manager will + // launch with promos_manager::Promo::DefaultBrowser continuously running.) + if (active_promos.empty() && sorted_impressions.empty()) return active_promos_sorted_by_least_recently_shown; for (promos_manager::Impression impression : sorted_impressions) {
diff --git a/ios/chrome/browser/promos_manager/promos_manager_unittest.mm b/ios/chrome/browser/promos_manager/promos_manager_unittest.mm index 9194bb2..58268254 100644 --- a/ios/chrome/browser/promos_manager/promos_manager_unittest.mm +++ b/ios/chrome/browser/promos_manager/promos_manager_unittest.mm
@@ -461,15 +461,10 @@ } // Tests PromosManager::LeastRecentlyShown() gracefully returns an empty array -// when no impression history exists (i.e. there's no 'least recently -// shown' promo because empty impression history means no promo has ever been -// shown.) +// when no impression history and no active promos exist. TEST_F(PromosManagerTest, ReturnsEmptyListWhenLeastRecentlyShownHasNoImpressionHistory) { - const std::set<promos_manager::Promo> active_promos = { - promos_manager::Promo::CredentialProviderExtension, - }; - + const std::set<promos_manager::Promo> active_promos; const std::vector<promos_manager::Impression> impressions; const std::vector<promos_manager::Promo> expected;
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.mm b/ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.mm index 56b6e2ab..e6b760d 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.mm +++ b/ios/chrome/browser/ui/autofill/form_input_accessory/branding_view_controller.mm
@@ -136,8 +136,8 @@ animations:^{ weakSelf.view.transform = CGAffineTransformIdentity; } - completion:^(BOOL finished) { - if (finished) { + completion:^(BOOL innerFinished) { + if (innerFinished) { [weakSelf.delegate brandingIconDidPerformPopAnimation]; } }];
diff --git a/net/base/net_error_list.h b/net/base/net_error_list.h index 772d699..20997e9 100644 --- a/net/base/net_error_list.h +++ b/net/base/net_error_list.h
@@ -112,7 +112,7 @@ // The request failed because the response was delivered along with requirements // which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor -// checks and 'Cross-Origin-Resource-Policy', for instance). +// checks and 'Cross-Origin-Resource-Policy' for instance). NET_ERROR(BLOCKED_BY_RESPONSE, -27) // Error -28 was removed (BLOCKED_BY_XSS_AUDITOR). @@ -127,6 +127,9 @@ // The request was blocked because of no H/2 or QUIC session. NET_ERROR(H2_OR_QUIC_REQUIRED, -31) +// The request was blocked by CORB or ORB. +NET_ERROR(BLOCKED_BY_ORB, -32) + // A connection was closed (corresponding to a TCP FIN). NET_ERROR(CONNECTION_CLOSED, -100)
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc index 3651e49..e27518d 100644 --- a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc +++ b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc
@@ -1177,7 +1177,8 @@ if (!statement.is_valid()) return false; sql::Transaction transaction(db); - transaction.Begin(); + if (!transaction.Begin()) + return false; for (const auto& cookie : cookies) { statement.Reset(true); statement.BindInt64( @@ -1652,7 +1653,8 @@ if (!statement.is_valid()) return false; sql::Transaction transaction(db); - transaction.Begin(); + if (!transaction.Begin()) + return false; for (const auto& cookie : cookies) { statement.Reset(true); statement.BindInt64( @@ -2026,7 +2028,8 @@ if (!statement.is_valid()) return false; sql::Transaction transaction(db); - transaction.Begin(); + if (!transaction.Begin()) + return false; for (const auto& cookie : cookies) { statement.Reset(true); statement.BindInt64( @@ -2073,7 +2076,8 @@ if (!statement.is_valid()) return false; sql::Transaction transaction(db); - transaction.Begin(); + if (!transaction.Begin()) + return false; for (const CanonicalCookie& cookie : cookies) { statement.Reset(true); statement.BindInt64( @@ -2121,7 +2125,8 @@ if (!statement.is_valid()) return false; sql::Transaction transaction(db); - transaction.Begin(); + if (!transaction.Begin()) + return false; for (const CanonicalCookie& cookie : cookies) { statement.Reset(true); statement.BindInt64( @@ -2171,7 +2176,8 @@ if (!statement.is_valid()) return false; sql::Transaction transaction(db); - transaction.Begin(); + if (!transaction.Begin()) + return false; for (const CanonicalCookie& cookie : cookies) { statement.Reset(true); statement.BindInt64(
diff --git a/remoting/host/desktop_resizer_x11.cc b/remoting/host/desktop_resizer_x11.cc index b0af034..6ae32da5 100644 --- a/remoting/host/desktop_resizer_x11.cc +++ b/remoting/host/desktop_resizer_x11.cc
@@ -142,6 +142,23 @@ if (has_randr_) connection_->DispatchAll(); + // RANDR does not allow fetching information on a particular monitor. So + // fetch all of them and try to find the requested monitor. + auto reply = randr_->GetMonitors({root_}).Sync(); + if (reply) { + for (const auto& monitor : reply->monitors) { + if (static_cast<webrtc::ScreenId>(monitor.name) != screen_id) { + continue; + } + return ScreenResolution( + webrtc::DesktopSize(monitor.width, monitor.height), + GetMonitorDpi(monitor)); + } + } + + LOG(ERROR) << "Cannot find current resolution for screen ID " << screen_id + << ". Resolution of the default screen will be returned."; + ScreenResolution result( webrtc::DesktopSize(connection_->default_screen().width_in_pixels, connection_->default_screen().height_in_pixels),
diff --git a/sandbox/win/BUILD.gn b/sandbox/win/BUILD.gn index f10d49e..28bf424 100644 --- a/sandbox/win/BUILD.gn +++ b/sandbox/win/BUILD.gn
@@ -180,6 +180,7 @@ "src/lpc_policy_test.cc", "src/named_pipe_policy_test.cc", "src/policy_target_test.cc", + "src/process_mitigations_deathtest.cc", "src/process_mitigations_dyncode_unittest.cc", "src/process_mitigations_extensionpoints_unittest.cc", "src/process_mitigations_unittest.cc",
diff --git a/sandbox/win/src/broker_services.cc b/sandbox/win/src/broker_services.cc index d123c3b..a1f9d78 100644 --- a/sandbox/win/src/broker_services.cc +++ b/sandbox/win/src/broker_services.cc
@@ -660,6 +660,16 @@ return SBOX_ALL_OK; } +void BrokerServicesBase::SetStartingMitigations( + sandbox::MitigationFlags starting_mitigations) { + sandbox::SetStartingMitigations(starting_mitigations); +} + +bool BrokerServicesBase::RatchetDownSecurityMitigations( + MitigationFlags additional_flags) { + return sandbox::RatchetDownSecurityMitigations(additional_flags); +} + // static void BrokerServicesBase::FreezeTargetConfigForTesting(TargetConfig* config) { CHECK(!config->IsConfigured());
diff --git a/sandbox/win/src/broker_services.h b/sandbox/win/src/broker_services.h index 7e96f59..43a4b43 100644 --- a/sandbox/win/src/broker_services.h +++ b/sandbox/win/src/broker_services.h
@@ -56,6 +56,9 @@ ResultCode WaitForAllTargets() override; ResultCode GetPolicyDiagnostics( std::unique_ptr<PolicyDiagnosticsReceiver> receiver) override; + void SetStartingMitigations(MitigationFlags starting_mitigations) override; + bool RatchetDownSecurityMitigations( + MitigationFlags additional_flags) override; static void FreezeTargetConfigForTesting(TargetConfig* config);
diff --git a/sandbox/win/src/process_mitigations.cc b/sandbox/win/src/process_mitigations.cc index d00f115..192a804 100644 --- a/sandbox/win/src/process_mitigations.cc +++ b/sandbox/win/src/process_mitigations.cc
@@ -11,12 +11,14 @@ #include <algorithm> #include <ostream> +#include "base/check.h" #include "base/check_op.h" #include "base/files/file_path.h" #include "base/notreached.h" #include "base/scoped_native_library.h" #include "base/win/windows_version.h" #include "build/build_config.h" +#include "sandbox/win/src/interception.h" #include "sandbox/win/src/nt_internals.h" #include "sandbox/win/src/restricted_token_utils.h" #include "sandbox/win/src/sandbox_rand.h" @@ -30,6 +32,8 @@ (0x00000002ui64 << 48) #endif +namespace sandbox { + namespace { // API defined in libloaderapi.h >= Win8. @@ -98,18 +102,34 @@ return false; } -} // namespace - -namespace sandbox { - -bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags) { - if (!CanSetProcessMitigationsPostStartup(flags)) +bool SetProcessMitigationPolicyInternal(PROCESS_MITIGATION_POLICY policy, + PVOID lpBuffer, + SIZE_T dwLength) { + HMODULE module = ::GetModuleHandleA("kernel32.dll"); + SetProcessMitigationPolicyFunction set_process_mitigation_policy_function = + reinterpret_cast<SetProcessMitigationPolicyFunction>( + ::GetProcAddress(module, "SetProcessMitigationPolicy")); + if (!set_process_mitigation_policy_function) return false; + PCHECK(set_process_mitigation_policy_function(policy, lpBuffer, dwLength)) + << "SetProcessMitigationPolicy failed with Policy: " << policy; + + return true; +} + +bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags starting_flags, + MitigationFlags flags, + MitigationFlags& applied_flags) { + // Check to make sure we have new flags to apply + MitigationFlags combined_flags = starting_flags | flags; + if (combined_flags == starting_flags) + return true; + base::win::Version version = base::win::GetVersion(); - HMODULE module = ::GetModuleHandleA("kernel32.dll"); if (flags & MITIGATION_DLL_SEARCH_ORDER) { + HMODULE module = ::GetModuleHandleA("kernel32.dll"); SetDefaultDllDirectoriesFunction set_default_dll_directories = reinterpret_cast<SetDefaultDllDirectoriesFunction>( ::GetProcAddress(module, "SetDefaultDllDirectories")); @@ -125,39 +145,44 @@ const DWORD directory_flags = LOAD_LIBRARY_SEARCH_SYSTEM32 | LOAD_LIBRARY_SEARCH_USER_DIRS; #endif - if (!set_default_dll_directories(directory_flags) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!set_default_dll_directories(directory_flags)) { return false; } + + applied_flags |= MITIGATION_DLL_SEARCH_ORDER; } } // Set the heap to terminate on corruption if (flags & MITIGATION_HEAP_TERMINATE) { if (!::HeapSetInformation(nullptr, HeapEnableTerminationOnCorruption, - nullptr, 0) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + nullptr, 0)) { return false; } + + applied_flags |= MITIGATION_HEAP_TERMINATE; } if (flags & MITIGATION_HARDEN_TOKEN_IL_POLICY) { DWORD error = HardenProcessIntegrityLevelPolicy(); - if ((error != ERROR_SUCCESS) && (error != ERROR_ACCESS_DENIED)) + if ((error != ERROR_SUCCESS)) return false; + applied_flags |= MITIGATION_HARDEN_TOKEN_IL_POLICY; } #if !defined(_WIN64) // DEP is always enabled on 64-bit. if (flags & MITIGATION_DEP) { DWORD dep_flags = PROCESS_DEP_ENABLE; - if (flags & MITIGATION_DEP_NO_ATL_THUNK) + if (combined_flags & MITIGATION_DEP_NO_ATL_THUNK) dep_flags |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION; - if (!::SetProcessDEPPolicy(dep_flags) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!::SetProcessDEPPolicy(dep_flags)) { return false; } + + applied_flags |= + combined_flags & (MITIGATION_DEP | MITIGATION_DEP_NO_ATL_THUNK); } #endif @@ -165,25 +190,30 @@ if (version < base::win::Version::WIN8) return true; - SetProcessMitigationPolicyFunction set_process_mitigation_policy = - reinterpret_cast<SetProcessMitigationPolicyFunction>( - ::GetProcAddress(module, "SetProcessMitigationPolicy")); - if (!set_process_mitigation_policy) - return false; - // Enable ASLR policies. if (flags & MITIGATION_RELOCATE_IMAGE) { PROCESS_MITIGATION_ASLR_POLICY policy = {}; policy.EnableForceRelocateImages = true; policy.DisallowStrippedImages = - (flags & MITIGATION_RELOCATE_IMAGE_REQUIRED) == + (combined_flags & MITIGATION_RELOCATE_IMAGE_REQUIRED) == MITIGATION_RELOCATE_IMAGE_REQUIRED; - if (!set_process_mitigation_policy(ProcessASLRPolicy, &policy, - sizeof(policy)) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + policy.EnableBottomUpRandomization = + (combined_flags & MITIGATION_BOTTOM_UP_ASLR) == + MITIGATION_BOTTOM_UP_ASLR; + policy.EnableHighEntropy = + (combined_flags & MITIGATION_HIGH_ENTROPY_ASLR) == + MITIGATION_HIGH_ENTROPY_ASLR; + + if (!SetProcessMitigationPolicyInternal(ProcessASLRPolicy, &policy, + sizeof(policy))) { return false; } + + applied_flags |= + combined_flags & + (MITIGATION_RELOCATE_IMAGE | MITIGATION_RELOCATE_IMAGE_REQUIRED | + MITIGATION_BOTTOM_UP_ASLR | MITIGATION_HIGH_ENTROPY_ASLR); } // Enable strict handle policies. @@ -192,11 +222,11 @@ policy.HandleExceptionsPermanentlyEnabled = policy.RaiseExceptionOnInvalidHandleReference = true; - if (!set_process_mitigation_policy(ProcessStrictHandleCheckPolicy, &policy, - sizeof(policy)) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!SetProcessMitigationPolicyInternal(ProcessStrictHandleCheckPolicy, + &policy, sizeof(policy))) { return false; } + applied_flags |= MITIGATION_STRICT_HANDLE_CHECKS; } // Enable system call policies. @@ -204,11 +234,11 @@ PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY policy = {}; policy.DisallowWin32kSystemCalls = true; - if (!set_process_mitigation_policy(ProcessSystemCallDisablePolicy, &policy, - sizeof(policy)) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!SetProcessMitigationPolicyInternal(ProcessSystemCallDisablePolicy, + &policy, sizeof(policy))) { return false; } + applied_flags |= MITIGATION_WIN32K_DISABLE; } // Enable extension point policies. @@ -216,11 +246,11 @@ PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY policy = {}; policy.DisableExtensionPoints = true; - if (!set_process_mitigation_policy(ProcessExtensionPointDisablePolicy, - &policy, sizeof(policy)) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!SetProcessMitigationPolicyInternal(ProcessExtensionPointDisablePolicy, + &policy, sizeof(policy))) { return false; } + applied_flags |= MITIGATION_EXTENSION_POINT_DISABLE; } if (version < base::win::Version::WIN8_1) @@ -235,11 +265,11 @@ PROCESS_MITIGATION_DYNAMIC_CODE_POLICY policy = {}; policy.ProhibitDynamicCode = true; - if (!set_process_mitigation_policy(ProcessDynamicCodePolicy, &policy, - sizeof(policy)) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!SetProcessMitigationPolicyInternal(ProcessDynamicCodePolicy, &policy, + sizeof(policy))) { return false; } + applied_flags |= MITIGATION_DYNAMIC_CODE_DISABLE; } if (version < base::win::Version::WIN10) @@ -250,11 +280,11 @@ PROCESS_MITIGATION_FONT_DISABLE_POLICY policy = {}; policy.DisableNonSystemFonts = true; - if (!set_process_mitigation_policy(ProcessFontDisablePolicy, &policy, - sizeof(policy)) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!SetProcessMitigationPolicyInternal(ProcessFontDisablePolicy, &policy, + sizeof(policy))) { return false; } + applied_flags |= MITIGATION_NONSYSTEM_FONT_DISABLE; } if (version < base::win::Version::WIN10_TH2) @@ -269,11 +299,11 @@ // 1) Only Windows Store signed. // 2) MS-signed, Win Store signed, and WHQL signed binaries. // Support not added at the moment. - if (!set_process_mitigation_policy(ProcessSignaturePolicy, &policy, - sizeof(policy)) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!SetProcessMitigationPolicyInternal(ProcessSignaturePolicy, &policy, + sizeof(policy))) { return false; } + applied_flags |= MITIGATION_FORCE_MS_SIGNED_BINS; } // Enable image load policies. @@ -281,21 +311,23 @@ flags & MITIGATION_IMAGE_LOAD_NO_LOW_LABEL || flags & MITIGATION_IMAGE_LOAD_PREFER_SYS32) { PROCESS_MITIGATION_IMAGE_LOAD_POLICY policy = {}; - if (flags & MITIGATION_IMAGE_LOAD_NO_REMOTE) + if (combined_flags & MITIGATION_IMAGE_LOAD_NO_REMOTE) policy.NoRemoteImages = true; - if (flags & MITIGATION_IMAGE_LOAD_NO_LOW_LABEL) + if (combined_flags & MITIGATION_IMAGE_LOAD_NO_LOW_LABEL) policy.NoLowMandatoryLabelImages = true; // PreferSystem32 is only supported on >= Anniversary. if (version >= base::win::Version::WIN10_RS1 && - flags & MITIGATION_IMAGE_LOAD_PREFER_SYS32) { + combined_flags & MITIGATION_IMAGE_LOAD_PREFER_SYS32) { policy.PreferSystem32Images = true; } - if (!set_process_mitigation_policy(ProcessImageLoadPolicy, &policy, - sizeof(policy)) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!SetProcessMitigationPolicyInternal(ProcessImageLoadPolicy, &policy, + sizeof(policy))) { return false; } + applied_flags |= (combined_flags & (MITIGATION_IMAGE_LOAD_NO_REMOTE | + MITIGATION_IMAGE_LOAD_NO_LOW_LABEL | + MITIGATION_IMAGE_LOAD_PREFER_SYS32)); } if (version < base::win::Version::WIN10_RS1) @@ -312,16 +344,47 @@ policy.ProhibitDynamicCode = true; policy.AllowThreadOptOut = true; - if (!set_process_mitigation_policy(ProcessDynamicCodePolicy, &policy, - sizeof(policy)) && - ERROR_ACCESS_DENIED != ::GetLastError()) { + if (!SetProcessMitigationPolicyInternal(ProcessDynamicCodePolicy, &policy, + sizeof(policy))) { return false; } + + applied_flags |= MITIGATION_DYNAMIC_CODE_DISABLE_WITH_OPT_OUT; } return true; } +} // namespace + +SANDBOX_INTERCEPT MitigationFlags g_current_mitigations = 0; +SANDBOX_INTERCEPT MitigationFlags g_shared_startup_mitigations; + +void SetStartingMitigations(MitigationFlags starting_flags) { + DCHECK_EQ(g_shared_startup_mitigations, uint64_t{0}); + DCHECK_EQ(g_current_mitigations, uint64_t{0}); + + g_current_mitigations = starting_flags; +} + +bool RatchetDownSecurityMitigations(MitigationFlags additional_flags) { + DCHECK_EQ(g_shared_startup_mitigations, uint64_t{0}); + if (!CanSetProcessMitigationsPostStartup(additional_flags)) + return false; + + return ApplyProcessMitigationsToCurrentProcess( + g_current_mitigations, additional_flags, g_current_mitigations); +} + +bool LockDownSecurityMitigations(MitigationFlags additional_flags) { + DCHECK_EQ(g_current_mitigations, uint64_t{0}); + if (!CanSetProcessMitigationsPostStartup(additional_flags)) + return false; + + return ApplyProcessMitigationsToCurrentProcess( + g_shared_startup_mitigations, additional_flags, g_current_mitigations); +} + bool ApplyMitigationsToCurrentThread(MitigationFlags flags) { if (!CanSetMitigationsPerThread(flags)) return false;
diff --git a/sandbox/win/src/process_mitigations.h b/sandbox/win/src/process_mitigations.h index cc38884..a6159f5 100644 --- a/sandbox/win/src/process_mitigations.h +++ b/sandbox/win/src/process_mitigations.h
@@ -13,9 +13,22 @@ namespace sandbox { -// Sets the mitigation policy for the current process, ignoring any settings -// that are invalid for the current version of Windows. -bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags); +// The sandbox supports 2 different security mitigation models, one for the +// browser process and one for child processes. These functions should only +// be called within the Sandbox code. + +// For the browser process, we have some mitigations set early in browser +// startup. In order to properly track those settings, SetStartingMitigations +// must be called before other mitigations are set. +// RatchetDownSecurityMitigations is then called by the browser process to +// gradually increase our security as startup continues. It's designed to +// be called multiple times. +void SetStartingMitigations(MitigationFlags starting_flags); +bool RatchetDownSecurityMitigations(MitigationFlags additional_flags); + +// For child processes, we call this method to apply the DelayedMitigations. +// This should only be called once. +bool LockDownSecurityMitigations(MitigationFlags additional_flags); // Sets the mitigation policy for the current thread, ignoring any settings // that are invalid for the current version of Windows.
diff --git a/sandbox/win/src/process_mitigations_deathtest.cc b/sandbox/win/src/process_mitigations_deathtest.cc new file mode 100644 index 0000000..1b08dfe --- /dev/null +++ b/sandbox/win/src/process_mitigations_deathtest.cc
@@ -0,0 +1,135 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sandbox/win/src/process_mitigations.h" + +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_number_conversions_win.h" +#include "base/strings/string_piece.h" +#include "base/strings/string_piece_forward.h" +#include "base/win/windows_version.h" +#include "sandbox/win/tests/common/controller.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace sandbox { + +namespace { +enum MethodCall { kRatchetDown = 1, kSetStart, kLockdown }; +} +//------------------------------------------------------------------------------ +// Exported functions called by child test processes. +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// Common test function for checking that a policy was enabled. +// - Use enum TestPolicy defined in integration_tests_common.h to specify which +// policy to check - passed as arg1. +//------------------------------------------------------------------------------ +SBOX_TESTS_COMMAND int CheckDeath(int argc, wchar_t** argv) { + if (argc < 2) + return SBOX_TEST_INVALID_PARAMETER; + + for (int i = 0; i < argc; i++) { + int test; + if (!base::StringToInt(argv[i], &test)) { + return SBOX_TEST_INVALID_PARAMETER; + } + + MethodCall call = static_cast<MethodCall>(test); + switch (call) { + case kRatchetDown: { + RatchetDownSecurityMitigations(sandbox::MITIGATION_RELOCATE_IMAGE); + break; + } + case kSetStart: { + SetStartingMitigations(sandbox::MITIGATION_RELOCATE_IMAGE); + break; + } + case kLockdown: { + LockDownSecurityMitigations(sandbox::MITIGATION_RELOCATE_IMAGE); + break; + } + } + } + + // We should crash before we get here + return SBOX_TEST_FAILED; +} + +TEST(ProcessMitigationsDeathTest, CheckRatchetDownOrderMatters) { + if (base::win::GetVersion() < base::win::Version::WIN8) + GTEST_SKIP() << "Skipping test due to unsupported Windows version"; + + std::wstring test_command = L"CheckDeath "; + test_command += base::NumberToWString(kRatchetDown); + test_command += L" "; + test_command += base::NumberToWString(kSetStart); + + TestRunner runner; + // We should hit a DCHECK in the child which will cause the process to crash + EXPECT_EQ(STATUS_BREAKPOINT, + static_cast<ULONG>(runner.RunTest(test_command.c_str()))); +} + +TEST(ProcessMitigationsDeathTest, CheckRatchetDownAndLockdownExclusive) { + if (base::win::GetVersion() < base::win::Version::WIN8) + GTEST_SKIP() << "Skipping test due to unsupported Windows version"; + + std::wstring test_command = L"CheckDeath "; + test_command += base::NumberToWString(kRatchetDown); + test_command += L" "; + test_command += base::NumberToWString(kLockdown); + + TestRunner runner; + // We should hit a DCHECK in the child which will cause the process to crash + EXPECT_EQ(STATUS_BREAKPOINT, + static_cast<ULONG>(runner.RunTest(test_command.c_str()))); +} + +TEST(ProcessMitigationsDeathTest, CheckRatchetDownAndLockdownExclusive2) { + if (base::win::GetVersion() < base::win::Version::WIN8) + GTEST_SKIP() << "Skipping test due to unsupported Windows version"; + + std::wstring test_command = L"CheckDeath "; + test_command += base::NumberToWString(kLockdown); + test_command += L" "; + test_command += base::NumberToWString(kRatchetDown); + + TestRunner runner; + // We should hit a DCHECK in the child which will cause the process to crash + EXPECT_EQ(STATUS_BREAKPOINT, + static_cast<ULONG>(runner.RunTest(test_command.c_str()))); +} + +TEST(ProcessMitigationsDeathTest, CheckSetStartAndLockdownExclusive) { + if (base::win::GetVersion() < base::win::Version::WIN8) + GTEST_SKIP() << "Skipping test due to unsupported Windows version"; + + std::wstring test_command = L"CheckDeath "; + test_command += base::NumberToWString(kLockdown); + test_command += L" "; + test_command += base::NumberToWString(kSetStart); + + TestRunner runner; + // We should hit a DCHECK in the child which will cause the process to crash + EXPECT_EQ(STATUS_BREAKPOINT, + static_cast<ULONG>(runner.RunTest(test_command.c_str()))); +} + +TEST(ProcessMitigationsDeathTest, CheckSetStartAndLockdownExclusive2) { + if (base::win::GetVersion() < base::win::Version::WIN8) + GTEST_SKIP() << "Skipping test due to unsupported Windows version"; + + std::wstring test_command = L"CheckDeath "; + test_command += base::NumberToWString(kSetStart); + test_command += L" "; + test_command += base::NumberToWString(kLockdown); + + TestRunner runner; + // We should hit a DCHECK in the child which will cause the process to crash + EXPECT_EQ(STATUS_BREAKPOINT, + static_cast<ULONG>(runner.RunTest(test_command.c_str()))); +} + +} // namespace sandbox \ No newline at end of file
diff --git a/sandbox/win/src/process_mitigations_unittest.cc b/sandbox/win/src/process_mitigations_unittest.cc index 9570df3..18a949e 100644 --- a/sandbox/win/src/process_mitigations_unittest.cc +++ b/sandbox/win/src/process_mitigations_unittest.cc
@@ -4,6 +4,7 @@ #include "sandbox/win/src/process_mitigations.h" +#include <excpt.h> #include <ktmw32.h> #include <windows.h> @@ -12,6 +13,7 @@ #include "base/path_service.h" #include "base/process/kill.h" #include "base/scoped_native_library.h" +#include "base/strings/string_number_conversions_win.h" #include "base/test/test_timeouts.h" #include "base/win/scoped_handle.h" #include "base/win/windows_version.h" @@ -459,6 +461,23 @@ break; } + case (TESTPOLICY_PREANDPOSTSTARTUP): { + // Both policies should be set now. + PROCESS_MITIGATION_IMAGE_LOAD_POLICY policy = {}; + if (!get_process_mitigation_policy(::GetCurrentProcess(), + ProcessImageLoadPolicy, &policy, + sizeof(policy))) { + return SBOX_TEST_NOT_FOUND; + } + if (!policy.NoLowMandatoryLabelImages) + return SBOX_TEST_FAILED; + + if (!policy.PreferSystem32Images) + return SBOX_TEST_FAILED; + + break; + } + default: return SBOX_TEST_INVALID_PARAMETER; } @@ -1384,4 +1403,84 @@ EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner2.RunTest(test_command.c_str())); } +// This test validates setting a pre-startup mitigation and a post startup +// mitigation on the same windows policy works in release and crashes in debug. +TEST(ProcessMitigationsTest, SetPreAndPostStartupSamePolicy_ImageLoad) { + if (base::win::GetVersion() < base::win::Version::WIN10_RS1) + return; + + std::wstring test_command = L"CheckPolicy "; + test_command += base::NumberToWString(TESTPOLICY_PREANDPOSTSTARTUP); + + TestRunner runner; + sandbox::TargetConfig* config = runner.GetPolicy()->GetConfig(); + + //--------------------------------- + // 1) Test setting pre-startup. + EXPECT_EQ(config->SetProcessMitigations(MITIGATION_IMAGE_LOAD_NO_LOW_LABEL), + SBOX_ALL_OK); + + //--------------------------------- + // 2) Test setting post-startup. + //--------------------------------- + EXPECT_EQ( + config->SetDelayedProcessMitigations(MITIGATION_IMAGE_LOAD_PREFER_SYS32), + SBOX_ALL_OK); + + EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str())); +} + +// This test validates setting a pre-startup mitigation and a post startup +// mitigation on the same windows policy works in release and crashes in debug. +TEST(ProcessMitigationsTest, SetPreAndPostStartupSamePolicy_ProcessDep) { + if (base::win::GetVersion() < base::win::Version::WIN8) + return; + + std::wstring test_command = L"CheckPolicy "; + test_command += base::NumberToWString(TESTPOLICY_DEP); + + TestRunner runner; + sandbox::TargetConfig* config = runner.GetPolicy()->GetConfig(); + + //--------------------------------- + // 1) Test setting pre-startup. + EXPECT_EQ(config->SetProcessMitigations(MITIGATION_DEP), SBOX_ALL_OK); + + //--------------------------------- + // 2) Test setting post-startup. + //--------------------------------- + EXPECT_EQ(config->SetDelayedProcessMitigations(MITIGATION_DEP_NO_ATL_THUNK), + SBOX_ALL_OK); + + EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str())); +} + +// This test validates setting a pre-startup mitigation and a post startup +// mitigation on the same windows policy works in release and crashes in debug. +TEST(ProcessMitigationsTest, SetPreAndPostStartupSamePolicy_ASLR) { + if (base::win::GetVersion() < base::win::Version::WIN8) + return; + + std::wstring test_command = L"CheckPolicy "; + test_command += base::NumberToWString(TESTPOLICY_ASLR); + + TestRunner runner; + sandbox::TargetConfig* config = runner.GetPolicy()->GetConfig(); + + //--------------------------------- + // 1) Test setting pre-startup. + EXPECT_EQ(config->SetProcessMitigations(MITIGATION_BOTTOM_UP_ASLR | + MITIGATION_HIGH_ENTROPY_ASLR), + SBOX_ALL_OK); + + //--------------------------------- + // 2) Test setting post-startup. + //--------------------------------- + EXPECT_EQ(config->SetDelayedProcessMitigations( + MITIGATION_RELOCATE_IMAGE | MITIGATION_RELOCATE_IMAGE_REQUIRED), + SBOX_ALL_OK); + + EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str())); +} + } // namespace sandbox
diff --git a/sandbox/win/src/sandbox.h b/sandbox/win/src/sandbox.h index 140c8c4..6be81f8 100644 --- a/sandbox/win/src/sandbox.h +++ b/sandbox/win/src/sandbox.h
@@ -135,6 +135,19 @@ virtual ResultCode GetPolicyDiagnostics( std::unique_ptr<PolicyDiagnosticsReceiver> receiver) = 0; + // For the broker, we have some mitigations set early in startup. In + // order to properly track those settings, SetStartingMitigations should be + // called before other mitigations are set by RatchetDownSecurityMitigations + virtual void SetStartingMitigations(MitigationFlags starting_mitigations) = 0; + + // RatchetDownSecurityMitigations is then called by the broker process to + // gradually increase our security as startup continues. It's designed to + // be called multiple times. If you don't call SetStartingMitigations first + // and there were mitigations applied early in startup, the new mitigations + // may not be applied. + virtual bool RatchetDownSecurityMitigations( + MitigationFlags additional_flags) = 0; + protected: ~BrokerServices() {} };
diff --git a/sandbox/win/src/sandbox_policy_base.cc b/sandbox/win/src/sandbox_policy_base.cc index a90b07e..f554b20 100644 --- a/sandbox/win/src/sandbox_policy_base.cc +++ b/sandbox/win/src/sandbox_policy_base.cc
@@ -158,8 +158,10 @@ } // namespace -SANDBOX_INTERCEPT IntegrityLevel g_shared_delayed_integrity_level; -SANDBOX_INTERCEPT MitigationFlags g_shared_delayed_mitigations; +SANDBOX_INTERCEPT IntegrityLevel g_shared_delayed_integrity_level = + INTEGRITY_LEVEL_LAST; +SANDBOX_INTERCEPT MitigationFlags g_shared_delayed_mitigations = 0; +SANDBOX_INTERCEPT MitigationFlags g_shared_startup_mitigations = 0; ConfigBase::ConfigBase() noexcept : @@ -765,6 +767,14 @@ if (SBOX_ALL_OK != ret) return ret; + g_shared_startup_mitigations = config()->GetProcessMitigations(); + ret = target->TransferVariable("g_shared_startup_mitigations", + &g_shared_startup_mitigations, + sizeof(g_shared_startup_mitigations)); + g_shared_startup_mitigations = 0; + if (SBOX_ALL_OK != ret) + return ret; + target_ = std::move(target); return SBOX_ALL_OK; }
diff --git a/sandbox/win/src/target_services.cc b/sandbox/win/src/target_services.cc index 9650d351..2a45f9ad 100644 --- a/sandbox/win/src/target_services.cc +++ b/sandbox/win/src/target_services.cc
@@ -120,9 +120,8 @@ } // namespace -SANDBOX_INTERCEPT IntegrityLevel g_shared_delayed_integrity_level = - INTEGRITY_LEVEL_LAST; -SANDBOX_INTERCEPT MitigationFlags g_shared_delayed_mitigations = 0; +SANDBOX_INTERCEPT IntegrityLevel g_shared_delayed_integrity_level; +SANDBOX_INTERCEPT MitigationFlags g_shared_delayed_mitigations; TargetServicesBase::TargetServicesBase() {} @@ -153,8 +152,9 @@ process_state_.SetCsrssConnected(is_csrss_connected); // Enabling mitigations must happen last otherwise handle closing breaks if (g_shared_delayed_mitigations && - !ApplyProcessMitigationsToCurrentProcess(g_shared_delayed_mitigations)) + !LockDownSecurityMitigations(g_shared_delayed_mitigations)) { ::TerminateProcess(::GetCurrentProcess(), SBOX_FATAL_MITIGATION); + } } ProcessState* TargetServicesBase::GetState() {
diff --git a/sandbox/win/tests/integration_tests/integration_tests_common.h b/sandbox/win/tests/integration_tests/integration_tests_common.h index 5f4c433..805e34a8 100644 --- a/sandbox/win/tests/integration_tests/integration_tests_common.h +++ b/sandbox/win/tests/integration_tests/integration_tests_common.h
@@ -33,6 +33,7 @@ TESTPOLICY_CETDYNAMICAPIS, TESTPOLICY_CETSTRICT, TESTPOLICY_KTMCOMPONENTFILTER, + TESTPOLICY_PREANDPOSTSTARTUP, }; // Timeout for ::WaitForSingleObject synchronization.
diff --git a/services/network/public/cpp/corb/corb_api.cc b/services/network/public/cpp/corb/corb_api.cc index 289e990..bde4d63 100644 --- a/services/network/public/cpp/corb/corb_api.cc +++ b/services/network/public/cpp/corb/corb_api.cc
@@ -120,10 +120,11 @@ } bool ShouldReportBlockedResponse() const override { - if (is_orb_enabled_) - return orb_analyzer_->ShouldReportBlockedResponse(); - else - return corb_analyzer_->ShouldReportBlockedResponse(); + return GetEnabledAnalyzer().ShouldReportBlockedResponse(); + } + + BlockedResponseHandling ShouldHandleBlockedResponseAs() const override { + return GetEnabledAnalyzer().ShouldHandleBlockedResponseAs(); } private: @@ -137,6 +138,13 @@ return is_orb_enabled_ ? orb_decision_ : corb_decision_; } + const ResponseAnalyzer& GetEnabledAnalyzer() const { + if (is_orb_enabled_) + return *orb_analyzer_; + else + return *corb_analyzer_; + } + const std::unique_ptr<CrossOriginReadBlocking::CorbResponseAnalyzer> corb_analyzer_; const std::unique_ptr<OpaqueResponseBlockingAnalyzer> orb_analyzer_;
diff --git a/services/network/public/cpp/corb/corb_api.h b/services/network/public/cpp/corb/corb_api.h index ada1a99..4f440cc 100644 --- a/services/network/public/cpp/corb/corb_api.h +++ b/services/network/public/cpp/corb/corb_api.h
@@ -49,6 +49,13 @@ kSniffMore, }; + // Decision for how to signal a blocking decision to the network stack and + // the application. + enum class BlockedResponseHandling { + kEmptyResponse, + kNetworkError, + }; + // The Init method should be called exactly once after getting the // ResponseAnalyzer from the Create method. The Init method attempts to // calculate the `Decision` based on the HTTP response headers. If @@ -81,6 +88,9 @@ // warning message written to the DevTools console. virtual bool ShouldReportBlockedResponse() const = 0; + // How should a blocked response be treated? + virtual BlockedResponseHandling ShouldHandleBlockedResponseAs() const = 0; + virtual ~ResponseAnalyzer(); };
diff --git a/services/network/public/cpp/corb/corb_impl.cc b/services/network/public/cpp/corb/corb_impl.cc index 4b5d83c3..f387baf 100644 --- a/services/network/public/cpp/corb/corb_impl.cc +++ b/services/network/public/cpp/corb/corb_impl.cc
@@ -1029,6 +1029,13 @@ return true; } +ResponseAnalyzer::BlockedResponseHandling +CrossOriginReadBlocking::CorbResponseAnalyzer::ShouldHandleBlockedResponseAs() + const { + // CORB wants blocked responses to be empty responses. + return ResponseAnalyzer::BlockedResponseHandling::kEmptyResponse; +} + Decision CrossOriginReadBlocking::CorbResponseAnalyzer::GetCorbDecision() { if (ShouldBlock()) return Decision::kBlock;
diff --git a/services/network/public/cpp/corb/corb_impl.h b/services/network/public/cpp/corb/corb_impl.h index cb9d8dd..d925980 100644 --- a/services/network/public/cpp/corb/corb_impl.h +++ b/services/network/public/cpp/corb/corb_impl.h
@@ -118,6 +118,7 @@ Decision Sniff(base::StringPiece data) override; Decision HandleEndOfSniffableResponseBody() override; bool ShouldReportBlockedResponse() const override; + BlockedResponseHandling ShouldHandleBlockedResponseAs() const override; class ConfirmationSniffer; class SimpleConfirmationSniffer;
diff --git a/services/network/public/cpp/corb/orb_impl.cc b/services/network/public/cpp/corb/orb_impl.cc index 59a754d..17b32b23 100644 --- a/services/network/public/cpp/corb/orb_impl.cc +++ b/services/network/public/cpp/corb/orb_impl.cc
@@ -14,6 +14,7 @@ #include "net/http/http_util.h" #include "net/url_request/url_request.h" #include "services/network/public/cpp/corb/corb_impl.h" +#include "services/network/public/cpp/features.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/url_response_head.mojom.h" @@ -437,6 +438,16 @@ return !is_empty_response_ && is_http_status_okay_; } +ResponseAnalyzer::BlockedResponseHandling +OpaqueResponseBlockingAnalyzer::ShouldHandleBlockedResponseAs() const { + // "ORB v0.1" uses CORB-style error handling with injecting an empty response. + // Later versions use ORB-specified error handling, by injecting a network + // error. + return base::FeatureList::IsEnabled(features::kOpaqueResponseBlockingV02) + ? BlockedResponseHandling::kNetworkError + : BlockedResponseHandling::kEmptyResponse; +} + void OpaqueResponseBlockingAnalyzer::ReportOrbBlockedAndCorbDidnt() const { // We encountered a scenario where ORB may block more than CORB and therefore // let's log some extra data that may help us understand the kind of
diff --git a/services/network/public/cpp/corb/orb_impl.h b/services/network/public/cpp/corb/orb_impl.h index 5cbe7acd..a406851 100644 --- a/services/network/public/cpp/corb/orb_impl.h +++ b/services/network/public/cpp/corb/orb_impl.h
@@ -40,6 +40,7 @@ Decision Sniff(base::StringPiece data) override; Decision HandleEndOfSniffableResponseBody() override; bool ShouldReportBlockedResponse() const override; + BlockedResponseHandling ShouldHandleBlockedResponseAs() const override; // TODO(https://crbug.com/1178928): Remove this once we gather enough // DumpWithoutCrashing data.
diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc index c5a9c0c..67726d2 100644 --- a/services/network/public/cpp/features.cc +++ b/services/network/public/cpp/features.cc
@@ -124,6 +124,13 @@ const base::Feature kOpaqueResponseBlockingV01{ "OpaqueResponseBlockingV01", base::FEATURE_DISABLED_BY_DEFAULT}; +// Enables ORB blocked responses being treated as errors (according to the spec) +// rather than the current, CORB-style handling of injecting an empty response. +// This is ORB v0.2. +// This should only be enabled when ORB v0.1 is, too. +const base::Feature kOpaqueResponseBlockingV02{ + "OpaqueResponseBlockingV02", base::FEATURE_DISABLED_BY_DEFAULT}; + // Enables preprocessing requests with the Trust Tokens API Fetch flags set, // and handling their responses, according to the protocol. // (See https://github.com/WICG/trust-token-api.)
diff --git a/services/network/public/cpp/features.h b/services/network/public/cpp/features.h index 864f6f2..9d172c6 100644 --- a/services/network/public/cpp/features.h +++ b/services/network/public/cpp/features.h
@@ -43,6 +43,8 @@ extern const base::Feature kMdnsResponderGeneratedNameListing; COMPONENT_EXPORT(NETWORK_CPP) extern const base::Feature kOpaqueResponseBlockingV01; +COMPONENT_EXPORT(NETWORK_CPP) +extern const base::Feature kOpaqueResponseBlockingV02; COMPONENT_EXPORT(NETWORK_CPP) extern const base::Feature kTrustTokens;
diff --git a/services/network/tcp_client_socket_brokered.cc b/services/network/tcp_client_socket_brokered.cc index 84268a9..20bd765b 100644 --- a/services/network/tcp_client_socket_brokered.cc +++ b/services/network/tcp_client_socket_brokered.cc
@@ -58,8 +58,12 @@ void TCPClientSocketBrokered::SetBeforeConnectCallback( const BeforeConnectCallback& before_connect_callback) { - // TODO(liza): Implement this. - NOTREACHED(); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(!before_connect_callback_); + DCHECK(!IsConnected()); + DCHECK(!is_connect_in_progress_); + + before_connect_callback_ = before_connect_callback; } int TCPClientSocketBrokered::Connect(net::CompletionOnceCallback callback) { @@ -128,6 +132,16 @@ brokered_socket_ = std::make_unique<net::TCPClientSocket>( std::move(tcp_socket), addresses_, network_quality_estimator_); brokered_socket_->ApplySocketTag(tag_); + + if (before_connect_callback_) { + int callback_result = before_connect_callback_.Run(); + DCHECK_NE(net::ERR_IO_PENDING, callback_result); + if (callback_result != net::OK) { + std::move(callback).Run(callback_result); + return; + } + } + brokered_socket_->Connect(base::BindOnce( &TCPClientSocketBrokered::DidCompleteConnect, brokered_weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
diff --git a/services/network/tcp_client_socket_brokered.h b/services/network/tcp_client_socket_brokered.h index c68c16c..ac0d607 100644 --- a/services/network/tcp_client_socket_brokered.h +++ b/services/network/tcp_client_socket_brokered.h
@@ -15,6 +15,7 @@ #include "net/base/completion_once_callback.h" #include "net/nqe/network_quality_estimator.h" #include "net/socket/socket_tag.h" +#include "net/socket/stream_socket.h" #include "net/socket/tcp_socket.h" #include "net/socket/transport_client_socket.h" @@ -126,6 +127,8 @@ // State to track whether socket is currently attempting to connect. bool is_connect_in_progress_ GUARDED_BY_CONTEXT(sequence_checker_) = false; + BeforeConnectCallback before_connect_callback_; + // Need to store the tag in case ApplySocketTag() is called before Connect(). net::SocketTag tag_ GUARDED_BY_CONTEXT(sequence_checker_);
diff --git a/services/network/tcp_client_socket_brokered_unittest.cc b/services/network/tcp_client_socket_brokered_unittest.cc index 6f3de65..36abd84 100644 --- a/services/network/tcp_client_socket_brokered_unittest.cc +++ b/services/network/tcp_client_socket_brokered_unittest.cc
@@ -397,6 +397,28 @@ EXPECT_GT(rv, 0); } +// Tests that setting a socket option in the BeforeConnectCallback works. With +// real sockets, socket options often have to be set before the connect() call, +// and the BeforeConnectCallback is the only way to do that, with a +// TCPClientSocket. +TEST_F(TCPClientSocketBrokeredTest, BeforeConnectCallback) { + net::TestCompletionCallback callback; + + EXPECT_FALSE(socket_->IsConnected()); + EXPECT_FALSE(socket_->IsConnectedAndIdle()); + + bool callback_was_called = false; + socket_->SetBeforeConnectCallback(base::BindLambdaForTesting([&] { + EXPECT_FALSE(socket_->IsConnected()); + callback_was_called = true; + return int{net::OK}; + })); + + ConnectClientSocket(&callback); + + EXPECT_TRUE(callback_was_called); +} + // Duplicated from tcp_client_socket_unittest.cc since tests in //net can't // depend on anything outside of //net. //
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc index 58fb0a3..ea3404a 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc
@@ -1679,31 +1679,14 @@ // Read Blocking / CORB). if (factory_params_.is_corb_enabled) { corb_analyzer_ = corb::ResponseAnalyzer::Create(per_factory_corb_state_); + is_more_corb_sniffing_needed_ = true; auto decision = corb_analyzer_->Init(url_request_->url(), url_request_->initiator(), request_mode_, *response_); - switch (decision) { - case network::corb::ResponseAnalyzer::Decision::kBlock: { - bool should_report_corb_blocking = - corb_analyzer_->ShouldReportBlockedResponse(); - corb_analyzer_.reset(); - is_more_corb_sniffing_needed_ = false; - if (BlockResponseForCorb(should_report_corb_blocking) == - kWillCancelRequest) - return; - break; - } - - case network::corb::ResponseAnalyzer::Decision::kAllow: - corb_analyzer_.reset(); - is_more_corb_sniffing_needed_ = false; - break; - - case network::corb::ResponseAnalyzer::Decision::kSniffMore: - is_more_corb_sniffing_needed_ = true; - break; - } + if (MaybeBlockResponseForCorb(decision)) + return; } + if ((options_ & mojom::kURLLoadOptionSniffMimeType)) { if (ShouldSniffContent(url_request_->url(), *response_)) { // We're going to look at the data before deciding what the content type @@ -1847,24 +1830,8 @@ corb_decision); } - switch (corb_decision) { - case network::corb::ResponseAnalyzer::Decision::kBlock: { - bool should_report_corb_blocking = - corb_analyzer_->ShouldReportBlockedResponse(); - corb_analyzer_.reset(); - is_more_corb_sniffing_needed_ = false; - if (BlockResponseForCorb(should_report_corb_blocking) == - kWillCancelRequest) - return; - break; - } - case network::corb::ResponseAnalyzer::Decision::kAllow: - corb_analyzer_.reset(); - is_more_corb_sniffing_needed_ = false; - break; - case network::corb::ResponseAnalyzer::Decision::kSniffMore: - break; - } + if (MaybeBlockResponseForCorb(corb_decision)) + return; } } @@ -2428,11 +2395,14 @@ memory_cache_writer_.reset(); } -URLLoader::BlockResponseForCorbResult URLLoader::BlockResponseForCorb( - bool should_report_corb_blocking) { +URLLoader::BlockResponseForCorbResult URLLoader::BlockResponseForCorb() { // CORB should only do work after the response headers have been received. DCHECK(has_received_response_); + // Caller should have set up a CorbAnalyzer for BlockResponseForCorb to be + // able to do its job. + DCHECK(corb_analyzer_); + // The response headers and body shouldn't yet be sent to the URLLoaderClient. DCHECK(response_); DCHECK(consumer_handle_.is_valid()); @@ -2440,34 +2410,54 @@ // Send stripped headers to the real URLLoaderClient. corb::SanitizeBlockedResponseHeaders(*response_); - // Send empty body to the real URLLoaderClient. - mojo::ScopedDataPipeProducerHandle producer_handle; - mojo::ScopedDataPipeConsumerHandle consumer_handle; - MojoResult result = mojo::CreateDataPipe(kBlockedBodyAllocationSize, - producer_handle, consumer_handle); - if (result != MOJO_RESULT_OK) { - NotifyCompleted(net::ERR_INSUFFICIENT_RESOURCES); - return kWillCancelRequest; - } - producer_handle.reset(); + // Determine error code. This essentially handles the "ORB v0.1" and "ORB + // v0.2" difference. + int blocked_error_code = + (corb_analyzer_->ShouldHandleBlockedResponseAs() == + corb::ResponseAnalyzer::BlockedResponseHandling::kEmptyResponse) + ? net::OK + : net::ERR_BLOCKED_BY_ORB; - url_loader_client_.Get()->OnReceiveResponse( - response_->Clone(), std::move(consumer_handle), absl::nullopt); - - // Tell the real URLLoaderClient that the response has been completed. - if (corb_detachable_) { - // TODO(lukasza): https://crbug.com/827633#c5: Consider passing net::ERR_OK - // instead. net::ERR_ABORTED was chosen for consistency with the old CORB - // implementation that used to go through DetachableResourceHandler. - CompleteBlockedResponse(net::ERR_ABORTED, should_report_corb_blocking); - } else { - // CORB responses are reported as a success. - CompleteBlockedResponse(net::OK, should_report_corb_blocking); + // todo(lukasza/vogelheim): https://crbug.com/827633#c5: + // This preserves compatibility with current implementations, which use + // net::ERR_ABORTED when the resource is detachable. We will not carry this + // forward past "ORB v0.1", so that this check will go away once + // OpaqueResponseBlockingV02 is perma-enabled. + if (corb_detachable_ && blocked_error_code == net::OK) { + CHECK(!base::FeatureList::IsEnabled(features::kOpaqueResponseBlockingV02)); + blocked_error_code = net::ERR_ABORTED; } + // Send empty body to the real URLLoaderClient. This preserves "ORB v0.1" + // behaviour and will also go away once OpaqueResponseBlockingV02 is + // perma-enabled. + if (blocked_error_code == net::OK || blocked_error_code == net::ERR_ABORTED) { + mojo::ScopedDataPipeProducerHandle producer_handle; + mojo::ScopedDataPipeConsumerHandle consumer_handle; + MojoResult result = mojo::CreateDataPipe(kBlockedBodyAllocationSize, + producer_handle, consumer_handle); + if (result != MOJO_RESULT_OK) { + NotifyCompleted(net::ERR_INSUFFICIENT_RESOURCES); + return kWillCancelRequest; + } + producer_handle.reset(); + + // Tell the real URLLoaderClient that the response has been completed. + url_loader_client_.Get()->OnReceiveResponse( + response_->Clone(), std::move(consumer_handle), absl::nullopt); + } + + CompleteBlockedResponse(blocked_error_code, + corb_analyzer_->ShouldReportBlockedResponse()); + // If the factory is asking to complete requests of this type, then we need to // continue processing the response to make sure the network cache is // populated. Otherwise we can cancel the request. + // + // TODO(lukasza/vogelheim): The `corb_detachable_` logic is meant to ensure a + // response is cached (in some cases). With HTTP cache partitioning, this is + // likely much less effective than it used to be. Maybe this mechanism should + // be retired. if (corb_detachable_) { // Discard any remaining callbacks or data by rerouting the pipes to // EmptyURLLoaderClient. @@ -2497,6 +2487,29 @@ return kWillCancelRequest; } +bool URLLoader::MaybeBlockResponseForCorb( + corb::ResponseAnalyzer::Decision corb_decision) { + DCHECK(corb_analyzer_); + DCHECK(is_more_corb_sniffing_needed_); + bool will_cancel = false; + switch (corb_decision) { + case network::corb::ResponseAnalyzer::Decision::kBlock: { + will_cancel = BlockResponseForCorb() == kWillCancelRequest; + corb_analyzer_.reset(); + is_more_corb_sniffing_needed_ = false; + break; + } + case network::corb::ResponseAnalyzer::Decision::kAllow: + corb_analyzer_.reset(); + is_more_corb_sniffing_needed_ = false; + break; + case network::corb::ResponseAnalyzer::Decision::kSniffMore: + break; + } + DCHECK_EQ(is_more_corb_sniffing_needed_, !!corb_analyzer_); + return will_cancel; +} + void URLLoader::ReportFlaggedResponseCookies() { if (cookie_observer_) { std::vector<mojom::CookieOrLineWithAccessResultPtr> reported_cookies;
diff --git a/services/network/url_loader.h b/services/network/url_loader.h index 0aa6aa95..798e7a7 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h
@@ -419,8 +419,11 @@ // processing the request (e.g. by calling ReadMore as necessary). kContinueRequest, }; - BlockResponseForCorbResult BlockResponseForCorb( - bool should_report_corb_blocking); + // Block the response because of CORB (or ORB). + BlockResponseForCorbResult BlockResponseForCorb(); + // Decide whether to call block a response via BlockResponseForCorb. + // Returns true if the request should be cancelled. + bool MaybeBlockResponseForCorb(corb::ResponseAnalyzer::Decision); void ReportFlaggedResponseCookies(); void StartReading();
diff --git a/sql/transaction.h b/sql/transaction.h index 0a5abb0..540baaf 100644 --- a/sql/transaction.h +++ b/sql/transaction.h
@@ -46,14 +46,14 @@ // carried out in the transaction. // // In most cases (no nested transactions), this method issues a BEGIN - // statemnent, which invokes SQLite's deferred transaction startup documented + // statement, which invokes SQLite's deferred transaction startup documented // in https://www.sqlite.org/lang_transaction.html. This means the database // lock is not acquired by the time Begin() completes. Instead, the first // statement after Begin() will attempt to acquire a read or write lock. // // This method is not idempotent. Calling Begin() twice on a Transaction will // cause a DCHECK crash. - bool Begin(); + [[nodiscard]] bool Begin(); // Explicitly rolls back the transaction. All changes will be forgotten. // @@ -69,9 +69,9 @@ // Commits the transaction. All changes will be persisted in the database. // - // Returns false in case of failure. The most failure case is a SQLite failure - // in committing the transaction. If sql::Database's support for nested - // transactions is in use, this method will also fail if any nested + // Returns false in case of failure. The most common failure case is a SQLite + // failure in committing the transaction. If sql::Database's support for + // nested transactions is in use, this method will also fail if any nested // transaction has been rolled back. // // This method is not idempotent. Calling Commit() twice on a Transaction will
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index db43177..5ab34108 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -1005,6 +1005,37 @@ }, { "args": [ + "--gtest_also_run_disabled_tests" + ], + "isolate_profile_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "device_os": null, + "device_type": null, + "machine_type": "n1-standard-4|e2-standard-4", + "os": "Ubuntu-18.04", + "pool": "chromium.tests.avd" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "chrome_junit_tests", + "test_id_prefix": "ninja://chrome/android:chrome_junit_tests/", + "use_isolated_scripts_api": true + }, + { + "args": [ "--gs-results-bucket=chromium-result-details", "--recover-devices", "--avd-config=../../tools/android/avd/proto/generic_android23.textpb", @@ -6786,17 +6817,6 @@ }, { "isolate_profile_data": true, - "name": "chrome_junit_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": {}, - "test": "chrome_junit_tests", - "test_id_prefix": "ninja://chrome/android:chrome_junit_tests/" - }, - { - "isolate_profile_data": true, "name": "components_junit_tests", "resultdb": { "enable": true,
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index a750105..68696b1 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -1438,12 +1438,6 @@ "test_id_prefix": "ninja://chrome/test/android:chrome_java_test_pagecontroller_junit_tests/" }, { - "name": "chrome_junit_tests", - "swarming": {}, - "test": "chrome_junit_tests", - "test_id_prefix": "ninja://chrome/android:chrome_junit_tests/" - }, - { "name": "components_junit_tests", "swarming": {}, "test": "components_junit_tests", @@ -24760,16 +24754,6 @@ "test_id_prefix": "ninja://chrome/test/android:chrome_java_test_pagecontroller_junit_tests/" }, { - "name": "chrome_junit_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": {}, - "test": "chrome_junit_tests", - "test_id_prefix": "ninja://chrome/android:chrome_junit_tests/" - }, - { "name": "components_junit_tests", "resultdb": { "enable": true, @@ -31711,6 +31695,34 @@ "isolated_scripts": [ { "args": [ + "--shards=8" + ], + "isolate_name": "chrome_junit_tests", + "isolate_profile_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "chrome_junit_tests", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://chrome/android:chrome_junit_tests/", + "use_isolated_scripts_api": true + }, + { + "args": [ "--gtest-benchmark-name=components_perftests" ], "isolate_name": "components_perftests", @@ -31850,20 +31862,6 @@ "test_id_prefix": "ninja://chrome/test/android:chrome_java_test_pagecontroller_junit_tests/" }, { - "args": [ - "--shards=8" - ], - "isolate_profile_data": true, - "name": "chrome_junit_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": {}, - "test": "chrome_junit_tests", - "test_id_prefix": "ninja://chrome/android:chrome_junit_tests/" - }, - { "isolate_profile_data": true, "name": "components_junit_tests", "resultdb": { @@ -32452,6 +32450,34 @@ "test_id_prefix": "ninja://chrome/test/android:chrome_java_test_wpr_tests/" }, { + "isolate_profile_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "device_os": null, + "device_type": null, + "machine_type": "n1-standard-4|e2-standard-4", + "os": "Ubuntu-18.04", + "pool": "chromium.tests.avd" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "chrome_junit_tests", + "test_id_prefix": "ninja://chrome/android:chrome_junit_tests/", + "use_isolated_scripts_api": true + }, + { "args": [ "--gs-results-bucket=chromium-result-details", "--recover-devices",
diff --git a/testing/buildbot/chromium.clang.json b/testing/buildbot/chromium.clang.json index 62f15e6..804f0fd36 100644 --- a/testing/buildbot/chromium.clang.json +++ b/testing/buildbot/chromium.clang.json
@@ -7799,16 +7799,6 @@ "test_id_prefix": "ninja://chrome/test/android:chrome_java_test_pagecontroller_junit_tests/" }, { - "name": "chrome_junit_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": {}, - "test": "chrome_junit_tests", - "test_id_prefix": "ninja://chrome/android:chrome_junit_tests/" - }, - { "name": "components_junit_tests", "resultdb": { "enable": true,
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index b1fb0d6..6d10b951 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -16768,9 +16768,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -16812,9 +16813,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -16857,9 +16859,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -16901,9 +16904,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -16939,9 +16943,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -16974,9 +16979,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17018,9 +17024,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17062,9 +17069,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17106,9 +17114,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17151,9 +17160,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17196,9 +17206,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17240,9 +17251,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17285,9 +17297,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17329,9 +17342,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17373,9 +17387,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17417,9 +17432,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17461,9 +17477,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17511,9 +17528,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17558,9 +17576,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17609,9 +17628,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17654,9 +17674,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17698,9 +17719,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17742,9 +17764,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17787,9 +17810,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17832,9 +17856,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17877,9 +17902,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17922,9 +17948,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -17966,9 +17993,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18010,9 +18038,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18054,9 +18083,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18098,9 +18128,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18142,9 +18173,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18186,9 +18218,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18230,9 +18263,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18276,9 +18310,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18320,9 +18355,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18364,9 +18400,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18408,9 +18445,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18452,9 +18490,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18496,9 +18535,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18540,9 +18580,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18584,9 +18625,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18628,9 +18670,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18672,9 +18715,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18716,9 +18760,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18760,9 +18805,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18804,9 +18850,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18848,9 +18895,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18893,9 +18941,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18937,9 +18986,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -18981,9 +19031,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19025,9 +19076,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19069,9 +19121,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19113,9 +19166,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19157,9 +19211,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19201,9 +19256,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19245,9 +19301,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19289,9 +19346,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19334,9 +19392,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19378,9 +19437,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19422,9 +19482,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19466,9 +19527,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19510,9 +19572,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19554,9 +19617,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19598,9 +19662,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19642,9 +19707,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19686,9 +19752,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19730,9 +19797,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19781,9 +19849,10 @@ ], "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19826,9 +19895,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19871,9 +19941,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19915,9 +19986,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -19959,9 +20031,10 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "device_os": "MMB29Q", + "device_os": "PQ3A.190801.002", + "device_os_flavor": "google", "device_os_type": "userdebug", - "device_type": "bullhead", + "device_type": "walleye", "os": "Android" } ], @@ -20028,17 +20101,6 @@ }, { "isolate_profile_data": true, - "name": "chrome_junit_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "swarming": {}, - "test": "chrome_junit_tests", - "test_id_prefix": "ninja://chrome/android:chrome_junit_tests/" - }, - { - "isolate_profile_data": true, "name": "components_junit_tests", "resultdb": { "enable": true, @@ -22962,6 +23024,166 @@ } ] }, + "android-perfetto-rel": { + "additional_compile_targets": [ + "chrome" + ], + "gtest_tests": [ + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices", + "--avd-config=../../tools/android/avd/proto/generic_android28.textpb" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", + "base_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ], + "named_caches": [ + { + "name": "generic_android28", + "path": ".android_emulator/generic_android28" + } + ], + "optional_dimensions": { + "60": [ + { + "caches": "generic_android28" + } + ] + }, + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "base_unittests", + "test_id_prefix": "ninja://base:base_unittests/" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices", + "--avd-config=../../tools/android/avd/proto/generic_android28.textpb" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", + "perfetto_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ], + "named_caches": [ + { + "name": "generic_android28", + "path": ".android_emulator/generic_android28" + } + ], + "optional_dimensions": { + "60": [ + { + "caches": "generic_android28" + } + ] + }, + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "perfetto_unittests", + "test_id_prefix": "ninja://third_party/perfetto:perfetto_unittests/" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices", + "--avd-config=../../tools/android/avd/proto/generic_android28.textpb" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", + "services_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-18.04" + } + ], + "named_caches": [ + { + "name": "generic_android28", + "path": ".android_emulator/generic_android28" + } + ], + "optional_dimensions": { + "60": [ + { + "caches": "generic_android28" + } + ] + }, + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "services_unittests", + "test_id_prefix": "ninja://services:services_unittests/" + } + ] + }, "chromeos-amd64-generic-rel (goma cache silo)": { "additional_compile_targets": [ "chromiumos_preflight" @@ -120176,6 +120398,67 @@ } ] }, + "mac-perfetto-rel": { + "additional_compile_targets": [ + "chrome" + ], + "gtest_tests": [ + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-10.15" + } + ], + "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": [ + { + "cpu": "x86-64", + "os": "Mac-10.15" + } + ], + "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": [ + { + "cpu": "x86-64", + "os": "Mac-10.15" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "services_unittests", + "test_id_prefix": "ninja://services:services_unittests/" + } + ] + }, "mac-upload-perfetto": { "additional_compile_targets": [ "trace_processor_shell" @@ -122695,6 +122978,64 @@ } ] }, + "win-perfetto-rel": { + "additional_compile_targets": [ + "chrome" + ], + "gtest_tests": [ + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10-19042" + } + ], + "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": "Windows-10-19042" + } + ], + "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": "Windows-10-19042" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "services_unittests", + "test_id_prefix": "ninja://services:services_unittests/" + } + ] + }, "win-upload-perfetto": { "additional_compile_targets": [ "trace_processor_shell"
diff --git a/testing/buildbot/generate_buildbot_json.py b/testing/buildbot/generate_buildbot_json.py index 3a5fb5a..bbdae68 100755 --- a/testing/buildbot/generate_buildbot_json.py +++ b/testing/buildbot/generate_buildbot_json.py
@@ -961,21 +961,6 @@ args = result.get('args', []) test_to_run = result.pop('telemetry_test_name', test_name) - # TODO(skbug.com/12149): Remove this once Gold-based tests no longer clobber - # earlier results on retry attempts. - is_gold_based_test = False - for a in args: - if '--git-revision' in a: - is_gold_based_test = True - break - if is_gold_based_test: - for a in args: - if '--test-filter' in a or '--isolated-script-test-filter' in a: - raise RuntimeError( - '--test-filter/--isolated-script-test-filter are currently not ' - 'supported for Gold-based GPU tests. See skbug.com/12100 and ' - 'skbug.com/12149 for more details.') - # These tests upload and download results from cloud storage and therefore # aren't idempotent yet. https://crbug.com/549140. result['swarming']['idempotent'] = False
diff --git a/testing/buildbot/generate_buildbot_json_unittest.py b/testing/buildbot/generate_buildbot_json_unittest.py index 7c27dd4..ead8473 100755 --- a/testing/buildbot/generate_buildbot_json_unittest.py +++ b/testing/buildbot/generate_buildbot_json_unittest.py
@@ -2870,20 +2870,6 @@ fbb.check_output_file_consistency(verbose=True) self.assertFalse(fbb.printed_lines) - def test_gpu_telemetry_tests_pixel_with_filter(self): - fbb = FakeBBGen(self.args, - FOO_GPU_TELEMETRY_TEST_WATERFALL, - COMPOSITION_SUITE_WITH_PIXEL_AND_FILTER, - LUCI_MILO_CFG, - exceptions=NO_BAR_TEST_EXCEPTIONS, - gn_isolate_map=GPU_TELEMETRY_GN_ISOLATE_MAP) - self.create_testing_buildbot_json_file('chromium.test.json', - GPU_TELEMETRY_TEST_OUTPUT) - self.create_testing_buildbot_json_file('chromium.ci.json', - GPU_TELEMETRY_TEST_OUTPUT) - with self.assertRaises(RuntimeError): - fbb.check_output_file_consistency(verbose=True) - def test_gpu_telemetry_tests_android(self): fbb = FakeBBGen(self.args, FOO_GPU_TELEMETRY_TEST_WATERFALL_ANDROID,
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index 725dca0..e759d19 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -447,7 +447,7 @@ }, "chrome_junit_tests": { "label": "//chrome/android:chrome_junit_tests", - "type": "junit_test", + "type": "generated_script", }, "chrome_modern_public_bundle_smoke_test": { "label": "//chrome/android:chrome_modern_public_bundle_smoke_test",
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index ae5a3cf..525db7f3 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -1024,11 +1024,6 @@ 'nougat-x86-emulator', ], }, - 'chrome_junit_tests': { - 'remove_mixins': [ - 'nougat-x86-emulator', - ], - }, 'components_junit_tests': { 'remove_mixins': [ 'nougat-x86-emulator', @@ -1123,6 +1118,24 @@ }, }, + 'chromium_junit_tests_scripts': { + 'chrome_junit_tests': { + 'mixins': [ + 'x86-64', + 'linux-bionic', + ], + 'remove_mixins': [ + 'bullhead', + 'marshmallow', + 'marshmallow-x86-emulator', + 'nougat-x86-emulator', + 'pie_fleet', + 'walleye', + ], + 'use_isolated_scripts_api': True, + }, + }, + 'chromium_linux_scripts': { 'check_network_annotations': { 'script': 'check_network_annotations.py', @@ -5349,25 +5362,6 @@ 'android_trichrome_smoke_tests', ], - # This is the same as 'android_marshmallow_gtests' - # with the addition of 'webview_cts_tests_gtest' and - # 'webview_ui_instrumentation_tests' - 'android_marshmallow_coverage_gtests': [ - 'android_modern_smoke_tests', - 'android_smoke_tests', - 'android_specific_chromium_gtests', # Already includes gl_gtests. - 'chromium_gtests', - 'chromium_gtests_for_devices_with_graphical_output', - 'chrome_public_tests', - 'linux_flavor_specific_chromium_gtests', - 'vr_android_specific_chromium_tests', - 'vr_platform_specific_chromium_gtests', - 'weblayer_android_gtests', - 'weblayer_gtests', - 'webview_cts_tests_gtest', - 'webview_ui_instrumentation_tests', - ], - # List gtests that run on android-marshmallow-arm64-rel builder. # TODO(crbug.com/1127110): Use android_marshmallow_gtests when # android-marshmallow-x86-rel is not mirrored to CQ. @@ -5401,6 +5395,8 @@ 'android_wpr_record_replay_tests', #'chromium_gtests', 'chromium_gtests_for_devices_with_graphical_output', + 'chromium_junit_tests_scripts', + # TODO(crbug.com/1255748): Remove components_capacity_tests when # chromium_gtests are enabled in this suite. 'components_capacity_tests', @@ -5467,6 +5463,26 @@ 'android_smoke_tests', ], + # This is the same as 'chromium_android_gtests' + # with the addition of 'android_modern_smoke_tests', + # 'webview_cts_tests_gtest', 'webview_ui_instrumentation_tests', + # 'weblayer_android_gtests', and 'weblayer_gtests'. + 'android_pie_coverage_gtests': [ + 'android_modern_smoke_tests', + 'android_smoke_tests', + 'android_specific_chromium_gtests', # Already includes gl_gtests. + 'chromium_gtests', + 'chromium_gtests_for_devices_with_graphical_output', + 'chrome_public_tests', + 'linux_flavor_specific_chromium_gtests', + 'vr_android_specific_chromium_tests', + 'vr_platform_specific_chromium_gtests', + 'weblayer_android_gtests', + 'weblayer_gtests', + 'webview_cts_tests_gtest', + 'webview_ui_instrumentation_tests', + ], + 'android_pie_gtests': [ 'android_ar_gtests', 'android_ddready_vr_gtests', @@ -6216,6 +6232,7 @@ 'marshmallow_pie_isolated_scripts': [ 'android_isolated_scripts', + 'chromium_junit_tests_scripts', 'components_perftests_isolated_scripts', 'telemetry_android_minidump_unittests_isolated_scripts', 'telemetry_perf_unittests_isolated_scripts_android',
diff --git a/testing/buildbot/tryserver.blink.json b/testing/buildbot/tryserver.blink.json index f38cde7..1e9d69e 100644 --- a/testing/buildbot/tryserver.blink.json +++ b/testing/buildbot/tryserver.blink.json
@@ -1,83 +1,6 @@ { "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, "AAAAA2 See generate_buildbot_json.py to make changes": {}, - "linux-blink-optional-highdpi-rel": { - "isolated_scripts": [ - { - "args": [ - "--flag-specific=highdpi", - "--num-retries=3", - "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", - "--git-revision=${got_revision}" - ], - "check_flakiness_for_new_tests": false, - "isolate_name": "blink_web_tests", - "merge": { - "args": [ - "--verbose" - ], - "script": "//third_party/blink/tools/merge_web_test_results.py" - }, - "name": "high_dpi_blink_web_tests", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true - }, - "results_handler": "layout tests", - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "os": "Ubuntu-18.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://:blink_web_tests/" - }, - { - "args": [ - "--flag-specific=highdpi", - "--num-retries=3", - "--write-run-histories-to=${ISOLATED_OUTDIR}/run_histories.json", - "--git-revision=${got_revision}" - ], - "check_flakiness_for_new_tests": false, - "isolate_name": "blink_wpt_tests", - "merge": { - "args": [ - "--verbose" - ], - "script": "//third_party/blink/tools/merge_web_test_results.py" - }, - "name": "high_dpi_blink_wpt_tests", - "precommit_args": [ - "--gerrit-issue=${patch_issue}", - "--gerrit-patchset=${patch_set}", - "--buildbucket-id=${buildbucket_build_id}" - ], - "resultdb": { - "enable": true - }, - "results_handler": "layout tests", - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "os": "Ubuntu-18.04" - } - ], - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 3 - }, - "test_id_prefix": "ninja://:blink_wpt_tests/" - } - ] - }, "linux-blink-rel": { "isolated_scripts": [ {
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 1196c06..f604151 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -3174,12 +3174,12 @@ 'android-code-coverage': { 'mixins': [ 'has_native_resultdb_integration', - 'bullhead', 'isolate_profile_data', - 'marshmallow', + 'pie_fleet', + 'walleye', ], 'test_suites': { - 'gtest_tests': 'android_marshmallow_coverage_gtests', + 'gtest_tests': 'android_pie_coverage_gtests', 'junit_tests': 'chromium_junit_tests', }, 'os_type': 'android', @@ -3210,6 +3210,20 @@ 'gtest_tests': 'fieldtrial_android_tests', }, }, + + 'android-perfetto-rel': { + 'additional_compile_targets': [ 'chrome' ], + 'mixins': [ + 'pie-x86-emulator', + 'linux-bionic', + 'x86-64', + ], + 'os_type': 'android', + 'test_suites': { + 'gtest_tests': 'perfetto_gtests', + }, + }, + 'chromeos-amd64-generic-rel (goma cache silo)': { 'additional_compile_targets': [ 'chromiumos_preflight', @@ -3958,6 +3972,15 @@ 'isolated_scripts': 'chromium_mac_rel_isolated_scripts', }, }, + 'mac-perfetto-rel': { + 'additional_compile_targets': [ 'chrome' ], + 'mixins': [ + 'mac_10.15', + ], + 'test_suites': { + 'gtest_tests': 'perfetto_gtests', + }, + }, 'mac-upload-perfetto': { 'additional_compile_targets': [ 'trace_processor_shell' ], 'test_suites': { @@ -4004,6 +4027,15 @@ 'isolated_scripts': 'fieldtrial_isolated_scripts', }, }, + 'win-perfetto-rel': { + 'additional_compile_targets': [ 'chrome' ], + 'mixins': [ + 'win10', + ], + 'test_suites': { + 'gtest_tests': 'perfetto_gtests', + }, + }, 'win-upload-perfetto': { 'additional_compile_targets': [ 'trace_processor_shell' ], 'test_suites': { @@ -6866,14 +6898,6 @@ 'mixins': ['chromium-tester-service-account'], 'machines': { # Should be kept in sync with v8_linux_blink_rel in tryserver.v8 - 'linux-blink-optional-highdpi-rel': { - 'mixins': [ - 'linux-bionic', - ], - 'test_suites': { - 'isolated_scripts': 'chromium_web_tests_high_dpi_isolated_scripts', - }, - }, 'linux-blink-rel': { 'mixins': [ 'linux-bionic',
diff --git a/testing/scripts/gpu_integration_test_adapter.py b/testing/scripts/gpu_integration_test_adapter.py index d605b3f..d3af5b8 100644 --- a/testing/scripts/gpu_integration_test_adapter.py +++ b/testing/scripts/gpu_integration_test_adapter.py
@@ -22,10 +22,7 @@ def generate_test_filter_args(self, test_filter_str): # isolated_script_test_filter comes in like: # WebglExtension_WEBGL_depth_texture::conformance/textures/misc/copytexsubimage2d-subrects.html # pylint: disable=line-too-long - # TODO(skbug.com/12149): Remove --has-test-filter once Gold-based tests no - # longer clobber earlier results on retry attempts. - return ['--test-filter=%s' % test_filter_str, - '--has-test-filter'] + return ['--test-filter=%s' % test_filter_str] def generate_sharding_args(self, total_shards, shard_index): return ['--total-shards=%d' % total_shards,
diff --git a/testing/scripts/test_traffic_annotation_auditor.py b/testing/scripts/test_traffic_annotation_auditor.py index e7413c9..9e3aa64 100755 --- a/testing/scripts/test_traffic_annotation_auditor.py +++ b/testing/scripts/test_traffic_annotation_auditor.py
@@ -99,7 +99,7 @@ json.dump(sheet_config, config_file, indent=4) config_filename = config_file.name config_file.close() - vpython_path = 'vpython.bat' if is_windows() else 'vpython' + vpython_path = 'vpython3.bat' if is_windows() else 'vpython3' command_line = [ vpython_path,
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 5938d5b..02a7c28 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -1302,6 +1302,28 @@ ] } ], + "AutofillParseAsync": [ + { + "platforms": [ + "android", + "android_webview", + "chromeos", + "chromeos_lacros", + "ios", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "AutofillParseAsync" + ] + } + ] + } + ], "AutofillParseMerchantPromoCodeFields": [ { "platforms": [ @@ -7882,24 +7904,6 @@ ] } ], - "PlatformHEVCDecoderSupport": [ - { - "platforms": [ - "android", - "chromeos", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "PlatformHEVCDecoderSupport" - ] - } - ] - } - ], "PrecompileInlineScripts": [ { "platforms": [ @@ -8214,7 +8218,6 @@ "InterestGroupStorage", "NoncedPartitionedCookies", "PrivacySandboxAdsAPIs", - "PrivacySandboxSettings3", "SharedStorageAPI" ] }
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index 296d594..fd778ca 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -1432,5 +1432,8 @@ const base::Feature kNoCentralWebCacheLimitControl{ "NoCentralWebCacheLimitControl", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kRunTextInputUpdatePostLifecycle{ + "RunTextInputUpdatePostLifecycle", base::FEATURE_ENABLED_BY_DEFAULT}; + } // namespace features } // namespace blink
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h index a4d2279..c64a17bf 100644 --- a/third_party/blink/public/common/features.h +++ b/third_party/blink/public/common/features.h
@@ -843,6 +843,10 @@ // TODO(crbug.com/1340565): Remove once the data is available. BLINK_COMMON_EXPORT extern const base::Feature kNoCentralWebCacheLimitControl; +// If enabled, IME updates are computed at the end of a lifecycle update rather +// than the beginning. +BLINK_COMMON_EXPORT extern const base::Feature kRunTextInputUpdatePostLifecycle; + } // namespace features } // namespace blink
diff --git a/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h b/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h index 0ff54cbb..f226a062 100644 --- a/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h +++ b/third_party/blink/public/web/modules/mediastream/media_stream_video_source.h
@@ -221,6 +221,8 @@ return tracks_.size(); } + using WebPlatformMediaStreamSource::GetTaskRunner; + virtual base::WeakPtr<MediaStreamVideoSource> GetWeakPtr() const = 0; protected:
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc index cd25a6c..56007ab 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
@@ -54,6 +54,8 @@ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/resources/grit/blink_image_resources.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_canvas_high_dynamic_range_options.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_canvas_smpte_st_2086_metadata.h" #include "third_party/blink/renderer/bindings/core/v8/v8_image_bitmap_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_image_encode_options.h" #include "third_party/blink/renderer/core/css/css_font_selector.h" @@ -440,8 +442,37 @@ void HTMLCanvasElement::configureHighDynamicRange( const CanvasHighDynamicRangeOptions* options, ExceptionState& exception_state) { - // TODO(https://crbug.com/1274220): Implement this. - NOTIMPLEMENTED(); + absl::optional<gfx::HDRMetadata> hdr_metadata; + if (options->hasSmpteSt2086Metadata()) { + hdr_metadata = gfx::HDRMetadata(); + auto& color_volume_metadata = hdr_metadata->color_volume_metadata; + const auto* v8_metadata = options->smpteSt2086Metadata(); + color_volume_metadata.primary_r.set_x(v8_metadata->redPrimaryX()); + color_volume_metadata.primary_r.set_y(v8_metadata->redPrimaryY()); + color_volume_metadata.primary_g.set_x(v8_metadata->greenPrimaryX()); + color_volume_metadata.primary_g.set_y(v8_metadata->greenPrimaryY()); + color_volume_metadata.primary_b.set_x(v8_metadata->bluePrimaryX()); + color_volume_metadata.primary_b.set_y(v8_metadata->bluePrimaryY()); + color_volume_metadata.white_point.set_x(v8_metadata->whitePointX()); + color_volume_metadata.white_point.set_y(v8_metadata->whitePointY()); + color_volume_metadata.luminance_min = v8_metadata->minimumLuminance(); + color_volume_metadata.luminance_max = v8_metadata->maximumLuminance(); + } + + if (IsOffscreenCanvasRegistered()) { + // TODO(https://crbug.com/1274220): Implement HDR support for offscreen + // canvas. + NOTIMPLEMENTED(); + } + + CanvasResourceHost::SetHDRMetadata(hdr_metadata); + if (context_ && (IsWebGL() || IsWebGPU())) { + // TODO(https://crbug.com/1274220): Implement HDR support for WebGL and + // WebGPU. + NOTIMPLEMENTED(); + } else if (canvas2d_bridge_) { + canvas2d_bridge_->SetHDRMetadata(hdr_metadata); + } } ScriptPromise HTMLCanvasElement::convertToBlob( @@ -832,10 +863,10 @@ Image* broken_canvas = broken_canvas_and_image_scale_factor.first; context.Save(); context.FillRect( - gfx::RectF(r), Color(), + gfx::RectF(r), Color::kWhite, PaintAutoDarkMode(ComputedStyleRef(), DarkModeFilter::ElementRole::kBackground), - SkBlendMode::kClear); + SkBlendMode::kSrc); // Place the icon near the upper left, like the missing image icon // for image elements. Offset it a bit from the upper corner. gfx::SizeF icon_size(broken_canvas->Size());
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index 5e13eab3..8784bff 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc
@@ -117,6 +117,7 @@ #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/vector.h" +#include "ui/accessibility/accessibility_features.h" #include "ui/display/screen_info.h" #ifndef LOG_MEDIA_EVENTS @@ -2792,11 +2793,22 @@ void HTMLMediaElement::pause() { DVLOG(2) << "pause(" << *this << ")"; + // When updating pause, be sure to update PauseToLetDescriptionFinish(). autoplay_policy_->StopAutoplayMutedWhenVisible(); PauseInternal(PlayPromiseError::kPaused_PauseCalled); } -void HTMLMediaElement::PauseInternal(PlayPromiseError code) { +void HTMLMediaElement::PauseToLetDescriptionFinish() { + DVLOG(2) << "pauseExceptSpeech(" << *this << ")"; + + autoplay_policy_->StopAutoplayMutedWhenVisible(); + + // Passing in pause_speech as false to pause everything except the speech. + PauseInternal(PlayPromiseError::kPaused_PauseCalled, false); +} + +void HTMLMediaElement::PauseInternal(PlayPromiseError code, + bool pause_speech /* = true */) { DVLOG(3) << "pauseInternal(" << *this << ")"; if (network_state_ == kNetworkEmpty) @@ -2818,7 +2830,7 @@ ScheduleRejectPlayPromises(code); } - UpdatePlayState(); + UpdatePlayState(pause_speech); } bool HTMLMediaElement::preservesPitch() const { @@ -3808,7 +3820,7 @@ return false; } -void HTMLMediaElement::UpdatePlayState() { +void HTMLMediaElement::UpdatePlayState(bool pause_speech /* = true */) { bool is_playing = GetWebMediaPlayer() && !GetWebMediaPlayer()->Paused(); bool should_be_playing = PotentiallyPlaying(); @@ -3827,6 +3839,8 @@ GetWebMediaPlayer()->SetRate(playbackRate()); GetWebMediaPlayer()->SetVolume(EffectiveMediaVolume()); GetWebMediaPlayer()->Play(); + if (::features::IsTextBasedAudioDescriptionEnabled()) + SpeechSynthesis()->Resume(); // These steps should not be necessary, but if `play()` is called before // a source change, we may get into a state where `paused_ == false` and @@ -3842,6 +3856,9 @@ } else { // Should not be playing right now if (is_playing) { GetWebMediaPlayer()->Pause(); + + if (pause_speech && ::features::IsTextBasedAudioDescriptionEnabled()) + SpeechSynthesis()->Pause(); } playback_progress_timer_.Stop();
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.h b/third_party/blink/renderer/core/html/media/html_media_element.h index 0f80c77..14c3766 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.h +++ b/third_party/blink/renderer/core/html/media/html_media_element.h
@@ -241,6 +241,10 @@ void SetLoop(bool); ScriptPromise playForBindings(ScriptState*); absl::optional<DOMExceptionCode> Play(); + + // Called when the video should pause to let audio descriptions finish. + void PauseToLetDescriptionFinish(); + void pause(); double latencyHint() const; void setLatencyHint(double); @@ -646,9 +650,12 @@ void PlayInternal(); // This does not stop autoplay visibility observation. - void PauseInternal(PlayPromiseError code); + // By default, will pause the video and speech. + void PauseInternal(PlayPromiseError code, bool pause_speech = true); - void UpdatePlayState(); + // By default, will pause the video and speech. + void UpdatePlayState(bool pause_speech = true); + bool PotentiallyPlaying() const; bool StoppedDueToErrors() const; bool CouldPlayIfEnoughData() const override;
diff --git a/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc b/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc index e190a9f1..2ea3c9dd 100644 --- a/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc +++ b/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc
@@ -750,14 +750,22 @@ void VTTCue::OnEnter(HTMLMediaElement& video) { if (!track()->IsSpokenKind()) return; + + // Clear the queue of utterances before speaking a current cue. + video.SpeechSynthesis()->Cancel(); + video.SpeechSynthesis()->Speak(text_, track()->Language()); } void VTTCue::OnExit(HTMLMediaElement& video) { if (!track()->IsSpokenKind()) return; + + // If SpeechSynthesis is speaking audio descriptions at the end time + // specified (when onExit runs), call PauseToLetDescriptionFinish so that only + // the video is paused and the audio descriptions can finish. if (video.SpeechSynthesis()->Speaking()) - video.pause(); + video.PauseToLetDescriptionFinish(); } void VTTCue::UpdateDisplay(HTMLDivElement& container) {
diff --git a/third_party/blink/renderer/core/paint/cull_rect_updater.cc b/third_party/blink/renderer/core/paint/cull_rect_updater.cc index 9fd5257..94af786 100644 --- a/third_party/blink/renderer/core/paint/cull_rect_updater.cc +++ b/third_party/blink/renderer/core/paint/cull_rect_updater.cc
@@ -148,8 +148,13 @@ DCHECK(scrollable_area); gfx::Vector2dF delta = -scroll_translation->Translation2D() - scrollable_area->LastCullRectUpdateScrollOffset(); - return object.FirstFragment().GetContentsCullRect().HasScrolledEnough( - delta, *scroll_translation); + if (!delta.IsZero()) { + // See CullRectUpdater::ShouldSkipChangedEnough(). + if (scrollable_area->Layer()->SelfOrDescendantNeedsRepaint()) + return true; + return object.FirstFragment().GetContentsCullRect().HasScrolledEnough( + delta, *scroll_translation); + } } } return false; @@ -221,15 +226,11 @@ if (object.IsFixedPositioned()) context.current = context.fixed; - bool should_proactively_update = ShouldProactivelyUpdate(context, layer); bool force_update_self = context.current.force_update_children; - context.current.force_update_children = - should_proactively_update || layer.ForcesChildrenCullRectUpdate(); + context.current.force_update_children = layer.ForcesChildrenCullRectUpdate(); - if (force_update_self || should_proactively_update || - layer.NeedsCullRectUpdate()) { + if (force_update_self || layer.NeedsCullRectUpdate()) context.current.force_update_children |= UpdateForSelf(context, layer); - } if (!context.current.subtree_is_out_of_cull_rect && object.ShouldClipOverflowAlongBothAxis() && @@ -398,12 +399,12 @@ absl::optional<CullRect> old_cull_rect; // Not using |old_cull_rect| will force the cull rect to be updated // (skipping |ChangedEnough|) in |ApplyPaintProperties|. - if (!ShouldProactivelyUpdate(context, layer)) + if (!ShouldSkipChangedEnough(context, layer)) old_cull_rect = fragment.GetCullRect(); bool expanded = cull_rect.ApplyPaintProperties(root_state_, parent_state, local_state, old_cull_rect); if (expanded && fragment.GetCullRect() != cull_rect) - context.current.force_proactive_update = true; + context.current.subtree_should_skip_changed_enough = true; } return cull_rect; } @@ -420,27 +421,27 @@ absl::optional<CullRect> old_contents_cull_rect; // Not using |old_cull_rect| will force the cull rect to be updated // (skipping |CullRect::ChangedEnough|) in |ApplyPaintProperties|. - if (!ShouldProactivelyUpdate(context, layer)) + if (!ShouldSkipChangedEnough(context, layer)) old_contents_cull_rect = fragment.GetContentsCullRect(); bool expanded = contents_cull_rect.ApplyPaintProperties( root_state_, local_state, contents_state, old_contents_cull_rect); if (expanded && fragment.GetContentsCullRect() != contents_cull_rect) - context.current.force_proactive_update = true; + context.current.subtree_should_skip_changed_enough = true; } return contents_cull_rect; } -bool CullRectUpdater::ShouldProactivelyUpdate(const Context& context, +bool CullRectUpdater::ShouldSkipChangedEnough(const Context& context, const PaintLayer& layer) const { - if (context.current.force_proactive_update) + if (context.current.subtree_should_skip_changed_enough) return true; - // If we will repaint anyway, proactively refresh cull rect. A sliding - // window (aka hysteresis, see: CullRect::ChangedEnough()) is used to - // avoid frequent cull rect updates because they force a repaint (see: - // |CullRectUpdater::SetFragmentCullRects|). Proactively updating the cull - // rect resets the sliding window which will minimize the need to update - // the cull rect again. + // If we will repaint anyway, proactively refresh cull rect by skipping the + // |CullRect::ChangedEnough| logic. That logic manages a sliding window (aka + // hysteresis) to avoid frequent cull rect updates because they force a + // repaint (see: |CullRectUpdater::SetFragmentCullRects|). Proactively + // updating the cull rect resets the sliding window which will minimize + // the need to update the cull rect again. return layer.SelfOrDescendantNeedsRepaint(); }
diff --git a/third_party/blink/renderer/core/paint/cull_rect_updater.h b/third_party/blink/renderer/core/paint/cull_rect_updater.h index 195edac..29409db 100644 --- a/third_party/blink/renderer/core/paint/cull_rect_updater.h +++ b/third_party/blink/renderer/core/paint/cull_rect_updater.h
@@ -44,7 +44,7 @@ const PaintLayer* container = nullptr; bool subtree_is_out_of_cull_rect = false; bool subtree_should_use_infinite_cull_rect = false; - bool force_proactive_update = false; + bool subtree_should_skip_changed_enough = false; bool force_update_children = false; STACK_ALLOCATED(); @@ -72,7 +72,7 @@ PaintLayer&, const FragmentData& fragment, const CullRect& cull_rect); - bool ShouldProactivelyUpdate(const Context&, const PaintLayer&) const; + bool ShouldSkipChangedEnough(const Context&, const PaintLayer&) const; PaintLayer& starting_layer_; PropertyTreeState root_state_ = PropertyTreeState::Uninitialized();
diff --git a/third_party/blink/renderer/core/paint/cull_rect_updater_test.cc b/third_party/blink/renderer/core/paint/cull_rect_updater_test.cc index 8f5f1fd5..6c56f24 100644 --- a/third_party/blink/renderer/core/paint/cull_rect_updater_test.cc +++ b/third_party/blink/renderer/core/paint/cull_rect_updater_test.cc
@@ -471,12 +471,14 @@ EXPECT_EQ(gfx::Rect(0, 0, 200, 7000), GetContentsCullRect("scroller").Rect()); EXPECT_EQ(gfx::Rect(0, 0, 200, 7000), GetCullRect("child").Rect()); - // Setting |scroller| needs repaint will lead to proactive update for it, - // and for |child| because |scroller|'s cull rect changes. + // Setting |scroller| needs repaint will let it ignore scrolled/changed + // enough logic. A scroll is needed to trigger cull rect update. + scroller->scrollBy(0, 1); GetPaintLayerByElementId("scroller")->SetNeedsRepaint(); UpdateAllLifecyclePhasesForTest(); - EXPECT_EQ(gfx::Rect(0, 0, 200, 4200), GetContentsCullRect("scroller").Rect()); - EXPECT_EQ(gfx::Rect(0, 0, 200, 4200), GetCullRect("child").Rect()); + EXPECT_EQ(gfx::Rect(0, 0, 200, 4201), GetContentsCullRect("scroller").Rect()); + // |child| also updates cull rect because |scroller|'s cull rect changes. + EXPECT_EQ(gfx::Rect(0, 0, 200, 4201), GetCullRect("child").Rect()); } TEST_P(CullRectUpdaterTest, ContentsCullRectCoveringWholeContentsRect) {
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc index 2d0026b..8d2cad7 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc
@@ -3218,15 +3218,20 @@ return; // If the parent is 'display: none', then the subtree will be ignored and // changing aria-hidden will have no effect. - if (parent->GetLayoutObject()) { - // For elements with layout objects we can get their style directly. - if (parent->GetLayoutObject()->Style()->Display() == EDisplay::kNone) - return; - } else if (Element* parent_element = parent->GetElement()) { - // No layout object: must ensure computed style. - const ComputedStyle* parent_style = parent_element->EnsureComputedStyle(); - if (!parent_style || parent_style->IsEnsuredInDisplayNone()) - return; + if (!parent->GetLayoutObject()) { + // No layout object: may be in display: none. + if (Element* parent_element = parent->GetElement()) { + if (!IsDisplayLocked(parent_element)) { + // No layout object: must ensure computed style. + // Do not perform this check for display locked content, where + // computed styles are not updated. In that case, we will need to + // assume the need for marking the subtree dirty. + const ComputedStyle* parent_style = + parent_element->EnsureComputedStyle(); + if (!parent_style || parent_style->IsEnsuredInDisplayNone()) + return; + } + } } // Unlike AXObject's |IsVisible| or |IsHiddenViaStyle| this method does not // consider 'visibility: [hidden|collapse]', because while the visibility
diff --git a/third_party/blink/renderer/modules/accessibility/blink_ax_tree_source.cc b/third_party/blink/renderer/modules/accessibility/blink_ax_tree_source.cc index 44e60ba..6606d8b 100644 --- a/third_party/blink/renderer/modules/accessibility/blink_ax_tree_source.cc +++ b/third_party/blink/renderer/modules/accessibility/blink_ax_tree_source.cc
@@ -34,7 +34,7 @@ #if DCHECK_IS_ON() AXObject* ParentObjectUnignored(AXObject* child) { - if (child->IsDetached()) + if (!child || child->IsDetached()) return nullptr; AXObject* parent = child->ParentObjectIncludedInTree(); while (parent && !parent->IsDetached() && @@ -96,7 +96,8 @@ // method is called. WTF::Vector<int32_t> to_remove; for (auto iter : load_inline_text_boxes_ids_) { - if (GetFromId(iter)->IsDetached()) + auto* obj = GetFromId(iter); + if (!obj || obj->IsDetached()) to_remove.push_back(iter); } for (auto iter : to_remove) @@ -297,7 +298,7 @@ AXObject* child = parent->ChildAtIncludingIgnored(i); // The child may be invalid due to issues in blink accessibility code. - if (child->IsDetached()) { + if (!child || child->IsDetached()) { NOTREACHED() << "Should not try to serialize an invalid child:" << "\nParent: " << parent->ToString(true).Utf8() << "\nChild: " << child->ToString(true).Utf8(); @@ -339,7 +340,8 @@ if (node == GetRoot()) return nullptr; node = node->ParentObject(); - } while (!node->IsDetached() && !node->AccessibilityIsIncludedInTree()); + } while (node && !node->IsDetached() && + !node->AccessibilityIsIncludedInTree()); return node; } @@ -380,7 +382,7 @@ dst->id = src->AXObjectID(); dst->role = src->RoleValue(); - if (src->IsDetached() || !src->AccessibilityIsIncludedInTree()) { + if (!src || src->IsDetached() || !src->AccessibilityIsIncludedInTree()) { dst->AddState(ax::mojom::blink::State::kIgnored); NOTREACHED(); return;
diff --git a/third_party/blink/renderer/modules/credentialmanagement/payment_credential_instrument.idl b/third_party/blink/renderer/modules/credentialmanagement/payment_credential_instrument.idl index 2479252d..71dd85a 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/payment_credential_instrument.idl +++ b/third_party/blink/renderer/modules/credentialmanagement/payment_credential_instrument.idl
@@ -5,7 +5,7 @@ // https://w3c.github.io/secure-payment-confirmation dictionary PaymentCredentialInstrument { - required DOMString displayName; + required USVString displayName; required USVString icon; boolean iconMustBeShown = true; };
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc b/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc index 7456e4b..f4229e9 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc
@@ -82,10 +82,12 @@ public: using VideoSinkId = WebMediaStreamSink*; - FrameDeliverer(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, - base::WeakPtr<MediaStreamVideoTrack> media_stream_video_track, - bool enabled, - uint32_t crop_version); + FrameDeliverer( + scoped_refptr<base::SingleThreadTaskRunner> main_render_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, + base::WeakPtr<MediaStreamVideoTrack> media_stream_video_track, + bool enabled, + uint32_t crop_version); FrameDeliverer(const FrameDeliverer&) = delete; FrameDeliverer& operator=(const FrameDeliverer&) = delete; @@ -220,13 +222,13 @@ }; MediaStreamVideoTrack::FrameDeliverer::FrameDeliverer( + scoped_refptr<base::SingleThreadTaskRunner> main_render_task_runner, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, base::WeakPtr<MediaStreamVideoTrack> media_stream_video_track, bool enabled, uint32_t crop_version) : io_task_runner_(std::move(io_task_runner)), - // TODO(crbug.com/1223353, crbug.com/624696): Move to WebFrameScheduler. - main_render_task_runner_(Thread::MainThread()->GetDeprecatedTaskRunner()), + main_render_task_runner_(main_render_task_runner), media_stream_video_track_(media_stream_video_track), enabled_(enabled), emit_frame_drop_events_(true), @@ -267,7 +269,7 @@ CrossThreadBindOnce(&FrameDeliverer::SetNotifyFrameDroppedCallbackOnIO, WrapRefCounted(this), WTF::CrossThreadUnretained(id), CrossThreadBindRepeating(std::move(callback)), - Thread::Current()->GetDeprecatedTaskRunner())); + main_render_task_runner_)); } void MediaStreamVideoTrack::FrameDeliverer::SetNotifyFrameDroppedCallbackOnIO( @@ -314,7 +316,7 @@ *io_task_runner_, FROM_HERE, CrossThreadBindOnce(&FrameDeliverer::RemoveCallbackOnIO, WrapRefCounted(this), WTF::CrossThreadUnretained(id), - Thread::Current()->GetDeprecatedTaskRunner())); + main_render_task_runner_)); } void MediaStreamVideoTrack::FrameDeliverer::RemoveCallbackOnIO( @@ -345,7 +347,7 @@ *io_task_runner_, FROM_HERE, CrossThreadBindOnce(&FrameDeliverer::RemoveEncodedCallbackOnIO, WrapRefCounted(this), WTF::CrossThreadUnretained(id), - Thread::Current()->GetDeprecatedTaskRunner())); + main_render_task_runner_)); } void MediaStreamVideoTrack::FrameDeliverer::RemoveEncodedCallbackOnIO( @@ -610,8 +612,8 @@ source_(source->GetWeakPtr()) { frame_deliverer_ = base::MakeRefCounted<MediaStreamVideoTrack::FrameDeliverer>( - source->io_task_runner(), weak_factory_.GetWeakPtr(), enabled, - source->GetCropVersion()); + source->GetTaskRunner(), source->io_task_runner(), + weak_factory_.GetWeakPtr(), enabled, source->GetCropVersion()); source->AddTrack( this, VideoTrackAdapterSettings(), ConvertToBaseRepeatingCallback(CrossThreadBindRepeating( @@ -659,8 +661,8 @@ source_(source->GetWeakPtr()) { frame_deliverer_ = base::MakeRefCounted<MediaStreamVideoTrack::FrameDeliverer>( - source->io_task_runner(), weak_factory_.GetWeakPtr(), enabled, - source->GetCropVersion()); + source->GetTaskRunner(), source->io_task_runner(), + weak_factory_.GetWeakPtr(), enabled, source->GetCropVersion()); source->AddTrack( this, adapter_settings, ConvertToBaseRepeatingCallback(CrossThreadBindRepeating(
diff --git a/third_party/blink/renderer/modules/payments/secure_payment_confirmation_request.idl b/third_party/blink/renderer/modules/payments/secure_payment_confirmation_request.idl index dc5987f..0d2c73f 100644 --- a/third_party/blink/renderer/modules/payments/secure_payment_confirmation_request.idl +++ b/third_party/blink/renderer/modules/payments/secure_payment_confirmation_request.idl
@@ -14,7 +14,7 @@ required PaymentCredentialInstrument instrument; unsigned long timeout; - DOMString payeeName; + USVString payeeName; USVString payeeOrigin; // The relying party, which must be the relying party of a given credential
diff --git a/third_party/blink/renderer/modules/webaudio/audio_context.cc b/third_party/blink/renderer/modules/webaudio/audio_context.cc index ffac39f..ce8def6 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_context.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_context.cc
@@ -535,14 +535,14 @@ return promise; } - // When the queue is empty, we start resolver immediately because it is the - // only item in the queue. - if (set_sink_id_resolvers_.IsEmpty()) { + set_sink_id_resolvers_.push_back(resolver); + + // When there's only one resolver in the queue, we start it immediately + // because there is no preceding resolver will start it. + if (set_sink_id_resolvers_.size() == 1) { resolver->Start(); } - set_sink_id_resolvers_.push_back(resolver); - return promise; }
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc index 3957bcc..aaa1f3a 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
@@ -1117,6 +1117,7 @@ bool want_depth_buffer = attrs.depth; bool want_stencil_buffer = attrs.stencil; bool want_antialiasing = attrs.antialias; + bool desynchronized = attrs.desynchronized; DrawingBuffer::PreserveDrawingBuffer preserve = attrs.preserve_drawing_buffer ? DrawingBuffer::kPreserve : DrawingBuffer::kDiscard; @@ -1143,13 +1144,13 @@ bool using_swap_chain = context_provider->GetCapabilities().shared_image_swap_chain && - attrs.desynchronized; + desynchronized; return DrawingBuffer::Create( std::move(context_provider), graphics_info, using_swap_chain, this, ClampedCanvasSize(), premultiplied_alpha, want_alpha_channel, - want_depth_buffer, want_stencil_buffer, want_antialiasing, preserve, - web_gl_version, chromium_image_usage, Host()->FilterQuality(), + want_depth_buffer, want_stencil_buffer, want_antialiasing, desynchronized, + preserve, web_gl_version, chromium_image_usage, Host()->FilterQuality(), drawing_buffer_color_space_, pixel_format_deprecated_, PowerPreferenceToGpuPreference(attrs.power_preference)); }
diff --git a/third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame.cc b/third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame.cc index 20f4313..b57d94a 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame.cc
@@ -305,7 +305,9 @@ base::WaitableEvent waitable_event; // TODO(crbug.com/1164152): Lift the main thread restriction. if (PostCrossThreadTask( - *Thread::MainThread()->GetDeprecatedTaskRunner(), FROM_HERE, + *Thread::MainThread()->GetTaskRunner( + MainThreadTaskRunnerRestricted()), + FROM_HERE, CrossThreadBindOnce( &GetMediaTaskRunnerAndGpuFactoriesOnMainThread, CrossThreadUnretained(&media_task_runner_),
diff --git a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc index f5a538e..bfe3584 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc
@@ -316,6 +316,7 @@ layer_->SetBlendBackgroundColor(opacity_mode_ != kOpaque); layer_->SetNearestNeighbor(resource_host_->FilterQuality() == cc::PaintFlags::FilterQuality::kNone); + layer_->SetHDRMetadata(resource_host_->GetHDRMetadata()); } // After the page becomes visible and successfully restored the canvas // resource provider, set |lose_context_in_background_| to false. @@ -368,6 +369,12 @@ cc::PaintFlags::FilterQuality::kNone); } +void Canvas2DLayerBridge::SetHDRMetadata( + absl::optional<gfx::HDRMetadata> hdr_metadata) { + if (layer_) + layer_->SetHDRMetadata(hdr_metadata); +} + void Canvas2DLayerBridge::SetIsInHiddenPage(bool hidden) { if (is_hidden_ == hidden) return;
diff --git a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h index bf27f35..78932544 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h +++ b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.h
@@ -82,6 +82,7 @@ void SetIsInHiddenPage(bool); void SetIsBeingDisplayed(bool); void SetFilterQuality(cc::PaintFlags::FilterQuality filter_quality); + void SetHDRMetadata(absl::optional<gfx::HDRMetadata> hdr_metadata); void DidDraw(); void DoPaintInvalidation(const gfx::Rect& dirty_rect); cc::Layer* Layer();
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_host.h b/third_party/blink/renderer/platform/graphics/canvas_resource_host.h index 1ec4569..4e70428 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_host.h +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_host.h
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/platform/graphics/graphics_types.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" #include "third_party/blink/renderer/platform/platform_export.h" +#include "ui/gfx/hdr_metadata.h" namespace cc { class PaintCanvas; @@ -35,6 +36,13 @@ cc::PaintFlags::FilterQuality FilterQuality() const { return filter_quality_; } + void SetHDRMetadata(const absl::optional<gfx::HDRMetadata>& hdr_metadata) { + hdr_metadata_ = hdr_metadata; + } + const absl::optional<gfx::HDRMetadata>& GetHDRMetadata() const { + return hdr_metadata_; + } + virtual bool LowLatencyEnabled() const { return false; } CanvasResourceProvider* ResourceProvider() const; @@ -52,6 +60,7 @@ std::unique_ptr<CanvasResourceProvider> resource_provider_; cc::PaintFlags::FilterQuality filter_quality_ = cc::PaintFlags::FilterQuality::kLow; + absl::optional<gfx::HDRMetadata> hdr_metadata_; }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc index 343dd27..9a5606d 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc
@@ -144,6 +144,7 @@ bool want_depth_buffer, bool want_stencil_buffer, bool want_antialiasing, + bool desynchronized, PreserveDrawingBuffer preserve, WebGLVersion webgl_version, ChromiumImageUsage chromium_image_usage, @@ -199,10 +200,11 @@ scoped_refptr<DrawingBuffer> drawing_buffer = base::AdoptRef(new DrawingBuffer( std::move(context_provider), graphics_info, using_swap_chain, - std::move(extensions_util), client, discard_framebuffer_supported, - want_alpha_channel, premultiplied_alpha, preserve, webgl_version, - want_depth_buffer, want_stencil_buffer, chromium_image_usage, - filter_quality, color_space, pixel_format, gpu_preference)); + desynchronized, std::move(extensions_util), client, + discard_framebuffer_supported, want_alpha_channel, + premultiplied_alpha, preserve, webgl_version, want_depth_buffer, + want_stencil_buffer, chromium_image_usage, filter_quality, + color_space, pixel_format, gpu_preference)); if (!drawing_buffer->Initialize(size, multisample_supported)) { drawing_buffer->BeginDestruction(); return scoped_refptr<DrawingBuffer>(); @@ -214,6 +216,7 @@ std::unique_ptr<WebGraphicsContext3DProvider> context_provider, const Platform::GraphicsInfo& graphics_info, bool using_swap_chain, + bool desynchronized, std::unique_ptr<Extensions3DUtil> extensions_util, Client* client, bool discard_framebuffer_supported, @@ -240,6 +243,7 @@ premultiplied_alpha_(premultiplied_alpha), graphics_info_(graphics_info), using_swap_chain_(using_swap_chain), + low_latency_enabled_(desynchronized), want_depth_(want_depth), want_stencil_(want_stencil), color_space_(PredefinedColorSpaceToGfxColorSpace(color_space)),
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h index ebf99e7..3fb3792 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h
@@ -136,6 +136,7 @@ bool want_depth_buffer, bool want_stencil_buffer, bool want_antialiasing, + bool desynchronized, PreserveDrawingBuffer, WebGLVersion, ChromiumImageUsage, @@ -335,6 +336,7 @@ DrawingBuffer(std::unique_ptr<WebGraphicsContext3DProvider>, const Platform::GraphicsInfo& graphics_info, bool using_swap_chain, + bool desynchronized, std::unique_ptr<Extensions3DUtil>, Client*, bool discard_framebuffer_supported,
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc index 300a7a6..040c8a5 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc
@@ -681,13 +681,15 @@ bool want_stencil_buffer = cases[i].request_stencil; bool want_antialiasing = false; bool using_swap_chain = false; + bool desynchronized = false; scoped_refptr<DrawingBuffer> drawing_buffer = DrawingBuffer::Create( std::move(provider), graphics_info, using_swap_chain, nullptr, gfx::Size(10, 10), premultiplied_alpha, want_alpha_channel, - want_depth_buffer, want_stencil_buffer, want_antialiasing, preserve, - DrawingBuffer::kWebGL1, DrawingBuffer::kAllowChromiumImage, - cc::PaintFlags::FilterQuality::kLow, PredefinedColorSpace::kSRGB, - CanvasPixelFormat::kUint8, gl::GpuPreference::kHighPerformance); + want_depth_buffer, want_stencil_buffer, want_antialiasing, + desynchronized, preserve, DrawingBuffer::kWebGL1, + DrawingBuffer::kAllowChromiumImage, cc::PaintFlags::FilterQuality::kLow, + PredefinedColorSpace::kSRGB, CanvasPixelFormat::kUint8, + gl::GpuPreference::kHighPerformance); // When we request a depth or a stencil buffer, we will get both. EXPECT_EQ(cases[i].request_depth || cases[i].request_stencil, @@ -756,10 +758,11 @@ graphics_info.using_gpu_compositing = true; scoped_refptr<DrawingBuffer> too_big_drawing_buffer = DrawingBuffer::Create( nullptr, graphics_info, false /* using_swap_chain */, nullptr, - too_big_size, false, false, false, false, false, DrawingBuffer::kDiscard, - DrawingBuffer::kWebGL1, DrawingBuffer::kAllowChromiumImage, - cc::PaintFlags::FilterQuality::kLow, PredefinedColorSpace::kSRGB, - CanvasPixelFormat::kUint8, gl::GpuPreference::kHighPerformance); + too_big_size, false, false, false, false, false, /*desynchronized=*/false, + DrawingBuffer::kDiscard, DrawingBuffer::kWebGL1, + DrawingBuffer::kAllowChromiumImage, cc::PaintFlags::FilterQuality::kLow, + PredefinedColorSpace::kSRGB, CanvasPixelFormat::kUint8, + gl::GpuPreference::kHighPerformance); EXPECT_EQ(too_big_drawing_buffer, nullptr); drawing_buffer_->BeginDestruction(); }
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test_helpers.h b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test_helpers.h index 45e41d2d83..6b627c5 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test_helpers.h +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test_helpers.h
@@ -428,6 +428,7 @@ std::move(context_provider), graphics_info, false /* usingSwapChain */, + false /* desynchronized */, std::move(extensions_util), client, false /* discardFramebufferSupported */,
diff --git a/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.cc b/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.cc index d13849ce..f3a8656 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.cc
@@ -139,7 +139,7 @@ // this once per thread. base::WaitableEvent waitable_event; scoped_refptr<base::SingleThreadTaskRunner> task_runner = - Thread::MainThread()->GetDeprecatedTaskRunner(); + Thread::MainThread()->GetTaskRunner(MainThreadTaskRunnerRestricted()); PostCrossThreadTask( *task_runner, FROM_HERE, CrossThreadBindOnce(
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index bb74a68..0619c0a 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1291,7 +1291,8 @@ }, { name: "FormRelAttribute", - status: "experimental", + status: "stable", + base_feature: "FormRelAttribute", }, { name: "FractionalScrollOffsets",
diff --git a/third_party/blink/renderer/platform/scheduler/public/main_thread.h b/third_party/blink/renderer/platform/scheduler/public/main_thread.h index 7b68ca86..50a44c48 100644 --- a/third_party/blink/renderer/platform/scheduler/public/main_thread.h +++ b/third_party/blink/renderer/platform/scheduler/public/main_thread.h
@@ -16,8 +16,12 @@ private: // Permitted users of `MainThread::GetTaskRunner`. friend class CachedStorageArea; + friend class CategorizedWorkerPoolImpl; friend class RendererResourceCoordinatorImpl; + friend class SharedGpuContext; friend class ThreadedIconLoader; + friend class WebGLWebCodecsVideoFrame; + friend class WebRtcVideoFrameAdapter; friend class V8WorkerMemoryReporter; MainThreadTaskRunnerRestricted() = default;
diff --git a/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc b/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc index cf1ea18a..ca6a18e 100644 --- a/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc +++ b/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc
@@ -180,7 +180,8 @@ // Recreate the context provider. base::WaitableEvent waitable_event; PostCrossThreadTask( - *Thread::MainThread()->GetDeprecatedTaskRunner(), FROM_HERE, + *Thread::MainThread()->GetTaskRunner(MainThreadTaskRunnerRestricted()), + FROM_HERE, CrossThreadBindOnce(&CreateContextProviderOnMainThread, CrossThreadUnretained(&raster_context_provider_), CrossThreadUnretained(&waitable_event)));
diff --git a/third_party/blink/renderer/platform/widget/compositing/categorized_worker_pool.cc b/third_party/blink/renderer/platform/widget/compositing/categorized_worker_pool.cc index 58fd705..e9ba22cf 100644 --- a/third_party/blink/renderer/platform/widget/compositing/categorized_worker_pool.cc +++ b/third_party/blink/renderer/platform/widget/compositing/categorized_worker_pool.cc
@@ -242,7 +242,7 @@ &has_task_for_background_priority_thread_cv_); #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) thread->SetBackgroundingCallback( - Thread::MainThread()->GetDeprecatedTaskRunner(), + Thread::MainThread()->GetTaskRunner(MainThreadTaskRunnerRestricted()), base::BindOnce([](base::PlatformThreadId thread_id) { Platform::Current()->SetThreadType(thread_id, base::ThreadType::kBackground);
diff --git a/third_party/blink/renderer/platform/widget/widget_base.cc b/third_party/blink/renderer/platform/widget/widget_base.cc index f4a691a2..cd44315 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.cc +++ b/third_party/blink/renderer/platform/widget/widget_base.cc
@@ -550,6 +550,8 @@ } void WidgetBase::DidBeginMainFrame() { + if (base::FeatureList::IsEnabled(features::kRunTextInputUpdatePostLifecycle)) + UpdateTextInputState(); client_->DidBeginMainFrame(); } @@ -846,11 +848,10 @@ client_->SetSuppressFrameRequestsWorkaroundFor704763Only(true); client_->WillBeginMainFrame(); UpdateSelectionBounds(); - - // The UpdateTextInputState can result in further layout and possibly - // enable GPU acceleration so they need to be called before any painting - // is done. - UpdateTextInputState(); + // UpdateTextInputState() will cause a forced style and layout update, which + // we would like to eliminate. + if (!base::FeatureList::IsEnabled(features::kRunTextInputUpdatePostLifecycle)) + UpdateTextInputState(); } void WidgetBase::RunPaintBenchmark(int repeat_count,
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 116659c..f6a10449 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
@@ -34,6 +34,7 @@ # TODO(dcheng): Should these be in a more specific config? 'gfx::ColorSpace', 'gfx::CubicBezier', + 'gfx::HDRMetadata', 'gfx::ICCProfile', 'gfx::RadToDeg',
diff --git a/third_party/blink/tools/blinkpy/w3c/test_importer.py b/third_party/blink/tools/blinkpy/w3c/test_importer.py index 6233ee2..fdd1b64 100644 --- a/third_party/blink/tools/blinkpy/w3c/test_importer.py +++ b/third_party/blink/tools/blinkpy/w3c/test_importer.py
@@ -671,6 +671,11 @@ 'disable-site-isolation-trials')) tests_to_rebaseline.update(to_rebaseline) + # commit local changes so that rebaseline tool will be happy + if self.chromium_git.has_working_directory_changes(): + message = 'Update test expectations' + self._commit_changes(message) + self._expectations_updater.download_text_baselines( list(tests_to_rebaseline))
diff --git a/third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/builders.py b/third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/builders.py index 3aa24e4..cc24459 100644 --- a/third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/builders.py +++ b/third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/builders.py
@@ -40,9 +40,6 @@ if self._fake_ci_builders is None: fake_try_builders = { # chromium.fyi - 'linux-blink-optional-highdpi-rel-dummy': { - 'linux-blink-optional-highdpi-rel', - }, 'linux-blink-rel-dummy': { 'linux-blink-rel', 'v8_linux_blink_rel',
diff --git a/third_party/blink/web_tests/SlowTests b/third_party/blink/web_tests/SlowTests index 16da5b0..7685b34 100644 --- a/third_party/blink/web_tests/SlowTests +++ b/third_party/blink/web_tests/SlowTests
@@ -619,8 +619,8 @@ crbug.com/831673 http/tests/devtools/reveal-objects.js [ Slow ] crbug.com/829952 fast/webgl/texImage-imageBitmap-from-image-resize.html [ Slow ] crbug.com/855816 [ Win ] virtual/stable/http/tests/navigation/rename-subframe-goback.html [ Slow ] -crbug.com/1066178 external/wpt/html/user-activation/consumption-crossorigin.sub.tentative.html [ Slow ] -crbug.com/1064522 external/wpt/html/user-activation/propagation-crossorigin.sub.tentative.html [ Slow ] +crbug.com/1066178 external/wpt/html/user-activation/consumption-crossorigin.sub.html [ Slow ] +crbug.com/1064522 external/wpt/html/user-activation/propagation-crossorigin.sub.html [ Slow ] crbug.com/863599 [ Debug ] external/wpt/requestidlecallback/callback-iframe.html [ Slow ] crbug.com/869364 http/tests/devtools/console/console-correct-suggestions.js [ Slow ] crbug.com/886566 [ Mac ] http/tests/csspaint/invalidation-background-image.html [ Slow ]
diff --git a/third_party/blink/web_tests/SmokeTests/Mac.txt b/third_party/blink/web_tests/SmokeTests/Mac.txt index bcf6120..7b9b395 100644 --- a/third_party/blink/web_tests/SmokeTests/Mac.txt +++ b/third_party/blink/web_tests/SmokeTests/Mac.txt
@@ -410,7 +410,7 @@ external/wpt/html/syntax/charset/after-head-after-1kb-crlf.html external/wpt/html/syntax/speculative-parsing/generated/document-write/meta-viewport-link-stylesheet-media.tentative.sub.html external/wpt/html/syntax/speculative-parsing/generated/document-write/svg-script-src.tentative.sub.html -external/wpt/html/user-activation/propagation-crossorigin.sub.tentative.html +external/wpt/html/user-activation/propagation-crossorigin.sub.html external/wpt/html/webappapis/scripting/events/event-handler-attributes-body-window.html external/wpt/html/webappapis/update-rendering/child-document-raf-order.html external/wpt/idle-detection/interceptor.https.html
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 0000bd39..509010a 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -4532,8 +4532,8 @@ crbug.com/849978 http/tests/devtools/elements/styles-4/stylesheet-source-url-comment.js [ Failure Pass Timeout ] # User Activation -crbug.com/736415 crbug.com/1066190 external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.tentative.html [ Failure Timeout ] -crbug.com/736415 external/wpt/html/user-activation/navigation-state-reset-sameorigin.tentative.html [ Failure ] +crbug.com/736415 crbug.com/1066190 external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.html [ Failure Timeout ] +crbug.com/736415 external/wpt/html/user-activation/navigation-state-reset-sameorigin.html [ Failure ] # S13N Sheriff 2018-7-11 crbug.com/862643 http/tests/serviceworker/navigation_preload/use-counter.html [ Failure Pass ] @@ -5904,7 +5904,7 @@ crbug.com/1210687 [ Mac10.15 ] fast/events/open-window-from-another-frame.html [ Pass Timeout ] crbug.com/1210687 [ Mac ] http/tests/permissions/chromium/test-request-worker.html [ Pass Timeout ] crbug.com/1210687 [ Mac10.15 ] storage/websql/sql-error-codes.html [ Pass Timeout ] -crbug.com/1210687 [ Mac10.15 ] external/wpt/html/user-activation/propagation-crossorigin.sub.tentative.html [ Pass Timeout ] +crbug.com/1210687 [ Mac10.15 ] external/wpt/html/user-activation/propagation-crossorigin.sub.html [ Pass Timeout ] # Sheriff 2021-06-02 crbug.com/1215575 [ Mac11 ] fast/peerconnection/RTCPeerConnection-applyConstraints-remoteVideoTrack.html [ Pass Timeout ] @@ -7139,6 +7139,10 @@ crbug.com/1364129 [ Mac10.15 ] editing/pasteboard/data-transfer-items-image-png.html [ Failure Pass ] crbug.com/1364129 [ Mac11 ] editing/pasteboard/data-transfer-items-image-png.html [ Failure Pass ] +# Disable DOM web flake on debug linux and mac +crbug.com/1353578 [ Debug Linux ] fast/dom/gc-image-element-2.html [ Failure Pass ] +crbug.com/1353578 [ Debug Mac ] fast/dom/gc-image-element-2.html [ Failure Pass ] + # Sheriff 2022-09-07 crbug.com/1360691 [ Debug Linux ] fast/canvas/disconnected-canvas-lost-gpu-context.html [ Failure ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index 7031c95..f221aeb 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -1273,5 +1273,23 @@ "external/wpt/close-watcher" ], "args": ["--enable-blink-features=CloseWatcher"] + }, + { + "prefix": "orb-v01", + "platforms": ["Linux"], + "args": ["--enable-features=OpaqueResponseBlockingV01"], + "bases": [ + "external/wpt/fetch/corb", + "external/wpt/fetch/api", + "external/wpt/fetch/nosniff" + ] + }, + { + "prefix": "orb-v02", + "platforms": ["Linux"], + "args": ["--enable-features=OpaqueResponseBlockingV01,OpaqueResponseBlockingV02"], + "bases": [ + "external/wpt/fetch/corb" + ] } ]
diff --git a/third_party/blink/web_tests/android/ChromeWPTOverrideExpectations b/third_party/blink/web_tests/android/ChromeWPTOverrideExpectations index 847f4a2..ec656794 100644 --- a/third_party/blink/web_tests/android/ChromeWPTOverrideExpectations +++ b/third_party/blink/web_tests/android/ChromeWPTOverrideExpectations
@@ -1023,10 +1023,10 @@ crbug.com/1050754 external/wpt/html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-sharedworker.html [ Failure ] crbug.com/1050754 external/wpt/html/semantics/tabular-data/processing-model-1/span-limits.html [ Failure ] crbug.com/1050754 external/wpt/html/syntax/xmldecl/xmldecl-1.html [ Failure Pass ] -crbug.com/1050754 external/wpt/html/user-activation/consumption-crossorigin.sub.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/consumption-sameorigin.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/propagation-crossorigin.sub.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/propagation-sameorigin.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/consumption-crossorigin.sub.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/consumption-sameorigin.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/propagation-crossorigin.sub.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/propagation-sameorigin.html [ Failure ] crbug.com/1050754 external/wpt/idle-detection/idle-detection-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html [ Failure ] crbug.com/1050754 external/wpt/idle-detection/idle-detection-allowed-by-feature-policy-attribute.https.sub.html [ Failure ] crbug.com/1050754 external/wpt/idle-detection/idle-detection-allowed-by-feature-policy.https.sub.html [ Failure ]
diff --git a/third_party/blink/web_tests/android/WebLayerWPTOverrideExpectations b/third_party/blink/web_tests/android/WebLayerWPTOverrideExpectations index ffb3583..b123a29 100644 --- a/third_party/blink/web_tests/android/WebLayerWPTOverrideExpectations +++ b/third_party/blink/web_tests/android/WebLayerWPTOverrideExpectations
@@ -1112,10 +1112,10 @@ crbug.com/1050754 external/wpt/html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-sharedworker.html [ Failure ] crbug.com/1050754 external/wpt/html/semantics/tabular-data/processing-model-1/span-limits.html [ Failure ] crbug.com/1050754 external/wpt/html/syntax/xmldecl/xmldecl-1.html [ Failure Pass ] -crbug.com/1050754 external/wpt/html/user-activation/consumption-crossorigin.sub.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/consumption-sameorigin.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/propagation-crossorigin.sub.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/propagation-sameorigin.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/consumption-crossorigin.sub.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/consumption-sameorigin.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/propagation-crossorigin.sub.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/propagation-sameorigin.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window.html [ Pass ] crbug.com/1050754 external/wpt/html/webappapis/structured-clone/structured-clone.html [ Failure ] crbug.com/1050754 external/wpt/idle-detection/idle-detection-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html [ Failure ]
diff --git a/third_party/blink/web_tests/android/WebviewWPTExpectations b/third_party/blink/web_tests/android/WebviewWPTExpectations index 90b587b..424ff7a2 100644 --- a/third_party/blink/web_tests/android/WebviewWPTExpectations +++ b/third_party/blink/web_tests/android/WebviewWPTExpectations
@@ -2962,12 +2962,12 @@ crbug.com/1050754 external/wpt/html/syntax/parsing/html5lib_webkit02.html?run_type=write [ Failure Pass ] crbug.com/1050754 external/wpt/html/syntax/parsing/html5lib_webkit02.html?run_type=write_single [ Failure Pass ] crbug.com/1050754 external/wpt/html/syntax/parsing/the-end.html [ Failure Pass ] -crbug.com/1050754 external/wpt/html/user-activation/consumption-crossorigin.sub.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/consumption-sameorigin.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/navigation-state-reset-sameorigin.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/propagation-crossorigin.sub.tentative.html [ Failure ] -crbug.com/1050754 external/wpt/html/user-activation/propagation-sameorigin.tentative.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/consumption-crossorigin.sub.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/consumption-sameorigin.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/navigation-state-reset-sameorigin.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/propagation-crossorigin.sub.html [ Failure ] +crbug.com/1050754 external/wpt/html/user-activation/propagation-sameorigin.html [ Failure ] crbug.com/1050754 external/wpt/html/webappapis/dynamic-markup-insertion/document-write/contentType.window.html [ Failure Pass ] crbug.com/1050754 external/wpt/html/webappapis/dynamic-markup-insertion/document-write/module-tla-delayed.html [ Timeout ] crbug.com/1050754 external/wpt/html/webappapis/dynamic-markup-insertion/document-write/module-tla-immediate-promise.html [ Timeout ]
diff --git a/third_party/blink/web_tests/external/wpt/fetch/corb/resources/response_block_probe.js b/third_party/blink/web_tests/external/wpt/fetch/corb/resources/response_block_probe.js new file mode 100644 index 0000000..d23ad48 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/fetch/corb/resources/response_block_probe.js
@@ -0,0 +1 @@ +window.script_callback();
diff --git a/third_party/blink/web_tests/external/wpt/fetch/corb/resources/response_block_probe.js.headers b/third_party/blink/web_tests/external/wpt/fetch/corb/resources/response_block_probe.js.headers new file mode 100644 index 0000000..0d848b0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/fetch/corb/resources/response_block_probe.js.headers
@@ -0,0 +1 @@ +Content-Type: text/csv
diff --git a/third_party/blink/web_tests/external/wpt/fetch/corb/response_block.tentative.sub.https-expected.txt b/third_party/blink/web_tests/external/wpt/fetch/corb/response_block.tentative.sub.https-expected.txt new file mode 100644 index 0000000..5f3cd87 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/fetch/corb/response_block.tentative.sub.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL ORB: Expect error response. assert_equals: expected "script errored" but got "script loaded" +FAIL !CORB: CORB would have expected an empty response. assert_not_equals: got disallowed value "script loaded" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/fetch/corb/response_block.tentative.sub.https.html b/third_party/blink/web_tests/external/wpt/fetch/corb/response_block.tentative.sub.https.html new file mode 100644 index 0000000..860e0d3 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/fetch/corb/response_block.tentative.sub.https.html
@@ -0,0 +1,44 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +// Test handling of blocked responses in CORB/ORB. +function probe() { + // We will cross-origin load a script resource that should get blocked by all + // versions of CORB/ORB. Three things may happen: + // + // 1, The script might execute. (CORB/ORB not supported. Or a bug.) + // 2, An empty response is injected: The script loads but nothing is executed. + // (Expected behaviour for CORB and "ORB v0.1".) + // 3, An error is injected and script loading aborts. (Expected for ORB.) + + // A cross-origin response labelled as text/csv, which will call + // script_callback when executed. + const probe = "https://{{domains[www1]}}:{{ports[https][0]}}" + + "/fetch/corb/resources/response_block_probe.js"; + + // Load the probe as a script. + const script = document.createElement("script"); + script.src = probe; + document.body.appendChild(script); + + // Return a promise that will return a string description corresponding to the + // three conditions above. Not that a script_callback call is processed + // synchronously and hence will occur before the onload event is dispatched. + return new Promise((resolve, reject) => { + script.onload = _ => resolve("script loaded"); + script.onerror = _ => resolve("script errored"); + window.script_callback = _ => resolve("script executed"); + }); +} + +promise_test(t => probe().then( + value => assert_equals(value, "script errored")), + "ORB: Expect error response."); + +// This test ensures we're _not_ seeing CORB behaviour. +promise_test(t => probe().then( + value => assert_not_equals(value, "script loaded")), + "!CORB: CORB would have expected an empty response."); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/fetch/corb/script-html-correctly-labeled.tentative.sub.html b/third_party/blink/web_tests/external/wpt/fetch/corb/script-html-correctly-labeled.tentative.sub.html index 8f4d767..6d1947c 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/corb/script-html-correctly-labeled.tentative.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/corb/script-html-correctly-labeled.tentative.sub.html
@@ -14,11 +14,13 @@ // Without CORB, the html document would cause a syntax error when parsed as // JavaScript, but with CORB there should be no errors (because CORB will - // replace the response body with an empty body). - script.onload = t.step_func_done(function(){}) + // replace the response body with an empty body). With ORB, the script loading + // itself will error out. + script.onload = t.step_func_done(); + script.onerror = t.step_func_done(); addEventListener("error",function(e) { t.step(function() { - assert_unreached("Empty body of a CORS-blocked response shouldn't trigger syntax errors."); + assert_unreached("Empty body of a CORB-blocked response shouldn't trigger syntax errors."); t.done(); }) });
diff --git a/third_party/blink/web_tests/external/wpt/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub.html b/third_party/blink/web_tests/external/wpt/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub.html index 1d9af35..f0eb1f0a 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub.html +++ b/third_party/blink/web_tests/external/wpt/fetch/corb/script-resource-with-json-parser-breaker.tentative.sub.html
@@ -62,8 +62,10 @@ // Without CORB, the JSON parser breaker would cause a syntax error when // parsed as JavaScript, but with CORB there should be no errors (because - // CORB will replace the response body with an empty body). + // CORB will replace the response body with an empty body). With ORB, + // the script loading itself should error out. script.onload = resolve; + script.onerror = resolve; addEventListener("error", t.unreached_func( "Empty body of a CORS-blocked response shouldn't trigger syntax errors."))
diff --git a/third_party/blink/web_tests/external/wpt/fetch/range/resources/partial-text.py b/third_party/blink/web_tests/external/wpt/fetch/range/resources/partial-text.py index a005855..fa3d1171 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/range/resources/partial-text.py +++ b/third_party/blink/web_tests/external/wpt/fetch/range/resources/partial-text.py
@@ -8,12 +8,13 @@ def main(request, response): total_length = int(request.GET.first(b'length', b'100')) partial_code = int(request.GET.first(b'partial', b'206')) + content_type = request.GET.first(b'type', b'text/plain') range_header = request.headers.get(b'Range', b'') # Send a 200 if there is no range request if not range_header: to_send = ''.zfill(total_length) - response.headers.set(b"Content-Type", b"text/plain") + response.headers.set(b"Content-Type", content_type) response.headers.set(b"Cache-Control", b"no-cache") response.headers.set(b"Content-Length", total_length) response.content = to_send @@ -29,12 +30,17 @@ # Error the request if the range goes beyond the length if length <= 0 or end > total_length: response.set_error(416, u"Range Not Satisfiable") + # set_error sets the MIME type to application/json, which - for a + # no-cors media request - will be blocked by ORB. We'll just force + # the expected MIME type here, whichfixes the test, but doesn't make + # sense in general. + response.headers = [(b"Content-Type", content_type)] response.write() return # Generate a partial response of the requested length to_send = ''.zfill(length) - response.headers.set(b"Content-Type", b"text/plain") + response.headers.set(b"Content-Type", content_type) response.headers.set(b"Accept-Ranges", b"bytes") response.headers.set(b"Cache-Control", b"no-cache") response.status = partial_code
diff --git a/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window.js b/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window.js index 42e4ac6..62ad894d 100644 --- a/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window.js +++ b/third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window.js
@@ -164,7 +164,7 @@ const rangeId = Math.random() + ''; const rangeBroadcast = awaitMessage(w.navigator.serviceWorker, rangeId); - // Create a bogus audo element to trick the browser into sending + // Create a bogus audio element to trick the browser into sending // cross-origin range requests that can be manipulated by the service worker. const sound_url = new URL('partial-text.py', w.location); sound_url.hostname = REMOTE_HOST; @@ -173,6 +173,7 @@ sound_url.searchParams.set('size', size); sound_url.searchParams.set('partial', partialResponseCode); sound_url.searchParams.set('id', rangeId); + sound_url.searchParams.set('type', 'audio/mp4'); appendAudio(w.document, sound_url); // wait for the range requests to happen @@ -184,6 +185,7 @@ const url = new URL('partial-text.py', w.location); url.searchParams.set('action', 'use-media-range-request'); url.searchParams.set('size', size); + url.searchParams.set('type', 'audio/mp4'); counts['size' + size] = 0; for (let i = 0; i < count; i++) { await preloadImage(url, { doc: w.document });
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/form-submission-target/form-target-request-header.html b/third_party/blink/web_tests/external/wpt/html/semantics/forms/form-submission-target/form-target-request-header.html new file mode 100644 index 0000000..a5cd680 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/form-submission-target/form-target-request-header.html
@@ -0,0 +1,31 @@ +<!DOCTYPE html> +<title>Form request header test</title> +<script src="/common/utils.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +async_test(t => { + window.addEventListener("load", function() { + let form = document.createElement("form"); + form.action = "resources/form-target-request-header-helper.py"; + form.method = "post"; + form.target = "_blank"; + + const channelName = token(); + const channel = new BroadcastChannel(channelName); + channel.onmessage = t.step_func_done(e => { + assert_equals(e.data, "OK"); + }); + + let url_input = document.createElement("input"); + url_input.type = "hidden"; + url_input.name = "channelname"; + url_input.value = channelName; + + form.appendChild(url_input); + document.body.appendChild(form); + form.submit(); + }); +}, 'Verify the content-type exist during a form submission toward "_blank"'); +</script> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/form-submission-target/resources/form-target-request-header-helper.py b/third_party/blink/web_tests/external/wpt/html/semantics/forms/form-submission-target/resources/form-target-request-header-helper.py new file mode 100644 index 0000000..8077016 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/form-submission-target/resources/form-target-request-header-helper.py
@@ -0,0 +1,14 @@ +body_template=""" +<script> +const channel = new BroadcastChannel('{}'); +channel.postMessage('{}', '*'); +window.close(); +</script> +""" +def main(request, response): + has_content_type = bool(request.headers.get(b'Content-Type')) + result = u"OK" if has_content_type else u"FAIL" + channel_name = request.body.decode('utf-8').split("=")[1]; + body = body_template.format(channel_name, result); + headers = [(b"Content-Type", b"text/html")] + return headers, body
diff --git a/third_party/blink/web_tests/external/wpt/html/user-activation/chained-setTimeout.tentative.html b/third_party/blink/web_tests/external/wpt/html/user-activation/chained-setTimeout.html similarity index 96% rename from third_party/blink/web_tests/external/wpt/html/user-activation/chained-setTimeout.tentative.html rename to third_party/blink/web_tests/external/wpt/html/user-activation/chained-setTimeout.html index 4a2f6c5..a530837 100644 --- a/third_party/blink/web_tests/external/wpt/html/user-activation/chained-setTimeout.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/user-activation/chained-setTimeout.html
@@ -1,8 +1,4 @@ <!DOCTYPE html> -<!-- - Tentative due to: - https://github.com/whatwg/html/issues/4008 ---> <html> <head> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/html/user-activation/consumption-crossorigin.sub.tentative.html b/third_party/blink/web_tests/external/wpt/html/user-activation/consumption-crossorigin.sub.html similarity index 97% rename from third_party/blink/web_tests/external/wpt/html/user-activation/consumption-crossorigin.sub.tentative.html rename to third_party/blink/web_tests/external/wpt/html/user-activation/consumption-crossorigin.sub.html index 0758530..d84051cc9 100644 --- a/third_party/blink/web_tests/external/wpt/html/user-activation/consumption-crossorigin.sub.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/user-activation/consumption-crossorigin.sub.html
@@ -1,8 +1,4 @@ <!DOCTYPE html> -<!-- - Tentative due to: - https://github.com/whatwg/html/issues/4008 ---> <html> <head> <meta name="timeout" content="long">
diff --git a/third_party/blink/web_tests/external/wpt/html/user-activation/consumption-sameorigin.tentative.html b/third_party/blink/web_tests/external/wpt/html/user-activation/consumption-sameorigin.html similarity index 97% rename from third_party/blink/web_tests/external/wpt/html/user-activation/consumption-sameorigin.tentative.html rename to third_party/blink/web_tests/external/wpt/html/user-activation/consumption-sameorigin.html index 893dfa3b..11dafea 100644 --- a/third_party/blink/web_tests/external/wpt/html/user-activation/consumption-sameorigin.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/user-activation/consumption-sameorigin.html
@@ -1,8 +1,4 @@ <!DOCTYPE html> -<!-- - Tentative due to: - https://github.com/whatwg/html/issues/4008 ---> <html> <head> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.tentative.html b/third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.html similarity index 95% rename from third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.tentative.html rename to third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.html index fc188d2..1645384e 100644 --- a/third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-crossorigin.sub.html
@@ -1,8 +1,4 @@ <!DOCTYPE html> -<!-- - Tentative due to: - https://github.com/whatwg/html/issues/4008 ---> <html> <head> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-sameorigin.tentative.html b/third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-sameorigin.html similarity index 95% rename from third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-sameorigin.tentative.html rename to third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-sameorigin.html index 271124c..9947598 100644 --- a/third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-sameorigin.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/user-activation/navigation-state-reset-sameorigin.html
@@ -1,8 +1,4 @@ <!DOCTYPE html> -<!-- - Tentative due to: - https://github.com/whatwg/html/issues/4008 ---> <html> <head> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/html/user-activation/no-activation-thru-escape-key.tentative.html b/third_party/blink/web_tests/external/wpt/html/user-activation/no-activation-thru-escape-key.html similarity index 96% rename from third_party/blink/web_tests/external/wpt/html/user-activation/no-activation-thru-escape-key.tentative.html rename to third_party/blink/web_tests/external/wpt/html/user-activation/no-activation-thru-escape-key.html index da873fd7..27988d1 100644 --- a/third_party/blink/web_tests/external/wpt/html/user-activation/no-activation-thru-escape-key.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/user-activation/no-activation-thru-escape-key.html
@@ -1,8 +1,4 @@ <!DOCTYPE html> -<!-- - Tentative due to: - https://github.com/whatwg/html/issues/4008 ---> <html> <head> <title>No user activation through 'Escape' key</title>
diff --git a/third_party/blink/web_tests/external/wpt/html/user-activation/propagation-crossorigin.sub.tentative.html b/third_party/blink/web_tests/external/wpt/html/user-activation/propagation-crossorigin.sub.html similarity index 97% rename from third_party/blink/web_tests/external/wpt/html/user-activation/propagation-crossorigin.sub.tentative.html rename to third_party/blink/web_tests/external/wpt/html/user-activation/propagation-crossorigin.sub.html index 09d9009..5f3bb69 100644 --- a/third_party/blink/web_tests/external/wpt/html/user-activation/propagation-crossorigin.sub.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/user-activation/propagation-crossorigin.sub.html
@@ -1,8 +1,4 @@ <!DOCTYPE html> -<!-- - Tentative due to: - https://github.com/whatwg/html/issues/4008 ---> <html> <head> <meta name="timeout" content="long">
diff --git a/third_party/blink/web_tests/external/wpt/html/user-activation/propagation-sameorigin.tentative.html b/third_party/blink/web_tests/external/wpt/html/user-activation/propagation-sameorigin.html similarity index 97% rename from third_party/blink/web_tests/external/wpt/html/user-activation/propagation-sameorigin.tentative.html rename to third_party/blink/web_tests/external/wpt/html/user-activation/propagation-sameorigin.html index 4b09634..112563fc 100644 --- a/third_party/blink/web_tests/external/wpt/html/user-activation/propagation-sameorigin.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/user-activation/propagation-sameorigin.html
@@ -1,8 +1,4 @@ <!DOCTYPE html> -<!-- - Tentative due to: - https://github.com/whatwg/html/issues/4008 ---> <html> <head> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/html/user-activation/user-activation-interface.tentative.html b/third_party/blink/web_tests/external/wpt/html/user-activation/user-activation-interface.html similarity index 93% rename from third_party/blink/web_tests/external/wpt/html/user-activation/user-activation-interface.tentative.html rename to third_party/blink/web_tests/external/wpt/html/user-activation/user-activation-interface.html index 2e03eae..cd808e0 100644 --- a/third_party/blink/web_tests/external/wpt/html/user-activation/user-activation-interface.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/user-activation/user-activation-interface.html
@@ -1,9 +1,5 @@ <!DOCTYPE html> <html> -<!-- - Tentative due to: - https://github.com/whatwg/html/issues/4008 ---> <head> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script>
diff --git a/third_party/blink/web_tests/virtual/orb-v01/README.md b/third_party/blink/web_tests/virtual/orb-v01/README.md new file mode 100644 index 0000000..e42ddd9 --- /dev/null +++ b/third_party/blink/web_tests/virtual/orb-v01/README.md
@@ -0,0 +1,5 @@ +# Test suite for OpaqueResponseBlockingV01 (ORB v0.1) + +Since this feature is Fetch-related, this suite tests all WPT fetch tests +with `--enable-features=OpaqueResponseBlockingV01`. Tests which are expected +to behave differently for ORB v0.1 have separate expectations.
diff --git a/third_party/blink/web_tests/virtual/orb-v01/external/wpt/fetch/README.txt b/third_party/blink/web_tests/virtual/orb-v01/external/wpt/fetch/README.txt new file mode 100644 index 0000000..c0f4ca6 --- /dev/null +++ b/third_party/blink/web_tests/virtual/orb-v01/external/wpt/fetch/README.txt
@@ -0,0 +1,6 @@ +Test Expectations for virtual/orb-v01. + +corb/response_block.tentative.sub.https.html tests behaviour that is different +between CORB, ORB v0.1 and ORB v0.2 (and full ORB), and hence has separate +expecations in this virtual test suite. +
diff --git a/third_party/blink/web_tests/virtual/orb-v01/external/wpt/fetch/corb/response_block.tentative.sub.https-expected.txt b/third_party/blink/web_tests/virtual/orb-v01/external/wpt/fetch/corb/response_block.tentative.sub.https-expected.txt new file mode 100644 index 0000000..5f3cd87 --- /dev/null +++ b/third_party/blink/web_tests/virtual/orb-v01/external/wpt/fetch/corb/response_block.tentative.sub.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL ORB: Expect error response. assert_equals: expected "script errored" but got "script loaded" +FAIL !CORB: CORB would have expected an empty response. assert_not_equals: got disallowed value "script loaded" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/orb-v02/README.md b/third_party/blink/web_tests/virtual/orb-v02/README.md new file mode 100644 index 0000000..1ef506e --- /dev/null +++ b/third_party/blink/web_tests/virtual/orb-v02/README.md
@@ -0,0 +1,6 @@ +# Test suite for OpaqueResponseBlockingV02 (ORB v0.2) + +Since this feature is Fetch-related, this suite tests all WPT fetch tests +with `--enable-features=OpaqueResponseBlockingV01,OpaqueResponseBlockingV02`. +Tests which are expected to behave differently for ORB v0.1 have separate +expectations.
diff --git a/third_party/blink/web_tests/virtual/orb-v02/external/wpt/fetch/README.txt b/third_party/blink/web_tests/virtual/orb-v02/external/wpt/fetch/README.txt new file mode 100644 index 0000000..24dacfb --- /dev/null +++ b/third_party/blink/web_tests/virtual/orb-v02/external/wpt/fetch/README.txt
@@ -0,0 +1,5 @@ +Test Expectations for virtual/orb-v02. + +corb/response_block.tentative.sub.https.html tests behaviour that is different +between CORB, ORB v0.1 and ORB v0.2 (and full ORB), and hence has separate +expecations in this virtual test suite.
diff --git a/third_party/blink/web_tests/virtual/orb-v02/external/wpt/fetch/corb/response_block.tentative.sub.https-expected.txt b/third_party/blink/web_tests/virtual/orb-v02/external/wpt/fetch/corb/response_block.tentative.sub.https-expected.txt new file mode 100644 index 0000000..d9bfbc7 --- /dev/null +++ b/third_party/blink/web_tests/virtual/orb-v02/external/wpt/fetch/corb/response_block.tentative.sub.https-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +PASS ORB: Expect error response. +PASS !CORB: CORB would have expected an empty response. +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/stable/webexposed/element-instance-property-listing-expected.txt b/third_party/blink/web_tests/virtual/stable/webexposed/element-instance-property-listing-expected.txt index 99d0adb9..b84c53e7 100644 --- a/third_party/blink/web_tests/virtual/stable/webexposed/element-instance-property-listing-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/webexposed/element-instance-property-listing-expected.txt
@@ -572,6 +572,8 @@ property method property name property noValidate + property rel + property relList property reportValidity property requestSubmit property reset
diff --git a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt index 54381c4..d96ea9f 100644 --- a/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -3012,6 +3012,8 @@ getter method getter name getter noValidate + getter rel + getter relList getter target method @@iterator method checkValidity @@ -3028,6 +3030,8 @@ setter method setter name setter noValidate + setter rel + setter relList setter target interface HTMLFrameElement : HTMLElement attribute @@toStringTag
diff --git a/third_party/freetype/README.chromium b/third_party/freetype/README.chromium index 96b7f4c..0bebc82 100644 --- a/third_party/freetype/README.chromium +++ b/third_party/freetype/README.chromium
@@ -1,7 +1,7 @@ Name: FreeType URL: http://www.freetype.org/ -Version: VER-2-12-1-85-g8e68439a6 -Revision: 8e68439a6ffc9e489a70f2c278a016fe15394abf +Version: VER-2-12-1-87-g33ceac2af +Revision: 33ceac2afc3608be2d12b3dece071a91e34c3062 CPEPrefix: cpe:/a:freetype:freetype:2.11.1 License: Custom license "inspired by the BSD, Artistic, and IJG (Independent JPEG Group) licenses"
diff --git a/third_party/webgpu-cts/ts_sources.txt b/third_party/webgpu-cts/ts_sources.txt index 31d828d..ba89cc3 100644 --- a/third_party/webgpu-cts/ts_sources.txt +++ b/third_party/webgpu-cts/ts_sources.txt
@@ -145,6 +145,7 @@ src/webgpu/api/operation/command_buffer/render/state_tracking.spec.ts src/webgpu/api/operation/compute/basic.spec.ts src/webgpu/api/operation/compute_pipeline/entry_point_name.spec.ts +src/webgpu/api/operation/compute_pipeline/overrides.spec.ts src/webgpu/api/operation/device/lost.spec.ts src/webgpu/api/operation/memory_sync/operation_context_helper.ts src/webgpu/api/operation/memory_sync/buffer/buffer_sync_test.ts @@ -160,6 +161,7 @@ src/webgpu/api/operation/render_pass/storeop2.spec.ts src/webgpu/api/operation/render_pipeline/alpha_to_coverage.spec.ts src/webgpu/api/operation/render_pipeline/culling_tests.spec.ts +src/webgpu/api/operation/render_pipeline/overrides.spec.ts src/webgpu/util/shader.ts src/webgpu/util/texture/texture_ok.ts src/webgpu/api/operation/render_pipeline/pipeline_output_targets.spec.ts
diff --git a/tools/code_coverage/coverage.py b/tools/code_coverage/coverage.py index 031b72e3..92b1460d 100755 --- a/tools/code_coverage/coverage.py +++ b/tools/code_coverage/coverage.py
@@ -17,7 +17,7 @@ --args="use_clang_coverage=true is_component_build=false\\ is_debug=false dcheck_always_on=true" gclient runhooks - vpython tools/code_coverage/coverage.py crypto_unittests url_unittests \\ + vpython3 tools/code_coverage/coverage.py crypto_unittests url_unittests \\ -b out/coverage -o out/report -c 'out/coverage/crypto_unittests' \\ -c 'out/coverage/url_unittests --gtest_filter=URLParser.PathURL' \\ -f url/ -f crypto/ @@ -32,7 +32,7 @@ * Sample flow for running a test target with xvfb (e.g. unit_tests): - vpython tools/code_coverage/coverage.py unit_tests -b out/coverage \\ + vpython3 tools/code_coverage/coverage.py unit_tests -b out/coverage \\ -o out/report -c 'python testing/xvfb.py out/coverage/unit_tests' If you are building a fuzz target, you need to add "use_libfuzzer=true" GN @@ -40,7 +40,7 @@ * Sample workflow for a fuzz target (e.g. pdfium_fuzzer): - vpython tools/code_coverage/coverage.py pdfium_fuzzer \\ + vpython3 tools/code_coverage/coverage.py pdfium_fuzzer \\ -b out/coverage -o out/report \\ -c 'out/coverage/pdfium_fuzzer -runs=0 <corpus_dir>' \\ -f third_party/pdfium @@ -53,7 +53,7 @@ * Sample workflow for running Blink web tests: - vpython tools/code_coverage/coverage.py blink_tests \\ + vpython3 tools/code_coverage/coverage.py blink_tests \\ -wt -b out/coverage -o out/report -f third_party/blink If you need to pass arguments to run_web_tests.py, use
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index e915403..aeeeb14 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -398,6 +398,7 @@ 'android-code-coverage': 'gpu_tests_android_release_bot_minimal_symbols_arm64_fastbuild_java_coverage_reclient', 'android-code-coverage-native': 'gpu_tests_android_release_bot_no_symbols_arm64_fastbuild_native_coverage_reclient', 'android-fieldtrial-rel': 'android_release_bot_minimal_symbols_x86_fastbuild_webview_monochrome_reclient', + 'android-perfetto-rel': 'perfetto_release_bot_reclient_android', # Keep in sync with android-pie-arm64-rel, but with reclient. 'build-perf-android': 'android_release_trybot_arm64_webview_monochrome_expectations_fastbuild_reclient', # Keep in sync with linux-rel, but with reclient. @@ -473,12 +474,14 @@ 'mac-code-coverage': 'clang_code_coverage', 'mac-fieldtrial-rel': 'mac_arm64_gpu_tests_release_bot_minimal_symbols_no_nacl', 'mac-hermetic-upgrade-rel': 'release_bot', + 'mac-perfetto-rel': 'perfetto_release_bot_reclient', 'mac-upload-perfetto': 'release_bot_perfetto_zlib', 'win-annotator-rel': 'release_bot_reclient', 'win-backuprefptr-x64-fyi-rel': 'release_trybot_backuprefptr_x64_reclient', 'win-backuprefptr-x86-fyi-rel': 'release_trybot_backuprefptr_x86_reclient', 'win-celab-builder-rel': 'release_bot_minimal_symbols_reclient', 'win-fieldtrial-rel': 'release_bot_minimal_symbols_reclient', + 'win-perfetto-rel': 'perfetto_release_bot_reclient', 'win-upload-perfetto': 'release_bot_perfetto_zlib_reclient', 'win10-code-coverage': 'clang_code_coverage_reclient', 'win10-rel-no-external-ip': 'gpu_tests_release_bot_minimal_symbols_reclient', @@ -885,7 +888,6 @@ # release trybots must *not* enable dchecks, because that could # cause them to produce different baselines than the release # waterfall bots, and run_web_tests.py can't handle that (by design). - 'linux-blink-optional-highdpi-rel': 'release_bot_blink_minimal_symbols', 'linux-blink-rel': 'release_bot_blink_minimal_symbols_reclient', 'mac10.13-blink-rel': 'release_bot_blink_minimal_symbols_no_nacl', 'mac10.14-blink-rel': 'release_bot_blink_minimal_symbols_no_nacl', @@ -1002,6 +1004,7 @@ 'android-opus-arm-rel': 'android_release_trybot', 'android-oreo-arm64-cts-networkservice-dbg': 'android_debug_trybot_arm64', 'android-oreo-arm64-dbg': 'android_debug_trybot_arm64', + 'android-perfetto-rel': 'perfetto_release_trybot_android', # TODO(crbug/1182468) Remove android coverage bots after coverage is # running on CQ. 'android-pie-arm64-coverage-experimental-rel': 'android_release_trybot_arm64_webview_monochrome_expectations_native_coverage', @@ -1266,6 +1269,7 @@ 'mac-fieldtrial-rel': 'mac_arm64_gpu_tests_release_bot_minimal_symbols_no_nacl', 'mac-inverse-fieldtrials-fyi-rel': 'gpu_tests_release_trybot_invert_fieldtrials', 'mac-osxbeta-rel': 'gpu_tests_debug_trybot', + 'mac-perfetto-rel': 'perfetto_release_trybot', 'mac-rel': 'gpu_tests_release_trybot_no_symbols_mac_code_coverage', 'mac11-arm64-rel': 'mac_arm64_gpu_tests_release_trybot_no_symbols', 'mac12-arm64-rel': 'mac_arm64_gpu_tests_release_trybot_no_symbols', @@ -1356,6 +1360,7 @@ 'win-celab-try-rel': 'release_bot_minimal_symbols', 'win-fieldtrial-rel': 'release_bot_minimal_symbols', 'win-libfuzzer-asan-rel': 'libfuzzer_windows_asan_release_trybot', + 'win-perfetto-rel': 'perfetto_release_trybot', 'win10_chromium_inverse_fieldtrials_x64_fyi_rel_ng': 'gpu_tests_release_trybot_resource_allowlisting_invert_fieldtrials', 'win10_chromium_x64_dbg_ng': 'gpu_tests_debug_bot', 'win10_chromium_x64_rel_ng': 'gpu_tests_release_trybot_resource_allowlisting_code_coverage', @@ -3373,10 +3378,18 @@ 'perfetto', 'release_bot_reclient', ], + 'perfetto_release_bot_reclient_android': [ + 'perfetto', 'release_bot_reclient', 'android', 'x64' + ], + 'perfetto_release_trybot': [ 'perfetto', 'release_trybot', ], + 'perfetto_release_trybot_android': [ + 'perfetto', 'release_trybot', 'android', 'x64' + ], + 'presubmit': [ # The chromium_presubmit bot does not use mb. 'error', @@ -3402,10 +3415,6 @@ 'release_bot_blink', 'arm64', 'minimal_symbols', ], - 'release_bot_blink_minimal_symbols': [ - 'release_bot_blink', 'minimal_symbols', - ], - 'release_bot_blink_minimal_symbols_no_nacl': [ 'release_bot_blink', 'minimal_symbols',
diff --git a/tools/mb/mb_config_expectations/chromium.fyi.json b/tools/mb/mb_config_expectations/chromium.fyi.json index 1daf46db..531d7500 100644 --- a/tools/mb/mb_config_expectations/chromium.fyi.json +++ b/tools/mb/mb_config_expectations/chromium.fyi.json
@@ -706,6 +706,19 @@ "use_remoteexec": true } }, + "android-perfetto-rel": { + "gn_args": { + "dcheck_always_on": false, + "ffmpeg_branding": "Chrome", + "is_component_build": false, + "is_debug": false, + "proprietary_codecs": true, + "target_cpu": "x64", + "target_os": "android", + "use_perfetto_client_library": true, + "use_remoteexec": true + } + }, "build-perf-android": { "gn_args": { "android_static_analysis": "off", @@ -1553,6 +1566,15 @@ "use_goma": true } }, + "mac-perfetto-rel": { + "gn_args": { + "dcheck_always_on": false, + "is_component_build": false, + "is_debug": false, + "use_perfetto_client_library": true, + "use_remoteexec": true + } + }, "mac-upload-perfetto": { "gn_args": { "dcheck_always_on": false, @@ -1620,6 +1642,15 @@ "use_remoteexec": true } }, + "win-perfetto-rel": { + "gn_args": { + "dcheck_always_on": false, + "is_component_build": false, + "is_debug": false, + "use_perfetto_client_library": true, + "use_remoteexec": true + } + }, "win-upload-perfetto": { "gn_args": { "dcheck_always_on": false,
diff --git a/tools/mb/mb_config_expectations/tryserver.blink.json b/tools/mb/mb_config_expectations/tryserver.blink.json index 87cd385..61b9433 100644 --- a/tools/mb/mb_config_expectations/tryserver.blink.json +++ b/tools/mb/mb_config_expectations/tryserver.blink.json
@@ -1,15 +1,4 @@ { - "linux-blink-optional-highdpi-rel": { - "gn_args": { - "dcheck_always_on": false, - "ffmpeg_branding": "Chrome", - "is_component_build": false, - "is_debug": false, - "proprietary_codecs": true, - "symbol_level": 1, - "use_goma": true - } - }, "linux-blink-rel": { "gn_args": { "dcheck_always_on": false,
diff --git a/tools/mb/mb_config_expectations/tryserver.chromium.android.json b/tools/mb/mb_config_expectations/tryserver.chromium.android.json index 8468d25..8b83bf2 100644 --- a/tools/mb/mb_config_expectations/tryserver.chromium.android.json +++ b/tools/mb/mb_config_expectations/tryserver.chromium.android.json
@@ -701,6 +701,20 @@ "use_goma": true } }, + "android-perfetto-rel": { + "gn_args": { + "dcheck_always_on": true, + "ffmpeg_branding": "Chrome", + "is_component_build": false, + "is_debug": false, + "proprietary_codecs": true, + "symbol_level": 0, + "target_cpu": "x64", + "target_os": "android", + "use_goma": true, + "use_perfetto_client_library": true + } + }, "android-pie-arm64-coverage-experimental-rel": { "gn_args": { "coverage_instrumentation_input_file": "//.code-coverage/files_to_instrument.txt",
diff --git a/tools/mb/mb_config_expectations/tryserver.chromium.mac.json b/tools/mb/mb_config_expectations/tryserver.chromium.mac.json index 734ee8c5..26e6a09 100644 --- a/tools/mb/mb_config_expectations/tryserver.chromium.mac.json +++ b/tools/mb/mb_config_expectations/tryserver.chromium.mac.json
@@ -518,6 +518,16 @@ "use_goma": true } }, + "mac-perfetto-rel": { + "gn_args": { + "dcheck_always_on": true, + "is_component_build": false, + "is_debug": false, + "symbol_level": 0, + "use_goma": true, + "use_perfetto_client_library": true + } + }, "mac-rel": { "gn_args": { "coverage_instrumentation_input_file": "//.code-coverage/files_to_instrument.txt",
diff --git a/tools/mb/mb_config_expectations/tryserver.chromium.win.json b/tools/mb/mb_config_expectations/tryserver.chromium.win.json index acc7ab4..6c17c78 100644 --- a/tools/mb/mb_config_expectations/tryserver.chromium.win.json +++ b/tools/mb/mb_config_expectations/tryserver.chromium.win.json
@@ -164,6 +164,16 @@ "use_libfuzzer": true } }, + "win-perfetto-rel": { + "gn_args": { + "dcheck_always_on": true, + "is_component_build": false, + "is_debug": false, + "symbol_level": 0, + "use_goma": true, + "use_perfetto_client_library": true + } + }, "win10_chromium_inverse_fieldtrials_x64_fyi_rel_ng": { "gn_args": { "dcheck_always_on": true,
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 3940341b..a5b4032 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -28483,6 +28483,11 @@ </description> </action> +<action name="Signin_Impression_FromPostDeviceRestoreSigninPromo"> + <owner>Please list the metric's owners. Add more owner tags as needed.</owner> + <description>Please enter the description of the metric.</description> +</action> + <action name="Signin_Impression_FromRecentTabs" not_user_triggered="true"> <owner>gogerald@chromium.org</owner> <description> @@ -29104,6 +29109,11 @@ </description> </action> +<action name="Signin_Signin_FromPostDeviceRestoreSigninPromo"> + <owner>Please list the metric's owners. Add more owner tags as needed.</owner> + <description>Please enter the description of the metric.</description> +</action> + <action name="Signin_Signin_FromRecentTabs"> <owner>gogerald@chromium.org</owner> <description> @@ -34276,6 +34286,8 @@ <suffix name="GMCCastStartStop" label="For GMCCastStartStop feature."/> <suffix name="GMCCastStartStopFeature" label="For Global Media Controls Cast start and stop feature."/> + <suffix name="HighEfficiencyInfoMode" + label="For HighEfficiencyInfoMode feature."/> <suffix name="HomePageButton" label="For HomePageButton feature."/> <suffix name="HomepageTile" label="For HomepageTile feature."/> <suffix name="IdentityDisc" label="For IdentityDisc feature."/>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index b430f8fc..fad8cee 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -32495,6 +32495,8 @@ <int value="1012" label="LacrosDataBackwardMigrationMode"/> <int value="1013" label="StrictMimetypeCheckForWorkerScriptsEnabled"/> <int value="1014" label="RecoveryFactorBehavior"/> + <int value="1015" label="CalendarIntegrationEnabled"/> + <int value="1016" label="DeviceReportXDREvents"/> </enum> <enum name="EnterprisePoliciesSources"> @@ -58508,8 +58510,6 @@ label="AutofillEnforceDelaysInStrikeDatabase:enabled"/> <int value="-831066457" label="IncognitoBrandConsistencyForDesktop:disabled"/> <int value="-825942229" label="tab-management-experiment-type-elderberry"/> - <int value="-825747847" - label="AutofillEnableSupportForMoreStructureInAddresses:enabled"/> <int value="-825312041" label="CastStreamingAv1:enabled"/> <int value="-824829316" label="UsbDeviceDefaultAttachToArcVm:enabled"/> <int value="-824199802" label="ContextualSearchSimplifiedServer:enabled"/> @@ -58737,8 +58737,6 @@ <int value="-694943768" label="ContextualSearchSuppressShortView:disabled"/> <int value="-694622753" label="VizHitTest:disabled"/> <int value="-694187898" label="MashOopViz:disabled"/> - <int value="-693881124" - label="AutofillEnableSupportForMoreStructureInNames:disabled"/> <int value="-690660906" label="ProductivityLauncherAnimation:disabled"/> <int value="-688003116" label="FocusFollowsCursor:enabled"/> <int value="-687302378" label="BluetoothFixA2dpPacketSize:enabled"/> @@ -61574,8 +61572,6 @@ <int value="1070449228" label="ContextualSuggestionsCarousel:enabled"/> <int value="1070840417" label="ChromeColors:enabled"/> <int value="1071520357" label="WebAuthenticationTouchId:enabled"/> - <int value="1071962531" - label="AutofillEnableSupportForMoreStructureInAddresses:disabled"/> <int value="1072010558" label="NTPModernLayout:disabled"/> <int value="1072517479" label="ImprovedCookieControls:enabled"/> <int value="1073699828" label="ScrollUpdateOptimizations:enabled"/> @@ -62592,8 +62588,6 @@ <int value="1708118086" label="TextFragmentAnchor:disabled"/> <int value="1708689134" label="PWAsDefaultOfflinePage:disabled"/> <int value="1709255374" label="DragAndDropAndroid:enabled"/> - <int value="1710630380" - label="AutofillEnableSupportForMoreStructureInNames:enabled"/> <int value="1710663404" label="CastForceEnableRemotingQuery:disabled"/> <int value="1711037950" label="AutofillVisualImprovementsForSuggestionUi:disabled"/>
diff --git a/tools/metrics/histograms/metadata/chrome/histograms.xml b/tools/metrics/histograms/metadata/chrome/histograms.xml index 7a9b6ef0..64d86a1 100644 --- a/tools/metrics/histograms/metadata/chrome/histograms.xml +++ b/tools/metrics/histograms/metadata/chrome/histograms.xml
@@ -56,7 +56,7 @@ </histogram> <histogram name="Chrome.KAnonymityService.TrustTokenGetter.Action" - enum="KAnonymityServiceJoinSetAction" expires_after="M108"> + enum="KAnonymityTrustTokenGetterAction" expires_after="M108"> <owner>behamilton@google.com</owner> <owner>pauljensen@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/feature_engagement/histograms.xml b/tools/metrics/histograms/metadata/feature_engagement/histograms.xml index 6368be0..5d3a465 100644 --- a/tools/metrics/histograms/metadata/feature_engagement/histograms.xml +++ b/tools/metrics/histograms/metadata/feature_engagement/histograms.xml
@@ -53,6 +53,7 @@ the Autofill dropdown to educate users virtual cards come with better security"/> <variant name="IPH_BadgedReadingList" summary="badged reading list"/> + <variant name="IPH_BatterySaverMode" summary="battery saver mode"/> <variant name="IPH_Bookmark" summary="bookmark"/> <variant name="IPH_BottomToolbarTip" summary="bottom toolbar"/> <variant name="IPH_ChromeDuet" @@ -144,6 +145,7 @@ <variant name="IPH_GlobalMediaControls" summary="the Global Media Controls"/> <variant name="IPH_GMCCastStartStop" summary="Cast start stop in the Zenith dialog"/> + <variant name="IPH_HighEfficiencyInfoMode" summary="High efficiency info"/> <variant name="IPH_IdentityDisc" summary="Identity Disc"/> <variant name="IPH_IncognitoWindow" summary="incognito window"/> <variant name="IPH_InstanceSwitcher" summary="instance switcher"/>
diff --git a/tools/metrics/histograms/metadata/others/histograms.xml b/tools/metrics/histograms/metadata/others/histograms.xml index 9b33ad1..33ffad7 100644 --- a/tools/metrics/histograms/metadata/others/histograms.xml +++ b/tools/metrics/histograms/metadata/others/histograms.xml
@@ -14039,6 +14039,17 @@ </summary> </histogram> +<histogram name="Tracing.Background.UploadingTraceSizeInKB" units="KB" + expires_after="2023-01-15"> + <owner>oksamyt@chromium.org</owner> + <owner>tracing@chromium.org</owner> + <owner>chrometto-team@google.com</owner> + <summary> + The size, in kilobytes, of a trace about to be uploaded. Values can range + from 1KB to 100MB. + </summary> +</histogram> + <histogram name="Tracing.ProducerHostInitializationResult" enum="TracingProducerHostInitializationResult" expires_after="2022-12-09"> <owner>eseckler@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/printing/histograms.xml b/tools/metrics/histograms/metadata/printing/histograms.xml index cd45fb78..9acf0eb 100644 --- a/tools/metrics/histograms/metadata/printing/histograms.xml +++ b/tools/metrics/histograms/metadata/printing/histograms.xml
@@ -23,7 +23,7 @@ <histograms> <histogram name="Printing.ConversionSize.Emf" units="KB" - expires_after="2022-12-04"> + expires_after="2023-09-10"> <owner>thestig@chromium.org</owner> <owner>awscreen@chromium.org</owner> <summary> @@ -33,7 +33,7 @@ </histogram> <histogram name="Printing.ConversionSize.EmfWithReducedRasterization" - units="KB" expires_after="2022-09-30"> + units="KB" expires_after="2023-09-10"> <owner>thestig@chromium.org</owner> <owner>awscreen@chromium.org</owner> <summary> @@ -43,7 +43,7 @@ </histogram> <histogram name="Printing.ConversionSize.PostScript2" units="KB" - expires_after="2022-09-30"> + expires_after="2023-09-10"> <owner>thestig@chromium.org</owner> <owner>awscreen@chromium.org</owner> <summary> @@ -53,7 +53,7 @@ </histogram> <histogram name="Printing.ConversionSize.PostScript3" units="KB" - expires_after="2022-09-30"> + expires_after="2023-09-10"> <owner>thestig@chromium.org</owner> <owner>awscreen@chromium.org</owner> <summary> @@ -63,7 +63,7 @@ </histogram> <histogram name="Printing.ConversionSize.PostScript3WithType42Fonts" units="KB" - expires_after="2022-09-30"> + expires_after="2023-09-10"> <owner>thestig@chromium.org</owner> <owner>awscreen@chromium.org</owner> <summary> @@ -73,7 +73,7 @@ </histogram> <histogram name="Printing.ConversionSize.Pwg" units="KB" - expires_after="2022-09-30"> + expires_after="2023-09-10"> <owner>thestig@chromium.org</owner> <owner>awscreen@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/tab/histograms.xml b/tools/metrics/histograms/metadata/tab/histograms.xml index 96c9c5d2..6402bc8 100644 --- a/tools/metrics/histograms/metadata/tab/histograms.xml +++ b/tools/metrics/histograms/metadata/tab/histograms.xml
@@ -2445,7 +2445,7 @@ </histogram> <histogram name="Tabs.TabSearch.NumWindowsOnOpen" units="windows" - expires_after="2022-10-26"> + expires_after="2023-02-26"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2457,7 +2457,7 @@ </histogram> <histogram name="Tabs.TabSearch.OpenAction" enum="TabSearchOpenActions" - expires_after="2022-10-26"> + expires_after="2023-02-26"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2508,7 +2508,7 @@ </histogram> <histogram name="Tabs.TabSearch.RecentlyClosedSectionToggleStateOnOpen" - enum="TabSearchRecentlyClosedToggleActions" expires_after="2022-10-26"> + enum="TabSearchRecentlyClosedToggleActions" expires_after="2023-02-26"> <owner>romanarora@chromium.org</owner> <owner>robliao@chromium.org</owner> <owner>tluk@chromium.org</owner> @@ -2525,7 +2525,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.IndexOf{Action}In{State}List" - units="tabs" expires_after="2022-10-26"> + units="tabs" expires_after="2023-02-26"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <owner>yuhengh@chromium.org</owner> @@ -2570,7 +2570,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.RecentlyClosed{Item}OpenAction" - enum="TabSearchRecentlyClosedItemOpenAction" expires_after="2022-10-26"> + enum="TabSearchRecentlyClosedItemOpenAction" expires_after="2023-02-26"> <owner>tluk@chromium.org</owner> <owner>chrome-cros@chromium.org</owner> <summary> @@ -2640,7 +2640,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.TabSwitchAction" - enum="TabSearchTabSwitchAction" expires_after="2022-10-26"> + enum="TabSearchTabSwitchAction" expires_after="2023-02-26"> <owner>tluk@chromium.org</owner> <owner>robliao@chromium.org</owner> <summary> @@ -2652,7 +2652,7 @@ </histogram> <histogram name="Tabs.TabSearch.WebUI.TimeTo{Action}In{State}List" units="ms" - expires_after="2022-10-26"> + expires_after="2023-02-26"> <owner>yuhengh@chromium.org</owner> <owner>chrome-cros@chromium.org</owner> <summary>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 8da003b..0c8755d 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,8 +5,8 @@ "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux_arm64/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "win": { - "hash": "6aafceb577fd254ab3a782bbfad4e98d1ea2b1ec", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/2c68f6d5e849083349bace01b0e3141904e98ab0/trace_processor_shell.exe" + "hash": "2c3356ece7c683bd9f5c93edd63a628838d05e97", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/cd3e2b402ea0b790022cf819eb6da4e188b7be93/trace_processor_shell.exe" }, "linux_arm": { "hash": "58893933be305d3bfe0a72ebebcacde2ac3ca893", @@ -22,7 +22,7 @@ }, "linux": { "hash": "5617176ae53c93907d93df0e60445240c701e9ae", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/de4b5d49c14337173ee73a2b091d1bece86fe1c9/trace_processor_shell" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/cd3e2b402ea0b790022cf819eb6da4e188b7be93/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/gl/swap_chain_presenter.cc b/ui/gl/swap_chain_presenter.cc index 4e85703..2b117ea 100644 --- a/ui/gl/swap_chain_presenter.cc +++ b/ui/gl/swap_chain_presenter.cc
@@ -1039,6 +1039,7 @@ swap_chain_size_ = swap_chain_size; if (swap_chain_) { ReleaseSwapChainResources(); + content_.Reset(); } return true; } @@ -1475,7 +1476,6 @@ decode_resource_.Reset(); swap_chain_handle_.Close(); staging_texture_.Reset(); - content_.Reset(); } bool SwapChainPresenter::ReallocateSwapChain(
diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index 8df1636..3fc5374 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn
@@ -217,8 +217,6 @@ "cr_components/chromeos/network/sim_lock_dialogs.d.ts", "cr_components/chromeos/smb_shares/add_smb_share_dialog.d.ts", "cr_components/chromeos/smb_shares/smb_browser_proxy.d.ts", - "cr_components/chromeos/traffic_counters/traffic_counters.d.ts", - "cr_components/chromeos/traffic_counters/traffic_counters_adapter.d.ts", "cr_components/chromeos/quick_unlock/pin_keyboard.d.ts", "cr_components/chromeos/quick_unlock/setup_pin_keyboard.d.ts", "cr_elements/cr_container_shadow_behavior.d.ts",
diff --git a/ui/webui/resources/cr_components/BUILD.gn b/ui/webui/resources/cr_components/BUILD.gn index 62ec46f..1bfc935 100644 --- a/ui/webui/resources/cr_components/BUILD.gn +++ b/ui/webui/resources/cr_components/BUILD.gn
@@ -108,7 +108,6 @@ "chromeos/network_health/network_diagnostics_types.js", "chromeos/quick_unlock/lock_screen_constants.js", "chromeos/smb_shares/smb_browser_proxy.js", - "chromeos/traffic_counters/traffic_counters_adapter.js", ] } @@ -177,7 +176,6 @@ "chromeos/quick_unlock/pin_keyboard.js", "chromeos/quick_unlock/setup_pin_keyboard.js", "chromeos/smb_shares/add_smb_share_dialog.js", - "chromeos/traffic_counters/traffic_counters.js", ] } }
diff --git a/ui/webui/resources/cr_components/chromeos/BUILD.gn b/ui/webui/resources/cr_components/chromeos/BUILD.gn index 45a48aa..d4fa02a 100644 --- a/ui/webui/resources/cr_components/chromeos/BUILD.gn +++ b/ui/webui/resources/cr_components/chromeos/BUILD.gn
@@ -14,7 +14,6 @@ "network_health:closure_compile_module", "quick_unlock:closure_compile_module", "smb_shares:closure_compile_module", - "traffic_counters:closure_compile_module", ] } @@ -26,6 +25,5 @@ "network_health:web_components", "quick_unlock:web_components", "smb_shares:web_components", - "traffic_counters:web_components", ] }
diff --git a/ui/webui/resources/cr_components/chromeos/smb_shares/smb_browser_proxy.html b/ui/webui/resources/cr_components/chromeos/smb_shares/smb_browser_proxy.html deleted file mode 100644 index e904e891..0000000 --- a/ui/webui/resources/cr_components/chromeos/smb_shares/smb_browser_proxy.html +++ /dev/null
@@ -1,2 +0,0 @@ -<link rel="import" href="../../../html/cr.html"> -<script src="smb_browser_proxy.js"> </script>