diff --git a/DEPS b/DEPS index 500daca..6c73c54 100644 --- a/DEPS +++ b/DEPS
@@ -269,15 +269,15 @@ # 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': '1186b60fcfac987c2264d95f1a4a98018c718e19', + 'skia_revision': 'b2a8a7e3e89bfc39ae87459723ba8352ffa9933a', # 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': 'a0762ead80f58826ff6e09e19bccdc0bd65fc84b', + 'v8_revision': '1b54f0baf6431dd859964c33ca060e4af839b7f3', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '118a6484c8d008af595abe87ab91ee98f9006c4d', + 'angle_revision': '8af51b7ef9dc3e0920931f28189ddc639f89281a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -296,7 +296,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. - 'fuchsia_version': 'version:8.20220519.0.1', + 'fuchsia_version': 'version:8.20220519.3.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling google-toolbox-for-mac # and whatever else without interference from each other. @@ -348,7 +348,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': '5baff14b8c6a722d0cf426134c366c43f92c562a', + 'devtools_frontend_revision': '87999eee8a69e9a9d7de1238cf8b77e7e38ad0a2', # 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. @@ -384,7 +384,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'e9ce8326b7843be34e8a31a5a54600cb924c83f2', + 'dawn_revision': '132a8f48fe48bf22be489515ff428464b4bb002d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -765,7 +765,7 @@ }, 'src/ios/third_party/material_components_ios/src': { - 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '31892cf6c20691aac39b9f17278e08ded01aa491', + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '99d2e285427146c61bdb4293ffde246ee2c38117', 'condition': 'checkout_ios', }, @@ -914,7 +914,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': 'ysPZmJ22H1d0s_hhsbD8Z_63nV2LPoUuz24Ll_Xk788C', + 'version': 'PwPwlC5S7JV4CxubGV0WFH7vyAHBGvqQKWxj83IUPxcC', }, ], 'condition': 'checkout_android', @@ -1133,7 +1133,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'bd80a1be23d33ef037692b8b3d51b57292151267', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'cf9a77671386713037eeed5c62a8f0a10b25a07e', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1666,7 +1666,7 @@ 'condition': 'checkout_android', }, - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@db71a037284bf388785f93b74e62600bec781980', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@880c9e0050c60c6079bf25dd81761bae6bdf5009', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + 'ebe84bec02c041d28f902da0214bf442743fc907', @@ -1702,10 +1702,10 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'd4d598789af1e73a1bdd6c9eec246e75ff43551a', 'src/third_party/webgpu-cts/src': - Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '0dd7405d1bfa950a71572aeb77aa38aacef6653d', + Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'e48651de0135b8aca607e5f890f06c4649e641ac', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'f4fcdf1ee1fd5752f2af13fe731f5638363722ef', + Var('webrtc_git') + '/src.git' + '@' + 'fa6ec692324b04b751b047653c616320bc25012d', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1778,7 +1778,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@9b3abfc9a1e2ea583c82b857c612365e5d093d67', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@3dc7b09c03969425a317961974117488e0d14895', 'condition': 'checkout_src_internal', }, @@ -1830,7 +1830,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'gPj1Vtx3-SgEOnTvu19ohJJGxpHCrvWeRH9ZKaU9OkQC', + 'version': 'qJq23XcKB1Y1d24mJ8I7L4SwVgxw6WhfhGFTn7FPx38C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/ash/components/drivefs/fake_drivefs.cc b/ash/components/drivefs/fake_drivefs.cc index b7a3a42..4084844 100644 --- a/ash/components/drivefs/fake_drivefs.cc +++ b/ash/components/drivefs/fake_drivefs.cc
@@ -170,6 +170,13 @@ if (--pending_callbacks_ == 0) { auto query = base::ToLowerASCII( params_->title.value_or(params_->text_content.value_or(""))); + std::vector<std::string> mime_types; + if (params_->mime_types.has_value()) { + mime_types = params_->mime_types.value(); + } + if (params_->mime_type.has_value()) { + mime_types.emplace_back(params_->mime_type.value() + "/*"); + } // Filter out non-matching results. base::EraseIf(results_, [=](const auto& item_ptr) { @@ -188,9 +195,19 @@ if (params_->shared_with_me) { return !metadata->shared; } - if (params_->mime_type.has_value()) { - return !net::MatchesMimeType(params_->mime_type.value() + "/*", - metadata->content_mime_type); + if (!mime_types.empty()) { + std::string content_mime_type = metadata->content_mime_type; + if (content_mime_type.empty()) { + return true; + } + const auto find_mime_type_iter = std::find_if( + mime_types.begin(), mime_types.end(), + [content_mime_type](const std::string& mime_type) { + return net::MatchesMimeType(mime_type, content_mime_type); + }); + if (find_mime_type_iter == mime_types.end()) { + return true; + } } return false; });
diff --git a/ash/components/drivefs/mojom/drivefs.mojom b/ash/components/drivefs/mojom/drivefs.mojom index 4ac2cf6..6c961cc 100644 --- a/ash/components/drivefs/mojom/drivefs.mojom +++ b/ash/components/drivefs/mojom/drivefs.mojom
@@ -455,7 +455,7 @@ }; // Definition of the search request sent to DriveFS. -// Next MinVersion: 2 +// Next MinVersion: 3 struct QueryParameters { // Where this request should go to. enum QuerySource { @@ -495,7 +495,7 @@ // Results must be only from shared with me documents. bool shared_with_me = false; - // Results must be only from available localy on the device. Works only + // Results must be only from available locally on the device. Works only // with |kLocalOnly|. bool available_offline = false; @@ -505,6 +505,11 @@ // The kind of query to perform. [MinVersion=1] QueryKind query_kind = kRegular; + + // Search for documents whose mime types match any of the string in the array. + // Note: this field is preferred to "mime_type" field above, when processing + // the query, the "mime_type" will be merged into this "mime_types" field. + [MinVersion=2] array<string>? mime_types; }; // TODO(crbug.com/896777): Put this inside QueryParameters once linked bug is
diff --git a/ash/display/screen_ash.cc b/ash/display/screen_ash.cc index e3ead6a..6400703a 100644 --- a/ash/display/screen_ash.cc +++ b/ash/display/screen_ash.cc
@@ -42,7 +42,6 @@ : display_list_(screen_ash->GetAllDisplays()), primary_display_(screen_ash->GetPrimaryDisplay()) { SetDisplayForNewWindows(primary_display_.id()); - set_shutdown(true); } ScreenForShutdown(const ScreenForShutdown&) = delete;
diff --git a/ash/shelf/login_shelf_view.cc b/ash/shelf/login_shelf_view.cc index 7fcd8a5..3f36002 100644 --- a/ash/shelf/login_shelf_view.cc +++ b/ash/shelf/login_shelf_view.cc
@@ -656,6 +656,16 @@ lock_screen_action_background); login_data_dispatcher_observation_.Observe( Shell::Get()->login_screen_controller()->data_dispatcher()); + + // If feature is enabled, update the boolean kiosk_license_mode_. Otherwise, + // it's false by default. + if (features::IsKioskEnrollmentInOobeEnabled()) { + kiosk_license_mode_ = + Shell::Get() + ->system_tray_model() + ->enterprise_domain() + ->management_device_mode() == ManagementDeviceMode::kKioskSku; + } } LoginShelfView::~LoginShelfView() = default; @@ -665,7 +675,6 @@ } void LoginShelfView::AddedToWidget() { - Shell::Get()->system_tray_model()->enterprise_domain()->AddObserver(this); UpdateUi(); } @@ -872,21 +881,6 @@ SetLoginDialogState(state); } -void LoginShelfView::OnDeviceEnterpriseInfoChanged() { - // If feature is enabled, update the boolean kiosk_license_mode_. Otherwise, - // it's false by default. - if (features::IsKioskEnrollmentInOobeEnabled()) { - kiosk_license_mode_ = - Shell::Get() - ->system_tray_model() - ->enterprise_domain() - ->management_device_mode() == ManagementDeviceMode::kKioskSku; - UpdateUi(); - } -} - -void LoginShelfView::OnEnterpriseAccountDomainChanged() {} - void LoginShelfView::HandleLocaleChange() { for (views::View* child : children()) { if (child->GetClassName() == kLoginShelfButtonClassName) {
diff --git a/ash/shelf/login_shelf_view.h b/ash/shelf/login_shelf_view.h index 66f2701..e957a17 100644 --- a/ash/shelf/login_shelf_view.h +++ b/ash/shelf/login_shelf_view.h
@@ -19,7 +19,6 @@ #include "ash/shelf/kiosk_app_instruction_bubble.h" #include "ash/shelf/shelf_shutdown_confirmation_bubble.h" #include "ash/shutdown_controller_impl.h" -#include "ash/system/enterprise/enterprise_domain_observer.h" #include "ash/tray_action/tray_action.h" #include "ash/tray_action/tray_action_observer.h" #include "base/memory/weak_ptr.h" @@ -48,8 +47,7 @@ public TrayActionObserver, public LockScreenActionBackgroundObserver, public ShutdownControllerImpl::Observer, - public LoginDataDispatcher::Observer, - public EnterpriseDomainObserver { + public LoginDataDispatcher::Observer { public: enum ButtonId { kShutdown = 1, // Shut down the device. @@ -164,10 +162,6 @@ void OnUsersChanged(const std::vector<LoginUserInfo>& users) override; void OnOobeDialogStateChanged(OobeDialogState state) override; - // ash::EnterpriseDomainObserver - void OnDeviceEnterpriseInfoChanged() override; - void OnEnterpriseAccountDomainChanged() override; - // Called when a locale change is detected. Updates the login shelf button // strings. void HandleLocaleChange();
diff --git a/ash/wallpaper/wallpaper_view.cc b/ash/wallpaper/wallpaper_view.cc index feabb247..b26e921 100644 --- a/ash/wallpaper/wallpaper_view.cc +++ b/ash/wallpaper/wallpaper_view.cc
@@ -54,6 +54,8 @@ window->parent()->StackChildAtBottom(window); display::Display display = display::Screen::GetScreen()->GetDisplayNearestWindow(window); + display::ManagedDisplayInfo info = + Shell::Get()->display_manager()->GetDisplayInfo(display.id()); for (auto* child : children()) { child->SetBounds(0, 0, display.size().width(), display.size().height());
diff --git a/ash/webui/camera_app_ui/resources/js/expert.ts b/ash/webui/camera_app_ui/resources/js/expert.ts index c7614e2..1d24642 100644 --- a/ash/webui/camera_app_ui/resources/js/expert.ts +++ b/ash/webui/camera_app_ui/resources/js/expert.ts
@@ -20,6 +20,8 @@ * Toggles expert mode. */ export function toggleExpertMode(): void { + // TODO(b/231535710): When toggle expert mode, also check the state of all + // options under expert mode const newState = !state.get(state.State.EXPERT); setExpertMode(newState); }
diff --git a/ash/webui/camera_app_ui/resources/js/views/camera.ts b/ash/webui/camera_app_ui/resources/js/views/camera.ts index 77c6bd6..997c0ad7 100644 --- a/ash/webui/camera_app_ui/resources/js/views/camera.ts +++ b/ash/webui/camera_app_ui/resources/js/views/camera.ts
@@ -273,9 +273,9 @@ state.addObserver(state.State.ENABLE_MULTISTREAM_RECORDING, () => { this.cameraManager.reconfigure(); }); - for (const s of [state.State.EXPERT, state.State.ENABLE_PTZ_FOR_BUILTIN]) { - state.addObserver(s, () => this.cameraManager.reconfigure()); - } + state.addObserver(state.State.ENABLE_PTZ_FOR_BUILTIN, () => { + this.cameraManager.reconfigure(); + }); this.initVideoEncoderOptions(); await this.initScanMode();
diff --git a/ash/webui/eche_app_ui/apps_access_manager.h b/ash/webui/eche_app_ui/apps_access_manager.h index 956adcd..6add6ec 100644 --- a/ash/webui/eche_app_ui/apps_access_manager.h +++ b/ash/webui/eche_app_ui/apps_access_manager.h
@@ -36,7 +36,19 @@ // The permission is granted by user action. kUserActionPermissionGranted = 2, - kMaxValue = kUserActionPermissionGranted + // Users explicitly decline the permission request. + kUserActionPermissionRejected = 3, + + // The permission request time out after 20 seconds. + kUserActionTimeout = 4, + + // The permission request is canceled because the device screen off. + kUserActionCanceled = 5, + + // System exceptions thrown out. + kSystemError = 6, + + kMaxValue = kSystemError }; class Observer : public base::CheckedObserver {
diff --git a/ash/webui/eche_app_ui/apps_access_manager_impl.cc b/ash/webui/eche_app_ui/apps_access_manager_impl.cc index c08b07b..4f4b57f 100644 --- a/ash/webui/eche_app_ui/apps_access_manager_impl.cc +++ b/ash/webui/eche_app_ui/apps_access_manager_impl.cc
@@ -119,6 +119,29 @@ "Eche.Onboarding.UserAction", OnboardingUserActionMetric::kUserActionPermissionGranted); } + } else if (apps_setup_response.result() == + proto::Result::RESULT_ERROR_USER_REJECTED) { + base::UmaHistogramEnumeration( + "Eche.Onboarding.UserAction", + OnboardingUserActionMetric::kUserActionPermissionRejected); + } else if (apps_setup_response.result() == + proto::Result::RESULT_ERROR_ACTION_TIMEOUT) { + base::UmaHistogramEnumeration( + "Eche.Onboarding.UserAction", + OnboardingUserActionMetric::kUserActionTimeout); + } else if (apps_setup_response.result() == + proto::Result::RESULT_ERROR_ACTION_CANCELED) { + base::UmaHistogramEnumeration( + "Eche.Onboarding.UserAction", + OnboardingUserActionMetric::kUserActionCanceled); + } else if (apps_setup_response.result() == + proto::Result::RESULT_ERROR_SYSTEM) { + base::UmaHistogramEnumeration("Eche.Onboarding.UserAction", + OnboardingUserActionMetric::kSystemError); + } else { + base::UmaHistogramEnumeration( + "Eche.Onboarding.UserAction", + OnboardingUserActionMetric::kUserActionUnknown); } }
diff --git a/ash/webui/eche_app_ui/eche_message_receiver_impl_unittest.cc b/ash/webui/eche_app_ui/eche_message_receiver_impl_unittest.cc index 12c952f..fde7aed 100644 --- a/ash/webui/eche_app_ui/eche_message_receiver_impl_unittest.cc +++ b/ash/webui/eche_app_ui/eche_message_receiver_impl_unittest.cc
@@ -140,7 +140,7 @@ TEST_F(EcheMessageReceiverImplTest, OnGetAppsAccessStateResponseReceived) { proto::GetAppsAccessStateResponse response; - response.set_result(eche_app::proto::Result::RESULT_ERROR_ACTION_FAILED); + response.set_result(eche_app::proto::Result::RESULT_NO_ERROR); response.set_apps_access_state( eche_app::proto::AppsAccessState::ACCESS_GRANTED); proto::ExoMessage message; @@ -155,7 +155,7 @@ EXPECT_EQ(0u, GetNumAppsSetupResponseCalls()); EXPECT_EQ(0u, GetNumStatusChangeCalls()); EXPECT_EQ(0u, GetNumAppsPolicyStateChangeCalls()); - EXPECT_EQ(eche_app::proto::Result::RESULT_ERROR_ACTION_FAILED, + EXPECT_EQ(eche_app::proto::Result::RESULT_NO_ERROR, actual_apps_state.result()); EXPECT_EQ(eche_app::proto::AppsAccessState::ACCESS_GRANTED, actual_apps_state.apps_access_state()); @@ -163,7 +163,7 @@ TEST_F(EcheMessageReceiverImplTest, OnSendAppsSetupResponseReceived) { proto::SendAppsSetupResponse response; - response.set_result(eche_app::proto::Result::RESULT_ERROR_ACTION_FAILED); + response.set_result(eche_app::proto::Result::RESULT_NO_ERROR); response.set_apps_access_state( eche_app::proto::AppsAccessState::ACCESS_GRANTED); proto::ExoMessage message; @@ -178,7 +178,7 @@ EXPECT_EQ(1u, GetNumAppsSetupResponseCalls()); EXPECT_EQ(0u, GetNumStatusChangeCalls()); EXPECT_EQ(0u, GetNumAppsPolicyStateChangeCalls()); - EXPECT_EQ(eche_app::proto::Result::RESULT_ERROR_ACTION_FAILED, + EXPECT_EQ(eche_app::proto::Result::RESULT_NO_ERROR, actual_apps_setup_response.result()); EXPECT_EQ(eche_app::proto::AppsAccessState::ACCESS_GRANTED, actual_apps_setup_response.apps_access_state());
diff --git a/ash/webui/eche_app_ui/proto/exo_messages.proto b/ash/webui/eche_app_ui/proto/exo_messages.proto index f5e8e775..e8ed701 100644 --- a/ash/webui/eche_app_ui/proto/exo_messages.proto +++ b/ash/webui/eche_app_ui/proto/exo_messages.proto
@@ -48,8 +48,10 @@ enum Result { RESULT_UNKNOWN = 0; RESULT_NO_ERROR = 1; - RESULT_ERROR_ACTION_FAILED = 2; - RESULT_ERROR_NOT_SUPPORTED = 3; + RESULT_ERROR_USER_REJECTED = 2; + RESULT_ERROR_ACTION_TIMEOUT = 3; + RESULT_ERROR_ACTION_CANCELED = 4; + RESULT_ERROR_SYSTEM = 5; } message SendAppsSetupRequest {}
diff --git a/ash/webui/shimless_rma/resources/splash_screen.js b/ash/webui/shimless_rma/resources/splash_screen.js index 51422f8..9edcf9b 100644 --- a/ash/webui/shimless_rma/resources/splash_screen.js +++ b/ash/webui/shimless_rma/resources/splash_screen.js
@@ -41,8 +41,7 @@ * @protected */ getSplashInstructionsText_() { - return this.i18n('shimlessSplashRemembering') + - this.i18n('shimlessSplashLoading'); + return this.i18n('shimlessSplashRemembering'); } }
diff --git a/ash/webui/shimless_rma/shimless_rma.cc b/ash/webui/shimless_rma/shimless_rma.cc index 0e4872b..b1e200c 100644 --- a/ash/webui/shimless_rma/shimless_rma.cc +++ b/ash/webui/shimless_rma/shimless_rma.cc
@@ -71,7 +71,6 @@ {"componentPowerButton", IDS_SHIMLESS_RMA_COMPONENT_POWER_BUTTON}, // Splash screen {"shimlessSplashRemembering", IDS_SHIMLESS_RMA_SPLASH_REMEMBERING}, - {"shimlessSplashLoading", IDS_SHIMLESS_RMA_SPLASH_LOADING}, // Common buttons {"exitButtonLabel", IDS_SHIMLESS_RMA_EXIT_BUTTON}, {"backButtonLabel", IDS_SHIMLESS_RMA_BACK_BUTTON}, @@ -277,7 +276,7 @@ {"confirmDeviceInfoSkuLabel", IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_SKU_LABEL}, {"confirmDeviceInfoResetButtonLabel", - IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_RESET_BUTTON_LABEL}, + IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_REVERT_BUTTON_LABEL}, {"confirmDeviceInfoSkuWarning", IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_SKU_WARNING}, // Firmware reimaging page
diff --git a/base/BUILD.gn b/base/BUILD.gn index caae724..be46e9c6 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -1019,11 +1019,11 @@ if (is_win) { sources += [ + "debug/close_handle_hook_win.cc", + "debug/close_handle_hook_win.h", "debug/debugger_win.cc", "debug/gdi_debug_util_win.cc", "debug/gdi_debug_util_win.h", - "debug/handle_hooks_win.cc", - "debug/handle_hooks_win.h", "debug/invalid_access_win.cc", "debug/invalid_access_win.h", "debug/stack_trace_win.cc",
diff --git a/base/allocator/partition_alloc_features.cc b/base/allocator/partition_alloc_features.cc index ff4735a..cc2809c 100644 --- a/base/allocator/partition_alloc_features.cc +++ b/base/allocator/partition_alloc_features.cc
@@ -123,5 +123,9 @@ const Feature kPartitionAllocDCScan{"PartitionAllocDCScan", FEATURE_DISABLED_BY_DEFAULT}; +// Whether to sort the active slot spans in PurgeMemory(). +extern const Feature kPartitionAllocSortActiveSlotSpans{ + "PartitionAllocSortActiveSlotSpans", FEATURE_DISABLED_BY_DEFAULT}; + } // namespace features } // namespace base
diff --git a/base/allocator/partition_alloc_features.h b/base/allocator/partition_alloc_features.h index 6ac878a..6b34d01 100644 --- a/base/allocator/partition_alloc_features.h +++ b/base/allocator/partition_alloc_features.h
@@ -71,6 +71,7 @@ extern const BASE_EXPORT Feature kPartitionAllocPCScanImmediateFreeing; extern const BASE_EXPORT Feature kPartitionAllocPCScanEagerClearing; extern const BASE_EXPORT Feature kPartitionAllocUseAlternateDistribution; +extern const BASE_EXPORT Feature kPartitionAllocSortActiveSlotSpans; } // namespace features } // namespace base
diff --git a/base/allocator/partition_allocator/partition_alloc_unittest.cc b/base/allocator/partition_allocator/partition_alloc_unittest.cc index 5d75f3af..49c031a 100644 --- a/base/allocator/partition_allocator/partition_alloc_unittest.cc +++ b/base/allocator/partition_allocator/partition_alloc_unittest.cc
@@ -13,6 +13,7 @@ #include <limits> #include <memory> #include <random> +#include <set> #include <tuple> #include <vector> @@ -29,6 +30,7 @@ #include "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_for_testing.h" #include "base/allocator/partition_allocator/partition_alloc_config.h" #include "base/allocator/partition_allocator/partition_alloc_constants.h" +#include "base/allocator/partition_allocator/partition_bucket.h" #include "base/allocator/partition_allocator/partition_cookie.h" #include "base/allocator/partition_allocator/partition_freelist_entry.h" #include "base/allocator/partition_allocator/partition_page.h" @@ -265,6 +267,7 @@ ~PartitionAllocTest() override = default; void SetUp() override { + PartitionRoot<ThreadSafe>::EnableSortActiveSlotSpans(); PartitionAllocGlobalInit(HandleOOM); allocator.init({ #if !BUILDFLAG(USE_BACKUP_REF_PTR) || BUILDFLAG(PUT_REF_COUNT_IN_PREVIOUS_SLOT) @@ -4709,6 +4712,74 @@ } } +TEST_P(PartitionAllocTest, SortActiveSlotSpans) { + auto run_test = [](size_t count) { + PartitionBucket<ThreadSafe> bucket; + bucket.Init(16); + bucket.active_slot_spans_head = nullptr; + + std::vector<SlotSpanMetadata<ThreadSafe>> slot_spans; + slot_spans.reserve(count); + + // Add slot spans with random freelist length. + for (size_t i = 0; i < count; i++) { + slot_spans.emplace_back(&bucket); + auto& slot_span = slot_spans.back(); + slot_span.num_unprovisioned_slots = + partition_alloc::internal::base::RandGenerator( + bucket.get_slots_per_span() / 2); + slot_span.num_allocated_slots = + partition_alloc::internal::base::RandGenerator( + bucket.get_slots_per_span() - slot_span.num_unprovisioned_slots); + slot_span.next_slot_span = bucket.active_slot_spans_head; + bucket.active_slot_spans_head = &slot_span; + } + + bucket.SortActiveSlotSpans(); + + std::set<SlotSpanMetadata<ThreadSafe>*> seen_slot_spans; + std::vector<SlotSpanMetadata<ThreadSafe>*> sorted_slot_spans; + for (auto* slot_span = bucket.active_slot_spans_head; slot_span; + slot_span = slot_span->next_slot_span) { + sorted_slot_spans.push_back(slot_span); + seen_slot_spans.insert(slot_span); + } + + // None repeated, none missing. + EXPECT_EQ(seen_slot_spans.size(), sorted_slot_spans.size()); + EXPECT_EQ(seen_slot_spans.size(), slot_spans.size()); + + // The first slot spans are sorted. + size_t sorted_spans_count = + std::min(PartitionBucket<ThreadSafe>::kMaxSlotSpansToSort, count); + EXPECT_TRUE(std::is_sorted(sorted_slot_spans.begin(), + sorted_slot_spans.begin() + sorted_spans_count, + partition_alloc::internal::CompareSlotSpans)); + + // Slot spans with no freelist entries are at the end of the sorted run. + auto has_empty_freelist = [](SlotSpanMetadata<ThreadSafe>* a) { + return a->GetFreelistLength() == 0; + }; + auto it = std::find_if(sorted_slot_spans.begin(), + sorted_slot_spans.begin() + sorted_spans_count, + has_empty_freelist); + if (it != sorted_slot_spans.end()) { + EXPECT_TRUE(std::all_of(it, + sorted_slot_spans.begin() + sorted_spans_count, + has_empty_freelist)); + } + }; + + // Everything is sorted. + run_test(PartitionBucket<ThreadSafe>::kMaxSlotSpansToSort / 2); + // Only the first slot spans are sorted. + run_test(PartitionBucket<ThreadSafe>::kMaxSlotSpansToSort * 2); + + // Corner cases. + run_test(0); + run_test(1); +} + } // namespace partition_alloc::internal #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
diff --git a/base/allocator/partition_allocator/partition_bucket.cc b/base/allocator/partition_allocator/partition_bucket.cc index 13c59f1..809771b 100644 --- a/base/allocator/partition_allocator/partition_bucket.cc +++ b/base/allocator/partition_allocator/partition_bucket.cc
@@ -4,7 +4,9 @@ #include "base/allocator/partition_allocator/partition_bucket.h" +#include <algorithm> #include <cstdint> +#include <tuple> #include "base/allocator/buildflags.h" #include "base/allocator/partition_allocator/address_pool_manager.h" @@ -18,6 +20,7 @@ #include "base/allocator/partition_allocator/partition_alloc_check.h" #include "base/allocator/partition_allocator/partition_alloc_config.h" #include "base/allocator/partition_allocator/partition_alloc_constants.h" +#include "base/allocator/partition_allocator/partition_alloc_forward.h" #include "base/allocator/partition_allocator/partition_direct_map_extent.h" #include "base/allocator/partition_allocator/partition_oom.h" #include "base/allocator/partition_allocator/partition_page.h" @@ -1103,6 +1106,88 @@ } } +BASE_EXPORT bool CompareSlotSpans(SlotSpanMetadata<ThreadSafe>* a, + SlotSpanMetadata<ThreadSafe>* b) { + auto criteria_tuple = [](SlotSpanMetadata<ThreadSafe> const* a) { + size_t freelist_length = a->GetFreelistLength(); + // The criteria are, in order (hence the lexicographic comparison below): + // 1. Prefer slot spans with freelist entries. The ones without freelist + // entries would be skipped in SetNewActiveSlotSpan() anyway. + // 2. Then the ones with the fewest freelist entries. They are either close + // to being full (for the provisioned memory), or close to being pushed + // at the end of the list (since they would not have freelist entries + // anymore, and would either fall into the first case, or be skipped by + // SetNewActiveSlotSpan()). + // 3. The ones with the fewer unprovisioned slots, meaning that they are + // close to being completely full. + // + // Note that this sorting order is not necessarily the best one when slot + // spans are partially provisioned. From local testing, in steady-state, + // most slot spans are entirely provisioned (or decommitted), which may be a + // consequence of the lack of partial slot span decommit, or of fairly + // effective fragmentation avoidance heuristics. Make sure to evaluate + // whether an alternative sorting order (sorting according to freelist size + // + unprovisioned slots) makes more sense. + return std::tuple<bool, size_t, size_t>{ + freelist_length == 0, freelist_length, a->num_unprovisioned_slots}; + }; + + return criteria_tuple(a) < criteria_tuple(b); +} + +template <bool thread_safe> +void PartitionBucket<thread_safe>::SortActiveSlotSpans() { + // Sorting up to |kMaxSlotSpansToSort| slot spans. This is capped for two + // reasons: + // - Limiting execution time + // - Current code cannot allocate. + // + // In practice though, it's rare to have that many active slot spans. + SlotSpanMetadata<thread_safe>* active_spans_array[kMaxSlotSpansToSort]; + size_t index = 0; + SlotSpanMetadata<thread_safe>* overflow_spans_start = nullptr; + + for (auto* slot_span = active_slot_spans_head; slot_span; + slot_span = slot_span->next_slot_span) { + if (index < kMaxSlotSpansToSort) { + active_spans_array[index++] = slot_span; + } else { + // Starting from this one, not sorting the slot spans. + overflow_spans_start = slot_span; + break; + } + } + + // We sort the active slot spans so that allocations are preferably serviced + // from the fullest ones. This way we hope to reduce fragmentation by keeping + // as few slot spans as full as possible. + // + // With perfect information on allocation lifespan, we would be able to pack + // allocations and get almost no fragmentation. This is obviously not the + // case, so we have partially full SlotSpans. Nevertheless, as a heuristic we + // want to: + // - Keep almost-empty slot spans as empty as possible + // - Keep mostly-full slot spans as full as possible + // + // The first part is done in the hope that future free()s will make these + // slot spans completely empty, allowing us to reclaim them. To that end, sort + // SlotSpans periodically so that the fullest ones are preferred. + // + // std::sort() is not completely guaranteed to never allocate memory. However, + // it may not throw std::bad_alloc, which constrains the implementation. In + // addition, this is protected by the reentrancy guard, so we would detect + // such an allocation. + std::sort(active_spans_array, active_spans_array + index, CompareSlotSpans); + + active_slot_spans_head = overflow_spans_start; + + // Reverse order, since we insert at the head of the list. + for (int i = index - 1; i >= 0; i--) { + active_spans_array[i]->next_slot_span = active_slot_spans_head; + active_slot_spans_head = active_spans_array[i]; + } +} + template <bool thread_safe> uintptr_t PartitionBucket<thread_safe>::SlowPathAlloc( PartitionRoot<thread_safe>* root,
diff --git a/base/allocator/partition_allocator/partition_bucket.h b/base/allocator/partition_allocator/partition_bucket.h index 6f07e928..b4037fb 100644 --- a/base/allocator/partition_allocator/partition_bucket.h +++ b/base/allocator/partition_allocator/partition_bucket.h
@@ -23,6 +23,10 @@ BASE_EXPORT uint8_t ComputeSystemPagesPerSlotSpan(size_t slot_size, bool prefer_smaller_slot_spans); +// Visible for testing. +BASE_EXPORT bool CompareSlotSpans(SlotSpanMetadata<ThreadSafe>* a, + SlotSpanMetadata<ThreadSafe>* b); + template <bool thread_safe> struct PartitionBucket { // Accessed most in hot path => goes first. Only nullptr for invalid buckets, @@ -54,8 +58,10 @@ "GetSlotOffset may produce an incorrect result when kMaxBucketed is too " "large."); + static constexpr size_t kMaxSlotSpansToSort = 200; + // Public API. - void Init(uint32_t new_slot_size); + BASE_EXPORT void Init(uint32_t new_slot_size); // Sets |is_already_zeroed| to true if the allocation was satisfied by // requesting (a) new page(s) from the operating system, or false otherwise. @@ -148,6 +154,8 @@ // Sort the freelists of all slot spans. void SortSlotSpanFreelists(); + // Sort the active slot span list in ascending freelist length. + BASE_EXPORT void SortActiveSlotSpans(); private: // Allocates a new slot span with size |num_partition_pages| from the
diff --git a/base/allocator/partition_allocator/partition_page.cc b/base/allocator/partition_allocator/partition_page.cc index e71c45e..7adb5ca 100644 --- a/base/allocator/partition_allocator/partition_page.cc +++ b/base/allocator/partition_allocator/partition_page.cc
@@ -138,11 +138,6 @@ // static template <bool thread_safe> -SlotSpanMetadata<thread_safe> - SlotSpanMetadata<thread_safe>::sentinel_slot_span_; - -// static -template <bool thread_safe> SlotSpanMetadata<thread_safe>* SlotSpanMetadata<thread_safe>::get_sentinel_slot_span() { return &sentinel_slot_span_; @@ -274,6 +269,7 @@ PA_DCHECK(slot_number < num_provisioned_slots); free_slots[slot_number] = true; } + PA_DCHECK(num_free_slots == GetFreelistLength()); // Empty or single-element list is always sorted. if (num_free_slots > 1) {
diff --git a/base/allocator/partition_allocator/partition_page.h b/base/allocator/partition_allocator/partition_page.h index 9a5c339..065be91 100644 --- a/base/allocator/partition_allocator/partition_page.h +++ b/base/allocator/partition_allocator/partition_page.h
@@ -173,7 +173,7 @@ // in PartitionPage which has 2B worth of fields and must fit in 32B. public: - explicit SlotSpanMetadata(PartitionBucket<thread_safe>* bucket); + BASE_EXPORT explicit SlotSpanMetadata(PartitionBucket<thread_safe>* bucket); // Public API // Note the matching Alloc() functions are in PartitionPage. @@ -269,6 +269,13 @@ return provisioned_size; } + // Return the number of entries in the freelist. + size_t GetFreelistLength() const { + size_t num_provisioned_slots = + bucket->get_slots_per_span() - num_unprovisioned_slots; + return num_provisioned_slots - num_allocated_slots; + } + ALWAYS_INLINE void Reset(); // TODO(ajwong): Can this be made private? https://crbug.com/787153 @@ -290,7 +297,7 @@ // // Note, this declaration is kept in the header as opposed to an anonymous // namespace so the getter can be fully inlined. - static SlotSpanMetadata sentinel_slot_span_; + static inline SlotSpanMetadata sentinel_slot_span_; // For the sentinel. constexpr SlotSpanMetadata() noexcept : marked_full(0),
diff --git a/base/allocator/partition_allocator/partition_root.cc b/base/allocator/partition_allocator/partition_root.cc index 5ba0cd7..c6b4727 100644 --- a/base/allocator/partition_allocator/partition_root.cc +++ b/base/allocator/partition_allocator/partition_root.cc
@@ -1091,6 +1091,9 @@ // Do it at the end, as the actions above change the status of slot // spans (e.g. empty -> decommitted). bucket.MaintainActiveList(); + + if (sort_active_slot_spans_) + bucket.SortActiveSlotSpans(); } } } @@ -1304,6 +1307,11 @@ return tcache->GetFromCache(bucket_index, slot_size); } +template <> +void PartitionRoot<internal::ThreadSafe>::EnableSortActiveSlotSpans() { + sort_active_slot_spans_ = true; +} + template struct BASE_EXPORT PartitionRoot<internal::ThreadSafe>; static_assert(offsetof(PartitionRoot<internal::ThreadSafe>, sentinel_bucket) ==
diff --git a/base/allocator/partition_allocator/partition_root.h b/base/allocator/partition_allocator/partition_root.h index 983d55af..051fa6f7 100644 --- a/base/allocator/partition_allocator/partition_root.h +++ b/base/allocator/partition_allocator/partition_root.h
@@ -744,7 +744,12 @@ } #endif // defined(PA_USE_MTE_CHECKED_PTR_WITH_64_BITS_POINTERS) + // Enables the sorting of active slot spans in PurgeMemory(). + static void EnableSortActiveSlotSpans(); + private: + static inline bool sort_active_slot_spans_ = false; + // |buckets| has `kNumBuckets` elements, but we sometimes access it at index // `kNumBuckets`, which is occupied by the sentinel bucket. The correct layout // is enforced by a static_assert() in partition_root.cc, so this is
diff --git a/base/debug/handle_hooks_win.cc b/base/debug/close_handle_hook_win.cc similarity index 61% rename from base/debug/handle_hooks_win.cc rename to base/debug/close_handle_hook_win.cc index bc3eed4b..68b0198 100644 --- a/base/debug/handle_hooks_win.cc +++ b/base/debug/close_handle_hook_win.cc
@@ -2,16 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/debug/handle_hooks_win.h" +#include "base/debug/close_handle_hook_win.h" -#include <windows.h> - +#include <Windows.h> #include <psapi.h> #include <stddef.h> -#include "base/logging.h" +#include <algorithm> +#include <memory> +#include <vector> + #include "base/memory/raw_ptr.h" -#include "base/numerics/safe_conversions.h" #include "base/win/iat_patch_function.h" #include "base/win/pe_image.h" #include "base/win/scoped_handle.h" @@ -19,18 +20,24 @@ namespace { -using CloseHandleType = decltype(&::CloseHandle); -using DuplicateHandleType = decltype(&::DuplicateHandle); +typedef BOOL (WINAPI* CloseHandleType) (HANDLE handle); -CloseHandleType g_close_function = nullptr; -DuplicateHandleType g_duplicate_function = nullptr; +typedef BOOL (WINAPI* DuplicateHandleType)(HANDLE source_process, + HANDLE source_handle, + HANDLE target_process, + HANDLE* target_handle, + DWORD desired_access, + BOOL inherit_handle, + DWORD options); + +CloseHandleType g_close_function = NULL; +DuplicateHandleType g_duplicate_function = NULL; // The entry point for CloseHandle interception. This function notifies the // verifier about the handle that is being closed, and calls the original // function. BOOL WINAPI CloseHandleHook(HANDLE handle) { - base::win::OnHandleBeingClosed(handle, - base::win::HandleOperation::kCloseHandleHook); + base::win::OnHandleBeingClosed(handle); return g_close_function(handle); } @@ -43,8 +50,7 @@ DWORD options) { if ((options & DUPLICATE_CLOSE_SOURCE) && (GetProcessId(source_process) == ::GetCurrentProcessId())) { - base::win::OnHandleBeingClosed( - source_handle, base::win::HandleOperation::kDuplicateHandleHook); + base::win::OnHandleBeingClosed(source_handle); } return g_duplicate_function(source_process, source_handle, target_process, @@ -68,7 +74,9 @@ AutoProtectMemory(const AutoProtectMemory&) = delete; AutoProtectMemory& operator=(const AutoProtectMemory&) = delete; - ~AutoProtectMemory() { RevertProtection(); } + ~AutoProtectMemory() { + RevertProtection(); + } // Grants write access to a given memory range. bool ChangeProtection(void* address, size_t bytes); @@ -93,7 +101,7 @@ return false; DWORD is_executable = (PAGE_EXECUTE | PAGE_EXECUTE_READ | - PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY) & + PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY) & memory_info.Protect; DWORD protect = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; @@ -120,12 +128,9 @@ old_protect_ = 0; } -#if defined(ARCH_CPU_32_BITS) -// Performs an EAT interception. Only supported on 32-bit. -void EATPatch(HMODULE module, - const char* function_name, - void* new_function, - void** old_function) { +// Performs an EAT interception. +void EATPatch(HMODULE module, const char* function_name, + void* new_function, void** old_function) { if (!module) return; @@ -145,35 +150,30 @@ return; // Perform the patch. - *eat_entry = - base::checked_cast<DWORD>(reinterpret_cast<uintptr_t>(new_function) - - reinterpret_cast<uintptr_t>(module)); + *eat_entry = static_cast<DWORD>(reinterpret_cast<uintptr_t>(new_function) - + reinterpret_cast<uintptr_t>(module)); } -#endif // defined(ARCH_CPU_32_BITS) // Performs an IAT interception. -std::unique_ptr<base::win::IATPatchFunction> IATPatch(HMODULE module, - const char* function_name, - void* new_function, - void** old_function) { +base::win::IATPatchFunction* IATPatch(HMODULE module, const char* function_name, + void* new_function, void** old_function) { if (!module) - return nullptr; + return NULL; - auto patch = std::make_unique<base::win::IATPatchFunction>(); + base::win::IATPatchFunction* patch = new base::win::IATPatchFunction; __try { // There is no guarantee that |module| is still loaded at this point. if (patch->PatchFromModule(module, "kernel32.dll", function_name, new_function)) { - return nullptr; + delete patch; + return NULL; } - } __except ((GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION || - GetExceptionCode() == EXCEPTION_GUARD_PAGE || - GetExceptionCode() == EXCEPTION_IN_PAGE_ERROR) - ? EXCEPTION_EXECUTE_HANDLER - : EXCEPTION_CONTINUE_SEARCH) { + } __except((GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION || + GetExceptionCode() == EXCEPTION_GUARD_PAGE || + GetExceptionCode() == EXCEPTION_IN_PAGE_ERROR) ? + EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { // Leak the patch. - std::ignore = patch.release(); - return nullptr; + return NULL; } if (!(*old_function)) { @@ -184,32 +184,44 @@ return patch; } -} // namespace +// Keeps track of all the hooks needed to intercept functions which could +// possibly close handles. +class HandleHooks { + public: + HandleHooks() {} -// static + HandleHooks(const HandleHooks&) = delete; + HandleHooks& operator=(const HandleHooks&) = delete; + + ~HandleHooks() {} + + void AddIATPatch(HMODULE module); + void AddEATPatch(); + + private: + std::vector<base::win::IATPatchFunction*> hooks_; +}; + void HandleHooks::AddIATPatch(HMODULE module) { if (!module) return; - auto close_handle_patch = + base::win::IATPatchFunction* patch = NULL; + patch = IATPatch(module, "CloseHandle", reinterpret_cast<void*>(&CloseHandleHook), reinterpret_cast<void**>(&g_close_function)); - if (!close_handle_patch) + if (!patch) return; - // This is intentionally leaked. - std::ignore = close_handle_patch.release(); + hooks_.push_back(patch); - auto duplicate_handle_patch = IATPatch( - module, "DuplicateHandle", reinterpret_cast<void*>(&DuplicateHandleHook), - reinterpret_cast<void**>(&g_duplicate_function)); - if (!duplicate_handle_patch) + patch = IATPatch(module, "DuplicateHandle", + reinterpret_cast<void*>(&DuplicateHandleHook), + reinterpret_cast<void**>(&g_duplicate_function)); + if (!patch) return; - // This is intentionally leaked. - std::ignore = duplicate_handle_patch.release(); + hooks_.push_back(patch); } -#if defined(ARCH_CPU_32_BITS) -// static void HandleHooks::AddEATPatch() { // An attempt to restore the entry on the table at destruction is not safe. EATPatch(GetModuleHandleA("kernel32.dll"), "CloseHandle", @@ -219,24 +231,33 @@ reinterpret_cast<void*>(&DuplicateHandleHook), reinterpret_cast<void**>(&g_duplicate_function)); } -#endif // defined(ARCH_CPU_32_BITS) -// static -void HandleHooks::PatchLoadedModules() { +void PatchLoadedModules(HandleHooks* hooks) { const DWORD kSize = 256; DWORD returned; - auto modules = std::make_unique<HMODULE[]>(kSize); - if (!::EnumProcessModules(GetCurrentProcess(), modules.get(), - kSize * sizeof(HMODULE), &returned)) { + std::unique_ptr<HMODULE[]> modules(new HMODULE[kSize]); + if (!EnumProcessModules(GetCurrentProcess(), modules.get(), + kSize * sizeof(HMODULE), &returned)) { return; } returned /= sizeof(HMODULE); returned = std::min(kSize, returned); for (DWORD current = 0; current < returned; current++) { - AddIATPatch(modules[current]); + hooks->AddIATPatch(modules[current]); } } +} // namespace + +void InstallHandleHooks() { + static HandleHooks* hooks = new HandleHooks(); + + // Performing EAT interception first is safer in the presence of other + // threads attempting to call CloseHandle. + hooks->AddEATPatch(); + PatchLoadedModules(hooks); +} + } // namespace debug } // namespace base
diff --git a/base/debug/close_handle_hook_win.h b/base/debug/close_handle_hook_win.h new file mode 100644 index 0000000..c775d75 --- /dev/null +++ b/base/debug/close_handle_hook_win.h
@@ -0,0 +1,19 @@ +// Copyright 2015 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 BASE_DEBUG_CLOSE_HANDLE_HOOK_WIN_H_ +#define BASE_DEBUG_CLOSE_HANDLE_HOOK_WIN_H_ + +#include "base/base_export.h" + +namespace base { +namespace debug { + +// Installs the hooks required to debug use of improper handles. +BASE_EXPORT void InstallHandleHooks(); + +} // namespace debug +} // namespace base + +#endif // BASE_DEBUG_CLOSE_HANDLE_HOOK_WIN_H_
diff --git a/base/debug/handle_hooks_win.h b/base/debug/handle_hooks_win.h deleted file mode 100644 index 5459393..0000000 --- a/base/debug/handle_hooks_win.h +++ /dev/null
@@ -1,41 +0,0 @@ -// Copyright 2015 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 BASE_DEBUG_HANDLE_HOOKS_WIN_H_ -#define BASE_DEBUG_HANDLE_HOOKS_WIN_H_ - -#include "base/base_export.h" -#include "base/win/windows_types.h" -#include "build/build_config.h" - -namespace base { -namespace debug { - -// Provides the ability to intercept functions which could possibly close -// handles in support of the handle tracker. -// This is a currently a container class for static functions because there is -// ongoing work to make the patches unhook, currently blocked by test failures. -// See https://crbug.com/1327397. -class BASE_EXPORT HandleHooks { - public: - HandleHooks() = delete; - - HandleHooks(const HandleHooks&) = delete; - HandleHooks& operator=(const HandleHooks&) = delete; - - // Patch IAT for a specified module. - static void AddIATPatch(HMODULE module); - // Add an EAT patch on kernel32.dll. This patch does not get removed. This is - // only supported on 32-bit because the EAT only supports 32-bit RVAs. -#if defined(ARCH_CPU_32_BITS) - static void AddEATPatch(); -#endif - // Patch IAT for all currently loaded modules. - static void PatchLoadedModules(); -}; - -} // namespace debug -} // namespace base - -#endif // BASE_DEBUG_HANDLE_HOOKS_WIN_H_
diff --git a/base/win/scoped_handle.cc b/base/win/scoped_handle.cc index 1c1cdce..de68545 100644 --- a/base/win/scoped_handle.cc +++ b/base/win/scoped_handle.cc
@@ -11,21 +11,6 @@ using base::win::internal::ScopedHandleVerifier; -std::ostream& operator<<(std::ostream& os, HandleOperation operation) { - switch (operation) { - case HandleOperation::kHandleAlreadyTracked: - return os << "Handle Already Tracked"; - case HandleOperation::kCloseHandleNotTracked: - return os << "Closing an untracked handle"; - case HandleOperation::kCloseHandleNotOwner: - return os << "Closing a handle owned by something else"; - case HandleOperation::kCloseHandleHook: - return os << "CloseHandleHook validation failure"; - case HandleOperation::kDuplicateHandleHook: - return os << "DuplicateHandleHook validation failure"; - } -} - // Static. bool HandleTraits::CloseHandle(HANDLE handle) { return ScopedHandleVerifier::Get()->CloseHandle(handle); @@ -51,8 +36,8 @@ return ScopedHandleVerifier::Get()->Disable(); } -void OnHandleBeingClosed(HANDLE handle, HandleOperation operation) { - return ScopedHandleVerifier::Get()->OnHandleBeingClosed(handle, operation); +void OnHandleBeingClosed(HANDLE handle) { + return ScopedHandleVerifier::Get()->OnHandleBeingClosed(handle); } } // namespace win
diff --git a/base/win/scoped_handle.h b/base/win/scoped_handle.h index 3a7d47e..bfa8188 100644 --- a/base/win/scoped_handle.h +++ b/base/win/scoped_handle.h
@@ -7,8 +7,6 @@ #include "base/win/windows_types.h" -#include <ostream> - #include "base/base_export.h" #include "base/check_op.h" #include "base/dcheck_is_on.h" @@ -28,16 +26,6 @@ namespace base { namespace win { -enum class HandleOperation { - kHandleAlreadyTracked, - kCloseHandleNotTracked, - kCloseHandleNotOwner, - kCloseHandleHook, - kDuplicateHandleHook -}; - -std::ostream& operator<<(std::ostream& os, HandleOperation operation); - // Generic wrapper for raw handles that takes care of closing handles // automatically. The class interface follows the style of // the ScopedFILE class with two additions: @@ -125,9 +113,8 @@ } private: - FRIEND_TEST_ALL_PREFIXES(ScopedHandleDeathTest, HandleVerifierWrongOwner); - FRIEND_TEST_ALL_PREFIXES(ScopedHandleDeathTest, - HandleVerifierUntrackedHandle); + FRIEND_TEST_ALL_PREFIXES(ScopedHandleTest, HandleVerifierWrongOwner); + FRIEND_TEST_ALL_PREFIXES(ScopedHandleTest, HandleVerifierUntrackedHandle); Handle handle_; }; @@ -196,7 +183,7 @@ GenericScopedHandle<HandleTraits, DummyVerifierTraits>; using CheckedScopedHandle = GenericScopedHandle<HandleTraits, VerifierTraits>; -#if DCHECK_IS_ON() +#if DCHECK_IS_ON() && !defined(ARCH_CPU_64_BITS) using ScopedHandle = CheckedScopedHandle; #else using ScopedHandle = UncheckedScopedHandle; @@ -211,8 +198,7 @@ // verification of improper handle closing is desired. If |handle| is being // tracked by the handle verifier and ScopedHandle is not the one closing it, // a CHECK is generated. -BASE_EXPORT void OnHandleBeingClosed(HANDLE handle, HandleOperation operation); - +BASE_EXPORT void OnHandleBeingClosed(HANDLE handle); } // namespace win } // namespace base
diff --git a/base/win/scoped_handle_unittest.cc b/base/win/scoped_handle_unittest.cc index 228f2eb6..0df21ce 100644 --- a/base/win/scoped_handle_unittest.cc +++ b/base/win/scoped_handle_unittest.cc
@@ -8,13 +8,11 @@ #include "base/base_switches.h" #include "base/command_line.h" -#include "base/debug/handle_hooks_win.h" #include "base/files/file_path.h" #include "base/scoped_native_library.h" #include "base/test/multiprocess_test.h" #include "base/test/test_timeouts.h" #include "base/win/scoped_handle.h" -#include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/multiprocess_func_list.h" @@ -26,31 +24,9 @@ extern "C" bool __declspec(dllexport) RunTest(); } // namespace testing -class ScopedHandleTest : public ::testing::Test, - public ::testing::WithParamInterface<bool> { - public: - ScopedHandleTest(const ScopedHandleTest&) = delete; - ScopedHandleTest& operator=(const ScopedHandleTest&) = delete; - - protected: - ScopedHandleTest() { - if (HooksEnabled()) { -#if defined(ARCH_CPU_32_BITS) - // EAT patch is only supported on 32-bit. - base::debug::HandleHooks::AddEATPatch(); -#endif - base::debug::HandleHooks::PatchLoadedModules(); - } - } - - static bool HooksEnabled() { return GetParam(); } -}; - -using ScopedHandleDeathTest = ScopedHandleTest; - -TEST_P(ScopedHandleTest, ScopedHandle) { +TEST(ScopedHandleTest, ScopedHandle) { // Any illegal error code will do. We just need to test that it is preserved - // by ScopedHandle to avoid https://crbug.com/528394. + // by ScopedHandle to avoid bug 528394. const DWORD magic_error = 0x12345678; HANDLE handle = ::CreateMutex(nullptr, false, nullptr); @@ -73,7 +49,7 @@ EXPECT_EQ(magic_error, ::GetLastError()); } -TEST_P(ScopedHandleDeathTest, HandleVerifierTrackedHasBeenClosed) { +TEST(ScopedHandleTest, HandleVerifierTrackedHasBeenClosed) { HANDLE handle = ::CreateMutex(nullptr, false, nullptr); ASSERT_NE(HANDLE(nullptr), handle); using NtCloseFunc = decltype(&::NtClose); @@ -88,35 +64,10 @@ // Destructing a ScopedHandle with an illegally closed handle should // fail. }, - "CloseHandle failed"); + ""); } -TEST_P(ScopedHandleDeathTest, HandleVerifierCloseTrackedHandle) { - // This test is only valid if hooks are enabled. - if (!HooksEnabled()) - return; - ASSERT_DEATH( - { - HANDLE handle = ::CreateMutex(nullptr, false, nullptr); - ASSERT_NE(HANDLE(nullptr), handle); - - // Start tracking the handle so that closes outside of the checker are - // caught. - base::win::CheckedScopedHandle handle_holder(handle); - - // Closing a tracked handle using ::CloseHandle should crash due to hook - // noticing the illegal close. - ::CloseHandle(handle); - }, - // This test must match the CloseHandleHook causing this failure, because - // if the hook doesn't crash and instead the handle is double closed by - // the `handle_holder` going out of scope, then there is still a crash, - // but a different crash and one we are not explicitly testing here. This - // other crash is tested in HandleVerifierTrackedHasBeenClosed above. - "CloseHandleHook validation failure"); -} - -TEST_P(ScopedHandleDeathTest, HandleVerifierDoubleTracking) { +TEST(ScopedHandleTest, HandleVerifierDoubleTracking) { HANDLE handle = ::CreateMutex(nullptr, false, nullptr); ASSERT_NE(HANDLE(nullptr), handle); @@ -125,7 +76,7 @@ ASSERT_DEATH({ base::win::CheckedScopedHandle handle_holder2(handle); }, ""); } -TEST_P(ScopedHandleDeathTest, HandleVerifierWrongOwner) { +TEST(ScopedHandleTest, HandleVerifierWrongOwner) { HANDLE handle = ::CreateMutex(nullptr, false, nullptr); ASSERT_NE(HANDLE(nullptr), handle); @@ -135,12 +86,12 @@ base::win::CheckedScopedHandle handle_holder2; handle_holder2.handle_ = handle; }, - "Closing a handle owned by something else"); + ""); ASSERT_TRUE(handle_holder.is_valid()); handle_holder.Close(); } -TEST_P(ScopedHandleDeathTest, HandleVerifierUntrackedHandle) { +TEST(ScopedHandleTest, HandleVerifierUntrackedHandle) { HANDLE handle = ::CreateMutex(nullptr, false, nullptr); ASSERT_NE(HANDLE(nullptr), handle); @@ -149,7 +100,7 @@ base::win::CheckedScopedHandle handle_holder; handle_holder.handle_ = handle; }, - "Closing an untracked handle"); + ""); ASSERT_TRUE(::CloseHandle(handle)); } @@ -162,7 +113,7 @@ #define MAYBE_MultiProcess MultiProcess #endif -TEST_P(ScopedHandleTest, MAYBE_MultiProcess) { +TEST(ScopedHandleTest, MAYBE_MultiProcess) { // Initializing ICU in the child process causes a scoped handle to be created // before the test gets a chance to test the race condition, so disable ICU // for the child process here. @@ -194,18 +145,5 @@ return 0; } -INSTANTIATE_TEST_SUITE_P(HooksEnabled, - ScopedHandleTest, - ::testing::Values(true)); -INSTANTIATE_TEST_SUITE_P(HooksDisabled, - ScopedHandleTest, - ::testing::Values(false)); -INSTANTIATE_TEST_SUITE_P(HooksEnabled, - ScopedHandleDeathTest, - ::testing::Values(true)); -INSTANTIATE_TEST_SUITE_P(HooksDisabled, - ScopedHandleDeathTest, - ::testing::Values(false)); - } // namespace win } // namespace base
diff --git a/base/win/scoped_handle_verifier.cc b/base/win/scoped_handle_verifier.cc index e7ab4b9..e64bd2c 100644 --- a/base/win/scoped_handle_verifier.cc +++ b/base/win/scoped_handle_verifier.cc
@@ -18,7 +18,6 @@ #include "base/trace_event/base_tracing.h" #include "base/win/base_win_buildflags.h" #include "base/win/current_module.h" -#include "base/win/scoped_handle.h" extern "C" { __declspec(dllexport) void* GetHandleVerifier(); @@ -41,25 +40,21 @@ using NativeLock = base::internal::LockImpl; NOINLINE void ReportErrorOnScopedHandleOperation( - const base::debug::StackTrace& creation_stack, - HandleOperation operation) { + const base::debug::StackTrace& creation_stack) { auto creation_stack_copy = creation_stack; base::debug::Alias(&creation_stack_copy); - base::debug::Alias(&operation); - CHECK(false) << operation; + CHECK(false); __builtin_unreachable(); } NOINLINE void ReportErrorOnScopedHandleOperation( const base::debug::StackTrace& creation_stack, - const ScopedHandleVerifierInfo& other, - HandleOperation operation) { + const ScopedHandleVerifierInfo& other) { auto other_stack_copy = *other.stack; base::debug::Alias(&other_stack_copy); auto creation_stack_copy = creation_stack; base::debug::Alias(&creation_stack_copy); - base::debug::Alias(&operation); - CHECK(false) << operation; + CHECK(false); __builtin_unreachable(); } @@ -112,7 +107,7 @@ bool CloseHandleWrapper(HANDLE handle) { if (!::CloseHandle(handle)) - CHECK(false) << "CloseHandle failed"; + CHECK(false); // CloseHandle failed. return true; } @@ -207,10 +202,9 @@ enabled_ = false; } -void ScopedHandleVerifier::OnHandleBeingClosed(HANDLE handle, - HandleOperation operation) { +void ScopedHandleVerifier::OnHandleBeingClosed(HANDLE handle) { if (enabled_) - OnHandleBeingClosedImpl(handle, operation); + OnHandleBeingClosedImpl(handle); } HMODULE ScopedHandleVerifier::GetModule() const { @@ -233,8 +227,7 @@ thread_id}); if (!result.second) { // Attempt to start tracking already tracked handle. - ReportErrorOnScopedHandleOperation(creation_stack_, result.first->second, - HandleOperation::kHandleAlreadyTracked); + ReportErrorOnScopedHandleOperation(creation_stack_, result.first->second); } } @@ -246,22 +239,18 @@ HandleMap::iterator i = map_.find(handle); if (i == map_.end()) { // Attempting to close an untracked handle. - ReportErrorOnScopedHandleOperation(creation_stack_, - HandleOperation::kCloseHandleNotTracked); + ReportErrorOnScopedHandleOperation(creation_stack_); } if (i->second.owner != owner) { // Attempting to close a handle not owned by opener. - ReportErrorOnScopedHandleOperation(creation_stack_, i->second, - HandleOperation::kCloseHandleNotOwner); + ReportErrorOnScopedHandleOperation(creation_stack_, i->second); } map_.erase(i); } -NOINLINE void ScopedHandleVerifier::OnHandleBeingClosedImpl( - HANDLE handle, - HandleOperation operation) { +NOINLINE void ScopedHandleVerifier::OnHandleBeingClosedImpl(HANDLE handle) { if (closing_.Get()) return; @@ -269,7 +258,7 @@ HandleMap::iterator i = map_.find(handle); if (i != map_.end()) { // CloseHandle called on tracked handle. - ReportErrorOnScopedHandleOperation(creation_stack_, i->second, operation); + ReportErrorOnScopedHandleOperation(creation_stack_, i->second); } }
diff --git a/base/win/scoped_handle_verifier.h b/base/win/scoped_handle_verifier.h index 7085e99..84bb547d 100644 --- a/base/win/scoped_handle_verifier.h +++ b/base/win/scoped_handle_verifier.h
@@ -18,7 +18,6 @@ namespace base { namespace win { -enum class HandleOperation; namespace internal { struct HandleHash { @@ -77,7 +76,7 @@ virtual void StopTracking(HANDLE handle, const void* owner, const void* pc1, const void* pc2); virtual void Disable(); - virtual void OnHandleBeingClosed(HANDLE handle, HandleOperation operation); + virtual void OnHandleBeingClosed(HANDLE handle); virtual HMODULE GetModule() const; private: @@ -87,7 +86,7 @@ const void* pc2); void StopTrackingImpl(HANDLE handle, const void* owner, const void* pc1, const void* pc2); - void OnHandleBeingClosedImpl(HANDLE handle, HandleOperation operation); + void OnHandleBeingClosedImpl(HANDLE handle); static base::internal::LockImpl* GetLock(); static void InstallVerifier();
diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index 9916bf6..09710040f 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1
@@ -1 +1 @@ -8.20220519.3.1 +8.20220520.0.1
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index fa26347..1bce84ed3 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -342,6 +342,7 @@ "//chrome/android/features/keyboard_accessory:public_java", "//chrome/android/features/start_surface:java_resources", "//chrome/android/features/start_surface:public_java", + "//chrome/android/features/tab_ui/public:java", "//chrome/android/modules/cablev2_authenticator/public:java", "//chrome/android/modules/image_editor/provider:java", "//chrome/android/modules/stack_unwinder/provider:java", @@ -963,6 +964,7 @@ "//chrome/android/features/keyboard_accessory:internal_java", "//chrome/android/features/start_surface:public_java", "//chrome/android/features/tab_ui:java", + "//chrome/android/features/tab_ui/public:java", "//chrome/android/modules/image_editor/provider:java", "//chrome/android/webapk/libs/client:client_java", "//chrome/android/webapk/libs/common:common_java",
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java index 935ad1d..5eacefb 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.autofill_assistant; import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.clearText; import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.action.ViewActions.pressImeActionButton; import static androidx.test.espresso.action.ViewActions.replaceText; @@ -48,6 +49,7 @@ import android.os.Build; import android.widget.RadioButton; +import androidx.test.espresso.Espresso; import androidx.test.espresso.matcher.ViewMatchers; import androidx.test.filters.MediumTest; @@ -1007,6 +1009,129 @@ } /** + * Create a transient contact and use it. + */ + @Test + @MediumTest + public void testCreateAndEnterTransientContact() throws Exception { + GetUserDataResponseProto userData = + GetUserDataResponseProto.newBuilder() + .setLocale("en-US") + .addAvailableContacts(ProfileProto.newBuilder().putValues( + 7, AutofillEntryProto.newBuilder().setValue("John Doe").build())) + .build(); + + ArrayList<ActionProto> list = new ArrayList<>(); + list.add(ActionProto.newBuilder() + .setCollectUserData( + CollectUserDataProto.newBuilder() + .setDataSource(DataSource.newBuilder()) + .setContactDetails( + ContactDetailsProto.newBuilder() + .setContactDetailsName("contact") + .setRequestPayerName(true) + .setRequestPayerPhone(false) + .addRequiredDataPiece( + buildRequiredDataPiece( + "Requires first name", 3)) + .addRequiredDataPiece( + buildRequiredDataPiece( + "Requires last name", 5))) + .setRequestTermsAndConditions(false)) + .build()); + list.add( + ActionProto.newBuilder() + .setUseAddress( + UseAddressProto.newBuilder() + .setName("contact") + .setFormFieldElement(toCssSelector("#profile_name")) + .addRequiredFields( + RequiredFieldProto.newBuilder() + .setValueExpression(buildValueExpression(7)) + .setElement(toCssSelector("#profile_name")) + .setForced(true))) + .build()); + list.add(ActionProto.newBuilder() + .setPrompt(PromptProto.newBuilder().setMessage("Prompt").addChoices( + PromptProto.Choice.newBuilder())) + .build()); + AutofillAssistantTestScript script = new AutofillAssistantTestScript( + SupportedScriptProto.newBuilder() + .setPath("form_target_website.html") + .setPresentation(PresentationProto.newBuilder().setAutostart(true)) + .build(), + list); + + AutofillAssistantTestService testService = + new AutofillAssistantTestService(Collections.singletonList(script)); + testService.setUserData(userData); + startAutofillAssistant(mTestRule.getActivity(), testService); + + // Check initial state by opening the expander: + // - There is a contact with "John Doe". + // - It does not have an edit icon. + // - The "add" button is shown. + waitUntilViewMatchesCondition( + withContentDescription("Continue"), allOf(isEnabled(), isCompletelyDisplayed())); + onView(withText("Contact info")).perform(click()); + waitUntilViewMatchesCondition( + allOf(withId(R.id.contact_full), withText(containsString("John Doe"))), + isDisplayed()); + onView(withTagValue(is(AssistantTagsForTesting.CHOICE_LIST_EDIT_ICON))) + .check(doesNotExist()); + onView(allOf(withText(R.string.payments_add_contact), + not(withParent(withId(R.id.section_title_add_button))))) + .check(matches(isDisplayed())); + // Create new contact with the editor and check the state after submitting: + // - The "John Doe" contact still exists. + // - There is a single "Jane Doe" contact that was added. + // - The newly added contact does have an edit icon. + onView(allOf(withText(R.string.payments_add_contact), + not(withParent(withId(R.id.section_title_add_button))))) + .perform(click()); + waitUntilViewMatchesCondition( + withContentDescription("Name*"), allOf(isDisplayed(), isEnabled())); + onView(withContentDescription("Name*")).perform(typeText("Jane Doe")); + Espresso.closeSoftKeyboard(); + onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button)) + .perform(scrollTo(), click()); + waitUntilViewMatchesCondition( + withContentDescription("Continue"), allOf(isDisplayed(), isEnabled())); + onView(allOf(withId(R.id.contact_full), withText(containsString("John Doe")))) + .check(matches(isDisplayed())); // Must still exist. + onView(allOf(withId(R.id.contact_full), withText(containsString("Jane Doe")))) + .check(matches(isDisplayed())); // Must be unique. + onView(withTagValue(is(AssistantTagsForTesting.CHOICE_LIST_EDIT_ICON))) + .check(matches(isDisplayed())); + // Edit existing contact with the editor and check the state after submitting: + // - The "John Doe" contact still exists. + // - The "Jane Doe" contact is gone. + // - There is a single "Jeremy Doe" contact instead. + // - The "Jeremy Doe" contact still has an edit icon. + onView(withTagValue(is(AssistantTagsForTesting.CHOICE_LIST_EDIT_ICON))).perform(click()); + waitUntilViewMatchesCondition( + withContentDescription("Name*"), allOf(isDisplayed(), isEnabled())); + onView(withContentDescription("Name*")).perform(clearText(), typeText("Jeremy Doe")); + Espresso.closeSoftKeyboard(); + onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button)) + .perform(scrollTo(), click()); + waitUntilViewMatchesCondition( + withContentDescription("Continue"), allOf(isDisplayed(), isEnabled())); + onView(allOf(withId(R.id.contact_full), withText(containsString("John Doe")))) + .check(matches(isDisplayed())); // Must still exist. + onView(allOf(withId(R.id.contact_full), withText(containsString("Jane Doe")))) + .check(doesNotExist()); // Must be Gone. + onView(allOf(withId(R.id.contact_full), withText(containsString("Jeremy Doe")))) + .check(matches(isDisplayed())); // Must be unique. + onView(withTagValue(is(AssistantTagsForTesting.CHOICE_LIST_EDIT_ICON))) + .check(matches(isDisplayed())); + // Submit and check that the correct value was filled into the website. + onView(withText("Continue")).perform(click()); + waitUntilViewMatchesCondition(withText("Prompt"), isCompletelyDisplayed()); + assertThat(getElementValue(getWebContents(), "profile_name"), is("Jeremy Doe")); + } + + /** * When using backend data privacy notice should have no background. */ @Test
diff --git a/chrome/android/features/tab_ui/BUILD.gn b/chrome/android/features/tab_ui/BUILD.gn index 95a2f27..50b3d8c4 100644 --- a/chrome/android/features/tab_ui/BUILD.gn +++ b/chrome/android/features/tab_ui/BUILD.gn
@@ -175,6 +175,7 @@ "//chrome/android:chrome_java", "//chrome/android:ui_locale_string_resources", "//chrome/android/features/start_surface:public_java", + "//chrome/android/features/tab_ui/public:java", "//chrome/app:java_strings_grd", "//chrome/browser/android/lifecycle:java", "//chrome/browser/back_press/android:java",
diff --git a/chrome/android/features/tab_ui/public/BUILD.gn b/chrome/android/features/tab_ui/public/BUILD.gn new file mode 100644 index 0000000..1f34c92 --- /dev/null +++ b/chrome/android/features/tab_ui/public/BUILD.gn
@@ -0,0 +1,12 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +# This should ideally hold all the files in public_tab_management_java_sources, which is defined in the tab_management_java_sources.gni module. +android_library("java") { + sources = [ "android/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCustomViewManager.java" ] + + deps = [ "//third_party/androidx:androidx_annotation_annotation_java" ] +}
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCustomViewManager.java b/chrome/android/features/tab_ui/public/android/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCustomViewManager.java similarity index 100% rename from chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCustomViewManager.java rename to chrome/android/features/tab_ui/public/android/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCustomViewManager.java
diff --git a/chrome/android/features/tab_ui/tab_management_java_sources.gni b/chrome/android/features/tab_ui/tab_management_java_sources.gni index ba32f79..79393bd 100644 --- a/chrome/android/features/tab_ui/tab_management_java_sources.gni +++ b/chrome/android/features/tab_ui/tab_management_java_sources.gni
@@ -13,7 +13,6 @@ "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabManagementDelegate.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabManagementModuleProvider.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcher.java", - "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCustomViewManager.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabUiFeatureUtilities.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabUiThemeProvider.java", "//chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/UndoGroupSnackbarController.java",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/PictureInPictureActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/media/PictureInPictureActivity.java index 28fdd0a..81b09d2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/PictureInPictureActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/PictureInPictureActivity.java
@@ -17,11 +17,13 @@ import android.graphics.drawable.Icon; import android.os.Build; import android.util.Rational; +import android.util.Size; import android.view.View; import android.view.View.OnLayoutChangeListener; import android.view.ViewGroup; import androidx.annotation.RequiresApi; +import androidx.annotation.VisibleForTesting; import org.chromium.base.ContextUtils; import org.chromium.base.IntentUtils; @@ -52,6 +54,16 @@ private static final String ACTION_PLAY = "org.chromium.chrome.browser.media.PictureInPictureActivity.Play"; + // If present, these provide our source rect hint. + private static final String SOURCE_X_KEY = + "org.chromium.chrome.browser.media.PictureInPictureActivity.source.x"; + private static final String SOURCE_Y_KEY = + "org.chromium.chrome.browser.media.PictureInPictureActivity.source.y"; + private static final String SOURCE_WIDTH_KEY = + "org.chromium.chrome.browser.media.PictureInPictureActivity.source.width"; + private static final String SOURCE_HEIGHT_KEY = + "org.chromium.chrome.browser.media.PictureInPictureActivity.source.height"; + private static final float MAX_ASPECT_RATIO = 2.39f; private static final float MIN_ASPECT_RATIO = 1 / 2.39f; @@ -68,6 +80,9 @@ private MediaSessionObserver mMediaSessionObserver; private boolean mIsPlayPauseVisible; + // If present, this is the video's aspect ratio. + private Rational mAspectRatio; + private BroadcastReceiver mMediaSessionReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -177,10 +192,18 @@ mMediaSessionObserver = new MediaSessionObserver(mediaSession) { @Override public void mediaSessionStateChanged(boolean isControllable, boolean isSuspended) { - setPictureInPictureParams(getPictureInPictureParams()); + updatePictureInPictureParams(); } }; + // See if there are PiP hints in the extras. + final Intent intent = getIntent(); + Size size = new Size( + intent.getIntExtra(SOURCE_WIDTH_KEY, 0), intent.getIntExtra(SOURCE_HEIGHT_KEY, 0)); + if (size.getWidth() > 0 && size.getHeight() > 0) { + clampAndStoreAspectRatio(size.getWidth(), size.getHeight()); + } + enterPictureInPictureMode(getPictureInPictureParams()); } @@ -258,31 +281,47 @@ pendingIntent)); } - return new PictureInPictureParams.Builder().setActions(actions).build(); + PictureInPictureParams.Builder builder = new PictureInPictureParams.Builder(); + builder.setActions(actions); + builder.setAspectRatio(mAspectRatio); + + return builder.build(); + } + + @SuppressLint("NewApi") + private void updatePictureInPictureParams() { + setPictureInPictureParams(getPictureInPictureParams()); } @CalledByNative @SuppressLint("NewApi") private void updateVideoSize(int width, int height) { - PictureInPictureParams.Builder builder = new PictureInPictureParams.Builder(); + clampAndStoreAspectRatio(width, height); + updatePictureInPictureParams(); + } + private void clampAndStoreAspectRatio(int width, int height) { float aspectRatio = MathUtils.clamp(width / (float) height, MIN_ASPECT_RATIO, MAX_ASPECT_RATIO); width = (int) (height * aspectRatio); - - builder.setAspectRatio(new Rational(width, height)); - setPictureInPictureParams(builder.build()); + mAspectRatio = new Rational(width, height); } @CalledByNative @SuppressLint("NewAPI") private void setPlayPauseButtonVisibility(boolean isVisible) { mIsPlayPauseVisible = isVisible; - setPictureInPictureParams(getPictureInPictureParams()); + updatePictureInPictureParams(); + } + + @VisibleForTesting + /* package */ Rational getAspectRatio() { + return mAspectRatio; } @CalledByNative - public static void createActivity(long nativeOverlayWindowAndroid, Object initiatorTab) { + public static void createActivity(long nativeOverlayWindowAndroid, Object initiatorTab, + int sourceX, int sourceY, int sourceWidth, int sourceHeight) { Context context = ContextUtils.getApplicationContext(); Intent intent = new Intent(context, PictureInPictureActivity.class); @@ -299,6 +338,16 @@ sInitiatorTab.addObserver(sTabObserver); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + if (sourceWidth > 0 && sourceHeight > 0) { + // Add the aspect ratio parameters if we have them, so that we can enter pip with them + // correctly immediately. We send these as two sizes since they're directly supported + // by `Bundle`. + intent.putExtra(SOURCE_X_KEY, sourceX); + intent.putExtra(SOURCE_Y_KEY, sourceY); + intent.putExtra(SOURCE_WIDTH_KEY, sourceWidth); + intent.putExtra(SOURCE_HEIGHT_KEY, sourceHeight); + } + context.startActivity(intent); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java index 5fd5291..483b9f0f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java
@@ -67,7 +67,6 @@ import org.chromium.chrome.browser.incognito.reauth.IncognitoReauthController; import org.chromium.chrome.browser.incognito.reauth.IncognitoReauthCoordinatorFactory; import org.chromium.chrome.browser.incognito.reauth.IncognitoReauthManager; -import org.chromium.chrome.browser.incognito.reauth.IncognitoReauthTabSwitcherDelegate; import org.chromium.chrome.browser.layouts.LayoutManager; import org.chromium.chrome.browser.layouts.LayoutStateProvider; import org.chromium.chrome.browser.layouts.LayoutType; @@ -721,35 +720,15 @@ if (IncognitoReauthManager.isIncognitoReauthFeatureAvailable()) { TabModelSelector tabModelSelector = mTabModelSelectorSupplier.get(); - // TODO(crbug.com/1324211, crbug.com/1227656) : Refactor below to remove - // IncognitoReauthTabSwitcherDelegate altogether and directly pass - // OneshotSupplierImpl<TabSwitcherCustomViewManager> instance. - OneshotSupplierImpl<IncognitoReauthTabSwitcherDelegate> - incognitoReauthTabSwitcherSupplier = new OneshotSupplierImpl<>(); - if (mActivityType == ActivityType.TABBED) { - mTabSwitcherCustomViewController = new CallbackController(); - mStartSurfaceSupplier.get().getTabSwitcherCustomViewManagerSupplier().onAvailable( - mTabSwitcherCustomViewController.makeCancelable(tabSwitcherCustomViewManager - -> incognitoReauthTabSwitcherSupplier.set( - new IncognitoReauthTabSwitcherDelegate() { - @Override - public boolean addReauthScreenInTabSwitcher( - @NonNull View customView) { - return tabSwitcherCustomViewManager.requestView( - customView); - } - - @Override - public boolean removeReauthScreenFromTabSwitcher() { - return tabSwitcherCustomViewManager.releaseView(); - } - }))); - } - + OneshotSupplier<TabSwitcherCustomViewManager> tabSwitcherCustomViewSupplier = + new OneshotSupplierImpl<>(); + tabSwitcherCustomViewSupplier = (mActivityType == ActivityType.TABBED) + ? mStartSurfaceSupplier.get().getTabSwitcherCustomViewManagerSupplier() + : tabSwitcherCustomViewSupplier; IncognitoReauthCoordinatorFactory incognitoReauthCoordinatorFactory = new IncognitoReauthCoordinatorFactory(mActivity, tabModelSelector, mModalDialogManagerSupplier.get(), new SettingsLauncherImpl(), - incognitoReauthTabSwitcherSupplier); + tabSwitcherCustomViewSupplier); mIncognitoReauthController = new IncognitoReauthController(tabModelSelector, mActivityLifecycleDispatcher, mLayoutStateProviderOneShotSupplier, mProfileSupplier, incognitoReauthCoordinatorFactory);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/dialogs/DownloadDialogIncognitoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/dialogs/DownloadDialogIncognitoTest.java index 1db782e..81a3c38 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/dialogs/DownloadDialogIncognitoTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/dialogs/DownloadDialogIncognitoTest.java
@@ -92,6 +92,7 @@ @Test @MediumTest + @DisabledTest(message = "https://crbug.com/1317700") public void testDuplicateDownloadForRegularProfile() throws Exception { // Showing a duplicate download dialog with a regular profile. OTRProfileID regularProfileID = null;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/PictureInPictureActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/PictureInPictureActivityTest.java index e183255..b0b3bab 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/PictureInPictureActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/PictureInPictureActivityTest.java
@@ -12,6 +12,7 @@ import android.app.Activity; import android.os.Build; import android.support.test.InstrumentationRegistry; +import android.util.Rational; import androidx.annotation.RequiresApi; import androidx.test.filters.MediumTest; @@ -105,6 +106,11 @@ } private PictureInPictureActivity startPictureInPictureActivity() throws Exception { + final int sourceX = 100; + final int sourceY = 200; + final int width = 300; + final int height = 400; + PictureInPictureActivity activity = ActivityTestUtils.waitForActivity(InstrumentationRegistry.getInstrumentation(), PictureInPictureActivity.class, new Callable<Void>() { @@ -113,7 +119,8 @@ TestThreadUtils.runOnUiThreadBlocking( () -> PictureInPictureActivity.createActivity( - NATIVE_OVERLAY, mTab)); + NATIVE_OVERLAY, mTab, sourceX, sourceY, + width, height)); return null; } }); @@ -124,6 +131,9 @@ Criteria.checkThat(activity.isInPictureInPictureMode(), Matchers.is(true)); }, PIP_TIMEOUT_MILLISECONDS, CriteriaHelper.DEFAULT_POLLING_INTERVAL); + Rational ratio = activity.getAspectRatio(); + Criteria.checkThat(ratio, Matchers.is(new Rational(width, height))); + return activity; } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountsReloadingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountsReloadingTest.java index 0930510..5847eda 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountsReloadingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountsReloadingTest.java
@@ -96,7 +96,6 @@ @Test @MediumTest - @DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.N, message = "crbug/1282868") public void testRefreshTokenUpdateWhenDefaultAccountSignsinWithoutSync() { final CoreAccountInfo account1 = mAccountManagerTestRule.addAccountAndWaitForSeeding(TEST_EMAIL1);
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index de985ff..f20e97d 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc
@@ -85,7 +85,7 @@ #include <algorithm> -#include "base/debug/handle_hooks_win.h" +#include "base/debug/close_handle_hook_win.h" #include "base/files/important_file_writer_cleaner.h" #include "base/threading/platform_thread_win.h" #include "base/win/atl.h" @@ -808,8 +808,8 @@ *exit_code = 0; return true; // Got a --version switch; exit with a success error code. } - // TODO(crbug.com/1052397): Revisit the macro expression once build flag - // switch of lacros-chrome is complete. +// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch +// of lacros-chrome is complete. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) // This will directly exit if the user asked for help. HandleHelpSwitches(command_line); @@ -823,25 +823,11 @@ return true; } - // HandleVerifier detects and reports incorrect handle manipulations. It - // tracks handle operations on builds that support DCHECK only. -#if DCHECK_IS_ON() - // This portion of the hook setup is just for child processes. Browser part is - // in ChromeBrowserMainPartsWin::PostProfileInit. - if (!is_browser) { - // Performing EAT interception first is safer in the presence of other - // threads attempting to call CloseHandle. -#if defined(ARCH_CPU_32_BITS) - // Patching EAT of kernel32.dll is only supported on 32-bit because RVA can - // only hold 32-bit values. - base::debug::HandleHooks::AddEATPatch(); -#endif - // Patch once. Cannot monitor for further modules in a child process as - // monitoring needs ModuleWatcher, but likely no more should really load in - // a child process from this point on. If we miss any then we will lose some - // detection but still generate no false positive crashes. - base::debug::HandleHooks::PatchLoadedModules(); - } +// HandleVerifier detects and reports incorrect handle manipulations. It tracks +// handle operations on builds that support DCHECK only. +// TODO(crbug/1104358): Support 64-bit handle hooks. +#if DCHECK_IS_ON() && !defined(ARCH_CPU_64_BITS) + base::debug::InstallHandleHooks(); #else base::win::DisableHandleVerifier(); #endif
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index 8d969fdb..872fb63 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -4000,21 +4000,12 @@ <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_OWNER" desc="Message in the consolidated consent screen to opt-in for metrics when the user is the device owner."> Help improve Chrome and ChromeOS features and performance by automatically sending crash reports as well as diagnostic and usage data to Google. Some aggregate data will also help Android apps and Google partners. If the Web & App Activity setting is turned on for your Google Account, your Android data may be saved to your Google Account. </message> - <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN" desc="Message in the consolidated consent screen to opt-in for metrics."> - Help improve Chrome and ChromeOS features and performance by automatically sending diagnostic and usage data to Google. Some aggregate data will also help Android apps and Google partners. If the Web & App Activity setting is turned on for your Google Account, your Android data may be saved to your Google Account. - </message> <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_CHILD_OWNER" desc="Message in the consolidated consent screen to opt-in for metrics for a child device owner account."> Help improve Chrome and ChromeOS features and performance by automatically sending crash reports as well as diagnostic and usage data to Google. Some aggregate data will also help Android apps and Google partners. If the Web & App Activity setting is turned on for your child's Google Account, your child's Android data may be saved to your child's Google Account. </message> - <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_CHILD" desc="Message in the consolidated consent screen to opt-in for metrics for a child account."> - Help improve Chrome and ChromeOS features and performance by automatically sending diagnostic and usage data to Google. Some aggregate data will also help Android apps and Google partners. If the Web & App Activity setting is turned on for your child's Google Account, your child's Android data may be saved to your child's Google Account. - </message> <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_ARC_DISABLED_OWNER" desc="Message in the consolidated consent screen to opt-in for metrics when ARC is disabled for device owner."> Help improve Chrome and ChromeOS features and performance by automatically sending crash reports as well as diagnostic and usage data to Google. </message> - <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_ARC_DISABLED" desc="Message in the consolidated consent screen to opt-in for metrics when ARC is disabled."> - Help improve Chrome and ChromeOS features and performance by automatically sending diagnostic and usage data to Google. - </message> <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_LINK" desc="Learn more about usage opt in"> Learn more about diagnostic and usage data </message> @@ -4023,47 +4014,22 @@ <ph name="BEGIN_PARAGRAPH2"><p></ph>You can start or stop allowing these reports any time in your ChromeOS device settings. If you’re a domain administrator, you can change this setting in the admin console.<ph name="END_PARAGRAPH2"></p></ph> <ph name="BEGIN_PARAGRAPH3"><p></ph>If the Web & App Activity setting is turned on for your Google Account, your Android data may be saved to your Google Account. You can see your data, delete it, and change your account settings at account.google.com.<ph name="END_PARAGRAPH3"></p></ph> </message> - <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE" desc="Text shown in a pop-up dialog in the consolidated consent screen when the user clicks on the learn more for metrics opt-in."> - <ph name="BEGIN_PARAGRAPH1"><p></ph>Allowing your ChromeOS devices to send automatic reports helps us prioritize what to fix and improve in ChromeOS. These reports can include things like which features you use, how much memory you typically use, Android app diagnostic and usage data, and errors. Some aggregate data will also help Google apps and partners, such as Android developers.<ph name="END_PARAGRAPH1"></p></ph> - <ph name="BEGIN_PARAGRAPH2"><p></ph>You can start or stop allowing these reports any time in your ChromeOS device settings. If you’re a domain administrator, you can change this setting in the admin console.<ph name="END_PARAGRAPH2"></p></ph> - <ph name="BEGIN_PARAGRAPH3"><p></ph>If the Web & App Activity setting is turned on for your Google Account, your Android data may be saved to your Google Account. You can see your data, delete it, and change your account settings at account.google.com.<ph name="END_PARAGRAPH3"></p></ph> - <ph name="BEGIN_PARAGRAPH4"><p></ph>If the device owner turns on "Send usage and diagnostic data", crash reports might also be uploaded to Google.<ph name="END_PARAGRAPH3"></p></ph> - </message> <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_CHILD_OWNER" desc="Text shown in a pop-up dialog in the consolidated consent screen when the user clicks on the learn more for metrics opt-in for a child device owner account."> <ph name="BEGIN_PARAGRAPH1"><p></ph>Allowing ChromeOS devices to send automatic reports helps us prioritize what to fix and improve in ChromeOS. These reports can include things like when ChromeOS crashes, which features were used, how much memory was typically used, and Android app diagnostic and usage data. Some aggregate data will also help Google apps and partners, such as Android developers.<ph name="END_PARAGRAPH1"></p></ph> <ph name="BEGIN_PARAGRAPH2"><p></ph>You can start or stop allowing these reports any time in your child's ChromeOS device settings. If you're a domain administrator, you can change this setting in the admin console.<ph name="END_PARAGRAPH2"></p></ph> <ph name="BEGIN_PARAGRAPH3"><p></ph>Turning off this feature doesn't affect this device's ability to send the information needed for essential services such as system updates and security.<ph name="END_PARAGRAPH3"></p></ph> <ph name="BEGIN_PARAGRAPH4"><p></ph>If the Web & App Activity setting is turned on for your child's Google Account, your child's data may be saved to their Google Account. Learn more about these settings and how to adjust them at families.google.com.<ph name="END_PARAGRAPH4"></p></ph> </message> - <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_CHILD" desc="Text shown in a pop-up dialog in the consolidated consent screen when the user clicks on the learn more for metrics opt-in for a child account."> - <ph name="BEGIN_PARAGRAPH1"><p></ph>Allowing ChromeOS devices to send automatic reports helps us prioritize what to fix and improve in ChromeOS. These reports can include things like which features were used, how much memory was typically used, and Android app diagnostic and usage data. Some aggregate data will also help Google apps and partners, such as Android developers.<ph name="END_PARAGRAPH1"></p></ph> - <ph name="BEGIN_PARAGRAPH2"><p></ph>You can start or stop allowing these reports any time in your child's ChromeOS device settings. If you're a domain administrator, you can change this setting in the admin console.<ph name="END_PARAGRAPH2"></p></ph> - <ph name="BEGIN_PARAGRAPH3"><p></ph>Turning off this feature doesn't affect this device's ability to send the information needed for essential services such as system updates and security.<ph name="END_PARAGRAPH3"></p></ph> - <ph name="BEGIN_PARAGRAPH4"><p></ph>If the Web & App Activity setting is turned on for your child's Google Account, your child's data may be saved to their Google Account. Learn more about these settings and how to adjust them at families.google.com.<ph name="END_PARAGRAPH4"></p></ph> - <ph name="BEGIN_PARAGRAPH4"><p></ph>If the device owner turns on "Send usage and diagnostic data", crash reports might also be uploaded to Google.<ph name="END_PARAGRAPH3"></p></ph> - </message> <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED_OWNER" desc="Text shown in a pop-up dialog in the consolidated consent screen when the device owner clicks on the learn more for metrics opt-in when ARC is disabled."> <ph name="BEGIN_PARAGRAPH1"><p></ph>Allowing your ChromeOS devices to send automatic reports helps us prioritize what to fix and improve in ChromeOS. These reports can include things like when ChromeOS crashes, which features you use and how much memory you typically use.<ph name="END_PARAGRAPH1"></p></ph> <ph name="BEGIN_PARAGRAPH2"><p></ph>You can start or stop allowing these reports any time in your Chrome device settings. If you’re a domain administrator, you can change this setting in the admin console.<ph name="END_PARAGRAPH2"></p></ph> <ph name="BEGIN_PARAGRAPH3"><p></ph>Turning off this feature doesn't affect your device's ability to send the information needed for essential services such as system updates and security.<ph name="END_PARAGRAPH3"></p></ph> </message> - <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED" desc="Text shown in a pop-up dialog in the consolidated consent screen when the user clicks on the learn more for metrics opt-in when ARC is disabled."> - <ph name="BEGIN_PARAGRAPH1"><p></ph>Allowing your ChromeOS devices to send automatic reports helps us prioritize what to fix and improve in ChromeOS. These reports can include things like which features you use and how much memory you typically use.<ph name="END_PARAGRAPH1"></p></ph> - <ph name="BEGIN_PARAGRAPH2"><p></ph>You can start or stop allowing these reports any time in your Chrome device settings. If you’re a domain administrator, you can change this setting in the admin console.<ph name="END_PARAGRAPH2"></p></ph> - <ph name="BEGIN_PARAGRAPH3"><p></ph>Turning off this feature doesn't affect your device's ability to send the information needed for essential services such as system updates and security.<ph name="END_PARAGRAPH3"></p></ph> - <ph name="BEGIN_PARAGRAPH4"><p></ph>If the device owner turns on "Send usage and diagnostic data", crash reports might also be uploaded to Google.<ph name="END_PARAGRAPH3"></p></ph> - </message> <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED_CHILD_OWNER" desc="Text shown in a pop-up dialog in the consolidated consent screen when the user clicks on the learn more for metrics opt-in when ARC is disabled in a child account."> <ph name="BEGIN_PARAGRAPH1"><p></ph>Allowing ChromeOS devices to send automatic reports helps us prioritize what to fix and improve in ChromeOS. These reports can include things like when ChromeOS crashes, which features were used, and how much memory was typically used.<ph name="END_PARAGRAPH1"></p></ph> <ph name="BEGIN_PARAGRAPH2"><p></ph>You can start or stop allowing these reports any time in your child's ChromeOS device settings. If you're a domain administrator, you can change this setting in the admin console.<ph name="END_PARAGRAPH2"></p></ph> <ph name="BEGIN_PARAGRAPH3"><p></ph>Turning off this feature doesn't affect this device's ability to send the information needed for essential services such as system updates and security.<ph name="END_PARAGRAPH3"></p></ph> </message> - <message name="IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED_CHILD" desc="Text shown in a pop-up dialog in the consolidated consent screen when the user clicks on the learn more for metrics opt-in when ARC is disabled in a child account."> - <ph name="BEGIN_PARAGRAPH1"><p></ph>Allowing ChromeOS devices to send automatic reports helps us prioritize what to fix and improve in ChromeOS. These reports can include things like when which features were used, and how much memory was typically used.<ph name="END_PARAGRAPH1"></p></ph> - <ph name="BEGIN_PARAGRAPH2"><p></ph>You can start or stop allowing these reports any time in your child's ChromeOS device settings. If you're a domain administrator, you can change this setting in the admin console.<ph name="END_PARAGRAPH2"></p></ph> - <ph name="BEGIN_PARAGRAPH3"><p></ph>Turning off this feature doesn't affect this device's ability to send the information needed for essential services such as system updates and security.<ph name="END_PARAGRAPH3"></p></ph> - <ph name="BEGIN_PARAGRAPH4"><p></ph>If the device owner turns on "Send usage and diagnostic data", crash reports might also be uploaded to Google.<ph name="END_PARAGRAPH3"></p></ph> - </message> <message name="IDS_CONSOLIDATED_CONSENT_BACKUP_OPT_IN_TITLE" desc="Title for the message in the consolidated consent screen to opt-in for back-up."> Back up Android apps to Google Drive. </message>
diff --git a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN.png.sha1 deleted file mode 100644 index 48f4a77..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -b973dfd97d4a95c33356fb2586a87bae3a65865a \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_ARC_DISABLED.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_ARC_DISABLED.png.sha1 deleted file mode 100644 index 937307d..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_ARC_DISABLED.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -b3eb3b644da1d45adb919483e7cfa5cd7e6c608f \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_CHILD.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_CHILD.png.sha1 deleted file mode 100644 index 70ebb42..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_CHILD.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -e0fa6e0ad9041c6ba06a9d74ac6b1a0588ab0078 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE.png.sha1 deleted file mode 100644 index 2c5a7a7..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -4a86caadc114789292806511a1a34888f3480c31 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED.png.sha1 deleted file mode 100644 index faf085ec..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -0f019ec21fe007ed97562753875e1d07492093df \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED_CHILD.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED_CHILD.png.sha1 deleted file mode 100644 index 1560f11..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED_CHILD.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -b5fae483ced124bef9159cefaeb3c5ece7f3a722 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_CHILD.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_CHILD.png.sha1 deleted file mode 100644 index f3508fa..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_CHILD.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -e1a084efbc480df7938c90cbe565d3bfe1598131 \ No newline at end of file
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 3bb579e4..18c9ff8 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -777,6 +777,9 @@ <message name="IDS_SETTINGS_PASSWORD_ROW_FEDERATED_MORE_ACTIONS" desc="The ARIA (accessibility) message for the More Actions button, which sits in every row of the password list. For this row does not include a password, only information of the account. It opens a menu with a list of actions, which apply to the account presented on this row."> More actions, saved account for <ph name="USERNAME">$1<ex>example@gmail.com</ex></ph> on <ph name="DOMAIN">$2<ex>www.google.com</ex></ph> </message> + <message name="IDS_SETTINGS_PASSWORD_ROW_PASSWORD_DETAIL_PAGE" desc="The ARIA (accessibility) message for the password subpage button, which sits in every row of the password list."> + Credential details for <ph name="USERNAME">$1<ex>example@gmail.com</ex></ph> on <ph name="DOMAIN">$2<ex>www.google.com</ex></ph> + </message> <message name="IDS_SETTINGS_TRUSTED_VAULT_BANNER_LABEL" desc="Label for the on-device encryption banner in settings."> On-device encryption </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORD_ROW_PASSWORD_DETAIL_PAGE.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORD_ROW_PASSWORD_DETAIL_PAGE.png.sha1 new file mode 100644 index 0000000..6d167615 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PASSWORD_ROW_PASSWORD_DETAIL_PAGE.png.sha1
@@ -0,0 +1 @@ +b0962ae4561c5bcdbca14bdb09f55ffc3ca3dfe1 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index ff7efb1..8b45bf2 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -4376,6 +4376,7 @@ "//chrome/app:command_ids", "//chrome/app/theme:chrome_unscaled_resources_grit", "//chrome/app/vector_icons", + "//chrome/browser/ash/system_web_apps/types:types", "//chrome/browser/cart:mojo_bindings", "//chrome/browser/enterprise/signals:utils", "//chrome/browser/first_party_sets", @@ -5809,8 +5810,6 @@ "mac/auth_session_request.mm", "mac/bluetooth_utility.h", "mac/bluetooth_utility.mm", - "mac/chrome_browser_main_extra_parts_mac.h", - "mac/chrome_browser_main_extra_parts_mac.mm", "mac/dock.h", "mac/dock.mm", "mac/exception_processor.h",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 885dfff..c218ce61 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -8027,6 +8027,12 @@ flag_descriptions::kEnableDrDcDescription, kOsAll, FEATURE_VALUE_TYPE(features::kEnableDrDc)}, + {"force-gpu-main-thread-to-normal-priority-drdc", + flag_descriptions::kForceGpuMainThreadToNormalPriorityDrDcName, + flag_descriptions::kForceGpuMainThreadToNormalPriorityDrDcDescription, + kOsAll, + FEATURE_VALUE_TYPE(features::kForceGpuMainThreadToNormalPriorityDrDc)}, + #if BUILDFLAG(IS_ANDROID) {"enable-drdc-vulkan", flag_descriptions::kEnableDrDcVulkanName, flag_descriptions::kEnableDrDcDescription, kOsAndroid,
diff --git a/chrome/browser/ash/BUILD.gn b/chrome/browser/ash/BUILD.gn index 5885764..ce5ec81 100644 --- a/chrome/browser/ash/BUILD.gn +++ b/chrome/browser/ash/BUILD.gn
@@ -168,6 +168,368 @@ "apps/apk_web_app_service.h", "apps/apk_web_app_service_factory.cc", "apps/apk_web_app_service_factory.h", + "arc/accessibility/accessibility_helper_instance_remote_proxy.cc", + "arc/accessibility/accessibility_helper_instance_remote_proxy.h", + "arc/accessibility/accessibility_info_data_wrapper.cc", + "arc/accessibility/accessibility_info_data_wrapper.h", + "arc/accessibility/accessibility_node_info_data_wrapper.cc", + "arc/accessibility/accessibility_node_info_data_wrapper.h", + "arc/accessibility/accessibility_window_info_data_wrapper.cc", + "arc/accessibility/accessibility_window_info_data_wrapper.h", + "arc/accessibility/arc_accessibility_helper_bridge.cc", + "arc/accessibility/arc_accessibility_helper_bridge.h", + "arc/accessibility/arc_accessibility_tree_tracker.cc", + "arc/accessibility/arc_accessibility_tree_tracker.h", + "arc/accessibility/arc_accessibility_util.cc", + "arc/accessibility/arc_accessibility_util.h", + "arc/accessibility/auto_complete_handler.cc", + "arc/accessibility/auto_complete_handler.h", + "arc/accessibility/ax_tree_source_arc.cc", + "arc/accessibility/ax_tree_source_arc.h", + "arc/accessibility/drawer_layout_handler.cc", + "arc/accessibility/drawer_layout_handler.h", + "arc/accessibility/geometry_util.cc", + "arc/accessibility/geometry_util.h", + "arc/adbd/arc_adbd_monitor_bridge.cc", + "arc/adbd/arc_adbd_monitor_bridge.h", + "arc/app_shortcuts/arc_app_shortcuts_menu_builder.cc", + "arc/app_shortcuts/arc_app_shortcuts_menu_builder.h", + "arc/app_shortcuts/arc_app_shortcuts_request.cc", + "arc/app_shortcuts/arc_app_shortcuts_request.h", + "arc/arc_demo_mode_delegate_impl.cc", + "arc/arc_demo_mode_delegate_impl.h", + "arc/arc_migration_constants.h", + "arc/arc_migration_guide_notification.cc", + "arc/arc_migration_guide_notification.h", + "arc/arc_optin_uma.cc", + "arc/arc_optin_uma.h", + "arc/arc_support_host.cc", + "arc/arc_support_host.h", + "arc/arc_ui_availability_reporter.cc", + "arc/arc_ui_availability_reporter.h", + "arc/arc_util.cc", + "arc/arc_util.h", + "arc/auth/arc_active_directory_enrollment_token_fetcher.cc", + "arc/auth/arc_active_directory_enrollment_token_fetcher.h", + "arc/auth/arc_auth_code_fetcher.h", + "arc/auth/arc_auth_context.cc", + "arc/auth/arc_auth_context.h", + "arc/auth/arc_auth_service.cc", + "arc/auth/arc_auth_service.h", + "arc/auth/arc_background_auth_code_fetcher.cc", + "arc/auth/arc_background_auth_code_fetcher.h", + "arc/auth/arc_fetcher_base.cc", + "arc/auth/arc_fetcher_base.h", + "arc/auth/arc_robot_auth_code_fetcher.cc", + "arc/auth/arc_robot_auth_code_fetcher.h", + "arc/bluetooth/arc_bluetooth_bridge.cc", + "arc/bluetooth/arc_bluetooth_bridge.h", + "arc/bluetooth/arc_bluetooth_task_queue.cc", + "arc/bluetooth/arc_bluetooth_task_queue.h", + "arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc", + "arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h", + "arc/enterprise/arc_data_snapshotd_delegate.cc", + "arc/enterprise/arc_data_snapshotd_delegate.h", + "arc/enterprise/arc_enterprise_reporting_service.cc", + "arc/enterprise/arc_enterprise_reporting_service.h", + "arc/enterprise/arc_force_installed_apps_tracker.cc", + "arc/enterprise/arc_force_installed_apps_tracker.h", + "arc/enterprise/arc_snapshot_reboot_notification_impl.cc", + "arc/enterprise/arc_snapshot_reboot_notification_impl.h", + "arc/enterprise/cert_store/arc_cert_installer.cc", + "arc/enterprise/cert_store/arc_cert_installer.h", + "arc/enterprise/cert_store/arc_cert_installer_utils.cc", + "arc/enterprise/cert_store/arc_cert_installer_utils.h", + "arc/enterprise/cert_store/cert_store_service.cc", + "arc/enterprise/cert_store/cert_store_service.h", + "arc/extensions/arc_support_message_host.cc", + "arc/extensions/arc_support_message_host.h", + "arc/file_system_watcher/arc_file_system_watcher_service.cc", + "arc/file_system_watcher/arc_file_system_watcher_service.h", + "arc/file_system_watcher/arc_file_system_watcher_util.cc", + "arc/file_system_watcher/arc_file_system_watcher_util.h", + "arc/file_system_watcher/file_system_scanner.cc", + "arc/file_system_watcher/file_system_scanner.h", + "arc/fileapi/arc_content_file_system_async_file_util.cc", + "arc/fileapi/arc_content_file_system_async_file_util.h", + "arc/fileapi/arc_content_file_system_backend_delegate.cc", + "arc/fileapi/arc_content_file_system_backend_delegate.h", + "arc/fileapi/arc_content_file_system_file_stream_reader.cc", + "arc/fileapi/arc_content_file_system_file_stream_reader.h", + "arc/fileapi/arc_content_file_system_file_stream_writer.cc", + "arc/fileapi/arc_content_file_system_file_stream_writer.h", + "arc/fileapi/arc_content_file_system_size_util.cc", + "arc/fileapi/arc_content_file_system_size_util.h", + "arc/fileapi/arc_content_file_system_url_util.cc", + "arc/fileapi/arc_content_file_system_url_util.h", + "arc/fileapi/arc_documents_provider_async_file_util.cc", + "arc/fileapi/arc_documents_provider_async_file_util.h", + "arc/fileapi/arc_documents_provider_backend_delegate.cc", + "arc/fileapi/arc_documents_provider_backend_delegate.h", + "arc/fileapi/arc_documents_provider_file_stream_reader.cc", + "arc/fileapi/arc_documents_provider_file_stream_reader.h", + "arc/fileapi/arc_documents_provider_file_stream_writer.cc", + "arc/fileapi/arc_documents_provider_file_stream_writer.h", + "arc/fileapi/arc_documents_provider_file_system_url_util.cc", + "arc/fileapi/arc_documents_provider_file_system_url_util.h", + "arc/fileapi/arc_documents_provider_root.cc", + "arc/fileapi/arc_documents_provider_root.h", + "arc/fileapi/arc_documents_provider_root_map.cc", + "arc/fileapi/arc_documents_provider_root_map.h", + "arc/fileapi/arc_documents_provider_root_map_factory.cc", + "arc/fileapi/arc_documents_provider_root_map_factory.h", + "arc/fileapi/arc_documents_provider_util.cc", + "arc/fileapi/arc_documents_provider_util.h", + "arc/fileapi/arc_documents_provider_watcher_manager.cc", + "arc/fileapi/arc_documents_provider_watcher_manager.h", + "arc/fileapi/arc_file_system_bridge.cc", + "arc/fileapi/arc_file_system_bridge.h", + "arc/fileapi/arc_file_system_mounter.cc", + "arc/fileapi/arc_file_system_mounter.h", + "arc/fileapi/arc_file_system_operation_runner.cc", + "arc/fileapi/arc_file_system_operation_runner.h", + "arc/fileapi/arc_file_system_operation_runner_util.cc", + "arc/fileapi/arc_file_system_operation_runner_util.h", + "arc/fileapi/arc_media_view_util.cc", + "arc/fileapi/arc_media_view_util.h", + "arc/fileapi/arc_select_files_handler.cc", + "arc/fileapi/arc_select_files_handler.h", + "arc/fileapi/arc_select_files_util.cc", + "arc/fileapi/arc_select_files_util.h", + "arc/fileapi/chrome_content_provider_url_util.cc", + "arc/fileapi/chrome_content_provider_url_util.h", + "arc/fileapi/file_stream_forwarder.cc", + "arc/fileapi/file_stream_forwarder.h", + "arc/input_method_manager/arc_input_method_manager_bridge.h", + "arc/input_method_manager/arc_input_method_manager_bridge_impl.cc", + "arc/input_method_manager/arc_input_method_manager_bridge_impl.h", + "arc/input_method_manager/arc_input_method_manager_service.cc", + "arc/input_method_manager/arc_input_method_manager_service.h", + "arc/input_method_manager/arc_input_method_state.cc", + "arc/input_method_manager/arc_input_method_state.h", + "arc/input_method_manager/input_connection_impl.cc", + "arc/input_method_manager/input_connection_impl.h", + "arc/input_method_manager/input_method_prefs.cc", + "arc/input_method_manager/input_method_prefs.h", + "arc/input_overlay/actions/action.cc", + "arc/input_overlay/actions/action.h", + "arc/input_overlay/actions/action_move.cc", + "arc/input_overlay/actions/action_move.h", + "arc/input_overlay/actions/action_tap.cc", + "arc/input_overlay/actions/action_tap.h", + "arc/input_overlay/actions/dependent_position.cc", + "arc/input_overlay/actions/dependent_position.h", + "arc/input_overlay/actions/input_element.cc", + "arc/input_overlay/actions/input_element.h", + "arc/input_overlay/actions/position.cc", + "arc/input_overlay/actions/position.h", + "arc/input_overlay/arc_input_overlay_manager.cc", + "arc/input_overlay/arc_input_overlay_manager.h", + "arc/input_overlay/arc_input_overlay_uma.cc", + "arc/input_overlay/arc_input_overlay_uma.h", + "arc/input_overlay/constants.h", + "arc/input_overlay/db/data_controller.cc", + "arc/input_overlay/db/data_controller.h", + "arc/input_overlay/display_overlay_controller.cc", + "arc/input_overlay/display_overlay_controller.h", + "arc/input_overlay/input_overlay_resources_util.cc", + "arc/input_overlay/input_overlay_resources_util.h", + "arc/input_overlay/key_event_source_rewriter.cc", + "arc/input_overlay/key_event_source_rewriter.h", + "arc/input_overlay/touch_id_manager.cc", + "arc/input_overlay/touch_id_manager.h", + "arc/input_overlay/touch_injector.cc", + "arc/input_overlay/touch_injector.h", + "arc/input_overlay/ui/action_circle.cc", + "arc/input_overlay/ui/action_circle.h", + "arc/input_overlay/ui/action_edit_button.cc", + "arc/input_overlay/ui/action_edit_button.h", + "arc/input_overlay/ui/action_edit_menu.cc", + "arc/input_overlay/ui/action_edit_menu.h", + "arc/input_overlay/ui/action_label.cc", + "arc/input_overlay/ui/action_label.h", + "arc/input_overlay/ui/action_tag.cc", + "arc/input_overlay/ui/action_tag.h", + "arc/input_overlay/ui/action_view.cc", + "arc/input_overlay/ui/action_view.h", + "arc/input_overlay/ui/edit_mode_exit_view.cc", + "arc/input_overlay/ui/edit_mode_exit_view.h", + "arc/input_overlay/ui/educational_view.cc", + "arc/input_overlay/ui/educational_view.h", + "arc/input_overlay/ui/error_view.cc", + "arc/input_overlay/ui/error_view.h", + "arc/input_overlay/ui/input_mapping_view.cc", + "arc/input_overlay/ui/input_mapping_view.h", + "arc/input_overlay/ui/input_menu_view.cc", + "arc/input_overlay/ui/input_menu_view.h", + "arc/instance_throttle/arc_active_window_throttle_observer.cc", + "arc/instance_throttle/arc_active_window_throttle_observer.h", + "arc/instance_throttle/arc_app_launch_throttle_observer.cc", + "arc/instance_throttle/arc_app_launch_throttle_observer.h", + "arc/instance_throttle/arc_boot_phase_throttle_observer.cc", + "arc/instance_throttle/arc_boot_phase_throttle_observer.h", + "arc/instance_throttle/arc_instance_throttle.cc", + "arc/instance_throttle/arc_instance_throttle.h", + "arc/instance_throttle/arc_kiosk_mode_throttle_observer.cc", + "arc/instance_throttle/arc_kiosk_mode_throttle_observer.h", + "arc/instance_throttle/arc_pip_window_throttle_observer.cc", + "arc/instance_throttle/arc_pip_window_throttle_observer.h", + "arc/instance_throttle/arc_power_throttle_observer.cc", + "arc/instance_throttle/arc_power_throttle_observer.h", + "arc/instance_throttle/arc_provisioning_throttle_observer.cc", + "arc/instance_throttle/arc_provisioning_throttle_observer.h", + "arc/instance_throttle/arc_switch_throttle_observer.cc", + "arc/instance_throttle/arc_switch_throttle_observer.h", + "arc/intent_helper/arc_intent_helper_mojo_ash.cc", + "arc/intent_helper/arc_intent_helper_mojo_ash.h", + "arc/intent_helper/arc_settings_service.cc", + "arc/intent_helper/arc_settings_service.h", + "arc/intent_helper/custom_tab_session_impl.cc", + "arc/intent_helper/custom_tab_session_impl.h", + "arc/intent_helper/factory_reset_delegate.cc", + "arc/intent_helper/factory_reset_delegate.h", + "arc/keymaster/arc_keymaster_bridge.cc", + "arc/keymaster/arc_keymaster_bridge.h", + "arc/keymaster/cert_store_bridge.cc", + "arc/keymaster/cert_store_bridge.h", + "arc/kiosk/arc_kiosk_bridge.cc", + "arc/kiosk/arc_kiosk_bridge.h", + "arc/metrics/arc_metrics_service_proxy.cc", + "arc/metrics/arc_metrics_service_proxy.h", + "arc/nearby_share/arc_nearby_share_bridge.cc", + "arc/nearby_share/arc_nearby_share_bridge.h", + "arc/nearby_share/arc_nearby_share_uma.cc", + "arc/nearby_share/arc_nearby_share_uma.h", + "arc/nearby_share/nearby_share_session_impl.cc", + "arc/nearby_share/nearby_share_session_impl.h", + "arc/nearby_share/share_info_file_handler.cc", + "arc/nearby_share/share_info_file_handler.h", + "arc/nearby_share/share_info_file_stream_adapter.cc", + "arc/nearby_share/share_info_file_stream_adapter.h", + "arc/nearby_share/ui/base_dialog_delegate_view.cc", + "arc/nearby_share/ui/base_dialog_delegate_view.h", + "arc/nearby_share/ui/error_dialog_view.cc", + "arc/nearby_share/ui/error_dialog_view.h", + "arc/nearby_share/ui/low_disk_space_dialog_view.cc", + "arc/nearby_share/ui/low_disk_space_dialog_view.h", + "arc/nearby_share/ui/nearby_share_overlay_view.cc", + "arc/nearby_share/ui/nearby_share_overlay_view.h", + "arc/nearby_share/ui/progress_bar_dialog_view.cc", + "arc/nearby_share/ui/progress_bar_dialog_view.h", + "arc/net/cert_manager_impl.cc", + "arc/net/cert_manager_impl.h", + "arc/notification/arc_boot_error_notification.cc", + "arc/notification/arc_boot_error_notification.h", + "arc/notification/arc_management_transition_notification.cc", + "arc/notification/arc_management_transition_notification.h", + "arc/notification/arc_provision_notification_service.cc", + "arc/notification/arc_provision_notification_service.h", + "arc/oemcrypto/arc_oemcrypto_bridge.cc", + "arc/oemcrypto/arc_oemcrypto_bridge.h", + "arc/optin/arc_optin_preference_handler.cc", + "arc/optin/arc_optin_preference_handler.h", + "arc/optin/arc_optin_preference_handler_observer.h", + "arc/optin/arc_terms_of_service_default_negotiator.cc", + "arc/optin/arc_terms_of_service_default_negotiator.h", + "arc/optin/arc_terms_of_service_negotiator.cc", + "arc/optin/arc_terms_of_service_negotiator.h", + "arc/optin/arc_terms_of_service_oobe_negotiator.cc", + "arc/optin/arc_terms_of_service_oobe_negotiator.h", + "arc/pip/arc_picture_in_picture_window_controller_impl.cc", + "arc/pip/arc_picture_in_picture_window_controller_impl.h", + "arc/pip/arc_pip_bridge.cc", + "arc/pip/arc_pip_bridge.h", + "arc/policy/arc_android_management_checker.cc", + "arc/policy/arc_android_management_checker.h", + "arc/policy/arc_policy_bridge.cc", + "arc/policy/arc_policy_bridge.h", + "arc/policy/arc_policy_handler.cc", + "arc/policy/arc_policy_handler.h", + "arc/policy/arc_policy_util.cc", + "arc/policy/arc_policy_util.h", + "arc/policy/managed_configuration_variables.cc", + "arc/policy/managed_configuration_variables.h", + "arc/print_spooler/arc_print_spooler_bridge.cc", + "arc/print_spooler/arc_print_spooler_bridge.h", + "arc/print_spooler/arc_print_spooler_util.cc", + "arc/print_spooler/arc_print_spooler_util.h", + "arc/print_spooler/print_session_impl.cc", + "arc/print_spooler/print_session_impl.h", + "arc/privacy_items/arc_privacy_items_bridge.cc", + "arc/privacy_items/arc_privacy_items_bridge.h", + "arc/process/arc_process.cc", + "arc/process/arc_process.h", + "arc/process/arc_process_service.cc", + "arc/process/arc_process_service.h", + "arc/screen_capture/arc_screen_capture_bridge.cc", + "arc/screen_capture/arc_screen_capture_bridge.h", + "arc/screen_capture/arc_screen_capture_session.cc", + "arc/screen_capture/arc_screen_capture_session.h", + "arc/session/adb_sideloading_availability_delegate_impl.cc", + "arc/session/adb_sideloading_availability_delegate_impl.h", + "arc/session/arc_app_id_provider_impl.cc", + "arc/session/arc_app_id_provider_impl.h", + "arc/session/arc_demo_mode_preference_handler.cc", + "arc/session/arc_demo_mode_preference_handler.h", + "arc/session/arc_play_store_enabled_preference_handler.cc", + "arc/session/arc_play_store_enabled_preference_handler.h", + "arc/session/arc_provisioning_result.cc", + "arc/session/arc_provisioning_result.h", + "arc/session/arc_service_launcher.cc", + "arc/session/arc_service_launcher.h", + "arc/session/arc_session_manager.cc", + "arc/session/arc_session_manager.h", + "arc/session/arc_session_manager_observer.h", + "arc/sharesheet/arc_sharesheet_bridge.cc", + "arc/sharesheet/arc_sharesheet_bridge.h", + "arc/survey/arc_survey_service.cc", + "arc/survey/arc_survey_service.h", + "arc/tracing/arc_app_performance_tracing.cc", + "arc/tracing/arc_app_performance_tracing.h", + "arc/tracing/arc_app_performance_tracing_custom_session.cc", + "arc/tracing/arc_app_performance_tracing_custom_session.h", + "arc/tracing/arc_app_performance_tracing_session.cc", + "arc/tracing/arc_app_performance_tracing_session.h", + "arc/tracing/arc_app_performance_tracing_uma_session.cc", + "arc/tracing/arc_app_performance_tracing_uma_session.h", + "arc/tracing/arc_cpu_event.cc", + "arc/tracing/arc_cpu_event.h", + "arc/tracing/arc_graphics_jank_detector.cc", + "arc/tracing/arc_graphics_jank_detector.h", + "arc/tracing/arc_system_model.cc", + "arc/tracing/arc_system_model.h", + "arc/tracing/arc_system_stat_collector.cc", + "arc/tracing/arc_system_stat_collector.h", + "arc/tracing/arc_tracing_bridge.cc", + "arc/tracing/arc_tracing_bridge.h", + "arc/tracing/arc_tracing_event.cc", + "arc/tracing/arc_tracing_event.h", + "arc/tracing/arc_tracing_event_matcher.cc", + "arc/tracing/arc_tracing_event_matcher.h", + "arc/tracing/arc_tracing_graphics_model.cc", + "arc/tracing/arc_tracing_graphics_model.h", + "arc/tracing/arc_tracing_model.cc", + "arc/tracing/arc_tracing_model.h", + "arc/tracing/arc_value_event.cc", + "arc/tracing/arc_value_event.h", + "arc/tracing/arc_value_event_trimmer.cc", + "arc/tracing/arc_value_event_trimmer.h", + "arc/tts/arc_tts_service.cc", + "arc/tts/arc_tts_service.h", + "arc/usb/arc_usb_host_bridge_delegate.cc", + "arc/usb/arc_usb_host_bridge_delegate.h", + "arc/user_session/arc_user_session_service.cc", + "arc/user_session/arc_user_session_service.h", + "arc/video/gpu_arc_video_service_host.cc", + "arc/video/gpu_arc_video_service_host.h", + "arc/wallpaper/arc_wallpaper_service.cc", + "arc/wallpaper/arc_wallpaper_service.h", + "arc/window_predictor/arc_predictor_app_launch_handler.cc", + "arc/window_predictor/arc_predictor_app_launch_handler.h", + "arc/window_predictor/window_predictor.cc", + "arc/window_predictor/window_predictor.h", + "arc/window_predictor/window_predictor_utils.cc", + "arc/window_predictor/window_predictor_utils.h", ] allow_circular_includes_from = [ @@ -177,37 +539,68 @@ ] public_deps = [ + "//ash", + "//ash/components/arc", + "//ash/components/arc:arc_base", + "//ash/components/arc:arc_base_utils", + "//ash/components/arc:arc_metrics_constants", + "//ash/components/arc/enterprise", "//ash/components/arc/mojom", + "//ash/components/arc/mojom:media", + "//ash/components/arc/mojom:oemcrypto", + "//ash/components/arc/session", + "//ash/components/arc/session:arc_base_enums", + "//ash/components/arc/session:connection_holder", "//ash/components/audio", "//ash/components/disks", "//ash/components/login/auth", "//ash/components/tpm", "//ash/public/cpp", + "//ash/public/cpp/external_arc", "//ash/services/multidevice_setup/public/cpp", "//ash/services/multidevice_setup/public/cpp:android_sms_app_helper_delegate", "//ash/services/multidevice_setup/public/cpp:android_sms_pairing_state_tracker", "//base", + "//chrome/browser/ash/arc/input_overlay/db/proto", "//chrome/browser/ash/crosapi", "//chrome/browser/chromeos", "//chrome/browser/extensions", + "//chrome/browser/image_decoder", "//chrome/browser/profiles:profile", "//chrome/browser/web_applications", "//chrome/common:buildflags", "//chrome/common:constants", + "//chrome/common/extensions/api", + "//chrome/services/keymaster/public/mojom", + "//chrome/services/printing/public/mojom", + "//chromeos/ash/components/dbus/concierge", + "//chromeos/components/sharesheet:constants", "//chromeos/crosapi/mojom", + "//chromeos/dbus/common", "//chromeos/dbus/dlcservice", "//chromeos/dbus/power", "//chromeos/dbus/resourced", + "//chromeos/dbus/session_manager", + "//chromeos/dbus/tpm_manager:tpm_manager_proto", "//chromeos/services/cros_healthd/public/mojom", "//chromeos/ui/base", "//components/account_id", "//components/account_manager_core", "//components/app_restore", + "//components/arc", + "//components/arc/common", "//components/content_settings/core/browser", "//components/exo", "//components/keyed_service/content", "//components/keyed_service/core", + "//components/policy:cloud_policy_proto_generated_compile", + "//components/policy:generated", + "//components/policy/core/browser", + "//components/policy/core/common", + "//components/policy/core/common:common_constants", + "//components/policy/core/common:policy_namespace", "//components/prefs", + "//components/printing/common:mojo_interfaces", "//components/services/app_service/public/cpp:app_types", "//components/services/app_service/public/cpp:app_update", "//components/services/app_service/public/cpp:icon_types", @@ -217,24 +610,47 @@ "//components/soda", "//components/sync_preferences", "//components/user_manager", + "//components/viz/common", "//content/public/browser", + "//crypto", + "//device/bluetooth", "//extensions/browser", + "//extensions/browser/api/automation_internal", + "//extensions/browser/api/messaging:native_messaging", "//extensions/common", + "//gpu/command_buffer/client", + "//media:media_buildflags", + "//mojo/public/c/system:headers", "//mojo/public/cpp/bindings", + "//mojo/public/cpp/system", "//net", + "//services/data_decoder/public/cpp", "//services/media_session/public/mojom", + "//services/network/public/cpp", "//services/network/public/mojom:cookies_mojom", + "//services/tracing/public/cpp", + "//storage/browser", "//third_party/abseil-cpp:absl", + "//third_party/boringssl", + "//ui/accessibility", + "//ui/accessibility:ax_base", "//ui/accessibility:ax_enums_mojo_headers", "//ui/aura", "//ui/base", + "//ui/base:ui_data_pack", + "//ui/base/ime", "//ui/base/ime/ash", "//ui/base/metadata", + "//ui/compositor", + "//ui/display", "//ui/events", + "//ui/events:dom_keycode_converter", + "//ui/events/types:headers", "//ui/gfx", "//ui/gfx:native_widget_types", "//ui/gfx/geometry", "//ui/message_center/public/cpp", + "//ui/shell_dialogs", "//ui/views", "//ui/wm/public", "//url", @@ -242,77 +658,135 @@ deps = [ "//apps", - "//ash", "//ash/components/account_manager", - "//ash/components/arc:arc_base_utils", - "//ash/components/arc:arc_metrics_constants", - "//ash/components/arc/session:connection_holder", + "//ash/components/arc:arc_features", + "//ash/components/arc:prefs", + "//ash/components/arc/input_overlay/resources", + "//ash/components/arc/media_session", + "//ash/components/arc/mojom:protected_buffer_manager", "//ash/components/cryptohome", "//ash/components/multidevice/logging", "//ash/components/settings", "//ash/constants", + "//ash/resources/vector_icons", "//ash/services/multidevice_setup/public/cpp:prefs", "//ash/services/multidevice_setup/public/mojom", + "//base:i18n", "//chrome/app:chromium_strings", "//chrome/app:generated_resources", + "//chrome/app/theme:theme_resources", "//chrome/app/vector_icons", "//chrome/browser:browser_process", "//chrome/browser:resources", "//chrome/browser/ash/crosapi:browser_util", - "//chrome/browser/image_decoder", "//chrome/browser/profiles", + "//chrome/browser/resources:component_extension_resources", "//chrome/browser/ui/webui/settings/chromeos/constants:mojom", + "//chrome/browser/webshare:storage", "//chrome/common", + "//chrome/common:channel_info", "//chrome/common:chrome_features", "//chrome/common:non_code_constants", - "//chrome/common/extensions/api", + "//chrome/common/net", "//chromeos/ash/components/dbus/upstart", + "//chromeos/components/cdm_factory_daemon:cdm_factory_daemon_browser", + "//chromeos/components/onc", "//chromeos/constants", "//chromeos/dbus", + "//chromeos/dbus/arc", + "//chromeos/dbus/cdm_factory_daemon", + "//chromeos/dbus/power:power_manager_proto", + "//chromeos/dbus/session_manager", + "//chromeos/dbus/tpm_manager", "//chromeos/dbus/userdataauth", + "//chromeos/dbus/virtual_file_provider", + "//chromeos/network", "//chromeos/services/cros_healthd/public/cpp", "//chromeos/system", + "//chromeos/ui/vector_icons", "//components/app_constants", + "//components/arc/common:arc_intent_helper_constants", + "//components/consent_auditor", "//components/crx_file", + "//components/device_event_log", + "//components/embedder_support:browser_util", "//components/language/core/browser", "//components/language/core/common", "//components/live_caption:constants", + "//components/metrics", + "//components/onc", "//components/ownership", "//components/pref_registry", + "//components/services/app_service/public/cpp:intents", "//components/services/app_service/public/cpp:types", "//components/services/app_service/public/mojom:types", + "//components/services/filesystem/public/mojom", + "//components/signin/public/base", "//components/strings:components_strings", + "//components/sync/base", + "//components/sync/driver", "//components/version_info", "//components/webapps/browser", "//components/webapps/browser:constants", "//content/public/common", + "//extensions/browser/api/file_handlers", "//extensions/browser/api/runtime", "//extensions/browser/api/virtual_keyboard_private", "//extensions/browser/api/virtual_keyboard_private:virtual_keyboard_delegate", "//extensions/common:common_constants", "//extensions/common:mojom", "//google_apis", - "//gpu/command_buffer/client", + "//gpu/command_buffer/client:gles2_interface", + "//gpu/command_buffer/common", + "//gpu/ipc/common", + "//mojo/public/cpp/bindings:bindings_base", + "//mojo/public/cpp/platform", + "//printing", + "//printing:printing_base", + "//printing/mojom", "//services/audio/public/cpp", - "//services/data_decoder/public/cpp", - "//services/network/public/cpp", "//services/network/public/cpp:cpp_base", "//services/network/public/mojom", + "//services/network/public/mojom:url_loader_base", + "//services/tracing/public/mojom", "//skia", "//third_party/blink/public/common:headers", "//third_party/blink/public/mojom:mojom_platform", - "//ui/accessibility:ax_base", + "//third_party/icu", + "//third_party/re2", + "//ui/accessibility", "//ui/accessibility:ax_enums_mojo", "//ui/base:features", "//ui/chromeos", - "//ui/compositor", + "//ui/chromeos/resources", + "//ui/chromeos/styles:cros_styles_views", "//ui/content_accelerators", - "//ui/display", + "//ui/display/manager", + "//ui/display/types", "//ui/events:event_constants", + "//ui/events:events_base", "//ui/events/blink", "//ui/gfx:color_utils", + "//ui/gfx:memory_buffer", "//ui/gfx/codec", + "//ui/strings", "//ui/views/controls/webview", "//ui/wm", ] } + +static_library("arc_test_support") { + testonly = true + + sources = [ + "arc/test/arc_data_removed_waiter.cc", + "arc/test/arc_data_removed_waiter.h", + "arc/test/test_arc_session_manager.cc", + "arc/test/test_arc_session_manager.h", + ] + + deps = [ + ":ash", + "//base", + ] +}
diff --git a/chrome/browser/ash/arc/nearby_share/OWNERS b/chrome/browser/ash/arc/nearby_share/OWNERS index ea9bde1f..a65cd53 100644 --- a/chrome/browser/ash/arc/nearby_share/OWNERS +++ b/chrome/browser/ash/arc/nearby_share/OWNERS
@@ -1,4 +1,10 @@ alanding@chromium.org + +# For Sharesheet integration: melzhang@chromium.org -mxcai@chromium.org + +# For Nearby Share integration: +nohle@chromium.org + +# For backup: tsergeant@chromium.org
diff --git a/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.h b/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.h index c9cfaf3..6dd0ca6 100644 --- a/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.h +++ b/chrome/browser/ash/arc/oemcrypto/arc_oemcrypto_bridge.h
@@ -8,7 +8,6 @@ #include <stdint.h> #include "ash/components/arc/mojom/oemcrypto.mojom.h" -#include "ash/components/arc/mojom/protected_buffer_manager.mojom.h" #include "components/keyed_service/core/keyed_service.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chrome/browser/ash/arc/process/arc_process_service.h b/chrome/browser/ash/arc/process/arc_process_service.h index eabfb0a..b702967 100644 --- a/chrome/browser/ash/arc/process/arc_process_service.h +++ b/chrome/browser/ash/arc/process/arc_process_service.h
@@ -21,8 +21,6 @@ #include "chrome/browser/ash/arc/process/arc_process.h" #include "chrome/browser/ash/process_snapshot_server.h" #include "components/keyed_service/core/keyed_service.h" -#include "services/resource_coordinator/public/cpp/memory_instrumentation/global_memory_dump.h" -#include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace content {
diff --git a/chrome/browser/ash/arc/session/arc_service_launcher.h b/chrome/browser/ash/arc/session/arc_service_launcher.h index 50562e3..eecbb5ba 100644 --- a/chrome/browser/ash/arc/session/arc_service_launcher.h +++ b/chrome/browser/ash/arc/session/arc_service_launcher.h
@@ -7,7 +7,6 @@ #include <memory> -#include "ash/public/mojom/cros_display_config.mojom.h" #include "media/media_buildflags.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chrome/browser/ash/crosapi/BUILD.gn b/chrome/browser/ash/crosapi/BUILD.gn index 6fd6774..be335399 100644 --- a/chrome/browser/ash/crosapi/BUILD.gn +++ b/chrome/browser/ash/crosapi/BUILD.gn
@@ -209,6 +209,7 @@ "//ash/webui/help_app_ui", "//base", "//chrome/browser:browser_process", + "//chrome/browser/ash/system_web_apps/types:types", "//chrome/browser/chromeos:print_job_info_proto", "//chrome/browser/profiles:profile", "//chrome/browser/ui/webui/settings/chromeos/constants:mojom",
diff --git a/chrome/browser/ash/file_manager/fileapi_util.cc b/chrome/browser/ash/file_manager/fileapi_util.cc index ecc47929..af22559 100644 --- a/chrome/browser/ash/file_manager/fileapi_util.cc +++ b/chrome/browser/ash/file_manager/fileapi_util.cc
@@ -471,13 +471,13 @@ GenerateUnusedFilenameState state, base::OnceCallback<void(base::FileErrorOr<storage::FileSystemURL>)> callback, - base::File::Error error, - const base::File::Info& file_info) { + base::File::Error error) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (error == base::File::FILE_ERROR_NOT_FOUND) { std::move(callback).Run(std::move(trial_url)); return; - } else if (error != base::File::FILE_OK) { + } else if (error != base::File::FILE_OK && + error != base::File::FILE_ERROR_NOT_A_DIRECTORY) { std::move(callback).Run(error); return; } @@ -493,9 +493,8 @@ state.destination_folder.mount_type(), state.destination_folder.virtual_path().Append( base::FilePath::FromUTF8Unsafe(filename))); - GetMetadataForPathOnIoThread( + CheckIfDirectoryExistsOnIoThread( file_system_context, filesystem_url, - storage::FileSystemOperation::GET_METADATA_FIELD_NONE, base::BindOnce(&GenerateUnusedFilenameOnGotMetadata, filesystem_url, std::move(state), std::move(callback))); } @@ -719,10 +718,8 @@ google_apis::CreateRelayCallback(std::move(callback))); content::GetIOThreadTaskRunner({})->PostTask( FROM_HERE, - base::BindOnce(&GetMetadataForPathOnIoThread, file_system_context, - std::move(trial_url), - storage::FileSystemOperation::GET_METADATA_FIELD_NONE, - std::move(get_metadata_callback))); + base::BindOnce(&CheckIfDirectoryExistsOnIoThread, file_system_context, + std::move(trial_url), std::move(get_metadata_callback))); } } // namespace util
diff --git a/chrome/browser/ash/file_manager/fileapi_util_unittest.cc b/chrome/browser/ash/file_manager/fileapi_util_unittest.cc index d45865b..df26472 100644 --- a/chrome/browser/ash/file_manager/fileapi_util_unittest.cc +++ b/chrome/browser/ash/file_manager/fileapi_util_unittest.cc
@@ -9,11 +9,13 @@ #include "ash/constants/ash_features.h" #include "base/bind.h" +#include "base/files/file_error_or.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "base/test/bind.h" #include "base/test/scoped_feature_list.h" #include "chrome/browser/ash/file_system_provider/fake_extension_provider.h" +#include "chrome/browser/ash/file_system_provider/fake_provided_file_system.h" #include "chrome/browser/ash/file_system_provider/service.h" #include "chrome/browser/ash/file_system_provider/service_factory.h" #include "chrome/test/base/testing_browser_process.h" @@ -507,6 +509,62 @@ base::File::FILE_ERROR_INVALID_OPERATION); } +TEST_P(FileManagerFileAPIUtilTest, GenerateUnusedFilenameFileSystemProvider) { + Profile* const profile = GetProfile(); + const std::string extension_id = "abc"; + + // Create and mount the FileSystemProvider. + auto fake_provider = + ash::file_system_provider::FakeExtensionProvider::Create(extension_id); + const auto kProviderId = fake_provider->GetId(); + auto* service = ash::file_system_provider::Service::Get(profile); + service->RegisterProvider(std::move(fake_provider)); + const base::File::Error result = service->MountFileSystem( + kProviderId, ash::file_system_provider::MountOptions(file_system_id_, + "Test FileSystem")); + ASSERT_EQ(base::File::FILE_OK, result); + + auto* provided_file_system = + static_cast<ash::file_system_provider::FakeProvidedFileSystem*>( + service->GetProvidedFileSystem(kProviderId, file_system_id_)); + ASSERT_TRUE(provided_file_system); + const base::FilePath mount_point_name = + provided_file_system->GetFileSystemInfo().mount_path().BaseName(); + + const std::string origin = "chrome-extension://abc/"; + storage::FileSystemContext* const context = + GetFileSystemContextForSourceURL(profile, GURL(origin)); + ASSERT_TRUE(context); + + // Make sure we can access the filesystem from the above origin. + context->external_backend()->GrantFileAccessToOrigin( + url::Origin::Create(GURL(origin)), base::FilePath(mount_point_name)); + + const storage::ExternalMountPoints* const mount_points = + storage::ExternalMountPoints::GetSystemInstance(); + auto destination_folder_url = mount_points->CreateCrackedFileSystemURL( + blink::StorageKey::CreateFromStringForTesting(origin), + storage::kFileSystemTypeExternal, mount_point_name); + auto expected_url = mount_points->CreateCrackedFileSystemURL( + blink::StorageKey::CreateFromStringForTesting(origin), + storage::kFileSystemTypeExternal, + mount_point_name.Append("hello (1).txt")); + + base::RunLoop run_loop; + GenerateUnusedFilename( + destination_folder_url, + base::FilePath(ash::file_system_provider::kFakeFilePath).BaseName(), + context, + base::BindLambdaForTesting( + [&](base::FileErrorOr<storage::FileSystemURL> result) { + EXPECT_FALSE(result.is_error()) + << "Unexpected error " << result.error(); + EXPECT_EQ(expected_url.ToGURL(), result->ToGURL()); + run_loop.Quit(); + })); + run_loop.Run(); +} + INSTANTIATE_TEST_SUITE_P(FilesAppMode, FileManagerFileAPIUtilTest, ::testing::Values(EXTENSION_FILES_APP,
diff --git a/chrome/browser/ash/file_manager/trash_io_task.cc b/chrome/browser/ash/file_manager/trash_io_task.cc index 2cde5311..6e60854f 100644 --- a/chrome/browser/ash/file_manager/trash_io_task.cc +++ b/chrome/browser/ash/file_manager/trash_io_task.cc
@@ -5,11 +5,13 @@ #include "chrome/browser/ash/file_manager/trash_io_task.h" #include "base/callback.h" +#include "base/files/file_util.h" #include "base/strings/strcat.h" #include "base/system/sys_info.h" #include "base/task/bind_post_task.h" #include "base/task/thread_pool.h" #include "base/time/time_to_iso8601.h" +#include "chrome/browser/ash/file_manager/fileapi_util.h" #include "chrome/browser/ash/file_manager/io_task_util.h" #include "chrome/browser/ash/file_manager/path_util.h" #include "content/public/browser/browser_task_traits.h" @@ -25,11 +27,23 @@ namespace { -const std::string GenerateTrashInfoContents( - const std::string& relative_restore_path, - const base::Time& deletion_time) { - return base::StrCat({"[Trash Info]\nPath=", relative_restore_path, - "\nDeletionDate=", base::TimeToISO8601(deletion_time)}); +// Generates and updates the `entry` with the standard contents of the +// individual .trashinfo files which contains the files original path (to +// restore to) and the deletion date. +bool UpdateTrashInfoContents(const base::FilePath& original_path, + const base::FilePath& trash_parent_path, + TrashEntry& entry) { + std::string relative_restore_path = original_path.value(); + if (!file_manager::util::ReplacePrefix( + &relative_restore_path, + trash_parent_path.AsEndingWithSeparator().value(), "")) { + return false; + } + + entry.trash_info_contents = base::StrCat( + {"[Trash Info]\nPath=", relative_restore_path, + "\nDeletionDate=", base::TimeToISO8601(entry.deletion_time)}); + return true; } storage::FileSystemOperationRunner::OperationID StartCreateDirectoryOnIOThread( @@ -41,6 +55,18 @@ url, /*exclusive=*/false, /*recursive=*/true, std::move(callback)); } +bool WriteMetadataFileOnBlockingThread(const base::FilePath& destination_path, + const std::string& contents) { + // If the metadata file already exists either a previous copy failed or + // the file has been tampered with to overwrite. Try to delete the file before + // proceeding. `DeleteFile` will succeed if the file does not exist. + if (!base::DeleteFile(destination_path)) { + LOG(ERROR) << "Failed to remove existing metadata file"; + return false; + } + return base::WriteFile(destination_path, contents); +} + TrashEntry::TrashEntry() : deletion_time(base::Time::Now()) {} TrashEntry::~TrashEntry() = default; @@ -60,6 +86,17 @@ } // namespace +const base::FilePath GenerateTrashPath(const base::FilePath& trash_path, + const std::string& subdir, + const std::string& file_name) { + base::FilePath path = trash_path.Append(subdir).Append(file_name); + // The metadata file in .Trash/info always has the .trashinfo extension. + if (subdir == kInfoFolderName) { + path = path.AddExtension(".trashinfo"); + } + return path; +} + TrashIOTask::TrashIOTask( std::vector<storage::FileSystemURL> file_urls, Profile* profile, @@ -112,13 +149,12 @@ base::BindOnce(std::move(complete_callback_), std::move(progress_))); } -void TrashIOTask::UpdateTrashEntry(size_t idx) { - base::FilePath source_path = progress_.sources[idx].url.path(); +void TrashIOTask::UpdateTrashEntry(size_t source_idx) { + base::FilePath source_path = progress_.sources[source_idx].url.path(); if (!base_path_.empty() && !source_path.IsAbsolute()) { source_path = base_path_.Append(source_path); } - const base::FilePath my_files_path = util::GetMyFilesFolderForProfile(profile_); const base::FilePath downloads_path = @@ -134,38 +170,37 @@ // out completely. // TODO(b/231830211): This may be better handled more gracefully by // continuing with the remaining files to see if others can be trashed. - progress_.sources[idx].error = base::File::FILE_ERROR_INVALID_OPERATION; + progress_.sources[source_idx].error = + base::File::FILE_ERROR_INVALID_OPERATION; Complete(State::kError); return; } - std::string relative_restore_path = source_path.value(); - if (!file_manager::util::ReplacePrefix(&relative_restore_path, - trash_parent_path.value(), "")) { + TrashEntry& entry = trash_entries_[source_idx]; + entry.trash_path = trash_parent_path.Append(kTrashFolderName); + + if (!UpdateTrashInfoContents(source_path, trash_parent_path, entry)) { // If we can't update the trash entry, update the source error and finish // with an error. - progress_.sources[idx].error = base::File::FILE_ERROR_INVALID_OPERATION; + progress_.sources[source_idx].error = + base::File::FILE_ERROR_INVALID_OPERATION; Complete(State::kError); return; } - TrashEntry& entry = trash_entries_[idx]; - entry.trash_path = trash_parent_path.Append(kTrashFolderName); - entry.trash_info_contents = - GenerateTrashInfoContents(relative_restore_path, entry.deletion_time); - auto it = free_space_map_.find(trash_parent_path); if (it == free_space_map_.end()) { - GetFreeDiskSpace(idx, trash_parent_path); + GetFreeDiskSpace(source_idx, trash_parent_path); return; } - ValidateAndDecrementFreeSpace(idx, it); + ValidateAndDecrementFreeSpace(source_idx, it); } -void TrashIOTask::ValidateAndDecrementFreeSpace(size_t idx, +void TrashIOTask::ValidateAndDecrementFreeSpace(size_t source_idx, FreeSpaceMap::iterator& it) { - size_t trash_contents_size = trash_entries_[idx].trash_info_contents.size(); + size_t trash_contents_size = + trash_entries_[source_idx].trash_info_contents.size(); progress_.total_bytes += trash_contents_size; if (trash_contents_size > it->second.free_space) { @@ -173,48 +208,48 @@ // if an error is set on `progress_.sources` before trashing. This will // enable trashes with mixed sources (some no space, some with space) to // finish. - progress_.sources[idx].error = base::File::FILE_ERROR_NO_SPACE; + progress_.sources[source_idx].error = base::File::FILE_ERROR_NO_SPACE; Complete(State::kError); return; } it->second.free_space -= trash_contents_size; - GetFileSize(idx); + GetFileSize(source_idx); } // Computes the total size of all source files and stores it in // `progress_.total_bytes`. -void TrashIOTask::GetFileSize(size_t idx) { - DCHECK(idx < progress_.sources.size()); +void TrashIOTask::GetFileSize(size_t source_idx) { + DCHECK(source_idx < progress_.sources.size()); content::GetIOThreadTaskRunner({})->PostTask( FROM_HERE, base::BindOnce( &GetFileMetadataOnIOThread, file_system_context_, - progress_.sources[idx].url, + progress_.sources[source_idx].url, storage::FileSystemOperation::GET_METADATA_FIELD_SIZE | storage::FileSystemOperation::GET_METADATA_FIELD_TOTAL_SIZE, google_apis::CreateRelayCallback( base::BindOnce(&TrashIOTask::GotFileSize, - weak_ptr_factory_.GetWeakPtr(), idx)))); + weak_ptr_factory_.GetWeakPtr(), source_idx)))); } // Helper function to GetFileSize() that is called when the metadata for a file // is retrieved. -void TrashIOTask::GotFileSize(size_t idx, +void TrashIOTask::GotFileSize(size_t source_idx, base::File::Error error, const base::File::Info& file_info) { - DCHECK(idx < progress_.sources.size()); + DCHECK(source_idx < progress_.sources.size()); if (error != base::File::FILE_OK) { - progress_.sources[idx].error = error; + progress_.sources[source_idx].error = error; Complete(State::kError); return; } progress_.total_bytes += file_info.size; - trash_entries_[idx].source_file_size = file_info.size; + trash_entries_[source_idx].source_file_size = file_info.size; - if (idx < progress_.sources.size() - 1) { - UpdateTrashEntry(idx + 1); + if (source_idx < progress_.sources.size() - 1) { + UpdateTrashEntry(source_idx + 1); return; } @@ -222,13 +257,14 @@ SetupSubDirectory(it, it->second.trash_files); } -void TrashIOTask::GetFreeDiskSpace(size_t idx, +void TrashIOTask::GetFreeDiskSpace(size_t source_idx, const base::FilePath& trash_parent_path) { base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {base::MayBlock()}, base::BindOnce(&base::SysInfo::AmountOfFreeDiskSpace, trash_parent_path), base::BindOnce(&TrashIOTask::GotFreeDiskSpace, - weak_ptr_factory_.GetWeakPtr(), idx, trash_parent_path)); + weak_ptr_factory_.GetWeakPtr(), source_idx, + trash_parent_path)); } base::FilePath TrashIOTask::MakeRelativeFromBasePath( @@ -245,19 +281,19 @@ return base::FilePath(relative_path); } -void TrashIOTask::GotFreeDiskSpace(size_t idx, +void TrashIOTask::GotFreeDiskSpace(size_t source_idx, const base::FilePath& trash_parent_path, int64_t free_space) { base::FilePath trash_path = MakeRelativeFromBasePath(trash_parent_path.Append(kTrashFolderName)); const storage::FileSystemURL files_url = CreateFileSystemURL( - progress_.sources[idx].url, trash_path.Append(kFilesFolderName)); + progress_.sources[source_idx].url, trash_path.Append(kFilesFolderName)); const storage::FileSystemURL info_url = CreateFileSystemURL( - progress_.sources[idx].url, trash_path.Append(kInfoFolderName)); + progress_.sources[source_idx].url, trash_path.Append(kInfoFolderName)); auto it = free_space_map_.try_emplace( trash_parent_path, DirectoryInfo(files_url, info_url, free_space)); - ValidateAndDecrementFreeSpace(idx, it.first); + ValidateAndDecrementFreeSpace(source_idx, it.first); } void TrashIOTask::SetupSubDirectory( @@ -295,15 +331,96 @@ it++; if (it == free_space_map_.end()) { - // TODO(b/231830211): Implement trash logic here, the directory structure - // has been setup successfully. - Complete(State::kSuccess); + GenerateDestinationURL(/*source_idx=*/0, /*output_idx=*/0); return; } SetupSubDirectory(it, it->second.trash_files); } +void TrashIOTask::GenerateDestinationURL(size_t source_idx, size_t output_idx) { + DCHECK(source_idx < progress_.sources.size()); + DCHECK(source_idx < trash_entries_.size()); + + const auto trash_path = MakeRelativeFromBasePath( + trash_entries_[source_idx].trash_path.Append(kFilesFolderName)); + + const storage::FileSystemURL files_location = + CreateFileSystemURL(progress_.sources[source_idx].url, trash_path); + util::GenerateUnusedFilename( + files_location, progress_.sources[source_idx].url.path().BaseName(), + file_system_context_, + base::BindOnce(&TrashIOTask::WriteMetadata, + weak_ptr_factory_.GetWeakPtr(), source_idx, output_idx, + files_location)); +} + +void TrashIOTask::WriteMetadata( + size_t source_idx, + size_t output_idx, + const storage::FileSystemURL& files_folder_location, + base::FileErrorOr<storage::FileSystemURL> destination_result) { + if (destination_result.is_error()) { + progress_.outputs.emplace_back(files_folder_location, absl::nullopt); + TrashComplete(source_idx, output_idx, destination_result.error()); + return; + } + const base::FilePath destination_path = + GenerateTrashPath(trash_entries_[source_idx].trash_path, kInfoFolderName, + destination_result.value().path().BaseName().value()); + progress_.outputs.emplace_back( + CreateFileSystemURL(progress_.sources[source_idx].url, destination_path), + absl::nullopt); + + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::MayBlock()}, + base::BindOnce(&WriteMetadataFileOnBlockingThread, destination_path, + trash_entries_[source_idx].trash_info_contents), + base::BindOnce(&TrashIOTask::OnWriteMetadata, + weak_ptr_factory_.GetWeakPtr(), source_idx, output_idx, + destination_result.value())); +} + +void TrashIOTask::OnWriteMetadata(size_t source_idx, + size_t output_idx, + const storage::FileSystemURL& destination_url, + bool success) { + if (!success) { + TrashComplete(source_idx, output_idx, base::File::FILE_ERROR_FAILED); + return; + } + + // TODO(b/231250202): Move the file to trash but on error remove the metadata + // file. + TrashComplete(source_idx, output_idx, base::File::Error::FILE_OK); +} + +void TrashIOTask::TrashComplete(size_t source_idx, + size_t output_idx, + base::File::Error error) { + DCHECK(source_idx < progress_.sources.size()); + DCHECK(source_idx < trash_entries_.size()); + DCHECK(output_idx < progress_.outputs.size()); + operation_id_.reset(); + progress_.sources[source_idx].error = error; + progress_.outputs[output_idx].error = error; + progress_.bytes_transferred += + trash_entries_[source_idx].trash_info_contents.size(); + + if (source_idx < progress_.sources.size() - 1) { + progress_callback_.Run(progress_); + GenerateDestinationURL(source_idx + 1, output_idx + 1); + } else { + for (const auto& source : progress_.sources) { + if (source.error != base::File::FILE_OK) { + Complete(State::kError); + return; + } + } + Complete(State::kSuccess); + } +} + const storage::FileSystemURL TrashIOTask::CreateFileSystemURL( const storage::FileSystemURL& original_url, const base::FilePath& path) {
diff --git a/chrome/browser/ash/file_manager/trash_io_task.h b/chrome/browser/ash/file_manager/trash_io_task.h index 4d5c642..d7c1eee 100644 --- a/chrome/browser/ash/file_manager/trash_io_task.h +++ b/chrome/browser/ash/file_manager/trash_io_task.h
@@ -8,6 +8,7 @@ #include <memory> #include <vector> +#include "base/files/file_error_or.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" @@ -77,6 +78,11 @@ // Constant representing the "files" folder name inside .Trash. extern const char kFilesFolderName[]; +// Helper to create a destination path for a file in one of the .Trash folders. +const base::FilePath GenerateTrashPath(const base::FilePath& trash_path, + const std::string& subdir, + const std::string& file_name); + // This class represents a trash task. A trash task attempts to trash zero or // more files by first moving them to a .Trash/files or .Trash-{UID}/files // folder that resides in a parent folder for: @@ -105,9 +111,9 @@ private: void Complete(State state); - void UpdateTrashEntry(size_t idx); - void GetFileSize(size_t idx); - void GotFileSize(size_t idx, + void UpdateTrashEntry(size_t source_idx); + void GetFileSize(size_t source_idx); + void GotFileSize(size_t source_idx, base::File::Error error, const base::File::Info& file_info); const storage::FileSystemURL CreateFileSystemURL( @@ -116,9 +122,11 @@ void SetCurrentOperationID( storage::FileSystemOperationRunner::OperationID id); using FreeSpaceMap = std::map<base::FilePath, DirectoryInfo>; - void ValidateAndDecrementFreeSpace(size_t idx, FreeSpaceMap::iterator& it); - void GetFreeDiskSpace(size_t idx, const base::FilePath& trash_parent_path); - void GotFreeDiskSpace(size_t idx, + void ValidateAndDecrementFreeSpace(size_t source_idx, + FreeSpaceMap::iterator& it); + void GetFreeDiskSpace(size_t source_idx, + const base::FilePath& trash_parent_path); + void GotFreeDiskSpace(size_t source_idx, const base::FilePath& trash_parent_path, int64_t free_space); @@ -132,6 +140,30 @@ base::File::Error error); base::FilePath MakeRelativeFromBasePath(const base::FilePath& absolute_path); + // Attempts to generate a unique destination filename when saving to + // .Trash/files. Appends an increasing (N) suffix until a unique name is + // identified. + void GenerateDestinationURL(size_t source_idx, size_t output_idx); + + // Creates a file in .Trash/info that matches the name generated from + // `GenerateDestinationURL`. Writes the relative restoration path as well as + // the date time of deletion. + void WriteMetadata( + size_t source_idx, + size_t output_idx, + const storage::FileSystemURL& files_folder_location, + base::FileErrorOr<storage::FileSystemURL> destination_result); + void OnWriteMetadata(size_t source_idx, + size_t output_idx, + const storage::FileSystemURL& destination_url, + bool success); + + // Called upon either error of writing metadata or completion of moving the + // trashed file. Ensures progress is invoked and the next file is queued. + void TrashComplete(size_t source_idx, + size_t output_idx, + base::File::Error error); + raw_ptr<Profile> profile_; scoped_refptr<storage::FileSystemContext> file_system_context_;
diff --git a/chrome/browser/ash/file_manager/trash_io_task_unittest.cc b/chrome/browser/ash/file_manager/trash_io_task_unittest.cc index 3427120..adef0f6 100644 --- a/chrome/browser/ash/file_manager/trash_io_task_unittest.cc +++ b/chrome/browser/ash/file_manager/trash_io_task_unittest.cc
@@ -9,8 +9,11 @@ #include "base/files/scoped_temp_dir.h" #include "base/rand_util.h" #include "base/run_loop.h" +#include "base/strings/strcat.h" #include "base/test/gmock_callback_support.h" #include "base/test/mock_callback.h" +#include "base/time/time_override.h" +#include "base/time/time_to_iso8601.h" #include "chrome/browser/ash/file_manager/fake_disk_mount_manager.h" #include "chrome/browser/ash/file_manager/path_util.h" #include "chrome/test/base/testing_profile.h" @@ -29,9 +32,32 @@ using ::base::test::RunClosure; using ::testing::_; +using ::testing::ElementsAre; using ::testing::Field; using ::testing::Return; +// Matcher that only verifies the `url` field from a `std::vector<EntryStatus>` +// ignoring the `error` field. The supplied `arg` should be a +// `std::vector<storage::FileSystemURL>` to match against. +MATCHER_P(EntryStatusUrls, matcher, "") { + std::vector<storage::FileSystemURL> urls; + for (const auto& status : arg) { + urls.push_back(status.url); + } + return testing::ExplainMatchResult(matcher, urls, result_listener); +} + +// Matcher that only verifies the `error` field from a +// `std::vector<EntryStatus>` ignoring the `url` field. The supplied `arg` +// should be a `std::vector<base::File::Error>` to match against. +MATCHER_P(EntryStatusErrors, matcher, "") { + std::vector<absl::optional<base::File::Error>> errors; + for (const auto& status : arg) { + errors.push_back(status.error); + } + return testing::ExplainMatchResult(matcher, errors, result_listener); +} + constexpr size_t kTestFileSize = 32; class TrashIOTaskTest : public testing::Test { @@ -76,6 +102,32 @@ base::FilePath::FromUTF8Unsafe(relative_path)); } + const base::FilePath GenerateInfoPath(const std::string& file_name) { + return GenerateTrashPath(downloads_dir_.Append(kTrashFolderName), + kInfoFolderName, file_name); + } + + const std::string CreateTrashInfoContentsFromPath( + const base::FilePath& file_path) { + std::string relative_restore_path = file_path.value(); + EXPECT_TRUE(file_manager::util::ReplacePrefix( + &relative_restore_path, downloads_dir_.AsEndingWithSeparator().value(), + "")); + return base::StrCat({"[Trash Info]\nPath=", relative_restore_path, + "\nDeletionDate=", base::TimeToISO8601(base::Time())}); + } + + bool EnsureTrashDirectorySetup(const base::FilePath& parent_path) { + base::FilePath trash_path = parent_path.Append(kTrashFolderName); + if (!base::CreateDirectory(trash_path.Append(kInfoFolderName))) { + return false; + } + if (!base::CreateDirectory(trash_path.Append(kFilesFolderName))) { + return false; + } + return true; + } + content::BrowserTaskEnvironment task_environment_; std::unique_ptr<TestingProfile> profile_; const blink::StorageKey kTestStorageKey = @@ -94,6 +146,13 @@ ASSERT_TRUE(base::DirectoryExists(trash_path.Append(kInfoFolderName))); } +void ExpectFileContents(const base::FilePath& path, + const std::string& expected) { + std::string contents; + ASSERT_TRUE(base::ReadFileToString(path, &contents)); + EXPECT_EQ(expected, contents); +} + TEST_F(TrashIOTaskTest, FileInUnsupportedDirectoryShouldError) { std::string foo_contents = base::RandBytesAsString(kTestFileSize); const base::FilePath file_path = temp_dir_.GetPath().Append("foo.txt"); @@ -169,7 +228,10 @@ base::MockRepeatingCallback<void(const ProgressStatus&)> progress_callback; base::MockOnceCallback<void(ProgressStatus)> complete_callback; - // TODO(b/231250202): Update this once the Trash logic has been written. + // Progress callback should not be called as the verification of disk space + // should fail before any file operations occur. + EXPECT_CALL(progress_callback, Run(_)).Times(0); + EXPECT_CALL(complete_callback, Run(Field(&ProgressStatus::state, State::kSuccess))) .WillOnce(RunClosure(run_loop.QuitClosure())); @@ -182,6 +244,131 @@ AssertTrashSetup(downloads_dir_); } +TEST_F(TrashIOTaskTest, OrphanedFilesAreOverwritten) { + std::string foo_contents = base::RandBytesAsString(kTestFileSize); + std::string file_name("foo.txt"); + const base::FilePath file_path = downloads_dir_.Append(file_name); + const std::string file_trashinfo_contents = + CreateTrashInfoContentsFromPath(file_path); + const size_t total_expected_bytes = + kTestFileSize + file_trashinfo_contents.size(); + ASSERT_TRUE(base::WriteFile(file_path, foo_contents)); + + // Ensure the .Trash, info and files directories are setup and create a file + // in .Trash/info that has no corresponding file in .Trash/files. + ASSERT_TRUE(EnsureTrashDirectorySetup(downloads_dir_)); + ASSERT_TRUE(base::WriteFile(GenerateInfoPath(file_name), + "these contents should be overwritten")); + + base::RunLoop run_loop; + std::vector<storage::FileSystemURL> source_urls = { + CreateFileSystemURL(file_path), + }; + + base::MockRepeatingCallback<void(const ProgressStatus&)> progress_callback; + base::MockOnceCallback<void(ProgressStatus)> complete_callback; + + // Completion callback should contain the one metadata file written with the + // `total_expected_bytes` containing the size of both the file to trash and + // the size of the metadata. + // TODO(b/231250202): Once trash has implemented, the `bytes_transferred` + // should be updated to the `total_expected_bytes`. + EXPECT_CALL( + complete_callback, + Run(AllOf(Field(&ProgressStatus::state, State::kSuccess), + Field(&ProgressStatus::bytes_transferred, + file_trashinfo_contents.size()), + Field(&ProgressStatus::total_bytes, total_expected_bytes), + Field(&ProgressStatus::sources, EntryStatusUrls(source_urls)), + Field(&ProgressStatus::outputs, + EntryStatusErrors(ElementsAre(base::File::FILE_OK)))))) + .WillOnce(RunClosure(run_loop.QuitClosure())); + + { + // Override the `base::Time::Now()` function to return 0 (i.e. base::Time()) + // This ensures the DeletionDate is static in tests to verify file contents. + base::subtle::ScopedTimeClockOverrides mock_time_now( + []() { return base::Time(); }, nullptr, nullptr); + TrashIOTask task(source_urls, profile_.get(), file_system_context_, + temp_dir_.GetPath()); + task.Execute(progress_callback.Get(), complete_callback.Get()); + run_loop.Run(); + } + + AssertTrashSetup(downloads_dir_); + ExpectFileContents(GenerateInfoPath(file_name), file_trashinfo_contents); +} + +TEST_F(TrashIOTaskTest, MultipleFilesInvokeProgress) { + std::string foo_contents = base::RandBytesAsString(kTestFileSize); + std::string file_name_1("foo.txt"); + const base::FilePath file_path_1 = downloads_dir_.Append(file_name_1); + const std::string file_trashinfo_contents_1 = + CreateTrashInfoContentsFromPath(file_path_1); + std::string file_name_2("bar.txt"); + const base::FilePath file_path_2 = downloads_dir_.Append(file_name_2); + const std::string file_trashinfo_contents_2 = + CreateTrashInfoContentsFromPath(file_path_2); + const size_t expected_bytes_transferred = + file_trashinfo_contents_1.size() + file_trashinfo_contents_2.size(); + const size_t expected_total_bytes = + (kTestFileSize * 2) + expected_bytes_transferred; + ASSERT_TRUE(base::WriteFile(file_path_1, foo_contents)); + ASSERT_TRUE(base::WriteFile(file_path_2, foo_contents)); + + base::RunLoop run_loop; + std::vector<storage::FileSystemURL> source_urls = { + CreateFileSystemURL(file_path_1), + CreateFileSystemURL(file_path_2), + }; + + base::MockRepeatingCallback<void(const ProgressStatus&)> progress_callback; + base::MockOnceCallback<void(ProgressStatus)> complete_callback; + + // Expect that all callback (both completion and progress) contains the set of + // source URLs and the `total_bytes` set to `expected_total_bytes`. + const auto base_matcher = + AllOf(Field(&ProgressStatus::sources, EntryStatusUrls(source_urls)), + Field(&ProgressStatus::total_bytes, expected_total_bytes)); + + // Expect the `progress_callback` to be invoked after the first metadata file + // has been written with the size contents and + EXPECT_CALL( + progress_callback, + Run(AllOf(Field(&ProgressStatus::state, State::kInProgress), + Field(&ProgressStatus::bytes_transferred, + file_trashinfo_contents_1.size()), + Field(&ProgressStatus::outputs, + EntryStatusErrors(ElementsAre(base::File::FILE_OK))), + base_matcher))) + .Times(1); + + // Expect the completion callback to be invoked after the final metadata file + // is written out. + EXPECT_CALL(complete_callback, + Run(AllOf(Field(&ProgressStatus::state, State::kSuccess), + Field(&ProgressStatus::bytes_transferred, + expected_bytes_transferred), + Field(&ProgressStatus::outputs, + EntryStatusErrors(ElementsAre( + base::File::FILE_OK, base::File::FILE_OK))), + base_matcher))) + .WillOnce(RunClosure(run_loop.QuitClosure())); + + { + base::subtle::ScopedTimeClockOverrides mock_time_now( + []() { return base::Time(); }, nullptr, nullptr); + TrashIOTask task(source_urls, profile_.get(), file_system_context_, + temp_dir_.GetPath()); + task.Execute(progress_callback.Get(), complete_callback.Get()); + run_loop.Run(); + } + + AssertTrashSetup(downloads_dir_); + ExpectFileContents(GenerateInfoPath(file_name_1), file_trashinfo_contents_1); + ExpectFileContents(GenerateInfoPath(file_name_2), file_trashinfo_contents_2); +} + } // namespace } // namespace io_task } // namespace file_manager
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc index fddcae6..49fcffb 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc
@@ -243,7 +243,6 @@ easy_unlock_service_regular_->Shutdown(); PowerManagerClient::Shutdown(); TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr); - display::Screen::SetScreenInstance(nullptr); } // Most tests will want to pass `should_initialize_all_dependencies` == true,
diff --git a/chrome/browser/ash/login/screens/consolidated_consent_screen.cc b/chrome/browser/ash/login/screens/consolidated_consent_screen.cc index 5a11330..886694ae 100644 --- a/chrome/browser/ash/login/screens/consolidated_consent_screen.cc +++ b/chrome/browser/ash/login/screens/consolidated_consent_screen.cc
@@ -247,9 +247,10 @@ // If the user is not the owner and the owner disabled metrics, the user // is not allowed to update the usage opt-in. - if (!is_owner_.value_or(false) && - !ash::StatsReportingController::Get()->IsEnabled()) { - view_->HideUsageOptin(); + if (view_) { + view_->SetUsageOptinOptinHidden( + !is_owner_.value_or(false) && + !ash::StatsReportingController::Get()->IsEnabled()); } const bool is_demo = arc::IsArcDemoModeSetupFlow(); @@ -286,9 +287,6 @@ UpdateMetricsMode(is_enabled, is_managed); } - - if (view_) - view_->SetIsDeviceOwner(is_owner_.value()); } void ConsolidatedConsentScreen::RecordConsents(
diff --git a/chrome/browser/ash/login/screens/mock_consolidated_consent_screen.h b/chrome/browser/ash/login/screens/mock_consolidated_consent_screen.h index 35d1d24..94097d62 100644 --- a/chrome/browser/ash/login/screens/mock_consolidated_consent_screen.h +++ b/chrome/browser/ash/login/screens/mock_consolidated_consent_screen.h
@@ -40,7 +40,7 @@ MOCK_METHOD(void, SetBackupMode, (bool enabled, bool managed)); MOCK_METHOD(void, SetLocationMode, (bool enabled, bool managed)); MOCK_METHOD(void, SetIsDeviceOwner, (bool is_owner)); - MOCK_METHOD(void, HideUsageOptin, ()); + MOCK_METHOD(void, SetUsageOptinOptinHidden, (bool hidden)); private: ConsolidatedConsentScreen* screen_ = nullptr;
diff --git a/chrome/browser/ash/policy/enrollment/private_membership/fake_psm_rlwe_dmserver_client.cc b/chrome/browser/ash/policy/enrollment/private_membership/fake_psm_rlwe_dmserver_client.cc new file mode 100644 index 0000000..3641a73 --- /dev/null +++ b/chrome/browser/ash/policy/enrollment/private_membership/fake_psm_rlwe_dmserver_client.cc
@@ -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. + +#include "chrome/browser/ash/policy/enrollment/private_membership/fake_psm_rlwe_dmserver_client.h" + +#include <utility> + +#include "base/check.h" +#include "chrome/browser/ash/policy/enrollment/private_membership/psm_rlwe_dmserver_client.h" + +namespace policy { + +FakePsmRlweDmserverClient::FakePsmRlweDmserverClient() + : result_holder_(PsmResult::kConnectionError) {} + +void FakePsmRlweDmserverClient::CheckMembership(CompletionCallback callback) { + DCHECK(callback); + std::move(callback).Run(result_holder_); +} + +bool FakePsmRlweDmserverClient::IsCheckMembershipInProgress() const { + return false; +} + +void FakePsmRlweDmserverClient::WillReplyWith(ResultHolder new_result_holder) { + result_holder_ = std::move(new_result_holder); +} + +} // namespace policy
diff --git a/chrome/browser/ash/policy/enrollment/private_membership/fake_psm_rlwe_dmserver_client.h b/chrome/browser/ash/policy/enrollment/private_membership/fake_psm_rlwe_dmserver_client.h new file mode 100644 index 0000000..cb6d9d3 --- /dev/null +++ b/chrome/browser/ash/policy/enrollment/private_membership/fake_psm_rlwe_dmserver_client.h
@@ -0,0 +1,39 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_POLICY_ENROLLMENT_PRIVATE_MEMBERSHIP_FAKE_PSM_RLWE_DMSERVER_CLIENT_H_ +#define CHROME_BROWSER_ASH_POLICY_ENROLLMENT_PRIVATE_MEMBERSHIP_FAKE_PSM_RLWE_DMSERVER_CLIENT_H_ + +#include "chrome/browser/ash/policy/enrollment/private_membership/psm_rlwe_dmserver_client.h" + +namespace policy { + +class FakePsmRlweDmserverClient : public PsmRlweDmserverClient { + public: + FakePsmRlweDmserverClient(); + + // Disallow copy constructor and assignment operator. + FakePsmRlweDmserverClient(const FakePsmRlweDmserverClient&) = delete; + FakePsmRlweDmserverClient& operator=(const FakePsmRlweDmserverClient&) = + delete; + + ~FakePsmRlweDmserverClient() override = default; + + // Executes the `callback` immediately with `completion_params_`; + void CheckMembership(CompletionCallback callback) override; + + // Always returns false. + bool IsCheckMembershipInProgress() const override; + + // Overrides the `result_holder_` values. + void WillReplyWith(ResultHolder new_result_holder); + + private: + // Final PSM result that is used for tests. + ResultHolder result_holder_; +}; + +} // namespace policy + +#endif // CHROME_BROWSER_ASH_POLICY_ENROLLMENT_PRIVATE_MEMBERSHIP_FAKE_PSM_RLWE_DMSERVER_CLIENT_H_
diff --git a/chrome/browser/ash/system_extensions/BUILD.gn b/chrome/browser/ash/system_extensions/BUILD.gn index 69c19f7..8c9235fe 100644 --- a/chrome/browser/ash/system_extensions/BUILD.gn +++ b/chrome/browser/ash/system_extensions/BUILD.gn
@@ -6,14 +6,6 @@ assert(is_chromeos_ash) -group("system_extensions_group") { - # Enable the "exit_time_destructors" warning here to avoid accidentally - # adding exit time destructors and because the flag is not enabled by default. - # TODO(http://crbug.com/101600): Remove once exit_time_destructors is enabled - # by default. - public_configs = [ "//build/config/compiler:wexit_time_destructors" ] -} - source_set("system_extensions") { sources = [ "system_extension.cc", @@ -37,8 +29,14 @@ "system_extensions_webui_config.cc", "system_extensions_webui_config.h", ] + + # Enable the "exit_time_destructors" warning here to avoid accidentally + # adding exit time destructors and because the flag is not enabled by default. + # TODO(http://crbug.com/101600): Remove once exit_time_destructors is enabled + # by default. + configs += [ "//build/config/compiler:wexit_time_destructors" ] + deps = [ - ":system_extensions_group", "//ash/constants", "//ash/webui/system_extensions_internals_ui/mojom", "//base",
diff --git a/chrome/browser/ash/system_extensions/api/window_management/BUILD.gn b/chrome/browser/ash/system_extensions/api/window_management/BUILD.gn index 5beceec..8377bcc 100644 --- a/chrome/browser/ash/system_extensions/api/window_management/BUILD.gn +++ b/chrome/browser/ash/system_extensions/api/window_management/BUILD.gn
@@ -11,9 +11,15 @@ "window_management_impl.cc", "window_management_impl.h", ] + + # Enable the "exit_time_destructors" warning here to avoid accidentally + # adding exit time destructors and because the flag is not enabled by default. + # TODO(http://crbug.com/101600): Remove once exit_time_destructors is enabled + # by default. + configs += [ "//build/config/compiler:wexit_time_destructors" ] + deps = [ "//ash", - "//chrome/browser/ash/system_extensions:system_extensions_group", "//chrome/browser/profiles:profile", "//components/services/app_service/public/cpp:instance_update", "//components/services/app_service/public/mojom",
diff --git a/chrome/browser/ash/system_logs/debug_daemon_log_source.cc b/chrome/browser/ash/system_logs/debug_daemon_log_source.cc index 4d856c7e..6c95910 100644 --- a/chrome/browser/ash/system_logs/debug_daemon_log_source.cc +++ b/chrome/browser/ash/system_logs/debug_daemon_log_source.cc
@@ -113,11 +113,13 @@ client->GetRoutes(true, // Numeric false, // No IPv6 + false, // All tables option disabled base::BindOnce(&DebugDaemonLogSource::OnGetRoutes, weak_ptr_factory_.GetWeakPtr(), false)); ++num_pending_requests_; - client->GetRoutes(true, // Numeric - true, // with IPv6 + client->GetRoutes(true, // Numeric + true, // with IPv6 + false, // All tables option disabled base::BindOnce(&DebugDaemonLogSource::OnGetRoutes, weak_ptr_factory_.GetWeakPtr(), true)); ++num_pending_requests_;
diff --git a/chrome/browser/ash/system_logs/debug_log_writer.cc b/chrome/browser/ash/system_logs/debug_log_writer.cc index c19f922..4b66d5b 100644 --- a/chrome/browser/ash/system_logs/debug_log_writer.cc +++ b/chrome/browser/ash/system_logs/debug_log_writer.cc
@@ -52,9 +52,12 @@ bool succeeded) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!succeeded) { - bool posted = g_sequenced_task_runner.Get()->PostTaskAndReply( - FROM_HERE, base::GetDeleteFileCallback(file_path), - base::BindOnce(std::move(callback), absl::nullopt)); + bool posted = g_sequenced_task_runner.Get()->PostTask( + FROM_HERE, + base::GetDeleteFileCallback( + file_path, + base::OnceCallback<void(bool)>(base::DoNothing()) + .Then(base::BindOnce(std::move(callback), absl::nullopt)))); DCHECK(posted); return; }
diff --git a/chrome/browser/ash/system_web_apps/types/BUILD.gn b/chrome/browser/ash/system_web_apps/types/BUILD.gn new file mode 100644 index 0000000..982ccdc1 --- /dev/null +++ b/chrome/browser/ash/system_web_apps/types/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. + +import("//chrome/browser/buildflags.gni") + +# TODO(crbug.com/1321984): Make SystemWebAppManager an ash-only object and +# move all the GN dependees under `if (is_chromeos_ash)` section. +# assert(is_chromeos_ash) + +source_set("types") { + sources = [ + "system_web_app_background_task_info.cc", + "system_web_app_background_task_info.h", + "system_web_app_delegate.cc", + "system_web_app_delegate.h", + "system_web_app_delegate_map.cc", + "system_web_app_delegate_map.h", + "system_web_app_type.h", + ] + + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + deps = [ + "//base", + "//chrome/common", + "//ui/base", + "//url", + ] +}
diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc index 53a5f1a..2b3e10ea 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
@@ -51,6 +51,7 @@ #include "media/base/media_switches.h" #include "media/mojo/mojom/media_types.mojom.h" #include "media/mojo/services/video_decode_perf_history.h" +#include "media/mojo/services/webrtc_video_perf_history.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" @@ -539,6 +540,72 @@ EXPECT_TRUE(is_power_efficient); } +// Verify WebrtcVideoPerfHistory is cleared when deleting all history from +// beginning of time. +IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, WebrtcVideoPerfHistory) { + media::WebrtcVideoPerfHistory* webrtc_video_perf_history = + GetBrowser()->profile()->GetWebrtcVideoPerfHistory(); + + // Save a video decode record. Note: we avoid using a web page to generate the + // stats as this takes at least 5 seconds and even then is not a guarantee + // depending on scheduler. Manual injection is quick and non-flaky. + const media::VideoCodecProfile kProfile = media::VP9PROFILE_PROFILE0; + const int kVideoPixels = 1920 * 1080; + const int kFrameRate = 30; + + const int kFramesProcessed = 1000; + const int kKeyFramesProcessed = 11; + const float kP99ProcessingTimeMs = 100.0; + + media::mojom::WebrtcPredictionFeatures features; + features.is_decode_stats = true; + features.profile = kProfile; + features.video_pixels = kVideoPixels; + features.hardware_accelerated = false; + + media::mojom::WebrtcVideoStats video_stats; + video_stats.frames_processed = kFramesProcessed; + video_stats.key_frames_processed = kKeyFramesProcessed; + video_stats.p99_processing_time_ms = kP99ProcessingTimeMs; + + { + base::RunLoop run_loop; + webrtc_video_perf_history->GetSaveCallback().Run(features, video_stats, + run_loop.QuitClosure()); + run_loop.Run(); + } + + // Verify history exists. + // Expect |is_smooth| = false given that the 99th percentile processing time + // is 100 ms. + { + base::RunLoop run_loop; + webrtc_video_perf_history->GetPerfInfo( + media::mojom::WebrtcPredictionFeatures::New(features), kFrameRate, + base::BindLambdaForTesting([&](bool smooth) { + EXPECT_FALSE(smooth); + run_loop.Quit(); + })); + run_loop.Run(); + } + + // Clear history. + RemoveAndWait(chrome_browsing_data_remover::DATA_TYPE_HISTORY); + + // Verify history no longer exists. |is_smooth| should now report true because + // the WebrtcVideoPerfHistory optimistically returns true when it has no data. + { + base::RunLoop run_loop; + webrtc_video_perf_history->GetPerfInfo( + media::mojom::WebrtcPredictionFeatures::New(features), kFrameRate, + base::BindLambdaForTesting([&](bool smooth) { + EXPECT_TRUE(smooth); + run_loop.Quit(); + })); + run_loop.Run(); + } +} + // Verify can modify database after deleting it. IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Database) { GURL url = embedded_test_server()->GetURL("/simple_database.html");
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc index 69190e4..9d105b7 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
@@ -134,6 +134,7 @@ #include "google_apis/gaia/gaia_urls.h" #include "media/base/media_switches.h" #include "media/mojo/services/video_decode_perf_history.h" +#include "media/mojo/services/webrtc_video_perf_history.h" #include "mojo/public/cpp/bindings/callback_helpers.h" #include "mojo/public/cpp/bindings/remote.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" @@ -555,10 +556,10 @@ : filter_builder->BuildPluginFilter()); } - // Clear VideoDecodePerfHistory only if asked to clear from the beginning of - // time. The perf history is a simple summing of decode statistics with no - // record of when the stats were written nor what site the video was played - // on. + // Clear VideoDecodePerfHistory and WebrtcVideoPerfHistory only if asked to + // clear from the beginning of time. The perf history is a simple summing of + // decode/encode statistics with no record of when the stats were written + // nor what site the video was played on. if (IsForAllTime()) { // TODO(chcunningham): Add UMA to track how often this gets deleted. media::VideoDecodePerfHistory* video_decode_perf_history = @@ -567,6 +568,13 @@ video_decode_perf_history->ClearHistory( CreateTaskCompletionClosure(TracingDataType::kVideoDecodeHistory)); } + + media::WebrtcVideoPerfHistory* webrtc_video_perf_history = + profile_->GetWebrtcVideoPerfHistory(); + if (webrtc_video_perf_history) { + webrtc_video_perf_history->ClearHistory(CreateTaskCompletionClosure( + TracingDataType::kWebrtcVideoPerfHistory)); + } } device_event_log::Clear(delete_begin_, delete_end_); @@ -1363,6 +1371,8 @@ return "WebAppHistory"; case TracingDataType::kWebAuthnCredentials: return "WebAuthnCredentials"; + case TracingDataType::kWebrtcVideoPerfHistory: + return "WebrtcVideoPerfHistory"; } }
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h index ac4143a..942e85a 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h
@@ -146,11 +146,12 @@ kSecurePaymentConfirmationCredentials = 41, kWebAppHistory = 42, kWebAuthnCredentials = 43, + kWebrtcVideoPerfHistory = 44, // Please update ChromeBrowsingDataRemoverTasks in enums.xml and // History.ClearBrowsingData.Duration.ChromeTask.{Task} // in histograms/metadata/history/histograms.xml when adding entries! - kMaxValue = kWebAuthnCredentials, + kMaxValue = kWebrtcVideoPerfHistory, }; // Returns the suffix for the
diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm index 341458a..0cb701b8 100644 --- a/chrome/browser/chrome_browser_main_mac.mm +++ b/chrome/browser/chrome_browser_main_mac.mm
@@ -56,7 +56,8 @@ StartupData* startup_data) : ChromeBrowserMainPartsPosix(is_integration_test, startup_data) {} -ChromeBrowserMainPartsMac::~ChromeBrowserMainPartsMac() = default; +ChromeBrowserMainPartsMac::~ChromeBrowserMainPartsMac() { +} int ChromeBrowserMainPartsMac::PreEarlyInitialization() { if (base::mac::WasLaunchedAsLoginItemRestoreState()) { @@ -68,6 +69,7 @@ base::CommandLine::ForCurrentProcess(); singleton_command_line->AppendSwitch(switches::kNoStartupWindow); } + return ChromeBrowserMainPartsPosix::PreEarlyInitialization(); }
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index dc6f7b0..600097b 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc
@@ -20,8 +20,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/command_line.h" -#include "base/dcheck_is_on.h" -#include "base/debug/handle_hooks_win.h" #include "base/enterprise_util.h" #include "base/environment.h" #include "base/feature_list.h" @@ -46,7 +44,6 @@ #include "base/win/windows_version.h" #include "base/win/wrapped_window_proc.h" #include "build/branding_buildflags.h" -#include "build/build_config.h" #include "chrome/browser/about_flags.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/enterprise/util/critical_policy_section_metrics_win.h" @@ -386,6 +383,74 @@ return true; } +// Used as the callback for ModuleWatcher events in this process. Dispatches +// them to the ModuleDatabase. +// Note: This callback may be invoked on any thread, even those not owned by the +// task scheduler, under the loader lock, directly on the thread where the +// DLL is currently loading. +void OnModuleEvent(const ModuleWatcher::ModuleEvent& event) { + { + TRACE_EVENT1("browser", "OnModuleEvent", "module_path", + event.module_path.BaseName().AsUTF8Unsafe()); + + switch (event.event_type) { + case ModuleWatcher::ModuleEventType::kModuleAlreadyLoaded: { + // kModuleAlreadyLoaded comes from the enumeration of loaded modules + // using CreateToolhelp32Snapshot(). + uint32_t time_date_stamp = 0; + if (TryGetModuleTimeDateStamp(event.module_load_address, + event.module_path, event.module_size, + &time_date_stamp)) { + ModuleDatabase::HandleModuleLoadEvent( + content::PROCESS_TYPE_BROWSER, event.module_path, + event.module_size, time_date_stamp); + } else { + // Failed to get the TimeDateStamp directly from memory. The next step + // to try is to read the file on disk. This must be done in a blocking + // task. + base::ThreadPool::PostTask( + FROM_HERE, + {base::MayBlock(), base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, + base::BindOnce(&HandleModuleLoadEventWithoutTimeDateStamp, + event.module_path, event.module_size)); + } + break; + } + case ModuleWatcher::ModuleEventType::kModuleLoaded: { + ModuleDatabase::HandleModuleLoadEvent( + content::PROCESS_TYPE_BROWSER, event.module_path, event.module_size, + GetModuleTimeDateStamp(event.module_load_address)); + break; + } + } + } + // Since OnModuleEvent can be invoked from any thread, the above trace event's + // END might be the last event on this thread, emit an empty event to force + // the END to be flushed. TODO(crbug.com/1021571): Remove this once fixed. + PERFETTO_INTERNAL_ADD_EMPTY_EVENT(); +} + +// Helper function for initializing the module database subsystem and populating +// the provided |module_watcher|. +void SetupModuleDatabase(std::unique_ptr<ModuleWatcher>* module_watcher) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK(module_watcher); + + bool third_party_blocking_policy_enabled = +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) + ModuleDatabase::IsThirdPartyBlockingPolicyEnabled(); +#else + false; +#endif + + ModuleDatabase::GetTaskRunner()->PostTask( + FROM_HERE, base::BindOnce(&InitializeModuleDatabase, + third_party_blocking_policy_enabled)); + + *module_watcher = ModuleWatcher::Create(base::BindRepeating(&OnModuleEvent)); +} + void ShowCloseBrowserFirstMessageBox() { chrome::ShowWarningMessageBox( nullptr, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), @@ -598,18 +663,6 @@ .get()); #endif -#if DCHECK_IS_ON() - // Patching EAT of kernel32.dll is only supported on 32-bit because RVA can - // only hold 32-bit values. -#if defined(ARCH_CPU_32_BITS) - base::debug::HandleHooks::AddEATPatch(); -#endif - // Patch currently loaded modules. Future ones will get patched by the module - // watcher. Note: if any modules load between now and when SetupModuleDatabase - // is called then these will be missed. - base::debug::HandleHooks::PatchLoadedModules(); -#endif // DCHECK_IS_ON() - // Create the module database and hook up the in-process module watcher. This // needs to be done before any child processes are initialized as the // ModuleDatabase is an endpoint for IPC from child processes. @@ -881,82 +934,3 @@ // duplicates, perhaps harmonize with switches::RemoveSwitchesForAutostart. return restart_command; } - -// Used as the callback for ModuleWatcher events in this process. Dispatches -// them to the ModuleDatabase. -// Note: This callback may be invoked on any thread, even those not owned by the -// task scheduler, under the loader lock, directly on the thread where the -// DLL is currently loading. -void ChromeBrowserMainPartsWin::OnModuleEvent( - const ModuleWatcher::ModuleEvent& event) { - { - TRACE_EVENT1("browser", "OnModuleEvent", "module_path", - event.module_path.BaseName().AsUTF8Unsafe()); - - switch (event.event_type) { - case ModuleWatcher::ModuleEventType::kModuleAlreadyLoaded: { - // kModuleAlreadyLoaded comes from the enumeration of loaded modules - // using CreateToolhelp32Snapshot(). - uint32_t time_date_stamp = 0; - if (TryGetModuleTimeDateStamp(event.module_load_address, - event.module_path, event.module_size, - &time_date_stamp)) { - ModuleDatabase::HandleModuleLoadEvent( - content::PROCESS_TYPE_BROWSER, event.module_path, - event.module_size, time_date_stamp); - } else { - // Failed to get the TimeDateStamp directly from memory. The next step - // to try is to read the file on disk. This must be done in a blocking - // task. - base::ThreadPool::PostTask( - FROM_HERE, - {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, - base::BindOnce(&HandleModuleLoadEventWithoutTimeDateStamp, - event.module_path, event.module_size)); - } - break; - } - case ModuleWatcher::ModuleEventType::kModuleLoaded: { -#if DCHECK_IS_ON() && defined(ARCH_CPU_64_BITS) - // This is only needed on 64-bit because on 32-bit the EAT from kernel32 - // is already patched. This is thread safe against itself as this is - // always called under loader lock. - HMODULE module = - reinterpret_cast<HMODULE>(event.module_load_address.get()); - base::debug::HandleHooks::AddIATPatch(module); -#endif // DCHECK_IS_ON() && defined(ARCH_CPU_64_BITS) - ModuleDatabase::HandleModuleLoadEvent( - content::PROCESS_TYPE_BROWSER, event.module_path, event.module_size, - GetModuleTimeDateStamp(event.module_load_address)); - break; - } - } - } - // Since OnModuleEvent can be invoked from any thread, the above trace event's - // END might be the last event on this thread, emit an empty event to force - // the END to be flushed. TODO(crbug.com/1021571): Remove this once fixed. - PERFETTO_INTERNAL_ADD_EMPTY_EVENT(); -} - -// Helper function for initializing the module database subsystem and populating -// the provided |module_watcher|. -void ChromeBrowserMainPartsWin::SetupModuleDatabase( - std::unique_ptr<ModuleWatcher>* module_watcher) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(module_watcher); - - bool third_party_blocking_policy_enabled = -#if BUILDFLAG(GOOGLE_CHROME_BRANDING) - ModuleDatabase::IsThirdPartyBlockingPolicyEnabled(); -#else - false; -#endif - - ModuleDatabase::GetTaskRunner()->PostTask( - FROM_HERE, base::BindOnce(&InitializeModuleDatabase, - third_party_blocking_policy_enabled)); - - *module_watcher = ModuleWatcher::Create(base::BindRepeating( - &ChromeBrowserMainPartsWin::OnModuleEvent, base::Unretained(this))); -}
diff --git a/chrome/browser/chrome_browser_main_win.h b/chrome/browser/chrome_browser_main_win.h index 87e802df..66bcce9 100644 --- a/chrome/browser/chrome_browser_main_win.h +++ b/chrome/browser/chrome_browser_main_win.h
@@ -10,7 +10,8 @@ #include <memory> #include "chrome/browser/chrome_browser_main.h" -#include "chrome/common/conflicts/module_watcher_win.h" + +class ModuleWatcher; namespace base { class CommandLine; @@ -76,9 +77,6 @@ const base::CommandLine& command_line); private: - void OnModuleEvent(const ModuleWatcher::ModuleEvent& event); - void SetupModuleDatabase(std::unique_ptr<ModuleWatcher>* module_watcher); - // Watches module load events and forwards them to the ModuleDatabase. std::unique_ptr<ModuleWatcher> module_watcher_; };
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 99660dd1..9afc02287 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -149,11 +149,6 @@ #include "chrome/browser/url_param_filter/url_param_filter_throttle.h" #include "chrome/browser/usb/frame_usb_services.h" #include "chrome/browser/vr/vr_tab_helper.h" -#include "chrome/browser/web_applications/policy/web_app_policy_manager.h" -#include "chrome/browser/web_applications/system_web_apps/system_web_app_manager.h" -#include "chrome/browser/web_applications/web_app_helpers.h" -#include "chrome/browser/web_applications/web_app_provider.h" -#include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/webapps/web_app_offline.h" #include "chrome/browser/webauthn/webauthn_pref_names.h" #include "chrome/common/buildflags.h" @@ -343,7 +338,6 @@ #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" -#include "chrome/browser/mac/chrome_browser_main_extra_parts_mac.h" #include "components/soda/constants.h" #include "sandbox/mac/seatbelt_exec.h" #include "sandbox/policy/mac/params.h" @@ -446,6 +440,11 @@ #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/search/new_tab_page_navigation_throttle.h" +#include "chrome/browser/web_applications/policy/web_app_policy_manager.h" +#include "chrome/browser/web_applications/system_web_apps/system_web_app_manager.h" +#include "chrome/browser/web_applications/web_app_helpers.h" +#include "chrome/browser/web_applications/web_app_provider.h" +#include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/webauthn/authenticator_request_scheduler.h" #include "chrome/browser/webauthn/chrome_authenticator_request_delegate.h" #include "chrome/grit/chrome_unscaled_resources.h" // nogncheck crbug.com/1125897 @@ -1454,10 +1453,6 @@ #endif #endif -#if BUILDFLAG(IS_MAC) - main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsMac>()); -#endif - #if BUILDFLAG(IS_CHROMEOS_ASH) // TODO(jamescook): Combine with `ChromeBrowserMainPartsAsh`. main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsAsh>());
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index f3d0bac9..e99953b4 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -206,6 +206,7 @@ "//chrome/browser/ash/crostini:crostini_installer_types_mojom", "//chrome/browser/ash/nearby:bluetooth_adapter_manager", "//chrome/browser/ash/power/ml/smart_dim", + "//chrome/browser/ash/system_web_apps/types:types", "//chrome/browser/ash/wilco_dtc_supportd:mojo_utils", "//chrome/browser/browsing_data:constants", "//chrome/browser/devtools", @@ -582,368 +583,6 @@ ] sources = [ - "../ash/arc/accessibility/accessibility_helper_instance_remote_proxy.cc", - "../ash/arc/accessibility/accessibility_helper_instance_remote_proxy.h", - "../ash/arc/accessibility/accessibility_info_data_wrapper.cc", - "../ash/arc/accessibility/accessibility_info_data_wrapper.h", - "../ash/arc/accessibility/accessibility_node_info_data_wrapper.cc", - "../ash/arc/accessibility/accessibility_node_info_data_wrapper.h", - "../ash/arc/accessibility/accessibility_window_info_data_wrapper.cc", - "../ash/arc/accessibility/accessibility_window_info_data_wrapper.h", - "../ash/arc/accessibility/arc_accessibility_helper_bridge.cc", - "../ash/arc/accessibility/arc_accessibility_helper_bridge.h", - "../ash/arc/accessibility/arc_accessibility_tree_tracker.cc", - "../ash/arc/accessibility/arc_accessibility_tree_tracker.h", - "../ash/arc/accessibility/arc_accessibility_util.cc", - "../ash/arc/accessibility/arc_accessibility_util.h", - "../ash/arc/accessibility/auto_complete_handler.cc", - "../ash/arc/accessibility/auto_complete_handler.h", - "../ash/arc/accessibility/ax_tree_source_arc.cc", - "../ash/arc/accessibility/ax_tree_source_arc.h", - "../ash/arc/accessibility/drawer_layout_handler.cc", - "../ash/arc/accessibility/drawer_layout_handler.h", - "../ash/arc/accessibility/geometry_util.cc", - "../ash/arc/accessibility/geometry_util.h", - "../ash/arc/adbd/arc_adbd_monitor_bridge.cc", - "../ash/arc/adbd/arc_adbd_monitor_bridge.h", - "../ash/arc/app_shortcuts/arc_app_shortcuts_menu_builder.cc", - "../ash/arc/app_shortcuts/arc_app_shortcuts_menu_builder.h", - "../ash/arc/app_shortcuts/arc_app_shortcuts_request.cc", - "../ash/arc/app_shortcuts/arc_app_shortcuts_request.h", - "../ash/arc/arc_demo_mode_delegate_impl.cc", - "../ash/arc/arc_demo_mode_delegate_impl.h", - "../ash/arc/arc_migration_constants.h", - "../ash/arc/arc_migration_guide_notification.cc", - "../ash/arc/arc_migration_guide_notification.h", - "../ash/arc/arc_optin_uma.cc", - "../ash/arc/arc_optin_uma.h", - "../ash/arc/arc_support_host.cc", - "../ash/arc/arc_support_host.h", - "../ash/arc/arc_ui_availability_reporter.cc", - "../ash/arc/arc_ui_availability_reporter.h", - "../ash/arc/arc_util.cc", - "../ash/arc/arc_util.h", - "../ash/arc/auth/arc_active_directory_enrollment_token_fetcher.cc", - "../ash/arc/auth/arc_active_directory_enrollment_token_fetcher.h", - "../ash/arc/auth/arc_auth_code_fetcher.h", - "../ash/arc/auth/arc_auth_context.cc", - "../ash/arc/auth/arc_auth_context.h", - "../ash/arc/auth/arc_auth_service.cc", - "../ash/arc/auth/arc_auth_service.h", - "../ash/arc/auth/arc_background_auth_code_fetcher.cc", - "../ash/arc/auth/arc_background_auth_code_fetcher.h", - "../ash/arc/auth/arc_fetcher_base.cc", - "../ash/arc/auth/arc_fetcher_base.h", - "../ash/arc/auth/arc_robot_auth_code_fetcher.cc", - "../ash/arc/auth/arc_robot_auth_code_fetcher.h", - "../ash/arc/bluetooth/arc_bluetooth_bridge.cc", - "../ash/arc/bluetooth/arc_bluetooth_bridge.h", - "../ash/arc/bluetooth/arc_bluetooth_task_queue.cc", - "../ash/arc/bluetooth/arc_bluetooth_task_queue.h", - "../ash/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.cc", - "../ash/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h", - "../ash/arc/enterprise/arc_data_snapshotd_delegate.cc", - "../ash/arc/enterprise/arc_data_snapshotd_delegate.h", - "../ash/arc/enterprise/arc_enterprise_reporting_service.cc", - "../ash/arc/enterprise/arc_enterprise_reporting_service.h", - "../ash/arc/enterprise/arc_force_installed_apps_tracker.cc", - "../ash/arc/enterprise/arc_force_installed_apps_tracker.h", - "../ash/arc/enterprise/arc_snapshot_reboot_notification_impl.cc", - "../ash/arc/enterprise/arc_snapshot_reboot_notification_impl.h", - "../ash/arc/enterprise/cert_store/arc_cert_installer.cc", - "../ash/arc/enterprise/cert_store/arc_cert_installer.h", - "../ash/arc/enterprise/cert_store/arc_cert_installer_utils.cc", - "../ash/arc/enterprise/cert_store/arc_cert_installer_utils.h", - "../ash/arc/enterprise/cert_store/cert_store_service.cc", - "../ash/arc/enterprise/cert_store/cert_store_service.h", - "../ash/arc/extensions/arc_support_message_host.cc", - "../ash/arc/extensions/arc_support_message_host.h", - "../ash/arc/file_system_watcher/arc_file_system_watcher_service.cc", - "../ash/arc/file_system_watcher/arc_file_system_watcher_service.h", - "../ash/arc/file_system_watcher/arc_file_system_watcher_util.cc", - "../ash/arc/file_system_watcher/arc_file_system_watcher_util.h", - "../ash/arc/file_system_watcher/file_system_scanner.cc", - "../ash/arc/file_system_watcher/file_system_scanner.h", - "../ash/arc/fileapi/arc_content_file_system_async_file_util.cc", - "../ash/arc/fileapi/arc_content_file_system_async_file_util.h", - "../ash/arc/fileapi/arc_content_file_system_backend_delegate.cc", - "../ash/arc/fileapi/arc_content_file_system_backend_delegate.h", - "../ash/arc/fileapi/arc_content_file_system_file_stream_reader.cc", - "../ash/arc/fileapi/arc_content_file_system_file_stream_reader.h", - "../ash/arc/fileapi/arc_content_file_system_file_stream_writer.cc", - "../ash/arc/fileapi/arc_content_file_system_file_stream_writer.h", - "../ash/arc/fileapi/arc_content_file_system_size_util.cc", - "../ash/arc/fileapi/arc_content_file_system_size_util.h", - "../ash/arc/fileapi/arc_content_file_system_url_util.cc", - "../ash/arc/fileapi/arc_content_file_system_url_util.h", - "../ash/arc/fileapi/arc_documents_provider_async_file_util.cc", - "../ash/arc/fileapi/arc_documents_provider_async_file_util.h", - "../ash/arc/fileapi/arc_documents_provider_backend_delegate.cc", - "../ash/arc/fileapi/arc_documents_provider_backend_delegate.h", - "../ash/arc/fileapi/arc_documents_provider_file_stream_reader.cc", - "../ash/arc/fileapi/arc_documents_provider_file_stream_reader.h", - "../ash/arc/fileapi/arc_documents_provider_file_stream_writer.cc", - "../ash/arc/fileapi/arc_documents_provider_file_stream_writer.h", - "../ash/arc/fileapi/arc_documents_provider_file_system_url_util.cc", - "../ash/arc/fileapi/arc_documents_provider_file_system_url_util.h", - "../ash/arc/fileapi/arc_documents_provider_root.cc", - "../ash/arc/fileapi/arc_documents_provider_root.h", - "../ash/arc/fileapi/arc_documents_provider_root_map.cc", - "../ash/arc/fileapi/arc_documents_provider_root_map.h", - "../ash/arc/fileapi/arc_documents_provider_root_map_factory.cc", - "../ash/arc/fileapi/arc_documents_provider_root_map_factory.h", - "../ash/arc/fileapi/arc_documents_provider_util.cc", - "../ash/arc/fileapi/arc_documents_provider_util.h", - "../ash/arc/fileapi/arc_documents_provider_watcher_manager.cc", - "../ash/arc/fileapi/arc_documents_provider_watcher_manager.h", - "../ash/arc/fileapi/arc_file_system_bridge.cc", - "../ash/arc/fileapi/arc_file_system_bridge.h", - "../ash/arc/fileapi/arc_file_system_mounter.cc", - "../ash/arc/fileapi/arc_file_system_mounter.h", - "../ash/arc/fileapi/arc_file_system_operation_runner.cc", - "../ash/arc/fileapi/arc_file_system_operation_runner.h", - "../ash/arc/fileapi/arc_file_system_operation_runner_util.cc", - "../ash/arc/fileapi/arc_file_system_operation_runner_util.h", - "../ash/arc/fileapi/arc_media_view_util.cc", - "../ash/arc/fileapi/arc_media_view_util.h", - "../ash/arc/fileapi/arc_select_files_handler.cc", - "../ash/arc/fileapi/arc_select_files_handler.h", - "../ash/arc/fileapi/arc_select_files_util.cc", - "../ash/arc/fileapi/arc_select_files_util.h", - "../ash/arc/fileapi/chrome_content_provider_url_util.cc", - "../ash/arc/fileapi/chrome_content_provider_url_util.h", - "../ash/arc/fileapi/file_stream_forwarder.cc", - "../ash/arc/fileapi/file_stream_forwarder.h", - "../ash/arc/input_method_manager/arc_input_method_manager_bridge.h", - "../ash/arc/input_method_manager/arc_input_method_manager_bridge_impl.cc", - "../ash/arc/input_method_manager/arc_input_method_manager_bridge_impl.h", - "../ash/arc/input_method_manager/arc_input_method_manager_service.cc", - "../ash/arc/input_method_manager/arc_input_method_manager_service.h", - "../ash/arc/input_method_manager/arc_input_method_state.cc", - "../ash/arc/input_method_manager/arc_input_method_state.h", - "../ash/arc/input_method_manager/input_connection_impl.cc", - "../ash/arc/input_method_manager/input_connection_impl.h", - "../ash/arc/input_method_manager/input_method_prefs.cc", - "../ash/arc/input_method_manager/input_method_prefs.h", - "../ash/arc/input_overlay/actions/action.cc", - "../ash/arc/input_overlay/actions/action.h", - "../ash/arc/input_overlay/actions/action_move.cc", - "../ash/arc/input_overlay/actions/action_move.h", - "../ash/arc/input_overlay/actions/action_tap.cc", - "../ash/arc/input_overlay/actions/action_tap.h", - "../ash/arc/input_overlay/actions/dependent_position.cc", - "../ash/arc/input_overlay/actions/dependent_position.h", - "../ash/arc/input_overlay/actions/input_element.cc", - "../ash/arc/input_overlay/actions/input_element.h", - "../ash/arc/input_overlay/actions/position.cc", - "../ash/arc/input_overlay/actions/position.h", - "../ash/arc/input_overlay/arc_input_overlay_manager.cc", - "../ash/arc/input_overlay/arc_input_overlay_manager.h", - "../ash/arc/input_overlay/arc_input_overlay_uma.cc", - "../ash/arc/input_overlay/arc_input_overlay_uma.h", - "../ash/arc/input_overlay/constants.h", - "../ash/arc/input_overlay/db/data_controller.cc", - "../ash/arc/input_overlay/db/data_controller.h", - "../ash/arc/input_overlay/display_overlay_controller.cc", - "../ash/arc/input_overlay/display_overlay_controller.h", - "../ash/arc/input_overlay/input_overlay_resources_util.cc", - "../ash/arc/input_overlay/input_overlay_resources_util.h", - "../ash/arc/input_overlay/key_event_source_rewriter.cc", - "../ash/arc/input_overlay/key_event_source_rewriter.h", - "../ash/arc/input_overlay/touch_id_manager.cc", - "../ash/arc/input_overlay/touch_id_manager.h", - "../ash/arc/input_overlay/touch_injector.cc", - "../ash/arc/input_overlay/touch_injector.h", - "../ash/arc/input_overlay/ui/action_circle.cc", - "../ash/arc/input_overlay/ui/action_circle.h", - "../ash/arc/input_overlay/ui/action_edit_button.cc", - "../ash/arc/input_overlay/ui/action_edit_button.h", - "../ash/arc/input_overlay/ui/action_edit_menu.cc", - "../ash/arc/input_overlay/ui/action_edit_menu.h", - "../ash/arc/input_overlay/ui/action_label.cc", - "../ash/arc/input_overlay/ui/action_label.h", - "../ash/arc/input_overlay/ui/action_tag.cc", - "../ash/arc/input_overlay/ui/action_tag.h", - "../ash/arc/input_overlay/ui/action_view.cc", - "../ash/arc/input_overlay/ui/action_view.h", - "../ash/arc/input_overlay/ui/edit_mode_exit_view.cc", - "../ash/arc/input_overlay/ui/edit_mode_exit_view.h", - "../ash/arc/input_overlay/ui/educational_view.cc", - "../ash/arc/input_overlay/ui/educational_view.h", - "../ash/arc/input_overlay/ui/error_view.cc", - "../ash/arc/input_overlay/ui/error_view.h", - "../ash/arc/input_overlay/ui/input_mapping_view.cc", - "../ash/arc/input_overlay/ui/input_mapping_view.h", - "../ash/arc/input_overlay/ui/input_menu_view.cc", - "../ash/arc/input_overlay/ui/input_menu_view.h", - "../ash/arc/instance_throttle/arc_active_window_throttle_observer.cc", - "../ash/arc/instance_throttle/arc_active_window_throttle_observer.h", - "../ash/arc/instance_throttle/arc_app_launch_throttle_observer.cc", - "../ash/arc/instance_throttle/arc_app_launch_throttle_observer.h", - "../ash/arc/instance_throttle/arc_boot_phase_throttle_observer.cc", - "../ash/arc/instance_throttle/arc_boot_phase_throttle_observer.h", - "../ash/arc/instance_throttle/arc_instance_throttle.cc", - "../ash/arc/instance_throttle/arc_instance_throttle.h", - "../ash/arc/instance_throttle/arc_kiosk_mode_throttle_observer.cc", - "../ash/arc/instance_throttle/arc_kiosk_mode_throttle_observer.h", - "../ash/arc/instance_throttle/arc_pip_window_throttle_observer.cc", - "../ash/arc/instance_throttle/arc_pip_window_throttle_observer.h", - "../ash/arc/instance_throttle/arc_power_throttle_observer.cc", - "../ash/arc/instance_throttle/arc_power_throttle_observer.h", - "../ash/arc/instance_throttle/arc_provisioning_throttle_observer.cc", - "../ash/arc/instance_throttle/arc_provisioning_throttle_observer.h", - "../ash/arc/instance_throttle/arc_switch_throttle_observer.cc", - "../ash/arc/instance_throttle/arc_switch_throttle_observer.h", - "../ash/arc/intent_helper/arc_intent_helper_mojo_ash.cc", - "../ash/arc/intent_helper/arc_intent_helper_mojo_ash.h", - "../ash/arc/intent_helper/arc_settings_service.cc", - "../ash/arc/intent_helper/arc_settings_service.h", - "../ash/arc/intent_helper/custom_tab_session_impl.cc", - "../ash/arc/intent_helper/custom_tab_session_impl.h", - "../ash/arc/intent_helper/factory_reset_delegate.cc", - "../ash/arc/intent_helper/factory_reset_delegate.h", - "../ash/arc/keymaster/arc_keymaster_bridge.cc", - "../ash/arc/keymaster/arc_keymaster_bridge.h", - "../ash/arc/keymaster/cert_store_bridge.cc", - "../ash/arc/keymaster/cert_store_bridge.h", - "../ash/arc/kiosk/arc_kiosk_bridge.cc", - "../ash/arc/kiosk/arc_kiosk_bridge.h", - "../ash/arc/metrics/arc_metrics_service_proxy.cc", - "../ash/arc/metrics/arc_metrics_service_proxy.h", - "../ash/arc/nearby_share/arc_nearby_share_bridge.cc", - "../ash/arc/nearby_share/arc_nearby_share_bridge.h", - "../ash/arc/nearby_share/arc_nearby_share_uma.cc", - "../ash/arc/nearby_share/arc_nearby_share_uma.h", - "../ash/arc/nearby_share/nearby_share_session_impl.cc", - "../ash/arc/nearby_share/nearby_share_session_impl.h", - "../ash/arc/nearby_share/share_info_file_handler.cc", - "../ash/arc/nearby_share/share_info_file_handler.h", - "../ash/arc/nearby_share/share_info_file_stream_adapter.cc", - "../ash/arc/nearby_share/share_info_file_stream_adapter.h", - "../ash/arc/nearby_share/ui/base_dialog_delegate_view.cc", - "../ash/arc/nearby_share/ui/base_dialog_delegate_view.h", - "../ash/arc/nearby_share/ui/error_dialog_view.cc", - "../ash/arc/nearby_share/ui/error_dialog_view.h", - "../ash/arc/nearby_share/ui/low_disk_space_dialog_view.cc", - "../ash/arc/nearby_share/ui/low_disk_space_dialog_view.h", - "../ash/arc/nearby_share/ui/nearby_share_overlay_view.cc", - "../ash/arc/nearby_share/ui/nearby_share_overlay_view.h", - "../ash/arc/nearby_share/ui/progress_bar_dialog_view.cc", - "../ash/arc/nearby_share/ui/progress_bar_dialog_view.h", - "../ash/arc/net/cert_manager_impl.cc", - "../ash/arc/net/cert_manager_impl.h", - "../ash/arc/notification/arc_boot_error_notification.cc", - "../ash/arc/notification/arc_boot_error_notification.h", - "../ash/arc/notification/arc_management_transition_notification.cc", - "../ash/arc/notification/arc_management_transition_notification.h", - "../ash/arc/notification/arc_provision_notification_service.cc", - "../ash/arc/notification/arc_provision_notification_service.h", - "../ash/arc/oemcrypto/arc_oemcrypto_bridge.cc", - "../ash/arc/oemcrypto/arc_oemcrypto_bridge.h", - "../ash/arc/optin/arc_optin_preference_handler.cc", - "../ash/arc/optin/arc_optin_preference_handler.h", - "../ash/arc/optin/arc_optin_preference_handler_observer.h", - "../ash/arc/optin/arc_terms_of_service_default_negotiator.cc", - "../ash/arc/optin/arc_terms_of_service_default_negotiator.h", - "../ash/arc/optin/arc_terms_of_service_negotiator.cc", - "../ash/arc/optin/arc_terms_of_service_negotiator.h", - "../ash/arc/optin/arc_terms_of_service_oobe_negotiator.cc", - "../ash/arc/optin/arc_terms_of_service_oobe_negotiator.h", - "../ash/arc/pip/arc_picture_in_picture_window_controller_impl.cc", - "../ash/arc/pip/arc_picture_in_picture_window_controller_impl.h", - "../ash/arc/pip/arc_pip_bridge.cc", - "../ash/arc/pip/arc_pip_bridge.h", - "../ash/arc/policy/arc_android_management_checker.cc", - "../ash/arc/policy/arc_android_management_checker.h", - "../ash/arc/policy/arc_policy_bridge.cc", - "../ash/arc/policy/arc_policy_bridge.h", - "../ash/arc/policy/arc_policy_handler.cc", - "../ash/arc/policy/arc_policy_handler.h", - "../ash/arc/policy/arc_policy_util.cc", - "../ash/arc/policy/arc_policy_util.h", - "../ash/arc/policy/managed_configuration_variables.cc", - "../ash/arc/policy/managed_configuration_variables.h", - "../ash/arc/print_spooler/arc_print_spooler_bridge.cc", - "../ash/arc/print_spooler/arc_print_spooler_bridge.h", - "../ash/arc/print_spooler/arc_print_spooler_util.cc", - "../ash/arc/print_spooler/arc_print_spooler_util.h", - "../ash/arc/print_spooler/print_session_impl.cc", - "../ash/arc/print_spooler/print_session_impl.h", - "../ash/arc/privacy_items/arc_privacy_items_bridge.cc", - "../ash/arc/privacy_items/arc_privacy_items_bridge.h", - "../ash/arc/process/arc_process.cc", - "../ash/arc/process/arc_process.h", - "../ash/arc/process/arc_process_service.cc", - "../ash/arc/process/arc_process_service.h", - "../ash/arc/screen_capture/arc_screen_capture_bridge.cc", - "../ash/arc/screen_capture/arc_screen_capture_bridge.h", - "../ash/arc/screen_capture/arc_screen_capture_session.cc", - "../ash/arc/screen_capture/arc_screen_capture_session.h", - "../ash/arc/session/adb_sideloading_availability_delegate_impl.cc", - "../ash/arc/session/adb_sideloading_availability_delegate_impl.h", - "../ash/arc/session/arc_app_id_provider_impl.cc", - "../ash/arc/session/arc_app_id_provider_impl.h", - "../ash/arc/session/arc_demo_mode_preference_handler.cc", - "../ash/arc/session/arc_demo_mode_preference_handler.h", - "../ash/arc/session/arc_play_store_enabled_preference_handler.cc", - "../ash/arc/session/arc_play_store_enabled_preference_handler.h", - "../ash/arc/session/arc_provisioning_result.cc", - "../ash/arc/session/arc_provisioning_result.h", - "../ash/arc/session/arc_service_launcher.cc", - "../ash/arc/session/arc_service_launcher.h", - "../ash/arc/session/arc_session_manager.cc", - "../ash/arc/session/arc_session_manager.h", - "../ash/arc/session/arc_session_manager_observer.h", - "../ash/arc/sharesheet/arc_sharesheet_bridge.cc", - "../ash/arc/sharesheet/arc_sharesheet_bridge.h", - "../ash/arc/survey/arc_survey_service.cc", - "../ash/arc/survey/arc_survey_service.h", - "../ash/arc/tracing/arc_app_performance_tracing.cc", - "../ash/arc/tracing/arc_app_performance_tracing.h", - "../ash/arc/tracing/arc_app_performance_tracing_custom_session.cc", - "../ash/arc/tracing/arc_app_performance_tracing_custom_session.h", - "../ash/arc/tracing/arc_app_performance_tracing_session.cc", - "../ash/arc/tracing/arc_app_performance_tracing_session.h", - "../ash/arc/tracing/arc_app_performance_tracing_uma_session.cc", - "../ash/arc/tracing/arc_app_performance_tracing_uma_session.h", - "../ash/arc/tracing/arc_cpu_event.cc", - "../ash/arc/tracing/arc_cpu_event.h", - "../ash/arc/tracing/arc_graphics_jank_detector.cc", - "../ash/arc/tracing/arc_graphics_jank_detector.h", - "../ash/arc/tracing/arc_system_model.cc", - "../ash/arc/tracing/arc_system_model.h", - "../ash/arc/tracing/arc_system_stat_collector.cc", - "../ash/arc/tracing/arc_system_stat_collector.h", - "../ash/arc/tracing/arc_tracing_bridge.cc", - "../ash/arc/tracing/arc_tracing_bridge.h", - "../ash/arc/tracing/arc_tracing_event.cc", - "../ash/arc/tracing/arc_tracing_event.h", - "../ash/arc/tracing/arc_tracing_event_matcher.cc", - "../ash/arc/tracing/arc_tracing_event_matcher.h", - "../ash/arc/tracing/arc_tracing_graphics_model.cc", - "../ash/arc/tracing/arc_tracing_graphics_model.h", - "../ash/arc/tracing/arc_tracing_model.cc", - "../ash/arc/tracing/arc_tracing_model.h", - "../ash/arc/tracing/arc_value_event.cc", - "../ash/arc/tracing/arc_value_event.h", - "../ash/arc/tracing/arc_value_event_trimmer.cc", - "../ash/arc/tracing/arc_value_event_trimmer.h", - "../ash/arc/tts/arc_tts_service.cc", - "../ash/arc/tts/arc_tts_service.h", - "../ash/arc/usb/arc_usb_host_bridge_delegate.cc", - "../ash/arc/usb/arc_usb_host_bridge_delegate.h", - "../ash/arc/user_session/arc_user_session_service.cc", - "../ash/arc/user_session/arc_user_session_service.h", - "../ash/arc/video/gpu_arc_video_service_host.cc", - "../ash/arc/video/gpu_arc_video_service_host.h", - "../ash/arc/wallpaper/arc_wallpaper_service.cc", - "../ash/arc/wallpaper/arc_wallpaper_service.h", - "../ash/arc/window_predictor/arc_predictor_app_launch_handler.cc", - "../ash/arc/window_predictor/arc_predictor_app_launch_handler.h", - "../ash/arc/window_predictor/window_predictor.cc", - "../ash/arc/window_predictor/window_predictor.h", - "../ash/arc/window_predictor/window_predictor_utils.cc", - "../ash/arc/window_predictor/window_predictor_utils.h", "../ash/assistant/assistant_util.cc", "../ash/assistant/assistant_util.h", "../ash/attestation/attestation_ca_client.cc", @@ -2483,6 +2122,8 @@ "../ash/policy/enrollment/fake_auto_enrollment_client.h", "../ash/policy/enrollment/private_membership/fake_private_membership_rlwe_client.cc", "../ash/policy/enrollment/private_membership/fake_private_membership_rlwe_client.h", + "../ash/policy/enrollment/private_membership/fake_psm_rlwe_dmserver_client.cc", + "../ash/policy/enrollment/private_membership/fake_psm_rlwe_dmserver_client.h", "../ash/policy/enrollment/private_membership/private_membership_rlwe_client.h", "../ash/policy/enrollment/private_membership/private_membership_rlwe_client_impl.cc", "../ash/policy/enrollment/private_membership/private_membership_rlwe_client_impl.h", @@ -3702,23 +3343,6 @@ args += rebase_path(sources, root_build_dir) } -static_library("arc_test_support") { - testonly = true - - sources = [ - "../ash/arc/test/arc_data_removed_waiter.cc", - "../ash/arc/test/arc_data_removed_waiter.h", - "../ash/arc/test/test_arc_session_manager.cc", - "../ash/arc/test/test_arc_session_manager.h", - ] - - deps = [ - ":chromeos", - "//base", - "//dbus", - ] -} - static_library("user_event_reporter_helper_test_support") { testonly = true @@ -4819,7 +4443,6 @@ public_deps = [ ":chromeos" ] deps = [ - ":arc_test_support", ":attestation_proto", ":test_support", ":user_activity_event_proto", @@ -4859,6 +4482,7 @@ "//base", "//build:chromeos_buildflags", "//chrome/app:command_ids", + "//chrome/browser/ash:arc_test_support", "//chrome/browser/ash/crosapi:unit_tests", "//chrome/browser/ui", "//chrome/browser/ui:ash_test_support",
diff --git a/chrome/browser/chromeos/fileapi/recent_drive_source.cc b/chrome/browser/chromeos/fileapi/recent_drive_source.cc index ccd7df2..5265601b 100644 --- a/chrome/browser/chromeos/fileapi/recent_drive_source.cc +++ b/chrome/browser/chromeos/fileapi/recent_drive_source.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/fileapi/recent_drive_source.h" +#include <iterator> #include <utility> #include <vector> @@ -21,6 +22,7 @@ #include "storage/browser/file_system/file_system_operation_runner.h" #include "storage/browser/file_system/file_system_url.h" #include "storage/common/file_system/file_system_types.h" +#include "ui/file_manager/file_types_data.h" #include "url/origin.h" using content::BrowserThread; @@ -78,6 +80,14 @@ case FileType::kVideo: query_params->mime_type = kVideoMimeType; break; + case FileType::kDocument: { + std::vector<std::string> doc_mime_types{ + std::make_move_iterator(file_types_data::kDocumentMIMETypes.begin()), + std::make_move_iterator(file_types_data::kDocumentMIMETypes.end()), + }; + query_params->mime_types = std::move(doc_mime_types); + break; + } default: // Leave the mime_type null to query all files. break;
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc index 11e309631..8ac904a0 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
@@ -480,6 +480,7 @@ ->AddPassword(parameters->options.url, base::UTF8ToUTF16(parameters->options.username), base::UTF8ToUTF16(parameters->options.password), + base::UTF8ToUTF16(parameters->options.note), parameters->options.use_account_store, GetSenderWebContents())) { return RespondNow(Error(
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h index f1dbbc4d..6fc2e97c4 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
@@ -79,6 +79,7 @@ virtual bool AddPassword(const std::string& url, const std::u16string& username, const std::u16string& password, + const std::u16string& note, bool use_account_store, content::WebContents* web_contents) = 0;
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc index e1c9c22..c3c2f8e 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -234,6 +234,7 @@ const std::string& url, const std::u16string& username, const std::u16string& password, + const std::u16string& note, bool use_account_store, content::WebContents* web_contents) { password_manager::PasswordForm form; @@ -242,6 +243,8 @@ form.signon_realm = password_manager::GetSignonRealm(form.url); form.username_value = username; form.password_value = password; + form.note.value = note; + form.note.date_created = base::Time::Now(); form.in_store = use_account_store ? password_manager::PasswordForm::Store::kAccountStore : password_manager::PasswordForm::Store::kProfileStore;
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h index a5cba18..733f584 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
@@ -60,6 +60,7 @@ bool AddPassword(const std::string& url, const std::u16string& username, const std::u16string& password, + const std::u16string& note, bool use_account_store, content::WebContents* web_contents) override; bool ChangeSavedPassword(
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc index 3e070f49..1295550 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc
@@ -173,6 +173,7 @@ MATCHER_P(PasswordUiEntryDataEquals, expected, "") { return testing::Value(expected.get().urls.link, arg.urls.link) && testing::Value(expected.get().username, arg.username) && + testing::Value(expected.get().password_note, arg.password_note) && testing::Value(expected.get().from_account_store, arg.from_account_store); } @@ -359,13 +360,14 @@ EXPECT_CALL(callback, Run(SizeIs(0))); delegate.GetSavedPasswordsList(callback.Get()); - EXPECT_TRUE(delegate.AddPassword("example1.com", u"username1", u"password1", - /*use_account_store=*/true, - web_contents.get())); - EXPECT_TRUE(delegate.AddPassword("http://example2.com/login?param=value", - /*username=*/u"", u"password2", - /*use_account_store=*/false, - web_contents.get())); + EXPECT_TRUE( + delegate.AddPassword(/*url=*/"example1.com", /*username=*/u"username1", + /*password=*/u"password1", /*note=*/u"", + /*use_account_store=*/true, web_contents.get())); + EXPECT_TRUE(delegate.AddPassword( + /*url=*/"http://example2.com/login?param=value", + /*username=*/u"", /*password=*/u"password2", /*note=*/u"note", + /*use_account_store=*/false, web_contents.get())); // Spin the loop to allow PasswordStore tasks posted when adding the // password to be completed. base::RunLoop().RunUntilIdle(); @@ -374,10 +376,12 @@ api::passwords_private::PasswordUiEntry expected_entry1; expected_entry1.urls.link = "https://example1.com/"; expected_entry1.username = "username1"; + expected_entry1.password_note = ""; expected_entry1.from_account_store = true; api::passwords_private::PasswordUiEntry expected_entry2; expected_entry2.urls.link = "http://example2.com/login"; expected_entry2.username = ""; + expected_entry2.password_note = "note"; expected_entry2.from_account_store = false; EXPECT_CALL(callback, Run(testing::UnorderedElementsAre( @@ -400,9 +404,9 @@ .WillByDefault(Return(false)); EXPECT_CALL(*(client->GetPasswordFeatureManager()), SetDefaultPasswordStore) .Times(0); - EXPECT_TRUE(delegate.AddPassword("example1.com", u"username1", u"password1", - /*use_account_store=*/false, - web_contents.get())); + EXPECT_TRUE( + delegate.AddPassword("example1.com", u"username1", u"password1", u"", + /*use_account_store=*/false, web_contents.get())); // Updates the default store if opted-in and operation succeeded. ON_CALL(*(client->GetPasswordFeatureManager()), IsOptedInForAccountStorage) @@ -410,14 +414,14 @@ EXPECT_CALL(*(client->GetPasswordFeatureManager()), SetDefaultPasswordStore( password_manager::PasswordForm::Store::kAccountStore)); - EXPECT_TRUE(delegate.AddPassword("example2.com", u"username2", u"password2", - /*use_account_store=*/true, - web_contents.get())); + EXPECT_TRUE( + delegate.AddPassword("example2.com", u"username2", u"password2", u"", + /*use_account_store=*/true, web_contents.get())); // NOT update default store if opted-in, but operation failed. EXPECT_CALL(*(client->GetPasswordFeatureManager()), SetDefaultPasswordStore) .Times(0); - EXPECT_FALSE(delegate.AddPassword("", u"", u"", + EXPECT_FALSE(delegate.AddPassword("", u"", u"", u"", /*use_account_store=*/false, web_contents.get())); }
diff --git a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc index 263ccb50..5ec8dfb 100644 --- a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc +++ b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc
@@ -82,6 +82,7 @@ const std::string& url, const std::u16string& username, const std::u16string& password, + const std::u16string& note, bool use_account_store, content::WebContents* web_contents) { return !url.empty() && !password.empty();
diff --git a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h index f9e8377..4f1b84a 100644 --- a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h +++ b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h
@@ -35,6 +35,7 @@ bool AddPassword(const std::string& url, const std::u16string& username, const std::u16string& password, + const std::u16string& note, bool use_account_store, content::WebContents* web_contents) override; // Fake implementation of ChangeSavedPassword. This succeeds if the current
diff --git a/chrome/browser/extensions/api/search/search_api_unittest.cc b/chrome/browser/extensions/api/search/search_api_unittest.cc index 3e69925..baeaee9 100644 --- a/chrome/browser/extensions/api/search/search_api_unittest.cc +++ b/chrome/browser/extensions/api/search/search_api_unittest.cc
@@ -15,6 +15,8 @@ #include "content/public/test/web_contents_tester.h" #include "extensions/browser/api_test_utils.h" #include "extensions/common/extension_builder.h" +#include "ui/display/test/scoped_screen_override.h" +#include "ui/display/test/test_screen.h" namespace extensions { @@ -72,6 +74,8 @@ std::unique_ptr<TestBrowserWindow> browser_window_; std::unique_ptr<Browser> browser_; + display::test::TestScreen test_screen_; + std::unique_ptr<display::test::ScopedScreenOverride> scoped_screen_override_; scoped_refptr<extensions::SearchQueryFunction> function_; }; @@ -87,6 +91,8 @@ params.type = Browser::TYPE_NORMAL; params.window = browser_window_.get(); browser_ = std::unique_ptr<Browser>(Browser::Create(params)); + scoped_screen_override_ = + std::make_unique<display::test::ScopedScreenOverride>(&test_screen_); // Mock TemplateURLService. auto* template_url_service = static_cast<TemplateURLService*>(
diff --git a/chrome/browser/extensions/api/system_display/system_display_extension_apitest.cc b/chrome/browser/extensions/api/system_display/system_display_extension_apitest.cc index 837d0bd..a42a5749 100644 --- a/chrome/browser/extensions/api/system_display/system_display_extension_apitest.cc +++ b/chrome/browser/extensions/api/system_display/system_display_extension_apitest.cc
@@ -15,11 +15,16 @@ #include "extensions/browser/api/system_display/system_display_api.h" #include "extensions/browser/api_test_utils.h" #include "extensions/browser/mock_display_info_provider.h" +#include "extensions/browser/mock_screen.h" #include "extensions/common/api/system_display.h" #include "ui/display/display.h" +#include "ui/display/screen.h" +#include "ui/display/test/scoped_screen_override.h" namespace extensions { +using display::Screen; +using display::test::ScopedScreenOverride; using ContextType = ExtensionBrowserTest::ContextType; class SystemDisplayExtensionApiTest @@ -34,19 +39,27 @@ void SetUpOnMainThread() override { ExtensionApiTest::SetUpOnMainThread(); + ANNOTATE_LEAKING_OBJECT_PTR(Screen::GetScreen()); + scoped_screen_override_ = + std::make_unique<ScopedScreenOverride>(screen_.get()); DisplayInfoProvider::InitializeForTesting(provider_.get()); } void TearDownOnMainThread() override { ExtensionApiTest::TearDownOnMainThread(); + scoped_screen_override_.reset(); } protected: std::unique_ptr<MockDisplayInfoProvider> provider_ = std::make_unique<MockDisplayInfoProvider>(); + + private: + std::unique_ptr<Screen> screen_ = std::make_unique<MockScreen>(); + std::unique_ptr<ScopedScreenOverride> scoped_screen_override_; }; -// TODO(crbug.com/1231357): Revisit this after screen creation refactoring. +// TODO(crbug.com/1231357): MockScreen causes random failures on Windows. #if !BUILDFLAG(IS_WIN) INSTANTIATE_TEST_SUITE_P(PersistentBackground,
diff --git a/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc b/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc index 7154cba7..005577b 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc
@@ -33,6 +33,8 @@ #include "extensions/common/constants.h" #include "extensions/common/extension_builder.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/display/test/scoped_screen_override.h" +#include "ui/display/test/test_screen.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/test/ash_test_helper.h" @@ -46,6 +48,8 @@ namespace extensions { +using display::test::ScopedScreenOverride; + namespace { std::unique_ptr<base::ListValue> RunTabsQueryFunction( @@ -123,15 +127,13 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) ash::AshTestHelper test_helper_; +#else + display::test::TestScreen test_screen_; + std::unique_ptr<ScopedScreenOverride> scoped_screen_override_; #endif }; void TabsApiUnitTest::SetUp() { -#if BUILDFLAG(IS_CHROMEOS_ASH) - ash::AshTestHelper::InitParams ash_params; - ash_params.start_session = true; - test_helper_.SetUp(std::move(ash_params)); -#endif // Force TabManager/TabLifecycleUnitSource creation. g_browser_process->GetTabManager(); @@ -143,6 +145,14 @@ params.type = Browser::TYPE_NORMAL; params.window = browser_window_.get(); browser_.reset(Browser::Create(params)); +#if BUILDFLAG(IS_CHROMEOS_ASH) + ash::AshTestHelper::InitParams ash_params; + ash_params.start_session = true; + test_helper_.SetUp(std::move(ash_params)); +#else + scoped_screen_override_ = + std::make_unique<ScopedScreenOverride>(&test_screen_); +#endif } void TabsApiUnitTest::TearDown() {
diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 53f84cb6..4fbfc7b6 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
@@ -668,6 +668,15 @@ return ret; } + const DownloadFailure* GetFailureWithId( + const std::vector<DownloadFailure>& failures, + const ExtensionId& id) { + auto it = std::find_if( + failures.begin(), failures.end(), + [&](const DownloadFailure& failure) { return failure.id == id; }); + return it == failures.end() ? nullptr : &*it; + } + void TestExtensionUpdateCheckRequests(bool pending) { // Create an extension with an update_url. ExtensionDownloaderTestHelper helper; @@ -914,13 +923,11 @@ CreateManifestFetchData(GURL("http://localhost/foo"))); UpdateManifestResults updates; std::vector<UpdateManifestResult*> updateable; - std::set<std::string> not_updateable; - ManifestInvalidFailureDataList errors; + std::vector<DownloadFailure> failures; helper.downloader().DetermineUpdates(*fetch_data, updates, &updateable, - ¬_updateable, &errors); + &failures); EXPECT_TRUE(updateable.empty()); - EXPECT_TRUE(not_updateable.empty()); - EXPECT_TRUE(errors.empty()); + EXPECT_TRUE(failures.empty()); // Create two updates - expect that DetermineUpdates will return the first // one (v1.0 installed, v1.1 available) but not the second one (both @@ -944,12 +951,13 @@ .WillOnce(DoAll(SetArgPointee<1>("2.0.0.0"), Return(true))); updateable.clear(); - not_updateable.clear(); - errors.clear(); + failures.clear(); helper.downloader().DetermineUpdates(*fetch_data, updates, &updateable, - ¬_updateable, &errors); - EXPECT_TRUE(errors.empty()); - EXPECT_THAT(not_updateable, testing::ElementsAre(id2)); + &failures); + ASSERT_EQ(1u, failures.size()); + EXPECT_EQ(id2, failures[0].id); + EXPECT_EQ(ExtensionDownloaderDelegate::Error::NO_UPDATE_AVAILABLE, + failures[0].error); ASSERT_EQ(1u, updateable.size()); EXPECT_EQ("1.1", updateable[0]->version); } @@ -1021,22 +1029,24 @@ .WillOnce(DoAll(SetArgPointee<1>("0.0.0.0"), Return(true))); std::vector<UpdateManifestResult*> updateable; - std::set<std::string> not_updateable; - ManifestInvalidFailureDataList errors; + std::vector<DownloadFailure> failures; helper.downloader().DetermineUpdates(*fetch_data, updates, &updateable, - ¬_updateable, &errors); - EXPECT_THAT(not_updateable, testing::UnorderedElementsAre(id2, id3)); + &failures); + std::vector<ExtensionId> ids_not_updateable({id2, id3}); + for (const auto& id : ids_not_updateable) { + const auto* failure = GetFailureWithId(failures, id); + ASSERT_TRUE(failure); + EXPECT_EQ(ExtensionDownloaderDelegate::Error::NO_UPDATE_AVAILABLE, + failure->error); + } std::vector<ExtensionId> ids_with_error({id4, id5, id6}); for (const auto& id : ids_with_error) { - auto it = std::find_if( - errors.begin(), errors.end(), - [&](const std::pair< - ExtensionId, ExtensionDownloaderDelegate::FailureData>& error) { - return error.first == id; - }); - EXPECT_TRUE(it != errors.end()); + const auto* failure = GetFailureWithId(failures, id); + ASSERT_TRUE(failure); + EXPECT_EQ(ExtensionDownloaderDelegate::Error::MANIFEST_INVALID, + failure->error); } - EXPECT_EQ(3u, errors.size()); + EXPECT_EQ(5u, failures.size()); ASSERT_EQ(1u, updateable.size()); EXPECT_EQ("1.1", updateable[0]->version); } @@ -1070,14 +1080,12 @@ EXPECT_CALL(delegate, IsExtensionPending(_)).WillRepeatedly(Return(true)); std::vector<UpdateManifestResult*> updateable; - std::set<std::string> not_updateable; - ManifestInvalidFailureDataList errors; + std::vector<DownloadFailure> failures; helper.downloader().DetermineUpdates(*fetch_data, updates, &updateable, - ¬_updateable, &errors); + &failures); // All the apps should be updateable. EXPECT_EQ(3u, updateable.size()); - EXPECT_TRUE(not_updateable.empty()); - EXPECT_TRUE(errors.empty()); + EXPECT_TRUE(failures.empty()); } void TestDetermineUpdatesDuplicates() { @@ -1145,22 +1153,24 @@ .WillOnce(DoAll(SetArgPointee<1>("1.6.0.0"), Return(true))); std::vector<UpdateManifestResult*> updateable; - std::set<std::string> not_updateable; - ManifestInvalidFailureDataList errors; + std::vector<DownloadFailure> failures; helper.downloader().DetermineUpdates(*fetch_data, updates, &updateable, - ¬_updateable, &errors); - EXPECT_THAT(not_updateable, testing::UnorderedElementsAre(id1, id4)); + &failures); + std::vector<ExtensionId> ids_not_updateable({id1, id4}); + for (const auto& id : ids_not_updateable) { + const auto* failure = GetFailureWithId(failures, id); + ASSERT_TRUE(failure); + EXPECT_EQ(ExtensionDownloaderDelegate::Error::NO_UPDATE_AVAILABLE, + failure->error); + } std::vector<ExtensionId> ids_with_error({id2, id5, id7}); for (const auto& id : ids_with_error) { - auto it = std::find_if( - errors.begin(), errors.end(), - [&](const std::pair< - ExtensionId, ExtensionDownloaderDelegate::FailureData>& error) { - return error.first == id; - }); - EXPECT_TRUE(it != errors.end()); + const auto* failure = GetFailureWithId(failures, id); + ASSERT_TRUE(failure); + EXPECT_EQ(ExtensionDownloaderDelegate::Error::MANIFEST_INVALID, + failure->error); } - EXPECT_EQ(3u, errors.size()); + EXPECT_EQ(5u, failures.size()); ASSERT_EQ(2u, updateable.size()); EXPECT_EQ("1.3.1.0", updateable[0]->version); EXPECT_EQ("1.6.1.0", updateable[1]->version);
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 723193a..c899eec 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -3322,6 +3322,11 @@ "expiry_milestone": 110 }, { + "name": "force-gpu-main-thread-to-normal-priority-drdc", + "owners": [ "vikassoni", "lehoangquyen" ], + "expiry_milestone": 110 + }, + { "name": "force-major-version-to-minor", "owners": [ "brgoldstein", "potassium-katabolism@google.com" ], "expiry_milestone": 110 @@ -5644,7 +5649,7 @@ { "name": "sync-settings-categorization", "owners": [ "bsazonov", "rsorokin", "cros-oac@google.com" ], - "expiry_milestone": 103 + "expiry_milestone": 106 }, { "name": "sync-standalone-invalidations",
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index bad7bf8..c5e330e 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -182,6 +182,14 @@ " Use this flag along with flag enable-drdc to enable DrDc on Vulkan. " " Note that this flag will be a no-op if enable-drdc is disabled. "; +const char kForceGpuMainThreadToNormalPriorityDrDcName[] = + "Force GPU main thread priority to normal for DrDc."; +const char kForceGpuMainThreadToNormalPriorityDrDcDescription[] = + "When enabled, force GPU main thread priority to be normal for DrDc mode. " + "In that case DrDc thread continues to use DISPLAY thread priority and " + "hence have higher thread priority than GPU main. Note that this flag will " + "be a no-op when DrDc is disabled."; + const char kU2FPermissionPromptName[] = "Enable a permission prompt for the U2F Security Key API"; const char kU2FPermissionPromptDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 99908d28..371df64 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -126,6 +126,9 @@ extern const char kEnableDrDcName[]; extern const char kEnableDrDcDescription[]; +extern const char kForceGpuMainThreadToNormalPriorityDrDcName[]; +extern const char kForceGpuMainThreadToNormalPriorityDrDcDescription[]; + extern const char kEnableDrDcVulkanName[]; #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
diff --git a/chrome/browser/incognito/BUILD.gn b/chrome/browser/incognito/BUILD.gn index 3cef0d6..db4d169 100644 --- a/chrome/browser/incognito/BUILD.gn +++ b/chrome/browser/incognito/BUILD.gn
@@ -20,7 +20,6 @@ "android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthProperties.java", "android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthSettingSwitchPreference.java", "android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthSettingUtils.java", - "android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthTabSwitcherDelegate.java", "android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthViewBinder.java", ] deps = [ @@ -28,6 +27,7 @@ "//base:base_java", "//base:jni_java", "//build/android:build_java", + "//chrome/android/features/tab_ui/public:java", "//chrome/browser/android/lifecycle:java", "//chrome/browser/dependency_injection:java", "//chrome/browser/device_reauth/android:java",
diff --git a/chrome/browser/incognito/DEPS b/chrome/browser/incognito/DEPS new file mode 100644 index 0000000..f20cdf7 --- /dev/null +++ b/chrome/browser/incognito/DEPS
@@ -0,0 +1,4 @@ +include_rules = [ + # This file is part of the tab management public API. + "+chrome/android/features/tab_ui/public/android/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSwitcherCustomViewManager.java", +]
diff --git a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthCoordinator.java b/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthCoordinator.java index 05ed626..6c085f3 100644 --- a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthCoordinator.java +++ b/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthCoordinator.java
@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.incognito.R; import org.chromium.chrome.browser.tabmodel.TabModelSelector; +import org.chromium.chrome.browser.tasks.tab_management.TabSwitcherCustomViewManager; import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.widget.listmenu.ListMenuButtonDelegate; import org.chromium.ui.modaldialog.DialogDismissalCause; @@ -34,8 +35,10 @@ class IncognitoReauthCoordinator { private final @NonNull Context mContext; private final @NonNull ModalDialogManager mModalDialogManager; - // This can be null if the {link TabSwitcherCustomViewManager} is not yet created. - private final @Nullable IncognitoReauthTabSwitcherDelegate mIncognitoReauthTabSwitcherDelegate; + // This can be null for cases where tab switcher might not have been created yet. + // This happens when user hasn't yet interacted with tab switcher but we create + // this coordinator to display a full-screen dialog. + private final @Nullable TabSwitcherCustomViewManager mTabSwitcherCustomViewManager; private final boolean mShowFullScreen; // Non-null for full screen re-auth dialog. @@ -59,7 +62,7 @@ * to initiate re-authentication. * @param settingsLauncher A {@link SettingsLauncher} that allows to fire {@link * SettingsActivity}. - * @param incognitoReauthTabSwitcherDelegate A {@link IncognitoReauthTabSwitcherDelegate} that + * @param tabSwitcherCustomViewManager A {@link TabSwitcherCustomViewManager} that * allows to communicate with tab switcher to show the re-auth screen. * @param showFullScreen Whether to show a fullscreen / tab based re-auth dialog. */ @@ -69,11 +72,11 @@ @NonNull IncognitoReauthManager.IncognitoReauthCallback incognitoReauthCallback, @NonNull IncognitoReauthManager incognitoReauthManager, @NonNull SettingsLauncher settingsLauncher, - @Nullable IncognitoReauthTabSwitcherDelegate incognitoReauthTabSwitcherDelegate, + @Nullable TabSwitcherCustomViewManager tabSwitcherCustomViewManager, boolean showFullScreen) { mContext = context; mModalDialogManager = modalDialogManager; - mIncognitoReauthTabSwitcherDelegate = incognitoReauthTabSwitcherDelegate; + mTabSwitcherCustomViewManager = tabSwitcherCustomViewManager; mShowFullScreen = showFullScreen; mIncognitoReauthMediator = new IncognitoReauthMediator( tabModelSelector, incognitoReauthCallback, incognitoReauthManager); @@ -103,10 +106,9 @@ new IncognitoReauthDialog(mModalDialogManager, mIncognitoReauthView); mIncognitoReauthDialog.showIncognitoReauthDialog(mShowFullScreen); } else { - assert mIncognitoReauthTabSwitcherDelegate - != null : "delegate to TabSwitcher can't be null."; - boolean success = mIncognitoReauthTabSwitcherDelegate.addReauthScreenInTabSwitcher( - mIncognitoReauthView); + assert mTabSwitcherCustomViewManager + != null : "TabSwitcherCustomViewManager can't be null."; + boolean success = mTabSwitcherCustomViewManager.requestView(mIncognitoReauthView); assert success : "Unable to signal showing the re-auth screen to tab switcher."; } } @@ -116,10 +118,9 @@ assert mIncognitoReauthDialog != null : "Incognito re-auth dialog doesn't exists."; mIncognitoReauthDialog.dismissIncognitoReauthDialog(dismissalCause); } else { - assert mIncognitoReauthTabSwitcherDelegate - != null : "delegate to TabSwitcher can't be null."; - boolean success = - mIncognitoReauthTabSwitcherDelegate.removeReauthScreenFromTabSwitcher(); + assert mTabSwitcherCustomViewManager + != null : "TabSwitcherCustomViewManager can't be null."; + boolean success = mTabSwitcherCustomViewManager.releaseView(); assert success : "Unable to signal removing the re-auth screen from tab switcher."; } destroy();
diff --git a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthCoordinatorFactory.java b/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthCoordinatorFactory.java index 15a83f6f..7629263 100644 --- a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthCoordinatorFactory.java +++ b/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthCoordinatorFactory.java
@@ -12,6 +12,7 @@ import org.chromium.base.CallbackController; import org.chromium.base.supplier.OneshotSupplier; import org.chromium.chrome.browser.tabmodel.TabModelSelector; +import org.chromium.chrome.browser.tasks.tab_management.TabSwitcherCustomViewManager; import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.ui.modaldialog.ModalDialogManager; @@ -25,10 +26,12 @@ private final @NonNull IncognitoReauthManager mIncognitoReauthManager; private final @NonNull SettingsLauncher mSettingsLauncher; - // A callback controller for initializing the |mIncognitoReauthTabSwitcherDelegate| which is - // invoked once the {@link TabSwitcherCustomViewManager} is initiated and created. - private final CallbackController mTabSwitcherDelegateController = new CallbackController(); - private @Nullable IncognitoReauthTabSwitcherDelegate mIncognitoReauthTabSwitcherDelegate; + // A callback controller to monitor the availability of {@link TabSwitcherCustomViewManager}. + private final CallbackController mTabSwitcherCustomViewManagerController = + new CallbackController(); + + // This is non-null for Tabbed Activity; + private @Nullable TabSwitcherCustomViewManager mTabSwitcherCustomViewManager; /** * @param context The {@link Context} to use for inflating the Incognito re-auth view. @@ -38,30 +41,30 @@ * containing the Incognito re-auth view. * @param settingsLauncher A {@link SettingsLauncher} that allows to launch {@link * SettingsActivity} from 3 dots menu. - * @param incognitoReauthTabSwitcherDelegateSupplier A {@link OneshotSupplier - * <IncognitoReauthTabSwitcherDelegate>} that allows to communicate with tab switcher to + * @param tabSwitcherCustomViewManagerOneshotSupplier A {@link OneshotSupplier + * <TabSwitcherCustomViewManager>} that allows to communicate with tab switcher to * show the re-auth screen. */ public IncognitoReauthCoordinatorFactory(@NonNull Context context, @NonNull TabModelSelector tabModelSelector, @NonNull ModalDialogManager modalDialogManager, @NonNull SettingsLauncher settingsLauncher, - @NonNull OneshotSupplier<IncognitoReauthTabSwitcherDelegate> - incognitoReauthTabSwitcherDelegateSupplier) { + @NonNull OneshotSupplier<TabSwitcherCustomViewManager> + tabSwitcherCustomViewManagerOneshotSupplier) { mContext = context; mTabModelSelector = tabModelSelector; mModalDialogManager = modalDialogManager; mIncognitoReauthManager = new IncognitoReauthManager(); mSettingsLauncher = settingsLauncher; - incognitoReauthTabSwitcherDelegateSupplier.onAvailable( - mTabSwitcherDelegateController.makeCancelable(delegate -> { - assert delegate != null; - mIncognitoReauthTabSwitcherDelegate = delegate; + tabSwitcherCustomViewManagerOneshotSupplier.onAvailable( + mTabSwitcherCustomViewManagerController.makeCancelable(manager -> { + assert manager != null; + mTabSwitcherCustomViewManager = manager; })); } void destroy() { - mTabSwitcherDelegateController.destroy(); + mTabSwitcherCustomViewManagerController.destroy(); } IncognitoReauthCoordinator createIncognitoReauthCoordinator( @@ -69,6 +72,6 @@ boolean showFullScreen) { return new IncognitoReauthCoordinator(mContext, mTabModelSelector, mModalDialogManager, incognitoReauthCallback, mIncognitoReauthManager, mSettingsLauncher, - mIncognitoReauthTabSwitcherDelegate, showFullScreen); + mTabSwitcherCustomViewManager, showFullScreen); } }
diff --git a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthTabSwitcherDelegate.java b/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthTabSwitcherDelegate.java deleted file mode 100644 index d4c50bea..0000000 --- a/chrome/browser/incognito/android/java/src/org/chromium/chrome/browser/incognito/reauth/IncognitoReauthTabSwitcherDelegate.java +++ /dev/null
@@ -1,34 +0,0 @@ -// 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. - -package org.chromium.chrome.browser.incognito.reauth; - -import android.view.View; - -import androidx.annotation.NonNull; - -/** - * An interface to establish communication with {@link TabSwitcherCustomViewManager} to support - * showing re-auth screen in tab switcher UI. - * - * TODO(crbug.com/1324211, crbug.com/1227656) : Remove this interface once tab_ui is modularized. - */ -public interface IncognitoReauthTabSwitcherDelegate { - /** - * A method to supply the incognito re-auth view to tab switcher. - * - * @param customView A {@link View} that needs to be added to the tab switcher content area. - * @return True, if the signal was relayed successfully to {@link TabSwitcherCustomViewManager}, - * false otherwise. - */ - boolean addReauthScreenInTabSwitcher(@NonNull View customView); - - /** - * A method to remove the incognito re-auth view from tab switcher. - * - * @return True, if the signal was relayed successfully to {@link TabSwitcherCustomViewManager}, - * false otherwise. - */ - boolean removeReauthScreenFromTabSwitcher(); -}
diff --git a/chrome/browser/lacros/browser_test_util.cc b/chrome/browser/lacros/browser_test_util.cc index 4f8f8e5..e1a9f106 100644 --- a/chrome/browser/lacros/browser_test_util.cc +++ b/chrome/browser/lacros/browser_test_util.cc
@@ -8,6 +8,7 @@ #include "base/run_loop.h" #include "base/time/time.h" #include "base/timer/timer.h" +#include "chrome/browser/ui/lacros/window_utility.h" #include "chromeos/crosapi/mojom/test_controller.mojom.h" #include "chromeos/lacros/lacros_service.h" #include "ui/aura/env.h" @@ -107,20 +108,6 @@ } // namespace -std::string GetWindowId(aura::Window* window) { - DCHECK(window); - DCHECK(window->IsRootWindow()); - // On desktop aura there is one WindowTreeHost per top-level window. - aura::WindowTreeHost* window_tree_host = window->GetHost(); - DCHECK(window_tree_host); - // Lacros is based on Ozone/Wayland, which uses PlatformWindow and - // aura::WindowTreeHostPlatform. - auto* desktop_window_tree_host_platform = - views::DesktopWindowTreeHostLacros::From(window_tree_host); - return desktop_window_tree_host_platform->platform_window() - ->GetWindowUniqueId(); -} - void WaitForElementCreation(const std::string& element_name) { WaitForElement(element_name, /*exists=*/true); } @@ -176,7 +163,7 @@ // before quitting the run loop. void SendAndWaitForMouseClick(aura::Window* window) { DCHECK(window->IsRootWindow()); - std::string id = GetWindowId(window); + std::string id = lacros_window_utility::GetRootWindowUniqueId(window); base::RunLoop run_loop; std::unique_ptr<AuraObserver> obs = std::make_unique<AuraObserver>(&run_loop);
diff --git a/chrome/browser/lacros/browser_test_util.h b/chrome/browser/lacros/browser_test_util.h index 0da97565..8a3ca5f 100644 --- a/chrome/browser/lacros/browser_test_util.h +++ b/chrome/browser/lacros/browser_test_util.h
@@ -15,10 +15,6 @@ namespace browser_test_util { -// Returns the id associated with a root window. This id is generated by lacros -// and shared with ash. -std::string GetWindowId(aura::Window* window); - // Waits for an element to be created. void WaitForElementCreation(const std::string& element_name);
diff --git a/chrome/browser/lacros/clipboard_lacros_browsertest.cc b/chrome/browser/lacros/clipboard_lacros_browsertest.cc index 4267cdb..4f76fb7 100644 --- a/chrome/browser/lacros/clipboard_lacros_browsertest.cc +++ b/chrome/browser/lacros/clipboard_lacros_browsertest.cc
@@ -9,6 +9,7 @@ #include "chrome/browser/lacros/browser_test_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/lacros/window_utility.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -64,7 +65,8 @@ aura::Window* window = BrowserView::GetBrowserViewForBrowser(browser()) ->frame() ->GetNativeWindow(); - std::string id = browser_test_util::GetWindowId(window->GetRootWindow()); + std::string id = + lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); browser_test_util::WaitForWindowCreation(id); browser_test_util::SendAndWaitForMouseClick(window->GetRootWindow());
diff --git a/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc b/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc index 6d5c72f..c5d88ae 100644 --- a/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc +++ b/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/lacros/lacros_extension_apps_publisher.h" #include "chrome/browser/lacros/lacros_extensions_util.h" #include "chrome/browser/ui/browser_element_identifiers.h" +#include "chrome/browser/ui/lacros/window_utility.h" #include "chrome/test/base/in_process_browser_test.h" #include "chromeos/crosapi/mojom/test_controller.mojom-test-utils.h" #include "chromeos/crosapi/mojom/test_controller.mojom.h" @@ -152,7 +153,7 @@ extensions::AppWindowRegistry::AppWindowList app_windows = extensions::AppWindowRegistry::Get(profile())->app_windows(); for (extensions::AppWindow* app_window : app_windows) { - std::string window_id = browser_test_util::GetWindowId( + std::string window_id = lacros_window_utility::GetRootWindowUniqueId( app_window->GetNativeWindow()->GetRootWindow()); app_window->GetBaseWindow()->Close(); browser_test_util::WaitForWindowDestruction(window_id);
diff --git a/chrome/browser/lacros/overview_lacros_browsertest.cc b/chrome/browser/lacros/overview_lacros_browsertest.cc index 5b5032a..a98d337b 100644 --- a/chrome/browser/lacros/overview_lacros_browsertest.cc +++ b/chrome/browser/lacros/overview_lacros_browsertest.cc
@@ -6,6 +6,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/lacros/window_utility.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/in_process_browser_test.h" #include "chromeos/crosapi/mojom/test_controller.mojom-test-utils.h" @@ -42,7 +43,8 @@ // Wait for the window to be visible. aura::Window* window = browser()->window()->GetNativeWindow(); - std::string id = browser_test_util::GetWindowId(window->GetRootWindow()); + std::string id = + lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); browser_test_util::WaitForWindowCreation(id); // Enter overview mode. @@ -67,8 +69,8 @@ // Wait for the window to be visible. aura::Window* main_window = browser()->window()->GetNativeWindow(); - std::string main_id = - browser_test_util::GetWindowId(main_window->GetRootWindow()); + std::string main_id = lacros_window_utility::GetRootWindowUniqueId( + main_window->GetRootWindow()); browser_test_util::WaitForWindowCreation(main_id); // Create an incognito window and make it visible. @@ -78,8 +80,8 @@ AddBlankTabAndShow(incognito_browser); aura::Window* incognito_window = incognito_browser->window()->GetNativeWindow(); - std::string incognito_id = - browser_test_util::GetWindowId(incognito_window->GetRootWindow()); + std::string incognito_id = lacros_window_utility::GetRootWindowUniqueId( + incognito_window->GetRootWindow()); browser_test_util::WaitForWindowCreation(incognito_id); // Enter overview mode.
diff --git a/chrome/browser/lacros/popup_lacros_browsertest.cc b/chrome/browser/lacros/popup_lacros_browsertest.cc index e98f2e9..35dd2fe 100644 --- a/chrome/browser/lacros/popup_lacros_browsertest.cc +++ b/chrome/browser/lacros/popup_lacros_browsertest.cc
@@ -7,6 +7,7 @@ #include "chrome/browser/lacros/browser_test_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/lacros/window_utility.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/tab.h" @@ -71,7 +72,7 @@ // Wait for the window to be created. aura::Window* window = browser()->window()->GetNativeWindow(); std::string window_id = - browser_test_util::GetWindowId(window->GetRootWindow()); + lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); browser_test_util::WaitForWindowCreation(window_id); // Wait for the window to be globally positioned at 0,0. It will eventually
diff --git a/chrome/browser/lacros/tab_scrubber_lacros_browsertest.cc b/chrome/browser/lacros/tab_scrubber_lacros_browsertest.cc index 7ad58e31..3cc7473 100644 --- a/chrome/browser/lacros/tab_scrubber_lacros_browsertest.cc +++ b/chrome/browser/lacros/tab_scrubber_lacros_browsertest.cc
@@ -6,6 +6,7 @@ #include "chrome/browser/lacros/browser_test_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/lacros/window_utility.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/tab_scrubber_chromeos.h" @@ -58,7 +59,7 @@ // Wait for the window to be created. aura::Window* window = browser()->window()->GetNativeWindow(); std::string window_id = - browser_test_util::GetWindowId(window->GetRootWindow()); + lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); browser_test_util::WaitForWindowCreation(window_id); // Add further 5 blank tabs.
diff --git a/chrome/browser/lacros/tablet_mode_lacros_browsertest.cc b/chrome/browser/lacros/tablet_mode_lacros_browsertest.cc index 91aca4a..346e656 100644 --- a/chrome/browser/lacros/tablet_mode_lacros_browsertest.cc +++ b/chrome/browser/lacros/tablet_mode_lacros_browsertest.cc
@@ -6,6 +6,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/lacros/window_utility.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/in_process_browser_test.h" #include "chromeos/crosapi/mojom/test_controller.mojom-test-utils.h" @@ -35,8 +36,8 @@ // Wait for the window to be visible. aura::Window* main_window = browser()->window()->GetNativeWindow(); - std::string main_id = - browser_test_util::GetWindowId(main_window->GetRootWindow()); + std::string main_id = lacros_window_utility::GetRootWindowUniqueId( + main_window->GetRootWindow()); browser_test_util::WaitForWindowCreation(main_id); // Create an incognito window and make it visible. @@ -46,8 +47,8 @@ AddBlankTabAndShow(incognito_browser); aura::Window* incognito_window = incognito_browser->window()->GetNativeWindow(); - std::string incognito_id = - browser_test_util::GetWindowId(incognito_window->GetRootWindow()); + std::string incognito_id = lacros_window_utility::GetRootWindowUniqueId( + incognito_window->GetRootWindow()); browser_test_util::WaitForWindowCreation(incognito_id); // Enter tablet mode.
diff --git a/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc b/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc index cc7e127..d98d51a 100644 --- a/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc +++ b/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc
@@ -9,6 +9,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/lacros/window_utility.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/common/webui_url_constants.h" #include "chrome/test/base/in_process_browser_test.h" @@ -83,7 +84,8 @@ aura::Window* window = BrowserView::GetBrowserViewForBrowser(browser()) ->frame() ->GetNativeWindow(); - std::string id = browser_test_util::GetWindowId(window->GetRootWindow()); + std::string id = + lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); browser_test_util::WaitForWindowCreation(id); EXPECT_FALSE(chrome::CanGoBack(browser())); @@ -117,7 +119,8 @@ aura::Window* window = BrowserView::GetBrowserViewForBrowser(browser()) ->frame() ->GetNativeWindow(); - std::string id = browser_test_util::GetWindowId(window->GetRootWindow()); + std::string id = + lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); browser_test_util::WaitForWindowCreation(id); EXPECT_FALSE(chrome::CanGoBack(browser()));
diff --git a/chrome/browser/mac/chrome_browser_main_extra_parts_mac.h b/chrome/browser/mac/chrome_browser_main_extra_parts_mac.h deleted file mode 100644 index 6f2faad..0000000 --- a/chrome/browser/mac/chrome_browser_main_extra_parts_mac.h +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2022 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_MAC_CHROME_BROWSER_MAIN_EXTRA_PARTS_MAC_H_ -#define CHROME_BROWSER_MAC_CHROME_BROWSER_MAIN_EXTRA_PARTS_MAC_H_ - -#include <memory> - -#include "chrome/browser/chrome_browser_main_extra_parts.h" - -namespace display { -class ScopedNativeScreen; -} - -class ChromeBrowserMainExtraPartsMac : public ChromeBrowserMainExtraParts { - public: - ChromeBrowserMainExtraPartsMac(); - ChromeBrowserMainExtraPartsMac(const ChromeBrowserMainExtraPartsMac&) = - delete; - ChromeBrowserMainExtraPartsMac& operator=( - const ChromeBrowserMainExtraPartsMac&) = delete; - ~ChromeBrowserMainExtraPartsMac() override; - - // ChromeBrowserMainExtraParts: - void PreEarlyInitialization() override; - - private: - std::unique_ptr<display::ScopedNativeScreen> screen_; -}; - -#endif // CHROME_BROWSER_MAC_CHROME_BROWSER_MAIN_EXTRA_PARTS_MAC_H_
diff --git a/chrome/browser/mac/chrome_browser_main_extra_parts_mac.mm b/chrome/browser/mac/chrome_browser_main_extra_parts_mac.mm deleted file mode 100644 index 3094e1f..0000000 --- a/chrome/browser/mac/chrome_browser_main_extra_parts_mac.mm +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright 2022 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/mac/chrome_browser_main_extra_parts_mac.h" - -#include "ui/display/screen.h" - -ChromeBrowserMainExtraPartsMac::ChromeBrowserMainExtraPartsMac() = default; -ChromeBrowserMainExtraPartsMac::~ChromeBrowserMainExtraPartsMac() = default; - -void ChromeBrowserMainExtraPartsMac::PreEarlyInitialization() { - screen_ = std::make_unique<display::ScopedNativeScreen>(); -}
diff --git a/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc b/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc index a66f6cbd..ee42739 100644 --- a/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc +++ b/chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc
@@ -118,8 +118,9 @@ : content_settings::PageSpecificContentSettings::CAMERA_BLOCKED); } - // TODO(crbug.com/698985): Use `GetLastCommittedURL` if web_contents represent - // NTP. + // We should always use `GetLastCommittedURL` if web_contents represent NTP. + // Otherwise, the Microphone permission request on NTP will be gated for + // incorrect origin. GURL embedding_origin; if (permissions::PermissionsClient::Get()->DoOriginsMatchNewTabPage( request.security_origin,
diff --git a/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker_unittest.cc b/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker_unittest.cc index dcb59b0..310c743 100644 --- a/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker_unittest.cc +++ b/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker_unittest.cc
@@ -40,16 +40,17 @@ delete; void SetUp() override { - display::Screen::SetScreenInstance(&screen_); ChromeRenderViewHostTestHarness::SetUp(); + previous_screen_ = display::Screen::SetScreenInstance(&screen_); tab_usage_scenario_tracker_ = std::make_unique<TabUsageScenarioTracker>(&usage_scenario_data_store_); } void TearDown() override { tab_usage_scenario_tracker_.reset(); + display::Screen::SetScreenInstance(previous_screen_); + previous_screen_ = nullptr; ChromeRenderViewHostTestHarness::TearDown(); - display::Screen::SetScreenInstance(nullptr); } std::unique_ptr<content::WebContents> CreateWebContents() { @@ -82,6 +83,7 @@ protected: display::test::TestScreen screen_; + raw_ptr<display::Screen> previous_screen_; UsageScenarioDataStoreImpl usage_scenario_data_store_; std::unique_ptr<TabUsageScenarioTracker> tab_usage_scenario_tracker_; ukm::TestAutoSetUkmRecorder ukm_recorder_;
diff --git a/chrome/browser/page_load_metrics/observers/optimization_guide_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/optimization_guide_page_load_metrics_observer.cc index 8624a5f..ccbf571 100644 --- a/chrome/browser/page_load_metrics/observers/optimization_guide_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/optimization_guide_page_load_metrics_observer.cc
@@ -31,6 +31,14 @@ } page_load_metrics::PageLoadMetricsObserver::ObservePolicy +OptimizationGuidePageLoadMetricsObserver::OnPrerenderStart( + content::NavigationHandle* navigation_handle, + const GURL& currently_committed_url) { + // This class is interested only in the page starting in the foreground. + return STOP_OBSERVING; +} + +page_load_metrics::PageLoadMetricsObserver::ObservePolicy OptimizationGuidePageLoadMetricsObserver::OnFencedFramesStart( content::NavigationHandle* navigation_handle, const GURL& currently_committed_url) {
diff --git a/chrome/browser/page_load_metrics/observers/optimization_guide_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/optimization_guide_page_load_metrics_observer.h index 88db906..a7dea26 100644 --- a/chrome/browser/page_load_metrics/observers/optimization_guide_page_load_metrics_observer.h +++ b/chrome/browser/page_load_metrics/observers/optimization_guide_page_load_metrics_observer.h
@@ -24,6 +24,11 @@ ~OptimizationGuidePageLoadMetricsObserver() override; // page_load_metrics::PageLoadMetricsObserver: + ObservePolicy OnStart(content::NavigationHandle* navigation_handle, + const GURL& currently_committed_url, + bool started_in_foreground) override; + ObservePolicy OnPrerenderStart(content::NavigationHandle* navigation_handle, + const GURL& currently_committed_url) override; ObservePolicy OnFencedFramesStart( content::NavigationHandle* navigation_handle, const GURL& currently_committed_url) override; @@ -33,9 +38,6 @@ const page_load_metrics::mojom::PageLoadTiming& timing) override; ObservePolicy FlushMetricsOnAppEnterBackground( const page_load_metrics::mojom::PageLoadTiming& timing) override; - ObservePolicy OnStart(content::NavigationHandle* navigation_handle, - const GURL& currently_committed_url, - bool started_in_foreground) override; private: // OptimizationGuideWebContentsObserver to pass any captured page load metrics
diff --git a/chrome/browser/page_load_metrics/observers/side_search_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/side_search_page_load_metrics_observer.cc index 783ada1..9b5eb0eb 100644 --- a/chrome/browser/page_load_metrics/observers/side_search_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/side_search_page_load_metrics_observer.cc
@@ -41,11 +41,13 @@ return std::make_unique<SideSearchPageLoadMetricsObserver>(); } -// TODO(https://crbug.com/1317494): Audit and use appropriate policy. page_load_metrics::PageLoadMetricsObserver::ObservePolicy SideSearchPageLoadMetricsObserver::OnFencedFramesStart( content::NavigationHandle* navigation_handle, const GURL& currently_committed_url) { + // This class is interested only in events that are preprocessed and + // dispatched also to the outermost page at PageLoadTracker. So, this class + // doesn't need to forward events for FencedFrames. return STOP_OBSERVING; }
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc index 1fbf2e80..00804ea 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc +++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
@@ -251,10 +251,12 @@ return total_pageload_histograms - total_internal_histograms == 0; } - std::unique_ptr<PageLoadMetricsTestWaiter> CreatePageLoadMetricsTestWaiter() { + std::unique_ptr<PageLoadMetricsTestWaiter> CreatePageLoadMetricsTestWaiter( + const char* observer_name) { content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - return std::make_unique<PageLoadMetricsTestWaiter>(web_contents); + return std::make_unique<PageLoadMetricsTestWaiter>(web_contents, + observer_name); } // Triggers nostate prefetch of |url|. @@ -431,7 +433,7 @@ protected: void test_animated_image_lcp(bool smaller, bool animated) { // Waiter to ensure main content is loaded. - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); waiter->AddPageExpectation(TimingField::kLargestContentfulPaint); @@ -585,7 +587,7 @@ "a.com", "/scroll/scrollable_page_with_content.html"); auto main_frame_viewport_rect_expectation_waiter = - CreatePageLoadMetricsTestWaiter(); + CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); @@ -622,7 +624,7 @@ "a.com", "/scroll/scrollable_page_with_content_rtl.html"); auto main_frame_intersection_rect_expectation_waiter = - CreatePageLoadMetricsTestWaiter(); + CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); @@ -670,7 +672,7 @@ "a.com", "/scroll/scrollable_page_with_content.html"); auto main_frame_intersection_expectation_waiter = - CreatePageLoadMetricsTestWaiter(); + CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); @@ -720,7 +722,7 @@ "a.com", "/scroll/scrollable_page_with_content.html"); auto main_frame_intersection_expectation_waiter = - CreatePageLoadMetricsTestWaiter(); + CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); @@ -770,7 +772,7 @@ "a.com", "/scroll/scrollable_page_with_content.html"); auto main_frame_intersection_expectation_waiter = - CreatePageLoadMetricsTestWaiter(); + CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); @@ -801,7 +803,7 @@ "a.com", "/scroll/scrollable_page_with_content.html"); auto main_frame_intersection_expectation_waiter = - CreatePageLoadMetricsTestWaiter(); + CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); @@ -829,7 +831,7 @@ GURL url = embedded_test_server()->GetURL("/title1.html"); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); waiter->Wait(); @@ -867,7 +869,7 @@ GURL first_url = embedded_test_server()->GetURL("/server-redirect?" + final_url.spec()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), first_url)); waiter->Wait(); @@ -907,7 +909,7 @@ TriggerNoStatePrefetch(url); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); waiter->Wait(); @@ -1008,7 +1010,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, NoPaintForEmptyDocument) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL("/empty.html"))); @@ -1036,7 +1038,7 @@ GURL a_url( embedded_test_server()->GetURL("/page_load_metrics/empty_iframe.html")); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddSubFrameExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), a_url)); @@ -1053,7 +1055,7 @@ ASSERT_TRUE(embedded_test_server()->Start()); GURL a_url(embedded_test_server()->GetURL("/page_load_metrics/iframe.html")); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstPaint); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); @@ -1069,7 +1071,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, PaintInDynamicChildFrame) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstPaint); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); @@ -1089,7 +1091,7 @@ GURL a_url(embedded_test_server()->GetURL("/page_load_metrics/iframes.html")); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddSubFrameExpectation(TimingField::kFirstPaint); @@ -1111,7 +1113,7 @@ GURL a_url(embedded_test_server()->GetURL( "/page_load_metrics/main_frame_with_iframe.html")); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstPaint); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); @@ -1127,7 +1129,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, SameDocumentNavigation) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); GURL url = embedded_test_server()->GetURL("/title1.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); @@ -1150,7 +1152,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, SameUrlNavigation) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); GURL url = embedded_test_server()->GetURL("/title1.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); @@ -1159,7 +1161,7 @@ histogram_tester_->ExpectTotalCount(internal::kHistogramDomContentLoaded, 1); histogram_tester_->ExpectTotalCount(internal::kHistogramLoad, 1); - waiter = CreatePageLoadMetricsTestWaiter(); + waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); waiter->Wait(); @@ -1181,7 +1183,7 @@ DocWriteAbortsSubframeNavigation) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( "/page_load_metrics/doc_write_aborts_subframe.html"))); @@ -1271,7 +1273,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, NoDocumentWrite) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( @@ -1287,7 +1289,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, DocumentWriteBlock) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( @@ -1302,7 +1304,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, DocumentWriteReload) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -1313,14 +1315,14 @@ internal::kHistogramDocWriteBlockParseStartToFirstContentfulPaint, 1); // Reload should not log the histogram as the script is not blocked. - waiter = CreatePageLoadMetricsTestWaiter(); + waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( "/page_load_metrics/document_write_script_block.html"))); waiter->Wait(); - waiter = CreatePageLoadMetricsTestWaiter(); + waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -1334,7 +1336,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, DocumentWriteAsync) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -1350,7 +1352,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, DocumentWriteSameDomain) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -1367,7 +1369,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, NoDocumentWriteScript) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -1425,7 +1427,7 @@ GURL url2(embedded_test_server()->GetURL("/title2.html")); NavigateParams params2(browser(), url2, ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); Navigate(¶ms2); waiter->Wait(); @@ -1447,7 +1449,7 @@ NavigateParams params2(browser(), url, ui::PAGE_TRANSITION_RELOAD); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); Navigate(¶ms2); waiter->Wait(); @@ -1504,7 +1506,7 @@ GURL url3(embedded_test_server()->GetURL("/title3.html")); NavigateParams params3(browser(), url3, ui::PAGE_TRANSITION_TYPED); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); Navigate(¶ms3); waiter->Wait(); @@ -1530,7 +1532,7 @@ EXPECT_TRUE(manager.WaitForRequestStart()); { - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); EXPECT_TRUE(content::ExecuteScript( browser()->tab_strip_model()->GetActiveWebContents(), @@ -1556,7 +1558,7 @@ MAYBE_FirstMeaningfulPaintRecorded) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstMeaningfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL("/title1.html"))); @@ -1575,7 +1577,7 @@ FirstMeaningfulPaintNotRecorded) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( @@ -1600,7 +1602,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, PayloadSize) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -1623,7 +1625,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, PayloadSizeChildFrame) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -1669,7 +1671,7 @@ UseCounterFeaturesInMainFrame) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -1707,7 +1709,7 @@ UseCounterCSSPropertiesInMainFrame) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -1728,7 +1730,7 @@ UseCounterAnimatedCSSPropertiesInMainFrame) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -1771,7 +1773,7 @@ https_server.AddDefaultHandlers(GetChromeTestDataDir()); ASSERT_TRUE(https_server.Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -1804,7 +1806,7 @@ https_server.AddDefaultHandlers(GetChromeTestDataDir()); ASSERT_TRUE(https_server.Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -1832,7 +1834,7 @@ https_server.AddDefaultHandlers(GetChromeTestDataDir()); ASSERT_TRUE(https_server.Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -1855,7 +1857,7 @@ UseCounterFeaturesInNonSecureMainFrame) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -1914,7 +1916,7 @@ .GetBackForwardCache() .DisableForTesting(content::BackForwardCache::TEST_REQUIRES_NO_CACHING); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); GURL url = embedded_test_server()->GetURL( "/page_load_metrics/use_counter_features.html"); @@ -1964,7 +1966,7 @@ .GetBackForwardCache() .DisableForTesting(content::BackForwardCache::TEST_REQUIRES_NO_CACHING); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); GURL url = https_server.GetURL("/page_load_metrics/use_counter_features.html"); @@ -2001,7 +2003,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, UseCounterFeaturesInIframe) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -2043,7 +2045,7 @@ UseCounterFeaturesInMultipleIframes) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -2085,7 +2087,7 @@ UseCounterCSSPropertiesInIframe) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -2109,7 +2111,7 @@ UseCounterCSSPropertiesInMultipleIframes) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -2133,7 +2135,7 @@ UseCounterAnimatedCSSPropertiesInIframe) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -2159,7 +2161,7 @@ UseCounterAnimatedCSSPropertiesInMultipleIframes) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -2202,7 +2204,7 @@ ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddUseCounterFeatureExpectation({ blink::mojom::UseCounterFeatureType::kPermissionsPolicyViolationEnforce, test_feature, @@ -2228,7 +2230,7 @@ ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddUseCounterFeatureExpectation({ blink::mojom::UseCounterFeatureType::kPermissionsPolicyViolationEnforce, test_feature, @@ -2257,7 +2259,7 @@ ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddUseCounterFeatureExpectation({ blink::mojom::UseCounterFeatureType::kPermissionsPolicyViolationEnforce, test_feature, @@ -2279,7 +2281,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, LoadingMetrics) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadTimingInfo); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL("/title1.html"))); @@ -2305,7 +2307,7 @@ web_contents->GetController() .GetLastCommittedEntry() ->SetIsOverridingUserAgent(true); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddUseCounterFeatureExpectation({ blink::mojom::UseCounterFeatureType::kUserAgentOverride, blink::UserAgentOverride::UserAgentOverriden, @@ -2335,7 +2337,7 @@ web_contents->GetController() .GetLastCommittedEntry() ->SetIsOverridingUserAgent(true); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddUseCounterFeatureExpectation({ blink::mojom::UseCounterFeatureType::kUserAgentOverride, blink::UserAgentOverride::UserAgentOverrideSubstring, @@ -2364,7 +2366,7 @@ web_contents->GetController() .GetLastCommittedEntry() ->SetIsOverridingUserAgent(true); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddUseCounterFeatureExpectation({ blink::mojom::UseCounterFeatureType::kUserAgentOverride, blink::UserAgentOverride::UserAgentOverrideSuffix, @@ -2777,7 +2779,7 @@ content::SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -2785,7 +2787,7 @@ waiter->Wait(); int64_t one_frame_page_size = waiter->current_network_bytes(); - waiter = CreatePageLoadMetricsTestWaiter(); + waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), @@ -2812,7 +2814,7 @@ true /*relative_url_is_prefix*/); ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); browser()->OpenURL(content::OpenURLParams( embedded_test_server()->GetURL("/mock_page.html"), content::Referrer(), @@ -2853,7 +2855,7 @@ true /*relative_url_is_prefix*/); ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); browser()->OpenURL(content::OpenURLParams( embedded_test_server()->GetURL("/mock_page.html"), content::Referrer(), @@ -2909,7 +2911,7 @@ true /*relative_url_is_prefix*/); ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); browser()->OpenURL(content::OpenURLParams( embedded_test_server()->GetURL("/page_with_cached_subresource.html"), content::Referrer(), WindowOpenDisposition::CURRENT_TAB, @@ -2927,7 +2929,7 @@ // Re-navigate the page to the same url with a different query string so the // main resource is not loaded from the disk cache. The subresource will be // loaded from the memory cache. - waiter = CreatePageLoadMetricsTestWaiter(); + waiter = CreatePageLoadMetricsTestWaiter("waiter"); browser()->OpenURL(content::OpenURLParams( embedded_test_server()->GetURL("/page_with_cached_subresource.html?xyz"), content::Referrer(), WindowOpenDisposition::CURRENT_TAB, @@ -2955,7 +2957,7 @@ content::SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); GURL url = embedded_test_server()->GetURL("/page_load_metrics/link.html"); @@ -2964,7 +2966,7 @@ content::SimulateMouseClickAt( browser()->tab_strip_model()->GetActiveWebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(100, 100)); - waiter = CreatePageLoadMetricsTestWaiter(); + waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); waiter->Wait(); @@ -2991,7 +2993,7 @@ content::SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); GURL url = embedded_test_server()->GetURL("/title1.html"); @@ -3017,14 +3019,14 @@ content::SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); GURL url = embedded_test_server()->GetURL("/page_load_metrics/javascript_href.html"); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); waiter->Wait(); - waiter = CreatePageLoadMetricsTestWaiter(); + waiter = CreatePageLoadMetricsTestWaiter("waiter"); content::SimulateMouseClickAt( browser()->tab_strip_model()->GetActiveWebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(100, 100)); @@ -3055,7 +3057,7 @@ content::SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); GURL url = embedded_test_server()->GetURL( @@ -3095,7 +3097,7 @@ content::SetupCrossSiteRedirector(embedded_test_server()); ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); ASSERT_TRUE(ui_test_utils::NavigateToURL( @@ -3119,7 +3121,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, ServiceWorkerMetrics) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstPaint); // Load a page that registers a service worker. @@ -3136,7 +3138,7 @@ histogram_tester_->ExpectTotalCount( internal::kHistogramServiceWorkerFirstPaint, 0); - waiter = CreatePageLoadMetricsTestWaiter(); + waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kFirstPaint); // Load a controlled page. @@ -3164,7 +3166,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, PreCommitWebFeature) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL( @@ -3183,7 +3185,7 @@ MainFrameIntersectionsMainFrame) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -3223,7 +3225,7 @@ MainFrameIntersectionSingleFrame) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -3246,7 +3248,7 @@ MainFrameIntersectionSameOrigin) { EXPECT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -3284,7 +3286,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, MainFrameIntersectionCrossOrigin) { EXPECT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -3338,7 +3340,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, MainFrameIntersectionCrossOriginOutOfView) { EXPECT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -3380,7 +3382,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, MainFrameIntersectionCrossOriginScrolled) { EXPECT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL( @@ -3431,13 +3433,13 @@ ASSERT_TRUE(embedded_test_server()->Start()); // Waiter to ensure main content is loaded. - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); waiter->AddPageExpectation(TimingField::kLargestContentfulPaint); // Waiter to ensure that iframe content is loaded. - auto waiter2 = CreatePageLoadMetricsTestWaiter(); + auto waiter2 = CreatePageLoadMetricsTestWaiter("waiter2"); waiter2->AddPageExpectation(TimingField::kLoadEvent); waiter2->AddSubFrameExpectation(TimingField::kLoadEvent); waiter2->AddPageExpectation(TimingField::kFirstContentfulPaint); @@ -3521,11 +3523,11 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, FirstInputDelayFromClick) { ASSERT_TRUE(embedded_test_server()->Start()); - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); waiter->AddPageExpectation(TimingField::kFirstContentfulPaint); - auto waiter2 = CreatePageLoadMetricsTestWaiter(); + auto waiter2 = CreatePageLoadMetricsTestWaiter("waiter2"); waiter2->AddPageExpectation(TimingField::kLoadEvent); waiter2->AddPageExpectation(TimingField::kFirstContentfulPaint); waiter2->AddPageExpectation(TimingField::kFirstInputDelay); @@ -3731,7 +3733,7 @@ GURL url = embedded_test_server()->GetURL( "/page_load_metrics/use_counter_features.html"); { - auto waiter = CreatePageLoadMetricsTestWaiter(); + auto waiter = CreatePageLoadMetricsTestWaiter("waiter"); waiter->AddPageExpectation(TimingField::kLoadEvent); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); MakeComponentFullscreen("testvideo");
diff --git a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogCoordinator.java b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogCoordinator.java index ba93811..6f3287a 100644 --- a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogCoordinator.java +++ b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogCoordinator.java
@@ -113,12 +113,16 @@ */ void show(@NonNull String[] usernames, int selectedUsernameIndex, @NonNull String password, @NonNull String origin, @Nullable String account) { + // It's important to setup the modal dialog first, + // because the dialog's button state depends on whether dialog's view model has errors. + // So to handle dialog's view model errors, the dialog model should be prepared + // to avoid null reference exception or incorrect state. + createModelDialogModel(); + mModalDialogManager.showDialog(mDialogModel, ModalDialogManager.ModalDialogType.TAB); + createDialogViewModel(usernames, selectedUsernameIndex, password, account); PropertyModelChangeProcessor.create( mDialogViewModel, mDialogView, PasswordEditDialogViewBinder::bind); - - createModelDialogModel(); - mModalDialogManager.showDialog(mDialogModel, ModalDialogManager.ModalDialogType.TAB); } private void createDialogViewModel( @@ -186,7 +190,12 @@ private void handlePasswordChanged(String password) { mDialogViewModel.set(PasswordEditDialogProperties.PASSWORD, password); - mDialogViewModel.set(PasswordEditDialogProperties.EMPTY_PASSWORD_ERROR, password.isEmpty()); + boolean isPasswordInvalid = password.isEmpty(); + mDialogViewModel.set(PasswordEditDialogProperties.PASSWORD_ERROR, + isPasswordInvalid + ? mContext.getString(R.string.password_entry_edit_empty_password_error) + : null); + mDialogModel.set(ModalDialogProperties.POSITIVE_BUTTON_DISABLED, isPasswordInvalid); } // ModalDialogProperties.Controller implementation.
diff --git a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogProperties.java b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogProperties.java index 0d46923..2cb0149 100644 --- a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogProperties.java +++ b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogProperties.java
@@ -38,9 +38,9 @@ .ReadableObjectPropertyKey<Callback<String>> PASSWORD_CHANGED_CALLBACK = new PropertyModel.ReadableObjectPropertyKey<>("password changed callback"); - static final PropertyModel.WritableBooleanPropertyKey EMPTY_PASSWORD_ERROR = - new PropertyModel.WritableBooleanPropertyKey("empty password error"); + static final PropertyModel.WritableObjectPropertyKey<String> PASSWORD_ERROR = + new PropertyModel.WritableObjectPropertyKey<>("empty password error"); static final PropertyKey[] ALL_KEYS = {USERNAME_CHANGED_CALLBACK, USERNAMES, USERNAME, PASSWORD, - PASSWORD_CHANGED_CALLBACK, EMPTY_PASSWORD_ERROR, FOOTER}; + PASSWORD_CHANGED_CALLBACK, PASSWORD_ERROR, FOOTER}; } \ No newline at end of file
diff --git a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogTest.java b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogTest.java index 6d5f7f6..44f904f 100644 --- a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogTest.java +++ b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogTest.java
@@ -192,6 +192,20 @@ .dismissDialog(mModalDialogModel, DialogDismissalCause.POSITIVE_BUTTON_CLICKED); } + @Test + @EnableFeatures(ChromeFeatureList.PASSWORD_EDIT_DIALOG_WITH_DETAILS) + public void testEmptyPasswordError() { + Callback<String> passwordChangedCallback = + mDialogProperties.get(PasswordEditDialogProperties.PASSWORD_CHANGED_CALLBACK); + passwordChangedCallback.onResult(""); + Assert.assertTrue("Accept button should be disabled when user enters empty password", + mModalDialogModel.get(ModalDialogProperties.POSITIVE_BUTTON_DISABLED)); + Assert.assertFalse("Error should be displayed when user enters empty password", + mDialogProperties.get(PasswordEditDialogProperties.PASSWORD_ERROR) == null + || mDialogProperties.get(PasswordEditDialogProperties.PASSWORD_ERROR) + .isEmpty()); + } + /** Tests that the username selected in spinner gets reflected in the callback parameter. */ @Test @EnableFeatures(ChromeFeatureList.PASSWORD_EDIT_DIALOG_WITH_DETAILS)
diff --git a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogView.java b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogView.java index f0118ba..ce19efc 100644 --- a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogView.java +++ b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogView.java
@@ -67,4 +67,13 @@ * Note: override this in the inheritor if password change needs to be handled */ void setPasswordChangedCallback(Callback<String> callback) {} + + /** + * Sets password error to be displayed in UI. + * Setting null error means that no error will be displayed. + * Note: override this in the inheritor if setting password error is needed + * + * @param error Error text + */ + void setPasswordError(String error) {} }
diff --git a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogViewBinder.java b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogViewBinder.java index a235e6ac..4c529347 100644 --- a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogViewBinder.java +++ b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogViewBinder.java
@@ -35,8 +35,8 @@ model.get(PasswordEditDialogProperties.PASSWORD_CHANGED_CALLBACK)); } else if (propertyKey == PasswordEditDialogProperties.PASSWORD) { dialogView.setPassword(model.get(PasswordEditDialogProperties.PASSWORD)); - } else if (propertyKey == PasswordEditDialogProperties.EMPTY_PASSWORD_ERROR) { - // TODO(crbug.com/1315916): Handle displaying empty password error in the following CLs + } else if (propertyKey == PasswordEditDialogProperties.PASSWORD_ERROR) { + dialogView.setPasswordError(model.get(PasswordEditDialogProperties.PASSWORD_ERROR)); } else { assert false : "Unhandled update to property: " + propertyKey; }
diff --git a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogWithDetailsView.java b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogWithDetailsView.java index 34092fd0..eb51d6c 100644 --- a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogWithDetailsView.java +++ b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogWithDetailsView.java
@@ -26,7 +26,8 @@ */ public class PasswordEditDialogWithDetailsView extends PasswordEditDialogView { private AutoCompleteTextView mUsernameView; - private TextInputEditText mPasswordView; + private TextInputEditText mPasswordField; + private TextInputLayout mPasswordInputLayout; private Callback<String> mUsernameChangedCallback; private Callback<String> mPasswordChangedCallback; @@ -57,10 +58,10 @@ TextInputLayout usernameInput = findViewById(R.id.username_input_layout); usernameInput.setEndIconOnClickListener(view -> mUsernameView.showDropDown()); - mPasswordView = findViewById(R.id.password); - mPasswordView.setInputType(InputType.TYPE_CLASS_TEXT + mPasswordField = findViewById(R.id.password); + mPasswordField.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_TEXT_FLAG_MULTI_LINE); - mPasswordView.addTextChangedListener(new TextWatcher() { + mPasswordField.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {} @@ -73,6 +74,7 @@ @Override public void afterTextChanged(Editable editable) {} }); + mPasswordInputLayout = findViewById(R.id.password_text_input_layout); } @Override @@ -91,12 +93,17 @@ @Override public void setPassword(String password) { - if (mPasswordView.getText().toString().equals(password)) return; - mPasswordView.setText(password); + if (mPasswordField.getText().toString().equals(password)) return; + mPasswordField.setText(password); } @Override public void setPasswordChangedCallback(Callback<String> callback) { mPasswordChangedCallback = callback; } + + @Override + public void setPasswordError(String error) { + mPasswordInputLayout.setError(error); + } }
diff --git a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogWithDetailsViewTest.java b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogWithDetailsViewTest.java index 84473a9f..71374c1 100644 --- a/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogWithDetailsViewTest.java +++ b/chrome/browser/password_edit_dialog/android/java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogWithDetailsViewTest.java
@@ -12,6 +12,7 @@ import androidx.test.filters.MediumTest; import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; import org.junit.Assert; import org.junit.Before; @@ -39,6 +40,7 @@ private static final String INITIAL_PASSWORD = "password"; private static final String CHANGED_PASSWORD = "passwordChanged"; private static final String FOOTER = "Footer"; + private static final String PASSWORD_ERROR = "Enter password"; @ClassRule public static BaseActivityTestRule<BlankUiTestActivity> sActivityTestRule = @@ -49,6 +51,7 @@ PasswordEditDialogWithDetailsView mDialogView; AutoCompleteTextView mUsernamesView; TextInputEditText mPasswordView; + TextInputLayout mPasswordInputLayout; TextView mFooterView; String mUsername; String mCurrentPassword; @@ -69,6 +72,8 @@ mFooterView = (TextView) mDialogView.findViewById(R.id.footer); sActivity.setContentView(mDialogView); mPasswordView = (TextInputEditText) mDialogView.findViewById(R.id.password); + mPasswordInputLayout = + (TextInputLayout) mDialogView.findViewById(R.id.password_text_input_layout); }); } @@ -163,4 +168,30 @@ TestThreadUtils.runOnUiThreadBlocking(() -> { mUsernamesView.setText(INITIAL_USERNAME); }); CriteriaHelper.pollUiThread(() -> mUsername.equals(INITIAL_USERNAME)); } + + /** Tests if the password error is displayed */ + @Test + @MediumTest + public void testPasswordError() { + TestThreadUtils.runOnUiThreadBlocking(() -> { + PropertyModel model = + populateDialogPropertiesBuilder() + .with(PasswordEditDialogProperties.PASSWORD_ERROR, PASSWORD_ERROR) + .build(); + PropertyModelChangeProcessor.create( + model, mDialogView, PasswordEditDialogViewBinder::bind); + }); + Assert.assertEquals("Should display password error", + mPasswordInputLayout.getError().toString(), PASSWORD_ERROR); + + TestThreadUtils.runOnUiThreadBlocking(() -> { + PropertyModel model = populateDialogPropertiesBuilder() + .with(PasswordEditDialogProperties.PASSWORD_ERROR, null) + .build(); + PropertyModelChangeProcessor.create( + model, mDialogView, PasswordEditDialogViewBinder::bind); + }); + Assert.assertTrue( + "Password error should be reset now", mPasswordInputLayout.getError() == null); + } }
diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc index c3f440d..75e614b6 100644 --- a/chrome/browser/password_manager/password_manager_browsertest.cc +++ b/chrome/browser/password_manager/password_manager_browsertest.cc
@@ -83,6 +83,7 @@ #include "content/public/test/browser_test.h" #include "content/public/test/prerender_test_util.h" #include "content/public/test/test_utils.h" +#include "google_apis/gaia/gaia_switches.h" #include "net/base/filename_util.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/http_request.h" @@ -122,6 +123,15 @@ set_wait_for_server_predictions_for_filling(false); } + void SetUpCommandLine(base::CommandLine* command_line) override { + PasswordManagerBrowserTestBase::SetUpCommandLine(command_line); + + // For the password form to be treated as the Gaia signin page. + command_line->AppendSwitchASCII( + switches::kGaiaUrl, + https_test_server().GetURL("accounts.google.com", "/").spec()); + } + ~PasswordManagerBrowserTest() override = default; };
diff --git a/chrome/browser/picture_in_picture/video_picture_in_picture_window_controller_browsertest.cc b/chrome/browser/picture_in_picture/video_picture_in_picture_window_controller_browsertest.cc index 8f54c98..82196a2 100644 --- a/chrome/browser/picture_in_picture/video_picture_in_picture_window_controller_browsertest.cc +++ b/chrome/browser/picture_in_picture/video_picture_in_picture_window_controller_browsertest.cc
@@ -105,6 +105,7 @@ MOCK_METHOD0(ToggleMicrophone, void()); MOCK_METHOD0(ToggleCamera, void()); MOCK_METHOD0(HangUp, void()); + MOCK_CONST_METHOD0(GetSourceBounds, const gfx::Rect&()); }; const base::FilePath::CharType kPictureInPictureWindowSizePage[] = @@ -333,6 +334,9 @@ ASSERT_TRUE(window_controller()->GetWindowForTesting()); EXPECT_TRUE(window_controller()->GetWindowForTesting()->IsVisible()); + // The bounds should be nontrivial. + EXPECT_NE(window_controller()->GetSourceBounds(), gfx::Rect()); + gfx::NativeWindow native_window = GetOverlayWindow()->GetNativeWindow(); EXPECT_FALSE(platform_util::IsWindowActive(native_window)); }
diff --git a/chrome/browser/resources/chromeos/login/screens/common/consolidated_consent.html b/chrome/browser/resources/chromeos/login/screens/common/consolidated_consent.html index 13cb8e6a..b90c198 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/consolidated_consent.html +++ b/chrome/browser/resources/chromeos/login/screens/common/consolidated_consent.html
@@ -220,8 +220,7 @@ <span id="usageTitle" class="oobe-optin-title"> [[i18nDynamic(locale, 'consolidatedConsentUsageOptInTitle')]] </span> - [[getUsageText_(locale, isChildAccount_, isArcEnabled_, - isDemo_, isOwner_)]] + [[getUsageText_(locale, isChildAccount_, isArcEnabled_, isDemo_)]] <a id="usageLearnMore" on-click="onUsageLearnMoreClick_" class="oobe-local-link" is="action-link"> [[i18nDynamic(locale, @@ -331,7 +330,7 @@ <span inner-h-t-m-l= "[[getUsageLearnMoreText_(locale, isChildAccount_, - isArcEnabled_, isDemo_, isOwner_)]]"> + isArcEnabled_, isDemo_)]]"> </span> </div> </oobe-modal-dialog>
diff --git a/chrome/browser/resources/chromeos/login/screens/common/consolidated_consent.js b/chrome/browser/resources/chromeos/login/screens/common/consolidated_consent.js index 05c5b2b..16c054d7 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/consolidated_consent.js +++ b/chrome/browser/resources/chromeos/login/screens/common/consolidated_consent.js
@@ -71,11 +71,6 @@ value: false, }, - isOwner_: { - type: Boolean, - value: false, - }, - isTosHidden_: { type: Boolean, value: false, @@ -91,6 +86,11 @@ value: false, }, + usageOptinHiddenLoading_: { + type: Boolean, + value: true, + }, + backupManaged_: { type: Boolean, value: false, @@ -149,7 +149,6 @@ this.crosEulaLoading_ = false; this.arcTosLoading_ = false; this.privacyPolicyLoading_ = false; - this.isOwnerLoading_ = true; } /** Overridden from LoginScreenBehavior. */ @@ -158,7 +157,6 @@ return ['setUsageMode', 'setBackupMode', 'setLocationMode', - 'setIsDeviceOwner', 'setUsageOptinHidden', ]; } @@ -201,8 +199,8 @@ this.countryCode_ = data['countryCode']; if (this.isDemo_) { - this.isOwner_ = true; - this.isOwnerLoading_ = false; + this.usageOptinHidden_ = false; + this.usageOptinHiddenLoading_ = false; } // If the ToS section is hidden, apply the remove the top border of the @@ -399,7 +397,7 @@ maybeSetLoadedStep_() { if (!this.googleEulaLoading_ && !this.arcTosLoading_ && - !this.isOwnerLoading_ && + !this.usageOptinHiddenLoading_ && this.uiStep == ConsolidatedConsentScreenState.LOADING) { this.setUIStep(ConsolidatedConsentScreenState.LOADED); this.$.acceptButton.focus(); @@ -514,57 +512,28 @@ return this.i18n('consolidatedConsentHeader'); } - getUsageText_(locale, isChildAccount, isArcEnabled, isDemo, isOwner) { + getUsageText_(locale, isChildAccount, isArcEnabled, isDemo) { if (this.isArcOptInsHidden_(isArcEnabled, isDemo)) { - if (isOwner) { - return this.i18n('consolidatedConsentUsageOptInArcDisabledOwner'); - } return this.i18n('consolidatedConsentUsageOptInArcDisabled'); } - if (isChildAccount) { - if (isOwner) { - return this.i18n('consolidatedConsentUsageOptInChildOwner'); - } return this.i18n('consolidatedConsentUsageOptInChild'); } - - if (isOwner) { - return this.i18n('consolidatedConsentUsageOptInOwner'); - } return this.i18n('consolidatedConsentUsageOptIn'); } - getUsageLearnMoreText_( - locale, isChildAccount, isArcEnabled, isDemo, isOwner) { + getUsageLearnMoreText_(locale, isChildAccount, isArcEnabled, isDemo) { if (this.isArcOptInsHidden_(isArcEnabled, isDemo)) { if (isChildAccount) { - if (isOwner) { - return this.i18nAdvanced( - 'consolidatedConsentUsageOptInLearnMoreArcDisabledChildOwner'); - } return this.i18nAdvanced( 'consolidatedConsentUsageOptInLearnMoreArcDisabledChild'); } - - if (isOwner) { - return this.i18nAdvanced( - 'consolidatedConsentUsageOptInLearnMoreArcDisabledOwner'); - } return this.i18nAdvanced( 'consolidatedConsentUsageOptInLearnMoreArcDisabled'); } if (isChildAccount) { - if (isOwner) { - return this.i18nAdvanced( - 'consolidatedConsentUsageOptInLearnMoreChildOwner'); - } return this.i18nAdvanced('consolidatedConsentUsageOptInLearnMoreChild'); } - - if (isOwner) { - return this.i18nAdvanced('consolidatedConsentUsageOptInLearnMoreOwner'); - } return this.i18nAdvanced('consolidatedConsentUsageOptInLearnMore'); } @@ -598,10 +567,14 @@ } /** - * Hides the entire usage opt-in. + * Sets the hidden property of the usage opt-in. + * @param {boolean} hidden Defines the value used for the hidden propoerty of + * the usage opt-in. */ - setUsageOptinHidden() { - this.usageOptinHidden_ = true; + setUsageOptinHidden(hidden) { + this.usageOptinHidden_ = hidden; + this.usageOptinHiddenLoading_ = false; + this.maybeSetLoadedStep_(); } /** @@ -625,17 +598,6 @@ } /** - * Sets isOwner_ property. - * @param {boolean} isOwner Defines whether the current user is the device - * owner. - */ - setIsDeviceOwner(isOwner) { - this.isOwner_ = isOwner; - this.isOwnerLoading_ = false; - this.maybeSetLoadedStep_(); - } - - /** * Opens external URL in popup overlay. * @param {string} targetUrl to show in overlay webview. */
diff --git a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html index e72837f..5fbdd30 100644 --- a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html +++ b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html
@@ -52,7 +52,8 @@ --cr-input-underline-display: none; } - :host([dialog-mode='edit']) settings-textarea { + :host([dialog-mode='edit']) settings-textarea, + :host([dialog-mode='add']) settings-textarea { --settings-textarea-footer-display: flex; } </style>
diff --git a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts index 1f785ac5..ab92549 100644 --- a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts
@@ -382,11 +382,13 @@ private shouldShowNote_(): boolean { return this.isPasswordNotesEnabled_ && (this.dialogMode === PasswordDialogMode.PASSWORD_VIEW || - this.dialogMode === PasswordDialogMode.EDIT); + this.dialogMode === PasswordDialogMode.EDIT || + this.dialogMode === PasswordDialogMode.ADD); } private isNoteLongerThanOrEqualTo_(characterCount: number): boolean { - return this.dialogMode === PasswordDialogMode.EDIT && + return (this.dialogMode === PasswordDialogMode.EDIT || + this.dialogMode === PasswordDialogMode.ADD) && this.note_.length >= characterCount; } @@ -548,6 +550,7 @@ url: this.$.websiteInput.value, username: this.username_, password: this.password_, + note: this.note_, useAccountStore: useAccountStore }) .finally(() => {
diff --git a/chrome/browser/resources/settings/autofill_page/password_list_item.html b/chrome/browser/resources/settings/autofill_page/password_list_item.html index daccfc8..d73dd37 100644 --- a/chrome/browser/resources/settings/autofill_page/password_list_item.html +++ b/chrome/browser/resources/settings/autofill_page/password_list_item.html
@@ -59,6 +59,7 @@ </div> <input id="username" class="username-column password-field" aria-label="$i18n{editPasswordUsernameLabel}" + disabled$="[[shouldShowSubpageButton_]]" readonly value="[[entry.username]]" title="[[entry.username]]" focus-row-control focus-type="username"> <div class="password-column"> @@ -88,7 +89,8 @@ <cr-icon-button id="seePasswordDetails" class="subpage-arrow" hidden$="[[!shouldShowSubpageButton_]]" title="$i18n{passwordDetailsTitle}" - focus-row-control focus-type="seePasswordDetails"> + focus-row-control focus-type="seePasswordDetails" + aria-label$="[[getSubpageLabel_(entry)]]"> </cr-icon-button> <cr-icon-button id="moreActionsButton" class="icon-more-vert" hidden$="[[shouldHideMoreActionsButton_(
diff --git a/chrome/browser/resources/settings/autofill_page/password_list_item.ts b/chrome/browser/resources/settings/autofill_page/password_list_item.ts index f3e69940..e0df396 100644 --- a/chrome/browser/resources/settings/autofill_page/password_list_item.ts +++ b/chrome/browser/resources/settings/autofill_page/password_list_item.ts
@@ -138,6 +138,15 @@ 'passwordRowMoreActionsButton', this.entry.username, this.entry.urls.shown); } + + /** + * Get the aria label for the password details subpage. + */ + private getSubpageLabel_(): string { + return loadTimeData.getStringF( + 'passwordRowPasswordDetailPageButton', this.entry.username, + this.entry.urls.shown); + } } declare global {
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.html b/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.html index 9797056..5e588a734 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.html
@@ -35,6 +35,11 @@ width: 354px; } + :host-context([is-no-link-layout]) #picture-container { + margin-block-end: 32px; + margin-block-start: 24px; + } + .picture-shapes-container { --shape-color-green: rgba(71, 166, 86, 1); --shape-color-red: rgba(255, 127, 116, 1);
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.ts b/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.ts index 483042e6..a89dd83e 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.ts +++ b/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.ts
@@ -39,10 +39,16 @@ static get properties() { return { + isNoLinkLayout: { + reflectToAttribute: true, + type: Boolean, + computed: + 'computeIsNoLinkLayout_(shouldShowWaa_, shouldShowPrivacySandbox_)', + }, + subheader_: { type: String, - computed: - 'computeSubheader_(shouldShowWaa_, shouldShowPrivacySandbox_)', + computed: 'computeSubheader_(isNoLinkLayout)', }, shouldShowPrivacySandbox_: { @@ -81,10 +87,14 @@ this.shadowRoot!.querySelector<HTMLElement>('[focus-element]')!.focus(); } + private computeIsNoLinkLayout_() { + return !this.shouldShowWaa_ && !this.shouldShowPrivacySandbox_; + } + private computeSubheader_(): string { - return (this.shouldShowWaa_ || this.shouldShowPrivacySandbox_) ? - this.i18n('privacyGuideCompletionCardSubHeader') : - this.i18n('privacyGuideCompletionCardSubHeaderNoLinks'); + return this.computeIsNoLinkLayout_() ? + this.i18n('privacyGuideCompletionCardSubHeaderNoLinks') : + this.i18n('privacyGuideCompletionCardSubHeader'); } /**
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 65a57c7..5432acc2 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1732,6 +1732,7 @@ "//chrome/app/vector_icons", "//chrome/browser:browser_themes", "//chrome/browser:theme_properties", + "//chrome/browser/ash/system_web_apps/types:types", "//chrome/browser/browsing_data:constants", "//chrome/browser/cart:mojo_bindings", "//chrome/browser/image_editor", @@ -5248,6 +5249,7 @@ "//apps", "//chrome/browser/apps/platform_apps", # TODO(loyso): Remove this dep. "//chrome/browser/apps/platform_apps/api", + "//chrome/browser/ash/system_web_apps/types:types", "//chrome/browser/extensions", "//chrome/browser/web_share_target", "//chrome/common/extensions/api",
diff --git a/chrome/browser/ui/android/overlay/overlay_window_android.cc b/chrome/browser/ui/android/overlay/overlay_window_android.cc index fcea78a..a61bdf6 100644 --- a/chrome/browser/ui/android/overlay/overlay_window_android.cc +++ b/chrome/browser/ui/android/overlay/overlay_window_android.cc
@@ -40,11 +40,15 @@ surface_layer_->SetMayContainVideo(true); surface_layer_->SetBackgroundColor(SK_ColorBLACK); + gfx::Rect source_bounds = controller_->GetSourceBounds(); + JNIEnv* env = base::android::AttachCurrentThread(); Java_PictureInPictureActivity_createActivity( env, reinterpret_cast<intptr_t>(this), TabAndroid::FromWebContents(controller_->GetWebContents()) - ->GetJavaObject()); + ->GetJavaObject(), + source_bounds.x(), source_bounds.y(), source_bounds.width(), + source_bounds.height()); } OverlayWindowAndroid::~OverlayWindowAndroid() {
diff --git a/chrome/browser/ui/ash/system_tray_client_impl.cc b/chrome/browser/ui/ash/system_tray_client_impl.cc index ddb261f9..66b17ea 100644 --- a/chrome/browser/ui/ash/system_tray_client_impl.cc +++ b/chrome/browser/ui/ash/system_tray_client_impl.cc
@@ -185,7 +185,7 @@ ash::ManagementDeviceMode GetManagementDeviceMode( policy::BrowserPolicyConnectorAsh* connector) { - if (!connector->IsDeviceEnterpriseManaged()) + if (connector->IsDeviceEnterpriseManaged()) return ash::ManagementDeviceMode::kNone; if (connector->IsKioskEnrolled())
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc index 97aafaf..1923e04 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc
@@ -812,22 +812,6 @@ class MultiScreenFullscreenControllerInteractiveTest : public FullscreenControllerInteractiveTest { public: - void SetUp() override { -#if !BUILDFLAG(IS_CHROMEOS_ASH) - screen_.display_list().AddDisplay({1, gfx::Rect(100, 100, 801, 802)}, - display::DisplayList::Type::PRIMARY); - display::Screen::SetScreenInstance(&screen_); -#endif - FullscreenControllerInteractiveTest::SetUp(); - } - - void TearDown() override { - FullscreenControllerInteractiveTest::TearDown(); -#if !BUILDFLAG(IS_CHROMEOS_ASH) - display::Screen::SetScreenInstance(nullptr); -#endif - } - // Perform common setup operations for multi-screen fullscreen testing: // Mock a screen with two displays, move the browser onto the first display, // and auto-grant the Window Placement permission on its active tab. @@ -837,8 +821,12 @@ display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .UpdateDisplay("0+0-800x800,800+0-800x800"); #else + original_screen_ = display::Screen::GetScreen(); + screen_.display_list().AddDisplay({1, gfx::Rect(0, 0, 800, 800)}, + display::DisplayList::Type::PRIMARY); screen_.display_list().AddDisplay({2, gfx::Rect(800, 0, 800, 800)}, display::DisplayList::Type::NOT_PRIMARY); + display::Screen::SetScreenInstance(&screen_); #endif // BUILDFLAG(IS_CHROMEOS_ASH) EXPECT_EQ(2, display::Screen::GetScreen()->GetNumDisplays()); @@ -861,6 +849,14 @@ return tab; } + void TearDown() override { +#if !BUILDFLAG(IS_CHROMEOS_ASH) + if (original_screen_) + display::Screen::SetScreenInstance(original_screen_); +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) + FullscreenControllerInteractiveTest::TearDown(); + } + // Wait for a JS content fullscreen change with the given script and options. void RequestContentFullscreenFromScript( const std::string& eval_js_script, @@ -934,12 +930,14 @@ #if !BUILDFLAG(IS_CHROMEOS_ASH) display::DisplayList& display_list() { return screen_.display_list(); } #endif // !BUILDFLAG(IS_CHROMEOS_ASH) + private: base::test::ScopedFeatureList feature_list_{ blink::features::kWindowPlacement}; #if !BUILDFLAG(IS_CHROMEOS_ASH) + raw_ptr<display::Screen> original_screen_ = nullptr; display::ScreenBase screen_; -#endif +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) }; // TODO(crbug.com/1034772): Disabled on Windows, where views::FullscreenHandler
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view_unittest.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view_unittest.cc index 4f6c28fc..2ab3e82 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_result_view_unittest.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_result_view_unittest.cc
@@ -25,10 +25,6 @@ #include "ui/views/accessibility/view_accessibility.h" #include "ui/views/widget/widget.h" -#if defined(USE_AURA) -#include "ui/aura/env.h" -#endif - namespace { // An arbitrary index for the result view under test. Used to test the selection @@ -63,17 +59,19 @@ class OmniboxResultViewTest : public ChromeViewsTestBase { public: void SetUp() override { -#if !defined(USE_AURA) - test_screen_ = std::make_unique<display::test::TestScreen>(); - scoped_screen_override_ = - std::make_unique<display::test::ScopedScreenOverride>( - test_screen_.get()); -#endif ChromeViewsTestBase::SetUp(); // Create a widget and assign bounds to support calls to HitTestPoint. widget_ = CreateTestWidget(); + // Install |test_screen_| after superclass setup and widget creation; on Ash + // both these require the Screen to work well with the underlying Shell, and + // TestScreen has no knowledge of that. + test_screen_ = std::make_unique<display::test::TestScreen>(); + scoped_screen_override_ = + std::make_unique<display::test::ScopedScreenOverride>( + test_screen_.get()); + edit_model_ = std::make_unique<OmniboxEditModel>( nullptr, nullptr, std::make_unique<TestOmniboxClient>()); popup_view_ = @@ -91,10 +89,10 @@ } void TearDown() override { - widget_.reset(); - ChromeViewsTestBase::TearDown(); scoped_screen_override_.reset(); test_screen_.reset(); + widget_.reset(); + ChromeViewsTestBase::TearDown(); } // Also sets the fake screen's mouse cursor to 0, 0. @@ -107,11 +105,7 @@ int flags, float x, float y) { -#if !defined(USE_AURA) test_screen_->set_cursor_screen_point(gfx::Point(x, y)); -#else - aura::Env::GetInstance()->SetLastMouseLocation(gfx::Point(x, y)); -#endif return ui::MouseEvent(type, gfx::Point(x, y), gfx::Point(), ui::EventTimeForNow(), flags, 0); }
diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views_unittest.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views_unittest.cc index 4a8938d4..c27482be 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views_unittest.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views_unittest.cc
@@ -61,9 +61,11 @@ void ToggleMicrophone() override {} void ToggleCamera() override {} void HangUp() override {} + const gfx::Rect& GetSourceBounds() const override { return source_bounds_; } private: raw_ptr<content::WebContents> web_contents_; + gfx::Rect source_bounds_; }; class VideoOverlayWindowViewsTest : public ChromeViewsTestBase {
diff --git a/chrome/browser/ui/views/test/view_event_test_base.cc b/chrome/browser/ui/views/test/view_event_test_base.cc index fed341ee..54c917a 100644 --- a/chrome/browser/ui/views/test/view_event_test_base.cc +++ b/chrome/browser/ui/views/test/view_event_test_base.cc
@@ -14,13 +14,13 @@ #include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/testing_browser_process.h" #include "mojo/core/embedder/embedder.h" -#include "ui/display/screen.h" #include "ui/views/layout/fill_layout.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" #if defined(USE_AURA) && !BUILDFLAG(IS_CHROMEOS_ASH) +#include "ui/display/screen.h" #include "ui/views/widget/desktop_aura/desktop_screen.h" #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && defined(USE_OZONE) @@ -98,12 +98,13 @@ // TODO(pkasting): Determine why the TestScreen in AuraTestHelper is // insufficient for these tests, then either bolster/replace it or fix the // tests. - DCHECK(!display::Screen::HasScreen()); + DCHECK(!display::Screen::GetScreen()); #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && defined(USE_OZONE) - if (!display::Screen::HasScreen()) - screen_ = views::test::TestDesktopScreenOzone::Create(); + if (!display::Screen::GetScreen()) + display::Screen::SetScreenInstance( + views::test::TestDesktopScreenOzone::GetInstance()); #endif - if (!display::Screen::HasScreen()) + if (!display::Screen::GetScreen()) screen_ = views::CreateDesktopScreen(); #endif }
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index c33c681..c42d12be 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -66,8 +66,6 @@ #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" #include "chrome/browser/ui/webui/version/version_ui.h" #include "chrome/browser/ui/webui/webui_util.h" -#include "chrome/browser/web_applications/system_web_apps/system_web_app_manager.h" -#include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/common/buildflags.h" #include "chrome/common/chrome_features.h" #include "chrome/common/pref_names.h" @@ -165,6 +163,8 @@ #include "chrome/browser/ui/webui/tab_search/tab_search_ui.h" #include "chrome/browser/ui/webui/webui_gallery/webui_gallery_ui.h" #include "chrome/browser/ui/webui/whats_new/whats_new_ui.h" +#include "chrome/browser/web_applications/system_web_apps/system_web_app_manager.h" +#include "chrome/browser/web_applications/web_app_provider.h" #include "media/base/media_switches.h" #endif // BUILDFLAG(IS_ANDROID)
diff --git a/chrome/browser/ui/webui/chromeos/login/consolidated_consent_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/consolidated_consent_screen_handler.cc index 97455982..a8562975 100644 --- a/chrome/browser/ui/webui/chromeos/login/consolidated_consent_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/consolidated_consent_screen_handler.cc
@@ -51,16 +51,10 @@ builder->Add("consolidatedConsentUsageOptInTitle", IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_TITLE); builder->Add("consolidatedConsentUsageOptIn", - IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN); - builder->Add("consolidatedConsentUsageOptInOwner", IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_OWNER); builder->Add("consolidatedConsentUsageOptInChild", - IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_CHILD); - builder->Add("consolidatedConsentUsageOptInChildOwner", IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_CHILD_OWNER); builder->Add("consolidatedConsentUsageOptInArcDisabled", - IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_ARC_DISABLED); - builder->Add("consolidatedConsentUsageOptInArcDisabledOwner", IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_ARC_DISABLED_OWNER); builder->Add("consolidatedConsentUsageOptInLearnMoreLink", IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_LINK); @@ -84,23 +78,14 @@ builder->Add("consolidatedConsentFooterChild", IDS_CONSOLIDATED_CONSENT_FOOTER_CHILD); builder->Add("consolidatedConsentUsageOptInLearnMore", - IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE); - builder->Add("consolidatedConsentUsageOptInLearnMoreOwner", IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_OWNER); builder->Add("consolidatedConsentUsageOptInLearnMoreChild", - IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_CHILD); - builder->Add("consolidatedConsentUsageOptInLearnMoreChildOwner", IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_CHILD_OWNER); - builder->Add("consolidatedConsentUsageOptInLearnMoreArcDisabled", - IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED); builder->Add( - "consolidatedConsentUsageOptInLearnMoreArcDisabledOwner", + "consolidatedConsentUsageOptInLearnMoreArcDisabled", IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED_OWNER); builder->Add( "consolidatedConsentUsageOptInLearnMoreArcDisabledChild", - IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED_CHILD); - builder->Add( - "consolidatedConsentUsageOptInLearnMoreArcDisabledChildOwner", IDS_CONSOLIDATED_CONSENT_USAGE_OPT_IN_LEARN_MORE_ARC_DISABLED_CHILD_OWNER); builder->Add("consolidatedConsentBackupOptInLearnMore", IDS_CONSOLIDATED_CONSENT_BACKUP_OPT_IN_LEARN_MORE); @@ -206,11 +191,7 @@ CallJS("login.ConsolidatedConsentScreen.setLocationMode", enabled, managed); } -void ConsolidatedConsentScreenHandler::SetIsDeviceOwner(bool is_owner) { - CallJS("login.ConsolidatedConsentScreen.setIsDeviceOwner", is_owner); -} - -void ConsolidatedConsentScreenHandler::HideUsageOptin() { - CallJS("login.ConsolidatedConsentScreen.setUsageOptinHidden"); +void ConsolidatedConsentScreenHandler::SetUsageOptinOptinHidden(bool hidden) { + CallJS("login.ConsolidatedConsentScreen.setUsageOptinHidden", hidden); } } // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/consolidated_consent_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/consolidated_consent_screen_handler.h index 42daabd8..a785c2555 100644 --- a/chrome/browser/ui/webui/chromeos/login/consolidated_consent_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/consolidated_consent_screen_handler.h
@@ -62,10 +62,10 @@ virtual void SetUsageMode(bool enabled, bool managed) = 0; virtual void SetBackupMode(bool enabled, bool managed) = 0; virtual void SetLocationMode(bool enabled, bool managed) = 0; - virtual void SetIsDeviceOwner(bool is_owner) = 0; - // Hide the entire section that allows user to opt-in/opt-out from metrics. - virtual void HideUsageOptin() = 0; + // Set the visibility of the usage opt-in. For non-demo scenarios, the screen + // will stay in the `loading` step until this method is called. + virtual void SetUsageOptinOptinHidden(bool hidden) = 0; }; class ConsolidatedConsentScreenHandler : public ConsolidatedConsentScreenView, @@ -90,8 +90,7 @@ void SetUsageMode(bool enabled, bool managed) override; void SetBackupMode(bool enabled, bool managed) override; void SetLocationMode(bool enabled, bool managed) override; - void SetIsDeviceOwner(bool is_owner) override; - void HideUsageOptin() override; + void SetUsageOptinOptinHidden(bool hidden) override; // content::WebUIMessageHandler: void RegisterMessages() override;
diff --git a/chrome/browser/ui/webui/policy/policy_ui_handler.cc b/chrome/browser/ui/webui/policy/policy_ui_handler.cc index a18596b..3bc0789 100644 --- a/chrome/browser/ui/webui/policy/policy_ui_handler.cc +++ b/chrome/browser/ui/webui/policy/policy_ui_handler.cc
@@ -1094,9 +1094,6 @@ std::unique_ptr<base::DictionaryValue> device_status( new base::DictionaryValue); device_status_provider_->GetStatus(device_status.get()); - if (!device_domain_.empty()) - device_status->SetStringKey("domain", device_domain_); - std::string domain = device_domain_; std::unique_ptr<base::DictionaryValue> user_status(new base::DictionaryValue); user_status_provider_->GetStatus(user_status.get()); const std::string* username = user_status->FindStringKey("username");
diff --git a/chrome/browser/ui/webui/policy/policy_ui_handler.h b/chrome/browser/ui/webui/policy/policy_ui_handler.h index 46ef2d6..8b44c7c1 100644 --- a/chrome/browser/ui/webui/policy/policy_ui_handler.h +++ b/chrome/browser/ui/webui/policy/policy_ui_handler.h
@@ -134,8 +134,6 @@ void OnGotDevicePolicy(base::Value device_policy, base::Value legend_data); #endif // BUILDFLAG(IS_CHROMEOS_LACROS) - std::string device_domain_; - scoped_refptr<ui::SelectFileDialog> export_policies_select_file_dialog_; // Providers that supply status dictionaries for user and device policy,
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index 647b489..ba55900 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -1091,6 +1091,8 @@ {"passwordRowMoreActionsButton", IDS_SETTINGS_PASSWORD_ROW_MORE_ACTIONS}, {"passwordRowFederatedMoreActionsButton", IDS_SETTINGS_PASSWORD_ROW_FEDERATED_MORE_ACTIONS}, + {"passwordRowPasswordDetailPageButton", + IDS_SETTINGS_PASSWORD_ROW_PASSWORD_DETAIL_PAGE}, {"exportPasswordsTitle", IDS_SETTINGS_PASSWORDS_EXPORT_TITLE}, {"exportPasswordsDescription", IDS_SETTINGS_PASSWORDS_EXPORT_DESCRIPTION}, {"exportPasswords", IDS_SETTINGS_PASSWORDS_EXPORT},
diff --git a/chrome/browser/ui/window_sizer/DEPS b/chrome/browser/ui/window_sizer/DEPS index ea16c4459..046d8fd0 100644 --- a/chrome/browser/ui/window_sizer/DEPS +++ b/chrome/browser/ui/window_sizer/DEPS
@@ -1,5 +1,6 @@ specific_include_rules = { - ".*chromeos.*test.*": [ - "+ash", + ".*test.*": [ + "!ash", + "+ash/public", ], }
diff --git a/chrome/browser/ui/window_sizer/window_sizer_chromeos_unittest.cc b/chrome/browser/ui/window_sizer/window_sizer_chromeos_unittest.cc index 90696be..a29e51a 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_chromeos_unittest.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_chromeos_unittest.cc
@@ -5,8 +5,6 @@ #include "chrome/browser/ui/window_sizer/window_sizer_chromeos.h" #include "ash/public/cpp/window_properties.h" -#include "ash/root_window_controller.h" -#include "ash/shelf/shelf.h" #include "ash/shell.h" #include "base/command_line.h" #include "base/memory/ptr_util.h" @@ -47,30 +45,16 @@ void GetWindowBounds(const Browser* browser, const gfx::Rect& passed_in, int64_t display_id, - const gfx::Rect& bounds, - const gfx::Rect& work_area, - Source source, gfx::Rect* out_bounds) { auto state_provider = std::make_unique<TestStateProvider>(); - if (source == PERSISTED) { - state_provider->SetPersistentState(bounds, work_area, - ui::SHOW_STATE_DEFAULT); - } else { - DCHECK_EQ(source, DEFAULT); - } + state_provider->SetPersistentState(gfx::Rect(), gfx::Rect(), + ui::SHOW_STATE_DEFAULT); display::Screen::GetScreen()->SetDisplayForNewWindows(display_id); ui::WindowShowState ignored; WindowSizer::GetBrowserWindowBoundsAndShowState( std::move(state_provider), passed_in, browser, out_bounds, &ignored); } - void GetWindowBounds(const Browser* browser, - const gfx::Rect& passed_in, - int64_t display_id, - gfx::Rect* out_bounds = nullptr) { - GetWindowBounds(browser, passed_in, display_id, gfx::Rect(), gfx::Rect(), - PERSISTED, out_bounds); - } // Returns browser window |out_bounds| and |out_show_state| for simulated // persisted and last-active window bounds, work area, show state, etc. @@ -140,13 +124,9 @@ } // namespace -// WindowSizerChromeOSNoAshTest are the tests that does not require ash -// environment, thus it can use WindowSizerTestUtil that create a TestScreen -// inside. - // Test that the window is sized appropriately for the first run experience // where the default window bounds calculation is invoked. -TEST(WindowSizerChromeOSNoAshTest, DefaultSizeCase) { +TEST_F(WindowSizerChromeOSTest, DefaultSizeCase) { { // 4:3 monitor case, 1024x768, no taskbar. gfx::Rect window_bounds; @@ -257,7 +237,7 @@ // Test that the next opened window is positioned appropriately given the // bounds of an existing window of the same type. -TEST(WindowSizerChromeOS2NoAshTest, LastWindowBoundsCase) { +TEST_F(WindowSizerChromeOSTest, LastWindowBoundsCase) { { // Normal, in the middle of the screen somewhere. gfx::Rect window_bounds; @@ -314,8 +294,8 @@ } } -TEST(WindowSizerChromeOSNoAshTest, - LastWindowOffscreenWithNonAggressiveRepositioning) { +TEST_F(WindowSizerChromeOSTest, + LastWindowOffscreenWithNonAggressiveRepositioning) { { // Taskbar on left. gfx::Rect window_bounds; @@ -390,12 +370,6 @@ // Test the placement of newly created windows. TEST_F(WindowSizerChromeOSTest, PlaceNewWindows) { - UpdateDisplay("1600x1200"); - auto* shelf = ash::Shell::GetPrimaryRootWindowController()->shelf(); - shelf->SetAutoHideBehavior(ash::ShelfAutoHideBehavior::kAlways); - - int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); - // Create a browser to pass into the WindowSizerTestUtil::GetWindowBounds // function. Browser::CreateParams native_params(&profile_, true); @@ -421,9 +395,10 @@ Browser::CreateParams params_popup(Browser::TYPE_POPUP, &profile_, true); auto new_popup = CreateWindowlessBrowser(params_popup); gfx::Rect window_bounds; - GetWindowBounds(new_popup.get(), gfx::Rect(), display_id, - gfx::Rect(50, 100, 300, 150), bottom_s1600x1200, PERSISTED, - &window_bounds); + WindowSizerTestUtil::GetWindowBounds( + p1600x1200, p1600x1200, gfx::Rect(), gfx::Rect(50, 100, 300, 150), + bottom_s1600x1200, PERSISTED, new_popup.get(), gfx::Rect(), + &window_bounds); EXPECT_EQ("50,100 300x150", window_bounds.ToString()); } @@ -431,17 +406,19 @@ { // If a window is there but not shown the persisted default should be used. gfx::Rect window_bounds; - GetWindowBounds(browser.get(), gfx::Rect(), display_id, - gfx::Rect(50, 100, 300, 150), bottom_s1600x1200, PERSISTED, - &window_bounds); + WindowSizerTestUtil::GetWindowBounds( + p1600x1200, p1600x1200, gfx::Rect(), gfx::Rect(50, 100, 300, 150), + bottom_s1600x1200, PERSISTED, browser.get(), gfx::Rect(), + &window_bounds); EXPECT_EQ("50,100 300x150", window_bounds.ToString()); } { // If a window is there but not shown the default should be returned. gfx::Rect window_bounds; - GetWindowBounds(browser.get(), gfx::Rect(), display_id, gfx::Rect(), - bottom_s1600x1200, DEFAULT, &window_bounds); + WindowSizerTestUtil::GetWindowBounds( + p1600x1200, p1600x1200, gfx::Rect(), gfx::Rect(), bottom_s1600x1200, + DEFAULT, browser.get(), gfx::Rect(), &window_bounds); // Note: We need to also take the defaults maximum width into account here // since that might get used if the resolution is too big. EXPECT_EQ(
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index c749ca0..5ed62ce2a 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -5,24 +5,8 @@ import("//build/config/chromeos/ui_mode.gni") import("//chrome/browser/buildflags.gni") -group("web_app_group") { - public_configs = [ "//build/config/compiler:wexit_time_destructors" ] -} - -group("web_app_test_group") { -} - source_set("web_applications") { sources = [ - # TODO(crbug.com/1321984): Move system_web_app_delegate.cc/h and - # system_web_app_types.cc/h to /ash/system_web_apps/types/ - "../ash/system_web_apps/types/system_web_app_background_task_info.cc", - "../ash/system_web_apps/types/system_web_app_background_task_info.h", - "../ash/system_web_apps/types/system_web_app_delegate.cc", - "../ash/system_web_apps/types/system_web_app_delegate.h", - "../ash/system_web_apps/types/system_web_app_delegate_map.cc", - "../ash/system_web_apps/types/system_web_app_delegate_map.h", - "../ash/system_web_apps/types/system_web_app_type.h", "app_registrar_observer.h", "commands/callback_command.cc", "commands/callback_command.h", @@ -256,15 +240,21 @@ ] } + # Enable the "exit_time_destructors" warning here to avoid accidentally + # adding exit time destructors and because the flag is not enabled by default. + # TODO(http://crbug.com/101600): Remove once exit_time_destructors is enabled + # by default. + configs += [ "//build/config/compiler:wexit_time_destructors" ] + # web_applications must not depend on //chrome/browser/extensions and //extensions deps = [ - ":web_app_group", "//base", "//build:branding_buildflags", "//build:chromeos_buildflags", "//chrome/app/resources:platform_locale_settings", "//chrome/app/theme:chrome_unscaled_resources", "//chrome/browser:browser_process", + "//chrome/browser/ash/system_web_apps/types:types", "//chrome/browser/profiles:profile", "//chrome/common", "//chrome/common:non_code_constants", @@ -457,12 +447,12 @@ ] deps = [ - ":web_app_test_group", ":web_applications", "//base/test:test_support", "//chrome/app:command_ids", "//chrome/app/theme:chrome_unscaled_resources_grit", "//chrome/browser", + "//chrome/browser/ash/system_web_apps/types:types", "//chrome/browser/profiles:profile", "//chrome/browser/ui", "//components/crx_file:crx_file", @@ -569,7 +559,6 @@ } deps = [ - ":web_app_test_group", ":web_applications", ":web_applications_test_support", "//base/test:test_support", @@ -577,6 +566,7 @@ "//chrome/app/theme:theme_resources", "//chrome/browser", "//chrome/browser:browser_process", + "//chrome/browser/ash/system_web_apps/types:types", "//chrome/browser/extensions:test_support", "//chrome/browser/profiles:profile", "//chrome/browser/web_applications/extensions:extensions", @@ -652,7 +642,16 @@ ] } -source_set("web_applications_browser_tests") { +group("unit_tests") { + testonly = true + + deps = [ + ":web_applications_unit_tests", + "//chrome/browser/web_applications/extensions:unit_tests", + ] +} + +source_set("browser_tests") { testonly = true sources = [ @@ -731,25 +730,6 @@ } } -group("unit_tests") { - testonly = true - - deps = [ - ":web_app_test_group", - ":web_applications_unit_tests", - "//chrome/browser/web_applications/extensions:unit_tests", - ] -} - -group("browser_tests") { - testonly = true - - deps = [ - ":web_app_test_group", - ":web_applications_browser_tests", - ] -} - source_set("interactive_ui_tests") { testonly = true
diff --git a/chrome/browser/web_applications/extensions/BUILD.gn b/chrome/browser/web_applications/extensions/BUILD.gn index faff1a5..70ac10c 100644 --- a/chrome/browser/web_applications/extensions/BUILD.gn +++ b/chrome/browser/web_applications/extensions/BUILD.gn
@@ -24,12 +24,17 @@ ] } + # Enable the "exit_time_destructors" warning here to avoid accidentally + # adding exit time destructors and because the flag is not enabled by default. + # TODO(http://crbug.com/101600): Remove once exit_time_destructors is enabled + # by default. + configs += [ "//build/config/compiler:wexit_time_destructors" ] + deps = [ "//base", "//chrome/browser:browser_process", "//chrome/browser/profiles:profile", "//chrome/browser/web_applications", - "//chrome/browser/web_applications:web_app_group", "//chrome/common", "//components/pref_registry", "//components/services/app_service/public/mojom", @@ -54,7 +59,6 @@ deps = [ ":extensions", "//build:chromeos_buildflags", - "//chrome/browser/web_applications:web_app_test_group", "//chrome/browser/web_applications:web_applications", "//chrome/browser/web_applications:web_applications_test_support", "//chrome/common",
diff --git a/chrome/browser/window_placement/window_placement_printing_interactive_uitest.cc b/chrome/browser/window_placement/window_placement_printing_interactive_uitest.cc index b10fccc..8efceba 100644 --- a/chrome/browser/window_placement/window_placement_printing_interactive_uitest.cc +++ b/chrome/browser/window_placement/window_placement_printing_interactive_uitest.cc
@@ -25,15 +25,6 @@ class WindowPlacementTest : public InProcessBrowserTest { public: - void SetUp() override { -#if !BUILDFLAG(IS_CHROMEOS_ASH) - display::Screen::SetScreenInstance(&screen_); - screen_.display_list().AddDisplay({1, gfx::Rect(0, 0, 803, 600)}, - display::DisplayList::Type::PRIMARY); -#endif - InProcessBrowserTest::SetUp(); - } - void SetUpOnMainThread() override { // Window placement features are only available on secure contexts. https_test_server_ = std::make_unique<net::EmbeddedTestServer>( @@ -42,20 +33,10 @@ ASSERT_TRUE(https_test_server_->Start()); } - void TearDown() override { - InProcessBrowserTest::TearDown(); -#if !BUILDFLAG(IS_CHROMEOS_ASH) - display::Screen::SetScreenInstance(nullptr); -#endif - } - protected: std::unique_ptr<net::EmbeddedTestServer> https_test_server_; base::test::ScopedFeatureList scoped_feature_list_{ blink::features::kWindowPlacement}; -#if !BUILDFLAG(IS_CHROMEOS_ASH) - display::ScreenBase screen_; -#endif }; // TODO(crbug.com/1042990): Windows crashes static casting to ScreenWin. @@ -75,6 +56,11 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .UpdateDisplay("0+0-803x600"); +#else + display::ScreenBase screen; + screen.display_list().AddDisplay({1, gfx::Rect(0, 0, 803, 600)}, + display::DisplayList::Type::PRIMARY); + display::test::ScopedScreenOverride screen_override(&screen); #endif // BUILDFLAG(IS_CHROMEOS_ASH) ASSERT_EQ(1, display::Screen::GetScreen()->GetNumDisplays()); @@ -113,9 +99,9 @@ display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .UpdateDisplay("0+0-807x600"); #else - screen_.display_list().UpdateDisplay({1, gfx::Rect(0, 0, 807, 600)}, - display::DisplayList::Type::PRIMARY); - EXPECT_EQ(screen_.display_list().displays().size(), 1u); + screen.display_list().UpdateDisplay({1, gfx::Rect(0, 0, 807, 600)}, + display::DisplayList::Type::PRIMARY); + EXPECT_EQ(screen.display_list().displays().size(), 1u); #endif // BUILDFLAG(IS_CHROMEOS_ASH) ASSERT_EQ(1, display::Screen::GetScreen()->GetNumDisplays()); @@ -130,9 +116,9 @@ display::test::DisplayManagerTestApi(ash::Shell::Get()->display_manager()) .UpdateDisplay("0+0-807x600,1000+0-804x600"); #else - screen_.display_list().AddDisplay({2, gfx::Rect(1000, 0, 804, 600)}, - display::DisplayList::Type::NOT_PRIMARY); - EXPECT_EQ(screen_.display_list().displays().size(), 2u); + screen.display_list().AddDisplay({2, gfx::Rect(1000, 0, 804, 600)}, + display::DisplayList::Type::NOT_PRIMARY); + EXPECT_EQ(screen.display_list().displays().size(), 2u); #endif // BUILDFLAG(IS_CHROMEOS_ASH) ASSERT_EQ(2, display::Screen::GetScreen()->GetNumDisplays());
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 2ca5cd8..10d2057 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1653004718-550f92d458d9543873af601aef4d70240f640880.profdata +chrome-linux-main-1653026321-56058a65660a1e8c5c1acd5baf277d73d380c9ff.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index c99bdfb1..5b34553 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1653004718-e355640cf3224109cd9cf7dc418dc3bc876c4f5b.profdata +chrome-mac-arm-main-1653026321-038c9a324ff992d69ee7a493c83135bbb1a06d31.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index f48da14e..c9c8400 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1653004718-c2ca067c3647bbce4d00287f02758d82633f0fa9.profdata +chrome-mac-main-1653026321-ae0a9bfb8ad9306ce7f1d253a3b6d2bd07764ffb.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index aee8e8a..b412e41 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1653004718-c2433064b36fa3564a7f8b552448083cded1b1fc.profdata +chrome-win32-main-1653026321-bdaf5d68e234969e9204bf13c62b5276d242dda8.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index b40073c67..983c810 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1653004718-61b6082e36edd8b9bd57650fde09bf7ab12acb8e.profdata +chrome-win64-main-1653035902-fd6d18881b36500cc3c73ceb4382e3a40f16f0f7.profdata
diff --git a/chrome/common/extensions/api/passwords_private.idl b/chrome/common/extensions/api/passwords_private.idl index 650eff9..c1e0c7d 100644 --- a/chrome/common/extensions/api/passwords_private.idl +++ b/chrome/common/extensions/api/passwords_private.idl
@@ -209,6 +209,9 @@ // The password value to be saved. DOMString password; + // The note attached the password. + DOMString note; + // True for account store, false for device store. boolean useAccountStore; };
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 39523f2..66783bd 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -4033,12 +4033,13 @@ "//ash/webui/shortcut_customization_ui", "//ash/webui/web_applications/test:test_support", "//chrome/browser/ash", + "//chrome/browser/ash:arc_test_support", "//chrome/browser/ash/crosapi", "//chrome/browser/ash/crosapi:test_support", "//chrome/browser/ash/system_extensions:browser_tests", + "//chrome/browser/ash/system_web_apps/types:types", "//chrome/browser/ash/wilco_dtc_supportd:mojo_utils", "//chrome/browser/chromeos", - "//chrome/browser/chromeos:arc_test_support", "//chrome/browser/chromeos:dlp_policy_event_proto", "//chrome/browser/chromeos:key_permissions_proto", "//chrome/browser/chromeos:test_support", @@ -7146,12 +7147,12 @@ "//ash/webui/projector_app/public/cpp", "//ash/webui/scanning", "//chrome/browser/ash", + "//chrome/browser/ash:arc_test_support", "//chrome/browser/ash/crosapi", "//chrome/browser/ash/crosapi:test_support", "//chrome/browser/ash/crosapi:unit_tests", "//chrome/browser/ash/system_extensions:unit_tests", "//chrome/browser/chromeos", - "//chrome/browser/chromeos:arc_test_support", "//chrome/browser/chromeos:test_support", "//chrome/browser/chromeos:unit_tests", "//chrome/browser/enterprise/connectors/device_trust/attestation/ash",
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index ec659c51..5c5e1d4 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc
@@ -119,10 +119,6 @@ #include "ui/events/test/event_generator.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(USE_OZONE) -#include "ui/views/test/test_desktop_screen_ozone.h" -#endif - #if defined(TOOLKIT_VIEWS) #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/tab.h" @@ -599,22 +595,6 @@ return true; } -void InProcessBrowserTest::SetScreenInstance() { - // TODO(crbug.com/1317416): On wayland platform, we need to check if the - // wayland-ozone platform is initialized at this point due to the async - // initialization of the display. Investigate if we can eliminate - // IsOzoneInitialized. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) - if (!display::Screen::HasScreen() && - views::test::TestDesktopScreenOzone::IsOzoneInitialized()) { - // This is necessary for interactive UI tests. - // It is enabled in interactive_ui_tests_main.cc - // (or through GPUMain) - screen_ = views::test::TestDesktopScreenOzone::Create(); - } -#endif -} - #if !BUILDFLAG(IS_MAC) void InProcessBrowserTest::OpenDevToolsWindow( content::WebContents* web_contents) {
diff --git a/chrome/test/base/in_process_browser_test.h b/chrome/test/base/in_process_browser_test.h index e154efc..b9ac30b 100644 --- a/chrome/test/base/in_process_browser_test.h +++ b/chrome/test/base/in_process_browser_test.h
@@ -52,10 +52,6 @@ } #endif // defined(TOOLKIT_VIEWS) -namespace display { -class Screen; -} - class Browser; #if BUILDFLAG(IS_CHROMEOS_LACROS) class FakeAccountManagerUI; @@ -229,7 +225,7 @@ [[nodiscard]] virtual bool SetUpUserDataDirectory(); // Initializes the display::Screen instance. - virtual void SetScreenInstance(); + virtual void SetScreenInstance() {} // BrowserTestBase: void PreRunTestOnMainThread() override; @@ -318,10 +314,6 @@ FakeAccountManagerUI* GetFakeAccountManagerUI() const; #endif // BUILDFLAG(IS_CHROMEOS_LACROS) -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) - std::unique_ptr<display::Screen> screen_; -#endif - private: void Initialize();
diff --git a/chrome/test/chromedriver/chrome/devtools_client_impl.cc b/chrome/test/chromedriver/chrome/devtools_client_impl.cc index 71ea4f0..4d286af 100644 --- a/chrome/test/chromedriver/chrome/devtools_client_impl.cc +++ b/chrome/test/chromedriver/chrome/devtools_client_impl.cc
@@ -79,12 +79,14 @@ const char DevToolsClientImpl::kBrowserwideDevToolsClientId[] = "browser"; -DevToolsClientImpl::DevToolsClientImpl(const SyncWebSocketFactory& factory, +DevToolsClientImpl::DevToolsClientImpl(const std::string& id, + const std::string& session_id, const std::string& url, - const std::string& id) + const SyncWebSocketFactory& factory) : socket_(factory.Run()), url_(url), owner_(nullptr), + session_id_(session_id), parent_(nullptr), crashed_(false), detached_(false), @@ -104,41 +106,15 @@ base::Unretained(this))); } -DevToolsClientImpl::DevToolsClientImpl( - const SyncWebSocketFactory& factory, - const std::string& url, - const std::string& id, - const FrontendCloserFunc& frontend_closer_func) - : socket_(factory.Run()), - url_(url), - owner_(nullptr), - parent_(nullptr), - crashed_(false), - detached_(false), - id_(id), - frontend_closer_func_(frontend_closer_func), - parser_func_(base::BindRepeating(&internal::ParseInspectorMessage)), - unnotified_event_(nullptr), - next_id_(1), - stack_count_(0) { - socket_->SetId(id_); - // If error happens during proactive event consumption we ignore it - // as there is no active user request where the error might be returned. - // Unretained 'this' won't cause any problems as we reset the callback in the - // .dtor. - socket_->SetNotificationCallback(base::BindRepeating( - base::IgnoreResult(&DevToolsClientImpl::HandleReceivedEvents), - base::Unretained(this))); -} - -DevToolsClientImpl::DevToolsClientImpl(DevToolsClientImpl* parent, - const std::string& session_id) +DevToolsClientImpl::DevToolsClientImpl(const std::string& id, + const std::string& session_id, + DevToolsClientImpl* parent) : owner_(nullptr), session_id_(session_id), parent_(parent), crashed_(false), detached_(false), - id_(session_id), + id_(id), frontend_closer_func_(base::BindRepeating(&FakeCloseFrontends)), parser_func_(base::BindRepeating(&internal::ParseInspectorMessage)), unnotified_event_(nullptr), @@ -147,34 +123,6 @@ parent->children_[session_id] = this; } -DevToolsClientImpl::DevToolsClientImpl( - const SyncWebSocketFactory& factory, - const std::string& url, - const std::string& id, - const FrontendCloserFunc& frontend_closer_func, - const ParserFunc& parser_func) - : socket_(factory.Run()), - url_(url), - owner_(nullptr), - parent_(nullptr), - crashed_(false), - detached_(false), - id_(id), - frontend_closer_func_(frontend_closer_func), - parser_func_(parser_func), - unnotified_event_(nullptr), - next_id_(1), - stack_count_(0) { - socket_->SetId(id_); - // If error happens during proactive event consumption we ignore it - // as there is no active user request where the error might be returned. - // Unretained 'this' won't cause any problems as we reset the callback in the - // .dtor. - socket_->SetNotificationCallback(base::BindRepeating( - base::IgnoreResult(&DevToolsClientImpl::HandleReceivedEvents), - base::Unretained(this))); -} - DevToolsClientImpl::~DevToolsClientImpl() { if (parent_ != nullptr) { parent_->children_.erase(session_id_); @@ -191,6 +139,11 @@ parser_func_ = parser_func; } +void DevToolsClientImpl::SetFrontendCloserFunc( + const FrontendCloserFunc& frontend_closer_func) { + frontend_closer_func_ = frontend_closer_func; +} + const std::string& DevToolsClientImpl::GetId() { return id_; } @@ -396,7 +349,7 @@ command.SetInteger("id", command_id); command.SetString("method", method); command.SetKey("params", params.Clone()); - if (parent_ != nullptr) { + if (!session_id_.empty()) { command.SetString("sessionId", session_id_); } std::string message = SerializeValue(&command);
diff --git a/chrome/test/chromedriver/chrome/devtools_client_impl.h b/chrome/test/chromedriver/chrome/devtools_client_impl.h index 1e6193d..9044810f 100644 --- a/chrome/test/chromedriver/chrome/devtools_client_impl.h +++ b/chrome/test/chromedriver/chrome/devtools_client_impl.h
@@ -55,17 +55,16 @@ public: static const char kBrowserwideDevToolsClientId[]; - DevToolsClientImpl(const SyncWebSocketFactory& factory, + DevToolsClientImpl(const std::string& id, + const std::string& session_id, const std::string& url, - const std::string& id); + const SyncWebSocketFactory& factory); typedef base::RepeatingCallback<Status()> FrontendCloserFunc; - DevToolsClientImpl(const SyncWebSocketFactory& factory, - const std::string& url, - const std::string& id, - const FrontendCloserFunc& frontend_closer_func); - DevToolsClientImpl(DevToolsClientImpl* parent, const std::string& session_id); + DevToolsClientImpl(const std::string& id, + const std::string& session_id, + DevToolsClientImpl* parent); typedef base::RepeatingCallback<bool(const std::string&, int, @@ -74,11 +73,6 @@ internal::InspectorEvent*, internal::InspectorCommandResponse*)> ParserFunc; - DevToolsClientImpl(const SyncWebSocketFactory& factory, - const std::string& url, - const std::string& id, - const FrontendCloserFunc& frontend_closer_func, - const ParserFunc& parser_func); DevToolsClientImpl(const DevToolsClientImpl&) = delete; DevToolsClientImpl& operator=(const DevToolsClientImpl&) = delete; @@ -86,6 +80,7 @@ ~DevToolsClientImpl() override; void SetParserFuncForTesting(const ParserFunc& parser_func); + void SetFrontendCloserFunc(const FrontendCloserFunc& frontend_closer_func); // Overridden from DevToolsClient: const std::string& GetId() override;
diff --git a/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc b/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc index 2edb39eb..1d90c4d 100644 --- a/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc +++ b/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc
@@ -25,11 +25,6 @@ #include "url/gurl.h" namespace { - -Status CloserFunc() { - return Status(kOk); -} - class MockSyncWebSocket : public SyncWebSocket { public: MockSyncWebSocket() @@ -161,8 +156,7 @@ TEST_F(DevToolsClientImplTest, SendCommand) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); base::DictionaryValue params; params.GetDict().Set("param", 1); @@ -172,8 +166,7 @@ TEST_F(DevToolsClientImplTest, SendCommandAndGetResult) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); base::DictionaryValue params; params.GetDict().Set("param", 1); @@ -216,8 +209,7 @@ TEST_F(DevToolsClientImplTest, ConnectIfNecessaryConnectFails) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket2>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kDisconnected, client.ConnectIfNecessary().code()); } @@ -272,8 +264,7 @@ TEST_F(DevToolsClientImplTest, SendCommandSendFails) { SyncWebSocketFactory factory = base::BindRepeating( &CreateMockSyncWebSocket_B<MockSyncWebSocket3>, false); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); base::DictionaryValue params; ASSERT_TRUE(client.SendCommand("method", params).IsError()); @@ -282,8 +273,7 @@ TEST_F(DevToolsClientImplTest, SendCommandReceiveNextMessageFails) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket_B<MockSyncWebSocket3>, true); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); base::DictionaryValue params; ASSERT_TRUE(client.SendCommand("method", params).IsError()); @@ -492,9 +482,8 @@ TEST_F(DevToolsClientImplTest, SendCommandOnlyConnectsOnce) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<FakeSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc), - base::BindRepeating(&ReturnCommand)); + DevToolsClientImpl client("id", "", "http://url", factory); + client.SetParserFuncForTesting(base::BindRepeating(&ReturnCommand)); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); base::DictionaryValue params; ASSERT_TRUE(client.SendCommand("method", params).IsOk()); @@ -504,8 +493,7 @@ TEST_F(DevToolsClientImplTest, SendCommandBadResponse) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<FakeSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); client.SetParserFuncForTesting(base::BindRepeating(&ReturnBadResponse)); base::DictionaryValue params; @@ -515,8 +503,7 @@ TEST_F(DevToolsClientImplTest, SendCommandBadId) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<FakeSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); client.SetParserFuncForTesting(base::BindRepeating(&ReturnCommandBadId)); base::DictionaryValue params; @@ -526,8 +513,7 @@ TEST_F(DevToolsClientImplTest, SendCommandResponseError) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<FakeSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); client.SetParserFuncForTesting(base::BindRepeating(&ReturnCommandError)); base::DictionaryValue params; @@ -539,8 +525,7 @@ base::BindRepeating(&CreateMockSyncWebSocket<FakeSyncWebSocket>); MockListener listener; bool first = true; - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); client.AddListener(&listener); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); client.SetParserFuncForTesting( @@ -711,8 +696,7 @@ MockListener listener; SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); client.AddListener(&listener); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); client.SetParserFuncForTesting(base::BindRepeating(&ReturnEvent)); @@ -724,8 +708,7 @@ TEST_F(DevToolsClientImplTest, HandleEventsUntilTimeout) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); client.SetParserFuncForTesting(base::BindRepeating(&ReturnEvent)); Status status = client.HandleEventsUntil(base::BindRepeating(&AlwaysTrue), @@ -736,9 +719,8 @@ TEST_F(DevToolsClientImplTest, WaitForNextEventCommand) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc), - base::BindRepeating(&ReturnCommand)); + DevToolsClientImpl client("id", "", "http://url", factory); + client.SetParserFuncForTesting(base::BindRepeating(&ReturnCommand)); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); Status status = client.HandleEventsUntil(base::BindRepeating(&AlwaysTrue), Timeout(long_timeout_)); @@ -748,8 +730,7 @@ TEST_F(DevToolsClientImplTest, WaitForNextEventError) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); client.SetParserFuncForTesting(base::BindRepeating(&ReturnError)); Status status = client.HandleEventsUntil(base::BindRepeating(&AlwaysTrue), @@ -760,8 +741,7 @@ TEST_F(DevToolsClientImplTest, WaitForNextEventConditionalFuncReturnsError) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); client.SetParserFuncForTesting(base::BindRepeating(&ReturnEvent)); Status status = client.HandleEventsUntil(base::BindRepeating(&AlwaysError), @@ -773,8 +753,7 @@ SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket>); int recurse_count = 0; - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); client.SetParserFuncForTesting( base::BindRepeating(&ReturnOutOfOrderResponses, &recurse_count, &client)); @@ -892,8 +871,7 @@ TEST_F(DevToolsClientImplTest, ProcessOnConnectedFirstOnCommand) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<OnConnectedSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "onconnected-id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("onconnected-id", "", "http://url", factory); OnConnectedListener listener1("DOM.getDocument", &client); OnConnectedListener listener2("Runtime.enable", &client); OnConnectedListener listener3("Page.enable", &client); @@ -908,8 +886,7 @@ TEST_F(DevToolsClientImplTest, ProcessOnConnectedFirstOnHandleEventsUntil) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<OnConnectedSyncWebSocket>); - DevToolsClientImpl client(factory, "http://url", "onconnected-id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("onconnected-id", "", "http://url", factory); OnConnectedListener listener1("DOM.getDocument", &client); OnConnectedListener listener2("Runtime.enable", &client); OnConnectedListener listener3("Page.enable", &client); @@ -1000,8 +977,7 @@ TEST_F(DevToolsClientImplTest, ProcessOnEventFirst) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket5>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); OtherEventListener listener2; OnEventListener listener1(&client, &listener2); client.AddListener(&listener1); @@ -1056,8 +1032,8 @@ SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<DisconnectedSyncWebSocket>); bool is_called = false; - DevToolsClientImpl client( - factory, "http://url", "id", + DevToolsClientImpl client("id", "", "http://url", factory); + client.SetFrontendCloserFunc( base::BindRepeating(&CheckCloserFuncCalled, &is_called)); ASSERT_FALSE(is_called); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); @@ -1142,8 +1118,7 @@ std::list<std::string> msgs; SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket6, &msgs); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); msgs.push_back( "{\"method\": \"Page.javascriptDialogOpening\", \"params\": {}}"); msgs.push_back("{\"id\": 2, \"result\": {}}"); @@ -1173,8 +1148,7 @@ std::list<std::string> msgs; SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket6, &msgs); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); MockDevToolsEventListener listener; client.AddListener(&listener); msgs.push_back("{\"method\": \"FirstEvent\", \"params\": {}}"); @@ -1229,8 +1203,7 @@ std::list<std::string> msgs; SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket6, &msgs); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); MockCommandListener listener1; listener1.callback_ = base::BindRepeating(&HandleReceivedEvents); MockCommandListener listener2; @@ -1306,8 +1279,7 @@ TEST_F(DevToolsClientImplTest, SendCommandAndIgnoreResponse) { SyncWebSocketFactory factory = base::BindRepeating(&CreateMockSyncWebSocket<MockSyncWebSocket7>); - DevToolsClientImpl client(factory, "http://url", "id", - base::BindRepeating(&CloserFunc)); + DevToolsClientImpl client("id", "", "http://url", factory); ASSERT_EQ(kOk, client.ConnectIfNecessary().code()); base::DictionaryValue params; params.GetDict().Set("param", 1);
diff --git a/chrome/test/chromedriver/chrome/devtools_http_client.cc b/chrome/test/chromedriver/chrome/devtools_http_client.cc index aa0e6dc..45e5a95 100644 --- a/chrome/test/chromedriver/chrome/devtools_http_client.cc +++ b/chrome/test/chromedriver/chrome/devtools_http_client.cc
@@ -4,6 +4,7 @@ #include "chrome/test/chromedriver/chrome/devtools_http_client.h" +#include <memory> #include <utility> #include "base/bind.h" @@ -112,10 +113,11 @@ std::unique_ptr<DevToolsClient> DevToolsHttpClient::CreateClient( const std::string& id) { - return std::unique_ptr<DevToolsClient>(new DevToolsClientImpl( - socket_factory_, endpoint_.GetDebuggerUrl(id), id, - base::BindRepeating(&DevToolsHttpClient::CloseFrontends, - base::Unretained(this), id))); + auto result = std::make_unique<DevToolsClientImpl>( + id, "", endpoint_.GetDebuggerUrl(id), socket_factory_); + result->SetFrontendCloserFunc(base::BindRepeating( + &DevToolsHttpClient::CloseFrontends, base::Unretained(this), id)); + return result; } Status DevToolsHttpClient::CloseWebView(const std::string& id) { @@ -197,7 +199,7 @@ for (std::list<std::string>::const_iterator it = docked_frontend_ids.begin(); it != docked_frontend_ids.end(); ++it) { std::unique_ptr<DevToolsClient> client(new DevToolsClientImpl( - socket_factory_, endpoint_.GetDebuggerUrl(*it), *it)); + *it, "", endpoint_.GetDebuggerUrl(*it), socket_factory_)); std::unique_ptr<WebViewImpl> web_view( new WebViewImpl(*it, false, nullptr, &browser_info_, std::move(client), nullptr, page_load_strategy_));
diff --git a/chrome/test/chromedriver/chrome/stub_web_view.cc b/chrome/test/chromedriver/chrome/stub_web_view.cc index 8ddae5e..c7fbd72 100644 --- a/chrome/test/chromedriver/chrome/stub_web_view.cc +++ b/chrome/test/chromedriver/chrome/stub_web_view.cc
@@ -259,10 +259,6 @@ return false; } -bool StubWebView::IsOOPIF(const std::string& frame_id) { - return false; -} - FrameTracker* StubWebView::GetFrameTracker() const { return nullptr; }
diff --git a/chrome/test/chromedriver/chrome/stub_web_view.h b/chrome/test/chromedriver/chrome/stub_web_view.h index 54681dc..f51c54b 100644 --- a/chrome/test/chromedriver/chrome/stub_web_view.h +++ b/chrome/test/chromedriver/chrome/stub_web_view.h
@@ -124,7 +124,6 @@ int xoffset, int yoffset) override; bool IsNonBlocking() const override; - bool IsOOPIF(const std::string& frame_id) override; FrameTracker* GetFrameTracker() const override; std::unique_ptr<base::Value> GetCastSinks() override; std::unique_ptr<base::Value> GetCastIssueMessage() override;
diff --git a/chrome/test/chromedriver/chrome/web_view.h b/chrome/test/chromedriver/chrome/web_view.h index 5429825b..923a2161 100644 --- a/chrome/test/chromedriver/chrome/web_view.h +++ b/chrome/test/chromedriver/chrome/web_view.h
@@ -263,8 +263,6 @@ virtual bool IsNonBlocking() const = 0; - virtual bool IsOOPIF(const std::string& frame_id) = 0; - virtual FrameTracker* GetFrameTracker() const = 0; virtual std::unique_ptr<base::Value> GetCastSinks() = 0;
diff --git a/chrome/test/chromedriver/chrome/web_view_impl.cc b/chrome/test/chromedriver/chrome/web_view_impl.cc index 89001672c..2f5af109 100644 --- a/chrome/test/chromedriver/chrome/web_view_impl.cc +++ b/chrome/test/chromedriver/chrome/web_view_impl.cc
@@ -389,7 +389,8 @@ DevToolsClientImpl* root_client = static_cast<DevToolsClientImpl*>(client_.get()->GetRootClient()); std::unique_ptr<DevToolsClient> child_client( - std::make_unique<DevToolsClientImpl>(root_client, session_id)); + std::make_unique<DevToolsClientImpl>(session_id, session_id, + root_client)); WebViewImpl* child = new WebViewImpl( target_id, w3c_compliant_, this, browser_info_, std::move(child_client), nullptr, @@ -1457,11 +1458,6 @@ return parent_->IsNonBlocking(); } -bool WebViewImpl::IsOOPIF(const std::string& frame_id) { - WebView* target = GetTargetForFrame(this, frame_id); - return target != nullptr && frame_id == target->GetId(); -} - FrameTracker* WebViewImpl::GetFrameTracker() const { return frame_tracker_.get(); }
diff --git a/chrome/test/chromedriver/chrome/web_view_impl.h b/chrome/test/chromedriver/chrome/web_view_impl.h index d93766b..ffe361f 100644 --- a/chrome/test/chromedriver/chrome/web_view_impl.h +++ b/chrome/test/chromedriver/chrome/web_view_impl.h
@@ -174,7 +174,6 @@ const base::Value& element, int* backend_node_id) override; bool IsNonBlocking() const override; - bool IsOOPIF(const std::string& frame_id) override; FrameTracker* GetFrameTracker() const override; std::unique_ptr<base::Value> GetCastSinks() override; std::unique_ptr<base::Value> GetCastIssueMessage() override;
diff --git a/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc b/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc index 8019b5d..000e9c5 100644 --- a/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc +++ b/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc
@@ -246,7 +246,7 @@ &CreateMockSyncWebSocket, SyncWebSocket::StatusCode::kOk); // CreateChild relies on client_ being a DevToolsClientImpl, so no mocking std::unique_ptr<DevToolsClientImpl> client_uptr = - std::make_unique<DevToolsClientImpl>(factory, "http://url", "id"); + std::make_unique<DevToolsClientImpl>("id", "", "http://url", factory); DevToolsClientImpl* client_ptr = client_uptr.get(); BrowserInfo browser_info; WebViewImpl level1(client_ptr->GetId(), true, nullptr, &browser_info, @@ -267,7 +267,7 @@ &CreateMockSyncWebSocket, SyncWebSocket::StatusCode::kOk); // CreateChild relies on client_ being a DevToolsClientImpl, so no mocking std::unique_ptr<DevToolsClientImpl> client_uptr = - std::make_unique<DevToolsClientImpl>(factory, "http://url", "id"); + std::make_unique<DevToolsClientImpl>("id", "", "http://url", factory); DevToolsClientImpl* client_ptr = client_uptr.get(); BrowserInfo browser_info; WebViewImpl parent_view(client_ptr->GetId(), true, nullptr, &browser_info, @@ -287,7 +287,7 @@ &CreateMockSyncWebSocket, SyncWebSocket::StatusCode::kOk); // CreateChild relies on client_ being a DevToolsClientImpl, so no mocking std::unique_ptr<DevToolsClientImpl> client_uptr = - std::make_unique<DevToolsClientImpl>(factory, "http://url", "id"); + std::make_unique<DevToolsClientImpl>("id", "", "http://url", factory); DevToolsClientImpl* client_ptr = client_uptr.get(); BrowserInfo browser_info; WebViewImpl parent_view(client_ptr->GetId(), true, nullptr, &browser_info, @@ -305,7 +305,7 @@ &CreateMockSyncWebSocket, SyncWebSocket::StatusCode::kTimeout); // CreateChild relies on client_ being a DevToolsClientImpl, so no mocking std::unique_ptr<DevToolsClientImpl> client_uptr = - std::make_unique<DevToolsClientImpl>(factory, "http://url", "id"); + std::make_unique<DevToolsClientImpl>("id", "", "http://url", factory); DevToolsClientImpl* client_ptr = client_uptr.get(); BrowserInfo browser_info; WebViewImpl parent_view(client_ptr->GetId(), true, nullptr, &browser_info, @@ -325,7 +325,7 @@ &CreateMockSyncWebSocket, SyncWebSocket::StatusCode::kOk); // CreateChild relies on client_ being a DevToolsClientImpl, so no mocking std::unique_ptr<DevToolsClientImpl> client_uptr = - std::make_unique<DevToolsClientImpl>(factory, "http://url", "id"); + std::make_unique<DevToolsClientImpl>("id", "", "http://url", factory); DevToolsClientImpl* client_ptr = client_uptr.get(); BrowserInfo browser_info; WebViewImpl parent_view(client_ptr->GetId(), true, nullptr, &browser_info,
diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc index 8f97a93..756410a 100644 --- a/chrome/test/chromedriver/chrome_launcher.cc +++ b/chrome/test/chromedriver/chrome_launcher.cc
@@ -352,8 +352,9 @@ if (url.length() == 0) { url = endpoint.GetBrowserDebuggerUrl(); } - std::unique_ptr<DevToolsClient> client(new DevToolsClientImpl( - socket_factory, url, DevToolsClientImpl::kBrowserwideDevToolsClientId)); + std::unique_ptr<DevToolsClient> client( + new DevToolsClientImpl(DevToolsClientImpl::kBrowserwideDevToolsClientId, + "", url, socket_factory)); for (const auto& listener : devtools_event_listeners) { // Only add listeners that subscribe to the browser-wide |DevToolsClient|. // Otherwise, listeners will think this client is associated with a webview,
diff --git a/chrome/test/data/extensions/api_test/passwords_private/test.js b/chrome/test/data/extensions/api_test/passwords_private/test.js index d27cdf2..964b7e7 100644 --- a/chrome/test/data/extensions/api_test/passwords_private/test.js +++ b/chrome/test/data/extensions/api_test/passwords_private/test.js
@@ -56,6 +56,7 @@ url: 'https://example.com', username: 'username', password: 'password', + note: '', useAccountStore: false }, () => { @@ -71,6 +72,7 @@ url: 'https://example.com', username: 'username', password: '', + note: '', useAccountStore: true }, () => {
diff --git a/chrome/test/data/webui/chromeos/emoji_picker/BUILD.gn b/chrome/test/data/webui/chromeos/emoji_picker/BUILD.gn index 999ccdb..c359955 100644 --- a/chrome/test/data/webui/chromeos/emoji_picker/BUILD.gn +++ b/chrome/test/data/webui/chromeos/emoji_picker/BUILD.gn
@@ -20,6 +20,7 @@ deps = [ ":emoji_picker_extension_test", ":emoji_picker_prefix_search_test", + ":emoji_picker_search_test", ":emoji_picker_store_test", ":emoji_picker_test", ":emoji_picker_trie_test", @@ -62,6 +63,15 @@ externs_list = [ "$externs_path/mocha-2.5.js" ] } +js_library("emoji_picker_search_test") { + deps = [ + "//chrome/browser/resources/chromeos/emoji_picker:emoji_picker", + "//chrome/test/data/webui:chai_assert", + "//ui/webui/resources/js:assert.m", + ] + externs_list = [ "$externs_path/mocha-2.5.js" ] +} + js_library("emoji_picker_trie_test") { deps = [ "//chrome/test/data/webui:chai_assert",
diff --git a/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_browsertest.js b/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_browsertest.js index 6ad4f8fd..ede60187 100644 --- a/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_browsertest.js +++ b/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_browsertest.js
@@ -71,6 +71,23 @@ mocha.run(); }); +var EmojiPickerExtensionSearchTest = class extends PolymerTest { + /** @override */ + get featureList() { + return {enabled: ['chromeos::features::kImeSystemEmojiPickerExtension']}; + } + + /** @override */ + get browsePreload() { + return 'chrome://emoji-picker/test_loader.html?module=' + + 'chromeos/emoji_picker/emoji_picker_search_test.js'; + } +}; + +TEST_F('EmojiPickerExtensionSearchTest', 'All', function() { + mocha.run(); +}); + var EmojiPickerTrieTest = class extends PolymerTest { /** @override */ get featureList() {
diff --git a/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_extension_test.js b/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_extension_test.js index 2ca89b7..fc88dab0 100644 --- a/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_extension_test.js +++ b/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_extension_test.js
@@ -262,82 +262,4 @@ () => leftChevron.style.display === 'flex' && rightChevron.style.display === 'flex'); }); - - suite('<emoji-search>', () => { - let emojiSearch; - setup(() => { - emojiSearch = findInEmojiPicker('emoji-search'); - }); - - test('By default, there is no search result.', () => { - const searchResults = findInEmojiPicker('emoji-search', '#results'); - assert(!searchResults); - }); - - test( - 'If matching, search should return both emoji and emoticon results.', - () => { - emojiSearch.search = 'face'; - flush(); - const emojiResults = findInEmojiPicker('emoji-search', 'emoji-group') - .shadowRoot.querySelectorAll('emoji-button'); - assertGT(emojiResults.length, 0); - const emoticonResults = - findInEmojiPicker('emoji-search', 'emoticon-group') - .shadowRoot.querySelectorAll('.emoticon-button'); - assertGT(emoticonResults.length, 0); - }); - - test( - 'Search should display meaningful output when no result is found.', - () => { - emojiSearch.search = 'zyxt'; - flush(); - const message = findInEmojiPicker('emoji-search', '.no-result'); - assert(message); - assertEquals(message.innerText, 'No result found'); - }); - - test( - 'If there is only one emoji returned, pressing Enter triggers the ' + - 'clicking event.', - async () => { - emojiSearch.search = 'zombi'; - await flush(); - const enterEvent = new KeyboardEvent( - 'keydown', {cancelable: true, key: 'Enter', keyCode: 13}); - const buttonClickPromise = new Promise( - (resolve) => - emojiPicker.addEventListener(EMOJI_BUTTON_CLICK, (event) => { - assertEquals('🧟', event.detail.text); - assertEquals('zombie', event.detail.name.trim()); - resolve(); - })); - emojiSearch.onSearchKeyDown(enterEvent); - await waitWithTimeout( - buttonClickPromise, 1000, - 'Failed to receive emoji button click event.'); - }); - test( - 'If there is only emoticon returned, pressing Enter triggers the ' + - 'clicking event.', - async () => { - emojiSearch.search = 'cat'; - await flush(); - const enterEvent = new KeyboardEvent( - 'keydown', {cancelable: true, key: 'Enter', keyCode: 13}); - - const buttonClickPromise = new Promise( - (resolve) => - emojiPicker.addEventListener(EMOJI_BUTTON_CLICK, (event) => { - assertEquals('=^.^=', event.detail.text); - resolve(); - })); - - emojiSearch.onSearchKeyDown(enterEvent); - await waitWithTimeout( - buttonClickPromise, 1000, - 'Failed to receive emoji button click event.'); - }); - }); }); \ No newline at end of file
diff --git a/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_search_test.js b/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_search_test.js new file mode 100644 index 0000000..f0e04cc --- /dev/null +++ b/chrome/test/data/webui/chromeos/emoji_picker/emoji_picker_search_test.js
@@ -0,0 +1,122 @@ +// 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 {EmojiPicker} from 'chrome://emoji-picker/emoji_picker.js'; +import {EMOJI_BUTTON_CLICK, V2_CONTENT_LOADED} from 'chrome://emoji-picker/events.js'; +import {assert} from 'chrome://resources/js/assert.m.js'; +import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {assertEquals, assertGT} from '../../chai_assert.js'; + +import {deepQuerySelector, waitWithTimeout} from './emoji_picker_test_util.js'; + +const ACTIVE_CATEGORY_BUTTON = 'category-button-active'; + +function isCategoryButtonActive(element) { + assert(element, 'category button element should not be null.'); + return element.classList.contains(ACTIVE_CATEGORY_BUTTON); +} + +suite('emoji-search', () => { + /** @type {!EmojiPicker} */ + let emojiPicker; + /** @type {function(...!string): ?HTMLElement} */ + let findInEmojiPicker; + let emojiSearch; + setup(() => { + // Reset DOM state. + document.body.innerHTML = ''; + window.localStorage.clear(); + + emojiPicker = + /** @type {!EmojiPicker} */ (document.createElement('emoji-picker')); + emojiPicker.emojiDataUrl = '/emoji_test_ordering'; + emojiPicker.emoticonDataUrl = '/emoticon_test_ordering.json'; + + findInEmojiPicker = (...path) => deepQuerySelector(emojiPicker, path); + + // Wait until emoji data is loaded before executing tests. + return new Promise((resolve) => { + emojiPicker.addEventListener(V2_CONTENT_LOADED, () => { + flush(); + resolve(); + }); + document.body.appendChild(emojiPicker); + emojiSearch = findInEmojiPicker('emoji-search'); + }); + }); + + + test('By default, there is no search result.', () => { + const searchResults = findInEmojiPicker('emoji-search', '#results'); + assert(!searchResults); + }); + + test( + 'If matching, search should return both emoji and emoticon results.', + () => { + emojiSearch.search = 'face'; + flush(); + const emojiResults = findInEmojiPicker('emoji-search', 'emoji-group') + .shadowRoot.querySelectorAll('emoji-button'); + assertGT(emojiResults.length, 0); + const emoticonResults = + findInEmojiPicker('emoji-search', 'emoticon-group') + .shadowRoot.querySelectorAll('.emoticon-button'); + assertGT(emoticonResults.length, 0); + }); + + test( + 'Search should display meaningful output when no result is found.', + () => { + emojiSearch.search = 'zyxt'; + flush(); + const message = findInEmojiPicker('emoji-search', '.no-result'); + assert(message); + assertEquals(message.innerText, 'No result found'); + }); + + test( + 'If there is only one emoji returned, pressing Enter triggers the ' + + 'clicking event.', + async () => { + emojiSearch.search = 'zombi'; + await flush(); + const enterEvent = new KeyboardEvent( + 'keydown', {cancelable: true, key: 'Enter', keyCode: 13}); + const buttonClickPromise = new Promise( + (resolve) => + emojiPicker.addEventListener(EMOJI_BUTTON_CLICK, (event) => { + assertEquals('🧟', event.detail.text); + assertEquals('zombie', event.detail.name.trim()); + resolve(); + })); + emojiSearch.onSearchKeyDown(enterEvent); + await waitWithTimeout( + buttonClickPromise, 1000, + 'Failed to receive emoji button click event.'); + }); + + test( + 'If there is only emoticon returned, pressing Enter triggers the ' + + 'clicking event.', + async () => { + emojiSearch.search = 'cat'; + await flush(); + const enterEvent = new KeyboardEvent( + 'keydown', {cancelable: true, key: 'Enter', keyCode: 13}); + + const buttonClickPromise = new Promise( + (resolve) => + emojiPicker.addEventListener(EMOJI_BUTTON_CLICK, (event) => { + assertEquals('=^.^=', event.detail.text); + resolve(); + })); + + emojiSearch.onSearchKeyDown(enterEvent); + await waitWithTimeout( + buttonClickPromise, 1000, + 'Failed to receive emoji button click event.'); + }); +}); \ No newline at end of file
diff --git a/chrome/test/data/webui/settings/password_edit_dialog_test.ts b/chrome/test/data/webui/settings/password_edit_dialog_test.ts index 6bc40fe..c85ac190 100644 --- a/chrome/test/data/webui/settings/password_edit_dialog_test.ts +++ b/chrome/test/data/webui/settings/password_edit_dialog_test.ts
@@ -12,7 +12,7 @@ import {PasswordDialogMode, PasswordEditDialogElement, SettingsTextareaElement} from 'chrome://settings/lazy_load.js'; import {PasswordManagerImpl} from 'chrome://settings/settings.js'; import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; -import {eventToPromise, flushTasks} from 'chrome://webui-test/test_util.js'; +import {eventToPromise, flushTasks, isVisible} from 'chrome://webui-test/test_util.js'; import {createMultiStorePasswordEntry, PasswordSectionElementFactory} from './passwords_and_autofill_fake_data.js'; import {TestPasswordManagerProxy} from './test_password_manager_proxy.js'; @@ -424,6 +424,21 @@ assertEquals( addDialog.i18n('addPasswordFootnote'), addDialog.$.footnote.innerText.trim()); + assertFalse(!!addDialog.shadowRoot!.querySelector('settings-textarea')); + }); + + test('hasCorrectInitialStateWhenAddPasswordWithNotes', function() { + loadTimeData.overrideValues({enablePasswordNotes: true}); + const addDialog = elementFactory.createPasswordEditDialog(); + assertAddDialogParts(addDialog); + assertEquals(true, addDialog.$.websiteInput.autofocus); + assertEquals('', addDialog.$.websiteInput.value); + assertEquals('', addDialog.$.usernameInput.value); + assertEquals('', addDialog.$.passwordInput.value); + assertEquals('password', addDialog.$.passwordInput.type); + assertTrue(isVisible(addDialog.$.footnote)); + assertEquals( + '', addDialog.shadowRoot!.querySelector('settings-textarea')!.value); }); test('showsStorePickerForAccountStoreUserWhenAddPassword', function() { @@ -739,16 +754,6 @@ '#note')); }); - test('addDialogDoesntHaveNotes', async function() { - loadTimeData.overrideValues({enablePasswordNotes: true}); - const existingEntry = createMultiStorePasswordEntry( - {url: 'website.com', username: 'username', accountId: 0}); - const addDialog = - elementFactory.createPasswordEditDialog(null, [existingEntry]); - assertAddDialogParts(addDialog); - assertFalse(!!addDialog.shadowRoot!.querySelector('#note')); - }); - test('showNoteWarningInEditModeWhen900Characters', async function() { loadTimeData.overrideValues({enablePasswordNotes: true}); const commonEntry = createMultiStorePasswordEntry({
diff --git a/chromeos/chromeos_strings.grd b/chromeos/chromeos_strings.grd index a9351bb..e353991 100644 --- a/chromeos/chromeos_strings.grd +++ b/chromeos/chromeos_strings.grd
@@ -2704,14 +2704,11 @@ Power Button </message> <!-- Splash screen --> - <message name="IDS_SHIMLESS_RMA_SPLASH_TITLE" translateable="false" desc="Message to display while waiting for RMA to initialize at boot."> + <message name="IDS_SHIMLESS_RMA_SPLASH_TITLE" desc="Message to display while waiting for RMA to initialize at boot."> <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> repair </message> - <message name="IDS_SHIMLESS_RMA_SPLASH_REMEMBERING" translateable="false" desc="Message that lets the user know that we are resuming repair."> - Remembering where you left off... - </message> - <message name="IDS_SHIMLESS_RMA_SPLASH_LOADING" translateable="false" desc="Message that lets the user know that we are loading the previous repair state."> - Loading state... may last ~10 seconds + <message name="IDS_SHIMLESS_RMA_SPLASH_REMEMBERING" desc="Message that lets the user know that we are resuming repair."> + Resuming repair process… </message> <!-- Common buttons --> <message name="IDS_SHIMLESS_RMA_EXIT_BUTTON" desc="Button used to exit RMA finalization, when allowed."> @@ -3072,8 +3069,8 @@ <message name="IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_SKU_LABEL" desc="The label for the text input showing the device's SKU."> SKU </message> - <message name="IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_RESET_BUTTON_LABEL" desc="The label for the button that resets the text input."> - Reset + <message name="IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_REVERT_BUTTON_LABEL" desc="The label for the button that resets the input back to its original value."> + Revert </message> <message name="IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_SKU_WARNING" desc="The text warning explaining when the device's SKU should be changed."> The SKU should only be changed if the new component(s) are different from the ones they replaced. For example, a touchscreen replacing a non-touchscreen, or memory being upgraded from 8GB to 16GB.
diff --git a/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_RESET_BUTTON_LABEL.png.sha1 b/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_RESET_BUTTON_LABEL.png.sha1 deleted file mode 100644 index dc085ed8..0000000 --- a/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_RESET_BUTTON_LABEL.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -dec93a194e8e868a3b48f4fcfcc060bd585d1c8c \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_REVERT_BUTTON_LABEL.png.sha1 b/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_REVERT_BUTTON_LABEL.png.sha1 new file mode 100644 index 0000000..20ed676 --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_CONFIRM_DEVICE_INFO_REVERT_BUTTON_LABEL.png.sha1
@@ -0,0 +1 @@ +d86325090e9519bb4ba5d2397466a7b00b801b58 \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_SPLASH_REMEMBERING.png.sha1 b/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_SPLASH_REMEMBERING.png.sha1 new file mode 100644 index 0000000..72d55594 --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_SPLASH_REMEMBERING.png.sha1
@@ -0,0 +1 @@ +c9df396c575fe5e5c484d4ee3830aa5b61289423 \ No newline at end of file
diff --git a/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_SPLASH_TITLE.png.sha1 b/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_SPLASH_TITLE.png.sha1 new file mode 100644 index 0000000..23d76a3e --- /dev/null +++ b/chromeos/chromeos_strings_grd/IDS_SHIMLESS_RMA_SPLASH_TITLE.png.sha1
@@ -0,0 +1 @@ +153eb2d5620c1ef3a03667336aefe8687b5d31c3 \ No newline at end of file
diff --git a/chromeos/dbus/debug_daemon/debug_daemon_client.cc b/chromeos/dbus/debug_daemon/debug_daemon_client.cc index 6a9dd22..2acdc6d 100644 --- a/chromeos/dbus/debug_daemon/debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon/debug_daemon_client.cc
@@ -172,6 +172,7 @@ void GetRoutes( bool numeric, bool ipv6, + bool all_tables, DBusMethodCallback<std::vector<std::string>> callback) override { dbus::MethodCall method_call(debugd::kDebugdInterface, debugd::kGetRoutes); dbus::MessageWriter writer(&method_call); @@ -186,6 +187,10 @@ elem_writer.AppendString("v6"); elem_writer.AppendVariantOfBool(ipv6); sub_writer.CloseContainer(&elem_writer); + sub_writer.OpenDictEntry(&elem_writer); + elem_writer.AppendString("all"); + elem_writer.AppendVariantOfBool(all_tables); + sub_writer.CloseContainer(&elem_writer); writer.CloseContainer(&sub_writer); debugdaemon_proxy_->CallMethod( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
diff --git a/chromeos/dbus/debug_daemon/debug_daemon_client.h b/chromeos/dbus/debug_daemon/debug_daemon_client.h index 0fc5715..cef275f4 100644 --- a/chromeos/dbus/debug_daemon/debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon/debug_daemon_client.h
@@ -80,6 +80,7 @@ virtual void GetRoutes( bool numeric, bool ipv6, + bool all_tables, DBusMethodCallback<std::vector<std::string> /* routes */> callback) = 0; // Gets information about network status as json.
diff --git a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc index 3eab7f1..b850b394 100644 --- a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc
@@ -10,6 +10,7 @@ #include <map> #include <string> #include <utility> +#include <vector> #include "base/bind.h" #include "base/callback.h" @@ -89,12 +90,19 @@ void FakeDebugDaemonClient::SetStopAgentTracingTaskRunner( scoped_refptr<base::TaskRunner> task_runner) {} +void FakeDebugDaemonClient::SetRoutesForTesting( + std::vector<std::string> routes) { + routes_ = std::move(routes); +} + void FakeDebugDaemonClient::GetRoutes( bool numeric, bool ipv6, + bool all_tables, DBusMethodCallback<std::vector<std::string>> callback) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt)); + FROM_HERE, + base::BindOnce(std::move(callback), absl::make_optional(routes_))); } void FakeDebugDaemonClient::GetNetworkStatus(
diff --git a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h index 50b083d..ac1c5bbb 100644 --- a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h
@@ -51,6 +51,7 @@ void GetRoutes( bool numeric, bool ipv6, + bool all_tables, DBusMethodCallback<std::vector<std::string>> callback) override; void SetKstaledRatio(uint8_t val, KstaledRatioCallback callback) override; void GetNetworkStatus(DBusMethodCallback<std::string> callback) override; @@ -119,6 +120,9 @@ // pending callbacks if is_available is true. void SetServiceIsAvailable(bool is_available); + // Sets routes that will be returned by GetRoutes() for testing. + void SetRoutesForTesting(std::vector<std::string> routes); + const std::string& scheduler_configuration_name() const { return scheduler_configuration_name_; } @@ -132,6 +136,7 @@ std::vector<WaitForServiceToBeAvailableCallback> pending_wait_for_service_to_be_available_callbacks_; std::set<std::string> printers_; + std::vector<std::string> routes_; std::string scheduler_configuration_name_; std::set<std::string> u2f_flags_; base::ObserverList<Observer> observers_;
diff --git a/chromeos/ui/base/OWNERS b/chromeos/ui/base/OWNERS new file mode 100644 index 0000000..42ead959 --- /dev/null +++ b/chromeos/ui/base/OWNERS
@@ -0,0 +1 @@ +per-file file_icon_util.* = file://ui/file_manager/OWNERS
diff --git a/components/autofill/DEPS b/components/autofill/DEPS index d3318af..51fd817 100644 --- a/components/autofill/DEPS +++ b/components/autofill/DEPS
@@ -2,7 +2,7 @@ "+components/autofill/android/jni_headers", "+components/prefs", "+components/strings/grit/components_strings.h", - "+google_apis/gaia/gaia_urls.h", + "+google_apis/gaia", "+net", "+mojo/public", "+third_party/protobuf",
diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc index 9367f0b..dac8744 100644 --- a/components/autofill/content/renderer/password_form_conversion_utils.cc +++ b/components/autofill/content/renderer/password_form_conversion_utils.cc
@@ -11,7 +11,7 @@ #include "components/autofill/content/renderer/html_based_username_detector.h" #include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/unique_ids.h" -#include "google_apis/gaia/gaia_urls.h" +#include "google_apis/gaia/gaia_auth_util.h" #include "net/base/url_util.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/web/web_document.h" @@ -64,13 +64,6 @@ control_elements, form_data, username_detector_cache, form); } -bool HasGaiaSchemeAndHost(const WebFormElement& form) { - GURL form_url = form.GetDocument().Url(); - GURL gaia_url = GaiaUrls::GetInstance()->gaia_url(); - return form_url.scheme() == gaia_url.scheme() && - form_url.host() == gaia_url.host(); -} - } // namespace re2::RE2* CreateMatcher(void* instance, const char* pattern) { @@ -84,7 +77,7 @@ } bool IsGaiaReauthenticationForm(const blink::WebFormElement& form) { - if (!HasGaiaSchemeAndHost(form)) + if (!gaia::HasGaiaSchemeHostPort(form.GetDocument().Url())) return false; bool has_rart_field = false; @@ -113,7 +106,7 @@ } bool IsGaiaWithSkipSavePasswordForm(const blink::WebFormElement& form) { - if (!HasGaiaSchemeAndHost(form)) + if (!gaia::HasGaiaSchemeHostPort(form.GetDocument().Url())) return false; GURL url(form.GetDocument().Url());
diff --git a/components/autofill/core/browser/data_model/autofill_profile.cc b/components/autofill/core/browser/data_model/autofill_profile.cc index e41c4e89..9b02abc 100644 --- a/components/autofill/core/browser/data_model/autofill_profile.cc +++ b/components/autofill/core/browser/data_model/autofill_profile.cc
@@ -320,19 +320,15 @@ std::u16string AutofillProfile::GetRawInfo(ServerFieldType type) const { const FormGroup* form_group = FormGroupForType(AutofillType(type)); - if (!form_group) { - NOTREACHED(); + if (!form_group) return std::u16string(); - } return form_group->GetRawInfo(type); } int AutofillProfile::GetRawInfoAsInt(ServerFieldType type) const { const FormGroup* form_group = FormGroupForType(AutofillType(type)); - if (!form_group) { - NOTREACHED(); + if (!form_group) return 0; - } return form_group->GetRawInfoAsInt(type); } @@ -341,11 +337,9 @@ const std::u16string& value, VerificationStatus status) { FormGroup* form_group = MutableFormGroupForType(AutofillType(type)); - if (!form_group) { - NOTREACHED(); - return; + if (form_group) { + form_group->SetRawInfoWithVerificationStatus(type, value, status); } - form_group->SetRawInfoWithVerificationStatus(type, value, status); } void AutofillProfile::SetRawInfoAsIntWithVerificationStatus( @@ -353,11 +347,9 @@ int value, VerificationStatus status) { FormGroup* form_group = MutableFormGroupForType(AutofillType(type)); - if (!form_group) { - NOTREACHED(); - return; + if (form_group) { + form_group->SetRawInfoAsIntWithVerificationStatus(type, value, status); } - form_group->SetRawInfoAsIntWithVerificationStatus(type, value, status); } void AutofillProfile::GetSupportedTypes(
diff --git a/components/autofill/core/browser/data_model/credit_card_unittest.cc b/components/autofill/core/browser/data_model/credit_card_unittest.cc index dd65028..7b8c201 100644 --- a/components/autofill/core/browser/data_model/credit_card_unittest.cc +++ b/components/autofill/core/browser/data_model/credit_card_unittest.cc
@@ -1320,6 +1320,9 @@ {"19", "01", "2019", LOCAL_CARD, {CREDIT_CARD_EXP_2_DIGIT_YEAR}}, {"01/2019", "01", "2019", LOCAL_CARD, {CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR}}, {"01-2019", "01", "2019", LOCAL_CARD, {CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR}}, + {"01/19", "01", "2019", LOCAL_CARD, {CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR}}, + {"01-19", "01", "2019", LOCAL_CARD, {CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR}}, + {"01 / 19", "01", "2019", LOCAL_CARD, {CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR}}, {"01/2020", "01", "2019", LOCAL_CARD, ServerFieldTypeSet()}, {"20", "01", "2019", LOCAL_CARD, ServerFieldTypeSet()}, {"2021", "01", "2019", LOCAL_CARD, ServerFieldTypeSet()},
diff --git a/components/autofill/core/browser/ui/suggestion_selection.cc b/components/autofill/core/browser/ui/suggestion_selection.cc index 2971056..7697f3087 100644 --- a/components/autofill/core/browser/ui/suggestion_selection.cc +++ b/components/autofill/core/browser/ui/suggestion_selection.cc
@@ -87,7 +87,7 @@ profile->GetRawInfo(type.GetStorableType()) == raw_field_contents) { continue; } -#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) +#endif // BUILDFLAG(IS_ANDROID) std::u16string value = GetInfoInOneLine(profile, type, comparator.app_locale());
diff --git a/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc b/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc index 235d283..a661e312 100644 --- a/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc +++ b/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc
@@ -3999,5 +3999,75 @@ "Android.AutofillAssistant.PaymentRequest.AutofillChanged", 1u); } +TEST_F(CollectUserDataActionTest, MergesTransientDataWithUserDataFromBackend) { + auto transient_contact = std::make_unique<autofill::AutofillProfile>(); + transient_contact->SetRawInfo(autofill::NAME_FULL, u"Jane Doe"); + user_data_.transient_contacts_.emplace_back( + std::make_unique<Contact>(std::move(transient_contact))); + + auto transient_phone_number = std::make_unique<autofill::AutofillProfile>(); + transient_phone_number->SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, + u"+16505678910"); + user_data_.transient_phone_numbers_.emplace_back( + std::make_unique<PhoneNumber>(std::move(transient_phone_number))); + + GetUserDataResponseProto user_data_response; + user_data_response.set_locale("en-US"); + auto* profile = user_data_response.add_available_contacts(); + (*profile->mutable_values())[7] = MakeAutofillEntry("John Doe"); + *user_data_response.add_available_phone_numbers()->mutable_value() = + MakeAutofillEntry("+1 187-654-3210"); + + ON_CALL(mock_action_delegate_, GetPersonalDataManager) + .WillByDefault(Return(nullptr)); + ON_CALL(mock_action_delegate_, MustUseBackendData) + .WillByDefault(Return(true)); + EXPECT_CALL(mock_action_delegate_, RequestUserData) + .Times(2) + .WillRepeatedly(RunOnceCallback<2>(true, user_data_response)); + EXPECT_CALL(mock_action_delegate_, CollectUserData(_)) + .WillOnce(Invoke([=](CollectUserDataOptions* collect_user_data_options) { + ASSERT_EQ(user_data_.available_contacts_.size(), 2u); + EXPECT_EQ(user_data_.available_contacts_[0]->profile->GetRawInfo( + autofill::NAME_FULL), + u"Jane Doe"); + EXPECT_EQ(user_data_.available_contacts_[1]->profile->GetRawInfo( + autofill::NAME_FULL), + u"John Doe"); + + ASSERT_EQ(user_data_.available_phone_numbers_.size(), 2u); + EXPECT_EQ(user_data_.available_phone_numbers_[0]->profile->GetRawInfo( + autofill::PHONE_HOME_WHOLE_NUMBER), + u"+16505678910"); + EXPECT_EQ(user_data_.available_phone_numbers_[1]->profile->GetRawInfo( + autofill::PHONE_HOME_WHOLE_NUMBER), + u"+1 187-654-3210"); + + std::move(collect_user_data_options->reload_data_callback) + .Run(UserDataEventField::NONE, &user_data_); + })) + .WillOnce(Invoke([=](CollectUserDataOptions* collect_user_data_options) { + EXPECT_EQ(user_data_.available_contacts_.size(), 2u); + EXPECT_EQ(user_data_.available_phone_numbers_.size(), 2u); + + // Don't end the action. + })); + + ActionProto action_proto; + auto* collect_user_data = action_proto.mutable_collect_user_data(); + collect_user_data->set_request_terms_and_conditions(false); + collect_user_data->mutable_contact_details()->set_request_payer_name(true); + collect_user_data->mutable_contact_details() + ->set_separate_phone_number_section(true); + collect_user_data->mutable_contact_details()->set_phone_number_section_title( + "Phone number"); + collect_user_data->mutable_contact_details()->set_contact_details_name( + kMemoryLocation); + collect_user_data->mutable_data_source(); + + CollectUserDataAction action(&mock_action_delegate_, action_proto); + action.ProcessAction(callback_.Get()); +} + } // namespace } // namespace autofill_assistant
diff --git a/components/exo/buffer.cc b/components/exo/buffer.cc index 4cdaeb98..7c0c8ea 100644 --- a/components/exo/buffer.cc +++ b/components/exo/buffer.cc
@@ -646,6 +646,19 @@ std::move(buffer_release_callback).Run(); } else { #if BUILDFLAG(IS_POSIX) + // Watching the release fence's fd results in a context switch to the I/O + // thread. That may steal thread time from other applications, which can + // do something useful during that time. Moreover, most of the time the + // fence can have already been signalled. Thus, only watch the fence is + // readable iff it hasn't been signalled yet. + base::TimeTicks ticks; + auto status = gfx::GpuFence::GetStatusChangeTime( + release_fence.owned_fd.get(), &ticks); + if (status == gfx::GpuFence::kSignaled) { + std::move(buffer_release_callback).Run(); + return; + } + auto controller = base::FileDescriptorWatcher::WatchReadable( release_fence.owned_fd.get(), base::BindRepeating(&Buffer::FenceSignalled, AsWeakPtr(), commit_id));
diff --git a/components/exo/wayland/clients/client_base.cc b/components/exo/wayland/clients/client_base.cc index 5465a6a..7b97fe0 100644 --- a/components/exo/wayland/clients/client_base.cc +++ b/components/exo/wayland/clients/client_base.cc
@@ -155,7 +155,7 @@ wl_registry_bind(registry, id, &wp_presentation_interface, 1))); } else if (strcmp(interface, "zaura_shell") == 0) { globals->aura_shell.reset(static_cast<zaura_shell*>( - wl_registry_bind(registry, id, &zaura_shell_interface, 32))); + wl_registry_bind(registry, id, &zaura_shell_interface, 14))); } else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0) { globals->linux_dmabuf.reset(static_cast<zwp_linux_dmabuf_v1*>( wl_registry_bind(registry, id, &zwp_linux_dmabuf_v1_interface, 2))); @@ -923,14 +923,6 @@ uint32_t modifier_hi, uint32_t modifier_lo) {} -//////////////////////////////////////////////////////////////////////////////// -// zaura_output_listener - -void ClientBase::HandleInsets(const gfx::Insets& insets) {} - -//////////////////////////////////////////////////////////////////////////////// -// helper functions - std::unique_ptr<ClientBase::Buffer> ClientBase::CreateBuffer( const gfx::Size& size, int32_t drm_format, @@ -1262,13 +1254,7 @@ [](void* data, struct zaura_shell* zaura_shell, uint32_t layout_mode) {}, [](void* data, struct zaura_shell* zaura_shell, uint32_t id) { CastToClientBase(data)->bug_fix_ids_.insert(id); - }, - [](void* data, struct zaura_shell* zaura_shell, - struct wl_array* desk_names) {}, - [](void* data, struct zaura_shell* zaura_shell, - int32_t active_desk_index) {}, - [](void* data, struct zaura_shell* zaura_shell, - struct wl_surface* gained_active, struct wl_surface* lost_active) {}}; + }}; zaura_shell_add_listener(globals_.aura_shell.get(), &kAuraShellListener, this); @@ -1280,23 +1266,6 @@ } zaura_surface_set_frame(aura_surface.get(), ZAURA_SURFACE_FRAME_TYPE_NORMAL); - - static zaura_output_listener kAuraOutputListener = { - [](void* data, struct zaura_output* zaura_output, uint32_t flags, - uint32_t scale) {}, - [](void* data, struct zaura_output* zaura_output, uint32_t connection) {}, - [](void* data, struct zaura_output* zaura_output, uint32_t scale) {}, - [](void* data, struct zaura_output* zaura_output, int32_t top, - int32_t left, int32_t bottom, int32_t right) { - CastToClientBase(data)->HandleInsets( - gfx::Insets::TLBR(top, left, bottom, right)); - }, - }; - - std::unique_ptr<zaura_output> aura_output(zaura_shell_get_aura_output( - globals_.aura_shell.get(), globals_.output.get())); - zaura_output_add_listener(aura_output.get(), &kAuraOutputListener, this); - globals_.aura_output = std::move(aura_output); } void ClientBase::SetupPointerStylus() {
diff --git a/components/exo/wayland/clients/client_base.h b/components/exo/wayland/clients/client_base.h index 19619be..b4e47bd 100644 --- a/components/exo/wayland/clients/client_base.h +++ b/components/exo/wayland/clients/client_base.h
@@ -15,7 +15,6 @@ #include "linux-dmabuf-unstable-v1-client-protocol.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkRefCnt.h" -#include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/size.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_surface.h" @@ -86,7 +85,6 @@ std::unique_ptr<wl_subcompositor> subcompositor; std::unique_ptr<wl_touch> touch; std::unique_ptr<zaura_shell> aura_shell; - std::unique_ptr<zaura_output> aura_output; std::unique_ptr<zxdg_shell_v6> xdg_shell_v6; std::unique_ptr<xdg_wm_base> xdg_wm_base; std::unique_ptr<zwp_fullscreen_shell_v1> fullscreen_shell; @@ -206,9 +204,6 @@ uint32_t modifier_hi, uint32_t modifier_lo); - // zaura_output_listener - virtual void HandleInsets(const gfx::Insets& insets); - gfx::Size size_ = gfx::Size(256, 256); int scale_ = 1; int transform_ = WL_OUTPUT_TRANSFORM_NORMAL;
diff --git a/components/exo/wayland/clients/info.cc b/components/exo/wayland/clients/info.cc index baf36fd..1e97fac3 100644 --- a/components/exo/wayland/clients/info.cc +++ b/components/exo/wayland/clients/info.cc
@@ -43,9 +43,6 @@ }; // |next_scales| are swapped with |scales| after receiving output done event. std::vector<Scale> scales, next_scales; - struct { - int32_t top, left, bottom, right; - } insets; std::unique_ptr<wl_output> output; std::unique_ptr<zaura_output> aura_output; }; @@ -158,17 +155,6 @@ info->device_scale_factor = device_scale_factor; } -void AuraOutputInsets(void* data, - zaura_output* output, - int32_t top, - int32_t left, - int32_t bottom, - int32_t right) { - Info* info = static_cast<Info*>(data); - - info->insets = {top, left, bottom, right}; -} - std::string OutputSubpixelToString(int32_t subpixel) { switch (subpixel) { case WL_OUTPUT_SUBPIXEL_UNKNOWN: @@ -307,8 +293,7 @@ OutputScale}; zaura_output_listener aura_output_listener = { - AuraOutputScale, AuraOutputConnection, AuraOutputDeviceScaleFactor, - AuraOutputInsets}; + AuraOutputScale, AuraOutputConnection, AuraOutputDeviceScaleFactor}; for (auto& info : globals.outputs) { wl_output_add_listener(info.output.get(), &output_listener, &info); if (globals.aura_shell) { @@ -364,12 +349,6 @@ << AuraOutputScaleFlagsToString(scale.flags) << std::endl; } } - std::cout << " insets:" << std::endl - << " top: " << info.insets.top << std::endl - << " left: " << info.insets.left << std::endl - << " bottom: " << info.insets.bottom << std::endl - << " right: " << info.insets.right << std::endl - << std::endl; } return 0;
diff --git a/components/exo/wayland/protocol/aura-shell.xml b/components/exo/wayland/protocol/aura-shell.xml index b0fd1b5..8a4bffb 100644 --- a/components/exo/wayland/protocol/aura-shell.xml +++ b/components/exo/wayland/protocol/aura-shell.xml
@@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. </copyright> - <interface name="zaura_shell" version="32"> + <interface name="zaura_shell" version="31"> <description summary="aura_shell"> The global interface exposing aura shell capabilities is used to instantiate an interface extension for a wl_surface object. @@ -512,7 +512,7 @@ </event> </interface> - <interface name="zaura_output" version="32"> + <interface name="zaura_output" version="6"> <description summary="aura shell interface to a wl_output"> An additional interface to a wl_output object, which allows the client to access aura shell specific functionality for output. @@ -614,23 +614,7 @@ </description> <arg name="scale" type="uint" enum="scale_factor" summary="output device scale factor"/> </event> - - <!-- Version 32 additions --> - - <event name="insets" since="32"> - <description summary="advertise the insets for the output"> - This event describes the insets for the output in logical screen - coordinates, from which the work area can be calculated. - - This event is sent before wl_output.done, after which the client would - apply the change. - </description> - <arg name="top" type="int"/> - <arg name="left" type="int"/> - <arg name="bottom" type="int"/> - <arg name="right" type="int"/> - </event> - </interface> + </interface> <interface name="zaura_toplevel" version="31"> <description summary="aura shell interface to the toplevel shell">
diff --git a/components/exo/wayland/zaura_shell.cc b/components/exo/wayland/zaura_shell.cc index 468c7eefd..ea481e07 100644 --- a/components/exo/wayland/zaura_shell.cc +++ b/components/exo/wayland/zaura_shell.cc
@@ -774,88 +774,90 @@ #endif // BUILDFLAG(IS_CHROMEOS_ASH) +namespace { + //////////////////////////////////////////////////////////////////////////////// // aura_output_interface: -AuraOutput::AuraOutput(wl_resource* resource) : resource_(resource) {} +class AuraOutput : public WaylandDisplayObserver { + public: + explicit AuraOutput(wl_resource* resource) : resource_(resource) {} -AuraOutput::~AuraOutput() = default; + AuraOutput(const AuraOutput&) = delete; + AuraOutput& operator=(const AuraOutput&) = delete; -bool AuraOutput::SendDisplayMetrics(const display::Display& display, - uint32_t changed_metrics) { - if (!(changed_metrics & - (display::DisplayObserver::DISPLAY_METRIC_BOUNDS | - display::DisplayObserver::DISPLAY_METRIC_WORK_AREA | - display::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR | - display::DisplayObserver::DISPLAY_METRIC_ROTATION))) { - return false; - } - - const WMHelper* wm_helper = WMHelper::GetInstance(); - const display::ManagedDisplayInfo& display_info = - wm_helper->GetDisplayInfo(display.id()); - - if (wl_resource_get_version(resource_) >= ZAURA_OUTPUT_SCALE_SINCE_VERSION) { - display::ManagedDisplayMode active_mode; - bool rv = wm_helper->GetActiveModeForDisplayId(display.id(), &active_mode); - DCHECK(rv); - const int32_t current_output_scale = - std::round(display_info.zoom_factor() * 1000.f); - std::vector<float> zoom_factors = - display::GetDisplayZoomFactors(active_mode); - - // Ensure that the current zoom factor is a part of the list. - auto it = std::find_if( - zoom_factors.begin(), zoom_factors.end(), - [&display_info](float zoom_factor) -> bool { - return std::abs(display_info.zoom_factor() - zoom_factor) <= - std::numeric_limits<float>::epsilon(); - }); - if (it == zoom_factors.end()) - zoom_factors.push_back(display_info.zoom_factor()); - - for (float zoom_factor : zoom_factors) { - int32_t output_scale = std::round(zoom_factor * 1000.f); - uint32_t flags = 0; - if (output_scale == 1000) - flags |= ZAURA_OUTPUT_SCALE_PROPERTY_PREFERRED; - if (current_output_scale == output_scale) - flags |= ZAURA_OUTPUT_SCALE_PROPERTY_CURRENT; - - // TODO(malaykeshav): This can be removed in the future when client - // has been updated. - if (wl_resource_get_version(resource_) < 6) - output_scale = std::round(1000.f / zoom_factor); - - zaura_output_send_scale(resource_, flags, output_scale); + // Overridden from WaylandDisplayObserver: + bool SendDisplayMetrics(const display::Display& display, + uint32_t changed_metrics) override { + if (!(changed_metrics & + (display::DisplayObserver::DISPLAY_METRIC_BOUNDS | + display::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR | + display::DisplayObserver::DISPLAY_METRIC_ROTATION))) { + return false; } + + const WMHelper* wm_helper = WMHelper::GetInstance(); + const display::ManagedDisplayInfo& display_info = + wm_helper->GetDisplayInfo(display.id()); + + if (wl_resource_get_version(resource_) >= + ZAURA_OUTPUT_SCALE_SINCE_VERSION) { + display::ManagedDisplayMode active_mode; + bool rv = + wm_helper->GetActiveModeForDisplayId(display.id(), &active_mode); + DCHECK(rv); + const int32_t current_output_scale = + std::round(display_info.zoom_factor() * 1000.f); + std::vector<float> zoom_factors = + display::GetDisplayZoomFactors(active_mode); + + // Ensure that the current zoom factor is a part of the list. + auto it = std::find_if( + zoom_factors.begin(), zoom_factors.end(), + [&display_info](float zoom_factor) -> bool { + return std::abs(display_info.zoom_factor() - zoom_factor) <= + std::numeric_limits<float>::epsilon(); + }); + if (it == zoom_factors.end()) + zoom_factors.push_back(display_info.zoom_factor()); + + for (float zoom_factor : zoom_factors) { + int32_t output_scale = std::round(zoom_factor * 1000.f); + uint32_t flags = 0; + if (output_scale == 1000) + flags |= ZAURA_OUTPUT_SCALE_PROPERTY_PREFERRED; + if (current_output_scale == output_scale) + flags |= ZAURA_OUTPUT_SCALE_PROPERTY_CURRENT; + + // TODO(malaykeshav): This can be removed in the future when client + // has been updated. + if (wl_resource_get_version(resource_) < 6) + output_scale = std::round(1000.f / zoom_factor); + + zaura_output_send_scale(resource_, flags, output_scale); + } + } + + if (wl_resource_get_version(resource_) >= + ZAURA_OUTPUT_CONNECTION_SINCE_VERSION) { + zaura_output_send_connection(resource_, + display.IsInternal() + ? ZAURA_OUTPUT_CONNECTION_TYPE_INTERNAL + : ZAURA_OUTPUT_CONNECTION_TYPE_UNKNOWN); + } + + if (wl_resource_get_version(resource_) >= + ZAURA_OUTPUT_DEVICE_SCALE_FACTOR_SINCE_VERSION) { + zaura_output_send_device_scale_factor( + resource_, display_info.device_scale_factor() * 1000); + } + + return true; } - if (wl_resource_get_version(resource_) >= - ZAURA_OUTPUT_CONNECTION_SINCE_VERSION) { - zaura_output_send_connection( - resource_, display.IsInternal() ? ZAURA_OUTPUT_CONNECTION_TYPE_INTERNAL - : ZAURA_OUTPUT_CONNECTION_TYPE_UNKNOWN); - } - - if (wl_resource_get_version(resource_) >= - ZAURA_OUTPUT_DEVICE_SCALE_FACTOR_SINCE_VERSION) { - zaura_output_send_device_scale_factor( - resource_, display_info.device_scale_factor() * 1000); - } - - if (wl_resource_get_version(resource_) >= ZAURA_OUTPUT_INSETS_SINCE_VERSION) - SendInsets(display.bounds().InsetsFrom(display.work_area())); - - return true; -} - -void AuraOutput::SendInsets(const gfx::Insets& insets) { - zaura_output_send_insets(resource_, insets.top(), insets.left(), - insets.bottom(), insets.right()); -} - -namespace { + private: + wl_resource* const resource_; +}; //////////////////////////////////////////////////////////////////////////////// // aura_shell_interface:
diff --git a/components/exo/wayland/zaura_shell.h b/components/exo/wayland/zaura_shell.h index ae7bc45..dda9f92 100644 --- a/components/exo/wayland/zaura_shell.h +++ b/components/exo/wayland/zaura_shell.h
@@ -10,8 +10,6 @@ #include "chromeos/ui/base/window_state_type.h" #include "components/exo/surface.h" #include "components/exo/surface_observer.h" -#include "components/exo/wayland/wayland_display_observer.h" -#include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/size_f.h" #include "ui/wm/public/activation_change_observer.h" @@ -26,7 +24,7 @@ namespace wayland { class SerialTracker; -constexpr uint32_t kZAuraShellVersion = 32; +constexpr uint32_t kZAuraShellVersion = 31; // Adds bindings to the Aura Shell. Normally this implies Ash on ChromeOS // builds. On non-ChromeOS builds the protocol provides access to Aura windowing @@ -150,26 +148,6 @@ ShellSurfaceBase* shell_surface_; }; -class AuraOutput : public WaylandDisplayObserver { - public: - explicit AuraOutput(wl_resource* resource); - - AuraOutput(const AuraOutput&) = delete; - AuraOutput& operator=(const AuraOutput&) = delete; - - ~AuraOutput() override; - - // Overridden from WaylandDisplayObserver: - bool SendDisplayMetrics(const display::Display& display, - uint32_t changed_metrics) override; - - protected: - virtual void SendInsets(const gfx::Insets& insets); - - private: - wl_resource* const resource_; -}; - } // namespace wayland } // namespace exo
diff --git a/components/exo/wayland/zaura_shell_unittest.cc b/components/exo/wayland/zaura_shell_unittest.cc index 1ac9993..b5b975f 100644 --- a/components/exo/wayland/zaura_shell_unittest.cc +++ b/components/exo/wayland/zaura_shell_unittest.cc
@@ -6,7 +6,6 @@ #include <aura-shell-server-protocol.h> -#include <sys/socket.h> #include <memory> #include "ash/session/session_controller_impl.h" @@ -403,40 +402,5 @@ aura_surface().SetFullscreenMode(ZAURA_SURFACE_FULLSCREEN_MODE_IMMERSIVE); } -class MockAuraOutput : public AuraOutput { - public: - using AuraOutput::AuraOutput; - - MOCK_METHOD(void, SendInsets, (const gfx::Insets&), (override)); -}; - -using ZAuraOutputTest = test::ExoTestBase; - -TEST_F(ZAuraOutputTest, SendInsets) { - int fds[2]; - ASSERT_EQ( - socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, /*protocol=*/0, fds), 0); - wl_display* wayland_display = wl_display_create(); - wl_client* client = wl_client_create(wayland_display, fds[0]); - wl_resource* resource = wl_resource_create( - client, &zaura_output_interface, ZAURA_OUTPUT_INSETS_SINCE_VERSION, 0); - - MockAuraOutput mock_aura_output(resource); - - UpdateDisplay("800x600"); - display::Display display = - display_manager()->GetDisplayForId(display_manager()->first_display_id()); - const gfx::Rect initial_bounds{800, 600}; - EXPECT_EQ(display.bounds(), initial_bounds); - const gfx::Rect new_work_area{10, 20, 500, 400}; - EXPECT_NE(display.work_area(), new_work_area); - display.set_work_area(new_work_area); - - const gfx::Insets expected_insets = initial_bounds.InsetsFrom(new_work_area); - EXPECT_CALL(mock_aura_output, SendInsets(expected_insets)).Times(1); - mock_aura_output.SendDisplayMetrics( - display, display::DisplayObserver::DISPLAY_METRIC_WORK_AREA); -} - } // namespace wayland } // namespace exo
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc index 85bf3f8..b582df1 100644 --- a/components/history/core/browser/history_backend.cc +++ b/components/history/core/browser/history_backend.cc
@@ -57,6 +57,7 @@ #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "sql/error_delegate_util.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/base/page_transition_types.h" #include "url/gurl.h" #include "url/url_constants.h" @@ -810,10 +811,16 @@ for (size_t redirect_index = 0; redirect_index < redirects.size(); redirect_index++) { + constexpr int kRedirectQualifiers = ui::PAGE_TRANSITION_CHAIN_START | + ui::PAGE_TRANSITION_CHAIN_END | + ui::PAGE_TRANSITION_IS_REDIRECT_MASK; + // Remove any redirect-related qualifiers that `request_transition` may + // have (there usually shouldn't be any, except for CLIENT_REDIRECT which + // was already handled above), and replace them with the `redirect_info`. ui::PageTransition t = ui::PageTransitionFromInt( - ui::PageTransitionStripQualifier(request_transition) | redirect_info); + (request_transition & ~kRedirectQualifiers) | redirect_info); - // If this is the last transition, add a CHAIN_END marker + // If this is the last transition, add a CHAIN_END marker. if (redirect_index == (redirects.size() - 1)) { t = ui::PageTransitionFromInt(t | ui::PAGE_TRANSITION_CHAIN_END); }
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc index 4330ad1a..b677f255 100644 --- a/components/history/core/browser/history_backend_unittest.cc +++ b/components/history/core/browser/history_backend_unittest.cc
@@ -3265,6 +3265,53 @@ EXPECT_EQ(1, url_row.typed_count()); } +TEST_F(HistoryBackendTest, RedirectWithQualifiers) { + // Create a redirect chain with 3 entries, with a page transition that + // includes a qualifier. + const ui::PageTransition page_transition = ui::PageTransitionFromInt( + ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); + const char* redirects[] = {"https://foo.com/page1.html", + "https://foo.com/page2.html", + "https://foo.com/page3.html", nullptr}; + AddRedirectChainWithTransitionAndTime(redirects, 0, page_transition, + base::Time::Now()); + + URLRow url1; + ASSERT_TRUE(backend_->GetURL(GURL("https://foo.com/page1.html"), &url1)); + URLRow url2; + ASSERT_TRUE(backend_->GetURL(GURL("https://foo.com/page2.html"), &url2)); + URLRow url3; + ASSERT_TRUE(backend_->GetURL(GURL("https://foo.com/page3.html"), &url3)); + + // Grab the resulting visits. + VisitVector visits1; + backend_->GetVisitsForURL(url1.id(), &visits1); + ASSERT_EQ(visits1.size(), 1u); + VisitVector visits2; + backend_->GetVisitsForURL(url2.id(), &visits2); + ASSERT_EQ(visits2.size(), 1u); + VisitVector visits3; + backend_->GetVisitsForURL(url3.id(), &visits3); + ASSERT_EQ(visits3.size(), 1u); + + // The page transition, including the qualifier, should have been preserved + // across all the visits. Additionally, the appropriate redirect qualifiers + // should have been set. + EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs( + visits1[0].transition, + ui::PageTransitionFromInt(page_transition | + ui::PAGE_TRANSITION_CHAIN_START))); + EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs( + visits2[0].transition, + ui::PageTransitionFromInt(page_transition | + ui::PAGE_TRANSITION_SERVER_REDIRECT))); + EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs( + visits3[0].transition, + ui::PageTransitionFromInt(page_transition | + ui::PAGE_TRANSITION_SERVER_REDIRECT | + ui::PAGE_TRANSITION_CHAIN_END))); +} + // Tests that a typed navigation will accrue the typed count even when a client // redirect from HTTP to HTTPS occurs. TEST_F(HistoryBackendTest, ClientRedirectScoring) {
diff --git a/components/page_load_metrics/browser/page_load_metrics_test_waiter.cc b/components/page_load_metrics/browser/page_load_metrics_test_waiter.cc index c93d9fbc..e1051cc 100644 --- a/components/page_load_metrics/browser/page_load_metrics_test_waiter.cc +++ b/components/page_load_metrics/browser/page_load_metrics_test_waiter.cc
@@ -5,6 +5,7 @@ #include "components/page_load_metrics/browser/page_load_metrics_test_waiter.h" #include "base/check_op.h" +#include "base/i18n/number_formatting.h" #include "components/page_load_metrics/browser/page_load_metrics_observer.h" #include "components/page_load_metrics/common/page_load_metrics.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -27,17 +28,20 @@ // PageLoadMetricsObserver used by the PageLoadMetricsTestWaiter to observe // metrics updates. -class WaiterMetricsObserver : public PageLoadMetricsObserver { +class WaiterMetricsObserver final : public PageLoadMetricsObserver { public: using FrameTreeNodeId = PageLoadMetricsObserver::FrameTreeNodeId; // We use a WeakPtr to the PageLoadMetricsTestWaiter because |waiter| can be // destroyed before this WaiterMetricsObserver. explicit WaiterMetricsObserver( - base::WeakPtr<PageLoadMetricsTestWaiter> waiter) - : waiter_(waiter) {} + base::WeakPtr<PageLoadMetricsTestWaiter> waiter, + const char* observer_name) + : waiter_(waiter), observer_name_(observer_name) {} ~WaiterMetricsObserver() override = default; + const char* GetObserverName() const override; + ObservePolicy OnFencedFramesStart( content::NavigationHandle* navigation_handle, const GURL& currently_committed_url) override; @@ -75,11 +79,18 @@ private: const base::WeakPtr<PageLoadMetricsTestWaiter> waiter_; + const char* observer_name_; }; PageLoadMetricsTestWaiter::PageLoadMetricsTestWaiter( content::WebContents* web_contents) - : MetricsLifecycleObserver(web_contents) {} + : MetricsLifecycleObserver(web_contents), + observer_name_("WaiterMetricsObserver") {} + +PageLoadMetricsTestWaiter::PageLoadMetricsTestWaiter( + content::WebContents* web_contents, + const char* observer_name_) + : MetricsLifecycleObserver(web_contents), observer_name_(observer_name_) {} PageLoadMetricsTestWaiter::~PageLoadMetricsTestWaiter() { CHECK(did_add_observer_); @@ -407,8 +418,8 @@ void PageLoadMetricsTestWaiter::AddObserver( page_load_metrics::PageLoadTracker* tracker) { ASSERT_FALSE(did_add_observer_); - tracker->AddObserver( - std::make_unique<WaiterMetricsObserver>(weak_factory_.GetWeakPtr())); + tracker->AddObserver(std::make_unique<WaiterMetricsObserver>( + weak_factory_.GetWeakPtr(), observer_name_)); did_add_observer_ = true; } @@ -505,12 +516,15 @@ expected_minimum_aggregate_cpu_time_ = base::TimeDelta(); } -// TODO(https://crbug.com/1317494): Audit and use appropriate policy. +const char* WaiterMetricsObserver::GetObserverName() const { + return observer_name_; +} + page_load_metrics::PageLoadMetricsObserver::ObservePolicy WaiterMetricsObserver::OnFencedFramesStart( content::NavigationHandle* navigation_handle, const GURL& currently_committed_url) { - return STOP_OBSERVING; + return FORWARD_OBSERVING; } void WaiterMetricsObserver::OnTimingUpdate(
diff --git a/components/page_load_metrics/browser/page_load_metrics_test_waiter.h b/components/page_load_metrics/browser/page_load_metrics_test_waiter.h index 947b183..078fa82 100644 --- a/components/page_load_metrics/browser/page_load_metrics_test_waiter.h +++ b/components/page_load_metrics/browser/page_load_metrics_test_waiter.h
@@ -45,6 +45,8 @@ page_load_metrics::PageLoadMetricsObserver::FrameTreeNodeId; explicit PageLoadMetricsTestWaiter(content::WebContents* web_contents); + explicit PageLoadMetricsTestWaiter(content::WebContents* web_contents, + const char* observer_name_); ~PageLoadMetricsTestWaiter() override; @@ -132,6 +134,8 @@ virtual void ResetExpectations(); private: + const char* observer_name_; + // Manages a bitset of TimingFields. class TimingFieldBitSet { public:
diff --git a/components/page_load_metrics/browser/page_load_tracker.cc b/components/page_load_metrics/browser/page_load_tracker.cc index e1b58ef9..028162c 100644 --- a/components/page_load_metrics/browser/page_load_tracker.cc +++ b/components/page_load_metrics/browser/page_load_tracker.cc
@@ -641,7 +641,11 @@ std::unique_ptr<PageLoadMetricsObserverInterface> observer) { if (observer->GetObserverName()) { DCHECK(observers_map_.find(observer->GetObserverName()) == - observers_map_.end()); + observers_map_.end()) + << "We expect that observer's class and name is unique in trackers. " + "Note that observer's class can be non-unique in test, e.g. " + "PageLoadMetricsTestWaiter. In that case, use a unique name in " + "the test. See also constructor of PageLoadMetricsTestWaiter."; observers_map_.emplace(observer->GetObserverName(), observer.get()); } observers_.push_back(std::move(observer));
diff --git a/components/page_load_metrics/browser/test_metrics_web_contents_observer_embedder.cc b/components/page_load_metrics/browser/test_metrics_web_contents_observer_embedder.cc index c92dcce..8e508b7 100644 --- a/components/page_load_metrics/browser/test_metrics_web_contents_observer_embedder.cc +++ b/components/page_load_metrics/browser/test_metrics_web_contents_observer_embedder.cc
@@ -18,9 +18,10 @@ // Simple PageLoadMetricsObserver that copies observed PageLoadTimings into the // provided std::vector, so they can be analyzed by unit tests. -class TestPageLoadMetricsObserver : public PageLoadMetricsObserver { +class TimingLoggingPageLoadMetricsObserver final + : public PageLoadMetricsObserver { public: - TestPageLoadMetricsObserver( + TimingLoggingPageLoadMetricsObserver( std::vector<mojom::PageLoadTimingPtr>* updated_timings, std::vector<mojom::PageLoadTimingPtr>* updated_subframe_timings, std::vector<mojom::PageLoadTimingPtr>* complete_timings, @@ -43,6 +44,11 @@ is_first_navigation_in_web_contents), count_on_enter_back_forward_cache_(count_on_enter_back_forward_cache) {} + const char* GetObserverName() const override { + static const char kName[] = "TimingLoggingPageLoadMetricsObserver"; + return kName; + } + ObservePolicy OnStart(content::NavigationHandle* navigation_handle, const GURL& currently_committed_url, bool started_in_foreground) override { @@ -52,11 +58,10 @@ return CONTINUE_OBSERVING; } - // TODO(https://crbug.com/1317494): Audit and use appropriate policy. ObservePolicy OnFencedFramesStart( content::NavigationHandle* navigation_handle, const GURL& currently_committed_url) override { - return STOP_OBSERVING; + return FORWARD_OBSERVING; } void OnTimingUpdate(content::RenderFrameHost* subframe_rfh, @@ -122,12 +127,17 @@ // Test PageLoadMetricsObserver that stops observing page loads with certain // substrings in the URL. -class FilteringPageLoadMetricsObserver : public PageLoadMetricsObserver { +class FilteringPageLoadMetricsObserver final : public PageLoadMetricsObserver { public: explicit FilteringPageLoadMetricsObserver( std::vector<GURL>* completed_filtered_urls) : completed_filtered_urls_(completed_filtered_urls) {} + const char* GetObserverName() const override { + static const char kName[] = "FilteringPageLoadMetricsObserver"; + return kName; + } + ObservePolicy OnStart(content::NavigationHandle* handle, const GURL& currently_committed_url, bool started_in_foreground) override { @@ -136,11 +146,10 @@ return should_ignore ? STOP_OBSERVING : CONTINUE_OBSERVING; } - // TODO(https://crbug.com/1317494): Audit and use appropriate policy. ObservePolicy OnFencedFramesStart( content::NavigationHandle* navigation_handle, const GURL& currently_committed_url) override { - return STOP_OBSERVING; + return FORWARD_OBSERVING; } ObservePolicy OnCommit(content::NavigationHandle* handle) override { @@ -171,7 +180,7 @@ void TestMetricsWebContentsObserverEmbedder::RegisterObservers( PageLoadTracker* tracker) { - tracker->AddObserver(std::make_unique<TestPageLoadMetricsObserver>( + tracker->AddObserver(std::make_unique<TimingLoggingPageLoadMetricsObserver>( &updated_timings_, &updated_subframe_timings_, &complete_timings_, &updated_cpu_timings_, &loaded_resources_, &observed_committed_urls_, &observed_aborted_urls_, &observed_features_,
diff --git a/components/password_manager/core/browser/password_store_proxy_backend.cc b/components/password_manager/core/browser/password_store_proxy_backend.cc index cac0e34..34b557e 100644 --- a/components/password_manager/core/browser/password_store_proxy_backend.cc +++ b/components/password_manager/core/browser/password_store_proxy_backend.cc
@@ -20,7 +20,9 @@ #include "components/password_manager/core/common/password_manager_features.h" #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/prefs/pref_service.h" +#include "components/sync/driver/sync_service.h" #include "components/sync/model/proxy_model_type_controller_delegate.h" +#include "google_apis/gaia/google_service_auth_error.h" namespace password_manager { @@ -89,30 +91,6 @@ return false; } -// This helper is used to determine main *and* shadow backends. Technically, -// some "Enable" groups don't require shadow traffic but they use it for safe -// deletions. -bool UsesAndroidBackendAsMainBackend(bool is_syncing) { - if (!is_syncing) - return false; - - if (!base::FeatureList::IsEnabled(features::kUnifiedPasswordManagerAndroid)) - return false; - - features::UpmExperimentVariation variation = - features::kUpmExperimentVariationParam.Get(); - switch (variation) { - case features::UpmExperimentVariation::kEnableForSyncingUsers: - case features::UpmExperimentVariation::kEnableOnlyBackendForSyncingUsers: - case features::UpmExperimentVariation::kEnableForAllUsers: - return true; - case features::UpmExperimentVariation::kShadowSyncingUsers: - return false; - } - NOTREACHED() << "Define explicitly whether Android is the main backend!"; - return false; -} - bool IsBuiltInBackendSyncEnabled() { DCHECK( base::FeatureList::IsEnabled(features::kUnifiedPasswordManagerAndroid)); @@ -644,21 +622,18 @@ void PasswordStoreProxyBackend::OnSyncServiceInitialized( syncer::SyncService* sync_service) { + sync_service_ = sync_service; android_backend_->OnSyncServiceInitialized(sync_service); } PasswordStoreBackend* PasswordStoreProxyBackend::main_backend() { - return UsesAndroidBackendAsMainBackend( - sync_delegate_->IsSyncingPasswordsEnabled()) - ? android_backend_ - : built_in_backend_; + return UsesAndroidBackendAsMainBackend() ? android_backend_ + : built_in_backend_; } PasswordStoreBackend* PasswordStoreProxyBackend::shadow_backend() { - return UsesAndroidBackendAsMainBackend( - sync_delegate_->IsSyncingPasswordsEnabled()) - ? built_in_backend_ - : android_backend_; + return UsesAndroidBackendAsMainBackend() ? built_in_backend_ + : android_backend_; } void PasswordStoreProxyBackend::OnRemoteFormChangesReceived( @@ -668,11 +643,34 @@ // `remote_form_changes_received` is used to inform observers about changes in // the backend. This check guarantees observers are informed only about // changes in the main backend. - if (originates_from_android.value() == - UsesAndroidBackendAsMainBackend( - sync_delegate_->IsSyncingPasswordsEnabled())) { + if (originates_from_android.value() == UsesAndroidBackendAsMainBackend()) { remote_form_changes_received.Run(std::move(changes)); } } +bool PasswordStoreProxyBackend::UsesAndroidBackendAsMainBackend() { + if (!sync_delegate_->IsSyncingPasswordsEnabled()) + return false; + + // Check for sync service errors if sync service is already initialized. + if (sync_service_ && sync_service_->GetAuthError().IsPersistentError()) + return false; + + if (!base::FeatureList::IsEnabled(features::kUnifiedPasswordManagerAndroid)) + return false; + + features::UpmExperimentVariation variation = + features::kUpmExperimentVariationParam.Get(); + switch (variation) { + case features::UpmExperimentVariation::kEnableForSyncingUsers: + case features::UpmExperimentVariation::kEnableOnlyBackendForSyncingUsers: + case features::UpmExperimentVariation::kEnableForAllUsers: + return true; + case features::UpmExperimentVariation::kShadowSyncingUsers: + return false; + } + NOTREACHED() << "Define explicitly whether Android is the main backend!"; + return false; +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_store_proxy_backend.h b/components/password_manager/core/browser/password_store_proxy_backend.h index 4eed518..0f2904b 100644 --- a/components/password_manager/core/browser/password_store_proxy_backend.h +++ b/components/password_manager/core/browser/password_store_proxy_backend.h
@@ -92,6 +92,12 @@ CallbackOriginatesFromAndroidBackend originatesFromAndroid, base::RepeatingClosure sync_enabled_or_disabled_cb); + // Helper used to determine main *and* shadow backends. Some UPM experiment + // groups use shadow traffic to compare the two backends, other may need it + // to execute login deletions on both backends, to avoid recovery of deleted + // data. + bool UsesAndroidBackendAsMainBackend(); + PasswordStoreBackend* main_backend(); PasswordStoreBackend* shadow_backend(); @@ -99,6 +105,7 @@ const raw_ptr<PasswordStoreBackend> android_backend_; raw_ptr<PrefService> const prefs_ = nullptr; const raw_ptr<SyncDelegate> sync_delegate_; + raw_ptr<syncer::SyncService> sync_service_ = nullptr; base::WeakPtrFactory<PasswordStoreProxyBackend> weak_ptr_factory_{this}; };
diff --git a/components/password_manager/core/browser/password_store_proxy_backend_unittest.cc b/components/password_manager/core/browser/password_store_proxy_backend_unittest.cc index d600a59ab..af930bd 100644 --- a/components/password_manager/core/browser/password_store_proxy_backend_unittest.cc +++ b/components/password_manager/core/browser/password_store_proxy_backend_unittest.cc
@@ -706,6 +706,79 @@ proxy_backend().OnSyncServiceInitialized(&sync_service); } +TEST_F(PasswordStoreProxyBackendTest, + UsesAndroidBackendAsMainBackendPasswordSyncDisabledInSettings) { + base::test::ScopedFeatureList feature_list; + // Enable UPM for syncing users only. + feature_list.InitAndEnableFeatureWithParameters( + features::kUnifiedPasswordManagerAndroid, {{"stage", "2"}}); + + // Imitate password sync being disabled in settings. + EXPECT_CALL(sync_delegate(), IsSyncingPasswordsEnabled) + .WillRepeatedly(Return(false)); + + // Initialize sync service. + syncer::TestSyncService sync_service; + EXPECT_CALL(android_backend(), OnSyncServiceInitialized(&sync_service)); + proxy_backend().OnSyncServiceInitialized(&sync_service); + + // Verify that android backend is not used. + EXPECT_CALL(android_backend(), GetAllLoginsAsync).Times(0); + EXPECT_CALL(built_in_backend(), GetAllLoginsAsync); + proxy_backend().GetAllLoginsAsync(base::DoNothing()); +} + +TEST_F(PasswordStoreProxyBackendTest, + UsesAndroidBackendAsMainBackendSyncPersistentAuthError) { + base::test::ScopedFeatureList feature_list; + // Enable UPM for syncing users only. + feature_list.InitAndEnableFeatureWithParameters( + features::kUnifiedPasswordManagerAndroid, {{"stage", "2"}}); + + EXPECT_CALL(sync_delegate(), IsSyncingPasswordsEnabled) + .WillRepeatedly(Return(true)); + + // Initialize sync service. + syncer::TestSyncService sync_service; + GoogleServiceAuthError persistent_error( + GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); + ASSERT_TRUE(persistent_error.IsPersistentError()); + sync_service.SetAuthError(persistent_error); + EXPECT_CALL(android_backend(), OnSyncServiceInitialized(&sync_service)); + proxy_backend().OnSyncServiceInitialized(&sync_service); + + // Verify that android backend is not used. + EXPECT_CALL(android_backend(), GetAllLoginsAsync).Times(0); + EXPECT_CALL(built_in_backend(), GetAllLoginsAsync); + proxy_backend().GetAllLoginsAsync(base::DoNothing()); +} + +TEST_F(PasswordStoreProxyBackendTest, + UsesAndroidBackendAsMainBackendSyncTransientAuthError) { + base::test::ScopedFeatureList feature_list; + // Enable UPM for syncing users only. + feature_list.InitAndEnableFeatureWithParameters( + features::kUnifiedPasswordManagerAndroid, {{"stage", "2"}}); + + EXPECT_CALL(sync_delegate(), IsSyncingPasswordsEnabled) + .WillRepeatedly(Return(true)); + + // Initialize sync service. + syncer::TestSyncService sync_service; + GoogleServiceAuthError transient_error( + GoogleServiceAuthError::CONNECTION_FAILED); + ASSERT_TRUE(transient_error.IsTransientError()); + sync_service.SetAuthError(transient_error); + EXPECT_CALL(android_backend(), OnSyncServiceInitialized(&sync_service)); + proxy_backend().OnSyncServiceInitialized(&sync_service); + + // Transient errors should not stop users from accessing android backend, as + // they are likely to succeed on retries. + EXPECT_CALL(android_backend(), GetAllLoginsAsync); + EXPECT_CALL(built_in_backend(), GetAllLoginsAsync).Times(0); + proxy_backend().GetAllLoginsAsync(base::DoNothing()); +} + // Holds the main and shadow backend's logins and the expected number of common // and different logins. struct LoginsMetricsParam {
diff --git a/components/permissions/BUILD.gn b/components/permissions/BUILD.gn index c3ead7f..ca123ef39 100644 --- a/components/permissions/BUILD.gn +++ b/components/permissions/BUILD.gn
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# TODO(698985): Make `permissions_common` source_set. +# TODO(crbug.com/1327384): Make `permissions_common` source_set. component("permissions_common") { sources = [ "constants.cc",
diff --git a/components/permissions/permission_util.h b/components/permissions/permission_util.h index 6054553..4a44362 100644 --- a/components/permissions/permission_util.h +++ b/components/permissions/permission_util.h
@@ -75,6 +75,7 @@ // Returns the authoritative `embedding origin`, as a GURL, to be used for // permission decisions in `render_frame_host`. + // TODO(crbug.com/1327384): Remove this method when possible. static GURL GetLastCommittedOriginAsURL( content::RenderFrameHost* render_frame_host);
diff --git a/components/services/screen_ai/proto/proto_convertor.cc b/components/services/screen_ai/proto/proto_convertor.cc index 7451eaca..9eb6476 100644 --- a/components/services/screen_ai/proto/proto_convertor.cc +++ b/components/services/screen_ai/proto/proto_convertor.cc
@@ -181,9 +181,12 @@ uie->set_parent_id(new_id[child_id_to_parent_id[ax_node_id]]); } + // TODO(https://crbug.com/1278249): Bounding box and Bounding Box Pixels + // do not consider offset container, ransforms, device scaling, clipping, + // offscreen state, etc. This should be fixed the same way the data is + // created for training Screen2x models. + // Bounding Box. - // These values are relative to the container position and not to the - // actual top-left of the screen. Screen2x is fine with that. uie->mutable_bounding_box()->set_top(node.relative_bounds.bounds.y() / snapshot_height); uie->mutable_bounding_box()->set_left(node.relative_bounds.bounds.x() / @@ -194,8 +197,6 @@ snapshot_width); // Bounding Box Pixels. - // These values are relative to the container position and not to the - // actual top-left of the screen. Screen2x is fine with that. uie->mutable_bounding_box_pixels()->set_top( node.relative_bounds.bounds.y()); uie->mutable_bounding_box_pixels()->set_left( @@ -205,10 +206,6 @@ uie->mutable_bounding_box_pixels()->set_right( node.relative_bounds.bounds.right()); - // Ensure all |relative_bound| values are relative to the root. - DCHECK(node.relative_bounds.offset_container_id == - snapshot.nodes[root_index].relative_bounds.offset_container_id); - // TODO(https://crbug.com/1278249): Add non-essential values. }
diff --git a/components/services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.cc b/components/services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.cc index f14a629..7ae9b0b 100644 --- a/components/services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.cc +++ b/components/services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.cc
@@ -42,6 +42,13 @@ BrokerFilePermission::ReadOnly("/dev/urandom"), BrokerFilePermission::ReadOnly("/proc/meminfo")}; + // The models are in the same folder as the library, and the library requires + // read access for them. + if (!library_path.empty()) { + permissions.push_back(BrokerFilePermission::ReadOnlyRecursive( + library_path.DirName().MaybeAsASCII() + base::FilePath::kSeparators)); + } + if (features::IsScreenAIDebugModeEnabled()) { permissions.push_back( BrokerFilePermission::ReadWriteCreateRecursive("/tmp/"));
diff --git a/components/services/screen_ai/screen_ai_service_impl.cc b/components/services/screen_ai/screen_ai_service_impl.cc index ea3b0b5b..810c211c 100644 --- a/components/services/screen_ai/screen_ai_service_impl.cc +++ b/components/services/screen_ai/screen_ai_service_impl.cc
@@ -9,55 +9,28 @@ #include "components/services/screen_ai/public/cpp/utilities.h" #include "ui/accessibility/accessibility_features.h" -namespace { - -enum class InitializationResult { - kOk = 0, - kErrorInvalidLibraryFunctions = 1, - kErrorInitializationFailed = 2, -}; - -} // namespace - namespace screen_ai { ScreenAIService::ScreenAIService( mojo::PendingReceiver<mojom::ScreenAIService> receiver) : library_(GetPreloadedLibraryFilePath()), - screen_ai_init_function_(reinterpret_cast<ScreenAIInitFunction>( - library_.GetFunctionPointer("InitScreenAI"))), + init_function_( + reinterpret_cast<InitFunction>(library_.GetFunctionPointer("Init"))), annotate_function_(reinterpret_cast<AnnotateFunction>( library_.GetFunctionPointer("Annotate"))), - screen_2x_init_function_(reinterpret_cast<Screen2xInitFunction>( - library_.GetFunctionPointer("InitScreen2x"))), extract_main_content_function_( reinterpret_cast<ExtractMainContentFunction>( library_.GetFunctionPointer("ExtractMainContent"))), receiver_(this, std::move(receiver)) { - auto init_result = InitializationResult::kOk; - - if (features::IsScreenAIVisualAnnotationsEnabled()) { - if (!screen_ai_init_function_ || !annotate_function_) - init_result = InitializationResult::kErrorInvalidLibraryFunctions; - else if (!screen_ai_init_function_(features::IsScreenAIDebugModeEnabled())) - init_result = InitializationResult::kErrorInitializationFailed; - } - - if (features::IsReadAnythingWithScreen2xEnabled()) { - if (!screen_2x_init_function_ || !extract_main_content_function_) - init_result = InitializationResult::kErrorInvalidLibraryFunctions; - else if (!screen_2x_init_function_( - features::IsScreenAIDebugModeEnabled())) { - init_result = InitializationResult::kErrorInitializationFailed; - } - } - - if (init_result != InitializationResult::kOk) { + DCHECK(init_function_ && annotate_function_ && + extract_main_content_function_); + if (!init_function_(features::IsScreenAIVisualAnnotationsEnabled(), + features::IsReadAnythingWithScreen2xEnabled(), + features::IsScreenAIDebugModeEnabled(), + GetPreloadedLibraryFilePath().DirName().MaybeAsASCII())) { // TODO(https://crbug.com/1278249): Add UMA metrics to monitor failures. - VLOG(1) << "Screen AI library initialization failed: " - << static_cast<int>(init_result); - base::Process::TerminateCurrentProcessImmediately( - static_cast<int>(init_result)); + VLOG(0) << "Screen AI library initialization failed."; + base::Process::TerminateCurrentProcessImmediately(-1); } }
diff --git a/components/services/screen_ai/screen_ai_service_impl.h b/components/services/screen_ai/screen_ai_service_impl.h index 8c3744e8..ba21a8fc 100644 --- a/components/services/screen_ai/screen_ai_service_impl.h +++ b/components/services/screen_ai/screen_ai_service_impl.h
@@ -51,16 +51,16 @@ mojo::PendingReceiver<mojom::Screen2xMainContentExtractor> main_content_extractor) override; - typedef bool (*ScreenAIInitFunction)(bool /*debug_mode*/); - ScreenAIInitFunction screen_ai_init_function_; + typedef bool (*InitFunction)(bool /*init_visual_annotations*/, + bool /*init_main_content_extraction*/, + bool /*debug_mode*/, + const std::string& models_path); + InitFunction init_function_; typedef bool (*AnnotateFunction)(const SkBitmap& /*image*/, std::string& /*annotation_text*/); AnnotateFunction annotate_function_; - typedef bool (*Screen2xInitFunction)(bool /*debug_mode*/); - Screen2xInitFunction screen_2x_init_function_; - typedef bool (*ExtractMainContentFunction)( const std::string& /*serialized_snapshot*/, std::vector<int32_t>& /*content_node_ids*/);
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 6fe723b5..00a4b8e 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -83,7 +83,7 @@ "//components/payments/mojom", "//components/services/screen_ai/buildflags", - # TODO(698985): Remove `permissions_common`. + # TODO(crbug.com/1327384): Remove `permissions_common`. "//components/permissions:permissions_common", "//components/power_scheduler", "//components/services/filesystem:lib", @@ -1351,7 +1351,7 @@ "permissions/permission_service_impl.cc", "permissions/permission_service_impl.h", - # TODO(698985): Remove `permission_util.*`. + # TODO(crbug.com/1327384): Remove `permission_util.*`. "net/cross_origin_embedder_policy_reporter.cc", "net/cross_origin_embedder_policy_reporter.h", "net/cross_origin_opener_policy_reporter.cc",
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index 81824f2..94d29aa 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -3283,6 +3283,12 @@ RunRegressionTest(FILE_PATH_LITERAL("aria-hidden-tabindex-change.html")); } +IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, + ClearChildrenWhileComputingName) { + RunRegressionTest( + FILE_PATH_LITERAL("clear-children-while-computing-name.html")); +} + IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, HiddenTable) { RunRegressionTest(FILE_PATH_LITERAL("hidden-table.html")); }
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc index c8044ba..06b34e10 100644 --- a/content/browser/browser_context.cc +++ b/content/browser/browser_context.cc
@@ -54,6 +54,7 @@ #include "media/capabilities/in_memory_video_decode_stats_db_impl.h" #include "media/capabilities/video_decode_stats_db_impl.h" #include "media/mojo/services/video_decode_perf_history.h" +#include "media/mojo/services/webrtc_video_perf_history.h" #include "storage/browser/blob/blob_storage_context.h" #include "storage/browser/database/database_tracker.h" #include "storage/browser/file_system/external_mount_points.h" @@ -303,6 +304,10 @@ return impl()->GetVideoDecodePerfHistory(); } +media::WebrtcVideoPerfHistory* BrowserContext::GetWebrtcVideoPerfHistory() { + return impl()->GetWebrtcVideoPerfHistory(); +} + media::learning::LearningSession* BrowserContext::GetLearningSession() { return impl()->GetLearningSession(); }
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc index 75a4318d..0c6808c 100644 --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc
@@ -264,6 +264,8 @@ if (gpu_feature_data.name == "skia_renderer" || gpu_feature_data.name == "raw_draw" || gpu_feature_data.name == "direct_rendering_display_compositor" || + gpu_feature_data.name == + "force_gpu_main_thread_to_normal_priority_drdc" || gpu_feature_data.name == "viz_hit_test_surface_layer") { status = (gpu_feature_data.disabled ? "disabled_off_ok" : "enabled_on"); } else if (gpu_feature_data.disabled || gpu_access_blocked ||
diff --git a/content/browser/permissions/permission_util.h b/content/browser/permissions/permission_util.h index 96f9df4d..0716491 100644 --- a/content/browser/permissions/permission_util.h +++ b/content/browser/permissions/permission_util.h
@@ -14,6 +14,7 @@ public: // Returns the authoritative `embedding origin`, as a GURL, to be used for // permission decisions in `render_frame_host`. + // TODO(crbug.com/1327384): Remove this method when possible. static GURL GetLastCommittedOriginAsURL( content::RenderFrameHost* render_frame_host); };
diff --git a/content/browser/picture_in_picture/picture_in_picture_service_impl.cc b/content/browser/picture_in_picture/picture_in_picture_service_impl.cc index 26e418a..c446d0ab 100644 --- a/content/browser/picture_in_picture/picture_in_picture_service_impl.cc +++ b/content/browser/picture_in_picture/picture_in_picture_service_impl.cc
@@ -36,6 +36,7 @@ const gfx::Size& natural_size, bool show_play_pause_button, mojo::PendingRemote<blink::mojom::PictureInPictureSessionObserver> observer, + const gfx::Rect& source_bounds, StartSessionCallback callback) { gfx::Size window_size; mojo::PendingRemote<blink::mojom::PictureInPictureSession> session_remote; @@ -43,8 +44,8 @@ auto result = GetController().StartSession( this, MediaPlayerId(render_frame_host()->GetGlobalId(), player_id), std::move(player_remote), surface_id, natural_size, - show_play_pause_button, std::move(observer), &session_remote, - &window_size); + show_play_pause_button, std::move(observer), source_bounds, + &session_remote, &window_size); if (result == PictureInPictureResult::kSuccess) { // Frames are to be blocklisted from the back-forward cache because the
diff --git a/content/browser/picture_in_picture/picture_in_picture_service_impl.h b/content/browser/picture_in_picture/picture_in_picture_service_impl.h index 66101dbb..03e3149 100644 --- a/content/browser/picture_in_picture/picture_in_picture_service_impl.h +++ b/content/browser/picture_in_picture/picture_in_picture_service_impl.h
@@ -48,6 +48,7 @@ const gfx::Size& natural_size, bool show_play_pause_button, mojo::PendingRemote<blink::mojom::PictureInPictureSessionObserver>, + const gfx::Rect& source_bounds, StartSessionCallback) final; private:
diff --git a/content/browser/picture_in_picture/picture_in_picture_service_impl_unittest.cc b/content/browser/picture_in_picture/picture_in_picture_service_impl_unittest.cc index f3fc742..9de6db5 100644 --- a/content/browser/picture_in_picture/picture_in_picture_service_impl_unittest.cc +++ b/content/browser/picture_in_picture/picture_in_picture_service_impl_unittest.cc
@@ -221,10 +221,11 @@ mojo::Remote<blink::mojom::PictureInPictureSession> session_remote; gfx::Size window_size; + const gfx::Rect source_bounds(1, 2, 3, 4); service().StartSession( kPlayerVideoOnlyId, BindMediaPlayerReceiverAndPassRemote(), surface_id, gfx::Size(42, 42), true /* show_play_pause_button */, - std::move(observer_remote), + std::move(observer_remote), source_bounds, base::BindLambdaForTesting( [&](mojo::PendingRemote<blink::mojom::PictureInPictureSession> remote, const gfx::Size& b) { @@ -233,9 +234,9 @@ window_size = b; })); - EXPECT_TRUE(controller->active_session_for_testing()); EXPECT_TRUE(session_remote); EXPECT_EQ(gfx::Size(42, 42), window_size); + EXPECT_EQ(source_bounds, controller->GetSourceBounds()); // Picture-in-Picture media player id should not be reset when the media is // destroyed (e.g. video stops playing). This allows the Picture-in-Picture @@ -265,11 +266,12 @@ mojo::Remote<blink::mojom::PictureInPictureSession> session_remote; gfx::Size window_size; + const gfx::Rect source_bounds(1, 2, 3, 4); service().StartSession( kPlayerVideoOnlyId, BindMediaPlayerReceiverAndPassRemote(), surface_id, gfx::Size(42, 42), true /* show_play_pause_button */, - std::move(observer_remote), + std::move(observer_remote), source_bounds, base::BindLambdaForTesting( [&](mojo::PendingRemote<blink::mojom::PictureInPictureSession> remote, const gfx::Size& b) {
diff --git a/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.cc b/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.cc index d06acce..03f62e7f 100644 --- a/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.cc +++ b/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.cc
@@ -213,6 +213,7 @@ const gfx::Size& natural_size, bool show_play_pause_button, mojo::PendingRemote<blink::mojom::PictureInPictureSessionObserver> observer, + const gfx::Rect& source_bounds, mojo::PendingRemote<blink::mojom::PictureInPictureSession>* session_remote, gfx::Size* window_size) { auto result = GetWebContentsImpl()->EnterPictureInPicture(); @@ -240,6 +241,7 @@ // If the window is closed by the system, then the picture in picture session // will end. The renderer must call `StartSession()` again. + source_bounds_ = source_bounds; EmbedSurface(surface_id, natural_size); SetShowPlayPauseButton(show_play_pause_button); Show(); @@ -432,6 +434,11 @@ surface_id_ = viz::SurfaceId(); } +const gfx::Rect& VideoPictureInPictureWindowControllerImpl::GetSourceBounds() + const { + return source_bounds_; +} + void VideoPictureInPictureWindowControllerImpl:: UpdatePlayPauseButtonVisibility() { if (!window_)
diff --git a/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h b/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h index 8c953828..6c31be2 100644 --- a/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h +++ b/content/browser/picture_in_picture/video_picture_in_picture_window_controller_impl.h
@@ -78,6 +78,7 @@ void ToggleMicrophone() override; void ToggleCamera() override; void HangUp() override; + const gfx::Rect& GetSourceBounds() const override; // Called by the MediaSessionImpl when the MediaSessionInfo changes. void MediaSessionInfoChanged( @@ -118,6 +119,7 @@ const gfx::Size& natural_size, bool show_play_pause_button, mojo::PendingRemote<blink::mojom::PictureInPictureSessionObserver>, + const gfx::Rect& source_bounds, mojo::PendingRemote<blink::mojom::PictureInPictureSession>* session_remote, gfx::Size* window_size); @@ -191,6 +193,9 @@ // The media position info as last reported to us by MediaSessionImpl. absl::optional<media_session::MediaPosition> media_position_; + // Coordinates of the video element in WebContents coordinates. + gfx::Rect source_bounds_; + WEB_CONTENTS_USER_DATA_KEY_DECL(); };
diff --git a/content/browser/renderer_host/back_forward_cache_metrics.cc b/content/browser/renderer_host/back_forward_cache_metrics.cc index 6a98f75..775e20b9 100644 --- a/content/browser/renderer_host/back_forward_cache_metrics.cc +++ b/content/browser/renderer_host/back_forward_cache_metrics.cc
@@ -65,39 +65,40 @@ // static scoped_refptr<BackForwardCacheMetrics> -BackForwardCacheMetrics::CreateOrReuseBackForwardCacheMetrics( - NavigationEntryImpl* currently_committed_entry, +BackForwardCacheMetrics::CreateOrReuseBackForwardCacheMetricsForNavigation( + NavigationEntryImpl* previous_entry, bool is_main_frame_navigation, - int64_t document_sequence_number) { - if (!currently_committed_entry) { - // In some rare cases it's possible to navigate a subframe - // without having a main frame navigation (e.g. extensions - // injecting frames into a blank page). + int64_t committing_document_sequence_number) { + if (!previous_entry) { + // There is no previous NavigationEntry, so we must create a new metrics + // object. return base::WrapRefCounted(new BackForwardCacheMetrics( - is_main_frame_navigation ? document_sequence_number : -1)); + is_main_frame_navigation ? committing_document_sequence_number : -1)); } - BackForwardCacheMetrics* currently_committed_metrics = - currently_committed_entry->back_forward_cache_metrics(); - if (!currently_committed_metrics) { - // When we restore the session it's possible to end up with an entry without - // metrics. - // We will have to create a new metrics object for the main document. + BackForwardCacheMetrics* previous_entry_metrics = + previous_entry->back_forward_cache_metrics(); + if (!previous_entry_metrics) { + // It's possible to encounter a `previous_entry` without metrics, e.g. on + // session restore. We will have to create a new metrics object for the main + // document. return base::WrapRefCounted(new BackForwardCacheMetrics( is_main_frame_navigation - ? document_sequence_number - : currently_committed_entry->root_node() + ? committing_document_sequence_number + : previous_entry->root_node() ->frame_entry->document_sequence_number())); } - if (!is_main_frame_navigation) - return currently_committed_metrics; - if (document_sequence_number == - currently_committed_metrics->document_sequence_number_) { - return currently_committed_metrics; + // Reuse `previous_entry_metrics` on subframe navigations and same-document + // navigations. + if (!is_main_frame_navigation || + committing_document_sequence_number == + previous_entry_metrics->document_sequence_number_) { + return previous_entry_metrics; } + return base::WrapRefCounted( - new BackForwardCacheMetrics(document_sequence_number)); + new BackForwardCacheMetrics(committing_document_sequence_number)); } BackForwardCacheMetrics::BackForwardCacheMetrics( @@ -116,17 +117,17 @@ void BackForwardCacheMetrics::DidCommitNavigation( NavigationRequest* navigation, bool back_forward_cache_allowed) { - // "Back-forward cache in enabled only for primary frame trees, so we need to - // record metrics only for primary main frame navigations". + // Back-forward cache in enabled only for primary frame trees, so we need to + // record metrics only for primary main frame navigations. if (!navigation->IsInPrimaryMainFrame() || navigation->IsSameDocument()) return; - { - bool is_reload = navigation->GetReloadType() != ReloadType::NONE; - RecordHistogramForReloadsAndHistoryNavigations(is_reload, - back_forward_cache_allowed); - } + // Record metrics for reloads after history navigation, if applicable. + RecordHistogramForReloadsAfterHistoryNavigations( + navigation->GetReloadType() != ReloadType::NONE, + back_forward_cache_allowed); + // Record metrics for history navigation, if applicable. if (IsHistoryNavigation(navigation)) { UpdateNotRestoredReasonsForNavigation(navigation); @@ -173,17 +174,19 @@ std::move(page_store_tree_result_)); } } - page_store_result_ = - std::make_unique<BackForwardCacheCanStoreDocumentResult>(); - page_store_tree_result_ = nullptr; + // Save the information about the last cross-document main frame navigation + // that uses this metrics object. previous_navigation_is_served_from_bfcache_ = navigation->IsServedFromBackForwardCache(); previous_navigation_is_history_ = IsHistoryNavigation(navigation); last_committed_cross_document_main_frame_navigation_id_ = navigation->GetNavigationId(); - // BackForwardCacheMetrics can be reused when reloading. Reset fields for UKM + // BackForwardCacheMetrics can be reused in some cases. Reset fields for UKM // for the next navigation. + page_store_result_ = + std::make_unique<BackForwardCacheCanStoreDocumentResult>(); + page_store_tree_result_ = nullptr; navigated_away_from_main_document_timestamp_ = absl::nullopt; started_navigation_timestamp_ = absl::nullopt; renderer_killed_timestamp_ = absl::nullopt; @@ -260,9 +263,7 @@ } } -void BackForwardCacheMetrics::MainFrameDidNavigateAwayFromDocument( - RenderFrameHostImpl* new_main_frame, - NavigationRequest* navigation) { +void BackForwardCacheMetrics::MainFrameDidNavigateAwayFromDocument() { // MainFrameDidNavigateAwayFromDocument is called when we commit a navigation // to another main frame document and the current document loses its "last // committed" status. @@ -329,10 +330,13 @@ void BackForwardCacheMetrics::UpdateNotRestoredReasonsForNavigation( NavigationRequest* navigation) { + DCHECK(IsHistoryNavigation(navigation)); BackForwardCacheCanStoreDocumentResult new_blocking_reasons; - // |last_committed_cross_document_main_frame_navigation_id_| is -1 when - // navigation history has never been initialized. This can happen only when - // the session history has been restored. + // |last_committed_cross_document_main_frame_navigation_id_| is -1 even though + // this is a history navigation. This can happen only when the session history + // has been restored, as the NavigationEntry will exist and can be navigated + // to, but the BackForwardCacheMetrics object is brand new (as it's not + // persisted and restored). if (last_committed_cross_document_main_frame_navigation_id_ == -1) { new_blocking_reasons.No(NotRestoredReason::kSessionRestored); } @@ -486,15 +490,13 @@ "BackForwardCache.AllSites.EvictedAfterDocumentRestoredReason", reason); } -void BackForwardCacheMetrics::RecordHistogramForReloadsAndHistoryNavigations( +void BackForwardCacheMetrics::RecordHistogramForReloadsAfterHistoryNavigations( bool is_reload, bool back_forward_cache_allowed) const { - if (!is_reload) + if (!is_reload || !previous_navigation_is_history_ || + !back_forward_cache_allowed) { return; - if (!previous_navigation_is_history_) - return; - if (!back_forward_cache_allowed) - return; + } // Record the total number of reloads after a history navigation. UMA_HISTOGRAM_ENUMERATION(
diff --git a/content/browser/renderer_host/back_forward_cache_metrics.h b/content/browser/renderer_host/back_forward_cache_metrics.h index 1c83a09..b336359 100644 --- a/content/browser/renderer_host/back_forward_cache_metrics.h +++ b/content/browser/renderer_host/back_forward_cache_metrics.h
@@ -155,19 +155,20 @@ kMaxValue = kServedFromBackForwardCache, }; - // Creates a potential new metrics object for the navigation. + // Gets the metrics object for a committed navigation. // Note that this object will not be used if the entry we are navigating to // already has the BackForwardCacheMetrics object (which happens for history - // navigations). + // navigations). We will reuse `previous_entry`'s metrics object if the + // navigation is a subframe navigation or if it's same-document with + // `previous_entry`'s document. // // |document_sequence_number| is the sequence number of the document - // associated with the document associated with the navigating frame and it is - // ignored if the navigating frame is not a main one. + // associated with the navigating frame. static scoped_refptr<BackForwardCacheMetrics> - CreateOrReuseBackForwardCacheMetrics( - NavigationEntryImpl* currently_committed_entry, + CreateOrReuseBackForwardCacheMetricsForNavigation( + NavigationEntryImpl* previous_entry, bool is_main_frame_navigation, - int64_t document_sequence_number); + int64_t committing_document_sequence_number); BackForwardCacheMetrics(const BackForwardCacheMetrics&) = delete; BackForwardCacheMetrics& operator=(const BackForwardCacheMetrics&) = delete; @@ -177,7 +178,7 @@ static void RecordEvictedAfterDocumentRestored( EvictedAfterDocumentRestoredReason reason); - // Sets the reason why the browsing instance is not swapped. Passing + // Sets the reason why the browsing instance is swapped/not swapped. Passing // absl::nullopt resets the reason. void SetBrowsingInstanceSwapResult( absl::optional<ShouldSwapBrowsingInstance> reason); @@ -207,11 +208,7 @@ // Records when another navigation commits away from the most recent entry // associated with |this|. This is the point in time that the previous // document could enter the back-forward cache. - // |new_main_document| points to the newly committed RFH, which might or might - // not be the same as the RFH for the old document. - void MainFrameDidNavigateAwayFromDocument( - RenderFrameHostImpl* new_main_document, - NavigationRequest* navigation); + void MainFrameDidNavigateAwayFromDocument(); // Snapshots the state of the features active on the page before closing it. // It should be called at the same time when the document might have been @@ -274,7 +271,7 @@ // particular we are interested in number of reloads after a restore from // the back-forward cache as a proxy for detecting whether the page was // broken or not. - void RecordHistogramForReloadsAndHistoryNavigations( + void RecordHistogramForReloadsAfterHistoryNavigations( bool is_reload, bool back_forward_cache_allowed) const; @@ -282,18 +279,31 @@ // are known only at the commit time. void UpdateNotRestoredReasonsForNavigation(NavigationRequest* navigation); + // Whether the last navigation swapped BrowsingInstance or not. Returns true + // if the last navigation did swap BrowsingInstance, or if it's unknown + // (`browsing_instance_swap_result_` is not set). Returns false otherwise. bool DidSwapBrowsingInstance() const; // Main frame document sequence number that identifies all NavigationEntries // this metrics object is associated with. const int64_t document_sequence_number_; - // NavigationHandle's ID for the last main frame navigation. This is updated - // for a main frame, not-same-document navigation. + // NavigationHandle's ID for the last cross-document main frame navigation + // that uses this metrics object. // // Should not be confused with NavigationEntryId. int64_t last_committed_cross_document_main_frame_navigation_id_ = -1; + // These values are updated only for cross-document main frame navigations. + bool previous_navigation_is_history_ = false; + bool previous_navigation_is_served_from_bfcache_ = false; + + // ====== Post-navigation reuse boundary ======== + // The variables above these are kept after we finished + // logging the metrics for the last navigation that used this metrics object, + // as they are needed for logging metrics for future navigations. + // The variables below are reset after logging. + blink::scheduler::WebSchedulerTrackedFeatures main_frame_features_; // We record metrics for same-origin frames and cross-origin frames // differently as we might want to apply different policies for them, @@ -306,6 +316,7 @@ absl::optional<base::TimeTicks> started_navigation_timestamp_; absl::optional<base::TimeTicks> navigated_away_from_main_document_timestamp_; + absl::optional<base::TimeTicks> renderer_killed_timestamp_; // TODO: Store BackForwardCacheCanStoreDocumentResultWithTree instead of // storing unique_ptr of BackForwardCacheCanStoreDocumentResult and @@ -313,18 +324,11 @@ std::unique_ptr<BackForwardCacheCanStoreDocumentResult> page_store_result_; std::unique_ptr<BackForwardCacheCanStoreTreeResult> page_store_tree_result_; - // This value is updated only for navigations which are not same-document and - // main-frame navigations. - bool previous_navigation_is_history_ = false; - bool previous_navigation_is_served_from_bfcache_ = false; - - absl::optional<base::TimeTicks> renderer_killed_timestamp_; + // The reason why the last attempted navigation in the main frame used or + // didn't use a new BrowsingInstance. + absl::optional<ShouldSwapBrowsingInstance> browsing_instance_swap_result_; TestObserver* test_observer_ = nullptr; - - // The reason why the last attempted navigation in the frame used or didn't - // use a new BrowsingInstance. - absl::optional<ShouldSwapBrowsingInstance> browsing_instance_swap_result_; }; } // namespace content
diff --git a/content/browser/renderer_host/input/fling_controller_unittest.cc b/content/browser/renderer_host/input/fling_controller_unittest.cc index 81208f00..ebd445ad 100644 --- a/content/browser/renderer_host/input/fling_controller_unittest.cc +++ b/content/browser/renderer_host/input/fling_controller_unittest.cc
@@ -216,7 +216,6 @@ bool first_wheel_event_sent_ = false; int sent_scroll_gesture_count_ = 0; #if BUILDFLAG(IS_WIN) - // This is necessary for static methods of `display::ScreenWin`. display::win::test::ScopedScreenWin scoped_screen_win_; #endif
diff --git a/content/browser/renderer_host/input/fling_scheduler_unittest.cc b/content/browser/renderer_host/input/fling_scheduler_unittest.cc index 1b45630..f8de4972b 100644 --- a/content/browser/renderer_host/input/fling_scheduler_unittest.cc +++ b/content/browser/renderer_host/input/fling_scheduler_unittest.cc
@@ -15,6 +15,10 @@ #include "content/test/test_render_widget_host.h" #include "testing/gtest/include/gtest/gtest.h" +#if BUILDFLAG(IS_WIN) +#include "ui/display/win/test/scoped_screen_win.h" +#endif + namespace content { class FakeFlingScheduler : public FlingScheduler { @@ -135,6 +139,9 @@ scoped_refptr<SiteInstanceGroup> site_instance_group_; std::unique_ptr<TestRenderWidgetHostView> view_; std::unique_ptr<MockRenderWidgetHostDelegate> delegate_; +#if BUILDFLAG(IS_WIN) + display::win::test::ScopedScreenWin scoped_screen_win_; +#endif }; TEST_F(FlingSchedulerTest, ScheduleNextFlingProgress) {
diff --git a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc index 8ba2b0f7..292f17f 100644 --- a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
@@ -25,6 +25,10 @@ #include "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h" #include "ui/events/blink/blink_features.h" +#if BUILDFLAG(IS_WIN) +#include "ui/display/win/test/scoped_screen_win.h" +#endif + using blink::WebGestureDevice; using blink::WebGestureEvent; using blink::WebInputEvent; @@ -240,6 +244,9 @@ std::unique_ptr<blink::mojom::InputEventResultState> sync_ack_result_; std::unique_ptr<WebGestureEvent> sync_followup_event_; base::test::ScopedFeatureList feature_list_; +#if BUILDFLAG(IS_WIN) + display::win::test::ScopedScreenWin scoped_screen_win_; +#endif }; class GestureEventQueueWithCompositorEventQueueTest
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc index 3e4d7c6..b4e1505c 100644 --- a/content/browser/renderer_host/input/input_router_impl_unittest.cc +++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -46,6 +46,10 @@ #include "ui/events/event.h" #endif +#if BUILDFLAG(IS_WIN) +#include "ui/display/win/test/scoped_screen_win.h" +#endif + using blink::SyntheticWebGestureEventBuilder; using blink::SyntheticWebMouseEventBuilder; using blink::SyntheticWebMouseWheelEventBuilder; @@ -966,6 +970,9 @@ TEST_F(InputRouterImplTest, DISABLED_GestureTypesIgnoringAck) { // We test every gesture type, ensuring that the stream of gestures is valid. +#if BUILDFLAG(IS_WIN) + display::win::test::ScopedScreenWin scoped_screen_win_; +#endif const WebInputEvent::Type eventTypes[] = { WebInputEvent::Type::kGestureTapDown, WebInputEvent::Type::kGestureShowPress,
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index 7801a15..679cd1f9 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -1280,14 +1280,14 @@ // TODO(altimin, crbug.com/933147): Remove this logic after we are done with // implementing back-forward cache. // For primary frame tree navigations, choose an appropriate - // BackForwardCacheMetrics to be associated with the NavigationEntry, by - // either creating a new object or reusing the previous one depending on - // whether it's a main frame navigation or not. + // BackForwardCacheMetrics to be associated with the new navigation's + // NavigationEntry, by either creating a new object or reusing the previous + // entry's one. scoped_refptr<BackForwardCacheMetrics> back_forward_cache_metrics; if (navigation_request->frame_tree_node()->frame_tree()->type() == FrameTree::Type::kPrimary) { - back_forward_cache_metrics = - BackForwardCacheMetrics::CreateOrReuseBackForwardCacheMetrics( + back_forward_cache_metrics = BackForwardCacheMetrics:: + CreateOrReuseBackForwardCacheMetricsForNavigation( GetLastCommittedEntry(), is_main_frame_navigation, params.document_sequence_number); } @@ -1295,7 +1295,7 @@ if (is_main_frame_navigation && !is_same_document_navigation) { if (NavigationEntryImpl* navigation_entry = GetLastCommittedEntry()) { if (auto* metrics = navigation_entry->back_forward_cache_metrics()) { - metrics->MainFrameDidNavigateAwayFromDocument(rfh, navigation_request); + metrics->MainFrameDidNavigateAwayFromDocument(); } } }
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index 17c5ed84..b22ccbf 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -81,7 +81,6 @@ #if BUILDFLAG(IS_MAC) #include "content/browser/renderer_host/test_render_widget_host_view_mac_factory.h" -#include "ui/display/test/test_screen.h" #endif #if defined(USE_AURA) || BUILDFLAG(IS_MAC) @@ -559,10 +558,6 @@ // calls display::Screen::SetScreenInstance(). ui::SetScreenAndroid(false /* use_display_wide_color_gamut */); #endif -#if BUILDFLAG(IS_MAC) - screen_ = std::make_unique<display::test::TestScreen>(); - display::Screen::SetScreenInstance(screen_.get()); -#endif #if defined(USE_AURA) screen_.reset(aura::TestScreen::Create(gfx::Size())); display::Screen::SetScreenInstance(screen_.get()); @@ -624,12 +619,12 @@ browser_context_.reset(); #if defined(USE_AURA) - ImageTransportFactory::Terminate(); -#endif -#if defined(USE_AURA) || BUILDFLAG(IS_MAC) display::Screen::SetScreenInstance(nullptr); screen_.reset(); #endif +#if defined(USE_AURA) || BUILDFLAG(IS_MAC) + ImageTransportFactory::Terminate(); +#endif #if BUILDFLAG(IS_ANDROID) display::Screen::SetScreenInstance(nullptr); #endif
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index 9253f16c..f4fc156 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -131,6 +131,7 @@ #if BUILDFLAG(IS_WIN) #include "ui/base/view_prop.h" #include "ui/base/win/window_event_target.h" +#include "ui/display/win/test/scoped_screen_win.h" #endif using testing::_; @@ -3765,6 +3766,11 @@ ScrollEventsOverscrollWithFling) { SetUpOverscrollEnvironment(); +#if BUILDFLAG(IS_WIN) + // Create a ScopedScreenWin. + display::win::test::ScopedScreenWin scoped_screen_win; +#endif + // Send a wheel event. ACK the event as not processed. This should not // initiate an overscroll gesture since it doesn't cross the threshold yet. SimulateWheelEvent(10, 0, 0, true, WebMouseWheelEvent::kPhaseBegan); @@ -3841,6 +3847,11 @@ ScrollEventsOverscrollWithZeroFling) { SetUpOverscrollEnvironment(); +#if BUILDFLAG(IS_WIN) + // Create a ScopedScreenWin. + display::win::test::ScopedScreenWin scoped_screen_win; +#endif + // Send a wheel event. ACK the event as not processed. This should not // initiate an overscroll gesture since it doesn't cross the threshold yet. SimulateWheelEvent(10, 0, 0, true, WebMouseWheelEvent::kPhaseBegan); @@ -3918,6 +3929,11 @@ MAYBE_ReverseFlingCancelsOverscroll) { SetUpOverscrollEnvironment(); +#if BUILDFLAG(IS_WIN) + // Create a ScopedScreenWin. + display::win::test::ScopedScreenWin scoped_screen_win; +#endif + { PressAndSetTouchActionAuto(); // Start and end a gesture in the same direction without processing the @@ -4788,6 +4804,11 @@ OverscrollStateResetsAfterScroll) { SetUpOverscrollEnvironment(); +#if BUILDFLAG(IS_WIN) + // Create a ScopedScreenWin. + display::win::test::ScopedScreenWin scoped_screen_win; +#endif + SimulateWheelEvent(0, 5, 0, true, WebMouseWheelEvent::kPhaseBegan); // sent directly SimulateWheelEvent(0, 30, 0, true, @@ -5225,6 +5246,11 @@ TEST_F(RenderWidgetHostViewAuraOverscrollTest, ScrollDeltasResetOnEnd) { SetUpOverscrollEnvironment(); +#if BUILDFLAG(IS_WIN) + // Create a ScopedScreenWin. + display::win::test::ScopedScreenWin scoped_screen_win; +#endif + PressAndSetTouchActionAuto(); // Wheel event scroll ending with mouse move. SimulateWheelEvent(-30, -10, 0, true,
diff --git a/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm index 8f8fb19c..c79d604 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm
@@ -27,7 +27,6 @@ #include "testing/platform_test.h" #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" #include "ui/base/layout.h" -#include "ui/display/screen.h" using content::RenderWidgetHostViewMac; @@ -123,7 +122,6 @@ void TearDown() override { ImageTransportFactory::Terminate(); } private: - display::ScopedNativeScreen screen_; // This has a MessageLoop for ImageTransportFactory and enables // BrowserThread::UI for RecyclableCompositorMac used by // RenderWidgetHostViewMac.
diff --git a/content/browser/screen_enumeration/screen_enumeration_browsertest.cc b/content/browser/screen_enumeration/screen_enumeration_browsertest.cc index feb76c9..6267f67 100644 --- a/content/browser/screen_enumeration/screen_enumeration_browsertest.cc +++ b/content/browser/screen_enumeration/screen_enumeration_browsertest.cc
@@ -135,26 +135,18 @@ protected: // ScreenEnumerationTest: - - void SetUp() override { + void SetUpOnMainThread() override { + ScreenEnumerationTest::SetUpOnMainThread(); + original_screen_ = display::Screen::GetScreen(); display::Screen::SetScreenInstance(&screen_); + // Create a shell that observes the fake screen. A display is required. screen()->display_list().AddDisplay({0, gfx::Rect(100, 100, 801, 802)}, display::DisplayList::Type::PRIMARY); - - ScreenEnumerationTest::SetUp(); - } - void TearDown() override { - ScreenEnumerationTest::TearDown(); - display::Screen::SetScreenInstance(nullptr); - } - - void SetUpOnMainThread() override { - ScreenEnumerationTest::SetUpOnMainThread(); - test_shell_ = CreateBrowser(); } void TearDownOnMainThread() override { + display::Screen::SetScreenInstance(original_screen_); ScreenEnumerationTest::TearDownOnMainThread(); } @@ -162,6 +154,7 @@ Shell* test_shell() { return test_shell_; } private: + raw_ptr<display::Screen> original_screen_ = nullptr; display::ScreenBase screen_; raw_ptr<Shell> test_shell_ = nullptr; };
diff --git a/content/common/partition_alloc_support.cc b/content/common/partition_alloc_support.cc index 65376e8..d0c769ea 100644 --- a/content/common/partition_alloc_support.cc +++ b/content/common/partition_alloc_support.cc
@@ -417,6 +417,12 @@ #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) base::allocator::StartMemoryReclaimer(base::ThreadTaskRunnerHandle::Get()); #endif + + if (base::FeatureList::IsEnabled( + base::features::kPartitionAllocSortActiveSlotSpans)) { + base::PartitionRoot< + partition_alloc::internal::ThreadSafe>::EnableSortActiveSlotSpans(); + } } void PartitionAllocSupport::OnForegrounded() {
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc index e0ff6fae..3375ce2 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc
@@ -291,11 +291,13 @@ base::PlatformThread::SetName("CrGpuMain"); #if !BUILDFLAG(IS_MAC) - if (base::FeatureList::IsEnabled(features::kGpuUseDisplayThreadPriority)) { - // Set thread priority before sandbox initialization. - base::PlatformThread::SetCurrentThreadPriority( - base::ThreadPriority::DISPLAY); + // Set thread priority before sandbox initialization. + base::ThreadPriority thread_priority = base::ThreadPriority::NORMAL; + if (base::FeatureList::IsEnabled(features::kGpuUseDisplayThreadPriority) && + !features::IsGpuMainThreadForcedToNormalPriorityDrDc()) { + thread_priority = base::ThreadPriority::DISPLAY; } + base::PlatformThread::SetCurrentThreadPriority(thread_priority); #endif auto gpu_init = std::make_unique<gpu::GpuInit>();
diff --git a/content/public/browser/browser_context.h b/content/public/browser/browser_context.h index 4d239a9..8afc8fb4 100644 --- a/content/public/browser/browser_context.h +++ b/content/public/browser/browser_context.h
@@ -44,6 +44,7 @@ namespace media { class VideoDecodePerfHistory; +class WebrtcVideoPerfHistory; namespace learning { class LearningSession; } @@ -269,6 +270,12 @@ // directly, so privacy is not compromised. media::VideoDecodePerfHistory* GetVideoDecodePerfHistory(); + // Gets media service for storing/retrieving WebRTC video performance stats. + // Exposed here rather than StoragePartition because all SiteInstances should + // have similar encode/decode performance and stats are not exposed to the web + // directly, so privacy is not compromised. + media::WebrtcVideoPerfHistory* GetWebrtcVideoPerfHistory(); + // Returns a LearningSession associated with |this|. Used as the central // source from which to retrieve LearningTaskControllers for media machine // learning.
diff --git a/content/public/browser/video_picture_in_picture_window_controller.h b/content/public/browser/video_picture_in_picture_window_controller.h index 3d592a1..65b68158 100644 --- a/content/public/browser/video_picture_in_picture_window_controller.h +++ b/content/public/browser/video_picture_in_picture_window_controller.h
@@ -7,6 +7,7 @@ #include "content/common/content_export.h" #include "content/public/browser/picture_in_picture_window_controller.h" +#include "ui/gfx/geometry/rect.h" namespace content { class VideoOverlayWindow; @@ -41,6 +42,10 @@ // Called when the user interacts with the "Hang Up" control. virtual void HangUp() = 0; + // Returns the source bounds of the video, in the WebContents top-level + // coordinate space, of the video before it enters picture in picture. + virtual const gfx::Rect& GetSourceBounds() const = 0; + protected: // Use PictureInPictureWindowController::GetOrCreateForWebContents() to // create an instance.
diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc index b674a89..aa30f0c 100644 --- a/content/public/test/test_renderer_host.cc +++ b/content/public/test/test_renderer_host.cc
@@ -40,12 +40,9 @@ #include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h" #include "third_party/blink/public/common/input/web_input_event.h" -#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) -#include "ui/display/screen.h" -#endif - #if BUILDFLAG(IS_ANDROID) #include "ui/android/dummy_screen_android.h" +#include "ui/display/screen.h" #endif #if BUILDFLAG(IS_WIN) @@ -242,10 +239,6 @@ #if BUILDFLAG(IS_WIN) ole_initializer_ = std::make_unique<ui::ScopedOleInitializer>(); #endif -#if BUILDFLAG(IS_MAC) - screen_ = std::make_unique<display::ScopedNativeScreen>(); -#endif - #if defined(USE_AURA) aura_test_helper_ = std::make_unique<aura::test::AuraTestHelper>( ImageTransportFactory::GetInstance()->GetContextFactory());
diff --git a/content/public/test/test_renderer_host.h b/content/public/test/test_renderer_host.h index 8741365c..a02288f 100644 --- a/content/public/test/test_renderer_host.h +++ b/content/public/test/test_renderer_host.h
@@ -43,7 +43,6 @@ namespace display { class Screen; -class ScopedNativeScreen; } namespace net { @@ -326,9 +325,6 @@ #if BUILDFLAG(IS_WIN) std::unique_ptr<ui::ScopedOleInitializer> ole_initializer_; #endif -#if BUILDFLAG(IS_MAC) - std::unique_ptr<display::ScopedNativeScreen> screen_; -#endif #if defined(USE_AURA) std::unique_ptr<aura::test::AuraTestHelper> aura_test_helper_; #endif
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index 2ee2fdb..15cbdd3 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn
@@ -310,10 +310,6 @@ deps += [ "//ui/views/linux_ui:linux_ui_factory" ] } - if (is_mac) { - deps += [ "//ui/display:test_support" ] - } - if (is_android) { deps += [ "//components/embedder_support/android:view",
diff --git a/content/shell/browser/shell_platform_data_aura.cc b/content/shell/browser/shell_platform_data_aura.cc index 6e2480ed..a02a4058 100644 --- a/content/shell/browser/shell_platform_data_aura.cc +++ b/content/shell/browser/shell_platform_data_aura.cc
@@ -82,7 +82,12 @@ #if defined(USE_OZONE) // Setup global display::Screen singleton. - screen_ = std::make_unique<aura::ScopedScreenOzone>(); + if (!display::Screen::GetScreen()) { + std::unique_ptr<aura::ScreenOzone> screen_ozone = + std::make_unique<aura::ScreenOzone>(); + screen_ozone.get()->Initialize(); + screen_ = std::move(screen_ozone); + } #endif // defined(USE_OZONE) ui::PlatformWindowInitProperties properties;
diff --git a/content/shell/browser/shell_platform_data_aura.h b/content/shell/browser/shell_platform_data_aura.h index 345a9d9..8b58302 100644 --- a/content/shell/browser/shell_platform_data_aura.h +++ b/content/shell/browser/shell_platform_data_aura.h
@@ -20,7 +20,7 @@ #if defined(USE_OZONE) namespace display { -class ScopedNativeScreen; +class Screen; } #endif @@ -46,7 +46,7 @@ private: #if defined(USE_OZONE) - std::unique_ptr<display::ScopedNativeScreen> screen_; + std::unique_ptr<display::Screen> screen_; #endif std::unique_ptr<aura::WindowTreeHost> host_;
diff --git a/content/shell/browser/shell_platform_delegate.h b/content/shell/browser/shell_platform_delegate.h index 9326cb3..32cd23a 100644 --- a/content/shell/browser/shell_platform_delegate.h +++ b/content/shell/browser/shell_platform_delegate.h
@@ -15,7 +15,6 @@ #if BUILDFLAG(IS_MAC) #include "content/public/browser/native_web_keyboard_event.h" -#include "ui/display/screen.h" #endif class GURL; @@ -140,9 +139,6 @@ #endif private: -#if BUILDFLAG(IS_MAC) - std::unique_ptr<display::ScopedNativeScreen> screen_; -#endif // Data held for each Shell instance, since there is one ShellPlatformDelegate // for the whole browser process (shared across Shells). This is defined for // each platform implementation.
diff --git a/content/shell/browser/shell_platform_delegate_mac.mm b/content/shell/browser/shell_platform_delegate_mac.mm index cf91694..0868a06 100644 --- a/content/shell/browser/shell_platform_delegate_mac.mm +++ b/content/shell/browser/shell_platform_delegate_mac.mm
@@ -134,7 +134,7 @@ ShellPlatformDelegate::~ShellPlatformDelegate() = default; void ShellPlatformDelegate::Initialize(const gfx::Size& default_window_size) { - screen_ = std::make_unique<display::ScopedNativeScreen>(); + // |platform_| is unused on this platform. } void ShellPlatformDelegate::CreatePlatformWindow(
diff --git a/content/shell/browser/shell_platform_delegate_views.cc b/content/shell/browser/shell_platform_delegate_views.cc index 0063882..f6924fc 100644 --- a/content/shell/browser/shell_platform_delegate_views.cc +++ b/content/shell/browser/shell_platform_delegate_views.cc
@@ -331,9 +331,8 @@ std::make_unique<wm::WMTestHelper>(default_window_size); #else platform_->wm_state = std::make_unique<wm::WMState>(); - // FakeScreen tests create their own screen. - if (!display::Screen::HasScreen()) - platform_->screen = views::CreateDesktopScreen(); + CHECK(!display::Screen::GetScreen()); + platform_->screen = views::CreateDesktopScreen(); #endif platform_->views_delegate =
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index f3f13ab..c547597 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -1621,7 +1621,6 @@ "//ui/base/ime/mojom", "//ui/compositor", "//ui/display", - "//ui/display:test_support", "//ui/events:test_support", "//ui/events/blink:blink", "//ui/gfx",
diff --git a/content/test/data/accessibility/regression/clear-children-while-computing-name-expected-blink.txt b/content/test/data/accessibility/regression/clear-children-while-computing-name-expected-blink.txt new file mode 100644 index 0000000..59e71c6 --- /dev/null +++ b/content/test/data/accessibility/regression/clear-children-while-computing-name-expected-blink.txt
@@ -0,0 +1,7 @@ +rootWebArea name='done' +++genericContainer ignored +++++genericContainer ignored +++++++genericContainer ignored invisible +++++++++heading ignored invisible +++++++++++staticText ignored invisible name='Browser' +++++++++genericContainer ignored invisible
diff --git a/content/test/data/accessibility/regression/clear-children-while-computing-name.html b/content/test/data/accessibility/regression/clear-children-while-computing-name.html new file mode 100644 index 0000000..415e25e --- /dev/null +++ b/content/test/data/accessibility/regression/clear-children-while-computing-name.html
@@ -0,0 +1,23 @@ +<!-- +@WAIT-FOR:done +--> +<head> +<style> +.c4 {} +</style> +</head> +<body> +<div id="container"> + <h3 id="heading">Browser</h3> + <a id="anchor"></a> +</div> +<script> + function crash() { + document.getElementById('container').setAttribute('aria-hidden', 'true'); + document.getElementById('heading').setAttribute('aria-hidden', 'false'); + document.getElementById('anchor').setAttribute('class', 'c4'); + heading['computedName']; // access to the property triggers name computation + document.title = 'done'; + } + setTimeout(crash, 100); +</script>
diff --git a/content/web_test/BUILD.gn b/content/web_test/BUILD.gn index 00cce83..7aab966 100644 --- a/content/web_test/BUILD.gn +++ b/content/web_test/BUILD.gn
@@ -208,14 +208,6 @@ "//ppapi:blink_test_plugin", ] } - - if (is_mac) { - deps += [ "//ui/display:test_support" ] - } - - if (use_aura) { - deps += [ "//ui/aura:test_support" ] - } } static_library("web_test_renderer") {
diff --git a/extensions/browser/api/system_display/display_info_provider.cc b/extensions/browser/api/system_display/display_info_provider.cc index 9097b1b..1b979ee 100644 --- a/extensions/browser/api/system_display/display_info_provider.cc +++ b/extensions/browser/api/system_display/display_info_provider.cc
@@ -37,11 +37,7 @@ } // namespace -DisplayInfoProvider::DisplayInfoProvider(display::Screen* screen) - : screen_(screen ? screen : display::Screen::GetScreen()) { - // Do not use/call on the screen object in this constructor yet because a - // subclass may pass not-yet-initialized screen instance. -} +DisplayInfoProvider::DisplayInfoProvider() = default; DisplayInfoProvider::~DisplayInfoProvider() = default; @@ -115,8 +111,9 @@ void DisplayInfoProvider::GetAllDisplaysInfo( bool /* single_unified*/, base::OnceCallback<void(DisplayUnitInfoList result)> callback) { - int64_t primary_id = screen_->GetPrimaryDisplay().id(); - std::vector<display::Display> displays = screen_->GetAllDisplays(); + display::Screen* screen = display::Screen::GetScreen(); + int64_t primary_id = screen->GetPrimaryDisplay().id(); + std::vector<display::Display> displays = screen->GetAllDisplays(); DisplayUnitInfoList all_displays; for (const display::Display& display : displays) { api::system_display::DisplayUnitInfo unit =
diff --git a/extensions/browser/api/system_display/display_info_provider.h b/extensions/browser/api/system_display/display_info_provider.h index d060ff4..2d0d26bf 100644 --- a/extensions/browser/api/system_display/display_info_provider.h +++ b/extensions/browser/api/system_display/display_info_provider.h
@@ -17,7 +17,6 @@ namespace display { class Display; -class Screen; } namespace extensions { @@ -119,7 +118,7 @@ ErrorCallback callback); protected: - explicit DisplayInfoProvider(display::Screen* screen = nullptr); + DisplayInfoProvider(); // Trigger OnDisplayChangedEvent void DispatchOnDisplayChangedEvent(); @@ -143,8 +142,6 @@ void OnDisplayMetricsChanged(const display::Display& display, uint32_t metrics) override; - display::Screen* const screen_; - absl::optional<display::ScopedDisplayObserver> display_observer_; };
diff --git a/extensions/browser/api/system_display/system_display_apitest.cc b/extensions/browser/api/system_display/system_display_apitest.cc index b4ccfd1..970ee75 100644 --- a/extensions/browser/api/system_display/system_display_apitest.cc +++ b/extensions/browser/api/system_display/system_display_apitest.cc
@@ -13,17 +13,24 @@ #include "extensions/browser/api/system_display/system_display_api.h" #include "extensions/browser/api_test_utils.h" #include "extensions/browser/mock_display_info_provider.h" +#include "extensions/browser/mock_screen.h" #include "extensions/common/api/system_display.h" #include "extensions/common/extension_builder.h" #include "extensions/shell/test/shell_apitest.h" #include "extensions/test/result_catcher.h" +#include "ui/display/display.h" #include "ui/display/screen.h" +#include "ui/display/test/scoped_screen_override.h" namespace extensions { +using display::Screen; +using display::test::ScopedScreenOverride; + class SystemDisplayApiTest : public ShellApiTest { public: - SystemDisplayApiTest() : provider_(new MockDisplayInfoProvider) {} + SystemDisplayApiTest() + : provider_(new MockDisplayInfoProvider), screen_(new MockScreen) {} SystemDisplayApiTest(const SystemDisplayApiTest&) = delete; SystemDisplayApiTest& operator=(const SystemDisplayApiTest&) = delete; @@ -32,9 +39,17 @@ void SetUpOnMainThread() override { ShellApiTest::SetUpOnMainThread(); + ANNOTATE_LEAKING_OBJECT_PTR(Screen::GetScreen()); + scoped_screen_override_ = + std::make_unique<ScopedScreenOverride>(screen_.get()); DisplayInfoProvider::InitializeForTesting(provider_.get()); } + void TearDownOnMainThread() override { + ShellApiTest::TearDownOnMainThread(); + scoped_screen_override_.reset(); + } + protected: void SetInfo(const std::string& display_id, const api::system_display::DisplayProperties& properties) { @@ -43,6 +58,8 @@ base::BindOnce([](absl::optional<std::string>) {})); } std::unique_ptr<MockDisplayInfoProvider> provider_; + std::unique_ptr<Screen> screen_; + std::unique_ptr<ScopedScreenOverride> scoped_screen_override_; }; #if BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/extensions/browser/mock_display_info_provider.cc b/extensions/browser/mock_display_info_provider.cc index 0ce2110..56ae05d 100644 --- a/extensions/browser/mock_display_info_provider.cc +++ b/extensions/browser/mock_display_info_provider.cc
@@ -16,8 +16,7 @@ namespace extensions { -MockDisplayInfoProvider::MockDisplayInfoProvider() - : DisplayInfoProvider(&screen_) {} +MockDisplayInfoProvider::MockDisplayInfoProvider() = default; MockDisplayInfoProvider::~MockDisplayInfoProvider() = default;
diff --git a/extensions/browser/mock_display_info_provider.h b/extensions/browser/mock_display_info_provider.h index f173f59..4e6fba2 100644 --- a/extensions/browser/mock_display_info_provider.h +++ b/extensions/browser/mock_display_info_provider.h
@@ -13,7 +13,6 @@ #include "base/values.h" #include "extensions/browser/api/system_display/display_info_provider.h" -#include "extensions/browser/mock_screen.h" #include "extensions/common/api/system_display.h" namespace extensions { @@ -86,8 +85,6 @@ bool native_touch_calibration_success_ = false; - MockScreen screen_; - api::system_display::MirrorMode mirror_mode_ = api::system_display::MIRROR_MODE_OFF; };
diff --git a/extensions/browser/updater/extension_downloader.cc b/extensions/browser/updater/extension_downloader.cc index 834a89a..e60bff08 100644 --- a/extensions/browser/updater/extension_downloader.cc +++ b/extensions/browser/updater/extension_downloader.cc
@@ -174,6 +174,13 @@ const char ExtensionDownloader::kUpdateInteractivityForeground[] = "fg"; const char ExtensionDownloader::kUpdateInteractivityBackground[] = "bg"; +DownloadFailure::DownloadFailure( + ExtensionId id, + ExtensionDownloaderDelegate::Error error, + ExtensionDownloaderDelegate::FailureData failure_data) + : id(id), error(error), failure_data(failure_data) {} +DownloadFailure::~DownloadFailure() = default; + UpdateDetails::UpdateDetails(const std::string& id, const base::Version& version) : id(id), version(version) {} @@ -747,17 +754,17 @@ return; // If not all extension were found in the cache, collect them and report // failure. - ManifestInvalidFailureDataList manifest_invalid_errors; const ExtensionIdSet extension_ids = fetch_data->GetExtensionIds(); + std::vector<DownloadFailure> manifest_invalid_errors; manifest_invalid_errors.reserve(extension_ids.size()); for (const auto& extension_id : extension_ids) { - manifest_invalid_errors.push_back(std::make_pair( - extension_id, - ExtensionDownloaderDelegate::FailureData(error.value().error))); + manifest_invalid_errors.emplace_back( + extension_id, ExtensionDownloaderDelegate::Error::MANIFEST_INVALID, + ExtensionDownloaderDelegate::FailureData(error.value().error)); } NotifyExtensionsDownloadStageChanged( extension_ids, ExtensionDownloaderDelegate::Stage::FINISHED); - NotifyExtensionsManifestInvalidFailure(manifest_invalid_errors, + NotifyExtensionsDownloadFailedWithList(manifest_invalid_errors, fetch_data->request_ids()); return; } else { @@ -769,11 +776,10 @@ extension_ids, ExtensionDownloaderDelegate::Stage::MANIFEST_LOADED); std::vector<UpdateManifestResult*> to_update; - std::set<std::string> no_updates; - ManifestInvalidFailureDataList errors; + std::vector<DownloadFailure> failures; // Examine the parsed manifest and kick off fetches of any new crx files. - DetermineUpdates(*fetch_data, *results, &to_update, &no_updates, &errors); + DetermineUpdates(*fetch_data, *results, &to_update, &failures); for (const UpdateManifestResult* update : to_update) { const std::string& extension_id = update->extension_id; @@ -804,17 +810,12 @@ } } - NotifyExtensionsDownloadStageChanged( - no_updates, ExtensionDownloaderDelegate::Stage::FINISHED); - NotifyExtensionsDownloadFailed( - no_updates, fetch_data->request_ids(), - ExtensionDownloaderDelegate::Error::NO_UPDATE_AVAILABLE); ExtensionIdSet extension_ids_with_errors; - for (const auto& e : errors) - extension_ids_with_errors.insert(e.first); + for (const auto& failure : failures) + extension_ids_with_errors.insert(failure.id); NotifyExtensionsDownloadStageChanged( extension_ids_with_errors, ExtensionDownloaderDelegate::Stage::FINISHED); - NotifyExtensionsManifestInvalidFailure(errors, fetch_data->request_ids()); + NotifyExtensionsDownloadFailedWithList(failures, fetch_data->request_ids()); } ExtensionDownloader::UpdateAvailability @@ -901,11 +902,9 @@ const ManifestFetchData& fetch_data, const UpdateManifestResults& possible_updates, std::vector<UpdateManifestResult*>* to_update, - std::set<std::string>* no_updates, - ManifestInvalidFailureDataList* errors) { + std::vector<DownloadFailure>* failures) { DCHECK_NE(nullptr, to_update); - DCHECK_NE(nullptr, no_updates); - DCHECK_NE(nullptr, errors); + DCHECK_NE(nullptr, failures); // Group successful possible updates by extension IDs. const std::map<std::string, std::vector<const UpdateManifestResult*>> @@ -943,11 +942,16 @@ to_update->push_back(update_result); break; case UpdateAvailability::kNoUpdate: - no_updates->insert(extension_id); + failures->emplace_back( + extension_id, + ExtensionDownloaderDelegate::Error::NO_UPDATE_AVAILABLE, + ExtensionDownloaderDelegate::FailureData()); break; case UpdateAvailability::kBadUpdateSpecification: - errors->emplace_back(extension_id, - ManifestInvalidError::BAD_UPDATE_SPECIFICATION); + failures->emplace_back( + extension_id, ExtensionDownloaderDelegate::Error::MANIFEST_INVALID, + ExtensionDownloaderDelegate::FailureData( + ManifestInvalidError::BAD_UPDATE_SPECIFICATION)); break; } } @@ -958,17 +962,20 @@ DCHECK(possible_update.parse_error); ManifestInvalidError error_type = possible_update.parse_error.value().error; // Report any error corresponding to an extension. - errors->emplace_back( - id, error_type == ManifestInvalidError::BAD_APP_STATUS - ? ExtensionDownloaderDelegate::FailureData( - error_type, possible_update.app_status) - : ExtensionDownloaderDelegate::FailureData(error_type)); + failures->emplace_back( + id, ExtensionDownloaderDelegate::Error::MANIFEST_INVALID, + error_type == ManifestInvalidError::BAD_APP_STATUS + ? ExtensionDownloaderDelegate::FailureData( + error_type, possible_update.app_status) + : ExtensionDownloaderDelegate::FailureData(error_type)); extension_errors.erase(id); } // For the remaining extensions, we have missing ids. for (const auto& id : extension_errors) { - errors->emplace_back(id, ExtensionDownloaderDelegate::FailureData( - ManifestInvalidError::MISSING_APP_ID)); + failures->emplace_back(id, + ExtensionDownloaderDelegate::Error::MANIFEST_INVALID, + ExtensionDownloaderDelegate::FailureData( + ManifestInvalidError::MISSING_APP_ID)); } } @@ -1290,23 +1297,6 @@ extensions_queue_.StartNextRequest(); } -void ExtensionDownloader::NotifyExtensionsManifestInvalidFailure( - const ManifestInvalidFailureDataList& errors, - const std::set<int>& request_ids) { - for (const auto& error_data : errors) { - const ExtensionId& extension_id = error_data.first; - ExtensionDownloaderDelegate::FailureData data = error_data.second; - auto ping_iter = ping_results_.find(extension_id); - delegate_->OnExtensionDownloadFailed( - extension_id, ExtensionDownloaderDelegate::Error::MANIFEST_INVALID, - ping_iter == ping_results_.end() - ? ExtensionDownloaderDelegate::PingResult() - : ping_iter->second, - request_ids, data); - ping_results_.erase(extension_id); - } -} - void ExtensionDownloader::NotifyExtensionsDownloadStageChanged( ExtensionIdSet extension_ids, ExtensionDownloaderDelegate::Stage stage) { @@ -1314,6 +1304,7 @@ delegate_->OnExtensionDownloadStageChanged(it, stage); } } + void ExtensionDownloader::NotifyExtensionsDownloadFailed( ExtensionIdSet extension_ids, std::set<int> request_ids, @@ -1340,6 +1331,24 @@ } } +void ExtensionDownloader::NotifyExtensionsDownloadFailedWithList( + std::vector<DownloadFailure> failures, + std::set<int> request_ids) { + for (const auto& failure : failures) { + const ExtensionId& extension_id = failure.id; + ExtensionDownloaderDelegate::Error error = failure.error; + ExtensionDownloaderDelegate::FailureData data = failure.failure_data; + auto ping_iter = ping_results_.find(extension_id); + delegate_->OnExtensionDownloadFailed( + extension_id, error, + ping_iter == ping_results_.end() + ? ExtensionDownloaderDelegate::PingResult() + : ping_iter->second, + request_ids, data); + ping_results_.erase(extension_id); + } +} + void ExtensionDownloader::NotifyUpdateFound(const std::string& id, const std::string& version) { UpdateDetails updateInfo(id, base::Version(version));
diff --git a/extensions/browser/updater/extension_downloader.h b/extensions/browser/updater/extension_downloader.h index 308460a..5bab9bb 100644 --- a/extensions/browser/updater/extension_downloader.h +++ b/extensions/browser/updater/extension_downloader.h
@@ -50,8 +50,17 @@ namespace extensions { -using ManifestInvalidFailureDataList = std::vector< - std::pair<ExtensionId, ExtensionDownloaderDelegate::FailureData>>; +struct DownloadFailure { + DownloadFailure(ExtensionId id, + ExtensionDownloaderDelegate::Error error, + ExtensionDownloaderDelegate::FailureData failure_data); + ~DownloadFailure(); + + ExtensionId id; + ExtensionDownloaderDelegate::Error error; + ExtensionDownloaderDelegate::FailureData failure_data; +}; + struct UpdateDetails { UpdateDetails(const std::string& id, const base::Version& version); ~UpdateDetails(); @@ -287,8 +296,7 @@ void DetermineUpdates(const ManifestFetchData& fetch_data, const UpdateManifestResults& possible_updates, std::vector<UpdateManifestResult*>* to_update, - std::set<std::string>* no_updates, - ManifestInvalidFailureDataList* errors); + std::vector<DownloadFailure>* errors); // Checks whether extension is presented in cache. If yes, return path to its // cached CRX, absl::nullopt otherwise. |manifest_fetch_failed| flag indicates @@ -314,10 +322,6 @@ void NotifyExtensionManifestUpdateCheckStatus( std::vector<UpdateManifestResult> results); - void NotifyExtensionsManifestInvalidFailure( - const ManifestInvalidFailureDataList& errors, - const std::set<int>& request_ids); - // Invokes OnExtensionDownloadStageChanged() on the |delegate_| for each // extension in the set, with |stage| as the current stage. Make a copy of // arguments because there is no guarantee that callback won't indirectly @@ -342,6 +346,14 @@ ExtensionDownloaderDelegate::Error error, const ExtensionDownloaderDelegate::FailureData& data); + // Invokes OnExtensionDownloadFailed() on the |delegate_| for each extension + // in the list, which also provides the reason for the failure. Make a copy + // of arguments because there is no guarantee that callback won't indirectly + // change source of them. + void NotifyExtensionsDownloadFailedWithList( + std::vector<DownloadFailure> errors, + std::set<int> request_ids); + // Send a notification that an update was found for |id| that we'll // attempt to download. void NotifyUpdateFound(const std::string& id, const std::string& version);
diff --git a/extensions/shell/browser/shell_desktop_controller_aura_unittest.cc b/extensions/shell/browser/shell_desktop_controller_aura_unittest.cc index 204c58e..aac03851 100644 --- a/extensions/shell/browser/shell_desktop_controller_aura_unittest.cc +++ b/extensions/shell/browser/shell_desktop_controller_aura_unittest.cc
@@ -54,7 +54,9 @@ ~ShellDesktopControllerAuraTest() override = default; void SetUp() override { - // Set up a screen with 2 displays before `ShellTestBaseAura::SetUp()` + ShellTestBaseAura::SetUp(); + + // Set up a screen with 2 displays. screen_ = std::make_unique<display::ScreenBase>(); screen_->display_list().AddDisplay( display::Display(100, gfx::Rect(0, 0, 1920, 1080)), @@ -64,7 +66,6 @@ display::DisplayList::Type::NOT_PRIMARY); screen_override_ = std::make_unique<display::test::ScopedScreenOverride>(screen_.get()); - ShellTestBaseAura::SetUp(); #if BUILDFLAG(IS_CHROMEOS_ASH) chromeos::PowerManagerClient::InitializeFake(); @@ -79,9 +80,9 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) chromeos::PowerManagerClient::Shutdown(); #endif - ShellTestBaseAura::TearDown(); screen_override_.reset(); screen_.reset(); + ShellTestBaseAura::TearDown(); } protected:
diff --git a/extensions/shell/browser/shell_desktop_controller_mac.h b/extensions/shell/browser/shell_desktop_controller_mac.h index d3ba91d..e78005f2 100644 --- a/extensions/shell/browser/shell_desktop_controller_mac.h +++ b/extensions/shell/browser/shell_desktop_controller_mac.h
@@ -8,7 +8,6 @@ #include <memory> #include "extensions/shell/browser/desktop_controller.h" -#include "ui/display/screen.h" namespace extensions { @@ -37,8 +36,6 @@ // The desktop only supports a single app window. // TODO(yoz): Support multiple app windows, as we do in Aura. AppWindow* app_window_; // NativeAppWindow::Close() deletes this. - - display::ScopedNativeScreen screen_; }; } // namespace extensions
diff --git a/fuchsia/engine/browser/web_engine_browser_main_parts.cc b/fuchsia/engine/browser/web_engine_browser_main_parts.cc index 1d9425f..38aa87c 100644 --- a/fuchsia/engine/browser/web_engine_browser_main_parts.cc +++ b/fuchsia/engine/browser/web_engine_browser_main_parts.cc
@@ -55,7 +55,6 @@ #include "third_party/widevine/cdm/widevine_cdm_common.h" #include "ui/aura/screen_ozone.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/display/screen.h" #include "ui/gfx/switches.h" #include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/ozone_switches.h" @@ -168,7 +167,9 @@ content::ContentBrowserClient* browser_client) : browser_client_(browser_client) {} -WebEngineBrowserMainParts::~WebEngineBrowserMainParts() = default; +WebEngineBrowserMainParts::~WebEngineBrowserMainParts() { + display::Screen::SetScreenInstance(nullptr); +} std::vector<content::BrowserContext*> WebEngineBrowserMainParts::browser_contexts() const { @@ -189,6 +190,7 @@ } int WebEngineBrowserMainParts::PreMainMessageLoopRun() { + DCHECK(!screen_); DCHECK_EQ(context_bindings_.size(), 0u); // Initialize the |component_inspector_| to allow diagnostics to be published. @@ -249,7 +251,11 @@ base::Unretained(this))); // Configure Ozone with an Aura implementation of the Screen abstraction. - screen_ = std::make_unique<aura::ScopedScreenOzone>(); + std::unique_ptr<aura::ScreenOzone> screen_ozone = + std::make_unique<aura::ScreenOzone>(); + screen_ozone.get()->Initialize(); + screen_ = std::move(screen_ozone); + display::Screen::SetScreenInstance(screen_.get()); // Create the FuchsiaCdmManager at startup rather than on-demand, to allow it // to perform potentially expensive startup work in the background. @@ -306,6 +312,7 @@ // that they may post cleanup tasks during teardown. // NOTE: Objects are destroyed in the reverse order of their creation. legacy_metrics_client_.reset(); + screen_.reset(); intl_profile_watcher_.reset(); base::ImportantFileWriterCleaner::GetInstance().Stop();
diff --git a/fuchsia/engine/browser/web_engine_browser_main_parts.h b/fuchsia/engine/browser/web_engine_browser_main_parts.h index e878565..91bd530 100644 --- a/fuchsia/engine/browser/web_engine_browser_main_parts.h +++ b/fuchsia/engine/browser/web_engine_browser_main_parts.h
@@ -22,7 +22,7 @@ } namespace display { -class ScopedNativeScreen; +class Screen; } namespace content { @@ -120,7 +120,7 @@ content::ContentBrowserClient* const browser_client_; - std::unique_ptr<display::ScopedNativeScreen> screen_; + std::unique_ptr<display::Screen> screen_; // Used to publish diagnostics including the active Contexts and FrameHosts. std::unique_ptr<sys::ComponentInspector> component_inspector_;
diff --git a/google_apis/drive/drive_api_requests.cc b/google_apis/drive/drive_api_requests.cc index a74bd20..6f992eed 100644 --- a/google_apis/drive/drive_api_requests.cc +++ b/google_apis/drive/drive_api_requests.cc
@@ -1129,8 +1129,8 @@ const DriveApiUrlGenerator& url_generator) : DriveUrlFetchRequestBase( sender, - // Safe to not retain as the SimpleURLoader is owned by our base class - // and cannot outlive this instance. + // Safe to not retain as the SimpleURLLoader is owned by our base + // class and cannot outlive this instance. base::BindRepeating(&BatchUploadRequest::OnUploadProgress, base::Unretained(this)), ProgressCallback()),
diff --git a/gpu/config/gpu_finch_features.cc b/gpu/config/gpu_finch_features.cc index e9efdd1..bc95b62e 100644 --- a/gpu/config/gpu_finch_features.cc +++ b/gpu/config/gpu_finch_features.cc
@@ -210,6 +210,10 @@ const base::Feature kEnableDrDc{"EnableDrDc", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kForceGpuMainThreadToNormalPriorityDrDc{ + "ForceGpuMainThreadToNormalPriorityDrDc", + base::FEATURE_DISABLED_BY_DEFAULT}; + #if BUILDFLAG(IS_ANDROID) const base::Feature kEnableDrDcVulkan{"EnableDrDcVulkan", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -353,6 +357,14 @@ #endif } +bool IsGpuMainThreadForcedToNormalPriorityDrDc() { + // GPU main thread priority is forced to NORMAL only when DrDc is enabled. In + // that case DrDc thread continues to use DISPLAY thread priority and hence + // have higher thread priority than GPU main. + return IsDrDcEnabled() && + base::FeatureList::IsEnabled(kForceGpuMainThreadToNormalPriorityDrDc); +} + bool IsUsingThreadSafeMediaForWebView() { #if BUILDFLAG(IS_ANDROID) // SurfaceTexture can't be thread-safe. Also thread safe media code currently
diff --git a/gpu/config/gpu_finch_features.h b/gpu/config/gpu_finch_features.h index 7352adca0..b4438fe0 100644 --- a/gpu/config/gpu_finch_features.h +++ b/gpu/config/gpu_finch_features.h
@@ -67,6 +67,8 @@ GPU_EXPORT extern const base::Feature kEnableDrDc; +GPU_EXPORT extern const base::Feature kForceGpuMainThreadToNormalPriorityDrDc; + #if BUILDFLAG(IS_ANDROID) // This flag is use additionally with kEnableDrDc to enable the feature for // vulkan enabled android devices. @@ -77,6 +79,7 @@ GPU_EXPORT bool IsUsingVulkan(); GPU_EXPORT bool IsDrDcEnabled(); +GPU_EXPORT bool IsGpuMainThreadForcedToNormalPriorityDrDc(); GPU_EXPORT bool NeedThreadSafeAndroidMedia(); GPU_EXPORT bool IsANGLEValidationEnabled();
diff --git a/headless/lib/browser/headless_browser_impl.h b/headless/lib/browser/headless_browser_impl.h index 7f4ac86..7be22a33 100644 --- a/headless/lib/browser/headless_browser_impl.h +++ b/headless/lib/browser/headless_browser_impl.h
@@ -14,7 +14,6 @@ #include "base/memory/weak_ptr.h" #include "base/task/single_thread_task_runner.h" -#include "build/build_config.h" #include "headless/lib/browser/headless_devtools_manager_delegate.h" #include "headless/public/headless_devtools_target.h" #include "headless/public/headless_export.h" @@ -29,10 +28,6 @@ } // namespace policy #endif -#if BUILDFLAG(IS_MAC) -#include "ui/display/screen.h" -#endif - namespace ui { class Compositor; } // namespace ui @@ -122,10 +117,6 @@ #endif protected: -#if BUILDFLAG(IS_MAC) - std::unique_ptr<display::ScopedNativeScreen> screen_; -#endif - base::OnceCallback<void(HeadlessBrowser*)> on_start_callback_; HeadlessBrowser::Options options_; raw_ptr<HeadlessBrowserMainParts> browser_main_parts_; // Not owned.
diff --git a/headless/lib/browser/headless_browser_impl_mac.mm b/headless/lib/browser/headless_browser_impl_mac.mm index da3dee43..812572a 100644 --- a/headless/lib/browser/headless_browser_impl_mac.mm +++ b/headless/lib/browser/headless_browser_impl_mac.mm
@@ -65,7 +65,6 @@ } // namespace void HeadlessBrowserImpl::PlatformInitialize() { - screen_ = std::make_unique<display::ScopedNativeScreen>(); HeadlessPopUpMethods::Init(); }
diff --git "a/infra/config/generated/builders/ci/Win x64 Builder \050py2 less\051/properties.json" "b/infra/config/generated/builders/ci/Win x64 Builder \050py2 less\051/properties.json" new file mode 100644 index 0000000..b83f239e --- /dev/null +++ "b/infra/config/generated/builders/ci/Win x64 Builder \050py2 less\051/properties.json"
@@ -0,0 +1,56 @@ +{ + "$build/chromium_tests_builder_config": { + "builder_config": { + "builder_db": { + "entries": [ + { + "builder_id": { + "bucket": "ci", + "builder": "Win x64 Builder (py2 less)", + "project": "chromium" + }, + "builder_spec": { + "builder_group": "chromium.fyi", + "execution_mode": "COMPILE_AND_TEST", + "legacy_chromium_config": { + "apply_configs": [ + "mb" + ], + "build_config": "Release", + "config": "chromium", + "target_bits": 64, + "target_platform": "win" + }, + "legacy_gclient_config": { + "apply_configs": [ + "use_clang_coverage" + ], + "config": "chromium" + } + } + } + ] + }, + "builder_ids": [ + { + "bucket": "ci", + "builder": "Win x64 Builder (py2 less)", + "project": "chromium" + } + ] + } + }, + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "metrics_project": "chromium-reclient-metrics" + }, + "$recipe_engine/resultdb/test_presentation": { + "column_keys": [], + "grouping_keys": [ + "status", + "v.test_suite" + ] + }, + "builder_group": "chromium.fyi", + "recipe": "chromium" +} \ No newline at end of file
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index ede95d6..877bece2 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -19677,6 +19677,90 @@ } } builders { + name: "Win x64 Builder (py2 less)" + swarming_host: "chromium-swarm.appspot.com" + dimensions: "builderless:1" + dimensions: "cores:32" + dimensions: "cpu:x86-64" + dimensions: "os:Windows-10" + dimensions: "pool:luci.chromium.ci" + dimensions: "ssd:0" + exe { + cipd_package: "infra/chromium/bootstrapper/${platform}" + cipd_version: "latest" + cmd: "bootstrapper" + } + properties: + '{' + ' "$bootstrap/exe": {' + ' "exe": {' + ' "cipd_package": "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build",' + ' "cipd_version": "refs/heads/main",' + ' "cmd": [' + ' "luciexe"' + ' ]' + ' }' + ' },' + ' "$bootstrap/properties": {' + ' "properties_file": "infra/config/generated/builders/ci/Win x64 Builder (py2 less)/properties.json",' + ' "top_level_project": {' + ' "ref": "refs/heads/main",' + ' "repo": {' + ' "host": "chromium.googlesource.com",' + ' "project": "chromium/src"' + ' }' + ' }' + ' },' + ' "builder_group": "chromium.fyi",' + ' "led_builder_is_bootstrapped": true,' + ' "recipe": "chromium"' + '}' + execution_timeout_secs: 36000 + build_numbers: YES + service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" + experiments { + key: "luci.buildbucket.omit_python2" + value: 100 + } + experiments { + key: "luci.recipes.use_python3" + value: 100 + } + resultdb { + enable: true + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "ci_test_results" + test_results {} + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "gpu_ci_test_results" + test_results { + predicate { + test_id_regexp: "ninja://chrome/test:telemetry_gpu_integration_test[^/]*/.+" + } + } + } + bq_exports { + project: "chrome-luci-data" + dataset: "chromium" + table: "blink_web_tests_ci_test_results" + test_results { + predicate { + test_id_regexp: "ninja://[^/]*blink_web_tests/.+" + } + } + } + history_options { + use_invocation_timestamp: true + } + } + description_html: "This is mirror of <a href=\"https://ci.chromium.org/p/chromium/builders/ci/Win%20x64%20Builder\">Win x64 Builder</a>, but runs on bots not having python2." + } + builders { name: "Win x64 Builder (reclient compare)" swarming_host: "chromium-swarm.appspot.com" dimensions: "builderless:1"
diff --git a/infra/config/generated/luci/luci-milo.cfg b/infra/config/generated/luci/luci-milo.cfg index 238d045..5f8fff9 100644 --- a/infra/config/generated/luci/luci-milo.cfg +++ b/infra/config/generated/luci/luci-milo.cfg
@@ -7997,6 +7997,11 @@ category: "win" } builders { + name: "buildbucket/luci.chromium.ci/Win x64 Builder (py2 less)" + category: "win" + short_name: "py3" + } + builders { name: "buildbucket/luci.chromium.ci/Comparison Windows (8 cores) (reclient)" category: "win" short_name: "re"
diff --git a/infra/config/generated/luci/luci-scheduler.cfg b/infra/config/generated/luci/luci-scheduler.cfg index dfbb3a8..d91d1b2 100644 --- a/infra/config/generated/luci/luci-scheduler.cfg +++ b/infra/config/generated/luci/luci-scheduler.cfg
@@ -3565,6 +3565,16 @@ } } job { + id: "Win x64 Builder (py2 less)" + realm: "ci" + acl_sets: "ci" + buildbucket { + server: "cr-buildbucket.appspot.com" + bucket: "ci" + builder: "Win x64 Builder (py2 less)" + } +} +job { id: "Win x64 Builder (reclient compare)" realm: "ci" acl_sets: "ci" @@ -6981,6 +6991,7 @@ triggers: "Win Builder (dbg)" triggers: "Win x64 Builder" triggers: "Win x64 Builder (dbg)" + triggers: "Win x64 Builder (py2 less)" triggers: "Win x64 Builder (reclient compare)" triggers: "Win x64 Builder (reclient)" triggers: "Win x64 Builder (reclient)(cross)"
diff --git a/infra/config/subprojects/chromium/ci/chromium.fyi.star b/infra/config/subprojects/chromium/ci/chromium.fyi.star index 5f1213c..e2c90871 100644 --- a/infra/config/subprojects/chromium/ci/chromium.fyi.star +++ b/infra/config/subprojects/chromium/ci/chromium.fyi.star
@@ -923,6 +923,40 @@ os = os.WINDOWS_DEFAULT, ) +ci.builder( + name = "Win x64 Builder (py2 less)", + description_html = "This is mirror of <a href=\"https://ci.chromium.org/p/chromium/builders/ci/Win%20x64%20Builder\">Win x64 Builder</a>, but runs on bots not having python2.", + builder_spec = builder_config.builder_spec( + gclient_config = builder_config.gclient_config( + config = "chromium", + apply_configs = [ + "use_clang_coverage", + ], + ), + chromium_config = builder_config.chromium_config( + config = "chromium", + apply_configs = [ + "mb", + ], + build_config = builder_config.build_config.RELEASE, + target_bits = 64, + target_platform = builder_config.target_platform.WIN, + ), + ), + builderless = True, + console_view_entry = consoles.console_view_entry( + category = "win", + short_name = "py3", + ), + cores = 32, + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + os = os.WINDOWS_DEFAULT, + experiments = { + "luci.buildbucket.omit_python2": 100, + }, +) + fyi_mac_builder( name = "Mac Builder (reclient)", builderless = True,
diff --git a/ios/chrome/browser/BUILD.gn b/ios/chrome/browser/BUILD.gn index e69dcd5..2d80583 100644 --- a/ios/chrome/browser/BUILD.gn +++ b/ios/chrome/browser/BUILD.gn
@@ -265,7 +265,6 @@ "//rlz/buildflags", "//services/network:network_service", "//ui/base", - "//ui/display", ] if (enable_rlz) {
diff --git a/ios/chrome/browser/first_run/first_run_metrics.h b/ios/chrome/browser/first_run/first_run_metrics.h index a1df133c..c5b216d 100644 --- a/ios/chrome/browser/first_run/first_run_metrics.h +++ b/ios/chrome/browser/first_run/first_run_metrics.h
@@ -114,6 +114,42 @@ kMaxValue = kWelcomeAndSigninScreenCompletionWithoutSignIn, }; +// The different type of screens of the first run experience. This is mapped to +// the variants of the metric IOS.FirstRun.ScrollButtonVisible.* in of +// `tools/metrics/histograms/metadata/ios/histograms.xml`. +enum FirstRunScreenType { + // The new FRE screen that instructs the user to set default browser to + // Chrome. + kDefaultBrowserPromoScreen, + // The screen that asks the user to sign in when no stored account is + // detected, with a footer shown at the bottom. Displayed when MICe is enabled + // without the welcome screen (2-steps MICe FRE), or when forced sign-in is + // enabled. + kSignInScreenWithFooter, + // The screen that asks the user to sign in a stored account, with a footer + // shown at the bottom. Displayed when MICe is enabled without the welcome + // screen (2-steps MICe FRE), or when forced sign-in is enabled. + kSignInScreenWithFooterAndIdentityPicker, + // The screen that asks the user to sign in a stored account, but with no + // footer shown at the bottom. Displayed when MICe is enabled with the welcome + // screen (3-steps MICe FRE). + kSignInScreenWithIdentityPicker, + // The screen that asks the user to sign in when no stored account is + // detected, but with no footer shown at the bottom. Displayed when MICe is + // enabled with the welcome screen (3-steps MICe FRE). + kSignInScreenWithoutFooterOrIdentityPicker, + // The screen that asks the user to turn on sync while no account picker is + // present. Displayed when MICe is enabled or when no account is detected. + kSyncScreenWithoutIdentityPicker, + // The screen that asks the user to turn on sync while showing an account + // picker. Displayed when MICe is disabled and an account is detected. + kSyncScreenWithIdentityPicker, + // Welcome screen without UMA checkbox. Displayed when MICe is enabled. + kWelcomeScreenWithoutUMACheckbox, + // Welcome screen with UMA checkbox. Displayed when MICe is disabled. + kWelcomeScreenWithUMACheckbox, +}; + } // namespace first_run #endif // IOS_CHROME_BROWSER_FIRST_RUN_FIRST_RUN_METRICS_H_
diff --git a/ios/chrome/browser/ios_chrome_main_parts.mm b/ios/chrome/browser/ios_chrome_main_parts.mm index 733a7d65..c43c354 100644 --- a/ios/chrome/browser/ios_chrome_main_parts.mm +++ b/ios/chrome/browser/ios_chrome_main_parts.mm
@@ -85,10 +85,6 @@ #include "base/allocator/allocator_shim.h" #endif -#if DCHECK_IS_ON() -#include "ui/display/screen_base.h" -#endif - #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @@ -129,15 +125,7 @@ net::URLRequest::SetDefaultCookiePolicyToBlock(); } -IOSChromeMainParts::~IOSChromeMainParts() { -#if DCHECK_IS_ON() - // The screen object is never deleted on IOS. Make sure that all display - // observers are removed at the end. - display::ScreenBase* screen = - static_cast<display::ScreenBase*>(display::Screen::GetScreen()); - DCHECK(!screen->HasDisplayObservers()); -#endif -} +IOSChromeMainParts::~IOSChromeMainParts() {} void IOSChromeMainParts::PreEarlyInitialization() { #if BUILDFLAG(USE_ALLOCATOR_SHIM)
diff --git a/ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator.mm b/ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator.mm index ba59ac3..b8facd41 100644 --- a/ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator.mm +++ b/ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator.mm
@@ -4,55 +4,36 @@ #import "ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator.h" -#include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#import "base/memory/weak_ptr.h" #import "ios/chrome/browser/snapshots/snapshot_tab_helper.h" #import "ios/chrome/common/ui/util/image_util.h" #import "ios/web/public/web_state.h" -#include "ios/web/public/web_state_observer.h" -#import "ios/web/public/web_state_observer_bridge.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -@interface ChromeActivityItemThumbnailGenerator () <CRWWebStateObserver> { - // WebState to be used for generating the snapshot. - web::WebState* _webState; - // Bridges WebStateObserver methods to this object. - std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; +@implementation ChromeActivityItemThumbnailGenerator { + // WebState used for generating the snapshot. + base::WeakPtr<web::WebState> _weakWebState; } -@end - -@implementation ChromeActivityItemThumbnailGenerator #pragma mark - Initializers - (instancetype)initWithWebState:(web::WebState*)webState { - DCHECK(webState); - self = [super init]; - if (self) { - // Thumbnail shouldn't be generated for incognito tabs. So there is no need - // to observe the webState. - if (webState->GetBrowserState()->IsOffTheRecord()) - return self; - _webState = webState; - _webStateObserver = std::make_unique<web::WebStateObserverBridge>(self); - _webState->AddObserver(_webStateObserver.get()); + if ((self = [super init])) { + _weakWebState = webState->GetWeakPtr(); } return self; } -- (void)dealloc { - if (_webState) - _webState->RemoveObserver(_webStateObserver.get()); -} - #pragma mark - Public methods - (UIImage*)thumbnailWithSize:(const CGSize&)size { - if (!_webState) + web::WebState* webState = _weakWebState.get(); + if (!webState) return nil; - UIImage* snapshot = SnapshotTabHelper::FromWebState(_webState) + UIImage* snapshot = SnapshotTabHelper::FromWebState(webState) ->GenerateSnapshotWithoutOverlays(); if (!snapshot) return nil; @@ -60,14 +41,4 @@ /*opaque=*/YES); } -#pragma mark - Private methods -#pragma mark - CRWWebStateObserver protocol - -- (void)webStateDestroyed:(web::WebState*)webState { - DCHECK_EQ(_webState, webState); - _webState->RemoveObserver(_webStateObserver.get()); - _webStateObserver.reset(); - _webState = nullptr; -} - @end
diff --git a/ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator_unittest.mm b/ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator_unittest.mm index e72cbea..9701eeea 100644 --- a/ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator_unittest.mm +++ b/ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator_unittest.mm
@@ -4,13 +4,13 @@ #import "ios/chrome/browser/ui/activity_services/data/chrome_activity_item_thumbnail_generator.h" -#include "base/test/task_environment.h" -#import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" +#import "base/task/thread_pool.h" +#import "base/test/task_environment.h" #import "ios/chrome/browser/snapshots/fake_snapshot_generator_delegate.h" #import "ios/chrome/browser/snapshots/snapshot_tab_helper.h" #import "ios/web/public/test/fakes/fake_web_state.h" -#include "testing/platform_test.h" -#include "ui/base/test/ios/ui_image_test_utils.h" +#import "testing/platform_test.h" +#import "ui/base/test/ios/ui_image_test_utils.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -21,8 +21,6 @@ class ChromeActivityItemThumbnailGeneratorTest : public PlatformTest { protected: ChromeActivityItemThumbnailGeneratorTest() { - chrome_browser_state_ = TestChromeBrowserState::Builder().Build(); - delegate_ = [[FakeSnapshotGeneratorDelegate alloc] init]; CGRect frame = {CGPointZero, CGSizeMake(400, 300)}; delegate_.view = [[UIView alloc] initWithFrame:frame]; @@ -32,22 +30,12 @@ SnapshotTabHelper::FromWebState(&fake_web_state_)->SetDelegate(delegate_); } - void SetIncognito(bool incognito) { - fake_web_state_.SetBrowserState( - incognito ? chrome_browser_state_->GetOffTheRecordChromeBrowserState() - : chrome_browser_state_.get()); - } - - FakeSnapshotGeneratorDelegate* delegate_ = nil; base::test::TaskEnvironment task_environment_; - std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; + FakeSnapshotGeneratorDelegate* delegate_ = nil; web::FakeWebState fake_web_state_; }; -TEST_F(ChromeActivityItemThumbnailGeneratorTest, - ThumbnailForNonIncognitoWebState) { - SetIncognito(/*incognito=*/false); - +TEST_F(ChromeActivityItemThumbnailGeneratorTest, Thumbnail) { CGSize size = CGSizeMake(50, 50); ChromeActivityItemThumbnailGenerator* generator = [[ChromeActivityItemThumbnailGenerator alloc] @@ -58,17 +46,28 @@ EXPECT_TRUE(CGSizeEqualToSize(thumbnail.size, size)); } -TEST_F(ChromeActivityItemThumbnailGeneratorTest, - NoThumbnailForIncognitoWebState) { - SetIncognito(/*incognito=*/true); +TEST_F(ChromeActivityItemThumbnailGeneratorTest, DeallocOnBackgroundSequence) { + // Create a closure that owns a ChromeActivityItemThumbnailGenerator and + // that will deallocate it when it is run, allowing to deallocate it on + // a background sequence. + base::OnceClosure closure; + @autoreleasepool { + __attribute__((objc_precise_lifetime)) + ChromeActivityItemThumbnailGenerator* generator = + [[ChromeActivityItemThumbnailGenerator alloc] + initWithWebState:&fake_web_state_]; - CGSize size = CGSizeMake(50, 50); - ChromeActivityItemThumbnailGenerator* generator = - [[ChromeActivityItemThumbnailGenerator alloc] - initWithWebState:&fake_web_state_]; - EXPECT_TRUE(generator); - UIImage* thumbnail = [generator thumbnailWithSize:size]; - EXPECT_FALSE(thumbnail); + closure = base::BindOnce(^(id object){/* do nothing */}, generator); + } + + // Post the closure on a background sequence to force the deallocation + // of the ChromeActivityItemThumbnailGenerator on another sequence. It + // should not crash. + base::RunLoop run_loop; + base::ThreadPool::PostTaskAndReply(FROM_HERE, {base::MayBlock()}, + std::move(closure), + run_loop.QuitClosure()); + run_loop.Run(); } } // namespace
diff --git a/ios/chrome/browser/ui/activity_services/data/share_to_data_builder.mm b/ios/chrome/browser/ui/activity_services/data/share_to_data_builder.mm index 66deb3c5..3a66693 100644 --- a/ios/chrome/browser/ui/activity_services/data/share_to_data_builder.mm +++ b/ios/chrome/browser/ui/activity_services/data/share_to_data_builder.mm
@@ -55,8 +55,14 @@ } BOOL is_page_printable = [web_state->GetView() viewPrintFormatter] != nil; + + // Thumbnail should not be generated for incognito tabs. ChromeActivityItemThumbnailGenerator* thumbnail_generator = - [[ChromeActivityItemThumbnailGenerator alloc] initWithWebState:web_state]; + web_state->GetBrowserState()->IsOffTheRecord() + ? nil + : [[ChromeActivityItemThumbnailGenerator alloc] + initWithWebState:web_state]; + const GURL& finalURLToShare = !share_url.is_empty() ? share_url : web_state->GetVisibleURL(); web::NavigationItem* visibleItem =
diff --git a/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_coordinator.mm b/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_coordinator.mm index 0c91a6a..0aa5844 100644 --- a/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_coordinator.mm +++ b/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_coordinator.mm
@@ -273,6 +273,19 @@ [self.consentStringIDs addObject:[NSNumber numberWithInt:stringID]]; } +- (void)signinSyncViewController: + (SigninSyncViewController*)signinSyncViewController + logScrollButtonVisible:(BOOL)scrollButtonVisible + withAccountPickerVisible:(BOOL)accountButtonVisible { + first_run::FirstRunScreenType screenType = + accountButtonVisible + ? first_run::FirstRunScreenType::kSyncScreenWithIdentityPicker + : first_run::FirstRunScreenType::kSyncScreenWithoutIdentityPicker; + RecordFirstRunScrollButtonVisibilityMetrics(screenType, scrollButtonVisible); +} + +#pragma mark - PromoStyleViewControllerDelegate + - (void)didTapPrimaryActionButton { if (self.mediator.selectedIdentity) { [self startSync];
diff --git a/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_view_controller.mm b/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_view_controller.mm index df67f76..ea0821c0 100644 --- a/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_view_controller.mm
@@ -179,6 +179,13 @@ [super viewDidLoad]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + [self.delegate signinSyncViewController:self + logScrollButtonVisible:!self.didReachBottom + withAccountPickerVisible:!self.identityControl.hidden]; +} + - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection];
diff --git a/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_view_controller_delegate.h b/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_view_controller_delegate.h index 9aae657..e9d5dd7 100644 --- a/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_view_controller_delegate.h +++ b/ios/chrome/browser/ui/authentication/signin_sync/signin_sync_view_controller_delegate.h
@@ -22,6 +22,12 @@ (SigninSyncViewController*)signinSyncViewController addConsentStringID:(const int)stringID; +// Logs scrollability metric on view appears. +- (void)signinSyncViewController: + (SigninSyncViewController*)signinSyncViewController + logScrollButtonVisible:(BOOL)scrollButtonVisible + withAccountPickerVisible:(BOOL)accountButtonVisible; + @end #endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_SIGNIN_SYNC_SIGNIN_SYNC_VIEW_CONTROLLER_DELEGATE_H_
diff --git a/ios/chrome/browser/ui/first_run/default_browser/BUILD.gn b/ios/chrome/browser/ui/first_run/default_browser/BUILD.gn index 6c319814..48fb53d 100644 --- a/ios/chrome/browser/ui/first_run/default_browser/BUILD.gn +++ b/ios/chrome/browser/ui/first_run/default_browser/BUILD.gn
@@ -27,8 +27,10 @@ ] deps = [ "//ios/chrome/app/strings", + "//ios/chrome/browser/first_run", "//ios/chrome/browser/ui/elements", "//ios/chrome/browser/ui/first_run:constants", + "//ios/chrome/browser/ui/first_run:utils", "//ios/chrome/browser/ui/first_run/resources:default_browser_screen_banner", "//ios/chrome/common/ui/colors", "//ios/chrome/common/ui/promo_style",
diff --git a/ios/chrome/browser/ui/first_run/default_browser/default_browser_screen_view_controller.mm b/ios/chrome/browser/ui/first_run/default_browser/default_browser_screen_view_controller.mm index 704a3b2a..de5546f 100644 --- a/ios/chrome/browser/ui/first_run/default_browser/default_browser_screen_view_controller.mm +++ b/ios/chrome/browser/ui/first_run/default_browser/default_browser_screen_view_controller.mm
@@ -4,8 +4,10 @@ #import "ios/chrome/browser/ui/first_run/default_browser/default_browser_screen_view_controller.h" +#include "ios/chrome/browser/first_run/first_run_metrics.h" #import "ios/chrome/browser/ui/elements/instruction_view.h" #import "ios/chrome/browser/ui/first_run/first_run_constants.h" +#import "ios/chrome/browser/ui/first_run/first_run_util.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h" #include "ios/chrome/grit/ios_chromium_strings.h" #import "ios/chrome/grit/ios_strings.h" @@ -62,4 +64,11 @@ [super viewDidLoad]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + RecordFirstRunScrollButtonVisibilityMetrics( + first_run::FirstRunScreenType::kDefaultBrowserPromoScreen, + !self.didReachBottom); +} + @end
diff --git a/ios/chrome/browser/ui/first_run/first_run_util.h b/ios/chrome/browser/ui/first_run/first_run_util.h index 2b6d823..85a6c65 100644 --- a/ios/chrome/browser/ui/first_run/first_run_util.h +++ b/ios/chrome/browser/ui/first_run/first_run_util.h
@@ -38,6 +38,11 @@ first_run::SignInAttemptStatus sign_in_attempt_status, BOOL has_sso_accounts); +// Records the result of the sign in steps for the First Run. +void RecordFirstRunScrollButtonVisibilityMetrics( + first_run::FirstRunScreenType screen_type, + BOOL scroll_button_visible); + // Records the completion of the first run. void WriteFirstRunSentinel();
diff --git a/ios/chrome/browser/ui/first_run/first_run_util.mm b/ios/chrome/browser/ui/first_run/first_run_util.mm index 7aded23..e26dbe2 100644 --- a/ios/chrome/browser/ui/first_run/first_run_util.mm +++ b/ios/chrome/browser/ui/first_run/first_run_util.mm
@@ -113,6 +113,60 @@ first_run::SIGNIN_SIZE); } +void RecordFirstRunScrollButtonVisibilityMetrics( + first_run::FirstRunScreenType screen_type, + BOOL scroll_button_visible) { + switch (screen_type) { + case first_run::FirstRunScreenType::kDefaultBrowserPromoScreen: + base::UmaHistogramBoolean( + "IOS.FirstRun.ScrollButtonVisible.DefaultBrowserPromoScreen", + scroll_button_visible); + break; + case first_run::FirstRunScreenType::kSignInScreenWithFooter: + base::UmaHistogramBoolean( + "IOS.FirstRun.ScrollButtonVisible.SignInScreenWithFooter", + scroll_button_visible); + break; + case first_run::FirstRunScreenType:: + kSignInScreenWithFooterAndIdentityPicker: + base::UmaHistogramBoolean("IOS.FirstRun.ScrollButtonVisible." + "SignInScreenWithFooterAndIdentityPicker", + scroll_button_visible); + break; + case first_run::FirstRunScreenType::kSignInScreenWithIdentityPicker: + base::UmaHistogramBoolean( + "IOS.FirstRun.ScrollButtonVisible.SignInScreenWithIdentityPicker", + scroll_button_visible); + break; + case first_run::FirstRunScreenType:: + kSignInScreenWithoutFooterOrIdentityPicker: + base::UmaHistogramBoolean("IOS.FirstRun.ScrollButtonVisible." + "SignInScreenWithoutFooterOrIdentityPicker", + scroll_button_visible); + break; + case first_run::FirstRunScreenType::kSyncScreenWithoutIdentityPicker: + base::UmaHistogramBoolean( + "IOS.FirstRun.ScrollButtonVisible.SyncScreenWithoutIdentityPicker", + scroll_button_visible); + break; + case first_run::FirstRunScreenType::kSyncScreenWithIdentityPicker: + base::UmaHistogramBoolean( + "IOS.FirstRun.ScrollButtonVisible.SyncScreenWithIdentityPicker", + scroll_button_visible); + break; + case first_run::FirstRunScreenType::kWelcomeScreenWithoutUMACheckbox: + base::UmaHistogramBoolean( + "IOS.FirstRun.ScrollButtonVisible.WelcomeScreenWithoutUMACheckbox", + scroll_button_visible); + break; + case first_run::FirstRunScreenType::kWelcomeScreenWithUMACheckbox: + base::UmaHistogramBoolean( + "IOS.FirstRun.ScrollButtonVisible.WelcomeScreenWithUMACheckbox", + scroll_button_visible); + break; + } +} + void FinishFirstRun(ChromeBrowserState* browserState, web::WebState* web_state, FirstRunConfiguration* config,
diff --git a/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_coordinator.mm b/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_coordinator.mm index c7d96b6..14dff43 100644 --- a/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_coordinator.mm +++ b/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_coordinator.mm
@@ -195,6 +195,24 @@ self.mediator.selectedIdentity; } +- (void)logScrollButtonVisible:(BOOL)scrollButtonVisible + withIdentityPicker:(BOOL)identityPickerVisible + andFooter:(BOOL)footerVisible { + first_run::FirstRunScreenType screenType; + if (identityPickerVisible && footerVisible) { + screenType = + first_run::FirstRunScreenType::kSignInScreenWithFooterAndIdentityPicker; + } else if (identityPickerVisible) { + screenType = first_run::FirstRunScreenType::kSignInScreenWithIdentityPicker; + } else if (footerVisible) { + screenType = first_run::FirstRunScreenType::kSignInScreenWithFooter; + } else { + screenType = first_run::FirstRunScreenType:: + kSignInScreenWithoutFooterOrIdentityPicker; + } + RecordFirstRunScrollButtonVisibilityMetrics(screenType, scrollButtonVisible); +} + - (void)didTapPrimaryActionButton { if (self.mediator.selectedIdentity) { [self startSignIn];
diff --git a/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_view_controller.h b/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_view_controller.h index 672f914..591253d 100644 --- a/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_view_controller.h +++ b/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_view_controller.h
@@ -18,6 +18,11 @@ // Called when the user taps to see the account picker. - (void)showAccountPickerFromPoint:(CGPoint)point; +// Logs scrollability metric on view appears. +- (void)logScrollButtonVisible:(BOOL)scrollButtonVisible + withIdentityPicker:(BOOL)identityPickerVisible + andFooter:(BOOL)footerVisible; + @end // View controller of sign-in screen.
diff --git a/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_view_controller.mm b/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_view_controller.mm index 7de47b9..9db8e0e1 100644 --- a/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_view_controller.mm +++ b/ios/chrome/browser/ui/first_run/legacy_signin/legacy_signin_screen_view_controller.mm
@@ -141,6 +141,14 @@ [super viewDidLoad]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + [self.delegate logScrollButtonVisible:!self.didReachBottom + withIdentityPicker:!self.identityControl.hidden + andFooter:self.enterpriseSignInRestrictions != + kNoEnterpriseRestriction]; +} + - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection];
diff --git a/ios/chrome/browser/ui/first_run/signin/signin_screen_coordinator.mm b/ios/chrome/browser/ui/first_run/signin/signin_screen_coordinator.mm index 9baf378e..bcfc97c 100644 --- a/ios/chrome/browser/ui/first_run/signin/signin_screen_coordinator.mm +++ b/ios/chrome/browser/ui/first_run/signin/signin_screen_coordinator.mm
@@ -24,6 +24,7 @@ #import "ios/chrome/browser/ui/first_run/first_run_constants.h" #import "ios/chrome/browser/ui/first_run/first_run_screen_delegate.h" #import "ios/chrome/browser/ui/first_run/first_run_util.h" +#import "ios/chrome/browser/ui/first_run/signin/signin_screen_consumer.h" #import "ios/chrome/browser/ui/first_run/signin/signin_screen_mediator.h" #import "ios/chrome/browser/ui/first_run/signin/signin_screen_view_controller.h" #import "ios/chrome/browser/ui/first_run/uma/uma_coordinator.h" @@ -285,6 +286,24 @@ self.mediator.selectedIdentity; } +- (void)logScrollButtonVisible:(BOOL)scrollButtonVisible + withIdentityPicker:(BOOL)identityPickerVisible + andFooter:(BOOL)footerVisible { + first_run::FirstRunScreenType screenType; + if (identityPickerVisible && footerVisible) { + screenType = + first_run::FirstRunScreenType::kSignInScreenWithFooterAndIdentityPicker; + } else if (identityPickerVisible) { + screenType = first_run::FirstRunScreenType::kSignInScreenWithIdentityPicker; + } else if (footerVisible) { + screenType = first_run::FirstRunScreenType::kSignInScreenWithFooter; + } else { + screenType = first_run::FirstRunScreenType:: + kSignInScreenWithoutFooterOrIdentityPicker; + } + RecordFirstRunScrollButtonVisibilityMetrics(screenType, scrollButtonVisible); +} + #pragma mark - TOSCommands - (void)showTOSPage {
diff --git a/ios/chrome/browser/ui/first_run/signin/signin_screen_view_controller.h b/ios/chrome/browser/ui/first_run/signin/signin_screen_view_controller.h index b5df574..1679762 100644 --- a/ios/chrome/browser/ui/first_run/signin/signin_screen_view_controller.h +++ b/ios/chrome/browser/ui/first_run/signin/signin_screen_view_controller.h
@@ -18,6 +18,11 @@ // Called when the user taps to see the account picker. - (void)showAccountPickerFromPoint:(CGPoint)point; +// Logs scrollability metric on view appears. +- (void)logScrollButtonVisible:(BOOL)scrollButtonVisible + withIdentityPicker:(BOOL)identityPickerVisible + andFooter:(BOOL)footerVisible; + @end // View controller of sign-in screen.
diff --git a/ios/chrome/browser/ui/first_run/signin/signin_screen_view_controller.mm b/ios/chrome/browser/ui/first_run/signin/signin_screen_view_controller.mm index 4cd2bc6..df9485c 100644 --- a/ios/chrome/browser/ui/first_run/signin/signin_screen_view_controller.mm +++ b/ios/chrome/browser/ui/first_run/signin/signin_screen_view_controller.mm
@@ -161,6 +161,13 @@ [super viewDidLoad]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + [self.delegate logScrollButtonVisible:!self.didReachBottom + withIdentityPicker:!self.identityControl.hidden + andFooter:[self.disclaimerText length] > 0]; +} + #pragma mark - Properties - (IdentityButtonControl*)identityControl {
diff --git a/ios/chrome/browser/ui/first_run/sync/BUILD.gn b/ios/chrome/browser/ui/first_run/sync/BUILD.gn index 23a4a280..459787f 100644 --- a/ios/chrome/browser/ui/first_run/sync/BUILD.gn +++ b/ios/chrome/browser/ui/first_run/sync/BUILD.gn
@@ -32,6 +32,7 @@ "//ios/chrome/browser/ui/coordinators:chrome_coordinators", "//ios/chrome/browser/ui/first_run:interruptible_chrome_coordinator", "//ios/chrome/browser/ui/first_run:screen_delegate", + "//ios/chrome/browser/ui/first_run:utils", "//ios/chrome/browser/ui/main:scene_state_header", "//ios/chrome/browser/unified_consent", "//ios/public/provider/chrome/browser/signin",
diff --git a/ios/chrome/browser/ui/first_run/sync/sync_screen_coordinator.mm b/ios/chrome/browser/ui/first_run/sync/sync_screen_coordinator.mm index 3f262db..21cd4a6 100644 --- a/ios/chrome/browser/ui/first_run/sync/sync_screen_coordinator.mm +++ b/ios/chrome/browser/ui/first_run/sync/sync_screen_coordinator.mm
@@ -26,6 +26,7 @@ #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/browsing_data_commands.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" +#import "ios/chrome/browser/ui/first_run/first_run_util.h" #import "ios/chrome/browser/ui/first_run/sync/sync_screen_mediator.h" #import "ios/chrome/browser/ui/first_run/sync/sync_screen_mediator_delegate.h" #import "ios/chrome/browser/ui/first_run/sync/sync_screen_view_controller.h" @@ -214,6 +215,12 @@ [self.consentStringIDs addObject:[NSNumber numberWithInt:stringID]]; } +- (void)logScrollButtonVisible:(BOOL)scrollButtonVisible { + RecordFirstRunScrollButtonVisibilityMetrics( + first_run::FirstRunScreenType::kSyncScreenWithoutIdentityPicker, + scrollButtonVisible); +} + #pragma mark - SyncScreenMediatorDelegate - (void)syncScreenMediatorDidSuccessfulyFinishSignin:
diff --git a/ios/chrome/browser/ui/first_run/sync/sync_screen_view_controller.h b/ios/chrome/browser/ui/first_run/sync/sync_screen_view_controller.h index cec2b7e..509cb7d 100644 --- a/ios/chrome/browser/ui/first_run/sync/sync_screen_view_controller.h +++ b/ios/chrome/browser/ui/first_run/sync/sync_screen_view_controller.h
@@ -14,8 +14,12 @@ // Delegate of sync screen view controller. @protocol SyncScreenViewControllerDelegate <PromoStyleViewControllerDelegate> +// Adds consent string ID. - (void)addConsentStringID:(const int)stringID; +// Logs scrollability metric on view appears. +- (void)logScrollButtonVisible:(BOOL)scrollButtonVisible; + @end // View controller of sync screen.
diff --git a/ios/chrome/browser/ui/first_run/sync/sync_screen_view_controller.mm b/ios/chrome/browser/ui/first_run/sync/sync_screen_view_controller.mm index 658d2a4..92ac6f0 100644 --- a/ios/chrome/browser/ui/first_run/sync/sync_screen_view_controller.mm +++ b/ios/chrome/browser/ui/first_run/sync/sync_screen_view_controller.mm
@@ -99,6 +99,11 @@ [super viewDidLoad]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + [self.delegate logScrollButtonVisible:!self.didReachBottom]; +} + #pragma mark - Properties - (ActivityOverlayView*)overlay {
diff --git a/ios/chrome/browser/ui/first_run/welcome/BUILD.gn b/ios/chrome/browser/ui/first_run/welcome/BUILD.gn index 268041ec..f0c7edf 100644 --- a/ios/chrome/browser/ui/first_run/welcome/BUILD.gn +++ b/ios/chrome/browser/ui/first_run/welcome/BUILD.gn
@@ -16,12 +16,14 @@ "//components/metrics", "//ios/chrome/app/strings", "//ios/chrome/browser/browser_state", + "//ios/chrome/browser/first_run", "//ios/chrome/browser/main:public", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/coordinators:chrome_coordinators", "//ios/chrome/browser/ui/first_run:field_trial", "//ios/chrome/browser/ui/first_run:screen_delegate", + "//ios/chrome/browser/ui/first_run:utils", "//ios/chrome/browser/ui/first_run/uma", "//ios/chrome/browser/ui/util:terms_util", "//ios/web/common:web_view_creation_util",
diff --git a/ios/chrome/browser/ui/first_run/welcome/welcome_screen_coordinator.mm b/ios/chrome/browser/ui/first_run/welcome/welcome_screen_coordinator.mm index b5f57b0..ac0b412 100644 --- a/ios/chrome/browser/ui/first_run/welcome/welcome_screen_coordinator.mm +++ b/ios/chrome/browser/ui/first_run/welcome/welcome_screen_coordinator.mm
@@ -6,9 +6,11 @@ #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" +#import "ios/chrome/browser/first_run/first_run_metrics.h" #include "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" #include "ios/chrome/browser/ui/commands/tos_commands.h" +#import "ios/chrome/browser/ui/first_run/first_run_util.h" #import "ios/chrome/browser/ui/first_run/fre_field_trial.h" #include "ios/chrome/browser/ui/first_run/uma/uma_coordinator.h" #include "ios/chrome/browser/ui/first_run/welcome/tos_coordinator.h" @@ -153,4 +155,13 @@ [self.UMACoordinator start]; } +- (void)logScrollButtonVisible:(BOOL)scrollButtonVisible + withUMACheckboxVisible:(BOOL)umaCheckboxVisible { + first_run::FirstRunScreenType screenType = + umaCheckboxVisible + ? first_run::FirstRunScreenType::kWelcomeScreenWithUMACheckbox + : first_run::FirstRunScreenType::kWelcomeScreenWithoutUMACheckbox; + RecordFirstRunScrollButtonVisibilityMetrics(screenType, scrollButtonVisible); +} + @end
diff --git a/ios/chrome/browser/ui/first_run/welcome/welcome_screen_view_controller.h b/ios/chrome/browser/ui/first_run/welcome/welcome_screen_view_controller.h index ca3d5411..9b65ef3 100644 --- a/ios/chrome/browser/ui/first_run/welcome/welcome_screen_view_controller.h +++ b/ios/chrome/browser/ui/first_run/welcome/welcome_screen_view_controller.h
@@ -21,6 +21,10 @@ // Called when the user taps on "Manage" related to metric reporting. - (void)showUMADialog; +// Logs scrollability metric on view appears. +- (void)logScrollButtonVisible:(BOOL)scrollButtonVisible + withUMACheckboxVisible:(BOOL)umaCheckboxVisible; + @end // View controller of welcome screen.
diff --git a/ios/chrome/browser/ui/first_run/welcome/welcome_screen_view_controller.mm b/ios/chrome/browser/ui/first_run/welcome/welcome_screen_view_controller.mm index f3f425f..e6550bf4 100644 --- a/ios/chrome/browser/ui/first_run/welcome/welcome_screen_view_controller.mm +++ b/ios/chrome/browser/ui/first_run/welcome/welcome_screen_view_controller.mm
@@ -150,9 +150,12 @@ - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, self.titleLabel); + [self.delegate logScrollButtonVisible:!self.didReachBottom + withUMACheckboxVisible: + fre_field_trial::GetNewMobileIdentityConsistencyFRE() == + NewMobileIdentityConsistencyFRE::kOld]; } #pragma mark - Accessors
diff --git a/ios/chrome/common/ui/promo_style/promo_style_view_controller.h b/ios/chrome/common/ui/promo_style/promo_style_view_controller.h index 0146dc4..fe7ea54 100644 --- a/ios/chrome/common/ui/promo_style/promo_style_view_controller.h +++ b/ios/chrome/common/ui/promo_style/promo_style_view_controller.h
@@ -75,6 +75,10 @@ // The help button item in the top left of the view. Nil if not available. @property(nonatomic, readonly) UIButton* learnMoreButton; +// Whether the bottom of the view controller is reached. This value will always +// be YES when `self.scrollToEndMandatory` is NO. +@property(nonatomic, assign, readonly) BOOL didReachBottom; + @end #endif // IOS_CHROME_COMMON_UI_PROMO_STYLE_PROMO_STYLE_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/common/ui/promo_style/promo_style_view_controller.mm b/ios/chrome/common/ui/promo_style/promo_style_view_controller.mm index 1a5f1d0..5caef4a 100644 --- a/ios/chrome/common/ui/promo_style/promo_style_view_controller.mm +++ b/ios/chrome/common/ui/promo_style/promo_style_view_controller.mm
@@ -53,7 +53,8 @@ @property(nonatomic, strong) UIView* separator; -@property(nonatomic, assign) BOOL didReachBottom; +// Read/Write override. +@property(nonatomic, assign, readwrite) BOOL didReachBottom; // YES if the views can be updated on scroll updates (e.g., change the text // label string of the primary button) which corresponds to the moment where the
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index 98aff0c..4aa20d73 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -da2bc8b39be83996a338bb4533e039086c8f3d5f \ No newline at end of file +89ae3ff6f9daa965dee686306468f13f188572d8 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 index 110b71f..aa0f94dc 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -f9680a08f5d364609cc7088c952d424e2223d15e \ No newline at end of file +7cc14fc65e8b895ff41978d611ab31b817924791 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 index 782f0403..6398f88 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -189045ce9b6ab6e0de583c3f3f6f1bd33d3c666f \ No newline at end of file +91dd0f99cfabfbaa7904d28a88ab345fb9faf67a \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 index 088eb003..3ac6988 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -fbd2678c6e85d3d9bc3c052f8cee4a48aed0de5e \ No newline at end of file +c0359a50f72109f52b435619c587a09a8e7d449c \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 index f3891da5..d2ea403 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -bcd9e458d866505d51b404592dea764e5c2c5c87 \ No newline at end of file +d71409f657834f1d5fdd60d2be0824cf50b783da \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 index 235e1f34..798a918 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -821ab244e45baa91893f2776299d31a67f615bd1 \ No newline at end of file +6d8cee79019f7eb244a51ef4965ff51a31322625 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 index f29c684..1cacd5c 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -11aa14dc070b66c701f5018d46a77b5e6cec4770 \ No newline at end of file +4f243c420c6b71acf812ae71223923936990444b \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 index 2426973..de823f5 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -c3c3d96709d8be611c3d4c59ea8fdd9dbae589b7 \ No newline at end of file +d94cf7e29377dd3761a30c82c83dcb7579da05ee \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 index d597f911..1702b34c9 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -2b1890856f2febe5baf4f1e867f07fc62300b9d4 \ No newline at end of file +20501ef6f57480dfc8b601ce3e07a51463c8ef2d \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 index 0ec5d9e4..6fc6fe2 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -24b33584539f5882723b77d6722db91e06bcec09 \ No newline at end of file +6206715728cfe771b40914dd58f0ef7cfcccfaf0 \ No newline at end of file
diff --git a/ios/testing/earl_grey/BUILD.gn b/ios/testing/earl_grey/BUILD.gn index a5b4ab0..6f5935bb 100644 --- a/ios/testing/earl_grey/BUILD.gn +++ b/ios/testing/earl_grey/BUILD.gn
@@ -63,6 +63,5 @@ "//ios/third_party/edo", "//ios/web/common", "//testing/gtest:gtest", - "//ui/display", ] }
diff --git a/ios/testing/earl_grey/DEPS b/ios/testing/earl_grey/DEPS deleted file mode 100644 index e5069168..0000000 --- a/ios/testing/earl_grey/DEPS +++ /dev/null
@@ -1,5 +0,0 @@ -specific_include_rules = { - "base_earl_grey_test_case.mm": [ - "+ui/display" - ] -}
diff --git a/ios/testing/earl_grey/base_earl_grey_test_case.mm b/ios/testing/earl_grey/base_earl_grey_test_case.mm index 5440688..da86c76c 100644 --- a/ios/testing/earl_grey/base_earl_grey_test_case.mm +++ b/ios/testing/earl_grey/base_earl_grey_test_case.mm
@@ -16,10 +16,6 @@ #import "ios/testing/earl_grey/coverage_utils.h" #import "ios/testing/earl_grey/earl_grey_test.h" -#if DCHECK_IS_ON() -#include "ui/display/screen_base.h" -#endif - #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @@ -76,14 +72,6 @@ } + (void)tearDown { -#if DCHECK_IS_ON() - // The same screen object is shared across multiple test runs on IOS build. - // Make sure that all display observers are removed at the end of each - // test. - display::ScreenBase* screen = - static_cast<display::ScreenBase*>(display::Screen::GetScreen()); - DCHECK(!screen->HasDisplayObservers()); -#endif if ([[AppLaunchManager sharedManager] appIsLaunched]) { [CoverageUtils writeClangCoverageProfile]; [CoverageUtils resetCoverageProfileCounters];
diff --git a/ios/web/shell/BUILD.gn b/ios/web/shell/BUILD.gn index a35ad69..bdf5d2c9 100644 --- a/ios/web/shell/BUILD.gn +++ b/ios/web/shell/BUILD.gn
@@ -63,7 +63,6 @@ "//net", "//net:extras", "//ui/base", - "//ui/display", ] frameworks = [
diff --git a/ios/web/shell/shell_web_main_parts.mm b/ios/web/shell/shell_web_main_parts.mm index 0e9bbbf..9833401f 100644 --- a/ios/web/shell/shell_web_main_parts.mm +++ b/ios/web/shell/shell_web_main_parts.mm
@@ -6,10 +6,6 @@ #include "ios/web/shell/shell_browser_state.h" -#if DCHECK_IS_ON() -#include "ui/display/screen_base.h" -#endif - #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @@ -20,13 +16,6 @@ } ShellWebMainParts::~ShellWebMainParts() { -#if DCHECK_IS_ON() - // The screen object is never deleted on IOS. Make sure that all display - // observers are removed at the end. - display::ScreenBase* screen = - static_cast<display::ScreenBase*>(display::Screen::GetScreen()); - DCHECK(!screen->HasDisplayObservers()); -#endif } void ShellWebMainParts::PreMainMessageLoopRun() {
diff --git a/ios/web/test/BUILD.gn b/ios/web/test/BUILD.gn index fe065aa6..60324ccc8 100644 --- a/ios/web/test/BUILD.gn +++ b/ios/web/test/BUILD.gn
@@ -71,7 +71,6 @@ "//net", "//third_party/ocmock", "//ui/base", - "//ui/display", ] sources = [
diff --git a/ios/web/test/web_int_test.mm b/ios/web/test/web_int_test.mm index 896a5add..ad4cca2 100644 --- a/ios/web/test/web_int_test.mm +++ b/ios/web/test/web_int_test.mm
@@ -15,10 +15,6 @@ #import "ios/web/public/test/web_view_interaction_test_util.h" #include "ios/web/public/web_state_observer.h" -#if DCHECK_IS_ON() -#include "ui/display/screen_base.h" -#endif - #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @@ -85,15 +81,6 @@ [WKWebsiteDataStore allWebsiteDataTypes]); WebTest::TearDown(); - -#if DCHECK_IS_ON() - // The same screen object is shared across multiple test runs on IOS build. - // Make sure that all display observers are removed at the end of each - // test. - display::ScreenBase* screen = - static_cast<display::ScreenBase*>(display::Screen::GetScreen()); - DCHECK(!screen->HasDisplayObservers()); -#endif } bool WebIntTest::ExecuteBlockAndWaitForLoad(const GURL& url,
diff --git a/ios/web_view/BUILD.gn b/ios/web_view/BUILD.gn index 3a9fd83..55a16746 100644 --- a/ios/web_view/BUILD.gn +++ b/ios/web_view/BUILD.gn
@@ -371,7 +371,6 @@ "//services/network:network_service", "//third_party/abseil-cpp:absl", "//ui/base", - "//ui/display", "//url", ]
diff --git a/ios/web_view/internal/DEPS b/ios/web_view/internal/DEPS index 271ac1bb..3d26b42b 100644 --- a/ios/web_view/internal/DEPS +++ b/ios/web_view/internal/DEPS
@@ -69,9 +69,3 @@ "+ui/base", "+ui/gfx", ] - -specific_include_rules = { - "web_view_web_main_parts.mm": [ - "+ui/display" - ] -}
diff --git a/ios/web_view/internal/web_view_web_main_parts.mm b/ios/web_view/internal/web_view_web_main_parts.mm index 534632d7..f6a80877 100644 --- a/ios/web_view/internal/web_view_web_main_parts.mm +++ b/ios/web_view/internal/web_view_web_main_parts.mm
@@ -24,10 +24,6 @@ #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/resource/resource_bundle.h" -#if DCHECK_IS_ON() -#include "ui/display/screen_base.h" -#endif - #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @@ -37,15 +33,7 @@ WebViewWebMainParts::WebViewWebMainParts() : field_trial_list_(/*entropy_provider=*/nullptr) {} -WebViewWebMainParts::~WebViewWebMainParts() { -#if DCHECK_IS_ON() - // The screen object is never deleted on IOS. Make sure that all display - // observers are removed at the end. - display::ScreenBase* screen = - static_cast<display::ScreenBase*>(display::Screen::GetScreen()); - DCHECK(!screen->HasDisplayObservers()); -#endif -} +WebViewWebMainParts::~WebViewWebMainParts() = default; void WebViewWebMainParts::PreCreateMainMessageLoop() { l10n_util::OverrideLocaleWithCocoaLocale();
diff --git a/media/capture/video/chromeos/camera_hal_delegate.cc b/media/capture/video/chromeos/camera_hal_delegate.cc index ef67081e..fbbdf7052 100644 --- a/media/capture/video/chromeos/camera_hal_delegate.cc +++ b/media/capture/video/chromeos/camera_hal_delegate.cc
@@ -559,7 +559,11 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!ipc_task_runner_->BelongsToCurrentThread()); - camera_module_has_been_set_.Wait(); + if (!camera_module_has_been_set_.TimedWait(kEventWaitTimeoutSecs)) { + LOG(ERROR) << "Camera module not set; platform camera service might not be " + "ready yet"; + return false; + } if (builtin_camera_info_updated_.IsSignaled()) { return true; }
diff --git a/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc b/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc index f7b7aaf..e5fddbb 100644 --- a/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc +++ b/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
@@ -461,17 +461,12 @@ HRESULT hr = MFCreateSample(&input_sample_); RETURN_ON_HR_FAILURE(hr, "Failed to create sample", false); - if (config.input_format == PIXEL_FORMAT_NV12 && - media::IsMediaFoundationD3D11VideoCaptureEnabled()) { + if (media::IsMediaFoundationD3D11VideoCaptureEnabled()) { dxgi_device_manager_ = DXGIDeviceManager::Create(); if (!dxgi_device_manager_) { MEDIA_LOG(ERROR, media_log.get()) << "Failed to create DXGIDeviceManager"; return false; } - } - - // Start the asynchronous processing model - if (dxgi_device_manager_) { auto mf_dxgi_device_manager = dxgi_device_manager_->GetMFDXGIDeviceManager(); hr = encoder_->ProcessMessage( @@ -480,6 +475,8 @@ RETURN_ON_HR_FAILURE( hr, "Couldn't set ProcessMessage MFT_MESSAGE_SET_D3D_MANAGER", false); } + + // Start the asynchronous processing model hr = encoder_->ProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, 0); RETURN_ON_HR_FAILURE( hr, "Couldn't set ProcessMessage MFT_MESSAGE_COMMAND_FLUSH", false);
diff --git a/net/base/port_util.cc b/net/base/port_util.cc index 0c406e5..775efb0 100644 --- a/net/base/port_util.cc +++ b/net/base/port_util.cc
@@ -20,35 +20,6 @@ namespace { -// Records ports that may need blocking to mitigate the ALPACA vulnerability. -// See https://alpaca-attack.com/ and https://github.com/whatwg/fetch/pull/1250. -void LogAlpacaPort(int port) { - // Unlike the obsolete Net.Port.SlipStreamRestricted histogram, we don't - // record an "Other" category. Instead, historical data from - // Net.Port.SlipStreamRestricted can be used as a baseline for comparisons. - enum class AlpacaPort { - k26 = 0, - k989 = 1, - k990 = 2, - k2525 = 3, - kMaxValue = k2525, - }; - - constexpr std::pair<int, AlpacaPort> kMap[] = { - {26, AlpacaPort::k26}, - {989, AlpacaPort::k989}, - {990, AlpacaPort::k990}, - {2525, AlpacaPort::k2525}, - }; - - for (const auto& pair : kMap) { - if (pair.first == port) { - base::UmaHistogramEnumeration("Net.Port.Alpaca", pair.second); - return; - } - } -} - // The general list of blocked ports. Will be blocked unless a specific // protocol overrides it. (Ex: ftp can use port 21) // When adding a port to the list, consider also adding it to kAllowablePorts, @@ -175,8 +146,6 @@ if (!IsPortValid(port)) return false; - LogAlpacaPort(port); - // Allow explicitly allowed ports for any scheme. if (g_explicitly_allowed_ports.Get().count(port) > 0) return true;
diff --git a/net/dns/host_resolver_manager_unittest.cc b/net/dns/host_resolver_manager_unittest.cc index 71a14fc..599b0c4 100644 --- a/net/dns/host_resolver_manager_unittest.cc +++ b/net/dns/host_resolver_manager_unittest.cc
@@ -8023,6 +8023,9 @@ const std::vector<IPEndPoint> nameservers = { CreateExpected("192.168.0.1", 92)}; overrides.nameservers = nameservers; + overrides.dns_over_tls_active = true; + const std::string dns_over_tls_hostname = "dns.example.com"; + overrides.dns_over_tls_hostname = dns_over_tls_hostname; const std::vector<std::string> search = {"str"}; overrides.search = search; overrides.append_to_multi_label_name = false; @@ -8053,6 +8056,8 @@ const DnsConfig* overridden_config = client_ptr->GetEffectiveConfig(); ASSERT_TRUE(overridden_config); EXPECT_EQ(nameservers, overridden_config->nameservers); + EXPECT_TRUE(overridden_config->dns_over_tls_active); + EXPECT_EQ(dns_over_tls_hostname, overridden_config->dns_over_tls_hostname); EXPECT_EQ(search, overridden_config->search); EXPECT_FALSE(overridden_config->append_to_multi_label_name); EXPECT_EQ(ndots, overridden_config->ndots);
diff --git a/net/dns/public/dns_config_overrides.cc b/net/dns/public/dns_config_overrides.cc index 1957c66..242bade 100644 --- a/net/dns/public/dns_config_overrides.cc +++ b/net/dns/public/dns_config_overrides.cc
@@ -24,7 +24,10 @@ default; bool DnsConfigOverrides::operator==(const DnsConfigOverrides& other) const { - return nameservers == other.nameservers && search == other.search && + return nameservers == other.nameservers && + dns_over_tls_active == other.dns_over_tls_active && + dns_over_tls_hostname == other.dns_over_tls_hostname && + search == other.search && append_to_multi_label_name == other.append_to_multi_label_name && ndots == other.ndots && fallback_period == other.fallback_period && attempts == other.attempts && doh_attempts == other.doh_attempts && @@ -46,6 +49,8 @@ DnsConfigOverrides overrides; overrides.nameservers = defaults.nameservers; + overrides.dns_over_tls_active = defaults.dns_over_tls_active; + overrides.dns_over_tls_hostname = defaults.dns_over_tls_hostname; overrides.search = defaults.search; overrides.append_to_multi_label_name = defaults.append_to_multi_label_name; overrides.ndots = defaults.ndots; @@ -64,9 +69,10 @@ } bool DnsConfigOverrides::OverridesEverything() const { - return nameservers && search && append_to_multi_label_name && ndots && - fallback_period && attempts && doh_attempts && rotate && - use_local_ipv6 && dns_over_https_config && secure_dns_mode && + return nameservers && dns_over_tls_active && dns_over_tls_hostname && + search && append_to_multi_label_name && ndots && fallback_period && + attempts && doh_attempts && rotate && use_local_ipv6 && + dns_over_https_config && secure_dns_mode && allow_dns_over_https_upgrade && clear_hosts; } @@ -78,6 +84,10 @@ if (nameservers) overridden.nameservers = nameservers.value(); + if (dns_over_tls_active) + overridden.dns_over_tls_active = dns_over_tls_active.value(); + if (dns_over_tls_hostname) + overridden.dns_over_tls_hostname = dns_over_tls_hostname.value(); if (search) overridden.search = search.value(); if (append_to_multi_label_name)
diff --git a/net/dns/public/dns_config_overrides.h b/net/dns/public/dns_config_overrides.h index 2770a8d..023eff2 100644 --- a/net/dns/public/dns_config_overrides.h +++ b/net/dns/public/dns_config_overrides.h
@@ -48,6 +48,8 @@ // Overriding values. See same-named fields in DnsConfig for explanations. absl::optional<std::vector<IPEndPoint>> nameservers; + absl::optional<bool> dns_over_tls_active; + absl::optional<std::string> dns_over_tls_hostname; absl::optional<std::vector<std::string>> search; absl::optional<bool> append_to_multi_label_name; absl::optional<int> ndots;
diff --git a/remoting/ios/DEPS b/remoting/ios/DEPS index 1ef6988..3b6691ff 100644 --- a/remoting/ios/DEPS +++ b/remoting/ios/DEPS
@@ -15,5 +15,4 @@ "+third_party/ocmock", "+third_party/protobuf/src", "+services/network/public/cpp", - "+ui/display", ]
diff --git a/remoting/ios/facade/BUILD.gn b/remoting/ios/facade/BUILD.gn index 1ed965e..9ae2b2b 100644 --- a/remoting/ios/facade/BUILD.gn +++ b/remoting/ios/facade/BUILD.gn
@@ -56,7 +56,6 @@ "//testing/gtest", "//third_party/ocmock", "//ui/base", - "//ui/display", ] configs += [ "//build/config/compiler:enable_arc" ]
diff --git a/remoting/ios/facade/host_list_service_unittest.mm b/remoting/ios/facade/host_list_service_unittest.mm index e0412c93..d8304324 100644 --- a/remoting/ios/facade/host_list_service_unittest.mm +++ b/remoting/ios/facade/host_list_service_unittest.mm
@@ -29,7 +29,6 @@ #include "testing/platform_test.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/display/screen.h" #define EXPECT_HOST_LIST_STATE(expected) \ EXPECT_EQ(expected, host_list_service_.state()) @@ -84,7 +83,6 @@ private: base::CallbackListSubscription host_list_state_subscription_; base::CallbackListSubscription fetch_failure_subscription_; - display::ScopedNativeScreen screen_; }; HostListServiceTest::HostListServiceTest()
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index c293a25..2e6ee882 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -8240,15 +8240,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -8359,7 +8359,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -8750,15 +8750,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/AOSP_SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/AOSP_SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -8869,7 +8869,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index 9af9dce..66b8922 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -46214,15 +46214,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -46333,7 +46333,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -46724,15 +46724,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/AOSP_SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/AOSP_SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -46843,7 +46843,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -47238,15 +47238,15 @@ { "args": [ "--additional-apk=apks/ChromePublic.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -47357,7 +47357,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -47748,15 +47748,15 @@ { "args": [ "--additional-apk=apks/ChromePublic.apk", - "--webview-apk-path=apks/AOSP_SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/AOSP_SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -47867,7 +47867,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -48330,15 +48330,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -48449,7 +48449,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -48840,15 +48840,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -48959,7 +48959,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -49422,15 +49422,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -49541,7 +49541,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -49932,15 +49932,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -50051,7 +50051,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M103", - "revision": "version:103.0.5060.13" + "revision": "version:103.0.5060.15" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 0178f8fee..d8c0f63c 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -5865,21 +5865,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5072.0", + "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -5892,7 +5892,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "isolate_profile_data": true, @@ -6030,21 +6030,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 104.0.5072.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -6056,7 +6056,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "args": [ @@ -6176,21 +6176,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 104.0.5072.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -6202,7 +6202,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "isolate_profile_data": true,
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index ac23e5e6..dc1d551 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -8959,6 +8959,28 @@ } ] }, + "Win x64 Builder (py2 less)": { + "additional_compile_targets": [ + "pdf_fuzzers" + ], + "scripts": [ + { + "name": "check_network_annotations", + "script": "check_network_annotations.py", + "swarming": {} + }, + { + "name": "metrics_python_tests", + "script": "metrics_python_tests.py", + "swarming": {} + }, + { + "name": "webkit_lint", + "script": "blink_lint_expectations.py", + "swarming": {} + } + ] + }, "Win x64 Builder (reclient compare)": { "additional_compile_targets": [ "pdf_fuzzers" @@ -87924,21 +87946,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5072.0", + "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", @@ -87946,7 +87968,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "isolate_profile_data": true, @@ -88059,28 +88081,28 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 104.0.5072.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "args": [ @@ -88180,28 +88202,28 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 104.0.5072.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "isolate_profile_data": true, @@ -89539,20 +89561,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5072.0", + "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -89566,7 +89588,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "merge": { @@ -89704,20 +89726,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 104.0.5072.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -89730,7 +89752,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "args": [ @@ -89850,20 +89872,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 104.0.5072.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -89876,7 +89898,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "merge": { @@ -91372,20 +91394,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5072.0", + "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -91399,7 +91421,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "merge": { @@ -91537,20 +91559,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 104.0.5072.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -91563,7 +91585,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "args": [ @@ -91683,20 +91705,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 104.0.5072.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -91709,7 +91731,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" }, { "merge": { @@ -92444,20 +92466,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5072.0", + "name": "interactive_ui_tests Lacros version skew testing ash 104.0.5073.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v104.0.5072.0", - "revision": "version:104.0.5072.0" + "location": "lacros_version_skew_tests_v104.0.5073.0", + "revision": "version:104.0.5073.0" } ], "dimension_sets": [ @@ -92470,7 +92492,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 104.0.5072.0" + "variant_id": "Lacros version skew testing ash 104.0.5073.0" } ] },
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index 8218057..7394849 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -22,15 +22,15 @@ }, 'LACROS_VERSION_SKEW_CANARY': { 'args': [ - '--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5072.0/test_ash_chrome', + '--ash-chrome-path-override=../../lacros_version_skew_tests_v104.0.5073.0/test_ash_chrome', ], - 'identifier': 'Lacros version skew testing ash 104.0.5072.0', + 'identifier': 'Lacros version skew testing ash 104.0.5073.0', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/linux-ash-chromium/x86_64/ash.zip', - 'location': 'lacros_version_skew_tests_v104.0.5072.0', - 'revision': 'version:104.0.5072.0', + 'location': 'lacros_version_skew_tests_v104.0.5073.0', + 'revision': 'version:104.0.5073.0', }, ], }, @@ -479,23 +479,23 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M103', - 'revision': 'version:103.0.5060.13' + 'revision': 'version:103.0.5060.15' } ] } }, 'WEBLAYER_10_AND_M_IMPL_SKEW_TESTS_NTH_MINUS_ONE_MILESTONE': { 'args': [ - '--webview-apk-path=apks/AOSP_SystemWebView.apk', '--test-runner-outdir', '.', '--client-outdir', '.', - '--implementation-outdir', - '../../weblayer_instrumentation_test_M102/out/Release', '--test-expectations', '../../weblayer/browser/android/javatests/skew/expectations.txt', - '--impl-version=102', + '--webview-apk-path=apks/AOSP_SystemWebView.apk', + '--implementation-outdir', + '../../weblayer_instrumentation_test_M102/out/Release', + '--impl-version=102' ], 'identifier': 'with_impl_from_102', 'swarming': { @@ -503,10 +503,10 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M102', - 'revision': 'version:102.0.5005.68', + 'revision': 'version:102.0.5005.68' } - ], - }, + ] + } }, 'WEBLAYER_10_AND_M_IMPL_SKEW_TESTS_NTH_MINUS_TWO_MILESTONE': { 'args': [ @@ -623,23 +623,23 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M103', - 'revision': 'version:103.0.5060.13' + 'revision': 'version:103.0.5060.15' } ] } }, 'WEBLAYER_IMPL_SKEW_TESTS_NTH_MINUS_ONE_MILESTONE': { 'args': [ - '--webview-apk-path=apks/SystemWebView.apk', '--test-runner-outdir', '.', '--client-outdir', '.', - '--implementation-outdir', - '../../weblayer_instrumentation_test_M102/out/Release', '--test-expectations', '../../weblayer/browser/android/javatests/skew/expectations.txt', - '--impl-version=102', + '--webview-apk-path=apks/SystemWebView.apk', + '--implementation-outdir', + '../../weblayer_instrumentation_test_M102/out/Release', + '--impl-version=102' ], 'identifier': 'with_impl_from_102', 'swarming': { @@ -647,10 +647,10 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M102', - 'revision': 'version:102.0.5005.68', + 'revision': 'version:102.0.5005.68' } - ], - }, + ] + } }, 'WEBLAYER_IMPL_SKEW_TESTS_NTH_MINUS_TWO_MILESTONE': { 'args': [ @@ -767,23 +767,23 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M103', - 'revision': 'version:103.0.5060.13' + 'revision': 'version:103.0.5060.15' } ] } }, 'WEBLAYER_CLIENT_SKEW_TESTS_NTH_MINUS_ONE_MILESTONE': { 'args': [ - '--webview-apk-path=apks/SystemWebView.apk', '--test-runner-outdir', '.', - '--client-outdir', - '../../weblayer_instrumentation_test_M102/out/Release', '--implementation-outdir', '.', '--test-expectations', '../../weblayer/browser/android/javatests/skew/expectations.txt', - '--client-version=102', + '--webview-apk-path=apks/SystemWebView.apk', + '--client-outdir', + '../../weblayer_instrumentation_test_M102/out/Release', + '--client-version=102' ], 'identifier': 'with_client_from_102', 'swarming': { @@ -791,10 +791,10 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M102', - 'revision': 'version:102.0.5005.68', + 'revision': 'version:102.0.5005.68' } - ], - }, + ] + } }, 'WEBLAYER_CLIENT_SKEW_TESTS_NTH_MINUS_TWO_MILESTONE': { 'args': [
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index c66301e..cc845bbe 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -2892,6 +2892,16 @@ }, 'use_swarming': False, }, + 'Win x64 Builder (py2 less)': { + # Copied from + # https://source.chromium.org/chromium/chromium/src/+/main:testing/buildbot/waterfalls.pyl;l=6248;drc=e40c45d7cb85fa476e0946b56a0fdcbb7d764134 + 'additional_compile_targets': [ + 'pdf_fuzzers' + ], + 'test_suites': { + 'scripts': 'chromium_win_scripts', + }, + }, 'Win x64 Builder (reclient compare)': { # Copied from # https://source.chromium.org/chromium/chromium/src/+/7b147a6777cb32d6a12e1716c61a0ed50dc1229a:testing/buildbot/waterfalls.pyl;l=6023-6030
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 8d4a88f..be298c6 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -1380,6 +1380,17 @@ ], "experiments": [ { + "name": "Enabled_All_20220418", + "params": { + "allowed_websites": "https://www.youtube.com|/embed,https://www.google.com|/maps/embed" + }, + "enable_features": [ + "AutomaticLazyFrameLoadingToAds", + "AutomaticLazyFrameLoadingToEmbedUrls", + "AutomaticLazyFrameLoadingToEmbeds" + ] + }, + { "name": "Enabled_LazyEmbeds_20220418", "params": { "allowed_websites": "https://www.youtube.com|/embed,https://www.google.com|/maps/embed" @@ -1391,6 +1402,29 @@ "disable_features": [ "AutomaticLazyFrameLoadingToAds" ] + }, + { + "name": "Enabled_LazyAds_20220418", + "enable_features": [ + "AutomaticLazyFrameLoadingToAds" + ], + "disable_features": [ + "AutomaticLazyFrameLoadingToEmbedUrls", + "AutomaticLazyFrameLoadingToEmbeds" + ] + }, + { + "name": "Control_20220418", + "params": { + "allowed_websites": "https://www.youtube.com|/embed,https://www.google.com|/maps/embed" + }, + "enable_features": [ + "AutomaticLazyFrameLoadingToEmbedUrls" + ], + "disable_features": [ + "AutomaticLazyFrameLoadingToAds", + "AutomaticLazyFrameLoadingToEmbeds" + ] } ] } @@ -3225,6 +3259,21 @@ ] } ], + "DownloadCalendarFile": [ + { + "platforms": [ + "ios" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "DownloadCalendar" + ] + } + ] + } + ], "DownloadLater": [ { "platforms": [ @@ -5778,6 +5827,22 @@ ] } ], + "PartitionAllocSortActiveSlotSpans": [ + { + "platforms": [ + "android", + "linux" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "PartitionAllocSortActiveSlotSpans" + ] + } + ] + } + ], "PartitionNetworkStateByDoubleKey": [ { "platforms": [ @@ -8714,12 +8779,7 @@ ], "experiments": [ { - "name": "Enabled,max_queue_time:75ms,_V4", - "enable_features": [ - "ThreadWrapperUsesMetronome", - "WebRtcMetronomeTaskQueue", - "WebRtcTimerUsesMetronome" - ] + "name": "Enabled,max_queue_time:75ms,_V2" } ] } @@ -8777,6 +8837,29 @@ ] } ], + "WebRtcMetronomeTaskQueue": [ + { + "platforms": [ + "android", + "android_webview", + "chromeos", + "chromeos_lacros", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "ThreadWrapperUsesMetronome", + "WebRtcMetronomeTaskQueue", + "WebRtcTimerUsesMetronome" + ] + } + ] + } + ], "WebUIBrandingUpdate": [ { "platforms": [
diff --git a/third_party/blink/public/common/privacy_budget/identifiable_surface.h b/third_party/blink/public/common/privacy_budget/identifiable_surface.h index 7236ed4..a1eacf9 100644 --- a/third_party/blink/public/common/privacy_budget/identifiable_surface.h +++ b/third_party/blink/public/common/privacy_budget/identifiable_surface.h
@@ -307,7 +307,7 @@ kVerticalViewportSegments = 24, kAspectRatioNormalized = 25, // We can use enum values up to and including 63, see static_assert below. - kMax = kVerticalViewportSegments + kMax = kAspectRatioNormalized }; static_assert(static_cast<int>(MediaFeatureName::kMax) < 64, "MediaFeatureName only allows values < 64 since we use it in "
diff --git a/third_party/blink/public/mojom/picture_in_picture/picture_in_picture.mojom b/third_party/blink/public/mojom/picture_in_picture/picture_in_picture.mojom index b4f017d4..bd2ed19 100644 --- a/third_party/blink/public/mojom/picture_in_picture/picture_in_picture.mojom +++ b/third_party/blink/public/mojom/picture_in_picture/picture_in_picture.mojom
@@ -59,6 +59,10 @@ // show_play_pause_button: Whether a play/pause control should be offered in // the Picture-in-Picture window. // observer: Observer to be associated with the session. + // source_bounds: Rectangle in the main frame's coordinate space where the + // video is displayed in physical pixels. This does not need + // to be exact; it will only be used to help the visual + // transition into picture in picture. // // TODO: Now that we are passing |player_remote|, it should be possible to get // rid of |player_id| once the few remaining uses of it in the browser process @@ -69,6 +73,7 @@ viz.mojom.SurfaceId surface_id, gfx.mojom.Size natural_size, bool show_play_pause_button, - pending_remote<PictureInPictureSessionObserver> observer) + pending_remote<PictureInPictureSessionObserver> observer, + gfx.mojom.Rect source_bounds) => (pending_remote<PictureInPictureSession>? session, gfx.mojom.Size size); };
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/html_frame_owner_element.cc index 71bae267..85a799e7 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -62,6 +62,7 @@ #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/network/network_state_notifier.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" +#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" namespace blink { @@ -276,6 +277,27 @@ return false; } +// If kAutomaticLazyFrameLoadingToAds is enabled, calculate the timeout in +// advance from the field trial param, otherwilse return 0; +base::TimeDelta GetLazyAdsTimeoutMs() { + const base::TimeDelta defaultTimeout = base::Milliseconds(0); + if (!base::FeatureList::IsEnabled(features::kAutomaticLazyFrameLoadingToAds)) + return defaultTimeout; + + const String timeout = + base::GetFieldTrialParamValueByFeature( + features::kAutomaticLazyFrameLoadingToAds, "timeout") + .c_str(); + if (timeout.IsEmpty()) + return defaultTimeout; + + bool success; + const int timeoutMs = timeout.ToInt(&success); + DCHECK(success); + + return base::Milliseconds(timeoutMs); +} + } // namespace SubframeLoadingDisabler::SubtreeRootSet& @@ -305,7 +327,8 @@ content_frame_(nullptr), embedded_content_view_(nullptr), should_lazy_load_children_(DoesParentAllowLazyLoadingChildren(document)), - is_swapping_frames_(false) {} + is_swapping_frames_(false), + lazy_ads_timeout_ms_(GetLazyAdsTimeoutMs()) {} LayoutEmbeddedContent* HTMLFrameOwnerElement::GetLayoutEmbeddedContent() const { // HTMLObjectElement and HTMLEmbedElement may return arbitrary layoutObjects @@ -642,6 +665,10 @@ /*record_uma=*/true)) { lazy_load_frame_observer_->DeferLoadUntilNearViewport(request, frame_load_type); + if (IsAdRelated()) { + SetTimeoutToStartAdFrameLoading(); + } + return true; } return false; @@ -838,6 +865,26 @@ return content_frame_->IsAdSubframe(); } +void HTMLFrameOwnerElement::LoadIfLazyOnIdle(base::TimeTicks deadline) { + LoadImmediatelyIfLazy(); +} + +void HTMLFrameOwnerElement::SetTimeoutToStartAdFrameLoading() { + if (!IsAdRelated() || !base::FeatureList::IsEnabled( + features::kAutomaticLazyFrameLoadingToAds)) { + return; + } + + // TODO(sisidovski) FrameScheduler should have the attribution of this task, + // but FrameScheduler doesn't expose + // SingleThreadIdleTaskRunner::PostIdleTask. So we call PostIdleTask here + // through the main thread scheduler. + ThreadScheduler::Current()->PostDelayedIdleTask( + FROM_HERE, lazy_ads_timeout_ms_, + WTF::Bind(&HTMLFrameOwnerElement::LoadIfLazyOnIdle, + WrapWeakPersistent(this))); +} + mojom::blink::ColorScheme HTMLFrameOwnerElement::GetColorScheme() const { if (const auto* style = GetComputedStyle()) return style->UsedColorScheme();
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.h b/third_party/blink/renderer/core/html/html_frame_owner_element.h index ad4e5a3..a3cfd32 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.h +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.h
@@ -199,6 +199,11 @@ is_swapping_frames_ = is_swapping; } + void SetTimeoutToStartAdFrameLoading(); + // This function is used for the call back of idle task. + // Trigger loading if the frame is lazy-loaded but not started yet. + void LoadIfLazyOnIdle(base::TimeTicks deadline); + // Check if the frame should be lazy-loaded and apply when conditions are // passed. Return true when lazy-load is applied. bool LazyLoadIfPossible(const KURL&, @@ -216,6 +221,7 @@ Member<LazyLoadFrameObserver> lazy_load_frame_observer_; bool should_lazy_load_children_; bool is_swapping_frames_; + base::TimeDelta lazy_ads_timeout_ms_; }; class SubframeLoadingDisabler {
diff --git a/third_party/blink/renderer/core/html/media/video_wake_lock_test.cc b/third_party/blink/renderer/core/html/media/video_wake_lock_test.cc index 8713443..8f5a053 100644 --- a/third_party/blink/renderer/core/html/media/video_wake_lock_test.cc +++ b/third_party/blink/renderer/core/html/media/video_wake_lock_test.cc
@@ -74,6 +74,7 @@ const gfx::Size&, bool, mojo::PendingRemote<mojom::blink::PictureInPictureSessionObserver>, + const gfx::Rect&, StartSessionCallback callback) override { mojo::PendingRemote<mojom::blink::PictureInPictureSession> session_remote; session_ = std::make_unique<VideoWakeLockPictureInPictureSession>(
diff --git a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc index d4d3559..b0c5f50 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc
@@ -3455,6 +3455,10 @@ ax::mojom::blink::NameFrom last_used_name_from = ax::mojom::blink::NameFrom::kUninitialized; + // Ensure that if this node needs to invalidate its children (e.g. due to + // included in tree status change), that we do it now, rather than while + // traversing the children. + UpdateCachedAttributeValuesIfNeeded(); #if defined(AX_FAIL_FAST_BUILD) base::AutoReset<bool> auto_reset(&is_computing_text_from_descendants_, true); #endif
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reader.cc b/third_party/blink/renderer/modules/nfc/ndef_reader.cc index 4d947602..6f23c307 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_reader.cc +++ b/third_party/blink/renderer/modules/nfc/ndef_reader.cc
@@ -76,14 +76,66 @@ constexpr char kChildFrameErrorMessage[] = "Web NFC can only be accessed in a top-level browsing context."; -constexpr char kScanAbortMessage[] = "The NFC scan operation was cancelled."; - -constexpr char kWriteAbortMessage[] = "The NFC write operation was cancelled."; - -constexpr char kMakeReadOnlyAbortMessage[] = - "The NFC make read-only operation was cancelled."; } // namespace +class NDEFReader::ReadAbortAlgorithm final : public AbortSignal::Algorithm { + public: + ReadAbortAlgorithm(NDEFReader* ndef_reader, AbortSignal* signal) + : ndef_reader_(ndef_reader), abort_signal_(signal) {} + ~ReadAbortAlgorithm() override = default; + + void Run() override { ndef_reader_->ReadAbort(abort_signal_); } + + void Trace(Visitor* visitor) const override { + visitor->Trace(ndef_reader_); + visitor->Trace(abort_signal_); + Algorithm::Trace(visitor); + } + + private: + Member<NDEFReader> ndef_reader_; + Member<AbortSignal> abort_signal_; +}; + +class NDEFReader::WriteAbortAlgorithm final : public AbortSignal::Algorithm { + public: + WriteAbortAlgorithm(NDEFReader* ndef_reader, AbortSignal* signal) + : ndef_reader_(ndef_reader), abort_signal_(signal) {} + ~WriteAbortAlgorithm() override = default; + + void Run() override { ndef_reader_->WriteAbort(abort_signal_); } + + void Trace(Visitor* visitor) const override { + visitor->Trace(ndef_reader_); + visitor->Trace(abort_signal_); + Algorithm::Trace(visitor); + } + + private: + Member<NDEFReader> ndef_reader_; + Member<AbortSignal> abort_signal_; +}; + +class NDEFReader::MakeReadOnlyAbortAlgorithm final + : public AbortSignal::Algorithm { + public: + MakeReadOnlyAbortAlgorithm(NDEFReader* ndef_reader, AbortSignal* signal) + : ndef_reader_(ndef_reader), abort_signal_(signal) {} + ~MakeReadOnlyAbortAlgorithm() override = default; + + void Run() override { ndef_reader_->MakeReadOnlyAbort(abort_signal_); } + + void Trace(Visitor* visitor) const override { + visitor->Trace(ndef_reader_); + visitor->Trace(abort_signal_); + Algorithm::Trace(visitor); + } + + private: + Member<NDEFReader> ndef_reader_; + Member<AbortSignal> abort_signal_; +}; + // static NDEFReader* NDEFReader::Create(ExecutionContext* context) { context->GetScheduler()->RegisterStickyFeature( @@ -126,12 +178,14 @@ return ScriptPromise(); } - // 7. If reader.[[Signal]]'s aborted flag is set, then reject p with a - // "AbortError" DOMException and return p. - if (options->hasSignal() && options->signal()->aborted()) { - exception_state.ThrowDOMException(DOMExceptionCode::kAbortError, - kScanAbortMessage); - return ScriptPromise(); + scan_signal_ = options->getSignalOr(nullptr); + if (scan_signal_) { + if (scan_signal_->aborted()) { + return ScriptPromise::Reject(script_state, + scan_signal_->reason(script_state)); + } + scan_signal_->AddAlgorithm( + MakeGarbageCollected<ReadAbortAlgorithm>(this, scan_signal_)); } // Reject promise when there's already an ongoing scan. @@ -173,19 +227,7 @@ return; } - scan_signal_ = options->getSignalOr(nullptr); - if (scan_signal_) { - if (scan_signal_->aborted()) { - scan_resolver_->Reject(V8ThrowDOMException::CreateOrDie( - script_state->GetIsolate(), DOMExceptionCode::kAbortError, - kScanAbortMessage)); - scan_resolver_.Clear(); - return; - } - scan_signal_->AddAlgorithm( - WTF::Bind(&NDEFReader::ReadAbort, WrapWeakPersistent(this), - WrapWeakPersistent(scan_signal_.Get()))); - } + DCHECK(!scan_signal_ || !scan_signal_->aborted()); GetNfcProxy()->StartReading( this, @@ -260,9 +302,7 @@ ScriptState::Scope script_state_scope(script_state); - scan_resolver_->Reject(V8ThrowDOMException::CreateOrDie( - script_state->GetIsolate(), DOMExceptionCode::kAbortError, - kScanAbortMessage)); + scan_resolver_->Reject(scan_signal_->reason(script_state)); scan_resolver_.Clear(); } @@ -280,12 +320,14 @@ return ScriptPromise(); } - if (options->hasSignal() && options->signal()->aborted()) { - // If signal’s aborted flag is set, then reject p with an "AbortError" - // DOMException and return p. - exception_state.ThrowDOMException(DOMExceptionCode::kAbortError, - kWriteAbortMessage); - return ScriptPromise(); + write_signal_ = options->getSignalOr(nullptr); + if (write_signal_) { + if (write_signal_->aborted()) { + return ScriptPromise::Reject(script_state, + write_signal_->reason(script_state)); + } + write_signal_->AddAlgorithm( + MakeGarbageCollected<WriteAbortAlgorithm>(this, write_signal_)); } // Step 11.2: Run "create NDEF message", if this throws an exception, @@ -339,21 +381,14 @@ return; } - write_signal_ = options->getSignalOr(nullptr); - if (write_signal_) { - if (write_signal_->aborted()) { - resolver->Reject(V8ThrowDOMException::CreateOrDie( - script_state->GetIsolate(), DOMExceptionCode::kAbortError, - kWriteAbortMessage)); - return; - } - write_signal_->AddAlgorithm( - WTF::Bind(&NDEFReader::WriteAbort, WrapWeakPersistent(this), - WrapWeakPersistent(write_signal_.Get()))); + if (write_signal_ && write_signal_->aborted()) { + resolver->Reject(write_signal_->reason(script_state)); + return; } - auto callback = WTF::Bind(&NDEFReader::WriteOnRequestCompleted, - WrapPersistent(this), WrapPersistent(resolver)); + auto callback = + WTF::Bind(&NDEFReader::WriteOnRequestCompleted, WrapPersistent(this), + WrapPersistent(resolver), WrapPersistent(write_signal_.Get())); GetNfcProxy()->Push(std::move(message), device::mojom::blink::NDEFWriteOptions::From(options), std::move(callback)); @@ -361,6 +396,7 @@ void NDEFReader::WriteOnRequestCompleted( ScriptPromiseResolver* resolver, + AbortSignal* signal, device::mojom::blink::NDEFErrorPtr error) { DCHECK(write_requests_.Contains(resolver)); @@ -377,6 +413,8 @@ if (error.is_null()) { resolver->Resolve(); + } else if (signal && signal->aborted()) { + resolver->Reject(signal->reason(script_state)); } else { resolver->Reject(NDEFErrorPtrToDOMException(script_state->GetIsolate(), std::move(error))); @@ -405,6 +443,17 @@ return ScriptPromise(); } + make_read_only_signal_ = options->getSignalOr(nullptr); + if (make_read_only_signal_) { + if (make_read_only_signal_->aborted()) { + return ScriptPromise::Reject( + script_state, make_read_only_signal_->reason(script_state)); + } + make_read_only_signal_->AddAlgorithm( + MakeGarbageCollected<MakeReadOnlyAbortAlgorithm>( + this, make_read_only_signal_)); + } + auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); make_read_only_requests_.insert(resolver); @@ -444,26 +493,20 @@ return; } - make_read_only_signal_ = options->getSignalOr(nullptr); - if (make_read_only_signal_) { - if (make_read_only_signal_->aborted()) { - resolver->Reject(V8ThrowDOMException::CreateOrDie( - script_state->GetIsolate(), DOMExceptionCode::kAbortError, - kMakeReadOnlyAbortMessage)); - return; - } - make_read_only_signal_->AddAlgorithm( - WTF::Bind(&NDEFReader::MakeReadOnlyAbort, WrapWeakPersistent(this), - WrapWeakPersistent(make_read_only_signal_.Get()))); + if (make_read_only_signal_ && make_read_only_signal_->aborted()) { + resolver->Reject(make_read_only_signal_->reason(script_state)); + return; } auto callback = WTF::Bind(&NDEFReader::MakeReadOnlyOnRequestCompleted, - WrapPersistent(this), WrapPersistent(resolver)); + WrapPersistent(this), WrapPersistent(resolver), + WrapPersistent(make_read_only_signal_.Get())); GetNfcProxy()->MakeReadOnly(std::move(callback)); } void NDEFReader::MakeReadOnlyOnRequestCompleted( ScriptPromiseResolver* resolver, + AbortSignal* signal, device::mojom::blink::NDEFErrorPtr error) { DCHECK(make_read_only_requests_.Contains(resolver)); @@ -480,6 +523,8 @@ if (error.is_null()) { resolver->Resolve(); + } else if (signal && signal->aborted()) { + resolver->Reject(signal->reason(script_state)); } else { resolver->Reject(NDEFErrorPtrToDOMException(script_state->GetIsolate(), std::move(error)));
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reader.h b/third_party/blink/renderer/modules/nfc/ndef_reader.h index 39380e47..fe940480 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_reader.h +++ b/third_party/blink/renderer/modules/nfc/ndef_reader.h
@@ -77,6 +77,10 @@ void MakeReadOnlyOnMojoConnectionError(); private: + class ReadAbortAlgorithm; + class WriteAbortAlgorithm; + class MakeReadOnlyAbortAlgorithm; + // ExecutionContextLifecycleObserver overrides. void ContextDestroyed() override; @@ -87,10 +91,12 @@ void WriteAbort(AbortSignal* signal); void WriteOnRequestCompleted(ScriptPromiseResolver* resolver, + AbortSignal* signal, device::mojom::blink::NDEFErrorPtr error); void MakeReadOnlyAbort(AbortSignal* signal); void MakeReadOnlyOnRequestCompleted(ScriptPromiseResolver* resolver, + AbortSignal* signal, device::mojom::blink::NDEFErrorPtr error); // Read Permission handling
diff --git a/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_impl.cc b/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_impl.cc index 45d81d1..5204c105 100644 --- a/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_impl.cc +++ b/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_impl.cc
@@ -163,6 +163,7 @@ video_element->GetWebMediaPlayer()->GetSurfaceId().value(), video_element->GetWebMediaPlayer()->NaturalSize(), ShouldShowPlayPauseButton(*video_element), std::move(session_observer), + video_element->BoundsInViewport(), WTF::Bind(&PictureInPictureControllerImpl::OnEnteredPictureInPicture, WrapPersistent(this), WrapPersistent(video_element), WrapPersistent(resolver)));
diff --git a/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_test.cc b/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_test.cc index 0187a099..de17474 100644 --- a/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_test.cc +++ b/third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_test.cc
@@ -79,7 +79,7 @@ public: MockPictureInPictureService() { // Setup default implementations. - ON_CALL(*this, StartSession(_, _, _, _, _, _, _)) + ON_CALL(*this, StartSession(_, _, _, _, _, _, _, _)) .WillByDefault(testing::Invoke( this, &MockPictureInPictureService::StartSessionInternal)); } @@ -107,6 +107,7 @@ const gfx::Size&, bool, mojo::PendingRemote<mojom::blink::PictureInPictureSessionObserver>, + const gfx::Rect&, StartSessionCallback)); MockPictureInPictureSession& Session() { return *session_.get(); } @@ -118,14 +119,19 @@ const gfx::Size&, bool, mojo::PendingRemote<mojom::blink::PictureInPictureSessionObserver>, + const gfx::Rect& source_bounds, StartSessionCallback callback) { + source_bounds_ = source_bounds; std::move(callback).Run(std::move(session_remote_), gfx::Size()); } + const gfx::Rect& source_bounds() const { return source_bounds_; } + private: mojo::Receiver<mojom::blink::PictureInPictureService> receiver_{this}; std::unique_ptr<MockPictureInPictureSession> session_; mojo::PendingRemote<mojom::blink::PictureInPictureSession> session_remote_; + gfx::Rect source_bounds_; }; class PictureInPictureControllerFrameClient @@ -266,7 +272,7 @@ WebMediaPlayer* player = Video()->GetWebMediaPlayer(); EXPECT_CALL(Service(), StartSession(player->GetDelegateId(), _, TestSurfaceId(), - player->NaturalSize(), true, _, _)); + player->NaturalSize(), true, _, _, _)); PictureInPictureControllerImpl::From(GetDocument()) .EnterPictureInPicture(Video(), /*promise=*/nullptr); @@ -305,7 +311,7 @@ WebMediaPlayer* player = Video()->GetWebMediaPlayer(); EXPECT_CALL(Service(), StartSession(player->GetDelegateId(), _, TestSurfaceId(), - player->NaturalSize(), true, _, _)); + player->NaturalSize(), true, _, _, _)); PictureInPictureControllerImpl::From(GetDocument()) .EnterPictureInPicture(Video(), /*promise=*/nullptr); @@ -332,7 +338,7 @@ WebMediaPlayer* player = Video()->GetWebMediaPlayer(); EXPECT_CALL(Service(), StartSession(player->GetDelegateId(), _, TestSurfaceId(), - player->NaturalSize(), true, _, _)); + player->NaturalSize(), true, _, _, _)); PictureInPictureControllerImpl::From(GetDocument()) .EnterPictureInPicture(Video(), /*promise=*/nullptr); @@ -351,7 +357,7 @@ WebMediaPlayer* player = Video()->GetWebMediaPlayer(); EXPECT_CALL(Service(), StartSession(player->GetDelegateId(), _, TestSurfaceId(), - player->NaturalSize(), true, _, _)); + player->NaturalSize(), true, _, _, _)); PictureInPictureControllerImpl::From(GetDocument()) .EnterPictureInPicture(Video(), /*promise=*/nullptr); @@ -379,7 +385,7 @@ WebMediaPlayer* player = Video()->GetWebMediaPlayer(); EXPECT_CALL(Service(), StartSession(player->GetDelegateId(), _, TestSurfaceId(), - player->NaturalSize(), false, _, _)); + player->NaturalSize(), false, _, _, _)); PictureInPictureControllerImpl::From(GetDocument()) .EnterPictureInPicture(Video(), /*promise=*/nullptr); @@ -398,7 +404,7 @@ WebMediaPlayer* player = Video()->GetWebMediaPlayer(); EXPECT_CALL(Service(), StartSession(player->GetDelegateId(), _, TestSurfaceId(), - player->NaturalSize(), false, _, _)); + player->NaturalSize(), false, _, _, _)); PictureInPictureControllerImpl::From(GetDocument()) .EnterPictureInPicture(Video(), /*promise=*/nullptr); @@ -450,4 +456,26 @@ dom_exception->code()); } +TEST_F(PictureInPictureControllerTest, + EnterPictureInPictureProvideSourceBounds) { + EXPECT_EQ(nullptr, PictureInPictureControllerImpl::From(GetDocument()) + .PictureInPictureElement()); + + WebMediaPlayer* player = Video()->GetWebMediaPlayer(); + EXPECT_CALL(Service(), + StartSession(player->GetDelegateId(), _, TestSurfaceId(), + player->NaturalSize(), true, _, _, _)); + + PictureInPictureControllerImpl::From(GetDocument()) + .EnterPictureInPicture(Video(), /*promise=*/nullptr); + + MakeGarbageCollected<WaitForEvent>(Video(), + event_type_names::kEnterpictureinpicture); + + // We expect that the video element has some nontrivial rect, else this won't + // really test anything. + ASSERT_NE(Video()->BoundsInViewport(), gfx::Rect()); + EXPECT_EQ(Service().source_bounds(), Video()->BoundsInViewport()); +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/fonts/font_platform_data.cc b/third_party/blink/renderer/platform/fonts/font_platform_data.cc index 856cd11..566db2e 100644 --- a/third_party/blink/renderer/platform/fonts/font_platform_data.cc +++ b/third_party/blink/renderer/platform/fonts/font_platform_data.cc
@@ -49,15 +49,6 @@ FontPlatformData::FontPlatformData() = default; -FontPlatformData::FontPlatformData(float size, - bool synthetic_bold, - bool synthetic_italic, - FontOrientation orientation) - : text_size_(size), - synthetic_bold_(synthetic_bold), - synthetic_italic_(synthetic_italic), - orientation_(orientation) {} - FontPlatformData::FontPlatformData(const FontPlatformData& source) : typeface_(source.typeface_), #if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_MAC)
diff --git a/third_party/blink/renderer/platform/fonts/font_platform_data.h b/third_party/blink/renderer/platform/fonts/font_platform_data.h index 4753763..5135777 100644 --- a/third_party/blink/renderer/platform/fonts/font_platform_data.h +++ b/third_party/blink/renderer/platform/fonts/font_platform_data.h
@@ -73,10 +73,6 @@ FontPlatformData(WTF::HashTableDeletedValueType); FontPlatformData(); FontPlatformData(const FontPlatformData&); - FontPlatformData(float size, - bool synthetic_bold, - bool synthetic_italic, - FontOrientation = FontOrientation::kHorizontal); FontPlatformData(const FontPlatformData& src, float text_size); FontPlatformData(const sk_sp<SkTypeface>, const std::string& name,
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng index 78fce2c..49ff2b5 100644 --- a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng +++ b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng
@@ -13,6 +13,7 @@ # Tests that fail in legacy but pass in NG # ====== New tests from wpt-importer added here ====== +crbug.com/626703 external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html [ Timeout ] crbug.com/626703 external/wpt/content-security-policy/wasm-unsafe-eval/postMessage-wasm-module.html [ Timeout ] crbug.com/626703 virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/postMessage-wasm-module.html [ Timeout ] crbug.com/626703 external/wpt/css/css-writing-modes/abs-pos-border-offset-001.html [ Failure ]
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials index 6858146..c09bb79 100644 --- a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials +++ b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials
@@ -44,6 +44,7 @@ crbug.com/1209223 external/wpt/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-security-check-same-origin-domain.sub.html [ Failure ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html [ Timeout ] crbug.com/626703 external/wpt/content-security-policy/wasm-unsafe-eval/postMessage-wasm-module.html [ Timeout ] crbug.com/626703 virtual/wasm-csp/external/wpt/content-security-policy/wasm-unsafe-eval/postMessage-wasm-module.html [ Timeout ] crbug.com/626703 external/wpt/fetch/metadata/generated/css-images.https.sub.tentative.html [ Timeout ]
diff --git a/third_party/blink/web_tests/SlowTests b/third_party/blink/web_tests/SlowTests index 8396d8a..b071bb20 100644 --- a/third_party/blink/web_tests/SlowTests +++ b/third_party/blink/web_tests/SlowTests
@@ -81,6 +81,13 @@ crbug.com/1236466 inspector-protocol/runtime/runtime-execution-contexts-events.js [ Slow ] crbug.com/1229701 http/tests/inspector-protocol/network/disable-cache-media-resource.js [ Slow ] crbug.com/1300409 [ Win ] http/tests/inspector-protocol/network/websocket/offline-no-send.js [ Slow ] +crbug.com/1280873 http/tests/inspector-protocol/network/xhr-cors-preflight-redirect-failure.js [ Slow ] +crbug.com/1280697 http/tests/inspector-protocol/network/block_cross_site_document_load.js [ Slow ] +crbug.com/1280585 http/tests/inspector-protocol/network/xhr-post-replay-cors.js [ Slow ] +crbug.com/1280537 http/tests/inspector-protocol/network/blocked-cookie-same-site-lax.js [ Slow ] +crbug.com/1279832 http/tests/inspector-protocol/network/cross-origin-isolation/coop-coep-get-security-isolation-info.js [ Slow ] +crbug.com/1277877 http/tests/inspector-protocol/network/blocked-cookie-same-site-strict.js [ Slow ] +crbug.com/1280736 http/tests/inspector-protocol/network/blocked-setcookie-same-site-strict.js [ Slow ] crbug.com/510337 cssom/cssvalue-comparison.html [ Slow ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 641a5d3..56d62299 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -3249,6 +3249,11 @@ crbug.com/626703 [ Win ] virtual/partitioned-cookies/http/tests/inspector-protocol/network/disabled-cache-navigation.js [ Failure ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 [ Linux ] external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html [ Timeout ] +crbug.com/626703 [ Mac10.15 ] external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html [ Timeout ] +crbug.com/626703 [ Mac11 ] external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html [ Timeout ] +crbug.com/626703 [ Mac11-arm64 ] external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html [ Timeout ] +crbug.com/626703 [ Win ] external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html [ Timeout ] crbug.com/626703 [ Linux ] external/wpt/content-security-policy/wasm-unsafe-eval/postMessage-wasm-module.html [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/content-security-policy/wasm-unsafe-eval/postMessage-wasm-module.html [ Timeout ] crbug.com/626703 [ Mac11 ] external/wpt/content-security-policy/wasm-unsafe-eval/postMessage-wasm-module.html [ Timeout ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index f38a7d8..299dfd5 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -1096,7 +1096,7 @@ "prefix": "automatic-lazy-frame-loading-ads", "platforms": ["Linux", "Mac", "Win"], "bases": [], - "args": ["--enable-features=AutomaticLazyFrameLoadingToAds"] + "args": ["--enable-features=AutomaticLazyFrameLoadingToAds:timeout/1000"] }, { "prefix": "initially-invisible-images-lcp",
diff --git a/third_party/blink/web_tests/external/Version b/third_party/blink/web_tests/external/Version index 9472ce5..e11ceb2 100644 --- a/third_party/blink/web_tests/external/Version +++ b/third_party/blink/web_tests/external/Version
@@ -1 +1 @@ -Version: 5f3c4872a168e983f9310845ce739ef8e356584f +Version: e889a60ee414688bf1554b8c4a2490ba37a10130
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 a42439d..bee0dddd 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
@@ -87022,6 +87022,45 @@ {} ] ], + "table-collapsed-borders-paint-htb-ltr.html": [ + "60e146296b226faf1914715aa837a86ac497ce25", + [ + null, + [ + [ + "/css/css-break/table/table-collapsed-borders-paint-htb-ltr-ref.html", + "==" + ] + ], + {} + ] + ], + "table-collapsed-borders-paint-vlr-rtl.html": [ + "d03968ec4d32b37bb86fc0d30c33f2d1afca399a", + [ + null, + [ + [ + "/css/css-break/table/table-collapsed-borders-paint-vlr-rtl-ref.html", + "==" + ] + ], + {} + ] + ], + "table-collapsed-borders-paint-vrl-ltr.html": [ + "6dff501fec734ff9dd75d725e1e1f014b93dd5b5", + [ + null, + [ + [ + "/css/css-break/table/table-collapsed-borders-paint-vrl-ltr-ref.html", + "==" + ] + ], + {} + ] + ], "table-row-paint-htb-ltr.html": [ "ecc156bd38bcc414b8d66abf84d355c040f0782d", [ @@ -161568,6 +161607,19 @@ {} ] ], + "border-collapse-dynamic-section.html": [ + "5f48749fa48f6594cea8947170f4b930bd567608", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square.xht", + "==" + ] + ], + {} + ] + ], "border-collapse-empty-cell.html": [ "18894a35a9c793755380d3a2ff1b34d88603af78", [ @@ -260626,6 +260678,18 @@ "0fde8bacc51d23a2065246727daf90fef8885f0c", [] ], + "table-collapsed-borders-paint-htb-ltr-ref.html": [ + "1841ff582124124a97bc49046abf9ab6f2377354", + [] + ], + "table-collapsed-borders-paint-vlr-rtl-ref.html": [ + "e17497a2702cc9acc4b43140a71bb271201294ab", + [] + ], + "table-collapsed-borders-paint-vrl-ltr-ref.html": [ + "2721bc0af0b11cddb17087d988990379cc48ebc5", + [] + ], "table-row-paint-htb-ltr-ref.html": [ "74e99b0143aa89b641b06297a282b2d46c868e06", [] @@ -298320,7 +298384,7 @@ [] ], "form-submission.sub.html": [ - "cbf7b5ca7f3eab3b75180a6e075c16a46055b98b", + "4c9c8c50f82ea4e36a1ab187d8b521fc338be621", [] ], "header-link.sub.html": [ @@ -396766,28 +396830,28 @@ ] ], "has-in-adjacent-position.html": [ - "d9dc9c7d3670a2d79ce4e77489a998d81c965534", + "5c1a1ecf78a86d77fec08f958cfbe652dccefca9", [ null, {} ] ], "has-in-ancestor-position.html": [ - "3d556d34dc7b665be1547a324a4cf3fe00ce2b36", + "7662fbde69efbeca48d0413a881782f303113613", [ null, {} ] ], "has-in-parent-position.html": [ - "0a1f8b9299f9f0bb6b1462736fb7a278efaec37c", + "4690e6929f5415e1b24f1f1507afd40c1dceb88c", [ null, {} ] ], "has-in-sibling-position.html": [ - "91b1dcf03970fb497eeb8bc6e7d37dc37d8934a3", + "8b35940f87c31e908fe4ebcd0c226fa82e173de3", [ null, {} @@ -427590,19 +427654,22 @@ ] ], "form-submission.https.sub.html": [ - "a0f683add1789e094c954a5a326749baef6e7ea3", + "988b07c74a948ffe037c9bdf221af9f5a69a7ff3", [ null, { - "testdriver": true + "testdriver": true, + "timeout": "long" } ] ], "form-submission.sub.html": [ - "c4a5e2fa7ba2089a1a7351dc52b009c4b68777f7", + "f862062aebcd3046d179551d349d0c08cc47638c", [ null, - {} + { + "timeout": "long" + } ] ], "header-link.https.sub.html": [ @@ -466295,7 +466362,7 @@ ] ], "image-loading-lazy-move-into-script-disabled-iframe.html": [ - "8e22c1fb549cab4852ce2b9c0ff312b0d029f1bc", + "10b644e22fd9b04f6eb2796a2f245f813df37721", [ null, {}
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-adjacent-position.html b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-adjacent-position.html index d9dc9c7..5c1a1ecf 100644 --- a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-adjacent-position.html +++ b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-adjacent-position.html
@@ -7,12 +7,18 @@ <link rel="help" href="https://drafts.csswg.org/selectors/#relational"> <style> div, main { color: grey } -div:has(.test, [test_attr]) + #subject { color: red } -div:has(> .test, > [test_attr]) + #subject { color: green } -div:has(~ .test, ~ [test_attr]) + #subject { color: yellow } -div:has(+ .test, + [test_attr]) + #subject { color: blue } -div:has(~ div .test, ~ div [test_attr]) + #subject { color: purple } -div:has(+ div .test, + div [test_attr]) + #subject { color: pink } +div:has(.test) + #subject { color: red } +div:has([test_attr]) + #subject { color: orangered } +div:has(> .test) + #subject { color: green } +div:has(> [test_attr]) + #subject { color: lightgreen } +div:has(~ .test) + #subject { color: yellow } +div:has(~ [test_attr]) + #subject { color: ivory } +div:has(+ .test) + #subject { color: blue } +div:has(+ [test_attr]) + #subject { color: skyblue } +div:has(~ div .test) + #subject { color: purple } +div:has(~ div [test_attr]) + #subject { color: violet } +div:has(+ div .test) + #subject { color: pink } +div:has(+ div [test_attr]) + #subject { color: lightpink } </style> <main id=main> @@ -32,11 +38,47 @@ <script> const grey = 'rgb(128, 128, 128)'; const red = 'rgb(255, 0, 0)'; +const orangered = 'rgb(255, 69, 0)'; const green = 'rgb(0, 128, 0)'; +const lightgreen = 'rgb(144, 238, 144)'; const blue = 'rgb(0, 0, 255)'; +const skyblue = 'rgb(135, 206, 235)'; const yellow = 'rgb(255, 255, 0)'; +const ivory = 'rgb(255, 255, 240)'; const purple = 'rgb(128, 0, 128)'; +const violet = 'rgb(238, 130, 238)'; const pink = 'rgb(255, 192, 203)'; +const lightpink = 'rgb(255, 182, 193)'; +const colors = { + grey: { + classTest: grey, + attributeTest: grey, + }, + red: { + classTest: red, + attributeTest: orangered, + }, + green: { + classTest: green, + attributeTest: lightgreen, + }, + blue: { + classTest: blue, + attributeTest: skyblue, + }, + yellow: { + classTest: yellow, + attributeTest: ivory, + }, + purple: { + classTest: purple, + attributeTest: violet, + }, + pink: { + classTest: pink, + attributeTest: lightpink, + }, +}; function testColor(test_name, color) { test(function() { @@ -44,27 +86,30 @@ }, test_name); } -function testClassChange(element, expectedColor) +function testClassChange(element, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; element.classList.add('test'); - testColor(`add .test to ${element.id}`, expectedColor); + testColor(`add .test to ${element.id}`, expectedColorForClassTest); element.classList.remove('test'); testColor(`remove .test from ${element.id}`, grey); } -function testElementInsertionBefore(beforeElement, expectedColor) +function testElementInsertionBefore(beforeElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); newElement.classList.add('test') beforeElement.before(newElement); - testColor(`insert element div.test before ${beforeElement.id}`, expectedColor); + testColor(`insert element div.test before ${beforeElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted before ${beforeElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' again to the element inserted before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element inserted before ${beforeElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove element div.test before ${beforeElement.id}`, grey); @@ -75,7 +120,7 @@ testColor(`insert element div before ${beforeElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' to the element inserted again before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' to the element inserted again before ${beforeElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted again before ${beforeElement.id}`, grey); @@ -86,25 +131,27 @@ newElement.setAttribute('test_attr', ''); beforeElement.before(newElement); - testColor(`insert element div[test_attr] before ${beforeElement.id}`, expectedColor); + testColor(`insert element div[test_attr] before ${beforeElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div[test_attr] before ${beforeElement.id}`, grey); } -function testElementInsertionAfter(afterElement, expectedColor) +function testElementInsertionAfter(afterElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); newElement.classList.add('test') afterElement.after(newElement); - testColor(`insert element div.test after ${afterElement.id}`, expectedColor); + testColor(`insert element div.test after ${afterElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted after ${afterElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' again to the element inserted after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element inserted after ${afterElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove element div.test after ${afterElement.id}`, grey); @@ -115,7 +162,7 @@ testColor(`insert element div after ${afterElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' to the element inserted again after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' to the element inserted again after ${afterElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted again after ${afterElement.id}`, grey); @@ -126,27 +173,29 @@ newElement.setAttribute('test_attr', ''); afterElement.after(newElement); - testColor(`insert element div[test_attr] after ${afterElement.id}`, expectedColor); + testColor(`insert element div[test_attr] after ${afterElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div[test_attr] after ${afterElement.id}`, grey); } -function testTreeInsertionBefore(beforeElement, expectedColor) +function testTreeInsertionBefore(beforeElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); const newChild = document.createElement('div'); newChild.classList.add('test'); newElement.appendChild(newChild); beforeElement.before(newElement); - testColor(`insert tree div>div.test before ${beforeElement.id}`, expectedColor); + testColor(`insert tree div>div.test before ${beforeElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted before ${beforeElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' again to the element in the tree inserted before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element in the tree inserted before ${beforeElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove tree div>div.test before ${beforeElement.id}`, grey); @@ -157,7 +206,7 @@ testColor(`insert tree div>div before ${beforeElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' to the element in the tree inserted again before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' to the element in the tree inserted again before ${beforeElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted again before ${beforeElement.id}`, grey); @@ -168,27 +217,29 @@ newChild.setAttribute('test_attr', ''); beforeElement.before(newElement); - testColor(`insert element div>div[test_attr] before ${beforeElement.id}`, expectedColor); + testColor(`insert element div>div[test_attr] before ${beforeElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div>div[test_attr] before ${beforeElement.id}`, grey); } -function testTreeInsertionAfter(afterElement, expectedColor) +function testTreeInsertionAfter(afterElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); const newChild = document.createElement('div'); newChild.classList.add('test'); newElement.appendChild(newChild); afterElement.after(newElement); - testColor(`insert tree div>div.test after ${afterElement.id}`, expectedColor); + testColor(`insert tree div>div.test after ${afterElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted after ${afterElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' again to the element in the tree inserted after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element in the tree inserted after ${afterElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove tree div>div.test after ${afterElement.id}`, grey); @@ -199,7 +250,7 @@ testColor(`insert tree div>div after ${afterElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' to the element in the tree inserted again after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' to the element in the tree inserted again after ${afterElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted again after ${afterElement.id}`, grey); @@ -210,7 +261,7 @@ newChild.setAttribute('test_attr', ''); afterElement.after(newElement); - testColor(`insert element div>div[test_attr] after ${afterElement.id}`, expectedColor); + testColor(`insert element div>div[test_attr] after ${afterElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div>div[test_attr] after ${afterElement.id}`, grey); @@ -218,44 +269,44 @@ testColor('Initial color', grey); -testClassChange(previous_sibling, grey); -testClassChange(previous_sibling_child, green); -testClassChange(previous_sibling_descendant, red); -testClassChange(subject, blue); -testClassChange(next_sibling, yellow); -testClassChange(next_sibling_child, purple); -testClassChange(next_sibling_descendant, purple); +testClassChange(previous_sibling, "grey"); +testClassChange(previous_sibling_child, "green"); +testClassChange(previous_sibling_descendant, "red"); +testClassChange(subject, "blue"); +testClassChange(next_sibling, "yellow"); +testClassChange(next_sibling_child, "purple"); +testClassChange(next_sibling_descendant, "purple"); -testElementInsertionBefore(previous_sibling, grey); -testElementInsertionBefore(previous_sibling_child, green); -testElementInsertionBefore(previous_sibling_descendant, red); -testElementInsertionBefore(subject, grey); -testElementInsertionBefore(next_sibling, yellow); -testElementInsertionBefore(next_sibling_child, purple); -testElementInsertionBefore(next_sibling_descendant, purple); +testElementInsertionBefore(previous_sibling, "grey"); +testElementInsertionBefore(previous_sibling_child, "green"); +testElementInsertionBefore(previous_sibling_descendant, "red"); +testElementInsertionBefore(subject, "grey"); +testElementInsertionBefore(next_sibling, "yellow"); +testElementInsertionBefore(next_sibling_child, "purple"); +testElementInsertionBefore(next_sibling_descendant, "purple"); -testElementInsertionAfter(previous_sibling, grey); -testElementInsertionAfter(previous_sibling_child, green); -testElementInsertionAfter(previous_sibling_descendant, red); -testElementInsertionAfter(subject, yellow); -testElementInsertionAfter(next_sibling, yellow); -testElementInsertionAfter(next_sibling_child, purple); -testElementInsertionAfter(next_sibling_descendant, purple); +testElementInsertionAfter(previous_sibling, "grey"); +testElementInsertionAfter(previous_sibling_child, "green"); +testElementInsertionAfter(previous_sibling_descendant, "red"); +testElementInsertionAfter(subject, "yellow"); +testElementInsertionAfter(next_sibling, "yellow"); +testElementInsertionAfter(next_sibling_child, "purple"); +testElementInsertionAfter(next_sibling_descendant, "purple"); -testTreeInsertionBefore(previous_sibling, grey); -testTreeInsertionBefore(previous_sibling_child, red); -testTreeInsertionBefore(previous_sibling_descendant, red); -testTreeInsertionBefore(subject, green); -testTreeInsertionBefore(next_sibling, purple); -testTreeInsertionBefore(next_sibling_child, purple); -testTreeInsertionBefore(next_sibling_descendant, purple); +testTreeInsertionBefore(previous_sibling, "grey"); +testTreeInsertionBefore(previous_sibling_child, "red"); +testTreeInsertionBefore(previous_sibling_descendant, "red"); +testTreeInsertionBefore(subject, "green"); +testTreeInsertionBefore(next_sibling, "purple"); +testTreeInsertionBefore(next_sibling_child, "purple"); +testTreeInsertionBefore(next_sibling_descendant, "purple"); -testTreeInsertionAfter(previous_sibling, green); -testTreeInsertionAfter(previous_sibling_child, red); -testTreeInsertionAfter(previous_sibling_descendant, red); -testTreeInsertionAfter(subject, purple); -testTreeInsertionAfter(next_sibling, purple); -testTreeInsertionAfter(next_sibling_child, purple); -testTreeInsertionAfter(next_sibling_descendant, purple); +testTreeInsertionAfter(previous_sibling, "green"); +testTreeInsertionAfter(previous_sibling_child, "red"); +testTreeInsertionAfter(previous_sibling_descendant, "red"); +testTreeInsertionAfter(subject, "purple"); +testTreeInsertionAfter(next_sibling, "purple"); +testTreeInsertionAfter(next_sibling_child, "purple"); +testTreeInsertionAfter(next_sibling_descendant, "purple"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-ancestor-position.html b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-ancestor-position.html index 3d556d34..7662fbde 100644 --- a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-ancestor-position.html +++ b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-ancestor-position.html
@@ -7,12 +7,18 @@ <link rel="help" href="https://drafts.csswg.org/selectors/#relational"> <style> div, main { color: grey } -div:has(.test, [test_attr]) #subject { color: red } -div:has(> .test, > [test_attr]) #subject { color: green } -div:has(~ .test, ~ [test_attr]) #subject { color: yellow } -div:has(+ .test, + [test_attr]) #subject { color: blue } -div:has(~ div .test, ~ div [test_attr]) #subject { color: purple } -div:has(+ div .test, + div [test_attr]) #subject { color: pink } +div:has(.test) #subject { color: red } +div:has([test_attr]) #subject { color: orangered } +div:has(> .test) #subject { color: green } +div:has(> [test_attr]) #subject { color: lightgreen } +div:has(~ .test) #subject { color: yellow } +div:has(~ [test_attr]) #subject { color: ivory } +div:has(+ .test) #subject { color: blue } +div:has(+ [test_attr]) #subject { color: skyblue } +div:has(~ div .test) #subject { color: purple } +div:has(~ div [test_attr]) #subject { color: violet } +div:has(+ div .test) #subject { color: pink } +div:has(+ div [test_attr]) #subject { color: lightpink } </style> <main id=main> @@ -35,11 +41,47 @@ <script> const grey = 'rgb(128, 128, 128)'; const red = 'rgb(255, 0, 0)'; +const orangered = 'rgb(255, 69, 0)'; const green = 'rgb(0, 128, 0)'; +const lightgreen = 'rgb(144, 238, 144)'; const blue = 'rgb(0, 0, 255)'; +const skyblue = 'rgb(135, 206, 235)'; const yellow = 'rgb(255, 255, 0)'; +const ivory = 'rgb(255, 255, 240)'; const purple = 'rgb(128, 0, 128)'; +const violet = 'rgb(238, 130, 238)'; const pink = 'rgb(255, 192, 203)'; +const lightpink = 'rgb(255, 182, 193)'; +const colors = { + grey: { + classTest: grey, + attributeTest: grey, + }, + red: { + classTest: red, + attributeTest: orangered, + }, + green: { + classTest: green, + attributeTest: lightgreen, + }, + blue: { + classTest: blue, + attributeTest: skyblue, + }, + yellow: { + classTest: yellow, + attributeTest: ivory, + }, + purple: { + classTest: purple, + attributeTest: violet, + }, + pink: { + classTest: pink, + attributeTest: lightpink, + }, +}; function testColor(test_name, color) { test(function() { @@ -47,27 +89,30 @@ }, test_name); } -function testClassChange(element, expectedColor) +function testClassChange(element, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; element.classList.add('test'); - testColor(`add .test to ${element.id}`, expectedColor); + testColor(`add .test to ${element.id}`, expectedColorForClassTest); element.classList.remove('test'); testColor(`remove .test from ${element.id}`, grey); } -function testElementInsertionBefore(beforeElement, expectedColor) +function testElementInsertionBefore(beforeElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); newElement.classList.add('test') beforeElement.before(newElement); - testColor(`insert element div.test before ${beforeElement.id}`, expectedColor); + testColor(`insert element div.test before ${beforeElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted before ${beforeElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' again to the element inserted before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element inserted before ${beforeElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove element div.test before ${beforeElement.id}`, grey); @@ -78,7 +123,7 @@ testColor(`insert element div before ${beforeElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' to the element inserted again before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' to the element inserted again before ${beforeElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted again before ${beforeElement.id}`, grey); @@ -89,25 +134,27 @@ newElement.setAttribute('test_attr', ''); beforeElement.before(newElement); - testColor(`insert element div[test_attr] before ${beforeElement.id}`, expectedColor); + testColor(`insert element div[test_attr] before ${beforeElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div[test_attr] before ${beforeElement.id}`, grey); } -function testElementInsertionAfter(afterElement, expectedColor) +function testElementInsertionAfter(afterElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); newElement.classList.add('test') afterElement.after(newElement); - testColor(`insert element div.test after ${afterElement.id}`, expectedColor); + testColor(`insert element div.test after ${afterElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted after ${afterElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' again to the element inserted after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element inserted after ${afterElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove element div.test after ${afterElement.id}`, grey); @@ -118,7 +165,7 @@ testColor(`insert element div after ${afterElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' to the element inserted again after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' to the element inserted again after ${afterElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted again after ${afterElement.id}`, grey); @@ -129,27 +176,29 @@ newElement.setAttribute('test_attr', ''); afterElement.after(newElement); - testColor(`insert element div[test_attr] after ${afterElement.id}`, expectedColor); + testColor(`insert element div[test_attr] after ${afterElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div[test_attr] after ${afterElement.id}`, grey); } -function testTreeInsertionBefore(beforeElement, expectedColor) +function testTreeInsertionBefore(beforeElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); const newChild = document.createElement('div'); newChild.classList.add('test'); newElement.appendChild(newChild); beforeElement.before(newElement); - testColor(`insert tree div>div.test before ${beforeElement.id}`, expectedColor); + testColor(`insert tree div>div.test before ${beforeElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted before ${beforeElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' again to the element in the tree inserted before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element in the tree inserted before ${beforeElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove tree div>div.test before ${beforeElement.id}`, grey); @@ -160,7 +209,7 @@ testColor(`insert tree div>div before ${beforeElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' to the element in the tree inserted again before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' to the element in the tree inserted again before ${beforeElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted again before ${beforeElement.id}`, grey); @@ -171,27 +220,29 @@ newChild.setAttribute('test_attr', ''); beforeElement.before(newElement); - testColor(`insert element div>div[test_attr] before ${beforeElement.id}`, expectedColor); + testColor(`insert element div>div[test_attr] before ${beforeElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div>div[test_attr] before ${beforeElement.id}`, grey); } -function testTreeInsertionAfter(afterElement, expectedColor) +function testTreeInsertionAfter(afterElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); const newChild = document.createElement('div'); newChild.classList.add('test'); newElement.appendChild(newChild); afterElement.after(newElement); - testColor(`insert tree div>div.test after ${afterElement.id}`, expectedColor); + testColor(`insert tree div>div.test after ${afterElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted after ${afterElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' again to the element in the tree inserted after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element in the tree inserted after ${afterElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove tree div>div.test after ${afterElement.id}`, grey); @@ -202,7 +253,7 @@ testColor(`insert tree div>div after ${afterElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' to the element in the tree inserted again after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' to the element in the tree inserted again after ${afterElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted again after ${afterElement.id}`, grey); @@ -213,7 +264,7 @@ newChild.setAttribute('test_attr', ''); afterElement.after(newElement); - testColor(`insert element div>div[test_attr] after ${afterElement.id}`, expectedColor); + testColor(`insert element div>div[test_attr] after ${afterElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div>div[test_attr] after ${afterElement.id}`, grey); @@ -221,49 +272,49 @@ testColor('Initial color', grey); -testClassChange(subject_ancestor, grey); -testClassChange(subject_parent, green); -testClassChange(subject, green); -testClassChange(subject_child, red); -testClassChange(subject_descendant, red); -testClassChange(next_sibling, blue); -testClassChange(next_sibling_child, pink); -testClassChange(next_sibling_descendant, pink); +testClassChange(subject_ancestor, "grey"); +testClassChange(subject_parent, "green"); +testClassChange(subject, "green"); +testClassChange(subject_child, "red"); +testClassChange(subject_descendant, "red"); +testClassChange(next_sibling, "blue"); +testClassChange(next_sibling_child, "pink"); +testClassChange(next_sibling_descendant, "pink"); -testElementInsertionBefore(subject_ancestor, grey); -testElementInsertionBefore(subject_parent, green); -testElementInsertionBefore(subject, green); -testElementInsertionBefore(subject_child, red); -testElementInsertionBefore(subject_descendant, red); -testElementInsertionBefore(next_sibling, blue); -testElementInsertionBefore(next_sibling_child, pink); -testElementInsertionBefore(next_sibling_descendant, pink); +testElementInsertionBefore(subject_ancestor, "grey"); +testElementInsertionBefore(subject_parent, "green"); +testElementInsertionBefore(subject, "green"); +testElementInsertionBefore(subject_child, "red"); +testElementInsertionBefore(subject_descendant, "red"); +testElementInsertionBefore(next_sibling, "blue"); +testElementInsertionBefore(next_sibling_child, "pink"); +testElementInsertionBefore(next_sibling_descendant, "pink"); -testElementInsertionAfter(subject_ancestor, blue); -testElementInsertionAfter(subject_parent, blue); -testElementInsertionAfter(subject, green); -testElementInsertionAfter(subject_child, red); -testElementInsertionAfter(subject_descendant, red); -testElementInsertionAfter(next_sibling, yellow); -testElementInsertionAfter(next_sibling_child, pink); -testElementInsertionAfter(next_sibling_descendant, pink); +testElementInsertionAfter(subject_ancestor, "blue"); +testElementInsertionAfter(subject_parent, "blue"); +testElementInsertionAfter(subject, "green"); +testElementInsertionAfter(subject_child, "red"); +testElementInsertionAfter(subject_descendant, "red"); +testElementInsertionAfter(next_sibling, "yellow"); +testElementInsertionAfter(next_sibling_child, "pink"); +testElementInsertionAfter(next_sibling_descendant, "pink"); -testTreeInsertionBefore(subject_ancestor, grey); -testTreeInsertionBefore(subject_parent, red); -testTreeInsertionBefore(subject, red); -testTreeInsertionBefore(subject_child, red); -testTreeInsertionBefore(subject_descendant, red); -testTreeInsertionBefore(next_sibling, pink); -testTreeInsertionBefore(next_sibling_child, pink); -testTreeInsertionBefore(next_sibling_descendant, pink); +testTreeInsertionBefore(subject_ancestor, "grey"); +testTreeInsertionBefore(subject_parent, "red"); +testTreeInsertionBefore(subject, "red"); +testTreeInsertionBefore(subject_child, "red"); +testTreeInsertionBefore(subject_descendant, "red"); +testTreeInsertionBefore(next_sibling, "pink"); +testTreeInsertionBefore(next_sibling_child, "pink"); +testTreeInsertionBefore(next_sibling_descendant, "pink"); -testTreeInsertionAfter(subject_ancestor, pink); -testTreeInsertionAfter(subject_parent, pink); -testTreeInsertionAfter(subject, red); -testTreeInsertionAfter(subject_child, red); -testTreeInsertionAfter(subject_descendant, red); -testTreeInsertionAfter(next_sibling, purple); -testTreeInsertionAfter(next_sibling_child, pink); -testTreeInsertionAfter(next_sibling_descendant, pink); +testTreeInsertionAfter(subject_ancestor, "pink"); +testTreeInsertionAfter(subject_parent, "pink"); +testTreeInsertionAfter(subject, "red"); +testTreeInsertionAfter(subject_child, "red"); +testTreeInsertionAfter(subject_descendant, "red"); +testTreeInsertionAfter(next_sibling, "purple"); +testTreeInsertionAfter(next_sibling_child, "pink"); +testTreeInsertionAfter(next_sibling_descendant, "pink"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-parent-position.html b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-parent-position.html index 0a1f8b9..4690e69 100644 --- a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-parent-position.html +++ b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-parent-position.html
@@ -7,12 +7,18 @@ <link rel="help" href="https://drafts.csswg.org/selectors/#relational"> <style> div, main { color: grey } -div:has(.test, [test_attr]) > #subject { color: red } -div:has(> .test, > [test_attr]) > #subject { color: green } -div:has(~ .test, ~ [test_attr]) > #subject { color: yellow } -div:has(+ .test, + [test_attr]) > #subject { color: blue } -div:has(~ div .test, ~ div [test_attr]) > #subject { color: purple } -div:has(+ div .test, + div [test_attr]) > #subject { color: pink } +div:has(.test) > #subject { color: red } +div:has([test_attr]) > #subject { color: orangered } +div:has(> .test) > #subject { color: green } +div:has(> [test_attr]) > #subject { color: lightgreen } +div:has(~ .test) > #subject { color: yellow } +div:has(~ [test_attr]) > #subject { color: ivory } +div:has(+ .test) > #subject { color: blue } +div:has(+ [test_attr]) > #subject { color: skyblue } +div:has(~ div .test) > #subject { color: purple } +div:has(~ div [test_attr]) > #subject { color: violet } +div:has(+ div .test) > #subject { color: pink } +div:has(+ div [test_attr]) > #subject { color: lightpink } </style> <main id=main> @@ -30,11 +36,47 @@ <script> const grey = 'rgb(128, 128, 128)'; const red = 'rgb(255, 0, 0)'; +const orangered = 'rgb(255, 69, 0)'; const green = 'rgb(0, 128, 0)'; +const lightgreen = 'rgb(144, 238, 144)'; const blue = 'rgb(0, 0, 255)'; +const skyblue = 'rgb(135, 206, 235)'; const yellow = 'rgb(255, 255, 0)'; +const ivory = 'rgb(255, 255, 240)'; const purple = 'rgb(128, 0, 128)'; +const violet = 'rgb(238, 130, 238)'; const pink = 'rgb(255, 192, 203)'; +const lightpink = 'rgb(255, 182, 193)'; +const colors = { + grey: { + classTest: grey, + attributeTest: grey, + }, + red: { + classTest: red, + attributeTest: orangered, + }, + green: { + classTest: green, + attributeTest: lightgreen, + }, + blue: { + classTest: blue, + attributeTest: skyblue, + }, + yellow: { + classTest: yellow, + attributeTest: ivory, + }, + purple: { + classTest: purple, + attributeTest: violet, + }, + pink: { + classTest: pink, + attributeTest: lightpink, + }, +}; function testColor(test_name, color) { test(function() { @@ -42,27 +84,30 @@ }, test_name); } -function testClassChange(element, expectedColor) +function testClassChange(element, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; element.classList.add('test'); - testColor(`add .test to ${element.id}`, expectedColor); + testColor(`add .test to ${element.id}`, expectedColorForClassTest); element.classList.remove('test'); testColor(`remove .test from ${element.id}`, grey); } -function testElementInsertionBefore(beforeElement, expectedColor) +function testElementInsertionBefore(beforeElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); newElement.classList.add('test'); beforeElement.before(newElement); - testColor(`insert element div.test before ${beforeElement.id}`, expectedColor); + testColor(`insert element div.test before ${beforeElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted before ${beforeElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' again to the element inserted before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element inserted before ${beforeElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove element div.test before ${beforeElement.id}`, grey); @@ -73,7 +118,7 @@ testColor(`insert element div before ${beforeElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' to the element inserted again before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' to the element inserted again before ${beforeElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted again before ${beforeElement.id}`, grey); @@ -84,25 +129,27 @@ newElement.setAttribute('test_attr', ''); beforeElement.before(newElement); - testColor(`insert element div[test_attr] before ${beforeElement.id}`, expectedColor); + testColor(`insert element div[test_attr] before ${beforeElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div[test_attr] before ${beforeElement.id}`, grey); } -function testElementInsertionAfter(afterElement, expectedColor) +function testElementInsertionAfter(afterElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); newElement.classList.add('test'); afterElement.after(newElement); - testColor(`insert element div.test after ${afterElement.id}`, expectedColor); + testColor(`insert element div.test after ${afterElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted after ${afterElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' again to the element inserted after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element inserted after ${afterElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove element div.test after ${afterElement.id}`, grey); @@ -113,7 +160,7 @@ testColor(`insert element div after ${afterElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' to the element inserted again after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' to the element inserted again after ${afterElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted again after ${afterElement.id}`, grey); @@ -124,27 +171,29 @@ newElement.setAttribute('test_attr', ''); afterElement.after(newElement); - testColor(`insert element div[test_attr] after ${afterElement.id}`, expectedColor); + testColor(`insert element div[test_attr] after ${afterElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div[test_attr] after ${afterElement.id}`, grey); } -function testTreeInsertionBefore(beforeElement, expectedColor) +function testTreeInsertionBefore(beforeElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); const newChild = document.createElement('div'); newChild.classList.add('test'); newElement.appendChild(newChild); beforeElement.before(newElement); - testColor(`insert tree div>div.test before ${beforeElement.id}`, expectedColor); + testColor(`insert tree div>div.test before ${beforeElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted before ${beforeElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' again to the element in the tree inserted before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element in the tree inserted before ${beforeElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove tree div>div.test before ${beforeElement.id}`, grey); @@ -155,7 +204,7 @@ testColor(`insert tree div>div before ${beforeElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' to the element in the tree inserted again before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' to the element in the tree inserted again before ${beforeElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted again before ${beforeElement.id}`, grey); @@ -166,27 +215,29 @@ newChild.setAttribute('test_attr', ''); beforeElement.before(newElement); - testColor(`insert element div>div[test_attr] before ${beforeElement.id}`, expectedColor); + testColor(`insert element div>div[test_attr] before ${beforeElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div>div[test_attr] before ${beforeElement.id}`, grey); } -function testTreeInsertionAfter(afterElement, expectedColor) +function testTreeInsertionAfter(afterElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); const newChild = document.createElement('div'); newChild.classList.add('test'); newElement.appendChild(newChild); afterElement.after(newElement); - testColor(`insert tree div>div.test after ${afterElement.id}`, expectedColor); + testColor(`insert tree div>div.test after ${afterElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted after ${afterElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' again to the element in the tree inserted after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element in the tree inserted after ${afterElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove tree div>div.test after ${afterElement.id}`, grey); @@ -197,7 +248,7 @@ testColor(`insert tree div>div after ${afterElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' to the element in the tree inserted again after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' to the element in the tree inserted again after ${afterElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted again after ${afterElement.id}`, grey); @@ -208,7 +259,7 @@ newChild.setAttribute('test_attr', ''); afterElement.after(newElement); - testColor(`insert element div>div[test_attr] after ${afterElement.id}`, expectedColor); + testColor(`insert element div>div[test_attr] after ${afterElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div>div[test_attr] after ${afterElement.id}`, grey); @@ -216,34 +267,34 @@ testColor('Initial color', grey); -testClassChange(subject_ancestor, grey); -testClassChange(subject_parent, grey); -testClassChange(subject, green); -testClassChange(subject_child, red); -testClassChange(subject_descendant, red); +testClassChange(subject_ancestor, "grey"); +testClassChange(subject_parent, "grey"); +testClassChange(subject, "green"); +testClassChange(subject_child, "red"); +testClassChange(subject_descendant, "red"); -testElementInsertionBefore(subject_ancestor, grey); -testElementInsertionBefore(subject_parent, grey); -testElementInsertionBefore(subject, green); -testElementInsertionBefore(subject_child, red); -testElementInsertionBefore(subject_descendant, red); +testElementInsertionBefore(subject_ancestor, "grey"); +testElementInsertionBefore(subject_parent, "grey"); +testElementInsertionBefore(subject, "green"); +testElementInsertionBefore(subject_child, "red"); +testElementInsertionBefore(subject_descendant, "red"); -testElementInsertionAfter(subject_ancestor, grey); -testElementInsertionAfter(subject_parent, blue); -testElementInsertionAfter(subject, green); -testElementInsertionAfter(subject_child, red); -testElementInsertionAfter(subject_descendant, red); +testElementInsertionAfter(subject_ancestor, "grey"); +testElementInsertionAfter(subject_parent, "blue"); +testElementInsertionAfter(subject, "green"); +testElementInsertionAfter(subject_child, "red"); +testElementInsertionAfter(subject_descendant, "red"); -testTreeInsertionBefore(subject_ancestor, grey); -testTreeInsertionBefore(subject_parent, grey); -testTreeInsertionBefore(subject, red); -testTreeInsertionBefore(subject_child, red); -testTreeInsertionBefore(subject_descendant, red); +testTreeInsertionBefore(subject_ancestor, "grey"); +testTreeInsertionBefore(subject_parent, "grey"); +testTreeInsertionBefore(subject, "red"); +testTreeInsertionBefore(subject_child, "red"); +testTreeInsertionBefore(subject_descendant, "red"); -testTreeInsertionAfter(subject_ancestor, grey); -testTreeInsertionAfter(subject_parent, pink); -testTreeInsertionAfter(subject, red); -testTreeInsertionAfter(subject_child, red); -testTreeInsertionAfter(subject_descendant, red); +testTreeInsertionAfter(subject_ancestor, "grey"); +testTreeInsertionAfter(subject_parent, "pink"); +testTreeInsertionAfter(subject, "red"); +testTreeInsertionAfter(subject_child, "red"); +testTreeInsertionAfter(subject_descendant, "red"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-sibling-position.html b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-sibling-position.html index 91b1dcf..8b35940 100644 --- a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-sibling-position.html +++ b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-in-sibling-position.html
@@ -7,12 +7,18 @@ <link rel="help" href="https://drafts.csswg.org/selectors/#relational"> <style> div, main { color: grey } -div:has(.test, [test_attr]) ~ #subject { color: red } -div:has(> .test, > [test_attr]) ~ #subject { color: green } -div:has(~ .test, ~ [test_attr]) ~ #subject { color: yellow } -div:has(+ .test, + [test_attr]) ~ #subject { color: blue } -div:has(~ div .test, ~ div [test_attr]) ~ #subject { color: purple } -div:has(+ div .test, + div [test_attr]) ~ #subject { color: pink } +div:has(.test) ~ #subject { color: red } +div:has([test_attr]) ~ #subject { color: orangered } +div:has(> .test) ~ #subject { color: green } +div:has(> [test_attr]) ~ #subject { color: lightgreen } +div:has(~ .test) ~ #subject { color: yellow } +div:has(~ [test_attr]) ~ #subject { color: ivory } +div:has(+ .test) ~ #subject { color: blue } +div:has(+ [test_attr]) ~ #subject { color: skyblue } +div:has(~ div .test) ~ #subject { color: purple } +div:has(~ div [test_attr]) ~ #subject { color: violet } +div:has(+ div .test) ~ #subject { color: pink } +div:has(+ div [test_attr]) ~ #subject { color: lightpink } </style> <main id=main> @@ -32,11 +38,47 @@ <script> const grey = 'rgb(128, 128, 128)'; const red = 'rgb(255, 0, 0)'; +const orangered = 'rgb(255, 69, 0)'; const green = 'rgb(0, 128, 0)'; +const lightgreen = 'rgb(144, 238, 144)'; const blue = 'rgb(0, 0, 255)'; +const skyblue = 'rgb(135, 206, 235)'; const yellow = 'rgb(255, 255, 0)'; +const ivory = 'rgb(255, 255, 240)'; const purple = 'rgb(128, 0, 128)'; +const violet = 'rgb(238, 130, 238)'; const pink = 'rgb(255, 192, 203)'; +const lightpink = 'rgb(255, 182, 193)'; +const colors = { + grey: { + classTest: grey, + attributeTest: grey, + }, + red: { + classTest: red, + attributeTest: orangered, + }, + green: { + classTest: green, + attributeTest: lightgreen, + }, + blue: { + classTest: blue, + attributeTest: skyblue, + }, + yellow: { + classTest: yellow, + attributeTest: ivory, + }, + purple: { + classTest: purple, + attributeTest: violet, + }, + pink: { + classTest: pink, + attributeTest: lightpink, + }, +}; function testColor(test_name, color) { test(function() { @@ -44,27 +86,30 @@ }, test_name); } -function testClassChange(element, expectedColor) +function testClassChange(element, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; element.classList.add('test'); - testColor(`add .test to ${element.id}`, expectedColor); + testColor(`add .test to ${element.id}`, expectedColorForClassTest); element.classList.remove('test'); testColor(`remove .test from ${element.id}`, grey); } -function testElementInsertionBefore(beforeElement, expectedColor) +function testElementInsertionBefore(beforeElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); newElement.classList.add('test') beforeElement.before(newElement); - testColor(`insert element div.test before ${beforeElement.id}`, expectedColor); + testColor(`insert element div.test before ${beforeElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted before ${beforeElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' again to the element inserted before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element inserted before ${beforeElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove element div.test before ${beforeElement.id}`, grey); @@ -75,7 +120,7 @@ testColor(`insert element div before ${beforeElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' to the element inserted again before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' to the element inserted again before ${beforeElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted again before ${beforeElement.id}`, grey); @@ -86,25 +131,27 @@ newElement.setAttribute('test_attr', ''); beforeElement.before(newElement); - testColor(`insert element div[test_attr] before ${beforeElement.id}`, expectedColor); + testColor(`insert element div[test_attr] before ${beforeElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div[test_attr] before ${beforeElement.id}`, grey); } -function testElementInsertionAfter(afterElement, expectedColor) +function testElementInsertionAfter(afterElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); newElement.classList.add('test') afterElement.after(newElement); - testColor(`insert element div.test after ${afterElement.id}`, expectedColor); + testColor(`insert element div.test after ${afterElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted after ${afterElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' again to the element inserted after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element inserted after ${afterElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove element div.test after ${afterElement.id}`, grey); @@ -115,7 +162,7 @@ testColor(`insert element div after ${afterElement.id}`, grey); newElement.classList.add('test'); - testColor(`add the class 'test' to the element inserted again after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' to the element inserted again after ${afterElement.id}`, expectedColorForClassTest); newElement.classList.remove('test'); testColor(`remove the class 'test' from the element inserted again after ${afterElement.id}`, grey); @@ -126,27 +173,29 @@ newElement.setAttribute('test_attr', ''); afterElement.after(newElement); - testColor(`insert element div[test_attr] after ${afterElement.id}`, expectedColor); + testColor(`insert element div[test_attr] after ${afterElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div[test_attr] after ${afterElement.id}`, grey); } -function testTreeInsertionBefore(beforeElement, expectedColor) +function testTreeInsertionBefore(beforeElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); const newChild = document.createElement('div'); newChild.classList.add('test'); newElement.appendChild(newChild); beforeElement.before(newElement); - testColor(`insert tree div>div.test before ${beforeElement.id}`, expectedColor); + testColor(`insert tree div>div.test before ${beforeElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted before ${beforeElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' again to the element in the tree inserted before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element in the tree inserted before ${beforeElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove tree div>div.test before ${beforeElement.id}`, grey); @@ -157,7 +206,7 @@ testColor(`insert tree div>div before ${beforeElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' to the element in the tree inserted again before ${beforeElement.id}`, expectedColor); + testColor(`add the class 'test' to the element in the tree inserted again before ${beforeElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted again before ${beforeElement.id}`, grey); @@ -168,27 +217,29 @@ newChild.setAttribute('test_attr', ''); beforeElement.before(newElement); - testColor(`insert element div>div[test_attr] before ${beforeElement.id}`, expectedColor); + testColor(`insert element div>div[test_attr] before ${beforeElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div>div[test_attr] before ${beforeElement.id}`, grey); } -function testTreeInsertionAfter(afterElement, expectedColor) +function testTreeInsertionAfter(afterElement, expectedColorName) { + const expectedColorForClassTest = colors[expectedColorName].classTest; + const expectedColorForAttributeTest = colors[expectedColorName].attributeTest; const newElement = document.createElement('div'); const newChild = document.createElement('div'); newChild.classList.add('test'); newElement.appendChild(newChild); afterElement.after(newElement); - testColor(`insert tree div>div.test after ${afterElement.id}`, expectedColor); + testColor(`insert tree div>div.test after ${afterElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted after ${afterElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' again to the element in the tree inserted after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' again to the element in the tree inserted after ${afterElement.id}`, expectedColorForClassTest); newElement.remove(); testColor(`remove tree div>div.test after ${afterElement.id}`, grey); @@ -199,7 +250,7 @@ testColor(`insert tree div>div after ${afterElement.id}`, grey); newChild.classList.add('test'); - testColor(`add the class 'test' to the element in the tree inserted again after ${afterElement.id}`, expectedColor); + testColor(`add the class 'test' to the element in the tree inserted again after ${afterElement.id}`, expectedColorForClassTest); newChild.classList.remove('test'); testColor(`remove the class 'test' from the element in the tree inserted again after ${afterElement.id}`, grey); @@ -210,7 +261,7 @@ newChild.setAttribute('test_attr', ''); afterElement.after(newElement); - testColor(`insert element div>div[test_attr] after ${afterElement.id}`, expectedColor); + testColor(`insert element div>div[test_attr] after ${afterElement.id}`, expectedColorForAttributeTest); newElement.remove(); testColor(`remove element div>div[test_attr] after ${afterElement.id}`, grey); @@ -218,44 +269,44 @@ testColor('Initial color', grey); -testClassChange(previous_sibling, grey); -testClassChange(previous_sibling_child, green); -testClassChange(previous_sibling_descendant, red); -testClassChange(subject, blue); -testClassChange(next_sibling, yellow); -testClassChange(next_sibling_child, purple); -testClassChange(next_sibling_descendant, purple); +testClassChange(previous_sibling, "grey"); +testClassChange(previous_sibling_child, "green"); +testClassChange(previous_sibling_descendant, "red"); +testClassChange(subject, "blue"); +testClassChange(next_sibling, "yellow"); +testClassChange(next_sibling_child, "purple"); +testClassChange(next_sibling_descendant, "purple"); -testElementInsertionBefore(previous_sibling, grey); -testElementInsertionBefore(previous_sibling_child, green); -testElementInsertionBefore(previous_sibling_descendant, red); -testElementInsertionBefore(subject, blue); -testElementInsertionBefore(next_sibling, yellow); -testElementInsertionBefore(next_sibling_child, purple); -testElementInsertionBefore(next_sibling_descendant, purple); +testElementInsertionBefore(previous_sibling, "grey"); +testElementInsertionBefore(previous_sibling_child, "green"); +testElementInsertionBefore(previous_sibling_descendant, "red"); +testElementInsertionBefore(subject, "blue"); +testElementInsertionBefore(next_sibling, "yellow"); +testElementInsertionBefore(next_sibling_child, "purple"); +testElementInsertionBefore(next_sibling_descendant, "purple"); -testElementInsertionAfter(previous_sibling, blue); -testElementInsertionAfter(previous_sibling_child, green); -testElementInsertionAfter(previous_sibling_descendant, red); -testElementInsertionAfter(subject, yellow); -testElementInsertionAfter(next_sibling, yellow); -testElementInsertionAfter(next_sibling_child, purple); -testElementInsertionAfter(next_sibling_descendant, purple); +testElementInsertionAfter(previous_sibling, "blue"); +testElementInsertionAfter(previous_sibling_child, "green"); +testElementInsertionAfter(previous_sibling_descendant, "red"); +testElementInsertionAfter(subject, "yellow"); +testElementInsertionAfter(next_sibling, "yellow"); +testElementInsertionAfter(next_sibling_child, "purple"); +testElementInsertionAfter(next_sibling_descendant, "purple"); -testTreeInsertionBefore(previous_sibling, green); -testTreeInsertionBefore(previous_sibling_child, red); -testTreeInsertionBefore(previous_sibling_descendant, red); -testTreeInsertionBefore(subject, pink); -testTreeInsertionBefore(next_sibling, purple); -testTreeInsertionBefore(next_sibling_child, purple); -testTreeInsertionBefore(next_sibling_descendant, purple); +testTreeInsertionBefore(previous_sibling, "green"); +testTreeInsertionBefore(previous_sibling_child, "red"); +testTreeInsertionBefore(previous_sibling_descendant, "red"); +testTreeInsertionBefore(subject, "pink"); +testTreeInsertionBefore(next_sibling, "purple"); +testTreeInsertionBefore(next_sibling_child, "purple"); +testTreeInsertionBefore(next_sibling_descendant, "purple"); -testTreeInsertionAfter(previous_sibling, pink); -testTreeInsertionAfter(previous_sibling_child, red); -testTreeInsertionAfter(previous_sibling_descendant, red); -testTreeInsertionAfter(subject, purple); -testTreeInsertionAfter(next_sibling, purple); -testTreeInsertionAfter(next_sibling_child, purple); -testTreeInsertionAfter(next_sibling_descendant, purple); +testTreeInsertionAfter(previous_sibling, "pink"); +testTreeInsertionAfter(previous_sibling_child, "red"); +testTreeInsertionAfter(previous_sibling_descendant, "red"); +testTreeInsertionAfter(subject, "purple"); +testTreeInsertionAfter(next_sibling, "purple"); +testTreeInsertionAfter(next_sibling_child, "purple"); +testTreeInsertionAfter(next_sibling_descendant, "purple"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/anonymous-window.tentative.https.window.js b/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/anonymous-window.tentative.https.window.js index a2ff8d8d..92db4e1 100644 --- a/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/anonymous-window.tentative.https.window.js +++ b/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/anonymous-window.tentative.https.window.js
@@ -13,9 +13,7 @@ iframe.contentWindow.modified = true; iframe.src = ORIGIN + "/common/blank.html"; // Wait for navigation to complete. - await t.step_wait(() => - iframe.contentWindow.location.href === iframe.src, - "Wait for the navigation to complete"); + await new Promise(resolve => iframe.onload = resolve); assert_true(iframe.anonymous); assert_true(iframe.contentWindow.isAnonymouslyFramed); assert_equals(undefined, iframe.contentWindow.modified); @@ -30,9 +28,7 @@ iframe.contentWindow.modified = true; iframe.src = ORIGIN + "/common/blank.html"; // Wait for navigation to complete. - await t.step_wait(() => - iframe.contentWindow.location.href === iframe.src, - "Wait for the navigation to complete"); + await new Promise(resolve => iframe.onload = resolve); assert_false(iframe.anonymous); assert_false(iframe.contentWindow.isAnonymouslyFramed); assert_equals(undefined, iframe.contentWindow.modified); @@ -47,9 +43,7 @@ iframe.contentWindow.modified = true; iframe.src = ORIGIN + "/common/blank.html"; // Wait for navigation to complete. - await t.step_wait(() => - iframe.contentWindow.location.href === iframe.src, - "Wait for the navigation to complete"); + await new Promise(resolve => iframe.onload = resolve); assert_true(iframe.anonymous); assert_true(iframe.contentWindow.isAnonymouslyFramed); assert_true(iframe.contentWindow.modified);
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html index 8e22c1f..10b644e2 100644 --- a/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html +++ b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/image-loading-lazy-move-into-script-disabled-iframe.html
@@ -10,8 +10,7 @@ <div style="height:1000vh;"></div> <iframe id="iframe" src="resources/image-loading-lazy-in-viewport.html"> </iframe> -<iframe id="sandboxediframe" sandbox="allow-same-origin" - src="resources/subframe.html"> +<iframe id="sandboxediframe" sandbox="allow-same-origin"> </iframe> <script> promise_test(async t => {
diff --git a/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/frame-lazyload-timeout.html b/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/frame-lazyload-timeout.html new file mode 100644 index 0000000..28ca1a31 --- /dev/null +++ b/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/frame-lazyload-timeout.html
@@ -0,0 +1,37 @@ +<!DOCTYPE html> + +<title>Makes sure that the ad iframe loading are triggered</title> +<script src="../../../../../resources/testharness.js"></script> +<script src="../../../../../resources/testharnessreport.js"></script> +<script src="../../../../../http/tests/resources/get-host-info.js"></script> +<script src="./resources/lazyload-helper.js"></script> + +<body> + <div id="atf_div"></div> + <div style="height:1000vh;"></div> + <div id="btf_div"></div> + + <script> + window.addEventListener('DOMContentLoaded', () => { + promise_test(async t => { + const btf = document.querySelector('#btf_div'); + appendAdFrame('btf', btf); + + const timeoutMs = 1000; + + let result = isElementLoaded('btf'); + await new Promise(resolve => { + t.step_timeout(() => { + result = isElementLoaded('btf') + resolve(); + }, timeoutMs); + }); + assert_false(result, "iframe is not loaded until the timeout"); + + await waitUntilIdle(); + result = await waitForElementLoad("btf"); + assert_true(result, "iframe is loaded after the timeout and idle"); + }, "Trigger loading after the timeout"); + }) + </script> +</body>
diff --git a/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/frame-lazyload.html b/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/frame-lazyload.html index b672a70..12ea0cc 100644 --- a/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/frame-lazyload.html +++ b/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/frame-lazyload.html
@@ -4,6 +4,7 @@ <script src="../../../../../resources/testharness.js"></script> <script src="../../../../../resources/testharnessreport.js"></script> <script src="../../../../../http/tests/resources/get-host-info.js"></script> +<script src="./resources/lazyload-helper.js"></script> <body> <div id="atf_div"></div> @@ -12,43 +13,6 @@ <script> window.addEventListener('DOMContentLoaded', () => { - const waitUntilIdle = () => { - return new Promise(resolve => { - window.requestIdleCallback(() => resolve()); - }); - }; - const loaded_ids = []; - const appendAdFrame = (id, elm) => { - const frame = document.createElement('iframe'); - frame.width = 300; - frame.height = 300; - frame.id = id; - - elm.appendChild(frame); - internals.setIsAdSubframe(frame); - - // Simulate 3P domain - const third_pary_origin = get_host_info().HTTPS_REMOTE_ORIGIN; - frame.src = `${third_pary_origin}/resources/dummy.html`; - - frame.onload = () => { - loaded_ids.push(id) - }; - }; - const isElementLoaded = (id) => loaded_ids.includes(id); - const waitForElementLoad = (id) => { - return new Promise((resolve, reject) => { - const elm = document.getElementById(id) - if (isElementLoaded(id)) { - resolve(true); - } else { - elm.addEventListener('load', () => { - resolve(true); - }); - } - }); - }; - promise_test(async t => { const atf = document.querySelector('#atf_div'); const btf = document.querySelector('#btf_div');
diff --git a/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/resources/lazyload-helper.js b/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/resources/lazyload-helper.js new file mode 100644 index 0000000..785ce1f --- /dev/null +++ b/third_party/blink/web_tests/virtual/automatic-lazy-frame-loading-ads/http/tests/subresource_filter/resources/lazyload-helper.js
@@ -0,0 +1,36 @@ +const waitUntilIdle = () => { + return new Promise(resolve => { + window.requestIdleCallback(() => resolve()); + }); +}; +const loaded_ids = []; +const appendAdFrame = (id, elm) => { + const frame = document.createElement('iframe'); + frame.width = 300; + frame.height = 300; + frame.id = id; + + elm.appendChild(frame); + internals.setIsAdSubframe(frame); + + // Simulate 3P domain + const third_pary_origin = get_host_info().HTTPS_REMOTE_ORIGIN; + frame.src = `${third_pary_origin}/resources/dummy.html`; + + frame.onload = () => { + loaded_ids.push(id) + }; +}; +const isElementLoaded = (id) => loaded_ids.includes(id); +const waitForElementLoad = (id) => { + return new Promise((resolve, reject) => { + const elm = document.getElementById(id) + if (isElementLoaded(id)) { + resolve(true); + } else { + elm.addEventListener('load', () => { + resolve(true); + }); + } + }); +};
diff --git a/third_party/blink/web_tests/wpt_internal/webgpu/cts.https.html b/third_party/blink/web_tests/wpt_internal/webgpu/cts.https.html index 150ef761..6807454 100644 --- a/third_party/blink/web_tests/wpt_internal/webgpu/cts.https.html +++ b/third_party/blink/web_tests/wpt_internal/webgpu/cts.https.html
@@ -2160,7 +2160,8 @@ <meta name=variant content='?q=webgpu:api,validation,encoding,cmds,index_access:out_of_bounds_zero_sized_index_buffer:*'> <meta name=variant content='?q=webgpu:api,validation,encoding,cmds,render,draw:unused_buffer_bound:*'> <meta name=variant content='?q=webgpu:api,validation,encoding,cmds,render,draw:index_buffer_OOB:*'> -<meta name=variant content='?q=webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB:*'> +<meta name=variant content='?q=webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB,vertex_step_mode:*'> +<meta name=variant content='?q=webgpu:api,validation,encoding,cmds,render,draw:vertex_buffer_OOB,instance_step_mode:*'> <meta name=variant content='?q=webgpu:api,validation,encoding,cmds,render,draw:last_buffer_setting_take_account:*'> <meta name=variant content='?q=webgpu:api,validation,encoding,cmds,render,draw:buffer_binding_overlap:*'> <meta name=variant content='?q=webgpu:api,validation,encoding,cmds,render,dynamic_state:setViewport,x_y_width_height_nonnegative:*'>
diff --git a/third_party/closure_compiler/externs/passwords_private.js b/third_party/closure_compiler/externs/passwords_private.js index aad8fb0..1a00bcf 100644 --- a/third_party/closure_compiler/externs/passwords_private.js +++ b/third_party/closure_compiler/externs/passwords_private.js
@@ -137,6 +137,7 @@ * url: string, * username: string, * password: string, + * note: string, * useAccountStore: boolean * }} */ @@ -352,9 +353,9 @@ * @param {!chrome.passwordsPrivate.InsecureCredential} credential The * credential for which the flow was triggered. * @param {boolean} isManualFlow + * @param {function(): void=} callback */ -chrome.passwordsPrivate.recordChangePasswordFlowStarted = function( - credential, isManualFlow) {}; +chrome.passwordsPrivate.recordChangePasswordFlowStarted = function(credential, isManualFlow, callback) {}; /** * Starts a check for insecure passwords. Invokes |callback| on completion.
diff --git a/third_party/ipcz/src/BUILD.gn b/third_party/ipcz/src/BUILD.gn index 9f214d0..13dc9c5 100644 --- a/third_party/ipcz/src/BUILD.gn +++ b/third_party/ipcz/src/BUILD.gn
@@ -5,10 +5,6 @@ import("//build_overrides/ipcz.gni") import("//testing/test.gni") -# ipcz will not implement a multiprocess reference driver or its supporting -# primitives for iOS or NaCl platforms. Note that this only affects ipcz tests. -enable_ipcz_multiprocess_test_support = !is_ios && !is_nacl - shared_library("ipcz_shared") { output_name = "ipcz" sources = [ @@ -130,8 +126,6 @@ } ipcz_source_set("reference_drivers") { - testonly = true - public = [ "reference_drivers/single_process_reference_driver.h" ] sources = [ @@ -142,58 +136,9 @@ "reference_drivers/single_process_reference_driver.cc", ] - if (enable_ipcz_multiprocess_test_support) { - public += [ - "reference_drivers/memory.h", - "reference_drivers/os_handle.h", - ] - sources += [ "reference_drivers/memory.cc" ] - - if (is_android) { - sources += [ - "reference_drivers/memory_android.cc", - "reference_drivers/os_handle_posix.cc", - "reference_drivers/os_handle_posix.h", - ] - } else if (is_mac) { - sources += [ - "reference_drivers/memory_mac.cc", - "reference_drivers/os_handle_mac.cc", - "reference_drivers/os_handle_mac.h", - ] - } else if (is_win) { - sources += [ - "reference_drivers/memory_win.cc", - "reference_drivers/os_handle_win.cc", - "reference_drivers/os_handle_win.h", - ] - } else if (is_fuchsia) { - sources += [ - "reference_drivers/memory_fuchsia.cc", - "reference_drivers/os_handle_fuchsia.cc", - "reference_drivers/os_handle_fuchsia.h", - ] - } else if (is_posix) { - sources += [ - "reference_drivers/memory_posix.cc", - "reference_drivers/os_handle_posix.cc", - "reference_drivers/os_handle_posix.h", - ] - } - } - ipcz_deps = [ ":util" ] public_deps = [ ":ipcz_header" ] configs = [ ":ipcz_include_src_dir" ] - - deps = [] - if (is_fuchsia) { - public_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/zx" ] - } - - if (is_android) { - deps += [ "//third_party/ashmem" ] - } } ipcz_source_set("util") { @@ -350,10 +295,6 @@ "util/stack_trace_test.cc", ] - if (enable_ipcz_multiprocess_test_support) { - sources += [ "reference_drivers/memory_test.cc" ] - } - deps = [ "//testing/gmock", "//testing/gtest",
diff --git a/third_party/ipcz/src/reference_drivers/memory.cc b/third_party/ipcz/src/reference_drivers/memory.cc deleted file mode 100644 index 041fa84..0000000 --- a/third_party/ipcz/src/reference_drivers/memory.cc +++ /dev/null
@@ -1,50 +0,0 @@ -// 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 "reference_drivers/memory.h" - -#include <utility> - -#include "build/build_config.h" -#include "third_party/abseil-cpp/absl/base/macros.h" - -namespace ipcz::reference_drivers { - -Memory::Mapping::Mapping() = default; - -Memory::Mapping::Mapping(void* base_address, size_t size) - : base_address_(base_address), size_(size) {} - -Memory::Mapping::Mapping(Mapping&& other) - : base_address_(std::exchange(other.base_address_, nullptr)), - size_(std::exchange(other.size_, 0)) {} - -Memory::Mapping& Memory::Mapping::operator=(Mapping&& other) { - Reset(); - base_address_ = std::exchange(other.base_address_, nullptr); - size_ = std::exchange(other.size_, 0); - return *this; -} - -Memory::Mapping::~Mapping() { - Reset(); -} - -Memory::Memory() = default; - -Memory::Memory(OSHandle handle, size_t size) - : handle_(std::move(handle)), size_(size) {} - -Memory::Memory(Memory&&) = default; - -Memory& Memory::operator=(Memory&&) = default; - -Memory::~Memory() = default; - -Memory Memory::Clone() { - ABSL_ASSERT(is_valid()); - return Memory(handle_.Clone(), size_); -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/memory.h b/third_party/ipcz/src/reference_drivers/memory.h deleted file mode 100644 index eaf24857..0000000 --- a/third_party/ipcz/src/reference_drivers/memory.h +++ /dev/null
@@ -1,95 +0,0 @@ -// 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 IPCZ_SRC_REFERENCE_DRIVERS_MEMORY_H_ -#define IPCZ_SRC_REFERENCE_DRIVERS_MEMORY_H_ - -#include "reference_drivers/os_handle.h" -#include "third_party/abseil-cpp/absl/types/span.h" - -namespace ipcz::reference_drivers { - -// Cross-platform abstraction for a shared memory region. -class Memory { - public: - // Cross-platform abstraction for an active mapping of a shared memory region. - // - // Instances of this object should be acquired from Memory::Map(). - class Mapping { - public: - Mapping(); - Mapping(void* base_address, size_t size); - Mapping(Mapping&&); - Mapping& operator=(Mapping&&); - Mapping(const Mapping&) = delete; - Mapping& operator=(const Mapping&) = delete; - ~Mapping(); - - bool is_valid() const { return base_address_ != nullptr; } - - size_t size() const { return size_; } - void* base() const { return base_address_; } - - absl::Span<uint8_t> bytes() const { - return {static_cast<uint8_t*>(base()), size_}; - } - - template <typename T> - T* As() const { - return static_cast<T*>(base()); - } - - void Reset(); - - private: - void* base_address_ = nullptr; - size_t size_ = 0; - }; - - // Constructs an invalid Memory object which cannot be mapped. - Memory(); - - // Constructs a new Memory object over `handle`, an OSHandle which should have - // been previously taken from some other valid Memory object. `size` must - // correspond to the size of that original region. - Memory(OSHandle handle, size_t size); - - // Constructs a new Memory object over a newly allocated shared memory region - // of at least `size` bytes. - explicit Memory(size_t size); - - Memory(Memory&&); - Memory& operator=(Memory&&); - Memory(const Memory&) = delete; - Memory& operator=(const Memory&) = delete; - ~Memory(); - - size_t size() const { return size_; } - bool is_valid() const { return handle_.is_valid(); } - const OSHandle& handle() const { return handle_; } - - // Invalidates this Memory object and returns an OSHandle which can be used - // later to reconstruct an equivalent Memory object, given the same size(). - OSHandle TakeHandle() { return std::move(handle_); } - - // Resets this object, closing its handle to the underlying region. - void reset() { handle_.reset(); } - - // Returns a new Memory object with its own handle to the same underlying - // region as `this`. Must only be called on a valid Memory object (i.e. - // is_valid() must be true.) - Memory Clone(); - - // Maps the entire region owned by Memory and returns a Mapping for it. Must - // only be called on a valid Memory object (i.e. is_valid() must be true.) - Mapping Map(); - - private: - OSHandle handle_; - size_t size_ = 0; -}; - -} // namespace ipcz::reference_drivers - -#endif // IPCZ_SRC_REFERENCE_DRIVERS_MEMORY_H_
diff --git a/third_party/ipcz/src/reference_drivers/memory_android.cc b/third_party/ipcz/src/reference_drivers/memory_android.cc deleted file mode 100644 index 355b20f..0000000 --- a/third_party/ipcz/src/reference_drivers/memory_android.cc +++ /dev/null
@@ -1,45 +0,0 @@ -// 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 "reference_drivers/memory.h" - -#include <sys/mman.h> -#include <unistd.h> - -#include <cstddef> - -#include "reference_drivers/os_handle.h" -#include "third_party/abseil-cpp/absl/base/macros.h" -#include "third_party/ashmem/ashmem.h" - -namespace ipcz::reference_drivers { - -void Memory::Mapping::Reset() { - if (base_address_) { - munmap(base_address_, size_); - base_address_ = nullptr; - size_ = 0; - } -} - -Memory::Memory(size_t size) { - const size_t page_size = static_cast<size_t>(sysconf(_SC_PAGESIZE)); - const size_t rounded_size = (size + page_size - 1) & (page_size - 1); - int fd = ashmem_create_region("ipcz-memory", rounded_size); - ABSL_ASSERT(fd >= 0); - int err = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE); - ABSL_ASSERT(err == 0); - handle_ = OSHandle(fd); - size_ = size; -} - -Memory::Mapping Memory::Map() { - ABSL_ASSERT(is_valid()); - void* addr = - mmap(nullptr, size_, PROT_READ | PROT_WRITE, MAP_SHARED, handle_.fd(), 0); - ABSL_ASSERT(addr && addr != MAP_FAILED); - return Mapping(addr, size_); -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/memory_fuchsia.cc b/third_party/ipcz/src/reference_drivers/memory_fuchsia.cc deleted file mode 100644 index e2c8e2c..0000000 --- a/third_party/ipcz/src/reference_drivers/memory_fuchsia.cc +++ /dev/null
@@ -1,54 +0,0 @@ -// 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 "reference_drivers/memory.h" - -#include <lib/zx/vmar.h> -#include <zircon/syscalls.h> - -#include <cstddef> -#include <cstdint> -#include <utility> - -#include "reference_drivers/os_handle.h" -#include "third_party/abseil-cpp/absl/base/macros.h" - -namespace ipcz::reference_drivers { - -void Memory::Mapping::Reset() { - if (base_address_) { - uintptr_t addr = reinterpret_cast<uintptr_t>(base_address_); - zx_status_t status = zx::vmar::root_self()->unmap(addr, size_); - ABSL_ASSERT(status == ZX_OK); - } -} - -Memory::Memory(size_t size) { - const uint32_t page_size = zx_system_get_page_size(); - const size_t rounded_size = (size + page_size - 1) & (page_size - 1); - zx::vmo vmo; - zx_status_t status = zx::vmo::create(rounded_size, 0, &vmo); - ABSL_ASSERT(status == ZX_OK); - const int kNoExec = ZX_DEFAULT_VMO_RIGHTS & ~ZX_RIGHT_EXECUTE; - status = vmo.replace(kNoExec, &vmo); - ABSL_ASSERT(status == ZX_OK); - handle_ = OSHandle(std::move(vmo)); - size_ = size; -} - -Memory::Mapping Memory::Map() { - ABSL_ASSERT(is_valid()); - uintptr_t addr; - zx_vm_option_t options = - ZX_VM_REQUIRE_NON_RESIZABLE | ZX_VM_PERM_READ | ZX_VM_PERM_WRITE; - zx_status_t status = zx::vmar::root_self()->map( - options, /*vmar_offset=*/0, *zx::unowned_vmo(handle_.handle().get()), 0, - size_, &addr); - if (status != ZX_OK) { - return {}; - } - return Mapping(reinterpret_cast<void*>(addr), size_); -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/memory_mac.cc b/third_party/ipcz/src/reference_drivers/memory_mac.cc deleted file mode 100644 index 4f1c561..0000000 --- a/third_party/ipcz/src/reference_drivers/memory_mac.cc +++ /dev/null
@@ -1,47 +0,0 @@ -// 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 "reference_drivers/memory.h" - -#include <mach/mach_vm.h> - -#include "reference_drivers/os_handle.h" -#include "third_party/abseil-cpp/absl/base/macros.h" - -namespace ipcz::reference_drivers { - -void Memory::Mapping::Reset() { - if (base_address_) { - kern_return_t kr = mach_vm_deallocate( - mach_task_self(), reinterpret_cast<mach_vm_address_t>(base_address_), - size_); - ABSL_ASSERT(kr == KERN_SUCCESS); - } -} - -Memory::Memory(size_t size) { - mach_vm_size_t vm_size = size; - mach_port_t named_right; - kern_return_t kr = mach_make_memory_entry_64( - mach_task_self(), &vm_size, 0, - MAP_MEM_NAMED_CREATE | VM_PROT_READ | VM_PROT_WRITE, &named_right, - MACH_PORT_NULL); - ABSL_ASSERT(kr == KERN_SUCCESS); - ABSL_ASSERT(vm_size >= size); - handle_ = OSHandle(OSHandle::MachSendRight(named_right)); - size_ = size; -} - -Memory::Mapping Memory::Map() { - ABSL_ASSERT(is_valid()); - mach_vm_address_t address = 0; - kern_return_t kr = mach_vm_map(mach_task_self(), &address, size_, 0, - VM_FLAGS_ANYWHERE, handle_.mach_send_right(), - 0, FALSE, VM_PROT_READ | VM_PROT_WRITE, - VM_PROT_READ | VM_PROT_WRITE, VM_INHERIT_NONE); - ABSL_ASSERT(kr == KERN_SUCCESS); - return Mapping(reinterpret_cast<void*>(address), size_); -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/memory_posix.cc b/third_party/ipcz/src/reference_drivers/memory_posix.cc deleted file mode 100644 index 37e7775..0000000 --- a/third_party/ipcz/src/reference_drivers/memory_posix.cc +++ /dev/null
@@ -1,47 +0,0 @@ -// 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 "reference_drivers/memory.h" - -#include <fcntl.h> -#include <sys/mman.h> -#include <sys/types.h> -#include <unistd.h> - -#include "reference_drivers/os_handle.h" -#include "third_party/abseil-cpp/absl/base/macros.h" - -namespace ipcz::reference_drivers { - -void Memory::Mapping::Reset() { - if (base_address_) { - munmap(base_address_, size_); - base_address_ = nullptr; - size_ = 0; - } -} - -Memory::Memory(size_t size) { - int fd = memfd_create("/ipcz/mem", MFD_ALLOW_SEALING); - ABSL_ASSERT(fd >= 0); - - int result = ftruncate(fd, size); - ABSL_ASSERT(result == 0); - - result = fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK); - ABSL_ASSERT(result == 0); - - handle_ = OSHandle(fd); - size_ = size; -} - -Memory::Mapping Memory::Map() { - ABSL_ASSERT(is_valid()); - void* addr = - mmap(nullptr, size_, PROT_READ | PROT_WRITE, MAP_SHARED, handle_.fd(), 0); - ABSL_ASSERT(addr && addr != MAP_FAILED); - return Mapping(addr, size_); -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/memory_test.cc b/third_party/ipcz/src/reference_drivers/memory_test.cc deleted file mode 100644 index 7017852..0000000 --- a/third_party/ipcz/src/reference_drivers/memory_test.cc +++ /dev/null
@@ -1,70 +0,0 @@ -// 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 "reference_drivers/memory.h" - -#include <tuple> - -#include "testing/gtest/include/gtest/gtest.h" - -namespace ipcz::reference_drivers { -namespace { - -using MemoryTest = testing::Test; - -TEST_F(MemoryTest, CreateAndMap) { - Memory memory(64); - - Memory::Mapping mapping0 = memory.Map(); - Memory::Mapping mapping1 = memory.Map(); - - int* data0 = mapping0.As<int>(); - int* data1 = mapping1.As<int>(); - - // Each mapping should have a different base address. - EXPECT_NE(data0, data1); - - // But they should be backed by the same physical memory. - data1[0] = 0; - data0[0] = 42; - EXPECT_EQ(42, data1[0]); -} - -TEST_F(MemoryTest, CreateMapClose) { - Memory memory(64); - - Memory::Mapping mapping0 = memory.Map(); - Memory::Mapping mapping1 = memory.Map(); - - // Even with the memfd closed, the mappings above should persist. - memory.reset(); - - int* data0 = mapping0.As<int>(); - int* data1 = mapping1.As<int>(); - EXPECT_NE(data0, data1); - data1[0] = 0; - data0[0] = 42; - EXPECT_EQ(42, data1[0]); -} - -TEST_F(MemoryTest, CreateCloneMapClose) { - Memory memory(64); - Memory clone = memory.Clone(); - - Memory::Mapping mapping0 = memory.Map(); - Memory::Mapping mapping1 = clone.Map(); - - memory.reset(); - clone.reset(); - - int* data0 = mapping0.As<int>(); - int* data1 = mapping1.As<int>(); - EXPECT_NE(data0, data1); - data1[0] = 0; - data0[0] = 42; - EXPECT_EQ(42, data1[0]); -} - -} // namespace -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/memory_win.cc b/third_party/ipcz/src/reference_drivers/memory_win.cc deleted file mode 100644 index 77ef5b6..0000000 --- a/third_party/ipcz/src/reference_drivers/memory_win.cc +++ /dev/null
@@ -1,48 +0,0 @@ -// 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 "reference_drivers/memory.h" - -#include <windows.h> - -#include "reference_drivers/os_handle.h" -#include "third_party/abseil-cpp/absl/base/macros.h" -#include "util/safe_math.h" - -namespace ipcz::reference_drivers { - -void Memory::Mapping::Reset() { - if (base_address_) { - ::UnmapViewOfFile(base_address_); - } -} - -Memory::Memory(size_t size) { - HANDLE h = ::CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, - 0, checked_cast<DWORD>(size), nullptr); - const HANDLE process = ::GetCurrentProcess(); - HANDLE h2; - - // NOTE: DuplicateHandle is called here to remove some permissions from the - // handle (at least WRITE_DAC, among others). This allows the handle to be - // duplicated to other processes under strict sandboxing conditions, which may - // be useful in some test scenarios. - BOOL ok = ::DuplicateHandle(process, h, process, &h2, - FILE_MAP_READ | FILE_MAP_WRITE, FALSE, 0); - ::CloseHandle(h); - ABSL_ASSERT(ok); - - handle_ = OSHandle(h2); - size_ = size; -} - -Memory::Mapping Memory::Map() { - ABSL_ASSERT(is_valid()); - void* addr = ::MapViewOfFile(handle_.handle(), FILE_MAP_READ | FILE_MAP_WRITE, - 0, 0, size_); - ABSL_ASSERT(addr); - return Mapping(addr, size_); -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/os_handle.h b/third_party/ipcz/src/reference_drivers/os_handle.h deleted file mode 100644 index 1ed3802..0000000 --- a/third_party/ipcz/src/reference_drivers/os_handle.h +++ /dev/null
@@ -1,22 +0,0 @@ -// 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 IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_H_ -#define IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_H_ - -#include "build/build_config.h" - -#if BUILDFLAG(IS_WIN) -#include "reference_drivers/os_handle_win.h" -#elif BUILDFLAG(IS_MAC) -#include "reference_drivers/os_handle_mac.h" -#elif BUILDFLAG(IS_FUCHSIA) -#include "reference_drivers/os_handle_fuchsia.h" -#elif BUILDFLAG(IS_POSIX) -#include "reference_drivers/os_handle_posix.h" -#else -#error "Unsupported platform" -#endif - -#endif // IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_H_
diff --git a/third_party/ipcz/src/reference_drivers/os_handle_fuchsia.cc b/third_party/ipcz/src/reference_drivers/os_handle_fuchsia.cc deleted file mode 100644 index c329b7d2..0000000 --- a/third_party/ipcz/src/reference_drivers/os_handle_fuchsia.cc +++ /dev/null
@@ -1,37 +0,0 @@ -// 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 "reference_drivers/os_handle.h" - -#include <lib/zx/handle.h> -#include <zircon/status.h> - -#include "third_party/abseil-cpp/absl/base/macros.h" - -namespace ipcz::reference_drivers { - -OSHandle::OSHandle() = default; - -OSHandle::OSHandle(zx::handle handle) : handle_(std::move(handle)) {} - -OSHandle::OSHandle(OSHandle&& other) = default; - -OSHandle& OSHandle::operator=(OSHandle&& other) = default; - -OSHandle::~OSHandle() = default; - -void OSHandle::reset() { - handle_.reset(); -} - -OSHandle OSHandle::Clone() const { - ABSL_ASSERT(is_valid()); - - zx::handle dupe; - zx_status_t status = handle_.duplicate(ZX_RIGHT_SAME_RIGHTS, &dupe); - ABSL_ASSERT(status == ZX_OK); - return OSHandle(std::move(dupe)); -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/os_handle_fuchsia.h b/third_party/ipcz/src/reference_drivers/os_handle_fuchsia.h deleted file mode 100644 index 4f03657..0000000 --- a/third_party/ipcz/src/reference_drivers/os_handle_fuchsia.h +++ /dev/null
@@ -1,41 +0,0 @@ -// 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 IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_FUCHSIA_H_ -#define IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_FUCHSIA_H_ - -#include <lib/zx/handle.h> - -namespace ipcz::reference_drivers { - -// The Fuchsia OSHandle implementation can wrap any zx::handle. -class OSHandle { - public: - OSHandle(); - explicit OSHandle(zx::handle handle); - - OSHandle(const OSHandle&) = delete; - OSHandle& operator=(const OSHandle&) = delete; - - OSHandle(OSHandle&& other); - OSHandle& operator=(OSHandle&& other); - - ~OSHandle(); - - void reset(); - - // Duplicates the underlying handle, returning a new OSHandle to wrap it. The - // handle must be valid. - OSHandle Clone() const; - - bool is_valid() const { return handle_.is_valid(); } - const zx::handle& handle() const { return handle_; } - - private: - zx::handle handle_; -}; - -} // namespace ipcz::reference_drivers - -#endif // IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_FUCHSIA_H_
diff --git a/third_party/ipcz/src/reference_drivers/os_handle_mac.cc b/third_party/ipcz/src/reference_drivers/os_handle_mac.cc deleted file mode 100644 index a62061e..0000000 --- a/third_party/ipcz/src/reference_drivers/os_handle_mac.cc +++ /dev/null
@@ -1,76 +0,0 @@ -// 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 "reference_drivers/os_handle.h" - -#include <errno.h> -#include <mach/mach.h> -#include <mach/mach_vm.h> -#include <unistd.h> - -#include <utility> - -#include "third_party/abseil-cpp/absl/base/macros.h" - -namespace ipcz::reference_drivers { - -OSHandle::OSHandle() = default; - -OSHandle::OSHandle(Value value) : value_(value) {} - -OSHandle::OSHandle(OSHandle&& other) - : value_(std::exchange(other.value_, {})) {} - -OSHandle& OSHandle::operator=(OSHandle&& other) { - reset(); - value_ = std::exchange(other.value_, {}); - return *this; -} - -OSHandle::~OSHandle() { - reset(); -} - -void OSHandle::reset() { - if (is_valid_fd()) { - int rv = close(fd()); - ABSL_ASSERT(rv == 0 || errno == EINTR); - } else if (is_valid_mach_send_right()) { - kern_return_t kr = - mach_port_deallocate(mach_task_self(), mach_send_right()); - ABSL_ASSERT(kr == KERN_SUCCESS); - } else if (is_valid_mach_receive_right()) { - kern_return_t kr = mach_port_mod_refs( - mach_task_self(), mach_receive_right(), MACH_PORT_RIGHT_RECEIVE, -1); - ABSL_ASSERT(kr == KERN_SUCCESS); - } - - value_ = {}; -} - -OSHandle OSHandle::Clone() const { - ABSL_ASSERT(is_valid()); - - // Cloning of receive rights is not supported. - ABSL_ASSERT(!absl::holds_alternative<MachReceiveRight>(value_)); - - if (is_valid_fd()) { - int duped_fd = dup(fd()); - ABSL_ASSERT(duped_fd >= 0); - return OSHandle(FileDescriptor(duped_fd)); - } - - if (is_valid_mach_send_right()) { - kern_return_t kr = mach_port_mod_refs(mach_task_self(), mach_send_right(), - MACH_PORT_RIGHT_SEND, 1); - if (kr != KERN_SUCCESS) { - return OSHandle(); - } - return OSHandle(MachSendRight(mach_send_right())); - } - - return {}; -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/os_handle_mac.h b/third_party/ipcz/src/reference_drivers/os_handle_mac.h deleted file mode 100644 index 1c9d7e2..0000000 --- a/third_party/ipcz/src/reference_drivers/os_handle_mac.h +++ /dev/null
@@ -1,84 +0,0 @@ -// 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 IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_MAC_H_ -#define IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_MAC_H_ - -#include <mach/mach.h> - -#include "third_party/abseil-cpp/absl/base/macros.h" -#include "third_party/abseil-cpp/absl/types/variant.h" -#include "util/strong_alias.h" - -namespace ipcz::reference_drivers { - -// The macOS implementation of OSHandle supports wrapping a single Mach send -// right, or a POSIX file descriptor. -class OSHandle { - public: - using FileDescriptor = StrongAlias<class FileDescriptorTag, int>; - using MachSendRight = StrongAlias<class MachSendRightTag, mach_port_t>; - using MachReceiveRight = StrongAlias<class MachReceiveRightTag, mach_port_t>; - using Value = absl:: - variant<absl::monostate, FileDescriptor, MachSendRight, MachReceiveRight>; - - OSHandle(); - explicit OSHandle(Value value); - - OSHandle(const OSHandle&) = delete; - OSHandle& operator=(const OSHandle&) = delete; - - OSHandle(OSHandle&& other); - OSHandle& operator=(OSHandle&& other); - - ~OSHandle(); - - void reset(); - - // Duplicates the underlying handle, returning a new OSHandle to wrap it. - // The handle must be a valid file descriptor or Mach send right. Cloning of - // of Mach receive rights is not supported. - OSHandle Clone() const; - - bool is_valid() const { - return is_valid_fd() || is_valid_mach_send_right() || - is_valid_mach_receive_right(); - } - - bool is_valid_fd() const { - return absl::holds_alternative<FileDescriptor>(value_) && fd() != -1; - } - - bool is_valid_mach_send_right() const { - return absl::holds_alternative<MachSendRight>(value_) && - mach_send_right() != MACH_PORT_NULL; - } - - bool is_valid_mach_receive_right() const { - return absl::holds_alternative<MachReceiveRight>(value_) && - mach_receive_right() != MACH_PORT_NULL; - } - - int fd() const { - ABSL_ASSERT(is_valid_fd()); - return absl::get<FileDescriptor>(value_).value(); - } - - mach_port_t mach_send_right() const { - ABSL_ASSERT(is_valid_mach_send_right()); - return absl::get<MachSendRight>(value_).value(); - } - - mach_port_t mach_receive_right() const { - ABSL_ASSERT(is_valid_mach_receive_right()); - return absl::get<MachReceiveRight>(value_).value(); - } - - private: - Value value_; -}; - -} // namespace ipcz::reference_drivers - -#endif // IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_MAC_H_
diff --git a/third_party/ipcz/src/reference_drivers/os_handle_posix.cc b/third_party/ipcz/src/reference_drivers/os_handle_posix.cc deleted file mode 100644 index c96dbdf..0000000 --- a/third_party/ipcz/src/reference_drivers/os_handle_posix.cc +++ /dev/null
@@ -1,46 +0,0 @@ -// 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 "reference_drivers/os_handle.h" - -#include <errno.h> -#include <unistd.h> - -#include <utility> - -#include "third_party/abseil-cpp/absl/base/macros.h" - -namespace ipcz::reference_drivers { - -OSHandle::OSHandle() = default; - -OSHandle::OSHandle(int fd) : fd_(fd) {} - -OSHandle::OSHandle(OSHandle&& other) : fd_(std::exchange(other.fd_, -1)) {} - -OSHandle& OSHandle::operator=(OSHandle&& other) { - reset(); - fd_ = std::exchange(other.fd_, -1); - return *this; -} - -OSHandle::~OSHandle() { - reset(); -} - -void OSHandle::reset() { - int fd = std::exchange(fd_, -1); - if (fd >= 0) { - int rv = close(fd); - ABSL_ASSERT(rv == 0 || errno == EINTR); - } -} - -OSHandle OSHandle::Clone() const { - ABSL_ASSERT(is_valid()); - int dupe = dup(fd_); - return OSHandle(dupe); -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/os_handle_posix.h b/third_party/ipcz/src/reference_drivers/os_handle_posix.h deleted file mode 100644 index 0ab5efc2..0000000 --- a/third_party/ipcz/src/reference_drivers/os_handle_posix.h +++ /dev/null
@@ -1,40 +0,0 @@ -// 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 IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_POSIX_H_ -#define IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_POSIX_H_ - -namespace ipcz::reference_drivers { - -// The POSIX OSHandle implementation wraps a file descriptor. -class OSHandle { - public: - OSHandle(); - explicit OSHandle(int fd); - - OSHandle(const OSHandle&) = delete; - OSHandle& operator=(const OSHandle&) = delete; - - OSHandle(OSHandle&& other); - OSHandle& operator=(OSHandle&& other); - - ~OSHandle(); - - void reset(); - - // Duplicates the underlying handle, returning a new OSHandle to wrap it. The - // handle must be valid. - OSHandle Clone() const; - - bool is_valid() const { return fd_ != -1; } - - int fd() const { return fd_; } - - private: - int fd_ = -1; -}; - -} // namespace ipcz::reference_drivers - -#endif // IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_POSIX_H_
diff --git a/third_party/ipcz/src/reference_drivers/os_handle_win.cc b/third_party/ipcz/src/reference_drivers/os_handle_win.cc deleted file mode 100644 index 570f45ea..0000000 --- a/third_party/ipcz/src/reference_drivers/os_handle_win.cc +++ /dev/null
@@ -1,54 +0,0 @@ -// 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 "reference_drivers/os_handle.h" - -#include <windows.h> - -#include <utility> - -#include "third_party/abseil-cpp/absl/base/macros.h" - -namespace ipcz::reference_drivers { - -OSHandle::OSHandle() = default; - -OSHandle::OSHandle(HANDLE handle) : handle_(handle) {} - -OSHandle::OSHandle(OSHandle&& other) - : handle_(std::exchange(other.handle_, INVALID_HANDLE_VALUE)) {} - -OSHandle& OSHandle::operator=(OSHandle&& other) { - reset(); - handle_ = std::exchange(other.handle_, INVALID_HANDLE_VALUE); - return *this; -} - -OSHandle::~OSHandle() { - reset(); -} - -void OSHandle::reset() { - HANDLE handle = std::exchange(handle_, INVALID_HANDLE_VALUE); - if (handle != INVALID_HANDLE_VALUE) { - ::CloseHandle(handle); - } -} - -OSHandle OSHandle::Clone() const { - ABSL_ASSERT(is_valid()); - - HANDLE dupe; - BOOL result = - ::DuplicateHandle(::GetCurrentProcess(), handle_, ::GetCurrentProcess(), - &dupe, 0, FALSE, DUPLICATE_SAME_ACCESS); - if (!result) { - return OSHandle(); - } - - ABSL_ASSERT(dupe != INVALID_HANDLE_VALUE); - return OSHandle(dupe); -} - -} // namespace ipcz::reference_drivers
diff --git a/third_party/ipcz/src/reference_drivers/os_handle_win.h b/third_party/ipcz/src/reference_drivers/os_handle_win.h deleted file mode 100644 index 2506f95..0000000 --- a/third_party/ipcz/src/reference_drivers/os_handle_win.h +++ /dev/null
@@ -1,42 +0,0 @@ -// 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 IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_WIN_H_ -#define IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_WIN_H_ - -#include <windows.h> - -namespace ipcz::reference_drivers { - -// The Windows OSHandle implementation can wrap any HANDLE value. -class OSHandle { - public: - OSHandle(); - explicit OSHandle(HANDLE handle); - - OSHandle(const OSHandle&) = delete; - OSHandle& operator=(const OSHandle&) = delete; - - OSHandle(OSHandle&& other); - OSHandle& operator=(OSHandle&& other); - - ~OSHandle(); - - void reset(); - - // Duplicates the underlying handle, returning a new OSHandle to wrap it. The - // handle must be valid. - OSHandle Clone() const; - - bool is_valid() const { return handle_ != INVALID_HANDLE_VALUE; } - - HANDLE handle() const { return handle_; } - - private: - HANDLE handle_ = INVALID_HANDLE_VALUE; -}; - -} // namespace ipcz::reference_drivers - -#endif // IPCZ_SRC_REFERENCE_DRIVERS_OS_HANDLE_WIN_H_
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 78dfc930..ead86e3 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -354,6 +354,7 @@ 'Site Isolation Android': 'android_release_bot_minimal_symbols_arm64_reclient', 'VR Linux': 'vr_release_bot_reclient', 'Win 10 Fast Ring': 'release_trybot_minimal_symbols_reclient', + 'Win x64 Builder (py2 less)': 'gpu_tests_release_bot_minimal_symbols_reclient', 'Win x64 Builder (reclient compare)': 'gpu_tests_release_bot_minimal_symbols_reclient', 'Win x64 Builder (reclient)': 'gpu_tests_release_bot_minimal_symbols_reclient', 'Win x64 Builder (reclient)(cross)': 'gpu_tests_release_bot_minimal_symbols_reclient_win_cross',
diff --git a/tools/mb/mb_config_expectations/chromium.fyi.json b/tools/mb/mb_config_expectations/chromium.fyi.json index d86dc71b..ac1fd0df 100644 --- a/tools/mb/mb_config_expectations/chromium.fyi.json +++ b/tools/mb/mb_config_expectations/chromium.fyi.json
@@ -433,6 +433,18 @@ "use_remoteexec": true } }, + "Win x64 Builder (py2 less)": { + "gn_args": { + "dcheck_always_on": false, + "ffmpeg_branding": "Chrome", + "is_component_build": false, + "is_debug": false, + "proprietary_codecs": true, + "symbol_level": 1, + "use_rbe": true, + "use_remoteexec": true + } + }, "Win x64 Builder (reclient compare)": { "gn_args": { "dcheck_always_on": false,
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 3f3091b4..708b14e 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -1618,13 +1618,6 @@ <int value="2" label="Warning canceled"/> </enum> -<enum name="AlpacaPort"> - <int value="0" label="26"/> - <int value="1" label="989"/> - <int value="2" label="990"/> - <int value="3" label="2525"/> -</enum> - <enum name="AlpsDecoderError"> <int value="0" label="NoError"/> <int value="1" label="FramingError"/> @@ -14887,6 +14880,7 @@ <int value="41" label="kSecurePaymentConfirmationInstruments"/> <int value="42" label="kWebAppHistory"/> <int value="43" label="kWebAuthnCredentials"/> + <int value="44" label="kWebrtcVideoPerfHistory"/> </enum> <enum name="ChromeChannelForHistogram"> @@ -21103,16 +21097,22 @@ <int value="0" label="Unknown"/> <int value="1" label="ZIP"/> <int value="2" label="RAR"/> - <int value="3" label="Tar"/> - <int value="4" label="Bzip2-compressed Tar"/> - <int value="5" label="Gzip-compressed Tar"/> - <int value="6" label="Bzip2-compressed Other"/> - <int value="7" label="Gzip-compressed Other"/> - <int value="8" label="7z"/> - <int value="9" label="Crx"/> - <int value="10" label="Iso"/> - <int value="11" label="Xz-compressed Tar"/> - <int value="12" label="Xz-compressed Other"/> + <int value="3" label="TAR">Uncompressed TAR</int> + <int value="4" label="TAR.BZ2">Bzip2-compressed TAR</int> + <int value="5" label="TAR.GZ">Gzip-compressed TAR</int> + <int value="6" label="BZ2">Bzip2-compressed File</int> + <int value="7" label="GZ">Gzip-compressed File</int> + <int value="8" label="7Z">7-Zip</int> + <int value="9" label="CRX">Chrome Extension</int> + <int value="10" label="ISO">ISO image</int> + <int value="11" label="TAR.XZ">XZ-compressed TAR</int> + <int value="12" label="XZ">XZ-compressed File</int> + <int value="13" label="TAR.LZMA">LZMA-compressed TAR</int> + <int value="14" label="LZMA">LZMA-compressed File</int> + <int value="15" label="TAR.Z">Z-compressed TAR</int> + <int value="16" label="Z">Z-compressed File</int> + <int value="17" label="TAR.ZST">Zstandard-compressed TAR</int> + <int value="18" label="ZST">Zstandard-compressed File</int> </enum> <enum name="CrosDisksClientFormatError"> @@ -54931,6 +54931,8 @@ <int value="-1830709105" label="OmniboxPedalsBatch3NonEnglish:disabled"/> <int value="-1830472348" label="CryptAuthV2DeviceSync:enabled"/> <int value="-1830199297" label="force-empty-corb-allowlist"/> + <int value="-1829204930" + label="ForceGpuMainThreadToNormalPriorityDrDc:disabled"/> <int value="-1827599944" label="QueryTilesLocalOrdering:enabled"/> <int value="-1826649921" label="ContextualSuggestionsButton:disabled"/> <int value="-1826309726" label="ArcCustomTabsExperiment:disabled"/> @@ -56788,6 +56790,8 @@ <int value="-619740638" label="ListAllDisplayModes:enabled"/> <int value="-619665653" label="DisableKeepaliveFetch:disabled"/> <int value="-619178844" label="NewOverviewLayout:disabled"/> + <int value="-617851128" + label="ForceGpuMainThreadToNormalPriorityDrDc:enabled"/> <int value="-617452890" label="media-router"/> <int value="-616818899" label="SameSiteByDefaultCookies:enabled"/> <int value="-616508634" label="DisableCryptAuthV1DeviceSync:enabled"/> @@ -70639,6 +70643,10 @@ <int value="2" label="The permission that onboarding necessary is granted by user action"/> + <int value="3" label="The permission request declines"/> + <int value="4" label="The permission request time out"/> + <int value="5" label="Users turn off the screen"/> + <int value="6" label="System exceptions thrown out"/> </enum> <enum name="OnServiceConnectedTimedOutResult">
diff --git a/tools/metrics/histograms/metadata/borealis/histograms.xml b/tools/metrics/histograms/metadata/borealis/histograms.xml index e75886ff..1b1880b 100644 --- a/tools/metrics/histograms/metadata/borealis/histograms.xml +++ b/tools/metrics/histograms/metadata/borealis/histograms.xml
@@ -134,6 +134,34 @@ </token> </histogram> +<histogram name="Borealis.Disk.StatefulReadsDaily" units="KiB" + expires_after="2023-05-05"> + <owner>philpearson@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary>Borealis stateful KiB read per day. Reported daily.</summary> +</histogram> + +<histogram name="Borealis.Disk.StatefulWritesDaily" units="KiB" + expires_after="2023-05-05"> + <owner>philpearson@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary>Borealis stateful KiB written per day. Reported daily.</summary> +</histogram> + +<histogram name="Borealis.Disk.SwapReadsDaily" units="KiB" + expires_after="2023-05-05"> + <owner>philpearson@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary>Borealis swap file KiB read per day. Reported daily.</summary> +</histogram> + +<histogram name="Borealis.Disk.SwapWritesDaily" units="KiB" + expires_after="2023-05-05"> + <owner>philpearson@google.com</owner> + <owner>src/chrome/browser/ash/borealis/OWNERS</owner> + <summary>Borealis swap file KiB written per day. Reported daily.</summary> +</histogram> + <histogram name="Borealis.EngagementTime.{Variant}" units="ms" expires_after="2023-02-01"> <owner>lqu@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/ios/histograms.xml b/tools/metrics/histograms/metadata/ios/histograms.xml index 9ef2f0e..5272fb8 100644 --- a/tools/metrics/histograms/metadata/ios/histograms.xml +++ b/tools/metrics/histograms/metadata/ios/histograms.xml
@@ -520,6 +520,59 @@ </summary> </histogram> +<histogram name="IOS.FirstRun.ScrollButtonVisible.{FirstRunScreen}" + enum="Boolean" expires_after="2022-11-09"> + <owner>ginnyhuang@chromium.org</owner> + <owner>bling-team@google.com</owner> + <summary> + Depending on the text size of the system, the first run screens would either + show buttons intended for the purpose of the view, or a "More" + button. In the latter scenario, tapping on the button would trigger a scroll + down, and would transform into the intended action buttons when the user has + scrolled down to the bottom of the view. This histogram counts the frequency + for each type of screen of the "More" button showing on the view + first appears, instead of the intended action buttons. + </summary> + <token key="FirstRunScreen"> + <variant name="DefaultBrowserPromoScreen" + summary="The new FRE screen that instructs the user to set default + browser to Chrome."/> + <variant name="SignInScreenWithFooter" + summary="The screen that asks the user to sign in when no stored + account is detected, with a footer shown at the bottom. + Displayed when MICe is enabled without the welcome screen + (2-steps MICe FRE), or when forced sign-in is enabled."/> + <variant name="SignInScreenWithFooterAndIdentityPicker" + summary="The screen that asks the user to sign in a stored account, + with a footer shown at the bottom. Displayed when MICe is + enabled without the welcome screen (2-steps MICe FRE), or + when forced sign-in is enabled."/> + <variant name="SignInScreenWithIdentityPicker" + summary="The screen that asks the user to sign in a stored account, + but with no footer shown at the bottom. Displayed when MICe + is enabled with the welcome screen (3-steps MICe FRE)."/> + <variant name="SignInScreenWithoutFooterOrIdentityPicker" + summary="The screen that asks the user to sign in when no stored + account is detected, but with no footer shown at the bottom. + Displayed when MICe is enabled with the welcome screen + (3-steps MICe FRE)."/> + <variant name="SyncScreenWithIdentityPicker" + summary="The screen that asks the user to turn on sync while showing + an account picker. Displayed when MICe is disabled and an + account is detected."/> + <variant name="SyncScreenWithoutIdentityPicker" + summary="The screen that asks the user to turn on sync while no + account picker is present. Displayed when MICe is enabled or + when no account is detected."/> + <variant name="WelcomeScreenWithoutUMACheckbox" + summary="Welcome screen without UMA checkbox. Displayed when MICe is + enabled."/> + <variant name="WelcomeScreenWithUMACheckbox" + summary="Welcome screen with UMA checkbox. Displayed when MICe is + disabled."/> + </token> +</histogram> + <histogram name="IOS.FormInputAccessory.ExecuteFormAssistActionException" enum="FormInputAccessoryAction" expires_after="2022-12-11"> <owner>rohitrao@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/net/histograms.xml b/tools/metrics/histograms/metadata/net/histograms.xml index 468680a..95588be 100644 --- a/tools/metrics/histograms/metadata/net/histograms.xml +++ b/tools/metrics/histograms/metadata/net/histograms.xml
@@ -1953,20 +1953,6 @@ </summary> </histogram> -<histogram name="Net.Port.Alpaca" enum="AlpacaPort" expires_after="2022-06-19"> - <owner>ricea@chromium.org</owner> - <owner>yhirano@chromium.org</owner> - <summary> - Ports which may be restricted to mitigate the NAT Slipstream 2.0 - vulnerability. Logged only for affected ports which are passed to - net::IsPortAllowedForScheme(). - - A top-level navigation will be counted 4 times, whereas a subresource will - only be counted once. This is not intentional, but may be useful to estimate - the level of breakage. - </summary> -</histogram> - <histogram name="Net.Prefetch.HitBytes" units="bytes" expires_after="M87"> <owner>jkarlin@chromium.org</owner> <summary>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 90d9a37..8788f68 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -13,8 +13,8 @@ "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux_arm/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "mac": { - "hash": "64fd82d275dcd99827bdd14de3d41f70c6363a3c", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/a4217a18debea8b9f02ab15f65097533568bf810/trace_processor_shell" + "hash": "34d7e92cd24af1bd24f584b2849b7558428f2687", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/370def59dcc5b6423f805754160cab7c5b772c2d/trace_processor_shell" }, "mac_arm64": { "hash": "e1ad4861384b06d911a65f035317914b8cc975c6",
diff --git a/tools/typescript/definitions/passwords_private.d.ts b/tools/typescript/definitions/passwords_private.d.ts index ac94836..8835d5058 100644 --- a/tools/typescript/definitions/passwords_private.d.ts +++ b/tools/typescript/definitions/passwords_private.d.ts
@@ -99,6 +99,7 @@ url: string; username: string; password: string; + note: string; useAccountStore: boolean; }
diff --git a/ui/aura/screen_ozone.cc b/ui/aura/screen_ozone.cc index a78a6a4..d133110 100644 --- a/ui/aura/screen_ozone.cc +++ b/ui/aura/screen_ozone.cc
@@ -13,13 +13,10 @@ namespace aura { -ScreenOzone::ScreenOzone() { - DCHECK(!display::Screen::HasScreen()); - display::Screen::SetScreenInstance(this); -} +ScreenOzone::ScreenOzone() = default; ScreenOzone::~ScreenOzone() { - display::Screen::SetScreenInstance(nullptr); + display::Screen::SetScreenInstance(old_screen_); } void ScreenOzone::Initialize() { @@ -37,11 +34,6 @@ } } -// static -bool ScreenOzone::IsOzoneInitialized() { - return ui::OzonePlatform::IsInitialized(); -} - gfx::Point ScreenOzone::GetCursorScreenPoint() { return platform_screen_->GetCursorScreenPoint(); } @@ -157,17 +149,4 @@ void ScreenOzone::OnBeforePlatformScreenInit() {} -ScopedScreenOzone::ScopedScreenOzone(const base::Location& location) - : ScopedNativeScreen(/*call_maybe_init=*/false, location) { - MaybeInit(); -} - -ScopedScreenOzone::~ScopedScreenOzone() = default; - -display::Screen* ScopedScreenOzone::CreateScreen() { - auto* screen = new ScreenOzone(); - screen->Initialize(); - return screen; -} - } // namespace aura
diff --git a/ui/aura/screen_ozone.h b/ui/aura/screen_ozone.h index 2970a0e..980c083b 100644 --- a/ui/aura/screen_ozone.h +++ b/ui/aura/screen_ozone.h
@@ -60,8 +60,6 @@ virtual gfx::NativeWindow GetNativeWindowFromAcceleratedWidget( gfx::AcceleratedWidget widget) const; - static bool IsOzoneInitialized(); - protected: ui::PlatformScreen* platform_screen() { return platform_screen_.get(); } @@ -75,22 +73,10 @@ virtual void OnBeforePlatformScreenInit(); + display::Screen* const old_screen_ = display::Screen::SetScreenInstance(this); std::unique_ptr<ui::PlatformScreen> platform_screen_; }; -// ScopedScreenOzone creates a ScreenOzone instead of NativeScreen -// (created by `CreateNativeScreen()`) if the screen hasn't been set. -class AURA_EXPORT ScopedScreenOzone : public display::ScopedNativeScreen { - public: - explicit ScopedScreenOzone(const base::Location& location = FROM_HERE); - ScopedScreenOzone(const ScopedScreenOzone&) = delete; - ScopedScreenOzone operator=(const ScopedScreenOzone&) = delete; - ~ScopedScreenOzone() override; - - private: - display::Screen* CreateScreen() override; -}; - } // namespace aura #endif // UI_AURA_SCREEN_OZONE_H_
diff --git a/ui/base/models/dialog_model.h b/ui/base/models/dialog_model.h index dd36cad..5fcea5f3 100644 --- a/ui/base/models/dialog_model.h +++ b/ui/base/models/dialog_model.h
@@ -134,8 +134,10 @@ return *this; } - Builder& SetIcon(ImageModel icon) { + Builder& SetIcon(ImageModel icon, + ImageModel dark_mode_icon = ImageModel()) { model_->icon_ = std::move(icon); + model_->dark_mode_icon_ = std::move(dark_mode_icon); return *this; } @@ -353,6 +355,10 @@ const ImageModel& icon(base::PassKey<DialogModelHost>) const { return icon_; } + const ImageModel& dark_mode_icon(base::PassKey<DialogModelHost>) const { + return dark_mode_icon_; + } + absl::optional<int> initially_focused_field( base::PassKey<DialogModelHost>) const { return initially_focused_field_; @@ -405,6 +411,7 @@ std::string internal_name_; std::u16string title_; ImageModel icon_; + ImageModel dark_mode_icon_; std::vector<std::unique_ptr<DialogModelField>> fields_; absl::optional<int> initially_focused_field_;
diff --git a/ui/base/test/cocoa_helper.h b/ui/base/test/cocoa_helper.h index c9030fe..4ec09b1 100644 --- a/ui/base/test/cocoa_helper.h +++ b/ui/base/test/cocoa_helper.h
@@ -13,7 +13,6 @@ #import "base/mac/scoped_nsobject.h" #import "base/strings/sys_string_conversions.h" #include "testing/platform_test.h" -#include "ui/display/screen.h" // CocoaTestHelperWindow behaves differently from a regular NSWindow in the // following ways: @@ -75,8 +74,6 @@ CocoaTestHelperWindow* test_window(); private: - display::ScopedNativeScreen screen_; - // Return a set of currently open windows. Avoiding NSArray so // contents aren't retained, the pointer values can only be used for // comparison purposes. Using std::set to make progress-checking
diff --git a/ui/display/display.cc b/ui/display/display.cc index 2871e5b..3693f89 100644 --- a/ui/display/display.cc +++ b/ui/display/display.cc
@@ -34,7 +34,7 @@ // -1.0, we read the forced device scale factor again. float g_forced_device_scale_factor = -1.0; -// An allowance error epsilon caused by fractional scale factor to produce +// An alloance error epsilon cauesd by fractional scale factor to produce // expected DP display size. constexpr float kDisplaySizeAllowanceEpsilon = 0.01f;
diff --git a/ui/display/display.h b/ui/display/display.h index faaf504..5a9b7ec 100644 --- a/ui/display/display.h +++ b/ui/display/display.h
@@ -172,7 +172,7 @@ gfx::Insets GetWorkAreaInsets() const; // Sets the device scale factor and display bounds in pixel. This - // updates the work area using the same insets between old bounds and + // updates the work are using the same insets between old bounds and // work area. void SetScaleAndBounds(float device_scale_factor, const gfx::Rect& bounds_in_pixel);
diff --git a/ui/display/display_list.h b/ui/display/display_list.h index 4c90bea3..2eb14bc 100644 --- a/ui/display/display_list.h +++ b/ui/display/display_list.h
@@ -71,9 +71,6 @@ bool IsValid() const; base::ObserverList<DisplayObserver>* observers() { return &observers_; } - const base::ObserverList<DisplayObserver>* observers() const { - return &observers_; - } private: // A non-const version of FindDisplayById.
diff --git a/ui/display/screen.cc b/ui/display/screen.cc index b972388..2225ae6 100644 --- a/ui/display/screen.cc +++ b/ui/display/screen.cc
@@ -31,7 +31,8 @@ // static Screen* Screen::GetScreen() { -#if BUILDFLAG(IS_IOS) +#if BUILDFLAG(IS_APPLE) + // TODO(scottmg): https://crbug.com/558054 if (!g_screen) g_screen = CreateNativeScreen(); #endif @@ -39,23 +40,10 @@ } // static -Screen* Screen::SetScreenInstance(Screen* instance, - const base::Location& location) { - // Do not allow screen instance override. The screen object has a lot of - // states, such as current display settings as well as observers, and safely - // transferring these to new screen implementation is very difficult and not - // safe. If you hit the DCHECK in a test, please look for other examples that - // that set a test screen instance in the setup process. - DCHECK(!g_screen || !instance || (instance && instance->shutdown_)) - << "fail=" << location.ToString(); +Screen* Screen::SetScreenInstance(Screen* instance) { return std::exchange(g_screen, instance); } -// static -bool Screen::HasScreen() { - return !!g_screen; -} - void Screen::SetCursorScreenPointForTesting(const gfx::Point& point) { NOTIMPLEMENTED_LOG_ONCE(); } @@ -225,49 +213,4 @@ return result; } -#if !BUILDFLAG(IS_ANDROID) - -ScopedNativeScreen::ScopedNativeScreen(const base::Location& location) { - MaybeInit(location); -} - -ScopedNativeScreen::ScopedNativeScreen(bool call_maybe_init, - const base::Location& location) { - if (call_maybe_init) - MaybeInit(location); -} - -ScopedNativeScreen::~ScopedNativeScreen() { - Shutdown(); -} - -void ScopedNativeScreen::MaybeInit(const base::Location& location) { - maybe_init_called_ = true; - if (!Screen::HasScreen()) { -#if BUILDFLAG(IS_IOS) - Screen::GetScreen(); -#else - screen_ = base::WrapUnique(CreateScreen()); - // ScreenOzone and DesktopScreenWin sets the instance by itself. - if (Screen::GetScreen() != screen_.get()) - Screen::SetScreenInstance(screen_.get(), location); -#endif - } -} - -void ScopedNativeScreen::Shutdown() { - DCHECK(maybe_init_called_); - if (screen_) { - DCHECK_EQ(screen_.get(), Screen::GetScreen()); - Screen::SetScreenInstance(nullptr); - screen_.reset(); - } -} - -Screen* ScopedNativeScreen::CreateScreen() { - return CreateNativeScreen(); -} - -#endif - } // namespace display
diff --git a/ui/display/screen.h b/ui/display/screen.h index a86c5b6..3771a345 100644 --- a/ui/display/screen.h +++ b/ui/display/screen.h
@@ -9,9 +9,8 @@ #include <set> #include <vector> -#include "base/location.h" #include "base/values.h" -#include "build/build_config.h" +#include "build/chromeos_buildflags.h" #include "ui/display/display.h" #include "ui/display/display_export.h" #include "ui/display/screen_infos.h" @@ -48,20 +47,13 @@ virtual ~Screen(); - // Retrieves the single Screen object; this may be null if it's not already - // created, except for IOS where it creates a native screen instance - // automatically. + // Retrieves the single Screen object; this may be null (e.g. in some tests). static Screen* GetScreen(); - // Returns whether a Screen singleton exists or not. - static bool HasScreen(); - - // [Deprecated] as a public method. Do not use this. // Sets the global screen. Returns the previously installed screen, if any. // NOTE: this does not take ownership of |screen|. Tests must be sure to reset // any state they install. - static Screen* SetScreenInstance(Screen* instance, - const base::Location& location = FROM_HERE); + static Screen* SetScreenInstance(Screen* instance); // Returns the current absolute position of the mouse pointer. virtual gfx::Point GetCursorScreenPoint() = 0; @@ -206,8 +198,6 @@ virtual bool SetScreenSaverSuspended(bool suspend); #endif // BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) - void set_shutdown(bool shutdown) { shutdown_ = shutdown; } - private: friend class ScopedDisplayForNewWindows; @@ -218,9 +208,6 @@ static gfx::NativeWindow GetWindowForView(gfx::NativeView view); - // A flag indicates that the instance is a special one used during shutdown. - bool shutdown_ = false; - int64_t display_id_for_new_windows_; int64_t scoped_display_id_for_new_windows_ = display::kInvalidDisplayId; @@ -229,41 +216,7 @@ #endif // BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) }; -// TODO(crbug.com/1317416): Make this static private member of -// ScopedNativeScreen. -DISPLAY_EXPORT Screen* CreateNativeScreen(); - -// Android does not have `CreateNativeScreen()`. -#if !BUILDFLAG(IS_ANDROID) - -// ScopedNativeScreen creates a native screen if there is no screen created yet -// (e.g. by a unit test). -class DISPLAY_EXPORT ScopedNativeScreen { - public: - explicit ScopedNativeScreen(const base::Location& location = FROM_HERE); - ScopedNativeScreen(const ScopedNativeScreen&) = delete; - ScopedNativeScreen& operator=(const ScopedNativeScreen&) = delete; - virtual ~ScopedNativeScreen(); - - // Create and initialize the screen instance if the screen instance does not - // exist yet. - void MaybeInit(const base::Location& location = FROM_HERE); - void Shutdown(); - - Screen* screen() { return screen_.get(); } - - virtual Screen* CreateScreen(); - - protected: - explicit ScopedNativeScreen(bool call_maybe_init, - const base::Location& location = FROM_HERE); - - private: - bool maybe_init_called_{false}; - std::unique_ptr<Screen> screen_; -}; - -#endif +Screen* CreateNativeScreen(); } // namespace display
diff --git a/ui/display/screen_base.cc b/ui/display/screen_base.cc index 2e9e375..03d89f0 100644 --- a/ui/display/screen_base.cc +++ b/ui/display/screen_base.cc
@@ -75,10 +75,6 @@ display_list_.RemoveObserver(observer); } -bool ScreenBase::HasDisplayObservers() const { - return !display_list_.observers()->empty(); -} - void ScreenBase::SetPanelRotationForTesting(int64_t display_id, Display::Rotation rotation) { Display display = *display_list_.FindDisplayById(display_id);
diff --git a/ui/display/screen_base.h b/ui/display/screen_base.h index ef3f7013..1b63863 100644 --- a/ui/display/screen_base.h +++ b/ui/display/screen_base.h
@@ -45,8 +45,6 @@ void SetPanelRotationForTesting(int64_t display_id, Display::Rotation rotation) override; - bool HasDisplayObservers() const; - protected: // Invoked when a display changed in some way, including being added. // If |is_primary| is true, |changed_display| is the primary display.
diff --git a/ui/display/test/scoped_screen_override.h b/ui/display/test/scoped_screen_override.h index aba5307f..0ba1c31 100644 --- a/ui/display/test/scoped_screen_override.h +++ b/ui/display/test/scoped_screen_override.h
@@ -11,8 +11,6 @@ namespace test { -// [Deprecated] Do not use this in new code. -// // This class represents a RAII wrapper for global screen overriding. An object // of this class restores original display::Screen instance when it goes out of // scope. Prefer to use it instead of directly call of
diff --git a/ui/display/test/test_screen.cc b/ui/display/test/test_screen.cc index af96e29..e2ae5bb5 100644 --- a/ui/display/test/test_screen.cc +++ b/ui/display/test/test_screen.cc
@@ -10,33 +10,18 @@ namespace display { namespace test { -namespace { -TestScreen* test_screen = nullptr; -} // static constexpr gfx::Rect TestScreen::kDefaultScreenBounds; TestScreen::TestScreen(bool create_display) { - DCHECK(!test_screen); - test_screen = this; - if (!create_display) return; Display display(1, kDefaultScreenBounds); ProcessDisplayChanged(display, /* is_primary = */ true); } -TestScreen::~TestScreen() { - DCHECK_EQ(test_screen, this); - test_screen = nullptr; -} - -// static -TestScreen* TestScreen::Get() { - DCHECK_EQ(Screen::GetScreen(), test_screen); - return test_screen; -} +TestScreen::~TestScreen() {} void TestScreen::set_cursor_screen_point(const gfx::Point& point) { cursor_screen_point_ = point;
diff --git a/ui/display/test/test_screen.h b/ui/display/test/test_screen.h index 9962e07..ff7fe07 100644 --- a/ui/display/test/test_screen.h +++ b/ui/display/test/test_screen.h
@@ -21,8 +21,6 @@ public: static constexpr gfx::Rect kDefaultScreenBounds = gfx::Rect(0, 0, 800, 600); - static TestScreen* Get(); - // TODO(weili): Split this into a protected no-argument constructor for // subclass uses and the public one with gfx::Size argument. explicit TestScreen(bool create_display = true);
diff --git a/ui/display/win/test/scoped_screen_win.cc b/ui/display/win/test/scoped_screen_win.cc index edb39b8c..84c1b4ca 100644 --- a/ui/display/win/test/scoped_screen_win.cc +++ b/ui/display/win/test/scoped_screen_win.cc
@@ -20,6 +20,10 @@ gfx::Vector2dF(96.0, 96.0), DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER}}); } +ScopedScreenWin::~ScopedScreenWin() { + Screen::SetScreenInstance(old_screen_); +} + } // namespace test } // namespace win } // namespace display
diff --git a/ui/display/win/test/scoped_screen_win.h b/ui/display/win/test/scoped_screen_win.h index 0633d2e..ca6cb2c 100644 --- a/ui/display/win/test/scoped_screen_win.h +++ b/ui/display/win/test/scoped_screen_win.h
@@ -12,10 +12,6 @@ namespace win { namespace test { -// [Deprecated] -// TODO(crbug.com/1317416): The initialization code of this class should be -// moved to the test that depends on it. -// // ScopedScreenWin construct a instance of ScreenWinDisplay with bounds // (1920,1080). This will allow unittests to query the details about ScreenWin // using static methods. ScopedScreenWin needs to be initialized before running @@ -27,7 +23,10 @@ ScopedScreenWin(const ScopedScreenWin&) = delete; ScopedScreenWin& operator=(const ScopedScreenWin&) = delete; - ~ScopedScreenWin() override = default; + ~ScopedScreenWin() override; + + private: + raw_ptr<Screen> old_screen_ = Screen::SetScreenInstance(this); }; } // namespace test
diff --git a/ui/file_manager/integration_tests/file_manager/recents.js b/ui/file_manager/integration_tests/file_manager/recents.js index c1d1761..eb6cb896 100644 --- a/ui/file_manager/integration_tests/file_manager/recents.js +++ b/ui/file_manager/integration_tests/file_manager/recents.js
@@ -525,9 +525,10 @@ testcase.recentDocumentsDownloadsAndDrive = async () => { const appId = await setupAndWaitUntilReady( RootPath.DOWNLOADS, [RECENTLY_MODIFIED_DOCUMENT], - [RECENTLY_MODIFIED_DOCUMENT]); + [RECENTLY_MODIFIED_DOCUMENT, RECENTLY_MODIFIED_VIDEO]); // RECENTLY_MODIFIED_DOCUMENT exists in both local and drive folder, the - // file will appear twice in the result. + // file will appear twice in the result. RECENTLY_MODIFIED_VIDEO won't + // be included because it's not a Document. await verifyRecentDocuments( appId, [RECENTLY_MODIFIED_DOCUMENT, RECENTLY_MODIFIED_DOCUMENT]); };
diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn index 1ab4bd9..626e9ebf 100644 --- a/ui/ozone/platform/wayland/BUILD.gn +++ b/ui/ozone/platform/wayland/BUILD.gn
@@ -163,8 +163,6 @@ "host/wayland_window_manager.h", "host/wayland_window_observer.cc", "host/wayland_window_observer.h", - "host/wayland_zaura_output.cc", - "host/wayland_zaura_output.h", "host/wayland_zaura_shell.cc", "host/wayland_zaura_shell.h", "host/wayland_zcr_cursor_shapes.cc", @@ -470,8 +468,6 @@ "test/test_wp_pointer_gestures.h", "test/test_xdg_popup.cc", "test/test_xdg_popup.h", - "test/test_zaura_output.cc", - "test/test_zaura_output.h", "test/test_zcr_text_input_extension.cc", "test/test_zcr_text_input_extension.h", "test/test_zwp_linux_buffer_params.cc", @@ -533,7 +529,6 @@ "host/wayland_window_drag_controller_unittest.cc", "host/wayland_window_manager_unittests.cc", "host/wayland_window_unittest.cc", - "host/wayland_zaura_output_unittest.cc", "host/wayland_zaura_shell_unittest.cc", "host/wayland_zwp_pointer_gestures_unittest.cc", "test/wayland_drag_drop_test.cc",
diff --git a/ui/ozone/platform/wayland/common/wayland_object.cc b/ui/ozone/platform/wayland/common/wayland_object.cc index 580491c..b7625c6 100644 --- a/ui/ozone/platform/wayland/common/wayland_object.cc +++ b/ui/ozone/platform/wayland/common/wayland_object.cc
@@ -167,7 +167,6 @@ IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_surface) IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_toplevel) IMPLEMENT_WAYLAND_OBJECT_TRAITS(xdg_wm_base) -IMPLEMENT_WAYLAND_OBJECT_TRAITS(zaura_output) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zaura_shell) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zaura_surface) IMPLEMENT_WAYLAND_OBJECT_TRAITS(zaura_toplevel)
diff --git a/ui/ozone/platform/wayland/common/wayland_object.h b/ui/ozone/platform/wayland/common/wayland_object.h index 3d9e53a..ef28758 100644 --- a/ui/ozone/platform/wayland/common/wayland_object.h +++ b/ui/ozone/platform/wayland/common/wayland_object.h
@@ -148,7 +148,6 @@ DECLARE_WAYLAND_OBJECT_TRAITS(xdg_surface) DECLARE_WAYLAND_OBJECT_TRAITS(xdg_toplevel) DECLARE_WAYLAND_OBJECT_TRAITS(xdg_wm_base) -DECLARE_WAYLAND_OBJECT_TRAITS(zaura_output) DECLARE_WAYLAND_OBJECT_TRAITS(zaura_shell) DECLARE_WAYLAND_OBJECT_TRAITS(zaura_surface) DECLARE_WAYLAND_OBJECT_TRAITS(zaura_toplevel)
diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc index 752200e2c..1bfdcd2 100644 --- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc +++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.cc
@@ -116,10 +116,6 @@ : SurfacelessEGL(gl::GLSurfaceEGL::GetGLDisplayEGL(), gfx::Size()), buffer_manager_(buffer_manager), widget_(widget), - has_implicit_external_sync_( - GetGLDisplayEGL()->HasEGLExtension("EGL_ARM_implicit_external_sync")), - has_image_flush_external_( - GetGLDisplayEGL()->HasEGLExtension("EGL_EXT_image_flush_external")), solid_color_buffers_holder_(std::make_unique<SolidColorBufferHolder>()), weak_factory_(this) { buffer_manager_->RegisterSurface(widget_, this); @@ -136,21 +132,46 @@ gl::GLImage* image, std::unique_ptr<gfx::GpuFence> gpu_fence, const gfx::OverlayPlaneData& overlay_plane_data) { + auto* frame = unsubmitted_frames_.back().get(); + // There are multiple scheduling submissions for the same frame. If the + // previous schedule failed, there is no reason to continue. + if (!frame->schedule_planes_succeeded) + return false; + + // Solid color overlays are non-backed. Thus, queue them directly. + // TODO(msisov): reconsider this once Linux Wayland compositors also support + // creation of non-backed solid color wl_buffers. if (!image) { // Only solid color overlays can be non-backed. if (!overlay_plane_data.is_solid_color) { LOG(WARNING) << "Only solid color overlay planes are allowed to be " "scheduled without GLImage."; + frame->schedule_planes_succeeded = false; return false; } DCHECK(!gpu_fence); - unsubmitted_frames_.back()->non_backed_overlays.emplace_back( - overlay_plane_data); + + BufferId buf_id = solid_color_buffers_holder_->GetOrCreateSolidColorBuffer( + overlay_plane_data.color.value(), buffer_manager_); + // Invalid buffer id. + if (buf_id == 0) { + frame->schedule_planes_succeeded = false; + return false; + } + frame->in_flight_color_buffers.push_back(buf_id); + QueueWaylandOverlayConfig( + {overlay_plane_data, nullptr, buf_id, surface_scale_factor()}); } else { - unsubmitted_frames_.back()->overlays.emplace_back( - image, std::move(gpu_fence), overlay_plane_data); + std::vector<gfx::GpuFence> acquire_fences; + if (gpu_fence) + acquire_fences.push_back(std::move(*gpu_fence)); + + auto pixmap = image->GetNativePixmap(); + DCHECK(pixmap); + frame->schedule_planes_succeeded = pixmap->ScheduleOverlayPlane( + widget_, overlay_plane_data, std::move(acquire_fences), {}); } - return true; + return frame->schedule_planes_succeeded; } bool GbmSurfacelessWayland::IsOffscreen() { @@ -189,19 +210,14 @@ return; } - if (!no_gl_flush_for_tests_ && - ((!has_image_flush_external_ && - !buffer_manager_->supports_acquire_fence()) || - requires_gl_flush_on_swap_buffers_)) { + if ((!no_gl_flush_for_tests_ && !buffer_manager_->supports_acquire_fence()) || + requires_gl_flush_on_swap_buffers_) { glFlush(); } - unsubmitted_frames_.back()->Flush(); - PendingFrame* frame = unsubmitted_frames_.back().get(); frame->completion_callback = std::move(completion_callback); frame->presentation_callback = std::move(presentation_callback); - frame->ScheduleOverlayPlanes(this); unsubmitted_frames_.push_back( std::make_unique<PendingFrame>(next_frame_id())); @@ -312,48 +328,6 @@ GbmSurfacelessWayland::PendingFrame::~PendingFrame() = default; -void GbmSurfacelessWayland::PendingFrame::ScheduleOverlayPlanes( - GbmSurfacelessWayland* surfaceless) { - DCHECK(surfaceless); - for (auto& overlay : overlays) { - if (!overlay.ScheduleOverlayPlane(surfaceless->widget_)) - return; - } - - // Solid color overlays are non-backed. Thus, queue them directly. - // TODO(msisov): reconsider this once Linux Wayland compositors also support - // creation of non-backed solid color wl_buffers. - in_flight_color_buffers.reserve(non_backed_overlays.size()); - for (auto& overlay_data : non_backed_overlays) { - // This mustn't happen, but let's be explicit here and fail scheduling if - // it is not a solid color overlay. - if (!overlay_data.color.has_value()) { - schedule_planes_succeeded = false; - return; - } - - BufferId buf_id = - surfaceless->solid_color_buffers_holder_->GetOrCreateSolidColorBuffer( - overlay_data.color.value(), surfaceless->buffer_manager_); - // Invalid buffer id. - if (buf_id == 0) { - schedule_planes_succeeded = false; - return; - } - in_flight_color_buffers.push_back(buf_id); - surfaceless->QueueWaylandOverlayConfig( - {overlay_data, nullptr, buf_id, surfaceless->surface_scale_factor()}); - } - - schedule_planes_succeeded = true; - return; -} - -void GbmSurfacelessWayland::PendingFrame::Flush() { - for (const auto& overlay : overlays) - overlay.Flush(); -} - void GbmSurfacelessWayland::MaybeSubmitFrames() { while (!unsubmitted_frames_.empty() && unsubmitted_frames_.front()->ready) { auto submitted_frame = std::move(unsubmitted_frames_.front()); @@ -416,7 +390,6 @@ solid_color_buffers_holder_->OnSubmission(buf, buffer_manager_); } submitted_frame->in_flight_color_buffers.clear(); - submitted_frame->overlays.clear(); // Check if the fence has retired. if (!release_fence.is_null()) {
diff --git a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h index 16136a1b..ba10a39b 100644 --- a/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h +++ b/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h
@@ -133,28 +133,21 @@ // primary plane informations. It is a "compositor frame" on AcceleratedWidget // level. This information gets into browser process and overlays are // translated to be attached to WaylandSurfaces of the AcceleratedWidget. + // TODO(fangzhoug): This should be changed to support Vulkan. struct PendingFrame { explicit PendingFrame(uint32_t frame_id); ~PendingFrame(); - // Queues overlay configs to |configs|. - void ScheduleOverlayPlanes(GbmSurfacelessWayland* surfaceless); - void Flush(); - // Unique identifier of the frame within this AcceleratedWidget. uint32_t frame_id; bool ready = false; - // TODO(fangzhoug): This should be changed to support Vulkan. - std::vector<gl::GLSurfaceOverlay> overlays; - std::vector<gfx::OverlayPlaneData> non_backed_overlays; SwapCompletionCallback completion_callback; PresentationCallback presentation_callback; - // Merged release fence fd. This is taken as the union of all release - // fences for a particular OnSubmission. - bool schedule_planes_succeeded = false; + // Says if scheduling succeeded. + bool schedule_planes_succeeded = true; std::vector<BufferId> in_flight_color_buffers; // Contains |buffer_id|s to gl::GLSurfaceOverlay, used for committing @@ -185,8 +178,6 @@ // PendingFrames that have received OnSubmission(), pending OnPresentation() // calls. std::vector<std::unique_ptr<PendingFrame>> pending_presentation_frames_; - const bool has_implicit_external_sync_; - const bool has_image_flush_external_; bool last_swap_buffers_result_ = true; bool use_egl_fence_sync_ = true;
diff --git a/ui/ozone/platform/wayland/host/wayland_output.cc b/ui/ozone/platform/wayland/host/wayland_output.cc index 01a01b2..2186d6a 100644 --- a/ui/ozone/platform/wayland/host/wayland_output.cc +++ b/ui/ozone/platform/wayland/host/wayland_output.cc
@@ -4,7 +4,6 @@ #include "ui/ozone/platform/wayland/host/wayland_output.h" -#include <aura-shell-client-protocol.h> #include <xdg-output-unstable-v1-client-protocol.h> #include "base/logging.h" @@ -12,7 +11,6 @@ #include "ui/gfx/color_space.h" #include "ui/ozone/platform/wayland/host/wayland_connection.h" #include "ui/ozone/platform/wayland/host/wayland_output_manager.h" -#include "ui/ozone/platform/wayland/host/wayland_zaura_output.h" #include "ui/ozone/platform/wayland/host/xdg_output.h" namespace ui { @@ -68,12 +66,6 @@ zxdg_output_manager_v1_get_xdg_output(xdg_output_manager, output_.get())); } -void WaylandOutput::InitializeZAuraOutput(zaura_shell* aura_shell) { - DCHECK(!aura_output_); - aura_output_ = std::make_unique<WaylandZAuraOutput>( - zaura_shell_get_aura_output(aura_shell, output_.get())); -} - void WaylandOutput::Initialize(Delegate* delegate) { DCHECK(!delegate_); delegate_ = delegate; @@ -92,14 +84,6 @@ : scale_factor(); } -gfx::Insets WaylandOutput::insets() const { - return aura_output_ ? aura_output_->insets() : gfx::Insets(); -} - -zaura_output* WaylandOutput::get_zaura_output() const { - return aura_output_ ? aura_output_->wl_object() : nullptr; -} - void WaylandOutput::TriggerDelegateNotifications() { if (xdg_output_ && connection_->surface_submission_in_pixel_coordinates()) { DCHECK(!rect_in_physical_pixels_.IsEmpty()); @@ -115,7 +99,7 @@ } } delegate_->OnOutputHandleMetrics(output_id_, rect_in_physical_pixels_, - insets(), scale_factor_, transform_); + scale_factor_, transform_); } // static
diff --git a/ui/ozone/platform/wayland/host/wayland_output.h b/ui/ozone/platform/wayland/host/wayland_output.h index ce225ac..c36c7c7 100644 --- a/ui/ozone/platform/wayland/host/wayland_output.h +++ b/ui/ozone/platform/wayland/host/wayland_output.h
@@ -16,7 +16,6 @@ class XDGOutput; class WaylandConnection; -class WaylandZAuraOutput; // WaylandOutput objects keep track of the current output of display // that are available to the application. @@ -34,7 +33,6 @@ public: virtual void OnOutputHandleMetrics(uint32_t output_id, const gfx::Rect& new_bounds, - const gfx::Insets& insets, float scale_factor, int32_t transform) = 0; @@ -53,7 +51,6 @@ void Initialize(Delegate* delegate); void InitializeXdgOutput(struct zxdg_output_manager_v1* manager); - void InitializeZAuraOutput(zaura_shell* aura_shell); float GetUIScaleFactor() const; uint32_t output_id() const { return output_id_; } @@ -61,14 +58,12 @@ float scale_factor() const { return scale_factor_; } int32_t transform() const { return transform_; } gfx::Rect bounds() const { return rect_in_physical_pixels_; } - gfx::Insets insets() const; // Tells if the output has already received physical screen dimensions in the // global compositor space. bool is_ready() const { return !rect_in_physical_pixels_.IsEmpty(); } - wl_output* get_output() const { return output_.get(); } - zaura_output* get_zaura_output() const; + wl_output* get_output() { return output_.get(); } private: static constexpr int32_t kDefaultScaleFactor = 1; @@ -102,7 +97,6 @@ const uint32_t output_id_ = 0; wl::Object<wl_output> output_; std::unique_ptr<XDGOutput> xdg_output_; - std::unique_ptr<WaylandZAuraOutput> aura_output_; float scale_factor_ = kDefaultScaleFactor; int32_t transform_ = WL_OUTPUT_TRANSFORM_NORMAL; gfx::Rect rect_in_physical_pixels_;
diff --git a/ui/ozone/platform/wayland/host/wayland_output_manager.cc b/ui/ozone/platform/wayland/host/wayland_output_manager.cc index 432bc96d..a7ccee03 100644 --- a/ui/ozone/platform/wayland/host/wayland_output_manager.cc +++ b/ui/ozone/platform/wayland/host/wayland_output_manager.cc
@@ -11,7 +11,6 @@ #include "ui/ozone/platform/wayland/host/wayland_connection.h" #include "ui/ozone/platform/wayland/host/wayland_output.h" #include "ui/ozone/platform/wayland/host/wayland_window.h" -#include "ui/ozone/platform/wayland/host/wayland_zaura_shell.h" namespace ui { @@ -46,10 +45,6 @@ wayland_output->Initialize(this); if (connection_->xdg_output_manager_v1()) wayland_output->InitializeXdgOutput(connection_->xdg_output_manager_v1()); - if (connection_->zaura_shell()) { - wayland_output->InitializeZAuraOutput( - connection_->zaura_shell()->wl_object()); - } DCHECK(!wayland_output->is_ready()); output_list_[output_id] = std::move(wayland_output); @@ -79,14 +74,6 @@ output.second->InitializeXdgOutput(connection_->xdg_output_manager_v1()); } -void WaylandOutputManager::InitializeAllZAuraOutputs() { - DCHECK(connection_->zaura_shell()); - for (const auto& output : output_list_) { - output.second->InitializeZAuraOutput( - connection_->zaura_shell()->wl_object()); - } -} - std::unique_ptr<WaylandScreen> WaylandOutputManager::CreateWaylandScreen() { auto wayland_screen = std::make_unique<WaylandScreen>(connection_); wayland_screen_ = wayland_screen->GetWeakPtr(); @@ -107,8 +94,7 @@ if (output.second->is_ready()) { screen->OnOutputAddedOrUpdated( output.second->output_id(), output.second->bounds(), - output.second->insets(), output.second->scale_factor(), - output.second->transform()); + output.second->scale_factor(), output.second->transform()); } } } @@ -129,11 +115,10 @@ void WaylandOutputManager::OnOutputHandleMetrics(uint32_t output_id, const gfx::Rect& new_bounds, - const gfx::Insets& insets, float scale_factor, int32_t transform) { if (wayland_screen_) { - wayland_screen_->OnOutputAddedOrUpdated(output_id, new_bounds, insets, + wayland_screen_->OnOutputAddedOrUpdated(output_id, new_bounds, scale_factor, transform); } auto* wayland_window_manager = connection_->wayland_window_manager();
diff --git a/ui/ozone/platform/wayland/host/wayland_output_manager.h b/ui/ozone/platform/wayland/host/wayland_output_manager.h index 49e2245..9f5711b4 100644 --- a/ui/ozone/platform/wayland/host/wayland_output_manager.h +++ b/ui/ozone/platform/wayland/host/wayland_output_manager.h
@@ -38,7 +38,6 @@ void RemoveWaylandOutput(const uint32_t output_id); void InitializeAllXdgOutputs(); - void InitializeAllZAuraOutputs(); // Creates a platform screen. std::unique_ptr<WaylandScreen> CreateWaylandScreen(); @@ -55,7 +54,6 @@ // WaylandOutput::Delegate: void OnOutputHandleMetrics(uint32_t output_id, const gfx::Rect& new_bounds, - const gfx::Insets& insets, float scale_factor, int32_t transform) override;
diff --git a/ui/ozone/platform/wayland/host/wayland_screen.cc b/ui/ozone/platform/wayland/host/wayland_screen.cc index 4f5b2ae..c574965 100644 --- a/ui/ozone/platform/wayland/host/wayland_screen.cc +++ b/ui/ozone/platform/wayland/host/wayland_screen.cc
@@ -109,10 +109,9 @@ void WaylandScreen::OnOutputAddedOrUpdated(uint32_t output_id, const gfx::Rect& bounds, - const gfx::Insets& insets, float scale, int32_t transform) { - AddOrUpdateDisplay(output_id, bounds, insets, scale, transform); + AddOrUpdateDisplay(output_id, bounds, scale, transform); } void WaylandScreen::OnOutputRemoved(uint32_t output_id) { @@ -143,12 +142,15 @@ void WaylandScreen::AddOrUpdateDisplay(uint32_t output_id, const gfx::Rect& new_bounds, - const gfx::Insets& insets, float scale_factor, int32_t transform) { display::Display changed_display(output_id); - changed_display.SetScaleAndBounds(scale_factor, new_bounds); - changed_display.UpdateWorkAreaFromInsets(insets); + if (!display::Display::HasForceDeviceScaleFactor()) { + changed_display.SetScaleAndBounds(scale_factor, new_bounds); + } else { + changed_display.set_bounds(new_bounds); + changed_display.set_work_area(new_bounds); + } DCHECK_GE(transform, WL_OUTPUT_TRANSFORM_NORMAL); DCHECK_LE(transform, WL_OUTPUT_TRANSFORM_FLIPPED_270);
diff --git a/ui/ozone/platform/wayland/host/wayland_screen.h b/ui/ozone/platform/wayland/host/wayland_screen.h index da79707..5b59b77 100644 --- a/ui/ozone/platform/wayland/host/wayland_screen.h +++ b/ui/ozone/platform/wayland/host/wayland_screen.h
@@ -41,7 +41,6 @@ void OnOutputAddedOrUpdated(uint32_t output_id, const gfx::Rect& bounds, - const gfx::Insets& insets, float output_scale, int32_t output_transform); void OnOutputRemoved(uint32_t output_id); @@ -74,11 +73,8 @@ const gfx::GpuExtraInfo& gpu_extra_info) override; private: - // |bounds| is given in physical pixel coordinates. - // |insets| is given in DIP screen coordinates. void AddOrUpdateDisplay(uint32_t output_id, const gfx::Rect& bounds, - const gfx::Insets& insets, float scale, int32_t transform);
diff --git a/ui/ozone/platform/wayland/host/wayland_screen_unittest.cc b/ui/ozone/platform/wayland/host/wayland_screen_unittest.cc index 343e01a..ca80363 100644 --- a/ui/ozone/platform/wayland/host/wayland_screen_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_screen_unittest.cc
@@ -21,7 +21,6 @@ #include "ui/ozone/platform/wayland/test/mock_pointer.h" #include "ui/ozone/platform/wayland/test/mock_surface.h" #include "ui/ozone/platform/wayland/test/mock_wayland_platform_window_delegate.h" -#include "ui/ozone/platform/wayland/test/mock_zaura_shell.h" #include "ui/ozone/platform/wayland/test/test_output.h" #include "ui/ozone/platform/wayland/test/test_wayland_server_thread.h" #include "ui/ozone/platform/wayland/test/wayland_test.h" @@ -91,9 +90,6 @@ WaylandTest::SetUp(); - mock_zaura_shell_ = std::make_unique<wl::MockZAuraShell>(); - mock_zaura_shell_->Initialize(server_.display()); - output_->SetRect({kOutputWidth, kOutputHeight}); output_->SetScale(1); output_->Flush(); @@ -128,8 +124,6 @@ EXPECT_EQ(display_for_widget.id(), expected_display_id); } - std::unique_ptr<wl::MockZAuraShell> mock_zaura_shell_; - wl::TestOutput* output_ = nullptr; WaylandOutputManager* output_manager_ = nullptr; @@ -301,7 +295,7 @@ TestDisplayObserver observer; platform_screen_->AddObserver(&observer); - const gfx::Rect new_rect{100, 100}; + gfx::Rect new_rect{100, 100}; output_->SetRect(new_rect); output_->Flush(); @@ -311,24 +305,7 @@ display::DisplayObserver::DISPLAY_METRIC_WORK_AREA; EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); EXPECT_EQ(observer.GetDisplay().bounds(), new_rect); - EXPECT_EQ(observer.GetDisplay().work_area(), new_rect); - // Test work area. - const gfx::Rect new_work_area{80, 80}; - ASSERT_TRUE(output_->GetAuraOutput()); - output_->GetAuraOutput()->SetInsets(new_rect.InsetsFrom(new_work_area)); - output_->Flush(); - - Sync(); - - changed_values = display::DisplayObserver::DISPLAY_METRIC_WORK_AREA; - EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); - // Bounds should be unchanged. - EXPECT_EQ(observer.GetDisplay().bounds(), new_rect); - // Work area should have new value. - EXPECT_EQ(observer.GetDisplay().work_area(), new_work_area); - - // Test scaling. const int32_t new_scale_value = 2; output_->SetScale(new_scale_value); output_->Flush(); @@ -342,7 +319,6 @@ EXPECT_EQ(observer.GetAndClearChangedMetrics(), changed_values); EXPECT_EQ(observer.GetDisplay().device_scale_factor(), new_scale_value); EXPECT_EQ(observer.GetDisplay().bounds(), gfx::Rect(50, 50)); - EXPECT_EQ(observer.GetDisplay().work_area(), gfx::Rect(30, 30)); platform_screen_->RemoveObserver(&observer); }
diff --git a/ui/ozone/platform/wayland/host/wayland_seat.cc b/ui/ozone/platform/wayland/host/wayland_seat.cc index dd07091..1d10dd3 100644 --- a/ui/ozone/platform/wayland/host/wayland_seat.cc +++ b/ui/ozone/platform/wayland/host/wayland_seat.cc
@@ -84,46 +84,8 @@ void WaylandSeat::Capabilities(void* data, wl_seat* seat, uint32_t capabilities) { - WaylandSeat* self = static_cast<WaylandSeat*>(data); - DCHECK(self); - DCHECK(self->connection_->event_source()); - - if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD) { - if (!self->keyboard_ && !self->RefreshKeyboard()) - LOG(ERROR) << "Failed to get wl_keyboard from seat"; - } else { - self->keyboard_.reset(); - } - - if (capabilities & WL_SEAT_CAPABILITY_POINTER) { - if (!self->pointer_) { - if (wl_pointer* pointer = wl_seat_get_pointer(seat)) { - self->pointer_ = std::make_unique<WaylandPointer>( - pointer, self->connection_, self->connection_->event_source()); - } else { - LOG(ERROR) << "Failed to get wl_pointer from seat"; - } - } - } else { - self->pointer_.reset(); - } - - if (capabilities & WL_SEAT_CAPABILITY_TOUCH) { - if (!self->touch_) { - if (wl_touch* touch = wl_seat_get_touch(seat)) { - self->touch_ = std::make_unique<WaylandTouch>( - touch, self->connection_, self->connection_->event_source()); - } else { - LOG(ERROR) << "Failed to get wl_touch from seat"; - } - } - } else { - self->touch_.reset(); - } - - self->connection_->UpdateInputDevices(); - - self->connection_->ScheduleFlush(); + auto* self = static_cast<WaylandSeat*>(data); + self->OnCapabilities(data, seat, capabilities); } // static @@ -131,4 +93,46 @@ NOTIMPLEMENTED_LOG_ONCE(); } +void WaylandSeat::OnCapabilities(void* data, + wl_seat* seat, + uint32_t capabilities) { + DCHECK(connection_->event_source()); + + if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD) { + if (!keyboard_ && !RefreshKeyboard()) + LOG(ERROR) << "Failed to get wl_keyboard from seat"; + } else { + keyboard_.reset(); + } + + if (capabilities & WL_SEAT_CAPABILITY_POINTER) { + if (!pointer_) { + if (wl_pointer* pointer = wl_seat_get_pointer(seat)) { + pointer_ = std::make_unique<WaylandPointer>( + pointer, connection_, connection_->event_source()); + } else { + LOG(ERROR) << "Failed to get wl_pointer from seat"; + } + } + } else { + pointer_.reset(); + } + + if (capabilities & WL_SEAT_CAPABILITY_TOUCH) { + if (!touch_) { + if (wl_touch* touch = wl_seat_get_touch(seat)) { + touch_ = std::make_unique<WaylandTouch>(touch, connection_, + connection_->event_source()); + } else { + LOG(ERROR) << "Failed to get wl_touch from seat"; + } + } + } else { + touch_.reset(); + } + + connection_->UpdateInputDevices(); + connection_->ScheduleFlush(); +} + } // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_seat.h b/ui/ozone/platform/wayland/host/wayland_seat.h index fa48f99..db07a4ea 100644 --- a/ui/ozone/platform/wayland/host/wayland_seat.h +++ b/ui/ozone/platform/wayland/host/wayland_seat.h
@@ -54,6 +54,8 @@ static void Capabilities(void* data, wl_seat* seat, uint32_t capabilities); static void Name(void* data, wl_seat* seat, const char* name); + void OnCapabilities(void* data, wl_seat* seat, uint32_t capabilities); + // Wayland object wrapped by this class. wl::Object<wl_seat> obj_;
diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc index db5410de..7bbd6ae 100644 --- a/ui/ozone/platform/wayland/host/wayland_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_window.cc
@@ -175,10 +175,18 @@ auto* output_manager = connection_->wayland_output_manager(); auto* output = output_manager->GetOutput(output_id); auto* preferred_output = output_manager->GetOutput(preferred_output_id); - // crbug.com/1323635 + // The compositor may have told the surface to enter the output that the + // client is not aware of. In such an event, we cannot evaluate scales, and + // can only return the default, which means falling back to the primary + // display in the code that calls this. + // DCHECKS below are kept for trying to catch the situation in developer's + // builds and find the way to reproduce the issue. + // See crbug.com/1323635 DCHECK(output) << " output " << output_id << " not found!"; DCHECK(preferred_output) << " output " << preferred_output_id << " not found!"; + if (!output || !preferred_output) + return 0; if (output->scale_factor() > preferred_output->scale_factor()) preferred_output_id = output_id; }
diff --git a/ui/ozone/platform/wayland/host/wayland_zaura_output.cc b/ui/ozone/platform/wayland/host/wayland_zaura_output.cc deleted file mode 100644 index 4df501f..0000000 --- a/ui/ozone/platform/wayland/host/wayland_zaura_output.cc +++ /dev/null
@@ -1,47 +0,0 @@ -// 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 "ui/ozone/platform/wayland/host/wayland_zaura_output.h" - -#include <aura-shell-client-protocol.h> - -#include "base/check.h" - -namespace ui { - -WaylandZAuraOutput::WaylandZAuraOutput(zaura_output* aura_output) - : obj_(aura_output) { - DCHECK(obj_); - - static constexpr zaura_output_listener kZAuraOutputListener = { - &OnScale, &OnConnection, &OnDeviceScaleFactor, &OnInsets}; - zaura_output_add_listener(obj_.get(), &kZAuraOutputListener, this); -} - -WaylandZAuraOutput::~WaylandZAuraOutput() = default; - -void WaylandZAuraOutput::OnScale(void* data, - struct zaura_output* zaura_output, - uint32_t flags, - uint32_t scale) {} - -void WaylandZAuraOutput::OnConnection(void* data, - struct zaura_output* zaura_output, - uint32_t connection) {} - -void WaylandZAuraOutput::OnDeviceScaleFactor(void* data, - struct zaura_output* zaura_output, - uint32_t scale) {} - -void WaylandZAuraOutput::OnInsets(void* data, - struct zaura_output* zaura_output, - int32_t top, - int32_t left, - int32_t bottom, - int32_t right) { - if (auto* aura_output = static_cast<WaylandZAuraOutput*>(data)) - aura_output->insets_ = gfx::Insets::TLBR(top, left, bottom, right); -} - -} // namespace ui
diff --git a/ui/ozone/platform/wayland/host/wayland_zaura_output.h b/ui/ozone/platform/wayland/host/wayland_zaura_output.h deleted file mode 100644 index ba813cbf..0000000 --- a/ui/ozone/platform/wayland/host/wayland_zaura_output.h +++ /dev/null
@@ -1,52 +0,0 @@ -// 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 UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_ZAURA_OUTPUT_H_ -#define UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_ZAURA_OUTPUT_H_ - -#include <cstdint> - -#include "ui/gfx/geometry/insets.h" -#include "ui/ozone/platform/wayland/common/wayland_object.h" - -namespace ui { - -// Wraps the zaura_output object. -class WaylandZAuraOutput { - public: - explicit WaylandZAuraOutput(zaura_output* aura_output); - WaylandZAuraOutput(const WaylandZAuraOutput&) = delete; - WaylandZAuraOutput& operator=(const WaylandZAuraOutput&) = delete; - ~WaylandZAuraOutput(); - - zaura_output* wl_object() { return obj_.get(); } - - const gfx::Insets& insets() const { return insets_; } - - private: - // zaura_output_listeners - static void OnScale(void* data, - struct zaura_output* zaura_output, - uint32_t flags, - uint32_t scale); - static void OnConnection(void* data, - struct zaura_output* zaura_output, - uint32_t connection); - static void OnDeviceScaleFactor(void* data, - struct zaura_output* zaura_output, - uint32_t scale); - static void OnInsets(void* data, - struct zaura_output* zaura_output, - int32_t top, - int32_t left, - int32_t bottom, - int32_t right); - - wl::Object<zaura_output> obj_; - gfx::Insets insets_; -}; - -} // namespace ui - -#endif // UI_OZONE_PLATFORM_WAYLAND_HOST_WAYLAND_ZAURA_OUTPUT_H_
diff --git a/ui/ozone/platform/wayland/host/wayland_zaura_output_unittest.cc b/ui/ozone/platform/wayland/host/wayland_zaura_output_unittest.cc deleted file mode 100644 index b26a72c7..0000000 --- a/ui/ozone/platform/wayland/host/wayland_zaura_output_unittest.cc +++ /dev/null
@@ -1,107 +0,0 @@ -// 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 "ui/ozone/platform/wayland/host/wayland_zaura_output.h" - -#include <components/exo/wayland/protocol/aura-shell-client-protocol.h> -#include <components/exo/wayland/protocol/aura-shell-server-protocol.h> - -#include "base/run_loop.h" -#include "base/test/task_environment.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "ui/ozone/platform/wayland/host/wayland_connection.h" -#include "ui/ozone/platform/wayland/host/wayland_event_source.h" -#include "ui/ozone/platform/wayland/host/wayland_output.h" -#include "ui/ozone/platform/wayland/host/wayland_output_manager.h" -#include "ui/ozone/platform/wayland/test/mock_zaura_shell.h" -#include "ui/ozone/platform/wayland/test/server_object.h" -#include "ui/ozone/platform/wayland/test/test_wayland_server_thread.h" -#include "ui/ozone/platform/wayland/test/test_zaura_output.h" - -namespace ui { -namespace { - -using ::testing::Values; - -class WaylandZAuraOutputTest : public ::testing::Test { - public: - WaylandZAuraOutputTest() - : task_environment_( - base::test::SingleThreadTaskEnvironment::MainThreadType::UI) {} - - WaylandZAuraOutputTest(const WaylandZAuraOutputTest&) = delete; - WaylandZAuraOutputTest& operator=(const WaylandZAuraOutputTest&) = delete; - - ~WaylandZAuraOutputTest() override = default; - - void SetUp() override { - ::testing::Test::SetUp(); - - ASSERT_TRUE(server_.Start({.shell_version = wl::ShellVersion::kStable})); - mock_zaura_shell_.Initialize(server_.display()); - - ASSERT_TRUE(connection_.Initialize()); - connection_.event_source()->StartProcessingEvents(); - base::RunLoop().RunUntilIdle(); - - // Set default values for the output. - wl::TestOutput* output = server_.output(); - output->SetRect({800, 600}); - output->SetScale(1); - output->Flush(); - - base::RunLoop().RunUntilIdle(); - server_.Pause(); - - output_manager_ = connection_.wayland_output_manager(); - ASSERT_TRUE(output_manager_); - EXPECT_TRUE(output_manager_->IsOutputReady()); - - // Initializing the screen also connects it to the primary output, so it's - // easier for us to get the associated WaylandOutput object later. - platform_screen_ = output_manager_->CreateWaylandScreen(); - output_manager_->InitWaylandScreen(platform_screen_.get()); - } - - protected: - base::test::SingleThreadTaskEnvironment task_environment_; - wl::TestWaylandServerThread server_; - wl::MockZAuraShell mock_zaura_shell_; - WaylandConnection connection_; - - WaylandOutputManager* output_manager_ = nullptr; - std::unique_ptr<WaylandScreen> platform_screen_; -}; - -TEST_F(WaylandZAuraOutputTest, HandleInsets) { - WaylandOutput* wayland_output = output_manager_->GetPrimaryOutput(); - ASSERT_TRUE(wayland_output); - EXPECT_TRUE(wayland_output->is_ready()); - EXPECT_EQ(wayland_output->bounds(), gfx::Rect(800, 600)); - EXPECT_TRUE(wayland_output->insets().IsEmpty()); - EXPECT_TRUE(wayland_output->get_zaura_output()); - - // Simulate server sending updated insets to the client. - wl_resource* zaura_output_resource = - server_.output()->GetAuraOutput()->resource(); - ASSERT_TRUE(zaura_output_resource); - const gfx::Insets sent_insets = - gfx::Rect(800, 600).InsetsFrom(gfx::Rect(10, 10, 500, 400)); - EXPECT_FALSE(sent_insets.IsEmpty()); - zaura_output_send_insets(zaura_output_resource, sent_insets.top(), - sent_insets.left(), sent_insets.bottom(), - sent_insets.right()); - - server_.Resume(); - base::RunLoop().RunUntilIdle(); - server_.Pause(); - - // Verify that insets is updated. - EXPECT_TRUE(wayland_output->is_ready()); - EXPECT_EQ(wayland_output->bounds(), gfx::Rect(800, 600)); - EXPECT_EQ(wayland_output->insets(), sent_insets); -} - -} // namespace -} // namespace ui \ No newline at end of file
diff --git a/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc b/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc index 5532e22..5114ddf 100644 --- a/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc +++ b/ui/ozone/platform/wayland/host/wayland_zaura_shell.cc
@@ -20,7 +20,7 @@ namespace { constexpr uint32_t kMinVersion = 1; -constexpr uint32_t kMaxVersion = 32; +constexpr uint32_t kMaxVersion = 31; } // static @@ -48,13 +48,6 @@ connection->zaura_shell_ = std::make_unique<WaylandZAuraShell>(zaura_shell.release(), connection); ReportShellUMA(UMALinuxWaylandShell::kZauraShell); - - // Usually WaylandOutputManager is instantiated first, so any ZAuraOutputs it - // created wouldn't have been initialized, since the zaura_shell didn't exist - // yet. So initialize them now. - if (connection->wayland_output_manager()) { - connection->wayland_output_manager()->InitializeAllZAuraOutputs(); - } } WaylandZAuraShell::WaylandZAuraShell(zaura_shell* aura_shell,
diff --git a/ui/ozone/platform/wayland/test/mock_zaura_shell.cc b/ui/ozone/platform/wayland/test/mock_zaura_shell.cc index 0f2c508..7e5fae6 100644 --- a/ui/ozone/platform/wayland/test/mock_zaura_shell.cc +++ b/ui/ozone/platform/wayland/test/mock_zaura_shell.cc
@@ -5,15 +5,12 @@ #include "ui/ozone/platform/wayland/test/mock_zaura_shell.h" #include "ui/ozone/platform/wayland/test/server_object.h" -#include "ui/ozone/platform/wayland/test/test_output.h" -#include "ui/ozone/platform/wayland/test/test_zaura_output.h" namespace wl { namespace { -constexpr uint32_t kZAuraShellVersion = 32; -constexpr uint32_t kZAuraOutputVersion = 32; +constexpr uint32_t kZAuraShellVersion = 26; void GetAuraSurface(wl_client* client, wl_resource* resource, @@ -23,12 +20,7 @@ void GetAuraOutput(wl_client* client, wl_resource* resource, uint32_t id, - wl_resource* output_resource) { - wl_resource* zaura_output_resource = CreateResourceWithImpl<TestZAuraOutput>( - client, &zaura_output_interface, kZAuraOutputVersion, nullptr, id); - auto* output = GetUserDataAs<TestOutput>(output_resource); - output->SetAuraOutput(GetUserDataAs<TestZAuraOutput>(zaura_output_resource)); -} + wl_resource* output_resource) {} void SurfaceSubmissionInPixelCoordinates(wl_client* client, wl_resource* resource) {}
diff --git a/ui/ozone/platform/wayland/test/test_output.cc b/ui/ozone/platform/wayland/test/test_output.cc index c0ec7a90..3d8b0d2 100644 --- a/ui/ozone/platform/wayland/test/test_output.cc +++ b/ui/ozone/platform/wayland/test/test_output.cc
@@ -56,10 +56,6 @@ scale_ = std::move(pending_scale_.value()); wl_output_send_scale(resource(), scale_); } - - if (aura_output_) - aura_output_->Flush(); - wl_output_send_done(resource()); } @@ -75,12 +71,4 @@ Flush(); } -void TestOutput::SetAuraOutput(TestZAuraOutput* aura_output) { - aura_output_ = aura_output; -} - -TestZAuraOutput* TestOutput::GetAuraOutput() { - return aura_output_; -} - } // namespace wl
diff --git a/ui/ozone/platform/wayland/test/test_output.h b/ui/ozone/platform/wayland/test/test_output.h index 5b90dc0..b8ed75c8 100644 --- a/ui/ozone/platform/wayland/test/test_output.h +++ b/ui/ozone/platform/wayland/test/test_output.h
@@ -11,7 +11,6 @@ #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/gfx/geometry/rect.h" #include "ui/ozone/platform/wayland/test/global_object.h" -#include "ui/ozone/platform/wayland/test/test_zaura_output.h" namespace wl { @@ -33,9 +32,6 @@ void Flush(); - void SetAuraOutput(TestZAuraOutput* aura_output); - TestZAuraOutput* GetAuraOutput(); - protected: void OnBind() override; @@ -47,8 +43,6 @@ absl::optional<gfx::Rect> pending_rect_ = absl::nullopt; absl::optional<int32_t> pending_scale_ = absl::nullopt; absl::optional<wl_output_transform> pending_transform_ = absl::nullopt; - - TestZAuraOutput* aura_output_ = nullptr; }; } // namespace wl
diff --git a/ui/ozone/platform/wayland/test/test_zaura_output.cc b/ui/ozone/platform/wayland/test/test_zaura_output.cc deleted file mode 100644 index afcead2..0000000 --- a/ui/ozone/platform/wayland/test/test_zaura_output.cc +++ /dev/null
@@ -1,25 +0,0 @@ -// 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 "ui/ozone/platform/wayland/test/test_zaura_output.h" - -#include <aura-shell-server-protocol.h> - -namespace wl { - -TestZAuraOutput::TestZAuraOutput(wl_resource* resource) - : ServerObject(resource) {} - -TestZAuraOutput::~TestZAuraOutput() = default; - -void TestZAuraOutput::Flush() { - if (pending_insets_) { - insets_ = std::move(*pending_insets_); - pending_insets_.reset(); - zaura_output_send_insets(resource(), insets_.top(), insets_.left(), - insets_.bottom(), insets_.right()); - } -} - -} // namespace wl
diff --git a/ui/ozone/platform/wayland/test/test_zaura_output.h b/ui/ozone/platform/wayland/test/test_zaura_output.h deleted file mode 100644 index 9aabb5b5..0000000 --- a/ui/ozone/platform/wayland/test/test_zaura_output.h +++ /dev/null
@@ -1,36 +0,0 @@ -// 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 UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_OUTPUT_H_ -#define UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_OUTPUT_H_ - -#include "third_party/abseil-cpp/absl/types/optional.h" -#include "ui/gfx/geometry/insets.h" -#include "ui/ozone/platform/wayland/test/server_object.h" - -namespace wl { - -// Manages zaura_output object. -class TestZAuraOutput : public ServerObject { - public: - explicit TestZAuraOutput(wl_resource* resource); - - TestZAuraOutput(const TestZAuraOutput&) = delete; - TestZAuraOutput& operator=(const TestZAuraOutput&) = delete; - - ~TestZAuraOutput() override; - - const gfx::Insets& GetInsets() const { return insets_; } - void SetInsets(const gfx::Insets& insets) { pending_insets_ = insets; } - - void Flush(); - - private: - gfx::Insets insets_; - absl::optional<gfx::Insets> pending_insets_; -}; - -} // namespace wl - -#endif // UI_OZONE_PLATFORM_WAYLAND_TEST_TEST_ZAURA_OUTPUT_H_
diff --git a/ui/ozone/platform/x11/BUILD.gn b/ui/ozone/platform/x11/BUILD.gn index 252986e..b1180a8 100644 --- a/ui/ozone/platform/x11/BUILD.gn +++ b/ui/ozone/platform/x11/BUILD.gn
@@ -151,7 +151,6 @@ "//ui/base/x", "//ui/base/x:test_support", "//ui/base/x:unittests", - "//ui/display:test_support", "//ui/events:test_support", "//ui/events/devices/x11", "//ui/events/platform/x11",
diff --git a/ui/ozone/platform/x11/test/x11_window_unittest.cc b/ui/ozone/platform/x11/test/x11_window_unittest.cc index cccb2e24..f499dbe 100644 --- a/ui/ozone/platform/x11/test/x11_window_unittest.cc +++ b/ui/ozone/platform/x11/test/x11_window_unittest.cc
@@ -15,7 +15,6 @@ #include "ui/base/x/x11_util.h" #include "ui/display/display_switches.h" #include "ui/display/screen_base.h" -#include "ui/display/test/test_screen.h" #include "ui/events/devices/x11/touch_factory_x11.h" #include "ui/events/event.h" #include "ui/events/platform/x11/x11_event_source.h" @@ -216,8 +215,8 @@ ui::TouchFactory::GetInstance()->SetPointerDeviceForTest(pointer_devices); // X11 requires display::Screen instance. - test_screen_.emplace(); - display::Screen::SetScreenInstance(&test_screen_.value()); + test_screen_ = new TestScreen(); + display::Screen::SetScreenInstance(test_screen_); // Make X11 synchronous for our display connection. This does not force the // window manager to behave synchronously. @@ -227,8 +226,6 @@ protected: void TearDown() override { x11::Connection::Get()->SynchronizeForTest(false); - display::Screen::SetScreenInstance(nullptr); - test_screen_.reset(); } std::unique_ptr<X11Window> CreateX11Window( @@ -255,7 +252,7 @@ std::unique_ptr<base::test::TaskEnvironment> task_env_; std::unique_ptr<X11EventSource> event_source_; - absl::optional<TestScreen> test_screen_; + TestScreen* test_screen_ = nullptr; }; // https://crbug.com/898742: Test is flaky.
diff --git a/ui/ozone/platform/x11/x11_window_ozone_unittest.cc b/ui/ozone/platform/x11/x11_window_ozone_unittest.cc index 8f8953c..f130507c 100644 --- a/ui/ozone/platform/x11/x11_window_ozone_unittest.cc +++ b/ui/ozone/platform/x11/x11_window_ozone_unittest.cc
@@ -78,13 +78,12 @@ void SetUp() override { event_source_ = std::make_unique<X11EventSource>(x11::Connection::Get()); - display::Screen::SetScreenInstance(&test_screen_); + test_screen_ = new TestScreen(); + display::Screen::SetScreenInstance(test_screen_); TouchFactory::GetInstance()->SetPointerDeviceForTest({kPointerDeviceId}); } - void TearDown() override { display::Screen::SetScreenInstance(nullptr); } - protected: std::unique_ptr<PlatformWindow> CreatePlatformWindow( MockPlatformWindowDelegate* delegate, @@ -113,7 +112,7 @@ return window_manager; } - TestScreen test_screen_; + TestScreen* test_screen_ = nullptr; private: std::unique_ptr<base::test::TaskEnvironment> task_env_; @@ -284,7 +283,7 @@ // Verifies X11Window sets fullscreen bounds in pixels when going to fullscreen. TEST_F(X11WindowOzoneTest, ToggleFullscreen) { constexpr gfx::Rect screen_bounds_in_px(640, 480, 1280, 720); - test_screen_.SetScaleAndBoundsForPrimaryDisplay(2, screen_bounds_in_px); + test_screen_->SetScaleAndBoundsForPrimaryDisplay(2, screen_bounds_in_px); MockPlatformWindowDelegate delegate; gfx::AcceleratedWidget widget;
diff --git a/ui/ozone/public/ozone_platform.cc b/ui/ozone/public/ozone_platform.cc index 30fcf86d..aa32ca5 100644 --- a/ui/ozone/public/ozone_platform.cc +++ b/ui/ozone/public/ozone_platform.cc
@@ -97,11 +97,6 @@ } // static -bool OzonePlatform::IsInitialized() { - return !!g_instance; -} - -// static std::string OzonePlatform::GetPlatformNameForTest() { return GetOzonePlatformName(); }
diff --git a/ui/ozone/public/ozone_platform.h b/ui/ozone/public/ozone_platform.h index df6b551..22ba323 100644 --- a/ui/ozone/public/ozone_platform.h +++ b/ui/ozone/public/ozone_platform.h
@@ -240,8 +240,6 @@ static OzonePlatform* GetInstance(); - static bool IsInitialized(); - // Returns the current ozone platform name. // Some tests may skip based on the platform name. static std::string GetPlatformNameForTest();
diff --git a/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc b/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc index 45189c7..f786b1b 100644 --- a/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc +++ b/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc
@@ -820,33 +820,30 @@ : public BubbleDialogDelegateViewTest, public testing::WithParamInterface<ArrowTestParameters> { public: - BubbleDialogDelegateViewArrowTest() { SetUpTestScreen(); } + BubbleDialogDelegateViewArrowTest() : screen_override_(SetUpTestScreen()) {} BubbleDialogDelegateViewArrowTest(const BubbleDialogDelegateViewArrowTest&) = delete; BubbleDialogDelegateViewArrowTest& operator=( const BubbleDialogDelegateViewArrowTest&) = delete; - ~BubbleDialogDelegateViewArrowTest() override { - display::Screen::SetScreenInstance(nullptr); - } + ~BubbleDialogDelegateViewArrowTest() override = default; private: - void SetUpTestScreen() { - DCHECK(!display::test::TestScreen::Get()); - test_screen_ = std::make_unique<display::test::TestScreen>(); - display::Screen::SetScreenInstance(test_screen_.get()); - const display::Display test_display = test_screen_->GetPrimaryDisplay(); + display::Screen* SetUpTestScreen() { + const display::Display test_display = test_screen_.GetPrimaryDisplay(); display::Display display(test_display); display.set_id(0x2); display.set_bounds(gfx::Rect(0, 0, kScreenWidth, kScreenHeight)); display.set_work_area(gfx::Rect(0, 0, kScreenWidth, kScreenHeight)); - test_screen_->display_list().RemoveDisplay(test_display.id()); - test_screen_->display_list().AddDisplay( - display, display::DisplayList::Type::PRIMARY); + test_screen_.display_list().RemoveDisplay(test_display.id()); + test_screen_.display_list().AddDisplay(display, + display::DisplayList::Type::PRIMARY); + return &test_screen_; } - std::unique_ptr<display::test::TestScreen> test_screen_; + display::test::TestScreen test_screen_; + display::test::ScopedScreenOverride screen_override_; }; TEST_P(BubbleDialogDelegateViewArrowTest, AvailableScreenSpaceTest) {
diff --git a/ui/views/bubble/bubble_dialog_model_host.cc b/ui/views/bubble/bubble_dialog_model_host.cc index fc496e8..00bfeda 100644 --- a/ui/views/bubble/bubble_dialog_model_host.cc +++ b/ui/views/bubble/bubble_dialog_model_host.cc
@@ -154,11 +154,30 @@ // into this class. This was done in steps to limit the size of the diff. class BubbleDialogModelHost::ContentsView : public View { public: - explicit ContentsView(ui::DialogModel* model) { + ContentsView(BubbleDialogModelHost* parent, ui::DialogModel* model) + : parent_(parent) { // Note that between-child spacing is manually handled using kMarginsKey. SetLayoutManager( std::make_unique<BoxLayout>(BoxLayout::Orientation::kVertical)); } + + void OnThemeChanged() override { + View::OnThemeChanged(); + if (!parent_->ShouldShowWindowIcon()) + return; + const ui::ImageModel dark_mode_icon = + parent_->model_->dark_mode_icon(parent_->GetPassKey()); + if (!dark_mode_icon.IsEmpty() && + color_utils::IsDark(parent_->GetBackgroundColor())) { + parent_->SetIcon(dark_mode_icon.GetImage().AsImageSkia()); + return; + } + parent_->SetIcon( + parent_->model_->icon(GetPassKey()).GetImage().AsImageSkia()); + } + + private: + BubbleDialogModelHost* const parent_; }; class BubbleDialogModelHost::LayoutConsensusView : public View { @@ -245,7 +264,7 @@ : BubbleDialogDelegate(anchor_view, arrow), model_(std::move(model)), contents_view_( - SetContentsView(std::make_unique<ContentsView>(model_.get()))) { + SetContentsView(std::make_unique<ContentsView>(this, model_.get()))) { model_->set_host(GetPassKey(), this); // Dialog callbacks can safely refer to |model_|, they can't be called after
diff --git a/ui/views/cocoa/bridged_native_widget_unittest.mm b/ui/views/cocoa/bridged_native_widget_unittest.mm index 34b4af7..4c219d938 100644 --- a/ui/views/cocoa/bridged_native_widget_unittest.mm +++ b/ui/views/cocoa/bridged_native_widget_unittest.mm
@@ -24,7 +24,6 @@ #import "ui/base/cocoa/window_size_constants.h" #include "ui/base/ime/input_method.h" #import "ui/base/test/cocoa_helper.h" -#include "ui/display/screen.h" #include "ui/events/test/cocoa_test_event_utils.h" #import "ui/gfx/mac/coordinate_conversion.h" #import "ui/views/cocoa/native_widget_mac_ns_window_host.h" @@ -386,8 +385,6 @@ private: TestViewsDelegate test_views_delegate_; - - display::ScopedNativeScreen screen_; }; class BridgedNativeWidgetTest : public BridgedNativeWidgetTestBase,
diff --git a/ui/views/controls/base_control_test_widget.cc b/ui/views/controls/base_control_test_widget.cc index 1131f0eb..1bee91040 100644 --- a/ui/views/controls/base_control_test_widget.cc +++ b/ui/views/controls/base_control_test_widget.cc
@@ -23,6 +23,8 @@ BaseControlTestWidget::~BaseControlTestWidget() = default; void BaseControlTestWidget::SetUp() { + ViewsTestBase::SetUp(); + #if BUILDFLAG(IS_MAC) test_screen_ = std::make_unique<display::test::TestScreenMac>(gfx::Size()); // Purposely not use ScopedScreenOverride, in which GetScreen() will @@ -30,8 +32,6 @@ display::Screen::SetScreenInstance(test_screen_.get()); #endif - ViewsTestBase::SetUp(); - widget_ = std::make_unique<Widget>(); Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); @@ -47,10 +47,10 @@ void BaseControlTestWidget::TearDown() { widget_.reset(); - ViewsTestBase::TearDown(); #if BUILDFLAG(IS_MAC) display::Screen::SetScreenInstance(nullptr); #endif + ViewsTestBase::TearDown(); } void BaseControlTestWidget::CreateWidgetContent(View* container) {}
diff --git a/ui/views/test/test_desktop_screen_ozone.cc b/ui/views/test/test_desktop_screen_ozone.cc index 61684a2..7f018a7 100644 --- a/ui/views/test/test_desktop_screen_ozone.cc +++ b/ui/views/test/test_desktop_screen_ozone.cc
@@ -4,20 +4,22 @@ #include "ui/views/test/test_desktop_screen_ozone.h" -namespace views::test { +#include <memory> + +#include "base/memory/singleton.h" + +namespace views { +namespace test { + namespace { TestDesktopScreenOzone* g_instance = nullptr; } -// static -std::unique_ptr<display::Screen> TestDesktopScreenOzone::Create() { - auto screen = std::make_unique<TestDesktopScreenOzone>(); - screen->Initialize(); - return screen; -} - TestDesktopScreenOzone* TestDesktopScreenOzone::GetInstance() { - DCHECK_EQ(display::Screen::GetScreen(), g_instance); + if (!g_instance) { + g_instance = base::Singleton<TestDesktopScreenOzone>::get(); + g_instance->Initialize(); + } return g_instance; } @@ -25,13 +27,8 @@ return cursor_screen_point_; } -TestDesktopScreenOzone::TestDesktopScreenOzone() { - DCHECK(!g_instance); - g_instance = this; -} +TestDesktopScreenOzone::TestDesktopScreenOzone() = default; +TestDesktopScreenOzone::~TestDesktopScreenOzone() = default; -TestDesktopScreenOzone::~TestDesktopScreenOzone() { - g_instance = nullptr; -} - -} // namespace views::test +} // namespace test +} // namespace views
diff --git a/ui/views/test/test_desktop_screen_ozone.h b/ui/views/test/test_desktop_screen_ozone.h index 1054c1c..abaea86 100644 --- a/ui/views/test/test_desktop_screen_ozone.h +++ b/ui/views/test/test_desktop_screen_ozone.h
@@ -5,13 +5,12 @@ #ifndef UI_VIEWS_TEST_TEST_DESKTOP_SCREEN_OZONE_H_ #define UI_VIEWS_TEST_TEST_DESKTOP_SCREEN_OZONE_H_ -#include <memory> - #include "ui/gfx/geometry/point.h" #include "ui/views/widget/desktop_aura/desktop_screen_ozone.h" -namespace display { -class Screen; +namespace base { +template <typename T> +struct DefaultSingletonTraits; } namespace views { @@ -27,7 +26,6 @@ TestDesktopScreenOzone(const TestDesktopScreenOzone&) = delete; TestDesktopScreenOzone& operator=(const TestDesktopScreenOzone&) = delete; - static std::unique_ptr<display::Screen> Create(); static TestDesktopScreenOzone* GetInstance(); // DesktopScreenOzone: @@ -37,10 +35,12 @@ cursor_screen_point_ = point; } + private: + friend struct base::DefaultSingletonTraits<TestDesktopScreenOzone>; + TestDesktopScreenOzone(); ~TestDesktopScreenOzone() override; - private: gfx::Point cursor_screen_point_; };
diff --git a/ui/views/test/views_test_helper_mac.h b/ui/views/test/views_test_helper_mac.h index 3d5eb38..a9abea1 100644 --- a/ui/views/test/views_test_helper_mac.h +++ b/ui/views/test/views_test_helper_mac.h
@@ -7,11 +7,9 @@ #include <memory> -#include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/test/scoped_fake_full_keyboard_access.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/compositor/test/test_context_factories.h" -#include "ui/display/screen.h" #include "ui/views/test/views_test_helper.h" namespace ui { @@ -60,8 +58,6 @@ // more consistent with other platforms, where most views are focusable by // default. ui::test::ScopedFakeFullKeyboardAccess faked_full_keyboard_access_; - - display::ScopedNativeScreen screen_; }; } // namespace views
diff --git a/ui/views/test/widget_test.cc b/ui/views/test/widget_test.cc index 459e046..ac1e3a965 100644 --- a/ui/views/test/widget_test.cc +++ b/ui/views/test/widget_test.cc
@@ -12,12 +12,8 @@ #include "ui/views/test/native_widget_factory.h" #include "ui/views/widget/root_view.h" -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \ - !BUILDFLAG(IS_CHROMECAST) -#include "ui/views/test/test_desktop_screen_ozone.h" -#endif - -namespace views::test { +namespace views { +namespace test { namespace { @@ -134,21 +130,9 @@ void DesktopWidgetTestInteractive::SetUp() { SetUpForInteractiveTests(); -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \ - !BUILDFLAG(IS_CHROMECAST) - screen_ = views::test::TestDesktopScreenOzone::Create(); -#endif DesktopWidgetTest::SetUp(); } -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \ - !BUILDFLAG(IS_CHROMECAST) -void DesktopWidgetTestInteractive::TearDown() { - DesktopWidgetTest::TearDown(); - screen_.reset(); -} -#endif - TestDesktopWidgetDelegate::TestDesktopWidgetDelegate() : TestDesktopWidgetDelegate(nullptr) {} @@ -286,4 +270,5 @@ widget_observation_.Reset(); } -} // namespace views::test +} // namespace test +} // namespace views
diff --git a/ui/views/test/widget_test.h b/ui/views/test/widget_test.h index 1ba22f67..24b792f 100644 --- a/ui/views/test/widget_test.h +++ b/ui/views/test/widget_test.h
@@ -14,17 +14,11 @@ #include "base/scoped_observation.h" #include "base/test/bind.h" #include "build/build_config.h" -#include "build/chromecast_buildflags.h" #include "ui/gfx/native_widget_types.h" #include "ui/views/test/views_test_base.h" #include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_observer.h" -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \ - !BUILDFLAG(IS_CHROMECAST) -#include "ui/display/screen.h" -#endif - namespace ui { namespace internal { class InputMethodDelegate; @@ -162,12 +156,6 @@ // DesktopWidgetTest void SetUp() override; - -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \ - !BUILDFLAG(IS_CHROMECAST) - void TearDown() override; - std::unique_ptr<display::Screen> screen_; -#endif }; // A helper WidgetDelegate for tests that require hooks into WidgetDelegate
diff --git a/ui/views/widget/desktop_aura/desktop_screen_win.cc b/ui/views/widget/desktop_aura/desktop_screen_win.cc index b5ad964..7c352dd 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_win.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_win.cc
@@ -13,13 +13,10 @@ namespace views { -DesktopScreenWin::DesktopScreenWin() { - DCHECK(!display::Screen::HasScreen()); - display::Screen::SetScreenInstance(this); -} +DesktopScreenWin::DesktopScreenWin() = default; DesktopScreenWin::~DesktopScreenWin() { - display::Screen::SetScreenInstance(nullptr); + display::Screen::SetScreenInstance(old_screen_); } HWND DesktopScreenWin::GetHWNDFromNativeWindow(gfx::NativeWindow window) const {
diff --git a/ui/views/widget/desktop_aura/desktop_screen_win.h b/ui/views/widget/desktop_aura/desktop_screen_win.h index c2cbf5a..6ab217c 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_win.h +++ b/ui/views/widget/desktop_aura/desktop_screen_win.h
@@ -23,6 +23,9 @@ HWND GetHWNDFromNativeWindow(gfx::NativeWindow window) const override; gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const override; bool IsNativeWindowOccluded(gfx::NativeWindow window) const override; + + const raw_ptr<display::Screen> old_screen_ = + display::Screen::SetScreenInstance(this); }; } // namespace views
diff --git a/ui/wm/BUILD.gn b/ui/wm/BUILD.gn index d006f7979..660b5a3 100644 --- a/ui/wm/BUILD.gn +++ b/ui/wm/BUILD.gn
@@ -100,15 +100,10 @@ sources = [ "test/testing_cursor_client_observer.cc", "test/testing_cursor_client_observer.h", + "test/wm_test_helper.cc", + "test/wm_test_helper.h", ] - if (is_chromeos_ash) { - sources += [ - "test/wm_test_helper.cc", - "test/wm_test_helper.h", - ] - } - public_deps = [ "//ui/base/cursor" ] deps = [
diff --git a/ui/wm/test/wm_test_helper.cc b/ui/wm/test/wm_test_helper.cc index 6e09afb6..5088317 100644 --- a/ui/wm/test/wm_test_helper.cc +++ b/ui/wm/test/wm_test_helper.cc
@@ -8,7 +8,6 @@ #include <utility> #include "base/memory/ptr_util.h" -#include "build/build_config.h" #include "ui/aura/client/default_capture_client.h" #include "ui/aura/test/test_focus_client.h" #include "ui/aura/test/test_screen.h" @@ -22,10 +21,10 @@ WMTestHelper::WMTestHelper(const gfx::Size& default_window_size) { wm_state_ = std::make_unique<WMState>(); - if (!display::Screen::HasScreen()) { - test_screen_ = base::WrapUnique(aura::TestScreen::Create(gfx::Size())); - display::Screen::SetScreenInstance(test_screen_.get()); - } + + // Install a screen, like TestWindowService's AuraTestHelper for InitMusHost. + test_screen_ = base::WrapUnique(aura::TestScreen::Create(gfx::Size())); + display::Screen::SetScreenInstance(test_screen_.get()); host_ = aura::WindowTreeHost::Create( ui::PlatformWindowInitProperties{gfx::Rect(default_window_size)}); @@ -47,7 +46,8 @@ WMTestHelper::~WMTestHelper() { host_->window()->RemovePreTargetHandler(root_window_event_filter_.get()); - if (test_screen_) + + if (display::Screen::GetScreen() == test_screen_.get()) display::Screen::SetScreenInstance(nullptr); }