diff --git a/DEPS b/DEPS index 2caac66..54627d63 100644 --- a/DEPS +++ b/DEPS
@@ -245,11 +245,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '896d278a5c97bbf6409640f0944b996159a2d153', + 'skia_revision': '98c09e51f33e978a0d2860b70dd82b8c97aa4ca5', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '4e822ed7404569f3e018b87ad6150cd82f8e760c', + 'v8_revision': 'c4208cca4b053300b7ae3d297790c7dcd0be551a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. @@ -288,7 +288,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling NaCl # and whatever else without interference from each other. - 'nacl_revision': '38e06bc9954cbe8582f557d525d2effbbc0d849e', + 'nacl_revision': '96f4b7e974d6fc13ec74926d1576b107b4c109af', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. @@ -312,7 +312,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': 'f92a0a2305661375284684a9dc1f80720905faf2', + 'catapult_revision': '8bc3659ded63d583750adfe835da1cf0612c79ca', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -320,7 +320,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': '30df387ba8415d6f1670f49a86032b3f3baba239', + 'devtools_frontend_revision': '34598f6ba9afbd140800b3ce465c53449c07c93b', # 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. @@ -1024,7 +1024,7 @@ # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '1f7096347c6a1fd0da859387f476218a03215682', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '62cacb3f3ceeda8696a1618bc231ca5c0b07639a', 'condition': 'checkout_chromeos', }, @@ -1648,7 +1648,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'fc207904abbb29864991c71c7156336455a3d892', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '4f8a58c3d2e1fa5fcf7dc7f07bd89ad428fb09f0', + Var('webrtc_git') + '/src.git' + '@' + '1ca57b9015517627f7d08ea8cfb82db30d2f8193', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1718,7 +1718,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@0c5efb6296a081fd6395bb5517b30ccf8784ef1f', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@83b507fd68910f94bd218ac0e4a6f0f048c8e8dc', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/docs/channels.md b/android_webview/docs/channels.md index 3e5baa6a..949359a8 100644 --- a/android_webview/docs/channels.md +++ b/android_webview/docs/channels.md
@@ -28,7 +28,7 @@ APK with the highest `versionCode` among eligible tracks. Google publishes an APK of Android System WebView to the beta track based on the -[same release cycle](https://chromiumdash.appspot.com/schedule) as Chrome Beta. +[same release cycle](https://chromiumdash.appspot.com/schedule) as Chrome Beta. Similarly, builds of Chrome for "Dev" channel releases include a build of WebView which gets published to an alpha track. Only users belonging to specific
diff --git a/android_webview/docs/web-platform-compatibility.md b/android_webview/docs/web-platform-compatibility.md index 82cd1182..fb86c541 100644 --- a/android_webview/docs/web-platform-compatibility.md +++ b/android_webview/docs/web-platform-compatibility.md
@@ -225,7 +225,7 @@ * WebView doesn't render any UI elements outside of the content viewport. The embedding app is responsible for any UI that may be needed to implement - WebView callbacks. + WebView callbacks. * Callback APIs exist to trigger permission prompts (though apps may not implement them), but there's no current API to render infobars, control how
diff --git a/android_webview/nonembedded/java/res_devui/layout/fragment_components_list.xml b/android_webview/nonembedded/java/res_devui/layout/fragment_components_list.xml index b279e35..2a01c9e 100644 --- a/android_webview/nonembedded/java/res_devui/layout/fragment_components_list.xml +++ b/android_webview/nonembedded/java/res_devui/layout/fragment_components_list.xml
@@ -55,4 +55,3 @@ android:childDivider="#00000000"/> </LinearLayout> - \ No newline at end of file
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index b48029e0..1fe3540d 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -245,6 +245,10 @@ const base::Feature kCameraPrivacySwitchNotifications{ "CameraPrivacySwitchNotifications", base::FEATURE_ENABLED_BY_DEFAULT}; +// Controls whether the selfie camera feature is enabled for Capture Mode. +const base::Feature kCaptureModeSelfieCamera{"CaptureModeSelfieCamera", + base::FEATURE_DISABLED_BY_DEFAULT}; + // If enabled, allow eSIM installation bypass the non-cellular internet // connectivity check. const base::Feature kCellularBypassESimInstallationConnectivityCheck{ @@ -1076,7 +1080,7 @@ // Enables redirect to default IdP without interstitial step. const base::Feature kRedirectToDefaultIdP{"RedirectToDefaultIdP", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Enables suppression of Displays notifications other than resolution change. const base::Feature kReduceDisplayNotifications{ @@ -1438,6 +1442,10 @@ return base::FeatureList::IsEnabled(kCalendarView); } +bool IsCaptureModeSelfieCameraEnabled() { + return base::FeatureList::IsEnabled(kCaptureModeSelfieCamera); +} + bool IsClipboardHistoryContextMenuNudgeEnabled() { return base::FeatureList::IsEnabled(kClipboardHistoryContextMenuNudge); }
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index 9c4e9159..899f556 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h
@@ -105,6 +105,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kCameraPrivacySwitchNotifications; COMPONENT_EXPORT(ASH_CONSTANTS) +extern const base::Feature kCaptureModeSelfieCamera; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kCellularBypassESimInstallationConnectivityCheck; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kCellularForbidAttachApn; @@ -530,6 +532,7 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsBentoBarEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsBluetoothRevampEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsCalendarViewEnabled(); +COMPONENT_EXPORT(ASH_CONSTANTS) bool IsCaptureModeSelfieCameraEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsLauncherItemColorSyncEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsClipboardHistoryContextMenuNudgeEnabled();
diff --git a/ash/constants/ash_switches.cc b/ash/constants/ash_switches.cc index 37a2470..e68277d 100644 --- a/ash/constants/ash_switches.cc +++ b/ash/constants/ash_switches.cc
@@ -383,6 +383,10 @@ // Enables ARCVM realtime VCPU feature. const char kEnableArcVmRtVcpu[] = "enable-arcvm-rt-vcpu"; +// Enables testing the selfie camera feature of Capture Mode using fake cameras. +// Used only in tests and the emulator. +const char kEnableCaptureModeFakeCameras[] = "enable-capture-mode-fake-cameras"; + // Enables the Cast Receiver. const char kEnableCastReceiver[] = "enable-cast-receiver"; @@ -843,6 +847,11 @@ return base::CommandLine::ForCurrentProcess()->HasSwitch(kCellularFirst); } +bool AreCaptureModeFakeCamerasEnabled() { + return base::CommandLine::ForCurrentProcess()->HasSwitch( + kEnableCaptureModeFakeCameras); +} + bool IsRevenBranding() { return base::CommandLine::ForCurrentProcess()->HasSwitch(kRevenBranding); }
diff --git a/ash/constants/ash_switches.h b/ash/constants/ash_switches.h index 66cd7690..ef73f246 100644 --- a/ash/constants/ash_switches.h +++ b/ash/constants/ash_switches.h
@@ -125,6 +125,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kEnableArc[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kEnableArcVm[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kEnableArcVmRtVcpu[]; +COMPONENT_EXPORT(ASH_CONSTANTS) +extern const char kEnableCaptureModeFakeCameras[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kEnableCastReceiver[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kEnableConsumerKiosk[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kEnableDimShelf[]; @@ -276,6 +278,10 @@ // Returns true if this is a Cellular First device. COMPONENT_EXPORT(ASH_CONSTANTS) bool IsCellularFirstDevice(); +// Returns true if testing the selfie camera feature of Capture Mode is enabled +// using fake camera devices. +COMPONENT_EXPORT(ASH_CONSTANTS) bool AreCaptureModeFakeCamerasEnabled(); + // Returns true if this is reven board. COMPONENT_EXPORT(ASH_CONSTANTS) bool IsRevenBranding();
diff --git a/ash/login/ui/lock_contents_view.h b/ash/login/ui/lock_contents_view.h index 9bfd0df..c922a491 100644 --- a/ash/login/ui/lock_contents_view.h +++ b/ash/login/ui/lock_contents_view.h
@@ -500,7 +500,7 @@ LoginErrorBubble* warning_banner_bubble_; // View that is shown on login timeout with camera usage. - base::raw_ptr<LoginCameraTimeoutView> login_camera_timeout_view_; + base::raw_ptr<LoginCameraTimeoutView> login_camera_timeout_view_ = nullptr; // Bottom status indicator displaying entreprise domain or ADB enabled alert BottomStatusIndicator* bottom_status_indicator_;
diff --git a/ash/projector/projector_controller_impl.cc b/ash/projector/projector_controller_impl.cc index 556c977..69c96bc 100644 --- a/ash/projector/projector_controller_impl.cc +++ b/ash/projector/projector_controller_impl.cc
@@ -29,7 +29,7 @@ // String format of the screencast name. constexpr char kScreencastPathFmtStr[] = - "Screencast %d-%02d-%02d %02d.%02d.%02d"; + "Recording %d-%02d-%02d %02d.%02d.%02d"; // Create directory. Returns true if saving succeeded, or false otherwise. bool CreateDirectory(const base::FilePath& path) {
diff --git a/ash/projector/projector_controller_unittest.cc b/ash/projector/projector_controller_unittest.cc index 52939f5..cfd9798 100644 --- a/ash/projector/projector_controller_unittest.cc +++ b/ash/projector/projector_controller_unittest.cc
@@ -296,7 +296,7 @@ // Verify that |SaveMetadata| in |ProjectorMetadataController| is called // with the expected path. const std::string expected_screencast_name = - "Screencast 2021-01-02 20.02.10"; + "Recording 2021-01-02 20.02.10"; const base::FilePath expected_path = screencast_container_path.Append("root") .Append("projector_data")
diff --git a/ash/webui/os_feedback_ui/resources/BUILD.gn b/ash/webui/os_feedback_ui/resources/BUILD.gn index 16587b5..c959b33 100644 --- a/ash/webui/os_feedback_ui/resources/BUILD.gn +++ b/ash/webui/os_feedback_ui/resources/BUILD.gn
@@ -26,7 +26,9 @@ "app_icon_48.png", "app_icon_192.png", "app_icon_256.png", + "feedback_types.js", "index.html", + "mojo_interface_provider.js", ] input_files_base_dir = rebase_path(".", "//") deps = [ ":preprocess_generated" ] @@ -40,21 +42,19 @@ closure_flags = default_closure_args deps = [ ":confirmation_page", + ":feedback_types", + ":mojo_interface_provider", ":search_page", ] } -js_library("search_page") { - deps = [ - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - ] -} - js_library("confirmation_page") { deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", ] } +js_library("feedback_types") { +} js_library("help_resources_icons") { deps = [ @@ -62,6 +62,16 @@ ] } +js_library("mojo_interface_provider") { + deps = [ "//ui/webui/resources/js:cr.m" ] +} + +js_library("search_page") { + deps = [ + "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + ] +} + preprocess_if_expr("preprocess_generated") { deps = [ ":web_components" ] in_folder = target_gen_dir
diff --git a/ash/webui/os_feedback_ui/resources/feedback_types.js b/ash/webui/os_feedback_ui/resources/feedback_types.js new file mode 100644 index 0000000..6e9d3e5 --- /dev/null +++ b/ash/webui/os_feedback_ui/resources/feedback_types.js
@@ -0,0 +1,18 @@ +// 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. + +/** + * @fileoverview + * Type aliases for the mojo API. + * + * TODO(xiangdongkong): When the fake API is replaced by mojo these can be + * re-aliased to the corresponding mojo types, or replaced by them. + */ + +/** + * Type alias for the HelpContentProviderInterface. + * TODO(xiangdongkong): Replace with a real mojo type when implemented. + * @typedef {!Object} + */ +export let HelpContentProviderInterface;
diff --git a/ash/webui/os_feedback_ui/resources/mojo_interface_provider.js b/ash/webui/os_feedback_ui/resources/mojo_interface_provider.js new file mode 100644 index 0000000..c57f900 --- /dev/null +++ b/ash/webui/os_feedback_ui/resources/mojo_interface_provider.js
@@ -0,0 +1,33 @@ +// 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. + +import {assert} from 'chrome://resources/js/assert.m.js'; +import {HelpContentProviderInterface} from './feedback_types.js'; + +/** + * @fileoverview + * Provides singleton access to mojo interfaces with the ability + * to override them with test/fake implementations. + */ + +/** + * @type {?HelpContentProviderInterface} + */ +let helpContentProvider = null; + +/** + * @param {!HelpContentProviderInterface} testProvider + */ +export function setHelpContentProviderForTesting(testProvider) { + helpContentProvider = testProvider; +} + +/** + * @return {!HelpContentProviderInterface} + */ +export function getHelpContentProvider() { + // TODO(xiangdongkong): Instantiate a real mojo interface here. + assert(!!helpContentProvider); + return helpContentProvider; +}
diff --git a/ash/wm/desks/templates/desks_templates_test_util.cc b/ash/wm/desks/templates/desks_templates_test_util.cc index 7eae5e9..bb46796 100644 --- a/ash/wm/desks/templates/desks_templates_test_util.cc +++ b/ash/wm/desks/templates/desks_templates_test_util.cc
@@ -5,17 +5,13 @@ #include "ash/wm/desks/templates/desks_templates_test_util.h" #include "ash/shell.h" -#include "ash/style/close_button.h" #include "ash/wm/desks/desks_bar_view.h" #include "ash/wm/desks/expanded_desks_bar_button.h" -#include "ash/wm/desks/templates/desks_templates_dialog_controller.h" #include "ash/wm/desks/templates/desks_templates_item_view.h" #include "ash/wm/desks/templates/desks_templates_presenter.h" #include "ash/wm/desks/zero_state_button.h" #include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_test_util.h" -#include "ui/views/widget/widget_delegate.h" -#include "ui/views/window/dialog_delegate.h" namespace ash { @@ -145,21 +141,6 @@ return item ? static_cast<views::Button*>(item) : nullptr; } -views::Button* GetTemplateItemDeleteButton(int index) { - auto* item = GetItemViewFromTemplatesGrid(index); - return item ? static_cast<views::Button*>(const_cast<CloseButton*>( - DesksTemplatesItemViewTestApi(item).delete_button())) - : nullptr; -} - -views::Button* GetDesksTemplatesDialogAcceptButton() { - const views::Widget* dialog_widget = - DesksTemplatesDialogController::Get()->dialog_widget(); - if (!dialog_widget) - return nullptr; - return dialog_widget->widget_delegate()->AsDialogDelegate()->GetOkButton(); -} - void WaitForDesksTemplatesUI() { auto* overview_session = GetOverviewSession(); DCHECK(overview_session);
diff --git a/ash/wm/desks/templates/desks_templates_test_util.h b/ash/wm/desks/templates/desks_templates_test_util.h index bbb4fc3..8e95b8c 100644 --- a/ash/wm/desks/templates/desks_templates_test_util.h +++ b/ash/wm/desks/templates/desks_templates_test_util.h
@@ -152,8 +152,6 @@ views::Button* GetExpandedStateDesksTemplatesButton(); views::Button* GetSaveDeskAsTemplateButton(); views::Button* GetTemplateItemButton(int index); -views::Button* GetTemplateItemDeleteButton(int index); -views::Button* GetDesksTemplatesDialogAcceptButton(); // A lot of the UI relies on calling into the local desk data manager to // update, which sends callbacks via posting tasks. Call
diff --git a/base/allocator/partition_alloc_support.cc b/base/allocator/partition_alloc_support.cc index d17c557..f65558d 100644 --- a/base/allocator/partition_alloc_support.cc +++ b/base/allocator/partition_alloc_support.cc
@@ -21,6 +21,7 @@ #include "base/feature_list.h" #include "base/ignore_result.h" #include "base/metrics/histogram_functions.h" +#include "base/metrics/histogram_macros.h" #include "base/no_destructor.h" #include "base/threading/platform_thread.h" #include "base/threading/thread_task_runner_handle.h" @@ -151,7 +152,13 @@ scoped_refptr<SequencedTaskRunner> task_runner) { TRACE_EVENT0("base", "PartitionAllocMemoryReclaimer::Reclaim()"); auto* instance = PartitionAllocMemoryReclaimer::Instance(); - instance->ReclaimNormal(); + + { + // Micros, since memory reclaiming should typically take at most a few ms. + SCOPED_UMA_HISTOGRAM_TIMER_MICROS("Memory.PartitionAlloc.MemoryReclaim"); + instance->ReclaimNormal(); + } + TimeDelta delay = Microseconds(instance->GetRecommendedReclaimIntervalInMicroseconds()); task_runner->PostDelayedTask(
diff --git a/base/allocator/partition_allocator/partition_address_space.cc b/base/allocator/partition_allocator/partition_address_space.cc index 5a97519..526ed47 100644 --- a/base/allocator/partition_allocator/partition_address_space.cc +++ b/base/allocator/partition_allocator/partition_address_space.cc
@@ -5,6 +5,7 @@ #include "base/allocator/partition_allocator/partition_address_space.h" #include <array> +#include <cstdint> #include <ostream> #include "base/allocator/partition_allocator/address_pool_manager.h" @@ -123,21 +124,21 @@ #endif // PA_STARSCAN_USE_CARD_TABLE } -// TODO(bartekn): Consider void* -> uintptr_t -void PartitionAddressSpace::InitConfigurablePool(void* address, size_t size) { +void PartitionAddressSpace::InitConfigurablePool(uintptr_t pool_base, + size_t size) { // The ConfigurablePool must only be initialized once. PA_CHECK(!IsConfigurablePoolInitialized()); // The other Pools must be initialized first. Init(); - PA_CHECK(address); + PA_CHECK(pool_base); PA_CHECK(size <= kConfigurablePoolMaxSize); PA_CHECK(size >= kConfigurablePoolMinSize); PA_CHECK(bits::IsPowerOfTwo(size)); - PA_CHECK(reinterpret_cast<uintptr_t>(address) % size == 0); + PA_CHECK(pool_base % size == 0); - setup_.configurable_pool_base_address_ = reinterpret_cast<uintptr_t>(address); + setup_.configurable_pool_base_address_ = pool_base; setup_.configurable_pool_base_mask_ = ~(size - 1); setup_.configurable_pool_ = internal::AddressPoolManager::GetInstance()->Add(
diff --git a/base/allocator/partition_allocator/partition_address_space.h b/base/allocator/partition_allocator/partition_address_space.h index 0c7e8a2..72771fb 100644 --- a/base/allocator/partition_allocator/partition_address_space.h +++ b/base/allocator/partition_allocator/partition_address_space.h
@@ -89,11 +89,11 @@ // Initialize the GigaCage and the Pools inside of it. // This function must only be called from the main thread. static void Init(); - // Initialize the ConfigurablePool at the given address. The address must be - // aligned to the size of the pool. The size must be a power of two and must - // be within [ConfigurablePoolMinSize(), ConfigurablePoolMaxSize()]. This + // Initialize the ConfigurablePool at the given address |pool_base|. It must + // be aligned to the size of the pool. The size must be a power of two and + // must be within [ConfigurablePoolMinSize(), ConfigurablePoolMaxSize()]. This // function must only be called from the main thread. - static void InitConfigurablePool(void* address, size_t size); + static void InitConfigurablePool(uintptr_t pool_base, size_t size); static void UninitForTesting(); static void UninitConfigurablePoolForTesting();
diff --git a/base/allocator/partition_allocator/partition_alloc_unittest.cc b/base/allocator/partition_allocator/partition_alloc_unittest.cc index 92a8f0e..3a4a4ac 100644 --- a/base/allocator/partition_allocator/partition_alloc_unittest.cc +++ b/base/allocator/partition_allocator/partition_alloc_unittest.cc
@@ -3754,7 +3754,8 @@ void* pool_memory = AllocPages(nullptr, pool_size, pool_size, PageInaccessible, PageTag::kPartitionAlloc); EXPECT_NE(nullptr, pool_memory); - PartitionAddressSpace::InitConfigurablePool(pool_memory, pool_size); + uintptr_t pool_base = reinterpret_cast<uintptr_t>(pool_memory); + PartitionAddressSpace::InitConfigurablePool(pool_base, pool_size); EXPECT_TRUE(IsConfigurablePoolAvailable()); @@ -3770,7 +3771,6 @@ const size_t count = 250; std::vector<void*> allocations(count, nullptr); - uintptr_t pool_base = reinterpret_cast<uintptr_t>(pool_memory); for (size_t i = 0; i < count; ++i) { const size_t size = kTestSizes[base::RandGenerator(kTestSizesCount)]; allocations[i] = root->Alloc(size, nullptr);
diff --git a/base/containers/id_map.h b/base/containers/id_map.h index a0f9b02..b782a388 100644 --- a/base/containers/id_map.h +++ b/base/containers/id_map.h
@@ -8,12 +8,13 @@ #include <stddef.h> #include <stdint.h> -#include <memory> -#include <set> +#include <iterator> +#include <ostream> #include <type_traits> #include <unordered_map> #include <utility> +#include "base/check.h" #include "base/check_op.h" #include "base/containers/flat_set.h" #include "base/memory/raw_ptr.h"
diff --git a/base/pickle.cc b/base/pickle.cc index 44c6bd82c..e7334714 100644 --- a/base/pickle.cc +++ b/base/pickle.cc
@@ -4,9 +4,8 @@ #include "base/pickle.h" -#include <stdlib.h> - #include <algorithm> // for max() +#include <cstdlib> #include <limits> #include "base/bits.h" @@ -24,8 +23,7 @@ PickleIterator::PickleIterator(const Pickle& pickle) : payload_(pickle.payload()), read_index_(0), - end_index_(pickle.payload_size()) { -} + end_index_(pickle.payload_size()) {} template <typename Type> inline bool PickleIterator::ReadBuiltinType(Type* result) { @@ -48,7 +46,7 @@ } } -template<typename Type> +template <typename Type> inline const char* PickleIterator::GetReadPointerAndAdvance() { if (sizeof(Type) > end_index_ - read_index_) { read_index_ = end_index_; @@ -269,8 +267,10 @@ header_size_(other.header_size_), capacity_after_header_(0), write_offset_(other.write_offset_) { - Resize(other.header_->payload_size); - memcpy(header_, other.header_, header_size_ + other.header_->payload_size); + if (other.header_) { + Resize(other.header_->payload_size); + memcpy(header_, other.header_, header_size_ + other.header_->payload_size); + } } Pickle::~Pickle() { @@ -291,10 +291,12 @@ header_ = nullptr; header_size_ = other.header_size_; } - Resize(other.header_->payload_size); - memcpy(header_, other.header_, - other.header_size_ + other.header_->payload_size); - write_offset_ = other.write_offset_; + if (other.header_) { + Resize(other.header_->payload_size); + memcpy(header_, other.header_, + other.header_size_ + other.header_->payload_size); + write_offset_ = other.write_offset_; + } return *this; } @@ -401,7 +403,8 @@ return true; } -template <size_t length> void Pickle::WriteBytesStatic(const void* data) { +template <size_t length> +void Pickle::WriteBytesStatic(const void* data) { WriteBytesCommon(data, length); }
diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc index 27a941a..796b8e1 100644 --- a/base/pickle_unittest.cc +++ b/base/pickle_unittest.cc
@@ -186,6 +186,47 @@ EXPECT_FALSE(iter.ReadInt(&data)); } +// Tests that instances constructed with invalid parameter combinations can be +// properly copied. Regression test for https://crbug.com/1271311. +TEST(PickleTest, CopyWithInvalidHeader) { + // 1. Actual header size (calculated based on the input buffer) > passed in + // buffer size. Which results in Pickle's internal |header_| = null. + { + Pickle::Header header = {.payload_size = 100}; + const char* data = reinterpret_cast<char*>(&header); + const Pickle pickle(data, sizeof(header)); + + EXPECT_EQ(0U, pickle.size()); + EXPECT_FALSE(pickle.data()); + + Pickle copy_built_with_op = pickle; + EXPECT_EQ(0U, copy_built_with_op.size()); + EXPECT_FALSE(copy_built_with_op.data()); + + Pickle copy_built_with_ctor(pickle); + EXPECT_EQ(0U, copy_built_with_ctor.size()); + EXPECT_FALSE(copy_built_with_ctor.data()); + } + // 2. Input buffer's size < sizeof(Pickle::Header). Which must also result in + // Pickle's internal |header_| = null. + { + const char data[2] = {0x00, 0x00}; + const Pickle pickle(data, sizeof(data)); + static_assert(sizeof(Pickle::Header) > sizeof(data)); + + EXPECT_EQ(0U, pickle.size()); + EXPECT_FALSE(pickle.data()); + + Pickle copy_built_with_op = pickle; + EXPECT_EQ(0U, copy_built_with_op.size()); + EXPECT_FALSE(copy_built_with_op.data()); + + Pickle copy_built_with_ctor(pickle); + EXPECT_EQ(0U, copy_built_with_ctor.size()); + EXPECT_FALSE(copy_built_with_ctor.data()); + } +} + TEST(PickleTest, UnalignedSize) { int buffer[] = { 10, 25, 40, 50 };
diff --git a/base/rs_glue/mod.rs b/base/rs_glue/mod.rs index 1c729ac..10c32fb 100644 --- a/base/rs_glue/mod.rs +++ b/base/rs_glue/mod.rs
@@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// At present, none of this is used except in our Rust unit tests. Absolutely -// all of this is therefore #[cfg(test)] to avoid 'unused' warnings. - /// C++ bindings for base. /// /// This mod contains all the FFI bindings for C++ types in the base
diff --git a/base/threading/scoped_blocking_call_unittest.cc b/base/threading/scoped_blocking_call_unittest.cc index c3f59fa..35537f8 100644 --- a/base/threading/scoped_blocking_call_unittest.cc +++ b/base/threading/scoped_blocking_call_unittest.cc
@@ -196,7 +196,7 @@ internal::SetBlockingObserverForCurrentThread(&main_thread_observer); } - void TearDown() override { + void StopMonitoring() { // Reclaim worker threads before CancelMonitoringForTesting() to avoid a // data race (crbug.com/1071166#c16). task_environment_.reset(); @@ -204,6 +204,11 @@ internal::ClearBlockingObserverForCurrentThread(); } + void TearDown() override { + if (task_environment_) + StopMonitoring(); + } + protected: // A member initialized before |task_environment_| that forces worker threads // to be started synchronously. This avoids a tricky race where Linux invokes @@ -938,7 +943,7 @@ task_environment_->RunUntilIdle(); // Force a report immediately. - internal::IOJankMonitoringWindow::CancelMonitoringForTesting(); + StopMonitoring(); // Test covered 2 monitoring windows. ASSERT_EQ(reports_.size(), 2U);
diff --git a/build/android/pylib/gtest/filter/unit_tests_disabled b/build/android/pylib/gtest/filter/unit_tests_disabled index 97811c8..3e08033 100644 --- a/build/android/pylib/gtest/filter/unit_tests_disabled +++ b/build/android/pylib/gtest/filter/unit_tests_disabled
@@ -47,7 +47,6 @@ SQLiteServerBoundCertStoreTest.TestUpgradeV1 SQLiteServerBoundCertStoreTest.TestUpgradeV2 -ProfileSyncComponentsFactoryImplTest.* PermissionsTest.GetWarningMessages_Plugins ImageOperations.ResizeShouldAverageColors
diff --git a/build/config/dcheck_always_on.gni b/build/config/dcheck_always_on.gni index 0e8443f..9e7e943e 100644 --- a/build/config/dcheck_always_on.gni +++ b/build/config/dcheck_always_on.gni
@@ -9,7 +9,7 @@ import("//build_overrides/build.gni") declare_args() { # Enables DCHECKs to be built-in, but to default to being non-fatal/log-only. - # DCHECKS can then be set as fatal/non-fatal via the DCheckIsFatal feature. + # DCHECKS can then be set as fatal/non-fatal via the "DcheckIsFatal" feature. # See https://bit.ly/dcheck-albatross for details on how this is used. dcheck_is_configurable = false }
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 36e71c57..c9b7a00e 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -7.20220119.0.1 +7.20220119.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 36e71c57..c9b7a00e 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -7.20220119.0.1 +7.20220119.1.1
diff --git a/build/lacros/test_runner.py b/build/lacros/test_runner.py index 5719239..7e8c1cb 100755 --- a/build/lacros/test_runner.py +++ b/build/lacros/test_runner.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env vpython3 +#!/usr/bin/env python3 # # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be
diff --git a/chrome/VERSION b/chrome/VERSION index dbb1cc9..0b4fa58 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=99 MINOR=0 -BUILD=4840 +BUILD=4841 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/findinpage/FindToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/findinpage/FindToolbarPhone.java index b83e785..eb8c3c0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/findinpage/FindToolbarPhone.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/findinpage/FindToolbarPhone.java
@@ -44,23 +44,19 @@ @Override protected void updateVisualsForTabModel(boolean isIncognito) { + setBackgroundColor(ChromeColors.getDefaultThemeColor(getContext(), isIncognito)); + final ColorStateList color = ChromeColors.getPrimaryIconTint(getContext(), isIncognito); + ApiCompatibilityUtils.setImageTintList(mFindNextButton, color); + ApiCompatibilityUtils.setImageTintList(mFindPrevButton, color); + ApiCompatibilityUtils.setImageTintList(mCloseFindButton, color); + int queryTextColorId; int queryHintTextColorId; if (isIncognito) { - setBackgroundColor(ChromeColors.getDefaultThemeColor(getContext(), true)); - ColorStateList white = ChromeColors.getPrimaryIconTint(getContext(), true); - ApiCompatibilityUtils.setImageTintList(mFindNextButton, white); - ApiCompatibilityUtils.setImageTintList(mFindPrevButton, white); - ApiCompatibilityUtils.setImageTintList(mCloseFindButton, white); queryTextColorId = R.color.find_in_page_query_white_color; queryHintTextColorId = R.color.find_in_page_query_incognito_hint_color; mDivider.setBackgroundResource(R.color.white_alpha_12); } else { - setBackgroundColor(ChromeColors.getDefaultThemeColor(getContext(), false)); - ColorStateList dark = ChromeColors.getPrimaryIconTint(getContext(), false); - ApiCompatibilityUtils.setImageTintList(mFindNextButton, dark); - ApiCompatibilityUtils.setImageTintList(mFindPrevButton, dark); - ApiCompatibilityUtils.setImageTintList(mCloseFindButton, dark); queryTextColorId = R.color.default_text_color_list; queryHintTextColorId = R.color.find_in_page_query_default_hint_color; mDivider.setBackgroundColor(SemanticColorUtils.getDividerLineBgColor(getContext()));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/search/SearchBoxMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/search/SearchBoxMediator.java index 0af89f3..1356267 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/search/SearchBoxMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/search/SearchBoxMediator.java
@@ -11,7 +11,6 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; -import androidx.annotation.ColorInt; import androidx.core.graphics.drawable.RoundedBitmapDrawable; import org.chromium.chrome.browser.gsa.GSAState; @@ -27,7 +26,7 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; -import org.chromium.components.browser_ui.styles.ChromeColors; +import org.chromium.chrome.browser.ui.theme.BrandedColorScheme; import org.chromium.components.externalauth.ExternalAuthUtils; import org.chromium.components.signin.AccountManagerFacadeProvider; import org.chromium.ui.base.ViewUtils; @@ -103,10 +102,8 @@ Drawable drawable = mAssistantVoiceSearchService.getCurrentMicDrawable(); mModel.set(SearchBoxProperties.VOICE_SEARCH_DRAWABLE, drawable); - final @ColorInt int primaryColor = - ChromeColors.getDefaultThemeColor(mContext, false /* forceDarkBgColor= */); - ColorStateList colorStateList = - mAssistantVoiceSearchService.getButtonColorStateList(primaryColor, mContext); + ColorStateList colorStateList = mAssistantVoiceSearchService.getButtonColorStateList( + BrandedColorScheme.APP_DEFAULT, mContext); mModel.set(SearchBoxProperties.VOICE_SEARCH_COLOR_STATE_LIST, colorStateList); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java index 13d195a..dd01f3d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java
@@ -1828,6 +1828,7 @@ } private void updateBookmarkButtonStatus() { + if (mBookmarkBridgeSupplier == null) return; Tab currentTab = mLocationBarModel.getTab(); BookmarkBridge bridge = mBookmarkBridgeSupplier.get(); boolean isBookmarked =
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index a84ad51..602f70d 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -206,15 +206,15 @@ #include "ui/native_theme/native_theme_features.h" #include "ui/ui_features.h" -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #include "base/allocator/buildflags.h" #endif -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) #include "chromeos/constants/chromeos_features.h" #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) #include "chrome/browser/android/explore_sites/explore_sites_feature.h" #include "chrome/browser/flags/android/chrome_feature_list.h" #include "chrome/browser/notifications/chime/android/features.h" @@ -224,10 +224,10 @@ #include "components/external_intents/android/external_intents_features.h" #include "components/power_scheduler/power_scheduler_features.h" #include "components/webapps/browser/android/features.h" -#else // OS_ANDROID +#else // BUILDFLAG(IS_ANDROID) #include "chrome/browser/media/router/media_router_feature.h" #include "chrome/browser/web_applications/preinstalled_app_install_features.h" -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/components/arc/arc_features.h" @@ -252,15 +252,15 @@ #include "chrome/common/webui_url_constants.h" #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/cocoa/screentime/screentime_features.h" -#endif // OS_MAC +#endif // BUILDFLAG(IS_MAC) #if BUILDFLAG(ENABLE_EXTENSIONS) #include "extensions/common/extension_features.h" #include "extensions/common/switches.h" -#endif // ENABLE_EXTENSIONS +#endif // BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_PDF) #include "pdf/pdf_features.h" @@ -274,16 +274,16 @@ #include "chrome/browser/supervised_user/supervised_user_features/supervised_user_features.h" #endif // ENABLE_SUPERVISED_USERS -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) #include "ui/ozone/buildflags.h" #include "ui/ozone/public/ozone_switches.h" -#endif // OS_LINUX || BUILDFLAG(IS_CHROMEOS_ASH) +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "base/win/windows_version.h" #include "chrome/browser/win/titlebar_config.h" #include "ui/color/color_switches.h" // nogncheck -#endif // OS_WIN +#endif #if defined(TOOLKIT_VIEWS) #include "ui/views/views_features.h" @@ -341,7 +341,7 @@ {flag_descriptions::kTouchSelectionStrategyDirection, blink::switches::kTouchTextSelectionStrategy, "direction"}}; -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) const FeatureEntry::Choice kUseAngleChoicesWindows[] = { {flag_descriptions::kUseAngleDefault, "", ""}, {flag_descriptions::kUseAngleGL, switches::kUseANGLE, @@ -352,7 +352,7 @@ gl::kANGLEImplementationD3D9Name}, {flag_descriptions::kUseAngleD3D11on12, switches::kUseANGLE, gl::kANGLEImplementationD3D11on12Name}}; -#elif defined(OS_MAC) +#elif BUILDFLAG(IS_MAC) const FeatureEntry::Choice kUseAngleChoicesMac[] = { {flag_descriptions::kUseAngleDefault, "", ""}, {flag_descriptions::kUseAngleGL, switches::kUseANGLE, @@ -361,7 +361,7 @@ gl::kANGLEImplementationMetalName}}; #endif -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) const FeatureEntry::Choice kOzonePlatformHintRuntimeChoices[] = { {flag_descriptions::kOzonePlatformHintChoiceDefault, "", ""}, {flag_descriptions::kOzonePlatformHintChoiceAuto, @@ -390,7 +390,7 @@ }; #endif // ENABLE_VR -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kElasticOverscrollFilterType[] = { {features::kElasticOverscrollType, features::kElasticOverscrollTypeFilter}}; const FeatureEntry::FeatureParam kElasticOverscrollTransformType[] = { @@ -430,7 +430,7 @@ {flag_descriptions::kUpdateMenuTypeUnsupportedOSVersion, switches::kForceUpdateMenuType, "unsupported_os_version"}, }; -#else // !defined(OS_ANDROID) +#else // BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kReaderModeOfferInSettings[] = { {switches::kReaderModeDiscoverabilityParamName, switches::kReaderModeOfferInSettings}}; @@ -438,9 +438,9 @@ const FeatureEntry::FeatureVariation kReaderModeDiscoverabilityVariations[] = { {"available in settings", kReaderModeOfferInSettings, base::size(kReaderModeOfferInSettings), nullptr}}; -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kAdaptiveButton_AlwaysNone[] = { {"mode", "always-none"}}; const FeatureEntry::FeatureParam kAdaptiveButton_AlwaysNewTab[] = { @@ -478,7 +478,7 @@ {"Voice", kAdaptiveButtonCustomization_Voice, base::size(kAdaptiveButtonCustomization_Voice), nullptr}, }; -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) #if !BUILDFLAG(IS_CHROMEOS_ASH) const FeatureEntry::FeatureParam kForceDark_SimpleHsl[] = { @@ -539,7 +539,7 @@ base::size(kForceDark_SelectiveGeneralInversion), nullptr}, {"with increased text contrast", kForceDark_IncreaseTextContrast, base::size(kForceDark_IncreaseTextContrast), nullptr}}; -#endif // !OS_CHROMEOS +#endif // !BUILDFLAG(IS_CHROMEOS) const FeatureEntry::FeatureParam kMBIModeLegacy[] = {{"mode", "legacy"}}; const FeatureEntry::FeatureParam kMBIModeEnabledPerRenderProcessHost[] = { @@ -577,7 +577,7 @@ kFencedFramesImplementationTypeMPArch, base::size(kFencedFramesImplementationTypeMPArch), nullptr}}; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kCloseTabSuggestionsStale_Immediate[] = { {"baseline_tab_suggestions", "true"}, {"baseline_close_tab_suggestions", "true"}}; @@ -648,7 +648,7 @@ &kDangerousDownloadNoFilledNegativeButton, 1, nullptr}, {"with filled negative button", &kDangerousDownloadFilledNegativeButton, 1, nullptr}}; -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) const FeatureEntry::Choice kEnableGpuRasterizationChoices[] = { {flags_ui::kGenericExperimentChoiceDefault, "", ""}, @@ -947,8 +947,8 @@ base::size(kPageContentAnnotationsTitleParams), nullptr}, }; -#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || \ - defined(OS_WIN) || defined(OS_FUCHSIA) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) const FeatureEntry::FeatureParam kOmniboxDocumentProviderServerScoring[] = { {"DocumentUseServerScore", "true"}, {"DocumentUseClientScore", "false"}, @@ -1155,8 +1155,8 @@ {"Dynamic Replace URL (Title - Path|URL)", kOmniboxBookmarkPathsDynamicReplaceUrl, base::size(kOmniboxBookmarkPathsDynamicReplaceUrl), nullptr}}; -#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || - // defined(OS_WIN) || defined(OS_FUCHSIA) +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || + // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) const FeatureEntry::FeatureVariation kOmniboxOnFocusSuggestionsContextualWebVariations[] = { @@ -1407,7 +1407,7 @@ {" alternate hover card format", kTabHoverCardImagesAlternateFormat, base::size(kTabHoverCardImagesAlternateFormat), nullptr}}; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kNtpChromeCartModuleFakeData[] = { {ntp_features::kNtpChromeCartModuleDataParam, "fake"}, @@ -1495,9 +1495,9 @@ {"(Fast Cooldown)", kNtpSafeBrowsingModuleFastCooldown, base::size(kNtpSafeBrowsingModuleFastCooldown), nullptr}, }; -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kTranslateForceTriggerOnEnglishGeo[] = { {language::kOverrideModelKey, language::kOverrideModelGeoValue}, {language::kEnforceRankerKey, "false"}}; @@ -1511,7 +1511,7 @@ base::size(kTranslateForceTriggerOnEnglishGeo), nullptr}, {"(Zero threshold)", kTranslateForceTriggerOnEnglishBackoff, base::size(kTranslateForceTriggerOnEnglishBackoff), nullptr}}; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kOverridePrefsForHrefTranslateForceAuto[] = { {translate::kForceAutoTranslateKey, "true"}}; @@ -1552,7 +1552,7 @@ base::size(kOverrideSimilarLanguagesForHrefTranslateForceAuto), nullptr}}; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kExploreSitesExperimental = { chrome::android::explore_sites::kExploreSitesVariationParameterName, chrome::android::explore_sites::kExploreSitesVariationExperimental}; @@ -1673,7 +1673,7 @@ nullptr}, }; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kResamplingInputEventsLSQEnabled[] = { {"predictor", features::kPredictorNameLsq}}; @@ -1732,7 +1732,7 @@ {features::kFilterNameOneEuro, kFilteringPredictionOneEuroFilterEnabled, base::size(kFilteringPredictionOneEuroFilterEnabled), nullptr}}; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kTabSwitcherOnReturn_Immediate[] = { {"tab_switcher_on_return_time_ms", "0"}}; const FeatureEntry::FeatureParam kTabSwitcherOnReturn_1Minute[] = { @@ -1751,9 +1751,9 @@ {"60 minutes", kTabSwitcherOnReturn_60Minutes, base::size(kTabSwitcherOnReturn_60Minutes), nullptr}, }; -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kTabGridLayoutAndroid_NewTabVariation[] = { {"tab_grid_layout_android_new_tab", "NewTabVariation"}, {"allow_to_refetch", "true"}}; @@ -1962,9 +1962,9 @@ {"60 minutes", kConditionalTabStripAndroid_60Minutes, base::size(kConditionalTabStripAndroid_60Minutes), nullptr}, }; -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kAddToHomescreen_UseTextBubble[] = { {"use_text_bubble", "true"}}; const FeatureEntry::FeatureParam kAddToHomescreen_UseMessage[] = { @@ -1977,7 +1977,7 @@ base::size(kAddToHomescreen_UseMessage), nullptr}}; #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kAutofillUseMobileLabelDisambiguationShowAll[] = { {autofill::features::kAutofillUseMobileLabelDisambiguationParameterName, @@ -1995,9 +1995,9 @@ base::size(kAutofillUseMobileLabelDisambiguationShowAll), nullptr}, {"(show one)", kAutofillUseMobileLabelDisambiguationShowOne, base::size(kAutofillUseMobileLabelDisambiguationShowOne), nullptr}}; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kHomepagePromoCardLarge[] = { {"promo-card-variation", "Large"}}; const FeatureEntry::FeatureParam kHomepagePromoCardCompact[] = { @@ -2017,9 +2017,9 @@ nullptr}, {"Compact_SuppressingSignInPromo", kHomepagePromoCardSuppressing, base::size(kHomepagePromoCardSuppressing), nullptr}}; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kLensCameraAssistedSearchLensButtonStart[] = { {"searchBoxStartVariantForLensCameraAssistedSearch", "true"}}; @@ -2061,7 +2061,7 @@ {"(Full)", kDynamicColorFull, base::size(kDynamicColorFull), nullptr}, }; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kLazyFrameLoadingAutomatic[] = { {"automatic-lazy-load-frames-enabled", "true"}, @@ -2093,7 +2093,7 @@ ""}, }; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kAssistantConsentV2_reprompts_counter[] = { {"count", "3"}}; @@ -2174,7 +2174,7 @@ base::size(kRequestDesktopSiteForTablets1280), nullptr}, {"for 1920dp+ screens", kRequestDesktopSiteForTablets1920, base::size(kRequestDesktopSiteForTablets1920), nullptr}}; -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) // TODO(crbug.com/991082,1015377): Remove after proper support for back-forward // cache is implemented. @@ -2216,7 +2216,7 @@ }; #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const FeatureEntry::Choice kWebOtpBackendChoices[] = { {flags_ui::kGenericExperimentChoiceDefault, "", ""}, {flag_descriptions::kWebOtpBackendSmsVerification, switches::kWebOtpBackend, @@ -2241,7 +2241,7 @@ query_tiles::switches::kQueryTilesCountryCode, "ID"}, }; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) // The choices for --enable-experimental-cookie-features. This really should // just be a SINGLE_VALUE_TYPE, but it is misleading to have the choices be @@ -2329,7 +2329,7 @@ }; #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // The variations of --password-change-in-settings. const FeatureEntry::FeatureParam kPasswordChangeInSettingsVariationWithForcedWarningForEverySite[] = { @@ -2358,9 +2358,9 @@ base::size( kPasswordChangeVariationWithForcedDialogAfterEverySuccessfulSubmission), nullptr}}; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // The variations of --metrics-settings-android. const FeatureEntry::FeatureParam kMetricsSettingsAndroidAlternativeOne[] = { {"fre", "1"}}; @@ -2374,9 +2374,9 @@ {"Alternative FRE 2", kMetricsSettingsAndroidAlternativeTwo, base::size(kMetricsSettingsAndroidAlternativeTwo), nullptr}, }; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // SCT Auditing feature variations. const FeatureEntry::FeatureParam kSCTAuditingSamplingRateNone[] = { {"sampling_rate", "0.0"}}; @@ -2393,9 +2393,9 @@ {"Sampling rate 0.1%", kSCTAuditingSamplingRateAlternativeTwo, base::size(kSCTAuditingSamplingRateAlternativeTwo), nullptr}, }; -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // The variations of ContentLanguagesInLanguagePicker. const FeatureEntry::FeatureParam kContentLanguagesInLanguagePickerDisableObservers[] = { @@ -2407,7 +2407,7 @@ base::size(kContentLanguagesInLanguagePickerDisableObservers), nullptr}, }; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kCheckOfflineCapabilityWarnOnly[] = { {"check_mode", "warn_only"}}; @@ -2480,14 +2480,14 @@ constexpr char kWallpaperPerDeskName[] = "per-desk-wallpaper"; #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if BUILDFLAG(ENABLE_PAINT_PREVIEW) && defined(OS_ANDROID) +#if BUILDFLAG(ENABLE_PAINT_PREVIEW) && BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kPaintPreviewStartupWithAccessibility[] = { {"has_accessibility_support", "true"}}; const FeatureEntry::FeatureVariation kPaintPreviewStartupVariations[] = { {"with accessibility support", kPaintPreviewStartupWithAccessibility, base::size(kPaintPreviewStartupWithAccessibility), nullptr}}; -#endif // BUILDFLAG(ENABLE_PAINT_PREVIEW) && defined(OS_ANDROID) +#endif // BUILDFLAG(ENABLE_PAINT_PREVIEW) && BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_CHROMEOS_ASH) constexpr char kBorealisBigGlInternalName[] = "borealis-big-gl"; @@ -2498,7 +2498,7 @@ constexpr char kBorealisLinuxModeInternalName[] = "borealis-linux-mode"; #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // The variations of Continuous Search. const FeatureEntry::FeatureParam kContinuousSearchAfterSecondSrp[] = { {"trigger_mode", "1"}}; @@ -2567,7 +2567,7 @@ const FeatureEntry::FeatureVariation kScrollCaptureVariations[] = { {"(in memory capture)", kScrollCaptureInMemory, base::size(kScrollCaptureInMemory), nullptr}}; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) const FeatureEntry::FeatureParam kLargeFaviconFromGoogle96[] = { {"favicon_size_in_dip", "96"}}; @@ -2712,13 +2712,13 @@ {"disable-webrtc-hw-encoding", flag_descriptions::kWebrtcHwEncodingName, flag_descriptions::kWebrtcHwEncodingDescription, kOsAndroid | kOsCrOS, SINGLE_DISABLE_VALUE_TYPE(switches::kDisableWebRtcHWEncoding)}, -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"enable-reader-mode", flag_descriptions::kEnableReaderModeName, flag_descriptions::kEnableReaderModeDescription, kOsDesktop, FEATURE_WITH_PARAMS_VALUE_TYPE(dom_distiller::kReaderMode, kReaderModeDiscoverabilityVariations, "ReaderMode")}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) #if defined(WEBRTC_USE_PIPEWIRE) {"enable-webrtc-pipewire-capturer", flag_descriptions::kWebrtcPipeWireCapturerName, @@ -2730,7 +2730,7 @@ flag_descriptions::kWebKioskEnableLacrosDescription, kOsCrOS, FEATURE_VALUE_TYPE(features::kWebKioskEnableLacros)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"enable-webrtc-remote-event-log", flag_descriptions::kWebRtcRemoteEventLogName, flag_descriptions::kWebRtcRemoteEventLogDescription, kOsDesktop, @@ -2774,7 +2774,7 @@ {"enable-container-queries", flag_descriptions::kCSSContainerQueriesName, flag_descriptions::kCSSContainerQueriesDescription, kOsAll, FEATURE_VALUE_TYPE(blink::features::kCSSContainerQueries)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"contextual-search-debug", flag_descriptions::kContextualSearchDebugName, flag_descriptions::kContextualSearchDebugDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kContextualSearchDebug)}, @@ -2874,7 +2874,7 @@ flag_descriptions::kRelatedSearchesSimplifiedUxName, flag_descriptions::kRelatedSearchesSimplifiedUxDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kRelatedSearchesSimplifiedUx)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"show-autofill-type-predictions", flag_descriptions::kShowAutofillTypePredictionsName, flag_descriptions::kShowAutofillTypePredictionsDescription, kOsAll, @@ -3224,7 +3224,7 @@ chromeos::features::kWifiConnectMacAddressRandomization)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) {"dark-light-mode", flag_descriptions::kDarkLightTestName, flag_descriptions::kDarkLightTestDescription, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kDarkLightMode)}, @@ -3238,9 +3238,9 @@ flag_descriptions::kEnableTtsLacrosSupportName, flag_descriptions::kEnableTtsLacrosSupportDescription, kOsCrOS | kOsLinux, FEATURE_VALUE_TYPE(chromeos::kLacrosTtsSupport)}, -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS) -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) { "enable-accelerated-video-decode", flag_descriptions::kAcceleratedVideoDecodeName, @@ -3258,7 +3258,7 @@ kOsMac | kOsWin | kOsCrOS | kOsAndroid | kOsLinux | kOsFuchsia, SINGLE_DISABLE_VALUE_TYPE(switches::kDisableAcceleratedVideoDecode), }, -#endif // defined(OS_LINUX) +#endif // BUILDFLAG(IS_LINUX) { "disable-accelerated-video-encode", flag_descriptions::kAcceleratedVideoEncodeName, @@ -3273,7 +3273,7 @@ kOsAll, FEATURE_VALUE_TYPE(media::kEnableMediaInternals), }, -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) { "enable-hardware-secure-decryption", flag_descriptions::kHardwareSecureDecryptionName, @@ -3319,7 +3319,7 @@ flag_descriptions::kUiSlowAnimationsDescription, kOsCrOS, SINGLE_VALUE_TYPE(switches::kUISlowAnimations)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) { "zero-copy-video-capture", flag_descriptions::kZeroCopyVideoCaptureName, @@ -3327,7 +3327,7 @@ kOsWin, FEATURE_VALUE_TYPE(media::kMediaFoundationD3D11VideoCapture), }, -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) {"debug-packed-apps", flag_descriptions::kDebugPackedAppName, flag_descriptions::kDebugPackedAppDescription, kOsDesktop, SINGLE_VALUE_TYPE(switches::kDebugPackedApps)}, @@ -3411,7 +3411,7 @@ {"enable-vulkan", flag_descriptions::kEnableVulkanName, flag_descriptions::kEnableVulkanDescription, kOsWin | kOsLinux | kOsAndroid, FEATURE_VALUE_TYPE(features::kVulkan)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"translate-force-trigger-on-english", flag_descriptions::kTranslateForceTriggerOnEnglishName, flag_descriptions::kTranslateForceTriggerOnEnglishDescription, kOsAndroid, @@ -3424,7 +3424,7 @@ {"translate-intent", flag_descriptions::kTranslateIntentName, flag_descriptions::kTranslateIntentDescription, kOsAndroid, FEATURE_VALUE_TYPE(language::kTranslateIntent)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"override-language-prefs-for-href-translate", flag_descriptions::kOverrideLanguagePrefsForHrefTranslateName, @@ -3466,7 +3466,7 @@ kOsMac | kOsLinux | kOsWin, FEATURE_VALUE_TYPE(features::kSystemNotifications)}, #endif // BUILDFLAG(ENABLE_SYSTEM_NOTIFICATIONS) && !BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"adaptive-button-in-top-toolbar", flag_descriptions::kAdaptiveButtonInTopToolbarName, flag_descriptions::kAdaptiveButtonInTopToolbarDescription, kOsAndroid, @@ -3532,7 +3532,7 @@ flag_descriptions::kLightweightReactionsAndroidName, flag_descriptions::kLightweightReactionsAndroidDescription, kOsAndroid, FEATURE_VALUE_TYPE(content_creation::kLightweightReactions)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"enable-automatic-snooze", flag_descriptions::kEnableAutomaticSnoozeName, flag_descriptions::kEnableAutomaticSnoozeDescription, kOsAll, FEATURE_VALUE_TYPE(feature_engagement::kEnableAutomaticSnooze)}, @@ -3604,14 +3604,15 @@ flag_descriptions::kCrostiniVirtualKeyboardSupportDescription, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kCrostiniVirtualKeyboardSupport)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if (defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_ANDROID)) && \ - !defined(OS_NACL) +#if (BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_ANDROID)) && \ + !BUILDFLAG(IS_NACL) {"mojo-linux-sharedmem", flag_descriptions::kMojoLinuxChannelSharedMemName, flag_descriptions::kMojoLinuxChannelSharedMemDescription, kOsCrOS | kOsLinux | kOsAndroid, FEATURE_VALUE_TYPE(mojo::core::kMojoLinuxChannelSharedMem)}, #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-site-isolation-for-password-sites", flag_descriptions::kSiteIsolationForPasswordSitesName, flag_descriptions::kSiteIsolationForPasswordSitesDescription, kOsAndroid, @@ -3640,7 +3641,7 @@ {"enable-login-detection", flag_descriptions::kEnableLoginDetectionName, flag_descriptions::kEnableLoginDetectionDescription, kOsAll, FEATURE_VALUE_TYPE(login_detection::kLoginDetection)}, -#if defined(OS_CHROMEOS) || defined(OS_LINUX) +#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) {"enable-save-data", flag_descriptions::kEnableSaveDataName, flag_descriptions::kEnableSaveDataDescription, kOsCrOS | kOsLinux, SINGLE_VALUE_TYPE( @@ -3650,7 +3651,7 @@ flag_descriptions::kEnableNavigationPredictorDescription, kOsCrOS | kOsLinux, FEATURE_VALUE_TYPE(blink::features::kNavigationPredictor)}, -#endif // defined(OS_CHROMEOS) || defined(OS_LINUX) +#endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) {"enable-preconnect-to-search", flag_descriptions::kEnablePreconnectToSearchName, flag_descriptions::kEnablePreconnectToSearchDescription, kOsAll, @@ -3767,7 +3768,7 @@ SINGLE_VALUE_TYPE_AND_VALUE( switches::kSyncServiceURL, "https://chrome-sync.sandbox.google.com/chrome-sync/alpha")}, -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"media-router-cast-allow-all-ips", flag_descriptions::kMediaRouterCastAllowAllIPsName, flag_descriptions::kMediaRouterCastAllowAllIPsDescription, kOsDesktop, @@ -3808,26 +3809,26 @@ flag_descriptions::kCastStreamingVp9Description, kOsDesktop, FEATURE_VALUE_TYPE(mirroring::features::kCastStreamingVp9)}, -#endif // !OS_ANDROID +#endif // !BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"autofill-keyboard-accessory-view", flag_descriptions::kAutofillAccessoryViewName, flag_descriptions::kAutofillAccessoryViewDescription, kOsAndroid, FEATURE_VALUE_TYPE(autofill::features::kAutofillKeyboardAccessory)}, -#endif // OS_ANDROID -#if defined(OS_MAC) +#endif // BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_MAC) {"mac-syscall-sandbox", flag_descriptions::kMacSyscallSandboxName, flag_descriptions::kMacSyscallSandboxDescription, kOsMac, FEATURE_VALUE_TYPE(features::kMacSyscallSandbox)}, -#endif // OS_MAC -#if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) {"web-share", flag_descriptions::kWebShareName, flag_descriptions::kWebShareDescription, kOsWin | kOsCrOS, FEATURE_VALUE_TYPE(features::kWebShare)}, -#endif // BUILDFLAG(IS_CHROMEOS_ASH) || OS_WIN || OS_MAC +#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) {"ozone-platform-hint", flag_descriptions::kOzonePlatformHintName, flag_descriptions::kOzonePlatformHintDescription, kOsLinux, MULTI_VALUE_TYPE(kOzonePlatformHintRuntimeChoices)}, @@ -3856,7 +3857,7 @@ {"system-keyboard-lock", flag_descriptions::kSystemKeyboardLockName, flag_descriptions::kSystemKeyboardLockDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kSystemKeyboardLock)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"add-to-homescreen-iph", flag_descriptions::kAddToHomescreenIPHName, flag_descriptions::kAddToHomescreenIPHDescription, kOsAndroid, FEATURE_WITH_PARAMS_VALUE_TYPE(chrome::android::kAddToHomescreenIPH, @@ -3943,7 +3944,7 @@ {"theme-refactor-android", flag_descriptions::kThemeRefactorAndroidName, flag_descriptions::kThemeRefactorAndroidDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kThemeRefactorAndroid)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"disallow-doc-written-script-loads", flag_descriptions::kDisallowDocWrittenScriptsUiName, flag_descriptions::kDisallowDocWrittenScriptsUiDescription, kOsAll, @@ -3962,24 +3963,24 @@ flag_descriptions::kDocumentTransitionSlowdownFactorName, flag_descriptions::kDocumentTransitionSlowdownFactorDescription, kOsAll, MULTI_VALUE_TYPE(kDocumentTransitionSlowdownFactorChoices)}, -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"use-winrt-midi-api", flag_descriptions::kUseWinrtMidiApiName, flag_descriptions::kUseWinrtMidiApiDescription, kOsWin, FEATURE_VALUE_TYPE(midi::features::kMidiManagerWinrt)}, -#endif // OS_WIN -#if defined(TOOLKIT_VIEWS) || defined(OS_ANDROID) +#endif // BUILDFLAG(IS_WIN) +#if defined(TOOLKIT_VIEWS) || BUILDFLAG(IS_ANDROID) {"enable-autofill-credit-card-upload", flag_descriptions::kAutofillCreditCardUploadName, flag_descriptions::kAutofillCreditCardUploadDescription, kOsAll, FEATURE_VALUE_TYPE(autofill::features::kAutofillUpstream)}, -#endif // TOOLKIT_VIEWS || OS_ANDROID +#endif // defined(TOOLKIT_VIEWS) || BUILDFLAG(IS_ANDROID) {"force-ui-direction", flag_descriptions::kForceUiDirectionName, flag_descriptions::kForceUiDirectionDescription, kOsAll, MULTI_VALUE_TYPE(kForceUIDirectionChoices)}, {"force-text-direction", flag_descriptions::kForceTextDirectionName, flag_descriptions::kForceTextDirectionDescription, kOsAll, MULTI_VALUE_TYPE(kForceTextDirectionChoices)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"force-update-menu-type", flag_descriptions::kUpdateMenuTypeName, flag_descriptions::kUpdateMenuTypeDescription, kOsAndroid, MULTI_VALUE_TYPE(kForceUpdateMenuTypeChoices)}, @@ -3998,14 +3999,14 @@ SINGLE_VALUE_TYPE_AND_VALUE(switches::kMarketUrlForTesting, "https://play.google.com/store/apps/" "details?id=com.android.chrome")}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"enable-tls13-early-data", flag_descriptions::kEnableTLS13EarlyDataName, flag_descriptions::kEnableTLS13EarlyDataDescription, kOsAll, FEATURE_VALUE_TYPE(net::features::kEnableTLS13EarlyData)}, {"post-quantum-cecpq2", flag_descriptions::kPostQuantumCECPQ2Name, flag_descriptions::kPostQuantumCECPQ2Description, kOsAll, FEATURE_VALUE_TYPE(net::features::kPostQuantumCECPQ2)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"interest-feed-v2", flag_descriptions::kInterestFeedV2Name, flag_descriptions::kInterestFeedV2Description, kOsAndroid, FEATURE_VALUE_TYPE(feed::kInterestFeedV2)}, @@ -4051,7 +4052,7 @@ kInterestFeedV2ClickAndViewActionsConditionalUploadDescription, kOsAndroid, FEATURE_VALUE_TYPE(feed::kInterestFeedV2ClicksAndViewsConditionalUpload)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"password-import", flag_descriptions::kPasswordImportName, flag_descriptions::kPasswordImportDescription, kOsAll, FEATURE_VALUE_TYPE(password_manager::features::kPasswordImport)}, @@ -4066,7 +4067,7 @@ kForceDarkVariations, "ForceDarkVariations")}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-accessibility-page-zoom", flag_descriptions::kAccessibilityPageZoomName, flag_descriptions::kAccessibilityPageZoomDescription, kOsAndroid, @@ -4076,7 +4077,7 @@ flag_descriptions::kAndroidLayoutChangeTabReparentingDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kAndroidLayoutChangeTabReparenting)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"enable-experimental-accessibility-language-detection", flag_descriptions::kExperimentalAccessibilityLanguageDetectionName, flag_descriptions::kExperimentalAccessibilityLanguageDetectionDescription, @@ -4222,12 +4223,12 @@ flag_descriptions::kSystemProxyForSystemServicesDescription, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kSystemProxyForSystemServices)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) {"enable-immersive-fullscreen-toolbar", flag_descriptions::kImmersiveFullscreenName, flag_descriptions::kImmersiveFullscreenDescription, kOsMac, FEATURE_VALUE_TYPE(features::kImmersiveFullscreen)}, -#endif // OS_MAC +#endif // BUILDFLAG(IS_MAC) {"enable-web-payments-experimental-features", flag_descriptions::kWebPaymentsExperimentalFeaturesName, flag_descriptions::kWebPaymentsExperimentalFeaturesDescription, kOsAll, @@ -4244,7 +4245,7 @@ flag_descriptions::kSecurePaymentConfirmationDebugName, flag_descriptions::kSecurePaymentConfirmationDebugDescription, kOsAll, FEATURE_VALUE_TYPE(features::kSecurePaymentConfirmationDebug)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-secure-payment-confirmation-android", flag_descriptions::kSecurePaymentConfirmationAndroidName, flag_descriptions::kSecurePaymentConfirmationAndroidDescription, @@ -4320,7 +4321,7 @@ SINGLE_VALUE_TYPE(ui_devtools::switches::kEnableUiDevTools)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-autofill-manual-fallback", flag_descriptions::kAutofillManualFallbackAndroidName, flag_descriptions::kAutofillManualFallbackAndroidDescription, kOsAndroid, @@ -4427,16 +4428,16 @@ FEATURE_VALUE_TYPE(chromeos::features::kEcheSWAInBackground)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) {"enable-universal-links", flag_descriptions::kEnableUniversalLinksName, flag_descriptions::kEnableUniversalLinksDescription, kOsMac, FEATURE_VALUE_TYPE(features::kEnableUniveralLinks)}, {"new-usb-backend", flag_descriptions::kNewUsbBackendName, flag_descriptions::kNewUsbBackendDescription, kOsMac, FEATURE_VALUE_TYPE(device::kNewUsbBackend)}, -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"omnibox-adaptive-suggestions-count", flag_descriptions::kOmniboxAdaptiveSuggestionsCountName, flag_descriptions::kOmniboxAdaptiveSuggestionsCountDescription, kOsAndroid, @@ -4459,7 +4460,7 @@ flag_descriptions::kOmniboxPedalsAndroidBatch1Name, flag_descriptions::kOmniboxPedalsAndroidBatch1Description, kOsAndroid, FEATURE_VALUE_TYPE(omnibox::kOmniboxPedalsAndroidBatch1)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) {"omnibox-clobber-triggers-contextual-web-zero-suggest", flag_descriptions::kOmniboxClobberTriggersContextualWebZeroSuggestName, @@ -4509,8 +4510,8 @@ kOmniboxZeroSuggestPrefetchingVariations, "OmniboxBundledExperimentV1")}, -#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || \ - defined(OS_WIN) || defined(OS_FUCHSIA) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ + BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) {"omnibox-experimental-keyword-mode", flag_descriptions::kOmniboxExperimentalKeywordModeName, flag_descriptions::kOmniboxExperimentalKeywordModeDescription, kOsDesktop, @@ -4622,8 +4623,8 @@ flag_descriptions::kOmniboxAggregateShortcutsName, flag_descriptions::kOmniboxAggregateShortcutsDescription, kOsDesktop, FEATURE_VALUE_TYPE(omnibox::kAggregateShortcuts)}, -#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || - // defined(OS_WIN) || defined(OS_FUCHSIA) +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || + // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) #if BUILDFLAG(IS_CHROMEOS_ASH) {"scheduler-configuration", flag_descriptions::kSchedulerConfigurationName, @@ -4631,14 +4632,14 @@ MULTI_VALUE_TYPE(kSchedulerConfigurationChoices)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-command-line-on-non-rooted-devices", flag_descriptions::kEnableCommandLineOnNonRootedName, flag_descriptions::kEnableCommandLineOnNoRootedDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kCommandLineOnNonRooted)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"request-desktop-site-for-tablets", flag_descriptions::kRequestDesktopSiteForTabletsName, flag_descriptions::kRequestDesktopSiteForTabletsDescription, kOsAndroid, @@ -4649,7 +4650,7 @@ flag_descriptions::kAppMenuMobileSiteOptionName, flag_descriptions::kAppMenuMobileSiteOptionDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kAppMenuMobileSiteOption)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"force-color-profile", flag_descriptions::kForceColorProfileName, flag_descriptions::kForceColorProfileDescription, kOsAll, @@ -4664,7 +4665,7 @@ flag_descriptions::kForcedColorsDescription, kOsAll, FEATURE_VALUE_TYPE(features::kForcedColors)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"dynamic-color-gamut", flag_descriptions::kDynamicColorGamutName, flag_descriptions::kDynamicColorGamutDescription, kOsAndroid, FEATURE_VALUE_TYPE(features::kDynamicColorGamut)}, @@ -4771,7 +4772,7 @@ kIntensiveWakeUpThrottlingVariations, "IntensiveWakeUpThrottling")}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"omnibox-spare-renderer", flag_descriptions::kOmniboxSpareRendererName, flag_descriptions::kOmniboxSpareRendererDescription, kOsAndroid, FEATURE_VALUE_TYPE(omnibox::kOmniboxSpareRenderer)}, @@ -4789,7 +4790,7 @@ FEATURE_VALUE_TYPE(features::kQuickSettingsPWANotifications)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {flag_descriptions::kReadLaterFlagId, flag_descriptions::kReadLaterName, flag_descriptions::kReadLaterDescription, kOsAndroid, FEATURE_WITH_PARAMS_VALUE_TYPE(reading_list::switches::kReadLater, @@ -4806,7 +4807,7 @@ flag_descriptions::kReadLaterNewBadgePromoDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kReadLaterNewBadgePromo)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"read-later-reminder-notification", flag_descriptions::kReadLaterReminderNotificationName, flag_descriptions::kReadLaterReminderNotificationDescription, kOsAndroid, @@ -4872,21 +4873,21 @@ flag_descriptions::kProminentDarkModeActiveTabTitleDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kProminentDarkModeActiveTabTitle)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-reader-mode-in-cct", flag_descriptions::kReaderModeInCCTName, flag_descriptions::kReaderModeInCCTDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kReaderModeInCCT)}, -#endif // !defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ - defined(OS_CHROMEOS) || defined(OS_FUCHSIA) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) {"webui-feedback", flag_descriptions::kWebuiFeedbackName, flag_descriptions::kWebuiFeedbackDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kWebUIFeedback)}, -#endif // defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || - // defined(OS_CHROMEOS) || defined(OS_FUCHSIA) +#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || + // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"ntp-cache-one-google-bar", flag_descriptions::kNtpCacheOneGoogleBarName, flag_descriptions::kNtpCacheOneGoogleBarDescription, kOsDesktop, FEATURE_VALUE_TYPE(ntp_features::kCacheOneGoogleBar)}, @@ -4977,7 +4978,7 @@ flag_descriptions::kNtpRealboxUseGoogleGIconName, flag_descriptions::kNtpRealboxUseGoogleGIconDescription, kOsDesktop, FEATURE_VALUE_TYPE(ntp_features::kRealboxUseGoogleGIcon)}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) #if defined(DCHECK_IS_CONFIGURABLE) {"dcheck-is-fatal", flag_descriptions::kDcheckIsFatalName, @@ -4998,13 +4999,13 @@ flag_descriptions::kPointerLockOptionsDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kPointerLockOptions)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-async-dns", flag_descriptions::kAsyncDnsName, flag_descriptions::kAsyncDnsDescription, kOsAndroid, FEATURE_VALUE_TYPE(features::kAsyncDns)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"download-auto-resumption-native", flag_descriptions::kDownloadAutoResumptionNativeName, flag_descriptions::kDownloadAutoResumptionNativeDescription, kOsAndroid, @@ -5054,7 +5055,7 @@ flag_descriptions::kDownloadRangeDescription, kOsAll, FEATURE_VALUE_TYPE(download::features::kDownloadRange)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"screen-capture-android", flag_descriptions::kUserMediaScreenCapturingName, flag_descriptions::kUserMediaScreenCapturingDescription, kOsAndroid, FEATURE_VALUE_TYPE(features::kUserMediaScreenCapturing)}, @@ -5110,14 +5111,14 @@ #endif // BUILDFLAG(ENABLE_PDF) #if BUILDFLAG(ENABLE_PRINTING) -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) {"cups-ipp-printing-backend", flag_descriptions::kCupsIppPrintingBackendName, flag_descriptions::kCupsIppPrintingBackendDescription, kOsMac, FEATURE_VALUE_TYPE(printing::features::kCupsIppPrintingBackend)}, -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"print-with-postscript-type42-fonts", flag_descriptions::kPrintWithPostScriptType42FontsName, flag_descriptions::kPrintWithPostScriptType42FontsDescription, kOsWin, @@ -5136,7 +5137,7 @@ flag_descriptions::kUseXpsForPrintingFromPdfName, flag_descriptions::kUseXpsForPrintingFromPdfDescription, kOsWin, FEATURE_VALUE_TYPE(printing::features::kUseXpsForPrintingFromPdf)}, -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) #endif // BUILDFLAG(ENABLE_PRINTING) {"autofill-profile-client-validation", @@ -5149,14 +5150,14 @@ flag_descriptions::kAutofillProfileServerValidationDescription, kOsAll, FEATURE_VALUE_TYPE(autofill::features::kAutofillProfileServerValidation)}, -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"enable-windows-gaming-input-data-fetcher", flag_descriptions::kEnableWindowsGamingInputDataFetcherName, flag_descriptions::kEnableWindowsGamingInputDataFetcherDescription, kOsWin, FEATURE_VALUE_TYPE(features::kEnableWindowsGamingInputDataFetcher)}, #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-start-surface", flag_descriptions::kStartSurfaceAndroidName, flag_descriptions::kStartSurfaceAndroidDescription, kOsAndroid, FEATURE_WITH_PARAMS_VALUE_TYPE(chrome::android::kStartSurfaceAndroid, @@ -5255,7 +5256,7 @@ {"shopping-list", flag_descriptions::kShoppingListName, flag_descriptions::kShoppingListDescription, kOsAndroid, FEATURE_VALUE_TYPE(commerce::kShoppingList)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"enable-lazy-image-loading", flag_descriptions::kEnableLazyImageLoadingName, @@ -5295,7 +5296,7 @@ flag_descriptions::kDisableProcessReuseDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kDisableProcessReuse)}, -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"enable-accessibility-live-caption", flag_descriptions::kEnableAccessibilityLiveCaptionName, flag_descriptions::kEnableAccessibilityLiveCaptionDescription, kOsDesktop, @@ -5305,15 +5306,15 @@ flag_descriptions::kEnableAutoDisableAccessibilityName, flag_descriptions::kEnableAutoDisableAccessibilityDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kAutoDisableAccessibility)}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"cct-incognito", flag_descriptions::kCCTIncognitoName, flag_descriptions::kCCTIncognitoDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kCCTIncognito)}, #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"cct-incognito-available-to-third-party", flag_descriptions::kCCTIncognitoAvailableToThirdPartyName, flag_descriptions::kCCTIncognitoAvailableToThirdPartyDescription, @@ -5321,7 +5322,7 @@ FEATURE_VALUE_TYPE(chrome::android::kCCTIncognitoAvailableToThirdParty)}, #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"cct-resizable-90-maximum-height", flag_descriptions::kCCTResizable90MaximumHeightName, flag_descriptions::kCCTResizable90MaximumHeightDescription, kOsAndroid, @@ -5426,13 +5427,13 @@ FEATURE_VALUE_TYPE(features::kVaapiWebPImageDecodeAcceleration)}, #endif -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"happiness-tracking-surveys-for-desktop-demo", flag_descriptions::kHappinessTrackingSurveysForDesktopDemoName, flag_descriptions::kHappinessTrackingSurveysForDesktopDemoDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kHappinessTrackingSurveysForDesktopDemo)}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) {"destroy-profile-on-browser-close", flag_descriptions::kDestroyProfileOnBrowserCloseName, @@ -5440,11 +5441,11 @@ kOsMac | kOsWin | kOsLinux | kOsFuchsia, FEATURE_VALUE_TYPE(features::kDestroyProfileOnBrowserClose)}, -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"use-angle", flag_descriptions::kUseAngleName, flag_descriptions::kUseAngleDescriptionWindows, kOsWin, MULTI_VALUE_TYPE(kUseAngleChoicesWindows)}, -#elif defined(OS_MAC) +#elif BUILDFLAG(IS_MAC) {"use-angle", flag_descriptions::kUseAngleName, flag_descriptions::kUseAngleDescriptionMac, kOsMac, MULTI_VALUE_TYPE(kUseAngleChoicesMac)}, @@ -5461,7 +5462,7 @@ FEATURE_VALUE_TYPE(chromeos::features::kDisableQuickAnswersV2Translation)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"new-window-app-menu", flag_descriptions::kNewWindowAppMenuName, flag_descriptions::kNewWindowAppMenuDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kNewWindowAppMenu)}, @@ -5469,7 +5470,7 @@ {"instance-switcher", flag_descriptions::kInstanceSwitcherName, flag_descriptions::kInstanceSwitcherDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kInstanceSwitcher)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) {"enable-gamepad-button-axis-events", flag_descriptions::kEnableGamepadButtonAxisEventsName, @@ -5484,7 +5485,7 @@ flag_descriptions::kSharedClipboardUIDescription, kOsAll, FEATURE_VALUE_TYPE(kSharedClipboardUI)}, -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"sharing-desktop-screenshots", flag_descriptions::kSharingDesktopScreenshotsName, flag_descriptions::kSharingDesktopScreenshotsDescription, kOsDesktop, @@ -5526,7 +5527,7 @@ flag_descriptions::kEnableGpuServiceLoggingDescription, kOsAll, SINGLE_VALUE_TYPE(switches::kEnableGPUServiceLogging)}, -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"hardware-media-key-handling", flag_descriptions::kHardwareMediaKeyHandling, flag_descriptions::kHardwareMediaKeyHandlingDescription, kOsDesktop, @@ -5567,7 +5568,7 @@ FEATURE_VALUE_TYPE(media::kUseFakeDeviceForMediaStream)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_CHROMEOS) && BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) +#if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) // TODO(b/180051795): remove kOsLinux when lacros-chrome switches to // kOsCrOS. {"chromeos-direct-video-decoder", @@ -5577,12 +5578,12 @@ FEATURE_VALUE_TYPE(media::kUseChromeOSDirectVideoDecoder)}, #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"force-startup-signin-promo", flag_descriptions::kForceStartupSigninPromoName, flag_descriptions::kForceStartupSigninPromoDescription, kOsAndroid, FEATURE_VALUE_TYPE(switches::kForceStartupSigninPromo)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) {"autofill-use-improved-label-disambiguation", flag_descriptions::kAutofillUseImprovedLabelDisambiguationName, @@ -5603,23 +5604,23 @@ flag_descriptions::kStrictOriginIsolationDescription, kOsAll, FEATURE_VALUE_TYPE(features::kStrictOriginIsolation)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-logging-js-console-messages", flag_descriptions::kLogJsConsoleMessagesName, flag_descriptions::kLogJsConsoleMessagesDescription, kOsAndroid, FEATURE_VALUE_TYPE(features::kLogJsConsoleMessages)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) {"enable-skia-renderer", flag_descriptions::kSkiaRendererName, flag_descriptions::kSkiaRendererDescription, kOsAll, FEATURE_VALUE_TYPE(features::kUseSkiaRenderer)}, -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) {"bluetooth-advertisement-monitoring", flag_descriptions::kBluetoothAdvertisementMonitoringName, flag_descriptions::kBluetoothAdvertisementMonitoringDescription, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kBluetoothAdvertisementMonitoring)}, -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH) {"allow-disable-mouse-acceleration", @@ -5800,7 +5801,7 @@ flag_descriptions::kUnsafeFastJSCallsDescription, kOsAll, SINGLE_VALUE_TYPE(switches::kEnableUnsafeFastJSCalls)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"autofill-use-mobile-label-disambiguation", flag_descriptions::kAutofillUseMobileLabelDisambiguationName, flag_descriptions::kAutofillUseMobileLabelDisambiguationDescription, @@ -5809,7 +5810,7 @@ autofill::features::kAutofillUseMobileLabelDisambiguation, kAutofillUseMobileLabelDisambiguationVariations, "AutofillUseMobileLabelDisambiguation")}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) {"allow-sync-xhr-in-page-dismissal", flag_descriptions::kAllowSyncXHRInPageDismissalName, @@ -5837,7 +5838,7 @@ FEATURE_VALUE_TYPE(chromeos::features::kAutoScreenBrightness)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"metrics-settings-android", flag_descriptions::kMetricsSettingsAndroidName, flag_descriptions::kMetricsSettingsAndroidDescription, kOsAndroid, FEATURE_WITH_PARAMS_VALUE_TYPE(features::kMetricsSettingsAndroid, @@ -5849,7 +5850,7 @@ flag_descriptions::kSearchHistoryLinkDescription, kOsAll, FEATURE_VALUE_TYPE(features::kSearchHistoryLink)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"safe-browsing-password-protection-for-signed-in-users", flag_descriptions::kPasswordProtectionForSignedInUsersName, flag_descriptions::kPasswordProtectionForSignedInUsersDescription, @@ -5883,15 +5884,15 @@ flag_descriptions::kMouseSubframeNoImplicitCaptureDescription, kOsAll, FEATURE_VALUE_TYPE(features::kMouseSubframeNoImplicitCapture)}, -#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ - defined(OS_CHROMEOS) || defined(OS_FUCHSIA) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) {"global-media-controls-modern-ui", flag_descriptions::kGlobalMediaControlsModernUIName, flag_descriptions::kGlobalMediaControlsModernUIDescription, kOsWin | kOsMac | kOsLinux | kOsCrOS | kOsFuchsia, FEATURE_VALUE_TYPE(media::kGlobalMediaControlsModernUI)}, -#endif // defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || - // defined(OS_CHROMEOS) || defined(OS_FUCHSIA) +#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || + // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) {"turn-off-streaming-media-caching-on-battery", flag_descriptions::kTurnOffStreamingMediaCachingOnBatteryName, @@ -5939,7 +5940,7 @@ flag_descriptions::kNotificationSchedulerDebugOptionDescription, kOsAndroid, MULTI_VALUE_TYPE(kNotificationSchedulerChoices)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"debug-chime-notification", flag_descriptions::kChimeAlwaysShowNotificationName, @@ -5950,7 +5951,7 @@ flag_descriptions::kChimeAndroidSdkDescription, kOsAndroid, FEATURE_VALUE_TYPE(notifications::features::kUseChimeAndroidSdk)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_CHROMEOS_ASH) {"contextual-nudges", flag_descriptions::kContextualNudgesName, @@ -5979,7 +5980,7 @@ flag_descriptions::kWebBundlesDescription, kOsAll, FEATURE_VALUE_TYPE(features::kWebBundles)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"web-otp-backend", flag_descriptions::kWebOtpBackendName, flag_descriptions::kWebOtpBackendDescription, kOsAndroid, MULTI_VALUE_TYPE(kWebOtpBackendChoices)}, @@ -5990,13 +5991,13 @@ kOsAndroid, FEATURE_VALUE_TYPE( content_settings::kDarkenWebsitesCheckboxInThemesSetting)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) {"enable-autofill-upi-vpa", flag_descriptions::kAutofillSaveAndFillVPAName, flag_descriptions::kAutofillSaveAndFillVPADescription, kOsAll, FEATURE_VALUE_TYPE(autofill::features::kAutofillSaveAndFillVPA)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"context-menu-google-lens-chip", flag_descriptions::kContextMenuGoogleLensChipName, flag_descriptions::kContextMenuGoogleLensChipDescription, kOsAndroid, @@ -6038,7 +6039,7 @@ FEATURE_WITH_PARAMS_VALUE_TYPE(chrome::android::kLensCameraAssistedSearch, kLensCameraAssistedSearchVariations, "OmniboxAssistantVoiceSearch")}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_CHROMEOS_ASH) {"enable-suggested-files", flag_descriptions::kEnableSuggestedFilesName, @@ -6064,11 +6065,11 @@ kBackForwardCacheVariations, "BackForwardCache")}, -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"closed-tab-cache", flag_descriptions::kClosedTabCacheName, flag_descriptions::kClosedTabCacheDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kClosedTabCache)}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) {"impulse-scroll-animations", flag_descriptions::kImpulseScrollAnimationsName, @@ -6083,11 +6084,11 @@ flag_descriptions::kScrollUnificationDescription, kOsAll, FEATURE_VALUE_TYPE(features::kScrollUnification)}, -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"elastic-overscroll", flag_descriptions::kElasticOverscrollName, flag_descriptions::kElasticOverscrollDescription, kOsWin | kOsAndroid, FEATURE_VALUE_TYPE(features::kElasticOverscroll)}, -#elif defined(OS_ANDROID) +#elif BUILDFLAG(IS_ANDROID) {"elastic-overscroll", flag_descriptions::kElasticOverscrollName, flag_descriptions::kElasticOverscrollDescription, kOsWin | kOsAndroid, FEATURE_WITH_PARAMS_VALUE_TYPE(features::kElasticOverscroll, @@ -6105,28 +6106,28 @@ FEATURE_VALUE_TYPE(chromeos::assistant::features::kAssistantAudioEraser)}, #endif -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"enable-winrt-geolocation-implementation", flag_descriptions::kWinrtGeolocationImplementationName, flag_descriptions::kWinrtGeolocationImplementationDescription, kOsWin, FEATURE_VALUE_TYPE(features::kWinrtGeolocationImplementation)}, #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) {"enable-core-location-backend", flag_descriptions::kMacCoreLocationBackendName, flag_descriptions::kMacCoreLocationBackendDescription, kOsMac, FEATURE_VALUE_TYPE(features::kMacCoreLocationBackend)}, #endif -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"mute-notification-snooze-action", flag_descriptions::kMuteNotificationSnoozeActionName, flag_descriptions::kMuteNotificationSnoozeActionDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kMuteNotificationSnoozeAction)}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) {"enable-new-mac-notification-api", flag_descriptions::kNewMacNotificationAPIName, flag_descriptions::kNewMacNotificationAPIDescription, kOsMac, @@ -6148,7 +6149,7 @@ FEATURE_VALUE_TYPE(chromeos::features::kExoPointerLock)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) {"metal", flag_descriptions::kMetalName, flag_descriptions::kMetalDescription, kOsMac, FEATURE_VALUE_TYPE(features::kMetal)}, @@ -6192,13 +6193,13 @@ FEATURE_VALUE_TYPE(chromeos::features::kCrostiniDiskResizing)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"homepage-promo-card", flag_descriptions::kHomepagePromoCardName, flag_descriptions::kHomepagePromoCardDescription, kOsAndroid, FEATURE_WITH_PARAMS_VALUE_TYPE(chrome::android::kHomepagePromoCard, kHomepagePromoCardVariations, "HomepagePromoAndroid")}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_CHROMEOS_ASH) {"sync-settings-categorization", @@ -6259,7 +6260,7 @@ FEATURE_VALUE_TYPE(switches::kAccountIdMigration)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if BUILDFLAG(ENABLE_PAINT_PREVIEW) && defined(OS_ANDROID) +#if BUILDFLAG(ENABLE_PAINT_PREVIEW) && BUILDFLAG(IS_ANDROID) {"paint-preview-demo", flag_descriptions::kPaintPreviewDemoName, flag_descriptions::kPaintPreviewDemoDescription, kOsAndroid, FEATURE_VALUE_TYPE(paint_preview::kPaintPreviewDemo)}, @@ -6268,9 +6269,9 @@ FEATURE_WITH_PARAMS_VALUE_TYPE(paint_preview::kPaintPreviewShowOnStartup, kPaintPreviewStartupVariations, "PaintPreviewShowOnStartup")}, -#endif // ENABLE_PAINT_PREVIEW && defined(OS_ANDROID) +#endif // BUILDFLAG(ENABLE_PAINT_PREVIEW) && BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"block-external-form-redirects-no-gesture", flag_descriptions::kIntentBlockExternalFormRedirectsNoGestureName, flag_descriptions::kIntentBlockExternalFormRedirectsNoGestureDescription, @@ -6289,26 +6290,26 @@ photo_picker::features::kPhotoPickerVideoSupport, kPhotoPickerVideoSupportFeatureVariations, "PhotoPickerVideoSupportFeatureVariations")}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) {"reduce-user-agent", flag_descriptions::kReduceUserAgentName, flag_descriptions::kReduceUserAgentDescription, kOsDesktop | kOsAndroid, FEATURE_VALUE_TYPE(blink::features::kReduceUserAgent)}, -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"run-video-capture-service-in-browser", flag_descriptions::kRunVideoCaptureServiceInBrowserProcessName, flag_descriptions::kRunVideoCaptureServiceInBrowserProcessDescription, kOsWin, FEATURE_VALUE_TYPE(features::kRunVideoCaptureServiceInBrowserProcess)}, -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) {"double-buffer-compositing", flag_descriptions::kDoubleBufferCompositingName, flag_descriptions::kDoubleBufferCompositingDescription, kOsCrOS, SINGLE_VALUE_TYPE(switches::kDoubleBufferCompositing)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"password-change-in-settings", flag_descriptions::kPasswordChangeInSettingsName, flag_descriptions::kPasswordChangeInSettingsDescription, kOsAndroid, @@ -6326,23 +6327,23 @@ kPasswordChangeFeatureVariations, "PasswordChangeFeatureVariations")}, -#endif // !defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"page-info-history", flag_descriptions::kPageInfoHistoryName, flag_descriptions::kPageInfoHistoryDescription, kOsAndroid, FEATURE_VALUE_TYPE(page_info::kPageInfoHistory)}, {"page-info-store-info", flag_descriptions::kPageInfoStoreInfoName, flag_descriptions::kPageInfoStoreInfoDescription, kOsAndroid, FEATURE_VALUE_TYPE(page_info::kPageInfoStoreInfo)}, -#endif // !defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"page-info-history-desktop", flag_descriptions::kPageInfoHistoryDesktopName, flag_descriptions::kPageInfoHistoryDesktopDescription, kOsDesktop, FEATURE_VALUE_TYPE(page_info::kPageInfoHistoryDesktop)}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) {"page-info-about-this-site", flag_descriptions::kPageInfoAboutThisSiteName, flag_descriptions::kPageInfoAboutThisSiteDescription, @@ -6364,12 +6365,12 @@ FEATURE_VALUE_TYPE(chromeos::features::kClipboardHistoryScreenshotNudge)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"enable-media-foundation-video-capture", flag_descriptions::kEnableMediaFoundationVideoCaptureName, flag_descriptions::kEnableMediaFoundationVideoCaptureDescription, kOsWin, FEATURE_VALUE_TYPE(media::kMediaFoundationVideoCapture)}, -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_CHROMEOS_ASH) {"scan-app-multi-page-scan", flag_descriptions::kScanAppMultiPageScanName, @@ -6392,11 +6393,11 @@ kPlatformProvidedTrustTokensVariations, "TrustTokenOriginTrial")}, -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"copy-link-to-text", flag_descriptions::kCopyLinkToTextName, flag_descriptions::kCopyLinkToTextDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kCopyLinkToText)}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) {"shared-highlighting-v2", flag_descriptions::kSharedHighlightingV2Name, flag_descriptions::kSharedHighlightingV2Description, kOsAll, @@ -6572,14 +6573,14 @@ MULTI_VALUE_TYPE(kFrameThrottleFpsChoices)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"enable-incognito-shortcut-on-desktop", flag_descriptions::kEnableIncognitoShortcutOnDesktopName, flag_descriptions::kEnableIncognitoShortcutOnDesktopDescription, kOsWin, FEATURE_VALUE_TYPE(features::kEnableIncognitoShortcutOnDesktop)}, -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"incognito-brand-consistency-for-android", flag_descriptions::kIncognitoBrandConsistencyForAndroidName, flag_descriptions::kIncognitoBrandConsistencyForAndroidDescription, @@ -6593,8 +6594,8 @@ FEATURE_VALUE_TYPE(chrome::android::kIncognitoReauthenticationForAndroid)}, #endif -#if defined(OS_MAC) || defined(OS_WIN) || defined(OS_LINUX) || \ - defined(OS_CHROMEOS) || defined(OS_FUCHSIA) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) {"incognito-brand-consistency-for-desktop", flag_descriptions::kIncognitoBrandConsistencyForDesktopName, flag_descriptions::kIncognitoBrandConsistencyForDesktopDescription, @@ -6612,15 +6613,15 @@ flag_descriptions::kInheritNativeThemeFromParentWidgetDescription, kOsDesktop, FEATURE_VALUE_TYPE(views::features::kInheritNativeThemeFromParentWidget)}, -#endif // defined(OS_MAC) || defined(OS_WIN) || defined(OS_LINUX) || - // defined(OS_CHROMEOS) || defined(OS_FUCHSIA) +#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || + // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) {"consolidated-site-storage-controls", flag_descriptions::kConsolidatedSiteStorageControlsName, flag_descriptions::kConsolidatedSiteStorageControlsDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kConsolidatedSiteStorageControls)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"cpu-affinity-restrict-to-little-cores", flag_descriptions::kCpuAffinityRestrictToLittleCoresName, flag_descriptions::kCpuAffinityRestrictToLittleCoresDescription, @@ -6635,15 +6636,15 @@ {"enable-image-reader", flag_descriptions::kAImageReaderName, flag_descriptions::kAImageReaderDescription, kOsAndroid, FEATURE_VALUE_TYPE(features::kAImageReader)}, -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"smart-suggestion-for-large-downloads", flag_descriptions::kSmartSuggestionForLargeDownloadsName, flag_descriptions::kSmartSuggestionForLargeDownloadsDescription, kOsAndroid, FEATURE_VALUE_TYPE(download::features::kSmartSuggestionForLargeDownloads)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(ENABLE_JXL_DECODER) {"enable-jxl", flag_descriptions::kEnableJXLName, @@ -6651,7 +6652,7 @@ FEATURE_VALUE_TYPE(blink::features::kJXL)}, #endif // BUILDFLAG(ENABLE_JXL_DECODER) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"messages-for-android-ads-blocked", flag_descriptions::kMessagesForAndroidAdsBlockedName, flag_descriptions::kMessagesForAndroidAdsBlockedDescription, kOsAndroid, @@ -6715,7 +6716,7 @@ FEATURE_VALUE_TYPE(messages::kMessagesForAndroidUpdatePassword)}, #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"android-detailed-language-settings", flag_descriptions::kAndroidDetailedLanguageSettingsName, flag_descriptions::kAndroidDetailedLanguageSettingsDescription, kOsAndroid, @@ -6726,8 +6727,8 @@ FEATURE_VALUE_TYPE(language::kForceAppLanguagePrompt)}, #endif -#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ - defined(OS_FUCHSIA) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_FUCHSIA) {"commander", flag_descriptions::kCommanderName, flag_descriptions::kCommanderDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kCommander)}, @@ -6744,7 +6745,7 @@ FEATURE_VALUE_TYPE(language::kDesktopDetailedLanguageSettings)}, #endif -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"pwa-uninstall-in-windows-os", flag_descriptions::kPwaUninstallInWindowsOsName, flag_descriptions::kPwaUninstallInWindowsOsDescription, kOsWin, @@ -6781,15 +6782,15 @@ flag_descriptions::kAnimatedImageResumeDescription, kOsAll, FEATURE_VALUE_TYPE(features::kAnimatedImageResume)}, -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"sct-auditing", flag_descriptions::kSCTAuditingName, flag_descriptions::kSCTAuditingDescription, kOsDesktop, FEATURE_WITH_PARAMS_VALUE_TYPE(features::kSCTAuditing, kSCTAuditingVariations, "SCTAuditingVariations")}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"incognito-screenshot", flag_descriptions::kIncognitoScreenshotName, flag_descriptions::kIncognitoScreenshotDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kIncognitoScreenshot)}, @@ -6842,13 +6843,13 @@ flag_descriptions::kOmniboxTriggerForPrerender2Description, kOsAll, FEATURE_VALUE_TYPE(features::kOmniboxTriggerForPrerender2)}, -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"webui-branding-update", flag_descriptions::kWebUIBrandingUpdateName, flag_descriptions::kWebUIBrandingUpdateDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kWebUIBrandingUpdate)}, -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"continuous-search", flag_descriptions::kContinuousSearchName, flag_descriptions::kContinuousSearchDescription, kOsAndroid, FEATURE_WITH_PARAMS_VALUE_TYPE(features::kContinuousSearch, @@ -6860,7 +6861,7 @@ FEATURE_WITH_PARAMS_VALUE_TYPE(features::kScrollCapture, kScrollCaptureVariations, "AndroidScrollCapture")}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) {"chrome-labs", flag_descriptions::kChromeLabsName, flag_descriptions::kChromeLabsDescription, kOsDesktop, @@ -6877,7 +6878,7 @@ flag_descriptions::kEnableFirstPartySetsDescription, kOsAll, FEATURE_VALUE_TYPE(features::kFirstPartySets)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"autofill-enable-offers-in-clank-keyboard-accessory", flag_descriptions::kAutofillEnableOffersInClankKeyboardAccessoryName, flag_descriptions:: @@ -6896,17 +6897,17 @@ FEATURE_VALUE_TYPE(chrome_pdf::features::kPdfXfaSupport)}, #endif // BUILDFLAG(ENABLE_PDF) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"send-tab-to-self-v2", flag_descriptions::kSendTabToSelfV2Name, flag_descriptions::kSendTabToSelfV2Description, kOsAndroid, FEATURE_VALUE_TYPE(send_tab_to_self::kSendTabToSelfV2)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"raw-audio-capture", flag_descriptions::kRawAudioCaptureName, flag_descriptions::kRawAudioCaptureDescription, kOsWin, FEATURE_VALUE_TYPE(media::kWasapiRawAudioCapture)}, -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) {"enable-managed-configuration-web-api", flag_descriptions::kEnableManagedConfigurationWebApiName, @@ -6940,7 +6941,7 @@ FEATURE_VALUE_TYPE(ash::features::kWallpaperPerDesk)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) // TODO(b/180051795): remove kOsLinux when lacros-chrome switches to // kOsCrOS. {"enable-vaapi-av1-decode-acceleration", @@ -6952,7 +6953,7 @@ flag_descriptions::kDefaultChromeAppsMigrationName, flag_descriptions::kDefaultChromeAppsMigrationDescription, kOsCrOS, FEATURE_VALUE_TYPE(policy::features::kDefaultChromeAppsMigration)}, -#endif // defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_CHROMEOS) #if defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS_ASH) {"enable-vaapi-vp9-kSVC-encode-acceleration", @@ -6970,8 +6971,9 @@ flag_descriptions::kVp9kSVCHWDecodingDescription, kOsAll, FEATURE_VALUE_TYPE(media::kVp9kSVCHWDecoding)}, -#if defined(OS_WIN) || (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \ - defined(OS_MAC) || defined(OS_FUCHSIA) +#if BUILDFLAG(IS_WIN) || \ + (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \ + BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA) { "ui-debug-tools", flag_descriptions::kUIDebugToolsName, @@ -6998,7 +7000,7 @@ kOsDesktop | kOsAndroid, FEATURE_VALUE_TYPE(language::kDetectedSourceLanguageOption)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"content-languages-in-language-picker", flag_descriptions::kContentLanguagesInLanguagePickerName, flag_descriptions::kContentLanguagesInLanguagePickerDescription, @@ -7038,7 +7040,7 @@ FEATURE_VALUE_TYPE( optimization_guide::features::kOptimizationGuideModelDownloading)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"optimization-guide-push-notifications", flag_descriptions::kOptimizationGuideModelPushNotificationName, flag_descriptions::kOptimizationGuideModelPushNotificationDescription, @@ -7114,8 +7116,8 @@ FEATURE_VALUE_TYPE(chromeos::features::kLauncherAppSort)}, #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) || defined(OS_MAC) || defined(OS_LINUX) || \ - defined(OS_FUCHSIA) +#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_FUCHSIA) {"enable-desktop-pwas-app-icon-shortcuts-menu-ui", flag_descriptions::kDesktopPWAsAppIconShortcutsMenuUIName, flag_descriptions::kDesktopPWAsAppIconShortcutsMenuUIDescription, @@ -7168,7 +7170,7 @@ flag_descriptions::kEnablePenetratingImageSelectionDescription, kOsAll, FEATURE_VALUE_TYPE(blink::features::kEnablePenetratingImageSelection)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"biometric-reauth-password-filling", flag_descriptions::kBiometricReauthForPasswordFillingName, flag_descriptions::kBiometricReauthForPasswordFillingDescription, @@ -7253,7 +7255,7 @@ flag_descriptions::kPrivacyReviewDescription, kOsDesktop | kOsAndroid, FEATURE_VALUE_TYPE(features::kPrivacyReview)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"google-mobile-services-passwords", flag_descriptions::kUnifiedPasswordManagerAndroidName, flag_descriptions::kUnifiedPasswordManagerAndroidDescription, kOsAndroid, @@ -7352,20 +7354,20 @@ flag_descriptions::kHttpsOnlyModeDescription, kOsDesktop | kOsAndroid, FEATURE_VALUE_TYPE(features::kHttpsOnlyMode)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"dynamic-color-android", flag_descriptions::kDynamicColorAndroidName, flag_descriptions::kDynamicColorAndroidDescription, kOsAndroid, FEATURE_WITH_PARAMS_VALUE_TYPE(chrome::android::kDynamicColorAndroid, kDynamicColorAndroidVariations, "AndroidDynamicColor")}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"win-10-tab-search-caption-button", flag_descriptions::kWin10TabSearchCaptionButtonName, flag_descriptions::kWin10TabSearchCaptionButtonDescription, kOsWin, FEATURE_VALUE_TYPE(features::kWin10TabSearchCaptionButton)}, -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_CHROMEOS_ASH) {"enable-holding-space-in-progress-animation-v2", @@ -7386,7 +7388,7 @@ kOsDesktop | kOsAndroid, FEATURE_VALUE_TYPE(omnibox::kUpdatedConnectionSecurityIndicators)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"share-usage-ranking", flag_descriptions::kShareUsageRankingName, flag_descriptions::kShareUsageRankingDescription, kOsAndroid, FEATURE_VALUE_TYPE(features::kShareUsageRanking)}, @@ -7400,7 +7402,7 @@ FEATURE_VALUE_TYPE(share::kSwapAndroidShareHubRows)}, #endif -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) {"share-context-menu", flag_descriptions::kShareContextMenuName, flag_descriptions::kShareContextMenuDescription, kOsAll, FEATURE_VALUE_TYPE(share::kShareMenu)}, @@ -7443,7 +7445,7 @@ flag_descriptions::kCanvasOopRasterizationDescription, kOsAll, FEATURE_VALUE_TYPE(features::kCanvasOopRasterization)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"bookmarks-improved-save-flow", flag_descriptions::kBookmarksImprovedSaveFlowName, flag_descriptions::kBookmarksImprovedSaveFlowDescription, kOsAndroid, @@ -7469,7 +7471,7 @@ FEATURE_VALUE_TYPE(ash::features::kAmbientModeNewUrl)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"request-desktop-site-global", flag_descriptions::kRequestDesktopSiteGlobalName, flag_descriptions::kRequestDesktopSiteGlobalDescription, kOsAndroid, @@ -7541,7 +7543,7 @@ {"web-midi", flag_descriptions::kWebMidiName, flag_descriptions::kWebMidiDescription, kOsAll, FEATURE_VALUE_TYPE(features::kWebMidi)}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"use-real-color-space-for-android-video", flag_descriptions::kUseRealColorSpaceForAndroidVideoName, flag_descriptions::kUseRealColorSpaceForAndroidVideoDescription, @@ -7588,7 +7590,7 @@ FEATURE_VALUE_TYPE(ash::features::kEnableIdleInhibit)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"enable-chrome-management-page-android", flag_descriptions::kChromeManagementPageAndroidName, flag_descriptions::kChromeManagementPageAndroidDescription, kOsAndroid, @@ -7615,7 +7617,7 @@ kOsAndroid, FEATURE_VALUE_TYPE( policy::features::kActivateMetricsReportingEnabledPolicyAndroid)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_CHROMEOS_ASH) {"enable-desks-templates", flag_descriptions::kDesksTemplatesName, @@ -7636,14 +7638,14 @@ FEATURE_WITH_PARAMS_VALUE_TYPE(features::kLargeFaviconFromGoogle, kLargeFaviconFromGoogleVariations, "LargeFaviconFromGoogle")}, -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"web-bluetooth-request-larger-mtu", flag_descriptions::kWebBluetoothRequestLargerMtuName, flag_descriptions::kWebBluetoothRequestLargerMtuDescription, kOsAndroid, FEATURE_VALUE_TYPE(features::kWebBluetoothRequestLargerMtu)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"request-desktop-site-exceptions", flag_descriptions::kRequestDesktopSiteExceptionsName, flag_descriptions::kRequestDesktopSiteExceptionsDescription, kOsAndroid, @@ -7664,14 +7666,14 @@ "QuickDim")}, #endif -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) {"pervasive-system-accent-color", flag_descriptions::kPervasiveSystemAccentColorName, flag_descriptions::kPervasiveSystemAccentColorDescription, kOsWin, SINGLE_VALUE_TYPE(switches::kPervasiveSystemAccentColor)}, #endif -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) {"improve-accessibility-tree-using-local-ml", flag_descriptions::kImproveAccessibilityTreeUsingLocalMLName, flag_descriptions::kImproveAccessibilityTreeUsingLocalMLDescription, @@ -7694,17 +7696,17 @@ FEATURE_VALUE_TYPE(ash::features::kUsbNotificationController)}, #endif -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) {"link-capturing-ui-update", flag_descriptions::kLinkCapturingUiUpdateName, flag_descriptions::kLinkCapturingUiUpdateDescription, kOsCrOS, FEATURE_VALUE_TYPE(features::kLinkCapturingUiUpdate)}, #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) {"drag-and-drop-android", flag_descriptions::kDragAndDropAndroidName, flag_descriptions::kDragAndDropAndroidDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kDragAndDropAndroid)}, -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) {"autofill-enable-update-virtual-card-enrollment", flag_descriptions::kAutofillEnableUpdateVirtualCardEnrollmentName, @@ -7863,13 +7865,13 @@ return true; } -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // HDR mode works, but displays everything horribly wrong prior to windows 10. if (!strcmp("enable-hdr", entry.internal_name) && base::win::GetVersion() < base::win::Version::WIN10) { return true; } -#endif // OS_WIN +#endif // BUILDFLAG(IS_WIN) if (!strcmp("dns-over-https", entry.internal_name) && SystemNetworkContextManager::GetInstance() && @@ -7955,7 +7957,7 @@ FlagsStateSingleton::GetFlagsState()->ResetAllFlags(flags_storage); } -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) void CrosUrlFlagsRedirect() { #if BUILDFLAG(IS_CHROMEOS_LACROS) lacros_url_handling::NavigateInAsh(GURL(chrome::kChromeUIFlagsURL));
diff --git a/chrome/browser/about_flags.h b/chrome/browser/about_flags.h index 0b51be0..9a896e6d 100644 --- a/chrome/browser/about_flags.h +++ b/chrome/browser/about_flags.h
@@ -17,6 +17,7 @@ #include "base/containers/span.h" #include "base/metrics/histogram_base.h" #include "base/values.h" +#include "build/build_config.h" #include "components/flags_ui/feature_entry.h" #include "components/flags_ui/flags_state.h" @@ -97,7 +98,7 @@ // Reset all flags to the default state by clearing all flags. void ResetAllFlags(flags_ui::FlagsStorage* flags_storage); -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) // Show flags of the other browser (Lacros/Ash). void CrosUrlFlagsRedirect(); #endif
diff --git a/chrome/browser/android/signin/fre_mobile_identity_consistency_field_trial.cc b/chrome/browser/android/signin/fre_mobile_identity_consistency_field_trial.cc index 081e1aa..9d7b629f 100644 --- a/chrome/browser/android/signin/fre_mobile_identity_consistency_field_trial.cc +++ b/chrome/browser/android/signin/fre_mobile_identity_consistency_field_trial.cc
@@ -16,4 +16,17 @@ return base::android::ConvertJavaStringToUTF8(env, group); } +bool IsFREFieldTrialEnabled() { + JNIEnv* env = base::android::AttachCurrentThread(); + return Java_FREMobileIdentityConsistencyFieldTrial_isEnabled(env); +} + +std::string GetFREVariationsFieldTrialGroup() { + JNIEnv* env = base::android::AttachCurrentThread(); + base::android::ScopedJavaLocalRef<jstring> group = + Java_FREMobileIdentityConsistencyFieldTrial_getFirstRunVariationsTrialGroup( + env); + return base::android::ConvertJavaStringToUTF8(env, group); +} + } // namespace fre_mobile_identity_consistency_field_trial
diff --git a/chrome/browser/android/signin/fre_mobile_identity_consistency_field_trial.h b/chrome/browser/android/signin/fre_mobile_identity_consistency_field_trial.h index 2a6b49a7..305e5d0 100644 --- a/chrome/browser/android/signin/fre_mobile_identity_consistency_field_trial.h +++ b/chrome/browser/android/signin/fre_mobile_identity_consistency_field_trial.h
@@ -10,9 +10,17 @@ namespace fre_mobile_identity_consistency_field_trial { // Returns the field trial group created in Java code. -// The groups are created in FREFieldTrial.java. +// The groups are created in FREMobileIdentityConsistencyFieldTrial.java. std::string GetFREFieldTrialGroup(); +// Returns whether MobileIdentityConsistencyFRESynthetic field trial is +// enabled. +bool IsFREFieldTrialEnabled(); + +// Returns the variation field trial group created in Java code. +// The groups are created in FREMobileIdentityConsistencyFieldTrial.java. +std::string GetFREVariationsFieldTrialGroup(); + } // namespace fre_mobile_identity_consistency_field_trial #endif // CHROME_BROWSER_ANDROID_SIGNIN_FRE_MOBILE_IDENTITY_CONSISTENCY_FIELD_TRIAL_H_
diff --git a/chrome/browser/ash/app_mode/arc/arc_kiosk_app_data.cc b/chrome/browser/ash/app_mode/arc/arc_kiosk_app_data.cc index b8ea9f89..c59c7f6 100644 --- a/chrome/browser/ash/app_mode/arc/arc_kiosk_app_data.cc +++ b/chrome/browser/ash/app_mode/arc/arc_kiosk_app_data.cc
@@ -60,7 +60,7 @@ SaveIcon(*icon_.bitmap(), cache_dir); PrefService* local_state = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update(local_state, dictionary_name()); + DictionaryPrefUpdate dict_update(local_state, dictionary_name()); SaveToDictionary(dict_update); }
diff --git a/chrome/browser/ash/app_mode/kiosk_app_data.cc b/chrome/browser/ash/app_mode/kiosk_app_data.cc index 475b9c5..4afc7d5 100644 --- a/chrome/browser/ash/app_mode/kiosk_app_data.cc +++ b/chrome/browser/ash/app_mode/kiosk_app_data.cc
@@ -407,15 +407,15 @@ SaveIcon(icon, cache_dir); PrefService* local_state = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update(local_state, dictionary_name()); + DictionaryPrefUpdate dict_update(local_state, dictionary_name()); SaveToDictionary(dict_update); const std::string app_key = std::string(kKeyApps) + '.' + app_id(); const std::string required_platform_version_key = app_key + '.' + kKeyRequiredPlatformVersion; - dict_update->SetString(required_platform_version_key, - required_platform_version); + dict_update->SetStringPath(required_platform_version_key, + required_platform_version); } void KioskAppData::OnExtensionIconLoaded(const gfx::Image& icon) {
diff --git a/chrome/browser/ash/app_mode/kiosk_app_data_base.cc b/chrome/browser/ash/app_mode/kiosk_app_data_base.cc index fab05d3..7fbd2d8 100644 --- a/chrome/browser/ash/app_mode/kiosk_app_data_base.cc +++ b/chrome/browser/ash/app_mode/kiosk_app_data_base.cc
@@ -79,24 +79,22 @@ KioskAppDataBase::~KioskAppDataBase() = default; -void KioskAppDataBase::SaveToDictionary( - DictionaryPrefUpdateDeprecated& dict_update) { +void KioskAppDataBase::SaveToDictionary(DictionaryPrefUpdate& dict_update) { DCHECK_CURRENTLY_ON(BrowserThread::UI); const std::string app_key = std::string(kKeyApps) + '.' + app_id_; const std::string name_key = app_key + '.' + kKeyName; const std::string icon_path_key = app_key + '.' + kKeyIcon; - dict_update->SetString(name_key, name_); - dict_update->SetString(icon_path_key, icon_path_.value()); + dict_update->SetStringPath(name_key, name_); + dict_update->SetStringPath(icon_path_key, icon_path_.value()); } -void KioskAppDataBase::SaveIconToDictionary( - DictionaryPrefUpdateDeprecated& dict_update) { +void KioskAppDataBase::SaveIconToDictionary(DictionaryPrefUpdate& dict_update) { DCHECK_CURRENTLY_ON(BrowserThread::UI); const std::string app_key = std::string(kKeyApps) + '.' + app_id_; const std::string icon_path_key = app_key + '.' + kKeyIcon; - dict_update->SetString(icon_path_key, icon_path_.value()); + dict_update->SetStringPath(icon_path_key, icon_path_.value()); } bool KioskAppDataBase::LoadFromDictionary(const base::Value& dict, @@ -154,7 +152,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); PrefService* local_state = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update(local_state, dictionary_name()); + DictionaryPrefUpdate dict_update(local_state, dictionary_name()); const std::string app_key = std::string(KioskAppDataBase::kKeyApps) + '.' + app_id_;
diff --git a/chrome/browser/ash/app_mode/kiosk_app_data_base.h b/chrome/browser/ash/app_mode/kiosk_app_data_base.h index e54c414..d211f2f 100644 --- a/chrome/browser/ash/app_mode/kiosk_app_data_base.h +++ b/chrome/browser/ash/app_mode/kiosk_app_data_base.h
@@ -47,10 +47,10 @@ ~KioskAppDataBase() override; // Helper to save name and icon to provided dictionary. - void SaveToDictionary(DictionaryPrefUpdateDeprecated& dict_update); + void SaveToDictionary(DictionaryPrefUpdate& dict_update); // Helper to save icon to provided dictionary. - void SaveIconToDictionary(DictionaryPrefUpdateDeprecated& dict_update); + void SaveIconToDictionary(DictionaryPrefUpdate& dict_update); // Helper to load name and icon from provided dictionary. // if |lazy_icon_load| is set to true, the icon will not be updated, only
diff --git a/chrome/browser/ash/app_mode/kiosk_app_launch_error.cc b/chrome/browser/ash/app_mode/kiosk_app_launch_error.cc index 16f752f..87e19c7 100644 --- a/chrome/browser/ash/app_mode/kiosk_app_launch_error.cc +++ b/chrome/browser/ash/app_mode/kiosk_app_launch_error.cc
@@ -79,9 +79,9 @@ // static void KioskAppLaunchError::Save(KioskAppLaunchError::Error error) { PrefService* local_state = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update( - local_state, KioskAppManager::kKioskDictionaryName); - dict_update->SetInteger(kKeyLaunchError, static_cast<int>(error)); + DictionaryPrefUpdate dict_update(local_state, + KioskAppManager::kKioskDictionaryName); + dict_update->SetIntPath(kKeyLaunchError, static_cast<int>(error)); s_last_error = error; } @@ -89,9 +89,9 @@ void KioskAppLaunchError::SaveCryptohomeFailure( const AuthFailure& auth_failure) { PrefService* local_state = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update( - local_state, KioskAppManager::kKioskDictionaryName); - dict_update->SetInteger(kKeyCryptohomeFailure, auth_failure.reason()); + DictionaryPrefUpdate dict_update(local_state, + KioskAppManager::kKioskDictionaryName); + dict_update->SetIntPath(kKeyCryptohomeFailure, auth_failure.reason()); } // static @@ -115,8 +115,8 @@ // static void KioskAppLaunchError::RecordMetricAndClear() { PrefService* local_state = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update( - local_state, KioskAppManager::kKioskDictionaryName); + DictionaryPrefUpdate dict_update(local_state, + KioskAppManager::kKioskDictionaryName); absl::optional<int> error = dict_update->FindIntKey(kKeyLaunchError); if (error) {
diff --git a/chrome/browser/ash/app_mode/kiosk_app_manager.cc b/chrome/browser/ash/app_mode/kiosk_app_manager.cc index d573286..c636a72 100644 --- a/chrome/browser/ash/app_mode/kiosk_app_manager.cc +++ b/chrome/browser/ash/app_mode/kiosk_app_manager.cc
@@ -870,9 +870,9 @@ void KioskAppManager::SetAutoLoginState(AutoLoginState state) { PrefService* prefs = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update( - prefs, KioskAppManager::kKioskDictionaryName); - dict_update->SetInteger(kKeyAutoLoginState, static_cast<int>(state)); + DictionaryPrefUpdate dict_update(prefs, + KioskAppManager::kKioskDictionaryName); + dict_update->SetIntKey(kKeyAutoLoginState, static_cast<int>(state)); prefs->CommitPendingWrite(); }
diff --git a/chrome/browser/ash/app_mode/kiosk_app_manager_browsertest.cc b/chrome/browser/ash/app_mode/kiosk_app_manager_browsertest.cc index 2eb4eb3..5294e12 100644 --- a/chrome/browser/ash/app_mode/kiosk_app_manager_browsertest.cc +++ b/chrome/browser/ash/app_mode/kiosk_app_manager_browsertest.cc
@@ -324,8 +324,8 @@ required_platform_version); PrefService* local_state = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update( - local_state, KioskAppManager::kKioskDictionaryName); + DictionaryPrefUpdate dict_update(local_state, + KioskAppManager::kKioskDictionaryName); dict_update->SetKey(KioskAppDataBase::kKeyApps, std::move(apps_dict)); // Make the app appear in device settings.
diff --git a/chrome/browser/ash/app_mode/kiosk_cryptohome_remover.cc b/chrome/browser/ash/app_mode/kiosk_cryptohome_remover.cc index a4a4ac6..f1d1399f 100644 --- a/chrome/browser/ash/app_mode/kiosk_cryptohome_remover.cc +++ b/chrome/browser/ash/app_mode/kiosk_cryptohome_remover.cc
@@ -32,8 +32,8 @@ void ScheduleDelayedCryptohomeRemoval(const AccountId& account_id) { PrefService* const local_state = g_browser_process->local_state(); { - DictionaryPrefUpdateDeprecated dict_update(local_state, - prefs::kAllKioskUsersToRemove); + DictionaryPrefUpdate dict_update(local_state, + prefs::kAllKioskUsersToRemove); dict_update->SetKey(cryptohome::Identification(account_id).id(), base::Value(account_id.GetUserEmail())); } @@ -43,8 +43,8 @@ void UnscheduleDelayedCryptohomeRemoval(const cryptohome::Identification& id) { PrefService* const local_state = g_browser_process->local_state(); { - DictionaryPrefUpdateDeprecated dict_update(local_state, - prefs::kAllKioskUsersToRemove); + DictionaryPrefUpdate dict_update(local_state, + prefs::kAllKioskUsersToRemove); dict_update->RemoveKey(id.id()); } local_state->CommitPendingWrite();
diff --git a/chrome/browser/ash/app_mode/web_app/web_kiosk_app_data.cc b/chrome/browser/ash/app_mode/web_app/web_kiosk_app_data.cc index 7437b1f..819f63f5 100644 --- a/chrome/browser/ash/app_mode/web_app/web_kiosk_app_data.cc +++ b/chrome/browser/ash/app_mode/web_app/web_kiosk_app_data.cc
@@ -230,7 +230,7 @@ } PrefService* local_state = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update(local_state, dictionary_name()); + DictionaryPrefUpdate dict_update(local_state, dictionary_name()); SaveToDictionary(dict_update); launch_url_ = GURL(app_info->start_url); @@ -299,7 +299,7 @@ SaveIcon(icon, cache_dir); PrefService* local_state = g_browser_process->local_state(); - DictionaryPrefUpdateDeprecated dict_update(local_state, dictionary_name()); + DictionaryPrefUpdate dict_update(local_state, dictionary_name()); SaveIconToDictionary(dict_update); dict_update->FindDictKey(KioskAppDataBase::kKeyApps)
diff --git a/chrome/browser/ash/crosapi/browser_manager.h b/chrome/browser/ash/crosapi/browser_manager.h index bda90bf..0a138ed 100644 --- a/chrome/browser/ash/crosapi/browser_manager.h +++ b/chrome/browser/ash/crosapi/browser_manager.h
@@ -44,10 +44,6 @@ class Crosapi; } // namespace mojom -namespace test { -class AshBrowserTestStarter; -} // namespace test - class BrowserLoader; class TestMojoConnectionManager; @@ -277,10 +273,6 @@ // web apps in Lacros. Need to decouple the App Platform systems from // needing lacros-chrome running all the time. friend class apps::AppServiceProxyAsh; - // Currently in practice KeepAlive is enabled for AppService as described - // above. To make the testing environment closer to the case, set up - // KeepAlive for AshBrowserTestStarter, too. - friend class test::AshBrowserTestStarter; // Returns true if the binary is ready to launch or already launched. bool IsReady() const;
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.cc index bcf2359..7125dbbc 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.cc
@@ -81,11 +81,6 @@ destination); } -std::unique_ptr<Sampler> -MetricReportingManager::Delegate::CreateHttpsLatencySampler() { - return std::make_unique<HttpsLatencySampler>(); -} - bool MetricReportingManager::Delegate::IsDeprovisioned() { return ::ash::DeviceSettingsService::IsInitialized() && ::ash::DeviceSettingsService::Get()->policy_data() && @@ -93,6 +88,103 @@ em::PolicyData::DEPROVISIONED; } +std::unique_ptr<MetricReportQueue> +MetricReportingManager::Delegate::CreateMetricReportQueue( + Destination destination, + Priority priority) { + std::unique_ptr<MetricReportQueue> metric_report_queue; + auto report_queue = CreateReportQueue(destination); + if (report_queue) { + metric_report_queue = + std::make_unique<MetricReportQueue>(std::move(report_queue), priority); + } else { + DVLOG(1) << "Cannot create metric report queue, report queue is null"; + } + return metric_report_queue; +} + +std::unique_ptr<MetricReportQueue> +MetricReportingManager::Delegate::CreatePeriodicUploadReportQueue( + Destination destination, + Priority priority, + ReportingSettings* reporting_settings, + const std::string& rate_setting_path, + base::TimeDelta default_rate, + int rate_unit_to_ms) { + std::unique_ptr<MetricReportQueue> metric_report_queue; + auto report_queue = CreateReportQueue(destination); + if (report_queue) { + metric_report_queue = std::make_unique<MetricReportQueue>( + std::move(report_queue), priority, reporting_settings, + rate_setting_path, default_rate, rate_unit_to_ms); + } else { + DVLOG(1) + << "Cannot create periodic upload report queue, report queue is null"; + } + return metric_report_queue; +} + +std::unique_ptr<CollectorBase> +MetricReportingManager::Delegate::CreateOneShotCollector( + Sampler* sampler, + MetricReportQueue* metric_report_queue, + ReportingSettings* reporting_settings, + const std::string& enable_setting_path, + bool setting_enabled_default_value) { + return std::make_unique<OneShotCollector>( + sampler, metric_report_queue, reporting_settings, enable_setting_path, + setting_enabled_default_value); +} + +std::unique_ptr<CollectorBase> +MetricReportingManager::Delegate::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) { + return std::make_unique<PeriodicCollector>( + sampler, metric_report_queue, reporting_settings, enable_setting_path, + setting_enabled_default_value, rate_setting_path, default_rate, + rate_unit_to_ms); +} + +std::unique_ptr<CollectorBase> +MetricReportingManager::Delegate::CreatePeriodicEventCollector( + Sampler* sampler, + std::unique_ptr<EventDetector> event_detector, + std::vector<Sampler*> additional_samplers, + 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) { + return std::make_unique<PeriodicEventCollector>( + sampler, std::move(event_detector), std::move(additional_samplers), + metric_report_queue, reporting_settings, enable_setting_path, + setting_enabled_default_value, rate_setting_path, default_rate, + rate_unit_to_ms); +} + +std::unique_ptr<MetricEventObserverManager> +MetricReportingManager::Delegate::CreateEventObserverManager( + std::unique_ptr<MetricEventObserver> event_observer, + MetricReportQueue* metric_report_queue, + ReportingSettings* reporting_settings, + const std::string& enable_setting_path, + bool setting_enabled_default_value, + std::vector<Sampler*> additional_samplers) { + return std::make_unique<MetricEventObserverManager>( + std::move(event_observer), metric_report_queue, reporting_settings, + enable_setting_path, setting_enabled_default_value, + std::move(additional_samplers)); +} + // static std::unique_ptr<MetricReportingManager> MetricReportingManager::Create( policy::ManagedSessionService* managed_session_service) { @@ -152,11 +244,14 @@ } void MetricReportingManager::Init() { - info_report_queue_ = - CreateMetricReportQueue(Destination::INFO_METRIC, Priority::SLOW_BATCH); - telemetry_report_queue_ = CreateTelemetryQueue(); - event_report_queue_ = - CreateMetricReportQueue(Destination::EVENT_METRIC, Priority::SLOW_BATCH); + info_report_queue_ = delegate_->CreateMetricReportQueue( + Destination::INFO_METRIC, Priority::SLOW_BATCH); + telemetry_report_queue_ = delegate_->CreatePeriodicUploadReportQueue( + Destination::TELEMETRY_METRIC, Priority::MANUAL_BATCH, + &reporting_settings_, ::ash::kReportUploadFrequency, + GetDefaultReportUploadFrequency()); + event_report_queue_ = delegate_->CreateMetricReportQueue( + Destination::EVENT_METRIC, Priority::SLOW_BATCH); InitCrosHealthdInfoCollector( chromeos::cros_healthd::mojom::ProbeCategoryEnum::kCpu, @@ -172,7 +267,7 @@ // Network health info. // ReportDeviceNetworkConfiguration policy is enabled by default, so set its // default value to true. - CreateOneShotCollector( + InitOneShotCollector( std::make_unique<NetworkInfoSampler>(), info_report_queue_.get(), /*enable_setting_path=*/::ash::kReportDeviceNetworkConfiguration, /*setting_enabled_default_value=*/true); @@ -184,36 +279,7 @@ InitAudioCollectors(); } -std::unique_ptr<MetricReportQueue> -MetricReportingManager::CreateMetricReportQueue(Destination destination, - Priority priority) { - std::unique_ptr<MetricReportQueue> metric_report_queue; - auto report_queue = delegate_->CreateReportQueue(destination); - if (report_queue) { - metric_report_queue = - std::make_unique<MetricReportQueue>(std::move(report_queue), priority); - } else { - DVLOG(1) << "Cannot create metric report queue, report queue is null"; - } - return metric_report_queue; -} - -std::unique_ptr<MetricReportQueue> -MetricReportingManager::CreateTelemetryQueue() { - std::unique_ptr<MetricReportQueue> telemetry_report_queue; - auto report_queue = - delegate_->CreateReportQueue(Destination::TELEMETRY_METRIC); - if (report_queue) { - telemetry_report_queue = std::make_unique<MetricReportQueue>( - std::move(report_queue), Priority::MANUAL_BATCH, &reporting_settings_, - ::ash::kReportUploadFrequency, GetDefaultReportUploadFrequency()); - } else { - DVLOG(1) << "Cannot create telemetry report queue, report queue is null"; - } - return telemetry_report_queue; -} - -void MetricReportingManager::CreateOneShotCollector( +void MetricReportingManager::InitOneShotCollector( std::unique_ptr<Sampler> sampler, MetricReportQueue* metric_report_queue, const std::string& enable_setting_path, @@ -223,12 +289,12 @@ if (!metric_report_queue) { return; } - one_shot_collectors_.emplace_back(std::make_unique<OneShotCollector>( + one_shot_collectors_.emplace_back(delegate_->CreateOneShotCollector( sampler_ptr, metric_report_queue, &reporting_settings_, enable_setting_path, setting_enabled_default_value)); } -void MetricReportingManager::CreatePeriodicCollector( +void MetricReportingManager::InitPeriodicCollector( std::unique_ptr<Sampler> sampler, const std::string& enable_setting_path, bool setting_enabled_default_value, @@ -240,13 +306,13 @@ if (!telemetry_report_queue_) { return; } - periodic_collectors_.emplace_back(std::make_unique<PeriodicCollector>( + periodic_collectors_.emplace_back(delegate_->CreatePeriodicCollector( sampler_ptr, telemetry_report_queue_.get(), &reporting_settings_, enable_setting_path, setting_enabled_default_value, rate_setting_path, default_rate, rate_unit_to_ms)); } -void MetricReportingManager::CreatePeriodicEventCollector( +void MetricReportingManager::InitPeriodicEventCollector( std::unique_ptr<Sampler> sampler, std::unique_ptr<EventDetector> event_detector, std::vector<Sampler*> additional_samplers, @@ -260,14 +326,14 @@ if (!event_report_queue_) { return; } - periodic_collectors_.emplace_back(std::make_unique<PeriodicEventCollector>( + periodic_collectors_.emplace_back(delegate_->CreatePeriodicEventCollector( sampler_ptr, std::move(event_detector), std::move(additional_samplers), event_report_queue_.get(), &reporting_settings_, enable_setting_path, setting_enabled_default_value, rate_setting_path, default_rate, rate_unit_to_ms)); } -void MetricReportingManager::CreateEventObserverManager( +void MetricReportingManager::InitEventObserverManager( std::unique_ptr<MetricEventObserver> event_observer, const std::string& enable_setting_path, bool setting_enabled_default_value, @@ -275,11 +341,10 @@ if (!event_report_queue_) { return; } - event_observer_managers_.emplace_back( - std::make_unique<MetricEventObserverManager>( - std::move(event_observer), event_report_queue_.get(), - &reporting_settings_, enable_setting_path, - setting_enabled_default_value, std::move(additional_samplers))); + event_observer_managers_.emplace_back(delegate_->CreateEventObserverManager( + std::move(event_observer), event_report_queue_.get(), + &reporting_settings_, enable_setting_path, setting_enabled_default_value, + std::move(additional_samplers))); } void MetricReportingManager::InitCrosHealthdInfoCollector( @@ -288,19 +353,19 @@ bool default_value) { auto info_sampler = std::make_unique<CrosHealthdMetricSampler>( probe_category, CrosHealthdMetricSampler::MetricType::kInfo); - CreateOneShotCollector(std::move(info_sampler), info_report_queue_.get(), - setting_path, default_value); + InitOneShotCollector(std::move(info_sampler), info_report_queue_.get(), + setting_path, default_value); } void MetricReportingManager::InitNetworkCollectors() { - auto https_latency_sampler = delegate_->CreateHttpsLatencySampler(); + auto https_latency_sampler = std::make_unique<HttpsLatencySampler>(); auto network_telemetry_sampler = std::make_unique<NetworkTelemetrySampler>(https_latency_sampler.get()); // Network health telemetry. // ReportDeviceNetworkStatus policy is enabled by default, so set its default // value to true. const bool kReportDeviceNetworkStatusDefaultValue = true; - CreatePeriodicCollector( + InitPeriodicCollector( std::move(network_telemetry_sampler), /*enable_setting_path=*/::ash::kReportDeviceNetworkStatus, kReportDeviceNetworkStatusDefaultValue, @@ -311,7 +376,7 @@ return; } // HttpsLatency events. - CreatePeriodicEventCollector( + InitPeriodicEventCollector( std::move(https_latency_sampler), std::make_unique<HttpsLatencyEventDetector>(), /*additional_samplers=*/{}, /*enable_setting_path=*/::ash::kReportDeviceNetworkStatus, @@ -319,7 +384,7 @@ ::ash::kReportDeviceNetworkTelemetryEventCheckingRateMs, GetDefaulEventCheckingRate(kDefaultNetworkTelemetryEventCheckingRate)); // Network health events observer. - CreateEventObserverManager( + InitEventObserverManager( std::make_unique<NetworkEventsObserver>(), /*enable_setting_path=*/::ash::kReportDeviceNetworkStatus, kReportDeviceNetworkStatusDefaultValue); @@ -328,7 +393,7 @@ void MetricReportingManager::InitAudioCollectors() { const bool kReportDeviceAudioStatusDefaultValue = true; - CreateEventObserverManager( + InitEventObserverManager( std::make_unique<AudioEventsObserver>(), /*enable_setting_path=*/::ash::kReportDeviceAudioStatus, kReportDeviceAudioStatusDefaultValue); @@ -336,7 +401,7 @@ auto audio_telemetry_sampler = std::make_unique<CrosHealthdMetricSampler>( chromeos::cros_healthd::mojom::ProbeCategoryEnum::kAudio, CrosHealthdMetricSampler::MetricType::kTelemetry); - CreatePeriodicCollector( + InitPeriodicCollector( std::move(audio_telemetry_sampler), /*enable_setting_path=*/::ash::kReportDeviceAudioStatus, kReportDeviceAudioStatusDefaultValue,
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.h b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.h index e076f2e..8bdafa4 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.h +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.h
@@ -27,8 +27,7 @@ class MetricEventObserver; class MetricEventObserverManager; class MetricReportQueue; -class OneShotCollector; -class PeriodicCollector; +class CollectorBase; class ReportQueue; class Sampler; @@ -55,9 +54,57 @@ virtual std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> CreateReportQueue(Destination destination); - virtual std::unique_ptr<Sampler> CreateHttpsLatencySampler(); - virtual bool IsDeprovisioned(); + + virtual std::unique_ptr<MetricReportQueue> CreateMetricReportQueue( + Destination destination, + Priority priority); + + virtual std::unique_ptr<MetricReportQueue> CreatePeriodicUploadReportQueue( + Destination destination, + Priority priority, + ReportingSettings* reporting_settings, + const std::string& rate_setting_path, + base::TimeDelta default_rate, + int rate_unit_to_ms = 1); + + virtual std::unique_ptr<CollectorBase> CreateOneShotCollector( + Sampler* sampler, + MetricReportQueue* metric_report_queue, + ReportingSettings* reporting_settings, + const std::string& enable_setting_path, + bool setting_enabled_default_value); + + virtual 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); + + virtual std::unique_ptr<CollectorBase> CreatePeriodicEventCollector( + Sampler* sampler, + std::unique_ptr<EventDetector> event_detector, + std::vector<Sampler*> additional_samplers, + 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); + + virtual std::unique_ptr<MetricEventObserverManager> + CreateEventObserverManager( + std::unique_ptr<MetricEventObserver> event_observer, + MetricReportQueue* metric_report_queue, + ReportingSettings* reporting_settings, + const std::string& enable_setting_path, + bool setting_enabled_default_value, + std::vector<Sampler*> additional_samplers); }; static std::unique_ptr<MetricReportingManager> Create( @@ -89,31 +136,25 @@ // affiliated user login, should only be called once on login. void InitOnAffiliatedLogin(); - std::unique_ptr<MetricReportQueue> CreateMetricReportQueue( - Destination destination, - Priority priority); - std::unique_ptr<MetricReportQueue> CreateTelemetryQueue(); - - void CreateOneShotCollector(std::unique_ptr<Sampler> sampler, - MetricReportQueue* report_queue, - const std::string& enable_setting_path, - bool setting_enabled_default_value); - void CreatePeriodicCollector(std::unique_ptr<Sampler> sampler, - 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); - void CreatePeriodicEventCollector( - std::unique_ptr<Sampler> sampler, - std::unique_ptr<EventDetector> event_detector, - std::vector<Sampler*> additional_samplers, - 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); - void CreateEventObserverManager( + void InitOneShotCollector(std::unique_ptr<Sampler> sampler, + MetricReportQueue* report_queue, + const std::string& enable_setting_path, + bool setting_enabled_default_value); + void InitPeriodicCollector(std::unique_ptr<Sampler> sampler, + 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); + void InitPeriodicEventCollector(std::unique_ptr<Sampler> sampler, + std::unique_ptr<EventDetector> event_detector, + std::vector<Sampler*> additional_samplers, + 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); + void InitEventObserverManager( std::unique_ptr<MetricEventObserver> event_observer, const std::string& enable_setting_path, bool setting_enabled_default_value, @@ -130,10 +171,16 @@ CrosReportingSettings reporting_settings_; + // Samplers and queues should be destructed on the same sequence where + // collectors are destructed. Queues should also be destructed on the same + // sequence where event observer managers are destructed, this is currently + // enforced by destructing all of them using the `Shutdown` method if they + // need to be deleted before the destruction of the MetricReportingManager + // instance. std::vector<std::unique_ptr<Sampler>> samplers_; - std::vector<std::unique_ptr<PeriodicCollector>> periodic_collectors_; - std::vector<std::unique_ptr<OneShotCollector>> one_shot_collectors_; + std::vector<std::unique_ptr<CollectorBase>> periodic_collectors_; + std::vector<std::unique_ptr<CollectorBase>> one_shot_collectors_; std::vector<std::unique_ptr<MetricEventObserverManager>> event_observer_managers_;
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager_unittest.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager_unittest.cc index 541e6b7..2e83f86 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager_unittest.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager_unittest.cc
@@ -6,790 +6,585 @@ #include <memory> #include <string> +#include <utility> #include <vector> #include "ash/components/settings/cros_settings_names.h" -#include "ash/components/settings/cros_settings_provider.h" #include "base/feature_list.h" -#include "base/run_loop.h" -#include "base/task/thread_pool.h" +#include "base/memory/raw_ptr.h" #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" -#include "base/time/time.h" #include "base/values.h" -#include "chrome/browser/ash/settings/device_settings_service.h" -#include "chrome/browser/ash/settings/scoped_testing_cros_settings.h" -#include "chrome/browser/ash/settings/stub_cros_settings_provider.h" -#include "chrome/browser/profiles/profile.h" -#include "chromeos/dbus/cros_healthd/cros_healthd_client.h" -#include "chromeos/dbus/cros_healthd/fake_cros_healthd_client.h" -#include "chromeos/network/network_handler.h" -#include "chromeos/network/network_handler_test_helper.h" -#include "chromeos/services/cros_healthd/public/cpp/service_connection.h" -#include "chromeos/services/network_health/public/mojom/network_health.mojom.h" -#include "components/reporting/client/mock_report_queue.h" +#include "components/reporting/metrics/fake_metric_report_queue.h" +#include "components/reporting/metrics/fake_reporting_settings.h" #include "components/reporting/metrics/fake_sampler.h" +#include "components/reporting/metrics/metric_data_collector.h" +#include "components/reporting/metrics/metric_event_observer_manager.h" +#include "components/reporting/metrics/metric_report_queue.h" +#include "components/reporting/metrics/sampler.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/abseil-cpp/absl/types/optional.h" -#include "third_party/cros_system_api/dbus/shill/dbus-constants.h" + +using ::testing::_; +using ::testing::ByMove; +using ::testing::Return; namespace reporting { namespace { -class FakeDelegate : public MetricReportingManager::Delegate { +class FakeMetricEventObserver : public MetricEventObserver { public: - FakeDelegate() = default; + FakeMetricEventObserver() = default; - FakeDelegate(const FakeDelegate& other) = delete; - FakeDelegate& operator=(const FakeDelegate& other) = delete; - - ~FakeDelegate() override = default; - - std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> CreateReportQueue( - Destination destination) override { - switch (destination) { - case INFO_METRIC: - return std::move(info_queue_); - case TELEMETRY_METRIC: - return std::move(telemetry_queue_); - case EVENT_METRIC: - return std::move(event_queue_); - default: - NOTREACHED(); - return std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter>( - nullptr, - base::OnTaskRunnerDeleter(base::SequencedTaskRunnerHandle::Get())); - } - } - - std::unique_ptr<Sampler> CreateHttpsLatencySampler() override { - if (!latency_sampler_) { - latency_sampler_ = std::make_unique<test::FakeSampler>(); - } - return std::move(latency_sampler_); - } - - bool IsDeprovisioned() override { return is_deprovisioned_; } - - bool IsAffiliated(Profile* profile) override { return is_affiliated_; } - - void SetIsAffiliated(bool is_affiliated) { is_affiliated_ = is_affiliated; } - - void SetInfoQueue( - std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> info_queue) { - info_queue_ = std::move(info_queue); - } - - void SetTelemetryQueue( - std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> telemetry_queue) { - telemetry_queue_ = std::move(telemetry_queue); - } - - void SetEventQueue( - std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> event_queue) { - event_queue_ = std::move(event_queue); - } - - void SetHttpsLatencySampler( - std::unique_ptr<test::FakeSampler> latency_sampler) { - latency_sampler_ = std::move(latency_sampler); - } - - void SetIsDeprovisioned(bool is_deprovisioned) { - is_deprovisioned_ = is_deprovisioned; - } - - private: - bool is_affiliated_ = true; - bool is_deprovisioned_ = false; - - std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> info_queue_{ - nullptr, - base::OnTaskRunnerDeleter(base::SequencedTaskRunnerHandle::Get())}; - std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> telemetry_queue_{ - nullptr, - base::OnTaskRunnerDeleter(base::SequencedTaskRunnerHandle::Get())}; - std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> event_queue_{ - nullptr, - base::OnTaskRunnerDeleter(base::SequencedTaskRunnerHandle::Get())}; - - std::unique_ptr<test::FakeSampler> latency_sampler_; -}; - -struct NetworkHealthReportingTestCase { - std::string test_name; - bool is_feature_enabled; - bool is_deprovisioned; - bool is_affiliated; - // optional to test the cases where the policies are not set. - absl::optional<bool> info_policy_enabled; - absl::optional<bool> telemetry_policy_enabled; - RoutineVerdict latency_verdict; - int expected_info_count; - int expected_telemetry_count; - int expected_event_count; - int expected_flush_per_period; -}; - -constexpr char kWifiPath[] = "wifi/path1"; -constexpr char kProfilePath[] = "/profile/path"; -constexpr char kInterfaceName[] = "wlan0"; -constexpr char kServicePath[] = "service/path"; - -constexpr int kNetworkHealthRateMs = 60000; - -class NetworkHealthReportingTest - : public ::testing::TestWithParam<NetworkHealthReportingTestCase> { - protected: - NetworkHealthReportingTest() = default; - - NetworkHealthReportingTest(const NetworkHealthReportingTest&) = delete; - NetworkHealthReportingTest& operator=(const NetworkHealthReportingTest&) = + FakeMetricEventObserver(const FakeMetricEventObserver& other) = delete; + FakeMetricEventObserver& operator=(const FakeMetricEventObserver& other) = delete; - ~NetworkHealthReportingTest() override = default; + ~FakeMetricEventObserver() override = default; - void SetUp() override { - ::ash::CrosHealthdClient::InitializeFake(); + void SetOnEventObservedCallback(MetricRepeatingCallback cb) override {} + void SetReportingEnabled(bool is_enabled) override {} +}; - task_runner_ = base::ThreadPool::CreateSequencedTaskRunner({}); - - scoped_testing_cros_settings_.device_settings()->SetInteger( - ::ash::kReportUploadFrequency, kNetworkHealthRateMs); - scoped_testing_cros_settings_.device_settings()->SetInteger( - ::ash::kReportDeviceNetworkTelemetryCollectionRateMs, - kNetworkHealthRateMs); - scoped_testing_cros_settings_.device_settings()->SetInteger( - ::ash::kReportDeviceNetworkTelemetryEventCheckingRateMs, - kNetworkHealthRateMs); - - network_handler_test_helper_.profile_test()->AddProfile(kProfilePath, - "user_hash"); - auto* const device_client = network_handler_test_helper_.device_test(); - auto* const service_client = network_handler_test_helper_.service_test(); - base::RunLoop().RunUntilIdle(); - - device_client->ClearDevices(); - service_client->ClearServices(); - device_client->AddDevice(kWifiPath, shill::kTypeEthernet, kInterfaceName); - device_client->SetDeviceProperty(kWifiPath, shill::kInterfaceProperty, - base::Value(kInterfaceName), - /*notify_changed=*/true); - device_client->SetDeviceProperty(kWifiPath, shill::kInterfaceProperty, - base::Value(kInterfaceName), - /*notify_changed=*/true); - base::RunLoop().RunUntilIdle(); - service_client->AddService(kServicePath, "guid", "network_name", - shill::kTypeWifi, shill::kStateOnline, - /*is_visible=*/true); - service_client->SetServiceProperty(kServicePath, shill::kDeviceProperty, - base::Value(kWifiPath)); - service_client->SetServiceProperty(kServicePath, shill::kProfileProperty, - base::Value(kProfilePath)); - base::RunLoop().RunUntilIdle(); +class FakeMetricEventObserverManager : public MetricEventObserverManager { + public: + FakeMetricEventObserverManager(ReportingSettings* reporting_settings, + int* observer_manager_count) + : MetricEventObserverManager(std::make_unique<FakeMetricEventObserver>(), + nullptr, + reporting_settings, + "", + false, + {}), + observer_manager_count_(observer_manager_count) { + ++(*observer_manager_count_); } - void TearDown() override { - ::ash::CrosHealthdClient::Shutdown(); - ::ash::cros_healthd::ServiceConnection::GetInstance()->FlushForTesting(); - } + FakeMetricEventObserverManager(const FakeMetricEventObserverManager& other) = + delete; + FakeMetricEventObserverManager& operator=( + const FakeMetricEventObserverManager& other) = delete; - void EmitSignalStrengthEvent() { - base::RunLoop run_loop; - ::ash::cros_healthd::FakeCrosHealthdClient::Get() - ->EmitSignalStrengthChangedEventForTesting( - "guid", ::chromeos::network_health::mojom::UInt32Value::New(50)); - base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE, - run_loop.QuitClosure()); - run_loop.Run(); - } - - void SetWifiResult() { - auto telemetry_info = chromeos::cros_healthd::mojom::TelemetryInfo::New(); - std::vector<chromeos::cros_healthd::mojom::NetworkInterfaceInfoPtr> - network_interfaces; - - auto wireless_link_info = - chromeos::cros_healthd::mojom::WirelessLinkInfo::New("", 0, 0, 0, 0, 0, - 0); - auto wireless_interface_info = - chromeos::cros_healthd::mojom::WirelessInterfaceInfo::New( - kInterfaceName, false, std::move(wireless_link_info)); - network_interfaces.push_back( - chromeos::cros_healthd::mojom::NetworkInterfaceInfo:: - NewWirelessInterfaceInfo(std::move(wireless_interface_info))); - auto network_interface_result = - chromeos::cros_healthd::mojom::NetworkInterfaceResult:: - NewNetworkInterfaceInfo(std::move(network_interfaces)); - - telemetry_info->network_interface_result = - std::move(network_interface_result); - ::ash::cros_healthd::FakeCrosHealthdClient::Get() - ->SetProbeTelemetryInfoResponseForTesting(telemetry_info); - } - - base::test::TaskEnvironment task_environment_{ - base::test::TaskEnvironment::TimeSource::MOCK_TIME}; - - scoped_refptr<base::SequencedTaskRunner> task_runner_; - - ::ash::ScopedTestingCrosSettings scoped_testing_cros_settings_; + ~FakeMetricEventObserverManager() override { --(*observer_manager_count_); } private: - ::ash::NetworkHandlerTestHelper network_handler_test_helper_; - - ::ash::ScopedTestDeviceSettingsService test_device_settings_service_; + raw_ptr<int> observer_manager_count_; }; -TEST_P(NetworkHealthReportingTest, Info_Telemetry_LatencyEvent) { - const NetworkHealthReportingTestCase& test_case = GetParam(); - - if (test_case.info_policy_enabled.has_value()) { - scoped_testing_cros_settings_.device_settings()->SetBoolean( - ::ash::kReportDeviceNetworkConfiguration, - test_case.info_policy_enabled.value()); - } - if (test_case.telemetry_policy_enabled.has_value()) { - scoped_testing_cros_settings_.device_settings()->SetBoolean( - ::ash::kReportDeviceNetworkStatus, - test_case.telemetry_policy_enabled.value()); - } - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatureState( - MetricReportingManager::kEnableNetworkTelemetryReporting, - test_case.is_feature_enabled); - - auto fake_delegate = std::make_unique<FakeDelegate>(); - auto* const fake_delegate_ptr = fake_delegate.get(); - - fake_delegate->SetIsAffiliated(test_case.is_affiliated); - fake_delegate->SetIsDeprovisioned(test_case.is_deprovisioned); - auto https_latency_sampler = std::make_unique<test::FakeSampler>(); - MetricData https_latency_data; - https_latency_data.mutable_telemetry_data() - ->mutable_networks_telemetry() - ->mutable_https_latency_data() - ->set_verdict(test_case.latency_verdict); - https_latency_sampler->SetMetricData(std::move(https_latency_data)); - fake_delegate->SetHttpsLatencySampler(std::move(https_latency_sampler)); - SetWifiResult(); - - int info_report_count = 0; - int telemetry_report_count = 0; - int telemetry_flush_count = 0; - int event_report_count = 0; - auto info_queue = std::unique_ptr<MockReportQueue, base::OnTaskRunnerDeleter>( - new ::testing::NiceMock<MockReportQueue>(), - base::OnTaskRunnerDeleter(task_runner_)); - auto telemetry_queue = - std::unique_ptr<MockReportQueue, base::OnTaskRunnerDeleter>( - new ::testing::NiceMock<MockReportQueue>(), - base::OnTaskRunnerDeleter(task_runner_)); - auto event_queue = - std::unique_ptr<MockReportQueue, base::OnTaskRunnerDeleter>( - new ::testing::NiceMock<MockReportQueue>(), - base::OnTaskRunnerDeleter(task_runner_)); - ON_CALL(*info_queue, AddRecord).WillByDefault([&]() { ++info_report_count; }); - ON_CALL(*telemetry_queue, AddRecord).WillByDefault([&]() { - ++telemetry_report_count; - }); - ON_CALL(*telemetry_queue, Flush).WillByDefault([&]() { - ++telemetry_flush_count; - }); - ON_CALL(*event_queue, AddRecord).WillByDefault([&]() { - ++event_report_count; - }); - - fake_delegate->SetInfoQueue(std::move(info_queue)); - fake_delegate->SetTelemetryQueue(std::move(telemetry_queue)); - fake_delegate->SetEventQueue(std::move(event_queue)); - - auto metric_reporting_manager = MetricReportingManager::CreateForTesting( - std::move(fake_delegate), nullptr); - base::RunLoop run_loop; - base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE, - run_loop.QuitClosure()); - run_loop.Run(); - EXPECT_EQ(info_report_count, test_case.expected_info_count); - - task_environment_.FastForwardBy(base::Milliseconds(kNetworkHealthRateMs)); - EXPECT_EQ(telemetry_report_count, 0); - EXPECT_EQ(telemetry_flush_count, test_case.expected_flush_per_period); - EXPECT_EQ(event_report_count, 0); - - metric_reporting_manager->OnLogin(nullptr); - - // Reset flush count. - telemetry_flush_count = 0; - task_environment_.FastForwardBy(base::Milliseconds(kNetworkHealthRateMs)); - EXPECT_EQ(telemetry_report_count, test_case.expected_telemetry_count); - EXPECT_EQ(telemetry_flush_count, test_case.expected_flush_per_period); - EXPECT_EQ(event_report_count, test_case.expected_event_count); - - fake_delegate_ptr->SetIsDeprovisioned(true); - metric_reporting_manager->DeviceSettingsUpdated(); - - // Device is deprovisioned, so no reporting, reset all counts. - telemetry_report_count = 0; - telemetry_flush_count = 0; - event_report_count = 0; - task_environment_.FastForwardBy(base::Milliseconds(kNetworkHealthRateMs)); - EXPECT_EQ(telemetry_report_count, 0); - EXPECT_EQ(telemetry_flush_count, 0); - EXPECT_EQ(event_report_count, 0); -} - -TEST_F(NetworkHealthReportingTest, NetworkEventsObserver) { - scoped_testing_cros_settings_.device_settings()->SetBoolean( - ::ash::kReportDeviceNetworkStatus, true); - - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatureState( - MetricReportingManager::kEnableNetworkTelemetryReporting, true); - - auto fake_delegate = std::make_unique<FakeDelegate>(); - fake_delegate->SetIsAffiliated(true); - - int event_reported_count = 0; - auto event_queue = - std::unique_ptr<MockReportQueue, base::OnTaskRunnerDeleter>( - new ::testing::NiceMock<MockReportQueue>(), - base::OnTaskRunnerDeleter(task_runner_)); - ON_CALL(*event_queue, AddRecord).WillByDefault([&]() { - ++event_reported_count; - }); - fake_delegate->SetEventQueue(std::move(event_queue)); - - auto metric_reporting_manager = MetricReportingManager::CreateForTesting( - std::move(fake_delegate), nullptr); - - metric_reporting_manager->OnLogin(nullptr); - base::RunLoop run_loop; - EmitSignalStrengthEvent(); - base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE, - run_loop.QuitClosure()); - run_loop.Run(); - - EXPECT_EQ(event_reported_count, 1); -} - -INSTANTIATE_TEST_SUITE_P( - NetworkHealthReportingTests, - NetworkHealthReportingTest, - ::testing::ValuesIn<NetworkHealthReportingTestCase>( - {{"FeatureDisabled", /*is_feature_enabled=*/false, - /*is_deprovisioned=*/false, - /*is_affiliated=*/true, /*info_policy_enabled=*/true, - /*telemetry_policy_enabled=*/true, - /*latency_verdict=*/RoutineVerdict::PROBLEM, - /*expected_info_count=*/0, - /*expected_telemetry_count=*/1, /*expected_event_count=*/0, - /*expected_flush_per_period=*/1}, - {"Deprovisioned", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/true, - /*is_affiliated=*/true, /*info_policy_enabled=*/true, - /*telemetry_policy_enabled=*/true, - /*latency_verdict=*/RoutineVerdict::PROBLEM, - /*expected_info_count=*/0, - /*expected_telemetry_count=*/0, /*expected_event_count=*/0, - /*expected_flush_per_period=*/0}, - {"NotAffiliated", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/false, - /*is_affiliated=*/false, /*info_policy_enabled=*/true, - /*telemetry_policy_enabled=*/true, - /*latency_verdict=*/RoutineVerdict::PROBLEM, - /*expected_info_count=*/1, - /*expected_telemetry_count=*/0, /*expected_event_count=*/0, - /*expected_flush_per_period=*/1}, - {"InfoPolicyDisabled", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/false, - /*is_affiliated=*/true, /*info_policy_enabled=*/false, - /*telemetry_policy_enabled=*/true, - /*latency_verdict=*/RoutineVerdict::PROBLEM, - /*expected_info_count=*/0, - /*expected_telemetry_count=*/1, /*expected_event_count=*/1, - /*expected_flush_per_period=*/1}, - {"TelemetryPolicyDisabled", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/false, - /*is_affiliated=*/true, /*info_policy_enabled=*/true, - /*telemetry_policy_enabled=*/false, - /*latency_verdict=*/RoutineVerdict::PROBLEM, - /*expected_info_count=*/1, - /*expected_telemetry_count=*/0, /*expected_event_count=*/0, - /*expected_flush_per_period=*/1}, - {"InfoPolicyDefaultEnabled", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/false, - /*is_affiliated=*/true, /*info_policy_enabled=*/absl::nullopt, - /*telemetry_policy_enabled=*/false, - /*latency_verdict=*/RoutineVerdict::PROBLEM, - /*expected_info_count=*/1, - /*expected_telemetry_count=*/0, /*expected_event_count=*/0, - /*expected_flush_per_period=*/1}, - {"TelemetryPolicyDefaultEnabled", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/false, - /*is_affiliated=*/true, /*info_policy_enabled=*/false, - /*telemetry_policy_enabled=*/absl::nullopt, - /*latency_verdict=*/RoutineVerdict::PROBLEM, - /*expected_info_count=*/0, - /*expected_telemetry_count=*/1, /*expected_event_count=*/1, - /*expected_flush_per_period=*/1}, - {"LatencyVerdictNoProblem", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/false, - /*is_affiliated=*/true, /*info_policy_enabled=*/true, - /*telemetry_policy_enabled=*/true, - /*latency_verdict=*/RoutineVerdict::NO_PROBLEM, - /*expected_info_count=*/1, - /*expected_telemetry_count=*/1, /*expected_event_count=*/0, - /*expected_flush_per_period=*/1}, - {"Default", /*is_feature_enabled=*/true, /*is_deprovisioned=*/false, - /*is_affiliated=*/true, /*info_policy_enabled=*/true, - /*telemetry_policy_enabled=*/true, - /*latency_verdict=*/RoutineVerdict::PROBLEM, - /*expected_info_count=*/1, - /*expected_telemetry_count=*/1, /*expected_event_count=*/1, - /*expected_flush_per_period=*/1}}), - [](const testing::TestParamInfo<NetworkHealthReportingTest::ParamType>& - info) { return info.param.test_name; }); - -struct HealthdInfoReportingTestCase { - std::string test_name; - bool is_deprovisioned; - std::string policy_path; - bool policy_enabled; - int expected_info_count; -}; - -class HealthdInfoReportingTest - : public ::testing::TestWithParam<HealthdInfoReportingTestCase> { +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 SetUp() override { - task_runner_ = base::ThreadPool::CreateSequencedTaskRunner({}); - chromeos::cros_healthd::FakeCrosHealthdClient::InitializeFake(); - } + void OnMetricDataCollected(MetricData) override {} - void TearDown() override { - chromeos::cros_healthd::FakeCrosHealthdClient::Shutdown(); - chromeos::cros_healthd::ServiceConnection::GetInstance()->FlushForTesting(); - } - - void SetHealthdMetricSamplerResult() { - auto telemetry_info = chromeos::cros_healthd::mojom::TelemetryInfo::New(); - - telemetry_info - ->cpu_result = chromeos::cros_healthd::mojom::CpuResult::NewCpuInfo( - chromeos::cros_healthd::mojom::CpuInfo::New( - 0, chromeos::cros_healthd::mojom::CpuArchitectureEnum::kX86_64, - std::vector<chromeos::cros_healthd::mojom::PhysicalCpuInfoPtr>(), - std::vector< - chromeos::cros_healthd::mojom::CpuTemperatureChannelPtr>(), - chromeos::cros_healthd::mojom::KeylockerInfo::New(false))); - - telemetry_info->memory_result = - chromeos::cros_healthd::mojom::MemoryResult::NewMemoryInfo( - chromeos::cros_healthd::mojom::MemoryInfo::New( - 0, 0, 0, 0, - chromeos::cros_healthd::mojom::MemoryEncryptionInfo::New( - chromeos::cros_healthd::mojom::EncryptionState:: - kEncryptionDisabled, - 0, 0, - chromeos::cros_healthd::mojom::CryptoAlgorithm:: - kAesXts128))); - - std::vector<chromeos::cros_healthd::mojom::BusDevicePtr> bus_devices; - auto tbt_device = chromeos::cros_healthd::mojom::BusDevice::New(); - tbt_device->bus_info = - chromeos::cros_healthd::mojom::BusInfo::NewThunderboltBusInfo( - chromeos::cros_healthd::mojom::ThunderboltBusInfo::New( - chromeos::cros_healthd::mojom::ThunderboltSecurityLevel::kNone, - std::vector<chromeos::cros_healthd::mojom:: - ThunderboltBusInterfaceInfoPtr>())); - bus_devices.push_back(std::move(tbt_device)); - telemetry_info->bus_result = - chromeos::cros_healthd::mojom::BusResult::NewBusDevices( - std::move(bus_devices)); - - chromeos::cros_healthd::FakeCrosHealthdClient::Get() - ->SetProbeTelemetryInfoResponseForTesting(telemetry_info); - } - - base::test::TaskEnvironment task_environment_; - scoped_refptr<base::SequencedTaskRunner> task_runner_; - ::ash::ScopedTestingCrosSettings scoped_testing_cros_settings_; + private: + raw_ptr<int> collector_count_; }; -TEST_P(HealthdInfoReportingTest, HealthdInfoTest) { - const HealthdInfoReportingTestCase& test_case = GetParam(); +class MockDelegate : public MetricReportingManager::Delegate { + public: + MockDelegate() = default; - scoped_testing_cros_settings_.device_settings()->SetBoolean( - test_case.policy_path, test_case.policy_enabled); + MockDelegate(const MockDelegate& other) = delete; + MockDelegate& operator=(const MockDelegate& other) = delete; - auto fake_delegate = std::make_unique<FakeDelegate>(); + ~MockDelegate() override = default; - fake_delegate->SetIsDeprovisioned(test_case.is_deprovisioned); - SetHealthdMetricSamplerResult(); + MOCK_METHOD(bool, IsAffiliated, (Profile * profile), (override)); - auto info_queue = std::unique_ptr<MockReportQueue, base::OnTaskRunnerDeleter>( - new ::testing::NiceMock<MockReportQueue>(), - base::OnTaskRunnerDeleter(task_runner_)); - auto telemetry_queue = - std::unique_ptr<MockReportQueue, base::OnTaskRunnerDeleter>( - new ::testing::NiceMock<MockReportQueue>(), - base::OnTaskRunnerDeleter(task_runner_)); - auto event_queue = - std::unique_ptr<MockReportQueue, base::OnTaskRunnerDeleter>( - new ::testing::NiceMock<MockReportQueue>(), - base::OnTaskRunnerDeleter(task_runner_)); - auto* const info_queue_ptr = info_queue.get(); + MOCK_METHOD(bool, IsDeprovisioned, (), (override)); - fake_delegate->SetInfoQueue(std::move(info_queue)); - fake_delegate->SetTelemetryQueue(std::move(telemetry_queue)); - fake_delegate->SetEventQueue(std::move(event_queue)); + MOCK_METHOD(std::unique_ptr<MetricReportQueue>, + CreateMetricReportQueue, + (Destination destination, Priority priority), + (override)); - EXPECT_CALL(*info_queue_ptr, AddRecord).Times(test_case.expected_info_count); - auto metric_reporting_manager = MetricReportingManager::CreateForTesting( - std::move(fake_delegate), nullptr); + MOCK_METHOD(std::unique_ptr<MetricReportQueue>, + CreatePeriodicUploadReportQueue, + (Destination destination, + Priority priority, + ReportingSettings* reporting_settings, + const std::string& rate_setting_path, + base::TimeDelta default_rate, + int rate_unit_to_ms), + (override)); - base::RunLoop run_loop; - run_loop.RunUntilIdle(); -} + MOCK_METHOD(std::unique_ptr<CollectorBase>, + CreateOneShotCollector, + (Sampler * sampler, + MetricReportQueue* metric_report_queue, + ReportingSettings* reporting_settings, + const std::string& enable_setting_path, + bool setting_enabled_default_value), + (override)); -INSTANTIATE_TEST_SUITE_P( - HealthdInfoReportingTests, - HealthdInfoReportingTest, - ::testing::ValuesIn<HealthdInfoReportingTestCase>({ - {"CpuReportingEnabled", /*is_deprovisioned=*/false, - /*policy_path=*/::ash::kReportDeviceCpuInfo, - /*policy_enabled=*/true, - /*expected_info_count=*/1}, - {"CpuReportingDisabled", /*is_deprovisioned=*/false, - /*policy_path=*/::ash::kReportDeviceCpuInfo, - /*policy_enabled=*/false, - /*expected_info_count=*/0}, - {"CpuReportingDeprovisioned", /*is_deprovisioned=*/true, - /*policy_path=*/::ash::kReportDeviceCpuInfo, - /*policy_enabled=*/true, - /*expected_info_count=*/0}, - {"MemoryReportingEnabled", /*is_deprovisioned=*/false, - /*policy_path=*/::ash::kReportDeviceMemoryInfo, - /*policy_enabled=*/true, - /*expected_info_count=*/1}, - {"MemoryReportingDisabled", /*is_deprovisioned=*/false, - /*policy_path=*/::ash::kReportDeviceMemoryInfo, - /*policy_enabled=*/false, - /*expected_info_count=*/0}, - {"MemoryReportingDeprovisioned", /*is_deprovisioned=*/true, - /*policy_path=*/::ash::kReportDeviceMemoryInfo, - /*policy_enabled=*/true, - /*expected_info_count=*/0}, - {"TbtReportingEnabled", /*is_deprovisioned=*/false, - /*policy_path=*/::ash::kReportDeviceSecurityStatus, - /*policy_enabled=*/true, - /*expected_info_count=*/1}, - {"TbtReportingDisabled", /*is_deprovisioned=*/false, - /*policy_path=*/::ash::kReportDeviceSecurityStatus, - /*policy_enabled=*/false, - /*expected_info_count=*/0}, - {"TbtReportingDeprovisioned", /*is_deprovisioned=*/true, - /*policy_path=*/::ash::kReportDeviceSecurityStatus, - /*policy_enabled=*/true, - /*expected_info_count=*/0}, - }), - [](const testing::TestParamInfo<HealthdInfoReportingTest::ParamType>& - info) { return info.param.test_name; }); + 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)); -constexpr int kAudioCheckingRateMs = 60000; + MOCK_METHOD(std::unique_ptr<CollectorBase>, + CreatePeriodicEventCollector, + (Sampler * sampler, + std::unique_ptr<EventDetector> event_detector, + std::vector<Sampler*> additional_samplers, + 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 AudioReportingTestCase { + MOCK_METHOD(std::unique_ptr<MetricEventObserverManager>, + CreateEventObserverManager, + (std::unique_ptr<MetricEventObserver> event_observer, + MetricReportQueue* metric_report_queue, + ReportingSettings* reporting_settings, + const std::string& enable_setting_path, + bool setting_enabled_default_value, + std::vector<Sampler*> additional_samplers), + (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_info_settings = { + ::ash::kReportDeviceNetworkConfiguration, true, "", 0}; +const MetricReportingSettingData cpu_info_settings = { + ::ash::kReportDeviceCpuInfo, false, "", 0}; +const MetricReportingSettingData memory_info_settings = { + ::ash::kReportDeviceMemoryInfo, false, "", 0}; +const MetricReportingSettingData bus_info_settings = { + ::ash::kReportDeviceSecurityStatus, false, "", 0}; +const MetricReportingSettingData network_telemetry_settings = { + ::ash::kReportDeviceNetworkStatus, true, + ::ash::kReportDeviceNetworkTelemetryCollectionRateMs, 1}; +const MetricReportingSettingData network_event_settings = { + ::ash::kReportDeviceNetworkStatus, true, + ::ash::kReportDeviceNetworkTelemetryEventCheckingRateMs, 1}; +const MetricReportingSettingData audio_metric_settings = { + ::ash::kReportDeviceAudioStatus, true, + ::ash::kReportDeviceAudioStatusCheckingRateMs, 1}; + +struct MetricReportingManagerTestCase { std::string test_name; - absl::optional<bool> is_feature_enabled; - bool is_deprovisioned; + std::vector<base::Feature> enabled_features; + std::vector<base::Feature> disabled_features; bool is_affiliated; - int expected_telemetry_count; - int time_forward; + MetricReportingSettingData setting_data; + int expected_count_before_login; + int expected_count_after_login; }; -class AudioReportingTest - : public ::testing::TestWithParam<AudioReportingTestCase> { +class MetricReportingManagerTest + : public ::testing::TestWithParam<MetricReportingManagerTestCase> { protected: - AudioReportingTest() = default; - - AudioReportingTest(const AudioReportingTest&) = delete; - AudioReportingTest& operator=(const AudioReportingTest&) = delete; - - ~AudioReportingTest() override = default; - void SetUp() override { - ::ash::CrosHealthdClient::InitializeFake(); - - task_runner_ = base::ThreadPool::CreateSequencedTaskRunner({}); - - scoped_testing_cros_settings_.device_settings()->SetInteger( - ::ash::kReportDeviceAudioStatusCheckingRateMs, kAudioCheckingRateMs); - - base::RunLoop().RunUntilIdle(); + info_queue_ = std::make_unique<test::FakeMetricReportQueue>(); + telemetry_queue_ = std::make_unique<test::FakeMetricReportQueue>(); + event_queue_ = std::make_unique<test::FakeMetricReportQueue>(); } - void TearDown() override { - ::ash::CrosHealthdClient::Shutdown(); - ::ash::cros_healthd::ServiceConnection::GetInstance()->FlushForTesting(); - } - - void EmitAudioSevereUnderrunEvent() { - base::RunLoop run_loop; - ::ash::cros_healthd::FakeCrosHealthdClient::Get() - ->EmitAudioSevereUnderrunEventForTesting(); - base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE, - run_loop.QuitClosure()); - run_loop.Run(); - } - - void SetAudioResult() { - auto telemetry_info = chromeos::cros_healthd::mojom::TelemetryInfo::New(); - telemetry_info->audio_result = - chromeos::cros_healthd::mojom::AudioResult::NewAudioInfo( - chromeos::cros_healthd::mojom::AudioInfo::New( - /*output_mute=*/true, - /*input_mute=*/true, /*output_volume=*/25, - /*output_device_name=*/"hey", - /*input_gain=*/50, /*input_device_name=*/"airpods", - /*underruns=*/0, - /*severe_underruns=*/1)); - ::ash::cros_healthd::FakeCrosHealthdClient::Get() - ->SetProbeTelemetryInfoResponseForTesting(telemetry_info); - } - - base::test::TaskEnvironment task_environment_{ - base::test::TaskEnvironment::TimeSource::MOCK_TIME}; - - scoped_refptr<base::SequencedTaskRunner> task_runner_; - - ::ash::ScopedTestingCrosSettings scoped_testing_cros_settings_; + base::test::SingleThreadTaskEnvironment task_environment_; + std::unique_ptr<MetricReportQueue> info_queue_; + std::unique_ptr<MetricReportQueue> telemetry_queue_; + std::unique_ptr<MetricReportQueue> event_queue_; }; -TEST_F(AudioReportingTest, AudioEvent) { - scoped_testing_cros_settings_.device_settings()->SetBoolean( - ::ash::kReportDeviceAudioStatus, true); +TEST_F(MetricReportingManagerTest, InitiallyDeprovisioned) { + auto fake_reporting_settings = + std::make_unique<test::FakeReportingSettings>(); + auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + int one_shot_collector_count = 0; + int periodic_collector_count = 0; + int periodic_event_collector_count = 0; + int observer_manager_count = 0; - auto fake_delegate = std::make_unique<FakeDelegate>(); - fake_delegate->SetIsAffiliated(true); + ON_CALL(*mock_delegate, IsDeprovisioned).WillByDefault(Return(true)); + ON_CALL(*mock_delegate, IsAffiliated).WillByDefault(Return(true)); + ON_CALL(*mock_delegate, CreateMetricReportQueue(Destination::INFO_METRIC, + Priority::SLOW_BATCH)) + .WillByDefault(Return(ByMove(std::move(info_queue_)))); + ON_CALL(*mock_delegate, CreateMetricReportQueue(Destination::EVENT_METRIC, + Priority::SLOW_BATCH)) + .WillByDefault(Return(ByMove(std::move(event_queue_)))); + ON_CALL(*mock_delegate, + CreatePeriodicUploadReportQueue(Destination::TELEMETRY_METRIC, + Priority::MANUAL_BATCH, _, + ::ash::kReportUploadFrequency, _, 1)) + .WillByDefault(Return(ByMove(std::move(telemetry_queue_)))); - int event_reported_count = 0; - auto event_queue = - std::unique_ptr<MockReportQueue, base::OnTaskRunnerDeleter>( - new ::testing::NiceMock<MockReportQueue>(), - base::OnTaskRunnerDeleter(task_runner_)); - ON_CALL(*event_queue, AddRecord).WillByDefault([&]() { - ++event_reported_count; + ON_CALL(*mock_delegate, CreateOneShotCollector).WillByDefault([&]() { + return std::make_unique<FakeCollector>(&one_shot_collector_count); }); - fake_delegate->SetEventQueue(std::move(event_queue)); + ON_CALL(*mock_delegate, CreatePeriodicCollector).WillByDefault([&]() { + return std::make_unique<FakeCollector>(&periodic_collector_count); + }); + ON_CALL(*mock_delegate, CreatePeriodicEventCollector).WillByDefault([&]() { + return std::make_unique<FakeCollector>(&periodic_event_collector_count); + }); + ON_CALL(*mock_delegate, CreateEventObserverManager).WillByDefault([&]() { + return std::make_unique<FakeMetricEventObserverManager>( + fake_reporting_settings.get(), &observer_manager_count); + }); auto metric_reporting_manager = MetricReportingManager::CreateForTesting( - std::move(fake_delegate), nullptr); + std::move(mock_delegate), nullptr); + + EXPECT_EQ(one_shot_collector_count, 0); + EXPECT_EQ(periodic_collector_count, 0); + EXPECT_EQ(periodic_event_collector_count, 0); + EXPECT_EQ(observer_manager_count, 0); metric_reporting_manager->OnLogin(nullptr); - base::RunLoop run_loop; - EmitAudioSevereUnderrunEvent(); - base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE, - run_loop.QuitClosure()); - run_loop.Run(); - EXPECT_EQ(event_reported_count, 1); + EXPECT_EQ(one_shot_collector_count, 0); + EXPECT_EQ(periodic_collector_count, 0); + EXPECT_EQ(periodic_event_collector_count, 0); + EXPECT_EQ(observer_manager_count, 0); } -TEST_P(AudioReportingTest, Telemetry) { - const AudioReportingTestCase& test_case = GetParam(); +class MetricReportingManagerInfoTest : public MetricReportingManagerTest {}; - if (test_case.is_feature_enabled.has_value()) { - scoped_testing_cros_settings_.device_settings()->SetBoolean( - ::ash::kReportDeviceAudioStatus, test_case.is_feature_enabled.value()); - } +TEST_P(MetricReportingManagerInfoTest, Default) { + const MetricReportingManagerTestCase& test_case = GetParam(); - auto fake_delegate = std::make_unique<FakeDelegate>(); - auto* const fake_delegate_ptr = fake_delegate.get(); + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures(test_case.enabled_features, + test_case.disabled_features); - fake_delegate->SetIsAffiliated(test_case.is_affiliated); - fake_delegate->SetIsDeprovisioned(test_case.is_deprovisioned); - - SetAudioResult(); - - int telemetry_report_count = 0; - auto telemetry_queue = - std::unique_ptr<MockReportQueue, base::OnTaskRunnerDeleter>( - new ::testing::NiceMock<MockReportQueue>(), - base::OnTaskRunnerDeleter(task_runner_)); - ON_CALL(*telemetry_queue, AddRecord).WillByDefault([&]() { - ++telemetry_report_count; - }); - fake_delegate->SetTelemetryQueue(std::move(telemetry_queue)); + auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + auto* const mock_delegate_ptr = mock_delegate.get(); + auto* const info_queue_ptr = info_queue_.get(); + int collector_count = 0; + ON_CALL(*mock_delegate_ptr, IsAffiliated) + .WillByDefault(Return(test_case.is_affiliated)); + ON_CALL(*mock_delegate_ptr, CreateMetricReportQueue(Destination::INFO_METRIC, + Priority::SLOW_BATCH)) + .WillByDefault(Return(ByMove(std::move(info_queue_)))); + ON_CALL(*mock_delegate_ptr, + CreateOneShotCollector( + _, info_queue_ptr, _, test_case.setting_data.enable_setting_path, + test_case.setting_data.setting_enabled_default_value)) + .WillByDefault( + [&]() { return std::make_unique<FakeCollector>(&collector_count); }); auto metric_reporting_manager = MetricReportingManager::CreateForTesting( - std::move(fake_delegate), nullptr); - base::RunLoop run_loop; - base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE, - run_loop.QuitClosure()); - run_loop.Run(); + std::move(mock_delegate), nullptr); - task_environment_.FastForwardBy(base::Milliseconds(test_case.time_forward)); - EXPECT_EQ(telemetry_report_count, 0); + EXPECT_EQ(collector_count, test_case.expected_count_before_login); metric_reporting_manager->OnLogin(nullptr); - task_environment_.FastForwardBy(base::Milliseconds(test_case.time_forward)); - EXPECT_EQ(telemetry_report_count, test_case.expected_telemetry_count); + EXPECT_EQ(collector_count, test_case.expected_count_after_login); - fake_delegate_ptr->SetIsDeprovisioned(true); + ON_CALL(*mock_delegate_ptr, IsDeprovisioned).WillByDefault(Return(true)); metric_reporting_manager->DeviceSettingsUpdated(); - // Device is deprovisioned, so no reporting, reset all counts. - telemetry_report_count = 0; - task_environment_.FastForwardBy(base::Milliseconds(test_case.time_forward)); - EXPECT_EQ(telemetry_report_count, 0); + EXPECT_EQ(collector_count, 0); } INSTANTIATE_TEST_SUITE_P( - AudioReportingTests, - AudioReportingTest, - ::testing::ValuesIn<AudioReportingTestCase>( - {{"Deprovisioned", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/true, - /*is_affiliated=*/true, - /*expected_telemetry_count=*/0, - /*time_forward=*/kAudioCheckingRateMs}, - {"NotAffiliated", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/true, + MetricReportingManagerInfoTests, + MetricReportingManagerInfoTest, + ::testing::ValuesIn<MetricReportingManagerTestCase>( + {{"NetworkInfo_FeatureDisabled", + /*enabled_features=*/{}, + /*disabled_features=*/ + {MetricReportingManager::kEnableNetworkTelemetryReporting}, /*is_affiliated=*/false, - /*expected_telemetry_count=*/0, - /*time_forward=*/kAudioCheckingRateMs}, - {"Disabled", /*is_feature_enabled=*/false, - /*is_deprovisioned=*/false, + network_info_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/0}, + {"NetworkInfo_FeatureEnabled", + /*enabled_features=*/ + {MetricReportingManager::kEnableNetworkTelemetryReporting}, + /*disabled_features=*/{}, + /*is_affiliated=*/false, + network_info_settings, + /*expected_count_before_login=*/1, + /*expected_count_after_login=*/1}, + {"CpuInfo", + /*enabled_features=*/{}, + /*disabled_features=*/{}, + /*is_affiliated=*/false, cpu_info_settings, + /*expected_count_before_login=*/1, + /*expected_count_after_login=*/1}, + {"MemoryInfo", + /*enabled_features=*/{}, + /*disabled_features=*/{}, + /*is_affiliated=*/false, memory_info_settings, + /*expected_count_before_login=*/1, + /*expected_count_after_login=*/1}, + {"BusInfo", + /*enabled_features=*/{}, + /*disabled_features=*/{}, + /*is_affiliated=*/true, bus_info_settings, + /*expected_count_before_login=*/1, + /*expected_count_after_login=*/1}}), + [](const testing::TestParamInfo<MetricReportingManagerInfoTest::ParamType>& + info) { return info.param.test_name; }); + +class MetricReportingManagerEventTest : public MetricReportingManagerTest {}; + +TEST_P(MetricReportingManagerEventTest, Default) { + const MetricReportingManagerTestCase& test_case = GetParam(); + + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures(test_case.enabled_features, + test_case.disabled_features); + + auto fake_reporting_settings = + std::make_unique<test::FakeReportingSettings>(); + auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + auto* const mock_delegate_ptr = mock_delegate.get(); + auto* const event_queue_ptr = event_queue_.get(); + int observer_manager_count = 0; + ON_CALL(*mock_delegate_ptr, IsAffiliated) + .WillByDefault(Return(test_case.is_affiliated)); + ON_CALL(*mock_delegate_ptr, CreateMetricReportQueue(Destination::EVENT_METRIC, + Priority::SLOW_BATCH)) + .WillByDefault(Return(ByMove(std::move(event_queue_)))); + ON_CALL(*mock_delegate_ptr, + CreateEventObserverManager( + _, event_queue_ptr, _, test_case.setting_data.enable_setting_path, + test_case.setting_data.setting_enabled_default_value, _)) + .WillByDefault([&]() { + return std::make_unique<FakeMetricEventObserverManager>( + fake_reporting_settings.get(), &observer_manager_count); + }); + + auto metric_reporting_manager = MetricReportingManager::CreateForTesting( + std::move(mock_delegate), nullptr); + + EXPECT_EQ(observer_manager_count, test_case.expected_count_before_login); + + metric_reporting_manager->OnLogin(nullptr); + + EXPECT_EQ(observer_manager_count, test_case.expected_count_after_login); + + ON_CALL(*mock_delegate_ptr, IsDeprovisioned).WillByDefault(Return(true)); + metric_reporting_manager->DeviceSettingsUpdated(); + + EXPECT_EQ(observer_manager_count, 0); +} + +INSTANTIATE_TEST_SUITE_P( + MetricReportingManagerEventTests, + MetricReportingManagerEventTest, + ::testing::ValuesIn<MetricReportingManagerTestCase>( + {{"NetworkEvent_FeatureDisabled", + /*enabled_features=*/{}, + /*disabled_features=*/ + {MetricReportingManager::kEnableNetworkTelemetryReporting}, /*is_affiliated=*/true, - /*expected_telemetry_count=*/0, - /*time_forward=*/kAudioCheckingRateMs}, - {"DefaultEnabled", /*is_feature_enabled=*/absl::nullopt, - /*is_deprovisioned=*/false, + network_event_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/0}, + {"NetworkEvent_Unaffiliated", + /*enabled_features=*/ + {MetricReportingManager::kEnableNetworkTelemetryReporting}, + /*disabled_features=*/{}, + /*is_affiliated=*/false, + network_event_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/0}, + {"NetworkEvent_Default", + /*enabled_features=*/ + {MetricReportingManager::kEnableNetworkTelemetryReporting}, + /*disabled_features=*/{}, /*is_affiliated=*/true, - /*expected_telemetry_count=*/1, - /*time_forward=*/kAudioCheckingRateMs}, - {"Enabled", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/false, - /*is_affiliated=*/true, - /*expected_telemetry_count=*/1, - /*time_forward=*/kAudioCheckingRateMs}, - {"Enabled_DoubleTime", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/false, - /*is_affiliated=*/true, - /*expected_telemetry_count=*/2, - /*time_forward=*/kAudioCheckingRateMs * 2}, - {"Enabled_HalfTime", /*is_feature_enabled=*/true, - /*is_deprovisioned=*/false, - /*is_affiliated=*/true, - /*expected_telemetry_count=*/0, - /*time_forward=*/kAudioCheckingRateMs / 2}}), - [](const testing::TestParamInfo<AudioReportingTest::ParamType>& info) { + network_event_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/1}, + {"AudioEvent_Unaffiliated", + /*enabled_features=*/{}, + /*disabled_features=*/{}, + /*is_affiliated=*/false, audio_metric_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/0}, + {"AudioEvent_Default", + /*enabled_features=*/{}, + /*disabled_features=*/{}, + /*is_affiliated=*/true, audio_metric_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/1}}), + [](const testing::TestParamInfo<MetricReportingManagerInfoTest::ParamType>& + info) { return info.param.test_name; }); + +class MetricReportingManagerTelemetryTest : public MetricReportingManagerTest { +}; + +TEST_P(MetricReportingManagerTelemetryTest, Default) { + const MetricReportingManagerTestCase& test_case = GetParam(); + + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures(test_case.enabled_features, + test_case.disabled_features); + + auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + auto* const mock_delegate_ptr = mock_delegate.get(); + auto* const telemetry_queue_ptr = telemetry_queue_.get(); + int collector_count = 0; + ON_CALL(*mock_delegate_ptr, IsAffiliated) + .WillByDefault(Return(test_case.is_affiliated)); + ON_CALL(*mock_delegate_ptr, + CreatePeriodicUploadReportQueue(Destination::TELEMETRY_METRIC, + Priority::MANUAL_BATCH, _, + ::ash::kReportUploadFrequency, _, 1)) + .WillByDefault(Return(ByMove(std::move(telemetry_queue_)))); + ON_CALL( + *mock_delegate_ptr, + 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( + [&]() { return std::make_unique<FakeCollector>(&collector_count); }); + + auto metric_reporting_manager = MetricReportingManager::CreateForTesting( + std::move(mock_delegate), nullptr); + + EXPECT_EQ(collector_count, test_case.expected_count_before_login); + + metric_reporting_manager->OnLogin(nullptr); + + EXPECT_EQ(collector_count, test_case.expected_count_after_login); + + ON_CALL(*mock_delegate_ptr, IsDeprovisioned).WillByDefault(Return(true)); + metric_reporting_manager->DeviceSettingsUpdated(); + + EXPECT_EQ(collector_count, 0); +} + +INSTANTIATE_TEST_SUITE_P( + MetricReportingManagerTelemetryTests, + MetricReportingManagerTelemetryTest, + ::testing::ValuesIn<MetricReportingManagerTestCase>( + {{"NetworkTelemetry_Unaffiliated", /*enabled_features=*/{}, + /*disabled_features=*/{}, + /*is_affiliated=*/false, network_telemetry_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/0}, + {"NetworkTelemetry_Default", /*enabled_features=*/{}, + /*disabled_features=*/{}, + /*is_affiliated=*/true, network_telemetry_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/1}, + {"AudioTelemetry_Unaffiliated", /*enabled_features=*/{}, + /*disabled_features=*/{}, + /*is_affiliated=*/false, audio_metric_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/0}, + {"AudioTelemetry_Default", /*enabled_features=*/{}, + /*disabled_features=*/{}, + /*is_affiliated=*/true, audio_metric_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/1}}), + [](const testing::TestParamInfo< + MetricReportingManagerTelemetryTest::ParamType>& info) { return info.param.test_name; }); +class MetricReportingManagerPeriodicEventTest + : public MetricReportingManagerTest {}; + +TEST_P(MetricReportingManagerPeriodicEventTest, Default) { + const MetricReportingManagerTestCase& test_case = GetParam(); + + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures(test_case.enabled_features, + test_case.disabled_features); + + auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + auto* const mock_delegate_ptr = mock_delegate.get(); + auto* const event_queue_ptr = event_queue_.get(); + int collector_count = 0; + ON_CALL(*mock_delegate_ptr, IsAffiliated) + .WillByDefault(Return(test_case.is_affiliated)); + ON_CALL(*mock_delegate_ptr, CreateMetricReportQueue(Destination::EVENT_METRIC, + Priority::SLOW_BATCH)) + .WillByDefault(Return(ByMove(std::move(event_queue_)))); + ON_CALL(*mock_delegate_ptr, + CreatePeriodicEventCollector( + _, _, _, event_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( + [&]() { return std::make_unique<FakeCollector>(&collector_count); }); + + auto metric_reporting_manager = MetricReportingManager::CreateForTesting( + std::move(mock_delegate), nullptr); + + EXPECT_EQ(collector_count, test_case.expected_count_before_login); + + metric_reporting_manager->OnLogin(nullptr); + + EXPECT_EQ(collector_count, test_case.expected_count_after_login); + + ON_CALL(*mock_delegate_ptr, IsDeprovisioned).WillByDefault(Return(true)); + metric_reporting_manager->DeviceSettingsUpdated(); + + EXPECT_EQ(collector_count, 0); +} + +INSTANTIATE_TEST_SUITE_P( + MetricReportingManagerPeriodicEventTests, + MetricReportingManagerPeriodicEventTest, + ::testing::ValuesIn<MetricReportingManagerTestCase>( + {{"NetworkPeriodicEvent_FeatureDisabled", + /*enabled_features=*/{}, + /*disabled_features=*/ + {MetricReportingManager::kEnableNetworkTelemetryReporting}, + /*is_affiliated=*/true, + network_event_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/0}, + {"NetworkPeriodicEvent_Unaffiliated", + /*enabled_features=*/ + {MetricReportingManager::kEnableNetworkTelemetryReporting}, + /*disabled_features=*/{}, + /*is_affiliated=*/false, + network_event_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/0}, + {"NetworkPeriodicEvent_Default", + /*enabled_features=*/ + {MetricReportingManager::kEnableNetworkTelemetryReporting}, + /*disabled_features=*/{}, + /*is_affiliated=*/true, + network_event_settings, + /*expected_count_before_login=*/0, + /*expected_count_after_login=*/1}}), + [](const testing::TestParamInfo< + MetricReportingManagerPeriodicEventTest::ParamType>& info) { + return info.param.test_name; + }); } // namespace } // namespace reporting
diff --git a/chrome/browser/chrome_browser_field_trials.cc b/chrome/browser/chrome_browser_field_trials.cc index 7ba99d5..2fc14f0 100644 --- a/chrome/browser/chrome_browser_field_trials.cc +++ b/chrome/browser/chrome_browser_field_trials.cc
@@ -180,6 +180,21 @@ fre_mobile_identity_consistency_field_trial::GetFREFieldTrialGroup(); ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( kFREMobileIdentityConsistencyTrial, group); + + if (fre_mobile_identity_consistency_field_trial::IsFREFieldTrialEnabled()) { + // MobileIdentityConsistencyFREVariationsSynthetic field trial. + // This trial experiments with different title and subtitle variation in + // the FRE UI. This is a follow up experiment to + // MobileIdentityConsistencyFRESynthetic and thus is only used for the + // enabled population of MobileIdentityConsistencyFRESynthetic. + static constexpr char kFREMobileIdentityConsistencyVariationsTrial[] = + "FREMobileIdentityConsistencyVariationsSynthetic"; + const std::string variation_group = + fre_mobile_identity_consistency_field_trial:: + GetFREVariationsFieldTrialGroup(); + ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( + kFREMobileIdentityConsistencyVariationsTrial, variation_group); + } } #endif // defined(OS_ANDROID) }
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 05e20156..4e9969d 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -192,7 +192,7 @@ #include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) #include "chrome/browser/flags/android/chrome_feature_list.h" #include "chrome/browser/share/share_history.h" #include "chrome/browser/ui/page_info/chrome_page_info_client.h" @@ -207,11 +207,11 @@ #include "chrome/browser/upgrade_detector/upgrade_detector.h" #include "chrome/browser/usb/web_usb_detector.h" #include "components/soda/soda_installer.h" -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/first_run/upgrade_util.h" -#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) #if !BUILDFLAG(IS_CHROMEOS_ASH) #include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h" @@ -228,29 +228,29 @@ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) #include "chrome/browser/first_run/upgrade_util_linux.h" -#endif // defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #include "components/crash/core/app/breakpad_linux.h" #include "components/crash/core/app/crashpad.h" #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) #include <Security/Security.h> #include "chrome/browser/app_controller_mac.h" #include "chrome/browser/mac/keystone_glue.h" #include "chrome/browser/ui/ui_features.h" -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) // TODO(port): several win-only methods have been pulled out of this, but // BrowserMain() as a whole needs to be broken apart so that it's usable by // other platforms. For now, it's just a stub. This is a serious work in // progress and should not be taken as an indication of a real refactoring. -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "base/trace_event/trace_event_etw_export_win.h" #include "base/win/win_util.h" #include "chrome/browser/chrome_browser_main_win.h" @@ -263,12 +263,12 @@ #include "chrome/browser/win/parental_controls.h" #include "chrome/install_static/install_util.h" #include "ui/shell_dialogs/select_file_dialog.h" -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_WIN) || defined(OS_MAC) || \ - (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ + (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) #include "chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h" #include "chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.h" #include "chrome/browser/profiles/profile_activity_metrics_recorder.h" @@ -302,7 +302,7 @@ #include "printing/printed_document.h" #endif -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && defined(OS_WIN) +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && BUILDFLAG(IS_WIN) #include "chrome/common/printing/printer_capabilities.h" #include "printing/backend/win_helper.h" #endif @@ -320,15 +320,15 @@ #include "ui/aura/env.h" #endif -#if defined(OS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) +#if BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) #include "chrome/browser/spellchecker/spellcheck_factory.h" #include "components/spellcheck/browser/pref_names.h" #include "components/spellcheck/common/spellcheck_features.h" -#endif // defined(OS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) +#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) namespace { -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Initialized in PreMainMessageLoopRun() and handed off to content:: in // WillRunMainMessageLoop() (or in TakeRunLoopForTest() in tests) std::unique_ptr<base::RunLoop>& GetMainRunLoopInstance() { @@ -347,7 +347,7 @@ } } -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) void AddFirstRunNewTabs(StartupBrowserCreator* browser_creator, const std::vector<GURL>& new_tabs) { for (const auto& new_tab : new_tabs) { @@ -355,7 +355,7 @@ browser_creator->AddFirstRunTab(new_tab); } } -#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) // Initializes the initial profile, possibly doing some user prompting to pick // a fallback profile. Returns either @@ -375,7 +375,7 @@ // If the browser is launched due to activation on Windows native // notification, the profile id encoded in the notification launch id should // be chosen over all others. -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) base::FilePath profile_basename = NotificationLaunchId::GetNotificationLaunchProfileBaseName( parsed_command_line); @@ -383,7 +383,7 @@ profiles::SetLastUsedProfile(profile_basename); last_used_profile_set = true; } -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) bool profile_dir_specified = profiles::IsMultipleProfilesEnabled() && @@ -406,7 +406,7 @@ } StartupProfileInfo profile_info; -#if BUILDFLAG(IS_CHROMEOS_ASH) || defined(OS_ANDROID) +#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_ANDROID) profile_info = {ProfileManager::CreateInitialProfile(), StartupProfileMode::kBrowserWindow}; @@ -432,21 +432,21 @@ "Error creating initial profile."); return profile_info; } -#endif // BUILDFLAG(IS_CHROMEOS_ASH) || defined(OS_ANDROID) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_ANDROID) UMA_HISTOGRAM_LONG_TIMES( "Startup.CreateFirstProfile", base::Time::Now() - start); return profile_info; } -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) OSStatus KeychainCallback(SecKeychainEvent keychain_event, SecKeychainCallbackInfo* info, void* context) { return noErr; } -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) void ProcessSingletonNotificationCallbackImpl( const base::CommandLine& command_line, const base::FilePath& current_directory) { @@ -494,7 +494,7 @@ FROM_HERE, base::BindOnce(&ProcessSingletonNotificationCallbackImpl, command_line, current_directory)); } -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) } // namespace @@ -603,7 +603,7 @@ group_name); } -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // Android updates the metrics service dynamically depending on whether the // application is in the foreground or not. Do not start here unless // kUmaBackgroundSessions is enabled. @@ -613,7 +613,7 @@ g_browser_process->metrics_service()->CheckForClonedInstall(); -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // The last live timestamp is used to assess whether a browser crash occurred // due to a full system crash. Update the last live timestamp on a slow // schedule to get the bast possible accuracy for the assessment. @@ -630,12 +630,12 @@ return; bool is_first_run = false; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // On Android, first run is handled in Java code, and the C++ side of Chrome // doesn't know if this is the first run. This will cause some inaccuracy in // the UMA statistics, but this should be minor (first runs are rare). is_first_run = first_run::IsChromeFirstRun(); -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) // Record collected startup metrics. startup_metric_utils::RecordBrowserMainMessageLoopStart( @@ -715,7 +715,7 @@ // ----------------------------------------------------------------------------- // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #define DLLEXPORT __declspec(dllexport) // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. @@ -798,7 +798,7 @@ void ChromeBrowserMainParts::PostCreateMainMessageLoop() { TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostCreateMainMessageLoop"); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Initialize the upgrade detector here after `ChromeBrowserMainPartsAsh` // has had a chance to connect the DBus services. UpgradeDetector::GetInstance()->Init(); @@ -832,10 +832,10 @@ if (result_code_ == content::RESULT_CODE_NORMAL_EXIT) { // These members must be initialized before exiting this function normally. -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) DCHECK(browser_creator_.get()); #endif -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) DCHECK(master_prefs_.get()); #endif @@ -855,7 +855,7 @@ if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) return chrome::RESULT_CODE_MISSING_DATA; -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) if (first_run::IsChromeFirstRun()) { bool stats_default; if (GoogleUpdateSettings::GetCollectStatsConsentDefault(&stats_default)) { @@ -868,7 +868,7 @@ : metrics::EnableMetricsDefault::OPT_IN); } } -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) std::string locale = startup_data_->chrome_feature_list_creator()->actual_locale(); @@ -893,7 +893,7 @@ int ChromeBrowserMainParts::ApplyFirstRunPrefs() { // Android does first run in Java instead of native. // Chrome OS has its own out-of-box-experience code. -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) master_prefs_ = std::make_unique<first_run::MasterPrefs>(); std::unique_ptr<installer::InitialPreferences> installer_initial_prefs = @@ -923,13 +923,13 @@ prefs::kBrowserSuppressDefaultBrowserPrompt, master_prefs_->suppress_default_browser_prompt_for_version); } -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) if (!master_prefs_->confirm_to_quit) { local_state->SetBoolean(prefs::kBrowserSuppressDefaultBrowserPrompt, master_prefs_->confirm_to_quit); } -#endif // defined(OS_MAC) -#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#endif // BUILDFLAG(IS_MAC) +#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) return content::RESULT_CODE_NORMAL_EXIT; } @@ -941,9 +941,9 @@ return chrome::RESULT_CODE_MISSING_DATA; } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) chrome::MaybeShowInvalidUserDataDirWarningDialog(); -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) DCHECK(!user_data_dir_.empty()); @@ -951,7 +951,7 @@ MediaCaptureDevicesDispatcher::GetInstance(); // Android's first run is done in Java instead of native. -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) process_singleton_ = std::make_unique<ChromeProcessSingleton>( user_data_dir_, base::BindRepeating(&ProcessSingletonNotificationCallback)); @@ -959,7 +959,7 @@ // Cache first run state early. first_run::IsChromeFirstRun(); -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) PrefService* local_state = browser_process_->local_state(); @@ -977,19 +977,19 @@ browser_process_->Init(); } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // These members must be initialized before returning from this function. // Android doesn't use StartupBrowserCreator. browser_creator_ = std::make_unique<StartupBrowserCreator>(); // TODO(yfriedman): Refactor Android to re-use UMABrowsingActivityObserver chrome::UMABrowsingActivityObserver::Init(); -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // This is needed to enable ETW exporting. This is only relevant for the // browser process, as other processes enable it separately. base::trace_event::TraceEventETWExport::EnableETWExport(); -#endif // OS_WIN +#endif // BUILDFLAG(IS_WIN) // Reset the command line in the crash report details, since we may have // just changed it to include experiments. @@ -1000,14 +1000,14 @@ // Android does first run in Java instead of native. // Chrome OS has its own out-of-box-experience code. -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) if (first_run::IsChromeFirstRun()) { if (!parsed_command_line().HasSwitch(switches::kApp) && !parsed_command_line().HasSwitch(switches::kAppId)) { AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs); } -#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) // Create directory for user-level Native Messaging manifest files. This // makes it less likely that the directory will be created by third-party // software with incorrect owner or permission. See crbug.com/725513 . @@ -1016,19 +1016,20 @@ &user_native_messaging_dir)); if (!base::PathExists(user_native_messaging_dir)) base::CreateDirectory(user_native_messaging_dir); -#endif // defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) } -#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_OPENBSD) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD) // Set the product channel for crash reports. if (!crash_reporter::IsCrashpadEnabled()) { breakpad::SetChannelCrashKey( chrome::GetChannelName(chrome::WithExtendedStable(true))); } -#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_OPENBSD) +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || + // BUILDFLAG(IS_OPENBSD) -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) // Get the Keychain API to register for distributed notifications on the main // thread, which has a proper CFRunloop, instead of later on the I/O thread, // which doesn't. This ensures those notifications will get delivered @@ -1036,12 +1037,12 @@ // (Note that the callback mask here is empty. I don't want to register for // any callbacks, I just want to initialize the mechanism.) SecKeychainAddCallback(&KeychainCallback, 0, nullptr); -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_WIN) || defined(OS_MAC) || \ - (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ + (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) metrics::DesktopSessionDurationTracker::Initialize(); ProfileActivityMetricsRecorder::Initialize(); TouchModeStatsTracker::Initialize( @@ -1059,7 +1060,7 @@ // IsolateOrigins policy is taken care of through SiteIsolationPrefsObserver // (constructed and owned by BrowserProcessImpl). -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // The admin should also be able to use these policies to force Site Isolation // off (on Android; using enterprise policies to disable Site Isolation is not // supported on other platforms). Note that disabling either SitePerProcess @@ -1081,7 +1082,7 @@ command_line->GetSwitchValueNative(switches::kProfileEmail); if (!email_native.empty()) { std::string email; -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) email = base::WideToUTF8(email_native); #else email = std::move(email_native); @@ -1121,7 +1122,7 @@ metrics::CallStackProfileParams::Thread::kIo)); // Sampling multiple threads might cause overhead on Android and we don't want // to enable it unless the data is needed. -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) content::GetIOThreadTaskRunner({})->PostTask( FROM_HERE, base::BindOnce(&tracing::TracingSamplerProfiler::CreateOnChildThread)); @@ -1164,18 +1165,18 @@ for (auto& chrome_extra_part : chrome_extra_parts_) chrome_extra_part->PreProfileInit(); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Ephemeral profiles may have been left behind if the browser crashed. g_browser_process->profile_manager()->CleanUpEphemeralProfiles(); // Files of deleted profiles can also be left behind after a crash. g_browser_process->profile_manager()->CleanUpDeletedProfiles(); -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) #if BUILDFLAG(ENABLE_EXTENSIONS) javascript_dialog_extensions_client::InstallClient(); #endif // BUILDFLAG(ENABLE_EXTENSIONS) -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) if (base::FeatureList::IsEnabled(features::kViewsJSAppModalDialog)) InstallChromeJavaScriptAppModalDialogViewFactory(); else @@ -1208,7 +1209,7 @@ for (auto& chrome_extra_part : chrome_extra_parts_) chrome_extra_part->PreBrowserStart(); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Start the tab manager here so that we give the most amount of time for the // other services to start up before we start adjusting the oom priority. g_browser_process->GetTabManager()->Start(); @@ -1227,10 +1228,10 @@ TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostBrowserStart"); for (auto& chrome_extra_part : chrome_extra_parts_) chrome_extra_part->PostBrowserStart(); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Allow ProcessSingleton to process messages. process_singleton_->Unlock(); -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) // Set up a task to delete old WebRTC log files for all profiles. Use a delay // to reduce the impact on startup time. content::GetUIThreadTaskRunner({})->PostDelayedTask( @@ -1238,7 +1239,7 @@ base::BindOnce(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), base::Minutes(1)); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) if (base::FeatureList::IsEnabled(features::kWebUsb)) { web_usb_detector_ = std::make_unique<WebUsbDetector>(); content::GetUIThreadTaskRunner({base::TaskPriority::BEST_EFFORT}) @@ -1265,7 +1266,7 @@ SCOPED_UMA_HISTOGRAM_LONG_TIMER("Startup.PreMainMessageLoopRunImplLongTime"); -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // Windows parental controls calls can be slow, so we do an early init here // that calculates this value off of the UI thread. InitializeWinParentalControls(); @@ -1281,7 +1282,7 @@ // Record last shutdown time into a histogram. browser_shutdown::ReadLastShutdownInfo(); -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // On Windows, we use our startup as an opportunity to do upgrade/uninstall // tasks. Those care whether the browser is already running. On Linux/Mac, // upgrade/uninstall happen separately. @@ -1302,7 +1303,7 @@ ui::SelectFileDialog::SetFactory(new ChromeSelectFileDialogFactory()); #elif BUILDFLAG(IS_CHROMEOS_LACROS) ui::SelectFileDialog::SetFactory(new ui::SelectFileDialogLacros::Factory()); -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { bool is_managed = g_browser_process->local_state()->IsManagedPreference( @@ -1323,7 +1324,7 @@ #endif // defined(USE_AURA) // Android doesn't support extensions and doesn't implement ProcessSingleton. -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // If the command line specifies --pack-extension, attempt the pack extension // startup action and exit. if (parsed_command_line().HasSwitch(switches::kPackExtension)) { @@ -1383,7 +1384,7 @@ } downgrade_manager_.UpdateLastVersion(user_data_dir_); #endif // BUILDFLAG(ENABLE_DOWNGRADE_PROCESSING) -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) #if !BUILDFLAG(IS_CHROMEOS_ASH) // Initialize the chrome browser cloud management controller after @@ -1401,7 +1402,7 @@ ->GetSharedURLLoaderFactory()); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) // Wait for the chrome browser cloud management enrollment to finish. // If enrollment is not mandatory, this function returns immediately. // Abort the launch process if required enrollment fails. @@ -1410,9 +1411,9 @@ ->WaitUntilPolicyEnrollmentFinished()) { return chrome::RESULT_CODE_CLOUD_POLICY_ENROLLMENT_FAILED; } -#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Handle special early return paths (which couldn't be processed even earlier // as they require the process singleton to be held) first. @@ -1429,7 +1430,7 @@ // StartupBrowserCreator. bool process_command_line = true; if (!try_chrome.empty()) { -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // Setup.exe has determined that we need to run a retention experiment // and has lauched chrome to show the experiment UI. It is guaranteed that // no other Chrome is currently running as the process singleton was @@ -1456,11 +1457,11 @@ #else // We don't support retention experiments on Mac or Linux. return content::RESULT_CODE_NORMAL_EXIT; -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) } -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // Do the tasks if chrome has been upgraded while it was last running. if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line())) return content::RESULT_CODE_NORMAL_EXIT; @@ -1473,7 +1474,7 @@ // obtained but before potentially creating the first run sentinel). if (ChromeBrowserMainPartsWin::CheckMachineLevelInstall()) return chrome::RESULT_CODE_MACHINE_LEVEL_INSTALL_EXISTS; -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) // Desktop construction occurs here, (required before profile creation). PreProfileInit(); @@ -1494,7 +1495,7 @@ if (profile_info.mode == StartupProfileMode::kError) return content::RESULT_CODE_NORMAL_EXIT; -#if defined(OS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) +#if BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) // Create the spellcheck service. This will asynchronously retrieve the // Windows platform spellcheck dictionary language tags used to populate the // context menu for editable content. @@ -1505,13 +1506,13 @@ spellcheck::kWinDelaySpellcheckServiceInit)) { SpellcheckServiceFactory::GetForContext(profile); } -#endif // defined(OS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) +#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // The first run sentinel must be created after the process singleton was // grabbed and no early return paths were otherwise hit above. first_run::CreateSentinelIfNeeded(); -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) #if BUILDFLAG(ENABLE_BACKGROUND_MODE) // Autoload any profiles which are running background apps. @@ -1535,7 +1536,7 @@ ChromeWebUIControllerFactory::GetInstance()); ChromeUntrustedWebUIControllerFactory::RegisterInstance(); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) page_info::SetPageInfoClient(new ChromePageInfoClient()); #endif @@ -1553,7 +1554,7 @@ profile_init_manager_ = std::make_unique<ProfileInitManager>(this); } -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) // Execute first run specific code after the PrefService has been initialized // and preferences have been registered since some of the import code depends // on preferences. @@ -1569,9 +1570,9 @@ if (browser_shutdown::IsTryingToQuit()) return content::RESULT_CODE_NORMAL_EXIT; } -#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // Sets things up so that if we crash from this point on, a dialog will // popup asking the user to restart chrome. It is done this late to avoid // testing against a bunch of special cases that are taken care early on. @@ -1596,7 +1597,7 @@ base::BindOnce(&NetworkProfileBubble::CheckNetworkProfile, profile->GetPath())); } -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) #if BUILDFLAG(ENABLE_RLZ) && !BUILDFLAG(IS_CHROMEOS_ASH) // Init the RLZ library. This just binds the dll and schedules a task on the @@ -1619,7 +1620,7 @@ net::NetModule::SetResourceProvider(ChromeNetResourceProvider); media::SetLocalizedStringProvider(ChromeMediaLocalizedStringProvider); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // In unittest mode, this will do nothing. In normal mode, this will create // the global IntranetRedirectDetector instance, which will promptly go to // sleep for seven seconds (to avoid slowing startup), and wake up afterwards @@ -1643,7 +1644,7 @@ } #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && defined(OS_WIN) +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && BUILDFLAG(IS_WIN) printing::SetGetDisplayNameFunction(&printing::GetUserFriendlyName); #endif @@ -1664,7 +1665,7 @@ // On mobile, the need for a clean shutdown arises only when the application // comes to the foreground (i.e. when MetricsService::OnAppEnterForeground() is // called). See crbug.com/179143 for more details. -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Start watching for a hang. // // Depending on the client's ExtendedVariationsSafeMode experiment group (see @@ -1677,7 +1678,7 @@ // is being kept here for the time being for the control group of the // extended Variations Safe Mode experiment. browser_process_->metrics_service()->LogNeedForCleanShutdown(); -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) // This has to come before the first GetInstance() call. PreBrowserStart() // seems like a reasonable place to put this, except on Android, @@ -1698,12 +1699,12 @@ if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate)) { component_updater::RegisterComponentsForUpdate(); -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) // Exclude Android: SODA is not supported. // Exclude ChromeOS: SODA is independent of Component Updater. speech::SodaInstaller::GetInstance()->Init(profile->GetPrefs(), browser_process_->local_state()); -#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) // Only read and update the persisted sets when First-Party Sets component // will be installed. @@ -1733,7 +1734,7 @@ if (should_call_pre_main_loop_start_startup_on_variations_service_) variations_service->PerformPreMainMessageLoopStartup(); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // Just initialize the policy prefs service here. Variations seed fetching // will be initialized when the app enters foreground mode. variations_service->set_policy_pref_service(profile->GetPrefs()); @@ -1763,24 +1764,24 @@ if (started) { // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_WIN) || (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) +#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) // Initialize autoupdate timer. Timer callback costs basically nothing // when browser is not in persistent mode, so it's OK to let it ride on // the main thread. This needs to be done here because we don't want // to start the timer when Chrome is run inside a test harness. browser_process_->StartAutoupdateTimer(); -#endif // defined(OS_WIN) || (defined(OS_LINUX) || +#endif // BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || // BUILDFLAG(IS_CHROMEOS_LACROS)) // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) // On Linux, the running exe will be updated if an upgrade becomes // available while the browser is running. We need to save the last // modified time of the exe, so we can compare to determine if there is // an upgrade while the browser is kept alive by a persistent extension. upgrade_util::SaveLastModifiedTimeOfExe(); -#endif // defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) // Record now as the last successful chrome start. if (ShouldRecordActiveUse(parsed_command_line())) @@ -1794,7 +1795,7 @@ GetMainRunLoopInstance()->QuitWhenIdleClosure()); } browser_creator_.reset(); -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) PostBrowserStart(); @@ -1813,7 +1814,7 @@ return result_code_; } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) bool ChromeBrowserMainParts::ShouldInterceptMainMessageLoopRun() { // Some early return paths in PreMainMessageLoopRunImpl intentionally prevent // the main run loop from being created. Use this as a signal to indicate that @@ -1824,7 +1825,7 @@ void ChromeBrowserMainParts::WillRunMainMessageLoop( std::unique_ptr<base::RunLoop>& run_loop) { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // Chrome on Android does not use default MessageLoop. It has its own // Android specific MessageLoop NOTREACHED(); @@ -1838,12 +1839,12 @@ // a synchronous event around the main loop of a thread. TRACE_EVENT_NESTABLE_ASYNC_BEGIN0( "toplevel", "ChromeBrowserMainParts::MainMessageLoopRun", this); -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) } void ChromeBrowserMainParts::OnFirstIdle() { startup_metric_utils::RecordBrowserMainLoopFirstIdle(base::TimeTicks::Now()); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) sharing::ShareHistory::CreateForProfile( ProfileManager::GetPrimaryUserProfile()); #endif @@ -1853,7 +1854,7 @@ TRACE_EVENT_NESTABLE_ASYNC_END0( "toplevel", "ChromeBrowserMainParts::MainMessageLoopRun", this); TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostMainMessageLoopRun"); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // Chrome on Android does not use default MessageLoop. It has its own // Android specific MessageLoop NOTREACHED(); @@ -1894,11 +1895,11 @@ restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop(); browser_process_->StartTearDown(); -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) } void ChromeBrowserMainParts::PostDestroyThreads() { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // On Android, there is no quit/exit. So the browser's main message loop will // not finish. NOTREACHED(); @@ -1961,7 +1962,7 @@ ash::StatsReportingController::Shutdown(); ash::CrosSettings::Shutdown(); #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) } // Public members: @@ -1971,7 +1972,7 @@ chrome_extra_parts_.push_back(std::move(parts)); } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // static std::unique_ptr<base::RunLoop> ChromeBrowserMainParts::TakeRunLoopForTest() { DCHECK(GetMainRunLoopInstance());
diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h index 39874d1..d7063be 100644 --- a/chrome/browser/chrome_browser_main.h +++ b/chrome/browser/chrome_browser_main.h
@@ -52,7 +52,7 @@ // Add additional ChromeBrowserMainExtraParts. void AddParts(std::unique_ptr<ChromeBrowserMainExtraParts> parts); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Returns the RunLoop that would be run by MainMessageLoopRun. This is used // by InProcessBrowserTests to allow them to run until the BrowserProcess is // ready for the browser to exit. @@ -75,7 +75,7 @@ int PreCreateThreads() override; void PostCreateThreads() override; int PreMainMessageLoopRun() override; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) bool ShouldInterceptMainMessageLoopRun() override; #endif void WillRunMainMessageLoop( @@ -154,7 +154,7 @@ const base::CommandLine& parsed_command_line_; int result_code_ = content::RESULT_CODE_NORMAL_EXIT; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Create ShutdownWatcherHelper object for watching jank during shutdown. // Please keep |shutdown_watcher| as the first object constructed, and hence // it is destroyed last. @@ -164,7 +164,7 @@ absl::optional<base::WatchHangsInScope> watch_hangs_scope_; std::unique_ptr<WebUsbDetector> web_usb_detector_; -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) // Vector of additional ChromeBrowserMainExtraParts. // Parts are deleted in the inverse order they are added. @@ -184,7 +184,7 @@ std::unique_ptr<BrowserProcessImpl> browser_process_; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Browser creation happens on the Java side in Android. std::unique_ptr<StartupBrowserCreator> browser_creator_; @@ -197,13 +197,13 @@ // Members needed across shutdown methods. bool restart_last_session_ = false; -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) #if BUILDFLAG(ENABLE_DOWNGRADE_PROCESSING) downgrade::DowngradeManager downgrade_manager_; #endif -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) // Android's first run is done in Java instead of native. Chrome OS does not // use master preferences. std::unique_ptr<first_run::MasterPrefs> master_prefs_;
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 3ebeb0b..570a941 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -319,7 +319,7 @@ #include "url/third_party/mozilla/url_parse.h" #include "url/url_constants.h" -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "base/files/file_util.h" #include "base/strings/string_tokenizer.h" #include "base/win/win_util.h" @@ -329,7 +329,7 @@ #include "chrome/install_static/install_util.h" #include "chrome/services/util_win/public/mojom/util_win.mojom.h" #include "sandbox/win/src/sandbox_policy.h" -#elif defined(OS_MAC) +#elif BUILDFLAG(IS_MAC) #include "chrome/browser/browser_process_platform_part_mac.h" #include "chrome/browser/chrome_browser_main_mac.h" #include "chrome/browser/mac/auth_session_request.h" @@ -373,9 +373,9 @@ #include "services/service_manager/public/mojom/interface_provider_spec.mojom.h" #include "storage/browser/file_system/external_mount_points.h" #include "third_party/cros_system_api/switches/chrome_switches.h" -#elif defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) #include "chrome/browser/chrome_browser_main_linux.h" -#elif defined(OS_ANDROID) +#elif BUILDFLAG(IS_ANDROID) #include "base/android/application_status_listener.h" #include "base/feature_list.h" #include "chrome/android/features/dev_ui/buildflags.h" @@ -407,9 +407,9 @@ #if BUILDFLAG(DFMIFY_DEV_UI) #include "chrome/browser/dev_ui/android/dev_ui_loader_throttle.h" #endif // BUILDFLAG(DFMIFY_DEV_UI) -#elif defined(OS_POSIX) +#elif BUILDFLAG(IS_POSIX) #include "chrome/browser/chrome_browser_main_posix.h" -#elif defined(OS_FUCHSIA) +#elif BUILDFLAG(IS_FUCHSIA) #include "chrome/browser/chrome_browser_main_parts_fuchsia.h" #endif @@ -422,7 +422,7 @@ #include "chrome/browser/policy/networking/policy_cert_service_factory.h" #endif -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/media/unified_autoplay_config.h" @@ -438,38 +438,38 @@ #include "chrome/browser/webauthn/chrome_authenticator_request_delegate.h" #include "chrome/grit/chrome_unscaled_resources.h" // nogncheck crbug.com/1125897 #include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom.h" -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_WIN) || defined(OS_MAC) || \ - (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ + (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) #include "chrome/browser/browser_switcher/browser_switcher_navigation_throttle.h" #endif -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #include "components/crash/core/app/crash_switches.h" #include "components/crash/core/app/crashpad.h" #endif -#if defined(OS_POSIX) && !defined(OS_MAC) -#if !defined(OS_ANDROID) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) +#if !BUILDFLAG(IS_ANDROID) #include "base/debug/leak_annotations.h" #include "components/crash/core/app/breakpad_linux.h" -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) #include "components/crash/content/browser/crash_handler_host_linux.h" #endif -#if defined(OS_LINUX) || defined(OS_MAC) || defined(OS_WIN) || \ +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \ BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/enterprise/connectors/device_trust/navigation_throttle.h" -#endif // defined(OS_LINUX) || defined(OS_MAC) || defined(OS_WIN) || +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || // BUILDFLAG(IS_CHROMEOS_ASH) // TODO(crbug.com/939205): Once the upcoming App Service is available, use a // single navigation throttle to display the intent picker on all platforms. -#if !defined(OS_ANDROID) -#if defined(OS_CHROMEOS) +#if !BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_CHROMEOS) #include "chrome/browser/apps/intent_helper/common_apps_navigation_throttle.h" #include "chrome/browser/policy/system_features_disable_list_policy_handler.h" #else @@ -483,11 +483,11 @@ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h" #endif -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) #include "chrome/browser/chrome_browser_main_extra_parts_linux.h" #elif defined(USE_OZONE) #include "chrome/browser/chrome_browser_main_extra_parts_ozone.h" @@ -601,7 +601,7 @@ #include "ui/base/ui_base_switches.h" #endif -#if BUILDFLAG(USE_MINIKIN_HYPHENATION) && !defined(OS_ANDROID) +#if BUILDFLAG(USE_MINIKIN_HYPHENATION) && !BUILDFLAG(IS_ANDROID) #include "chrome/browser/component_updater/hyphenation_component_installer.h" #endif @@ -625,7 +625,7 @@ using content::SiteInstance; using content::WebContents; -#if defined(OS_POSIX) +#if BUILDFLAG(IS_POSIX) using content::PosixFileDescriptorInfo; #endif @@ -643,7 +643,8 @@ namespace { -#if defined(OS_WIN) && !defined(COMPONENT_BUILD) && !defined(ADDRESS_SANITIZER) +#if BUILDFLAG(IS_WIN) && !defined(COMPONENT_BUILD) && \ + !defined(ADDRESS_SANITIZER) // Enables pre-launch Code Integrity Guard (CIG) for Chrome renderers, when // running on Windows 10 1511 and above. See // https://blogs.windows.com/blog/tag/code-integrity-guard/. @@ -656,7 +657,7 @@ const base::Feature kNetworkServiceCodeIntegrity{ "NetworkServiceCodeIntegrity", base::FEATURE_DISABLED_BY_DEFAULT}; -#endif // defined(OS_WIN) && !defined(COMPONENT_BUILD) && +#endif // BUILDFLAG(IS_WIN) && !defined(COMPONENT_BUILD) && // !defined(ADDRESS_SANITIZER) bool IsSSLErrorOverrideAllowedForOrigin(const GURL& request_url, @@ -775,7 +776,7 @@ return true; } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Check if the current url is allowlisted based on a list of allowlisted urls. bool IsURLAllowlisted(const GURL& current_url, base::Value::ConstListView allowlisted_urls) { @@ -838,7 +839,7 @@ NOTREACHED(); } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); PrefService* prefs = profile->GetPrefs(); @@ -861,15 +862,15 @@ // allow autoplay within the iframe. Only allow a nesting of single depth. result = blink::mojom::AutoplayPolicy::kNoUserGestureRequired; } -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) return result; } -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) int GetCrashSignalFD(const base::CommandLine& command_line) { return crashpad::CrashHandlerHost::Get()->GetDeathSignalSocket(); } -#elif defined(OS_POSIX) && !defined(OS_MAC) +#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( const std::string& process_type) { base::FilePath dumps_path; @@ -932,7 +933,7 @@ return -1; } -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) void SetApplicationLocaleOnIOThread(const std::string& locale) { DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -1042,17 +1043,17 @@ // This is a copy of the code in policy_loader_win.cc but it's ok to duplicate // as a new central class to replace those checks is in the making. bool ShouldHonorPolicies() { -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) bool is_enterprise_version = base::win::OSInfo::GetInstance()->version_type() != base::win::SUITE_HOME; return base::win::IsEnrolledToDomain() || (base::win::IsDeviceRegisteredWithManagement() && is_enterprise_version); -#else // defined(OS_WIN) +#else // BUILDFLAG(IS_WIN) // TODO(pastarmovj): Replace this with check for MacOS and the new management // service once it is ready. return true; -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) } // Used by Enterprise policy. Disable blocking of navigations toward external @@ -1179,7 +1180,8 @@ } } -#if defined(OS_WIN) && !defined(COMPONENT_BUILD) && !defined(ADDRESS_SANITIZER) +#if BUILDFLAG(IS_WIN) && !defined(COMPONENT_BUILD) && \ + !defined(ADDRESS_SANITIZER) // Returns the full path to |module_name|. Both dev builds (where |module_name| // is in the current executable's directory) and proper installs (where // |module_name| is in a versioned sub-directory of the current executable's @@ -1201,7 +1203,7 @@ // directory. This is the expected location of modules for dev builds. return exe_dir.Append(module_name); } -#endif // defined(OS_WIN) && !defined(COMPONENT_BUILD) && +#endif // BUILDFLAG(IS_WIN) && !defined(COMPONENT_BUILD) && // !defined(ADDRESS_SANITIZER) void MaybeAddThrottle( @@ -1300,7 +1302,7 @@ registry->RegisterDictionaryPref( prefs::kDevToolsBackgroundServicesExpirationDict); registry->RegisterBooleanPref(prefs::kSignedHTTPExchangeEnabled, true); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) registry->RegisterBooleanPref(prefs::kAutoplayAllowed, false); registry->RegisterListPref(prefs::kAutoplayAllowlist); registry->RegisterIntegerPref(prefs::kFetchKeepaliveDurationOnShutdown, 0); @@ -1314,7 +1316,7 @@ registry->RegisterListPref(prefs::kSSLErrorOverrideAllowedForOrigins); registry->RegisterBooleanPref( prefs::kSuppressDifferentOriginSubframeJSDialogs, true); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) registry->RegisterBooleanPref(prefs::kWebXRImmersiveArEnabled, true); #endif registry->RegisterBooleanPref(prefs::kPromptOnMultipleMatchingCertificates, @@ -1353,10 +1355,10 @@ content::MainFunctionParams parameters) { std::unique_ptr<ChromeBrowserMainParts> main_parts; // Construct the Main browser parts based on the OS type. -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) main_parts = std::make_unique<ChromeBrowserMainPartsWin>( std::move(parameters), &startup_data_); -#elif defined(OS_MAC) +#elif BUILDFLAG(IS_MAC) main_parts = std::make_unique<ChromeBrowserMainPartsMac>( std::move(parameters), &startup_data_); #elif BUILDFLAG(IS_CHROMEOS_ASH) @@ -1365,16 +1367,16 @@ #elif BUILDFLAG(IS_CHROMEOS_LACROS) main_parts = std::make_unique<ChromeBrowserMainPartsLacros>( std::move(parameters), &startup_data_); -#elif defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) main_parts = std::make_unique<ChromeBrowserMainPartsLinux>( std::move(parameters), &startup_data_); -#elif defined(OS_ANDROID) +#elif BUILDFLAG(IS_ANDROID) main_parts = std::make_unique<ChromeBrowserMainPartsAndroid>( std::move(parameters), &startup_data_); -#elif defined(OS_POSIX) +#elif BUILDFLAG(IS_POSIX) main_parts = std::make_unique<ChromeBrowserMainPartsPosix>( std::move(parameters), &startup_data_); -#elif defined(OS_FUCHSIA) +#elif BUILDFLAG(IS_FUCHSIA) main_parts = std::make_unique<ChromeBrowserMainPartsFuchsia>( std::move(parameters), &startup_data_); #else @@ -1384,7 +1386,7 @@ #endif bool add_profiles_extra_parts = true; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) if (startup_data_.HasBuiltProfilePrefService()) add_profiles_extra_parts = false; #endif @@ -1399,7 +1401,7 @@ std::make_unique<ChromeBrowserMainExtraPartsViewsLacros>()); // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#elif defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) main_parts->AddParts( std::make_unique<ChromeBrowserMainExtraPartsViewsLinux>()); #else @@ -1416,7 +1418,7 @@ main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsLacros>()); #endif -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsLinux>()); #elif defined(USE_OZONE) main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsOzone>()); @@ -1517,7 +1519,7 @@ } bool ChromeContentBrowserClient::AllowGpuLaunchRetryOnIOThread() { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const base::android::ApplicationState app_state = base::android::ApplicationStatusListener::GetState(); return base::android::APPLICATION_STATE_UNKNOWN == app_state || @@ -1549,7 +1551,7 @@ host->GetID(), profile->IsOffTheRecord(), profile->GetPath())); #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // Data cannot be persisted if the profile is off the record. host->AddFilter( new cdm::CdmMessageFilterAndroid(!profile->IsOffTheRecord(), false)); @@ -1575,7 +1577,7 @@ if (!profile) return url; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // If the input |url| should be assigned to the Instant renderer, make its // effective URL distinct from other URLs on the search provider's domain. // This needs to happen even if |url| corresponds to an isolated origin; see @@ -1612,13 +1614,13 @@ } bool ChromeContentBrowserClient::ShouldUseMobileFlingCurve() { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) return true; #elif BUILDFLAG(IS_CHROMEOS_ASH) return ash::TabletMode::IsInTabletMode(); #else return false; -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) } bool ChromeContentBrowserClient::ShouldUseProcessPerSite( @@ -1635,7 +1637,7 @@ return true; } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) if (search::ShouldUseProcessPerSiteForInstantSiteURL(site_url, profile)) return true; #endif @@ -1663,7 +1665,7 @@ if (IsTopChromeWebUIURL(site_url)) return false; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Instant renderers should not use a spare process, because they require // passing switches::kInstantProcess to the renderer process when it // launches. A spare process is launched earlier, before it is known which @@ -1884,7 +1886,7 @@ if (!profile) return true; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Instant URLs should only be in the instant process and instant process // should only have Instant URLs. InstantService* instant_service = @@ -1962,7 +1964,7 @@ if (!profile) return; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) // Remember the ID of the Instant process to signal the renderer process // on startup in |AppendExtraCommandLineSwitches| below. if (search::ShouldAssignURLToInstantRenderer(site_instance->GetSiteURL(), @@ -2016,7 +2018,7 @@ // Sign-in process isolation is not needed on Android, see // https://crbug.com/739418. -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) isolated_origin_list.push_back( url::Origin::Create(GaiaUrls::GetInstance()->gaia_url())); #endif @@ -2156,15 +2158,15 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( base::CommandLine* command_line, int child_process_id) { -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) std::unique_ptr<metrics::ClientInfo> client_info = GoogleUpdateSettings::LoadMetricsClientInfo(); if (client_info) { command_line->AppendSwitchASCII(switches::kMetricsClientID, client_info->client_id); } -#elif defined(OS_POSIX) -#if defined(OS_ANDROID) +#elif BUILDFLAG(IS_POSIX) +#if BUILDFLAG(IS_ANDROID) bool enable_crash_reporter = true; #else bool enable_crash_reporter = false; @@ -2287,7 +2289,7 @@ if (prefs->GetBoolean(prefs::kPrintPreviewDisabled)) command_line->AppendSwitch(switches::kDisablePrintPreview); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) InstantService* instant_service = InstantServiceFactory::GetForProfile(profile); if (instant_service && @@ -2351,19 +2353,19 @@ switches::kDisableTargetBlankImpliesNoOpener); } -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // Communicating to content/ for BackForwardCache. if (prefs->HasPrefPath(policy::policy_prefs::kBackForwardCacheEnabled) && !prefs->GetBoolean(policy::policy_prefs::kBackForwardCacheEnabled)) { command_line->AppendSwitch(switches::kDisableBackForwardCache); } -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) } MaybeAppendBlinkSettingsSwitchForFieldTrial(browser_command_line, command_line); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // If the platform is Android, force the distillability service on. command_line->AppendSwitch(switches::kEnableDistillabilityService); #endif @@ -2479,7 +2481,7 @@ ThreadProfilerConfiguration::Get()->AppendCommandLineSwitchForChildProcess( command_line); -#if defined(OS_LINUX) || defined(OS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) // Processes may only query perf_event_open with the BPF sandbox disabled. if (browser_command_line.HasSwitch(switches::kEnableThreadInstructionCount) && command_line->HasSwitch(sandbox::policy::switches::kNoSandbox)) { @@ -2492,7 +2494,7 @@ command_line->AppendSwitchASCII(switches::kChangeStackGuardOnFork, switches::kChangeStackGuardOnForkEnabled); } -#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) } std::string @@ -2846,14 +2848,14 @@ device::GeolocationManager* ChromeContentBrowserClient::GetGeolocationManager() { -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) return g_browser_process->platform_part()->geolocation_manager(); #else return nullptr; #endif } -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) bool ChromeContentBrowserClient::ShouldUseGmsCoreGeolocationProvider() { // Indicate that Chrome uses the GMS core location provider. return true; @@ -2922,7 +2924,7 @@ return; } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) bool ChromeContentBrowserClient::ShouldDenyRequestOnCertificateError( const GURL main_page_url) { // Desktop Reader Mode pages should never load resources with certificate @@ -2937,7 +2939,7 @@ namespace { -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) blink::mojom::PreferredColorScheme ToBlinkPreferredColorScheme( ui::NativeTheme::PreferredColorScheme native_theme_scheme) { switch (native_theme_scheme) { @@ -2949,7 +2951,7 @@ NOTREACHED(); } -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) // Returns true if preferred color scheme is modified based on at least one of // the following - @@ -2962,7 +2964,7 @@ const ui::NativeTheme* native_theme) { auto old_preferred_color_scheme = web_prefs->preferred_color_scheme; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) auto* delegate = TabAndroid::FromWebContents(web_contents) ? static_cast<android::TabWebContentsDelegateAndroid*>( web_contents->GetDelegate()) @@ -2977,7 +2979,7 @@ // Update based on native theme scheme. web_prefs->preferred_color_scheme = ToBlinkPreferredColorScheme(native_theme->GetPreferredColorScheme()); -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) bool force_light = false; // Force a light preferred color scheme on certain URLs if kWebUIDarkMode is @@ -3249,7 +3251,7 @@ void ChromeContentBrowserClient::MaybeOverrideManifest( content::RenderFrameHost* render_frame_host, blink::mojom::ManifestPtr& manifest) { -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) Profile* profile = Profile::FromBrowserContext(render_frame_host->GetBrowserContext()); auto* provider = web_app::WebAppProvider::GetForWebApps(profile); @@ -3260,7 +3262,7 @@ } content::TtsPlatform* ChromeContentBrowserClient::GetTtsPlatform() { -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) content::TtsController::GetInstance()->SetTtsEngineDelegate( TtsExtensionEngine::GetInstance()); #endif @@ -3282,7 +3284,7 @@ // Fill font preferences. These are not registered on Android // - http://crbug.com/308033, http://crbug.com/696364. -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitStandardFontFamilyMap, &web_prefs->standard_font_family_map); @@ -3336,7 +3338,7 @@ web_prefs->allow_running_insecure_content = prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) web_prefs->font_scale_factor = static_cast<float>(prefs->GetDouble(prefs::kWebKitFontScaleFactor)); web_prefs->force_enable_zoom = @@ -3355,7 +3357,7 @@ } #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) web_prefs->password_echo_enabled = prefs->GetBoolean(prefs::kWebKitPasswordEchoEnabled); #else @@ -3411,7 +3413,7 @@ "holdback_web", false); if (web_contents) { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) auto* delegate = TabAndroid::FromWebContents(web_contents) ? static_cast<android::TabWebContentsDelegateAndroid*>( web_contents->GetDelegate()) @@ -3426,10 +3428,10 @@ web_prefs->force_dark_mode_enabled = delegate->IsForceDarkWebContentEnabled(); } -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) // web_app_scope value is platform specific. -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) if (delegate) web_prefs->web_app_scope = delegate->GetManifestScope(); #elif BUILDFLAG(ENABLE_EXTENSIONS) @@ -3592,7 +3594,7 @@ web_prefs->text_track_window_radius = style->window_radius; } -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // If the pref is not set, the default value (true) will be used: web_prefs->webxr_immersive_ar_allowed = prefs->GetBoolean(prefs::kWebXRImmersiveArEnabled); @@ -3626,7 +3628,7 @@ bool preferred_color_scheme_updated = UpdatePreferredColorScheme( prefs, web_contents->GetLastCommittedURL(), web_contents, GetWebTheme()); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) bool force_dark_mode_changed = false; auto* delegate = TabAndroid::FromWebContents(web_contents) ? static_cast<android::TabWebContentsDelegateAndroid*>( @@ -3641,7 +3643,7 @@ #endif return new_autoplay_policy_needed || extra_parts_need_update || -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) force_dark_mode_changed || #endif preferred_color_scheme_updated; @@ -3662,15 +3664,15 @@ handler->AddHandlerPair(&HandleChromeAboutAndChromeSyncRewrite, BrowserURLHandler::null_handler()); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // Handler to rewrite chrome://newtab on Android. handler->AddHandlerPair(&chrome::android::HandleAndroidNativePageURL, BrowserURLHandler::null_handler()); -#else // defined(OS_ANDROID) +#else // BUILDFLAG(IS_ANDROID) // Handler to rewrite chrome://newtab for InstantExtended. handler->AddHandlerPair(&search::HandleNewTabURLRewrite, &search::HandleNewTabURLReverseRewrite); -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) // chrome: & friends. handler->AddHandlerPair(&ChromeContentBrowserClient::HandleWebUI, @@ -3834,12 +3836,12 @@ } } -#if defined(OS_POSIX) && !defined(OS_MAC) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, PosixFileDescriptorInfo* mappings) { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) base::MemoryMappedFile::Region region; int fd = ui::GetMainAndroidPackFd(®ion); mappings->ShareWithRegion(kAndroidUIResourcesPakDescriptor, fd, region); @@ -3863,15 +3865,15 @@ base::FilePath app_data_path; base::PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); DCHECK(!app_data_path.empty()); -#endif // defined(OS_ANDROID) +#endif // BUILDFLAG(IS_ANDROID) int crash_signal_fd = GetCrashSignalFD(command_line); if (crash_signal_fd >= 0) { mappings->Share(kCrashDumpSignal, crash_signal_fd); } } -#endif // defined(OS_POSIX) && !defined(OS_MAC) +#endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) std::wstring ChromeContentBrowserClient::GetAppContainerSidForSandboxType( sandbox::mojom::Sandbox sandbox_type) { // TODO(wfh): Add support for more process types here. crbug.com/499523 @@ -4028,7 +4030,7 @@ return IsAudioProcessHighPriorityEnabled(); } -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) void ChromeContentBrowserClient:: RegisterMojoBinderPoliciesForSameOriginPrerendering( @@ -4047,7 +4049,7 @@ content::BrowserContext* browser_context = site_instance->GetBrowserContext(); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) ServiceTabLauncher::GetInstance()->LaunchTab(browser_context, params, std::move(callback)); #else @@ -4113,7 +4115,7 @@ &throttles); #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // TODO(davidben): This is insufficient to integrate with prerender properly. // https://crbug.com/370595 prerender::NoStatePrefetchContents* no_state_prefetch_contents = @@ -4160,9 +4162,9 @@ } #endif -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) auto url_to_apps_throttle = -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) apps::CommonAppsNavigationThrottle::MaybeCreate(handle); #else apps::AppsNavigationThrottle::MaybeCreate(handle); @@ -4245,15 +4247,15 @@ &throttles); } -#if defined(OS_LINUX) || defined(OS_MAC) || defined(OS_WIN) || \ +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \ BUILDFLAG(IS_CHROMEOS_ASH) MaybeAddThrottle(enterprise_connectors::DeviceTrustNavigationThrottle:: MaybeCreateThrottleFor(handle), &throttles); -#endif // defined(OS_LINUX) || defined(OS_MAC) || defined(OS_WIN) || +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || // BUILDFLAG(IS_CHROMEOS_ASH) -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) MaybeAddThrottle(DevToolsWindow::MaybeCreateNavigationThrottle(handle), &throttles); @@ -4279,8 +4281,8 @@ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_WIN) || defined(OS_MAC) || \ - (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ + (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) MaybeAddThrottle(browser_switcher::BrowserSwitcherNavigationThrottle:: MaybeCreateThrottleFor(handle), &throttles); @@ -4292,7 +4294,7 @@ &throttles); #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) if (__builtin_available(macOS 10.15, *)) { MaybeAddThrottle(MaybeCreateAuthSessionThrottleFor(handle), &throttles); } @@ -4365,7 +4367,7 @@ std::unique_ptr<content::DevToolsManagerDelegate> ChromeContentBrowserClient::CreateDevToolsManagerDelegate() { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) return std::make_unique<DevToolsManagerDelegateAndroid>(); #else return std::make_unique<ChromeDevToolsManagerDelegate>(); @@ -4496,7 +4498,7 @@ base::CommandLine* to_command_line, const base::CommandLine& from_command_line, version_info::Channel channel) { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) const version_info::Channel kMaxDisableEncryptionChannel = version_info::Channel::BETA; #else @@ -4645,7 +4647,7 @@ GetPrerenderCanceler(wc_getter))); } -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) std::string client_data_header; bool is_tab_large_enough = false; bool is_custom_tab = false; @@ -4677,7 +4679,7 @@ profile->GetPrefs()->GetInteger(prefs::kForceYouTubeRestrict), profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps)}; result.push_back(std::make_unique<GoogleURLLoaderThrottle>( -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) client_data_header, is_tab_large_enough, #endif std::move(dynamic_params))); @@ -4695,7 +4697,7 @@ request.destination, frame_tree_node_id)); #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) auto delegate = std::make_unique<signin::HeaderModificationDelegateImpl>( profile, /*incognito_enabled=*/!is_custom_tab); #else @@ -4828,7 +4830,7 @@ int child_id_; }; -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) bool IsSystemFeatureDisabled(policy::SystemFeature system_feature) { return policy::SystemFeaturesDisableListPolicyHandler:: IsSystemFeatureDisabled(system_feature, g_browser_process->local_state()); @@ -5405,7 +5407,7 @@ return bluetooth_delegate_.get(); } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) void ChromeContentBrowserClient::CreateDeviceInfoService( content::RenderFrameHost* render_frame_host, mojo::PendingReceiver<blink::mojom::DeviceAPIService> receiver) { @@ -5543,7 +5545,7 @@ } #endif // BUILDFLAG(ENABLE_EXTENSIONS) -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) // Main frame external protocols are handled by // InterceptNavigationResourceThrottle. if (is_main_frame) @@ -5617,7 +5619,7 @@ } } -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // TODO(crbug.com/1003960): Remove when issue is resolved. if (url->SchemeIs(content::kChromeUIScheme) && url->host() == chrome::kChromeUIWelcomeWin10Host) { @@ -5628,7 +5630,7 @@ *url = url->ReplaceComponents(replacements); return true; } -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) if (!ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL( browser_context, *url)) { @@ -5649,7 +5651,7 @@ } #endif -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) if (IsSystemFeatureURLDisabled(*url)) { *url = ReplaceURLHostAndPath(*url, chrome::kChromeUIAppDisabledHost, ""); return true; @@ -5663,7 +5665,7 @@ content::BrowserContext* browser_context, const GURL& url, base::OnceCallback<void(bool, int, int)> callback) { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) return false; #else payments::PaymentRequestDisplayManagerFactory::GetInstance() @@ -5677,7 +5679,7 @@ bool ChromeContentBrowserClient::HandleWebUIReverse( GURL* url, content::BrowserContext* browser_context) { -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // TODO(crbug.com/1003960): Remove when issue is resolved. // No need to actually reverse-rewrite the URL, but return true to update the // displayed URL when rewriting chrome://welcome-win10 to chrome://welcome. @@ -5685,7 +5687,7 @@ url->host() == chrome::kChromeUIWelcomeHost) { return true; } -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) // No need to actually reverse-rewrite the URL, but return true to update the // displayed URL when rewriting chrome://help to chrome://settings/help. @@ -5777,7 +5779,7 @@ ->ReportNetworkServiceDataUse(network_traffic_annotation_id_hash, recv_bytes, sent_bytes); } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) task_manager::TaskManagerInterface::UpdateAccumulatedStatsNetworkForRoute( render_frame_host_id, recv_bytes, sent_bytes); #endif @@ -5840,7 +5842,7 @@ absl::optional<gfx::ImageSkia> ChromeContentBrowserClient::GetProductLogo() { // This icon is available on Android, but adds 19KiB to the APK. Since it // isn't used on Android we exclude it to avoid bloat. -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) return absl::optional<gfx::ImageSkia>( *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_PRODUCT_LOGO_256)); @@ -5877,7 +5879,7 @@ return AccessibilityLabelsServiceFactory::GetForProfile(profile)->GetAXMode(); } -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) content::ContentBrowserClient::WideColorGamutHeuristic ChromeContentBrowserClient::GetWideColorGamutHeuristic() { if (viz::AlwaysUseWideColorGamut() || @@ -5986,7 +5988,7 @@ bool ChromeContentBrowserClient::ShouldLoadExtraIcuDataFile( std::string* split_name) { -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) *split_name = "extra_icu"; return extra_icu::ModuleProvider::IsModuleInstalled(); #else @@ -6005,7 +6007,7 @@ ->IsFullCookieAccessAllowed(url, site_for_cookies, top_frame_origin); } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) base::OnceClosure ChromeContentBrowserClient::FetchRemoteSms( content::WebContents* web_contents, const std::vector<url::Origin>& origin_list, @@ -6192,7 +6194,7 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted( content::BrowserContext* context) { -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) DVLOG(1) << "OnKeepaliveRequestStarted: " << num_keepalive_requests_ << " ==> " << num_keepalive_requests_ + 1; ++num_keepalive_requests_; @@ -6218,11 +6220,11 @@ std::make_unique<ScopedKeepAlive>( KeepAliveOrigin::BROWSER, KeepAliveRestartOption::DISABLED))); } -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) } void ChromeContentBrowserClient::OnKeepaliveRequestFinished() { -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) DCHECK_GT(num_keepalive_requests_, 0u); DVLOG(1) << "OnKeepaliveRequestFinished: " << num_keepalive_requests_ << " ==> " << num_keepalive_requests_ - 1; @@ -6233,10 +6235,10 @@ // This deletes the keep alive handle attached to the timer function and // unblock the shutdown sequence. } -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) } -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) bool ChromeContentBrowserClient::SetupEmbedderSandboxParameters( sandbox::mojom::Sandbox sandbox_type, sandbox::SeatbeltExecClient* client) { @@ -6257,11 +6259,11 @@ return false; } -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) void ChromeContentBrowserClient::GetHyphenationDictionary( base::OnceCallback<void(const base::FilePath&)> callback) { -#if BUILDFLAG(USE_MINIKIN_HYPHENATION) && !defined(OS_ANDROID) +#if BUILDFLAG(USE_MINIKIN_HYPHENATION) && !BUILDFLAG(IS_ANDROID) component_updater::HyphenationComponentInstallerPolicy:: GetHyphenationDictionary(std::move(callback)); #endif @@ -6315,7 +6317,7 @@ AttachUniversalWebContentsObservers(web_contents); } -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) base::TimeDelta ChromeContentBrowserClient::GetKeepaliveTimerTimeout( content::BrowserContext* context) { Profile* profile = Profile::FromBrowserContext(context); @@ -6350,7 +6352,7 @@ void ChromeContentBrowserClient::FlushBackgroundAttributions( base::OnceClosure callback) { DCHECK(!callback.is_null()); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) std::move(callback).Run(); #else if (!background_attribution_flusher_) {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index d14f659..e5a3109 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -105,7 +105,7 @@ } #endif -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) class BackgroundAttributionFlusher; #endif @@ -306,7 +306,7 @@ std::string GetGeolocationApiKey() override; device::GeolocationManager* GetGeolocationManager() override; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) bool ShouldUseGmsCoreGeolocationProvider() override; #endif scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext() @@ -322,7 +322,7 @@ bool strict_enforcement, base::OnceCallback<void(content::CertificateRequestResultType)> callback) override; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) bool ShouldDenyRequestOnCertificateError(const GURL main_page_url) override; #endif base::OnceClosure SelectClientCertificate( @@ -408,13 +408,13 @@ void OverridePageVisibilityState( content::RenderFrameHost* render_frame_host, content::PageVisibilityState* visibility_state) override; -#if defined(OS_POSIX) && !defined(OS_MAC) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) void GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) override; -#endif // defined(OS_POSIX) && !defined(OS_MAC) -#if defined(OS_WIN) +#endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_WIN) bool PreSpawnChild(sandbox::TargetPolicy* policy, sandbox::mojom::Sandbox sandbox_type, ChildSpawnFlags flags) override; @@ -565,7 +565,7 @@ content::RenderFrameHost* render_frame_host, mojo::PendingReceiver<blink::mojom::WebUsbService> receiver) override; content::BluetoothDelegate* GetBluetoothDelegate() override; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) void CreateDeviceInfoService( content::RenderFrameHost* render_frame_host, mojo::PendingReceiver<blink::mojom::DeviceAPIService> receiver) override; @@ -654,7 +654,7 @@ ui::AXMode GetAXModeForBrowserContext( content::BrowserContext* browser_context) override; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) ContentBrowserClient::WideColorGamutHeuristic GetWideColorGamutHeuristic() override; #endif @@ -688,7 +688,7 @@ const net::SiteForCookies& site_for_cookies, const absl::optional<url::Origin>& top_frame_origin) override; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) base::OnceClosure FetchRemoteSms( content::WebContents* web_contents, const std::vector<url::Origin>& origin_list, @@ -737,11 +737,11 @@ content::BrowserContext* browser_context) override; void OnKeepaliveRequestFinished() override; -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) bool SetupEmbedderSandboxParameters( sandbox::mojom::Sandbox sandbox_type, sandbox::SeatbeltExecClient* client) override; -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) void GetHyphenationDictionary( base::OnceCallback<void(const base::FilePath&)>) override; @@ -752,9 +752,9 @@ std::unique_ptr<content::IdentityRequestDialogController> CreateIdentityRequestDialogController() override; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) base::TimeDelta GetKeepaliveTimerTimeout(content::BrowserContext* context); -#endif // !defined(OS_ANDROID) +#endif // !BUILDFLAG(IS_ANDROID) bool SuppressDifferentOriginSubframeJSDialogs( content::BrowserContext* browser_context) override; @@ -860,7 +860,7 @@ handshake_client, WillCreateWebTransportCallback callback); -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) void OnKeepaliveTimerFired( std::unique_ptr<ScopedKeepAlive> keep_alive_handle); #endif @@ -878,7 +878,7 @@ StartupData startup_data_; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) std::unique_ptr<BackgroundAttributionFlusher> background_attribution_flusher_; #else std::unique_ptr<ChromeSerialDelegate> serial_delegate_; @@ -895,7 +895,7 @@ // thread because it needs to access the Local State prefs. std::vector<base::FilePath> network_contexts_parent_directory_; -#if !defined(OS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) uint64_t num_keepalive_requests_ = 0; base::OneShotTimer keepalive_timer_; base::TimeTicks keepalive_deadline_;
diff --git a/chrome/browser/client_hints/client_hints_browsertest.cc b/chrome/browser/client_hints/client_hints_browsertest.cc index 856e151..ee4d9428 100644 --- a/chrome/browser/client_hints/client_hints_browsertest.cc +++ b/chrome/browser/client_hints/client_hints_browsertest.cc
@@ -2880,116 +2880,6 @@ EXPECT_EQ(0u, third_party_client_hints_count_seen()); } -class AcceptCHFrameObserverInterceptor { - public: - AcceptCHFrameObserverInterceptor() - : interceptor_(base::BindRepeating( - &AcceptCHFrameObserverInterceptor::InterceptURLRequest, - base::Unretained(this))) {} - - void set_accept_ch_frame( - std::vector<network::mojom::WebClientHintsType> frame) { - accept_ch_frame_ = frame; - } - - private: - bool InterceptURLRequest(URLLoaderInterceptor::RequestParams* params) { - if (!accept_ch_frame_ || !params->url_request.trusted_params || - !params->url_request.trusted_params->accept_ch_frame_observer) { - return false; - } - - std::vector<network::mojom::WebClientHintsType> hints; - for (auto hint : accept_ch_frame_.value()) { - std::string header = network::GetClientHintToNameMap().at(hint); - if (!params->url_request.headers.HasHeader(header)) - hints.push_back(hint); - } - - if (hints.empty()) - return false; - - mojo::Remote<network::mojom::AcceptCHFrameObserver> remote(std::move( - params->url_request.trusted_params->accept_ch_frame_observer)); - remote->OnAcceptCHFrameReceived(params->url_request.url, hints, - base::DoNothing()); - // At this point it's expected that either the remote's callback will be - // called or the URLLoader will be destroyed to make way for a new one. - // As this is essentially unobservable, RunUntilIdle must be used. - base::RunLoop().RunUntilIdle(); - return false; - } - - URLLoaderInterceptor interceptor_; - absl::optional<std::vector<network::mojom::WebClientHintsType>> - accept_ch_frame_; -}; - -// Replace the request interceptor with an AcceptCHFrameObserverInterceptor. -class ClientHintsAcceptCHFrameObserverBrowserTest - : public ClientHintsBrowserTest { - public: - void SetUpOnMainThread() override { - host_resolver()->AddRule("*", "127.0.0.1"); - accept_ch_frame_observer_interceptor_ = - std::make_unique<AcceptCHFrameObserverInterceptor>(); - } - - void TearDownOnMainThread() override { - accept_ch_frame_observer_interceptor_.reset(); - } - - void set_accept_ch_frame( - std::vector<network::mojom::WebClientHintsType> frame) { - accept_ch_frame_observer_interceptor_->set_accept_ch_frame(frame); - } - - std::vector<network::mojom::WebClientHintsType> all_client_hints_types() { - std::vector<network::mojom::WebClientHintsType> hints; - for (const auto& elem : network::GetClientHintToNameMap()) { - const auto& type = elem.first; - hints.push_back(type); - } - return hints; - } - - private: - std::unique_ptr<AcceptCHFrameObserverInterceptor> - accept_ch_frame_observer_interceptor_; -}; - -// TODO(crbug.com/1195790): Flaky on multiple bots. -#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \ - (BUILDFLAG(IS_WIN) && defined(ADDRESS_SANITIZER)) -#define MAYBE_AcceptCHFrame DISABLED_AcceptCHFrame -#else -#define MAYBE_AcceptCHFrame AcceptCHFrame -#endif - -// Ensure that client hints are sent when the ACCEPT_CH frame observer is -// notified. -IN_PROC_BROWSER_TEST_F(ClientHintsAcceptCHFrameObserverBrowserTest, - MAYBE_AcceptCHFrame) { - const GURL gurl = without_accept_ch_url(); - set_accept_ch_frame(all_client_hints_types()); - SetClientHintExpectationsOnMainFrame(true); - SetClientHintExpectationsOnSubresources(false); - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), gurl)); -} - -// Ensure that client hints are *not* sent when the observer is notified but -// client hints would normally not be sent (e.g. when JS is disabled for the -// frame). -IN_PROC_BROWSER_TEST_F(ClientHintsAcceptCHFrameObserverBrowserTest, - AcceptCHFrameJSDisabled) { - const GURL gurl = without_accept_ch_url(); - set_accept_ch_frame(all_client_hints_types()); - SetJsEnabledForActiveView(false); - SetClientHintExpectationsOnMainFrame(false); - SetClientHintExpectationsOnSubresources(false); - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), gurl)); -} - IN_PROC_BROWSER_TEST_P(ClientHintsBrowserTest, UseCounter_HttpEquiv) { auto web_feature_waiter = std::make_unique<page_load_metrics::PageLoadMetricsTestWaiter>(
diff --git a/chrome/browser/extensions/chrome_extension_web_contents_observer.cc b/chrome/browser/extensions/chrome_extension_web_contents_observer.cc index ee84aea..c5a2e56b 100644 --- a/chrome/browser/extensions/chrome_extension_web_contents_observer.cc +++ b/chrome/browser/extensions/chrome_extension_web_contents_observer.cc
@@ -145,8 +145,8 @@ ExtensionWebContentsObserver::InitializeRenderFrame(render_frame_host); WindowController* controller = dispatcher()->GetExtensionWindowController(); if (controller) { - render_frame_host->Send(new ExtensionMsg_UpdateBrowserWindowId( - render_frame_host->GetRoutingID(), controller->GetWindowId())); + GetLocalFrame(render_frame_host) + ->UpdateBrowserWindowId(controller->GetWindowId()); } }
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index 22d046c..cbd29af 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -547,7 +547,7 @@ "ContextualSearchLiteralSearchTap", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kContextualSearchLongpressResolve{ - "ContextualSearchLongpressResolve", base::FEATURE_DISABLED_BY_DEFAULT}; + "ContextualSearchLongpressResolve", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kContextualSearchMlTapSuppression{ "ContextualSearchMlTapSuppression", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/google/google_brand_code_map_chromeos.cc b/chrome/browser/google/google_brand_code_map_chromeos.cc index b9adfcc..7198410 100644 --- a/chrome/browser/google/google_brand_code_map_chromeos.cc +++ b/chrome/browser/google/google_brand_code_map_chromeos.cc
@@ -125,6 +125,7 @@ {"EDFZ", {"VUMJ", "OMDW", "LCDF"}}, {"EDHM", {"NLAE", "JYDL", "BTWJ"}}, {"EGSC", {"DWAW", "FZRC", "PKWJ"}}, + {"EJPG", {"YYRD", "WPCQ", "IMWD"}}, {"EKWL", {"PGWE", "JEHJ", "WQYW"}}, {"ELQA", {"GTJZ", "DTIH", "IXVN"}}, {"EOJH", {"GTAZ", "APYI", "UHAZ"}}, @@ -163,6 +164,7 @@ {"GXYK", {"MLCI", "HWQK", "ERBL"}}, {"HBOM", {"BCAW", "OXRC", "UGKI"}}, {"HDPY", {"JCUZ", "TMKK", "XMVQ"}}, + {"HEXN", {"KMII", "PFZL", "RKZB"}}, {"HFAN", {"ZQNI", "RPSS", "VFHT"}}, {"HFKU", {"ILOF", "UXKA", "JQLI"}}, {"HFRG", {"YGYA", "IWET", "PSFN"}}, @@ -207,6 +209,7 @@ {"JLGJ", {"HAZJ", "KSWW", "QCYN"}}, {"JLOF", {"IWFR", "CJHY", "DOPK"}}, {"JLRH", {"SAMJ", "GLJZ", "SKTN"}}, + {"JOQG", {"WOAM", "GAYR", "KWWJ"}}, {"JOTV", {"QBNM", "NMWE", "IDTV"}}, {"JPUQ", {"OVKI", "AHZL", "YMJY"}}, {"JPZQ", {"CCBQ", "ABTW", "KFNE"}}, @@ -226,6 +229,7 @@ {"KOKS", {"XCGR", "ZFVG", "PPCB"}}, {"KRTE", {"ILKK", "GNTB", "XFRA"}}, {"KXUH", {"RIFT", "DZUO", "ZSEI"}}, + {"KYYP", {"PGTZ", "VRVC", "HDRK"}}, {"LASN", {"ILWC", "BQYG", "RROZ"}}, {"LEAA", {"DHUB", "OBDS", "YMSJ"}}, {"LEAB", {"LRHX", "EFFC", "SZFH"}}, @@ -347,10 +351,12 @@ {"PAZD", {"VARX", "KZSU", "WPLH"}}, {"PEVA", {"RBMX", "IBPY", "ALNV"}}, {"PGQF", {"USPJ", "SFKO", "KNBH"}}, + {"PGRU", {"UNWU", "PZNF", "XXZB"}}, {"PHYB", {"EGXD", "KHYC", "QUPU"}}, {"PIGM", {"FEBY", "YTML", "VFLZ"}}, {"PLKQ", {"EXXM", "LBZT", "SPDN"}}, {"PRYU", {"QFZV", "TZXL", "EPRT"}}, + {"PSHU", {"DWTK", "RTTW", "PGXM"}}, {"PULG", {"OXHS", "IBTI", "EKUW"}}, {"PVHI", {"FUBQ", "URIF", "UATZ"}}, {"PWFL", {"WGJQ", "KMBF", "UKJV"}}, @@ -415,6 +421,7 @@ {"TBKT", {"IBUN", "QLQQ", "CRBQ"}}, {"TFIY", {"RVUF", "DHKE", "GFPK"}}, {"THNQ", {"XMVV", "RUHW", "WWLP"}}, + {"TIJC", {"ACYJ", "TJFH", "WVYN"}}, {"TJKH", {"ZHMG", "RBXM", "VIVU"}}, {"TKER", {"KOSM", "IUCL", "LIIM"}}, {"TKZT", {"KWCM", "APLN", "STGO"}}, @@ -428,7 +435,9 @@ {"TXMN", {"WTVY", "GJTZ", "KMRI"}}, {"TYOO", {"EGWA", "BJJJ", "GOKE"}}, {"TZIV", {"XWTU", "JFLV", "JLEU"}}, + {"TZNR", {"MHIP", "YJBK", "VDZV"}}, {"UBKE", {"CPTX", "EGAC", "MRXT"}}, + {"UEUD", {"GNRQ", "ZTCJ", "NPTM"}}, {"UGAY", {"YDHM", "HVCY", "ILHO"}}, {"UMAU", {"FKAK", "JCTZ", "GDUU"}}, {"UPPG", {"HYSS", "KHZT", "QQZJ"}},
diff --git a/chrome/browser/media/router/OWNERS b/chrome/browser/media/router/OWNERS index c96f031..80f5f7b 100644 --- a/chrome/browser/media/router/OWNERS +++ b/chrome/browser/media/router/OWNERS
@@ -1 +1,4 @@ -file://components/media_router/OWNERS +takumif@chromium.org +mfoltz@chromium.org +muyaoxu@google.com +btolsch@chromium.org
diff --git a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc index 431fd952..67f4749 100644 --- a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc +++ b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc
@@ -66,8 +66,8 @@ // Set the user preference for |origin| to prefer tab mirroring. void EnableTabMirroringForOrigin(PrefService* prefs, const std::string& origin) { - ListPrefUpdateDeprecated update( - prefs, media_router::prefs::kMediaRouterTabMirroringSources); + ListPrefUpdate update(prefs, + media_router::prefs::kMediaRouterTabMirroringSources); if (!base::Contains(update->GetList(), base::Value(origin))) update->Append(origin); } @@ -797,8 +797,8 @@ // Remove the user preference for |origin|. { - ListPrefUpdateDeprecated update(profile()->GetPrefs(), - prefs::kMediaRouterTabMirroringSources); + ListPrefUpdate update(profile()->GetPrefs(), + prefs::kMediaRouterTabMirroringSources); update->EraseListValue(base::Value(origin)); } @@ -854,7 +854,7 @@ // Remove the user preference for |origin| in OffTheRecord. { - ListPrefUpdateDeprecated update( + ListPrefUpdate update( profile()->GetPrimaryOTRProfile(/*create_if_needed=*/true)->GetPrefs(), prefs::kMediaRouterTabMirroringSources); update->EraseListValue(base::Value(origin));
diff --git a/chrome/browser/ozone_platform_browsertest.cc b/chrome/browser/ozone_platform_browsertest.cc new file mode 100644 index 0000000..0afdd23a --- /dev/null +++ b/chrome/browser/ozone_platform_browsertest.cc
@@ -0,0 +1,32 @@ +// Copyright 2021 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/test/base/in_process_browser_test.h" +#include "content/public/test/browser_test.h" +#include "ui/ozone/public/ozone_platform.h" + +namespace ui { + +// Configures the ozone platform so it would return an error early at the stage +// of initialisation. In such event, the browser should gracefully exit. +// See https://crbug.com/1280138. +class OzonePlatformTest : public InProcessBrowserTest { + public: + OzonePlatformTest() { + OzonePlatform::SetFailInitializeUIForTest(true); + set_expected_exit_code(1); + } + + ~OzonePlatformTest() override { + OzonePlatform::SetFailInitializeUIForTest(false); + } +}; + +IN_PROC_BROWSER_TEST_F(OzonePlatformTest, ExitsGracefullyOnPlatormInitFailure) { + // This should never be hit. The browser is expected to exit before entering + // the test body. + ASSERT_TRUE(false); +} + +} // namespace ui
diff --git a/chrome/browser/payments/android/payment_app_service_bridge_unittest.cc b/chrome/browser/payments/android/payment_app_service_bridge_unittest.cc index 6008ee4..de6b6958 100644 --- a/chrome/browser/payments/android/payment_app_service_bridge_unittest.cc +++ b/chrome/browser/payments/android/payment_app_service_bridge_unittest.cc
@@ -107,6 +107,7 @@ /*number_of_factories=*/3, web_contents_->GetMainFrame(), top_origin_, spec.AsWeakPtr(), /*twa_package_name=*/GetParam(), web_data_service_, /*may_crawl_for_installable_payment_apps=*/true, + /*is_off_the_record=*/false, base::BindRepeating(&MockCallback::NotifyCanMakePaymentCalculated, base::Unretained(&mock_callback)), base::BindRepeating(&MockCallback::NotifyPaymentAppCreated,
diff --git a/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc b/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc index 00365c3..9a4ca716 100644 --- a/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc +++ b/chrome/browser/payments/payment_request_can_make_payment_browsertest.cc
@@ -80,20 +80,6 @@ } }; -// Visa is required, and user has a visa instrument. -IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, - CanMakePayment_Supported) { - NavigateTo("/payment_request_can_make_payment_query_test.html"); - const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa. - AddCreditCard(card); - - CallCanMakePayment(); - ExpectBodyContains("true"); - - CallHasEnrolledInstrument(); - ExpectBodyContains("true"); -} - // Visa is required, and user has a visa instrument, but canMakePayment is // disabled by user preference. IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, @@ -158,9 +144,40 @@ ExpectBodyContains("false"); } +class PaymentRequestCanMakePaymentQueryBasicCardEnabledTest + : public PaymentRequestCanMakePaymentQueryTest { + public: + PaymentRequestCanMakePaymentQueryBasicCardEnabledTest( + const PaymentRequestCanMakePaymentQueryBasicCardEnabledTest&) = delete; + PaymentRequestCanMakePaymentQueryBasicCardEnabledTest& operator=( + const PaymentRequestCanMakePaymentQueryBasicCardEnabledTest&) = delete; + + protected: + PaymentRequestCanMakePaymentQueryBasicCardEnabledTest() { + feature_list_.InitAndEnableFeature(::features::kPaymentRequestBasicCard); + } + + private: + base::test::ScopedFeatureList feature_list_; +}; + +// Visa is required, and user has a visa instrument. +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryBasicCardEnabledTest, + CanMakePayment_Supported) { + NavigateTo("/payment_request_can_make_payment_query_test.html"); + const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa. + AddCreditCard(card); + + CallCanMakePayment(); + ExpectBodyContains("true"); + + CallHasEnrolledInstrument(); + ExpectBodyContains("true"); +} + // Visa is required, user has a visa instrument, and user is in incognito // mode. -IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryBasicCardEnabledTest, CanMakePayment_Supported_InIncognitoMode) { NavigateTo("/payment_request_can_make_payment_query_test.html"); test_controller()->SetOffTheRecord(true); @@ -176,7 +193,7 @@ } // Visa is required, and user doesn't have a visa instrument. -IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryBasicCardEnabledTest, CanMakePayment_NotSupported) { NavigateTo("/payment_request_can_make_payment_query_test.html"); const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex. @@ -190,9 +207,9 @@ } // Visa is required, user doesn't have a visa instrument and the user is in -// incognito mode. In this case canMakePayment returns false as in a normal +// incognito mode. In this case canMakePayment() returns false as in a normal // profile. -IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryBasicCardEnabledTest, CanMakePayment_NotSupported_InIncognitoMode) { NavigateTo("/payment_request_can_make_payment_query_test.html"); test_controller()->SetOffTheRecord(true); @@ -207,6 +224,129 @@ ExpectBodyContains("false"); } +// The tests in this class correspond to the tests of the same name in +// PaymentRequestCanMakePaymentQueryTest, with the basic-card being +// disabled. Parameterized tests are not used because the test setup for both +// tests are too different. +class PaymentRequestCanMakePaymentQueryBasicCardDisabledTest + : public PaymentRequestCanMakePaymentTestBase { + public: + PaymentRequestCanMakePaymentQueryBasicCardDisabledTest( + const PaymentRequestCanMakePaymentQueryBasicCardDisabledTest&) = delete; + PaymentRequestCanMakePaymentQueryBasicCardDisabledTest& operator=( + const PaymentRequestCanMakePaymentQueryBasicCardDisabledTest&) = delete; + net::EmbeddedTestServer nickpay_server_; + + protected: + PaymentRequestCanMakePaymentQueryBasicCardDisabledTest() + : nickpay_server_(net::EmbeddedTestServer::TYPE_HTTPS) { + feature_list_.InitAndDisableFeature(::features::kPaymentRequestBasicCard); + } + + void SetUpOnMainThread() override { + PaymentRequestPlatformBrowserTestBase::SetUpOnMainThread(); + + // Choosing nickpay for its JIT installation support. + nickpay_server_.ServeFilesFromSourceDirectory( + "components/test/data/payments/nickpay.com/"); + + ASSERT_TRUE(nickpay_server_.Start()); + } + + void CallCanMakePaymentWithMethod(const std::string& method) { + ResetEventWaiterForEventSequence( + {TestEvent::kCanMakePaymentCalled, TestEvent::kCanMakePaymentReturned}); + ASSERT_TRUE(content::ExecuteScript( + GetActiveWebContents(), + content::JsReplace("buyWithMethods([{supportedMethods:$1}]);", + method))); + WaitForObservedEvent(); + } + + void CallHasEnrolledInstrumentWithMethod(const std::string& method) { + ResetEventWaiterForEventSequence( + {TestEvent::kHasEnrolledInstrumentCalled, + TestEvent::kHasEnrolledInstrumentReturned}); + ASSERT_TRUE(content::ExecuteScript( + GetActiveWebContents(), + content::JsReplace( + "hasEnrolledInstrumentWithMethods([{supportedMethods:$1}]);", + method))); + WaitForObservedEvent(); + } + + private: + base::test::ScopedFeatureList feature_list_; +}; + +// A payment method is required, user has installed the payment app, the +// payment app responds true to the "canmakepayment" event. +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryBasicCardDisabledTest, + CanMakePayment_Supported) { + std::string method; + InstallPaymentApp("a.com", "payment_request_success_responder.js", &method); + + NavigateTo("/payment_request_can_make_payment_query_test.html"); + + CallCanMakePaymentWithMethod(method); + ExpectBodyContains("true"); + + CallHasEnrolledInstrumentWithMethod(method); + ExpectBodyContains("true"); +} + +// A payment method is required, user has installed the payment app, the +// payment app responds true to the "canmakepayment" event and user is in +// incognito mode. In this case, hasEnrolledInstrument() returns false because +// the "canmakepayment" event is not fired in incognito mode. +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryBasicCardDisabledTest, + CanMakePayment_Supported_InIncognitoMode) { + std::string method; + InstallPaymentApp("a.com", "payment_request_success_responder.js", &method); + + NavigateTo("/payment_request_can_make_payment_query_test.html"); + test_controller()->SetOffTheRecord(true); + + CallCanMakePaymentWithMethod(method); + ExpectBodyContains("true"); + + CallHasEnrolledInstrumentWithMethod(method); + ExpectBodyContains("false"); +} + +// Nickpay is requested but not installed, but it supports just-in-time +// installation. In this case canMakePayment() returns true and +// hasEnrolledInstrument() returns false. +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryBasicCardDisabledTest, + CanMakePayment_NotSupported) { + std::string method = nickpay_server_.GetURL("nickpay.com", "/pay").spec(); + + NavigateTo("/payment_request_can_make_payment_query_test.html"); + + CallCanMakePaymentWithMethod(method); + ExpectBodyContains("true"); + + CallHasEnrolledInstrumentWithMethod(method); + ExpectBodyContains("false"); +} + +// Nickpay is requested in incognito mode and it supports just-in-time +// installation but is not installed. In this case canMakePayment() returns true +// and hasEnrolledInstrument() returns false as in a normal mode. +IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryBasicCardDisabledTest, + CanMakePayment_NotSupported_InIncognitoMode) { + std::string method = nickpay_server_.GetURL("nickpay.com", "/pay").spec(); + + NavigateTo("/payment_request_can_make_payment_query_test.html"); + test_controller()->SetOffTheRecord(true); + + CallCanMakePaymentWithMethod(method); + ExpectBodyContains("true"); + + CallHasEnrolledInstrumentWithMethod(method); + ExpectBodyContains("false"); +} + class PaymentRequestCanMakePaymentQueryCCTest : public PaymentRequestCanMakePaymentTestBase { public: @@ -313,7 +453,7 @@ ExpectBodyContains("true"); } -// canMakePayment should return result in incognito mode as in normal mode to +// canMakePayment() should return result in incognito mode as in normal mode to // avoid incognito mode detection. IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryCCTest, QueryQuotaInIncognito) {
diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java index 8c5871eb..f4db333 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java
@@ -382,6 +382,9 @@ */ public static final String FIRST_RUN_FIELD_TRIAL_GROUP = "Chrome.FirstRun.FieldTrialEnabled"; + public static final String FIRST_RUN_VARIATIONS_FIELD_TRIAL_GROUP = + "Chrome.FirstRun.VariationFieldTrialGroup"; + /** * The Feed articles visibility. This value is used as a pre-native cache and should be kept * consistent with {@link Pref.ARTICLES_LIST_VISIBLE}. @@ -1073,6 +1076,7 @@ EXPLORE_OFFLINE_CONTENT_AVAILABILITY_STATUS, FEED_ARTICLES_LIST_VISIBLE, FIRST_RUN_FIELD_TRIAL_GROUP, + FIRST_RUN_VARIATIONS_FIELD_TRIAL_GROUP, FIRST_RUN_SKIPPED_BY_POLICY, FLAGS_CACHED.pattern(), FLAGS_CRASH_STREAK_BEFORE_CACHE,
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 11c5650..65905b8 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -625,7 +625,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) || \ BUILDFLAG(GOOGLE_CHROME_BRANDING) ui::MenuSourceType GetMenuSourceType(int event_flags) { - if (event_flags & ui::EF_LEFT_MOUSE_BUTTON) + if (event_flags & ui::EF_MOUSE_BUTTON) return ui::MENU_SOURCE_MOUSE; else if (event_flags & ui::EF_FROM_TOUCH) return ui::MENU_SOURCE_TOUCH;
diff --git a/chrome/browser/resources/chromeos/login/components/gaia_dialog.html b/chrome/browser/resources/chromeos/login/components/gaia_dialog.html index 5020b53..30e5d08 100644 --- a/chrome/browser/resources/chromeos/login/components/gaia_dialog.html +++ b/chrome/browser/resources/chromeos/login/components/gaia_dialog.html
@@ -153,7 +153,7 @@ <img src="chrome://theme/IDR_TAB_RECORDING_INDICATOR"> </span> <span id="saml-notice-message"> - [[getSamlNoticeMessage_(locale, videoEnabled, authDomain_)]] + [[getSamlNoticeMessage_(locale, videoEnabled, authDomain)]] </span> </div> <cr-icon-button id="saml-close-button" iron-icon="cr:close"
diff --git a/chrome/browser/resources/chromeos/login/components/gaia_dialog.js b/chrome/browser/resources/chromeos/login/components/gaia_dialog.js index 3583e7c..f3e274f4 100644 --- a/chrome/browser/resources/chromeos/login/components/gaia_dialog.js +++ b/chrome/browser/resources/chromeos/login/components/gaia_dialog.js
@@ -85,9 +85,10 @@ * Used to display SAML notice. * @private */ - authDomain_: { + authDomain: { type: String, value: '', + notify: true, }, /** @@ -279,7 +280,7 @@ this.authFlow = e.newValue; }, 'authDomainChange': (e) => { - this.authDomain_ = e.newValue; + this.authDomain = e.newValue; }, 'dialogShown': (e) => { this.navigationEnabled = false;
diff --git a/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.html b/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.html index b58fac22..e24d284 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.html +++ b/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.html
@@ -58,6 +58,7 @@ is-default-sso-provider="[[isDefaultSsoProvider_]]" is-closable="[[isClosable_]]" video-enabled="{{videoEnabled_}}" + auth-domain="{{authDomain_}}" auth-flow="{{authFlow}}" navigation-enabled="{{navigationEnabled_}}" navigation-hidden="[[navigationButtonsHidden_]]" @@ -75,6 +76,15 @@ on-removeuserbyemail="onRemoveUserByEmailMessage_" on-changesigninprovider="onSamlPageChangeAccount_"> </gaia-dialog> + <!-- TODO(dkuzmin): This alert is added here, because ChromeVox keep + pronouncing it several times when role="alert" is added + inside gaia-dialog. This problem should be resolved in + https://crbug.com/1288829 --> + <div id="samlVideoAlert" role="alert" hidden="[[!videoEnabled_]]" + aria-label$="[[getSamlVideoAlertMessage_(locale, + videoEnabled_, + authDomain_)]]"> + </div> <security-token-pin id="pinDialog" parameters="[[pinDialogParameters_]]" for-step="pin" on-cancel="onPinDialogCanceled_" on-completed="onPinDialogCompleted_">
diff --git a/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.js b/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.js index 17feeec1..543fbf38 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.js +++ b/chrome/browser/resources/chromeos/login/screens/common/gaia_signin.js
@@ -181,6 +181,14 @@ }, /** + * Bound to gaia-dialog::authDomain. + * @private + */ + authDomain_: { + type: String, + }, + + /** * Bound to gaia-dialog::authFlow. * @private */ @@ -1282,6 +1290,21 @@ clickPrimaryButtonForTesting() { this.$['signin-frame-dialog'].clickPrimaryButtonForTesting(); } + + /** + * Copmose alert message when third-party IdP uses camera for authentication. + * @param {string} locale i18n locale data + * @param {boolean} videoEnabled + * @param {string} authDomain + * @return {string} + * @private + */ + getSamlVideoAlertMessage_(locale, videoEnabled, authDomain) { + if (videoEnabled && authDomain) { + return this.i18n('samlNoticeWithVideo', authDomain); + } + return ''; + } } customElements.define(GaiaSigninElement.is, GaiaSigninElement);
diff --git a/chrome/browser/resources/safe_browsing/OWNERS b/chrome/browser/resources/safe_browsing/OWNERS index d586b97..70e4b68 100644 --- a/chrome/browser/resources/safe_browsing/OWNERS +++ b/chrome/browser/resources/safe_browsing/OWNERS
@@ -1,4 +1,3 @@ -asanka@chromium.org drubery@chromium.org nparker@chromium.org vakh@chromium.org
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_clear_on_exit_fragment.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_clear_on_exit_fragment.html index 29d09ec..9c20e4a2 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_clear_on_exit_fragment.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_clear_on_exit_fragment.html
@@ -1,5 +1,5 @@ <style include="privacy-review-fragment-shared"></style> -<div class="header" tabindex="-1"> +<div class="header" focus-element tabindex="-1"> <picture> <source srcset="./images/privacy_review/clear_on_exit_graphic_dark.svg"
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.html index a6076e5..da003c1 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.html
@@ -23,7 +23,7 @@ width: calc(100% - 48px); /* 48px = 2x :host horizontal padding */ } </style> -<div class="header" tabindex="-1"> +<div class="header" focus-element tabindex="-1"> <picture> <source srcset="./images/privacy_review/completion_banner_dark.svg"
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_cookies_fragment.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_cookies_fragment.html index 2e1620f..660765e 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_cookies_fragment.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_cookies_fragment.html
@@ -1,5 +1,5 @@ <style include="privacy-review-fragment-shared"></style> -<div class="header" tabindex="-1"> +<div class="header" focus-element tabindex="-1"> <picture> <source srcset="./images/privacy_review/cookies_graphic_dark.svg"
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_history_sync_fragment.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_history_sync_fragment.html index 7f2c862b..35606781 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_history_sync_fragment.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_history_sync_fragment.html
@@ -1,5 +1,5 @@ <style include="privacy-review-fragment-shared"></style> -<div class="header" tabindex="-1"> +<div class="header" focus-element tabindex="-1"> <picture> <source srcset="./images/privacy_review/history_sync_graphic_dark.svg"
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_msbb_fragment.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_msbb_fragment.html index bf031ab..c89818cc 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_msbb_fragment.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_msbb_fragment.html
@@ -1,5 +1,5 @@ <style include="privacy-review-fragment-shared"></style> -<div class="header" tabindex="-1"> +<div class="header" focus-element tabindex="-1"> <picture> <source srcset="./images/privacy_review/msbb_graphic_dark.svg"
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_page.ts b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_page.ts index 0f84064..c58f8e1d 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_page.ts +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_page.ts
@@ -468,11 +468,11 @@ private onViewEnterStart_(event: Event) { // The |view-enter-start| event was dispatched to the fragment that is now - // becoming visible. Every fragment has a |header| class element that can - // be focused programmatically. + // becoming visible. Every fragment has a [focus-element] element that is + // focused programmatically when the fragment becomes visible. const elementToFocus = assert((event.target! as HTMLElement) - .shadowRoot!.querySelector<HTMLElement>('.header')); + .shadowRoot!.querySelector<HTMLElement>('[focus-element]')); afterNextRender(this, () => elementToFocus!.focus()); } }
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_safe_browsing_fragment.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_safe_browsing_fragment.html index 90a4a06..98c0c899 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_safe_browsing_fragment.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_safe_browsing_fragment.html
@@ -1,5 +1,5 @@ <style include="privacy-review-fragment-shared"></style> -<div class="header" tabindex="-1"> +<div class="header" focus-element tabindex="-1"> <picture> <source srcset="./images/privacy_review/safe_browsing_graphic_dark.svg"
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_welcome_fragment.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_welcome_fragment.html index 0b6c21c..b0e9caf 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_welcome_fragment.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_welcome_fragment.html
@@ -22,7 +22,7 @@ width: calc(100% - 48px); /* 48px = 2x :host horizontal padding */ } </style> -<div class="header" tabindex="-1"> +<div class="header" focus-element tabindex="-1"> <picture> <source srcset="./images/privacy_review/welcome_banner_dark.svg"
diff --git a/chrome/browser/sessions/session_tab_helper_factory.cc b/chrome/browser/sessions/session_tab_helper_factory.cc index a3446f6..e9aff2f 100644 --- a/chrome/browser/sessions/session_tab_helper_factory.cc +++ b/chrome/browser/sessions/session_tab_helper_factory.cc
@@ -6,6 +6,7 @@ #include "chrome/browser/buildflags.h" #include "chrome/common/buildflags.h" +#include "extensions/buildflags/buildflags.h" #if BUILDFLAG(ENABLE_SESSION_SERVICE) #include "chrome/browser/profiles/profile.h" @@ -16,6 +17,10 @@ #include "content/public/browser/web_contents.h" #endif +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "extensions/browser/extension_web_contents_observer.h" +#endif + namespace { #if BUILDFLAG(ENABLE_SESSION_SERVICE) @@ -45,4 +50,14 @@ sessions::SessionTabHelper::DelegateLookup lookup; #endif sessions::SessionTabHelper::CreateForWebContents(contents, std::move(lookup)); + +#if BUILDFLAG(ENABLE_EXTENSIONS) + auto* observer = + extensions::ExtensionWebContentsObserver::GetForWebContents(contents); + + if (observer) { + observer->ListenToWindowIdChangesFrom( + sessions::SessionTabHelper::FromWebContents(contents)); + } +#endif }
diff --git a/chrome/browser/signin/services/android/BUILD.gn b/chrome/browser/signin/services/android/BUILD.gn index 7a0a1dc6..3c2d0cba 100644 --- a/chrome/browser/signin/services/android/BUILD.gn +++ b/chrome/browser/signin/services/android/BUILD.gn
@@ -49,6 +49,7 @@ "java/res/drawable/logo_avatar_anonymous.xml", "java/res/values/dimens.xml", ] + deps = [ "//chrome/browser/ui/android/strings:ui_strings_grd" ] } android_library("javatests") {
diff --git a/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/FREMobileIdentityConsistencyFieldTrial.java b/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/FREMobileIdentityConsistencyFieldTrial.java index f3177891..f260c43 100644 --- a/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/FREMobileIdentityConsistencyFieldTrial.java +++ b/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/FREMobileIdentityConsistencyFieldTrial.java
@@ -4,7 +4,10 @@ package org.chromium.chrome.browser.signin.services; +import android.util.Pair; + import androidx.annotation.AnyThread; +import androidx.annotation.IntDef; import androidx.annotation.MainThread; import androidx.annotation.VisibleForTesting; @@ -16,6 +19,8 @@ import org.chromium.components.version_info.Channel; import org.chromium.components.version_info.VersionConstants; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.Random; /** @@ -36,6 +41,64 @@ @VisibleForTesting public static final String OLD_FRE_WITH_UMA_DIALOG_GROUP = "OldFreWithUmaDialog"; + /** + * The group variation values should be consecutive starting from zero. WELCOME_TO_CHROME acts + * as the control group of the experiment. + * If a new group needs to be added then another control group must also be added. + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({ + VariationsGroup.DEFAULT, + VariationsGroup.WELCOME_TO_CHROME, + VariationsGroup.WELCOME_TO_CHROME_MOST_OUT_OF_CHROME, + VariationsGroup.WELCOME_TO_CHROME_STRONGEST_SECURITY, + VariationsGroup.WELCOME_TO_CHROME_EASIER_ACROSS_DEVICES, + VariationsGroup.MOST_OUT_OF_CHROME, + VariationsGroup.MAKE_CHROME_YOUR_OWN, + VariationsGroup.MAX_VALUE, + }) + private @interface VariationsGroup { + /** + * Default group of the experiment which is the group WELCOME_TO_CHROME. + * + * Title: 'Welcome to Chrome' + * Subtitle: None + */ + int DEFAULT = -1; + /** + * Title: 'Welcome to Chrome' + * Subtitle: None + */ + int WELCOME_TO_CHROME = 0; + /** + * Title: 'Welcome to Chrome' + * Subtitle: 'Sign in to get the most out of Chrome' + */ + int WELCOME_TO_CHROME_MOST_OUT_OF_CHROME = 1; + /** + * Title: 'Welcome to Chrome' + * Subtitle: 'Sign in for additional features and Chrome's strongest security' + */ + int WELCOME_TO_CHROME_STRONGEST_SECURITY = 2; + /** + * Title: 'Welcome to Chrome' + * Subtitle: 'Sign in to browse easier across devices' + */ + int WELCOME_TO_CHROME_EASIER_ACROSS_DEVICES = 3; + /** + * Title: 'Sign in to get the most out of Chrome' + * Subtitle: None + */ + int MOST_OUT_OF_CHROME = 4; + /** + * Title: 'Sign in to make Chrome your own' + * Subtitle: None + */ + int MAKE_CHROME_YOUR_OWN = 5; + int MAX_VALUE = 6; + } + + @CalledByNative @AnyThread public static boolean isEnabled() { // Switch used for tests. Disabled by default otherwise. @@ -66,6 +129,58 @@ } } + @CalledByNative + @AnyThread + public static String getFirstRunVariationsTrialGroup() { + @VariationsGroup + final int group = getFirstRunVariationsTrialGroupInternal(); + switch (group) { + case VariationsGroup.WELCOME_TO_CHROME: + return "Control"; + case VariationsGroup.WELCOME_TO_CHROME_MOST_OUT_OF_CHROME: + return "WelcomeToChrome_MostOutOfChrome"; + case VariationsGroup.WELCOME_TO_CHROME_STRONGEST_SECURITY: + return "WelcomeToChrome_StrongestSecurity"; + case VariationsGroup.WELCOME_TO_CHROME_EASIER_ACROSS_DEVICES: + return "WelcomeToChrome_EasierAcrossDevices"; + case VariationsGroup.MOST_OUT_OF_CHROME: + return "MostOutOfChrome"; + case VariationsGroup.MAKE_CHROME_YOUR_OWN: + return "MakeChromeYourOwn"; + default: + return "Default"; + } + } + + /** + * Returns different titles and subtitles depending upon the group variation. + * + * The first integer holds the string resource value for the title and the second integer + * for the subtitle. The second integer may be 0, in which case there is no subtitle. + */ + @MainThread + public static Pair<Integer, Integer> getVariationTitleAndSubtitle() { + @VariationsGroup + final int group = getFirstRunVariationsTrialGroupInternal(); + switch (group) { + case VariationsGroup.WELCOME_TO_CHROME: + return new Pair(R.string.fre_welcome, 0); + case VariationsGroup.WELCOME_TO_CHROME_MOST_OUT_OF_CHROME: + return new Pair(R.string.fre_welcome, R.string.signin_fre_subtitle_variation_1); + case VariationsGroup.WELCOME_TO_CHROME_STRONGEST_SECURITY: + return new Pair(R.string.fre_welcome, R.string.signin_fre_subtitle_variation_2); + case VariationsGroup.WELCOME_TO_CHROME_EASIER_ACROSS_DEVICES: + return new Pair(R.string.fre_welcome, R.string.signin_fre_subtitle_variation_3); + case VariationsGroup.MOST_OUT_OF_CHROME: + return new Pair(R.string.signin_fre_title_variation_1, 0); + case VariationsGroup.MAKE_CHROME_YOUR_OWN: + return new Pair(R.string.signin_fre_title_variation_2, 0); + default: + // By default VariationsGroup.WELCOME_TO_CHROME UI is shown in the fre. + return new Pair(R.string.fre_welcome, 0); + } + } + /** * This method should be only called once during FRE in * {@link org.chromium.chrome.browser.firstrun.FirstRunActivity} so that subsequent chrome runs @@ -115,10 +230,11 @@ } assert enabledPercent + disabledPercent + oldFreWithUmaDialogPercent <= 100; - int randomBucket = new Random().nextInt(100); + final int randomBucket = new Random().nextInt(100); String group = DEFAULT_GROUP; if (randomBucket < enabledPercent) { group = ENABLED_GROUP; + createFirstRunVariationsTrial(); } else if (randomBucket < enabledPercent + disabledPercent) { group = DISABLED_GROUP; } else if (randomBucket < enabledPercent + disabledPercent + oldFreWithUmaDialogPercent) { @@ -131,6 +247,41 @@ } } + /** + * Creates variations of the FRE signin welcome screen with different title/subtitle + * combinations. + * + * The group information is registered as a synthetic field trial in native code inside + * ChromeBrowserFieldTrials::RegisterSyntheticTrials(). + */ + @MainThread + private static void createFirstRunVariationsTrial() { + // TODO(https://crbug.com/1276961): This percentage will be changed when the experiment + // starts. + final int variationsPercentage = 0; + // For A/B testing all experiment groups should have the same percentages. + assert variationsPercentage * VariationsGroup.MAX_VALUE <= 100; + + final int randomBucket = new Random().nextInt(100); + int group = VariationsGroup.DEFAULT; + if (randomBucket < variationsPercentage * VariationsGroup.MAX_VALUE) { + group = randomBucket / variationsPercentage; + } + synchronized (LOCK) { + SharedPreferencesManager.getInstance().writeInt( + ChromePreferenceKeys.FIRST_RUN_VARIATIONS_FIELD_TRIAL_GROUP, group); + } + } + + @AnyThread + private static int getFirstRunVariationsTrialGroupInternal() { + synchronized (LOCK) { + return SharedPreferencesManager.getInstance().readInt( + ChromePreferenceKeys.FIRST_RUN_VARIATIONS_FIELD_TRIAL_GROUP, + VariationsGroup.DEFAULT); + } + } + @AnyThread public static void setFirstRunTrialGroupForTesting(String group) { synchronized (LOCK) { @@ -138,4 +289,4 @@ ChromePreferenceKeys.FIRST_RUN_FIELD_TRIAL_GROUP, group); } } -} \ No newline at end of file +}
diff --git a/chrome/browser/sync/chrome_sync_client.cc b/chrome/browser/sync/chrome_sync_client.cc index 06c2cc6a..3afe319f 100644 --- a/chrome/browser/sync/chrome_sync_client.cc +++ b/chrome/browser/sync/chrome_sync_client.cc
@@ -57,7 +57,7 @@ #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/autofill/core/common/autofill_features.h" #include "components/browser_sync/browser_sync_switches.h" -#include "components/browser_sync/profile_sync_components_factory_impl.h" +#include "components/browser_sync/sync_api_component_factory_impl.h" #include "components/consent_auditor/consent_auditor.h" #include "components/desks_storage/core/desk_sync_service.h" #include "components/dom_distiller/core/dom_distiller_service.h" @@ -203,7 +203,7 @@ account_password_store_ = AccountPasswordStoreFactory::GetForProfile( profile_, ServiceAccessType::IMPLICIT_ACCESS); - component_factory_ = std::make_unique<ProfileSyncComponentsFactoryImpl>( + component_factory_ = std::make_unique<SyncApiComponentFactoryImpl>( this, chrome::GetChannel(), content::GetUIThreadTaskRunner({}), web_data_service_thread_, profile_web_data_service_, account_web_data_service_, profile_password_store_,
diff --git a/chrome/browser/sync/chrome_sync_client.h b/chrome/browser/sync/chrome_sync_client.h index 275c2db..c1d0f210 100644 --- a/chrome/browser/sync/chrome_sync_client.h +++ b/chrome/browser/sync/chrome_sync_client.h
@@ -34,7 +34,7 @@ namespace browser_sync { -class ProfileSyncComponentsFactoryImpl; +class SyncApiComponentFactoryImpl; class ChromeSyncClient : public browser_sync::BrowserSyncClient { public: @@ -93,8 +93,7 @@ const raw_ptr<Profile> profile_; // The sync api component factory in use by this client. - std::unique_ptr<browser_sync::ProfileSyncComponentsFactoryImpl> - component_factory_; + std::unique_ptr<browser_sync::SyncApiComponentFactoryImpl> component_factory_; std::unique_ptr<syncer::TrustedVaultClient> trusted_vault_client_;
diff --git a/chrome/browser/sync/test/integration/enable_disable_test.cc b/chrome/browser/sync/test/integration/enable_disable_test.cc index 29c9052f..65fd819 100644 --- a/chrome/browser/sync/test/integration/enable_disable_test.cc +++ b/chrome/browser/sync/test/integration/enable_disable_test.cc
@@ -27,7 +27,6 @@ namespace { using syncer::ModelType; -using syncer::ModelTypeFromDebugString; using syncer::ModelTypeSet; using syncer::ModelTypeToDebugString; using syncer::SyncUserSettings;
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/LocationBarMediator.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/LocationBarMediator.java index 48806cf..bc29bc8 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/LocationBarMediator.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/LocationBarMediator.java
@@ -183,6 +183,7 @@ private final BooleanSupplier mIsToolbarMicEnabledSupplier; // Tracks if the location bar is laid out in a focused state due to an ntp scroll. private boolean mIsLocationBarFocusedFromNtpScroll; + private @BrandedColorScheme int mBrandedColorScheme = BrandedColorScheme.APP_DEFAULT; /*package */ LocationBarMediator(@NonNull Context context, @NonNull LocationBarLayout locationBarLayout, @@ -907,8 +908,8 @@ mAssistantVoiceSearchServiceSupplier.get(); if (assistantVoiceSearchService == null) return; - mLocationBarLayout.setMicButtonTint(assistantVoiceSearchService.getButtonColorStateList( - getPrimaryBackgroundColor(), mContext)); + mLocationBarLayout.setMicButtonTint( + assistantVoiceSearchService.getButtonColorStateList(mBrandedColorScheme, mContext)); mLocationBarLayout.setMicButtonDrawable( assistantVoiceSearchService.getCurrentMicDrawable()); } @@ -919,8 +920,8 @@ mAssistantVoiceSearchServiceSupplier.get(); if (assistantVoiceSearchService == null) return; - mLocationBarLayout.setLensButtonTint(assistantVoiceSearchService.getButtonColorStateList( - getPrimaryBackgroundColor(), mContext)); + mLocationBarLayout.setLensButtonTint( + assistantVoiceSearchService.getButtonColorStateList(mBrandedColorScheme, mContext)); } /** @@ -928,20 +929,19 @@ */ @VisibleForTesting /* package */ void updateBrandedColorScheme() { - final @BrandedColorScheme int brandedColorScheme = - OmniboxResourceProvider.getBrandedColorScheme(mContext, - mLocationBarDataProvider.isIncognito(), getPrimaryBackgroundColor()); + mBrandedColorScheme = OmniboxResourceProvider.getBrandedColorScheme( + mContext, mLocationBarDataProvider.isIncognito(), getPrimaryBackgroundColor()); mLocationBarLayout.setDeleteButtonTint( - ThemeUtils.getThemedToolbarIconTint(mContext, brandedColorScheme)); + ThemeUtils.getThemedToolbarIconTint(mContext, mBrandedColorScheme)); // If the URL changed colors and is not focused, update the URL to account for the new // color scheme. - if (mUrlCoordinator.setBrandedColorScheme(brandedColorScheme) && !isUrlBarFocused()) { + if (mUrlCoordinator.setBrandedColorScheme(mBrandedColorScheme) && !isUrlBarFocused()) { updateUrl(); } - mStatusCoordinator.setBrandedColorScheme(brandedColorScheme); + mStatusCoordinator.setBrandedColorScheme(mBrandedColorScheme); if (mAutocompleteCoordinator != null) { - mAutocompleteCoordinator.updateVisualsForState(brandedColorScheme); + mAutocompleteCoordinator.updateVisualsForState(mBrandedColorScheme); } } @@ -1167,9 +1167,11 @@ @Override public void onPrimaryColorChanged() { + // This method needs to be called first as it computes |mBrandedColorScheme|. + updateBrandedColorScheme(); + updateAssistantVoiceSearchDrawableAndColors(); updateLensButtonColors(); - updateBrandedColorScheme(); } @Override
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProvider.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProvider.java index 37000338..4c51e0b 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProvider.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProvider.java
@@ -28,12 +28,6 @@ public class OmniboxResourceProvider { private static final String TAG = "OmniboxResourceProvider"; - /** @return Whether the mode is dark (dark theme or incognito). */ - public static boolean isDarkMode(@BrandedColorScheme int brandedColorScheme) { - return brandedColorScheme == BrandedColorScheme.DARK_BRANDED_THEME - || brandedColorScheme == BrandedColorScheme.INCOGNITO; - } - /** * Returns a drawable for a given attribute depending on a {@link BrandedColorScheme} *
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProviderTest.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProviderTest.java index 9dfa6cb2..295f0828 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProviderTest.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/styles/OmniboxResourceProviderTest.java
@@ -37,7 +37,6 @@ private Activity mActivity; private @ColorInt int mDefaultColor; - private @ColorInt int mDefaultIncognitoColor; @Before public void setUp() { @@ -45,16 +44,6 @@ mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); mDefaultColor = ChromeColors.getDefaultThemeColor(mActivity, false); - mDefaultIncognitoColor = ChromeColors.getDefaultThemeColor(mActivity, true); - } - - @Test - public void isDarkMode() { - Assert.assertTrue( - OmniboxResourceProvider.isDarkMode(BrandedColorScheme.DARK_BRANDED_THEME)); - Assert.assertTrue(OmniboxResourceProvider.isDarkMode(BrandedColorScheme.INCOGNITO)); - Assert.assertFalse( - OmniboxResourceProvider.isDarkMode(BrandedColorScheme.LIGHT_BRANDED_THEME)); } @Test
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewBinder.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewBinder.java index becea4e..63395c9 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewBinder.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewBinder.java
@@ -23,6 +23,7 @@ import org.chromium.chrome.browser.omnibox.styles.OmniboxResourceProvider; import org.chromium.chrome.browser.omnibox.suggestions.SuggestionCommonProperties; import org.chromium.chrome.browser.omnibox.suggestions.base.BaseSuggestionViewProperties.Action; +import org.chromium.chrome.browser.ui.theme.BrandedColorScheme; import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyModel; @@ -100,7 +101,7 @@ actionView.setContentDescription(action.accessibilityDescription); actionView.setBackground(copyDrawable(backgroundDrawable)); updateIcon(actionView, action.icon, - ChromeColors.getPrimaryIconTintRes(!useDarkColors(model))); + ChromeColors.getPrimaryIconTintRes(isIncognito(model))); actionView.setAccessibilityDelegate(new AccessibilityDelegate() { @Override @@ -140,14 +141,13 @@ ImageView actionView = actionViews.get(index); actionView.setBackground(copyDrawable(backgroundDrawable)); updateIcon(actionView, actions.get(index).icon, - ChromeColors.getPrimaryIconTintRes(!useDarkColors(model))); + ChromeColors.getPrimaryIconTintRes(isIncognito(model))); } } - /** @return Whether currently used color scheme is considered to be dark. */ - private static boolean useDarkColors(PropertyModel model) { - return !OmniboxResourceProvider.isDarkMode( - model.get(SuggestionCommonProperties.COLOR_SCHEME)); + /** @return Whether the current {@link BrandedColorScheme} is INCOGNITO. */ + private static boolean isIncognito(PropertyModel model) { + return model.get(SuggestionCommonProperties.COLOR_SCHEME) == BrandedColorScheme.INCOGNITO; } /** Update attributes of decorated suggestion icon. */ @@ -173,7 +173,7 @@ rciv.setClipToOutline(sds.useRoundedCorners); } - updateIcon(rciv, sds, ChromeColors.getSecondaryIconTintRes(!useDarkColors(model))); + updateIcon(rciv, sds, ChromeColors.getSecondaryIconTintRes(isIncognito(model))); } /** @@ -225,8 +225,6 @@ /** Update image view using supplied drawable state object. */ private static void updateIcon( ImageView view, SuggestionDrawableState sds, @ColorRes int tintRes) { - final Resources res = view.getContext().getResources(); - view.setVisibility(sds == null ? View.GONE : View.VISIBLE); if (sds == null) { // Release any drawable that is still attached to this view to reclaim memory.
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinder.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinder.java index 6c21881..881777e 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinder.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/header/HeaderViewBinder.java
@@ -9,8 +9,8 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.browser.omnibox.R; -import org.chromium.chrome.browser.omnibox.styles.OmniboxResourceProvider; import org.chromium.chrome.browser.omnibox.suggestions.SuggestionCommonProperties; +import org.chromium.chrome.browser.ui.theme.BrandedColorScheme; import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyModel; @@ -22,12 +22,12 @@ if (HeaderViewProperties.TITLE == propertyKey) { view.getTextView().setText(model.get(HeaderViewProperties.TITLE)); } else if (propertyKey == SuggestionCommonProperties.COLOR_SCHEME) { - final boolean useDarkColors = !OmniboxResourceProvider.isDarkMode( - model.get(SuggestionCommonProperties.COLOR_SCHEME)); - TextViewCompat.setTextAppearance(view.getTextView(), - ChromeColors.getTextMediumThickSecondaryStyle(!useDarkColors)); + final boolean isIncognito = model.get(SuggestionCommonProperties.COLOR_SCHEME) + == BrandedColorScheme.INCOGNITO; + TextViewCompat.setTextAppearance( + view.getTextView(), ChromeColors.getTextMediumThickSecondaryStyle(isIncognito)); ApiCompatibilityUtils.setImageTintList(view.getIconView(), - ChromeColors.getPrimaryIconTint(view.getContext(), !useDarkColors)); + ChromeColors.getPrimaryIconTint(view.getContext(), isIncognito)); } else if (propertyKey == SuggestionCommonProperties.LAYOUT_DIRECTION) { ViewCompat.setLayoutDirection( view, model.get(SuggestionCommonProperties.LAYOUT_DIRECTION));
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchService.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchService.java index 207dd69..8791aba 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchService.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchService.java
@@ -13,7 +13,6 @@ import android.graphics.drawable.Drawable; import android.text.TextUtils; -import androidx.annotation.ColorInt; import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -31,7 +30,8 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; -import org.chromium.components.browser_ui.styles.ChromeColors; +import org.chromium.chrome.browser.theme.ThemeUtils; +import org.chromium.chrome.browser.ui.theme.BrandedColorScheme; import org.chromium.components.externalauth.ExternalAuthUtils; import org.chromium.components.search_engines.TemplateUrlService; import org.chromium.components.signin.AccountManagerFacade; @@ -41,7 +41,6 @@ import org.chromium.components.signin.identitymanager.ConsentLevel; import org.chromium.components.signin.identitymanager.IdentityManager; import org.chromium.components.signin.identitymanager.PrimaryAccountChangeEvent; -import org.chromium.ui.util.ColorUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -219,13 +218,10 @@ /** @return The correct ColorStateList for the current theme. */ public @Nullable ColorStateList getButtonColorStateList( - @ColorInt int primaryColor, Context context) { + @BrandedColorScheme int brandedColorScheme, Context context) { if (mShouldShowColorfulButtons) return null; - final boolean useLightColors = - ColorUtils.shouldUseLightForegroundOnBackground(primaryColor); - int id = ChromeColors.getPrimaryIconTintRes(useLightColors); - return AppCompatResources.getColorStateList(context, id); + return ThemeUtils.getThemedToolbarIconTint(context, brandedColorScheme); } /** Called from {@link VoiceRecognitionHandler} after the consent flow has completed. */
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchServiceUnitTest.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchServiceUnitTest.java index f903a28c..e9b99b67 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchServiceUnitTest.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/voice/AssistantVoiceSearchServiceUnitTest.java
@@ -45,6 +45,7 @@ import org.chromium.chrome.browser.gsa.GSAState; import org.chromium.chrome.browser.omnibox.voice.AssistantVoiceSearchService.EligibilityFailureReason; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; +import org.chromium.chrome.browser.ui.theme.BrandedColorScheme; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; import org.chromium.components.externalauth.ExternalAuthUtils; @@ -287,13 +288,15 @@ mAssistantVoiceSearchService.onAccountsChanged(); // Colorful mic should be returned when only 1 account is present. - Assert.assertNull(mAssistantVoiceSearchService.getButtonColorStateList(0, mContext)); + Assert.assertNull(mAssistantVoiceSearchService.getButtonColorStateList( + BrandedColorScheme.APP_DEFAULT, mContext)); // Adding new account would trigger onAccountsChanged() automatically mAccountManagerTestRule.addAccount(TEST_ACCOUNT_EMAIL2); // Colorful mic should be returned when only 1 account is present. - Assert.assertNotNull(mAssistantVoiceSearchService.getButtonColorStateList(0, mContext)); + Assert.assertNotNull(mAssistantVoiceSearchService.getButtonColorStateList( + BrandedColorScheme.APP_DEFAULT, mContext)); } @Test @@ -313,7 +316,8 @@ @Feature("OmniboxAssistantVoiceSearch") public void getButtonColorStateList_ColorfulMicEnabled() { mAssistantVoiceSearchService.setColorfulMicEnabledForTesting(true); - Assert.assertNull(mAssistantVoiceSearchService.getButtonColorStateList(0, mContext)); + Assert.assertNull(mAssistantVoiceSearchService.getButtonColorStateList( + BrandedColorScheme.APP_DEFAULT, mContext)); } @Test
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index cafc23a3..e3560d26 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -2843,6 +2843,21 @@ <message name="IDS_SIGNIN_FRE_UMA_DIALOG_SECOND_SECTION_BODY" desc="Text that describes the concrete data that users share with Google if they turn on the metric sharing option."> Info about your Chrome usage that can\u2019t be tied to you\n\nRelevant data from rare Chrome crashes, which may include some personal info\n\nIf you turn on sync, metrics may also include info about URLs you visit </message> + <message name="IDS_SIGNIN_FRE_SUBTITLE_VARIATION_1" desc="Subtitle shown below a welcoming title on the very first screen after opening Chrome for the first time. Asks the user to sign in to Chrome with their Google Account to use additional features that are only available to signed-in users. Try to limit translations to 50 characters. Do not exceed 75 characters."> + Sign in to get the most out of Chrome + </message> + <message name="IDS_SIGNIN_FRE_SUBTITLE_VARIATION_2" desc="Subtitle shown below a welcoming title on the very first screen after opening Chrome for the first time. Asks the user to sign in to Chrome with their Google Account to use additional features that are only available to signed-in users. Try to limit translations to 50 characters. Do not exceed 75 characters."> + Sign in for additional features and Chrome\u2019s strongest security + </message> + <message name="IDS_SIGNIN_FRE_SUBTITLE_VARIATION_3" desc="Subtitle shown below a welcoming title on the very first screen after opening Chrome for the first time. Asks the user to sign in to Chrome with their Google Account to get more useful features when they're signed in across multiple devices (like phones and computers). Try to limit translations to 50 characters. Do not exceed 75 characters."> + Sign in to browse easier across devices + </message> + <message name="IDS_SIGNIN_FRE_TITLE_VARIATION_1" desc="Title shown on the very first screen after opening Chrome for the first time. Asks the user to sign in to Chrome with their Google Account to use additional features that are only available to signed-in users. Try to limit translations to 40 characters. Do not exceed 50 characters."> + Sign in to get the most out of Chrome + </message> + <message name="IDS_SIGNIN_FRE_TITLE_VARIATION_2" desc="Title shown on the very first screen after opening Chrome for the first time. Asks the user to sign in to Chrome with their Google Account, so they can personalize and customize Chrome and remember their settings in their Google Account. Try to limit translations to 40 characters. Do not exceed 50 characters."> + Sign in to make Chrome your own + </message> <!-- Account Signin Strings --> <message name="IDS_SIGNIN_ADD_ACCOUNT" desc="Text for adding another Google Account">
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_SUBTITLE_VARIATION_1.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_SUBTITLE_VARIATION_1.png.sha1 new file mode 100644 index 0000000..ad193ce --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_SUBTITLE_VARIATION_1.png.sha1
@@ -0,0 +1 @@ +dd7397b727a0d9dfe7ce02f22de1a603843b5c5e \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_SUBTITLE_VARIATION_2.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_SUBTITLE_VARIATION_2.png.sha1 new file mode 100644 index 0000000..744677a --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_SUBTITLE_VARIATION_2.png.sha1
@@ -0,0 +1 @@ +c73a80ea730d4f7cdfac30a0dd415544a522d966 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_SUBTITLE_VARIATION_3.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_SUBTITLE_VARIATION_3.png.sha1 new file mode 100644 index 0000000..d1bda41b --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_SUBTITLE_VARIATION_3.png.sha1
@@ -0,0 +1 @@ +28bd2f742d8b7dd8d59c1f3af983d55ce74361c5 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_TITLE_VARIATION_1.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_TITLE_VARIATION_1.png.sha1 new file mode 100644 index 0000000..a4294ea --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_TITLE_VARIATION_1.png.sha1
@@ -0,0 +1 @@ +8769b350f4859e24cc3a5f3e2456008587ce41f6 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_TITLE_VARIATION_2.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_TITLE_VARIATION_2.png.sha1 new file mode 100644 index 0000000..596539f --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_FRE_TITLE_VARIATION_2.png.sha1
@@ -0,0 +1 @@ +a6dc65dd8e8d1732dcbd6d1f9142fb88fe67feab \ No newline at end of file
diff --git a/chrome/browser/ui/ash/desks_templates/desks_templates_client_browsertest.cc b/chrome/browser/ui/ash/desks_templates/desks_templates_client_browsertest.cc index fa0fdc62..098303ca 100644 --- a/chrome/browser/ui/ash/desks_templates/desks_templates_client_browsertest.cc +++ b/chrome/browser/ui/ash/desks_templates/desks_templates_client_browsertest.cc
@@ -15,7 +15,6 @@ #include "ash/public/cpp/shell_window_ids.h" #include "ash/session/session_controller_impl.h" #include "ash/shell.h" -#include "ash/wm/desks/desk.h" #include "ash/wm/desks/desks_test_util.h" #include "ash/wm/desks/templates/desks_templates_test_util.h" #include "ash/wm/overview/overview_test_util.h" @@ -50,7 +49,6 @@ #include "chrome/browser/web_applications/test/web_app_install_test_utils.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "chromeos/ui/base/window_state_type.h" #include "components/app_restore/app_launch_info.h" #include "components/app_restore/features.h" @@ -73,7 +71,6 @@ #include "ui/display/screen.h" #include "ui/events/test/event_generator.h" #include "ui/views/controls/button/button.h" -#include "ui/views/controls/button/label_button.h" #include "url/gurl.h" using ::testing::_; @@ -110,8 +107,6 @@ return urls; } -// TODO(crbug.com/1286515): Remove this. Tests should navigate to overview and -// click the button using an event generator. std::unique_ptr<ash::DeskTemplate> CaptureActiveDeskAndSaveTemplate() { base::RunLoop run_loop; std::unique_ptr<ash::DeskTemplate> desk_template; @@ -178,34 +173,11 @@ event_generator.ClickLeftButton(); } -// If `wait_for_ui` is true, wait for the callback from the model to update the -// UI. -void ClickSaveDeskAsTemplateButton(bool wait_for_ui) { +void ClickSaveDeskAsTemplateButton() { views::Button* save_desk_as_template_button = ash::GetSaveDeskAsTemplateButton(); DCHECK(save_desk_as_template_button); ClickButton(save_desk_as_template_button); - if (wait_for_ui) - ash::WaitForDesksTemplatesUI(); -} - -void ClickSaveDeskAsTemplateButton() { - ClickSaveDeskAsTemplateButton(/*wait_for_ui=*/true); -} - -void ClickZeroStateTemplatesButton() { - views::Button* zero_state_templates_button = - ash::GetZeroStateDesksTemplatesButton(); - ASSERT_TRUE(zero_state_templates_button); - ClickButton(zero_state_templates_button); - ash::WaitForDesksTemplatesUI(); -} - -void ClickExpandedStateTemplatesButton() { - views::Button* expanded_state_templates_button = - ash::GetExpandedStateDesksTemplatesButton(); - ASSERT_TRUE(expanded_state_templates_button); - ClickButton(expanded_state_templates_button); ash::WaitForDesksTemplatesUI(); } @@ -218,22 +190,6 @@ ash::WaitForDesksTemplatesUI(); } -const std::vector<ash::DeskTemplate*> GetAllEntries() { - std::vector<ash::DeskTemplate*> templates; - base::RunLoop loop; - DesksTemplatesClient::Get()->GetDeskModel()->GetAllEntries( - base::BindLambdaForTesting( - [&](desks_storage::DeskModel::GetAllEntriesStatus status, - const std::vector<ash::DeskTemplate*>& entries) { - DCHECK_EQ(desks_storage::DeskModel::GetAllEntriesStatus::kOk, - status); - templates = entries; - loop.Quit(); - })); - loop.Run(); - return templates; -} - class MockDesksTemplatesAppLaunchHandler : public DesksTemplatesAppLaunchHandler { public: @@ -519,6 +475,7 @@ const std::u16string kDeskName(u"Test Desk Name"); auto* desks_controller = ash::DesksController::Get(); + ASSERT_EQ(0, desks_controller->GetActiveDeskIndex()); // TODO(crbug.com/1273532): Note that `SetTemplate` allows setting an empty @@ -1072,9 +1029,7 @@ } // Tests that basic operations using the native UI work as expected. -// TODO(crbug.com/1286515): Remove the NativeUI prefix from these tests. Remove -// the tests that do not have the NativeUI prefix other than GetDeskTemplateJson -// once the extension is deprecated. +// TODO(crbug.com/1286515): Remove the NativeUI prefix from these tests. IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, NativeUIBasic) { auto* desk_model = DesksTemplatesClient::Get()->GetDeskModel(); ASSERT_EQ(0, desk_model->GetEntryCount()); @@ -1164,90 +1119,6 @@ browser_window->parent()); } -// Tests that a browser's urls can be captured correctly in the desk template. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUICaptureBrowserUrlsTest) { - // Create a new browser and add a few tabs to it. - Browser* browser = CreateBrowser({GURL(kExampleUrl1), GURL(kExampleUrl2)}); - aura::Window* window = browser->window()->GetNativeWindow(); - - const int32_t browser_window_id = - window->GetProperty(app_restore::kWindowIdKey); - // Get current tabs from browser. - std::vector<GURL> urls = GetURLsForBrowserWindow(browser); - - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - - ClickSaveDeskAsTemplateButton(); - - std::vector<ash::DeskTemplate*> templates = GetAllEntries(); - ASSERT_EQ(1u, templates.size()); - - ash::DeskTemplate* desk_template = templates.front(); - const app_restore::RestoreData* restore_data = - desk_template->desk_restore_data(); - const auto& app_id_to_launch_list = restore_data->app_id_to_launch_list(); - EXPECT_EQ(app_id_to_launch_list.size(), 1u); - - // Find `browser` window's app restore data. - auto iter = app_id_to_launch_list.find(extension_misc::kChromeAppId); - ASSERT_TRUE(iter != app_id_to_launch_list.end()); - auto app_restore_data_iter = iter->second.find(browser_window_id); - ASSERT_TRUE(app_restore_data_iter != iter->second.end()); - const auto& data = app_restore_data_iter->second; - // Check the urls are captured correctly in the `desk_template`. - EXPECT_EQ(data->urls.value(), urls); -} - -// Tests that incognito browser windows will NOT be captured in the desk -// template. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUICaptureIncognitoBrowserTest) { - Browser* incognito_browser = CreateIncognitoBrowser(); - chrome::AddTabAt(incognito_browser, GURL(kExampleUrl1), /*index=*/-1, - /*foreground=*/true); - chrome::AddTabAt(incognito_browser, GURL(kExampleUrl2), /*index=*/-1, - /*foreground=*/true); - incognito_browser->window()->Show(); - aura::Window* window = incognito_browser->window()->GetNativeWindow(); - - const int32_t incognito_browser_window_id = - window->GetProperty(app_restore::kWindowIdKey); - - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - - // Incognito browsers are unsupported so a dialog will popup asking users if - // they are sure. Use a key press to accept the dialog instead of a click as - // dialog buttons think a click generated by the event generator is an - // accidentally click and therefore ignores it. - ClickSaveDeskAsTemplateButton(/*wait_for_ui=*/false); - views::Button* dialog_accept_button = - ash::GetDesksTemplatesDialogAcceptButton(); - ASSERT_TRUE(dialog_accept_button); - aura::Window* root_window = - dialog_accept_button->GetWidget()->GetNativeWindow()->GetRootWindow(); - ui::test::EventGenerator event_generator(root_window); - event_generator.PressAndReleaseKey(ui::VKEY_RETURN); - - std::vector<ash::DeskTemplate*> templates = GetAllEntries(); - ASSERT_EQ(1u, templates.size()); - - ash::DeskTemplate* desk_template = templates.front(); - const app_restore::RestoreData* restore_data = - desk_template->desk_restore_data(); - const auto& app_id_to_launch_list = restore_data->app_id_to_launch_list(); - EXPECT_EQ(1u, app_id_to_launch_list.size()); - - // Find `browser` window's app restore data. - auto iter = app_id_to_launch_list.find(extension_misc::kChromeAppId); - ASSERT_FALSE(iter == app_id_to_launch_list.end()); - auto app_restore_data_iter = iter->second.find(incognito_browser_window_id); - // Created incognito window is NOT in restore list. - EXPECT_TRUE(iter->second.end() == app_restore_data_iter); -} - // Tests that launching a template that contains a system web app works as // expected. IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, @@ -1280,7 +1151,12 @@ ash::ToggleOverview(); ash::WaitForOverviewEnterAnimation(); - ClickZeroStateTemplatesButton(); + views::Button* zero_state_templates_button = + ash::GetZeroStateDesksTemplatesButton(); + ASSERT_TRUE(zero_state_templates_button); + ClickButton(zero_state_templates_button); + ash::WaitForDesksTemplatesUI(); + ClickFirstTemplateItem(); for (auto* browser : *BrowserList::GetInstance()) { @@ -1335,8 +1211,12 @@ // template. ash::ToggleOverview(); ash::WaitForOverviewEnterAnimation(); + views::Button* zero_state_templates_button = + ash::GetZeroStateDesksTemplatesButton(); + ASSERT_TRUE(zero_state_templates_button); + ClickButton(zero_state_templates_button); + ash::WaitForDesksTemplatesUI(); - ClickZeroStateTemplatesButton(); ClickFirstTemplateItem(); // Wait for the tabs to load. @@ -1361,558 +1241,6 @@ EXPECT_EQ(gfx::Rect(), settings_window->layer()->clip_rect()); } -// Tests that browser windows created from a template have the correct bounds -// and window state. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUIBrowserWindowRestorationTest) { - // Create a new browser and set its bounds. - Browser* browser_1 = CreateBrowser({GURL(kExampleUrl1), GURL(kExampleUrl2)}); - const gfx::Rect browser_bounds_1 = gfx::Rect(100, 100, 600, 200); - aura::Window* window_1 = browser_1->window()->GetNativeWindow(); - window_1->SetBounds(browser_bounds_1); - - // Create a new minimized browser. - Browser* browser_2 = CreateBrowser({GURL(kExampleUrl1)}); - const gfx::Rect browser_bounds_2 = gfx::Rect(150, 150, 500, 300); - aura::Window* window_2 = browser_2->window()->GetNativeWindow(); - window_2->SetBounds(browser_bounds_2); - EXPECT_EQ(browser_bounds_2, window_2->bounds()); - browser_2->window()->Minimize(); - - // Create a new maximized browser. - Browser* browser_3 = CreateBrowser({GURL(kExampleUrl1)}); - browser_3->window()->Maximize(); - - EXPECT_EQ(browser_bounds_1, window_1->bounds()); - EXPECT_EQ(browser_bounds_2, window_2->bounds()); - ASSERT_TRUE(browser_2->window()->IsMinimized()); - ASSERT_TRUE(browser_3->window()->IsMaximized()); - - const int32_t browser_window_id_1 = - window_1->GetProperty(app_restore::kWindowIdKey); - const int32_t browser_window_id_2 = - window_2->GetProperty(app_restore::kWindowIdKey); - const int32_t browser_window_id_3 = - browser_3->window()->GetNativeWindow()->GetProperty( - app_restore::kWindowIdKey); - - // Capture the active desk, which contains the three browser windows. - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - ClickSaveDeskAsTemplateButton(); - - ClickFirstTemplateItem(); - - // Wait for the tabs to load. - content::RunAllTasksUntilIdle(); - - // Verify that the browser was launched with the correct bounds. - Browser* new_browser_1 = FindBrowser(browser_window_id_1); - ASSERT_TRUE(new_browser_1); - EXPECT_EQ(browser_bounds_1, - new_browser_1->window()->GetNativeWindow()->bounds()); - - // Verify that the browser was launched and minimized. - Browser* new_browser_2 = FindBrowser(browser_window_id_2); - ASSERT_TRUE(new_browser_2); - ASSERT_TRUE(new_browser_2->window()->IsMinimized()); - EXPECT_EQ(browser_bounds_2, - new_browser_2->window()->GetNativeWindow()->bounds()); - - // Verify that the browser was launched and maximized. - Browser* new_browser_3 = FindBrowser(browser_window_id_3); - ASSERT_TRUE(new_browser_3); - ASSERT_TRUE(new_browser_3->window()->IsMaximized()); -} - -// Tests that saving and launching a template that contains a PWA works as -// expected. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUILaunchTemplateWithPWA) { - Browser* pwa_browser = - InstallAndLaunchPWA(GURL(kExampleUrl1), /*launch_in_browser=*/false); - ASSERT_TRUE(pwa_browser->is_type_app()); - aura::Window* pwa_window = pwa_browser->window()->GetNativeWindow(); - const gfx::Rect pwa_bounds(50, 50, 500, 500); - pwa_window->SetBounds(pwa_bounds); - const int32_t pwa_window_id = - pwa_window->GetProperty(app_restore::kWindowIdKey); - const std::string* app_name = - pwa_window->GetProperty(app_restore::kBrowserAppNameKey); - ASSERT_TRUE(app_name); - - // Capture the active desk, which contains the PWA. - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - ClickSaveDeskAsTemplateButton(); - - std::vector<ash::DeskTemplate*> templates = GetAllEntries(); - ASSERT_EQ(1u, templates.size()); - - // Find `pwa_browser` window's app restore data. - ash::DeskTemplate* desk_template = templates.front(); - const app_restore::RestoreData* restore_data = - desk_template->desk_restore_data(); - const auto& app_id_to_launch_list = restore_data->app_id_to_launch_list(); - EXPECT_EQ(1u, app_id_to_launch_list.size()); - ASSERT_TRUE(restore_data->HasAppTypeBrowser()); - auto iter = app_id_to_launch_list.find(extension_misc::kChromeAppId); - ASSERT_TRUE(iter != app_id_to_launch_list.end()); - auto app_restore_data_iter = iter->second.find(pwa_window_id); - ASSERT_TRUE(app_restore_data_iter != iter->second.end()); - const auto& data = app_restore_data_iter->second; - // Verify window info are correctly captured. - EXPECT_EQ(pwa_bounds, data->current_bounds.value()); - ASSERT_TRUE(data->app_type_browser.has_value() && - data->app_type_browser.value()); - EXPECT_EQ(*app_name, *data->app_name); - - // Launch the template. - ClickFirstTemplateItem(); - - // Verify that the PWA was launched correctly. - Browser* new_pwa_browser = FindBrowser(pwa_window_id); - ASSERT_TRUE(new_pwa_browser); - ASSERT_TRUE(new_pwa_browser->is_type_app()); - aura::Window* new_browser_window = - new_pwa_browser->window()->GetNativeWindow(); - EXPECT_NE(new_browser_window, pwa_window); - EXPECT_EQ(pwa_bounds, new_browser_window->bounds()); - const std::string* new_app_name = - new_browser_window->GetProperty(app_restore::kBrowserAppNameKey); - ASSERT_TRUE(new_app_name); - EXPECT_EQ(*app_name, *new_app_name); -} - -// Tests that saving and launching a template that contains a PWA in a browser -// window works as expected. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUILaunchTemplateWithPWAInBrowser) { - Browser* pwa_browser = - InstallAndLaunchPWA(GURL(kYoutubeUrl), /*launch_in_browser=*/true); - aura::Window* pwa_window = pwa_browser->window()->GetNativeWindow(); - const int32_t pwa_window_id = - pwa_window->GetProperty(app_restore::kWindowIdKey); - - // Capture the active desk, which contains the PWA. - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - ClickSaveDeskAsTemplateButton(); - - std::vector<ash::DeskTemplate*> templates = GetAllEntries(); - ASSERT_EQ(1u, templates.size()); - - // Test that `pwa_browser` restore data can be found. - ash::DeskTemplate* desk_template = templates.front(); - const app_restore::RestoreData* restore_data = - desk_template->desk_restore_data(); - const auto& app_id_to_launch_list = restore_data->app_id_to_launch_list(); - EXPECT_EQ(1u, app_id_to_launch_list.size()); - - // Test that `pwa_browser`'s restore data is saved under the Chrome browser - // app id extension_misc::kChromeAppId, not Youtube app id - // extension_misc::kYoutubeAppId. - auto iter = app_id_to_launch_list.find(extension_misc::kChromeAppId); - ASSERT_TRUE(iter != app_id_to_launch_list.end()); - auto app_restore_data_iter = iter->second.find(pwa_window_id); - ASSERT_TRUE(app_restore_data_iter != iter->second.end()); - - iter = app_id_to_launch_list.find(extension_misc::kYoutubeAppId); - EXPECT_TRUE(iter == app_id_to_launch_list.end()); -} - -// Tests that browsers and SWAs can be captured correctly in the desk template. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUICaptureActiveDeskAsTemplateTest) { - // Change `browser`'s bounds. - const gfx::Rect browser_bounds(800, 200); - aura::Window* window = browser()->window()->GetNativeWindow(); - window->SetBounds(browser_bounds); - // Make the window visible on all desks. - window->SetProperty(aura::client::kWindowWorkspaceKey, - aura::client::kWindowWorkspaceVisibleOnAllWorkspaces); - const int32_t browser_window_id = - window->GetProperty(app_restore::kWindowIdKey); - - // Create the settings app, which is a system web app. - web_app::AppId settings_app_id = - CreateSettingsSystemWebApp(browser()->profile()); - - // Change the Settings app's bounds too. - const gfx::Rect settings_app_bounds(100, 100, 800, 300); - aura::Window* settings_window = FindBrowserWindow(kSettingsWindowId); - const int32_t settings_window_id = - settings_window->GetProperty(app_restore::kWindowIdKey); - ASSERT_TRUE(settings_window); - settings_window->SetBounds(settings_app_bounds); - - auto* desks_controller = ash::DesksController::Get(); - const std::u16string desk_name = - desks_controller->GetDeskName(desks_controller->GetActiveDeskIndex()); - - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - - ClickSaveDeskAsTemplateButton(); - - std::vector<ash::DeskTemplate*> templates = GetAllEntries(); - ASSERT_EQ(1u, templates.size()); - - ash::DeskTemplate* desk_template = templates.front(); - - // Test the default template's name is the desk's name it was created from. - EXPECT_EQ(desk_name, desk_template->template_name()); - - const app_restore::RestoreData* restore_data = - desk_template->desk_restore_data(); - const auto& app_id_to_launch_list = restore_data->app_id_to_launch_list(); - EXPECT_EQ(2u, app_id_to_launch_list.size()); - - // Find `browser` window's app restore data. - auto iter = app_id_to_launch_list.find(extension_misc::kChromeAppId); - ASSERT_NE(iter, app_id_to_launch_list.end()); - auto app_restore_data_iter = iter->second.find(browser_window_id); - ASSERT_NE(iter->second.end(), app_restore_data_iter); - const auto& data = app_restore_data_iter->second; - // Verify window info are correctly captured. - EXPECT_EQ(browser_bounds, data->current_bounds.value()); - // `visible_on_all_workspaces` should have been reset even though - // the captured window is visible on all workspaces. - EXPECT_FALSE(data->desk_id.has_value()); - auto* screen = display::Screen::GetScreen(); - EXPECT_EQ(screen->GetDisplayNearestWindow(window).id(), - data->display_id.value()); - EXPECT_EQ(window->GetProperty(aura::client::kShowStateKey), - chromeos::ToWindowShowState(data->window_state_type.value())); - // We don't capture the window's desk_id as a template will always - // create in a new desk. - EXPECT_FALSE(data->desk_id.has_value()); - - // Find Setting app's app restore data. - auto iter2 = app_id_to_launch_list.find(settings_app_id); - ASSERT_NE(app_id_to_launch_list.end(), iter2); - auto app_restore_data_iter2 = iter2->second.find(settings_window_id); - ASSERT_NE(iter->second.end(), app_restore_data_iter2); - const auto& data2 = app_restore_data_iter2->second; - EXPECT_EQ( - static_cast<int>(apps::mojom::LaunchContainer::kLaunchContainerWindow), - data2->container.value()); - EXPECT_EQ(static_cast<int>(WindowOpenDisposition::NEW_WINDOW), - data2->disposition.value()); - // Verify window info are correctly captured. - EXPECT_EQ(settings_app_bounds, data2->current_bounds.value()); - EXPECT_FALSE(data2->desk_id.has_value()); - EXPECT_EQ(screen->GetDisplayNearestWindow(window).id(), - data->display_id.value()); - EXPECT_EQ(window->GetProperty(aura::client::kShowStateKey), - chromeos::ToWindowShowState(data->window_state_type.value())); - EXPECT_EQ(window->GetProperty(aura::client::kShowStateKey), - chromeos::ToWindowShowState(data->window_state_type.value())); - EXPECT_FALSE(data2->desk_id.has_value()); -} - -// Tests that launching a template that contains a chrome app works as expected. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUILaunchTemplateWithChromeApp) { - // Create a chrome app. - const extensions::Extension* extension = - LoadAndLaunchPlatformApp("launch", "Launched"); - ASSERT_TRUE(extension); - - const std::string extension_id = extension->id(); - ::full_restore::SaveAppLaunchInfo( - profile()->GetPath(), - std::make_unique<app_restore::AppLaunchInfo>( - extension_id, apps::mojom::LaunchContainer::kLaunchContainerWindow, - WindowOpenDisposition::NEW_WINDOW, display::kDefaultDisplayId, - std::vector<base::FilePath>{}, nullptr)); - - extensions::AppWindow* app_window = CreateAppWindow(profile(), extension); - ASSERT_TRUE(app_window); - ASSERT_TRUE(GetFirstAppWindowForApp(extension_id)); - - // Enter overview and save the current desk as a template. - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - - ClickSaveDeskAsTemplateButton(); - - // Close the chrome app window. We'll need to verify if it reopens later. - views::Widget* app_widget = - views::Widget::GetWidgetForNativeWindow(app_window->GetNativeWindow()); - app_widget->CloseNow(); - ASSERT_FALSE(GetFirstAppWindowForApp(extension_id)); - - ash::DesksController* desks_controller = ash::DesksController::Get(); - ASSERT_EQ(0, desks_controller->GetActiveDeskIndex()); - - // `BrowserAppLauncher::LaunchAppWithParams()` does not launch the chrome app - // in tests, so here we set up a mock app launch handler and just verify a - // `LaunchSystemWebAppOrChromeApp()` call with the associated extension is - // seen. - auto mock_app_launch_handler = - std::make_unique<MockDesksTemplatesAppLaunchHandler>(profile()); - MockDesksTemplatesAppLaunchHandler* mock_app_launch_handler_ptr = - mock_app_launch_handler.get(); - ScopedDesksTemplatesAppLaunchHandlerSetter scoped_launch_handler( - std::move(mock_app_launch_handler)); - - EXPECT_CALL(*mock_app_launch_handler_ptr, - LaunchSystemWebAppOrChromeApp(_, extension_id, _)); - - // Launch the template we saved. - ClickFirstTemplateItem(); -} - -// crbug.com/1288715: flaky on Linux. -#if defined(OS_LINUX) -#define MAYBE_NativeUILaunchMultipleDeskTemplates \ - DISABLED_NativeUILaunchMultipleDeskTemplates -#else -#define MAYBE_NativeUILaunchMultipleDeskTemplates \ - NativeUILaunchMultipleDeskTemplates -#endif - -// Tests that launching the same desk template multiple times creates desks with -// different/incremented names. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - MAYBE_NativeUILaunchMultipleDeskTemplates) { - const base::GUID kDeskUuid = base::GUID::GenerateRandomV4(); - const std::u16string kDeskName(u"Test Desk Name"); - - auto* desks_controller = ash::DesksController::Get(); - - ASSERT_EQ(0, desks_controller->GetActiveDeskIndex()); - desks_controller->desks()[0]->SetName(kDeskName, true); - - // Save a template. - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - - ClickSaveDeskAsTemplateButton(); - - // Helper that launches a template by entering the grid and clicking on the - // lone template item, and then checks the expected name. - bool first_run = true; - auto check_launch_template_desk_name = - [kDeskUuid, &first_run](const std::u16string& desk_name) { - SCOPED_TRACE(desk_name); - - // We are already on the templates grid after saving the template, so no - // need to click the templates button the first time we use this helper. - if (!first_run) - ClickExpandedStateTemplatesButton(); - - ClickFirstTemplateItem(); - - // Wait for the tabs to load. - content::RunAllTasksUntilIdle(); - - // A DCHECK related to the desks templates animation fails without this - // wait. - // TODO(sammiequon): Find a proper fix and remove this delay. - base::RunLoop run_loop; - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, run_loop.QuitClosure(), base::Milliseconds(500)); - run_loop.Run(); - - first_run = false; - }; - - // Launching a desk from the template creates a desk with the same name as the - // template. - desks_controller->desks()[0]->SetName(u"Desk", true); - check_launch_template_desk_name(kDeskName); - - // Launch more desks from the template and verify that the newly created desks - // have unique names. - check_launch_template_desk_name(std::u16string(kDeskName).append(u" (1)")); - check_launch_template_desk_name(std::u16string(kDeskName).append(u" (2)")); - - // Remove "Test Desk Name (1)", which means the next created desk from - // template will have that name. Then it will skip (2) since it already - // exists, and create the next desk with (3). - RemoveDesk(desks_controller->desks()[2].get()); - check_launch_template_desk_name(std::u16string(kDeskName).append(u" (1)")); - check_launch_template_desk_name(std::u16string(kDeskName).append(u" (3)")); - - // Same as above, but make sure that deleting the desk with the exact template - // name still functions the same by only filling in whatever name is - // available. - RemoveDesk(desks_controller->desks()[1].get()); - check_launch_template_desk_name(kDeskName); - check_launch_template_desk_name(std::u16string(kDeskName).append(u" (4)")); -} - -// Tests that the windows and tabs count histogram is recorded properly. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUIDeskTemplateWindowAndTabCountHistogram) { - base::HistogramTester histogram_tester; - - // Create the settings app, which is a system web app. - CreateSettingsSystemWebApp(browser()->profile()); - - CreateBrowser({GURL(kExampleUrl1), GURL(kExampleUrl2)}); - CreateBrowser({GURL(kExampleUrl1), GURL(kExampleUrl2), GURL(kExampleUrl3)}); - - // Save a template. - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - ClickSaveDeskAsTemplateButton(); - - constexpr char kWindowCountHistogramName[] = "Ash.DeskTemplate.WindowCount"; - constexpr char kTabCountHistogramName[] = "Ash.DeskTemplate.TabCount"; - constexpr char kWindowAndTabCountHistogramName[] = - "Ash.DeskTemplate.WindowAndTabCount"; - // NOTE: there is an existing browser with 1 tab created by BrowserMain(). - histogram_tester.ExpectBucketCount(kWindowCountHistogramName, 4, 1); - histogram_tester.ExpectBucketCount(kTabCountHistogramName, 6, 1); - histogram_tester.ExpectBucketCount(kWindowAndTabCountHistogramName, 7, 1); -} - -// Tests that the launch from template histogram is recorded properly. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUIDeskTemplateLaunchFromTemplateHistogram) { - base::HistogramTester histogram_tester; - - // Create a new browser. - CreateBrowser({}); - - // Save a template. - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - ClickSaveDeskAsTemplateButton(); - - const int launches = 5; - for (int i = 0; i < launches; i++) { - ClickFirstTemplateItem(); - - // A DCHECK related to the desks templates animation fails without this - // wait. - // TODO(sammiequon): Find a proper fix and remove this delay. - base::RunLoop run_loop; - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, run_loop.QuitClosure(), base::Milliseconds(500)); - run_loop.Run(); - - ClickExpandedStateTemplatesButton(); - } - - // TODO(crbug.com/1287649): This histogram is double counted when a template - // is launched from the UI. - constexpr char kLaunchFromTemplateHistogramName[] = - "Ash.DeskTemplate.LaunchFromTemplate"; - histogram_tester.ExpectTotalCount(kLaunchFromTemplateHistogramName, - 2 * launches); -} - -// Tests that the template count histogram is recorded properly. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUIDeskTemplateUserTemplateCountHistogram) { - base::HistogramTester histogram_tester; - - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - - // Save 3 templates. - const int saves = 3; - for (int i = 0; i < saves; i++) { - ClickSaveDeskAsTemplateButton(); - - // Exit and renenter overview to save the next template. Once we are viewing - // the grid we can't go back to regular overview unless we exit overview or - // delete all the templates. - if (i != saves - 1) { - ash::ToggleOverview(); - ash::WaitForOverviewExitAnimation(); - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - } - } - - views::Button* delete_button = ash::GetTemplateItemDeleteButton(/*index=*/0); - ClickButton(delete_button); - - // Confirm deleting a template. Use a key press to accept the dialog instead - // of a click as dialog buttons think a click generated by the event generator - // is an accidentally click and therefore ignores it. - views::Button* dialog_accept_button = - ash::GetDesksTemplatesDialogAcceptButton(); - ASSERT_TRUE(dialog_accept_button); - aura::Window* root_window = - dialog_accept_button->GetWidget()->GetNativeWindow()->GetRootWindow(); - ui::test::EventGenerator event_generator(root_window); - event_generator.PressAndReleaseKey(ui::VKEY_RETURN); - - // Wait for the model to update. - ash::WaitForDesksTemplatesUI(); - - // Save one more template. - ash::ToggleOverview(); - ash::WaitForOverviewExitAnimation(); - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - ClickSaveDeskAsTemplateButton(); - - // Verify that all template saves and deletes are captured by the histogram. - constexpr char kUserTemplateCountHistogramName[] = - "Ash.DeskTemplate.UserTemplateCount"; - histogram_tester.ExpectBucketCount(kUserTemplateCountHistogramName, 1, 1); - histogram_tester.ExpectBucketCount(kUserTemplateCountHistogramName, 2, 2); - histogram_tester.ExpectBucketCount(kUserTemplateCountHistogramName, 3, 2); -} - -// Tests that browser session restore isn't triggered when we launch a template -// that contains a browser window. -IN_PROC_BROWSER_TEST_F(DesksTemplatesClientTest, - NativeUIPreventBrowserSessionRestoreTest) { - // Do not exit from test or delete the Profile* when last browser is closed. - ScopedKeepAlive keep_alive(KeepAliveOrigin::BROWSER, - KeepAliveRestartOption::DISABLED); - ScopedProfileKeepAlive profile_keep_alive( - browser()->profile(), ProfileKeepAliveOrigin::kBrowserWindow); - - // Enable session service. - SessionStartupPref pref(SessionStartupPref::LAST); - Profile* profile = browser()->profile(); - SessionStartupPref::SetStartupPref(profile, pref); - - const int expected_tab_count = 2; - chrome::AddTabAt(browser(), GURL(kExampleUrl2), /*index=*/-1, - /*foreground=*/true); - EXPECT_EQ(expected_tab_count, browser()->tab_strip_model()->count()); - const int32_t browser_window_id = - browser()->window()->GetNativeWindow()->GetProperty( - app_restore::kWindowIdKey); - - // Enter overview and save the current desk as a template. - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - - ClickSaveDeskAsTemplateButton(); - - // Exit overview, close the browser and verify that all browser windows are - // closed. - ash::ToggleOverview(); - ash::WaitForOverviewExitAnimation(); - CloseBrowserSynchronously(browser()); - EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); - - // Reenter overview and launch the template we saved. - ash::ToggleOverview(); - ash::WaitForOverviewEnterAnimation(); - ash::WaitForDesksTemplatesUI(); - ClickZeroStateTemplatesButton(); - ClickFirstTemplateItem(); - - // Verify that the browser was launched with the correct number of tabs, and - // that browser session restore did not restore any windows/tabs. - Browser* new_browser = FindBrowser(browser_window_id); - ASSERT_TRUE(new_browser); - EXPECT_EQ(expected_tab_count, GetURLsForBrowserWindow(new_browser).size()); - EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); -} - class DesksTemplatesClientArcTest : public InProcessBrowserTest { public: DesksTemplatesClientArcTest() { @@ -1993,8 +1321,12 @@ // template. ash::ToggleOverview(); ash::WaitForOverviewEnterAnimation(); + views::Button* zero_state_templates_button = + ash::GetZeroStateDesksTemplatesButton(); + ASSERT_TRUE(zero_state_templates_button); + ClickButton(zero_state_templates_button); + ash::WaitForDesksTemplatesUI(); - ClickZeroStateTemplatesButton(); ClickFirstTemplateItem(); ash::ToggleOverview(); @@ -2016,6 +1348,15 @@ arc_helper()->StopInstance(); } +// TODO(crbug.com/1273532): Add more tests: +// - Deleting templates. +// - Launching templates with uninstalled apps. +// - Launching ARC apps which already have an instance open. +// - Test for spoken feedback. +// - Port tests that use `DesksTemplatesClient` directly. These were meant to +// test launching while the prototype extension was being built, but now we +// can do end to end tests with the native UI. + class DesksTemplatesClientMultiProfileTest : public ash::LoginManagerTest { public: DesksTemplatesClientMultiProfileTest() : ash::LoginManagerTest() {
diff --git a/chrome/browser/ui/cocoa/share_menu_controller_browsertest.mm b/chrome/browser/ui/cocoa/share_menu_controller_browsertest.mm index e1d844b..08d593c 100644 --- a/chrome/browser/ui/cocoa/share_menu_controller_browsertest.mm +++ b/chrome/browser/ui/cocoa/share_menu_controller_browsertest.mm
@@ -66,7 +66,7 @@ ASSERT_TRUE(embedded_test_server()->Start()); url_ = embedded_test_server()->GetURL("/title2.html"); - AddTabAtIndex(0, url_, ui::PAGE_TRANSITION_TYPED); + ASSERT_TRUE(AddTabAtIndex(0, url_, ui::PAGE_TRANSITION_TYPED)); controller_.reset([[ShareMenuController alloc] init]); }
diff --git a/chrome/browser/ui/content_settings/content_setting_image_model.cc b/chrome/browser/ui/content_settings/content_setting_image_model.cc index 3b722b9..83683f5 100644 --- a/chrome/browser/ui/content_settings/content_setting_image_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_image_model.cc
@@ -378,7 +378,8 @@ bool ContentSettingImageModel::ShouldNotifyAccessibility( content::WebContents* contents) const { - return image_type_should_notify_accessibility_ && explanatory_string_id_ && + return image_type_should_notify_accessibility_ && + AccessibilityAnnouncementStringId() && !ContentSettingImageModelStates::Get(contents) ->GetAccessibilityNotified(image_type()); } @@ -580,11 +581,10 @@ set_icon(vector_icons::kLocationOnIcon, is_allowed ? gfx::kNoneIcon : vector_icons::kBlockedBadgeIcon); - set_tooltip(l10n_util::GetStringUTF16(is_allowed - ? IDS_ALLOWED_GEOLOCATION_MESSAGE - : IDS_BLOCKED_GEOLOCATION_MESSAGE)); - set_explanatory_string_id(is_allowed ? IDS_ALLOWED_GEOLOCATION_MESSAGE - : IDS_BLOCKED_GEOLOCATION_MESSAGE); + auto message_id = is_allowed ? IDS_ALLOWED_GEOLOCATION_MESSAGE + : IDS_BLOCKED_GEOLOCATION_MESSAGE; + set_tooltip(l10n_util::GetStringUTF16(message_id)); + set_accessibility_string_id(message_id); return true; } @@ -763,10 +763,12 @@ if (IsCameraBlockedOnSiteLevel() || IsMicBlockedOnSiteLevel()) { set_icon(vector_icons::kVideocamIcon, vector_icons::kBlockedBadgeIcon); set_tooltip(l10n_util::GetStringUTF16(IDS_MICROPHONE_CAMERA_BLOCKED)); + set_accessibility_string_id(IDS_MICROPHONE_CAMERA_BLOCKED); } else if (DidCameraAccessFailBecauseOfSystemLevelBlock() || DidMicAccessFailBecauseOfSystemLevelBlock()) { set_icon(vector_icons::kVideocamIcon, vector_icons::kBlockedBadgeIcon); set_tooltip(l10n_util::GetStringUTF16(IDS_MICROPHONE_CAMERA_BLOCKED)); + set_accessibility_string_id(IDS_MICROPHONE_CAMERA_BLOCKED); if (content_settings->camera_was_just_granted_on_site_level() || content_settings->mic_was_just_granted_on_site_level()) { // Automatically trigger the new bubble, if the camera @@ -787,9 +789,11 @@ if (IsCameraBlockedOnSiteLevel()) { set_icon(vector_icons::kVideocamIcon, vector_icons::kBlockedBadgeIcon); set_tooltip(l10n_util::GetStringUTF16(IDS_CAMERA_BLOCKED)); + set_accessibility_string_id(IDS_CAMERA_BLOCKED); } else if (DidCameraAccessFailBecauseOfSystemLevelBlock()) { set_icon(vector_icons::kVideocamIcon, vector_icons::kBlockedBadgeIcon); set_tooltip(l10n_util::GetStringUTF16(IDS_CAMERA_BLOCKED)); + set_accessibility_string_id(IDS_CAMERA_BLOCKED); if (content_settings->camera_was_just_granted_on_site_level()) { set_should_auto_open_bubble(true); } else { @@ -798,6 +802,7 @@ } else { set_icon(vector_icons::kVideocamIcon, gfx::kNoneIcon); set_tooltip(l10n_util::GetStringUTF16(IDS_CAMERA_ACCESSED)); + set_accessibility_string_id(IDS_CAMERA_ACCESSED); } return true; } @@ -806,9 +811,11 @@ if (IsMicBlockedOnSiteLevel()) { set_icon(vector_icons::kMicIcon, vector_icons::kBlockedBadgeIcon); set_tooltip(l10n_util::GetStringUTF16(IDS_MICROPHONE_BLOCKED)); + set_accessibility_string_id(IDS_MICROPHONE_BLOCKED); } else if (DidMicAccessFailBecauseOfSystemLevelBlock()) { set_icon(vector_icons::kMicIcon, vector_icons::kBlockedBadgeIcon); set_tooltip(l10n_util::GetStringUTF16(IDS_MICROPHONE_BLOCKED)); + set_accessibility_string_id(IDS_MICROPHONE_BLOCKED); if (content_settings->mic_was_just_granted_on_site_level()) { set_should_auto_open_bubble(true); } else { @@ -817,6 +824,7 @@ } else { set_icon(vector_icons::kMicIcon, gfx::kNoneIcon); set_tooltip(l10n_util::GetStringUTF16(IDS_MICROPHONE_ACCESSED)); + set_accessibility_string_id(IDS_MICROPHONE_ACCESSED); } return true; } @@ -838,7 +846,7 @@ : IDS_MICROPHONE_ACCESSED; } set_tooltip(l10n_util::GetStringUTF16(id)); - set_explanatory_string_id(id); + set_accessibility_string_id(id); return true; } @@ -1020,6 +1028,7 @@ QuietNotificationPermissionUiState::ShouldShowPromo(profile)); if (permissions::PermissionUiSelector::ShouldSuppressAnimation( manager->ReasonForUsingQuietUi())) { + set_accessibility_string_id(IDS_NOTIFICATIONS_OFF_EXPLANATORY_TEXT); set_explanatory_string_id(0); } else { set_explanatory_string_id(IDS_NOTIFICATIONS_OFF_EXPLANATORY_TEXT); @@ -1052,6 +1061,11 @@ icon_color, *icon_badge_)); } +int ContentSettingImageModel::AccessibilityAnnouncementStringId() const { + return explanatory_string_id_ ? explanatory_string_id_ + : accessibility_string_id_; +} + ContentSettingImageModel::ContentSettingImageModel( ImageType image_type, bool image_type_should_notify_accessibility)
diff --git a/chrome/browser/ui/content_settings/content_setting_image_model.h b/chrome/browser/ui/content_settings/content_setting_image_model.h index 91c82a3..96d58dc 100644 --- a/chrome/browser/ui/content_settings/content_setting_image_model.h +++ b/chrome/browser/ui/content_settings/content_setting_image_model.h
@@ -101,6 +101,7 @@ // Returns the resource ID of a string to show when the icon appears, or 0 if // we don't wish to show anything. int explanatory_string_id() const { return explanatory_string_id_; } + int AccessibilityAnnouncementStringId() const; const std::u16string& get_tooltip() const { return tooltip_; } const gfx::VectorIcon* get_icon_badge() const { return icon_badge_; } @@ -120,6 +121,9 @@ bool IsMacRestoreLocationPermissionExperimentActive(); protected: + // Note: image_type_should_notify_accessibility by itself does not guarantee + // the item will be read; it also needs a valid explanatory_text_id or + // accessibility_string_id. explicit ContentSettingImageModel( ImageType type, bool image_type_should_notify_accessibility = false); @@ -139,6 +143,8 @@ icon_badge_ = &badge; } + void set_accessibility_string_id(int id) { accessibility_string_id_ = id; } + void set_tooltip(const std::u16string& tooltip) { tooltip_ = tooltip; } void set_should_auto_open_bubble(const bool should_auto_open_bubble) { should_auto_open_bubble_ = should_auto_open_bubble; @@ -153,6 +159,7 @@ raw_ptr<const gfx::VectorIcon> icon_; raw_ptr<const gfx::VectorIcon> icon_badge_; int explanatory_string_id_ = 0; + int accessibility_string_id_ = 0; std::u16string tooltip_; const ImageType image_type_; const bool image_type_should_notify_accessibility_;
diff --git a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc index d08c2e5..d256cb8 100644 --- a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc +++ b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
@@ -256,7 +256,8 @@ content_settings->OnContentBlocked(ContentSettingsType::SENSORS); UpdateModelAndVerifyStates( content_setting_image_model.get(), /* is_visible = */ true, - /* tooltip_empty = */ false, IDS_SENSORS_BLOCKED_TOOLTIP, 0); + /* tooltip_empty = */ false, IDS_SENSORS_BLOCKED_TOOLTIP, + /* explanatory_string_id = */ 0); NavigateAndCommit(web_contents(), GURL("http://www.google.com")); content_settings = @@ -270,7 +271,8 @@ content_settings->OnContentAllowed(ContentSettingsType::SENSORS); UpdateModelAndVerifyStates( content_setting_image_model.get(), /* is_visible = */ true, - /* tooltip_empty = */ false, IDS_SENSORS_ALLOWED_TOOLTIP, 0); + /* tooltip_empty = */ false, IDS_SENSORS_ALLOWED_TOOLTIP, + /* explanatory_string_id = */ 0); NavigateAndCommit(web_contents(), GURL("http://www.google.com")); content_settings = @@ -284,7 +286,8 @@ content_settings->OnContentBlocked(ContentSettingsType::SENSORS); UpdateModelAndVerifyStates( content_setting_image_model.get(), /* is_visible = */ true, - /* tooltip_empty = */ false, IDS_SENSORS_BLOCKED_TOOLTIP, 0); + /* tooltip_empty = */ false, IDS_SENSORS_BLOCKED_TOOLTIP, + /* explanatory_string_id = */ 0); } #if BUILDFLAG(IS_MAC) @@ -326,7 +329,7 @@ UpdateModelAndVerifyStates( content_setting_image_model.get(), /* is_visible = */ true, /* tooltip_empty = */ false, IDS_ALLOWED_GEOLOCATION_MESSAGE, - IDS_ALLOWED_GEOLOCATION_MESSAGE); + /* explanatory_string_id = */ 0); settings_map->SetDefaultContentSetting(ContentSettingsType::GEOLOCATION, CONTENT_SETTING_BLOCK); @@ -334,14 +337,14 @@ UpdateModelAndVerifyStates( content_setting_image_model.get(), /* is_visible = */ true, /* tooltip_empty = */ false, IDS_BLOCKED_GEOLOCATION_MESSAGE, - IDS_BLOCKED_GEOLOCATION_MESSAGE); + /* explanatory_string_id = */ 0); geolocation_manager->SetSystemPermission( device::LocationSystemPermissionStatus::kDenied); UpdateModelAndVerifyStates( content_setting_image_model.get(), /* is_visible = */ true, /* tooltip_empty = */ false, IDS_BLOCKED_GEOLOCATION_MESSAGE, - IDS_BLOCKED_GEOLOCATION_MESSAGE); + /* explanatory_string_id = */ 0); content_settings->OnContentAllowed(ContentSettingsType::GEOLOCATION); UpdateModelAndVerifyStates( @@ -394,8 +397,7 @@ content_settings->OnContentBlocked(ContentSettingsType::GEOLOCATION); UpdateModelAndVerifyStates( content_setting_image_model.get(), /* is_visible = */ true, - /* tooltip_empty = */ false, IDS_BLOCKED_GEOLOCATION_MESSAGE, - IDS_BLOCKED_GEOLOCATION_MESSAGE); + /* tooltip_empty = */ false, IDS_BLOCKED_GEOLOCATION_MESSAGE, 0); } TEST_F(ContentSettingImageModelTest, GeolocationAccessDeniedExperiment) {
diff --git a/chrome/browser/ui/global_media_controls/OWNERS b/chrome/browser/ui/global_media_controls/OWNERS index ce0c6e51..119b26f 100644 --- a/chrome/browser/ui/global_media_controls/OWNERS +++ b/chrome/browser/ui/global_media_controls/OWNERS
@@ -2,7 +2,7 @@ per-file cast_*=muyaoxu@google.com per-file cast_*=takumif@chromium.org -per-file cast_*=file://components/media_router/OWNERS +per-file cast_*=file://chrome/browser/media/router/OWNERS per-file presentation_request_*=muyaoxu@google.com per-file presentation_request_*=takumif@chromium.org -per-file presentation_request_*=file://components/media_router/OWNERS +per-file presentation_request_*=file://chrome/browser/media/router/OWNERS
diff --git a/chrome/browser/ui/toolbar/app_menu_model_unittest.cc b/chrome/browser/ui/toolbar/app_menu_model_unittest.cc index 94a4888..bc7cfc77 100644 --- a/chrome/browser/ui/toolbar/app_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/app_menu_model_unittest.cc
@@ -248,10 +248,9 @@ #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) { - ListPrefUpdateDeprecated update( - TestingBrowserProcess::GetGlobal()->local_state(), - policy::policy_prefs::kSystemFeaturesDisableList); - base::ListValue* list = update.Get(); + ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(), + policy::policy_prefs::kSystemFeaturesDisableList); + base::Value* list = update.Get(); list->Append(policy::SystemFeature::kBrowserSettings); } EXPECT_FALSE(model.IsEnabledAt(options_index)); @@ -263,10 +262,9 @@ #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) { - ListPrefUpdateDeprecated update( - TestingBrowserProcess::GetGlobal()->local_state(), - policy::policy_prefs::kSystemFeaturesDisableList); - base::ListValue* list = update.Get(); + ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(), + policy::policy_prefs::kSystemFeaturesDisableList); + base::Value* list = update.Get(); list->ClearList(); } EXPECT_TRUE(model.IsEnabledAt(options_index));
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc index 4131cd0..ecfe131 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc
@@ -120,17 +120,6 @@ return menu_delegate_->GetDropOperation(item, event, position); } -ui::mojom::DragOperation BookmarkMenuController::OnPerformDrop( - MenuItemView* menu, - DropPosition position, - const ui::DropTargetEvent& event) { - ui::mojom::DragOperation result = - menu_delegate_->OnPerformDrop(menu, position, event); - if (for_drop_) - delete this; - return result; -} - views::View::DropCallback BookmarkMenuController::GetDropCallback( views::MenuItemView* menu, DropPosition position,
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h index 5e2c75c..984a8788 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h
@@ -93,10 +93,6 @@ ui::mojom::DragOperation GetDropOperation(views::MenuItemView* item, const ui::DropTargetEvent& event, DropPosition* position) override; - ui::mojom::DragOperation OnPerformDrop( - views::MenuItemView* menu, - DropPosition position, - const ui::DropTargetEvent& event) override; views::View::DropCallback GetDropCallback( views::MenuItemView* menu, DropPosition position,
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc index 16bf84e..b082829 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
@@ -27,6 +27,7 @@ #include "ui/events/event_utils.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/color_utils.h" +#include "ui/strings/grit/ui_strings.h" #include "ui/views/accessibility/view_accessibility.h" #include "ui/views/animation/ink_drop.h" #include "ui/views/animation/ink_drop_impl.h" @@ -111,10 +112,17 @@ SetVisible(true); if (content_setting_image_model_->ShouldNotifyAccessibility(web_contents)) { - GetViewAccessibility().OverrideName(l10n_util::GetStringUTF16( - content_setting_image_model_->explanatory_string_id())); - GetViewAccessibility().OverrideDescription( - l10n_util::GetStringUTF16(IDS_A11Y_OMNIBOX_CHIP_HINT)); + auto name = l10n_util::GetStringUTF16( + content_setting_image_model_->AccessibilityAnnouncementStringId()); + auto desc = l10n_util::GetStringUTF16(IDS_A11Y_OMNIBOX_CHIP_HINT); + GetViewAccessibility().OverrideName(name); + GetViewAccessibility().OverrideDescription(desc); +#if BUILDFLAG(IS_MAC) + NotifyAccessibilityEvent(ax::mojom::Event::kAlert, true); +#else + GetViewAccessibility().AnnounceText(l10n_util::GetStringFUTF16( + IDS_CONCAT_TWO_STRINGS_WITH_COMMA, name, desc)); +#endif NotifyAccessibilityEvent(ax::mojom::Event::kAlert, true); content_setting_image_model_->AccessibilityWasNotified(web_contents); }
diff --git a/chrome/browser/ui/views/passwords/password_generation_popup_view_views.cc b/chrome/browser/ui/views/passwords/password_generation_popup_view_views.cc index 9070ec4..9a65d836 100644 --- a/chrome/browser/ui/views/passwords/password_generation_popup_view_views.cc +++ b/chrome/browser/ui/views/passwords/password_generation_popup_view_views.cc
@@ -71,9 +71,6 @@ void OnMouseReleased(const ui::MouseEvent& event) override; void OnGestureEvent(ui::GestureEvent* event) override; - // Construct a ColumnSet with one view on the left and another on the right. - static void BuildColumnSet(views::GridLayout* layout); - raw_ptr<views::Label> suggestion_label_ = nullptr; raw_ptr<views::Label> password_label_ = nullptr; base::WeakPtr<PasswordGenerationPopupController> controller_ = nullptr; @@ -82,12 +79,14 @@ void PasswordGenerationPopupViewViews::GeneratedPasswordBox::Init( base::WeakPtr<PasswordGenerationPopupController> controller) { controller_ = controller; - views::GridLayout* layout = - SetLayoutManager(std::make_unique<views::GridLayout>()); - BuildColumnSet(layout); - layout->StartRow(views::GridLayout::kFixedSize, 0); + auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::Orientation::kHorizontal, gfx::Insets(), + ChromeLayoutProvider::Get()->GetDistanceMetric( + DISTANCE_BETWEEN_PRIMARY_AND_SECONDARY_LABELS_HORIZONTAL))); + layout->set_cross_axis_alignment( + views::BoxLayout::CrossAxisAlignment::kCenter); - suggestion_label_ = layout->AddView(std::make_unique<views::Label>( + suggestion_label_ = AddChildView(std::make_unique<views::Label>( controller_->SuggestedText(), views::style::CONTEXT_DIALOG_BODY_TEXT, controller_->state() == PasswordGenerationPopupController::kOfferGeneration @@ -95,9 +94,10 @@ : views::style::STYLE_SECONDARY)); DCHECK(!password_label_); - password_label_ = layout->AddView(std::make_unique<views::Label>( + password_label_ = AddChildView(std::make_unique<views::Label>( controller_->password(), views::style::CONTEXT_DIALOG_BODY_TEXT, STYLE_SECONDARY_MONOSPACED)); + layout->SetFlexForView(password_label_, 1); } void PasswordGenerationPopupViewViews::GeneratedPasswordBox::OnMouseEntered( @@ -143,22 +143,6 @@ } } -// static -void PasswordGenerationPopupViewViews::GeneratedPasswordBox::BuildColumnSet( - views::GridLayout* layout) { - views::ColumnSet* column_set = layout->AddColumnSet(0); - column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, - 0 /* resize_percent */, - views::GridLayout::ColumnSize::kUsePreferred, 0, 0); - column_set->AddPaddingColumn( - 0 /* resize_percent */, - ChromeLayoutProvider::Get()->GetDistanceMetric( - DISTANCE_BETWEEN_PRIMARY_AND_SECONDARY_LABELS_HORIZONTAL)); - column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, - 1.0 /* resize_percent */, - views::GridLayout::ColumnSize::kUsePreferred, 0, 0); -} - BEGIN_METADATA(PasswordGenerationPopupViewViews, GeneratedPasswordBox, views::View)
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 b273f36..1af37c6 100644 --- a/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc +++ b/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
@@ -95,10 +95,7 @@ // Setup the https server. https_server_ = std::make_unique<net::EmbeddedTestServer>( net::EmbeddedTestServer::TYPE_HTTPS); - host_resolver()->AddRule("a.com", "127.0.0.1"); - host_resolver()->AddRule("b.com", "127.0.0.1"); - host_resolver()->AddRule("c.com", "127.0.0.1"); - host_resolver()->AddRule("d.com", "127.0.0.1"); + host_resolver()->AddRule("*", "127.0.0.1"); ASSERT_TRUE(https_server_->InitializeAndListen()); https_server_->ServeFilesFromSourceDirectory("components/test/data/payments"); https_server_->StartAcceptingConnections(); @@ -274,12 +271,6 @@ event_waiter_->OnEvent(DialogEvent::PAYMENT_HANDLER_WINDOW_OPENED); } -void PaymentRequestBrowserTestBase::SetHostReplaceRule( - const std::string& host_pattern, - const std::string& replacement) { - host_resolver()->AddRule(host_pattern, replacement); -} - // Install the payment app specified by `hostname`, e.g., "a.com". Specify the // filename of the service worker with `service_worker_filename`. Note that // the origin has to be initialized first to be supported here. The payment
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 8e8c64b..0c7ee8f6 100644 --- a/chrome/browser/ui/views/payments/payment_request_browsertest_base.h +++ b/chrome/browser/ui/views/payments/payment_request_browsertest_base.h
@@ -146,9 +146,6 @@ void OnProcessingSpinnerHidden() override; void OnPaymentHandlerWindowOpened() override; - void SetHostReplaceRule(const std::string& host_pattern, - const std::string& replacement); - void InstallPaymentApp(const std::string& hostname, const std::string& service_worker_filename, std::string* url_method_output);
diff --git a/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc b/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc index 0509932cd..b117f42 100644 --- a/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc
@@ -748,7 +748,6 @@ void SetUpOnMainThread() override { PaymentRequestBrowserTestBase::SetUpOnMainThread(); - SetHostReplaceRule("*", "127.0.0.1"); // Choosing nickpay for its JIT installation support. nickpay_server_.ServeFilesFromSourceDirectory(
diff --git a/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc b/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc index 3e28b1e..1f14b92 100644 --- a/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc +++ b/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc
@@ -50,6 +50,7 @@ #include "components/policy/policy_constants.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_launcher.h" #include "content/public/test/test_navigation_observer.h" #include "content/public/test/url_loader_interceptor.h" #include "mojo/public/cpp/bindings/associated_receiver.h" @@ -624,4 +625,123 @@ INSTANTIATE_TEST_SUITE_P(, WebAppFileHandlingIconBrowserTest, testing::Bool()); +// The following fixtures help test what happens when the feature's state +// changes between browser launches. +class WebAppFileHandlingBrowserTest_FeatureSwitchesState + : public WebAppFileHandlingBrowserTest { + public: + explicit WebAppFileHandlingBrowserTest_FeatureSwitchesState( + bool feature_switches_from_off_to_on = false) { + if (feature_switches_from_off_to_on == content::IsPreTest()) { + scoped_feature_list_.InitAndDisableFeature( + blink::features::kFileHandlingAPI); + } + + WebAppFileHandlerManager::DisableOsIntegrationForTesting( + base::BindRepeating( + &WebAppFileHandlingBrowserTest_FeatureSwitchesState:: + IntegrationWasSet, + base::Unretained(this))); + } + ~WebAppFileHandlingBrowserTest_FeatureSwitchesState() override = default; + + void InstallApp() { + EXPECT_EQ(0u, registrar().GetAppIds().size()); + InstallFileHandlingPWA(); + EXPECT_EQ(1u, registrar().GetAppIds().size()); + + // `InstallFileHandlingPWA()` doesn't perform OS integration, so explicitly + // call it here to simulate a user install. Note: does nothing if the + // feature is disabled. + file_handler_manager().EnableAndRegisterOsFileHandlers(app_id()); + } + + void IntegrationWasSet(bool enabled) { + if (enabled) + added_count_++; + else + removed_count_++; + } + + protected: + // The number of times Chrome has called into the OS to set state. + int added_count_ = 0; + int removed_count_ = 0; + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +// This test fixture will run the PRE_ test with the feature disabled, then the +// main test with the feature enabled. If a FH app was installed when the +// feature was disabled, then the feature becomes enabled, it should be +// registered with the OS. +class WebAppFileHandlingBrowserTest_FeatureSwitchesOn + : public WebAppFileHandlingBrowserTest_FeatureSwitchesState { + public: + WebAppFileHandlingBrowserTest_FeatureSwitchesOn() + : WebAppFileHandlingBrowserTest_FeatureSwitchesState( + /*feature_switches_from_off_to_on=*/true) {} + ~WebAppFileHandlingBrowserTest_FeatureSwitchesOn() override = default; +}; + +IN_PROC_BROWSER_TEST_F(WebAppFileHandlingBrowserTest_FeatureSwitchesOn, + PRE_PRE_OsIntegrationIsAdded) { + InstallApp(); + EXPECT_FALSE(file_handler_manager().IsFileHandlingAPIAvailable(app_id())); + EXPECT_FALSE(registrar().ExpectThatFileHandlersAreRegisteredWithOs(app_id())); + EXPECT_EQ(0, added_count_); + EXPECT_EQ(0, removed_count_); +} + +IN_PROC_BROWSER_TEST_F(WebAppFileHandlingBrowserTest_FeatureSwitchesOn, + PRE_OsIntegrationIsAdded) { + // In this intermediate test, the feature is still off. Verify that Chrome + // doesn't make excess calls to the OS. + EXPECT_EQ(0, added_count_); + EXPECT_EQ(0, removed_count_); +} + +IN_PROC_BROWSER_TEST_F(WebAppFileHandlingBrowserTest_FeatureSwitchesOn, + OsIntegrationIsAdded) { + ASSERT_EQ(1u, registrar().GetAppIds().size()); + AppId app_id = registrar().GetAppIds()[0]; + EXPECT_TRUE(file_handler_manager().IsFileHandlingAPIAvailable(app_id)); + EXPECT_TRUE(registrar().ExpectThatFileHandlersAreRegisteredWithOs(app_id)); + EXPECT_EQ(1, added_count_); + EXPECT_EQ(0, removed_count_); +} + +// This test fixture verifies the opposite of the above. It will run the PRE_ +// test with the feature enabled, then the main test with the feature disabled. +// If a FH app was installed when the feature was enabled, then the feature +// becomes disabled, it should be no longer be registered with the OS. +class WebAppFileHandlingBrowserTest_FeatureSwitchesOff + : public WebAppFileHandlingBrowserTest_FeatureSwitchesState { + public: + WebAppFileHandlingBrowserTest_FeatureSwitchesOff() + : WebAppFileHandlingBrowserTest_FeatureSwitchesState( + /*feature_switches_from_off_to_on=*/false) {} + ~WebAppFileHandlingBrowserTest_FeatureSwitchesOff() override = default; +}; + +IN_PROC_BROWSER_TEST_F(WebAppFileHandlingBrowserTest_FeatureSwitchesOff, + PRE_OsIntegrationIsRemoved) { + InstallApp(); + EXPECT_TRUE(file_handler_manager().IsFileHandlingAPIAvailable(app_id())); + EXPECT_TRUE(registrar().ExpectThatFileHandlersAreRegisteredWithOs(app_id())); + EXPECT_EQ(1, added_count_); + EXPECT_EQ(0, removed_count_); +} + +IN_PROC_BROWSER_TEST_F(WebAppFileHandlingBrowserTest_FeatureSwitchesOff, + OsIntegrationIsRemoved) { + ASSERT_EQ(1u, registrar().GetAppIds().size()); + AppId app_id = registrar().GetAppIds()[0]; + EXPECT_FALSE(file_handler_manager().IsFileHandlingAPIAvailable(app_id)); + EXPECT_FALSE(registrar().ExpectThatFileHandlersAreRegisteredWithOs(app_id)); + EXPECT_EQ(0, added_count_); + EXPECT_EQ(1, removed_count_); +} + } // namespace web_app
diff --git a/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc b/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc index 8bda4d0d..0cd0e38 100644 --- a/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc +++ b/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc
@@ -54,7 +54,8 @@ transport_availability.request_type = device::FidoRequestType::kGetAssertion; model->StartFlow(std::move(transport_availability), - /*use_location_bar_bubble=*/false); + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/false); // The dialog should immediately close as soon as it is displayed. if (name == "mechanisms") {
diff --git a/chrome/browser/ui/webui/history/foreign_session_handler.cc b/chrome/browser/ui/webui/history/foreign_session_handler.cc index 874d3b01..8faf9ee 100644 --- a/chrome/browser/ui/webui/history/foreign_session_handler.cc +++ b/chrome/browser/ui/webui/history/foreign_session_handler.cc
@@ -309,12 +309,11 @@ // Use a pref to keep track of sessions that were collapsed by the user. // To prevent the pref from accumulating stale sessions, clear it each time // and only add back sessions that are still current. - DictionaryPrefUpdateDeprecated pref_update( - Profile::FromWebUI(web_ui())->GetPrefs(), - prefs::kNtpCollapsedForeignSessions); - base::DictionaryValue* current_collapsed_sessions = pref_update.Get(); - std::unique_ptr<base::DictionaryValue> collapsed_sessions( - current_collapsed_sessions->DeepCopy()); + DictionaryPrefUpdate pref_update(Profile::FromWebUI(web_ui())->GetPrefs(), + prefs::kNtpCollapsedForeignSessions); + base::Value* current_collapsed_sessions = pref_update.Get(); + std::unique_ptr<base::Value> collapsed_sessions( + current_collapsed_sessions->CreateDeepCopy()); current_collapsed_sessions->DictClear(); // Note: we don't own the SyncedSessions themselves. @@ -450,10 +449,9 @@ // Store session tags for collapsed sessions in a preference so that the // collapsed state persists. PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); - DictionaryPrefUpdateDeprecated update(prefs, - prefs::kNtpCollapsedForeignSessions); + DictionaryPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions); if (is_collapsed) - update.Get()->SetBoolean(session_tag, true); + update.Get()->SetBoolKey(session_tag, true); else update.Get()->RemoveKey(session_tag); }
diff --git a/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc b/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc index a286991..3373ae7 100644 --- a/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc +++ b/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc
@@ -976,6 +976,37 @@ run_loop.Run(); } +#if defined(CHROMEOS) +TEST_F(ExternallyManagedAppInstallTaskTest, InstallPlaceholderCustomName) { + const GURL kWebAppUrl("https://foo.example"); + const std::string kCustomName("Custom äpp näme"); + ExternalInstallOptions options(kWebAppUrl, DisplayMode::kStandalone, + ExternalInstallSource::kExternalPolicy); + options.install_placeholder = true; + options.override_name = kCustomName; + auto task = GetInstallationTaskWithTestMocks(std::move(options)); + url_loader().SetPrepareForLoadResultLoaded(); + url_loader().SetNextLoadUrlResult( + kWebAppUrl, WebAppUrlLoader::Result::kRedirectedUrlLoaded); + + base::RunLoop run_loop; + task->Install( + web_contents(), + base::BindLambdaForTesting( + [&](ExternallyManagedAppManager::InstallResult result) { + EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code); + + const WebAppInstallInfo& web_app_info = + finalizer()->web_app_info_list().at(0); + + EXPECT_EQ(base::UTF8ToUTF16(kCustomName), web_app_info.title); + + run_loop.Quit(); + })); + run_loop.Run(); +} +#endif // defined(CHROMEOS) + TEST_F(ExternallyManagedAppInstallTaskTest, UninstallAndReplace) { const GURL kWebAppUrl("https://foo.example"); ExternalInstallOptions options = {kWebAppUrl, DisplayMode::kUndefined,
diff --git a/chrome/browser/web_applications/extensions/web_app_policy_manager_unittest.cc b/chrome/browser/web_applications/extensions/web_app_policy_manager_unittest.cc index 979b9b6e..fdff3d8 100644 --- a/chrome/browser/web_applications/extensions/web_app_policy_manager_unittest.cc +++ b/chrome/browser/web_applications/extensions/web_app_policy_manager_unittest.cc
@@ -81,6 +81,7 @@ constexpr char kTabbedUrl[] = "https://tabbed.example/"; constexpr char kNoContainerUrl[] = "https://no-container.example/"; constexpr char kDefaultCustomIconUrl[] = "https://windowed.example/icon.png"; +constexpr char kUnsecureIconUrl[] = "http://windowed.example/icon.png"; constexpr char kDefaultCustomIconHash[] = "abcdef"; base::Value GetWindowedItem() { @@ -253,13 +254,14 @@ return options; } -base::Value GetCustomAppIconItem() { +base::Value GetCustomAppIconItem(bool secure = true) { base::Value item(base::Value::Type::DICTIONARY); item.SetKey(kUrlKey, base::Value(kWindowedUrl)); item.SetKey(kDefaultLaunchContainerKey, base::Value(kDefaultLaunchContainerWindowValue)); base::Value sub_item(base::Value::Type::DICTIONARY); - sub_item.SetKey(kCustomIconURLKey, base::Value(kDefaultCustomIconUrl)); + sub_item.SetKey(kCustomIconURLKey, base::Value(secure ? kDefaultCustomIconUrl + : kUnsecureIconUrl)); sub_item.SetKey(kCustomIconHashKey, base::Value(kDefaultCustomIconHash)); item.SetKey(kCustomIconKey, std::move(sub_item)); return item; @@ -730,6 +732,27 @@ EXPECT_EQ(install_requests, expected_install_options_list); } +// If the custom icon URL is not https, the icon should be ignored. +TEST_P(WebAppPolicyManagerTest, ForceInstallAppWithUnsecureCustomAppIcon) { + if (ShouldSkipPWASpecificTest()) + return; + base::Value list(base::Value::Type::LIST); + list.Append(GetCustomAppIconItem(/*secure=*/false)); + profile()->GetPrefs()->Set(prefs::kWebAppInstallForceList, std::move(list)); + + policy_manager().Start(); + base::RunLoop().RunUntilIdle(); + + const auto& install_requests = + externally_managed_app_manager().install_requests(); + + std::vector<ExternalInstallOptions> expected_install_options_list; + expected_install_options_list.push_back(GetCustomAppIconInstallOptions()); + + EXPECT_EQ(1u, install_requests.size()); + EXPECT_FALSE(install_requests[0].override_icon_url); +} + TEST_P(WebAppPolicyManagerTest, ForceInstallAppWithCustomAppName) { if (ShouldSkipPWASpecificTest()) return;
diff --git a/chrome/browser/web_applications/externally_managed_app_install_task.cc b/chrome/browser/web_applications/externally_managed_app_install_task.cc index 050cf81..af67617 100644 --- a/chrome/browser/web_applications/externally_managed_app_install_task.cc +++ b/chrome/browser/web_applications/externally_managed_app_install_task.cc
@@ -110,7 +110,7 @@ } if (install_options_.install_placeholder) { - InstallPlaceholder(std::move(retry_on_failure)); + InstallPlaceholder(web_contents, std::move(retry_on_failure)); return; } @@ -218,13 +218,15 @@ } void ExternallyManagedAppInstallTask::InstallPlaceholder( + content::WebContents* web_contents, ResultCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); absl::optional<AppId> app_id = externally_installed_app_prefs_.LookupPlaceholderAppId( install_options_.install_url); - if (app_id.has_value() && registrar_->IsInstalled(app_id.value())) { + if (app_id.has_value() && registrar_->IsInstalled(app_id.value()) && + !install_options_.force_reinstall) { // No need to install a placeholder app again. base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, @@ -234,13 +236,62 @@ return; } + if (install_options_.override_icon_url) { + web_contents->DownloadImage( + install_options_.override_icon_url.value(), + /*is_favicon, whether to not sent/accept cookies*/ true, gfx::Size(), + /*max_bitmap_size, 0=unlimited*/ 0, + /*bypass_cache*/ false, + base::BindOnce(&ExternallyManagedAppInstallTask::OnCustomIconFetched, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + return; + } + + FinalizePlaceholderInstall(std::move(callback), absl::nullopt); +} + +void ExternallyManagedAppInstallTask::OnCustomIconFetched( + ResultCallback callback, + int id, + int http_status_code, + const GURL& image_url, + const std::vector<SkBitmap>& bitmaps, + const std::vector<gfx::Size>& sizes) { + if (bitmaps.size() > 0) { + FinalizePlaceholderInstall(std::move(callback), bitmaps); + } else { + FinalizePlaceholderInstall(std::move(callback), absl::nullopt); + } +} + +void ExternallyManagedAppInstallTask::FinalizePlaceholderInstall( + ResultCallback callback, + absl::optional<std::reference_wrapper<const std::vector<SkBitmap>>> + bitmaps) { WebAppInstallInfo web_app_info; + +#if defined(CHROMEOS) web_app_info.title = install_options_.override_name ? base::UTF8ToUTF16(install_options_.override_name.value()) : install_options_.fallback_app_name ? base::UTF8ToUTF16(install_options_.fallback_app_name.value()) : base::UTF8ToUTF16(install_options_.install_url.spec()); + + if (bitmaps) { + IconsMap icons_map; + icons_map.emplace(GURL(install_options_.override_icon_url.value()), + bitmaps.value()); + PopulateProductIcons(&web_app_info, &icons_map); + } + +#else // defined(CHROMEOS) + web_app_info.title = + install_options_.fallback_app_name + ? base::UTF8ToUTF16(install_options_.fallback_app_name.value()) + : base::UTF8ToUTF16(install_options_.install_url.spec()); +#endif // defined(CHROMEOS) + web_app_info.start_url = install_options_.install_url; web_app_info.user_display_mode = install_options_.user_display_mode; @@ -248,7 +299,9 @@ WebAppInstallFinalizer::FinalizeOptions options; options.install_source = ConvertExternalInstallSourceToInstallSource( install_options_.install_source); - options.overwrite_existing_manifest_fields = false; + // Overwrite fields if we are doing a forced reinstall, because some + // values (custom name or icon) might have changed. + options.overwrite_existing_manifest_fields = install_options_.force_reinstall; install_finalizer_->FinalizeInstall( web_app_info, options,
diff --git a/chrome/browser/web_applications/externally_managed_app_install_task.h b/chrome/browser/web_applications/externally_managed_app_install_task.h index 14f8bd4..faa5284 100644 --- a/chrome/browser/web_applications/externally_managed_app_install_task.h +++ b/chrome/browser/web_applications/externally_managed_app_install_task.h
@@ -82,7 +82,21 @@ ResultCallback result_callback, WebAppUrlLoader::Result load_url_result); - void InstallPlaceholder(ResultCallback result_callback); + // result_callback could be called synchronously or asynchronously. + void InstallPlaceholder(content::WebContents* web_contents, + ResultCallback result_callback); + + void OnCustomIconFetched(ResultCallback callback, + int id, + int http_status_code, + const GURL& image_url, + const std::vector<SkBitmap>& bitmaps, + const std::vector<gfx::Size>& sizes); + + void FinalizePlaceholderInstall( + ResultCallback callback, + absl::optional<std::reference_wrapper<const std::vector<SkBitmap>>> + bitmaps); void UninstallPlaceholderApp(content::WebContents* web_contents, ResultCallback result_callback);
diff --git a/chrome/browser/web_applications/externally_managed_app_manager_impl_browsertest.cc b/chrome/browser/web_applications/externally_managed_app_manager_impl_browsertest.cc index 73ad1c82..b6f69cd6 100644 --- a/chrome/browser/web_applications/externally_managed_app_manager_impl_browsertest.cc +++ b/chrome/browser/web_applications/externally_managed_app_manager_impl_browsertest.cc
@@ -16,11 +16,13 @@ #include "chrome/browser/web_applications/externally_installed_web_app_prefs.h" #include "chrome/browser/web_applications/externally_managed_app_registration_task.h" #include "chrome/browser/web_applications/os_integration_manager.h" +#include "chrome/browser/web_applications/test/web_app_icon_test_utils.h" #include "chrome/browser/web_applications/test/web_app_install_test_utils.h" #include "chrome/browser/web_applications/test/web_app_registration_waiter.h" #include "chrome/browser/web_applications/test/web_app_test_utils.h" #include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app_constants.h" +#include "chrome/browser/web_applications/web_app_icon_generator.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/test/base/in_process_browser_test.h" @@ -32,6 +34,7 @@ #include "net/test/embedded_test_server/embedded_test_server.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/storage_key/storage_key.h" +#include "third_party/skia/include/core/SkColor.h" #include "url/origin.h" namespace web_app { @@ -165,7 +168,9 @@ EXPECT_TRUE(registrar().IsPlaceholderApp(app_id.value())); } -// Installing a placeholder app with shortcuts should succeed. +#if defined(OS_CHROMEOS) +// Installing a placeholder app with a custom name should succeed. +// This feature is ChromeOS-only. IN_PROC_BROWSER_TEST_F(ExternallyManagedAppManagerImplBrowserTest, PlaceholderInstallSucceedsWithCustomName) { ASSERT_TRUE(embedded_test_server()->Start()); @@ -192,6 +197,49 @@ EXPECT_EQ(CUSTOM_NAME, registrar().GetAppById(app_id.value())->name()); } +// Installing a placeholder app with a custom icon should succeed. +// This feature is ChromeOS-only. +IN_PROC_BROWSER_TEST_F(ExternallyManagedAppManagerImplBrowserTest, + PlaceholderInstallSucceedsWithCustomIcon) { + ASSERT_TRUE(embedded_test_server()->Start()); + + GURL final_url = embedded_test_server()->GetURL( + "other.origin.com", "/banners/manifest_test_page.html"); + // Add a redirect to a different origin, so a placeholder is installed. + GURL app_url( + embedded_test_server()->GetURL("/server-redirect?" + final_url.spec())); + // 192 is chosen to not be part of web_app_icon_generator.h:SizesToGenerate(). + GURL icon_url = embedded_test_server()->GetURL("/banners/192x192-green.png"); + const SquareSizePx kIconSize = 192; + const SkColor kIconColor = SK_ColorGREEN; + const auto kGeneratedSizes = SizesToGenerate(); + EXPECT_TRUE(kGeneratedSizes.find(kIconSize) == kGeneratedSizes.end()); + + ExternalInstallOptions options = CreateInstallOptions(app_url); + options.install_placeholder = true; + options.add_to_applications_menu = true; + options.add_to_desktop = true; + options.override_icon_url = icon_url; + InstallApp(options); + + EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result_code_.value()); + absl::optional<AppId> app_id = + ExternallyInstalledWebAppPrefs(profile()->GetPrefs()) + .LookupAppId(app_url); + ASSERT_TRUE(app_id.has_value()); + EXPECT_TRUE(registrar().IsPlaceholderApp(app_id.value())); + SortedSizesPx downloaded_sizes = + registrar().GetAppDownloadedIconSizesAny(app_id.value()); + EXPECT_EQ(1u + kGeneratedSizes.size(), downloaded_sizes.size()); + EXPECT_TRUE(downloaded_sizes.find(kIconSize) != downloaded_sizes.end()); + EXPECT_EQ(kIconColor, + IconManagerReadAppIconPixel( + WebAppProvider::GetForTest(profile())->icon_manager(), + app_id.value(), kIconSize, 0, 0)); +} + +#endif // defined(OS_CHROMEOS) + // Tests that the browser doesn't crash if it gets shutdown with a pending // installation. IN_PROC_BROWSER_TEST_F(ExternallyManagedAppManagerImplBrowserTest,
diff --git a/chrome/browser/web_applications/manifest_update_task.cc b/chrome/browser/web_applications/manifest_update_task.cc index 432d403..e8d41830 100644 --- a/chrome/browser/web_applications/manifest_update_task.cc +++ b/chrome/browser/web_applications/manifest_update_task.cc
@@ -382,10 +382,8 @@ if (web_application_info_->handle_links != app->handle_links()) return true; - if (os_integration_manager_.IsFileHandlingAPIAvailable(app_id_) && - app->file_handlers() != web_application_info_->file_handlers) { + if (app->file_handlers() != web_application_info_->file_handlers) return true; - } if (web_application_info_->background_color != app->background_color()) return true;
diff --git a/chrome/browser/web_applications/os_integration_manager.cc b/chrome/browser/web_applications/os_integration_manager.cc index 23d0190..94de0972 100644 --- a/chrome/browser/web_applications/os_integration_manager.cc +++ b/chrome/browser/web_applications/os_integration_manager.cc
@@ -626,8 +626,13 @@ const AppId& app_id, FileHandlerUpdateAction file_handlers_need_os_update, ResultCallback finished_callback) { - if (!IsFileHandlingAPIAvailable(app_id) || - file_handlers_need_os_update == FileHandlerUpdateAction::kNoUpdate) { + if (file_handlers_need_os_update == FileHandlerUpdateAction::kNoUpdate) { + std::move(finished_callback).Run(Result::kOk); + return; + } + + if (file_handlers_need_os_update == FileHandlerUpdateAction::kUpdate && + !IsFileHandlingAPIAvailable(app_id)) { std::move(finished_callback).Run(Result::kOk); return; }
diff --git a/chrome/browser/web_applications/os_integration_manager_unittest.cc b/chrome/browser/web_applications/os_integration_manager_unittest.cc index f750bc64..482c900 100644 --- a/chrome/browser/web_applications/os_integration_manager_unittest.cc +++ b/chrome/browser/web_applications/os_integration_manager_unittest.cc
@@ -189,27 +189,6 @@ EXPECT_FALSE(uninstall_errors[OsHookType::kUninstallationViaOsSettings]); } -TEST_F(OsIntegrationManagerTest, UpdateOsHooksEverything) { - const AppId app_id = "test"; - testing::StrictMock<MockOsIntegrationManager> manager; - - WebAppInstallInfo web_app_info; - base::StringPiece old_name = "test-name"; - - EXPECT_CALL( - manager, - UpdateFileHandlers(app_id, FileHandlerUpdateAction::kUpdate, testing::_)) - .Times(1); - EXPECT_CALL(manager, UpdateShortcuts(app_id, old_name, testing::_)).Times(1); - EXPECT_CALL(manager, UpdateShortcutsMenu(app_id, testing::_)).Times(1); - EXPECT_CALL(manager, UpdateUrlHandlers(app_id, testing::_)).Times(1); - EXPECT_CALL(manager, UpdateProtocolHandlers(app_id, false, testing::_)) - .Times(1); - - manager.UpdateOsHooks(app_id, old_name, FileHandlerUpdateAction::kUpdate, - web_app_info, base::DoNothing()); -} - TEST_F(OsIntegrationManagerTest, UpdateProtocolHandlers) { #if BUILDFLAG(IS_WIN) // UpdateProtocolHandlers is a no-op on Win7
diff --git a/chrome/browser/web_applications/policy/web_app_policy_manager.cc b/chrome/browser/web_applications/policy/web_app_policy_manager.cc index b1ce2491..2f26b23 100644 --- a/chrome/browser/web_applications/policy/web_app_policy_manager.cc +++ b/chrome/browser/web_applications/policy/web_app_policy_manager.cc
@@ -37,6 +37,7 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "third_party/blink/public/common/manifest/manifest.h" +#include "url/url_constants.h" #if BUILDFLAG(IS_CHROMEOS) #include "chrome/browser/browser_process.h" @@ -344,10 +345,10 @@ ExternalInstallOptions WebAppPolicyManager::ParseInstallPolicyEntry( const base::Value& entry) { - const base::Value* url = entry.FindKey(kUrlKey); + const base::Value* install_url = entry.FindKey(kUrlKey); // url is a required field and is validated by // SimpleSchemaValidatingPolicyHandler. It is guaranteed to exist. - const GURL gurl(url->GetString()); + const GURL install_gurl(install_url->GetString()); const base::Value* default_launch_container = entry.FindKey(kDefaultLaunchContainerKey); const base::Value* create_desktop_shortcut = @@ -362,8 +363,8 @@ default_launch_container->GetString() == kDefaultLaunchContainerTabValue); - if (!gurl.is_valid()) { - LOG(WARNING) << "Policy-installed web app has invalid URL " << url; + if (!install_gurl.is_valid()) { + LOG(WARNING) << "Policy-installed web app has invalid URL " << install_url; } DisplayMode user_display_mode; @@ -377,7 +378,7 @@ } ExternalInstallOptions install_options{ - gurl, user_display_mode, ExternalInstallSource::kExternalPolicy}; + install_gurl, user_display_mode, ExternalInstallSource::kExternalPolicy}; install_options.add_to_applications_menu = true; install_options.add_to_desktop = @@ -393,16 +394,24 @@ if (custom_name) { install_options.override_name = custom_name->GetString(); - if (gurl.is_valid()) - custom_manifest_values_by_url_[gurl].SetName(custom_name->GetString()); + if (install_gurl.is_valid()) + custom_manifest_values_by_url_[install_gurl].SetName( + custom_name->GetString()); } if (custom_icon && custom_icon->is_dict()) { const std::string* icon_url = custom_icon->FindStringKey(kCustomIconURLKey); if (icon_url) { - install_options.override_icon_url = GURL(*icon_url); - if (gurl.is_valid()) - custom_manifest_values_by_url_[gurl].SetIcon(*icon_url); + GURL icon_gurl = GURL(*icon_url); + if (icon_gurl.SchemeIs(url::kHttpsScheme)) { + install_options.override_icon_url = icon_gurl; + if (install_gurl.is_valid()) + custom_manifest_values_by_url_[install_gurl].SetIcon(icon_gurl); + } else { + LOG(WARNING) << "Policy-installed web app " << install_url + << " has non-https custom icon URL " << icon_url + << ", ignoring custom icon."; + } } } @@ -556,11 +565,10 @@ name = base::UTF8ToUTF16(utf8_name); } -void WebAppPolicyManager::CustomManifestValues::SetIcon( - const std::string& icon_url) { +void WebAppPolicyManager::CustomManifestValues::SetIcon(const GURL& icon_gurl) { blink::Manifest::ImageResource icon; - icon.src = GURL(icon_url); + icon.src = GURL(icon_gurl); icon.sizes.emplace_back(0, 0); // Represents size "any". icon.purpose.push_back(blink::mojom::ManifestImageResource::Purpose::ANY);
diff --git a/chrome/browser/web_applications/policy/web_app_policy_manager.h b/chrome/browser/web_applications/policy/web_app_policy_manager.h index f7c93ac8..cc95315 100644 --- a/chrome/browser/web_applications/policy/web_app_policy_manager.h +++ b/chrome/browser/web_applications/policy/web_app_policy_manager.h
@@ -121,7 +121,7 @@ ~CustomManifestValues(); void SetName(const std::string& utf8_name); - void SetIcon(const std::string& icon_url); + void SetIcon(const GURL& icon_gurl); absl::optional<std::u16string> name; absl::optional<std::vector<blink::Manifest::ImageResource>> icons;
diff --git a/chrome/browser/web_applications/test/fake_web_app_file_handler_manager.cc b/chrome/browser/web_applications/test/fake_web_app_file_handler_manager.cc index c19be307..8e9b5b15 100644 --- a/chrome/browser/web_applications/test/fake_web_app_file_handler_manager.cc +++ b/chrome/browser/web_applications/test/fake_web_app_file_handler_manager.cc
@@ -9,7 +9,7 @@ FakeWebAppFileHandlerManager::FakeWebAppFileHandlerManager(Profile* profile) : WebAppFileHandlerManager(profile) { - WebAppFileHandlerManager::DisableOsIntegrationForTesting(); + WebAppFileHandlerManager::DisableOsIntegrationForTesting(base::DoNothing()); } FakeWebAppFileHandlerManager::~FakeWebAppFileHandlerManager() = default;
diff --git a/chrome/browser/web_applications/test/mock_os_integration_manager.h b/chrome/browser/web_applications/test/mock_os_integration_manager.h index d24fd50..37231d0 100644 --- a/chrome/browser/web_applications/test/mock_os_integration_manager.h +++ b/chrome/browser/web_applications/test/mock_os_integration_manager.h
@@ -110,32 +110,11 @@ // Update: MOCK_METHOD(void, - UpdateFileHandlers, - (const AppId& app_id, - FileHandlerUpdateAction file_handlers_need_os_update, - ResultCallback finished_callback), - (override)); - MOCK_METHOD(void, UpdateShortcuts, (const AppId& app_id, base::StringPiece old_name, base::OnceClosure callback), (override)); - MOCK_METHOD(void, - UpdateShortcutsMenu, - (const AppId& app_id, const WebAppInstallInfo& web_app_info), - (override)); - MOCK_METHOD(void, - UpdateUrlHandlers, - (const AppId& app_id, - base::OnceCallback<void(bool success)> callback), - (override)); - MOCK_METHOD(void, - UpdateProtocolHandlers, - (const AppId& app_id, - bool force_shortcut_updates_if_needed, - base::OnceClosure update_finished_callback), - (override)); // Utility methods: MOCK_METHOD(std::unique_ptr<ShortcutInfo>,
diff --git a/chrome/browser/web_applications/web_app_file_handler_manager.cc b/chrome/browser/web_applications/web_app_file_handler_manager.cc index db0d180..dadeb3e4 100644 --- a/chrome/browser/web_applications/web_app_file_handler_manager.cc +++ b/chrome/browser/web_applications/web_app_file_handler_manager.cc
@@ -10,14 +10,17 @@ #include "base/compiler_specific.h" #include "base/containers/contains.h" #include "base/feature_list.h" +#include "base/no_destructor.h" #include "base/time/time.h" #include "build/build_config.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app_file_handler_registration.h" +#include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_app_registry_update.h" #include "chrome/browser/web_applications/web_app_sync_bridge.h" +#include "chrome/browser/web_applications/web_app_utils.h" #include "chrome/common/chrome_features.h" #include "components/services/app_service/public/cpp/file_handler.h" #include "content/public/browser/browser_task_traits.h" @@ -32,7 +35,10 @@ // icons. absl::optional<bool> g_icons_supported_by_os_override; -bool g_disable_automatic_file_handler_cleanup_for_testing = false; +base::RepeatingCallback<void(bool)>& GetOsIntegrationCallback() { + static base::NoDestructor<base::RepeatingCallback<void(bool)>> instance; + return *instance; +} } // namespace @@ -48,22 +54,19 @@ void WebAppFileHandlerManager::Start() { DCHECK(sync_bridge_); - if (!g_disable_automatic_file_handler_cleanup_for_testing) { - content::GetUIThreadTaskRunner({base::TaskPriority::BEST_EFFORT}) - ->PostTask(FROM_HERE, - base::BindOnce( - base::IgnoreResult( - &WebAppFileHandlerManager::CleanupAfterOriginTrials), - weak_ptr_factory_.GetWeakPtr())); - } + // Don't compete for resources during browser startup. + content::GetUIThreadTaskRunner({base::TaskPriority::BEST_EFFORT}) + ->PostTask( + FROM_HERE, + base::BindOnce(base::IgnoreResult( + &WebAppFileHandlerManager::SyncOsIntegrationState), + weak_ptr_factory_.GetWeakPtr())); } -void WebAppFileHandlerManager::DisableOsIntegrationForTesting() { - disable_os_integration_for_testing_ = true; -} - -int WebAppFileHandlerManager::TriggerFileHandlerCleanupForTesting() { - return CleanupAfterOriginTrials(); +// static +void WebAppFileHandlerManager::DisableOsIntegrationForTesting( + const base::RepeatingCallback<void(bool)>& set_os_integration) { + GetOsIntegrationCallback() = set_os_integration; } // static @@ -78,17 +81,20 @@ SetOsIntegrationState(app_id, OsIntegrationState::kEnabled); - if (!ShouldRegisterFileHandlersWithOs() || - disable_os_integration_for_testing_) { + if (GetOsIntegrationCallback()) { + GetOsIntegrationCallback().Run(true); return; } + if (!ShouldRegisterFileHandlersWithOs()) + return; + +#if !BUILDFLAG(IS_MAC) // File handler registration is done via shortcuts creation on MacOS, // WebAppShortcutManager::BuildShortcutInfoForWebApp collects file handler // information to shortcut_info->file_handler_extensions, then used by MacOS // implementation of |internals::CreatePlatformShortcuts|. So we avoid // creating shortcuts twice here. -#if !BUILDFLAG(IS_MAC) const apps::FileHandlers* file_handlers = GetEnabledFileHandlers(app_id); if (file_handlers) { RegisterFileHandlersWithOs(app_id, GetRegistrar()->GetAppShortName(app_id), @@ -110,8 +116,13 @@ SetOsIntegrationState(app_id, OsIntegrationState::kDisabled); - if (!ShouldRegisterFileHandlersWithOs() || - disable_os_integration_for_testing_) { + if (GetOsIntegrationCallback()) { + GetOsIntegrationCallback().Run(false); + std::move(callback).Run(Result::kOk); + return; + } + + if (!ShouldRegisterFileHandlersWithOs()) { // This enumeration signals if there was not an error. Exiting early here is // WAI, so this is a success. std::move(callback).Run(Result::kOk); @@ -165,25 +176,8 @@ base::FeatureList::IsEnabled(blink::features::kFileHandlingIcons); } -void WebAppFileHandlerManager::DisableAutomaticFileHandlerCleanupForTesting() { - g_disable_automatic_file_handler_cleanup_for_testing = true; -} - -int WebAppFileHandlerManager::CleanupAfterOriginTrials() { - int cleaned_up_count = 0; - for (const AppId& app_id : GetRegistrar()->GetAppIds()) { - if (!ShouldOsIntegrationBeEnabled(app_id)) - continue; - - if (IsFileHandlingAPIAvailable(app_id)) - continue; - - // If the trial has expired, unregister handlers. - DisableAndUnregisterOsFileHandlers(app_id, base::DoNothing()); - cleaned_up_count++; - } - - return cleaned_up_count; +void WebAppFileHandlerManager::SyncOsIntegrationStateForTesting() { + SyncOsIntegrationState(); } const apps::FileHandlers* WebAppFileHandlerManager::GetAllFileHandlers( @@ -242,16 +236,22 @@ bool WebAppFileHandlerManager::ShouldOsIntegrationBeEnabled( const AppId& app_id) const { - if (!GetRegistrar()) - return false; - - const WebApp* web_app = GetRegistrar()->GetAppById(app_id); - return web_app && web_app->file_handler_os_integration_state() == - OsIntegrationState::kEnabled; + return GetRegistrar() && + GetRegistrar()->ExpectThatFileHandlersAreRegisteredWithOs(app_id); } const WebAppRegistrar* WebAppFileHandlerManager::GetRegistrar() const { return sync_bridge_ ? &sync_bridge_->registrar() : nullptr; } +void WebAppFileHandlerManager::SyncOsIntegrationState() { + if (GetRegistrar()) { + for (AppId& id : GetRegistrar()->GetAppIds()) { + UpdateFileHandlerOsIntegration( + WebAppProvider::GetForLocalAppsUnchecked(profile_), id, + base::DoNothing()); + } + } +} + } // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_file_handler_manager.h b/chrome/browser/web_applications/web_app_file_handler_manager.h index a2b79eb..1c5f9a9 100644 --- a/chrome/browser/web_applications/web_app_file_handler_manager.h +++ b/chrome/browser/web_applications/web_app_file_handler_manager.h
@@ -34,19 +34,12 @@ void Start(); // Disables OS integrations, such as shortcut creation on Linux or modifying - // the registry on Windows, to prevent side effects while testing. Note: When - // disabled, file handling integration will not work on most operating - // systems. - void DisableOsIntegrationForTesting(); - - // This is needed because cleanup can run before the tests have finished - // setting up. - static void DisableAutomaticFileHandlerCleanupForTesting(); - - // Manually trigger file handler cleanup for tests. Returns the number of file - // handlers which were cleaned up. After the origin trial for file handling is - // completed this can be removed. - int TriggerFileHandlerCleanupForTesting(); + // the registry on Windows, to prevent side effects while testing. + // `set_os_integration` will be invoked every time OS integration would have + // been toggled with a boolean that is true for enabled. Note: When disabled, + // file handling integration will not work on most operating systems. + static void DisableOsIntegrationForTesting( + const base::RepeatingCallback<void(bool)>& set_os_integration); // Called by tests to enable file handling icon infrastructure on a platform // independently of whether it's needed or used in production. Note that the @@ -75,14 +68,14 @@ // the app they belong to. const apps::FileHandlers* GetEnabledFileHandlers(const AppId& app_id) const; - // Determines whether file handling is allowed for |app_id|. This is true if - // the app has a valid origin trial token for the file handling API or if the - // FileHandlingAPI flag is enabled. + // Determines whether file handling is allowed for |app_id|. bool IsFileHandlingAPIAvailable(const AppId& app_id) const; // Returns true when the system supports file type association icons. static bool IconsEnabled(); + void SyncOsIntegrationStateForTesting(); + protected: // Gets all file handlers for |app_id|. |nullptr| if the app has no file // handlers or if app_id was uninstalled. @@ -92,11 +85,6 @@ const AppId& app_id) const; private: - // Removes file handlers whose origin trials have expired (assuming - // kFileHandlingAPI isn't enabled). Returns the number of apps that had file - // handlers unregistered, for use in tests. - int CleanupAfterOriginTrials(); - // Sets whether `app_id` should have its File Handling abilities surfaces in // the OS. In theory, this should match the actual OS integration state (e.g. // the contents of the .desktop file on Linux), however, that's only enforced @@ -108,13 +96,17 @@ // registry. bool ShouldOsIntegrationBeEnabled(const AppId& app_id) const; + // Refreshes the OS integration state for all apps. This is useful to handle + // the case where the File Handling feature became enabled or disabled since + // the last time Chromium ran. + void SyncOsIntegrationState(); + const WebAppRegistrar* GetRegistrar() const; static bool disable_automatic_file_handler_cleanup_for_testing_; - bool disable_os_integration_for_testing_ = false; [[maybe_unused]] const raw_ptr<Profile> profile_; - raw_ptr<WebAppSyncBridge> sync_bridge_ = nullptr; + raw_ptr<WebAppSyncBridge> sync_bridge_; base::WeakPtrFactory<WebAppFileHandlerManager> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/web_applications/web_app_file_handler_registration_linux.cc b/chrome/browser/web_applications/web_app_file_handler_registration_linux.cc index e5bff27d..a6def63 100644 --- a/chrome/browser/web_applications/web_app_file_handler_registration_linux.cc +++ b/chrome/browser/web_applications/web_app_file_handler_registration_linux.cc
@@ -206,11 +206,11 @@ // is needed. Uninstalling already cleans up shortcuts (and thus, file // handlers). auto* provider = WebAppProvider::GetForWebApps(profile); - DCHECK(provider->registrar().IsInstalled(app_id)); if (provider->registrar().IsUninstalling(app_id)) { std::move(callback).Run(Result::kOk); return; } + DCHECK(provider->registrar().IsInstalled(app_id)); // Otherwise, simply recreate the .desktop file. UpdateFileHandlerRegistrationInOs(app_id, profile, std::move(callback));
diff --git a/chrome/browser/web_applications/web_app_registrar.cc b/chrome/browser/web_applications/web_app_registrar.cc index 7b05072..340be63 100644 --- a/chrome/browser/web_applications/web_app_registrar.cc +++ b/chrome/browser/web_applications/web_app_registrar.cc
@@ -642,6 +642,13 @@ return web_app->file_handler_approval_state(); } +bool WebAppRegistrar::ExpectThatFileHandlersAreRegisteredWithOs( + const AppId& app_id) const { + const WebApp* web_app = GetAppById(app_id); + return web_app && web_app->file_handler_os_integration_state() == + OsIntegrationState::kEnabled; +} + absl::optional<GURL> WebAppRegistrar::GetAppScopeInternal( const AppId& app_id) const { auto* web_app = GetAppById(app_id);
diff --git a/chrome/browser/web_applications/web_app_registrar.h b/chrome/browser/web_applications/web_app_registrar.h index 80097c5..098710f7 100644 --- a/chrome/browser/web_applications/web_app_registrar.h +++ b/chrome/browser/web_applications/web_app_registrar.h
@@ -147,6 +147,9 @@ bool IsAppFileHandlerPermissionBlocked(const web_app::AppId& app_id) const; // Returns the state of the File Handling API for the given app. ApiApprovalState GetAppFileHandlerApprovalState(const AppId& app_id) const; + // Returns true iff it's expected that File Handlers have been, **or are in + // the process of being**, registered with the OS. + bool ExpectThatFileHandlersAreRegisteredWithOs(const AppId& app_id) const; // Returns the start_url with launch_query_params appended to the end if any. GURL GetAppLaunchUrl(const AppId& app_id) const;
diff --git a/chrome/browser/web_applications/web_app_utils.cc b/chrome/browser/web_applications/web_app_utils.cc index 44ec01c95..82584856 100644 --- a/chrome/browser/web_applications/web_app_utils.cc +++ b/chrome/browser/web_applications/web_app_utils.cc
@@ -301,32 +301,51 @@ app_id, allowed ? ApiApprovalState::kAllowed : ApiApprovalState::kDisallowed); - if (allowed) { + UpdateFileHandlerOsIntegration(provider, app_id, + std::move(update_finished_callback)); +} + +void UpdateFileHandlerOsIntegration( + WebAppProvider* provider, + const AppId& app_id, + base::OnceClosure update_finished_callback) { + bool enabled = + provider->os_integration_manager().IsFileHandlingAPIAvailable(app_id) && + !provider->registrar().IsAppFileHandlerPermissionBlocked(app_id); + + if (enabled == + provider->registrar().ExpectThatFileHandlersAreRegisteredWithOs(app_id)) { std::move(update_finished_callback).Run(); - } else { -#if BUILDFLAG(IS_MAC) - // On Mac, the file handlers are encoded in the app shortcut. First - // unregister the file handlers (verifying that it finishes synchronously), - // then update the shortcut. - Result unregister_file_handlers_result = Result::kError; - provider->os_integration_manager().UpdateFileHandlers( - app_id, FileHandlerUpdateAction::kRemove, - base::BindOnce( - [](Result* result_out, Result actual_result) { - *result_out = actual_result; - }, - &unregister_file_handlers_result)); - DCHECK_EQ(Result::kOk, unregister_file_handlers_result); - provider->os_integration_manager().UpdateShortcuts( - app_id, /*old_name=*/{}, std::move(update_finished_callback)); -#else - provider->os_integration_manager().UpdateFileHandlers( - app_id, FileHandlerUpdateAction::kRemove, - base::BindOnce([](base::OnceClosure closure, - Result ignored) { std::move(closure).Run(); }, - std::move(update_finished_callback))); -#endif + return; } + + FileHandlerUpdateAction action = enabled ? FileHandlerUpdateAction::kUpdate + : FileHandlerUpdateAction::kRemove; + +#if BUILDFLAG(IS_MAC) + // On Mac, the file handlers are encoded in the app shortcut. First + // unregister the file handlers (verifying that it finishes synchronously), + // then update the shortcut. + Result unregister_file_handlers_result = Result::kError; + provider->os_integration_manager().UpdateFileHandlers( + app_id, action, + base::BindOnce([](Result* result_out, + Result actual_result) { *result_out = actual_result; }, + &unregister_file_handlers_result)); + DCHECK_EQ(Result::kOk, unregister_file_handlers_result); + provider->os_integration_manager().UpdateShortcuts( + app_id, /*old_name=*/{}, std::move(update_finished_callback)); +#else + provider->os_integration_manager().UpdateFileHandlers( + app_id, action, + base::BindOnce([](base::OnceClosure closure, + Result ignored) { std::move(closure).Run(); }, + std::move(update_finished_callback))); +#endif + + DCHECK_EQ( + enabled, + provider->registrar().ExpectThatFileHandlersAreRegisteredWithOs(app_id)); } bool HasAnySpecifiedSourcesAndNoOtherSources(WebAppSources sources, @@ -345,4 +364,8 @@ return HasAnySpecifiedSourcesAndNoOtherSources(sources, specified_sources); } +void RegisterFileHandlersWithOs(WebAppProvider* provider, + const AppId& app_id, + absl::optional<ApiApprovalState> approval_state, + base::OnceClosure finished_closure) {} } // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_utils.h b/chrome/browser/web_applications/web_app_utils.h index d0d06a0..8e6cf5a5 100644 --- a/chrome/browser/web_applications/web_app_utils.h +++ b/chrome/browser/web_applications/web_app_utils.h
@@ -27,6 +27,8 @@ namespace web_app { +class WebAppProvider; + // These functions return true if the WebApp System or its subset is allowed // for a given profile. // |profile| can be original profile or its secondary off-the-record profile. @@ -115,6 +117,19 @@ bool allowed, base::OnceClosure update_finished_callback); +// Updates the file handler registration with the OS to match the app's +// settings. Note that this tries to avoid extra work by no-oping if the current +// OS state matches what is calculated to be the desired stated. For example, if +// Chromium has already registered file handlers with the OS, and finds that +// file handlers *should* be registered with the OS, this function will no-op. +// This will not account for what the current file handlers actually are. The +// actual set of file handlers can only change on app update, and that path must +// go through `OsIntegrationManager::UpdateOsHooks()`, which always clobbers and +// renews the entire set of OS-registered file handlers (and other OS hooks). +void UpdateFileHandlerOsIntegration(WebAppProvider* provider, + const AppId& app_id, + base::OnceClosure update_finished_callback); + // Check if only |specified_sources| exist in the |sources| bool HasAnySpecifiedSourcesAndNoOtherSources(WebAppSources sources, WebAppSources specified_sources);
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model.cc b/chrome/browser/webauthn/authenticator_request_dialog_model.cc index a48fc77..9730babc 100644 --- a/chrome/browser/webauthn/authenticator_request_dialog_model.cc +++ b/chrome/browser/webauthn/authenticator_request_dialog_model.cc
@@ -153,7 +153,8 @@ void AuthenticatorRequestDialogModel::StartFlow( TransportAvailabilityInfo transport_availability, - bool use_location_bar_bubble) { + bool use_location_bar_bubble, + bool prefer_native_api) { DCHECK(!started_); DCHECK_EQ(current_step(), Step::kNotStarted); @@ -161,7 +162,7 @@ transport_availability_ = std::move(transport_availability); use_location_bar_bubble_ = use_location_bar_bubble; - PopulateMechanisms(); + PopulateMechanisms(prefer_native_api); if (use_location_bar_bubble_) { // This is a conditional request so show a lightweight, non-modal dialog @@ -412,6 +413,29 @@ } bool AuthenticatorRequestDialogModel::OnWinUserCancelled() { +#if BUILDFLAG(IS_WIN) + // If the native Windows API was triggered immediately (i.e. before any Chrome + // dialog) then start the request over (once) if the user cancels the Windows + // UI and there are other options in Chrome's UI. + if (!have_restarted_due_to_windows_cancel_) { + bool have_other_option = std::any_of( + mechanisms_.begin(), mechanisms_.end(), [](const Mechanism& m) -> bool { + return absl::holds_alternative<Mechanism::Phone>(m.type) || + absl::holds_alternative<Mechanism::AddPhone>(m.type); + }); + bool windows_was_priority = std::any_of( + mechanisms_.begin(), mechanisms_.end(), [](const Mechanism& m) -> bool { + return m.priority && + absl::holds_alternative<Mechanism::WindowsAPI>(m.type); + }); + if (have_other_option && windows_was_priority) { + have_restarted_due_to_windows_cancel_ = true; + StartOver(); + return true; + } + } +#endif + return false; } @@ -829,7 +853,8 @@ DCHECK(found_name); } -void AuthenticatorRequestDialogModel::PopulateMechanisms() { +void AuthenticatorRequestDialogModel::PopulateMechanisms( + bool prefer_native_api) { const bool is_get_assertion = transport_availability_.request_type == device::FidoRequestType::kGetAssertion; // priority_transport contains the transport that should be activated @@ -888,6 +913,23 @@ } } + // The Windows API option comes first so that it gets focus and people can + // select it by simply hitting enter. + if (win_native_api_enabled()) { + const std::u16string desc = l10n_util::GetStringUTF16( + IDS_WEBAUTHN_TRANSPORT_POPUP_DIFFERENT_AUTHENTICATOR_WIN); + mechanisms_.emplace_back( + Mechanism::WindowsAPI(/*unused*/ true), desc, desc, + GetTransportIcon(AuthenticatorTransport::kUsbHumanInterfaceDevice), + base::BindRepeating(&AuthenticatorRequestDialogModel::StartWinNativeApi, + base::Unretained(this), mechanisms_.size()), + // The Windows API should have priority when requested unless caBLE does + // because it's v1 or server-link. + !priority_transport.has_value() && + (prefer_native_api || + (!include_add_phone_option && paired_phone_names().empty()))); + } + if (include_add_phone_option) { const std::u16string label = l10n_util::GetStringUTF16(IDS_WEBAUTHN_CABLEV2_ADD_PHONE); @@ -916,19 +958,6 @@ priority_transport.has_value() && *priority_transport == transport); } - if (win_native_api_enabled()) { - const std::u16string desc = l10n_util::GetStringUTF16( - IDS_WEBAUTHN_TRANSPORT_POPUP_DIFFERENT_AUTHENTICATOR_WIN); - mechanisms_.emplace_back( - Mechanism::WindowsAPI(/*unused*/ true), desc, desc, - GetTransportIcon(AuthenticatorTransport::kUsbHumanInterfaceDevice), - base::BindRepeating(&AuthenticatorRequestDialogModel::StartWinNativeApi, - base::Unretained(this), mechanisms_.size()), - // The Windows API should have priority unless caBLE does or if there - // are linked phones. - !priority_transport.has_value() && paired_phones_.empty()); - } - if (base::Contains(transport_availability_.available_transports, kCable)) { for (const auto& phone_name : paired_phone_names()) { const std::u16string name16 = base::UTF8ToUTF16(phone_name);
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model.h b/chrome/browser/webauthn/authenticator_request_dialog_model.h index a044a79..50e66d5 100644 --- a/chrome/browser/webauthn/authenticator_request_dialog_model.h +++ b/chrome/browser/webauthn/authenticator_request_dialog_model.h
@@ -269,10 +269,15 @@ // If |use_location_bar_bubble| is true, a non-modal bubble will be displayed // on the location bar instead of the full-blown page-modal UI. // + // |prefer_native_api| indicates that the UI should jump directly to the + // system WebAuthn UI if there's no better option. This is currently only + // meaningful on Windows, but the parameter exists on all platforms to avoid + // too much #ifdef soup. + // // Valid action when at step: kNotStarted. - void StartFlow( - TransportAvailabilityInfo transport_availability, - bool use_location_bar_bubble); + void StartFlow(TransportAvailabilityInfo transport_availability, + bool use_location_bar_bubble, + bool prefer_native_api); // Restarts the UX flow. void StartOver(); @@ -594,7 +599,14 @@ void DispatchRequestAsyncInternal(const std::string& authenticator_id); void ContactNextPhoneByName(const std::string& name); - void PopulateMechanisms(); + + // PopulateMechanisms fills in |mechanisms_|. + // + // |prefer_native_api| indicates that the UI should jump directly to the + // system WebAuthn UI if there's no better option. This is currently only + // meaningful on Windows, but the parameter exists on all platforms to avoid + // too much #ifdef soup. + void PopulateMechanisms(bool prefer_native_api); // Proceeds straight to the platform authenticator prompt. // @@ -663,6 +675,11 @@ // extension. bool cable_extension_provided_ = false; + // have_restarted_due_to_windows_cancel_ is set to true if the request was + // restarted because the UI jumped directly to the Windows UI but the user + // hit cancel. + bool have_restarted_due_to_windows_cancel_ = false; + // mechanisms contains the entries that appear in the "transport" selection // sheet and the drop-down menu. std::vector<Mechanism> mechanisms_;
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc b/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc index 44aa065..48feaa8 100644 --- a/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc +++ b/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc
@@ -13,12 +13,14 @@ #include "base/containers/flat_set.h" #include "base/strings/string_util.h" #include "base/test/bind.h" +#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "build/build_config.h" #include "chrome/browser/webauthn/authenticator_reference.h" #include "chrome/browser/webauthn/authenticator_transport.h" #include "device/fido/authenticator_data.h" #include "device/fido/authenticator_get_assertion_response.h" +#include "device/fido/features.h" #include "device/fido/fido_constants.h" #include "device/fido/fido_transport_protocol.h" #include "device/fido/public_key_credential_user_entity.h" @@ -101,6 +103,7 @@ kHasWinNativeAuthenticator, kHasCableV1Extension, kHasCableV2Extension, + kPreferNativeAPI, }; base::StringPiece TransportAvailabilityParamToString( @@ -114,6 +117,8 @@ return "kHasCableV1Extension"; case TransportAvailabilityParam::kHasCableV2Extension: return "kHasCableV2Extension"; + case TransportAvailabilityParam::kPreferNativeAPI: + return "kPreferNativeAPI"; } } @@ -154,6 +159,7 @@ const auto has_winapi = TransportAvailabilityParam::kHasWinNativeAuthenticator; const auto has_plat = TransportAvailabilityParam::kHasPlatformCredential; + const auto native = TransportAvailabilityParam::kPreferNativeAPI; using t = AuthenticatorRequestDialogModel::Mechanism::Transport; using p = AuthenticatorRequestDialogModel::Mechanism::Phone; const auto winapi = @@ -186,8 +192,8 @@ {mc, {}, {has_winapi}, {}, {winapi}, plat_ui}, {ga, {}, {has_winapi}, {}, {winapi}, plat_ui}, // ... even if, somehow, there's another transport. - {mc, {usb}, {has_winapi}, {}, {t(usb), winapi}, plat_ui}, - {ga, {usb}, {has_winapi}, {}, {t(usb), winapi}, plat_ui}, + {mc, {usb}, {has_winapi}, {}, {winapi, t(usb)}, plat_ui}, + {ga, {usb}, {has_winapi}, {}, {winapi, t(usb)}, plat_ui}, // A caBLEv1 extension should cause us to go directly to caBLE. {ga, {usb, cable}, {v1}, {}, {t(usb), t(cable)}, cable_ui}, @@ -203,6 +209,16 @@ // On Windows, if there are linked phones we'll show a selection sheet. {mc, {cable}, {has_winapi}, {"a"}, {winapi, p("a")}, mss}, {ga, {cable}, {has_winapi}, {"a"}, {winapi, p("a")}, mss}, + // ... unless the `prefer_native_api` flag is set because Chrome + // remembered that the last successful security key operation was via the + // Windows API. In that case we'll still jump directly to the native UI. + {mc, {cable}, {has_winapi, native}, {"a"}, {winapi, p("a")}, plat_ui}, + {ga, {cable}, {has_winapi, native}, {"a"}, {winapi, p("a")}, plat_ui}, + // Even without `prefer_native_api`, if there aren't any linked phones + // we'll still jump directly to the native UI, at least until we enable + // the "Add phone" option. + {mc, {cable}, {has_winapi}, {}, {winapi}, plat_ui}, + {ga, {cable}, {has_winapi}, {}, {winapi}, plat_ui}, }; unsigned test_num = 0; @@ -257,8 +273,12 @@ base::DoNothing(), absl::nullopt); } - model.StartFlow(std::move(transports_info), - /*use_location_bar_bubble=*/false); + model.StartFlow( + std::move(transports_info), + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/ + base::Contains(test.params, + TransportAvailabilityParam::kPreferNativeAPI)); EXPECT_EQ(test.expected_first_step, model.current_step()); std::vector<AuthenticatorRequestDialogModel::Mechanism::Type> @@ -277,6 +297,46 @@ } } +#if BUILDFLAG(IS_WIN) +TEST_F(AuthenticatorRequestDialogModelTest, WinCancel) { + // Simulate the user canceling the Windows native UI, both with and without + // that UI being immediately triggered. If it was immediately triggered then + // canceling it should show the mechanism selection UI. + base::test::ScopedFeatureList scoped_feature_list{ + device::kWebAuthPhoneSupport}; + + for (const bool prefer_native_api : {false, true}) { + SCOPED_TRACE(prefer_native_api); + + AuthenticatorRequestDialogModel::TransportAvailabilityInfo tai; + tai.has_win_native_api_authenticator = true; + tai.win_native_api_authenticator_id = "ID"; + tai.available_transports.insert( + device::FidoTransportProtocol::kCloudAssistedBluetoothLowEnergy); + + AuthenticatorRequestDialogModel model(/*relying_party_id=*/"example.com"); + model.set_cable_transport_info(absl::nullopt, {}, base::DoNothing(), + "fido:/1234"); + + model.StartFlow(std::move(tai), + /*use_location_bar_bubble=*/false, prefer_native_api); + + if (prefer_native_api) { + // The Windows native UI should have been triggered. + EXPECT_EQ(model.current_step(), Step::kNotStarted); + // Canceling the Windows native UI should be handled. + EXPECT_TRUE(model.OnWinUserCancelled()); + } + + // The mechanism selection sheet should now be showing. + EXPECT_EQ(model.current_step(), Step::kMechanismSelection); + // Canceling the Windows UI ends the request because the user must have + // selected the Windows option first. + EXPECT_FALSE(model.OnWinUserCancelled()); + } +} +#endif + TEST_F(AuthenticatorRequestDialogModelTest, NoAvailableTransports) { testing::StrictMock<MockDialogModelObserver> mock_observer; AuthenticatorRequestDialogModel model(/*relying_party_id=*/"example.com"); @@ -284,7 +344,8 @@ EXPECT_CALL(mock_observer, OnStepTransition()); model.StartFlow(TransportAvailabilityInfo(), - /*use_location_bar_bubble=*/false); + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/false); EXPECT_EQ(Step::kErrorNoAvailableTransports, model.current_step()); testing::Mock::VerifyAndClearExpectations(&mock_observer); @@ -360,7 +421,8 @@ absl::nullopt); model.StartFlow(std::move(transports_info), - /*use_location_bar_bubble=*/false); + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/false); ASSERT_EQ(model.mechanisms().size(), 1u); for (const auto step : test.steps) { @@ -409,7 +471,8 @@ EXPECT_CALL(mock_observer, OnStepTransition()); model.StartFlow(std::move(transports_info), - /*use_location_bar_bubble=*/false); + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/false); EXPECT_EQ(Step::kMechanismSelection, model.current_step()); testing::Mock::VerifyAndClearExpectations(&mock_observer); @@ -449,7 +512,8 @@ model.SetBluetoothAdapterPowerOnCallback(power_receiver.GetCallback()); model.set_cable_transport_info(true, {}, base::DoNothing(), absl::nullopt); model.StartFlow(std::move(transports_info), - /*use_location_bar_bubble=*/false); + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/false); EXPECT_EQ(test_case.expected_final_step, model.current_step()); EXPECT_TRUE(model.ble_adapter_is_powered()); EXPECT_FALSE(power_receiver.was_called()); @@ -479,7 +543,8 @@ model.SetBluetoothAdapterPowerOnCallback(power_receiver.GetCallback()); model.set_cable_transport_info(true, {}, base::DoNothing(), absl::nullopt); model.StartFlow(std::move(transports_info), - /*use_location_bar_bubble=*/false); + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/false); EXPECT_EQ(Step::kBlePowerOnManual, model.current_step()); EXPECT_FALSE(model.ble_adapter_is_powered()); @@ -520,7 +585,8 @@ model.SetBluetoothAdapterPowerOnCallback(power_receiver.GetCallback()); model.set_cable_transport_info(true, {}, base::DoNothing(), absl::nullopt); model.StartFlow(std::move(transports_info), - /*use_location_bar_bubble=*/false); + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/false); EXPECT_EQ(Step::kBlePowerOnAutomatic, model.current_step()); @@ -554,7 +620,8 @@ /*device_id=*/"authenticator", AuthenticatorTransport::kInternal)); model.StartFlow(std::move(transports_info), - /*use_location_bar_bubble=*/false); + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/false); EXPECT_EQ(AuthenticatorRequestDialogModel::Step::kMechanismSelection, model.current_step()); EXPECT_EQ(0, num_called); @@ -596,7 +663,8 @@ &dispatched_authenticator_ids)); model.StartFlow(std::move(transports_info), - /*use_location_bar_bubble=*/false); + /*use_location_bar_bubble=*/false, + /*prefer_native_api=*/false); EXPECT_TRUE(model.should_dialog_be_hidden()); task_environment_.FastForwardUntilNoTasksRemain(); @@ -621,7 +689,8 @@ transports_info.available_transports = kAllTransports; transports_info.has_recognized_platform_authenticator_credential = true; model.StartFlow(std::move(transports_info), - /*use_location_bar_bubble=*/true); + /*use_location_bar_bubble=*/true, + /*prefer_native_api=*/false); EXPECT_EQ(model.current_step(), Step::kLocationBarBubble); EXPECT_TRUE(model.should_dialog_be_hidden()); EXPECT_EQ(num_called, 0); @@ -650,7 +719,8 @@ transports_info.recognized_platform_authenticator_credentials = {user_1, user_2}; model.StartFlow(std::move(transports_info), - /*is_location_bar_bubble_ui==*/true); + /*is_location_bar_bubble_ui==*/true, + /*prefer_native_api=*/false); EXPECT_EQ(model.current_step(), Step::kLocationBarBubble); EXPECT_TRUE(model.should_dialog_be_hidden()); EXPECT_EQ(num_called, 0);
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc index dd4456c..4e674f9 100644 --- a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc +++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
@@ -35,6 +35,7 @@ #include "components/device_event_log/device_event_log.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/device_service.h" @@ -82,6 +83,14 @@ }); } +#if BUILDFLAG(IS_WIN) +// kWebAuthnLastOperationWasNativeAPI is a boolean preference that records +// whether the last successful operation used the Windows native API. If so +// then we'll try and jump directly to it next time. +const char kWebAuthnLastOperationWasNativeAPI[] = + "webauthn.last_op_used_native_api"; +#endif + #if BUILDFLAG(IS_MAC) const char kWebAuthnTouchIdMetadataSecretPrefName[] = "webauthn.touchid.metadata_secret"; @@ -145,6 +154,23 @@ return web_contents->GetVisibility() == content::Visibility::VISIBLE; } +#if BUILDFLAG(IS_WIN) +void ChromeWebAuthenticationDelegate::OperationSucceeded( + content::BrowserContext* browser_context, + bool used_win_api) { + // If a registration or assertion operation was successful, record whether the + // Windows native API was used for it. If so we'll jump directly to the native + // UI for the next operation. + Profile* const profile = Profile::FromBrowserContext(browser_context); + if (profile->IsOffTheRecord()) { + return; + } + + profile->GetPrefs()->SetBoolean(kWebAuthnLastOperationWasNativeAPI, + used_win_api); +} +#endif + #if BUILDFLAG(IS_MAC) // static ChromeWebAuthenticationDelegate::TouchIdAuthenticatorConfig @@ -232,6 +258,9 @@ // static void ChromeAuthenticatorRequestDelegate::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { +#if BUILDFLAG(IS_WIN) + registry->RegisterBooleanPref(kWebAuthnLastOperationWasNativeAPI, false); +#endif #if BUILDFLAG(IS_MAC) registry->RegisterStringPref(kWebAuthnTouchIdMetadataSecretPrefName, std::string()); @@ -544,13 +573,21 @@ return; } - weak_dialog_model_->AddObserver(this); - - weak_dialog_model_->StartFlow(std::move(data), is_conditional_); - content::WebContents* web_contents = content::WebContents::FromRenderFrameHost(GetRenderFrameHost()); - Browser* browser = chrome::FindBrowserWithWebContents(web_contents); + + bool last_used_native_api = false; +#if BUILDFLAG(IS_WIN) + PrefService* const prefs = + user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()); + last_used_native_api = prefs->GetBoolean(kWebAuthnLastOperationWasNativeAPI); +#endif + + weak_dialog_model_->AddObserver(this); + weak_dialog_model_->StartFlow(std::move(data), is_conditional_, + last_used_native_api); + + Browser* const browser = chrome::FindBrowserWithWebContents(web_contents); if (browser) { browser->window()->UpdatePageActionIcon(PageActionIconType::kWebAuthn); }
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate.h b/chrome/browser/webauthn/chrome_authenticator_request_delegate.h index 1545fee3..8b53882 100644 --- a/chrome/browser/webauthn/chrome_authenticator_request_delegate.h +++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate.h
@@ -63,6 +63,10 @@ bool SupportsResidentKeys( content::RenderFrameHost* render_frame_host) override; bool IsFocused(content::WebContents* web_contents) override; +#if BUILDFLAG(IS_WIN) + void OperationSucceeded(content::BrowserContext* browser_context, + bool used_win_api) override; +#endif #if BUILDFLAG(IS_MAC) absl::optional<TouchIdAuthenticatorConfig> GetTouchIdAuthenticatorConfig( content::BrowserContext* browser_context) override;
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate_unittest.cc b/chrome/browser/webauthn/chrome_authenticator_request_delegate_unittest.cc index c6fce1e..f61bbc5 100644 --- a/chrome/browser/webauthn/chrome_authenticator_request_delegate_unittest.cc +++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate_unittest.cc
@@ -6,15 +6,20 @@ #include <utility> +#include "base/logging.h" #include "base/memory/raw_ptr.h" +#include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "chrome/browser/webauthn/authenticator_request_dialog_model.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "content/public/browser/authenticator_request_client_delegate.h" #include "content/public/browser/browser_context.h" #include "content/public/test/web_contents_tester.h" +#include "device/fido/features.h" #include "device/fido/fido_device_authenticator.h" #include "device/fido/fido_discovery_factory.h" +#include "device/fido/fido_request_handler_base.h" +#include "device/fido/fido_transport_protocol.h" #include "device/fido/test_callback_receiver.h" #include "testing/gtest/include/gtest/gtest.h" @@ -31,7 +36,7 @@ class ChromeAuthenticatorRequestDelegateTest : public ChromeRenderViewHostTestHarness {}; -class TestAuthenticatorModelObserver +class TestAuthenticatorModelObserver final : public AuthenticatorRequestDialogModel::Observer { public: explicit TestAuthenticatorModelObserver( @@ -146,4 +151,76 @@ EXPECT_EQ(cb.value(), true); } +class ChromeAuthenticatorRequestDelegateWindowsBehaviorTest + : public ChromeAuthenticatorRequestDelegateTest { + public: + void CreateObjectsUnderTest() { + delegate_.emplace(main_rfh()); + delegate_->SetRelyingPartyId("example.com"); + + AuthenticatorRequestDialogModel* const model = delegate_->dialog_model(); + observer_.emplace(model); + model->AddObserver(&observer_.value()); + CHECK_EQ(observer_->last_step(), + AuthenticatorRequestDialogModel::Step::kNotStarted); + } + + absl::optional<ChromeAuthenticatorRequestDelegate> delegate_; + absl::optional<TestAuthenticatorModelObserver> observer_; + + private: + base::test::ScopedFeatureList scoped_feature_list_{ + device::kWebAuthPhoneSupport}; +}; + +TEST_F(ChromeAuthenticatorRequestDelegateWindowsBehaviorTest, + CancelAfterMechanismSelection) { + // Test that, on Windows, the `ChromeAuthenticatorRequestDelegate` should + // remember whether the last successful operation was with the native API or + // not and immediately trigger that UI for the next operation accordingly. + + // Setup the Windows native authenticator and configure caBLE such that adding + // a phone is an option. + AuthenticatorRequestDialogModel::TransportAvailabilityInfo tai; + tai.has_win_native_api_authenticator = true; + tai.win_native_api_authenticator_id = "ID"; + tai.available_transports.insert( + device::FidoTransportProtocol::kCloudAssistedBluetoothLowEnergy); + + CreateObjectsUnderTest(); + delegate_->dialog_model()->set_cable_transport_info( + absl::nullopt, {}, base::DoNothing(), "fido:/1234"); + delegate_->OnTransportAvailabilityEnumerated(tai); + + // Since there are two options, the mechanism selection sheet should be shown. + EXPECT_EQ(observer_->last_step(), + AuthenticatorRequestDialogModel::Step::kMechanismSelection); + + // Simulate the Windows native API being used successfully. + ChromeWebAuthenticationDelegate non_request_delegate; + non_request_delegate.OperationSucceeded(profile(), /* used_win_api= */ true); + + CreateObjectsUnderTest(); + delegate_->dialog_model()->set_cable_transport_info( + absl::nullopt, {}, base::DoNothing(), "fido:/1234"); + delegate_->OnTransportAvailabilityEnumerated(tai); + + // Since the Windows API was used successfully last time, it should jump + // directly to the native UI this time. + EXPECT_EQ(observer_->last_step(), + AuthenticatorRequestDialogModel::Step::kNotStarted); + + // Simulate that caBLE was used successfully. + non_request_delegate.OperationSucceeded(profile(), /* used_win_api= */ false); + + CreateObjectsUnderTest(); + delegate_->dialog_model()->set_cable_transport_info( + absl::nullopt, {}, base::DoNothing(), "fido:/1234"); + delegate_->OnTransportAvailabilityEnumerated(tai); + + // Should show the mechanism selection sheet again. + EXPECT_EQ(observer_->last_step(), + AuthenticatorRequestDialogModel::Step::kMechanismSelection); +} + #endif // BUILDFLAG(IS_WIN)
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 3ae0d43..6845189 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1642593155-8c336440867e9250c04fc82b71080818b00b1768.profdata +chrome-linux-main-1642614982-dff44bb688e1cc081733c1753cd2c2a0049bd16c.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index dc62fc8..e06258e7 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1642593155-ff0a2e73ab65505099a61750d4ed63a6f59dfb0d.profdata +chrome-win32-main-1642604245-3a84b41787a0d28fce834ba8f50d7408f833771f.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 3522930..6b355483 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1642593155-966c73cf8e880a08e307abf492dafff836860153.profdata +chrome-win64-main-1642604245-5b010e4723ff9db2c3baf71069785a97d79d7b0d.profdata
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index fb1d9902..bf02522 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -2205,7 +2205,10 @@ } if (is_linux) { - sources += [ "../browser/ui/views/frame/desktop_browser_frame_aura_linux_browsertest.cc" ] + sources += [ + "../browser/ozone_platform_browsertest.cc", + "../browser/ui/views/frame/desktop_browser_frame_aura_linux_browsertest.cc", + ] } if (is_linux || is_chromeos) {
diff --git a/chrome/test/base/chromeos/ash_browser_test_starter.cc b/chrome/test/base/chromeos/ash_browser_test_starter.cc index 73373115..ae6bbd1cd 100644 --- a/chrome/test/base/chromeos/ash_browser_test_starter.cc +++ b/chrome/test/base/chromeos/ash_browser_test_starter.cc
@@ -20,7 +20,6 @@ #include "chrome/test/base/in_process_browser_test.h" #include "testing/gtest/include/gtest/gtest.h" -namespace crosapi { namespace test { AshBrowserTestStarter::AshBrowserTestStarter() = default; @@ -46,7 +45,7 @@ return true; } -class LacrosStartedObserver : public BrowserManagerObserver { +class LacrosStartedObserver : public crosapi::BrowserManagerObserver { public: LacrosStartedObserver() = default; LacrosStartedObserver(const LacrosStartedObserver&) = delete; @@ -54,13 +53,13 @@ ~LacrosStartedObserver() override = default; void OnStateChanged() override { - if (BrowserManager::Get()->IsRunning()) { + if (crosapi::BrowserManager::Get()->IsRunning()) { run_loop_.Quit(); } } void Wait(base::TimeDelta timeout) { - if (BrowserManager::Get()->IsRunning()) { + if (crosapi::BrowserManager::Get()->IsRunning()) { return; } base::ThreadPool::PostDelayedTask(FROM_HERE, run_loop_.QuitClosure(), @@ -92,16 +91,16 @@ DCHECK(HasLacrosArgument()); WaitForExoStarted(scoped_temp_dir_xdg_.GetPath()); - auto* browser_manager = BrowserManager::Get(); - lacros_keep_alive_ = - browser_manager->KeepAlive(BrowserManager::Feature::kTestOnly); + + crosapi::BrowserManager::Get()->NewWindow( + /*incongnito=*/false, /*should_trigger_session_restore=*/false); LacrosStartedObserver observer; - browser_manager->AddObserver(&observer); + crosapi::BrowserManager::Get()->AddObserver(&observer); observer.Wait(TestTimeouts::action_max_timeout()); - browser_manager->RemoveObserver(&observer); + crosapi::BrowserManager::Get()->RemoveObserver(&observer); - CHECK(browser_manager->IsRunning()); + CHECK(crosapi::BrowserManager::Get()->IsRunning()); // Create a new ash browser window so browser() can work. Profile* profile = ProfileManager::GetActiveUserProfile(); @@ -110,4 +109,3 @@ } } // namespace test -} // namespace crosapi
diff --git a/chrome/test/base/chromeos/ash_browser_test_starter.h b/chrome/test/base/chromeos/ash_browser_test_starter.h index ae6f689..f4ca460 100644 --- a/chrome/test/base/chromeos/ash_browser_test_starter.h +++ b/chrome/test/base/chromeos/ash_browser_test_starter.h
@@ -7,11 +7,9 @@ #include "base/files/scoped_temp_dir.h" #include "base/test/scoped_feature_list.h" -#include "chrome/browser/ash/crosapi/browser_manager.h" class InProcessBrowserTest; -namespace crosapi { namespace test { class AshBrowserTestStarter { @@ -39,10 +37,8 @@ // This is XDG_RUNTIME_DIR. base::ScopedTempDir scoped_temp_dir_xdg_; base::test::ScopedFeatureList scoped_feature_list_; - std::unique_ptr<BrowserManager::ScopedKeepAlive> lacros_keep_alive_; }; } // namespace test -} // namespace crosapi #endif // CHROME_TEST_BASE_CHROMEOS_ASH_BROWSER_TEST_STARTER_H_
diff --git a/chrome/test/base/chromeos/demo_ash_requires_lacros_browsertest.cc b/chrome/test/base/chromeos/demo_ash_requires_lacros_browsertest.cc index 5d91577..4321690 100644 --- a/chrome/test/base/chromeos/demo_ash_requires_lacros_browsertest.cc +++ b/chrome/test/base/chromeos/demo_ash_requires_lacros_browsertest.cc
@@ -34,7 +34,7 @@ } protected: - crosapi::test::AshBrowserTestStarter ash_starter_; + test::AshBrowserTestStarter ash_starter_; }; IN_PROC_BROWSER_TEST_F(DemoAshRequiresLacrosTest, NewTab) {
diff --git a/chrome/test/base/javascript_browser_test.cc b/chrome/test/base/javascript_browser_test.cc index 774407d..f818f11f 100644 --- a/chrome/test/base/javascript_browser_test.cc +++ b/chrome/test/base/javascript_browser_test.cc
@@ -18,13 +18,18 @@ user_libraries_.push_back(library_path); } -JavaScriptBrowserTest::JavaScriptBrowserTest() = default; +JavaScriptBrowserTest::JavaScriptBrowserTest() { +#if BUILDFLAG(IS_CHROMEOS_ASH) -JavaScriptBrowserTest::~JavaScriptBrowserTest() = default; +#endif +} + +JavaScriptBrowserTest::~JavaScriptBrowserTest() { +} void JavaScriptBrowserTest::SetUpInProcessBrowserTestFixture() { #if BUILDFLAG(IS_CHROMEOS_ASH) - ash_starter_ = std::make_unique<crosapi::test::AshBrowserTestStarter>(); + ash_starter_ = std::make_unique<test::AshBrowserTestStarter>(); if (ash_starter_->HasLacrosArgument()) ASSERT_TRUE(ash_starter_->PrepareEnvironmentForLacros()); #endif // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/test/base/javascript_browser_test.h b/chrome/test/base/javascript_browser_test.h index da2a919..ef5a044c7 100644 --- a/chrome/test/base/javascript_browser_test.h +++ b/chrome/test/base/javascript_browser_test.h
@@ -49,9 +49,7 @@ std::vector<base::Value> args); #if BUILDFLAG(IS_CHROMEOS_ASH) - crosapi::test::AshBrowserTestStarter* ash_starter() { - return ash_starter_.get(); - } + test::AshBrowserTestStarter* ash_starter() { return ash_starter_.get(); } #endif // BUILDFLAG(IS_CHROMEOS_ASH) private: @@ -62,7 +60,7 @@ std::vector<base::FilePath> library_search_paths_; #if BUILDFLAG(IS_CHROMEOS_ASH) - std::unique_ptr<crosapi::test::AshBrowserTestStarter> ash_starter_; + std::unique_ptr<test::AshBrowserTestStarter> ash_starter_; #endif // BUILDFLAG(IS_CHROMEOS_ASH) };
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index 17b3027..4420ff7 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -669,7 +669,10 @@ # TypeScript related targets -checked_in_dts_files = [ "test_browser_proxy.d.ts" ] +checked_in_dts_files = [ + "chai_assert.d.ts", + "test_browser_proxy.d.ts", +] # Copies checked-in .d.ts files to the preprocess folder so that they are # discovered by TSC the same way generated .d.ts files are. @@ -682,7 +685,6 @@ root_dir = "./" out_dir = "$target_gen_dir/tsc" js_files = [ - "chai_assert.js", "fake_chrome_event.js", "mock_controller.js", "mock_timer.js",
diff --git a/chrome/test/data/webui/chai_assert.d.ts b/chrome/test/data/webui/chai_assert.d.ts new file mode 100644 index 0000000..901fff2 --- /dev/null +++ b/chrome/test/data/webui/chai_assert.d.ts
@@ -0,0 +1,25 @@ +// 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. + +export function assertTrue(value: boolean, message?: string): asserts value; +export function assertFalse(value: boolean, message?: string): void; +export function assertGE( + value1: number, value2: number, message?: string): void; +export function assertGT( + value1: number, value2: number, message?: string): void; +export function assertEquals( + expected: any, actual: any, message?: string): void; +export function assertDeepEquals( + expected: any, actual: any, message?: string): void; +export function assertLE( + value1: number, value2: number, message?: string): void; +export function assertLT( + value1: number, value2: number, message?: string): void; +export function assertNotEquals( + expected: any, actual: any, message?: string): void; +export function assertNotReached(message?: string): void; +export function assertThrows( + testFunction: () => any, expected_or_constructor?: (Function|string|RegExp), + message?: string): void; +export function assertArrayEquals(expected: any[], actual: any[]): void;
diff --git a/chrome/test/data/webui/chromeos/os_feedback_ui/BUILD.gn b/chrome/test/data/webui/chromeos/os_feedback_ui/BUILD.gn index fce7f33..323469c 100644 --- a/chrome/test/data/webui/chromeos/os_feedback_ui/BUILD.gn +++ b/chrome/test/data/webui/chromeos/os_feedback_ui/BUILD.gn
@@ -13,6 +13,7 @@ ] deps = [ ":confirmation_page_test", + ":mojo_interface_provider_test", ":os_feedback_unified_test", ":search_page_test", ] @@ -26,11 +27,11 @@ externs_list = [ "$externs_path/mocha-2.5.js" ] } -js_library("search_page_test") { +js_library("mojo_interface_provider_test") { deps = [ "../..:chai_assert", - "../..:test_util", - "//ash/webui/os_feedback_ui/resources:search_page", + "//ash/webui/os_feedback_ui/resources:feedback_types", + "//ash/webui/os_feedback_ui/resources:mojo_interface_provider", ] externs_list = [ "$externs_path/mocha-2.5.js" ] } @@ -39,3 +40,12 @@ deps = [] externs_list = [ "$externs_path/mocha-2.5.js" ] } + +js_library("search_page_test") { + deps = [ + "../..:chai_assert", + "../..:test_util", + "//ash/webui/os_feedback_ui/resources:search_page", + ] + externs_list = [ "$externs_path/mocha-2.5.js" ] +}
diff --git a/chrome/test/data/webui/chromeos/os_feedback_ui/mojo_interface_provider_test.js b/chrome/test/data/webui/chromeos/os_feedback_ui/mojo_interface_provider_test.js new file mode 100644 index 0000000..7bb6b87 --- /dev/null +++ b/chrome/test/data/webui/chromeos/os_feedback_ui/mojo_interface_provider_test.js
@@ -0,0 +1,18 @@ +// 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. + +import {HelpContentProviderInterface} from 'chrome://os-feedback/feedback_types.js'; +import {getHelpContentProvider, setHelpContentProviderForTesting} from 'chrome://os-feedback/mojo_interface_provider.js'; + +import {assertEquals} from '../../chai_assert.js'; + +export function fakeMojoProviderTestSuite() { + test('SettingGettingTestProvider', () => { + // TODO(xiangdongkong): Replace with fake when built. + let fake_provider = + /** @type {HelpContentProviderInterface} */ (new Object()); + setHelpContentProviderForTesting(fake_provider); + assertEquals(fake_provider, getHelpContentProvider()); + }); +} \ No newline at end of file
diff --git a/chrome/test/data/webui/chromeos/os_feedback_ui/os_feedback_browsertest.js b/chrome/test/data/webui/chromeos/os_feedback_ui/os_feedback_browsertest.js index f4c6ce0..a303fda 100644 --- a/chrome/test/data/webui/chromeos/os_feedback_ui/os_feedback_browsertest.js +++ b/chrome/test/data/webui/chromeos/os_feedback_ui/os_feedback_browsertest.js
@@ -41,6 +41,7 @@ // although technically is not necessary. const debug_suites_list = [ 'confirmationPageTest', + 'fakeMojoProviderTest', 'searchPageTest', ];
diff --git a/chrome/test/data/webui/chromeos/os_feedback_ui/os_feedback_unified_test.js b/chrome/test/data/webui/chromeos/os_feedback_ui/os_feedback_unified_test.js index 2dbef69..492d726 100644 --- a/chrome/test/data/webui/chromeos/os_feedback_ui/os_feedback_unified_test.js +++ b/chrome/test/data/webui/chromeos/os_feedback_ui/os_feedback_unified_test.js
@@ -5,6 +5,7 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; import {confirmationPageTest} from './confirmation_page_test.js'; +import {fakeMojoProviderTestSuite} from './mojo_interface_provider_test.js'; import {searchPageTestSuite} from './search_page_test.js'; window.test_suites_list = []; @@ -15,4 +16,5 @@ } runSuite('confirmationPageTest', confirmationPageTest); -runSuite('searchPageTest', searchPageTestSuite); +runSuite('fakeMojoProviderTest', fakeMojoProviderTestSuite); +runSuite('searchPageTest', searchPageTestSuite); \ No newline at end of file
diff --git a/chrome/test/data/webui/chromeos/personalization_app/google_photos_collection_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/google_photos_collection_element_test.ts index 3dbc5ac8..fcec21f 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/google_photos_collection_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/google_photos_collection_element_test.ts
@@ -65,7 +65,7 @@ // Photos content should be present and visible. const photosContent = querySelector('#photosContent'); assertTrue(!!photosContent); - assertFalse(photosContent!.hidden); + assertFalse(photosContent.hidden); // Albums content should be absent. assertEquals(querySelector('#albumsContent'), null); @@ -93,34 +93,34 @@ // Tab strip should be present and visible. const tabStrip = querySelector('#tabStrip'); assertTrue(!!tabStrip); - assertFalse(tabStrip!.hidden); + assertFalse(tabStrip.hidden); // Photos tab should be present, visible, and pressed. const photosTab = querySelector('#photosTab'); assertTrue(!!photosTab); - assertFalse(photosTab!.hidden); - assertEquals(photosTab!.getAttribute('aria-pressed'), 'true'); + assertFalse(photosTab.hidden); + assertEquals(photosTab.getAttribute('aria-pressed'), 'true'); // Photos content should be present and visible. const photosContent = querySelector('#photosContent'); assertTrue(!!photosContent); - assertFalse(photosContent!.hidden); + assertFalse(photosContent.hidden); // Albums tab should be present, visible, and *not* pressed. const albumsTab = querySelector('#albumsTab'); assertTrue(!!albumsTab); - assertFalse(albumsTab!.hidden); - assertEquals(albumsTab!.getAttribute('aria-pressed'), 'false'); + assertFalse(albumsTab.hidden); + assertEquals(albumsTab.getAttribute('aria-pressed'), 'false'); // Albums content should be present and hidden. const albumsContent = querySelector('#albumsContent'); assertTrue(!!albumsContent); - assertTrue(albumsContent!.hidden); + assertTrue(albumsContent.hidden); // Photos by album id content should be present and hidden. const photosByAlbumIdContent = querySelector('#photosByAlbumIdContent'); assertTrue(!!photosByAlbumIdContent); - assertTrue(photosByAlbumIdContent!.hidden); + assertTrue(photosByAlbumIdContent.hidden); // Clicking the albums tab should cause: // * albums tab to be visible and pressed. @@ -128,14 +128,14 @@ // * photos tab to be visible and *not* pressed. // * photos content to be hidden. // * photos by album id content to be hidden. - albumsTab!.click(); - assertFalse(albumsTab!.hidden); - assertEquals(albumsTab!.getAttribute('aria-pressed'), 'true'); - assertFalse(albumsContent!.hidden); - assertFalse(photosTab!.hidden); - assertEquals(photosTab!.getAttribute('aria-pressed'), 'false'); - assertTrue(photosContent!.hidden); - assertTrue(photosByAlbumIdContent!.hidden); + albumsTab.click(); + assertFalse(albumsTab.hidden); + assertEquals(albumsTab.getAttribute('aria-pressed'), 'true'); + assertFalse(albumsContent.hidden); + assertFalse(photosTab.hidden); + assertEquals(photosTab.getAttribute('aria-pressed'), 'false'); + assertTrue(photosContent.hidden); + assertTrue(photosByAlbumIdContent.hidden); // Selecting an album should cause: // * tab strip to be hidden. @@ -144,10 +144,10 @@ // * photos content to be hidden. googlePhotosCollectionElement.setAttribute('album-id', '1'); await waitAfterNextRender(googlePhotosCollectionElement); - assertEquals(window.getComputedStyle(tabStrip!).display, 'none'); - assertFalse(photosByAlbumIdContent!.hidden); - assertTrue(albumsContent!.hidden); - assertTrue(photosContent!.hidden); + assertEquals(window.getComputedStyle(tabStrip).display, 'none'); + assertFalse(photosByAlbumIdContent.hidden); + assertTrue(albumsContent.hidden); + assertTrue(photosContent.hidden); // Un-selecting an album should cause: // * tab strip to be visible. @@ -157,9 +157,9 @@ googlePhotosCollectionElement.removeAttribute('album-id'); await waitAfterNextRender(googlePhotosCollectionElement); assertEquals(window.getComputedStyle(tabStrip!).display, 'block'); - assertTrue(photosByAlbumIdContent!.hidden); - assertFalse(albumsContent!.hidden); - assertTrue(photosContent!.hidden); + assertTrue(photosByAlbumIdContent.hidden); + assertFalse(albumsContent.hidden); + assertTrue(photosContent.hidden); // Clicking the photos tab should cause: // * photos tab to be visible and pressed. @@ -167,14 +167,14 @@ // * albums tab to be visible and *not* pressed. // * albums content to be hidden. // * photos by album id content to be hidden. - photosTab!.click(); - assertFalse(photosTab!.hidden); - assertEquals(photosTab!.getAttribute('aria-pressed'), 'true'); - assertFalse(photosContent!.hidden); - assertFalse(albumsTab!.hidden); - assertEquals(albumsTab!.getAttribute('aria-pressed'), 'false'); - assertTrue(albumsContent!.hidden); - assertTrue(photosByAlbumIdContent!.hidden); + photosTab.click(); + assertFalse(photosTab.hidden); + assertEquals(photosTab.getAttribute('aria-pressed'), 'true'); + assertFalse(photosContent.hidden); + assertFalse(albumsTab.hidden); + assertEquals(albumsTab.getAttribute('aria-pressed'), 'false'); + assertTrue(albumsContent.hidden); + assertTrue(photosByAlbumIdContent.hidden); }); test('displays zero state when there is no content', async () => { @@ -205,6 +205,6 @@ // Zero state should be present and visible. const zeroState = querySelector('#zeroState'); assertTrue(!!zeroState); - assertFalse(zeroState!.hidden); + assertFalse(zeroState.hidden); }); }
diff --git a/chrome/test/data/webui/chromeos/personalization_app/local_images_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/local_images_element_test.ts index 2663bee0..7110e98 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/local_images_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/local_images_element_test.ts
@@ -108,8 +108,8 @@ // Both items are sent. No images are rendered yet because they are not // done loading thumbnails. - assertEquals(2, ironList!.items!.length); - assertEquals(0, ironList!.shadowRoot!.querySelectorAll('img').length); + assertEquals(2, ironList.items!.length); + assertEquals(0, ironList.shadowRoot!.querySelectorAll('img').length); // Set loading finished for first thumbnail. personalizationStore.data.wallpaper.loading.local.data = { @@ -117,7 +117,7 @@ }; personalizationStore.notifyObservers(); await waitAfterNextRender(localImagesElement); - assertEquals(2, ironList!.items!.length); + assertEquals(2, ironList.items!.length); let imgTags = localImagesElement.shadowRoot!.querySelectorAll('img'); assertEquals(1, imgTags.length); assertEquals('data://localimage0data', imgTags![0]!.src);
diff --git a/chrome/test/data/webui/chromeos/personalization_app/personalization_breadcrumb_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/personalization_breadcrumb_element_test.ts index db2d729b..c5ec277 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/personalization_breadcrumb_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/personalization_breadcrumb_element_test.ts
@@ -72,14 +72,15 @@ breadcrumbElement.shadowRoot!.getElementById('breadcrumbContainer'); assertTrue(!!breadcrumbContainer && !breadcrumbContainer.hidden); assertBreadcrumbs( - breadcrumbContainer!, [breadcrumbElement.i18n('wallpaperLabel')]); + breadcrumbContainer, [breadcrumbElement.i18n('wallpaperLabel')]); }); test('shows collection name when collection is selected', async () => { const collection = wallpaperProvider.collections![0]; + assertTrue(!!collection); breadcrumbElement = initElement( PersonalizationBreadcrumb, - {'path': Paths.CollectionImages, 'collectionId': collection!.id}); + {'path': Paths.CollectionImages, 'collectionId': collection.id}); personalizationStore.data.wallpaper.backdrop.collections = wallpaperProvider.collections; @@ -91,8 +92,8 @@ breadcrumbElement.shadowRoot!.getElementById('breadcrumbContainer'); assertTrue(!!breadcrumbContainer && !breadcrumbContainer.hidden); assertBreadcrumbs( - breadcrumbContainer!, - [breadcrumbElement.i18n('wallpaperLabel'), collection!.name]); + breadcrumbContainer, + [breadcrumbElement.i18n('wallpaperLabel'), collection.name]); }); test('show album name when Google Photos subpage is loaded', async () => { @@ -116,7 +117,7 @@ const breadcrumbContainer = breadcrumbElement.shadowRoot!.getElementById('breadcrumbContainer'); assertTrue(!!breadcrumbContainer && !breadcrumbContainer.hidden); - assertBreadcrumbs(breadcrumbContainer!, [ + assertBreadcrumbs(breadcrumbContainer, [ breadcrumbElement.i18n('wallpaperLabel'), breadcrumbElement.i18n('googlePhotosLabel'), googlePhotosAlbum.title ]); @@ -133,7 +134,7 @@ const breadcrumbContainer = breadcrumbElement.shadowRoot!.getElementById('breadcrumbContainer'); assertTrue(!!breadcrumbContainer && !breadcrumbContainer.hidden); - assertBreadcrumbs(breadcrumbContainer!, [ + assertBreadcrumbs(breadcrumbContainer, [ breadcrumbElement.i18n('wallpaperLabel'), breadcrumbElement.i18n('googlePhotosLabel') ]); @@ -152,7 +153,7 @@ const breadcrumbContainer = breadcrumbElement.shadowRoot!.getElementById('breadcrumbContainer'); assertTrue(!!breadcrumbContainer && !breadcrumbContainer.hidden); - assertBreadcrumbs(breadcrumbContainer!, [ + assertBreadcrumbs(breadcrumbContainer, [ breadcrumbElement.i18n('wallpaperLabel'), breadcrumbElement.i18n('myImagesLabel') ]);
diff --git a/chrome/test/data/webui/chromeos/personalization_app/personalization_theme_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/personalization_theme_element_test.ts index 1d920ec..ccada54 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/personalization_theme_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/personalization_theme_element_test.ts
@@ -76,6 +76,6 @@ const radioButton = personalizationThemeElement.shadowRoot!.getElementById('darkMode'); assertTrue(!!radioButton); - assertEquals(radioButton!.getAttribute('aria-pressed'), 'true'); + assertEquals(radioButton.getAttribute('aria-pressed'), 'true'); }); }
diff --git a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_preview_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_preview_element_test.ts index 8553804..bce0958e 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_preview_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_preview_element_test.ts
@@ -62,7 +62,7 @@ personalizationStore.notifyObservers(); await waitAfterNextRender(wallpaperPreviewElement); - assertEquals('none', placeholder!.style.display); + assertEquals('none', placeholder.style.display); // Sent a request to update user wallpaper. Loading placeholder should // come back. @@ -74,7 +74,7 @@ personalizationStore.notifyObservers(); await waitAfterNextRender(wallpaperPreviewElement); - assertEquals('', placeholder!.style.display); + assertEquals('', placeholder.style.display); }); test('shows wallpaper image when loaded', async () => { @@ -111,8 +111,8 @@ // Dom-if will set display: none if the element is hidden. Make sure it is // not hidden. - assertNotEquals('none', placeholder!.style.display); + assertNotEquals('none', placeholder.style.display); assertEquals( null, wallpaperPreviewElement.shadowRoot!.querySelector('img')); }); -} \ No newline at end of file +}
diff --git a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.ts index 6603c399..0ff17ca 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.ts
@@ -68,7 +68,7 @@ personalizationStore.notifyObservers(); await waitAfterNextRender(wallpaperSelectedElement); - assertEquals('none', placeholder!.style.display); + assertEquals('none', placeholder.style.display); // Sent a request to update user wallpaper. Loading placeholder should // come back. @@ -80,7 +80,7 @@ personalizationStore.notifyObservers(); await waitAfterNextRender(wallpaperSelectedElement); - assertEquals('', placeholder!.style.display); + assertEquals('', placeholder.style.display); }); test('shows wallpaper image and attribution when loaded', async () => { @@ -89,7 +89,7 @@ wallpaperSelectedElement = initElement(WallpaperSelected); await waitAfterNextRender(wallpaperSelectedElement); - + const img = wallpaperSelectedElement.shadowRoot!.querySelector('img'); assertEquals( `chrome://image/?${wallpaperProvider.currentWallpaper.url.url}`, @@ -195,7 +195,7 @@ // Dom-if will set display: none if the element is hidden. Make sure it is // not hidden. - assertNotEquals('none', placeholder!.style.display); + assertNotEquals('none', placeholder.style.display); assertEquals( null, wallpaperSelectedElement.shadowRoot!.querySelector('img')); });
diff --git a/chrome/test/data/webui/cr_elements/cr_view_manager_test.ts b/chrome/test/data/webui/cr_elements/cr_view_manager_test.ts index 23c6b98..413cd8711 100644 --- a/chrome/test/data/webui/cr_elements/cr_view_manager_test.ts +++ b/chrome/test/data/webui/cr_elements/cr_view_manager_test.ts
@@ -9,7 +9,7 @@ import {assert} from 'chrome://resources/js/assert.m.js'; -import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; +import {assertEquals} from 'chrome://webui-test/chai_assert.js'; import {isChildVisible} from 'chrome://webui-test/test_util.js'; // clang-format on @@ -44,8 +44,9 @@ test(assert(TestNames.Visibility), function() { function assertViewVisible(id: string, expectIsVisible: boolean) { - const assertFunc = expectIsVisible ? assertTrue : assertFalse; - assertFunc(isChildVisible(viewManager, `#${id}`, true)); + assertEquals( + expectIsVisible, + isChildVisible(viewManager, `#${id}`, /*checkLightDom=*/ true)); } assertViewVisible('viewOne', false);
diff --git a/chrome/test/enterprise/OWNERS b/chrome/test/enterprise/OWNERS index 9cd6168..1788c1a 100644 --- a/chrome/test/enterprise/OWNERS +++ b/chrome/test/enterprise/OWNERS
@@ -1,3 +1,2 @@ jxiang@google.com -asanka@chromium.org eswarank@google.com
diff --git a/chromecast/mojo/interface_bundle.h b/chromecast/mojo/interface_bundle.h index 20afa1f..00533d3b 100644 --- a/chromecast/mojo/interface_bundle.h +++ b/chromecast/mojo/interface_bundle.h
@@ -129,7 +129,8 @@ bool TryBindReceiver(mojo::GenericPendingReceiver& receiver) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (local_interfaces_.HasInterface(*receiver.interface_name())) { - local_interfaces_.Bind(*receiver.interface_name(), receiver.PassPipe()); + std::string interface_name = *receiver.interface_name(); + local_interfaces_.Bind(interface_name, receiver.PassPipe()); return true; } return false;
diff --git a/components/BUILD.gn b/components/BUILD.gn index 7b6d99a4..59d18e5 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -245,6 +245,7 @@ "//components/previous_session_info:unit_tests", "//components/safe_browsing/ios/browser:unit_tests", "//components/security_state/ios:unit_tests", + "//components/shared_highlighting/ios:unit_tests", "//components/signin/ios/browser:unit_tests", "//components/signin/public/identity_manager/objc:unit_tests", "//components/translate/ios/browser:unit_tests",
diff --git a/components/account_manager_core/chromeos/account_manager.cc b/components/account_manager_core/chromeos/account_manager.cc index 23416c66..39b0c359 100644 --- a/components/account_manager_core/chromeos/account_manager.cc +++ b/components/account_manager_core/chromeos/account_manager.cc
@@ -578,30 +578,6 @@ UpsertAccountInternal(account_key, AccountInfo{it->second.raw_email, token}); } -void AccountManager::UpdateEmail( - const ::account_manager::AccountKey& account_key, - const std::string& raw_email) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK_NE(init_state_, InitializationState::kNotStarted); - - base::OnceClosure closure = - base::BindOnce(&AccountManager::UpdateEmailInternal, - weak_factory_.GetWeakPtr(), account_key, raw_email); - RunOnInitialization(std::move(closure)); -} - -void AccountManager::UpdateEmailInternal( - const ::account_manager::AccountKey& account_key, - const std::string& raw_email) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK_EQ(init_state_, InitializationState::kInitialized); - - auto it = accounts_.find(account_key); - DCHECK(it != accounts_.end()) - << "UpdateEmail cannot be used for adding accounts"; - UpsertAccountInternal(account_key, AccountInfo{raw_email, it->second.token}); -} - void AccountManager::UpsertAccountInternal( const ::account_manager::AccountKey& account_key, const AccountInfo& account) {
diff --git a/components/account_manager_core/chromeos/account_manager.h b/components/account_manager_core/chromeos/account_manager.h index 21c9ab3..d33b8b97 100644 --- a/components/account_manager_core/chromeos/account_manager.h +++ b/components/account_manager_core/chromeos/account_manager.h
@@ -169,10 +169,10 @@ // with GAIA fails, AccountManager will forget the account. void RemoveAccount(const ::account_manager::AccountKey& account_key); - // Updates or inserts an account. |raw_email| is the raw, un-canonicalized - // email id for |account_key|. |raw_email| must not be empty. Use - // |AccountManager::kActiveDirectoryDummyToken| as the |token| for Active - // Directory accounts, and |AccountManager::kInvalidToken| for Gaia accounts + // Updates or inserts an account. `raw_email` is the raw, un-canonicalized + // email id for `account_key`. `raw_email` must not be empty. Use + // `AccountManager::kActiveDirectoryDummyToken` as the `token` for Active + // Directory accounts, and `AccountManager::kInvalidToken` for Gaia accounts // with unknown tokens. // Note: This API is idempotent. void UpsertAccount(const ::account_manager::AccountKey& account_key, @@ -186,12 +186,6 @@ void UpdateToken(const ::account_manager::AccountKey& account_key, const std::string& token); - // Updates the email associated with |account_key|. The account must be known - // to Account Manager. See |UpsertAccount| for information about adding an - // account. - void UpdateEmail(const ::account_manager::AccountKey& account_key, - const std::string& raw_email); - // Add a non owning pointer to an |AccountManager::Observer|. void AddObserver(Observer* observer); @@ -287,10 +281,6 @@ // class is initialized. void RunOnInitialization(base::OnceClosure closure); - // Assumes that |AccountManager| initialization (|init_state_|) is complete. - void UpdateEmailInternal(const ::account_manager::AccountKey& account_key, - const std::string& raw_email); - // Does the actual work of upserting an account and performing related tasks // like revoking old tokens and informing observers. All account updates // funnel through to this method. Assumes that |AccountManager| initialization
diff --git a/components/account_manager_core/chromeos/account_manager_unittest.cc b/components/account_manager_core/chromeos/account_manager_unittest.cc index 92f80b4..ed02814 100644 --- a/components/account_manager_core/chromeos/account_manager_unittest.cc +++ b/components/account_manager_core/chromeos/account_manager_unittest.cc
@@ -456,18 +456,6 @@ EXPECT_EQ(kRawUserEmail, raw_email); } -TEST_F(AccountManagerTest, UpdatingAccountEmailShouldNotOverwriteTokens) { - const std::string new_email = "new-email@example.org"; - account_manager()->UpsertAccount(kGaiaAccountKey, kRawUserEmail, kGaiaToken); - account_manager()->UpdateEmail(kGaiaAccountKey, new_email); - RunAllPendingTasks(); - - ResetAndInitializeAccountManager(); - const std::string raw_email = GetAccountEmailBlocking(kGaiaAccountKey); - EXPECT_EQ(new_email, raw_email); - EXPECT_EQ(kGaiaToken, account_manager()->accounts_[kGaiaAccountKey].token); -} - TEST_F(AccountManagerTest, UpsertAccountCanUpdateEmail) { const std::string new_email = "new-email@example.org"; account_manager()->UpsertAccount(kGaiaAccountKey, kRawUserEmail, kGaiaToken);
diff --git a/components/autofill/core/browser/BUILD.gn b/components/autofill/core/browser/BUILD.gn index a5d0663..d4bbf6a2 100644 --- a/components/autofill/core/browser/BUILD.gn +++ b/components/autofill/core/browser/BUILD.gn
@@ -251,6 +251,8 @@ "payments/payments_client.cc", "payments/payments_client.h", "payments/payments_customer_data.h", + "payments/payments_requests/get_details_for_enrollment_request.cc", + "payments/payments_requests/get_details_for_enrollment_request.h", "payments/payments_requests/payments_request.cc", "payments/payments_requests/payments_request.h", "payments/payments_requests/select_challenge_option_request.cc", @@ -782,6 +784,7 @@ "payments/full_card_request_unittest.cc", "payments/legal_message_line_unittest.cc", "payments/payments_client_unittest.cc", + "payments/payments_requests/get_details_for_enrollment_request_unittest.cc", "payments/payments_service_url_unittest.cc", "payments/payments_util_unittest.cc", "payments/wait_for_signal_or_timeout_unittest.cc",
diff --git a/components/autofill/core/browser/payments/payments_client.cc b/components/autofill/core/browser/payments/payments_client.cc index a3e947f..4a7564bc 100644 --- a/components/autofill/core/browser/payments/payments_client.cc +++ b/components/autofill/core/browser/payments/payments_client.cc
@@ -27,6 +27,7 @@ #include "components/autofill/core/browser/data_model/credit_card.h" #include "components/autofill/core/browser/payments/account_info_getter.h" #include "components/autofill/core/browser/payments/local_card_migration_manager.h" +#include "components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request.h" #include "components/autofill/core/browser/payments/payments_requests/payments_request.h" #include "components/autofill/core/browser/payments/payments_requests/select_challenge_option_request.h" #include "components/autofill/core/browser/payments/payments_requests/unmask_card_request.h" @@ -47,8 +48,7 @@ #include "services/network/public/cpp/simple_url_loader.h" #include "services/network/public/mojom/url_response_head.mojom.h" -namespace autofill { -namespace payments { +namespace autofill::payments { namespace { @@ -225,7 +225,7 @@ GetUnmaskDetailsRequest(const GetUnmaskDetailsRequest&) = delete; GetUnmaskDetailsRequest& operator=(const GetUnmaskDetailsRequest&) = delete; - ~GetUnmaskDetailsRequest() override {} + ~GetUnmaskDetailsRequest() override = default; std::string GetRequestUrlPath() override { return kGetUnmaskDetailsRequestPath; @@ -319,7 +319,7 @@ OptChangeRequest(const OptChangeRequest&) = delete; OptChangeRequest& operator=(const OptChangeRequest&) = delete; - ~OptChangeRequest() override {} + ~OptChangeRequest() override = default; std::string GetRequestUrlPath() override { return kOptChangeRequestPath; } @@ -444,7 +444,7 @@ GetUploadDetailsRequest(const GetUploadDetailsRequest&) = delete; GetUploadDetailsRequest& operator=(const GetUploadDetailsRequest&) = delete; - ~GetUploadDetailsRequest() override {} + ~GetUploadDetailsRequest() override = default; std::string GetRequestUrlPath() override { return kGetUploadDetailsRequestPath; @@ -564,12 +564,12 @@ int start; base::StringToInt(range[0], &start); if (range.size() == 1) { - supported_card_bin_ranges.push_back(std::make_pair(start, start)); + supported_card_bin_ranges.emplace_back(start, start); } else { int end; base::StringToInt(range[1], &end); DCHECK_LE(start, end); - supported_card_bin_ranges.push_back(std::make_pair(start, end)); + supported_card_bin_ranges.emplace_back(start, end); } } return supported_card_bin_ranges; @@ -607,7 +607,7 @@ UploadCardRequest(const UploadCardRequest&) = delete; UploadCardRequest& operator=(const UploadCardRequest&) = delete; - ~UploadCardRequest() override {} + ~UploadCardRequest() override = default; std::string GetRequestUrlPath() override { return kUploadCardRequestPath; } @@ -729,7 +729,7 @@ MigrateCardsRequest(const MigrateCardsRequest&) = delete; MigrateCardsRequest& operator=(const MigrateCardsRequest&) = delete; - ~MigrateCardsRequest() override {} + ~MigrateCardsRequest() override = default; std::string GetRequestUrlPath() override { return kMigrateCardsRequestPath; } @@ -964,9 +964,20 @@ PaymentsClient::SelectChallengeOptionRequestDetails:: ~SelectChallengeOptionRequestDetails() = default; +PaymentsClient::GetDetailsForEnrollmentRequestDetails:: + GetDetailsForEnrollmentRequestDetails() = default; +PaymentsClient::GetDetailsForEnrollmentRequestDetails:: + GetDetailsForEnrollmentRequestDetails( + const GetDetailsForEnrollmentRequestDetails& other) = default; +PaymentsClient::GetDetailsForEnrollmentRequestDetails:: + ~GetDetailsForEnrollmentRequestDetails() = default; + PaymentsClient::GetDetailsForEnrollmentResponseDetails:: GetDetailsForEnrollmentResponseDetails() = default; PaymentsClient::GetDetailsForEnrollmentResponseDetails:: + GetDetailsForEnrollmentResponseDetails( + const GetDetailsForEnrollmentResponseDetails& other) = default; +PaymentsClient::GetDetailsForEnrollmentResponseDetails:: ~GetDetailsForEnrollmentResponseDetails() = default; PaymentsClient::UpdateVirtualCardEnrollmentRequestDetails:: @@ -1331,5 +1342,4 @@ base::Unretained(this))); } -} // namespace payments -} // namespace autofill +} // namespace autofill::payments
diff --git a/components/autofill/core/browser/payments/payments_client.h b/components/autofill/core/browser/payments/payments_client.h index 85a4eba47..6c73ae1 100644 --- a/components/autofill/core/browser/payments/payments_client.h +++ b/components/autofill/core/browser/payments/payments_client.h
@@ -324,15 +324,37 @@ absl::optional<std::string> vcn_context_token; }; - // TODO(crbug.com/1281695): Add GetDetailsForEnrollRequest. + // The struct to hold all detailed information to construct a + // GetDetailsForEnrollmentRequest. + struct GetDetailsForEnrollmentRequestDetails { + GetDetailsForEnrollmentRequestDetails(); + GetDetailsForEnrollmentRequestDetails( + const GetDetailsForEnrollmentRequestDetails& other); + ~GetDetailsForEnrollmentRequestDetails(); + + // The type of the enrollment this request is for. + VirtualCardEnrollmentSource type = VirtualCardEnrollmentSource::kNone; + + // |instrument_id| is used by the server to identify a specific card to get + // details for. + int64_t instrument_id = 0; + + // The billing customer number of the account this request is sent to. + int64_t billing_customer_number = 0; + + // |risk_data| contains some fingerprint data for the user and the device. + std::string risk_data; + + // |app_locale| is the Chrome locale. + std::string app_locale; + }; + // A collection of information received in the response for a // GetDetailsForEnrollRequest. struct GetDetailsForEnrollmentResponseDetails { GetDetailsForEnrollmentResponseDetails(); GetDetailsForEnrollmentResponseDetails( - const GetDetailsForEnrollmentResponseDetails&) = delete; - GetDetailsForEnrollmentResponseDetails& operator=( - const GetDetailsForEnrollmentResponseDetails&) = delete; + const GetDetailsForEnrollmentResponseDetails& other); ~GetDetailsForEnrollmentResponseDetails(); // |vcn_context_token| is used in the sequential Enroll call, where it // allows the server to get the instrument id for this |vcn_context_token|
diff --git a/components/autofill/core/browser/payments/payments_client_unittest.cc b/components/autofill/core/browser/payments/payments_client_unittest.cc index a92e2f0c..750077ba 100644 --- a/components/autofill/core/browser/payments/payments_client_unittest.cc +++ b/components/autofill/core/browser/payments/payments_client_unittest.cc
@@ -39,8 +39,7 @@ #include "services/network/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" -namespace autofill { -namespace payments { +namespace autofill::payments { namespace { int kAllDetectableValues = @@ -332,8 +331,8 @@ card1.SetRawInfo(CREDIT_CARD_NAME_FULL, u""); card2.SetRawInfo(CREDIT_CARD_NAME_FULL, u""); } - migratable_credit_cards_.push_back(MigratableCreditCard(card1)); - migratable_credit_cards_.push_back(MigratableCreditCard(card2)); + migratable_credit_cards_.emplace_back(card1); + migratable_credit_cards_.emplace_back(card2); client_->MigrateCards( request_details, migratable_credit_cards_, base::BindOnce(&PaymentsClientTest::OnDidMigrateLocalCards, @@ -1494,7 +1493,7 @@ TEST_F(PaymentsClientTest, MigrationRequestIncludesCardNickname) { StartMigrating(/*has_cardholder_name=*/true, - /*set_nickname_to_first_card=*/true); + /*set_nickname_for_first_card=*/true); IssueOAuthToken(); // Nickname was set for the first card. @@ -1727,5 +1726,4 @@ TriggerFlow(); } -} // namespace payments -} // namespace autofill +} // namespace autofill::payments
diff --git a/components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request.cc b/components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request.cc new file mode 100644 index 0000000..bdfba3c --- /dev/null +++ b/components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request.cc
@@ -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. + +#include "components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request.h" + +#include "base/json/json_writer.h" + +namespace autofill::payments { + +namespace { + +// The path that the request will be sent to. +const char kGetDetailsForEnrollmentRequestPath[] = + "payments/apis/virtualcardservice/getdetailsforenroll"; + +// The billable service number for the request if the enrollment happens after a +// local card upload. +const int kUpstreamEnrollBillableServiceNumber = + kUploadCardBillableServiceNumber; + +// The billable service number for the request if the enrollment happens after a +// server card retrieval or in the settings page. +const int kDownstreamEnrollBillableServiceNumber = + kUnmaskCardBillableServiceNumber; + +} // namespace + +GetDetailsForEnrollmentRequest::GetDetailsForEnrollmentRequest( + PaymentsClient::GetDetailsForEnrollmentRequestDetails request_details, + base::OnceCallback< + void(AutofillClient::PaymentsRpcResult, + PaymentsClient::GetDetailsForEnrollmentResponseDetails&)> callback) + : request_details_(request_details), callback_(std::move(callback)) {} + +GetDetailsForEnrollmentRequest::~GetDetailsForEnrollmentRequest() = default; + +std::string GetDetailsForEnrollmentRequest::GetRequestUrlPath() { + return kGetDetailsForEnrollmentRequestPath; +} + +std::string GetDetailsForEnrollmentRequest::GetRequestContentType() { + return "application/json"; +} + +std::string GetDetailsForEnrollmentRequest::GetRequestContent() { + base::Value request_dict(base::Value::Type::DICTIONARY); + + base::Value context(base::Value::Type::DICTIONARY); + context.SetKey("language_code", base::Value(request_details_.app_locale)); + int billable_service_number = 0; + switch (request_details_.type) { + case VirtualCardEnrollmentSource::kUpstream: + billable_service_number = kUpstreamEnrollBillableServiceNumber; + break; + case VirtualCardEnrollmentSource::kDownstream: + case VirtualCardEnrollmentSource::kSettingsPage: + billable_service_number = kDownstreamEnrollBillableServiceNumber; + break; + case VirtualCardEnrollmentSource::kNone: + NOTREACHED(); + break; + } + context.SetKey("billable_service", base::Value(billable_service_number)); + if (request_details_.billing_customer_number != 0) { + context.SetKey("customer_context", + BuildCustomerContextDictionary( + request_details_.billing_customer_number)); + } + request_dict.SetKey("context", std::move(context)); + + request_dict.SetKey( + "instrument_id", + base::Value(base::NumberToString(request_details_.instrument_id))); + + request_dict.SetKey("risk_data_encoded", + BuildRiskDictionary(request_details_.risk_data)); + + std::string request_content; + base::JSONWriter::Write(request_dict, &request_content); + VLOG(3) << "GetDetailsForEnrollmentRequest request body: " << request_content; + return request_content; +} + +void GetDetailsForEnrollmentRequest::ParseResponse( + const base::Value& response) { + const base::Value* google_legal_message = response.FindKeyOfType( + "google_legal_message", base::Value::Type::DICTIONARY); + if (google_legal_message) { + LegalMessageLine::Parse(*google_legal_message, + &response_details_.google_legal_message, + /*escape_apostrophes=*/true); + } + + const base::Value* external_legal_message = response.FindKeyOfType( + "external_legal_message", base::Value::Type::DICTIONARY); + if (external_legal_message) { + LegalMessageLine::Parse(*external_legal_message, + &response_details_.issuer_legal_message, + /*escape_apostrophes=*/true); + } + + const auto* context_token = response.FindStringKey("context_token"); + response_details_.vcn_context_token = + context_token ? *context_token : std::string(); +} + +bool GetDetailsForEnrollmentRequest::IsResponseComplete() { + return !response_details_.vcn_context_token.empty() && + !response_details_.google_legal_message.empty(); +} + +void GetDetailsForEnrollmentRequest::RespondToDelegate( + AutofillClient::PaymentsRpcResult result) { + std::move(callback_).Run(result, response_details_); +} + +} // namespace autofill::payments
diff --git a/components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request.h b/components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request.h new file mode 100644 index 0000000..a9550c3 --- /dev/null +++ b/components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request.h
@@ -0,0 +1,55 @@ +// 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 COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_REQUESTS_GET_DETAILS_FOR_ENROLLMENT_REQUEST_H_ +#define COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_REQUESTS_GET_DETAILS_FOR_ENROLLMENT_REQUEST_H_ + +#include "components/autofill/core/browser/payments/payments_client.h" +#include "components/autofill/core/browser/payments/payments_requests/payments_request.h" + +namespace autofill::payments { + +// Payments request to fetch necessary information (i.e. ToS message) in +// preparation for the virtual card enrollment. +class GetDetailsForEnrollmentRequest : public PaymentsRequest { + public: + GetDetailsForEnrollmentRequest( + PaymentsClient::GetDetailsForEnrollmentRequestDetails request_details, + base::OnceCallback<void( + AutofillClient::PaymentsRpcResult, + PaymentsClient::GetDetailsForEnrollmentResponseDetails&)> callback); + GetDetailsForEnrollmentRequest(const GetDetailsForEnrollmentRequest&) = + delete; + GetDetailsForEnrollmentRequest& operator=( + const GetDetailsForEnrollmentRequest&) = delete; + ~GetDetailsForEnrollmentRequest() override; + + // PaymentsRequest: + std::string GetRequestUrlPath() override; + std::string GetRequestContentType() override; + std::string GetRequestContent() override; + void ParseResponse(const base::Value& response) override; + bool IsResponseComplete() override; + void RespondToDelegate(AutofillClient::PaymentsRpcResult result) override; + + private: + friend class GetDetailsForEnrollmentRequestTest; + + // Used to store information to be populated to the request. + PaymentsClient::GetDetailsForEnrollmentRequestDetails request_details_; + + // Used to store information parsed from the response. Will be passed into the + // |callback_| function as a param. + PaymentsClient::GetDetailsForEnrollmentResponseDetails response_details_; + + // The callback function to be invoked when the response is received. + base::OnceCallback<void( + AutofillClient::PaymentsRpcResult, + PaymentsClient::GetDetailsForEnrollmentResponseDetails&)> + callback_; +}; + +} // namespace autofill::payments + +#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_REQUESTS_GET_DETAILS_FOR_ENROLLMENT_REQUEST_H_
diff --git a/components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request_unittest.cc b/components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request_unittest.cc new file mode 100644 index 0000000..d364c237 --- /dev/null +++ b/components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request_unittest.cc
@@ -0,0 +1,77 @@ +// 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 <memory> + +#include "base/callback_helpers.h" +#include "base/json/json_reader.h" +#include "components/autofill/core/browser/payments/payments_requests/get_details_for_enrollment_request.h" +#include "components/autofill/core/browser/payments/virtual_card_enrollment_flow.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace autofill::payments { + +class GetDetailsForEnrollmentRequestTest : public testing::Test { + public: + GetDetailsForEnrollmentRequestTest() = default; + GetDetailsForEnrollmentRequestTest( + const GetDetailsForEnrollmentRequestTest&) = delete; + GetDetailsForEnrollmentRequestTest& operator=( + const GetDetailsForEnrollmentRequestTest&) = delete; + ~GetDetailsForEnrollmentRequestTest() override = default; + + void CreateRequest() { + PaymentsClient::GetDetailsForEnrollmentRequestDetails request_details; + request_details.instrument_id = 11223344; + request_details.app_locale = "en"; + request_details.billing_customer_number = 55667788; + request_details.risk_data = "fake risk data"; + request_details.type = VirtualCardEnrollmentSource::kUpstream; + request_ = std::make_unique<GetDetailsForEnrollmentRequest>( + request_details, base::DoNothing()); + } + + GetDetailsForEnrollmentRequest* GetRequest() const { return request_.get(); } + + const PaymentsClient::GetDetailsForEnrollmentResponseDetails& + GetParsedResponse() const { + return request_->response_details_; + } + + private: + std::unique_ptr<GetDetailsForEnrollmentRequest> request_; +}; + +TEST_F(GetDetailsForEnrollmentRequestTest, GetRequestContent) { + CreateRequest(); + EXPECT_EQ(GetRequest()->GetRequestUrlPath(), + "payments/apis/virtualcardservice/getdetailsforenroll"); + EXPECT_TRUE(!GetRequest()->GetRequestContent().empty()); + EXPECT_TRUE(GetRequest()->GetRequestContent().find("language_code") != + std::string::npos); + EXPECT_TRUE(GetRequest()->GetRequestContent().find("billable_service") != + std::string::npos); + EXPECT_TRUE(GetRequest()->GetRequestContent().find("external_customer_id") != + std::string::npos); + EXPECT_TRUE(GetRequest()->GetRequestContent().find("instrument_id") != + std::string::npos); + EXPECT_TRUE(GetRequest()->GetRequestContent().find("risk_data_encoded") != + std::string::npos); +} + +TEST_F(GetDetailsForEnrollmentRequestTest, ParseResponse) { + CreateRequest(); + absl::optional<base::Value> response = base::JSONReader::Read( + "{ \"google_legal_message\": {}, \"external_legal_message\": {}, " + "\"context_token\": \"some_token\" }"); + ASSERT_TRUE(response.has_value()); + GetRequest()->ParseResponse(response.value()); + + EXPECT_EQ(GetParsedResponse().vcn_context_token, "some_token"); + EXPECT_TRUE(GetParsedResponse().issuer_legal_message.empty()); + EXPECT_TRUE(GetParsedResponse().google_legal_message.empty()); + EXPECT_FALSE(GetRequest()->IsResponseComplete()); +} + +} // namespace autofill::payments
diff --git a/components/autofill/core/browser/payments/virtual_card_enrollment_manager.cc b/components/autofill/core/browser/payments/virtual_card_enrollment_manager.cc index c381427c..dab48c25 100644 --- a/components/autofill/core/browser/payments/virtual_card_enrollment_manager.cc +++ b/components/autofill/core/browser/payments/virtual_card_enrollment_manager.cc
@@ -37,7 +37,7 @@ std::unique_ptr<VirtualCardEnrollmentProcessState> state, AutofillClient::PaymentsRpcResult result, payments::PaymentsClient::GetDetailsForEnrollmentResponseDetails - get_details_for_enrollment_response_fields) {} + get_details_for_enrollment_response_details) {} void VirtualCardEnrollmentManager::ShowVirtualCardEnrollmentBubble( std::unique_ptr<VirtualCardEnrollmentProcessState> state) {}
diff --git a/components/autofill/core/browser/payments/virtual_card_enrollment_manager.h b/components/autofill/core/browser/payments/virtual_card_enrollment_manager.h index 3749bba8..10df90a 100644 --- a/components/autofill/core/browser/payments/virtual_card_enrollment_manager.h +++ b/components/autofill/core/browser/payments/virtual_card_enrollment_manager.h
@@ -113,14 +113,14 @@ std::unique_ptr<VirtualCardEnrollmentProcessState> state); // Handles the response from the GetDetailsForEnrollRequest. |result| and - // |get_details_for_enrollment_response_fields| are received from the + // |get_details_for_enrollment_response_details| are received from the // GetDetailsForEnroll server call response, while |state| is passed down from // GetDetailsForEnroll() to track the current process' state. void OnDidGetDetailsForEnrollResponse( std::unique_ptr<VirtualCardEnrollmentProcessState> state, AutofillClient::PaymentsRpcResult result, const payments::PaymentsClient::GetDetailsForEnrollmentResponseDetails& - get_details_for_enrollment_response_fields); + get_details_for_enrollment_response_details); // Shows the VirtualCardEnrollmentBubble. |state|'s // |virtual_card_enrollment_fields| will contain all of the dynamic fields
diff --git a/components/browser_sync/BUILD.gn b/components/browser_sync/BUILD.gn index c92f09d..458e347b 100644 --- a/components/browser_sync/BUILD.gn +++ b/components/browser_sync/BUILD.gn
@@ -12,10 +12,10 @@ "browser_sync_client.h", "browser_sync_switches.cc", "browser_sync_switches.h", - "profile_sync_components_factory_impl.cc", - "profile_sync_components_factory_impl.h", "signin_confirmation_helper.cc", "signin_confirmation_helper.h", + "sync_api_component_factory_impl.cc", + "sync_api_component_factory_impl.h", ] public_deps = [ "//components/sync" ]
diff --git a/components/browser_sync/profile_sync_components_factory_impl.cc b/components/browser_sync/sync_api_component_factory_impl.cc similarity index 94% rename from components/browser_sync/profile_sync_components_factory_impl.cc rename to components/browser_sync/sync_api_component_factory_impl.cc index 7656bc8b..e660caa 100644 --- a/components/browser_sync/profile_sync_components_factory_impl.cc +++ b/components/browser_sync/sync_api_component_factory_impl.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/browser_sync/profile_sync_components_factory_impl.h" +#include "components/browser_sync/sync_api_component_factory_impl.h" #include <utility> @@ -124,7 +124,7 @@ } // namespace -ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl( +SyncApiComponentFactoryImpl::SyncApiComponentFactoryImpl( browser_sync::BrowserSyncClient* sync_client, version_info::Channel channel, const scoped_refptr<base::SequencedTaskRunner>& ui_thread, @@ -154,10 +154,10 @@ DCHECK(sync_client_); } -ProfileSyncComponentsFactoryImpl::~ProfileSyncComponentsFactoryImpl() = default; +SyncApiComponentFactoryImpl::~SyncApiComponentFactoryImpl() = default; syncer::DataTypeController::TypeVector -ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( +SyncApiComponentFactoryImpl::CreateCommonDataTypeControllers( syncer::ModelTypeSet disabled_types, syncer::SyncService* sync_service) { syncer::DataTypeController::TypeVector controllers; @@ -398,7 +398,7 @@ } std::unique_ptr<DataTypeManager> -ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( +SyncApiComponentFactoryImpl::CreateDataTypeManager( const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& debug_info_listener, const DataTypeController::TypeMap* controllers, @@ -411,7 +411,7 @@ } std::unique_ptr<syncer::SyncEngine> -ProfileSyncComponentsFactoryImpl::CreateSyncEngine( +SyncApiComponentFactoryImpl::CreateSyncEngine( const std::string& name, invalidation::InvalidationService* invalidator, syncer::SyncInvalidationsService* sync_invalidation_service) { @@ -428,7 +428,7 @@ base::Unretained(sync_client_))); } -void ProfileSyncComponentsFactoryImpl::ClearAllTransportData() { +void SyncApiComponentFactoryImpl::ClearAllTransportData() { syncer::SyncTransportDataPrefs sync_transport_data_prefs( sync_client_->GetPrefService()); @@ -450,20 +450,21 @@ } std::unique_ptr<syncer::ModelTypeControllerDelegate> -ProfileSyncComponentsFactoryImpl::CreateForwardingControllerDelegate( +SyncApiComponentFactoryImpl::CreateForwardingControllerDelegate( syncer::ModelType type) { return std::make_unique<syncer::ForwardingModelTypeControllerDelegate>( sync_client_->GetControllerDelegateForModelType(type).get()); } -std::unique_ptr<ModelTypeController> ProfileSyncComponentsFactoryImpl:: - CreateModelTypeControllerForModelRunningOnUIThread(syncer::ModelType type) { +std::unique_ptr<ModelTypeController> +SyncApiComponentFactoryImpl::CreateModelTypeControllerForModelRunningOnUIThread( + syncer::ModelType type) { return std::make_unique<ModelTypeController>( type, CreateForwardingControllerDelegate(type)); } std::unique_ptr<ModelTypeController> -ProfileSyncComponentsFactoryImpl::CreateWalletModelTypeController( +SyncApiComponentFactoryImpl::CreateWalletModelTypeController( syncer::ModelType type, const base::RepeatingCallback< base::WeakPtr<syncer::ModelTypeControllerDelegate>( @@ -478,13 +479,13 @@ sync_client_->GetPrefService(), sync_service); } -std::unique_ptr<ModelTypeController> ProfileSyncComponentsFactoryImpl:: - CreateWalletModelTypeControllerWithInMemorySupport( - syncer::ModelType type, - const base::RepeatingCallback< - base::WeakPtr<syncer::ModelTypeControllerDelegate>( - autofill::AutofillWebDataService*)>& delegate_from_web_data, - syncer::SyncService* sync_service) { +std::unique_ptr<ModelTypeController> +SyncApiComponentFactoryImpl::CreateWalletModelTypeControllerWithInMemorySupport( + syncer::ModelType type, + const base::RepeatingCallback< + base::WeakPtr<syncer::ModelTypeControllerDelegate>( + autofill::AutofillWebDataService*)>& delegate_from_web_data, + syncer::SyncService* sync_service) { return std::make_unique<AutofillWalletModelTypeController>( type, /*delegate_for_full_sync_mode=*/ std::make_unique<syncer::ProxyModelTypeControllerDelegate>(
diff --git a/components/browser_sync/profile_sync_components_factory_impl.h b/components/browser_sync/sync_api_component_factory_impl.h similarity index 88% rename from components/browser_sync/profile_sync_components_factory_impl.h rename to components/browser_sync/sync_api_component_factory_impl.h index 0c785d7e3..435c7032 100644 --- a/components/browser_sync/profile_sync_components_factory_impl.h +++ b/components/browser_sync/sync_api_component_factory_impl.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 COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ -#define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ +#ifndef COMPONENTS_BROWSER_SYNC_SYNC_API_COMPONENT_FACTORY_IMPL_H_ +#define COMPONENTS_BROWSER_SYNC_SYNC_API_COMPONENT_FACTORY_IMPL_H_ #include <memory> #include <string> @@ -39,11 +39,9 @@ class BrowserSyncClient; -// TODO(crbug.com/1201272): Rename to SyncApiComponentFactoryImpl. -class ProfileSyncComponentsFactoryImpl - : public syncer::SyncApiComponentFactory { +class SyncApiComponentFactoryImpl : public syncer::SyncApiComponentFactory { public: - ProfileSyncComponentsFactoryImpl( + SyncApiComponentFactoryImpl( BrowserSyncClient* sync_client, version_info::Channel channel, const scoped_refptr<base::SequencedTaskRunner>& ui_thread, @@ -57,11 +55,10 @@ const scoped_refptr<password_manager::PasswordStoreInterface>& account_password_store, sync_bookmarks::BookmarkSyncService* bookmark_sync_service); - ProfileSyncComponentsFactoryImpl(const ProfileSyncComponentsFactoryImpl&) = + SyncApiComponentFactoryImpl(const SyncApiComponentFactoryImpl&) = delete; + SyncApiComponentFactoryImpl& operator=(const SyncApiComponentFactoryImpl&) = delete; - ProfileSyncComponentsFactoryImpl& operator=( - const ProfileSyncComponentsFactoryImpl&) = delete; - ~ProfileSyncComponentsFactoryImpl() override; + ~SyncApiComponentFactoryImpl() override; // Creates and returns enabled datatypes and their controllers. // |disabled_types| allows callers to prevent certain types from being @@ -134,4 +131,4 @@ } // namespace browser_sync -#endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_IMPL_H__ +#endif // COMPONENTS_BROWSER_SYNC_SYNC_API_COMPONENT_FACTORY_IMPL_H_
diff --git a/components/browser_ui/styles/android/java/src/org/chromium/components/browser_ui/styles/ChromeColors.java b/components/browser_ui/styles/android/java/src/org/chromium/components/browser_ui/styles/ChromeColors.java index 0792dc1..6fbeb0e 100644 --- a/components/browser_ui/styles/android/java/src/org/chromium/components/browser_ui/styles/ChromeColors.java +++ b/components/browser_ui/styles/android/java/src/org/chromium/components/browser_ui/styles/ChromeColors.java
@@ -68,42 +68,39 @@ } /** - * Returns the text medium thick secondary style based on the given parameter. + * Returns the text medium thick secondary style based on the incognito state. * - * @param forceLightTextColor When true, returns the light-mode medium text secondary style; - * otherwise returns adaptive medium text secondary style. + * @param isIncognito When true, returns the baseline light medium text secondary style; + * otherwise returns adaptive medium text secondary style that can have dynamic colors. * @return The medium text secondary style. */ - public static int getTextMediumThickSecondaryStyle(boolean forceLightTextColor) { - return forceLightTextColor ? R.style.TextAppearance_TextMediumThick_Secondary_Baseline_Light - : R.style.TextAppearance_TextMediumThick_Secondary; + public static int getTextMediumThickSecondaryStyle(boolean isIncognito) { + return isIncognito ? R.style.TextAppearance_TextMediumThick_Secondary_Baseline_Light + : R.style.TextAppearance_TextMediumThick_Secondary; } /** - * Returns the primary icon tint resource to use based on the current parameters and whether - * the app is in night mode. + * Returns the primary icon tint resource to use based on the incognito state. * - * @param forceLightIconTint When true, returns the light tint color res; otherwise returns - * adaptive primary icon tint color res. + * @param isIncognito When true, returns the baseline light tint color res; otherwise returns + * the default primary icon tint list that is adaptive and can be dynamic. * @return The {@link ColorRes} for the icon tint. */ - public static @ColorRes int getPrimaryIconTintRes(boolean forceLightIconTint) { - return forceLightIconTint ? R.color.default_icon_color_light_tint_list - : R.color.default_icon_color_tint_list; + public static @ColorRes int getPrimaryIconTintRes(boolean isIncognito) { + return isIncognito ? R.color.default_icon_color_light_tint_list + : R.color.default_icon_color_tint_list; } /** - * Returns the primary icon tint to use based on the current parameters and whether the app is - * in night mode. + * Returns the primary icon tint to use based on the incognito state. * * @param context The {@link Context} used to retrieve colors. - * @param forceLightIconTint When true, returns the light tint color res; otherwise returns - * adaptive primary icon tint color res. + * @param isIncognito When true, returns the baseline light tint list; otherwise returns the + * default primary icon tint list that is adaptive and can be dynamic. * @return The {@link ColorStateList} for the icon tint. */ - public static ColorStateList getPrimaryIconTint(Context context, boolean forceLightIconTint) { - return AppCompatResources.getColorStateList( - context, getPrimaryIconTintRes(forceLightIconTint)); + public static ColorStateList getPrimaryIconTint(Context context, boolean isIncognito) { + return AppCompatResources.getColorStateList(context, getPrimaryIconTintRes(isIncognito)); } /**
diff --git a/components/certificate_transparency/data/log_list.json b/components/certificate_transparency/data/log_list.json index d5253e8..8b16080 100644 --- a/components/certificate_transparency/data/log_list.json +++ b/components/certificate_transparency/data/log_list.json
@@ -1,6 +1,6 @@ { - "version": "4.93", - "log_list_timestamp": "2022-01-18T01:34:12Z", + "version": "4.94", + "log_list_timestamp": "2022-01-19T01:34:43Z", "operators": [ { "name": "Google",
diff --git a/components/media_router/OWNERS b/components/media_router/OWNERS index 5a0f44e..916a3da5 100644 --- a/components/media_router/OWNERS +++ b/components/media_router/OWNERS
@@ -1,3 +1,4 @@ -mfoltz@chromium.org -btolsch@chromium.org -takumif@chromium.org +file://chrome/browser/media/router/OWNERS + + +
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentAppServiceBridge.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentAppServiceBridge.java index a21664b9..9e8e328 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentAppServiceBridge.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentAppServiceBridge.java
@@ -51,7 +51,7 @@ PaymentAppServiceBridgeJni.get().create(delegate.getParams().getRenderFrameHost(), delegate.getParams().getTopLevelOrigin(), delegate.getParams().getSpec(), delegate.getParams().getTwaPackageName(), delegate.getParams().getMayCrawl(), - callback); + delegate.getParams().isOffTheRecord(), callback); } /** Handles callbacks from native PaymentAppService. */ @@ -120,10 +120,13 @@ * Chrome. If not running in TWA mode, then this string is null or empty. * @param mayCrawlForInstallablePaymentApps Whether crawling for just-in-time installable * payment apps is allowed. + * @param isOffTheRecord Whether the merchant WebContent's profile is in off-the-record + * mode. * @param callback The callback that receives the discovered payment apps. */ void create(RenderFrameHost initiatorRenderFrameHost, String topOrigin, PaymentRequestSpec spec, String twaPackageName, - boolean mayCrawlForInstallablePaymentApps, PaymentAppServiceCallback callback); + boolean mayCrawlForInstallablePaymentApps, boolean isOffTheRecord, + PaymentAppServiceCallback callback); } }
diff --git a/components/payments/content/android/payment_app_service_bridge.cc b/components/payments/content/android/payment_app_service_bridge.cc index a2df0a2d..d7d7ebe 100644 --- a/components/payments/content/android/payment_app_service_bridge.cc +++ b/components/payments/content/android/payment_app_service_bridge.cc
@@ -92,6 +92,7 @@ const JavaParamRef<jobject>& jpayment_request_spec, const JavaParamRef<jstring>& jtwa_package_name, jboolean jmay_crawl_for_installable_payment_apps, + jboolean jis_off_the_record, const JavaParamRef<jobject>& jcallback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -117,6 +118,7 @@ env, jpayment_request_spec), jtwa_package_name ? ConvertJavaStringToUTF8(env, jtwa_package_name) : "", web_data_service, jmay_crawl_for_installable_payment_apps, + jis_off_the_record, base::BindOnce(&OnCanMakePaymentCalculated, ScopedJavaGlobalRef<jobject>(env, jcallback)), base::BindRepeating(&OnPaymentAppCreated, @@ -174,6 +176,7 @@ const std::string& twa_package_name, scoped_refptr<PaymentManifestWebDataService> web_data_service, bool may_crawl_for_installable_payment_apps, + bool is_off_the_record, CanMakePaymentCalculatedCallback can_make_payment_calculated_callback, PaymentAppCreatedCallback payment_app_created_callback, PaymentAppCreationErrorCallback payment_app_creation_error_callback, @@ -184,7 +187,7 @@ std::unique_ptr<PaymentAppServiceBridge> bridge(new PaymentAppServiceBridge( number_of_factories, render_frame_host, top_origin, spec, twa_package_name, std::move(web_data_service), - may_crawl_for_installable_payment_apps, + may_crawl_for_installable_payment_apps, is_off_the_record, std::move(can_make_payment_calculated_callback), std::move(payment_app_created_callback), std::move(payment_app_creation_error_callback), @@ -201,6 +204,7 @@ const std::string& twa_package_name, scoped_refptr<PaymentManifestWebDataService> web_data_service, bool may_crawl_for_installable_payment_apps, + bool is_off_the_record, CanMakePaymentCalculatedCallback can_make_payment_calculated_callback, PaymentAppCreatedCallback payment_app_created_callback, PaymentAppCreationErrorCallback payment_app_creation_error_callback, @@ -217,6 +221,7 @@ payment_manifest_web_data_service_(web_data_service), may_crawl_for_installable_payment_apps_( may_crawl_for_installable_payment_apps), + is_off_the_record_(is_off_the_record), can_make_payment_calculated_callback_( std::move(can_make_payment_calculated_callback)), payment_app_created_callback_(std::move(payment_app_created_callback)), @@ -294,9 +299,7 @@ } bool PaymentAppServiceBridge::IsOffTheRecord() const { - auto* rfh = content::RenderFrameHost::FromID(frame_routing_id_); - return rfh && rfh->GetBrowserContext() && - rfh->GetBrowserContext()->IsOffTheRecord(); + return is_off_the_record_; } const std::vector<autofill::AutofillProfile*>&
diff --git a/components/payments/content/android/payment_app_service_bridge.h b/components/payments/content/android/payment_app_service_bridge.h index 34e11b7d..8d73bb4 100644 --- a/components/payments/content/android/payment_app_service_bridge.h +++ b/components/payments/content/android/payment_app_service_bridge.h
@@ -49,6 +49,7 @@ const std::string& twa_package_name, scoped_refptr<PaymentManifestWebDataService> web_data_service, bool may_crawl_for_installable_payment_apps, + bool is_off_the_record, CanMakePaymentCalculatedCallback can_make_payment_calculated_callback, PaymentAppCreatedCallback payment_app_created_callback, PaymentAppCreationErrorCallback payment_app_creation_error_callback, @@ -105,6 +106,7 @@ const std::string& twa_package_name, scoped_refptr<PaymentManifestWebDataService> web_data_service, bool may_crawl_for_installable_payment_apps, + bool is_off_the_record, CanMakePaymentCalculatedCallback can_make_payment_calculated_callback, PaymentAppCreatedCallback payment_app_created_callback, PaymentAppCreationErrorCallback payment_app_creation_error_callback, @@ -121,6 +123,7 @@ scoped_refptr<PaymentManifestWebDataService> payment_manifest_web_data_service_; bool may_crawl_for_installable_payment_apps_; + bool is_off_the_record_; std::vector<autofill::AutofillProfile*> dummy_profiles_; CanMakePaymentCalculatedCallback can_make_payment_calculated_callback_;
diff --git a/components/performance_manager/v8_memory/v8_detailed_memory_unittest.cc b/components/performance_manager/v8_memory/v8_detailed_memory_unittest.cc index dacaf96..a3e8aa2 100644 --- a/components/performance_manager/v8_memory/v8_detailed_memory_unittest.cc +++ b/components/performance_manager/v8_memory/v8_detailed_memory_unittest.cc
@@ -1556,7 +1556,7 @@ }); } -TEST_F(V8DetailedMemoryDecoratorDeathTest, InvalidParameters) { +TEST_F(V8DetailedMemoryDecoratorDeathTest, InvalidEagerModeConfig) { // Not allowed to use kEagerForTesting mode without calling // SetEagerMemoryMeasurementEnabledForTesting. EXPECT_DCHECK_DEATH({ @@ -1567,20 +1567,27 @@ V8DetailedMemoryRequestAnySeq memory_request( kMinTimeBetweenRequests, MeasurementMode::kEagerForTesting); }); - // Zero, negative and infinite TimeDelta's are disallowed. +} + +TEST_F(V8DetailedMemoryDecoratorDeathTest, NonPositiveTimeDeltas) { + // Zero and negative. EXPECT_DCHECK_DEATH({ base::TimeDelta zero; V8DetailedMemoryRequestAnySeq memory_request(zero); }); EXPECT_DCHECK_DEATH({ + V8DetailedMemoryRequestAnySeq memory_request(kMinTimeBetweenRequests * -1); + }); +} + +TEST_F(V8DetailedMemoryDecoratorDeathTest, ExtremeTImeDeltas) { + // Infinite TimeDelta's are disallowed. + EXPECT_DCHECK_DEATH({ V8DetailedMemoryRequestAnySeq memory_request(base::TimeDelta::Min()); }); EXPECT_DCHECK_DEATH({ V8DetailedMemoryRequestAnySeq memory_request(base::TimeDelta::Max()); }); - EXPECT_DCHECK_DEATH({ - V8DetailedMemoryRequestAnySeq memory_request(kMinTimeBetweenRequests * -1); - }); } TEST_F(V8DetailedMemoryRequestAnySeqTest, RequestIsSequenceSafe) {
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index ef67b1e..79d92c6 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -21736,13 +21736,13 @@ - <ph name="OVERRIDE_APP_NAME_LABEL">custom_name</ph> (Starting with <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> - version 96, allows you to permanently override the app name for all web + version 99, allows you to permanently override the app name for all web apps and PWAs. Currently only supported on <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph>.) - <ph name="CUSTOM_ICON_LABEL">custom_icon</ph> (Starting with <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> - version 96, allows you to override the app icon of installed apps. The + version 99, allows you to override the app icon of installed apps. The icons have to be square, maximal 1 MB in size, and in one of the following formats: jpeg, png, gif, webp, ico. The hash value has to be the SHA256 hash of the icon file. Currently only supported on @@ -24237,7 +24237,6 @@ }, 'id': 696, 'supported_on': ['chrome.*:84-', 'chrome_os:84-'], - 'future': True, 'caption': '''Configuration policy for the OnFileDownloaded Chrome Enterprise Connector''', 'tags': [], 'desc': '''List of Chrome Enterprise Connectors services settings to be applied to the <ph name="ON_FILE_DOWNLOADED_ENTERPRISE_CONNECTOR">OnFileDownloaded</ph> Enterprise Connector, which triggers when a file is downloaded in Chrome. @@ -24256,7 +24255,7 @@ The <ph name="ENTERPRISE_CONNECTOR_CUSTOM_MESSAGES_FIELD">custom_messages</ph>, <ph name="ENTERPRISE_CONNECTOR_MESSAGE_FIELD">message</ph>, <ph name="ENTERPRISE_CONNECTOR_LEARN_MORE_URL_FIELD">learn_more_url</ph>, <ph name="ENTERPRISE_CONNECTOR_LANGUAGE_FIELD">language</ph> and <ph name="ENTERPRISE_CONNECTOR_TAG_FIELD">tag</ph> fields are used to configure a message to show the user when a warning is shown after a scan had a non-clean verdict. The message field contains the text to show the user and should have at most 200 characters. The learn_more_url field contains an admin-provided URL that will be clickable by the user to get more customer-provided information about why the action was blocked. The language field is optional and contains the language of the message. An empty language field or a value of 'default' indicates a message to be used when the user's language doesn't have a message. The tag field specifies for which type of scans the message is displayed. The custom_messages list can have zero or more entries, where each entry is required to have non-empty message and tag fields. - This policy can only be set from the <ph name="GOOGLE_ADMIN_CONSOLE_PRODUCT_NAME">Google Admin console</ph>.''' + This policy requires additional setup to take effect, please visit https://support.google.com/chrome/a?p=chrome_enterprise_connector_policies_setting for more information.''' }, { 'name': 'OnFileAttachedEnterpriseConnector', @@ -24372,7 +24371,6 @@ }, 'id': 693, 'supported_on': ['chrome.*:84-', 'chrome_os:84-'], - 'future': True, 'caption': '''Configuration policy for the OnFileAttached Chrome Enterprise Connector''', 'tags': [], 'desc': '''List of Chrome Enterprise Connectors services settings to be applied to the <ph name="ON_FILE_ATTACHED_ENTERPRISE_CONNECTOR">OnFileAttached</ph> Enterprise Connector, which triggers when a file is attached to Chrome. @@ -24391,7 +24389,7 @@ The <ph name="ENTERPRISE_CONNECTOR_CUSTOM_MESSAGES_FIELD">custom_messages</ph>, <ph name="ENTERPRISE_CONNECTOR_MESSAGE_FIELD">message</ph>, <ph name="ENTERPRISE_CONNECTOR_LEARN_MORE_URL_FIELD">learn_more_url</ph>, <ph name="ENTERPRISE_CONNECTOR_LANGUAGE_FIELD">language</ph> and <ph name="ENTERPRISE_CONNECTOR_TAG_FIELD">tag</ph> fields are used to configure a message to show the user when a warning is shown after a scan had a non-clean verdict. The message field contains the text to show the user and should have at most 200 characters. The learn_more_url field contains an admin-provided URL that will be clickable by the user to get more customer-provided information about why the action was blocked. The language field is optional and contains the language of the message. An empty language field or a value of 'default' indicates a message to be used when the user's language doesn't have a message. The tag field specifies for which type of scans the message is displayed. The custom_messages list can have zero or more entries, where each entry is required to have non-empty message and tag fields. - This policy can only be set from the <ph name="GOOGLE_ADMIN_CONSOLE_PRODUCT_NAME">Google Admin console</ph>.''' + This policy requires additional setup to take effect, please visit https://support.google.com/chrome/a?p=chrome_enterprise_connector_policies_setting for more information.''' }, { 'name': 'OnBulkDataEntryEnterpriseConnector', @@ -24505,7 +24503,6 @@ }, 'id': 697, 'supported_on': ['chrome.*:84-', 'chrome_os:84-'], - 'future': True, 'caption': '''Configuration policy for the OnBulkDataEntry Chrome Enterprise Connector''', 'tags': [], 'desc': '''List of Chrome Enterprise Connectors services settings to be applied to the <ph name="ON_BULK_DATA_ENTRY_ENTERPRISE_CONNECTOR">OnBulkDataEntry</ph> Enterprise Connector, which triggers when data is entered in Chrome from the clipboard or by drag and dropping web content. @@ -24522,7 +24519,7 @@ The <ph name="ENTERPRISE_CONNECTOR_CUSTOM_MESSAGES_FIELD">custom_messages</ph>, <ph name="ENTERPRISE_CONNECTOR_MESSAGE_FIELD">message</ph>, <ph name="ENTERPRISE_CONNECTOR_LEARN_MORE_URL_FIELD">learn_more_url</ph>, <ph name="ENTERPRISE_CONNECTOR_LANGUAGE_FIELD">language</ph> and <ph name="ENTERPRISE_CONNECTOR_TAG_FIELD">tag</ph> fields are used to configure a message to show the user when a warning is shown after a scan had a non-clean verdict. The message field contains the text to show the user and should have at most 200 characters. The learn_more_url field contains an admin-provided URL that will be clickable by the user to get more customer-provided information about why the action was blocked. The language field is optional and contains the language of the message. An empty language field or a value of 'default' indicates a message to be used when the user's language doesn't have a message. The tag field specifies for which type of scans the message is displayed. The custom_messages list can have zero or more entries, where each entry is required to have non-empty message and tag fields. - This policy can only be set from the <ph name="GOOGLE_ADMIN_CONSOLE_PRODUCT_NAME">Google Admin console</ph>.''' + This policy requires additional setup to take effect, please visit https://support.google.com/chrome/a?p=chrome_enterprise_connector_policies_setting for more information.''' }, { 'name': 'OnPrintEnterpriseConnector', @@ -24642,7 +24639,7 @@ The <ph name="ENTERPRISE_CONNECTOR_CUSTOM_MESSAGES_FIELD">custom_messages</ph>, <ph name="ENTERPRISE_CONNECTOR_MESSAGE_FIELD">message</ph>, <ph name="ENTERPRISE_CONNECTOR_LEARN_MORE_URL_FIELD">learn_more_url</ph>, <ph name="ENTERPRISE_CONNECTOR_LANGUAGE_FIELD">language</ph> and <ph name="ENTERPRISE_CONNECTOR_TAG_FIELD">tag</ph> fields are used to configure a message to show the user when a warning is shown after a scan had a non-clean verdict. The administrator is able to configure messages of up to 200 characters. - This policy can only be set from the <ph name="GOOGLE_ADMIN_CONSOLE_PRODUCT_NAME">Google Admin console</ph>.''' + This policy requires additional setup to take effect, please visit https://support.google.com/chrome/a?p=chrome_enterprise_connector_policies_setting for more information.''' }, { 'name': 'OnSecurityEventEnterpriseConnector', @@ -24672,14 +24669,13 @@ }, 'id': 699, 'supported_on': ['chrome.*:84-', 'chrome_os:84-'], - 'future': True, 'caption': '''Configuration policy for the OnSecurityEvent Chrome Enterprise Connector''', 'tags': [], 'desc': '''List of Chrome Enterprise Connectors services settings to be applied to the <ph name="ON_SECURITY_EVENT_ENTERPRISE_CONNECTOR">OnSecurityEvent</ph> Enterprise Connector, which triggers when a security event occurs in Chrome. This includes negative verdicts from analysis Enterprise Connectors, password reuse, navigations to unsafe pages and other security sensitive user actions. The <ph name="ENTERPRISE_CONNECTOR_SERVICE_PROVIDER_FIELD">service_provider</ph> field identifies which reporting service provider the settings correspond to and the <ph name="ENTERPRISE_CONNECTOR_ENABLED_EVENT_NAMES_FIELD">enabled_event_names</ph> field identifies which events are enabled for this provider. - This policy can only be set from the <ph name="GOOGLE_ADMIN_CONSOLE_PRODUCT_NAME">Google Admin console</ph>.''' + This policy requires additional setup to take effect, please visit https://support.google.com/chrome/a?p=chrome_enterprise_connector_policies_setting for more information.''' }, { 'name': 'EnterpriseRealTimeUrlCheckMode', @@ -24721,7 +24717,7 @@ If this policy is set to ‘Enabled’, URLs will be sent to be scanned in real time under enterprise ToS. It will result in Chrome sending URLs to Google Cloud or third parties of your choosing to check them in real time. The consumer version of Safe Browsing real time lookup will be switched off. - This policy can only be set from the <ph name="GOOGLE_ADMIN_CONSOLE_PRODUCT_NAME">Google Admin console</ph>.''' + This policy requires additional setup to take effect, please visit https://support.google.com/chrome/a?p=chrome_enterprise_connector_policies_setting for more information.''' }, { 'name': 'RendererCodeIntegrityEnabled',
diff --git a/components/reporting/metrics/metric_event_observer_manager.h b/components/reporting/metrics/metric_event_observer_manager.h index 6bc2810d..e11b9a1 100644 --- a/components/reporting/metrics/metric_event_observer_manager.h +++ b/components/reporting/metrics/metric_event_observer_manager.h
@@ -39,7 +39,7 @@ MetricEventObserverManager& operator=( const MetricEventObserverManager& other) = delete; - ~MetricEventObserverManager(); + virtual ~MetricEventObserverManager(); private: void SetReportingEnabled(bool is_enabled);
diff --git a/components/segmentation_platform/internal/database/metadata_utils.cc b/components/segmentation_platform/internal/database/metadata_utils.cc index c9afcd1..07b4e1f 100644 --- a/components/segmentation_platform/internal/database/metadata_utils.cc +++ b/components/segmentation_platform/internal/database/metadata_utils.cc
@@ -90,6 +90,11 @@ ValidationResult ValidateMetadata( const proto::SegmentationModelMetadata& model_metadata) { + if (proto::CurrentVersion::METADATA_VERSION < + model_metadata.version_info().metadata_min_version()) { + return ValidationResult::kVersionNotSupported; + } + if (model_metadata.time_unit() == proto::TimeUnit::UNKNOWN_TIME_UNIT) return ValidationResult::kTimeUnitInvald;
diff --git a/components/segmentation_platform/internal/database/metadata_utils.h b/components/segmentation_platform/internal/database/metadata_utils.h index 537c3c1..c4aa05e 100644 --- a/components/segmentation_platform/internal/database/metadata_utils.h +++ b/components/segmentation_platform/internal/database/metadata_utils.h
@@ -31,7 +31,8 @@ kFeatureAggregationNotFound = 7, kFeatureTensorLengthInvalid = 8, kFeatureNameHashDoesNotMatchName = 9, - kMaxValue = kFeatureNameHashDoesNotMatchName, + kVersionNotSupported = 10, + kMaxValue = kVersionNotSupported, }; // Whether the given SegmentInfo and its metadata is valid to be used for the
diff --git a/components/segmentation_platform/internal/database/metadata_utils_unittest.cc b/components/segmentation_platform/internal/database/metadata_utils_unittest.cc index 4780296..942ddda 100644 --- a/components/segmentation_platform/internal/database/metadata_utils_unittest.cc +++ b/components/segmentation_platform/internal/database/metadata_utils_unittest.cc
@@ -71,6 +71,12 @@ metadata.set_time_unit(proto::DAY); EXPECT_EQ(metadata_utils::ValidationResult::kValidationSuccess, metadata_utils::ValidateMetadata(metadata)); + + proto::VersionInfo* version_info = metadata.mutable_version_info(); + version_info->set_metadata_min_version( + proto::CurrentVersion::METADATA_VERSION + 1); + EXPECT_EQ(metadata_utils::ValidationResult::kVersionNotSupported, + metadata_utils::ValidateMetadata(metadata)); } TEST_F(MetadataUtilsTest, MetadataFeatureValidation) {
diff --git a/components/segmentation_platform/internal/execution/model_execution_manager_factory.cc b/components/segmentation_platform/internal/execution/model_execution_manager_factory.cc index d6d8e28a..a4329dd 100644 --- a/components/segmentation_platform/internal/execution/model_execution_manager_factory.cc +++ b/components/segmentation_platform/internal/execution/model_execution_manager_factory.cc
@@ -35,6 +35,11 @@ class SignalDatabase; #if BUILDFLAG(BUILD_WITH_TFLITE_LIB) + +const char kSegmentationModelMetadataTypeUrl[] = + "type.googleapis.com/" + "google.internal.chrome.optimizationguide.v1.SegmentationModelMetadata"; + // CreateModelHandler makes it possible to pass in any creator of the // SegmentationModelHandler, which makes it possible to create mock versions. std::unique_ptr<SegmentationModelHandler> CreateModelHandler( @@ -43,9 +48,18 @@ optimization_guide::proto::OptimizationTarget optimization_target, const SegmentationModelHandler::ModelUpdatedCallback& model_updated_callback) { + // Preparing the version data to be sent to server along with the request to + // download the model. + optimization_guide::proto::Any any_metadata; + any_metadata.set_type_url(kSegmentationModelMetadataTypeUrl); + proto::SegmentationModelMetadata model_metadata; + proto::VersionInfo* version_info = model_metadata.mutable_version_info(); + version_info->set_metadata_cur_version( + proto::CurrentVersion::METADATA_VERSION); + model_metadata.SerializeToString(any_metadata.mutable_value()); return std::make_unique<SegmentationModelHandler>( model_provider, background_task_runner, optimization_target, - model_updated_callback); + model_updated_callback, std::move(any_metadata)); } #endif // BUILDFLAG(BUILD_WITH_TFLITE_LIB)
diff --git a/components/segmentation_platform/internal/execution/model_execution_manager_impl_unittest.cc b/components/segmentation_platform/internal/execution/model_execution_manager_impl_unittest.cc index c1ebaf0..b364dcd 100644 --- a/components/segmentation_platform/internal/execution/model_execution_manager_impl_unittest.cc +++ b/components/segmentation_platform/internal/execution/model_execution_manager_impl_unittest.cc
@@ -89,7 +89,8 @@ : SegmentationModelHandler(model_provider, background_task_runner, optimization_target, - model_updated_callback) {} + model_updated_callback, + absl::nullopt) {} MOCK_METHOD(void, ExecuteModelWithInput,
diff --git a/components/segmentation_platform/internal/execution/segmentation_model_executor_unittest.cc b/components/segmentation_platform/internal/execution/segmentation_model_executor_unittest.cc index a7aa8f2..2276510a 100644 --- a/components/segmentation_platform/internal/execution/segmentation_model_executor_unittest.cc +++ b/components/segmentation_platform/internal/execution/segmentation_model_executor_unittest.cc
@@ -73,7 +73,7 @@ model_executor_handle_ = std::make_unique<SegmentationModelHandler>( optimization_guide_model_provider_.get(), task_environment_.GetMainThreadTaskRunner(), kOptimizationTarget, - callback); + callback, absl::nullopt); } void ResetModelExecutor() {
diff --git a/components/segmentation_platform/internal/execution/segmentation_model_handler.cc b/components/segmentation_platform/internal/execution/segmentation_model_handler.cc index 42d59a49..23a1e0d 100644 --- a/components/segmentation_platform/internal/execution/segmentation_model_handler.cc +++ b/components/segmentation_platform/internal/execution/segmentation_model_handler.cc
@@ -20,13 +20,14 @@ optimization_guide::OptimizationGuideModelProvider* model_provider, scoped_refptr<base::SequencedTaskRunner> background_task_runner, optimization_guide::proto::OptimizationTarget optimization_target, - const ModelUpdatedCallback& model_updated_callback) + const ModelUpdatedCallback& model_updated_callback, + absl::optional<optimization_guide::proto::Any>&& model_metadata) : optimization_guide::ModelHandler<float, const std::vector<float>&>( model_provider, background_task_runner, std::make_unique<SegmentationModelExecutor>(), optimization_target, - /*model_metadata=*/absl::nullopt), + model_metadata), model_updated_callback_(model_updated_callback) { stats::RecordModelAvailability( optimization_target,
diff --git a/components/segmentation_platform/internal/execution/segmentation_model_handler.h b/components/segmentation_platform/internal/execution/segmentation_model_handler.h index 27dc660..725ca861 100644 --- a/components/segmentation_platform/internal/execution/segmentation_model_handler.h +++ b/components/segmentation_platform/internal/execution/segmentation_model_handler.h
@@ -37,7 +37,9 @@ optimization_guide::OptimizationGuideModelProvider* model_provider, scoped_refptr<base::SequencedTaskRunner> background_task_runner, optimization_guide::proto::OptimizationTarget optimization_target, - const ModelUpdatedCallback& model_updated_callback); + const ModelUpdatedCallback& model_updated_callback, + absl::optional<optimization_guide::proto::Any>&& model_metadata); + ~SegmentationModelHandler() override; // Disallow copy/assign.
diff --git a/components/segmentation_platform/internal/proto/PRESUBMIT.py b/components/segmentation_platform/internal/proto/PRESUBMIT.py new file mode 100644 index 0000000..e4183d8 --- /dev/null +++ b/components/segmentation_platform/internal/proto/PRESUBMIT.py
@@ -0,0 +1,30 @@ +# 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. + +""" +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details on the presubmit API built into depot_tools. +""" + +USE_PYTHON3 = True + +def CheckChange(input_api, output_api): + cwd = input_api.PresubmitLocalPath() + for f in input_api.AffectedFiles(): + p = f.AbsoluteLocalPath() + + # Only do PRESUBMIT checks when |p| is under |cwd| and is a proto file. + if input_api.os_path.commonprefix([p, cwd]) == cwd \ + and p.endswith('.proto'): + return [output_api.PresubmitPromptWarning( + 'Segmentation platform proto files were updated, consider ' + + 'updating the VERSION field in components/' + + 'segmentation_platform/internal/proto/model_metadata.proto.')] + return [] + +def CheckChangeOnUpload(input_api, output_api): + return CheckChange(input_api, output_api) + +def CheckChangeOnCommit(input_api, output_api): + return CheckChange(input_api, output_api)
diff --git a/components/segmentation_platform/internal/proto/model_metadata.proto b/components/segmentation_platform/internal/proto/model_metadata.proto index 1eb33de..252f8a1 100644 --- a/components/segmentation_platform/internal/proto/model_metadata.proto +++ b/components/segmentation_platform/internal/proto/model_metadata.proto
@@ -10,6 +10,27 @@ import "components/segmentation_platform/internal/proto/aggregation.proto"; import "components/segmentation_platform/internal/proto/types.proto"; +// The version is used to verify if the metadata provided by the server is +// supported in current version of the code. Update the version number for any +// new feature added to metadata proto, and add a log of the new changes in the +// current version in this file. +// Version 0 supports UMA features and aggregation in |features| field. +// Version 1 supports UMA features and custom inputs in |input_features| field. +enum CurrentVersion { METADATA_VERSION = 0; } + +// Version information for segmentation models. +message VersionInfo { + // Minimum model metadata version that is supported. Some newer + // features/fields might not be available before this version. This field is + // set on the server and read by the client to verify if model is valid. + optional int32 metadata_min_version = 1; + + // Current model metadata version. This field is set by the client while + // sending a model download request to optimization guide server so that the + // server knows the capabilities of the client. + optional int32 metadata_cur_version = 2; +} + // Used as time unit for rest of this proto. enum TimeUnit { UNKNOWN_TIME_UNIT = 0; @@ -54,6 +75,9 @@ // Metadata about a segmentation model for a given segment. Contains information // on how to use the model such as collecting signals, interpreting results etc. message SegmentationModelMetadata { + // The version information needed to validate segmentation models. + optional VersionInfo version_info = 9; + // An ordered list of required features. repeated Feature features = 1;
diff --git a/components/services/quarantine/OWNERS b/components/services/quarantine/OWNERS index 15eb1078..2a42cbe 100644 --- a/components/services/quarantine/OWNERS +++ b/components/services/quarantine/OWNERS
@@ -1,2 +1 @@ -asanka@chromium.org wfh@chromium.org
diff --git a/components/sessions/BUILD.gn b/components/sessions/BUILD.gn index 0c19868..e50ea80 100644 --- a/components/sessions/BUILD.gn +++ b/components/sessions/BUILD.gn
@@ -2,8 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//extensions/buildflags/buildflags.gni") - if (is_android) { import("//build/config/android/config.gni") } @@ -44,14 +42,9 @@ "//base", "//base/third_party/dynamic_annotations", "//content/public/common", - "//extensions/buildflags", "//ui/base", "//url", ] - - if (enable_extensions) { - deps += [ "//extensions/common" ] - } } } else { source_set("sessions") {
diff --git a/components/sessions/content/DEPS b/components/sessions/content/DEPS index 89bf3d5..92e83a8f 100644 --- a/components/sessions/content/DEPS +++ b/components/sessions/content/DEPS
@@ -2,11 +2,9 @@ "+content/public/browser", "+content/public/common", "+content/public/test", - "+extensions/buildflags", - "+extensions/common", "+third_party/blink/public/common/page_state/page_state.h", "+third_party/blink/public/common/user_agent/user_agent_metadata.h", "+third_party/blink/public/platform", "+services/network/public/mojom/referrer_policy.mojom.h", "+services/network/public/cpp/shared_url_loader_factory.h", -] \ No newline at end of file +]
diff --git a/components/sessions/content/session_tab_helper.cc b/components/sessions/content/session_tab_helper.cc index a1ad793..a393a073 100644 --- a/components/sessions/content/session_tab_helper.cc +++ b/components/sessions/content/session_tab_helper.cc
@@ -11,11 +11,6 @@ #include "components/sessions/core/serialized_user_agent_override.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/web_contents.h" -#include "extensions/buildflags/buildflags.h" - -#if BUILDFLAG(ENABLE_EXTENSIONS) -#include "extensions/common/extension_messages.h" -#endif namespace sessions { @@ -31,13 +26,7 @@ void SessionTabHelper::SetWindowID(const SessionID& id) { window_id_ = id; - -#if BUILDFLAG(ENABLE_EXTENSIONS) - // Extension code in the renderer holds the ID of the window that hosts it. - // Notify it that the window ID changed. - web_contents()->SendToAllFrames( - new ExtensionMsg_UpdateBrowserWindowId(MSG_ROUTING_NONE, id.id())); -#endif + window_id_changed_callbacks_.Notify(id); } // static @@ -57,6 +46,11 @@ : SessionID::InvalidValue(); } +base::CallbackListSubscription SessionTabHelper::RegisterForWindowIdChanged( + WindowIdChangedCallbackList::CallbackType callback) { + return window_id_changed_callbacks_.Add(std::move(callback)); +} + void SessionTabHelper::UserAgentOverrideSet( const blink::UserAgentOverride& ua_override) { SessionTabHelperDelegate* delegate = GetDelegate();
diff --git a/components/sessions/content/session_tab_helper.h b/components/sessions/content/session_tab_helper.h index ca14a1b..1a68abd 100644 --- a/components/sessions/content/session_tab_helper.h +++ b/components/sessions/content/session_tab_helper.h
@@ -6,6 +6,7 @@ #define COMPONENTS_SESSIONS_CONTENT_SESSION_TAB_HELPER_H_ #include "base/callback.h" +#include "base/callback_list.h" #include "components/sessions/core/session_id.h" #include "components/sessions/core/sessions_export.h" #include "content/public/browser/web_contents_observer.h" @@ -22,6 +23,8 @@ public: using DelegateLookup = base::RepeatingCallback<SessionTabHelperDelegate*(content::WebContents*)>; + using WindowIdChangedCallbackList = + base::RepeatingCallbackList<void(const SessionID& id)>; SessionTabHelper(const SessionTabHelper&) = delete; SessionTabHelper& operator=(const SessionTabHelper&) = delete; @@ -53,6 +56,9 @@ // WebContents has no SessionTabHelper. static SessionID IdForWindowContainingTab(const content::WebContents* tab); + base::CallbackListSubscription RegisterForWindowIdChanged( + WindowIdChangedCallbackList::CallbackType callback); + // content::WebContentsObserver: void UserAgentOverrideSet( const blink::UserAgentOverride& ua_override) override; @@ -70,6 +76,8 @@ sessions::SessionTabHelperDelegate* GetDelegate(); + WindowIdChangedCallbackList window_id_changed_callbacks_; + DelegateLookup delegate_lookup_; // Unique identifier of the tab for session restore. This id is only unique
diff --git a/components/shared_highlighting/ios/BUILD.gn b/components/shared_highlighting/ios/BUILD.gn new file mode 100644 index 0000000..db903449 --- /dev/null +++ b/components/shared_highlighting/ios/BUILD.gn
@@ -0,0 +1,30 @@ +# 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. + +source_set("ios") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "parsing_utils.h", + "parsing_utils.mm", + ] + + deps = [ + "//base", + "//ios/web/public", + "//ios/web/public/ui", + "//url", + ] +} + +source_set("unit_tests") { + configs += [ "//build/config/compiler:enable_arc" ] + testonly = true + sources = [ "parsing_utils_unittest.mm" ] + deps = [ + ":ios", + "//base/test:test_support", + "//testing/gtest", + "//url", + ] +}
diff --git a/components/shared_highlighting/ios/DEPS b/components/shared_highlighting/ios/DEPS new file mode 100644 index 0000000..0fc0ddd --- /dev/null +++ b/components/shared_highlighting/ios/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+ios/web/public", +]
diff --git a/components/shared_highlighting/ios/parsing_utils.h b/components/shared_highlighting/ios/parsing_utils.h new file mode 100644 index 0000000..f8457b5 --- /dev/null +++ b/components/shared_highlighting/ios/parsing_utils.h
@@ -0,0 +1,43 @@ +// 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 COMPONENTS_SHARED_HIGHLIGHTING_IOS_PARSING_UTILS_H_ +#define COMPONENTS_SHARED_HIGHLIGHTING_IOS_PARSING_UTILS_H_ + +#import <string> + +#import <CoreGraphics/CoreGraphics.h> + +#import "third_party/abseil-cpp/absl/types/optional.h" +#import "url/gurl.h" + +namespace base { +class Value; +} // namespace base + +namespace web { +class WebState; +} // namespace web + +namespace shared_highlighting { + +// Returns whether |value| is a dictionary value, and is not empty. +BOOL IsValidDictValue(const base::Value* value); + +// Attempts to parse the given |value| into a CGRect. If |value| does not map +// into the expected structure, an empty absl::optional instance will be +// returned. +absl::optional<CGRect> ParseRect(const base::Value* value); + +// Attempts to parse the given |url_value| into a GURL instance. If |url_value| +// is empty or invalid, an empty absl::optional instance will be returned. +absl::optional<GURL> ParseURL(const std::string* url_value); + +// Converts a given |web_view_rect| into its browser coordinates counterpart. +// Uses the given |web_state| to do the conversion. +CGRect ConvertToBrowserRect(CGRect web_view_rect, web::WebState* web_state); + +} // namespace shared_highlighting + +#endif // COMPONENTS_SHARED_HIGHLIGHTING_IOS_PARSING_UTILS_H_
diff --git a/components/shared_highlighting/ios/parsing_utils.mm b/components/shared_highlighting/ios/parsing_utils.mm new file mode 100644 index 0000000..77ebb67e --- /dev/null +++ b/components/shared_highlighting/ios/parsing_utils.mm
@@ -0,0 +1,76 @@ +// 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. + +#import "components/shared_highlighting/ios/parsing_utils.h" + +#import "base/values.h" +#import "ios/web/public/ui/crw_web_view_proxy.h" +#import "ios/web/public/ui/crw_web_view_scroll_view_proxy.h" +#import "ios/web/public/web_state.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { +const CGFloat kCaretWidth = 4.0; +} // namespace + +namespace shared_highlighting { + +BOOL IsValidDictValue(const base::Value* value) { + return value && value->is_dict() && !value->DictEmpty(); +} + +absl::optional<CGRect> ParseRect(const base::Value* value) { + if (!IsValidDictValue(value)) { + return absl::nullopt; + } + + const base::Value* xValue = + value->FindKeyOfType("x", base::Value::Type::DOUBLE); + const base::Value* yValue = + value->FindKeyOfType("y", base::Value::Type::DOUBLE); + const base::Value* widthValue = + value->FindKeyOfType("width", base::Value::Type::DOUBLE); + const base::Value* heightValue = + value->FindKeyOfType("height", base::Value::Type::DOUBLE); + + if (!xValue || !yValue || !widthValue || !heightValue) { + return absl::nullopt; + } + + return CGRectMake(xValue->GetDouble(), yValue->GetDouble(), + widthValue->GetDouble(), heightValue->GetDouble()); +} + +absl::optional<GURL> ParseURL(const std::string* url_value) { + if (!url_value) { + return absl::nullopt; + } + + GURL url(*url_value); + if (!url.is_empty() && url.is_valid()) { + return url; + } + + return absl::nullopt; +} + +CGRect ConvertToBrowserRect(CGRect web_view_rect, web::WebState* web_state) { + if (CGRectEqualToRect(web_view_rect, CGRectZero) || !web_state) { + return web_view_rect; + } + + id<CRWWebViewProxy> web_view_proxy = web_state->GetWebViewProxy(); + CGFloat zoom_scale = web_view_proxy.scrollViewProxy.zoomScale; + UIEdgeInsets inset = web_view_proxy.scrollViewProxy.contentInset; + + return CGRectMake((web_view_rect.origin.x * zoom_scale) + inset.left, + (web_view_rect.origin.y * zoom_scale) + inset.top, + (web_view_rect.size.width * zoom_scale) + kCaretWidth, + web_view_rect.size.height * zoom_scale); +} + +} // namespace shared_highlighting
diff --git a/components/shared_highlighting/ios/parsing_utils_unittest.mm b/components/shared_highlighting/ios/parsing_utils_unittest.mm new file mode 100644 index 0000000..7e05816 --- /dev/null +++ b/components/shared_highlighting/ios/parsing_utils_unittest.mm
@@ -0,0 +1,74 @@ +// 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. + +#import "components/shared_highlighting/ios/parsing_utils.h" + +#import <CoreGraphics/CoreGraphics.h> + +#import "base/values.h" +#import "testing/gtest/include/gtest/gtest.h" +#import "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +typedef PlatformTest ParsingUtilsTest; + +namespace shared_highlighting { + +// Tests the ParseRect utility function. +TEST_F(ParsingUtilsTest, ParseRect) { + CGRect expected_rect = CGRectMake(1, 2, 3, 4); + base::Value rect_value = base::Value(base::Value::Type::DICTIONARY); + rect_value.SetDoubleKey("x", expected_rect.origin.x); + rect_value.SetDoubleKey("y", expected_rect.origin.y); + rect_value.SetDoubleKey("width", expected_rect.size.width); + rect_value.SetDoubleKey("height", expected_rect.size.height); + + absl::optional<CGRect> opt_rect = ParseRect(&rect_value); + ASSERT_TRUE(opt_rect.has_value()); + EXPECT_TRUE(CGRectEqualToRect(expected_rect, opt_rect.value())); + + // Invalid values. + EXPECT_FALSE(ParseRect(nil).has_value()); + base::Value string_value = base::Value(base::Value::Type::STRING); + EXPECT_FALSE(ParseRect(&string_value).has_value()); + base::Value empty_dict_value = base::Value(base::Value::Type::DICTIONARY); + EXPECT_FALSE(ParseRect(&empty_dict_value).has_value()); + + base::Value copied_value = rect_value.Clone(); + copied_value.RemoveKey("x"); + EXPECT_FALSE(ParseRect(&copied_value).has_value()); + + copied_value = rect_value.Clone(); + copied_value.RemoveKey("y"); + EXPECT_FALSE(ParseRect(&copied_value).has_value()); + + copied_value = rect_value.Clone(); + copied_value.RemoveKey("width"); + EXPECT_FALSE(ParseRect(&copied_value).has_value()); + + copied_value = rect_value.Clone(); + copied_value.RemoveKey("height"); + EXPECT_FALSE(ParseRect(&copied_value).has_value()); +} + +// Tests for the ParseURL utility function. +TEST_F(ParsingUtilsTest, ParseURL) { + EXPECT_FALSE(ParseURL(nil).has_value()); + + std::string empty_str = ""; + EXPECT_FALSE(ParseURL(&empty_str).has_value()); + + std::string invalid_url_str = "abcd"; + EXPECT_FALSE(ParseURL(&invalid_url_str).has_value()); + + std::string valid_url_str = "https://www.example.com/"; + absl::optional<GURL> valid_url = ParseURL(&valid_url_str); + EXPECT_TRUE(valid_url.has_value()); + EXPECT_EQ(GURL(valid_url_str).spec(), valid_url.value().spec()); +} + +} // namespace shared_highlighting
diff --git a/components/sync/base/model_type.cc b/components/sync/base/model_type.cc index c434931..eb679699 100644 --- a/components/sync/base/model_type.cc +++ b/components/sync/base/model_type.cc
@@ -445,13 +445,6 @@ return std::make_unique<base::Value>(ModelTypeToDebugString(model_type)); } -ModelType ModelTypeFromDebugString(const std::string& model_type_string) { - auto* iter = base::ranges::find( - kModelTypeInfoMap, model_type_string, - [](const ModelTypeInfo& info) { return info.model_type_debug_string; }); - return iter != std::end(kModelTypeInfoMap) ? iter->model_type : UNSPECIFIED; -} - std::string ModelTypeSetToDebugString(ModelTypeSet model_types) { std::string result; for (ModelType type : model_types) { @@ -467,31 +460,6 @@ return out << ModelTypeSetToDebugString(model_type_set); } -ModelTypeSet ModelTypeSetFromDebugString( - const std::string& model_types_string) { - std::string working_copy = model_types_string; - ModelTypeSet model_types; - while (!working_copy.empty()) { - // Remove any leading spaces. - working_copy = working_copy.substr(working_copy.find_first_not_of(' ')); - if (working_copy.empty()) - break; - std::string type_str; - size_t end = working_copy.find(','); - if (end == std::string::npos) { - end = working_copy.length() - 1; - type_str = working_copy; - } else { - type_str = working_copy.substr(0, end); - } - ModelType type = ModelTypeFromDebugString(type_str); - if (IsRealDataType(type)) - model_types.Put(type); - working_copy = working_copy.substr(end + 1); - } - return model_types; -} - std::unique_ptr<base::ListValue> ModelTypeSetToValue(ModelTypeSet model_types) { std::unique_ptr<base::ListValue> value(new base::ListValue()); for (ModelType type : model_types) {
diff --git a/components/sync/base/model_type.h b/components/sync/base/model_type.h index a2855bd..3cd09c20 100644 --- a/components/sync/base/model_type.h +++ b/components/sync/base/model_type.h
@@ -382,18 +382,12 @@ // Handles all model types, and not just real ones. std::unique_ptr<base::Value> ModelTypeToValue(ModelType model_type); -// Returns the ModelType corresponding to the name |model_type_string|. -ModelType ModelTypeFromDebugString(const std::string& model_type_string); - // Returns the comma-separated string representation of |model_types|. std::string ModelTypeSetToDebugString(ModelTypeSet model_types); // Necessary for compatibility with EXPECT_EQ and the like. std::ostream& operator<<(std::ostream& out, ModelTypeSet model_type_set); -// Returns the set of comma-separated model types from |model_type_string|. -ModelTypeSet ModelTypeSetFromDebugString(const std::string& model_type_string); - // Generates a base::ListValue from |model_types|. std::unique_ptr<base::ListValue> ModelTypeSetToValue(ModelTypeSet model_types);
diff --git a/components/sync/base/model_type_unittest.cc b/components/sync/base/model_type_unittest.cc index 58c81fc6..8a3d58a 100644 --- a/components/sync/base/model_type_unittest.cc +++ b/components/sync/base/model_type_unittest.cc
@@ -97,17 +97,6 @@ EXPECT_EQ(9, ModelTypeToStableIdentifier(TYPED_URLS)); } -TEST_F(ModelTypeTest, ModelTypeSetFromDebugString) { - ModelTypeSet empty; - ModelTypeSet one(BOOKMARKS); - ModelTypeSet two(BOOKMARKS, TYPED_URLS); - - EXPECT_EQ(empty, - ModelTypeSetFromDebugString(ModelTypeSetToDebugString(empty))); - EXPECT_EQ(one, ModelTypeSetFromDebugString(ModelTypeSetToDebugString(one))); - EXPECT_EQ(two, ModelTypeSetFromDebugString(ModelTypeSetToDebugString(two))); -} - TEST_F(ModelTypeTest, DefaultFieldValues) { ModelTypeSet types = ProtocolTypes(); for (ModelType type : types) { @@ -140,16 +129,9 @@ } } -TEST_F(ModelTypeTest, ModelTypeStringMapping) { - ModelTypeSet all_types = ModelTypeSet::All(); - for (ModelType model_type : all_types) { - const char* model_type_string = ModelTypeToDebugString(model_type); - ModelType converted_model_type = - ModelTypeFromDebugString(model_type_string); - if (IsRealDataType(model_type)) - EXPECT_EQ(converted_model_type, model_type); - else - EXPECT_EQ(converted_model_type, UNSPECIFIED); +TEST_F(ModelTypeTest, ModelTypeDebugStringIsNotEmpty) { + for (ModelType model_type : ModelTypeSet::All()) { + EXPECT_NE("", ModelTypeToDebugString(model_type)); } }
diff --git a/components/test/data/payments/can_make_payment_query.js b/components/test/data/payments/can_make_payment_query.js index fb28a5a7..3229850 100644 --- a/components/test/data/payments/can_make_payment_query.js +++ b/components/test/data/payments/can_make_payment_query.js
@@ -43,7 +43,16 @@ * Checks for existence of Bob Pay or a complete credit card. */ function buy() { // eslint-disable-line no-unused-vars - var request = new PaymentRequest([bobPayMethod, visaMethod], defaultDetails); + buyWithMethods([bobPayMethod, visaMethod]); +} + +/** + * Checks for existence of the given methods. + * @param {sequence<PaymentMethodData>} methodData An array of payment method + * objects. + */ +function buyWithMethods(methodData) { + var request = new PaymentRequest(methodData, defaultDetails); run(() => { return request.canMakePayment(); }); @@ -53,7 +62,16 @@ * Show payment UI for Bob Pay or a complete credit card. */ function show() { // eslint-disable-line no-unused-vars - var request = new PaymentRequest([bobPayMethod, visaMethod], defaultDetails); + showWithMethods([bobPayMethod, visaMethod]); +} + +/** + * Show payment UI for the given methods. + * @param {sequence<PaymentMethodData>} methodData An array of payment method + * objects. + */ +function showWithMethods(methodData) { + var request = new PaymentRequest(methodData, defaultDetails); run(() => { return request.show(); }); @@ -63,7 +81,16 @@ * Checks for enrolled instrument of Bob Pay or a complete credit card. */ function hasEnrolledInstrument() { // eslint-disable-line no-unused-vars - var request = new PaymentRequest([bobPayMethod, visaMethod], defaultDetails); + hasEnrolledInstrumentWithMethods([bobPayMethod, visaMethod]); +} + +/** + * Checks for enrolled instrument of the given methods. + * @param {sequence<PaymentMethodData>} methodData An array of payment method + * objects. + */ + function hasEnrolledInstrumentWithMethods(methodData) { + var request = new PaymentRequest(methodData, defaultDetails); run(() => { return request.hasEnrolledInstrument(); });
diff --git a/components/ukm/ukm_service_unittest.cc b/components/ukm/ukm_service_unittest.cc index e485cbb..d85ac37 100644 --- a/components/ukm/ukm_service_unittest.cc +++ b/components/ukm/ukm_service_unittest.cc
@@ -484,9 +484,6 @@ } TEST_F(UkmServiceTest, MetricsProviderTest) { - ScopedUkmFeatureParams params( - {{"WhitelistEntries", std::string(TestProviderEvent::kEntryName)}}); - UkmService service(&prefs_, &client_, std::make_unique<MockDemographicMetricsProvider>()); TestRecordingHelper recorder(&service);
diff --git a/content/browser/attribution_reporting/attribution_host.h b/content/browser/attribution_reporting/attribution_host.h index 4ad0d028..1bfb6e92 100644 --- a/content/browser/attribution_reporting/attribution_host.h +++ b/content/browser/attribution_reporting/attribution_host.h
@@ -57,7 +57,7 @@ const url::Origin& impression_origin, const blink::Impression& impression); - [[nodiscard]] static blink::mojom::ImpressionPtr MojoImpressionFromImpression( + static blink::mojom::ImpressionPtr MojoImpressionFromImpression( const blink::Impression& impression); // Overrides the target object to bind |receiver| to in BindReceiver().
diff --git a/content/browser/attribution_reporting/attribution_host_utils.h b/content/browser/attribution_reporting/attribution_host_utils.h index ba8df55..14eb74f 100644 --- a/content/browser/attribution_reporting/attribution_host_utils.h +++ b/content/browser/attribution_reporting/attribution_host_utils.h
@@ -40,11 +40,11 @@ AttributionManager& attribution_manager, base::Time impression_time); -[[nodiscard]] CONTENT_EXPORT absl::optional<blink::Impression> -ParseImpressionFromApp(const std::string& attribution_source_event_id, - const std::string& attribution_destination, - const std::string& attribution_report_to, - int64_t attribution_expiry); +CONTENT_EXPORT absl::optional<blink::Impression> ParseImpressionFromApp( + const std::string& attribution_source_event_id, + const std::string& attribution_destination, + const std::string& attribution_report_to, + int64_t attribution_expiry); } // namespace attribution_host_utils
diff --git a/content/browser/attribution_reporting/attribution_manager.h b/content/browser/attribution_reporting/attribution_manager.h index 0a44890..a8d374a7 100644 --- a/content/browser/attribution_reporting/attribution_manager.h +++ b/content/browser/attribution_reporting/attribution_manager.h
@@ -97,8 +97,7 @@ // Returns the AttributionPolicy that is used to control API policies such // as noise. - [[nodiscard]] virtual const AttributionPolicy& GetAttributionPolicy() - const = 0; + virtual const AttributionPolicy& GetAttributionPolicy() const = 0; // Deletes all data in storage for URLs matching |filter|, between // |delete_begin| and |delete_end| time.
diff --git a/content/browser/attribution_reporting/attribution_policy.cc b/content/browser/attribution_reporting/attribution_policy.cc index af7b6c1..8b281d2 100644 --- a/content/browser/attribution_reporting/attribution_policy.cc +++ b/content/browser/attribution_reporting/attribution_policy.cc
@@ -19,8 +19,7 @@ using AttributionLogic = ::content::StorableSource::AttributionLogic; using AttributionMode = ::content::AttributionPolicy::AttributionMode; -[[nodiscard]] uint64_t TriggerDataCardinality( - StorableSource::SourceType source_type) { +uint64_t TriggerDataCardinality(StorableSource::SourceType source_type) { switch (source_type) { case StorableSource::SourceType::kNavigation: return 8;
diff --git a/content/browser/attribution_reporting/attribution_policy.h b/content/browser/attribution_reporting/attribution_policy.h index 96baa51..1faf6ec 100644 --- a/content/browser/attribution_reporting/attribution_policy.h +++ b/content/browser/attribution_reporting/attribution_policy.h
@@ -31,17 +31,15 @@ AttributionPolicy& operator=(AttributionPolicy&& other) = delete; virtual ~AttributionPolicy(); - [[nodiscard]] uint64_t SanitizeTriggerData( - uint64_t trigger_data, - StorableSource::SourceType source_type) const; + uint64_t SanitizeTriggerData(uint64_t trigger_data, + StorableSource::SourceType source_type) const; - [[nodiscard]] bool IsTriggerDataInRange( - uint64_t trigger_data, - StorableSource::SourceType source_type) const; + bool IsTriggerDataInRange(uint64_t trigger_data, + StorableSource::SourceType source_type) const; // Returns the expiry time for an impression that is clamped to a maximum // value of 30 days from |impression_time|. - [[nodiscard]] base::Time GetExpiryTimeForImpression( + base::Time GetExpiryTimeForImpression( const absl::optional<base::TimeDelta>& declared_expiry, base::Time impression_time, StorableSource::SourceType source_type) const; @@ -56,15 +54,15 @@ // open, or internet being disconnected. This given them a noisy report time // to help disassociate them from other reports. Returns null if no delay // should be applied, e.g. because the policy is in debug mode. - [[nodiscard]] virtual absl::optional<OfflineReportDelayConfig> - GetOfflineReportDelayConfig() const; + virtual absl::optional<OfflineReportDelayConfig> GetOfflineReportDelayConfig() + const; // Gets the delay for a report that has failed to be sent // `failed_send_attempts` times. // Returns `absl::nullopt` to indicate that no more attempts should be made. // Otherwise, the return value must be positive. `failed_send_attempts` is // guaranteed to be positive. - [[nodiscard]] absl::optional<base::TimeDelta> GetFailedReportDelay( + absl::optional<base::TimeDelta> GetFailedReportDelay( int failed_send_attempts) const; class CONTENT_EXPORT AttributionMode { @@ -81,12 +79,10 @@ AttributionMode& operator=(const AttributionMode&); AttributionMode& operator=(AttributionMode&&); - [[nodiscard]] StorableSource::AttributionLogic logic() const { - return logic_; - } + StorableSource::AttributionLogic logic() const { return logic_; } // `absl::nullopt` when `logic()` is not `AttributionLogic::kFalsely`. - [[nodiscard]] absl::optional<uint64_t> fake_trigger_data() const { + absl::optional<uint64_t> fake_trigger_data() const { return fake_trigger_data_; } @@ -97,13 +93,13 @@ // Selects how to handle the given source type; may involve RNG or other // dynamic criteria. - [[nodiscard]] AttributionMode GetAttributionMode( + AttributionMode GetAttributionMode( StorableSource::SourceType source_type) const; protected: - [[nodiscard]] virtual bool ShouldNoiseTriggerData() const; + virtual bool ShouldNoiseTriggerData() const; - [[nodiscard]] virtual uint64_t MakeNoisedTriggerData(uint64_t max) const; + virtual uint64_t MakeNoisedTriggerData(uint64_t max) const; private: // Whether the API is running in debug mode. No noise or delay should be used.
diff --git a/content/browser/attribution_reporting/attribution_report.h b/content/browser/attribution_reporting/attribution_report.h index 0338013..588e0c8 100644 --- a/content/browser/attribution_reporting/attribution_report.h +++ b/content/browser/attribution_reporting/attribution_report.h
@@ -42,10 +42,10 @@ ~AttributionReport(); // Returns the URL to which the report will be sent. - [[nodiscard]] GURL ReportURL() const; + GURL ReportURL() const; // Returns the JSON for the report body. - [[nodiscard]] std::string ReportBody(bool pretty_print = false) const; + std::string ReportBody(bool pretty_print = false) const; const StorableSource& source() const { return source_; }
diff --git a/content/browser/attribution_reporting/attribution_storage.h b/content/browser/attribution_reporting/attribution_storage.h index 2fd34de..8a73264 100644 --- a/content/browser/attribution_reporting/attribution_storage.h +++ b/content/browser/attribution_reporting/attribution_storage.h
@@ -48,16 +48,15 @@ // Returns the time a report should be sent for a given trigger time and // its corresponding source. - [[nodiscard]] virtual base::Time GetReportTime( - const StorableSource& source, - base::Time trigger_time) const = 0; + virtual base::Time GetReportTime(const StorableSource& source, + base::Time trigger_time) const = 0; // This limit is used to determine if a source is allowed to schedule // a new report. When a source reaches this limit it is // marked inactive and no new reports will be created for it. // Sources will be checked against this limit after they schedule a new // report. - [[nodiscard]] virtual int GetMaxAttributionsPerSource( + virtual int GetMaxAttributionsPerSource( StorableSource::SourceType source_type) const = 0; // These limits are designed solely to avoid excessive disk / memory usage. @@ -67,20 +66,19 @@ // // Returns the maximum number of sources that can be in storage at any // time for a source top-level origin. - [[nodiscard]] virtual int GetMaxSourcesPerOrigin() const = 0; + virtual int GetMaxSourcesPerOrigin() const = 0; // Returns the maximum number of reports that can be in storage at any // time for an attribution top-level origin. Note that since reporting // origins are the actual entities that invoke attribution registration, we // could consider changing this limit to be keyed by an <attribution origin, // reporting origin> tuple. - [[nodiscard]] virtual int GetMaxAttributionsPerOrigin() const = 0; + virtual int GetMaxAttributionsPerOrigin() const = 0; // Returns the maximum number of distinct attribution destinations that can // be in storage at any time for event sources with a given // reporting origin. - [[nodiscard]] virtual int GetMaxAttributionDestinationsPerEventSource() - const = 0; + virtual int GetMaxAttributionDestinationsPerEventSource() const = 0; struct RateLimitConfig { base::TimeDelta time_window; @@ -88,21 +86,19 @@ }; // Returns the rate limits for capping contributions per window. - [[nodiscard]] virtual RateLimitConfig GetRateLimits( + virtual RateLimitConfig GetRateLimits( AttributionType attribution_type) const = 0; // Returns the maximum frequency at which to delete expired sources. // Must be positive. - [[nodiscard]] virtual base::TimeDelta GetDeleteExpiredSourcesFrequency() - const = 0; + virtual base::TimeDelta GetDeleteExpiredSourcesFrequency() const = 0; // Returns the maximum frequency at which to delete expired rate limits. // Must be positive. - [[nodiscard]] virtual base::TimeDelta GetDeleteExpiredRateLimitsFrequency() - const = 0; + virtual base::TimeDelta GetDeleteExpiredRateLimitsFrequency() const = 0; // Returns a new report ID. - [[nodiscard]] virtual base::GUID NewReportID() const = 0; + virtual base::GUID NewReportID() const = 0; }; struct CONTENT_EXPORT DeactivatedSource { @@ -206,17 +202,16 @@ // |max_report_time|. This call is logically const, and does not modify the // underlying storage. |limit| limits the number of reports to return; use // a negative number for no limit. - [[nodiscard]] virtual std::vector<AttributionReport> GetAttributionsToReport( + virtual std::vector<AttributionReport> GetAttributionsToReport( base::Time max_report_time, int limit = -1) = 0; // Returns the first report time strictly after `time`. - [[nodiscard]] virtual absl::optional<base::Time> GetNextReportTime( - base::Time time) = 0; + virtual absl::optional<base::Time> GetNextReportTime(base::Time time) = 0; // Returns the reports with the given IDs. This call is logically const, and // does not modify the underlying storage. - [[nodiscard]] virtual std::vector<AttributionReport> GetReports( + virtual std::vector<AttributionReport> GetReports( const std::vector<AttributionReport::Id>& ids) = 0; // Returns all active sources in storage. Active sources are all @@ -225,18 +220,19 @@ // trigger and then superceded by a matching source should not be // returned. |limit| limits the number of sources to return; use // a negative number for no limit. - [[nodiscard]] virtual std::vector<StorableSource> GetActiveSources( - int limit = -1) = 0; + virtual std::vector<StorableSource> GetActiveSources(int limit = -1) = 0; // Deletes the report with the given |report_id|. Returns // false if an error occurred. - virtual bool DeleteReport(AttributionReport::Id report_id) = 0; + [[nodiscard]] virtual bool DeleteReport(AttributionReport::Id report_id) = 0; // Updates the number of failures associated with the given report, and sets // its report time to the given value. Should be called after a transient - // failure to send the report so that it is retried later. - virtual bool UpdateReportForSendFailure(AttributionReport::Id report_id, - base::Time new_report_time) = 0; + // failure to send the report so that it is retried later. Returns false on + // failure. + [[nodiscard]] virtual bool UpdateReportForSendFailure( + AttributionReport::Id report_id, + base::Time new_report_time) = 0; // Adjusts the report time of all reports that should have been sent while the // browser was offline by a random value between `min_delay` and `max_delay`,
diff --git a/content/browser/attribution_reporting/attribution_storage_sql.cc b/content/browser/attribution_reporting/attribution_storage_sql.cc index a0841fc..b6d3f19a 100644 --- a/content/browser/attribution_reporting/attribution_storage_sql.cc +++ b/content/browser/attribution_reporting/attribution_storage_sql.cc
@@ -139,13 +139,12 @@ count); } -[[nodiscard]] int SerializeAttributionLogic( - StorableSource::AttributionLogic val) { +int SerializeAttributionLogic(StorableSource::AttributionLogic val) { return static_cast<int>(val); } -[[nodiscard]] absl::optional<StorableSource::AttributionLogic> -DeserializeAttributionLogic(int val) { +absl::optional<StorableSource::AttributionLogic> DeserializeAttributionLogic( + int val) { switch (val) { case static_cast<int>(StorableSource::AttributionLogic::kNever): return StorableSource::AttributionLogic::kNever; @@ -158,12 +157,11 @@ } } -[[nodiscard]] int SerializeSourceType(StorableSource::SourceType val) { +int SerializeSourceType(StorableSource::SourceType val) { return static_cast<int>(val); } -[[nodiscard]] absl::optional<StorableSource::SourceType> DeserializeSourceType( - int val) { +absl::optional<StorableSource::SourceType> DeserializeSourceType(int val) { switch (val) { case static_cast<int>(StorableSource::SourceType::kNavigation): return StorableSource::SourceType::kNavigation; @@ -179,7 +177,7 @@ int num_conversions; }; -[[nodiscard]] absl::optional<SourceToAttribute> ReadSourceToAttribute( +absl::optional<SourceToAttribute> ReadSourceToAttribute( sql::Database* db, StorableSource::Id source_id, const url::Origin& reporting_origin) {
diff --git a/content/browser/attribution_reporting/attribution_storage_sql.h b/content/browser/attribution_reporting/attribution_storage_sql.h index 2f143902..48380457 100644 --- a/content/browser/attribution_reporting/attribution_storage_sql.h +++ b/content/browser/attribution_reporting/attribution_storage_sql.h
@@ -125,8 +125,7 @@ [[nodiscard]] bool DeleteReportInternal(AttributionReport::Id report_id) VALID_CONTEXT_REQUIRED(sequence_checker_); - [[nodiscard]] bool HasCapacityForStoringSource( - const std::string& serialized_origin) + bool HasCapacityForStoringSource(const std::string& serialized_origin) VALID_CONTEXT_REQUIRED(sequence_checker_); enum class ReportAlreadyStoredStatus { @@ -135,7 +134,7 @@ kError, }; - [[nodiscard]] ReportAlreadyStoredStatus ReportAlreadyStored( + ReportAlreadyStoredStatus ReportAlreadyStored( StorableSource::Id source_id, absl::optional<int64_t> dedup_key) VALID_CONTEXT_REQUIRED(sequence_checker_); @@ -146,7 +145,7 @@ kError, }; - [[nodiscard]] ConversionCapacityStatus CapacityForStoringReport( + ConversionCapacityStatus CapacityForStoringReport( const std::string& serialized_origin) VALID_CONTEXT_REQUIRED(sequence_checker_); @@ -165,21 +164,22 @@ absl::optional<AttributionReport>& replaced_report) VALID_CONTEXT_REQUIRED(sequence_checker_); - [[nodiscard]] absl::optional<AttributionReport> GetReport( - AttributionReport::Id report_id) + absl::optional<AttributionReport> GetReport(AttributionReport::Id report_id) VALID_CONTEXT_REQUIRED(sequence_checker_); - [[nodiscard]] absl::optional<std::vector<int64_t>> ReadDedupKeys( + absl::optional<std::vector<int64_t>> ReadDedupKeys( StorableSource::Id source_id) VALID_CONTEXT_REQUIRED(sequence_checker_); // When storing an event source, deletes active event // sources in order by |impression_time| until there are sufficiently few - // unique conversion destinations for the same |impression_site|. + // unique conversion destinations for the same |impression_site|. Returns + // false on failure. [[nodiscard]] bool EnsureCapacityForPendingDestinationLimit( const StorableSource& source) VALID_CONTEXT_REQUIRED(sequence_checker_); // Stores |report| in the database, but uses |source_id| rather than - // |AttributionReport::source::source_id()|, which may be null. + // |AttributionReport::source::source_id()|, which may be null. Returns false + // on failure. [[nodiscard]] bool StoreReport(const AttributionReport& report, StorableSource::Id source_id) VALID_CONTEXT_REQUIRED(sequence_checker_); @@ -189,8 +189,10 @@ // it is not already. [[nodiscard]] bool LazyInit(DbCreationPolicy creation_policy) VALID_CONTEXT_REQUIRED(sequence_checker_); + // Returns false on failure. [[nodiscard]] bool InitializeSchema(bool db_empty) VALID_CONTEXT_REQUIRED(sequence_checker_); + // Returns false on failure. [[nodiscard]] bool CreateSchema() VALID_CONTEXT_REQUIRED(sequence_checker_); void HandleInitializationFailure(const InitStatus status) VALID_CONTEXT_REQUIRED(sequence_checker_);
diff --git a/content/browser/attribution_reporting/attribution_storage_sql_migrations.cc b/content/browser/attribution_reporting/attribution_storage_sql_migrations.cc index 0bd989d3..deff6d9a 100644 --- a/content/browser/attribution_reporting/attribution_storage_sql_migrations.cc +++ b/content/browser/attribution_reporting/attribution_storage_sql_migrations.cc
@@ -23,11 +23,11 @@ namespace { -[[nodiscard]] StorableSource::Id NextImpressionId(StorableSource::Id id) { +StorableSource::Id NextImpressionId(StorableSource::Id id) { return StorableSource::Id(*id + 1); } -[[nodiscard]] AttributionReport::Id NextConversionId(AttributionReport::Id id) { +AttributionReport::Id NextConversionId(AttributionReport::Id id) { return AttributionReport::Id(*id + 1); }
diff --git a/content/browser/attribution_reporting/attribution_storage_sql_migrations.h b/content/browser/attribution_reporting/attribution_storage_sql_migrations.h index 391cc2d..eff1a4f 100644 --- a/content/browser/attribution_reporting/attribution_storage_sql_migrations.h +++ b/content/browser/attribution_reporting/attribution_storage_sql_migrations.h
@@ -43,7 +43,8 @@ // generated above. // Upgrades |db| to the latest schema, and updates the version stored in -// |meta_table| accordingly. Must be called with an open |db|. +// |meta_table| accordingly. Must be called with an open |db|. Returns false on +// failure. [[nodiscard]] bool UpgradeAttributionStorageSqlSchema( sql::Database* db, sql::MetaTable* meta_table,
diff --git a/content/browser/attribution_reporting/attribution_test_utils.h b/content/browser/attribution_reporting/attribution_test_utils.h index 5432541..b2bb49f0 100644 --- a/content/browser/attribution_reporting/attribution_test_utils.h +++ b/content/browser/attribution_reporting/attribution_test_utils.h
@@ -210,33 +210,30 @@ explicit SourceBuilder(base::Time time = base::Time::Now()); ~SourceBuilder(); - [[nodiscard]] SourceBuilder& SetExpiry(base::TimeDelta delta); + SourceBuilder& SetExpiry(base::TimeDelta delta); - [[nodiscard]] SourceBuilder& SetSourceEventId(uint64_t source_event_id); + SourceBuilder& SetSourceEventId(uint64_t source_event_id); - [[nodiscard]] SourceBuilder& SetImpressionOrigin(url::Origin origin); + SourceBuilder& SetImpressionOrigin(url::Origin origin); - [[nodiscard]] SourceBuilder& SetConversionOrigin(url::Origin domain); + SourceBuilder& SetConversionOrigin(url::Origin domain); - [[nodiscard]] SourceBuilder& SetReportingOrigin(url::Origin origin); + SourceBuilder& SetReportingOrigin(url::Origin origin); - [[nodiscard]] SourceBuilder& SetSourceType( - StorableSource::SourceType source_type); + SourceBuilder& SetSourceType(StorableSource::SourceType source_type); - [[nodiscard]] SourceBuilder& SetPriority(int64_t priority); + SourceBuilder& SetPriority(int64_t priority); - [[nodiscard]] SourceBuilder& SetAttributionLogic( + SourceBuilder& SetAttributionLogic( StorableSource::AttributionLogic attribution_logic); - [[nodiscard]] SourceBuilder& SetFakeTriggerData( - absl::optional<uint64_t> fake_trigger_data); + SourceBuilder& SetFakeTriggerData(absl::optional<uint64_t> fake_trigger_data); - [[nodiscard]] SourceBuilder& SetSourceId( - absl::optional<StorableSource::Id> source_id); + SourceBuilder& SetSourceId(absl::optional<StorableSource::Id> source_id); - [[nodiscard]] SourceBuilder& SetDedupKeys(std::vector<int64_t> dedup_keys); + SourceBuilder& SetDedupKeys(std::vector<int64_t> dedup_keys); - [[nodiscard]] StorableSource Build() const; + StorableSource Build() const; private: uint64_t source_event_id_ = 123; @@ -257,7 +254,7 @@ // Returns a StorableTrigger with default data which matches the default // impressions created by SourceBuilder. -[[nodiscard]] StorableTrigger DefaultTrigger(); +StorableTrigger DefaultTrigger(); // Helper class to construct a StorableTrigger for tests using default data. // StorableTrigger members are not mutable after construction requiring a @@ -267,22 +264,20 @@ TriggerBuilder(); ~TriggerBuilder(); - [[nodiscard]] TriggerBuilder& SetTriggerData(uint64_t trigger_data); + TriggerBuilder& SetTriggerData(uint64_t trigger_data); - [[nodiscard]] TriggerBuilder& SetEventSourceTriggerData( - uint64_t event_source_trigger_data); + TriggerBuilder& SetEventSourceTriggerData(uint64_t event_source_trigger_data); - [[nodiscard]] TriggerBuilder& SetConversionDestination( + TriggerBuilder& SetConversionDestination( net::SchemefulSite conversion_destination); - [[nodiscard]] TriggerBuilder& SetReportingOrigin( - url::Origin reporting_origin); + TriggerBuilder& SetReportingOrigin(url::Origin reporting_origin); - [[nodiscard]] TriggerBuilder& SetPriority(int64_t priority); + TriggerBuilder& SetPriority(int64_t priority); - [[nodiscard]] TriggerBuilder& SetDedupKey(absl::optional<int64_t> dedup_key); + TriggerBuilder& SetDedupKey(absl::optional<int64_t> dedup_key); - [[nodiscard]] StorableTrigger Build() const; + StorableTrigger Build() const; private: uint64_t trigger_data_ = 111; @@ -300,21 +295,19 @@ explicit ReportBuilder(StorableSource source); ~ReportBuilder(); - [[nodiscard]] ReportBuilder& SetTriggerData(uint64_t trigger_data); + ReportBuilder& SetTriggerData(uint64_t trigger_data); - [[nodiscard]] ReportBuilder& SetTriggerTime(base::Time time); + ReportBuilder& SetTriggerTime(base::Time time); - [[nodiscard]] ReportBuilder& SetReportTime(base::Time time); + ReportBuilder& SetReportTime(base::Time time); - [[nodiscard]] ReportBuilder& SetPriority(int64_t priority); + ReportBuilder& SetPriority(int64_t priority); - [[nodiscard]] ReportBuilder& SetExternalReportId( - base::GUID external_report_id); + ReportBuilder& SetExternalReportId(base::GUID external_report_id); - [[nodiscard]] ReportBuilder& SetReportId( - absl::optional<AttributionReport::Id> id); + ReportBuilder& SetReportId(absl::optional<AttributionReport::Id> id); - [[nodiscard]] AttributionReport Build() const; + AttributionReport Build() const; private: StorableSource source_; @@ -364,7 +357,7 @@ std::ostream& out, const AttributionStorage::DeactivatedSource& deactivated_source); -[[nodiscard]] std::vector<AttributionReport> GetAttributionsToReportForTesting( +std::vector<AttributionReport> GetAttributionsToReportForTesting( AttributionManagerImpl* manager, base::Time max_report_time);
diff --git a/content/browser/attribution_reporting/attribution_utils.h b/content/browser/attribution_reporting/attribution_utils.h index 7a68d8d9..da3954b 100644 --- a/content/browser/attribution_reporting/attribution_utils.h +++ b/content/browser/attribution_reporting/attribution_utils.h
@@ -15,8 +15,8 @@ // Calculates the report time for a conversion associated with a given // impression. -[[nodiscard]] base::Time ComputeReportTime(const StorableSource& impression, - base::Time trigger_time); +base::Time ComputeReportTime(const StorableSource& impression, + base::Time trigger_time); } // namespace content #endif // CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_UTILS_H_
diff --git a/content/browser/attribution_reporting/rate_limit_table.cc b/content/browser/attribution_reporting/rate_limit_table.cc index 6fc6dce..81e3160 100644 --- a/content/browser/attribution_reporting/rate_limit_table.cc +++ b/content/browser/attribution_reporting/rate_limit_table.cc
@@ -28,7 +28,7 @@ AttributionType::kAggregate, }; -[[nodiscard]] AttributionType AttributionTypeFromSourceType( +AttributionType AttributionTypeFromSourceType( StorableSource::SourceType source_type) { switch (source_type) { case StorableSource::SourceType::kNavigation: @@ -38,7 +38,7 @@ } } -[[nodiscard]] int SerializeAttributionType(AttributionType attribution_type) { +int SerializeAttributionType(AttributionType attribution_type) { return static_cast<int>(attribution_type); } @@ -283,49 +283,45 @@ if (filter.is_null()) return ClearAllDataInRange(db, delete_begin, delete_end); - std::vector<int64_t> rate_limit_ids_to_delete; - { - static constexpr char kScanCandidateData[] = - "SELECT rate_limit_id,impression_origin,conversion_origin " - "FROM rate_limits " - DCHECK_SQL_INDEXED_BY("rate_limit_attribution_type_conversion_time_idx") - "WHERE attribution_type = ? AND conversion_time BETWEEN ? AND ?"; - sql::Statement statement( - db->GetCachedStatement(SQL_FROM_HERE, kScanCandidateData)); - - // Issue deletes for different attribution_types so this can be easily - // optimized by the rate_limit_attribution_type_conversion_time_idx. - for (AttributionType attribution_type : kAttributionTypes) { - statement.Reset(/*clear_bound_vars=*/true); - statement.BindInt(0, SerializeAttributionType(attribution_type)); - statement.BindTime(1, delete_begin); - statement.BindTime(2, delete_end); - - while (statement.Step()) { - int64_t rate_limit_id = statement.ColumnInt64(0); - if (filter.Run(DeserializeOrigin(statement.ColumnString(1))) || - filter.Run(DeserializeOrigin(statement.ColumnString(2)))) { - rate_limit_ids_to_delete.push_back(rate_limit_id); - } - } - - if (!statement.Succeeded()) - return false; - } - } + static constexpr char kDeleteSql[] = + "DELETE FROM rate_limits WHERE rate_limit_id=?"; + sql::Statement delete_statement( + db->GetCachedStatement(SQL_FROM_HERE, kDeleteSql)); sql::Transaction transaction(db); if (!transaction.Begin()) return false; - static constexpr char kDeleteRateLimitSql[] = - "DELETE FROM rate_limits WHERE rate_limit_id = ?"; - sql::Statement statement( - db->GetCachedStatement(SQL_FROM_HERE, kDeleteRateLimitSql)); - for (int64_t rate_limit_id : rate_limit_ids_to_delete) { - statement.Reset(/*clear_bound_vars=*/true); - statement.BindInt64(0, rate_limit_id); - if (!statement.Run()) + static constexpr char kSelectSql[] = + "SELECT rate_limit_id,impression_origin,conversion_origin " + "FROM rate_limits " + DCHECK_SQL_INDEXED_BY("rate_limit_attribution_type_conversion_time_idx") + "WHERE attribution_type=? AND conversion_time BETWEEN ? AND ?"; + sql::Statement select_statement( + db->GetCachedStatement(SQL_FROM_HERE, kSelectSql)); + select_statement.BindTime(1, delete_begin); + select_statement.BindTime(2, delete_end); + + // Issue SELECTs for different attribution_types so this can be easily + // optimized by the rate_limit_attribution_type_conversion_time_idx. + for (AttributionType attribution_type : kAttributionTypes) { + select_statement.Reset(/*clear_bound_vars=*/false); + select_statement.BindInt(0, SerializeAttributionType(attribution_type)); + + while (select_statement.Step()) { + int64_t rate_limit_id = select_statement.ColumnInt64(0); + if (filter.Run(DeserializeOrigin(select_statement.ColumnString(1))) || + filter.Run(DeserializeOrigin(select_statement.ColumnString(2)))) { + // See https://www.sqlite.org/isolation.html for why it's OK for this + // DELETE to be interleaved in the surrounding SELECT. + delete_statement.Reset(/*clear_bound_vars=*/false); + delete_statement.BindInt64(0, rate_limit_id); + if (!delete_statement.Run()) + return false; + } + } + + if (!select_statement.Succeeded()) return false; }
diff --git a/content/browser/attribution_reporting/rate_limit_table.h b/content/browser/attribution_reporting/rate_limit_table.h index d0285be..47c8428 100644 --- a/content/browser/attribution_reporting/rate_limit_table.h +++ b/content/browser/attribution_reporting/rate_limit_table.h
@@ -63,25 +63,22 @@ // Checks if the given attribution is allowed according to the data in the // table and policy as specified by the delegate. - [[nodiscard]] AttributionAllowedStatus AttributionAllowed( - sql::Database* db, - const AttributionReport& report, - base::Time now); + AttributionAllowedStatus AttributionAllowed(sql::Database* db, + const AttributionReport& report, + base::Time now); // Attempts to add a set of histogram contributions to the rate limit. Returns // `kAllowed` if the contributions were added, `kNotAllowed` if the reports // would have exceeded the limit, and `kError` otherwise. This API will change // as we iterate on the aggregate API, so for now it is only available in // tests. - [[nodiscard]] AttributionAllowedStatus - AddAggregateHistogramContributionsForTesting( + AttributionAllowedStatus AddAggregateHistogramContributionsForTesting( sql::Database* db, const StorableSource& source, const std::vector<AggregateHistogramContribution>& contributions); // These should be 1:1 with |AttributionStorageSql|'s |ClearData| functions. // Returns false on failure. - // Returns false on failure. [[nodiscard]] bool ClearAllDataAllTime(sql::Database* db); // Returns false on failure. [[nodiscard]] bool ClearDataForOriginsInRange( @@ -89,6 +86,7 @@ base::Time delete_begin, base::Time delete_end, base::RepeatingCallback<bool(const url::Origin&)> filter); + // Returns false on failure. [[nodiscard]] bool ClearDataForSourceIds( sql::Database* db, const std::vector<StorableSource::Id>& source_ids); @@ -97,13 +95,13 @@ // Returns the capacity for the given `attribution_type`, `impression_site`, // `conversion_destination`, according to `delegate_->GetRateLimits()`. // Returns 0 if there is no capacity, -1 on error. - [[nodiscard]] int64_t GetCapacity( - sql::Database* db, - AttributionStorage::AttributionType attribution_type, - const std::string& serialized_impression_site, - const std::string& serialized_conversion_destination, - base::Time now) VALID_CONTEXT_REQUIRED(sequence_checker_); + int64_t GetCapacity(sql::Database* db, + AttributionStorage::AttributionType attribution_type, + const std::string& serialized_impression_site, + const std::string& serialized_conversion_destination, + base::Time now) VALID_CONTEXT_REQUIRED(sequence_checker_); + // Returns false on failure. [[nodiscard]] bool AddRow( sql::Database* db, AttributionStorage::AttributionType attribution_type, @@ -116,6 +114,7 @@ const std::string& bucket, uint32_t value) VALID_CONTEXT_REQUIRED(sequence_checker_); + // Returns false on failure. [[nodiscard]] bool ClearAllDataInRange(sql::Database* db, base::Time delete_begin, base::Time delete_end)
diff --git a/content/browser/attribution_reporting/sql_utils.h b/content/browser/attribution_reporting/sql_utils.h index 5abf59c..a2d2f429 100644 --- a/content/browser/attribution_reporting/sql_utils.h +++ b/content/browser/attribution_reporting/sql_utils.h
@@ -32,13 +32,13 @@ namespace content { -[[nodiscard]] std::string SerializeOrigin(const url::Origin& origin); +std::string SerializeOrigin(const url::Origin& origin); -[[nodiscard]] url::Origin DeserializeOrigin(const std::string& origin); +url::Origin DeserializeOrigin(const std::string& origin); -[[nodiscard]] int64_t SerializeUint64(uint64_t data); +int64_t SerializeUint64(uint64_t data); -[[nodiscard]] uint64_t DeserializeUint64(int64_t data); +uint64_t DeserializeUint64(int64_t data); // Prevent these functions from being called in the wrong direction. int64_t SerializeUint64(int64_t data) = delete;
diff --git a/content/browser/attribution_reporting/storable_source.h b/content/browser/attribution_reporting/storable_source.h index f19f971..4fe2b55f 100644 --- a/content/browser/attribution_reporting/storable_source.h +++ b/content/browser/attribution_reporting/storable_source.h
@@ -67,41 +67,31 @@ StorableSource& operator=(StorableSource&& other); ~StorableSource(); - [[nodiscard]] uint64_t source_event_id() const { return source_event_id_; } + uint64_t source_event_id() const { return source_event_id_; } - [[nodiscard]] const url::Origin& impression_origin() const { - return impression_origin_; - } + const url::Origin& impression_origin() const { return impression_origin_; } - [[nodiscard]] const url::Origin& conversion_origin() const { - return conversion_origin_; - } + const url::Origin& conversion_origin() const { return conversion_origin_; } - [[nodiscard]] const url::Origin& reporting_origin() const { - return reporting_origin_; - } + const url::Origin& reporting_origin() const { return reporting_origin_; } - [[nodiscard]] base::Time impression_time() const { return impression_time_; } + base::Time impression_time() const { return impression_time_; } - [[nodiscard]] base::Time expiry_time() const { return expiry_time_; } + base::Time expiry_time() const { return expiry_time_; } - [[nodiscard]] absl::optional<Id> source_id() const { return source_id_; } + absl::optional<Id> source_id() const { return source_id_; } - [[nodiscard]] SourceType source_type() const { return source_type_; } + SourceType source_type() const { return source_type_; } - [[nodiscard]] int64_t priority() const { return priority_; } + int64_t priority() const { return priority_; } - [[nodiscard]] AttributionLogic attribution_logic() const { - return attribution_logic_; - } + AttributionLogic attribution_logic() const { return attribution_logic_; } - [[nodiscard]] absl::optional<uint64_t> fake_trigger_data() const { + absl::optional<uint64_t> fake_trigger_data() const { return fake_trigger_data_; } - [[nodiscard]] const std::vector<int64_t>& dedup_keys() const { - return dedup_keys_; - } + const std::vector<int64_t>& dedup_keys() const { return dedup_keys_; } void SetDedupKeys(std::vector<int64_t> dedup_keys) { dedup_keys_ = std::move(dedup_keys); @@ -111,13 +101,13 @@ // // TODO(johnidel): Consider storing the SchemefulSite as a separate member so // that we avoid unnecessary copies of |conversion_origin_|. - [[nodiscard]] net::SchemefulSite ConversionDestination() const; + net::SchemefulSite ConversionDestination() const; // Returns the schemeful site of |impression_origin|. // // TODO(johnidel): Consider storing the SchemefulSite as a separate member so // that we avoid unnecessary copies of |impression_origin_|. - [[nodiscard]] net::SchemefulSite ImpressionSite() const; + net::SchemefulSite ImpressionSite() const; private: uint64_t source_event_id_;
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 6846ca3..7217202 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -768,6 +768,10 @@ } } +void BrowserMainLoop::CreateMessageLoopForEarlyShutdown() { + CreateMainMessageLoop(); +} + int BrowserMainLoop::PreCreateThreads() { TRACE_EVENT0("startup", "BrowserMainLoop::PreCreateThreads"); @@ -1440,6 +1444,8 @@ // Env creates the compositor. Aura widgets need the compositor to be created // before they can be initialized by the browser. env_ = aura::Env::CreateInstance(); + if (!env_) + return false; #endif // defined(USE_AURA) if (parts_)
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index e660d54..717ab1e 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h
@@ -143,6 +143,10 @@ void CreateMainMessageLoop(); void PostCreateMainMessageLoop(); + // Creates a "bare" message loop that is required to exit gracefully at the + // early stage if the toolkit failed to initialise. + void CreateMessageLoopForEarlyShutdown(); + // Create and start running the tasks we need to complete startup. Note that // this can be called more than once (currently only on Android) if we get a // request for synchronous startup while the tasks created by asynchronous
diff --git a/content/browser/browser_main_runner_impl.cc b/content/browser/browser_main_runner_impl.cc index b3b7903..be2a83a 100644 --- a/content/browser/browser_main_runner_impl.cc +++ b/content/browser/browser_main_runner_impl.cc
@@ -113,8 +113,10 @@ return early_init_error_code; // Must happen before we try to use a message loop or display any UI. - if (!main_loop_->InitializeToolkit()) + if (!main_loop_->InitializeToolkit()) { + main_loop_->CreateMessageLoopForEarlyShutdown(); return 1; + } main_loop_->PreCreateMainMessageLoop(); main_loop_->CreateMainMessageLoop();
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc index e8e9d01..3daaea9 100644 --- a/content/browser/download/mhtml_generation_manager.cc +++ b/content/browser/download/mhtml_generation_manager.cc
@@ -746,6 +746,16 @@ TRACE_EVENT0("page-serialization", "MHTMLGenerationManager::Job MHTML footer writing"); +#if BUILDFLAG(IS_FUCHSIA) + // TODO(crbug.com/1288816): Remove the Seek call. + // On fuchsia, fds do not share state. As the fd has been duped and sent to + // the renderer process, it must be seeked to the end to ensure the data is + // appended. + if (file.Seek(base::File::FROM_END, 0) == -1) { + save_status = mojom::MhtmlSaveStatus::kFileWritingError; + } +#endif // BUILDFLAG(IS_FUCHSIA) + // Write the extra data into a part of its own, if we have any. std::string serialized_extra_data_parts = CreateExtraDataParts(boundary, extra_data_parts);
diff --git a/content/browser/renderer_host/frame_tree_browsertest.cc b/content/browser/renderer_host/frame_tree_browsertest.cc index 8a4fd12..731c55d 100644 --- a/content/browser/renderer_host/frame_tree_browsertest.cc +++ b/content/browser/renderer_host/frame_tree_browsertest.cc
@@ -1677,7 +1677,7 @@ // Navigate the iframe. It should still have the same nonce. NavigateIframeInFencedFrame( fenced_frame->child_at(0), - https_server()->GetURL("b.test", "/fenced_frames/nested.html")); + https_server()->GetURL("b.test", "/fenced_frames/title1.html")); const net::IsolationInfo& nested_iframe_new_isolation_info = fenced_frame->child_at(0) ->current_frame_host()
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index 1c5b3dc..7f889967 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -2928,9 +2928,7 @@ // its tree. If it is possible that the navigation is both inside and // outside the frame tree and we discard it entirely because we don't // want to end up in a history state that didn't exist before. - if (base::FeatureList::IsEnabled( - features::kHistoryPreventSandboxedNavigation) && - !navigates_inside_tree) { + if (!navigates_inside_tree) { DiscardPendingEntry(false); return; }
diff --git a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc index 8924e18..f055daf 100644 --- a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc
@@ -17491,11 +17491,6 @@ class SandboxedNavigationControllerBrowserTest : public NavigationControllerBrowserTest { protected: - void SetUp() override { - feature_list_.InitAndEnableFeature( - features::kHistoryPreventSandboxedNavigation); - NavigationControllerBrowserTest::SetUp(); - } void SetupNavigation() { NavigationControllerImpl& controller = @@ -17613,8 +17608,7 @@ void SetUp() override { feature_list_.InitWithFeaturesAndParameters( {{features::kBackForwardCache, - {{"TimeToLiveInBackForwardCacheInSeconds", "3600"}}}, - {features::kHistoryPreventSandboxedNavigation, {}}}, + {{"TimeToLiveInBackForwardCacheInSeconds", "3600"}}}}, // Allow BackForwardCache for all devices regardless of their memory. {features::kBackForwardCacheMemoryControls}); NavigationControllerBrowserTest::SetUp(); @@ -17658,11 +17652,6 @@ class SandboxedNavigationControllerPopupBrowserTest : public NavigationControllerBrowserTest { protected: - void SetUp() override { - feature_list_.InitAndEnableFeature( - features::kHistoryPreventSandboxedNavigation); - NavigationControllerBrowserTest::SetUp(); - } void SetupNavigation() { EXPECT_EQ(1u, Shell::windows().size());
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index 7cbc246..bce10b22 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -3272,12 +3272,6 @@ EXPECT_EQ(embedded_test_server()->GetURL("/service_worker/" + worker_url), running_info.script_url); - // Non-PlzServiceWorker: - // Process allocation is broken during a fresh installation. We currently do - // not have the headers, and end up with a non isolated service worker script. - // - // TODO(crbug.com/996511): Remove non-PlzSerivceWorker case once the flag - // sticks. bool is_in_process = shell()->web_contents()->GetMainFrame()->GetProcess()->GetID() == running_info.render_process_id;
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index e58223c..cc8f30e2 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1354,12 +1354,6 @@ } } -int WebContentsImpl::SendToAllFrames(IPC::Message* message) { - OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::SendToAllFrames"); - return SendToAllFramesImpl(primary_frame_tree_, /*include_pending=*/false, - message); -} - int WebContentsImpl::SendToAllFramesIncludingPending(IPC::Message* message) { OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::SentToAllFramesIncludingPending");
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 41f6aad..3ce25bf 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -347,7 +347,6 @@ int frame_tree_node_id) override; void ForEachFrame( const base::RepeatingCallback<void(RenderFrameHost*)>& on_frame) override; - int SendToAllFrames(IPC::Message* message) override; void ForEachRenderFrameHost( RenderFrameHost::FrameIterationCallback on_frame) override; void ForEachRenderFrameHost(
diff --git a/content/browser/webauth/authenticator_common.cc b/content/browser/webauth/authenticator_common.cc index 3cf1c07..bd75fe5 100644 --- a/content/browser/webauth/authenticator_common.cc +++ b/content/browser/webauth/authenticator_common.cc
@@ -1298,6 +1298,11 @@ DCHECK(response_data.has_value()); DCHECK(authenticator); +#if BUILDFLAG(IS_WIN) + GetWebAuthenticationDelegate()->OperationSucceeded( + GetBrowserContext(), authenticator->IsWinNativeApiAuthenticator()); +#endif + absl::optional<device::FidoTransportProtocol> transport = authenticator->AuthenticatorTransport(); bool is_transport_used_internal = false; @@ -1514,6 +1519,11 @@ DCHECK(response_data.has_value()); DCHECK(authenticator); +#if BUILDFLAG(IS_WIN) + GetWebAuthenticationDelegate()->OperationSucceeded( + GetBrowserContext(), authenticator->IsWinNativeApiAuthenticator()); +#endif + // Show an account picker for requests with empty allow lists. // Authenticators may omit the identifying information in the user entity // if only one credential matches, or if they have account selection UI
diff --git a/content/common/zygote/zygote_commands_linux.h b/content/common/zygote/zygote_commands_linux.h index 272b5b5..2de34e9f 100644 --- a/content/common/zygote/zygote_commands_linux.h +++ b/content/common/zygote/zygote_commands_linux.h
@@ -24,7 +24,13 @@ static const char kZygoteChildPingMessage[] = "CHILD_PING"; // Maximum allowable length for messages sent to the zygote. -const size_t kZygoteMaxMessageLength = 12288; +const size_t kZygoteMaxMessageLength = 64 * 1024; +static_assert(kZygoteMaxMessageLength < 200 * 1024, + "Raising kZygoteMaxMessageLength past the maximum single " + "datagram size for a Unix domain socket will cause long " + "messages to be silently truncated. See " + "https://crbug.com/1278226. Values as low as 212992 have " + "been observed in the wild."); // File descriptors initialized by the Zygote Host const int kZygoteSocketPairFd = base::GlobalDescriptors::kBaseDescriptor;
diff --git a/content/public/browser/authenticator_request_client_delegate.cc b/content/public/browser/authenticator_request_client_delegate.cc index c4948a5a..bef79ae 100644 --- a/content/public/browser/authenticator_request_client_delegate.cc +++ b/content/public/browser/authenticator_request_client_delegate.cc
@@ -55,6 +55,12 @@ return true; } +#if BUILDFLAG(IS_WIN) +void WebAuthenticationDelegate::OperationSucceeded( + BrowserContext* browser_context, + bool used_win_api) {} +#endif + #if BUILDFLAG(IS_MAC) absl::optional<WebAuthenticationDelegate::TouchIdAuthenticatorConfig> WebAuthenticationDelegate::GetTouchIdAuthenticatorConfig(
diff --git a/content/public/browser/authenticator_request_client_delegate.h b/content/public/browser/authenticator_request_client_delegate.h index 3c67e1b..0c8113a 100644 --- a/content/public/browser/authenticator_request_client_delegate.h +++ b/content/public/browser/authenticator_request_client_delegate.h
@@ -87,6 +87,15 @@ // that testing is possible. virtual bool IsFocused(WebContents* web_contents); +#if BUILDFLAG(IS_WIN) + // OperationSucceeded is called when a registration or assertion operation + // succeeded. It communicates whether the Windows API was used or not. The + // implementation may wish to use this information to guide the UI for future + // operations towards the types of security keys that the user tends to use. + virtual void OperationSucceeded(BrowserContext* browser_context, + bool used_win_api); +#endif + #if BUILDFLAG(IS_MAC) using TouchIdAuthenticatorConfig = device::fido::mac::AuthenticatorConfig;
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index 2a71467..b980a289 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h
@@ -426,11 +426,6 @@ virtual void ForEachFrame( const base::RepeatingCallback<void(RenderFrameHost*)>& on_frame) = 0; - // TODO(1208438): Migrate to |ForEachRenderFrameHost|. - // Sends the given IPC to all live frames in this WebContents and returns the - // number of sent messages (i.e. the number of processed frames). - virtual int SendToAllFrames(IPC::Message* message) = 0; - // Calls |on_frame| for every RenderFrameHost in this WebContents. Note that // this includes RenderFrameHosts that are not descended from the primary main // frame (e.g. bfcached pages and prerendered pages). The order of traversal
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 907f38e..e481989a 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -397,12 +397,6 @@ // (activated by kUserAgentClientHint) const base::Feature kGreaseUACH{"GreaseUACH", base::FEATURE_ENABLED_BY_DEFAULT}; -// Prevents sandboxed iframes from using the history API to navigate frames -// outside their subttree, if they are restricted from doing top-level -// navigations. -const base::Feature kHistoryPreventSandboxedNavigation{ - "HistoryPreventSandboxedNavigation", base::FEATURE_ENABLED_BY_DEFAULT}; - // This is intended as a kill switch for the Idle Detection feature. To enable // this feature, the experimental web platform features flag should be set, // or the site should obtain an Origin Trial token.
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 74031e4..a80da75 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -98,7 +98,6 @@ kFledgeLimitNumAuctionsParam; CONTENT_EXPORT extern const base::Feature kFractionalScrollOffsets; CONTENT_EXPORT extern const base::Feature kGreaseUACH; -CONTENT_EXPORT extern const base::Feature kHistoryPreventSandboxedNavigation; CONTENT_EXPORT extern const base::Feature kIdleDetection; CONTENT_EXPORT extern const base::Feature kIncludeIpcOverheadInNavigationStart; CONTENT_EXPORT extern const base::Feature kInstalledApp;
diff --git a/content/renderer/mhtml_handle_writer.cc b/content/renderer/mhtml_handle_writer.cc index b5480296f..52f32c0 100644 --- a/content/renderer/mhtml_handle_writer.cc +++ b/content/renderer/mhtml_handle_writer.cc
@@ -63,7 +63,15 @@ base::File file) : MHTMLHandleWriter(std::move(main_thread_task_runner), std::move(callback)), - file_(std::move(file)) {} + file_(std::move(file)) { +#if BUILDFLAG(IS_FUCHSIA) + // TODO(crbug.com/1288816): Remove the Seek call. + // On fuchsia, fds do not share state. As the fd has been duped and sent from + // the browser process, it must be seeked to the end to ensure the data is + // appended. + file_.Seek(base::File::FROM_END, 0); +#endif // BUILDFLAG(IS_FUCHSIA) +} MHTMLFileHandleWriter::~MHTMLFileHandleWriter() {}
diff --git a/content/test/gpu/PRESUBMIT.py b/content/test/gpu/PRESUBMIT.py index 6c557c2..39fe02e1 100644 --- a/content/test/gpu/PRESUBMIT.py +++ b/content/test/gpu/PRESUBMIT.py
@@ -28,17 +28,18 @@ gpu_tests = [ input_api.Command( name='run_content_test_gpu_unittests', - cmd=[input_api.python_executable, 'run_unittests.py', 'gpu_tests'], + cmd=[input_api.python3_executable, 'run_unittests.py', 'gpu_tests'], kwargs={'env': gpu_env}, - message=output_api.PresubmitError), + message=output_api.PresubmitError, + python3=True), input_api.Command(name='validate_tag_consistency', cmd=[ - input_api.python_executable, - 'validate_tag_consistency.py', - 'validate', + input_api.python3_executable, + 'validate_tag_consistency.py', 'validate' ], kwargs={}, - message=output_api.PresubmitError), + message=output_api.PresubmitError, + python3=True), ] results.extend(input_api.RunTests(gpu_tests)) @@ -50,7 +51,8 @@ 'unexpected_passes'), [r'^.+_unittest\.py$'], env=gpu_env, run_on_python2=False, - run_on_python3=True)) + run_on_python3=True, + skip_shebang_check=True)) results.extend( input_api.canned_checks.RunUnitTestsInDirectory( @@ -60,9 +62,12 @@ 'flake_suppressor'), [r'^.+_unittest\.py$'], env=gpu_env, run_on_python2=False, - run_on_python3=True)) + run_on_python3=True, + skip_shebang_check=True)) - pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api) + pylint_checks = input_api.canned_checks.GetPylint(input_api, + output_api, + version='2.7') results.extend(input_api.RunTests(pylint_checks)) results.extend(CheckForNewSkipExpectations(input_api, output_api))
diff --git a/content/test/gpu/flake_suppressor/data_types.py b/content/test/gpu/flake_suppressor/data_types.py index 597706a..b1154db2 100644 --- a/content/test/gpu/flake_suppressor/data_types.py +++ b/content/test/gpu/flake_suppressor/data_types.py
@@ -22,7 +22,7 @@ return (self._comp(result.test) and self.tags <= set(result.tags)) -class Result(object): +class Result(): """Container for a test result. Contains all the relevant information we get back from BigQuery for a result
diff --git a/content/test/gpu/flake_suppressor/expectations_unittest.py b/content/test/gpu/flake_suppressor/expectations_unittest.py index 08d5ed1c..9627968 100755 --- a/content/test/gpu/flake_suppressor/expectations_unittest.py +++ b/content/test/gpu/flake_suppressor/expectations_unittest.py
@@ -605,7 +605,7 @@ class GetExpectationFilesFromOriginUnittest(unittest.TestCase): - class FakeRequestResult(object): + class FakeRequestResult(): def __init__(self): self.text = ''
diff --git a/content/test/gpu/flake_suppressor/queries.py b/content/test/gpu/flake_suppressor/queries.py index bbdece1..f7fdfa7 100644 --- a/content/test/gpu/flake_suppressor/queries.py +++ b/content/test/gpu/flake_suppressor/queries.py
@@ -163,7 +163,7 @@ """.format(submitted_builds_subquery=SUBMITTED_BUILDS_SUBQUERY) -class BigQueryQuerier(object): +class BigQueryQuerier(): def __init__(self, sample_period, billing_project): """Class for making calls to BigQuery.
diff --git a/content/test/gpu/flake_suppressor/unittest_utils.py b/content/test/gpu/flake_suppressor/unittest_utils.py index 3d58695..6414e82 100644 --- a/content/test/gpu/flake_suppressor/unittest_utils.py +++ b/content/test/gpu/flake_suppressor/unittest_utils.py
@@ -13,6 +13,6 @@ test.fs.CreateFile(*args, **kwargs) -class FakeProcess(object): +class FakeProcess(): def __init__(self, stdout): self.stdout = stdout or ''
diff --git a/content/test/gpu/gather_power_measurement_results.py b/content/test/gpu/gather_power_measurement_results.py index 60d4f9f3..afcf821 100755 --- a/content/test/gpu/gather_power_measurement_results.py +++ b/content/test/gpu/gather_power_measurement_results.py
@@ -17,9 +17,13 @@ import logging import re import sys -import urllib import urllib2 +try: + import urllib.parse as urllib +except ImportError: + import urllib + _TESTS = [ 'Basic', 'Video_720_MP4', 'Video_720_MP4_Fullscreen', 'Video_720_MP4_Underlay', 'Video_720_MP4_Underlay_Fullscreen' @@ -119,6 +123,10 @@ return None +# TODO(crbug.com/1285077): Once the issue with the //content/test/gpu/pylintrc +# not being used has been resolved, move this disable there, since it doesn't +# appear to be a useful warning. +# pylint: disable=unsupported-assignment-operation def ProcessStepStdout(stdout_url, entry): url = urllib.unquote(stdout_url) number = entry['number'] @@ -174,6 +182,7 @@ break else: logging.warn('[BUILD %d] Fail to locate the bot name' % number) +# pylint: enable=unsupported-assignment-operation def CollectBuildData(build, data_entries):
diff --git a/content/test/gpu/gold_inexact_matching/base_parameter_optimizer.py b/content/test/gpu/gold_inexact_matching/base_parameter_optimizer.py index 6f360fb5..aae7348 100644 --- a/content/test/gpu/gold_inexact_matching/base_parameter_optimizer.py +++ b/content/test/gpu/gold_inexact_matching/base_parameter_optimizer.py
@@ -30,7 +30,7 @@ ] -class BaseParameterOptimizer(object): +class BaseParameterOptimizer(): """Abstract base class for running a parameter optimization for a test.""" MIN_EDGE_THRESHOLD = 0 MAX_EDGE_THRESHOLD = 255 @@ -289,7 +289,7 @@ if status == 'positive' ] if not positive_digests: - raise RuntimeError('Failed to find any positive digests for test %s', + raise RuntimeError('Failed to find any positive digests for test %s' % self._test_name) for digest in positive_digests: content = self._DownloadImageWithDigest(digest)
diff --git a/content/test/gpu/gold_inexact_matching/binary_search_parameter_optimizer.py b/content/test/gpu/gold_inexact_matching/binary_search_parameter_optimizer.py index 92e3b4b8..62eb8f37 100644 --- a/content/test/gpu/gold_inexact_matching/binary_search_parameter_optimizer.py +++ b/content/test/gpu/gold_inexact_matching/binary_search_parameter_optimizer.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from __future__ import print_function import logging @@ -23,10 +22,10 @@ def __init__(self, args, test_name): self._unlocked_parameter = None - super(BinarySearchParameterOptimizer, self).__init__(args, test_name) + super().__init__(args, test_name) def _VerifyArgs(self): - super(BinarySearchParameterOptimizer, self)._VerifyArgs() + super()._VerifyArgs() max_diff_locked = self._args.max_max_diff == self._args.min_max_diff delta_threshold_locked = ( @@ -72,10 +71,9 @@ """ if self._unlocked_parameter == self.UNLOCKED_PARAM_MAX_DIFF: return self._args.max_max_diff, self._args.min_max_diff - elif self._unlocked_parameter == self.UNLOCKED_PARAM_DELTA_THRESHOLD: + if self._unlocked_parameter == self.UNLOCKED_PARAM_DELTA_THRESHOLD: return self._args.max_delta_threshold, self._args.min_delta_threshold - else: - return self._args.min_edge_threshold, self._args.max_edge_threshold + return self._args.min_edge_threshold, self._args.max_edge_threshold def _CreateParameterSet(self, value): """Creates a parameter_set.ParameterSet to test. @@ -90,9 +88,8 @@ if self._unlocked_parameter == self.UNLOCKED_PARAM_MAX_DIFF: return parameter_set.ParameterSet(value, self._args.min_delta_threshold, self._args.min_edge_threshold) - elif self._unlocked_parameter == self.UNLOCKED_PARAM_DELTA_THRESHOLD: + if self._unlocked_parameter == self.UNLOCKED_PARAM_DELTA_THRESHOLD: return parameter_set.ParameterSet(self._args.min_max_diff, value, self._args.min_edge_threshold) - else: - return parameter_set.ParameterSet(self._args.min_max_diff, - self._args.min_delta_threshold, value) + return parameter_set.ParameterSet(self._args.min_max_diff, + self._args.min_delta_threshold, value)
diff --git a/content/test/gpu/gold_inexact_matching/iterative_parameter_optimizer.py b/content/test/gpu/gold_inexact_matching/iterative_parameter_optimizer.py index c736e84..0eea5c32 100644 --- a/content/test/gpu/gold_inexact_matching/iterative_parameter_optimizer.py +++ b/content/test/gpu/gold_inexact_matching/iterative_parameter_optimizer.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from __future__ import print_function import gold_inexact_matching.base_parameter_optimizer as base_optimizer @@ -47,7 +46,7 @@ return common_group, sobel_group, fuzzy_group def _VerifyArgs(self): - super(IterativeParameterOptimizer, self)._VerifyArgs() + super()._VerifyArgs() assert self._args.edge_threshold_step >= self.MIN_EDGE_THRESHOLD_STEP assert self._args.edge_threshold_step <= self.MAX_EDGE_THRESHOLD_STEP
diff --git a/content/test/gpu/gold_inexact_matching/local_minima_parameter_optimizer.py b/content/test/gpu/gold_inexact_matching/local_minima_parameter_optimizer.py index 90bb0d6..4389dc9 100644 --- a/content/test/gpu/gold_inexact_matching/local_minima_parameter_optimizer.py +++ b/content/test/gpu/gold_inexact_matching/local_minima_parameter_optimizer.py
@@ -25,7 +25,7 @@ MIN_MAX_DIFF_WEIGHT = MIN_DELTA_THRESHOLD_WEIGHT = 0 def __init__(self, args, test_name): - super(LocalMinimaParameterOptimizer, self).__init__(args, test_name) + super().__init__(args, test_name) # These are (or will be) maps of ints to maps of ints to ints, i.e. a 2D # array containing ints, just using maps instead of lists. They hold the # most permissive value visited so far that resulted in a comparison failure @@ -76,7 +76,7 @@ return common_group, sobel_group, fuzzy_group def _VerifyArgs(self): - super(LocalMinimaParameterOptimizer, self)._VerifyArgs() + super()._VerifyArgs() assert self._args.edge_threshold_weight >= self.MIN_EDGE_THRESHOLD_WEIGHT @@ -95,7 +95,7 @@ # 2. They haven't been visited already. # 3. They are not guaranteed to fail based on previously tested parameters. # 4. The current parameters result in a successful comparison. - while len(to_visit): + while to_visit: current_parameters = None if self._args.use_bfs: current_parameters = to_visit.popleft()
diff --git a/content/test/gpu/gold_inexact_matching/optimizer_set.py b/content/test/gpu/gold_inexact_matching/optimizer_set.py index dc4a0ab..6a8d6f2 100644 --- a/content/test/gpu/gold_inexact_matching/optimizer_set.py +++ b/content/test/gpu/gold_inexact_matching/optimizer_set.py
@@ -2,10 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from __future__ import print_function -class OptimizerSet(object): +class OptimizerSet(): """Class to run a ParameterOptimizer for multiple tests.""" def __init__(self, args, optimizer_class):
diff --git a/content/test/gpu/gold_inexact_matching/parameter_set.py b/content/test/gpu/gold_inexact_matching/parameter_set.py index 566545de..f707c98 100644 --- a/content/test/gpu/gold_inexact_matching/parameter_set.py +++ b/content/test/gpu/gold_inexact_matching/parameter_set.py
@@ -2,10 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from __future__ import print_function -class ParameterSet(object): +class ParameterSet(): """Struct-like object for holding parameters for an iteration.""" # This parameter is not varied, so it is set statically once instead of being
diff --git a/content/test/gpu/gpu_tests/color_profile_manager.py b/content/test/gpu/gpu_tests/color_profile_manager.py index e94f1567..3fa9d0c9 100644 --- a/content/test/gpu/gpu_tests/color_profile_manager.py +++ b/content/test/gpu/gpu_tests/color_profile_manager.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from __future__ import print_function import atexit import sys @@ -17,7 +16,9 @@ return ForceUntilExitSRGB.has_forced_srgb = True + # pylint: disable=import-outside-toplevel from gpu_tests import color_profile_manager_mac + # pylint: enable=import-outside-toplevel # Record the current color profiles. display_profile_url_map = \ color_profile_manager_mac.GetDisplaysToProfileURLMap()
diff --git a/content/test/gpu/gpu_tests/color_profile_manager_mac.py b/content/test/gpu/gpu_tests/color_profile_manager_mac.py index 19d451d..a75e955 100644 --- a/content/test/gpu/gpu_tests/color_profile_manager_mac.py +++ b/content/test/gpu/gpu_tests/color_profile_manager_mac.py
@@ -11,7 +11,6 @@ # trigger undefined-variables. # pylint: disable=undefined-variable -from __future__ import print_function import sys if sys.platform.startswith('darwin'):
diff --git a/content/test/gpu/gpu_tests/expected_color_test.py b/content/test/gpu/gpu_tests/expected_color_test.py index a335bdb7..a6a5b3e 100644 --- a/content/test/gpu/gpu_tests/expected_color_test.py +++ b/content/test/gpu/gpu_tests/expected_color_test.py
@@ -23,12 +23,12 @@ Gold normally for the test. """ - def RunActualGpuTest(self, options): + def RunActualGpuTest(self, test_path, *args): raise NotImplementedError( 'RunActualGpuTest must be overridden in a subclass') def GetGoldJsonKeys(self, page): - keys = super(ExpectedColorTest, self).GetGoldJsonKeys(page) + keys = super().GetGoldJsonKeys(page) keys['expected_color_comment'] = ( 'This is an expected color test. Triaging in Gold will not affect test ' 'behavior.') @@ -156,11 +156,12 @@ class ExpectedColorPixelTestPage(pixel_test_pages.PixelTestPage): """Extension of PixelTestPage with expected color information.""" - def __init__(self, expected_colors, tolerance=2, *args, **kwargs): - super(ExpectedColorPixelTestPage, self).__init__(*args, **kwargs) + def __init__(self, expected_colors, *args, **kwargs): + # The tolerance when comparing against the reference image. + self.tolerance = kwargs.pop('tolerance', 2) + + super().__init__(*args, **kwargs) # The expected colors can be specified as a list of dictionaries. The format # is only defined by contract with _CompareScreenshotSamples in # expected_color_test.py. self.expected_colors = expected_colors - # The tolerance when comparing against the reference image. - self.tolerance = tolerance
diff --git a/content/test/gpu/gpu_tests/gpu_helper.py b/content/test/gpu/gpu_tests/gpu_helper.py index da58cec..e8a08c3b 100644 --- a/content/test/gpu/gpu_tests/gpu_helper.py +++ b/content/test/gpu/gpu_tests/gpu_helper.py
@@ -49,8 +49,7 @@ match = re.search(r'ANGLE \((.*), .*, .*\)', device_string) if match: return match.group(1) - else: - return None + return None def _GetANGLEGpuDeviceId(device_string): @@ -62,8 +61,7 @@ match = re.search(r'ANGLE \(.*, (.*), .*\)', device_string) if match: return match.group(1) - else: - return None + return None def GetGpuVendorString(gpu_info, index): @@ -76,13 +74,13 @@ vendor_id = primary_gpu.vendor_id if vendor_id == 0x10DE: return 'nvidia' - elif vendor_id == 0x1002: + if vendor_id == 0x1002: return 'amd' - elif vendor_id == 0x8086: + if vendor_id == 0x8086: return 'intel' - elif angle_vendor_string: + if angle_vendor_string: return angle_vendor_string.lower() - elif vendor_string: + if vendor_string: return vendor_string.split(' ')[0].lower() return 'unknown_gpu' @@ -181,18 +179,15 @@ if sys.platform.startswith('linux'): if 'WAYLAND_DISPLAY' in os.environ: return 'display-server-wayland' - else: - return 'display-server-x' - else: - return None + return 'display-server-x' + return None def GetOOPCanvasStatus(gpu_feature_status): if gpu_feature_status and gpu_feature_status.get( 'canvas_oop_rasterization') == 'enabled_on': return 'oop-c' - else: - return 'no-oop-c' + return 'no-oop-c' # TODO(rivr): Use GPU feature status for Dawn instead of command line. @@ -255,6 +250,7 @@ for i in range(0, len(ver)): if not ver[i].isdigit(): return int(ver[:i]) if i > 0 else 0, ver[i:] + return None def versions_can_be_compared(ver_list1, ver_list2): # If either of the two versions doesn't match the Intel driver version @@ -292,15 +288,15 @@ if operation == 'eq': return False - elif operation == 'ne': + if operation == 'ne': return True - elif operation == 'ge' or operation == 'gt': + if operation in ('ge', 'gt'): return diff > 0 - elif operation == 'le' or operation == 'lt': + if operation in ('le', 'lt'): return diff < 0 raise Exception('Invalid operation: ' + operation) - return operation == 'eq' or operation == 'ge' or operation == 'le' + return operation in ('eq', 'ge', 'le') # pylint: enable=too-many-locals,too-many-branches
diff --git a/content/test/gpu/gpu_tests/gpu_integration_test.py b/content/test/gpu/gpu_tests/gpu_integration_test.py index 4abbb16..fe1703ad 100644 --- a/content/test/gpu/gpu_tests/gpu_integration_test.py +++ b/content/test/gpu/gpu_tests/gpu_integration_test.py
@@ -70,7 +70,7 @@ _first_run_test = None def __init__(self, *args, **kwargs): - super(GpuIntegrationTest, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if self.artifacts is None: self.set_artifacts(None) @@ -81,7 +81,7 @@ # as during initial browser startup. if artifacts is None: artifacts = acw.FullLoggingArtifactImpl() - super(GpuIntegrationTest, self).set_artifacts(artifacts) + super().set_artifacts(artifacts) @classmethod def SetUpProcess(cls): @@ -164,7 +164,7 @@ # Some platforms require GPU process, so browser fails to launch with # --disable-gpu mode, therefore, even test expectations fail to evaluate. os_name = cls.browser.platform.GetOSName() - if os_name == 'android' or os_name == 'chromeos': + if os_name in ('android', 'chromeos'): browser_args.remove(cba.DISABLE_GPU) if cls._finder_options.browser_type == 'web-engine-shell': @@ -303,7 +303,7 @@ # TODO(crbug.com/1245346): Move this into Telemetry itself once it is # shown to work. os_name = cls.platform.GetOSName() - if os_name == 'android' or os_name == 'chromeos': + if os_name in ('android', 'chromeos'): logging.warning( 'Restarting TsProxyServer due to being on a remote platform') network_controller_backend = ( @@ -329,7 +329,9 @@ # Internal bookkeeping. should_retry_on_failure = True # Notify typ that it should retry this test if necessary. - self.retryOnFailure = True # pylint: disable=attribute-defined-outside-init + # pylint: disable=attribute-defined-outside-init + self.retryOnFailure = True + # pylint: enable=attribute-defined-outside-init try: # TODO(nednguyen): For some reason the arguments are getting wrapped # in another tuple sometimes (like in the WebGL extension tests). @@ -345,7 +347,9 @@ self.browser.platform.android_action_runner.TurnScreenOn() self.RunActualGpuTest(url, *args) except unittest.SkipTest: - self.programmaticSkipIsExpected = True # pylint: disable=attribute-defined-outside-init + # pylint: disable=attribute-defined-outside-init + self.programmaticSkipIsExpected = True + # pylint: enable=attribute-defined-outside-init raise except Exception: if ResultType.Failure in expected_results or should_retry_on_failure: @@ -518,9 +522,9 @@ tuples of tests to run.""" raise NotImplementedError - def RunActualGpuTest(self, file_path, *args): + def RunActualGpuTest(self, test_path, *args): """Subclasses must override this to run the actual test at the given - URL. file_path is a path on the local file system that may need to + URL. test_path is a path on the local file system that may need to be resolved via UrlOfStaticFilePath. """ raise NotImplementedError
diff --git a/content/test/gpu/gpu_tests/gpu_integration_test_unittest.py b/content/test/gpu/gpu_tests/gpu_integration_test_unittest.py index 4a13080..d419dd65 100644 --- a/content/test/gpu/gpu_tests/gpu_integration_test_unittest.py +++ b/content/test/gpu/gpu_tests/gpu_integration_test_unittest.py
@@ -5,7 +5,6 @@ # It's reasonable for unittests to be messing with protected members. # pylint: disable=protected-access -from __future__ import print_function import json import os @@ -93,7 +92,7 @@ tags = None with mock.patch.object( test_class, 'ExpectationsFiles', return_value=['exp.txt']): - _ = [_ for _ in test_class.GenerateGpuTests(args)] + _ = list(test_class.GenerateGpuTests(args)) platform = fakes.FakePlatform('win', 'win10') browser = fakes.FakeBrowser(platform, 'release') browser._returned_system_info = _GetSystemInfo( @@ -102,7 +101,7 @@ return tags -class _IntegrationTestArgs(object): +class _IntegrationTestArgs(): """Struct-like object for defining an integration test.""" def __init__(self, test_name):
diff --git a/content/test/gpu/gpu_tests/info_collection_test.py b/content/test/gpu/gpu_tests/info_collection_test.py index ac1c3f5..89547d1 100644 --- a/content/test/gpu/gpu_tests/info_collection_test.py +++ b/content/test/gpu/gpu_tests/info_collection_test.py
@@ -12,7 +12,7 @@ import six -class InfoCollectionTestArgs(object): +class InfoCollectionTestArgs(): """Struct-like class for passing args to an InfoCollection test.""" def __init__(self, expected_vendor_id_str=None, expected_device_id_strs=None): @@ -147,6 +147,7 @@ if isinstance(value, bool): return 'supported' if value else 'unsupported' assert False + return False @classmethod def ExpectationsFiles(cls):
diff --git a/content/test/gpu/gpu_tests/ipg_utils.py b/content/test/gpu/gpu_tests/ipg_utils.py index dd1e6a8..0640b9da 100644 --- a/content/test/gpu/gpu_tests/ipg_utils.py +++ b/content/test/gpu/gpu_tests/ipg_utils.py
@@ -147,7 +147,7 @@ per_core_results[core] = results for key in results: - if key == 'samples' or key == 'log': + if key in ('samples', 'log'): continue metrics.setdefault(key, []).append(results[key]) return per_core_results, metrics
diff --git a/content/test/gpu/gpu_tests/maps_integration_test.py b/content/test/gpu/gpu_tests/maps_integration_test.py index deb3ac94e..129220f 100644 --- a/content/test/gpu/gpu_tests/maps_integration_test.py +++ b/content/test/gpu/gpu_tests/maps_integration_test.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from __future__ import print_function import json import os @@ -77,10 +76,10 @@ # sufficient to debugging the failure. yield ('Maps_maps', 'file://performance.html', ()) - def RunActualGpuTest(self, url, *_): + def RunActualGpuTest(self, test_path, *args): tab = self.tab action_runner = tab.action_runner - action_runner.Navigate(url) + action_runner.Navigate(test_path) action_runner.WaitForJavaScriptCondition('window.startTest != undefined') action_runner.EvaluateJavaScript('window.startTest()') action_runner.WaitForJavaScriptCondition('window.testDone', timeout=320) @@ -94,7 +93,7 @@ action_runner.WaitForJavaScriptCondition('window.testCompleted', timeout=30) expected = _ReadPixelExpectations('maps_pixel_expectations.json') - page = _GetMapsPageForUrl(url, expected) + page = _GetMapsPageForUrl(test_path, expected) # Special case some tests on Fuchsia that need to grab the entire contents # in the screenshot instead of just the visible portion due to small screen
diff --git a/content/test/gpu/gpu_tests/mediapipe_integration_test.py b/content/test/gpu/gpu_tests/mediapipe_integration_test.py index 35823ca..83349ad 100644 --- a/content/test/gpu/gpu_tests/mediapipe_integration_test.py +++ b/content/test/gpu/gpu_tests/mediapipe_integration_test.py
@@ -43,12 +43,14 @@ @classmethod def GenerateGpuTests(cls, options): - for entry in next(os.walk(_DATA_PATH))[1]: - yield ('MediaPipe_mediapipe_%s' % entry, _get_test_html(entry), ()) + for entry in os.scandir(_DATA_PATH): + if entry.is_dir(): + yield ('MediaPipe_mediapipe_%s' % entry.name, + _get_test_html(entry.name), ()) - def RunActualGpuTest(self, url, *_): + def RunActualGpuTest(self, test_path, *args): action_runner = self.tab.action_runner - action_runner.Navigate(self.UrlOfStaticFilePath(url)) + action_runner.Navigate(self.UrlOfStaticFilePath(test_path)) action_runner.WaitForJavaScriptCondition('window.runTest !== undefined') action_runner.EvaluateJavaScript('window.runTest()') # 120s timeout: some of these tests time out on bots pretty regularly, even
diff --git a/content/test/gpu/gpu_tests/path_util.py b/content/test/gpu/gpu_tests/path_util.py index 1afbfec..5eaba18 100644 --- a/content/test/gpu/gpu_tests/path_util.py +++ b/content/test/gpu/gpu_tests/path_util.py
@@ -24,15 +24,17 @@ os.path.join(GetChromiumSrcDir(), 'third_party', 'catapult')) +# pylint: disable=no-value-for-parameter def AddDirToPathIfNeeded(*path_parts): path = os.path.abspath(os.path.join(*path_parts)) if os.path.isdir(path) and path not in sys.path: sys.path.append(path) +# pylint: enable=no-value-for-parameter def SetupTelemetryPaths(): SetupToolsPerfPath() - from core import path_util + from core import path_util # pylint: disable=import-outside-toplevel AddDirToPathIfNeeded(path_util.GetTelemetryDir())
diff --git a/content/test/gpu/gpu_tests/pixel_test_pages.py b/content/test/gpu/gpu_tests/pixel_test_pages.py index ef5689f..95f3a69 100644 --- a/content/test/gpu/gpu_tests/pixel_test_pages.py +++ b/content/test/gpu/gpu_tests/pixel_test_pages.py
@@ -35,7 +35,7 @@ ignored_border_thickness=1) -class PixelTestPage(object): +class PixelTestPage(): """A wrapper class mimicking the functionality of the PixelTestsStorySet from the old-style GPU tests. """ @@ -53,7 +53,7 @@ grace_period_end=None, expected_per_process_crashes=None, matching_algorithm=None): - super(PixelTestPage, self).__init__() + super().__init__() self.url = url self.name = name self.test_rect = test_rect @@ -124,7 +124,7 @@ ] -class PixelTestPages(object): +class PixelTestPages(): @staticmethod def DefaultPages(base_name): sw_compositing_args = [cba.DISABLE_GPU_COMPOSITING]
diff --git a/content/test/gpu/gpu_tests/power_measurement_integration_test.py b/content/test/gpu/gpu_tests/power_measurement_integration_test.py index 7102a77b..4bf17a6b 100644 --- a/content/test/gpu/gpu_tests/power_measurement_integration_test.py +++ b/content/test/gpu/gpu_tests/power_measurement_integration_test.py
@@ -206,7 +206,7 @@ """ -class _PowerMeasurementTestArguments(object): +class _PowerMeasurementTestArguments(): """Struct-like object for passing power measurement args instead of a dict.""" def __init__( # pylint: disable=too-many-arguments
diff --git a/content/test/gpu/gpu_tests/skia_gold_integration_test_base.py b/content/test/gpu/gpu_tests/skia_gold_integration_test_base.py index 65a683d..5a59f4687c 100644 --- a/content/test/gpu/gpu_tests/skia_gold_integration_test_base.py +++ b/content/test/gpu/gpu_tests/skia_gold_integration_test_base.py
@@ -34,7 +34,7 @@ SKIA_GOLD_CORPUS = 'chrome-gpu' -class _ImageParameters(object): +class _ImageParameters(): def __init__(self): # Parameters for cloud storage reference images. self.vendor_id = None @@ -446,7 +446,7 @@ del options return [] - def RunActualGpuTest(self, options): + def RunActualGpuTest(self, test_path, *args): raise NotImplementedError( 'RunActualGpuTest must be overridden in a subclass')
diff --git a/content/test/gpu/gpu_tests/skia_gold_matching_algorithms.py b/content/test/gpu/gpu_tests/skia_gold_matching_algorithms.py index 7bb5063..f419517f 100644 --- a/content/test/gpu/gpu_tests/skia_gold_matching_algorithms.py +++ b/content/test/gpu/gpu_tests/skia_gold_matching_algorithms.py
@@ -3,10 +3,9 @@ # found in the LICENSE file. """Classes related to the possible matching algorithms for Skia Gold.""" -from __future__ import print_function -class Parameters(object): +class Parameters(): """Constants for Skia Gold algorithm parameters. These correspond to the constants defined in goldctl's @@ -32,7 +31,7 @@ EDGE_THRESHOLD = 'sobel_edge_threshold' -class SkiaGoldMatchingAlgorithm(object): +class SkiaGoldMatchingAlgorithm(): ALGORITHM_KEY = 'image_matching_algorithm' """Abstract base class for all algorithms.""" @@ -70,7 +69,7 @@ max_different_pixels, pixel_delta_threshold, ignored_border_thickness=0): - super(FuzzyMatchingAlgorithm, self).__init__() + super().__init__() assert int(max_different_pixels) >= 0 assert int(pixel_delta_threshold) >= 0 assert int(ignored_border_thickness) >= 0 @@ -79,7 +78,7 @@ self._ignored_border_thickness = ignored_border_thickness def GetCmdline(self): - retval = super(FuzzyMatchingAlgorithm, self).GetCmdline() + retval = super().GetCmdline() retval.extend( _GenerateOptionalKey(Parameters.MAX_DIFFERENT_PIXELS, self._max_different_pixels)) @@ -106,9 +105,8 @@ pixel_delta_threshold, edge_threshold, ignored_border_thickness=0): - super(SobelMatchingAlgorithm, - self).__init__(max_different_pixels, pixel_delta_threshold, - ignored_border_thickness) + super().__init__(max_different_pixels, pixel_delta_threshold, + ignored_border_thickness) assert int(edge_threshold) >= 0 assert int(edge_threshold) <= 255 if edge_threshold == 255: @@ -118,7 +116,7 @@ self._edge_threshold = edge_threshold def GetCmdline(self): - retval = super(SobelMatchingAlgorithm, self).GetCmdline() + retval = super().GetCmdline() retval.extend( _GenerateOptionalKey(Parameters.EDGE_THRESHOLD, self._edge_threshold)) return retval
diff --git a/content/test/gpu/gpu_tests/test_expectations_unittest.py b/content/test/gpu/gpu_tests/test_expectations_unittest.py index c6f81c0..5352f8e 100644 --- a/content/test/gpu/gpu_tests/test_expectations_unittest.py +++ b/content/test/gpu/gpu_tests/test_expectations_unittest.py
@@ -80,7 +80,7 @@ _map_specific_to_generic['release-x64'] = 'release' _get_generic = lambda tags: set( - [_map_specific_to_generic.get(tag, tag) for tag in tags]) + _map_specific_to_generic.get(tag, tag) for tag in tags) ResultType = json_results.ResultType @@ -137,45 +137,42 @@ operation2, version2 = tag2[1:] if operation1 == 'ne': return not (operation2 == 'eq' and version1 == version2) - elif operation2 == 'ne': + if operation2 == 'ne': return not (operation1 == 'eq' and version1 == version2) - elif operation1 == 'eq': + if operation1 == 'eq': return gpu_helper.EvaluateVersionComparison(version1, operation2, version2) - elif operation2 == 'eq': + if operation2 == 'eq': return gpu_helper.EvaluateVersionComparison(version2, operation1, version1) - if operation1 == 'ge' or operation1 == 'gt': - if operation2 == 'ge' or operation2 == 'gt': - return True - elif operation1 == 'le' or operation1 == 'lt': - if operation2 == 'le' or operation2 == 'lt': - return True + if operation1 in ('ge', 'gt') and operation2 in ('ge', 'gt'): + return True + if operation1 in ('le', 'lt') and operation2 in ('le', 'lt'): + return True if operation1 == 'ge': if operation2 == 'le': return not gpu_helper.EvaluateVersionComparison(version1, 'gt', version2) - elif operation2 == 'lt': + if operation2 == 'lt': return not gpu_helper.EvaluateVersionComparison(version1, 'ge', version2) - elif operation1 == 'gt': + if operation1 == 'gt': return not gpu_helper.EvaluateVersionComparison(version1, 'ge', version2) - elif operation1 == 'le': + if operation1 == 'le': if operation2 == 'ge': return not gpu_helper.EvaluateVersionComparison(version1, 'lt', version2) - elif operation2 == 'gt': + if operation2 == 'gt': return not gpu_helper.EvaluateVersionComparison(version1, 'le', version2) - elif operation1 == 'lt': + if operation1 == 'lt': return not gpu_helper.EvaluateVersionComparison(version1, 'le', version2) - else: - assert False + assert False + return False # pylint: enable=too-many-return-statements,too-many-branches def _DoTagsConflict(t1, t2): if gpu_helper.MatchDriverTag(t1): return not _IsDriverTagDuplicated(t1, t2) - else: - return (t1 != t2 and t1 != _map_specific_to_generic.get(t2, t2) - and t2 != _map_specific_to_generic.get(t1, t1)) + return (t1 != t2 and t1 != _map_specific_to_generic.get(t2, t2) + and t2 != _map_specific_to_generic.get(t1, t1)) def _ExtractUnitTestTestExpectations(file_name): @@ -328,7 +325,7 @@ broken_expectations = expectations.check_for_broken_expectations(tests) msg = '' - for ununsed_pattern in set([e.test for e in broken_expectations]): + for ununsed_pattern in set(e.test for e in broken_expectations): msg += ("Expectations with pattern '{0}' in {1} do not apply to any " "webgl version {2} extension tests\n".format( ununsed_pattern, os.path.basename(f.name), webgl_version))
diff --git a/content/test/gpu/gpu_tests/trace_integration_test.py b/content/test/gpu/gpu_tests/trace_integration_test.py index 19b50c9..623d99d 100644 --- a/content/test/gpu/gpu_tests/trace_integration_test.py +++ b/content/test/gpu/gpu_tests/trace_integration_test.py
@@ -93,7 +93,7 @@ _SUPPORTED_WIN_AMD_GPUS_WITH_NV12_ROTATED_OVERLAYS = [0x7340] -class _TraceTestArguments(object): +class _TraceTestArguments(): """Struct-like object for passing trace test arguments instead of dicts.""" def __init__( # pylint: disable=too-many-arguments @@ -412,8 +412,8 @@ valid_entry_found = False for index in range(len(presentation_mode_history)): mode = presentation_mode_history[index] - if (mode == _SWAP_CHAIN_PRESENTATION_MODE_NONE - or mode == _SWAP_CHAIN_GET_FRAME_STATISTICS_MEDIA_FAILED): + if mode in (_SWAP_CHAIN_PRESENTATION_MODE_NONE, + _SWAP_CHAIN_GET_FRAME_STATISTICS_MEDIA_FAILED): # Be more tolerant to avoid test flakiness continue if (TraceIntegrationTest._SwapChainPresentationModeToStr(mode) != @@ -510,7 +510,7 @@ ] -class _VideoExpectations(object): +class _VideoExpectations(): """Struct-like object for passing around video test expectations.""" def __init__(self):
diff --git a/content/test/gpu/gpu_tests/webcodecs_integration_test.py b/content/test/gpu/gpu_tests/webcodecs_integration_test.py index 9854c22..e4a42d8 100644 --- a/content/test/gpu/gpu_tests/webcodecs_integration_test.py +++ b/content/test/gpu/gpu_tests/webcodecs_integration_test.py
@@ -112,7 +112,7 @@ @staticmethod def CameraCanShowFourColors(os_name): - return os_name != 'android' and os_name != 'chromeos' + return os_name not in ('android', 'chromeos') @classmethod def SetUpProcess(cls):
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py b/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py index a8508a78..a8afeda 100644 --- a/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py +++ b/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py
@@ -73,7 +73,7 @@ return cmp(ver_num1[0:size], ver_num2[0:size]) -class WebGLTestArgs(object): +class WebGLTestArgs(): """Struct-like class for passing args to a WebGLConformance test.""" def __init__(self, webgl_version=None, extension=None, extension_list=None): @@ -194,35 +194,34 @@ 'WEBGL_video_texture', 'WEBGL_webcodecs_video_frame', ] - else: - return [ - 'EXT_color_buffer_float', - 'EXT_color_buffer_half_float', - 'EXT_disjoint_timer_query_webgl2', - 'EXT_float_blend', - 'EXT_texture_compression_bptc', - 'EXT_texture_compression_rgtc', - 'EXT_texture_filter_anisotropic', - 'EXT_texture_norm16', - 'KHR_parallel_shader_compile', - 'OES_draw_buffers_indexed', - 'OES_texture_float_linear', - 'OVR_multiview2', - 'WEBGL_compressed_texture_astc', - 'WEBGL_compressed_texture_etc', - 'WEBGL_compressed_texture_etc1', - 'WEBGL_compressed_texture_pvrtc', - 'WEBGL_compressed_texture_s3tc', - 'WEBGL_compressed_texture_s3tc_srgb', - 'WEBGL_debug_renderer_info', - 'WEBGL_debug_shaders', - 'WEBGL_draw_instanced_base_vertex_base_instance', - 'WEBGL_lose_context', - 'WEBGL_multi_draw', - 'WEBGL_multi_draw_instanced_base_vertex_base_instance', - 'WEBGL_video_texture', - 'WEBGL_webcodecs_video_frame', - ] + return [ + 'EXT_color_buffer_float', + 'EXT_color_buffer_half_float', + 'EXT_disjoint_timer_query_webgl2', + 'EXT_float_blend', + 'EXT_texture_compression_bptc', + 'EXT_texture_compression_rgtc', + 'EXT_texture_filter_anisotropic', + 'EXT_texture_norm16', + 'KHR_parallel_shader_compile', + 'OES_draw_buffers_indexed', + 'OES_texture_float_linear', + 'OVR_multiview2', + 'WEBGL_compressed_texture_astc', + 'WEBGL_compressed_texture_etc', + 'WEBGL_compressed_texture_etc1', + 'WEBGL_compressed_texture_pvrtc', + 'WEBGL_compressed_texture_s3tc', + 'WEBGL_compressed_texture_s3tc_srgb', + 'WEBGL_debug_renderer_info', + 'WEBGL_debug_shaders', + 'WEBGL_draw_instanced_base_vertex_base_instance', + 'WEBGL_lose_context', + 'WEBGL_multi_draw', + 'WEBGL_multi_draw_instanced_base_vertex_base_instance', + 'WEBGL_video_texture', + 'WEBGL_webcodecs_video_frame', + ] def _ShouldForceRetryOnFailureFirstTest(self): # Force RetryOnFailure of the first test on a shard on ChromeOS VMs.
diff --git a/content/test/gpu/power_measurement_results/analyze_power_measurement_results.py b/content/test/gpu/power_measurement_results/analyze_power_measurement_results.py index 5fb67cd..c80a8fc 100755 --- a/content/test/gpu/power_measurement_results/analyze_power_measurement_results.py +++ b/content/test/gpu/power_measurement_results/analyze_power_measurement_results.py
@@ -48,15 +48,14 @@ def ToString(cls, strategy): if strategy == cls.COUNT_EACH: return "each" - elif strategy == cls.COUNT_MINIMUM: + if strategy == cls.COUNT_MINIMUM: return "minimum" - elif strategy == cls.COUNT_AVERAGE: + if strategy == cls.COUNT_AVERAGE: return "average" - elif strategy == cls.COUNT_MEDIAN: + if strategy == cls.COUNT_MEDIAN: return "median" - else: - assert strategy == cls.COUNT_MINIMUM_FIRST_TWO - return "minimum (first two)" + assert strategy == cls.COUNT_MINIMUM_FIRST_TWO + return "minimum (first two)" def LoadResultsJsonFiles(): @@ -72,21 +71,21 @@ def DetermineResultsFromMultipleRuns(measurements, repeat_strategy): if repeat_strategy == RepeatStrategy.COUNT_EACH: return measurements - elif repeat_strategy == RepeatStrategy.COUNT_MINIMUM: + if repeat_strategy == RepeatStrategy.COUNT_MINIMUM: measurements.sort() return [measurements[0]] - elif repeat_strategy == RepeatStrategy.COUNT_AVERAGE: + if repeat_strategy == RepeatStrategy.COUNT_AVERAGE: return [Mean(measurements)] - elif repeat_strategy == RepeatStrategy.COUNT_MEDIAN: + if repeat_strategy == RepeatStrategy.COUNT_MEDIAN: return [MedianLow(measurements)] - elif repeat_strategy == RepeatStrategy.COUNT_MINIMUM_FIRST_TWO: + if repeat_strategy == RepeatStrategy.COUNT_MINIMUM_FIRST_TWO: assert len(measurements) >= 2 first_two = measurements[0:2] first_two.sort() return [first_two[0]] - else: - assert False - return [] + + assert False + return [] def ProcessJsonData(jsons,
diff --git a/content/test/gpu/run_gpu_integration_test.py b/content/test/gpu/run_gpu_integration_test.py index 088b233..6db05bc5 100755 --- a/content/test/gpu/run_gpu_integration_test.py +++ b/content/test/gpu/run_gpu_integration_test.py
@@ -36,7 +36,7 @@ # tests. if not sys.platform.startswith('darwin'): return - import Quartz + import Quartz # pylint: disable=import-outside-toplevel current_session = Quartz.CGSessionCopyCurrentDictionary() if not current_session: # Using the logging module doesn't seem to be guaranteed to show up in @@ -59,6 +59,7 @@ for cl in modules_to_classes.values(): if cl.Name() == test_name: return cl + return None def ProcessArgs(args, parser=None):
diff --git a/content/test/gpu/trim_culprit_cls.py b/content/test/gpu/trim_culprit_cls.py index ed8e0a4d..39cd561 100755 --- a/content/test/gpu/trim_culprit_cls.py +++ b/content/test/gpu/trim_culprit_cls.py
@@ -47,7 +47,6 @@ # https://source.chromium.org/chromium/infra/infra/+/main:go/src/go.chromium.org/luci/cv/api/bigquery/v1/attempt.proto # # Original author: maruel@ -# pylint: enable=line-too-long QUERY_TEMPLATE = """\ WITH cq_builds AS ( SELECT @@ -81,12 +80,13 @@ SELECT * FROM builds ORDER BY patchset DESC, critical, builder, start_time """ +# pylint: enable=line-too-long GERRIT_URL_REGEX = re.compile(r'^\s*Reviewed-on: (?P<gerrit_url>.*)$', re.MULTILINE) -class ChangeList(object): +class ChangeList(): """Class for storing relevant information for a CL.""" def __init__(self):
diff --git a/content/test/gpu/unexpected_passes/gpu_builders.py b/content/test/gpu/unexpected_passes/gpu_builders.py index 0158082..515637d 100644 --- a/content/test/gpu/unexpected_passes/gpu_builders.py +++ b/content/test/gpu/unexpected_passes/gpu_builders.py
@@ -21,7 +21,7 @@ class GpuBuilders(builders.Builders): def __init__(self, include_internal_builders): - super(GpuBuilders, self).__init__(include_internal_builders) + super().__init__(include_internal_builders) self._isolate_names = None self._fake_ci_builders = None self._non_chromium_builders = None
diff --git a/content/test/gpu/unexpected_passes/gpu_queries.py b/content/test/gpu/unexpected_passes/gpu_queries.py index 8ce21b8..be4e318 100644 --- a/content/test/gpu/unexpected_passes/gpu_queries.py +++ b/content/test/gpu/unexpected_passes/gpu_queries.py
@@ -3,7 +3,6 @@ # found in the LICENSE file. """GPU-specific implementation of the unexpected passes' queries module.""" -from __future__ import print_function from unexpected_passes_common import constants from unexpected_passes_common import queries as queries_module @@ -165,8 +164,7 @@ class GpuBigQueryQuerier(queries_module.BigQueryQuerier): def __init__(self, suite, project, num_samples, large_query_mode): - super(GpuBigQueryQuerier, self).__init__(suite, project, num_samples, - large_query_mode) + super().__init__(suite, project, num_samples, large_query_mode) self._check_webgl_version = None self._webgl_version_tag = None @@ -177,14 +175,16 @@ # expectation. # TODO(crbug.com/1140283): Remove this once WebGL expectations are merged # and there's no need to differentiate them. - if 'webgl_conformance' in self._suite: # pylint: disable=access-member-before-definition - webgl_version = self._suite[-1] # pylint: disable=access-member-before-definition + # pylint: disable=access-member-before-definition + if 'webgl_conformance' in self._suite: + webgl_version = self._suite[-1] self._suite = 'webgl_conformance' self._webgl_version_tag = 'webgl-version-%s' % webgl_version self._check_webgl_version =\ lambda tags: self._webgl_version_tag in tags else: self._check_webgl_version = lambda tags: True + # pylint: enable=access-member-before-definition # Most test names are |suite|_integration_test, but there are several that # are not reported that way in typ, and by extension ResultDB, so adjust
diff --git a/content/test/gpu/unittest_data/integration_tests.py b/content/test/gpu/unittest_data/integration_tests.py index 815015c6..fafd7bb 100644 --- a/content/test/gpu/unittest_data/integration_tests.py +++ b/content/test/gpu/unittest_data/integration_tests.py
@@ -25,6 +25,7 @@ from gpu_tests import gpu_integration_test +# pylint: disable=abstract-method class _BaseSampleIntegrationTest(gpu_integration_test.GpuIntegrationTest): _test_state = {} @@ -58,6 +59,7 @@ with open(test_state_json_path, 'w') as f: json.dump(cls._test_state, f) super(_BaseSampleIntegrationTest, cls).TearDownProcess() +# pylint: enable=abstract-method class SimpleTest(_BaseSampleIntegrationTest): @@ -80,15 +82,15 @@ super(SimpleTest, cls).StartBrowser() cls._test_state['num_browser_starts'] += 1 - def RunActualGpuTest(self, file_path, *args): - logging.warn('Running ' + file_path) - if file_path == 'failure.html': + def RunActualGpuTest(self, test_path, *args): + logging.warn('Running ' + test_path) + if test_path == 'failure.html': self.fail('Expected failure') - elif file_path == 'flaky.html': + elif test_path == 'flaky.html': if self._test_state['num_flaky_runs_to_fail'] > 0: self._test_state['num_flaky_runs_to_fail'] -= 1 self.fail('Expected flaky failure') - elif file_path == 'error.html': + elif test_path == 'error.html': raise Exception('Expected exception') @classmethod @@ -137,7 +139,7 @@ # This test causes the browser to try and restart the browser 3 times. yield ('restart', 'restart.html', ()) - def RunActualGpuTest(self, file_path, *args): + def RunActualGpuTest(self, test_path, *args): # The logic of this test is run when the browser starts, it fails twice # and then succeeds on the third time so we are just testing that this # is successful based on the parameters. @@ -189,7 +191,7 @@ # This test causes the browser to try and restart the browser 3 times. yield ('restart', 'restart.html', ()) - def RunActualGpuTest(self, file_path, *args): + def RunActualGpuTest(self, test_path, *args): # The logic of this test is run when the browser starts, it fails twice # and then succeeds on the third time so we are just testing that this # is successful based on the parameters. @@ -198,7 +200,7 @@ class RunTestsWithExpectationsFiles(_BaseSampleIntegrationTest): def __init__(self, methodName): - super(RunTestsWithExpectationsFiles, self).__init__(methodName) + super().__init__(methodName) self._flaky_test_run = 0 @classmethod @@ -219,9 +221,9 @@ for test in tests: yield test - def RunActualGpuTest(self, file_path, *args): - if file_path == 'failure.html' or self._flaky_test_run < 3: - self._flaky_test_run += file_path == 'flaky.html' + def RunActualGpuTest(self, test_path, *args): + if test_path == 'failure.html' or self._flaky_test_run < 3: + self._flaky_test_run += test_path == 'flaky.html' self.fail() @classmethod @@ -247,12 +249,12 @@ def GenerateGpuTests(cls, options): yield ('unexpected_failure', 'failure.html', ()) - def RunActualGpuTest(self, file_path, *args): + def RunActualGpuTest(self, test_path, *args): self._test_state['num_test_runs'] += 1 - if file_path == 'failure.html': + if test_path == 'failure.html': self.fail('Expected failure') else: - raise Exception('Unexpected test name ' + file_path) + raise Exception('Unexpected test name ' + test_path) class TestRepeat(_BaseSampleIntegrationTest): @@ -268,10 +270,10 @@ def GenerateGpuTests(cls, options): yield ('success', 'success.html', ()) - def RunActualGpuTest(self, file_path, *args): + def RunActualGpuTest(self, test_path, *args): self._test_state['num_test_runs'] += 1 - if file_path != 'success.html': - raise Exception('Unexpected test name ' + file_path) + if test_path != 'success.html': + raise Exception('Unexpected test name ' + test_path) class TestAlsoRunDisabledTests(_BaseSampleIntegrationTest): @@ -288,9 +290,9 @@ for test in tests: yield test - def RunActualGpuTest(self, file_path, *args): + def RunActualGpuTest(self, test_path, *args): self._test_state['num_test_runs'] += 1 - self._test_state['num_flaky_test_runs'] += file_path == 'flaky.html' + self._test_state['num_flaky_test_runs'] += test_path == 'flaky.html' raise Exception('Everything fails') @classmethod
diff --git a/content/test/gpu/validate_tag_consistency.py b/content/test/gpu/validate_tag_consistency.py index 398257a2..e3d804e5 100755 --- a/content/test/gpu/validate_tag_consistency.py +++ b/content/test/gpu/validate_tag_consistency.py
@@ -140,8 +140,7 @@ args = parser.parse_args() if args.function == 'apply': return Apply() - else: - return Validate() + return Validate() if __name__ == '__main__':
diff --git a/docs/accessibility/os/patts.md b/docs/accessibility/os/patts.md index 0165106..878822a 100644 --- a/docs/accessibility/os/patts.md +++ b/docs/accessibility/os/patts.md
@@ -11,7 +11,7 @@ This is for Googlers only. -Visit [http://go/chrome-tts-blaze](http://go/chrome-tts-blaze) +Visit [http://go/google-tts-web-ports](http://go/google-tts-web-ports) for instructions on how to build the engine from source and get the latest voice files.
diff --git a/docs/security/rust-toolchain.md b/docs/security/rust-toolchain.md index fdcc4b648..001fbf4 100644 --- a/docs/security/rust-toolchain.md +++ b/docs/security/rust-toolchain.md
@@ -1,20 +1,20 @@ -# Experimental Rust toolchain +# Experimenting with Rust in Chromium [TOC] # Why? -Parsing untrustworthy data is a major source of security bugs, and it's therefore -against Chromium rules [to do it in the browser process](rule-of-2.md) unless -you can use a memory safe language. +Parsing untrustworthy data is a major source of security bugs, and it's +therefore against Chromium rules [to do it in the browser process](rule-of-2.md) +unless you can use a memory safe language. For teams building browser process features which need to handle untrustworthy -data, they usually have to do the parsing in a utility process which incurs -a performance overhead and adds engineering complexity. +data, they usually have to do the parsing in a utility process which incurs a +performance overhead and adds engineering complexity. -The Chrome security team is working to make a cross-platform memory safe language -available to Chromium developers. This document describes how to use that -language in Chromium. The language, at least for now, is Rust. +The Chrome security team is working to make a cross-platform memory safe +language available to Chromium developers. This document describes how to use +that language in Chromium. The language, at least for now, is Rust. # Guidelines @@ -27,9 +27,9 @@ * any experiments must be reversible (you may have to write a C++ equivalent in order to ship) * Rust code must not affect production Chrome binaries nor be shipped to Chrome - users (we provide `#if defined(...)` and other facilities to make this easy) - so if - you put Rust code in Chrome, the sole purpose is to help experiment and provide - data for evaluation of future memory safe language options + users (we provide `#if defined(...)` and other facilities to make this easy) - + so if you put Rust code in Chrome, the sole purpose is to help experiment and + provide data for evaluation of future memory safe language options * Rust is not yet available on all Chromium platforms (just Linux and Android for now) * Facilities and tooling in Rust are not as rich as other languages yet. @@ -48,6 +48,8 @@ include the necessary libraries for building required C++-Rust interop tooling. +See also [Using VSCode](#using-vscode). + # GN support Assume you want to add some Rust code to an existing C++ `source_set`. @@ -190,7 +192,8 @@ # C++/Rust interop There are multiple different solutions for Rust/C++ interop. In this phase of our -experiments, we're supporting just one: [cxx, described in this excellent online book](https://cxx.rs). +experiments, we're supporting just one: +[cxx, described in this excellent online book](https://cxx.rs). To use this interop facility in Chromium: @@ -205,8 +208,9 @@ ``` You can now simply call functions and use types declared/defined in your CXX -bridge. A typical usage might be to pass a `const std::string&` or `rust::Slice<const uint8_t>` -from C++ into Rust and then return a struct with the parsed results. +bridge. A typical usage might be to pass a `const std::string&` or +`rust::Slice<const uint8_t>` from C++ into Rust and then return a struct with +the parsed results. If you need to call back into C++ from Rust, this is also supported - `include!` directives within an `extern "C++"` section should work: @@ -217,7 +221,7 @@ unsafe extern "C++" { include!("path/to/my_cpp_header.h"); fn some_function_defined_in_cpp(); - } + } } // Rust code calls ffi::some_function_defined_in_cpp() @@ -229,7 +233,8 @@ ## Dependencies between Rust targets If your `rust_source_set` exposes Rust APIs for other Rust targets in Chromium, -those targets should be able to depend directly on your `rust_source_set` target. +those targets should be able to depend directly on your `rust_source_set` +target. If you have a `mixed_source_set` or any other component which is intended for both Rust _and_ C++ consumers, please reach out to `rust-dev@chromium.org` @@ -244,7 +249,8 @@ ## Known cases which don't work -* At the moment LTO doesn't work, so you can't use `is_official_build = true`. ([Bug.](https://crbug.com/1229423)) +* At the moment LTO doesn't work, so you can't use `is_official_build = true`. + ([Bug.](https://crbug.com/1229423)) * Windows doesn't work just yet. ([Bug.](https://crbug.com/1268157)) ## Building on non-Linux platforms @@ -276,10 +282,10 @@ earlier forms of Rust support. 2. Run `gn` with this extra flag: `gn gen out/Release --export-rust-project`. 3. `ln -s out/Release/rust-project.json rust-project.json` -4. When you run VSCode, or any other IDE that uses [rust-analyzer](https://rust-analyzer.github.io/) - it should detect the `rust-project.json` and use this to give you rich - browsing, autocompletion, type annotations etc. for all the Rust within - the Chromium codebase. +4. When you run VSCode, or any other IDE that uses + [rust-analyzer](https://rust-analyzer.github.io/) it should detect the + `rust-project.json` and use this to give you rich browsing, autocompletion, + type annotations etc. for all the Rust within the Chromium codebase. ## Source code format
diff --git a/docs/speed/perf_lab_platforms.md b/docs/speed/perf_lab_platforms.md index 04e9276..3491ee1 100644 --- a/docs/speed/perf_lab_platforms.md +++ b/docs/speed/perf_lab_platforms.md
@@ -34,6 +34,7 @@ * [mac-10_12_laptop_low_end-perf](https://ci.chromium.org/p/chrome/builders/ci/mac-10_12_laptop_low_end-perf): MacBook Air, Core i5 1.8 GHz, 8GB RAM, 128GB SSD, HD Graphics. * [mac-10_13_laptop_high_end-perf](https://ci.chromium.org/p/chrome/builders/ci/mac-10_13_laptop_high_end-perf): MacBook Pro, Core i7 2.8 GHz, 16GB RAM, 256GB SSD, Radeon 55. * [mac-laptop_high_end-perf](https://ci.chromium.org/p/chrome/builders/ci/mac-laptop_high_end-perf): MacBook Pro, Core i7 2.8 GHz, 16GB RAM, 256GB SSD, Radeon 55. + * [mac-laptop_low_end-perf](https://ci.chromium.org/p/chrome/builders/ci/mac-laptop_low_end-perf): MacBook Air, Core i5 1.8 GHz, 8GB RAM, 128GB SSD, HD Graphics. * [mac-m1_mini_2020-perf](https://ci.chromium.org/p/chrome/builders/ci/mac-m1_mini_2020-perf): Mac M1 Mini 2020. ## Win
diff --git a/docs/sync/model_api.md b/docs/sync/model_api.md index b3072ac..7905ccf 100644 --- a/docs/sync/model_api.md +++ b/docs/sync/model_api.md
@@ -261,7 +261,7 @@ [`kModelTypeInfoMap`][info_map]. * Add it to the [proto value conversions][conversions] files. * Register a [`ModelTypeController`][ModelTypeController] for your type in - [`ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers`][CreateCommonDataTypeControllers] or platform-specific equivalent in + [`SyncApiComponentFactoryImpl::CreateCommonDataTypeControllers`][CreateCommonDataTypeControllers] or platform-specific equivalent in [`ChromeSyncClient::CreateDataTypeControllers`][CreateDataTypeControllers]. * Add your KeyedService dependency to [`SyncServiceFactory`][SyncServiceFactory]. @@ -281,7 +281,7 @@ [info_map]: https://cs.chromium.org/search/?q="kModelTypeInfoMap%5B%5D"+file:model_type.cc [conversions]: https://cs.chromium.org/chromium/src/components/sync/protocol/proto_value_conversions.h [ModelTypeController]: https://cs.chromium.org/chromium/src/components/sync/driver/model_type_controller.h -[CreateCommonDataTypeControllers]: https://cs.chromium.org/search/?q="ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers" +[CreateCommonDataTypeControllers]: https://cs.chromium.org/search/?q="SyncApiComponentFactoryImpl::CreateCommonDataTypeControllers" [CreateDataTypeControllers]: https://cs.chromium.org/search/?q="ChromeSyncClient::CreateDataTypeControllers" [SyncServiceFactory]: https://cs.chromium.org/search/?q=:SyncServiceFactory%5C(%5C) [NigoriSpecifics]: https://cs.chromium.org/chromium/src/components/sync/protocol/nigori_specifics.proto
diff --git a/extensions/browser/extension_web_contents_observer.cc b/extensions/browser/extension_web_contents_observer.cc index 99e2b11..453e242 100644 --- a/extensions/browser/extension_web_contents_observer.cc +++ b/extensions/browser/extension_web_contents_observer.cc
@@ -5,6 +5,7 @@ #include "extensions/browser/extension_web_contents_observer.h" #include "base/check.h" +#include "components/sessions/content/session_tab_helper.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_frame_host.h" @@ -62,6 +63,18 @@ return std::make_unique<ExtensionFrameHost>(web_contents); } +void ExtensionWebContentsObserver::ListenToWindowIdChangesFrom( + sessions::SessionTabHelper* helper) { + if (!window_id_subscription_) { + // We use an unretained receiver here: the callback is inside the + // subscription, which is a member of |this|, so it can't be run after the + // destruction of |this|. + window_id_subscription_ = helper->RegisterForWindowIdChanged( + base::BindRepeating(&ExtensionWebContentsObserver::OnWindowIdChanged, + base::Unretained(this))); + } +} + void ExtensionWebContentsObserver::Initialize() { if (initialized_) return; @@ -79,6 +92,13 @@ observer->InitializeRenderFrame(render_frame_host); }, this)); + + // It would be ideal if SessionTabHelper was created before this object, + // because then we could start observing it here instead of needing to be + // externally notified when it is created, but it isn't. If that ordering ever + // changes, this code can be restructured and ListenToWindowIdChangesFrom() + // can become private. + DCHECK(!sessions::SessionTabHelper::FromWebContents(web_contents())); } ExtensionWebContentsObserver::ExtensionWebContentsObserver( @@ -343,4 +363,15 @@ return remote.get(); } +void ExtensionWebContentsObserver::OnWindowIdChanged(const SessionID& id) { + web_contents()->ForEachRenderFrameHost(base::BindRepeating( + [](int32_t window_id, ExtensionWebContentsObserver* observer, + content::RenderFrameHost* rfh) { + auto* local_frame = observer->GetLocalFrame(rfh); + if (local_frame) + local_frame->UpdateBrowserWindowId(window_id); + }, + id.id(), base::Unretained(this))); +} + } // namespace extensions
diff --git a/extensions/browser/extension_web_contents_observer.h b/extensions/browser/extension_web_contents_observer.h index 27474e8..7beed9b2 100644 --- a/extensions/browser/extension_web_contents_observer.h +++ b/extensions/browser/extension_web_contents_observer.h
@@ -11,6 +11,7 @@ #include "base/compiler_specific.h" #include "base/memory/raw_ptr.h" #include "base/types/pass_key.h" +#include "components/sessions/core/session_id.h" #include "content/public/browser/web_contents_observer.h" #include "extensions/browser/extension_function_dispatcher.h" #include "extensions/common/mojom/frame.mojom.h" @@ -22,6 +23,10 @@ class WebContents; } +namespace sessions { +class SessionTabHelper; +} + namespace extensions { class Extension; class ExtensionFrameHost; @@ -89,6 +94,13 @@ // is not live. mojom::LocalFrame* GetLocalFrame(content::RenderFrameHost* render_frame_host); + // Tells the receiver to start listening to window ID changes from the + // supplied SessionTabHelper. This method is public to allow the code that + // installs new SessionTabHelpers to call it; that in turn is required because + // SessionTabHelpers may be created after the corresponding + // ExtensionWebContentsObserver has already been initialized. + void ListenToWindowIdChangesFrom(sessions::SessionTabHelper* helper); + protected: explicit ExtensionWebContentsObserver(content::WebContents* web_contents); ~ExtensionWebContentsObserver() override; @@ -133,6 +145,9 @@ using PassKey = base::PassKey<ExtensionWebContentsObserver>; friend class ExtensionFrameHostBrowserTest; + + void OnWindowIdChanged(const SessionID& id); + // The BrowserContext associated with the WebContents being observed. raw_ptr<content::BrowserContext> browser_context_; @@ -143,6 +158,8 @@ std::unique_ptr<ExtensionFrameHost> extension_frame_host_; + base::CallbackListSubscription window_id_subscription_; + // A map of render frame host to mojo remotes. std::map<content::RenderFrameHost*, mojo::AssociatedRemote<mojom::LocalFrame>> local_frame_map_;
diff --git a/extensions/common/csp_validator.cc b/extensions/common/csp_validator.cc index 11f6419..803bcf19 100644 --- a/extensions/common/csp_validator.cc +++ b/extensions/common/csp_validator.cc
@@ -45,6 +45,7 @@ const char kSelfSource[] = "'self'"; const char kNoneSource[] = "'none'"; const char kWasmEvalSource[] = "'wasm-eval'"; +const char kWasmUnsafeEvalSource[] = "'wasm-unsafe-eval'"; const char kDirectiveSeparator = ';'; @@ -242,7 +243,8 @@ // We might need to relax this allowlist over time. if (source_lower == kSelfSource || source_lower == kNoneSource || - source_lower == kWasmEvalSource || source_lower == "blob:" || + source_lower == kWasmEvalSource || + source_lower == kWasmUnsafeEvalSource || source_lower == "blob:" || source_lower == "filesystem:" || isNonWildcardTLD(source_lower, "https://", true) || isNonWildcardTLD(source_lower, "chrome://", false) || @@ -710,7 +712,8 @@ return true; } - if (source_lower == kWasmEvalSource && + if ((source_lower == kWasmEvalSource || + source_lower == kWasmUnsafeEvalSource) && base::FeatureList::IsEnabled( extensions_features::kAllowWasmInMV3)) { return true;
diff --git a/extensions/common/extension_messages.h b/extensions/common/extension_messages.h index ee3643b..a3e7355f1 100644 --- a/extensions/common/extension_messages.h +++ b/extensions/common/extension_messages.h
@@ -311,10 +311,6 @@ extensions::mojom::DispatchEventParams /* params */, base::ListValue /* event_args */) -// Tell the render view which browser window it's being attached to. -IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId, - int /* id of browser window */) - // The browser's response to the ExtensionMsg_WakeEventPage IPC. IPC_MESSAGE_CONTROL2(ExtensionMsg_WakeEventPageResponse, int /* request_id */,
diff --git a/extensions/common/manifest_handlers/csp_info_unittest.cc b/extensions/common/manifest_handlers/csp_info_unittest.cc index 5e53956..c798022 100644 --- a/extensions/common/manifest_handlers/csp_info_unittest.cc +++ b/extensions/common/manifest_handlers/csp_info_unittest.cc
@@ -163,6 +163,11 @@ errors::kInvalidCSPInsecureValueError, keys::kContentSecurityPolicy_ExtensionPagesPath, "'wasm-eval'", "worker-src")), + Testcase("csp_dictionary_with_unsafe_wasm.json", + ErrorUtils::FormatErrorMessage( + errors::kInvalidCSPInsecureValueError, + keys::kContentSecurityPolicy_ExtensionPagesPath, + "'wasm-unsafe-eval'", "worker-src")), }; RunTestcases(testcases, base::size(testcases), EXPECT_TYPE_ERROR); } @@ -180,6 +185,8 @@ } cases[] = { {"csp_dictionary_with_wasm.json", "worker-src 'self' 'wasm-eval'; default-src 'self'"}, + {"csp_dictionary_with_unsafe_wasm.json", + "worker-src 'self' 'wasm-unsafe-eval'; default-src 'self'"}, {"csp_dictionary_empty_v3.json", kDefaultSecureCSPWithWasmAllowed}, {"csp_dictionary_valid_1.json", "default-src 'none'"}, {"csp_omitted_mv2.json", kDefaultExtensionPagesCSP}};
diff --git a/extensions/common/mojom/frame.mojom b/extensions/common/mojom/frame.mojom index 1ac1a54b..6b76184 100644 --- a/extensions/common/mojom/frame.mojom +++ b/extensions/common/mojom/frame.mojom
@@ -101,6 +101,9 @@ string extension_id, string script_id, url.mojom.Url url); + + // Tell the render view which browser window it's being attached to. + UpdateBrowserWindowId(int32 window_id); }; // Implemented in the browser, this interface defines the local frame host
diff --git a/extensions/renderer/extension_frame_helper.cc b/extensions/renderer/extension_frame_helper.cc index 9abb420e..f10a7a9 100644 --- a/extensions/renderer/extension_frame_helper.cc +++ b/extensions/renderer/extension_frame_helper.cc
@@ -409,8 +409,6 @@ IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnExtensionDeliverMessage) IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect, OnExtensionDispatchOnDisconnect) - IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateBrowserWindowId, - OnUpdateBrowserWindowId) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -467,10 +465,6 @@ tab_id_ = tab_id; } -void ExtensionFrameHelper::OnUpdateBrowserWindowId(int browser_window_id) { - browser_window_id_ = browser_window_id; -} - void ExtensionFrameHelper::NotifyRenderViewType(mojom::ViewType type) { // TODO(devlin): It'd be really nice to be able to // DCHECK_EQ(mojom::ViewType::kInvalid, view_type_) here. @@ -562,6 +556,10 @@ } } +void ExtensionFrameHelper::UpdateBrowserWindowId(int32_t window_id) { + browser_window_id_ = window_id; +} + void ExtensionFrameHelper::OnDestruct() { delete this; }
diff --git a/extensions/renderer/extension_frame_helper.h b/extensions/renderer/extension_frame_helper.h index 414246e..ffc4d99 100644 --- a/extensions/renderer/extension_frame_helper.h +++ b/extensions/renderer/extension_frame_helper.h
@@ -119,6 +119,8 @@ const std::string& script_id, const GURL& url) override; + void UpdateBrowserWindowId(int32_t window_id) override; + void set_did_create_script_context() { did_create_script_context_ = true; } bool did_create_script_context() const { return did_create_script_context_; } @@ -180,7 +182,6 @@ void OnExtensionDispatchOnDisconnect(int worker_thread_id, const PortId& id, const std::string& error_message); - void OnUpdateBrowserWindowId(int browser_window_id); // Type of view associated with the RenderFrame. mojom::ViewType view_type_ = mojom::ViewType::kInvalid;
diff --git a/extensions/test/data/manifest_tests/csp_dictionary_with_unsafe_wasm.json b/extensions/test/data/manifest_tests/csp_dictionary_with_unsafe_wasm.json new file mode 100644 index 0000000..9fd8d10 --- /dev/null +++ b/extensions/test/data/manifest_tests/csp_dictionary_with_unsafe_wasm.json
@@ -0,0 +1,8 @@ +{ + "name": "test", + "version": "0.1", + "manifest_version": 3, + "content_security_policy": { + "extension_pages" : "worker-src 'self' 'wasm-unsafe-eval'; default-src 'self'" + } +}
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc index 8ae0f43..1447b382 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include <stdint.h> +#include <cstdint> #include <memory> #include "base/allocator/partition_allocator/page_allocator.h" @@ -446,10 +447,10 @@ #endif // Try to reserve the maximum size of the pool at first, then keep halving // the size on failure until it succeeds. - void* pool_base = nullptr; + uintptr_t pool_base = 0; while (!pool_base && pool_size >= min_pool_size) { - pool_base = reinterpret_cast<void*>(sandbox_address_space->AllocatePages( - 0, pool_size, pool_size, v8::PagePermissions::kNoAccess)); + pool_base = sandbox_address_space->AllocatePages( + 0, pool_size, pool_size, v8::PagePermissions::kNoAccess); if (!pool_base) { pool_size /= 2; }
diff --git a/gpu/command_buffer/service/external_vk_image_skia_representation.cc b/gpu/command_buffer/service/external_vk_image_skia_representation.cc index 2eab6fe5..41773dd 100644 --- a/gpu/command_buffer/service/external_vk_image_skia_representation.cc +++ b/gpu/command_buffer/service/external_vk_image_skia_representation.cc
@@ -74,9 +74,8 @@ backing_impl()->context_state()->CacheSkSurface(this, surface); } - int count = surface->getCanvas()->save(); + [[maybe_unused]] int count = surface->getCanvas()->save(); DCHECK_EQ(count, 1); - ALLOW_UNUSED_LOCAL(count); access_mode_ = kWrite;
diff --git a/gpu/command_buffer/service/shared_image_backing_factory_angle_vulkan.cc b/gpu/command_buffer/service/shared_image_backing_factory_angle_vulkan.cc index 3582dfb..eb2bddb 100644 --- a/gpu/command_buffer/service/shared_image_backing_factory_angle_vulkan.cc +++ b/gpu/command_buffer/service/shared_image_backing_factory_angle_vulkan.cc
@@ -399,9 +399,8 @@ backing_impl()->context_state_->CacheSkSurface(this, surface); } - int count = surface->getCanvas()->save(); + [[maybe_unused]] int count = surface->getCanvas()->save(); DCHECK_EQ(count, 1); - ALLOW_UNUSED_LOCAL(count); return surface; }
diff --git a/gpu/command_buffer/service/wrapped_sk_image.cc b/gpu/command_buffer/service/wrapped_sk_image.cc index 389dd03..04de9a9 100644 --- a/gpu/command_buffer/service/wrapped_sk_image.cc +++ b/gpu/command_buffer/service/wrapped_sk_image.cc
@@ -417,8 +417,7 @@ final_msaa_count, surface_props, context_state_); if (!surface) return nullptr; - int save_count = surface->getCanvas()->save(); - ALLOW_UNUSED_LOCAL(save_count); + [[maybe_unused]] int save_count = surface->getCanvas()->save(); DCHECK_EQ(1, save_count); write_surface_ = surface.get(); return surface;
diff --git a/gpu/command_buffer/tests/fuzzer_main.cc b/gpu/command_buffer/tests/fuzzer_main.cc index e34756b..910ec00 100644 --- a/gpu/command_buffer/tests/fuzzer_main.cc +++ b/gpu/command_buffer/tests/fuzzer_main.cc
@@ -241,9 +241,8 @@ attrib_helper.buffer_preserved = it.GetBit(); attrib_helper.bind_generates_resource = it.GetBit(); attrib_helper.single_buffer = it.GetBit(); - bool es3 = it.GetBit(); + [[maybe_unused]] bool es3 = it.GetBit(); #if defined(GPU_FUZZER_USE_RASTER_DECODER) - ALLOW_UNUSED_LOCAL(es3); attrib_helper.context_type = CONTEXT_TYPE_OPENGLES2; #else bool es31 = it.GetBit(); @@ -324,8 +323,8 @@ CHECK(base::i18n::InitializeICU()); base::CommandLine::Init(0, nullptr); - auto* command_line = base::CommandLine::ForCurrentProcess(); - ALLOW_UNUSED_LOCAL(command_line); + [[maybe_unused]] auto* command_line = + base::CommandLine::ForCurrentProcess(); #if defined(USE_OZONE) ui::OzonePlatform::InitializeForGPU(ui::OzonePlatform::InitParams());
diff --git "a/infra/config/generated/builders/ci/Cast Android \050dbg\051/properties.textpb" "b/infra/config/generated/builders/ci/Cast Android \050dbg\051/properties.textpb" index 432cf6b..8252801 100644 --- "a/infra/config/generated/builders/ci/Cast Android \050dbg\051/properties.textpb" +++ "b/infra/config/generated/builders/ci/Cast Android \050dbg\051/properties.textpb"
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/Cast Audio Linux/properties.textpb b/infra/config/generated/builders/ci/Cast Audio Linux/properties.textpb index 21fcce96..e859202 100644 --- a/infra/config/generated/builders/ci/Cast Audio Linux/properties.textpb +++ b/infra/config/generated/builders/ci/Cast Audio Linux/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, + "$build/reclient": { + "instance": "rbe-chromium-trusted", "jobs": 500, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/Cast Linux ARM64/properties.textpb b/infra/config/generated/builders/ci/Cast Linux ARM64/properties.textpb index 21fcce96..e859202 100644 --- a/infra/config/generated/builders/ci/Cast Linux ARM64/properties.textpb +++ b/infra/config/generated/builders/ci/Cast Linux ARM64/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, + "$build/reclient": { + "instance": "rbe-chromium-trusted", "jobs": 500, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/Cast Linux Debug/properties.textpb b/infra/config/generated/builders/ci/Cast Linux Debug/properties.textpb index 21fcce96..e859202 100644 --- a/infra/config/generated/builders/ci/Cast Linux Debug/properties.textpb +++ b/infra/config/generated/builders/ci/Cast Linux Debug/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, + "$build/reclient": { + "instance": "rbe-chromium-trusted", "jobs": 500, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/Cast Linux/properties.textpb b/infra/config/generated/builders/ci/Cast Linux/properties.textpb index 9a26172b..e859202 100644 --- a/infra/config/generated/builders/ci/Cast Linux/properties.textpb +++ b/infra/config/generated/builders/ci/Cast Linux/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 50, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/luci/commit-queue.cfg b/infra/config/generated/luci/commit-queue.cfg index 92336168..15c21432 100644 --- a/infra/config/generated/luci/commit-queue.cfg +++ b/infra/config/generated/luci/commit-queue.cfg
@@ -636,6 +636,10 @@ location_regexp: ".+/[+]/infra/config/.+" } builders { + name: "chromium/try/builder-config-verifier" + includable_only: true + } + builders { name: "chromium/try/cast_shell_android" location_regexp: ".*" location_regexp_exclude: ".+/[+]/docs/.+"
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index f67e841..57fef22 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -55122,6 +55122,91 @@ } } builders { + name: "builder-config-verifier" + 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/recipe_bundles/chromium.googlesource.com/chromium/tools/build" + cipd_version: "refs/heads/main" + cmd: "luciexe" + } + properties: + '{' + ' "$recipe_engine/resultdb/test_presentation": {' + ' "column_keys": [],' + ' "grouping_keys": [' + ' "status",' + ' "v.test_suite"' + ' ]' + ' },' + ' "properties_file_globs": [' + ' "infra/config/generated/builders/*/*/properties.textpb"' + ' ],' + ' "recipe": "chromium/builder_config_verifier"' + '}' + priority: 25 + 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: "luci.recipes.use_python3" + value: 100 + } + experiments { + key: "luci.use_realms" + 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:|content/test:fuchsia_)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/.+" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + description_html: "checks that builder configs in properties files match the recipe-side configs" + } + builders { name: "cast_shell_android" swarming_host: "chromium-swarm.appspot.com" dimensions: "builder:cast_shell_android"
diff --git a/infra/config/generated/luci/luci-milo.cfg b/infra/config/generated/luci/luci-milo.cfg index ef60001..717588ccf 100644 --- a/infra/config/generated/luci/luci-milo.cfg +++ b/infra/config/generated/luci/luci-milo.cfg
@@ -1637,6 +1637,9 @@ name: "buildbucket/luci.chromium.try/branch-config-verifier" } builders { + name: "buildbucket/luci.chromium.try/builder-config-verifier" + } + builders { name: "buildbucket/luci.chromium.try/chromium_presubmit" } builders { @@ -2439,6 +2442,9 @@ name: "buildbucket/luci.chromium.try/branch-config-verifier" } builders { + name: "buildbucket/luci.chromium.try/builder-config-verifier" + } + builders { name: "buildbucket/luci.chromium.try/cast_shell_android" } builders { @@ -14160,6 +14166,9 @@ name: "buildbucket/luci.chromium.try/branch-config-verifier" } builders { + name: "buildbucket/luci.chromium.try/builder-config-verifier" + } + builders { name: "buildbucket/luci.chromium.try/cast_shell_android" } builders {
diff --git a/infra/config/recipes.star b/infra/config/recipes.star index 00e0643..90f6ee93 100644 --- a/infra/config/recipes.star +++ b/infra/config/recipes.star
@@ -135,6 +135,11 @@ ) build_recipe( + name = "recipe:chromium/builder_config_verifier", + use_python3 = True, +) + +build_recipe( name = "recipe:chromium/orchestrator", bootstrappable = True, use_python3 = True,
diff --git a/infra/config/subprojects/chromium/ci/chromium.android.star b/infra/config/subprojects/chromium/ci/chromium.android.star index d91a4381..5acf1d5d 100644 --- a/infra/config/subprojects/chromium/ci/chromium.android.star +++ b/infra/config/subprojects/chromium/ci/chromium.android.star
@@ -164,6 +164,9 @@ ), cq_mirrors_console_view = "mirrors", tree_closing = True, + goma_backend = None, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, + reclient_instance = rbe_instance.DEFAULT, ) ci.builder(
diff --git a/infra/config/subprojects/chromium/ci/chromium.linux.star b/infra/config/subprojects/chromium/ci/chromium.linux.star index a8f0245..c3aa231 100644 --- a/infra/config/subprojects/chromium/ci/chromium.linux.star +++ b/infra/config/subprojects/chromium/ci/chromium.linux.star
@@ -42,6 +42,9 @@ short_name = "aud", ), ssd = True, + goma_backend = None, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, + reclient_instance = rbe_instance.DEFAULT, ) ci.builder( @@ -52,7 +55,9 @@ short_name = "vid", ), cq_mirrors_console_view = "mirrors", - goma_jobs = goma.jobs.J50, + goma_backend = None, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, + reclient_instance = rbe_instance.DEFAULT, ) ci.builder( @@ -66,6 +71,9 @@ os = os.LINUX_BIONIC, # TODO(crbug.com/1173333): Make it tree-closing. tree_closing = False, + goma_backend = None, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, + reclient_instance = rbe_instance.DEFAULT, ) ci.builder( @@ -78,6 +86,9 @@ cq_mirrors_console_view = "mirrors", os = os.LINUX_BIONIC, tree_closing = False, + goma_backend = None, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, + reclient_instance = rbe_instance.DEFAULT, ) ci.builder(
diff --git a/infra/config/subprojects/chromium/try/presubmit.star b/infra/config/subprojects/chromium/try/presubmit.star index 0a3b2074..e4f1feb6 100644 --- a/infra/config/subprojects/chromium/try/presubmit.star +++ b/infra/config/subprojects/chromium/try/presubmit.star
@@ -41,10 +41,11 @@ against generated files being out of date, so they MUST run quickly so that the submit after a CQ dry run doesn't take long. """ - tryjob_args = {a: getattr(tryjob, a) for a in dir(tryjob)} - tryjob_args["disable_reuse"] = True - tryjob_args["add_default_excludes"] = False - tryjob = try_.job(**tryjob_args) + if tryjob: + tryjob_args = {a: getattr(tryjob, a) for a in dir(tryjob)} + tryjob_args["disable_reuse"] = True + tryjob_args["add_default_excludes"] = False + tryjob = try_.job(**tryjob_args) return try_.builder(name = name, tryjob = tryjob, **kwargs) # Errors that this builder would catch would go unnoticed until a project is set @@ -105,6 +106,22 @@ ) presubmit_builder( + name = "builder-config-verifier", + description_html = "checks that builder configs in properties files match the recipe-side configs", + executable = "recipe:chromium/builder_config_verifier", + properties = { + "properties_file_globs": [ + "infra/config/generated/builders/*/*/properties.textpb", + ], + }, + # TODO(crbug.com/1288604) Add to the CQ once the recipe is ready + tryjob = None, + # tryjob = try_.job( + # location_regexp = [r".+/[+]infra/config/generated/builders"], + # ), +) + +presubmit_builder( name = "chromium_presubmit", branch_selector = branches.ALL_BRANCHES, executable = "recipe:presubmit",
diff --git a/ios/chrome/browser/BUILD.gn b/ios/chrome/browser/BUILD.gn index d5d48b6..5532b778 100644 --- a/ios/chrome/browser/BUILD.gn +++ b/ios/chrome/browser/BUILD.gn
@@ -127,7 +127,10 @@ "//ios/chrome/browser/sync/glue", "//ios/chrome/browser/browser_state", ] - frameworks = [ "UIKit.framework" ] + frameworks = [ + "UIKit.framework", + "Foundation.framework", + ] } source_set("utils") { @@ -244,6 +247,7 @@ "//ios/chrome/common/app_group", "//ios/public/provider/chrome/browser", "//ios/public/provider/chrome/browser/app_distribution:app_distribution_api", + "//ios/public/provider/chrome/browser/signin:signin_sso_api", "//ios/web", "//ios/web/public/init", "//mojo/public/cpp/bindings",
diff --git a/ios/chrome/browser/application_context.h b/ios/chrome/browser/application_context.h index efeed925c..c05c6ac 100644 --- a/ios/chrome/browser/application_context.h +++ b/ios/chrome/browser/application_context.h
@@ -5,6 +5,8 @@ #ifndef IOS_CHROME_BROWSER_APPLICATION_CONTEXT_H_ #define IOS_CHROME_BROWSER_APPLICATION_CONTEXT_H_ +#import <Foundation/Foundation.h> + #include <string> #include "base/memory/scoped_refptr.h" @@ -67,12 +69,7 @@ class IOSChromeIOThread; class PrefService; class SafeBrowsingService; - -// Unused. Present to ensure that all files including application_context.h -// has been converted to Objective-C++ and that it is safe to include ObjC -// in this file in the future. Will be removed when real ObjC use is added -// in a followup CL. -@class NSObject; +@protocol SingleSignOnService; // Gets the global application context. Cannot return null. ApplicationContext* GetApplicationContext(); @@ -166,6 +163,9 @@ virtual breadcrumbs::BreadcrumbPersistentStorageManager* GetBreadcrumbPersistentStorageManager() = 0; + // Returns the SingleSignOnService instance used by this application. + virtual id<SingleSignOnService> GetSSOService() = 0; + protected: // Sets the global ApplicationContext instance. static void SetApplicationContext(ApplicationContext* context);
diff --git a/ios/chrome/browser/application_context_impl.h b/ios/chrome/browser/application_context_impl.h index c267468..a7476aff 100644 --- a/ios/chrome/browser/application_context_impl.h +++ b/ios/chrome/browser/application_context_impl.h
@@ -81,6 +81,7 @@ BrowserPolicyConnectorIOS* GetBrowserPolicyConnector() override; breadcrumbs::BreadcrumbPersistentStorageManager* GetBreadcrumbPersistentStorageManager() override; + id<SingleSignOnService> GetSSOService() override; private: // Sets the locale used by the application. @@ -126,6 +127,8 @@ network_connection_tracker_; scoped_refptr<SafeBrowsingService> safe_browsing_service_; + + __strong id<SingleSignOnService> single_sign_on_service_ = nil; }; #endif // IOS_CHROME_BROWSER_APPLICATION_CONTEXT_IMPL_H_
diff --git a/ios/chrome/browser/application_context_impl.mm b/ios/chrome/browser/application_context_impl.mm index ccdf598..5bddce89 100644 --- a/ios/chrome/browser/application_context_impl.mm +++ b/ios/chrome/browser/application_context_impl.mm
@@ -67,6 +67,7 @@ #include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h" #include "ios/chrome/common/channel_info.h" #include "ios/public/provider/chrome/browser/app_distribution/app_distribution_api.h" +#include "ios/public/provider/chrome/browser/signin/signin_sso_api.h" #include "ios/web/public/thread/web_task_traits.h" #include "ios/web/public/thread/web_thread.h" #include "mojo/public/cpp/bindings/pending_receiver.h" @@ -488,6 +489,14 @@ : nullptr; } +id<SingleSignOnService> ApplicationContextImpl::GetSSOService() { + if (!single_sign_on_service_) { + single_sign_on_service_ = ios::provider::CreateSSOService(); + DCHECK(single_sign_on_service_); + } + return single_sign_on_service_; +} + void ApplicationContextImpl::SetApplicationLocale(const std::string& locale) { DCHECK(thread_checker_.CalledOnValidThread()); application_locale_ = locale;
diff --git a/ios/chrome/browser/link_to_text/BUILD.gn b/ios/chrome/browser/link_to_text/BUILD.gn index 270a344..d4cc1e7b 100644 --- a/ios/chrome/browser/link_to_text/BUILD.gn +++ b/ios/chrome/browser/link_to_text/BUILD.gn
@@ -19,6 +19,7 @@ ":internal", ":link_to_text_js", "//components/shared_highlighting/core/common", + "//components/shared_highlighting/ios", "//components/ukm/ios:ukm_url_recorder", "//ios/chrome/browser/tabs", "//ios/web/public",
diff --git a/ios/chrome/browser/link_to_text/link_to_text_response.mm b/ios/chrome/browser/link_to_text/link_to_text_response.mm index 41e5ac3..8db8f9f1 100644 --- a/ios/chrome/browser/link_to_text/link_to_text_response.mm +++ b/ios/chrome/browser/link_to_text/link_to_text_response.mm
@@ -8,6 +8,7 @@ #import "base/values.h" #import "components/shared_highlighting/core/common/fragment_directives_utils.h" #import "components/shared_highlighting/core/common/text_fragment.h" +#import "components/shared_highlighting/ios/parsing_utils.h" #import "components/ukm/ios/ukm_url_recorder.h" #import "ios/chrome/browser/link_to_text/link_to_text_payload.h" #import "ios/chrome/browser/link_to_text/link_to_text_utils.h" @@ -88,7 +89,7 @@ ukm::SourceId sourceID = ukm::GetSourceIdForWebStateDocument(webState); - if (!link_to_text::IsValidDictValue(value)) { + if (!shared_highlighting::IsValidDictValue(value)) { if (link_to_text::IsLinkGenerationTimeout(latency)) { return [[self alloc] initWithError:LinkGenerationError::kTimeout sourceID:sourceID @@ -120,7 +121,7 @@ TextFragment::FromValue(value->FindKey("fragment")); const std::string* selectedText = value->FindStringKey("selectedText"); absl::optional<CGRect> sourceRect = - link_to_text::ParseRect(value->FindKey("selectionRect")); + shared_highlighting::ParseRect(value->FindKey("selectionRect")); // All values must be present to have a valid payload. if (!title || !fragment || !selectedText || !sourceRect) { @@ -131,7 +132,7 @@ GURL baseURL = webState->GetLastCommittedURL(); absl::optional<GURL> canonicalURL = - link_to_text::ParseURL(value->FindStringKey("canonicalUrl")); + shared_highlighting::ParseURL(value->FindStringKey("canonicalUrl")); // Use the canonical URL as base when it exists, and only on HTTPS pages. if (baseURL.SchemeIsCryptographic() && canonicalURL) { @@ -147,8 +148,8 @@ title:title selectedText:base::SysUTF8ToNSString(*selectedText) sourceView:webState->GetView() - sourceRect:link_to_text::ConvertToBrowserRect(sourceRect.value(), - webState)]; + sourceRect:shared_highlighting::ConvertToBrowserRect(sourceRect.value(), + webState)]; return [[self alloc] initWithPayload:payload sourceID:sourceID latency:latency];
diff --git a/ios/chrome/browser/link_to_text/link_to_text_utils.h b/ios/chrome/browser/link_to_text/link_to_text_utils.h index 7e96e1b..c613ef77 100644 --- a/ios/chrome/browser/link_to_text/link_to_text_utils.h +++ b/ios/chrome/browser/link_to_text/link_to_text_utils.h
@@ -5,29 +5,16 @@ #ifndef IOS_CHROME_BROWSER_LINK_TO_TEXT_LINK_TO_TEXT_UTILS_H_ #define IOS_CHROME_BROWSER_LINK_TO_TEXT_LINK_TO_TEXT_UTILS_H_ -#import <CoreGraphics/CoreGraphics.h> -#import <UIKit/UIKit.h> - -#include <string> - #import "components/shared_highlighting/core/common/shared_highlighting_metrics.h" #import "ios/chrome/browser/link_to_text/link_generation_outcome.h" #import "third_party/abseil-cpp/absl/types/optional.h" namespace base { class TimeDelta; -class Value; } // namespace base -namespace web { -class WebState; -} // namespace web - namespace link_to_text { -// Returns whether |value| is a dictionary value, and is not empty. -BOOL IsValidDictValue(const base::Value* value); - // Attempts to convert a numerical |status| value from the // text-fragments-polyfill library into a LinkGenerationOutcome enum // value, representing outcomes for that library. @@ -39,19 +26,6 @@ shared_highlighting::LinkGenerationError OutcomeToError( LinkGenerationOutcome outcome); -// Attempts to parse the given |value| into a CGRect. If |value| does not map -// into the expected structure, an empty absl::optional instance will be -// returned. -absl::optional<CGRect> ParseRect(const base::Value* value); - -// Attempts to parse the given |url_value| into a GURL instance. If |url_value| -// is empty or invalid, an empty absl::optional instance will be returned. -absl::optional<GURL> ParseURL(const std::string* url_value); - -// Converts a given |web_view_rect| into its browser coordinates counterpart. -// Uses the given |web_state| to do the conversion. -CGRect ConvertToBrowserRect(CGRect web_view_rect, web::WebState* web_state); - // Returns YES if |latency| exceeds the timeout limit for link generation. BOOL IsLinkGenerationTimeout(base::TimeDelta latency);
diff --git a/ios/chrome/browser/link_to_text/link_to_text_utils.mm b/ios/chrome/browser/link_to_text/link_to_text_utils.mm index e2eb8b1..e20f565d 100644 --- a/ios/chrome/browser/link_to_text/link_to_text_utils.mm +++ b/ios/chrome/browser/link_to_text/link_to_text_utils.mm
@@ -5,12 +5,8 @@ #import "ios/chrome/browser/link_to_text/link_to_text_utils.h" #import "base/time/time.h" -#import "base/values.h" #import "components/shared_highlighting/core/common/text_fragment.h" #import "ios/chrome/browser/link_to_text/link_to_text_constants.h" -#import "ios/web/public/ui/crw_web_view_proxy.h" -#import "ios/web/public/ui/crw_web_view_scroll_view_proxy.h" -#import "ios/web/public/web_state.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -20,14 +16,6 @@ namespace link_to_text { -namespace { -const CGFloat kCaretWidth = 4.0; -} // namespace - -BOOL IsValidDictValue(const base::Value* value) { - return value && value->is_dict() && !value->DictEmpty(); -} - absl::optional<LinkGenerationOutcome> ParseStatus( absl::optional<double> status) { if (!status.has_value()) { @@ -61,56 +49,6 @@ } } -absl::optional<CGRect> ParseRect(const base::Value* value) { - if (!IsValidDictValue(value)) { - return absl::nullopt; - } - - const base::Value* xValue = - value->FindKeyOfType("x", base::Value::Type::DOUBLE); - const base::Value* yValue = - value->FindKeyOfType("y", base::Value::Type::DOUBLE); - const base::Value* widthValue = - value->FindKeyOfType("width", base::Value::Type::DOUBLE); - const base::Value* heightValue = - value->FindKeyOfType("height", base::Value::Type::DOUBLE); - - if (!xValue || !yValue || !widthValue || !heightValue) { - return absl::nullopt; - } - - return CGRectMake(xValue->GetDouble(), yValue->GetDouble(), - widthValue->GetDouble(), heightValue->GetDouble()); -} - -absl::optional<GURL> ParseURL(const std::string* url_value) { - if (!url_value) { - return absl::nullopt; - } - - GURL url(*url_value); - if (!url.is_empty() && url.is_valid()) { - return url; - } - - return absl::nullopt; -} - -CGRect ConvertToBrowserRect(CGRect web_view_rect, web::WebState* web_state) { - if (CGRectEqualToRect(web_view_rect, CGRectZero) || !web_state) { - return web_view_rect; - } - - id<CRWWebViewProxy> web_view_proxy = web_state->GetWebViewProxy(); - CGFloat zoom_scale = web_view_proxy.scrollViewProxy.zoomScale; - UIEdgeInsets inset = web_view_proxy.scrollViewProxy.contentInset; - - return CGRectMake((web_view_rect.origin.x * zoom_scale) + inset.left, - (web_view_rect.origin.y * zoom_scale) + inset.top, - (web_view_rect.size.width * zoom_scale) + kCaretWidth, - web_view_rect.size.height * zoom_scale); -} - BOOL IsLinkGenerationTimeout(base::TimeDelta latency) { return latency.InMilliseconds() >= kLinkGenerationTimeoutInMs; }
diff --git a/ios/chrome/browser/link_to_text/link_to_text_utils_unittest.mm b/ios/chrome/browser/link_to_text/link_to_text_utils_unittest.mm index edf89eb..c21ac21 100644 --- a/ios/chrome/browser/link_to_text/link_to_text_utils_unittest.mm +++ b/ios/chrome/browser/link_to_text/link_to_text_utils_unittest.mm
@@ -4,9 +4,6 @@ #import "ios/chrome/browser/link_to_text/link_to_text_utils.h" -#import <CoreGraphics/CoreGraphics.h> - -#import "base/values.h" #import "ios/chrome/browser/link_to_text/link_generation_outcome.h" #import "ios/chrome/browser/link_to_text/link_to_text_constants.h" #import "testing/gtest/include/gtest/gtest.h" @@ -40,59 +37,6 @@ .has_value()); } -// Tests the ParseRect utility function. -TEST_F(LinkToTextUtilsTest, ParseRect) { - CGRect expected_rect = CGRectMake(1, 2, 3, 4); - base::Value rect_value = base::Value(base::Value::Type::DICTIONARY); - rect_value.SetDoubleKey("x", expected_rect.origin.x); - rect_value.SetDoubleKey("y", expected_rect.origin.y); - rect_value.SetDoubleKey("width", expected_rect.size.width); - rect_value.SetDoubleKey("height", expected_rect.size.height); - - absl::optional<CGRect> opt_rect = ParseRect(&rect_value); - ASSERT_TRUE(opt_rect.has_value()); - EXPECT_TRUE(CGRectEqualToRect(expected_rect, opt_rect.value())); - - // Invalid values. - EXPECT_FALSE(ParseRect(nil).has_value()); - base::Value string_value = base::Value(base::Value::Type::STRING); - EXPECT_FALSE(ParseRect(&string_value).has_value()); - base::Value empty_dict_value = base::Value(base::Value::Type::DICTIONARY); - EXPECT_FALSE(ParseRect(&empty_dict_value).has_value()); - - base::Value copied_value = rect_value.Clone(); - copied_value.RemoveKey("x"); - EXPECT_FALSE(ParseRect(&copied_value).has_value()); - - copied_value = rect_value.Clone(); - copied_value.RemoveKey("y"); - EXPECT_FALSE(ParseRect(&copied_value).has_value()); - - copied_value = rect_value.Clone(); - copied_value.RemoveKey("width"); - EXPECT_FALSE(ParseRect(&copied_value).has_value()); - - copied_value = rect_value.Clone(); - copied_value.RemoveKey("height"); - EXPECT_FALSE(ParseRect(&copied_value).has_value()); -} - -// Tests for the ParseURL utility function. -TEST_F(LinkToTextUtilsTest, ParseURL) { - EXPECT_FALSE(ParseURL(nil).has_value()); - - std::string empty_str = ""; - EXPECT_FALSE(ParseURL(&empty_str).has_value()); - - std::string invalid_url_str = "abcd"; - EXPECT_FALSE(ParseURL(&invalid_url_str).has_value()); - - std::string valid_url_str = "https://www.example.com/"; - absl::optional<GURL> valid_url = ParseURL(&valid_url_str); - EXPECT_TRUE(valid_url.has_value()); - EXPECT_EQ(GURL(valid_url_str).spec(), valid_url.value().spec()); -} - // Tests that IsLinkGenerationTimeout returns the right values based on // different input values. TEST_F(LinkToTextUtilsTest, IsLinkGenerationTimeout) {
diff --git a/ios/chrome/browser/rlz/BUILD.gn b/ios/chrome/browser/rlz/BUILD.gn index 56ceed5..5e94757 100644 --- a/ios/chrome/browser/rlz/BUILD.gn +++ b/ios/chrome/browser/rlz/BUILD.gn
@@ -3,6 +3,7 @@ # found in the LICENSE file. source_set("rlz") { + configs += [ "//build/config/compiler:enable_arc" ] sources = [ "rlz_tracker_delegate_impl.h", "rlz_tracker_delegate_impl.mm",
diff --git a/ios/chrome/browser/sync/ios_chrome_sync_client.h b/ios/chrome/browser/sync/ios_chrome_sync_client.h index 8790dbec..48d47b9 100644 --- a/ios/chrome/browser/sync/ios_chrome_sync_client.h +++ b/ios/chrome/browser/sync/ios_chrome_sync_client.h
@@ -23,7 +23,7 @@ } namespace browser_sync { -class ProfileSyncComponentsFactoryImpl; +class SyncApiComponentFactoryImpl; } class IOSChromeSyncClient : public browser_sync::BrowserSyncClient { @@ -65,8 +65,7 @@ ChromeBrowserState* const browser_state_; // The sync api component factory in use by this client. - std::unique_ptr<browser_sync::ProfileSyncComponentsFactoryImpl> - component_factory_; + std::unique_ptr<browser_sync::SyncApiComponentFactoryImpl> component_factory_; std::unique_ptr<syncer::TrustedVaultClient> trusted_vault_client_;
diff --git a/ios/chrome/browser/sync/ios_chrome_sync_client.mm b/ios/chrome/browser/sync/ios_chrome_sync_client.mm index c1ace21..008f204 100644 --- a/ios/chrome/browser/sync/ios_chrome_sync_client.mm +++ b/ios/chrome/browser/sync/ios_chrome_sync_client.mm
@@ -17,7 +17,7 @@ #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/autofill/core/common/autofill_features.h" #include "components/browser_sync/browser_sync_switches.h" -#include "components/browser_sync/profile_sync_components_factory_impl.h" +#include "components/browser_sync/sync_api_component_factory_impl.h" #include "components/consent_auditor/consent_auditor.h" #include "components/dom_distiller/core/dom_distiller_service.h" #include "components/history/core/browser/history_service.h" @@ -83,7 +83,7 @@ browser_state_, ServiceAccessType::IMPLICIT_ACCESS); component_factory_ = - std::make_unique<browser_sync::ProfileSyncComponentsFactoryImpl>( + std::make_unique<browser_sync::SyncApiComponentFactoryImpl>( this, ::GetChannel(), base::CreateSingleThreadTaskRunner({web::WebThread::UI}), db_thread_, profile_web_data_service_, account_web_data_service_, password_store_,
diff --git a/ios/chrome/test/BUILD.gn b/ios/chrome/test/BUILD.gn index 3580e425..4865048 100644 --- a/ios/chrome/test/BUILD.gn +++ b/ios/chrome/test/BUILD.gn
@@ -63,6 +63,7 @@ "//ios/chrome/browser/ui/util", "//ios/components/webui:url_constants", "//ios/public/provider/chrome/browser", + "//ios/public/provider/chrome/browser/signin:signin_sso_api", "//ios/web", "//ios/web/public/test", "//net",
diff --git a/ios/chrome/test/testing_application_context.h b/ios/chrome/test/testing_application_context.h index 712198f..7afd4ce1 100644 --- a/ios/chrome/test/testing_application_context.h +++ b/ios/chrome/test/testing_application_context.h
@@ -68,6 +68,7 @@ BrowserPolicyConnectorIOS* GetBrowserPolicyConnector() override; breadcrumbs::BreadcrumbPersistentStorageManager* GetBreadcrumbPersistentStorageManager() override; + id<SingleSignOnService> GetSSOService() override; private: base::ThreadChecker thread_checker_; @@ -87,6 +88,7 @@ scoped_refptr<SafeBrowsingService> fake_safe_browsing_service_; std::unique_ptr<network::TestNetworkConnectionTracker> test_network_connection_tracker_; + __strong id<SingleSignOnService> single_sign_on_service_ = nil; }; #endif // IOS_CHROME_TEST_TESTING_APPLICATION_CONTEXT_H_
diff --git a/ios/chrome/test/testing_application_context.mm b/ios/chrome/test/testing_application_context.mm index 75403d3..b79e0d06 100644 --- a/ios/chrome/test/testing_application_context.mm +++ b/ios/chrome/test/testing_application_context.mm
@@ -14,6 +14,7 @@ #include "ios/chrome/browser/policy/browser_policy_connector_ios.h" #include "ios/chrome/browser/policy/configuration_policy_handler_list_factory.h" #import "ios/chrome/browser/safe_browsing/fake_safe_browsing_service.h" +#include "ios/public/provider/chrome/browser/signin/signin_sso_api.h" #include "net/url_request/url_request_context_getter.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "services/network/test/test_network_connection_tracker.h" @@ -215,3 +216,11 @@ DCHECK(thread_checker_.CalledOnValidThread()); return nullptr; } + +id<SingleSignOnService> TestingApplicationContext::GetSSOService() { + if (!single_sign_on_service_) { + single_sign_on_service_ = ios::provider::CreateSSOService(); + DCHECK(single_sign_on_service_); + } + return single_sign_on_service_; +}
diff --git a/ios/web_view/internal/sync/web_view_sync_client.h b/ios/web_view/internal/sync/web_view_sync_client.h index 7968c57a..292f65d 100644 --- a/ios/web_view/internal/sync/web_view_sync_client.h +++ b/ios/web_view/internal/sync/web_view_sync_client.h
@@ -11,7 +11,7 @@ #include "base/task/single_thread_task_runner.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/browser_sync/browser_sync_client.h" -#include "components/browser_sync/profile_sync_components_factory_impl.h" +#include "components/browser_sync/sync_api_component_factory_impl.h" #include "components/password_manager/core/browser/password_store_interface.h" #include "ios/web_view/internal/web_view_browser_state.h" @@ -77,8 +77,7 @@ invalidation::InvalidationService* invalidation_service_; syncer::SyncInvalidationsService* sync_invalidations_service_; - std::unique_ptr<browser_sync::ProfileSyncComponentsFactoryImpl> - component_factory_; + std::unique_ptr<browser_sync::SyncApiComponentFactoryImpl> component_factory_; std::unique_ptr<syncer::TrustedVaultClient> trusted_vault_client_; };
diff --git a/ios/web_view/internal/sync/web_view_sync_client.mm b/ios/web_view/internal/sync/web_view_sync_client.mm index 21ab1dc..6474acc 100644 --- a/ios/web_view/internal/sync/web_view_sync_client.mm +++ b/ios/web_view/internal/sync/web_view_sync_client.mm
@@ -101,7 +101,7 @@ invalidation_service_(invalidation_service), sync_invalidations_service_(sync_invalidations_service) { component_factory_ = - std::make_unique<browser_sync::ProfileSyncComponentsFactoryImpl>( + std::make_unique<browser_sync::SyncApiComponentFactoryImpl>( this, version_info::Channel::STABLE, base::CreateSingleThreadTaskRunner({web::WebThread::UI}), profile_web_data_service_->GetDBTaskRunner(),
diff --git a/mojo/public/tools/mojom/check_stable_mojom_compatibility.py b/mojo/public/tools/mojom/check_stable_mojom_compatibility.py index 0fe5ee5..ac024ed 100755 --- a/mojo/public/tools/mojom/check_stable_mojom_compatibility.py +++ b/mojo/public/tools/mojom/check_stable_mojom_compatibility.py
@@ -75,6 +75,17 @@ raise ParseError('encountered exception {0} while parsing {1}'.format( e, mojom)) for imp in ast.import_list: + if (not file_overrides.get(imp.import_filename) + and not os.path.exists(os.path.join(root, imp.import_filename))): + # Speculatively construct a path prefix to locate the import_filename + mojom_path = os.path.dirname(os.path.normpath(mojom)).split(os.sep) + test_prefix = '' + for path_component in mojom_path: + test_prefix = os.path.join(test_prefix, path_component) + test_import_filename = os.path.join(test_prefix, imp.import_filename) + if os.path.exists(os.path.join(root, test_import_filename)): + imp.import_filename = test_import_filename + break parseMojom(imp.import_filename, file_overrides, override_modules) # Now that the transitive set of dependencies has been imported and parsed
diff --git a/mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py b/mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py index 9f51ea7..a5ba72f 100755 --- a/mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py +++ b/mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py
@@ -258,3 +258,66 @@ [Stable] struct T { foo.S s; int32 x; }; """) ]) + + def testWithPartialImport(self): + """The compatibility checking tool correctly parses imports with partial + paths.""" + self.assertBackwardCompatible([ + UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'), + Change('foo/bar.mojom', + old="""\ + module bar; + import "foo/foo.mojom"; + [Stable] struct T { foo.S s; }; + """, + new="""\ + module bar; + import "foo.mojom"; + [Stable] struct T { foo.S s; }; + """) + ]) + + self.assertBackwardCompatible([ + UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'), + Change('foo/bar.mojom', + old="""\ + module bar; + import "foo.mojom"; + [Stable] struct T { foo.S s; }; + """, + new="""\ + module bar; + import "foo/foo.mojom"; + [Stable] struct T { foo.S s; }; + """) + ]) + + self.assertNotBackwardCompatible([ + UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'), + Change('bar/bar.mojom', + old="""\ + module bar; + import "foo/foo.mojom"; + [Stable] struct T { foo.S s; }; + """, + new="""\ + module bar; + import "foo.mojom"; + [Stable] struct T { foo.S s; }; + """) + ]) + + self.assertNotBackwardCompatible([ + UnchangedFile('foo/foo.mojom', 'module foo; [Stable] struct S {};'), + Change('bar/bar.mojom', + old="""\ + module bar; + import "foo.mojom"; + [Stable] struct T { foo.S s; }; + """, + new="""\ + module bar; + import "foo/foo.mojom"; + [Stable] struct T { foo.S s; }; + """) + ])
diff --git a/net/base/SECURITY_OWNERS b/net/base/SECURITY_OWNERS index dcc8eb1..0d55df81 100644 --- a/net/base/SECURITY_OWNERS +++ b/net/base/SECURITY_OWNERS
@@ -1,3 +1,2 @@ rsleevi@chromium.org -asanka@chromium.org mmenke@chromium.org
diff --git a/net/cookies/cookie_access_delegate.cc b/net/cookies/cookie_access_delegate.cc index 75c796d..e852cff 100644 --- a/net/cookies/cookie_access_delegate.cc +++ b/net/cookies/cookie_access_delegate.cc
@@ -4,10 +4,13 @@ #include "net/cookies/cookie_access_delegate.h" +#include <set> + #include "base/callback.h" #include "base/stl_util.h" #include "net/base/schemeful_site.h" #include "net/cookies/cookie_partition_key.h" +#include "net/cookies/first_party_set_metadata.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace net {
diff --git a/net/cookies/cookie_access_delegate.h b/net/cookies/cookie_access_delegate.h index 7a56396..6f01f05 100644 --- a/net/cookies/cookie_access_delegate.h +++ b/net/cookies/cookie_access_delegate.h
@@ -50,14 +50,17 @@ const GURL& url, const SiteForCookies& site_for_cookies) const = 0; - // Returns the metadata indicating whether `site` is same-party with + // Calls `callback` with metadata indicating whether `site` is same-party with // `party_context` and `top_frame_site`; and `site`'s owner, if applicable.. // If `top_frame_site` is nullptr, then `site` will be checked only against // `party_context`. - virtual FirstPartySetMetadata ComputeFirstPartySetMetadata( + // + // `callback` may be invoked synchronously or asynchronously. + virtual void ComputeFirstPartySetMetadataMaybeAsync( const net::SchemefulSite& site, const net::SchemefulSite* top_frame_site, - const std::set<net::SchemefulSite>& party_context) const = 0; + const std::set<net::SchemefulSite>& party_context, + base::OnceCallback<void(FirstPartySetMetadata)> callback) const = 0; // Returns the owner of a `site`'s First-Party Set if `site` is in a // non-trivial set. Returns nullopt otherwise.
diff --git a/net/cookies/cookie_util.cc b/net/cookies/cookie_util.cc index 7668bb5..17d67914 100644 --- a/net/cookies/cookie_util.cc +++ b/net/cookies/cookie_util.cc
@@ -739,26 +739,25 @@ return base::FeatureList::IsEnabled(features::kSchemefulSameSite); } -// Returns First-Party Set metadata for the given context. Returns empty/default -// metadata if `isolation_info` is not fully populated, or -// `isolation_info.party_context` is nullopt. -FirstPartySetMetadata ComputeFirstPartySetMetadata( +void ComputeFirstPartySetMetadataMaybeAsync( const SchemefulSite& request_site, const IsolationInfo& isolation_info, const CookieAccessDelegate* cookie_access_delegate, - bool force_ignore_top_frame_party) { + bool force_ignore_top_frame_party, + base::OnceCallback<void(FirstPartySetMetadata)> callback) { if (!isolation_info.IsEmpty() && isolation_info.party_context().has_value() && cookie_access_delegate) { - return cookie_access_delegate->ComputeFirstPartySetMetadata( + cookie_access_delegate->ComputeFirstPartySetMetadataMaybeAsync( request_site, force_ignore_top_frame_party ? nullptr : base::OptionalOrNullptr( isolation_info.network_isolation_key().GetTopFrameSite()), - isolation_info.party_context().value()); + isolation_info.party_context().value(), std::move(callback)); + return; } - return FirstPartySetMetadata(); + std::move(callback).Run(FirstPartySetMetadata()); } CookieSamePartyStatus GetSamePartyStatus(const CanonicalCookie& cookie,
diff --git a/net/cookies/cookie_util.h b/net/cookies/cookie_util.h index f4baa07d..e727b056 100644 --- a/net/cookies/cookie_util.h +++ b/net/cookies/cookie_util.h
@@ -244,11 +244,14 @@ // `force_ignore_top_frame_party` is true, the top frame from `isolation_info` // will be assumed to be same-party with `request_site`, regardless of what it // is. -NET_EXPORT FirstPartySetMetadata -ComputeFirstPartySetMetadata(const SchemefulSite& request_site, - const IsolationInfo& isolation_info, - const CookieAccessDelegate* cookie_access_delegate, - bool force_ignore_top_frame_party); +// +// `callback` may be invoked either synchronously or asynchronously. +NET_EXPORT void ComputeFirstPartySetMetadataMaybeAsync( + const SchemefulSite& request_site, + const IsolationInfo& isolation_info, + const CookieAccessDelegate* cookie_access_delegate, + bool force_ignore_top_frame_party, + base::OnceCallback<void(FirstPartySetMetadata)> callback); // Get the SameParty inclusion status. If the cookie is not SameParty, returns // kNoSamePartyEnforcement; if the cookie is SameParty but does not have a
diff --git a/net/cookies/test_cookie_access_delegate.cc b/net/cookies/test_cookie_access_delegate.cc index c46e8b4..86661372 100644 --- a/net/cookies/test_cookie_access_delegate.cc +++ b/net/cookies/test_cookie_access_delegate.cc
@@ -9,9 +9,11 @@ #include "base/callback.h" #include "base/containers/contains.h" #include "base/containers/flat_map.h" +#include "base/task/thread_pool.h" #include "net/base/schemeful_site.h" #include "net/cookies/cookie_constants.h" #include "net/cookies/cookie_util.h" +#include "net/cookies/first_party_set_metadata.h" #include "net/cookies/same_party_context.h" namespace net { @@ -40,11 +42,18 @@ return true; } -FirstPartySetMetadata TestCookieAccessDelegate::ComputeFirstPartySetMetadata( +void TestCookieAccessDelegate::ComputeFirstPartySetMetadataMaybeAsync( const net::SchemefulSite& site, const net::SchemefulSite* top_frame_site, - const std::set<net::SchemefulSite>& party_context) const { - return FirstPartySetMetadata(); + const std::set<net::SchemefulSite>& party_context, + base::OnceCallback<void(FirstPartySetMetadata)> callback) const { + if (invoke_callbacks_asynchronously_) { + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, base::BindOnce([]() { return FirstPartySetMetadata(); }), + std::move(callback)); + return; + } + std::move(callback).Run(FirstPartySetMetadata()); } absl::optional<net::SchemefulSite> @@ -61,6 +70,18 @@ base::OnceCallback< void(base::flat_map<net::SchemefulSite, std::set<net::SchemefulSite>>)> callback) const { + if (invoke_callbacks_asynchronously_) { + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, + base::BindOnce( + [](const base::flat_map<net::SchemefulSite, + std::set<net::SchemefulSite>>& sets) { + return sets; + }, + first_party_sets_), + std::move(callback)); + return; + } std::move(callback).Run(first_party_sets_); }
diff --git a/net/cookies/test_cookie_access_delegate.h b/net/cookies/test_cookie_access_delegate.h index e15beff..22a2fb6 100644 --- a/net/cookies/test_cookie_access_delegate.h +++ b/net/cookies/test_cookie_access_delegate.h
@@ -40,10 +40,11 @@ bool ShouldIgnoreSameSiteRestrictions( const GURL& url, const SiteForCookies& site_for_cookies) const override; - FirstPartySetMetadata ComputeFirstPartySetMetadata( + void ComputeFirstPartySetMetadataMaybeAsync( const net::SchemefulSite& site, const net::SchemefulSite* top_frame_site, - const std::set<net::SchemefulSite>& party_context) const override; + const std::set<net::SchemefulSite>& party_context, + base::OnceCallback<void(FirstPartySetMetadata)> callback) const override; absl::optional<net::SchemefulSite> FindFirstPartySetOwner( const net::SchemefulSite& site) const override; void RetrieveFirstPartySets( @@ -71,6 +72,10 @@ const base::flat_map<net::SchemefulSite, std::set<net::SchemefulSite>>& sets); + void set_invoke_callbacks_asynchronously(bool async) { + invoke_callbacks_asynchronously_ = async; + } + private: // Discard any leading dot in the domain string. std::string GetKeyForDomainValue(const std::string& domain) const; @@ -79,6 +84,7 @@ std::map<std::string, bool> ignore_samesite_restrictions_schemes_; base::flat_map<net::SchemefulSite, std::set<net::SchemefulSite>> first_party_sets_; + bool invoke_callbacks_asynchronously_ = false; }; } // namespace net
diff --git a/net/ntlm/OWNERS b/net/ntlm/OWNERS index f18201c..57eef363 100644 --- a/net/ntlm/OWNERS +++ b/net/ntlm/OWNERS
@@ -1,3 +1,2 @@ -asanka@chromium.org rsleevi@chromium.org zentaro@chromium.org
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 02a3a9c..8a2ec5e 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc
@@ -26,6 +26,7 @@ #include "net/cert/x509_certificate.h" #include "net/cookies/cookie_store.h" #include "net/cookies/cookie_util.h" +#include "net/cookies/first_party_set_metadata.h" #include "net/dns/public/secure_dns_policy.h" #include "net/http/http_log_util.h" #include "net/http/http_util.h" @@ -647,14 +648,23 @@ void URLRequest::StartJob(std::unique_ptr<URLRequestJob> job) { DCHECK(!is_pending_); DCHECK(!job_); + if (!context()->cookie_store()) { + OnGotFirstPartySetMetadata(std::move(job), FirstPartySetMetadata()); + return; + } - set_first_party_set_metadata( - context()->cookie_store() - ? cookie_util::ComputeFirstPartySetMetadata( - SchemefulSite(url()), isolation_info(), - context()->cookie_store()->cookie_access_delegate(), - force_ignore_top_frame_party_for_cookies()) - : FirstPartySetMetadata()); + cookie_util::ComputeFirstPartySetMetadataMaybeAsync( + SchemefulSite(url()), isolation_info(), + context()->cookie_store()->cookie_access_delegate(), + force_ignore_top_frame_party_for_cookies(), + base::BindOnce(&URLRequest::OnGotFirstPartySetMetadata, + weak_factory_.GetWeakPtr(), std::move(job))); +} + +void URLRequest::OnGotFirstPartySetMetadata( + std::unique_ptr<URLRequestJob> job, + FirstPartySetMetadata first_party_set_metadata) { + set_first_party_set_metadata(std::move(first_party_set_metadata)); privacy_mode_ = DeterminePrivacyMode(); net_log_.BeginEvent(NetLogEventType::URL_REQUEST_START_JOB, [&] {
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 3da5f137..a3f9ba0f 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h
@@ -913,6 +913,11 @@ // the request if it's a value other than OK. void OnCallToDelegateComplete(int error = OK); + // Called after getting First-Party Set metadata, when starting a request leg. + void OnGotFirstPartySetMetadata( + std::unique_ptr<URLRequestJob> job, + FirstPartySetMetadata first_party_set_metadata); + // Records the referrer policy of the given request, bucketed by // whether the request is same-origin or not. To save computation, // takes this fact as a boolean parameter rather than dynamically
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index a241c3a..53286db 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -40,6 +40,7 @@ #include "base/memory/weak_ptr.h" #include "base/path_service.h" #include "base/run_loop.h" +#include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h" @@ -13033,4 +13034,72 @@ } } +class URLRequestMaybeAsyncFirstPartySetsTest + : public URLRequestTest, + public testing::WithParamInterface<bool> { + public: + URLRequestMaybeAsyncFirstPartySetsTest() + : cookie_monster_(/*store=*/nullptr, + /*net_log=*/nullptr, + /*first_party_sets_enabled=*/true) { + auto cookie_access_delegate = std::make_unique<TestCookieAccessDelegate>(); + cookie_access_delegate->set_invoke_callbacks_asynchronously( + invoke_callbacks_asynchronously()); + cookie_monster_.SetCookieAccessDelegate(std::move(cookie_access_delegate)); + + CHECK(test_server_.Start()); + } + + bool invoke_callbacks_asynchronously() { return GetParam(); } + + CookieStore* cookie_store() { return &cookie_monster_; } + + HttpTestServer& test_server() { return test_server_; } + + private: + CookieMonster cookie_monster_; + HttpTestServer test_server_; +}; + +TEST_P(URLRequestMaybeAsyncFirstPartySetsTest, SimpleRequest) { + TestURLRequestContext context(/*delay_initialization=*/true); + context.set_cookie_store(cookie_store()); + context.Init(); + + TestDelegate d; + std::unique_ptr<URLRequest> req( + context.CreateRequest(test_server().GetURL("/echo"), DEFAULT_PRIORITY, &d, + TRAFFIC_ANNOTATION_FOR_TESTS)); + req->Start(); + d.RunUntilComplete(); + + EXPECT_EQ(d.data_received(), "Echo"); + EXPECT_THAT(d.request_status(), IsOk()); + EXPECT_EQ(req->GetResponseCode(), 200); +} + +TEST_P(URLRequestMaybeAsyncFirstPartySetsTest, SingleRedirect) { + TestURLRequestContext context(/*delay_initialization=*/true); + context.set_cookie_store(cookie_store()); + context.Init(); + + TestDelegate d; + std::unique_ptr<URLRequest> req(context.CreateRequest( + test_server().GetURL(base::StrCat({ + "/server-redirect?", + test_server().GetURL("/echo").spec(), + })), + DEFAULT_PRIORITY, &d, TRAFFIC_ANNOTATION_FOR_TESTS)); + req->Start(); + d.RunUntilComplete(); + + EXPECT_EQ(d.data_received(), "Echo"); + EXPECT_THAT(d.request_status(), IsOk()); + EXPECT_EQ(req->GetResponseCode(), 200); +} + +INSTANTIATE_TEST_SUITE_P(, + URLRequestMaybeAsyncFirstPartySetsTest, + testing::Bool()); + } // namespace net
diff --git a/services/network/cookie_access_delegate_impl.cc b/services/network/cookie_access_delegate_impl.cc index 98a00a2..d1edeb5 100644 --- a/services/network/cookie_access_delegate_impl.cc +++ b/services/network/cookie_access_delegate_impl.cc
@@ -60,14 +60,17 @@ return false; } -net::FirstPartySetMetadata -CookieAccessDelegateImpl::ComputeFirstPartySetMetadata( +void CookieAccessDelegateImpl::ComputeFirstPartySetMetadataMaybeAsync( const net::SchemefulSite& site, const net::SchemefulSite* top_frame_site, - const std::set<net::SchemefulSite>& party_context) const { - return first_party_sets_ ? first_party_sets_->ComputeMetadata( - site, top_frame_site, party_context) - : net::FirstPartySetMetadata(); + const std::set<net::SchemefulSite>& party_context, + base::OnceCallback<void(net::FirstPartySetMetadata)> callback) const { + if (!first_party_sets_) { + std::move(callback).Run(net::FirstPartySetMetadata()); + return; + } + first_party_sets_->ComputeMetadata(site, top_frame_site, party_context, + std::move(callback)); } absl::optional<net::SchemefulSite>
diff --git a/services/network/cookie_access_delegate_impl.h b/services/network/cookie_access_delegate_impl.h index 9f986cbd..253f9bf8 100644 --- a/services/network/cookie_access_delegate_impl.h +++ b/services/network/cookie_access_delegate_impl.h
@@ -54,10 +54,12 @@ bool ShouldIgnoreSameSiteRestrictions( const GURL& url, const net::SiteForCookies& site_for_cookies) const override; - net::FirstPartySetMetadata ComputeFirstPartySetMetadata( + void ComputeFirstPartySetMetadataMaybeAsync( const net::SchemefulSite& site, const net::SchemefulSite* top_frame_site, - const std::set<net::SchemefulSite>& party_context) const override; + const std::set<net::SchemefulSite>& party_context, + base::OnceCallback<void(net::FirstPartySetMetadata)> callback) + const override; absl::optional<net::SchemefulSite> FindFirstPartySetOwner( const net::SchemefulSite& site) const override; void RetrieveFirstPartySets(
diff --git a/services/network/first_party_sets/first_party_sets.cc b/services/network/first_party_sets/first_party_sets.cc index fbbd93f4..7bc64d4 100644 --- a/services/network/first_party_sets/first_party_sets.cc +++ b/services/network/first_party_sets/first_party_sets.cc
@@ -175,10 +175,11 @@ return base::ranges::all_of(party_context, is_owned_by_site_owner); } -net::FirstPartySetMetadata FirstPartySets::ComputeMetadata( +void FirstPartySets::ComputeMetadata( const net::SchemefulSite& site, const net::SchemefulSite* top_frame_site, - const std::set<net::SchemefulSite>& party_context) const { + const std::set<net::SchemefulSite>& party_context, + base::OnceCallback<void(net::FirstPartySetMetadata)> callback) const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); const base::ElapsedTimer timer; @@ -201,9 +202,9 @@ net::FirstPartySetsContextType first_party_sets_context_type = ComputeContextType(site, top_frame_site, party_context); - return net::FirstPartySetMetadata(context, - base::OptionalOrNullptr(FindOwner(site)), - first_party_sets_context_type); + std::move(callback).Run(net::FirstPartySetMetadata( + context, base::OptionalOrNullptr(FindOwner(site)), + first_party_sets_context_type)); } net::FirstPartySetsContextType FirstPartySets::ComputeContextType(
diff --git a/services/network/first_party_sets/first_party_sets.h b/services/network/first_party_sets/first_party_sets.h index 32dd408..db718af44 100644 --- a/services/network/first_party_sets/first_party_sets.h +++ b/services/network/first_party_sets/first_party_sets.h
@@ -65,10 +65,13 @@ void ParseAndSet(base::File sets_file); // Computes the First-Party Set metadata related to the given context. - net::FirstPartySetMetadata ComputeMetadata( + // + // `callback` may be invoked either synchronously or asynchronously. + void ComputeMetadata( const net::SchemefulSite& site, const net::SchemefulSite* top_frame_site, - const std::set<net::SchemefulSite>& party_context) const; + const std::set<net::SchemefulSite>& party_context, + base::OnceCallback<void(net::FirstPartySetMetadata)> callback) const; int64_t size() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/services/network/first_party_sets/first_party_sets_unittest.cc b/services/network/first_party_sets/first_party_sets_unittest.cc index 2b533a2..3a234bf 100644 --- a/services/network/first_party_sets/first_party_sets_unittest.cc +++ b/services/network/first_party_sets/first_party_sets_unittest.cc
@@ -79,6 +79,22 @@ return sets; } + net::FirstPartySetMetadata ComputeMetadataAndWait( + const net::SchemefulSite& site, + const net::SchemefulSite* top_frame_site, + const std::set<net::SchemefulSite>& party_context) const { + base::RunLoop run_loop; + net::FirstPartySetMetadata metadata; + sets_.ComputeMetadata( + site, top_frame_site, party_context, + base::BindLambdaForTesting([&](net::FirstPartySetMetadata result) { + metadata = std::move(result); + run_loop.Quit(); + })); + run_loop.Run(); + return metadata; + } + FirstPartySets& sets() { return sets_; } base::test::TaskEnvironment& env() { return env_; } @@ -127,34 +143,34 @@ // Works if the site is provided with WSS scheme instead of HTTPS. EXPECT_THAT( - sets().ComputeMetadata(wss_member, &member, {member, example}).context(), + ComputeMetadataAndWait(wss_member, &member, {member, example}).context(), net::SamePartyContext(Type::kCrossParty, Type::kCrossParty, Type::kSameParty)); - EXPECT_THAT(sets().ComputeMetadata(example, &member, {member}).context(), + EXPECT_THAT(ComputeMetadataAndWait(example, &member, {member}).context(), net::SamePartyContext(Type::kCrossParty)); - EXPECT_THAT(sets().ComputeMetadata(member, &example, {member}).context(), + EXPECT_THAT(ComputeMetadataAndWait(member, &example, {member}).context(), net::SamePartyContext(Type::kCrossParty)); // Top&resource differs from Ancestors. - EXPECT_THAT(sets().ComputeMetadata(member, &member, {example}).context(), + EXPECT_THAT(ComputeMetadataAndWait(member, &member, {example}).context(), net::SamePartyContext(Type::kCrossParty, Type::kCrossParty, Type::kSameParty)); // Metrics values infer singleton sets when appropriate. - EXPECT_THAT(sets().ComputeMetadata(member, &member, {member}).context(), + EXPECT_THAT(ComputeMetadataAndWait(member, &member, {member}).context(), net::SamePartyContext(Type::kCrossParty, Type::kSameParty, Type::kSameParty)); - EXPECT_THAT(sets().ComputeMetadata(member, &example, {member}).context(), + EXPECT_THAT(ComputeMetadataAndWait(member, &example, {member}).context(), net::SamePartyContext(Type::kCrossParty)); - EXPECT_THAT(sets().ComputeMetadata(example, &member, {member}).context(), + EXPECT_THAT(ComputeMetadataAndWait(example, &member, {member}).context(), net::SamePartyContext(Type::kCrossParty)); - EXPECT_THAT(sets().ComputeMetadata(member, &member, {example}).context(), + EXPECT_THAT(ComputeMetadataAndWait(member, &member, {example}).context(), net::SamePartyContext(Type::kCrossParty, Type::kCrossParty, Type::kSameParty)); EXPECT_THAT( - sets().ComputeMetadata(member, &member, {member, example}).context(), + ComputeMetadataAndWait(member, &member, {member, example}).context(), net::SamePartyContext(Type::kCrossParty, Type::kCrossParty, Type::kSameParty)); } @@ -986,35 +1002,30 @@ for (const net::SchemefulSite* top_frame : std::initializer_list<net::SchemefulSite*>{&example_site, nullptr}) { EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://nonmember.test")), - top_frame, {}) + ComputeMetadataAndWait( + net::SchemefulSite(GURL("https://nonmember.test")), top_frame, {}) .context() .context_type(), Type::kCrossParty); - EXPECT_EQ(sets() - .ComputeMetadata(example_site, top_frame, {}) + EXPECT_EQ(ComputeMetadataAndWait(example_site, top_frame, {}) .context() .context_type(), Type::kSameParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("http://example.test")), - top_frame, {}) + ComputeMetadataAndWait(net::SchemefulSite(GURL("http://example.test")), + top_frame, {}) .context() .context_type(), Type::kCrossParty); } - EXPECT_EQ(sets() - .ComputeMetadata(example_site, &nonmember, {}) + EXPECT_EQ(ComputeMetadataAndWait(example_site, &nonmember, {}) .context() .context_type(), Type::kCrossParty); - EXPECT_EQ(sets() - .ComputeMetadata(nonmember, &example_site, {}) + EXPECT_EQ(ComputeMetadataAndWait(nonmember, &example_site, {}) .context() .context_type(), Type::kCrossParty); @@ -1030,51 +1041,46 @@ for (const net::SchemefulSite* top_frame : std::initializer_list<net::SchemefulSite*>{&example_site, nullptr}) { EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("http://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("http://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member1.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member1.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); - EXPECT_EQ(sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://foo.test")), - top_frame, context) + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://foo.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member2.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ(ComputeMetadataAndWait( + net::SchemefulSite(GURL("https://nonmember.test")), top_frame, + context) .context() .context_type(), Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member2.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://nonmember.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); } } @@ -1087,51 +1093,46 @@ for (const net::SchemefulSite* top_frame : std::initializer_list<net::SchemefulSite*>{&example_site, nullptr}) { EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://example.test")), + top_frame, context) .context() .context_type(), Type::kSameParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("http://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("http://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member1.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member1.test")), + top_frame, context) .context() .context_type(), Type::kSameParty); - EXPECT_EQ(sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://foo.test")), - top_frame, context) + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://foo.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member2.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ(ComputeMetadataAndWait( + net::SchemefulSite(GURL("https://nonmember.test")), top_frame, + context) .context() .context_type(), Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member2.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://nonmember.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); } } @@ -1144,59 +1145,53 @@ for (const net::SchemefulSite* top_frame : std::initializer_list<net::SchemefulSite*>{&example_site, nullptr}) { EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://example.test")), + top_frame, context) .context() .context_type(), Type::kSameParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("http://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("http://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://example.test")), + top_frame, context) .context() .context_type(), Type::kSameParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member1.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member1.test")), + top_frame, context) .context() .context_type(), Type::kSameParty); - EXPECT_EQ(sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://foo.test")), - top_frame, context) + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://foo.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member2.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ(ComputeMetadataAndWait( + net::SchemefulSite(GURL("https://nonmember.test")), top_frame, + context) .context() .context_type(), Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member2.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://nonmember.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); } } @@ -1211,59 +1206,53 @@ for (const net::SchemefulSite* top_frame : std::initializer_list<net::SchemefulSite*>{&example_site, nullptr}) { EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://example.test")), + top_frame, context) .context() .context_type(), Type::kSameParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("http://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("http://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member1.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member1.test")), + top_frame, context) .context() .context_type(), Type::kSameParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member3.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member3.test")), + top_frame, context) .context() .context_type(), Type::kSameParty); - EXPECT_EQ(sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://foo.test")), - top_frame, context) + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://foo.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member2.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ(ComputeMetadataAndWait( + net::SchemefulSite(GURL("https://nonmember.test")), top_frame, + context) .context() .context_type(), Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member2.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://nonmember.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); } } @@ -1279,51 +1268,46 @@ for (const net::SchemefulSite* top_frame : std::initializer_list<net::SchemefulSite*>{&example_site, nullptr}) { EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("http://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("http://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member1.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member1.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); - EXPECT_EQ(sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://foo.test")), - top_frame, context) + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://foo.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member2.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ(ComputeMetadataAndWait( + net::SchemefulSite(GURL("https://nonmember.test")), top_frame, + context) .context() .context_type(), Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member2.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://nonmember.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); } } @@ -1340,51 +1324,46 @@ for (const net::SchemefulSite* top_frame : std::initializer_list<net::SchemefulSite*>{&example_site, nullptr}) { EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("http://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("http://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member1.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member1.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); - EXPECT_EQ(sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://foo.test")), - top_frame, context) + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://foo.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member2.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ(ComputeMetadataAndWait( + net::SchemefulSite(GURL("https://nonmember.test")), top_frame, + context) .context() .context_type(), Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member2.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://nonmember.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); } } @@ -1400,51 +1379,46 @@ for (const net::SchemefulSite* top_frame : std::initializer_list<net::SchemefulSite*>{&example_site, nullptr}) { EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("http://example.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("http://example.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member1.test")), - top_frame, context) + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member1.test")), + top_frame, context) .context() .context_type(), Type::kCrossParty); - EXPECT_EQ(sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://foo.test")), - top_frame, context) + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://foo.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ( + ComputeMetadataAndWait(net::SchemefulSite(GURL("https://member2.test")), + top_frame, context) + .context() + .context_type(), + Type::kCrossParty); + + EXPECT_EQ(ComputeMetadataAndWait( + net::SchemefulSite(GURL("https://nonmember.test")), top_frame, + context) .context() .context_type(), Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://member2.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); - - EXPECT_EQ( - sets() - .ComputeMetadata(net::SchemefulSite(GURL("https://nonmember.test")), - top_frame, context) - .context() - .context_type(), - Type::kCrossParty); } } @@ -1457,83 +1431,83 @@ net::SchemefulSite wss_nonmember(GURL("wss://nonmember.test")); // Works as usual for sites that are in First-Party sets. - EXPECT_EQ(sets().ComputeMetadata(member, &member, {member}), + EXPECT_EQ(ComputeMetadataAndWait(member, &member, {member}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kSameParty), &owner, net::FirstPartySetsContextType::kHomogeneous)); - EXPECT_EQ(sets().ComputeMetadata(owner, &member, {member}), + EXPECT_EQ(ComputeMetadataAndWait(owner, &member, {member}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kSameParty), &owner, net::FirstPartySetsContextType::kHomogeneous)); - EXPECT_EQ(sets().ComputeMetadata(member, &owner, {member}), + EXPECT_EQ(ComputeMetadataAndWait(member, &owner, {member}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kSameParty), &owner, net::FirstPartySetsContextType::kHomogeneous)); - EXPECT_EQ(sets().ComputeMetadata(member, &member, {owner}), + EXPECT_EQ(ComputeMetadataAndWait(member, &member, {owner}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kSameParty), &owner, net::FirstPartySetsContextType::kHomogeneous)); - EXPECT_EQ(sets().ComputeMetadata(member, &member, {member, owner}), + EXPECT_EQ(ComputeMetadataAndWait(member, &member, {member, owner}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kSameParty), &owner, net::FirstPartySetsContextType::kHomogeneous)); // Works if the site is provided with WSS scheme instead of HTTPS. - EXPECT_EQ(sets().ComputeMetadata(wss_member, &member, {member, owner}), + EXPECT_EQ(ComputeMetadataAndWait(wss_member, &member, {member, owner}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kSameParty), &owner, net::FirstPartySetsContextType::kHomogeneous)); - EXPECT_EQ(sets().ComputeMetadata(nonmember, &member, {member}), + EXPECT_EQ(ComputeMetadataAndWait(nonmember, &member, {member}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty), nullptr, net::FirstPartySetsContextType::kTopResourceMismatch)); - EXPECT_EQ(sets().ComputeMetadata(member, &nonmember, {member}), + EXPECT_EQ(ComputeMetadataAndWait(member, &nonmember, {member}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty), &owner, net::FirstPartySetsContextType::kTopResourceMismatch)); - EXPECT_EQ(sets().ComputeMetadata(wss_nonmember, &wss_member, {member, owner}), + EXPECT_EQ(ComputeMetadataAndWait(wss_nonmember, &wss_member, {member, owner}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty), nullptr, net::FirstPartySetsContextType::kTopResourceMismatch)); // Top&resource differs from Ancestors. EXPECT_EQ( - sets().ComputeMetadata(member, &member, {nonmember}), + ComputeMetadataAndWait(member, &member, {nonmember}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty, Type::kCrossParty, Type::kSameParty), &owner, net::FirstPartySetsContextType::kTopResourceMatchMixed)); // Metrics values infer singleton sets when appropriate. - EXPECT_EQ(sets().ComputeMetadata(nonmember, &nonmember, {nonmember}), + EXPECT_EQ(ComputeMetadataAndWait(nonmember, &nonmember, {nonmember}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty, Type::kSameParty, Type::kSameParty), nullptr, net::FirstPartySetsContextType::kHomogeneous)); - EXPECT_EQ(sets().ComputeMetadata(nonmember, &nonmember1, {nonmember}), + EXPECT_EQ(ComputeMetadataAndWait(nonmember, &nonmember1, {nonmember}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty), nullptr, net::FirstPartySetsContextType::kTopResourceMismatch)); - EXPECT_EQ(sets().ComputeMetadata(nonmember1, &nonmember, {nonmember}), + EXPECT_EQ(ComputeMetadataAndWait(nonmember1, &nonmember, {nonmember}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty), nullptr, net::FirstPartySetsContextType::kTopResourceMismatch)); EXPECT_EQ( - sets().ComputeMetadata(nonmember, &nonmember, {nonmember1}), + ComputeMetadataAndWait(nonmember, &nonmember, {nonmember1}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty, Type::kCrossParty, Type::kSameParty), nullptr, net::FirstPartySetsContextType::kTopResourceMatchMixed)); EXPECT_EQ( - sets().ComputeMetadata(member, &member, {member, nonmember}), + ComputeMetadataAndWait(member, &member, {member, nonmember}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty, Type::kCrossParty, Type::kSameParty), &owner, net::FirstPartySetsContextType::kTopResourceMatchMixed)); EXPECT_EQ( - sets().ComputeMetadata(nonmember, &nonmember, {member, nonmember}), + ComputeMetadataAndWait(nonmember, &nonmember, {member, nonmember}), net::FirstPartySetMetadata( net::SamePartyContext(Type::kCrossParty, Type::kCrossParty, Type::kSameParty),
diff --git a/services/network/restricted_cookie_manager.cc b/services/network/restricted_cookie_manager.cc index 38887f4..38de266 100644 --- a/services/network/restricted_cookie_manager.cc +++ b/services/network/restricted_cookie_manager.cc
@@ -29,6 +29,7 @@ #include "net/cookies/cookie_store.h" #include "net/cookies/cookie_util.h" #include "net/cookies/first_party_set_metadata.h" +#include "net/cookies/site_for_cookies.h" #include "services/network/cookie_settings.h" #include "services/network/public/mojom/cookie_access_observer.mojom.h" #include "services/network/public/mojom/cookie_manager.mojom.h" @@ -40,13 +41,20 @@ namespace { +// TODO(cfredric): the `force_ignore_top_frame_party` param being false prevents +// `document.cookie` access for same-party scripts embedded in an extension +// frame. It would be better if we allowed that similarly to how we allow +// SameParty cookies for requests in same-party contexts embedded in top-level +// extension frames. +const bool kForceIgnoreTopFrameParty = false; + net::CookieOptions MakeOptionsForSet( mojom::RestrictedCookieManagerRole role, const GURL& url, const net::SiteForCookies& site_for_cookies, const net::IsolationInfo& isolation_info, const CookieSettings& cookie_settings, - const net::CookieAccessDelegate* cookie_access_delegate) { + const net::FirstPartySetMetadata& first_party_set_metadata) { net::CookieOptions options; bool force_ignore_site_for_cookies = cookie_settings.ShouldIgnoreSameSiteRestrictions(url, site_for_cookies); @@ -62,16 +70,6 @@ net::cookie_util::ComputeSameSiteContextForSubresource( url, site_for_cookies, force_ignore_site_for_cookies)); } - // TODO(cfredric): the `force_ignore_top_frame_party` param below prevents - // `document.cookie` access for same-party scripts embedded in an extension - // frame. It would be better if we allowed that similarly to how we allow - // SameParty cookies for requests in same-party contexts embedded in top-level - // extension frames. - bool force_ignore_top_frame_party = false; - net::FirstPartySetMetadata first_party_set_metadata = - net::cookie_util::ComputeFirstPartySetMetadata( - /*request_site=*/net::SchemefulSite(url), isolation_info, - cookie_access_delegate, force_ignore_top_frame_party); options.set_same_party_context(first_party_set_metadata.context()); if (isolation_info.party_context().has_value()) { // Count the top-frame site since it's not in the party_context. @@ -94,7 +92,7 @@ const net::SiteForCookies& site_for_cookies, const net::IsolationInfo& isolation_info, const CookieSettings& cookie_settings, - const net::CookieAccessDelegate* cookie_access_delegate) { + const net::FirstPartySetMetadata& first_party_set_metadata) { // TODO(https://crbug.com/925311): Wire initiator here. net::CookieOptions options; bool force_ignore_site_for_cookies = @@ -112,11 +110,6 @@ net::cookie_util::ComputeSameSiteContextForSubresource( url, site_for_cookies, force_ignore_site_for_cookies)); } - bool force_ignore_top_frame_party = false; - net::FirstPartySetMetadata first_party_set_metadata = - net::cookie_util::ComputeFirstPartySetMetadata( - /*request_site=*/net::SchemefulSite(url), isolation_info, - cookie_access_delegate, force_ignore_top_frame_party); options.set_same_party_context(first_party_set_metadata.context()); if (isolation_info.party_context().has_value()) { // Count the top-frame site since it's not in the party_context. @@ -390,11 +383,27 @@ // TODO(morlovich): Try to validate site_for_cookies as well. - net::CookieOptions net_options = MakeOptionsForGet( - role_, url, site_for_cookies, isolation_info_, cookie_settings(), - cookie_store_->cookie_access_delegate()); + net::cookie_util::ComputeFirstPartySetMetadataMaybeAsync( + /*request_site=*/net::SchemefulSite(url), isolation_info_, + cookie_store_->cookie_access_delegate(), kForceIgnoreTopFrameParty, + base::BindOnce( + &RestrictedCookieManager::OnGotFirstPartySetMetadataForGetAllForUrl, + weak_ptr_factory_.GetWeakPtr(), url, site_for_cookies, + top_frame_origin, std::move(options), std::move(callback))); +} + +void RestrictedCookieManager::OnGotFirstPartySetMetadataForGetAllForUrl( + const GURL& url, + const net::SiteForCookies& site_for_cookies, + const url::Origin& top_frame_origin, + mojom::CookieManagerGetOptionsPtr options, + GetAllForUrlCallback callback, + net::FirstPartySetMetadata first_party_set_metadata) const { + net::CookieOptions net_options = + MakeOptionsForGet(role_, url, site_for_cookies, isolation_info_, + cookie_settings(), first_party_set_metadata); // TODO(https://crbug.com/977040): remove set_return_excluded_cookies() once - // removing deprecation warnings. + // removing deprecation warnings. net_options.set_return_excluded_cookies(); cookie_store_->GetCookieListWithOptionsAsync( @@ -606,11 +615,12 @@ cookie_partition_key.has_value()); } - auto sanitized_cookie = net::CanonicalCookie::FromStorage( - cookie.Name(), cookie.Value(), cookie.Domain(), cookie.Path(), now, - cookie.ExpiryDate(), now, cookie.IsSecure(), cookie.IsHttpOnly(), - cookie.SameSite(), cookie.Priority(), cookie.IsSameParty(), - cookie_partition_key, source_scheme, origin_.port()); + std::unique_ptr<net::CanonicalCookie> sanitized_cookie = + net::CanonicalCookie::FromStorage( + cookie.Name(), cookie.Value(), cookie.Domain(), cookie.Path(), now, + cookie.ExpiryDate(), now, cookie.IsSecure(), cookie.IsHttpOnly(), + cookie.SameSite(), cookie.Priority(), cookie.IsSameParty(), + cookie_partition_key, source_scheme, origin_.port()); DCHECK(sanitized_cookie); // FromStorage() uses a less strict version of IsCanonical(), we need to check // the stricter version as well here. @@ -618,11 +628,27 @@ std::move(callback).Run(false); return; } - net::CanonicalCookie cookie_copy = *sanitized_cookie; - net::CookieOptions options = MakeOptionsForSet( - role_, url, site_for_cookies, isolation_info_, cookie_settings(), - cookie_store_->cookie_access_delegate()); + net::cookie_util::ComputeFirstPartySetMetadataMaybeAsync( + /*request_site=*/net::SchemefulSite(url), isolation_info_, + cookie_store_->cookie_access_delegate(), kForceIgnoreTopFrameParty, + base::BindOnce(&RestrictedCookieManager::OnGotFirstPartySetMetadataForSet, + weak_ptr_factory_.GetWeakPtr(), url, site_for_cookies, + std::move(sanitized_cookie), origin_url, + std::move(callback))); +} + +void RestrictedCookieManager::OnGotFirstPartySetMetadataForSet( + const GURL& url, + const net::SiteForCookies& site_for_cookies, + std::unique_ptr<net::CanonicalCookie> sanitized_cookie, + const GURL& origin_url, + SetCanonicalCookieCallback callback, + net::FirstPartySetMetadata first_party_set_metadata) const { + net::CanonicalCookie cookie_copy = *sanitized_cookie; + net::CookieOptions options = + MakeOptionsForSet(role_, url, site_for_cookies, isolation_info_, + cookie_settings(), first_party_set_metadata); cookie_store_->SetCanonicalCookieAsync( std::move(sanitized_cookie), origin_url, options, @@ -668,9 +694,26 @@ return; } - net::CookieOptions net_options = MakeOptionsForGet( - role_, url, site_for_cookies, isolation_info_, cookie_settings(), - cookie_store_->cookie_access_delegate()); + net::cookie_util::ComputeFirstPartySetMetadataMaybeAsync( + /*request_site=*/net::SchemefulSite(url), isolation_info_, + cookie_store_->cookie_access_delegate(), kForceIgnoreTopFrameParty, + base::BindOnce(&RestrictedCookieManager:: + OnGotFirstPartySetMetadataForAddChangeListener, + weak_ptr_factory_.GetWeakPtr(), url, site_for_cookies, + top_frame_origin, std::move(mojo_listener), + std::move(callback))); +} + +void RestrictedCookieManager::OnGotFirstPartySetMetadataForAddChangeListener( + const GURL& url, + const net::SiteForCookies& site_for_cookies, + const url::Origin& top_frame_origin, + mojo::PendingRemote<mojom::CookieChangeListener> mojo_listener, + AddChangeListenerCallback callback, + net::FirstPartySetMetadata first_party_set_metadata) { + net::CookieOptions net_options = + MakeOptionsForGet(role_, url, site_for_cookies, isolation_info_, + cookie_settings(), first_party_set_metadata); auto listener = std::make_unique<Listener>( cookie_store_, this, url, site_for_cookies, top_frame_origin, cookie_partition_key_, net_options, std::move(mojo_listener),
diff --git a/services/network/restricted_cookie_manager.h b/services/network/restricted_cookie_manager.h index 037481a8..999d77a 100644 --- a/services/network/restricted_cookie_manager.h +++ b/services/network/restricted_cookie_manager.h
@@ -141,6 +141,35 @@ const net::CookieAccessResultList& cookie_list, const net::CookieAccessResultList& excluded_cookies); + // Called after getting First-Party Set data when setting a cookie. + void OnGotFirstPartySetMetadataForSet( + const GURL& url, + const net::SiteForCookies& site_for_cookies, + std::unique_ptr<net::CanonicalCookie> sanitized_cookie, + const GURL& origin_url, + SetCanonicalCookieCallback callback, + net::FirstPartySetMetadata first_party_set_metadata) const; + + // Called after getting First-Party Set data when getting all cookies for a + // URL. + void OnGotFirstPartySetMetadataForGetAllForUrl( + const GURL& url, + const net::SiteForCookies& site_for_cookies, + const url::Origin& top_frame_origin, + mojom::CookieManagerGetOptionsPtr options, + GetAllForUrlCallback callback, + net::FirstPartySetMetadata first_party_set_metadata) const; + + // Called after getting First-Party Set data when adding a cookie change + // listener. + void OnGotFirstPartySetMetadataForAddChangeListener( + const GURL& url, + const net::SiteForCookies& site_for_cookies, + const url::Origin& top_frame_origin, + mojo::PendingRemote<mojom::CookieChangeListener> mojo_listener, + AddChangeListenerCallback callback, + net::FirstPartySetMetadata first_party_set_metadata); + // Reports the result of setting the cookie to |network_context_client_|, and // invokes the user callback. void SetCanonicalCookieResult(const GURL& url,
diff --git a/testing/buildbot/chrome.json b/testing/buildbot/chrome.json index 1d29450..44d4ae6 100644 --- a/testing/buildbot/chrome.json +++ b/testing/buildbot/chrome.json
@@ -86,6 +86,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -127,6 +128,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -175,6 +177,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -212,6 +215,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -253,6 +257,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -290,6 +295,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -327,6 +333,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -367,6 +374,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -405,6 +413,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -444,6 +453,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -482,6 +492,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -519,6 +530,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -556,6 +568,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -593,6 +606,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -630,6 +644,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -667,6 +682,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -707,6 +723,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -744,6 +761,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -781,6 +799,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -834,6 +853,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -875,6 +895,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -915,6 +936,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -952,6 +974,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -989,6 +1012,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -1030,6 +1054,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -1067,6 +1092,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -1104,6 +1130,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -1157,6 +1184,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -1205,6 +1233,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -1252,6 +1281,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests"
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index 2203c3d1..7ddf897 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -1701,7 +1701,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/"
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index 0c73659..f1ee175 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -3031,7 +3031,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -6723,7 +6723,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -12228,7 +12228,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -16803,7 +16803,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -29318,7 +29318,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -31083,7 +31083,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -34432,7 +34432,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -39859,7 +39859,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/"
diff --git a/testing/buildbot/chromium.clang.json b/testing/buildbot/chromium.clang.json index 153c4830..24f65ee 100644 --- a/testing/buildbot/chromium.clang.json +++ b/testing/buildbot/chromium.clang.json
@@ -6196,7 +6196,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/"
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index fbadc2c..92166cf 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -7675,7 +7675,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -8204,7 +8204,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -9648,7 +9648,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -13560,7 +13560,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/" @@ -26125,6 +26125,108 @@ "13a233", "--xctest" ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPad Air 2 15.0", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11|Mac-10.16" + } + ], + "named_caches": [ + { + "name": "xcode_ios_13a233", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_15_0", + "path": "Runtime-ios-15.0" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPhone X", + "--version", + "15.0", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "13a233", + "--xctest" + ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPhone X 15.0", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11|Mac-10.16" + } + ], + "named_caches": [ + { + "name": "xcode_ios_13a233", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_15_0", + "path": "Runtime-ios-15.0" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPad Air 2", + "--version", + "15.0", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "13a233", + "--xctest" + ], "isolate_name": "crypto_unittests", "merge": { "args": [], @@ -29090,6 +29192,108 @@ "13a233", "--xctest" ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPhone 6s 14.5", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11|Mac-10.16" + } + ], + "named_caches": [ + { + "name": "xcode_ios_13a233", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_14_5", + "path": "Runtime-ios-14.5" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPhone 6s", + "--version", + "15.0", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "13a233", + "--xctest" + ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPhone 6s 15.0", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11|Mac-10.16" + } + ], + "named_caches": [ + { + "name": "xcode_ios_13a233", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_15_0", + "path": "Runtime-ios-15.0" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPhone 6s", + "--version", + "14.5", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "13a233", + "--xctest" + ], "isolate_name": "crypto_unittests", "merge": { "args": [], @@ -50505,6 +50709,57 @@ "12e262", "--xctest" ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPhone X 14.5", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11|Mac-10.16" + } + ], + "named_caches": [ + { + "name": "xcode_ios_12e262", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_14_5", + "path": "Runtime-ios-14.5" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPhone X", + "--version", + "14.5", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "12e262", + "--xctest" + ], "isolate_name": "crypto_unittests", "merge": { "args": [], @@ -54691,6 +54946,57 @@ "12e262", "--xctest" ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPhone 6s 14.5", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "arm64", + "os": "Mac-11" + } + ], + "named_caches": [ + { + "name": "xcode_ios_12e262", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_14_5", + "path": "Runtime-ios-14.5" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPhone 6s", + "--version", + "14.5", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "12e262", + "--xctest" + ], "isolate_name": "crypto_unittests", "merge": { "args": [], @@ -59375,6 +59681,108 @@ "13a233", "--xctest" ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPhone 6s 14.5", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11|Mac-10.16" + } + ], + "named_caches": [ + { + "name": "xcode_ios_13a233", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_14_5", + "path": "Runtime-ios-14.5" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPhone 6s", + "--version", + "15.0", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "13a233", + "--xctest" + ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPhone 6s 15.0", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11|Mac-10.16" + } + ], + "named_caches": [ + { + "name": "xcode_ios_13a233", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_15_0", + "path": "Runtime-ios-15.0" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPhone 6s", + "--version", + "14.5", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "13a233", + "--xctest" + ], "isolate_name": "crypto_unittests", "merge": { "args": [], @@ -67619,6 +68027,108 @@ "13a233", "--xctest" ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPhone 6s 14.5", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11|Mac-10.16" + } + ], + "named_caches": [ + { + "name": "xcode_ios_13a233", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_14_5", + "path": "Runtime-ios-14.5" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPhone 6s", + "--version", + "15.0", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "13a233", + "--xctest" + ], + "isolate_name": "crashpad_tests", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "crashpad_tests_iPhone 6s 15.0", + "resultdb": { + "enable": true, + "has_native_resultdb_integration": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/mac_toolchain/${platform}", + "location": ".", + "revision": "git_revision:723fc1a6c8cdf2631a57851f5610e598db0c1de1" + } + ], + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Mac-11|Mac-10.16" + } + ], + "named_caches": [ + { + "name": "xcode_ios_13a233", + "path": "Xcode.app" + }, + { + "name": "runtime_ios_15_0", + "path": "Runtime-ios-15.0" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test_id_prefix": "ninja://third_party/crashpad/crashpad:crashpad_tests/" + }, + { + "args": [ + "--platform", + "iPhone 6s", + "--version", + "14.5", + "--out-dir", + "${ISOLATED_OUTDIR}", + "--xcode-build-version", + "13a233", + "--xctest" + ], "isolate_name": "crypto_unittests", "merge": { "args": [],
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index 8ecfebf..7a68053 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -13826,7 +13826,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 4 + "shards": 6 }, "test": "components_unittests", "test_id_prefix": "ninja://components:components_unittests/"
diff --git a/testing/buildbot/chromium.perf.json b/testing/buildbot/chromium.perf.json index 8898bbbc..0f614d6 100644 --- a/testing/buildbot/chromium.perf.json +++ b/testing/buildbot/chromium.perf.json
@@ -1682,6 +1682,68 @@ "script": "//tools/perf/process_perf_results.py" } }, + "mac-laptop_low_end-perf": { + "isolated_scripts": [ + { + "args": [ + "-v", + "--browser=release", + "--upload-results", + "--test-shard-map-filename=mac-laptop_low_end-perf_map.json", + "--assert-gpu-compositing" + ], + "isolate_name": "performance_test_suite", + "merge": { + "args": [ + "--lightweight", + "--skip-perf" + ], + "script": "//tools/perf/process_perf_results.py" + }, + "name": "performance_test_suite", + "override_compile_targets": [ + "performance_test_suite" + ], + "resultdb": { + "enable": true + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "gpu": "8086:1626", + "os": "Mac-10.12.6", + "pool": "chrome.tests.perf", + "synthetic_product_name": "MacBookAir7,2_x86-64-i5-5350U_Intel Broadwell HD Graphics 6000_8192_APPLE SSD SM0128G" + } + ], + "expiration": 7200, + "hard_timeout": 21600, + "ignore_task_failure": false, + "io_timeout": 21600, + "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com", + "shards": 26 + }, + "trigger_script": { + "args": [ + "--multiple-dimension-script-verbose", + "True" + ], + "requires_simultaneous_shard_dispatch": true, + "script": "//testing/trigger_scripts/perf_device_trigger.py" + } + } + ] + }, + "mac-laptop_low_end-processor-perf": { + "merge": { + "args": [ + "--lightweight" + ], + "script": "//tools/perf/process_perf_results.py" + } + }, "mac-m1_mini_2020-perf": { "isolated_scripts": [ {
diff --git a/testing/buildbot/filters/fuchsia.content_browsertests.filter b/testing/buildbot/filters/fuchsia.content_browsertests.filter index 1c33f7b..112b099d 100644 --- a/testing/buildbot/filters/fuchsia.content_browsertests.filter +++ b/testing/buildbot/filters/fuchsia.content_browsertests.filter
@@ -14,8 +14,6 @@ -CrossPlatformAccessibilityBrowserTest.ControlsIdsForDateTimePopup -DirectSocketsTcpBrowserTest.OpenTcp_MDNS -DnsHttpsProtocolUpgradeBrowserTest.HttpsProtocolUpgrade --MHTMLGenerationSitePerProcessTest/* --MHTMLGenerationTest/* -MemoryTracingTest.BrowserInitiatedDump -MidiBrowserTest.RequestMIDIAccess -MidiBrowserTest.SubscribeAll
diff --git a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/components_unittests.filter b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/components_unittests.filter index 5a430fd3..667d608 100644 --- a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/components_unittests.filter +++ b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/components_unittests.filter
@@ -9480,7 +9480,6 @@ -ModelTypeTest.ModelTypeHistogramMapping -ModelTypeTest.ModelTypeNotificationTypeMapping -ModelTypeTest.ModelTypeOfInvalidSpecificsFieldNumber --ModelTypeTest.ModelTypeSetFromDebugString -ModelTypeTest.ModelTypeSetToValue -ModelTypeTest.ModelTypeStringMapping -ModelTypeTest.ModelTypeToFromSpecificsFieldNumber
diff --git a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/components_unittests.filter b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/components_unittests.filter index 5a430fd3..667d608 100644 --- a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/components_unittests.filter +++ b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/components_unittests.filter
@@ -9480,7 +9480,6 @@ -ModelTypeTest.ModelTypeHistogramMapping -ModelTypeTest.ModelTypeNotificationTypeMapping -ModelTypeTest.ModelTypeOfInvalidSpecificsFieldNumber --ModelTypeTest.ModelTypeSetFromDebugString -ModelTypeTest.ModelTypeSetToValue -ModelTypeTest.ModelTypeStringMapping -ModelTypeTest.ModelTypeToFromSpecificsFieldNumber
diff --git a/testing/buildbot/internal.chromeos.fyi.json b/testing/buildbot/internal.chromeos.fyi.json index 70f39c5..a59e35f3 100644 --- a/testing/buildbot/internal.chromeos.fyi.json +++ b/testing/buildbot/internal.chromeos.fyi.json
@@ -23,6 +23,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -60,6 +61,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -101,6 +103,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -138,6 +141,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -175,6 +179,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -215,6 +220,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -253,6 +259,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -292,6 +299,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -330,6 +338,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -367,6 +376,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -404,6 +414,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -441,6 +452,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -478,6 +490,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -515,6 +528,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -555,6 +569,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -592,6 +607,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -629,6 +645,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -682,6 +699,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -723,6 +741,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -763,6 +782,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -800,6 +820,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -837,6 +858,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -878,6 +900,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -915,6 +938,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -952,6 +976,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -1005,6 +1030,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -1053,6 +1079,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests" @@ -1100,6 +1127,7 @@ "dimension_sets": [ { "cpu": "x86", + "gce": "1", "kvm": "1", "os": "Ubuntu-18.04", "pool": "chrome.tests"
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl index 24fa19aa..3f3941f9 100644 --- a/testing/buildbot/mixins.pyl +++ b/testing/buildbot/mixins.pyl
@@ -289,6 +289,7 @@ { 'cpu': 'x86', 'kvm': '1', + 'gce': '1', 'os': 'Ubuntu-18.04', 'pool': 'chrome.tests', }
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index cb108eba..d12ae25 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -382,7 +382,7 @@ 'cc_unittests': {}, 'components_unittests': { 'android_swarming': { - 'shards': 4, + 'shards': 6, }, }, 'content_unittests': { @@ -966,7 +966,7 @@ 'components_browsertests': {}, 'components_unittests': { 'android_swarming': { - 'shards': 4, + 'shards': 6, }, }, 'content_browsertests': { @@ -1396,7 +1396,7 @@ 'components_capacity_tests': { 'components_unittests': { 'android_swarming': { - 'shards': 4, + 'shards': 6, }, }, }, @@ -4185,6 +4185,11 @@ 'url_unittests': {}, }, + # TODO(crbug.com/1288850): Move this into ios_common_tests when green. + 'ios_crash_unittests': { + 'crashpad_tests': {}, + }, + 'ios_crash_xcuitests': { 'ios_crash_xcuitests_module': {}, }, @@ -4702,7 +4707,7 @@ 'components_browsertests': {}, 'components_unittests': { 'android_swarming': { - 'shards': 4, + 'shards': 6, }, }, 'content_unittests': { @@ -7089,6 +7094,11 @@ 'SIM_IPHONE_X_14_5', ], }, + 'ios_crash_unittests': { + 'variants': [ + 'SIM_IPHONE_X_14_5', + ], + }, 'ios_eg2_tests': { 'mixins': ['xcode_parallelization'], 'variants': [ @@ -7123,6 +7133,12 @@ 'SIM_IPHONE_6S_14_5', ], }, + 'ios_crash_unittests': { + 'variants': [ + # Latest beta iOS version Sims + 'SIM_IPHONE_6S_14_5', + ], + }, 'ios_eg2_tests': { 'mixins': ['xcode_parallelization'], 'variants': [ @@ -7159,6 +7175,12 @@ 'SIM_IPHONE_6S_14_5', ], }, + 'ios_crash_unittests': { + 'variants': [ + 'SIM_IPHONE_6S_15_0', + 'SIM_IPHONE_6S_14_5', + ], + }, 'ios_eg2_tests': { 'mixins': ['xcode_parallelization'], 'variants': [ @@ -7202,6 +7224,12 @@ 'SIM_IPHONE_6S_14_5', ], }, + 'ios_crash_unittests': { + 'variants': [ + 'SIM_IPHONE_6S_15_0', + 'SIM_IPHONE_6S_14_5', + ], + }, 'ios_eg2_tests': { 'mixins': ['xcode_parallelization'], 'variants': [ @@ -7245,6 +7273,12 @@ 'SIM_IPAD_AIR_2_15_0', ] }, + 'ios_crash_unittests': { + 'variants': [ + 'SIM_IPHONE_X_15_0', + 'SIM_IPAD_AIR_2_15_0', + ] + }, 'ios_screen_size_dependent_tests': { 'variants': [ 'SIM_IPHONE_X_15_0',
diff --git a/testing/test.gni b/testing/test.gni index 5fa8f39b..32cb36e 100644 --- a/testing/test.gni +++ b/testing/test.gni
@@ -685,6 +685,7 @@ if (_use_xvfb) { executable = "//testing/xvfb.py" + data += [ "//.vpython3" ] } else { executable = "//testing/test_env.py" } @@ -720,10 +721,7 @@ executable_args += [ "--cfi-diag=true" ] } - data += [ - "//build/lacros/test_runner.py", - "//.vpython", - ] + data += [ "//build/lacros/test_runner.py" ] if (use_rts) { data_deps += [ ":${invoker.target_name}__rts_filters" ]
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 6809550..5af4c26 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -2772,24 +2772,6 @@ ] } ], - "ContextualSearchMaintenanceMode": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "Launch-candidate_20211129", - "enable_features": [ - "ContextualSearchLongpressResolve" - ], - "disable_features": [ - "ContextualSearchLiteralSearchTap" - ] - } - ] - } - ], "ContinuousSearchNavigation": [ { "platforms": [ @@ -4148,22 +4130,6 @@ ] } ], - "HTTPSVideoCompression": [ - { - "platforms": [ - "android", - "android_weblayer" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "SubresourceRedirectSrcVideo" - ] - } - ] - } - ], "HashedLoggingForHindsight": [ { "platforms": [ @@ -7619,28 +7585,6 @@ ] } ], - "SubresourceRedirect": [ - { - "platforms": [ - "android", - "android_weblayer" - ], - "experiments": [ - { - "name": "Enabled", - "params": { - "enable_login_robots_based_compression": "true", - "enable_public_image_hints_based_compression": "false", - "enable_subresource_server_redirect": "true", - "robots_rules_receive_timeout": "2000" - }, - "enable_features": [ - "SubresourceRedirect" - ] - } - ] - } - ], "SurfaceSyncThrottling": [ { "platforms": [
diff --git a/testing/xvfb.py b/testing/xvfb.py index 7651b7ec..c18a7cf 100755 --- a/testing/xvfb.py +++ b/testing/xvfb.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env vpython +#!/usr/bin/env vpython3 # Copyright (c) 2012 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. @@ -11,7 +11,6 @@ import copy import os import os.path -import psutil import random import re import signal @@ -19,8 +18,12 @@ import sys import threading import time + +import psutil + import test_env + class _XvfbProcessError(Exception): """Exception raised when Xvfb cannot start.""" pass
diff --git a/third_party/abseil-cpp/README.chromium b/third_party/abseil-cpp/README.chromium index f8eb8cee..f1b540b7 100644 --- a/third_party/abseil-cpp/README.chromium +++ b/third_party/abseil-cpp/README.chromium
@@ -4,7 +4,7 @@ License: Apache 2.0 License File: LICENSE Version: 0 -Revision: 2a042b082ca6fc8592ec98d800012fc03c965c15 +Revision: c59e7e59f5d29619ddc07fcb59be3dcba9585814 Security Critical: yes Description:
diff --git a/third_party/abseil-cpp/absl/base/casts.h b/third_party/abseil-cpp/absl/base/casts.h index 83c69126..b16af233 100644 --- a/third_party/abseil-cpp/absl/base/casts.h +++ b/third_party/abseil-cpp/absl/base/casts.h
@@ -105,47 +105,50 @@ // bit_cast() // -// Performs a bitwise cast on a type without changing the underlying bit -// representation of that type's value. The two types must be of the same size -// and both types must be trivially copyable. As with most casts, use with -// caution. A `bit_cast()` might be needed when you need to temporarily treat a -// type as some other type, such as in the following cases: +// Creates a value of the new type `Dest` whose representation is the same as +// that of the argument, which is of (deduced) type `Source` (a "bitwise cast"; +// every bit in the value representation of the result is equal to the +// corresponding bit in the object representation of the source). Source and +// destination types must be of the same size, and both types must be trivially +// copyable. // -// * Serialization (casting temporarily to `char *` for those purposes is -// always allowed by the C++ standard) -// * Managing the individual bits of a type within mathematical operations -// that are not normally accessible through that type -// * Casting non-pointer types to pointer types (casting the other way is -// allowed by `reinterpret_cast()` but round-trips cannot occur the other -// way). -// -// Example: +// As with most casts, use with caution. A `bit_cast()` might be needed when you +// need to treat a value as the value of some other type, for example, to access +// the individual bits of an object which are not normally accessible through +// the object's type, such as for working with the binary representation of a +// floating point value: // // float f = 3.14159265358979; // int i = bit_cast<int32_t>(f); // // i = 0x40490fdb // -// Casting non-pointer types to pointer types and then dereferencing them -// traditionally produces undefined behavior. +// Reinterpreting and accessing a value directly as a different type (as shown +// below) usually results in undefined behavior. // // Example: // // // WRONG -// float f = 3.14159265358979; // WRONG -// int i = * reinterpret_cast<int*>(&f); // WRONG +// float f = 3.14159265358979; +// int i = reinterpret_cast<int&>(f); // Wrong +// int j = *reinterpret_cast<int*>(&f); // Equally wrong +// int k = *bit_cast<int*>(&f); // Equally wrong // -// The address-casting method produces undefined behavior according to the ISO -// C++ specification section [basic.lval]. Roughly, this section says: if an -// object in memory has one type, and a program accesses it with a different -// type, the result is undefined behavior for most values of "different type". +// Reinterpret-casting results in undefined behavior according to the ISO C++ +// specification, section [basic.lval]. Roughly, this section says: if an object +// in memory has one type, and a program accesses it with a different type, the +// result is undefined behavior for most "different type". +// +// Using bit_cast on a pointer and then dereferencing it is no better than using +// reinterpret_cast. You should only use bit_cast on the value itself. // // Such casting results in type punning: holding an object in memory of one type // and reading its bits back using a different type. A `bit_cast()` avoids this -// issue by implementing its casts using `memcpy()`, which avoids introducing -// this undefined behavior. +// issue by copying the object representation to a new value, which avoids +// introducing this undefined behavior (since the original value is never +// accessed in the wrong way). // -// NOTE: The requirements here are more strict than the bit_cast of standard -// proposal p0476 due to the need for workarounds and lack of intrinsics. +// NOTE: The requirements here are stricter than the bit_cast of standard +// proposal P0476 due to the need for workarounds and lack of intrinsics. // Specifically, this implementation also requires `Dest` to be // default-constructible. template <
diff --git a/third_party/abseil-cpp/absl/container/internal/compressed_tuple_test.cc b/third_party/abseil-cpp/absl/container/internal/compressed_tuple_test.cc index 62a7483..74111f9 100644 --- a/third_party/abseil-cpp/absl/container/internal/compressed_tuple_test.cc +++ b/third_party/abseil-cpp/absl/container/internal/compressed_tuple_test.cc
@@ -403,6 +403,16 @@ } #endif +// TODO(b/214288561): enable this test. +TEST(CompressedTupleTest, DISABLED_NestedEbo) { + struct Empty1 {}; + struct Empty2 {}; + CompressedTuple<Empty1, CompressedTuple<Empty2>, int> x; + CompressedTuple<Empty1, Empty2, int> y; + // Currently fails with sizeof(x) == 8, sizeof(y) == 4. + EXPECT_EQ(sizeof(x), sizeof(y)); +} + } // namespace } // namespace container_internal ABSL_NAMESPACE_END
diff --git a/third_party/abseil-cpp/absl/numeric/BUILD.bazel b/third_party/abseil-cpp/absl/numeric/BUILD.bazel index 1f9e0f2..eaa27df 100644 --- a/third_party/abseil-cpp/absl/numeric/BUILD.bazel +++ b/third_party/abseil-cpp/absl/numeric/BUILD.bazel
@@ -37,6 +37,20 @@ ], ) +cc_binary( + name = "bits_benchmark", + testonly = 1, + srcs = ["bits_benchmark.cc"], + copts = ABSL_DEFAULT_COPTS, + linkopts = ABSL_DEFAULT_LINKOPTS, + deps = [ + ":bits", + "//absl/base:core_headers", + "//absl/random", + "@com_github_google_benchmark//:benchmark_main", + ], +) + cc_test( name = "bits_test", size = "small",
diff --git a/third_party/abseil-cpp/absl/numeric/bits_benchmark.cc b/third_party/abseil-cpp/absl/numeric/bits_benchmark.cc new file mode 100644 index 0000000..3de1dbf --- /dev/null +++ b/third_party/abseil-cpp/absl/numeric/bits_benchmark.cc
@@ -0,0 +1,73 @@ +// Copyright 2022 The Abseil Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include <cstdint> +#include <vector> + +#include "benchmark/benchmark.h" +#include "absl/base/optimization.h" +#include "absl/numeric/bits.h" +#include "absl/random/random.h" + +namespace absl { +namespace { + +template <typename T> +static void BM_bitwidth(benchmark::State& state) { + const int count = state.range(0); + + absl::BitGen rng; + std::vector<T> values; + values.reserve(count); + for (int i = 0; i < count; ++i) { + values.push_back(absl::Uniform<T>(rng, 0, std::numeric_limits<T>::max())); + } + + while (state.KeepRunningBatch(count)) { + for (int i = 0; i < count; ++i) { + benchmark::DoNotOptimize(values[i]); + } + } +} +BENCHMARK_TEMPLATE(BM_bitwidth, uint8_t)->Range(1, 1 << 20); +BENCHMARK_TEMPLATE(BM_bitwidth, uint16_t)->Range(1, 1 << 20); +BENCHMARK_TEMPLATE(BM_bitwidth, uint32_t)->Range(1, 1 << 20); +BENCHMARK_TEMPLATE(BM_bitwidth, uint64_t)->Range(1, 1 << 20); + +template <typename T> +static void BM_bitwidth_nonzero(benchmark::State& state) { + const int count = state.range(0); + + absl::BitGen rng; + std::vector<T> values; + values.reserve(count); + for (int i = 0; i < count; ++i) { + values.push_back(absl::Uniform<T>(rng, 1, std::numeric_limits<T>::max())); + } + + while (state.KeepRunningBatch(count)) { + for (int i = 0; i < count; ++i) { + const T value = values[i]; + ABSL_INTERNAL_ASSUME(value > 0); + benchmark::DoNotOptimize(value); + } + } +} +BENCHMARK_TEMPLATE(BM_bitwidth_nonzero, uint8_t)->Range(1, 1 << 20); +BENCHMARK_TEMPLATE(BM_bitwidth_nonzero, uint16_t)->Range(1, 1 << 20); +BENCHMARK_TEMPLATE(BM_bitwidth_nonzero, uint32_t)->Range(1, 1 << 20); +BENCHMARK_TEMPLATE(BM_bitwidth_nonzero, uint64_t)->Range(1, 1 << 20); + +} // namespace +} // namespace absl
diff --git a/third_party/abseil-cpp/absl/random/internal/distribution_caller.h b/third_party/abseil-cpp/absl/random/internal/distribution_caller.h index fc81b787..f1ad5ccd 100644 --- a/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +++ b/third_party/abseil-cpp/absl/random/internal/distribution_caller.h
@@ -32,6 +32,8 @@ // to intercept such calls. template <typename URBG> struct DistributionCaller { + static_assert(!std::is_pointer<URBG>::value, + "You must pass a reference, not a pointer."); // SFINAE to detect whether the URBG type includes a member matching // bool InvokeMock(base_internal::FastTypeIdType, void*, void*). //
diff --git a/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_asan_bazel.sh b/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_asan_bazel.sh index 5245933..0605e2b 100755 --- a/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_asan_bazel.sh +++ b/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_asan_bazel.sh
@@ -70,8 +70,8 @@ --rm \ -e CC="/opt/llvm/clang/bin/clang" \ -e BAZEL_CXXOPTS="-std=${std}:-nostdinc++" \ - -e BAZEL_LINKOPTS="-L/opt/llvm/libcxx/lib:-lc++:-lc++abi:-lm:-Wl,-rpath=/opt/llvm/libcxx/lib" \ - -e CPLUS_INCLUDE_PATH="/opt/llvm/libcxx/include/c++/v1" \ + -e BAZEL_LINKOPTS="-L/opt/llvm/libcxx/lib/x86_64-unknown-linux-gnu:-lc++:-lc++abi:-lm:-Wl,-rpath=/opt/llvm/libcxx/lib/x86_64-unknown-linux-gnu" \ + -e CPLUS_INCLUDE_PATH="/opt/llvm/libcxx/include/x86_64-unknown-linux-gnu/c++/v1:/opt/llvm/libcxx/include/c++/v1" \ ${DOCKER_EXTRA_ARGS:-} \ ${DOCKER_CONTAINER} \ /usr/local/bin/bazel test ... \
diff --git a/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_bazel.sh b/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_bazel.sh index e0fe653d..00517749 100755 --- a/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_bazel.sh +++ b/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_bazel.sh
@@ -71,8 +71,8 @@ --rm \ -e CC="/opt/llvm/clang/bin/clang" \ -e BAZEL_CXXOPTS="-std=${std}:-nostdinc++" \ - -e BAZEL_LINKOPTS="-L/opt/llvm/libcxx/lib:-lc++:-lc++abi:-lm:-Wl,-rpath=/opt/llvm/libcxx/lib" \ - -e CPLUS_INCLUDE_PATH="/opt/llvm/libcxx/include/c++/v1" \ + -e BAZEL_LINKOPTS="-L/opt/llvm/libcxx/lib/x86_64-unknown-linux-gnu:-lc++:-lc++abi:-lm:-Wl,-rpath=/opt/llvm/libcxx/lib/x86_64-unknown-linux-gnu" \ + -e CPLUS_INCLUDE_PATH="/opt/llvm/libcxx/include/x86_64-unknown-linux-gnu/c++/v1:/opt/llvm/libcxx/include/c++/v1" \ ${DOCKER_EXTRA_ARGS:-} \ ${DOCKER_CONTAINER} \ /bin/sh -c "
diff --git a/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_tsan_bazel.sh b/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_tsan_bazel.sh index 555f6b1..da4fcd0 100755 --- a/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_tsan_bazel.sh +++ b/third_party/abseil-cpp/ci/linux_clang-latest_libcxx_tsan_bazel.sh
@@ -70,8 +70,8 @@ --rm \ -e CC="/opt/llvm/clang/bin/clang" \ -e BAZEL_CXXOPTS="-std=${std}:-nostdinc++" \ - -e BAZEL_LINKOPTS="-L/opt/llvm/libcxx-tsan/lib:-lc++:-lc++abi:-lm:-Wl,-rpath=/opt/llvm/libcxx-tsan/lib" \ - -e CPLUS_INCLUDE_PATH="/opt/llvm/libcxx-tsan/include/c++/v1" \ + -e BAZEL_LINKOPTS="-L/opt/llvm/libcxx-tsan/lib/x86_64-unknown-linux-gnu:-lc++:-lc++abi:-lm:-Wl,-rpath=/opt/llvm/libcxx-tsan/lib/x86_64-unknown-linux-gnu" \ + -e CPLUS_INCLUDE_PATH="/opt/llvm/libcxx-tsan/include/x86_64-unknown-linux-gnu/c++/v1:/opt/llvm/libcxx-tsan/include/c++/v1" \ ${DOCKER_EXTRA_ARGS:-} \ ${DOCKER_CONTAINER} \ /usr/local/bin/bazel test ... \
diff --git a/third_party/abseil-cpp/ci/linux_docker_containers.sh b/third_party/abseil-cpp/ci/linux_docker_containers.sh index 32865b83..37be531 100644 --- a/third_party/abseil-cpp/ci/linux_docker_containers.sh +++ b/third_party/abseil-cpp/ci/linux_docker_containers.sh
@@ -16,6 +16,6 @@ # Test scripts should source this file to get the identifiers. readonly LINUX_ALPINE_CONTAINER="gcr.io/google.com/absl-177019/alpine:20201026" -readonly LINUX_CLANG_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20210617" -readonly LINUX_GCC_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20210617" +readonly LINUX_CLANG_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20220113" +readonly LINUX_GCC_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20220113" readonly LINUX_GCC_FLOOR_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-floor:20210617"
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index e9502f5..604ec8b4 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -629,6 +629,11 @@ const base::Feature kWebviewAccelerateSmallCanvases{ "WebviewAccelerateSmallCanvases", base::FEATURE_DISABLED_BY_DEFAULT}; +// Use old behavior for accelerated canvases: de-accelerate after first call to +// ctx.getImageData (crbug.com/1288118) +const base::Feature kSoftwareCanvas2DOnReadback{ + "SoftwareCanvas2DOnReadback", base::FEATURE_DISABLED_BY_DEFAULT}; + // When enabled, frees up CachedMetadata after consumption by script resources // and modules. Needed for the experiment in http://crbug.com/1045052. const base::Feature kDiscardCodeCacheAfterFirstUse{
diff --git a/third_party/blink/common/mime_util/OWNERS b/third_party/blink/common/mime_util/OWNERS index 9825bef9..9b72688 100644 --- a/third_party/blink/common/mime_util/OWNERS +++ b/third_party/blink/common/mime_util/OWNERS
@@ -1,3 +1,2 @@ -asanka@chromium.org mmenke@chromium.org rsleevi@chromium.org
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h index b04c9c1..17e7ffe 100644 --- a/third_party/blink/public/common/features.h +++ b/third_party/blink/public/common/features.h
@@ -200,6 +200,8 @@ BLINK_COMMON_EXPORT extern const base::Feature kWebviewAccelerateSmallCanvases; +BLINK_COMMON_EXPORT extern const base::Feature kSoftwareCanvas2DOnReadback; + BLINK_COMMON_EXPORT extern const base::Feature kDiscardCodeCacheAfterFirstUse; BLINK_COMMON_EXPORT extern const base::Feature kCacheCodeOnIdle;
diff --git a/third_party/blink/public/common/mime_util/OWNERS b/third_party/blink/public/common/mime_util/OWNERS index 9825bef9..9b72688 100644 --- a/third_party/blink/public/common/mime_util/OWNERS +++ b/third_party/blink/public/common/mime_util/OWNERS
@@ -1,3 +1,2 @@ -asanka@chromium.org mmenke@chromium.org rsleevi@chromium.org
diff --git a/third_party/blink/public/common/privacy_budget/OWNERS b/third_party/blink/public/common/privacy_budget/OWNERS index 83037bc..b5711be9 100644 --- a/third_party/blink/public/common/privacy_budget/OWNERS +++ b/third_party/blink/public/common/privacy_budget/OWNERS
@@ -1,3 +1,2 @@ -asanka@chromium.org pauljensen@chromium.org caraitto@chromium.org
diff --git a/third_party/blink/renderer/core/editing/commands/document_exec_command.cc b/third_party/blink/renderer/core/editing/commands/document_exec_command.cc index 7678ed3..06c39f7 100644 --- a/third_party/blink/renderer/core/editing/commands/document_exec_command.cc +++ b/third_party/blink/renderer/core/editing/commands/document_exec_command.cc
@@ -60,6 +60,37 @@ EditorCommandSource::kDOM); } +// Trusted Types requires that HTML (or Script, or script URLs) to be +// inserted into a Document go through a Trusted Types check first. This +// is a slightly awkward fit for execCommand API structure, which effectively +// dispatches to very different code based on its command name. Here, we'll +// check whether we need to run a Trusted Types check in the first place, and +// will also run the check if necessary. +String TrustedTypesCheck(Document* document, + const EditorCommand& editor_command, + const V8UnionStringOrTrustedHTML* value, + ExceptionState& exception_state) { + // If we receive null or the value parameter is missing, then there's nothing + // to check. + if (!value) + return g_empty_string; + + // TrustedHTML values always pass. + if (value->IsTrustedHTML()) + return value->GetAsTrustedHTML()->toString(); + + // We received a plain string. Most editor commands won't read the value as + // HTML. Those commands can pass. + DCHECK(value->IsString()); + if (!editor_command.IsValueInterpretedAsHTML()) + return value->GetAsString(); + + // We received plain string, and it's one of the commands of interest. + // Run the TT check. + return TrustedTypesCheckForExecCommand( + value->GetAsString(), document->GetExecutionContext(), exception_state); +} + } // namespace bool Document::execCommand(const String& command_name, @@ -112,17 +143,14 @@ UseCounter::Count(*this, WebFeature::kExecCommandWithTrustedTypes); } - // Extract the (unchecked) string from value. - // TODO(vogelheim): Once crbug.com/1230567 is resolved, this can be removed. - String string_value; - if (value->IsTrustedHTML()) - string_value = value->GetAsTrustedHTML()->toString(); - else if (value->IsString()) - string_value = value->GetAsString(); + String checked_value = + TrustedTypesCheck(this, editor_command, value, exception_state); + if (exception_state.HadException()) + return false; base::UmaHistogramSparse("WebCore.Document.execCommand", editor_command.IdForHistogram()); - return editor_command.Execute(string_value); + return editor_command.Execute(checked_value); } bool Document::queryCommandEnabled(const String& command_name,
diff --git a/third_party/blink/renderer/core/editing/commands/editor_command.cc b/third_party/blink/renderer/core/editing/commands/editor_command.cc index a4f0397..0281f55 100644 --- a/third_party/blink/renderer/core/editing/commands/editor_command.cc +++ b/third_party/blink/renderer/core/editing/commands/editor_command.cc
@@ -2052,6 +2052,11 @@ return command_ && command_->is_text_insertion; } +bool EditorCommand::IsValueInterpretedAsHTML() const { + return IsSupported() && + command_->command_type == EditingCommandType::kInsertHTML; +} + int EditorCommand::IdForHistogram() const { return IsSupported() ? static_cast<int>(command_->command_type) : 0; }
diff --git a/third_party/blink/renderer/core/editing/commands/editor_command.h b/third_party/blink/renderer/core/editing/commands/editor_command.h index de09f29..ca5b9d9 100644 --- a/third_party/blink/renderer/core/editing/commands/editor_command.h +++ b/third_party/blink/renderer/core/editing/commands/editor_command.h
@@ -64,6 +64,7 @@ String Value(Event* triggering_event = nullptr) const; bool IsTextInsertion() const; + bool IsValueInterpretedAsHTML() const; // Returns 0 if this EditorCommand is not supported. int IdForHistogram() const;
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc index 4e932b9..e9d715f 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -155,8 +155,7 @@ static LayoutUnit AdjustLineOffsetForHanging(NGLineInfo* line_info, LayoutUnit& line_offset) { - if (IsLtr(line_info->BaseDirection()) || - !line_info->ShouldHangTrailingSpaces()) + if (IsLtr(line_info->BaseDirection())) return LayoutUnit(); // If the hang_width cause overflow, we don't want to adjust the line_offset @@ -166,8 +165,14 @@ // that we ignore the hanging width when the NGInlineLayoutStateStack computes // their positions in ComputeInlinePositions function. LayoutUnit hang_width = line_info->HangWidth(); - if (line_offset < hang_width) + if (line_offset < hang_width) { + // If we haven't considered the hang_width in ApplyTextAlign, we might end + // up with a negative line_offset, so shift the offset to ignore hanging + // spaces. + if (!line_info->ShouldHangTrailingSpaces()) + line_offset += hang_width; return -hang_width; + } // At this point we have a RTL line with hanging spaces that shouldn't be // ignored based on the text-align property. Hence the final line_offset value
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker_test.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker_test.cc index 9b1dc5f..9dfd8da 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker_test.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker_test.cc
@@ -84,7 +84,7 @@ if (fill_first_space_ && lines.IsEmpty()) { first_should_hang_trailing_space_ = line_info.ShouldHangTrailingSpaces(); - first_hang_width_ = line_info.HangWidth(); + first_hang_width_ = line_info.HangWidthForAlignment(); } lines.push_back(std::make_pair(ToString(line_info.Results(), node), line_info.Results().back().item_index));
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_info.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_line_info.cc index 9c8ea1b..f947c5f 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_info.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_info.cc
@@ -125,12 +125,19 @@ void NGLineInfo::UpdateTextAlign() { text_align_ = GetTextAlign(IsLastLine()); + allow_hang_for_alignment_ = false; - if (HasTrailingSpaces() && ShouldHangTrailingSpaces()) { - hang_width_ = ComputeTrailingSpaceWidth(&end_offset_for_justify_); - } else if (text_align_ == ETextAlign::kJustify) { - end_offset_for_justify_ = InflowEndOffset(); + if (HasTrailingSpaces() && line_style_->AutoWrap()) { + if (ShouldHangTrailingSpaces()) { + hang_width_ = ComputeTrailingSpaceWidth(&end_offset_for_justify_); + allow_hang_for_alignment_ = true; + return; + } + hang_width_ = ComputeTrailingSpaceWidth(); } + + if (text_align_ == ETextAlign::kJustify) + end_offset_for_justify_ = InflowEndOffset(); } LayoutUnit NGLineInfo::ComputeTrailingSpaceWidth(
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_info.h b/third_party/blink/renderer/core/layout/ng/inline/ng_line_info.h index 5f1f940..327e4bf 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_info.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_info.h
@@ -100,9 +100,16 @@ LayoutUnit Width() const { return width_.ClampNegativeToZero(); } // Same as |Width()| but returns negative value as is. Preserved trailing // spaces may or may not be included, depends on |ShouldHangTrailingSpaces()|. - LayoutUnit WidthForAlignment() const { return width_ - hang_width_; } + LayoutUnit WidthForAlignment() const { + return width_ - HangWidthForAlignment(); + } // Width that hangs over the end of the line; e.g., preserved trailing spaces. LayoutUnit HangWidth() const { return hang_width_; } + // Same as |HangWidth()| but it may be 0 depending on + // |ShouldHangTrailingSpaces()|. + LayoutUnit HangWidthForAlignment() const { + return allow_hang_for_alignment_ ? hang_width_ : LayoutUnit(); + } // Compute |Width()| from |Results()|. Used during line breaking, before // |Width()| is set. After line breaking, this should match to |Width()| // without clamping. @@ -213,6 +220,7 @@ // Note: To avoid scanning |NGInlineItemResults|, this variable is true // when |NGInlineItemResult| to |results_|. bool may_have_text_combine_item_ = false; + bool allow_hang_for_alignment_ = false; }; std::ostream& operator<<(std::ostream& ostream, const NGLineInfo& line_info);
diff --git a/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm_helpers.cc b/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm_helpers.cc index 5bfb67b19..06087e3 100644 --- a/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm_helpers.cc +++ b/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm_helpers.cc
@@ -708,42 +708,18 @@ auto RowBlockSizeDeficit = [&percentage_resolution_block_size]( const NGTableTypes::Row& row) { - if (percentage_resolution_block_size == kIndefiniteSize) - return LayoutUnit(); + DCHECK_NE(percentage_resolution_block_size, kIndefiniteSize); DCHECK(row.percent); return (LayoutUnit(*row.percent * percentage_resolution_block_size / 100) - row.block_size) .ClampNegativeToZero(); }; - auto IsUnconstrainedNonEmptyRow = - [&percentage_resolution_block_size](const NGTableTypes::Row& row) { - if (row.block_size == LayoutUnit()) - return false; - if (row.percent && percentage_resolution_block_size == kIndefiniteSize) - return true; - return !row.is_constrained; - }; - - auto IsRowWithOriginatingRowspan = - [&start_row, - &desired_block_size_is_rowspan](const NGTableTypes::Row& row) { - // Rowspans are treated specially only during rowspan distribution. - return desired_block_size_is_rowspan && &row != start_row && - row.has_rowspan_start; - }; - - auto IsEmptyRow = - [&percentage_resolution_block_size](const NGTableTypes::Row& row) { - bool is_percent = percentage_resolution_block_size != kIndefiniteSize && - row.percent && *row.percent != 0; - return row.block_size == LayoutUnit() && !is_percent; - }; - - Vector<wtf_size_t> percent_rows_with_deficit; Vector<wtf_size_t> rows_with_originating_rowspan; + Vector<wtf_size_t> percent_rows_with_deficit; Vector<wtf_size_t> unconstrained_non_empty_rows; Vector<wtf_size_t> empty_rows; + Vector<wtf_size_t> non_empty_rows; Vector<wtf_size_t> unconstrained_empty_rows; unsigned constrained_non_empty_row_count = 0; @@ -754,25 +730,43 @@ for (auto index = start_row_index; index < end_row_index; ++index) { const auto& row = rows->at(index); total_block_size += row.block_size; - if (row.percent) { + + // Rowspans are treated specially only during rowspan distribution. + bool is_row_with_originating_rowspan = desired_block_size_is_rowspan && + index != start_row_index && + row.has_rowspan_start; + if (is_row_with_originating_rowspan) + rows_with_originating_rowspan.push_back(index); + + bool is_row_empty = row.block_size == LayoutUnit(); + + if (row.percent && *row.percent != 0 && + percentage_resolution_block_size != kIndefiniteSize) { LayoutUnit deficit = RowBlockSizeDeficit(row); if (deficit != LayoutUnit()) { percent_rows_with_deficit.push_back(index); percent_block_size_deficit += deficit; + is_row_empty = false; } } - if (IsRowWithOriginatingRowspan(row)) - rows_with_originating_rowspan.push_back(index); - if (IsUnconstrainedNonEmptyRow(row)) { - unconstrained_non_empty_rows.push_back(index); - unconstrained_non_empty_row_block_size += row.block_size; - } else if (row.is_constrained && !IsEmptyRow(row)) { - constrained_non_empty_row_count++; - } - if (IsEmptyRow(row)) { + + // Only consider percent rows that resolve as constrained. + const bool is_row_constrained = + row.is_constrained && + (!row.percent || percentage_resolution_block_size != kIndefiniteSize); + + if (is_row_empty) { empty_rows.push_back(index); - if (!row.is_constrained) + if (!is_row_constrained) unconstrained_empty_rows.push_back(index); + } else { + non_empty_rows.push_back(index); + if (is_row_constrained) { + constrained_non_empty_row_count++; + } else { + unconstrained_non_empty_rows.push_back(index); + unconstrained_non_empty_row_block_size += row.block_size; + } } } @@ -833,7 +827,6 @@ LayoutUnit remaining_deficit = distributable_block_size; for (auto& index : unconstrained_non_empty_rows) { auto& row = rows->at(index); - DCHECK(IsUnconstrainedNonEmptyRow(row)); LayoutUnit delta = LayoutUnit(row.block_size * distributable_block_size.ToFloat() / unconstrained_non_empty_row_block_size); @@ -893,20 +886,19 @@ // Step 5: Grow non-empty rows in proportion to current block size. // It grows constrained, and unconstrained rows. - NGTableTypes::Row* last_row = nullptr; - LayoutUnit remaining_deficit = distributable_block_size; - for (NGTableTypes::Row* row = start_row; row != end_row; ++row) { - if (row->block_size == LayoutUnit()) - continue; - last_row = row; - LayoutUnit delta = LayoutUnit(distributable_block_size * - row->block_size.ToFloat() / total_block_size); - row->block_size += delta; - remaining_deficit -= delta; - } - if (last_row) { - last_row->block_size += remaining_deficit; - last_row->block_size = std::max(last_row->block_size, LayoutUnit()); + if (!non_empty_rows.IsEmpty()) { + LayoutUnit remaining_deficit = distributable_block_size; + for (auto& index : non_empty_rows) { + auto& row = rows->at(index); + LayoutUnit delta = + LayoutUnit(distributable_block_size * row.block_size.ToFloat() / + total_block_size); + row.block_size += delta; + remaining_deficit -= delta; + } + auto& last_row = rows->at(non_empty_rows.back()); + last_row.block_size += remaining_deficit; + last_row.block_size = std::max(last_row.block_size, LayoutUnit()); } }
diff --git a/third_party/blink/renderer/core/timing/performance_resource_timing.cc b/third_party/blink/renderer/core/timing/performance_resource_timing.cc index 2d10e649..8ba7dd3 100644 --- a/third_party/blink/renderer/core/timing/performance_resource_timing.cc +++ b/third_party/blink/renderer/core/timing/performance_resource_timing.cc
@@ -200,12 +200,10 @@ AtomicString returnedProtocol = (alpn_negotiated_protocol == "unknown") ? connection_info : alpn_negotiated_protocol; - // If connection_info is unknown, or if this is a `document` destination and - // TAO didn't pass, return the empty string. - // https://github.com/w3c/navigation-timing/issues/71 - // https://github.com/w3c/resource-timing/pull/224 - if (returnedProtocol == "unknown" || - (!AllowTimingDetails() && IsDocumentDestination(context_type_))) { + // If connection_info is unknown, or if TAO didn't pass, return the empty + // string. + // https://fetch.spec.whatwg.org/#create-an-opaque-timing-info + if (returnedProtocol == "unknown" || !AllowTimingDetails()) { returnedProtocol = ""; }
diff --git a/third_party/blink/renderer/core/timing/performance_resource_timing.h b/third_party/blink/renderer/core/timing/performance_resource_timing.h index c682729..c55e0d9 100644 --- a/third_party/blink/renderer/core/timing/performance_resource_timing.h +++ b/third_party/blink/renderer/core/timing/performance_resource_timing.h
@@ -146,15 +146,15 @@ network::mojom::RequestDestination request_destination_ = network::mojom::RequestDestination::kEmpty; mojom::blink::CacheState cache_state_ = mojom::blink::CacheState::kNone; - uint64_t encoded_body_size_ = 0; - uint64_t decoded_body_size_ = 0; - bool did_reuse_connection_ = false; + const uint64_t encoded_body_size_ = 0; + const uint64_t decoded_body_size_ = 0; + const bool did_reuse_connection_ = false; // Do not access allow_timing_details_ directly. Instead use the // AllowTimingDetails() method which is overridden by some sub-classes. - bool allow_timing_details_ = false; - bool allow_redirect_details_ = false; - bool allow_negative_value_ = false; - bool is_secure_transport_ = false; + const bool allow_timing_details_ = false; + const bool allow_redirect_details_ = false; + const bool allow_negative_value_ = false; + const bool is_secure_transport_ = false; HeapVector<Member<PerformanceServerTiming>> server_timing_; HeapVector<Member<PerformanceEntry>> worker_timing_;
diff --git a/third_party/blink/renderer/core/timing/performance_resource_timing_test.cc b/third_party/blink/renderer/core/timing/performance_resource_timing_test.cc index 4a5bfd4..03e194a 100644 --- a/third_party/blink/renderer/core/timing/performance_resource_timing_test.cc +++ b/third_party/blink/renderer/core/timing/performance_resource_timing_test.cc
@@ -16,20 +16,35 @@ const AtomicString& connection_info) { mojom::blink::ResourceTimingInfo info; info.allow_timing_details = true; - std::unique_ptr<DummyPageHolder> dummy_page_holder = - std::make_unique<DummyPageHolder>(); - PerformanceResourceTiming* timing = - MakeGarbageCollected<PerformanceResourceTiming>( - info, base::TimeTicks(), - dummy_page_holder->GetDocument() - .GetExecutionContext() - ->CrossOriginIsolatedCapability(), - /*initiator_type=*/"", - mojo::PendingReceiver<mojom::blink::WorkerTimingContainer>(), - dummy_page_holder->GetDocument().GetExecutionContext()); + PerformanceResourceTiming* timing = MakePerformanceResourceTiming(info); return timing->GetNextHopProtocol(alpn_negotiated_protocol, connection_info); } + + AtomicString GetNextHopProtocolWithoutTao( + const AtomicString& alpn_negotiated_protocol, + const AtomicString& connection_info) { + mojom::blink::ResourceTimingInfo info; + info.allow_timing_details = false; + PerformanceResourceTiming* timing = MakePerformanceResourceTiming(info); + return timing->GetNextHopProtocol(alpn_negotiated_protocol, + connection_info); + } + + private: + PerformanceResourceTiming* MakePerformanceResourceTiming( + const mojom::blink::ResourceTimingInfo& info) { + std::unique_ptr<DummyPageHolder> dummy_page_holder = + std::make_unique<DummyPageHolder>(); + return MakeGarbageCollected<PerformanceResourceTiming>( + info, base::TimeTicks(), + dummy_page_holder->GetDocument() + .GetExecutionContext() + ->CrossOriginIsolatedCapability(), + /*initiator_type=*/"", + mojo::PendingReceiver<mojom::blink::WorkerTimingContainer>(), + dummy_page_holder->GetDocument().GetExecutionContext()); + } }; TEST_F(PerformanceResourceTimingTest, @@ -60,4 +75,13 @@ EXPECT_EQ(GetNextHopProtocol(alpn_negotiated_protocol, connection_info), alpn_negotiated_protocol); } + +TEST_F(PerformanceResourceTimingTest, TestNextHopProtocolIsGuardedByTao) { + AtomicString connection_info = "http/1.1"; + AtomicString alpn_negotiated_protocol = "RandomProtocol"; + EXPECT_EQ( + GetNextHopProtocolWithoutTao(alpn_negotiated_protocol, connection_info), + ""); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc index 841a765..3201eb4 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc +++ b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.cc
@@ -593,4 +593,11 @@ kNavigateToJavascriptURL, kNavigateToJavascriptURLAndDefaultPolicyFailed); } +String TrustedTypesCheckForExecCommand( + String html, + const ExecutionContext* execution_context, + ExceptionState& exception_state) { + return TrustedTypesCheckForHTML(html, execution_context, exception_state); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h index 0a11c3c..b208f2b 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h +++ b/third_party/blink/renderer/core/trustedtypes/trusted_types_util.h
@@ -63,6 +63,14 @@ ScriptElementBase::Type, ExecutionContext*); +// Functionally equivalent to TrustedTypesCheckForHTML(const String&, ...), +// but with separate enable flag and use counter, to ensure this won't break +// existing sites before enabling it in full. +CORE_EXPORT String TrustedTypesCheckForExecCommand(String, + const ExecutionContext*, + ExceptionState&) + WARN_UNUSED_RESULT; + // Determine whether a Trusted Types check is needed in this execution context. // // Note: All methods above handle this internally and will return success if a
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc index e385e04..b051edd 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
@@ -2009,7 +2009,8 @@ // attribute that let the users indicate if a canvas will be read frequently // through getImageData, thus uses CPU rendering from the start in such cases. if (!RuntimeEnabledFeatures::NewCanvas2DAPIEnabled( - GetTopExecutionContext())) { + GetTopExecutionContext()) || + base::FeatureList::IsEnabled(features::kSoftwareCanvas2DOnReadback)) { // GetImagedata is faster in Unaccelerated canvases. // In Desynchronized canvas disabling the acceleration will break // putImageData: crbug.com/1112060.
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc index 3f0b191..67803d9 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc
@@ -119,7 +119,7 @@ return true; } -#if !defined(OS_IOS) +#if !BUILDFLAG(IS_IOS) if (properties.goog_auto_gain_control) { return true; }
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor_test.cc b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor_test.cc index 4d730d0..2fb91b28 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor_test.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_audio_processor_test.cc
@@ -150,7 +150,7 @@ EXPECT_FALSE(config.voice_detection.enabled); EXPECT_FALSE(config.gain_controller1.analog_gain_controller .clipping_predictor.enabled); -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) EXPECT_TRUE(config.echo_canceller.mobile_mode); EXPECT_EQ(config.gain_controller1.mode, config.gain_controller1.kFixedDigital); @@ -170,7 +170,7 @@ public ::testing::WithParamInterface<bool> {}; // Test crashing with ASAN on Android. crbug.com/468762 -#if defined(OS_ANDROID) && defined(ADDRESS_SANITIZER) +#if BUILDFLAG(IS_ANDROID) && defined(ADDRESS_SANITIZER) #define MAYBE_WithAudioProcessing DISABLED_WithAudioProcessing #else #define MAYBE_WithAudioProcessing WithAudioProcessing @@ -224,7 +224,7 @@ } // Test crashing with ASAN on Android. crbug.com/468762 -#if defined(OS_ANDROID) && defined(ADDRESS_SANITIZER) +#if BUILDFLAG(IS_ANDROID) && defined(ADDRESS_SANITIZER) #define MAYBE_TestAllSampleRates DISABLED_TestAllSampleRates #else #define MAYBE_TestAllSampleRates TestAllSampleRates @@ -703,7 +703,7 @@ AudioProcessingProperties::EchoCancellationType::kEchoCancellationAec3; // WouldModifyAudio overrides this effect on iOS, but not the audio processor. // TODO(https://crbug.com/1269364): Make these functions behave consistently. -#if !defined(OS_IOS) +#if !BUILDFLAG(IS_IOS) EXPECT_TRUE(MediaStreamAudioProcessor::WouldModifyAudio(properties)); #else EXPECT_FALSE(MediaStreamAudioProcessor::WouldModifyAudio(properties)); @@ -738,7 +738,7 @@ properties.goog_auto_gain_control = true; // WouldModifyAudio overrides this effect on iOS, but not the audio processor. // TODO(https://crbug.com/1269364): Make these functions behave consistently. -#if !defined(OS_IOS) +#if !BUILDFLAG(IS_IOS) EXPECT_TRUE(MediaStreamAudioProcessor::WouldModifyAudio(properties)); #else EXPECT_FALSE(MediaStreamAudioProcessor::WouldModifyAudio(properties)); @@ -759,7 +759,7 @@ properties.DisableDefaultProperties(); properties.goog_experimental_echo_cancellation = true; // WouldModifyAudio overrides this effect on iOS and Android. -#if !defined(OS_IOS) && !defined(OS_ANDROID) +#if !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_ANDROID) EXPECT_TRUE(MediaStreamAudioProcessor::WouldModifyAudio(properties)); #else EXPECT_FALSE(MediaStreamAudioProcessor::WouldModifyAudio(properties)); @@ -768,7 +768,7 @@ scoped_refptr<MediaStreamAudioProcessor> audio_processor = CreateAudioProcessorWithProperties(properties); // WouldModifyAudio overrides this effect on iOS and Android. -#if !defined(OS_IOS) && !defined(OS_ANDROID) +#if !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_ANDROID) EXPECT_TRUE(audio_processor->has_webrtc_audio_processing()); #else EXPECT_FALSE(audio_processor->has_webrtc_audio_processing());
diff --git a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc index db3055c..6702ebe 100644 --- a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc +++ b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source.cc
@@ -107,7 +107,7 @@ // AEC is active. This is currently the default on at least MacOS but is not // allowed for ChromeOS setups. constexpr bool IsIndependentSystemNsAllowed() { -#if defined(OS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS) return false; #else return true; @@ -116,7 +116,7 @@ int GetCaptureBufferSize(bool need_webrtc_processing, const media::AudioParameters input_device_params) { -#if defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMECAST) +#if BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMECAST) // TODO(henrika): Re-evaluate whether to use same logic as other platforms. // https://crbug.com/638081 return 2 * input_device_params.sample_rate() / 100;
diff --git a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source_test.cc b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source_test.cc index 1e1bd20..dea908f 100644 --- a/third_party/blink/renderer/modules/mediastream/processed_local_audio_source_test.cc +++ b/third_party/blink/renderer/modules/mediastream/processed_local_audio_source_test.cc
@@ -40,7 +40,7 @@ // On Android, ProcessedLocalAudioSource forces a 20ms buffer size from the // input device. -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) constexpr int kExpectedSourceBufferSize = kSampleRate / 50; #else constexpr int kExpectedSourceBufferSize = kRequestedBufferSize;
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc index d2a49ac7..ec7bc99 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
@@ -775,8 +775,7 @@ } bool ServiceWorkerGlobalScope::CrossOriginIsolatedCapability() const { - // TODO(crbug.com/1131404): Return Agent::IsCrossOriginIsolated(). - return false; + return Agent::IsCrossOriginIsolated(); } bool ServiceWorkerGlobalScope::DirectSocketCapability() const {
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng index d85c742..b30c2ae 100644 --- a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng +++ b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng
@@ -598,6 +598,14 @@ crbug.com/1162836 external/wpt/css/css-text/white-space/trailing-ideographic-space-020.html [ Failure ] crbug.com/1162836 external/wpt/css/css-text/white-space/trailing-ideographic-space-023.html [ Failure ] crbug.com/1162836 external/wpt/css/css-text/hyphens/hyphens-auto-004.html [ Failure ] +crbug.com/782638 external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-001.html [ Failure ] +crbug.com/782638 external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-003.html [ Failure ] +crbug.com/782638 external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-004.html [ Failure ] +crbug.com/782638 external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-005.html [ Failure ] +crbug.com/782638 external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-001.html [ Failure ] +crbug.com/782638 external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html [ Failure ] +crbug.com/782638 external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-004.html [ Failure ] +crbug.com/782638 external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-005.html [ Failure ] ### external/wpt/css/css-text/word-break/ crbug.com/591099 external/wpt/css/css-text/word-break/word-break-break-all-004.html [ Failure ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index a8b5d11..d7f24c21 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -3049,6 +3049,11 @@ crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-flexbox/flexbox_flow-column-wrap.html [ Crash Failure ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 external/wpt/css/compositing/background-blending/background-blend-mode-plus-lighter.html [ Failure ] +crbug.com/626703 external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html [ Failure ] +crbug.com/626703 external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html [ Failure ] +crbug.com/626703 external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html [ Failure ] +crbug.com/626703 [ Mac11 ] virtual/off-main-thread-css-paint/external/wpt/css/css-paint-api/parse-input-arguments-002.https.html [ Failure ] crbug.com/626703 [ Mac10.15 ] virtual/off-main-thread-css-paint/external/wpt/css/css-paint-api/registered-property-value-013.https.html [ Failure ] crbug.com/626703 [ Mac10.13 ] external/wpt/wasm/jsapi/constructor/instantiate-bad-imports.any.html [ Timeout ] crbug.com/626703 [ Mac10.13 ] external/wpt/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html [ Timeout ] @@ -5032,8 +5037,8 @@ crbug.com/1179186 virtual/first-party-sets/http/tests/inspector-protocol/network/blocked-setcookie-same-party-cross-party-issue.js [ Pass ] # Temporarily disabled to allow a change to DebuggerModel#scriptsForSourceUrl to land. -crbug.com/1277403 http/tests/devtools/bindings/inline-styles-binding.js [ Pass Failure ] -crbug.com/1277403 http/tests/devtools/sources/debugger-ui/script-snippet-model.js [ Pass Failure ] +crbug.com/1277403 http/tests/devtools/bindings/inline-styles-binding.js [ Failure Pass ] +crbug.com/1277403 http/tests/devtools/sources/debugger-ui/script-snippet-model.js [ Failure Pass ] # Sheriff 2018-04-13 crbug.com/833655 [ Linux ] media/controls/closed-captions-dynamic-update.html [ Skip ] @@ -7593,9 +7598,9 @@ # Sheriff 2022-01-18 crbug.com/1287067 virtual/fenced-frame-mparch/wpt_internal/fenced_frame/embedder-require-corp.https.html [ Failure Pass ] -crbug.com/1288264 [ Win ] http/tests/fetch/serviceworker-proxied/thorough/redirect-loop-base-https-other-https.html [ Skip Pass Timeout ] -crbug.com/1288264 [ Win ] http/tests/fetch/window/thorough/cors-preflight2-base-https-other-https.html [ Skip Pass Timeout ] -crbug.com/1288264 [ Win ] http/tests/fetch/serviceworker/thorough/nocors-base-https-other-https.html [ Skip Pass Timeout ] +crbug.com/1288264 [ Win ] http/tests/fetch/serviceworker-proxied/thorough/redirect-loop-base-https-other-https.html [ Pass Skip Timeout ] +crbug.com/1288264 [ Win ] http/tests/fetch/window/thorough/cors-preflight2-base-https-other-https.html [ Pass Skip Timeout ] +crbug.com/1288264 [ Win ] http/tests/fetch/serviceworker/thorough/nocors-base-https-other-https.html [ Pass Skip Timeout ] crbug.com/1288264 [ Win ] http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write.html [ Pass Timeout ] crbug.com/1227911 [ Linux Release ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomainport.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Mac10.14 ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomainport.sub.https.html [ Failure Pass ] @@ -7605,9 +7610,13 @@ crbug.com/1227911 [ Mac10.14 ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-yes-child1-no-subdomain-child2-no-subdomain2.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Linux Release ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-subdomain-yes-2-subdomain2-no.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Mac10.14 ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-subdomain-yes-2-subdomain2-no.sub.https.html [ Failure Pass ] -crbug.com/1227911 [ Win Release ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomain.sub.https.html [ Failure Pass ] +crbug.com/1227911 [ Release Win ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomain.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Linux Release ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomain.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Mac10.14 ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomain.sub.https.html [ Failure Pass ] -crbug.com/1227911 [ Win Release ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-no-subdomain-2-yes-subdomain.sub.https.html [ Failure Pass ] +crbug.com/1227911 [ Release Win ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-no-subdomain-2-yes-subdomain.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Linux Release ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-no-subdomain-2-yes-subdomain.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Mac10.14 ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-no-subdomain-2-yes-subdomain.sub.https.html [ Failure Pass ] + +# Flaky test on mac. +crbug.com/1282347 [ Mac ] virtual/clipboard-custom-formats/clipboard/async-clipboard/async-custom-formats-write-read.tentative.https.html [ Failure Pass ] +crbug.com/1282347 [ Mac ] virtual/clipboard-custom-formats/clipboard/async-clipboard/async-custom-format-write-read.tentative.https.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json index e8918f3..0414defe 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
@@ -1021,6 +1021,20 @@ ] }, "css-layout-api": { + "chrome-bug-1287843-000-crash.https.html": [ + "6137eba6dcf1d5fa61abb0b4bd2c437be8b72d36", + [ + null, + {} + ] + ], + "chrome-bug-1287843-001-crash.https.html": [ + "ac8c6ecf1ad77fe2432ba66f69a30b71e46118c5", + [ + null, + {} + ] + ], "input-text-crash.https.html": [ "2d32609040a970fa0b20ec6f0530b91c53a360d4", [ @@ -2952,6 +2966,13 @@ }, "mathml": { "crashtests": { + "chrome-bug-1287843.html": [ + "6fc95fc12e11d28ae69ec05bcd8d935103b5bcb1", + [ + null, + {} + ] + ], "display-and-column-properties.html": [ "c40a2a05497642d076962315b6b90cc3f5987360", [ @@ -69400,6 +69421,19 @@ ], {} ] + ], + "background-blend-mode-plus-lighter.html": [ + "0816dc691b7f812da4962755b8c765a0e5074e99", + [ + null, + [ + [ + "/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html", + "==" + ] + ], + {} + ] ] }, "compositing_simple_div.html": [ @@ -69780,7 +69814,20 @@ {} ] ], - "mix-blend-mode-plus-lighter-svg.html": [ + "mix-blend-mode-plus-lighter-basic.html": [ + "fcf2d172afd6b1ebc99f64021a66a548d5b1f1fd", + [ + null, + [ + [ + "/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html", + "==" + ] + ], + {} + ] + ], + "mix-blend-mode-plus-lighter-svg-basic.html": [ "4762389ca9257440a1297a3e246af0eddd78bf22", [ null, @@ -69793,8 +69840,21 @@ {} ] ], + "mix-blend-mode-plus-lighter-svg.html": [ + "fc5e94e74e90b083b5bf609f19fefbe570190bc0", + [ + null, + [ + [ + "/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html", + "==" + ] + ], + {} + ] + ], "mix-blend-mode-plus-lighter.html": [ - "ae3dff155dce88166be3bb28ac40e2531720e2f3", + "e6fc4d73a0421e4e1978c3d4875b0f2e85c5917e", [ null, [ @@ -131890,6 +131950,45 @@ {} ] ], + "change-fragmentainer-size-000.html": [ + "823506d1c55e23addc2838ee3c92bf19995d8ec5", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "change-fragmentainer-size-001.html": [ + "d9ae7b1b6628c51e239977e23bf3ec97dc347737", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], + "change-fragmentainer-size-002.html": [ + "4b3804361e1cb432962275726fc355fcc5e415f6", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "change-intrinsic-width.html": [ "3df3e1ebc8f9b5780dc858a878bca13dbedcdb35", [ @@ -133204,7 +133303,7 @@ ] ], "multicol-fill-balance-018.html": [ - "692071c4834bfa64326823ea365db57200dd6605", + "fd4f47c591d743ab4cbb6e52c22ee8b7323396db", [ null, [ @@ -168431,6 +168530,32 @@ {} ] ], + "white-space-pre-wrap-trailing-spaces-022.html": [ + "95f4361e8395e28e21d03dce4d9e0d454651bf5c", + [ + null, + [ + [ + "/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html", + "==" + ] + ], + {} + ] + ], + "white-space-pre-wrap-trailing-spaces-023.html": [ + "3986079e62b95a2c64098a62c6cfe8ad44a58e64", + [ + null, + [ + [ + "/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html", + "==" + ] + ], + {} + ] + ], "white-space-wrap-after-nowrap-001.html": [ "5947c289e8752c26a17631f37309de7874d68986", [ @@ -206340,7 +206465,7 @@ ] ], "mq-invalid-media-type-001.html": [ - "24ebd9fd4fcf302a9d695b549098ed7663d18277", + "a88f18173e0c4f95a92943c0e6ff388827142932", [ null, [ @@ -206353,7 +206478,7 @@ ] ], "mq-invalid-media-type-002.html": [ - "71f597e447b346d5115307cb8e174b2b6ebd52c0", + "763a7f29205757b57395465741b9a2ae65e9dd42", [ null, [ @@ -206366,7 +206491,7 @@ ] ], "mq-invalid-media-type-003.html": [ - "b12bd75814a52a7232467bcd724db1b94dc08ee9", + "acc524ca98a305fe8fad3a871c18e02bbe5c4933", [ null, [ @@ -206379,7 +206504,7 @@ ] ], "mq-invalid-media-type-004.html": [ - "d039281c0254e2bb794e229baecbe4d39c547baa", + "689c8d1a78d193225eac5a6b84c19f32b0e94913", [ null, [ @@ -214632,6 +214757,19 @@ {} ] ], + "select-intrinsic-option-font-size.html": [ + "7f36708973d4c01f9af0e3c613ccaddd738ea6e9", + [ + null, + [ + [ + "/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size-ref.html", + "==" + ] + ], + {} + ] + ], "select-intrinsic-text-transform.html": [ "1026e29977bfbc1ccc24bd2597743c40fb7eb4c3", [ @@ -227503,6 +227641,10 @@ [] ], "resources": { + "cross-origin-helper-frame.html": [ + "997c5a2b72bafcad3421ccb48e48e323de6ef6f0", + [] + ], "idbfactory-origin-isolation-iframe.html": [ "d405ea48e15e298241a2c400a6d04adbd054e1e5", [] @@ -232880,6 +233022,10 @@ "b58767080c33af12e82638869ef395346ca509e5", [] ], + "idlharness.https.window-expected.txt": [ + "6e82efe03661492bd611a401f2af2e0a63a0f86d", + [] + ], "passwordcredential-framed-get.sub.https-expected.txt": [ "b58767080c33af12e82638869ef395346ca509e5", [] @@ -239908,6 +240054,10 @@ "background-blend-mode-gradient-image-ref.html": [ "4389960d783c91c414b33e1aaf0466ca91ee5942", [] + ], + "background-blend-mode-plus-lighter-ref.html": [ + "550981986b04746bda8f20ced60c0f9bd7ff3053", + [] ] }, "support": { @@ -240035,14 +240185,22 @@ "275105c5dbb03cf1b82eb058e856d53b129ecbe9", [] ], - "mix-blend-mode-plus-lighter-ref.html": [ + "mix-blend-mode-plus-lighter-basic-ref.html": [ "e5acd26b6fd498d12f2591d4b04aa3c8f748e153", [] ], - "mix-blend-mode-plus-lighter-svg-ref.html": [ + "mix-blend-mode-plus-lighter-ref.html": [ + "4709ab8b6882eb5cf33d1d3180ca5a7585f1ddb2", + [] + ], + "mix-blend-mode-plus-lighter-svg-basic-ref.html": [ "9193bb574b3f9537a26f5ce0c5430f1685058c63", [] ], + "mix-blend-mode-plus-lighter-svg-ref.html": [ + "8e1cb707599c4f5d2a9b42343076d61253ad22a2", + [] + ], "mix-blend-mode-rotated-clip-ref.html": [ "377ed7c879fd8ec15ff660da617294bc119206e0", [] @@ -240153,6 +240311,16 @@ "be2348ab967f2ff4c161f8bbb9999a0bd8523e82", [] ], + "support": { + "plus-lighter.js": [ + "cadefa57282360af0910e9616671f1103c5f4c5d", + [] + ], + "utils.js": [ + "eb369ce2e58f0a25e1ff543b2ed53e2e2ac99b06", + [] + ] + }, "svg": { "reference": { "mix-blend-mode-in-svg-image-ref.html": [ @@ -243546,10 +243714,6 @@ "262fe39522e0e251756616705d700a7ba77b0ca7", [] ], - "container-for-shadow-dom.tentative-expected.txt": [ - "c68cca2e9841c1417971e347182def49812084cb", - [] - ], "container-name-parsing-expected.txt": [ "cda9550e7fa97b050f5aa2d435ad54a015e41fc1", [] @@ -261484,7 +261648,7 @@ [] ], "idlharness-expected.txt": [ - "46168b29be8578ef30c6b2b2cc71e88883ab6d75", + "f76169b892e8b8f5dc8d8c2ce5a1ee1992fe6432", [] ], "marker-and-other-pseudo-elements-ref.html": [ @@ -278067,6 +278231,10 @@ "dfa29a887db747cc5f1d34aa120b8860fa39a552", [] ], + "EventListener-handleEvent-cross-realm-expected.txt": [ + "bbda97de800889e3add4560d075bc140db95a8ed", + [] + ], "EventListener-handleEvent-expected.txt": [ "bb076e74f458f8aa89855d42ef845b55b2ccb354", [] @@ -278096,6 +278264,10 @@ [] ], "resources": { + "empty-document.html": [ + "b9cd130a07f77ee1a54f4bf54df54dc126fec1ee", + [] + ], "event-global-extra-frame.html": [ "241dda8b66f8c8fe128e736bcb073479aee634a9", [] @@ -278128,8 +278300,20 @@ "e31ca4f3c12693d4faa4a336b46edb3df545a09f", [] ], + "idlharness.any.serviceworker-expected.txt": [ + "a67b4ba7731a5e4b1e38685b3e5fba79c84f02a4", + [] + ], + "idlharness.any.sharedworker-expected.txt": [ + "a67b4ba7731a5e4b1e38685b3e5fba79c84f02a4", + [] + ], + "idlharness.any.worker-expected.txt": [ + "a67b4ba7731a5e4b1e38685b3e5fba79c84f02a4", + [] + ], "idlharness.window_exclude=Node-expected.txt": [ - "12920ef81a8107ddc637b89bf590c64e5a154d74", + "aa4572f1be7c0b080c99d6cef2d2bb38ebf69dbc", [] ], "lists": { @@ -278523,26 +278707,18 @@ [] ], "traversal": { - "TreeWalker-acceptNode-filter-cross-realm-expected.txt": [ - "7948b1bf20723649a696ddc36b6a885c1f3a62a7", - [] - ], - "TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-expected.txt": [ - "e9ed6f07909cb4a9ba25de88d5426744236e701f", - [] - ], "support": { "TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-subframe.html": [ "f5e393d0f081728aba806a7155fb8139796b089d", [] ], - "TreeWalker-acceptNode-filter-cross-realm-subframe.html": [ - "0c8bda14c0faf2b81fbb7556f9c12a0631bba7ec", - [] - ], "assert-node.js": [ "0d5d8ad74fce7dcd4d60a1a11525c5134407f8ba", [] + ], + "empty-document.html": [ + "b9cd130a07f77ee1a54f4bf54df54dc126fec1ee", + [] ] }, "unfinished": { @@ -278688,6 +278864,10 @@ "0805bd682b48461588250a22018a6bd90990d002", [] ], + "resolver-callback-interface-cross-realm-expected.txt": [ + "1e681034783394d9c33b46355bec25169e0dd234", + [] + ], "resolver-callback-interface-expected.txt": [ "a3e74bd621d3cbd370e1c657bc545e0b32474a60", [] @@ -278697,8 +278877,12 @@ [] ], "resources": { + "empty-document.html": [ + "b9cd130a07f77ee1a54f4bf54df54dc126fec1ee", + [] + ], "invalid_namespace_test.js": [ - "b985261551e0b7526c205ec85667c4948ed8b681", + "8b934eff4e8d14d41ec30caecfcd4a7dcad305bc", [] ] }, @@ -280950,6 +281134,10 @@ "9e3a2546556a896943d73233cb647edca73d9dd4", [] ], + "idlharness.any-expected.txt": [ + "c4137e86e3b4245e560d978087e3dfae56422500", + [] + ], "resources": { "crossiframe-childframe.html": [ "6a8bc6b64240636dbc576aaa15b9c86b799dae8e", @@ -282876,40 +283064,24 @@ [] ], "shared-worker-fetch.https.window-expected.txt": [ - "31ae173f70264676caf5d4173fd308f9f20acb1b", + "0b54e1fb1a79866ca2e731de446b21f1d79e3a5d", [] ], "shared-worker-fetch.window-expected.txt": [ "cd62872e656ae0b85bc3257d8e1b789e087b9935", [] ], - "shared-worker.https.window-expected.txt": [ - "c7cd66da3743edf09e60f658824fea067e4da015", - [] - ], - "shared-worker.window-expected.txt": [ - "8718ffde7bc70a2802ec04ecd5c1e3b42e0dca32", - [] - ], "websocket.window-expected.txt": [ "11e2dcac903cb8fb7f68563036c4b8a4a9c1a9e7", [] ], "worker-fetch.https.window-expected.txt": [ - "0b54e1fb1a79866ca2e731de446b21f1d79e3a5d", + "4ea413e243878208fb41d891d71645b433c64018", [] ], "worker-fetch.window-expected.txt": [ "cd62872e656ae0b85bc3257d8e1b789e087b9935", [] - ], - "worker.https.window-expected.txt": [ - "c7cd66da3743edf09e60f658824fea067e4da015", - [] - ], - "worker.window-expected.txt": [ - "8718ffde7bc70a2802ec04ecd5c1e3b42e0dca32", - [] ] }, "range": { @@ -283506,11 +283678,11 @@ [] ], "window-tests-blob.js": [ - "e21733ce7f1afc8410899d1b5e58d56ec642c43c", + "3279849c5e285fc756f2f0620f09e64121d1a24c", [] ], "window-tests-enumeration.js": [ - "838e5c34346286545fe7aa5cd7faf8bcb2310fe8", + "be906f6ed3355784d3848891685fb2bc27089920", [] ] } @@ -288522,10 +288694,6 @@ "133807fb285da0e897d84b688da39281d5b67bfc", [] ], - "drawing-rectangles-to-the-canvas.yaml": [ - "7b042d854fefdedd4691609c0c322b6b0730062b", - [] - ], "drawing-text-to-the-canvas.yaml": [ "686bd0763f214cff22be0fa5bd7a59a5a057fcb3", [] @@ -288592,10 +288760,6 @@ "f2be7b8e07bd648c8fb690750fb894a17cbcc81e", [] ], - "drawing-rectangles-to-the-canvas.yaml": [ - "4903aa2f42818beb0c8f938bb91cd85e4e999df2", - [] - ], "fill-and-stroke-styles.yaml": [ "7a57a4730e096c728010b754c503c753a6972326", [] @@ -288654,6 +288818,10 @@ "conformance_requirements.yaml": [ "89091d6e7c760c192650dbd8994304ceb4586287", [] + ], + "drawing-rectangles-to-the-canvas.yaml": [ + "129fe95530a81b5b9fc5da74d19ba273e5dc28ca", + [] ] } } @@ -289736,7 +289904,7 @@ [] ], "idlharness.worker-expected.txt": [ - "9609f524ee724b2aaf8c2847fbf9c59ca981948d", + "0e04c9174c346bb33240b482245fab61e1eab32c", [] ], "new-harness.js": [ @@ -294241,6 +294409,10 @@ "31ba23a5cf86f161b1204ea3f4c9fef4585af909", [] ], + "select-intrinsic-option-font-size-ref.html": [ + "8b1b422176f8f7dbb080910b71b0b3ae89f876cd", + [] + ], "select-intrinsic-text-transform-ref.html": [ "18e272ba10d3c319c06cdb669e5f7a535946d024", [] @@ -301493,7 +301665,7 @@ [] ], "OES_draw_buffers_indexed.idl": [ - "25696f12fca77799ddd803483de22c251c75eb82", + "bf1932c665353800f8a93ec43769b86aa05fc26a", [] ], "OES_element_index_uint.idl": [ @@ -301621,13 +301793,17 @@ [] ], "app-history.idl": [ - "b87bb582e67e9fbd521a36db433d114944164aa2", + "f5f1b7e4937dd53838f64a0681db652fa4300bf3", [] ], "audio-output.idl": [ "80ceb225308a057d99ce39f575ebcf8eb40ab5fb", [] ], + "autoplay.idl": [ + "f2be5bb3789b123b33a07a8e237a3c48a7ae1cc4", + [] + ], "background-fetch.idl": [ "993bd8bc2fd8db2a52fcc4b703e6b0801ab76ff8", [] @@ -301665,7 +301841,7 @@ [] ], "compute-pressure.idl": [ - "8ea37bfbb9c47511d6aa8d34484f97527ec9ea29", + "0cf880b4503fede8f40b1c656834d806cd906d5e", [] ], "console.idl": [ @@ -301673,7 +301849,7 @@ [] ], "contact-api.idl": [ - "7f67a5d19a84087182469b6f06887a2dafc37073", + "d7f2ba5d959ee316f8045697177c0b052302107a", [] ], "content-index.idl": [ @@ -301693,7 +301869,7 @@ [] ], "credential-management.idl": [ - "a07aa0b4447cd3119dc5bd22c5c3d16679e3afe5", + "bf1adbaffcbe7e6221f8629724e29ac2cf75aa19", [] ], "csp-embedded-enforcement.idl": [ @@ -301716,8 +301892,8 @@ "8185170943281bd1ceb8bb8fd3cd701a60fa290c", [] ], - "css-cascade-5.idl": [ - "4166ae6b9ba780c8cb4108eb98da0647fbef0d1d", + "css-cascade.idl": [ + "9011dc7fd9e2a3f835e6d6ff565d9854db82e96f", [] ], "css-conditional.idl": [ @@ -301741,7 +301917,7 @@ [] ], "css-highlight-api.idl": [ - "56db8c35ac099bbfc79fb40b88a3ba14ab700f43", + "f3c6b2e9d21a525e80461a22e511c672ce05ba87", [] ], "css-images-4.idl": [ @@ -301777,7 +301953,7 @@ [] ], "css-pseudo.idl": [ - "2c90ff2b3174eea5d1245214b79ac79ac2479ee5", + "dbe4c5461f6ae2199968bb77c81d32570f55f1c7", [] ], "css-regions.idl": [ @@ -301797,7 +301973,7 @@ [] ], "css-typed-om.idl": [ - "b3942e6bcf55556978fc244861936a5c21252036", + "3a0a6bd064ddf65930c7170c38f3f9b40e694879", [] ], "cssom-view.idl": [ @@ -301829,7 +302005,11 @@ [] ], "dom.idl": [ - "d3255b45e01b302347ab5a3d695963871e1eedba", + "635072d57346d56f870ba28aa795f785c187da52", + [] + ], + "edit-context.idl": [ + "f5e60bd0d02c45ca8f3145c729edcfd0b240b61e", [] ], "element-timing.idl": [ @@ -301849,7 +302029,7 @@ [] ], "event-timing.idl": [ - "98e8d920fca47b6d0daf87ce88acce442c9da9ab", + "329570e44314278526ecf949ebc1a98e4d4dd840", [] ], "eyedropper-api.idl": [ @@ -301892,14 +302072,14 @@ "157072f6341821aba5403be50ddd5355dbb940d8", [] ], - "geolocation-API.idl": [ - "4b971f097babf71b9ef1b5091d1a8777b4d717ea", - [] - ], "geolocation-sensor.idl": [ "e1d676205fff369c5cdc656f8563e4bb1fca9946", [] ], + "geolocation.idl": [ + "4b971f097babf71b9ef1b5091d1a8777b4d717ea", + [] + ], "geometry.idl": [ "a1159c0d77a3f6f9c302d4c70c185a4130e2b383", [] @@ -301921,7 +302101,7 @@ [] ], "html.idl": [ - "2b5efa90ba2c3af6df84735bee4c45e1be5b66f8", + "2eaf5d09e2c882588a3069b51fffa88802e4ed61", [] ], "idle-detection.idl": [ @@ -301980,12 +302160,8 @@ "4fb1b70398e7486a0596574b3ef76d361806e0f3", [] ], - "lighting-estimation.idl": [ - "35aa1d746a7466e80a9de9d366935b831da8cc7f", - [] - ], "local-font-access.idl": [ - "577cd3621ac327c00d55a346942138c18711fa2a", + "e37b2c7d56f028c3bf9fe32352382697f2410f05", [] ], "longtasks.idl": [ @@ -301996,6 +302172,10 @@ "45ba9edcfe570c5d1828d089409e8220788c7e94", [] ], + "manifest-incubations.idl": [ + "bab3998dedd1353ba95b824a36500f1ab9a69987", + [] + ], "mathml-core.idl": [ "3989288b3bd14de69f0d9ce9c188825b06836697", [] @@ -302025,7 +302205,11 @@ [] ], "mediacapture-streams.idl": [ - "7d51a2af8077c4430423701dc5c58fb8dd9847d8", + "33511eb24153ab4ac4dd213b932219244ea98d21", + [] + ], + "mediacapture-transform.idl": [ + "5b2c8fa67a6b130d1fe99f962ff85c5cf7a7bc3d", [] ], "mediasession.idl": [ @@ -302109,7 +302293,7 @@ [] ], "permissions.idl": [ - "3112ef6d20b9ab6f71846a9c8e620f67c80f8684", + "3a0f159c2b2e330c6d8af9e74952d10879008240", [] ], "picture-in-picture.idl": [ @@ -302136,6 +302320,10 @@ "4f1e4bee835a23c5b7bcf54b5b05f4ded2b08023", [] ], + "priority-hints.idl": [ + "835b0180d30655ce85298e42442d676bf6bc3f9a", + [] + ], "private-click-measurement.idl": [ "3bed7ccf991f6b8cd4e9a5a237275c4ff5fc6f1f", [] @@ -302173,7 +302361,7 @@ [] ], "sanitizer-api.idl": [ - "b98da2a2c671e2e86c113d3ebe904470b82e60ad", + "8268384affc8c23daadadb79959d4b953c563f1b", [] ], "sanitizer-api.tentative.idl": [ @@ -302209,7 +302397,7 @@ [] ], "secure-payment-confirmation.idl": [ - "0a4416ef4b20e1577484a875c511f7a41a936ff2", + "1522bff76eac485d8046cbad2634fdfd9fda5e06", [] ], "selection-api.idl": [ @@ -302249,7 +302437,7 @@ [] ], "streams.idl": [ - "2ebe5b7491f3757e5df3e3f543fdef48ea296755", + "f7084dd60610420628f6b3468bf071b66e93dc14", [] ], "svg-animations.idl": [ @@ -302317,7 +302505,7 @@ [] ], "wasm-js-api.idl": [ - "b56c8cf0c7943e746c64b0acab5ea8a2bbbdd75e", + "141af90fd2d9d9432747277fc7d38ab6f53ea1f5", [] ], "wasm-web-api.idl": [ @@ -302337,11 +302525,11 @@ [] ], "web-locks.idl": [ - "a0319a00fd208a8bdeecd9700e00fd0d67549a60", + "d79e404b983fb4388028de8b269ee16b652fed0f", [] ], "web-nfc.idl": [ - "3b8be7fd81cf7ca5e8f96c5a36abeb7914614b91", + "ff042b044e1da41ee42c07361a1f814684049f4a", [] ], "web-otp.idl": [ @@ -302357,7 +302545,7 @@ [] ], "webauthn.idl": [ - "92143205d672f08471370498623d71202a6cee84", + "2b897608ab4b1118bdaf90ba716b88b2f1b1eaa4", [] ], "webcodecs.idl": [ @@ -302377,11 +302565,11 @@ [] ], "webgpu.idl": [ - "c23ba7878172556f0db75a45f88bc135489cad1e", + "6ded86e1d6389ab9f864272549d7cbf662043035", [] ], "webhid.idl": [ - "d4ce439785d866a9667d2a5e716d139d355a4d12", + "997d82c3986e5e4b908e032475723e8b9348d459", [] ], "webidl.idl": [ @@ -302421,11 +302609,11 @@ [] ], "webrtc.idl": [ - "ff0a4a9ec5ccfc153dbafa2d2c6fdab7582eb66e", + "aed8fbbedfe5d236a9d85fbfa75fa6c07b51695b", [] ], "webtransport.idl": [ - "f098e47d179b4e02ed3f6c0bde20832c29183acd", + "95ab9e05d498c9e5bf244e173bf8cd106a0d8c7f", [] ], "webusb.idl": [ @@ -302464,6 +302652,10 @@ "fa4fb71c9decd64054669249353a16b3476aae56", [] ], + "webxr-lighting-estimation.idl": [ + "35aa1d746a7466e80a9de9d366935b831da8cc7f", + [] + ], "webxr.idl": [ "004f104c8e23c5200e8ef3d63f6ee85b6ec39365", [] @@ -302473,7 +302665,7 @@ [] ], "window-controls-overlay.idl": [ - "de5e67419743fef952bc6e1df09ab77f03c18386", + "051978d693e3aa5213096e571be66d10cc8d8199", [] ], "xhr.idl": [ @@ -304390,6 +304582,10 @@ "563fa6720ba3a89d6ad8add86cd903465fe456f2", [] ], + "MediaStreamTrackGenerator-in-shared-worker.https-expected.txt": [ + "1bc00727ca33d15f53d9c41f9660d2229e486482", + [] + ], "MediaStreamTrackGenerator-in-worker.https-expected.txt": [ "11ecc9430dc08d3eceb70b8bacc693b955564dc2", [] @@ -304401,6 +304597,10 @@ "MediaStreamTrackProcessor-worker.js": [ "51eaef80a90a6e24fce8cad4fee03e05548e4517", [] + ], + "shared-worker.js": [ + "61ff67bcff03099cbf93fbb594e9b188d85a9f11", + [] ] }, "mediacapture-record": { @@ -304545,7 +304745,7 @@ [] ], "idlharness.https.window-expected.txt": [ - "35a2f4c8c4e26a49ef72cdefc7e9f826f4dbe7fc", + "07cd17de93769ec3e2a05e2e0d0f5be3debeaced", [] ], "iframe-enumerate-cleared.html": [ @@ -315974,7 +316174,7 @@ [] ], "urlpatterntestdata.json": [ - "671751fd3105b56ca0584553619c73634a971849", + "8cb3fffa2bfe247358e6b1f8291bff3712f98a14", [] ], "urlpatterntests.js": [ @@ -316259,6 +316459,16 @@ ] } }, + "global": { + "type.tentative.any-expected.txt": [ + "2aec539c575a8bc88c84d5608d0b74081054966b", + [] + ], + "type.tentative.any.worker-expected.txt": [ + "2aec539c575a8bc88c84d5608d0b74081054966b", + [] + ] + }, "idlharness.any-expected.txt": [ "845370fc1055ff291bf102d65281592f1a3552c1", [] @@ -316305,14 +316515,6 @@ "c5880db327517f6bd5fdf09c4a8f2b291bdecf27", [] ], - "prototypes.any-expected.txt": [ - "4df42608c6b1973327cd517e9e267d1c8acecd8d", - [] - ], - "prototypes.any.worker-expected.txt": [ - "4df42608c6b1973327cd517e9e267d1c8acecd8d", - [] - ], "table": { "assertions.js": [ "19cc5c3b92d6fa6748c3831f3629c92b62ed757f", @@ -316334,22 +316536,6 @@ "dbd6539ea90e6578e0e76234ea555f414a3aeb4f", [] ], - "constructor.any-expected.txt": [ - "49f77337eed4303808b94d77f97b5856f9f4b7af", - [] - ], - "constructor.any.worker-expected.txt": [ - "49f77337eed4303808b94d77f97b5856f9f4b7af", - [] - ], - "get-set.any-expected.txt": [ - "cad5a835b6d9c95500261243889ea88456e94d1b", - [] - ], - "get-set.any.worker-expected.txt": [ - "cad5a835b6d9c95500261243889ea88456e94d1b", - [] - ], "grow-reftypes.tentative.any-expected.txt": [ "5a04fca68f6843a86f7f5e900a26253a9a08dd5b", [] @@ -316358,14 +316544,6 @@ "7d6bf80291cd295caabfe4c09d1f60144101d655", [] ], - "grow.any-expected.txt": [ - "16927db9100e7aee0392d8a36b5d35df6b338416", - [] - ], - "grow.any.worker-expected.txt": [ - "16927db9100e7aee0392d8a36b5d35df6b338416", - [] - ], "set-reftypes.tentative.any-expected.txt": [ "5eb1b117af669e2c21fe01b2e9c370426d5e72a8", [] @@ -316373,6 +316551,14 @@ "set-reftypes.tentative.any.worker-expected.txt": [ "5eb1b117af669e2c21fe01b2e9c370426d5e72a8", [] + ], + "type.tentative.any-expected.txt": [ + "f65819c8872ca3a75623c0eb1b58e80070a9aa23", + [] + ], + "type.tentative.any.worker-expected.txt": [ + "f65819c8872ca3a75623c0eb1b58e80070a9aa23", + [] ] }, "tag": { @@ -317544,10 +317730,6 @@ } }, "the-audiocontext-interface": { - "audiocontext-not-fully-active-expected.txt": [ - "86d99c233ebb1d7ad83ddbb3571b87a5bb9fdc06", - [] - ], "audiocontext-suspend-resume-expected.txt": [ "4b3708bcb872ac53b8e82e6d780745dcb59cafab", [] @@ -318386,14 +318568,6 @@ "9da4bb7be5ffb76835cd33860bf74aa1981695b6", [] ], - "defaults.py": [ - "8dd171aa64c71fa031e0e14ef4344f4335e368cc", - [] - ], - "fixtures.py": [ - "cb98ccb6a754e9cb90687a84491b5f8c7b2d2237", - [] - ], "fixtures_bidi.py": [ "4e900bb55b9b40418e69d97e22d16c0476c3cfd8", [] @@ -318517,7 +318691,7 @@ [] ], "idlharness.https.window-expected.txt": [ - "6ed0916d004bd748428d92ecb2296fb2790f3eec", + "7b3f1ae73d65e4c10fef92795b0d5a9ad64fefb2", [] ] }, @@ -325565,6 +325739,15 @@ {} ] ], + "database-names-by-origin.html": [ + "2224d5b5c371f791a64849f36ace5b830f6e1a65", + [ + null, + { + "timeout": "long" + } + ] + ], "delete-range.any.js": [ "c11c68a609e444cffc9dd9aa1387cfc01be9a9de", [ @@ -359034,6 +359217,13 @@ {} ] ], + "transform-010.html": [ + "8418551cdc8172862d57d8359a732968b3467aba", + [ + null, + {} + ] + ], "widows-orphans-005.html": [ "713849703ce92e062780bd20e0708c8dfcd21f5f", [ @@ -359051,7 +359241,7 @@ ] ], "idlharness.html": [ - "80d33185561cc1f6708e7e8de967d57288a6827a", + "9bde23b946ccf1537c92c6de2301005144bf12a6", [ null, {} @@ -359680,7 +359870,7 @@ ] ], "container-for-shadow-dom.tentative.html": [ - "24d52da256a8802e47b4e33f3c3c98f6216537b6", + "66e9ea088aaa024a3ae3f15da2e69436e7855383", [ null, {} @@ -366750,6 +366940,13 @@ {} ] ], + "grid-template-shorthand-areas-valid.html": [ + "59770ed430bc5cab4c6915cbebe10694012a86d1", + [ + null, + {} + ] + ], "grid-template-shorthand-invalid.html": [ "366cdf4d887aa937875cd5e5a49631d1b3e283b1", [ @@ -384297,6 +384494,13 @@ {} ] ], + "mq-invalid-media-type-005.html": [ + "3e25a248b3f58ad3d3777953d482a81965e6ff81", + [ + null, + {} + ] + ], "navigation-controls.tentative.html": [ "ac1087bb65b9a8fd85d924ad1ae0de797762dac5", [ @@ -385131,6 +385335,13 @@ {} ] ], + "has-specificity.html": [ + "b33e3a0eb3663266d7806ea9d243428684d673fd", + [ + null, + {} + ] + ], "hover-002.html": [ "02cee99bf6cd161eb95806854cb12e39504a359e", [ @@ -385480,7 +385691,7 @@ ] ], "has-complexity.html": [ - "df127bcf1e4e830b32abfe069873a928b9f1d191", + "0bdcdec13b97d8a2b3973f86773512474988519c", [ null, {} @@ -387634,6 +387845,13 @@ {} ] ], + "EventListener-handleEvent-cross-realm.html": [ + "663d04213f82bbcfabe420d3b738a706e0fd86e0", + [ + null, + {} + ] + ], "EventListener-handleEvent.html": [ "06bc1f6e2ab267e36c3d15da9e278db2aced85c0", [ @@ -390199,14 +390417,14 @@ ] ], "TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html": [ - "4d6bb53289f47257a0ae21d451e48ec59529512c", + "f8e71bcdf56e155ad704facc8a5a1be981c02e73", [ null, {} ] ], "TreeWalker-acceptNode-filter-cross-realm.html": [ - "60a80d31190de6cf394be338bfeecaf3e9699338", + "da91cf6cb2379839367d09e48cadaa970b34e42a", [ null, {} @@ -390645,6 +390863,13 @@ {} ] ], + "resolver-callback-interface-cross-realm.html": [ + "55fbb070a3b482b1546a52eef0285f9e7e5483f0", + [ + null, + {} + ] + ], "resolver-callback-interface.html": [ "b43695f4aa56d2e7b8a05d0798657ff1057e3c9b", [ @@ -416454,7 +416679,7 @@ ] ], "worker-fetch.https.window.js": [ - "78e51b0f8af848b69a2e6f1b12230bde14b66ebd", + "528b556a2e5af8a765bd820ebd5aacb6730ec965", [ "fetch/private-network-access/worker-fetch.https.window.html", { @@ -418256,33 +418481,6 @@ } ] ], - "font_access-chooser-multiple.tentative.manual.https.html": [ - "bf70a0a7192a6d7b49d40a653110ccf2d75f0b7e", - [ - null, - { - "testdriver": true - } - ] - ], - "font_access-chooser-selection.tentative.manual.https.html": [ - "e8a1e8d91b21eed5b074f860cedd5f768cec3d8e", - [ - null, - { - "testdriver": true - } - ] - ], - "font_access-chooser.tentative.manual.https.html": [ - "499d8be4a1fcc15367ba5c07e21dd695d17c51f8", - [ - null, - { - "testdriver": true - } - ] - ], "font_access-enumeration.tentative.https.window.js": [ "677fe82c70233de2e1cbeab4beb41437319688b3", [ @@ -418310,7 +418508,7 @@ ] ], "font_metadata.tentative.https.window.js": [ - "21d3ea1c1125c7e2ea2674c38a421b3130a357f6", + "672bc082f2d73117eb415dfe785905319e9fd504", [ "font-access/font_metadata.tentative.https.window.html", { @@ -418752,7 +418950,7 @@ ] ], "idlharness.https.window.js": [ - "7f83eaf52d1d19be3074daf72cf32162d46ea4e6", + "176bae86af93745c5b5611a1070f3d9619c4a352", [ "geolocation-API/idlharness.https.window.html", { @@ -424063,7 +424261,7 @@ ] ], "2d.clearRect.clip.html": [ - "92d6dd51cd5341494c32fccd55ce02af2625be32", + "0c6deaaaada1e675882b81cc63e343d3b2f60f2e", [ null, {} @@ -424091,7 +424289,7 @@ ] ], "2d.clearRect.nonfinite.html": [ - "6f1dacc5a2e90b4cefbfb779c913aea95d7997a1", + "18ce63081322d29d8365b59c23c8ad0689104c17", [ null, {} @@ -424133,7 +424331,7 @@ ] ], "2d.fillRect.clip.html": [ - "96925f1c2e5f020c1b5a95502c4b35d977bd5e19", + "ccbe776889ac1849f6770968248b39d8ab1ec7ab", [ null, {} @@ -424147,7 +424345,7 @@ ] ], "2d.fillRect.nonfinite.html": [ - "22deef6c81697004797fef0c539ca2cc0203bc4d", + "98b19cee4fda962aa53555ec847c84d60efef6c2", [ null, {} @@ -424189,7 +424387,7 @@ ] ], "2d.strokeRect.clip.html": [ - "2b1b3f6d60b0fafca0f5f9b6ae87e0f6b6632f08", + "1da47f43d959d91fa7cfcb784a168cd4fddf772b", [ null, {} @@ -424217,7 +424415,7 @@ ] ], "2d.strokeRect.nonfinite.html": [ - "8fee577df8d53c434a046af4d7bed2e5bcbe7bab", + "27829cb31f0bee9906342689a35f6d25d57bd34b", [ null, {} @@ -426860,7 +427058,7 @@ ] ], "createImageBitmap-sizeOverflow.html": [ - "f58825cc371f04bf186ba23fa869391f3d2d3f6c", + "7239c2e7a1c5983583e04d8bce7ebe028401ffec", [ null, {} @@ -470917,6 +471115,13 @@ } ] ], + "MediaStreamTrackGenerator-in-shared-worker.https.html": [ + "deecfccad16f5df61028b9fc65e0e65e5f825e64", + [ + null, + {} + ] + ], "MediaStreamTrackGenerator-in-worker.https.html": [ "ff3b9459686d6507f89efb502b4d3436fff81f13", [ @@ -515802,6 +516007,13 @@ {} ] ], + "viewport-resize-event-on-iframe-show.html": [ + "688148a88fb21f899a16a710f24dd4836631fd13", + [ + null, + {} + ] + ], "viewport-resize-event-on-iframe-size-change.html": [ "802fee7879200a8e9352a54ba0a5f9719ca5f401", [
diff --git a/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window-expected.txt new file mode 100644 index 0000000..6e82efe0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window-expected.txt
@@ -0,0 +1,99 @@ +This is a testharness.js-based test. +Found 95 tests; 94 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface Navigator: original interface defined +PASS Partial interface Navigator: member names are unique +PASS Partial dictionary CredentialRequestOptions: original dictionary defined +PASS Partial dictionary CredentialRequestOptions: member names are unique +PASS Partial dictionary CredentialCreationOptions: original dictionary defined +PASS Partial dictionary CredentialCreationOptions: member names are unique +PASS Partial dictionary CredentialRequestOptions[2]: original dictionary defined +PASS Partial dictionary CredentialRequestOptions[2]: member names are unique +PASS Partial dictionary CredentialCreationOptions[2]: original dictionary defined +PASS Partial dictionary CredentialCreationOptions[2]: member names are unique +PASS Partial interface mixin NavigatorID: member names are unique +PASS PasswordCredential includes CredentialUserData: member names are unique +PASS FederatedCredential includes CredentialUserData: member names are unique +PASS HTMLElement includes GlobalEventHandlers: member names are unique +PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes ElementContentEditable: member names are unique +PASS HTMLElement includes HTMLOrSVGElement: member names are unique +PASS Navigator includes NavigatorID: member names are unique +PASS Navigator includes NavigatorLanguage: member names are unique +PASS Navigator includes NavigatorOnLine: member names are unique +PASS Navigator includes NavigatorContentUtils: member names are unique +PASS Navigator includes NavigatorCookies: member names are unique +PASS Navigator includes NavigatorPlugins: member names are unique +PASS Navigator includes NavigatorConcurrentHardware: member names are unique +PASS Element includes ParentNode: member names are unique +PASS Element includes NonDocumentTypeChildNode: member names are unique +PASS Element includes ChildNode: member names are unique +PASS Element includes Slottable: member names are unique +PASS Credential interface: existence and properties of interface object +PASS Credential interface object length +PASS Credential interface object name +PASS Credential interface: existence and properties of interface prototype object +PASS Credential interface: existence and properties of interface prototype object's "constructor" property +PASS Credential interface: existence and properties of interface prototype object's @@unscopables property +PASS Credential interface: attribute id +PASS Credential interface: attribute type +FAIL Credential interface: operation isConditionalMediationAvailable() assert_own_property: interface object missing static operation expected property "isConditionalMediationAvailable" missing +PASS CredentialsContainer interface: existence and properties of interface object +PASS CredentialsContainer interface object length +PASS CredentialsContainer interface object name +PASS CredentialsContainer interface: existence and properties of interface prototype object +PASS CredentialsContainer interface: existence and properties of interface prototype object's "constructor" property +PASS CredentialsContainer interface: existence and properties of interface prototype object's @@unscopables property +PASS CredentialsContainer interface: operation get(optional CredentialRequestOptions) +PASS CredentialsContainer interface: operation store(Credential) +PASS CredentialsContainer interface: operation create(optional CredentialCreationOptions) +PASS CredentialsContainer interface: operation preventSilentAccess() +PASS CredentialsContainer must be primary interface of navigator.credentials +PASS Stringification of navigator.credentials +PASS CredentialsContainer interface: navigator.credentials must inherit property "get(optional CredentialRequestOptions)" with the proper type +PASS CredentialsContainer interface: calling get(optional CredentialRequestOptions) on navigator.credentials with too few arguments must throw TypeError +PASS CredentialsContainer interface: navigator.credentials must inherit property "store(Credential)" with the proper type +PASS CredentialsContainer interface: calling store(Credential) on navigator.credentials with too few arguments must throw TypeError +PASS CredentialsContainer interface: navigator.credentials must inherit property "create(optional CredentialCreationOptions)" with the proper type +PASS CredentialsContainer interface: calling create(optional CredentialCreationOptions) on navigator.credentials with too few arguments must throw TypeError +PASS CredentialsContainer interface: navigator.credentials must inherit property "preventSilentAccess()" with the proper type +PASS PasswordCredential interface: existence and properties of interface object +PASS PasswordCredential interface object length +PASS PasswordCredential interface object name +PASS PasswordCredential interface: existence and properties of interface prototype object +PASS PasswordCredential interface: existence and properties of interface prototype object's "constructor" property +PASS PasswordCredential interface: existence and properties of interface prototype object's @@unscopables property +PASS PasswordCredential interface: attribute password +PASS PasswordCredential interface: attribute name +PASS PasswordCredential interface: attribute iconURL +PASS PasswordCredential must be primary interface of passwordCredential +PASS Stringification of passwordCredential +PASS PasswordCredential interface: passwordCredential must inherit property "password" with the proper type +PASS PasswordCredential interface: passwordCredential must inherit property "name" with the proper type +PASS PasswordCredential interface: passwordCredential must inherit property "iconURL" with the proper type +PASS Credential interface: passwordCredential must inherit property "id" with the proper type +PASS Credential interface: passwordCredential must inherit property "type" with the proper type +PASS Credential interface: passwordCredential must inherit property "isConditionalMediationAvailable()" with the proper type +PASS FederatedCredential interface: existence and properties of interface object +PASS FederatedCredential interface object length +PASS FederatedCredential interface object name +PASS FederatedCredential interface: existence and properties of interface prototype object +PASS FederatedCredential interface: existence and properties of interface prototype object's "constructor" property +PASS FederatedCredential interface: existence and properties of interface prototype object's @@unscopables property +PASS FederatedCredential interface: attribute provider +PASS FederatedCredential interface: attribute protocol +PASS FederatedCredential interface: attribute name +PASS FederatedCredential interface: attribute iconURL +PASS FederatedCredential must be primary interface of federatedCredential +PASS Stringification of federatedCredential +PASS FederatedCredential interface: federatedCredential must inherit property "provider" with the proper type +PASS FederatedCredential interface: federatedCredential must inherit property "protocol" with the proper type +PASS FederatedCredential interface: federatedCredential must inherit property "name" with the proper type +PASS FederatedCredential interface: federatedCredential must inherit property "iconURL" with the proper type +PASS Credential interface: federatedCredential must inherit property "id" with the proper type +PASS Credential interface: federatedCredential must inherit property "type" with the proper type +PASS Credential interface: federatedCredential must inherit property "isConditionalMediationAvailable()" with the proper type +PASS Navigator interface: attribute credentials +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/background-blend-mode-plus-lighter.html b/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/background-blend-mode-plus-lighter.html new file mode 100644 index 0000000..0816dc6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/background-blend-mode-plus-lighter.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<title>background-blend-mode: plus-lighter test</title> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#background-blend-mode"> +<link rel="match" href="reference/background-blend-mode-plus-lighter-ref.html"> +<style> + .test { + width: 100px; + height: 100px; + background-blend-mode: plus-lighter; + } +</style> +<script type="module"> + import { tests } from '../support/plus-lighter.js'; + import { toCSSColor } from '../support/utils.js'; + + // Create a solid color CSS image. + const colorImage = (pixel) => + `linear-gradient(to right, ${toCSSColor(pixel)}, ${toCSSColor(pixel)})`; + + const createBackgrounds = (colors) => colors + // Backgrounds are top first + .slice().reverse() + .map((color) => colorImage(color)) + .join(', '); + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <div class="test" style="background-image: ${createBackgrounds(colors)}"></div> + `); + } +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html new file mode 100644 index 0000000..55098198 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<title>background-blend-mode: plus-lighter test</title> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#background-blend-mode"> +<style> + .test { + width: 100px; + height: 100px; + } +</style> +<script type="module"> + import { tests, plusLighter } from '../../support/plus-lighter.js'; + import { toCSSColor } from '../../support/utils.js'; + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <div class="test" style="background-color: ${toCSSColor(plusLighter(colors))}"></div> + `); + } +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html new file mode 100644 index 0000000..fcf2d17 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html
@@ -0,0 +1,42 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter test</title> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> +<link rel="match" href="reference/mix-blend-mode-plus-lighter-basic-ref.html"> + +<style> +.container { + position: relative; + isolation: isolate; + width: 500px; + height: 500px; +} +.blue { background: #000064; } +.green { background: #006400; } +.common { + position: absolute; + width: 100px; + height: 100px; + opacity: 0.6; +} +.one { + top: 10px; + left: 10px; +} +.two { + top: 65px; + left: 30px; + mix-blend-mode: plus-lighter; +} +.three { + top: 120px; + left: 50px; + mix-blend-mode: plus-lighter; +} +</style> + +<div class=container> + <div class="one common blue"></div> + <div class="two common blue"></div> + <div class="three common green"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html new file mode 100644 index 0000000..4762389 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html
@@ -0,0 +1,21 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter SVG test</title> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> +<link rel="match" href="reference/mix-blend-mode-plus-lighter-svg-ref.html"> + +<style> +.isolate { isolation: isolate; } +rect { + opacity: 0.6; + mix-blend-mode: plus-lighter; +} +</style> + +<svg width=500 height=500> + <g class="isolate"> + <rect x="10" y="10" width="100" height="100" fill="#000064"></rect> + <rect x="30" y="65" width="100" height="100" fill="#000064"></rect> + <rect x="50" y="120" width="100" height="100" fill="#006400"></rect> + </g> +</svg>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html index 4762389..fc5e94e 100644 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html
@@ -1,21 +1,37 @@ <!DOCTYPE html> <title>mix-blend-mode: plus-lighter SVG test</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> <link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> <link rel="match" href="reference/mix-blend-mode-plus-lighter-svg-ref.html"> - <style> -.isolate { isolation: isolate; } -rect { - opacity: 0.6; - mix-blend-mode: plus-lighter; -} + .blend-group { + isolation: isolate; + } + .layer { + mix-blend-mode: plus-lighter; + } </style> +<script type="module"> + import { tests } from '../support/plus-lighter.js'; + import { toCSSColor } from '../support/utils.js'; -<svg width=500 height=500> - <g class="isolate"> - <rect x="10" y="10" width="100" height="100" fill="#000064"></rect> - <rect x="30" y="65" width="100" height="100" fill="#000064"></rect> - <rect x="50" y="120" width="100" height="100" fill="#006400"></rect> - </g> -</svg> + function createRects(colors) { + let html = ''; + + for (const color of colors) { + html += `<rect class="layer" x="0" y="0" width="100%" height="100%" fill="${toCSSColor(color)}" />`; + } + + return html; + } + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <svg width="100" height="100"> + <g class="blend-group"> + ${createRects(colors)} + </g> + </svg> + `); + } +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html index ae3dff1..e6fc4d7 100644 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html
@@ -1,42 +1,38 @@ <!DOCTYPE html> <title>mix-blend-mode: plus-lighter test</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> <link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> <link rel="match" href="reference/mix-blend-mode-plus-lighter-ref.html"> - <style> -.container { - position: relative; - isolation: isolate; - width: 500px; - height: 500px; -} -.blue { background: #000064; } -.green { background: #006400; } -.common { - position: absolute; - width: 100px; - height: 100px; - opacity: 0.6; -} -.one { - top: 10px; - left: 10px; -} -.two { - top: 65px; - left: 30px; - mix-blend-mode: plus-lighter; -} -.three { - top: 120px; - left: 50px; - mix-blend-mode: plus-lighter; -} + .test { + width: 100px; + height: 100px; + position: relative; + isolation: isolate; + } + .layer { + position: absolute; + inset: 0; + mix-blend-mode: plus-lighter; + } </style> +<script type="module"> + import { tests } from '../support/plus-lighter.js'; + import { toCSSColor } from '../support/utils.js'; -<div class=container> - <div class="one common blue"></div> - <div class="two common blue"></div> - <div class="three common green"></div> -</div> + function createLayers(colors) { + let html = ''; + + for (const color of colors) { + html += `<div class="layer" style="background-color: ${toCSSColor(color)}"></div>`; + } + + return html; + } + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <div class="test">${createLayers(colors)}</div> + `); + } +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html new file mode 100644 index 0000000..e5acd26 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html
@@ -0,0 +1,57 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter test</title> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> + +<style> +.container { + isolation: isolate; + position: relative; + width: 500px; + height: 500px; +} +.blue { background: #000064; } +.green { background: #006400; } +.common { + position: absolute; + width: 100px; + height: 100px; + opacity: 0.6; +} +.one { + top: 10px; + left: 10px; +} +.two { + top: 65px; + left: 30px; +} +.three { + top: 120px; + left: 50px; +} +.one_and_two { + position: absolute; + width: 80px; + height: 45px; + top: 65px; + left: 30px; + background: #000078; +} +.two_and_three { + position: absolute; + width: 80px; + height: 45px; + top: 120px; + left: 50px; + background: #003C3C; +} +</style> + +<div class=container> + <div class="one common blue"></div> + <div class="two common blue"></div> + <div class="three common green"></div> + <div class="one_and_two"></div> + <div class="two_and_three"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html index e5acd26..4709ab8 100644 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html
@@ -1,57 +1,20 @@ <!DOCTYPE html> <title>mix-blend-mode: plus-lighter test</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> <link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> - <style> -.container { - isolation: isolate; - position: relative; - width: 500px; - height: 500px; -} -.blue { background: #000064; } -.green { background: #006400; } -.common { - position: absolute; - width: 100px; - height: 100px; - opacity: 0.6; -} -.one { - top: 10px; - left: 10px; -} -.two { - top: 65px; - left: 30px; -} -.three { - top: 120px; - left: 50px; -} -.one_and_two { - position: absolute; - width: 80px; - height: 45px; - top: 65px; - left: 30px; - background: #000078; -} -.two_and_three { - position: absolute; - width: 80px; - height: 45px; - top: 120px; - left: 50px; - background: #003C3C; -} + .test { + width: 100px; + height: 100px; + } </style> +<script type="module"> + import { tests, plusLighter } from '../../support/plus-lighter.js'; + import { toCSSColor } from '../../support/utils.js'; -<div class=container> - <div class="one common blue"></div> - <div class="two common blue"></div> - <div class="three common green"></div> - <div class="one_and_two"></div> - <div class="two_and_three"></div> -</div> + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <div class="test" style="background-color: ${toCSSColor(plusLighter(colors))}"></div> + `); + } +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html new file mode 100644 index 0000000..9193bb5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html
@@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter SVG test</title> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> + +<style> +.isolate { isolation: isolate; } +.original { opacity: 0.6; } +</style> + +<svg width=500 height=500> + <g class="isolate"> + <rect class="original" x="10" y="10" width="100" height="100" fill="#000064"></rect> + <rect class="original" x="30" y="65" width="100" height="100" fill="#000064"></rect> + <rect class="original" x="50" y="120" width="100" height="100" fill="#006400"></rect> + <rect x="30" y="65" width="80" height="45" fill="#000078"></rect> + <rect x="50" y="120" width="80" height="45" fill="#003C3C"></rect> + </g> +</svg>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html index 9193bb5..8e1cb70 100644 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html
@@ -1,19 +1,14 @@ <!DOCTYPE html> <title>mix-blend-mode: plus-lighter SVG test</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> <link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> +<script type="module"> + import { tests, plusLighter } from '../../support/plus-lighter.js'; + import { toCSSColor } from '../../support/utils.js'; -<style> -.isolate { isolation: isolate; } -.original { opacity: 0.6; } -</style> - -<svg width=500 height=500> - <g class="isolate"> - <rect class="original" x="10" y="10" width="100" height="100" fill="#000064"></rect> - <rect class="original" x="30" y="65" width="100" height="100" fill="#000064"></rect> - <rect class="original" x="50" y="120" width="100" height="100" fill="#006400"></rect> - <rect x="30" y="65" width="80" height="45" fill="#000078"></rect> - <rect x="50" y="120" width="80" height="45" fill="#003C3C"></rect> - </g> -</svg> + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <svg width="100" height="100" style="background-color: ${toCSSColor(plusLighter(colors))}"></svg> + `); + } +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/support/plus-lighter.js b/third_party/blink/web_tests/external/wpt/css/compositing/support/plus-lighter.js new file mode 100644 index 0000000..cadefa5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/compositing/support/plus-lighter.js
@@ -0,0 +1,47 @@ +import { clamp01, multiplyAlpha, unmultiplyAlpha } from "./utils.js"; + +export function plusLighter(pixels) { + if (pixels.length === 1) return pixels[0]; + + return pixels.reduce((destination, source) => { + const premultipliedSource = multiplyAlpha(source); + const premultipliedDestination = multiplyAlpha(destination); + const premultipliedResult = premultipliedDestination.map((channel, i) => + clamp01(channel + premultipliedSource[i]) + ); + return unmultiplyAlpha(premultipliedResult); + }); +} + +export const tests = [ + // Each test is a list of colors to composite. + // Each color is [r, g, b, a], unmultiplied, in the range 0-1. + [ + [1, 0, 0, 0.5], + [0, 0, 1, 0.5], + ], + [ + [1, 0, 0, 0.25], + [0, 0, 1, 0.25], + ], + [ + [0.5, 0, 0, 0.5], + [0, 0, 1, 0.5], + ], + // Test clamping + [ + [1, 0, 0, 1], + [0, 0, 1, 1], + ], + // Test more than two elements + [ + [0.5, 0, 0, 0.25], + [0.25, 0.25, 0, 0.25], + [0.25, 0, 0.1, 0.25], + [0, 0, 0.1, 0.25], + ], + // Test a single element + [ + [0.5, 0, 0, 0.25], + ], +];
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/support/utils.js b/third_party/blink/web_tests/external/wpt/css/compositing/support/utils.js new file mode 100644 index 0000000..eb369ce --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/compositing/support/utils.js
@@ -0,0 +1,31 @@ +export function multiplyAlpha(pixel) { + return pixel.map((channel, i) => { + // Pass the alpha channel through unchanged + if (i === 3) return channel; + // Otherwise, multiply by alpha + return channel * pixel[3]; + }); +} + +export function unmultiplyAlpha(pixel) { + return pixel.map((channel, i) => { + // Pass the alpha channel through unchanged + if (i === 3) return channel; + // Avoid divide-by-zero + if (pixel[3] === 0) return channel; + // Divide by alpha + return channel / pixel[3]; + }); +} + +export function clamp01(value) { + if (value < 0) return 0; + if (value > 1) return 1; + return value; +} + +const toPercent = (num) => `${num * 100}%`; +export const toCSSColor = (pixel) => + `rgb(${toPercent(pixel[0])} ${toPercent(pixel[1])} ${toPercent(pixel[2])} / ${ + pixel[3] + })`;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-cascade/idlharness.html b/third_party/blink/web_tests/external/wpt/css/css-cascade/idlharness.html index 80d3318..9bde23b 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-cascade/idlharness.html +++ b/third_party/blink/web_tests/external/wpt/css/css-cascade/idlharness.html
@@ -15,7 +15,7 @@ <script> 'use strict'; idl_test( - ['css-cascade-5'], + ['css-cascade'], ['cssom'], idl_array => { try {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-pseudo/idlharness-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-pseudo/idlharness-expected.txt index 46168b2..f76169b 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-pseudo/idlharness-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-pseudo/idlharness-expected.txt
@@ -15,10 +15,15 @@ FAIL CSSPseudoElement interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing FAIL CSSPseudoElement interface: attribute type assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing FAIL CSSPseudoElement interface: attribute element assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface: attribute parent assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface: operation pseudo(CSSOMString) assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing FAIL CSSPseudoElement must be primary interface of beforeElements.item(0) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" FAIL Stringification of beforeElements.item(0) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "element" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "parent" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "pseudo(CSSOMString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL CSSPseudoElement interface: calling pseudo(CSSOMString) on beforeElements.item(0) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" FAIL Element interface: operation pseudo(CSSOMString) assert_own_property: interface prototype object missing non-static operation expected property "pseudo" missing Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-001-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-001-ref.html new file mode 100644 index 0000000..3dbb85a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-001-ref.html
@@ -0,0 +1,27 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text Reference File</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + div { + display: inline-block; + width: 3ch; + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + box-sizing: content-box; + overflow-y: hidden; + overflow-x: auto; + } +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<div class="left">XXX X</div> +<div class="center">XXX X</div> +<div class="right">XXX X</div> +<div class="start">XXX X</div> +<div class="end">XXX X</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-002-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-002-ref.html new file mode 100644 index 0000000..a0811e6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-002-ref.html
@@ -0,0 +1,27 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text Reference File</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + div { + display: inline-block; + width: 3ch; + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + box-sizing: content-box; + overflow-y: hidden; + overflow-x: auto; + } +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<div class="left">XXXX X</div> +<div class="center">XXXX X</div> +<div class="right">XXXX X</div> +<div class="start">XXXX X</div> +<div class="end">XXXX X</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-001-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-001-ref.html new file mode 100644 index 0000000..3de3f47 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-001-ref.html
@@ -0,0 +1,29 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text Reference File</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + div { + display: inline-block; + width: 3ch; + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + box-sizing: content-box; + overflow-y: hidden; + overflow-x: auto; + + direction: rtl; + } +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<div class="left">XXX X</div> +<div class="center">XXX X</div> +<div class="right">XXX X</div> +<div class="start">XXX X</div> +<div class="end">XXX X</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-002-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-002-ref.html new file mode 100644 index 0000000..8b29f31d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-002-ref.html
@@ -0,0 +1,29 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text Reference File</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + div { + display: inline-block; + width: 3ch; + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + box-sizing: content-box; + overflow-y: hidden; + overflow-x: auto; + + direction: rtl; + } +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<div class="left">XXXX X</div> +<div class="center">XXXX X</div> +<div class="right">XXXX X</div> +<div class="start">XXXX X</div> +<div class="end">XXXX X</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-005-ref.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-005-ref.html new file mode 100644 index 0000000..e93ee65 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/reference/trailing-space-and-text-alignment-rtl-005-ref.html
@@ -0,0 +1,29 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text Reference File</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + div { + display: inline-block; + width: 3ch; + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + box-sizing: content-box; + overflow-y: hidden; + overflow-x: auto; + + direction: rtl; + } +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<div class="left"> XXX X</div> +<div class="center"> XXX X</div> +<div class="right"> XXX X</div> +<div class="start"> XXX X</div> +<div class="end"> XXX X</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-001.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-001.html new file mode 100644 index 0000000..011518bdd8 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-001.html
@@ -0,0 +1,43 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal"> +<link rel="match" href="reference/trailing-space-and-text-alignment-001-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: normal' hang and shouldn't cause overflow and activate the horizontal scrollbar."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: normal; +} +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-002.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-002.html new file mode 100644 index 0000000..a015c74 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-002.html
@@ -0,0 +1,43 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre"> +<link rel="match" href="reference/trailing-space-and-text-alignment-002-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: pre' shouldn't hang and may cause overflow and activate the scrollbars."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: pre; + } +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-003.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-003.html new file mode 100644 index 0000000..9d0c971 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-003.html
@@ -0,0 +1,43 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap"> +<link rel="match" href="reference/trailing-space-and-text-alignment-001-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: pre-wrap' hang and shouldn't cause overflow and activate the horizontal scrollbar."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: pre-wrap; +} +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-004.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-004.html new file mode 100644 index 0000000..2328afa --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-004.html
@@ -0,0 +1,43 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces"> +<link rel="match" href="reference/trailing-space-and-text-alignment-002-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: break-spaces' shouldn't hang and may cause overflow and activate the horizontal scrollbar."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: break-spaces; +} +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-005.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-005.html new file mode 100644 index 0000000..059a2af4 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-005.html
@@ -0,0 +1,43 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-line"> +<link rel="match" href="reference/trailing-space-and-text-alignment-001-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: pre-line' hang and shouldn't cause overflow and activate the horizontal scrollbar."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: pre-line; +} +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-001.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-001.html new file mode 100644 index 0000000..5351fdc5 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-001.html
@@ -0,0 +1,44 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing RTL white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-normal"> +<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-001-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: normal' hang and shouldn't cause overflow and activate the horizontal scrollbar."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: normal; + direction: rtl; +} +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-002.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-002.html new file mode 100644 index 0000000..8fdf6943 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-002.html
@@ -0,0 +1,44 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing RTL white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre"> +<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-002-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: pre' shouldn't hang and may cause overflow and activate the scrollbars."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: pre; + direction: rtl; + } +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html new file mode 100644 index 0000000..00186110 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html
@@ -0,0 +1,44 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-wrap"> +<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-001-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: pre-wrap' hang and shouldn't cause overflow and activate the horizontal scrollbar."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: pre-wrap; + direction: rtl; +} +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-004.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-004.html new file mode 100644 index 0000000..628c7fa --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-004.html
@@ -0,0 +1,44 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing RTL white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-break-spaces"> +<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-005-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: break-spaces' shouldn't hang and may cause overflow and activate the horizontal scrollbar."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: break-spaces; + direction: rtl; +} +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-005.html b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-005.html new file mode 100644 index 0000000..bb69506 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-text/white-space/trailing-space-and-text-alignment-rtl-005.html
@@ -0,0 +1,44 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Text level 3 Test: preserved trailing RTL white space that hang in a textarea</title> +<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="3. White Space and Wrapping: the white-space property" href="https://drafts.csswg.org/css-text-3/#white-space-property"> +<link rel="help" title="4.1.2. Phase II: Trimming and Positioning" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> +<link rel="help" title="6.1. Text Alignment: the text-align shorthand" href="https://drafts.csswg.org/css-text-3/#text-align-property"> +<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-white-space-pre-line"> +<link rel="match" href="reference/trailing-space-and-text-alignment-rtl-001-ref.html"> +<meta name="assert" content="preserved trailing spaces under 'white-space: pre-line' hang and shouldn't cause overflow and activate the horizontal scrollbar."> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> +<style> + textarea { + /* Reset user-agent style */ + margin: initial; + padding: initial; + border: initial; + outline: initial; + resize: initial; + overflow-wrap: initial; + + height: 100px; + font: 40px/1 Ahem; + border: 1px solid black; + overflow-y: hidden; + overflow-x: auto; + + /* testing */ + width: 3ch; + white-space: pre-line; + direction: rtl; +} +.left { text-align: left; } +.center { text-align: center; } +.right { text-align: right; } +.start { text-align: start; } +.end { text-align: end; } +</style> +<textarea class="left">XXX X</textarea> +<textarea class="center">XXX X</textarea> +<textarea class="right">XXX X</textarea> +<textarea class="start">XXX X</textarea> +<textarea class="end">XXX X</textarea>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-001.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-001.html index 24ebd9f..a88f181 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-001.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-001.html
@@ -18,6 +18,9 @@ @media not and { div { background-color: red; } } + @media and { + div { background-color: red; } + } </style> </head> <body>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-002.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-002.html index 71f597e..763a7f29 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-002.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-002.html
@@ -18,6 +18,9 @@ @media not or { div { background-color: red; } } + @media or { + div { background-color: red; } + } </style> </head> <body>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-003.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-003.html index b12bd758..acc524c 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-003.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-003.html
@@ -18,6 +18,9 @@ @media not not { div { background-color: red; } } + @media not { + div { background-color: red; } + } </style> </head> <body>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-004.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-004.html index d039281c..689c8d1a78 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-004.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-004.html
@@ -18,6 +18,9 @@ @media not only { div { background-color: red; } } + @media only { + div { background-color: red; } + } </style> </head> <body>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-005.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-005.html new file mode 100644 index 0000000..3e25a24 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-005.html
@@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> +<meta charset="utf-8"> +<title>Mediaqueries-3 test: parsing hanging-punctuation with invalid values</title> +<link rel="help" href="https://www.w3.org/TR/css3-mediaqueries/#error-handling"> +<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/"> +<meta name="flags" content="invalid"> +<meta name="assert" content="media types ''not'', ''and'', ''only'' and ''or'' must not be treated as unknown media types, but rather trigger the malformed query clause."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + @media not and { + div { background-color: red; } + } + @media and { + div { background-color: red; } + } + @media not or { + div { background-color: red; } + } + @media or { + div { background-color: red; } + } + @media not not { + div { background-color: red; } + } + @media not { + div { background-color: red; } + } + @media not only { + div { background-color: red; } + } + @media only { + div { background-color: red; } + } +</style> +<script> +var queries = document.styleSheets[0].cssRules; +test(() => { + for (const query of queries) { + assert_equals(query.conditionText, "not all"); + } + assert_equals(queries.length, 8, "invalid rules must be treated as 'not all', not dropped"); + }, "syntactical MQ keywords used as media types are a syntax error"); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/has-specificity.html b/third_party/blink/web_tests/external/wpt/css/selectors/has-specificity.html new file mode 100644 index 0000000..b33e3a0e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/selectors/has-specificity.html
@@ -0,0 +1,42 @@ +<!DOCTYPE html> +<title>Specificity for complex :has selectors</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://drafts.csswg.org/selectors/#specificity-rules"> +<style> + main :has(#foo) { --t0:PASS; } + main :has(.foo) { --t0:FAIL; } + + main :has(span#foo) { --t1:PASS; } + main :has(#foo) { --t1:FAIL; } + + main :has(.bar, #foo) { --t2:FAIL; } + main :has(#foo, .bar) { --t2:PASS; } + + main :has(.bar, #foo) { --t3:PASS; } + main :has(.foo, .bar) { --t3:FAIL; } + + main :has(span + span) { --t4:PASS; } + main :has(span) { --t4:FAIL; } + + main :has(span, li, #foo) { --t5:PASS; } + main :has(span, li, p) { --t5:FAIL; } +</style> +<main id=main> + <div id=div><p><span id=foo class=foo></span><span class=bar></span><li></li></p></div> +</main> +<script> + function test_value(name, description) { + test(function() { + let actual = getComputedStyle(div).getPropertyValue(name); + assert_equals(actual, 'PASS'); + }, description); + } + + test_value('--t0', ':has(#foo) wins over :has(.foo)'); + test_value('--t1', ':has(span#foo) wins over :has(#foo)'); + test_value('--t2', ':has(.bar, #foo) has same specificity as :has(#foo, .bar)'); + test_value('--t3', ':has(.bar, #foo) wins over :has(.foo, .bar)'); + test_value('--t4', ':has(span + span) wins over :has(span)'); + test_value('--t5', ':has(span, li, p) wins over :has(span, lo, p)'); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-complexity.html b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-complexity.html index df127bcf..0bdcdec 100644 --- a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-complexity.html +++ b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-complexity.html
@@ -9,7 +9,7 @@ div, main { color: grey } main:has(span) .subject { color: red } main:has(span + span) .subject { color: green } -main:has(final) .subject { color: blue } +main:has(span + final) .subject { color: blue } main:has(nonexistent + span) .subject { color: black } main:has(span) span { color: black } main:has(nonexistent) span { color: black }
diff --git a/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm-expected.txt b/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm-expected.txt new file mode 100644 index 0000000..bbda97d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm-expected.txt
@@ -0,0 +1,8 @@ +This is a testharness.js-based test. +FAIL EventListener is cross-realm plain object without 'handleEvent' property assert_equals: expected "object" but got "undefined" +FAIL EventListener is cross-realm plain object with non-callable 'handleEvent' property assert_equals: expected "object" but got "undefined" +PASS EventListener is cross-realm plain object with revoked Proxy as 'handleEvent' property +FAIL EventListener is cross-realm non-callable revoked Proxy assert_equals: expected "object" but got "undefined" +PASS EventListener is cross-realm callable revoked Proxy +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm.html b/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm.html new file mode 100644 index 0000000..663d042 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm.html
@@ -0,0 +1,75 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Cross-realm EventListener throws TypeError of its associated Realm</title> +<link rel="help" href="https://webidl.spec.whatwg.org/#ref-for-prepare-to-run-script"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<iframe name="eventListenerGlobalObject" src="resources/empty-document.html"></iframe> + +<script> +setup({ allow_uncaught_exception: true }); + +test_onload(() => { + const eventTarget = new EventTarget; + const eventListener = new eventListenerGlobalObject.Object; + + eventTarget.addEventListener("foo", eventListener); + assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); +}, "EventListener is cross-realm plain object without 'handleEvent' property"); + +test_onload(() => { + const eventTarget = new EventTarget; + const eventListener = new eventListenerGlobalObject.Object; + eventListener.handleEvent = {}; + + eventTarget.addEventListener("foo", eventListener); + assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); +}, "EventListener is cross-realm plain object with non-callable 'handleEvent' property"); + +test_onload(() => { + const eventTarget = new EventTarget; + const { proxy, revoke } = Proxy.revocable(() => {}, {}); + revoke(); + + const eventListener = new eventListenerGlobalObject.Object; + eventListener.handleEvent = proxy; + + eventTarget.addEventListener("foo", eventListener); + assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); +}, "EventListener is cross-realm plain object with revoked Proxy as 'handleEvent' property"); + +test_onload(() => { + const eventTarget = new EventTarget; + const { proxy, revoke } = eventListenerGlobalObject.Proxy.revocable({}, {}); + revoke(); + + eventTarget.addEventListener("foo", proxy); + assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); +}, "EventListener is cross-realm non-callable revoked Proxy"); + +test_onload(() => { + const eventTarget = new EventTarget; + const { proxy, revoke } = eventListenerGlobalObject.Proxy.revocable(() => {}, {}); + revoke(); + + eventTarget.addEventListener("foo", proxy); + assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); +}, "EventListener is cross-realm callable revoked Proxy"); + +function test_onload(fn, desc) { + async_test(t => { window.addEventListener("load", t.step_func_done(fn)); }, desc); +} + +function assert_reports_exception(expectedConstructor, fn) { + let error; + const onErrorHandler = event => { error = event.error; }; + + eventListenerGlobalObject.addEventListener("error", onErrorHandler); + fn(); + eventListenerGlobalObject.removeEventListener("error", onErrorHandler); + + assert_equals(typeof error, "object"); + assert_equals(error.constructor, expectedConstructor); +} +</script>
diff --git a/third_party/blink/web_tests/external/wpt/dom/events/resources/empty-document.html b/third_party/blink/web_tests/external/wpt/dom/events/resources/empty-document.html new file mode 100644 index 0000000..b9cd130 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/events/resources/empty-document.html
@@ -0,0 +1,3 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/dom/idlharness.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/dom/idlharness.any.serviceworker-expected.txt new file mode 100644 index 0000000..a67b4ba7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/idlharness.any.serviceworker-expected.txt
@@ -0,0 +1,216 @@ +This is a testharness.js-based test. +Found 212 tests; 210 PASS, 2 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface Window: original interface defined +PASS Partial interface Window: member names are unique +PASS Partial interface Document: member names are unique +PASS Partial interface Document[2]: member names are unique +PASS Partial interface Window[2]: member names are unique +PASS Document includes NonElementParentNode: member names are unique +PASS DocumentFragment includes NonElementParentNode: member names are unique +PASS Document includes ParentNode: member names are unique +PASS DocumentFragment includes ParentNode: member names are unique +PASS Element includes ParentNode: member names are unique +PASS Element includes NonDocumentTypeChildNode: member names are unique +PASS CharacterData includes NonDocumentTypeChildNode: member names are unique +PASS DocumentType includes ChildNode: member names are unique +PASS Element includes ChildNode: member names are unique +PASS CharacterData includes ChildNode: member names are unique +PASS Element includes Slottable: member names are unique +PASS Text includes Slottable: member names are unique +PASS Document includes XPathEvaluatorBase: member names are unique +PASS XPathEvaluator includes XPathEvaluatorBase: member names are unique +PASS Document includes GlobalEventHandlers: member names are unique +PASS Document includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes GlobalEventHandlers: member names are unique +PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes ElementContentEditable: member names are unique +PASS HTMLElement includes HTMLOrSVGElement: member names are unique +PASS Window includes GlobalEventHandlers: member names are unique +PASS Window includes WindowEventHandlers: member names are unique +PASS Window includes WindowOrWorkerGlobalScope: member names are unique +PASS Window includes AnimationFrameProvider: member names are unique +PASS Window includes WindowSessionStorage: member names are unique +PASS Window includes WindowLocalStorage: member names are unique +PASS Event interface: existence and properties of interface object +PASS Event interface object length +PASS Event interface object name +PASS Event interface: existence and properties of interface prototype object +PASS Event interface: existence and properties of interface prototype object's "constructor" property +PASS Event interface: existence and properties of interface prototype object's @@unscopables property +PASS Event interface: attribute type +PASS Event interface: attribute target +PASS Event interface: attribute srcElement +PASS Event interface: attribute currentTarget +PASS Event interface: operation composedPath() +PASS Event interface: constant NONE on interface object +PASS Event interface: constant NONE on interface prototype object +PASS Event interface: constant CAPTURING_PHASE on interface object +PASS Event interface: constant CAPTURING_PHASE on interface prototype object +PASS Event interface: constant AT_TARGET on interface object +PASS Event interface: constant AT_TARGET on interface prototype object +PASS Event interface: constant BUBBLING_PHASE on interface object +PASS Event interface: constant BUBBLING_PHASE on interface prototype object +PASS Event interface: attribute eventPhase +PASS Event interface: operation stopPropagation() +PASS Event interface: attribute cancelBubble +PASS Event interface: operation stopImmediatePropagation() +PASS Event interface: attribute bubbles +PASS Event interface: attribute cancelable +PASS Event interface: attribute returnValue +PASS Event interface: operation preventDefault() +PASS Event interface: attribute defaultPrevented +PASS Event interface: attribute composed +PASS Event interface: attribute timeStamp +PASS Event interface: operation initEvent(DOMString, optional boolean, optional boolean) +PASS Event must be primary interface of new Event("foo") +PASS Stringification of new Event("foo") +PASS Event interface: new Event("foo") must inherit property "type" with the proper type +PASS Event interface: new Event("foo") must inherit property "target" with the proper type +PASS Event interface: new Event("foo") must inherit property "srcElement" with the proper type +PASS Event interface: new Event("foo") must inherit property "currentTarget" with the proper type +PASS Event interface: new Event("foo") must inherit property "composedPath()" with the proper type +PASS Event interface: new Event("foo") must inherit property "NONE" with the proper type +PASS Event interface: new Event("foo") must inherit property "CAPTURING_PHASE" with the proper type +PASS Event interface: new Event("foo") must inherit property "AT_TARGET" with the proper type +PASS Event interface: new Event("foo") must inherit property "BUBBLING_PHASE" with the proper type +PASS Event interface: new Event("foo") must inherit property "eventPhase" with the proper type +PASS Event interface: new Event("foo") must inherit property "stopPropagation()" with the proper type +PASS Event interface: new Event("foo") must inherit property "cancelBubble" with the proper type +PASS Event interface: new Event("foo") must inherit property "stopImmediatePropagation()" with the proper type +PASS Event interface: new Event("foo") must inherit property "bubbles" with the proper type +PASS Event interface: new Event("foo") must inherit property "cancelable" with the proper type +PASS Event interface: new Event("foo") must inherit property "returnValue" with the proper type +PASS Event interface: new Event("foo") must inherit property "preventDefault()" with the proper type +PASS Event interface: new Event("foo") must inherit property "defaultPrevented" with the proper type +PASS Event interface: new Event("foo") must inherit property "composed" with the proper type +PASS Event interface: new Event("foo") must have own property "isTrusted" +PASS Event interface: new Event("foo") must inherit property "timeStamp" with the proper type +PASS Event interface: new Event("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type +PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new Event("foo") with too few arguments must throw TypeError +PASS CustomEvent interface: existence and properties of interface object +PASS CustomEvent interface object length +PASS CustomEvent interface object name +PASS CustomEvent interface: existence and properties of interface prototype object +PASS CustomEvent interface: existence and properties of interface prototype object's "constructor" property +PASS CustomEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS CustomEvent interface: attribute detail +PASS CustomEvent interface: operation initCustomEvent(DOMString, optional boolean, optional boolean, optional any) +PASS CustomEvent must be primary interface of new CustomEvent("foo") +PASS Stringification of new CustomEvent("foo") +PASS CustomEvent interface: new CustomEvent("foo") must inherit property "detail" with the proper type +PASS CustomEvent interface: new CustomEvent("foo") must inherit property "initCustomEvent(DOMString, optional boolean, optional boolean, optional any)" with the proper type +PASS CustomEvent interface: calling initCustomEvent(DOMString, optional boolean, optional boolean, optional any) on new CustomEvent("foo") with too few arguments must throw TypeError +PASS Event interface: new CustomEvent("foo") must inherit property "type" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "target" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "srcElement" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "currentTarget" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "composedPath()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "NONE" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "CAPTURING_PHASE" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "AT_TARGET" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "BUBBLING_PHASE" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "eventPhase" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "stopPropagation()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "cancelBubble" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "stopImmediatePropagation()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "bubbles" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "cancelable" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "preventDefault()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "defaultPrevented" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "composed" with the proper type +PASS Event interface: new CustomEvent("foo") must have own property "isTrusted" +PASS Event interface: new CustomEvent("foo") must inherit property "timeStamp" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type +PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new CustomEvent("foo") with too few arguments must throw TypeError +PASS EventTarget interface: existence and properties of interface object +PASS EventTarget interface object length +PASS EventTarget interface object name +PASS EventTarget interface: existence and properties of interface prototype object +PASS EventTarget interface: existence and properties of interface prototype object's "constructor" property +PASS EventTarget interface: existence and properties of interface prototype object's @@unscopables property +PASS EventTarget interface: operation addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) +PASS EventTarget interface: operation removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) +PASS EventTarget interface: operation dispatchEvent(Event) +PASS EventTarget must be primary interface of new EventTarget() +PASS Stringification of new EventTarget() +PASS EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError +PASS EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError +PASS EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type +PASS EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError +PASS EventListener interface: existence and properties of interface object +PASS AbortController interface: existence and properties of interface object +PASS AbortController interface object length +PASS AbortController interface object name +PASS AbortController interface: existence and properties of interface prototype object +PASS AbortController interface: existence and properties of interface prototype object's "constructor" property +PASS AbortController interface: existence and properties of interface prototype object's @@unscopables property +PASS AbortController interface: attribute signal +PASS AbortController interface: operation abort(optional any) +PASS AbortController must be primary interface of new AbortController() +PASS Stringification of new AbortController() +PASS AbortController interface: new AbortController() must inherit property "signal" with the proper type +PASS AbortController interface: new AbortController() must inherit property "abort(optional any)" with the proper type +PASS AbortController interface: calling abort(optional any) on new AbortController() with too few arguments must throw TypeError +PASS AbortSignal interface: existence and properties of interface object +PASS AbortSignal interface object length +PASS AbortSignal interface object name +PASS AbortSignal interface: existence and properties of interface prototype object +PASS AbortSignal interface: existence and properties of interface prototype object's "constructor" property +PASS AbortSignal interface: existence and properties of interface prototype object's @@unscopables property +PASS AbortSignal interface: operation abort(optional any) +PASS AbortSignal interface: attribute aborted +PASS AbortSignal interface: attribute reason +FAIL AbortSignal interface: operation throwIfAborted() assert_own_property: interface prototype object missing non-static operation expected property "throwIfAborted" missing +PASS AbortSignal interface: attribute onabort +PASS AbortSignal must be primary interface of new AbortController().signal +PASS Stringification of new AbortController().signal +PASS AbortSignal interface: new AbortController().signal must inherit property "abort(optional any)" with the proper type +PASS AbortSignal interface: calling abort(optional any) on new AbortController().signal with too few arguments must throw TypeError +PASS AbortSignal interface: new AbortController().signal must inherit property "aborted" with the proper type +PASS AbortSignal interface: new AbortController().signal must inherit property "reason" with the proper type +FAIL AbortSignal interface: new AbortController().signal must inherit property "throwIfAborted()" with the proper type assert_inherits: property "throwIfAborted" not found in prototype chain +PASS AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type +PASS EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError +PASS EventTarget interface: new AbortController().signal must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError +PASS EventTarget interface: new AbortController().signal must inherit property "dispatchEvent(Event)" with the proper type +PASS EventTarget interface: calling dispatchEvent(Event) on new AbortController().signal with too few arguments must throw TypeError +PASS NodeList interface: existence and properties of interface object +PASS HTMLCollection interface: existence and properties of interface object +PASS MutationObserver interface: existence and properties of interface object +PASS MutationRecord interface: existence and properties of interface object +PASS Node interface: existence and properties of interface object +PASS Document interface: existence and properties of interface object +PASS XMLDocument interface: existence and properties of interface object +PASS DOMImplementation interface: existence and properties of interface object +PASS DocumentType interface: existence and properties of interface object +PASS DocumentFragment interface: existence and properties of interface object +PASS ShadowRoot interface: existence and properties of interface object +PASS Element interface: existence and properties of interface object +PASS NamedNodeMap interface: existence and properties of interface object +PASS Attr interface: existence and properties of interface object +PASS CharacterData interface: existence and properties of interface object +PASS Text interface: existence and properties of interface object +PASS CDATASection interface: existence and properties of interface object +PASS ProcessingInstruction interface: existence and properties of interface object +PASS Comment interface: existence and properties of interface object +PASS AbstractRange interface: existence and properties of interface object +PASS StaticRange interface: existence and properties of interface object +PASS Range interface: existence and properties of interface object +PASS NodeIterator interface: existence and properties of interface object +PASS TreeWalker interface: existence and properties of interface object +PASS NodeFilter interface: existence and properties of interface object +PASS DOMTokenList interface: existence and properties of interface object +PASS XPathResult interface: existence and properties of interface object +PASS XPathExpression interface: existence and properties of interface object +PASS XPathNSResolver interface: existence and properties of interface object +PASS XPathEvaluator interface: existence and properties of interface object +PASS XSLTProcessor interface: existence and properties of interface object +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/dom/idlharness.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/dom/idlharness.any.sharedworker-expected.txt new file mode 100644 index 0000000..a67b4ba7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/idlharness.any.sharedworker-expected.txt
@@ -0,0 +1,216 @@ +This is a testharness.js-based test. +Found 212 tests; 210 PASS, 2 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface Window: original interface defined +PASS Partial interface Window: member names are unique +PASS Partial interface Document: member names are unique +PASS Partial interface Document[2]: member names are unique +PASS Partial interface Window[2]: member names are unique +PASS Document includes NonElementParentNode: member names are unique +PASS DocumentFragment includes NonElementParentNode: member names are unique +PASS Document includes ParentNode: member names are unique +PASS DocumentFragment includes ParentNode: member names are unique +PASS Element includes ParentNode: member names are unique +PASS Element includes NonDocumentTypeChildNode: member names are unique +PASS CharacterData includes NonDocumentTypeChildNode: member names are unique +PASS DocumentType includes ChildNode: member names are unique +PASS Element includes ChildNode: member names are unique +PASS CharacterData includes ChildNode: member names are unique +PASS Element includes Slottable: member names are unique +PASS Text includes Slottable: member names are unique +PASS Document includes XPathEvaluatorBase: member names are unique +PASS XPathEvaluator includes XPathEvaluatorBase: member names are unique +PASS Document includes GlobalEventHandlers: member names are unique +PASS Document includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes GlobalEventHandlers: member names are unique +PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes ElementContentEditable: member names are unique +PASS HTMLElement includes HTMLOrSVGElement: member names are unique +PASS Window includes GlobalEventHandlers: member names are unique +PASS Window includes WindowEventHandlers: member names are unique +PASS Window includes WindowOrWorkerGlobalScope: member names are unique +PASS Window includes AnimationFrameProvider: member names are unique +PASS Window includes WindowSessionStorage: member names are unique +PASS Window includes WindowLocalStorage: member names are unique +PASS Event interface: existence and properties of interface object +PASS Event interface object length +PASS Event interface object name +PASS Event interface: existence and properties of interface prototype object +PASS Event interface: existence and properties of interface prototype object's "constructor" property +PASS Event interface: existence and properties of interface prototype object's @@unscopables property +PASS Event interface: attribute type +PASS Event interface: attribute target +PASS Event interface: attribute srcElement +PASS Event interface: attribute currentTarget +PASS Event interface: operation composedPath() +PASS Event interface: constant NONE on interface object +PASS Event interface: constant NONE on interface prototype object +PASS Event interface: constant CAPTURING_PHASE on interface object +PASS Event interface: constant CAPTURING_PHASE on interface prototype object +PASS Event interface: constant AT_TARGET on interface object +PASS Event interface: constant AT_TARGET on interface prototype object +PASS Event interface: constant BUBBLING_PHASE on interface object +PASS Event interface: constant BUBBLING_PHASE on interface prototype object +PASS Event interface: attribute eventPhase +PASS Event interface: operation stopPropagation() +PASS Event interface: attribute cancelBubble +PASS Event interface: operation stopImmediatePropagation() +PASS Event interface: attribute bubbles +PASS Event interface: attribute cancelable +PASS Event interface: attribute returnValue +PASS Event interface: operation preventDefault() +PASS Event interface: attribute defaultPrevented +PASS Event interface: attribute composed +PASS Event interface: attribute timeStamp +PASS Event interface: operation initEvent(DOMString, optional boolean, optional boolean) +PASS Event must be primary interface of new Event("foo") +PASS Stringification of new Event("foo") +PASS Event interface: new Event("foo") must inherit property "type" with the proper type +PASS Event interface: new Event("foo") must inherit property "target" with the proper type +PASS Event interface: new Event("foo") must inherit property "srcElement" with the proper type +PASS Event interface: new Event("foo") must inherit property "currentTarget" with the proper type +PASS Event interface: new Event("foo") must inherit property "composedPath()" with the proper type +PASS Event interface: new Event("foo") must inherit property "NONE" with the proper type +PASS Event interface: new Event("foo") must inherit property "CAPTURING_PHASE" with the proper type +PASS Event interface: new Event("foo") must inherit property "AT_TARGET" with the proper type +PASS Event interface: new Event("foo") must inherit property "BUBBLING_PHASE" with the proper type +PASS Event interface: new Event("foo") must inherit property "eventPhase" with the proper type +PASS Event interface: new Event("foo") must inherit property "stopPropagation()" with the proper type +PASS Event interface: new Event("foo") must inherit property "cancelBubble" with the proper type +PASS Event interface: new Event("foo") must inherit property "stopImmediatePropagation()" with the proper type +PASS Event interface: new Event("foo") must inherit property "bubbles" with the proper type +PASS Event interface: new Event("foo") must inherit property "cancelable" with the proper type +PASS Event interface: new Event("foo") must inherit property "returnValue" with the proper type +PASS Event interface: new Event("foo") must inherit property "preventDefault()" with the proper type +PASS Event interface: new Event("foo") must inherit property "defaultPrevented" with the proper type +PASS Event interface: new Event("foo") must inherit property "composed" with the proper type +PASS Event interface: new Event("foo") must have own property "isTrusted" +PASS Event interface: new Event("foo") must inherit property "timeStamp" with the proper type +PASS Event interface: new Event("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type +PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new Event("foo") with too few arguments must throw TypeError +PASS CustomEvent interface: existence and properties of interface object +PASS CustomEvent interface object length +PASS CustomEvent interface object name +PASS CustomEvent interface: existence and properties of interface prototype object +PASS CustomEvent interface: existence and properties of interface prototype object's "constructor" property +PASS CustomEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS CustomEvent interface: attribute detail +PASS CustomEvent interface: operation initCustomEvent(DOMString, optional boolean, optional boolean, optional any) +PASS CustomEvent must be primary interface of new CustomEvent("foo") +PASS Stringification of new CustomEvent("foo") +PASS CustomEvent interface: new CustomEvent("foo") must inherit property "detail" with the proper type +PASS CustomEvent interface: new CustomEvent("foo") must inherit property "initCustomEvent(DOMString, optional boolean, optional boolean, optional any)" with the proper type +PASS CustomEvent interface: calling initCustomEvent(DOMString, optional boolean, optional boolean, optional any) on new CustomEvent("foo") with too few arguments must throw TypeError +PASS Event interface: new CustomEvent("foo") must inherit property "type" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "target" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "srcElement" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "currentTarget" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "composedPath()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "NONE" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "CAPTURING_PHASE" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "AT_TARGET" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "BUBBLING_PHASE" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "eventPhase" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "stopPropagation()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "cancelBubble" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "stopImmediatePropagation()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "bubbles" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "cancelable" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "preventDefault()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "defaultPrevented" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "composed" with the proper type +PASS Event interface: new CustomEvent("foo") must have own property "isTrusted" +PASS Event interface: new CustomEvent("foo") must inherit property "timeStamp" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type +PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new CustomEvent("foo") with too few arguments must throw TypeError +PASS EventTarget interface: existence and properties of interface object +PASS EventTarget interface object length +PASS EventTarget interface object name +PASS EventTarget interface: existence and properties of interface prototype object +PASS EventTarget interface: existence and properties of interface prototype object's "constructor" property +PASS EventTarget interface: existence and properties of interface prototype object's @@unscopables property +PASS EventTarget interface: operation addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) +PASS EventTarget interface: operation removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) +PASS EventTarget interface: operation dispatchEvent(Event) +PASS EventTarget must be primary interface of new EventTarget() +PASS Stringification of new EventTarget() +PASS EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError +PASS EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError +PASS EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type +PASS EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError +PASS EventListener interface: existence and properties of interface object +PASS AbortController interface: existence and properties of interface object +PASS AbortController interface object length +PASS AbortController interface object name +PASS AbortController interface: existence and properties of interface prototype object +PASS AbortController interface: existence and properties of interface prototype object's "constructor" property +PASS AbortController interface: existence and properties of interface prototype object's @@unscopables property +PASS AbortController interface: attribute signal +PASS AbortController interface: operation abort(optional any) +PASS AbortController must be primary interface of new AbortController() +PASS Stringification of new AbortController() +PASS AbortController interface: new AbortController() must inherit property "signal" with the proper type +PASS AbortController interface: new AbortController() must inherit property "abort(optional any)" with the proper type +PASS AbortController interface: calling abort(optional any) on new AbortController() with too few arguments must throw TypeError +PASS AbortSignal interface: existence and properties of interface object +PASS AbortSignal interface object length +PASS AbortSignal interface object name +PASS AbortSignal interface: existence and properties of interface prototype object +PASS AbortSignal interface: existence and properties of interface prototype object's "constructor" property +PASS AbortSignal interface: existence and properties of interface prototype object's @@unscopables property +PASS AbortSignal interface: operation abort(optional any) +PASS AbortSignal interface: attribute aborted +PASS AbortSignal interface: attribute reason +FAIL AbortSignal interface: operation throwIfAborted() assert_own_property: interface prototype object missing non-static operation expected property "throwIfAborted" missing +PASS AbortSignal interface: attribute onabort +PASS AbortSignal must be primary interface of new AbortController().signal +PASS Stringification of new AbortController().signal +PASS AbortSignal interface: new AbortController().signal must inherit property "abort(optional any)" with the proper type +PASS AbortSignal interface: calling abort(optional any) on new AbortController().signal with too few arguments must throw TypeError +PASS AbortSignal interface: new AbortController().signal must inherit property "aborted" with the proper type +PASS AbortSignal interface: new AbortController().signal must inherit property "reason" with the proper type +FAIL AbortSignal interface: new AbortController().signal must inherit property "throwIfAborted()" with the proper type assert_inherits: property "throwIfAborted" not found in prototype chain +PASS AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type +PASS EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError +PASS EventTarget interface: new AbortController().signal must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError +PASS EventTarget interface: new AbortController().signal must inherit property "dispatchEvent(Event)" with the proper type +PASS EventTarget interface: calling dispatchEvent(Event) on new AbortController().signal with too few arguments must throw TypeError +PASS NodeList interface: existence and properties of interface object +PASS HTMLCollection interface: existence and properties of interface object +PASS MutationObserver interface: existence and properties of interface object +PASS MutationRecord interface: existence and properties of interface object +PASS Node interface: existence and properties of interface object +PASS Document interface: existence and properties of interface object +PASS XMLDocument interface: existence and properties of interface object +PASS DOMImplementation interface: existence and properties of interface object +PASS DocumentType interface: existence and properties of interface object +PASS DocumentFragment interface: existence and properties of interface object +PASS ShadowRoot interface: existence and properties of interface object +PASS Element interface: existence and properties of interface object +PASS NamedNodeMap interface: existence and properties of interface object +PASS Attr interface: existence and properties of interface object +PASS CharacterData interface: existence and properties of interface object +PASS Text interface: existence and properties of interface object +PASS CDATASection interface: existence and properties of interface object +PASS ProcessingInstruction interface: existence and properties of interface object +PASS Comment interface: existence and properties of interface object +PASS AbstractRange interface: existence and properties of interface object +PASS StaticRange interface: existence and properties of interface object +PASS Range interface: existence and properties of interface object +PASS NodeIterator interface: existence and properties of interface object +PASS TreeWalker interface: existence and properties of interface object +PASS NodeFilter interface: existence and properties of interface object +PASS DOMTokenList interface: existence and properties of interface object +PASS XPathResult interface: existence and properties of interface object +PASS XPathExpression interface: existence and properties of interface object +PASS XPathNSResolver interface: existence and properties of interface object +PASS XPathEvaluator interface: existence and properties of interface object +PASS XSLTProcessor interface: existence and properties of interface object +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/dom/idlharness.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/dom/idlharness.any.worker-expected.txt new file mode 100644 index 0000000..a67b4ba7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/idlharness.any.worker-expected.txt
@@ -0,0 +1,216 @@ +This is a testharness.js-based test. +Found 212 tests; 210 PASS, 2 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface Window: original interface defined +PASS Partial interface Window: member names are unique +PASS Partial interface Document: member names are unique +PASS Partial interface Document[2]: member names are unique +PASS Partial interface Window[2]: member names are unique +PASS Document includes NonElementParentNode: member names are unique +PASS DocumentFragment includes NonElementParentNode: member names are unique +PASS Document includes ParentNode: member names are unique +PASS DocumentFragment includes ParentNode: member names are unique +PASS Element includes ParentNode: member names are unique +PASS Element includes NonDocumentTypeChildNode: member names are unique +PASS CharacterData includes NonDocumentTypeChildNode: member names are unique +PASS DocumentType includes ChildNode: member names are unique +PASS Element includes ChildNode: member names are unique +PASS CharacterData includes ChildNode: member names are unique +PASS Element includes Slottable: member names are unique +PASS Text includes Slottable: member names are unique +PASS Document includes XPathEvaluatorBase: member names are unique +PASS XPathEvaluator includes XPathEvaluatorBase: member names are unique +PASS Document includes GlobalEventHandlers: member names are unique +PASS Document includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes GlobalEventHandlers: member names are unique +PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique +PASS HTMLElement includes ElementContentEditable: member names are unique +PASS HTMLElement includes HTMLOrSVGElement: member names are unique +PASS Window includes GlobalEventHandlers: member names are unique +PASS Window includes WindowEventHandlers: member names are unique +PASS Window includes WindowOrWorkerGlobalScope: member names are unique +PASS Window includes AnimationFrameProvider: member names are unique +PASS Window includes WindowSessionStorage: member names are unique +PASS Window includes WindowLocalStorage: member names are unique +PASS Event interface: existence and properties of interface object +PASS Event interface object length +PASS Event interface object name +PASS Event interface: existence and properties of interface prototype object +PASS Event interface: existence and properties of interface prototype object's "constructor" property +PASS Event interface: existence and properties of interface prototype object's @@unscopables property +PASS Event interface: attribute type +PASS Event interface: attribute target +PASS Event interface: attribute srcElement +PASS Event interface: attribute currentTarget +PASS Event interface: operation composedPath() +PASS Event interface: constant NONE on interface object +PASS Event interface: constant NONE on interface prototype object +PASS Event interface: constant CAPTURING_PHASE on interface object +PASS Event interface: constant CAPTURING_PHASE on interface prototype object +PASS Event interface: constant AT_TARGET on interface object +PASS Event interface: constant AT_TARGET on interface prototype object +PASS Event interface: constant BUBBLING_PHASE on interface object +PASS Event interface: constant BUBBLING_PHASE on interface prototype object +PASS Event interface: attribute eventPhase +PASS Event interface: operation stopPropagation() +PASS Event interface: attribute cancelBubble +PASS Event interface: operation stopImmediatePropagation() +PASS Event interface: attribute bubbles +PASS Event interface: attribute cancelable +PASS Event interface: attribute returnValue +PASS Event interface: operation preventDefault() +PASS Event interface: attribute defaultPrevented +PASS Event interface: attribute composed +PASS Event interface: attribute timeStamp +PASS Event interface: operation initEvent(DOMString, optional boolean, optional boolean) +PASS Event must be primary interface of new Event("foo") +PASS Stringification of new Event("foo") +PASS Event interface: new Event("foo") must inherit property "type" with the proper type +PASS Event interface: new Event("foo") must inherit property "target" with the proper type +PASS Event interface: new Event("foo") must inherit property "srcElement" with the proper type +PASS Event interface: new Event("foo") must inherit property "currentTarget" with the proper type +PASS Event interface: new Event("foo") must inherit property "composedPath()" with the proper type +PASS Event interface: new Event("foo") must inherit property "NONE" with the proper type +PASS Event interface: new Event("foo") must inherit property "CAPTURING_PHASE" with the proper type +PASS Event interface: new Event("foo") must inherit property "AT_TARGET" with the proper type +PASS Event interface: new Event("foo") must inherit property "BUBBLING_PHASE" with the proper type +PASS Event interface: new Event("foo") must inherit property "eventPhase" with the proper type +PASS Event interface: new Event("foo") must inherit property "stopPropagation()" with the proper type +PASS Event interface: new Event("foo") must inherit property "cancelBubble" with the proper type +PASS Event interface: new Event("foo") must inherit property "stopImmediatePropagation()" with the proper type +PASS Event interface: new Event("foo") must inherit property "bubbles" with the proper type +PASS Event interface: new Event("foo") must inherit property "cancelable" with the proper type +PASS Event interface: new Event("foo") must inherit property "returnValue" with the proper type +PASS Event interface: new Event("foo") must inherit property "preventDefault()" with the proper type +PASS Event interface: new Event("foo") must inherit property "defaultPrevented" with the proper type +PASS Event interface: new Event("foo") must inherit property "composed" with the proper type +PASS Event interface: new Event("foo") must have own property "isTrusted" +PASS Event interface: new Event("foo") must inherit property "timeStamp" with the proper type +PASS Event interface: new Event("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type +PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new Event("foo") with too few arguments must throw TypeError +PASS CustomEvent interface: existence and properties of interface object +PASS CustomEvent interface object length +PASS CustomEvent interface object name +PASS CustomEvent interface: existence and properties of interface prototype object +PASS CustomEvent interface: existence and properties of interface prototype object's "constructor" property +PASS CustomEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS CustomEvent interface: attribute detail +PASS CustomEvent interface: operation initCustomEvent(DOMString, optional boolean, optional boolean, optional any) +PASS CustomEvent must be primary interface of new CustomEvent("foo") +PASS Stringification of new CustomEvent("foo") +PASS CustomEvent interface: new CustomEvent("foo") must inherit property "detail" with the proper type +PASS CustomEvent interface: new CustomEvent("foo") must inherit property "initCustomEvent(DOMString, optional boolean, optional boolean, optional any)" with the proper type +PASS CustomEvent interface: calling initCustomEvent(DOMString, optional boolean, optional boolean, optional any) on new CustomEvent("foo") with too few arguments must throw TypeError +PASS Event interface: new CustomEvent("foo") must inherit property "type" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "target" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "srcElement" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "currentTarget" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "composedPath()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "NONE" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "CAPTURING_PHASE" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "AT_TARGET" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "BUBBLING_PHASE" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "eventPhase" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "stopPropagation()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "cancelBubble" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "stopImmediatePropagation()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "bubbles" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "cancelable" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "preventDefault()" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "defaultPrevented" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "composed" with the proper type +PASS Event interface: new CustomEvent("foo") must have own property "isTrusted" +PASS Event interface: new CustomEvent("foo") must inherit property "timeStamp" with the proper type +PASS Event interface: new CustomEvent("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type +PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new CustomEvent("foo") with too few arguments must throw TypeError +PASS EventTarget interface: existence and properties of interface object +PASS EventTarget interface object length +PASS EventTarget interface object name +PASS EventTarget interface: existence and properties of interface prototype object +PASS EventTarget interface: existence and properties of interface prototype object's "constructor" property +PASS EventTarget interface: existence and properties of interface prototype object's @@unscopables property +PASS EventTarget interface: operation addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) +PASS EventTarget interface: operation removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) +PASS EventTarget interface: operation dispatchEvent(Event) +PASS EventTarget must be primary interface of new EventTarget() +PASS Stringification of new EventTarget() +PASS EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError +PASS EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError +PASS EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type +PASS EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError +PASS EventListener interface: existence and properties of interface object +PASS AbortController interface: existence and properties of interface object +PASS AbortController interface object length +PASS AbortController interface object name +PASS AbortController interface: existence and properties of interface prototype object +PASS AbortController interface: existence and properties of interface prototype object's "constructor" property +PASS AbortController interface: existence and properties of interface prototype object's @@unscopables property +PASS AbortController interface: attribute signal +PASS AbortController interface: operation abort(optional any) +PASS AbortController must be primary interface of new AbortController() +PASS Stringification of new AbortController() +PASS AbortController interface: new AbortController() must inherit property "signal" with the proper type +PASS AbortController interface: new AbortController() must inherit property "abort(optional any)" with the proper type +PASS AbortController interface: calling abort(optional any) on new AbortController() with too few arguments must throw TypeError +PASS AbortSignal interface: existence and properties of interface object +PASS AbortSignal interface object length +PASS AbortSignal interface object name +PASS AbortSignal interface: existence and properties of interface prototype object +PASS AbortSignal interface: existence and properties of interface prototype object's "constructor" property +PASS AbortSignal interface: existence and properties of interface prototype object's @@unscopables property +PASS AbortSignal interface: operation abort(optional any) +PASS AbortSignal interface: attribute aborted +PASS AbortSignal interface: attribute reason +FAIL AbortSignal interface: operation throwIfAborted() assert_own_property: interface prototype object missing non-static operation expected property "throwIfAborted" missing +PASS AbortSignal interface: attribute onabort +PASS AbortSignal must be primary interface of new AbortController().signal +PASS Stringification of new AbortController().signal +PASS AbortSignal interface: new AbortController().signal must inherit property "abort(optional any)" with the proper type +PASS AbortSignal interface: calling abort(optional any) on new AbortController().signal with too few arguments must throw TypeError +PASS AbortSignal interface: new AbortController().signal must inherit property "aborted" with the proper type +PASS AbortSignal interface: new AbortController().signal must inherit property "reason" with the proper type +FAIL AbortSignal interface: new AbortController().signal must inherit property "throwIfAborted()" with the proper type assert_inherits: property "throwIfAborted" not found in prototype chain +PASS AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type +PASS EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError +PASS EventTarget interface: new AbortController().signal must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type +PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError +PASS EventTarget interface: new AbortController().signal must inherit property "dispatchEvent(Event)" with the proper type +PASS EventTarget interface: calling dispatchEvent(Event) on new AbortController().signal with too few arguments must throw TypeError +PASS NodeList interface: existence and properties of interface object +PASS HTMLCollection interface: existence and properties of interface object +PASS MutationObserver interface: existence and properties of interface object +PASS MutationRecord interface: existence and properties of interface object +PASS Node interface: existence and properties of interface object +PASS Document interface: existence and properties of interface object +PASS XMLDocument interface: existence and properties of interface object +PASS DOMImplementation interface: existence and properties of interface object +PASS DocumentType interface: existence and properties of interface object +PASS DocumentFragment interface: existence and properties of interface object +PASS ShadowRoot interface: existence and properties of interface object +PASS Element interface: existence and properties of interface object +PASS NamedNodeMap interface: existence and properties of interface object +PASS Attr interface: existence and properties of interface object +PASS CharacterData interface: existence and properties of interface object +PASS Text interface: existence and properties of interface object +PASS CDATASection interface: existence and properties of interface object +PASS ProcessingInstruction interface: existence and properties of interface object +PASS Comment interface: existence and properties of interface object +PASS AbstractRange interface: existence and properties of interface object +PASS StaticRange interface: existence and properties of interface object +PASS Range interface: existence and properties of interface object +PASS NodeIterator interface: existence and properties of interface object +PASS TreeWalker interface: existence and properties of interface object +PASS NodeFilter interface: existence and properties of interface object +PASS DOMTokenList interface: existence and properties of interface object +PASS XPathResult interface: existence and properties of interface object +PASS XPathExpression interface: existence and properties of interface object +PASS XPathNSResolver interface: existence and properties of interface object +PASS XPathEvaluator interface: existence and properties of interface object +PASS XSLTProcessor interface: existence and properties of interface object +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/dom/idlharness.window_exclude=Node-expected.txt b/third_party/blink/web_tests/external/wpt/dom/idlharness.window_exclude=Node-expected.txt index 12920ef..aa4572f1 100644 --- a/third_party/blink/web_tests/external/wpt/dom/idlharness.window_exclude=Node-expected.txt +++ b/third_party/blink/web_tests/external/wpt/dom/idlharness.window_exclude=Node-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 1290 tests; 1287 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 1292 tests; 1287 PASS, 5 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Window: original interface defined @@ -194,6 +194,7 @@ PASS AbortSignal interface: operation abort(optional any) PASS AbortSignal interface: attribute aborted PASS AbortSignal interface: attribute reason +FAIL AbortSignal interface: operation throwIfAborted() assert_own_property: interface prototype object missing non-static operation expected property "throwIfAborted" missing PASS AbortSignal interface: attribute onabort PASS AbortSignal must be primary interface of new AbortController().signal PASS Stringification of new AbortController().signal @@ -201,6 +202,7 @@ PASS AbortSignal interface: calling abort(optional any) on new AbortController().signal with too few arguments must throw TypeError PASS AbortSignal interface: new AbortController().signal must inherit property "aborted" with the proper type PASS AbortSignal interface: new AbortController().signal must inherit property "reason" with the proper type +FAIL AbortSignal interface: new AbortController().signal must inherit property "throwIfAborted()" with the proper type assert_inherits: property "throwIfAborted" not found in prototype chain PASS AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type PASS EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-expected.txt b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-expected.txt deleted file mode 100644 index 7948b1b..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -This is a testharness.js-based test. -PASS parent's |this|, parent's method, parent's filter, parent's root -PASS parent's |this|, parent's method, parent's filter, iframe's root -FAIL parent's |this|, parent's method, iframe's filter, iframe's root assert_equals: expected function "function TypeError() { [native code] }" but got function "function TypeError() { [native code] }" -PASS parent's |this|, iframes's method, iframe's filter, iframe's root -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-expected.txt b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-expected.txt deleted file mode 100644 index e9ed6f0..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-expected.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is a testharness.js-based test. -FAIL TreeWalker: NodeFilter from detached iframe works as expected Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is no longer runnable. -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html index 4d6bb53..f8e71bc 100644 --- a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html +++ b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html
@@ -1,11 +1,12 @@ <!DOCTYPE html> <meta charset="utf-8"> -<title>TreeWalker: NodeFilter from detached iframe works as expected</title> -<link rel="help" href="https://dom.spec.whatwg.org/#ref-for-call-a-user-objects-operation%E2%91%A0"> +<title>TreeWalker: NodeFilter from detached iframe doesn't get called</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <body> +<div></div> + <script> const t = async_test(); @@ -16,8 +17,13 @@ iframe.remove(); assert_equals(iframe.contentWindow, null); - assert_equals(nodeIterator.nextNode(), document.body); - assert_true(nodeIterator.dummyFilterCalled); + + let errorWasThrown = false; + try { nodeIterator.nextNode(); } + catch { errorWasThrown = true; } + + assert_true(errorWasThrown); + assert_false(nodeIterator.dummyFilterCalled); }); document.body.append(iframe);
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm.html b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm.html index 60a80d31..da91cf6c 100644 --- a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm.html +++ b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm.html
@@ -1,21 +1,60 @@ <!DOCTYPE html> -<title>TreeWalker: cross-realm NodeFilter throws TypeError of current realm</title> +<meta charset="utf-8"> +<title>TreeWalker: cross-realm NodeFilter throws TypeError of its associated Realm</title> +<link rel="help" href="https://webidl.spec.whatwg.org/#ref-for-prepare-to-run-script"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<link rel="help" href="https://webidl.spec.whatwg.org/#call-a-user-objects-operation"> -<body id="treeWalkerRoot"> -<div></div> +<iframe name="nodeFilterGlobalObject" src="support/empty-document.html"></iframe> + +<div id="treeWalkerRoot"> + <div class="firstChild"></div> +</div> <script> -const iframe = document.createElement("iframe"); -iframe.src = "support/TreeWalker-acceptNode-filter-cross-realm-subframe.html"; -iframe.onload = () => { - for (const testCase of iframe.contentWindow.testCases) { - test(t => { - assert_equals(testCase.actual.constructor, testCase.expected); - }, testCase.description); - } -}; -document.body.append(iframe); +test_onload(() => { + const nodeFilter = new nodeFilterGlobalObject.Object; + + const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, nodeFilter); + assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); +}, "NodeFilter is cross-realm plain object without 'acceptNode' property"); + +test_onload(() => { + const nodeFilter = new nodeFilterGlobalObject.Object; + nodeFilter.acceptNode = {}; + + const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, nodeFilter); + assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); +}, "NodeFilter is cross-realm plain object with non-callable 'acceptNode' property"); + +test_onload(() => { + const { proxy, revoke } = Proxy.revocable(() => {}, {}); + revoke(); + + const nodeFilter = new nodeFilterGlobalObject.Object; + nodeFilter.acceptNode = proxy; + + const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, nodeFilter); + assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); +}, "NodeFilter is cross-realm plain object with revoked Proxy as 'acceptNode' property"); + +test_onload(() => { + const { proxy, revoke } = nodeFilterGlobalObject.Proxy.revocable({}, {}); + revoke(); + + const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, proxy); + assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); +}, "NodeFilter is cross-realm non-callable revoked Proxy"); + +test_onload(() => { + const { proxy, revoke } = nodeFilterGlobalObject.Proxy.revocable(() => {}, {}); + revoke(); + + const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, proxy); + assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); +}, "NodeFilter is cross-realm callable revoked Proxy"); + +function test_onload(fn, desc) { + async_test(t => { window.addEventListener("load", t.step_func_done(fn)); }, desc); +} </script>
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/support/TreeWalker-acceptNode-filter-cross-realm-subframe.html b/third_party/blink/web_tests/external/wpt/dom/traversal/support/TreeWalker-acceptNode-filter-cross-realm-subframe.html deleted file mode 100644 index 0c8bda14..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/traversal/support/TreeWalker-acceptNode-filter-cross-realm-subframe.html +++ /dev/null
@@ -1,22 +0,0 @@ -<!DOCTYPE html> - -<body id="treeWalkerRoot"> -<div></div> - -<script> -window.testCases = []; - -(function() { - let walker = parent.document.createTreeWalker(parent.treeWalkerRoot, NodeFilter.SHOW_ELEMENT, new parent.Object); - try { walker.firstChild(); } catch (err) { testCases.push({ actual: err, expected: parent.TypeError, description: "parent's |this|, parent's method, parent's filter, parent's root" }); } - - walker = parent.document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, new parent.Object); - try { walker.firstChild(); } catch (err) { testCases.push({ actual: err, expected: parent.TypeError, description: "parent's |this|, parent's method, parent's filter, iframe's root" }); } - - walker = parent.document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, {}); - try { walker.firstChild(); } catch (err) { testCases.push({ actual: err, expected: parent.TypeError, description: "parent's |this|, parent's method, iframe's filter, iframe's root" }); } - - walker = document.createTreeWalker.call(parent.document, treeWalkerRoot, NodeFilter.SHOW_ELEMENT, {}); - try { walker.firstChild(); } catch (err) { testCases.push({ actual: err, expected: TypeError, description: "parent's |this|, iframes's method, iframe's filter, iframe's root" }); } -})(); -</script>
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/support/empty-document.html b/third_party/blink/web_tests/external/wpt/dom/traversal/support/empty-document.html new file mode 100644 index 0000000..b9cd130 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/traversal/support/empty-document.html
@@ -0,0 +1,3 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm-expected.txt b/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm-expected.txt new file mode 100644 index 0000000..1e681034 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm-expected.txt
@@ -0,0 +1,8 @@ +This is a testharness.js-based test. +FAIL XPathNSResolver is cross-realm plain object without 'lookupNamespaceURI' property assert_unreached: Should have rejected: undefined Reached unreachable code +FAIL XPathNSResolver is cross-realm plain object with non-callable 'lookupNamespaceURI' property assert_unreached: Should have rejected: undefined Reached unreachable code +FAIL XPathNSResolver is cross-realm plain object with revoked Proxy as 'lookupNamespaceURI' property assert_unreached: Should have rejected: undefined Reached unreachable code +FAIL XPathNSResolver is cross-realm non-callable revoked Proxy assert_unreached: Should have rejected: undefined Reached unreachable code +FAIL XPathNSResolver is cross-realm callable revoked Proxy assert_unreached: Should have rejected: undefined Reached unreachable code +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm.html b/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm.html new file mode 100644 index 0000000..55fbb07 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm.html
@@ -0,0 +1,67 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Cross-realm XPathNSResolver throws TypeError of its associated Realm</title> +<link rel="help" href="https://webidl.spec.whatwg.org/#ref-for-prepare-to-run-script"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/invalid_namespace_test.js"></script> + +<iframe name="resolverGlobalObject" src="resources/empty-document.html"></iframe> + +<script> +setup({ allow_uncaught_exception: true }); + +const iframeLoaded = new Promise(resolve => { window.addEventListener("load", resolve); }); + +promise_test(async t => { + await iframeLoaded; + const resolver = new resolverGlobalObject.Object; + + return promise_rejects_js(t, resolverGlobalObject.TypeError, + invalid_namespace_test(t, resolver, resolverGlobalObject) + ); +}, "XPathNSResolver is cross-realm plain object without 'lookupNamespaceURI' property"); + +promise_test(async t => { + await iframeLoaded; + const resolver = new resolverGlobalObject.Object; + resolver.lookupNamespaceURI = {}; + + return promise_rejects_js(t, resolverGlobalObject.TypeError, + invalid_namespace_test(t, resolver, resolverGlobalObject) + ); +}, "XPathNSResolver is cross-realm plain object with non-callable 'lookupNamespaceURI' property"); + +promise_test(async t => { + await iframeLoaded; + const { proxy, revoke } = Proxy.revocable(() => {}, {}); + revoke(); + + const resolver = new resolverGlobalObject.Object; + resolver.lookupNamespaceURI = proxy; + + return promise_rejects_js(t, resolverGlobalObject.TypeError, + invalid_namespace_test(t, resolver, resolverGlobalObject) + ); +}, "XPathNSResolver is cross-realm plain object with revoked Proxy as 'lookupNamespaceURI' property"); + +promise_test(async t => { + await iframeLoaded; + const { proxy, revoke } = resolverGlobalObject.Proxy.revocable({}, {}); + revoke(); + + return promise_rejects_js(t, resolverGlobalObject.TypeError, + invalid_namespace_test(t, proxy, resolverGlobalObject) + ); +}, "XPathNSResolver is cross-realm non-callable revoked Proxy"); + +promise_test(async t => { + await iframeLoaded; + const { proxy, revoke } = resolverGlobalObject.Proxy.revocable(() => {}, {}); + revoke(); + + return promise_rejects_js(t, resolverGlobalObject.TypeError, + invalid_namespace_test(t, proxy, resolverGlobalObject) + ); +}, "XPathNSResolver is cross-realm callable revoked Proxy"); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/domxpath/resources/empty-document.html b/third_party/blink/web_tests/external/wpt/domxpath/resources/empty-document.html new file mode 100644 index 0000000..b9cd130 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/domxpath/resources/empty-document.html
@@ -0,0 +1,3 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<body>
diff --git a/third_party/blink/web_tests/external/wpt/domxpath/resources/invalid_namespace_test.js b/third_party/blink/web_tests/external/wpt/domxpath/resources/invalid_namespace_test.js index b985261..8b934ef 100644 --- a/third_party/blink/web_tests/external/wpt/domxpath/resources/invalid_namespace_test.js +++ b/third_party/blink/web_tests/external/wpt/domxpath/resources/invalid_namespace_test.js
@@ -1,15 +1,15 @@ "use strict"; setup({ allow_uncaught_exception: true }); -const invalid_namespace_test = (t, resolver) => { +const invalid_namespace_test = (t, resolver, resolverWindow = window) => { const result = new Promise((resolve, reject) => { const handler = event => { reject(event.error); }; - window.addEventListener("error", handler); + resolverWindow.addEventListener("error", handler); t.add_cleanup(() => { - window.removeEventListener("error", handler); + resolverWindow.removeEventListener("error", handler); }); t.step_timeout(resolve, 0);
diff --git a/third_party/blink/web_tests/external/wpt/event-timing/idlharness.any-expected.txt b/third_party/blink/web_tests/external/wpt/event-timing/idlharness.any-expected.txt new file mode 100644 index 0000000..c4137e86 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/event-timing/idlharness.any-expected.txt
@@ -0,0 +1,39 @@ +This is a testharness.js-based test. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface Performance: original interface defined +PASS Partial interface Performance: valid exposure set +PASS Partial interface Performance: member names are unique +PASS Partial dictionary PerformanceObserverInit: original dictionary defined +PASS Partial dictionary PerformanceObserverInit: member names are unique +PASS Partial interface Performance[2]: member names are unique +PASS PerformanceEventTiming interface: existence and properties of interface object +PASS PerformanceEventTiming interface object length +PASS PerformanceEventTiming interface object name +PASS PerformanceEventTiming interface: existence and properties of interface prototype object +PASS PerformanceEventTiming interface: existence and properties of interface prototype object's "constructor" property +PASS PerformanceEventTiming interface: existence and properties of interface prototype object's @@unscopables property +PASS PerformanceEventTiming interface: attribute processingStart +PASS PerformanceEventTiming interface: attribute processingEnd +PASS PerformanceEventTiming interface: attribute cancelable +PASS PerformanceEventTiming interface: attribute target +PASS PerformanceEventTiming interface: attribute interactionId +PASS PerformanceEventTiming interface: operation toJSON() +PASS EventCounts interface: existence and properties of interface object +PASS EventCounts interface object length +PASS EventCounts interface object name +PASS EventCounts interface: existence and properties of interface prototype object +PASS EventCounts interface: existence and properties of interface prototype object's "constructor" property +PASS EventCounts interface: existence and properties of interface prototype object's @@unscopables property +FAIL InteractionCounts interface: existence and properties of interface object assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing +FAIL InteractionCounts interface object length assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing +FAIL InteractionCounts interface object name assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing +FAIL InteractionCounts interface: existence and properties of interface prototype object assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing +FAIL InteractionCounts interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing +FAIL InteractionCounts interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing +PASS Performance interface: attribute eventCounts +FAIL Performance interface: attribute interactionCounts assert_true: The prototype object must have a property "interactionCounts" expected true got false +PASS Performance interface: performance must inherit property "eventCounts" with the proper type +FAIL Performance interface: performance must inherit property "interactionCounts" with the proper type assert_inherits: property "interactionCounts" not found in prototype chain +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/geolocation-API/idlharness.https.window.js b/third_party/blink/web_tests/external/wpt/geolocation-API/idlharness.https.window.js index 7f83eaf..176bae8 100644 --- a/third_party/blink/web_tests/external/wpt/geolocation-API/idlharness.https.window.js +++ b/third_party/blink/web_tests/external/wpt/geolocation-API/idlharness.https.window.js
@@ -4,7 +4,7 @@ // https://www.w3.org/TR/geolocation-API/ idl_test( - ['geolocation-API'], + ['geolocation'], ['hr-time', 'html'], idl_array => { self.audio = document.createElement('audio');
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/cross-origin-isolated-permission.https-expected.txt b/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/cross-origin-isolated-permission.https-expected.txt index 166ed23..9ba1e94 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/cross-origin-isolated-permission.https-expected.txt +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-embedder-policy/cross-origin-isolated-permission.https-expected.txt
@@ -22,6 +22,6 @@ PASS shared worker: withCoopCoep = false FAIL shared worker: withCoopCoep = true assert_equals: expected true but got false PASS service worker: withCoopCoep = false -FAIL service worker: withCoopCoep = true assert_equals: expected true but got false +PASS service worker: withCoopCoep = true Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt index 9609f52..0e04c917 100644 --- a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 816 tests; 808 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 822 tests; 813 PASS, 9 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Document: original interface defined @@ -254,6 +254,12 @@ PASS HTMLSlotElement interface: existence and properties of interface object PASS HTMLCanvasElement interface: existence and properties of interface object PASS CanvasRenderingContext2D interface: existence and properties of interface object +PASS CanvasFilter interface: existence and properties of interface object +FAIL CanvasFilter interface object length assert_equals: wrong value for CanvasFilter.length expected 0 but got 1 +PASS CanvasFilter interface object name +PASS CanvasFilter interface: existence and properties of interface prototype object +PASS CanvasFilter interface: existence and properties of interface prototype object's "constructor" property +PASS CanvasFilter interface: existence and properties of interface prototype object's @@unscopables property PASS CanvasGradient interface: existence and properties of interface object PASS CanvasGradient interface object length PASS CanvasGradient interface object name
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size-ref.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size-ref.html new file mode 100644 index 0000000..8b1b422 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size-ref.html
@@ -0,0 +1,8 @@ +<!doctype html> +<title>CSS Test Reference</title> +<select> + <option>ABC</option> +</select> +<select> + <option>ABC</option> +</select>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size.html new file mode 100644 index 0000000..7f36708 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size.html
@@ -0,0 +1,9 @@ +<!doctype html> +<title>Select should be as wide as needed to fit its options regardless of option styles</title> +<link rel=match href=select-intrinsic-option-font-size-ref.html> +<select> + <option style="font-size: 5px">ABC</option> +</select> +<select> + <option style="font-size: 50px">ABC</option> +</select>
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/OES_draw_buffers_indexed.idl b/third_party/blink/web_tests/external/wpt/interfaces/OES_draw_buffers_indexed.idl index 25696f12..bf1932c 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/OES_draw_buffers_indexed.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/OES_draw_buffers_indexed.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: WebGL OES_draw_buffers_indexed Extension Draft Specification (https://www.khronos.org/registry/webgl/extensions/OES_draw_buffers_indexed/) +// Source: WebGL OES_draw_buffers_indexed Extension Specification (https://www.khronos.org/registry/webgl/extensions/OES_draw_buffers_indexed/) [Exposed=(Window,Worker), LegacyNoInterfaceObject] interface OES_draw_buffers_indexed {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/app-history.idl b/third_party/blink/web_tests/external/wpt/interfaces/app-history.idl index b87bb582..f5f1b7e 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/app-history.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/app-history.idl
@@ -121,7 +121,7 @@ [Exposed=Window] interface AppHistoryEntry : EventTarget { - readonly attribute USVString url; + readonly attribute USVString? url; readonly attribute DOMString key; readonly attribute DOMString id; readonly attribute long long index;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/autoplay.idl b/third_party/blink/web_tests/external/wpt/interfaces/autoplay.idl new file mode 100644 index 0000000..f2be5bb --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/autoplay.idl
@@ -0,0 +1,18 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Autoplay Policy Detection (https://w3c.github.io/autoplay/) + +enum AutoplayPolicy { + "allowed", + "allowed-muted", + "disallowed" +}; + +partial interface Document { + readonly attribute AutoplayPolicy autoplayPolicy; +}; + +partial interface HTMLMediaElement { + readonly attribute AutoplayPolicy autoplayPolicy; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/compute-pressure.idl b/third_party/blink/web_tests/external/wpt/interfaces/compute-pressure.idl index 8ea37bf..0cf880b 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/compute-pressure.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/compute-pressure.idl
@@ -4,7 +4,7 @@ // Source: Compute Pressure API (https://wicg.github.io/compute-pressure/) callback ComputePressureUpdateCallback = undefined ( - ComputePressureObserverUpdate update, + ComputePressureEntry update, ComputePressureObserver observer ); @@ -18,7 +18,7 @@ undefined unobserve(); }; -dictionary ComputePressureObserverUpdate { +dictionary ComputePressureEntry { double cpuSpeed; double cpuUtilization; ComputePressureObserverOptions options;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/contact-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/contact-api.idl index 7f67a5d..d7f2ba5d 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/contact-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/contact-api.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: Contact Picker API (https://wicg.github.io/contact-api/spec/) +// Source: Contact Picker API (https://w3c.github.io/contact-api/spec/) [Exposed=Window] partial interface Navigator {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/credential-management.idl b/third_party/blink/web_tests/external/wpt/interfaces/credential-management.idl index a07aa0b..bf1adba 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/credential-management.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/credential-management.idl
@@ -7,6 +7,7 @@ interface Credential { readonly attribute USVString id; readonly attribute DOMString type; + static boolean isConditionalMediationAvailable(); }; [SecureContext] @@ -39,6 +40,7 @@ enum CredentialMediationRequirement { "silent", "optional", + "conditional", "required" };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-cascade-5.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl similarity index 75% rename from third_party/blink/web_tests/external/wpt/interfaces/css-cascade-5.idl rename to third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl index 4166ae6..9011dc7 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-cascade-5.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl
@@ -1,6 +1,8 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) // Source: CSS Cascading and Inheritance Level 5 (https://drafts.csswg.org/css-cascade-5/) -[Exposed=Window] partial interface CSSImportRule { readonly attribute CSSOMString? layerName; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-highlight-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-highlight-api.idl index 56db8c35..f3c6b2e9 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-highlight-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-highlight-api.idl
@@ -3,11 +3,18 @@ // (https://github.com/w3c/webref) // Source: CSS Custom Highlight API Module Level 1 (https://drafts.csswg.org/css-highlight-api-1/) +enum HighlightType { + "highlight", + "spelling-error", + "grammar-error" +}; + [Exposed=Window] interface Highlight { constructor(AbstractRange... initialRanges); setlike<AbstractRange>; attribute long priority; + attribute HighlightType type; }; partial namespace CSS {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-pseudo.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-pseudo.idl index 2c90ff2b..dbe4c54 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-pseudo.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-pseudo.idl
@@ -7,6 +7,8 @@ interface CSSPseudoElement : EventTarget { readonly attribute CSSOMString type; readonly attribute Element element; + readonly attribute (Element or CSSPseudoElement) parent; + CSSPseudoElement? pseudo(CSSOMString type); }; partial interface Element {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-typed-om.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-typed-om.idl index b3942e6b..3a0a6bd 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-typed-om.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-typed-om.idl
@@ -323,7 +323,7 @@ interface CSSColorValue : CSSStyleValue { readonly attribute CSSKeywordValue colorSpace; CSSColorValue to(CSSKeywordish colorSpace); - [Exposed=Window] static CSSColorValue parse(USVString cssText); + [Exposed=Window] static (CSSColorValue or CSSStyleValue) parse(USVString cssText); }; [Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/dom.idl b/third_party/blink/web_tests/external/wpt/interfaces/dom.idl index d3255b4..635072d5 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/dom.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/dom.idl
@@ -97,6 +97,7 @@ readonly attribute boolean aborted; readonly attribute any reason; + undefined throwIfAborted(); attribute EventHandler onabort; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/edit-context.idl b/third_party/blink/web_tests/external/wpt/interfaces/edit-context.idl new file mode 100644 index 0000000..f5e60bd --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/edit-context.idl
@@ -0,0 +1,113 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: EditContext API (https://w3c.github.io/edit-context/) + +partial interface Element { + attribute EditContext? editContext; +}; + +dictionary EditContextInit { + DOMString text; + unsigned long selectionStart; + unsigned long selectionEnd; +}; + +[Exposed=Window] +interface EditContext : EventTarget { + constructor(optional EditContextInit options = {}); + + undefined updateText(unsigned long rangeStart, unsigned long rangeEnd, + DOMString text); + undefined updateSelection(unsigned long start, unsigned long end); + undefined updateControlBound(DOMRect controlBound); + undefined updateSelectionBound(DOMRect selectionBound); + undefined updateCharacterBounds(unsigned long rangeStart, sequence<DOMRect> characterBounds); + + sequence<Element> attachedElements(); + + readonly attribute DOMString text; + readonly attribute unsigned long selectionStart; + readonly attribute unsigned long selectionEnd; + readonly attribute unsigned long compositionRangeStart; + readonly attribute unsigned long compositionRangeEnd; + readonly attribute boolean isInComposition; + readonly attribute DOMRect controlBound; + readonly attribute DOMRect selectionBound; + readonly attribute unsigned long characterBoundsRangeStart; + sequence<DOMRect> characterBounds(); + + attribute EventHandler ontextupdate; + attribute EventHandler ontextformatupdate; + attribute EventHandler oncharacterboundsupdate; + attribute EventHandler oncompositionstart; + attribute EventHandler oncompositionend; +}; + +dictionary TextUpdateEventInit { + unsigned long updateRangeStart; + unsigned long updateRangeEnd; + DOMString text; + unsigned long selectionStart; + unsigned long selectionEnd; + unsigned long compositionStart; + unsigned long compositionEnd; +}; + +[Exposed=Window] +interface TextUpdateEvent : Event { + constructor(optional TextUpdateEventInit options = {}); + readonly attribute unsigned long updateRangeStart; + readonly attribute unsigned long updateRangeEnd; + readonly attribute DOMString text; + readonly attribute unsigned long selectionStart; + readonly attribute unsigned long selectionEnd; + readonly attribute unsigned long compositionStart; + readonly attribute unsigned long compositionEnd; +}; + +dictionary TextFormatInit { + unsigned long rangeStart; + unsigned long rangeEnd; + DOMString textColor; + DOMString backgroundColor; + DOMString underlineStyle; + DOMString underlineThickness; + DOMString underlineColor; +}; + +[Exposed=Window] +interface TextFormat { + constructor(optional TextFormatInit options = {}); + attribute unsigned long rangeStart; + attribute unsigned long rangeEnd; + attribute DOMString textColor; + attribute DOMString backgroundColor; + attribute DOMString underlineStyle; + attribute DOMString underlineThickness; + attribute DOMString underlineColor; +}; + +dictionary TextFormatUpdateEventInit { + sequence<TextFormat> textFormats; +}; + +[Exposed=Window] +interface TextFormatUpdateEvent : Event { + constructor(optional TextFormatUpdateEventInit options = {}); + + sequence<TextFormat> getTextFormats(); +}; + +dictionary CharacterBoundsUpdateEventInit { + unsigned long rangeStart; + unsigned long rangeEnd; +}; + +[Exposed=Window] +interface CharacterBoundsUpdateEvent : Event { + constructor(optional CharacterBoundsUpdateEventInit options = {}); + + readonly attribute unsigned long rangeStart; + readonly attribute unsigned long rangeEnd; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/event-timing.idl b/third_party/blink/web_tests/external/wpt/interfaces/event-timing.idl index 98e8d920f..329570e 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/event-timing.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/event-timing.idl
@@ -19,8 +19,14 @@ }; [Exposed=Window] +interface InteractionCounts { + readonly maplike<DOMString, unsigned long long>; +}; + +[Exposed=Window] partial interface Performance { [SameObject] readonly attribute EventCounts eventCounts; + [SameObject] readonly attribute InteractionCounts interactionCounts; }; partial dictionary PerformanceObserverInit {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/geolocation-API.idl b/third_party/blink/web_tests/external/wpt/interfaces/geolocation.idl similarity index 100% rename from third_party/blink/web_tests/external/wpt/interfaces/geolocation-API.idl rename to third_party/blink/web_tests/external/wpt/interfaces/geolocation.idl
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/html.idl b/third_party/blink/web_tests/external/wpt/interfaces/html.idl index 2b5efa90..2eaf5d0 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/html.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/html.idl
@@ -933,6 +933,8 @@ undefined setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve"); undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); + undefined showPicker(); + // also has obsolete members }; @@ -1367,7 +1369,14 @@ interface mixin CanvasFilters { // filters - attribute DOMString filter; // (default "none") + attribute (DOMString or CanvasFilter) filter; // (default "none") +}; + +typedef record<DOMString, any> CanvasFilterInput; + +[Exposed=(Window,Worker,PaintWorklet)] +interface CanvasFilter { + constructor(optional (CanvasFilterInput or sequence<CanvasFilterInput>) filters); }; interface mixin CanvasRect { @@ -1993,9 +2002,9 @@ // timers long setTimeout(TimerHandler handler, optional long timeout = 0, any... arguments); - undefined clearTimeout(optional long handle = 0); + undefined clearTimeout(optional long id = 0); long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments); - undefined clearInterval(optional long handle = 0); + undefined clearInterval(optional long id = 0); // microtask queuing undefined queueMicrotask(VoidFunction callback);
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/local-font-access.idl b/third_party/blink/web_tests/external/wpt/interfaces/local-font-access.idl index 577cd36..e37b2c7d 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/local-font-access.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/local-font-access.idl
@@ -8,20 +8,18 @@ [SameObject] readonly attribute FontManager fonts; }; Navigator includes NavigatorFonts; -WorkerNavigator includes NavigatorFonts; [SecureContext, - Exposed=(Window,Worker)] + Exposed=Window] interface FontManager { Promise<sequence<FontMetadata>> query(optional QueryOptions options = {}); }; dictionary QueryOptions { - boolean persistentAccess = false; sequence<DOMString> select = []; }; -[Exposed=(Window,Worker)] +[Exposed=Window] interface FontMetadata { Promise<Blob> blob();
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/manifest-incubations.idl b/third_party/blink/web_tests/external/wpt/interfaces/manifest-incubations.idl new file mode 100644 index 0000000..bab3998 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/manifest-incubations.idl
@@ -0,0 +1,24 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Manifest Incubations (https://wicg.github.io/manifest-incubations/) + +[Exposed=Window] +interface BeforeInstallPromptEvent : Event { + constructor(DOMString type, optional EventInit eventInitDict = {}); + Promise<PromptResponseObject> prompt(); +}; + +dictionary PromptResponseObject { + AppBannerPromptOutcome userChoice; +}; + +enum AppBannerPromptOutcome { + "accepted", + "dismissed" +}; + +partial interface Window { + attribute EventHandler onappinstalled; + attribute EventHandler onbeforeinstallprompt; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-streams.idl b/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-streams.idl index 7d51a2a..33511eb 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-streams.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-streams.idl
@@ -238,3 +238,11 @@ typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString; + +dictionary DevicePermissionDescriptor : PermissionDescriptor { + DOMString deviceId; +}; + +dictionary CameraDevicePermissionDescriptor : DevicePermissionDescriptor { + boolean panTiltZoom = false; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-transform.idl b/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-transform.idl new file mode 100644 index 0000000..5b2c8fa6 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-transform.idl
@@ -0,0 +1,23 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: MediaStreamTrack Insertable Media Processing using Streams (https://w3c.github.io/mediacapture-transform/) + +[Exposed=DedicatedWorker] +interface MediaStreamTrackProcessor { + constructor(MediaStreamTrackProcessorInit init); + attribute ReadableStream readable; +}; + +dictionary MediaStreamTrackProcessorInit { + required MediaStreamTrack track; + [EnforceRange] unsigned short maxBufferSize; +}; + +[Exposed=DedicatedWorker] +interface VideoTrackGenerator { + constructor(); + readonly attribute WritableStream writable; + attribute boolean muted; + readonly attribute MediaStreamTrack track; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl b/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl index 3112ef6..3a0f159 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl
@@ -56,11 +56,3 @@ "speaker-selection", "xr-spatial-tracking", }; - -dictionary DevicePermissionDescriptor : PermissionDescriptor { - DOMString deviceId; -}; - -dictionary CameraDevicePermissionDescriptor : DevicePermissionDescriptor { - boolean panTiltZoom = false; -};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/priority-hints.idl b/third_party/blink/web_tests/external/wpt/interfaces/priority-hints.idl new file mode 100644 index 0000000..835b0180 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/interfaces/priority-hints.idl
@@ -0,0 +1,30 @@ +// GENERATED CONTENT - DO NOT EDIT +// Content was automatically extracted by Reffy into webref +// (https://github.com/w3c/webref) +// Source: Priority Hints (https://wicg.github.io/priority-hints/) + +enum Importance { "high", "low", "auto" }; + +partial interface Request { + readonly attribute Importance importance; +}; + +partial dictionary RequestInit { + Importance importance; +}; + +partial interface HTMLImageElement { + [CEReactions] attribute DOMString importance; +}; + +partial interface HTMLLinkElement { + [CEReactions] attribute DOMString importance; +}; + +partial interface HTMLScriptElement { + [CEReactions] attribute DOMString importance; +}; + +partial interface HTMLIFrameElement { + [CEReactions] attribute DOMString importance; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl index b98da2a..8268384 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl
@@ -16,8 +16,11 @@ static SanitizerConfig getDefaultConfiguration(); }; +dictionary SetHTMLOptions { + Sanitizer sanitizer; +}; partial interface Element { - undefined setHTML(DOMString input, Sanitizer sanitizer); + undefined setHTML(DOMString input, optional SetHTMLOptions options = {}); }; dictionary SanitizerConfig {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl b/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl index 0a4416e..1522bff 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: Secure Payment Confirmation (https://w3c.github.io/secure-payment-confirmation) +// Source: Secure Payment Confirmation (https://w3c.github.io/secure-payment-confirmation/) dictionary SecurePaymentConfirmationRequest { required BufferSource challenge;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/streams.idl b/third_party/blink/web_tests/external/wpt/interfaces/streams.idl index 2ebe5b74..f7084dd 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/streams.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/streams.idl
@@ -74,8 +74,8 @@ ReadableStreamDefaultReader includes ReadableStreamGenericReader; dictionary ReadableStreamDefaultReadResult { - any value; - boolean done; + any value; + boolean done; }; [Exposed=(Window,Worker,Worklet)] @@ -88,8 +88,8 @@ ReadableStreamBYOBReader includes ReadableStreamGenericReader; dictionary ReadableStreamBYOBReadResult { - ArrayBufferView value; - boolean done; + ArrayBufferView value; + boolean done; }; [Exposed=(Window,Worker,Worklet)]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/wasm-js-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/wasm-js-api.idl index b56c8cf..141af90 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/wasm-js-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/wasm-js-api.idl
@@ -92,6 +92,7 @@ "i64", "f32", "f64", + "v128", "externref", "anyfunc", };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/web-locks.idl b/third_party/blink/web_tests/external/wpt/interfaces/web-locks.idl index a0319a0..d79e404 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/web-locks.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/web-locks.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: Web Locks API (https://wicg.github.io/web-locks/) +// Source: Web Locks API (https://w3c.github.io/web-locks/) [SecureContext] interface mixin NavigatorLocks {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl b/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl index 3b8be7fd..ff042b0 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl
@@ -51,6 +51,7 @@ Promise<undefined> scan(optional NDEFScanOptions options={}); Promise<undefined> write(NDEFMessageSource message, optional NDEFWriteOptions options={}); + Promise<undefined> makeReadOnly(optional NDEFMakeReadOnlyOptions options={}); }; [SecureContext, Exposed=Window] @@ -71,6 +72,10 @@ AbortSignal? signal; }; +dictionary NDEFMakeReadOnlyOptions { + AbortSignal? signal; +}; + dictionary NDEFScanOptions { AbortSignal signal; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl b/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl index 9214320..2b89760 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: Web Authentication: An API for accessing Public Key Credentials - Level 3 (https://w3c.github.io/webauthn/) +// Source: Web Authentication: An API for accessing Public Key Credentials - Level (https://w3c.github.io/webauthn/) [SecureContext, Exposed=Window] interface PublicKeyCredential : Credential {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl b/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl index c23ba78..6ded86e 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl
@@ -277,13 +277,19 @@ "rgba32sint", "rgba32float", - // Depth and stencil formats + // Depth/stencil formats "stencil8", "depth16unorm", "depth24plus", "depth24plus-stencil8", "depth32float", + // "depth24unorm-stencil8" feature + "depth24unorm-stencil8", + + // "depth32float-stencil8" feature + "depth32float-stencil8", + // BC compressed formats usable if "texture-compression-bc" is both // supported by the device/user agent and enabled in requestDevice. "bc1-rgba-unorm", @@ -344,12 +350,6 @@ "astc-12x10-unorm-srgb", "astc-12x12-unorm", "astc-12x12-unorm-srgb", - - // "depth24unorm-stencil8" feature - "depth24unorm-stencil8", - - // "depth32float-stencil8" feature - "depth32float-stencil8", }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -517,9 +517,14 @@ }; GPUShaderModule includes GPUObjectBase; +dictionary GPUShaderModuleCompilationHint { + required GPUPipelineLayout layout; +}; + dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { required USVString code; object sourceMap; + record<USVString, GPUShaderModuleCompilationHint> hints; }; enum GPUCompilationMessageType { @@ -777,6 +782,9 @@ dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase { }; +interface mixin GPUCommandsMixin { +}; + [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUCommandEncoder { GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); @@ -804,14 +812,10 @@ GPUImageCopyTexture destination, GPUExtent3D copySize); - undefined fillBuffer( - GPUBuffer destination, - GPUSize64 destinationOffset, - GPUSize64 size); - - undefined pushDebugGroup(USVString groupLabel); - undefined popDebugGroup(); - undefined insertDebugMarker(USVString markerLabel); + undefined clearBuffer( + GPUBuffer buffer, + optional GPUSize64 offset = 0, + optional GPUSize64 size); undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex); @@ -825,6 +829,8 @@ GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {}); }; GPUCommandEncoder includes GPUObjectBase; +GPUCommandEncoder includes GPUCommandsMixin; +GPUCommandEncoder includes GPUDebugCommandsMixin; dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { }; @@ -854,6 +860,7 @@ dictionary GPUImageCopyExternalImage { required (ImageBitmap or HTMLCanvasElement or OffscreenCanvas) source; GPUOrigin2D origin = {}; + boolean flipY = false; }; interface mixin GPUProgrammablePassEncoder { @@ -864,7 +871,9 @@ Uint32Array dynamicOffsetsData, GPUSize64 dynamicOffsetsDataStart, GPUSize32 dynamicOffsetsDataLength); +}; +interface mixin GPUDebugCommandsMixin { undefined pushDebugGroup(USVString groupLabel); undefined popDebugGroup(); undefined insertDebugMarker(USVString markerLabel); @@ -879,6 +888,8 @@ undefined endPass(); }; GPUComputePassEncoder includes GPUObjectBase; +GPUComputePassEncoder includes GPUCommandsMixin; +GPUComputePassEncoder includes GPUDebugCommandsMixin; GPUComputePassEncoder includes GPUProgrammablePassEncoder; enum GPUComputePassTimestampLocation { @@ -934,6 +945,8 @@ undefined endPass(); }; GPURenderPassEncoder includes GPUObjectBase; +GPURenderPassEncoder includes GPUCommandsMixin; +GPURenderPassEncoder includes GPUDebugCommandsMixin; GPURenderPassEncoder includes GPUProgrammablePassEncoder; GPURenderPassEncoder includes GPURenderEncoderBase; @@ -1005,6 +1018,8 @@ GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); }; GPURenderBundleEncoder includes GPUObjectBase; +GPURenderBundleEncoder includes GPUCommandsMixin; +GPURenderBundleEncoder includes GPUDebugCommandsMixin; GPURenderBundleEncoder includes GPUProgrammablePassEncoder; GPURenderBundleEncoder includes GPURenderEncoderBase; @@ -1123,7 +1138,7 @@ DOMString type, GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict ); - [SameObject] readonly attribute GPUError error; + readonly attribute GPUError error; }; dictionary GPUUncapturedErrorEventInit : EventInit {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webhid.idl b/third_party/blink/web_tests/external/wpt/interfaces/webhid.idl index d4ce439..997d82c3 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webhid.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webhid.idl
@@ -37,6 +37,7 @@ readonly attribute FrozenArray<HIDCollectionInfo> collections; Promise<undefined> open(); Promise<undefined> close(); + Promise<undefined> forget(); Promise<undefined> sendReport([EnforceRange] octet reportId, BufferSource data); Promise<undefined> sendFeatureReport( [EnforceRange] octet reportId,
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webrtc.idl b/third_party/blink/web_tests/external/wpt/interfaces/webrtc.idl index ff0a4a9..aed8fbb 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webrtc.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webrtc.idl
@@ -4,11 +4,11 @@ // Source: WebRTC 1.0: Real-Time Communication Between Browsers (https://w3c.github.io/webrtc-pc/) dictionary RTCConfiguration { - sequence<RTCIceServer> iceServers; - RTCIceTransportPolicy iceTransportPolicy; - RTCBundlePolicy bundlePolicy; - RTCRtcpMuxPolicy rtcpMuxPolicy; - sequence<RTCCertificate> certificates; + sequence<RTCIceServer> iceServers = []; + RTCIceTransportPolicy iceTransportPolicy = "all"; + RTCBundlePolicy bundlePolicy = "balanced"; + RTCRtcpMuxPolicy rtcpMuxPolicy = "require"; + sequence<RTCCertificate> certificates = []; [EnforceRange] octet iceCandidatePoolSize = 0; }; @@ -247,7 +247,7 @@ }; dictionary RTCCertificateExpiration { - [EnforceRange] EpochTimeStamp expires; + [EnforceRange] unsigned long long expires; }; [Exposed=Window, Serializable]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webtransport.idl b/third_party/blink/web_tests/external/wpt/interfaces/webtransport.idl index f098e47..95ab9e0 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webtransport.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webtransport.idl
@@ -46,8 +46,8 @@ }; dictionary WebTransportCloseInfo { - unsigned long closeCode; - DOMString reason; + unsigned long closeCode = 0; + DOMString reason = ""; }; dictionary WebTransportStats {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/lighting-estimation.idl b/third_party/blink/web_tests/external/wpt/interfaces/webxr-lighting-estimation.idl similarity index 100% rename from third_party/blink/web_tests/external/wpt/interfaces/lighting-estimation.idl rename to third_party/blink/web_tests/external/wpt/interfaces/webxr-lighting-estimation.idl
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/window-controls-overlay.idl b/third_party/blink/web_tests/external/wpt/interfaces/window-controls-overlay.idl index de5e674..051978d6 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/window-controls-overlay.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/window-controls-overlay.idl
@@ -11,18 +11,18 @@ [Exposed=Window] interface WindowControlsOverlay : EventTarget { readonly attribute boolean visible; - DOMRect getBoundingClientRect(); + DOMRect getTitlebarAreaRect(); attribute EventHandler ongeometrychange; }; [Exposed=Window] interface WindowControlsOverlayGeometryChangeEvent : Event { constructor(DOMString type, WindowControlsOverlayGeometryChangeEventInit eventInitDict); - [SameObject] readonly attribute DOMRect boundingRect; + [SameObject] readonly attribute DOMRect titlebarAreaRect; readonly attribute boolean visible; }; dictionary WindowControlsOverlayGeometryChangeEventInit : EventInit { - required DOMRect boundingRect; + required DOMRect titlebarAreaRect; boolean visible = false; };
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-streams/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/mediacapture-streams/idlharness.https.window-expected.txt index 35a2f4c..07cd17d 100644 --- a/third_party/blink/web_tests/external/wpt/mediacapture-streams/idlharness.https.window-expected.txt +++ b/third_party/blink/web_tests/external/wpt/mediacapture-streams/idlharness.https.window-expected.txt
@@ -1,6 +1,5 @@ This is a testharness.js-based test. -Found 190 tests; 184 PASS, 6 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS idl_test setup +FAIL idl_test setup promise_test: Unhandled rejection with value: object "DevicePermissionDescriptor inherits PermissionDescriptor, but PermissionDescriptor is undefined." PASS idl_test validation PASS Partial interface Navigator: original interface defined PASS Partial interface Navigator: member names are unique @@ -16,179 +15,5 @@ PASS Navigator includes NavigatorCookies: member names are unique PASS Navigator includes NavigatorPlugins: member names are unique PASS Navigator includes NavigatorConcurrentHardware: member names are unique -PASS MediaStream interface: existence and properties of interface object -PASS MediaStream interface object length -PASS MediaStream interface object name -PASS MediaStream interface: existence and properties of interface prototype object -PASS MediaStream interface: existence and properties of interface prototype object's "constructor" property -PASS MediaStream interface: existence and properties of interface prototype object's @@unscopables property -PASS MediaStream interface: attribute id -PASS MediaStream interface: operation getAudioTracks() -PASS MediaStream interface: operation getVideoTracks() -PASS MediaStream interface: operation getTracks() -PASS MediaStream interface: operation getTrackById(DOMString) -PASS MediaStream interface: operation addTrack(MediaStreamTrack) -PASS MediaStream interface: operation removeTrack(MediaStreamTrack) -PASS MediaStream interface: operation clone() -PASS MediaStream interface: attribute active -PASS MediaStream interface: attribute onaddtrack -PASS MediaStream interface: attribute onremovetrack -PASS MediaStream must be primary interface of stream -PASS Stringification of stream -PASS MediaStream interface: stream must inherit property "id" with the proper type -PASS MediaStream interface: stream must inherit property "getAudioTracks()" with the proper type -PASS MediaStream interface: stream must inherit property "getVideoTracks()" with the proper type -PASS MediaStream interface: stream must inherit property "getTracks()" with the proper type -PASS MediaStream interface: stream must inherit property "getTrackById(DOMString)" with the proper type -PASS MediaStream interface: calling getTrackById(DOMString) on stream with too few arguments must throw TypeError -PASS MediaStream interface: stream must inherit property "addTrack(MediaStreamTrack)" with the proper type -PASS MediaStream interface: calling addTrack(MediaStreamTrack) on stream with too few arguments must throw TypeError -PASS MediaStream interface: stream must inherit property "removeTrack(MediaStreamTrack)" with the proper type -PASS MediaStream interface: calling removeTrack(MediaStreamTrack) on stream with too few arguments must throw TypeError -PASS MediaStream interface: stream must inherit property "clone()" with the proper type -PASS MediaStream interface: stream must inherit property "active" with the proper type -PASS MediaStream interface: stream must inherit property "onaddtrack" with the proper type -PASS MediaStream interface: stream must inherit property "onremovetrack" with the proper type -PASS MediaStream must be primary interface of new MediaStream() -PASS Stringification of new MediaStream() -PASS MediaStream interface: new MediaStream() must inherit property "id" with the proper type -PASS MediaStream interface: new MediaStream() must inherit property "getAudioTracks()" with the proper type -PASS MediaStream interface: new MediaStream() must inherit property "getVideoTracks()" with the proper type -PASS MediaStream interface: new MediaStream() must inherit property "getTracks()" with the proper type -PASS MediaStream interface: new MediaStream() must inherit property "getTrackById(DOMString)" with the proper type -PASS MediaStream interface: calling getTrackById(DOMString) on new MediaStream() with too few arguments must throw TypeError -PASS MediaStream interface: new MediaStream() must inherit property "addTrack(MediaStreamTrack)" with the proper type -PASS MediaStream interface: calling addTrack(MediaStreamTrack) on new MediaStream() with too few arguments must throw TypeError -PASS MediaStream interface: new MediaStream() must inherit property "removeTrack(MediaStreamTrack)" with the proper type -PASS MediaStream interface: calling removeTrack(MediaStreamTrack) on new MediaStream() with too few arguments must throw TypeError -PASS MediaStream interface: new MediaStream() must inherit property "clone()" with the proper type -PASS MediaStream interface: new MediaStream() must inherit property "active" with the proper type -PASS MediaStream interface: new MediaStream() must inherit property "onaddtrack" with the proper type -PASS MediaStream interface: new MediaStream() must inherit property "onremovetrack" with the proper type -PASS MediaStreamTrack interface: existence and properties of interface object -PASS MediaStreamTrack interface object length -PASS MediaStreamTrack interface object name -PASS MediaStreamTrack interface: existence and properties of interface prototype object -PASS MediaStreamTrack interface: existence and properties of interface prototype object's "constructor" property -PASS MediaStreamTrack interface: existence and properties of interface prototype object's @@unscopables property -PASS MediaStreamTrack interface: attribute kind -PASS MediaStreamTrack interface: attribute id -PASS MediaStreamTrack interface: attribute label -PASS MediaStreamTrack interface: attribute enabled -PASS MediaStreamTrack interface: attribute muted -PASS MediaStreamTrack interface: attribute onmute -PASS MediaStreamTrack interface: attribute onunmute -PASS MediaStreamTrack interface: attribute readyState -PASS MediaStreamTrack interface: attribute onended -PASS MediaStreamTrack interface: operation clone() -PASS MediaStreamTrack interface: operation stop() -PASS MediaStreamTrack interface: operation getCapabilities() -PASS MediaStreamTrack interface: operation getConstraints() -PASS MediaStreamTrack interface: operation getSettings() -PASS MediaStreamTrack interface: operation applyConstraints(optional MediaTrackConstraints) -PASS MediaStreamTrack must be primary interface of track -PASS Stringification of track -PASS MediaStreamTrack interface: track must inherit property "kind" with the proper type -PASS MediaStreamTrack interface: track must inherit property "id" with the proper type -PASS MediaStreamTrack interface: track must inherit property "label" with the proper type -PASS MediaStreamTrack interface: track must inherit property "enabled" with the proper type -PASS MediaStreamTrack interface: track must inherit property "muted" with the proper type -PASS MediaStreamTrack interface: track must inherit property "onmute" with the proper type -PASS MediaStreamTrack interface: track must inherit property "onunmute" with the proper type -PASS MediaStreamTrack interface: track must inherit property "readyState" with the proper type -PASS MediaStreamTrack interface: track must inherit property "onended" with the proper type -PASS MediaStreamTrack interface: track must inherit property "clone()" with the proper type -PASS MediaStreamTrack interface: track must inherit property "stop()" with the proper type -PASS MediaStreamTrack interface: track must inherit property "getCapabilities()" with the proper type -PASS MediaStreamTrack interface: track must inherit property "getConstraints()" with the proper type -PASS MediaStreamTrack interface: track must inherit property "getSettings()" with the proper type -PASS MediaStreamTrack interface: track must inherit property "applyConstraints(optional MediaTrackConstraints)" with the proper type -PASS MediaStreamTrack interface: calling applyConstraints(optional MediaTrackConstraints) on track with too few arguments must throw TypeError -PASS MediaStreamTrackEvent interface: existence and properties of interface object -PASS MediaStreamTrackEvent interface object length -PASS MediaStreamTrackEvent interface object name -PASS MediaStreamTrackEvent interface: existence and properties of interface prototype object -PASS MediaStreamTrackEvent interface: existence and properties of interface prototype object's "constructor" property -PASS MediaStreamTrackEvent interface: existence and properties of interface prototype object's @@unscopables property -PASS MediaStreamTrackEvent interface: attribute track -PASS MediaStreamTrackEvent must be primary interface of trackEvent -PASS Stringification of trackEvent -PASS MediaStreamTrackEvent interface: trackEvent must inherit property "track" with the proper type -FAIL OverconstrainedError interface: existence and properties of interface object assert_equals: prototype of OverconstrainedError is not DOMException expected function "function DOMException() { [native code] }" but got function "function () { [native code] }" -FAIL OverconstrainedError interface object length assert_equals: wrong value for OverconstrainedError.length expected 1 but got 2 -PASS OverconstrainedError interface object name -FAIL OverconstrainedError interface: existence and properties of interface prototype object assert_equals: prototype of OverconstrainedError.prototype is not DOMException.prototype expected [stringifying object threw TypeError: Illegal invocation with type object] but got object "[object Object]" -PASS OverconstrainedError interface: existence and properties of interface prototype object's "constructor" property -PASS OverconstrainedError interface: existence and properties of interface prototype object's @@unscopables property -PASS OverconstrainedError interface: attribute constraint -FAIL OverconstrainedError must be primary interface of new OverconstrainedError("constraint") assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Failed to construct 'OverconstrainedError': 2 arguments required, but only 1 present." -FAIL Stringification of new OverconstrainedError("constraint") assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Failed to construct 'OverconstrainedError': 2 arguments required, but only 1 present." -FAIL OverconstrainedError interface: new OverconstrainedError("constraint") must inherit property "constraint" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Failed to construct 'OverconstrainedError': 2 arguments required, but only 1 present." -PASS MediaDevices interface: existence and properties of interface object -PASS MediaDevices interface object length -PASS MediaDevices interface object name -PASS MediaDevices interface: existence and properties of interface prototype object -PASS MediaDevices interface: existence and properties of interface prototype object's "constructor" property -PASS MediaDevices interface: existence and properties of interface prototype object's @@unscopables property -PASS MediaDevices interface: attribute ondevicechange -PASS MediaDevices interface: operation enumerateDevices() -PASS MediaDevices interface: operation getSupportedConstraints() -PASS MediaDevices interface: operation getUserMedia(optional MediaStreamConstraints) -PASS MediaDevices must be primary interface of navigator.mediaDevices -PASS Stringification of navigator.mediaDevices -PASS MediaDevices interface: navigator.mediaDevices must inherit property "ondevicechange" with the proper type -PASS MediaDevices interface: navigator.mediaDevices must inherit property "enumerateDevices()" with the proper type -PASS MediaDevices interface: navigator.mediaDevices must inherit property "getSupportedConstraints()" with the proper type -PASS MediaDevices interface: navigator.mediaDevices must inherit property "getUserMedia(optional MediaStreamConstraints)" with the proper type -PASS MediaDevices interface: calling getUserMedia(optional MediaStreamConstraints) on navigator.mediaDevices with too few arguments must throw TypeError -PASS MediaDeviceInfo interface: existence and properties of interface object -PASS MediaDeviceInfo interface object length -PASS MediaDeviceInfo interface object name -PASS MediaDeviceInfo interface: existence and properties of interface prototype object -PASS MediaDeviceInfo interface: existence and properties of interface prototype object's "constructor" property -PASS MediaDeviceInfo interface: existence and properties of interface prototype object's @@unscopables property -PASS MediaDeviceInfo interface: attribute deviceId -PASS MediaDeviceInfo interface: attribute kind -PASS MediaDeviceInfo interface: attribute label -PASS MediaDeviceInfo interface: attribute groupId -PASS MediaDeviceInfo interface: operation toJSON() -PASS MediaDeviceInfo must be primary interface of audiooutput -PASS Stringification of audiooutput -PASS MediaDeviceInfo interface: audiooutput must inherit property "deviceId" with the proper type -PASS MediaDeviceInfo interface: audiooutput must inherit property "kind" with the proper type -PASS MediaDeviceInfo interface: audiooutput must inherit property "label" with the proper type -PASS MediaDeviceInfo interface: audiooutput must inherit property "groupId" with the proper type -PASS MediaDeviceInfo interface: audiooutput must inherit property "toJSON()" with the proper type -PASS MediaDeviceInfo interface: default toJSON operation on audiooutput -PASS InputDeviceInfo interface: existence and properties of interface object -PASS InputDeviceInfo interface object length -PASS InputDeviceInfo interface object name -PASS InputDeviceInfo interface: existence and properties of interface prototype object -PASS InputDeviceInfo interface: existence and properties of interface prototype object's "constructor" property -PASS InputDeviceInfo interface: existence and properties of interface prototype object's @@unscopables property -PASS InputDeviceInfo interface: operation getCapabilities() -PASS InputDeviceInfo must be primary interface of audioinput -PASS Stringification of audioinput -PASS InputDeviceInfo interface: audioinput must inherit property "getCapabilities()" with the proper type -PASS MediaDeviceInfo interface: audioinput must inherit property "deviceId" with the proper type -PASS MediaDeviceInfo interface: audioinput must inherit property "kind" with the proper type -PASS MediaDeviceInfo interface: audioinput must inherit property "label" with the proper type -PASS MediaDeviceInfo interface: audioinput must inherit property "groupId" with the proper type -PASS MediaDeviceInfo interface: audioinput must inherit property "toJSON()" with the proper type -PASS MediaDeviceInfo interface: default toJSON operation on audioinput -PASS InputDeviceInfo must be primary interface of videoinput -PASS Stringification of videoinput -PASS InputDeviceInfo interface: videoinput must inherit property "getCapabilities()" with the proper type -PASS MediaDeviceInfo interface: videoinput must inherit property "deviceId" with the proper type -PASS MediaDeviceInfo interface: videoinput must inherit property "kind" with the proper type -PASS MediaDeviceInfo interface: videoinput must inherit property "label" with the proper type -PASS MediaDeviceInfo interface: videoinput must inherit property "groupId" with the proper type -PASS MediaDeviceInfo interface: videoinput must inherit property "toJSON()" with the proper type -PASS MediaDeviceInfo interface: default toJSON operation on videoinput -PASS Navigator interface: attribute mediaDevices -PASS Navigator interface: operation getUserMedia(MediaStreamConstraints, NavigatorUserMediaSuccessCallback, NavigatorUserMediaErrorCallback) -PASS Navigator interface: navigator must inherit property "mediaDevices" with the proper type -PASS Navigator interface: navigator must inherit property "getUserMedia(MediaStreamConstraints, NavigatorUserMediaSuccessCallback, NavigatorUserMediaErrorCallback)" with the proper type -PASS Navigator interface: calling getUserMedia(MediaStreamConstraints, NavigatorUserMediaSuccessCallback, NavigatorUserMediaErrorCallback) on navigator with too few arguments must throw TypeError Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/nextHopProtocol-is-tao-protected.https.html b/third_party/blink/web_tests/external/wpt/resource-timing/nextHopProtocol-is-tao-protected.https.html index e0e96af..b16ff7af 100644 --- a/third_party/blink/web_tests/external/wpt/resource-timing/nextHopProtocol-is-tao-protected.https.html +++ b/third_party/blink/web_tests/external/wpt/resource-timing/nextHopProtocol-is-tao-protected.https.html
@@ -6,33 +6,44 @@ <link rel="help" href="https://www.w3.org/TR/resource-timing-2/#sec-performanceresourcetiming"/> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<script src="/common/custom-cors-response.js"></script> <script src="/common/get-host-info.sub.js"></script> <script src="resources/entry-invariants.js"></script> <script src="resources/resource-loaders.js"></script> +<script src="resources/tao-response.js"></script> </head> <body> <script> const {HTTPS_REMOTE_ORIGIN} = get_host_info(); -const remote_resources = `${HTTPS_REMOTE_ORIGIN}/resource-timing/resources`; -// Add iframe to remote origin - page without TAO -attribute_test( - load.iframe, `${remote_resources}/green.htm`, - entry => assert_equals(entry.nextHopProtocol, "", - "nextHopProtocol should be the empty string"), - "Add TAO-less iframe from remote origin. Make sure nextHopProtocol is the " + - "empty string" -); +const tao_protected_next_hop_test = (loader, item) => { + attribute_test( + loader, custom_cors_response({}, HTTPS_REMOTE_ORIGIN), + entry => assert_equals(entry.nextHopProtocol, "", + "nextHopProtocol should be the empty string."), + `Fetch TAO-less ${item} from remote origin. Make sure nextHopProtocol ` + + "is the empty string." + ); -// Add iframe to remote origin - page with TAO -attribute_test( - load.iframe, `${remote_resources}/blank-with-tao.html`, - entry => assert_not_equals(entry.nextHopProtocol, "", - "nextHopProtocol should not be the empty string"), - "Add TAO'd iframe from remote origin. Make sure nextHopProtocol is not " + - "the empty string" -); + attribute_test( + loader, remote_tao_response('*'), + entry => assert_not_equals(entry.nextHopProtocol, "", + "nextHopProtocol should not be the empty string."), + `Fetch TAO'd ${item} from remote origin. Make sure nextHopProtocol ` + + "is not the empty string." + ); +} + +tao_protected_next_hop_test(load.font, "font"); +tao_protected_next_hop_test(load.iframe, "iframe"); +tao_protected_next_hop_test(load.image, "image"); +tao_protected_next_hop_test(path => load.object(path, "text/plain"), "object"); +tao_protected_next_hop_test(load.script, "script"); +tao_protected_next_hop_test(load.stylesheet, "stylesheet"); +tao_protected_next_hop_test(load.xhr_sync, "synchronous xhr"); +tao_protected_next_hop_test(load.xhr_async, "asynchronous xhr"); + </script> </body> </html>
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/Document-execCommand.tentative.html b/third_party/blink/web_tests/external/wpt/trusted-types/Document-execCommand.tentative.html new file mode 100644 index 0000000..0fd7e64 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/trusted-types/Document-execCommand.tentative.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<link rel="author" title="Daniel Vogelheim" href="mailto:vogelheim@chromium.org"></link> +<link rel="help" href="https://w3c.github.io/webappsec-trusted-types/dist/spec/"></link> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> + // Test that execCommand continues to work if Trusted Types is not enabled. + const commands = [ "insertHTML", "paste" ]; + for (const command of commands) { + test(t => { + document.execCommand(command, false, "<em>Hello World</em>"); + }, `Document.execCommand("${command}") works as usual.`); + } +</script>
diff --git a/third_party/blink/web_tests/external/wpt/trusted-types/block-Document-execCommand.tentative.html b/third_party/blink/web_tests/external/wpt/trusted-types/block-Document-execCommand.tentative.html new file mode 100644 index 0000000..e25b7dd2 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/trusted-types/block-Document-execCommand.tentative.html
@@ -0,0 +1,44 @@ +<!DOCTYPE html> +<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'"> +<link rel="author" title="Daniel Vogelheim" href="mailto:vogelheim@chromium.org"></link> +<link rel="help" href="https://w3c.github.io/webappsec-trusted-types/dist/spec/"></link> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> + // Tests that certain execCommand commands will observe Trusted Types if + // it's enforced. + const commands = [ "insertHTML", "paste" ]; + const tt_commands = [ "insertHTML" ]; + + // A pass-through policy for testing. + const a_policy = trustedTypes.createPolicy("a policy", {"createHTML": x => x}); + + for (const command of commands) { + const requires_tt = tt_commands.includes(command); + + // Test that execCommand with String throws, but only for commands that + // require TT. + if (requires_tt) { + test(t => { + assert_throws_js(TypeError, _ => document.execCommand(command, false, "<em>Hello World</em>")); + }, `Document.execCommand("${command}") throws.`); + } else { + test(t => { + document.execCommand(command, false, "<em>Hello World</em>"); + }, `Document.execCommand("${command}") works as usual."`); + } + // Test that execCommand succeeds with a TrustedHTML argument. + test(t => { + document.execCommand(command, false, a_policy.createHTML("<em>Hello World</em>")); + }, `Document.execCommand("${command}") works with a TrustedHTML argument.`); + } + + // Test that with a default policy, all comamnds will work again. + trustedTypes.createPolicy("default", {"createHTML": x => x}); + for (const command of commands) { + test(t => { + document.execCommand(command, false, "<em>Hello World</em>"); + }, `Document.execCommand("${command}") works as usual with a default policy.`); + } +</script>
diff --git a/third_party/blink/web_tests/external/wpt/visual-viewport/viewport-resize-event-on-iframe-show.html b/third_party/blink/web_tests/external/wpt/visual-viewport/viewport-resize-event-on-iframe-show.html new file mode 100644 index 0000000..688148a8 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/visual-viewport/viewport-resize-event-on-iframe-show.html
@@ -0,0 +1,43 @@ +<!doctype html> +<html> + <head> + <title>Viewport: Resize Event On Showing Iframe</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, minimum-scale=1"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script> + async_test(t => { + document.addEventListener("DOMContentLoaded", () => { + let iframe = document.querySelector("iframe"); + onload = () => { + requestAnimationFrame(() => { requestAnimationFrame(() => { + // First full rendering update is complete. + let resize_event_count = 0; + iframe.contentWindow.visualViewport.addEventListener("resize", () => { + resize_event_count++; + }); + iframe.style.display = ""; + iframe.clientWidth; + requestAnimationFrame(() => { + t.step(() => { + assert_equals(resize_event_count, 1); + t.done(); + }); + }) }); // 2x requestAnimationFrame + }) + }; + }); + }, "Resize event fired when an iframe is shown."); + </script> + </head> + <body> + <h1>Viewport: Resize Event On Iframe Size Change</h1> + <h4> + Test Description: This test ensures that we fire a resize event when + an iframe is shown. + </h4> + <iframe style="display: none;" srcdoc="<p>Hello, world!</p>"></iframe> + <div id="log"></div> + </body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/defaults.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/defaults.py deleted file mode 100644 index 8dd171a..0000000 --- a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/defaults.py +++ /dev/null
@@ -1,9 +0,0 @@ -SCRIPT_TIMEOUT = 30 -PAGE_LOAD_TIMEOUT = 300 -IMPLICIT_WAIT_TIMEOUT = 0 - -WINDOW_POSITION = (100, 100) -WINDOW_SIZE = (800, 600) - -DRIVER_HOST = '127.0.0.1' -DRIVER_PORT = 4444
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py deleted file mode 100644 index cb98ccb..0000000 --- a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py +++ /dev/null
@@ -1,226 +0,0 @@ -import copy -import json -import os - -import asyncio -import pytest -import webdriver - -from urllib.parse import urlunsplit - -from tests.support import defaults -from tests.support.helpers import cleanup_session, deep_update -from tests.support.inline import build_inline -from tests.support.http_request import HTTPRequest - - -# The webdriver session can outlive a pytest session -_current_session = None - -# The event loop needs to outlive the webdriver session -_event_loop = None - -_custom_session = False - - -def pytest_configure(config): - # register the capabilities marker - config.addinivalue_line( - "markers", - "capabilities: mark test to use capabilities" - ) - - -@pytest.fixture -def capabilities(): - """Default capabilities to use for a new WebDriver session.""" - return {} - - -def pytest_generate_tests(metafunc): - if "capabilities" in metafunc.fixturenames: - marker = metafunc.definition.get_closest_marker(name="capabilities") - if marker: - metafunc.parametrize("capabilities", marker.args, ids=None) - - -@pytest.fixture(scope="session") -def event_loop(): - """Change event_loop fixture to global.""" - global _event_loop - - if _event_loop is None: - _event_loop = asyncio.get_event_loop_policy().new_event_loop() - return _event_loop - - -@pytest.fixture -def http(configuration): - return HTTPRequest(configuration["host"], configuration["port"]) - - -@pytest.fixture -def server_config(): - with open(os.environ.get("WD_SERVER_CONFIG_FILE"), "r") as f: - return json.load(f) - - -@pytest.fixture(scope="session") -def configuration(): - host = os.environ.get("WD_HOST", defaults.DRIVER_HOST) - port = int(os.environ.get("WD_PORT", str(defaults.DRIVER_PORT))) - capabilities = json.loads(os.environ.get("WD_CAPABILITIES", "{}")) - - return { - "host": host, - "port": port, - "capabilities": capabilities - } - - -async def reset_current_session_if_necessary(caps): - global _current_session - - # If there is a session with different requested capabilities active than - # the one we would like to create, end it now. - if _current_session is not None: - if not _current_session.match(caps): - is_bidi = isinstance(_current_session, webdriver.BidiSession) - if is_bidi: - await _current_session.end() - else: - _current_session.end() - _current_session = None - - -@pytest.fixture(scope="function") -async def session(capabilities, configuration): - """Create and start a session for a test that does not itself test session creation. - - By default the session will stay open after each test, but we always try to start a - new one and assume that if that fails there is already a valid session. This makes it - possible to recover from some errors that might leave the session in a bad state, but - does not demand that we start a new session per test. - """ - global _current_session - - # Update configuration capabilities with custom ones from the - # capabilities fixture, which can be set by tests - caps = copy.deepcopy(configuration["capabilities"]) - deep_update(caps, capabilities) - caps = {"alwaysMatch": caps} - - await reset_current_session_if_necessary(caps) - - if _current_session is None: - _current_session = webdriver.Session( - configuration["host"], - configuration["port"], - capabilities=caps) - - _current_session.start() - - # Enforce a fixed default window size and position - if _current_session.capabilities.get("setWindowRect"): - _current_session.window.size = defaults.WINDOW_SIZE - _current_session.window.position = defaults.WINDOW_POSITION - - yield _current_session - - cleanup_session(_current_session) - - -@pytest.fixture(scope="function") -async def bidi_session(capabilities, configuration): - """Create and start a bidi session. - - Can be used for a test that does not itself test bidi session creation. - - By default the session will stay open after each test, but we always try to start a - new one and assume that if that fails there is already a valid session. This makes it - possible to recover from some errors that might leave the session in a bad state, but - does not demand that we start a new session per test. - """ - global _current_session - - # Update configuration capabilities with custom ones from the - # capabilities fixture, which can be set by tests - caps = copy.deepcopy(configuration["capabilities"]) - caps.update({"webSocketUrl": True}) - deep_update(caps, capabilities) - caps = {"alwaysMatch": caps} - - await reset_current_session_if_necessary(caps) - - if _current_session is None: - _current_session = webdriver.Session( - configuration["host"], - configuration["port"], - capabilities=caps, - enable_bidi=True) - - _current_session.start() - await _current_session.bidi_session.start() - - # Enforce a fixed default window size and position - if _current_session.capabilities.get("setWindowRect"): - _current_session.window.size = defaults.WINDOW_SIZE - _current_session.window.position = defaults.WINDOW_POSITION - - yield _current_session.bidi_session - - await _current_session.bidi_session.end() - cleanup_session(_current_session) - - -@pytest.fixture(scope="function") -def current_session(): - return _current_session - - -@pytest.fixture -def url(server_config): - def url(path, protocol="http", domain="", subdomain="", query="", fragment=""): - domain = server_config["domains"][domain][subdomain] - port = server_config["ports"][protocol][0] - host = "{0}:{1}".format(domain, port) - return urlunsplit((protocol, host, path, query, fragment)) - - return url - - -@pytest.fixture -def inline(url): - """Take a source extract and produces well-formed documents. - - Based on the desired document type, the extract is embedded with - predefined boilerplate in order to produce well-formed documents. - The media type and character set may also be individually configured. - - This helper function originally used data URLs, but since these - are not universally supported (or indeed standardised!) across - browsers, it now delegates the serving of the document to wptserve. - This file also acts as a wptserve handler (see the main function - below) which configures the HTTP response using query parameters. - - This function returns a URL to the wptserve handler, which in turn - will serve an HTTP response with the requested source extract - inlined in a well-formed document, and the Content-Type header - optionally configured using the desired media type and character set. - - Any additional keyword arguments are passed on to the build_url - function, which comes from the url fixture. - """ - def inline(src, **kwargs): - return build_inline(url, src, **kwargs) - - return inline - - -@pytest.fixture -def iframe(inline): - """Inline document extract as the source document of an <iframe>.""" - def iframe(src, **kwargs): - return "<iframe src='{}'></iframe>".format(inline(src, **kwargs)) - - return iframe
diff --git a/third_party/blink/web_tests/external/wpt/webhid/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/webhid/idlharness.https.window-expected.txt index 6ed0916..7b3f1ae7 100644 --- a/third_party/blink/web_tests/external/wpt/webhid/idlharness.https.window-expected.txt +++ b/third_party/blink/web_tests/external/wpt/webhid/idlharness.https.window-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 64 tests; 63 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 65 tests; 64 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Navigator: original interface defined @@ -43,6 +43,7 @@ PASS HIDDevice interface: attribute collections PASS HIDDevice interface: operation open() PASS HIDDevice interface: operation close() +PASS HIDDevice interface: operation forget() PASS HIDDevice interface: operation sendReport(octet, BufferSource) PASS HIDDevice interface: operation sendFeatureReport(octet, BufferSource) PASS HIDDevice interface: operation receiveFeatureReport(octet)
diff --git a/third_party/blink/web_tests/fast/css/text-align-pre-wrap-trailing-spaces-expected.html b/third_party/blink/web_tests/fast/css/text-align-pre-wrap-trailing-spaces-expected.html index bbbf3d59..77d2d99 100644 --- a/third_party/blink/web_tests/fast/css/text-align-pre-wrap-trailing-spaces-expected.html +++ b/third_party/blink/web_tests/fast/css/text-align-pre-wrap-trailing-spaces-expected.html
@@ -6,6 +6,7 @@ div { white-space: pre-wrap; text-decoration: underline; + font-family: monospace; font-size: 20px; width: 15ch; height: 3em;
diff --git a/third_party/blink/web_tests/fast/css/text-align-pre-wrap-trailing-spaces.html b/third_party/blink/web_tests/fast/css/text-align-pre-wrap-trailing-spaces.html index a9067ab..18d6ebf 100644 --- a/third_party/blink/web_tests/fast/css/text-align-pre-wrap-trailing-spaces.html +++ b/third_party/blink/web_tests/fast/css/text-align-pre-wrap-trailing-spaces.html
@@ -6,6 +6,7 @@ div { white-space: pre-wrap; text-decoration: underline; + font-family: monospace; font-size: 20px; width: 15ch; height: 3em;
diff --git a/third_party/blink/web_tests/http/tests/preload/preload-video-cors.html b/third_party/blink/web_tests/http/tests/preload/preload-video-cors.html index b424b54..5c4e0551 100644 --- a/third_party/blink/web_tests/http/tests/preload/preload-video-cors.html +++ b/third_party/blink/web_tests/http/tests/preload/preload-video-cors.html
@@ -4,24 +4,24 @@ <script> const t = async_test("Ensure preloads use video poster crossorigin value"); window.addEventListener('load', t.step_func_done(function() { - let entries = performance.getEntriesByName("http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square100.png&allow=false"); + let entries = performance.getEntriesByName("http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square100.png&allow=false&tao=*"); assert_equals(entries.length, 1, "100.png should get an entry"); assert_equals(entries[0].nextHopProtocol, '', "100.png should not be loaded"); - entries = performance.getEntriesByName("http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square200.png&allow=true"); + entries = performance.getEntriesByName("http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square200.png&allow=true&tao=*"); assert_equals(entries.length, 1, "200.png should load successfully once, as the server is using Access-Control-Allow-Origin: *"); - assert_not_equals(entries[0].nextHopProtocol, '', "100.png should not be loaded"); + assert_not_equals(entries[0].nextHopProtocol, '', "200.png should be loaded"); - entries = performance.getEntriesByName("http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square20.png&allow=false"); + entries = performance.getEntriesByName("http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square20.png&allow=false&tao=*"); assert_equals(entries.length, 1, "20.png should load successfully once, as it is loaded with no-cors"); - assert_not_equals(entries[0].nextHopProtocol, '', "100.png should not be loaded"); + assert_not_equals(entries[0].nextHopProtocol, '', "20.png should be loaded"); })); </script> -<video poster="http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square100.png&allow=false" crossorigin> +<video poster="http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square100.png&allow=false&tao=*" crossorigin> </video> -<video poster="http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square200.png&allow=true" crossorigin> +<video poster="http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square200.png&allow=true&tao=*" crossorigin> </video> -<video poster="http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square20.png&allow=false"> +<video poster="http://localhost:8080/security/resources/image-access-control.php?file=../../resources/square20.png&allow=false&tao=*"> </video>
diff --git a/third_party/blink/web_tests/http/tests/security/resources/image-access-control.php b/third_party/blink/web_tests/http/tests/security/resources/image-access-control.php index 27919da5..d31a538 100644 --- a/third_party/blink/web_tests/http/tests/security/resources/image-access-control.php +++ b/third_party/blink/web_tests/http/tests/security/resources/image-access-control.php
@@ -4,6 +4,10 @@ header("Access-Control-Allow-Origin: *"); } +if (array_key_exists('tao', $_GET)) { + header("Timing-Allow-Origin: " . $_GET['tao']); +} + $file = $_GET['file']; $fp = fopen($file, 'rb'); header("Content-Type: image/png");
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/external/wpt/webhid/idlharness.https.window-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.12/external/wpt/webhid/idlharness.https.window-expected.txt deleted file mode 100644 index 0c5ed83..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/external/wpt/webhid/idlharness.https.window-expected.txt +++ /dev/null
@@ -1,68 +0,0 @@ -This is a testharness.js-based test. -Found 64 tests; 63 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS idl_test setup -PASS idl_test validation -PASS Partial interface Navigator: original interface defined -PASS Partial interface Navigator: member names are unique -PASS Partial interface mixin NavigatorID: member names are unique -PASS Navigator includes NavigatorID: member names are unique -PASS Navigator includes NavigatorLanguage: member names are unique -PASS Navigator includes NavigatorOnLine: member names are unique -PASS Navigator includes NavigatorContentUtils: member names are unique -PASS Navigator includes NavigatorCookies: member names are unique -PASS Navigator includes NavigatorPlugins: member names are unique -PASS Navigator includes NavigatorConcurrentHardware: member names are unique -PASS HID interface: existence and properties of interface object -PASS HID interface object length -PASS HID interface object name -PASS HID interface: existence and properties of interface prototype object -PASS HID interface: existence and properties of interface prototype object's "constructor" property -PASS HID interface: existence and properties of interface prototype object's @@unscopables property -PASS HID interface: attribute onconnect -PASS HID interface: attribute ondisconnect -PASS HID interface: operation getDevices() -PASS HID interface: operation requestDevice(HIDDeviceRequestOptions) -PASS HID must be primary interface of navigator.hid -PASS Stringification of navigator.hid -PASS HID interface: navigator.hid must inherit property "onconnect" with the proper type -PASS HID interface: navigator.hid must inherit property "ondisconnect" with the proper type -PASS HID interface: navigator.hid must inherit property "getDevices()" with the proper type -PASS HID interface: navigator.hid must inherit property "requestDevice(HIDDeviceRequestOptions)" with the proper type -PASS HID interface: calling requestDevice(HIDDeviceRequestOptions) on navigator.hid with too few arguments must throw TypeError -PASS HIDConnectionEvent interface: existence and properties of interface object -PASS HIDConnectionEvent interface object length -PASS HIDConnectionEvent interface object name -PASS HIDConnectionEvent interface: existence and properties of interface prototype object -PASS HIDConnectionEvent interface: existence and properties of interface prototype object's "constructor" property -PASS HIDConnectionEvent interface: existence and properties of interface prototype object's @@unscopables property -PASS HIDConnectionEvent interface: attribute device -PASS HIDInputReportEvent interface: existence and properties of interface object -FAIL HIDInputReportEvent interface object length assert_equals: wrong value for HIDInputReportEvent.length expected 2 but got 0 -PASS HIDInputReportEvent interface object name -PASS HIDInputReportEvent interface: existence and properties of interface prototype object -PASS HIDInputReportEvent interface: existence and properties of interface prototype object's "constructor" property -PASS HIDInputReportEvent interface: existence and properties of interface prototype object's @@unscopables property -PASS HIDInputReportEvent interface: attribute device -PASS HIDInputReportEvent interface: attribute reportId -PASS HIDInputReportEvent interface: attribute data -PASS HIDDevice interface: existence and properties of interface object -PASS HIDDevice interface object length -PASS HIDDevice interface object name -PASS HIDDevice interface: existence and properties of interface prototype object -PASS HIDDevice interface: existence and properties of interface prototype object's "constructor" property -PASS HIDDevice interface: existence and properties of interface prototype object's @@unscopables property -PASS HIDDevice interface: attribute oninputreport -PASS HIDDevice interface: attribute opened -PASS HIDDevice interface: attribute vendorId -PASS HIDDevice interface: attribute productId -PASS HIDDevice interface: attribute productName -PASS HIDDevice interface: attribute collections -PASS HIDDevice interface: operation open() -PASS HIDDevice interface: operation close() -PASS HIDDevice interface: operation sendReport(octet, BufferSource) -PASS HIDDevice interface: operation sendFeatureReport(octet, BufferSource) -PASS HIDDevice interface: operation receiveFeatureReport(octet) -PASS Navigator interface: attribute hid -PASS Navigator interface: navigator must inherit property "hid" with the proper type -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/idlharness-expected.txt b/third_party/blink/web_tests/virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/idlharness-expected.txt new file mode 100644 index 0000000..f76169b --- /dev/null +++ b/third_party/blink/web_tests/virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/idlharness-expected.txt
@@ -0,0 +1,29 @@ +This is a testharness.js-based test. +FAIL idl_test setup promise_test: Unhandled rejection with value: object "TypeError: window.getPseudoElements is not a function" +PASS idl_test validation +PASS Partial interface Element: original interface defined +PASS Partial interface Element: member names are unique +PASS Element includes ParentNode: member names are unique +PASS Element includes NonDocumentTypeChildNode: member names are unique +PASS Element includes ChildNode: member names are unique +PASS Element includes Slottable: member names are unique +FAIL CSSPseudoElement interface: existence and properties of interface object assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface object length assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface object name assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface: attribute type assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface: attribute element assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface: attribute parent assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement interface: operation pseudo(CSSOMString) assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing +FAIL CSSPseudoElement must be primary interface of beforeElements.item(0) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL Stringification of beforeElements.item(0) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "element" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "parent" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "pseudo(CSSOMString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL CSSPseudoElement interface: calling pseudo(CSSOMString) on beforeElements.item(0) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" +FAIL Element interface: operation pseudo(CSSOMString) assert_own_property: interface prototype object missing non-static operation expected property "pseudo" missing +Harness: the test ran to completion. +
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 24f95f5..e06b32d 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -498,10 +498,10 @@ }, 'chromium.linux': { - 'Cast Audio Linux': 'cast_audio_release_bot', - 'Cast Linux': 'cast_release_bot', - 'Cast Linux Debug': 'cast_debug_bot', - 'Cast Linux ARM64': 'cast_arm64_release_bot', + 'Cast Audio Linux': 'cast_audio_release_bot_reclient', + 'Cast Linux': 'cast_release_bot_reclient', + 'Cast Linux Debug': 'cast_debug_bot_reclient', + 'Cast Linux ARM64': 'cast_arm64_release_bot_reclient', 'Deterministic Fuchsia (dbg)': 'debug_bot_fuchsia', 'Deterministic Linux (dbg)': { 'local': 'debug_bot_local_build', @@ -1743,8 +1743,8 @@ # Cast Linux takes very long in linking, possibly due to being on GCE # (crbug/794423). - 'cast_release_bot': [ - 'cast', 'release_bot', 'minimal_symbols', + 'cast_release_bot_reclient': [ + 'cast', 'release_bot_reclient', 'minimal_symbols', ], 'cast_release_trybot': [ @@ -1755,16 +1755,24 @@ 'cast', 'debug_bot', ], + 'cast_debug_bot_reclient': [ + 'cast', 'debug_bot_reclient', + ], + 'cast_arm64_release_bot': [ 'cast', 'release_bot', 'arm64', 'minimal_symbols', ], + 'cast_arm64_release_bot_reclient': [ + 'cast', 'release_bot_reclient', 'arm64', 'minimal_symbols', + ], + 'cast_binary_size': [ 'cast', 'minimal_symbols', 'release_bot', ], - 'cast_audio_release_bot': [ - 'cast', 'cast_audio', 'release_bot', 'minimal_symbols', + 'cast_audio_release_bot_reclient': [ + 'cast', 'cast_audio', 'release_bot_reclient', 'minimal_symbols', ], 'cast_audio_release_trybot': [
diff --git a/tools/mb/mb_config_expectations/chromium.linux.json b/tools/mb/mb_config_expectations/chromium.linux.json index e522f4d..747458f4 100644 --- a/tools/mb/mb_config_expectations/chromium.linux.json +++ b/tools/mb/mb_config_expectations/chromium.linux.json
@@ -7,7 +7,8 @@ "is_component_build": false, "is_debug": false, "symbol_level": 1, - "use_goma": true + "use_rbe": true, + "use_remoteexec": true } }, "Cast Linux": { @@ -17,7 +18,8 @@ "is_component_build": false, "is_debug": false, "symbol_level": 1, - "use_goma": true + "use_rbe": true, + "use_remoteexec": true } }, "Cast Linux ARM64": { @@ -28,7 +30,8 @@ "is_debug": false, "symbol_level": 1, "target_cpu": "arm64", - "use_goma": true + "use_rbe": true, + "use_remoteexec": true } }, "Cast Linux Debug": { @@ -37,7 +40,8 @@ "is_component_build": true, "is_debug": true, "symbol_level": 1, - "use_goma": true + "use_rbe": true, + "use_remoteexec": true } }, "Deterministic Fuchsia (dbg)": {
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 4357c5c..8f74977c 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -79245,6 +79245,7 @@ <int value="7" label="FeatureAggregationNotFound"/> <int value="8" label="FeatureTensorLengthInvalid"/> <int value="9" label="FeatureNameHashDoesNotMatchName"/> + <int value="10" label="VersionNotSupported"/> </enum> <enum name="SegmentationSelectionFailureReason">
diff --git a/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS b/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS index 673338145..1ec57905 100644 --- a/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS +++ b/tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS
@@ -5,7 +5,6 @@ altimin@chromium.org andypaicu@chromium.org anise@chromium.org -asanka@chromium.org awscreen@chromium.org ayui@chromium.org bingler@chromium.org
diff --git a/tools/metrics/histograms/metadata/android/histograms.xml b/tools/metrics/histograms/metadata/android/histograms.xml index 3dcc20d..b38a414c 100644 --- a/tools/metrics/histograms/metadata/android/histograms.xml +++ b/tools/metrics/histograms/metadata/android/histograms.xml
@@ -3723,13 +3723,13 @@ </histogram> <histogram name="Android.WebView.SingleOrMultiProcess" - enum="AndroidWebViewSingleOrMultiProcess" expires_after="2022-01-22"> + enum="AndroidWebViewSingleOrMultiProcess" expires_after="2022-07-22"> <owner>alexmitra@chromium.org</owner> <owner>nator@chromium.org</owner> <owner>src/android_webview/OWNERS</owner> <summary> Records whether WebView is being run in a single process or multi-process. - This is recorded when WebView starts. + This is recorded each time logs are uploaded. </summary> </histogram>
diff --git a/tools/metrics/histograms/metadata/apps/histograms.xml b/tools/metrics/histograms/metadata/apps/histograms.xml index 3ec15d0..9f4d9c9 100644 --- a/tools/metrics/histograms/metadata/apps/histograms.xml +++ b/tools/metrics/histograms/metadata/apps/histograms.xml
@@ -22,24 +22,6 @@ <histograms> -<variants name="App"> - <variant name="Contacts" summary="Contacts"> - <obsolete> - Removed October 2021. - </obsolete> - </variant> - <variant name="FileManager" summary="FileManager"> - <obsolete> - Removed October 2021. - </obsolete> - </variant> - <variant name="PlayStore" summary="PlayStore"> - <obsolete> - Removed October 2021. - </obsolete> - </variant> -</variants> - <variants name="AppType"> <variant name="Arc" summary="Android apps"/> <variant name="Borealis" summary="Borealis apps"/> @@ -124,16 +106,6 @@ <variant name="User" summary="Installed by user"/> </variants> -<variants name="InstallSource"> - <variant name="Oem" summary="Installed by an OEM"/> - <variant name="Policy" summary="Installed by policy"/> - <variant name="Preload" summary="Preinstalled by default"/> - <variant name="Sync" summary="Installed by sync"/> - <variant name="System" summary="Installed with the system"/> - <variant name="Unknown" summary="Installed with unknown source"/> - <variant name="User" summary="Installed by user"/> -</variants> - <variants name="LauncherUISurface"> <variant name=".AppsSearch" summary="App tiles search"/> <variant name=".AppsZeroState" summary="App tiles zero-state"/> @@ -150,31 +122,6 @@ <variant name=".WriteItem" summary=""/> </variants> -<variants name="RestoreAction"> - <variant name="CloseByUser" - summary="The full restore notfication is closed by user"> - <obsolete> - Removed October 2021. - </obsolete> - </variant> - <variant name="CloseNotByUser" - summary="The full restore notfication is not closed by user"> - <obsolete> - Removed October 2021. - </obsolete> - </variant> - <variant name="NotRestore" summary="No thanks is clicked"> - <obsolete> - Removed October 2021. - </obsolete> - </variant> - <variant name="Restore" summary="Restore is clicked"> - <obsolete> - Removed October 2021. - </obsolete> - </variant> -</variants> - <variants name="SearchAction"> <variant name="Abandon" summary="abandon"/> <variant name="Ignore" summary="ignore"/> @@ -248,43 +195,6 @@ </summary> </histogram> -<histogram name="Apps.AppInfoDialog.Launches" enum="AppInfoDialogLaunchOrigin" - expires_after="M77"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>sashab@chromium.org</owner> - <summary> - The number of times the app info dialog is launched. This is gathered each - time the app info dialog is opened, from each of the places the dialog can - be opened from. - </summary> -</histogram> - -<histogram name="Apps.AppInfoDialog.OpenedForLocation" enum="AppLocation" - expires_after="M85"> - <obsolete> - Removed September 2016. Recorded as Apps.AppInfoDialogOpenedForLocation? - </obsolete> - <owner>sashab@chromium.org</owner> - <summary> - The location of the app that the dialog was opened for. This is gathered - each time the app info dialog is opened. - </summary> -</histogram> - -<histogram name="Apps.AppInfoDialog.OpenedForType" enum="ExtensionType" - expires_after="M85"> - <obsolete> - Removed September 2016. Recorded as Apps.AppInfoDialogOpenedForType? - </obsolete> - <owner>sashab@chromium.org</owner> - <summary> - The type of the app that the dialog was opened for. This is gathered each - time the app info dialog is opened. - </summary> -</histogram> - <histogram name="Apps.AppLaunch" enum="AppLaunch" expires_after="2022-06-30"> <owner>tapted@chromium.org</owner> <owner>benwells@chromium.org</owner> @@ -434,126 +344,6 @@ </token> </histogram> -<histogram name="Apps.AppList.DriveQuickAccessProvider.ApiResults" - units="count" expires_after="2021-03-15"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>wrong@chromium.org</owner> - <summary> - The number of results returned from a call to the Drive QuickAccess API. - Only reported if the API call did not error. - </summary> -</histogram> - -<histogram name="Apps.AppList.DriveQuickAccessProvider.CacheEmpty" - enum="BooleanEmpty" expires_after="2021-04-11"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>wrong@chromium.org</owner> - <summary> - Whether or not the results cache is empty. An empty cache means either poor - network conditions, the user opening zero-state very quickly, or an API - error. - </summary> -</histogram> - -<histogram name="Apps.AppList.DriveQuickAccessProvider.CacheWarmed" - units="Boolean" expires_after="2021-03-28"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>wrong@chromium.org</owner> - <summary> - Whether or not the cache of Drive file results has already been warmed with - a request to ItemSuggest. Emitted each time we decide whether to warm the - cache, ie. each time Drive FS is mounted. - </summary> -</histogram> - -<histogram name="Apps.AppList.DriveQuickAccessProvider.DriveFSMounted" - enum="Boolean" expires_after="2021-04-11"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>wrong@chromium.org</owner> - <summary> - Whether or not DriveFS is mounted on a call to - DriveQuickAccessProvider::Start or ::GetQuickAccessItems. - </summary> -</histogram> - -<histogram name="Apps.AppList.DriveQuickAccessProvider.FileError" - enum="DriveFileError" expires_after="2021-04-11"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>wrong@chromium.org</owner> - <summary> - The error code returned from a call to the Drive QuickAccess API. - </summary> -</histogram> - -<histogram - name="Apps.AppList.DriveQuickAccessProvider.GetQuickAccessItemsLatency" - units="ms" expires_after="2021-03-15"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - The time between when GetQuickAccessItems was last called, and receiving - Drive QuickAccess results back. Only reported if the API call did not error. - </summary> -</histogram> - -<histogram name="Apps.AppList.DriveQuickAccessProvider.Latency" units="ms" - expires_after="2021-03-15"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - The time between sending a zero state query and receiving file - recommendations back from the DriveQuickAccessProvider. - </summary> -</histogram> - -<histogram - name="Apps.AppList.DriveQuickAccessProvider.TimeFromFetchToZeroStateStart" - units="ms" expires_after="2021-03-15"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - The time between when GetQuickAccessItems was last called, and the user - entering zero state search. - </summary> -</histogram> - -<histogram name="Apps.AppList.DriveQuickAccessProvider.ValidResults" - units="count" expires_after="2021-04-04"> - <obsolete> - Removed February 2021. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>wrong@chromium.org</owner> - <summary> - Counts how many results from one call to the QuickAccess API exist in the - DriveFS mount and are OK for display. - </summary> -</histogram> - <histogram name="Apps.AppList.DriveSearchProvider.Latency" units="ms" expires_after="2022-11-30"> <owner>wrong@chromium.org</owner> @@ -854,50 +644,6 @@ </summary> </histogram> -<histogram name="Apps.AppList.ScoreNormalizer.L2ErrorDecreased" enum="Boolean" - expires_after="2022-01-31"> - <obsolete> - Removed October 2021. - </obsolete> - <owner>adafang@google.com</owner> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - Whether or not splitting and merging bins is less than or equal to the old - L2 error of bin counts. Logged after each search result is recorded. - </summary> -</histogram> - -<histogram name="Apps.AppList.ScoreNormalizer.ReadPrefsError" - enum="BooleanError" expires_after="2022-01-31"> - <obsolete> - Removed October 2021. - </obsolete> - <owner>adafang@google.com</owner> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - Whether or not dividers and/or counts from read prefs is empty. A empty - dividers or counts means one of the values in the vector was not saved - properly as a double. Logged when the ScoreNormalizer is initialized, which - is when ReadPrefs is called. - </summary> -</histogram> - -<histogram name="Apps.AppList.ScoreNormalizer.SearchResultsCount" units="count" - expires_after="2022-01-31"> - <obsolete> - Removed October 2021. - </obsolete> - <owner>adafang@google.com</owner> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - The number of search results which have been normalized. Logged when each - vector of search results is normalized. - </summary> -</histogram> - <histogram name="Apps.AppList.Search.Error" enum="AppListUserEventError" expires_after="2022-08-15"> <owner>wrong@chromium.org</owner> @@ -1025,44 +771,6 @@ </summary> </histogram> -<histogram name="Apps.AppList.SuggestedFiles.ChipLaunched" enum="Boolean" - expires_after="2021-05-16"> - <obsolete> - Removed December 2020. - </obsolete> - <owner>tby@chromium.org</owner> - <summary> - Emitted when a suggestion chip is launched. Currently only 'true' is used, - but we may emit 'false' in future to track abandonment. - </summary> -</histogram> - -<histogram name="Apps.AppList.SuggestedFiles.LaunchIndex" units="index" - expires_after="2021-08-15"> - <obsolete> - Removed April 2021. Use the more general Apps.AppList.UserEvent.LaunchIndex - instead. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>wrong@chromium.org</owner> - <summary> - Emitted when a suggestion chip is launched, records the index (position in - the bar) of that chip. The left-most chip is index 0 and the maximum index - is 4. - </summary> -</histogram> - -<histogram name="Apps.AppList.SuggestedFiles.LaunchType" - enum="LauncherRankingItemType" expires_after="2021-05-30"> - <obsolete> - Removed December 2020. - </obsolete> - <owner>tby@chromium.org</owner> - <summary> - Emitted when a suggestion chip is launched, records the type of that chip. - </summary> -</histogram> - <histogram name="Apps.AppList.TimeToUserAction{TabletOrClamshell}" units="ms" expires_after="2022-12-19"> <owner>gzadina@google.com</owner> @@ -1088,21 +796,6 @@ <token key="TabletOrClamshell" variants="TabletOrClamshellMode"/> </histogram> -<histogram name="Apps.AppList.UserEvent.Error" enum="AppListSearchResult" - expires_after="2022-08-15"> - <obsolete> - Deprecated November 2021. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>thanhdng@chromium.org</owner> - <owner>wrong@chromium.org</owner> - <summary> - Records error when processing user events into Apps.AppList.UserEvent.* - metrics. These are expected to be rare and bucket proportion is not - meaningful. - </summary> -</histogram> - <histogram name="Apps.AppList.UserEvent.LaunchIndex{LauncherUISurface}" units="index" expires_after="2022-08-15"> <owner>tby@chromium.org</owner> @@ -1257,19 +950,6 @@ </summary> </histogram> -<histogram name="Apps.AppList.ZeroStateFileProvider.NotifierCreationSuccess" - enum="BooleanSuccess" expires_after="2021-02-07"> - <obsolete> - Removed January 2021. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>edimitriadis@chromium.org</owner> - <summary> - Emitted when the ZeroStateFileProvider is created, records whether the - FileTasksNotifier creation succeeded for the given profile. - </summary> -</histogram> - <histogram name="Apps.AppList.ZeroStateFileProvider.Relevance" units="score" expires_after="2022-06-30"> <owner>wrong@chromium.org</owner> @@ -1290,112 +970,6 @@ </summary> </histogram> -<histogram name="Apps.AppList.ZeroStateResults.ReceivedScore.DriveQuickAccess" - units="score" expires_after="2021-04-18"> - <obsolete> - Removed December 2020. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - Logs the result score received from the Drive Quick Access provider. The - original float score is scaled to range from 0 to 100 and its floor is - recorded. - </summary> -</histogram> - -<histogram name="Apps.AppList.ZeroStateResults.ReceivedScore.OmniboxSearch" - units="score" expires_after="2021-04-11"> - <obsolete> - Removed December 2020. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - Logs the result score received from the Omnibox search provider. The - original float score is scaled to range from 0 to 100 and its floor is - recorded. - </summary> -</histogram> - -<histogram name="Apps.AppList.ZeroStateResults.ReceivedScore.ZeroStateFile" - units="score" expires_after="2020-12-06"> - <obsolete> - Removed December 2020. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - Logs the result score received from the zero state file provider. The - original float score is scaled to range from 0 to 100 and its floor is - recorded. - </summary> -</histogram> - -<histogram name="Apps.AppList.ZeroStateResultsList.Clicked" - enum="BooleanClicked" expires_after="2021-04-11"> - <obsolete> - Removed December 2020. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - Whether an item was clicked from zero state search results, or if results - were displayed for some amount time but not clicked. These clicks and - impressions are used for calculating CTR metrics. - </summary> -</histogram> - -<histogram name="Apps.AppList.ZeroStateResultsList.ContainsDriveFiles" - enum="Boolean" expires_after="2021-05-30"> - <obsolete> - Removed December 2020. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - Whether a set of search result impressions contains any Drive QuickAccess - file results. - </summary> -</histogram> - -<histogram name="Apps.AppList.ZeroStateResultsList.FileImpressions" - enum="AppListSearchResult" expires_after="2021-02-07"> - <obsolete> - Removed January 2021. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - The number of zero state impressions that contained at least one result of - the specified file type. - </summary> -</histogram> - -<histogram name="Apps.AppList.ZeroStateResultsList.LaunchedItemPositionV2" - units="position" expires_after="2021-02-07"> - <obsolete> - Removed December 2020. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - The position index of an item launched from zero state search results. - </summary> -</histogram> - -<histogram name="Apps.AppList.ZeroStateResultsList.NumImpressionTypesV2" - units="count" expires_after="2021-01-03"> - <obsolete> - Removed December 2020. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - The number of item types included in each zero state impression set. - </summary> -</histogram> - <histogram name="Apps.AppList.ZeroStateSearchResultRemovalDecision" enum="AppListResultRemovalConfirmation" expires_after="2022-06-01"> <owner>jennyz@chromium.org</owner> @@ -1717,21 +1291,6 @@ </summary> </histogram> -<histogram name="Apps.AppListRecommendedImpResultCountAfterOpen" units="shows" - expires_after="2021-11-28"> - <obsolete> - Removed December 2021. - </obsolete> - <owner>napper@chromium.org</owner> - <owner>robsc@chromium.org</owner> - <owner>thanhdng@chromium.org</owner> - <summary> - When a user opens an app recommendation result, this is the number of times - we showed the result before opening. Number of times shown is reset to 0 - every 30 days, and is held on device. - </summary> -</histogram> - <histogram name="Apps.AppListRecommendedResponse" enum="ReinstallResponseParseResult" expires_after="2022-01-02"> <owner>napper@chromium.org</owner> @@ -1765,48 +1324,6 @@ </summary> </histogram> -<histogram name="Apps.AppListResultLaunchIndexAndQueryLength" units="units" - expires_after="2021-01-31"> - <obsolete> - Removed January 2021. - </obsolete> - <owner>tby@chromium.org</owner> - <owner>thanhdng@chromium.org</owner> - <summary> - The index of a clicked result in the search result box and the length of the - search query. The index is relative to the SearchResultListView, not the - overall position in the suggestion window. - </summary> -</histogram> - -<histogram name="Apps.AppListResultLaunchIsEmptyQuery" enum="Boolean" - expires_after="2021-11-15"> - <obsolete> - Removed January 2021. - </obsolete> - <owner>thanhdng@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - This boolean records if the query that introduces a launch in the results - list is empty or not. This will be recorded every time the user clicks an - item in the launcher results list. - </summary> -</histogram> - -<histogram name="Apps.AppListSearchAbandonQueryLength" units="characters" - expires_after="2021-03-15"> - <obsolete> - Removed March 2021. - </obsolete> - <owner>jennyz@chromium.org</owner> - <owner>tby@chromium.org</owner> - <owner>thanhdng@chromium.org</owner> - <summary> - The length of the query when the user abandons results of a queried search - or recommendations of zero state (zero length query) in launcher UI. - </summary> -</histogram> - <histogram name="Apps.AppListSearchBoxActivated" enum="SearchBoxActivationSource" expires_after="2022-05-01"> <!-- Name completed by histogram_suffixes name="TabletOrClamshellMode" --> @@ -1830,22 +1347,6 @@ </summary> </histogram> -<histogram name="Apps.AppListSearchOmniboxResultOpenType" - enum="AppListOmniboxResult" expires_after="2021-12-31"> - <obsolete> - Removed December 2021. - </obsolete> - <owner>jennyz@chromium.org</owner> - <owner>newcomer@chromium.org</owner> - <owner>mpearson@chromium.org</owner> - <owner>jdonnelly@chromium.org</owner> - <summary> - The type of app list search omnibox result that was opened by the user. This - is gathered per OmniboxResult opened in the app list's launcher suggestion - window. - </summary> -</histogram> - <histogram name="Apps.AppListSearchQueryLength" units="characters" expires_after="2022-05-01"> <!-- Name completed by histogram_suffixes name="TabletOrClamshellMode" --> @@ -2008,24 +1509,6 @@ <token key="InstallReason" variants="InstallReason"/> </histogram> -<histogram name="Apps.AppsCountPerInstallSource.{AppType}.{InstallSource}" - units="Apps" expires_after="2022-07-01"> - <obsolete> - Removed in M96. Replaced with Apps.AppsCountPerInstallReason. - </obsolete> - <owner>nancylingwang@chromium.org</owner> - <owner>chromeos-apps-foundation-team@google.com</owner> - <summary> - The total number of installed {AppType} for each app type {InstallSource} in - Chrome OS. This is logged when more than 24 hours pass after last log, or - during the system startup phase if more than 24 hours passed after last log. - This histogram is capped at 1000; values above this go into the overflow - bucket. - </summary> - <token key="AppType" variants="AppType"/> - <token key="InstallSource" variants="InstallSource"/> -</histogram> - <histogram name="Apps.AppShimErrorVersion" units="units" expires_after="M78"> <owner>jackhou@chromium.org</owner> <summary> @@ -2103,11 +1586,6 @@ UI. {ContextMenuFromApp} </summary> <token key="ContextMenuFromApp"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> <variant name=".FromApp" summary="The source of the context menu was an app."/> <variant name=".NotFromApp" @@ -2124,37 +1602,10 @@ The show source (touch, mouse, keyboard, etc) for a context menu. Split by the component from which the context menu originated. {AppUIComponent} </summary> - <token key="AppUIComponent" variants="AppUIComponent"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> - </token> + <token key="AppUIComponent" variants="AppUIComponent"/> <token key="TabletOrClamshellMode" variants="TabletOrClamshellMode"/> </histogram> -<histogram name="Apps.ContextMenuShowSource{AppUIComponent}" - enum="MenuSourceType" expires_after="2021-10-10"> - <obsolete> - Obsoleted in October 2021. Combine the TabletOrClamshellMode suffix in - histogram_suffixes_list with this histogram. - </obsolete> - <owner>mmourgos@chromium.org</owner> - <owner>newcomer@chromium.org</owner> - <summary> - The show source (touch, mouse, keyboard, etc) for a context menu. Split by - the component from which the context menu originated. {AppUIComponent} - </summary> - <token key="AppUIComponent" variants="AppUIComponent"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> - </token> -</histogram> - <histogram name="Apps.ContextMenuUserJourneyTimeV2{AppUIComponent}{TabletOrClamshellMode}" units="ms" expires_after="2022-06-01"> @@ -2166,39 +1617,10 @@ activated. Not recorded whenever the context menu is not for an app icon on the shelf. {AppUIComponent} </summary> - <token key="AppUIComponent" variants="AppUIComponent"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> - </token> + <token key="AppUIComponent" variants="AppUIComponent"/> <token key="TabletOrClamshellMode" variants="TabletOrClamshellMode"/> </histogram> -<histogram name="Apps.ContextMenuUserJourneyTime{AppUIComponent}" units="ms" - expires_after="2021-10-31"> - <obsolete> - Obsoleted in October 2021. Combine the TabletOrClamshellMode suffix in - histogram_suffixes_list with this histogram. - </obsolete> - <owner>mmourgos@chromium.org</owner> - <owner>newcomer@chromium.org</owner> - <summary> - The user journey time for a ContextMenu, defined as the time between - launching a context menu and the context menu's close callback being - activated. Not recorded whenever the context menu is not for an app icon on - the shelf. {AppUIComponent} - </summary> - <token key="AppUIComponent" variants="AppUIComponent"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> - </token> -</histogram> - <histogram name="Apps.CreateShortcutIcon.Linux.Result" enum="WebAppCreateShortcutIconLinuxResult" expires_after="2022-07-03"> <owner>estade@chromium.org</owner> @@ -2235,11 +1657,6 @@ {DefaultAppLaunchSource} </summary> <token key="DefaultAppLaunchSource"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> <variant name=".FromAppListGrid" summary="From app list grid."/> <variant name=".FromAppListGridContextMenu" summary="From app list grid context menu."/> @@ -2400,22 +1817,6 @@ </summary> </histogram> -<histogram name="Apps.LauncherSearchQueryLengthJumped" enum="Boolean" - expires_after="2021-10-25"> - <obsolete> - Removed October 2021. - </obsolete> - <owner>wrong@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - Whether or not the most recent Launcher search query differs from the - previous query in length by more than one character. Search queries are - issued incrementally as the user types, so this will approximately - differentiate between incremental and non-incremental search queries. - Emitted on each change to the launcher search query. - </summary> -</histogram> - <histogram name="Apps.LockScreen.AppsProfile.Creation.Duration" units="ms" expires_after="2022-06-01"> <owner>dstockwell@chromium.org</owner> @@ -2473,13 +1874,7 @@ {LockScreenAppDataItemOperation} </summary> <token key="LockScreenAppDataItemOperation" - variants="LockScreenAppDataItemOperation"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> - </token> + variants="LockScreenAppDataItemOperation"/> </histogram> <histogram @@ -2493,13 +1888,7 @@ {LockScreenAppDataItemOperation} </summary> <token key="LockScreenAppDataItemOperation" - variants="LockScreenAppDataItemOperation"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> - </token> + variants="LockScreenAppDataItemOperation"/> </histogram> <histogram @@ -2512,13 +1901,7 @@ chrome.lockScreen.data extension API. {LockScreenAppDataItemOperation} </summary> <token key="LockScreenAppDataItemOperation" - variants="LockScreenAppDataItemOperation"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> - </token> + variants="LockScreenAppDataItemOperation"/> </histogram> <histogram name="Apps.LockScreen.DataItemStorage.RegisteredItemsCount" @@ -2556,11 +1939,6 @@ state. {LockScreenNoteTakingAppWindowState} </summary> <token key="LockScreenNoteTakingAppWindowState"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> <variant name=".Background" summary="The app window is in background (behind the lock screen)"/> <variant name=".Foreground" @@ -2691,19 +2069,6 @@ </summary> </histogram> -<histogram name="Apps.LogDisplayTypeClickedResultZeroState" - enum="AppListSearchResultDisplayType" expires_after="2020-11-22"> - <obsolete> - Removed October 2020, replaced by Apps.AppList.UserEvent.Overall.* - </obsolete> - <owner>thanhdng@chromium.org</owner> - <owner>tby@chromium.org</owner> - <summary> - Records number of clicks on search result for different display types in - zero-state. - </summary> -</histogram> - <histogram name="Apps.NoteTakingApp.DefaultLaunchResult" enum="NoteTakingAppLaunchResult" expires_after="2022-06-01"> <owner>dstockwell@chromium.org</owner> @@ -2766,33 +2131,6 @@ </histogram> <histogram - name="Apps.OpenedAppListSearchResultFromSearchBox.{AnyNonAppBrowserWindowOpenAndNotMinimized}" - enum="AppListSearchResult" expires_after="M101"> - <obsolete> - Deprecated 01/2022, because it was recording the similarly named - AppListSearchResultType enum, rather than SearchResultType. Replaced with - Apps.OpenedAppListSearchResultFromSearchBoxV2.*. - </obsolete> - <owner>andrewxu@chromium.org</owner> - <owner>tbarzic@chromium.org</owner> - <summary> - Records the opened launcher search results from the search box. Data is - gathered when a search result is opened from the search box. - {AnyNonAppBrowserWindowOpenAndNotMinimized} denotes whether there is any - non-app browser window open and not minimized when a search result is - opened. - </summary> - <token key="AnyNonAppBrowserWindowOpenAndNotMinimized"> - <variant name="ExistNonAppBrowserWindowOpenAndNotMinimized" - summary="there exists at least one non-app browser window which is - open and not minimized"/> - <variant name="NonAppBrowserWindowsEitherClosedOrMinimized" - summary="there is no open non-app browser windows or all open non-app - browser windows are minimized"/> - </token> -</histogram> - -<histogram name="Apps.OpenedAppListSearchResultFromSearchBoxV2.{AnyNonAppBrowserWindowOpenAndNotMinimized}" enum="AppListSearchResult" expires_after="M101"> <owner>andrewxu@chromium.org</owner> @@ -2874,48 +2212,6 @@ </summary> </histogram> -<histogram name="Apps.PreferredApps.FileIOAction" - enum="PreferredAppsFileIOAction" expires_after="2022-04-24"> - <obsolete> - Obsoleted in November 2021. - </obsolete> - <owner>mxcai@chromium.org</owner> - <owner>chromeos-apps-foundation-team@google.com</owner> - <summary> - Recorded at the time a read/write operation happens for preferred app to - indicate whether the I/O succeeded or not. This was briefly logged under - PreferredApps.FileIOAction in milestone 85. - </summary> -</histogram> - -<histogram name="Apps.PreferredApps.UpdateAction" - enum="PreferredAppsUpdateAction" expires_after="2022-04-24"> - <obsolete> - Obsoleted in November 2021. - </obsolete> - <owner>mxcai@chromium.org</owner> - <owner>chromeos-apps-foundation-team@google.com</owner> - <summary> - Recorded at the time a update operation happens for preferred apps to - indicate the type of update action. This was briefly logged under - PreferredApps.UpdateAction in milestone 85. - </summary> -</histogram> - -<histogram name="Apps.PreviousReadinessStatus.{App}" enum="AppReadiness" - expires_after="2021-12-31"> - <obsolete> - Removed October 2021. - </obsolete> - <owner>nancylingwang@chromium.org</owner> - <owner>chromeos-apps-foundation-team@google.com</owner> - <summary> - Recorded the previous readiness status when the app is ready. This is logged - when the app readiness status is ready. - </summary> - <token key="App" variants="App"/> -</histogram> - <histogram name="Apps.RestoreArcAppsResult" enum="RestoreResult" expires_after="2022-07-01"> <owner>nancylingwang@chromium.org</owner> @@ -3066,13 +2362,7 @@ Maximum latency of the presentation time of the drag scroll in the scrollable shelf. {HomeLauncherVisibility} </summary> - <token key="HomeLauncherVisibility" variants="HomeLauncherVisibility"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> - </token> + <token key="HomeLauncherVisibility" variants="HomeLauncherVisibility"/> </histogram> <histogram @@ -3087,13 +2377,7 @@ Warning: This histogram was expired from 2021-01-10 to 2022-06-02; data may be missing. {HomeLauncherVisibility} </summary> - <token key="HomeLauncherVisibility" variants="HomeLauncherVisibility"> - <variant name=""> - <obsolete> - Base histogram. Use suffixes of this histogram instead. - </obsolete> - </variant> - </token> + <token key="HomeLauncherVisibility" variants="HomeLauncherVisibility"/> </histogram> <histogram name="Apps.SessionRestoreExitResult" enum="SessionRestoreExitResult" @@ -3117,30 +2401,6 @@ </summary> </histogram> -<histogram name="Apps.ShortcutsMenu.Registration.Win.Result" - enum="ShortcutsMenuRegistrationWinResult" expires_after="M87"> - <obsolete> - Removed January 2021. - </obsolete> - <owner>cmumford@chromium.org</owner> - <owner>rahsin@microsoft.com</owner> - <summary> - Records the result of shortcuts menu registration for PWA on Windows - </summary> -</histogram> - -<histogram name="Apps.ShortcutsMenu.Unregistration.Win.Result" - enum="ShortcutsMenuUnregistrationWinResult" expires_after="M87"> - <obsolete> - Removed January 2021. - </obsolete> - <owner>cmumford@chromium.org</owner> - <owner>rahsin@microsoft.com</owner> - <summary> - Records the result of shortcuts menu unregistration for PWA on Windows - </summary> -</histogram> - <histogram name="Apps.StateTransition.AnimationSmoothness{AppListTargetState}" units="%" expires_after="2022-05-30"> <owner>newcomer@chromium.org</owner> @@ -3239,49 +2499,6 @@ <token key="AppTypeV2" variants="AppTypeV2"/> </histogram> -<histogram name="Apps.WindowCount.{RestoreAction}" units="unit" - expires_after="2021-12-30"> - <obsolete> - Removed October 2021. - </obsolete> - <owner>nancylingwang@chromium.org</owner> - <owner>sammiequon@chromium.org</owner> - <summary> - Records the number of the new created windows when {RestoreAction} in Chrome - OS. This is logged when {RestoreAction} on the full restore notfication - during the system startup phase. - </summary> - <token key="RestoreAction" variants="RestoreAction"/> -</histogram> - -<histogram name="PreferredApps.FileIOAction" enum="PreferredAppsFileIOAction" - expires_after="M89"> - <obsolete> - This was used by mistake, add the entry to avoid anyone accidently using - this name. Obsolete in 10/2020. Replaced by Apps.PreferredApps.FileIOAction. - </obsolete> - <owner>mxcai@chromium.org</owner> - <owner>chromeos-apps-foundation-team@google.com</owner> - <summary> - Recorded at the time a read/write operation happens for preferred app to - indicate whether the I/O succeeded or not. - </summary> -</histogram> - -<histogram name="PreferredApps.UpdateAction" enum="PreferredAppsUpdateAction" - expires_after="M89"> - <obsolete> - This was used by mistake, add the entry to avoid anyone accidently using - this name. Obsolete in 10/2020. Replaced by Apps.PreferredApps.UpdateAction. - </obsolete> - <owner>mxcai@chromium.org</owner> - <owner>chromeos-apps-foundation-team@google.com</owner> - <summary> - Recorded at the time a update operation happens for preferred apps to - indicate the type of update action. - </summary> -</histogram> - </histograms> </histogram-configuration>
diff --git a/tools/metrics/histograms/metadata/memory/histograms.xml b/tools/metrics/histograms/metadata/memory/histograms.xml index 445ddee..fbc3609 100644 --- a/tools/metrics/histograms/metadata/memory/histograms.xml +++ b/tools/metrics/histograms/metadata/memory/histograms.xml
@@ -2383,6 +2383,19 @@ <summary>Throughput of a ParkableString disk write.</summary> </histogram> +<histogram name="Memory.PartitionAlloc.MemoryReclaim" units="microseconds" + expires_after="M102"> + <owner>lizeb@chromium.org</owner> + <owner>bartekn@chromium.org</owner> + <summary> + Time it takes for PartitionAlloc's MemoryReclaimer to reclaim once. + Collected at each reclaim, for all process types. + + Note that clients without high-resolution clocks will report 0 for very + short times. + </summary> +</histogram> + <histogram name="Memory.PartitionAlloc.ThreadCache.BatchFillRate{ThreadType}" units="%" expires_after="M102"> <owner>lizeb@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/net/histograms.xml b/tools/metrics/histograms/metadata/net/histograms.xml index 958fc5a..b5faed4 100644 --- a/tools/metrics/histograms/metadata/net/histograms.xml +++ b/tools/metrics/histograms/metadata/net/histograms.xml
@@ -1511,6 +1511,9 @@ </histogram> <histogram name="Net.FTP.StartResult" enum="FTPStartResult" expires_after="M79"> + <obsolete> + Removed from code 2020-08. + </obsolete> <owner>tervay@google.com</owner> <owner>asanka@chromium.org</owner> <summary> @@ -1531,8 +1534,8 @@ <histogram name="Net.HttpAuthCount" enum="HttpAuthCount" expires_after="2022-06-19"> - <owner>asanka@chromium.org</owner> <owner>mmenke@chromium.org</owner> + <owner>src/net/OWNERS</owner> <summary> Per-authentication-scheme counts of authentication attempts and rejections. </summary> @@ -1540,8 +1543,8 @@ <histogram name="Net.HttpAuthNtlmV2Usage" enum="HttpAuthNtlmV2Usage" expires_after="M79"> - <owner>asanka@chromium.org</owner> <owner>mmenke@chromium.org</owner> + <owner>src/net/OWNERS</owner> <summary> Whether NTLMv2 was enabled for an authentication handshake. For a given data set the number of samples here is expected to be equivalent to the @@ -1560,8 +1563,8 @@ <histogram name="Net.HttpAuthTarget" enum="HttpAuthTarget" expires_after="2022-04-17"> - <owner>asanka@chromium.org</owner> <owner>mmenke@chromium.org</owner> + <owner>src/net/OWNERS</owner> <summary> Per-authentication-scheme counts of authentication targets, such as secure servers or proxies.
diff --git a/tools/metrics/histograms/metadata/others/histograms.xml b/tools/metrics/histograms/metadata/others/histograms.xml index a18ebaf..d395b73 100644 --- a/tools/metrics/histograms/metadata/others/histograms.xml +++ b/tools/metrics/histograms/metadata/others/histograms.xml
@@ -15127,7 +15127,7 @@ </histogram> <histogram name="Tablet.AppDrag.EndWindowState" - enum="AppWindowDragEndWindowState" expires_after="2022-01-30"> + enum="AppWindowDragEndWindowState" expires_after="2022-10-01"> <owner>minch@chromium.org</owner> <owner>omrilio@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/v8/histograms.xml b/tools/metrics/histograms/metadata/v8/histograms.xml index a803baa9..26aff74 100644 --- a/tools/metrics/histograms/metadata/v8/histograms.xml +++ b/tools/metrics/histograms/metadata/v8/histograms.xml
@@ -352,6 +352,9 @@ <histogram name="V8.ContextSnapshotDecompress" units="microseconds" expires_after="2022-05-22"> + <obsolete> + Removed 01/2022. + </obsolete> <owner>sky@chromium.org</owner> <owner>yukishiino@chromium.org</owner> <summary> @@ -381,19 +384,6 @@ </summary> </histogram> -<histogram name="V8.Execute" units="ms" expires_after="M94"> - <obsolete> - Use V8.ExecuteMicroSeconds after M94, which correctly accounts nested timers - with nested V8.Execute blocks. - </obsolete> - <owner>cbruni@chromium.org</owner> - <owner>v8-runtime@google.com</owner> - <summary> - Time spent in JavaScript Execution, including runtime calls, callbacks, and - lazy compilation. - </summary> -</histogram> - <histogram name="V8.ExecuteMicroSeconds" units="microseconds" expires_after="2022-06-26"> <owner>cbruni@chromium.org</owner> @@ -697,71 +687,6 @@ </summary> </histogram> -<histogram name="V8.GC.Event.MainThread.Full.Atomic.Compact.Cpp" units="ms" - expires_after="M100"> - <obsolete> - Removed 09/2021. Renamed to V8.GC.Cycle.MainThread.Full.Atomic.Compact.Cpp. - </obsolete> - <owner>omerkatz@chromium.org</owner> - <owner>v8-memory-sheriffs@google.com</owner> - <summary> - Duration of individual compaction steps on the main thread during the atomic - pause of a garbage collection of the managed C++ heap. - </summary> -</histogram> - -<histogram name="V8.GC.Event.MainThread.Full.Atomic.Cpp" units="ms" - expires_after="M100"> - <obsolete> - Removed 09/2021. Renamed to V8.GC.Cycle.MainThread.Full.Atomic.Cpp. - </obsolete> - <owner>omerkatz@chromium.org</owner> - <owner>v8-memory-sheriffs@google.com</owner> - <summary> - Duration of individual steps on the main thread during the atomic pause of a - garbage collection of the managed C++ heap. - </summary> -</histogram> - -<histogram name="V8.GC.Event.MainThread.Full.Atomic.Mark.Cpp" units="ms" - expires_after="M100"> - <obsolete> - Removed 09/2021. Renamed to V8.GC.Cycle.MainThread.Full.Atomic.Mark.Cpp. - </obsolete> - <owner>omerkatz@chromium.org</owner> - <owner>v8-memory-sheriffs@google.com</owner> - <summary> - Duration of individual marking steps on the main thread during the atomic - pause of a garbage collection of the managed C++ heap. - </summary> -</histogram> - -<histogram name="V8.GC.Event.MainThread.Full.Atomic.Sweep.Cpp" units="ms" - expires_after="M100"> - <obsolete> - Removed 09/2021. Renamed to V8.GC.Cycle.MainThread.Full.Atomic.Sweep.Cpp. - </obsolete> - <owner>omerkatz@chromium.org</owner> - <owner>v8-memory-sheriffs@google.com</owner> - <summary> - Duration of individual sweeping steps on the main thread during the atomic - pause of a garbage collection of the managed C++ heap. - </summary> -</histogram> - -<histogram name="V8.GC.Event.MainThread.Full.Atomic.Weak.Cpp" units="ms" - expires_after="M100"> - <obsolete> - Removed 09/2021. Renamed to V8.GC.Cycle.MainThread.Full.Atomic.Weak.Cpp. - </obsolete> - <owner>omerkatz@chromium.org</owner> - <owner>v8-memory-sheriffs@google.com</owner> - <summary> - Duration of individual weakness handling steps on the main thread during the - atomic pause of a garbage collection of the managed C++ heap. - </summary> -</histogram> - <histogram name="V8.GC.Event.MainThread.Full.Incremental.Cpp" units="ms" expires_after="M109"> <owner>omerkatz@chromium.org</owner> @@ -834,19 +759,6 @@ </summary> </histogram> -<histogram name="V8.GCBackgroundScavenger" units="ms" - expires_after="2021-12-19"> - <obsolete> - Removed 11/2021. Superseded by V8.GC.Cycle.Young. - </obsolete> - <owner>mlippautz@chromium.org</owner> - <owner>v8-memory-sheriffs@google.com</owner> - <summary> - Time spent in background tasks doing scavenging in one GC cycle. It is - recorded after each GC. - </summary> -</histogram> - <histogram name="V8.GCBackgroundSweeping" units="ms" expires_after="2022-06-05"> <owner>mlippautz@chromium.org</owner> <owner>v8-memory-sheriffs@google.com</owner> @@ -1067,18 +979,6 @@ </summary> </histogram> -<histogram name="V8.GCMarkCompactor" units="ms" expires_after="2022-01-02"> - <obsolete> - Unused as of 2022-01-02. - </obsolete> - <owner>mlippautz@chromium.org</owner> - <owner>v8-memory-sheriffs@google.com</owner> - <summary> - Sum of all durations of individual phases within one V8 mark-compact garbage - collection. Reported once per garbage collection. - </summary> -</histogram> - <histogram name="V8.GCMarkCompactReason" enum="GarbageCollectionReason" expires_after="2022-06-26"> <owner>mlippautz@chromium.org</owner> @@ -1169,26 +1069,6 @@ </summary> </histogram> -<histogram name="V8.MaxArrayBufferCageReservationSize" units="GB" - expires_after="2022-06-30"> - <obsolete> - Removed 09/2021. Superseded by V8.VirtualMemoryCageSizeGB. - </obsolete> - <owner>saelo@chromium.org</owner> - <owner>ishell@chromium.org</owner> - <summary> - Largest possible size of the virtual memory region for an ArrayBuffer cage. - - Measured and reported at process startup, right before initializing V8, by - attempting to reserve memory regions with decreasing size until the - reservation succeeds, then immediately freeing it again. - - This experiment is part of the V8 Heap Sandbox and the V8 ArrayBuffer Caging - proposal. Its goal is to estimate the maximum possible size of an - ArrayBuffer cage region. - </summary> -</histogram> - <histogram name="V8.MemoryExternalFragmentationCodeSpace" units="%" expires_after="2020-03-01"> <owner>hpayer@chromium.org</owner> @@ -1290,6 +1170,9 @@ <histogram name="V8.SnapshotDecompress" units="microseconds" expires_after="2022-05-22"> + <obsolete> + Removed 01/2022. + </obsolete> <owner>sky@chromium.org</owner> <owner>yukishiino@chromium.org</owner> <summary> @@ -1300,29 +1183,6 @@ </summary> </histogram> -<histogram name="V8.StopTheWorld" units="ms" expires_after="2021-10-01"> - <obsolete> - Removed 02/2021. Renamed to V8.GC.TimeToSafepoint due to switch to - microseconds. - </obsolete> - <owner>dinfuehr@chromium.org</owner> - <owner>ulan@chromium.org</owner> - <summary>Time spent in stopping other threads before performing GC.</summary> -</histogram> - -<histogram name="V8.TimeToCollection" units="ms" expires_after="2021-10-01"> - <obsolete> - Removed 02/2021. Renamed to V8.GC.TimeToCollectionBackground due to switch - to microseconds. - </obsolete> - <owner>dinfuehr@chromium.org</owner> - <owner>ulan@chromium.org</owner> - <summary> - Time between requesting GC from background thread and actually starting - collection on main thread. - </summary> -</histogram> - <histogram name="V8.TurboFan1KTicks" units="1000 ticks" expires_after="2020-01-23"> <owner>tebbi@chromium.org</owner> @@ -1520,20 +1380,6 @@ </summary> </histogram> -<histogram name="V8.WasmAddressSpaceUsageMiB" units="MB" expires_after="M98"> - <obsolete> - Received no values since M79. - </obsolete> - <owner>ecmziegler@chromium.org</owner> - <owner>adamk@chromium.org</owner> - <owner>ahaas@chromium.org</owner> - <summary> - The total amount of address space reserved by the backing stores of all live - WebAssembly.Memory backing stores in MiB. Recorded on each memory - reservation. - </summary> -</histogram> - <histogram name="V8.WasmCacheCount" units="count" expires_after="2022-06-30"> <owner>ahaas@chromium.org</owner> <owner>ecmziegler@chromium.org</owner> @@ -1699,21 +1545,6 @@ </summary> </histogram> -<histogram name="V8.WasmFunctionSizeBytes" units="bytes" - expires_after="2021-08-01"> - <obsolete> - Removed 07/2021 in favor of V8.WasmHugeFunctionSizeBytes which gives a - better overview about critical functions. - </obsolete> - <owner>ecmziegler@chromium.org</owner> - <owner>adamk@chromium.org</owner> - <owner>clemensb@chromium.org</owner> - <summary> - Size of a WebAssembly function in bytes. Recorded on each compilation of a - single function, either synchronous, asynchronous, or lazily. - </summary> -</histogram> - <histogram name="V8.WasmFunctionsPerModule" units="functions" expires_after="2022-06-19"> <owner>ecmziegler@chromium.org</owner>
diff --git a/tools/perf/contrib/privacy_budget_perf/OWNERS b/tools/perf/contrib/privacy_budget_perf/OWNERS index 92efa8e1..7d88b7bb 100644 --- a/tools/perf/contrib/privacy_budget_perf/OWNERS +++ b/tools/perf/contrib/privacy_budget_perf/OWNERS
@@ -1,2 +1 @@ caraitto@chromium.org -asanka@chromium.org
diff --git a/tools/perf/core/bot_platforms.py b/tools/perf/core/bot_platforms.py index 8877598..a102788 100644 --- a/tools/perf/core/bot_platforms.py +++ b/tools/perf/core/bot_platforms.py
@@ -573,6 +573,13 @@ 26, 'mac', executables=_MAC_LOW_END_EXECUTABLE_CONFIGS) +MAC_LOW_END_LAPTOP = PerfPlatform( + 'mac-laptop_low_end-perf', + 'MacBook Air, Core i5 1.8 GHz, 8GB RAM, 128GB SSD, HD Graphics', + _MAC_LOW_END_BENCHMARK_CONFIGS, + 26, + 'mac', + executables=_MAC_LOW_END_EXECUTABLE_CONFIGS) MAC_M1_MINI_2020 = PerfPlatform( 'mac-m1_mini_2020-perf', 'Mac M1 Mini 2020',
diff --git a/tools/perf/core/perf_data_generator.py b/tools/perf/core/perf_data_generator.py index dbca722..8bfd05f 100755 --- a/tools/perf/core/perf_data_generator.py +++ b/tools/perf/core/perf_data_generator.py
@@ -104,6 +104,7 @@ 'win-10-perf', 'win-10_laptop_low_end-perf', 'mac-laptop_high_end-perf', + 'mac-laptop_low_end-perf', ] # This is an opt-in list for builders which uses dynamic sharding. @@ -942,6 +943,30 @@ 'MacBookAir7,2_x86-64-i5-5350U_Intel Broadwell HD Graphics 6000_8192_APPLE SSD SM0128G' }, }, + 'mac-laptop_low_end-perf': { + 'tests': [ + { + 'isolate': 'performance_test_suite', + 'extra_args': [ + '--assert-gpu-compositing', + ], + }, + ], + 'platform': + 'mac', + 'dimension': { + 'cpu': + 'x86-64', + 'gpu': + '8086:1626', + 'os': + 'Mac-10.12.6', + 'pool': + 'chrome.tests.perf', + 'synthetic_product_name': + 'MacBookAir7,2_x86-64-i5-5350U_Intel Broadwell HD Graphics 6000_8192_APPLE SSD SM0128G' + }, + }, 'mac-m1_mini_2020-perf': { 'tests': [ { @@ -1072,6 +1097,10 @@ 'platform': 'linux', 'perf_processor': True, }, + 'mac-laptop_low_end-processor-perf': { + 'platform': 'linux', + 'perf_processor': True, + }, 'mac-10_13_laptop_high_end-processor-perf': { 'platform': 'linux', 'perf_processor': True,
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 1a4ec5e..bf73dcf 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -14,7 +14,7 @@ }, "mac": { "hash": "27f08c64c371ac3295e79f133c7ccb246efa163d", - "remote_path": "perfetto_binaries/trace_processor_shell/mac/5a202e1c1c7fb14817bb4df498d5f0ea71915653/trace_processor_shell" + "remote_path": "perfetto_binaries/trace_processor_shell/mac/c581dd4f599dc73735f6d006ea1d25ea80ce3165/trace_processor_shell" }, "mac_arm64": { "hash": "c0397e87456ad6c6a7aa0133e5b81c97adbab4ab",
diff --git a/tools/perf/core/shard_maps/mac-laptop_low_end-perf_map.json b/tools/perf/core/shard_maps/mac-laptop_low_end-perf_map.json new file mode 100644 index 0000000..649e83e --- /dev/null +++ b/tools/perf/core/shard_maps/mac-laptop_low_end-perf_map.json
@@ -0,0 +1,418 @@ +{ + "0": { + "benchmarks": { + "blink_perf.accessibility": { + "abridged": false + }, + "blink_perf.bindings": { + "abridged": false + }, + "blink_perf.css": { + "abridged": false + }, + "blink_perf.display_locking": { + "abridged": false + }, + "blink_perf.dom": { + "abridged": false + }, + "blink_perf.events": { + "abridged": false + }, + "blink_perf.image_decoder": { + "end": 8, + "abridged": false + } + } + }, + "1": { + "benchmarks": { + "blink_perf.image_decoder": { + "begin": 8, + "abridged": false + }, + "blink_perf.layout": { + "abridged": false + }, + "blink_perf.owp_storage": { + "abridged": false + }, + "blink_perf.paint": { + "abridged": false + }, + "blink_perf.parser": { + "end": 13, + "abridged": false + } + } + }, + "2": { + "benchmarks": { + "blink_perf.parser": { + "begin": 13, + "abridged": false + }, + "blink_perf.shadow_dom": { + "abridged": false + }, + "blink_perf.svg": { + "abridged": false + }, + "blink_perf.webaudio": { + "abridged": false + }, + "dromaeo": { + "abridged": false + }, + "dummy_benchmark.noisy_benchmark_1": { + "abridged": false + }, + "dummy_benchmark.stable_benchmark_1": { + "abridged": false + }, + "jetstream": { + "abridged": false + }, + "kraken": { + "abridged": false + }, + "loading.desktop": { + "end": 4, + "abridged": false + } + }, + "executables": { + "load_library_perf_tests": { + "path": "load_library_perf_tests" + } + } + }, + "3": { + "benchmarks": { + "loading.desktop": { + "begin": 4, + "end": 31, + "abridged": false + } + } + }, + "4": { + "benchmarks": { + "loading.desktop": { + "begin": 31, + "end": 55, + "abridged": false + } + } + }, + "5": { + "benchmarks": { + "loading.desktop": { + "begin": 55, + "end": 77, + "abridged": false + } + } + }, + "6": { + "benchmarks": { + "loading.desktop": { + "begin": 77, + "end": 100, + "abridged": false + } + } + }, + "7": { + "benchmarks": { + "loading.desktop": { + "begin": 100, + "abridged": false + }, + "media.desktop": { + "abridged": false + }, + "memory.desktop": { + "end": 5, + "abridged": false + } + } + }, + "8": { + "benchmarks": { + "memory.desktop": { + "begin": 5, + "abridged": false + }, + "octane": { + "abridged": false + }, + "power.desktop": { + "end": 13, + "abridged": false + } + }, + "executables": { + "performance_browser_tests": { + "path": "browser_tests", + "arguments": [ + "--full-performance-run", + "--test-launcher-jobs=1", + "--test-launcher-retry-limit=0", + "--ui-test-action-timeout=60000", + "--ui-test-action-max-timeout=60000", + "--test-launcher-timeout=60000", + "--gtest_filter=*/TabCapturePerformanceTest.*:*/CastV2PerformanceTest.*" + ] + } + } + }, + "9": { + "benchmarks": { + "power.desktop": { + "begin": 13, + "abridged": false + }, + "rasterize_and_record_micro.top_25": { + "abridged": false + }, + "rendering.desktop": { + "end": 35, + "abridged": false + } + } + }, + "10": { + "benchmarks": { + "rendering.desktop": { + "begin": 35, + "end": 86, + "abridged": false + } + } + }, + "11": { + "benchmarks": { + "rendering.desktop": { + "begin": 86, + "end": 138, + "abridged": false + } + } + }, + "12": { + "benchmarks": { + "rendering.desktop": { + "begin": 138, + "end": 185, + "abridged": false + } + } + }, + "13": { + "benchmarks": { + "rendering.desktop": { + "begin": 185, + "end": 234, + "abridged": false + } + } + }, + "14": { + "benchmarks": { + "rendering.desktop": { + "begin": 234, + "end": 276, + "abridged": false + } + } + }, + "15": { + "benchmarks": { + "rendering.desktop": { + "begin": 276, + "abridged": false + }, + "speedometer": { + "abridged": false + }, + "speedometer-future": { + "abridged": false + }, + "speedometer2": { + "abridged": false + }, + "speedometer2-future": { + "abridged": false + }, + "speedometer2-pcscan": { + "abridged": false + }, + "system_health.common_desktop": { + "end": 6, + "abridged": false + } + } + }, + "16": { + "benchmarks": { + "system_health.common_desktop": { + "begin": 6, + "end": 49, + "abridged": false + } + } + }, + "17": { + "benchmarks": { + "system_health.common_desktop": { + "begin": 49, + "abridged": false + }, + "system_health.memory_desktop": { + "end": 3, + "abridged": false + } + } + }, + "18": { + "benchmarks": { + "system_health.memory_desktop": { + "begin": 3, + "end": 21, + "abridged": false + } + } + }, + "19": { + "benchmarks": { + "system_health.memory_desktop": { + "begin": 21, + "end": 39, + "abridged": false + } + } + }, + "20": { + "benchmarks": { + "system_health.memory_desktop": { + "begin": 39, + "end": 62, + "abridged": false + } + } + }, + "21": { + "benchmarks": { + "system_health.memory_desktop": { + "begin": 62, + "end": 76, + "abridged": false + } + } + }, + "22": { + "benchmarks": { + "system_health.memory_desktop": { + "begin": 76, + "abridged": false + }, + "desktop_ui": { + "end": 6, + "abridged": false + } + } + }, + "23": { + "benchmarks": { + "desktop_ui": { + "begin": 6, + "abridged": false + }, + "system_health.pcscan": { + "abridged": false + }, + "tab_switching.typical_25": { + "abridged": false + }, + "tracing.tracing_with_background_memory_infra": { + "abridged": false + }, + "v8.browsing_desktop": { + "end": 16, + "abridged": false + } + } + }, + "24": { + "benchmarks": { + "v8.browsing_desktop": { + "begin": 16, + "abridged": false + }, + "v8.browsing_desktop-future": { + "end": 12, + "abridged": false + }, + "wasmpspdfkit": { + "abridged": false + } + } + }, + "25": { + "benchmarks": { + "blink_perf.webgl": { + "abridged": false + }, + "blink_perf.webgl_fast_call": { + "abridged": false + }, + "blink_perf.webgpu": { + "abridged": false + }, + "blink_perf.webgpu_fast_call": { + "abridged": false + }, + "v8.browsing_desktop-future": { + "begin": 12, + "abridged": false + }, + "webrtc": { + "abridged": false + } + } + }, + "extra_infos": { + "num_stories": 1094, + "predicted_min_shard_time": 1344.0, + "predicted_min_shard_index": 25, + "predicted_max_shard_time": 1467.0, + "predicted_max_shard_index": 21, + "shard #0": 1398.0, + "shard #1": 1398.0, + "shard #2": 1396.0, + "shard #3": 1392.0, + "shard #4": 1406.0, + "shard #5": 1410.0, + "shard #6": 1400.0, + "shard #7": 1408.0, + "shard #8": 1399.0, + "shard #9": 1408.0, + "shard #10": 1387.0, + "shard #11": 1393.0, + "shard #12": 1393.0, + "shard #13": 1400.0, + "shard #14": 1395.0, + "shard #15": 1386.0, + "shard #16": 1407.0, + "shard #17": 1409.0, + "shard #18": 1416.0, + "shard #19": 1395.0, + "shard #20": 1422.0, + "shard #21": 1467.0, + "shard #22": 1371.0, + "shard #23": 1380.0, + "shard #24": 1393.0, + "shard #25": 1344.0 + } +}
diff --git a/tools/perf/core/shard_maps/timing_data/mac-laptop_low_end-perf_timing.json b/tools/perf/core/shard_maps/timing_data/mac-laptop_low_end-perf_timing.json new file mode 100644 index 0000000..ead1098 --- /dev/null +++ b/tools/perf/core/shard_maps/timing_data/mac-laptop_low_end-perf_timing.json
@@ -0,0 +1,4278 @@ +[ + { + "duration": "24.0", + "name": "blink_perf.accessibility/build-table.html" + }, + { + "duration": "19.0", + "name": "blink_perf.accessibility/focus-links.html" + }, + { + "duration": "24.0", + "name": "blink_perf.accessibility/line-breaks.html" + }, + { + "duration": "34.0", + "name": "blink_perf.accessibility/many-text-changes-deep-block-subtree.html" + }, + { + "duration": "30.0", + "name": "blink_perf.accessibility/many-text-changes-deep-hidden-subtree.html" + }, + { + "duration": "27.0", + "name": "blink_perf.accessibility/many-text-changes-deep-inline-subtree.html" + }, + { + "duration": "40.0", + "name": "blink_perf.accessibility/many-text-changes-small-wait-between.html" + }, + { + "duration": "22.0", + "name": "blink_perf.accessibility/textarea-append.html" + }, + { + "duration": "13.0", + "name": "blink_perf.bindings/append-child.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/create-element.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/document-implementation.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/dom-attribute-on-prototoype.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/first-child.html" + }, + { + "duration": "6.0", + "name": "blink_perf.bindings/gc-forest.html" + }, + { + "duration": "7.0", + "name": "blink_perf.bindings/gc-mini-tree.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/gc-tree.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/get-attribute-rare.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/get-attribute.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/get-element-by-id.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/get-elements-by-tag-name.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/id-getter.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/id-setter.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/indexed-getter.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/insert-before.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/named-property-enumerator.html" + }, + { + "duration": "14.0", + "name": "blink_perf.bindings/node-list-access.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/node-type.html" + }, + { + "duration": "3.0", + "name": "blink_perf.bindings/post-message.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/sequence-conversion-array.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/sequence-conversion-custom-iterator.html" + }, + { + "duration": "3.0", + "name": "blink_perf.bindings/serialize-array.html" + }, + { + "duration": "3.0", + "name": "blink_perf.bindings/serialize-long-string.html" + }, + { + "duration": "5.0", + "name": "blink_perf.bindings/serialize-map.html" + }, + { + "duration": "3.0", + "name": "blink_perf.bindings/serialize-nested-array.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/set-attribute-rare.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/set-attribute.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/structured-clone-json-deserialize.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/structured-clone-json-serialize.html" + }, + { + "duration": "5.0", + "name": "blink_perf.bindings/structured-clone-long-string-deserialize.html" + }, + { + "duration": "5.0", + "name": "blink_perf.bindings/structured-clone-long-string-serialize.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/typed-array-construct-from-array.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/typed-array-construct-from-same-type.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/typed-array-construct-from-typed.html" + }, + { + "duration": "9.0", + "name": "blink_perf.bindings/typed-array-set-from-typed.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/undefined-first-child.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/undefined-get-element-by-id.html" + }, + { + "duration": "8.0", + "name": "blink_perf.bindings/undefined-id-getter.html" + }, + { + "duration": "3.0", + "name": "blink_perf.bindings/worker-structured-clone-different-payloads.html" + }, + { + "duration": "14.0", + "name": "blink_perf.bindings/worker-structured-clone-json-from-worker.html" + }, + { + "duration": "14.0", + "name": "blink_perf.bindings/worker-structured-clone-json-roundtrip.html" + }, + { + "duration": "14.0", + "name": "blink_perf.bindings/worker-structured-clone-json-to-worker.html" + }, + { + "duration": "4.0", + "name": "blink_perf.bindings/worker-structured-clone-workerDOM-DBMon-from-worker.html" + }, + { + "duration": "3.0", + "name": "blink_perf.bindings/worker-structured-clone-workerDOM-Map-from-worker.html" + }, + { + "duration": "11.0", + "name": "blink_perf.bindings/worker-text-encoded-transferable-from-worker.html" + }, + { + "duration": "11.0", + "name": "blink_perf.bindings/worker-text-encoded-transferable-roundtrip.html" + }, + { + "duration": "11.0", + "name": "blink_perf.bindings/worker-text-encoded-transferable-to-worker.html" + }, + { + "duration": "12.0", + "name": "blink_perf.bindings/worker-transferable-from-worker.html" + }, + { + "duration": "12.0", + "name": "blink_perf.bindings/worker-transferable-roundtrip.html" + }, + { + "duration": "12.0", + "name": "blink_perf.bindings/worker-transferable-to-worker.html" + }, + { + "duration": "18.0", + "name": "blink_perf.css/AttributeDescendantSelector.html" + }, + { + "duration": "5.0", + "name": "blink_perf.css/CSSLogicalDirection.html" + }, + { + "duration": "11.0", + "name": "blink_perf.css/CSSPropertySetterGetter.html" + }, + { + "duration": "11.0", + "name": "blink_perf.css/CSSPropertySetterGetterMethods.html" + }, + { + "duration": "11.0", + "name": "blink_perf.css/CSSPropertyUpdateValue.html" + }, + { + "duration": "7.0", + "name": "blink_perf.css/ChangeStyleCSSVariableRecalc.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleChildClassSelector.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleChildElementSelectors.html" + }, + { + "duration": "7.0", + "name": "blink_perf.css/ChangeStyleCustomPropertyDeclaration.html" + }, + { + "duration": "9.0", + "name": "blink_perf.css/ChangeStyleElementSelector.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleGrandChildElementSelector.html" + }, + { + "duration": "9.0", + "name": "blink_perf.css/ChangeStyleMultipleClassSelector.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleMultipleQualifiedDataAttributesWithValuesSelector.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleNestedPseudoSelector.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStylePairOfNthChildSelector.html" + }, + { + "duration": "9.0", + "name": "blink_perf.css/ChangeStylePartialAttributeMatchingSelector.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleQualifiedDataAttributeSelector.html" + }, + { + "duration": "9.0", + "name": "blink_perf.css/ChangeStyleQualifiedDataAttributeWithValueSelector.html" + }, + { + "duration": "11.0", + "name": "blink_perf.css/ChangeStyleShallowTree.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleSingleClassSelector.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleSingleNthChildSelector.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleSinglePseudoSelector.html" + }, + { + "duration": "9.0", + "name": "blink_perf.css/ChangeStyleUniversalSelector.html" + }, + { + "duration": "9.0", + "name": "blink_perf.css/ChangeStyleUnqualifiedDataAttributeSelector.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/ChangeStyleUnqualifiedDataAttributeWithValueSelector.html" + }, + { + "duration": "14.0", + "name": "blink_perf.css/ClassDescendantSelector.html" + }, + { + "duration": "12.0", + "name": "blink_perf.css/ClassInvalidation.html" + }, + { + "duration": "5.0", + "name": "blink_perf.css/CustomPropertiesCascade.html" + }, + { + "duration": "6.0", + "name": "blink_perf.css/CustomPropertiesDependency.html" + }, + { + "duration": "6.0", + "name": "blink_perf.css/CustomPropertiesNonRootInheritance.html" + }, + { + "duration": "6.0", + "name": "blink_perf.css/CustomPropertiesPendingSubstitution.html" + }, + { + "duration": "6.0", + "name": "blink_perf.css/CustomPropertiesRootInheritance.html" + }, + { + "duration": "5.0", + "name": "blink_perf.css/CustomPropertiesVarAlias.html" + }, + { + "duration": "5.0", + "name": "blink_perf.css/ExplicitInheritance.html" + }, + { + "duration": "13.0", + "name": "blink_perf.css/FocusUpdate.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/LoadBootstrapBlog.html" + }, + { + "duration": "10.0", + "name": "blink_perf.css/LoadMaterializeStarterPage.html" + }, + { + "duration": "9.0", + "name": "blink_perf.css/LoadSemanticPageExample.html" + }, + { + "duration": "11.0", + "name": "blink_perf.css/PseudoClassSelectors.html" + }, + { + "duration": "12.0", + "name": "blink_perf.css/SelectorCountScaling.html" + }, + { + "duration": "12.0", + "name": "blink_perf.display_locking/abs_pos_outer_sizes_change.html" + }, + { + "duration": "4.0", + "name": "blink_perf.display_locking/fieldset_container_width_changes.html" + }, + { + "duration": "3.0", + "name": "blink_perf.display_locking/flex_container_width_changes.html" + }, + { + "duration": "3.0", + "name": "blink_perf.display_locking/forced_layout_on_locked_el.html" + }, + { + "duration": "6.0", + "name": "blink_perf.display_locking/inner_sizes_change.html" + }, + { + "duration": "7.0", + "name": "blink_perf.display_locking/outer_sizes_change.html" + }, + { + "duration": "6.0", + "name": "blink_perf.display_locking/outer_sizes_change_activatable.html" + }, + { + "duration": "21.0", + "name": "blink_perf.display_locking/outer_sizes_change_iframe.html" + }, + { + "duration": "5.0", + "name": "blink_perf.display_locking/unlock_top_items.html" + }, + { + "duration": "3.0", + "name": "blink_perf.display_locking/unlock_top_items_nested.html" + }, + { + "duration": "14.0", + "name": "blink_perf.dom/custom-element-default-style-with-shadow.html" + }, + { + "duration": "8.0", + "name": "blink_perf.dom/custom-element-default-style.html" + }, + { + "duration": "12.0", + "name": "blink_perf.dom/long-sibling-list.html" + }, + { + "duration": "5.0", + "name": "blink_perf.dom/modify-element-classname.html" + }, + { + "duration": "4.0", + "name": "blink_perf.dom/modify-element-id.html" + }, + { + "duration": "4.0", + "name": "blink_perf.dom/modify-element-title.html" + }, + { + "duration": "9.0", + "name": "blink_perf.dom/select-multiple-add.html" + }, + { + "duration": "9.0", + "name": "blink_perf.dom/select-single-add.html" + }, + { + "duration": "9.0", + "name": "blink_perf.dom/select-single-remove.html" + }, + { + "duration": "18.0", + "name": "blink_perf.events/EventsDispatching.html" + }, + { + "duration": "10.0", + "name": "blink_perf.events/EventsDispatchingInDeeplyNestedV1ShadowTrees.html" + }, + { + "duration": "27.0", + "name": "blink_perf.events/EventsDispatchingInV1ShadowTrees.html" + }, + { + "duration": "12.0", + "name": "blink_perf.events/hit-test-lots-of-layers.html" + }, + { + "duration": "10.0", + "name": "blink_perf.events/is-input-pending-default-events.html" + }, + { + "duration": "10.0", + "name": "blink_perf.events/is-input-pending-include-continuous-events.html" + }, + { + "duration": "30.0", + "name": "blink_perf.image_decoder/decode-gif.html" + }, + { + "duration": "16.0", + "name": "blink_perf.image_decoder/decode-jpeg-h1v1.html" + }, + { + "duration": "15.0", + "name": "blink_perf.image_decoder/decode-jpeg-h1v2.html" + }, + { + "duration": "15.0", + "name": "blink_perf.image_decoder/decode-jpeg-h2v1.html" + }, + { + "duration": "15.0", + "name": "blink_perf.image_decoder/decode-jpeg-h2v2.html" + }, + { + "duration": "25.0", + "name": "blink_perf.image_decoder/decode-lossless-webp.html" + }, + { + "duration": "13.0", + "name": "blink_perf.image_decoder/decode-lossy-webp.html" + }, + { + "duration": "20.0", + "name": "blink_perf.image_decoder/decode-png-palette-opaque.html" + }, + { + "duration": "15.0", + "name": "blink_perf.image_decoder/decode-png-palette.html" + }, + { + "duration": "29.0", + "name": "blink_perf.image_decoder/decode-png.html" + }, + { + "duration": "29.0", + "name": "blink_perf.layout/ArabicLineLayout.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/Shapes/MultipleShapes.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/SimpleTextPathLineLayout.html" + }, + { + "duration": "12.0", + "name": "blink_perf.layout/abspos.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/add-remove-inline-floats.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/animate-abspos-deep.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/attach-inlines-2.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/attach-inlines.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/auto-grid-lots-of-data.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/auto-grid-lots-of-spanning-data.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/chapter-reflow-once-random.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/chapter-reflow-once.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/chapter-reflow-thrice.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/chapter-reflow-twice.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/chapter-reflow.html" + }, + { + "duration": "6.0", + "name": "blink_perf.layout/character_fallback.html" + }, + { + "duration": "6.0", + "name": "blink_perf.layout/contain-content-style-change.html" + }, + { + "duration": "4.0", + "name": "blink_perf.layout/culled-inline-bounding-rects.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/culled-inline-hittest.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/deeply-nested-grid.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/editing_append.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/editing_append_single_line.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/editing_delete.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/editing_insert.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/editing_prepend.html" + }, + { + "duration": "13.0", + "name": "blink_perf.layout/fit-content-change-available-size-blocks.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/fit-content-change-available-size-text.html" + }, + { + "duration": "10.0", + "name": "blink_perf.layout/fixed-grid-lots-of-data.html" + }, + { + "duration": "10.0", + "name": "blink_perf.layout/fixed-grid-lots-of-stretched-data.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/flexbox-column-nowrap.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/flexbox-column-wrap.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/flexbox-deeply-nested-column-flow.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/flexbox-hittest.html" + }, + { + "duration": "10.0", + "name": "blink_perf.layout/flexbox-input.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/flexbox-lots-of-data.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/flexbox-row-nowrap.html" + }, + { + "duration": "10.0", + "name": "blink_perf.layout/flexbox-row-stretch-height-definite.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/flexbox-row-stretch-height-indefinite.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/flexbox-row-wrap.html" + }, + { + "duration": "10.0", + "name": "blink_perf.layout/flexbox-with-stretch-layout.html" + }, + { + "duration": "11.0", + "name": "blink_perf.layout/flexbox_with_list_item.html" + }, + { + "duration": "7.0", + "name": "blink_perf.layout/floats_100_100.html" + }, + { + "duration": "7.0", + "name": "blink_perf.layout/floats_100_100_nested.html" + }, + { + "duration": "7.0", + "name": "blink_perf.layout/floats_10_1000.html" + }, + { + "duration": "4.0", + "name": "blink_perf.layout/floats_20_100.html" + }, + { + "duration": "4.0", + "name": "blink_perf.layout/floats_20_100_nested.html" + }, + { + "duration": "4.0", + "name": "blink_perf.layout/floats_2_100.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/floats_2_100_nested.html" + }, + { + "duration": "4.0", + "name": "blink_perf.layout/floats_50_100.html" + }, + { + "duration": "4.0", + "name": "blink_perf.layout/floats_50_100_nested.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/floats_show_hide.html" + }, + { + "duration": "54.0", + "name": "blink_perf.layout/hindi-line-layout.html" + }, + { + "duration": "4.0", + "name": "blink_perf.layout/hittest-block-children.html" + }, + { + "duration": "5.0", + "name": "blink_perf.layout/japanese-kokoro-insert.html" + }, + { + "duration": "11.0", + "name": "blink_perf.layout/large-grid.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/large-spanning-grid-item.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/large-table-with-collapsed-borders-and-colspans-wider-than-table.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/large-table-with-collapsed-borders-and-colspans.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/large-table-with-collapsed-borders-and-no-colspans.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/latin-ebook-resize.html" + }, + { + "duration": "6.0", + "name": "blink_perf.layout/latin-ebook.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/layers_overlap_2d.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/layers_overlap_3d.html" + }, + { + "duration": "4.0", + "name": "blink_perf.layout/line-layout-fit-content-break-word.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/line-layout-fit-content.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/line-layout-line-height.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/line-layout-repeat-append-select.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/line-layout-repeat-append.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/line-layout.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/long-line-nowrap-collapse.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/long-line-nowrap-spans-collapse.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/long-line-nowrap.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/many-block-children-auto-inline-size.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/many-block-children-fixed-inline-size.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/multicol/balance-forced-breaks.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/multicol/deeply-nested-tables.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/multicol/fixed-height-with-spanner-and-nested-tables.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/multicol/lots-of-small-nested-unbreakable-blocks-autofill.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/multicol/lots-of-small-unbreakable-blocks-autofill.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/multicol/lots-of-text-autofill.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/multicol/lots-of-text-balanced-orphans-widows.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/multicol/lots-of-text-balanced.html" + }, + { + "duration": "18.0", + "name": "blink_perf.layout/multicol/nested-forced-breaks.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/multicol/tall-content-short-columns-realistic.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/multicol/tall-content-short-columns.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/nested-blocks-with-percent-height-and-max-height.html" + }, + { + "duration": "8.0", + "name": "blink_perf.layout/nested-grid-lots-of-tracks.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/nested-grid.html" + }, + { + "duration": "9.0", + "name": "blink_perf.layout/nested-percent-height-tables.html" + }, + { + "duration": "15.0", + "name": "blink_perf.layout/ruby.html" + }, + { + "duration": "40.0", + "name": "blink_perf.layout/subtree-detaching.html" + }, + { + "duration": "6.0", + "name": "blink_perf.layout/vertical-japanese-kokoro-insert.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/word-break-break-all.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/word-break-break-word.html" + }, + { + "duration": "3.0", + "name": "blink_perf.layout/word-wrap-break-word.html" + }, + { + "duration": "17.0", + "name": "blink_perf.owp_storage/blob-perf-files.html" + }, + { + "duration": "14.0", + "name": "blink_perf.owp_storage/blob-perf-ipc.html" + }, + { + "duration": "12.0", + "name": "blink_perf.owp_storage/blob-perf-shm.html" + }, + { + "duration": "14.0", + "name": "blink_perf.owp_storage/blob-perf-tiny.html" + }, + { + "duration": "15.0", + "name": "blink_perf.owp_storage/idb-load-docs.html" + }, + { + "duration": "15.0", + "name": "blink_perf.paint/appending-text.html" + }, + { + "duration": "16.0", + "name": "blink_perf.paint/color-changes.html" + }, + { + "duration": "15.0", + "name": "blink_perf.paint/complex-content-slow-scroll.html" + }, + { + "duration": "14.0", + "name": "blink_perf.paint/complex-iframe-filtered.html" + }, + { + "duration": "37.0", + "name": "blink_perf.paint/contain-update-layer-tree.html" + }, + { + "duration": "17.0", + "name": "blink_perf.paint/containment-resize.html" + }, + { + "duration": "14.0", + "name": "blink_perf.paint/fixed-and-many-layers-scroll.html" + }, + { + "duration": "15.0", + "name": "blink_perf.paint/large-table-background-change.html" + }, + { + "duration": "14.0", + "name": "blink_perf.paint/large-table-collapsed-border-change.html" + }, + { + "duration": "14.0", + "name": "blink_perf.paint/modify-selection.html" + }, + { + "duration": "13.0", + "name": "blink_perf.paint/move-text-with-mask.html" + }, + { + "duration": "13.0", + "name": "blink_perf.paint/paint-offset-changes.html" + }, + { + "duration": "17.0", + "name": "blink_perf.paint/transform-changes.html" + }, + { + "duration": "14.0", + "name": "blink_perf.parser/css-parser-yui.html" + }, + { + "duration": "15.0", + "name": "blink_perf.parser/declarative-shadow-dom-cloning.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/declarative-shadow-dom.html" + }, + { + "duration": "5.0", + "name": "blink_perf.parser/html-parser-threaded.html" + }, + { + "duration": "6.0", + "name": "blink_perf.parser/html-parser.html" + }, + { + "duration": "27.0", + "name": "blink_perf.parser/html5-full-render.html" + }, + { + "duration": "17.0", + "name": "blink_perf.parser/iframe-append-remove.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/innerHTML-setter-siblings.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/innerHTML-setter.html" + }, + { + "duration": "8.0", + "name": "blink_perf.parser/query-selector-all-attribute-complex.html" + }, + { + "duration": "8.0", + "name": "blink_perf.parser/query-selector-all-attribute.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-all-class-deep.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-all-class-first.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-all-class-last.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-all-class.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-all-deep.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-all-first.html" + }, + { + "duration": "10.0", + "name": "blink_perf.parser/query-selector-all-id-deep.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-all-id-first.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-all-id-last.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-all-last.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-deep.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-first.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-id-deep.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-id-last.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/query-selector-last.html" + }, + { + "duration": "8.0", + "name": "blink_perf.parser/simple-url.html" + }, + { + "duration": "9.0", + "name": "blink_perf.parser/textarea-parsing.html" + }, + { + "duration": "8.0", + "name": "blink_perf.parser/tiny-innerHTML.html" + }, + { + "duration": "11.0", + "name": "blink_perf.parser/url-parser.html" + }, + { + "duration": "8.0", + "name": "blink_perf.parser/xml-parser.html" + }, + { + "duration": "7.0", + "name": "blink_perf.shadow_dom/declarative-api.html" + }, + { + "duration": "1.0", + "name": "blink_perf.shadow_dom/imperative-api-appendchild.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/imperative-api-assign.html" + }, + { + "duration": "1.0", + "name": "blink_perf.shadow_dom/imperative-api-assigned-elements.html" + }, + { + "duration": "1.0", + "name": "blink_perf.shadow_dom/imperative-api-assigned-slot.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/imperative-api-custom-detail-summary-large.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/imperative-api-custom-detail-summary.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/imperative-api-detail-summary-large.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/imperative-api-detail-summary.html" + }, + { + "duration": "1.0", + "name": "blink_perf.shadow_dom/imperative-api-insertbefore.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/imperative-api.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/shadow-style-share-attr-selectors.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/shadow-style-share-media-query.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/shadow-style-share-with-distribution.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/shadow-style-share.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/style-sheet-insert.html" + }, + { + "duration": "7.0", + "name": "blink_perf.shadow_dom/v1-distribution-disconnected-and-reconnected.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-distribution.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-host-child-append.html" + }, + { + "duration": "7.0", + "name": "blink_perf.shadow_dom/v1-large-deep-distribution.html" + }, + { + "duration": "9.0", + "name": "blink_perf.shadow_dom/v1-large-deep-layout.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-large-shallow-append-layout.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-large-shallow-distribution.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-large-shallow-layout.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-large-shallow-prepend-layout.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-mutate-deep-tree-then-re-layout.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-mutate-deep-tree-then-slot-assigned-nodes.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-mutate-deep-tree-then-slot-flatten.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-mutate-shallow-tree-then-re-layout.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-mutate-shallow-tree-then-slot-assigned-nodes.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-mutate-shallow-tree-then-slot-flatten.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-slot-append.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-small-deep-distribution.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-small-deep-layout.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-small-shallow-distribution.html" + }, + { + "duration": "3.0", + "name": "blink_perf.shadow_dom/v1-small-shallow-layout.html" + }, + { + "duration": "9.0", + "name": "blink_perf.svg/AzLizardBenjiPark.html" + }, + { + "duration": "4.0", + "name": "blink_perf.svg/Bamboo.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/Cactus.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/Cowboy.html" + }, + { + "duration": "1.0", + "name": "blink_perf.svg/Cowboy_transform.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/CrawFishGanson.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/Debian.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/DropsOnABlade.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/FlowerFromMyGarden.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/FoodLeifLodahl.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/France.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/FrancoBolloGnomeEzechi.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/GearFlowers.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/HarveyRayner.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/HereGear.html" + }, + { + "duration": "5.0", + "name": "blink_perf.svg/MtSaintHelens.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/Samurai.html" + }, + { + "duration": "1.0", + "name": "blink_perf.svg/SierpinskiCarpet.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/SvgCubics.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/SvgHitTesting.html" + }, + { + "duration": "9.0", + "name": "blink_perf.svg/SvgNestedUse.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/UnderTheSee.html" + }, + { + "duration": "3.0", + "name": "blink_perf.svg/WorldIso.html" + }, + { + "duration": "4.0", + "name": "blink_perf.svg/Worldcup.html" + }, + { + "duration": "21.0", + "name": "blink_perf.webaudio/audio-buffer-source-node.html" + }, + { + "duration": "116.0", + "name": "blink_perf.webaudio/audio-worklet-node.html" + }, + { + "duration": "117.0", + "name": "blink_perf.webaudio/biquad-filter-node.html" + }, + { + "duration": "116.0", + "name": "blink_perf.webaudio/gain-node.html" + }, + { + "duration": "47.0", + "name": "blink_perf.webaudio/panner-node.html" + }, + { + "duration": "38.0", + "name": "dromaeo/http://dromaeo.com?dom-attr" + }, + { + "duration": "35.0", + "name": "dromaeo/http://dromaeo.com?dom-modify" + }, + { + "duration": "48.0", + "name": "dromaeo/http://dromaeo.com?dom-query" + }, + { + "duration": "29.0", + "name": "dromaeo/http://dromaeo.com?dom-traverse" + }, + { + "duration": "8.0", + "name": "dummy_benchmark.noisy_benchmark_1/dummy_page.html" + }, + { + "duration": "5.0", + "name": "dummy_benchmark.stable_benchmark_1/dummy_page.html" + }, + { + "duration": "201.0", + "name": "jetstream/JetStream" + }, + { + "duration": "30.0", + "name": "kraken/http://krakenbenchmark.mozilla.org/kraken-1.1/driver.html" + }, + { + "duration": "25.0", + "name": "loading.desktop/24h_cold" + }, + { + "duration": "28.0", + "name": "loading.desktop/24h_warm" + }, + { + "duration": "35.0", + "name": "loading.desktop/AirBnB_cold" + }, + { + "duration": "46.0", + "name": "loading.desktop/AirBnB_warm" + }, + { + "duration": "22.0", + "name": "loading.desktop/Aljayyash_cold" + }, + { + "duration": "25.0", + "name": "loading.desktop/Aljayyash_warm" + }, + { + "duration": "14.0", + "name": "loading.desktop/AllRecipes_cold" + }, + { + "duration": "40.0", + "name": "loading.desktop/AllRecipes_warm" + }, + { + "duration": "33.0", + "name": "loading.desktop/ArsTechnica_cold" + }, + { + "duration": "44.0", + "name": "loading.desktop/ArsTechnica_warm" + }, + { + "duration": "23.0", + "name": "loading.desktop/Baidu_cold" + }, + { + "duration": "26.0", + "name": "loading.desktop/Baidu_warm" + }, + { + "duration": "26.0", + "name": "loading.desktop/Bhaskar_cold" + }, + { + "duration": "32.0", + "name": "loading.desktop/Bhaskar_warm" + }, + { + "duration": "28.0", + "name": "loading.desktop/Chosun_cold" + }, + { + "duration": "32.0", + "name": "loading.desktop/Chosun_warm" + }, + { + "duration": "25.0", + "name": "loading.desktop/Colorado.edu_cold" + }, + { + "duration": "29.0", + "name": "loading.desktop/Colorado.edu_warm" + }, + { + "duration": "28.0", + "name": "loading.desktop/Danawa_cold" + }, + { + "duration": "32.0", + "name": "loading.desktop/Danawa_warm" + }, + { + "duration": "28.0", + "name": "loading.desktop/Daum_cold" + }, + { + "duration": "31.0", + "name": "loading.desktop/Daum_warm" + }, + { + "duration": "28.0", + "name": "loading.desktop/Donga_cold" + }, + { + "duration": "32.0", + "name": "loading.desktop/Donga_warm" + }, + { + "duration": "33.0", + "name": "loading.desktop/Economist_cold" + }, + { + "duration": "52.0", + "name": "loading.desktop/Economist_warm" + }, + { + "duration": "28.0", + "name": "loading.desktop/Elmundo_cold" + }, + { + "duration": "12.0", + "name": "loading.desktop/Elmundo_warm" + }, + { + "duration": "25.0", + "name": "loading.desktop/FC2Blog_cold" + }, + { + "duration": "28.0", + "name": "loading.desktop/FC2Blog_warm" + }, + { + "duration": "29.0", + "name": "loading.desktop/FIFA_cold" + }, + { + "duration": "35.0", + "name": "loading.desktop/FIFA_warm" + }, + { + "duration": "36.0", + "name": "loading.desktop/FarsNews_cold" + }, + { + "duration": "26.0", + "name": "loading.desktop/FarsNews_warm" + }, + { + "duration": "26.0", + "name": "loading.desktop/Flickr_cold" + }, + { + "duration": "30.0", + "name": "loading.desktop/Flickr_warm" + }, + { + "duration": "22.0", + "name": "loading.desktop/FlipKart_cold" + }, + { + "duration": "26.0", + "name": "loading.desktop/FlipKart_warm" + }, + { + "duration": "22.0", + "name": "loading.desktop/Free.fr_cold" + }, + { + "duration": "25.0", + "name": "loading.desktop/Free.fr_warm" + }, + { + "duration": "24.0", + "name": "loading.desktop/HTML5Rocks_cold" + }, + { + "duration": "26.0", + "name": "loading.desktop/HTML5Rocks_warm" + }, + { + "duration": "21.0", + "name": "loading.desktop/Haraj_cold" + }, + { + "duration": "24.0", + "name": "loading.desktop/Haraj_warm" + }, + { + "duration": "25.0", + "name": "loading.desktop/HatenaBookmark_cold" + }, + { + "duration": "29.0", + "name": "loading.desktop/HatenaBookmark_warm" + }, + { + "duration": "29.0", + "name": "loading.desktop/IGN_cold" + }, + { + "duration": "33.0", + "name": "loading.desktop/IGN_warm" + }, + { + "duration": "26.0", + "name": "loading.desktop/IMDB_cold" + }, + { + "duration": "31.0", + "name": "loading.desktop/IMDB_warm" + }, + { + "duration": "24.0", + "name": "loading.desktop/IndiaTimes_cold" + }, + { + "duration": "28.0", + "name": "loading.desktop/IndiaTimes_warm" + }, + { + "duration": "26.0", + "name": "loading.desktop/Kakaku_cold" + }, + { + "duration": "30.0", + "name": "loading.desktop/Kakaku_warm" + }, + { + "duration": "34.0", + "name": "loading.desktop/Kenh14_cold" + }, + { + "duration": "45.0", + "name": "loading.desktop/Kenh14_warm" + }, + { + "duration": "22.0", + "name": "loading.desktop/Mercadolivre_cold" + }, + { + "duration": "26.0", + "name": "loading.desktop/Mercadolivre_warm" + }, + { + "duration": "27.0", + "name": "loading.desktop/Naver_cold" + }, + { + "duration": "30.0", + "name": "loading.desktop/Naver_warm" + }, + { + "duration": "23.0", + "name": "loading.desktop/Orange_cold" + }, + { + "duration": "25.0", + "name": "loading.desktop/Orange_warm" + }, + { + "duration": "28.0", + "name": "loading.desktop/Pantip_cold" + }, + { + "duration": "32.0", + "name": "loading.desktop/Pantip_warm" + }, + { + "duration": "26.0", + "name": "loading.desktop/PremierLeague_cold" + }, + { + "duration": "31.0", + "name": "loading.desktop/PremierLeague_warm" + }, + { + "duration": "26.0", + "name": "loading.desktop/QQ_cold" + }, + { + "duration": "32.0", + "name": "loading.desktop/QQ_warm" + }, + { + "duration": "28.0", + "name": "loading.desktop/REI_cold" + }, + { + "duration": "32.0", + "name": "loading.desktop/REI_warm" + }, + { + "duration": "24.0", + "name": "loading.desktop/Ruten_cold" + }, + { + "duration": "27.0", + "name": "loading.desktop/Ruten_warm" + }, + { + "duration": "26.0", + "name": "loading.desktop/Sina_cold" + }, + { + "duration": "33.0", + "name": "loading.desktop/Sina_warm" + }, + { + "duration": "27.0", + "name": "loading.desktop/Taobao_cold" + }, + { + "duration": "33.0", + "name": "loading.desktop/Taobao_warm" + }, + { + "duration": "28.0", + "name": "loading.desktop/TheOnion_cold" + }, + { + "duration": "34.0", + "name": "loading.desktop/TheOnion_warm" + }, + { + "duration": "32.0", + "name": "loading.desktop/TheVerge_cold" + }, + { + "duration": "38.0", + "name": "loading.desktop/TheVerge_warm" + }, + { + "duration": "29.0", + "name": "loading.desktop/TicketMaster_cold" + }, + { + "duration": "49.0", + "name": "loading.desktop/TicketMaster_warm" + }, + { + "duration": "32.0", + "name": "loading.desktop/Vietnamnet_cold" + }, + { + "duration": "40.0", + "name": "loading.desktop/Vietnamnet_warm" + }, + { + "duration": "27.0", + "name": "loading.desktop/Vnexpress_cold" + }, + { + "duration": "50.0", + "name": "loading.desktop/Vnexpress_warm" + }, + { + "duration": "14.0", + "name": "loading.desktop/Walgreens_cold" + }, + { + "duration": "14.0", + "name": "loading.desktop/Walgreens_warm" + }, + { + "duration": "23.0", + "name": "loading.desktop/Yandex_cold" + }, + { + "duration": "27.0", + "name": "loading.desktop/Yandex_warm" + }, + { + "duration": "25.0", + "name": "loading.desktop/amazon.co.jp_cold" + }, + { + "duration": "46.0", + "name": "loading.desktop/amazon.co.jp_warm" + }, + { + "duration": "24.0", + "name": "loading.desktop/ja.wikipedia_cold" + }, + { + "duration": "28.0", + "name": "loading.desktop/ja.wikipedia_warm" + }, + { + "duration": "31.0", + "name": "loading.desktop/money.cnn_cold" + }, + { + "duration": "40.0", + "name": "loading.desktop/money.cnn_warm" + }, + { + "duration": "24.0", + "name": "loading.desktop/ru.wikipedia_cold" + }, + { + "duration": "26.0", + "name": "loading.desktop/ru.wikipedia_warm" + }, + { + "duration": "26.0", + "name": "loading.desktop/uol.com.br_cold" + }, + { + "duration": "34.0", + "name": "loading.desktop/uol.com.br_warm" + }, + { + "duration": "25.0", + "name": "loading.desktop/yahoo.co.jp_cold" + }, + { + "duration": "29.0", + "name": "loading.desktop/yahoo.co.jp_warm" + }, + { + "duration": "18.0", + "name": "media.desktop/mse.html?media=aac_audio.mp4" + }, + { + "duration": "18.0", + "name": "media.desktop/mse.html?media=aac_audio.mp4,h264_video.mp4" + }, + { + "duration": "18.0", + "name": "media.desktop/mse.html?media=h264_video.mp4" + }, + { + "duration": "18.0", + "name": "media.desktop/mse.html?media=tulip0.av1.mp4" + }, + { + "duration": "19.0", + "name": "media.desktop/mse.html?media=tulip2.vp9.webm" + }, + { + "duration": "137.0", + "name": "media.desktop/video.html?src=boat_1080p60fps_vp9.webm" + }, + { + "duration": "24.0", + "name": "media.desktop/video.html?src=crowd1080.mp4" + }, + { + "duration": "26.0", + "name": "media.desktop/video.html?src=crowd1080.webm" + }, + { + "duration": "23.0", + "name": "media.desktop/video.html?src=crowd1080_vp9.webm" + }, + { + "duration": "138.0", + "name": "media.desktop/video.html?src=foodmarket_720p30fps.mp4" + }, + { + "duration": "18.0", + "name": "media.desktop/video.html?src=garden2_10s.mp4&seek" + }, + { + "duration": "18.0", + "name": "media.desktop/video.html?src=garden2_10s.webm&seek" + }, + { + "duration": "20.0", + "name": "media.desktop/video.html?src=smpte_3840x2160_60fps_vp9.webm&seek" + }, + { + "duration": "24.0", + "name": "media.desktop/video.html?src=tulip0.av1.mp4" + }, + { + "duration": "17.0", + "name": "media.desktop/video.html?src=tulip0.av1.mp4&seek" + }, + { + "duration": "30.0", + "name": "media.desktop/video.html?src=tulip2.m4a&type=audio" + }, + { + "duration": "30.0", + "name": "media.desktop/video.html?src=tulip2.mp3&type=audio" + }, + { + "duration": "17.0", + "name": "media.desktop/video.html?src=tulip2.mp3&type=audio&seek" + }, + { + "duration": "31.0", + "name": "media.desktop/video.html?src=tulip2.mp4" + }, + { + "duration": "31.0", + "name": "media.desktop/video.html?src=tulip2.mp4&busyjs" + }, + { + "duration": "30.0", + "name": "media.desktop/video.html?src=tulip2.ogg&type=audio" + }, + { + "duration": "17.0", + "name": "media.desktop/video.html?src=tulip2.ogg&type=audio&seek" + }, + { + "duration": "31.0", + "name": "media.desktop/video.html?src=tulip2.vp9.webm" + }, + { + "duration": "24.0", + "name": "media.desktop/video.html?src=tulip2.vp9.webm&background" + }, + { + "duration": "32.0", + "name": "media.desktop/video.html?src=tulip2.vp9.webm_WiFi" + }, + { + "duration": "18.0", + "name": "memory.desktop/TrivialAnimationPageSharedPageState" + }, + { + "duration": "19.0", + "name": "memory.desktop/TrivialBlinkingCursorPageSharedPageState" + }, + { + "duration": "18.0", + "name": "memory.desktop/TrivialBlurAnimationPageSharedPageState" + }, + { + "duration": "19.0", + "name": "memory.desktop/TrivialCanvasPageSharedPageState" + }, + { + "duration": "19.0", + "name": "memory.desktop/TrivialFullscreenVideoPageSharedPageState" + }, + { + "duration": "18.0", + "name": "memory.desktop/TrivialGifPageSharedPageState" + }, + { + "duration": "20.0", + "name": "memory.desktop/TrivialScrollingPageSharedPageState" + }, + { + "duration": "19.0", + "name": "memory.desktop/TrivialWebGLPageSharedPageState" + }, + { + "duration": "54.0", + "name": "memory.desktop/WebWorker" + }, + { + "duration": "47.0", + "name": "octane/Octane" + }, + { + "duration": "48.0", + "name": "power.desktop/TrivialAnimationPageSharedPageState" + }, + { + "duration": "42.0", + "name": "power.desktop/TrivialBlinkingCursorPageSharedPageState" + }, + { + "duration": "43.0", + "name": "power.desktop/TrivialBlurAnimationPageSharedPageState" + }, + { + "duration": "43.0", + "name": "power.desktop/TrivialCanvasPageSharedPageState" + }, + { + "duration": "44.0", + "name": "power.desktop/TrivialFullscreenVideoPageSharedPageState" + }, + { + "duration": "43.0", + "name": "power.desktop/TrivialGifPageSharedPageState" + }, + { + "duration": "45.0", + "name": "power.desktop/TrivialScrollingPageSharedPageState" + }, + { + "duration": "43.0", + "name": "power.desktop/TrivialWebGLPageSharedPageState" + }, + { + "duration": "57.0", + "name": "power.desktop/abcnews" + }, + { + "duration": "47.0", + "name": "power.desktop/indiatimes" + }, + { + "duration": "46.0", + "name": "power.desktop/instagram" + }, + { + "duration": "47.0", + "name": "power.desktop/microsoft" + }, + { + "duration": "48.0", + "name": "power.desktop/sina" + }, + { + "duration": "47.0", + "name": "power.desktop/slideshare" + }, + { + "duration": "48.0", + "name": "power.desktop/uol" + }, + { + "duration": "14.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/amazon.html" + }, + { + "duration": "7.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/blogger.html" + }, + { + "duration": "8.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/booking.html" + }, + { + "duration": "8.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/cnn.html" + }, + { + "duration": "7.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/ebay.html" + }, + { + "duration": "10.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/espn.html" + }, + { + "duration": "7.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/facebook.html" + }, + { + "duration": "8.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/gmail.html" + }, + { + "duration": "7.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/google.html" + }, + { + "duration": "6.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/googlecalendar.html" + }, + { + "duration": "7.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/googledocs.html" + }, + { + "duration": "8.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/googleimagesearch.html" + }, + { + "duration": "10.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/googleplus.html" + }, + { + "duration": "6.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/linkedin.html" + }, + { + "duration": "6.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/pinterest.html" + }, + { + "duration": "9.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/techcrunch.html" + }, + { + "duration": "10.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/twitter.html" + }, + { + "duration": "7.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/weather.html" + }, + { + "duration": "1.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/wikipedia.html" + }, + { + "duration": "7.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/wordpress.html" + }, + { + "duration": "7.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/yahooanswers.html" + }, + { + "duration": "7.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/yahoogames.html" + }, + { + "duration": "8.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/yahoonews.html" + }, + { + "duration": "9.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/yahoosports.html" + }, + { + "duration": "8.0", + "name": "rasterize_and_record_micro.top_25/file://static_top_25/youtube.html" + }, + { + "duration": "35.0", + "name": "rendering.desktop/accu_weather_2018" + }, + { + "duration": "41.0", + "name": "rendering.desktop/accu_weather_pinch_2018" + }, + { + "duration": "29.0", + "name": "rendering.desktop/amazon_2018" + }, + { + "duration": "27.0", + "name": "rendering.desktop/amazon_pinch_2018" + }, + { + "duration": "30.0", + "name": "rendering.desktop/analog_clock_svg" + }, + { + "duration": "34.0", + "name": "rendering.desktop/animometer_webgl" + }, + { + "duration": "33.0", + "name": "rendering.desktop/animometer_webgl_attrib_arrays" + }, + { + "duration": "33.0", + "name": "rendering.desktop/animometer_webgl_fast_call" + }, + { + "duration": "40.0", + "name": "rendering.desktop/animometer_webgl_indexed" + }, + { + "duration": "39.0", + "name": "rendering.desktop/animometer_webgl_indexed_fast_call" + }, + { + "duration": "33.0", + "name": "rendering.desktop/animometer_webgl_indexed_multi_draw" + }, + { + "duration": "33.0", + "name": "rendering.desktop/animometer_webgl_indexed_multi_draw_base_vertex_base_instance" + }, + { + "duration": "60.0", + "name": "rendering.desktop/animometer_webgl_multi_draw" + }, + { + "duration": "34.0", + "name": "rendering.desktop/aquarium" + }, + { + "duration": "38.0", + "name": "rendering.desktop/aquarium_20k" + }, + { + "duration": "36.0", + "name": "rendering.desktop/aquarium_20k_fast_call" + }, + { + "duration": "33.0", + "name": "rendering.desktop/background_color_animation" + }, + { + "duration": "29.0", + "name": "rendering.desktop/background_color_animation_with_gradient" + }, + { + "duration": "30.0", + "name": "rendering.desktop/balls_css_key_frame_animations" + }, + { + "duration": "33.0", + "name": "rendering.desktop/balls_css_key_frame_animations_composited_transform" + }, + { + "duration": "30.0", + "name": "rendering.desktop/balls_css_transition_2_properties" + }, + { + "duration": "30.0", + "name": "rendering.desktop/balls_css_transition_40_properties" + }, + { + "duration": "30.0", + "name": "rendering.desktop/balls_css_transition_all_properties" + }, + { + "duration": "31.0", + "name": "rendering.desktop/balls_javascript_canvas" + }, + { + "duration": "27.0", + "name": "rendering.desktop/balls_javascript_css" + }, + { + "duration": "28.0", + "name": "rendering.desktop/balls_svg_animations" + }, + { + "duration": "30.0", + "name": "rendering.desktop/blob" + }, + { + "duration": "36.0", + "name": "rendering.desktop/blogspot_2018" + }, + { + "duration": "29.0", + "name": "rendering.desktop/blogspot_pinch_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/blur_rotating_background" + }, + { + "duration": "23.0", + "name": "rendering.desktop/booking.com_2018" + }, + { + "duration": "24.0", + "name": "rendering.desktop/booking_pinch_2018" + }, + { + "duration": "27.0", + "name": "rendering.desktop/bouncing_balls_15" + }, + { + "duration": "28.0", + "name": "rendering.desktop/bouncing_balls_shadow" + }, + { + "duration": "27.0", + "name": "rendering.desktop/bouncing_clipped_rectangles" + }, + { + "duration": "27.0", + "name": "rendering.desktop/bouncing_gradient_circles" + }, + { + "duration": "26.0", + "name": "rendering.desktop/bouncing_png_images" + }, + { + "duration": "28.0", + "name": "rendering.desktop/bouncing_svg_images" + }, + { + "duration": "31.0", + "name": "rendering.desktop/camera_to_webgl" + }, + { + "duration": "27.0", + "name": "rendering.desktop/canvas2d_to_texture.html" + }, + { + "duration": "36.0", + "name": "rendering.desktop/canvas_05000_pixels_per_second" + }, + { + "duration": "34.0", + "name": "rendering.desktop/canvas_10000_pixels_per_second" + }, + { + "duration": "32.0", + "name": "rendering.desktop/canvas_20000_pixels_per_second" + }, + { + "duration": "32.0", + "name": "rendering.desktop/canvas_40000_pixels_per_second" + }, + { + "duration": "32.0", + "name": "rendering.desktop/canvas_60000_pixels_per_second" + }, + { + "duration": "40.0", + "name": "rendering.desktop/canvas_75000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/canvas_90000_pixels_per_second" + }, + { + "duration": "27.0", + "name": "rendering.desktop/canvas_animation_no_clear" + }, + { + "duration": "27.0", + "name": "rendering.desktop/canvas_arcs" + }, + { + "duration": "27.0", + "name": "rendering.desktop/canvas_font_cycler" + }, + { + "duration": "27.0", + "name": "rendering.desktop/canvas_lines" + }, + { + "duration": "27.0", + "name": "rendering.desktop/canvas_to_blob" + }, + { + "duration": "27.0", + "name": "rendering.desktop/canvas_to_canvas_draw" + }, + { + "duration": "21.0", + "name": "rendering.desktop/cats_unscaled" + }, + { + "duration": "20.0", + "name": "rendering.desktop/cats_viewport_width" + }, + { + "duration": "30.0", + "name": "rendering.desktop/cc_poster_circle" + }, + { + "duration": "24.0", + "name": "rendering.desktop/cc_scroll_text_only" + }, + { + "duration": "30.0", + "name": "rendering.desktop/chip_tune" + }, + { + "duration": "25.0", + "name": "rendering.desktop/cnn_2018" + }, + { + "duration": "31.0", + "name": "rendering.desktop/cnn_pinch_2018" + }, + { + "duration": "27.0", + "name": "rendering.desktop/compositor_heavy_animation" + }, + { + "duration": "27.0", + "name": "rendering.desktop/crafty_mind" + }, + { + "duration": "29.0", + "name": "rendering.desktop/css_animations_many_keyframes" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_animations_simultaneous_inline_style" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_animations_simultaneous_new_element" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_animations_simultaneous_style_element" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_animations_simultaneous_updating_class" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_animations_staggered_infinite_iterations" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_animations_staggered_inline_style" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_animations_staggered_new_element" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_animations_staggered_style_element" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_animations_staggered_updating_class" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_animations_triggered_inline_style" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_animations_triggered_new_element" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_animations_triggered_style_element" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_animations_triggered_updating_class" + }, + { + "duration": "30.0", + "name": "rendering.desktop/css_opacity_plus_n_layers_99" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_inline_style" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_new_element" + }, + { + "duration": "27.0", + "name": "rendering.desktop/css_transitions_staggered_inline_style" + }, + { + "duration": "31.0", + "name": "rendering.desktop/css_transitions_staggered_new_element" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_staggered_style_element" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_staggered_updating_class" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_style_element" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_triggered_inline_style" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_triggered_new_element" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_triggered_style_element" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_triggered_updating_class" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_transitions_updating_class" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_value_type_color" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_value_type_filter" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_value_type_length" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_value_type_length_complex" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_value_type_length_simple" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_value_type_path" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_value_type_shadow" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_value_type_transform_complex" + }, + { + "duration": "26.0", + "name": "rendering.desktop/css_value_type_transform_simple" + }, + { + "duration": "26.0", + "name": "rendering.desktop/docs_paper.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/docs_resume.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/docs_table.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/draw_image" + }, + { + "duration": "26.0", + "name": "rendering.desktop/draw_image_not_pixel_aligned" + }, + { + "duration": "26.0", + "name": "rendering.desktop/dynamic_canvas_to_hw_accelerated_canvas.html" + }, + { + "duration": "30.0", + "name": "rendering.desktop/dynamic_cube_map" + }, + { + "duration": "26.0", + "name": "rendering.desktop/dynamic_webgl_to_hw_accelerated_canvas.html" + }, + { + "duration": "28.0", + "name": "rendering.desktop/earth" + }, + { + "duration": "23.0", + "name": "rendering.desktop/ebay_2018" + }, + { + "duration": "29.0", + "name": "rendering.desktop/ebay_pinch_2018" + }, + { + "duration": "30.0", + "name": "rendering.desktop/effect_games" + }, + { + "duration": "34.0", + "name": "rendering.desktop/espn_2018" + }, + { + "duration": "27.0", + "name": "rendering.desktop/espn_pinch_2018" + }, + { + "duration": "26.0", + "name": "rendering.desktop/extra_large_texture_uploads" + }, + { + "duration": "23.0", + "name": "rendering.desktop/facebook_2018" + }, + { + "duration": "24.0", + "name": "rendering.desktop/facebook_pinch_2018" + }, + { + "duration": "26.0", + "name": "rendering.desktop/falling_particle_simulation_cpu.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/falling_particle_simulation_gpu.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/fill_clear_rect.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/fill_shapes" + }, + { + "duration": "27.0", + "name": "rendering.desktop/filter_terrain_svg" + }, + { + "duration": "26.0", + "name": "rendering.desktop/geo_apis" + }, + { + "duration": "26.0", + "name": "rendering.desktop/get_image_data_cpu.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/get_image_data_gpu.html" + }, + { + "duration": "24.0", + "name": "rendering.desktop/gmail_2018" + }, + { + "duration": "38.0", + "name": "rendering.desktop/gmail_move_2018" + }, + { + "duration": "24.0", + "name": "rendering.desktop/gmail_pinch_2018" + }, + { + "duration": "21.0", + "name": "rendering.desktop/google_calendar_2018" + }, + { + "duration": "23.0", + "name": "rendering.desktop/google_calendar_pinch_2018" + }, + { + "duration": "25.0", + "name": "rendering.desktop/google_docs_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/google_image_pinch_2018" + }, + { + "duration": "23.0", + "name": "rendering.desktop/google_image_search_2018" + }, + { + "duration": "33.0", + "name": "rendering.desktop/google_plus_2018" + }, + { + "duration": "27.0", + "name": "rendering.desktop/google_search_pinch_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/google_web_search_2018" + }, + { + "duration": "31.0", + "name": "rendering.desktop/gpu_bound_shader.html" + }, + { + "duration": "27.0", + "name": "rendering.desktop/guimark_vector_chart" + }, + { + "duration": "30.0", + "name": "rendering.desktop/hakim" + }, + { + "duration": "26.0", + "name": "rendering.desktop/hw_accelerated_canvas_to_sw_canvas.html" + }, + { + "duration": "38.0", + "name": "rendering.desktop/ie_chalkboard" + }, + { + "duration": "29.0", + "name": "rendering.desktop/ie_pirate_mark" + }, + { + "duration": "28.0", + "name": "rendering.desktop/infinite_scroll_element_n_layers_99" + }, + { + "duration": "28.0", + "name": "rendering.desktop/infinite_scroll_root_fixed_n_layers_99" + }, + { + "duration": "28.0", + "name": "rendering.desktop/infinite_scroll_root_n_layers_99" + }, + { + "duration": "27.0", + "name": "rendering.desktop/jarro_doverson" + }, + { + "duration": "22.0", + "name": "rendering.desktop/jpeg_decoding_rgb_and_gpu_rasterization" + }, + { + "duration": "22.0", + "name": "rendering.desktop/jpeg_decoding_yuv_and_gpu_rasterization" + }, + { + "duration": "30.0", + "name": "rendering.desktop/js_full_screen_invalidation" + }, + { + "duration": "29.0", + "name": "rendering.desktop/js_opacity_plus_n_layers_99" + }, + { + "duration": "29.0", + "name": "rendering.desktop/js_paint_plus_n_layers_99" + }, + { + "duration": "29.0", + "name": "rendering.desktop/js_poster_circle" + }, + { + "duration": "29.0", + "name": "rendering.desktop/js_scroll_text_only" + }, + { + "duration": "27.0", + "name": "rendering.desktop/kevs_3d" + }, + { + "duration": "26.0", + "name": "rendering.desktop/keyframed_animations" + }, + { + "duration": "26.0", + "name": "rendering.desktop/large_texture_uploads" + }, + { + "duration": "24.0", + "name": "rendering.desktop/linkedin_2018" + }, + { + "duration": "25.0", + "name": "rendering.desktop/linkedin_pinch_2018" + }, + { + "duration": "69.0", + "name": "rendering.desktop/lost_crypt" + }, + { + "duration": "63.0", + "name": "rendering.desktop/lost_crypt_fast_call" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_0fps_impl_60fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_0fps_impl_60fps_no_update" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_0fps_impl_60fps_no_update_jank" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_0fps_with_jank_impl_0fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_15fps_impl_0fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_15fps_with_jank_impl_0fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_30fps_impl_0fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_30fps_impl_60fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_60fps_impl_0fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_60fps_impl_60fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_60fps_impl_60fps_no_update" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_60fps_impl_60fps_no_update_jank" + }, + { + "duration": "42.0", + "name": "rendering.desktop/main_60fps_with_extreme_jank_impl_0fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/main_60fps_with_jank_and_delay_impl_60fps" + }, + { + "duration": "27.0", + "name": "rendering.desktop/main_60fps_with_jank_impl_0fps" + }, + { + "duration": "27.0", + "name": "rendering.desktop/main_animations_half_presented" + }, + { + "duration": "26.0", + "name": "rendering.desktop/man_in_blue" + }, + { + "duration": "29.0", + "name": "rendering.desktop/many_images" + }, + { + "duration": "30.0", + "name": "rendering.desktop/many_planets_deep" + }, + { + "duration": "27.0", + "name": "rendering.desktop/maps_move_2018" + }, + { + "duration": "26.0", + "name": "rendering.desktop/maps_perf_test" + }, + { + "duration": "26.0", + "name": "rendering.desktop/medium_texture_uploads" + }, + { + "duration": "26.0", + "name": "rendering.desktop/megi_dish" + }, + { + "duration": "62.0", + "name": "rendering.desktop/microgame_fps" + }, + { + "duration": "67.0", + "name": "rendering.desktop/microgame_fps_fast_call" + }, + { + "duration": "29.0", + "name": "rendering.desktop/microsoft_asteroid_belt" + }, + { + "duration": "26.0", + "name": "rendering.desktop/microsoft_fireflies" + }, + { + "duration": "26.0", + "name": "rendering.desktop/microsoft_fish_ie_tank" + }, + { + "duration": "26.0", + "name": "rendering.desktop/microsoft_performance" + }, + { + "duration": "26.0", + "name": "rendering.desktop/microsoft_snow" + }, + { + "duration": "26.0", + "name": "rendering.desktop/microsoft_speed_reading" + }, + { + "duration": "26.0", + "name": "rendering.desktop/microsoft_tweet_map" + }, + { + "duration": "27.0", + "name": "rendering.desktop/microsoft_video_city" + }, + { + "duration": "26.0", + "name": "rendering.desktop/microsoft_worker_fountains" + }, + { + "duration": "26.0", + "name": "rendering.desktop/mix_10k" + }, + { + "duration": "13.0", + "name": "rendering.desktop/mix_blend_mode_animation_difference" + }, + { + "duration": "13.0", + "name": "rendering.desktop/mix_blend_mode_animation_hue" + }, + { + "duration": "30.0", + "name": "rendering.desktop/mix_blend_mode_animation_propagating_isolation" + }, + { + "duration": "25.0", + "name": "rendering.desktop/mix_blend_mode_animation_screen" + }, + { + "duration": "26.0", + "name": "rendering.desktop/motion_mark_canvas_fill_shapes" + }, + { + "duration": "26.0", + "name": "rendering.desktop/motion_mark_canvas_stroke_shapes" + }, + { + "duration": "29.0", + "name": "rendering.desktop/new_tilings" + }, + { + "duration": "29.0", + "name": "rendering.desktop/nvidia_vertex_buffer_object" + }, + { + "duration": "26.0", + "name": "rendering.desktop/off_screen_main_60fps" + }, + { + "duration": "26.0", + "name": "rendering.desktop/off_screen_main_60fps_jank" + }, + { + "duration": "27.0", + "name": "rendering.desktop/overlay_background_color_css_transitions_page" + }, + { + "duration": "28.0", + "name": "rendering.desktop/particles" + }, + { + "duration": "31.0", + "name": "rendering.desktop/pinterest_2018" + }, + { + "duration": "26.0", + "name": "rendering.desktop/put_and_create_imagebitmap_from_imagedata" + }, + { + "duration": "26.0", + "name": "rendering.desktop/put_get_image_data" + }, + { + "duration": "26.0", + "name": "rendering.desktop/put_image_data.html" + }, + { + "duration": "23.0", + "name": "rendering.desktop/raf" + }, + { + "duration": "23.0", + "name": "rendering.desktop/raf_animation" + }, + { + "duration": "23.0", + "name": "rendering.desktop/raf_canvas" + }, + { + "duration": "23.0", + "name": "rendering.desktop/raf_touch_animation" + }, + { + "duration": "26.0", + "name": "rendering.desktop/repaint_amazon_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/repaint_cnn_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/repaint_facebook_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/repaint_google_search_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/repaint_instagram_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/repaint_reddit_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/repaint_theverge_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/repaint_twitter_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/repaint_wikipedia_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/repaint_yahoo_homepage_2018" + }, + { + "duration": "26.0", + "name": "rendering.desktop/runway_2019" + }, + { + "duration": "28.0", + "name": "rendering.desktop/san_angeles" + }, + { + "duration": "24.0", + "name": "rendering.desktop/second_batch_js_heavy" + }, + { + "duration": "23.0", + "name": "rendering.desktop/second_batch_js_light" + }, + { + "duration": "23.0", + "name": "rendering.desktop/second_batch_js_medium" + }, + { + "duration": "29.0", + "name": "rendering.desktop/sheets_render.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/simple_text_page" + }, + { + "duration": "19.0", + "name": "rendering.desktop/simple_touch_drag" + }, + { + "duration": "71.0", + "name": "rendering.desktop/skelebuddies_wasm_2020" + }, + { + "duration": "64.0", + "name": "rendering.desktop/skelebuddies_wasm_2020_fast_call" + }, + { + "duration": "29.0", + "name": "rendering.desktop/small_texture_uploads" + }, + { + "duration": "33.0", + "name": "rendering.desktop/smash_cat" + }, + { + "duration": "29.0", + "name": "rendering.desktop/spielzeugz" + }, + { + "duration": "29.0", + "name": "rendering.desktop/static_canvas_to_hw_accelerated_canvas.html" + }, + { + "duration": "29.0", + "name": "rendering.desktop/static_webgl_to_hw_accelerated_canvas.html" + }, + { + "duration": "29.0", + "name": "rendering.desktop/stroke_shapes" + }, + { + "duration": "23.0", + "name": "rendering.desktop/sync_scroll_offset" + }, + { + "duration": "38.0", + "name": "rendering.desktop/techcrunch_2018" + }, + { + "duration": "39.0", + "name": "rendering.desktop/text_05000_pixels_per_second" + }, + { + "duration": "37.0", + "name": "rendering.desktop/text_10000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_20000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_40000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_60000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_75000_pixels_per_second" + }, + { + "duration": "34.0", + "name": "rendering.desktop/text_90000_pixels_per_second" + }, + { + "duration": "40.0", + "name": "rendering.desktop/text_constant_full_page_raster_05000_pixels_per_second" + }, + { + "duration": "38.0", + "name": "rendering.desktop/text_constant_full_page_raster_10000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_constant_full_page_raster_20000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_constant_full_page_raster_40000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_constant_full_page_raster_60000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_constant_full_page_raster_75000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_constant_full_page_raster_90000_pixels_per_second" + }, + { + "duration": "39.0", + "name": "rendering.desktop/text_hover_05000_pixels_per_second" + }, + { + "duration": "37.0", + "name": "rendering.desktop/text_hover_10000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_hover_20000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_hover_40000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_hover_60000_pixels_per_second" + }, + { + "duration": "35.0", + "name": "rendering.desktop/text_hover_75000_pixels_per_second" + }, + { + "duration": "34.0", + "name": "rendering.desktop/text_hover_90000_pixels_per_second" + }, + { + "duration": "32.0", + "name": "rendering.desktop/throughput_scrolling_active_handler" + }, + { + "duration": "32.0", + "name": "rendering.desktop/throughput_scrolling_composited" + }, + { + "duration": "32.0", + "name": "rendering.desktop/throughput_scrolling_passive_handler" + }, + { + "duration": "32.0", + "name": "rendering.desktop/throughput_scrolling_uncomposited" + }, + { + "duration": "64.0", + "name": "rendering.desktop/tiny_racing_v3_wasm_2020" + }, + { + "duration": "64.0", + "name": "rendering.desktop/tiny_racing_v3_wasm_2020_fast_call" + }, + { + "duration": "30.0", + "name": "rendering.desktop/toBlob_duration.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/toBlob_duration_jpeg.html" + }, + { + "duration": "26.0", + "name": "rendering.desktop/toBlob_small_canvas_in_worker.html" + }, + { + "duration": "22.0", + "name": "rendering.desktop/touch_handler_scrolling" + }, + { + "duration": "25.0", + "name": "rendering.desktop/transfer_from_imageBitmap.html" + }, + { + "duration": "25.0", + "name": "rendering.desktop/transform_transitions" + }, + { + "duration": "25.0", + "name": "rendering.desktop/transform_transitions_js_block" + }, + { + "duration": "32.0", + "name": "rendering.desktop/twitch_2018" + }, + { + "duration": "29.0", + "name": "rendering.desktop/twitch_pinch_2018" + }, + { + "duration": "24.0", + "name": "rendering.desktop/twitter_2018" + }, + { + "duration": "22.0", + "name": "rendering.desktop/twitter_pinch_2018" + }, + { + "duration": "26.0", + "name": "rendering.desktop/video_to_hw_accelerated_canvas" + }, + { + "duration": "25.0", + "name": "rendering.desktop/video_to_sub_texture" + }, + { + "duration": "25.0", + "name": "rendering.desktop/video_to_sub_texture_flip_and_premultiply" + }, + { + "duration": "25.0", + "name": "rendering.desktop/video_to_sub_texture_flip_y" + }, + { + "duration": "25.0", + "name": "rendering.desktop/video_to_sub_texture_premultiply" + }, + { + "duration": "26.0", + "name": "rendering.desktop/video_to_texture" + }, + { + "duration": "26.0", + "name": "rendering.desktop/web_animation_value_type_color" + }, + { + "duration": "25.0", + "name": "rendering.desktop/web_animation_value_type_length_3d" + }, + { + "duration": "25.0", + "name": "rendering.desktop/web_animation_value_type_length_complex" + }, + { + "duration": "25.0", + "name": "rendering.desktop/web_animation_value_type_length_simple" + }, + { + "duration": "25.0", + "name": "rendering.desktop/web_animation_value_type_path" + }, + { + "duration": "25.0", + "name": "rendering.desktop/web_animation_value_type_shadow" + }, + { + "duration": "25.0", + "name": "rendering.desktop/web_animation_value_type_transform_complex" + }, + { + "duration": "25.0", + "name": "rendering.desktop/web_animation_value_type_transform_simple" + }, + { + "duration": "27.0", + "name": "rendering.desktop/web_animations_many_keyframes" + }, + { + "duration": "25.0", + "name": "rendering.desktop/web_animations_set_current_time" + }, + { + "duration": "25.0", + "name": "rendering.desktop/web_animations_simultaneous" + }, + { + "duration": "26.0", + "name": "rendering.desktop/web_animations_staggered_chaining" + }, + { + "duration": "26.0", + "name": "rendering.desktop/web_animations_staggered_infinite_iterations" + }, + { + "duration": "26.0", + "name": "rendering.desktop/web_animations_staggered_triggering_page" + }, + { + "duration": "25.0", + "name": "rendering.desktop/webgl_to_texture" + }, + { + "duration": "21.0", + "name": "rendering.desktop/webp_decoding_rgb_and_gpu_rasterization" + }, + { + "duration": "21.0", + "name": "rendering.desktop/webp_decoding_yuv_and_gpu_rasterization" + }, + { + "duration": "25.0", + "name": "rendering.desktop/wikipedia_2018" + }, + { + "duration": "24.0", + "name": "rendering.desktop/wordpress_2018" + }, + { + "duration": "21.0", + "name": "rendering.desktop/yahoo_answers_2018" + }, + { + "duration": "23.0", + "name": "rendering.desktop/yahoo_news_2018" + }, + { + "duration": "23.0", + "name": "rendering.desktop/yahoo_news_pinch_2018" + }, + { + "duration": "24.0", + "name": "rendering.desktop/yahoo_sports_2018" + }, + { + "duration": "24.0", + "name": "rendering.desktop/yahoo_sports_pinch_2018" + }, + { + "duration": "13.0", + "name": "rendering.desktop/youtube_2018" + }, + { + "duration": "13.0", + "name": "rendering.desktop/youtube_pinch_2018" + }, + { + "duration": "51.0", + "name": "speedometer-future/http://browserbench.org/Speedometer/" + }, + { + "duration": "50.0", + "name": "speedometer/http://browserbench.org/Speedometer/" + }, + { + "duration": "91.0", + "name": "speedometer2-future/Speedometer2" + }, + { + "duration": "90.0", + "name": "speedometer2-pcscan/Speedometer2" + }, + { + "duration": "88.0", + "name": "speedometer2/Speedometer2" + }, + { + "duration": "46.0", + "name": "system_health.common_desktop/browse:media:googleplaystore:2021" + }, + { + "duration": "83.0", + "name": "system_health.common_desktop/browse:media:imgur" + }, + { + "duration": "98.0", + "name": "system_health.common_desktop/browse:media:pinterest:2018" + }, + { + "duration": "69.0", + "name": "system_health.common_desktop/browse:media:tumblr:2018" + }, + { + "duration": "14.0", + "name": "system_health.common_desktop/browse:media:youtube:2019" + }, + { + "duration": "77.0", + "name": "system_health.common_desktop/browse:media:youtubetv:2019" + }, + { + "duration": "90.0", + "name": "system_health.common_desktop/browse:media:youtubetv_watch:2020" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/browse:news:hackernews:2020" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/browse:news:nytimes:2020" + }, + { + "duration": "60.0", + "name": "system_health.common_desktop/browse:news:reddit:2020" + }, + { + "duration": "56.0", + "name": "system_health.common_desktop/browse:search:google:2020" + }, + { + "duration": "76.0", + "name": "system_health.common_desktop/browse:social:facebook_infinite_scroll:2018" + }, + { + "duration": "66.0", + "name": "system_health.common_desktop/browse:social:tumblr_infinite_scroll:2018" + }, + { + "duration": "52.0", + "name": "system_health.common_desktop/browse:social:twitter:2018" + }, + { + "duration": "72.0", + "name": "system_health.common_desktop/browse:social:twitter_infinite_scroll:2018" + }, + { + "duration": "66.0", + "name": "system_health.common_desktop/browse:tech:discourse_infinite_scroll:2018" + }, + { + "duration": "41.0", + "name": "system_health.common_desktop/browse:tools:docs_scrolling" + }, + { + "duration": "79.0", + "name": "system_health.common_desktop/browse:tools:earth:2020" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/browse:tools:gmail-compose:2020" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/browse:tools:gmail-labelclick:2020" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/browse:tools:gmail-openconversation:2020" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/browse:tools:gmail-search:2020" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/browse:tools:maps:2019" + }, + { + "duration": "45.0", + "name": "system_health.common_desktop/browse:tools:sheets:2019" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/browse_accessibility:media:youtube" + }, + { + "duration": "38.0", + "name": "system_health.common_desktop/browse_accessibility:tech:codesearch:2018" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load:chrome:blank" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:games:alphabetty:2018" + }, + { + "duration": "24.0", + "name": "system_health.common_desktop/load:games:bubbles:2020" + }, + { + "duration": "31.0", + "name": "system_health.common_desktop/load:games:lazors" + }, + { + "duration": "28.0", + "name": "system_health.common_desktop/load:games:miniclip:2018" + }, + { + "duration": "31.0", + "name": "system_health.common_desktop/load:games:spychase:2018" + }, + { + "duration": "30.0", + "name": "system_health.common_desktop/load:media:9gag" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:media:dailymotion:2019" + }, + { + "duration": "27.0", + "name": "system_health.common_desktop/load:media:facebook_feed:desktop:2020" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load:media:facebook_photos:2018" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load:media:facebook_photos:desktop:2020" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load:media:flickr:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:media:google_images:2018" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load:media:imgur:2018" + }, + { + "duration": "27.0", + "name": "system_health.common_desktop/load:media:soundcloud:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:media:youtube:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:media:youtubelivingroom:2020" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:news:bbc:2018" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load:news:cnn:2020" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:news:flipboard" + }, + { + "duration": "24.0", + "name": "system_health.common_desktop/load:news:hackernews:2018" + }, + { + "duration": "29.0", + "name": "system_health.common_desktop/load:news:nytimes:2018" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load:news:qq:2018" + }, + { + "duration": "27.0", + "name": "system_health.common_desktop/load:news:reddit:2018" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load:news:wikipedia:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:search:amazon:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:search:baidu:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:search:ebay:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:search:flipkart:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:search:google:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:search:taobao:2018" + }, + { + "duration": "24.0", + "name": "system_health.common_desktop/load:search:yahoo:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:search:yandex:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:social:instagram:2018" + }, + { + "duration": "27.0", + "name": "system_health.common_desktop/load:social:pinterest:2019" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:social:vk:2018" + }, + { + "duration": "35.0", + "name": "system_health.common_desktop/load:tools:chat:2020" + }, + { + "duration": "29.0", + "name": "system_health.common_desktop/load:tools:docs:2019" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load:tools:drive:2019" + }, + { + "duration": "40.0", + "name": "system_health.common_desktop/load:tools:gmail:2019" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:tools:stackoverflow:2018" + }, + { + "duration": "25.0", + "name": "system_health.common_desktop/load:tools:weather:2019" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load_accessibility:media:wikipedia:2018" + }, + { + "duration": "26.0", + "name": "system_health.common_desktop/load_accessibility:shopping:amazon:2018" + }, + { + "duration": "140.0", + "name": "system_health.common_desktop/long_running:tools:gmail-background" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/long_running:tools:gmail-foreground" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/multitab:misc:typical24" + }, + { + "duration": "11.0", + "name": "system_health.common_desktop/multitab:misc:typical24:2018" + }, + { + "duration": "55.0", + "name": "system_health.common_desktop/play:media:google_play_music" + }, + { + "duration": "52.0", + "name": "system_health.common_desktop/play:media:soundcloud:2018" + }, + { + "duration": "40.0", + "name": "system_health.memory_desktop/browse:media:googleplaystore:2021" + }, + { + "duration": "74.0", + "name": "system_health.memory_desktop/browse:media:imgur" + }, + { + "duration": "92.0", + "name": "system_health.memory_desktop/browse:media:pinterest:2018" + }, + { + "duration": "63.0", + "name": "system_health.memory_desktop/browse:media:tumblr:2018" + }, + { + "duration": "7.0", + "name": "system_health.memory_desktop/browse:media:youtube:2019" + }, + { + "duration": "69.0", + "name": "system_health.memory_desktop/browse:media:youtubetv:2019" + }, + { + "duration": "76.0", + "name": "system_health.memory_desktop/browse:media:youtubetv_watch:2020" + }, + { + "duration": "52.0", + "name": "system_health.memory_desktop/browse:news:hackernews:2020" + }, + { + "duration": "5.0", + "name": "system_health.memory_desktop/browse:news:nytimes:2020" + }, + { + "duration": "55.0", + "name": "system_health.memory_desktop/browse:news:reddit:2020" + }, + { + "duration": "50.0", + "name": "system_health.memory_desktop/browse:search:google:2020" + }, + { + "duration": "67.0", + "name": "system_health.memory_desktop/browse:social:facebook_infinite_scroll:2018" + }, + { + "duration": "61.0", + "name": "system_health.memory_desktop/browse:social:tumblr_infinite_scroll:2018" + }, + { + "duration": "46.0", + "name": "system_health.memory_desktop/browse:social:twitter:2018" + }, + { + "duration": "64.0", + "name": "system_health.memory_desktop/browse:social:twitter_infinite_scroll:2018" + }, + { + "duration": "58.0", + "name": "system_health.memory_desktop/browse:tech:discourse_infinite_scroll:2018" + }, + { + "duration": "35.0", + "name": "system_health.memory_desktop/browse:tools:docs_scrolling" + }, + { + "duration": "4.0", + "name": "system_health.memory_desktop/browse:tools:earth:2020" + }, + { + "duration": "4.0", + "name": "system_health.memory_desktop/browse:tools:gmail-compose:2020" + }, + { + "duration": "4.0", + "name": "system_health.memory_desktop/browse:tools:gmail-labelclick:2020" + }, + { + "duration": "4.0", + "name": "system_health.memory_desktop/browse:tools:gmail-openconversation:2020" + }, + { + "duration": "4.0", + "name": "system_health.memory_desktop/browse:tools:gmail-search:2020" + }, + { + "duration": "6.0", + "name": "system_health.memory_desktop/browse:tools:maps:2019" + }, + { + "duration": "38.0", + "name": "system_health.memory_desktop/browse:tools:sheets:2019" + }, + { + "duration": "4.0", + "name": "system_health.memory_desktop/browse_accessibility:media:youtube" + }, + { + "duration": "27.0", + "name": "system_health.memory_desktop/browse_accessibility:tech:codesearch:2018" + }, + { + "duration": "16.0", + "name": "system_health.memory_desktop/load:chrome:blank" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:games:alphabetty:2018" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:games:bubbles:2020" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:games:lazors" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:games:miniclip:2018" + }, + { + "duration": "24.0", + "name": "system_health.memory_desktop/load:games:spychase:2018" + }, + { + "duration": "23.0", + "name": "system_health.memory_desktop/load:media:9gag" + }, + { + "duration": "20.0", + "name": "system_health.memory_desktop/load:media:dailymotion:2019" + }, + { + "duration": "22.0", + "name": "system_health.memory_desktop/load:media:facebook_feed:desktop:2020" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:media:facebook_photos:2018" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:media:facebook_photos:desktop:2020" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:media:flickr:2018" + }, + { + "duration": "20.0", + "name": "system_health.memory_desktop/load:media:google_images:2018" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:media:imgur:2018" + }, + { + "duration": "20.0", + "name": "system_health.memory_desktop/load:media:soundcloud:2018" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:media:youtube:2018" + }, + { + "duration": "18.0", + "name": "system_health.memory_desktop/load:media:youtubelivingroom:2020" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:news:bbc:2018" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:news:cnn:2020" + }, + { + "duration": "20.0", + "name": "system_health.memory_desktop/load:news:flipboard" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:news:hackernews:2018" + }, + { + "duration": "22.0", + "name": "system_health.memory_desktop/load:news:nytimes:2018" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:news:qq:2018" + }, + { + "duration": "20.0", + "name": "system_health.memory_desktop/load:news:reddit:2018" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:news:wikipedia:2018" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:search:amazon:2018" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:search:baidu:2018" + }, + { + "duration": "20.0", + "name": "system_health.memory_desktop/load:search:ebay:2018" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:search:flipkart:2018" + }, + { + "duration": "20.0", + "name": "system_health.memory_desktop/load:search:google:2018" + }, + { + "duration": "18.0", + "name": "system_health.memory_desktop/load:search:taobao:2018" + }, + { + "duration": "18.0", + "name": "system_health.memory_desktop/load:search:yahoo:2018" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:search:yandex:2018" + }, + { + "duration": "20.0", + "name": "system_health.memory_desktop/load:social:instagram:2018" + }, + { + "duration": "20.0", + "name": "system_health.memory_desktop/load:social:pinterest:2019" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:social:vk:2018" + }, + { + "duration": "30.0", + "name": "system_health.memory_desktop/load:tools:chat:2020" + }, + { + "duration": "24.0", + "name": "system_health.memory_desktop/load:tools:docs:2019" + }, + { + "duration": "21.0", + "name": "system_health.memory_desktop/load:tools:drive:2019" + }, + { + "duration": "33.0", + "name": "system_health.memory_desktop/load:tools:gmail:2019" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:tools:stackoverflow:2018" + }, + { + "duration": "19.0", + "name": "system_health.memory_desktop/load:tools:weather:2019" + }, + { + "duration": "17.0", + "name": "system_health.memory_desktop/load_accessibility:media:wikipedia:2018" + }, + { + "duration": "17.0", + "name": "system_health.memory_desktop/load_accessibility:shopping:amazon:2018" + }, + { + "duration": "5.0", + "name": "system_health.memory_desktop/long_running:tools:gmail-background" + }, + { + "duration": "5.0", + "name": "system_health.memory_desktop/long_running:tools:gmail-foreground" + }, + { + "duration": "5.0", + "name": "system_health.memory_desktop/multitab:misc:typical24" + }, + { + "duration": "5.0", + "name": "system_health.memory_desktop/multitab:misc:typical24:2018" + }, + { + "duration": "6.0", + "name": "system_health.memory_desktop/play:media:google_play_music" + }, + { + "duration": "46.0", + "name": "system_health.memory_desktop/play:media:soundcloud:2018" + }, + { + "duration": "0.0", + "name": "tab_switching.typical_25/multitab:misc:typical24" + }, + { + "duration": "16.0", + "name": "tracing.tracing_with_background_memory_infra/Facebook" + }, + { + "duration": "15.0", + "name": "tracing.tracing_with_background_memory_infra/Wikipedia" + }, + { + "duration": "15.0", + "name": "tracing.tracing_with_background_memory_infra/http://www.amazon.com" + }, + { + "duration": "14.0", + "name": "tracing.tracing_with_background_memory_infra/http://www.ask.com/" + }, + { + "duration": "15.0", + "name": "tracing.tracing_with_background_memory_infra/http://www.bing.com/" + }, + { + "duration": "16.0", + "name": "tracing.tracing_with_background_memory_infra/http://www.yahoo.com/" + }, + { + "duration": "15.0", + "name": "tracing.tracing_with_background_memory_infra/http://www.youtube.com" + }, + { + "duration": "16.0", + "name": "tracing.tracing_with_background_memory_infra/https://www.google.com/#hl=en&q=barack+obama" + }, + { + "duration": "15.0", + "name": "tracing.tracing_with_background_memory_infra/https://www.google.com/calendar/" + }, + { + "duration": "57.0", + "name": "v8.browsing_desktop-future/browse:media:googleplaystore:2021" + }, + { + "duration": "22.0", + "name": "v8.browsing_desktop-future/browse:media:imgur" + }, + { + "duration": "109.0", + "name": "v8.browsing_desktop-future/browse:media:pinterest:2018" + }, + { + "duration": "81.0", + "name": "v8.browsing_desktop-future/browse:media:tumblr:2018" + }, + { + "duration": "22.0", + "name": "v8.browsing_desktop-future/browse:media:youtube:2019" + }, + { + "duration": "85.0", + "name": "v8.browsing_desktop-future/browse:media:youtubetv:2019" + }, + { + "duration": "92.0", + "name": "v8.browsing_desktop-future/browse:media:youtubetv_watch:2020" + }, + { + "duration": "22.0", + "name": "v8.browsing_desktop-future/browse:news:hackernews:2020" + }, + { + "duration": "22.0", + "name": "v8.browsing_desktop-future/browse:news:nytimes:2020" + }, + { + "duration": "73.0", + "name": "v8.browsing_desktop-future/browse:news:reddit:2020" + }, + { + "duration": "71.0", + "name": "v8.browsing_desktop-future/browse:search:google:2020" + }, + { + "duration": "94.0", + "name": "v8.browsing_desktop-future/browse:social:facebook_infinite_scroll:2018" + }, + { + "duration": "83.0", + "name": "v8.browsing_desktop-future/browse:social:tumblr_infinite_scroll:2018" + }, + { + "duration": "64.0", + "name": "v8.browsing_desktop-future/browse:social:twitter:2018" + }, + { + "duration": "81.0", + "name": "v8.browsing_desktop-future/browse:social:twitter_infinite_scroll:2018" + }, + { + "duration": "80.0", + "name": "v8.browsing_desktop-future/browse:tech:discourse_infinite_scroll:2018" + }, + { + "duration": "52.0", + "name": "v8.browsing_desktop-future/browse:tools:docs_scrolling" + }, + { + "duration": "94.0", + "name": "v8.browsing_desktop-future/browse:tools:earth:2020" + }, + { + "duration": "24.0", + "name": "v8.browsing_desktop-future/browse:tools:gmail-compose:2020" + }, + { + "duration": "24.0", + "name": "v8.browsing_desktop-future/browse:tools:gmail-labelclick:2020" + }, + { + "duration": "24.0", + "name": "v8.browsing_desktop-future/browse:tools:gmail-openconversation:2020" + }, + { + "duration": "24.0", + "name": "v8.browsing_desktop-future/browse:tools:gmail-search:2020" + }, + { + "duration": "22.0", + "name": "v8.browsing_desktop-future/browse:tools:maps:2019" + }, + { + "duration": "58.0", + "name": "v8.browsing_desktop-future/browse:tools:sheets:2019" + }, + { + "duration": "61.0", + "name": "v8.browsing_desktop/browse:media:googleplaystore:2021" + }, + { + "duration": "24.0", + "name": "v8.browsing_desktop/browse:media:imgur" + }, + { + "duration": "112.0", + "name": "v8.browsing_desktop/browse:media:pinterest:2018" + }, + { + "duration": "84.0", + "name": "v8.browsing_desktop/browse:media:tumblr:2018" + }, + { + "duration": "24.0", + "name": "v8.browsing_desktop/browse:media:youtube:2019" + }, + { + "duration": "88.0", + "name": "v8.browsing_desktop/browse:media:youtubetv:2019" + }, + { + "duration": "94.0", + "name": "v8.browsing_desktop/browse:media:youtubetv_watch:2020" + }, + { + "duration": "24.0", + "name": "v8.browsing_desktop/browse:news:hackernews:2020" + }, + { + "duration": "24.0", + "name": "v8.browsing_desktop/browse:news:nytimes:2020" + }, + { + "duration": "76.0", + "name": "v8.browsing_desktop/browse:news:reddit:2020" + }, + { + "duration": "71.0", + "name": "v8.browsing_desktop/browse:search:google:2020" + }, + { + "duration": "100.0", + "name": "v8.browsing_desktop/browse:social:facebook_infinite_scroll:2018" + }, + { + "duration": "86.0", + "name": "v8.browsing_desktop/browse:social:tumblr_infinite_scroll:2018" + }, + { + "duration": "66.0", + "name": "v8.browsing_desktop/browse:social:twitter:2018" + }, + { + "duration": "84.0", + "name": "v8.browsing_desktop/browse:social:twitter_infinite_scroll:2018" + }, + { + "duration": "81.0", + "name": "v8.browsing_desktop/browse:tech:discourse_infinite_scroll:2018" + }, + { + "duration": "55.0", + "name": "v8.browsing_desktop/browse:tools:docs_scrolling" + }, + { + "duration": "95.0", + "name": "v8.browsing_desktop/browse:tools:earth:2020" + }, + { + "duration": "25.0", + "name": "v8.browsing_desktop/browse:tools:gmail-compose:2020" + }, + { + "duration": "25.0", + "name": "v8.browsing_desktop/browse:tools:gmail-labelclick:2020" + }, + { + "duration": "25.0", + "name": "v8.browsing_desktop/browse:tools:gmail-openconversation:2020" + }, + { + "duration": "25.0", + "name": "v8.browsing_desktop/browse:tools:gmail-search:2020" + }, + { + "duration": "25.0", + "name": "v8.browsing_desktop/browse:tools:maps:2019" + }, + { + "duration": "61.0", + "name": "v8.browsing_desktop/browse:tools:sheets:2019" + }, + { + "duration": "30.0", + "name": "webrtc/10s_datachannel_transfer" + }, + { + "duration": "28.0", + "name": "webrtc/canvas_capture_peer_connection" + }, + { + "duration": "38.0", + "name": "webrtc/codec_constraints_h264" + }, + { + "duration": "38.0", + "name": "webrtc/codec_constraints_vp8" + }, + { + "duration": "38.0", + "name": "webrtc/codec_constraints_vp9" + }, + { + "duration": "28.0", + "name": "webrtc/hd_local_stream_10s" + }, + { + "duration": "28.0", + "name": "webrtc/insertable_streams_video_processing_camera_canvas2d_video" + }, + { + "duration": "28.0", + "name": "webrtc/insertable_streams_video_processing_camera_webgl_pc" + }, + { + "duration": "28.0", + "name": "webrtc/insertable_streams_video_processing_camera_webgl_video" + }, + { + "duration": "28.0", + "name": "webrtc/insertable_streams_video_processing_pc_webgl_video" + }, + { + "duration": "28.0", + "name": "webrtc/insertable_streams_video_processing_video_webgl_video" + }, + { + "duration": "40.0", + "name": "webrtc/multiple_peerconnections" + }, + { + "duration": "43.0", + "name": "webrtc/pause_play_peerconnections" + }, + { + "duration": "210.0", + "name": "performance_browser_tests/_gtest_" + }, + { + "duration": "3.0", + "name": "load_library_perf_tests/_gtest_" + } +] \ No newline at end of file
diff --git a/tools/traffic_annotation/scripts/auditor/auditor.py b/tools/traffic_annotation/scripts/auditor/auditor.py index ba067fb..2f6e9a9 100755 --- a/tools/traffic_annotation/scripts/auditor/auditor.py +++ b/tools/traffic_annotation/scripts/auditor/auditor.py
@@ -17,20 +17,23 @@ import xml.etree.ElementTree from enum import Enum, auto -from functools import reduce from google.protobuf import text_format -from google.protobuf.descriptor import FieldDescriptor -from google.protobuf.message import Message from pathlib import Path from typing import NewType, TYPE_CHECKING, Any, Optional, List, Dict, Set, \ Iterable, Tuple, Union +from error import AuditorError, ErrorType +import util +from util import UniqueId, HashCode + # Path to the directory where this script is. SCRIPT_DIR = Path(__file__).resolve().parent # Absolute path to chrome/src. SRC_DIR = SCRIPT_DIR.parents[3] +logger = logging.getLogger(__name__) + # TODO(nicolaso): Move extractor.py to this folder once the C++ auditor doesn't # depend on it anymore. sys.path.insert(0, str(SCRIPT_DIR.parent)) @@ -46,9 +49,6 @@ from traffic_annotation_pb2 import NetworkTrafficAnnotation as \ traffic_annotation -UniqueId = NewType("UniqueId", str) -HashCode = NewType("HashCode", int) - # Reserved annotation unique IDs that should only be used in untracked files # (e.g., test files or files that aren't compiled on this platform). TEST_IDS = [UniqueId("test"), UniqueId("test_partial")] @@ -80,431 +80,6 @@ <annotations>""" -# Configure logging with timestamp, log level, filename, and line number. -logging.basicConfig( - level=logging.INFO, - format="[%(asctime)s:%(levelname)s:%(filename)s(%(lineno)d)] %(message)s") -logger = logging.getLogger(__name__) - - -def get_current_platform(build_path: Optional[Path] = None) -> str: - """Return the target platform of |build_path| based on heuristics.""" - # Use host platform as the source of truth (in most cases). - current_platform: str = platform.system().lower() - - if current_platform == "linux" and build_path is not None: - # It could be an Android build directory, being compiled from a Linux host. - # Look for a target_os="android" line in args.gn. - try: - gn_args = (build_path / "args.gn").read_text(encoding="utf-8") - pattern = re.compile(r"^\s*target_os\s*=\s*\"(android|chromeos)\"\s*$", - re.MULTILINE) - match = pattern.search(gn_args) - if match: - current_platform = match.group(1) - - except (ValueError, OSError) as e: - logger.info(e) - # Maybe the file's absent, or it can't be decoded as UTF-8, or something. - # It's probably not Android in that case. - pass - - if current_platform not in SUPPORTED_PLATFORMS: - raise ValueError("Unsupported platform {}".format(current_platform)) - - return current_platform - - -def twos_complement_8bit(b: int) -> int: - """Interprets b like a signed 8-bit integer, possibly changing its sign. - - For instance, twos_complement_8bit(204) returns -52.""" - if b >= 256: - raise ValueError("b must fit inside 8 bits") - if b & (1 << 7): - # Negative number, calculate its value using two's-complement. - return b - (1 << 8) - else: - # Positive number, do not touch. - return b - - -def iterative_hash(s: str) -> HashCode: - """Compute the has code of the given string as in: - net/traffic_annotation/network_traffic_annotation.h - - Args: - s: str - The seed, e.g. unique id of traffic annotation. - Returns: int - A hash code. - """ - return HashCode( - reduce(lambda acc, b: (acc * 31 + twos_complement_8bit(b)) % 138003713, - s.encode("utf-8"), 0)) - - -def compute_hash_value(text: str) -> HashCode: - """Same as iterative_hash, but returns -1 for empty strings.""" - return iterative_hash(text) if text else HashCode(-1) - - -def merge_string_field(src: Message, dst: Message, field: str): - """Merges the content of one string field into an annotation.""" - if getattr(src, field): - if getattr(dst, field): - setattr(dst, field, "{}\n{}".format(getattr(src, field), - getattr(dst, field))) - else: - setattr(dst, field, getattr(src, field)) - - -def fill_proto_with_bogus(proto: Message, field_numbers: List[int]): - """Fill proto with bogus values for the fields identified by field_numbers. - Uses reflection to fill the proto with the right types.""" - descriptor = proto.DESCRIPTOR - for field_number in field_numbers: - field_number = abs(field_number) - - if field_number not in descriptor.fields_by_number: - raise ValueError("{} is not a valid {} field".format( - field_number, descriptor.name)) - - field = descriptor.fields_by_number[field_number] - repeated = field.label == FieldDescriptor.LABEL_REPEATED - - if field.type == FieldDescriptor.TYPE_STRING and not repeated: - setattr(proto, field.name, "[Archived]") - elif field.type == FieldDescriptor.TYPE_ENUM and not repeated: - # Assume the 2nd value in the enum is reasonable, since the 1st is - # UNSPECIFIED. - setattr(proto, field.name, field.enum_type.values[1].number) - elif field.type == FieldDescriptor.TYPE_MESSAGE and repeated: - getattr(proto, field.name).add() - else: - raise NotImplementedError("Unimplemented proto field type {} ({})".format( - field.type, "repeated" if repeated else "non-repeated")) - - -def extract_annotation_id(line: str) -> Optional[UniqueId]: - """Returns the annotation id given an '<item id=...' line""" - m = re.search('id="([^"]+)"', line) - return UniqueId(m.group(1)) if m else None - - -# TODO(nicolaso): Move TSV-related functions to their own file (after detangling -# circular imports). -def escape_for_tsv(text: str) -> str: - """Changes double-quotes to single-quotes, and adds double-quotes around the - text if it has newlines/tabs.""" - text.replace("\"", "'") - if "\n" in text or "\t" in text: - return "\"{}\"".format(text) - return text - - -def policy_to_text(chrome_policy: Iterable[Message]) -> str: - """Unnests the policy name/values from chrome_policy, producing a - human-readable string. - - For example, this: - chrome_policy { - SyncDisabled { - policy_options { - mode: MANDATORY - } - SyncDisabled: true - } - } - - becomes this: - SyncDisabled: true""" - items = [] - # Use the protobuf serializer library to print the fields, 2 levels deep. - for policy in chrome_policy: - for field, value in policy.ListFields(): - for subfield, subvalue in value.ListFields(): - if subfield.name == "policy_options": - # Skip the policy_options field. - continue - writer = text_format.TextWriter(as_utf8=True) - text_format.PrintField(subfield, - subvalue, - writer, - as_one_line=True, - use_short_repeated_primitives=True) - items.append(writer.getvalue().strip()) - # We wrote an extra comma at the end, remove it before returning. - return ", ".join(items) - return re.sub(r", $", "", writer.getvalue()).strip() - - -def write_annotations_tsv_file(file_path: Path, annotations: List["Annotation"], - missing_ids: List[UniqueId]): - """Writes a TSV file of all annotations and their contents in file_path.""" - logger.info("Saving annotations to TSV file: {}.".format(file_path)) - Destination = traffic_annotation.TrafficSemantics.Destination - CookiesAllowed = traffic_annotation.TrafficPolicy.CookiesAllowed - - lines = [] - title = "Unique ID\tLast Update\tSender\tDescription\tTrigger\tData\t" + \ - "Destination\tCookies Allowed\tCookies Store\tSetting\tChrome Policy\t" + \ - "Comments\tSource File" - - column_count = title.count("\t") - for missing_id in missing_ids: - lines.append(missing_id + "\t" * column_count) - - for annotation in annotations: - if annotation.type != Annotation.Type.COMPLETE: - continue - - # TODO(nicolaso): Use StringIO for faster concatenation. - - line = annotation.proto.unique_id - # Placeholder for Last Update Date, will be updated in the scripts. - line += "\t" - - # Semantics. - semantics = annotation.proto.semantics - semantics_list = [ - semantics.sender, - escape_for_tsv(semantics.description), - escape_for_tsv(semantics.trigger), - escape_for_tsv(semantics.data), - ] - - for semantic_info in semantics_list: - line += "\t{}".format(semantic_info) - - destination_names = { - Destination.WEBSITE: "Website", - Destination.GOOGLE_OWNED_SERVICE: "Google", - Destination.LOCAL: "Local", - Destination.OTHER: "Other", - } - if (semantics.destination == Destination.OTHER - and semantics.destination_other): - line += "\tOther: {}".format(semantics.destination_other) - elif semantics.destination in destination_names: - line += "\t{}".format(destination_names[semantics.destination]) - else: - raise ValueError("Invalid value for the semantics.destination field") - - # Policy. - policy = annotation.proto.policy - if annotation.proto.policy.cookies_allowed == CookiesAllowed.YES: - line += "\tYes" - else: - line += "\tNo" - - line += "\t{}".format(escape_for_tsv(policy.cookies_store)) - line += "\t{}".format(escape_for_tsv(policy.setting)) - - # Chrome policies. - if policy.chrome_policy: - policies_text = policy_to_text(policy.chrome_policy) - else: - policies_text = policy.policy_exception_justification - line += "\t{}".format(escape_for_tsv(policies_text)) - - # Comments. - line += "\t{}".format(escape_for_tsv(annotation.proto.comments)) - # Source. - source = annotation.proto.source - code_search_link = "https://cs.chromium.org/chromium/src/" - line += "\t{}{}?l={}".format(code_search_link, source.file, source.line) - lines.append(line) - - lines.sort() - lines.insert(0, title) - report = "\n".join(lines) + "\n" - - file_path.write_text(report, encoding="utf-8") - - -class AuditorError: - class Type(Enum): - # Annotation syntax is not right. - SYNTAX = auto() - # Can't create a MutableNetworkTrafficAnnotationTag from anywhere (except - # in whitelisted files). - MUTABLE_TAG = auto() - # Annotation has some missing fields. - INCOMPLETE_ANNOTATION = auto() - # A partial of (branched-)completing annotation is not paired with another - # annotation to be completed. - INCOMPLETED_ANNOTATION = auto() - # Annotation has some inconsistent fields. - INCONSISTENT_ANNOTATION = auto() - # Two annotations that are supposed to merge cannot merge. - MERGE_FAILED = auto() - # A function is called with the "missing" tag. - MISSING_TAG_USED = auto() - # A function is called with the "test" or "test_partial" tag outside of a - # test file. - TEST_ANNOTATION = auto() - # A function is called with NO_TRAFFIC_ANNOTATION_YET tag. - NO_ANNOTATION = auto() - # An id has a hash code equal to a reserved word. - RESERVED_ID_HASH_CODE = auto() - # An id contains an invalid character (not alphanumeric or underscore). - ID_INVALID_CHARACTER = auto() - # An id is used in two places without matching conditions. Proper conditions - # include when 2 annotations are completing each other, or are different - # branches of the same annotation. - REPEATED_ID = auto() - # Annotation does not have a valid second id. - MISSING_SECOND_ID = auto() - # Two ids have equal hash codes. - HASH_CODE_COLLISION = auto() - # "os_list" is invalid in annotations.xml. - INVALID_OS = auto() - # "added_in_milestone" is invalid in annotations.xml. - INVALID_ADDED_IN = auto() - # annotations.xml requires an update. - ANNOTATIONS_XML_UPDATE = auto() - # Annotations should be added to grouping.xml. - ADD_GROUPING_XML = auto() - # Annotations should be removed from grouping.xml. - REMOVE_GROUPING_XML = auto() - - def __init__(self, - result_type: "AuditorError.Type", - message: str = "", - file_path: Optional[Path] = None, - line: int = 0, - *extra_details: str): - self.type = result_type - self.message = message - self.file_path = file_path - self.line = line - self._details = [] - - assert message or result_type in [ - AuditorError.Type.MISSING_TAG_USED, AuditorError.Type.TEST_ANNOTATION, - AuditorError.Type.NO_ANNOTATION, AuditorError.Type.MISSING_SECOND_ID, - AuditorError.Type.MUTABLE_TAG, AuditorError.Type.INVALID_OS, - AuditorError.Type.INVALID_ADDED_IN - ] - - if message: - self._details.append(message) - self._details.extend(extra_details) - - def __str__(self) -> str: - if self.type == AuditorError.Type.SYNTAX: - assert self._details - return ("SYNTAX: Annotation at '{}:{}' has the following syntax" - " error: {}".format(self.file_path, self.line, - str(self._details[0]).replace("\n", " "))) - - if self.type == AuditorError.Type.MUTABLE_TAG: - return ("MUTABLE_TAG: Calling CreateMutableNetworkTrafficAnnotationTag() " - "is not safelisted at '{}:{}'.".format(self.file_path, self.line)) - - if self.type == AuditorError.Type.INCOMPLETE_ANNOTATION: - assert self._details - return ("INCOMPLETE_ANNOTATION: Annotation at '{}:{}' has the" - " following missing fields: {}".format(self.file_path, self.line, - self._details[0])) - - if self.type == AuditorError.Type.INCOMPLETED_ANNOTATION: - assert self._details - return ("INCOMPLETED_ANNOTATION: Annotation '{}' is never " - "completed.".format(self._details[0])) - - if self.type == AuditorError.Type.INCONSISTENT_ANNOTATION: - assert self._details - return ("INCONSISTENT_ANNOTATION: Annotation at '{}:{}' has the " - "following inconsistencies: {}".format(self.file_path, self.line, - self._details[0])) - if self.type == AuditorError.Type.MERGE_FAILED: - assert len(self._details) == 3 - return ("MERGE_FAILED: Annotations '{}' and '{}' cannot be merged due to " - "the following error(s): {}".format(self._details[1], - self._details[2], - self._details[0])) - - if self.type == AuditorError.Type.MISSING_TAG_USED: - return ("MISSING_TAG_USED: MISSING_TRAFFIC_ANNOTATION tag used in " - "'{}:{}'.".format(self.file_path, self.line)) - - if self.type == AuditorError.Type.TEST_ANNOTATION: - return ("TEST_ANNOTATION: Annotation for tests used in '{}:{}'.".format( - self.file_path, self.line)) - - if self.type == AuditorError.Type.NO_ANNOTATION: - return "NO_ANNOTATION: Empty annotation in '{}:{}'.".format( - self.file_path, self.line) - - if self.type == AuditorError.Type.RESERVED_ID_HASH_CODE: - assert self._details - return ("RESERVED_ID_HASH_CODE: Id '{}' in '{}:{}' has a hash code equal " - "to a reserved word and should be changed.".format( - self._details[0], self.file_path, self.line)) - - if self.type == AuditorError.Type.HASH_CODE_COLLISION: - assert len(self._details) == 2 - return ("HASH_CODE_COLLISION: The following annotations have colliding " - "hash codes and should be updated: '{}', '{}'.".format( - self._details[0], self._details[1])) - - if self.type == AuditorError.Type.REPEATED_ID: - assert len(self._details) == 2 - return ("REPEATED_ID: The following annotations have equal ids and " - "should be updated: {}, {}.".format(self._details[0], - self._details[1])) - - if self.type == AuditorError.Type.ID_INVALID_CHARACTER: - assert self._details - return ("ID_INVALID_CHARACTER: Id '{}' in '{}:{}' contains an invalid " - "character.".format(self._details[0], self.file_path, self.line)) - - if self.type == AuditorError.Type.MISSING_SECOND_ID: - return ("MISSING_SECOND_ID: Second id of annotation at '{}:{}' should be " - "updated, as it has the same hash code as the first one.".format( - self.file_path, self.line)) - - if self.type == AuditorError.Type.INVALID_OS: - assert len(self._details) == 2 - return ("INVALID_OS: Invalid OS '{}' in annotation '{}' at {}.".format( - self._details[0], self._details[1], self.file_path)) - - if self.type == AuditorError.Type.INVALID_ADDED_IN: - assert len(self._details) == 2 - return ("INVALID_ADDED_IN: Invalid or missing added_in_milestone '{}' in " - "annotation '{}' at {}.".format(self._details[0], - self._details[1], self.file_path)) - - if self.type == AuditorError.Type.ADD_GROUPING_XML: - assert self._details - return ("ADD_GROUPING_XML: The following annotations should be added " - "to an existing group in " - "tools/traffic_annotation/summary/grouping.xml: {}.".format( - self._details[0])) - - if self.type == AuditorError.Type.REMOVE_GROUPING_XML: - assert self._details - return ("REMOVE_GROUPING_XML: The following annotations are not needed " - "in tools/traffic_annotation/summary/grouping.xml, and should be " - "removed: {}.".format(self._details[0])) - - if self.type == AuditorError.Type.ANNOTATIONS_XML_UPDATE: - assert self._details - return ( - "'tools/traffic_annotation/summary/annotations.xml' requires update. " - "It is recommended to run traffic_annotation_auditor locally to do " - "the updates automatically (please refer to tools/traffic_annotation/" - "auditor/README.md), but you can also apply the following edit(s) to " - "do it manually:\n{}\n\n".format(self._details[0])) - - raise NotImplementedError("Unimplemented AuditorError.Type: {}".format( - self.type.name)) - - def __repr__(self) -> str: - return "AuditorError(\"{}\")".format(str(self)) - class Annotation: """An annotation in code, typically extracted from C++. @@ -568,11 +143,11 @@ @property def unique_id_hash_code(self) -> HashCode: - return compute_hash_value(self.unique_id) + return util.compute_hash_value(self.unique_id) @property def second_id_hash_code(self) -> HashCode: - return compute_hash_value(self.second_id) + return util.compute_hash_value(self.second_id) def get_ids(self) -> List[UniqueId]: """Returns the ids used by this annotation (up to 2 strings).""" @@ -595,9 +170,10 @@ if annotation.needs_two_ids(): annotation.second_id = archived.second_id - fill_proto_with_bogus(annotation.proto.semantics, archived.semantics_fields) + util.fill_proto_with_bogus(annotation.proto.semantics, + archived.semantics_fields) - fill_proto_with_bogus(annotation.proto.policy, archived.policy_fields) + util.fill_proto_with_bogus(annotation.proto.policy, archived.policy_fields) # cookies_allowed is a special field: negative values indicate NO, and # positive values indicate YES. @@ -642,7 +218,7 @@ combination.second_id = UniqueId("") # Update comment. - merge_string_field(other.proto, combination.proto, "comments") + util.merge_string_field(other.proto, combination.proto, "comments") assert self.file is not None assert completing_annotation.file is not None combination.proto.comments += ( @@ -657,7 +233,8 @@ "sender", "description", "trigger", "data", "destination_other" ] for f in semantics_string_fields: - merge_string_field(other.proto.semantics, combination.proto.semantics, f) + util.merge_string_field(other.proto.semantics, + combination.proto.semantics, f) # Merge 'destination' field. Destination = traffic_annotation.TrafficSemantics.Destination @@ -669,7 +246,7 @@ combination.proto.semantics.destination): return combination, [ AuditorError( - AuditorError.Type.MERGE_FAILED, + ErrorType.MERGE_FAILED, "Annotations contain different semantics::destination values", None, 0, self.unique_id, completing_annotation.unique_id) ] @@ -679,7 +256,7 @@ "cookies_store", "setting", "policy_exception_justification" ] for f in policy_string_fields: - merge_string_field(other.proto.policy, combination.proto.policy, f) + util.merge_string_field(other.proto.policy, combination.proto.policy, f) combination.proto.policy.cookies_allowed = max( combination.proto.policy.cookies_allowed, @@ -749,7 +326,7 @@ source_free_proto.ClearField("source") source_free_proto = text_format.MessageToString(source_free_proto, as_utf8=False) - return compute_hash_value(source_free_proto) + return util.compute_hash_value(source_free_proto) def deserialize(self, serialized_annotation: extractor.Annotation ) -> List[AuditorError]: @@ -762,10 +339,7 @@ self.line = line_number if serialized_annotation.type_name == extractor.AnnotationType.MUTABLE: - return [ - AuditorError(AuditorError.Type.MUTABLE_TAG, "", file_path, - line_number) - ] + return [AuditorError(ErrorType.MUTABLE_TAG, "", file_path, line_number)] self.type = Annotation.Type(serialized_annotation.type_name.value.lower()) self.unique_id = serialized_annotation.unique_id @@ -774,29 +348,22 @@ # Check for reserved IDs first, before trying to parse the Proto. if self.unique_id in TEST_IDS: return [ - AuditorError(AuditorError.Type.TEST_ANNOTATION, "", file_path, - line_number) + AuditorError(ErrorType.TEST_ANNOTATION, "", file_path, line_number) ] if self.unique_id == MISSING_ID: return [ - AuditorError(AuditorError.Type.MISSING_TAG_USED, "", file_path, - line_number) + AuditorError(ErrorType.MISSING_TAG_USED, "", file_path, line_number) ] if self.unique_id == NO_ANNOTATION_ID: - return [ - AuditorError(AuditorError.Type.NO_ANNOTATION, "", file_path, - line_number) - ] + return [AuditorError(ErrorType.NO_ANNOTATION, "", file_path, line_number)] try: text_format.Parse(serialized_annotation.text, self.proto) except Exception as e: logger.error(str(e)) - return [ - AuditorError(AuditorError.Type.SYNTAX, str(e), file_path, line_number) - ] + return [AuditorError(ErrorType.SYNTAX, str(e), file_path, line_number)] return [] @@ -833,8 +400,8 @@ if unspecifieds: error_text = ", ".join(unspecifieds) return [ - AuditorError(AuditorError.Type.INCOMPLETE_ANNOTATION, error_text, - self.file, self.line) + AuditorError(ErrorType.INCOMPLETE_ANNOTATION, error_text, self.file, + self.line) ] else: return [] @@ -847,7 +414,7 @@ if policy.cookies_allowed == CookiesAllowed.NO and policy.cookies_store: return [ AuditorError( - AuditorError.Type.INCONSISTENT_ANNOTATION, + ErrorType.INCONSISTENT_ANNOTATION, "Cookies store is specified while cookies are not allowed.", self.file, self.line) ] @@ -855,7 +422,7 @@ if policy.chrome_policy and policy.policy_exception_justification: return [ AuditorError( - AuditorError.Type.INCONSISTENT_ANNOTATION, + ErrorType.INCONSISTENT_ANNOTATION, "Both chrome policies and policy exception justification are " "present.", self.file, self.line) ] @@ -875,12 +442,12 @@ MUTABLE_TAG = "mutable_tag" @classmethod - def from_error_type(cls, error_type: AuditorError.Type): - if error_type == AuditorError.Type.MISSING_TAG_USED: + def from_error_type(cls, error_type: ErrorType): + if error_type == ErrorType.MISSING_TAG_USED: return ExceptionType.MISSING - if error_type == AuditorError.Type.TEST_ANNOTATION: + if error_type == ErrorType.TEST_ANNOTATION: return ExceptionType.TEST_ANNOTATION - if error_type == AuditorError.Type.MUTABLE_TAG: + if error_type == ErrorType.MUTABLE_TAG: return ExceptionType.MUTABLE_TAG return None @@ -989,7 +556,7 @@ errors.extend(self._check_for_second_ids()) errors.extend( self._check_for_invalid_values(self.reserved_ids, - AuditorError.Type.RESERVED_ID_HASH_CODE)) + ErrorType.RESERVED_ID_HASH_CODE)) errors.extend(self._check_for_hash_collisions()) errors.extend(self._check_for_invalid_repeated_ids()) @@ -1003,8 +570,8 @@ for id in annotation.get_ids(): if not re.match(r"^[0-9a-zA-Z_]*$", id): errors.append( - AuditorError(AuditorError.Type.ID_INVALID_CHARACTER, id, - annotation.file, annotation.line)) + AuditorError(ErrorType.ID_INVALID_CHARACTER, id, annotation.file, + annotation.line)) return errors @@ -1017,14 +584,13 @@ and (not annotation.second_id or annotation.second_id == annotation.unique_id)): errors.append( - AuditorError(AuditorError.Type.MISSING_SECOND_ID, "", - annotation.file, annotation.line)) + AuditorError(ErrorType.MISSING_SECOND_ID, "", annotation.file, + annotation.line)) return errors def _check_for_invalid_values(self, invalid_ids: List[UniqueId], - error_type: AuditorError.Type - ) -> List[AuditorError]: + error_type: ErrorType) -> List[AuditorError]: """Checks that invalid_ids are not used in annotations. If found, returns an error with error_type.""" @@ -1045,12 +611,12 @@ for annotation in self._annotations: for id in annotation.get_ids(): - hash_code = compute_hash_value(id) + hash_code = util.compute_hash_value(id) if hash_code not in collisions: collisions[hash_code] = id elif id != collisions[hash_code]: errors.append( - AuditorError(AuditorError.Type.HASH_CODE_COLLISION, id, None, 0, + AuditorError(ErrorType.HASH_CODE_COLLISION, id, None, 0, collisions[hash_code])) return errors @@ -1111,7 +677,7 @@ annotation2: Annotation) -> AuditorError: """Constructs and returns a REPEATED_ID error.""" return AuditorError( - AuditorError.Type.REPEATED_ID, + ErrorType.REPEATED_ID, "{} in '{}:{}'".format(common_id, annotation1.file, annotation1.line), None, 0, "'{}:{}'".format(annotation2.file, annotation2.line)) @@ -1163,7 +729,7 @@ @property def hash_code(self) -> HashCode: - return compute_hash_value(self.id) + return util.compute_hash_value(self.id) def __str__(self): return "ArchivedAnnotation({})".format(",".join( @@ -1395,8 +961,8 @@ for unique_id, archived in self.archive.items(): if archived.hash_code in used_codes: errors.append( - AuditorError(AuditorError.Type.HASH_CODE_COLLISION, - str(archived.hash_code), None, 0, unique_id)) + AuditorError(ErrorType.HASH_CODE_COLLISION, str(archived.hash_code), + None, 0, unique_id)) else: used_codes[archived.hash_code] = unique_id @@ -1405,14 +971,14 @@ for os in archived.os_list: if os not in SUPPORTED_PLATFORMS: errors.append( - AuditorError(AuditorError.Type.INVALID_OS, "", + AuditorError(ErrorType.INVALID_OS, "", Exporter.ANNOTATIONS_XML_PATH, 0, os, unique_id)) # Check for consistency of "added_in_milestone" attribute. for unique_id, archived in self.archive.items(): if archived.added_in_milestone < MIN_MILESTONE: errors.append( - AuditorError(AuditorError.Type.INVALID_ADDED_IN, "", + AuditorError(ErrorType.INVALID_ADDED_IN, "", Exporter.ANNOTATIONS_XML_PATH, 0, str(archived.added_in_milestone), unique_id)) @@ -1473,6 +1039,9 @@ "auditor" / "chromeos" / "safe_list.txt") def __init__(self, current_platform: str, no_filtering: bool = False): + if current_platform not in SUPPORTED_PLATFORMS: + raise ValueError("Unsupported platform {}".format(current_platform)) + self.no_filtering = no_filtering self.extracted_annotations: List[Annotation] = [] @@ -1717,14 +1286,13 @@ # Check that the partial annotation was completed by another. if not found_a_pair: all_errors.append( - AuditorError(AuditorError.Type.INCOMPLETED_ANNOTATION, - partial.unique_id)) + AuditorError(ErrorType.INCOMPLETED_ANNOTATION, partial.unique_id)) # Check that completing annotations all complete another annotation. for completing in completing_annotations: if completing not in used_completing_annotations: all_errors.append( - AuditorError(AuditorError.Type.INCOMPLETED_ANNOTATION, + AuditorError(ErrorType.INCOMPLETED_ANNOTATION, completing.unique_id)) self.extracted_annotations.extend(new_annotations) @@ -1774,14 +1342,14 @@ ids_to_add = extracted_ids - grouping_xml_ids if ids_to_add: errors.append( - AuditorError(AuditorError.Type.ADD_GROUPING_XML, + AuditorError(ErrorType.ADD_GROUPING_XML, ", ".join(sorted(ids_to_add)))) # These ids should be removed from grouping.xml. ids_to_remove = grouping_xml_ids - extracted_ids if ids_to_remove: errors.append( - AuditorError(AuditorError.Type.REMOVE_GROUPING_XML, + AuditorError(ErrorType.REMOVE_GROUPING_XML, ", ".join(sorted(ids_to_remove)))) return errors @@ -1846,8 +1414,7 @@ if report_xml_updates: updates = self.exporter.get_required_updates() if updates: - errors.append( - AuditorError(AuditorError.Type.ANNOTATIONS_XML_UPDATE, updates)) + errors.append(AuditorError(ErrorType.ANNOTATIONS_XML_UPDATE, updates)) return errors @@ -1875,36 +1442,14 @@ self.skip_compdb = skip_compdb # Exposed for testing. - self.traffic_annotation = self.import_compiled_proto() - self.auditor = Auditor(get_current_platform(self.build_path), + global traffic_annotation_pb2 + global traffic_annotation + traffic_annotation_pb2 = util.import_compiled_proto(self.build_path) + traffic_annotation = traffic_annotation_pb2.NetworkTrafficAnnotation + self.traffic_annotation = traffic_annotation + self.auditor = Auditor(util.get_current_platform(self.build_path), self.no_filtering) - def import_compiled_proto(self) -> Any: - """Global import from function. |self.build_path| is needed to perform - this import, hence why it's not a top-level import. - - The compiled proto is located ${self.build_path}/pyproto/ and generated - as a part of compiling Chrome.""" - # Use the build path to import the compiled traffic annotation proto. - proto_path = (self.build_path / "pyproto" / "chrome" / "browser" / - "privacy") - sys.path.insert(0, str(proto_path)) - - try: - global traffic_annotation_pb2 - global traffic_annotation - import traffic_annotation_pb2 - # Used for accessing enum constants. - from traffic_annotation_pb2 import NetworkTrafficAnnotation as \ - traffic_annotation - return traffic_annotation - except ImportError as e: - logger.critical( - "Failed to import the compiled traffic annotation proto. Make sure "+ \ - "Chrome is built in '{}' before running this script.".format( - self.build_path)) - raise - def main(self) -> int: if self.no_filtering and self.path_filters: logger.warning("The path_filters input is being ignored.") @@ -1926,9 +1471,9 @@ # Write annotations TSV file. if self.annotations_file is not None: missing_ids = self.auditor.exporter.get_other_platforms_annotation_ids() - write_annotations_tsv_file(self.annotations_file, - self.auditor.extracted_annotations, - missing_ids) + util.write_annotations_tsv_file(self.annotations_file, + self.auditor.extracted_annotations, + missing_ids) # Update annotations.xml if everything else is OK and the auditor is not # in test-only mode.
diff --git a/tools/traffic_annotation/scripts/auditor/auditor_test.py b/tools/traffic_annotation/scripts/auditor/auditor_test.py index 8b3242f..5fc94dad 100755 --- a/tools/traffic_annotation/scripts/auditor/auditor_test.py +++ b/tools/traffic_annotation/scripts/auditor/auditor_test.py
@@ -11,11 +11,15 @@ import os import platform import sys +import tempfile import unittest -from auditor import * from typing import cast, Tuple +from auditor import * +from error import * +from util import * + # Path to the test_data/ dir. TEST_DATA_DIR = SCRIPT_DIR.parent / "test_data" @@ -187,13 +191,13 @@ Annotation.Type.BRANCHED_COMPLETING), ("good_completing_annotation.txt", None, Annotation.Type.COMPLETING), ("good_partial_annotation.txt", None, Annotation.Type.PARTIAL), - ("good_test_annotation.txt", AuditorError.Type.TEST_ANNOTATION, None), - ("missing_annotation.txt", AuditorError.Type.MISSING_TAG_USED, None), - ("good_no_annotation.txt", AuditorError.Type.NO_ANNOTATION, None), - ("bad_syntax_annotation1.txt", AuditorError.Type.SYNTAX, None), - ("bad_syntax_annotation2.txt", AuditorError.Type.SYNTAX, None), - ("bad_syntax_annotation3.txt", AuditorError.Type.SYNTAX, None), - ("bad_syntax_annotation4.txt", AuditorError.Type.SYNTAX, None), + ("good_test_annotation.txt", ErrorType.TEST_ANNOTATION, None), + ("missing_annotation.txt", ErrorType.MISSING_TAG_USED, None), + ("good_no_annotation.txt", ErrorType.NO_ANNOTATION, None), + ("bad_syntax_annotation1.txt", ErrorType.SYNTAX, None), + ("bad_syntax_annotation2.txt", ErrorType.SYNTAX, None), + ("bad_syntax_annotation3.txt", ErrorType.SYNTAX, None), + ("bad_syntax_annotation4.txt", ErrorType.SYNTAX, None), # "fatal" means a Python exception gets raised. ("fatal_annotation1.txt", "fatal", None), ("fatal_annotation2.txt", "fatal", None), @@ -247,14 +251,14 @@ annotation.unique_id = reserved_id errors = self.run_id_checker(annotation) self.assertEqual(1, len(errors)) - self.assertEqual(AuditorError.Type.RESERVED_ID_HASH_CODE, errors[0].type) + self.assertEqual(ErrorType.RESERVED_ID_HASH_CODE, errors[0].type) annotation.type = Annotation.Type.PARTIAL annotation.unique_id = "nonempty" annotation.second_id = reserved_id errors = self.run_id_checker(annotation) self.assertEqual(1, len(errors)) - self.assertEqual(AuditorError.Type.RESERVED_ID_HASH_CODE, errors[0].type) + self.assertEqual(ErrorType.RESERVED_ID_HASH_CODE, errors[0].type) def test_repeated_ids_detection(self): """Tests if use of repeated ids are detected.""" @@ -272,7 +276,7 @@ self.create_annotation_sample(unique_id=i // 2) for i in range(20) ] errors = id_checker.check_ids(annotations) - self.assertCountEqual([AuditorError.Type.REPEATED_ID] * 10, + self.assertCountEqual([ErrorType.REPEATED_ID] * 10, [e.type for e in errors]) def test_similar_unique_and_second_ids_detection(self): @@ -680,7 +684,7 @@ self.assertTrue(errors) result = errors[0] - self.assertEqual(AuditorError.Type.SYNTAX, result.type) + self.assertEqual(ErrorType.SYNTAX, result.type) self.assertTrue("sender: \"Cloud Policy\"': Expected \"{\"" in str(result)) def test_incomplete_error(self) -> None: @@ -691,7 +695,7 @@ errors = self.auditor.run_all_checks([], True) self.assertTrue(errors) result = errors[0] - self.assertEqual(AuditorError.Type.INCOMPLETE_ANNOTATION, result.type) + self.assertEqual(ErrorType.INCOMPLETE_ANNOTATION, result.type) expected_missing_fields = [ "sender", "chrome_policy", "cookies_store", @@ -715,6 +719,23 @@ else: raise ValueError("Unrecognized host platform {}".format(host_platform)) + def test_write_annotations_tsv_file(self) -> None: + annotation, errors = self.deserialize("good_complete_annotation.txt") + self.assertEqual([], errors) + annotations = [annotation] + + self.maxDiff = None + tsv_path = Path(tempfile.mktemp()) + write_annotations_tsv_file(tsv_path, annotations, []) + self.assertTrue(tsv_path.exists()) + tsv_contents = tsv_path.read_text(encoding="utf-8") + expected_contents = """Unique ID\tLast Update\tSender\tDescription\tTrigger\tData\tDestination\tCookies Allowed\tCookies Store\tSetting\tChrome Policy\tComments\tSource File +supervised_user_refresh_token_fetcher\t\tSupervised Users\tFetches an OAuth2 refresh token scoped down to the Supervised User Sync scope and tied to the given Supervised User ID, identifying the Supervised User Profile to be created.\tCalled when creating a new Supervised User profile in Chromium to fetch OAuth credentials for using Sync with the new profile.\t"The request is authenticated with an OAuth2 access token identifying the Google account and contains the following information: +* The Supervised User ID, a randomly generated 64-bit identifier for the profile. +* The device name, to identify the refresh token in account management."\tGoogle\tNo\t\tUsers can disable this feature by toggling 'Let anyone add a person to Chrome' in Chromium settings, under People.\tSupervisedUserCreationEnabled: false\t\thttps://cs.chromium.org/chromium/src/?l=0 +""" + self.assertEqual(expected_contents, tsv_contents) + if __name__ == "__main__": unittest.main()
diff --git a/tools/traffic_annotation/scripts/auditor/error.py b/tools/traffic_annotation/scripts/auditor/error.py new file mode 100644 index 0000000..acbf7fc --- /dev/null +++ b/tools/traffic_annotation/scripts/auditor/error.py
@@ -0,0 +1,190 @@ +# 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. + +from pathlib import Path +from enum import Enum, auto +from typing import Optional + + +class ErrorType(Enum): + # Annotation syntax is not right. + SYNTAX = auto() + # Can't create a MutableNetworkTrafficAnnotationTag from anywhere (except + # in whitelisted files). + MUTABLE_TAG = auto() + # Annotation has some missing fields. + INCOMPLETE_ANNOTATION = auto() + # A partial of (branched-)completing annotation is not paired with another + # annotation to be completed. + INCOMPLETED_ANNOTATION = auto() + # Annotation has some inconsistent fields. + INCONSISTENT_ANNOTATION = auto() + # Two annotations that are supposed to merge cannot merge. + MERGE_FAILED = auto() + # A function is called with the "missing" tag. + MISSING_TAG_USED = auto() + # A function is called with the "test" or "test_partial" tag outside of a + # test file. + TEST_ANNOTATION = auto() + # A function is called with NO_TRAFFIC_ANNOTATION_YET tag. + NO_ANNOTATION = auto() + # An id has a hash code equal to a reserved word. + RESERVED_ID_HASH_CODE = auto() + # An id contains an invalid character (not alphanumeric or underscore). + ID_INVALID_CHARACTER = auto() + # An id is used in two places without matching conditions. Proper conditions + # include when 2 annotations are completing each other, or are different + # branches of the same annotation. + REPEATED_ID = auto() + # Annotation does not have a valid second id. + MISSING_SECOND_ID = auto() + # Two ids have equal hash codes. + HASH_CODE_COLLISION = auto() + # "os_list" is invalid in annotations.xml. + INVALID_OS = auto() + # "added_in_milestone" is invalid in annotations.xml. + INVALID_ADDED_IN = auto() + # annotations.xml requires an update. + ANNOTATIONS_XML_UPDATE = auto() + # Annotations should be added to grouping.xml. + ADD_GROUPING_XML = auto() + # Annotations should be removed from grouping.xml. + REMOVE_GROUPING_XML = auto() + + +class AuditorError: + def __init__(self, + result_type: ErrorType, + message: str = "", + file_path: Optional[Path] = None, + line: int = 0, + *extra_details: str): + self.type = result_type + self.message = message + self.file_path = file_path + self.line = line + self._details = [] + + assert message or result_type in [ + ErrorType.MISSING_TAG_USED, ErrorType.TEST_ANNOTATION, + ErrorType.NO_ANNOTATION, ErrorType.MISSING_SECOND_ID, + ErrorType.MUTABLE_TAG, ErrorType.INVALID_OS, ErrorType.INVALID_ADDED_IN + ] + + if message: + self._details.append(message) + self._details.extend(extra_details) + + def __str__(self) -> str: + if self.type == ErrorType.SYNTAX: + assert self._details + return ("SYNTAX: Annotation at '{}:{}' has the following syntax" + " error: {}".format(self.file_path, self.line, + str(self._details[0]).replace("\n", " "))) + + if self.type == ErrorType.MUTABLE_TAG: + return ("MUTABLE_TAG: Calling CreateMutableNetworkTrafficAnnotationTag() " + "is not safelisted at '{}:{}'.".format(self.file_path, self.line)) + + if self.type == ErrorType.INCOMPLETE_ANNOTATION: + assert self._details + return ("INCOMPLETE_ANNOTATION: Annotation at '{}:{}' has the" + " following missing fields: {}".format(self.file_path, self.line, + self._details[0])) + + if self.type == ErrorType.INCOMPLETED_ANNOTATION: + assert self._details + return ("INCOMPLETED_ANNOTATION: Annotation '{}' is never " + "completed.".format(self._details[0])) + + if self.type == ErrorType.INCONSISTENT_ANNOTATION: + assert self._details + return ("INCONSISTENT_ANNOTATION: Annotation at '{}:{}' has the " + "following inconsistencies: {}".format(self.file_path, self.line, + self._details[0])) + if self.type == ErrorType.MERGE_FAILED: + assert len(self._details) == 3 + return ("MERGE_FAILED: Annotations '{}' and '{}' cannot be merged due to " + "the following error(s): {}".format(self._details[1], + self._details[2], + self._details[0])) + + if self.type == ErrorType.MISSING_TAG_USED: + return ("MISSING_TAG_USED: MISSING_TRAFFIC_ANNOTATION tag used in " + "'{}:{}'.".format(self.file_path, self.line)) + + if self.type == ErrorType.TEST_ANNOTATION: + return ("TEST_ANNOTATION: Annotation for tests used in '{}:{}'.".format( + self.file_path, self.line)) + + if self.type == ErrorType.NO_ANNOTATION: + return "NO_ANNOTATION: Empty annotation in '{}:{}'.".format( + self.file_path, self.line) + + if self.type == ErrorType.RESERVED_ID_HASH_CODE: + assert self._details + return ("RESERVED_ID_HASH_CODE: Id '{}' in '{}:{}' has a hash code equal " + "to a reserved word and should be changed.".format( + self._details[0], self.file_path, self.line)) + + if self.type == ErrorType.HASH_CODE_COLLISION: + assert len(self._details) == 2 + return ("HASH_CODE_COLLISION: The following annotations have colliding " + "hash codes and should be updated: '{}', '{}'.".format( + self._details[0], self._details[1])) + + if self.type == ErrorType.REPEATED_ID: + assert len(self._details) == 2 + return ("REPEATED_ID: The following annotations have equal ids and " + "should be updated: {}, {}.".format(self._details[0], + self._details[1])) + + if self.type == ErrorType.ID_INVALID_CHARACTER: + assert self._details + return ("ID_INVALID_CHARACTER: Id '{}' in '{}:{}' contains an invalid " + "character.".format(self._details[0], self.file_path, self.line)) + + if self.type == ErrorType.MISSING_SECOND_ID: + return ("MISSING_SECOND_ID: Second id of annotation at '{}:{}' should be " + "updated, as it has the same hash code as the first one.".format( + self.file_path, self.line)) + + if self.type == ErrorType.INVALID_OS: + assert len(self._details) == 2 + return ("INVALID_OS: Invalid OS '{}' in annotation '{}' at {}.".format( + self._details[0], self._details[1], self.file_path)) + + if self.type == ErrorType.INVALID_ADDED_IN: + assert len(self._details) == 2 + return ("INVALID_ADDED_IN: Invalid or missing added_in_milestone '{}' in " + "annotation '{}' at {}.".format(self._details[0], + self._details[1], self.file_path)) + + if self.type == ErrorType.ADD_GROUPING_XML: + assert self._details + return ("ADD_GROUPING_XML: The following annotations should be added " + "to an existing group in " + "tools/traffic_annotation/summary/grouping.xml: {}.".format( + self._details[0])) + + if self.type == ErrorType.REMOVE_GROUPING_XML: + assert self._details + return ("REMOVE_GROUPING_XML: The following annotations are not needed " + "in tools/traffic_annotation/summary/grouping.xml, and should be " + "removed: {}.".format(self._details[0])) + + if self.type == ErrorType.ANNOTATIONS_XML_UPDATE: + assert self._details + return ( + "'tools/traffic_annotation/summary/annotations.xml' requires update. " + "It is recommended to run traffic_annotation_auditor locally to do " + "the updates automatically (please refer to tools/traffic_annotation/" + "auditor/README.md), but you can also apply the following edit(s) to " + "do it manually:\n{}\n\n".format(self._details[0])) + + raise NotImplementedError("Unimplemented ErrorType: {}".format( + self.type.name)) + + def __repr__(self) -> str: + return "AuditorError(\"{}\")".format(str(self))
diff --git a/tools/traffic_annotation/scripts/auditor/util.py b/tools/traffic_annotation/scripts/auditor/util.py new file mode 100644 index 0000000..3bbd97a5f --- /dev/null +++ b/tools/traffic_annotation/scripts/auditor/util.py
@@ -0,0 +1,281 @@ +# 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. + +import logging +import platform +import re +import sys + +from functools import reduce +from google.protobuf import text_format +from google.protobuf.descriptor import FieldDescriptor +from google.protobuf.message import Message +from pathlib import Path +from typing import NewType, Any, Optional, List, Iterable + +UniqueId = NewType("UniqueId", str) +HashCode = NewType("HashCode", int) + +# Configure logging with timestamp, log level, filename, and line number. +logging.basicConfig( + level=logging.INFO, + format="[%(asctime)s:%(levelname)s:%(filename)s(%(lineno)d)] %(message)s") +logger = logging.getLogger(__name__) + + +def import_compiled_proto(build_path) -> Any: + """Global import from function. |self.build_path| is needed to perform + this import, hence why it's not a top-level import. + + The compiled proto is located ${build_path}/pyproto/ and generated as a part + of compiling Chrome.""" + # Use the build path to import the compiled traffic annotation proto. + proto_path = build_path / "pyproto" / "chrome" / "browser" / "privacy" + sys.path.insert(0, str(proto_path)) + + try: + global traffic_annotation_pb2 + global traffic_annotation + import traffic_annotation_pb2 + # Used for accessing enum constants. + from traffic_annotation_pb2 import NetworkTrafficAnnotation as \ + traffic_annotation + return traffic_annotation_pb2 + except ImportError as e: + logger.critical( + "Failed to import the compiled traffic annotation proto. Make sure "+ \ + "Chrome is built in '{}' before running this script.".format( + build_path)) + raise + + +def get_current_platform(build_path: Optional[Path] = None) -> str: + """Return the target platform of |build_path| based on heuristics.""" + # Use host platform as the source of truth (in most cases). + current_platform: str = platform.system().lower() + + if current_platform == "linux" and build_path is not None: + # It could be an Android build directory, being compiled from a Linux host. + # Look for a target_os="android" line in args.gn. + try: + gn_args = (build_path / "args.gn").read_text(encoding="utf-8") + pattern = re.compile(r"^\s*target_os\s*=\s*\"(android|chromeos)\"\s*$", + re.MULTILINE) + match = pattern.search(gn_args) + if match: + current_platform = match.group(1) + + except (ValueError, OSError) as e: + logger.info(e) + # Maybe the file's absent, or it can't be decoded as UTF-8, or something. + # It's probably not Android/ChromeOS in that case. + pass + + return current_platform + + +def twos_complement_8bit(b: int) -> int: + """Interprets b like a signed 8-bit integer, possibly changing its sign. + + For instance, twos_complement_8bit(204) returns -52.""" + if b >= 256: + raise ValueError("b must fit inside 8 bits") + if b & (1 << 7): + # Negative number, calculate its value using two's-complement. + return b - (1 << 8) + else: + # Positive number, do not touch. + return b + + +def iterative_hash(s: str) -> HashCode: + """Compute the has code of the given string as in: + net/traffic_annotation/network_traffic_annotation.h + + Args: + s: str + The seed, e.g. unique id of traffic annotation. + Returns: int + A hash code. + """ + return HashCode( + reduce(lambda acc, b: (acc * 31 + twos_complement_8bit(b)) % 138003713, + s.encode("utf-8"), 0)) + + +def compute_hash_value(text: str) -> HashCode: + """Same as iterative_hash, but returns -1 for empty strings.""" + return iterative_hash(text) if text else HashCode(-1) + + +def merge_string_field(src: Message, dst: Message, field: str): + """Merges the content of one string field into an annotation.""" + if getattr(src, field): + if getattr(dst, field): + setattr(dst, field, "{}\n{}".format(getattr(src, field), + getattr(dst, field))) + else: + setattr(dst, field, getattr(src, field)) + + +def fill_proto_with_bogus(proto: Message, field_numbers: List[int]): + """Fill proto with bogus values for the fields identified by field_numbers. + Uses reflection to fill the proto with the right types.""" + descriptor = proto.DESCRIPTOR + for field_number in field_numbers: + field_number = abs(field_number) + + if field_number not in descriptor.fields_by_number: + raise ValueError("{} is not a valid {} field".format( + field_number, descriptor.name)) + + field = descriptor.fields_by_number[field_number] + repeated = field.label == FieldDescriptor.LABEL_REPEATED + + if field.type == FieldDescriptor.TYPE_STRING and not repeated: + setattr(proto, field.name, "[Archived]") + elif field.type == FieldDescriptor.TYPE_ENUM and not repeated: + # Assume the 2nd value in the enum is reasonable, since the 1st is + # UNSPECIFIED. + setattr(proto, field.name, field.enum_type.values[1].number) + elif field.type == FieldDescriptor.TYPE_MESSAGE and repeated: + getattr(proto, field.name).add() + else: + raise NotImplementedError("Unimplemented proto field type {} ({})".format( + field.type, "repeated" if repeated else "non-repeated")) + + +def extract_annotation_id(line: str) -> Optional[UniqueId]: + """Returns the annotation id given an '<item id=...' line""" + m = re.search('id="([^"]+)"', line) + return UniqueId(m.group(1)) if m else None + + +def escape_for_tsv(text: str) -> str: + """Changes double-quotes to single-quotes, and adds double-quotes around the + text if it has newlines/tabs.""" + text.replace("\"", "'") + if "\n" in text or "\t" in text: + return "\"{}\"".format(text) + return text + + +def policy_to_text(chrome_policy: Iterable[Message]) -> str: + """Unnests the policy name/values from chrome_policy, producing a + human-readable string. + + For example, this: + chrome_policy { + SyncDisabled { + policy_options { + mode: MANDATORY + } + SyncDisabled: true + } + } + + becomes this: + SyncDisabled: true""" + items = [] + # Use the protobuf serializer library to print the fields, 2 levels deep. + for policy in chrome_policy: + for field, value in policy.ListFields(): + for subfield, subvalue in value.ListFields(): + if subfield.name == "policy_options": + # Skip the policy_options field. + continue + writer = text_format.TextWriter(as_utf8=True) + text_format.PrintField(subfield, + subvalue, + writer, + as_one_line=True, + use_short_repeated_primitives=True) + items.append(writer.getvalue().strip()) + # We wrote an extra comma at the end, remove it before returning. + return ", ".join(items) + return re.sub(r", $", "", writer.getvalue()).strip() + + +def write_annotations_tsv_file(file_path: Path, annotations: List["Annotation"], + missing_ids: List[UniqueId]): + """Writes a TSV file of all annotations and their contents in file_path.""" + logger.info("Saving annotations to TSV file: {}.".format(file_path)) + Destination = traffic_annotation.TrafficSemantics.Destination + CookiesAllowed = traffic_annotation.TrafficPolicy.CookiesAllowed + + lines = [] + title = "Unique ID\tLast Update\tSender\tDescription\tTrigger\tData\t" + \ + "Destination\tCookies Allowed\tCookies Store\tSetting\tChrome Policy\t" + \ + "Comments\tSource File" + + column_count = title.count("\t") + for missing_id in missing_ids: + lines.append(missing_id + "\t" * column_count) + + for annotation in annotations: + if annotation.type.value != "definition": + continue + + # TODO(nicolaso): Use StringIO for faster concatenation. + + line = annotation.proto.unique_id + # Placeholder for Last Update Date, will be updated in the scripts. + line += "\t" + + # Semantics. + semantics = annotation.proto.semantics + semantics_list = [ + semantics.sender, + escape_for_tsv(semantics.description), + escape_for_tsv(semantics.trigger), + escape_for_tsv(semantics.data), + ] + + for semantic_info in semantics_list: + line += "\t{}".format(semantic_info) + + destination_names = { + Destination.WEBSITE: "Website", + Destination.GOOGLE_OWNED_SERVICE: "Google", + Destination.LOCAL: "Local", + Destination.OTHER: "Other", + } + if (semantics.destination == Destination.OTHER + and semantics.destination_other): + line += "\tOther: {}".format(semantics.destination_other) + elif semantics.destination in destination_names: + line += "\t{}".format(destination_names[semantics.destination]) + else: + raise ValueError("Invalid value for the semantics.destination field") + + # Policy. + policy = annotation.proto.policy + if annotation.proto.policy.cookies_allowed == CookiesAllowed.YES: + line += "\tYes" + else: + line += "\tNo" + + line += "\t{}".format(escape_for_tsv(policy.cookies_store)) + line += "\t{}".format(escape_for_tsv(policy.setting)) + + # Chrome policies. + if policy.chrome_policy: + policies_text = policy_to_text(policy.chrome_policy) + else: + policies_text = policy.policy_exception_justification + line += "\t{}".format(escape_for_tsv(policies_text)) + + # Comments. + line += "\t{}".format(escape_for_tsv(annotation.proto.comments)) + # Source. + source = annotation.proto.source + code_search_link = "https://cs.chromium.org/chromium/src/" + line += "\t{}{}?l={}".format(code_search_link, source.file, source.line) + lines.append(line) + + lines.sort() + lines.insert(0, title) + report = "\n".join(lines) + "\n" + + file_path.write_text(report, encoding="utf-8")
diff --git a/tools/vim/OWNERS b/tools/vim/OWNERS index e9790fa..dab87902 100644 --- a/tools/vim/OWNERS +++ b/tools/vim/OWNERS
@@ -1,4 +1,3 @@ -asanka@chromium.org dcheng@chromium.org lukasza@chromium.org scottmg@chromium.org
diff --git a/ui/accessibility/extensions/OWNERS b/ui/accessibility/extensions/OWNERS new file mode 100644 index 0000000..7d43a55 --- /dev/null +++ b/ui/accessibility/extensions/OWNERS
@@ -0,0 +1 @@ +anastasi@google.com
diff --git a/ui/aura/env.cc b/ui/aura/env.cc index f458afd..62d295c 100644 --- a/ui/aura/env.cc +++ b/ui/aura/env.cc
@@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/containers/cxx20_erase.h" #include "base/lazy_instance.h" +#include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/memory/raw_ptr.h" #include "base/observer_list_types.h" @@ -99,8 +100,9 @@ DCHECK(!g_primary_instance); // No make_unique as constructor is private. std::unique_ptr<Env> env(new Env()); + if (!env->Init()) + return {}; g_primary_instance = env.get(); - env->Init(); return env; } @@ -209,7 +211,7 @@ #endif } -void Env::Init() { +bool Env::Init() { #if defined(USE_OZONE) // The ozone platform can provide its own event source. So initialize the // platform before creating the default event source @@ -219,10 +221,14 @@ // Env::CreateInstance() instead of checking flags here. params.single_process = command_line->HasSwitch("single-process") || command_line->HasSwitch("in-process-gpu"); - ui::OzonePlatform::InitializeForUI(params); + if (!ui::OzonePlatform::InitializeForUI(params)) { + LOG(ERROR) << "The platform failed to initialize. Exiting."; + return false; + } #endif if (!ui::PlatformEventSource::GetInstance()) event_source_ = ui::PlatformEventSource::CreateDefault(); + return true; } void Env::NotifyWindowInitialized(Window* window) {
diff --git a/ui/aura/env.h b/ui/aura/env.h index 8fbc146..4f9bcbad 100644 --- a/ui/aura/env.h +++ b/ui/aura/env.h
@@ -147,7 +147,9 @@ Env(); - void Init(); + // Returns whether the initialisation was successful. If it was not, + // CreateInstance will return nullptr, and the process will eventually exit. + bool Init(); // Called by the Window when it is initialized. Notifies observers. void NotifyWindowInitialized(Window* window);
diff --git a/ui/ozone/platform/cast/ozone_platform_cast.cc b/ui/ozone/platform/cast/ozone_platform_cast.cc index e2c6e5c5..741bf0e 100644 --- a/ui/ozone/platform/cast/ozone_platform_cast.cc +++ b/ui/ozone/platform/cast/ozone_platform_cast.cc
@@ -124,7 +124,7 @@ usage == gfx::BufferUsage::SCANOUT; } - void InitializeUI(const InitParams& params) override { + bool InitializeUI(const InitParams& params) override { device_manager_ = CreateDeviceManager(); cursor_factory_ = std::make_unique<CursorFactory>(); gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); @@ -148,6 +148,8 @@ if (enable_dummy_software_rendering) surface_factory_ = std::make_unique<SurfaceFactoryCast>(); + + return true; } void InitializeGPU(const InitParams& params) override { overlay_manager_ = std::make_unique<OverlayManagerCast>();
diff --git a/ui/ozone/platform/drm/ozone_platform_drm.cc b/ui/ozone/platform/drm/ozone_platform_drm.cc index 08983311..dbfa1bba 100644 --- a/ui/ozone/platform/drm/ozone_platform_drm.cc +++ b/ui/ozone/platform/drm/ozone_platform_drm.cc
@@ -188,7 +188,7 @@ usage); } - void InitializeUI(const InitParams& args) override { + bool InitializeUI(const InitParams& args) override { // Ozone drm can operate in two modes configured at runtime. // 1. single-process mode where host and viz components // communicate via in-process mojo. Single-process mode can be single @@ -228,6 +228,8 @@ cursor_factory_ = std::make_unique<BitmapCursorFactory>(); host_drm_device_->SetDisplayManager(display_manager_.get()); + + return true; } void InitializeGPU(const InitParams& args) override {
diff --git a/ui/ozone/platform/flatland/ozone_platform_flatland.cc b/ui/ozone/platform/flatland/ozone_platform_flatland.cc index 39e81c5..9cd3257 100644 --- a/ui/ozone/platform/flatland/ozone_platform_flatland.cc +++ b/ui/ozone/platform/flatland/ozone_platform_flatland.cc
@@ -148,7 +148,7 @@ delegate, window_manager_->GetWindow(widget)->CloneViewRef()); } - void InitializeUI(const InitParams& params) override { + bool InitializeUI(const InitParams& params) override { if (!PlatformEventSource::GetInstance()) platform_event_source_ = std::make_unique<FlatlandPlatformEventSource>(); keyboard_layout_engine_ = std::make_unique<StubKeyboardLayoutEngine>(); @@ -170,6 +170,8 @@ if (base::ThreadTaskRunnerHandle::IsSet()) BindInMainProcessIfNecessary(); + + return true; } void InitializeGPU(const InitParams& params) override {
diff --git a/ui/ozone/platform/headless/ozone_platform_headless.cc b/ui/ozone/platform/headless/ozone_platform_headless.cc index faee29e..84ed83b7 100644 --- a/ui/ozone/platform/headless/ozone_platform_headless.cc +++ b/ui/ozone/platform/headless/ozone_platform_headless.cc
@@ -98,7 +98,7 @@ return std::make_unique<InputMethodMinimal>(delegate); } - void InitializeUI(const InitParams& params) override { + bool InitializeUI(const InitParams& params) override { window_manager_ = std::make_unique<HeadlessWindowManager>(); surface_factory_ = std::make_unique<HeadlessSurfaceFactory>(file_path_); // This unbreaks tests that create their own. @@ -112,6 +112,8 @@ input_controller_ = CreateStubInputController(); cursor_factory_ = std::make_unique<BitmapCursorFactory>(); gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); + + return true; } void InitializeGPU(const InitParams& params) override {
diff --git a/ui/ozone/platform/scenic/ozone_platform_scenic.cc b/ui/ozone/platform/scenic/ozone_platform_scenic.cc index 5fed0eb..52f3cc5 100644 --- a/ui/ozone/platform/scenic/ozone_platform_scenic.cc +++ b/ui/ozone/platform/scenic/ozone_platform_scenic.cc
@@ -157,7 +157,7 @@ delegate, window_manager_->GetWindow(widget)->CloneViewRef()); } - void InitializeUI(const InitParams& params) override { + bool InitializeUI(const InitParams& params) override { if (!PlatformEventSource::GetInstance()) platform_event_source_ = std::make_unique<ScenicPlatformEventSource>(); keyboard_layout_engine_ = std::make_unique<StubKeyboardLayoutEngine>(); @@ -178,6 +178,8 @@ if (base::ThreadTaskRunnerHandle::IsSet()) BindInMainProcessIfNecessary(); + + return true; } void InitializeGPU(const InitParams& params) override {
diff --git a/ui/ozone/platform/wayland/host/wayland_data_source.cc b/ui/ozone/platform/wayland/host/wayland_data_source.cc index 0cfe165..ad9dd8e 100644 --- a/ui/ozone/platform/wayland/host/wayland_data_source.cc +++ b/ui/ozone/platform/wayland/host/wayland_data_source.cc
@@ -11,6 +11,7 @@ #include <vector> #include "base/files/file_util.h" +#include "base/logging.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/ozone/platform/wayland/host/wayland_connection.h" @@ -33,12 +34,33 @@ delegate_->OnDataSourceFinish(completed); } +// Writes |data_str| to file descriptor |fd| assuming it is flagged as +// O_NONBLOCK, which implies in handling EAGAIN, besides EINTR. Returns true +// iff data is fully written to the given file descriptor. See the link below +// for more details about non-blocking behavior for 'write' syscall. +// https://pubs.opengroup.org/onlinepubs/007904975/functions/write.html +bool WriteDataNonBlocking(int fd, const std::string& data_str) { + const char* data = data_str.data(); + const ssize_t size = base::checked_cast<ssize_t>(data_str.size()); + ssize_t written = 0; + while (written < size) { + ssize_t result = write(fd, data + written, size - written); + if (result == -1) { + if (errno == EINTR || errno == EAGAIN) + continue; + return false; + } + written += result; + } + return true; +} + template <typename T> void DataSource<T>::HandleSendEvent(const std::string& mime_type, int32_t fd) { std::string contents; delegate_->OnDataSourceSend(mime_type, &contents); - bool done = base::WriteFileDescriptor(fd, contents); - DCHECK(done); + bool done = WriteDataNonBlocking(fd, contents); + VPLOG_IF(1, !done) << "Failed to write"; close(fd); }
diff --git a/ui/ozone/platform/wayland/ozone_platform_wayland.cc b/ui/ozone/platform/wayland/ozone_platform_wayland.cc index 926df534..b32bf5c4 100644 --- a/ui/ozone/platform/wayland/ozone_platform_wayland.cc +++ b/ui/ozone/platform/wayland/ozone_platform_wayland.cc
@@ -204,7 +204,11 @@ return connection_->xdg_decoration_manager_v1() == nullptr; } - void InitializeUI(const InitParams& args) override { + bool InitializeUI(const InitParams& args) override { + if (ShouldFailInitializeUIForTest()) { + LOG(ERROR) << "Failing for test"; + return false; + } // Initialize DeviceDataManager early as devices are set during // WaylandConnection::Initialize(). DeviceDataManager::CreateInstance(); @@ -217,8 +221,10 @@ KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( keyboard_layout_engine_.get()); connection_ = std::make_unique<WaylandConnection>(); - if (!connection_->Initialize()) - LOG(FATAL) << "Failed to initialize Wayland platform"; + if (!connection_->Initialize()) { + LOG(ERROR) << "Failed to initialize Wayland platform"; + return false; + } buffer_manager_connector_ = std::make_unique<WaylandBufferManagerConnector>( connection_->buffer_manager_host()); @@ -239,6 +245,8 @@ menu_utils_ = std::make_unique<WaylandMenuUtils>(connection_.get()); wayland_utils_ = std::make_unique<WaylandUtils>(); + + return true; } void InitializeGPU(const InitParams& args) override {
diff --git a/ui/ozone/platform/windows/ozone_platform_windows.cc b/ui/ozone/platform/windows/ozone_platform_windows.cc index 8ef72b26..2e37a74 100644 --- a/ui/ozone/platform/windows/ozone_platform_windows.cc +++ b/ui/ozone/platform/windows/ozone_platform_windows.cc
@@ -86,7 +86,7 @@ return nullptr; } - void InitializeUI(const InitParams& params) override { + bool InitializeUI(const InitParams& params) override { window_manager_ = std::make_unique<WindowsWindowManager>(); surface_factory_ = std::make_unique<WindowsSurfaceFactory>(); // This unbreaks tests that create their own. @@ -100,6 +100,8 @@ input_controller_ = CreateStubInputController(); cursor_factory_ = std::make_unique<WinCursorFactory>(); gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); + + return true; } void InitializeGPU(const InitParams& params) override {
diff --git a/ui/ozone/platform/x11/ozone_platform_x11.cc b/ui/ozone/platform/x11/ozone_platform_x11.cc index 013abeee..e584ae7 100644 --- a/ui/ozone/platform/x11/ozone_platform_x11.cc +++ b/ui/ozone/platform/x11/ozone_platform_x11.cc
@@ -221,14 +221,19 @@ return false; } - void InitializeUI(const InitParams& params) override { - // If opening the connection failed there is nothing we can do. Crash here - // instead of crashing later. If you are crashing here, make sure there is - // an X server running and $DISPLAY is set. - // In case of non-Ozone/X11, the very same check happens during the - // BrowserMainLoop::InitializeToolkit call. - if (!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) - CHECK(x11::Connection::Get()->Ready()) << "Missing X server or $DISPLAY"; + bool InitializeUI(const InitParams& params) override { + if (ShouldFailInitializeUIForTest()) { + LOG(ERROR) << "Failing for test"; + return false; + } + // If opening the connection failed, we can not do anything. The platform + // cannot initialise. + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kHeadless) && + !x11::Connection::Get()->Ready()) { + LOG(ERROR) << "Missing X server or $DISPLAY"; + return false; + } InitializeCommon(params); CreatePlatformEventSource(); @@ -253,6 +258,8 @@ x11_utils_ = std::make_unique<X11Utils>(); base::UmaHistogramEnumeration("Linux.WindowManager", GetWindowManagerUMA()); + + return true; } void InitializeGPU(const InitParams& params) override {
diff --git a/ui/ozone/public/ozone_platform.cc b/ui/ozone/public/ozone_platform.cc index 6cfa241..aa32ca5 100644 --- a/ui/ozone/public/ozone_platform.cc +++ b/ui/ozone/public/ozone_platform.cc
@@ -24,6 +24,8 @@ namespace { OzonePlatform* g_instance = nullptr; +bool g_fail_initialize_ui_for_test = false; + void EnsureInstance() { if (g_instance) return; @@ -64,16 +66,18 @@ } // static -void OzonePlatform::InitializeForUI(const InitParams& args) { +bool OzonePlatform::InitializeForUI(const InitParams& args) { EnsureInstance(); if (g_instance->initialized_ui_) - return; - g_instance->initialized_ui_ = true; + return true; g_instance->single_process_ = args.single_process; - g_instance->InitializeUI(args); + if (!g_instance->InitializeUI(args)) + return false; + g_instance->initialized_ui_ = true; // This is deliberately created after initializing so that the platform can // create its own version of DDM. DeviceDataManager::CreateInstance(); + return true; } // static @@ -177,6 +181,16 @@ void OzonePlatform::PostMainMessageLoopRun() {} +// static +bool OzonePlatform::ShouldFailInitializeUIForTest() { + return g_fail_initialize_ui_for_test; +} + +// static +void OzonePlatform::SetFailInitializeUIForTest(bool fail) { + g_fail_initialize_ui_for_test = fail; +} + void OzonePlatform::PreEarlyInitialize() {} } // namespace ui
diff --git a/ui/ozone/public/ozone_platform.h b/ui/ozone/public/ozone_platform.h index 6809e378..98e6f7e 100644 --- a/ui/ozone/public/ozone_platform.h +++ b/ui/ozone/public/ozone_platform.h
@@ -225,8 +225,11 @@ // Initializes the subsystems/resources necessary for the UI process (e.g. // events) with additional properties to customize the ozone platform // implementation. Ozone will not retain InitParams after returning from - // InitalizeForUI. - static void InitializeForUI(const InitParams& args); + // InitializeForUI. + // Returns whether the initialisation completed successfully. Should this + // have returned false, the browser must stop the startup and exit because it + // would not be able to work normally. + static bool InitializeForUI(const InitParams& args); // Initializes the subsystems for rendering but with additional properties // provided by |args| as with InitalizeForUI. @@ -338,12 +341,26 @@ bool single_process() const { return single_process_; } + static bool ShouldFailInitializeUIForTest(); + private: + friend class OzonePlatformTest; + + // For platforms that may fail at the early stage of initialising, sets so + // that they fail. + // See https://crbug.com/1280138. + static void SetFailInitializeUIForTest(bool fail); + // Optional method for pre-early initialization. In case of X11, sets X11 // error handlers so that errors can be caught if early initialization fails. virtual void PreEarlyInitialize(); - virtual void InitializeUI(const InitParams& params) = 0; + // Initialises the platform in the UI process. Returns whether that completed + // successfully, i. e., the startup process may proceed further. + // The platform implementation must check all conditions critical for normal + // operation, and return false if any of them are not met (e. g., the display + // server is not available). + virtual bool InitializeUI(const InitParams& params) = 0; virtual void InitializeGPU(const InitParams& params) = 0; bool initialized_ui_ = false;
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc index 7361210..283ee15 100644 --- a/ui/views/window/dialog_client_view.cc +++ b/ui/views/window/dialog_client_view.cc
@@ -23,8 +23,9 @@ #include "ui/views/controls/button/image_button.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/md_text_button.h" -#include "ui/views/layout/grid_layout.h" #include "ui/views/layout/layout_provider.h" +#include "ui/views/layout/table_layout.h" +#include "ui/views/metadata/view_factory.h" #include "ui/views/style/platform_style.h" #include "ui/views/view_observer.h" #include "ui/views/view_tracker.h" @@ -200,14 +201,10 @@ if (details.parent != button_row_container_) return; - // SetupViews() removes all children, managing data members itself. + // SetupViews() adds/removes children, and manages their position. if (adding_or_removing_views_) return; - // Otherwise, this should only happen during teardown. Ensure there are no - // references to deleted Views. - button_row_container_->SetLayoutManager(nullptr); - if (child == ok_button_) ok_button_ = nullptr; else if (child == cancel_button_) @@ -325,8 +322,7 @@ FocusManager* focus_manager = GetFocusManager(); ViewTracker view_tracker(focus_manager->GetFocusedView()); - // Clobber any existing LayoutManager since it has weak references to child - // Views which may be removed by SetupViews(). + // Clobber the layout manager in case there are no views in which to layout. button_row_container_->SetLayoutManager(nullptr); SetupViews(); @@ -344,46 +340,50 @@ button_row_container_->AddChildViewAt(extra_view_.get(), 0); } - GridLayout* layout = button_row_container_->SetLayoutManager( - std::make_unique<views::GridLayout>()); - layout->set_minimum_size(minimum_size_); - if (std::count(views.begin(), views.end(), nullptr) == kNumButtons) return; + // This will also clobber any existing layout manager and clear any settings + // it may already have. + auto* layout = button_row_container_->SetLayoutManager( + std::make_unique<views::TableLayout>()); + layout->SetMinimumSize(minimum_size_); + // The |resize_percent| constants. There's only one stretchy column (padding // to the left of ok/cancel buttons). - constexpr float kFixed = 0.f; - constexpr float kStretchy = 1.f; + constexpr float kFixed = views::TableLayout::kFixedSize; + constexpr float kStretchy = 1.0f; - // Button row is [ extra <pad+stretchy> second <pad> third ]. Ensure the <pad> - // column is zero width if there isn't a button on either side. + // Button row is [ extra <pad+stretchy> second <pad> third ]. Ensure the + // <pad> column is zero width if there isn't a button on either side. // GetExtraViewSpacing() handles <pad+stretchy>. LayoutProvider* const layout_provider = LayoutProvider::Get(); const int button_spacing = (ok_button_ && cancel_button_) ? layout_provider->GetDistanceMetric( DISTANCE_RELATED_BUTTON_HORIZONTAL) : 0; - - constexpr int kButtonRowId = 0; - ColumnSet* column_set = layout->AddColumnSet(kButtonRowId); - - // Rather than giving |button_row_container_| a Border, incorporate the insets - // into the layout. This simplifies min/max size calculations. - column_set->AddPaddingColumn(kFixed, button_row_insets_.left()); - column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, kFixed, - GridLayout::ColumnSize::kUsePreferred, 0, 0); - column_set->AddPaddingColumn(kStretchy, GetExtraViewSpacing()); - column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, kFixed, - GridLayout::ColumnSize::kUsePreferred, 0, 0); - column_set->AddPaddingColumn(kFixed, button_spacing); - column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, kFixed, - GridLayout::ColumnSize::kUsePreferred, 0, 0); - column_set->AddPaddingColumn(kFixed, button_row_insets_.right()); + // Rather than giving |button_row_container_| a Border, incorporate the + // insets into the layout. This simplifies min/max size calculations. + layout->SetMinimumSize(minimum_size_) + .AddPaddingColumn(kFixed, button_row_insets_.left()) + .AddColumn(LayoutAlignment::kStretch, LayoutAlignment::kStretch, kFixed, + TableLayout::ColumnSize::kUsePreferred, 0, 0) + .AddPaddingColumn(kStretchy, GetExtraViewSpacing()) + .AddColumn(LayoutAlignment::kStretch, LayoutAlignment::kStretch, kFixed, + TableLayout::ColumnSize::kUsePreferred, 0, 0) + .AddPaddingColumn(kFixed, button_spacing) + .AddColumn(LayoutAlignment::kStretch, LayoutAlignment::kStretch, kFixed, + TableLayout::ColumnSize::kUsePreferred, 0, 0) + .AddPaddingColumn(kFixed, button_row_insets_.right()) + .AddPaddingRow(kFixed, button_row_insets_.top()) + .AddRows(1, kFixed) + .AddPaddingRow(kFixed, button_row_insets_.bottom()) + .SetLinkedColumnSizeLimit(layout_provider->GetDistanceMetric( + DISTANCE_BUTTON_MAX_LINKABLE_WIDTH)); // Track which columns to link sizes under MD. constexpr int kViewToColumnIndex[] = {1, 3, 5}; - std::vector<int> columns_to_link; + std::vector<size_t> columns_to_link; // Skip views that are not a button, or are a specific subclass of Button // that should never be linked. Otherwise, link everything. @@ -392,23 +392,18 @@ !IsViewClass<ImageButton>(view); }; - layout->StartRowWithPadding(kFixed, kButtonRowId, kFixed, - button_row_insets_.top()); for (size_t view_index = 0; view_index < kNumButtons; ++view_index) { if (views[view_index]) { - layout->AddExistingView(views[view_index]); + RemoveFillerView(view_index); + button_row_container_->ReorderChildView(views[view_index], view_index); if (should_link(views[view_index])) columns_to_link.push_back(kViewToColumnIndex[view_index]); } else { - layout->SkipColumns(1); + AddFillerView(view_index); } } - column_set->set_linked_column_size_limit( - layout_provider->GetDistanceMetric(DISTANCE_BUTTON_MAX_LINKABLE_WIDTH)); - column_set->LinkColumnSizes(columns_to_link); - - layout->AddPaddingRow(kFixed, button_row_insets_.bottom()); + layout->LinkColumnSizes(columns_to_link); // The default focus is lost when child views are added back into the dialog. // This restores focus if the button is still available. @@ -434,10 +429,29 @@ delete extra_view_; extra_view_ = disowned_extra_view.release(); - if (extra_view_ && Button::AsButton(extra_view_)) + if (extra_view_ && IsViewClass<Button>(extra_view_)) extra_view_->SetGroup(kButtonGroup); } +void DialogClientView::AddFillerView(size_t view_index) { + DCHECK_LT(view_index, kNumButtons); + View*& filler = filler_views_[view_index]; + if (!filler) { + filler = button_row_container_->AddChildViewAt( + std::make_unique<View>(), + std::min(button_row_container_->children().size(), view_index)); + } +} + +void DialogClientView::RemoveFillerView(size_t view_index) { + DCHECK_LT(view_index, kNumButtons); + View*& filler = filler_views_[view_index]; + if (filler) { + button_row_container_->RemoveChildViewT(filler); + filler = nullptr; + } +} + BEGIN_METADATA(DialogClientView, ClientView) END_METADATA
diff --git a/ui/views/window/dialog_client_view.h b/ui/views/window/dialog_client_view.h index 073d5180..016f253 100644 --- a/ui/views/window/dialog_client_view.h +++ b/ui/views/window/dialog_client_view.h
@@ -112,6 +112,11 @@ // After calling this, no button row Views will be in the view hierarchy. void SetupViews(); + // Adds/Removes a filler view depending on whether the corresponding live view + // is present. + void AddFillerView(size_t view_index); + void RemoveFillerView(size_t view_index); + // How much to inset the button row. gfx::Insets button_row_insets_; @@ -129,6 +134,9 @@ // Container view for the button row. raw_ptr<ButtonRowContainer> button_row_container_ = nullptr; + // List of "filler" views used to keep columns in sync for TableLayout. + std::array<View*, kNumButtons> filler_views_ = {nullptr, nullptr, nullptr}; + // Used to prevent unnecessary or potentially harmful changes during // SetupLayout(). Everything will be manually updated afterwards. bool adding_or_removing_views_ = false;
diff --git a/ui/views/window/dialog_client_view_unittest.cc b/ui/views/window/dialog_client_view_unittest.cc index 32a1a8b5..3b78b837 100644 --- a/ui/views/window/dialog_client_view_unittest.cc +++ b/ui/views/window/dialog_client_view_unittest.cc
@@ -278,7 +278,13 @@ // Views are added to the contents view, not the client view, so the focus // chain within the client view is not affected. - EXPECT_EQ(nullptr, client_view()->cancel_button()->GetNextFocusableView()); + // NOTE: The TableLayout requires a view to be in every cell. "Dummy" non- + // focusable views are inserted to satisfy this requirement. + EXPECT_TRUE(!client_view()->cancel_button()->GetNextFocusableView() || + client_view() + ->cancel_button() + ->GetNextFocusableView() + ->GetFocusBehavior() == View::FocusBehavior::NEVER); } // Test that the contents view gets its preferred size in the basic dialog