diff --git a/DEPS b/DEPS index b7d41e48..d9d8de3 100644 --- a/DEPS +++ b/DEPS
@@ -276,7 +276,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'src_internal_revision': '1fd670ae00548d02b7be137d992ec52db29f3f4c', + 'src_internal_revision': '38652b8866d84df9ea9e44365faee1954eba333a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. @@ -284,15 +284,15 @@ # 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': 'f4a2825cd7d8d81a9f6eeb49d22f51982b2dfee7', + 'v8_revision': '9e416be0f26ee77553bf4468023ebeb1aaed6773', # 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': '09f3bc3a72ce14d8cb6bd149e35e92750fa388c5', + 'angle_revision': '1287e19e802ae2af651cd74ff1adaf9efe453146', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'c0fe4d40475b709a42d78315d3929d41d44838c8', + 'swiftshader_revision': '23b93c7cfe27e205e178a135a6ea24d1dcba1068', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -300,7 +300,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. - 'boringssl_revision': 'aefa5d24da34ef77ac797bdbe684734e5bd870f4', + 'boringssl_revision': '0436a33c875ead926d821b12075fd20d47b6bc77', # 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. @@ -348,7 +348,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '60c19667867ffdfc5af22da1b1d4822894a9b7e4', + 'catapult_revision': '452b85ea51998d34386f3b7f8bd711ba12e5d4b7', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling chromium_variations # and whatever else without interference from each other. @@ -372,7 +372,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': 'e4ab20de944fb512b1f9fd4c576c2958997616f2', + 'devtools_frontend_revision': '6243889956c0e82870c014587050fcec9bb453e5', # 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. @@ -396,7 +396,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': '505a2d78c9a0be556aeff5f22a02f0950de86074', + 'dawn_revision': '2312bfa66cd1437612fd16a98620c51ff6224345', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -496,7 +496,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling llvm-libc # and whatever else without interference from each other. - 'llvm_libc_revision': 'cee48b92a7f38a42d92b0e2949c23e27a4772845', + 'llvm_libc_revision': 'a4d792ed7bbbf7380a284f8660a8a31b3bfa5585', # If you change this, also update the libc++ revision in # //buildtools/deps_revisions.gni. @@ -1304,7 +1304,7 @@ 'src/clank': { 'url': Var('chrome_git') + '/clank/internal/apps.git' + '@' + - '87961a747195a2b627f5c78b6b274e1d05323672', + '2cf4ab0b04a9f4713c31cdf420e4d0f1278cac38', 'condition': 'checkout_android and checkout_src_internal', }, @@ -1799,7 +1799,7 @@ 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '9b4d1e485d37a44e3ebe73a06d21fc79c527ec96', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'bf32de3167aa5d172223b50b13758f2fb0bce5e5', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -2154,7 +2154,7 @@ }, 'src/third_party/libva-fake-driver/src': - Var('chromium_git') + '/chromiumos/platform/libva-fake-driver.git' + '@' + '6cc0a9bf51b520aae3cedc86c6b3c8892c38dac3', + Var('chromium_git') + '/chromiumos/platform/libva-fake-driver.git' + '@' + 'a9bcab9cd6b15d4e3634ca44d5e5f7652c612194', 'src/third_party/libvpx/source/libvpx': Var('chromium_git') + '/webm/libvpx.git' + '@' + '6f0c446c7b88d384a1c09caf33ec132e7ee24aea', @@ -2166,7 +2166,7 @@ Var('chromium_git') + '/webm/libwebp.git' + '@' + '845d5476a866141ba35ac133f856fa62f0b7445f', 'src/third_party/libyuv': - Var('chromium_git') + '/libyuv/libyuv.git' + '@' + '192b8c2238cae1c26774962eb5b61ba90cd45210', + Var('chromium_git') + '/libyuv/libyuv.git' + '@' + '86b09b24506650f226e5f270275a01f8e7498f62', 'src/third_party/lighttpd': { 'url': Var('chromium_git') + '/chromium/deps/lighttpd.git' + '@' + Var('lighttpd_revision'), @@ -2275,7 +2275,7 @@ Var('chromium_git') + '/external/github.com/cisco/openh264' + '@' + '478e5ab3eca30e600006d5a0a08b176fd34d3bd1', 'src/third_party/openscreen/src': - Var('chromium_git') + '/openscreen' + '@' + '5b3472f9168aa539c041e329c502627924d94f60', + Var('chromium_git') + '/openscreen' + '@' + '945f58d81079de7cbc424b0368df88d4ef018a47', 'src/third_party/openxr/src': { 'url': Var('chromium_git') + '/external/github.com/KhronosGroup/OpenXR-SDK' + '@' + '781f2eab3698d653c804ecbd11e0aed47eaad1c6', @@ -2301,7 +2301,7 @@ Var('pdfium_git') + '/pdfium.git' + '@' + Var('pdfium_revision'), 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '46bab18c5264682dff25a2bd1caac99eb1dc4737', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'e463a6f141d1f836eccecf2b63bafd1d5c1d936f', 'src/base/tracing/test/data': { 'bucket': 'perfetto', @@ -2663,7 +2663,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '450cceb587613ac1469c5a131fac15935c99e0e7', 'src/third_party/webgpu-cts/src': - Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '726f4dd24eac0296f4ae39f11ad28d42635b5e55', + Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'be3dea4be98a7a6017259837af6a6a1a127414f2', 'src/third_party/webpagereplay': Var('chromium_git') + '/webpagereplay.git' + '@' + Var('webpagereplay_revision'), @@ -4475,7 +4475,7 @@ 'src/ios_internal': { 'url': Var('chrome_git') + '/chrome/ios_internal.git' + '@' + - '3af99a5d7926566c96dc05b1f661b3d0b11b321b', + '99e655dc13dd8c7c26118c100796228339923c65', 'condition': 'checkout_ios and checkout_src_internal', },
diff --git a/ash/accessibility/flash_screen_controller.h b/ash/accessibility/flash_screen_controller.h index 8a551d6..104b1900 100644 --- a/ash/accessibility/flash_screen_controller.h +++ b/ash/accessibility/flash_screen_controller.h
@@ -64,9 +64,6 @@ gfx::ThrobAnimation throb_animation_; - // How many flashes have elapsed for this timer. - int num_completed_flashes_ = 0; - base::ScopedObservation<message_center::MessageCenter, MessageCenterObserver> notification_observer_{this}; };
diff --git a/ash/ambient/ambient_controller_unittest.cc b/ash/ambient/ambient_controller_unittest.cc index 6c0b529..66ec9527 100644 --- a/ash/ambient/ambient_controller_unittest.cc +++ b/ash/ambient/ambient_controller_unittest.cc
@@ -2043,7 +2043,7 @@ ASSERT_TRUE(GetContainerView()); // Simulate user session start (e.g. user login) - CreateUserSessions(/*session_count=*/1); + SimulateUserLogin(kDefaultUserEmail); // Confirm that ambient mode is not shown if disabled. (disabled by default) FastForwardByLockScreenInactivityTimeout(); @@ -2093,7 +2093,7 @@ EXPECT_FALSE(ambient_controller()->ShouldShowAmbientUi()); // Simulate login - CreateUserSessions(/*session_count=*/1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_FALSE(ambient_controller()->ShouldShowAmbientUi()); SetAmbientModeManagedScreensaverEnabled(true); @@ -2126,7 +2126,7 @@ EXPECT_FALSE(ambient_controller()->ShouldShowAmbientUi()); // Simulate login - CreateUserSessions(/*session_count=*/1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_FALSE(ambient_controller()->ShouldShowAmbientUi()); SetAmbientModeManagedScreensaverEnabled(true);
diff --git a/ash/app_list/views/search_box_view.h b/ash/app_list/views/search_box_view.h index 49f178af..513f1ae 100644 --- a/ash/app_list/views/search_box_view.h +++ b/ash/app_list/views/search_box_view.h
@@ -321,9 +321,6 @@ // The corner radius of the search box background. int corner_radius_ = 0; - // Whether an IPH is allowed to be shown or not. - bool is_iph_allowed_ = false; - // The category filter menu adapter and model that handles the menu life cycle // and command execution. std::unique_ptr<ui::SimpleMenuModel> filter_menu_model_;
diff --git a/ash/capture_mode/capture_mode_controller.cc b/ash/capture_mode/capture_mode_controller.cc index 2d4c49f..a3d5f1fd 100644 --- a/ash/capture_mode/capture_mode_controller.cc +++ b/ash/capture_mode/capture_mode_controller.cc
@@ -699,8 +699,8 @@ return; } - search_results_panel_widget_ = - SearchResultsPanel::CreateWidget(capture_mode_session_->current_root()); + search_results_panel_widget_ = SearchResultsPanel::CreateWidget( + capture_mode_session_->current_root(), is_active); RecordSearchResultsPanelEntryType(capture_mode_session_->active_behavior()); @@ -758,6 +758,13 @@ } } +void CaptureModeController::RefreshSearchResultsPanel(bool is_active) { + // Note we re-stack the panel even if it's not currently visible. + if (auto* panel = GetSearchResultsPanel()) { + panel->RefreshStackingOrder(is_active); + } +} + bool CaptureModeController::IsActive() const { return capture_mode_session_ && !capture_mode_session_->is_shutting_down(); } @@ -911,6 +918,7 @@ capture_mode_session_->ReportSessionHistograms(); capture_mode_session_->Shutdown(); capture_mode_session_.reset(); + RefreshSearchResultsPanel(/*is_active=*/false); delegate_->OnSessionStateChanged(/*started=*/false); }
diff --git a/ash/capture_mode/capture_mode_controller.h b/ash/capture_mode/capture_mode_controller.h index d1194ae..2c9345ed 100644 --- a/ash/capture_mode/capture_mode_controller.h +++ b/ash/capture_mode/capture_mode_controller.h
@@ -730,6 +730,11 @@ // remove it if remote. void DeleteFileAsync(const base::FilePath& path); + // Refreshes the search results panel stacking order if it exists. `is_active` + // indicates whether capture mode session is currently active and will be used + // to determine the panel stacking order. + void RefreshSearchResultsPanel(bool is_active); + // The ID of this object as a client of the video conference manager. const base::UnguessableToken vc_client_id_ = base::UnguessableToken::Create();
diff --git a/ash/capture_mode/capture_mode_session.cc b/ash/capture_mode/capture_mode_session.cc index d0ceea1..63118af 100644 --- a/ash/capture_mode/capture_mode_session.cc +++ b/ash/capture_mode/capture_mode_session.cc
@@ -2301,8 +2301,6 @@ // Allow all events located on the results panel (if present) to go through. // See `CaptureModeController::IsEventOnSearchResultsPanel()`. - // TODO(b/377019438): Block all events that aren't targeting the panel from - // reaching other UI elements underneath. // This must be done after `MaybeUpdateCaptureUisOpacity()` which will hide // the panel if a drag is in progress and before running // `deferred_cursor_updater` to allow the panel to update the cursor type. @@ -2311,11 +2309,16 @@ if (cursor_setter_) { cursor_setter_->ResetCursor(); } + // If the event is a mouse or touch down, we assume the user wants to + // interact with the panel and stop the session now. + if (is_press_event) { + controller_->Stop(); // Deletes `this`. + } return; } // Update the value of `should_pass_located_event_to_camera_preview_` here - // before calling `UpdateCursor` which uses it. + // before calling `UpdateCursor` which uses should_pass_located_event_to_camera_preview_ = ShouldPassEventToCameraPreview(event);
diff --git a/ash/capture_mode/search_results_panel.cc b/ash/capture_mode/search_results_panel.cc index 8196cabb..ad1595f 100644 --- a/ash/capture_mode/search_results_panel.cc +++ b/ash/capture_mode/search_results_panel.cc
@@ -51,6 +51,13 @@ gfx::Insets::TLBR(14, 0, 14, 16); inline constexpr gfx::Insets kHeaderIconSpacing = gfx::Insets::TLBR(0, 2, 0, 8); +// Returns the target container window for the panel widget. +aura::Window* GetParentContainer(aura::Window* root, bool is_active) { + return Shell::GetContainer( + root, is_active ? kShellWindowId_CaptureModeSearchResultsPanel + : kShellWindowId_SystemModalContainer); +} + } // namespace // TODO: crbug.com/377764351 - Fix the textfield being too far to the left when @@ -222,12 +229,12 @@ SearchResultsPanel::~SearchResultsPanel() = default; // static -views::UniqueWidgetPtr SearchResultsPanel::CreateWidget(aura::Window* root) { +views::UniqueWidgetPtr SearchResultsPanel::CreateWidget(aura::Window* root, + bool is_active) { views::Widget::InitParams params( views::Widget::InitParams::CLIENT_OWNS_WIDGET, views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); - params.parent = - Shell::GetContainer(root, kShellWindowId_CaptureModeSearchResultsPanel); + params.parent = GetParentContainer(root, is_active); params.opacity = views::Widget::InitParams::WindowOpacity::kOpaque; params.activatable = views::Widget::InitParams::Activatable::kYes; params.shadow_elevation = wm::kShadowElevationInactiveWindow; @@ -253,6 +260,15 @@ search_box_view_->textfield_->SetText(text); } +void SearchResultsPanel::RefreshStackingOrder(bool is_active) { + aura::Window* native_window = GetWidget()->GetNativeWindow(); + // While the capture mode session is active, we parent the panel to its own + // container, else we parent it to the system modal container. + aura::Window* new_parent = + GetParentContainer(native_window->GetRootWindow(), is_active); + views::Widget::ReparentNativeView(native_window, new_parent); +} + bool SearchResultsPanel::HasFocus() const { // Returns true if `this` or any of its child views has focus. const views::FocusManager* focus_manager = GetFocusManager();
diff --git a/ash/capture_mode/search_results_panel.h b/ash/capture_mode/search_results_panel.h index cdb8c868..4518ffb8 100644 --- a/ash/capture_mode/search_results_panel.h +++ b/ash/capture_mode/search_results_panel.h
@@ -34,7 +34,8 @@ SearchResultsPanel& operator=(const SearchResultsPanel&) = delete; ~SearchResultsPanel() override; - static views::UniqueWidgetPtr CreateWidget(aura::Window* const root); + static views::UniqueWidgetPtr CreateWidget(aura::Window* root, + bool is_active); AshWebView* search_results_view() const { return search_results_view_; } views::Button* close_button() const { return close_button_; } @@ -46,6 +47,11 @@ virtual void SetSearchBoxImage(const gfx::ImageSkia& image); void SetSearchBoxText(const std::u16string& text); + // Refreshes the panel z-order. `is_active` indicates whether capture mode + // session is currently active and will be used to determine the panel + // stacking order. + void RefreshStackingOrder(bool is_active); + // SystemPanelView: bool HasFocus() const override;
diff --git a/ash/capture_mode/sunfish_unittest.cc b/ash/capture_mode/sunfish_unittest.cc index ad8cf174..f4b2432 100644 --- a/ash/capture_mode/sunfish_unittest.cc +++ b/ash/capture_mode/sunfish_unittest.cc
@@ -36,6 +36,7 @@ #include "ash/public/cpp/capture_mode/capture_mode_delegate.h" #include "ash/public/cpp/capture_mode/capture_mode_test_api.h" #include "ash/public/cpp/scanner/scanner_delegate.h" +#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/system/toast_manager.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/scanner/fake_scanner_profile_scoped_delegate.h" @@ -577,7 +578,8 @@ // Tests that the search results panel is draggable. TEST_F(SunfishTest, DragSearchResultsPanel) { - auto widget = SearchResultsPanel::CreateWidget(Shell::GetPrimaryRootWindow()); + auto widget = SearchResultsPanel::CreateWidget(Shell::GetPrimaryRootWindow(), + /*is_active=*/false); widget->SetBounds(gfx::Rect(100, 100, capture_mode::kSearchResultsPanelWidth, capture_mode::kSearchResultsPanelHeight)); widget->Show(); @@ -1879,6 +1881,56 @@ ->has_focus()); } +// Tests the panel stacking order in Sunfish session. +TEST_F(SunfishTest, PanelStackingOrder) { + // Show the panel in Sunfish session. Test it is stacked to the Search Results + // Panel container. + auto* controller = CaptureModeController::Get(); + controller->StartSunfishSession(); + auto* generator = GetEventGenerator(); + SelectCaptureModeRegion(generator, gfx::Rect(50, 50, 400, 400), + /*release_mouse=*/true, /*verify_region=*/true); + WaitForImageCapturedForSearch(PerformCaptureType::kSunfish); + auto* panel_widget = controller->search_results_panel_widget(); + ASSERT_TRUE(panel_widget); + aura::Window* panel_window = panel_widget->GetNativeWindow(); + EXPECT_EQ(Shell::GetContainer(panel_window->GetRootWindow(), + kShellWindowId_CaptureModeSearchResultsPanel), + panel_window->parent()); + + // Right click on the panel. Test we end the session and the panel is stacked + // to the System Modal container. + generator->MoveMouseTo(panel_widget->GetWindowBoundsInScreen().CenterPoint()); + EXPECT_TRUE(controller->IsActive()); + generator->ClickRightButton(); + EXPECT_FALSE(controller->IsActive()); + EXPECT_EQ(Shell::GetContainer(panel_window->GetRootWindow(), + kShellWindowId_SystemModalContainer), + panel_window->parent()); + + // Start default session. The panel will be closed. + StartCaptureSession(CaptureModeSource::kRegion, CaptureModeType::kImage); + EXPECT_FALSE(controller->search_results_panel_widget()); + + // Select a new region, then press the Search button. Test we end the session + // and the panel is stacked to the System Modal container. + CaptureModeTestApi test_api; + test_api.SetUserSelectedRegion(gfx::Rect()); + SelectCaptureModeRegion(generator, gfx::Rect(50, 50, 400, 400), + /*release_mouse=*/true, /*verify_region=*/true); + CaptureModeSessionTestApi session_test_api( + controller->capture_mode_session()); + LeftClickOn( + session_test_api.GetButtonWithViewID(ActionButtonViewID::kSearchButton)); + WaitForImageCapturedForSearch(PerformCaptureType::kSearch); + panel_widget = controller->search_results_panel_widget(); + ASSERT_TRUE(panel_widget); + panel_window = panel_widget->GetNativeWindow(); + EXPECT_EQ(Shell::GetContainer(panel_window->GetRootWindow(), + kShellWindowId_SystemModalContainer), + panel_window->parent()); +} + class ScannerTest : public AshTestBase { public: ScannerTest()
diff --git a/ash/detachable_base/detachable_base_notification_controller_unittest.cc b/ash/detachable_base/detachable_base_notification_controller_unittest.cc index 5f9f9d1d..30996a8 100644 --- a/ash/detachable_base/detachable_base_notification_controller_unittest.cc +++ b/ash/detachable_base/detachable_base_notification_controller_unittest.cc
@@ -77,7 +77,7 @@ TEST_F(DetachableBaseNotificationControllerTest, ShowPairingNotificationIfSessionNotBlocked) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // The first detachable base used by the user - no notification expected. detachable_base_handler()->PairChallengeSucceeded({0x01, 0x01}); @@ -98,7 +98,7 @@ TEST_F(DetachableBaseNotificationControllerTest, ShowNotificationOnNonAuthenticatedBases) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); detachable_base_handler()->PairChallengeFailed(); EXPECT_TRUE(IsBaseChangedNotificationVisible()); @@ -106,7 +106,7 @@ TEST_F(DetachableBaseNotificationControllerTest, UpdateNotificationOnUserSwitch) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // The first detachable base used by the user - no notification expected. detachable_base_handler()->PairChallengeSucceeded({0x01, 0x01}); @@ -127,7 +127,7 @@ TEST_F(DetachableBaseNotificationControllerTest, NonAuthenticatedBaseNotificationOnUserSwitch) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); detachable_base_handler()->PairChallengeFailed(); EXPECT_TRUE(IsBaseChangedNotificationVisible()); @@ -185,12 +185,12 @@ detachable_base_handler()->PairChallengeFailed(); EXPECT_FALSE(IsBaseChangedNotificationVisible()); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_TRUE(IsBaseChangedNotificationVisible()); } TEST_F(DetachableBaseNotificationControllerTest, NoNotificationOnLockScreen) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // The first detachable base used by the user - no notification expected. detachable_base_handler()->PairChallengeSucceeded({0x01, 0x01}); @@ -205,7 +205,7 @@ TEST_F(DetachableBaseNotificationControllerTest, NoNotificationAfterLockScreenIfSetAsUsed) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // The first detachable base used by the user - no notification expected. detachable_base_handler()->PairChallengeSucceeded({0x01, 0x01}); BlockUserSession(UserSessionBlockReason::BLOCKED_BY_LOCK_SCREEN); @@ -225,16 +225,17 @@ // about the base. TEST_F(DetachableBaseNotificationControllerTest, NonAuthenticatedBaseNotificationNotShownOnLock) { - BlockUserSession(UserSessionBlockReason::BLOCKED_BY_LOCK_SCREEN); + ASSERT_TRUE(IsInSessionState(session_manager::SessionState::LOGIN_PRIMARY)); detachable_base_handler()->PairChallengeFailed(); EXPECT_FALSE(IsBaseChangedNotificationVisible()); - UnblockUserSession(); + SimulateUserLogin(kDefaultUserEmail); + EXPECT_TRUE(IsBaseChangedNotificationVisible()); } TEST_F(DetachableBaseNotificationControllerTest, NotificationOnUpdateRequired) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); detachable_base_handler()->BaseFirmwareUpdateNeeded(); EXPECT_TRUE(IsBaseRequiresUpdateNotificationVisible()); @@ -253,7 +254,7 @@ EXPECT_FALSE(IsBaseRequiresUpdateNotificationVisible()); // Login, expect the notification to be shown. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_TRUE(IsBaseRequiresUpdateNotificationVisible()); // The notification should be removed when the base gets detached.
diff --git a/ash/focus/ash_focus_rules_unittest.cc b/ash/focus/ash_focus_rules_unittest.cc index 265747d..0835feaf 100644 --- a/ash/focus/ash_focus_rules_unittest.cc +++ b/ash/focus/ash_focus_rules_unittest.cc
@@ -38,7 +38,10 @@ TestPrefServiceProvider* prefs_provider) : TestSessionControllerClient(controller, prefs_provider) { InitializeAndSetClient(); - CreatePredefinedUserSessions(1); + + Reset(); + AddUserSession("user0@tray"); + SetSessionState(session_manager::SessionState::ACTIVE); } LockScreenSessionControllerClient(const LockScreenSessionControllerClient&) =
diff --git a/ash/metrics/login_unlock_throughput_recorder_unittest.cc b/ash/metrics/login_unlock_throughput_recorder_unittest.cc index d32a7b2..a9cb363 100644 --- a/ash/metrics/login_unlock_throughput_recorder_unittest.cc +++ b/ash/metrics/login_unlock_throughput_recorder_unittest.cc
@@ -201,7 +201,7 @@ } void LoginOwner() { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_ACTIVE, LoginState::LOGGED_IN_USER_REGULAR); }
diff --git a/ash/metrics/unlock_throughput_recorder_unittest.cc b/ash/metrics/unlock_throughput_recorder_unittest.cc index 396977a..642a609 100644 --- a/ash/metrics/unlock_throughput_recorder_unittest.cc +++ b/ash/metrics/unlock_throughput_recorder_unittest.cc
@@ -40,7 +40,7 @@ protected: void LoginOwner() { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); LoginState::Get()->SetLoggedInState(LoginState::LOGGED_IN_ACTIVE, LoginState::LOGGED_IN_USER_REGULAR); }
diff --git a/ash/metrics/user_metrics_recorder_unittest.cc b/ash/metrics/user_metrics_recorder_unittest.cc index 17615b6..24976eb 100644 --- a/ash/metrics/user_metrics_recorder_unittest.cc +++ b/ash/metrics/user_metrics_recorder_unittest.cc
@@ -63,7 +63,7 @@ EXPECT_FALSE(test_api().IsUserInActiveDesktopEnvironment()); // Environment is active after login. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ASSERT_TRUE(session->IsActiveUserSessionStarted()); EXPECT_TRUE(test_api().IsUserInActiveDesktopEnvironment()); @@ -97,7 +97,7 @@ // recorded when a user is active in a desktop environment. TEST_F(UserMetricsRecorderTest, VerifyStatsRecordedWhenUserInActiveDesktopEnvironment) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ASSERT_TRUE(test_api().IsUserInActiveDesktopEnvironment()); test_api().RecordPeriodicMetrics(); @@ -109,7 +109,7 @@ // Verify the shelf item counts recorded by the // UserMetricsRecorder::RecordPeriodicMetrics() method. TEST_F(UserMetricsRecorderTest, ValuesRecordedByRecordShelfItemCounts) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // Make sure the shelf model is empty at first. ShelfModel* shelf_model = ShelfModel::Get();
diff --git a/ash/public/cpp/ash_web_view.h b/ash/public/cpp/ash_web_view.h index 0a80bd6..518fcd1 100644 --- a/ash/public/cpp/ash_web_view.h +++ b/ash/public/cpp/ash_web_view.h
@@ -11,9 +11,9 @@ #include "base/observer_list_types.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/geometry/rounded_corners_f.h" +#include "url/gurl.h" #include "ui/views/view.h" -class GURL; enum class WindowOpenDisposition; namespace ash { @@ -74,6 +74,10 @@ // Used to override the Media Controls source title. Empty strings will // trigger default parent behavior. std::string source_title; + + // URL to open when AshWebView contents are activated but the widget is not + // activatable. Empty GURLs will trigger default parent behavior. + GURL activation_url; }; // An observer which receives AshWebView events.
diff --git a/ash/quick_insert/views/quick_insert_image_item_grid_view.cc b/ash/quick_insert/views/quick_insert_image_item_grid_view.cc index c9fc409..d5d658e7 100644 --- a/ash/quick_insert/views/quick_insert_image_item_grid_view.cc +++ b/ash/quick_insert/views/quick_insert_image_item_grid_view.cc
@@ -67,8 +67,7 @@ } // namespace QuickInsertImageItemGridView::QuickInsertImageItemGridView(int grid_width) - : grid_width_(grid_width), - focus_search_(std::make_unique<FocusSearch>( + : focus_search_(std::make_unique<FocusSearch>( this, base::BindRepeating(&QuickInsertImageItemGridView::GetFocusableItems, base::Unretained(this)))) {
diff --git a/ash/quick_insert/views/quick_insert_image_item_grid_view.h b/ash/quick_insert/views/quick_insert_image_item_grid_view.h index e68b260..c1ee4c1 100644 --- a/ash/quick_insert/views/quick_insert_image_item_grid_view.h +++ b/ash/quick_insert/views/quick_insert_image_item_grid_view.h
@@ -86,7 +86,6 @@ // Returns items in this grid in focus traversal order. const views::View::Views& GetFocusableItems() const; - int grid_width_ = 0; views::View::Views focusable_items_; std::unique_ptr<FocusSearch> focus_search_; };
diff --git a/ash/quick_pair/keyed_service/quick_pair_mediator.cc b/ash/quick_pair/keyed_service/quick_pair_mediator.cc index 8c8c549..28f7ecb1 100644 --- a/ash/quick_pair/keyed_service/quick_pair_mediator.cc +++ b/ash/quick_pair/keyed_service/quick_pair_mediator.cc
@@ -31,6 +31,7 @@ #include "ash/quick_pair/scanning/scanner_broker_impl.h" #include "ash/quick_pair/ui/actions.h" #include "ash/quick_pair/ui/ui_broker_impl.h" +#include "base/base64.h" #include "base/task/single_thread_task_runner.h" #include "chromeos/ash/services/bluetooth_config/fast_pair_delegate.h" #include "chromeos/ash/services/quick_pair/quick_pair_process.h" @@ -48,6 +49,19 @@ constexpr base::TimeDelta kShortBanDiscoveryNotificationBanTime = base::Minutes(5); +std::pair<std::string, Protocol> GetDiscoveryBanListKey( + scoped_refptr<Device> device) { + switch (device->protocol()) { + case Protocol::kFastPairRetroactive: + case Protocol::kFastPairInitial: + return std::make_pair(device->metadata_id(), device->protocol()); + case Protocol::kFastPairSubsequent: + CHECK(device->account_key().has_value()); + std::string encoded = base::Base64Encode(device->account_key().value()); + return std::make_pair(encoded, device->protocol()); + } +} + } // namespace std::unique_ptr<Mediator> Mediator::FactoryImpl::BuildInstance() { @@ -178,8 +192,8 @@ bool Mediator::IsDeviceBlockedForDiscoveryNotifications( scoped_refptr<Device> device) { - auto it = discovery_notification_block_list_.find( - std::make_pair(device->metadata_id(), device->protocol())); + auto it = + discovery_notification_block_list_.find(GetDiscoveryBanListKey(device)); if (it == discovery_notification_block_list_.end()) { return false; } @@ -399,48 +413,82 @@ } void Mediator::UpdateDiscoveryBlockList(scoped_refptr<Device> device) { - auto it = discovery_notification_block_list_.find( - std::make_pair(device->metadata_id(), device->protocol())); + auto discovery_block_list_key = GetDiscoveryBanListKey(device); + if (device->protocol() == Protocol::kFastPairSubsequent) { + // Subsequent pairing is discovered more frequently than initial pairing and + // the notification is more intrusive than it is on Android. + // Add the notification to the block list with the short ban (5 minute) + // time. The user can put the device into pairing mode to see the initial + // pair notification. + auto it = discovery_notification_block_list_.find(discovery_block_list_key); + if (it == discovery_notification_block_list_.end()) { + discovery_notification_block_list_[discovery_block_list_key] = + std::make_pair( + DiscoveryNotificationDismissalState::kShortBan, + std::make_optional(base::Time::Now() + + kShortBanDiscoveryNotificationBanTime)); + return; + } else { + // If the device is already in the block-list, update the state and the + // expire timestamp. + DiscoveryNotificationDismissalState dismissal_state = it->second.first; + switch (dismissal_state) { + case DiscoveryNotificationDismissalState::kShortBan: + // Since `IsDeviceBlockedForDiscoveryNotifications` has an explicit + // check for `kLongBan`, the timestamp is std::nullopt. The `kLongBan` + // does not have an expiration timeout. + it->second = std::make_pair( + DiscoveryNotificationDismissalState::kLongBan, std::nullopt); + return; + case DiscoveryNotificationDismissalState::kDismissed: + case DiscoveryNotificationDismissalState::kLongBan: + // Subsequent pair notifications should only ever reoccur after a + // short ban. + NOTREACHED(); + } + } + } else { + // We use the exponential back-off strategy for initial and retroactive + // pair. If this is the first time we are seeing this device, create a new + // value in the block-list. + auto it = discovery_notification_block_list_.find(discovery_block_list_key); + if (it == discovery_notification_block_list_.end()) { + discovery_notification_block_list_[discovery_block_list_key] = + std::make_pair( + DiscoveryNotificationDismissalState::kDismissed, + std::make_optional(base::Time::Now() + + kDismissedDiscoveryNotificationBanTime)); + return; + } - // If this is the first time we are seeing this device, create a new value in - // the block-list. - if (it == discovery_notification_block_list_.end()) { - discovery_notification_block_list_[std::make_pair(device->metadata_id(), - device->protocol())] = - std::make_pair( - DiscoveryNotificationDismissalState::kDismissed, + // If the device is already in the block-list, update the state and the + // expire timestamp. + DiscoveryNotificationDismissalState dismissal_state = it->second.first; + switch (dismissal_state) { + case DiscoveryNotificationDismissalState::kDismissed: + it->second = std::make_pair( + DiscoveryNotificationDismissalState::kShortBan, std::make_optional(base::Time::Now() + - kDismissedDiscoveryNotificationBanTime)); - return; + kShortBanDiscoveryNotificationBanTime)); + return; + case DiscoveryNotificationDismissalState::kShortBan: + // Since `IsDeviceBlockedForDiscoveryNotifications` has an explicit + // check for `kLongBan`, the timestamp is std::nullopt. The `kLongBan` + // does not have an expiration timeout. + it->second = std::make_pair( + DiscoveryNotificationDismissalState::kLongBan, std::nullopt); + return; + case DiscoveryNotificationDismissalState::kLongBan: + // If the device had the state `kLongBan`, it should have never been + // shown again, so we are expected to never get to this state when a + // `kLongBan` was shown, and then dismissed by user. + NOTREACHED(); + } } - - // If the device is already in the block-list, update the state and the - // expire timestamp. - DiscoveryNotificationDismissalState dismissal_state = it->second.first; - switch (dismissal_state) { - case DiscoveryNotificationDismissalState::kDismissed: - it->second = std::make_pair( - DiscoveryNotificationDismissalState::kShortBan, - std::make_optional(base::Time::Now() + - kShortBanDiscoveryNotificationBanTime)); - return; - case DiscoveryNotificationDismissalState::kShortBan: - // Since `IsDeviceBlockedForDiscoveryNotifications` has an explicit - // check for `kLongBan`, the timestamp is std::nullopt. The `kLongBan` - // does not have an expiration timeout. - it->second = std::make_pair(DiscoveryNotificationDismissalState::kLongBan, - std::nullopt); - return; - case DiscoveryNotificationDismissalState::kLongBan: - // If the device had the state `kLongBan`, it should have never been - // shown again, so we are expected to never get to this state when a - // `kLongBan` was shown, and then dismissed by user. - NOTREACHED(); } -} void Mediator::RemoveFromDiscoveryBlockList(scoped_refptr<Device> device) { - auto key = std::make_pair(device->metadata_id(), device->protocol()); + auto key = GetDiscoveryBanListKey(device); discovery_notification_block_list_.erase(key); } @@ -477,8 +525,6 @@ // When the user explicitly dismisses the discovery notification, update // the device's block-list value accordingly. UpdateDiscoveryBlockList(device); - [[fallthrough]]; - case DiscoveryAction::kDismissedByTimeout: // When the notification is dismissed by timeout or dismissed by user, // there will be no more notifications for |device|. We reset // |device_currently_showing_notification_| to enforce the first come, @@ -491,6 +537,20 @@ device_currently_showing_notification_ = nullptr; FastPairHandshakeLookup::GetInstance()->Erase(device); break; + case DiscoveryAction::kDismissedByTimeout: + // When the device is not in pairing mode, it can change its + // service data frequently which results in lots of subsequent pair + // notifications. To prevent spam, we'll add these notifications to the + // block list even when the notification is dismissed by timeout. We + // additionally have stricter ban times for these notifications. Users can + // get around these strict ban times by entering pairing mode and going + // through the Initial Pair flow. + if (device->protocol() == Protocol::kFastPairSubsequent) { + UpdateDiscoveryBlockList(device); + } + device_currently_showing_notification_ = nullptr; + FastPairHandshakeLookup::GetInstance()->Erase(device); + break; case DiscoveryAction::kLearnMore: break; }
diff --git a/ash/quick_pair/keyed_service/quick_pair_mediator.h b/ash/quick_pair/keyed_service/quick_pair_mediator.h index d01df14..98a308db 100644 --- a/ash/quick_pair/keyed_service/quick_pair_mediator.h +++ b/ash/quick_pair/keyed_service/quick_pair_mediator.h
@@ -160,23 +160,28 @@ scoped_refptr<Device> device_currently_showing_notification_; // The discovery notification block-list, where - // std::pair<std::string, Protocol> represents the block-list key of the - // device’s model ID and the pairing protocol corresponding (either initial - // or subsequent), and the value is + // std::pair<std::string, Protocol> represents the block-list key in the form + // of: + // - model ID, Protocol::kFastPairInitial + // - model ID, Protocol::kFastPairRetroactive + // - base64 account key, Protocol::kFastPairSubsequent + // We use account key for subsequent pair to allow for stricter ban times. + // The user can enter pairing mode on the device to avoid hitting the + // subsequent pair block list. The value is // std::pair<DiscoveryNotificationDismissalState, std::optional<base::Time> // representing the current state of the device and the timestamp of when it // is set to expire. It is optional because `kLongBan` does not have an expire - // timeout. This block-list bans a device model (by model ID), which means - // that if a user has two of the same device, or two devices are pairing in - // the same range, both will be blocked for discovery notifications. This is a - // rare edge case that we consider in order to align with Android by banning - // by model id. We don’t expect many users to have two of the same device, or - // two of the same device pairing in the same range at the same time, and - // users can pair via Bluetooth settings if needed. We cannot use the BLE - // address as a unique identifier for a device because it rotates, and when - // Fast Pair shows the discovery notifications, it does not yet have the - // classic mac address to unique identify a device (this is given as part of - // the FastPairHandshake). + // timeout. This block-list bans a device model (by model ID) for Initial + // Pair, which means that if a user has two of the same device, or two devices + // are pairing in the same range, both will be blocked for discovery + // notifications. This is a rare edge case that we consider in order to align + // with Android by banning by model id. We don’t expect many users to have two + // of the same device, or two of the same device pairing in the same range at + // the same time, and users can pair via Bluetooth settings if needed. We + // cannot use the BLE address as a unique identifier for a device because it + // rotates, and when Fast Pair shows the discovery notifications, it does not + // yet have the classic mac address to unique identify a device (this is given + // as part of the FastPairHandshake). base::flat_map< std::pair<std::string, Protocol>, std::pair<DiscoveryNotificationDismissalState, std::optional<base::Time>>>
diff --git a/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc b/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc index 0bc3e169..e8f35d7 100644 --- a/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc +++ b/ash/quick_pair/keyed_service/quick_pair_mediator_unittest.cc
@@ -163,6 +163,8 @@ kTestMetadataId2, kTestAddress, Protocol::kFastPairInitial); subsequent_device_ = base::MakeRefCounted<Device>( kTestMetadataId, kTestAddress, Protocol::kFastPairSubsequent); + std::vector<uint8_t> data = {0}; + subsequent_device_->set_account_key(data); retroactive_device_ = base::MakeRefCounted<Device>( kTestMetadataId, kTestAddress, Protocol::kFastPairRetroactive); base::RunLoop().RunUntilIdle(); @@ -877,35 +879,16 @@ EXPECT_CALL(*mock_ui_broker_, ShowDiscovery).Times(0); mock_scanner_broker_->NotifyDeviceFound(subsequent_device_); - // After the 2 second timeout, when the device is found again, expect - // the notification to be shown. - task_environment()->FastForwardBy(kDismissedDiscoveryNotificationBanTime); - EXPECT_CALL(*mock_ui_broker_, ShowDiscovery).Times(1); - mock_scanner_broker_->NotifyDeviceFound(subsequent_device_); - - // When the device is found again, we expect the notification to not be shown - // since it's within the 5 minute short ban timeout period after it has been - // dismissed by user again. - mock_ui_broker_->NotifyDiscoveryAction(subsequent_device_, - DiscoveryAction::kDismissedByUser); - EXPECT_CALL(*mock_ui_broker_, ShowDiscovery).Times(0); - mock_scanner_broker_->NotifyDeviceFound(subsequent_device_); - // After the 5 minute timeout, when the device is found again, expect // the notification to be shown. task_environment()->FastForwardBy(kShortBanDiscoveryNotificationBanTime); EXPECT_CALL(*mock_ui_broker_, ShowDiscovery).Times(1); mock_scanner_broker_->NotifyDeviceFound(subsequent_device_); - - // When the device is found again, we expect the notification to not be shown - // again since it's in the long ban state. mock_ui_broker_->NotifyDiscoveryAction(subsequent_device_, DiscoveryAction::kDismissedByUser); - EXPECT_CALL(*mock_ui_broker_, ShowDiscovery).Times(0); - mock_scanner_broker_->NotifyDeviceFound(subsequent_device_); // Even after a long timeout period, we do not expect the notification to be - // shown again under the long ban period. + // shown again after the second dismissal. task_environment()->FastForwardBy(kLongBanDiscoveryNotificationBanTime); EXPECT_CALL(*mock_ui_broker_, ShowDiscovery).Times(0); mock_scanner_broker_->NotifyDeviceFound(subsequent_device_); @@ -918,13 +901,15 @@ EXPECT_CALL(*mock_ui_broker_, ShowDiscovery).Times(1); mock_scanner_broker_->NotifyDeviceFound(subsequent_device_); - // We also expect the notification to be shown again after a successful - // pairing. Trigger the ban logic. + // We also expect the notification to be banned if the notification is + // ignored and dismissed by timeout. mock_ui_broker_->NotifyDiscoveryAction(subsequent_device_, - DiscoveryAction::kDismissedByUser); + DiscoveryAction::kDismissedByTimeout); EXPECT_CALL(*mock_ui_broker_, ShowDiscovery).Times(0); mock_scanner_broker_->NotifyDeviceFound(subsequent_device_); - // Trigger a successful pairing + + // We also expect the notification to be shown again after a successful + // pairing. Trigger a successful pairing. mock_pairer_broker_->NotifyDevicePaired(subsequent_device_); EXPECT_CALL(*mock_ui_broker_, ShowDiscovery).Times(1); mock_scanner_broker_->NotifyDeviceFound(subsequent_device_);
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index 13e7341..32c505c 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc
@@ -444,7 +444,7 @@ login_modal_widget->Close(); // Configure user session environment. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_EQ(1, session_controller->NumberOfLoggedInUsers()); EXPECT_TRUE(session_controller->IsActiveUserSessionStarted()); EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer),
diff --git a/ash/session/test_session_controller_client.cc b/ash/session/test_session_controller_client.cc index 376d5ad..4aa1dc4 100644 --- a/ash/session/test_session_controller_client.cc +++ b/ash/session/test_session_controller_client.cc
@@ -117,25 +117,6 @@ controller_->SetSessionInfo(session_info_); } -void TestSessionControllerClient::CreatePredefinedUserSessions(int count) { - DCHECK_GT(count, 0); - - // Resets the controller's state. - Reset(); - - // Adds user sessions with numbered emails if more are needed. - for (int numbered_user_index = 0; numbered_user_index < count; - ++numbered_user_index) { - AddUserSession(base::StringPrintf("user%d@tray", numbered_user_index)); - } - - // Sets the first user as active. - SwitchActiveUser(controller_->GetUserSession(0)->user_info.account_id); - - // Updates session state after adding user sessions. - SetSessionState(session_manager::SessionState::ACTIVE); -} - void TestSessionControllerClient::AddUserSession( const std::string& display_email, user_manager::UserType user_type, @@ -349,6 +330,12 @@ return existing_users_count_; } +int TestSessionControllerClient::NumberOfLoggedInUsers() const { + // This should be migrated to GetExistingUserCount when + // TestSessionControllerImpl is removed. + return controller_->NumberOfLoggedInUsers(); +} + void TestSessionControllerClient::DoSwitchUser(const AccountId& account_id, bool switch_user) { if (!switch_user)
diff --git a/ash/session/test_session_controller_client.h b/ash/session/test_session_controller_client.h index 1aa5167..0d5e5b92 100644 --- a/ash/session/test_session_controller_client.h +++ b/ash/session/test_session_controller_client.h
@@ -80,12 +80,6 @@ void SetIsRunningInAppMode(bool app_mode); void SetIsDemoSession(); - // Creates the |count| pre-defined user sessions. The users are named by - // numbers using "user%d@tray" template. The first user is set as active user - // to be consistent with crash-and-restore scenario. Note that existing user - // sessions prior this call will be removed without sending out notifications. - void CreatePredefinedUserSessions(int count); - // Adds a user session from a given display email. If |provide_pref_service| // is true, eagerly inject a PrefService for this user. |is_new_profile| // indicates whether the user has a newly created profile on the device. @@ -174,6 +168,8 @@ default_provide_pref_service_ = default_provide_pref_service; } + int NumberOfLoggedInUsers() const; + private: void DoSwitchUser(const AccountId& account_id, bool switch_user); @@ -203,8 +199,6 @@ bool should_show_lock_screen_ = false; - bool is_enterprise_managed_ = false; - std::tuple<bool, bool> is_eligible_for_background_replace_ = {true, true}; int existing_users_count_ = 0;
diff --git a/ash/shelf/home_button_unittest.cc b/ash/shelf/home_button_unittest.cc index c252842..0681482 100644 --- a/ash/shelf/home_button_unittest.cc +++ b/ash/shelf/home_button_unittest.cc
@@ -1002,7 +1002,9 @@ TEST_P(HomeButtonTest, LongPressGesture) { // Simulate two users with primary user as active. - CreateUserSessions(2); + auto primary = SimulateUserLogin(kDefaultUserEmail); + SimulateUserLogin(kDefaultUserEmail); + SwitchActiveUser(primary); // Enable the Assistant in system settings. prefs()->SetBoolean(assistant::prefs::kAssistantEnabled, true); @@ -1033,7 +1035,9 @@ TEST_P(HomeButtonTest, LongPressGestureInTabletMode) { // Simulate two users with primary user as active. - CreateUserSessions(2); + auto primary = SimulateUserLogin(kDefaultUserEmail); + SimulateUserLogin(kDefaultUserEmail); + SwitchActiveUser(primary); // Enable the Assistant in system settings. prefs()->SetBoolean(assistant::prefs::kAssistantEnabled, true); @@ -1109,7 +1113,9 @@ TEST_P(HomeButtonTest, LongPressGestureWithSettingsDisabled) { // Simulate two user with primary user as active. - CreateUserSessions(2); + auto primary = SimulateUserLogin(kDefaultUserEmail); + SimulateUserLogin(kDefaultUserEmail); + SwitchActiveUser(primary); // Simulate a user who has already completed setup flow, but disabled the // Assistant in settings.
diff --git a/ash/shelf/home_to_overview_nudge_controller_unittest.cc b/ash/shelf/home_to_overview_nudge_controller_unittest.cc index ea4e2a52..fcab76f 100644 --- a/ash/shelf/home_to_overview_nudge_controller_unittest.cc +++ b/ash/shelf/home_to_overview_nudge_controller_unittest.cc
@@ -48,7 +48,8 @@ base::WeakPtr<views::Widget> widget_; }; -class HomeToOverviewNudgeControllerWithNudgesDisabledTest : public AshTestBase { +class HomeToOverviewNudgeControllerWithNudgesDisabledTest + : public NoSessionAshTestBase { public: HomeToOverviewNudgeControllerWithNudgesDisabledTest() { scoped_feature_list_.InitAndDisableFeature( @@ -67,7 +68,7 @@ base::test::ScopedFeatureList scoped_feature_list_; }; -class HomeToOverviewNudgeControllerTest : public AshTestBase { +class HomeToOverviewNudgeControllerTest : public NoSessionAshTestBase { public: HomeToOverviewNudgeControllerTest() { scoped_feature_list_.InitAndEnableFeature( @@ -82,7 +83,7 @@ // AshTestBase: void SetUp() override { - AshTestBase::SetUp(); + NoSessionAshTestBase::SetUp(); GetSessionControllerClient()->SetSessionState( session_manager::SessionState::LOGIN_PRIMARY); test_clock_.Advance(base::Hours(2)); @@ -90,7 +91,7 @@ } void TearDown() override { contextual_tooltip::ClearClockOverrideForTesting(); - AshTestBase::TearDown(); + NoSessionAshTestBase::TearDown(); } HomeToOverviewNudgeController* GetNudgeController() { @@ -186,7 +187,7 @@ ->shelf_layout_manager() ->home_to_overview_nudge_controller_for_testing()); TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); std::unique_ptr<aura::Window> window_1 = CreateTestWindow(gfx::Rect(0, 0, 400, 400)); @@ -205,7 +206,7 @@ TabletModeControllerTestApi().EnterTabletMode(); EXPECT_FALSE(GetNudgeController()); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_TRUE(GetNudgeController()); } @@ -214,7 +215,7 @@ // subsequent shows, the nudge should be hidden after a timeout. TEST_F(HomeToOverviewNudgeControllerTest, ShownOnHomeScreen) { base::HistogramTester histogram_tester; - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // The nudge should not be shown in clamshell. EXPECT_FALSE(GetNudgeController()); @@ -286,7 +287,7 @@ // Tests that the nudge eventually stops showing. TEST_F(HomeToOverviewNudgeControllerTest, ShownLimitedNumberOfTimes) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList extra_windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -317,7 +318,7 @@ TEST_F(HomeToOverviewNudgeControllerTest, HiddenOnTabletModeExit) { base::HistogramTester histogram_tester; TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList extra_windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -335,7 +336,7 @@ // Tests that the nudge show is canceled when tablet mode exits. TEST_F(HomeToOverviewNudgeControllerTest, ShowCanceledOnTabletModeExit) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList extra_windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -354,7 +355,7 @@ TEST_F(HomeToOverviewNudgeControllerTest, ShowAnimationCanceledOnTabletModeExit) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList extra_windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -378,7 +379,7 @@ // Tests that the nudge is hidden when the screen is locked. TEST_F(HomeToOverviewNudgeControllerTest, HiddenOnScreenLock) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList extra_windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -404,7 +405,7 @@ // show timer runs. TEST_F(HomeToOverviewNudgeControllerTest, InAppShelfShownBeforeShowTimer) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList extra_windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -433,7 +434,7 @@ // animation to show the nudge. TEST_F(HomeToOverviewNudgeControllerTest, NudgeHiddenDuringShowAnimation) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList extra_windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -484,7 +485,7 @@ // Tests that there is no crash if the nudge widget gets closed unexpectedly. TEST_F(HomeToOverviewNudgeControllerTest, NoCrashIfNudgeWidgetGetsClosed) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -504,7 +505,7 @@ TEST_F(HomeToOverviewNudgeControllerTest, TapOnTheNudgeClosesTheNudge) { base::HistogramTester histogram_tester; TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -529,7 +530,7 @@ TEST_F(HomeToOverviewNudgeControllerTest, TapOnTheNudgeDuringShowAnimation) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList extra_windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -583,7 +584,7 @@ // times. TEST_F(HomeToOverviewNudgeControllerTest, NoNudgeAfterSuccessfulGestures) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList windows = CreateAndMinimizeWindows(2); EXPECT_FALSE(GetNudgeController()->nudge_for_testing()); @@ -648,7 +649,7 @@ // widget works - i.e. that home still transitions to overview. TEST_F(HomeToOverviewNudgeControllerTest, HomeToOverviewGestureFromNudge) { TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList windows = CreateAndMinimizeWindows(2); EXPECT_FALSE(GetNudgeController()->nudge_for_testing()); @@ -691,7 +692,7 @@ NudgeBoundsUpdatedOnDisplayBoundsChange) { UpdateDisplay("768x1200"); TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); @@ -719,7 +720,7 @@ // Enters tablet mode and sets up two minimized windows. This will create the // show nudge timer. TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); ScopedWindowList windows = CreateAndMinimizeWindows(2); ASSERT_TRUE(GetNudgeController()); EXPECT_TRUE(GetNudgeController()->HasShowTimerForTesting()); @@ -741,15 +742,13 @@ DisableNudgesForShelfControls) { SCOPED_TRACE(testing::Message() << "Pref=" << GetParam()); // Enabling accessibility shelf controls should disable the nudge. - Shell::Get() - ->session_controller() - ->GetLastActiveUserPrefService() - ->SetBoolean(GetParam(), true); + Shell::Get()->session_controller()->GetActivePrefService()->SetBoolean( + GetParam(), true); // Enters tablet mode and sets up two minimized windows. This should not // trigger the nudge show timer because shelf controls are on. TabletModeControllerTestApi().EnterTabletMode(); - CreateUserSessions(1); + SimulateNewUserFirstLogin("test@gmail.com"); ScopedWindowList windows = CreateAndMinimizeWindows(2); EXPECT_FALSE(GetNudgeController());
diff --git a/ash/shelf/login_shelf_view_unittest.cc b/ash/shelf/login_shelf_view_unittest.cc index 8903ce5f..1cc5432 100644 --- a/ash/shelf/login_shelf_view_unittest.cc +++ b/ash/shelf/login_shelf_view_unittest.cc
@@ -228,7 +228,7 @@ ShouldUpdateUiAfterShutdownPolicyChangeAtLockScreen) { EXPECT_TRUE(ShowsShelfButtons({})); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -252,7 +252,7 @@ // The initial state of |reboot_on_shutdown| is false. EXPECT_TRUE(ShowsShelfButtons({})); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifyShutdownPolicyChanged(true /*reboot_on_shutdown*/); NotifySessionStateChanged(SessionState::LOCKED); @@ -270,7 +270,7 @@ EXPECT_TRUE( login_shelf_view_->GetViewByID(LoginShelfView::kApps)->GetVisible()); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_FALSE( login_shelf_view_->GetViewByID(LoginShelfView::kApps)->GetVisible()); } @@ -470,7 +470,7 @@ } TEST_F(LoginShelfViewTest, ClickShutdownButtonOnLockScreen) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); ShutdownAndConfirm(); EXPECT_TRUE(Shell::Get()->lock_state_controller()->ShutdownRequested()); @@ -480,13 +480,13 @@ // session that starts with side shelf. See https://crbug.com/1050192. TEST_F(LoginShelfViewTest, ClickShutdownButtonOnLockScreenWithVerticalInSessionShelf) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetShelfAlignmentPref( Shell::Get()->session_controller()->GetPrimaryUserPrefService(), GetPrimaryDisplay().id(), ShelfAlignment::kLeft); ClearLogin(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); ShutdownAndConfirm(); @@ -495,7 +495,7 @@ TEST_F(LoginShelfViewTest, ClickRestartButton) { // The Restart button is not available in OOBE session state. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); NotifyShutdownPolicyChanged(true /*reboot_on_shutdown*/); @@ -507,7 +507,7 @@ } TEST_F(LoginShelfViewTest, ClickSignOutButton) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_EQ(session_manager::SessionState::ACTIVE, Shell::Get()->session_controller()->GetSessionState()); @@ -520,7 +520,7 @@ TEST_F(LoginShelfViewTest, ClickCancelButton) { auto client = std::make_unique<MockLoginScreenClient>(); EXPECT_CALL(*client, CancelAddUser()); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOGIN_SECONDARY); Click(LoginShelfView::kCancel); } @@ -544,7 +544,7 @@ } TEST_F(LoginShelfViewTest, TabGoesFromShelfToStatusAreaAndBackToShelf) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -584,7 +584,7 @@ } TEST_F(LoginShelfViewTest, LoginShelfButtonTooltipText) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -638,7 +638,7 @@ } TEST_F(LoginShelfViewTest, LoginShelfButtonTooltipTextAccessibility) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -837,7 +837,7 @@ } TEST_F(LoginShelfViewTest, ParentAccessButtonVisibilityChangeOnLockScreen) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -949,7 +949,7 @@ test_mouse_wheel_noop(location); } - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); for (const auto& location : kLocations) { @@ -1045,7 +1045,7 @@ // Simulate the lock screen scenario to verify the previous focus is updated. Shell::Get()->login_screen_controller()->ShowLockScreen(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); data = ui::AXNodeData(); @@ -1199,7 +1199,7 @@ // shutdown button on the lockscreen TEST_F(LoginShelfViewWithShutdownConfirmationTest, ShouldShowAfterShutdownButtonLockSession) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -1242,7 +1242,7 @@ // cancel button on the shutdown confirmation bubble and could be shown again. TEST_F(LoginShelfViewWithShutdownConfirmationTest, ShouldCloseAfterCancelButton) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -1283,7 +1283,7 @@ // down. TEST_F(LoginShelfViewWithShutdownConfirmationTest, ShouldCloseAndShutdownAfterConfirmButton) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -1311,7 +1311,7 @@ // Checks that shutdown confirmation bubble disappears after inactive. TEST_F(LoginShelfViewWithShutdownConfirmationTest, ShouldCloseAfterInactive) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -1341,7 +1341,7 @@ // Checks that shutdown confirmation was first cancelled, then confirmed TEST_F(LoginShelfViewWithShutdownConfirmationTest, ShouldCloseAndShutdownAfterCancelAndConfirmButton) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -1444,7 +1444,7 @@ } TEST_F(LoginShelfViewWithShutdownConfirmationTest, ClickRestartButton) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); EXPECT_TRUE( ShowsShelfButtons({LoginShelfView::kShutdown, LoginShelfView::kSignOut})); @@ -1460,7 +1460,7 @@ TEST_F(LoginShelfViewWithShutdownConfirmationTest, ShelfShutdownConfirmationBubbleAccessibleProperties) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); NotifySessionStateChanged(SessionState::LOCKED); Click(LoginShelfView::kShutdown); auto* confirmation_bubble =
diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc index 1d78921..39d0175 100644 --- a/ash/shelf/shelf_widget_unittest.cc +++ b/ash/shelf/shelf_widget_unittest.cc
@@ -401,7 +401,7 @@ ASSERT_TRUE(shelf_widget2); // Simulate login. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); const int total_width1 = screen_util::GetDisplayBoundsWithShelf(shelf_widget1->GetNativeWindow()) @@ -967,7 +967,7 @@ ShelfVisibilityState expected_shelf_visibility_state, ShelfAutoHideState expected_shelf_auto_hide_state) { // Simulate login. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // Simulate shelf settings being applied from profile prefs. Shelf* shelf = GetPrimaryShelf(); @@ -1001,7 +1001,7 @@ EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); // Simulate login. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // Ensure settings are correct after login. EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
diff --git a/ash/shelf/shelf_window_watcher_unittest.cc b/ash/shelf/shelf_window_watcher_unittest.cc index 1ec378a..a7963a8 100644 --- a/ash/shelf/shelf_window_watcher_unittest.cc +++ b/ash/shelf/shelf_window_watcher_unittest.cc
@@ -332,7 +332,7 @@ EXPECT_EQ(0, model->item_count()); // Start the test user session; ShelfWindowWatcher will find the open window. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_EQ(1, model->item_count()); }
diff --git a/ash/shell.cc b/ash/shell.cc index d694a99..7c1bd01 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -994,6 +994,13 @@ // notification. focus_mode_controller_.reset(); + // DetachableBaseNotificationController depends on DetachableBaseHandler, and + // has to be destructed before it. + detachable_base_notification_controller_.reset(); + // DetachableBaseHandler depends on the PrefService and must be destructed + // before it. + detachable_base_handler_.reset(); + system_notification_controller_.reset(); // Should be destroyed after Shelf and |system_notification_controller_|. system_tray_model_.reset(); @@ -1164,12 +1171,6 @@ // TouchDevicesController depends on the PrefService and must be destructed // before it. touch_devices_controller_ = nullptr; - // DetachableBaseNotificationController depends on DetachableBaseHandler, and - // has to be destructed before it. - detachable_base_notification_controller_.reset(); - // DetachableBaseHandler depends on the PrefService and must be destructed - // before it. - detachable_base_handler_.reset(); diagnostics_log_controller_.reset(); @@ -1276,11 +1277,6 @@ // These controllers call Shell::Get() in their constructors, so they cannot // be in the member initialization list. touch_devices_controller_ = std::make_unique<TouchDevicesController>(); - detachable_base_handler_ = - std::make_unique<DetachableBaseHandler>(local_state_); - detachable_base_notification_controller_ = - std::make_unique<DetachableBaseNotificationController>( - detachable_base_handler_.get()); display_speaker_controller_ = std::make_unique<DisplaySpeakerController>(); policy_recommendation_restorer_ = std::make_unique<PolicyRecommendationRestorer>(); @@ -1725,6 +1721,13 @@ system_notification_controller_ = std::make_unique<SystemNotificationController>(); + // They listen to session controller after notification controller. + detachable_base_handler_ = + std::make_unique<DetachableBaseHandler>(local_state_); + detachable_base_notification_controller_ = + std::make_unique<DetachableBaseNotificationController>( + detachable_base_handler_.get()); + // WmModeController should be created before initializing the window tree // hosts, since the latter will initialize the shelf on each display, which // hosts the WM mode tray button.
diff --git a/ash/shell.h b/ash/shell.h index d565c7fb..ea2db4d 100644 --- a/ash/shell.h +++ b/ash/shell.h
@@ -1063,9 +1063,6 @@ std::unique_ptr<DesksController> desks_controller_; std::unique_ptr<SavedDeskController> saved_desk_controller_; std::unique_ptr<SavedDeskDelegate> saved_desk_delegate_; - std::unique_ptr<DetachableBaseHandler> detachable_base_handler_; - std::unique_ptr<DetachableBaseNotificationController> - detachable_base_notification_controller_; std::unique_ptr<diagnostics::DiagnosticsLogController> diagnostics_log_controller_; std::unique_ptr<DisplayHighlightController> display_highlight_controller_; @@ -1150,6 +1147,9 @@ std::unique_ptr<AcceleratorTracker> accelerator_tracker_; std::unique_ptr<ShutdownControllerImpl> shutdown_controller_; std::unique_ptr<SystemNotificationController> system_notification_controller_; + std::unique_ptr<DetachableBaseHandler> detachable_base_handler_; + std::unique_ptr<DetachableBaseNotificationController> + detachable_base_notification_controller_; std::unique_ptr<SystemNudgePauseManagerImpl> system_nudge_pause_manager_; std::unique_ptr<SystemTrayModel> system_tray_model_; std::unique_ptr<SystemTrayNotifier> system_tray_notifier_;
diff --git a/ash/system/accessibility/accessibility_feature_pod_controller_unittest.cc b/ash/system/accessibility/accessibility_feature_pod_controller_unittest.cc index 6c55821..68013b2 100644 --- a/ash/system/accessibility/accessibility_feature_pod_controller_unittest.cc +++ b/ash/system/accessibility/accessibility_feature_pod_controller_unittest.cc
@@ -95,7 +95,7 @@ } TEST_F(AccessibilityFeaturePodControllerTest, ButtonVisibilityLoggedIn) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); GetPrimaryUnifiedSystemTray()->ShowBubble(); auto* tile = views::AsViewClass<FeatureTile>( GetPrimaryUnifiedSystemTray()->bubble()->GetBubbleView()->GetViewByID(
diff --git a/ash/system/focus_mode/focus_mode_controller.cc b/ash/system/focus_mode/focus_mode_controller.cc index f4feec7..09dc887 100644 --- a/ash/system/focus_mode/focus_mode_controller.cc +++ b/ash/system/focus_mode/focus_mode_controller.cc
@@ -30,8 +30,10 @@ #include "ash/system/status_area_widget.h" #include "ash/system/toast/anchored_nudge_manager_impl.h" #include "ash/system/unified/unified_system_tray.h" +#include "base/check_op.h" #include "base/metrics/histogram_functions.h" #include "base/rand_util.h" +#include "base/strings/strcat.h" #include "base/time/time.h" #include "chromeos/ash/components/audio/sounds.h" #include "chromeos/ash/components/audio/system_sounds_delegate.h" @@ -55,6 +57,12 @@ constexpr base::TimeDelta kEndingMomentBounceAnimationDelay = base::Minutes(1); +// YouTube Music API playlist name prefix. +constexpr std::string_view kPlaylistIdPrefix = "playlists/"; +constexpr std::string_view kBasePlaylistUrl = + "https://music.youtube.com/playlist?list="; +constexpr std::string_view kYouTubeMusicUrl = "https://music.youtube.com/"; + bool IsQuietModeOnSetByFocusMode() { auto* message_center = message_center::MessageCenter::Get(); return message_center->IsQuietMode() && @@ -143,6 +151,25 @@ std::move(callback).Run(task); } +// Returns the direct URL to view info for the associated YouTube Music +// `playlist`. +GURL GetYouTubeMusicPlaylistUrl(focus_mode_util::SelectedPlaylist playlist) { + CHECK_EQ(playlist.type, focus_mode_util::SoundType::kYouTubeMusic); + + if (playlist.id.starts_with(kPlaylistIdPrefix)) { + // Strip the prefix from `playlist.id` to get the actual playlist id and + // construct the URL. + return GURL(base::StrCat( + {kBasePlaylistUrl, playlist.id.substr(kPlaylistIdPrefix.length())})); + } + + // The expected api playlist name should have the prefix "playlists/". Check + // the playlists api documentation: + // https://developers.google.com/youtube/mediaconnect/reference/rest/v1/playlists#Playlist" + LOG(WARNING) << "YTM playlist name format is invalid"; + return GURL(kYouTubeMusicUrl); +} + } // namespace FocusModeController::FocusModeController( @@ -877,6 +904,14 @@ web_view_params.source_title = focus_mode_util::GetSourceTitleForMediaControls( focus_mode_sounds_controller_->selected_playlist()); + // Provide the playlist source URL to show for when users click on the media + // controls view. + if (focus_mode_sounds_controller_->selected_playlist().type == + focus_mode_util::SoundType::kYouTubeMusic) { + web_view_params.activation_url = GetYouTubeMusicPlaylistUrl( + focus_mode_sounds_controller_->selected_playlist()); + } + focus_mode_media_view_ = media_widget_->SetContentsView( AshWebViewFactory::Get()->Create(web_view_params)); focus_mode_media_view_->Navigate(GURL(chrome::kChromeUIFocusModeMediaURL));
diff --git a/ash/system/focus_mode/focus_mode_util.cc b/ash/system/focus_mode/focus_mode_util.cc index 9c049dc..cf83ba1 100644 --- a/ash/system/focus_mode/focus_mode_util.cc +++ b/ash/system/focus_mode/focus_mode_util.cc
@@ -46,6 +46,8 @@ u"☑"), }; +constexpr const char* kYouTubeMusicUrl = "music.youtube.com"; + } // namespace SelectedPlaylist::SelectedPlaylist() = default; @@ -143,10 +145,10 @@ return ""; } - return l10n_util::GetStringUTF8( - playlist.type == SoundType::kYouTubeMusic - ? IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_YOUTUBE_MUSIC_BUTTON - : IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_SOUNDSCAPE_BUTTON); + return playlist.type == SoundType::kYouTubeMusic + ? kYouTubeMusicUrl + : l10n_util::GetStringUTF8( + IDS_ASH_STATUS_TRAY_FOCUS_MODE_SOUNDS_SOUNDSCAPE_BUTTON); } std::u16string GetCongratulatoryText(const size_t index) {
diff --git a/ash/system/focus_mode/focus_mode_util_unittest.cc b/ash/system/focus_mode/focus_mode_util_unittest.cc index b58bd8e..5ee7c29 100644 --- a/ash/system/focus_mode/focus_mode_util_unittest.cc +++ b/ash/system/focus_mode/focus_mode_util_unittest.cc
@@ -22,7 +22,8 @@ SelectedPlaylist selected_playlist; selected_playlist.id = "id0"; selected_playlist.type = SoundType::kYouTubeMusic; - EXPECT_EQ(GetSourceTitleForMediaControls(selected_playlist), "YouTube Music"); + EXPECT_EQ(GetSourceTitleForMediaControls(selected_playlist), + "music.youtube.com"); } // Verify the Soundscape source string.
diff --git a/ash/system/nearby_share/nearby_share_feature_pod_controller_unittest.cc b/ash/system/nearby_share/nearby_share_feature_pod_controller_unittest.cc index f091d91..197a309 100644 --- a/ash/system/nearby_share/nearby_share_feature_pod_controller_unittest.cc +++ b/ash/system/nearby_share/nearby_share_feature_pod_controller_unittest.cc
@@ -97,14 +97,14 @@ } TEST_F(NearbyShareFeaturePodControllerTest, ButtonVisibilityLoggedIn) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpButton(); // If logged in, it should be visible. EXPECT_TRUE(IsButtonVisible()); } TEST_F(NearbyShareFeaturePodControllerTest, ButtonVisibilityLocked) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); BlockUserSession(UserSessionBlockReason::BLOCKED_BY_LOCK_SCREEN); // Showing the lock screen closes the system tray bubble, so re-show it before @@ -117,7 +117,7 @@ } TEST_F(NearbyShareFeaturePodControllerTest, ButtonVisibilityLoginScreen) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); BlockUserSession(UserSessionBlockReason::BLOCKED_BY_LOGIN_SCREEN); SetUpButton(); // If the login screen is showing (e.g. multi-user signin), it should not be @@ -126,7 +126,7 @@ } TEST_F(NearbyShareFeaturePodControllerTest, ButtonVisiblilityHiddenByDelegate) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->set_is_pod_button_visible(false); SetUpButton(); // If NearbyShareDelegate::IsPodButtonVisible() returns false, it should @@ -136,7 +136,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, ButtonToggledByHighVisibilityEnabledEvent) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpButton(); ASSERT_FALSE(IsButtonToggled()); nearby_share_controller_->HighVisibilityEnabledChanged(true); @@ -146,7 +146,7 @@ } TEST_F(NearbyShareFeaturePodControllerTest, ButtonPressTogglesHighVisibility) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpButton(); test_delegate_->method_calls().clear(); @@ -164,7 +164,7 @@ } TEST_F(NearbyShareFeaturePodControllerTest, IconUMATracking) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpButton(); std::string histogram_prefix; @@ -193,7 +193,7 @@ } TEST_F(NearbyShareFeaturePodControllerTest, ButtonEnabledStateVisibility) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->set_is_enabled(false); SetUpButton(); // If NearbyShareDelegate::IsEnabled() returns false, the button should @@ -204,7 +204,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, QuickShareV2_ButtonToggledOnYourDevicesVisibility) { EnableQuickShareV2(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // Default visibility is Your devices. SetUpButton(); EXPECT_TRUE(IsButtonToggled()); @@ -213,7 +213,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, QuickShareV2_ButtonToggledOnContactsVisibility) { EnableQuickShareV2(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->set_visibility( ::nearby_share::mojom::Visibility::kAllContacts); SetUpButton(); @@ -223,7 +223,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, QuickShareV2_ButtonToggledOnSelectedContactsVisibility) { EnableQuickShareV2(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->set_visibility( ::nearby_share::mojom::Visibility::kSelectedContacts); SetUpButton(); @@ -233,7 +233,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, QuickShareV2_ButtonToggledOnHiddenVisibility) { EnableQuickShareV2(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->set_visibility(::nearby_share::mojom::Visibility::kNoOne); SetUpButton(); EXPECT_TRUE(IsButtonToggled()); @@ -242,7 +242,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, QuickShareV2_ButtonToggledOn_HighVisibilityEnabled) { EnableQuickShareV2(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->set_is_high_visibility_on(true); SetUpButton(); EXPECT_TRUE(IsButtonToggled()); @@ -251,7 +251,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, QuickShareV2_ButtonToggledOn_QuickShareEnabled) { EnableQuickShareV2(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->SetEnabled(true); SetUpButton(); EXPECT_TRUE(IsButtonToggled()); @@ -260,7 +260,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, QuickShareV2_ButtonToggledOff_QuickShareDisabled) { EnableQuickShareV2(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->SetEnabled(false); SetUpButton(); EXPECT_FALSE(IsButtonToggled()); @@ -269,7 +269,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, QuickShareV2_IconTogglesButtonOn_QuickShareOn_OnPress) { EnableQuickShareV2(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->SetEnabled(false); SetUpButton(); EXPECT_FALSE(IsButtonToggled()); @@ -282,7 +282,7 @@ TEST_F(NearbyShareFeaturePodControllerTest, QuickShareV2_IconTogglesButtonOff_QuickShareOff_OnPress) { EnableQuickShareV2(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); test_delegate_->SetEnabled(true); SetUpButton(); EXPECT_TRUE(IsButtonToggled());
diff --git a/ash/system/network/network_list_network_item_view_unittest.cc b/ash/system/network/network_list_network_item_view_unittest.cc index 863cb04..a63e8c29 100644 --- a/ash/system/network/network_list_network_item_view_unittest.cc +++ b/ash/system/network/network_list_network_item_view_unittest.cc
@@ -243,7 +243,7 @@ IDS_ASH_STATUS_TRAY_NETWORK_STATUS_ACTIVATE_AFTER_DEVICE_SETUP), network_list_network_item_view()->sub_text_label()->GetText()); - CreateUserSessions(/*session_count=*/1); + SimulateUserLogin(kDefaultUserEmail); base::RunLoop().RunUntilIdle(); // Label for unactivated eSIM networks. @@ -456,7 +456,7 @@ base::UTF8ToUTF16(kCellularName)), network_list_network_item_view()->GetViewAccessibility().GetCachedName()); - CreateUserSessions(/*session_count=*/1); + SimulateUserLogin(kDefaultUserEmail); base::RunLoop().RunUntilIdle(); // Contact carrier A11Y label is shown when a eSIM network is connected but @@ -593,7 +593,7 @@ l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_NETWORK_STATUS_ACTIVATE_AFTER_DEVICE_SETUP)); - CreateUserSessions(/*session_count=*/1); + SimulateUserLogin(kDefaultUserEmail); base::RunLoop().RunUntilIdle(); // Cellular is not activated and is an eSIM network.
diff --git a/ash/system/overview/overview_button_tray_unittest.cc b/ash/system/overview/overview_button_tray_unittest.cc index 6bad5fc..2c433c0 100644 --- a/ash/system/overview/overview_button_tray_unittest.cc +++ b/ash/system/overview/overview_button_tray_unittest.cc
@@ -296,7 +296,7 @@ ClearLogin(); Shell::Get()->UpdateAfterLoginStatusChange(LoginStatus::NOT_LOGGED_IN); EXPECT_FALSE(GetTray()->GetVisible()); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); Shell::Get()->UpdateAfterLoginStatusChange(LoginStatus::USER); EXPECT_TRUE(GetTray()->GetVisible()); SetUserAddingScreenRunning(true);
diff --git a/ash/system/power/power_button_controller_unittest.cc b/ash/system/power/power_button_controller_unittest.cc index d33fa49..207b3f3 100644 --- a/ash/system/power/power_button_controller_unittest.cc +++ b/ash/system/power/power_button_controller_unittest.cc
@@ -836,7 +836,7 @@ // Should have sign out, lock screen and feedback items if user is logged in // and screen is unlocked. ClearLogin(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); OpenPowerButtonMenu(); EXPECT_FALSE(GetLockedState()); EXPECT_TRUE(power_button_test_api_->MenuHasSignOutItem()); @@ -1034,7 +1034,7 @@ TapToDismissPowerButtonMenu(); ClearLogin(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); OpenPowerButtonMenu(); ASSERT_TRUE(power_button_test_api_->MenuHasSignOutItem()); ASSERT_TRUE(power_button_test_api_->MenuHasLockScreenItem());
diff --git a/ash/system/power/power_button_test_base.cc b/ash/system/power/power_button_test_base.cc index 18bfa256..c616b8f 100644 --- a/ash/system/power/power_button_test_base.cc +++ b/ash/system/power/power_button_test_base.cc
@@ -109,7 +109,7 @@ if (status == LoginStatus::NOT_LOGGED_IN) ClearLogin(); else - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); if (status == LoginStatus::GUEST) SetCanLockScreen(false);
diff --git a/ash/system/session/logout_confirmation_controller_unittest.cc b/ash/system/session/logout_confirmation_controller_unittest.cc index 6326ea1..fd930161 100644 --- a/ash/system/session/logout_confirmation_controller_unittest.cc +++ b/ash/system/session/logout_confirmation_controller_unittest.cc
@@ -221,7 +221,7 @@ EXPECT_FALSE(controller->dialog_for_testing()); // Dialog is not visible after login. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_FALSE(controller->dialog_for_testing()); // Creating and closing a window does not show the dialog because this is not
diff --git a/ash/system/session/session_limit_notification_controller_unittest.cc b/ash/system/session/session_limit_notification_controller_unittest.cc index b626edb1..23ad12fd 100644 --- a/ash/system/session/session_limit_notification_controller_unittest.cc +++ b/ash/system/session/session_limit_notification_controller_unittest.cc
@@ -183,7 +183,7 @@ EXPECT_FALSE(GetNotification()); // Notification is shown after login. - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_TRUE(GetNotification()); RemoveNotification(); @@ -196,7 +196,7 @@ // Notification should be absent. UpdateSessionLengthLimitInMin(kNotificationThresholdInMinutes + 10); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_FALSE(GetNotification()); RemoveNotification();
diff --git a/ash/system/unified/power_button_pixeltest.cc b/ash/system/unified/power_button_pixeltest.cc index 18576f07..09c3acb0 100644 --- a/ash/system/unified/power_button_pixeltest.cc +++ b/ash/system/unified/power_button_pixeltest.cc
@@ -65,7 +65,7 @@ // TODO(crbug.com/1451244): Re-enable this test. TEST_F(PowerButtonPixelTest, DISABLED_LoginSession) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen( "check_button", @@ -79,7 +79,7 @@ // TODO(crbug.com/1451244): Re-enable this test. TEST_F(PowerButtonPixelTest, DISABLED_LockScreenSession) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); BlockUserSession(BLOCKED_BY_LOCK_SCREEN); EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen(
diff --git a/ash/system/unified/power_button_unittest.cc b/ash/system/unified/power_button_unittest.cc index 0f39e69..ea14b5b 100644 --- a/ash/system/unified/power_button_unittest.cc +++ b/ash/system/unified/power_button_unittest.cc
@@ -148,7 +148,7 @@ // `PowerButton` should be with the correct view id and have the UMA tracking // with the correct catalog name. TEST_F(PowerButtonTest, PowerButtonHasCorrectViewIdAndUma) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // No metrics logged before clicking on any buttons. histogram_tester_.ExpectTotalCount("Ash.QuickSettings.Button.Activated", @@ -170,7 +170,9 @@ } TEST_F(PowerButtonTest, LockMenuButtonRecordsUma) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); + // TOOD(crbug.com/383442863): Move this to SimulateUserLogin. + GetSessionControllerClient()->SetCanLockScreen(true); SimulatePowerButtonPress(); LeftClickOn(GetLockButton()); @@ -184,7 +186,7 @@ } TEST_F(PowerButtonTest, SignOutMenuButtonRecordsUma) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SimulatePowerButtonPress(); LeftClickOn(GetSignOutButton()); @@ -199,7 +201,7 @@ } TEST_F(PowerButtonTest, RestartMenuButtonRecordsUma) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SimulatePowerButtonPress(); LeftClickOn(GetRestartButton()); @@ -214,7 +216,7 @@ } TEST_F(PowerButtonTest, PowerOffMenuButtonRecordsUma) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SimulatePowerButtonPress(); LeftClickOn(GetPowerOffButton()); @@ -228,7 +230,7 @@ } TEST_F(PowerButtonTest, EmailMenuButtonRecordsUma) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SimulatePowerButtonPress(); LeftClickOn(GetEmailButton()); @@ -269,7 +271,9 @@ // All buttons are shown after login. TEST_F(PowerButtonTest, ButtonStatesLoggedIn) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); + // TOOD(crbug.com/383442863): Move this to SimulateUserLogin. + GetSessionControllerClient()->SetCanLockScreen(true); EXPECT_TRUE(GetPowerButton()->GetVisible()); @@ -297,7 +301,7 @@ // The lock button are hidden at the lock screen. TEST_F(PowerButtonTest, ButtonStatesLockScreen) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); BlockUserSession(BLOCKED_BY_LOCK_SCREEN); // Changes in lock state close the system tray bubble, so re-show it. @@ -331,7 +335,7 @@ // The lock button is hidden when adding a second multiprofile user. TEST_F(PowerButtonTest, ButtonStatesAddingUser) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUserAddingScreenRunning(true); EXPECT_TRUE(GetPowerButton()->GetVisible()); @@ -450,7 +454,7 @@ // Power button's rounded radii should change correctly when switching between // active/inactive. TEST_F(PowerButtonTest, ButtonRoundedRadii) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // Sets a LTR locale. base::i18n::SetICUDefaultLocale("en_US"); @@ -483,7 +487,7 @@ } TEST_F(PowerButtonTest, DeviceRebootOnShutdownPolicyHidesPowerOffButton) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // Simulate DeviceRebootOnShutdownPolicy is enabled. Shell::Get()->shutdown_controller()->SetRebootOnShutdown(true); @@ -494,7 +498,7 @@ } TEST_F(PowerButtonTest, ChevronFlipsWhenMenuIsShowing) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); EXPECT_TRUE(GetPowerButton()->GetVisible()); EXPECT_FALSE(IsMenuShowing());
diff --git a/ash/system/unified/quick_settings_footer_unittest.cc b/ash/system/unified/quick_settings_footer_unittest.cc index a21d7da2..f9f5392 100644 --- a/ash/system/unified/quick_settings_footer_unittest.cc +++ b/ash/system/unified/quick_settings_footer_unittest.cc
@@ -81,7 +81,9 @@ // Tests that all buttons are with the correct view id, catalog name and UMA // tracking. TEST_F(QuickSettingsFooterTest, ButtonNamesAndUMA) { - CreateUserSessions(2); + auto primary = SimulateUserLogin(kDefaultUserEmail); + SimulateUserLogin(kDefaultUserEmail); + SwitchActiveUser(primary); SetUpView(); // The number of view id should be the number of catalog name -1, since @@ -141,7 +143,7 @@ // All buttons are shown after login. TEST_F(QuickSettingsFooterTest, ButtonStatesLoggedIn) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpView(); EXPECT_FALSE(GetSignOutButton()); @@ -180,7 +182,7 @@ // Settings button and lock button are hidden when adding a second // multiprofile user. TEST_F(QuickSettingsFooterTest, ButtonStatesAddingUser) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUserAddingScreenRunning(true); SetUpView(); @@ -233,7 +235,7 @@ TEST_F(QuickSettingsFooterTest, SignOutShowsWithMultipleAccounts) { GetSessionControllerClient()->set_existing_users_count(2); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpView(); ASSERT_TRUE(GetSignOutButton()); @@ -252,7 +254,7 @@ } GetSessionControllerClient()->set_existing_users_count(2); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpView(); base::HistogramTester histogram_tester; @@ -285,7 +287,7 @@ // Tests different battery states. TEST_F(QuickSettingsFooterTest, BatteryButtonState) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpView(); const bool use_smart_charging_ui = @@ -313,7 +315,7 @@ // Try to layout buttons after login. TEST_F(QuickSettingsFooterTest, ButtonLayoutLoggedIn) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpView(); LayoutFooter(); } @@ -327,7 +329,7 @@ // Try to layout buttons when adding a second multiprofile user. TEST_F(QuickSettingsFooterTest, ButtonLayoutAddingUser) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUserAddingScreenRunning(true); SetUpView(); LayoutFooter();
diff --git a/ash/system/unified/quiet_mode_feature_pod_controller_unittest.cc b/ash/system/unified/quiet_mode_feature_pod_controller_unittest.cc index fee8b10..86d5f0d5 100644 --- a/ash/system/unified/quiet_mode_feature_pod_controller_unittest.cc +++ b/ash/system/unified/quiet_mode_feature_pod_controller_unittest.cc
@@ -78,14 +78,14 @@ } TEST_F(QuietModeFeaturePodControllerTest, ButtonVisibilityLoggedIn) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpButton(); // If logged in, it should be visible. EXPECT_TRUE(IsButtonVisible()); } TEST_F(QuietModeFeaturePodControllerTest, ButtonVisibilityLocked) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); BlockUserSession(UserSessionBlockReason::BLOCKED_BY_LOCK_SCREEN); SetUpButton(); // If locked, it should not be visible. @@ -93,7 +93,7 @@ } TEST_F(QuietModeFeaturePodControllerTest, IconUMATracking) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); SetUpButton(); message_center::MessageCenter::Get()->SetQuietMode(false); @@ -135,7 +135,7 @@ } TEST_F(QuietModeFeaturePodControllerTest, ToggledState) { - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); // Do not disturb is initially off, button is not toggled. SetUpButton();
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index f32ac1bc..7f92950 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc
@@ -427,13 +427,11 @@ return ash_test_helper_->ambient_ash_test_helper(); } -void AshTestBase::CreateUserSessions(int n) { - GetSessionControllerClient()->CreatePredefinedUserSessions(n); -} - -void AshTestBase::SimulateUserLogin(const std::string& user_email, - user_manager::UserType user_type) { - SimulateUserLogin(AccountId::FromUserEmail(user_email), user_type); +AccountId AshTestBase::SimulateUserLogin(const std::string& user_email, + user_manager::UserType user_type) { + auto account_id = AccountId::FromUserEmail(user_email); + SimulateUserLogin(account_id, user_type); + return account_id; } void AshTestBase::SimulateUserLogin(const AccountId& account_id, @@ -441,10 +439,13 @@ ash_test_helper_->SimulateUserLogin(account_id, user_type); } -void AshTestBase::SimulateNewUserFirstLogin(const std::string& user_email) { - ash_test_helper_->SimulateUserLogin(AccountId::FromUserEmail(user_email), +AccountId AshTestBase::SimulateNewUserFirstLogin( + const std::string& user_email) { + auto account_id = AccountId::FromUserEmail(user_email); + ash_test_helper_->SimulateUserLogin(account_id, user_manager::UserType::kRegular, /*is_new_profile=*/true); + return account_id; } void AshTestBase::SimulateGuestLogin() { @@ -460,6 +461,14 @@ SimulateUserLogin(AccountId::FromUserEmail(kKioskUserEmail), user_type); } +void AshTestBase::SwitchActiveUser(const AccountId& account_id) { + Shell::Get()->session_controller()->SwitchActiveUser(account_id); +} + +bool AshTestBase::IsInSessionState(session_manager::SessionState state) const { + return Shell::Get()->session_controller()->GetSessionState() == state; +} + void AshTestBase::SetAccessibilityPanelHeight(int panel_height) { Shell::GetPrimaryRootWindowController() ->GetAccessibilityPanelLayoutManagerForTest() @@ -488,7 +497,6 @@ void AshTestBase::BlockUserSession(UserSessionBlockReason block_reason) { switch (block_reason) { case BLOCKED_BY_LOCK_SCREEN: - CreateUserSessions(1); GetSessionControllerClient()->LockScreen(); break; case BLOCKED_BY_LOGIN_SCREEN: @@ -503,7 +511,6 @@ } void AshTestBase::UnblockUserSession() { - CreateUserSessions(1); GetSessionControllerClient()->UnlockScreen(); }
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h index 7246056..b652b48 100644 --- a/ash/test/ash_test_base.h +++ b/ash/test/ash_test_base.h
@@ -76,6 +76,8 @@ class UnifiedSystemTray; class WorkAreaInsets; +inline constexpr std::string kDefaultUserEmail = "user0@tray"; + // Base class for most tests in //ash. Constructs ash::Shell and all its // dependencies. Provides a user login session (use NoSessionAshTestBase for // tests that start at the login screen or need unusual user types). Sets @@ -310,18 +312,15 @@ AmbientAshTestHelper* GetAmbientAshTestHelper(); - // Emulates an ash session that have |session_count| user sessions running. - // Note that existing user sessions will be cleared. - void CreateUserSessions(int session_count); - - // Simulates a user sign-in. It creates a new user session, adds it to - // existing user sessions and makes it the active user session. + // Simulates a user sign-in, and returns an AccountId used to sign in. It + // creates a new user session, adds it to existing user sessions and makes it + // the active user session. // // For convenience |user_email| is used to create an |AccountId|. For testing // behavior where |AccountId|s are compared, prefer the method of the same // name that takes an |AccountId| created with a valid storage key instead. // See the documentation for|AccountId::GetUserEmail| for discussion. - void SimulateUserLogin( + AccountId SimulateUserLogin( const std::string& user_email, user_manager::UserType user_type = user_manager::UserType::kRegular); @@ -332,7 +331,7 @@ user_manager::UserType user_type = user_manager::UserType::kRegular); // Simular to SimulateUserLogin but for a newly created user first ever login. - void SimulateNewUserFirstLogin(const std::string& user_email); + AccountId SimulateNewUserFirstLogin(const std::string& user_email); // Similar to SimulateUserLogin but for a guest user. void SimulateGuestLogin(); @@ -340,6 +339,12 @@ // Simulates kiosk mode. |user_type| must correlate to a kiosk type user. void SimulateKioskMode(user_manager::UserType user_type); + // Switches the active user to `account_id`; + void SwitchActiveUser(const AccountId& account_id); + + // Returns true if the session is in `state`. + bool IsInSessionState(session_manager::SessionState state) const; + // Simulates setting height of the accessibility panel. // Note: Accessibility panel widget needs to be setup first. void SetAccessibilityPanelHeight(int panel_height); @@ -358,6 +363,7 @@ // Methods to emulate blocking and unblocking user session with given // |block_reason|. + // TODO(crbug.com/383770001): Deprecate these methods. void BlockUserSession(UserSessionBlockReason block_reason); void UnblockUserSession();
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index 56b7e00..80774d6 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc
@@ -398,9 +398,6 @@ session_controller_client_ = std::make_unique<TestSessionControllerClient>( shell->session_controller(), prefs_provider_.get()); session_controller_client_->InitializeAndSetClient(); - if (init_params.start_session) { - session_controller_client_->CreatePredefinedUserSessions(1); - } // Requires the AppListController the Shell creates. app_list_test_helper_ = std::make_unique<AppListTestHelper>(); @@ -408,6 +405,21 @@ Shell::GetPrimaryRootWindow()->Show(); Shell::GetPrimaryRootWindow()->GetHost()->Show(); + // Sign-in after UI is shown. + if (init_params.start_session) { + // TODO(crbug.com/383441831): Remove Reset(); + session_controller_client_->Reset(); + + auto account_id = AccountId::FromUserEmail("user0@tray"); + // TODO((crbug.com/383441831): Use SimulateUserLogin. + session_controller_client_->AddUserSession( + account_id, account_id.GetUserEmail(), + user_manager::UserType::kRegular); + session_controller_client_->SwitchActiveUser(account_id); + session_controller_client_->SetSessionState( + session_manager::SessionState::ACTIVE); + } + // Don't change the display size due to host size resize. display::test::DisplayManagerTestApi(shell->display_manager()) .DisableChangeDisplayUponHostResize();
diff --git a/ash/webui/eche_app_ui/accessibility_provider.h b/ash/webui/eche_app_ui/accessibility_provider.h index 1d4cd81..52a08d94 100644 --- a/ash/webui/eche_app_ui/accessibility_provider.h +++ b/ash/webui/eche_app_ui/accessibility_provider.h
@@ -99,8 +99,6 @@ // source. In the future we can swap this to a map if more windows are added. std::unique_ptr<ax::android::AXTreeSourceAndroid> tree_source_; - bool use_full_focus_mode_ = false; - // device settings gfx::Rect device_bounds_;
diff --git a/ash/webui/help_app_ui/BUILD.gn b/ash/webui/help_app_ui/BUILD.gn index 70e9532..3ac4652 100644 --- a/ash/webui/help_app_ui/BUILD.gn +++ b/ash/webui/help_app_ui/BUILD.gn
@@ -40,10 +40,8 @@ deps = [ ":help_app_ui_pref", ":mojo_bindings", - ":mojo_bindings_js", "//ash/constants", "//ash/webui/help_app_ui/search:mojo_bindings", - "//ash/webui/help_app_ui/search:mojo_bindings_js", "//ash/webui/help_app_ui/search:proto", "//ash/webui/resources:help_app_bundle_resources", "//ash/webui/resources:help_app_kids_magazine_bundle_resources", @@ -81,9 +79,6 @@ sources = [ "help_app_ui.mojom" ] public_deps = [ "//url/mojom:url_mojom_gurl" ] webui_module_path = "/" - - # Help app is still using JS + Closure Compiler. - generate_webui_js_bindings = true } source_set("unit_tests") {
diff --git a/ash/webui/help_app_ui/resources/BUILD.gn b/ash/webui/help_app_ui/resources/BUILD.gn index a6f1ecee..1e1d338 100644 --- a/ash/webui/help_app_ui/resources/BUILD.gn +++ b/ash/webui/help_app_ui/resources/BUILD.gn
@@ -17,15 +17,15 @@ copy("copy_for_tsc") { visibility = [ ":build_ts" ] public_deps = [ - "//ash/webui/help_app_ui:mojo_bindings_js__generator", - "//ash/webui/help_app_ui/search:mojo_bindings_js__generator", + "//ash/webui/help_app_ui:mojo_bindings_ts__generator", + "//ash/webui/help_app_ui/search:mojo_bindings_ts__generator", "//ash/webui/system_apps/public/js:build_ts", "//chromeos/ash/components/local_search_service/public/mojom:mojom_js__generator", ] sources = [ + "$root_gen_dir/ash/webui/help_app_ui/help_app_ui.mojom-webui.ts", + "$root_gen_dir/ash/webui/help_app_ui/search/search.mojom-webui.ts", "$root_gen_dir/ash/webui/system_apps/public/js/message_pipe.js", - "$root_gen_dir/mojom-webui/ash/webui/help_app_ui/help_app_ui.mojom-webui.js", - "$root_gen_dir/mojom-webui/ash/webui/help_app_ui/search/search.mojom-webui.js", "$root_gen_dir/mojom-webui/chromeos/ash/components/local_search_service/public/mojom/index.mojom-webui.js", "$root_gen_dir/mojom-webui/chromeos/ash/components/local_search_service/public/mojom/types.mojom-webui.js", "//ui/webui/resources/js/mojo_type_util.ts",
diff --git a/ash/webui/help_app_ui/search/BUILD.gn b/ash/webui/help_app_ui/search/BUILD.gn index 3aa890d..20972370 100644 --- a/ash/webui/help_app_ui/search/BUILD.gn +++ b/ash/webui/help_app_ui/search/BUILD.gn
@@ -12,9 +12,6 @@ sources = [ "search.mojom" ] webui_module_path = "/" - # Help app is still using JS + Closure Compiler. - generate_webui_js_bindings = true - public_deps = [ "//mojo/public/mojom/base" ] }
diff --git a/ash/webui/resources/BUILD.gn b/ash/webui/resources/BUILD.gn index dc980b8a..83c5977 100644 --- a/ash/webui/resources/BUILD.gn +++ b/ash/webui/resources/BUILD.gn
@@ -91,10 +91,8 @@ output_dir = "$ash_webui_grit_output_dir" deps = [ - "//ash/webui/help_app_ui:mojo_bindings_js", "//ash/webui/help_app_ui/resources:browser_proxy_rollup", "//ash/webui/help_app_ui/resources:receiver_rollup", - "//ash/webui/help_app_ui/search:mojo_bindings_js", "//chromeos/ash/components/local_search_service/public/mojom:mojom_js", ] }
diff --git a/ash/wm/default_state.cc b/ash/wm/default_state.cc index 44e6362..e9180a1 100644 --- a/ash/wm/default_state.cc +++ b/ash/wm/default_state.cc
@@ -289,10 +289,16 @@ gfx::Rect work_area = screen_util::GetDisplayWorkAreaBoundsInParent(window); // Maximize vertically if: + // - The window is resizable and maximizable // - The window does not have a max height defined. // - The window is floated or has the normal state type. Snapped windows // are excluded because they are already maximized vertically and // reverting to the restored bounds looks weird. + if (!window_state->CanResize() || !window_state->CanMaximize()) { + wm::AnimateWindow(window_state->window(), + wm::WINDOW_ANIMATION_TYPE_BOUNCE); + return; + } if (GetWindowMaximumSize(window).height() != 0) return; if (!window_state->IsNormalStateType() && !window_state->IsFloated()) @@ -310,8 +316,14 @@ } case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: { // Maximize horizontally if: + // - The window is resizable and maximizable // - The window does not have a max width defined. // - The window is snapped or floated or has the normal state type. + if (!window_state->CanResize() || !window_state->CanMaximize()) { + wm::AnimateWindow(window_state->window(), + wm::WINDOW_ANIMATION_TYPE_BOUNCE); + return; + } if (GetWindowMaximumSize(window).width() != 0) return; if (!window_state->IsNormalOrSnapped() && !window_state->IsFloated())
diff --git a/ash/wm/window_state_util.cc b/ash/wm/window_state_util.cc index c5f5944..1e35dda 100644 --- a/ash/wm/window_state_util.cc +++ b/ash/wm/window_state_util.cc
@@ -33,12 +33,18 @@ if (window_state->IsFullscreen()) { const WMEvent wm_event(WM_EVENT_TOGGLE_FULLSCREEN); window_state->OnWMEvent(&wm_event); - } else if (window_state->IsMaximized()) { + return; + } + // False CanMaximize blocks both maximizing and restoring + if (!window_state->CanMaximize()) { + wm::AnimateWindow(window_state->window(), wm::WINDOW_ANIMATION_TYPE_BOUNCE); + return; + } + + if (window_state->IsMaximized()) { window_state->Restore(); } else if (window_state->IsNormalOrSnapped() || window_state->IsFloated()) { - if (window_state->CanMaximize()) { - window_state->Maximize(); - } + window_state->Maximize(); } } @@ -49,13 +55,18 @@ if (window_state->IsFullscreen()) { const WMEvent wm_event(WM_EVENT_TOGGLE_FULLSCREEN); window_state->OnWMEvent(&wm_event); - } else if (window_state->IsMaximized()) { - window_state->Restore(); - } else if (window_state->CanMaximize()) { - window_state->Maximize(); - } else { - // If `window` cannot be maximized, then do a window bounce animation. + return; + } + // False CanMaximize blocks both maximizing and restoring + if (!window_state->CanMaximize()) { wm::AnimateWindow(window_state->window(), wm::WINDOW_ANIMATION_TYPE_BOUNCE); + return; + } + + if (window_state->IsMaximized()) { + window_state->Restore(); + } else { + window_state->Maximize(); } }
diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc index 53e1bdfc..2670b081 100644 --- a/ash/wm/workspace/workspace_event_handler_unittest.cc +++ b/ash/wm/workspace/workspace_event_handler_unittest.cc
@@ -385,6 +385,109 @@ EXPECT_TRUE(window_state->IsSnapped()); } +// Tests that non-resizable windows do not allow for maximizing +TEST_F(WorkspaceEventHandlerTest, + DoubleClickCaptionDoesntToggleMaximizeNonResizableWindow) { + aura::test::TestWindowDelegate delegate; + std::unique_ptr<aura::Window> window( + CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); + // Set window as non-resizable and non-maximizable + window->SetProperty(aura::client::kResizeBehaviorKey, + aura::client::kResizeBehaviorNone); + + WindowState* window_state = WindowState::Get(window.get()); + gfx::Rect initial_bounds = window->bounds(); + + EXPECT_FALSE(window_state->IsMaximized()); + + // 1) Double clicking the caption should not maximize + delegate.set_window_component(HTCAPTION); + aura::Window* root = Shell::GetPrimaryRootWindow(); + ui::test::EventGenerator generator(root, window.get()); + generator.DoubleClickLeftButton(); + EXPECT_EQ(initial_bounds, window->bounds()); + EXPECT_FALSE(window_state->IsMaximized()); + + // 2) Double clicking on edge should not maximize horizontally/vertically + delegate.set_window_component(HTLEFT); + generator.DoubleClickLeftButton(); + EXPECT_EQ(initial_bounds, window->bounds()); + + delegate.set_window_component(HTRIGHT); + generator.DoubleClickLeftButton(); + EXPECT_EQ(initial_bounds, window->bounds()); + + delegate.set_window_component(HTTOP); + generator.DoubleClickLeftButton(); + EXPECT_EQ(initial_bounds, window->bounds()); + + delegate.set_window_component(HTBOTTOM); + generator.DoubleClickLeftButton(); + EXPECT_EQ(initial_bounds, window->bounds()); + + // 3) Double click on the maximized window should not restore + window_state->Maximize(); + EXPECT_TRUE(window_state->IsMaximized()); + delegate.set_window_component(HTCAPTION); + generator.DoubleClickLeftButton(); + EXPECT_TRUE(window_state->IsMaximized()); +} + +// Tests that non-resizable windows blocks maximize/fullscreen events +TEST_F(WorkspaceEventHandlerTest, ResizingEventsBlockedInNonResizableWindows) { + aura::test::TestWindowDelegate delegate; + std::unique_ptr<aura::Window> window( + CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); + // Set window to be non-resizable + window->SetProperty(aura::client::kResizeBehaviorKey, + aura::client::kResizeBehaviorNone); + + WindowState* window_state = WindowState::Get(window.get()); + gfx::Rect initial_bounds = window->bounds(); + + const WMEvent toggle_fullscreen_event(WM_EVENT_TOGGLE_FULLSCREEN); + const WMEvent toggle_maximize_event(WM_EVENT_TOGGLE_MAXIMIZE); + const WMEvent toggle_maximize_caption_event(WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); + const WMEvent toggle_horizontal_maximize_event( + WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); + const WMEvent toogle_vertical_maximize_event( + WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); + + window_state->OnWMEvent(&toggle_fullscreen_event); + EXPECT_FALSE(window_state->IsFullscreen()); + + window_state->OnWMEvent(&toggle_maximize_event); + EXPECT_FALSE(window_state->IsMaximized()); + + window_state->OnWMEvent(&toggle_maximize_caption_event); + EXPECT_FALSE(window_state->IsMaximized()); + + window_state->OnWMEvent(&toggle_horizontal_maximize_event); + EXPECT_EQ(initial_bounds, window->bounds()); + + window_state->OnWMEvent(&toogle_vertical_maximize_event); + EXPECT_EQ(initial_bounds, window->bounds()); + + // Check if restoring from maximized state is banned too + wm::SetWindowFullscreen(window.get(), false); + window_state->Maximize(); + EXPECT_FALSE(window_state->IsFullscreen()); + EXPECT_TRUE(window_state->IsMaximized()); + initial_bounds = window->bounds(); + + window_state->OnWMEvent(&toggle_maximize_event); + EXPECT_TRUE(window_state->IsMaximized()); + + window_state->OnWMEvent(&toggle_maximize_caption_event); + EXPECT_TRUE(window_state->IsMaximized()); + + window_state->OnWMEvent(&toggle_horizontal_maximize_event); + EXPECT_EQ(initial_bounds, window->bounds()); + + window_state->OnWMEvent(&toogle_vertical_maximize_event); + EXPECT_EQ(initial_bounds, window->bounds()); +} + // Test that double clicking on window side edge horizontally and vertically // will maximize the window, double click vertically and horizontally will // return to previous state.
diff --git a/base/allocator/partition_alloc_features.cc b/base/allocator/partition_alloc_features.cc index 233504e8..5fa4cf7d6 100644 --- a/base/allocator/partition_alloc_features.cc +++ b/base/allocator/partition_alloc_features.cc
@@ -109,7 +109,7 @@ BASE_FEATURE(kPartitionAllocLargeEmptySlotSpanRing, "PartitionAllocLargeEmptySlotSpanRing", -#if BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) FEATURE_ENABLED_BY_DEFAULT); #else FEATURE_DISABLED_BY_DEFAULT); @@ -449,7 +449,7 @@ BASE_FEATURE(kPartitionAllocAdjustSizeWhenInForeground, "PartitionAllocAdjustSizeWhenInForeground", -#if BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) FEATURE_ENABLED_BY_DEFAULT); #else FEATURE_DISABLED_BY_DEFAULT);
diff --git a/base/allocator/partition_allocator/partition_alloc.gni b/base/allocator/partition_allocator/partition_alloc.gni index 17da3298..a5b4c2f 100644 --- a/base/allocator/partition_allocator/partition_alloc.gni +++ b/base/allocator/partition_allocator/partition_alloc.gni
@@ -31,8 +31,9 @@ # foreground mode compared to background mode # (see `PartitionRoot::AdjustFor(Background|Foreground)`). # -# Foreground/background modes are used by default on macOS so this must be -# true on that platform. It's also true on other platforms to allow experiments. +# Foreground/background modes are used by default on macOS and Windows so this +# must be true on these platforms. It's also true on other platforms to allow +# experiments. # # TODO(crbug.com/329199197): Clean this up when experiments are complete. use_large_empty_slot_span_ring = true
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc index ae70271..94636a1 100644 --- a/base/files/file_posix.cc +++ b/base/files/file_posix.cc
@@ -54,13 +54,11 @@ #if BUILDFLAG(IS_APPLE) // When enabled, `F_FULLFSYNC` is not used in `File::Flush`. Instead, // `F_BARRIERFSYNC` or `flush()` is used (depending on the -// "MacEfficientFileFlushUseBarrier" param). The feature exists to measure the -// cost of `F_FULLFSYNC` compared to other solutions (not ready to enable by -// default as-is). See +// "MacEfficientFileFlushUseBarrier" param). See // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fsync.2.html BASE_FEATURE(kMacEfficientFileFlush, "MacEfficientFileFlush", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); const FeatureParam<bool> kMacEfficientFileFlushUseBarrier{ &kMacEfficientFileFlush, "MacEfficientFileFlushUseBarrier", true};
diff --git a/base/numerics/safe_math_shared_impl.h b/base/numerics/safe_math_shared_impl.h index 72764fa2..c0078d57 100644 --- a/base/numerics/safe_math_shared_impl.h +++ b/base/numerics/safe_math_shared_impl.h
@@ -13,7 +13,7 @@ #include "base/numerics/safe_conversions.h" #include "build/build_config.h" -#if BUILDFLAG(IS_ASMJS) +#if defined(__asmjs__) || defined(__wasm__) // Optimized safe math instructions are incompatible with asmjs. #define BASE_HAS_OPTIMIZED_SAFE_MATH (0) // Where available use builtin math overflow support on Clang and GCC.
diff --git a/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc b/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc index e9fe1384..b4833dc 100644 --- a/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc +++ b/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc
@@ -48,7 +48,7 @@ BASE_FEATURE(kAvoidScheduleWorkDuringNativeEventProcessing, "AvoidScheduleWorkDuringNativeEventProcessing", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); std::atomic_bool g_run_tasks_by_batches = false; std::atomic_bool g_avoid_schedule_calls_during_native_event_processing = false;
diff --git a/base/task/task_features.cc b/base/task/task_features.cc index f538b67a..5d56423 100644 --- a/base/task/task_features.cc +++ b/base/task/task_features.cc
@@ -59,7 +59,7 @@ BASE_FEATURE(kRunTasksByBatches, "RunTasksByBatches", -#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) base::FEATURE_ENABLED_BY_DEFAULT); #else base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/base/test/trace_event_analyzer.cc b/base/test/trace_event_analyzer.cc index 56e6ff55..f939d22 100644 --- a/base/test/trace_event_analyzer.cc +++ b/base/test/trace_event_analyzer.cc
@@ -960,8 +960,7 @@ void Start(const std::string& category_filter_string) { DCHECK(!base::trace_event::TraceLog::GetInstance()->IsEnabled()); base::trace_event::TraceLog::GetInstance()->SetEnabled( - base::trace_event::TraceConfig(category_filter_string, ""), - base::trace_event::TraceLog::RECORDING_MODE); + base::trace_event::TraceConfig(category_filter_string, "")); } std::unique_ptr<TraceAnalyzer> Stop() {
diff --git a/base/test/trace_event_analyzer_unittest.cc b/base/test/trace_event_analyzer_unittest.cc index 515fa525..28cb44cf 100644 --- a/base/test/trace_event_analyzer_unittest.cc +++ b/base/test/trace_event_analyzer_unittest.cc
@@ -55,8 +55,7 @@ output_.json_output.clear(); buffer_.Start(); base::trace_event::TraceLog::GetInstance()->SetEnabled( - base::trace_event::TraceConfig("*", ""), - base::trace_event::TraceLog::RECORDING_MODE); + base::trace_event::TraceConfig("*", "")); } void TraceEventAnalyzerTest::EndTracing() {
diff --git a/base/test/trace_to_file.cc b/base/test/trace_to_file.cc index f271596..5929b2cd 100644 --- a/base/test/trace_to_file.cc +++ b/base/test/trace_to_file.cc
@@ -56,8 +56,7 @@ WriteFileHeader(); trace_event::TraceLog::GetInstance()->SetEnabled( - trace_event::TraceConfig(categories, trace_event::RECORD_UNTIL_FULL), - trace_event::TraceLog::RECORDING_MODE); + trace_event::TraceConfig(categories, trace_event::RECORD_UNTIL_FULL)); } void TraceToFile::WriteFileHeader() {
diff --git a/base/trace_event/trace_event_unittest.cc b/base/trace_event/trace_event_unittest.cc index 45955e73..9f06d7a 100644 --- a/base/trace_event/trace_event_unittest.cc +++ b/base/trace_event/trace_event_unittest.cc
@@ -109,8 +109,7 @@ } void BeginSpecificTrace(const std::string& filter) { - TraceLog::GetInstance()->SetEnabled(TraceConfig(filter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(TraceConfig(filter, "")); } void CancelTrace() { @@ -153,7 +152,7 @@ } void EndTraceAndFlushAsync(WaitableEvent* flush_complete_event) { - TraceLog::GetInstance()->SetDisabled(TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetDisabled(); TraceLog::GetInstance()->Flush(base::BindRepeating( &TraceEventTestFixture::OnTraceDataCollected, base::Unretained(static_cast<TraceEventTestFixture*>(this)), @@ -771,8 +770,8 @@ // Simple Test for emitting data and validating it was received. TEST_F(TraceEventTestFixture, DataCaptured) { - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); TraceWithAllMacroVariants(nullptr); @@ -784,8 +783,8 @@ // Emit some events and validate that only empty strings are received // if we tell Flush() to discard events. TEST_F(TraceEventTestFixture, DataDiscarded) { - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); TraceWithAllMacroVariants(nullptr); @@ -807,8 +806,8 @@ EXPECT_CALL(observer, OnTraceLogEnabled()) .Times(1); - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); testing::Mock::VerifyAndClear(&observer); EXPECT_TRUE(TraceLog::GetInstance()->IsEnabled()); @@ -818,8 +817,8 @@ } TEST_F(TraceEventTestFixture, EnabledObserverFiresOnDisable) { - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); MockEnabledStateChangedObserver observer; TraceLog::GetInstance()->AddEnabledStateObserver(&observer); @@ -838,13 +837,13 @@ EXPECT_CALL(*observer, OnTraceLogEnabled()).Times(1); EXPECT_CALL(*observer, OnTraceLogDisabled()).Times(1); TraceLog::GetInstance()->AddOwnedEnabledStateObserver(std::move(observer)); - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); TraceLog::GetInstance()->SetDisabled(); TraceLog::ResetForTesting(); // These notifications won't be sent. - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); TraceLog::GetInstance()->SetDisabled(); } @@ -869,8 +868,8 @@ AfterStateChangeEnabledStateObserver observer; TraceLog::GetInstance()->AddEnabledStateObserver(&observer); - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); EXPECT_TRUE(TraceLog::GetInstance()->IsEnabled()); TraceLog::GetInstance()->SetDisabled(); @@ -903,8 +902,8 @@ TraceLog::GetInstance()->AddEnabledStateObserver(&observer); EXPECT_EQ(1u, TraceLog::GetInstance()->GetObserverCountForTest()); - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); TraceLog::GetInstance()->SetDisabled(); // The observer removed itself on disable. EXPECT_EQ(0u, TraceLog::GetInstance()->GetObserverCountForTest()); @@ -918,8 +917,8 @@ TEST_F(TraceEventTestFixture, NewTraceRecording) { ASSERT_FALSE(IsNewTrace()); - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); // First call to IsNewTrace() should succeed. But, the second shouldn't. ASSERT_TRUE(IsNewTrace()); ASSERT_FALSE(IsNewTrace()); @@ -930,8 +929,8 @@ // Start another trace. IsNewTrace() should become true again, briefly, as // before. - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); ASSERT_TRUE(IsNewTrace()); ASSERT_FALSE(IsNewTrace()); @@ -993,8 +992,7 @@ // Include nonexistent category -> no events Clear(); included_categories.clear(); - TraceLog::GetInstance()->SetEnabled(TraceConfig("not_found823564786", ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(TraceConfig("not_found823564786", "")); TRACE_EVENT_INSTANT0("cat1", "name", TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_INSTANT0("cat2", "name", TRACE_EVENT_SCOPE_THREAD); EndTraceAndFlush(); @@ -1004,8 +1002,7 @@ // Include existent category -> only events of that category Clear(); included_categories.clear(); - TraceLog::GetInstance()->SetEnabled(TraceConfig("test_inc", ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(TraceConfig("test_inc", "")); TRACE_EVENT_INSTANT0("test_inc", "name", TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_INSTANT0("test_inc2", "name", TRACE_EVENT_SCOPE_THREAD); EndTraceAndFlush(); @@ -1016,8 +1013,7 @@ // Include existent wildcard -> all categories matching wildcard Clear(); included_categories.clear(); - TraceLog::GetInstance()->SetEnabled(TraceConfig("test_inc_wildcard_*", ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(TraceConfig("test_inc_wildcard_*", "")); TRACE_EVENT_INSTANT0("test_inc_wildcard_abc", "included", TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_INSTANT0("test_inc_wildcard_", "included", @@ -1041,8 +1037,7 @@ // Exclude nonexistent category -> all events Clear(); - TraceLog::GetInstance()->SetEnabled(TraceConfig("-not_found823564786", ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(TraceConfig("-not_found823564786", "")); TRACE_EVENT_INSTANT0("cat1", "name", TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_INSTANT0("cat2", "name", TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_INSTANT0("category1,category2", "name", TRACE_EVENT_SCOPE_THREAD); @@ -1053,8 +1048,7 @@ // Exclude existent category -> only events of other categories Clear(); - TraceLog::GetInstance()->SetEnabled(TraceConfig("-test_inc", ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(TraceConfig("-test_inc", "")); TRACE_EVENT_INSTANT0("test_inc", "name", TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_INSTANT0("test_inc2", "name", TRACE_EVENT_SCOPE_THREAD); TRACE_EVENT_INSTANT0("test_inc2,test_inc", "name", TRACE_EVENT_SCOPE_THREAD); @@ -1353,12 +1347,12 @@ TEST_F(TraceEventTestFixture, TraceEnableDisable) { TraceLog* trace_log = TraceLog::GetInstance(); TraceConfig tc_inc_all("*", ""); - trace_log->SetEnabled(tc_inc_all, TraceLog::RECORDING_MODE); + trace_log->SetEnabled(tc_inc_all); EXPECT_TRUE(trace_log->IsEnabled()); trace_log->SetDisabled(); EXPECT_FALSE(trace_log->IsEnabled()); - trace_log->SetEnabled(tc_inc_all, TraceLog::RECORDING_MODE); + trace_log->SetEnabled(tc_inc_all); EXPECT_TRUE(trace_log->IsEnabled()); trace_log->SetDisabled(); EXPECT_FALSE(trace_log->IsEnabled()); @@ -1367,19 +1361,19 @@ TEST_F(TraceEventTestFixture, TraceWithDefaultCategoryFilters) { TraceLog* trace_log = TraceLog::GetInstance(); - trace_log->SetEnabled(TraceConfig(), TraceLog::RECORDING_MODE); + trace_log->SetEnabled(TraceConfig()); CheckTraceDefaultCategoryFilters(*trace_log); trace_log->SetDisabled(); - trace_log->SetEnabled(TraceConfig("", ""), TraceLog::RECORDING_MODE); + trace_log->SetEnabled(TraceConfig("", "")); CheckTraceDefaultCategoryFilters(*trace_log); trace_log->SetDisabled(); - trace_log->SetEnabled(TraceConfig("*", ""), TraceLog::RECORDING_MODE); + trace_log->SetEnabled(TraceConfig("*", "")); CheckTraceDefaultCategoryFilters(*trace_log); trace_log->SetDisabled(); - trace_log->SetEnabled(TraceConfig(""), TraceLog::RECORDING_MODE); + trace_log->SetEnabled(TraceConfig("")); CheckTraceDefaultCategoryFilters(*trace_log); trace_log->SetDisabled(); } @@ -1387,8 +1381,7 @@ TEST_F(TraceEventTestFixture, TraceWithDisabledByDefaultCategoryFilters) { TraceLog* trace_log = TraceLog::GetInstance(); - trace_log->SetEnabled(TraceConfig("foo,disabled-by-default-foo", ""), - TraceLog::RECORDING_MODE); + trace_log->SetEnabled(TraceConfig("foo,disabled-by-default-foo", "")); EXPECT_TRUE(IsCategoryEnabled("foo")); EXPECT_TRUE(IsCategoryEnabled("disabled-by-default-foo")); EXPECT_FALSE(IsCategoryEnabled("bar")); @@ -1397,8 +1390,7 @@ // Enabling only the disabled-by-default-* category means the default ones // are also enabled. - trace_log->SetEnabled(TraceConfig("disabled-by-default-foo", ""), - TraceLog::RECORDING_MODE); + trace_log->SetEnabled(TraceConfig("disabled-by-default-foo", "")); EXPECT_TRUE(IsCategoryEnabled("disabled-by-default-foo")); EXPECT_TRUE(IsCategoryEnabled("foo")); EXPECT_TRUE(IsCategoryEnabled("bar")); @@ -1419,8 +1411,8 @@ }; TEST_F(TraceEventTestFixture, ConvertableTypes) { - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); { std::unique_ptr<ConvertableToTraceFormat> data(new MyData()); @@ -1512,8 +1504,8 @@ } TEST_F(TraceEventTestFixture, PrimitiveArgs) { - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); { TRACE_EVENT1("foo", "event1", "int_one", 1); @@ -1650,8 +1642,8 @@ } TEST_F(TraceEventTestFixture, NameIsEscaped) { - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); TRACE_EVENT0("category", "name\\with\\backspaces"); EndTraceAndFlush(); @@ -1811,8 +1803,7 @@ logging::SetLogMessageHandler(MockLogMessageHandler); TraceLog::GetInstance()->SetEnabled( - TraceConfig(kRecordAllCategoryFilter, ECHO_TO_CONSOLE), - TraceLog::RECORDING_MODE); + TraceConfig(kRecordAllCategoryFilter, ECHO_TO_CONSOLE)); TRACE_EVENT_BEGIN0("test_a", "begin_end"); { TRACE_EVENT0("test_b", "duration"); @@ -1839,8 +1830,7 @@ logging::SetLogMessageHandler(LogMessageHandlerWithTraceEvent); TraceLog::GetInstance()->SetEnabled( - TraceConfig(kRecordAllCategoryFilter, ECHO_TO_CONSOLE), - TraceLog::RECORDING_MODE); + TraceConfig(kRecordAllCategoryFilter, ECHO_TO_CONSOLE)); { // This should not cause deadlock or infinite recursion. TRACE_EVENT0("test_b", "duration"); @@ -1858,8 +1848,8 @@ } TEST_F(TraceEventTestFixture, ContextLambda) { - TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled( + TraceConfig(kRecordAllCategoryFilter, "")); { TRACE_EVENT1("cat", "Name", "arg", [&](perfetto::TracedValue ctx) {
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc index c4207e08..39c7928 100644 --- a/base/trace_event/trace_log.cc +++ b/base/trace_event/trace_log.cc
@@ -739,10 +739,7 @@ } } -void TraceLog::SetEnabled(const TraceConfig& trace_config, - uint8_t modes_to_enable) { - // FILTERING_MODE is no longer supported. - DCHECK(modes_to_enable == RECORDING_MODE); +void TraceLog::SetEnabled(const TraceConfig& trace_config) { DCHECK(trace_config.process_filter_config().IsEnabled(process_id_)); AutoLock lock(lock_); @@ -958,16 +955,10 @@ void TraceLog::SetDisabled() { AutoLock lock(lock_); - SetDisabledWhileLocked(RECORDING_MODE); + SetDisabledWhileLocked(); } -void TraceLog::SetDisabled(uint8_t modes_to_disable) { - AutoLock lock(lock_); - SetDisabledWhileLocked(modes_to_disable); -} - -void TraceLog::SetDisabledWhileLocked(uint8_t modes_to_disable) { - DCHECK(modes_to_disable == RECORDING_MODE); +void TraceLog::SetDisabledWhileLocked() { if (!tracing_session_) return; @@ -1097,7 +1088,7 @@ if (buffer_limit_reached_timestamp_.is_null()) { buffer_limit_reached_timestamp_ = OffsetNow(); } - SetDisabledWhileLocked(RECORDING_MODE); + SetDisabledWhileLocked(); } } @@ -1547,14 +1538,14 @@ TimeTicks offset_event_timestamp = OffsetTimestamp(timestamp); ThreadLocalEventBuffer* event_buffer = nullptr; - if (*category_group_enabled & RECORDING_MODE) { + if (*category_group_enabled) { // |thread_local_event_buffer| can be null if the current thread doesn't // have a message loop or the message loop is blocked. InitializeThreadLocalEventBufferIfSupported(); event_buffer = thread_local_event_buffer; } - if (*category_group_enabled & RECORDING_MODE) { + if (*category_group_enabled) { auto trace_event_override = add_trace_event_override_.load(std::memory_order_relaxed); if (trace_event_override) {
diff --git a/base/trace_event/trace_log.h b/base/trace_event/trace_log.h index 5536563d..f872b685 100644 --- a/base/trace_event/trace_log.h +++ b/base/trace_event/trace_log.h
@@ -64,15 +64,6 @@ public: class ThreadLocalEventBuffer; - // Argument passed to TraceLog::SetEnabled. - enum Mode : uint8_t { - // Enables normal tracing (recording trace events in the trace buffer). - // This is the only tracing mode supported now. - // TODO(khokhlov): Clean up all uses of tracing mode and remove this enum - // completely. - RECORDING_MODE = 1 << 0, - }; - static TraceLog* GetInstance(); TraceLog(const TraceLog&) = delete; @@ -86,8 +77,8 @@ void InitializeThreadLocalEventBufferIfSupported(); // See TraceConfig comments for details on how to control which categories - // will be traced. Only RECORDING_MODE is supported. - void SetEnabled(const TraceConfig& trace_config, uint8_t modes_to_enable); + // will be traced. + void SetEnabled(const TraceConfig& trace_config); // Enable tracing using a customized Perfetto trace config. This allows, for // example, enabling additional data sources and enabling protobuf output @@ -95,9 +86,8 @@ void SetEnabled(const TraceConfig& trace_config, const perfetto::TraceConfig& perfetto_config); - // Disables tracing for all categories. Only RECORDING_MODE is supported. + // Disables tracing for all categories. void SetDisabled(); - void SetDisabled(uint8_t modes_to_disable); // Returns true if TraceLog is enabled (i.e. there's an active tracing // session). @@ -490,7 +480,7 @@ bool check_buffer_is_full) EXCLUSIVE_LOCKS_REQUIRED(lock_); void CheckIfBufferIsFullWhileLocked() EXCLUSIVE_LOCKS_REQUIRED(lock_); - void SetDisabledWhileLocked(uint8_t modes) EXCLUSIVE_LOCKS_REQUIRED(lock_); + void SetDisabledWhileLocked() EXCLUSIVE_LOCKS_REQUIRED(lock_); TraceEvent* GetEventByHandleInternal(TraceEventHandle handle, OptionalAutoLock* lock);
diff --git a/base/win/scoped_co_mem.h b/base/win/scoped_co_mem.h index b2bd24b..2c5e6d3 100644 --- a/base/win/scoped_co_mem.h +++ b/base/win/scoped_co_mem.h
@@ -64,7 +64,9 @@ T* get() const { return mem_ptr_; } private: - // RAW_PTR_EXCLUSION: #addr-of, #union + // RAW_PTR_EXCLUSION: This memory is handled by the OS instead + // of PartitionAlloc, so there's no point rewriting it to a + // raw_ptr RAW_PTR_EXCLUSION T* mem_ptr_; };
diff --git a/base/win/scoped_safearray.h b/base/win/scoped_safearray.h index 86b356743..28735f6 100644 --- a/base/win/scoped_safearray.h +++ b/base/win/scoped_safearray.h
@@ -228,7 +228,8 @@ bool operator!=(const ScopedSafearray& safearray2) const = delete; private: - // RAW_PTR_EXCLUSION: #addr-of + // RAW_PTR_EXCLUSION: Like LockScope::safearray_, this comes from the + // operating system. RAW_PTR_EXCLUSION SAFEARRAY* safearray_; };
diff --git a/build/android/fast_local_dev_server.py b/build/android/fast_local_dev_server.py index 6573ee3e..db77053 100755 --- a/build/android/fast_local_dev_server.py +++ b/build/android/fast_local_dev_server.py
@@ -15,6 +15,7 @@ import pathlib import re import signal +import shlex import shutil import socket import subprocess @@ -68,7 +69,7 @@ def log_to_file(message: str, build_id: str): - logfile = _LOGFILES.get(build_id) + logfile = _LOGFILES[build_id] print(message, file=logfile, flush=True) @@ -124,7 +125,8 @@ _total_task_count_per_build = collections.defaultdict(int) _completed_task_count_per_build = collections.defaultdict(int) _running_processes_count_per_build = collections.defaultdict(int) - _lock = threading.Lock() + _outdir_per_build = {} + _lock = threading.RLock() @classmethod def no_running_processes(cls): @@ -132,10 +134,11 @@ return cls._num_processes == 0 @classmethod - def add_task(cls, build_id: str): + def add_task(cls, build_id: str, outdir: str): with cls._lock: cls._total_tasks += 1 cls._total_task_count_per_build[build_id] += 1 + cls._outdir_per_build[build_id] = outdir @classmethod def add_process(cls, build_id: str): @@ -171,6 +174,31 @@ return cls._completed_tasks @classmethod + def query_build(cls, query_build_id: str = None): + with cls._lock: + active_builds = BuildManager.get_live_builds() + if query_build_id: + build_ids = [query_build_id] + else: + build_ids = sorted( + set(active_builds) | set(cls._total_task_count_per_build)) + builds = [] + for build_id in build_ids: + current_tasks = TaskManager.get_current_tasks(build_id) + builds.append({ + 'build_id': build_id, + 'is_active': build_id in active_builds, + 'completed_tasks': cls.num_completed_tasks(build_id), + 'pending_tasks': cls.num_pending_tasks(build_id), + 'active_tasks': [t.cmd for t in current_tasks], + 'outdir': cls._outdir_per_build.get(build_id), # None if no tasks. + }) + return { + 'pid': os.getpid(), + 'builds': builds, + } + + @classmethod def prefix(cls, build_id: str = None): # Ninja's prefix is: [205 processes, 6/734 @ 6.5/s : 0.922s ] # Time taken and task completion rate are not important for the build server @@ -254,7 +282,7 @@ @classmethod def add_task(cls, task: Task, options): assert not cls._deactivated - TaskStats.add_task(build_id=task.build_id) + TaskStats.add_task(task.build_id, task.cwd) with cls._lock: cls._queue.appendleft(task) set_status(f'QUEUED {task.name}', @@ -269,6 +297,11 @@ cls._current_tasks.remove(task) @classmethod + def get_current_tasks(cls, build_id): + with cls._lock: + return [t for t in cls._current_tasks if t.build_id == build_id] + + @classmethod def deactivate(cls): cls._deactivated = True tasks_to_terminate: list[Task] = [] @@ -528,13 +561,7 @@ def _handle_query_build(data, connection: socket.socket): """Handle messages of type QUERY_BUILD.""" build_id = data['build_id'] - pending_tasks = TaskStats.num_pending_tasks(build_id) - completed_tasks = TaskStats.num_completed_tasks(build_id) - response = { - 'build_id': build_id, - 'completed_tasks': completed_tasks, - 'pending_tasks': pending_tasks, - } + response = TaskStats.query_build(build_id) try: with connection: server_utils.SendMessage(connection, json.dumps(response).encode('utf8')) @@ -660,7 +687,13 @@ """Comunicates with the main server waiting for a build to complete.""" start_time = datetime.datetime.now() while True: - build_info = query_build_info(build_id) + try: + build_info = query_build_info(build_id)['builds'][0] + except ConnectionRefusedError: + print('No server running. It likely finished all tasks.') + print('You can check $OUTDIR/buildserver.log.0 to be sure.') + return 0 + pending_tasks = build_info['pending_tasks'] if pending_tasks == 0: @@ -720,8 +753,56 @@ return 1 +def _print_build_status_all(): + try: + query_data = query_build_info(None) + except ConnectionRefusedError: + print('No server running. Consult $OUTDIR/buildserver.log.0') + return 0 + builds = query_data['builds'] + pid = query_data['pid'] + all_active_tasks = [] + print(f'Build server (PID={pid}) has {len(builds)} registered builds') + for build_info in builds: + build_id = build_info['build_id'] + pending_tasks = build_info['pending_tasks'] + completed_tasks = build_info['completed_tasks'] + active_tasks = build_info['active_tasks'] + out_dir = build_info['outdir'] + active = build_info['is_active'] + total_tasks = pending_tasks + completed_tasks + all_active_tasks += active_tasks + if total_tasks == 0 and not active: + status = 'Finished without any jobs' + else: + if active: + status = 'Siso still running' + else: + status = 'Siso finished' + if out_dir: + status += f' in {out_dir}' + status += f'. Completed [{completed_tasks}/{total_tasks}].' + if completed_tasks < total_tasks: + status += f' {len(active_tasks)} tasks currently executing' + print(f'{build_id}: {status}') + if all_active_tasks: + total = len(all_active_tasks) + to_show = min(4, total) + print(f'Currently executing (showing {to_show} of {total}):') + for cmd in sorted(all_active_tasks)[:to_show]: + truncated = shlex.join(cmd) + if len(truncated) > 200: + truncated = truncated[:200] + '...' + print(truncated) + return 0 + + def _print_build_status(build_id): - build_info = query_build_info(build_id) + try: + build_info = query_build_info(build_id)['builds'][0] + except ConnectionRefusedError: + print('No server running. Consult $OUTDIR/buildserver.log.0') + return 0 pending_tasks = build_info['pending_tasks'] completed_tasks = build_info['completed_tasks'] total_tasks = pending_tasks + completed_tasks @@ -736,7 +817,7 @@ print(' '.join([server_path, '--wait-for-build', build_id])) else: print('Build Server is done with all background tasks. ' + - f'[{completed_tasks}/{total_tasks}] Tasks Done.') + f'Completed [{completed_tasks}/{total_tasks}].') return 0 @@ -756,6 +837,7 @@ def main(): + # pylint: disable=too-many-return-statements parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( '--fail-if-not-running', @@ -775,6 +857,9 @@ parser.add_argument('--print-status', metavar='BUILD_ID', help='Print the current state of a build.') + parser.add_argument('--print-status-all', + action='store_true', + help='Print the current state of all active builds.') parser.add_argument( '--register-build-id', metavar='BUILD_ID', @@ -791,6 +876,8 @@ return _wait_for_build(args.wait_for_build) if args.print_status: return _print_build_status(args.print_status) + if args.print_status_all: + return _print_build_status_all() if args.register_build_id: return _register_builder(args.register_build_id, args.builder_pid) if args.cancel_build:
diff --git a/build/android/fast_local_dev_server_test.py b/build/android/fast_local_dev_server_test.py index a2a13d6..3c5fe99e 100755 --- a/build/android/fast_local_dev_server_test.py +++ b/build/android/fast_local_dev_server_test.py
@@ -44,10 +44,10 @@ return False -def callServer(args, stdout=subprocess.DEVNULL, check=True): +def callServer(args, check=True): return subprocess.run([str(server_utils.SERVER_SCRIPT.absolute())] + args, cwd=pathlib.Path(__file__).parent, - stdout=stdout, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=check, text=True) @@ -72,7 +72,7 @@ fifo_path.unlink(missing_ok=True) -class TasksTest(unittest.TestCase): +class ServerStartedTest(unittest.TestCase): def setUp(self): self._TTY_FILE = '/tmp/fast_local_dev_server_test_tty' @@ -127,7 +127,7 @@ return '' def getBuildInfo(self): - build_info = server.query_build_info(self.id()) + build_info = server.query_build_info(self.id())['builds'][0] pending_tasks = build_info['pending_tasks'] completed_tasks = build_info['completed_tasks'] return pending_tasks, completed_tasks @@ -197,29 +197,38 @@ self.assertEqual(self.getTtyContents(), '') def testBuildStatusServerCall(self): - proc_result = callServer(['--print-status', self.id()], - stdout=subprocess.PIPE) + proc_result = callServer(['--print-status', self.id()]) self.assertEqual(proc_result.stdout, '') + proc_result = callServer(['--print-status-all']) + self.assertIn(self.id(), proc_result.stdout) + self.sendTask(['true']) self.waitForTasksDone() - proc_result = callServer(['--print-status', self.id()], - stdout=subprocess.PIPE) + + proc_result = callServer(['--print-status', self.id()]) + self.assertIn('[1/1]', proc_result.stdout) + + proc_result = callServer(['--print-status-all']) + self.assertIn('has 1 registered build', proc_result.stdout) self.assertIn('[1/1]', proc_result.stdout) with blockingFifo() as fifo_path: # cat gets stuck until we open the other end of the fifo. self.sendTask(['cat', str(fifo_path)]) - proc_result = callServer(['--print-status', self.id()], - stdout=subprocess.PIPE) + proc_result = callServer(['--print-status', self.id()]) self.assertIn('[1/2]', proc_result.stdout) self.assertIn(f'--wait-for-build {self.id()}', proc_result.stdout) self.waitForTasksDone() - proc_result = callServer(['--print-status', self.id()], - stdout=subprocess.PIPE) + callServer(['--cancel-build', self.id()]) + self.waitForTasksDone() + proc_result = callServer(['--print-status', self.id()]) self.assertIn('[2/2]', proc_result.stdout) + proc_result = callServer(['--print-status-all']) + self.assertIn('Siso finished', proc_result.stdout) + def testServerCancelsRunningTasks(self): output_stamp = pathlib.Path('/tmp/.deleteme.stamp') with blockingFifo() as fifo_path: @@ -235,6 +244,17 @@ self._process.wait(timeout=1) +class ServerNotStartedTest(unittest.TestCase): + + def testWaitForBuildServerCall(self): + proc_result = callServer(['--wait-for-build', self.id()]) + self.assertIn('No server running', proc_result.stdout) + + def testBuildStatusServerCall(self): + proc_result = callServer(['--print-status-all']) + self.assertIn('No server running', proc_result.stdout) + + if __name__ == '__main__': # Suppress logging messages. unittest.main(buffer=True)
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 92fe650c..4d52063 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc
@@ -89,6 +89,11 @@ Layer::LayerTreeInputs::LayerTreeInputs() = default; Layer::LayerTreeInputs::~LayerTreeInputs() = default; +int Layer::GetNextLayerId() { + // Layer IDs start from 1. + return g_next_layer_id.GetNext() + 1; +} + scoped_refptr<Layer> Layer::Create() { return base::WrapRefCounted(new Layer()); } @@ -96,8 +101,7 @@ Layer::Layer() : parent_(nullptr), layer_tree_host_(nullptr), - // Layer IDs start from 1. - layer_id_(g_next_layer_id.GetNext() + 1), + layer_id_(GetNextLayerId()), num_descendants_that_draw_content_(0), transform_tree_index_(kInvalidPropertyNodeId), effect_tree_index_(kInvalidPropertyNodeId),
diff --git a/cc/layers/layer.h b/cc/layers/layer.h index 34c6e26..2354ffcf 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h
@@ -95,6 +95,9 @@ INVALID_ID = -1, }; + // Get a unique layer id. + static int GetNextLayerId(); + // Factory to create a new Layer, with a unique id. static scoped_refptr<Layer> Create();
diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc index b7d915d..e2c30f7 100644 --- a/cc/layers/render_surface_impl.cc +++ b/cc/layers/render_surface_impl.cc
@@ -37,7 +37,8 @@ ElementId id) : layer_tree_impl_(layer_tree_impl), id_(id), - effect_tree_index_(kInvalidPropertyNodeId) { + effect_tree_index_(kInvalidPropertyNodeId), + layer_id_(Layer::GetNextLayerId()) { DCHECK(id); damage_tracker_ = DamageTracker::Create(); } @@ -459,7 +460,7 @@ shared_quad_state->SetAll( draw_transform(), content_rect(), content_rect(), mask_filter_info(), clip_rect, contents_opaque, draw_properties_.draw_opacity, BlendMode(), - sorting_context_id, /*layer_id=*/0u, is_fast_rounded_corner()); + sorting_context_id, layer_id_, is_fast_rounded_corner()); if (layer_tree_impl_->debug_state().show_debug_borders.test( DebugBorderType::RENDERPASS)) {
diff --git a/cc/layers/render_surface_impl.h b/cc/layers/render_surface_impl.h index 7667f98..3e2919dc 100644 --- a/cc/layers/render_surface_impl.h +++ b/cc/layers/render_surface_impl.h
@@ -273,6 +273,10 @@ ElementId id_; int effect_tree_index_; + // A unique id in the same namespace as `Layer::layer_id_`, so viz can + // identify `RenderPassDrawQuads` across the frame, similarly to other quads. + uint32_t layer_id_ = 0; + // Container for properties that render surfaces need to compute before they // can be drawn. struct DrawProperties {
diff --git a/cc/slim/layer.cc b/cc/slim/layer.cc index fa2fcb6..c40bd35 100644 --- a/cc/slim/layer.cc +++ b/cc/slim/layer.cc
@@ -429,7 +429,8 @@ data.mask_filter_info_in_target, clip_opt, contents_opaque(), opacity, SkBlendMode::kSrcOver, /*sorting_context=*/0, - /*layer_id=*/0u, /*fast_rounded_corner=*/false); + /*layer_id=*/static_cast<uint32_t>(id()), + /*fast_rounded_corner=*/false); quad_state->is_fast_rounded_corner = true; quad_state->offset_tag = data.offset_tag; return quad_state;
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 241896a..0961589 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -464,6 +464,7 @@ "//chrome/browser/share/android:java_resources", "//chrome/browser/signin/services/android:java", "//chrome/browser/single_tab/android:java", + "//chrome/browser/ssl/android:java", "//chrome/browser/supervised_user:supervised_user_service_platform_delegate_java", "//chrome/browser/supervised_user:website_parent_approval_java", "//chrome/browser/sync/android:java", @@ -1827,6 +1828,8 @@ "//chrome/browser/share/android:java_resources", "//chrome/browser/signin/services/android:java", "//chrome/browser/single_tab/android:java", + "//chrome/browser/ssl/android:java", + "//chrome/browser/ssl/android:javatests", "//chrome/browser/supervised_user:javatests", "//chrome/browser/supervised_user:test_support_java", "//chrome/browser/sync/android:java", @@ -3987,6 +3990,7 @@ "//chrome/browser/search_engines/android:jni_headers", "//chrome/browser/segmentation_platform:client_util_jni_headers", "//chrome/browser/segmentation_platform:jni_headers", + "//chrome/browser/ssl/android:jni_headers", "//chrome/browser/tab:jni_headers", "//chrome/browser/tab_group_sync:factory_jni_headers", "//chrome/browser/tab_group_sync:jni_headers",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index b2e2816..170628c 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -228,6 +228,7 @@ "java/src/org/chromium/chrome/browser/bookmarks/PowerBookmarkMetrics.java", "java/src/org/chromium/chrome/browser/bookmarks/PowerBookmarkUtils.java", "java/src/org/chromium/chrome/browser/bookmarks/ReadingListSectionHeader.java", + "java/src/org/chromium/chrome/browser/bookmarks/ScopedBookmarkModelObservation.java", "java/src/org/chromium/chrome/browser/bookmarks/ShoppingAccessoryCoordinator.java", "java/src/org/chromium/chrome/browser/bookmarks/ShoppingAccessoryView.java", "java/src/org/chromium/chrome/browser/bookmarks/ShoppingAccessoryViewBinder.java",
diff --git a/chrome/android/chrome_junit_test_java_sources.gni b/chrome/android/chrome_junit_test_java_sources.gni index 84e03569..58b4b2f1 100644 --- a/chrome/android/chrome_junit_test_java_sources.gni +++ b/chrome/android/chrome_junit_test_java_sources.gni
@@ -99,6 +99,7 @@ "junit/src/org/chromium/chrome/browser/bookmarks/ImprovedBookmarkRowTest.java", "junit/src/org/chromium/chrome/browser/bookmarks/PendingRunnableTest.java", "junit/src/org/chromium/chrome/browser/bookmarks/ReadingListSectionHeaderTest.java", + "junit/src/org/chromium/chrome/browser/bookmarks/ScopedBookmarkModelObservationTest.java", "junit/src/org/chromium/chrome/browser/bookmarks/SharedBookmarkModelMocks.java", "junit/src/org/chromium/chrome/browser/bookmarks/ShoppingAccessoryCoordinatorTest.java", "junit/src/org/chromium/chrome/browser/browserservices/ClearDataDialogResultRecorderTest.java",
diff --git a/chrome/android/chrome_test_java_sources.gni b/chrome/android/chrome_test_java_sources.gni index 57f3182..02f2510 100644 --- a/chrome/android/chrome_test_java_sources.gni +++ b/chrome/android/chrome_test_java_sources.gni
@@ -416,7 +416,7 @@ "javatests/src/org/chromium/chrome/browser/policy/PolicyAuditorBridgeTest.java", "javatests/src/org/chromium/chrome/browser/previewtab/PreviewTabTest.java", "javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java", - "javatests/src/org/chromium/chrome/browser/privacy/settings/HttpsFirstModeSettingTest.java", + "javatests/src/org/chromium/chrome/browser/privacy/settings/HttpsFirstModeLegacySettingTest.java", "javatests/src/org/chromium/chrome/browser/privacy/settings/PrivacyPreferencesManagerImplNativeTest.java", "javatests/src/org/chromium/chrome/browser/privacy/settings/PrivacySettingsFragmentTest.java", "javatests/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSurveyControllerIntegrationTest.java",
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml index 642f287..a03ba17 100644 --- a/chrome/android/java/res/xml/privacy_preferences.xml +++ b/chrome/android/java/res/xml/privacy_preferences.xml
@@ -73,10 +73,17 @@ android:title="@string/prefs_safe_browsing_title" android:summary="@string/prefs_safe_browsing_summary" android:fragment="org.chromium.chrome.browser.safe_browsing.settings.SafeBrowsingSettingsFragment" /> + <!-- Old HTTPS-First Mode toggle. Hidden if HttpsFirstBalancedMode flag is enabled. + TODO(crbug.com/349860796): Remove once new settings are fully rolled out. --> <org.chromium.components.browser_ui.settings.ChromeSwitchPreference - android:key="https_first_mode" + android:key="https_first_mode_legacy" android:title="@string/settings_https_first_mode_title" android:summary="@string/settings_https_first_mode_summary" /> + <!-- New HTTPS-First Mode settings sub-page. Hidden if HttpsFirstBalancedMode flag is disabled. --> + <Preference + android:key="https_first_mode" + android:title="@string/settings_https_first_mode_title" + android:fragment="org.chromium.chrome.browser.ssl.HttpsFirstModeSettingsFragment" /> <org.chromium.components.browser_ui.settings.ChromeBasePreference android:key="secure_dns" android:title="@string/settings_secure_dns_title"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java index c3614a3..922c2e6f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java
@@ -1470,6 +1470,8 @@ && tab.getNativePage() instanceof PdfPage pdfPage) { EnterpriseInfo.OwnedState state = EnterpriseInfo.getInstance().getDeviceEnterpriseInfoSync(); + RecordHistogram.recordBooleanHistogram( + "Android.Pdf.AssistContent.IsEnterpriseInfoCached", state != null); if (state == null) return; String structuredData = pdfPage.requestAssistContent(state.mProfileOwned); if (structuredData != null) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/FinancialAccountsManagementFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/FinancialAccountsManagementFragment.java index 8b7075f..4ceefdd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/FinancialAccountsManagementFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/FinancialAccountsManagementFragment.java
@@ -46,11 +46,13 @@ @VisibleForTesting static final String FRAGMENT_SHOWN_HISTOGRAM = "FacilitatedPayments.SettingsPage.Shown"; - // TODO(b/337929926): Remove hardcoding for Pix and use FacilitatedPaymentsType enum. @VisibleForTesting - static final String FACILITATED_PAYMENTS_TOGGLE_UPDATED_HISTOGRAM = + static final String FACILITATED_PAYMENTS_PIX_TOGGLE_UPDATED_HISTOGRAM = "FacilitatedPayments.SettingsPage.Pix.ToggleUpdated"; + static final String FACILITATED_PAYMENTS_EWALLET_TOGGLE_UPDATED_HISTOGRAM = + "FacilitatedPayments.SettingsPage.Ewallet.ToggleUpdated"; + // Preference keys @VisibleForTesting static final String PREFERENCE_KEY_PIX = "pix"; @VisibleForTesting static final String PREFERENCE_KEY_EWALLET = "ewallet"; @@ -273,12 +275,15 @@ if (preference.getKey().equals(PREFERENCE_KEY_PIX)) { boolean isPixEnabled = (boolean) newValue; RecordHistogram.recordBooleanHistogram( - FACILITATED_PAYMENTS_TOGGLE_UPDATED_HISTOGRAM, /* sample= */ isPixEnabled); + FACILITATED_PAYMENTS_PIX_TOGGLE_UPDATED_HISTOGRAM, /* sample= */ isPixEnabled); mPersonalDataManager.setFacilitatedPaymentsPixPref(isPixEnabled); PostTask.postTask(TaskTraits.UI_DEFAULT, this::rebuildPage); return true; } else if (preference.getKey().equals(PREFERENCE_KEY_EWALLET)) { boolean isEwalletEnabled = (boolean) newValue; + RecordHistogram.recordBooleanHistogram( + FACILITATED_PAYMENTS_EWALLET_TOGGLE_UPDATED_HISTOGRAM, + /* sample= */ isEwalletEnabled); mPersonalDataManager.setFacilitatedPaymentsEwalletPref(isEwalletEnabled); PostTask.postTask(TaskTraits.UI_DEFAULT, this::rebuildPage); return true;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/ScopedBookmarkModelObservation.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/ScopedBookmarkModelObservation.java new file mode 100644 index 0000000..905361c --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/ScopedBookmarkModelObservation.java
@@ -0,0 +1,172 @@ +// Copyright 2024 The Chromium Authors +// 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.bookmarks; + +import androidx.annotation.NonNull; + +import org.chromium.components.bookmarks.BookmarkId; +import org.chromium.components.bookmarks.BookmarkItem; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +/** + * A scoped object which observes and propagates events for the supplied bookmark model if and only + * if they involve the supplied bookmark folder's direct descendants. + */ +public class ScopedBookmarkModelObservation extends BookmarkModelObserver { + + /** + * An observer to which events are propagated if and only if they involve the supplied bookmark + * folder's direct descendants. + */ + public static interface Observer { + /** + * Invoked when a direct descendant of the supplied bookmark folder is added. + * + * @param source the observation that propagated the event. + * @param item the direct descendant that was added. + * @param index the index at which the direct descendant was added. + */ + public void onBookmarkItemAdded( + @NonNull ScopedBookmarkModelObservation source, + @NonNull BookmarkItem item, + int index); + + /** + * Invoked when a direct descendant of the supplied bookmark folder is moved. + * + * @param source the observation that propagated the event. + * @param index the index to which the direct descendant was moved. + * @param oldIndex the index from which the direct descendant was moved. + */ + public void onBookmarkItemMoved( + @NonNull ScopedBookmarkModelObservation source, int index, int oldIndex); + + /** + * Invoked when a direct descendant of the supplied bookmark folder is removed. + * + * @param source the observation that propagated the event. + * @param index the index at which the direct descendant was removed. + */ + public void onBookmarkItemRemoved( + @NonNull ScopedBookmarkModelObservation source, int index); + + /** + * Invoked when a direct descendant of the supplied bookmark folder is updated. + * + * @param source the observation that propagated the event. + * @param index the direct descendant that was updated. + */ + public void onBookmarkItemUpdated( + @NonNull ScopedBookmarkModelObservation source, @NonNull BookmarkItem item); + + /** + * Invoked when the direct descendants of the supplied bookmark folder have changed. Note + * that this event is only propagated when a more specific event cannot be, e.g. when the + * bookmark model has undergone extensive batched changes. + * + * @param source the observation that propagated the event. + * @param items the direct descendants that changed. + */ + public void onBookmarkItemsChanged( + @NonNull ScopedBookmarkModelObservation source, @NonNull List<BookmarkItem> items); + } + + private final BookmarkId mFolderId; + private final BookmarkModel mModel; + private final Observer mObserver; + + /** + * Constructor. + * + * @param folderId the ID for the folder to observe. + * @param model the model to observe. + * @param observer the observer to which events are propagated. + */ + public ScopedBookmarkModelObservation( + @NonNull BookmarkId folderId, + @NonNull BookmarkModel model, + @NonNull Observer observer) { + assert model.isBookmarkModelLoaded(); + + mFolderId = folderId; + mModel = model; + mObserver = observer; + + mModel.addObserver(this); + bookmarkModelChanged(); + } + + /** Destroys the observation. */ + public void destroy() { + mModel.removeObserver(this); + } + + @Override + public void bookmarkAllUserNodesRemoved() { + mObserver.onBookmarkItemsChanged(/* source= */ this, Collections.emptyList()); + } + + @Override + public void bookmarkModelChanged() { + mObserver.onBookmarkItemsChanged( + /* source= */ this, mModel.getBookmarksForFolder(mFolderId)); + } + + @Override + public void bookmarkNodeAdded(BookmarkItem parent, int index) { + if (Objects.equals(mFolderId, parent.getId())) { + mObserver.onBookmarkItemAdded(/* source= */ this, getBookmarkByIndex(index), index); + } + } + + @Override + public void bookmarkNodeChanged(BookmarkItem node) { + if (Objects.equals(mFolderId, node.getParentId())) { + mObserver.onBookmarkItemUpdated(/* source= */ this, node); + } + } + + @Override + public void bookmarkNodeChildrenReordered(BookmarkItem node) { + if (Objects.equals(mFolderId, node.getId())) { + bookmarkModelChanged(); + } + } + + @Override + public void bookmarkNodeMoved( + BookmarkItem oldParent, int oldIndex, BookmarkItem parent, int index) { + final boolean isMoveFromFolder = Objects.equals(mFolderId, oldParent.getId()); + final boolean isMoveToFolder = Objects.equals(mFolderId, parent.getId()); + final boolean isMoveWithinFolder = isMoveFromFolder && isMoveToFolder; + + if (isMoveWithinFolder) { + mObserver.onBookmarkItemMoved(this, index, oldIndex); + } else if (isMoveFromFolder) { + mObserver.onBookmarkItemRemoved(this, oldIndex); + } else if (isMoveToFolder) { + mObserver.onBookmarkItemAdded(/* source= */ this, getBookmarkByIndex(index), index); + } + } + + @Override + public void bookmarkNodeRemoved(BookmarkItem parent, int oldIndex, BookmarkItem node) { + if (Objects.equals(mFolderId, parent.getId())) { + mObserver.onBookmarkItemRemoved(/* source= */ this, oldIndex); + } + } + + private @NonNull BookmarkItem getBookmarkByIndex(int index) { + final BookmarkId id = mModel.getChildAt(mFolderId, index); + assert id != null; + + final BookmarkItem item = mModel.getBookmarkById(id); + assert item != null; + return item; + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/TabGroupContextMenuCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/TabGroupContextMenuCoordinator.java index 3702614..e437ea3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/TabGroupContextMenuCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/TabGroupContextMenuCoordinator.java
@@ -299,15 +299,18 @@ R.style.TextAppearance_TextLarge_Primary_Baseline_Light, isIncognito, /* enabled= */ true)); - itemList.add( - BrowserUiListMenuUtils.buildMenuListItemWithIncognitoBranding( - R.string.ungroup_tab_group_menu_item, - R.id.ungroup_tab, - R.drawable.ic_ungroup_tabs_24dp, - R.color.default_icon_color_light_tint_list, - R.style.TextAppearance_TextLarge_Primary_Baseline_Light, - isIncognito, - /* enabled= */ true)); + + if (!hasCollaborationData) { + itemList.add( + BrowserUiListMenuUtils.buildMenuListItemWithIncognitoBranding( + R.string.ungroup_tab_group_menu_item, + R.id.ungroup_tab, + R.drawable.ic_ungroup_tabs_24dp, + R.color.default_icon_color_light_tint_list, + R.style.TextAppearance_TextLarge_Primary_Baseline_Light, + isIncognito, + /* enabled= */ true)); + } if (!isIncognito && ChromeFeatureList.isEnabled(ChromeFeatureList.DATA_SHARING) @@ -338,9 +341,8 @@ R.string.tab_grid_dialog_toolbar_delete_group, R.id.delete_tab_group, R.drawable.material_ic_delete_24dp, - true)); + /* enabled= */ true)); } - setListViewHeightBasedOnChildren(); } @@ -365,6 +367,14 @@ } if (memberRole == MemberRole.OWNER) { + int insertionIndex = getMenuItemIndex(itemList, R.id.manage_sharing); + itemList.add( + insertionIndex, + BrowserUiListMenuUtils.buildMenuListItem( + R.string.ungroup_tab_group_menu_item, + R.id.ungroup_tab, + R.drawable.ic_ungroup_tabs_24dp, + /* enabled= */ true)); itemList.add(getDivider()); itemList.add( BrowserUiListMenuUtils.buildMenuListItem(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchContext.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchContext.java index 6b334a4..a657fe4f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchContext.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchContext.java
@@ -11,6 +11,7 @@ import androidx.annotation.VisibleForTesting; import org.jni_zero.CalledByNative; +import org.jni_zero.JniType; import org.jni_zero.NativeClassQualifiedName; import org.jni_zero.NativeMethods; @@ -460,7 +461,7 @@ void setResolveProperties( long nativeContextualSearchContext, ContextualSearchContext caller, - String homeCountry, + @JniType("std::string") String homeCountry, boolean doSendBasePageUrl); @NativeClassQualifiedName("NativeContextualSearchContext") @@ -471,21 +472,22 @@ int endAdjust); @NativeClassQualifiedName("NativeContextualSearchContext") + @JniType("std::string") String detectLanguage(long nativeContextualSearchContext, ContextualSearchContext caller); @NativeClassQualifiedName("NativeContextualSearchContext") void setTranslationLanguages( long nativeContextualSearchContext, ContextualSearchContext caller, - String detectedLanguage, - String targetLanguage, - String fluentLanguages); + @JniType("std::string") String detectedLanguage, + @JniType("std::string") String targetLanguage, + @JniType("std::string") String fluentLanguages); @NativeClassQualifiedName("NativeContextualSearchContext") void prepareToResolve( long nativeContextualSearchContext, ContextualSearchContext caller, boolean isExactSearch, - String relatedSearchesStamp); + @JniType("std::string") String relatedSearchesStamp); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java index c1c31ce..96aeb14c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java
@@ -687,7 +687,10 @@ @CalledByNative @VisibleForTesting void onTextSurroundingSelectionAvailable( - final String encoding, final String surroundingText, int startOffset, int endOffset) { + final @JniType("std::string") String encoding, + final @JniType("std::u16string") String surroundingText, + int startOffset, + int endOffset) { if (mInternalStateController.isStillWorkingOn(InternalState.GATHERING_SURROUNDINGS)) { assert mContext != null; // Sometimes Blink returns empty surroundings and 0 offsets so reset in that case. @@ -735,22 +738,22 @@ public void onSearchTermResolutionResponse( boolean isNetworkUnavailable, int responseCode, - final String searchTerm, - final String displayText, - final String alternateTerm, - final String mid, + final @JniType("std::string") String searchTerm, + final @JniType("std::string") String displayText, + final @JniType("std::string") String alternateTerm, + final @JniType("std::string") String mid, boolean doPreventPreload, int selectionStartAdjust, int selectionEndAdjust, - final String contextLanguage, - final String thumbnailUrl, - final String caption, - final String quickActionUri, + final @JniType("std::string") String contextLanguage, + final @JniType("std::string") String thumbnailUrl, + final @JniType("std::string") String caption, + final @JniType("std::string") String quickActionUri, @QuickActionCategory final int quickActionCategory, - final String searchUrlFull, - final String searchUrlPreload, + final @JniType("std::string") String searchUrlFull, + final @JniType("std::string") String searchUrlPreload, @CardTag final int cocaCardTag, - final String relatedSearchesJson) { + final @JniType("std::string") String relatedSearchesJson) { ContextualSearchUma.logResolveReceived(mSelectionController.isTapSelection()); ResolvedSearchTerm resolvedSearchTerm = new ResolvedSearchTerm.Builder( @@ -2021,7 +2024,7 @@ void removeLastHistoryEntry( long nativeContextualSearchManager, ContextualSearchManager caller, - String historyUrl, + @JniType("std::string") String historyUrl, long urlTimeMs); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialog.java index c4d781b..341ccd36 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialog.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialog.java
@@ -11,6 +11,7 @@ import androidx.annotation.VisibleForTesting; import org.jni_zero.CalledByNative; +import org.jni_zero.JniType; import org.jni_zero.NativeMethods; import org.chromium.chrome.R; @@ -134,7 +135,7 @@ @VisibleForTesting static UsbChooserDialog create( WindowAndroid windowAndroid, - String origin, + @JniType("std::u16string") String origin, int securityLevel, Profile profile, long nativeUsbChooserDialogPtr) { @@ -165,12 +166,13 @@ @VisibleForTesting @CalledByNative - void addDevice(String deviceId, String deviceName) { + void addDevice( + @JniType("std::string") String deviceId, @JniType("std::u16string") String deviceName) { mItemChooserDialog.addOrUpdateItem(deviceId, deviceName); } @CalledByNative - private void removeDevice(String deviceId) { + private void removeDevice(@JniType("std::string") String deviceId) { mItemChooserDialog.removeItemFromList(deviceId); } @@ -182,7 +184,8 @@ @NativeMethods interface Natives { - void onItemSelected(long nativeUsbChooserDialogAndroid, String deviceId); + void onItemSelected( + long nativeUsbChooserDialogAndroid, @JniType("std::string") String deviceId); void onDialogCancelled(long nativeUsbChooserDialogAndroid);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java index 0a9a773..b7dd72eb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
@@ -41,6 +41,7 @@ import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate; import org.chromium.chrome.browser.settings.SettingsNavigationFactory; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; +import org.chromium.chrome.browser.ssl.HttpsFirstModeSettingsFragment; import org.chromium.chrome.browser.sync.settings.GoogleServicesSettings; import org.chromium.chrome.browser.sync.settings.ManageSyncSettings; import org.chromium.chrome.browser.usage_stats.UsageStatsConsentDialog; @@ -62,6 +63,8 @@ private static final String PREF_CAN_MAKE_PAYMENT = "can_make_payment"; private static final String PREF_PRELOAD_PAGES = "preload_pages"; private static final String PREF_HTTPS_FIRST_MODE = "https_first_mode"; + // TODO(crbug.com/349860796): Remove once new settings are fully rolled out. + private static final String PREF_HTTPS_FIRST_MODE_LEGACY = "https_first_mode_legacy"; private static final String PREF_SECURE_DNS = "secure_dns"; private static final String PREF_USAGE_STATS = "usage_stats_reporting"; private static final String PREF_SAFE_BROWSING = "safe_browsing"; @@ -170,36 +173,51 @@ (ChromeSwitchPreference) findPreference(PREF_CAN_MAKE_PAYMENT); canMakePaymentPref.setOnPreferenceChangeListener(this); - ChromeSwitchPreference httpsFirstModePref = - (ChromeSwitchPreference) findPreference(PREF_HTTPS_FIRST_MODE); - httpsFirstModePref.setOnPreferenceChangeListener(this); - httpsFirstModePref.setManagedPreferenceDelegate( - new ChromeManagedPreferenceDelegate(getProfile()) { - @Override - public boolean isPreferenceControlledByPolicy(Preference preference) { - String key = preference.getKey(); - assert PREF_HTTPS_FIRST_MODE.equals(key) - : "Unexpected preference key: " + key; - return UserPrefs.get(getProfile()) - .isManagedPreference(Pref.HTTPS_ONLY_MODE_ENABLED); - } + // TODO(crbug.com/349860796): Remove old version (PREF_HTTPS_FIRST_MODE_LEGACY) + // when new settings are fully rolled out. + Preference httpsFirstModePref = findPreference(PREF_HTTPS_FIRST_MODE); + ChromeSwitchPreference httpsFirstModeLegacySwitchPref = + (ChromeSwitchPreference) findPreference(PREF_HTTPS_FIRST_MODE_LEGACY); + if (ChromeFeatureList.isEnabled(ChromeFeatureList.HTTPS_FIRST_BALANCED_MODE)) { + // Hide the old toggle pref if the feature flag is enabled. + httpsFirstModeLegacySwitchPref.setVisible(false); - @Override - public boolean isPreferenceClickDisabled(Preference preference) { - // Advanced Protection automatically enables HTTPS-Only Mode so - // lock the setting. - return isPreferenceControlledByPolicy(preference) - || new SafeBrowsingBridge(getProfile()).isUnderAdvancedProtection(); - } - }); - httpsFirstModePref.setChecked( - UserPrefs.get(getProfile()).getBoolean(Pref.HTTPS_ONLY_MODE_ENABLED)); - if (new SafeBrowsingBridge(getProfile()).isUnderAdvancedProtection()) { httpsFirstModePref.setSummary( - getContext() - .getString( - R.string - .settings_https_first_mode_with_advanced_protection_summary)); + HttpsFirstModeSettingsFragment.getSummary(getContext(), getProfile())); + } else { + // Hide the new pref item if the feature flag isn't enabled. + httpsFirstModePref.setVisible(false); + + httpsFirstModeLegacySwitchPref.setOnPreferenceChangeListener(this); + httpsFirstModeLegacySwitchPref.setManagedPreferenceDelegate( + new ChromeManagedPreferenceDelegate(getProfile()) { + @Override + public boolean isPreferenceControlledByPolicy(Preference preference) { + String key = preference.getKey(); + assert PREF_HTTPS_FIRST_MODE_LEGACY.equals(key) + : "Unexpected preference key: " + key; + return UserPrefs.get(getProfile()) + .isManagedPreference(Pref.HTTPS_ONLY_MODE_ENABLED); + } + + @Override + public boolean isPreferenceClickDisabled(Preference preference) { + // Advanced Protection automatically enables HTTPS-Only Mode so + // lock the setting. + return isPreferenceControlledByPolicy(preference) + || new SafeBrowsingBridge(getProfile()) + .isUnderAdvancedProtection(); + } + }); + httpsFirstModeLegacySwitchPref.setChecked( + UserPrefs.get(getProfile()).getBoolean(Pref.HTTPS_ONLY_MODE_ENABLED)); + if (new SafeBrowsingBridge(getProfile()).isUnderAdvancedProtection()) { + httpsFirstModeLegacySwitchPref.setSummary( + getContext() + .getString( + R.string + .settings_https_first_mode_with_advanced_protection_summary)); + } } Preference syncAndServicesLink = findPreference(PREF_SYNC_AND_SERVICES_LINK); @@ -312,7 +330,8 @@ if (PREF_CAN_MAKE_PAYMENT.equals(key)) { UserPrefs.get(getProfile()) .setBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED, (boolean) newValue); - } else if (PREF_HTTPS_FIRST_MODE.equals(key)) { + } else if (PREF_HTTPS_FIRST_MODE_LEGACY.equals(key)) { + // TODO(crbug.com/349860796): Remove once new settings are fully rolled out. UserPrefs.get(getProfile()) .setBoolean(Pref.HTTPS_ONLY_MODE_ENABLED, (boolean) newValue); } @@ -377,6 +396,12 @@ getContext(), getProfile())); } + Preference httpsFirstModePreference = findPreference(PREF_HTTPS_FIRST_MODE); + if (httpsFirstModePreference != null && httpsFirstModePreference.isVisible()) { + httpsFirstModePreference.setSummary( + HttpsFirstModeSettingsFragment.getSummary(getContext(), getProfile())); + } + Preference usageStatsPref = findPreference(PREF_USAGE_STATS); if (usageStatsPref != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/FinancialAccountsManagementFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/FinancialAccountsManagementFragmentTest.java index cda2a4a..bf49d377 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/FinancialAccountsManagementFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/settings/FinancialAccountsManagementFragmentTest.java
@@ -564,7 +564,7 @@ var pixToggleEnabledHistogram = HistogramWatcher.newSingleRecordWatcher( FinancialAccountsManagementFragment - .FACILITATED_PAYMENTS_TOGGLE_UPDATED_HISTOGRAM, + .FACILITATED_PAYMENTS_PIX_TOGGLE_UPDATED_HISTOGRAM, true); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(new Bundle()); ChromeSwitchPreference pixSwitch = getPixSwitchPreference(activity); @@ -586,7 +586,7 @@ var pixToggleDisabledHistogram = HistogramWatcher.newSingleRecordWatcher( FinancialAccountsManagementFragment - .FACILITATED_PAYMENTS_TOGGLE_UPDATED_HISTOGRAM, + .FACILITATED_PAYMENTS_PIX_TOGGLE_UPDATED_HISTOGRAM, false); SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(new Bundle()); ChromeSwitchPreference pixSwitch = getPixSwitchPreference(activity); @@ -600,6 +600,52 @@ @Test @MediumTest + @RequiresRestart("crbug.com/344671557") + public void testEwalletToggleTurnedOn_histogramLogged() { + AutofillTestHelper.addEwallet(EWALLET_ACCOUNT); + ThreadUtils.runOnUiThreadBlocking( + () -> { + getPrefService().setBoolean(Pref.FACILITATED_PAYMENTS_EWALLET, false); + }); + var eWalletToggleEnabledHistogram = + HistogramWatcher.newSingleRecordWatcher( + FinancialAccountsManagementFragment + .FACILITATED_PAYMENTS_EWALLET_TOGGLE_UPDATED_HISTOGRAM, + true); + SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(new Bundle()); + ChromeSwitchPreference eWalletSwitch = getEwalletSwitchPreference(activity); + assertThat(eWalletSwitch.isChecked()).isFalse(); + + // Set the eWallet toggle to on. + ThreadUtils.runOnUiThreadBlocking( + () -> { + eWalletSwitch.performClick(); + }); + + eWalletToggleEnabledHistogram.assertExpected(); + } + + @Test + @MediumTest + public void testEwalletToggleTurnedOff_histogramLogged() throws TimeoutException { + AutofillTestHelper.addEwallet(EWALLET_ACCOUNT); + var eWalletToggleEnabledHistogram = + HistogramWatcher.newSingleRecordWatcher( + FinancialAccountsManagementFragment + .FACILITATED_PAYMENTS_EWALLET_TOGGLE_UPDATED_HISTOGRAM, + false); + SettingsActivity activity = mSettingsActivityTestRule.startSettingsActivity(new Bundle()); + ChromeSwitchPreference eWalletSwitch = getEwalletSwitchPreference(activity); + assertThat(eWalletSwitch.isChecked()).isTrue(); + + // Set the eWallet toggle to off. + rule.clickOnPreferenceAndWait(eWalletSwitch); + + eWalletToggleEnabledHistogram.assertExpected(); + } + + @Test + @MediumTest public void testPixAccountPrefClicked_triggersOpeningManagePaymentMethodPage() throws Exception { AutofillTestHelper.addMaskedBankAccount(PIX_BANK_ACCOUNT);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/privacy/settings/HttpsFirstModeSettingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/privacy/settings/HttpsFirstModeLegacySettingTest.java similarity index 62% rename from chrome/android/javatests/src/org/chromium/chrome/browser/privacy/settings/HttpsFirstModeSettingTest.java rename to chrome/android/javatests/src/org/chromium/chrome/browser/privacy/settings/HttpsFirstModeLegacySettingTest.java index 220d674..f90b276 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/privacy/settings/HttpsFirstModeSettingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/privacy/settings/HttpsFirstModeLegacySettingTest.java
@@ -21,6 +21,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; +import org.chromium.base.test.util.Features.DisableFeatures; +import org.chromium.base.test.util.Features.EnableFeatures; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; @@ -28,15 +31,20 @@ import java.util.concurrent.ExecutionException; -/** Tests for the HTTPS-First Mode setting in Privacy and security. */ +/** + * Tests for the HTTPS-First Mode setting in Privacy and security. Disables the + * HTTPS_FIRST_BALANCED_MODE feature flag to test the old settings UI. + * (c/b/ssl/android/javatests/src/org/chromium/chrome/browser/ssl/ contains the tests for the new + * settings UI when the feature flag is enabled.) + */ @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) @Batch(PER_CLASS) -public class HttpsFirstModeSettingTest { +public class HttpsFirstModeLegacySettingTest { private final SettingsActivityTestRule<PrivacySettings> mSettingsActivityTestRule = new SettingsActivityTestRule<>(PrivacySettings.class); - private static final String PREF_HTTPS_FIRST_MODE = "https_first_mode"; + private static final String PREF_HTTPS_FIRST_MODE_LEGACY = "https_first_mode_legacy"; private static Preference waitForPreference( final PreferenceFragmentCompat prefFragment, final String preferenceKey) @@ -54,6 +62,7 @@ @Test @LargeTest + @DisableFeatures(ChromeFeatureList.HTTPS_FIRST_BALANCED_MODE) public void testSetting_AdvancedProtectionDisabled() throws Exception { mSettingsActivityTestRule.startSettingsActivity(); final PrivacySettings privacySettings = mSettingsActivityTestRule.getFragment(); @@ -61,7 +70,7 @@ ApplicationProvider.getApplicationContext() .getString(R.string.settings_https_first_mode_summary); - Preference pref = waitForPreference(privacySettings, PREF_HTTPS_FIRST_MODE); + Preference pref = waitForPreference(privacySettings, PREF_HTTPS_FIRST_MODE_LEGACY); Assert.assertNotNull(pref); ThreadUtils.runOnUiThreadBlocking( @@ -72,6 +81,7 @@ @Test @LargeTest + @DisableFeatures(ChromeFeatureList.HTTPS_FIRST_BALANCED_MODE) @CommandLineFlags.Add({"safe-browsing-treat-user-as-advanced-protection"}) public void testSetting_AdvancedProtectionEnabled() throws Exception { mSettingsActivityTestRule.startSettingsActivity(); @@ -83,7 +93,7 @@ R.string .settings_https_first_mode_with_advanced_protection_summary); - Preference pref = waitForPreference(privacySettings, PREF_HTTPS_FIRST_MODE); + Preference pref = waitForPreference(privacySettings, PREF_HTTPS_FIRST_MODE_LEGACY); Assert.assertNotNull(pref); ThreadUtils.runOnUiThreadBlocking( @@ -91,4 +101,38 @@ Assert.assertTrue(pref.getSummary().equals(lockedSummaryText)); }); } + + @Test + @LargeTest + @DisableFeatures(ChromeFeatureList.HTTPS_FIRST_BALANCED_MODE) + public void testSetting_NewSettingNotShownWhenFeatureDisabled() throws Exception { + // Check that the new setting preference isn't visible. + mSettingsActivityTestRule.startSettingsActivity(); + + final PrivacySettings privacySettings = mSettingsActivityTestRule.getFragment(); + + Preference pref = waitForPreference(privacySettings, "https_first_mode"); + Assert.assertNotNull(pref); + ThreadUtils.runOnUiThreadBlocking( + () -> { + Assert.assertFalse(pref.isVisible()); + }); + } + + @Test + @LargeTest + @EnableFeatures(ChromeFeatureList.HTTPS_FIRST_BALANCED_MODE) + public void testSetting_OldSettingNotShownWhenFeatureEnabled() throws Exception { + // Check that the old setting preference isn't visible. + mSettingsActivityTestRule.startSettingsActivity(); + + final PrivacySettings privacySettings = mSettingsActivityTestRule.getFragment(); + + Preference pref = waitForPreference(privacySettings, PREF_HTTPS_FIRST_MODE_LEGACY); + Assert.assertNotNull(pref); + ThreadUtils.runOnUiThreadBlocking( + () -> { + Assert.assertFalse(pref.isVisible()); + }); + } }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/ScopedBookmarkModelObservationTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/ScopedBookmarkModelObservationTest.java new file mode 100644 index 0000000..3877959f --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/bookmarks/ScopedBookmarkModelObservationTest.java
@@ -0,0 +1,234 @@ +// Copyright 2024 The Chromium Authors +// 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.bookmarks; + +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.clearInvocations; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import androidx.test.filters.SmallTest; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.base.test.util.Batch; +import org.chromium.components.bookmarks.BookmarkId; +import org.chromium.components.bookmarks.BookmarkItem; + +import java.util.Collections; +import java.util.List; + +/** Unit tests for {@link ScopedBookmarkModelObservation}. */ +@Batch(Batch.UNIT_TESTS) +@RunWith(BaseRobolectricTestRunner.class) +public class ScopedBookmarkModelObservationTest { + + @Rule public MockitoRule mMockitoRule = MockitoJUnit.rule(); + + @Mock private BookmarkItem mFolder; + @Mock private BookmarkId mFolderId; + @Mock private BookmarkItem mItem; + @Mock private BookmarkId mItemId; + @Mock private BookmarkModel mModel; + @Mock private ScopedBookmarkModelObservation.Observer mObserver; + @Mock private BookmarkItem mUnobservedFolder; + @Mock private BookmarkId mUnobservedFolderId; + @Mock private BookmarkItem mUnobservedItem; + @Mock private BookmarkId mUnobservedItemId; + + private List<BookmarkItem> mFolderItems; + private ScopedBookmarkModelObservation mObservation; + private BookmarkModelObserver mUnderlyingObserver; + private List<BookmarkItem> mUnobservedFolderItems; + + @Before + public void setUp() { + BookmarkModel.setInstanceForTesting(mModel); + mFolderItems = List.of(mItem); + mUnobservedFolderItems = List.of(mUnobservedItem); + + when(mFolder.getId()).thenReturn(mFolderId); + when(mItem.getId()).thenReturn(mItemId); + when(mItem.getParentId()).thenReturn(mFolderId); + when(mModel.getBookmarkById(mFolderId)).thenReturn(mFolder); + when(mModel.getBookmarkById(mItemId)).thenReturn(mItem); + when(mModel.getBookmarkById(mUnobservedFolderId)).thenReturn(mUnobservedFolder); + when(mModel.getBookmarkById(mUnobservedItemId)).thenReturn(mUnobservedItem); + when(mModel.getBookmarksForFolder(mFolderId)).thenReturn(mFolderItems); + when(mModel.getBookmarksForFolder(mUnobservedFolderId)).thenReturn(mUnobservedFolderItems); + when(mModel.isBookmarkModelLoaded()).thenReturn(true); + when(mUnobservedFolder.getId()).thenReturn(mUnobservedFolderId); + when(mUnobservedItem.getId()).thenReturn(mUnobservedItemId); + when(mUnobservedItem.getParentId()).thenReturn(mUnobservedFolderId); + + // Cache/release the underlying observer since most tests wish to interact with it. + doAnswer(i -> mUnderlyingObserver = i.getArgument(0)).when(mModel).addObserver(any()); + doAnswer(i -> mUnderlyingObserver = null).when(mModel).removeObserver(any()); + + // Most tests aren't interested in events that are propagated during construction, so reset + // the observer when creating the observation. + createObservation(/* resetObserver= */ true); + } + + private void createObservation(boolean resetObserver) { + if (mObservation != null) { + mObservation.destroy(); + clearInvocations(mModel, mObserver); + } + + mObservation = new ScopedBookmarkModelObservation(mFolderId, mModel, mObserver); + + if (resetObserver) { + reset(mObserver); + } + } + + @Test + @SmallTest + public void testConstructor() { + createObservation(/* resetObserver= */ false); + verify(mObserver).onBookmarkItemsChanged(mObservation, mFolderItems); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkAllUserNodesRemoved() { + mUnderlyingObserver.bookmarkAllUserNodesRemoved(); + verify(mObserver).onBookmarkItemsChanged(mObservation, Collections.emptyList()); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkModelChanged() { + mUnderlyingObserver.bookmarkModelChanged(); + verify(mObserver).onBookmarkItemsChanged(mObservation, mFolderItems); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeAddedToObservedFolder() { + final int index = 10; + when(mModel.getChildAt(mFolderId, index)).thenAnswer(i -> mItem.getId()); + mUnderlyingObserver.bookmarkNodeAdded(mFolder, index); + verify(mObserver).onBookmarkItemAdded(mObservation, mItem, index); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeAddedToUnobservedFolder() { + final int index = 10; + mUnderlyingObserver.bookmarkNodeAdded(mUnobservedFolder, index); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeChangedWithinObservedFolder() { + mUnderlyingObserver.bookmarkNodeChanged(mItem); + verify(mObserver).onBookmarkItemUpdated(mObservation, mItem); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeChangedWithinUnobservedFolder() { + mUnderlyingObserver.bookmarkNodeChanged(mUnobservedItem); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeChildrenReorderedWithinObservedFolder() { + mUnderlyingObserver.bookmarkNodeChildrenReordered(mFolder); + verify(mObserver).onBookmarkItemsChanged(mObservation, mFolderItems); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeChildrenReorderedWithinUnobservedFolder() { + mUnderlyingObserver.bookmarkNodeChildrenReordered(mUnobservedFolder); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeMovedFromObservedFolder() { + final int index = 10; + final int oldIndex = 27; + mUnderlyingObserver.bookmarkNodeMoved(mFolder, oldIndex, mUnobservedFolder, index); + verify(mObserver).onBookmarkItemRemoved(mObservation, oldIndex); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeMovedToObservedFolder() { + final int index = 10; + final int oldIndex = 27; + when(mModel.getChildAt(mFolderId, index)).thenReturn(mItemId); + mUnderlyingObserver.bookmarkNodeMoved(mUnobservedFolder, oldIndex, mFolder, index); + verify(mObserver).onBookmarkItemAdded(mObservation, mItem, index); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeMovedWithinObservedFolder() { + final int index = 10; + final int oldIndex = 27; + mUnderlyingObserver.bookmarkNodeMoved(mFolder, oldIndex, mFolder, index); + verify(mObserver).onBookmarkItemMoved(mObservation, index, oldIndex); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeMovedWithinUnobservedFolder() { + final int index = 10; + final int oldIndex = 27; + mUnderlyingObserver.bookmarkNodeMoved( + mUnobservedFolder, oldIndex, mUnobservedFolder, index); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeRemovedFromObservedFolder() { + final int index = 10; + mUnderlyingObserver.bookmarkNodeRemoved(mFolder, index, mItem); + verify(mObserver).onBookmarkItemRemoved(mObservation, index); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testBookmarkNodeRemovedFromUnobservedFolder() { + final int index = 10; + mUnderlyingObserver.bookmarkNodeRemoved(mUnobservedFolder, index, mUnobservedItem); + verifyNoMoreInteractions(mObserver); + } + + @Test + @SmallTest + public void testDestroy() { + mObservation.destroy(); + verifyNoMoreInteractions(mObserver); + } +}
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/compositor/overlays/strip/TabGroupContextMenuCoordinatorUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/compositor/overlays/strip/TabGroupContextMenuCoordinatorUnitTest.java index 423f3b6..3d549b8 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/compositor/overlays/strip/TabGroupContextMenuCoordinatorUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/compositor/overlays/strip/TabGroupContextMenuCoordinatorUnitTest.java
@@ -257,7 +257,15 @@ verifyNormalListItems(modelList, 5); // Assert: verify collaboration menu items. - verifyCollaborationListItems(modelList, MemberRole.OWNER); + assertEquals( + R.id.manage_sharing, + modelList.get(3).model.get(ListMenuItemProperties.MENU_ITEM_ID)); + assertEquals( + R.id.recent_activity, + modelList.get(4).model.get(ListMenuItemProperties.MENU_ITEM_ID)); + assertEquals( + R.id.delete_shared_group, + modelList.get(7).model.get(ListMenuItemProperties.MENU_ITEM_ID)); } @Test @@ -277,13 +285,26 @@ mTabGroupContextMenuCoordinator.buildCollaborationMenuItems(modelList, MemberRole.MEMBER); // Assert: verify number of items in the model list. - assertEquals("Number of items in the list menu is incorrect", 8, modelList.size()); + assertEquals("Number of items in the list menu is incorrect", 7, modelList.size()); - // Assert: verify normal menu items. - verifyNormalListItems(modelList, 5); - - // Assert: verify collaboration menu items. - verifyCollaborationListItems(modelList, MemberRole.MEMBER); + // Assert: verify normal and collaboration menu items; members should not have the option to + // ungroup. + assertEquals(ListMenuItemType.DIVIDER, modelList.get(0).type); + assertEquals( + R.id.open_new_tab_in_group, + modelList.get(1).model.get(ListMenuItemProperties.MENU_ITEM_ID)); + assertEquals( + R.id.manage_sharing, + modelList.get(2).model.get(ListMenuItemProperties.MENU_ITEM_ID)); + assertEquals( + R.id.recent_activity, + modelList.get(3).model.get(ListMenuItemProperties.MENU_ITEM_ID)); + assertEquals( + R.id.close_tab_group, + modelList.get(4).model.get(ListMenuItemProperties.MENU_ITEM_ID)); + assertEquals(ListMenuItemType.DIVIDER, modelList.get(5).type); + assertEquals( + R.id.leave_group, modelList.get(6).model.get(ListMenuItemProperties.MENU_ITEM_ID)); } @Test @@ -405,25 +426,4 @@ R.id.close_tab_group, modelList.get(closeGroupPosition).model.get(ListMenuItemProperties.MENU_ITEM_ID)); } - - private void verifyCollaborationListItems(ModelList modelList, @MemberRole int memberRole) { - assertEquals( - R.id.manage_sharing, - modelList.get(3).model.get(ListMenuItemProperties.MENU_ITEM_ID)); - assertEquals( - R.id.recent_activity, - modelList.get(4).model.get(ListMenuItemProperties.MENU_ITEM_ID)); - assertEquals(ListMenuItemType.DIVIDER, modelList.get(6).type); - - // Verify delete group or leave group depending on the member role. - if (memberRole == MemberRole.OWNER) { - assertEquals( - R.id.delete_shared_group, - modelList.get(7).model.get(ListMenuItemProperties.MENU_ITEM_ID)); - } else if (memberRole == MemberRole.MEMBER) { - assertEquals( - R.id.leave_group, - modelList.get(7).model.get(ListMenuItemProperties.MENU_ITEM_ID)); - } - } }
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 7f9df76..ac7e239 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -12780,6 +12780,17 @@ Learn more about access requests. </message> + <!-- Extension upload to account dialog --> + <message name="IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_TITLE" desc="Title of the dialog triggers the upload of a local extension to the signed in user's account."> + Save this extension in your Google Account? + </message> + <message name="IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_SUBTITLE" desc="Subtitle of the dialog triggers the upload of a local extension to the signed in user's account."> + "<ph name="NAME">$1<ex>Google Cast</ex></ph>" is saved only to this device. To use it on your other devices, save it in your account. + </message> + <message name="IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_OK_BUTTON_LABEL" desc="Text of the button that triggers the upload of a local extension to the signed in user's account in the extension upload dialog."> + Save in account + </message> + <!-- Reset Profile Settings strings --> <message name="IDS_RESET_PROFILE_SETTINGS_EXPLANATION" desc="A label describing the consequences of the 'reset profile settings' feature"> This will reset your startup page, new tab page, search engine, and pinned tabs. It will also disable all extensions and clear temporary data like cookies. Your bookmarks, history and saved passwords will not be cleared. @@ -18517,6 +18528,12 @@ <message name="IDS_TOAST_CLOSE_TOOLTIP" desc="Tooltip for the X button on a toast notification that closes the toast."> Close </message> + <message name="IDS_TOAST_MENU_ITEM_DISMISS" desc="Menu item that allows a user to dismiss a toast."> + Dismiss + </message> + <message name="IDS_TOAST_MENU_ITEM_DONT_SHOW_AGAIN" desc="Menu item that allows a user to turn off similar toast messages in the future."> + Don't show this message again + </message> </if> <message name="IDS_ACCNAME_SIDEBAR_WEBVIEW_LOCATION_BAR" desc="The accessible name of the sidebar webview's location bar.">
diff --git a/chrome/app/generated_resources_grd/IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_OK_BUTTON_LABEL.png.sha1 b/chrome/app/generated_resources_grd/IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_OK_BUTTON_LABEL.png.sha1 new file mode 100644 index 0000000..fee73c2 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_OK_BUTTON_LABEL.png.sha1
@@ -0,0 +1 @@ +1f9d91a8660d07078b556433d5b32d2b3014ce3b \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_SUBTITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_SUBTITLE.png.sha1 new file mode 100644 index 0000000..fee73c2 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_SUBTITLE.png.sha1
@@ -0,0 +1 @@ +1f9d91a8660d07078b556433d5b32d2b3014ce3b \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_TITLE.png.sha1 new file mode 100644 index 0000000..fee73c2 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_TITLE.png.sha1
@@ -0,0 +1 @@ +1f9d91a8660d07078b556433d5b32d2b3014ce3b \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_TOAST_MENU_ITEM_DISMISS.png.sha1 b/chrome/app/generated_resources_grd/IDS_TOAST_MENU_ITEM_DISMISS.png.sha1 new file mode 100644 index 0000000..ab750dc --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_TOAST_MENU_ITEM_DISMISS.png.sha1
@@ -0,0 +1 @@ +24cbf53ae12b8fd900d55511b91e2541331384f0 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_TOAST_MENU_ITEM_DONT_SHOW_AGAIN.png.sha1 b/chrome/app/generated_resources_grd/IDS_TOAST_MENU_ITEM_DONT_SHOW_AGAIN.png.sha1 new file mode 100644 index 0000000..ab750dc --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_TOAST_MENU_ITEM_DONT_SHOW_AGAIN.png.sha1
@@ -0,0 +1 @@ +24cbf53ae12b8fd900d55511b91e2541331384f0 \ No newline at end of file
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 2b6a795..4217571 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -1463,8 +1463,14 @@ <message name="IDS_SETTINGS_COMPOSE_SETTING_LINK_A11Y" desc="This string is found in a link that takes the user to the Help Me Write help center article when the user taps it. It is at the end of the Help Me Write setting description that users see when they visit the ‘AI innovations’ section of settings (AI = artificial intelligence). The tone should be informative."> Learn more about Help me write </message> - <message name="IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_HELP" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that this feature suggests writing help when users are writing short-form text on the web. The tone should be motivating."> - Helps you write short-form text for things on the web, like reviews. Writing suggestions are based on your prompts and the content of the web page + <message name="IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_HELP" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that this feature suggests writing help when users are writing on the web. The tone should be motivating."> + Helps you write anything on the web with a little extra polish or creative inspiration + </message> + <message name="IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_EXAMPLES" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that users can get writing help on a variety of content, from short-form (social media posts) to long-form (essays). The tone should be motivating."> + You can get help with reviews, emails, social media posts, essays, and more + </message> + <message name="IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_REFERENCES" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that writing help will be smart and contextual, based on the page content and the user’s input. The tone should be motivating."> + Writing suggestions are based on your prompts and the content of the web page </message> <message name="IDS_SETTINGS_COMPOSE_CONSIDER_DATA" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that AI features will send data to Google servers in order to provide the feature’s respective benefit. The tone should be informative."> When you get writing help, the page’s URL, content, and your text are sent to Google. Don’t enter personal info (like medical or financial details) @@ -3937,7 +3943,7 @@ <message name="IDS_SETTINGS_HISTORY_SEARCH_SETTING_LABEL" desc="Title of the page of the settings that enables history search."> History search, powered by AI </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_SETTING_SUBLABEL" desc="Sublabel of the setting that enables history search." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_SETTING_SUBLABEL" desc="Sublabel of the setting that enables history search."> Use everyday language to search your browsing history and find sites you visited. Only sites you visit after turning on this feature are shown in AI-powered history search results. </message> <message name="IDS_SETTINGS_HISTORY_SEARCH_SETTING_SUBLABEL_V2" desc="This string is the subheading of a setting for ‘History search, powered by AI’. This subheading summarizes the user benefit of the History Search feature. This is an AI (artificial intelligence) feature that improves the search functionality so that users can write queries in natural language and search their Chrome browsing history. The tone should be motivating."> @@ -3949,34 +3955,37 @@ <message name="IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_BULLET_ONE" desc="Bullet point in the 'Things to consider' column of the description of the setting that enables history search."> When you search browsing history, your history search terms, page content of best matches, and generated model outputs are sent to Google and may be seen by human reviewers to improve this feature. </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_BULLET_TWO" desc="Bullet point in the 'Things to consider' column of the description of the setting that enables history search." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_BULLET_TWO" desc="Bullet point in the 'Things to consider' column of the description of the setting that enables history search."> As you browse sites, their page contents are saved in an encrypted form on your device. This may affect Chrome's performance. </message> <message name="IDS_SETTINGS_HISTORY_SEARCH_LEARN_MORE_A11Y_LABEL" desc="Label for the 'Learn more' link in the toggle for the setting that enables history search."> Learn more about history searches </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_SETTING_SUBLABEL" desc="Sublabel of the setting that enables history search with answers enabled." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_SETTING_SUBLABEL" desc="Sublabel of the setting that enables history search with answers enabled."> Use everyday language to search your browsing history. You can also ask questions and get answers based on your browsing history. </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_ONE" desc="Bullet point in the 'When on' column of the description of the setting that enables history search with answers enabled." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_ONE" desc="Bullet point in the 'When on' column of the description of the setting that enables history search with answers enabled."> Answers and search results are based on the content of a page. This gives you improved results, whether you're searching browsing history in the address bar using “@history” or from the History page. </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_TWO" desc="Bullet point in the 'When on' column of the description of the setting that enables history search with answers enabled." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_TWO" desc="Bullet point in the 'When on' column of the description of the setting that enables history search with answers enabled."> Only sites you visit after turning on this feature are shown in AI-powered history search results. </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_ONE" desc="Bullet point in the 'Things to consider' column of the description of the setting that enables history search with answers enabled." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_ONE" desc="Bullet point in the 'Things to consider' column of the description of the setting that enables history search with answers enabled."> When you search browsing history, your history searches, the page content of best matches, and generated model outputs are sent to Google and may be seen by human reviewers to improve this feature. </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_TWO" desc="Bullet point in the 'Things to consider' column of the description of the setting that enables history search with answers enabled." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_TWO" desc="Bullet point in the 'Things to consider' column of the description of the setting that enables history search with answers enabled."> As you browse sites, their page contents are encrypted and saved to your device. AI-powered history search results and answers may become outdated if site content has changed since your last visit. This feature may also affect Chrome’s performance. </message> <message name="IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_PAGE_CONTENT" desc="This string is a bullet point in the ‘When on’ column, which describes the behavior of this feature. This string explains how users can write queries in natural language and search their Chrome browsing history. The tone should be motivating."> You can search your browsing history based on general page content, not only page title and URL, and see improved results </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_SEARCH_FROM" desc="This string is a bullet point in the ‘When on’ column, which describes the behavior of this feature. This string explains how users search their Chrome browsing history from the address bar (always shown on the top of Chrome). They can also search from the History page itself. The tone should be motivating." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_SEARCH_FROM" desc="This string is a bullet point in the ‘When on’ column, which describes the behavior of this feature. This string explains how users search their Chrome browsing history from the address bar (always shown on the top of Chrome). They can also search from the History page itself. The tone should be motivating."> You can search in the address bar using "@history", as well as from the History page </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_DATA" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that AI features will send data to Google servers in order to provide the feature’s respective benefit. The tone should be informative." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_LOG_START" desc="This string is a bullet point in the ‘When on’ column, which describes the behavior of this feature. This string explains that the AI-powered history search results will only use data about sites the user visits after they turn on this feature. Earlier history data, from when the feature setting was turned off, won’t appear in the search results. The tone should be informative."> + Only sites you visit after turning on this feature are shown in AI-powered history results + </message> + <message name="IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_DATA" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that AI features will send data to Google servers in order to provide the feature’s respective benefit. The tone should be informative."> When you search browsing history, your history searches, the page content of best matches, and generated model outputs are sent to Google </message> <message name="IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_DATA_ENCRYPTED" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that AI features will save data to the user’s device in order to provide the feature’s respective benefit. The data will be appropriately encrypted for security. The tone should be informative."> @@ -3988,25 +3997,25 @@ <message name="IDS_SETTINGS_HISTORY_SEARCH_SUBLABEL_OFF" desc="This string is the subheading of a setting for ‘History search, powered by AI’. This subheading notes that the setting is currently turned on. Then, it summarizes the user benefit of the History Search feature. This is an AI (artificial intelligence) feature that improves the search functionality so that users can write queries in natural language and search their Chrome browsing history. The tone should be motivating."> Off • Use everyday language to search your browsing history and find sites you visited </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SETTING_SUBLABEL_V2" desc="Sublabel of the setting that enables history search, powered by AI, with answers enabled." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SETTING_SUBLABEL_V2" desc="Sublabel of the setting that enables history search, powered by AI, with answers enabled."> Use everyday language to search your browsing history and find sites you visited. You can also ask questions and get answers based on your browsing history </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_PAGE_CONTENT" desc="This string is a bullet point in the ‘When on’ column, which describes the behavior of this feature. This string explains how users can write queries in natural language and search their Chrome browsing history to get answers. The tone should be motivating." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_PAGE_CONTENT" desc="This string is a bullet point in the ‘When on’ column, which describes the behavior of this feature. This string explains how users can write queries in natural language and search their Chrome browsing history to get answers. The tone should be motivating."> When you search your browsing history, answers and search results are based on the content of a page. This gives you improved results </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_LOG_START" desc="This string is a bullet point in the ‘When on’ column, which describes the behavior of this feature. This string explains how only sites the user visits after turning on the feature will be available in history search results powered by AI." translateable="false"> - Only sites you visit after turning on this feature are shown in AI-powered history results + <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_RECALL_INFO" desc="This string is a bullet point in the ‘When on’ column, which describes the behavior of this feature. This string explains how users can write questions (using question words like ‘what’, ‘who’, ‘where’) and get answer summaries based on their Chrome browsing history. The tone should be motivating."> + When you ask questions about your history, you can get answers about specific information from a page you visited </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_DATA_ENCRYPTED" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that AI features will save data to the user’s device in order to provide the feature’s respective benefit. The data will be appropriately encrypted for security. The tone should be informative." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_DATA_ENCRYPTED" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that AI features will save data to the user’s device in order to provide the feature’s respective benefit. The data will be appropriately encrypted for security. The tone should be informative."> As you browse sites, their page contents are encrypted and saved to your device. This may affect Chrome's performance </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_OUTDATED" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that history search results and answers powered by AI may become outdated since they are dependent on the user's last visit to the page contents." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_OUTDATED" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that history search results and answers powered by AI may become outdated since they are dependent on the user's last visit to the page contents."> AI-powered history search results and answers may become outdated if site content has changed since your last visit </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_ON" desc="This string is the subheading of a setting for ‘History search, powered by AI’ when answers are available. This subheading notes that the setting is currently turned on. Then, it summarizes the user benefit of the History Search feature. This is an AI (artificial intelligence) feature that improves the search functionality so that users can write queries in natural language and search their Chrome browsing history. The tone should be motivating." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_ON" desc="This string is the subheading of a setting for ‘History search, powered by AI’ when answers are available. This subheading notes that the setting is currently turned on. Then, it summarizes the user benefit of the History Search feature. This is an AI (artificial intelligence) feature that improves the search functionality so that users can write queries in natural language and search their Chrome browsing history. The tone should be motivating."> On • Use everyday language to search your browsing history and find sites you visited. You can also ask questions and get answers based on your browsing history </message> - <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_OFF" desc="This string is the subheading of a setting for ‘History search, powered by AI’ when answers are available. This subheading notes that the setting is currently turned on. Then, it summarizes the user benefit of the History Search feature. This is an AI (artificial intelligence) feature that improves the search functionality so that users can write queries in natural language and search their Chrome browsing history. The tone should be motivating." translateable="false"> + <message name="IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_OFF" desc="This string is the subheading of a setting for ‘History search, powered by AI’ when answers are available. This subheading notes that the setting is currently turned on. Then, it summarizes the user benefit of the History Search feature. This is an AI (artificial intelligence) feature that improves the search functionality so that users can write queries in natural language and search their Chrome browsing history. The tone should be motivating."> Off • Use everyday language to search your browsing history and find sites you visited. You can also ask questions and get answers based on your browsing history </message> @@ -4587,8 +4596,11 @@ <message name="IDS_SETTINGS_AUTOTABS_SETTING_LINK_A11Y" desc="This string is found in a link that takes the user to the Tab Organizer help center article when the user taps it. It is at the end of the Tab Organizer setting description that users see when they visit the ‘AI innovations’ section of settings (AI = artificial intelligence). The tone should be informative."> Learn more about tab organizer </message> - <message name="IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_AUTO_GROUPS" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that this feature helps users get organized by suggesting and automatically creating tab groups out of the user’s open tabs. The tone should be motivating."> - Automatically suggests and creates groups from your open tabs, making it easier to find what you're looking for + <message name="IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_AUTO_GROUPS" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that this feature suggests and automatically creates tab groups out of the user’s open tabs. The tone should be motivating."> + Automatically suggests and creates groups from your open tabs + </message> + <message name="IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_IMPROVE_FOCUS" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that this feature helps users stay focused on their work because their tabs will be organized. The tone should be motivating."> + Helps you focus on whatever you’re working on </message> <message name="IDS_SETTINGS_TAB_ORGANIZER_CONSIDER_DATA" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that AI features will send data to Google servers in order to provide the feature’s respective benefit. The tone should be informative."> When you use organize tabs, the titles and URLs of your open tabs are sent to Google to generate suggested tab groups @@ -4612,6 +4624,15 @@ <message name="IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_DETAILS" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that this feature helps users compare products in open tabs by generating an information table and summarizing key differences. The tone should be motivating."> Helps you see similar products side-by-side and easily compare the details that matter to you </message> + <message name="IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_SUGGEST" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that this feature will suggest which details are most relevant to look at when comparing different products. The tone should be motivating."> + Suggests comparison details to look at when choosing between products + </message> + <message name="IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_FILTER" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that Compare tables are also useful as a notepad, as users can eliminate products that they are no longer considering. The tone should be motivating."> + You can use your comparison tables to keep track as you narrow down your options + </message> + <message name="IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_REVIEWS" desc="This string is a bullet point in the ‘When used’ column, which describes the behavior of this feature. This string explains that this feature will pull in details from review websites and product-buying guides; however, only some products have this content available. The tone should be motivating."> + For some products, Chrome can gather reviews from around the web + </message> <message name="IDS_SETTINGS_COMPARE_CONSIDER_DATA" desc="This is a bullet point in the ‘Things to consider’ column, which describes things users should consider about a feature. This string explains that AI features will send data to Google servers in order to provide the feature’s respective benefit. The tone should be informative."> When you compare products, the tab titles and URLs of the products are sent to Google </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_FILTER.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_FILTER.png.sha1 new file mode 100644 index 0000000..77b5934c --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_FILTER.png.sha1
@@ -0,0 +1 @@ +6f19b034ae8f99adf0afcd20ccf9efa44ec0990d \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_REVIEWS.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_REVIEWS.png.sha1 new file mode 100644 index 0000000..77b5934c --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_REVIEWS.png.sha1
@@ -0,0 +1 @@ +6f19b034ae8f99adf0afcd20ccf9efa44ec0990d \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_SUGGEST.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_SUGGEST.png.sha1 new file mode 100644 index 0000000..77b5934c --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_SUGGEST.png.sha1
@@ -0,0 +1 @@ +6f19b034ae8f99adf0afcd20ccf9efa44ec0990d \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_EXAMPLES.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_EXAMPLES.png.sha1 new file mode 100644 index 0000000..7d5cda0 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_EXAMPLES.png.sha1
@@ -0,0 +1 @@ +da99033089b70a3da5029b72f85882d9ba6f5b38 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_HELP.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_HELP.png.sha1 index 9c62811..7d5cda0 100644 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_HELP.png.sha1 +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_HELP.png.sha1
@@ -1 +1 @@ -09cf85e4aa7908b3d418363575a48e75eccf3020 \ No newline at end of file +da99033089b70a3da5029b72f85882d9ba6f5b38 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_REFERENCES.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_REFERENCES.png.sha1 new file mode 100644 index 0000000..7d5cda0 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_REFERENCES.png.sha1
@@ -0,0 +1 @@ +da99033089b70a3da5029b72f85882d9ba6f5b38 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_ONE.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_ONE.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_ONE.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_TWO.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_TWO.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_TWO.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_SETTING_SUBLABEL.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_SETTING_SUBLABEL.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_SETTING_SUBLABEL.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_ONE.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_ONE.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_ONE.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_TWO.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_TWO.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_TWO.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_BULLET_TWO.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_BULLET_TWO.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_BULLET_TWO.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_DATA.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_DATA.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_CONSIDER_DATA.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_SETTING_SUBLABEL.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_SETTING_SUBLABEL.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_SETTING_SUBLABEL.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_LOG_START.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_LOG_START.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_LOG_START.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_SEARCH_FROM.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_SEARCH_FROM.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_SEARCH_FROM.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_DATA_ENCRYPTED.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_DATA_ENCRYPTED.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_DATA_ENCRYPTED.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_OUTDATED.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_OUTDATED.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_OUTDATED.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SETTING_SUBLABEL_V2.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SETTING_SUBLABEL_V2.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SETTING_SUBLABEL_V2.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_OFF.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_OFF.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_OFF.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_ON.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_ON.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SUBLABEL_ON.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_PAGE_CONTENT.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_PAGE_CONTENT.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_PAGE_CONTENT.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_RECALL_INFO.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_RECALL_INFO.png.sha1 new file mode 100644 index 0000000..9d4d18a1 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_RECALL_INFO.png.sha1
@@ -0,0 +1 @@ +64f1f9c38b7b7f77ebddadbd9f5c1593fd1d98f7 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_AUTO_GROUPS.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_AUTO_GROUPS.png.sha1 index 10897b4..7346abf 100644 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_AUTO_GROUPS.png.sha1 +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_AUTO_GROUPS.png.sha1
@@ -1 +1 @@ -785103f4950db95dd21eadc5c2c9d3bd5c454755 \ No newline at end of file +f1eb9b403183bd03089d0f102643cba1256ed502 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_IMPROVE_FOCUS.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_IMPROVE_FOCUS.png.sha1 new file mode 100644 index 0000000..7346abf --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_IMPROVE_FOCUS.png.sha1
@@ -0,0 +1 @@ +f1eb9b403183bd03089d0f102643cba1256ed502 \ No newline at end of file
diff --git a/chrome/app/theme/default_100_percent/common/save_card_convenience.png b/chrome/app/theme/default_100_percent/common/save_card_convenience.png deleted file mode 100644 index 238a76c..0000000 --- a/chrome/app/theme/default_100_percent/common/save_card_convenience.png +++ /dev/null Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/save_card_convenience_dark.png b/chrome/app/theme/default_100_percent/common/save_card_convenience_dark.png deleted file mode 100644 index 1d94991..0000000 --- a/chrome/app/theme/default_100_percent/common/save_card_convenience_dark.png +++ /dev/null Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/save_card_education.png b/chrome/app/theme/default_100_percent/common/save_card_education.png deleted file mode 100644 index f51697f..0000000 --- a/chrome/app/theme/default_100_percent/common/save_card_education.png +++ /dev/null Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/save_card_education_dark.png b/chrome/app/theme/default_100_percent/common/save_card_education_dark.png deleted file mode 100644 index cc48a3b..0000000 --- a/chrome/app/theme/default_100_percent/common/save_card_education_dark.png +++ /dev/null Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/save_card_convenience.png b/chrome/app/theme/default_200_percent/common/save_card_convenience.png deleted file mode 100644 index fae31d2..0000000 --- a/chrome/app/theme/default_200_percent/common/save_card_convenience.png +++ /dev/null Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/save_card_convenience_dark.png b/chrome/app/theme/default_200_percent/common/save_card_convenience_dark.png deleted file mode 100644 index 3f6afd8f..0000000 --- a/chrome/app/theme/default_200_percent/common/save_card_convenience_dark.png +++ /dev/null Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/save_card_education.png b/chrome/app/theme/default_200_percent/common/save_card_education.png deleted file mode 100644 index 0e9e5190..0000000 --- a/chrome/app/theme/default_200_percent/common/save_card_education.png +++ /dev/null Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/save_card_education_dark.png b/chrome/app/theme/default_200_percent/common/save_card_education_dark.png deleted file mode 100644 index 367c848..0000000 --- a/chrome/app/theme/default_200_percent/common/save_card_education_dark.png +++ /dev/null Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 716f97e..5c6ecdb 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd
@@ -277,11 +277,7 @@ <structure type="chrome_scaled_image" name="IDR_SAVE_PASSWORD" file="common/save_password.png" /> <structure type="chrome_scaled_image" name="IDR_SAVE_PASSWORD_DARK" file="common/save_password_dark.png" /> <structure type="chrome_scaled_image" name="IDR_SAVE_CARD" file="common/save_card.png" /> - <structure type="chrome_scaled_image" name="IDR_SAVE_CARD_CONVENIENCE" file="common/save_card_convenience.png" /> - <structure type="chrome_scaled_image" name="IDR_SAVE_CARD_CONVENIENCE_DARK" file="common/save_card_convenience_dark.png" /> <structure type="chrome_scaled_image" name="IDR_SAVE_CARD_DARK" file="common/save_card_dark.png" /> - <structure type="chrome_scaled_image" name="IDR_SAVE_CARD_EDUCATION" file="common/save_card_education.png" /> - <structure type="chrome_scaled_image" name="IDR_SAVE_CARD_EDUCATION_DARK" file="common/save_card_education_dark.png" /> <structure type="chrome_scaled_image" name="IDR_SAVE_CARD_SECURITY" file="common/save_card_security.png" /> <structure type="chrome_scaled_image" name="IDR_SAVE_CARD_SECURITY_DARK" file="common/save_card_security_dark.png" /> <structure type="chrome_scaled_image" name="IDR_SAVE_CVC" file="common/save_cvc.png" />
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 8f060985..483dd09 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -3138,6 +3138,7 @@ "signin/identity_services_provider_android.cc", "signin/signin_manager_android_factory.cc", "signin/signin_manager_android_factory.h", + "ssl/android/https_first_mode_bridge.cc", "ssl/chrome_security_state_client.cc", "ssl/chrome_security_state_client.h", "ssl/chrome_security_state_model_delegate.cc", @@ -3295,6 +3296,7 @@ "//chrome/browser/safety_hub/android", "//chrome/browser/search_resumption:jni_headers", "//chrome/browser/signin/services/android:jni_headers", + "//chrome/browser/ssl/android:jni_headers", "//chrome/browser/supervised_user:supervised_user_service_platform_delegate_jni_headers", "//chrome/browser/supervised_user:website_parent_approval_jni_headers", "//chrome/browser/sync/android:jni_headers",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index a3fd033..fec2237b 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -3933,21 +3933,6 @@ nullptr}}; #endif -const FeatureEntry::FeatureParam kAutofillUpstreamUpdatedUi_Security[] = { - {"autofill_upstream_updated_ui_treatment", "1"}}; -const FeatureEntry::FeatureParam kAutofillUpstreamUpdatedUi_Convenience[] = { - {"autofill_upstream_updated_ui_treatment", "2"}}; -const FeatureEntry::FeatureParam kAutofillUpstreamUpdatedUi_Education[] = { - {"autofill_upstream_updated_ui_treatment", "3"}}; - -const FeatureEntry::FeatureVariation kAutofillUpstreamUpdatedUiOptions[] = { - {"Security focus", kAutofillUpstreamUpdatedUi_Security, - std::size(kAutofillUpstreamUpdatedUi_Security), nullptr}, - {"Convenience focus", kAutofillUpstreamUpdatedUi_Convenience, - std::size(kAutofillUpstreamUpdatedUi_Convenience), nullptr}, - {"Education focus", kAutofillUpstreamUpdatedUi_Education, - std::size(kAutofillUpstreamUpdatedUi_Education), nullptr}}; - const FeatureEntry::FeatureParam kDeferRendererTasksAfterInputMinimalTypesPolicyParam[] = { {blink::features::kDeferRendererTasksAfterInputPolicyParamName, @@ -10908,6 +10893,11 @@ flag_descriptions::kEnableCertManagementV2UIWriteDescription, kOsLinux | kOsMac | kOsWin | kOsCrOS, FEATURE_VALUE_TYPE(features::kEnableCertManagementUIV2Write)}, + {"cert-management-v2-ui-edit-certs", + flag_descriptions::kEnableCertManagementV2UIEditCertsName, + flag_descriptions::kEnableCertManagementV2UIEditCertsDescription, + kOsLinux | kOsMac | kOsWin | kOsCrOS, + FEATURE_VALUE_TYPE(features::kEnableCertManagementUIV2EditCerts)}, #endif // BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI) #if BUILDFLAG(IS_ANDROID) @@ -11068,14 +11058,6 @@ flag_descriptions::kStorageAccessHeadersDescription, kOsAll, FEATURE_VALUE_TYPE(network::features::kStorageAccessHeaders)}, - {"autofill-upstream-updated-ui", - flag_descriptions::kAutofillUpstreamUpdatedUiName, - flag_descriptions::kAutofillUpstreamUpdatedUiDescription, kOsDesktop, - FEATURE_WITH_PARAMS_VALUE_TYPE( - autofill::features::kAutofillUpstreamUpdatedUi, - kAutofillUpstreamUpdatedUiOptions, - "AutofillUpstreamUpdatedUi")}, - {"canvas-2d-hibernation", flag_descriptions::kCanvasHibernationName, flag_descriptions::kCanvasHibernationDescription, kOsAll, FEATURE_VALUE_TYPE(blink::features::kCanvas2DHibernation)}, @@ -11832,6 +11814,14 @@ FEATURE_VALUE_TYPE(features::kSafetyHubServicesOnStartUp)}, #endif // !BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS) + {"enable-chrome-refresh-token-binding", + flag_descriptions::kEnableChromeRefreshTokenBindingName, + flag_descriptions::kEnableChromeRefreshTokenBindingDescription, + kOsMac | kOsWin | kOsLinux, + FEATURE_VALUE_TYPE(switches::kEnableChromeRefreshTokenBinding)}, +#endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS) + // NOTE: Adding a new flag requires adding a corresponding entry to enum // "LoginCustomFlags" in tools/metrics/histograms/enums.xml. See "Flag // Histograms" in tools/metrics/histograms/README.md (run the
diff --git a/chrome/browser/ai/ai_create_on_device_session_task.cc b/chrome/browser/ai/ai_create_on_device_session_task.cc index d4f86d74..96f9d05 100644 --- a/chrome/browser/ai/ai_create_on_device_session_task.cc +++ b/chrome/browser/ai/ai_create_on_device_session_task.cc
@@ -65,7 +65,8 @@ Finish(std::move(session)); return; } - optimization_guide::OnDeviceModelEligibilityReason reason; + optimization_guide::OnDeviceModelEligibilityReason reason = + optimization_guide::OnDeviceModelEligibilityReason::kUnknown; bool can_create = service->CanCreateOnDeviceSession(feature_, &reason); CHECK(!can_create); if (!kWaitableReasons.contains(reason)) {
diff --git a/chrome/browser/ai/ai_data_keyed_service.cc b/chrome/browser/ai/ai_data_keyed_service.cc index a7d0713..edb34e67 100644 --- a/chrome/browser/ai/ai_data_keyed_service.cc +++ b/chrome/browser/ai/ai_data_keyed_service.cc
@@ -66,7 +66,8 @@ void OnGotAIPageContentForModelPrototyping( AiDataKeyedService::AiDataCallback continue_callback, - std::optional<optimization_guide::proto::AnnotatedPageContent> proto) { + std::optional<optimization_guide::proto::features::AnnotatedPageContent> + proto) { TRACE_EVENT("browser", "OnGotAIPageContentForModelPrototyping"); AiDataKeyedService::BrowserData data; @@ -348,12 +349,14 @@ std::move(continue_callback).Run(std::move(data)); return; } - if (std::optional<optimization_guide::proto::FormsPredictionsRequest> + if (std::optional< + optimization_guide::proto::features::FormsPredictionsRequest> request = client->GetModelExecutor()->GetLatestRequest(); request) { *data->mutable_forms_predictions_request() = *request; } - if (std::optional<optimization_guide::proto::FormsPredictionsResponse> + if (std::optional< + optimization_guide::proto::features::FormsPredictionsResponse> response = client->GetModelExecutor()->GetLatestResponse(); response) { *data->mutable_forms_predictions_response() = *response;
diff --git a/chrome/browser/ai/ai_data_keyed_service.h b/chrome/browser/ai/ai_data_keyed_service.h index b741330f..3a58fd3 100644 --- a/chrome/browser/ai/ai_data_keyed_service.h +++ b/chrome/browser/ai/ai_data_keyed_service.h
@@ -23,7 +23,8 @@ class AiDataKeyedService : public KeyedService { public: // Data related to AiData collection. - using BrowserData = optimization_guide::proto::BrowserCollectedInformation; + using BrowserData = + optimization_guide::proto::features::BrowserCollectedInformation; using AiData = std::optional<BrowserData>; using AiDataCallback = base::OnceCallback<void(AiData)>;
diff --git a/chrome/browser/ai/ai_data_keyed_service_browsertest.cc b/chrome/browser/ai/ai_data_keyed_service_browsertest.cc index 6e34aac9..a1857cf 100644 --- a/chrome/browser/ai/ai_data_keyed_service_browsertest.cc +++ b/chrome/browser/ai/ai_data_keyed_service_browsertest.cc
@@ -51,16 +51,18 @@ (autofill::FormData form_data, (base::flat_map<autofill::FieldGlobalId, bool> field_eligibility_map), (base::flat_map<autofill::FieldGlobalId, bool> sensitivity_map), - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, PredictionsReceivedCallback callback), (override)); MOCK_METHOD( - const std::optional<optimization_guide::proto::FormsPredictionsRequest>&, + const std::optional< + optimization_guide::proto::features::FormsPredictionsRequest>&, GetLatestRequest, (), (const override)); MOCK_METHOD( - const std::optional<optimization_guide::proto::FormsPredictionsResponse>&, + const std::optional< + optimization_guide::proto::features::FormsPredictionsResponse>&, GetLatestResponse, (), (const override)); @@ -257,7 +259,7 @@ const auto& content_attributes = page_content.root_node().content_attributes(); EXPECT_EQ(content_attributes.attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_ROOT); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_ROOT); } #if !BUILDFLAG(IS_ANDROID) class AiDataKeyedServiceBrowserTestWithFormsPredictions @@ -278,17 +280,17 @@ autofill::prefs::kAutofillPredictionImprovementsEnabled, true); // Set up test data. - auto request = - std::make_optional<optimization_guide::proto::FormsPredictionsRequest>(); - optimization_guide::proto::UserAnnotationsEntry* entry = + auto request = std::make_optional< + optimization_guide::proto::features::FormsPredictionsRequest>(); + optimization_guide::proto::features::UserAnnotationsEntry* entry = request->add_entries(); entry->set_key("test_key"); entry->set_value("test_value"); - auto response = - std::make_optional<optimization_guide::proto::FormsPredictionsResponse>(); - optimization_guide::proto::FilledFormData* filled_form_data = + auto response = std::make_optional< + optimization_guide::proto::features::FormsPredictionsResponse>(); + optimization_guide::proto::features::FilledFormData* filled_form_data = response->mutable_form_data(); - optimization_guide::proto::FilledFormFieldData* filled_field = + optimization_guide::proto::features::FilledFormFieldData* filled_field = filled_form_data->add_filled_form_field_data(); filled_field->set_normalized_label("test_label");
diff --git a/chrome/browser/ai/ai_rewriter.cc b/chrome/browser/ai/ai_rewriter.cc index 5feded53..59e3a61a 100644 --- a/chrome/browser/ai/ai_rewriter.cc +++ b/chrome/browser/ai/ai_rewriter.cc
@@ -39,7 +39,7 @@ const std::optional<std::string>& context, mojo::PendingRemote<blink::mojom::ModelStreamingResponder> pending_responder) { - optimization_guide::proto::ComposePageMetadata page_metadata; + optimization_guide::proto::features::ComposePageMetadata page_metadata; std::string context_string = base::JoinString( {options_->shared_context.value_or(""), context.value_or("")}, "\n"); base::TrimString(context_string, "\n", &context_string); @@ -47,26 +47,26 @@ context_string.substr(0, AIUtils::kTrimmedInnerTextMaxChars)); page_metadata.set_page_inner_text(context_string); - optimization_guide::proto::ComposeRequest context_request; + optimization_guide::proto::features::ComposeRequest context_request; *context_request.mutable_page_metadata() = std::move(page_metadata); session_->AddContext(context_request); - optimization_guide::proto::ComposeRequest execute_request; + optimization_guide::proto::features::ComposeRequest execute_request; // TODO(crbug.com/358214322): We don't support the combination of tone and // length. if (options_->tone == blink::mojom::AIRewriterTone::kMoreFormal) { execute_request.mutable_rewrite_params()->set_tone( - optimization_guide::proto::ComposeTone::COMPOSE_FORMAL); + optimization_guide::proto::features::ComposeTone::COMPOSE_FORMAL); } else if (options_->tone == blink::mojom::AIRewriterTone::kMoreCasual) { execute_request.mutable_rewrite_params()->set_tone( - optimization_guide::proto::ComposeTone::COMPOSE_INFORMAL); + optimization_guide::proto::features::ComposeTone::COMPOSE_INFORMAL); } else if (options_->length == blink::mojom::AIRewriterLength::kLonger) { execute_request.mutable_rewrite_params()->set_length( - optimization_guide::proto::ComposeLength::COMPOSE_LONGER); + optimization_guide::proto::features::ComposeLength::COMPOSE_LONGER); } else if (options_->length == blink::mojom::AIRewriterLength::kShorter) { execute_request.mutable_rewrite_params()->set_length( - optimization_guide::proto::ComposeLength::COMPOSE_SHORTER); + optimization_guide::proto::features::ComposeLength::COMPOSE_SHORTER); } else { execute_request.mutable_rewrite_params()->set_regenerate(true); } @@ -94,7 +94,8 @@ } auto compose_response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::ComposeResponse>(result.response->response); + optimization_guide::proto::features::ComposeResponse>( + result.response->response); if (compose_response) { responder->OnStreaming(compose_response->output()); }
diff --git a/chrome/browser/ai/ai_rewriter_unittest.cc b/chrome/browser/ai/ai_rewriter_unittest.cc index 16b4c74..9252f7c 100644 --- a/chrome/browser/ai/ai_rewriter_unittest.cc +++ b/chrome/browser/ai/ai_rewriter_unittest.cc
@@ -53,7 +53,7 @@ optimization_guide::OptimizationGuideModelStreamingExecutionResult CreateExecutionResult(std::string_view output, bool is_complete) { - optimization_guide::proto::ComposeResponse response; + optimization_guide::proto::features::ComposeResponse response; *response.mutable_output() = output; return optimization_guide::OptimizationGuideModelStreamingExecutionResult( optimization_guide::StreamingResponse{ @@ -74,8 +74,8 @@ void CheckComposeRequestContext( const google::protobuf::MessageLite& request_metadata, const std::string& expected_context_string) { - const optimization_guide::proto::ComposeRequest* request = - static_cast<const optimization_guide::proto::ComposeRequest*>( + const optimization_guide::proto::features::ComposeRequest* request = + static_cast<const optimization_guide::proto::features::ComposeRequest*>( &request_metadata); EXPECT_THAT(request->page_metadata().page_inner_text(), expected_context_string); @@ -86,34 +86,34 @@ void CheckComposeRequestRewriteParamsPreviousResponse( const google::protobuf::MessageLite& request_metadata, const std::string& previous_response) { - const optimization_guide::proto::ComposeRequest* request = - static_cast<const optimization_guide::proto::ComposeRequest*>( + const optimization_guide::proto::features::ComposeRequest* request = + static_cast<const optimization_guide::proto::features::ComposeRequest*>( &request_metadata); EXPECT_THAT(request->rewrite_params().previous_response(), previous_response); } void CheckComposeRequestRewriteParamsTone( const google::protobuf::MessageLite& request_metadata, - optimization_guide::proto::ComposeTone tone) { - const optimization_guide::proto::ComposeRequest* request = - static_cast<const optimization_guide::proto::ComposeRequest*>( + optimization_guide::proto::features::ComposeTone tone) { + const optimization_guide::proto::features::ComposeRequest* request = + static_cast<const optimization_guide::proto::features::ComposeRequest*>( &request_metadata); EXPECT_EQ(request->rewrite_params().tone(), tone); } void CheckComposeRequestRewriteParamsLength( const google::protobuf::MessageLite& request_metadata, - optimization_guide::proto::ComposeLength length) { - const optimization_guide::proto::ComposeRequest* request = - static_cast<const optimization_guide::proto::ComposeRequest*>( + optimization_guide::proto::features::ComposeLength length) { + const optimization_guide::proto::features::ComposeRequest* request = + static_cast<const optimization_guide::proto::features::ComposeRequest*>( &request_metadata); EXPECT_EQ(request->rewrite_params().length(), length); } void CheckComposeRequestRewriteParamsRegenerateFlag( const google::protobuf::MessageLite& request_metadata) { - const optimization_guide::proto::ComposeRequest* request = - static_cast<const optimization_guide::proto::ComposeRequest*>( + const optimization_guide::proto::features::ComposeRequest* request = + static_cast<const optimization_guide::proto::features::ComposeRequest*>( &request_metadata); EXPECT_TRUE(request->rewrite_params().regenerate()); } @@ -447,12 +447,12 @@ blink::mojom::AIRewriterTone::kMoreCasual, blink::mojom::AIRewriterFormat::kAsIs, blink::mojom::AIRewriterLength::kAsIs, - base::BindLambdaForTesting( - [&](const google::protobuf::MessageLite& request_metadata) { - CheckComposeRequestRewriteParamsTone( - request_metadata, - optimization_guide::proto::ComposeTone::COMPOSE_INFORMAL); - })); + base::BindLambdaForTesting([&](const google::protobuf::MessageLite& + request_metadata) { + CheckComposeRequestRewriteParamsTone( + request_metadata, + optimization_guide::proto::features::ComposeTone::COMPOSE_INFORMAL); + })); } TEST_F(AIRewriterTest, RewriteMoreFormal) { @@ -460,12 +460,12 @@ blink::mojom::AIRewriterTone::kMoreFormal, blink::mojom::AIRewriterFormat::kAsIs, blink::mojom::AIRewriterLength::kAsIs, - base::BindLambdaForTesting( - [&](const google::protobuf::MessageLite& request_metadata) { - CheckComposeRequestRewriteParamsTone( - request_metadata, - optimization_guide::proto::ComposeTone::COMPOSE_FORMAL); - })); + base::BindLambdaForTesting([&](const google::protobuf::MessageLite& + request_metadata) { + CheckComposeRequestRewriteParamsTone( + request_metadata, + optimization_guide::proto::features::ComposeTone::COMPOSE_FORMAL); + })); } TEST_F(AIRewriterTest, RewriteLonger) { @@ -473,12 +473,12 @@ blink::mojom::AIRewriterTone::kAsIs, blink::mojom::AIRewriterFormat::kAsIs, blink::mojom::AIRewriterLength::kLonger, - base::BindLambdaForTesting( - [&](const google::protobuf::MessageLite& request_metadata) { - CheckComposeRequestRewriteParamsLength( - request_metadata, - optimization_guide::proto::ComposeLength::COMPOSE_LONGER); - })); + base::BindLambdaForTesting([&](const google::protobuf::MessageLite& + request_metadata) { + CheckComposeRequestRewriteParamsLength( + request_metadata, + optimization_guide::proto::features::ComposeLength::COMPOSE_LONGER); + })); } TEST_F(AIRewriterTest, RewriteShorter) { @@ -489,8 +489,8 @@ base::BindLambdaForTesting( [&](const google::protobuf::MessageLite& request_metadata) { CheckComposeRequestRewriteParamsLength( - request_metadata, - optimization_guide::proto::ComposeLength::COMPOSE_SHORTER); + request_metadata, optimization_guide::proto::features:: + ComposeLength::COMPOSE_SHORTER); })); }
diff --git a/chrome/browser/ai/ai_writer.cc b/chrome/browser/ai/ai_writer.cc index 936bae65..9326a6e 100644 --- a/chrome/browser/ai/ai_writer.cc +++ b/chrome/browser/ai/ai_writer.cc
@@ -38,7 +38,7 @@ const std::optional<std::string>& context, mojo::PendingRemote<blink::mojom::ModelStreamingResponder> pending_responder) { - optimization_guide::proto::ComposePageMetadata page_metadata; + optimization_guide::proto::features::ComposePageMetadata page_metadata; std::string context_string = base::JoinString( {options_->shared_context.value_or(""), context.value_or("")}, "\n"); base::TrimString(context_string, "\n", &context_string); @@ -46,12 +46,12 @@ context_string.substr(0, AIUtils::kTrimmedInnerTextMaxChars)); page_metadata.set_page_inner_text(context_string); - optimization_guide::proto::ComposeRequest context_request; + optimization_guide::proto::features::ComposeRequest context_request; *context_request.mutable_page_metadata() = std::move(page_metadata); session_->AddContext(context_request); - optimization_guide::proto::ComposeRequest execute_request; + optimization_guide::proto::features::ComposeRequest execute_request; execute_request.mutable_generate_params()->set_user_input(input); session_->ExecuteModel( @@ -76,7 +76,8 @@ } auto compose_response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::ComposeResponse>(result.response->response); + optimization_guide::proto::features::ComposeResponse>( + result.response->response); if (compose_response) { responder->OnStreaming(compose_response->output()); }
diff --git a/chrome/browser/ai/ai_writer_unittest.cc b/chrome/browser/ai/ai_writer_unittest.cc index 538db94..e32c6378 100644 --- a/chrome/browser/ai/ai_writer_unittest.cc +++ b/chrome/browser/ai/ai_writer_unittest.cc
@@ -53,7 +53,7 @@ optimization_guide::OptimizationGuideModelStreamingExecutionResult CreateExecutionResult(std::string_view output, bool is_complete) { - optimization_guide::proto::ComposeResponse response; + optimization_guide::proto::features::ComposeResponse response; *response.mutable_output() = output; return optimization_guide::OptimizationGuideModelStreamingExecutionResult( optimization_guide::StreamingResponse{ @@ -74,8 +74,8 @@ void CheckComposeRequestContext( const google::protobuf::MessageLite& request_metadata, const std::string& expected_context_string) { - const optimization_guide::proto::ComposeRequest* request = - static_cast<const optimization_guide::proto::ComposeRequest*>( + const optimization_guide::proto::features::ComposeRequest* request = + static_cast<const optimization_guide::proto::features::ComposeRequest*>( &request_metadata); EXPECT_THAT(request->page_metadata().page_inner_text(), expected_context_string); @@ -86,8 +86,8 @@ void CheckComposeRequestUserInput( const google::protobuf::MessageLite& request_metadata, const std::string& expected_user_input) { - const optimization_guide::proto::ComposeRequest* request = - static_cast<const optimization_guide::proto::ComposeRequest*>( + const optimization_guide::proto::features::ComposeRequest* request = + static_cast<const optimization_guide::proto::features::ComposeRequest*>( &request_metadata); EXPECT_THAT(request->generate_params().user_input(), expected_user_input); }
diff --git a/chrome/browser/android/contextualsearch/contextual_search_manager.cc b/chrome/browser/android/contextualsearch/contextual_search_manager.cc index 9e492c69..53025c2 100644 --- a/chrome/browser/android/contextualsearch/contextual_search_manager.cc +++ b/chrome/browser/android/contextualsearch/contextual_search_manager.cc
@@ -108,7 +108,7 @@ void ContextualSearchManager::RemoveLastHistoryEntry( JNIEnv* env, const JavaParamRef<jobject>& obj, - const JavaParamRef<jstring>& search_url, + std::string& search_url, jlong search_start_time_ms) { // The deletion window is from the time a search URL was put in history, up // to a short amount of time later. @@ -124,8 +124,7 @@ // because search results that are not promoted to a Tab do not make it to // the web history, only local. std::set<GURL> restrict_set; - restrict_set.insert( - GURL(base::android::ConvertJavaStringToUTF8(env, search_url))); + restrict_set.insert(GURL(search_url)); service->ExpireHistoryBetween( restrict_set, history::kNoAppIdFilter, begin_time, end_time, /*user_initiated*/ false, base::DoNothing(), &history_task_tracker_); @@ -136,47 +135,20 @@ const ResolvedSearchTerm& resolved_search_term) { // Notify the Java UX of the result. JNIEnv* env = base::android::AttachCurrentThread(); - base::android::ScopedJavaLocalRef<jstring> j_search_term = - base::android::ConvertUTF8ToJavaString(env, - resolved_search_term.search_term); - base::android::ScopedJavaLocalRef<jstring> j_display_text = - base::android::ConvertUTF8ToJavaString(env, - resolved_search_term.display_text); - base::android::ScopedJavaLocalRef<jstring> j_alternate_term = - base::android::ConvertUTF8ToJavaString( - env, resolved_search_term.alternate_term); - base::android::ScopedJavaLocalRef<jstring> j_mid = - base::android::ConvertUTF8ToJavaString(env, resolved_search_term.mid); - base::android::ScopedJavaLocalRef<jstring> j_context_language = - base::android::ConvertUTF8ToJavaString( - env, resolved_search_term.context_language); - base::android::ScopedJavaLocalRef<jstring> j_thumbnail_url = - base::android::ConvertUTF8ToJavaString( - env, resolved_search_term.thumbnail_url); - base::android::ScopedJavaLocalRef<jstring> j_caption = - base::android::ConvertUTF8ToJavaString(env, resolved_search_term.caption); - base::android::ScopedJavaLocalRef<jstring> j_quick_action_uri = - base::android::ConvertUTF8ToJavaString( - env, resolved_search_term.quick_action_uri); - base::android::ScopedJavaLocalRef<jstring> j_search_url_full = - base::android::ConvertUTF8ToJavaString( - env, resolved_search_term.search_url_full); - base::android::ScopedJavaLocalRef<jstring> j_search_url_preload = - base::android::ConvertUTF8ToJavaString( - env, resolved_search_term.search_url_preload); - base::android::ScopedJavaLocalRef<jstring> j_related_searches_json = - base::android::ConvertUTF8ToJavaString( - env, resolved_search_term.related_searches_json); Java_ContextualSearchManager_onSearchTermResolutionResponse( env, java_manager_, resolved_search_term.is_invalid, - resolved_search_term.response_code, j_search_term, j_display_text, - j_alternate_term, j_mid, resolved_search_term.prevent_preload, + resolved_search_term.response_code, resolved_search_term.search_term, + resolved_search_term.display_text, resolved_search_term.alternate_term, + resolved_search_term.mid, resolved_search_term.prevent_preload, resolved_search_term.selection_start_adjust, - resolved_search_term.selection_end_adjust, j_context_language, - j_thumbnail_url, j_caption, j_quick_action_uri, - resolved_search_term.quick_action_category, j_search_url_full, - j_search_url_preload, resolved_search_term.coca_card_tag, - j_related_searches_json); + resolved_search_term.selection_end_adjust, + resolved_search_term.context_language, resolved_search_term.thumbnail_url, + resolved_search_term.caption, resolved_search_term.quick_action_uri, + resolved_search_term.quick_action_category, + resolved_search_term.search_url_full, + resolved_search_term.search_url_preload, + resolved_search_term.coca_card_tag, + resolved_search_term.related_searches_json); } void ContextualSearchManager::OnTextSurroundingSelectionAvailable( @@ -185,13 +157,8 @@ size_t start_offset, size_t end_offset) { JNIEnv* env = base::android::AttachCurrentThread(); - base::android::ScopedJavaLocalRef<jstring> j_encoding = - base::android::ConvertUTF8ToJavaString(env, encoding.c_str()); - base::android::ScopedJavaLocalRef<jstring> j_surrounding_text = - base::android::ConvertUTF16ToJavaString(env, surrounding_text.c_str()); Java_ContextualSearchManager_onTextSurroundingSelectionAvailable( - env, java_manager_, j_encoding, j_surrounding_text, start_offset, - end_offset); + env, java_manager_, encoding, surrounding_text, start_offset, end_offset); } jlong JNI_ContextualSearchManager_Init(JNIEnv* env,
diff --git a/chrome/browser/android/contextualsearch/contextual_search_manager.h b/chrome/browser/android/contextualsearch/contextual_search_manager.h index a38149d1..cc3159c 100644 --- a/chrome/browser/android/contextualsearch/contextual_search_manager.h +++ b/chrome/browser/android/contextualsearch/contextual_search_manager.h
@@ -55,11 +55,10 @@ // Removes a search URL from history. |search_start_time_ms| represents the // time at which |search_url| was committed. - void RemoveLastHistoryEntry( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj, - const base::android::JavaParamRef<jstring>& search_url, - jlong search_start_time_ms); + void RemoveLastHistoryEntry(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, + std::string& search_url, + jlong search_start_time_ms); private: void OnSearchTermResolutionResponse(
diff --git a/chrome/browser/android/contextualsearch/native_contextual_search_context.cc b/chrome/browser/android/contextualsearch/native_contextual_search_context.cc index b02befd6..004d813 100644 --- a/chrome/browser/android/contextualsearch/native_contextual_search_context.cc +++ b/chrome/browser/android/contextualsearch/native_contextual_search_context.cc
@@ -45,10 +45,8 @@ void NativeContextualSearchContext::SetResolveProperties( JNIEnv* env, jobject obj, - const base::android::JavaParamRef<jstring>& j_home_country, + std::string& home_country, jboolean j_may_send_base_page_url) { - std::string home_country = - base::android::ConvertJavaStringToUTF8(env, j_home_country); ContextualSearchContext::SetResolveProperties(home_country, j_may_send_base_page_url); } @@ -64,35 +62,24 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>& obj, jboolean j_is_exact_resolve, - const base::android::JavaParamRef<jstring>& j_related_searches_stamp) { - std::string related_searches_stamp = - base::android::ConvertJavaStringToUTF8(env, j_related_searches_stamp); + std::string& related_searches_stamp) { ContextualSearchContext::PrepareToResolve(j_is_exact_resolve, related_searches_stamp); } -base::android::ScopedJavaLocalRef<jstring> -NativeContextualSearchContext::DetectLanguage( +std::string NativeContextualSearchContext::DetectLanguage( JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) const { std::string language = ContextualSearchContext::DetectLanguage(); - base::android::ScopedJavaLocalRef<jstring> j_language = - base::android::ConvertUTF8ToJavaString(env, language); - return j_language; + return language; } void NativeContextualSearchContext::SetTranslationLanguages( JNIEnv* env, const base::android::JavaParamRef<jobject>& obj, - const base::android::JavaParamRef<jstring>& j_detected_language, - const base::android::JavaParamRef<jstring>& j_target_language, - const base::android::JavaParamRef<jstring>& j_fluent_languages) { - std::string detected_language = - base::android::ConvertJavaStringToUTF8(env, j_detected_language); - std::string target_language = - base::android::ConvertJavaStringToUTF8(env, j_target_language); - std::string fluent_languages = - base::android::ConvertJavaStringToUTF8(env, j_fluent_languages); + std::string& detected_language, + std::string& target_language, + std::string& fluent_languages) { ContextualSearchContext::SetTranslationLanguages( detected_language, target_language, fluent_languages); }
diff --git a/chrome/browser/android/contextualsearch/native_contextual_search_context.h b/chrome/browser/android/contextualsearch/native_contextual_search_context.h index 31222e9..598dc7a 100644 --- a/chrome/browser/android/contextualsearch/native_contextual_search_context.h +++ b/chrome/browser/android/contextualsearch/native_contextual_search_context.h
@@ -35,11 +35,10 @@ const base::android::JavaRef<jobject>& j_contextual_search_context); // Sets the properties needed to resolve a context. - void SetResolveProperties( - JNIEnv* env, - jobject obj, - const base::android::JavaParamRef<jstring>& j_home_country, - jboolean j_may_send_base_page_url); + void SetResolveProperties(JNIEnv* env, + jobject obj, + std::string& home_country, + jboolean j_may_send_base_page_url); // Adjust the current selection offsets by the given signed amounts. void AdjustSelection(JNIEnv* env, @@ -54,25 +53,23 @@ // |j_related_searches_stamp| is a value to stamp onto search URLs to // identify related searches. If the string is empty then Related Searches // are not being requested. - void PrepareToResolve( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj, - jboolean j_is_exact_resolve, - const base::android::JavaParamRef<jstring>& j_related_searches_stamp); + void PrepareToResolve(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, + jboolean j_is_exact_resolve, + std::string& related_searches_stamp); // Detects the language of the context using CLD from the translate utility. - base::android::ScopedJavaLocalRef<jstring> DetectLanguage( + std::string DetectLanguage( JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) const; // Sets the languages to remember for use in translation. // See |GetTranslationLanguages|. - void SetTranslationLanguages( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj, - const base::android::JavaParamRef<jstring>& j_detected_language, - const base::android::JavaParamRef<jstring>& j_target_language, - const base::android::JavaParamRef<jstring>& j_fluent_languages); + void SetTranslationLanguages(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj, + std::string& detected_language, + std::string& target_language, + std::string& fluent_languages); private: // The linked Java object.
diff --git a/chrome/browser/ash/accessibility/live_caption/system_live_caption_service.h b/chrome/browser/ash/accessibility/live_caption/system_live_caption_service.h index 3817911..848aa4d 100644 --- a/chrome/browser/ash/accessibility/live_caption/system_live_caption_service.h +++ b/chrome/browser/ash/accessibility/live_caption/system_live_caption_service.h
@@ -156,10 +156,6 @@ // The number of characters sent to the translation service. int characters_translated_ = 0; - // The number of characters omitted from the translation by the text - // stabilization policy. Used by metrics only. - int translation_characters_erased_ = 0; - // If set during a test this number will be used to determine the // number of non chrome output streams. std::optional<uint32_t> num_output_streams_for_testing_;
diff --git a/chrome/browser/ash/app_list/arc/arc_pai_starter.h b/chrome/browser/ash/app_list/arc/arc_pai_starter.h index aa96691b..7039139a 100644 --- a/chrome/browser/ash/app_list/arc/arc_pai_starter.h +++ b/chrome/browser/ash/app_list/arc/arc_pai_starter.h
@@ -68,9 +68,6 @@ const raw_ptr<Profile> profile_; const raw_ptr<PrefService> pref_service_; std::vector<base::OnceClosure> onstart_callbacks_; - // Set to true in case external component (Assistant) wants to lock PAI for - // awhile. - bool locked_ = false; // Set to true once PAI request was successfully processed. bool started_ = false; // Indicates that PAI request is pending.
diff --git a/chrome/browser/ash/crosapi/BUILD.gn b/chrome/browser/ash/crosapi/BUILD.gn index d29a6aa..a28b88a 100644 --- a/chrome/browser/ash/crosapi/BUILD.gn +++ b/chrome/browser/ash/crosapi/BUILD.gn
@@ -152,8 +152,6 @@ "media_app_ash.h", "media_ui_ash.cc", "media_ui_ash.h", - "metrics_ash.cc", - "metrics_ash.h", "multi_capture_service_ash.cc", "multi_capture_service_ash.h", "native_theme_service_ash.cc",
diff --git a/chrome/browser/ash/crosapi/crosapi_ash.cc b/chrome/browser/ash/crosapi/crosapi_ash.cc index b85ae17..0586c8c 100644 --- a/chrome/browser/ash/crosapi/crosapi_ash.cc +++ b/chrome/browser/ash/crosapi/crosapi_ash.cc
@@ -67,7 +67,6 @@ #include "chrome/browser/ash/crosapi/login_state_ash.h" #include "chrome/browser/ash/crosapi/media_app_ash.h" #include "chrome/browser/ash/crosapi/media_ui_ash.h" -#include "chrome/browser/ash/crosapi/metrics_ash.h" #include "chrome/browser/ash/crosapi/multi_capture_service_ash.h" #include "chrome/browser/ash/crosapi/native_theme_service_ash.h" #include "chrome/browser/ash/crosapi/networking_attributes_ash.h" @@ -245,7 +244,6 @@ std::make_unique<ash::MagicBoostControllerAsh>()), media_app_ash_(std::make_unique<MediaAppAsh>()), media_ui_ash_(std::make_unique<MediaUIAsh>()), - metrics_ash_(std::make_unique<MetricsAsh>()), multi_capture_service_ash_(std::make_unique<MultiCaptureServiceAsh>()), native_theme_service_ash_(std::make_unique<NativeThemeServiceAsh>()), networking_attributes_ash_(std::make_unique<NetworkingAttributesAsh>()), @@ -676,10 +674,6 @@ std::move(receiver)); } -void CrosapiAsh::BindMetrics(mojo::PendingReceiver<mojom::Metrics> receiver) { - metrics_ash_->BindReceiver(std::move(receiver)); -} - void CrosapiAsh::BindMultiCaptureService( mojo::PendingReceiver<mojom::MultiCaptureService> receiver) { multi_capture_service_ash_->BindReceiver(std::move(receiver));
diff --git a/chrome/browser/ash/crosapi/crosapi_ash.h b/chrome/browser/ash/crosapi/crosapi_ash.h index 9d1666d..e54b2b5 100644 --- a/chrome/browser/ash/crosapi/crosapi_ash.h +++ b/chrome/browser/ash/crosapi/crosapi_ash.h
@@ -102,7 +102,6 @@ class LoginStateAsh; class MediaAppAsh; class MediaUIAsh; -class MetricsAsh; class MultiCaptureServiceAsh; class NativeThemeServiceAsh; class NetworkingAttributesAsh; @@ -288,7 +287,6 @@ void BindMediaSessionController( mojo::PendingReceiver<media_session::mojom::MediaControllerManager> receiver) override; - void BindMetrics(mojo::PendingReceiver<mojom::Metrics> receiver) override; void BindMultiCaptureService( mojo::PendingReceiver<mojom::MultiCaptureService> receiver) override; void BindNativeThemeService( @@ -641,7 +639,6 @@ std::unique_ptr<ash::MagicBoostControllerAsh> magic_boost_controller_ash_; std::unique_ptr<MediaAppAsh> media_app_ash_; std::unique_ptr<MediaUIAsh> media_ui_ash_; - std::unique_ptr<MetricsAsh> metrics_ash_; std::unique_ptr<MultiCaptureServiceAsh> multi_capture_service_ash_; std::unique_ptr<NativeThemeServiceAsh> native_theme_service_ash_; std::unique_ptr<NetworkingAttributesAsh> networking_attributes_ash_;
diff --git a/chrome/browser/ash/crosapi/crosapi_util.cc b/chrome/browser/ash/crosapi/crosapi_util.cc index 8e71ec7..4cd7ed5 100644 --- a/chrome/browser/ash/crosapi/crosapi_util.cc +++ b/chrome/browser/ash/crosapi/crosapi_util.cc
@@ -117,7 +117,6 @@ #include "chromeos/crosapi/mojom/mahi.mojom.h" #include "chromeos/crosapi/mojom/media_app.mojom.h" #include "chromeos/crosapi/mojom/media_ui.mojom.h" -#include "chromeos/crosapi/mojom/metrics.mojom.h" #include "chromeos/crosapi/mojom/multi_capture_service.mojom.h" #include "chromeos/crosapi/mojom/network_change.mojom.h" #include "chromeos/crosapi/mojom/networking_attributes.mojom.h" @@ -363,7 +362,6 @@ MakeInterfaceVersionEntry<crosapi::mojom::MahiBrowserDelegate>(), MakeInterfaceVersionEntry<crosapi::mojom::MediaApp>(), MakeInterfaceVersionEntry<crosapi::mojom::MediaUI>(), - MakeInterfaceVersionEntry<crosapi::mojom::Metrics>(), MakeInterfaceVersionEntry<crosapi::mojom::MultiCaptureService>(), MakeInterfaceVersionEntry<crosapi::mojom::NativeThemeService>(), MakeInterfaceVersionEntry<crosapi::mojom::NetworkChange>(),
diff --git a/chrome/browser/ash/crosapi/metrics_ash.cc b/chrome/browser/ash/crosapi/metrics_ash.cc deleted file mode 100644 index 96f2f901..0000000 --- a/chrome/browser/ash/crosapi/metrics_ash.cc +++ /dev/null
@@ -1,53 +0,0 @@ -// Copyright 2022 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ash/crosapi/metrics_ash.h" - -#include <string_view> -#include <utility> - -#include "base/functional/bind.h" -#include "chromeos/ash/components/system/statistics_provider.h" - -namespace crosapi { - -MetricsAsh::MetricsAsh() : weak_ptr_factory_(this) {} -MetricsAsh::~MetricsAsh() = default; - -void MetricsAsh::BindReceiver(mojo::PendingReceiver<mojom::Metrics> receiver) { - receivers_.Add(this, std::move(receiver)); -} - -void MetricsAsh::GetFullHardwareClass(GetFullHardwareClassCallback callback) { - if (full_hardware_class_) { - std::move(callback).Run(full_hardware_class_.value()); - return; - } - - callbacks_.push_back(std::move(callback)); - if (callbacks_.size() == 1) { - ash::system::StatisticsProvider::GetInstance() - ->ScheduleOnMachineStatisticsLoaded( - base::BindOnce(&MetricsAsh::OnMachineStatisticsLoaded, - weak_ptr_factory_.GetWeakPtr())); - } -} - -void MetricsAsh::OnMachineStatisticsLoaded() { - const std::optional<std::string_view> full_hardware_class = - ash::system::StatisticsProvider::GetInstance()->GetMachineStatistic( - "hardware_class"); - if (full_hardware_class) { - full_hardware_class_ = std::string(full_hardware_class.value()); - } else { - full_hardware_class_ = ""; - } - std::vector<GetFullHardwareClassCallback> callbacks; - callbacks.swap(callbacks_); - for (auto& callback : callbacks) { - std::move(callback).Run(full_hardware_class_.value()); - } -} - -} // namespace crosapi
diff --git a/chrome/browser/ash/crosapi/metrics_ash.h b/chrome/browser/ash/crosapi/metrics_ash.h deleted file mode 100644 index cf5b718..0000000 --- a/chrome/browser/ash/crosapi/metrics_ash.h +++ /dev/null
@@ -1,50 +0,0 @@ -// Copyright 2022 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_ASH_CROSAPI_METRICS_ASH_H_ -#define CHROME_BROWSER_ASH_CROSAPI_METRICS_ASH_H_ - -#include <optional> -#include <string> - -#include "base/memory/weak_ptr.h" -#include "chromeos/crosapi/mojom/metrics.mojom.h" -#include "mojo/public/cpp/bindings/pending_receiver.h" -#include "mojo/public/cpp/bindings/receiver_set.h" - -namespace crosapi { - -// The ash-chrome implementation of the Metrics crosapi interface. -class MetricsAsh : public mojom::Metrics { - public: - MetricsAsh(); - MetricsAsh(const MetricsAsh&) = delete; - MetricsAsh& operator=(const MetricsAsh&) = delete; - ~MetricsAsh() override; - - void BindReceiver(mojo::PendingReceiver<mojom::Metrics> receiver); - - // crosapi::mojom::Metrics: - void GetFullHardwareClass(GetFullHardwareClassCallback callback) override; - - private: - // Called when machine statistics are loaded. Can be synchronously invoked if - // machine statistics are already loaded. - void OnMachineStatisticsLoaded(); - - // A cached copy of the full hardware class. - std::optional<std::string> full_hardware_class_; - - // Callbacks waiting for full_hardware_class_. - std::vector<GetFullHardwareClassCallback> callbacks_; - - // This class supports any number of connections. - mojo::ReceiverSet<mojom::Metrics> receivers_; - - base::WeakPtrFactory<MetricsAsh> weak_ptr_factory_; -}; - -} // namespace crosapi - -#endif // CHROME_BROWSER_ASH_CROSAPI_METRICS_ASH_H_
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc b/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc index 9a35e5dfa..53731e9 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc +++ b/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc
@@ -25,6 +25,7 @@ #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/test/metrics/histogram_tester.h" +#include "base/test/metrics/user_action_tester.h" #include "base/test/scoped_feature_list.h" #include "base/test/scoped_run_loop_timeout.h" #include "base/test/test_timeouts.h" @@ -321,6 +322,7 @@ protected: test::EnrollmentHelperMixin enrollment_helper_{&mixin_host_}; base::HistogramTester histogram_tester_; + base::UserActionTester user_action_tester_; private: // TODO(agawronska): Maybe create a separate test fixture for offline setup. @@ -1060,6 +1062,54 @@ histogram_tester_.ExpectTotalCount("DemoMode.Setup.Error", 1); } +IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, ClickRetryOnErrorScreen) { + // Simulate online setup failure. + enrollment_helper_.ExpectEnrollmentMode( + policy::EnrollmentConfig::MODE_ATTESTATION); + enrollment_helper_.ExpectAttestationEnrollmentError( + policy::EnrollmentStatus::ForRegistrationError( + policy::DeviceManagementStatus::DM_STATUS_TEMPORARY_UNAVAILABLE)); + SimulateNetworkConnected(); + + TriggerDemoModeOnWelcomeScreen(); + + UseOnlineModeOnNetworkScreen(); + + ProceedThroughDemoPreferencesScreen(); + + // policy::DeviceManagementStatus::DM_STATUS_TEMPORARY_UNAVAILABLE matching to + // DemoSetupController::DemoSetupError::ErrorCode::kTemporaryUnavailable in + // DemoSetupController::CreateFromClientStatus(). + AcceptTermsAndExpectDemoSetupFailure( + DemoSetupController::DemoSetupError::ErrorCode::kTemporaryUnavailable); + + // Default error returned by MockDemoModeOnlineEnrollmentHelperCreator. + ExpectErrorMessage(IDS_DEMO_SETUP_TEMPORARY_ERROR, + IDS_DEMO_SETUP_RECOVERY_RETRY); + + test::OobeJS().ExpectVisiblePath(kDemoSetupErrorDialogRetry); + test::OobeJS().ExpectHiddenPath(kDemoSetupErrorDialogPowerwash); + test::OobeJS().ExpectEnabledPath(kDemoSetupErrorDialogBack); + + EXPECT_FALSE(StartupUtils::IsOobeCompleted()); + EXPECT_FALSE(StartupUtils::IsDeviceRegistered()); + + test::LockDemoDeviceInstallAttributes(); + + // We need to create another mock after showing error dialog. + enrollment_helper_.ResetMock(); + // Simulate successful online setup on retry. + enrollment_helper_.ExpectEnrollmentMode( + policy::EnrollmentConfig::MODE_ATTESTATION); + enrollment_helper_.ExpectAttestationEnrollmentSuccess(); + + EXPECT_EQ(0, user_action_tester_.GetActionCount( + "DemoMode.Setup.RetryButtonClicked")); + test::OobeJS().ClickOnPath(kDemoSetupErrorDialogRetry); + EXPECT_EQ(1, user_action_tester_.GetActionCount( + "DemoMode.Setup.RetryButtonClicked")); +} + IN_PROC_BROWSER_TEST_F(DemoSetupArcSupportedTest, NoOfflineSetupOptionOnNetworkList) { test::WaitForWelcomeScreen();
diff --git a/chrome/browser/ash/login/enrollment/enrollment_launcher.cc b/chrome/browser/ash/login/enrollment/enrollment_launcher.cc index 1b22dba..86e3816 100644 --- a/chrome/browser/ash/login/enrollment/enrollment_launcher.cc +++ b/chrome/browser/ash/login/enrollment/enrollment_launcher.cc
@@ -139,7 +139,6 @@ policy::EnrollmentConfig enrollment_config_; std::string enrolling_user_domain_; - policy::LicenseType license_type_; enum { OAUTH_NOT_STARTED,
diff --git a/chrome/browser/ash/login/users/fake_chrome_user_manager.h b/chrome/browser/ash/login/users/fake_chrome_user_manager.h index bfa67dac3..f7556aa 100644 --- a/chrome/browser/ash/login/users/fake_chrome_user_manager.h +++ b/chrome/browser/ash/login/users/fake_chrome_user_manager.h
@@ -160,9 +160,6 @@ AccountId active_account_id_ = EmptyAccountId(); AccountId last_session_active_account_id_ = EmptyAccountId(); - - // Whether the device is enterprise managed. - bool is_enterprise_managed_ = false; }; } // namespace ash
diff --git a/chrome/browser/ash/mahi/mahi_manager_impl_unittest.cc b/chrome/browser/ash/mahi/mahi_manager_impl_unittest.cc index 9d1c0b7..97fa3b9 100644 --- a/chrome/browser/ash/mahi/mahi_manager_impl_unittest.cc +++ b/chrome/browser/ash/mahi/mahi_manager_impl_unittest.cc
@@ -148,7 +148,7 @@ mahi_manager_impl_ = std::make_unique<MahiManagerImpl>(); mahi_manager_impl_->mahi_provider_ = CreateMahiProvider(); - CreateUserSessions(1); + SimulateUserLogin(kDefaultUserEmail); } void TearDown() override {
diff --git a/chrome/browser/ash/policy/enrollment/auto_enrollment_controller.h b/chrome/browser/ash/policy/enrollment/auto_enrollment_controller.h index f00b991..40e88f15 100644 --- a/chrome/browser/ash/policy/enrollment/auto_enrollment_controller.h +++ b/chrome/browser/ash/policy/enrollment/auto_enrollment_controller.h
@@ -286,7 +286,6 @@ // `AutoEnrollmentClient`. AutoEnrollmentTypeChecker::CheckType auto_enrollment_check_type_ = AutoEnrollmentTypeChecker::CheckType::kNone; - bool auto_enrollment_check_type_init_started_ = false; // Shared factory for outgoing network requests. scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
diff --git a/chrome/browser/ash/policy/skyvault/migration_coordinator.h b/chrome/browser/ash/policy/skyvault/migration_coordinator.h index 5727b15..eec2856 100644 --- a/chrome/browser/ash/policy/skyvault/migration_coordinator.h +++ b/chrome/browser/ash/policy/skyvault/migration_coordinator.h
@@ -177,9 +177,6 @@ base::WeakPtr<ash::cloud_upload::OdfsSkyvaultUploader>> uploaders_; - // Flag to indicate that Run() method should wait. - bool emulate_slow_for_testing_ = false; - base::WeakPtrFactory<OneDriveMigrationUploader> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/autofill_ai/autofill_ai_browsertest.cc b/chrome/browser/autofill_ai/autofill_ai_browsertest.cc index e13046288..79e7a46 100644 --- a/chrome/browser/autofill_ai/autofill_ai_browsertest.cc +++ b/chrome/browser/autofill_ai/autofill_ai_browsertest.cc
@@ -65,8 +65,8 @@ std::string expected_value_for_import_and_automatic_filling; }; -// Matches optimization_guide::proto::UserAnnotationsEntry `arg` against -// `TestField` `expected_test_field`. +// Matches optimization_guide::proto::features::UserAnnotationsEntry `arg` +// against `TestField` `expected_test_field`. MATCHER_P(MatchesTestField, expected_test_field, "") { return arg.key() == expected_test_field.label && arg.value() == expected_test_field @@ -177,14 +177,14 @@ } switch (expected_response_type_) { case ResponseType::kFormsAnnotations: { - optimization_guide::proto::FormsAnnotationsRequest + optimization_guide::proto::features::FormsAnnotationsRequest forms_annotations_request; if (!forms_annotations_request.ParseFromString( execute_request.request_metadata().value())) { response->set_content( "Couldn't parse optimization_guide::proto::ExecuteRequest's " "request_metadata().value() field as " - "optimization_guide::proto::FormsAnnotationsRequest."); + "optimization_guide::proto::features::FormsAnnotationsRequest."); response->set_code(net::HTTP_INTERNAL_SERVER_ERROR); return response; } @@ -197,14 +197,14 @@ break; } case ResponseType::kFormsPredictions: { - optimization_guide::proto::FormsPredictionsRequest + optimization_guide::proto::features::FormsPredictionsRequest forms_predictions_request; if (!forms_predictions_request.ParseFromString( execute_request.request_metadata().value())) { response->set_content( "Couldn't parse optimization_guide::proto::ExecuteRequest's " "request_metadata().value() field as " - "optimization_guide::proto::FormsPredictionsRequest."); + "optimization_guide::proto::features::FormsPredictionsRequest."); response->set_code(net::HTTP_INTERNAL_SERVER_ERROR); return response; } @@ -224,14 +224,15 @@ static optimization_guide::proto::ExecuteResponse BuildFormsAnnotationsResponse( - const optimization_guide::proto::FormsAnnotationsRequest& request) { - optimization_guide::proto::FormsAnnotationsResponse response; - for (const optimization_guide::proto::FormFieldData& field : + const optimization_guide::proto::features::FormsAnnotationsRequest& + request) { + optimization_guide::proto::features::FormsAnnotationsResponse response; + for (const optimization_guide::proto::features::FormFieldData& field : request.form_data().fields()) { if (field.field_value().empty()) { continue; } - optimization_guide::proto::UserAnnotationsEntry* entry = + optimization_guide::proto::features::UserAnnotationsEntry* entry = response.add_upserted_entries(); entry->set_key(field.field_label()); entry->set_value(field.field_value()); @@ -242,34 +243,36 @@ any_metadata->set_type_url("type.googleapis.com/" + response.GetTypeName()); response.SerializeToString(any_metadata->mutable_value()); auto response_data = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::FormsAnnotationsResponse>(*any_metadata); + optimization_guide::proto::features::FormsAnnotationsResponse>( + *any_metadata); EXPECT_TRUE(response_data); return execute_response; } static optimization_guide::proto::ExecuteResponse BuildFormsPredictionsResponse( - const optimization_guide::proto::FormsPredictionsRequest& request) { - optimization_guide::proto::FormsPredictionsResponse response; + const optimization_guide::proto::features::FormsPredictionsRequest& + request) { + optimization_guide::proto::features::FormsPredictionsResponse response; for (int i = 0; i < request.form_data().fields().size(); ++i) { - const optimization_guide::proto::FormFieldData& field = + const optimization_guide::proto::features::FormFieldData& field = request.form_data().fields(i); auto it = base::ranges::find( request.entries(), field.field_label(), - &optimization_guide::proto::UserAnnotationsEntry::key); + &optimization_guide::proto::features::UserAnnotationsEntry::key); if (it == request.entries().end()) { continue; } const std::string& field_label = it->key(); const std::string& field_value = it->value(); - optimization_guide::proto::FilledFormFieldData* filled_field = + optimization_guide::proto::features::FilledFormFieldData* filled_field = response.mutable_form_data()->add_filled_form_field_data(); - optimization_guide::proto::PredictedValue* predicted_value = + optimization_guide::proto::features::PredictedValue* predicted_value = filled_field->add_predicted_values(); predicted_value->set_value(field_value); filled_field->set_normalized_label(field_label); filled_field->set_request_field_index(i); - optimization_guide::proto::FormFieldData* filled_field_data = + optimization_guide::proto::features::FormFieldData* filled_field_data = filled_field->mutable_field_data(); filled_field_data->set_field_label(field_label); filled_field_data->set_field_value(field_value); @@ -280,7 +283,8 @@ any_metadata->set_type_url("type.googleapis.com/" + response.GetTypeName()); response.SerializeToString(any_metadata->mutable_value()); auto response_data = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::FormsPredictionsResponse>(*any_metadata); + optimization_guide::proto::features::FormsPredictionsResponse>( + *any_metadata); EXPECT_TRUE(response_data); return execute_response; }
diff --git a/chrome/browser/autofill_ai/chrome_autofill_ai_client.cc b/chrome/browser/autofill_ai/chrome_autofill_ai_client.cc index 6b32f1e..5cca94ac 100644 --- a/chrome/browser/autofill_ai/chrome_autofill_ai_client.cc +++ b/chrome/browser/autofill_ai/chrome_autofill_ai_client.cc
@@ -78,7 +78,7 @@ } void ChromeAutofillAiClient::GetAXTree(AXTreeCallback callback) { - using ProtoTreeUpdate = optimization_guide::proto::AXTreeUpdate; + using ProtoTreeUpdate = optimization_guide::proto::features::AXTreeUpdate; base::OnceCallback<ProtoTreeUpdate(ui::AXTreeUpdate&)> processing_callback = base::BindOnce([](ui::AXTreeUpdate& ax_tree_update) { ProtoTreeUpdate ax_tree_proto;
diff --git a/chrome/browser/browsing_data/counters/autofill_counter_browsertest.cc b/chrome/browser/browsing_data/counters/autofill_counter_browsertest.cc index bac07a4..81b4a3f8 100644 --- a/chrome/browser/browsing_data/counters/autofill_counter_browsertest.cc +++ b/chrome/browser/browsing_data/counters/autofill_counter_browsertest.cc
@@ -384,8 +384,8 @@ WaitForCounting(); EXPECT_EQ(0, GetNumUserAnnotations()); - SetUserAnnotations( - std::vector(10, optimization_guide::proto::UserAnnotationsEntry{})); + SetUserAnnotations(std::vector( + 10, optimization_guide::proto::features::UserAnnotationsEntry{})); counter.Restart(); WaitForCounting(); EXPECT_EQ(10, GetNumUserAnnotations());
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 1b5c5a76..a3996b1 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2213,11 +2213,6 @@ const url::Origin& origin, bool is_for_isolated_world, network::mojom::URLLoaderFactoryParams* factory_params) { -#if BUILDFLAG(IS_ANDROID) - // Loading state text isn't used on Android, only in desktop UI. - factory_params->provide_loading_state_updates = false; -#endif - #if BUILDFLAG(ENABLE_EXTENSIONS_CORE) if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile( browser_context)) {
diff --git a/chrome/browser/chromeos/extensions/info_private/info_private_api.cc b/chrome/browser/chromeos/extensions/info_private/info_private_api.cc index d6d9d05..b60b997 100644 --- a/chrome/browser/chromeos/extensions/info_private/info_private_api.cc +++ b/chrome/browser/chromeos/extensions/info_private/info_private_api.cc
@@ -12,18 +12,10 @@ #include "base/functional/callback.h" #include "base/values.h" #include "build/chromeos_buildflags.h" -#include "extensions/browser/extension_function.h" - -#if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/crosapi/crosapi_ash.h" #include "chrome/browser/ash/crosapi/crosapi_manager.h" #include "chrome/browser/ash/crosapi/extension_info_private_ash.h" -#endif - -#if BUILDFLAG(IS_CHROMEOS_LACROS) -#include "chromeos/crosapi/mojom/extension_info_private.mojom.h" // nogncheck -#include "chromeos/lacros/lacros_service.h" -#endif +#include "extensions/browser/extension_function.h" namespace { @@ -33,17 +25,6 @@ // Property not found error message. const char kPropertyNotFound[] = "Property '*' does not exist."; -#if BUILDFLAG(IS_CHROMEOS_LACROS) -mojo::Remote<crosapi::mojom::ExtensionInfoPrivate>* -GetExtensionInfoPrivateRemote() { - auto* lacros_service = chromeos::LacrosService::Get(); - if (lacros_service->IsAvailable<crosapi::mojom::ExtensionInfoPrivate>()) { - return &(lacros_service->GetRemote<crosapi::mojom::ExtensionInfoPrivate>()); - } - return nullptr; -} -#endif - } // namespace namespace extensions { @@ -64,19 +45,10 @@ } auto callback = base::BindOnce(&ChromeosInfoPrivateGetFunction::RespondWithResult, this); -#if BUILDFLAG(IS_CHROMEOS_ASH) crosapi::CrosapiManager::Get() ->crosapi_ash() ->extension_info_private_ash() ->GetSystemProperties(std::move(property_names), std::move(callback)); -#else - auto* remote = GetExtensionInfoPrivateRemote(); - if (!remote) { - return RespondNow(Error("ExtensionInfoPrivate unavailable.")); - } - (*remote)->GetSystemProperties(std::move(property_names), - std::move(callback)); -#endif return RespondLater(); } @@ -97,18 +69,10 @@ EXTENSION_FUNCTION_VALIDATE(args().size() >= 2); EXTENSION_FUNCTION_VALIDATE(args()[1].is_string()); const std::string& param_value = args()[1].GetString(); -#if BUILDFLAG(IS_CHROMEOS_ASH) crosapi::CrosapiManager::Get() ->crosapi_ash() ->extension_info_private_ash() ->SetTimezone(param_value); -#else - auto* remote = GetExtensionInfoPrivateRemote(); - if (!remote) { - return RespondNow(Error("ExtensionInfoPrivate unavailable.")); - } - (*remote)->SetTimezone(param_value); -#endif return RespondNow(NoArguments()); } @@ -118,18 +82,10 @@ auto callback = base::BindOnce(&ChromeosInfoPrivateSetFunction::RespondWithResult, this); -#if BUILDFLAG(IS_CHROMEOS_ASH) crosapi::CrosapiManager::Get() ->crosapi_ash() ->extension_info_private_ash() ->SetBool(param_name_, param_value, std::move(callback)); -#else - auto* remote = GetExtensionInfoPrivateRemote(); - if (!remote) { - return RespondNow(Error("ExtensionInfoPrivate unavailable.")); - } - (*remote)->SetBool(param_name_, param_value, std::move(callback)); -#endif return RespondLater(); } @@ -152,18 +108,10 @@ ChromeosInfoPrivateIsTabletModeEnabledFunction::Run() { auto callback = base::BindOnce( &ChromeosInfoPrivateIsTabletModeEnabledFunction::RespondWithResult, this); -#if BUILDFLAG(IS_CHROMEOS_ASH) crosapi::CrosapiManager::Get() ->crosapi_ash() ->extension_info_private_ash() ->IsTabletModeEnabled(std::move(callback)); -#else - auto* remote = GetExtensionInfoPrivateRemote(); - if (!remote) { - return RespondNow(Error("ExtensionInfoPrivate unavailable.")); - } - (*remote)->IsTabletModeEnabled(std::move(callback)); -#endif return RespondLater(); } @@ -180,11 +128,7 @@ ExtensionFunction::ResponseAction ChromeosInfoPrivateIsRunningOnLacrosFunction::Run() { -#if BUILDFLAG(IS_CHROMEOS_ASH) return RespondNow(WithArguments(false)); -#else - return RespondNow(WithArguments(true)); -#endif } } // namespace extensions
diff --git a/chrome/browser/chromeos/extensions/info_private/info_private_browser_apitest.cc b/chrome/browser/chromeos/extensions/info_private/info_private_browser_apitest.cc index 2899d984..eb9c13b 100644 --- a/chrome/browser/chromeos/extensions/info_private/info_private_browser_apitest.cc +++ b/chrome/browser/chromeos/extensions/info_private/info_private_browser_apitest.cc
@@ -17,13 +17,7 @@ }; IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateBrowserTest, TestIsRunningOnLacros) { - const char* custom_arg = -#if BUILDFLAG(IS_CHROMEOS_ASH) - "isRunningOnLacros - False"; -#else - "isRunningOnLacros - True"; -#endif - + const char* custom_arg = "isRunningOnLacros - False"; ASSERT_TRUE(RunExtensionTest("chromeos_info_private/basic", {.custom_arg = custom_arg}, {.load_as_component = true}))
diff --git a/chrome/browser/compose/chrome_compose_client_unittest.cc b/chrome/browser/compose/chrome_compose_client_unittest.cc index c5bc7a6c..0bf5403 100644 --- a/chrome/browser/compose/chrome_compose_client_unittest.cc +++ b/chrome/browser/compose/chrome_compose_client_unittest.cc
@@ -372,41 +372,43 @@ } protected: - optimization_guide::proto::ComposePageMetadata ComposePageMetadata() { - optimization_guide::proto::ComposePageMetadata page_metadata; + optimization_guide::proto::features::ComposePageMetadata + ComposePageMetadata() { + optimization_guide::proto::features::ComposePageMetadata page_metadata; page_metadata.set_page_url(GetPageUrl().spec()); page_metadata.set_page_title(base::UTF16ToUTF8( browser()->tab_strip_model()->GetWebContentsAt(0)->GetTitle())); return page_metadata; } - optimization_guide::proto::ComposeRequest ComposeRequest( + optimization_guide::proto::features::ComposeRequest ComposeRequest( std::string user_input, - optimization_guide::proto::ComposeUpfrontInputMode mode) { - optimization_guide::proto::ComposeRequest request; + optimization_guide::proto::features::ComposeUpfrontInputMode mode) { + optimization_guide::proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input(user_input); request.mutable_generate_params()->set_upfront_input_mode(mode); return request; } - optimization_guide::proto::ComposeRequest RegenerateRequest( + optimization_guide::proto::features::ComposeRequest RegenerateRequest( std::string previous_response) { - optimization_guide::proto::ComposeRequest request; + optimization_guide::proto::features::ComposeRequest request; request.mutable_rewrite_params()->set_regenerate(true); request.mutable_rewrite_params()->set_previous_response(previous_response); return request; } - optimization_guide::proto::ComposeResponse ComposeResponse( + optimization_guide::proto::features::ComposeResponse ComposeResponse( bool ok, std::string output) { - optimization_guide::proto::ComposeResponse response; + optimization_guide::proto::features::ComposeResponse response; response.set_output(ok ? output : ""); return response; } StreamingResponse OptimizationGuideResponse( - const optimization_guide::proto::ComposeResponse compose_response, + const optimization_guide::proto::features::ComposeResponse + compose_response, bool is_complete = true) { return StreamingResponse{ .response = optimization_guide::AnyWrapProto(compose_response), @@ -416,7 +418,8 @@ OptimizationGuideModelStreamingExecutionResult OptimizationGuideStreamingResult( - const optimization_guide::proto::ComposeResponse compose_response, + const optimization_guide::proto::features::ComposeResponse + compose_response, bool is_complete = true, bool provided_by_on_device = false, std::unique_ptr<ModelQualityLogEntry> log_entry = nullptr) { @@ -1205,7 +1208,7 @@ {}); const std::string input = "a user typed this"; - optimization_guide::proto::ComposeRequest context_request; + optimization_guide::proto::features::ComposeRequest context_request; *context_request.mutable_page_metadata() = ComposePageMetadata(); optimization_guide::OptimizationGuideModelExecutionResultStreamingCallback saved_callback; @@ -1213,7 +1216,7 @@ EXPECT_CALL(session(), ExecuteModel( EqualsProto(ComposeRequest( - input, optimization_guide::proto:: + input, optimization_guide::proto::features:: ComposeUpfrontInputMode::COMPOSE_POLISH_MODE)), _)) .WillOnce(testing::WithArg<1>(testing::Invoke( @@ -1287,7 +1290,7 @@ {optimization_guide::features::kOptimizationGuideOnDeviceModel}, {}); const std::string input = "a user typed this"; - optimization_guide::proto::ComposeRequest context_request; + optimization_guide::proto::features::ComposeRequest context_request; *context_request.mutable_page_metadata() = ComposePageMetadata(); base::test::TestFuture< optimization_guide:: @@ -1297,7 +1300,7 @@ EXPECT_CALL(session(), ExecuteModel( EqualsProto(ComposeRequest( - input, optimization_guide::proto:: + input, optimization_guide::proto::features:: ComposeUpfrontInputMode::COMPOSE_POLISH_MODE)), _)) .WillOnce(testing::WithArg<1>(testing::Invoke( @@ -1332,7 +1335,7 @@ const std::string input = "a user typed this"; const std::string input2 = "another input"; - optimization_guide::proto::ComposeRequest context_request; + optimization_guide::proto::features::ComposeRequest context_request; *context_request.mutable_page_metadata() = ComposePageMetadata(); optimization_guide::OptimizationGuideModelExecutionResultStreamingCallback original_callback; @@ -1340,7 +1343,7 @@ EXPECT_CALL(session(), ExecuteModel( EqualsProto(ComposeRequest( - input, optimization_guide::proto:: + input, optimization_guide::proto::features:: ComposeUpfrontInputMode::COMPOSE_POLISH_MODE)), _)) .WillOnce(testing::WithArg<1>(testing::Invoke( @@ -1358,8 +1361,8 @@ session(), ExecuteModel( EqualsProto(ComposeRequest( - input2, optimization_guide::proto::ComposeUpfrontInputMode:: - COMPOSE_POLISH_MODE)), + input2, optimization_guide::proto::features:: + ComposeUpfrontInputMode::COMPOSE_POLISH_MODE)), _)) .WillOnce(testing::WithArg<1>(testing::Invoke( [&](optimization_guide:: @@ -1434,8 +1437,8 @@ ShowDialogAndBindMojo(); std::string user_input = "a user typed this"; auto matcher = EqualsProto(ComposeRequest( - user_input, - optimization_guide::proto::ComposeUpfrontInputMode::COMPOSE_POLISH_MODE)); + user_input, optimization_guide::proto::features::ComposeUpfrontInputMode:: + COMPOSE_POLISH_MODE)); EXPECT_CALL(session(), ExecuteModel(matcher, _)) .WillOnce(testing::WithArg<1>(testing::Invoke( [&](optimization_guide:: @@ -3744,9 +3747,9 @@ uploaded_logs()[2]->compose().quality().session_id(); EXPECT_EQ(kSessionIdHigh, session_id3.high()); EXPECT_EQ(kSessionIdLow, session_id3.low()); - EXPECT_EQ( - optimization_guide::proto::FinalModelStatus::FINAL_MODEL_STATUS_SUCCESS, - uploaded_logs()[1]->compose().quality().final_model_status()); + EXPECT_EQ(optimization_guide::proto::features::FinalModelStatus:: + FINAL_MODEL_STATUS_SUCCESS, + uploaded_logs()[1]->compose().quality().final_model_status()); } TEST_F(ChromeComposeClientTest, TestComposeQualityLoggedOnSubsequentError) { @@ -3915,10 +3918,11 @@ EXPECT_TRUE(log_uploaded_signal.Wait()); ASSERT_EQ(2u, uploaded_logs().size()); - EXPECT_EQ(optimization_guide::proto::FinalStatus::STATUS_ABANDONED, + EXPECT_EQ(optimization_guide::proto::features::FinalStatus::STATUS_ABANDONED, uploaded_logs()[0]->compose().quality().final_status()); - EXPECT_EQ(optimization_guide::proto::FinalStatus::STATUS_UNSPECIFIED, - uploaded_logs()[1]->compose().quality().final_status()); + EXPECT_EQ( + optimization_guide::proto::features::FinalStatus::STATUS_UNSPECIFIED, + uploaded_logs()[1]->compose().quality().final_status()); } TEST_F(ChromeComposeClientTest, TestComposeQualityNewSessionWithSelectedText) { @@ -3944,7 +3948,7 @@ // Get quality result from the abandoned session. EXPECT_TRUE(log_uploaded_signal.Wait()); ASSERT_EQ(1u, uploaded_logs().size()); - EXPECT_EQ(optimization_guide::proto::FinalStatus::STATUS_ABANDONED, + EXPECT_EQ(optimization_guide::proto::features::FinalStatus::STATUS_ABANDONED, uploaded_logs()[0]->compose().quality().final_status()); page_handler()->Compose("a user typed this", @@ -3958,7 +3962,7 @@ EXPECT_TRUE(log_uploaded_signal.Wait()); ASSERT_EQ(2u, uploaded_logs().size()); - EXPECT_EQ(optimization_guide::proto::FinalStatus::STATUS_ABANDONED, + EXPECT_EQ(optimization_guide::proto::features::FinalStatus::STATUS_ABANDONED, uploaded_logs()[1]->compose().quality().final_status()); } @@ -3984,9 +3988,9 @@ // Get quality result from the abandoned session. EXPECT_TRUE(log_uploaded_signal.Wait()); ASSERT_EQ(1u, uploaded_logs().size()); - EXPECT_EQ( - optimization_guide::proto::FinalStatus::STATUS_FINISHED_WITHOUT_INSERT, - uploaded_logs()[0]->compose().quality().final_status()); + EXPECT_EQ(optimization_guide::proto::features::FinalStatus:: + STATUS_FINISHED_WITHOUT_INSERT, + uploaded_logs()[0]->compose().quality().final_status()); } TEST_F(ChromeComposeClientTest, TestComposeQualityFeedbackPositive) { @@ -4014,7 +4018,8 @@ // Get quality logs sent for the Compose Request. EXPECT_TRUE(log_uploaded_signal.Wait()); ASSERT_EQ(1u, uploaded_logs().size()); - EXPECT_EQ(optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_UP, + EXPECT_EQ(optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_UP, uploaded_logs()[0]->compose().quality().user_feedback()); // Check that the histogram was sent for request feedback. @@ -4048,12 +4053,13 @@ // Get quality logs sent for the Compose Request. EXPECT_TRUE(log_uploaded_signal.Wait()); ASSERT_EQ(1u, uploaded_logs().size()); - EXPECT_EQ(optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN, + EXPECT_EQ(optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN, uploaded_logs()[0]->compose().quality().user_feedback()); - EXPECT_EQ( - optimization_guide::proto::FinalModelStatus::FINAL_MODEL_STATUS_FAILURE, - uploaded_logs()[0]->compose().quality().final_model_status()); + EXPECT_EQ(optimization_guide::proto::features::FinalModelStatus:: + FINAL_MODEL_STATUS_FAILURE, + uploaded_logs()[0]->compose().quality().final_model_status()); // Check that the histogram was sent for request feedback. histograms().ExpectUniqueSample( @@ -4095,8 +4101,9 @@ EXPECT_TRUE(uploaded_logs()[0]->compose().quality().was_generated_via_edit()); EXPECT_FALSE( uploaded_logs()[1]->compose().quality().was_generated_via_edit()); - EXPECT_EQ(optimization_guide::proto::FinalStatus::STATUS_UNSPECIFIED, - uploaded_logs()[1]->compose().quality().final_status()); + EXPECT_EQ( + optimization_guide::proto::features::FinalStatus::STATUS_UNSPECIFIED, + uploaded_logs()[1]->compose().quality().final_status()); histograms().ExpectBucketCount( compose::kComposeRequestReason, @@ -4121,8 +4128,8 @@ ShowDialogAndBindMojo(); std::string user_input = "a user typed this"; auto matcher = EqualsProto(ComposeRequest( - user_input, - optimization_guide::proto::ComposeUpfrontInputMode::COMPOSE_POLISH_MODE)); + user_input, optimization_guide::proto::features::ComposeUpfrontInputMode:: + COMPOSE_POLISH_MODE)); EXPECT_CALL(session(), ExecuteModel(matcher, _)) .WillOnce(testing::WithArg<1>(testing::Invoke( [&](optimization_guide:: @@ -4206,8 +4213,8 @@ ShowDialogAndBindMojo(); std::string user_input = "a user typed this"; auto compose_matcher = EqualsProto(ComposeRequest( - user_input, - optimization_guide::proto::ComposeUpfrontInputMode::COMPOSE_POLISH_MODE)); + user_input, optimization_guide::proto::features::ComposeUpfrontInputMode:: + COMPOSE_POLISH_MODE)); EXPECT_CALL(session(), ExecuteModel(compose_matcher, _)) .WillOnce(testing::WithArg<1>(testing::Invoke( [&](optimization_guide:: @@ -4217,10 +4224,10 @@ ComposeResponse(true, "Cucumbers"))); }))); // Rewrite with Formal. - optimization_guide::proto::ComposeRequest request; + optimization_guide::proto::features::ComposeRequest request; request.mutable_rewrite_params()->set_previous_response("Cucumbers"); request.mutable_rewrite_params()->set_tone( - optimization_guide::proto::ComposeTone::COMPOSE_FORMAL); + optimization_guide::proto::features::ComposeTone::COMPOSE_FORMAL); auto rewrite_matcher = EqualsProto(request); EXPECT_CALL(session(), ExecuteModel(rewrite_matcher, _)) .WillOnce(testing::WithArg<1>(testing::Invoke( @@ -4233,7 +4240,7 @@ // Rewrite with Casual. request.mutable_rewrite_params()->set_previous_response("Tomatoes"); request.mutable_rewrite_params()->set_tone( - optimization_guide::proto::ComposeTone::COMPOSE_INFORMAL); + optimization_guide::proto::features::ComposeTone::COMPOSE_INFORMAL); auto rewrite_matcher_informal = EqualsProto(request); EXPECT_CALL(session(), ExecuteModel(rewrite_matcher_informal, _)) .WillOnce(testing::WithArg<1>(testing::Invoke( @@ -4324,8 +4331,8 @@ ShowDialogAndBindMojo(); std::string user_input = "a user typed this"; auto compose_matcher = EqualsProto(ComposeRequest( - user_input, - optimization_guide::proto::ComposeUpfrontInputMode::COMPOSE_POLISH_MODE)); + user_input, optimization_guide::proto::features::ComposeUpfrontInputMode:: + COMPOSE_POLISH_MODE)); EXPECT_CALL(session(), ExecuteModel(compose_matcher, _)) .WillOnce(testing::WithArg<1>(testing::Invoke( [&](optimization_guide:: @@ -4336,10 +4343,10 @@ }))); // Rewrite with Elaborate. - optimization_guide::proto::ComposeRequest request; + optimization_guide::proto::features::ComposeRequest request; request.mutable_rewrite_params()->set_previous_response("Cucumbers"); request.mutable_rewrite_params()->set_length( - optimization_guide::proto::ComposeLength::COMPOSE_LONGER); + optimization_guide::proto::features::ComposeLength::COMPOSE_LONGER); auto rewrite_matcher = EqualsProto(request); EXPECT_CALL(session(), ExecuteModel(rewrite_matcher, _)) .WillOnce(testing::WithArg<1>(testing::Invoke( @@ -4353,7 +4360,7 @@ // Rewrite with Shorten. request.mutable_rewrite_params()->set_previous_response("Tomatoes"); request.mutable_rewrite_params()->set_length( - optimization_guide::proto::ComposeLength::COMPOSE_SHORTER); + optimization_guide::proto::features::ComposeLength::COMPOSE_SHORTER); auto rewrite_shorten_matcher = EqualsProto(request); EXPECT_CALL(session(), ExecuteModel(rewrite_shorten_matcher, _)) .WillOnce(testing::WithArg<1>(testing::Invoke( @@ -4488,11 +4495,12 @@ std::move(callback).Run(std::move(expected_inner_text)); }))); - base::test::TestFuture<optimization_guide::proto::ComposeRequest> test_future; + base::test::TestFuture<optimization_guide::proto::features::ComposeRequest> + test_future; EXPECT_CALL(session(), AddContext(_)) .WillOnce(testing::WithArg<0>(testing::Invoke( [&](const google::protobuf::MessageLite& request_metadata) { - optimization_guide::proto::ComposeRequest request; + optimization_guide::proto::features::ComposeRequest request; request.CheckTypeAndMergeFrom(request_metadata); test_future.SetValue(request); }))); @@ -4500,7 +4508,8 @@ ShowDialogAndBindMojo(); page_handler()->Compose("a user typed this", compose::mojom::InputMode::kPolish, false); - optimization_guide::proto::ComposeRequest result = test_future.Take(); + optimization_guide::proto::features::ComposeRequest result = + test_future.Take(); std::string result_string; EXPECT_TRUE(result.SerializeToString(&result_string)); @@ -4519,11 +4528,12 @@ std::move(callback).Run(std::move(expected_inner_text)); }))); - base::test::TestFuture<optimization_guide::proto::ComposeRequest> test_future; + base::test::TestFuture<optimization_guide::proto::features::ComposeRequest> + test_future; EXPECT_CALL(session(), AddContext(_)) .WillOnce(testing::WithArg<0>(testing::Invoke( [&](const google::protobuf::MessageLite& request_metadata) { - optimization_guide::proto::ComposeRequest request; + optimization_guide::proto::features::ComposeRequest request; request.CheckTypeAndMergeFrom(request_metadata); test_future.SetValue(request); }))); @@ -4531,7 +4541,8 @@ ShowDialogAndBindMojo(); page_handler()->Compose("a user typed this", compose::mojom::InputMode::kPolish, false); - optimization_guide::proto::ComposeRequest result = test_future.Take(); + optimization_guide::proto::features::ComposeRequest result = + test_future.Take(); std::string result_string; EXPECT_TRUE(result.SerializeToString(&result_string));
diff --git a/chrome/browser/compose/compose_session.cc b/chrome/browser/compose/compose_session.cc index e456d8c..9d7fa16e 100644 --- a/chrome/browser/compose/compose_session.cc +++ b/chrome/browser/compose/compose_session.cc
@@ -357,10 +357,10 @@ if (close_reason_ == compose::ComposeSessionCloseReason::kAbandoned) { base::RecordAction( base::UserMetricsAction("Compose.EndedSession.EndedImplicitly")); - final_model_status_ = - optimization_guide::proto::FinalModelStatus::FINAL_MODEL_STATUS_FAILURE; - final_status_ = - optimization_guide::proto::FinalStatus::STATUS_FINISHED_WITHOUT_INSERT; + final_model_status_ = optimization_guide::proto::features:: + FinalModelStatus::FINAL_MODEL_STATUS_FAILURE; + final_status_ = optimization_guide::proto::features::FinalStatus:: + STATUS_FINISHED_WITHOUT_INSERT; } LogComposeSessionCloseMetrics(close_reason_, session_events_); @@ -429,9 +429,9 @@ base::UserMetricsAction("Compose.ComposeRequest.CreateClicked")); request_reason = GetRequestReasonForInputMode(mode); } - optimization_guide::proto::ComposeRequest request; + optimization_guide::proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input(input); - optimization_guide::proto::ComposeUpfrontInputMode request_mode = + optimization_guide::proto::features::ComposeUpfrontInputMode request_mode = ComposeUpfrontInputMode(mode); request.mutable_generate_params()->set_upfront_input_mode(request_mode); @@ -441,29 +441,29 @@ void ComposeSession::Rewrite(compose::mojom::StyleModifier style) { compose::ComposeRequestReason request_reason; - optimization_guide::proto::ComposeRequest request; + optimization_guide::proto::features::ComposeRequest request; switch (style) { case compose::mojom::StyleModifier::kFormal: request.mutable_rewrite_params()->set_tone( - optimization_guide::proto::ComposeTone::COMPOSE_FORMAL); + optimization_guide::proto::features::ComposeTone::COMPOSE_FORMAL); session_events_.formal_count++; request_reason = compose::ComposeRequestReason::kToneFormalRequest; break; case compose::mojom::StyleModifier::kCasual: request.mutable_rewrite_params()->set_tone( - optimization_guide::proto::ComposeTone::COMPOSE_INFORMAL); + optimization_guide::proto::features::ComposeTone::COMPOSE_INFORMAL); session_events_.casual_count++; request_reason = compose::ComposeRequestReason::kToneCasualRequest; break; case compose::mojom::StyleModifier::kShorter: request.mutable_rewrite_params()->set_length( - optimization_guide::proto::ComposeLength::COMPOSE_SHORTER); + optimization_guide::proto::features::ComposeLength::COMPOSE_SHORTER); session_events_.shorten_count++; request_reason = compose::ComposeRequestReason::kLengthShortenRequest; break; case compose::mojom::StyleModifier::kLonger: request.mutable_rewrite_params()->set_length( - optimization_guide::proto::ComposeLength::COMPOSE_LONGER); + optimization_guide::proto::features::ComposeLength::COMPOSE_LONGER); session_events_.lengthen_count++; request_reason = compose::ComposeRequestReason::kLengthElaborateRequest; break; @@ -487,7 +487,7 @@ } void ComposeSession::MakeRequest( - optimization_guide::proto::ComposeRequest request, + optimization_guide::proto::features::ComposeRequest request, compose::ComposeRequestReason request_reason, bool is_input_edited) { active_mojo_state_->has_pending_request = true; @@ -524,7 +524,7 @@ } void ComposeSession::RequestWithSession( - const optimization_guide::proto::ComposeRequest& request, + const optimization_guide::proto::features::ComposeRequest& request, compose::ComposeRequestReason request_reason, bool is_input_edited) { // Add timeout for high latency Compose requests. @@ -574,7 +574,7 @@ compose::ComposeRequestReason request_reason, bool was_input_edited, optimization_guide::OptimizationGuideModelStreamingExecutionResult result, - std::unique_ptr<optimization_guide::proto::ComposeLoggingData> + std::unique_ptr<optimization_guide::proto::features::ComposeLoggingData> logging_data) { base::TimeDelta request_delta = request_timer.Elapsed(); std::unique_ptr<optimization_guide::ModelQualityLogEntry> log_entry; @@ -639,7 +639,7 @@ return; } auto response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::ComposeResponse>(result.response); + optimization_guide::proto::features::ComposeResponse>(result.response); if (!response) { DLOG(ERROR) << "Failed to parse partial compose response"; return; @@ -694,7 +694,8 @@ CHECK(result.response->is_complete); auto response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::ComposeResponse>(result.response->response); + optimization_guide::proto::features::ComposeResponse>( + result.response->response); if (!response) { compose::LogComposeRequestDuration(request_delta, eval_location, @@ -714,7 +715,7 @@ session_events_.started_with_proactive_nudge); log_entry->quality_data<optimization_guide::ComposeFeatureTypeMap>() ->set_request_latency_ms(request_delta.InMilliseconds()); - optimization_guide::proto::Int128* token = + optimization_guide::proto::features::Int128* token = log_entry->quality_data<optimization_guide::ComposeFeatureTypeMap>() ->mutable_session_id(); @@ -1015,11 +1016,11 @@ if (active_mojo_state_->response) { active_mojo_state_->feedback = feedback; } - optimization_guide::proto::UserFeedback user_feedback = + optimization_guide::proto::features::UserFeedback user_feedback = OptimizationFeedbackFromComposeFeedback(feedback); // Apply feedback to the last saved state with a valid response. - optimization_guide::proto::ComposeQuality* quality = + optimization_guide::proto::features::ComposeQuality* quality = last_response_state->modeling_log_entry() ->quality_data<optimization_guide::ComposeFeatureTypeMap>(); if (quality) { @@ -1205,7 +1206,7 @@ page_metadata_.emplace(); } - optimization_guide::proto::ComposeRequest request; + optimization_guide::proto::features::ComposeRequest request; if (page_metadata_) { page_metadata_->set_page_url(web_contents_->GetLastCommittedURL().spec()); page_metadata_->set_page_title( @@ -1301,27 +1302,30 @@ switch (close_reason) { case compose::ComposeSessionCloseReason::kCloseButtonPressed: case compose::ComposeSessionCloseReason::kCanceledBeforeResponseReceived: - final_status_ = optimization_guide::proto::FinalStatus::STATUS_ABANDONED; - final_model_status_ = optimization_guide::proto::FinalModelStatus:: - FINAL_MODEL_STATUS_FAILURE; + final_status_ = + optimization_guide::proto::features::FinalStatus::STATUS_ABANDONED; + final_model_status_ = optimization_guide::proto::features:: + FinalModelStatus::FINAL_MODEL_STATUS_FAILURE; session_events_.close_clicked = true; break; case compose::ComposeSessionCloseReason::kReplacedWithNewSession: - final_status_ = optimization_guide::proto::FinalStatus::STATUS_ABANDONED; - final_model_status_ = optimization_guide::proto::FinalModelStatus:: - FINAL_MODEL_STATUS_FAILURE; + final_status_ = + optimization_guide::proto::features::FinalStatus::STATUS_ABANDONED; + final_model_status_ = optimization_guide::proto::features:: + FinalModelStatus::FINAL_MODEL_STATUS_FAILURE; break; case compose::ComposeSessionCloseReason::kExceededMaxDuration: case compose::ComposeSessionCloseReason::kAbandoned: - final_status_ = optimization_guide::proto::FinalStatus:: + final_status_ = optimization_guide::proto::features::FinalStatus:: STATUS_FINISHED_WITHOUT_INSERT; - final_model_status_ = optimization_guide::proto::FinalModelStatus:: - FINAL_MODEL_STATUS_FAILURE; + final_model_status_ = optimization_guide::proto::features:: + FinalModelStatus::FINAL_MODEL_STATUS_FAILURE; break; case compose::ComposeSessionCloseReason::kInsertedResponse: - final_status_ = optimization_guide::proto::FinalStatus::STATUS_INSERTED; - final_model_status_ = optimization_guide::proto::FinalModelStatus:: - FINAL_MODEL_STATUS_SUCCESS; + final_status_ = + optimization_guide::proto::features::FinalStatus::STATUS_INSERTED; + final_model_status_ = optimization_guide::proto::features:: + FinalModelStatus::FINAL_MODEL_STATUS_SUCCESS; session_events_.inserted_results = true; if (CurrentState().has_value() && CurrentState()->is_user_edited()) { session_events_.edited_result_inserted = true; @@ -1347,7 +1351,7 @@ if (log_entry) { log_entry->quality_data<optimization_guide::ComposeFeatureTypeMap>() ->set_request_latency_ms(request_time.InMilliseconds()); - optimization_guide::proto::Int128* token = + optimization_guide::proto::features::Int128* token = log_entry->quality_data<optimization_guide::ComposeFeatureTypeMap>() ->mutable_session_id();
diff --git a/chrome/browser/compose/compose_session.h b/chrome/browser/compose/compose_session.h index 960e427b..a82a09ec 100644 --- a/chrome/browser/compose/compose_session.h +++ b/chrome/browser/compose/compose_session.h
@@ -244,7 +244,7 @@ compose::ComposeRequestReason request_reason, bool was_input_edited, optimization_guide::OptimizationGuideModelStreamingExecutionResult result, - std::unique_ptr<optimization_guide::proto::ComposeLoggingData> + std::unique_ptr<optimization_guide::proto::features::ComposeLoggingData> logging_data); void ModelExecutionProgress(optimization_guide::StreamingResponse result); void ModelExecutionComplete( @@ -257,14 +257,14 @@ void EraseForwardStatesInHistory(); // Makes compose or rewrite request. - void MakeRequest(optimization_guide::proto::ComposeRequest request, + void MakeRequest(optimization_guide::proto::features::ComposeRequest request, compose::ComposeRequestReason request_reason, bool is_input_edited); // RequestWithSession can either be called synchronously or on a later event // loop. void RequestWithSession( - const optimization_guide::proto::ComposeRequest& request, + const optimization_guide::proto::features::ComposeRequest& request, compose::ComposeRequestReason request_reason, bool is_input_edited); @@ -361,11 +361,11 @@ compose::ComposeSessionCloseReason close_reason_{ compose::ComposeSessionCloseReason::kAbandoned}; // Reason that a compose session was exited, used for quality logging. - optimization_guide::proto::FinalStatus final_status_{ - optimization_guide::proto::FinalStatus::STATUS_UNSPECIFIED}; + optimization_guide::proto::features::FinalStatus final_status_{ + optimization_guide::proto::features::FinalStatus::STATUS_UNSPECIFIED}; // Success status of a completed compose session, used for quality logging. - optimization_guide::proto::FinalModelStatus final_model_status_{ - optimization_guide::proto::FinalModelStatus:: + optimization_guide::proto::features::FinalModelStatus final_model_status_{ + optimization_guide::proto::features::FinalModelStatus:: FINAL_MODEL_STATUS_UNSPECIFIED}; // Tracks how long a session has been open. @@ -426,7 +426,8 @@ bool skip_feedback_ui_for_testing_ = false; - std::optional<optimization_guide::proto::ComposePageMetadata> page_metadata_; + std::optional<optimization_guide::proto::features::ComposePageMetadata> + page_metadata_; base::WeakPtrFactory<ComposeSession> weak_ptr_factory_; };
diff --git a/chrome/browser/controlled_frame/controlled_frame_wpt_browsertest.cc b/chrome/browser/controlled_frame/controlled_frame_wpt_browsertest.cc index eaf69817..0cca9ae 100644 --- a/chrome/browser/controlled_frame/controlled_frame_wpt_browsertest.cc +++ b/chrome/browser/controlled_frame/controlled_frame_wpt_browsertest.cc
@@ -34,7 +34,8 @@ "new_window.window.js", "no_callback.window.js", "scheme.window.js", - "user_agent_override.window.js"); + "user_agent_override.window.js", + "webrequest_event_handlers.window.js"); constexpr char kTestDirectory[] = "chrome/test/data/controlled_frame"; constexpr char kTestHarnessPath[] =
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc b/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc index c20294b..2979915 100644 --- a/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc +++ b/chrome/browser/extensions/api/autofill_private/autofill_private_api.cc
@@ -1113,7 +1113,8 @@ user_annotations::UserAnnotationsEntries response) { std::vector<autofill_private::UserAnnotationsEntry> result; result.reserve(response.size()); - for (optimization_guide::proto::UserAnnotationsEntry& entry : response) { + for (optimization_guide::proto::features::UserAnnotationsEntry& entry : + response) { result.emplace_back(); result.back().entry_id = entry.entry_id(); result.back().key = std::move(entry.key());
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_private_api_unittest.cc b/chrome/browser/extensions/api/autofill_private/autofill_private_api_unittest.cc index 161f18f..6ceefc0 100644 --- a/chrome/browser/extensions/api/autofill_private/autofill_private_api_unittest.cc +++ b/chrome/browser/extensions/api/autofill_private/autofill_private_api_unittest.cc
@@ -301,9 +301,9 @@ IN_PROC_BROWSER_TEST_F(AutofillPrivateApiUnitTest, RemoveUserAnnotationEntry) { // Seed user annotations service with entries. ASSERT_TRUE(RunAutofillSubtest("deleteUserAnnotationsEntry")); - optimization_guide::proto::UserAnnotationsEntry entry_1; + optimization_guide::proto::features::UserAnnotationsEntry entry_1; entry_1.set_entry_id(123); - optimization_guide::proto::UserAnnotationsEntry entry_2; + optimization_guide::proto::features::UserAnnotationsEntry entry_2; entry_2.set_entry_id(321); user_annotations_service()->ReplaceAllEntries({entry_1, entry_2}); EXPECT_EQ(GetAllUserAnnotationsEntries().size(), 2u); @@ -319,7 +319,7 @@ IN_PROC_BROWSER_TEST_F(AutofillPrivateApiUnitTest, RemoveAllUserAnnotations) { // Seed user annotations service with entries. - optimization_guide::proto::UserAnnotationsEntry entry; + optimization_guide::proto::features::UserAnnotationsEntry entry; entry.set_entry_id(0); user_annotations_service()->ReplaceAllEntries({entry}); EXPECT_EQ(GetAllUserAnnotationsEntries().size(), 1u);
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_private_apitest.cc b/chrome/browser/extensions/api/autofill_private/autofill_private_apitest.cc index 7df8052..4dcd4a05 100644 --- a/chrome/browser/extensions/api/autofill_private/autofill_private_apitest.cc +++ b/chrome/browser/extensions/api/autofill_private/autofill_private_apitest.cc
@@ -415,7 +415,7 @@ IN_PROC_BROWSER_TEST_F(AutofillPrivateApiTest, HasUserAnnotationsEntries_WithEntries) { - optimization_guide::proto::UserAnnotationsEntry entry; + optimization_guide::proto::features::UserAnnotationsEntry entry; entry.set_entry_id(1); user_annotations_service()->ReplaceAllEntries({entry}); EXPECT_TRUE(RunAutofillSubtest("hasUserAnnotationsEntries_WithEntries"))
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index a10b291..ddb84d829 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -30,6 +30,7 @@ #include "base/uuid.h" #include "chrome/browser/apps/app_service/app_launch_params.h" #include "chrome/browser/devtools/devtools_window.h" +#include "chrome/browser/extensions/account_extension_tracker.h" #include "chrome/browser/extensions/api/developer_private/extension_info_generator.h" #include "chrome/browser/extensions/chrome_zipfile_installer.h" #include "chrome/browser/extensions/crx_installer.h" @@ -38,6 +39,7 @@ #include "chrome/browser/extensions/extension_commands_global_registry.h" #include "chrome/browser/extensions/extension_management.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/extensions/extension_sync_util.h" #include "chrome/browser/extensions/extension_system_factory.h" #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/extensions/extension_util.h" @@ -54,6 +56,7 @@ #include "chrome/browser/platform_util.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/supervised_user/supervised_user_browser_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" @@ -72,6 +75,7 @@ #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" #include "components/policy/core/common/policy_pref_names.h" +#include "components/signin/public/identity_manager/identity_manager.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_frame_host.h" @@ -182,6 +186,9 @@ const char kCannotDismissExtensionOnUnsupportedStage[] = "Cannot dismiss the MV2 deprecation notice for extension with ID '*' on " "the unsupported stage."; +const char kUserNotSignedIn[] = "User is not signed in."; +const char kCannotUploadExtensionToAccount[] = + "Extension with ID '*' cannot be uploaded to the user's account."; const char kUnpackedAppsFolder[] = "apps_target"; const char kManifestFile[] = "manifest.json"; @@ -2935,6 +2942,96 @@ Respond(NoArguments()); } +DeveloperPrivateUploadExtensionToAccountFunction:: + DeveloperPrivateUploadExtensionToAccountFunction() = default; +DeveloperPrivateUploadExtensionToAccountFunction:: + ~DeveloperPrivateUploadExtensionToAccountFunction() = default; + +ExtensionFunction::ResponseAction +DeveloperPrivateUploadExtensionToAccountFunction::Run() { + auto params = developer::UploadExtensionToAccount::Params::Create(args()); + + EXTENSION_FUNCTION_VALIDATE(params); + extension_id_ = std::move(params->extension_id); + + const Extension* extension = + ExtensionRegistry::Get(browser_context()) + ->GetExtensionById(extension_id_, ExtensionRegistry::EVERYTHING); + if (!extension) { + return RespondNow(Error( + ErrorUtils::FormatErrorMessage(kNoExtensionError, extension_id_))); + } + + Profile* profile = Profile::FromBrowserContext(browser_context()); + + // Return an error if there is no signed in user. + signin::IdentityManager* identity_manager = + IdentityManagerFactory::GetForProfile(profile); + AccountInfo account_info = identity_manager->FindExtendedAccountInfo( + identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSignin)); + if (account_info.IsEmpty()) { + return RespondNow(Error(kUserNotSignedIn)); + } + + // Return an error if the extension cannot be uploaded for reasons such as: + // - syncing extensions in transport mode (signed in but not full sync) is + // disabled. + // - the extension is already associated with the signed in user's account. + // - the extension is not syncable (for example, if it's unpacked). + if (!sync_util::IsExtensionsExplicitSigninEnabled() || + !AccountExtensionTracker::Get(profile)->CanUploadAsAccountExtension( + *extension)) { + return RespondNow(Error(ErrorUtils::FormatErrorMessage( + kCannotUploadExtensionToAccount, extension_id_))); + } + + if (accept_bubble_for_testing_.has_value()) { + if (*accept_bubble_for_testing_) { + OnDialogAccepted(); + } else { + OnDialogCancelled(); + } + return AlreadyResponded(); + } + + content::WebContents* web_contents = GetSenderWebContents(); + if (!web_contents) { + return RespondNow(Error(kCouldNotFindWebContentsError)); + } + + Browser* browser = chrome::FindBrowserWithTab(web_contents); + if (!browser) { + return RespondNow(Error(kCouldNotFindWebContentsError)); + } + + ShowUploadExtensionToAccountDialog( + browser, *extension, + base::BindOnce( + &DeveloperPrivateUploadExtensionToAccountFunction::OnDialogAccepted, + this), + base::BindOnce( + &DeveloperPrivateUploadExtensionToAccountFunction::OnDialogCancelled, + this)); + + return RespondLater(); +} + +void DeveloperPrivateUploadExtensionToAccountFunction::OnDialogAccepted() { + // We cannot proceed if the `browser_context` is not valid as the relevant + // classes needed to upload the extension will not exist. + if (!browser_context()) { + return; + } + + // TODO(crbug.com/381127648): Upload the associated `extension_id_` to the + // user's account once the dialog is accepted. + Respond(NoArguments()); +} + +void DeveloperPrivateUploadExtensionToAccountFunction::OnDialogCancelled() { + Respond(NoArguments()); +} + } // namespace api } // namespace extensions
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h index 864288d..ead363f 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.h +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -1098,6 +1098,40 @@ std::optional<bool> accept_bubble_for_testing_; }; +class DeveloperPrivateUploadExtensionToAccountFunction + : public DeveloperPrivateAPIFunction { + public: + DECLARE_EXTENSION_FUNCTION("developerPrivate.uploadExtensionToAccount", + DEVELOPERPRIVATE_UPLOADEXTENSIONTOACCOUNT) + DeveloperPrivateUploadExtensionToAccountFunction(); + + DeveloperPrivateUploadExtensionToAccountFunction( + const DeveloperPrivateUploadExtensionToAccountFunction&) = delete; + DeveloperPrivateUploadExtensionToAccountFunction& operator=( + const DeveloperPrivateUploadExtensionToAccountFunction&) = delete; + + void accept_bubble_for_testing(bool accept_bubble) { + accept_bubble_for_testing_ = accept_bubble; + } + + private: + ~DeveloperPrivateUploadExtensionToAccountFunction() override; + + ResponseAction Run() override; + + // A callback function to run when the user accepts the action dialog. + void OnDialogAccepted(); + + // A callback function to run when the user cancels the action dialog. + void OnDialogCancelled(); + + // The ID of the extension to be uploaded. + ExtensionId extension_id_; + + // If true, immediately accepts the keep dialog by running the callback. + std::optional<bool> accept_bubble_for_testing_; +}; + } // namespace api } // namespace extensions
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc index 7d60d00c..9069a56 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
@@ -23,6 +23,7 @@ #include "base/test/gtest_util.h" #include "base/test/values_test_util.h" #include "base/values.h" +#include "chrome/browser/extensions/account_extension_tracker.h" #include "chrome/browser/extensions/api/developer_private/extension_info_generator.h" #include "chrome/browser/extensions/chrome_test_extension_loader.h" #include "chrome/browser/extensions/error_console/error_console.h" @@ -32,12 +33,15 @@ #include "chrome/browser/extensions/extension_management_test_util.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service_test_with_install.h" +#include "chrome/browser/extensions/extension_sync_util.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/manifest_v2_experiment_manager.h" #include "chrome/browser/extensions/permissions/permissions_test_util.h" #include "chrome/browser/extensions/permissions/permissions_updater.h" #include "chrome/browser/extensions/permissions/scripting_permissions_modifier.h" #include "chrome/browser/extensions/permissions/site_permissions_helper.h" +#include "chrome/browser/signin/identity_manager_factory.h" +#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" #include "chrome/browser/supervised_user/supervised_user_browser_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/extensions/extension_install_ui.h" @@ -47,7 +51,11 @@ #include "chrome/test/base/test_browser_window.h" #include "components/crx_file/id_util.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" +#include "components/signin/public/base/signin_pref_names.h" +#include "components/signin/public/base/signin_switches.h" +#include "components/signin/public/identity_manager/identity_manager.h" #include "components/supervised_user/core/common/features.h" +#include "components/sync/base/features.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "content/public/test/mock_render_process_host.h" #include "content/public/test/web_contents_tester.h" @@ -3333,4 +3341,129 @@ EXPECT_TRUE(experiment_manager->DidUserAcknowledgeNotice(extension->id())); } +class DeveloperPrivateApiTransportModeUnitTest + : public DeveloperPrivateApiUnitTest { + public: + DeveloperPrivateApiTransportModeUnitTest() { + scoped_feature_list_.InitWithFeatures( + {switches::kExplicitBrowserSigninUIOnDesktop, + syncer::kSyncEnableExtensionsInTransportMode}, + /*disabled_features=*/{}); + } + + DeveloperPrivateApiTransportModeUnitTest( + const DeveloperPrivateApiTransportModeUnitTest&) = delete; + DeveloperPrivateApiTransportModeUnitTest& operator=( + const DeveloperPrivateApiTransportModeUnitTest&) = delete; + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +// Test that extensions cannot be uploaded if the user is signed out. +TEST_F(DeveloperPrivateApiTransportModeUnitTest, + UploadExtensionToAccount_SignedOut) { + const scoped_refptr<const Extension> extension = + ExtensionBuilder("ext") + .SetLocation(mojom::ManifestLocation::kInternal) + .Build(); + service()->AddExtension(extension.get()); + + std::string args = base::StringPrintf(R"(["%s"])", extension->id().c_str()); + auto upload_function = base::MakeRefCounted< + api::DeveloperPrivateUploadExtensionToAccountFunction>(); + upload_function->set_source_context_type(mojom::ContextType::kWebUi); + + std::string error = api_test_utils::RunFunctionAndReturnError( + upload_function, args, profile()); + EXPECT_EQ(error, "User is not signed in."); +} + +TEST_F(DeveloperPrivateApiTransportModeUnitTest, + UploadExtensionToAccount_UnsyncableExtension) { + // Add an unsyncable (unpacked) extension. + const scoped_refptr<const Extension> unsyncable_extension = + ExtensionBuilder("unsync_ext") + .SetLocation(mojom::ManifestLocation::kUnpacked) + .Build(); + EXPECT_FALSE(sync_util::ShouldSync(profile(), unsyncable_extension.get())); + service()->AddExtension(unsyncable_extension.get()); + + // Sign the user in without full sync. + auto identity_test_env_profile_adaptor = + std::make_unique<IdentityTestEnvironmentProfileAdaptor>(profile()); + identity_test_env_profile_adaptor->identity_test_env() + ->MakePrimaryAccountAvailable("testy@mctestface.com", + signin::ConsentLevel::kSignin); + // Pretend that the user has completed an explicit sign in before. This is + // necessary for extensions to sync in transport mode. + profile()->GetPrefs()->SetBoolean(prefs::kExplicitBrowserSignin, true); + + std::string args_str = + base::StringPrintf(R"(["%s"])", unsyncable_extension->id().c_str()); + auto upload_function = base::MakeRefCounted< + api::DeveloperPrivateUploadExtensionToAccountFunction>(); + upload_function->set_source_context_type(mojom::ContextType::kWebUi); + + // The unsyncable extension cannot be uploaded. + std::string error = api_test_utils::RunFunctionAndReturnError( + upload_function, args_str, profile()); + EXPECT_EQ( + error, + ErrorUtils::FormatErrorMessage( + "Extension with ID '*' cannot be uploaded to the user's account.", + unsyncable_extension->id())); +} + +TEST_F(DeveloperPrivateApiTransportModeUnitTest, UploadExtensionToAccount) { + // Add a syncable extension. + const scoped_refptr<const Extension> syncable_extension = + ExtensionBuilder("sync_ext") + .SetLocation(mojom::ManifestLocation::kInternal) + .Build(); + EXPECT_TRUE(sync_util::ShouldSync(profile(), syncable_extension.get())); + service()->AddExtension(syncable_extension.get()); + + // Sign the user in without full sync. + auto identity_test_env_profile_adaptor = + std::make_unique<IdentityTestEnvironmentProfileAdaptor>(profile()); + identity_test_env_profile_adaptor->identity_test_env() + ->MakePrimaryAccountAvailable("testy@mctestface.com", + signin::ConsentLevel::kSignin); + // Pretend that the user has completed an explicit sign in before. This is + // necessary for extensions to sync in transport mode. + profile()->GetPrefs()->SetBoolean(prefs::kExplicitBrowserSignin, true); + + // The syncable extension can be uploaded, but pretend we don't proceed with + // the upload by simulating cancelling the dialog. + base::Value::List args; + args.Append(syncable_extension->id()); + auto upload_function = base::MakeRefCounted< + api::DeveloperPrivateUploadExtensionToAccountFunction>(); + upload_function->set_source_context_type(mojom::ContextType::kWebUi); + upload_function->accept_bubble_for_testing(false); + EXPECT_TRUE(RunFunction(upload_function, args)); + + // Now pretend the extension is already associated with the user's account. + AccountExtensionTracker::Get(profile())->SetAccountExtensionTypeForTesting( + syncable_extension->id(), + AccountExtensionTracker::AccountExtensionType::kAccountInstalledSignedIn); + + std::string args_str = + base::StringPrintf(R"(["%s"])", syncable_extension->id().c_str()); + upload_function = base::MakeRefCounted< + api::DeveloperPrivateUploadExtensionToAccountFunction>(); + upload_function->set_source_context_type(mojom::ContextType::kWebUi); + + // The extension shouldn't be able to be uploaded since it's now already + // associated with the user's account and thus already "uploaded". + std::string error = api_test_utils::RunFunctionAndReturnError( + upload_function, args_str, profile()); + EXPECT_EQ( + error, + ErrorUtils::FormatErrorMessage( + "Extension with ID '*' cannot be uploaded to the user's account.", + syncable_extension->id())); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc index 40ef8cf1..adc1b7b0b 100644 --- a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc +++ b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc
@@ -25,6 +25,7 @@ #include "chrome/browser/extensions/extension_allowlist.h" #include "chrome/browser/extensions/extension_safety_check_utils.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/extensions/extension_sync_util.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/manifest_v2_experiment_manager.h" #include "chrome/browser/extensions/mv2_experiment_stage.h" @@ -41,7 +42,6 @@ #include "chrome/grit/generated_resources.h" #include "components/supervised_user/core/browser/supervised_user_preferences.h" #include "components/supervised_user/core/common/pref_names.h" -#include "components/sync/base/features.h" #include "content/public/browser/render_frame_host.h" #include "extensions/browser/blocklist_extension_prefs.h" #include "extensions/browser/blocklist_state.h" @@ -838,8 +838,7 @@ // `CanUploadAsAccountExtension` should already check for the feature flag // somewhere but add another guard for it here just in case. info->can_upload_as_account_extension = - base::FeatureList::IsEnabled( - syncer::kSyncEnableExtensionsInTransportMode) && + sync_util::IsExtensionsExplicitSigninEnabled() && AccountExtensionTracker::Get(profile)->CanUploadAsAccountExtension( extension);
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc index da2ce51b..dad846a2 100644 --- a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc +++ b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
@@ -48,6 +48,7 @@ #include "chrome/grit/generated_resources.h" #include "components/crx_file/id_util.h" #include "components/signin/public/base/signin_pref_names.h" +#include "components/signin/public/base/signin_switches.h" #include "components/signin/public/identity_manager/identity_test_environment.h" #include "components/signin/public/identity_manager/identity_test_utils.h" #include "components/supervised_user/core/common/features.h" @@ -1274,8 +1275,9 @@ TEST_F(ExtensionInfoGeneratorUnitTest, UploadAsAccountExtension_TransportMode) { // Allow extensions to sync in transport mode. base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature( - syncer::kSyncEnableExtensionsInTransportMode); + feature_list.InitWithFeatures({switches::kExplicitBrowserSigninUIOnDesktop, + syncer::kSyncEnableExtensionsInTransportMode}, + /*disabled_features=*/{}); // Sign the user in without full sync. auto identity_test_env_profile_adaptor =
diff --git a/chrome/browser/extensions/content_capabilities_browsertest.cc b/chrome/browser/extensions/content_capabilities_browsertest.cc index 58aa1268..3a3e0dfa 100644 --- a/chrome/browser/extensions/content_capabilities_browsertest.cc +++ b/chrome/browser/extensions/content_capabilities_browsertest.cc
@@ -251,15 +251,8 @@ // script without a user gesture. EXPECT_TRUE( CanWriteClipboard(extension.get(), GetTestURLFor("bar.example.com"))); - if (base::FeatureList::IsEnabled( - features::kUserActivationSameOriginVisibility)) { - EXPECT_TRUE(CanWriteClipboardInAboutBlankFrame( - extension.get(), GetTestURLFor("bar.example.com"))); - } else { - // In UserActivationV2, acitvation doesn't propagate to a child frame. - EXPECT_FALSE(CanWriteClipboardInAboutBlankFrame( - extension.get(), GetTestURLFor("bar.example.com"))); - } + EXPECT_TRUE(CanWriteClipboardInAboutBlankFrame( + extension.get(), GetTestURLFor("bar.example.com"))); EXPECT_FALSE( CanReadClipboard(extension.get(), GetTestURLFor("foo.example.com")));
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 9cb28c9..10ba9dfe 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -833,11 +833,6 @@ "expiry_milestone": 135 }, { - "name": "autofill-upstream-updated-ui", - "owners": ["jsaul@google.com", "payments-autofill-team@google.com"], - "expiry_milestone": 135 - }, - { "name": "autofill-vcn-enroll-request-timeout", "owners": ["smcgruer@google.com", "chrome-payments-team@google.com"], "expiry_milestone": 135 @@ -1393,6 +1388,11 @@ "expiry_milestone": 138 }, { + "name": "cert-management-v2-ui-edit-certs", + "owners": [ "hchao@chromium.org", "mattm@chromium.org", "chrome-secure-web-and-net@google.com" ], + "expiry_milestone": 145 + }, + { "name": "cert-management-v2-ui-write", "owners": [ "hchao@chromium.org", "mattm@chromium.org", "chrome-secure-web-and-net@google.com" ], "expiry_milestone": 145 @@ -2555,6 +2555,11 @@ "owners": [ "tbansal@chromium.org", "chrome-intelligence-core@chromium.org"], "expiry_milestone":120 }, + { + "name": "enable-chrome-refresh-token-binding", + "owners": ["alexilin@chromium.org", "chrome-signin-team@google.com"], + "expiry_milestone": 138 + }, {"name": "enable-chromeos-live-translate", "owners": ["robsc@chromium.org", "amoylan@chromium.org", "zufeng@google.com"], "expiry_milestone": 145
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 75dd7f3c..5b4c755 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -780,12 +780,6 @@ "upload request. Upon timeout, the client will terminate the upload UI, " "but the request may still succeed server-side."; -const char kAutofillUpstreamUpdatedUiName[] = - "Credit card upload save UI treatment"; -const char kAutofillUpstreamUpdatedUiDescription[] = - "When enabled, shows different text and images in the UI of the credit " - "card upload save bubble."; - const char kAutofillVcnEnrollRequestTimeoutName[] = "Timeout for the credit card VCN enrollment request"; const char kAutofillVcnEnrollRequestTimeoutDescription[] = @@ -8172,8 +8166,13 @@ const char kEnableBoundSessionCredentialsSoftwareKeysForManualTestingDescription[] = "Enables mock software-backed cryptographic keys for Google session " - "credentials binding (not secure). This is intended to be used for " - "manual testing only."; + "credentials binding and Chrome refresh tokens binding (not secure). " + "This is intended to be used for manual testing only."; + +const char kEnableChromeRefreshTokenBindingName[] = + "Chrome Refresh Token Binding"; +const char kEnableChromeRefreshTokenBindingDescription[] = + "Enables binding of Chrome refresh tokens to cryptographic keys."; #endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS) const char kEnableStandardBoundSessionCredentialsName[] = @@ -8201,6 +8200,11 @@ "For Linux and ChromeOS, this is a change as previously user-added certs " "would be written to the platform cert store. The UI is accessible at " "chrome://certificate-manager"; +const char kEnableCertManagementV2UIEditCertsName[] = + "Cert Management V2 UI Edit Certs"; +const char kEnableCertManagementV2UIEditCertsDescription[] = + "Enables the ability to edit trust and constraints on the cert viewer " + "for user-added certs that are added via chrome://certificate-manager"; #endif // BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI) #if !BUILDFLAG(IS_ANDROID)
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 9db240a..06da2bf 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -455,9 +455,6 @@ extern const char kAutofillUploadCardRequestTimeoutName[]; extern const char kAutofillUploadCardRequestTimeoutDescription[]; -extern const char kAutofillUpstreamUpdatedUiName[]; -extern const char kAutofillUpstreamUpdatedUiDescription[]; - extern const char kAutofillVcnEnrollRequestTimeoutName[]; extern const char kAutofillVcnEnrollRequestTimeoutDescription[]; @@ -4789,6 +4786,9 @@ kEnableBoundSessionCredentialsSoftwareKeysForManualTestingName[]; extern const char kEnableBoundSessionCredentialsSoftwareKeysForManualTestingDescription[]; + +extern const char kEnableChromeRefreshTokenBindingName[]; +extern const char kEnableChromeRefreshTokenBindingDescription[]; #endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS) extern const char kEnableStandardBoundSessionCredentialsName[]; @@ -4801,6 +4801,8 @@ extern const char kEnableCertManagementV2UIDescription[]; extern const char kEnableCertManagementV2UIWriteName[]; extern const char kEnableCertManagementV2UIWriteDescription[]; +extern const char kEnableCertManagementV2UIEditCertsName[]; +extern const char kEnableCertManagementV2UIEditCertsDescription[]; #endif // BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI) #if BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/glic/BUILD.gn b/chrome/browser/glic/BUILD.gn index f2a0397d..0fa5555f 100644 --- a/chrome/browser/glic/BUILD.gn +++ b/chrome/browser/glic/BUILD.gn
@@ -45,6 +45,7 @@ "//chrome/browser/ui:browser_list", "//chrome/browser/ui:browser_navigator_params_headers", "//chrome/common", + "//components/favicon/content:content", "//components/guest_view/browser", "//components/sessions", "//url",
diff --git a/chrome/browser/glic/glic_page_context_fetcher.cc b/chrome/browser/glic/glic_page_context_fetcher.cc index 65c3495..bbc3015 100644 --- a/chrome/browser/glic/glic_page_context_fetcher.cc +++ b/chrome/browser/glic/glic_page_context_fetcher.cc
@@ -9,6 +9,7 @@ #include "base/task/thread_pool.h" #include "chrome/browser/content_extraction/inner_text.h" #include "chrome/browser/ui/webui/glic/glic.mojom.h" +#include "components/favicon/content/content_favicon_driver.h" #include "components/sessions/content/session_tab_helper.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" @@ -18,13 +19,23 @@ namespace glic { namespace { -glic::mojom::TabDataPtr GetTabData(content::WebContents* web_contents) { + +glic::mojom::TabDataPtr GetTabData(content::WebContents& web_contents) { + SkBitmap favicon; + auto* favicon_driver = + favicon::ContentFaviconDriver::FromWebContents(&web_contents); + if (favicon_driver) { + if (favicon_driver->FaviconIsValid()) { + favicon = favicon_driver->GetFavicon().AsBitmap(); + } + } return glic::mojom::TabData::New( - sessions::SessionTabHelper::IdForTab(web_contents).id(), - sessions::SessionTabHelper::IdForWindowContainingTab(web_contents).id(), - web_contents->GetLastCommittedURL(), - base::UTF16ToUTF8(web_contents->GetTitle())); + sessions::SessionTabHelper::IdForTab(&web_contents).id(), + sessions::SessionTabHelper::IdForWindowContainingTab(&web_contents).id(), + web_contents.GetLastCommittedURL(), + base::UTF16ToUTF8(web_contents.GetTitle()), favicon); } + } // namespace GlicPageContextFetcher::GlicPageContextFetcher() = default; @@ -132,7 +143,7 @@ if (web_contents() && web_contents()->GetPrimaryMainFrame() && !primary_page_changed_) { auto tab_context = mojom::TabContext::New(); - tab_context->tab_data = GetTabData(web_contents()); + tab_context->tab_data = GetTabData(*web_contents()); // TODO(crbug.com/379773651): Clean up logspam when it's no longer useful. LOG(WARNING) << "GlicPageContextFetcher: Returning context for " << tab_context->tab_data->url;
diff --git a/chrome/browser/glic/glic_profile_manager.cc b/chrome/browser/glic/glic_profile_manager.cc index 31df4a16..4c5b36aa 100644 --- a/chrome/browser/glic/glic_profile_manager.cc +++ b/chrome/browser/glic/glic_profile_manager.cc
@@ -7,10 +7,26 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/glic/glic_keyed_service_factory.h" #include "chrome/browser/global_features.h" +#include "chrome/browser/lifetime/termination_notification.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" namespace glic { + +namespace { + +// Ensures that the window is closed early enough (if we don't do this, we +// won't have cleaned up by the time that keyed services are destroyed). +void OnAppTerminating() { + GlicProfileManager* mgr = GlicProfileManager::GetInstance(); + if (!mgr) { + return; + } + mgr->CloseGlicWindow(); +} + +} // namespace + GlicProfileManager* GlicProfileManager::GetInstance() { return g_browser_process->GetFeatures()->glic_profile_manager(); } @@ -34,7 +50,9 @@ active_glic_ = glic->GetWeakPtr(); } -GlicProfileManager::GlicProfileManager() = default; +GlicProfileManager::GlicProfileManager() + : termination_subscription_(browser_shutdown::AddAppTerminatingCallback( + base::BindOnce(&OnAppTerminating))) {} GlicProfileManager::~GlicProfileManager() = default;
diff --git a/chrome/browser/glic/glic_profile_manager.h b/chrome/browser/glic/glic_profile_manager.h index 58b5d5b6..3439002 100644 --- a/chrome/browser/glic/glic_profile_manager.h +++ b/chrome/browser/glic/glic_profile_manager.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_GLIC_GLIC_PROFILE_MANAGER_H_ #define CHROME_BROWSER_GLIC_GLIC_PROFILE_MANAGER_H_ +#include "base/callback_list.h" #include "base/memory/raw_ptr.h" #include "chrome/browser/glic/glic_keyed_service.h" @@ -38,6 +39,7 @@ private: base::WeakPtr<GlicKeyedService> active_glic_; + base::CallbackListSubscription termination_subscription_; }; } // namespace glic
diff --git a/chrome/browser/history_embeddings/history_embeddings_service_browsertest.cc b/chrome/browser/history_embeddings/history_embeddings_service_browsertest.cc index 552e61e..e374a83 100644 --- a/chrome/browser/history_embeddings/history_embeddings_service_browsertest.cc +++ b/chrome/browser/history_embeddings/history_embeddings_service_browsertest.cc
@@ -349,8 +349,9 @@ }; service()->SendQualityLog( result, {1}, 3, - optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED, - optimization_guide::proto::UiSurface::UI_SURFACE_HISTORY_PAGE); + optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED, + optimization_guide::proto::features::UiSurface::UI_SURFACE_HISTORY_PAGE); histogram_tester.ExpectUniqueSample( "History.Embeddings.Quality.LogEntryPrepared", true, 1); }
diff --git a/chrome/browser/metrics/lacros_metrics_provider.cc b/chrome/browser/metrics/lacros_metrics_provider.cc index 7279572..9cf0646 100644 --- a/chrome/browser/metrics/lacros_metrics_provider.cc +++ b/chrome/browser/metrics/lacros_metrics_provider.cc
@@ -9,8 +9,6 @@ #include "base/metrics/histogram_macros.h" #include "chrome/browser/metrics/enrollment_status.h" #include "chromeos/crosapi/mojom/crosapi.mojom.h" -#include "chromeos/crosapi/mojom/metrics.mojom.h" -#include "chromeos/lacros/lacros_service.h" #include "chromeos/startup/browser_params_proxy.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_recorder.h" @@ -38,14 +36,7 @@ } // namespace -LacrosMetricsProvider::LacrosMetricsProvider() : weak_ptr_factory_(this) { - auto* lacros_service = chromeos::LacrosService::Get(); - if (lacros_service->IsAvailable<crosapi::mojom::Metrics>()) { - lacros_service->GetRemote<crosapi::mojom::Metrics>()->GetFullHardwareClass( - base::BindOnce(&LacrosMetricsProvider::OnGetFullHardwareClass, - weak_ptr_factory_.GetWeakPtr())); - } -} +LacrosMetricsProvider::LacrosMetricsProvider() = default; LacrosMetricsProvider::~LacrosMetricsProvider() = default; @@ -71,14 +62,3 @@ .SetEnrollmentStatus(static_cast<int64_t>(status)) .Record(ukm::UkmRecorder::Get()); } - -void LacrosMetricsProvider::ProvideSystemProfileMetrics( - metrics::SystemProfileProto* proto) { - metrics::SystemProfileProto::Hardware* hardware = proto->mutable_hardware(); - hardware->set_full_hardware_class(full_hardware_class_); -} - -void LacrosMetricsProvider::OnGetFullHardwareClass( - const std::string& full_hardware_class) { - full_hardware_class_ = full_hardware_class; -}
diff --git a/chrome/browser/metrics/lacros_metrics_provider.h b/chrome/browser/metrics/lacros_metrics_provider.h index 18a5f38..f6c3ea2 100644 --- a/chrome/browser/metrics/lacros_metrics_provider.h +++ b/chrome/browser/metrics/lacros_metrics_provider.h
@@ -14,6 +14,7 @@ // Provides metrics for the lacros-chrome binary. // NOTE: The ash-chrome binary uses ChromeOSMetricsProvider. +// TODO(crbug.com/373971535): Delete this class. class LacrosMetricsProvider : public metrics::MetricsProvider { public: LacrosMetricsProvider(); @@ -27,17 +28,9 @@ void ProvideCurrentSessionData( metrics::ChromeUserMetricsExtension* uma_proto) override; void ProvideCurrentSessionUKMData() override; - void ProvideSystemProfileMetrics(metrics::SystemProfileProto* proto) override; private: - // Called after the hardware class is available. - void OnGetFullHardwareClass(const std::string& full_hardware_class); - - // This class caches the full_hardware_class as fetching it is asynchronous - // but it must be provided synchronously in ProvideSystemProfileMetrics. - std::string full_hardware_class_; - base::WeakPtrFactory<LacrosMetricsProvider> weak_ptr_factory_; }; -#endif // CHROME_BROWSER_METRICS_LACROS_METRICS_PROVIDER_H_ +#endif // CHROME_BROWSER_METRICS_LACROS_METRICS_PROVIDER_H_
diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc index 3c404e1..7fc38c2 100644 --- a/chrome/browser/net/profile_network_context_service.cc +++ b/chrome/browser/net/profile_network_context_service.cc
@@ -525,10 +525,7 @@ registry->RegisterBooleanPref(prefs::kCAPlatformIntegrationEnabled, true); #endif #if BUILDFLAG(IS_CHROMEOS) - registry->RegisterIntegerPref( - prefs::kNSSCertsMigratedToServerCertDb, - static_cast<int>(net::ServerCertificateDatabaseService:: - NSSMigrationResultPref::kNotMigrated)); + net::ServerCertificateDatabaseService::RegisterProfilePrefs(registry); #endif }
diff --git a/chrome/browser/net/server_certificate_database_nss_migrator.cc b/chrome/browser/net/server_certificate_database_nss_migrator.cc index ab525cf9..3723b10 100644 --- a/chrome/browser/net/server_certificate_database_nss_migrator.cc +++ b/chrome/browser/net/server_certificate_database_nss_migrator.cc
@@ -9,11 +9,7 @@ #include "base/strings/string_number_conversions.h" #include "base/task/bind_post_task.h" #include "base/task/thread_pool.h" -#include "chrome/browser/net/nss_service.h" -#include "chrome/browser/net/nss_service_factory.h" #include "chrome/browser/net/server_certificate_database_service.h" -#include "chrome/browser/net/server_certificate_database_service_factory.h" -#include "chrome/browser/profiles/profile.h" #include "content/public/browser/browser_thread.h" #include "crypto/scoped_nss_types.h" #include "crypto/sha2.h" @@ -85,7 +81,7 @@ } void GetNSSCertDatabaseOnIOThread( - NssCertDatabaseGetter database_getter, + ServerCertificateDatabaseNSSMigrator::NssCertDatabaseGetter database_getter, base::OnceCallback< void(std::vector<net::PlatformTrustStore::CertWithTrust>)> callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); @@ -105,8 +101,10 @@ } // namespace ServerCertificateDatabaseNSSMigrator::ServerCertificateDatabaseNSSMigrator( - Profile* profile) - : profile_(profile) {} + net::ServerCertificateDatabaseService* cert_db_service, + NssCertDatabaseGetter nss_cert_db_getter) + : cert_db_service_(cert_db_service), + nss_cert_db_getter_(std::move(nss_cert_db_getter)) {} ServerCertificateDatabaseNSSMigrator::~ServerCertificateDatabaseNSSMigrator() = default; @@ -117,9 +115,7 @@ content::GetIOThreadTaskRunner({})->PostTask( FROM_HERE, base::BindOnce( - &GetNSSCertDatabaseOnIOThread, - NssServiceFactory::GetForContext(profile_) - ->CreateNSSCertDatabaseGetterForIOThread(), + &GetNSSCertDatabaseOnIOThread, std::move(nss_cert_db_getter_), base::BindPostTaskToCurrentDefault(base::BindOnce( &ServerCertificateDatabaseNSSMigrator::GotCertsFromNSS, weak_ptr_factory_.GetWeakPtr(), std::move(callback))))); @@ -130,11 +126,7 @@ std::vector<net::PlatformTrustStore::CertWithTrust> certs_to_migrate) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - net::ServerCertificateDatabaseService* cert_db_service = - net::ServerCertificateDatabaseServiceFactory::GetForBrowserContext( - profile_); - - cert_db_service->PostTaskWithDatabase(base::BindOnce( + cert_db_service_->PostTaskWithDatabase(base::BindOnce( &MigrateCertsOnBackgroundThread, std::move(certs_to_migrate), base::BindPostTaskToCurrentDefault(base::BindOnce( &ServerCertificateDatabaseNSSMigrator::FinishedMigration,
diff --git a/chrome/browser/net/server_certificate_database_nss_migrator.h b/chrome/browser/net/server_certificate_database_nss_migrator.h index 8166d50..76a67e1e 100644 --- a/chrome/browser/net/server_certificate_database_nss_migrator.h +++ b/chrome/browser/net/server_certificate_database_nss_migrator.h
@@ -5,14 +5,15 @@ #ifndef CHROME_BROWSER_NET_SERVER_CERTIFICATE_DATABASE_NSS_MIGRATOR_H_ #define CHROME_BROWSER_NET_SERVER_CERTIFICATE_DATABASE_NSS_MIGRATOR_H_ -#include "base/functional/callback_forward.h" +#include "base/functional/callback.h" #include "base/memory/weak_ptr.h" #include "net/cert/internal/platform_trust_store.h" -class Profile; - namespace net { +class NSSCertDatabase; +class ServerCertificateDatabaseService; + // Migrates server-related certificates from an NSS user database into // ServerCertificateDatabase. // Does not migrate client certificates as those are handled by Kcer and a @@ -29,7 +30,15 @@ }; using ResultCallback = base::OnceCallback<void(MigrationResult)>; - explicit ServerCertificateDatabaseNSSMigrator(Profile* profile); + // NssCertDatabaseGetter here has the same definition and usage requirements + // as in chrome/browser/net/nss_service.h but the alias is redefined here + // because we can't include that file directly. + using NssCertDatabaseGetter = base::OnceCallback<net::NSSCertDatabase*( + base::OnceCallback<void(net::NSSCertDatabase*)> callback)>; + + explicit ServerCertificateDatabaseNSSMigrator( + ServerCertificateDatabaseService* cert_db_service, + NssCertDatabaseGetter nss_cert_db_getter); ~ServerCertificateDatabaseNSSMigrator(); // Begins migration process. `callback` will be run on the calling thread when @@ -45,7 +54,8 @@ std::vector<net::PlatformTrustStore::CertWithTrust> certs_to_migrate); void FinishedMigration(ResultCallback callback, MigrationResult result); - const raw_ptr<Profile> profile_; + raw_ptr<ServerCertificateDatabaseService> cert_db_service_; + NssCertDatabaseGetter nss_cert_db_getter_; base::WeakPtrFactory<ServerCertificateDatabaseNSSMigrator> weak_ptr_factory_{ this}; };
diff --git a/chrome/browser/net/server_certificate_database_nss_migrator_unittest.cc b/chrome/browser/net/server_certificate_database_nss_migrator_unittest.cc index ec1a411..315d865 100644 --- a/chrome/browser/net/server_certificate_database_nss_migrator_unittest.cc +++ b/chrome/browser/net/server_certificate_database_nss_migrator_unittest.cc
@@ -4,16 +4,18 @@ #include "chrome/browser/net/server_certificate_database_nss_migrator.h" +#include "base/files/scoped_temp_dir.h" +#include "base/test/scoped_feature_list.h" #include "base/test/test_future.h" -#include "chrome/browser/net/fake_nss_service.h" #include "chrome/browser/net/server_certificate_database.h" #include "chrome/browser/net/server_certificate_database.pb.h" #include "chrome/browser/net/server_certificate_database_service.h" -#include "chrome/browser/net/server_certificate_database_service_factory.h" #include "chrome/browser/net/server_certificate_database_test_util.h" #include "chrome/common/chrome_features.h" -#include "chrome/test/base/testing_profile.h" +#include "components/prefs/testing_pref_service.h" +#include "content/public/browser/browser_thread.h" #include "content/public/test/browser_task_environment.h" +#include "crypto/scoped_test_nss_db.h" #include "net/cert/nss_cert_database.h" #include "net/cert/x509_util_nss.h" #include "net/test/cert_builder.h" @@ -26,31 +28,58 @@ namespace net { +namespace { + +net::NSSCertDatabase* NssGetterForIOThread( + net::NSSCertDatabase* result, + base::OnceCallback<void(net::NSSCertDatabase*)>) { + // The check is here because the real NSS getter must also be run on the IO + // thread. + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + return result; +} + +} // namespace + class ServerCertificateDatabaseNSSMigratorTest : public testing::Test { public: void SetUp() override { - profile_ = TestingProfile::Builder().Build(); - - nss_service_ = FakeNssService::InitializeForBrowserContext( - profile_.get(), - /*enable_system_slot=*/false); + ServerCertificateDatabaseService::RegisterProfilePrefs( + pref_service_.registry()); + ASSERT_TRUE(temp_profile_dir_.CreateUniqueTempDir()); + test_nss_slot_ = std::make_unique<crypto::ScopedTestNSSDB>(); + ASSERT_TRUE(test_nss_slot_->is_open()); + nss_cert_database_ = std::make_unique<NSSCertDatabase>( + crypto::ScopedPK11Slot(PK11_ReferenceSlot(test_nss_slot_->slot())), + crypto::ScopedPK11Slot(PK11_ReferenceSlot(test_nss_slot_->slot()))); } - void TearDown() override { nss_service_ = nullptr; } + std::unique_ptr<net::ServerCertificateDatabaseService> CreateService() { + return std::make_unique<ServerCertificateDatabaseService>( + temp_profile_dir_.GetPath(), &pref_service_, + base::BindOnce(NssGetterForIOThread, nss_cert_database_.get())); + } - TestingProfile* profile() { return profile_.get(); } - FakeNssService* nss_service() { return nss_service_; } + PrefService* pref_service() { return &pref_service_; } + NSSCertDatabase* nss_cert_database() { return nss_cert_database_.get(); } private: base::test::ScopedFeatureList feature_list_{ features::kEnableCertManagementUIV2Write}; content::BrowserTaskEnvironment task_environment_; - std::unique_ptr<TestingProfile> profile_; - raw_ptr<FakeNssService> nss_service_; + base::ScopedTempDir temp_profile_dir_; + TestingPrefServiceSimple pref_service_; + std::unique_ptr<crypto::ScopedTestNSSDB> test_nss_slot_; + std::unique_ptr<net::NSSCertDatabase> nss_cert_database_; }; TEST_F(ServerCertificateDatabaseNSSMigratorTest, MigrateEmptyNssDb) { - ServerCertificateDatabaseNSSMigrator migrator(profile()); + std::unique_ptr<net::ServerCertificateDatabaseService> cert_db_service = + CreateService(); + ServerCertificateDatabaseNSSMigrator migrator( + cert_db_service.get(), + base::BindOnce(NssGetterForIOThread, nss_cert_database())); + base::test::TestFuture<ServerCertificateDatabaseNSSMigrator::MigrationResult> migrate_certs_waiter; migrator.MigrateCerts(migrate_certs_waiter.GetCallback()); @@ -59,9 +88,6 @@ EXPECT_EQ(0, result.cert_count); EXPECT_EQ(0, result.error_count); - net::ServerCertificateDatabaseService* cert_db_service = - net::ServerCertificateDatabaseServiceFactory::GetForBrowserContext( - profile()); base::test::TestFuture< std::vector<net::ServerCertificateDatabase::CertInformation>> get_certs_waiter; @@ -76,24 +102,20 @@ auto [leaf, intermediate, root] = CertBuilder::CreateSimpleChain3(); // Import test certificates into NSS user database. - base::test::TestFuture<net::NSSCertDatabase*> nss_waiter; - nss_service()->UnsafelyGetNSSCertDatabaseForTesting(nss_waiter.GetCallback()); - net::NSSCertDatabase* nss_db = nss_waiter.Get(); - NSSCertDatabase::ImportCertFailureList not_imported; - EXPECT_TRUE(nss_db->ImportServerCert( + EXPECT_TRUE(nss_cert_database()->ImportServerCert( x509_util::CreateCERTCertificateListFromX509Certificate( leaf->GetX509Certificate().get()), NSSCertDatabase::DISTRUSTED_SSL, ¬_imported)); EXPECT_TRUE(not_imported.empty()); - EXPECT_TRUE(nss_db->ImportCACerts( + EXPECT_TRUE(nss_cert_database()->ImportCACerts( x509_util::CreateCERTCertificateListFromX509Certificate( intermediate->GetX509Certificate().get()), NSSCertDatabase::TRUST_DEFAULT, ¬_imported)); EXPECT_TRUE(not_imported.empty()); - EXPECT_TRUE(nss_db->ImportCACerts( + EXPECT_TRUE(nss_cert_database()->ImportCACerts( x509_util::CreateCERTCertificateListFromX509Certificate( root->GetX509Certificate().get()), NSSCertDatabase::TRUSTED_SSL, ¬_imported)); @@ -102,11 +124,15 @@ // Import a client cert to NSS also. It shouldn't be migrated. EXPECT_TRUE(net::ImportClientCertAndKeyFromFile( net::GetTestCertsDirectory(), "client_1.pem", "client_1.pk8", - nss_db->GetPublicSlot().get())); + nss_cert_database()->GetPublicSlot().get())); + std::unique_ptr<net::ServerCertificateDatabaseService> cert_db_service = + CreateService(); // Do the migration from NSS to ServerCertificateDatabase. { - ServerCertificateDatabaseNSSMigrator migrator(profile()); + ServerCertificateDatabaseNSSMigrator migrator( + cert_db_service.get(), + base::BindOnce(NssGetterForIOThread, nss_cert_database())); base::test::TestFuture< ServerCertificateDatabaseNSSMigrator::MigrationResult> migrate_certs_waiter; @@ -128,9 +154,6 @@ const ServerCertificateDatabase::CertInformation expected_root_info = MakeCertInfo(root->GetDER(), CertificateTrust::CERTIFICATE_TRUST_TYPE_TRUSTED); - net::ServerCertificateDatabaseService* cert_db_service = - net::ServerCertificateDatabaseServiceFactory::GetForBrowserContext( - profile()); { base::test::TestFuture< std::vector<net::ServerCertificateDatabase::CertInformation>> @@ -151,7 +174,9 @@ // replacing the entries in the ServerCertificateDatabase with exactly the // same value, so the end result should not change. { - ServerCertificateDatabaseNSSMigrator migrator(profile()); + ServerCertificateDatabaseNSSMigrator migrator( + cert_db_service.get(), + base::BindOnce(NssGetterForIOThread, nss_cert_database())); base::test::TestFuture< ServerCertificateDatabaseNSSMigrator::MigrationResult> migrate_certs_waiter;
diff --git a/chrome/browser/net/server_certificate_database_service.cc b/chrome/browser/net/server_certificate_database_service.cc index 3ea04a0..b72b8e5 100644 --- a/chrome/browser/net/server_certificate_database_service.cc +++ b/chrome/browser/net/server_certificate_database_service.cc
@@ -13,28 +13,40 @@ #include "base/task/sequenced_task_runner.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" -#include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_features.h" #if BUILDFLAG(IS_CHROMEOS) #include "base/metrics/histogram_functions.h" #include "chrome/browser/net/server_certificate_database_nss_migrator.h" #include "chrome/common/pref_names.h" +#include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #endif namespace net { +#if BUILDFLAG(IS_CHROMEOS) ServerCertificateDatabaseService::ServerCertificateDatabaseService( - Profile* profile) - : profile_(profile) { + base::FilePath profile_path, + PrefService* prefs, + ServerCertificateDatabaseNSSMigrator::NssCertDatabaseGetter + nss_cert_db_getter) + : profile_path_(std::move(profile_path)), + prefs_(prefs), + nss_cert_db_getter_(std::move(nss_cert_db_getter)) +#else +ServerCertificateDatabaseService::ServerCertificateDatabaseService( + base::FilePath profile_path) + : profile_path_(std::move(profile_path)) +#endif +{ if (base::FeatureList::IsEnabled( ::features::kEnableCertManagementUIV2Write)) { server_cert_database_ = base::SequenceBound<net::ServerCertificateDatabase>( base::ThreadPool::CreateSequencedTaskRunner( {base::MayBlock(), base::TaskPriority::USER_BLOCKING, base::TaskShutdownBehavior::BLOCK_SHUTDOWN}), - profile->GetPath()); + profile_path_); } } @@ -60,14 +72,13 @@ // database. Migration will only be done once per profile. If called multiple // times before migration completes, all the callbacks will be queued and // processed once the migration is done. - if (profile_->GetPrefs()->GetInteger( - prefs::kNSSCertsMigratedToServerCertDb) == + if (prefs_->GetInteger(prefs::kNSSCertsMigratedToServerCertDb) == static_cast<int>(NSSMigrationResultPref::kNotMigrated)) { if (!nss_migrator_) { DVLOG(1) << "starting migration for profile " - << profile_->GetPath().AsUTF8Unsafe(); - nss_migrator_ = - std::make_unique<ServerCertificateDatabaseNSSMigrator>(profile_); + << profile_path_.AsUTF8Unsafe(); + nss_migrator_ = std::make_unique<ServerCertificateDatabaseNSSMigrator>( + this, std::move(nss_cert_db_getter_)); // Unretained is safe as ServerCertificateDatabaseNSSMigrator will not // run the callback after it is deleted. nss_migrator_->MigrateCerts(base::BindOnce( @@ -88,7 +99,7 @@ #if BUILDFLAG(IS_CHROMEOS) void ServerCertificateDatabaseService::NSSMigrationComplete( ServerCertificateDatabaseNSSMigrator::MigrationResult result) { - DVLOG(1) << "Migration for " << profile_->GetPath().AsUTF8Unsafe() + DVLOG(1) << "Migration for " << profile_path_.AsUTF8Unsafe() << " finished: nss cert count=" << result.cert_count << " errors=" << result.error_count; NSSMigrationResultHistogram result_for_histogram; @@ -107,7 +118,7 @@ "Net.CertVerifier.NSSCertMigrationQueuedRequestsWhenFinished", get_certificates_pending_migration_.size()); - profile_->GetPrefs()->SetInteger( + prefs_->SetInteger( prefs::kNSSCertsMigratedToServerCertDb, static_cast<int>((result.error_count == 0) ? NSSMigrationResultPref::kMigratedSuccessfully @@ -162,4 +173,14 @@ } } +#if BUILDFLAG(IS_CHROMEOS) +void ServerCertificateDatabaseService::RegisterProfilePrefs( + PrefRegistrySimple* registry) { + registry->RegisterIntegerPref( + prefs::kNSSCertsMigratedToServerCertDb, + static_cast<int>(net::ServerCertificateDatabaseService:: + NSSMigrationResultPref::kNotMigrated)); +} +#endif + } // namespace net
diff --git a/chrome/browser/net/server_certificate_database_service.h b/chrome/browser/net/server_certificate_database_service.h index 0b61d8ee..9e9b7a4 100644 --- a/chrome/browser/net/server_certificate_database_service.h +++ b/chrome/browser/net/server_certificate_database_service.h
@@ -16,7 +16,8 @@ #include "chrome/browser/net/server_certificate_database_nss_migrator.h" #endif -class Profile; +class PrefRegistrySimple; +class PrefService; namespace net { @@ -52,7 +53,15 @@ using GetCertificatesCallback = base::OnceCallback<void( std::vector<net::ServerCertificateDatabase::CertInformation>)>; - explicit ServerCertificateDatabaseService(Profile* profile); +#if BUILDFLAG(IS_CHROMEOS) + explicit ServerCertificateDatabaseService( + base::FilePath profile_path, + PrefService* prefs, + ServerCertificateDatabaseNSSMigrator::NssCertDatabaseGetter + nss_cert_db_getter); +#else + explicit ServerCertificateDatabaseService(base::FilePath profile_path); +#endif ServerCertificateDatabaseService(const ServerCertificateDatabaseService&) = delete; @@ -89,6 +98,10 @@ void DeleteCertificate(const std::string& sha256hash_hex, base::OnceCallback<void(bool)> callback); +#if BUILDFLAG(IS_CHROMEOS) + static void RegisterProfilePrefs(PrefRegistrySimple* registry); +#endif + private: void HandleModificationResult(base::OnceCallback<void(bool)> callback, bool success); @@ -98,10 +111,13 @@ ServerCertificateDatabaseNSSMigrator::MigrationResult result); #endif - const raw_ptr<Profile> profile_; + const base::FilePath profile_path_; base::SequenceBound<net::ServerCertificateDatabase> server_cert_database_; #if BUILDFLAG(IS_CHROMEOS) + raw_ptr<PrefService> prefs_; + ServerCertificateDatabaseNSSMigrator::NssCertDatabaseGetter + nss_cert_db_getter_; std::unique_ptr<ServerCertificateDatabaseNSSMigrator> nss_migrator_; std::vector<GetCertificatesCallback> get_certificates_pending_migration_; #endif
diff --git a/chrome/browser/net/server_certificate_database_service_factory.cc b/chrome/browser/net/server_certificate_database_service_factory.cc index e422486e..084fdce8 100644 --- a/chrome/browser/net/server_certificate_database_service_factory.cc +++ b/chrome/browser/net/server_certificate_database_service_factory.cc
@@ -5,6 +5,8 @@ #include "chrome/browser/net/server_certificate_database_service_factory.h" #include "base/feature_list.h" +#include "chrome/browser/net/nss_service.h" +#include "chrome/browser/net/nss_service_factory.h" #include "chrome/browser/net/server_certificate_database_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_features.h" @@ -48,9 +50,16 @@ std::unique_ptr<KeyedService> ServerCertificateDatabaseServiceFactory::BuildServiceInstanceForBrowserContext( - content::BrowserContext* profile) const { + content::BrowserContext* browser_context) const { + Profile* profile = Profile::FromBrowserContext(browser_context); +#if BUILDFLAG(IS_CHROMEOS) return std::make_unique<ServerCertificateDatabaseService>( - Profile::FromBrowserContext(profile)); + profile->GetPath(), profile->GetPrefs(), + NssServiceFactory::GetForContext(profile) + ->CreateNSSCertDatabaseGetterForIOThread()); +#else + return std::make_unique<ServerCertificateDatabaseService>(profile->GetPath()); +#endif } } // namespace net
diff --git a/chrome/browser/net/server_certificate_database_service_unittest.cc b/chrome/browser/net/server_certificate_database_service_unittest.cc index 35ede04..96016cf 100644 --- a/chrome/browser/net/server_certificate_database_service_unittest.cc +++ b/chrome/browser/net/server_certificate_database_service_unittest.cc
@@ -4,20 +4,24 @@ #include "chrome/browser/net/server_certificate_database_service.h" +#include <memory> + +#include "base/files/scoped_temp_dir.h" +#include "base/test/scoped_feature_list.h" #include "base/test/test_future.h" #include "chrome/browser/net/server_certificate_database_service.h" -#include "chrome/browser/net/server_certificate_database_service_factory.h" #include "chrome/browser/net/server_certificate_database_test_util.h" #include "chrome/common/chrome_features.h" -#include "chrome/common/pref_names.h" -#include "chrome/test/base/testing_profile.h" -#include "components/prefs/pref_service.h" +#include "content/public/browser/browser_thread.h" #include "content/public/test/browser_task_environment.h" #include "net/test/cert_builder.h" #include "testing/gtest/include/gtest/gtest.h" #if BUILDFLAG(IS_CHROMEOS) -#include "chrome/browser/net/fake_nss_service.h" +#include "chrome/common/pref_names.h" +#include "components/prefs/pref_service.h" +#include "components/prefs/testing_pref_service.h" +#include "crypto/scoped_test_nss_db.h" #include "net/cert/nss_cert_database.h" #include "net/cert/x509_util_nss.h" #endif @@ -26,28 +30,69 @@ using ::testing::UnorderedElementsAre; namespace net { +namespace { + +#if BUILDFLAG(IS_CHROMEOS) +net::NSSCertDatabase* NssGetterForIOThread( + net::NSSCertDatabase* result, + base::OnceCallback<void(net::NSSCertDatabase*)>) { + // The check is here because the real NSS getter must also be run on the IO + // thread. + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + return result; +} +#endif + +} // namespace class ServerCertificateDatabaseServiceTest : public testing::Test { public: void SetUp() override { - profile_ = TestingProfile::Builder().Build(); + ASSERT_TRUE(temp_profile_dir_.CreateUniqueTempDir()); +#if BUILDFLAG(IS_CHROMEOS) + ServerCertificateDatabaseService::RegisterProfilePrefs( + pref_service_.registry()); + test_nss_slot_ = std::make_unique<crypto::ScopedTestNSSDB>(); + ASSERT_TRUE(test_nss_slot_->is_open()); + nss_cert_database_ = std::make_unique<NSSCertDatabase>( + crypto::ScopedPK11Slot(PK11_ReferenceSlot(test_nss_slot_->slot())), + crypto::ScopedPK11Slot(PK11_ReferenceSlot(test_nss_slot_->slot()))); +#endif } - TestingProfile* profile() { return profile_.get(); } + std::unique_ptr<net::ServerCertificateDatabaseService> CreateService() { +#if BUILDFLAG(IS_CHROMEOS) + return std::make_unique<ServerCertificateDatabaseService>( + temp_profile_dir_.GetPath(), &pref_service_, + base::BindOnce(NssGetterForIOThread, nss_cert_database_.get())); +#else + return std::make_unique<ServerCertificateDatabaseService>( + temp_profile_dir_.GetPath()); +#endif + } + +#if BUILDFLAG(IS_CHROMEOS) + PrefService* pref_service() { return &pref_service_; } + NSSCertDatabase* nss_cert_database() { return nss_cert_database_.get(); } +#endif private: base::test::ScopedFeatureList feature_list_{ features::kEnableCertManagementUIV2Write}; content::BrowserTaskEnvironment task_environment_; - std::unique_ptr<TestingProfile> profile_; + base::ScopedTempDir temp_profile_dir_; +#if BUILDFLAG(IS_CHROMEOS) + TestingPrefServiceSimple pref_service_; + std::unique_ptr<crypto::ScopedTestNSSDB> test_nss_slot_; + std::unique_ptr<net::NSSCertDatabase> nss_cert_database_; +#endif }; TEST_F(ServerCertificateDatabaseServiceTest, TestNotifications) { auto [leaf, root] = CertBuilder::CreateSimpleChain2(); - net::ServerCertificateDatabaseService* cert_db_service = - net::ServerCertificateDatabaseServiceFactory::GetForBrowserContext( - profile()); + std::unique_ptr<net::ServerCertificateDatabaseService> cert_db_service = + CreateService(); base::test::TestFuture<void> update_waiter; @@ -111,41 +156,22 @@ } #if BUILDFLAG(IS_CHROMEOS) -class ServerCertificateDatabaseServiceNSSMigratorTest - : public ServerCertificateDatabaseServiceTest { - public: - void SetUp() override { - ServerCertificateDatabaseServiceTest::SetUp(); - - nss_service_ = FakeNssService::InitializeForBrowserContext( - profile(), /*enable_system_slot=*/false); - } - - void TearDown() override { nss_service_ = nullptr; } - - FakeNssService* nss_service() { return nss_service_; } - - private: - raw_ptr<FakeNssService> nss_service_; -}; +using ServerCertificateDatabaseServiceNSSMigratorTest = + ServerCertificateDatabaseServiceTest; TEST_F(ServerCertificateDatabaseServiceNSSMigratorTest, TestMigration) { auto [leaf, root] = CertBuilder::CreateSimpleChain2(); // Import test certificate into NSS user database. - base::test::TestFuture<net::NSSCertDatabase*> nss_waiter; - nss_service()->UnsafelyGetNSSCertDatabaseForTesting(nss_waiter.GetCallback()); - net::NSSCertDatabase* nss_db = nss_waiter.Get(); NSSCertDatabase::ImportCertFailureList not_imported; - EXPECT_TRUE(nss_db->ImportCACerts( + EXPECT_TRUE(nss_cert_database()->ImportCACerts( x509_util::CreateCERTCertificateListFromX509Certificate( root->GetX509Certificate().get()), NSSCertDatabase::TRUSTED_SSL, ¬_imported)); EXPECT_TRUE(not_imported.empty()); - net::ServerCertificateDatabaseService* cert_db_service = - net::ServerCertificateDatabaseServiceFactory::GetForBrowserContext( - profile()); + std::unique_ptr<net::ServerCertificateDatabaseService> cert_db_service = + CreateService(); // Verify that server cert database starts empty and migration pref default // is false. @@ -153,10 +179,10 @@ base::test::TestFuture<uint32_t> get_certs_count_waiter; cert_db_service->GetCertificatesCount(get_certs_count_waiter.GetCallback()); EXPECT_EQ(0U, get_certs_count_waiter.Get()); - EXPECT_EQ(profile()->GetPrefs()->GetInteger( - prefs::kNSSCertsMigratedToServerCertDb), - static_cast<int>(ServerCertificateDatabaseService:: - NSSMigrationResultPref::kNotMigrated)); + EXPECT_EQ( + pref_service()->GetInteger(prefs::kNSSCertsMigratedToServerCertDb), + static_cast<int>(ServerCertificateDatabaseService:: + NSSMigrationResultPref::kNotMigrated)); } // Call GetAllCertificates to begin the migration. @@ -178,8 +204,7 @@ UnorderedElementsAre(CertInfoEquals(std::ref(expected_nss_root_info)))); // Migration pref should be true now. EXPECT_EQ( - profile()->GetPrefs()->GetInteger( - prefs::kNSSCertsMigratedToServerCertDb), + pref_service()->GetInteger(prefs::kNSSCertsMigratedToServerCertDb), static_cast<int>(ServerCertificateDatabaseService:: NSSMigrationResultPref::kMigratedSuccessfully)); } @@ -222,19 +247,15 @@ auto [leaf, root] = CertBuilder::CreateSimpleChain2(); // Import test certificate into NSS user database. - base::test::TestFuture<net::NSSCertDatabase*> nss_waiter; - nss_service()->UnsafelyGetNSSCertDatabaseForTesting(nss_waiter.GetCallback()); - net::NSSCertDatabase* nss_db = nss_waiter.Get(); NSSCertDatabase::ImportCertFailureList not_imported; - EXPECT_TRUE(nss_db->ImportCACerts( + EXPECT_TRUE(nss_cert_database()->ImportCACerts( x509_util::CreateCERTCertificateListFromX509Certificate( root->GetX509Certificate().get()), NSSCertDatabase::TRUSTED_SSL, ¬_imported)); EXPECT_TRUE(not_imported.empty()); - net::ServerCertificateDatabaseService* cert_db_service = - net::ServerCertificateDatabaseServiceFactory::GetForBrowserContext( - profile()); + std::unique_ptr<net::ServerCertificateDatabaseService> cert_db_service = + CreateService(); // Call GetAllCertificates multiple times. base::test::TestFuture< @@ -246,10 +267,9 @@ cert_db_service->GetAllCertificates(waiter1.GetCallback()); cert_db_service->GetAllCertificates(waiter2.GetCallback()); // Migration pref should be false still. - EXPECT_EQ( - profile()->GetPrefs()->GetInteger(prefs::kNSSCertsMigratedToServerCertDb), - static_cast<int>(ServerCertificateDatabaseService:: - NSSMigrationResultPref::kNotMigrated)); + EXPECT_EQ(pref_service()->GetInteger(prefs::kNSSCertsMigratedToServerCertDb), + static_cast<int>(ServerCertificateDatabaseService:: + NSSMigrationResultPref::kNotMigrated)); // Both callbacks should get run and both should have the migrated cert. ServerCertificateDatabase::CertInformation expected_nss_root_info = @@ -270,7 +290,7 @@ // Migration pref should be true now. EXPECT_EQ( - profile()->GetPrefs()->GetInteger(prefs::kNSSCertsMigratedToServerCertDb), + pref_service()->GetInteger(prefs::kNSSCertsMigratedToServerCertDb), static_cast<int>(ServerCertificateDatabaseService:: NSSMigrationResultPref::kMigratedSuccessfully)); }
diff --git a/chrome/browser/optimization_guide/model_execution/model_execution_browsertest.cc b/chrome/browser/optimization_guide/model_execution/model_execution_browsertest.cc index 98fec738..1104785 100644 --- a/chrome/browser/optimization_guide/model_execution/model_execution_browsertest.cc +++ b/chrome/browser/optimization_guide/model_execution/model_execution_browsertest.cc
@@ -67,14 +67,15 @@ }; proto::ExecuteResponse BuildComposeResponse(const std::string& output) { - proto::ComposeResponse compose_response; + proto::features::ComposeResponse compose_response; compose_response.set_output(output); proto::ExecuteResponse execute_response; proto::Any* any_metadata = execute_response.mutable_response_metadata(); any_metadata->set_type_url("type.googleapis.com/" + compose_response.GetTypeName()); compose_response.SerializeToString(any_metadata->mutable_value()); - auto response_data = ParsedAnyMetadata<proto::ComposeResponse>(*any_metadata); + auto response_data = + ParsedAnyMetadata<proto::features::ComposeResponse>(*any_metadata); EXPECT_TRUE(response_data); return execute_response; } @@ -405,7 +406,7 @@ IN_PROC_BROWSER_TEST_F(ModelExecutionDisabledBrowserTest, ModelExecutionDisabled) { - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); @@ -498,7 +499,7 @@ IN_PROC_BROWSER_TEST_F(ModelExecutionEnabledBrowserTest, ModelExecutionDisabledInIncognito) { Browser* otr_browser = CreateIncognitoBrowser(browser()->profile()); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request, otr_browser->profile()); @@ -517,7 +518,7 @@ IN_PROC_BROWSER_TEST_F(ModelExecutionEnabledBrowserTest, ModelExecutionFailsNoUserSignIn) { - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); @@ -539,12 +540,12 @@ SetMetricsConsent(false); SetExpectedBearerAccessToken("Bearer access_token"); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); EXPECT_TRUE(model_execution_result_->response.has_value()); - auto response = ParsedAnyMetadata<proto::ComposeResponse>( + auto response = ParsedAnyMetadata<proto::features::ComposeResponse>( model_execution_result_->response.value()); EXPECT_EQ("foo response", response->output()); @@ -560,12 +561,12 @@ SetMetricsConsent(true); SetExpectedBearerAccessToken("Bearer access_token"); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); EXPECT_TRUE(model_execution_result_->response.has_value()); - auto response = ParsedAnyMetadata<proto::ComposeResponse>( + auto response = ParsedAnyMetadata<proto::features::ComposeResponse>( model_execution_result_->response.value()); EXPECT_EQ("foo response", response->output()); @@ -586,7 +587,7 @@ ASSERT_TRUE( g_browser_process->GetMetricsServicesManager()->IsMetricsConsentGiven()); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); @@ -608,7 +609,7 @@ SetExpectedBearerAccessToken("Bearer access_token"); SetResponseType(ModelExecutionRemoteResponseType::kMalformed); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); @@ -625,7 +626,7 @@ SetExpectedBearerAccessToken("Bearer access_token"); SetResponseType(ModelExecutionRemoteResponseType::kErrorFiltered); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); @@ -650,7 +651,7 @@ ASSERT_TRUE( g_browser_process->GetMetricsServicesManager()->IsMetricsConsentGiven()); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); @@ -781,7 +782,7 @@ EnableSignin(); SetExpectedBearerAccessToken("Bearer access_token"); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("foo"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); @@ -921,12 +922,12 @@ ASSERT_TRUE( g_browser_process->GetMetricsServicesManager()->IsMetricsConsentGiven()); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request); EXPECT_TRUE(model_execution_result_.has_value()); EXPECT_TRUE(model_execution_result_->response.has_value()); - auto response = ParsedAnyMetadata<proto::ComposeResponse>( + auto response = ParsedAnyMetadata<proto::features::ComposeResponse>( model_execution_result_->response.value()); EXPECT_EQ("foo response", response->output()); @@ -1111,7 +1112,7 @@ EXPECT_FALSE( ShouldFeatureBeCurrentlyEnabledForUser(UserVisibleFeatureKey::kCompose)); - proto::ComposeRequest request_1; + proto::features::ComposeRequest request_1; request_1.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request_1); @@ -1139,7 +1140,7 @@ EXPECT_TRUE( ShouldFeatureBeCurrentlyEnabledForUser(UserVisibleFeatureKey::kCompose)); - proto::ComposeRequest request_2; + proto::features::ComposeRequest request_2; request_2.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request_2); @@ -1184,7 +1185,7 @@ EXPECT_TRUE( ShouldFeatureBeCurrentlyEnabledForUser(UserVisibleFeatureKey::kCompose)); - proto::ComposeRequest request_1; + proto::features::ComposeRequest request_1; request_1.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request_1); @@ -1209,7 +1210,7 @@ EXPECT_TRUE( ShouldFeatureBeCurrentlyEnabledForUser(UserVisibleFeatureKey::kCompose)); - proto::ComposeRequest request_2; + proto::features::ComposeRequest request_2; request_2.mutable_generate_params()->set_user_input("a user typed this"); ExecuteModel(UserVisibleFeatureKey::kCompose, request_2);
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc index 45c795f..e06d606d 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service_browsertest.cc
@@ -365,7 +365,7 @@ auto log_entry = std::make_unique<ModelQualityLogEntry>( service()->GetModelQualityLogsUploaderService()->GetWeakPtr()); *log_entry->log_ai_data_request()->mutable_compose() = - proto::ComposeLoggingData(); + proto::features::ComposeLoggingData(); return log_entry; }
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index bff0f19..8424b56 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -1989,6 +1989,8 @@ glic::GlicConfiguration::RegisterPrefs(registry); #endif + registry->RegisterIntegerPref(prefs::kToastAlertLevel, 0); + // This is intentionally last. RegisterLocalStatePrefsForMigration(registry); }
diff --git a/chrome/browser/resources/certificate_viewer/BUILD.gn b/chrome/browser/resources/certificate_viewer/BUILD.gn index 173bad0..b8ac793 100644 --- a/chrome/browser/resources/certificate_viewer/BUILD.gn +++ b/chrome/browser/resources/certificate_viewer/BUILD.gn
@@ -18,11 +18,11 @@ non_web_component_files = [ "browser_proxy.ts", "certificate_viewer.ts", - "constraint_list.ts", - "constraint_list.html.ts", + "modifications_panel.ts", + "modifications_panel.html.ts", ] - css_files = [ "constraint_list.css" ] + css_files = [ "modifications_panel.css" ] ts_composite = true ts_definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ]
diff --git a/chrome/browser/resources/certificate_viewer/certificate_viewer.css b/chrome/browser/resources/certificate_viewer/certificate_viewer.css index 71c5c42..effddcb 100644 --- a/chrome/browser/resources/certificate_viewer/certificate_viewer.css +++ b/chrome/browser/resources/certificate_viewer/certificate_viewer.css
@@ -80,34 +80,6 @@ width: 100%; } -.horizontal-row { - color: #616161; - display: flex; - flex-direction: row; - align-content: flex-start; - padding-top: 10px; - padding-inline-start: 20px; - padding-bottom: 10px; -} - -.input-with-error { - display: flex; - flex-direction: column; -} - -.error { - margin: 4px 10px; - color: rgb(179, 38, 30); -} - -.hide-error { - display: none; -} - -.modifications-row-label { - width: 150px; -} - #hierarchy { /* Cert hierarchy tree should be 3 lines tall and does not grow. */ flex: 0;
diff --git a/chrome/browser/resources/certificate_viewer/certificate_viewer.html b/chrome/browser/resources/certificate_viewer/certificate_viewer.html index 985daa9..d54a0e50 100644 --- a/chrome/browser/resources/certificate_viewer/certificate_viewer.html +++ b/chrome/browser/resources/certificate_viewer/certificate_viewer.html
@@ -120,28 +120,8 @@ </div> <!-- Modifications --> - <!-- TODO(crbug.com/40928765): make entire modifications panel into - its own component and merge this with the constraint-list --> <div slot="panel" id="modifications" role="tabpanel"> - <div class="vertical-box"> - <h3 role="heading">$i18n{trust}</h3> - <div class="horizontal-row"> - <label class="modifications-row-label">$i18n{trustState}</label> - <div class="input-with-error"> - <select id="trust-state-select" class="md-select" disabled> - <option value="0">$i18n{trustStateDistrusted}</option> - <option value="1">$i18n{trustStateHint}</option> - <option value="2">$i18n{trustStateTrusted}</option> - </select> - <div id="trust-state-select-error" class="error hide-error"> - Error - </div> - </div> - </div> - <!-- TODO(crbug.com/40928765): only show constraint list - if trust = trusted --> - <constraint-list id="constraints"></constraint-list> - </div> + <modifications-panel id="modifications-panel"></modifications-panel> </div> </cr-tab-box> </body>
diff --git a/chrome/browser/resources/certificate_viewer/certificate_viewer.ts b/chrome/browser/resources/certificate_viewer/certificate_viewer.ts index 2c45647..34f7e23 100644 --- a/chrome/browser/resources/certificate_viewer/certificate_viewer.ts +++ b/chrome/browser/resources/certificate_viewer/certificate_viewer.ts
@@ -7,16 +7,13 @@ import 'chrome://resources/cr_elements/cr_tree/cr_tree.js'; import 'chrome://resources/cr_elements/cr_tree/cr_tree_item.js'; import './browser_proxy.js'; -import './constraint_list.js'; +import './modifications_panel.js'; import type {CrTreeElement} from 'chrome://resources/cr_elements/cr_tree/cr_tree.js'; import type {CrTreeItemElement} from 'chrome://resources/cr_elements/cr_tree/cr_tree_item.js'; import {assert} from 'chrome://resources/js/assert.js'; import {sendWithPromise} from 'chrome://resources/js/cr.js'; -import {CertViewerBrowserProxyImpl} from './browser_proxy.js'; -import type {CertMetadataChangeResult} from './browser_proxy.js'; - interface TreeInfo { payload?: object; children?: TreeInfo[]; @@ -104,52 +101,6 @@ exportButton.onclick = exportCertificate; } -export function onTrustStateChange() { - // Clear any error message - const trustStateErrorMessage = - document.querySelector<HTMLElement>('#trust-state-select-error'); - assert(trustStateErrorMessage); - trustStateErrorMessage.classList.add('hide-error'); - - // Update the trust state. - const trustStateSelect = - document.querySelector<HTMLSelectElement>('#trust-state-select'); - assert(trustStateSelect); - - // Disable editing so we only have one change outstanding at any one time. - trustStateSelect.disabled = true; - assert(trustStateSelect); - CertViewerBrowserProxyImpl.getInstance() - .updateTrustState(Number(trustStateSelect.value)) - .then(onTrustStateChangeFinished); -} - -function onTrustStateChangeFinished(result: CertMetadataChangeResult) { - const trustStateSelect = - document.querySelector<HTMLSelectElement>('#trust-state-select'); - assert(trustStateSelect); - trustStateSelect.disabled = false; - - if (!result.success) { - const trustStateErrorMessage = - document.querySelector<HTMLElement>('#trust-state-select-error'); - assert(trustStateErrorMessage); - // Set error message - if (result.errorMessage !== undefined) { - trustStateErrorMessage.innerText = result.errorMessage; - } else { - // TODO(crbug.com/40928765): localize - trustStateErrorMessage.innerText = - 'There was an error saving the trust state change'; - } - - trustStateErrorMessage.classList.remove('hide-error'); - } - - document.body.dispatchEvent( - new CustomEvent('trust-state-change-finished-for-testing')); -} - function getCertificateMetadata(certInfo: CertificateInfo) { if (certInfo.certMetadata === undefined) { return; @@ -160,21 +111,16 @@ assert(modificationsTab); modificationsTab.hidden = false; - const trustStateSelect = - document.querySelector<HTMLSelectElement>('#trust-state-select'); - assert(trustStateSelect); - trustStateSelect.value = certInfo.certMetadata.trust.toString(); + const modificationsPanel = document.querySelector('modifications-panel'); + assert(modificationsPanel); + modificationsPanel.trustStateValue = certInfo.certMetadata.trust.toString(); if (certInfo.certMetadata.isEditable) { - trustStateSelect.disabled = false; - trustStateSelect.addEventListener('change', onTrustStateChange); + modificationsPanel.isEditable = true; } if (certInfo.certMetadata.constraints !== undefined) { - const constraintsElement = document.querySelector('constraint-list'); - assert(constraintsElement); - - constraintsElement.constraints = certInfo.certMetadata.constraints; + modificationsPanel.constraints = certInfo.certMetadata.constraints; } }
diff --git a/chrome/browser/resources/certificate_viewer/constraint_list.html.ts b/chrome/browser/resources/certificate_viewer/constraint_list.html.ts deleted file mode 100644 index 0fe788a7..0000000 --- a/chrome/browser/resources/certificate_viewer/constraint_list.html.ts +++ /dev/null
@@ -1,46 +0,0 @@ -// Copyright 2024 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import {html} from '//resources/lit/v3_0/lit.rollup.js'; - -import type {ConstraintListElement} from './constraint_list.js'; - -export function getHtml(this: ConstraintListElement) { - // TODO(crbug.com/40928765): finish localization. - return html`<!--_html_template_start_--> - <div class="horizontal-row"> - <div class="modifications-row-label">$i18n{constraints}</div> - <div id="constraintList"> - ${this.constraints.map((constraint: string, index: number) => html` - <div class="constraint">${constraint} - <cr-icon-button id="constraint-delete-${index}" - data-index="${index}" - @click="${this.onDeleteConstraintClick_}" - ?disabled="${!this.editControlsEnabled}" - class="icon-picture-delete"> - </cr-icon-button> - </div>`)} - <div id="constraintDeleteError" - ?hidden="${this.deleteConstraintErrorMessage.length === 0}" - class="error"> - ${this.deleteConstraintErrorMessage} - </div> - </div> - </div> - <div class="horizontal-row"> - <div class="modifications-row-label">Add Constraint</div> - <cr-input - id="addConstraintInput" - placeholder="DNS or CIDR constraint" - ?invalid="${this.addConstraintErrorMessage.length !== 0}" - error-message="${this.addConstraintErrorMessage}"> - <cr-button id="addConstraintButton" slot="suffix" - ?disabled="${!this.editControlsEnabled}" - @click="${this.onAddConstraintClick_}"> - Add - </cr-button> - </cr-input> - </div> - <!--_html_template_end_-->`; -}
diff --git a/chrome/browser/resources/certificate_viewer/constraint_list.css b/chrome/browser/resources/certificate_viewer/modifications_panel.css similarity index 73% rename from chrome/browser/resources/certificate_viewer/constraint_list.css rename to chrome/browser/resources/certificate_viewer/modifications_panel.css index 77b5da6..de9d9d0 100644 --- a/chrome/browser/resources/certificate_viewer/constraint_list.css +++ b/chrome/browser/resources/certificate_viewer/modifications_panel.css
@@ -8,7 +8,8 @@ * #import=//resources/cr_elements/cr_hidden_style_lit.css.js * #import=//resources/cr_elements/cr_icons_lit.css.js * #import=//resources/cr_elements/cr_shared_style_lit.css.js - * #include=cr-icons-lit cr-shared-style-lit cr-hidden-style-lit + * #import=//resources/cr_elements/md_select_lit.css.js + * #include=cr-icons-lit cr-shared-style-lit cr-hidden-style-lit md-select-lit * #css_wrapper_metadata_end */ .constraint { @@ -19,7 +20,6 @@ width: 150px; } - /* TODO(crbug.com/40928765): Try using shared colors from cr_shared_vars.css */ .horizontal-row { color: #616161; @@ -35,3 +35,22 @@ margin: 4px 10px; color: rgb(179, 38, 30); } + +.input-with-error { + display: flex; + flex-direction: column; +} + +h3 { + font-size: 100%; + margin-bottom: 15px; + margin-top: 17px; +} + +.vertical-box { + display: flex; + flex-direction: column; + height: 100%; + position: relative; + width: 100%; +}
diff --git a/chrome/browser/resources/certificate_viewer/modifications_panel.html.ts b/chrome/browser/resources/certificate_viewer/modifications_panel.html.ts new file mode 100644 index 0000000..34e95867 --- /dev/null +++ b/chrome/browser/resources/certificate_viewer/modifications_panel.html.ts
@@ -0,0 +1,72 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {html} from '//resources/lit/v3_0/lit.rollup.js'; + +import type {ModificationsPanelElement} from './modifications_panel.js'; + +export function getHtml(this: ModificationsPanelElement) { + // TODO(crbug.com/40928765): finish localization. + return html`<!--_html_template_start_--> + <div class="vertical-box"> + <h3 role="heading">$i18n{trust}</h3> + <div class="horizontal-row"> + <label class="modifications-row-label">$i18n{trustState}</label> + <div class="input-with-error"> + <select id="trustStateSelect" class="md-select" + .value="${this.trustStateValue}" + @change="${this.onTrustStateChange_}" + ?disabled="${!(this.isEditable && this.editControlsEnabled)}"> + <option value="0">$i18n{trustStateDistrusted}</option> + <option value="1">$i18n{trustStateHint}</option> + <option value="2">$i18n{trustStateTrusted}</option> + </select> + <div id="trustStateSelectError" + ?hidden="${this.trustStateErrorMessage.length === 0}" + class="error"> + ${this.trustStateErrorMessage} + </div> + </div> + </div> + <div class="horizontal-row" id="constraintListSection" + ?hidden="${ + this.trustStateValue !== '2' || this.constraints.length === 0}"> + <div class="modifications-row-label">$i18n{constraints}</div> + <div> + ${this.constraints.map((constraint: string, index: number) => html` + <div class="constraint">${constraint} + <cr-icon-button id="constraint-delete-${index}" + data-index="${index}" + @click="${this.onDeleteConstraintClick_}" + ?hidden="${!this.isEditable}" + ?disabled="${!this.editControlsEnabled}" + class="icon-picture-delete"> + </cr-icon-button> + </div>`)} + <div id="constraintDeleteError" + ?hidden="${this.deleteConstraintErrorMessage.length === 0}" + class="error"> + ${this.deleteConstraintErrorMessage} + </div> + </div> + </div> + <div class="horizontal-row" id="addConstraintSection" + ?hidden="${!(this.isEditable && this.trustStateValue === '2')}"> + <div class="modifications-row-label">Add Constraint</div> + <cr-input + id="addConstraintInput" + placeholder="DNS or CIDR constraint" + ?invalid="${this.addConstraintErrorMessage.length !== 0}" + error-message="${this.addConstraintErrorMessage}" + value=""> + <cr-button id="addConstraintButton" slot="suffix" + ?disabled="${!this.editControlsEnabled}" + @click="${this.onAddConstraintClick_}"> + Add + </cr-button> + </cr-input> + </div> + </div> + <!--_html_template_end_-->`; +}
diff --git a/chrome/browser/resources/certificate_viewer/constraint_list.ts b/chrome/browser/resources/certificate_viewer/modifications_panel.ts similarity index 63% rename from chrome/browser/resources/certificate_viewer/constraint_list.ts rename to chrome/browser/resources/certificate_viewer/modifications_panel.ts index e865cfb..de326aaa 100644 --- a/chrome/browser/resources/certificate_viewer/constraint_list.ts +++ b/chrome/browser/resources/certificate_viewer/modifications_panel.ts
@@ -13,21 +13,27 @@ import {CrLitElement} from '//resources/lit/v3_0/lit.rollup.js'; import {CertViewerBrowserProxyImpl} from './browser_proxy.js'; -import type {ConstraintChangeResult} from './browser_proxy.js'; -import {getCss} from './constraint_list.css.js'; -import {getHtml} from './constraint_list.html.js'; +import type {CertMetadataChangeResult, ConstraintChangeResult} from './browser_proxy.js'; +import {getCss} from './modifications_panel.css.js'; +import {getHtml} from './modifications_panel.html.js'; -export interface ConstraintListElement { +export interface ModificationsPanelElement { $: { + addConstraintSection: HTMLElement, addConstraintInput: CrInputElement, addConstraintButton: CrButtonElement, + + constraintListSection: HTMLElement, constraintDeleteError: HTMLElement, + + trustStateSelect: HTMLSelectElement, + trustStateSelectError: HTMLElement, }; } -export class ConstraintListElement extends CrLitElement { +export class ModificationsPanelElement extends CrLitElement { static get is() { - return 'constraint-list'; + return 'modifications-panel'; } static override get styles() { @@ -41,23 +47,29 @@ static override get properties() { return { constraints: {type: Array}, + trustStateValue: {type: String}, + isEditable: {type: Boolean}, editControlsEnabled: {type: Boolean}, addConstraintErrorMessage: {type: String}, deleteConstraintErrorMessage: {type: String}, + trustStateErrorMessage: {type: String}, }; } constraints: string[] = []; + trustStateValue: string = '0'; + isEditable: boolean = false; + protected editControlsEnabled: boolean = true; protected addConstraintErrorMessage: string = ''; protected deleteConstraintErrorMessage: string = ''; + protected trustStateErrorMessage: string = ''; // Clear all error messages in this element. private clearErrorMessages() { - // TODO(crbug.com/40928765): clear trust state change error message - // after this is merged with the rest of the modifications panel. this.deleteConstraintErrorMessage = ''; this.addConstraintErrorMessage = ''; + this.trustStateErrorMessage = ''; } protected onDeleteConstraintClick_(e: Event) { @@ -67,8 +79,7 @@ const constraintToDeleteIndex = Number((e.target as HTMLElement).dataset['index']); if (this.constraints[constraintToDeleteIndex]) { - // TODO(crbug.com/40928765): set trust state selector enabled state to - // false after this is merged with the rest of the modifications panel. + // Disable editing so we only have one change outstanding at any one time. this.editControlsEnabled = false; CertViewerBrowserProxyImpl.getInstance() .deleteConstraint(this.constraints[constraintToDeleteIndex]) @@ -103,8 +114,7 @@ return; } - // TODO(crbug.com/40928765): set trust state selector enabled state to false - // after this is merged with the rest of the modifications panel. + // Disable editing so we only have one change outstanding at any one time. this.editControlsEnabled = false; this.clearErrorMessages(); CertViewerBrowserProxyImpl.getInstance() @@ -116,6 +126,8 @@ if (result.status.success) { assert(result.constraints); this.constraints = result.constraints; + // Only clear input on successful add. + this.$.addConstraintInput.value = ''; } else { if (result.status.errorMessage !== undefined) { this.addConstraintErrorMessage = result.status.errorMessage; @@ -125,12 +137,40 @@ } this.editControlsEnabled = true; } + + protected onTrustStateChange_() { + // Disable editing so we only have one change outstanding at any one time. + this.editControlsEnabled = false; + this.clearErrorMessages(); + + CertViewerBrowserProxyImpl.getInstance() + .updateTrustState(Number(this.$.trustStateSelect.value)) + .then(this.onTrustStateChangeFinished_.bind(this)); + } + + private onTrustStateChangeFinished_(result: CertMetadataChangeResult) { + if (result.success) { + // Update state to the new trust value. + this.trustStateValue = this.$.trustStateSelect.value; + } else { + // Restore UI to the old trust value. + this.$.trustStateSelect.value = this.trustStateValue; + if (result.errorMessage !== undefined) { + this.trustStateErrorMessage = result.errorMessage; + } else { + // TODO(crbug.com/40928765): localize + this.trustStateErrorMessage = + 'There was an error saving the trust state change'; + } + } + this.editControlsEnabled = true; + } } declare global { interface HTMLElementTagNameMap { - 'constraint-list': ConstraintListElement; + 'modifications-panel': ModificationsPanelElement; } } -customElements.define(ConstraintListElement.is, ConstraintListElement); +customElements.define(ModificationsPanelElement.is, ModificationsPanelElement);
diff --git a/chrome/browser/resources/extensions/detail_view.html.ts b/chrome/browser/resources/extensions/detail_view.html.ts index e46e74f..bd6f49a2 100644 --- a/chrome/browser/resources/extensions/detail_view.html.ts +++ b/chrome/browser/resources/extensions/detail_view.html.ts
@@ -30,7 +30,8 @@ ${this.showAccountUploadButton_() ? html` <cr-icon-button id="account-upload-button" class="no-overlap" title="$i18n{itemUpload}" aria-label="$i18n{itemUpload}" - iron-icon="extensions-icons:extension_cloud_upload"> + iron-icon="extensions-icons:extension_cloud_upload" + aria-describedby="a11yAssociation" @click="${this.onUploadClick_}"> </cr-icon-button>` : ''} ${this.showDevReloadButton_() ? html` <cr-icon-button id="dev-reload-button" class="icon-refresh no-overlap"
diff --git a/chrome/browser/resources/extensions/detail_view.ts b/chrome/browser/resources/extensions/detail_view.ts index a471690..0f9351d 100644 --- a/chrome/browser/resources/extensions/detail_view.ts +++ b/chrome/browser/resources/extensions/detail_view.ts
@@ -303,6 +303,10 @@ this.reloadItem().catch((loadError) => this.fire('load-error', loadError)); } + protected onUploadClick_() { + this.delegate.uploadItemToAccount(this.data.id); + } + protected onRemoveClick_() { if (this.showSafetyCheck_) { chrome.metricsPrivate.recordUserAction('SafetyCheck.DetailRemoveClicked');
diff --git a/chrome/browser/resources/extensions/item.html.ts b/chrome/browser/resources/extensions/item.html.ts index 57a35e8..a9b5b91 100644 --- a/chrome/browser/resources/extensions/item.html.ts +++ b/chrome/browser/resources/extensions/item.html.ts
@@ -156,7 +156,8 @@ ${this.showAccountUploadButton_() ? html` <cr-icon-button id="account-upload-button" class="no-overlap" title="$i18n{itemUpload}" aria-label="$i18n{itemUpload}" - iron-icon="extensions-icons:extension_cloud_upload"> + iron-icon="extensions-icons:extension_cloud_upload" + aria-describedby="a11yAssociation" @click="${this.onUploadClick_}"> </cr-icon-button>` : ''} ${this.showDevReloadButton_() ? html` <cr-icon-button id="dev-reload-button" class="icon-refresh no-overlap"
diff --git a/chrome/browser/resources/extensions/item.ts b/chrome/browser/resources/extensions/item.ts index eb7833b7..45a04777c 100644 --- a/chrome/browser/resources/extensions/item.ts +++ b/chrome/browser/resources/extensions/item.ts
@@ -51,6 +51,7 @@ reason: chrome.developerPrivate.SafetyCheckWarningReason): void; setShowAccessRequestsInToolbar(id: string, showRequests: boolean): void; setItemPinnedToToolbar(id: string, pinnedToToolbar: boolean): void; + uploadItemToAccount(id: string): Promise<void>; // TODO(tjudkins): This function is not specific to items, so should be pulled // out to a more generic place when we need to access it from elsewhere. @@ -100,6 +101,9 @@ _id: string, _reason: chrome.developerPrivate.SafetyCheckWarningReason) {} setShowAccessRequestsInToolbar(_id: string, _showRequests: boolean) {} setItemPinnedToToolbar(_id: string, _pinnedToToolbar: boolean) {} + uploadItemToAccount(_id: string) { + return Promise.resolve(); + } recordUserAction(_metricName: string) {} getItemStateChangedTarget() { return new FakeChromeEvent(); @@ -258,6 +262,11 @@ this.reloadItem().catch((loadError) => this.fire('load-error', loadError)); } + protected onUploadClick_() { + assert(this.delegate); + this.delegate.uploadItemToAccount(this.data.id); + } + protected onRepairClick_() { assert(this.delegate); this.delegate.repairItem(this.data.id);
diff --git a/chrome/browser/resources/extensions/service.ts b/chrome/browser/resources/extensions/service.ts index 677e725..95378aef 100644 --- a/chrome/browser/resources/extensions/service.ts +++ b/chrome/browser/resources/extensions/service.ts
@@ -517,6 +517,10 @@ return chrome.developerPrivate.dismissMv2DeprecationNoticeForExtension(id); } + uploadItemToAccount(id: string): Promise<void> { + return chrome.developerPrivate.uploadExtensionToAccount(id); + } + static getInstance(): ServiceInterface { return instance || (instance = new Service()); }
diff --git a/chrome/browser/resources/glic/glic_api/glic_api.ts b/chrome/browser/resources/glic/glic_api/glic_api.ts index 764f1ec8..30ceb8ba 100644 --- a/chrome/browser/resources/glic/glic_api/glic_api.ts +++ b/chrome/browser/resources/glic/glic_api/glic_api.ts
@@ -147,6 +147,8 @@ // The title of the loaded page. Returned if the page is loaded enough for it // to be available. It may be empty if the page did not define a title. title?: string; + // The favicon for the tab. Provided when available. + favicon?(): Promise<Blob|undefined>; } /**
diff --git a/chrome/browser/resources/glic/glic_api/glic_api_client.ts b/chrome/browser/resources/glic/glic_api/glic_api_client.ts index f2823d1e..679a91ad 100644 --- a/chrome/browser/resources/glic/glic_api/glic_api_client.ts +++ b/chrome/browser/resources/glic/glic_api/glic_api_client.ts
@@ -6,7 +6,9 @@ import {GetTabContextErrorReason} from '../glic_api/glic_api.js'; import {PostMessageRequestReceiver, PostMessageRequestSender} from './post_message_transport.js'; -import type {WebClientRequestTypes} from './request_types.js'; +import type {RgbaImage, TabContextResultPrivate, TabDataPrivate, WebClientRequestTypes} from './request_types.js'; +import {ImageAlphaType, ImageColorType} from './request_types.js'; + // Web client side of the Glic API. // Communicates with the Chrome-WebUI-side in glic_api_host.ts @@ -114,7 +116,7 @@ if (!result.tabData) { throw new Error('createTab: failed'); } - return result.tabData; + return convertTabDataFromPrivate(result.tabData); } closePanel(): Promise<void> { @@ -132,7 +134,7 @@ 'getContext failed', context.error || GetTabContextErrorReason.UNKNOWN); } - return context.tabContextResult; + return convertTabContextResultFromPrivate(context.tabContextResult); } async resizeWindow(width: number, height: number) { @@ -170,3 +172,66 @@ super(message); } } + +// Converts an RgbaImage into a Blob through the canvas API. Output is a PNG. +async function rgbaImageToBlob(image: RgbaImage): Promise<Blob> { + const canvas = document.createElement('canvas'); + canvas.width = image.width; + canvas.height = image.height; + const ctx = canvas.getContext('2d'); + if (!ctx) { + throw Error('getContext error'); + } + if (image.colorType !== ImageColorType.BGRA) { + throw Error('unsupported colorType'); + } + // Note that for either alphaType, we swap bytes from BGRA to RGBA order. + const pixelData = new Uint8ClampedArray(image.dataRGBA); + if (image.alphaType === ImageAlphaType.PREMUL) { + for (let i = 0; i + 3 < pixelData.length; i += 4) { + const alphaInt = pixelData[i + 3]!; + if (alphaInt === 0) { + // Don't divide by zero. In this case, RGB should already be zero, so + // there's no purpose in swapping bytes. + continue; + } + const alpha = alphaInt / 255.0; + pixelData[i] = pixelData[i + 2]! / alpha; + pixelData[i + 1] = pixelData[i + 1]! / alpha; + pixelData[i + 2] = pixelData[i]! / alpha; + } + } else { + for (let i = 0; i + 3 < pixelData.length; i += 4) { + pixelData[i] = pixelData[i + 2]!; + pixelData[i + 2] = pixelData[i]!; + } + } + ctx.putImageData(new ImageData(pixelData, image.width, image.height), 0, 0); + return new Promise((resolve) => { + canvas.toBlob((result) => { + if (!result) { + throw Error('toBlob failed'); + } + resolve(result); + }); + }); +} + +function convertTabDataFromPrivate(data: TabDataPrivate): TabData { + const result = Object.assign({}, data) as TabData; + if (data.rawFavicon) { + const rawFavicon = data.rawFavicon; + delete (result as any).rawFavicon; + result.favicon = () => rgbaImageToBlob(rawFavicon); + } + return result; +} + +function convertTabContextResultFromPrivate(data: TabContextResultPrivate): + TabContextResult { + const result = Object.assign({}, data) as TabContextResult; + if (data.tabData) { + result.tabData = convertTabDataFromPrivate(data.tabData); + } + return result; +}
diff --git a/chrome/browser/resources/glic/glic_api/request_types.ts b/chrome/browser/resources/glic/glic_api/request_types.ts index 1aa9e3e..dd675cb 100644 --- a/chrome/browser/resources/glic/glic_api/request_types.ts +++ b/chrome/browser/resources/glic/glic_api/request_types.ts
@@ -49,7 +49,7 @@ }, response: { // Undefined on failure. - tabData?: TabData, + tabData?: TabDataPrivate, }, }; glicBrowserClosePanel: { @@ -66,7 +66,7 @@ }, response: { // Present on success. - tabContextResult?: TabContextResult, + tabContextResult?: TabContextResultPrivate, // The error reason. Should be present when `tabContextResult` is not, but // might still be undefined for some older chrome versions. error?: GetTabContextErrorReason, @@ -97,3 +97,39 @@ response: void, }; } + +// +// Types used in messages that are not exposed directly to the API. +// + +// TabData format for postMessage transport. +export declare interface TabDataPrivate extends Omit<TabData, 'favicon'> { + rawFavicon?: RgbaImage; +} + +// A bitmap, used to store data from a BitmapN32 without conversion. +export declare interface RgbaImage { + dataRGBA: ArrayBuffer; + width: number; + height: number; + alphaType: ImageAlphaType; + colorType: ImageColorType; +} + +export enum ImageAlphaType { + // RGB values are unmodified. + UNPREMUL = 0, + // RGB values have been premultiplied by alpha. + PREMUL = 1, +} + +// Chromium currently only uses a single color type for BitmapN32. +export enum ImageColorType { + BGRA = 0, +} + +// TabContextResult data for postMessage transport. +export declare interface TabContextResultPrivate extends + Omit<TabContextResult, 'tabData'> { + tabData: TabDataPrivate; +}
diff --git a/chrome/browser/resources/glic/glic_api_impl/glic_api_host.ts b/chrome/browser/resources/glic/glic_api_impl/glic_api_host.ts index 4ee27e8c..a0dc2ead 100644 --- a/chrome/browser/resources/glic/glic_api_impl/glic_api_host.ts +++ b/chrome/browser/resources/glic/glic_api_impl/glic_api_host.ts
@@ -9,6 +9,9 @@ // TODO(crbug.com/379677413): Add tests for the API host. import {loadTimeData} from '//resources/js/load_time_data.js'; +import type {BigBuffer} from '//resources/mojo/mojo/public/mojom/base/big_buffer.mojom-webui.js'; +import type {BitmapN32} from '//resources/mojo/skia/public/mojom/bitmap.mojom-webui.js'; +import {AlphaType} from '//resources/mojo/skia/public/mojom/image_info.mojom-webui.js'; import type {Origin} from '//resources/mojo/url/mojom/origin.mojom-webui.js'; import type {Url} from '//resources/mojo/url/mojom/url.mojom-webui.js'; @@ -19,8 +22,8 @@ import {GetTabContextErrorReason} from '../glic_api/glic_api.js'; import type {PostMessageRequestHandler} from '../glic_api/post_message_transport.js'; import {PostMessageRequestReceiver, PostMessageRequestSender} from '../glic_api/post_message_transport.js'; -import type {HostRequestTypes} from '../glic_api/request_types.js'; - +import type {HostRequestTypes, RgbaImage} from '../glic_api/request_types.js'; +import {ImageAlphaType, ImageColorType} from '../glic_api/request_types.js'; // Turn everything except void into a promise. type Promisify<T> = T extends void ? void : Promise<T>; @@ -131,11 +134,20 @@ return {error}; } const tabData = tabContext.tabData; + let rawFavicon: RgbaImage|undefined = undefined; + if (tabData.favicon) { + rawFavicon = bitmapN32ToRGBAImage(tabData.favicon); + if (rawFavicon) { + transfer.push(rawFavicon.dataRGBA); + } + } + const tabDataResult = { tabId: tabIdToClient(tabData.tabId), windowId: windowIdToClient(tabData.windowId), url: urlToClient(tabData.url), title: optionalToClient(tabData.title), + rawFavicon, }; const webPageData = tabContext.webPageData; let webPageDataResult: WebPageData|undefined = undefined; @@ -329,3 +341,34 @@ } return originBase; } + +function getArrayBufferFromBigBuffer(bigBuffer: BigBuffer): ArrayBuffer| + undefined { + if (bigBuffer.bytes !== undefined) { + return new Uint8Array(bigBuffer.bytes).buffer; + } + return bigBuffer.sharedMemory?.bufferHandle + .mapBuffer(0, bigBuffer.sharedMemory.size) + .buffer; +} + +function bitmapN32ToRGBAImage(bitmap: BitmapN32): RgbaImage|undefined { + const bytes = getArrayBufferFromBigBuffer(bitmap.pixelData); + if (!bytes) { + return undefined; + } + // We don't transmit ColorType over mojo, because it's determined by the + // endianness of the platform. Chromium only supports little endian, which + // maps to BGRA. See third_party/skia/include/core/SkColorType.h. + const colorType = ImageColorType.BGRA; + + return { + width: bitmap.imageInfo.width, + height: bitmap.imageInfo.height, + dataRGBA: bytes, + alphaType: bitmap.imageInfo.alphaType === AlphaType.PREMUL ? + ImageAlphaType.PREMUL : + ImageAlphaType.UNPREMUL, + colorType, + }; +}
diff --git a/chrome/browser/resources/settings/ai_page/ai_compare_subpage.html b/chrome/browser/resources/settings/ai_page/ai_compare_subpage.html index 67ab687..b897fe1 100644 --- a/chrome/browser/resources/settings/ai_page/ai_compare_subpage.html +++ b/chrome/browser/resources/settings/ai_page/ai_compare_subpage.html
@@ -24,6 +24,21 @@ </cr-icon> <div class="secondary">$i18n{aiCompareWhenOnProductDetails}</div> </li> + <li> + <cr-icon icon="settings20:text-compare" aria-hidden="true"> + </cr-icon> + <div class="secondary">$i18n{aiCompareWhenOnProductSuggest}</div> + </li> + <li> + <cr-icon icon="settings20:filter-list" aria-hidden="true"> + </cr-icon> + <div class="secondary">$i18n{aiCompareWhenOnProductFilter}</div> + </li> + <li> + <cr-icon icon="settings20:reviews" aria-hidden="true"> + </cr-icon> + <div class="secondary">$i18n{aiCompareWhenOnProductReviews}</div> + </li> </ul> </div> <div class="column">
diff --git a/chrome/browser/resources/settings/ai_page/ai_page.ts b/chrome/browser/resources/settings/ai_page/ai_page.ts index dd175f1..e239df8 100644 --- a/chrome/browser/resources/settings/ai_page/ai_page.ts +++ b/chrome/browser/resources/settings/ai_page/ai_page.ts
@@ -161,10 +161,19 @@ } private async setShowAutofillAiControl_() { + if (loadTimeData.getBoolean('showAiSettingsForTesting')) { + this.showAutofillAIControl_ = true; + return; + } + + if (!loadTimeData.getBoolean('autofillAiEnabled')) { + this.showAutofillAIControl_ = false; + return; + } + this.showAutofillAIControl_ = - loadTimeData.getBoolean('autofillAiEnabled') && - (await UserAnnotationsManagerProxyImpl.getInstance().isUserEligible() || - await UserAnnotationsManagerProxyImpl.getInstance().hasEntries()); + await UserAnnotationsManagerProxyImpl.getInstance().isUserEligible() || + await UserAnnotationsManagerProxyImpl.getInstance().hasEntries(); } private onHistorySearchRowClick_() {
diff --git a/chrome/browser/resources/settings/ai_page/ai_tab_organization_subpage.html b/chrome/browser/resources/settings/ai_page/ai_tab_organization_subpage.html index 0199bb7..7a845ef 100644 --- a/chrome/browser/resources/settings/ai_page/ai_tab_organization_subpage.html +++ b/chrome/browser/resources/settings/ai_page/ai_tab_organization_subpage.html
@@ -27,6 +27,12 @@ $i18n{tabOrganizationSettingWhenOnAutoGroups} </div> </li> + <li> + <cr-icon icon="settings20:tab" aria-hidden="true"></cr-icon> + <div class="secondary"> + $i18n{tabOrganizationSettingWhenOnImproveFocus} + </div> + </li> </ul> </div> <div class="column">
diff --git a/chrome/browser/resources/settings/ai_page/history_search_page.html b/chrome/browser/resources/settings/ai_page/history_search_page.html index bf3d116..893f251 100644 --- a/chrome/browser/resources/settings/ai_page/history_search_page.html +++ b/chrome/browser/resources/settings/ai_page/history_search_page.html
@@ -109,16 +109,24 @@ $i18n{historySearchWithAnswersWhenOnPageContent} </div> </li> + <li id="whenOnRecallInfoWithAnswers" + hidden="[[!isAnswersFeatureEnabled_]]"> + <cr-icon icon="settings20:auto-summarize" aria-hidden="true"> + </cr-icon> + <div class="secondary"> + $i18n{historySearchWithAnswersWhenOnRecallInfo} + </div> + </li> <li> <cr-icon icon="settings20:quick-reference-all" aria-hidden="true"> </cr-icon> <div class="secondary">$i18n{historySearchWhenOnSearchFrom}</div> </li> - <li id="whenOnLogStartItem" hidden="[[!isAnswersFeatureEnabled_]]"> - <cr-icon icon="settings20:summarize" aria-hidden="true"> + <li id="whenOnLogStartItem"> + <cr-icon icon="settings20:history" aria-hidden="true"> </cr-icon> <div class="secondary"> - $i18n{historySearchWithAnswersWhenOnLogStart} + $i18n{historySearchWhenOnLogStart} </div> </li> </ul>
diff --git a/chrome/browser/resources/settings/ai_page/offer_writing_help_page.html b/chrome/browser/resources/settings/ai_page/offer_writing_help_page.html index 608c767d..8134286 100644 --- a/chrome/browser/resources/settings/ai_page/offer_writing_help_page.html +++ b/chrome/browser/resources/settings/ai_page/offer_writing_help_page.html
@@ -47,6 +47,14 @@ <cr-icon icon="settings20:pen-spark" aria-hidden="true"></cr-icon> <div class="secondary">$i18n{aiComposeWhenOnWritingHelp}</div> </li> + <li> + <cr-icon icon="settings20:summarize" aria-hidden="true"></cr-icon> + <div class="secondary">$i18n{aiComposeWhenOnWritingExamples}</div> + </li> + <li> + <cr-icon icon="settings20:text-analysis" aria-hidden="true"></cr-icon> + <div class="secondary">$i18n{aiComposeWhenOnWritingReferences}</div> + </li> </ul> </div> <div class="column">
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html index ee715652..fa4306e5 100644 --- a/chrome/browser/resources/settings/icons.html +++ b/chrome/browser/resources/settings/icons.html
@@ -12,6 +12,7 @@ <g id="archive"><path d="M4.5 17C4.08333 17 3.72917 16.8542 3.4375 16.5625C3.14583 16.2708 3 15.9167 3 15.5V5.625C3 5.43055 3.03472 5.24306 3.10417 5.0625C3.1875 4.86805 3.29861 4.70139 3.4375 4.5625L4.5625 3.4375C4.70139 3.29861 4.86111 3.19444 5.04167 3.125C5.23611 3.04167 5.43056 3 5.625 3H14.375C14.5694 3 14.7569 3.04167 14.9375 3.125C15.1319 3.19444 15.2986 3.29861 15.4375 3.4375L16.5625 4.5625C16.7014 4.70139 16.8056 4.86805 16.875 5.0625C16.9583 5.24306 17 5.43055 17 5.625V15.5C17 15.9167 16.8542 16.2708 16.5625 16.5625C16.2708 16.8542 15.9167 17 15.5 17H4.5ZM4.625 5.5H15.375L14.375 4.5H5.625L4.625 5.5ZM4.5 7V15.5H15.5V7H4.5ZM10 14.25L13 11.25L11.9375 10.1875L10.75 11.375V8.25H9.25V11.375L8.0625 10.1875L7 11.25L10 14.25ZM4.5 15.5H15.5H4.5Z"></path></g> <g id="astrophotography-mode"><path d="M15.5 7.97917L14.3958 5.58333L12 4.5L14.3958 3.39583L15.5 0.999999L16.5833 3.39583L18.9792 4.5L16.5833 5.58333L15.5 7.97917ZM15.5 18.9792L14.4167 16.5625L12 15.4792L14.4167 14.3958L15.5 11.9792L16.5833 14.3958L19 15.4792L16.5833 16.5625L15.5 18.9792ZM8.5 16.4792L6.47917 12L2 9.97917L6.47917 7.95833L8.5 3.47917L10.5208 7.95833L15 9.97917L10.5208 12L8.5 16.4792ZM8.5 12.8542L9.39583 10.875L11.375 9.97917L9.39583 9.08333L8.5 7.10417L7.60417 9.08333L5.625 9.97917L7.60417 10.875L8.5 12.8542Z"></path></g> <g id="auto-delete"><path d="M6.5 5.5v10ZM9.396 17H6.5q-.625 0-1.062-.438Q5 16.125 5 15.5v-10H4V4h4V3h4v1h4v1.5h-1v3.104q-.375-.062-.75-.094-.375-.031-.75.011V5.5h-7v10h2.208q.104.396.282.771.177.375.406.729ZM8 14h.5q0-1.458.5-2.312l.5-.855V7H8Zm2.5-4.25q.292-.229.677-.469.385-.239.823-.406V7h-1.5ZM14 18q-1.667 0-2.833-1.167Q10 15.667 10 14q0-1.667 1.167-2.833Q12.333 10 14 10q1.667 0 2.833 1.167Q18 12.333 18 14q0 1.667-1.167 2.833Q15.667 18 14 18Zm1.146-2.146.708-.708-1.354-1.354V12h-1v2.208Z"></path></g> + <g id="auto-summarize"><path d="M5.83333 9.16665V7.49998H10.8333V9.16665H5.83333ZM5.83333 12.5V10.8333H17.5V12.5H5.83333ZM5.83333 15.8333V14.1666H17.5V15.8333H5.83333ZM3.33333 9.16665C3.09722 9.16665 2.89931 9.08679 2.73958 8.92706C2.57986 8.76734 2.5 8.56942 2.5 8.33331C2.5 8.0972 2.57986 7.89929 2.73958 7.73956C2.89931 7.57984 3.09722 7.49998 3.33333 7.49998C3.56944 7.49998 3.76736 7.57984 3.92708 7.73956C4.08681 7.89929 4.16667 8.0972 4.16667 8.33331C4.16667 8.56942 4.08681 8.76734 3.92708 8.92706C3.76736 9.08679 3.56944 9.16665 3.33333 9.16665ZM3.33333 12.5C3.09722 12.5 2.89931 12.4201 2.73958 12.2604C2.57986 12.1007 2.5 11.9028 2.5 11.6666C2.5 11.4305 2.57986 11.2326 2.73958 11.0729C2.89931 10.9132 3.09722 10.8333 3.33333 10.8333C3.56944 10.8333 3.76736 10.9132 3.92708 11.0729C4.08681 11.2326 4.16667 11.4305 4.16667 11.6666C4.16667 11.9028 4.08681 12.1007 3.92708 12.2604C3.76736 12.4201 3.56944 12.5 3.33333 12.5ZM3.33333 15.8333C3.09722 15.8333 2.89931 15.7535 2.73958 15.5937C2.57986 15.434 2.5 15.2361 2.5 15C2.5 14.7639 2.57986 14.566 2.73958 14.4062C2.89931 14.2465 3.09722 14.1666 3.33333 14.1666C3.56944 14.1666 3.76736 14.2465 3.92708 14.4062C4.08681 14.566 4.16667 14.7639 4.16667 15C4.16667 15.2361 4.08681 15.434 3.92708 15.5937C3.76736 15.7535 3.56944 15.8333 3.33333 15.8333ZM14.5833 9.99998C14.5833 8.7222 15.0278 7.63887 15.9167 6.74998C16.8056 5.86109 17.8889 5.41665 19.1667 5.41665C17.8889 5.41665 16.8056 4.9722 15.9167 4.08331C15.0278 3.19442 14.5833 2.11109 14.5833 0.833313C14.5833 2.11109 14.1389 3.19442 13.25 4.08331C12.3611 4.9722 11.2778 5.41665 10 5.41665C11.2778 5.41665 12.3611 5.86109 13.25 6.74998C14.1389 7.63887 14.5833 8.7222 14.5833 9.99998Z"></path></g> <g id="auto-tab-group"><path d="M6.5 3.5C6.5 3.81944 6.5 4.14583 6.5 4.47917C6.5 4.8125 6.5 5.15972 6.5 5.52083C6.5 7.03472 6.5 8.32639 6.5 9.39583C6.5 10.4653 6.5 11 6.5 11C6.5 11 6.5 10.9653 6.5 10.8958C6.5 10.8264 6.5 10.7292 6.5 10.6042V13.5V3.5ZM3.5 18C3.08333 18 2.72917 17.8542 2.4375 17.5625C2.14583 17.2708 2 16.9167 2 16.5V5H3.5V16.5H15V18H3.5ZM6.5 15C6.08333 15 5.72917 14.8542 5.4375 14.5625C5.14583 14.2708 5 13.9167 5 13.5V3.5C5 3.08333 5.14583 2.72917 5.4375 2.4375C5.72917 2.14583 6.08333 2 6.5 2H10.2708C10.0764 2.22222 9.90278 2.45833 9.75 2.70833C9.61111 2.95833 9.48611 3.22222 9.375 3.5H6.5V13.5H16.5V10.6042C16.7778 10.4931 17.0417 10.3681 17.2917 10.2292C17.5417 10.0764 17.7778 9.90278 18 9.70833V13.5C18 13.9167 17.8542 14.2708 17.5625 14.5625C17.2708 14.8542 16.9167 15 16.5 15H6.5ZM14.5 10C14.5 8.75 14.0625 7.6875 13.1875 6.8125C12.3125 5.9375 11.25 5.5 10 5.5C11.25 5.5 12.3125 5.0625 13.1875 4.1875C14.0625 3.3125 14.5 2.25 14.5 0.999999C14.5 2.25 14.9375 3.3125 15.8125 4.1875C16.6875 5.0625 17.75 5.5 19 5.5C17.75 5.5 16.6875 5.9375 15.8125 6.8125C14.9375 7.6875 14.5 8.75 14.5 10Z"></path></g> <g id="background-replace"><path d="M3 8.104V6.333L6.333 3h1.792Zm0-3.896V3h1.208Zm10.188 1.521Q13 5.5 12.76 5.281q-.239-.219-.51-.385L14.167 3h1.791Zm-8.73 6.938 2.063-2.042q.167.25.364.458.198.209.365.375l-.25.25q-.625.146-1.312.407-.688.26-1.23.552Zm9.667-3.979q0-.021.021-.136.021-.114.021-.156 0-.354-.052-.688-.053-.333-.157-.625L17 4.062v1.771Zm-5.354-4.23L10.271 3h1.771l-1.313 1.312q-.187-.041-.364-.052-.177-.01-.344-.01-.354 0-.667.052-.312.052-.583.156Zm-5.729 7.521v-1.771l3.062-3.041q-.104.291-.166.604-.063.312-.063.625 0 .166.01.333.011.167.053.354Zm13.729 1.833q-.167-.25-.365-.479-.198-.229-.489-.416L17 11.854v1.75ZM14.5 12.188q-.125-.042-.292-.105-.166-.062-.312-.104-.167-.062-.354-.114-.188-.053-.375-.094L17 7.938v1.791Zm-4.479-.688q-1.313 0-2.219-.917-.906-.916-.906-2.187 0-1.292.906-2.208.906-.917 2.219-.917 1.291 0 2.198.917.906.916.906 2.208 0 1.271-.906 2.187-.907.917-2.198.917Zm0-1.5q.667 0 1.135-.469.469-.469.469-1.135 0-.667-.469-1.146-.468-.479-1.135-.479t-1.146.479q-.479.479-.479 1.146 0 .666.479 1.135t1.146.469ZM4 17v-1.5q0-.604.323-1.125t.865-.813q1.124-.583 2.333-.895 1.208-.313 2.479-.313 1.25 0 2.458.313 1.209.312 2.334.895.541.292.875.813.333.521.333 1.125V17Zm1.5-1.5h9q0-.208-.125-.354t-.292-.25q-.937-.5-1.979-.771T10 13.854q-1.062 0-2.104.261-1.042.26-1.979.76-.188.104-.302.26-.115.157-.115.365Z"></path></g> <g id="bar-chart"><path fill-rule="evenodd" clip-rule="evenodd" d="M4 16V8h3v8Zm4.5 0V4h3v12Zm4.5 0v-6h3v6Z"></path></g> @@ -64,6 +65,7 @@ <g id="psychiatry"><path d="M9.25 17V10.8125H9.0625C8.27083 10.8125 7.50694 10.6667 6.77083 10.375C6.04861 10.0694 5.40278 9.63889 4.83333 9.08333C4.23611 8.51389 3.77778 7.85417 3.45833 7.10417C3.15278 6.35417 3 5.56944 3 4.75V3H4.75C5.54167 3 6.29861 3.15278 7.02083 3.45833C7.74306 3.75 8.38889 4.17361 8.95833 4.72917C9.36111 5.11805 9.69445 5.55555 9.95833 6.04167C10.2361 6.51389 10.4444 7.01389 10.5833 7.54167C11.1111 6.80556 11.7917 6.24305 12.625 5.85417C13.4583 5.45139 14.3333 5.25 15.25 5.25H17V7C17 7.81944 16.8403 8.60417 16.5208 9.35417C16.2153 10.1042 15.7639 10.7639 15.1667 11.3333C14.6111 11.8194 13.9931 12.1944 13.3125 12.4583C12.6319 12.7222 11.9236 12.8542 11.1875 12.8542H10.75V17H9.25ZM9.25 9.25C9.25 8.61111 9.13889 7.99306 8.91667 7.39583C8.70833 6.78472 8.38194 6.25694 7.9375 5.8125C7.49306 5.36805 6.96528 5.04167 6.35417 4.83333C5.75694 4.61111 5.13889 4.5 4.5 4.5C4.5 5.13889 4.60417 5.76389 4.8125 6.375C5.03472 6.97222 5.36806 7.49306 5.8125 7.9375C6.25694 8.38194 6.77778 8.71528 7.375 8.9375C7.98611 9.14583 8.61111 9.25 9.25 9.25ZM10.75 11.5C11.3889 11.5 12.0069 11.3958 12.6042 11.1875C13.2153 10.9653 13.7431 10.6319 14.1875 10.1875C14.6319 9.74305 14.9583 9.22222 15.1667 8.625C15.3889 8.01389 15.5 7.38889 15.5 6.75C14.8611 6.75 14.2361 6.86111 13.625 7.08333C13.0278 7.29167 12.5069 7.61805 12.0625 8.0625C11.6181 8.50694 11.2847 9.03472 11.0625 9.64583C10.8542 10.2431 10.75 10.8611 10.75 11.5Z"></path></g> <g id="public"><path fill-rule="evenodd" clip-rule="evenodd" d="M10 1.667A8.336 8.336 0 0 0 1.667 10c0 4.6 3.733 8.333 8.333 8.333S18.333 14.6 18.333 10 14.6 1.667 10 1.667zM3.333 10c0-.508.067-1.008.175-1.483L7.492 12.5v.833c0 .917.75 1.667 1.666 1.667v1.608C5.883 16.192 3.333 13.392 3.333 10zm9.992 3.333c.75 0 1.367.492 1.583 1.167a6.66 6.66 0 0 0 1.758-4.5 6.67 6.67 0 0 0-4.175-6.175v.342c0 .916-.75 1.666-1.666 1.666H9.158V7.5a.836.836 0 0 1-.833.833H6.658V10h5c.459 0 .834.375.834.833v2.5h.833z"></path></g> <g id="quick-reference-all"><path d="M4.5 3.5V7V9.02083C4.5 9.14583 4.5 9.68055 4.5 10.625C4.5 11.5694 4.5 12.6944 4.5 14C4.5 14.4583 4.5 14.9028 4.5 15.3333C4.5 15.75 4.5 16.1389 4.5 16.5V3.5V7V3.5ZM6 12H9.41667C9.54167 11.7222 9.6875 11.4583 9.85417 11.2083C10.0347 10.9583 10.2292 10.7222 10.4375 10.5H6V12ZM6 15H9.10417C9.04861 14.75 9.01389 14.5 9 14.25C8.98611 14 8.99306 13.75 9.02083 13.5H6V15ZM4.5 18C4.08333 18 3.72917 17.8542 3.4375 17.5625C3.14583 17.2708 3 16.9167 3 16.5V3.5C3 3.08333 3.14583 2.72917 3.4375 2.4375C3.72917 2.14583 4.08333 2 4.5 2H11L15 6V9.10417C14.75 9.04861 14.5 9.01389 14.25 9C14 8.98611 13.75 8.99305 13.5 9.02083V7H10V3.5H4.5V16.5H9.66667C9.83333 16.7917 10.0278 17.0694 10.25 17.3333C10.4722 17.5833 10.7222 17.8056 11 18H4.5ZM14 16C14.5556 16 15.0278 15.8056 15.4167 15.4167C15.8056 15.0278 16 14.5556 16 14C16 13.4444 15.8056 12.9722 15.4167 12.5833C15.0278 12.1944 14.5556 12 14 12C13.5556 12 13.1111 12.1667 12.6667 12.5C12.2222 12.8333 12 13.3333 12 14C12 14.5556 12.1944 15.0278 12.5833 15.4167C12.9722 15.8056 13.4444 16 14 16ZM17.9375 19L15.8958 16.9375C15.6181 17.1181 15.3194 17.2569 15 17.3542C14.6806 17.4514 14.3542 17.5 14.0208 17.5C13.0347 17.5 12.2014 17.1597 11.5208 16.4792C10.8403 15.7986 10.5 14.9722 10.5 14C10.5 13.0278 10.8403 12.2014 11.5208 11.5208C12.2014 10.8403 13.0278 10.5 14 10.5C14.9722 10.5 15.7986 10.8403 16.4792 11.5208C17.1597 12.2014 17.5 13.0278 17.5 14C17.5 14.3472 17.4514 14.6806 17.3542 15C17.2569 15.3194 17.1181 15.6181 16.9375 15.8958L19 17.9375L17.9375 19Z"></path></g> + <g id="reviews"><path d="M7.6875 11.75L10 10.375L12.3125 11.75L11.6875 9.16667L13.7292 7.41667L11.0417 7.1875L10 4.75L8.95833 7.1875L6.27083 7.41667L8.3125 9.16667L7.6875 11.75ZM2 18V3.5C2 3.08333 2.14583 2.72917 2.4375 2.4375C2.72917 2.14583 3.08333 2 3.5 2H16.5C16.9167 2 17.2708 2.14583 17.5625 2.4375C17.8542 2.72917 18 3.08333 18 3.5V13.5C18 13.9167 17.8542 14.2708 17.5625 14.5625C17.2708 14.8542 16.9167 15 16.5 15H5L2 18ZM4.375 13.5H16.5V3.5H3.5V14.375L4.375 13.5ZM3.5 13.5V3.5V13.5Z"></path></g> <g id="rule-folder" viewBox="0 -960 960 960"><path d="m313-305 198-198-57-57-141 142-57-57-56 57 113 113Zm263 0 64-64 64 64 56-56-64-64 64-64-56-56-64 64-64-64-56 56 64 64-64 64 56 56ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H447l-80-80H160v480Zm0 0v-480 480Z"></path></g> <g id="search-spark"><path d="M15.9375 17L10.9583 12.0208C10.5417 12.3264 10.0833 12.5694 9.58333 12.75C9.08333 12.9167 8.55556 13 8 13C6.61111 13 5.43056 12.5139 4.45833 11.5417C3.48611 10.5694 3 9.38889 3 8C3 6.61111 3.48611 5.43055 4.45833 4.45833C5.43056 3.48611 6.61111 3 8 3C8.36111 3 8.70139 3.03472 9.02083 3.10417C9.35417 3.17361 9.67361 3.27778 9.97917 3.41667L8.79167 4.58333C8.66667 4.55555 8.53472 4.53472 8.39583 4.52083C8.27083 4.50694 8.13889 4.5 8 4.5C7.02778 4.5 6.20139 4.84028 5.52083 5.52083C4.84028 6.20139 4.5 7.02778 4.5 8C4.5 8.97222 4.84028 9.79861 5.52083 10.4792C6.20139 11.1597 7.02778 11.5 8 11.5C8.80556 11.5 9.51389 11.2708 10.125 10.8125C10.7361 10.3403 11.1458 9.73611 11.3542 9H12.8958C12.8264 9.36111 12.7153 9.70833 12.5625 10.0417C12.4097 10.3611 12.2292 10.6667 12.0208 10.9583L17 15.9375L15.9375 17ZM14.5 10C14.5 8.75 14.0625 7.6875 13.1875 6.8125C12.3125 5.9375 11.25 5.5 10 5.5C11.25 5.5 12.3125 5.0625 13.1875 4.1875C14.0625 3.3125 14.5 2.25 14.5 0.999999C14.5 2.25 14.9375 3.3125 15.8125 4.1875C16.6875 5.0625 17.75 5.5 19 5.5C17.75 5.5 16.6875 5.9375 15.8125 6.8125C14.9375 7.6875 14.5 8.75 14.5 10Z"></path></g> <g id="security"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.183 4.7L10 1.667 16.816 4.7v4.542c0 4.208-2.908 8.133-6.816 9.091-3.909-.958-6.817-4.883-6.817-9.091V4.7zM15.3 9.992H10V3.325L4.7 5.683V10l5.3-.008v6.775c2.816-.875 4.9-3.65 5.3-6.775z"></path></g> @@ -71,9 +73,11 @@ <g id="shoppingcart"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.1585 10.8333H12.8502C13.4502 10.8333 14.0002 10.5083 14.3002 9.99167L17.0335 5.20001C17.2502 4.81667 17.2502 4.33334 17.0335 3.95001C16.8168 3.56667 16.3918 3.33334 15.9502 3.33334H4.61683L3.87516 1.66667H0.833496V3.33334H2.79183L5.74183 9.98334L4.85016 11.7583C4.59183 12.275 4.61683 12.8833 4.92516 13.3833C5.2335 13.8833 5.7585 14.175 6.34183 14.175H15.8335V12.5083H6.35016L7.1835 10.8417H12.1585V10.8333ZM7.50016 16.6667C7.50016 17.5871 6.75397 18.3333 5.8335 18.3333C4.91302 18.3333 4.16683 17.5871 4.16683 16.6667C4.16683 15.7462 4.91302 15 5.8335 15C6.75397 15 7.50016 15.7462 7.50016 16.6667ZM15.8335 16.6667C15.8335 17.5871 15.0873 18.3333 14.1668 18.3333C13.2464 18.3333 12.5002 17.5871 12.5002 16.6667C12.5002 15.7462 13.2464 15 14.1668 15C15.0873 15 15.8335 15.7462 15.8335 16.6667ZM12.8502 9.16667L15.2335 5.00001H5.3585L7.2085 9.16667H12.8502Z"></path></g> <g id="spam"><path d="M15.0714 6.66667V3.5H16.5V7.38889H15.0714V6.66667ZM15.0714 9.83333H16.5V8.38889H15.0714V9.83333ZM9.71429 10.9444C11.6214 10.9444 15.4286 11.9122 15.4286 13.8333V16H4V13.8333C4 11.9122 7.80714 10.9444 9.71429 10.9444ZM9.71429 4.44444C10.472 4.44444 11.1988 4.74881 11.7346 5.29058C12.2704 5.83235 12.5714 6.56715 12.5714 7.33333C12.5714 8.09951 12.2704 8.83431 11.7346 9.37609C11.1988 9.91786 10.472 10.2222 9.71429 10.2222C8.95652 10.2222 8.2298 9.91786 7.69398 9.37609C7.15816 8.83431 6.85714 8.09951 6.85714 7.33333C6.85714 6.56715 7.15816 5.83235 7.69398 5.29058C8.2298 4.74881 8.95652 4.44444 9.71429 4.44444ZM9.71429 12.3167C7.59286 12.3167 5.35714 13.3711 5.35714 13.8333V14.6278H14.0714V13.8333C14.0714 13.3711 11.8357 12.3167 9.71429 12.3167ZM9.71429 5.81667C9.31646 5.81667 8.93493 5.97646 8.65363 6.26089C8.37232 6.54532 8.21429 6.93109 8.21429 7.33333C8.21429 7.73558 8.37232 8.12135 8.65363 8.40578C8.93493 8.69021 9.31646 8.85 9.71429 8.85C10.1121 8.85 10.4936 8.69021 10.7749 8.40578C11.0563 8.12135 11.2143 7.73558 11.2143 7.33333C11.2143 6.93109 11.0563 6.54532 10.7749 6.26089C10.4936 5.97646 10.1121 5.81667 9.71429 5.81667Z"></path></g> <g id="sync-saved-locally"><path d="M 9.105469 11.707031 L 13.832031 7 L 12.644531 5.8125 L 9.105469 9.355469 L 7.332031 7.582031 L 6.167969 8.75 Z M 0.832031 17.5 L 0.832031 15.832031 L 19.167969 15.832031 L 19.167969 17.5 Z M 3.332031 15 C 2.875 15 2.484375 14.835938 2.15625 14.511719 C 1.828125 14.183594 1.667969 13.792969 1.667969 13.332031 L 1.667969 4.167969 C 1.667969 3.707031 1.828125 3.316406 2.15625 2.988281 C 2.484375 2.664062 2.875 2.5 3.332031 2.5 L 16.667969 2.5 C 17.125 2.5 17.515625 2.664062 17.84375 2.988281 C 18.171875 3.316406 18.332031 3.707031 18.332031 4.167969 L 18.332031 13.332031 C 18.332031 13.792969 18.171875 14.183594 17.84375 14.511719 C 17.515625 14.835938 17.125 15 16.667969 15 Z M 3.332031 13.332031 L 16.667969 13.332031 L 16.667969 4.167969 L 3.332031 4.167969 Z M 3.332031 13.332031 L 3.332031 4.167969 Z M 3.332031 13.332031 "></path></g> - <g id="summarize"><path d="M5.83333 9.16665V7.49998H10.8333V9.16665H5.83333ZM5.83333 12.5V10.8333H17.5V12.5H5.83333ZM5.83333 15.8333V14.1666H17.5V15.8333H5.83333ZM3.33333 9.16665C3.09722 9.16665 2.89931 9.08679 2.73958 8.92706C2.57986 8.76734 2.5 8.56942 2.5 8.33331C2.5 8.0972 2.57986 7.89929 2.73958 7.73956C2.89931 7.57984 3.09722 7.49998 3.33333 7.49998C3.56944 7.49998 3.76736 7.57984 3.92708 7.73956C4.08681 7.89929 4.16667 8.0972 4.16667 8.33331C4.16667 8.56942 4.08681 8.76734 3.92708 8.92706C3.76736 9.08679 3.56944 9.16665 3.33333 9.16665ZM3.33333 12.5C3.09722 12.5 2.89931 12.4201 2.73958 12.2604C2.57986 12.1007 2.5 11.9028 2.5 11.6666C2.5 11.4305 2.57986 11.2326 2.73958 11.0729C2.89931 10.9132 3.09722 10.8333 3.33333 10.8333C3.56944 10.8333 3.76736 10.9132 3.92708 11.0729C4.08681 11.2326 4.16667 11.4305 4.16667 11.6666C4.16667 11.9028 4.08681 12.1007 3.92708 12.2604C3.76736 12.4201 3.56944 12.5 3.33333 12.5ZM3.33333 15.8333C3.09722 15.8333 2.89931 15.7535 2.73958 15.5937C2.57986 15.434 2.5 15.2361 2.5 15C2.5 14.7639 2.57986 14.566 2.73958 14.4062C2.89931 14.2465 3.09722 14.1666 3.33333 14.1666C3.56944 14.1666 3.76736 14.2465 3.92708 14.4062C4.08681 14.566 4.16667 14.7639 4.16667 15C4.16667 15.2361 4.08681 15.434 3.92708 15.5937C3.76736 15.7535 3.56944 15.8333 3.33333 15.8333ZM14.5833 9.99998C14.5833 8.7222 15.0278 7.63887 15.9167 6.74998C16.8056 5.86109 17.8889 5.41665 19.1667 5.41665C17.8889 5.41665 16.8056 4.9722 15.9167 4.08331C15.0278 3.19442 14.5833 2.11109 14.5833 0.833313C14.5833 2.11109 14.1389 3.19442 13.25 4.08331C12.3611 4.9722 11.2778 5.41665 10 5.41665C11.2778 5.41665 12.3611 5.86109 13.25 6.74998C14.1389 7.63887 14.5833 8.7222 14.5833 9.99998Z"></path></path></g> + <g id="summarize"><path d="M6.75 7.5C6.95833 7.5 7.13194 7.43055 7.27083 7.29167C7.42361 7.13889 7.5 6.95833 7.5 6.75C7.5 6.54167 7.42361 6.36805 7.27083 6.22917C7.13194 6.07639 6.95833 6 6.75 6C6.54167 6 6.36111 6.07639 6.20833 6.22917C6.06944 6.36805 6 6.54167 6 6.75C6 6.95833 6.06944 7.13889 6.20833 7.29167C6.36111 7.43055 6.54167 7.5 6.75 7.5ZM6.75 10.75C6.95833 10.75 7.13194 10.6806 7.27083 10.5417C7.42361 10.3889 7.5 10.2083 7.5 10C7.5 9.79167 7.42361 9.61806 7.27083 9.47917C7.13194 9.32639 6.95833 9.25 6.75 9.25C6.54167 9.25 6.36111 9.32639 6.20833 9.47917C6.06944 9.61806 6 9.79167 6 10C6 10.2083 6.06944 10.3889 6.20833 10.5417C6.36111 10.6806 6.54167 10.75 6.75 10.75ZM6.75 14C6.95833 14 7.13194 13.9306 7.27083 13.7917C7.42361 13.6389 7.5 13.4583 7.5 13.25C7.5 13.0417 7.42361 12.8681 7.27083 12.7292C7.13194 12.5764 6.95833 12.5 6.75 12.5C6.54167 12.5 6.36111 12.5764 6.20833 12.7292C6.06944 12.8681 6 13.0417 6 13.25C6 13.4583 6.06944 13.6389 6.20833 13.7917C6.36111 13.9306 6.54167 14 6.75 14ZM4.5 17C4.08333 17 3.72917 16.8542 3.4375 16.5625C3.14583 16.2708 3 15.9167 3 15.5V4.5C3 4.08333 3.14583 3.72917 3.4375 3.4375C3.72917 3.14583 4.08333 3 4.5 3H13L17 7V15.5C17 15.9167 16.8542 16.2708 16.5625 16.5625C16.2708 16.8542 15.9167 17 15.5 17H4.5ZM4.5 15.5H15.5V8H12V4.5H4.5V15.5ZM4.5 4.5V7.75V4.5V7.75V15.5V4.5Z"></path></g> + <g id="tab"><path d="M3.5 14.5H16.5V9H11V5.5H3.5V14.5ZM3.5 16C3.08333 16 2.72917 15.8542 2.4375 15.5625C2.14583 15.2708 2 14.9167 2 14.5V5.5C2 5.08333 2.14583 4.72917 2.4375 4.4375C2.72917 4.14583 3.08333 4 3.5 4H16.5C16.9167 4 17.2708 4.14583 17.5625 4.4375C17.8542 4.72917 18 5.08333 18 5.5V14.5C18 14.9167 17.8542 15.2708 17.5625 15.5625C17.2708 15.8542 16.9167 16 16.5 16H3.5ZM3.5 14.5V5.5V14.5Z"></path></g> <g id="table-chart-organize"><path d="M4.5 17C4.09722 17 3.74306 16.8542 3.4375 16.5625C3.14583 16.2569 3 15.9028 3 15.5V4.5C3 4.08333 3.14583 3.72917 3.4375 3.4375C3.74306 3.14583 4.09722 3 4.5 3H9.58333C9.47222 3.23611 9.36806 3.47917 9.27083 3.72917C9.1875 3.97917 9.125 4.23611 9.08333 4.5H4.5V6.75H9.14583C9.21528 7.02778 9.29861 7.29167 9.39583 7.54167C9.49306 7.77778 9.61111 8.01389 9.75 8.25H8V15.5H12V10.375C12.2361 10.5 12.4792 10.6042 12.7292 10.6875C12.9792 10.7708 13.2361 10.8403 13.5 10.8958V15.5H15.5V10.9167C15.7639 10.875 16.0208 10.8125 16.2708 10.7292C16.5208 10.6319 16.7639 10.5278 17 10.4167V15.5C17 15.9028 16.8472 16.2569 16.5417 16.5625C16.25 16.8542 15.9028 17 15.5 17H4.5ZM4.5 15.5H6.5V8.25H4.5V15.5ZM4.5 17H6.5H3C3 17 3.14583 17 3.4375 17C3.72917 17 4.08333 17 4.5 17ZM3 6.75C3 6.54167 3 6.33333 3 6.125C3 5.90278 3 5.68056 3 5.45833C3 5.01389 3 4.59028 3 4.1875C3 3.77083 3 3.375 3 3C3 3 3 3.14583 3 3.4375C3 3.72917 3 4.08333 3 4.5V6.75ZM8 17H12C11.5278 17 11.0972 17 10.7083 17C10.3333 17 10.0139 17 9.75 17H8ZM13.5 17H15.5C15.9167 17 16.2708 17 16.5625 17C16.8542 17 17 17 17 17C16.625 17 16.2292 17 15.8125 17C15.4097 17 14.9861 17 14.5417 17C14.3611 17 14.1806 17 14 17C13.8333 17 13.6667 17 13.5 17ZM14.5 10C14.5 8.75 14.0625 7.6875 13.1875 6.8125C12.3125 5.9375 11.25 5.5 10 5.5C11.25 5.5 12.3125 5.0625 13.1875 4.1875C14.0625 3.3125 14.5 2.25 14.5 0.999999C14.5 2.25 14.9375 3.3125 15.8125 4.1875C16.6875 5.0625 17.75 5.5 19 5.5C17.75 5.5 16.6875 5.9375 15.8125 6.8125C14.9375 7.6875 14.5 8.75 14.5 10Z"></path></g> <g id="text-analysis"><path d="M 2.5 17.5 L 2.5 15.832031 L 12.5 15.832031 L 12.5 17.5 Z M 2.5 13.332031 L 2.5 11.667969 L 17.5 11.667969 L 17.5 13.332031 Z M 2.5 9.167969 L 2.5 7.5 L 11.667969 7.5 L 11.667969 9.167969 Z M 14.582031 10 C 14.582031 8.722656 14.140625 7.640625 13.25 6.75 C 12.359375 5.859375 11.277344 5.417969 10 5.417969 C 11.277344 5.417969 12.359375 4.972656 13.25 4.082031 C 14.140625 3.195312 14.582031 2.109375 14.582031 0.832031 C 14.582031 2.109375 15.027344 3.195312 15.917969 4.082031 C 16.804688 4.972656 17.890625 5.417969 19.167969 5.417969 C 17.890625 5.417969 16.804688 5.859375 15.917969 6.75 C 15.027344 7.640625 14.582031 8.722656 14.582031 10 Z M 14.582031 10 "></path></g> + <g id="text-compare"><path d="M8.5 19V17H4.5C4.08333 17 3.72917 16.8542 3.4375 16.5625C3.14583 16.2708 3 15.9167 3 15.5V4.5C3 4.08333 3.14583 3.72917 3.4375 3.4375C3.72917 3.14583 4.08333 3 4.5 3H8.5V0.999999H10V19H8.5ZM4.5 15.5H8.5V14H6V12.5H8.5V11H6V9.5H8.5V8H6V6.5H8.5V4.5H4.5V15.5ZM11.5 4.5V3H15.5C15.9167 3 16.2708 3.14583 16.5625 3.4375C16.8542 3.72917 17 4.08333 17 4.5V15.5C17 15.9167 16.8542 16.2708 16.5625 16.5625C16.2708 16.8542 15.9167 17 15.5 17H11.5V15.5H15.5V4.5H11.5ZM11.5 11V9.5H14V11H11.5ZM11.5 8V6.5H14V8H11.5Z"></path></g> <g id="timer"><path d="M7.5 3V1.5H12.5V3H7.5ZM9.25 12H10.75V7H9.25V12ZM10 18C9.02778 18 8.11806 17.8194 7.27083 17.4583C6.42361 17.0833 5.68056 16.5833 5.04167 15.9583C4.41667 15.3194 3.91667 14.5764 3.54167 13.7292C3.18056 12.8819 3 11.9722 3 11C3 10.0278 3.18056 9.11806 3.54167 8.27083C3.91667 7.42361 4.41667 6.6875 5.04167 6.0625C5.68056 5.42361 6.42361 4.92361 7.27083 4.5625C8.11806 4.1875 9.02778 4 10 4C10.8056 4 11.5764 4.13889 12.3125 4.41667C13.0625 4.68055 13.7569 5.05555 14.3958 5.54167L15.4792 4.47917L16.5208 5.52083L15.4583 6.60417C15.9444 7.22917 16.3194 7.91667 16.5833 8.66667C16.8611 9.41667 17 10.1944 17 11C17 11.9722 16.8125 12.8819 16.4375 13.7292C16.0764 14.5764 15.5764 15.3194 14.9375 15.9583C14.3125 16.5833 13.5764 17.0833 12.7292 17.4583C11.8819 17.8194 10.9722 18 10 18ZM10 16.5C11.5278 16.5 12.8264 15.9653 13.8958 14.8958C14.9653 13.8264 15.5 12.5278 15.5 11C15.5 9.47222 14.9653 8.17361 13.8958 7.10417C12.8264 6.03472 11.5278 5.5 10 5.5C8.47222 5.5 7.17361 6.03472 6.10417 7.10417C5.03472 8.17361 4.5 9.47222 4.5 11C4.5 12.5278 5.03472 13.8264 6.10417 14.8958C7.17361 15.9653 8.47222 16.5 10 16.5Z"></path></g> <g id="undo"><path d="M11.8335 15.8333H5.8335V14.5833H11.8543C12.8266 14.5833 13.6634 14.2604 14.3647 13.6146C15.0661 12.9687 15.4168 12.1666 15.4168 11.2083C15.4168 10.25 15.0661 9.4479 14.3647 8.80206C13.6634 8.15623 12.8266 7.83331 11.8543 7.83331H5.7085L8.0835 10.2083L7.2085 11.0833L3.3335 7.20831L7.2085 3.33331L8.0835 4.20831L5.7085 6.58331H11.8335C13.1529 6.58331 14.2884 7.02776 15.2397 7.91665C16.1911 8.80554 16.6668 9.90276 16.6668 11.2083C16.6668 12.5139 16.1911 13.6111 15.2397 14.5C14.2884 15.3889 13.1529 15.8333 11.8335 15.8333Z"></path></g> <g id="volume-down"><path fill-rule="evenodd" clip-rule="evenodd" d="M1 13H4.46667L8 16.5V3.5L4.46667 7H1V13ZM10 6.5V13.5C11.776 12.8652 12.5 11.0043 12.5 10C12.5 8.99565 11.776 7.14348 10 6.5Z"></path></g>
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index 14486b3..5bfd3a9 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -168,8 +168,9 @@ InquireOnDeviceModel, (ClientPhishingRequest*, std::string, - base::OnceCallback<void( - std::optional<optimization_guide::proto::ScamDetectionResponse>)>)); + base::OnceCallback< + void(std::optional< + optimization_guide::proto::features::ScamDetectionResponse>)>)); }; class MockSafeBrowsingUIManager : public SafeBrowsingUIManager { @@ -2227,9 +2228,8 @@ .WillOnce(testing::Invoke( [&](ClientPhishingRequest* verdict, std::string rendered_text, base::OnceCallback<void( - std::optional< - optimization_guide::proto::ScamDetectionResponse>)> - callback) { + std::optional<optimization_guide::proto::features:: + ScamDetectionResponse>)> callback) { run_loop_for_inquire_on_device_model.Quit(); std::move(callback).Run(std::nullopt); })); @@ -2281,11 +2281,10 @@ .WillOnce(testing::Invoke( [&](ClientPhishingRequest* verdict, std::string rendered_text, base::OnceCallback<void( - std::optional< - optimization_guide::proto::ScamDetectionResponse>)> - callback) { + std::optional<optimization_guide::proto::features:: + ScamDetectionResponse>)> callback) { run_loop_for_inquire_on_device_model.Quit(); - optimization_guide::proto::ScamDetectionResponse + optimization_guide::proto::features::ScamDetectionResponse scam_detection_response; scam_detection_response.set_brand("Example Brand"); scam_detection_response.set_intent("Example Intent");
diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc index b2e477f..3e2fdc7 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
@@ -64,7 +64,7 @@ using ::optimization_guide::MockSession; using ::optimization_guide::OptimizationGuideModelExecutionError; using ::optimization_guide::OptimizationGuideModelStreamingExecutionResult; -using ::optimization_guide::proto::ScamDetectionResponse; +using ::optimization_guide::proto::features::ScamDetectionResponse; using ::testing::_; using ::testing::Invoke; using ::testing::Mock;
diff --git a/chrome/browser/safe_browsing/download_protection/download_feedback.cc b/chrome/browser/safe_browsing/download_protection/download_feedback.cc index 2fbeb9d..a4baf05 100644 --- a/chrome/browser/safe_browsing/download_protection/download_feedback.cc +++ b/chrome/browser/safe_browsing/download_protection/download_feedback.cc
@@ -19,20 +19,6 @@ namespace { -// This enum is used by histograms. Do not change the ordering or remove items. -enum UploadResultType { - UPLOAD_SUCCESS = 0, - UPLOAD_CANCELLED = 1, - UPLOAD_METADATA_NET_ERROR = 2, - UPLOAD_METADATA_RESPONSE_ERROR = 3, - UPLOAD_FILE_NET_ERROR = 4, - UPLOAD_FILE_RESPONSE_ERROR = 5, - UPLOAD_COMPLETE_RESPONSE_ERROR = 6, - // Memory space for histograms is determined by the max. - // ALWAYS ADD NEW VALUES BEFORE THIS ONE. - UPLOAD_RESULT_MAX = 7 -}; - // Handles the uploading of a single downloaded binary to the safebrowsing // download feedback service. class DownloadFeedbackImpl : public DownloadFeedback {
diff --git a/chrome/browser/search_engines/template_url_service_test_util.cc b/chrome/browser/search_engines/template_url_service_test_util.cc index bf97336..d14bc52e 100644 --- a/chrome/browser/search_engines/template_url_service_test_util.cc +++ b/chrome/browser/search_engines/template_url_service_test_util.cc
@@ -254,8 +254,8 @@ std::unique_ptr<TemplateURL> extension_turl) { TemplateURL* result = model()->Add(std::move(extension_turl)); DCHECK(result); - DCHECK(result->GetExtensionInfoForTesting()); - if (result->GetExtensionInfoForTesting()->wants_to_be_default_engine) { + DCHECK(result->GetExtensionInfo()); + if (result->GetExtensionInfo()->wants_to_be_default_engine) { SetExtensionDefaultSearchInPrefs(profile()->GetTestingPrefService(), result->data()); } @@ -267,8 +267,8 @@ TemplateURL* turl = model()->FindTemplateURLForExtension( extension_id, TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION); ASSERT_TRUE(turl); - ASSERT_TRUE(turl->GetExtensionInfoForTesting()); - if (turl->GetExtensionInfoForTesting()->wants_to_be_default_engine) { + ASSERT_TRUE(turl->GetExtensionInfo()); + if (turl->GetExtensionInfo()->wants_to_be_default_engine) { RemoveExtensionDefaultSearchFromPrefs(profile()->GetTestingPrefService()); } model()->RemoveExtensionControlledTURL(
diff --git a/chrome/browser/ssl/android/BUILD.gn b/chrome/browser/ssl/android/BUILD.gn new file mode 100644 index 0000000..6fe6a7a --- /dev/null +++ b/chrome/browser/ssl/android/BUILD.gn
@@ -0,0 +1,98 @@ +# Copyright 2024 The Chromium Authors +# 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") +import("//third_party/jni_zero/jni_zero.gni") + +generate_jni("jni_headers") { + sources = + [ "java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeBridge.java" ] +} + +android_library("java") { + sources = [ + "java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeBridge.java", + "java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingsFragment.java", + "java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeVariantPreference.java", + ] + deps = [ + ":java_resources", + "//base:base_java", + "//build/android:build_java", + "//chrome/browser/flags:java", + "//chrome/browser/preferences:java", + "//chrome/browser/profiles/android:java", + "//chrome/browser/safe_browsing/android:java", + "//chrome/browser/settings:java", + "//components/browser_ui/settings/android:java", + "//components/browser_ui/widget/android:java", + "//components/prefs/android:java", + "//components/user_prefs/android:java", + "//third_party/androidx:androidx_annotation_annotation_java", + "//third_party/androidx:androidx_browser_browser_java", + "//third_party/androidx:androidx_core_core_java", + "//third_party/androidx:androidx_fragment_fragment_java", + "//third_party/androidx:androidx_preference_preference_java", + "//third_party/jni_zero:jni_zero_java", + ] + + srcjar_deps = [ + ":https_first_mode_enums", + ":jni_headers", + ] + resources_package = "org.chromium.chrome.browser.ssl" +} + +android_resources("java_resources") { + sources = [ + "java/res/layout/https_first_mode_variant_preference.xml", + "java/res/xml/https_first_mode_settings.xml", + ] + deps = [ + "//chrome/browser/ui/android/strings:ui_strings_grd", + "//components/browser_ui/settings/android:java_resources", + ] +} + +java_cpp_enum("https_first_mode_enums") { + sources = [ "//chrome/browser/ssl/https_first_mode_settings_tracker.h" ] +} + +android_library("javatests") { + testonly = true + resources_package = "org.chromium.chrome.browser.ssl" + sources = [ + "javatests/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingTest.java", + "javatests/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingsFragmentTest.java", + ] + deps = [ + ":java", + ":java_resources", + "//base:base_java_test_support", + "//build/android:build_java", + "//chrome/android:chrome_java", + "//chrome/browser/flags:java", + "//chrome/browser/preferences:java", + "//chrome/browser/preferences:pref_service_java", + "//chrome/browser/profiles/android:java", + "//chrome/browser/settings:java", + "//chrome/browser/settings:test_support_java", + "//chrome/test/android:chrome_java_integration_test_support", + "//components/browser_ui/settings/android:java", + "//components/browser_ui/widget/android:java", + "//components/policy/android:policy_java_test_support", + "//components/prefs/android:java", + "//components/signin/public/android:java", + "//components/user_prefs/android:java", + "//content/public/android:content_java", + "//content/public/test/android:content_java_test_support", + "//third_party/androidx:androidx_fragment_fragment_java", + "//third_party/androidx:androidx_preference_preference_java", + "//third_party/androidx:androidx_test_core_java", + "//third_party/androidx:androidx_test_monitor_java", + "//third_party/androidx:androidx_test_runner_java", + "//third_party/hamcrest:hamcrest_java", + "//third_party/junit", + ] +}
diff --git a/chrome/browser/ssl/android/https_first_mode_bridge.cc b/chrome/browser/ssl/android/https_first_mode_bridge.cc new file mode 100644 index 0000000..a944650 --- /dev/null +++ b/chrome/browser/ssl/android/https_first_mode_bridge.cc
@@ -0,0 +1,42 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/android/jni_string.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ssl/https_first_mode_settings_tracker.h" +#include "chrome/common/pref_names.h" +#include "components/prefs/pref_service.h" + +// Must come after all headers that specialize FromJniType() / ToJniType(). +#include "chrome/browser/ssl/android/jni_headers/HttpsFirstModeBridge_jni.h" + +using base::android::JavaParamRef; + +static jint JNI_HttpsFirstModeBridge_GetCurrentSetting( + JNIEnv* env, + const JavaParamRef<jobject>& j_profile) { + HttpsFirstModeService* hfm_service = + HttpsFirstModeServiceFactory::GetForProfile( + Profile::FromJavaObject(j_profile)); + return static_cast<jint>(hfm_service->GetCurrentSetting()); +} + +static void JNI_HttpsFirstModeBridge_UpdatePrefs( + JNIEnv* env, + const JavaParamRef<jobject>& j_profile, + jint setting) { + HttpsFirstModeService* hfm_service = + HttpsFirstModeServiceFactory::GetForProfile( + Profile::FromJavaObject(j_profile)); + auto selection = static_cast<HttpsFirstModeSetting>(setting); + hfm_service->UpdatePrefs(selection); + return; +} + +static jboolean JNI_HttpsFirstModeBridge_IsManaged( + JNIEnv* env, + const JavaParamRef<jobject>& j_profile) { + Profile* profile = Profile::FromJavaObject(j_profile); + return profile->GetPrefs()->IsManagedPreference(prefs::kHttpsOnlyModeEnabled); +}
diff --git a/chrome/browser/ssl/android/java/res/layout/https_first_mode_variant_preference.xml b/chrome/browser/ssl/android/java/res/layout/https_first_mode_variant_preference.xml new file mode 100644 index 0000000..b09d8d50 --- /dev/null +++ b/chrome/browser/ssl/android/java/res/layout/https_first_mode_variant_preference.xml
@@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright 2024 The Chromium Authors +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?android:attr/selectableItemBackground" + android:gravity="center_vertical" + android:orientation="vertical" + android:paddingBottom="8dp" + android:focusable="false"> + + <org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionLayout + android:id="@+id/mode_group" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <org.chromium.components.browser_ui.widget.RadioButtonWithDescription + android:id="@+id/balanced" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="@dimen/min_touch_target_size" + android:background="?attr/selectableItemBackground" + app:primaryText="@string/settings_https_first_mode_enabled_balanced_label"/> + + <org.chromium.components.browser_ui.widget.RadioButtonWithDescription + android:id="@+id/strict" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="@dimen/min_touch_target_size" + android:background="?attr/selectableItemBackground" + app:primaryText="@string/settings_https_first_mode_enabled_strict_label" + app:descriptionText="@string/settings_https_first_mode_enabled_strict_sublabel"/> + + </org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionLayout> +</LinearLayout>
diff --git a/chrome/browser/ssl/android/java/res/xml/https_first_mode_settings.xml b/chrome/browser/ssl/android/java/res/xml/https_first_mode_settings.xml new file mode 100644 index 0000000..380b230 --- /dev/null +++ b/chrome/browser/ssl/android/java/res/xml/https_first_mode_settings.xml
@@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright 2024 The Chromium Authors +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <org.chromium.components.browser_ui.settings.ChromeSwitchPreference + android:key="https_first_mode_switch" + android:persistent="false" + android:title="@string/settings_https_first_mode_title" + android:summary="@string/settings_https_first_mode_description" /> + + <org.chromium.chrome.browser.ssl.HttpsFirstModeVariantPreference + android:key="https_first_mode_variant" + app:allowDividerBelow="false" /> + +</PreferenceScreen>
diff --git a/chrome/browser/ssl/android/java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeBridge.java b/chrome/browser/ssl/android/java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeBridge.java new file mode 100644 index 0000000..88617b4 --- /dev/null +++ b/chrome/browser/ssl/android/java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeBridge.java
@@ -0,0 +1,55 @@ +// Copyright 2024 The Chromium Authors +// 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.ssl; + +import androidx.annotation.VisibleForTesting; + +import org.jni_zero.NativeMethods; + +import org.chromium.chrome.browser.profiles.Profile; + +/** Bridge providing access to native-side HTTPS-First Mode data. */ +public final class HttpsFirstModeBridge { + private final Profile mProfile; + + /** Constructs a {@link HttpsFirstModeBridge} associated with the given {@link Profile}. */ + public HttpsFirstModeBridge(Profile profile) { + mProfile = profile; + } + + /** + * @return The HTTPS-First Mode setting state. It can be Disabled, Full, or Balanced. + */ + public @HttpsFirstModeSetting int getCurrentSetting() { + return HttpsFirstModeBridgeJni.get().getCurrentSetting(mProfile); + } + + /** + * Sets the underlying HTTPS-First Mode prefs based on `state`. + * + * @param state Current setting state. It can be Disabled, Full, or Balanced. + */ + public void updatePrefs(@HttpsFirstModeSetting int state) { + HttpsFirstModeBridgeJni.get().updatePrefs(mProfile, state); + } + + /** + * @return Whether the HTTPS-First Mode preference is managed. + */ + public boolean isManaged() { + return HttpsFirstModeBridgeJni.get().isManaged(mProfile); + } + + @NativeMethods + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) + public interface Natives { + @HttpsFirstModeSetting + int getCurrentSetting(Profile profile); + + void updatePrefs(Profile profile, @HttpsFirstModeSetting int state); + + boolean isManaged(Profile profile); + } +}
diff --git a/chrome/browser/ssl/android/java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingsFragment.java b/chrome/browser/ssl/android/java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingsFragment.java new file mode 100644 index 0000000..16a2654e --- /dev/null +++ b/chrome/browser/ssl/android/java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingsFragment.java
@@ -0,0 +1,146 @@ +// Copyright 2024 The Chromium Authors +// 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.ssl; + +import android.content.Context; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import androidx.preference.Preference; + +import org.chromium.base.supplier.ObservableSupplier; +import org.chromium.base.supplier.ObservableSupplierImpl; +import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.chrome.browser.safe_browsing.SafeBrowsingBridge; +import org.chromium.chrome.browser.settings.ChromeBaseSettingsFragment; +import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate; +import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; +import org.chromium.components.browser_ui.settings.SettingsUtils; + +/** + * Fragment to manage HTTPS-First Mode preference. It consists of a toggle switch and, if the switch + * is enabled, an HttpsFirstModeVariantPreference. + */ +public class HttpsFirstModeSettingsFragment extends ChromeBaseSettingsFragment { + // Must match keys in https_first_mode_settings.xml. + @VisibleForTesting static final String PREF_HTTPS_FIRST_MODE_SWITCH = "https_first_mode_switch"; + + @VisibleForTesting + static final String PREF_HTTPS_FIRST_MODE_VARIANT = "https_first_mode_variant"; + + private ChromeSwitchPreference mHttpsFirstModeSwitch; + private HttpsFirstModeVariantPreference mHttpsFirstModeVariantPreference; + private HttpsFirstModeBridge mHttpsFirstModeBridge; + private SafeBrowsingBridge mSafeBrowsingBridge; + private final ObservableSupplierImpl<String> mPageTitle = new ObservableSupplierImpl<>(); + + @Override + public ObservableSupplier<String> getPageTitle() { + return mPageTitle; + } + + @Override + public void setProfile(@NonNull Profile profile) { + super.setProfile(profile); + mHttpsFirstModeBridge = new HttpsFirstModeBridge(profile); + mSafeBrowsingBridge = new SafeBrowsingBridge(profile); + } + + /** + * @return A summary for use in the Preference that opens this fragment. + */ + public static String getSummary(Context context, Profile profile) { + @HttpsFirstModeSetting int setting = new HttpsFirstModeBridge(profile).getCurrentSetting(); + switch (setting) { + case HttpsFirstModeSetting.ENABLED_BALANCED: + return context.getString(R.string.settings_https_first_mode_enabled_balanced_label); + case HttpsFirstModeSetting.ENABLED_FULL: + return context.getString(R.string.settings_https_first_mode_enabled_strict_label); + case HttpsFirstModeSetting.DISABLED: + // fall through + default: + return context.getString(R.string.settings_https_first_mode_disabled_label); + } + } + + /** + * @return Whether the HTTPS-First Mode setting is enforced and not modifiable by the user. + */ + public boolean isSettingEnforced() { + return mHttpsFirstModeBridge.isManaged() || mSafeBrowsingBridge.isUnderAdvancedProtection(); + } + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + mPageTitle.set(getString(R.string.settings_https_first_mode_title)); + SettingsUtils.addPreferencesFromResource(this, R.xml.https_first_mode_settings); + + // Set up the main toggle preference. + mHttpsFirstModeSwitch = findPreference(PREF_HTTPS_FIRST_MODE_SWITCH); + mHttpsFirstModeSwitch.setManagedPreferenceDelegate( + new ChromeManagedPreferenceDelegate(getProfile()) { + @Override + public boolean isPreferenceControlledByPolicy(Preference preference) { + return mHttpsFirstModeBridge.isManaged(); + } + + @Override + public boolean isPreferenceClickDisabled(Preference preference) { + return isSettingEnforced(); + } + }); + mHttpsFirstModeSwitch.setOnPreferenceChangeListener( + (preference, enabled) -> { + // When the toggle is turned on, default to Balanced mode. + mHttpsFirstModeBridge.updatePrefs( + (boolean) enabled + ? HttpsFirstModeSetting.ENABLED_BALANCED + : HttpsFirstModeSetting.DISABLED); + loadPreferenceState(); + return true; + }); + // Override switch description if the preference is force-enabled by Advanced Protection. + if (mSafeBrowsingBridge.isUnderAdvancedProtection()) { + mHttpsFirstModeSwitch.setSummary( + getString( + R.string + .settings_https_first_mode_with_advanced_protection_description)); + } + + // Setup the sub-preference for controlling which mode of HFM is enabled. + mHttpsFirstModeVariantPreference = findPreference(PREF_HTTPS_FIRST_MODE_VARIANT); + mHttpsFirstModeVariantPreference.init(mHttpsFirstModeBridge.getCurrentSetting()); + mHttpsFirstModeVariantPreference.setOnPreferenceChangeListener( + (preference, value) -> { + mHttpsFirstModeBridge.updatePrefs((int) value); + loadPreferenceState(); + return true; + }); + + // Update preference views and state. + loadPreferenceState(); + } + + private void loadPreferenceState() { + @HttpsFirstModeSetting int setting = mHttpsFirstModeBridge.getCurrentSetting(); + boolean enabled = setting != HttpsFirstModeSetting.DISABLED; + mHttpsFirstModeSwitch.setChecked(enabled); + mHttpsFirstModeVariantPreference.setEnabled(enabled && !isSettingEnforced()); + mHttpsFirstModeVariantPreference.setCheckedState(setting); + + // If the setting is force-disabled by policy, don't show the radio + // group. + if (isSettingEnforced() && !enabled) { + mHttpsFirstModeVariantPreference.setVisible(false); + } + } + + @Override + public void onResume() { + super.onResume(); + loadPreferenceState(); + } +}
diff --git a/chrome/browser/ssl/android/java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeVariantPreference.java b/chrome/browser/ssl/android/java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeVariantPreference.java new file mode 100644 index 0000000..ae8106f --- /dev/null +++ b/chrome/browser/ssl/android/java/src/org/chromium/chrome/browser/ssl/HttpsFirstModeVariantPreference.java
@@ -0,0 +1,84 @@ +// Copyright 2024 The Chromium Authors +// 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.ssl; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.RadioGroup; + +import androidx.preference.Preference; +import androidx.preference.PreferenceViewHolder; + +import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; +import org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionLayout; + +/** + * HttpsFirstModeVariantPreference is the user interface that is shown when HTTPS-First Mode is + * enabled. When HTTPS-First Mode is off, the HttpsFirstModeVariantPreference is disabled. (This is + * a boolean choice but displayed as a radio button group.) + */ +class HttpsFirstModeVariantPreference extends Preference + implements RadioGroup.OnCheckedChangeListener { + // UI elements. These fields are assigned only once, in onBindViewHolder. + private RadioButtonWithDescriptionLayout mGroupLayout; + private RadioButtonWithDescription mBalancedButton; + private RadioButtonWithDescription mStrictButton; + + // Current setting. + private @HttpsFirstModeSetting int mHttpsFirstModeSetting; + + public HttpsFirstModeVariantPreference(Context context, AttributeSet attrs) { + super(context, attrs); + setLayoutResource(R.layout.https_first_mode_variant_preference); + } + + public void init(@HttpsFirstModeSetting int httpsFirstModeSetting) { + mHttpsFirstModeSetting = httpsFirstModeSetting; + } + + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + if (checkedId == mBalancedButton.getId()) { + mHttpsFirstModeSetting = HttpsFirstModeSetting.ENABLED_BALANCED; + } else if (checkedId == mStrictButton.getId()) { + mHttpsFirstModeSetting = HttpsFirstModeSetting.ENABLED_FULL; + } + callChangeListener(mHttpsFirstModeSetting); + } + + @Override + public void onBindViewHolder(PreferenceViewHolder holder) { + super.onBindViewHolder(holder); + + mGroupLayout = (RadioButtonWithDescriptionLayout) holder.findViewById(R.id.mode_group); + mGroupLayout.setOnCheckedChangeListener(this); + + mBalancedButton = (RadioButtonWithDescription) holder.findViewById(R.id.balanced); + mStrictButton = (RadioButtonWithDescription) holder.findViewById(R.id.strict); + + setCheckedState(mHttpsFirstModeSetting); + } + + public void setCheckedState(@HttpsFirstModeSetting int checkedState) { + if (mGroupLayout == null) { + // Not yet bound to view holder. + return; + } + + mHttpsFirstModeSetting = checkedState; + mStrictButton.setChecked(checkedState == HttpsFirstModeSetting.ENABLED_FULL); + mBalancedButton.setChecked( + checkedState == HttpsFirstModeSetting.ENABLED_BALANCED + || checkedState == HttpsFirstModeSetting.DISABLED); + } + + public RadioButtonWithDescription getStrictModeButtonForTesting() { + return mStrictButton; + } + + public RadioButtonWithDescription getBalancedModeButtonForTesting() { + return mBalancedButton; + } +}
diff --git a/chrome/browser/ssl/android/javatests/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingTest.java b/chrome/browser/ssl/android/javatests/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingTest.java new file mode 100644 index 0000000..d2496531 --- /dev/null +++ b/chrome/browser/ssl/android/javatests/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingTest.java
@@ -0,0 +1,142 @@ +// Copyright 2024 The Chromium Authors +// 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.ssl; + +import static org.chromium.base.test.util.Batch.PER_CLASS; + +import androidx.preference.Preference; +import androidx.preference.PreferenceFragmentCompat; +import androidx.test.core.app.ApplicationProvider; +import androidx.test.filters.LargeTest; + +import org.hamcrest.Matchers; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.ThreadUtils; +import org.chromium.base.test.util.Batch; +import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.Criteria; +import org.chromium.base.test.util.CriteriaHelper; +import org.chromium.base.test.util.Features.DisableFeatures; +import org.chromium.base.test.util.Features.EnableFeatures; +import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.flags.ChromeSwitches; +import org.chromium.chrome.browser.privacy.settings.PrivacySettings; +import org.chromium.chrome.browser.settings.SettingsActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; + +import java.util.concurrent.ExecutionException; + +/** + * Tests for the HTTPS-First Mode setting in Privacy and security. Enables the + * HTTPS_FIRST_BALANCED_MODE feature flag to test the new settings UI. + */ +@RunWith(ChromeJUnit4ClassRunner.class) +@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) +@EnableFeatures(ChromeFeatureList.HTTPS_FIRST_BALANCED_MODE) +@Batch(PER_CLASS) +public class HttpsFirstModeSettingTest { + private final SettingsActivityTestRule<PrivacySettings> mSettingsActivityTestRule = + new SettingsActivityTestRule<>(PrivacySettings.class); + + private static final String PREF_HTTPS_FIRST_MODE = "https_first_mode"; + private static final String PREF_HTTPS_FIRST_MODE_SWITCH = "https_first_mode_switch"; + private static final String PREF_HTTPS_FIRST_MODE_VARIANT = "https_first_mode_variant"; + + private static Preference waitForPreference( + final PreferenceFragmentCompat prefFragment, final String preferenceKey) + throws ExecutionException { + CriteriaHelper.pollUiThread( + () -> { + Criteria.checkThat( + "Expected valid preference for: " + preferenceKey, + prefFragment.findPreference(preferenceKey), + Matchers.notNullValue()); + }); + + return ThreadUtils.runOnUiThreadBlocking(() -> prefFragment.findPreference(preferenceKey)); + } + + @Test + @LargeTest + public void testSetting_AdvancedProtectionDisabled() throws Exception { + mSettingsActivityTestRule.startSettingsActivity(); + final PrivacySettings privacySettings = mSettingsActivityTestRule.getFragment(); + + Preference pref = waitForPreference(privacySettings, PREF_HTTPS_FIRST_MODE); + Assert.assertNotNull(pref); + + // Check that the expected title is shown and the setting defaults to disabled. + final String prefTitle = + ApplicationProvider.getApplicationContext() + .getString(R.string.settings_https_first_mode_title); + final String prefSummary = + ApplicationProvider.getApplicationContext() + .getString(R.string.settings_https_first_mode_disabled_label); + ThreadUtils.runOnUiThreadBlocking( + () -> { + Assert.assertTrue(pref.getTitle().equals(prefTitle)); + Assert.assertTrue(pref.getSummary().equals(prefSummary)); + }); + } + + @Test + @LargeTest + @CommandLineFlags.Add({"safe-browsing-treat-user-as-advanced-protection"}) + public void testSetting_AdvancedProtectionEnabled() throws Exception { + mSettingsActivityTestRule.startSettingsActivity(); + + // Checks that when the user is enrolled in APP, the summary shows that + // the user is in strict mode. + final PrivacySettings privacySettings = mSettingsActivityTestRule.getFragment(); + final String lockedSummaryText = + ApplicationProvider.getApplicationContext() + .getString(R.string.settings_https_first_mode_enabled_strict_label); + + Preference pref = waitForPreference(privacySettings, PREF_HTTPS_FIRST_MODE); + Assert.assertNotNull(pref); + + ThreadUtils.runOnUiThreadBlocking( + () -> { + Assert.assertTrue(pref.getSummary().equals(lockedSummaryText)); + }); + } + + @Test + @LargeTest + @DisableFeatures(ChromeFeatureList.HTTPS_FIRST_BALANCED_MODE) + public void testSetting_NewSettingNotShownWhenFeatureDisabled() throws Exception { + // Check that the new setting preference isn't visible. + mSettingsActivityTestRule.startSettingsActivity(); + + final PrivacySettings privacySettings = mSettingsActivityTestRule.getFragment(); + + Preference pref = waitForPreference(privacySettings, PREF_HTTPS_FIRST_MODE); + Assert.assertNotNull(pref); + ThreadUtils.runOnUiThreadBlocking( + () -> { + Assert.assertFalse(pref.isVisible()); + }); + } + + @Test + @LargeTest + @EnableFeatures(ChromeFeatureList.HTTPS_FIRST_BALANCED_MODE) + public void testSetting_OldSettingNotShownWhenFeatureEnabled() throws Exception { + // Check that the old setting preference isn't visible. + mSettingsActivityTestRule.startSettingsActivity(); + + final PrivacySettings privacySettings = mSettingsActivityTestRule.getFragment(); + + Preference pref = waitForPreference(privacySettings, "https_first_mode_legacy"); + Assert.assertNotNull(pref); + ThreadUtils.runOnUiThreadBlocking( + () -> { + Assert.assertFalse(pref.isVisible()); + }); + } +}
diff --git a/chrome/browser/ssl/android/javatests/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingsFragmentTest.java b/chrome/browser/ssl/android/javatests/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingsFragmentTest.java new file mode 100644 index 0000000..809a067 --- /dev/null +++ b/chrome/browser/ssl/android/javatests/src/org/chromium/chrome/browser/ssl/HttpsFirstModeSettingsFragmentTest.java
@@ -0,0 +1,297 @@ +// Copyright 2024 The Chromium Authors +// 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.ssl; + +import androidx.test.core.app.ApplicationProvider; +import androidx.test.filters.SmallTest; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.ThreadUtils; +import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.DoNotBatch; +import org.chromium.base.test.util.Feature; +import org.chromium.base.test.util.Features.EnableFeatures; +import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.init.ChromeBrowserInitializer; +import org.chromium.chrome.browser.profiles.ProfileManager; +import org.chromium.chrome.browser.settings.SettingsActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; +import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; +import org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionLayout; +import org.chromium.components.policy.test.annotations.Policies; + +/** Tests for {@link HttpsFirstModeSettingsFragment}. */ +@RunWith(ChromeJUnit4ClassRunner.class) +@DoNotBatch(reason = "This test launches a Settings activity") +@EnableFeatures(ChromeFeatureList.HTTPS_FIRST_BALANCED_MODE) +public class HttpsFirstModeSettingsFragmentTest { + private static final String ASSERT_HFM_STATE_RADIO_BUTTON_GROUP = + "Incorrect HFM state in the radio button group."; + private static final String ASSERT_SWITCH_ENABLED = "Incorrect switch enabled state."; + private static final String ASSERT_RADIO_BUTTON_CHECKED = + "Incorrect radio button checked state."; + private static final String ASSERT_HFM_STATE_NATIVE = "Incorrect HFM state from native."; + + @Rule + public SettingsActivityTestRule<HttpsFirstModeSettingsFragment> mSettingsTestRule = + new SettingsActivityTestRule<>(HttpsFirstModeSettingsFragment.class); + + private HttpsFirstModeSettingsFragment mHttpsFirstModeSettingsFragment; + private ChromeSwitchPreference mHttpsFirstModeTogglePref; + private HttpsFirstModeVariantPreference mHttpsFirstModeVariantPref; + private RadioButtonWithDescriptionLayout mHttpsFirstModeVariantGroup; + private RadioButtonWithDescription mHttpsFirstModeVariantStrict; + private RadioButtonWithDescription mHttpsFirstModeVariantBalanced; + + private void startSettings() { + mSettingsTestRule.startSettingsActivity(); + mHttpsFirstModeSettingsFragment = mSettingsTestRule.getFragment(); + mHttpsFirstModeTogglePref = + mHttpsFirstModeSettingsFragment.findPreference( + HttpsFirstModeSettingsFragment.PREF_HTTPS_FIRST_MODE_SWITCH); + mHttpsFirstModeVariantPref = + mHttpsFirstModeSettingsFragment.findPreference( + HttpsFirstModeSettingsFragment.PREF_HTTPS_FIRST_MODE_VARIANT); + Assert.assertNotNull("Switch preference should not be null.", mHttpsFirstModeTogglePref); + Assert.assertNotNull("Variant preference should not be null.", mHttpsFirstModeVariantPref); + } + + @HttpsFirstModeSetting + private int getHttpsFirstModeState() { + return ThreadUtils.runOnUiThreadBlocking( + () -> { + return new HttpsFirstModeBridge(ProfileManager.getLastUsedRegularProfile()) + .getCurrentSetting(); + }); + } + + private boolean isSettingManaged() { + return ThreadUtils.runOnUiThreadBlocking( + () -> { + return new HttpsFirstModeBridge(ProfileManager.getLastUsedRegularProfile()) + .isManaged(); + }); + } + + @Test + @SmallTest + @Feature({"HttpsFirstMode"}) + public void testOnStartup() { + startSettings(); + ThreadUtils.runOnUiThreadBlocking( + () -> { + @HttpsFirstModeSetting int currentState = getHttpsFirstModeState(); + boolean strict_mode_checked = + currentState == HttpsFirstModeSetting.ENABLED_FULL; + boolean balanced_mode_checked = + (currentState == HttpsFirstModeSetting.ENABLED_BALANCED + || currentState == HttpsFirstModeSetting.DISABLED); + boolean toggle_on = currentState != HttpsFirstModeSetting.DISABLED; + Assert.assertEquals( + ASSERT_RADIO_BUTTON_CHECKED, + strict_mode_checked, + getStrictModeButton().isChecked()); + Assert.assertEquals( + ASSERT_RADIO_BUTTON_CHECKED, + balanced_mode_checked, + getBalancedModeButton().isChecked()); + Assert.assertEquals( + ASSERT_RADIO_BUTTON_CHECKED, + toggle_on, + mHttpsFirstModeTogglePref.isChecked()); + // Variant pref is enabled if toggle is on. + Assert.assertEquals( + "Incorrect variant pref enabled state.", + toggle_on, + mHttpsFirstModeVariantPref.isEnabled()); + }); + } + + @Test + @SmallTest + @Feature({"HttpsFirstMode"}) + public void testPreferenceControls() { + startSettings(); + ThreadUtils.runOnUiThreadBlocking( + () -> { + // Flip the main toggle on. + mHttpsFirstModeTogglePref.onClick(); + Assert.assertTrue(ASSERT_SWITCH_ENABLED, mHttpsFirstModeTogglePref.isChecked()); + Assert.assertTrue( + "Variant pref has incorrect enabled state.", + mHttpsFirstModeVariantPref.isEnabled()); + Assert.assertFalse( + ASSERT_RADIO_BUTTON_CHECKED, getStrictModeButton().isChecked()); + Assert.assertTrue( + ASSERT_RADIO_BUTTON_CHECKED, getBalancedModeButton().isChecked()); + Assert.assertEquals( + ASSERT_HFM_STATE_NATIVE, + HttpsFirstModeSetting.ENABLED_BALANCED, + getHttpsFirstModeState()); + + // Click the Strict Mode button. + getStrictModeButton().onClick(null); + Assert.assertTrue(ASSERT_SWITCH_ENABLED, mHttpsFirstModeTogglePref.isChecked()); + Assert.assertTrue( + ASSERT_RADIO_BUTTON_CHECKED, getStrictModeButton().isChecked()); + Assert.assertFalse( + ASSERT_RADIO_BUTTON_CHECKED, getBalancedModeButton().isChecked()); + Assert.assertEquals( + ASSERT_HFM_STATE_NATIVE, + HttpsFirstModeSetting.ENABLED_FULL, + getHttpsFirstModeState()); + + // Click the Balanced Mode button. + getBalancedModeButton().onClick(null); + Assert.assertTrue(ASSERT_SWITCH_ENABLED, mHttpsFirstModeTogglePref.isChecked()); + Assert.assertFalse( + ASSERT_RADIO_BUTTON_CHECKED, getStrictModeButton().isChecked()); + Assert.assertTrue( + ASSERT_RADIO_BUTTON_CHECKED, getBalancedModeButton().isChecked()); + Assert.assertEquals( + ASSERT_HFM_STATE_NATIVE, + HttpsFirstModeSetting.ENABLED_BALANCED, + getHttpsFirstModeState()); + + // Flip the main toggle off. + mHttpsFirstModeTogglePref.onClick(); + Assert.assertFalse(mHttpsFirstModeVariantPref.isEnabled()); + Assert.assertFalse( + ASSERT_SWITCH_ENABLED, mHttpsFirstModeTogglePref.isChecked()); + Assert.assertFalse( + ASSERT_RADIO_BUTTON_CHECKED, getStrictModeButton().isChecked()); + // When the main toggle is off, the "Balanced Mode" radio button should + // remain checked (but the Preference control is disabled). + Assert.assertTrue( + ASSERT_RADIO_BUTTON_CHECKED, getBalancedModeButton().isChecked()); + Assert.assertEquals( + ASSERT_HFM_STATE_NATIVE, + HttpsFirstModeSetting.DISABLED, + getHttpsFirstModeState()); + }); + } + + @Test + @SmallTest + @Feature({"HttpsFirstMode"}) + @CommandLineFlags.Add({"safe-browsing-treat-user-as-advanced-protection"}) + public void testSetting_AdvancedProtectionEnabled() { + startSettings(); + final String lockedSummaryText = + ApplicationProvider.getApplicationContext() + .getString( + R.string + .settings_https_first_mode_with_advanced_protection_description); + ThreadUtils.runOnUiThreadBlocking( + () -> { + // A custom summary should be shown for APP users. + Assert.assertEquals( + "Incorrect summary string for APP mode user.", + lockedSummaryText, + mHttpsFirstModeTogglePref.getSummary()); + + // Strict mode should be set. + Assert.assertTrue(ASSERT_SWITCH_ENABLED, mHttpsFirstModeTogglePref.isChecked()); + Assert.assertTrue( + ASSERT_RADIO_BUTTON_CHECKED, getStrictModeButton().isChecked()); + Assert.assertFalse( + ASSERT_RADIO_BUTTON_CHECKED, getBalancedModeButton().isChecked()); + Assert.assertEquals( + ASSERT_HFM_STATE_NATIVE, + HttpsFirstModeSetting.ENABLED_FULL, + getHttpsFirstModeState()); + + // Toggle and variant preferences should be disabled. + Assert.assertFalse( + "Preference not correctly disabled.", + mHttpsFirstModeTogglePref.isEnabled()); + Assert.assertFalse( + "Preference not correctly disabled.", + mHttpsFirstModeVariantPref.isEnabled()); + }); + } + + @Test + @SmallTest + @Feature({"HttpsFirstMode"}) + @Policies.Add({@Policies.Item(key = "HttpsOnlyMode", string = "disallowed")}) + public void testHttpsFirstModeManagedDisallowed() { + ThreadUtils.runOnUiThreadBlocking( + () -> { + ChromeBrowserInitializer.getInstance().handleSynchronousStartup(); + }); + startSettings(); + ThreadUtils.runOnUiThreadBlocking( + () -> { + Assert.assertTrue(isSettingManaged()); + Assert.assertFalse(mHttpsFirstModeTogglePref.isEnabled()); + Assert.assertEquals(HttpsFirstModeSetting.DISABLED, getHttpsFirstModeState()); + + // Radio group should be hidden when the settings is force-disabled by policy. + Assert.assertFalse(mHttpsFirstModeVariantPref.isVisible()); + }); + } + + @Test + @SmallTest + @Feature({"HttpsFirstMode"}) + @Policies.Add({@Policies.Item(key = "HttpsOnlyMode", string = "force_enabled")}) + public void testHttpsFirstModeManagedForceEnabled() { + ThreadUtils.runOnUiThreadBlocking( + () -> { + ChromeBrowserInitializer.getInstance().handleSynchronousStartup(); + }); + startSettings(); + ThreadUtils.runOnUiThreadBlocking( + () -> { + Assert.assertTrue(isSettingManaged()); + Assert.assertFalse(getStrictModeButton().isEnabled()); + Assert.assertTrue(getStrictModeButton().isChecked()); + Assert.assertFalse(getBalancedModeButton().isEnabled()); + Assert.assertFalse(mHttpsFirstModeTogglePref.isEnabled()); + Assert.assertTrue(mHttpsFirstModeTogglePref.isChecked()); + Assert.assertTrue(mHttpsFirstModeVariantPref.isVisible()); + Assert.assertEquals( + HttpsFirstModeSetting.ENABLED_FULL, getHttpsFirstModeState()); + }); + } + + @Test + @SmallTest + @Feature({"HttpsFirstMode"}) + @Policies.Add({@Policies.Item(key = "HttpsOnlyMode", string = "force_balanced_enabled")}) + public void testHttpsFirstModeManagedForceBalancedEnabled() { + ThreadUtils.runOnUiThreadBlocking( + () -> { + ChromeBrowserInitializer.getInstance().handleSynchronousStartup(); + }); + startSettings(); + ThreadUtils.runOnUiThreadBlocking( + () -> { + Assert.assertTrue(isSettingManaged()); + Assert.assertFalse(getStrictModeButton().isEnabled()); + Assert.assertFalse(getBalancedModeButton().isEnabled()); + Assert.assertTrue(getBalancedModeButton().isChecked()); + Assert.assertFalse(mHttpsFirstModeTogglePref.isEnabled()); + Assert.assertTrue(mHttpsFirstModeTogglePref.isChecked()); + Assert.assertTrue(mHttpsFirstModeVariantPref.isVisible()); + Assert.assertEquals( + HttpsFirstModeSetting.ENABLED_BALANCED, getHttpsFirstModeState()); + }); + } + + private RadioButtonWithDescription getStrictModeButton() { + return mHttpsFirstModeVariantPref.getStrictModeButtonForTesting(); + } + + private RadioButtonWithDescription getBalancedModeButton() { + return mHttpsFirstModeVariantPref.getBalancedModeButtonForTesting(); + } +}
diff --git a/chrome/browser/ssl/generated_https_first_mode_pref.cc b/chrome/browser/ssl/generated_https_first_mode_pref.cc index f50b9b3..bed66df 100644 --- a/chrome/browser/ssl/generated_https_first_mode_pref.cc +++ b/chrome/browser/ssl/generated_https_first_mode_pref.cc
@@ -76,17 +76,6 @@ auto selection = static_cast<HttpsFirstModeSetting>(value->GetInt()); - if (selection != HttpsFirstModeSetting::kDisabled && - selection != HttpsFirstModeSetting::kEnabledBalanced && - selection != HttpsFirstModeSetting::kEnabledFull) { - return extensions::settings_private::SetPrefResult::PREF_TYPE_MISMATCH; - } - - if (!IsBalancedModeAvailable() && - selection == HttpsFirstModeSetting::kEnabledBalanced) { - return extensions::settings_private::SetPrefResult::PREF_TYPE_UNSUPPORTED; - } - // If the enterprise policy is enforced, then the kHttpsOnlyModeEnabled pref // will not be modifiable (for all policy values). const PrefService::Preference* fully_enabled_pref = @@ -96,46 +85,12 @@ } // Update both HTTPS-First Mode preferences to match the selection. - // - // Note that the HttpsFirstModeSetting::kEnabledBalanced is not available by - // default. If the feature flag is disabled, then the kEnabledFull and - // kDisabled settings will only be mapped to the kHttpsOnlyModeEnabled pref. - // - // Note: The Security.HttpsFirstMode.SettingChanged* histograms are logged - // here instead of in HttpsFirstModeService::OnHttpsFirstModePrefChanged() - // because this will fire the pref observer _twice_, so logging the histogram - // in the pref observer would cause double counting. - if (IsBalancedModeAvailable()) { - switch (selection) { - case HttpsFirstModeSetting::kDisabled: - base::UmaHistogramEnumeration("Security.HttpsFirstMode.SettingChanged2", - HttpsFirstModeSetting::kDisabled); - profile_->GetPrefs()->SetBoolean(prefs::kHttpsOnlyModeEnabled, false); - profile_->GetPrefs()->SetBoolean(prefs::kHttpsFirstBalancedMode, false); - break; - case HttpsFirstModeSetting::kEnabledBalanced: - base::UmaHistogramEnumeration("Security.HttpsFirstMode.SettingChanged2", - HttpsFirstModeSetting::kEnabledBalanced); - profile_->GetPrefs()->SetBoolean(prefs::kHttpsOnlyModeEnabled, false); - profile_->GetPrefs()->SetBoolean(prefs::kHttpsFirstBalancedMode, true); - break; - case HttpsFirstModeSetting::kEnabledFull: - base::UmaHistogramEnumeration("Security.HttpsFirstMode.SettingChanged2", - HttpsFirstModeSetting::kEnabledFull); - profile_->GetPrefs()->SetBoolean(prefs::kHttpsOnlyModeEnabled, true); - profile_->GetPrefs()->SetBoolean(prefs::kHttpsFirstBalancedMode, false); - break; - } - } else { - // TODO(crbug.com/349860796): Remove old settings path once Balanced Mode - // is launched. - base::UmaHistogramBoolean("Security.HttpsFirstMode.SettingChanged", - selection == HttpsFirstModeSetting::kEnabledFull); - profile_->GetPrefs()->SetBoolean( - prefs::kHttpsOnlyModeEnabled, - selection == HttpsFirstModeSetting::kEnabledFull); + HttpsFirstModeService* hfm_service = + HttpsFirstModeServiceFactory::GetForProfile(profile_); + bool success = hfm_service->UpdatePrefs(selection); + if (!success) { + return extensions::settings_private::SetPrefResult::PREF_TYPE_MISMATCH; } - return extensions::settings_private::SetPrefResult::SUCCESS; }
diff --git a/chrome/browser/ssl/generated_https_first_mode_pref_unittest.cc b/chrome/browser/ssl/generated_https_first_mode_pref_unittest.cc index bac0458b..07f2a3b1 100644 --- a/chrome/browser/ssl/generated_https_first_mode_pref_unittest.cc +++ b/chrome/browser/ssl/generated_https_first_mode_pref_unittest.cc
@@ -189,7 +189,7 @@ std::make_unique<base::Value>( static_cast<int>(HttpsFirstModeSetting::kEnabledBalanced)) .get()), - settings_private::SetPrefResult::PREF_TYPE_UNSUPPORTED); + settings_private::SetPrefResult::PREF_TYPE_MISMATCH); // With Balanced Mode feature disabled, check that setting the underlying // Balanced pref to `true` does not change the generated pref from kDisabled.
diff --git a/chrome/browser/ssl/https_first_mode_settings_tracker.cc b/chrome/browser/ssl/https_first_mode_settings_tracker.cc index 74f8092..5e28981 100644 --- a/chrome/browser/ssl/https_first_mode_settings_tracker.cc +++ b/chrome/browser/ssl/https_first_mode_settings_tracker.cc
@@ -580,6 +580,62 @@ return HttpsFirstModeSetting::kDisabled; } +bool HttpsFirstModeService::UpdatePrefs( + const HttpsFirstModeSetting& selection) { + if (selection != HttpsFirstModeSetting::kDisabled && + selection != HttpsFirstModeSetting::kEnabledBalanced && + selection != HttpsFirstModeSetting::kEnabledFull) { + return false; + } + + if (!IsBalancedModeAvailable() && + selection == HttpsFirstModeSetting::kEnabledBalanced) { + return false; + } + + // Update both HTTPS-First Mode preferences to match the selection. + // + // Note that the HttpsFirstModeSetting::kEnabledBalanced is not available by + // default. If the feature flag is disabled, then the kEnabledFull and + // kDisabled settings will only be mapped to the kHttpsOnlyModeEnabled pref. + // + // Note: The Security.HttpsFirstMode.SettingChanged* histograms are logged + // here instead of in HttpsFirstModeService::OnHttpsFirstModePrefChanged() + // because this will fire the pref observer _twice_, so logging the histogram + // in the pref observer would cause double counting. + if (IsBalancedModeAvailable()) { + switch (selection) { + case HttpsFirstModeSetting::kDisabled: + base::UmaHistogramEnumeration("Security.HttpsFirstMode.SettingChanged2", + HttpsFirstModeSetting::kDisabled); + profile_->GetPrefs()->SetBoolean(prefs::kHttpsOnlyModeEnabled, false); + profile_->GetPrefs()->SetBoolean(prefs::kHttpsFirstBalancedMode, false); + break; + case HttpsFirstModeSetting::kEnabledBalanced: + base::UmaHistogramEnumeration("Security.HttpsFirstMode.SettingChanged2", + HttpsFirstModeSetting::kEnabledBalanced); + profile_->GetPrefs()->SetBoolean(prefs::kHttpsOnlyModeEnabled, false); + profile_->GetPrefs()->SetBoolean(prefs::kHttpsFirstBalancedMode, true); + break; + case HttpsFirstModeSetting::kEnabledFull: + base::UmaHistogramEnumeration("Security.HttpsFirstMode.SettingChanged2", + HttpsFirstModeSetting::kEnabledFull); + profile_->GetPrefs()->SetBoolean(prefs::kHttpsOnlyModeEnabled, true); + profile_->GetPrefs()->SetBoolean(prefs::kHttpsFirstBalancedMode, false); + break; + } + } else { + // TODO(crbug.com/349860796): Remove old settings path once Balanced Mode + // is launched. + base::UmaHistogramBoolean("Security.HttpsFirstMode.SettingChanged", + selection == HttpsFirstModeSetting::kEnabledFull); + profile_->GetPrefs()->SetBoolean( + prefs::kHttpsOnlyModeEnabled, + selection == HttpsFirstModeSetting::kEnabledFull); + } + return true; +} + void HttpsFirstModeService::IncrementRecentNavigationCount() { if (navigation_counter_->Increment()) { profile_->GetPrefs()->SetDict(prefs::kHttpsUpgradeNavigations,
diff --git a/chrome/browser/ssl/https_first_mode_settings_tracker.h b/chrome/browser/ssl/https_first_mode_settings_tracker.h index 6d3d600..2422c73 100644 --- a/chrome/browser/ssl/https_first_mode_settings_tracker.h +++ b/chrome/browser/ssl/https_first_mode_settings_tracker.h
@@ -36,6 +36,8 @@ // Must be kept in sync with the HttpsFirstModeSetting enums located in // chrome/browser/resources/settings/privacy_page/security_page.ts and enums.xml // LINT.IfChange +// A Java counterpart will be generated for this enum. +// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ssl enum class HttpsFirstModeSetting { kDisabled = 0, // DEPRECATED: A separate Incognito setting never shipped. @@ -93,6 +95,10 @@ HttpsFirstModeSetting GetCurrentSetting() const; + // Update the underlying HTTPS-First Mode prefs based on the UI setting + // selection. + bool UpdatePrefs(const HttpsFirstModeSetting& selection); + // Increment recent navigation count and maybe save the counts to a pref. void IncrementRecentNavigationCount(); // Returns the number of navigations counted recently in a rolling window.
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index ecd634b..d039ccc 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -174,8 +174,8 @@ "webui/components/components_handler.h", "webui/components/components_ui.cc", "webui/components/components_ui.h", - "webui/crashes_ui.cc", - "webui/crashes_ui.h", + "webui/crashes/crashes_ui.cc", + "webui/crashes/crashes_ui.h", "webui/data_sharing_internals/data_sharing_internals_page_handler_impl.cc", "webui/data_sharing_internals/data_sharing_internals_page_handler_impl.h", "webui/data_sharing_internals/data_sharing_internals_ui.cc", @@ -4032,6 +4032,7 @@ "views/extensions/dialogs/mv2_deprecation_keep_dialog.cc", "views/extensions/dialogs/mv2_deprecation_reenable_dialog.cc", "views/extensions/dialogs/reload_page_dialog.cc", + "views/extensions/dialogs/upload_extension_to_account_dialog.cc", "views/extensions/expandable_container_view.cc", "views/extensions/expandable_container_view.h", "views/extensions/extension_context_menu_controller.cc", @@ -4701,6 +4702,8 @@ "views/tabs/tab_drag_context.h", "views/tabs/tab_drag_controller.cc", "views/tabs/tab_drag_controller.h", + "views/tabs/tab_glic_container.cc", + "views/tabs/tab_glic_container.h", "views/tabs/tab_group_editor_bubble_view.cc", "views/tabs/tab_group_editor_bubble_view.h", "views/tabs/tab_group_header.cc",
diff --git a/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android.cc b/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android.cc index f23165c5..4d32e56f 100644 --- a/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android.cc +++ b/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android.cc
@@ -79,9 +79,8 @@ const auto origin = url::Origin::Create( permissions::PermissionUtil::GetLastCommittedOriginAsURL( render_frame_host->GetMainFrame())); - base::android::ScopedJavaLocalRef<jstring> origin_string = - base::android::ConvertUTF16ToJavaString( - env, url_formatter::FormatOriginForSecurityDisplay(origin)); + std::u16string origin_string = + url_formatter::FormatOriginForSecurityDisplay(origin); SecurityStateTabHelper* helper = SecurityStateTabHelper::FromWebContents(web_contents); DCHECK(helper); @@ -139,10 +138,7 @@ item_id_map_.insert(item_id_map_.begin() + index, item_id_str); std::u16string device_name = controller_->GetOption(index); - Java_UsbChooserDialog_addDevice( - env, java_dialog_, - base::android::ConvertUTF8ToJavaString(env, item_id_str), - base::android::ConvertUTF16ToJavaString(env, device_name)); + Java_UsbChooserDialog_addDevice(env, java_dialog_, item_id_str, device_name); } void UsbChooserDialogAndroid::OnOptionRemoved(size_t index) { @@ -152,8 +148,7 @@ std::string item_id = item_id_map_[index]; item_id_map_.erase(item_id_map_.begin() + index); - Java_UsbChooserDialog_removeDevice( - env, java_dialog_, base::android::ConvertUTF8ToJavaString(env, item_id)); + Java_UsbChooserDialog_removeDevice(env, java_dialog_, item_id); } void UsbChooserDialogAndroid::OnOptionUpdated(size_t index) { @@ -168,11 +163,8 @@ NOTREACHED(); } -void UsbChooserDialogAndroid::OnItemSelected( - JNIEnv* env, - const base::android::JavaParamRef<jstring>& item_id_jstring) { - std::string item_id = - base::android::ConvertJavaStringToUTF8(env, item_id_jstring); +void UsbChooserDialogAndroid::OnItemSelected(JNIEnv* env, + std::string& item_id) { auto it = base::ranges::find(item_id_map_, item_id); CHECK(it != item_id_map_.end(), base::NotFatalUntil::M130); controller_->Select(
diff --git a/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android.h b/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android.h index ebc4fa60..47c36a1e 100644 --- a/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android.h +++ b/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android.h
@@ -29,7 +29,7 @@ base::OnceCallback<base::android::ScopedJavaLocalRef<jobject>( JNIEnv*, const base::android::JavaRef<jobject>&, - const base::android::JavaRef<jstring>&, + const std::u16string&, JniIntWrapper, const base::android::JavaRef<jobject>&, jlong)>; @@ -67,8 +67,7 @@ void OnRefreshStateChanged(bool refreshing) override; // Report the dialog's result. - void OnItemSelected(JNIEnv* env, - const base::android::JavaParamRef<jstring>& item_id); + void OnItemSelected(JNIEnv* env, std::string& item_id); void OnDialogCancelled(JNIEnv* env); void LoadUsbHelpPage(JNIEnv* env);
diff --git a/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android_unittest.cc b/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android_unittest.cc index cd420ea..3f6090f 100644 --- a/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android_unittest.cc +++ b/chrome/browser/ui/android/device_dialog/usb_chooser_dialog_android_unittest.cc
@@ -47,12 +47,9 @@ base::MockCallback<UsbChooserDialogAndroid::CreateJavaDialogCallback> mock_callback; - auto origin_predicate = - [&](const base::android::JavaRef<jstring>& java_string) { - return base::android::ConvertJavaStringToUTF16( - base::android::AttachCurrentThread(), java_string) == - u"https://main-frame.com"; - }; + auto origin_predicate = [&](const std::u16string& java_string) { + return java_string == u"https://main-frame.com"; + }; EXPECT_CALL(mock_callback, Run(/*env=*/_, /*window_android=*/_, testing::Truly(origin_predicate), /*security_level=*/_, /*profile=*/_,
diff --git a/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfCoordinator.java b/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfCoordinator.java index e71e1fc0..b8c9fcd 100644 --- a/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfCoordinator.java +++ b/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfCoordinator.java
@@ -265,6 +265,7 @@ } mActivity.grantUriPermission( GSAUtils.GSA_PACKAGE_NAME, mUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); + PdfUtils.recordIsWorkProfile(isWorkProfile); return structuredData; }
diff --git a/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfPageUnitTest.java b/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfPageUnitTest.java index 319cdc1..0924f49 100644 --- a/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfPageUnitTest.java +++ b/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfPageUnitTest.java
@@ -27,6 +27,7 @@ import org.chromium.base.supplier.DestroyableObservableSupplier; import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.Features.EnableFeatures; +import org.chromium.base.test.util.HistogramWatcher; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.ui.native_page.NativePageHost; import org.chromium.chrome.browser.util.ChromeFileProvider; @@ -84,7 +85,11 @@ } @Test - public void testCreatePdfPage_WithContentUri() { + public void testCreatePdfPage_WithContentUri() throws Exception { + HistogramWatcher histogramExpectation = + HistogramWatcher.newBuilder() + .expectBooleanRecord("Android.Pdf.AssistContent.IsWorkProfile", true) + .build(); String encodedUrl = PdfUtils.encodePdfPageUrl(CONTENT_URL); PdfPage pdfPage = new PdfPage( @@ -110,7 +115,24 @@ Assert.assertTrue( "Pdf should be loaded when the view is attached to window.", pdfPage.mPdfCoordinator.getIsPdfLoadedForTesting()); + String jsonString = pdfPage.requestAssistContent(/*isWorkProfile*/ true); + Assert.assertNotNull( + "Assist content should be generated when the pdf is ready to load", jsonString); + JSONObject jsonObject = new JSONObject(jsonString); + JSONObject metadata = (JSONObject) jsonObject.get("file_metadata"); + Assert.assertEquals( + "File uri should match.", + pdfPage.mPdfCoordinator.getUriForTesting().toString(), + metadata.get("file_uri")); + Assert.assertEquals( + "File name should match.", pdfPage.getTitle(), metadata.get("file_name")); + Assert.assertEquals( + "Mime type should match.", MimeTypeUtils.PDF_MIME_TYPE, metadata.get("mime_type")); + Assert.assertEquals("Work profile should match.", true, metadata.get("is_work_profile")); + histogramExpectation.assertExpected(); + contentView.removeView(view); + pdfPage.destroy(); } @Test @@ -146,6 +168,10 @@ @Test public void testCreatePdfPage_WithPdfLink() throws Exception { + HistogramWatcher histogramExpectation = + HistogramWatcher.newBuilder() + .expectBooleanRecord("Android.Pdf.AssistContent.IsWorkProfile", false) + .build(); PdfPage pdfPage = new PdfPage( mMockNativePageHost, @@ -194,6 +220,7 @@ Assert.assertEquals( "Mime type should match.", MimeTypeUtils.PDF_MIME_TYPE, metadata.get("mime_type")); Assert.assertEquals("Work profile should match.", false, metadata.get("is_work_profile")); + histogramExpectation.assertExpected(); contentView.removeView(view); pdfPage.destroy();
diff --git a/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfUtils.java b/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfUtils.java index 10b6a0b..f005ba7 100644 --- a/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfUtils.java +++ b/chrome/browser/ui/android/pdf/java/src/org/chromium/chrome/browser/pdf/PdfUtils.java
@@ -364,6 +364,11 @@ "Android.Pdf.FindInPageCounts", findInPageCounts, /* max= */ 9); } + static void recordIsWorkProfile(boolean isWorkProfile) { + RecordHistogram.recordBooleanHistogram( + "Android.Pdf.AssistContent.IsWorkProfile", isWorkProfile); + } + static void recordHasFilepathWithoutFragmentOnDestroy(boolean hasFilepath) { RecordHistogram.recordBooleanHistogram( "Android.Pdf.HasFilepathWithoutFragmentOnDestroy", hasFilepath);
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index fe3e127..8ebbac3 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -6322,6 +6322,25 @@ <message name="IDS_SETTINGS_HTTPS_FIRST_MODE_TITLE" desc="Text for the HTTPS-First Mode toggle in settings."> Always use secure connections </message> + <message name="IDS_SETTINGS_HTTPS_FIRST_MODE_DESCRIPTION" desc="Secondary, continued explanation of HTTPS-Only Mode in Security settings"> + For sites that don’t support secure connections, get warned before visiting the site + </message> + <message name="IDS_SETTINGS_HTTPS_FIRST_MODE_WITH_ADVANCED_PROTECTION_DESCRIPTION" desc="Secondary, continued explanation of HTTPS-Only Mode in Security settings when the user can't change the setting"> + For sites that don’t support secure connections, get warned before visiting the site. You can’t change this setting because you have Advanced Protection enabled. + </message> + <message name="IDS_SETTINGS_HTTPS_FIRST_MODE_DISABLED_LABEL" desc="Label shown under main HTTPS-First Mode title ('Always use secure connections') when the feature is turned off."> + Off + </message> + <message name="IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_STRICT_LABEL" desc="Label for radio button to enable the stricter form of HTTPS-First Mode"> + Warns you for insecure public & private sites + </message> + <message name="IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_STRICT_SUBLABEL" desc="Secondary, continued explanation for the stricter form of HTTPS-First Mode"> + Private sites might include things like your company’s intranet + </message> + <message name="IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_BALANCED_LABEL" desc="Label for radio button to enable the less-strict form of HTTPS-First Mode"> + Warns you for insecure public sites + </message> + <!-- Old HTTPS-First Mode settings strings. TODO(crbug.com/349860796): Remove after new settings are fully rolled out. --> <message name="IDS_SETTINGS_HTTPS_FIRST_MODE_SUMMARY" desc="Secondary, continued explanation of HTTPS-First Mode in settings."> Use HTTPS whenever possible and get warned before loading sites that don’t support it </message>
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_DESCRIPTION.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..2327e23 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +468d1f8c9b5837a623724c295252cb8451a8ed57 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_DISABLED_LABEL.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_DISABLED_LABEL.png.sha1 new file mode 100644 index 0000000..8abf367a --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_DISABLED_LABEL.png.sha1
@@ -0,0 +1 @@ +ad901fb42b6cfbe8b1b7b545b84ca5e2e08d17cf \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_BALANCED_LABEL.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_BALANCED_LABEL.png.sha1 new file mode 100644 index 0000000..2327e23 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_BALANCED_LABEL.png.sha1
@@ -0,0 +1 @@ +468d1f8c9b5837a623724c295252cb8451a8ed57 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_STRICT_LABEL.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_STRICT_LABEL.png.sha1 new file mode 100644 index 0000000..2327e23 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_STRICT_LABEL.png.sha1
@@ -0,0 +1 @@ +468d1f8c9b5837a623724c295252cb8451a8ed57 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_STRICT_SUBLABEL.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_STRICT_SUBLABEL.png.sha1 new file mode 100644 index 0000000..2327e23 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_ENABLED_STRICT_SUBLABEL.png.sha1
@@ -0,0 +1 @@ +468d1f8c9b5837a623724c295252cb8451a8ed57 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_WITH_ADVANCED_PROTECTION_DESCRIPTION.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_WITH_ADVANCED_PROTECTION_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..7e336c2 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SETTINGS_HTTPS_FIRST_MODE_WITH_ADVANCED_PROTECTION_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +1cb35603a436a5acb9ff09d08da4662d9d1e851c \ No newline at end of file
diff --git a/chrome/browser/ui/ash/assistant/assistant_browser_delegate_impl_unittest.cc b/chrome/browser/ui/ash/assistant/assistant_browser_delegate_impl_unittest.cc index 4fc4effa..90cde36 100644 --- a/chrome/browser/ui/ash/assistant/assistant_browser_delegate_impl_unittest.cc +++ b/chrome/browser/ui/ash/assistant/assistant_browser_delegate_impl_unittest.cc
@@ -34,7 +34,9 @@ class AssistantBrowserDelegateImplTest : public ChromeAshTestBase { public: AssistantBrowserDelegateImplTest() - : fake_user_manager_(std::make_unique<ash::FakeChromeUserManager>()) {} + : fake_user_manager_(std::make_unique<ash::FakeChromeUserManager>()) { + set_start_session(false); + } ~AssistantBrowserDelegateImplTest() override = default; void SetUp() override { @@ -46,7 +48,6 @@ auto* user = fake_user_manager_->AddUser(account_id); fake_user_manager_->LoginUser(account_id); - CreateUserSessions(/*session_count=*/1); SimulateUserLogin(account_id); ash::ProfileHelper::Get()->SetUserToProfileMappingForTesting(
diff --git a/chrome/browser/ui/ash/capture_mode/lens_overlay_query_controller.h b/chrome/browser/ui/ash/capture_mode/lens_overlay_query_controller.h index a09ff00..d34e98a 100644 --- a/chrome/browser/ui/ash/capture_mode/lens_overlay_query_controller.h +++ b/chrome/browser/ui/ash/capture_mode/lens_overlay_query_controller.h
@@ -501,9 +501,6 @@ // always be the first interaction in a query flow. bool parent_query_sent_ = false; - // Whether or not a page contents request has been sent. - bool page_contents_request_sent_ = false; - // The invocation source that triggered the query flow. lens::LensOverlayInvocationSource invocation_source_;
diff --git a/chrome/browser/ui/ash/quick_answers/test/chrome_quick_answers_test_base.cc b/chrome/browser/ui/ash/quick_answers/test/chrome_quick_answers_test_base.cc index 4109cdc..a761add 100644 --- a/chrome/browser/ui/ash/quick_answers/test/chrome_quick_answers_test_base.cc +++ b/chrome/browser/ui/ash/quick_answers/test/chrome_quick_answers_test_base.cc
@@ -20,7 +20,9 @@ #include "ui/views/controls/menu/menu_runner.h" #include "ui/views/widget/widget.h" -ChromeQuickAnswersTestBase::ChromeQuickAnswersTestBase() = default; +ChromeQuickAnswersTestBase::ChromeQuickAnswersTestBase() { + set_start_session(false); +} ChromeQuickAnswersTestBase::~ChromeQuickAnswersTestBase() = default; @@ -38,11 +40,11 @@ GetFakeUserManager()->AddUser(account_id); GetFakeUserManager()->LoginUser(account_id); + SimulateUserLogin(account_id); + SetUpInitialPrefValues(); quick_answers_controller_ = CreateQuickAnswersControllerImpl(read_write_cards_ui_controller_); - - CreateUserSessions(/*session_count=*/1); } void ChromeQuickAnswersTestBase::TearDown() {
diff --git a/chrome/browser/ui/ash/web_view/BUILD.gn b/chrome/browser/ui/ash/web_view/BUILD.gn index 304e0e8..05491b1a 100644 --- a/chrome/browser/ui/ash/web_view/BUILD.gn +++ b/chrome/browser/ui/ash/web_view/BUILD.gn
@@ -21,6 +21,7 @@ "//base", "//chrome/browser/media/webrtc", "//chrome/browser/profiles:profile", + "//chrome/browser/ui/ash/new_window:new_window", "//content/public/browser", "//ui/aura", "//ui/base",
diff --git a/chrome/browser/ui/ash/web_view/DEPS b/chrome/browser/ui/ash/web_view/DEPS index f1f4dbc8..61a7308 100644 --- a/chrome/browser/ui/ash/web_view/DEPS +++ b/chrome/browser/ui/ash/web_view/DEPS
@@ -12,5 +12,12 @@ # Whenever possible, avoid adding new //chrome dependencies to this list. "+chrome/browser/media/webrtc", "+chrome/browser/profiles", + "+chrome/browser/ui/ash/new_window", "+chrome/test", ] + +specific_include_rules = { + "ash_web_view_impl_browsertest.cc": [ + "+chrome/browser/ui/browser.h" + ] +}
diff --git a/chrome/browser/ui/ash/web_view/ash_web_view_impl.cc b/chrome/browser/ui/ash/web_view/ash_web_view_impl.cc index 05fa4a72..44be635 100644 --- a/chrome/browser/ui/ash/web_view/ash_web_view_impl.cc +++ b/chrome/browser/ui/ash/web_view/ash_web_view_impl.cc
@@ -4,11 +4,13 @@ #include "chrome/browser/ui/ash/web_view/ash_web_view_impl.h" +#include "ash/public/cpp/new_window_delegate.h" #include "ash/public/cpp/window_properties.h" #include "base/task/sequenced_task_runner.h" #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/ash/new_window/chrome_new_window_client.h" #include "content/public/browser/focused_node_details.h" #include "content/public/browser/host_zoom_map.h" #include "content/public/browser/media_session.h" @@ -145,6 +147,24 @@ source, params, std::move(navigation_handle_callback)); } +void AshWebViewImpl::ActivateContents(content::WebContents* contents) { + // In cases where the widget is not activatable, an `activation_url` may be + // provided to show instead. + // This is currently used for Focus Mode YTM for when the user clicks on the + // media controls view. Since the media window is a custom hidden window, a + // separately provided URL tab (navigating to `activation_url`) is shown when + // the hidden media window is activated. + if (!GetWidget()->CanActivate() && !params_.activation_url.is_empty()) { + ChromeNewWindowClient::Get()->OpenUrl( + params_.activation_url, + ash::NewWindowDelegate::OpenUrlFrom::kUserInteraction, + ash::NewWindowDelegate::Disposition::kSwitchToTab); + return; + } + + content::WebContentsDelegate::ActivateContents(contents); +} + void AshWebViewImpl::ResizeDueToAutoResize(content::WebContents* web_contents, const gfx::Size& new_size) { DCHECK_EQ(web_contents_.get(), web_contents);
diff --git a/chrome/browser/ui/ash/web_view/ash_web_view_impl.h b/chrome/browser/ui/ash/web_view/ash_web_view_impl.h index b078a4a..4fd8dff1 100644 --- a/chrome/browser/ui/ash/web_view/ash_web_view_impl.h +++ b/chrome/browser/ui/ash/web_view/ash_web_view_impl.h
@@ -66,6 +66,7 @@ const content::OpenURLParams& params, base::OnceCallback<void(content::NavigationHandle&)> navigation_handle_callback) override; + void ActivateContents(content::WebContents* contents) override; void ResizeDueToAutoResize(content::WebContents* web_contents, const gfx::Size& new_size) override; bool TakeFocus(content::WebContents* web_contents, bool reverse) override;
diff --git a/chrome/browser/ui/ash/web_view/ash_web_view_impl_browsertest.cc b/chrome/browser/ui/ash/web_view/ash_web_view_impl_browsertest.cc index d9d93dbdd..5e53e5d 100644 --- a/chrome/browser/ui/ash/web_view/ash_web_view_impl_browsertest.cc +++ b/chrome/browser/ui/ash/web_view/ash_web_view_impl_browsertest.cc
@@ -12,11 +12,13 @@ #include "base/run_loop.h" #include "base/scoped_observation.h" #include "base/strings/stringprintf.h" +#include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/browser/host_zoom_map.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/test/browser_test.h" +#include "content/public/test/test_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/views/view.h" @@ -97,12 +99,16 @@ // Helpers --------------------------------------------------------------------- -std::unique_ptr<views::Widget> CreateWidget() { +std::unique_ptr<views::Widget> CreateWidget(bool activatable = true) { auto widget = std::make_unique<views::Widget>(); views::Widget::InitParams params( views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET, views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); + params.activatable = activatable + ? views::Widget::InitParams::Activatable::kDefault + : views::Widget::InitParams::Activatable::kNo; + widget->Init(std::move(params)); return widget; } @@ -310,3 +316,33 @@ EXPECT_DOUBLE_EQ( 1.0, content::HostZoomMap::GetZoomLevel(web_view_impl->web_contents())); } + +// Tests that AshWebViewImpl will open a browser window if the AshWebView is +// activated (while the widget is not activatable) and provided an +// `activation_url`. +IN_PROC_BROWSER_TEST_F(AshWebViewImplBrowserTest, ShouldOpenNewWindow) { + auto widget = CreateWidget(/*activatable=*/false); + AshWebView::InitParams init_params; + const GURL destination_url("https://www.google.com"); + init_params.activation_url = destination_url; + + AshWebView* web_view = + widget->SetContentsView(AshWebViewFactory::Get()->Create(init_params)); + AshWebViewImpl* web_view_impl = static_cast<AshWebViewImpl*>(web_view); + + web_view->Navigate(CreateDataUrl()); + EXPECT_DID_STOP_LOADING(web_view); + + content::WebContents* web_contents = web_view_impl->web_contents(); + web_contents->GetDelegate()->ActivateContents(web_contents); + + // Wait for the browser tab to load. + content::RunAllTasksUntilIdle(); + + // Verify that the browser was launched with the correct url as the active + // tab. + ASSERT_TRUE(browser()); + EXPECT_EQ( + destination_url, + browser()->tab_strip_model()->GetActiveWebContents()->GetVisibleURL()); +}
diff --git a/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller.h b/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller.h index 5fd53a2..28e45f22 100644 --- a/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller.h +++ b/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller.h
@@ -12,7 +12,7 @@ #include "components/user_annotations/user_annotations_types.h" #include "content/public/browser/web_contents.h" -namespace optimization_guide::proto { +namespace optimization_guide::proto::features { class UserAnnotationsEntry; } @@ -52,7 +52,7 @@ // Shows a save Autofill AI data bubble which the user can accept or decline. virtual void OfferSave( - std::vector<optimization_guide::proto::UserAnnotationsEntry> + std::vector<optimization_guide::proto::features::UserAnnotationsEntry> prediction_improvements, user_annotations::PromptAcceptanceCallback prompt_acceptance_callback, LearnMoreClickedCallback learn_more_clicked_callback, @@ -71,7 +71,8 @@ virtual void OnLearnMoreClicked() = 0; // Returns the Autofill AI data to be displayed in the UI. - virtual const std::vector<optimization_guide::proto::UserAnnotationsEntry>& + virtual const std::vector< + optimization_guide::proto::features::UserAnnotationsEntry>& GetAutofillAiData() const = 0; // Called when the Autofill AI data bubble is closed.
diff --git a/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller_impl.cc b/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller_impl.cc index aba6e6b..0f49fcd 100644 --- a/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller_impl.cc
@@ -59,7 +59,7 @@ } void SaveAutofillAiDataControllerImpl::OfferSave( - std::vector<optimization_guide::proto::UserAnnotationsEntry> + std::vector<optimization_guide::proto::features::UserAnnotationsEntry> autofill_ai_data, user_annotations::PromptAcceptanceCallback prompt_acceptance_callback, LearnMoreClickedCallback learn_more_clicked_callback, @@ -133,7 +133,7 @@ return weak_ptr_factory_.GetWeakPtr(); } -const std::vector<optimization_guide::proto::UserAnnotationsEntry>& +const std::vector<optimization_guide::proto::features::UserAnnotationsEntry>& SaveAutofillAiDataControllerImpl::GetAutofillAiData() const { return autofill_ai_data_; }
diff --git a/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller_impl.h b/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller_impl.h index c9a7835..ec40df0 100644 --- a/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller_impl.h +++ b/chrome/browser/ui/autofill/autofill_ai/save_autofill_ai_data_controller_impl.h
@@ -34,13 +34,13 @@ // SaveAutofillAiDataController: void OfferSave( - std::vector<optimization_guide::proto::UserAnnotationsEntry> + std::vector<optimization_guide::proto::features::UserAnnotationsEntry> autofill_ai_data, user_annotations::PromptAcceptanceCallback prompt_acceptance_callback, LearnMoreClickedCallback learn_more_clicked_callback, UserFeedbackCallback user_feedback_callback) override; void OnSaveButtonClicked() override; - const std::vector<optimization_guide::proto::UserAnnotationsEntry>& + const std::vector<optimization_guide::proto::features::UserAnnotationsEntry>& GetAutofillAiData() const override; void OnBubbleClosed(AutofillAiBubbleClosedReason closed_reason) override; base::WeakPtr<SaveAutofillAiDataController> GetWeakPtr() override; @@ -63,7 +63,7 @@ // A list of Autofill AI data keys and values that the user can accept // to save. - std::vector<optimization_guide::proto::UserAnnotationsEntry> + std::vector<optimization_guide::proto::features::UserAnnotationsEntry> autofill_ai_data_; // Callback to notify the data provider about the user decision for the save
diff --git a/chrome/browser/ui/autofill/payments/BUILD.gn b/chrome/browser/ui/autofill/payments/BUILD.gn index 93ea3c66..7bedc99 100644 --- a/chrome/browser/ui/autofill/payments/BUILD.gn +++ b/chrome/browser/ui/autofill/payments/BUILD.gn
@@ -160,7 +160,6 @@ "manage_migration_ui_controller.cc", "offer_notification_bubble_controller_impl.cc", "save_card_bubble_controller_impl.cc", - "save_card_ui.cc", "save_payment_icon_controller.cc", ] deps += [ "//chrome/browser/ui/hats" ]
diff --git a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc index 649cab07..ffc8ff2 100644 --- a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc +++ b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc
@@ -55,46 +55,6 @@ namespace autofill { -namespace { - -std::u16string GetWindowTitleForUploadSave() { - switch (GetUpdatedDesktopUiTreatmentArm()) { - case UpdatedDesktopUiTreatmentArm::kSecurityFocus: - return l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_SECURITY); - case UpdatedDesktopUiTreatmentArm::kConvenienceFocus: - return l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_CONVENIENCE); - case UpdatedDesktopUiTreatmentArm::kEducationFocus: - return l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_EDUCATION); - case UpdatedDesktopUiTreatmentArm::kDefault: - return features::ShouldShowImprovedUserConsentForCreditCardSave() - ? l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_V4) - : l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_V3); - } -} - -std::optional<std::u16string> GetUpdatedExplanatoryMessageForUploadSave() { - switch (GetUpdatedDesktopUiTreatmentArm()) { - case UpdatedDesktopUiTreatmentArm::kSecurityFocus: - return l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_SECURITY); - case UpdatedDesktopUiTreatmentArm::kConvenienceFocus: - return l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_CONVENIENCE); - case UpdatedDesktopUiTreatmentArm::kEducationFocus: - return l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_EDUCATION); - case UpdatedDesktopUiTreatmentArm::kDefault: - return std::nullopt; - } -} - -} // namespace - static bool g_ignore_window_activation_for_testing = false; SaveCardBubbleControllerImpl::SaveCardBubbleControllerImpl( @@ -280,7 +240,8 @@ IDS_AUTOFILL_SAVE_CVC_PROMPT_TITLE_LOCAL); case BubbleType::UPLOAD_SAVE: case BubbleType::UPLOAD_IN_PROGRESS: - return GetWindowTitleForUploadSave(); + return l10n_util::GetStringUTF16( + IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_SECURITY); case BubbleType::UPLOAD_CVC_SAVE: return l10n_util::GetStringUTF16( IDS_AUTOFILL_SAVE_CVC_PROMPT_TITLE_TO_CLOUD); @@ -324,26 +285,8 @@ return std::u16string(); } - if (std::optional<std::u16string> updated_ui_explanatory_message = - GetUpdatedExplanatoryMessageForUploadSave()) { - return updated_ui_explanatory_message.value(); - } - - if (base::FeatureList::IsEnabled( - features::kAutofillEnableCvcStorageAndFilling) && - options_.card_save_type == - payments::PaymentsAutofillClient::CardSaveType::kCardSaveWithCvc) { - return l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_WITH_CVC_PROMPT_EXPLANATION_UPLOAD); - } - - if (options_.should_request_name_from_user) { - return l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_V3_WITH_NAME); - } - return l10n_util::GetStringUTF16( - IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_V3); + IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_SECURITY); } std::u16string SaveCardBubbleControllerImpl::GetAcceptButtonText() const {
diff --git a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl_unittest.cc b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl_unittest.cc index 8371a106..54b3165 100644 --- a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl_unittest.cc +++ b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl_unittest.cc
@@ -1506,92 +1506,5 @@ u"code to your device"); } -using UploadCardUpdatedDesktopUiTestData = - std::tuple<UpdatedDesktopUiTreatmentArm, int, int>; - -// Ensures that the AutofillUpstreamUpdatedUi feature displays the correct UI -// based on which treatment arm the user is in. -// Param of the UploadCardUpdatedDesktopUiTest: -// -- UploadCardUpdatedDesktopUiTestData: A trio of 1) which arm of the -// experiment is active, 2) the expected bubble title text message ID for -// that arm, and 3) the expected bubble explanatory message ID for that arm. -class UploadCardUpdatedDesktopUiTest - : public SaveCardBubbleControllerImplTest, - public testing::WithParamInterface<UploadCardUpdatedDesktopUiTestData> { - public: - UploadCardUpdatedDesktopUiTest() - : treatment_arm_(std::get<0>(GetParam())), - expected_title_id_(std::get<1>(GetParam())), - expected_explanatory_message_id_(std::get<2>(GetParam())) { - std::string treatment_arm_number; - switch (treatment_arm_) { - case UpdatedDesktopUiTreatmentArm::kSecurityFocus: - treatment_arm_number = "1"; - break; - case UpdatedDesktopUiTreatmentArm::kConvenienceFocus: - treatment_arm_number = "2"; - break; - case UpdatedDesktopUiTreatmentArm::kEducationFocus: - treatment_arm_number = "3"; - break; - case UpdatedDesktopUiTreatmentArm::kDefault: - // For the default arm, disable the experiment flag. - scoped_feature_list_.InitAndDisableFeature( - features::kAutofillUpstreamUpdatedUi); - return; - } - scoped_feature_list_.InitAndEnableFeatureWithParameters( - features::kAutofillUpstreamUpdatedUi, - {{"autofill_upstream_updated_ui_treatment", treatment_arm_number}}); - } - - ~UploadCardUpdatedDesktopUiTest() override = default; - - protected: - const UpdatedDesktopUiTreatmentArm treatment_arm_; - const int expected_title_id_; - const int expected_explanatory_message_id_; - - private: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -INSTANTIATE_TEST_SUITE_P( - , - UploadCardUpdatedDesktopUiTest, - testing::Values( - UploadCardUpdatedDesktopUiTestData( - UpdatedDesktopUiTreatmentArm::kDefault, -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_V4, -#else - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_V3, -#endif - IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_V3), - UploadCardUpdatedDesktopUiTestData( - UpdatedDesktopUiTreatmentArm::kSecurityFocus, - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_SECURITY, - IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_SECURITY), - UploadCardUpdatedDesktopUiTestData( - UpdatedDesktopUiTreatmentArm::kConvenienceFocus, - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_CONVENIENCE, - IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_CONVENIENCE), - UploadCardUpdatedDesktopUiTestData( - UpdatedDesktopUiTreatmentArm::kEducationFocus, - IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_EDUCATION, - IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_EDUCATION))); - -TEST_P(UploadCardUpdatedDesktopUiTest, ReturnsApplicableWindowTitle) { - ShowUploadBubble(); - EXPECT_EQ(l10n_util::GetStringUTF16(expected_title_id_), - controller()->GetWindowTitle()); -} - -TEST_P(UploadCardUpdatedDesktopUiTest, ReturnsApplicableExplanatoryMessage) { - ShowUploadBubble(); - EXPECT_EQ(l10n_util::GetStringUTF16(expected_explanatory_message_id_), - controller()->GetExplanatoryMessage()); -} - } // namespace } // namespace autofill
diff --git a/chrome/browser/ui/autofill/payments/save_card_ui.cc b/chrome/browser/ui/autofill/payments/save_card_ui.cc deleted file mode 100644 index f2cda73d..0000000 --- a/chrome/browser/ui/autofill/payments/save_card_ui.cc +++ /dev/null
@@ -1,28 +0,0 @@ -// Copyright 2024 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/autofill/payments/save_card_ui.h" - -#include "components/autofill/core/common/autofill_payments_features.h" - -namespace autofill { - -UpdatedDesktopUiTreatmentArm GetUpdatedDesktopUiTreatmentArm() { - if (!base::FeatureList::IsEnabled(features::kAutofillUpstreamUpdatedUi)) { - return UpdatedDesktopUiTreatmentArm::kDefault; - } - - switch (features::kAutofillUpstreamUpdatedUiTreatment.Get()) { - case 1: - return UpdatedDesktopUiTreatmentArm::kSecurityFocus; - case 2: - return UpdatedDesktopUiTreatmentArm::kConvenienceFocus; - case 3: - return UpdatedDesktopUiTreatmentArm::kEducationFocus; - default: - return UpdatedDesktopUiTreatmentArm::kDefault; - } -} - -} // namespace autofill
diff --git a/chrome/browser/ui/autofill/payments/save_card_ui.h b/chrome/browser/ui/autofill/payments/save_card_ui.h index 348815f..e60290dc 100644 --- a/chrome/browser/ui/autofill/payments/save_card_ui.h +++ b/chrome/browser/ui/autofill/payments/save_card_ui.h
@@ -37,22 +37,6 @@ INACTIVE }; -// The active treatment arm of the AutofillUpstreamUpdatedUi feature. -enum class UpdatedDesktopUiTreatmentArm { - // Experiment not active. - kDefault, - // Security-focused messaging and imagery. - kSecurityFocus, - // Convenience-focused messaging and imagery. - kConvenienceFocus, - // Education-focused messaging and imagery. - kEducationFocus -}; - -// Returns the active UpdatedDesktopUiTreatmentArm based on the user's current -// Finch configuration. -UpdatedDesktopUiTreatmentArm GetUpdatedDesktopUiTreatmentArm(); - } // namespace autofill #endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_SAVE_CARD_UI_H_
diff --git a/chrome/browser/ui/chromeos/magic_boost/magic_boost_card_controller.h b/chrome/browser/ui/chromeos/magic_boost/magic_boost_card_controller.h index d39e8b9..b54fea98 100644 --- a/chrome/browser/ui/chromeos/magic_boost/magic_boost_card_controller.h +++ b/chrome/browser/ui/chromeos/magic_boost/magic_boost_card_controller.h
@@ -87,9 +87,6 @@ private: TransitionAction transition_action_ = TransitionAction::kDoNothing; - // If Orca feature is included. - bool is_orca_included_ = false; - views::UniqueWidgetPtr opt_in_widget_; OptInFeatures opt_in_features_;
diff --git a/chrome/browser/ui/extensions/extensions_dialogs.h b/chrome/browser/ui/extensions/extensions_dialogs.h index a716cd4..affb90c 100644 --- a/chrome/browser/ui/extensions/extensions_dialogs.h +++ b/chrome/browser/ui/extensions/extensions_dialogs.h
@@ -138,6 +138,12 @@ content::WebContents* web_contents, base::OnceClosure done_callback); +// Shows a dialog when the user tries to upload an extension to their account. +void ShowUploadExtensionToAccountDialog(Browser* browser, + const Extension& extension, + base::OnceClosure accept_callback, + base::OnceClosure cancel_callback); + #if BUILDFLAG(IS_CHROMEOS) // Shows a scanner discovery confirmation dialog bubble anchored to the toolbar
diff --git a/chrome/browser/ui/lens/lens_overlay_live_test.cc b/chrome/browser/ui/lens/lens_overlay_live_test.cc index 3413eb44..9847be4 100644 --- a/chrome/browser/ui/lens/lens_overlay_live_test.cc +++ b/chrome/browser/ui/lens/lens_overlay_live_test.cc
@@ -56,13 +56,16 @@ constexpr char kDivWordClass[] = "word"; constexpr char kDivObjectClass[] = "object"; +constexpr char kDivTranslatedLineClass[] = "translated-line"; + +constexpr char kTranslateEnableButtonID[] = "translateEnableButton"; // Helper script to verify that the overlay WebUI has rendered divs with the CSS // class provided. constexpr char kFindAndClickDivWithClassScript[] = R"( function findAndClickDivWithClass(parentElement) { const div = parentElement.querySelector('div.' + $1); - if (parentElement.querySelector('div.' + $1)) { + if (div) { const rect = div.getBoundingClientRect(); const centerX = rect.left + rect.width / 2; const centerY = rect.top + rect.height / 2; @@ -99,10 +102,61 @@ findAndClickDivWithClass(document.body); )"; +constexpr char kFindDivWithClassScript[] = R"( + function kFindDivWithClassScript(parentElement) { + const div = parentElement.querySelector('div.' + $1); + if (div) { + return true; + } + for (const child of parentElement.children) { + if (kFindDivWithClassScript(child) || + (child.shadowRoot && + kFindDivWithClassScript(child.shadowRoot))) { + return true; + } + } + return false; + } + kFindDivWithClassScript(document.body); +)"; + +// Helper script to fetch an element with a certain ID and click on it. +constexpr char kFindAndClickElementWithIDScript[] = R"( + function findAndClickElementWithID(root, id) { + const nodesToVisit = [root]; + while (nodesToVisit.length > 0) { + const currentNode = nodesToVisit.shift(); + if (currentNode instanceof ShadowRoot) { + const element = currentNode.getElementById(id); + if (element) { + element.click(); + return true; + } + } + // Add all children (including those in shadowRoots) to the queue. + for (const child of currentNode.children) { + nodesToVisit.push(child); + if (child.shadowRoot) { + nodesToVisit.push(child.shadowRoot); + } + } + } + return false; + } + findAndClickElementWithID(document, $1); +)"; + +// Wait for an animation frame as it takes one to wait for the translated lines +// to render properly. +constexpr char kWaitForAnimationFrame[] = + "() => new Promise(resolve => requestAnimationFrame(() => resolve(true)))"; + const char kNpsUrl[] = "https://www.nps.gov/articles/route-66-overview.htm"; const char kNpsObjectUrl[] = "https://www.nps.gov/common/commonspot/templates/images/graphics/404/" "04.jpg"; +const char kNpsTranslateUrl[] = + "https://www.nps.gov/subjects/historicpreservationfund/en-espanol.htm"; } // namespace // Live tests for Companion. @@ -256,6 +310,37 @@ ".*source=chrome.cr.menu.*&gsc=2&hl=.*&biw=\\d+&bih=\\d+")); } + void ClickTranslateButtonAndThenText() { + // Find and click the translate enable button when it appears on the + // overlay. + ASSERT_TRUE(base::test::RunUntil([&]() { + return EvalJs(content::JsReplace(kFindAndClickElementWithIDScript, + kTranslateEnableButtonID)) + .ExtractBool(); + })); + + // After, wait for the translated lines to appear. + ASSERT_TRUE(base::test::RunUntil([&]() { + return EvalJs(content::JsReplace(kFindDivWithClassScript, + kDivTranslatedLineClass)) + .ExtractBool(); + })); + + // The translated lines render and then need one animation frame in order + // for the overlay to compute their bounding boxes for highlighted lines. If + // the overlay does not wait for this computation, then an assertion error + // will be thrown. + ASSERT_TRUE(content::ExecJs(GetOverlayWebContents()->GetPrimaryMainFrame(), + kWaitForAnimationFrame)); + + // Click on the translated line. + ASSERT_TRUE(base::test::RunUntil([&]() { + return EvalJs(content::JsReplace(kFindAndClickDivWithClassScript, + kDivTranslatedLineClass)) + .ExtractBool(); + })); + } + virtual void SetUpFeatureList() { feature_list_.InitAndEnableFeatureWithParameters( lens::features::kLensOverlay, @@ -518,4 +603,126 @@ VerifySidePanelLoaded(); } +IN_PROC_BROWSER_TEST_F(LensOverlayLiveTest, TranslateScreen_SignedInAndSynced) { + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(lens::features::kLensOverlayTranslateButton); + + std::optional<signin::TestAccountSigninCredentials> test_account = + GetTestAccounts()->GetAccount("INTELLIGENCE_ACCOUNT"); + // Sign in and sync to opted in test account. + CHECK(test_account.has_value()); + sign_in_functions.TurnOnSync(*test_account, 0); + EXPECT_TRUE(sync_service()->IsSyncFeatureEnabled()); + + // Navigate to a website and wait for paint before starting controller. + WaitForPaint(kNpsTranslateUrl); + EXPECT_TRUE(content::WaitForLoadStop(web_contents())); + + // State should start in off. + auto* controller = browser() + ->tab_strip_model() + ->GetActiveTab() + ->GetTabFeatures() + ->lens_overlay_controller(); + ASSERT_EQ(controller->state(), State::kOff); + + // Showing UI should change the state to screenshot and eventually to overlay. + controller->ShowUI(LensOverlayInvocationSource::kAppMenu); + ASSERT_EQ(controller->state(), State::kScreenshot); + ASSERT_TRUE(base::test::RunUntil( + [&]() { return controller->state() == State::kOverlay; })); + ASSERT_EQ(side_panel_coordinator()->GetCurrentEntryId(), std::nullopt); + ASSERT_TRUE(content::WaitForLoadStop(GetOverlayWebContents())); + + // Confirm that the WebUI has reported that it is ready. This means the local + // DOM should be initialized on our WebUI. + WaitForHistogram("Lens.Overlay.TimeToWebUIReady"); + + // Check if the translate button exits and then click on a translated line. + ClickTranslateButtonAndThenText(); + + // After finding and clicking the div, make sure the side panel opens and + // loaded a result. + VerifySidePanelLoaded(); +} + +IN_PROC_BROWSER_TEST_F(LensOverlayLiveTest, TranslateScreen_SignedInNotSynced) { + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(lens::features::kLensOverlayTranslateButton); + + std::optional<signin::TestAccountSigninCredentials> test_account = + GetTestAccounts()->GetAccount("INTELLIGENCE_ACCOUNT"); + // Sign in but do not sync to opted in test account. + CHECK(test_account.has_value()); + sign_in_functions.SignInFromWeb(*test_account, 0); + EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled()); + + // Navigate to a website and wait for paint before starting controller. + WaitForPaint(kNpsTranslateUrl); + EXPECT_TRUE(content::WaitForLoadStop(web_contents())); + + // State should start in off. + auto* controller = browser() + ->tab_strip_model() + ->GetActiveTab() + ->GetTabFeatures() + ->lens_overlay_controller(); + ASSERT_EQ(controller->state(), State::kOff); + + // Showing UI should change the state to screenshot and eventually to overlay. + controller->ShowUI(LensOverlayInvocationSource::kAppMenu); + ASSERT_EQ(controller->state(), State::kScreenshot); + ASSERT_TRUE(base::test::RunUntil( + [&]() { return controller->state() == State::kOverlay; })); + ASSERT_EQ(side_panel_coordinator()->GetCurrentEntryId(), std::nullopt); + ASSERT_TRUE(content::WaitForLoadStop(GetOverlayWebContents())); + + // Confirm that the WebUI has reported that it is ready. This means the local + // DOM should be initialized on our WebUI. + WaitForHistogram("Lens.Overlay.TimeToWebUIReady"); + + // Check if the translate button exits and then click on a translated line. + ClickTranslateButtonAndThenText(); + + // After finding and clicking the div, make sure the side panel opens and + // loaded a result. + VerifySidePanelLoaded(); +} + +IN_PROC_BROWSER_TEST_F(LensOverlayLiveTest, TranslateScreen_SignedOut) { + base::test::ScopedFeatureList features; + features.InitAndEnableFeature(lens::features::kLensOverlayTranslateButton); + + // Navigate to a website and wait for paint before starting controller. + WaitForPaint(kNpsTranslateUrl); + EXPECT_TRUE(content::WaitForLoadStop(web_contents())); + + // State should start in off. + auto* controller = browser() + ->tab_strip_model() + ->GetActiveTab() + ->GetTabFeatures() + ->lens_overlay_controller(); + ASSERT_EQ(controller->state(), State::kOff); + + // Showing UI should change the state to screenshot and eventually to overlay. + controller->ShowUI(LensOverlayInvocationSource::kAppMenu); + ASSERT_EQ(controller->state(), State::kScreenshot); + ASSERT_TRUE(base::test::RunUntil( + [&]() { return controller->state() == State::kOverlay; })); + ASSERT_EQ(side_panel_coordinator()->GetCurrentEntryId(), std::nullopt); + ASSERT_TRUE(content::WaitForLoadStop(GetOverlayWebContents())); + + // Confirm that the WebUI has reported that it is ready. This means the local + // DOM should be initialized on our WebUI. + WaitForHistogram("Lens.Overlay.TimeToWebUIReady"); + + // Check if the translate button exits and then click on a translated line. + ClickTranslateButtonAndThenText(); + + // After finding and clicking the div, make sure the side panel opens and + // loaded a result. + VerifySidePanelLoaded(); +} + } // namespace lens
diff --git a/chrome/browser/ui/startup/first_run_service.cc b/chrome/browser/ui/startup/first_run_service.cc index 2738960..f9289f66 100644 --- a/chrome/browser/ui/startup/first_run_service.cc +++ b/chrome/browser/ui/startup/first_run_service.cc
@@ -208,9 +208,7 @@ should_mark_fre_finished = false; break; case ProfilePicker::FirstRunExitStatus::kQuitAtEnd: -#if BUILDFLAG(ENABLE_DICE_SUPPORT) proceed = true; -#endif should_mark_fre_finished = true; break; case ProfilePicker::FirstRunExitStatus::kAbandonedFlow: @@ -260,16 +258,14 @@ /*is_default_name=*/false); } -void FirstRunService::OpenFirstRunIfNeeded(EntryPoint entry_point, - ResumeTaskCallback callback) { +void FirstRunService::OpenFirstRunIfNeeded(ResumeTaskCallback callback) { OnFirstRunHasExited(ProfilePicker::FirstRunExitStatus::kAbortTask); resume_task_callback_ = std::move(callback); - TryMarkFirstRunAlreadyFinished( - base::BindOnce(&FirstRunService::OpenFirstRunInternal, - weak_ptr_factory_.GetWeakPtr(), entry_point)); + TryMarkFirstRunAlreadyFinished(base::BindOnce( + &FirstRunService::OpenFirstRunInternal, weak_ptr_factory_.GetWeakPtr())); } -void FirstRunService::OpenFirstRunInternal(EntryPoint entry_point) { +void FirstRunService::OpenFirstRunInternal() { if (IsFirstRunMarkedFinishedInPrefs()) { // Opening the First Run is not needed. For example it might have been // marked finished silently, or is suppressed by policy. @@ -280,9 +276,6 @@ return; } - base::UmaHistogramEnumeration("ProfilePicker.FirstRun.EntryPoint", - entry_point); - // Note: we call `Show()` even if the FRE might be already open and rely on // the ProfilePicker to decide what it wants to do with `callback`. ProfilePicker::Show(ProfilePicker::Params::ForFirstRun(
diff --git a/chrome/browser/ui/startup/first_run_service.h b/chrome/browser/ui/startup/first_run_service.h index 9a25f06..10abf3a 100644 --- a/chrome/browser/ui/startup/first_run_service.h +++ b/chrome/browser/ui/startup/first_run_service.h
@@ -14,7 +14,6 @@ #include "chrome/browser/profiles/profile_keyed_service_factory.h" #include "chrome/browser/ui/profiles/profile_picker.h" #include "components/keyed_service/core/keyed_service.h" -#include "components/signin/public/base/signin_buildflags.h" class PrefRegistrySimple; class Profile; @@ -38,26 +37,8 @@ public: // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. - enum class EntryPoint { - // Indicates misc, undifferentiated entry points to the FRE that we don't - // particularly worry about. If we have a concern about a specific entry - // point, we should register a dedicated value for it to track how often it - // gets triggered. - kOther = 0, - - kProcessStartup = 1, - kWebAppLaunch = 2, - kWebAppContextMenu = 3, - - kMaxValue = kWebAppContextMenu - }; - - // These values are persisted to logs. Entries should not be renumbered and - // numeric values should never be reused. enum class FinishedReason { -#if BUILDFLAG(ENABLE_DICE_SUPPORT) kExperimentCounterfactual = 0, -#endif kFinishedFlow = 1, kProfileAlreadySetUp = 2, kSkippedByPolicies = 3, @@ -92,8 +73,7 @@ // again at the next startup. // When this method is called again while FRE is in progress, the previous // callback is aborted (called with false), and is replaced by `callback`. - virtual void OpenFirstRunIfNeeded(EntryPoint entry_point, - ResumeTaskCallback callback); + virtual void OpenFirstRunIfNeeded(ResumeTaskCallback callback); // Terminates the first run without re-opening a browser window. virtual void FinishFirstRunWithoutResumeTask(); @@ -111,7 +91,7 @@ // The finished state can be checked by calling `ShouldOpenFirstRun()`. void TryMarkFirstRunAlreadyFinished(base::OnceClosure callback); - void OpenFirstRunInternal(EntryPoint entry_point); + void OpenFirstRunInternal(); // Processes the outcome from the FRE and resumes the user's interrupted task. void OnFirstRunHasExited(ProfilePicker::FirstRunExitStatus status);
diff --git a/chrome/browser/ui/startup/first_run_service_browsertest.cc b/chrome/browser/ui/startup/first_run_service_browsertest.cc index 4a91a9c2..41895ce 100644 --- a/chrome/browser/ui/startup/first_run_service_browsertest.cc +++ b/chrome/browser/ui/startup/first_run_service_browsertest.cc
@@ -134,16 +134,13 @@ expected_proceed = true; ASSERT_TRUE(fre_service()->ShouldOpenFirstRun()); - fre_service()->OpenFirstRunIfNeeded(FirstRunService::EntryPoint::kOther, - proceed_future.GetCallback()); + fre_service()->OpenFirstRunIfNeeded(proceed_future.GetCallback()); profiles::testing::WaitForPickerWidgetCreated(); EXPECT_FALSE(GetFirstRunFinishedPrefValue()); histogram_tester.ExpectUniqueSample("ProfilePicker.FirstRun.ServiceCreated", true, 1); - histogram_tester.ExpectUniqueSample("ProfilePicker.FirstRun.EntryPoint", - FirstRunService::EntryPoint::kOther, 1); ProfilePicker::Hide(); EXPECT_EQ(expected_proceed, proceed_future.Get()); @@ -174,13 +171,11 @@ base::HistogramTester histogram_tester; ASSERT_TRUE(fre_service()->ShouldOpenFirstRun()); - fre_service()->OpenFirstRunIfNeeded(FirstRunService::EntryPoint::kOther, - first_proceed_future.GetCallback()); + fre_service()->OpenFirstRunIfNeeded(first_proceed_future.GetCallback()); profiles::testing::WaitForPickerWidgetCreated(); bool expected_second_proceed = true; - fre_service()->OpenFirstRunIfNeeded(FirstRunService::EntryPoint::kOther, - second_proceed_future.GetCallback()); + fre_service()->OpenFirstRunIfNeeded(second_proceed_future.GetCallback()); EXPECT_FALSE(first_proceed_future.Get()); histogram_tester.ExpectBucketCount( @@ -199,8 +194,7 @@ ASSERT_TRUE(fre_service()); EXPECT_TRUE(fre_service()->ShouldOpenFirstRun()); - fre_service()->OpenFirstRunIfNeeded(FirstRunService::EntryPoint::kOther, - proceed_future.GetCallback()); + fre_service()->OpenFirstRunIfNeeded(proceed_future.GetCallback()); profiles::testing::WaitForPickerWidgetCreated(); EXPECT_FALSE(GetFirstRunFinishedPrefValue()); @@ -293,7 +287,6 @@ base::RunLoop run_loop; fre_service()->OpenFirstRunIfNeeded( - FirstRunService::EntryPoint::kOther, base::IgnoreArgs<bool>(run_loop.QuitClosure())); EXPECT_EQ(GetParam().should_open_fre, ProfilePicker::IsOpen());
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index 16f7438..e63c39a 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -709,7 +709,6 @@ // launch. This `StartupBrowserCreator` will get destroyed when the method // returns so the relevant data is copied over and passed to the callback. fre_service->OpenFirstRunIfNeeded( - FirstRunService::EntryPoint::kProcessStartup, base::BindOnce(&OpenNewWindowForFirstRun, command_line, profile, cur_dir, first_run_tabs_, process_startup, is_first_run));
diff --git a/chrome/browser/ui/tabs/organization/logging_util.cc b/chrome/browser/ui/tabs/organization/logging_util.cc index 3bd0f6b..a16eb187 100644 --- a/chrome/browser/ui/tabs/organization/logging_util.cc +++ b/chrome/browser/ui/tabs/organization/logging_util.cc
@@ -12,18 +12,18 @@ #include "components/optimization_guide/proto/features/tab_organization.pb.h" void AddOrganizationDetailsToQualityOrganization( - optimization_guide::proto::TabOrganizationQuality* quality, + optimization_guide::proto::features::TabOrganizationQuality* quality, const TabOrganization* organization, const TabOrganizationResponse::Organization* response_organization) { CHECK(quality && response_organization); - optimization_guide::proto::TabOrganizationQuality_Organization* + optimization_guide::proto::features::TabOrganizationQuality_Organization* quality_organization = quality->add_organizations(); CHECK(quality_organization != nullptr); if (!organization) { quality_organization->set_choice( - optimization_guide::proto:: + optimization_guide::proto::features:: TabOrganizationQuality_Organization_Choice_NOT_USED); return; } @@ -35,17 +35,18 @@ switch (organization->choice()) { case TabOrganization::UserChoice::kRejected: { quality_organization->set_choice( - optimization_guide::proto:: + optimization_guide::proto::features:: TabOrganizationQuality_Organization_Choice_REJECTED); break; } case TabOrganization::UserChoice::kAccepted: { quality_organization->set_choice( - optimization_guide::proto:: + optimization_guide::proto::features:: TabOrganizationQuality_Organization_Choice_ACCEPTED); - optimization_guide::proto::TabOrganizationQuality_Organization_Label* - label = quality_organization->mutable_label(); + optimization_guide::proto::features:: + TabOrganizationQuality_Organization_Label* label = + quality_organization->mutable_label(); label->set_edited(organization->names().size() == 0 || organization->names()[0] != organization->GetDisplayName()); @@ -63,7 +64,7 @@ } void AddSessionDetailsToQuality( - optimization_guide::proto::TabOrganizationQuality* quality, + optimization_guide::proto::features::TabOrganizationQuality* quality, const TabOrganizationSession* session) { CHECK(session && session->request() && session->request()->response());
diff --git a/chrome/browser/ui/tabs/organization/logging_util.h b/chrome/browser/ui/tabs/organization/logging_util.h index 88b5af77..2cad1a29 100644 --- a/chrome/browser/ui/tabs/organization/logging_util.h +++ b/chrome/browser/ui/tabs/organization/logging_util.h
@@ -7,22 +7,20 @@ #include "chrome/browser/ui/tabs/organization/tab_organization_request.h" -namespace optimization_guide { -namespace proto { +namespace optimization_guide::proto::features { class TabOrganizationQuality; -} // namespace proto -} // namespace optimization_guide +} // namespace optimization_guide::proto::features class TabOrganizationSession; class TabOrganization; void AddOrganizationDetailsToQualityOrganization( - optimization_guide::proto::TabOrganizationQuality* quality, + optimization_guide::proto::features::TabOrganizationQuality* quality, const TabOrganization* organization, const TabOrganizationResponse::Organization* response_organization); void AddSessionDetailsToQuality( - optimization_guide::proto::TabOrganizationQuality* quality, + optimization_guide::proto::features::TabOrganizationQuality* quality, const TabOrganizationSession* session); #endif // CHROME_BROWSER_UI_TABS_ORGANIZATION_LOGGING_UTIL_H_
diff --git a/chrome/browser/ui/tabs/organization/request_factory.cc b/chrome/browser/ui/tabs/organization/request_factory.cc index 29fbd7a..bc98ac2 100644 --- a/chrome/browser/ui/tabs/organization/request_factory.cc +++ b/chrome/browser/ui/tabs/organization/request_factory.cc
@@ -52,7 +52,7 @@ if (log_entry && session->request() && session->request()->response() && session->request()->response()->organizations.size() > 0 && session->tab_organizations().size() > 0) { - optimization_guide::proto::TabOrganizationQuality* quality = + optimization_guide::proto::features::TabOrganizationQuality* quality = log_entry ->quality_data<optimization_guide::TabOrganizationFeatureTypeMap>(); @@ -67,7 +67,8 @@ TabOrganizationRequest::BackendCompletionCallback on_completion, TabOrganizationRequest::BackendFailureCallback on_failure, optimization_guide::OptimizationGuideModelExecutionResult result, - std::unique_ptr<optimization_guide::proto::TabOrganizationLoggingData> + std::unique_ptr< + optimization_guide::proto::features::TabOrganizationLoggingData> logging_data) { OptimizationGuideKeyedService* optimization_guide_keyed_service = OptimizationGuideKeyedServiceFactory::GetForProfile(profile); @@ -82,7 +83,7 @@ } auto response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::TabOrganizationResponse>( + optimization_guide::proto::features::TabOrganizationResponse>( result.response.value()); if (!response) { @@ -130,7 +131,8 @@ return; } - optimization_guide::proto::TabOrganizationRequest tab_organization_request; + optimization_guide::proto::features::TabOrganizationRequest + tab_organization_request; int valid_tabs = 0; for (const std::unique_ptr<TabData>& tab_data : request->tab_datas()) { if (!tab_data->IsValidForOrganizing()) { @@ -190,22 +192,22 @@ switch (strategy) { case tab_search::mojom::TabOrganizationModelStrategy::kTopic: tab_organization_request.set_model_strategy( - optimization_guide::proto:: + optimization_guide::proto::features:: TabOrganizationRequest_TabOrganizationModelStrategy_STRATEGY_UNSPECIFIED); break; case tab_search::mojom::TabOrganizationModelStrategy::kTask: tab_organization_request.set_model_strategy( - optimization_guide::proto:: + optimization_guide::proto::features:: TabOrganizationRequest_TabOrganizationModelStrategy_STRATEGY_TASK_BASED); break; case tab_search::mojom::TabOrganizationModelStrategy::kDomain: tab_organization_request.set_model_strategy( - optimization_guide::proto:: + optimization_guide::proto::features:: TabOrganizationRequest_TabOrganizationModelStrategy_STRATEGY_DOMAIN_BASED); break; default: tab_organization_request.set_model_strategy( - optimization_guide::proto:: + optimization_guide::proto::features:: TabOrganizationRequest_TabOrganizationModelStrategy_STRATEGY_UNSPECIFIED); break; }
diff --git a/chrome/browser/ui/tabs/organization/tab_organization.h b/chrome/browser/ui/tabs/organization/tab_organization.h index 849031f..3be5d47 100644 --- a/chrome/browser/ui/tabs/organization/tab_organization.h +++ b/chrome/browser/ui/tabs/organization/tab_organization.h
@@ -57,7 +57,9 @@ const CurrentName& current_name() const { return current_name_; } UserChoice choice() const { return choice_; } // TODO(b/331852814): Remove along with the multi tab organization flag - optimization_guide::proto::UserFeedback feedback() const { return feedback_; } + optimization_guide::proto::features::UserFeedback feedback() const { + return feedback_; + } std::optional<tab_groups::TabGroupId> group_id() const { return group_id_; } ID organization_id() const { return organization_id_; } const std::u16string GetDisplayName() const; @@ -74,7 +76,7 @@ void RemoveTabData(TabData::TabID id); void SetCurrentName(CurrentName new_current_name); // TODO(b/331852814): Remove along with the multi tab organization flag - void SetFeedback(optimization_guide::proto::UserFeedback feedback) { + void SetFeedback(optimization_guide::proto::features::UserFeedback feedback) { feedback_ = feedback; } void SetTabGroupId(std::optional<tab_groups::TabGroupId> id) { @@ -122,8 +124,9 @@ // A separate feedback mechanism, represents whether the user has provided // feedback via the thumbs UI. // TODO(b/331852814): Remove along with the multi tab organization flag - optimization_guide::proto::UserFeedback feedback_ = - optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + optimization_guide::proto::features::UserFeedback feedback_ = + optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED; // The id for the existing tab group this organization refers to, if any. std::optional<tab_groups::TabGroupId> group_id_ = std::nullopt;
diff --git a/chrome/browser/ui/tabs/organization/tab_organization_session.h b/chrome/browser/ui/tabs/organization/tab_organization_session.h index 93bb7cc..374b736 100644 --- a/chrome/browser/ui/tabs/organization/tab_organization_session.h +++ b/chrome/browser/ui/tabs/organization/tab_organization_session.h
@@ -50,7 +50,9 @@ } ID session_id() const { return session_id_; } std::u16string feedback_id() const { return feedback_id_; } - optimization_guide::proto::UserFeedback feedback() const { return feedback_; } + optimization_guide::proto::features::UserFeedback feedback() const { + return feedback_; + } const tabs::TabInterface* base_session_tab() const { return base_session_tab_; } @@ -74,7 +76,7 @@ // that need to be taken on organizations. bool IsComplete() const; - void SetFeedback(optimization_guide::proto::UserFeedback feedback) { + void SetFeedback(optimization_guide::proto::features::UserFeedback feedback) { feedback_ = feedback; } @@ -108,8 +110,9 @@ std::u16string feedback_id_; // Represents whether the user has provided feedback via the thumbs UI. - optimization_guide::proto::UserFeedback feedback_ = - optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + optimization_guide::proto::features::UserFeedback feedback_ = + optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED; // Entry point used to create the session. Used for logging. TabOrganizationEntryPoint entrypoint_;
diff --git a/chrome/browser/ui/tabs/organization/tab_organization_unittest.cc b/chrome/browser/ui/tabs/organization/tab_organization_unittest.cc index b26b68c7..392e7d1 100644 --- a/chrome/browser/ui/tabs/organization/tab_organization_unittest.cc +++ b/chrome/browser/ui/tabs/organization/tab_organization_unittest.cc
@@ -1249,7 +1249,7 @@ std::unique_ptr<optimization_guide::ModelQualityLogEntry> model_quality_log_entry = std::make_unique<FakeModelQualityLogEntry>(); - optimization_guide::proto::TabOrganizationQuality* quality = + optimization_guide::proto::features::TabOrganizationQuality* quality = model_quality_log_entry ->quality_data<optimization_guide::TabOrganizationFeatureTypeMap>(); @@ -1345,7 +1345,7 @@ std::unique_ptr<optimization_guide::ModelQualityLogEntry> model_quality_log_entry = std::make_unique<FakeModelQualityLogEntry>(); - optimization_guide::proto::TabOrganizationQuality* quality = + optimization_guide::proto::features::TabOrganizationQuality* quality = model_quality_log_entry ->quality_data<optimization_guide::TabOrganizationFeatureTypeMap>(); @@ -1356,12 +1356,14 @@ // get the list of organizations and expect one to be present EXPECT_EQ(quality->organizations_size(), 3); { - const optimization_guide::proto::TabOrganizationQuality_Organization& - quality_org = quality->organizations(0); + const optimization_guide::proto::features:: + TabOrganizationQuality_Organization& quality_org = + quality->organizations(0); EXPECT_TRUE(quality_org.has_label()); - const optimization_guide::proto::TabOrganizationQuality_Organization_Label& - quality_org_label = quality_org.label(); + const optimization_guide::proto::features:: + TabOrganizationQuality_Organization_Label& quality_org_label = + quality_org.label(); EXPECT_FALSE(quality_org_label.edited()); } }
diff --git a/chrome/browser/ui/toasts/BUILD.gn b/chrome/browser/ui/toasts/BUILD.gn index c73d0e2..82b1596 100644 --- a/chrome/browser/ui/toasts/BUILD.gn +++ b/chrome/browser/ui/toasts/BUILD.gn
@@ -9,6 +9,7 @@ source_set("toasts") { sources = [ "toast_controller.h", + "toast_dismiss_menu_model.h", "toast_features.h", "toast_metrics.h", "toast_service.h", @@ -34,6 +35,7 @@ source_set("impl") { sources = [ "toast_controller.cc", + "toast_dismiss_menu_model.cc", "toast_features.cc", "toast_metrics.cc", "toast_service.cc", @@ -45,6 +47,7 @@ "//chrome/app:generated_resources", "//chrome/app:generated_resources_grit", "//chrome/app/vector_icons", + "//chrome/browser:browser_process", "//chrome/browser:browser_public_dependencies", "//chrome/browser/profiles:profile", "//chrome/browser/ui:browser_element_identifiers",
diff --git a/chrome/browser/ui/toasts/toast_controller.cc b/chrome/browser/ui/toasts/toast_controller.cc index dc39e579..23c7c4c 100644 --- a/chrome/browser/ui/toasts/toast_controller.cc +++ b/chrome/browser/ui/toasts/toast_controller.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/toasts/toast_controller.h" +#include <memory> #include <optional> #include <string> #include <utility> @@ -17,6 +18,7 @@ #include "base/location.h" #include "base/time/time.h" #include "base/timer/timer.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/ui/browser_window/public/browser_window_features.h" #include "chrome/browser/ui/browser_window/public/browser_window_interface.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" @@ -25,10 +27,13 @@ #include "chrome/browser/ui/toasts/api/toast_id.h" #include "chrome/browser/ui/toasts/api/toast_registry.h" #include "chrome/browser/ui/toasts/api/toast_specification.h" +#include "chrome/browser/ui/toasts/toast_dismiss_menu_model.h" #include "chrome/browser/ui/toasts/toast_features.h" #include "chrome/browser/ui/toasts/toast_metrics.h" #include "chrome/browser/ui/toasts/toast_view.h" +#include "chrome/common/pref_names.h" #include "components/omnibox/common/omnibox_focus_state.h" +#include "components/prefs/pref_service.h" #include "content/public/browser/web_contents.h" #include "ui/base/l10n/l10n_util.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" @@ -65,8 +70,20 @@ return GetCurrentToastId().has_value(); } -bool ToastController::CanShowToast(ToastId id) const { - return base::FeatureList::IsEnabled(toast_features::kToastFramework); +bool ToastController::CanShowToast(ToastId toast_id) const { + if (!base::FeatureList::IsEnabled(toast_features::kToastFramework)) { + return false; + } + if (base::FeatureList::IsEnabled(toast_features::kToastRefinements) && + static_cast<toasts::ToastAlertLevel>( + g_browser_process->local_state()->GetInteger( + prefs::kToastAlertLevel)) == + toasts::ToastAlertLevel::kActionable) { + const ToastSpecification* toast_spec = + toast_registry_->GetToastSpecification(toast_id); + return toast_spec->has_close_button() || toast_spec->has_menu(); + } + return true; } std::optional<ToastId> ToastController::GetCurrentToastId() const { @@ -75,6 +92,7 @@ bool ToastController::MaybeShowToast(ToastParams params) { if (!CanShowToast(params.toast_id)) { + RecordToastFailedToShow(params.toast_id); return false; } @@ -266,6 +284,10 @@ if (params.menu_model) { toast_view->AddMenu(std::move(params.menu_model)); + } else if (base::FeatureList::IsEnabled(toast_features::kToastRefinements) && + !spec->has_close_button()) { + toast_view->AddMenu( + std::make_unique<ToastDismissMenuModel>(params.toast_id)); } toast_view_ = toast_view.get();
diff --git a/chrome/browser/ui/toasts/toast_controller_interactive_ui_test.cc b/chrome/browser/ui/toasts/toast_controller_interactive_ui_test.cc index 9bbc23b..258708e 100644 --- a/chrome/browser/ui/toasts/toast_controller_interactive_ui_test.cc +++ b/chrome/browser/ui/toasts/toast_controller_interactive_ui_test.cc
@@ -11,6 +11,7 @@ #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "chrome/app/chrome_command_ids.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/browser_window.h" @@ -21,11 +22,14 @@ #include "chrome/browser/ui/omnibox/omnibox_tab_helper.h" #include "chrome/browser/ui/toasts/api/toast_id.h" #include "chrome/browser/ui/toasts/toast_controller.h" +#include "chrome/browser/ui/toasts/toast_dismiss_menu_model.h" #include "chrome/browser/ui/toasts/toast_features.h" +#include "chrome/browser/ui/toasts/toast_metrics.h" #include "chrome/browser/ui/toasts/toast_view.h" #include "chrome/browser/ui/views/frame/app_menu_button.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/star_view.h" +#include "chrome/common/pref_names.h" #include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/ui_test_utils.h" #include "chrome/test/interaction/interactive_browser_test.h" @@ -112,8 +116,9 @@ public: void SetUp() override { feature_list_.InitWithFeatures( - {toast_features::kToastFramework, toast_features::kLinkCopiedToast, - toast_features::kImageCopiedToast, toast_features::kReadingListToast, + {toast_features::kToastFramework, toast_features::kToastRefinements, + toast_features::kLinkCopiedToast, toast_features::kImageCopiedToast, + toast_features::kReadingListToast, plus_addresses::features::kPlusAddressesEnabled, plus_addresses::features::kPlusAddressFullFormFill}, {}); @@ -375,6 +380,33 @@ } IN_PROC_BROWSER_TEST_F(ToastControllerInteractiveTest, + DismissingToastPermanently) { + RunTestSequence( + ShowToast(ToastParams(ToastId::kLinkCopied)), + WaitForShow(toasts::ToastView::kToastViewId), + EnsurePresent(toasts::ToastView::kToastMenuButton), + PressButton(toasts::ToastView::kToastMenuButton), + WaitForShow(ToastDismissMenuModel::kToastDontShowAgainMenuItem), + SelectMenuItem(ToastDismissMenuModel::kToastDontShowAgainMenuItem), + WaitForHide(toasts::ToastView::kToastViewId), + ShowToast(ToastParams(ToastId::kLinkCopied)), + EnsureNotPresent(toasts::ToastView::kToastViewId)); +} + +IN_PROC_BROWSER_TEST_F(ToastControllerInteractiveTest, + DismissingToastTemporarily) { + RunTestSequence(ShowToast(ToastParams(ToastId::kLinkCopied)), + WaitForShow(toasts::ToastView::kToastViewId), + EnsurePresent(toasts::ToastView::kToastMenuButton), + PressButton(toasts::ToastView::kToastMenuButton), + WaitForShow(ToastDismissMenuModel::kToastDismissMenuItem), + SelectMenuItem(ToastDismissMenuModel::kToastDismissMenuItem), + WaitForHide(toasts::ToastView::kToastViewId), + ShowToast(ToastParams(ToastId::kLinkCopied)), + WaitForShow(toasts::ToastView::kToastViewId)); +} + +IN_PROC_BROWSER_TEST_F(ToastControllerInteractiveTest, ToastReactToOmniboxFocus) { LocationBar* const location_bar = browser()->window()->GetLocationBar(); ASSERT_TRUE(location_bar);
diff --git a/chrome/browser/ui/toasts/toast_controller_unittest.cc b/chrome/browser/ui/toasts/toast_controller_unittest.cc index 5c0511ab..19502e74 100644 --- a/chrome/browser/ui/toasts/toast_controller_unittest.cc +++ b/chrome/browser/ui/toasts/toast_controller_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/time/time.h" @@ -13,7 +14,12 @@ #include "chrome/browser/ui/toasts/api/toast_registry.h" #include "chrome/browser/ui/toasts/api/toast_specification.h" #include "chrome/browser/ui/toasts/toast_features.h" +#include "chrome/browser/ui/toasts/toast_metrics.h" #include "chrome/browser/ui/toasts/toast_view.h" +#include "chrome/common/pref_names.h" +#include "chrome/test/base/scoped_testing_local_state.h" +#include "chrome/test/base/testing_browser_process.h" +#include "components/prefs/pref_service.h" #include "components/vector_icons/vector_icons.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -170,3 +176,46 @@ task_environment().FastForwardBy(toast_features::kToastTimeout.Get() / 2); EXPECT_TRUE(controller->IsShowingToast()); } + +class ToastControllerWithRefinementsUnitTest : public testing::Test { + public: + void SetUp() override { + feature_list_.InitAndEnableFeatureWithParameters( + toast_features::kToastRefinements, {}); + toast_registry_ = std::make_unique<ToastRegistry>(); + } + + ToastRegistry* toast_registry() { return toast_registry_.get(); } + TestingPrefServiceSimple* local_state() { return local_state_.Get(); } + base::HistogramTester* histogram() { return &histogram_; } + + private: + base::test::ScopedFeatureList feature_list_; + base::test::SingleThreadTaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + std::unique_ptr<ToastRegistry> toast_registry_; + base::HistogramTester histogram_; + ScopedTestingLocalState local_state_{TestingBrowserProcess::GetGlobal()}; +}; + +TEST_F(ToastControllerWithRefinementsUnitTest, DoesNotShowToastWhenDisabled) { + ToastRegistry* const registry = toast_registry(); + registry->RegisterToast( + ToastId::kLinkCopied, + ToastSpecification::Builder(vector_icons::kEmailIcon, 0).Build()); + + auto controller = std::make_unique<TestToastController>(registry); + + local_state()->SetInteger( + prefs::kToastAlertLevel, + static_cast<int>(toasts::ToastAlertLevel::kActionable)); + EXPECT_FALSE(controller->CanShowToast(ToastId::kLinkCopied)); + EXPECT_FALSE(controller->MaybeShowToast(ToastParams(ToastId::kLinkCopied))); + + histogram()->ExpectBucketCount("Toast.FailedToShow", ToastId::kLinkCopied, 1); + + local_state()->SetInteger(prefs::kToastAlertLevel, + static_cast<int>(toasts::ToastAlertLevel::kAll)); + EXPECT_TRUE(controller->CanShowToast(ToastId::kLinkCopied)); + EXPECT_TRUE(controller->MaybeShowToast(ToastParams(ToastId::kLinkCopied))); +}
diff --git a/chrome/browser/ui/toasts/toast_dismiss_menu_model.cc b/chrome/browser/ui/toasts/toast_dismiss_menu_model.cc new file mode 100644 index 0000000..ebea2b42 --- /dev/null +++ b/chrome/browser/ui/toasts/toast_dismiss_menu_model.cc
@@ -0,0 +1,49 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/toasts/toast_dismiss_menu_model.h" + +#include "base/notreached.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/ui/toasts/toast_metrics.h" +#include "chrome/common/pref_names.h" +#include "chrome/grit/generated_resources.h" +#include "components/prefs/pref_service.h" +#include "ui/base/interaction/element_identifier.h" +#include "ui/base/l10n/l10n_util.h" + +DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(ToastDismissMenuModel, + kToastDismissMenuItem); +DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(ToastDismissMenuModel, + kToastDontShowAgainMenuItem); + +ToastDismissMenuModel::ToastDismissMenuModel(ToastId toast_id) + : ui::SimpleMenuModel(/*delegate=*/this), toast_id_(toast_id) { + AddItem(static_cast<int>(toasts::ToastDismissMenuEntries::kDismiss), + l10n_util::GetStringUTF16(IDS_TOAST_MENU_ITEM_DISMISS)); + SetElementIdentifierAt(0, kToastDismissMenuItem); + AddItem(static_cast<int>(toasts::ToastDismissMenuEntries::kDontShowAgain), + l10n_util::GetStringUTF16(IDS_TOAST_MENU_ITEM_DONT_SHOW_AGAIN)); + SetElementIdentifierAt(1, kToastDontShowAgainMenuItem); +} + +ToastDismissMenuModel::~ToastDismissMenuModel() = default; + +void ToastDismissMenuModel::ExecuteCommand(int command_id, int event_flags) { + const toasts::ToastDismissMenuEntries command = + static_cast<toasts::ToastDismissMenuEntries>(command_id); + RecordToastDismissMenuClicked(toast_id_, command); + + switch (command) { + case toasts::ToastDismissMenuEntries::kDismiss: + // Toast will dismiss automatically when a menu item is clicked. + return; + case toasts::ToastDismissMenuEntries::kDontShowAgain: + g_browser_process->local_state()->SetInteger( + prefs::kToastAlertLevel, + static_cast<int>(toasts::ToastAlertLevel::kActionable)); + return; + } + NOTREACHED(); +}
diff --git a/chrome/browser/ui/toasts/toast_dismiss_menu_model.h b/chrome/browser/ui/toasts/toast_dismiss_menu_model.h new file mode 100644 index 0000000..b8fe585 --- /dev/null +++ b/chrome/browser/ui/toasts/toast_dismiss_menu_model.h
@@ -0,0 +1,28 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_TOASTS_TOAST_DISMISS_MENU_MODEL_H_ +#define CHROME_BROWSER_UI_TOASTS_TOAST_DISMISS_MENU_MODEL_H_ + +#include "chrome/browser/ui/toasts/api/toast_id.h" +#include "ui/base/interaction/element_identifier.h" +#include "ui/menus/simple_menu_model.h" + +class ToastDismissMenuModel : public ui::SimpleMenuModel, + public ui::SimpleMenuModel::Delegate { + public: + DECLARE_CLASS_ELEMENT_IDENTIFIER_VALUE(kToastDismissMenuItem); + DECLARE_CLASS_ELEMENT_IDENTIFIER_VALUE(kToastDontShowAgainMenuItem); + + explicit ToastDismissMenuModel(ToastId toast_id); + ~ToastDismissMenuModel() override; + + // ui::SimpleMenuModel::Delegate: + void ExecuteCommand(int command_id, int event_flags) override; + + private: + const ToastId toast_id_; +}; + +#endif // CHROME_BROWSER_UI_TOASTS_TOAST_DISMISS_MENU_MODEL_H_
diff --git a/chrome/browser/ui/toasts/toast_features.cc b/chrome/browser/ui/toasts/toast_features.cc index bff63b4c..acb5e97 100644 --- a/chrome/browser/ui/toasts/toast_features.cc +++ b/chrome/browser/ui/toasts/toast_features.cc
@@ -16,6 +16,12 @@ "ToastFramework", base::FEATURE_ENABLED_BY_DEFAULT); +// Enables refinements of the toast framework that allow for controlling the +// visibility of non-actionable toasts. +BASE_FEATURE(kToastRefinements, + "ToastRefinements", + base::FEATURE_DISABLED_BY_DEFAULT); + const base::FeatureParam<bool> kToastDemoMode{&kToastFramework, "toast_demo_mode", false};
diff --git a/chrome/browser/ui/toasts/toast_features.h b/chrome/browser/ui/toasts/toast_features.h index 628d382..5902d1b 100644 --- a/chrome/browser/ui/toasts/toast_features.h +++ b/chrome/browser/ui/toasts/toast_features.h
@@ -14,6 +14,8 @@ // Base feature BASE_DECLARE_FEATURE(kToastFramework); +BASE_DECLARE_FEATURE(kToastRefinements); + // Enables all toast features queried through `toast_features::IsEnabled` which // is used for demo mode. extern const base::FeatureParam<bool> kToastDemoMode;
diff --git a/chrome/browser/ui/toasts/toast_metrics.cc b/chrome/browser/ui/toasts/toast_metrics.cc index 88fe034..af5b23efd0 100644 --- a/chrome/browser/ui/toasts/toast_metrics.cc +++ b/chrome/browser/ui/toasts/toast_metrics.cc
@@ -14,6 +14,10 @@ base::UmaHistogramEnumeration("Toast.TriggeredToShow", toast_id); } +void RecordToastFailedToShow(ToastId toast_id) { + base::UmaHistogramEnumeration("Toast.FailedToShow", toast_id); +} + void RecordToastActionButtonClicked(ToastId toast_id) { base::RecordComputedAction( base::StrCat({"Toast.ActionButtonClicked.", GetToastName(toast_id)})); @@ -30,3 +34,10 @@ base::StrCat({"Toast.", GetToastName(toast_id), ".Dismissed"}), close_reason); } + +void RecordToastDismissMenuClicked(ToastId toast_id, + toasts::ToastDismissMenuEntries command_id) { + base::UmaHistogramEnumeration( + base::StrCat({"Toast.", GetToastName(toast_id), ".DismissMenuClicked"}), + command_id); +}
diff --git a/chrome/browser/ui/toasts/toast_metrics.h b/chrome/browser/ui/toasts/toast_metrics.h index a2a151a2..b3bef94 100644 --- a/chrome/browser/ui/toasts/toast_metrics.h +++ b/chrome/browser/ui/toasts/toast_metrics.h
@@ -9,10 +9,30 @@ namespace toasts { enum class ToastCloseReason; -} + +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. +enum class ToastAlertLevel { + kAll = 0, + kActionable = 1, + kMaxValue = kActionable +}; + +// LINT.IfChange(ToastDismissMenuEntries) +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. +enum class ToastDismissMenuEntries { + kDismiss = 0, + kDontShowAgain = 1, + kMaxValue = kDontShowAgain +}; +// LINT.ThenChange(/tools/metrics/histograms/metadata/toasts/enums.xml:ToastDismissMenuEntries) +} // namespace toasts void RecordToastTriggeredToShow(ToastId toast_id); +void RecordToastFailedToShow(ToastId toast_id); + void RecordToastActionButtonClicked(ToastId toast_id); void RecordToastCloseButtonClicked(ToastId toast_id); @@ -20,4 +40,7 @@ void RecordToastDismissReason(ToastId toast_id, toasts::ToastCloseReason close_reason); +void RecordToastDismissMenuClicked(ToastId toast_id, + toasts::ToastDismissMenuEntries command_id); + #endif // CHROME_BROWSER_UI_TOASTS_TOAST_METRICS_H_
diff --git a/chrome/browser/ui/views/autofill/autofill_ai/save_autofill_ai_data_bubble_view.cc b/chrome/browser/ui/views/autofill/autofill_ai/save_autofill_ai_data_bubble_view.cc index e7feaf07..a84bf7e 100644 --- a/chrome/browser/ui/views/autofill/autofill_ai/save_autofill_ai_data_bubble_view.cc +++ b/chrome/browser/ui/views/autofill/autofill_ai/save_autofill_ai_data_bubble_view.cc
@@ -221,7 +221,7 @@ .SetCrossAxisAlignment(views::LayoutAlignment::kStart) .Build()); - for (const optimization_guide::proto::UserAnnotationsEntry& + for (const optimization_guide::proto::features::UserAnnotationsEntry& prediction_improvement : controller_->GetAutofillAiData()) { improved_predicted_values_container->AddChildView(BuildPredictedValueRow( prediction_improvement.key(), prediction_improvement.value()));
diff --git a/chrome/browser/ui/views/autofill/autofill_ai/save_autofill_ai_data_bubble_view_unittest.cc b/chrome/browser/ui/views/autofill/autofill_ai/save_autofill_ai_data_bubble_view_unittest.cc index 9c3238f3..74efc6e 100644 --- a/chrome/browser/ui/views/autofill/autofill_ai/save_autofill_ai_data_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/autofill/autofill_ai/save_autofill_ai_data_bubble_view_unittest.cc
@@ -32,16 +32,16 @@ MOCK_METHOD( void, OfferSave, - (std::vector<optimization_guide::proto::UserAnnotationsEntry>, + (std::vector<optimization_guide::proto::features::UserAnnotationsEntry>, user_annotations::PromptAcceptanceCallback PromptAcceptanceCallback, LearnMoreClickedCallback, UserFeedbackCallback), (override)); - MOCK_METHOD( - const std::vector<optimization_guide::proto::UserAnnotationsEntry>&, - GetAutofillAiData, - (), - (const override)); + MOCK_METHOD(const std::vector< + optimization_guide::proto::features::UserAnnotationsEntry>&, + GetAutofillAiData, + (), + (const override)); MOCK_METHOD(void, OnSaveButtonClicked, (), (override)); MOCK_METHOD(void, OnThumbsUpClicked, (), (override)); MOCK_METHOD(void, OnThumbsDownClicked, (), (override)); @@ -108,7 +108,8 @@ ON_CALL(mock_controller(), GetAutofillAiData()) .WillByDefault(testing::ReturnRefOfCopy( - std::vector<optimization_guide::proto::UserAnnotationsEntry>())); + std::vector< + optimization_guide::proto::features::UserAnnotationsEntry>())); auto view_unique = std::make_unique<SaveAutofillAiDataBubbleView>( anchor_widget_->GetContentsView(), web_contents_.get(),
diff --git a/chrome/browser/ui/views/autofill/payments/save_card_offer_bubble_views.cc b/chrome/browser/ui/views/autofill/payments/save_card_offer_bubble_views.cc index 46bc8c8..03f0aa2 100644 --- a/chrome/browser/ui/views/autofill/payments/save_card_offer_bubble_views.cc +++ b/chrome/browser/ui/views/autofill/payments/save_card_offer_bubble_views.cc
@@ -61,36 +61,6 @@ namespace autofill { -namespace { - -int GetLightModeBannerIdForSaveCard() { - switch (autofill::GetUpdatedDesktopUiTreatmentArm()) { - case autofill::UpdatedDesktopUiTreatmentArm::kSecurityFocus: - return IDR_SAVE_CARD_SECURITY; - case autofill::UpdatedDesktopUiTreatmentArm::kConvenienceFocus: - return IDR_SAVE_CARD_CONVENIENCE; - case autofill::UpdatedDesktopUiTreatmentArm::kEducationFocus: - return IDR_SAVE_CARD_EDUCATION; - case autofill::UpdatedDesktopUiTreatmentArm::kDefault: - return IDR_SAVE_CARD; - } -} - -int GetDarkModeBannerIdForSaveCard() { - switch (autofill::GetUpdatedDesktopUiTreatmentArm()) { - case autofill::UpdatedDesktopUiTreatmentArm::kSecurityFocus: - return IDR_SAVE_CARD_SECURITY_DARK; - case autofill::UpdatedDesktopUiTreatmentArm::kConvenienceFocus: - return IDR_SAVE_CARD_CONVENIENCE_DARK; - case autofill::UpdatedDesktopUiTreatmentArm::kEducationFocus: - return IDR_SAVE_CARD_EDUCATION_DARK; - case autofill::UpdatedDesktopUiTreatmentArm::kDefault: - return IDR_SAVE_CARD_DARK; - } -} - -} // namespace - SaveCardOfferBubbleViews::SaveCardOfferBubbleViews( views::View* anchor_view, content::WebContents* web_contents, @@ -203,8 +173,8 @@ case BubbleType::UPLOAD_IN_PROGRESS: case BubbleType::UPLOAD_COMPLETED: // Updated banner/text pairs are for upload save only. - light_mode_banner_id = GetLightModeBannerIdForSaveCard(); - dark_mode_banner_id = GetDarkModeBannerIdForSaveCard(); + light_mode_banner_id = IDR_SAVE_CARD_SECURITY; + dark_mode_banner_id = IDR_SAVE_CARD_SECURITY_DARK; break; case BubbleType::LOCAL_CVC_SAVE: case BubbleType::UPLOAD_CVC_SAVE:
diff --git a/chrome/browser/ui/views/compose/compose_interactive_uitest.cc b/chrome/browser/ui/views/compose/compose_interactive_uitest.cc index cc47f093..d6d41a0e 100644 --- a/chrome/browser/ui/views/compose/compose_interactive_uitest.cc +++ b/chrome/browser/ui/views/compose/compose_interactive_uitest.cc
@@ -262,7 +262,8 @@ } optimization_guide::StreamingResponse OptimizationGuideResponse( - const optimization_guide::proto::ComposeResponse compose_response, + const optimization_guide::proto::features::ComposeResponse + compose_response, bool is_complete = true) { return optimization_guide::StreamingResponse{ .response = optimization_guide::AnyWrapProto(compose_response), @@ -272,7 +273,8 @@ optimization_guide::OptimizationGuideModelStreamingExecutionResult OptimizationGuideStreamingResult( - const optimization_guide::proto::ComposeResponse compose_response, + const optimization_guide::proto::features::ComposeResponse + compose_response, bool is_complete = true, bool provided_by_on_device = false, std::unique_ptr<optimization_guide::ModelQualityLogEntry> log_entry = @@ -282,10 +284,10 @@ provided_by_on_device, std::move(log_entry)); } - optimization_guide::proto::ComposeResponse ComposeResponse( + optimization_guide::proto::features::ComposeResponse ComposeResponse( bool ok, std::string output) { - optimization_guide::proto::ComposeResponse response; + optimization_guide::proto::features::ComposeResponse response; response.set_output(ok ? output : ""); return response; }
diff --git a/chrome/browser/ui/views/extensions/dialogs/upload_extension_to_account_dialog.cc b/chrome/browser/ui/views/extensions/dialogs/upload_extension_to_account_dialog.cc new file mode 100644 index 0000000..fc0798e2 --- /dev/null +++ b/chrome/browser/ui/views/extensions/dialogs/upload_extension_to_account_dialog.cc
@@ -0,0 +1,82 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/functional/callback_helpers.h" +#include "chrome/browser/extensions/account_extension_tracker.h" +#include "chrome/browser/extensions/extension_util.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_avatar_icon_util.h" +#include "chrome/browser/signin/identity_manager_factory.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_dialogs.h" +#include "chrome/browser/ui/views/chrome_layout_provider.h" +#include "chrome/browser/ui/views/extensions/extensions_dialogs_utils.h" +#include "chrome/grit/generated_resources.h" +#include "components/signin/public/base/consent_level.h" +#include "components/signin/public/identity_manager/account_info.h" +#include "components/signin/public/identity_manager/identity_manager.h" +#include "components/sync/base/features.h" +#include "extensions/common/extension.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/views/layout/layout_provider.h" + +namespace extensions { + +void ShowUploadExtensionToAccountDialog(Browser* browser, + const Extension& extension, + base::OnceClosure accept_callback, + base::OnceClosure cancel_callback) { + CHECK(base::FeatureList::IsEnabled( + syncer::kSyncEnableExtensionsInTransportMode)); + CHECK(AccountExtensionTracker::Get(browser->profile()) + ->CanUploadAsAccountExtension(extension)); + + auto split_cancel_callback = + base::SplitOnceCallback(std::move(cancel_callback)); + + ui::DialogModel::Builder builder; + builder.SetInternalName("UploadExtensionToAccountDialog") + .SetTitle(l10n_util::GetStringUTF16( + IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_TITLE)) + .OverrideShowCloseButton(false) + .SetSubtitle(l10n_util::GetStringFUTF16( + IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_SUBTITLE, + util::GetFixupExtensionNameForUIDisplay(extension.name()))) + .AddOkButton( + std::move(accept_callback), + ui::DialogModel::Button::Params().SetLabel(l10n_util::GetStringUTF16( + IDS_EXTENSIONS_MOVE_TO_ACCOUNT_DIALOG_OK_BUTTON_LABEL))) + .AddCancelButton(std::move(split_cancel_callback.first)) + .SetCloseActionCallback(std::move(split_cancel_callback.second)); + + // Show the avatar and email of the signed-in account as a custom view + // between the dialog's subtitle and buttons. + signin::IdentityManager* identity_manager = + IdentityManagerFactory::GetForProfile( + browser->profile()->GetOriginalProfile()); + AccountInfo account_info = identity_manager->FindExtendedAccountInfo( + identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSignin)); + CHECK(!account_info.IsEmpty()); + + auto avatar_and_email_view = std::make_unique<views::View>(); + avatar_and_email_view->AddChildView(std::make_unique<views::ImageView>( + ui::ImageModel::FromImage(profiles::GetSizedAvatarIcon( + account_info.account_image, 16, 16, profiles::SHAPE_CIRCLE)))); + avatar_and_email_view->AddChildView( + std::make_unique<views::Label>(base::UTF8ToUTF16(account_info.email))); + int horizontal_spacing = ChromeLayoutProvider::Get()->GetDistanceMetric( + views::DISTANCE_RELATED_LABEL_HORIZONTAL); + avatar_and_email_view->SetLayoutManager(std::make_unique<views::BoxLayout>()) + ->set_between_child_spacing(horizontal_spacing); + builder.AddCustomField( + std::make_unique<views::BubbleDialogModelHost::CustomView>( + std::move(avatar_and_email_view), + views::BubbleDialogModelHost::FieldType::kControl)); + + // Show a browser modal instead of one attached to the extensions icon to be + // consistent with upload dialogs for other syncable types (e.g. bookmarks). + chrome::ShowBrowserModal(browser, builder.Build()); +} + +} // namespace extensions
diff --git a/chrome/browser/ui/views/extensions/dialogs/upload_extension_to_account_dialog_browsertest.cc b/chrome/browser/ui/views/extensions/dialogs/upload_extension_to_account_dialog_browsertest.cc new file mode 100644 index 0000000..29737eb6 --- /dev/null +++ b/chrome/browser/ui/views/extensions/dialogs/upload_extension_to_account_dialog_browsertest.cc
@@ -0,0 +1,106 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/functional/callback_helpers.h" +#include "base/test/scoped_feature_list.h" +#include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/identity_manager_factory.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/extensions/extensions_dialogs.h" +#include "chrome/browser/ui/views/extensions/extensions_dialogs_browsertest.h" +#include "components/signin/public/base/signin_pref_names.h" +#include "components/signin/public/identity_manager/identity_manager.h" +#include "components/signin/public/identity_manager/identity_test_utils.h" +#include "components/sync/base/features.h" +#include "content/public/test/browser_test.h" +#include "extensions/browser/extension_system.h" +#include "extensions/common/extension.h" +#include "extensions/common/extension_builder.h" +#include "extensions/common/mojom/manifest.mojom.h" +#include "ui/gfx/image/image_unittest_util.h" + +namespace extensions { + +namespace { + +// Signs a user in to the provided `profile`. This also provides a profile icon. +void SignIn(Profile* profile) { + signin::IdentityManager* identity_manager = + IdentityManagerFactory::GetForProfile(profile); + AccountInfo account_info = signin::MakePrimaryAccountAvailable( + identity_manager, "testymctestface@gmail.com", + signin::ConsentLevel::kSignin); + signin::SimulateAccountImageFetch(identity_manager, account_info.account_id, + "https://avatar.com/avatar.png", + gfx::test::CreateImage(/*size=*/32)); + // Pretend the user has now explcitly signed in. All this is required for + // extensions to sync in transport mode. + profile->GetPrefs()->SetBoolean(prefs::kExplicitBrowserSignin, true); +} + +} // namespace + +class UploadExtensionToAccountDialogBrowserTest + : public ExtensionsDialogBrowserTest { + public: + UploadExtensionToAccountDialogBrowserTest() { + scoped_feature_list_.InitAndEnableFeature( + syncer::kSyncEnableExtensionsInTransportMode); + } + ~UploadExtensionToAccountDialogBrowserTest() override = default; + UploadExtensionToAccountDialogBrowserTest( + const UploadExtensionToAccountDialogBrowserTest&) = delete; + UploadExtensionToAccountDialogBrowserTest& operator=( + const UploadExtensionToAccountDialogBrowserTest&) = delete; + + // DialogBrowserTest: + void ShowUi(const std::string& name) override { + // Add an extension that can be uploaded. This means that it would be + // syncable and is a local extension (i.e. not installed while a user is + // signed in, therefore not associated with any signed in user). + scoped_refptr<const Extension> extension; + + std::string extension_name; + if (name == "NormalExtension") { + extension_name = "My Extension"; + } else if (name == "LongNameExtension") { + extension_name = + "This extension has a really long name that should probably be " + "truncated like seriously who thought this was a good idea?"; + } + + extension = ExtensionBuilder(extension_name) + .SetLocation(mojom::ManifestLocation::kInternal) + .Build(); + + ASSERT_TRUE(extension); + ExtensionSystem::Get(browser()->profile()) + ->extension_service() + ->AddExtension(extension.get()); + + // Sign in AFTER the extension has been added so there is an active account + // for extensions to be uploaded to. + SignIn(browser()->profile()); + + ShowUploadExtensionToAccountDialog(browser(), *extension, + /*accept_callback=*/base::DoNothing(), + /*cancel_callback=*/base::DoNothing()); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +IN_PROC_BROWSER_TEST_F(UploadExtensionToAccountDialogBrowserTest, + InvokeUi_NormalExtension) { + ShowAndVerifyUi(); +} + +IN_PROC_BROWSER_TEST_F(UploadExtensionToAccountDialogBrowserTest, + InvokeUi_LongNameExtension) { + ShowAndVerifyUi(); +} + +} // namespace extensions
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.cc b/chrome/browser/ui/views/frame/tab_strip_region_view.cc index d8b74770..ebb0dd9 100644 --- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc +++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -22,6 +22,7 @@ #include "chrome/browser/ui/views/tab_search_bubble_host.h" #include "chrome/browser/ui/views/tabs/new_tab_button.h" #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" +#include "chrome/browser/ui/views/tabs/tab_glic_container.h" #include "chrome/browser/ui/views/tabs/tab_search_button.h" #include "chrome/browser/ui/views/tabs/tab_search_container.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" @@ -125,6 +126,7 @@ // Add and configure the TabSearchContainer, TabStripComboButton, and // ProductSpecificationsButton. std::unique_ptr<TabSearchContainer> tab_search_container; + std::unique_ptr<TabGlicContainer> tab_glic_container; std::unique_ptr<TabStripComboButton> tab_strip_combo_button; std::unique_ptr<ProductSpecificationsButton> product_specifications_button; #if BUILDFLAG(ENABLE_GLIC) @@ -155,18 +157,30 @@ product_specifications_button->SetProperty( views::kCrossAxisAlignmentKey, views::LayoutAlignment::kCenter); } - -#if BUILDFLAG(ENABLE_GLIC) - if (GlicEnabling::IsEnabledByFlags()) { - glic_button = - std::make_unique<glic::GlicButton>(tab_strip_->controller()); - glic_button->SetProperty(views::kCrossAxisAlignmentKey, - views::LayoutAlignment::kCenter); - glic_button->SetProperty( + if (features::IsTabstripComboButtonEnabled()) { + tab_glic_container = + std::make_unique<TabGlicContainer>(tab_strip_->controller()); + tab_glic_container->SetProperty(views::kCrossAxisAlignmentKey, + views::LayoutAlignment::kCenter); + tab_glic_container->SetProperty( views::kMarginsKey, gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_STRIP_PADDING))); - } + + tab_glic_container_ = AddChildView(std::move(tab_glic_container)); + + } else { +#if BUILDFLAG(ENABLE_GLIC) + if (GlicEnabling::IsEnabledByFlags()) { + glic_button = + std::make_unique<glic::GlicButton>(tab_strip_->controller()); + glic_button->SetProperty(views::kCrossAxisAlignmentKey, + views::LayoutAlignment::kCenter); + glic_button->SetProperty( + views::kMarginsKey, + gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_STRIP_PADDING))); + } #endif // BUILDFLAG(ENABLE_GLIC) + } } if (tab_search_container && render_tab_search_before_tab_strip_) { @@ -400,6 +414,9 @@ children.emplace_back(product_specifications_button_.get()); } + if (tab_glic_container_) { + children.emplace_back(tab_glic_container_.get()); + } #if BUILDFLAG(ENABLE_GLIC) if (glic_button_) { children.emplace_back(glic_button_.get());
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.h b/chrome/browser/ui/views/frame/tab_strip_region_view.h index ffacee03..c2df9e1 100644 --- a/chrome/browser/ui/views/frame/tab_strip_region_view.h +++ b/chrome/browser/ui/views/frame/tab_strip_region_view.h
@@ -19,6 +19,7 @@ class Button; } class NewTabButton; +class TabGlicContainer; class TabSearchButton; class TabStrip; class TabStripComboButton; @@ -147,6 +148,7 @@ raw_ptr<TabStripScrollContainer> tab_strip_scroll_container_ = nullptr; raw_ptr<views::Button> new_tab_button_ = nullptr; raw_ptr<TabSearchContainer> tab_search_container_ = nullptr; + raw_ptr<TabGlicContainer> tab_glic_container_ = nullptr; raw_ptr<TabStripComboButton> tab_strip_combo_button_ = nullptr; raw_ptr<ProductSpecificationsButton> product_specifications_button_ = nullptr; raw_ptr<glic::GlicButton> glic_button_ = nullptr;
diff --git a/chrome/browser/ui/views/glic/glic_view.cc b/chrome/browser/ui/views/glic/glic_view.cc index 781ba5e..36fa299 100644 --- a/chrome/browser/ui/views/glic/glic_view.cc +++ b/chrome/browser/ui/views/glic/glic_view.cc
@@ -25,8 +25,6 @@ GlicView::GlicView(Profile* profile, const gfx::Size& initial_size) { profile_keep_alive_ = std::make_unique<ScopedProfileKeepAlive>( profile, ProfileKeepAliveOrigin::kGlicView); - keep_alive_ = std::make_unique<ScopedKeepAlive>( - KeepAliveOrigin::GLIC_VIEW, KeepAliveRestartOption::ENABLED); auto web_view = std::make_unique<GlicWebView>(profile); web_view_ = web_view.get(); web_view->SetSize(initial_size);
diff --git a/chrome/browser/ui/views/glic/glic_view.h b/chrome/browser/ui/views/glic/glic_view.h index 989baf0..6a1d9914 100644 --- a/chrome/browser/ui/views/glic/glic_view.h +++ b/chrome/browser/ui/views/glic/glic_view.h
@@ -7,8 +7,6 @@ #include "chrome/browser/profiles/keep_alive/scoped_profile_keep_alive.h" #include "chrome/browser/ui/views/glic/glic_web_view.h" -#include "components/keep_alive_registry/keep_alive_types.h" -#include "components/keep_alive_registry/scoped_keep_alive.h" #include "ui/gfx/geometry/size.h" #include "ui/views/view.h" #include "ui/views/widget/unique_widget_ptr.h" @@ -44,9 +42,8 @@ raw_ptr<GlicWebView> web_view_; // Ensures that the profile associated with this view isn't destroyed while - // it is visible, and nor is the browser process. + // it is visible. std::unique_ptr<ScopedProfileKeepAlive> profile_keep_alive_; - std::unique_ptr<ScopedKeepAlive> keep_alive_; }; } // namespace glic
diff --git a/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view_browsertest.cc b/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view_browsertest.cc index 3c202a29..bbe52b2 100644 --- a/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view_browsertest.cc
@@ -165,12 +165,6 @@ {privacy_sandbox::kFingerprintingProtectionUserBypass}, {}); } - ContentSetting GetTrackingProtectionSetting() { - return host_content_settings_map()->GetContentSetting( - GURL(), third_party_cookie_page_url(), - ContentSettingsType::TRACKING_PROTECTION); - } - private: base::test::ScopedFeatureList feature_list_; std::unique_ptr<net::EmbeddedTestServer> https_server_; @@ -178,12 +172,17 @@ IN_PROC_BROWSER_TEST_F(TrackingProtectionBubbleViewBrowserTest, ToggleCreatesTrackingProtectionException) { + auto* tracking_protection_settings = + TrackingProtectionSettingsFactory::GetForProfile(browser()->profile()); ShowBubble(); - EXPECT_EQ(GetTrackingProtectionSetting(), CONTENT_SETTING_BLOCK); + EXPECT_FALSE(tracking_protection_settings->HasTrackingProtectionException( + third_party_cookie_page_url())); SimulateTogglePress(false); - EXPECT_EQ(GetTrackingProtectionSetting(), CONTENT_SETTING_ALLOW); + EXPECT_TRUE(tracking_protection_settings->HasTrackingProtectionException( + third_party_cookie_page_url())); SimulateTogglePress(true); - EXPECT_EQ(GetTrackingProtectionSetting(), CONTENT_SETTING_BLOCK); + EXPECT_FALSE(tracking_protection_settings->HasTrackingProtectionException( + third_party_cookie_page_url())); } IN_PROC_BROWSER_TEST_F(CookieControlsBubbleViewBrowserTest,
diff --git a/chrome/browser/ui/views/profiles/first_run_interactive_uitest.cc b/chrome/browser/ui/views/profiles/first_run_interactive_uitest.cc index a3c25cc..3186387f 100644 --- a/chrome/browser/ui/views/profiles/first_run_interactive_uitest.cc +++ b/chrome/browser/ui/views/profiles/first_run_interactive_uitest.cc
@@ -231,8 +231,7 @@ base::OnceCallback<void(bool)>()) { ASSERT_TRUE(fre_service()->ShouldOpenFirstRun()); - fre_service()->OpenFirstRunIfNeeded(FirstRunService::EntryPoint::kOther, - std::move(first_run_exited_callback)); + fre_service()->OpenFirstRunIfNeeded(std::move(first_run_exited_callback)); WaitForPickerWidgetCreated(); view()->SetProperty(views::kElementIdentifierKey, kProfilePickerViewId);
diff --git a/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.cc b/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.cc index efb83f19..81c94ee 100644 --- a/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.cc +++ b/chrome/browser/ui/views/site_data/page_specific_site_data_dialog.cc
@@ -400,8 +400,8 @@ if (base::FeatureList::IsEnabled( privacy_sandbox::kTrackingProtectionContentSettingFor3pcb)) { has_site_level_exception |= - tracking_protection_settings_->GetTrackingProtectionSetting( - current_url) == CONTENT_SETTING_ALLOW; + tracking_protection_settings_->HasTrackingProtectionException( + current_url); } // Partitioned access is displayed when all of these conditions are met:
diff --git a/chrome/browser/ui/views/tabs/tab_glic_container.cc b/chrome/browser/ui/views/tabs/tab_glic_container.cc new file mode 100644 index 0000000..c2f7460 --- /dev/null +++ b/chrome/browser/ui/views/tabs/tab_glic_container.cc
@@ -0,0 +1,42 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/views/tabs/tab_glic_container.h" + +#include <base/logging.h> + +#include "base/feature_list.h" +#include "build/build_config.h" +#include "chrome/browser/ui/layout_constants.h" +#include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/views/layout/flex_layout.h" +#include "ui/views/view_class_properties.h" + +#if BUILDFLAG(ENABLE_GLIC) +#include "chrome/browser/glic/glic_enabling.h" +#include "chrome/browser/ui/views/tabs/glic_button.h" +#endif // BUILDFLAG(ENABLE_GLIC) + +TabGlicContainer::TabGlicContainer(TabStripController* tab_strip_controller) { +#if BUILDFLAG(ENABLE_GLIC) + if (GlicEnabling::IsEnabledByFlags()) { + std::unique_ptr<glic::GlicButton> glic_button = + std::make_unique<glic::GlicButton>(tab_strip_controller); + glic_button->SetProperty(views::kCrossAxisAlignmentKey, + views::LayoutAlignment::kCenter); + glic_button->SetProperty( + views::kMarginsKey, + gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_STRIP_PADDING))); + + glic_button_ = AddChildView(std::move(glic_button)); + } +#endif // BUILDFLAG(ENABLE_GLIC) + + SetLayoutManager(std::make_unique<views::FlexLayout>()); +} + +TabGlicContainer::~TabGlicContainer() = default; + +BEGIN_METADATA(TabGlicContainer) +END_METADATA
diff --git a/chrome/browser/ui/views/tabs/tab_glic_container.h b/chrome/browser/ui/views/tabs/tab_glic_container.h new file mode 100644 index 0000000..8620c574 --- /dev/null +++ b/chrome/browser/ui/views/tabs/tab_glic_container.h
@@ -0,0 +1,34 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_GLIC_CONTAINER_H_ +#define CHROME_BROWSER_UI_VIEWS_TABS_TAB_GLIC_CONTAINER_H_ + +#include "chrome/browser/ui/views/tabs/tab_strip_controller.h" +#include "chrome/common/buildflags.h" +#include "ui/views/view.h" + +namespace glic { +class GlicButton; +} + +class TabGlicContainer : public views::View { + METADATA_HEADER(TabGlicContainer, views::View) + public: + explicit TabGlicContainer(TabStripController* tab_strip_controller); + TabGlicContainer(const TabGlicContainer&) = delete; + TabGlicContainer& operator=(const TabGlicContainer&) = delete; + ~TabGlicContainer() override; + +#if BUILDFLAG(ENABLE_GLIC) + glic::GlicButton* GetGlicButton() { return glic_button_; } +#endif // BUILDFLAG(ENABLE_GLIC) + + private: +#if BUILDFLAG(ENABLE_GLIC) + raw_ptr<glic::GlicButton, DanglingUntriaged> glic_button_ = nullptr; +#endif // BUILDFLAG(ENABLE_GLIC) +}; + +#endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_GLIC_CONTAINER_H_
diff --git a/chrome/browser/ui/views/tabs/tab_glic_container_unittest.cc b/chrome/browser/ui/views/tabs/tab_glic_container_unittest.cc new file mode 100644 index 0000000..ef554f7c --- /dev/null +++ b/chrome/browser/ui/views/tabs/tab_glic_container_unittest.cc
@@ -0,0 +1,61 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/views/tabs/tab_glic_container.h" + +#include <memory> + +#include "base/test/scoped_feature_list.h" +#include "chrome/browser/ui/views/frame/tab_strip_region_view.h" +#include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" +#include "chrome/common/chrome_features.h" +#include "chrome/test/views/chrome_views_test_base.h" +#include "ui/gfx/animation/animation_test_api.h" +#include "ui/views/test/views_test_utils.h" +#include "ui/views/widget/widget.h" + +class TabGlicContainerTest : public ChromeViewsTestBase { + public: + TabGlicContainerTest() + : animation_mode_reset_(gfx::AnimationTestApi::SetRichAnimationRenderMode( + gfx::Animation::RichAnimationRenderMode::FORCE_ENABLED)) {} + TabGlicContainerTest(const TabGlicContainerTest&) = delete; + TabGlicContainerTest& operator=(const TabGlicContainerTest&) = delete; + ~TabGlicContainerTest() override = default; + + void SetUp() override { + ChromeViewsTestBase::SetUp(); + scoped_feature_list_.InitWithFeatures( + {features::kGlic, features::kTabstripComboButton}, {}); + BuildGlicContainer(); + } + + void TearDown() override { + ChromeViewsTestBase::TearDown(); + tab_glic_container_.reset(); + } + void BuildGlicContainer() { + auto controller = std::make_unique<FakeBaseTabStripController>(); + controller_ = controller.get(); + tab_glic_container_ = std::make_unique<TabGlicContainer>( + std::unique_ptr<TabStripController>(controller.release()).get()); + } + + protected: + std::unique_ptr<TabGlicContainer> tab_glic_container_ = nullptr; + + private: + // Owned by TabStrip. + raw_ptr<FakeBaseTabStripController, DanglingUntriaged> controller_ = nullptr; + raw_ptr<TabStrip, DanglingUntriaged> tab_strip_ = nullptr; + std::unique_ptr<views::Widget> widget_; + base::test::ScopedFeatureList scoped_feature_list_; + gfx::AnimationTestApi::RenderModeResetter animation_mode_reset_; +}; + +#if BUILDFLAG(ENABLE_GLIC) +TEST_F(TabGlicContainerTest, GlicButtonDrawing) { + EXPECT_NE(tab_glic_container_->GetGlicButton(), nullptr); +} +#endif // BUILDFLAG(ENABLE_GLIC)
diff --git a/chrome/browser/ui/webui/ash/lobster/lobster_view.h b/chrome/browser/ui/webui/ash/lobster/lobster_view.h index 2a14838..f5abaa6e 100644 --- a/chrome/browser/ui/webui/ash/lobster/lobster_view.h +++ b/chrome/browser/ui/webui/ash/lobster/lobster_view.h
@@ -35,7 +35,6 @@ // screen coordinates. The bubble view will be positioned around this caret // bound. gfx::Rect caret_bounds_; - bool initial_bounds_set = false; }; } // namespace ash
diff --git a/chrome/browser/ui/webui/chrome_web_ui_configs.cc b/chrome/browser/ui/webui/chrome_web_ui_configs.cc index c3648143..ab5ef2f 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_configs.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_configs.cc
@@ -16,7 +16,7 @@ #include "chrome/browser/ui/webui/commerce/commerce_internals_ui_config.h" #include "chrome/browser/ui/webui/components/components_ui.h" #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" -#include "chrome/browser/ui/webui/crashes_ui.h" +#include "chrome/browser/ui/webui/crashes/crashes_ui.h" #include "chrome/browser/ui/webui/data_sharing_internals/data_sharing_internals_ui.h" #include "chrome/browser/ui/webui/device_log/device_log_ui.h" #include "chrome/browser/ui/webui/download_internals/download_internals_ui.h"
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 bd49f8de..7231a00 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -25,7 +25,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/about/about_ui.h" #include "chrome/browser/ui/webui/components/components_ui.h" -#include "chrome/browser/ui/webui/crashes_ui.h" +#include "chrome/browser/ui/webui/crashes/crashes_ui.h" #include "chrome/browser/ui/webui/download_internals/download_internals_ui.h" #include "chrome/browser/ui/webui/flags/flags_ui.h" #include "chrome/common/buildflags.h"
diff --git a/chrome/browser/ui/webui/cr_components/history_embeddings/history_embeddings_handler.cc b/chrome/browser/ui/webui/cr_components/history_embeddings/history_embeddings_handler.cc index ad8d2d8d..6caf18b 100644 --- a/chrome/browser/ui/webui/cr_components/history_embeddings/history_embeddings_handler.cc +++ b/chrome/browser/ui/webui/cr_components/history_embeddings/history_embeddings_handler.cc
@@ -31,16 +31,19 @@ namespace { -optimization_guide::proto::UserFeedback +optimization_guide::proto::features::UserFeedback OptimizationFeedbackFromMojoUserFeedback( history_embeddings::mojom::UserFeedback feedback) { switch (feedback) { case history_embeddings::mojom::UserFeedback::kUserFeedbackPositive: - return optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_UP; + return optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_UP; case history_embeddings::mojom::UserFeedback::kUserFeedbackNegative: - return optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN; + return optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN; case history_embeddings::mojom::UserFeedback::kUserFeedbackUnspecified: - return optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + return optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED; } } @@ -114,8 +117,8 @@ void HistoryEmbeddingsHandler::PublishResultToPage( const history_embeddings::SearchResult& native_search_result) { - user_feedback_ = - optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + user_feedback_ = optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED; auto mojom_search_result = history_embeddings::mojom::SearchResult::New(); mojom_search_result->query = native_search_result.query; @@ -188,9 +191,10 @@ selected_indices.end()); service->SendQualityLog( last_result_, indices_set, num_chars_for_query, user_feedback_, - for_side_panel_ - ? optimization_guide::proto::UiSurface::UI_SURFACE_SIDE_PANEL - : optimization_guide::proto::UiSurface::UI_SURFACE_HISTORY_PAGE); + for_side_panel_ ? optimization_guide::proto::features::UiSurface:: + UI_SURFACE_SIDE_PANEL + : optimization_guide::proto::features::UiSurface:: + UI_SURFACE_HISTORY_PAGE); } void HistoryEmbeddingsHandler::RecordSearchResultsMetrics(
diff --git a/chrome/browser/ui/webui/cr_components/history_embeddings/history_embeddings_handler.h b/chrome/browser/ui/webui/cr_components/history_embeddings/history_embeddings_handler.h index 84774b4b..7fa3bcc 100644 --- a/chrome/browser/ui/webui/cr_components/history_embeddings/history_embeddings_handler.h +++ b/chrome/browser/ui/webui/cr_components/history_embeddings/history_embeddings_handler.h
@@ -86,7 +86,7 @@ raw_ptr<content::WebUI> web_ui_; history_embeddings::SearchResult last_result_; - optimization_guide::proto::UserFeedback user_feedback_; + optimization_guide::proto::features::UserFeedback user_feedback_; base::WeakPtrFactory<HistoryEmbeddingsHandler> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ui/webui/crashes/OWNERS b/chrome/browser/ui/webui/crashes/OWNERS new file mode 100644 index 0000000..21fa106 --- /dev/null +++ b/chrome/browser/ui/webui/crashes/OWNERS
@@ -0,0 +1 @@ +file://components/crash/OWNERS
diff --git a/chrome/browser/ui/webui/crashes_ui.cc b/chrome/browser/ui/webui/crashes/crashes_ui.cc similarity index 91% rename from chrome/browser/ui/webui/crashes_ui.cc rename to chrome/browser/ui/webui/crashes/crashes_ui.cc index 22cb477c..63ac0cc 100644 --- a/chrome/browser/ui/webui/crashes_ui.cc +++ b/chrome/browser/ui/webui/crashes/crashes_ui.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/crashes_ui.h" +#include "chrome/browser/ui/webui/crashes/crashes_ui.h" #include <stddef.h> @@ -23,11 +23,13 @@ #include "chrome/browser/metrics/metrics_reporting_state.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/identity_manager_factory.h" +#include "chrome/browser/ui/webui/webui_util.h" #include "chrome/common/webui_url_constants.h" #include "chrome/grit/branded_strings.h" #include "components/crash/core/browser/crashes_ui_util.h" #include "components/grit/components_scaled_resources.h" -#include "components/grit/dev_ui_components_resources.h" +#include "components/grit/crashes_resources.h" +#include "components/grit/crashes_resources_map.h" #include "components/signin/public/base/consent_level.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "content/public/browser/web_contents.h" @@ -38,7 +40,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_scale_factor.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) #include "chromeos/ash/components/dbus/debug_daemon/debug_daemon_client.h" #endif @@ -62,14 +64,9 @@ source->AddLocalizedString(crash_reporter::kCrashesUIShortProductName, IDS_SHORT_PRODUCT_NAME); - source->UseStringsJs(); - source->AddResourcePath(crash_reporter::kCrashesUICrashesJS, - IDR_CRASH_CRASHES_JS); - source->AddResourcePath(crash_reporter::kCrashesUICrashesCSS, - IDR_CRASH_CRASHES_CSS); - source->AddResourcePath(crash_reporter::kCrashesUISadTabSVG, - IDR_CRASH_SADTAB_SVG); - source->SetDefaultResource(IDR_CRASH_CRASHES_HTML); + + webui::SetupWebUIDataSource(source, kCrashesResources, + IDR_CRASHES_CRASHES_HTML); } //////////////////////////////////////////////////////////////////////////////// @@ -98,7 +95,7 @@ // Asynchronously fetches the list of crashes. Called from JS. void HandleRequestCrashes(const base::Value::List& args); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) // Asynchronously triggers crash uploading. Called from JS. void HandleRequestUploads(const base::Value::List& args); #endif @@ -131,7 +128,7 @@ base::BindRepeating(&CrashesDOMHandler::HandleRequestCrashes, base::Unretained(this))); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) web_ui()->RegisterMessageCallback( crash_reporter::kCrashesUIRequestCrashUpload, base::BindRepeating(&CrashesDOMHandler::HandleRequestUploads, @@ -152,8 +149,9 @@ AllowJavascript(); if (first_load_) { first_load_ = false; - if (list_available_) + if (list_available_) { UpdateUI(); + } } else { list_available_ = false; upload_list_->Load(base::BindOnce(&CrashesDOMHandler::OnUploadListAvailable, @@ -161,7 +159,7 @@ } } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void CrashesDOMHandler::HandleRequestUploads(const base::Value::List& args) { ash::DebugDaemonClient* debugd_client = ash::DebugDaemonClient::Get(); DCHECK(debugd_client); @@ -176,8 +174,9 @@ void CrashesDOMHandler::OnUploadListAvailable() { list_available_ = true; - if (!first_load_) + if (!first_load_) { UpdateUI(); + } } void CrashesDOMHandler::UpdateUI() { @@ -213,8 +212,9 @@ bool upload_list = manual_uploads_supported || crash_reporting_enabled; base::Value::List crash_list; - if (upload_list) + if (upload_list) { crash_reporter::UploadListToValue(upload_list_.get(), &crash_list); + } base::Value::Dict result; result.Set("enabled", crash_reporting_enabled);
diff --git a/chrome/browser/ui/webui/crashes_ui.h b/chrome/browser/ui/webui/crashes/crashes_ui.h similarity index 85% rename from chrome/browser/ui/webui/crashes_ui.h rename to chrome/browser/ui/webui/crashes/crashes_ui.h index eed13de4..f5d7664 100644 --- a/chrome/browser/ui/webui/crashes_ui.h +++ b/chrome/browser/ui/webui/crashes/crashes_ui.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_WEBUI_CRASHES_UI_H_ -#define CHROME_BROWSER_UI_WEBUI_CRASHES_UI_H_ +#ifndef CHROME_BROWSER_UI_WEBUI_CRASHES_CRASHES_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_CRASHES_CRASHES_UI_H_ #include "chrome/common/webui_url_constants.h" #include "content/public/browser/web_ui_controller.h" @@ -35,4 +35,4 @@ ui::ResourceScaleFactor scale_factor); }; -#endif // CHROME_BROWSER_UI_WEBUI_CRASHES_UI_H_ +#endif // CHROME_BROWSER_UI_WEBUI_CRASHES_CRASHES_UI_H_
diff --git a/chrome/browser/ui/webui/glic/BUILD.gn b/chrome/browser/ui/webui/glic/BUILD.gn index 174e68f..90eaab3 100644 --- a/chrome/browser/ui/webui/glic/BUILD.gn +++ b/chrome/browser/ui/webui/glic/BUILD.gn
@@ -13,6 +13,7 @@ public_deps = [ "//mojo/public/mojom/base", + "//skia/public/mojom", "//ui/gfx/geometry/mojom", "//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_origin",
diff --git a/chrome/browser/ui/webui/glic/glic.mojom b/chrome/browser/ui/webui/glic/glic.mojom index 71dcfb57..01c2fe3 100644 --- a/chrome/browser/ui/webui/glic/glic.mojom +++ b/chrome/browser/ui/webui/glic/glic.mojom
@@ -8,6 +8,7 @@ import "url/mojom/url.mojom"; import "url/mojom/origin.mojom"; import "ui/gfx/geometry/mojom/geometry.mojom"; +import "skia/public/mojom/bitmap.mojom"; // Factory for PageHandler used in chrome://glic. interface PageHandlerFactory { @@ -112,6 +113,8 @@ // The title of the loaded page. Returned if the page is loaded enough for it // to be available. It may be empty if the page did not define a title. string? title; + // The favicon for the tab. Null when not available. + skia.mojom.BitmapN32? favicon; }; // Annotates an image, providing security relevant information about the origins
diff --git a/chrome/browser/ui/webui/new_tab_page/webui_ntp_browsertest.cc b/chrome/browser/ui/webui/new_tab_page/webui_ntp_browsertest.cc index c494c02..6cc7b64 100644 --- a/chrome/browser/ui/webui/new_tab_page/webui_ntp_browsertest.cc +++ b/chrome/browser/ui/webui/new_tab_page/webui_ntp_browsertest.cc
@@ -12,6 +12,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/search/ntp_features.h" +#include "content/public/browser/child_process_id.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/spare_render_process_host_manager.h" #include "content/public/browser/web_contents.h" @@ -27,8 +28,8 @@ content::EXECUTE_SCRIPT_DEFAULT_OPTIONS, /*world_id=*/1)); } -std::set<int> LiveRenderProcessHostIds() { - std::set<int> result; +std::set<content::ChildProcessId> LiveRenderProcessHostIds() { + std::set<content::ChildProcessId> result; for (auto iter = content::RenderProcessHost::AllHostsIterator(); !iter.IsAtEnd(); iter.Advance()) { result.insert(iter.GetCurrentKey()); @@ -110,7 +111,8 @@ // Note the current render processes before the navigation. These should all // remain alive after the navigation. - const std::set<int> starting_rph_ids = LiveRenderProcessHostIds(); + const std::set<content::ChildProcessId> starting_rph_ids = + LiveRenderProcessHostIds(); // Open an NTP. chrome::NewTab(browser()); @@ -124,8 +126,10 @@ ntp->GetPrimaryMainFrame()->GetProcess()->GetID())); // No processes should be unnecessarily terminated. - const std::set<int> ending_rph_ids = LiveRenderProcessHostIds(); - const std::set<int> terminated_rph_ids = - base::STLSetDifference<std::set<int>>(starting_rph_ids, ending_rph_ids); + const std::set<content::ChildProcessId> ending_rph_ids = + LiveRenderProcessHostIds(); + const std::set<content::ChildProcessId> terminated_rph_ids = + base::STLSetDifference<std::set<content::ChildProcessId>>( + starting_rph_ids, ending_rph_ids); EXPECT_TRUE(terminated_rph_ids.empty()); }
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 abd96e2..df347d1 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -396,6 +396,8 @@ IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_ONE}, {"historySearchAnswersWhenOnBulletTwo", IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_WHEN_ON_BULLET_TWO}, + {"historySearchWhenOnLogStart", + IDS_SETTINGS_HISTORY_SEARCH_WHEN_ON_LOG_START}, {"historySearchAnswersConsiderBulletOne", IDS_SETTINGS_HISTORY_SEARCH_ANSWERS_CONSIDER_BULLET_ONE}, {"historySearchAnswersConsiderBulletTwo", @@ -415,8 +417,8 @@ IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_SETTING_SUBLABEL_V2}, {"historySearchWithAnswersWhenOnPageContent", IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_PAGE_CONTENT}, - {"historySearchWithAnswersWhenOnLogStart", - IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_LOG_START}, + {"historySearchWithAnswersWhenOnRecallInfo", + IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_WHEN_ON_RECALL_INFO}, {"historySearchWithAnswersConsiderDataEncrypted", IDS_SETTINGS_HISTORY_SEARCH_WITH_ANSWERS_CONSIDER_DATA_ENCRYPTED}, {"historySearchWithAnswersConsiderOutdated", @@ -432,6 +434,12 @@ {"aiCompareLearnMoreA11yLabel", IDS_SETTINGS_COMPARE_SETTING_LINK_A11Y}, {"aiCompareWhenOnProductDetails", IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_DETAILS}, + {"aiCompareWhenOnProductSuggest", + IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_SUGGEST}, + {"aiCompareWhenOnProductFilter", + IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_FILTER}, + {"aiCompareWhenOnProductReviews", + IDS_SETTINGS_COMPARE_WHEN_ON_PRODUCT_REVIEWS}, {"aiCompareConsiderData", IDS_SETTINGS_COMPARE_CONSIDER_DATA}, {"aiCompareConsiderTablesInAccount", IDS_SETTINGS_COMPARE_CONSIDER_TABLES_IN_ACCOUNT}, @@ -453,6 +461,10 @@ IDS_SETTINGS_OFFER_WRITING_HELP_REMOVE_SITE_ARIA_LABEL}, {"aiComposeSettingLearnMoreA11y", IDS_SETTINGS_COMPOSE_SETTING_LINK_A11Y}, {"aiComposeWhenOnWritingHelp", IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_HELP}, + {"aiComposeWhenOnWritingExamples", + IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_EXAMPLES}, + {"aiComposeWhenOnWritingReferences", + IDS_SETTINGS_COMPOSE_WHEN_ON_WRITING_REFERENCES}, {"aiComposeComposeConsiderData", IDS_SETTINGS_COMPOSE_CONSIDER_DATA}, // Tab Organization strings. @@ -464,6 +476,8 @@ IDS_SETTINGS_AUTOTABS_SETTING_LINK_A11Y}, {"tabOrganizationSettingWhenOnAutoGroups", IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_AUTO_GROUPS}, + {"tabOrganizationSettingWhenOnImproveFocus", + IDS_SETTINGS_TAB_ORGANIZER_WHEN_ON_IMPROVE_FOCUS}, {"tabOrganizationSettingConsiderData", IDS_SETTINGS_TAB_ORGANIZER_CONSIDER_DATA},
diff --git a/chrome/browser/ui/webui/settings/settings_ui.cc b/chrome/browser/ui/webui/settings/settings_ui.cc index 24f820f..4758421 100644 --- a/chrome/browser/ui/webui/settings/settings_ui.cc +++ b/chrome/browser/ui/webui/settings/settings_ui.cc
@@ -578,6 +578,9 @@ const bool show_ai_settings_for_testing = optimization_guide::features::kShowAiSettingsForTesting.Get(); + html_source->AddBoolean("showAiSettingsForTesting", + show_ai_settings_for_testing); + const bool use_is_setting_visible = base::FeatureList::IsEnabled( optimization_guide::features::kAiSettingsPageEnterpriseDisabledUi);
diff --git a/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler.cc b/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler.cc index fe30402..95211d0 100644 --- a/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler.cc +++ b/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler.cc
@@ -108,15 +108,18 @@ return result; } -optimization_guide::proto::UserFeedback +optimization_guide::proto::features::UserFeedback OptimizationFeedbackFromWallpaperSearchFeedback(UserFeedback feedback) { switch (feedback) { case UserFeedback::kThumbsUp: - return optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_UP; + return optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_UP; case UserFeedback::kThumbsDown: - return optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN; + return optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN; case UserFeedback::kUnspecified: - return optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + return optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED; } } @@ -365,7 +368,7 @@ if (!optimization_guide_keyed_service) { return; } - optimization_guide::proto::WallpaperSearchRequest request; + optimization_guide::proto::features::WallpaperSearchRequest request; auto& descriptors = *request.mutable_descriptors(); CHECK(result_descriptors->subject); descriptors.set_subject(*result_descriptors->subject); @@ -386,7 +389,7 @@ } optimization_guide::ModelExecutionCallbackWithLogging< - optimization_guide::proto::WallpaperSearchLoggingData> + optimization_guide::proto::features::WallpaperSearchLoggingData> wrapper_callback = base::BindOnce( &WallpaperSearchHandler::OnWallpaperSearchResultsRetrieved, weak_ptr_factory_.GetWeakPtr(), std::move(callback), @@ -537,7 +540,7 @@ ShowFeedbackPage(); } - optimization_guide::proto::UserFeedback user_feedback = + optimization_guide::proto::features::UserFeedback user_feedback = OptimizationFeedbackFromWallpaperSearchFeedback(selected_option); if (!log_entries_.empty()) { auto* quality = @@ -953,7 +956,8 @@ GetWallpaperSearchResultsCallback callback, base::ElapsedTimer request_timer, optimization_guide::OptimizationGuideModelExecutionResult result, - std::unique_ptr<optimization_guide::proto::WallpaperSearchLoggingData> + std::unique_ptr< + optimization_guide::proto::features::WallpaperSearchLoggingData> logging_data) { if (!log_entries_.empty()) { auto& [prev_log_entry, render_time] = log_entries_.back(); @@ -1009,13 +1013,14 @@ return; } auto response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::WallpaperSearchResponse>( + optimization_guide::proto::features::WallpaperSearchResponse>( result.response.value()); if (response->images().empty()) { return; } auto barrier = base::BarrierCallback<std::pair< - optimization_guide::proto::WallpaperSearchImageQuality*, SkBitmap>>( + optimization_guide::proto::features::WallpaperSearchImageQuality*, + SkBitmap>>( response->images_size(), base::BindOnce(&WallpaperSearchHandler::OnWallpaperSearchResultsDecoded, weak_ptr_factory_.GetWeakPtr(), std::move(callback), @@ -1025,8 +1030,8 @@ // from gfx::Image to SkBitmap before passing to the barrier callback because // of some issues with const gfx::Image& and base::BarrierCallback. for (auto& image : response->images()) { - optimization_guide::proto::WallpaperSearchImageQuality* image_quality = - nullptr; + optimization_guide::proto::features::WallpaperSearchImageQuality* + image_quality = nullptr; if (!log_entries_.empty()) { auto* quality = log_entries_.back() @@ -1042,10 +1047,10 @@ image.encoded_image(), gfx::Size(), nullptr, base::BindOnce( [](base::RepeatingCallback<void( - std::pair< - optimization_guide::proto::WallpaperSearchImageQuality*, - SkBitmap>)> barrier, - optimization_guide::proto::WallpaperSearchImageQuality* + std::pair<optimization_guide::proto::features:: + WallpaperSearchImageQuality*, + SkBitmap>)> barrier, + optimization_guide::proto::features::WallpaperSearchImageQuality* image_quality, const gfx::Image& image) { std::move(barrier).Run( @@ -1076,9 +1081,9 @@ void WallpaperSearchHandler::OnWallpaperSearchResultsDecoded( GetWallpaperSearchResultsCallback callback, base::ElapsedTimer processing_timer, - std::vector< - std::pair<optimization_guide::proto::WallpaperSearchImageQuality*, - SkBitmap>> bitmaps) { + std::vector<std::pair< + optimization_guide::proto::features::WallpaperSearchImageQuality*, + SkBitmap>> bitmaps) { std::vector<WallpaperSearchResultPtr> thumbnails; for (auto& [image_quality, bitmap] : bitmaps) {
diff --git a/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler.h b/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler.h index 06617af..65395450 100644 --- a/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler.h +++ b/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler.h
@@ -136,14 +136,15 @@ GetWallpaperSearchResultsCallback callback, base::ElapsedTimer request_timer, optimization_guide::OptimizationGuideModelExecutionResult result, - std::unique_ptr<optimization_guide::proto::WallpaperSearchLoggingData> + std::unique_ptr< + optimization_guide::proto::features::WallpaperSearchLoggingData> logging_data); void OnWallpaperSearchResultsDecoded( GetWallpaperSearchResultsCallback callback, base::ElapsedTimer processing_timer, - std::vector< - std::pair<optimization_guide::proto::WallpaperSearchImageQuality*, - SkBitmap>> bitmaps); + std::vector<std::pair< + optimization_guide::proto::features::WallpaperSearchImageQuality*, + SkBitmap>> bitmaps); void SelectHistoryImage( const base::Token& id, base::ElapsedTimer timer, @@ -179,9 +180,10 @@ // destructed before the pointed to objects in `log_entries_`. base::flat_map< base::Token, - std::tuple<optimization_guide::proto::WallpaperSearchImageQuality*, - std::optional<base::Time>, - SkBitmap>> + std::tuple< + optimization_guide::proto::features::WallpaperSearchImageQuality*, + std::optional<base::Time>, + SkBitmap>> wallpaper_search_results_; const int64_t session_id_; const raw_ref<const WallpaperSearchStringMap> string_map_;
diff --git a/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler_unittest.cc b/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler_unittest.cc index c74bebf..620f9876 100644 --- a/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler_unittest.cc +++ b/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_handler_unittest.cc
@@ -663,7 +663,7 @@ } TEST_F(WallpaperSearchHandlerTest, GetWallpaperSearchResults_Success) { - optimization_guide::proto::WallpaperSearchRequest request; + optimization_guide::proto::features::WallpaperSearchRequest request; optimization_guide::OptimizationGuideModelExecutionResultCallback done_callback; base::OnceCallback<void(const gfx::Image&)> decoder_callback1; @@ -715,7 +715,7 @@ EXPECT_EQ("baz", request.descriptors().mood()); EXPECT_EQ("#FFFFFF", request.descriptors().color()); - optimization_guide::proto::WallpaperSearchResponse response; + optimization_guide::proto::features::WallpaperSearchResponse response; // Create test bitmap 1 and add it to response. SkBitmap bitmap1; @@ -816,7 +816,7 @@ TEST_F(WallpaperSearchHandlerTest, GetWallpaperSearchResults_MultipleRequests) { // FIRST REQUEST. - optimization_guide::proto::WallpaperSearchRequest request1; + optimization_guide::proto::features::WallpaperSearchRequest request1; optimization_guide::OptimizationGuideModelExecutionResultCallback done_callback1; EXPECT_CALL(mock_optimization_guide_keyed_service(), ExecuteModel(_, _, _, _)) @@ -851,7 +851,7 @@ EXPECT_EQ("#FFFFFF", request1.descriptors().color()); // Serialize and set result to later send to done_callback. - optimization_guide::proto::WallpaperSearchResponse response1; + optimization_guide::proto::features::WallpaperSearchResponse response1; std::string serialized_metadata1; response1.SerializeToString(&serialized_metadata1); optimization_guide::proto::Any result1; @@ -881,7 +881,7 @@ {}, base::Time::Now().InMillisecondsFSinceUnixEpoch()); // SECOND REQUEST. - optimization_guide::proto::WallpaperSearchRequest request2; + optimization_guide::proto::features::WallpaperSearchRequest request2; optimization_guide::OptimizationGuideModelExecutionResultCallback done_callback2; EXPECT_CALL(mock_optimization_guide_keyed_service(), ExecuteModel(_, _, _, _)) @@ -915,7 +915,7 @@ EXPECT_EQ("baz2", request2.descriptors().mood()); EXPECT_EQ("#FF0000", request2.descriptors().color()); - optimization_guide::proto::WallpaperSearchResponse response2; + optimization_guide::proto::features::WallpaperSearchResponse response2; std::string serialized_metadata2; response2.SerializeToString(&serialized_metadata2); optimization_guide::proto::Any result2; @@ -977,7 +977,7 @@ TEST_F(WallpaperSearchHandlerTest, GetWallpaperSearchResults_TwoDescriptorsQueryFormatCorrect) { - optimization_guide::proto::WallpaperSearchRequest request; + optimization_guide::proto::features::WallpaperSearchRequest request; base::OnceCallback<void(const gfx::Image&)> decoder_callback1; EXPECT_CALL(mock_optimization_guide_keyed_service(), ExecuteModel(_, _, _, _)) .WillOnce(Invoke( @@ -1012,7 +1012,7 @@ } TEST_F(WallpaperSearchHandlerTest, GetWallpaperSearchResults_ConvertsHueToHex) { - optimization_guide::proto::WallpaperSearchRequest request; + optimization_guide::proto::features::WallpaperSearchRequest request; base::OnceCallback<void(const gfx::Image&)> decoder_callback1; EXPECT_CALL(mock_optimization_guide_keyed_service(), ExecuteModel(_, _, _, _)) .WillOnce(Invoke( @@ -1046,7 +1046,7 @@ } TEST_F(WallpaperSearchHandlerTest, GetWallpaperSearchResults_NoResponse) { - optimization_guide::proto::WallpaperSearchRequest request; + optimization_guide::proto::features::WallpaperSearchRequest request; optimization_guide::OptimizationGuideModelExecutionResultCallback done_callback; base::OnceCallback<void(const gfx::Image&)> decoder_callback1; @@ -1116,7 +1116,7 @@ } TEST_F(WallpaperSearchHandlerTest, GetWallpaperSearchResults_NoImages) { - optimization_guide::proto::WallpaperSearchRequest request; + optimization_guide::proto::features::WallpaperSearchRequest request; optimization_guide::OptimizationGuideModelExecutionResultCallback done_callback; base::OnceCallback<void(const gfx::Image&)> decoder_callback1; @@ -1147,7 +1147,7 @@ EXPECT_TRUE(request.descriptors().mood().empty()); EXPECT_TRUE(request.descriptors().color().empty()); - optimization_guide::proto::WallpaperSearchResponse response; + optimization_guide::proto::features::WallpaperSearchResponse response; std::string serialized_metadata; response.SerializeToString(&serialized_metadata); optimization_guide::proto::Any result; @@ -1187,7 +1187,7 @@ } TEST_F(WallpaperSearchHandlerTest, GetWallpaperSearchResults_RequestThrottled) { - optimization_guide::proto::WallpaperSearchRequest request; + optimization_guide::proto::features::WallpaperSearchRequest request; optimization_guide::OptimizationGuideModelExecutionResultCallback done_callback; base::OnceCallback<void(const gfx::Image&)> decoder_callback1; @@ -1372,7 +1372,7 @@ TEST_F(WallpaperSearchHandlerTest, SetBackgroundToWallpaperSearchResult) { // Fill wallpaper_search_results_ with 2 bitmaps. - optimization_guide::proto::WallpaperSearchRequest request; + optimization_guide::proto::features::WallpaperSearchRequest request; optimization_guide::OptimizationGuideModelExecutionResultCallback done_callback; base::OnceCallback<void(const gfx::Image&)> decoder_callback1; @@ -1419,7 +1419,7 @@ EXPECT_TRUE(request.descriptors().mood().empty()); EXPECT_TRUE(request.descriptors().color().empty()); - optimization_guide::proto::WallpaperSearchResponse response; + optimization_guide::proto::features::WallpaperSearchResponse response; // Create test bitmap 1 and add it to response. SkBitmap bitmap1; @@ -1553,7 +1553,7 @@ TEST_F(WallpaperSearchHandlerTest, SetUserFeedback) { // Mock first request, then mark as thumbs down. - optimization_guide::proto::WallpaperSearchRequest request1; + optimization_guide::proto::features::WallpaperSearchRequest request1; optimization_guide::OptimizationGuideModelExecutionResultCallback done_callback1; EXPECT_CALL(mock_optimization_guide_keyed_service(), ExecuteModel(_, _, _, _)) @@ -1580,7 +1580,7 @@ SK_ColorWHITE); handler->GetWallpaperSearchResults(std::move(result_descriptors), callback1.Get()); - optimization_guide::proto::WallpaperSearchResponse response1; + optimization_guide::proto::features::WallpaperSearchResponse response1; std::string serialized_metadata1; response1.SerializeToString(&serialized_metadata1); optimization_guide::proto::Any result1; @@ -1600,7 +1600,7 @@ side_panel::customize_chrome::mojom::UserFeedback::kThumbsDown); // Mock second request, then mark as thumbs up. - optimization_guide::proto::WallpaperSearchRequest request2; + optimization_guide::proto::features::WallpaperSearchRequest request2; optimization_guide::OptimizationGuideModelExecutionResultCallback done_callback2; EXPECT_CALL(mock_optimization_guide_keyed_service(), ExecuteModel(_, _, _, _)) @@ -1628,7 +1628,7 @@ SK_ColorRED); handler->GetWallpaperSearchResults(std::move(result_descriptors2), callback2.Get()); - optimization_guide::proto::WallpaperSearchResponse response2; + optimization_guide::proto::features::WallpaperSearchResponse response2; std::string serialized_metadata2; response2.SerializeToString(&serialized_metadata2); optimization_guide::proto::Any result2; @@ -1652,9 +1652,11 @@ const auto& log1 = logs[0]->mutable_wallpaper_search()->quality(); const auto& log2 = logs[1]->mutable_wallpaper_search()->quality(); - EXPECT_EQ(optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN, + EXPECT_EQ(optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN, log1.user_feedback()); - EXPECT_EQ(optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_UP, + EXPECT_EQ(optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_UP, log2.user_feedback()); }
diff --git a/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_interactive_uitest.cc b/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_interactive_uitest.cc index 0e3e3e9..68d6eb4 100644 --- a/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_interactive_uitest.cc +++ b/chrome/browser/ui/webui/side_panel/customize_chrome/wallpaper_search/wallpaper_search_interactive_uitest.cc
@@ -294,7 +294,8 @@ gfx::PNGCodec::EncodeBGRASkBitmap( bitmap, /*discard_transparency=*/false); - optimization_guide::proto::WallpaperSearchResponse response; + optimization_guide::proto::features::WallpaperSearchResponse + response; auto* image = response.add_images(); image->set_encoded_image( std::string(base::as_string_view(encoded.value())));
diff --git a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc index f17174e..5ed94eaa 100644 --- a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc +++ b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc
@@ -982,19 +982,19 @@ int32_t session_id, int32_t organization_id, tab_search::mojom::UserFeedback feedback) { - optimization_guide::proto::UserFeedback user_feedback; + optimization_guide::proto::features::UserFeedback user_feedback; switch (feedback) { case tab_search::mojom::UserFeedback::kUserFeedBackPositive: - user_feedback = - optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_UP; + user_feedback = optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_UP; break; case tab_search::mojom::UserFeedback::kUserFeedBackNegative: - user_feedback = - optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN; + user_feedback = optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN; break; case tab_search::mojom::UserFeedback::kUserFeedBackUnspecified: - user_feedback = - optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + user_feedback = optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED; break; } if (base::FeatureList::IsEnabled(features::kMultiTabOrganization)) {
diff --git a/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc b/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc index 75fdf91..7740b70 100644 --- a/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc +++ b/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc
@@ -535,16 +535,6 @@ // static apps::AppType WebAppPublisherHelper::GetWebAppType() { -// After moving the ordinary Web Apps to Lacros chrome, the remaining web -// apps in ash Chrome will be only System Web Apps. Change the app type -// to kSystemWeb for this case and the kWeb app type will be published from -// the publisher for Lacros web apps. -#if BUILDFLAG(IS_CHROMEOS_ASH) - if (crosapi::browser_util::IsLacrosEnabled() && IsWebAppsCrosapiEnabled()) { - return apps::AppType::kSystemWeb; - } -#endif - return apps::AppType::kWeb; } @@ -905,19 +895,7 @@ SetIconEffect(app_id); } - if (!IsWebAppsCrosapiEnabled()) { - provider_->ui_manager().CloseAppWindows(app_id); - } else { - CHECK(apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile( - profile_)); - - apps::BrowserAppInstanceTracker* instance_tracker = - apps::AppServiceProxyFactory::GetForProfile(profile_) - ->BrowserAppInstanceTracker(); - CHECK(instance_tracker); - - instance_tracker->StopInstancesOfApp(app_id); - } + provider_->ui_manager().CloseAppWindows(app_id); delegate_->PublishWebApp(paused_apps_.CreateAppWithPauseStatus( app_type(), app_id, /*paused=*/true)); @@ -945,20 +923,7 @@ return; } - if (!IsWebAppsCrosapiEnabled()) { - provider_->ui_manager().CloseAppWindows(app_id); - return; - } - - CHECK( - apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile(profile_)); - - apps::BrowserAppInstanceTracker* instance_tracker = - apps::AppServiceProxyFactory::GetForProfile(profile_) - ->BrowserAppInstanceTracker(); - CHECK(instance_tracker); - - instance_tracker->StopInstancesOfApp(app_id); + provider_->ui_manager().CloseAppWindows(app_id); } void WebAppPublisherHelper::GetCompressedIconData(
diff --git a/chrome/browser/web_applications/isolated_web_apps/isolated_web_app_installation_manager.cc b/chrome/browser/web_applications/isolated_web_apps/isolated_web_app_installation_manager.cc index a931eb27..91f4696 100644 --- a/chrome/browser/web_applications/isolated_web_apps/isolated_web_app_installation_manager.cc +++ b/chrome/browser/web_applications/isolated_web_apps/isolated_web_app_installation_manager.cc
@@ -166,15 +166,6 @@ return; } -#if BUILDFLAG(IS_CHROMEOS_ASH) - if (IsWebAppsCrosapiEnabled()) { - // If Lacros manages Web Apps, then Ash only manages System Web Apps. Thus, - // do not attempt to install IWAs in Ash, because Lacros will take care of - // that. - return; - } -#endif - if (KeepAliveRegistry::GetInstance()->IsShuttingDown()) { ReportInstallationResult(base::unexpected( "Unable to install IWA due to browser shutting down."));
diff --git a/chrome/browser/web_applications/policy/web_app_policy_manager.cc b/chrome/browser/web_applications/policy/web_app_policy_manager.cc index 8dccceb..a10ebbd 100644 --- a/chrome/browser/web_applications/policy/web_app_policy_manager.cc +++ b/chrome/browser/web_applications/policy/web_app_policy_manager.cc
@@ -138,19 +138,11 @@ policy_settings_and_force_installs_applied_ = std::move(policy_settings_and_force_installs_applied); - // When Lacros is enabled, don't run PWA-specific logic in Ash. - // TODO(crbug.com/40792561): Consider factoring out logic that should only run - // in Ash into a separate class. This way, when running in Ash, we won't need - // to construct a WebAppPolicyManager. - bool enable_pwa_support = true; -#if BUILDFLAG(IS_CHROMEOS_ASH) - enable_pwa_support = !IsWebAppsCrosapiEnabled(); -#endif // BUILDFLAG(IS_CHROMEOS_ASH) content::GetUIThreadTaskRunner({base::TaskPriority::BEST_EFFORT}) ->PostTask(FROM_HERE, base::BindOnce( &WebAppPolicyManager::InitChangeRegistrarAndRefreshPolicy, - weak_ptr_factory_.GetWeakPtr(), enable_pwa_support)); + weak_ptr_factory_.GetWeakPtr())); } void WebAppPolicyManager::Shutdown() { @@ -210,34 +202,26 @@ registry->RegisterListPref(prefs::kWebAppSettings); } -void WebAppPolicyManager::InitChangeRegistrarAndRefreshPolicy( - bool enable_pwa_support) { +void WebAppPolicyManager::InitChangeRegistrarAndRefreshPolicy() { pref_change_registrar_.Init(pref_service_); - if (enable_pwa_support) { - pref_change_registrar_.Add( - prefs::kWebAppInstallForceList, - base::BindRepeating(&WebAppPolicyManager::RefreshPolicyInstalledApps, - weak_ptr_factory_.GetWeakPtr(), - /*allow_close_and_relaunch=*/false)); - pref_change_registrar_.Add( - prefs::kWebAppSettings, - base::BindRepeating(&WebAppPolicyManager::RefreshPolicySettings, - weak_ptr_factory_.GetWeakPtr())); + pref_change_registrar_.Add( + prefs::kWebAppInstallForceList, + base::BindRepeating(&WebAppPolicyManager::RefreshPolicyInstalledApps, + weak_ptr_factory_.GetWeakPtr(), + /*allow_close_and_relaunch=*/false)); + pref_change_registrar_.Add( + prefs::kWebAppSettings, + base::BindRepeating(&WebAppPolicyManager::RefreshPolicySettings, + weak_ptr_factory_.GetWeakPtr())); - RefreshPolicySettings(); + RefreshPolicySettings(); #if BUILDFLAG(IS_CHROMEOS) - RefreshPolicyInstalledApps( - /*allow_close_and_relaunch=*/base::FeatureList::IsEnabled( - features::kForcedAppRelaunchOnPlaceholderUpdate)); + RefreshPolicyInstalledApps( + /*allow_close_and_relaunch=*/base::FeatureList::IsEnabled( + features::kForcedAppRelaunchOnPlaceholderUpdate)); #else - RefreshPolicyInstalledApps(/*allow_close_and_relaunch=*/false); + RefreshPolicyInstalledApps(/*allow_close_and_relaunch=*/false); #endif - - } else { - if (policy_settings_and_force_installs_applied_) { - std::move(policy_settings_and_force_installs_applied_).Run(); - } - } ObserveDisabledSystemFeaturesPolicy(); }
diff --git a/chrome/browser/web_applications/policy/web_app_policy_manager.h b/chrome/browser/web_applications/policy/web_app_policy_manager.h index 99b6d14..20807d9 100644 --- a/chrome/browser/web_applications/policy/web_app_policy_manager.h +++ b/chrome/browser/web_applications/policy/web_app_policy_manager.h
@@ -140,7 +140,7 @@ std::optional<std::vector<blink::Manifest::ImageResource>> icons; }; - void InitChangeRegistrarAndRefreshPolicy(bool enable_pwa_support); + void InitChangeRegistrarAndRefreshPolicy(); void RefreshPolicyInstalledApps(bool allow_close_and_relaunch = false); void ParsePolicySettings();
diff --git a/chrome/browser/web_applications/preinstalled_web_app_manager.cc b/chrome/browser/web_applications/preinstalled_web_app_manager.cc index 3ade4d4..a6583e4 100644 --- a/chrome/browser/web_applications/preinstalled_web_app_manager.cc +++ b/chrome/browser/web_applications/preinstalled_web_app_manager.cc
@@ -730,13 +730,6 @@ bool preinstalling_enabled = base::FeatureList::IsEnabled(features::kPreinstalledWebAppInstallation); -#if BUILDFLAG(IS_CHROMEOS_ASH) - // With Lacros, web apps are not installed using the Ash browser. - if (IsWebAppsCrosapiEnabled()) { - preinstalling_enabled = false; - } -#endif - if (!preinstalling_enabled) { std::move(callback).Run({}); return;
diff --git a/chrome/browser/web_applications/preinstalled_web_app_migration_browsertest.cc b/chrome/browser/web_applications/preinstalled_web_app_migration_browsertest.cc index eda7796..b8d8c9d 100644 --- a/chrome/browser/web_applications/preinstalled_web_app_migration_browsertest.cc +++ b/chrome/browser/web_applications/preinstalled_web_app_migration_browsertest.cc
@@ -298,15 +298,7 @@ } bool IsUninstallSilentlySupported() { -#if BUILDFLAG(IS_CHROMEOS_LACROS) - DCHECK(IsWebAppsCrosapiEnabled()); - return chromeos::LacrosService::Get() - ->GetInterfaceVersion<crosapi::mojom::AppServiceProxy>() >= - int{crosapi::mojom::AppServiceProxy::MethodMinVersions:: - kUninstallSilentlyMinVersion}; -#else // BUILDFLAG(IS_CHROMEOS_LACROS) return true; -#endif // BUILDFLAG(IS_CHROMEOS_LACROS) } protected:
diff --git a/chrome/browser/web_applications/web_app_provider.cc b/chrome/browser/web_applications/web_app_provider.cc index aa53803c..712886c7 100644 --- a/chrome/browser/web_applications/web_app_provider.cc +++ b/chrome/browser/web_applications/web_app_provider.cc
@@ -82,18 +82,6 @@ // static WebAppProvider* WebAppProvider::GetForWebApps(Profile* profile) { -#if BUILDFLAG(IS_CHROMEOS_ASH) - // If features::kWebAppsCrosapi is enabled, Ash browser only manages system - // web apps (return nullptr here). Otherwise, Ash browser manages all web apps - // (return WebAppProvider). - // An exception is that Shimless RMA app always requires loading IWA on Ash. - // TODO(b/292227137): Migrate Shimless RMA app to LaCrOS. - if (IsWebAppsCrosapiEnabled() && - (!::ash::features::IsShimlessRMA3pDiagnosticsEnabled() || - !::ash::IsShimlessRmaAppBrowserContext(profile))) { - return nullptr; - } -#endif return WebAppProviderFactory::GetForProfile(profile); }
diff --git a/chrome/browser/web_applications/web_app_registrar.cc b/chrome/browser/web_applications/web_app_registrar.cc index eff5a7b7..603e51b6 100644 --- a/chrome/browser/web_applications/web_app_registrar.cc +++ b/chrome/browser/web_applications/web_app_registrar.cc
@@ -17,6 +17,7 @@ #include "base/containers/enum_set.h" #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" +#include "base/containers/map_util.h" #include "base/feature_list.h" #include "base/functional/bind.h" #include "base/functional/callback_helpers.h" @@ -66,19 +67,6 @@ proto::InstallState_MIN, proto::InstallState_MAX>; -// With Lacros, only system web apps are exposed using the Ash browser. -bool WebAppSourceSupported(const WebApp& web_app) { -#if BUILDFLAG(IS_CHROMEOS_ASH) - if (IsWebAppsCrosapiEnabled() && !web_app.IsSystemApp()) { - return false; - } -#elif BUILDFLAG(IS_CHROMEOS_LACROS) - if (web_app.IsSystemApp()) - return false; -#endif - return true; -} - BASE_FEATURE(kDiyAppsDefaultCaptureForcedOff, "capture_forced_off_diy_apps", base::FEATURE_DISABLED_BY_DEFAULT); @@ -605,29 +593,23 @@ #endif const WebApp* WebAppRegistrar::GetAppById(const webapps::AppId& app_id) const { - auto it = registry_.find(app_id); - if (it != registry_.end() && WebAppSourceSupported(*it->second)) - return it->second.get(); - - return nullptr; + return base::FindPtrOrNull(registry_, app_id); } const WebApp* WebAppRegistrar::GetAppByStartUrl(const GURL& start_url) const { for (auto const& it : registry_) { - if (WebAppSourceSupported(*it.second) && - it.second->start_url() == start_url) + if (it.second->start_url() == start_url) { return it.second.get(); + } } return nullptr; } std::vector<webapps::AppId> WebAppRegistrar::GetAppsFromSyncAndPendingInstallation() const { - AppSet apps_in_sync_install = - AppSet(this, [](const WebApp& web_app) { - return WebAppSourceSupported(web_app) && - web_app.is_from_sync_and_pending_installation(); - }); + AppSet apps_in_sync_install = AppSet(this, [](const WebApp& web_app) { + return web_app.is_from_sync_and_pending_installation(); + }); std::vector<webapps::AppId> app_ids; for (const WebApp& app : apps_in_sync_install) @@ -637,16 +619,15 @@ } std::vector<webapps::AppId> WebAppRegistrar::GetAppsPendingUninstall() const { - AppSet apps_in_sync_uninstall = - AppSet(this, [](const WebApp& web_app) { - return WebAppSourceSupported(web_app) && - !web_app.is_from_sync_and_pending_installation() && - web_app.is_uninstalling(); - }); + AppSet apps_in_sync_uninstall = AppSet(this, [](const WebApp& web_app) { + return !web_app.is_from_sync_and_pending_installation() && + web_app.is_uninstalling(); + }); std::vector<webapps::AppId> app_ids; - for (const WebApp& app : apps_in_sync_uninstall) + for (const WebApp& app : apps_in_sync_uninstall) { app_ids.push_back(app.app_id()); + } return app_ids; } @@ -1696,18 +1677,14 @@ } WebAppRegistrar::AppSet WebAppRegistrar::GetAppsIncludingStubs() const { - return AppSet(this, [](const WebApp& web_app) { - return WebAppSourceSupported(web_app); - }); + return AppSet(this, [](const WebApp& web_app) { return true; }); } WebAppRegistrar::AppSet WebAppRegistrar::GetApps() const { - return AppSet( - this, [](const WebApp& web_app) { - return WebAppSourceSupported(web_app) && - !web_app.is_from_sync_and_pending_installation() && - !web_app.is_uninstalling(); - }); + return AppSet(this, [](const WebApp& web_app) { + return !web_app.is_from_sync_and_pending_installation() && + !web_app.is_uninstalling(); + }); } base::Value WebAppRegistrar::AsDebugValue() const { @@ -1805,12 +1782,10 @@ } WebAppRegistrar::AppSet WebAppRegistrarMutable::GetAppsMutable() { - return AppSet( - this, [](const WebApp& web_app) { - return WebAppSourceSupported(web_app) && - !web_app.is_from_sync_and_pending_installation() && - !web_app.is_uninstalling(); - }); + return AppSet(this, [](const WebApp& web_app) { + return !web_app.is_from_sync_and_pending_installation() && + !web_app.is_uninstalling(); + }); } bool IsRegistryEqual(const Registry& registry,
diff --git a/chrome/browser/web_applications/web_app_sync_bridge.cc b/chrome/browser/web_applications/web_app_sync_bridge.cc index 2d5ea20b..ac0da51 100644 --- a/chrome/browser/web_applications/web_app_sync_bridge.cc +++ b/chrome/browser/web_applications/web_app_sync_bridge.cc
@@ -494,11 +494,6 @@ for (std::unique_ptr<WebApp>& web_app : update_data->apps_to_create) { webapps::AppId app_id = web_app->app_id(); DCHECK(!registrar_->GetAppById(app_id)); -#if BUILDFLAG(IS_CHROMEOS_ASH) - // We do not install non-system web apps in Ash when Lacros web apps are - // enabled. - DCHECK(web_app->IsSystemApp() || !IsWebAppsCrosapiEnabled()); -#endif registrar_->registry().emplace(std::move(app_id), std::move(web_app)); }
diff --git a/chrome/browser/web_applications/web_app_utils.cc b/chrome/browser/web_applications/web_app_utils.cc index ece5a2f0..35664fd9 100644 --- a/chrome/browser/web_applications/web_app_utils.cc +++ b/chrome/browser/web_applications/web_app_utils.cc
@@ -310,12 +310,6 @@ } bool AreWebAppsUserInstallable(Profile* profile) { -#if BUILDFLAG(IS_CHROMEOS) - // With Lacros, web apps are not installed using the Ash browser. - if (IsWebAppsCrosapiEnabled()) { - return false; - } -#endif return AreWebAppsEnabled(profile) && !profile->IsGuestSession() && !profile->IsOffTheRecord(); } @@ -412,9 +406,8 @@ bool AreAppsLocallyInstalledBySync() { #if BUILDFLAG(IS_CHROMEOS) - // With Crosapi, Ash no longer participates in sync. - // On Chrome OS before Crosapi, sync always locally installs an app. - return !IsWebAppsCrosapiEnabled(); + // On Chrome OS, sync always locally installs an app. + return true; #else return false; #endif
diff --git a/chrome/build/android-arm64.pgo.txt b/chrome/build/android-arm64.pgo.txt index 1cb3c502..7e6355b 100644 --- a/chrome/build/android-arm64.pgo.txt +++ b/chrome/build/android-arm64.pgo.txt
@@ -1 +1 @@ -chrome-android64-main-1734109208-8a9731068b140019a22a2826bec96db7792d6dce-bedd1c4bcadda4d1ca95260b42010736f991c1aa.profdata +chrome-android64-main-1734129746-a8c39745dfd2f81989c4294bead8f55ac92fcc79-0b91de8357cc2116576263ece0eccfc65f938bd8.profdata
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index aa6e456..e79fc1e 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1734091137-29a3be138d71abcb3cc90be42bedac25ffd9c56a-d83e960b676d9b7761163445d6e514f70dcf2719.profdata +chrome-linux-main-1734112723-4e7569323ce07fcec7dd7468c4e86acf7697446c-ea52e4879b01873d51c88ea929f2e85be9ce238f.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 325967d..466f4f4 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1734105425-4ee56ee39673ec9dcb778967f4194e2770bcb9f5-dc35b9ce374ffc5b8e275511d350da29f55e3698.profdata +chrome-mac-arm-main-1734127145-dc1ff5eed6c33cc810ed5168c0b91cf86055fb98-ea5f6440b59aef77b33a11f75a8b1ec8565cdf4b.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index f67a115f..fc96e44 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1734091137-c8c866c03f6b38884bdf8678702659fc14edd9bd-d83e960b676d9b7761163445d6e514f70dcf2719.profdata +chrome-mac-main-1734112723-dd95933d222ecc02ba3c09af9af86fe88e334b36-ea52e4879b01873d51c88ea929f2e85be9ce238f.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index ee7cc0d..367e9ff 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1734080359-8976ae3f6d95701ed7f36673d16a89ad3f25a561-8405b6a55abeab277cebb5414c7adc44af8c6cd5.profdata +chrome-win32-main-1734091137-679c78a63a5d6202673f1e8e136223a950574960-d83e960b676d9b7761163445d6e514f70dcf2719.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index d1a794b..a136bbf 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1734091137-c8d76cc8548ba49f32533d1f0e46e5dcbdfc62b1-d83e960b676d9b7761163445d6e514f70dcf2719.profdata +chrome-win64-main-1734101932-b0339d17e5595342ac97ef67e5d6d894e1558192-086dfea685bb9f04d9c61a2750d56f1963299248.profdata
diff --git a/chrome/chrome_paks.gni b/chrome/chrome_paks.gni index 96fd2a3f..b2ad1a98 100644 --- a/chrome/chrome_paks.gni +++ b/chrome/chrome_paks.gni
@@ -117,6 +117,7 @@ "$root_gen_dir/components/autofill/core/browser/autofill_address_rewriter_resources.pak", "$root_gen_dir/components/chrome_urls_resources.pak", "$root_gen_dir/components/components_resources.pak", + "$root_gen_dir/components/crashes_resources.pak", "$root_gen_dir/components/flags_ui_resources.pak", "$root_gen_dir/components/metrics/metrics_server_urls.pak", "$root_gen_dir/components/version_ui_resources.pak",
diff --git a/chrome/common/compose/type_conversions.cc b/chrome/common/compose/type_conversions.cc index 3207e89b..7a3fd6ef 100644 --- a/chrome/common/compose/type_conversions.cc +++ b/chrome/common/compose/type_conversions.cc
@@ -8,30 +8,32 @@ using ModelExecutionError = optimization_guide:: OptimizationGuideModelExecutionError::ModelExecutionError; -optimization_guide::proto::ComposeLength ComposeLength( +optimization_guide::proto::features::ComposeLength ComposeLength( compose::mojom::StyleModifier modifier) { switch (modifier) { case compose::mojom::StyleModifier::kShorter: - return optimization_guide::proto::ComposeLength::COMPOSE_SHORTER; + return optimization_guide::proto::features::ComposeLength:: + COMPOSE_SHORTER; case compose::mojom::StyleModifier::kLonger: - return optimization_guide::proto::ComposeLength::COMPOSE_LONGER; + return optimization_guide::proto::features::ComposeLength::COMPOSE_LONGER; case compose::mojom::StyleModifier::kUnset: default: - return optimization_guide::proto::ComposeLength:: + return optimization_guide::proto::features::ComposeLength:: COMPOSE_UNSPECIFIED_LENGTH; } } -optimization_guide::proto::ComposeTone ComposeTone( +optimization_guide::proto::features::ComposeTone ComposeTone( compose::mojom::StyleModifier modifier) { switch (modifier) { case compose::mojom::StyleModifier::kCasual: - return optimization_guide::proto::ComposeTone::COMPOSE_INFORMAL; + return optimization_guide::proto::features::ComposeTone::COMPOSE_INFORMAL; case compose::mojom::StyleModifier::kFormal: - return optimization_guide::proto::ComposeTone::COMPOSE_FORMAL; + return optimization_guide::proto::features::ComposeTone::COMPOSE_FORMAL; case compose::mojom::StyleModifier::kUnset: default: - return optimization_guide::proto::ComposeTone::COMPOSE_UNSPECIFIED_TONE; + return optimization_guide::proto::features::ComposeTone:: + COMPOSE_UNSPECIFIED_TONE; } } @@ -67,32 +69,35 @@ } } -optimization_guide::proto::UserFeedback OptimizationFeedbackFromComposeFeedback( - compose::mojom::UserFeedback feedback) { +optimization_guide::proto::features::UserFeedback +OptimizationFeedbackFromComposeFeedback(compose::mojom::UserFeedback feedback) { switch (feedback) { case compose::mojom::UserFeedback::kUserFeedbackPositive: - return optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_UP; + return optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_UP; case compose::mojom::UserFeedback::kUserFeedbackNegative: - return optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN; + return optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN; default: - return optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + return optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED; } } -optimization_guide::proto::ComposeUpfrontInputMode ComposeUpfrontInputMode( - compose::mojom::InputMode mode) { +optimization_guide::proto::features::ComposeUpfrontInputMode +ComposeUpfrontInputMode(compose::mojom::InputMode mode) { switch (mode) { case compose::mojom::InputMode::kPolish: - return optimization_guide::proto::ComposeUpfrontInputMode:: + return optimization_guide::proto::features::ComposeUpfrontInputMode:: COMPOSE_POLISH_MODE; case compose::mojom::InputMode::kElaborate: - return optimization_guide::proto::ComposeUpfrontInputMode:: + return optimization_guide::proto::features::ComposeUpfrontInputMode:: COMPOSE_ELABORATE_MODE; case compose::mojom::InputMode::kFormalize: - return optimization_guide::proto::ComposeUpfrontInputMode:: + return optimization_guide::proto::features::ComposeUpfrontInputMode:: COMPOSE_FORMALIZE_MODE; case compose::mojom::InputMode::kUnset: - return optimization_guide::proto::ComposeUpfrontInputMode:: + return optimization_guide::proto::features::ComposeUpfrontInputMode:: COMPOSE_UNSPECIFIED_MODE; } }
diff --git a/chrome/common/compose/type_conversions.h b/chrome/common/compose/type_conversions.h index 6d568d12..0ce98ce 100644 --- a/chrome/common/compose/type_conversions.h +++ b/chrome/common/compose/type_conversions.h
@@ -8,15 +8,15 @@ #include "chrome/common/compose/compose.mojom.h" #include "components/optimization_guide/core/optimization_guide_model_executor.h" #include "components/optimization_guide/proto/features/compose.pb.h" -optimization_guide::proto::ComposeLength ComposeLength( +optimization_guide::proto::features::ComposeLength ComposeLength( compose::mojom::StyleModifier modifier); -optimization_guide::proto::ComposeTone ComposeTone( +optimization_guide::proto::features::ComposeTone ComposeTone( compose::mojom::StyleModifier modifier); compose::mojom::ComposeStatus ComposeStatusFromOptimizationGuideResult( const optimization_guide::OptimizationGuideModelStreamingExecutionResult& result); -optimization_guide::proto::UserFeedback OptimizationFeedbackFromComposeFeedback( - compose::mojom::UserFeedback feedback); -optimization_guide::proto::ComposeUpfrontInputMode ComposeUpfrontInputMode( - compose::mojom::InputMode mode); +optimization_guide::proto::features::UserFeedback +OptimizationFeedbackFromComposeFeedback(compose::mojom::UserFeedback feedback); +optimization_guide::proto::features::ComposeUpfrontInputMode +ComposeUpfrontInputMode(compose::mojom::InputMode mode); #endif // CHROME_COMMON_COMPOSE_TYPE_CONVERSIONS_H_
diff --git a/chrome/common/extensions/api/developer_private.idl b/chrome/common/extensions/api/developer_private.idl index 10668d4..d43dd53 100644 --- a/chrome/common/extensions/api/developer_private.idl +++ b/chrome/common/extensions/api/developer_private.idl
@@ -877,6 +877,11 @@ // Triggers the dismissal of the mv2 deprecation notice for `extensionId`. static void dismissMv2DeprecationNoticeForExtension(DOMString extensionId); + // Uploads an extension to the signed in user's account. If the extension is + // not eligible for upload or if there is no signed in user, returns an + // error. + static void uploadExtensionToAccount(DOMString extensionId); + [nocompile, deprecated="Use openDevTools"] static void inspect(InspectOptions options, optional VoidCallback callback);
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 9850ba2..fa58f81 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -3257,6 +3257,9 @@ "glic.launcher_global_hotkey"; #endif // BUILDFLAG(ENABLE_GLIC) +// An enum that controls what level of toasts we show to the user. +inline constexpr char kToastAlertLevel[] = "settings.toast.alert_level"; + // *************** SERVICE PREFS *************** // These are attached to the service process.
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index f2812417..7d8ae84 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -4503,6 +4503,7 @@ "../browser/ui/views/extensions/dialogs/mv2_deprecation_reenable_dialog_browsertest.cc", "../browser/ui/views/extensions/dialogs/reload_page_dialog_browsertest.cc", "../browser/ui/views/extensions/dialogs/settings_overridden_dialog_browsertest.cc", + "../browser/ui/views/extensions/dialogs/upload_extension_to_account_dialog_browsertest.cc", "../browser/ui/views/extensions/extension_install_blocked_dialog_view_browsertest.cc", "../browser/ui/views/extensions/extension_install_dialog_view_browsertest.cc", "../browser/ui/views/extensions/extension_install_friction_dialog_view_browsertest.cc", @@ -9820,6 +9821,7 @@ "../browser/ui/views/tabs/fake_tab_slot_controller.h", "../browser/ui/views/tabs/overflow_view_unittest.cc", "../browser/ui/views/tabs/tab_container_unittest.cc", + "../browser/ui/views/tabs/tab_glic_container_unittest.cc", "../browser/ui/views/tabs/tab_group_views_unittest.cc", "../browser/ui/views/tabs/tab_hover_card_bubble_view_unittest.cc", "../browser/ui/views/tabs/tab_hover_card_controller_unittest.cc",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/transit/hub/NewTabGroupDialogFacility.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/transit/hub/NewTabGroupDialogFacility.java index a81588f1..ee515d7d 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/transit/hub/NewTabGroupDialogFacility.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/transit/hub/NewTabGroupDialogFacility.java
@@ -97,11 +97,11 @@ if (mSelectedColor != null) { elements.declareView( colorPickerIconSpec(color, color.equals(mSelectedColor)), - ViewElement.unscopedOption()); + ViewElement.newOptions().unscoped().displayingAtLeast(10).build()); } else { elements.declareView( colorPickerIconSpec(color, /* selected= */ null), - ViewElement.unscopedOption()); + ViewElement.newOptions().unscoped().displayingAtLeast(10).build()); } }
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/transit/hub/TabGroupDialogFacility.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/transit/hub/TabGroupDialogFacility.java index 15a50c4..fec6121 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/transit/hub/TabGroupDialogFacility.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/transit/hub/TabGroupDialogFacility.java
@@ -25,8 +25,10 @@ import org.chromium.base.test.transit.Elements; import org.chromium.base.test.transit.Facility; import org.chromium.base.test.transit.Station; +import org.chromium.base.test.transit.ViewElement; import org.chromium.base.test.transit.ViewSpec; import org.chromium.chrome.browser.ChromeTabbedActivity; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.test.R; import org.chromium.chrome.test.transit.ntp.IncognitoNewTabPageStation; import org.chromium.chrome.test.transit.ntp.RegularNewTabPageStation; @@ -60,6 +62,8 @@ public static final ViewSpec BACK_BUTTON = viewSpec(withId(R.id.toolbar_back_button), TOOLBAR_MATCHER); public static final ViewSpec LIST_MENU_BUTTON = viewSpec(withId(R.id.toolbar_menu_button)); + public static final ViewSpec SHARE_BUTTON = + viewSpec(withId(R.id.share_button), TOOLBAR_MATCHER); private final List<Integer> mTabIdsInGroup; private final String mTitle; @@ -100,7 +104,14 @@ elements.declareView(mTitleInputSpec); elements.declareView(NEW_TAB_BUTTON); elements.declareView(BACK_BUTTON); - elements.declareView(LIST_MENU_BUTTON); + if (ChromeFeatureList.isEnabled(ChromeFeatureList.DATA_SHARING)) { + elements.declareView(SHARE_BUTTON); + + // TODO(ckitagawa): Share button causes menu button to be slightly hidden. + elements.declareView(LIST_MENU_BUTTON, ViewElement.displayingAtLeastOption(51)); + } else { + elements.declareView(LIST_MENU_BUTTON); + } } /** Input a new group name. */
diff --git a/chrome/test/data/controlled_frame/webrequest_event_handlers.window.js b/chrome/test/data/controlled_frame/webrequest_event_handlers.window.js new file mode 100644 index 0000000..b684b720 --- /dev/null +++ b/chrome/test/data/controlled_frame/webrequest_event_handlers.window.js
@@ -0,0 +1,64 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// META script=resources/controlled_frame_helpers.js + +// This test expects WebRequest events to be triggered for a basic GET request +// inside Controlled Frame. 'onAuthRequired', 'onBeforeRedirect', +// 'onErrorOccurred' are expected to not trigger. + +// The list of WebRequest events. +const WebRequestEvents = [ + {name: 'onAuthRequired', shouldTrigger: false}, + {name: 'onBeforeRedirect', shouldTrigger: false}, + {name: 'onBeforeRequest', shouldTrigger: true}, + {name: 'onBeforeSendHeaders', shouldTrigger: true}, + {name: 'onCompleted', shouldTrigger: true}, + {name: 'onErrorOccurred', shouldTrigger: false}, + {name: 'onHeadersReceived', shouldTrigger: true}, + {name: 'onHeadersReceived', shouldTrigger: true}, + {name: 'onSendHeaders', shouldTrigger: true}, +]; + +promise_test(async (test) => { + const controlledframe = await createControlledFrame('/simple.html'); + controlledframe.stop(); + + for (const singleEvent of WebRequestEvents) { + const eventName = singleEvent.name; + window['count' + eventName] = 0; + const eventCounter = function() { + window['count' + this.name] += 1; + }; + + controlledframe.request[eventName].addListener( + eventCounter.bind({name: eventName}), {urls: ['<all_urls>']}); + } + + + const targetUrl = new URL(controlledframe.src); + targetUrl.pathname = '/handbag.png'; + + const script = `(async() => {await fetch('${ + targetUrl.toString()}', {method:'GET'});})();`; + await executeAsyncScript(controlledframe, script); + + for (singleEvent of WebRequestEvents) { + const eventName = singleEvent.name; + console.log( + `${eventName} triggered ${window['count' + eventName]} time(s).`); + + if (singleEvent.shouldTrigger) { + assert_true( + window['count' + eventName] > 0, + `Expected ${eventName} to trigger more than 0 times, but triggered ${ + window['count' + eventName]} time(s).`); + } else { + assert_true( + window['count' + eventName] == 0, + `Expected ${eventName} to trigger 0 times, but triggered ${ + window['count' + eventName]} time(s).`); + } + } +}, 'WebRequest Event Handlers');
diff --git a/chrome/test/data/webui/certificate_viewer_dialog/certificate_viewer_dialog_browsertest.cc b/chrome/test/data/webui/certificate_viewer_dialog/certificate_viewer_dialog_browsertest.cc index ee1a248..f2b60b6 100644 --- a/chrome/test/data/webui/certificate_viewer_dialog/certificate_viewer_dialog_browsertest.cc +++ b/chrome/test/data/webui/certificate_viewer_dialog/certificate_viewer_dialog_browsertest.cc
@@ -141,7 +141,7 @@ cert_metadata; cert_metadata.mutable_trust()->set_trust_type( chrome_browser_server_certificate_database::CertificateTrust:: - CERTIFICATE_TRUST_TYPE_UNSPECIFIED); + CERTIFICATE_TRUST_TYPE_TRUSTED); cert_metadata.mutable_constraints()->add_dns_names("example.com"); cert_metadata.mutable_constraints()->add_dns_names("domainname.com"); chrome_browser_server_certificate_database::CIDR* cidr = @@ -153,16 +153,67 @@ } }; -IN_PROC_BROWSER_TEST_F(CertificateViewerUIWithMetadataCertTest, CheckMetadata) { - RunTestCase("CheckMetadata"); +IN_PROC_BROWSER_TEST_F(CertificateViewerUIWithMetadataCertTest, + CheckMetadataNotEditable) { + RunTestCase("CheckMetadataNotEditable"); +} + +class CertificateViewerUIWithMetadataCertNoConstraintsTest + : public CertificateViewerUITest { + protected: + std::optional<chrome_browser_server_certificate_database::CertificateMetadata> + GetCertMetadata() override { + chrome_browser_server_certificate_database::CertificateMetadata + cert_metadata; + cert_metadata.mutable_trust()->set_trust_type( + chrome_browser_server_certificate_database::CertificateTrust:: + CERTIFICATE_TRUST_TYPE_TRUSTED); + return cert_metadata; + } +}; + +IN_PROC_BROWSER_TEST_F(CertificateViewerUIWithMetadataCertNoConstraintsTest, + CheckMetadataNotEditableNoConstraints) { + RunTestCase("CheckMetadataNotEditableNoConstraints"); +} + +class CertificateViewerUIWithMetadataCertEditNoConstraintsTest + : public CertificateViewerUITest { + public: + void ModifyCallback(net::ServerCertificateDatabase::CertInformation, + base::OnceCallback<void(bool)> callback) { + std::move(callback).Run(true); + } + + protected: + std::optional<chrome_browser_server_certificate_database::CertificateMetadata> + GetCertMetadata() override { + chrome_browser_server_certificate_database::CertificateMetadata + cert_metadata; + cert_metadata.mutable_trust()->set_trust_type( + chrome_browser_server_certificate_database::CertificateTrust:: + CERTIFICATE_TRUST_TYPE_TRUSTED); + return cert_metadata; + } + + CertMetadataModificationsCallback GetModificationsCallback() override { + return base::BindRepeating( + &CertificateViewerUIWithMetadataCertEditNoConstraintsTest:: + ModifyCallback, + base::Unretained(this)); + } +}; + +IN_PROC_BROWSER_TEST_F(CertificateViewerUIWithMetadataCertEditNoConstraintsTest, + CheckMetadataEditableNoConstraints) { + RunTestCase("CheckMetadataEditableNoConstraints"); } class CertificateViewerUIWithMetadataCertEditTest : public CertificateViewerUIWithMetadataCertTest { public: - void ModifyCallback(net::ServerCertificateDatabase::CertInformation cert_info, + void ModifyCallback(net::ServerCertificateDatabase::CertInformation, base::OnceCallback<void(bool)> callback) { - written_cert_info_ = std::move(cert_info); std::move(callback).Run(true); } @@ -172,39 +223,23 @@ &CertificateViewerUIWithMetadataCertEditTest::ModifyCallback, base::Unretained(this)); } - - net::ServerCertificateDatabase::CertInformation written_cert_info_; }; -// TODO(crbug.com/40928765): change to not test C++ code. // TODO(crbug.com/40928765): add C++ unit test of handler since Mocha tests are // meant to be unit tests of the TS/HTML/CSS code. IN_PROC_BROWSER_TEST_F(CertificateViewerUIWithMetadataCertEditTest, + CheckMetadataEditable) { + RunTestCase("CheckMetadataEditable"); +} + +IN_PROC_BROWSER_TEST_F(CertificateViewerUIWithMetadataCertEditTest, EditTrustState) { RunTestCase("EditTrustState"); +} - // Set up expected CertInformation - bssl::UniquePtr<CRYPTO_BUFFER> cert = GetCerts(); - ASSERT_TRUE(cert); - net::ServerCertificateDatabase::CertInformation cert_info; - cert_info.der_cert = - base::ToVector(net::x509_util::CryptoBufferAsSpan(cert.get())); - cert_info.sha256hash_hex = base::ToLowerASCII(base::HexEncode( - net::X509Certificate::CalculateFingerprint256(cert.get()).data)); - - cert_info.cert_metadata.mutable_trust()->set_trust_type( - chrome_browser_server_certificate_database::CertificateTrust:: - CERTIFICATE_TRUST_TYPE_TRUSTED); - cert_info.cert_metadata.mutable_constraints()->add_dns_names("example.com"); - cert_info.cert_metadata.mutable_constraints()->add_dns_names( - "domainname.com"); - chrome_browser_server_certificate_database::CIDR* cidr = - cert_info.cert_metadata.mutable_constraints()->add_cidrs(); - cidr->set_ip(std::string( - base::as_string_view(net::IPAddress::IPv4Localhost().bytes()))); - cidr->set_prefix_length(24); - - EXPECT_THAT(written_cert_info_, CertInfoEquals(std::ref(cert_info))); +IN_PROC_BROWSER_TEST_F(CertificateViewerUIWithMetadataCertEditTest, + EditTrustStateError) { + RunTestCase("EditTrustStateError"); } IN_PROC_BROWSER_TEST_F(CertificateViewerUIWithMetadataCertEditTest, @@ -236,24 +271,3 @@ DeleteConstraintError) { RunTestCase("DeleteConstraintError"); } - -class CertificateViewerUIWithMetadataCertEditErrorTest - : public CertificateViewerUIWithMetadataCertTest { - public: - void ModifyCallback(net::ServerCertificateDatabase::CertInformation cert_info, - base::OnceCallback<void(bool)> callback) { - std::move(callback).Run(false); - } - - protected: - CertMetadataModificationsCallback GetModificationsCallback() override { - return base::BindRepeating( - &CertificateViewerUIWithMetadataCertEditErrorTest::ModifyCallback, - base::Unretained(this)); - } -}; - -IN_PROC_BROWSER_TEST_F(CertificateViewerUIWithMetadataCertEditErrorTest, - EditTrustStateError) { - RunTestCase("EditTrustStateError"); -}
diff --git a/chrome/test/data/webui/certificate_viewer_dialog/certificate_viewer_dialog_test.ts b/chrome/test/data/webui/certificate_viewer_dialog/certificate_viewer_dialog_test.ts index 8e467a8..21c40893 100644 --- a/chrome/test/data/webui/certificate_viewer_dialog/certificate_viewer_dialog_test.ts +++ b/chrome/test/data/webui/certificate_viewer_dialog/certificate_viewer_dialog_test.ts
@@ -5,13 +5,12 @@ import type {CrIconButtonElement} from 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.js'; import type {CrTreeBaseElement} from 'chrome://resources/cr_elements/cr_tree/cr_tree_base.js'; import {assert} from 'chrome://resources/js/assert.js'; -import {sendWithPromise} from 'chrome://resources/js/cr.js'; import {getRequiredElement} from 'chrome://resources/js/util.js'; import {CertViewerBrowserProxyImpl} from 'chrome://view-cert/browser_proxy.js'; import type {CertMetadataChangeResult, CertViewerBrowserProxy, ConstraintChangeResult} from 'chrome://view-cert/browser_proxy.js'; import type {TreeItemDetail} from 'chrome://view-cert/certificate_viewer.js'; import {CertificateTrust} from 'chrome://view-cert/certificate_viewer.js'; -import type {ConstraintListElement} from 'chrome://view-cert/constraint_list.js'; +import type {ModificationsPanelElement} from 'chrome://view-cert/modifications_panel.js'; import {assertEquals, assertFalse, assertLT, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {TestBrowserProxy} from 'chrome://webui-test/test_browser_proxy.js'; import {eventToPromise, isVisible, microtasksFinished} from 'chrome://webui-test/test_util.js'; @@ -47,19 +46,27 @@ ]); } + private trustStateChangeResult: CertMetadataChangeResult = { + success: true, + }; + private constraintChangeResult: ConstraintChangeResult = { status: { success: true, }, }; + setTrustStateChangeResult(newChangeResult: CertMetadataChangeResult) { + this.trustStateChangeResult = newChangeResult; + } + setConstraintChangeResult(newChangeResult: ConstraintChangeResult) { this.constraintChangeResult = newChangeResult; } updateTrustState(newTrust: number): Promise<CertMetadataChangeResult> { this.methodCalled('updateTrustState', newTrust); - return sendWithPromise('updateTrustState', newTrust); + return Promise.resolve(this.trustStateChangeResult); } addConstraint(constraint: string): Promise<ConstraintChangeResult> { @@ -142,27 +149,106 @@ // Check for the default constraints that are set up in C++ for the // certificate. - function checkDefaultConstraints(constraintList: ConstraintListElement) { - assertEquals(3, constraintList.constraints.length); - assertTrue(constraintList.constraints.includes('example.com')); - assertTrue(constraintList.constraints.includes('domainname.com')); - assertTrue(constraintList.constraints.includes('127.0.0.1/24')); + function checkDefaultConstraints( + modificationsPanel: ModificationsPanelElement) { + assertEquals(3, modificationsPanel.constraints.length); + assertTrue(modificationsPanel.constraints.includes('example.com')); + assertTrue(modificationsPanel.constraints.includes('domainname.com')); + assertTrue(modificationsPanel.constraints.includes('127.0.0.1/24')); } - test('CheckMetadata', async function() { + test('CheckMetadataNotEditable', async function() { const modificationsTab = getRequiredElement('modifications-tab'); assertFalse(modificationsTab.hidden); + // Select the modifications tab to allow for visibility checks + getRequiredElement('tabbox').setAttribute('selected-index', '2'); - const trustStateSelector = - (getRequiredElement('trust-state-select') as HTMLSelectElement); + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); assertEquals( - CertificateTrust.CERTIFICATE_TRUST_UNSPECIFIED, - Number(trustStateSelector.value) as CertificateTrust); - assertTrue(trustStateSelector.disabled); + CertificateTrust.CERTIFICATE_TRUST_TRUSTED, + Number(modificationsPanel.$.trustStateSelect.value) as + CertificateTrust); + assertTrue(modificationsPanel.$.trustStateSelect.disabled); - const constraintList = - (getRequiredElement('constraints') as ConstraintListElement); - checkDefaultConstraints(constraintList); + checkDefaultConstraints(modificationsPanel); + assertFalse(isVisible(modificationsPanel.$.addConstraintSection)); + assertTrue(isVisible(modificationsPanel.$.constraintListSection)); + const deleteButton = + modificationsPanel.shadowRoot!.querySelector<CrIconButtonElement>( + '#constraint-delete-0'); + assert(deleteButton); + assertFalse(isVisible(deleteButton)); + }); + + test('CheckMetadataNotEditableNoConstraints', async function() { + const modificationsTab = getRequiredElement('modifications-tab'); + assertFalse(modificationsTab.hidden); + // Select the modifications tab to allow for visibility checks + getRequiredElement('tabbox').setAttribute('selected-index', '2'); + + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); + assertEquals( + CertificateTrust.CERTIFICATE_TRUST_TRUSTED, + Number(modificationsPanel.$.trustStateSelect.value) as + CertificateTrust); + assertTrue(modificationsPanel.$.trustStateSelect.disabled); + + assertFalse(isVisible(modificationsPanel.$.constraintListSection)); + assertFalse(isVisible(modificationsPanel.$.addConstraintSection)); + }); + + test('CheckMetadataEditable', async function() { + const modificationsTab = getRequiredElement('modifications-tab'); + assertFalse(modificationsTab.hidden); + // Select the modifications tab to allow for visibility checks + getRequiredElement('tabbox').setAttribute('selected-index', '2'); + + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); + assertEquals( + CertificateTrust.CERTIFICATE_TRUST_TRUSTED, + Number(modificationsPanel.$.trustStateSelect.value) as + CertificateTrust); + assertFalse(modificationsPanel.$.trustStateSelect.disabled); + + checkDefaultConstraints(modificationsPanel); + assertTrue(isVisible(modificationsPanel.$.addConstraintSection)); + assertFalse(modificationsPanel.$.addConstraintButton.disabled); + assertTrue(isVisible(modificationsPanel.$.constraintListSection)); + const deleteButton = + modificationsPanel.shadowRoot!.querySelector<CrIconButtonElement>( + '#constraint-delete-0'); + assert(deleteButton); + assertTrue(isVisible(deleteButton)); + assertFalse(deleteButton.disabled); + }); + + test('CheckMetadataEditableNoConstraints', async function() { + const modificationsTab = getRequiredElement('modifications-tab'); + assertFalse(modificationsTab.hidden); + // Select the modifications tab to allow for visibility checks + getRequiredElement('tabbox').setAttribute('selected-index', '2'); + + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); + assertEquals( + CertificateTrust.CERTIFICATE_TRUST_TRUSTED, + Number(modificationsPanel.$.trustStateSelect.value) as + CertificateTrust); + assertFalse(modificationsPanel.$.trustStateSelect.disabled); + + // Can add constraints + assertTrue(isVisible(modificationsPanel.$.addConstraintSection)); + assertFalse(modificationsPanel.$.addConstraintButton.disabled); + // No constraints to see, hide the list. + assertEquals(0, modificationsPanel.constraints.length); + assertFalse(isVisible(modificationsPanel.$.constraintListSection)); }); test('EditTrustState', async function() { @@ -171,67 +257,89 @@ const modificationsTab = getRequiredElement('modifications-tab'); assertFalse(modificationsTab.hidden); + // Select the modifications tab to allow for visibility checks + getRequiredElement('tabbox').setAttribute('selected-index', '2'); - const trustStateSelector = - (getRequiredElement('trust-state-select') as HTMLSelectElement); + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); assertEquals( - CertificateTrust.CERTIFICATE_TRUST_UNSPECIFIED, - Number(trustStateSelector.value) as CertificateTrust); - assertFalse(trustStateSelector.disabled); - const trustStateErrorMessage = - (getRequiredElement('trust-state-select-error') as HTMLElement); - assertTrue(trustStateErrorMessage.classList.contains('hide-error')); + CertificateTrust.CERTIFICATE_TRUST_TRUSTED, + Number(modificationsPanel.$.trustStateSelect.value) as + CertificateTrust); + assertFalse(modificationsPanel.$.trustStateSelect.disabled); + assertFalse(isVisible(modificationsPanel.$.trustStateSelectError)); - trustStateSelector.value = - (CertificateTrust.CERTIFICATE_TRUST_TRUSTED as number).toString(); + modificationsPanel.$.trustStateSelect.value = + (CertificateTrust.CERTIFICATE_TRUST_UNSPECIFIED as number).toString(); // Changing the value with javascript doesn't trigger the change event; // trigger the event manually. - trustStateSelector.dispatchEvent(new Event('change')); + modificationsPanel.$.trustStateSelect.dispatchEvent(new Event('change')); await testBrowserProxy.whenCalled('updateTrustState'); + await microtasksFinished(); - const changeFinished = trustStateSelector.disabled ? - eventToPromise( - 'trust-state-change-finished-for-testing', document.body) : - Promise.resolve(); - await changeFinished; - - assertTrue(trustStateErrorMessage.classList.contains('hide-error')); + assertFalse(isVisible(modificationsPanel.$.trustStateSelectError)); + assertEquals( + modificationsPanel.trustStateValue, + (CertificateTrust.CERTIFICATE_TRUST_UNSPECIFIED as number).toString()); + // Changing trust to unspecified should remove visibility of constraints + // sections. + assertFalse( + isVisible(modificationsPanel.$.constraintListSection), 'visible 1'); + assertFalse( + isVisible(modificationsPanel.$.addConstraintSection), 'visible 2'); }); test('EditTrustStateError', async function() { const testBrowserProxy = new TestCertViewerBrowserProxy(); CertViewerBrowserProxyImpl.setInstance(testBrowserProxy); + testBrowserProxy.setTrustStateChangeResult({ + success: false, + errorMessage: 'error message', + }); const modificationsTab = getRequiredElement('modifications-tab'); assertFalse(modificationsTab.hidden); + // Select the modifications tab to allow for visibility checks + getRequiredElement('tabbox').setAttribute('selected-index', '2'); - const trustStateSelector = - (getRequiredElement('trust-state-select') as HTMLSelectElement); + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); assertEquals( - CertificateTrust.CERTIFICATE_TRUST_UNSPECIFIED, - Number(trustStateSelector.value) as CertificateTrust); - assertFalse(trustStateSelector.disabled); - const trustStateErrorMessage = - (getRequiredElement('trust-state-select-error') as HTMLElement); - assertTrue(trustStateErrorMessage.classList.contains('hide-error')); + CertificateTrust.CERTIFICATE_TRUST_TRUSTED, + Number(modificationsPanel.$.trustStateSelect.value) as + CertificateTrust); + assertFalse(modificationsPanel.$.trustStateSelect.disabled); + assertTrue(isVisible(modificationsPanel), 'modifications tab not visible'); + assertTrue( + isVisible(modificationsPanel.$.trustStateSelect), + 'trust state selector not visible'); + assertFalse(isVisible(modificationsPanel.$.trustStateSelectError)); - trustStateSelector.value = - (CertificateTrust.CERTIFICATE_TRUST_TRUSTED as number).toString(); + modificationsPanel.$.trustStateSelect.value = + (CertificateTrust.CERTIFICATE_TRUST_UNSPECIFIED as number).toString(); // Changing the value with javascript doesn't trigger the change event; // trigger the event manually. - trustStateSelector.dispatchEvent(new Event('change')); + modificationsPanel.$.trustStateSelect.dispatchEvent(new Event('change')); await testBrowserProxy.whenCalled('updateTrustState'); + await microtasksFinished(); - const changeFinished = trustStateSelector.disabled ? - eventToPromise( - 'trust-state-change-finished-for-testing', document.body) : - Promise.resolve(); - await changeFinished; - - assertFalse(trustStateErrorMessage.classList.contains('hide-error')); + assertTrue(isVisible(modificationsPanel.$.trustStateSelectError)); assertEquals( - trustStateErrorMessage.innerText, - 'There was an error saving the trust state change'); + modificationsPanel.$.trustStateSelectError.innerText.trim(), + 'error message'); + assertEquals( + modificationsPanel.trustStateValue, + (CertificateTrust.CERTIFICATE_TRUST_TRUSTED as number).toString()); + assertEquals( + modificationsPanel.$.trustStateSelect.value, + (CertificateTrust.CERTIFICATE_TRUST_TRUSTED as number).toString()); + // Trust didn't change, so constraints sections should still be visible. + assertTrue( + isVisible(modificationsPanel.$.constraintListSection), 'visible 1'); + assertTrue( + isVisible(modificationsPanel.$.addConstraintSection), 'visible 2'); }); test('AddConstraintDNS', async function() { @@ -244,21 +352,25 @@ const modificationsTab = getRequiredElement('modifications-tab'); assertFalse(modificationsTab.hidden); + getRequiredElement('tabbox').setAttribute('selected-index', '2'); - const constraintList = - (getRequiredElement('constraints') as ConstraintListElement); - checkDefaultConstraints(constraintList); + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); + checkDefaultConstraints(modificationsPanel); - constraintList.$.addConstraintInput.value = 'foo.com'; - constraintList.$.addConstraintButton.click(); + modificationsPanel.$.addConstraintInput.value = 'foo.com'; + modificationsPanel.$.addConstraintButton.click(); await testBrowserProxy.whenCalled('addConstraint'); await microtasksFinished(); - assertEquals(4, constraintList.constraints.length); - assertTrue(constraintList.constraints.includes('example.com')); - assertTrue(constraintList.constraints.includes('foo.com')); - assertTrue(constraintList.constraints.includes('domainname.com')); - assertTrue(constraintList.constraints.includes('127.0.0.1/24')); + assertEquals(4, modificationsPanel.constraints.length); + assertTrue(modificationsPanel.constraints.includes('example.com')); + assertTrue(modificationsPanel.constraints.includes('foo.com')); + assertTrue(modificationsPanel.constraints.includes('domainname.com')); + assertTrue(modificationsPanel.constraints.includes('127.0.0.1/24')); + assertFalse(modificationsPanel.$.addConstraintInput.invalid); + assertEquals(modificationsPanel.$.addConstraintInput.value, ''); }); test('AddConstraintCIDR', async function() { @@ -272,21 +384,25 @@ const modificationsTab = getRequiredElement('modifications-tab'); assertFalse(modificationsTab.hidden); + getRequiredElement('tabbox').setAttribute('selected-index', '2'); - const constraintList = - (getRequiredElement('constraints') as ConstraintListElement); - checkDefaultConstraints(constraintList); + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); + checkDefaultConstraints(modificationsPanel); - constraintList.$.addConstraintInput.value = '10.10.0.0/15'; - constraintList.$.addConstraintButton.click(); + modificationsPanel.$.addConstraintInput.value = '10.10.0.0/15'; + modificationsPanel.$.addConstraintButton.click(); await testBrowserProxy.whenCalled('addConstraint'); await microtasksFinished(); - assertEquals(4, constraintList.constraints.length); - assertTrue(constraintList.constraints.includes('example.com')); - assertTrue(constraintList.constraints.includes('domainname.com')); - assertTrue(constraintList.constraints.includes('127.0.0.1/24')); - assertTrue(constraintList.constraints.includes('10.10.0.0/15')); + assertEquals(4, modificationsPanel.constraints.length); + assertTrue(modificationsPanel.constraints.includes('example.com')); + assertTrue(modificationsPanel.constraints.includes('domainname.com')); + assertTrue(modificationsPanel.constraints.includes('127.0.0.1/24')); + assertTrue(modificationsPanel.constraints.includes('10.10.0.0/15')); + assertFalse(modificationsPanel.$.addConstraintInput.invalid); + assertEquals(modificationsPanel.$.addConstraintInput.value, ''); }); test('AddConstraintError', async function() { @@ -301,22 +417,25 @@ const modificationsTab = getRequiredElement('modifications-tab'); assertFalse(modificationsTab.hidden); + getRequiredElement('tabbox').setAttribute('selected-index', '2'); - const constraintList = - (getRequiredElement('constraints') as ConstraintListElement); - checkDefaultConstraints(constraintList); + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); + checkDefaultConstraints(modificationsPanel); - constraintList.$.addConstraintInput.value = 'foo.com'; - constraintList.$.addConstraintButton.click(); + modificationsPanel.$.addConstraintInput.value = 'foo.com'; + modificationsPanel.$.addConstraintButton.click(); await testBrowserProxy.whenCalled('addConstraint'); await microtasksFinished(); // Constraints should not have changed. - checkDefaultConstraints(constraintList); + checkDefaultConstraints(modificationsPanel); // Error message should be set on the input - assertTrue(constraintList.$.addConstraintInput.invalid); + assertTrue(modificationsPanel.$.addConstraintInput.invalid); assertEquals( - constraintList.$.addConstraintInput.errorMessage, 'error message'); + modificationsPanel.$.addConstraintInput.errorMessage, 'error message'); + assertEquals(modificationsPanel.$.addConstraintInput.value, 'foo.com'); }); test('DeleteConstraintDNS', async function() { @@ -329,13 +448,15 @@ const modificationsTab = getRequiredElement('modifications-tab'); assertFalse(modificationsTab.hidden); + getRequiredElement('tabbox').setAttribute('selected-index', '2'); - const constraintList = - (getRequiredElement('constraints') as ConstraintListElement); - checkDefaultConstraints(constraintList); + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); + checkDefaultConstraints(modificationsPanel); const deleteButton = - constraintList.shadowRoot!.querySelector<CrIconButtonElement>( + modificationsPanel.shadowRoot!.querySelector<CrIconButtonElement>( '#constraint-delete-0'); assert(deleteButton); const deleteConstraint = @@ -348,13 +469,15 @@ await microtasksFinished(); assertEquals( - 2, constraintList.constraints.length, - 'too long: ' + constraintList.constraints.length); + 2, modificationsPanel.constraints.length, + 'too long: ' + modificationsPanel.constraints.length); assertTrue( - constraintList.constraints.includes('domainname.com'), + modificationsPanel.constraints.includes('domainname.com'), 'missing domainname.com'); assertTrue( - constraintList.constraints.includes('127.0.0.1/24'), 'missing cidr'); + modificationsPanel.constraints.includes('127.0.0.1/24'), + 'missing cidr'); + assertFalse(isVisible(modificationsPanel.$.constraintDeleteError)); }); test('DeleteConstraintCIDR', async function() { @@ -367,13 +490,15 @@ const modificationsTab = getRequiredElement('modifications-tab'); assertFalse(modificationsTab.hidden); + getRequiredElement('tabbox').setAttribute('selected-index', '2'); - const constraintList = - (getRequiredElement('constraints') as ConstraintListElement); - checkDefaultConstraints(constraintList); + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); + checkDefaultConstraints(modificationsPanel); const deleteButton = - constraintList.shadowRoot!.querySelector<CrIconButtonElement>( + modificationsPanel.shadowRoot!.querySelector<CrIconButtonElement>( '#constraint-delete-2'); assert(deleteButton); const deleteConstraint = @@ -385,9 +510,10 @@ await testBrowserProxy.whenCalled('deleteConstraint'); await microtasksFinished(); - assertEquals(2, constraintList.constraints.length); - assertTrue(constraintList.constraints.includes('example.com')); - assertTrue(constraintList.constraints.includes('domainname.com')); + assertEquals(2, modificationsPanel.constraints.length); + assertTrue(modificationsPanel.constraints.includes('example.com')); + assertTrue(modificationsPanel.constraints.includes('domainname.com')); + assertFalse(isVisible(modificationsPanel.$.constraintDeleteError)); }); test('DeleteConstraintError', async function() { @@ -402,15 +528,16 @@ const modificationsTab = getRequiredElement('modifications-tab'); assertFalse(modificationsTab.hidden); - // Select the modifications tab getRequiredElement('tabbox').setAttribute('selected-index', '2'); - const constraintList = - (getRequiredElement('constraints') as ConstraintListElement); - checkDefaultConstraints(constraintList); + const modificationsPanel = + (getRequiredElement('modifications-panel') as + ModificationsPanelElement); + checkDefaultConstraints(modificationsPanel); + assertFalse(isVisible(modificationsPanel.$.constraintDeleteError)); const deleteButton = - constraintList.shadowRoot!.querySelector<CrIconButtonElement>( + modificationsPanel.shadowRoot!.querySelector<CrIconButtonElement>( '#constraint-delete-0'); assert(deleteButton); const deleteConstraint = @@ -423,10 +550,11 @@ await microtasksFinished(); // Constraints should not have changed. - checkDefaultConstraints(constraintList); - assertTrue(isVisible(constraintList.$.constraintDeleteError)); + checkDefaultConstraints(modificationsPanel); + assertTrue( + isVisible(modificationsPanel.$.constraintDeleteError), 'not visible'); assertEquals( - constraintList.$.constraintDeleteError.innerText.trim(), - 'error message'); + modificationsPanel.$.constraintDeleteError.innerText.trim(), + 'error message', 'error message not equal'); }); });
diff --git a/chrome/test/data/webui/extensions/detail_view_test.ts b/chrome/test/data/webui/extensions/detail_view_test.ts index 953edb65..a27533e 100644 --- a/chrome/test/data/webui/extensions/detail_view_test.ts +++ b/chrome/test/data/webui/extensions/detail_view_test.ts
@@ -1038,5 +1038,9 @@ testVisible(item, '#account-upload-button', false); await updateItemData({canUploadAsAccountExtension: true}); testVisible(item, '#account-upload-button', true); + + await mockDelegate.testClickingCalls( + item.shadowRoot!.querySelector<HTMLElement>('#account-upload-button')!, + 'uploadItemToAccount', [item.data.id]); }); });
diff --git a/chrome/test/data/webui/extensions/item_test.ts b/chrome/test/data/webui/extensions/item_test.ts index 3dae808..ad70e2fb 100644 --- a/chrome/test/data/webui/extensions/item_test.ts +++ b/chrome/test/data/webui/extensions/item_test.ts
@@ -691,5 +691,9 @@ item.data = data; await microtasksFinished(); testVisible(item, '#account-upload-button', true); + + await mockDelegate.testClickingCalls( + item.shadowRoot!.querySelector<HTMLElement>('#account-upload-button')!, + 'uploadItemToAccount', [item.data.id]); }); });
diff --git a/chrome/test/data/webui/extensions/test_service.ts b/chrome/test/data/webui/extensions/test_service.ts index 48777b1e..ded3144 100644 --- a/chrome/test/data/webui/extensions/test_service.ts +++ b/chrome/test/data/webui/extensions/test_service.ts
@@ -78,6 +78,7 @@ 'updateExtensionCommandKeybinding', 'updateExtensionCommandScope', 'updateSiteAccess', + 'uploadItemToAccount', ]); } @@ -406,4 +407,9 @@ dismissMv2DeprecationNotice() { this.methodCalled('dismissMv2DeprecationNotice'); } + + uploadItemToAccount(id: string) { + this.methodCalled('uploadItemToAccount', id); + return Promise.resolve(); + } }
diff --git a/chrome/test/data/webui/extensions/test_util.ts b/chrome/test/data/webui/extensions/test_util.ts index 09d315c87..673cd49c 100644 --- a/chrome/test/data/webui/extensions/test_util.ts +++ b/chrome/test/data/webui/extensions/test_util.ts
@@ -107,6 +107,9 @@ setItemPinnedToToolbar(_id: string, _pinnedToToolbar: boolean) {} inspectItemView(_id: string, _view: chrome.developerPrivate.ExtensionView) {} openUrl(_url: string) {} + uploadItemToAccount(_id: string) { + return Promise.resolve(); + } reloadItem(_id: string) {
diff --git a/chrome/test/data/webui/new_tab_page/middle_slot_promo_test.ts b/chrome/test/data/webui/new_tab_page/middle_slot_promo_test.ts index 0ab31d0..1ec7419e 100644 --- a/chrome/test/data/webui/new_tab_page/middle_slot_promo_test.ts +++ b/chrome/test/data/webui/new_tab_page/middle_slot_promo_test.ts
@@ -27,6 +27,7 @@ let promoBrowserCommandHandler: TestMock<CommandHandlerRemote>; let callbackRouterRemote: PageRemote; let metrics: MetricsTracker; + let middleSlotPromo: MiddleSlotPromoElement; setup(() => { document.body.innerHTML = window.trustedTypes!.emptyHTML; @@ -84,12 +85,11 @@ } async function createMiddleSlotPromo( - canShowPromo: boolean, - hasPromoId: boolean = true): Promise<MiddleSlotPromoElement> { + canShowPromo: boolean, hasPromoId: boolean = true) { promoBrowserCommandHandler.setResultFor( 'canExecuteCommand', Promise.resolve({canExecute: canShowPromo})); - const middleSlotPromo = document.createElement('ntp-middle-slot-promo'); + middleSlotPromo = document.createElement('ntp-middle-slot-promo'); document.body.appendChild(middleSlotPromo); const loaded = eventToPromise('ntp-middle-slot-promo-loaded', document.body); @@ -110,69 +110,62 @@ assertEquals(0, newTabPageHandler.getCallCount('onPromoRendered')); } await loaded; - return middleSlotPromo; } - function assertHasContent( - hasContent: boolean, middleSlotPromo: MiddleSlotPromoElement) { + async function createMiddleSlotPromoWithData() { + await createMiddleSlotPromo(/*canShowPromo=*/ true, /*hasPromoId=*/ true); + } + + function assertMiddleSlotPromoHasContent(hasContent: boolean) { assertEquals( hasContent, isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertEquals(hasContent, !!$$(middleSlotPromo, '#promoContainer')); } test('render canShowPromo=true', async () => { - const canShowPromo = true; - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); - assertHasContent(canShowPromo, middleSlotPromo); + // Create the promo and get the container element. + await createMiddleSlotPromoWithData(); + assertMiddleSlotPromoHasContent(true); const promoContainer = $$(middleSlotPromo, '#promoContainer'); assertTrue(!!promoContainer); + + // Verify that the promo container populated correctly. const parts = promoContainer.children; assertEquals(6, parts.length); - const image = parts[0] as CrAutoImgElement; - const imageWithLink = parts[1] as HTMLAnchorElement; - const imageWithCommand = parts[2] as HTMLAnchorElement; - const text = parts[3] as HTMLElement; - const link = parts[4] as HTMLAnchorElement; - const command = parts[5] as HTMLAnchorElement; - assertEquals('https://image', image.autoSrc); - + const imageWithLink = parts[1] as HTMLAnchorElement; assertEquals('https://link/', imageWithLink.href); assertEquals( 'https://image', (imageWithLink.children[0] as CrAutoImgElement).autoSrc); - + const imageWithCommand = parts[2] as HTMLAnchorElement; assertEquals('', imageWithCommand.href); assertEquals( 'https://image', (imageWithCommand.children[0] as CrAutoImgElement).autoSrc); - + const text = parts[3] as HTMLElement; assertEquals('text', text.innerText); - + const link = parts[4] as HTMLAnchorElement; assertEquals('https://link/', link.href); assertEquals('link', link.innerText); - + const command = parts[5] as HTMLAnchorElement; assertEquals('', command.href); assertEquals('command', command.text); }); test('render canShowPromo=false', async () => { const canShowPromo = false; - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); - assertHasContent(canShowPromo, middleSlotPromo); + await createMiddleSlotPromo(canShowPromo); + assertMiddleSlotPromoHasContent(canShowPromo); }); test('clicking on command', async () => { - const canShowPromo = true; - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); - assertHasContent(canShowPromo, middleSlotPromo); + await createMiddleSlotPromoWithData(); promoBrowserCommandHandler.setResultFor( 'executeCommand', Promise.resolve()); const promoContainer = $$(middleSlotPromo, '#promoContainer'); assertTrue(!!promoContainer); - const imageWithCommand = promoContainer.children[2] as HTMLElement; - const command = promoContainer.children[5] as HTMLElement; async function testClick(el: HTMLElement) { promoBrowserCommandHandler.reset(); @@ -194,7 +187,9 @@ expectedClickInfo); } + const imageWithCommand = promoContainer.children[2] as HTMLElement; await testClick(imageWithCommand); + const command = promoContainer.children[5] as HTMLElement; await testClick(command); }); @@ -205,28 +200,31 @@ }); }); + async function clickDismissPromoButton( + middleSlotPromo: MiddleSlotPromoElement) { + const parts = middleSlotPromo.$.promoAndDismissContainer.children; + assertEquals(2, parts.length); + const dismissPromoButton = parts[1] as HTMLElement; + dismissPromoButton.click(); + await microtasksFinished(); + } + test(`dismiss button doesn't show if there is no promo id`, async () => { const canShowPromo = true; const hasPromoId = false; - const middleSlotPromo = - await createMiddleSlotPromo(canShowPromo, hasPromoId); - assertHasContent(canShowPromo, middleSlotPromo); + await createMiddleSlotPromo(canShowPromo, hasPromoId); + const parts = middleSlotPromo.$.promoAndDismissContainer.children; assertEquals(1, parts.length); - - const promoContainer = parts[0] as HTMLElement; - assertEquals(6, promoContainer.children.length); + assertEquals(parts[0]!.id, 'promoContainer'); }); test('clicking dismiss button dismisses promo', async () => { - const canShowPromo = true; - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); - assertHasContent(canShowPromo, middleSlotPromo); - const parts = middleSlotPromo.$.promoAndDismissContainer.children; - assertEquals(2, parts.length); + await createMiddleSlotPromoWithData(); - const dismissPromoButton = parts[1] as HTMLElement; - dismissPromoButton.click(); + await clickDismissPromoButton(middleSlotPromo); + + assertEquals(1, newTabPageHandler.getCallCount('blocklistPromo')); assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertEquals( 1, @@ -235,15 +233,10 @@ }); test('clicking undo button restores promo', async () => { - // Dismiss middle slot promo. - const canShowPromo = true; - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); - const parts = middleSlotPromo.$.promoAndDismissContainer.children; - assertEquals(2, parts.length); - const dismissPromoButton = parts[1] as HTMLElement; - dismissPromoButton.click(); + // Dismiss the promo. + await createMiddleSlotPromoWithData(); + await clickDismissPromoButton(middleSlotPromo); assertEquals(0, newTabPageHandler.getCallCount('undoBlocklistPromo')); - assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertEquals( 0, metrics.count( @@ -261,14 +254,9 @@ }); test('restores promo if undo command is fired via keyboard', async () => { - // Dismiss middle slot promo. - const canShowPromo = true; - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); - const parts = middleSlotPromo.$.promoAndDismissContainer.children; - assertEquals(2, parts.length); - const dismissPromoButton = parts[1] as HTMLElement; - dismissPromoButton.click(); - assertEquals(0, newTabPageHandler.getCallCount('undoBlocklistPromo')); + // Dismiss the promo. + await createMiddleSlotPromoWithData(); + await clickDismissPromoButton(middleSlotPromo); assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertEquals( 0, @@ -286,9 +274,8 @@ 'NewTabPage.Promos.DismissAction', PromoDismissAction.RESTORE)); }); - test('ignores undo command if no promo was blocklisted', async () => { - const canShowPromo = true; - await createMiddleSlotPromo(canShowPromo); + test('ignores undo command if no promo blocklisted', async () => { + await createMiddleSlotPromoWithData(); // Simulate 'ctrl+z' key combo (or meta+z for Mac). keyDownOn(document.documentElement, 0, isMac ? 'meta' : 'ctrl', 'z'); @@ -301,16 +288,16 @@ }); test('setting promo data resurfaces promo after dismissal', async () => { - const canShowPromo = true; - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); + // Dismiss the promo. + await createMiddleSlotPromoWithData(); + await clickDismissPromoButton(middleSlotPromo); - callbackRouterRemote.setPromo(null); - await callbackRouterRemote.$.flushForTesting(); - assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); - + // Set promo data. callbackRouterRemote.setPromo(createPromo()); await callbackRouterRemote.$.flushForTesting(); - assertTrue(isVisible(middleSlotPromo.$.promoAndDismissContainer)); + + // Assert that the promo resurfaces. + assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); }); }); @@ -322,118 +309,118 @@ }); test(`mobile promo doesn't exist if default promo renders`, async () => { - const canShowPromo = true; + // Instantiate the element with data for both promos. newTabPageHandler.setResultFor( 'getMobilePromoQrCode', Promise.resolve({qrCode: 'abc'})); - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); + await createMiddleSlotPromoWithData(); + // Assert that only the default promo is visible. assertTrue(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertFalse(!!middleSlotPromo.shadowRoot!.querySelector('#mobilePromo')); - // Ensure mobile promo's state remains the same even if the default promo - // goes away. + // Remove data for the default promo to make it disappear. callbackRouterRemote.setPromo(null); await callbackRouterRemote.$.flushForTesting(); + // Assert that the mobile promo remains hidden even when the + // default promo is gone. assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertFalse(!!middleSlotPromo.shadowRoot!.querySelector('#mobilePromo')); assertEquals(0, newTabPageHandler.getCallCount('onMobilePromoShown')); }); test(`mobile promo shows if default promo doesn't render`, async () => { - const canShowPromo = false; + // Instantiate the element with mobile promo data only. newTabPageHandler.setResultFor( 'getMobilePromoQrCode', Promise.resolve({qrCode: 'abc'})); - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); + await createMiddleSlotPromo(/*canShowPromo=*/ false); + + // Assert that only the mobile promo is visible. assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertTrue(isVisible(middleSlotPromo.$.mobilePromo)); assertEquals(1, newTabPageHandler.getCallCount('onMobilePromoShown')); }); test(`default promo doesn't render if mobile promo rendered`, async () => { - const canShowPromo = false; + // Instantiate the element with mobile promo data only. newTabPageHandler.setResultFor( 'getMobilePromoQrCode', Promise.resolve({qrCode: 'abc'})); - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); + await createMiddleSlotPromo(/*canShowPromo=*/ false); - assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); - assertTrue(isVisible(middleSlotPromo.$.mobilePromo)); - + // Set up default promo data. callbackRouterRemote.setPromo(createPromo()); await callbackRouterRemote.$.flushForTesting(); + // Assert that the mobile promo remains visible. assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertTrue(isVisible(middleSlotPromo.$.mobilePromo)); }); test( - 'default promo renders later on if mobile promo has no valid qr code', - async () => { - const canShowPromo = false; - newTabPageHandler.setResultFor( - 'getMobilePromoQrCode', Promise.resolve({qrCode: ''})); - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); - - assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); - assertFalse(isVisible(middleSlotPromo.$.mobilePromo)); - - promoBrowserCommandHandler.setResultFor( - 'canExecuteCommand', Promise.resolve({canExecute: true})); - callbackRouterRemote.setPromo(createPromo()); - await callbackRouterRemote.$.flushForTesting(); - - assertTrue(isVisible(middleSlotPromo.$.promoAndDismissContainer)); - assertFalse(isVisible(middleSlotPromo.$.mobilePromo)); - }); - - test( `mobile promo hides if default promo doesn't render and no qr code`, async () => { - const canShowPromo = false; + // Instantiate the element with invalid mobile promo data and no + // default promo data. newTabPageHandler.setResultFor( 'getMobilePromoQrCode', Promise.resolve({qrCode: ''})); - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); + await createMiddleSlotPromo(/*canShowPromo=*/ false); + + // Assert that neither promo shows. assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertFalse(isVisible(middleSlotPromo.$.mobilePromo)); assertEquals(0, newTabPageHandler.getCallCount('onMobilePromoShown')); }); + test( + 'default promo renders later on if mobile promo has no valid qr code', + async () => { + // Instantiate the element with invalid mobile promo data and no + // default promo data. + newTabPageHandler.setResultFor( + 'getMobilePromoQrCode', Promise.resolve({qrCode: ''})); + await createMiddleSlotPromo(/*canShowPromo=*/ false); + + // Set up data for the default promo. + promoBrowserCommandHandler.setResultFor( + 'canExecuteCommand', Promise.resolve({canExecute: true})); + callbackRouterRemote.setPromo(createPromo()); + await callbackRouterRemote.$.flushForTesting(); + + // Assert that the default promo shows. + assertTrue(isVisible(middleSlotPromo.$.promoAndDismissContainer)); + assertFalse(isVisible(middleSlotPromo.$.mobilePromo)); + }); + test('mobile promo shows if it gets a QR code later', async () => { - const canShowPromo = false; + // Instantiate the element with invalid mobile promo data and no + // default promo data. newTabPageHandler.setResultFor( 'getMobilePromoQrCode', Promise.resolve({qrCode: ''})); - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); + await createMiddleSlotPromo(/*canShowPromo=*/ false); const mobilePromo = middleSlotPromo.$.mobilePromo; - assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); - assertFalse(isVisible(mobilePromo)); - assertEquals(0, newTabPageHandler.getCallCount('onMobilePromoShown')); - const loaded = - eventToPromise('ntp-middle-slot-promo-loaded', document.body); - + // Give the mobile promo valid data. mobilePromo.dispatchEvent(new CustomEvent('qr-code-changed', { bubbles: true, composed: true, detail: {value: 'abc'}, })); + await microtasksFinished(); - const loadedEvent: Event = await loaded; - assertTrue(!!loadedEvent); + // Assert that the mobile promo shows. assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertTrue(isVisible(mobilePromo)); - assertEquals(1, newTabPageHandler.getCallCount('onMobilePromoShown')); }); test('mobile promo hides if QR code gets removed later', async () => { - const canShowPromo = false; + // Instantiate the element with valid mobile promo data and no + // default promo data. newTabPageHandler.setResultFor( 'getMobilePromoQrCode', Promise.resolve({qrCode: 'abc'})); - const middleSlotPromo = await createMiddleSlotPromo(canShowPromo); - const mobilePromo = middleSlotPromo.$.mobilePromo; - assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); - assertTrue(isVisible(mobilePromo)); - assertEquals(1, newTabPageHandler.getCallCount('onMobilePromoShown')); + await createMiddleSlotPromo(/*canShowPromo=*/ false); + // Remove the mobile promo's data. + const mobilePromo = middleSlotPromo.$.mobilePromo; mobilePromo.dispatchEvent(new CustomEvent('qr-code-changed', { bubbles: true, composed: true, @@ -441,9 +428,9 @@ })); await microtasksFinished(); + // Assert that neither promo shows. assertFalse(isVisible(middleSlotPromo.$.promoAndDismissContainer)); assertFalse(isVisible(mobilePromo)); - assertEquals(1, newTabPageHandler.getCallCount('onMobilePromoShown')); }); }); });
diff --git a/chrome/test/data/webui/new_tab_page/mobile_promo_test.ts b/chrome/test/data/webui/new_tab_page/mobile_promo_test.ts index 58d8b52..b17997511 100644 --- a/chrome/test/data/webui/new_tab_page/mobile_promo_test.ts +++ b/chrome/test/data/webui/new_tab_page/mobile_promo_test.ts
@@ -18,6 +18,7 @@ suite('MobilePromoTest', () => { let newTabPageHandler: TestMock<PageHandlerRemote>; + let mobilePromo: MobilePromoElement; setup(() => { document.body.innerHTML = window.trustedTypes!.emptyHTML; @@ -27,8 +28,7 @@ void newTabPageHandler; }); - async function createMobilePromo(hasQrCode: boolean): - Promise<MobilePromoElement> { + async function createMobilePromo(hasQrCode: boolean) { if (hasQrCode) { newTabPageHandler.setResultFor( 'getMobilePromoQrCode', Promise.resolve({qrCode: 'abc'})); @@ -36,13 +36,23 @@ newTabPageHandler.setResultFor( 'getMobilePromoQrCode', Promise.resolve({qrCode: ''})); } - const mobilePromo = document.createElement('ntp-mobile-promo'); + mobilePromo = document.createElement('ntp-mobile-promo'); document.body.appendChild(mobilePromo); await eventToPromise('qr-code-changed', mobilePromo); await microtasksFinished(); + } - return mobilePromo; + async function createMobilePromoWithQrCode() { + await createMobilePromo(/*hasQrCode=*/ true); + } + + async function clickDismissPromoButton(mobilePromo: MobilePromoElement) { + const parts = mobilePromo.$.titleAndDismissContainer.children; + assertEquals(2, parts.length); + const dismissPromoButton = parts[1] as HTMLElement; + dismissPromoButton.click(); + await microtasksFinished(); } function assertHasQrCode( @@ -61,57 +71,39 @@ test('render hasQrCode=true', async () => { const hasQrCode = true; - const mobilePromo = await createMobilePromo(hasQrCode); + await createMobilePromo(hasQrCode); assertHasQrCode(hasQrCode, mobilePromo); }); test('render hasQrCode=false', async () => { const hasQrCode = false; - const mobilePromo = await createMobilePromo(hasQrCode); + await createMobilePromo(hasQrCode); assertHasQrCode(hasQrCode, mobilePromo); }); test('mobile promo dismisses when dismiss is clicked', async () => { - newTabPageHandler.setResultFor( - 'getMobilePromoQrCode', Promise.resolve({qrCode: 'abc'})); - const mobilePromo = await createMobilePromo(true); + await createMobilePromoWithQrCode(); assertTrue(isVisible(mobilePromo.$.promoContainer)); assertFalse(mobilePromo.$.dismissPromoButtonToast.open); - const parts = mobilePromo.$.titleAndDismissContainer.children; - assertEquals(2, parts.length); - - const dismissPromoButton = parts[1] as HTMLElement; - dismissPromoButton.click(); - - await microtasksFinished(); + await clickDismissPromoButton(mobilePromo); assertFalse(isVisible(mobilePromo.$.promoContainer)); assertTrue(mobilePromo.$.dismissPromoButtonToast.open); assertEquals(1, newTabPageHandler.getCallCount('onDismissMobilePromo')); }); - test('mobile promo dismissed can undo', async () => { - newTabPageHandler.setResultFor( - 'getMobilePromoQrCode', Promise.resolve({qrCode: 'abc'})); - const mobilePromo = await (createMobilePromo(true)); - assertTrue(isVisible(mobilePromo.$.promoContainer)); + test('mobile promo dismissal can be undone', async () => { + // Dismiss mobile promo. + await createMobilePromoWithQrCode(); assertFalse(mobilePromo.$.dismissPromoButtonToast.open); - - const parts = mobilePromo.$.titleAndDismissContainer.children; - assertEquals(2, parts.length); - - const dismissPromoButton = parts[1] as HTMLElement; - dismissPromoButton.click(); - - await microtasksFinished(); - + await clickDismissPromoButton(mobilePromo); assertFalse(isVisible(mobilePromo.$.promoContainer)); assertTrue(mobilePromo.$.dismissPromoButtonToast.open); - assertEquals(1, newTabPageHandler.getCallCount('onDismissMobilePromo')); + assertEquals(0, newTabPageHandler.getCallCount('onUndoDismissMobilePromo')); + // Undo dismissal via toast. mobilePromo.$.undoDismissPromoButton.click(); - await microtasksFinished(); assertTrue(isVisible(mobilePromo.$.promoContainer)); @@ -120,17 +112,11 @@ }); test('restores promo if undo command is fired via keyboard', async () => { - newTabPageHandler.setResultFor( - 'getMobilePromoQrCode', Promise.resolve({qrCode: 'abc'})); - const mobilePromo = await (createMobilePromo(true)); - - const parts = mobilePromo.$.titleAndDismissContainer.children; - assertEquals(2, parts.length); - const dismissPromoButton = parts[1] as HTMLElement; - dismissPromoButton.click(); - await microtasksFinished(); - + // Dismiss mobile promo. + await createMobilePromoWithQrCode(); + await clickDismissPromoButton(mobilePromo); assertEquals(0, newTabPageHandler.getCallCount('onUndoDismissMobilePromo')); + // Simulate 'ctrl+z' key combo (or meta+z for Mac). keyDownOn(document.documentElement, 0, isMac ? 'meta' : 'ctrl', 'z'); await microtasksFinished(); @@ -141,9 +127,7 @@ }); test('ignores undo command if no promo was blocklisted', async () => { - newTabPageHandler.setResultFor( - 'getMobilePromoQrCode', Promise.resolve({qrCode: 'abc'})); - await (createMobilePromo(true)); + await createMobilePromoWithQrCode(); // Simulate 'ctrl+z' key combo (or meta+z for Mac). keyDownOn(document.documentElement, 0, isMac ? 'meta' : 'ctrl', 'z');
diff --git a/chrome/test/data/webui/settings/ai_history_search_subpage_test.ts b/chrome/test/data/webui/settings/ai_history_search_subpage_test.ts index a19063c..432a1451 100644 --- a/chrome/test/data/webui/settings/ai_history_search_subpage_test.ts +++ b/chrome/test/data/webui/settings/ai_history_search_subpage_test.ts
@@ -137,7 +137,8 @@ assertFalse(checkVisibility('#linkoutTextWithAnswers')); assertTrue(checkVisibility('#whenOnPageContentText')); assertFalse(checkVisibility('#whenOnPageContentTextWithAnswers')); - assertFalse(checkVisibility('#whenOnLogStartItem')); + assertFalse(checkVisibility('#whenOnRecallInfoWithAnswers')); + assertTrue(checkVisibility('#whenOnLogStartItem')); assertTrue(checkVisibility('#considerDataEncryptedText')); assertFalse(checkVisibility('#considerDataEncryptedTextWithAnswers')); assertFalse(checkVisibility('#considerOutDatedItem')); @@ -148,6 +149,7 @@ assertTrue(checkVisibility('#linkoutTextWithAnswers')); assertFalse(checkVisibility('#whenOnPageContentText')); assertTrue(checkVisibility('#whenOnPageContentTextWithAnswers')); + assertTrue(checkVisibility('#whenOnRecallInfoWithAnswers')); assertTrue(checkVisibility('#whenOnLogStartItem')); assertFalse(checkVisibility('#considerDataEncryptedText')); assertTrue(checkVisibility('#considerDataEncryptedTextWithAnswers'));
diff --git a/chrome/test/data/webui/settings/ai_page_test.ts b/chrome/test/data/webui/settings/ai_page_test.ts index bfdba779..1a5729f8 100644 --- a/chrome/test/data/webui/settings/ai_page_test.ts +++ b/chrome/test/data/webui/settings/ai_page_test.ts
@@ -279,23 +279,71 @@ routes.AI_TAB_ORGANIZATION, Router.getInstance().getCurrentRoute()); }); - test('AutofillAiRow', async () => { + test('autofillAiRowVisible', async () => { + // The AutofillAI row should be visible if autofillAiEnabled is true. loadTimeData.overrideValues({ autofillAiEnabled: true, + showAiSettingsForTesting: false, }); resetRouterForTesting(); + await createPage(); const autofillAiRow = page.shadowRoot!.querySelector<HTMLElement>('#autofillAiRowV2'); assertTrue(!!autofillAiRow); assertTrue(isVisible(autofillAiRow)); + }); + test('autofillAiRowVisibleForTesting', async () => { + // The AutofillAI row should be visible if showAiSettingsForTesting is true. + loadTimeData.overrideValues({ + autofillAiEnabled: false, + showAiSettingsForTesting: true, + }); + resetRouterForTesting(); + + await createPage(); + + const autofillAiRow = + page.shadowRoot!.querySelector<HTMLElement>('#autofillAiRowV2'); + assertTrue(!!autofillAiRow); + assertTrue(isVisible(autofillAiRow)); + }); + + test('autofillAiRowNotVisible', async () => { + // The AutofillAI row should not be visible if autofillAiEnabled and + // showAiSettingsForTesting are false. + loadTimeData.overrideValues({ + autofillAiEnabled: false, + showAiSettingsForTesting: false, + }); + resetRouterForTesting(); + + await createPage(); + + const autofillAiRow = + page.shadowRoot!.querySelector<HTMLElement>('#autofillAiRowV2'); + assertTrue(!!autofillAiRow); + assertFalse(isVisible(autofillAiRow)); + }); + + test('autofillAiRowClick', async () => { + loadTimeData.overrideValues({ + autofillAiEnabled: true, + }); + resetRouterForTesting(); + + await createPage(); + + const autofillAiRow = + page.shadowRoot!.querySelector<HTMLElement>('#autofillAiRowV2'); + assertTrue(!!autofillAiRow); autofillAiRow.click(); + await verifyFeatureInteractionMetrics( AiPageInteractions.AUTOFILL_AI_CLICK, 'Settings.AiPage.AutofillAIEntryPointClick'); - assertEquals(routes.AUTOFILL_AI, Router.getInstance().getCurrentRoute()); });
diff --git a/chrome/test/supervised_user/google_auth_state_waiter_mixin.cc b/chrome/test/supervised_user/google_auth_state_waiter_mixin.cc index 1a9d894..530be97 100644 --- a/chrome/test/supervised_user/google_auth_state_waiter_mixin.cc +++ b/chrome/test/supervised_user/google_auth_state_waiter_mixin.cc
@@ -47,6 +47,9 @@ // Wait for the auth state to change. run_loop.Run(); +#else + // Silence -Wunused-private-field warning. + (void)expected_auth_state_; #endif }
diff --git a/chromeos/ash/components/boca/on_task/on_task_blocklist.h b/chromeos/ash/components/boca/on_task/on_task_blocklist.h index 5aa194f..61e5713 100644 --- a/chromeos/ash/components/boca/on_task/on_task_blocklist.h +++ b/chromeos/ash/components/boca/on_task/on_task_blocklist.h
@@ -114,7 +114,6 @@ ::boca::LockedNavigationOptions::OPEN_NAVIGATION; base::WeakPtr<content::WebContents> previous_tab_; GURL previous_url_; - bool first_time_popup_ = true; std::map<SessionID, ::boca::LockedNavigationOptions::NavigationType> parent_tab_to_nav_filters_; std::map<SessionID, ::boca::LockedNavigationOptions::NavigationType>
diff --git a/chromeos/crosapi/mojom/BUILD.gn b/chromeos/crosapi/mojom/BUILD.gn index 0147bd53..3bde088 100644 --- a/chromeos/crosapi/mojom/BUILD.gn +++ b/chromeos/crosapi/mojom/BUILD.gn
@@ -73,7 +73,6 @@ "mahi.mojom", "media_app.mojom", "media_ui.mojom", - "metrics.mojom", "multi_capture_service.mojom", "native_theme.mojom", "network_change.mojom",
diff --git a/chromeos/crosapi/mojom/crosapi.mojom b/chromeos/crosapi/mojom/crosapi.mojom index f4640bbc..43a321b 100644 --- a/chromeos/crosapi/mojom/crosapi.mojom +++ b/chromeos/crosapi/mojom/crosapi.mojom
@@ -67,7 +67,6 @@ import "chromeos/crosapi/mojom/magic_boost.mojom"; import "chromeos/crosapi/mojom/mahi.mojom"; import "chromeos/crosapi/mojom/media_app.mojom"; -import "chromeos/crosapi/mojom/metrics.mojom"; import "chromeos/crosapi/mojom/multi_capture_service.mojom"; import "chromeos/crosapi/mojom/native_theme.mojom"; import "chromeos/crosapi/mojom/network_change.mojom"; @@ -457,11 +456,7 @@ [MinVersion=33] BindNativeThemeService@38(pending_receiver<NativeThemeService> receiver); - // Binds the Metrics interface for fetching metadata needed by the - // metrics subsystem. - // Added in M110. - [MinVersion=102] - BindMetrics@106(pending_receiver<Metrics> receiver); + // BindMetrics@106 was removed. // Binds the MultiCaptureService interface that handles multi capture related // usage indicators and notifications.
diff --git a/chromeos/crosapi/mojom/metrics.mojom b/chromeos/crosapi/mojom/metrics.mojom deleted file mode 100644 index 41efb5d..0000000 --- a/chromeos/crosapi/mojom/metrics.mojom +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright 2022 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -module crosapi.mojom; - -// Clients that upload metrics often need some device-specific metadata that is -// used to segment the metrics server-side. This interface allows clients to get -// that metadata. Implemented by ash-chrome. -// Next version: 1 -// Next method id: 1 -[Uuid="45ecfa93-4332-4c68-a355-87e3d0407427"] -interface Metrics { - // Provides an opaque string which identifies the current hardware. The string - // is not structured and information should not be derived from its content. - // If the string is empty then this is not a known hardware type. - GetFullHardwareClass@0() => (string full_hardware_class); -};
diff --git a/chromeos/ui/frame/multitask_menu/multitask_button.cc b/chromeos/ui/frame/multitask_menu/multitask_button.cc index a3f9cf7..528694bd 100644 --- a/chromeos/ui/frame/multitask_menu/multitask_button.cc +++ b/chromeos/ui/frame/multitask_menu/multitask_button.cc
@@ -22,7 +22,6 @@ const std::u16string& name) : views::Button(std::move(callback)), type_(type), - is_portrait_mode_(is_portrait_mode), paint_as_active_(paint_as_active) { views::InstallRoundRectHighlightPathGenerator( this, gfx::Insets(), kMultitaskBaseButtonBorderRadius);
diff --git a/chromeos/ui/frame/multitask_menu/multitask_button.h b/chromeos/ui/frame/multitask_menu/multitask_button.h index e0b30ed..d8c64633 100644 --- a/chromeos/ui/frame/multitask_menu/multitask_button.h +++ b/chromeos/ui/frame/multitask_menu/multitask_button.h
@@ -37,9 +37,6 @@ private: const Type type_; - // The display orientation. This determines whether button is in - // landscape/portrait mode. - const bool is_portrait_mode_; // Used to determine whether the button should be painted as active. If a // window is in fullscreen or floated state, it should be painted as active.
diff --git a/clank b/clank index 87961a7..2cf4ab0 160000 --- a/clank +++ b/clank
@@ -1 +1 @@ -Subproject commit 87961a747195a2b627f5c78b6b274e1d05323672 +Subproject commit 2cf4ab0b04a9f4713c31cdf420e4d0f1278cac38
diff --git a/components/autofill/core/browser/autofill_client.h b/components/autofill/core/browser/autofill_client.h index d45c89e0..54201d1 100644 --- a/components/autofill/core/browser/autofill_client.h +++ b/components/autofill/core/browser/autofill_client.h
@@ -60,7 +60,7 @@ class UkmRecorder; } -namespace optimization_guide::proto { +namespace optimization_guide::proto::features { class UserAnnotationsEntry; }
diff --git a/components/autofill/core/browser/browser_autofill_manager_unittest.cc b/components/autofill/core/browser/browser_autofill_manager_unittest.cc index 670cc99..57612c7 100644 --- a/components/autofill/core/browser/browser_autofill_manager_unittest.cc +++ b/components/autofill/core/browser/browser_autofill_manager_unittest.cc
@@ -6629,7 +6629,7 @@ // when the submitted form was imported into user annotations successfully. TEST_F(BrowserAutofillManagerTest, ProfileNotImportedOnSuccessfulUserAnnotationsImport) { - using optimization_guide::proto::UserAnnotationsEntry; + using optimization_guide::proto::features::UserAnnotationsEntry; TestAddressDataManager& adm = personal_data().test_address_data_manager(); FormData form = CreateTestAddressFormData(); FormsSeen({form});
diff --git a/components/autofill/core/browser/form_processing/optimization_guide_proto_util.cc b/components/autofill/core/browser/form_processing/optimization_guide_proto_util.cc index a327a65b..4263fd31 100644 --- a/components/autofill/core/browser/form_processing/optimization_guide_proto_util.cc +++ b/components/autofill/core/browser/form_processing/optimization_guide_proto_util.cc
@@ -13,48 +13,55 @@ namespace { // Converts `form_control_type` to its corresponding proto enum. -optimization_guide::proto::FormControlType ToFormControlTypeProto( +optimization_guide::proto::features::FormControlType ToFormControlTypeProto( FormControlType form_control_type) { switch (form_control_type) { case FormControlType::kContentEditable: - return optimization_guide::proto::FORM_CONTROL_TYPE_CONTENT_EDITABLE; + return optimization_guide::proto::features:: + FORM_CONTROL_TYPE_CONTENT_EDITABLE; case FormControlType::kInputCheckbox: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_CHECKBOX; + return optimization_guide::proto::features:: + FORM_CONTROL_TYPE_INPUT_CHECKBOX; case FormControlType::kInputEmail: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_EMAIL; + return optimization_guide::proto::features::FORM_CONTROL_TYPE_INPUT_EMAIL; case FormControlType::kInputMonth: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_MONTH; + return optimization_guide::proto::features::FORM_CONTROL_TYPE_INPUT_MONTH; case FormControlType::kInputNumber: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_NUMBER; + return optimization_guide::proto::features:: + FORM_CONTROL_TYPE_INPUT_NUMBER; case FormControlType::kInputPassword: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_PASSWORD; + return optimization_guide::proto::features:: + FORM_CONTROL_TYPE_INPUT_PASSWORD; case FormControlType::kInputRadio: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_RADIO; + return optimization_guide::proto::features::FORM_CONTROL_TYPE_INPUT_RADIO; case FormControlType::kInputSearch: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_SEARCH; + return optimization_guide::proto::features:: + FORM_CONTROL_TYPE_INPUT_SEARCH; case FormControlType::kInputTelephone: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_TELEPHONE; + return optimization_guide::proto::features:: + FORM_CONTROL_TYPE_INPUT_TELEPHONE; case FormControlType::kInputText: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_TEXT; + return optimization_guide::proto::features::FORM_CONTROL_TYPE_INPUT_TEXT; case FormControlType::kInputUrl: - return optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_URL; + return optimization_guide::proto::features::FORM_CONTROL_TYPE_INPUT_URL; case FormControlType::kSelectOne: - return optimization_guide::proto::FORM_CONTROL_TYPE_SELECT_ONE; + return optimization_guide::proto::features::FORM_CONTROL_TYPE_SELECT_ONE; case FormControlType::kSelectMultiple: - return optimization_guide::proto::FORM_CONTROL_TYPE_SELECT_MULTIPLE; + return optimization_guide::proto::features:: + FORM_CONTROL_TYPE_SELECT_MULTIPLE; case FormControlType::kTextArea: - return optimization_guide::proto::FORM_CONTROL_TYPE_TEXT_AREA; + return optimization_guide::proto::features::FORM_CONTROL_TYPE_TEXT_AREA; } - return optimization_guide::proto::FORM_CONTROL_TYPE_UNSPECIFIED; + return optimization_guide::proto::features::FORM_CONTROL_TYPE_UNSPECIFIED; } } // namespace -optimization_guide::proto::FormData ToFormDataProto( +optimization_guide::proto::features::FormData ToFormDataProto( const FormData& form_data, const base::flat_map<FieldGlobalId, bool>& field_eligibility_map, const base::flat_map<FieldGlobalId, bool>& field_value_sensitivity_map) { - optimization_guide::proto::FormData form_data_proto; + optimization_guide::proto::features::FormData form_data_proto; form_data_proto.set_form_name(base::UTF16ToUTF8(form_data.name())); for (const auto& field : form_data.fields()) { auto* field_proto = form_data_proto.add_fields(); @@ -93,7 +100,7 @@ return form_data_proto; } -optimization_guide::proto::FormData ToFormDataProto( +optimization_guide::proto::features::FormData ToFormDataProto( const FormStructure& form_structure) { auto field_eligibility_map = base::MakeFlatMap<FieldGlobalId, bool>( form_structure.fields(), {}, [](const auto& field) {
diff --git a/components/autofill/core/browser/form_processing/optimization_guide_proto_util.h b/components/autofill/core/browser/form_processing/optimization_guide_proto_util.h index d5b6aa4..692efff 100644 --- a/components/autofill/core/browser/form_processing/optimization_guide_proto_util.h +++ b/components/autofill/core/browser/form_processing/optimization_guide_proto_util.h
@@ -8,23 +8,23 @@ #include "base/containers/flat_map.h" #include "components/autofill/core/common/unique_ids.h" -namespace optimization_guide::proto { +namespace optimization_guide::proto::features { class FormData; -} // namespace optimization_guide::proto +} // namespace optimization_guide::proto::features namespace autofill { class FormStructure; class FormData; // Converts `form_structure` to its corresponding form data proto. -optimization_guide::proto::FormData ToFormDataProto( +optimization_guide::proto::features::FormData ToFormDataProto( const FormData& form_data, const base::flat_map<FieldGlobalId, bool>& field_eligibility_map, const base::flat_map<FieldGlobalId, bool>& field_value_sensitivity_map); // Convenience overload that calls the function above with an empty // field_eligibility_map. -optimization_guide::proto::FormData ToFormDataProto( +optimization_guide::proto::features::FormData ToFormDataProto( const FormStructure& form_structure); } // namespace autofill
diff --git a/components/autofill/core/browser/form_processing/optimization_guide_proto_util_unittest.cc b/components/autofill/core/browser/form_processing/optimization_guide_proto_util_unittest.cc index 5529f08..48eecd3 100644 --- a/components/autofill/core/browser/form_processing/optimization_guide_proto_util_unittest.cc +++ b/components/autofill/core/browser/form_processing/optimization_guide_proto_util_unittest.cc
@@ -72,11 +72,12 @@ /*is_sensitive=*/false); field3.set_field_is_eligible_for_autofill_ai(false); - optimization_guide::proto::FormData form_data_proto = ToFormDataProto(form); + optimization_guide::proto::features::FormData form_data_proto = + ToFormDataProto(form); EXPECT_EQ(form_data_proto.fields_size(), 3); // The first field should contain everything including the value. - optimization_guide::proto::FormFieldData field_data1 = + optimization_guide::proto::features::FormFieldData field_data1 = form_data_proto.fields(0); EXPECT_EQ(field_data1.field_label(), "label"); EXPECT_EQ(field_data1.field_value(), "val"); @@ -89,7 +90,7 @@ // The second field should contain an empty value because it was marked as // sensitive. - optimization_guide::proto::FormFieldData field_data2 = + optimization_guide::proto::features::FormFieldData field_data2 = form_data_proto.fields(1); EXPECT_EQ(field_data2.field_label(), "label2"); EXPECT_EQ(field_data2.field_value(), ""); @@ -101,17 +102,17 @@ EXPECT_EQ(field_data2.is_eligible(), false); // Check that the options are corectly extracted from the select element. - optimization_guide::proto::FormFieldData field_data3 = + optimization_guide::proto::features::FormFieldData field_data3 = form_data_proto.fields(2); EXPECT_EQ(field_data3.field_label(), "select"); EXPECT_TRUE(field_data3.field_value().empty()); EXPECT_TRUE(field_data3.field_name().empty()); EXPECT_EQ(2, field_data3.select_options_size()); - optimization_guide::proto::SelectOption select_option1 = + optimization_guide::proto::features::SelectOption select_option1 = field_data3.select_options(0); EXPECT_EQ("1", select_option1.value()); EXPECT_EQ("text1", select_option1.text()); - optimization_guide::proto::SelectOption select_option2 = + optimization_guide::proto::features::SelectOption select_option2 = field_data3.select_options(1); EXPECT_EQ("2", select_option2.value()); EXPECT_EQ("text2", select_option2.text());
diff --git a/components/autofill/core/browser/payments/amount_extraction_heuristic_regexes.h b/components/autofill/core/browser/payments/amount_extraction_heuristic_regexes.h index 06cf6e5..7dda4ba 100644 --- a/components/autofill/core/browser/payments/amount_extraction_heuristic_regexes.h +++ b/components/autofill/core/browser/payments/amount_extraction_heuristic_regexes.h
@@ -39,6 +39,12 @@ // See comment for `number_of_ancestor_levels_to_search_`. uint32_t number_of_ancestor_levels_to_search() const; + void ResetRegexStringPatternsForTesting() { + keyword_pattern_.clear(); + amount_pattern_.clear(); + number_of_ancestor_levels_to_search_ = 0; + } + private: // A keyword pattern string used for amount extraction from DOM search // process.
diff --git a/components/autofill/core/common/autofill_payments_features.cc b/components/autofill/core/common/autofill_payments_features.cc index bbc8920..8fed48d8 100644 --- a/components/autofill/core/common/autofill_payments_features.cc +++ b/components/autofill/core/common/autofill_payments_features.cc
@@ -310,14 +310,6 @@ "AutofillUpstream", base::FEATURE_DISABLED_BY_DEFAULT); -// When enabled, shows different text and images in the UI of the credit card -// upload save bubble. -BASE_FEATURE(kAutofillUpstreamUpdatedUi, - "AutofillUpstreamUpdatedUi", - base::FEATURE_ENABLED_BY_DEFAULT); -const base::FeatureParam<int> kAutofillUpstreamUpdatedUiTreatment{ - &kAutofillUpstreamUpdatedUi, "autofill_upstream_updated_ui_treatment", 1}; - // When enabled, adds a timeout on the network request for VcnEnroll requests. BASE_FEATURE(kAutofillVcnEnrollRequestTimeout, "AutofillVcnEnrollRequestTimeout",
diff --git a/components/autofill/core/common/autofill_payments_features.h b/components/autofill/core/common/autofill_payments_features.h index dcb15d3..254a574 100644 --- a/components/autofill/core/common/autofill_payments_features.h +++ b/components/autofill/core/common/autofill_payments_features.h
@@ -124,11 +124,6 @@ COMPONENT_EXPORT(AUTOFILL) BASE_DECLARE_FEATURE(kAutofillUpstream); COMPONENT_EXPORT(AUTOFILL) -BASE_DECLARE_FEATURE(kAutofillUpstreamUpdatedUi); -COMPONENT_EXPORT(AUTOFILL) -extern const base::FeatureParam<int> kAutofillUpstreamUpdatedUiTreatment; - -COMPONENT_EXPORT(AUTOFILL) BASE_DECLARE_FEATURE(kAutofillVcnEnrollRequestTimeout); COMPONENT_EXPORT(AUTOFILL) extern const base::FeatureParam<int>
diff --git a/components/autofill_ai/core/browser/autofill_ai_client.h b/components/autofill_ai/core/browser/autofill_ai_client.h index 63159b3..9ff37e07b 100644 --- a/components/autofill_ai/core/browser/autofill_ai_client.h +++ b/components/autofill_ai/core/browser/autofill_ai_client.h
@@ -12,7 +12,7 @@ class GURL; -namespace optimization_guide::proto { +namespace optimization_guide::proto::features { class AXTreeUpdate; } @@ -39,8 +39,8 @@ class AutofillAiClient { public: // The callback to extract the accessibility tree snapshot. - using AXTreeCallback = - base::OnceCallback<void(optimization_guide::proto::AXTreeUpdate)>; + using AXTreeCallback = base::OnceCallback<void( + optimization_guide::proto::features::AXTreeUpdate)>; virtual ~AutofillAiClient() = default;
diff --git a/components/autofill_ai/core/browser/autofill_ai_logger_unittest.cc b/components/autofill_ai/core/browser/autofill_ai_logger_unittest.cc index e0a1a00..9ff73b2 100644 --- a/components/autofill_ai/core/browser/autofill_ai_logger_unittest.cc +++ b/components/autofill_ai/core/browser/autofill_ai_logger_unittest.cc
@@ -345,10 +345,12 @@ // This will dictate whether we consider the form ready to be filled or not. user_annotations_service_.ReplaceAllEntries( {user_has_data() - ? std::vector<optimization_guide::proto:: - UserAnnotationsEntry>{optimization_guide::proto:: - UserAnnotationsEntry()} - : std::vector<optimization_guide::proto::UserAnnotationsEntry>{}}); + ? std::vector< + optimization_guide::proto::features:: + UserAnnotationsEntry>{optimization_guide::proto::features:: + UserAnnotationsEntry()} + : std::vector< + optimization_guide::proto::features::UserAnnotationsEntry>{}}); manager().OnFormSeen(*form); if (user_saw_suggestions()) {
diff --git a/components/autofill_ai/core/browser/autofill_ai_manager.cc b/components/autofill_ai/core/browser/autofill_ai_manager.cc index b492b9b3..95a6bab 100644 --- a/components/autofill_ai/core/browser/autofill_ai_manager.cc +++ b/components/autofill_ai/core/browser/autofill_ai_manager.cc
@@ -289,7 +289,7 @@ weak_ptr_factory_.GetWeakPtr(), form, trigger_field)); } else { - optimization_guide::proto::AXTreeUpdate ax_tree_update; + optimization_guide::proto::features::AXTreeUpdate ax_tree_update; OnReceivedAXTree(form, trigger_field, std::move(ax_tree_update)); } } @@ -297,7 +297,7 @@ void AutofillAiManager::OnReceivedAXTree( const autofill::FormData& form, const autofill::FormFieldData& trigger_field, - optimization_guide::proto::AXTreeUpdate ax_tree_update) { + optimization_guide::proto::features::AXTreeUpdate ax_tree_update) { client_->GetModelExecutor()->GetPredictions( form, GetFieldFillingEligibilityMap(form), GetFieldValueSensitivityMap(form), std::move(ax_tree_update), @@ -613,7 +613,7 @@ OnReceivedAXTreeForFormImport( url, kSendTitleURL.Get() ? client_->GetTitle() : std::string(), std::move(form), std::move(callback), - optimization_guide::proto::AXTreeUpdate()); + optimization_guide::proto::features::AXTreeUpdate()); } } @@ -622,7 +622,7 @@ const std::string& title, std::unique_ptr<autofill::FormStructure> form, user_annotations::ImportFormCallback callback, - optimization_guide::proto::AXTreeUpdate ax_tree_update) { + optimization_guide::proto::features::AXTreeUpdate ax_tree_update) { if (user_annotations::UserAnnotationsService* user_annotations_service = client_->GetUserAnnotationsService()) { user_annotations_service->AddFormSubmission( @@ -646,8 +646,8 @@ << "Received user annotation entries:" << [&] { LogBuffer buffer; buffer << autofill::Tag{"table"}; - for (const optimization_guide::proto::UserAnnotationsEntry& - entry : entries) { + for (const optimization_guide::proto::features:: + UserAnnotationsEntry& entry : entries) { buffer << autofill::Tr{} << entry.entry_id() << entry.key() << entry.value() << autofill::SetParentTagContainsPII{};
diff --git a/components/autofill_ai/core/browser/autofill_ai_manager.h b/components/autofill_ai/core/browser/autofill_ai_manager.h index 11577474..f597f2fd 100644 --- a/components/autofill_ai/core/browser/autofill_ai_manager.h +++ b/components/autofill_ai/core/browser/autofill_ai_manager.h
@@ -142,7 +142,7 @@ void OnReceivedAXTree(const autofill::FormData& form, const autofill::FormFieldData& trigger_field, - optimization_guide::proto::AXTreeUpdate); + optimization_guide::proto::features::AXTreeUpdate); // The unexpected value is always `false` if there was an error retrieving // predictions. @@ -172,7 +172,7 @@ const std::string& title, std::unique_ptr<autofill::FormStructure> form, user_annotations::ImportFormCallback callback, - optimization_guide::proto::AXTreeUpdate ax_tree_update); + optimization_guide::proto::features::AXTreeUpdate ax_tree_update); // Returns true if the user has the flag enabled and is overall eligible for // the feature, such as signin state (check the implementation for details).
diff --git a/components/autofill_ai/core/browser/autofill_ai_manager_unittest.cc b/components/autofill_ai/core/browser/autofill_ai_manager_unittest.cc index dcf64cd..1ca63274 100644 --- a/components/autofill_ai/core/browser/autofill_ai_manager_unittest.cc +++ b/components/autofill_ai/core/browser/autofill_ai_manager_unittest.cc
@@ -101,16 +101,18 @@ (autofill::FormData form_data, (base::flat_map<autofill::FieldGlobalId, bool> field_eligibility_map), (base::flat_map<autofill::FieldGlobalId, bool> sensitivity_map), - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, PredictionsReceivedCallback callback), (override)); MOCK_METHOD( - const std::optional<optimization_guide::proto::FormsPredictionsRequest>&, + const std::optional< + optimization_guide::proto::features::FormsPredictionsRequest>&, GetLatestRequest, (), (const override)); MOCK_METHOD( - const std::optional<optimization_guide::proto::FormsPredictionsResponse>&, + const std::optional< + optimization_guide::proto::features::FormsPredictionsResponse>&, GetLatestResponse, (), (const override)); @@ -232,8 +234,8 @@ EXPECT_CALL(update_suggestions_callback, Run(ElementsAre(HasType(kAutofillAiLoadingState)), _)); EXPECT_CALL(client(), GetAXTree) - .WillOnce( - RunOnceCallback<0>(optimization_guide::proto::AXTreeUpdate())); + .WillOnce(RunOnceCallback<0>( + optimization_guide::proto::features::AXTreeUpdate())); EXPECT_CALL(model_executor(), GetPredictions) .WillOnce(RunOnceCallback<4>(PredictionsByGlobalId{}, "")); EXPECT_CALL(update_suggestions_callback, @@ -270,8 +272,8 @@ EXPECT_CALL(update_suggestions_callback, Run(ElementsAre(HasType(kAutofillAiLoadingState)), _)); EXPECT_CALL(client(), GetAXTree) - .WillOnce( - RunOnceCallback<0>(optimization_guide::proto::AXTreeUpdate())); + .WillOnce(RunOnceCallback<0>( + optimization_guide::proto::features::AXTreeUpdate())); EXPECT_CALL(model_executor(), GetPredictions) .WillOnce(RunOnceCallback<4>(PredictionsByGlobalId{}, "")); EXPECT_CALL(update_suggestions_callback, @@ -314,8 +316,8 @@ EXPECT_CALL(update_suggestions_callback, Run(ElementsAre(HasType(kAutofillAiLoadingState)), _)); EXPECT_CALL(client(), GetAXTree) - .WillOnce( - RunOnceCallback<0>(optimization_guide::proto::AXTreeUpdate())); + .WillOnce(RunOnceCallback<0>( + optimization_guide::proto::features::AXTreeUpdate())); EXPECT_CALL(model_executor(), GetPredictions) .WillOnce(MoveArg<4>(&predictions_received_callback)); EXPECT_CALL( @@ -375,8 +377,8 @@ EXPECT_CALL(update_suggestions_callback, Run(ElementsAre(HasType(kAutofillAiLoadingState)), _)); EXPECT_CALL(client(), GetAXTree) - .WillOnce( - RunOnceCallback<0>(optimization_guide::proto::AXTreeUpdate())); + .WillOnce(RunOnceCallback<0>( + optimization_guide::proto::features::AXTreeUpdate())); EXPECT_CALL(model_executor(), GetPredictions) .WillOnce(MoveArg<4>(&predictions_received_callback)); EXPECT_CALL(update_suggestions_callback, @@ -899,8 +901,8 @@ #endif if (should_extract_ax_tree()) { EXPECT_CALL(client(), GetAXTree) - .WillOnce( - RunOnceCallback<0>(optimization_guide::proto::AXTreeUpdate{})); + .WillOnce(RunOnceCallback<0>( + optimization_guide::proto::features::AXTreeUpdate{})); } else { EXPECT_CALL(client(), GetAXTree).Times(0); } @@ -998,7 +1000,7 @@ TEST_F(AutofillAiManagerTest, HasDataStoredReturnsTrueIfDataIsStored) { base::MockCallback<AutofillAiManager::HasDataCallback> has_data_callback; user_annotations_service_.ReplaceAllEntries( - {optimization_guide::proto::UserAnnotationsEntry()}); + {optimization_guide::proto::features::UserAnnotationsEntry()}); manager().HasDataStored(has_data_callback.Get()); EXPECT_CALL(has_data_callback, Run(AutofillAiManager::HasData(true))); manager().HasDataStored(has_data_callback.Get());
diff --git a/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor.h b/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor.h index c8a18dd..6126a78 100644 --- a/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor.h +++ b/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor.h
@@ -14,11 +14,11 @@ class FormData; } -namespace optimization_guide::proto { +namespace optimization_guide::proto::features { class AXTreeUpdate; class FormsPredictionsRequest; class FormsPredictionsResponse; -} +} // namespace optimization_guide::proto::features namespace autofill_ai { @@ -60,20 +60,20 @@ autofill::FormData form_data, base::flat_map<autofill::FieldGlobalId, bool> field_eligibility_map, base::flat_map<autofill::FieldGlobalId, bool> field_sensitivity_map, - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, PredictionsReceivedCallback callback) = 0; // Returns the latest forms predictions request made to the optimization // guide, if any. virtual const std::optional< - optimization_guide::proto::FormsPredictionsRequest>& + optimization_guide::proto::features::FormsPredictionsRequest>& GetLatestRequest() const = 0; // Returns the response to `GetLatestRequest()`. Note that the response can be // non-existent for two reasons: 1) it wasn't received yet or 2) there was an // error parsing the response proto. virtual const std::optional< - optimization_guide::proto::FormsPredictionsResponse>& + optimization_guide::proto::features::FormsPredictionsResponse>& GetLatestResponse() const = 0; };
diff --git a/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl.cc b/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl.cc index b9ff4fa7..20ac6185 100644 --- a/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl.cc +++ b/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl.cc
@@ -46,7 +46,7 @@ autofill::FormData form_data, base::flat_map<autofill::FieldGlobalId, bool> field_eligibility_map, base::flat_map<autofill::FieldGlobalId, bool> field_sensitivity_map, - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, PredictionsReceivedCallback callback) { user_annotations_service_->RetrieveAllEntries(base::BindOnce( &AutofillAiModelExecutorImpl::OnUserAnnotationsRetrieved, @@ -59,7 +59,7 @@ autofill::FormData form_data, const base::flat_map<autofill::FieldGlobalId, bool>& field_eligibility_map, const base::flat_map<autofill::FieldGlobalId, bool>& field_sensitivity_map, - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, PredictionsReceivedCallback callback, user_annotations::UserAnnotationsEntries user_annotations) { // At this point there should be user annotations. Return an error if there @@ -72,8 +72,8 @@ } // Construct request. - optimization_guide::proto::FormsPredictionsRequest request; - optimization_guide::proto::PageContext* page_context = + optimization_guide::proto::features::FormsPredictionsRequest request; + optimization_guide::proto::features::PageContext* page_context = request.mutable_page_context(); if (kSendTitleURL.Get()) { page_context->set_url(form_data.url().spec()); @@ -91,7 +91,7 @@ SetLatestRequestForDebugging(request); optimization_guide::ModelExecutionCallbackWithLogging< - optimization_guide::proto::FormsPredictionsLoggingData> + optimization_guide::proto::features::FormsPredictionsLoggingData> wrapper_callback = base::BindOnce(&AutofillAiModelExecutorImpl::OnModelExecuted, weak_ptr_factory_.GetWeakPtr(), std::move(form_data), @@ -106,7 +106,8 @@ autofill::FormData form_data, PredictionsReceivedCallback callback, optimization_guide::OptimizationGuideModelExecutionResult execution_result, - std::unique_ptr<optimization_guide::proto::FormsPredictionsLoggingData> + std::unique_ptr< + optimization_guide::proto::features::FormsPredictionsLoggingData> logging_data) { CHECK(logging_data); auto log_entry = std::make_unique<optimization_guide::ModelQualityLogEntry>( @@ -120,7 +121,7 @@ SetLatestResponseForDebugging( optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::FormsPredictionsResponse>( + optimization_guide::proto::features::FormsPredictionsResponse>( execution_result.response.value())); if (!GetLatestResponse()) { @@ -137,10 +138,11 @@ AutofillAiModelExecutor::PredictionsByGlobalId AutofillAiModelExecutorImpl::ExtractPredictions( const autofill::FormData& form_data, - const optimization_guide::proto::FilledFormData& form_data_proto) { + const optimization_guide::proto::features::FilledFormData& + form_data_proto) { std::vector<std::pair<autofill::FieldGlobalId, Prediction>> predictions; const std::vector<autofill::FormFieldData>& fields = form_data.fields(); - for (const optimization_guide::proto::FilledFormFieldData& + for (const optimization_guide::proto::features::FilledFormFieldData& filled_form_field_proto : form_data_proto.filled_form_field_data()) { // Only the first predicted value is used at the moment. if (filled_form_field_proto.predicted_values_size() == 0 || @@ -204,7 +206,7 @@ } void AutofillAiModelExecutorImpl::SetLatestRequestForDebugging( - optimization_guide::proto::FormsPredictionsRequest request) { + optimization_guide::proto::features::FormsPredictionsRequest request) { // Reset `latest_response_` to ensure it always matches `latest_request_`, if // it exists. latest_response_.reset(); @@ -212,17 +214,19 @@ } void AutofillAiModelExecutorImpl::SetLatestResponseForDebugging( - std::optional<optimization_guide::proto::FormsPredictionsResponse> + std::optional<optimization_guide::proto::features::FormsPredictionsResponse> response) { latest_response_ = std::move(response); } -const std::optional<optimization_guide::proto::FormsPredictionsRequest>& +const std::optional< + optimization_guide::proto::features::FormsPredictionsRequest>& AutofillAiModelExecutorImpl::GetLatestRequest() const { return latest_request_; } -const std::optional<optimization_guide::proto::FormsPredictionsResponse>& +const std::optional< + optimization_guide::proto::features::FormsPredictionsResponse>& AutofillAiModelExecutorImpl::GetLatestResponse() const { return latest_response_; }
diff --git a/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl.h b/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl.h index d8b79619..aeca4ad 100644 --- a/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl.h +++ b/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl.h
@@ -21,10 +21,10 @@ class FormData; } // namespace autofill -namespace optimization_guide::proto { +namespace optimization_guide::proto::features { class AXTreeUpdate; class FilledFormData; -} // namespace optimization_guide::proto +} // namespace optimization_guide::proto::features namespace user_annotations { class UserAnnotationsService; @@ -45,11 +45,13 @@ autofill::FormData form_data, base::flat_map<autofill::FieldGlobalId, bool> field_eligibility_map, base::flat_map<autofill::FieldGlobalId, bool> field_sensitivity_map, - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, PredictionsReceivedCallback callback) override; - const std::optional<optimization_guide::proto::FormsPredictionsRequest>& + const std::optional< + optimization_guide::proto::features::FormsPredictionsRequest>& GetLatestRequest() const override; - const std::optional<optimization_guide::proto::FormsPredictionsResponse>& + const std::optional< + optimization_guide::proto::features::FormsPredictionsResponse>& GetLatestResponse() const override; private: @@ -60,7 +62,7 @@ field_eligibility_map, const base::flat_map<autofill::FieldGlobalId, bool>& field_sensitivity_map, - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, PredictionsReceivedCallback callback, user_annotations::UserAnnotationsEntries user_annotations); @@ -70,31 +72,34 @@ PredictionsReceivedCallback callback, optimization_guide::OptimizationGuideModelExecutionResult execution_result, - std::unique_ptr<optimization_guide::proto::FormsPredictionsLoggingData> + std::unique_ptr< + optimization_guide::proto::features::FormsPredictionsLoggingData> logging_data); static PredictionsByGlobalId ExtractPredictions( const autofill::FormData& form_data, - const optimization_guide::proto::FilledFormData& form_data_proto); + const optimization_guide::proto::features::FilledFormData& + form_data_proto); // Setter for `latest_request_`. Also resets `latest_response_`. void SetLatestRequestForDebugging( - optimization_guide::proto::FormsPredictionsRequest request); + optimization_guide::proto::features::FormsPredictionsRequest request); // Setter for `latest_response_`. // Note that within a tab and thus per model executor instance, there cannot // be multiple requests as per the // `AutofillAiManager::prediction_retrieval_state_`. void SetLatestResponseForDebugging( - std::optional<optimization_guide::proto::FormsPredictionsResponse> + std::optional< + optimization_guide::proto::features::FormsPredictionsResponse> response); // Latest request made to the optimization guide. - std::optional<optimization_guide::proto::FormsPredictionsRequest> + std::optional<optimization_guide::proto::features::FormsPredictionsRequest> latest_request_ = std::nullopt; // Response received for `latest_request_`, if any. - std::optional<optimization_guide::proto::FormsPredictionsResponse> + std::optional<optimization_guide::proto::features::FormsPredictionsResponse> latest_response_ = std::nullopt; raw_ptr<optimization_guide::OptimizationGuideModelExecutor> model_executor_ =
diff --git a/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl_unittest.cc b/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl_unittest.cc index 470e5582..6cbab77 100644 --- a/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl_unittest.cc +++ b/components/autofill_ai/core/browser/suggestion/autofill_ai_model_executor_impl_unittest.cc
@@ -36,16 +36,16 @@ using ::testing::Pair; void AddFieldToResponse( - optimization_guide::proto::FormsPredictionsResponse& response, + optimization_guide::proto::features::FormsPredictionsResponse& response, const std::string& label, const std::string& normalized_label, const std::string& value, int request_field_index = 0) { - optimization_guide::proto::FilledFormFieldData* filled_field = + optimization_guide::proto::features::FilledFormFieldData* filled_field = response.mutable_form_data()->add_filled_form_field_data(); filled_field->mutable_field_data()->set_field_label(label); filled_field->set_normalized_label(normalized_label); - optimization_guide::proto::PredictedValue* predicted_value = + optimization_guide::proto::features::PredictedValue* predicted_value = filled_field->add_predicted_values(); predicted_value->set_value(value); filled_field->set_request_field_index(request_field_index); @@ -102,13 +102,13 @@ TEST_F(AutofillAiModelExecutorImplTest, EndToEnd) { // Seed user annotations service with entries. - optimization_guide::proto::UserAnnotationsEntry entry; + optimization_guide::proto::features::UserAnnotationsEntry entry; entry.set_key("label"); entry.set_value("value"); user_annotations_service()->ReplaceAllEntries({entry}); // Set up mock. - optimization_guide::proto::FormsPredictionsResponse response; + optimization_guide::proto::features::FormsPredictionsResponse response; AddFieldToResponse(response, "label", "normalized label", "value", 0); AddFieldToResponse(response, "empty", "", "", 2); AddFieldToResponse(response, "notinform", "", "doesntmatter"); @@ -158,7 +158,7 @@ {.label = u"Field has value, not filled", .value = u"value"}}}; autofill::FormData form = autofill::test::GetFormData(form_description); - optimization_guide::proto::AXTreeUpdate ax_tree; + optimization_guide::proto::features::AXTreeUpdate ax_tree; base::test::TestFuture<PredictionsOrError, std::optional<std::string>> test_future; engine()->GetPredictions(form, {}, {}, ax_tree, test_future.GetCallback()); @@ -192,7 +192,7 @@ form_field_data.set_label(u"label"); autofill::FormData form_data; form_data.set_fields({form_field_data}); - optimization_guide::proto::AXTreeUpdate ax_tree; + optimization_guide::proto::features::AXTreeUpdate ax_tree; base::test::TestFuture<PredictionsOrError, std::optional<std::string>> test_future; engine()->GetPredictions(form_data, {}, {}, ax_tree, @@ -205,7 +205,7 @@ TEST_F(AutofillAiModelExecutorImplTest, ModelExecutionError) { // Seed user annotations service with entries. - optimization_guide::proto::UserAnnotationsEntry entry; + optimization_guide::proto::features::UserAnnotationsEntry entry; entry.set_key("label"); entry.set_value("value"); user_annotations_service()->ReplaceAllEntries({entry}); @@ -232,7 +232,7 @@ form_field_data.set_label(u"label"); autofill::FormData form_data; form_data.set_fields({form_field_data}); - optimization_guide::proto::AXTreeUpdate ax_tree; + optimization_guide::proto::features::AXTreeUpdate ax_tree; base::test::TestFuture<PredictionsOrError, std::optional<std::string>> test_future; engine()->GetPredictions(form_data, {}, {}, ax_tree, @@ -245,7 +245,7 @@ TEST_F(AutofillAiModelExecutorImplTest, ModelExecutionWrongTypeReturned) { // Seed user annotations service with entries. - optimization_guide::proto::UserAnnotationsEntry entry; + optimization_guide::proto::features::UserAnnotationsEntry entry; entry.set_key("label"); entry.set_value("value"); user_annotations_service()->ReplaceAllEntries({entry}); @@ -267,7 +267,7 @@ form_field_data.set_label(u"label"); autofill::FormData form_data; form_data.set_fields({form_field_data}); - optimization_guide::proto::AXTreeUpdate ax_tree; + optimization_guide::proto::features::AXTreeUpdate ax_tree; base::test::TestFuture<PredictionsOrError, std::optional<std::string>> test_future; engine()->GetPredictions(form_data, {}, {}, ax_tree,
diff --git a/components/autofill_payments_strings.grdp b/components/autofill_payments_strings.grdp index d1c2d70..db13b7b 100644 --- a/components/autofill_payments_strings.grdp +++ b/components/autofill_payments_strings.grdp
@@ -138,15 +138,9 @@ Save card to Google Account? </message> <if expr="not is_ios and not is_android"> - <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_SECURITY" desc="Title text for the credit card upload save prompt on Desktop, using security-focused messaging."> + <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_SECURITY" desc="Title text for the credit card upload save prompt on Desktop, using security-focused messaging. Became the new default in Dec. 2024."> Save card securely? </message> - <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_CONVENIENCE" desc="Title text for the credit card upload save prompt on Desktop, using convenience-focused messaging."> - Save card? - </message> - <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_EDUCATION" desc="Title text for the credit card upload save prompt on Desktop, using education-focused messaging."> - Autofill card next time? - </message> </if> <message name="IDS_AUTOFILL_SAVE_CVC_PROMPT_TITLE_TO_CLOUD" desc="Title text for the Autofill CVC upload prompt that offers to upload CVC to the Sync server for existing server cards. This prompt is shown if a CVC is detected for an existing server card on form submission."> Save security code? @@ -183,9 +177,6 @@ <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_V3" desc="Explanation of the effect of the Autofill save card prompt when the card is to be saved by uploading it to Google Payments, according to April 2018 UI guidelines, and minorly updated again in September 2023. The prompt will be shown either in a bubble below the omnibox, or in a bottom sheet, or in an infobar."> To pay faster next time, save your card and billing address in your Google Account </message> - <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_V3_WITH_NAME" desc="Explanation of the effect of the Autofill save card prompt when the card is to be saved by uploading it to Google Payments, according to April 2018 UI guidelines, and minorly updated again in September 2023. The prompt will be shown either in a bubble below the omnibox, or in a bottom sheet, or in an infobar."> - To pay faster next time, save your card, name, and billing address in your Google Account - </message> <message name="IDS_AUTOFILL_SAVE_CVC_PROMPT_EXPLANATION_UPLOAD" desc="Explanation text for the Autofill save CVC prompt that offers to upload CVC to the Sync server for existing server cards. This prompt is shown if a CVC is detected for an existing server card on form submission."> This card's CVC will be encrypted and saved in your Google Account for faster checkout </message> @@ -193,15 +184,9 @@ To pay faster next time, save your card, encrypted security code, and billing address in your Google Account </message> <if expr="not is_ios and not is_android"> - <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_SECURITY" desc="Explanation of the benefit of credit card upload save on Desktop, using security-focused messaging."> + <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_SECURITY" desc="Explanation of the benefit of credit card upload save on Desktop, using security-focused messaging. Became the new default in Dec. 2024."> Pay faster when your card is saved. Card details are encrypted in your Google Account. </message> - <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_CONVENIENCE" desc="Explanation of the benefit of credit card upload save on Desktop, using convenience-focused messaging."> - Save this card to use online with Google Pay for purchases across your devices - </message> - <message name="IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_EDUCATION" desc="Explanation of the benefit of credit card upload save on Desktop, using education-focused messaging."> - Autofill your card for future purchases when you save it to use with Google Pay - </message> </if> <if expr="is_android"> <message name="IDS_AUTOFILL_SAVE_CVC_MESSAGE_SAVE_ACCEPT" desc="Positive button label for the Autofill save CVC prompt that offers to save CVC for existing server cards. This prompt is shown if a CVC is detected for an existing server card on form submission. The prompt is shown in a Message UI on Android devices.">
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_CONVENIENCE.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_CONVENIENCE.png.sha1 deleted file mode 100644 index d40b1df..0000000 --- a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_CONVENIENCE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -9dac1f4a25c8e26579c1789d0f8ef091b10ae383 \ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_EDUCATION.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_EDUCATION.png.sha1 deleted file mode 100644 index 29268de1..0000000 --- a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD_EDUCATION.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -a37faf56dbbc24269ccfef91283e77aea4642c7e \ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_CONVENIENCE.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_CONVENIENCE.png.sha1 deleted file mode 100644 index 97766c5b..0000000 --- a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_CONVENIENCE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -21e2be71456fb75e84728660c5c00dbc53c098af \ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_EDUCATION.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_EDUCATION.png.sha1 deleted file mode 100644 index 2ce4e9f..0000000 --- a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_EDUCATION.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -d0f8b90be20ec4cf85da833d5a092670648e4e83 \ No newline at end of file
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_V3_WITH_NAME.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_V3_WITH_NAME.png.sha1 deleted file mode 100644 index aae8a2c..0000000 --- a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_V3_WITH_NAME.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -138a1d2c271167a1bc818adc592c5fcc9d53889d \ No newline at end of file
diff --git a/components/commerce/core/webui/shopping_service_handler.cc b/components/commerce/core/webui/shopping_service_handler.cc index f60f4bd..54256822 100644 --- a/components/commerce/core/webui/shopping_service_handler.cc +++ b/components/commerce/core/webui/shopping_service_handler.cc
@@ -239,11 +239,11 @@ void ConvertDescriptionTextToProto( ProductSpecifications::DescriptionText description_text, - optimization_guide::proto::DescriptionText* description_proto) { + optimization_guide::proto::features::DescriptionText* description_proto) { description_proto->set_text(description_text.text); for (auto url_info : description_text.urls) { - optimization_guide::proto::DescriptionText::ReferenceUrl* reference_url = - description_proto->add_urls(); + optimization_guide::proto::features::DescriptionText::ReferenceUrl* + reference_url = description_proto->add_urls(); reference_url->set_url(url_info.url.spec()); reference_url->set_title(base::UTF16ToUTF8(url_info.title)); if (url_info.favicon_url.has_value()) { @@ -257,16 +257,17 @@ void ConvertProductSpecificationsToProto( ProductSpecifications specs, - optimization_guide::proto::ProductSpecificationData* product_spec_data) { + optimization_guide::proto::features::ProductSpecificationData* + product_spec_data) { for (auto pair : specs.product_dimension_map) { - optimization_guide::proto::ProductSpecificationSection* section = + optimization_guide::proto::features::ProductSpecificationSection* section = product_spec_data->add_product_specification_sections(); section->set_key(base::NumberToString(pair.first)); section->set_title(pair.second); } for (auto product : specs.products) { - optimization_guide::proto::ProductSpecification* product_spec = + optimization_guide::proto::features::ProductSpecification* product_spec = product_spec_data->add_product_specifications(); product_spec->mutable_identifiers()->set_gpc_id(product.product_cluster_id); product_spec->mutable_identifiers()->set_mid(product.mid); @@ -274,39 +275,41 @@ product_spec->set_image_url(product.image_url.spec()); for (auto pair : product.product_dimension_values) { - optimization_guide::proto::ProductSpecificationValue* + optimization_guide::proto::features::ProductSpecificationValue* product_specification_value = product_spec->add_product_specification_values(); product_specification_value->set_key(base::NumberToString(pair.first)); for (auto description : pair.second.descriptions) { - optimization_guide::proto::ProductSpecificationDescription* + optimization_guide::proto::features::ProductSpecificationDescription* product_specification_description = product_specification_value->add_specification_descriptions(); product_specification_description->set_label(description.label); product_specification_description->set_alternative_text( description.alt_text); for (auto option : description.options) { - optimization_guide::proto::ProductSpecificationDescription::Option* - option_proto = product_specification_description->add_options(); + optimization_guide::proto::features::ProductSpecificationDescription:: + Option* option_proto = + product_specification_description->add_options(); for (auto option_description : option.descriptions) { - optimization_guide::proto::DescriptionText* description_text = - option_proto->add_description(); + optimization_guide::proto::features::DescriptionText* + description_text = option_proto->add_description(); ConvertDescriptionTextToProto(option_description, description_text); } } } for (auto summary : pair.second.summary) { - optimization_guide::proto::DescriptionText* summary_description = - product_specification_value->add_summary_description(); + optimization_guide::proto::features::DescriptionText* + summary_description = + product_specification_value->add_summary_description(); ConvertDescriptionTextToProto(summary, summary_description); } } for (auto description_text : product.summary) { - optimization_guide::proto::DescriptionText* summary_description = - product_spec->add_summary_description(); + optimization_guide::proto::features::DescriptionText* + summary_description = product_spec->add_summary_description(); ConvertDescriptionTextToProto(description_text, summary_description); } } @@ -315,18 +318,19 @@ // TODO(b/347064310): Move this method to some lower-level layers instead of // here which is only usable in WebUI. void RecordQualityEntry( - optimization_guide::proto::ProductSpecificationsQuality* quality_proto, + optimization_guide::proto::features::ProductSpecificationsQuality* + quality_proto, std::vector<GURL> input_urls, ProductSpecifications specs) { // Record input. for (auto url : input_urls) { - optimization_guide::proto::ProductIdentifier* identifider = + optimization_guide::proto::features::ProductIdentifier* identifider = quality_proto->add_product_identifiers(); identifider->set_product_url(url.spec()); } // Record product spec table. - optimization_guide::proto::ProductSpecificationData* product_spec_data = - quality_proto->mutable_product_specification_data(); + optimization_guide::proto::features::ProductSpecificationData* + product_spec_data = quality_proto->mutable_product_specification_data(); ConvertProductSpecificationsToProto(specs, product_spec_data); } } // namespace @@ -688,23 +692,23 @@ void ShoppingServiceHandler::SetProductSpecificationsUserFeedback( shopping_service::mojom::UserFeedback feedback) { - optimization_guide::proto::UserFeedback user_feedback; + optimization_guide::proto::features::UserFeedback user_feedback; switch (feedback) { case shopping_service::mojom::UserFeedback::kThumbsUp: - user_feedback = - optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_UP; + user_feedback = optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_UP; break; case shopping_service::mojom::UserFeedback::kThumbsDown: - user_feedback = - optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN; + user_feedback = optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN; break; case shopping_service::mojom::UserFeedback::kUnspecified: - user_feedback = - optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + user_feedback = optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED; break; } - if (user_feedback == - optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN) { + if (user_feedback == optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN) { // If quality log is enabled, `log_id` of the feedback will be the same as // the `execution_id` of the log entry so that they can be matched later; // otherwise it will be a random ID. @@ -725,10 +729,10 @@ if (!request) { return; } - optimization_guide::proto::ProductSpecificationsQuality* quality_proto = - optimization_guide::ProductSpecificationsFeatureTypeMap::GetLoggingData( - *request) - ->mutable_quality(); + optimization_guide::proto::features::ProductSpecificationsQuality* + quality_proto = optimization_guide::ProductSpecificationsFeatureTypeMap:: + GetLoggingData(*request) + ->mutable_quality(); quality_proto->set_user_feedback(user_feedback); }
diff --git a/components/commerce/core/webui/shopping_service_handler_unittest.cc b/components/commerce/core/webui/shopping_service_handler_unittest.cc index bfecd34c..32fa7505 100644 --- a/components/commerce/core/webui/shopping_service_handler_unittest.cc +++ b/components/commerce/core/webui/shopping_service_handler_unittest.cc
@@ -443,7 +443,8 @@ optimization_guide::proto::LogAiDataRequest* request = handler_->current_log_quality_entry_for_testing()->log_ai_data_request(); ASSERT_EQ( - optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_UP, + optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_UP, optimization_guide::ProductSpecificationsFeatureTypeMap::GetLoggingData( *request) ->quality() @@ -453,7 +454,8 @@ shopping_service::mojom::UserFeedback::kUnspecified); ASSERT_EQ( - optimization_guide::proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED, + optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_UNSPECIFIED, optimization_guide::ProductSpecificationsFeatureTypeMap::GetLoggingData( *request) ->quality() @@ -479,7 +481,8 @@ optimization_guide::proto::LogAiDataRequest* request = handler_->current_log_quality_entry_for_testing()->log_ai_data_request(); ASSERT_EQ( - optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN, + optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN, optimization_guide::ProductSpecificationsFeatureTypeMap::GetLoggingData( *request) ->quality()
diff --git a/components/component_updater/installer_policies/BUILD.gn b/components/component_updater/installer_policies/BUILD.gn index aeed0d3..b76d62c9 100644 --- a/components/component_updater/installer_policies/BUILD.gn +++ b/components/component_updater/installer_policies/BUILD.gn
@@ -80,6 +80,7 @@ source_set("unit_tests") { testonly = true sources = [ + "amount_extraction_heuristic_regexes_component_installer_unittest.cc", "autofill_states_component_installer_unittest.cc", "cookie_readiness_list_component_installer_policy_unittest.cc", "first_party_sets_component_installer_policy_unittest.cc", @@ -96,6 +97,7 @@ ":installer_policies", "//base", "//base/test:test_support", + "//components/autofill/core/browser:amount_extraction_heuristic_regexes_proto", "//components/autofill/core/browser:test_support", "//components/component_updater:test_support", "//components/history_embeddings/core",
diff --git a/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.cc b/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.cc index dbf7026..10c97da 100644 --- a/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.cc +++ b/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.cc
@@ -4,6 +4,7 @@ #include "components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.h" +#include <optional> #include <vector> #include "base/files/file_path.h" @@ -31,6 +32,27 @@ return base.Append(kAmountExtractionHeuristicRegexesBinaryPbFileName); } +static std::optional<std::string> LoadAmountExtractionHeuristicRegexesFromDisk( + const base::FilePath& pb_path) { + std::string binary_pb; + if (!base::ReadFileToString(pb_path, &binary_pb)) { + return std::nullopt; + } + + return binary_pb; +} + +static void PopulateAmountExtractionHeuristicRegexesData( + const base::FilePath& pb_path, + std::optional<std::string> binary_pb) { + if (!binary_pb) { + return; + } + + autofill::payments::AmountExtractionHeuristicRegexes::GetInstance() + .PopulateStringFromComponent(std::move(*binary_pb)); +} + } // namespace AmountExtractionHeuristicRegexesInstallerPolicy:: @@ -61,7 +83,14 @@ void AmountExtractionHeuristicRegexesInstallerPolicy::ComponentReady( const base::Version& version, const base::FilePath& install_dir, - base::Value::Dict /* manifest */) {} + base::Value::Dict /* manifest */) { + const base::FilePath pb_path = GetInstalledPath(install_dir); + + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, + base::BindOnce(&LoadAmountExtractionHeuristicRegexesFromDisk, pb_path), + base::BindOnce(&PopulateAmountExtractionHeuristicRegexesData, pb_path)); +} // Called during startup and installation before ComponentReady(). bool AmountExtractionHeuristicRegexesInstallerPolicy::VerifyInstallation(
diff --git a/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.h b/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.h index 70c05ac..e5ab06c 100644 --- a/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.h +++ b/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.h
@@ -30,6 +30,7 @@ ~AmountExtractionHeuristicRegexesInstallerPolicy() override; private: + friend class AmountExtractionHeuristicRegexesInstallerPolicyTest; // The following methods override ComponentInstallerPolicy. bool SupportsGroupPolicyEnabledComponentUpdates() const override; bool RequiresNetworkEncryption() const override;
diff --git a/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer_unittest.cc b/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer_unittest.cc new file mode 100644 index 0000000..258beaf --- /dev/null +++ b/components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer_unittest.cc
@@ -0,0 +1,116 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/component_updater/installer_policies/amount_extraction_heuristic_regexes_component_installer.h" + +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/files/scoped_temp_dir.h" +#include "base/test/task_environment.h" +#include "base/version.h" +#include "components/autofill/core/browser/payments/amount_extraction_heuristic_regexes.h" +#include "components/autofill/core/browser/payments/amount_extraction_heuristic_regexes.pb.h" +#include "components/component_updater/mock_component_updater_service.h" +#include "testing/gtest/include/gtest/gtest.h" + +using ::autofill::core::browser::payments::HeuristicRegexes; + +namespace component_updater { + +namespace { +constexpr char kAmountExtractionHeuristicRegexesVersion[] = "1"; +const base::FilePath::CharType + kAmountExtractionHeuristicRegexesBinaryPbFileName[] = + FILE_PATH_LITERAL("heuristic_regexes.binarypb"); +} // namespace + +class AmountExtractionHeuristicRegexesInstallerPolicyTest + : public testing::Test { + public: + AmountExtractionHeuristicRegexesInstallerPolicyTest() = default; + AmountExtractionHeuristicRegexesInstallerPolicyTest( + const AmountExtractionHeuristicRegexesInstallerPolicyTest&) = delete; + AmountExtractionHeuristicRegexesInstallerPolicyTest& operator=( + const AmountExtractionHeuristicRegexesInstallerPolicyTest&) = delete; + ~AmountExtractionHeuristicRegexesInstallerPolicyTest() override = default; + + void SetUp() override { + ASSERT_TRUE(component_install_dir_.CreateUniqueTempDir()); + } + + base::FilePath component_install_dir() const { + return component_install_dir_.GetPath(); + } + + bool CreateTestAmountExtractionHeuristicRegexesData( + const std::string& file_content) { + base::FilePath file_path = component_install_dir().Append( + kAmountExtractionHeuristicRegexesBinaryPbFileName); + return base::WriteFile(file_path, file_content); + } + + void LoadTestAmountExtractionHeuristicRegexesData() { + base::Value::Dict manifest; + ASSERT_TRUE(policy_.VerifyInstallation(manifest, component_install_dir())); + const base::Version expected_version( + kAmountExtractionHeuristicRegexesVersion); + policy_.ComponentReady(expected_version, component_install_dir(), + std::move(manifest)); + RunUntilIdle(); + } + + void RunUntilIdle() { task_environment_.RunUntilIdle(); } + + protected: + base::test::TaskEnvironment task_environment_; + base::ScopedTempDir component_install_dir_; + MockComponentUpdateService component_update_service_; + AmountExtractionHeuristicRegexesInstallerPolicy policy_; +}; + +TEST_F(AmountExtractionHeuristicRegexesInstallerPolicyTest, + ComponentRegistered) { + EXPECT_CALL(component_update_service_, RegisterComponent(testing::_)) + .Times(1) + .WillOnce(testing::Return(true)); + RegisterAmountExtractionHeuristicRegexesComponent(&component_update_service_); + RunUntilIdle(); +} + +TEST_F(AmountExtractionHeuristicRegexesInstallerPolicyTest, + LoadFileWithDefualtPattern) { + autofill::payments::AmountExtractionHeuristicRegexes::GetInstance() + .ResetRegexStringPatternsForTesting(); + HeuristicRegexes heuristic_regexes; + ASSERT_TRUE(CreateTestAmountExtractionHeuristicRegexesData( + heuristic_regexes.SerializeAsString())); + ASSERT_NO_FATAL_FAILURE(LoadTestAmountExtractionHeuristicRegexesData()); + + const autofill::payments::AmountExtractionHeuristicRegexes& regex_data = + autofill::payments::AmountExtractionHeuristicRegexes::GetInstance(); + EXPECT_EQ(regex_data.keyword_pattern(), "^(Order Total|Total):?$"); + EXPECT_EQ(regex_data.amount_pattern(), + R"regexp((?:\$)\s*\d{1,3}(?:[.,]\d{3})*(?:[.,]\d{2})?)regexp"); +} + +TEST_F(AmountExtractionHeuristicRegexesInstallerPolicyTest, LoadFileWithData) { + HeuristicRegexes heuristic_regexes; + heuristic_regexes.mutable_generic_details()->set_keyword_pattern( + "^(Total Amount):?$"); + heuristic_regexes.mutable_generic_details()->set_amount_pattern( + R"regexp(\$\d+\.\d{2})regexp"); + heuristic_regexes.mutable_generic_details() + ->set_number_of_ancestor_levels_to_search(4); + ASSERT_TRUE(CreateTestAmountExtractionHeuristicRegexesData( + heuristic_regexes.SerializeAsString())); + ASSERT_NO_FATAL_FAILURE(LoadTestAmountExtractionHeuristicRegexesData()); + + const autofill::payments::AmountExtractionHeuristicRegexes& regex_data = + autofill::payments::AmountExtractionHeuristicRegexes::GetInstance(); + EXPECT_EQ(regex_data.keyword_pattern(), "^(Total Amount):?$"); + EXPECT_EQ(regex_data.amount_pattern(), R"regexp(\$\d+\.\d{2})regexp"); + EXPECT_EQ(regex_data.number_of_ancestor_levels_to_search(), 4u); +} + +} // namespace component_updater
diff --git a/components/content_settings/browser/ui/cookie_controls_controller.cc b/components/content_settings/browser/ui/cookie_controls_controller.cc index bdd64e57..955f4d7 100644 --- a/components/content_settings/browser/ui/cookie_controls_controller.cc +++ b/components/content_settings/browser/ui/cookie_controls_controller.cc
@@ -188,7 +188,7 @@ CreateTrackingProtectionFeatureList( CookieControlsEnforcement::kNoEnforcement, /*cookies_allowed=*/true, - /*protections_on=*/false)}; + /*act_exception=*/true)}; } const GURL& url = web_contents->GetLastCommittedURL(); @@ -202,7 +202,7 @@ CreateTrackingProtectionFeatureList( CookieControlsEnforcement::kNoEnforcement, /*cookies_allowed=*/true, - /*protections_on=*/false)}; + /*act_exception=*/true)}; } auto blocking_status = CookieBlocking3pcdStatus::kNotIn3pcd; @@ -215,17 +215,14 @@ SettingInfo info; bool is_allowed = cookie_settings_->IsThirdPartyAccessAllowed(url, &info); - bool protections_on = - tracking_protection_settings_->GetTrackingProtectionSetting(url) == - CONTENT_SETTING_BLOCK; - CookieControlsEnforcement enforcement = GetEnforcementForThirdPartyCookieBlocking(blocking_status, url, info, is_allowed); std::vector<TrackingProtectionFeature> features = - CreateTrackingProtectionFeatureList(enforcement, is_allowed, - protections_on); + CreateTrackingProtectionFeatureList( + enforcement, is_allowed, + tracking_protection_settings_->HasTrackingProtectionException(url)); return {// Hide controls if the exception is from a metadata grant. enforcement != CookieControlsEnforcement::kEnforcedByTpcdGrant, /*protections_on=*/!is_allowed, @@ -256,7 +253,7 @@ CookieControlsController::CreateTrackingProtectionFeatureList( CookieControlsEnforcement enforcement, bool cookies_allowed, - bool protections_on) { + bool act_exception) { auto status_label = BlockingStatus::kBlocked; if (cookies_allowed) { status_label = BlockingStatus::kAllowed; @@ -270,15 +267,15 @@ if (ShowIpProtection()) { features.push_back( {FeatureType::kIpProtection, CookieControlsEnforcement::kNoEnforcement, - protections_on ? TrackingProtectionBlockingStatus::kHidden - : TrackingProtectionBlockingStatus::kVisible}); + act_exception ? TrackingProtectionBlockingStatus::kVisible + : TrackingProtectionBlockingStatus::kHidden}); } if (ShowFingerprintingProtection()) { features.push_back({FeatureType::kFingerprintingProtection, CookieControlsEnforcement::kNoEnforcement, - protections_on - ? TrackingProtectionBlockingStatus::kLimited - : TrackingProtectionBlockingStatus::kAllowed}); + act_exception + ? TrackingProtectionBlockingStatus::kAllowed + : TrackingProtectionBlockingStatus::kLimited}); } return features;
diff --git a/components/content_settings/browser/ui/cookie_controls_controller.h b/components/content_settings/browser/ui/cookie_controls_controller.h index 8dc6076b..c574dda7 100644 --- a/components/content_settings/browser/ui/cookie_controls_controller.h +++ b/components/content_settings/browser/ui/cookie_controls_controller.h
@@ -160,7 +160,7 @@ std::vector<TrackingProtectionFeature> CreateTrackingProtectionFeatureList( CookieControlsEnforcement enforcement, bool cookies_allowed, - bool protections_on); + bool act_exception); CookieControlsEnforcement GetEnforcementForThirdPartyCookieBlocking( CookieBlocking3pcdStatus status,
diff --git a/components/content_settings/core/browser/cookie_settings.cc b/components/content_settings/core/browser/cookie_settings.cc index b2dfa07..df1dc0d 100644 --- a/components/content_settings/core/browser/cookie_settings.cc +++ b/components/content_settings/core/browser/cookie_settings.cc
@@ -206,8 +206,8 @@ if (base::FeatureList::IsEnabled( privacy_sandbox::kTrackingProtectionContentSettingFor3pcb) && tracking_protection_settings_ && - tracking_protection_settings_->GetTrackingProtectionSetting( - first_party_url) == CONTENT_SETTING_ALLOW) { + tracking_protection_settings_->HasTrackingProtectionException( + first_party_url)) { return true; } return false;
diff --git a/components/crash/core/browser/crashes_ui_util.h b/components/crash/core/browser/crashes_ui_util.h index 77682aa0..ce538162 100644 --- a/components/crash/core/browser/crashes_ui_util.h +++ b/components/crash/core/browser/crashes_ui_util.h
@@ -55,9 +55,6 @@ // Strings used by the WebUI resources. // Must match the constants used in the resource files. -inline constexpr char kCrashesUICrashesJS[] = "crashes.js"; -inline constexpr char kCrashesUICrashesCSS[] = "crashes.css"; -inline constexpr char kCrashesUISadTabSVG[] = "sadtab.svg"; inline constexpr char kCrashesUIRequestCrashList[] = "requestCrashList"; inline constexpr char kCrashesUIRequestCrashUpload[] = "requestCrashUpload"; inline constexpr char kCrashesUIShortProductName[] = "shortProductName";
diff --git a/components/crash/core/browser/resources/BUILD.gn b/components/crash/core/browser/resources/BUILD.gn index a53e8c5..40bc307 100644 --- a/components/crash/core/browser/resources/BUILD.gn +++ b/components/crash/core/browser/resources/BUILD.gn
@@ -2,20 +2,22 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//tools/grit/preprocess_if_expr.gni") -import("//tools/typescript/webui_ts_library.gni") +import("//ui/webui/resources/tools/build_webui.gni") -preprocess_if_expr("preprocess") { - in_folder = "." - out_folder = target_gen_dir - in_files = [ "crashes.ts" ] -} +build_webui("build") { + grd_prefix = "crashes" -webui_ts_library("build_ts") { - root_dir = target_gen_dir - out_dir = "$target_gen_dir/tsc" - in_files = [ "crashes.ts" ] - definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ] - deps = [ "//ui/webui/resources/js:build_ts" ] - extra_deps = [ ":preprocess" ] + static_files = [ + "crashes.html", + "crashes.css", + "sadtab.svg", + ] + + non_web_component_files = [ "crashes.ts" ] + + ts_definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ] + ts_deps = [ "//ui/webui/resources/js:build_ts" ] + webui_context_type = "trusted" + + grit_output_dir = "$root_gen_dir/components" }
diff --git a/components/resources/sadtab.svg b/components/crash/core/browser/resources/sadtab.svg similarity index 100% rename from components/resources/sadtab.svg rename to components/crash/core/browser/resources/sadtab.svg
diff --git a/components/exo/keyboard_unittest.cc b/components/exo/keyboard_unittest.cc index 3df3a14e..5c1cc93 100644 --- a/components/exo/keyboard_unittest.cc +++ b/components/exo/keyboard_unittest.cc
@@ -1183,7 +1183,9 @@ TEST_F(KeyboardTest, KeyRepeatSettingsIgnoredForNonActiveUser) { // Simulate two users, with the first user as active. - CreateUserSessions(2); + auto active_account_id = SimulateUserLogin("user0@gmail.com"); + auto inactive_account_id = SimulateUserLogin("user1@gmail.com"); + SwitchActiveUser(active_account_id); // Key repeat settings should be sent exactly once, for the default values. auto delegate = std::make_unique<NiceMockKeyboardDelegate>(); @@ -1198,7 +1200,7 @@ EXPECT_CALL(*delegate_ptr, OnKeyRepeatSettingsChanged(testing::_, testing::_, testing::_)) .Times(0); - const std::string email = "user1@tray"; + const auto email = inactive_account_id.GetUserEmail(); SetUserPref(email, ash::prefs::kXkbAutoRepeatEnabled, base::Value(true)); SetUserPref(email, ash::prefs::kXkbAutoRepeatDelay, base::Value(1000)); SetUserPref(email, ash::prefs::kXkbAutoRepeatInterval, base::Value(1000)); @@ -1207,10 +1209,12 @@ TEST_F(KeyboardTest, KeyRepeatSettingsUpdateOnProfileChange) { // Simulate two users, with the first user as active. - CreateUserSessions(2); + auto active_account_id = SimulateUserLogin("user0@gmail.com"); + auto inactive_account_id = SimulateUserLogin("user1@gmail.com"); + SwitchActiveUser(active_account_id); // Second user has different preferences. - std::string email = "user1@tray"; + std::string email = inactive_account_id.GetUserEmail(); SetUserPref(email, ash::prefs::kXkbAutoRepeatEnabled, base::Value(true)); SetUserPref(email, ash::prefs::kXkbAutoRepeatDelay, base::Value(1000)); SetUserPref(email, ash::prefs::kXkbAutoRepeatInterval, base::Value(1000));
diff --git a/components/facilitated_payments/core/metrics/facilitated_payments_metrics.cc b/components/facilitated_payments/core/metrics/facilitated_payments_metrics.cc index 855d3d4..8683b530 100644 --- a/components/facilitated_payments/core/metrics/facilitated_payments_metrics.cc +++ b/components/facilitated_payments/core/metrics/facilitated_payments_metrics.cc
@@ -125,8 +125,6 @@ void LogLoadRiskDataResultAndLatency(bool was_successful, base::TimeDelta duration) { - // TODO(crbug.com/337929926): Remove hardcoding for Pix and use - // FacilitatedPaymentsType enum. base::UmaHistogramLongTimes( base::StrCat({"FacilitatedPayments.Pix.LoadRiskData.", was_successful ? "Success" : "Failure", ".Latency"}), @@ -134,8 +132,6 @@ } void LogGetClientTokenResultAndLatency(bool result, base::TimeDelta duration) { - // TODO(crbug.com/337929926): Remove hardcoding for Pix and use - // FacilitatedPaymentsType enum. base::UmaHistogramLongTimes( base::StrCat({"FacilitatedPayments.Pix.GetClientToken.", result ? "Success" : "Failure", ".Latency"}), @@ -143,22 +139,16 @@ } void LogPayflowExitedReason(PayflowExitedReason reason) { - // TODO(crbug.com/337929926): Remove hardcoding for Pix and use - // FacilitatedPaymentsType enum. base::UmaHistogramEnumeration("FacilitatedPayments.Pix.PayflowExitedReason", reason); } void LogInitiatePaymentAttempt() { - // TODO(crbug.com/337929926): Remove hardcoding for Pix and use - // FacilitatedPaymentsType enum. base::UmaHistogramBoolean("FacilitatedPayments.Pix.InitiatePayment.Attempt", /*sample=*/true); } void LogInitiatePaymentResultAndLatency(bool result, base::TimeDelta duration) { - // TODO(crbug.com/337929926): Remove hardcoding for Pix and use - // FacilitatedPaymentsType enum. base::UmaHistogramLongTimes( base::StrCat({"FacilitatedPayments.Pix.InitiatePayment.", result ? "Success" : "Failure", ".Latency"}), @@ -166,8 +156,6 @@ } void LogInitiatePurchaseActionAttempt() { - // TODO(crbug.com/337929926): Remove hardcoding for Pix and use - // FacilitatedPaymentsType enum. base::UmaHistogramBoolean( "FacilitatedPayments.Pix.InitiatePurchaseAction.Attempt", /*sample=*/true); @@ -175,8 +163,6 @@ void LogInitiatePurchaseActionResultAndLatency(PurchaseActionResult result, base::TimeDelta duration) { - // TODO(crbug.com/337929926): Remove hardcoding for Pix and use - // FacilitatedPaymentsType enum. base::UmaHistogramLongTimes( base::StrCat({"FacilitatedPayments.Pix.InitiatePurchaseAction.", GetInitiatePurchaseActionResultString(result), ".Latency"}),
diff --git a/components/fingerprinting_protection_filter/browser/fingerprinting_protection_page_activation_throttle.cc b/components/fingerprinting_protection_filter/browser/fingerprinting_protection_page_activation_throttle.cc index fab390bc..f4639ce8 100644 --- a/components/fingerprinting_protection_filter/browser/fingerprinting_protection_page_activation_throttle.cc +++ b/components/fingerprinting_protection_filter/browser/fingerprinting_protection_page_activation_throttle.cc
@@ -103,8 +103,8 @@ // If we have a reference to TrackingProtectionSettings, use it to check for // a URL-level exclusion. if (tracking_protection_settings_ != nullptr && - tracking_protection_settings_->GetTrackingProtectionSetting( - navigation_handle()->GetURL()) == CONTENT_SETTING_ALLOW) { + tracking_protection_settings_->HasTrackingProtectionException( + navigation_handle()->GetURL())) { // FP disabled by a Tracking Protection exception for the current URL. return {.level = ActivationLevel::kDisabled, .decision = ActivationDecision::URL_ALLOWLISTED};
diff --git a/components/guest_view/browser/bad_message.cc b/components/guest_view/browser/bad_message.cc index f4d4f6f..c2da60d 100644 --- a/components/guest_view/browser/bad_message.cc +++ b/components/guest_view/browser/bad_message.cc
@@ -27,7 +27,8 @@ content::RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); } -void ReceivedBadMessage(int render_process_id, BadMessageReason reason) { +void ReceivedBadMessage(content::ChildProcessId render_process_id, + BadMessageReason reason) { content::RenderProcessHost* rph = content::RenderProcessHost::FromID(render_process_id); if (!rph) @@ -35,6 +36,5 @@ ReceivedBadMessage(rph, reason); } - } // namespace bad_message } // namespace guest_view
diff --git a/components/guest_view/browser/bad_message.h b/components/guest_view/browser/bad_message.h index d9795776..9667346 100644 --- a/components/guest_view/browser/bad_message.h +++ b/components/guest_view/browser/bad_message.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_GUEST_VIEW_BROWSER_BAD_MESSAGE_H_ #define COMPONENTS_GUEST_VIEW_BROWSER_BAD_MESSAGE_H_ +#include "content/public/browser/child_process_id.h" + namespace content { class RenderProcessHost; } // namespace content @@ -39,8 +41,8 @@ // and terminates the process for |host| / |render_process_id|. void ReceivedBadMessage(content::RenderProcessHost* host, BadMessageReason reason); -void ReceivedBadMessage(int render_process_id, BadMessageReason reason); - +void ReceivedBadMessage(content::ChildProcessId render_process_id, + BadMessageReason reason); } // namespace bad_message } // namespace guest_view
diff --git a/components/guest_view/browser/guest_view.h b/components/guest_view/browser/guest_view.h index 745eaa8..d234ca5e 100644 --- a/components/guest_view/browser/guest_view.h +++ b/components/guest_view/browser/guest_view.h
@@ -34,6 +34,12 @@ GuestViewBase::FromInstanceID(embedder_process_id, guest_instance_id)); } + static T* FromInstanceID(content::ChildProcessId embedder_process_id, + int guest_instance_id) { + return AsDerivedGuest( + GuestViewBase::FromInstanceID(embedder_process_id, guest_instance_id)); + } + // Prefer using FromRenderFrameHost. See https://crbug.com/1362569. static T* FromWebContents(content::WebContents* contents) { return AsDerivedGuest(GuestViewBase::FromWebContents(contents));
diff --git a/components/guest_view/browser/guest_view_base.cc b/components/guest_view/browser/guest_view_base.cc index 9af7e96..4e7692b 100644 --- a/components/guest_view/browser/guest_view_base.cc +++ b/components/guest_view/browser/guest_view_base.cc
@@ -420,6 +420,18 @@ } // static +GuestViewBase* GuestViewBase::FromInstanceID( + content::ChildProcessId owner_process_id, + int guest_instance_id) { + auto* host = content::RenderProcessHost::FromID(owner_process_id); + if (!host) { + return nullptr; + } + + return GuestViewManager::FromBrowserContext(host->GetBrowserContext()) + ->GetGuestByInstanceIDSafely(guest_instance_id, owner_process_id); +} + GuestViewBase* GuestViewBase::FromInstanceID(int owner_process_id, int guest_instance_id) { auto* host = content::RenderProcessHost::FromID(owner_process_id);
diff --git a/components/guest_view/browser/guest_view_base.h b/components/guest_view/browser/guest_view_base.h index 7fee1d3..9e55141 100644 --- a/components/guest_view/browser/guest_view_base.h +++ b/components/guest_view/browser/guest_view_base.h
@@ -18,6 +18,7 @@ #include "components/guest_view/common/guest_view_constants.h" #include "components/zoom/zoom_observer.h" #include "content/public/browser/browser_plugin_guest_delegate.h" +#include "content/public/browser/child_process_id.h" #include "content/public/browser/frame_tree_node_id.h" #include "content/public/browser/global_routing_id.h" #include "content/public/browser/guest_page_holder.h" @@ -68,6 +69,9 @@ public zoom::ZoomObserver, public base::SupportsUserData::Data { public: + static GuestViewBase* FromInstanceID(content::ChildProcessId owner_process_id, + int instance_id); + static GuestViewBase* FromInstanceID(int owner_process_id, int instance_id); // Prefer using FromRenderFrameHost. See https://crbug.com/1362569.
diff --git a/components/guest_view/browser/guest_view_manager.cc b/components/guest_view/browser/guest_view_manager.cc index c94861bc..b10df70 100644 --- a/components/guest_view/browser/guest_view_manager.cc +++ b/components/guest_view/browser/guest_view_manager.cc
@@ -57,7 +57,7 @@ RenderProcessHost* host, const content::ChildProcessTerminationInfo& info) override { if (guest_view_manager_) - guest_view_manager_->EmbedderProcessDestroyed(host->GetDeprecatedID()); + guest_view_manager_->EmbedderProcessDestroyed(host->GetID()); } void RenderProcessHostDestroyed(RenderProcessHost* host) override { @@ -113,7 +113,7 @@ GuestViewBase* GuestViewManager::GetGuestByInstanceIDSafely( int guest_instance_id, - int embedder_render_process_id) { + content::ChildProcessId embedder_render_process_id) { if (!CanEmbedderAccessInstanceIDMaybeKill(embedder_render_process_id, guest_instance_id)) { return nullptr; @@ -121,7 +121,14 @@ return GetGuestByInstanceID(guest_instance_id); } -void GuestViewManager::AttachGuest(int embedder_process_id, +GuestViewBase* GuestViewManager::GetGuestByInstanceIDSafely( + int guest_instance_id, + int embedder_render_process_id) { + return GetGuestByInstanceIDSafely( + guest_instance_id, content::ChildProcessId(embedder_render_process_id)); +} + +void GuestViewManager::AttachGuest(content::ChildProcessId embedder_process_id, int element_instance_id, int guest_instance_id, const base::Value::Dict& attach_params) { @@ -145,6 +152,15 @@ guest_view->SetAttachParams(attach_params); } +void GuestViewManager::AttachGuest(int embedder_process_id, + int element_instance_id, + int guest_instance_id, + const base::Value::Dict& attach_params) { + GuestViewManager::AttachGuest(content::ChildProcessId(embedder_process_id), + element_instance_id, guest_instance_id, + attach_params); +} + bool GuestViewManager::IsOwnedByExtension(const GuestViewBase* guest) { return delegate_->IsOwnedByExtension(guest); } @@ -212,7 +228,7 @@ RenderProcessHost* owner_process = guest->owner_rfh()->GetProcess(); DCHECK(owner_process); ObserveEmbedderLifetime(owner_process); - owned_guests_.insert({owner_process->GetDeprecatedID(), std::move(guest)}); + owned_guests_.insert({owner_process->GetID(), std::move(guest)}); } std::unique_ptr<content::WebContents> @@ -435,7 +451,8 @@ return it == guest_page_frame_id_guestview_map_.end() ? nullptr : it->second; } -void GuestViewManager::EmbedderProcessDestroyed(int embedder_process_id) { +void GuestViewManager::EmbedderProcessDestroyed( + content::ChildProcessId embedder_process_id) { embedders_observed_.erase(embedder_process_id); // We can't just call std::multimap::erase here because destroying a guest @@ -454,7 +471,7 @@ CallViewDestructionCallbacks(embedder_process_id); } -void GuestViewManager::ViewCreated(int embedder_process_id, +void GuestViewManager::ViewCreated(content::ChildProcessId embedder_process_id, int view_instance_id, const std::string& view_type) { if (guest_view_registry_.empty()) @@ -475,13 +492,15 @@ } } -void GuestViewManager::ViewGarbageCollected(int embedder_process_id, - int view_instance_id) { +void GuestViewManager::ViewGarbageCollected( + content::ChildProcessId embedder_process_id, + int view_instance_id) { CallViewDestructionCallbacks(embedder_process_id, view_instance_id); } -void GuestViewManager::CallViewDestructionCallbacks(int embedder_process_id, - int view_instance_id) { +void GuestViewManager::CallViewDestructionCallbacks( + content::ChildProcessId embedder_process_id, + int view_instance_id) { // Find the callbacks for the embedder with ID |embedder_process_id|. auto embedder_it = view_destruction_callback_map_.find(embedder_process_id); if (embedder_it == view_destruction_callback_map_.end()) @@ -512,7 +531,8 @@ callbacks_for_embedder.erase(view_it); } -void GuestViewManager::CallViewDestructionCallbacks(int embedder_process_id) { +void GuestViewManager::CallViewDestructionCallbacks( + content::ChildProcessId embedder_process_id) { CallViewDestructionCallbacks(embedder_process_id, kInstanceIDNone); } @@ -551,7 +571,7 @@ } void GuestViewManager::RegisterViewDestructionCallback( - int embedder_process_id, + content::ChildProcessId embedder_process_id, int view_instance_id, base::OnceClosure callback) { RenderProcessHost* rph = RenderProcessHost::FromID(embedder_process_id); @@ -569,8 +589,8 @@ void GuestViewManager::ObserveEmbedderLifetime( RenderProcessHost* embedder_process) { - if (!embedders_observed_.count(embedder_process->GetDeprecatedID())) { - embedders_observed_.insert(embedder_process->GetDeprecatedID()); + if (!embedders_observed_.count(embedder_process->GetID())) { + embedders_observed_.insert(embedder_process->GetID()); // EmbedderRenderProcessHostObserver owns itself. new EmbedderRenderProcessHostObserver(weak_ptr_factory_.GetWeakPtr(), embedder_process); @@ -596,7 +616,7 @@ } bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( - int embedder_render_process_id, + content::ChildProcessId embedder_render_process_id, int guest_instance_id) { if (!CanEmbedderAccessInstanceID(embedder_render_process_id, guest_instance_id)) { @@ -616,7 +636,7 @@ } bool GuestViewManager::CanEmbedderAccessInstanceID( - int embedder_render_process_id, + content::ChildProcessId embedder_render_process_id, int guest_instance_id) { // TODO(crbug.com/41353094): Remove crash key once the cause of the kill is // known. @@ -648,13 +668,10 @@ // MimeHandlerViewGuests (PDF) may be embedded in a cross-process frame. // Other than MimeHandlerViewGuest, all other guest types are only permitted // to run in the main frame or its local subframes. - const int allowed_embedder_render_process_id = + const content::ChildProcessId allowed_embedder_render_process_id = guest_view->CanBeEmbeddedInsideCrossProcessFrames() - ? guest_view->owner_rfh()->GetProcess()->GetDeprecatedID() - : guest_view->owner_rfh() - ->GetMainFrame() - ->GetProcess() - ->GetDeprecatedID(); + ? guest_view->owner_rfh()->GetProcess()->GetID() + : guest_view->owner_rfh()->GetMainFrame()->GetProcess()->GetID(); if (embedder_render_process_id != allowed_embedder_render_process_id) { bad_access_key.Set("Bad embedder process"); @@ -669,11 +686,10 @@ element_instance_id(kInstanceIDNone) {} GuestViewManager::ElementInstanceKey::ElementInstanceKey( - int embedder_process_id, + content::ChildProcessId embedder_process_id, int element_instance_id) : embedder_process_id(embedder_process_id), - element_instance_id(element_instance_id) { -} + element_instance_id(element_instance_id) {} bool GuestViewManager::ElementInstanceKey::operator<( const GuestViewManager::ElementInstanceKey& other) const {
diff --git a/components/guest_view/browser/guest_view_manager.h b/components/guest_view/browser/guest_view_manager.h index 2a3c393..5713b29 100644 --- a/components/guest_view/browser/guest_view_manager.h +++ b/components/guest_view/browser/guest_view_manager.h
@@ -15,6 +15,7 @@ #include "base/memory/weak_ptr.h" #include "base/values.h" #include "content/public/browser/browser_plugin_guest_manager.h" +#include "content/public/browser/child_process_id.h" #include "content/public/browser/frame_tree_node_id.h" #include "content/public/browser/web_contents.h" @@ -61,12 +62,23 @@ // If the embedder is not allowed access, the embedder will be killed, and // this method will return NULL. If no guest exists with the given // instance ID, then NULL will also be returned. + GuestViewBase* GetGuestByInstanceIDSafely( + int guest_instance_id, + content::ChildProcessId embedder_render_process_id); + // TODO(crbug.com/379869738): Deprecated, please use the ChildProcessId + // version above. GuestViewBase* GetGuestByInstanceIDSafely(int guest_instance_id, int embedder_render_process_id); // Associates the Browser Plugin with |element_instance_id| to a // guest that has ID of |guest_instance_id| and sets initialization // parameters, |params| for it. + virtual void AttachGuest(content::ChildProcessId embedder_process_id, + int element_instance_id, + int guest_instance_id, + const base::Value::Dict& attach_params); + // TODO(crbug.com/379869738): Deprecated, please use the ChildProcessId + // version above. virtual void AttachGuest(int embedder_process_id, int element_instance_id, int guest_instance_id, @@ -87,7 +99,7 @@ content::RenderFrameHost* owner_rfh)>; using GuestViewCleanUpFunction = base::RepeatingCallback<void(content::BrowserContext*, - int embedder_process_id, + content::ChildProcessId embedder_process_id, int view_instance_id)>; void RegisterGuestViewType(const std::string& type, GuestViewCreateFunction create_function, @@ -96,6 +108,12 @@ // Registers a callback to be called when the view identified by // |embedder_process_id| and |view_instance_id| is destroyed. // Note that multiple callbacks can be registered for one view. + void RegisterViewDestructionCallback( + content::ChildProcessId embedder_process_id, + int view_instance_id, + base::OnceClosure callback); + // TODO(crbug.com/379869738): Deprecated, please use the ChildProcessId + // version above. void RegisterViewDestructionCallback(int embedder_process_id, int view_instance_id, base::OnceClosure callback); @@ -168,25 +186,27 @@ // This method is called when the embedder process with ID // |embedder_process_id| has been destroyed. - virtual void EmbedderProcessDestroyed(int embedder_process_id); + virtual void EmbedderProcessDestroyed( + content::ChildProcessId embedder_process_id); // Called when a GuestView has been created in JavaScript. - virtual void ViewCreated(int embedder_process_id, + virtual void ViewCreated(content::ChildProcessId embedder_process_id, int view_instance_id, const std::string& view_type); // Called when a GuestView has been garbage collected in JavaScript. - virtual void ViewGarbageCollected(int embedder_process_id, + virtual void ViewGarbageCollected(content::ChildProcessId embedder_process_id, int view_instance_id); // Calls all destruction callbacks registered for the GuestView identified by // |embedder_process_id| and |view_instance_id|. - void CallViewDestructionCallbacks(int embedder_process_id, + void CallViewDestructionCallbacks(content::ChildProcessId embedder_process_id, int view_instance_id); // Calls all destruction callbacks registered for GuestViews in the embedder // with ID |embedder_process_id|. - void CallViewDestructionCallbacks(int embedder_process_id); + void CallViewDestructionCallbacks( + content::ChildProcessId embedder_process_id); // Creates a guest of the provided |view_type|. std::unique_ptr<GuestViewBase> CreateGuestInternal( @@ -213,11 +233,12 @@ GuestViewBase* GetGuestByInstanceID(int guest_instance_id); bool CanEmbedderAccessInstanceIDMaybeKill( - int embedder_render_process_id, + content::ChildProcessId embedder_render_process_id, int guest_instance_id); - bool CanEmbedderAccessInstanceID(int embedder_render_process_id, - int guest_instance_id); + bool CanEmbedderAccessInstanceID( + content::ChildProcessId embedder_render_process_id, + int guest_instance_id); // Returns true if |guest_instance_id| can be used to add a new guest to this // manager. @@ -240,11 +261,11 @@ guest_page_frame_id_guestview_map_; struct ElementInstanceKey { - int embedder_process_id; + content::ChildProcessId embedder_process_id; int element_instance_id; ElementInstanceKey(); - ElementInstanceKey(int embedder_process_id, + ElementInstanceKey(content::ChildProcessId embedder_process_id, int element_instance_id); bool operator<(const ElementInstanceKey& other) const; @@ -284,20 +305,22 @@ std::unique_ptr<GuestViewManagerDelegate> delegate_; // This tracks which GuestView embedders are currently being observed. - std::set<int> embedders_observed_; + std::set<content::ChildProcessId> embedders_observed_; // Maps embedder process ids to unattached guests whose lifetimes are being // managed by this GuestViewManager. An unattached guest's lifetime is scoped // to the process that created it by this manager. Ownership is taken from // this manager via `TransferOwnership` upon guest attachment, or for cases // where an unattached guest needs to be destroyed earlier. - std::multimap<int, std::unique_ptr<GuestViewBase>> owned_guests_; + std::multimap<content::ChildProcessId, std::unique_ptr<GuestViewBase>> + owned_guests_; // |view_destruction_callback_map_| maps from embedder process ID to view ID // to a vector of callback functions to be called when that view is destroyed. using Callbacks = std::vector<base::OnceClosure>; using CallbacksForEachViewID = std::map<int, Callbacks>; - using CallbacksForEachEmbedderID = std::map<int, CallbacksForEachViewID>; + using CallbacksForEachEmbedderID = + std::map<content::ChildProcessId, CallbacksForEachViewID>; CallbacksForEachEmbedderID view_destruction_callback_map_; base::WeakPtrFactory<GuestViewManager> weak_ptr_factory_{this};
diff --git a/components/guest_view/browser/guest_view_message_handler.cc b/components/guest_view/browser/guest_view_message_handler.cc index 3a600c6..ef72d760 100644 --- a/components/guest_view/browser/guest_view_message_handler.cc +++ b/components/guest_view/browser/guest_view_message_handler.cc
@@ -24,7 +24,7 @@ public: ViewHandle(int view_instance_id, base::WeakPtr<GuestViewManager> guest_view_manager, - int render_process_id) + content::ChildProcessId render_process_id) : view_instance_id_(view_instance_id), guest_view_manager_(guest_view_manager), render_process_id_(render_process_id) {} @@ -39,7 +39,7 @@ private: const int view_instance_id_; base::WeakPtr<GuestViewManager> guest_view_manager_; - const int render_process_id_; + const content::ChildProcessId render_process_id_; }; GuestViewMessageHandler::GuestViewMessageHandler(
diff --git a/components/guest_view/browser/guest_view_message_handler.h b/components/guest_view/browser/guest_view_message_handler.h index f884e0ab..195e5996 100644 --- a/components/guest_view/browser/guest_view_message_handler.h +++ b/components/guest_view/browser/guest_view_message_handler.h
@@ -12,6 +12,7 @@ #include "base/values.h" #include "components/guest_view/common/guest_view.mojom.h" +#include "content/public/browser/child_process_id.h" #include "content/public/browser/global_routing_id.h" namespace content { @@ -32,7 +33,9 @@ explicit GuestViewMessageHandler( const content::GlobalRenderFrameHostId& frame_id); - int render_process_id() const { return frame_id_.child_id; } + content::ChildProcessId render_process_id() const { + return content::ChildProcessId(frame_id_.child_id); + } const content::GlobalRenderFrameHostId frame_id_;
diff --git a/components/guest_view/browser/test_guest_view_manager.cc b/components/guest_view/browser/test_guest_view_manager.cc index 0157f679..e40bd6de 100644 --- a/components/guest_view/browser/test_guest_view_manager.cc +++ b/components/guest_view/browser/test_guest_view_manager.cc
@@ -161,10 +161,11 @@ } } -void TestGuestViewManager::AttachGuest(int embedder_process_id, - int element_instance_id, - int guest_instance_id, - const base::Value::Dict& attach_params) { +void TestGuestViewManager::AttachGuest( + content::ChildProcessId embedder_process_id, + int element_instance_id, + int guest_instance_id, + const base::Value::Dict& attach_params) { auto* guest_to_attach = GuestViewBase::FromInstanceID(embedder_process_id, guest_instance_id); if (will_attach_callback_) @@ -180,6 +181,14 @@ } } +void TestGuestViewManager::AttachGuest(int embedder_process_id, + int element_instance_id, + int guest_instance_id, + const base::Value::Dict& attach_params) { + AttachGuest(content::ChildProcessId(embedder_process_id), element_instance_id, + guest_instance_id, attach_params); +} + void TestGuestViewManager::GetGuestRenderFrameHostList( std::vector<content::RenderFrameHost*>* guest_render_frame_host_list) { for (auto& watcher : guest_view_watchers_) { @@ -190,13 +199,15 @@ } } -void TestGuestViewManager::EmbedderProcessDestroyed(int embedder_process_id) { +void TestGuestViewManager::EmbedderProcessDestroyed( + content::ChildProcessId embedder_process_id) { ++num_embedder_processes_destroyed_; GuestViewManager::EmbedderProcessDestroyed(embedder_process_id); } -void TestGuestViewManager::ViewGarbageCollected(int embedder_process_id, - int view_instance_id) { +void TestGuestViewManager::ViewGarbageCollected( + content::ChildProcessId embedder_process_id, + int view_instance_id) { GuestViewManager::ViewGarbageCollected(embedder_process_id, view_instance_id); ++num_views_garbage_collected_; if (gc_run_loop_)
diff --git a/components/guest_view/browser/test_guest_view_manager.h b/components/guest_view/browser/test_guest_view_manager.h index cc29ff7..867bb0fd 100644 --- a/components/guest_view/browser/test_guest_view_manager.h +++ b/components/guest_view/browser/test_guest_view_manager.h
@@ -93,9 +93,14 @@ // guest_view::GuestViewManager: void AddGuest(GuestViewBase* guest) override; - void EmbedderProcessDestroyed(int embedder_process_id) override; - void ViewGarbageCollected(int embedder_process_id, + void EmbedderProcessDestroyed( + content::ChildProcessId embedder_process_id) override; + void ViewGarbageCollected(content::ChildProcessId embedder_process_id, int view_instance_id) override; + void AttachGuest(content::ChildProcessId embedder_process_id, + int element_instance_id, + int guest_instance_id, + const base::Value::Dict& attach_params) override; void AttachGuest(int embedder_process_id, int element_instance_id, int guest_instance_id,
diff --git a/components/history_embeddings/answerer.cc b/components/history_embeddings/answerer.cc index 4e8575a..5db5ab5 100644 --- a/components/history_embeddings/answerer.cc +++ b/components/history_embeddings/answerer.cc
@@ -15,7 +15,7 @@ AnswererResult::AnswererResult( ComputeAnswerStatus status, std::string query, - optimization_guide::proto::Answer answer, + optimization_guide::proto::features::Answer answer, std::unique_ptr<optimization_guide::ModelQualityLogEntry> log_entry, std::string url, std::vector<std::string> text_directives) @@ -25,9 +25,10 @@ log_entry(std::move(log_entry)), url(std::move(url)), text_directives(std::move(text_directives)) {} -AnswererResult::AnswererResult(ComputeAnswerStatus status, - std::string query, - optimization_guide::proto::Answer answer) +AnswererResult::AnswererResult( + ComputeAnswerStatus status, + std::string query, + optimization_guide::proto::features::Answer answer) : status(status), query(std::move(query)), answer(std::move(answer)) {} AnswererResult::AnswererResult(AnswererResult&&) = default; AnswererResult::~AnswererResult() {
diff --git a/components/history_embeddings/answerer.h b/components/history_embeddings/answerer.h index 8fbf344d..0b0fdcd 100644 --- a/components/history_embeddings/answerer.h +++ b/components/history_embeddings/answerer.h
@@ -54,13 +54,13 @@ AnswererResult( ComputeAnswerStatus status, std::string query, - optimization_guide::proto::Answer answer, + optimization_guide::proto::features::Answer answer, std::unique_ptr<optimization_guide::ModelQualityLogEntry> log_entry, std::string url, std::vector<std::string> text_directives); AnswererResult(ComputeAnswerStatus status, std::string query, - optimization_guide::proto::Answer answer); + optimization_guide::proto::features::Answer answer); AnswererResult(AnswererResult&&); ~AnswererResult(); AnswererResult& operator=(AnswererResult&&); @@ -71,7 +71,7 @@ ComputeAnswerStatus status = ComputeAnswerStatus::kUnspecified; std::string query; - optimization_guide::proto::Answer answer; + optimization_guide::proto::features::Answer answer; // The partially populated v2 quality log entry. This will be dropped // on destruction to avoid logging when logging is disabled. If logging // is enabled, then it will be taken from here by
diff --git a/components/history_embeddings/history_embeddings_service.cc b/components/history_embeddings/history_embeddings_service.cc index 2313b11..2e71b07 100644 --- a/components/history_embeddings/history_embeddings_service.cc +++ b/components/history_embeddings/history_embeddings_service.cc
@@ -498,8 +498,8 @@ SearchResult& result, std::set<size_t> selections, size_t num_entered_characters, - optimization_guide::proto::UserFeedback user_feedback, - optimization_guide::proto::UiSurface ui_surface) { + optimization_guide::proto::features::UserFeedback user_feedback, + optimization_guide::proto::features::UiSurface ui_surface) { // Exit early if logging is not enabled. if (!GetFeatureParameters().send_quality_log || !embedder_metadata_.has_value()) { @@ -527,7 +527,7 @@ base::Uuid::GenerateRandomV4().AsLowercaseString(), })); - optimization_guide::proto::HistoryQueryQuality* query_quality = + optimization_guide::proto::features::HistoryQueryQuality* query_quality = optimization_guide::HistoryQueryFeatureTypeMap::GetLoggingData(*request) ->mutable_quality(); if (!query_quality) { @@ -552,7 +552,7 @@ for (size_t row_index = 0; row_index < result.scored_url_rows.size(); ++row_index) { const ScoredUrlRow& scored_url_row = result.scored_url_rows[row_index]; - optimization_guide::proto::DocumentShown* document_shown = + optimization_guide::proto::features::DocumentShown* document_shown = query_quality->add_top_documents_shown(); document_shown->set_url(scored_url_row.row.url().spec()); document_shown->set_was_clicked(selections.contains(row_index)); @@ -566,7 +566,7 @@ // Log the top passages that may be used as context for the Answerer. for (size_t passage_index : scored_url_row.GetBestScoreIndices( 0, GetFeatureParameters().context_passages_minimum_word_count)) { - optimization_guide::proto::PassageData* passage_data = + optimization_guide::proto::features::PassageData* passage_data = document_shown->add_passages(); passage_data->set_text( scored_url_row.passages_embeddings.passages.passages( @@ -583,10 +583,11 @@ } if (result.scored_url_rows.size() > 0) { query_quality->set_final_model_status( - any_document_clicked ? optimization_guide::proto::FinalModelStatus:: - FINAL_MODEL_STATUS_SUCCESS - : optimization_guide::proto::FinalModelStatus:: - FINAL_MODEL_STATUS_FAILURE); + any_document_clicked + ? optimization_guide::proto::features::FinalModelStatus:: + FINAL_MODEL_STATUS_SUCCESS + : optimization_guide::proto::features::FinalModelStatus:: + FINAL_MODEL_STATUS_FAILURE); } // The data is sent when `log_entry` destructs. @@ -602,9 +603,9 @@ std::unique_ptr<optimization_guide::ModelQualityLogEntry> log_entry = std::move(result.answerer_result.log_entry); if (log_entry) { - optimization_guide::proto::HistoryAnswerQuality* answer_quality = - log_entry - ->quality_data<optimization_guide::HistoryAnswerFeatureTypeMap>(); + optimization_guide::proto::features::HistoryAnswerQuality* + answer_quality = log_entry->quality_data< + optimization_guide::HistoryAnswerFeatureTypeMap>(); if (answer_quality) { answer_quality->set_session_id(result.session_id); answer_quality->set_url(result.answerer_result.url); @@ -1027,7 +1028,7 @@ SearchResult loadingResult = result.Clone(); loadingResult.answerer_result = AnswererResult(ComputeAnswerStatus::kLoading, result.query, - optimization_guide::proto::Answer()); + optimization_guide::proto::features::Answer()); callback.Run(std::move(loadingResult)); Answerer::Context context(result.session_id);
diff --git a/components/history_embeddings/history_embeddings_service.h b/components/history_embeddings/history_embeddings_service.h index 3b954e9..ab07eae8 100644 --- a/components/history_embeddings/history_embeddings_service.h +++ b/components/history_embeddings/history_embeddings_service.h
@@ -201,11 +201,12 @@ // Submit quality logging data after user selects an item from search result. // Note, the `result` contains a log entry that will be consumed by this call. - void SendQualityLog(SearchResult& result, - std::set<size_t> selections, - size_t num_entered_characters, - optimization_guide::proto::UserFeedback user_feedback, - optimization_guide::proto::UiSurface ui_surface); + void SendQualityLog( + SearchResult& result, + std::set<size_t> selections, + size_t num_entered_characters, + optimization_guide::proto::features::UserFeedback user_feedback, + optimization_guide::proto::features::UiSurface ui_surface); // KeyedService: void Shutdown() override;
diff --git a/components/history_embeddings/ml_answerer.cc b/components/history_embeddings/ml_answerer.cc index a9be764..f56501c1 100644 --- a/components/history_embeddings/ml_answerer.cc +++ b/components/history_embeddings/ml_answerer.cc
@@ -20,9 +20,9 @@ using optimization_guide::OptimizationGuideModelExecutionError; using optimization_guide::OptimizationGuideModelStreamingExecutionResult; using optimization_guide::SessionConfigParams; -using optimization_guide::proto::Answer; -using optimization_guide::proto::HistoryAnswerRequest; -using optimization_guide::proto::Passage; +using optimization_guide::proto::features::Answer; +using optimization_guide::proto::features::HistoryAnswerRequest; +using optimization_guide::proto::features::Passage; namespace { @@ -194,7 +194,7 @@ std::move(result.log_entry), "", {})); } else if (result.response->is_complete) { auto response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::HistoryAnswerResponse>( + optimization_guide::proto::features::HistoryAnswerResponse>( std::move(result.response).value().response); AnswererResult answerer_result( ComputeAnswerStatus::kSuccess, query_, response->answer(), @@ -239,7 +239,7 @@ // Use a dummy request here since both passages and query are already added // to context. if (!sessions_.empty()) { - optimization_guide::proto::HistoryAnswerRequest request; + optimization_guide::proto::features::HistoryAnswerRequest request; const size_t session_index = std::get<0>(session_scores[max_index]); VLOG(3) << "Running ExecuteModel for session " << session_index; sessions_[session_index]->ExecuteModel(
diff --git a/components/history_embeddings/ml_answerer_unittest.cc b/components/history_embeddings/ml_answerer_unittest.cc index 3eadb4b..5efb103 100644 --- a/components/history_embeddings/ml_answerer_unittest.cc +++ b/components/history_embeddings/ml_answerer_unittest.cc
@@ -22,7 +22,7 @@ using ::optimization_guide::MockSession; using ::optimization_guide::OptimizationGuideModelExecutionError; using ::optimization_guide::OptimizationGuideModelStreamingExecutionResult; -using ::optimization_guide::proto::HistoryAnswerResponse; +using ::optimization_guide::proto::features::HistoryAnswerResponse; using ::testing::_; using ::testing::NiceMock; using ::testing::StrictMock;
diff --git a/components/history_embeddings/ml_intent_classifier.cc b/components/history_embeddings/ml_intent_classifier.cc index 284f069..7d9d51f 100644 --- a/components/history_embeddings/ml_intent_classifier.cc +++ b/components/history_embeddings/ml_intent_classifier.cc
@@ -29,8 +29,8 @@ using ::optimization_guide::ParsedAnyMetadata; using ::optimization_guide::proto::HistoryQueryIntentModelMetadata; -using ::optimization_guide::proto::HistoryQueryIntentRequest; -using ::optimization_guide::proto::HistoryQueryIntentResponse; +using ::optimization_guide::proto::features::HistoryQueryIntentRequest; +using ::optimization_guide::proto::features::HistoryQueryIntentResponse; } // namespace
diff --git a/components/history_embeddings/ml_intent_classifier_unittest.cc b/components/history_embeddings/ml_intent_classifier_unittest.cc index 238df2f..a8b49d6 100644 --- a/components/history_embeddings/ml_intent_classifier_unittest.cc +++ b/components/history_embeddings/ml_intent_classifier_unittest.cc
@@ -30,8 +30,8 @@ using optimization_guide::proto::Any; using optimization_guide::proto::HistoryQueryIntentModelMetadata; -using optimization_guide::proto::HistoryQueryIntentRequest; -using optimization_guide::proto::HistoryQueryIntentResponse; +using optimization_guide::proto::features::HistoryQueryIntentRequest; +using optimization_guide::proto::features::HistoryQueryIntentResponse; auto FakeExecute(const google::protobuf::MessageLite& request_metadata) { const HistoryQueryIntentRequest* request =
diff --git a/components/history_embeddings/mock_answerer.cc b/components/history_embeddings/mock_answerer.cc index dcf05b8..02eb5ce4 100644 --- a/components/history_embeddings/mock_answerer.cc +++ b/components/history_embeddings/mock_answerer.cc
@@ -21,7 +21,7 @@ void MockAnswerer::ComputeAnswer(std::string query, Context context, ComputeAnswerCallback callback) { - optimization_guide::proto::Answer answer; + optimization_guide::proto::features::Answer answer; answer.set_text(std::string("This is the answer to query '") + query + std::string("'.")); AnswererResult result(static_cast<ComputeAnswerStatus>( @@ -31,7 +31,7 @@ // Set URL and passage citation if available. auto it = context.url_passages_map.begin(); if (it != context.url_passages_map.end()) { - optimization_guide::proto::Citation* citation = + optimization_guide::proto::features::Citation* citation = result.answer.add_citations(); citation->set_passage_id("0001"); result.url = it->first;
diff --git a/components/keep_alive_registry/keep_alive_types.cc b/components/keep_alive_registry/keep_alive_types.cc index 3160870c..558b0df 100644 --- a/components/keep_alive_registry/keep_alive_types.cc +++ b/components/keep_alive_registry/keep_alive_types.cc
@@ -44,8 +44,6 @@ return out << "NATIVE_MESSAGING_HOST_ERROR_REPORT"; case KeepAliveOrigin::GLIC_LAUNCHER: return out << "GLIC_LAUNCHER"; - case KeepAliveOrigin::GLIC_VIEW: - return out << "GLIC_VIEW"; case KeepAliveOrigin::NOTIFICATION: return out << "NOTIFICATION"; case KeepAliveOrigin::PENDING_NOTIFICATION_CLICK_EVENT:
diff --git a/components/keep_alive_registry/keep_alive_types.h b/components/keep_alive_registry/keep_alive_types.h index 7a1b8df0..b08ca21 100644 --- a/components/keep_alive_registry/keep_alive_types.h +++ b/components/keep_alive_registry/keep_alive_types.h
@@ -49,7 +49,6 @@ // c/b/glic GLIC_LAUNCHER, - GLIC_VIEW, // c/b/notifications NOTIFICATION,
diff --git a/components/optimization_guide/content/browser/page_content_proto_provider.cc b/components/optimization_guide/content/browser/page_content_proto_provider.cc index 6765c2e..8324981 100644 --- a/components/optimization_guide/content/browser/page_content_proto_provider.cc +++ b/components/optimization_guide/content/browser/page_content_proto_provider.cc
@@ -51,7 +51,7 @@ content::GlobalRenderFrameHostToken main_frame_token, std::unique_ptr<optimization_guide::AIPageContentMap> page_content_map, OnAIPageContentDone done_callback) { - optimization_guide::proto::AnnotatedPageContent proto; + optimization_guide::proto::features::AnnotatedPageContent proto; if (optimization_guide::ConvertAIPageContentToProto( main_frame_token, *page_content_map, base::BindRepeating(&GetRenderFrameInfo), &proto)) {
diff --git a/components/optimization_guide/content/browser/page_content_proto_provider.h b/components/optimization_guide/content/browser/page_content_proto_provider.h index 7e3120d8..067e7d64 100644 --- a/components/optimization_guide/content/browser/page_content_proto_provider.h +++ b/components/optimization_guide/content/browser/page_content_proto_provider.h
@@ -17,7 +17,7 @@ // Provides AIPageContent representation for the primary page displayed in a // WebContents. using OnAIPageContentDone = base::OnceCallback<void( - std::optional<optimization_guide::proto::AnnotatedPageContent>)>; + std::optional<optimization_guide::proto::features::AnnotatedPageContent>)>; void GetAIPageContent(content::WebContents* web_contents, OnAIPageContentDone done_callback);
diff --git a/components/optimization_guide/content/browser/page_content_proto_provider_browsertest.cc b/components/optimization_guide/content/browser/page_content_proto_provider_browsertest.cc index 1ac76f9..64cad430 100644 --- a/components/optimization_guide/content/browser/page_content_proto_provider_browsertest.cc +++ b/components/optimization_guide/content/browser/page_content_proto_provider_browsertest.cc
@@ -31,25 +31,27 @@ FILE_PATH_LITERAL("components/test/data/optimization_guide")); } -void AssertHasText(const optimization_guide::proto::ContentNode& node, +void AssertHasText(const optimization_guide::proto::features::ContentNode& node, std::string text) { const auto& content_attributes = node.content_attributes(); EXPECT_EQ(content_attributes.attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_ROOT); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_ROOT); EXPECT_EQ(content_attributes.text_info().size(), 1); EXPECT_EQ(content_attributes.text_info().at(0).text_content(), text); } -void AssertRectsEqual(const optimization_guide::proto::BoundingRect& proto_rect, - gfx::Rect rect) { +void AssertRectsEqual( + const optimization_guide::proto::features::BoundingRect& proto_rect, + gfx::Rect rect) { EXPECT_EQ(proto_rect.width(), rect.width()); EXPECT_EQ(proto_rect.height(), rect.height()); EXPECT_EQ(proto_rect.x(), rect.x()); EXPECT_EQ(proto_rect.y(), rect.y()); } -void AssertRectsEqual(const optimization_guide::proto::BoundingRect& a, - const optimization_guide::proto::BoundingRect& b) { +void AssertRectsEqual( + const optimization_guide::proto::features::BoundingRect& a, + const optimization_guide::proto::features::BoundingRect& b) { EXPECT_EQ(a.width(), b.width()); EXPECT_EQ(a.height(), b.height()); EXPECT_EQ(a.x(), b.x()); @@ -97,13 +99,16 @@ command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, "1.0"); } - void SetPageContent(base::OnceClosure quit_closure, - std::optional<proto::AnnotatedPageContent> page_content) { + void SetPageContent( + base::OnceClosure quit_closure, + std::optional<proto::features::AnnotatedPageContent> page_content) { page_content_ = std::move(page_content); std::move(quit_closure).Run(); } - const proto::AnnotatedPageContent& page_content() { return *page_content_; } + const proto::features::AnnotatedPageContent& page_content() { + return *page_content_; + } void LoadData() { base::RunLoop run_loop; @@ -136,7 +141,7 @@ private: std::unique_ptr<net::EmbeddedTestServer> https_server_; - std::optional<proto::AnnotatedPageContent> page_content_; + std::optional<proto::features::AnnotatedPageContent> page_content_; }; IN_PROC_BROWSER_TEST_F(PageContentProtoProviderBrowserTest, AIPageContent) { @@ -221,7 +226,7 @@ const auto& iframe = page_content().root_node().children_nodes()[0]; EXPECT_EQ(iframe.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_IFRAME); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_IFRAME); const auto& iframe_data = iframe.content_attributes().iframe_data(); AssertValidURL(iframe_data.url(), "a.com"); EXPECT_FALSE(iframe_data.likely_ad_frame()); @@ -237,7 +242,7 @@ const auto& iframe = page_content().root_node().children_nodes()[0]; EXPECT_EQ(iframe.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_IFRAME); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_IFRAME); const auto& iframe_data = iframe.content_attributes().iframe_data(); AssertValidURL(iframe_data.url(), "a.com"); EXPECT_FALSE(iframe_data.likely_ad_frame()); @@ -268,17 +273,17 @@ const auto& iframe = page_content().root_node().children_nodes()[0]; ASSERT_EQ(iframe.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_IFRAME); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_IFRAME); ASSERT_EQ(iframe.children_nodes().size(), 1); const auto& iframe_root = iframe.children_nodes()[0]; ASSERT_EQ(iframe_root.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_ROOT); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_ROOT); ASSERT_EQ(iframe_root.children_nodes().size(), 1); const auto& p = iframe_root.children_nodes()[0]; EXPECT_EQ(p.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_PARAGRAPH); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_PARAGRAPH); const auto& geometry = p.content_attributes().geometry(); AssertRectsEqual(geometry.outer_bounding_box(), gfx::Rect(-20, -10, 100, 200)); @@ -299,16 +304,16 @@ const auto& iframe = page_content().root_node().children_nodes()[0]; ASSERT_EQ(iframe.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_IFRAME); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_IFRAME); ASSERT_EQ(iframe.children_nodes().size(), 1); const auto& iframe_root = iframe.children_nodes()[0]; ASSERT_EQ(iframe_root.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_ROOT); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_ROOT); const auto& p = iframe_root.children_nodes()[0]; EXPECT_EQ(p.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_PARAGRAPH); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_PARAGRAPH); // TODO(khushalsagar): This is an existing bug where the scroll offset of the // root scroller in the ancestor remote frame is not applied. @@ -358,7 +363,7 @@ const auto& b_frame = page_content().root_node().children_nodes()[0]; EXPECT_EQ(b_frame.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_IFRAME); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_IFRAME); const auto& b_frame_data = b_frame.content_attributes().iframe_data(); AssertValidURL(b_frame_data.url(), "b.com"); EXPECT_FALSE(b_frame_data.likely_ad_frame()); @@ -371,7 +376,7 @@ const auto& c_frame = page_content().root_node().children_nodes()[1]; EXPECT_EQ(c_frame.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_IFRAME); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_IFRAME); const auto& c_frame_data = c_frame.content_attributes().iframe_data(); AssertValidURL(c_frame_data.url(), "c.com"); EXPECT_FALSE(c_frame_data.likely_ad_frame()); @@ -417,7 +422,7 @@ const auto& b_frame = page_content().root_node().children_nodes()[0]; EXPECT_EQ(b_frame.content_attributes().attribute_type(), - optimization_guide::proto::CONTENT_ATTRIBUTE_IFRAME); + optimization_guide::proto::features::CONTENT_ATTRIBUTE_IFRAME); const auto& b_frame_data = b_frame.content_attributes().iframe_data(); AssertValidURL(b_frame_data.url(), "b.com"); EXPECT_FALSE(b_frame_data.likely_ad_frame());
diff --git a/components/optimization_guide/content/browser/page_content_proto_util.cc b/components/optimization_guide/content/browser/page_content_proto_util.cc index 1e21d6f..e03f703 100644 --- a/components/optimization_guide/content/browser/page_content_proto_util.cc +++ b/components/optimization_guide/content/browser/page_content_proto_util.cc
@@ -14,28 +14,30 @@ namespace optimization_guide { namespace { -optimization_guide::proto::ContentAttributeType ConvertAttributeType( +optimization_guide::proto::features::ContentAttributeType ConvertAttributeType( blink::mojom::AIPageContentAttributeType type) { switch (type) { case blink::mojom::AIPageContentAttributeType::kRoot: - return optimization_guide::proto::CONTENT_ATTRIBUTE_ROOT; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_ROOT; case blink::mojom::AIPageContentAttributeType::kContainer: - return optimization_guide::proto::CONTENT_ATTRIBUTE_CONTAINER; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_CONTAINER; case blink::mojom::AIPageContentAttributeType::kIframe: - return optimization_guide::proto::CONTENT_ATTRIBUTE_IFRAME; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_IFRAME; case blink::mojom::AIPageContentAttributeType::kParagraph: - return optimization_guide::proto::CONTENT_ATTRIBUTE_PARAGRAPH; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_PARAGRAPH; case blink::mojom::AIPageContentAttributeType::kHeading: - return optimization_guide::proto::CONTENT_ATTRIBUTE_HEADING; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_HEADING; case blink::mojom::AIPageContentAttributeType::kOrderedList: - return optimization_guide::proto::CONTENT_ATTRIBUTE_ORDERED_LIST; + return optimization_guide::proto::features:: + CONTENT_ATTRIBUTE_ORDERED_LIST; case blink::mojom::AIPageContentAttributeType::kUnorderedList: - return optimization_guide::proto::CONTENT_ATTRIBUTE_UNORDERED_LIST; + return optimization_guide::proto::features:: + CONTENT_ATTRIBUTE_UNORDERED_LIST; case blink::mojom::AIPageContentAttributeType::kAnchor: // TODO(crbug.com/382083796): Add this type to the proto. - return optimization_guide::proto::CONTENT_ATTRIBUTE_UNKNOWN; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_UNKNOWN; case blink::mojom::AIPageContentAttributeType::kForm: - return optimization_guide::proto::CONTENT_ATTRIBUTE_FORM; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_FORM; case blink::mojom::AIPageContentAttributeType::kFigure: case blink::mojom::AIPageContentAttributeType::kHeader: case blink::mojom::AIPageContentAttributeType::kNav: @@ -46,27 +48,29 @@ case blink::mojom::AIPageContentAttributeType::kAside: case blink::mojom::AIPageContentAttributeType::kFooter: // TODO(crbug.com/382083796): Add this type to the proto. - return optimization_guide::proto::CONTENT_ATTRIBUTE_UNKNOWN; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_UNKNOWN; case blink::mojom::AIPageContentAttributeType::kTable: - return optimization_guide::proto::CONTENT_ATTRIBUTE_TABLE; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_TABLE; case blink::mojom::AIPageContentAttributeType::kTableCell: // TODO(crbug.com/382083796): Add this type to the proto. - return optimization_guide::proto::CONTENT_ATTRIBUTE_UNKNOWN; + return optimization_guide::proto::features::CONTENT_ATTRIBUTE_UNKNOWN; } NOTREACHED(); } -void ConvertRect(const gfx::Rect& mojom_rect, - optimization_guide::proto::BoundingRect* proto_rect) { +void ConvertRect( + const gfx::Rect& mojom_rect, + optimization_guide::proto::features::BoundingRect* proto_rect) { proto_rect->set_x(mojom_rect.x()); proto_rect->set_y(mojom_rect.y()); proto_rect->set_width(mojom_rect.width()); proto_rect->set_height(mojom_rect.height()); } -void ConvertGeometry(const blink::mojom::AIPageContentGeometry& mojom_geometry, - optimization_guide::proto::Geometry* proto_geometry) { +void ConvertGeometry( + const blink::mojom::AIPageContentGeometry& mojom_geometry, + optimization_guide::proto::features::Geometry* proto_geometry) { ConvertRect(mojom_geometry.outer_bounding_box, proto_geometry->mutable_outer_bounding_box()); ConvertRect(mojom_geometry.visible_bounding_box, @@ -75,8 +79,8 @@ void ConvertTextInfo( const std::vector<blink::mojom::AIPageContentTextInfoPtr>& mojom_text_info, - google::protobuf::RepeatedPtrField<optimization_guide::proto::TextInfo>* - proto_text_info) { + google::protobuf::RepeatedPtrField< + optimization_guide::proto::features::TextInfo>* proto_text_info) { for (const auto& mojom_text : mojom_text_info) { auto* proto_text = proto_text_info->Add(); proto_text->set_text_content(mojom_text->text_content); @@ -92,8 +96,8 @@ void ConvertImageInfo( const std::vector<blink::mojom::AIPageContentImageInfoPtr>& mojom_image_info, - google::protobuf::RepeatedPtrField<optimization_guide::proto::ImageInfo>* - proto_image_info) { + google::protobuf::RepeatedPtrField< + optimization_guide::proto::features::ImageInfo>* proto_image_info) { for (const auto& mojom_image : mojom_image_info) { auto* proto_image = proto_image_info->Add(); if (mojom_image->image_caption) { @@ -114,7 +118,7 @@ void ConvertAttributes( const blink::mojom::AIPageContentAttributes& mojom_attributes, - optimization_guide::proto::ContentAttributes* proto_attributes) { + optimization_guide::proto::features::ContentAttributes* proto_attributes) { for (const auto& dom_node_id : mojom_attributes.dom_node_ids) { proto_attributes->add_dom_node_ids(dom_node_id); } @@ -141,7 +145,7 @@ void ConvertIframeData( const RenderFrameInfo& render_frame_info, const blink::mojom::AIPageContentIframeData& iframe_data, - optimization_guide::proto::IframeData* proto_iframe_data) { + optimization_guide::proto::features::IframeData* proto_iframe_data) { proto_iframe_data->set_url(render_frame_info.source_origin.Serialize()); proto_iframe_data->set_likely_ad_frame(iframe_data.likely_ad_frame); } @@ -150,7 +154,7 @@ const blink::mojom::AIPageContentNode& mojom_node, const AIPageContentMap& page_content_map, GetRenderFrameInfo get_render_frame_info, - optimization_guide::proto::ContentNode* proto_node) { + optimization_guide::proto::features::ContentNode* proto_node) { const auto& mojom_attributes = *mojom_node.content_attributes; ConvertAttributes(mojom_attributes, proto_node->mutable_content_attributes()); @@ -217,7 +221,7 @@ content::GlobalRenderFrameHostToken main_frame_token, const AIPageContentMap& page_content_map, GetRenderFrameInfo get_render_frame_info, - optimization_guide::proto::AnnotatedPageContent* proto) { + optimization_guide::proto::features::AnnotatedPageContent* proto) { auto it = page_content_map.find(main_frame_token); if (it == page_content_map.end()) { return false; @@ -231,7 +235,7 @@ } proto->set_version( - optimization_guide::proto::ANNOTATED_PAGE_CONTENT_VERSION_1_0); + optimization_guide::proto::features::ANNOTATED_PAGE_CONTENT_VERSION_1_0); return true; }
diff --git a/components/optimization_guide/content/browser/page_content_proto_util.h b/components/optimization_guide/content/browser/page_content_proto_util.h index 161a0c00..0f17b20 100644 --- a/components/optimization_guide/content/browser/page_content_proto_util.h +++ b/components/optimization_guide/content/browser/page_content_proto_util.h
@@ -33,7 +33,7 @@ content::GlobalRenderFrameHostToken main_frame_token, const AIPageContentMap& page_content_map, GetRenderFrameInfo get_render_frame_info, - optimization_guide::proto::AnnotatedPageContent* proto); + optimization_guide::proto::features::AnnotatedPageContent* proto); } // namespace optimization_guide
diff --git a/components/optimization_guide/content/browser/page_content_proto_util_unittest.cc b/components/optimization_guide/content/browser/page_content_proto_util_unittest.cc index 54099a07..8406182 100644 --- a/components/optimization_guide/content/browser/page_content_proto_util_unittest.cc +++ b/components/optimization_guide/content/browser/page_content_proto_util_unittest.cc
@@ -52,7 +52,7 @@ NOTREACHED(); }); - proto::AnnotatedPageContent proto; + proto::features::AnnotatedPageContent proto; EXPECT_FALSE(ConvertAIPageContentToProto(main_frame_token, page_content_map, get_render_frame_info, &proto)); } @@ -80,7 +80,7 @@ return std::nullopt; }); - proto::AnnotatedPageContent proto; + proto::features::AnnotatedPageContent proto; EXPECT_FALSE(ConvertAIPageContentToProto(main_frame_token, page_content_map, get_render_frame_info, &proto)); ASSERT_TRUE(query_token.has_value());
diff --git a/components/optimization_guide/core/feature_registry/feature_registration.cc b/components/optimization_guide/core/feature_registry/feature_registration.cc index 32ecc71..c1052b2 100644 --- a/components/optimization_guide/core/feature_registry/feature_registration.cc +++ b/components/optimization_guide/core/feature_registry/feature_registration.cc
@@ -108,10 +108,10 @@ base::BindRepeating([](proto::LogAiDataRequest& request_proto) { // If there is no tab organization, we don't have any user_feedback mark // it as unspecified. - const proto::TabOrganizationQuality& quality = + const proto::features::TabOrganizationQuality& quality = request_proto.tab_organization().quality(); if (quality.organizations().empty()) { - return proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + return proto::features::UserFeedback::USER_FEEDBACK_UNSPECIFIED; } if (quality.user_feedback()) { return quality.user_feedback(); @@ -173,7 +173,7 @@ base::BindRepeating([](proto::LogAiDataRequest& request_proto) { // There is no user feedback on history answer. It's recorded on history // query. - return proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + return proto::features::UserFeedback::USER_FEEDBACK_UNSPECIFIED; }); auto mqls_metadata_answer = std::make_unique<MqlsFeatureMetadata>( "HistoryAnswer", proto::LogAiDataRequest::FeatureCase::kHistoryAnswer,
diff --git a/components/optimization_guide/core/feature_registry/mqls_feature_registry.h b/components/optimization_guide/core/feature_registry/mqls_feature_registry.h index 5608af9..bb2fa5b 100644 --- a/components/optimization_guide/core/feature_registry/mqls_feature_registry.h +++ b/components/optimization_guide/core/feature_registry/mqls_feature_registry.h
@@ -23,7 +23,8 @@ } // namespace proto using UserFeedbackCallback = - base::RepeatingCallback<proto::UserFeedback(proto::LogAiDataRequest&)>; + base::RepeatingCallback<proto::features::UserFeedback( + proto::LogAiDataRequest&)>; // MqlsFeatureMetadata holds metadata for each proto logged using the Model // Quality Logging Service (MQLS). Note that for a given user-visible feature,
diff --git a/components/optimization_guide/core/feature_registry/mqls_feature_registry_unittest.cc b/components/optimization_guide/core/feature_registry/mqls_feature_registry_unittest.cc index 45aa2a9..c494c55e 100644 --- a/components/optimization_guide/core/feature_registry/mqls_feature_registry_unittest.cc +++ b/components/optimization_guide/core/feature_registry/mqls_feature_registry_unittest.cc
@@ -31,7 +31,7 @@ EnterprisePolicyPref enterprise_policy("policy_name"); UserFeedbackCallback logging_callback = base::BindRepeating([](proto::LogAiDataRequest& request_proto) { - return proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + return proto::features::UserFeedback::USER_FEEDBACK_UNSPECIFIED; }); auto metadata = std::make_unique<MqlsFeatureMetadata>( "Test", proto::LogAiDataRequest::FeatureCase::kCompose, enterprise_policy, @@ -58,7 +58,7 @@ UserFeedbackCallback logging_callback = base::BindRepeating([](proto::LogAiDataRequest& request_proto) { - return proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + return proto::features::UserFeedback::USER_FEEDBACK_UNSPECIFIED; }); MqlsFeatureMetadata metadata( "Test", proto::LogAiDataRequest::FeatureCase::kCompose, @@ -73,7 +73,7 @@ UserFeedbackCallback logging_callback = base::BindRepeating([](proto::LogAiDataRequest& request_proto) { - return proto::UserFeedback::USER_FEEDBACK_UNSPECIFIED; + return proto::features::UserFeedback::USER_FEEDBACK_UNSPECIFIED; }); MqlsFeatureMetadata metadata( "Test", proto::LogAiDataRequest::FeatureCase::kCompose,
diff --git a/components/optimization_guide/core/model_execution/aqa_response_parser.cc b/components/optimization_guide/core/model_execution/aqa_response_parser.cc index b7a5dfb..37a33a1 100644 --- a/components/optimization_guide/core/model_execution/aqa_response_parser.cc +++ b/components/optimization_guide/core/model_execution/aqa_response_parser.cc
@@ -47,7 +47,8 @@ // fails, return the corresponding failure enum. optimization_guide::AqaResponseParser::Result ParseAqaResponse( const std::string& redacted_output) { - optimization_guide::proto::HistoryAnswerResponse history_answer_response; + optimization_guide::proto::features::HistoryAnswerResponse + history_answer_response; std::string unanswerable_capture; std::string remaining_capture;
diff --git a/components/optimization_guide/core/model_execution/aqa_response_parser_unittest.cc b/components/optimization_guide/core/model_execution/aqa_response_parser_unittest.cc index 722cbbb..0038c426 100644 --- a/components/optimization_guide/core/model_execution/aqa_response_parser_unittest.cc +++ b/components/optimization_guide/core/model_execution/aqa_response_parser_unittest.cc
@@ -29,8 +29,8 @@ auto maybe_response = response_future.Get(); ASSERT_TRUE(maybe_response.has_value()); - auto response = - ParsedAnyMetadata<proto::HistoryAnswerResponse>(*maybe_response); + auto response = ParsedAnyMetadata<proto::features::HistoryAnswerResponse>( + *maybe_response); EXPECT_EQ("The fox jumps over the dog", response->answer().text()); EXPECT_EQ("0001", response->answer().citations()[0].passage_id()); EXPECT_EQ("0003", response->answer().citations()[1].passage_id()); @@ -46,8 +46,8 @@ auto maybe_response = response_future.Get(); ASSERT_TRUE(maybe_response.has_value()); - auto response = - ParsedAnyMetadata<proto::HistoryAnswerResponse>(*maybe_response); + auto response = ParsedAnyMetadata<proto::features::HistoryAnswerResponse>( + *maybe_response); EXPECT_TRUE(response->is_unanswerable()); } @@ -78,8 +78,8 @@ auto maybe_response = response_future.Get(); ASSERT_TRUE(maybe_response.has_value()); - auto response = - ParsedAnyMetadata<proto::HistoryAnswerResponse>(*maybe_response); + auto response = ParsedAnyMetadata<proto::features::HistoryAnswerResponse>( + *maybe_response); EXPECT_TRUE(response->is_unanswerable()); }
diff --git a/components/optimization_guide/core/model_execution/json_response_parser_unittest.cc b/components/optimization_guide/core/model_execution/json_response_parser_unittest.cc index 2a025e8..3e03027 100644 --- a/components/optimization_guide/core/model_execution/json_response_parser_unittest.cc +++ b/components/optimization_guide/core/model_execution/json_response_parser_unittest.cc
@@ -31,7 +31,8 @@ TEST_F(JsonResponseParserTest, Parse) { base::test::TestFuture<ResponseParser::Result> response_future; proto::OnDeviceModelExecutionOutputConfig config; - config.set_proto_type("optimization_guide.proto.TabOrganizationResponse"); + config.set_proto_type( + "optimization_guide.proto.features.TabOrganizationResponse"); JsonResponseParserFactory().CreateParser(config)->ParseAsync( R"({ "tabGroups": [ @@ -53,10 +54,10 @@ response_future.GetCallback()); auto response = response_future.Get(); EXPECT_TRUE(response.has_value()); - EXPECT_EQ( - response->type_url(), - "type.googleapis.com/optimization_guide.proto.TabOrganizationResponse"); - proto::TabOrganizationResponse resp; + EXPECT_EQ(response->type_url(), + "type.googleapis.com/" + "optimization_guide.proto.features.TabOrganizationResponse"); + proto::features::TabOrganizationResponse resp; ASSERT_TRUE(resp.ParseFromString(response->value())); EXPECT_EQ(resp.tab_groups(0).tabs(1).title(), "mytitle"); EXPECT_EQ(resp.tab_groups(0).tabs(0).tab_id(), 3);
diff --git a/components/optimization_guide/core/model_execution/model_execution_manager.cc b/components/optimization_guide/core/model_execution/model_execution_manager.cc index 4038a0e..84440ef 100644 --- a/components/optimization_guide/core/model_execution/model_execution_manager.cc +++ b/components/optimization_guide/core/model_execution/model_execution_manager.cc
@@ -248,7 +248,7 @@ case ModelBasedCapabilityKey::kTabOrganization: { proto::Any any = AnyWrapProto(request_metadata); auto tab_request = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::TabOrganizationRequest>(any); + optimization_guide::proto::features::TabOrganizationRequest>(any); std::string tabs = ""; for (const auto& tab : tab_request->tabs()) { tabs += base::StringPrintf("%s\"%s\"", tabs.empty() ? "" : ",", @@ -260,7 +260,7 @@ << "TabOrganization Request: " << base::StringPrintf( "{\"model_strategy\": \"%s\", \"tabs\" : [%s]}", - optimization_guide::proto:: + optimization_guide::proto::features:: TabOrganizationRequest_TabOrganizationModelStrategy_Name( tab_request->model_strategy()), tabs.c_str()); @@ -445,7 +445,7 @@ case ModelBasedCapabilityKey::kTabOrganization: { std::string message = ""; auto tab_response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::TabOrganizationResponse>( + optimization_guide::proto::features::TabOrganizationResponse>( execute_response->response_metadata()); message += "Response: ["; int group_cnt = 0;
diff --git a/components/optimization_guide/core/model_execution/model_execution_manager_unittest.cc b/components/optimization_guide/core/model_execution/model_execution_manager_unittest.cc index 470d156b..e0c2ab9 100644 --- a/components/optimization_guide/core/model_execution/model_execution_manager_unittest.cc +++ b/components/optimization_guide/core/model_execution/model_execution_manager_unittest.cc
@@ -44,7 +44,7 @@ using ::testing::HasSubstr; proto::ExecuteResponse BuildComposeResponse(const std::string& output) { - proto::ComposeResponse compose_response; + proto::features::ComposeResponse compose_response; compose_response.set_output(output); proto::ExecuteResponse execute_response; proto::Any* any_metadata = execute_response.mutable_response_metadata(); @@ -532,7 +532,7 @@ // Message is added through AddContext(). session->AddContext(UserInputRequest("some test")); // ExecuteModel() uses empty message. - session->ExecuteModel(proto::ComposeRequest(), + session->ExecuteModel(proto::features::ComposeRequest(), response_holder.GetStreamingCallback()); CheckPendingRequestMessage("some test"); EXPECT_TRUE(SimulateSuccessfulResponse()); @@ -549,7 +549,7 @@ session->AddContext(UserInputRequest("first test")); session->AddContext(UserInputRequest("second test")); // ExecuteModel() uses empty message. - session->ExecuteModel(proto::ComposeRequest(), + session->ExecuteModel(proto::features::ComposeRequest(), response_holder.GetStreamingCallback()); CheckPendingRequestMessage("second test"); EXPECT_TRUE(SimulateSuccessfulResponse());
diff --git a/components/optimization_guide/core/model_execution/on_device_model_feature_adapter.cc b/components/optimization_guide/core/model_execution/on_device_model_feature_adapter.cc index e6599d1..f823be0 100644 --- a/components/optimization_guide/core/model_execution/on_device_model_feature_adapter.cc +++ b/components/optimization_guide/core/model_execution/on_device_model_feature_adapter.cc
@@ -104,8 +104,10 @@ return redact_result; } -bool OnDeviceModelFeatureAdapter::ShouldParseResponse(bool is_complete) const { - return is_complete || !parser_->SuppressParsingIncompleteResponse(); +bool OnDeviceModelFeatureAdapter::ShouldParseResponse( + ResponseCompleteness completeness) const { + return completeness == ResponseCompleteness::kComplete || + !parser_->SuppressParsingIncompleteResponse(); } void OnDeviceModelFeatureAdapter::ParseResponse(
diff --git a/components/optimization_guide/core/model_execution/on_device_model_feature_adapter.h b/components/optimization_guide/core/model_execution/on_device_model_feature_adapter.h index 0f0eff9..c623b96 100644 --- a/components/optimization_guide/core/model_execution/on_device_model_feature_adapter.h +++ b/components/optimization_guide/core/model_execution/on_device_model_feature_adapter.h
@@ -19,6 +19,7 @@ #include "components/optimization_guide/core/model_execution/redactor.h" #include "components/optimization_guide/core/model_execution/response_parser.h" #include "components/optimization_guide/core/model_execution/substitution.h" +#include "components/optimization_guide/core/optimization_guide_enums.h" #include "components/optimization_guide/core/optimization_guide_model_executor.h" #include "components/optimization_guide/proto/features/text_safety.pb.h" #include "components/optimization_guide/proto/on_device_model_execution_config.pb.h" @@ -41,7 +42,7 @@ const google::protobuf::MessageLite& request, bool want_input_context) const; - bool ShouldParseResponse(bool is_complete) const; + bool ShouldParseResponse(ResponseCompleteness completeness) const; // Converts model response into this feature's expected response type. // Replies with std::nullopt on error.
diff --git a/components/optimization_guide/core/model_execution/on_device_model_feature_adapter_unittest.cc b/components/optimization_guide/core/model_execution/on_device_model_feature_adapter_unittest.cc index c6adf5a..254211c 100644 --- a/components/optimization_guide/core/model_execution/on_device_model_feature_adapter_unittest.cc +++ b/components/optimization_guide/core/model_execution/on_device_model_feature_adapter_unittest.cc
@@ -7,6 +7,7 @@ #include "base/test/task_environment.h" #include "base/test/test.pb.h" #include "base/test/test_future.h" +#include "components/optimization_guide/core/optimization_guide_enums.h" #include "components/optimization_guide/core/optimization_guide_util.h" #include "components/optimization_guide/proto/features/compose.pb.h" #include "components/optimization_guide/proto/parser_kind.pb.h" @@ -25,7 +26,7 @@ auto adapter = base::MakeRefCounted<OnDeviceModelFeatureAdapter>(std::move(config)); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("whatever"); EXPECT_EQ(std::nullopt, adapter->ConstructTextSafetyRequest(request, "text")); } @@ -36,7 +37,7 @@ auto adapter = base::MakeRefCounted<OnDeviceModelFeatureAdapter>(std::move(config)); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("whatever"); auto safety_request = adapter->ConstructTextSafetyRequest(request, "text"); @@ -54,7 +55,7 @@ auto adapter = base::MakeRefCounted<OnDeviceModelFeatureAdapter>(std::move(config)); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_page_metadata()->set_page_url("url"); auto safety_request = adapter->ConstructTextSafetyRequest(request, "text"); @@ -73,7 +74,7 @@ auto adapter = base::MakeRefCounted<OnDeviceModelFeatureAdapter>(std::move(config)); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_page_metadata()->set_page_url("url"); EXPECT_EQ(std::nullopt, adapter->ConstructTextSafetyRequest(request, "text")); } @@ -160,7 +161,7 @@ TEST(OnDeviceModelFeatureAdapterTest, ConstructOutputMetadata_DefaultSimple) { proto::OnDeviceModelExecutionFeatureConfig config; auto* oc = config.mutable_output_config(); - oc->set_proto_type("optimization_guide.proto.ComposeResponse"); + oc->set_proto_type("optimization_guide.proto.features.ComposeResponse"); oc->mutable_proto_field()->add_proto_descriptors()->set_tag_number(1); auto adapter = base::MakeRefCounted<OnDeviceModelFeatureAdapter>(std::move(config)); @@ -171,16 +172,16 @@ auto maybe_metadata = response_future.Get(); ASSERT_TRUE(maybe_metadata.has_value()); - EXPECT_EQ( - "output", - ParsedAnyMetadata<proto::ComposeResponse>(*maybe_metadata)->output()); + EXPECT_EQ("output", + ParsedAnyMetadata<proto::features::ComposeResponse>(*maybe_metadata) + ->output()); } TEST(OnDeviceModelFeatureAdapterTest, ConstructOutputMetadata_DefaultSimple_ChunkByChunkWithStartingPos) { proto::OnDeviceModelExecutionFeatureConfig config; auto* oc = config.mutable_output_config(); - oc->set_proto_type("optimization_guide.proto.ComposeResponse"); + oc->set_proto_type("optimization_guide.proto.features.ComposeResponse"); oc->mutable_proto_field()->add_proto_descriptors()->set_tag_number(1); oc->set_response_streaming_mode( proto::ResponseStreamingMode::STREAMING_MODE_CHUNK_BY_CHUNK); @@ -196,16 +197,16 @@ auto maybe_metadata = response_future.Get(); ASSERT_TRUE(maybe_metadata.has_value()); - EXPECT_EQ( - "put", - ParsedAnyMetadata<proto::ComposeResponse>(*maybe_metadata)->output()); + EXPECT_EQ("put", + ParsedAnyMetadata<proto::features::ComposeResponse>(*maybe_metadata) + ->output()); } TEST(OnDeviceModelFeatureAdapterTest, ConstructOutputMetadata_DefaultSimple_CurrentResponseWithStartingPos) { proto::OnDeviceModelExecutionFeatureConfig config; auto* oc = config.mutable_output_config(); - oc->set_proto_type("optimization_guide.proto.ComposeResponse"); + oc->set_proto_type("optimization_guide.proto.features.ComposeResponse"); oc->mutable_proto_field()->add_proto_descriptors()->set_tag_number(1); oc->set_response_streaming_mode( proto::ResponseStreamingMode::STREAMING_MODE_CURRENT_RESPONSE); @@ -221,9 +222,9 @@ auto maybe_metadata = response_future.Get(); ASSERT_TRUE(maybe_metadata.has_value()); - EXPECT_EQ( - "output", - ParsedAnyMetadata<proto::ComposeResponse>(*maybe_metadata)->output()); + EXPECT_EQ("output", + ParsedAnyMetadata<proto::features::ComposeResponse>(*maybe_metadata) + ->output()); } TEST(OnDeviceModelFeatureAdapterTest, ConstructOutputMetadata_JSON) { @@ -232,7 +233,7 @@ proto::OnDeviceModelExecutionFeatureConfig config; auto* oc = config.mutable_output_config(); oc->set_parser_kind(proto::PARSER_KIND_JSON); - oc->set_proto_type("optimization_guide.proto.ComposeResponse"); + oc->set_proto_type("optimization_guide.proto.features.ComposeResponse"); auto adapter = base::MakeRefCounted<OnDeviceModelFeatureAdapter>(std::move(config)); @@ -242,9 +243,9 @@ auto maybe_metadata = response_future.Get(); ASSERT_TRUE(maybe_metadata.has_value()); - EXPECT_EQ( - "abc", - ParsedAnyMetadata<proto::ComposeResponse>(*maybe_metadata)->output()); + EXPECT_EQ("abc", + ParsedAnyMetadata<proto::features::ComposeResponse>(*maybe_metadata) + ->output()); } TEST(OnDeviceModelFeatureAdapterTest, ShouldParseResponseCompleteOnly) { @@ -254,8 +255,8 @@ auto adapter = base::MakeRefCounted<OnDeviceModelFeatureAdapter>(std::move(config)); - EXPECT_FALSE(adapter->ShouldParseResponse(/*is_complete=*/false)); - EXPECT_TRUE(adapter->ShouldParseResponse(/*is_complete=*/true)); + EXPECT_FALSE(adapter->ShouldParseResponse(ResponseCompleteness::kPartial)); + EXPECT_TRUE(adapter->ShouldParseResponse(ResponseCompleteness::kComplete)); } TEST(OnDeviceModelFeatureAdapterTest, ShouldParseResponseAlways) { @@ -265,8 +266,8 @@ auto adapter = base::MakeRefCounted<OnDeviceModelFeatureAdapter>(std::move(config)); - EXPECT_TRUE(adapter->ShouldParseResponse(/*is_complete=*/false)); - EXPECT_TRUE(adapter->ShouldParseResponse(/*is_complete=*/true)); + EXPECT_TRUE(adapter->ShouldParseResponse(ResponseCompleteness::kPartial)); + EXPECT_TRUE(adapter->ShouldParseResponse(ResponseCompleteness::kComplete)); } } // namespace optimization_guide
diff --git a/components/optimization_guide/core/model_execution/on_device_model_service_controller_unittest.cc b/components/optimization_guide/core/model_execution/on_device_model_service_controller_unittest.cc index c48dc1485..a704ab6 100644 --- a/components/optimization_guide/core/model_execution/on_device_model_service_controller_unittest.cc +++ b/components/optimization_guide/core/model_execution/on_device_model_service_controller_unittest.cc
@@ -188,7 +188,7 @@ } proto::Any ComposeResponse(const std::string& output) { - proto::ComposeResponse response; + proto::features::ComposeResponse response; response.set_output(output); return AnyWrapProto(response); } @@ -415,7 +415,7 @@ const std::string expected_response = "Input: execute:foo\n"; EXPECT_EQ(*response_.value(), expected_response); EXPECT_TRUE(*response_.provided_by_on_device()); - EXPECT_THAT(response_.streamed(), ElementsAre(expected_response)); + EXPECT_THAT(response_.partials(), IsEmpty()); EXPECT_TRUE(response_.log_entry()); auto logged_on_device_model_execution_info = response_.log_entry() @@ -665,7 +665,7 @@ "Input: execute:this is long contextfoo\n", }); EXPECT_EQ(*response_.value(), expected_responses.back()); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_THAT(response_.partials(), ElementsAreArray(expected_responses)); } TEST_F(OnDeviceModelServiceControllerTest, @@ -689,7 +689,7 @@ "Input: execute:this is long contextfoo\n", }); EXPECT_EQ(*response_.value(), expected_responses.back()); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_THAT(response_.partials(), ElementsAreArray(expected_responses)); } // Without a base model available, sessions should fail to be created. @@ -2187,7 +2187,7 @@ task_environment_.RunUntilIdle(); const std::string expected_response1 = "Input: execute:foo\n"; EXPECT_EQ(*response_.value(), expected_response1); - EXPECT_THAT(response_.streamed(), ElementsAre(expected_response1)); + EXPECT_THAT(response_.partials(), ElementsAre(expected_response1)); // Input and output contain text matching redact, so should not be redacted. auto session2 = CreateSession(); @@ -2198,7 +2198,7 @@ task_environment_.RunUntilIdle(); const std::string expected_response2 = "Input: execute:abarx\n"; EXPECT_EQ(*response2.value(), expected_response2); - EXPECT_THAT(response2.streamed(), ElementsAre(expected_response2)); + EXPECT_THAT(response2.partials(), ElementsAre(expected_response2)); // Output contains redacted text (and input doesn't), so redact. fake_settings_.set_execute_result({"Input: abarx\n"}); @@ -2210,7 +2210,7 @@ task_environment_.RunUntilIdle(); const std::string expected_response3 = "Input: a[###]x\n"; EXPECT_EQ(*response3.value(), expected_response3); - EXPECT_THAT(response3.streamed(), ElementsAre(expected_response3)); + EXPECT_THAT(response3.partials(), ElementsAre(expected_response3)); } TEST_F(OnDeviceModelServiceControllerTest, RejectedField) { @@ -2297,7 +2297,7 @@ // `bar` shouldn't be rewritten as it's in the input. const std::string expected_response = "Input: bar\n"; EXPECT_EQ(*response_.value(), expected_response); - EXPECT_THAT(response_.streamed(), ElementsAre(expected_response)); + EXPECT_THAT(response_.partials(), ElementsAre(expected_response)); } TEST_F(OnDeviceModelServiceControllerTest, ReplacementText) { @@ -2320,7 +2320,7 @@ task_environment_.RunUntilIdle(); const std::string expected_response = "Input: a[redacted]x\n"; EXPECT_EQ(*response_.value(), expected_response); - EXPECT_THAT(response_.streamed(), ElementsAre(expected_response)); + EXPECT_THAT(response_.partials(), ElementsAre(expected_response)); } TEST_F(OnDeviceModelServiceControllerTest, DetectsRepeats) { @@ -2350,10 +2350,10 @@ const std::vector<std::string> expected_responses = ConcatResponses({ "some text", " some more repeating text", - " some more repeating text", }); - EXPECT_EQ(*response_.value(), expected_responses.back()); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_EQ(*response_.value(), + expected_responses.back() + " some more repeating text"); + EXPECT_THAT(response_.partials(), ElementsAreArray(expected_responses)); ASSERT_TRUE(response_.log_entry()); EXPECT_GT(response_.log_entry() @@ -2476,15 +2476,14 @@ session->ExecuteModel(UserInputRequest("foo"), response_.GetStreamingCallback()); task_environment_.RunUntilIdle(); - const std::vector<std::string> expected_responses = ConcatResponses({ + const std::vector<std::string> partial_responses = ConcatResponses({ "some text", " some more repeating", " text", " some more ", - "repeating text", }); - EXPECT_EQ(*response_.value(), expected_responses.back()); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_EQ(*response_.value(), partial_responses.back() + "repeating text"); + EXPECT_THAT(response_.partials(), ElementsAreArray(partial_responses)); ASSERT_TRUE(response_.log_entry()); EXPECT_GT(response_.log_entry() @@ -2550,7 +2549,7 @@ " more stuff", }); EXPECT_EQ(*response_.value(), expected_responses.back()); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_THAT(response_.partials(), ElementsAreArray(expected_responses)); ASSERT_TRUE(response_.log_entry()); EXPECT_GT(response_.log_entry() @@ -2606,7 +2605,7 @@ response_.GetStreamingCallback()); task_environment_.RunUntilIdle(); - EXPECT_TRUE(response_.streamed().empty()); + EXPECT_TRUE(response_.partials().empty()); EXPECT_FALSE(response_.value()); ASSERT_TRUE(response_.error()); EXPECT_EQ(*response_.error(), OptimizationGuideModelExecutionError:: @@ -2675,7 +2674,7 @@ .Run(OptimizationGuideModelExecutionResult(base::ok(ts_any), nullptr), std::move(remote_log_entry)); - EXPECT_TRUE(response_.streamed().empty()); + EXPECT_TRUE(response_.partials().empty()); EXPECT_EQ(*response_.value(), expected_responses.back()); histogram_tester.ExpectUniqueSample( "OptimizationGuide.ModelExecution.OnDeviceExecuteModelResult.Compose", @@ -2785,7 +2784,7 @@ std::move(model_execution_info)), std::move(remote_log_entry)); - EXPECT_TRUE(response_.streamed().empty()); + EXPECT_TRUE(response_.partials().empty()); EXPECT_FALSE(response_.value()); histogram_tester.ExpectUniqueSample( "OptimizationGuide.ModelExecution.OnDeviceExecuteModelResult.Compose", @@ -3015,7 +3014,7 @@ const std::string expected_response = "Input: execute:foo\nTopK: 4, Temp: 1.5\n"; EXPECT_EQ(*response_.value(), expected_response); - EXPECT_THAT(response_.streamed(), ElementsAre(expected_response)); + EXPECT_THAT(response_.partials(), IsEmpty()); } TEST_F(OnDeviceModelServiceControllerTest, UsesSessionTopKAndTemperature) { @@ -3045,7 +3044,7 @@ const std::string expected_response = "Input: execute:foo\nTopK: 3, Temp: 2\n"; EXPECT_EQ(*response_.value(), expected_response); - EXPECT_THAT(response_.streamed(), ElementsAre(expected_response)); + EXPECT_THAT(response_.partials(), IsEmpty()); } // Validate that a missing partial output config suppresses partial output. @@ -3072,7 +3071,7 @@ const std::vector<std::string> expected_responses = { "token1 token2 token3 token4"}; EXPECT_EQ(*response_.value(), expected_responses.back()); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_THAT(response_.partials(), IsEmpty()); } // Validate that token interval 1 evaluates all partial output. @@ -3097,14 +3096,13 @@ response_.GetStreamingCallback()); task_environment_.RunUntilIdle(); - const std::vector<std::string> expected_responses = { - "token1", - "token1 token2", - "token1 token2 token3", - "token1 token2 token3 token4", - }; - EXPECT_EQ(*response_.value(), expected_responses.back()); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_EQ(*response_.value(), "token1 token2 token3 token4"); + EXPECT_THAT(response_.partials(), ElementsAreArray({ + "token1", + "token1 token2", + "token1 token2 token3", + "token1 token2 token3 token4", + })); } // Validate that token interval 3 only evaluates every third and final chunk. @@ -3129,13 +3127,13 @@ response_.GetStreamingCallback()); task_environment_.RunUntilIdle(); - const std::vector<std::string> expected_responses = { - "token1 token2 token3", - "token1 token2 token3 token4 token5 token6", - "token1 token2 token3 token4 token5 token6 token7", - }; - EXPECT_EQ(*response_.value(), expected_responses.back()); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_EQ(*response_.value(), + "token1 token2 token3 token4 token5 token6 token7"); + EXPECT_THAT(response_.partials(), + ElementsAreArray({ + "token1 token2 token3", + "token1 token2 token3 token4 token5 token6", + })); } // Validate that PartialOutputChecks::minimum_tokens is respected. @@ -3169,7 +3167,7 @@ }; EXPECT_EQ(*response_.value(), expected_responses.back()); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_THAT(response_.partials(), ElementsAreArray(expected_responses)); } // Validate chunk-by-chunk streaming mode works correctly. @@ -3207,7 +3205,7 @@ const std::vector<std::string> expected_responses = {"token1", " token2", " token3", " token4"}; EXPECT_EQ(*response_.value(), ""); - EXPECT_THAT(response_.streamed(), ElementsAreArray(expected_responses)); + EXPECT_THAT(response_.partials(), ElementsAreArray(expected_responses)); } TEST_F(OnDeviceModelServiceControllerTest, TestAvailabilityObserver) {
diff --git a/components/optimization_guide/core/model_execution/safety_checker.cc b/components/optimization_guide/core/model_execution/safety_checker.cc index 3497bc01..83ee83d 100644 --- a/components/optimization_guide/core/model_execution/safety_checker.cc +++ b/components/optimization_guide/core/model_execution/safety_checker.cc
@@ -69,7 +69,7 @@ SafetyChecker::Result RawOutputCheckResult( base::WeakPtr<SafetyChecker> checker, std::string check_input_text, - bool is_complete, + ResponseCompleteness completeness, on_device_model::mojom::SafetyInfoPtr safety_info) { if (!checker) { return FailToRunResult(); @@ -78,7 +78,7 @@ // Evaluate the check. result.is_unsafe = checker->safety_cfg().IsRawOutputUnsafe(safety_info); result.is_unsupported_language = - checker->safety_cfg().IsRawOutputUnsupportedLanguage(is_complete, + checker->safety_cfg().IsRawOutputUnsupportedLanguage(completeness, safety_info); *result.logs.Add() = MakeTextSafetyExecutionLog(check_input_text, safety_info, result.is_unsafe); @@ -89,7 +89,7 @@ base::WeakPtr<SafetyChecker> checker, int request_check_idx, std::string check_input_text, - bool is_complete, + ResponseCompleteness completeness, on_device_model::mojom::SafetyInfoPtr safety_info) { if (!checker) { return FailToRunResult(); @@ -100,7 +100,7 @@ checker->safety_cfg().IsResponseUnsafe(request_check_idx, safety_info); result.is_unsupported_language = checker->safety_cfg().IsResponseUnsupportedLanguage( - request_check_idx, is_complete, safety_info); + request_check_idx, completeness, safety_info); *result.logs.Add() = MakeTextSafetyExecutionLog(check_input_text, safety_info, result.is_unsafe); return result; @@ -174,7 +174,7 @@ } void SafetyChecker::RunRawOutputCheck(const std::string& raw_output, - bool is_complete, + ResponseCompleteness completeness, ResultCallback callback) { if (!safety_cfg_.HasRawOutputCheck()) { std::move(callback).Run(SafetyChecker::Result{}); @@ -192,14 +192,14 @@ auto text = check_input->ToString(); client_->GetTextSafetyModelRemote(params_)->ClassifyTextSafety( text, base::BindOnce(&RawOutputCheckResult, - weak_ptr_factory_.GetWeakPtr(), text, is_complete) + weak_ptr_factory_.GetWeakPtr(), text, completeness) .Then(std::move(callback))); } void SafetyChecker::RunResponseChecks( const google::protobuf::MessageLite& request, const proto::Any& response_as_any, - bool is_complete, + ResponseCompleteness completeness, ResultCallback callback) { int num_checks = safety_cfg_.NumResponseChecks(); if (num_checks == 0) { @@ -228,7 +228,7 @@ auto text = check_input->ToString(); auto merge_result_fn = base::BindOnce(&ResponseCheckResult, weak_ptr_factory_.GetWeakPtr(), - idx, text, is_complete) + idx, text, completeness) .Then(merge_fn); client_->GetTextSafetyModelRemote(params_)->ClassifyTextSafety( text, std::move(merge_result_fn));
diff --git a/components/optimization_guide/core/model_execution/safety_checker.h b/components/optimization_guide/core/model_execution/safety_checker.h index 5cbf5044..872248a 100644 --- a/components/optimization_guide/core/model_execution/safety_checker.h +++ b/components/optimization_guide/core/model_execution/safety_checker.h
@@ -12,6 +12,7 @@ #include "base/memory/weak_ptr.h" #include "components/optimization_guide/core/model_execution/safety_config.h" #include "components/optimization_guide/core/model_execution/substitution.h" +#include "components/optimization_guide/core/optimization_guide_enums.h" #include "components/optimization_guide/proto/model_quality_metadata.pb.h" #include "components/optimization_guide/proto/model_quality_service.pb.h" #include "components/optimization_guide/proto/text_safety_model_metadata.pb.h" @@ -62,13 +63,13 @@ // Runs the configured check (if any) for evaluating raw output. void RunRawOutputCheck(const std::string& raw_output, - bool is_complete, + ResponseCompleteness completeness, ResultCallback callback); // Runs all of the configured checks for evaluating parsed responses. void RunResponseChecks(const google::protobuf::MessageLite& request, const proto::Any& response, - bool is_complete, + ResponseCompleteness completeness, ResultCallback callback); const SafetyConfig& safety_cfg() const { return safety_cfg_; }
diff --git a/components/optimization_guide/core/model_execution/safety_checker_unittest.cc b/components/optimization_guide/core/model_execution/safety_checker_unittest.cc index d6dfc17..bb2ccd9 100644 --- a/components/optimization_guide/core/model_execution/safety_checker_unittest.cc +++ b/components/optimization_guide/core/model_execution/safety_checker_unittest.cc
@@ -61,16 +61,16 @@ return log.response().text_safety_model_response().is_unsafe(); } -proto::ComposeRequest UrlAndInputRequest(const std::string& url, - const std::string& input) { - proto::ComposeRequest req; +proto::features::ComposeRequest UrlAndInputRequest(const std::string& url, + const std::string& input) { + proto::features::ComposeRequest req; req.mutable_page_metadata()->set_page_url(url); req.mutable_generate_params()->set_user_input(input); return req; } proto::Any SimpleResponse(const std::string& output) { - proto::ComposeResponse resp; + proto::features::ComposeResponse resp; resp.set_output(output); return AnyWrapProto(resp); } @@ -134,7 +134,8 @@ // When no thresholds are defined, all outputs will pass. SafetyClientFixture fixture([]() { return ComposeSafetyConfig(); }()); auto checker = fixture.MakeSafetyChecker(); - checker->RunRawOutputCheck("unsafe raw output", /*is_complete=*/true, + checker->RunRawOutputCheck("unsafe raw output", + ResponseCompleteness::kComplete, future_.GetCallback()); auto result = future_.Take(); @@ -158,7 +159,8 @@ return safety_config; }()); auto checker = fixture.MakeSafetyChecker(); - checker->RunRawOutputCheck("reasonable raw output", /*is_complete=*/true, + checker->RunRawOutputCheck("reasonable raw output", + ResponseCompleteness::kComplete, future_.GetCallback()); auto result = future_.Take(); @@ -183,7 +185,8 @@ return safety_config; }()); auto checker = fixture.MakeSafetyChecker(); - checker->RunRawOutputCheck("unsafe raw output", /*is_complete=*/true, + checker->RunRawOutputCheck("unsafe raw output", + ResponseCompleteness::kComplete, future_.GetCallback()); auto result = future_.Take(); @@ -211,7 +214,8 @@ }()); auto checker = fixture.MakeSafetyChecker(); checker->RunRawOutputCheck("reasonable raw output in esperanto", - /*is_complete=*/true, future_.GetCallback()); + ResponseCompleteness::kComplete, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); @@ -239,7 +243,8 @@ return safety_config; }()); auto checker = fixture.MakeSafetyChecker(); - checker->RunRawOutputCheck("reasonable raw output", /*is_complete=*/true, + checker->RunRawOutputCheck("reasonable raw output", + ResponseCompleteness::kComplete, future_.GetCallback()); auto result = future_.Take(); @@ -267,7 +272,8 @@ return safety_config; }()); auto checker = fixture.MakeSafetyChecker(); - checker->RunRawOutputCheck("reasonable raw output", /*is_complete=*/true, + checker->RunRawOutputCheck("reasonable raw output", + ResponseCompleteness::kComplete, future_.GetCallback()); auto result = future_.Take(); @@ -299,7 +305,8 @@ auto checker = fixture.MakeSafetyChecker(); { checker->RunRawOutputCheck("reasonable raw output lang:en=0.3", - /*is_complete=*/false, future_.GetCallback()); + ResponseCompleteness::kPartial, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); EXPECT_TRUE(result.is_unsupported_language); @@ -307,7 +314,8 @@ { checker->RunRawOutputCheck("reasonable raw output lang:en=0.6", - /*is_complete=*/false, future_.GetCallback()); + ResponseCompleteness::kPartial, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); EXPECT_FALSE(result.is_unsupported_language); @@ -315,7 +323,8 @@ { checker->RunRawOutputCheck("reasonable raw output lang:en=0.6", - /*is_complete=*/true, future_.GetCallback()); + ResponseCompleteness::kComplete, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); EXPECT_TRUE(result.is_unsupported_language); @@ -323,7 +332,8 @@ { checker->RunRawOutputCheck("reasonable raw output lang:en=0.9", - /*is_complete=*/true, future_.GetCallback()); + ResponseCompleteness::kComplete, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); EXPECT_FALSE(result.is_unsupported_language); @@ -342,7 +352,8 @@ return safety_config; }()); auto checker = fixture.MakeSafetyChecker(); - checker->RunRawOutputCheck("unsafe raw output", /*is_complete=*/true, + checker->RunRawOutputCheck("unsafe raw output", + ResponseCompleteness::kComplete, future_.GetCallback()); auto result = future_.Take(); @@ -628,7 +639,7 @@ auto checker = fixture.MakeSafetyChecker(); checker->RunResponseChecks( UrlAndInputRequest("very_", "reasonable_esperanto_"), - SimpleResponse("safe_output"), /*is_complete=*/true, + SimpleResponse("safe_output"), ResponseCompleteness::kComplete, future_.GetCallback()); auto result = future_.Take(); @@ -681,7 +692,8 @@ auto checker = fixture.MakeSafetyChecker(); checker->RunResponseChecks(UrlAndInputRequest("un", "reasonable_esperanto_"), SimpleResponse("safe_output"), - /*is_complete=*/true, future_.GetCallback()); + ResponseCompleteness::kComplete, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); @@ -731,9 +743,9 @@ return safety_config; }()); auto checker = fixture.MakeSafetyChecker(); - checker->RunResponseChecks(UrlAndInputRequest("very_", "reasonable_"), - SimpleResponse("safe_output"), - /*is_complete=*/true, future_.GetCallback()); + checker->RunResponseChecks( + UrlAndInputRequest("very_", "reasonable_"), SimpleResponse("safe_output"), + ResponseCompleteness::kComplete, future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); @@ -799,8 +811,8 @@ { checker->RunResponseChecks( UrlAndInputRequest("unknown language", "lang:en=0.3"), - SimpleResponse("safe_output"), - /*is_complete=*/false, future_.GetCallback()); + SimpleResponse("safe_output"), ResponseCompleteness::kPartial, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); EXPECT_TRUE(result.is_unsupported_language); @@ -809,8 +821,8 @@ { checker->RunResponseChecks( UrlAndInputRequest("unknown language", "lang:en=0.6"), - SimpleResponse("safe_output"), - /*is_complete=*/false, future_.GetCallback()); + SimpleResponse("safe_output"), ResponseCompleteness::kPartial, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); EXPECT_FALSE(result.is_unsupported_language); @@ -819,8 +831,8 @@ { checker->RunResponseChecks( UrlAndInputRequest("unknown language", "lang:en=0.6"), - SimpleResponse("safe_output"), - /*is_complete=*/true, future_.GetCallback()); + SimpleResponse("safe_output"), ResponseCompleteness::kComplete, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); EXPECT_TRUE(result.is_unsupported_language); @@ -829,8 +841,8 @@ { checker->RunResponseChecks( UrlAndInputRequest("unknown language", "lang:en=0.9"), - SimpleResponse("safe_output"), - /*is_complete=*/true, future_.GetCallback()); + SimpleResponse("safe_output"), ResponseCompleteness::kComplete, + future_.GetCallback()); auto result = future_.Take(); EXPECT_FALSE(result.failed_to_run); EXPECT_FALSE(result.is_unsupported_language);
diff --git a/components/optimization_guide/core/model_execution/safety_config.cc b/components/optimization_guide/core/model_execution/safety_config.cc index 7cbbefdc3..e332b09 100644 --- a/components/optimization_guide/core/model_execution/safety_config.cc +++ b/components/optimization_guide/core/model_execution/safety_config.cc
@@ -12,6 +12,7 @@ #include "base/containers/contains.h" #include "base/no_destructor.h" #include "components/optimization_guide/core/model_execution/substitution.h" +#include "components/optimization_guide/core/optimization_guide_enums.h" #include "components/optimization_guide/core/optimization_guide_features.h" #include "components/optimization_guide/proto/string_value.pb.h" #include "components/optimization_guide/proto/substitution.pb.h" @@ -47,11 +48,13 @@ } template <class T> -double GetLanguageReliabilityThreshold(const T& check, bool is_complete) { +double GetLanguageReliabilityThreshold(const T& check, + ResponseCompleteness completeness) { if (!check.has_language_check()) { return features::GetOnDeviceModelLanguageDetectionMinimumReliability(); } - if (is_complete || !check.language_check().has_partial_threshold()) { + if (completeness == ResponseCompleteness::kComplete || + !check.language_check().has_partial_threshold()) { return check.language_check().confidence_threshold(); } return check.language_check().partial_threshold(); @@ -183,7 +186,7 @@ return false; } double threshold = - GetLanguageReliabilityThreshold(check, /*is_complete*/ true); + GetLanguageReliabilityThreshold(check, ResponseCompleteness::kComplete); return IsTextInUnsupportedOrUndeterminedLanguage(safety_info, threshold); } @@ -209,10 +212,10 @@ } bool SafetyConfig::IsRawOutputUnsupportedLanguage( - bool is_complete, + ResponseCompleteness completeness, const on_device_model::mojom::SafetyInfoPtr& safety_info) const { const auto& check = proto_->raw_output_check(); - double threshold = GetLanguageReliabilityThreshold(check, is_complete); + double threshold = GetLanguageReliabilityThreshold(check, completeness); return IsTextInUnsupportedOrUndeterminedLanguage(safety_info, threshold); } @@ -232,13 +235,13 @@ bool SafetyConfig::IsResponseUnsupportedLanguage( int check_idx, - bool is_complete, + ResponseCompleteness completeness, const on_device_model::mojom::SafetyInfoPtr& safety_info) const { const auto& check = proto_->response_check(check_idx); if (check.ignore_language_result()) { return false; } - double threshold = GetLanguageReliabilityThreshold(check, is_complete); + double threshold = GetLanguageReliabilityThreshold(check, completeness); return IsTextInUnsupportedOrUndeterminedLanguage(safety_info, threshold); }
diff --git a/components/optimization_guide/core/model_execution/safety_config.h b/components/optimization_guide/core/model_execution/safety_config.h index 89114eb..d7722789 100644 --- a/components/optimization_guide/core/model_execution/safety_config.h +++ b/components/optimization_guide/core/model_execution/safety_config.h
@@ -9,6 +9,7 @@ #include <string> #include "components/optimization_guide/core/model_execution/substitution.h" +#include "components/optimization_guide/core/optimization_guide_enums.h" #include "components/optimization_guide/proto/text_safety_model_metadata.pb.h" #include "services/on_device_model/public/mojom/on_device_model.mojom.h" @@ -63,7 +64,7 @@ // Evaluates language requirements of the raw output check. bool IsRawOutputUnsupportedLanguage( - bool is_complete, + ResponseCompleteness completeness, const on_device_model::mojom::SafetyInfoPtr& safety_info) const; // The number of request safety checks to perform. @@ -84,7 +85,7 @@ // `check_idx` must be < `NumResponseChecks()`. bool IsResponseUnsupportedLanguage( int check_idx, - bool is_complete, + ResponseCompleteness completeness, const on_device_model::mojom::SafetyInfoPtr& safety_info) const; private:
diff --git a/components/optimization_guide/core/model_execution/session_impl.cc b/components/optimization_guide/core/model_execution/session_impl.cc index 0b92aaf..a7a88c9 100644 --- a/components/optimization_guide/core/model_execution/session_impl.cc +++ b/components/optimization_guide/core/model_execution/session_impl.cc
@@ -537,7 +537,8 @@ return; } - RunRawOutputSafetyCheck(/*is_complete=*/false); + on_device_state_->num_unchecked_response_tokens = 0; + RunRawOutputSafetyCheck(ResponseCompleteness::kPartial); } void SessionImpl::OnComplete( @@ -554,26 +555,20 @@ on_device_state_->opts.model_client->OnResponseCompleted(); - on_device_state_->model_response_complete = true; - - if (on_device_state_->num_unchecked_response_tokens == 0) { - // We've already requested the evaluation. Check if it finished. - MaybeSendCompleteResponse(); - return; - } - RunRawOutputSafetyCheck(/*is_complete=*/true); + on_device_state_->response_completeness = ResponseCompleteness::kComplete; + RunRawOutputSafetyCheck(ResponseCompleteness::kComplete); } -void SessionImpl::RunRawOutputSafetyCheck(bool is_complete) { - on_device_state_->num_unchecked_response_tokens = 0; +void SessionImpl::RunRawOutputSafetyCheck(ResponseCompleteness completeness) { on_device_state_->opts.safety_checker->RunRawOutputCheck( - on_device_state_->current_response, is_complete, + on_device_state_->current_response, completeness, base::BindOnce(&SessionImpl::OnRawOutputSafetyResult, on_device_state_->session_weak_ptr_factory_.GetWeakPtr(), - on_device_state_->current_response.size())); + on_device_state_->current_response.size(), completeness)); } void SessionImpl::OnRawOutputSafetyResult(size_t raw_output_size, + ResponseCompleteness completeness, SafetyChecker::Result safety_result) { if (safety_result.failed_to_run) { DestroyOnDeviceStateAndFallbackToRemote( @@ -595,21 +590,11 @@ return; } } - on_device_state_->latest_safe_raw_output.length = raw_output_size; - on_device_state_->latest_safe_raw_output.logs = std::move(safety_result.logs); - SendResponse(ResponseType::kPartial); - MaybeSendCompleteResponse(); -} - -void SessionImpl::MaybeSendCompleteResponse() { - if (on_device_state_ && on_device_state_->model_response_complete && - on_device_state_->latest_safe_raw_output.length == - on_device_state_->current_response.size()) { - on_device_state_->AddModelExecutionLogs( - std::move(on_device_state_->latest_safe_raw_output.logs)); - on_device_state_->latest_safe_raw_output.logs.Clear(); - SendResponse(ResponseType::kComplete); + if (completeness == ResponseCompleteness::kComplete) { + on_device_state_->AddModelExecutionLogs(std::move(safety_result.logs)); } + on_device_state_->latest_safe_raw_output.length = raw_output_size; + SendResponse(completeness); } on_device_model::mojom::Session& SessionImpl::GetOrCreateSession() { @@ -638,7 +623,8 @@ } on_device_state_->session.reset(); - if (!on_device_state_->model_response_complete) { + if (on_device_state_->response_completeness == + ResponseCompleteness::kPartial) { // Only cancel the request if the model response is not complete yet. We can // get in this state if there is an outstanding remote text safety request. CancelPendingResponse(ExecuteModelResult::kDisconnectAndCancel); @@ -679,16 +665,14 @@ } } -void SessionImpl::SendResponse(ResponseType response_type) { - const bool is_complete = response_type != ResponseType::kPartial; - - if (!is_complete && +void SessionImpl::SendResponse(ResponseCompleteness completeness) { + if (completeness == ResponseCompleteness::kPartial && features::ShouldUseTextSafetyRemoteFallbackForEligibleFeatures()) { // We don't send streaming responses in this mode. return; } - if (!on_device_state_->opts.adapter->ShouldParseResponse(is_complete)) { + if (!on_device_state_->opts.adapter->ShouldParseResponse(completeness)) { return; } @@ -702,11 +686,11 @@ *last_message_, safe_response, previous_response_pos, base::BindOnce(&SessionImpl::OnParsedResponse, on_device_state_->session_weak_ptr_factory_.GetWeakPtr(), - is_complete)); + completeness)); } void SessionImpl::OnParsedResponse( - bool is_complete, + ResponseCompleteness completeness, base::expected<proto::Any, ResponseParsingError> output) { if (!output.has_value()) { switch (output.error()) { @@ -724,13 +708,13 @@ } } on_device_state_->opts.safety_checker->RunResponseChecks( - *last_message_, *output, is_complete, + *last_message_, *output, completeness, base::BindOnce(&SessionImpl::OnResponseSafetyResult, on_device_state_->session_weak_ptr_factory_.GetWeakPtr(), - is_complete, *output)); + completeness, *output)); } -void SessionImpl::OnResponseSafetyResult(bool is_complete, +void SessionImpl::OnResponseSafetyResult(ResponseCompleteness completeness, proto::Any output, SafetyChecker::Result safety_result) { if (safety_result.failed_to_run) { @@ -738,8 +722,8 @@ ExecuteModelResult::kFailedConstructingMessage); return; } - if (is_complete || safety_result.is_unsafe || - safety_result.is_unsupported_language) { + if (completeness == ResponseCompleteness::kComplete || + safety_result.is_unsafe || safety_result.is_unsupported_language) { on_device_state_->AddModelExecutionLogs(std::move(safety_result.logs)); } if (safety_result.is_unsafe || safety_result.is_unsupported_language) { @@ -756,7 +740,7 @@ return; } } - if (!is_complete) { + if (completeness == ResponseCompleteness::kPartial) { SendPartialResponseCallback(output); return; } @@ -961,8 +945,7 @@ log_ai_data_request.reset(); num_unchecked_response_tokens = 0; latest_safe_raw_output.length = 0; - latest_safe_raw_output.logs.Clear(); - model_response_complete = false; + response_completeness = ResponseCompleteness::kPartial; session_weak_ptr_factory_.InvalidateWeakPtrs(); }
diff --git a/components/optimization_guide/core/model_execution/session_impl.h b/components/optimization_guide/core/model_execution/session_impl.h index 86f9844a..eda5b43 100644 --- a/components/optimization_guide/core/model_execution/session_impl.h +++ b/components/optimization_guide/core/model_execution/session_impl.h
@@ -172,19 +172,6 @@ private: class ContextProcessor; - // Type of response. - enum class ResponseType { - // This is a partial response. That is, one of `kComplete` or - // `kCompleteUnsafeOutput` will follow. - kPartial, - - // The response completed successfully. - kComplete, - - // The response completed, but the output is considered unsafe. - kCompleteUnsafeOutput, - }; - // Used to log the result of ExecuteModel. class ExecuteModelHistogramLogger { public: @@ -207,7 +194,8 @@ // Returns true if ExecuteModel() was called and the complete response // has not been received. bool did_execute_and_waiting_for_on_complete() const { - return start != base::TimeTicks() && !model_response_complete; + return start != base::TimeTicks() && + response_completeness == ResponseCompleteness::kPartial; } // Returns the mutable on-device model service response for logging. @@ -253,10 +241,6 @@ ~SafeRawOutput(); // How much of 'current_response' was checked. size_t length = 0; - // The execution logs for the check (if any). - google::protobuf::RepeatedPtrField< - proto::InternalOnDeviceModelExecutionInfo> - logs; }; // The longest response that has passed the raw output text safety check. SafeRawOutput latest_safe_raw_output; @@ -265,7 +249,7 @@ size_t latest_response_pos = 0; // Whether the model response is complete. - bool model_response_complete = false; + ResponseCompleteness response_completeness = ResponseCompleteness::kPartial; // Factory for weak pointers related to this session that are invalidated // with the request state. @@ -293,7 +277,7 @@ void MaybeSendCompleteResponse(); // Sends `current_response_` to the client. - void SendResponse(ResponseType response_type); + void SendResponse(ResponseCompleteness completeness); void DestroyOnDeviceStateAndFallbackToRemote(ExecuteModelResult result); @@ -313,10 +297,11 @@ // Evaluates raw output safety. // Will invoke SendResponse if evaluations are successful. - void RunRawOutputSafetyCheck(bool is_complete); + void RunRawOutputSafetyCheck(ResponseCompleteness completeness); // Called when output safety check completes. void OnRawOutputSafetyResult(size_t raw_output_size, + ResponseCompleteness completeness, SafetyChecker::Result safety_result); // Callback invoked when the text safety remote fallback response comes back. @@ -329,11 +314,11 @@ // Called when a response has finished parsing. void OnParsedResponse( - bool is_complete, + ResponseCompleteness completeness, base::expected<proto::Any, ResponseParsingError> output); // Called when response safety check completes. - void OnResponseSafetyResult(bool is_complete, + void OnResponseSafetyResult(ResponseCompleteness completeness, proto::Any output, SafetyChecker::Result safety_result);
diff --git a/components/optimization_guide/core/model_execution/simple_response_parser_unittest.cc b/components/optimization_guide/core/model_execution/simple_response_parser_unittest.cc index 2d9e8d09..65539863 100644 --- a/components/optimization_guide/core/model_execution/simple_response_parser_unittest.cc +++ b/components/optimization_guide/core/model_execution/simple_response_parser_unittest.cc
@@ -18,7 +18,7 @@ TEST(SimpleResponseParserTest, Valid) { proto::OnDeviceModelExecutionOutputConfig cfg; - cfg.set_proto_type("optimization_guide.proto.ComposeResponse"); + cfg.set_proto_type("optimization_guide.proto.features.ComposeResponse"); cfg.mutable_proto_field()->add_proto_descriptors()->set_tag_number(1); auto parser = SimpleResponseParserFactory().CreateParser(cfg); @@ -27,9 +27,9 @@ auto maybe_metadata = response_future.Get(); ASSERT_TRUE(maybe_metadata.has_value()); - EXPECT_EQ( - "output", - ParsedAnyMetadata<proto::ComposeResponse>(*maybe_metadata)->output()); + EXPECT_EQ("output", + ParsedAnyMetadata<proto::features::ComposeResponse>(*maybe_metadata) + ->output()); } TEST(SimpleResponseParserTest, BadProtoType) { @@ -49,7 +49,7 @@ TEST(SimpleResponseParserTest, NotStringField) { proto::OnDeviceModelExecutionFeatureConfig config; proto::OnDeviceModelExecutionOutputConfig cfg; - cfg.set_proto_type("optimization_guide.proto.ComposeResponse"); + cfg.set_proto_type("optimization_guide.proto.features.ComposeResponse"); cfg.mutable_proto_field()->add_proto_descriptors()->set_tag_number(7); auto parser = SimpleResponseParserFactory().CreateParser(cfg);
diff --git a/components/optimization_guide/core/model_execution/substitution_unittest.cc b/components/optimization_guide/core/model_execution/substitution_unittest.cc index cb215d13..b318a9c 100644 --- a/components/optimization_guide/core/model_execution/substitution_unittest.cc +++ b/components/optimization_guide/core/model_execution/substitution_unittest.cc
@@ -237,7 +237,7 @@ *substitution->add_substitutions()->add_candidates()->mutable_proto_field() = UserInputField(); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_page_metadata()->set_page_title("nested"); request.mutable_generate_params()->set_user_input("inner type"); auto result = CreateSubstitutions(request, subs); @@ -254,7 +254,7 @@ *substitution->add_substitutions()->add_candidates()->mutable_proto_field() = ProtoField({10000}); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_page_metadata()->set_page_title("nested"); auto result = CreateSubstitutions(request, subs); @@ -263,9 +263,9 @@ } TEST_F(SubstitutionTest, Conditions) { - proto::ComposeRequest request; + proto::features::ComposeRequest request; // COMPOSE_LONGER == 2 - request.mutable_rewrite_params()->set_length(proto::COMPOSE_LONGER); + request.mutable_rewrite_params()->set_length(proto::features::COMPOSE_LONGER); // rewrite_params.tone is implicitly 0 / UNSPECIFIED_TONE // True conditions @@ -318,8 +318,8 @@ } // Make a simple request with two tabs. -proto::TabOrganizationRequest TwoTabRequest() { - proto::TabOrganizationRequest request; +proto::features::TabOrganizationRequest TwoTabRequest() { + proto::features::TabOrganizationRequest request; auto* tabs = request.mutable_tabs(); { auto* t1 = tabs->Add(); @@ -358,7 +358,7 @@ expr.add_candidates()->set_raw_string("E"); subs.Add()->MergeFrom(TabsExpr(expr)); } - proto::TabOrganizationRequest request = TwoTabRequest(); + proto::features::TabOrganizationRequest request = TwoTabRequest(); auto result = CreateSubstitutions(request, subs); ASSERT_TRUE(result.has_value()); EXPECT_EQ(result->ToString(), "Tabs: E,E,"); @@ -372,7 +372,7 @@ *expr.add_candidates()->mutable_proto_field() = TabTitle(); subs.Add()->MergeFrom(TabsExpr(expr)); } - proto::TabOrganizationRequest request = TwoTabRequest(); + proto::features::TabOrganizationRequest request = TwoTabRequest(); auto result = CreateSubstitutions(request, subs); ASSERT_TRUE(result.has_value()); EXPECT_EQ(result->ToString(), "Tabs: tabA,tabB,"); @@ -386,7 +386,7 @@ expr.add_candidates()->mutable_index_expr(); subs.Add()->MergeFrom(TabsExpr(expr)); } - proto::TabOrganizationRequest request = TwoTabRequest(); + proto::features::TabOrganizationRequest request = TwoTabRequest(); auto result = CreateSubstitutions(request, subs); ASSERT_TRUE(result.has_value()); EXPECT_EQ(result->ToString(), "Tabs: 0,1,"); @@ -400,7 +400,7 @@ expr.add_candidates()->mutable_index_expr()->set_one_based(true); subs.Add()->MergeFrom(TabsExpr(expr)); } - proto::TabOrganizationRequest request = TwoTabRequest(); + proto::features::TabOrganizationRequest request = TwoTabRequest(); auto result = CreateSubstitutions(request, subs); ASSERT_TRUE(result.has_value()); EXPECT_EQ(result->ToString(), "Tabs: 1,2,"); @@ -422,7 +422,7 @@ c2->set_raw_string("NotTen"); subs.Add()->MergeFrom(TabsExpr(expr)); } - proto::TabOrganizationRequest request = TwoTabRequest(); + proto::features::TabOrganizationRequest request = TwoTabRequest(); auto result = CreateSubstitutions(request, subs); ASSERT_TRUE(result.has_value()); EXPECT_EQ(result->ToString(), "Tabs: Ten,NotTen,");
diff --git a/components/optimization_guide/core/model_execution/test/feature_config_builder.cc b/components/optimization_guide/core/model_execution/test/feature_config_builder.cc index 2543198..4819296 100644 --- a/components/optimization_guide/core/model_execution/test/feature_config_builder.cc +++ b/components/optimization_guide/core/model_execution/test/feature_config_builder.cc
@@ -88,7 +88,8 @@ config.set_feature( ToModelExecutionFeatureProto(ModelBasedCapabilityKey::kCompose)); auto& input_config = *config.mutable_input_config(); - input_config.set_request_base_name(proto::ComposeRequest().GetTypeName()); + input_config.set_request_base_name( + proto::features::ComposeRequest().GetTypeName()); // Execute call prefixes with execute:. auto& substitution = *input_config.add_execute_substitutions(); @@ -106,7 +107,8 @@ ->mutable_proto_field() = UserInputField(); auto& output_config = *config.mutable_output_config(); - output_config.set_proto_type(proto::ComposeResponse().GetTypeName()); + output_config.set_proto_type( + proto::features::ComposeResponse().GetTypeName()); *output_config.mutable_proto_field() = OutputField(); return config; }
diff --git a/components/optimization_guide/core/model_execution/test/request_builder.cc b/components/optimization_guide/core/model_execution/test/request_builder.cc index 6b15f0af..3776356 100644 --- a/components/optimization_guide/core/model_execution/test/request_builder.cc +++ b/components/optimization_guide/core/model_execution/test/request_builder.cc
@@ -8,23 +8,24 @@ namespace optimization_guide { -proto::ComposeRequest PageUrlRequest(const std::string& input) { - proto::ComposeRequest req; +proto::features::ComposeRequest PageUrlRequest(const std::string& input) { + proto::features::ComposeRequest req; req.mutable_page_metadata()->set_page_url(std::string(input)); return req; } -proto::ComposeRequest UserInputRequest(const std::string& input) { - proto::ComposeRequest req; +proto::features::ComposeRequest UserInputRequest(const std::string& input) { + proto::features::ComposeRequest req; req.mutable_generate_params()->set_user_input(input); return req; } -proto::ComposeRequest RewriteRequest(const std::string& previous_response) { - proto::ComposeRequest req; +proto::features::ComposeRequest RewriteRequest( + const std::string& previous_response) { + proto::features::ComposeRequest req; auto& rewrite_params = *req.mutable_rewrite_params(); rewrite_params.set_previous_response(previous_response); - rewrite_params.set_tone(proto::COMPOSE_FORMAL); + rewrite_params.set_tone(proto::features::COMPOSE_FORMAL); return req; }
diff --git a/components/optimization_guide/core/model_execution/test/request_builder.h b/components/optimization_guide/core/model_execution/test/request_builder.h index c16a82db..80bd661 100644 --- a/components/optimization_guide/core/model_execution/test/request_builder.h +++ b/components/optimization_guide/core/model_execution/test/request_builder.h
@@ -10,13 +10,14 @@ namespace optimization_guide { // A ComposeRequest with page_metadata.page_url filled. -proto::ComposeRequest PageUrlRequest(const std::string& input); +proto::features::ComposeRequest PageUrlRequest(const std::string& input); // A ComposeRequest with generate_params.user_input filled. -proto::ComposeRequest UserInputRequest(const std::string& input); +proto::features::ComposeRequest UserInputRequest(const std::string& input); // A ComposeRequest with rewrite_params.previous_response filled. -proto::ComposeRequest RewriteRequest(const std::string& previous_response); +proto::features::ComposeRequest RewriteRequest( + const std::string& previous_response); } // namespace optimization_guide
diff --git a/components/optimization_guide/core/model_execution/test/response_holder.cc b/components/optimization_guide/core/model_execution/test/response_holder.cc index 28af33cb..fb5affc 100644 --- a/components/optimization_guide/core/model_execution/test/response_holder.cc +++ b/components/optimization_guide/core/model_execution/test/response_holder.cc
@@ -16,7 +16,8 @@ namespace { std::string GetOutput(const StreamingResponse& response) { - return ParsedAnyMetadata<proto::ComposeResponse>(response.response)->output(); + return ParsedAnyMetadata<proto::features::ComposeResponse>(response.response) + ->output(); } } // namespace @@ -41,7 +42,7 @@ final_status_future_.Clear(); log_entry_received_.reset(); model_execution_info_received_.reset(); - streamed_responses_.clear(); + partial_responses_.clear(); response_error_ = std::nullopt; provided_by_on_device_ = std::nullopt; response_received_ = std::nullopt; @@ -69,7 +70,7 @@ if (result.response.has_value() && !result.response->is_complete) { EXPECT_FALSE(result.log_entry); EXPECT_TRUE(result.provided_by_on_device); - streamed_responses_.push_back(GetOutput(*result.response)); + partial_responses_.push_back(GetOutput(*result.response)); return; } provided_by_on_device_ = result.provided_by_on_device;
diff --git a/components/optimization_guide/core/model_execution/test/response_holder.h b/components/optimization_guide/core/model_execution/test/response_holder.h index 9b75a15..ce51968 100644 --- a/components/optimization_guide/core/model_execution/test/response_holder.h +++ b/components/optimization_guide/core/model_execution/test/response_holder.h
@@ -25,8 +25,8 @@ bool GetFinalStatus() { return final_status_future_.Get(); } const std::optional<std::string>& value() const { return response_received_; } - const std::vector<std::string>& streamed() const { - return streamed_responses_; + const std::vector<std::string>& partials() const { + return partial_responses_; } const std::optional< OptimizationGuideModelExecutionError::ModelExecutionError>& @@ -61,7 +61,7 @@ OptimizationGuideModelStreamingExecutionResult result); base::test::TestFuture<bool> final_status_future_; - std::vector<std::string> streamed_responses_; + std::vector<std::string> partial_responses_; std::optional<std::string> response_received_; std::optional<bool> provided_by_on_device_; std::unique_ptr<ModelQualityLogEntry> log_entry_received_;
diff --git a/components/optimization_guide/core/model_quality/feature_type_map.h b/components/optimization_guide/core/model_quality/feature_type_map.h index 4b5ee9d8..1cbd455f 100644 --- a/components/optimization_guide/core/model_quality/feature_type_map.h +++ b/components/optimization_guide/core/model_quality/feature_type_map.h
@@ -39,10 +39,10 @@ class ComposeFeatureTypeMap { public: - using LoggingData = proto::ComposeLoggingData; - using Request = proto::ComposeRequest; - using Response = proto::ComposeResponse; - using Quality = proto::ComposeQuality; + using LoggingData = proto::features::ComposeLoggingData; + using Request = proto::features::ComposeRequest; + using Response = proto::features::ComposeResponse; + using Quality = proto::features::ComposeQuality; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_compose(); @@ -53,10 +53,10 @@ class TabOrganizationFeatureTypeMap { public: - using LoggingData = proto::TabOrganizationLoggingData; - using Request = proto::TabOrganizationRequest; - using Response = proto::TabOrganizationResponse; - using Quality = proto::TabOrganizationQuality; + using LoggingData = proto::features::TabOrganizationLoggingData; + using Request = proto::features::TabOrganizationRequest; + using Response = proto::features::TabOrganizationResponse; + using Quality = proto::features::TabOrganizationQuality; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_tab_organization(); @@ -67,10 +67,10 @@ class WallpaperSearchFeatureTypeMap { public: - using LoggingData = proto::WallpaperSearchLoggingData; - using Request = proto::WallpaperSearchRequest; - using Response = proto::WallpaperSearchResponse; - using Quality = proto::WallpaperSearchQuality; + using LoggingData = proto::features::WallpaperSearchLoggingData; + using Request = proto::features::WallpaperSearchRequest; + using Response = proto::features::WallpaperSearchResponse; + using Quality = proto::features::WallpaperSearchQuality; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_wallpaper_search(); @@ -81,10 +81,10 @@ class HistoryQueryFeatureTypeMap { public: - using LoggingData = proto::HistoryQueryLoggingData; - using Request = proto::HistoryQueryRequest; - using Response = proto::HistoryQueryResponse; - using Quality = proto::HistoryQueryQuality; + using LoggingData = proto::features::HistoryQueryLoggingData; + using Request = proto::features::HistoryQueryRequest; + using Response = proto::features::HistoryQueryResponse; + using Quality = proto::features::HistoryQueryQuality; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_history_query(); @@ -95,9 +95,9 @@ class HistoryQueryIntentFeatureTypeMap { public: - using LoggingData = proto::HistoryQueryIntentLoggingData; - using Request = proto::HistoryQueryIntentRequest; - using Response = proto::HistoryQueryIntentResponse; + using LoggingData = proto::features::HistoryQueryIntentLoggingData; + using Request = proto::features::HistoryQueryIntentRequest; + using Response = proto::features::HistoryQueryIntentResponse; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_history_query_intent(); @@ -108,10 +108,10 @@ class HistoryAnswerFeatureTypeMap { public: - using LoggingData = proto::HistoryAnswerLoggingData; - using Request = proto::HistoryAnswerRequest; - using Response = proto::HistoryAnswerResponse; - using Quality = proto::HistoryAnswerQuality; + using LoggingData = proto::features::HistoryAnswerLoggingData; + using Request = proto::features::HistoryAnswerRequest; + using Response = proto::features::HistoryAnswerResponse; + using Quality = proto::features::HistoryAnswerQuality; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_history_answer(); @@ -122,8 +122,8 @@ class ProductSpecificationsFeatureTypeMap { public: - using LoggingData = proto::ProductSpecificationsLoggingData; - using Quality = proto::ProductSpecificationsQuality; + using LoggingData = proto::features::ProductSpecificationsLoggingData; + using Quality = proto::features::ProductSpecificationsQuality; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_product_specifications(); @@ -134,10 +134,10 @@ class FormsAnnotationsFeatureTypeMap { public: - using LoggingData = proto::FormsAnnotationsLoggingData; - using Request = proto::FormsAnnotationsRequest; - using Response = proto::FormsAnnotationsResponse; - using Quality = proto::FormsAnnotationsQuality; + using LoggingData = proto::features::FormsAnnotationsLoggingData; + using Request = proto::features::FormsAnnotationsRequest; + using Response = proto::features::FormsAnnotationsResponse; + using Quality = proto::features::FormsAnnotationsQuality; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_forms_annotations(); @@ -148,10 +148,10 @@ class FormsPredictionsFeatureTypeMap { public: - using LoggingData = proto::FormsPredictionsLoggingData; - using Request = proto::FormsPredictionsRequest; - using Response = proto::FormsPredictionsResponse; - using Quality = proto::FormsPredictionsQuality; + using LoggingData = proto::features::FormsPredictionsLoggingData; + using Request = proto::features::FormsPredictionsRequest; + using Response = proto::features::FormsPredictionsResponse; + using Quality = proto::features::FormsPredictionsQuality; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_forms_predictions(); @@ -162,9 +162,9 @@ class BlingPrototypingFeatureTypeMap { public: - using LoggingData = proto::BlingPrototypingLoggingData; - using Request = proto::BlingPrototypingRequest; - using Response = proto::BlingPrototypingResponse; + using LoggingData = proto::features::BlingPrototypingLoggingData; + using Request = proto::features::BlingPrototypingRequest; + using Response = proto::features::BlingPrototypingResponse; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_bling_prototyping(); @@ -175,7 +175,7 @@ class ModelPrototypingFeatureTypeMap { public: - using LoggingData = proto::ModelPrototypingLoggingData; + using LoggingData = proto::features::ModelPrototypingLoggingData; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_model_prototyping(); @@ -186,9 +186,9 @@ class PasswordChangeSubmissionFeatureTypeMap { public: - using LoggingData = proto::PasswordChangeSubmissionLoggingData; - using Request = proto::PasswordChangeRequest; - using Response = proto::PasswordChangeResponse; + using LoggingData = proto::features::PasswordChangeSubmissionLoggingData; + using Request = proto::features::PasswordChangeRequest; + using Response = proto::features::PasswordChangeResponse; static LoggingData* GetLoggingData(proto::LogAiDataRequest& ai_data_request) { return ai_data_request.mutable_password_change_submission();
diff --git a/components/optimization_guide/core/model_quality/model_execution_logging_wrappers_unittest.cc b/components/optimization_guide/core/model_quality/model_execution_logging_wrappers_unittest.cc index 25e93185..9c07740 100644 --- a/components/optimization_guide/core/model_quality/model_execution_logging_wrappers_unittest.cc +++ b/components/optimization_guide/core/model_quality/model_execution_logging_wrappers_unittest.cc
@@ -39,7 +39,7 @@ }; TEST_F(ModelExecutionLoggingWrappersTest, ExecuteModelWithLogging) { - proto::TabOrganizationResponse response; + proto::features::TabOrganizationResponse response; response.add_tab_groups()->set_label("foo"); proto::ModelExecutionInfo model_execution_info; model_execution_info.set_execution_id("id"); @@ -59,16 +59,16 @@ model_execution_info)), /*log_entry=*/nullptr); })); - proto::TabOrganizationRequest request; + proto::features::TabOrganizationRequest request; auto* tabs = request.mutable_tabs(); auto* tab = tabs->Add(); tab->set_title("tab"); tab->set_tab_id(1); - ModelExecutionCallbackWithLogging<proto::TabOrganizationLoggingData> + ModelExecutionCallbackWithLogging<proto::features::TabOrganizationLoggingData> callback = base::BindLambdaForTesting( [&request, &response, &model_execution_info]( OptimizationGuideModelExecutionResult result, - std::unique_ptr<proto::TabOrganizationLoggingData> + std::unique_ptr<proto::features::TabOrganizationLoggingData> model_execution_proto) { ASSERT_TRUE(model_execution_proto); EXPECT_THAT(model_execution_proto->request(), EqualsProto(request)); @@ -103,16 +103,17 @@ nullptr), /*log_entry=*/nullptr); })); - proto::TabOrganizationRequest request; + proto::features::TabOrganizationRequest request; auto* tabs = request.mutable_tabs(); auto* tab = tabs->Add(); tab->set_title("tab"); tab->set_tab_id(1); - ModelExecutionCallbackWithLogging<proto::TabOrganizationLoggingData> + ModelExecutionCallbackWithLogging<proto::features::TabOrganizationLoggingData> callback = base::BindLambdaForTesting( - [&request](OptimizationGuideModelExecutionResult result, - std::unique_ptr<proto::TabOrganizationLoggingData> - model_execution_proto) { + [&request]( + OptimizationGuideModelExecutionResult result, + std::unique_ptr<proto::features::TabOrganizationLoggingData> + model_execution_proto) { ASSERT_TRUE(model_execution_proto); EXPECT_THAT(model_execution_proto->request(), EqualsProto(request)); EXPECT_EQ( @@ -129,7 +130,7 @@ TEST_F(ModelExecutionLoggingWrappersTest, ExecuteModelSessionWithLogging) { testing::NiceMock<MockSession> session; - proto::ComposeResponse response; + proto::features::ComposeResponse response; response.set_output("foo"); proto::ModelExecutionInfo model_execution_info; model_execution_info.set_execution_id("id"); @@ -150,13 +151,13 @@ std::make_unique<proto::ModelExecutionInfo>( model_execution_info))); })); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_page_metadata()->set_page_url("url"); - ModelExecutionSessionCallbackWithLogging<proto::ComposeLoggingData> callback = - base::BindLambdaForTesting( + ModelExecutionSessionCallbackWithLogging<proto::features::ComposeLoggingData> + callback = base::BindLambdaForTesting( [&request, &response, &model_execution_info]( OptimizationGuideModelStreamingExecutionResult result, - std::unique_ptr<proto::ComposeLoggingData> + std::unique_ptr<proto::features::ComposeLoggingData> model_execution_proto) { ASSERT_TRUE(model_execution_proto); EXPECT_THAT(model_execution_proto->request(), EqualsProto(request)); @@ -192,12 +193,12 @@ // won't have a ModelExecutionInfo. nullptr)); })); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_page_metadata()->set_page_url("url"); - ModelExecutionSessionCallbackWithLogging<proto::ComposeLoggingData> callback = - base::BindLambdaForTesting( + ModelExecutionSessionCallbackWithLogging<proto::features::ComposeLoggingData> + callback = base::BindLambdaForTesting( [&request](OptimizationGuideModelStreamingExecutionResult result, - std::unique_ptr<proto::ComposeLoggingData> + std::unique_ptr<proto::features::ComposeLoggingData> model_execution_proto) { ASSERT_TRUE(model_execution_proto); EXPECT_THAT(model_execution_proto->request(), EqualsProto(request)); @@ -214,7 +215,7 @@ ExecuteModelSessionWithLogging_IncompleteResponse) { testing::NiceMock<MockSession> session; - proto::ComposeResponse response; + proto::features::ComposeResponse response; response.set_output("foo"); EXPECT_CALL( session, @@ -233,12 +234,13 @@ // execution_info is not set for incomplete responses. /*execution_info=*/nullptr)); })); - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_page_metadata()->set_page_url("url"); ModelExecutionSessionCallbackWithLogging callback = base::BindLambdaForTesting( [](OptimizationGuideModelStreamingExecutionResult result, - std::unique_ptr<proto::ComposeLoggingData> model_execution_proto) { + std::unique_ptr<proto::features::ComposeLoggingData> + model_execution_proto) { ASSERT_FALSE(model_execution_proto); }); ExecuteModelSessionWithLogging(&session, request, std::move(callback));
diff --git a/components/optimization_guide/core/model_quality/model_quality_log_entry_unittest.cc b/components/optimization_guide/core/model_quality/model_quality_log_entry_unittest.cc index 097e888..64f7edc7 100644 --- a/components/optimization_guide/core/model_quality/model_quality_log_entry_unittest.cc +++ b/components/optimization_guide/core/model_quality/model_quality_log_entry_unittest.cc
@@ -25,7 +25,7 @@ namespace { void AddComposeLoggingData(proto::LogAiDataRequest* log) { - *(log->mutable_compose()) = proto::ComposeLoggingData(); + *(log->mutable_compose()) = proto::features::ComposeLoggingData(); } class TestModelQualityLogsUploaderService
diff --git a/components/optimization_guide/core/model_quality/model_quality_logs_uploader_service.cc b/components/optimization_guide/core/model_quality/model_quality_logs_uploader_service.cc index 5c65c415..b234206 100644 --- a/components/optimization_guide/core/model_quality/model_quality_logs_uploader_service.cc +++ b/components/optimization_guide/core/model_quality/model_quality_logs_uploader_service.cc
@@ -68,7 +68,7 @@ MqlsFeatureRegistry::GetInstance().GetFeature( log_ai_data_request->feature_case()); CHECK(metadata); - proto::UserFeedback user_feedback = + proto::features::UserFeedback user_feedback = metadata->get_user_feedback_callback().Run(*log_ai_data_request); base::UmaHistogramEnumeration( base::StrCat(
diff --git a/components/optimization_guide/core/model_quality/model_quality_logs_uploader_service_unittest.cc b/components/optimization_guide/core/model_quality/model_quality_logs_uploader_service_unittest.cc index 2e460f7..1d50dcc8 100644 --- a/components/optimization_guide/core/model_quality/model_quality_logs_uploader_service_unittest.cc +++ b/components/optimization_guide/core/model_quality/model_quality_logs_uploader_service_unittest.cc
@@ -49,17 +49,17 @@ ->mutable_system_profile() ->set_build_timestamp(12345); - proto::ComposeLoggingData compose_logging_data; + proto::features::ComposeLoggingData compose_logging_data; - proto::ComposeRequest request; + proto::features::ComposeRequest request; request.mutable_generate_params()->set_user_input("a user typed this"); - proto::ComposeResponse response; + proto::features::ComposeResponse response; response.set_output("compose response"); - proto::ComposeQuality quality; + proto::features::ComposeQuality quality; quality.set_final_status( - optimization_guide::proto::FinalStatus::STATUS_INSERTED); + optimization_guide::proto::features::FinalStatus::STATUS_INSERTED); *(compose_logging_data.mutable_request()) = request; *(compose_logging_data.mutable_response()) = response; @@ -123,7 +123,7 @@ std::unique_ptr<ModelQualityLogEntry> GetModelQualityLogEntryAndSetFeedback( UserVisibleFeatureKey feature, - proto::UserFeedback feedback) { + proto::features::UserFeedback feedback) { std::unique_ptr<ModelQualityLogEntry> log_entry = std::make_unique<ModelQualityLogEntry>( model_quality_logs_uploader_service_->GetWeakPtr()); @@ -316,51 +316,51 @@ std::unique_ptr<ModelQualityLogEntry> log_entry_1 = GetModelQualityLogEntryAndSetFeedback( UserVisibleFeatureKey::kWallpaperSearch, - proto::USER_FEEDBACK_THUMBS_UP); + proto::features::USER_FEEDBACK_THUMBS_UP); UploadModelQualityLogsWithLogEntry(std::move(log_entry_1)); histogram_tester_.ExpectBucketCount( "OptimizationGuide.ModelQuality.UserFeedback.WallpaperSearch", - proto::USER_FEEDBACK_THUMBS_UP, 1); + proto::features::USER_FEEDBACK_THUMBS_UP, 1); std::unique_ptr<ModelQualityLogEntry> log_entry_2 = GetModelQualityLogEntryAndSetFeedback( UserVisibleFeatureKey::kWallpaperSearch, - proto::USER_FEEDBACK_THUMBS_DOWN); + proto::features::USER_FEEDBACK_THUMBS_DOWN); UploadModelQualityLogsWithLogEntry(std::move(log_entry_2)); histogram_tester_.ExpectBucketCount( "OptimizationGuide.ModelQuality.UserFeedback.WallpaperSearch", - proto::USER_FEEDBACK_THUMBS_DOWN, 1); + proto::features::USER_FEEDBACK_THUMBS_DOWN, 1); } TEST_F(ModelQualityLogsUploaderServiceTest, TabOrganizationUserFeedbackUMA) { std::unique_ptr<ModelQualityLogEntry> log_entry_1 = GetModelQualityLogEntryAndSetFeedback( UserVisibleFeatureKey::kTabOrganization, - proto::USER_FEEDBACK_THUMBS_UP); + proto::features::USER_FEEDBACK_THUMBS_UP); UploadModelQualityLogsWithLogEntry(std::move(log_entry_1)); histogram_tester_.ExpectBucketCount( "OptimizationGuide.ModelQuality.UserFeedback.TabOrganization", - proto::USER_FEEDBACK_THUMBS_UP, 1); + proto::features::USER_FEEDBACK_THUMBS_UP, 1); std::unique_ptr<ModelQualityLogEntry> log_entry_2 = GetModelQualityLogEntryAndSetFeedback( UserVisibleFeatureKey::kTabOrganization, - proto::USER_FEEDBACK_THUMBS_DOWN); + proto::features::USER_FEEDBACK_THUMBS_DOWN); UploadModelQualityLogsWithLogEntry(std::move(log_entry_2)); histogram_tester_.ExpectBucketCount( "OptimizationGuide.ModelQuality.UserFeedback.TabOrganization", - proto::USER_FEEDBACK_THUMBS_DOWN, 1); + proto::features::USER_FEEDBACK_THUMBS_DOWN, 1); } TEST_F(ModelQualityLogsUploaderServiceTest, TabOrganizationUserFeedbackNullCheck) { // Set TabOrganization ModelQualityLogEntry without any quality data tab // organization. - proto::TabOrganizationLoggingData tab_organization_logging_data; + proto::features::TabOrganizationLoggingData tab_organization_logging_data; - proto::TabOrganizationRequest tab_request; + proto::features::TabOrganizationRequest tab_request; *(tab_organization_logging_data.mutable_request()) = tab_request; std::unique_ptr<ModelQualityLogEntry> log_entry_1 = @@ -374,7 +374,7 @@ histogram_tester_.ExpectBucketCount( "OptimizationGuide.ModelQuality.UserFeedback.TabOrganization", - proto::USER_FEEDBACK_UNSPECIFIED, 1); + proto::features::USER_FEEDBACK_UNSPECIFIED, 1); } TEST_F(ModelQualityLogsUploaderServiceTest, @@ -382,46 +382,49 @@ std::unique_ptr<ModelQualityLogEntry> log_entry = GetModelQualityLogEntryAndSetFeedback( UserVisibleFeatureKey::kTabOrganization, - proto::USER_FEEDBACK_THUMBS_UP); + proto::features::USER_FEEDBACK_THUMBS_UP); // Add one more tab organization to existing log_entry with user feedback. log_entry->quality_data<TabOrganizationFeatureTypeMap>() ->add_organizations() - ->set_user_feedback(proto::USER_FEEDBACK_THUMBS_DOWN); + ->set_user_feedback(proto::features::USER_FEEDBACK_THUMBS_DOWN); UploadModelQualityLogsWithLogEntry(std::move(log_entry)); // We only record the first user feedback value. histogram_tester_.ExpectBucketCount( "OptimizationGuide.ModelQuality.UserFeedback.TabOrganization", - proto::USER_FEEDBACK_THUMBS_UP, 1); + proto::features::USER_FEEDBACK_THUMBS_UP, 1); histogram_tester_.ExpectBucketCount( "OptimizationGuide.ModelQuality.UserFeedback.TabOrganization", - proto::USER_FEEDBACK_THUMBS_DOWN, 0); + proto::features::USER_FEEDBACK_THUMBS_DOWN, 0); } TEST_F(ModelQualityLogsUploaderServiceTest, ComposeUserFeedbackUMA) { std::unique_ptr<ModelQualityLogEntry> log_entry_1 = - GetModelQualityLogEntryAndSetFeedback(UserVisibleFeatureKey::kCompose, - proto::USER_FEEDBACK_THUMBS_UP); + GetModelQualityLogEntryAndSetFeedback( + UserVisibleFeatureKey::kCompose, + proto::features::USER_FEEDBACK_THUMBS_UP); UploadModelQualityLogsWithLogEntry(std::move(log_entry_1)); histogram_tester_.ExpectBucketCount( "OptimizationGuide.ModelQuality.UserFeedback.Compose", - proto::USER_FEEDBACK_THUMBS_UP, 1); + proto::features::USER_FEEDBACK_THUMBS_UP, 1); std::unique_ptr<ModelQualityLogEntry> log_entry_2 = - GetModelQualityLogEntryAndSetFeedback(UserVisibleFeatureKey::kCompose, - proto::USER_FEEDBACK_THUMBS_DOWN); + GetModelQualityLogEntryAndSetFeedback( + UserVisibleFeatureKey::kCompose, + proto::features::USER_FEEDBACK_THUMBS_DOWN); UploadModelQualityLogsWithLogEntry(std::move(log_entry_2)); histogram_tester_.ExpectBucketCount( "OptimizationGuide.ModelQuality.UserFeedback.Compose", - proto::USER_FEEDBACK_THUMBS_DOWN, 1); + proto::features::USER_FEEDBACK_THUMBS_DOWN, 1); } TEST_F(ModelQualityLogsUploaderServiceTest, CheckUploadOnDestruction) { std::unique_ptr<ModelQualityLogEntry> log_entry = - GetModelQualityLogEntryAndSetFeedback(UserVisibleFeatureKey::kCompose, - proto::USER_FEEDBACK_THUMBS_UP); + GetModelQualityLogEntryAndSetFeedback( + UserVisibleFeatureKey::kCompose, + proto::features::USER_FEEDBACK_THUMBS_UP); // Instead of calling UploadModelQualityLogs, resetting the log entry this // shouldn't upload the logs as // ModelQualityLogsUploaderService::CanUploadLogs will return false.
diff --git a/components/optimization_guide/core/optimization_guide_enums.h b/components/optimization_guide/core/optimization_guide_enums.h index 20f7cfa..bfe1b52 100644 --- a/components/optimization_guide/core/optimization_guide_enums.h +++ b/components/optimization_guide/core/optimization_guide_enums.h
@@ -430,6 +430,14 @@ kMaxValue = kInterrupted, }; +// Whether a response is complete or not. +enum class ResponseCompleteness { + // This is a partial response, more output may follow. + kPartial, + // The response is complete and no more output will be produced. + kComplete, +}; + } // namespace optimization_guide #endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_GUIDE_ENUMS_H_
diff --git a/components/optimization_guide/core/optimization_guide_proto_util.cc b/components/optimization_guide/core/optimization_guide_proto_util.cc index 7fee59e..a2574c6 100644 --- a/components/optimization_guide/core/optimization_guide_proto_util.cc +++ b/components/optimization_guide/core/optimization_guide_proto_util.cc
@@ -17,911 +17,1051 @@ namespace { -optimization_guide::proto::AXTextAffinity TextAffinityToProto( +optimization_guide::proto::features::AXTextAffinity TextAffinityToProto( ax::mojom::TextAffinity affinity) { switch (affinity) { case ax::mojom::TextAffinity::kNone: - return optimization_guide::proto::AXTextAffinity::AX_TEXT_AFFINITY_NONE; + return optimization_guide::proto::features::AXTextAffinity:: + AX_TEXT_AFFINITY_NONE; case ax::mojom::TextAffinity::kDownstream: - return optimization_guide::proto::AXTextAffinity:: + return optimization_guide::proto::features::AXTextAffinity:: AX_TEXT_AFFINITY_DOWNSTREAM; case ax::mojom::TextAffinity::kUpstream: - return optimization_guide::proto::AXTextAffinity:: + return optimization_guide::proto::features::AXTextAffinity:: AX_TEXT_AFFINITY_UPSTREAM; } } -optimization_guide::proto::AXRole RoleToProto(ax::mojom::Role role) { +optimization_guide::proto::features::AXRole RoleToProto(ax::mojom::Role role) { switch (role) { case ax::mojom::Role::kUnknown: - return optimization_guide::proto::AXRole::AX_ROLE_UNKNOWN; + return optimization_guide::proto::features::AXRole::AX_ROLE_UNKNOWN; case ax::mojom::Role::kAbbr: - return optimization_guide::proto::AXRole::AX_ROLE_ABBR; + return optimization_guide::proto::features::AXRole::AX_ROLE_ABBR; case ax::mojom::Role::kAlert: - return optimization_guide::proto::AXRole::AX_ROLE_ALERT; + return optimization_guide::proto::features::AXRole::AX_ROLE_ALERT; case ax::mojom::Role::kAlertDialog: - return optimization_guide::proto::AXRole::AX_ROLE_ALERTDIALOG; + return optimization_guide::proto::features::AXRole::AX_ROLE_ALERTDIALOG; case ax::mojom::Role::kApplication: - return optimization_guide::proto::AXRole::AX_ROLE_APPLICATION; + return optimization_guide::proto::features::AXRole::AX_ROLE_APPLICATION; case ax::mojom::Role::kArticle: - return optimization_guide::proto::AXRole::AX_ROLE_ARTICLE; + return optimization_guide::proto::features::AXRole::AX_ROLE_ARTICLE; case ax::mojom::Role::kAudio: - return optimization_guide::proto::AXRole::AX_ROLE_AUDIO; + return optimization_guide::proto::features::AXRole::AX_ROLE_AUDIO; case ax::mojom::Role::kBanner: - return optimization_guide::proto::AXRole::AX_ROLE_BANNER; + return optimization_guide::proto::features::AXRole::AX_ROLE_BANNER; case ax::mojom::Role::kBlockquote: - return optimization_guide::proto::AXRole::AX_ROLE_BLOCKQUOTE; + return optimization_guide::proto::features::AXRole::AX_ROLE_BLOCKQUOTE; case ax::mojom::Role::kButton: - return optimization_guide::proto::AXRole::AX_ROLE_BUTTON; + return optimization_guide::proto::features::AXRole::AX_ROLE_BUTTON; case ax::mojom::Role::kCanvas: - return optimization_guide::proto::AXRole::AX_ROLE_CANVAS; + return optimization_guide::proto::features::AXRole::AX_ROLE_CANVAS; case ax::mojom::Role::kCaption: - return optimization_guide::proto::AXRole::AX_ROLE_CAPTION; + return optimization_guide::proto::features::AXRole::AX_ROLE_CAPTION; case ax::mojom::Role::kCaret: - return optimization_guide::proto::AXRole::AX_ROLE_CARET; + return optimization_guide::proto::features::AXRole::AX_ROLE_CARET; case ax::mojom::Role::kCell: - return optimization_guide::proto::AXRole::AX_ROLE_CELL; + return optimization_guide::proto::features::AXRole::AX_ROLE_CELL; case ax::mojom::Role::kCheckBox: - return optimization_guide::proto::AXRole::AX_ROLE_CHECKBOX; + return optimization_guide::proto::features::AXRole::AX_ROLE_CHECKBOX; case ax::mojom::Role::kClient: - return optimization_guide::proto::AXRole::AX_ROLE_CLIENT; + return optimization_guide::proto::features::AXRole::AX_ROLE_CLIENT; case ax::mojom::Role::kCode: - return optimization_guide::proto::AXRole::AX_ROLE_CODE; + return optimization_guide::proto::features::AXRole::AX_ROLE_CODE; case ax::mojom::Role::kColorWell: - return optimization_guide::proto::AXRole::AX_ROLE_COLORWELL; + return optimization_guide::proto::features::AXRole::AX_ROLE_COLORWELL; case ax::mojom::Role::kColumn: - return optimization_guide::proto::AXRole::AX_ROLE_COLUMN; + return optimization_guide::proto::features::AXRole::AX_ROLE_COLUMN; case ax::mojom::Role::kColumnHeader: - return optimization_guide::proto::AXRole::AX_ROLE_COLUMNHEADER; + return optimization_guide::proto::features::AXRole::AX_ROLE_COLUMNHEADER; case ax::mojom::Role::kComboBoxGrouping: - return optimization_guide::proto::AXRole::AX_ROLE_COMBOBOXGROUPING; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_COMBOBOXGROUPING; case ax::mojom::Role::kComboBoxMenuButton: - return optimization_guide::proto::AXRole::AX_ROLE_COMBOBOXMENUBUTTON; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_COMBOBOXMENUBUTTON; case ax::mojom::Role::kComboBoxSelect: - return optimization_guide::proto::AXRole::AX_ROLE_COMBOBOXSELECT; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_COMBOBOXSELECT; case ax::mojom::Role::kComplementary: - return optimization_guide::proto::AXRole::AX_ROLE_COMPLEMENTARY; + return optimization_guide::proto::features::AXRole::AX_ROLE_COMPLEMENTARY; case ax::mojom::Role::kComment: - return optimization_guide::proto::AXRole::AX_ROLE_COMMENT; + return optimization_guide::proto::features::AXRole::AX_ROLE_COMMENT; case ax::mojom::Role::kContentDeletion: - return optimization_guide::proto::AXRole::AX_ROLE_CONTENTDELETION; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_CONTENTDELETION; case ax::mojom::Role::kContentInsertion: - return optimization_guide::proto::AXRole::AX_ROLE_CONTENTINSERTION; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_CONTENTINSERTION; case ax::mojom::Role::kContentInfo: - return optimization_guide::proto::AXRole::AX_ROLE_CONTENTINFO; + return optimization_guide::proto::features::AXRole::AX_ROLE_CONTENTINFO; case ax::mojom::Role::kDate: - return optimization_guide::proto::AXRole::AX_ROLE_DATE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DATE; case ax::mojom::Role::kDateTime: - return optimization_guide::proto::AXRole::AX_ROLE_DATETIME; + return optimization_guide::proto::features::AXRole::AX_ROLE_DATETIME; case ax::mojom::Role::kDefinition: - return optimization_guide::proto::AXRole::AX_ROLE_DEFINITION; + return optimization_guide::proto::features::AXRole::AX_ROLE_DEFINITION; case ax::mojom::Role::kDescriptionList: - return optimization_guide::proto::AXRole::AX_ROLE_DESCRIPTIONLIST; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_DESCRIPTIONLIST; case ax::mojom::Role::kDescriptionListDetailDeprecated: - return optimization_guide::proto::AXRole:: + return optimization_guide::proto::features::AXRole:: AX_ROLE_DESCRIPTIONLISTDETAILDEPRECATED; case ax::mojom::Role::kDescriptionListTermDeprecated: - return optimization_guide::proto::AXRole:: + return optimization_guide::proto::features::AXRole:: AX_ROLE_DESCRIPTIONLISTTERMDEPRECATED; case ax::mojom::Role::kDesktop: - return optimization_guide::proto::AXRole::AX_ROLE_DESKTOP; + return optimization_guide::proto::features::AXRole::AX_ROLE_DESKTOP; case ax::mojom::Role::kDetails: - return optimization_guide::proto::AXRole::AX_ROLE_DETAILS; + return optimization_guide::proto::features::AXRole::AX_ROLE_DETAILS; case ax::mojom::Role::kDialog: - return optimization_guide::proto::AXRole::AX_ROLE_DIALOG; + return optimization_guide::proto::features::AXRole::AX_ROLE_DIALOG; case ax::mojom::Role::kDirectoryDeprecated: - return optimization_guide::proto::AXRole::AX_ROLE_DIRECTORYDEPRECATED; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_DIRECTORYDEPRECATED; case ax::mojom::Role::kDisclosureTriangle: - return optimization_guide::proto::AXRole::AX_ROLE_DISCLOSURETRIANGLE; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_DISCLOSURETRIANGLE; case ax::mojom::Role::kDisclosureTriangleGrouped: - return optimization_guide::proto::AXRole:: + return optimization_guide::proto::features::AXRole:: AX_ROLE_DISCLOSURETRIANGLEGROUPED; case ax::mojom::Role::kDocAbstract: - return optimization_guide::proto::AXRole::AX_ROLE_DOCABSTRACT; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCABSTRACT; case ax::mojom::Role::kDocAcknowledgments: - return optimization_guide::proto::AXRole::AX_ROLE_DOCACKNOWLEDGMENTS; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_DOCACKNOWLEDGMENTS; case ax::mojom::Role::kDocAfterword: - return optimization_guide::proto::AXRole::AX_ROLE_DOCAFTERWORD; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCAFTERWORD; case ax::mojom::Role::kDocAppendix: - return optimization_guide::proto::AXRole::AX_ROLE_DOCAPPENDIX; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCAPPENDIX; case ax::mojom::Role::kDocBackLink: - return optimization_guide::proto::AXRole::AX_ROLE_DOCBACKLINK; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCBACKLINK; case ax::mojom::Role::kDocBiblioEntry: - return optimization_guide::proto::AXRole::AX_ROLE_DOCBIBLIOENTRY; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_DOCBIBLIOENTRY; case ax::mojom::Role::kDocBibliography: - return optimization_guide::proto::AXRole::AX_ROLE_DOCBIBLIOGRAPHY; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_DOCBIBLIOGRAPHY; case ax::mojom::Role::kDocBiblioRef: - return optimization_guide::proto::AXRole::AX_ROLE_DOCBIBLIOREF; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCBIBLIOREF; case ax::mojom::Role::kDocChapter: - return optimization_guide::proto::AXRole::AX_ROLE_DOCCHAPTER; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCCHAPTER; case ax::mojom::Role::kDocColophon: - return optimization_guide::proto::AXRole::AX_ROLE_DOCCOLOPHON; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCCOLOPHON; case ax::mojom::Role::kDocConclusion: - return optimization_guide::proto::AXRole::AX_ROLE_DOCCONCLUSION; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCCONCLUSION; case ax::mojom::Role::kDocCover: - return optimization_guide::proto::AXRole::AX_ROLE_DOCCOVER; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCCOVER; case ax::mojom::Role::kDocCredit: - return optimization_guide::proto::AXRole::AX_ROLE_DOCCREDIT; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCCREDIT; case ax::mojom::Role::kDocCredits: - return optimization_guide::proto::AXRole::AX_ROLE_DOCCREDITS; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCCREDITS; case ax::mojom::Role::kDocDedication: - return optimization_guide::proto::AXRole::AX_ROLE_DOCDEDICATION; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCDEDICATION; case ax::mojom::Role::kDocEndnote: - return optimization_guide::proto::AXRole::AX_ROLE_DOCENDNOTE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCENDNOTE; case ax::mojom::Role::kDocEndnotes: - return optimization_guide::proto::AXRole::AX_ROLE_DOCENDNOTES; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCENDNOTES; case ax::mojom::Role::kDocEpigraph: - return optimization_guide::proto::AXRole::AX_ROLE_DOCEPIGRAPH; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCEPIGRAPH; case ax::mojom::Role::kDocEpilogue: - return optimization_guide::proto::AXRole::AX_ROLE_DOCEPILOGUE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCEPILOGUE; case ax::mojom::Role::kDocErrata: - return optimization_guide::proto::AXRole::AX_ROLE_DOCERRATA; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCERRATA; case ax::mojom::Role::kDocExample: - return optimization_guide::proto::AXRole::AX_ROLE_DOCEXAMPLE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCEXAMPLE; case ax::mojom::Role::kDocFootnote: - return optimization_guide::proto::AXRole::AX_ROLE_DOCFOOTNOTE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCFOOTNOTE; case ax::mojom::Role::kDocForeword: - return optimization_guide::proto::AXRole::AX_ROLE_DOCFOREWORD; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCFOREWORD; case ax::mojom::Role::kDocGlossary: - return optimization_guide::proto::AXRole::AX_ROLE_DOCGLOSSARY; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCGLOSSARY; case ax::mojom::Role::kDocGlossRef: - return optimization_guide::proto::AXRole::AX_ROLE_DOCGLOSSREF; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCGLOSSREF; case ax::mojom::Role::kDocIndex: - return optimization_guide::proto::AXRole::AX_ROLE_DOCINDEX; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCINDEX; case ax::mojom::Role::kDocIntroduction: - return optimization_guide::proto::AXRole::AX_ROLE_DOCINTRODUCTION; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_DOCINTRODUCTION; case ax::mojom::Role::kDocNoteRef: - return optimization_guide::proto::AXRole::AX_ROLE_DOCNOTEREF; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCNOTEREF; case ax::mojom::Role::kDocNotice: - return optimization_guide::proto::AXRole::AX_ROLE_DOCNOTICE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCNOTICE; case ax::mojom::Role::kDocPageBreak: - return optimization_guide::proto::AXRole::AX_ROLE_DOCPAGEBREAK; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCPAGEBREAK; case ax::mojom::Role::kDocPageFooter: - return optimization_guide::proto::AXRole::AX_ROLE_DOCPAGEFOOTER; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCPAGEFOOTER; case ax::mojom::Role::kDocPageHeader: - return optimization_guide::proto::AXRole::AX_ROLE_DOCPAGEHEADER; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCPAGEHEADER; case ax::mojom::Role::kDocPageList: - return optimization_guide::proto::AXRole::AX_ROLE_DOCPAGELIST; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCPAGELIST; case ax::mojom::Role::kDocPart: - return optimization_guide::proto::AXRole::AX_ROLE_DOCPART; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCPART; case ax::mojom::Role::kDocPreface: - return optimization_guide::proto::AXRole::AX_ROLE_DOCPREFACE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCPREFACE; case ax::mojom::Role::kDocPrologue: - return optimization_guide::proto::AXRole::AX_ROLE_DOCPROLOGUE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCPROLOGUE; case ax::mojom::Role::kDocPullquote: - return optimization_guide::proto::AXRole::AX_ROLE_DOCPULLQUOTE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCPULLQUOTE; case ax::mojom::Role::kDocQna: - return optimization_guide::proto::AXRole::AX_ROLE_DOCQNA; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCQNA; case ax::mojom::Role::kDocSubtitle: - return optimization_guide::proto::AXRole::AX_ROLE_DOCSUBTITLE; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCSUBTITLE; case ax::mojom::Role::kDocTip: - return optimization_guide::proto::AXRole::AX_ROLE_DOCTIP; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCTIP; case ax::mojom::Role::kDocToc: - return optimization_guide::proto::AXRole::AX_ROLE_DOCTOC; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCTOC; case ax::mojom::Role::kDocument: - return optimization_guide::proto::AXRole::AX_ROLE_DOCUMENT; + return optimization_guide::proto::features::AXRole::AX_ROLE_DOCUMENT; case ax::mojom::Role::kEmbeddedObject: - return optimization_guide::proto::AXRole::AX_ROLE_EMBEDDEDOBJECT; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_EMBEDDEDOBJECT; case ax::mojom::Role::kEmphasis: - return optimization_guide::proto::AXRole::AX_ROLE_EMPHASIS; + return optimization_guide::proto::features::AXRole::AX_ROLE_EMPHASIS; case ax::mojom::Role::kFeed: - return optimization_guide::proto::AXRole::AX_ROLE_FEED; + return optimization_guide::proto::features::AXRole::AX_ROLE_FEED; case ax::mojom::Role::kFigcaption: - return optimization_guide::proto::AXRole::AX_ROLE_FIGCAPTION; + return optimization_guide::proto::features::AXRole::AX_ROLE_FIGCAPTION; case ax::mojom::Role::kFigure: - return optimization_guide::proto::AXRole::AX_ROLE_FIGURE; + return optimization_guide::proto::features::AXRole::AX_ROLE_FIGURE; case ax::mojom::Role::kFooter: - return optimization_guide::proto::AXRole::AX_ROLE_FOOTER; + return optimization_guide::proto::features::AXRole::AX_ROLE_FOOTER; case ax::mojom::Role::kForm: - return optimization_guide::proto::AXRole::AX_ROLE_FORM; + return optimization_guide::proto::features::AXRole::AX_ROLE_FORM; case ax::mojom::Role::kGenericContainer: - return optimization_guide::proto::AXRole::AX_ROLE_GENERICCONTAINER; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_GENERICCONTAINER; case ax::mojom::Role::kGraphicsDocument: - return optimization_guide::proto::AXRole::AX_ROLE_GRAPHICSDOCUMENT; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_GRAPHICSDOCUMENT; case ax::mojom::Role::kGraphicsObject: - return optimization_guide::proto::AXRole::AX_ROLE_GRAPHICSOBJECT; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_GRAPHICSOBJECT; case ax::mojom::Role::kGraphicsSymbol: - return optimization_guide::proto::AXRole::AX_ROLE_GRAPHICSSYMBOL; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_GRAPHICSSYMBOL; case ax::mojom::Role::kGrid: - return optimization_guide::proto::AXRole::AX_ROLE_GRID; + return optimization_guide::proto::features::AXRole::AX_ROLE_GRID; case ax::mojom::Role::kGridCell: - return optimization_guide::proto::AXRole::AX_ROLE_GRIDCELL; + return optimization_guide::proto::features::AXRole::AX_ROLE_GRIDCELL; case ax::mojom::Role::kGroup: - return optimization_guide::proto::AXRole::AX_ROLE_GROUP; + return optimization_guide::proto::features::AXRole::AX_ROLE_GROUP; case ax::mojom::Role::kHeader: - return optimization_guide::proto::AXRole::AX_ROLE_HEADER; + return optimization_guide::proto::features::AXRole::AX_ROLE_HEADER; case ax::mojom::Role::kHeading: - return optimization_guide::proto::AXRole::AX_ROLE_HEADING; + return optimization_guide::proto::features::AXRole::AX_ROLE_HEADING; case ax::mojom::Role::kIframe: - return optimization_guide::proto::AXRole::AX_ROLE_IFRAME; + return optimization_guide::proto::features::AXRole::AX_ROLE_IFRAME; case ax::mojom::Role::kIframePresentational: - return optimization_guide::proto::AXRole::AX_ROLE_IFRAMEPRESENTATIONAL; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_IFRAMEPRESENTATIONAL; case ax::mojom::Role::kImage: - return optimization_guide::proto::AXRole::AX_ROLE_IMAGE; + return optimization_guide::proto::features::AXRole::AX_ROLE_IMAGE; case ax::mojom::Role::kImeCandidate: - return optimization_guide::proto::AXRole::AX_ROLE_IMECANDIDATE; + return optimization_guide::proto::features::AXRole::AX_ROLE_IMECANDIDATE; case ax::mojom::Role::kInlineTextBox: - return optimization_guide::proto::AXRole::AX_ROLE_INLINETEXTBOX; + return optimization_guide::proto::features::AXRole::AX_ROLE_INLINETEXTBOX; case ax::mojom::Role::kInputTime: - return optimization_guide::proto::AXRole::AX_ROLE_INPUTTIME; + return optimization_guide::proto::features::AXRole::AX_ROLE_INPUTTIME; case ax::mojom::Role::kKeyboard: - return optimization_guide::proto::AXRole::AX_ROLE_KEYBOARD; + return optimization_guide::proto::features::AXRole::AX_ROLE_KEYBOARD; case ax::mojom::Role::kLabelText: - return optimization_guide::proto::AXRole::AX_ROLE_LABELTEXT; + return optimization_guide::proto::features::AXRole::AX_ROLE_LABELTEXT; case ax::mojom::Role::kLayoutTable: - return optimization_guide::proto::AXRole::AX_ROLE_LAYOUTTABLE; + return optimization_guide::proto::features::AXRole::AX_ROLE_LAYOUTTABLE; case ax::mojom::Role::kLayoutTableCell: - return optimization_guide::proto::AXRole::AX_ROLE_LAYOUTTABLECELL; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_LAYOUTTABLECELL; case ax::mojom::Role::kLayoutTableRow: - return optimization_guide::proto::AXRole::AX_ROLE_LAYOUTTABLEROW; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_LAYOUTTABLEROW; case ax::mojom::Role::kLegend: - return optimization_guide::proto::AXRole::AX_ROLE_LEGEND; + return optimization_guide::proto::features::AXRole::AX_ROLE_LEGEND; case ax::mojom::Role::kLineBreak: - return optimization_guide::proto::AXRole::AX_ROLE_LINEBREAK; + return optimization_guide::proto::features::AXRole::AX_ROLE_LINEBREAK; case ax::mojom::Role::kLink: - return optimization_guide::proto::AXRole::AX_ROLE_LINK; + return optimization_guide::proto::features::AXRole::AX_ROLE_LINK; case ax::mojom::Role::kList: - return optimization_guide::proto::AXRole::AX_ROLE_LIST; + return optimization_guide::proto::features::AXRole::AX_ROLE_LIST; case ax::mojom::Role::kListBox: - return optimization_guide::proto::AXRole::AX_ROLE_LISTBOX; + return optimization_guide::proto::features::AXRole::AX_ROLE_LISTBOX; case ax::mojom::Role::kListBoxOption: - return optimization_guide::proto::AXRole::AX_ROLE_LISTBOXOPTION; + return optimization_guide::proto::features::AXRole::AX_ROLE_LISTBOXOPTION; case ax::mojom::Role::kListGrid: - return optimization_guide::proto::AXRole::AX_ROLE_LISTGRID; + return optimization_guide::proto::features::AXRole::AX_ROLE_LISTGRID; case ax::mojom::Role::kListItem: - return optimization_guide::proto::AXRole::AX_ROLE_LISTITEM; + return optimization_guide::proto::features::AXRole::AX_ROLE_LISTITEM; case ax::mojom::Role::kListMarker: - return optimization_guide::proto::AXRole::AX_ROLE_LISTMARKER; + return optimization_guide::proto::features::AXRole::AX_ROLE_LISTMARKER; case ax::mojom::Role::kLog: - return optimization_guide::proto::AXRole::AX_ROLE_LOG; + return optimization_guide::proto::features::AXRole::AX_ROLE_LOG; case ax::mojom::Role::kMain: - return optimization_guide::proto::AXRole::AX_ROLE_MAIN; + return optimization_guide::proto::features::AXRole::AX_ROLE_MAIN; case ax::mojom::Role::kMark: - return optimization_guide::proto::AXRole::AX_ROLE_MARK; + return optimization_guide::proto::features::AXRole::AX_ROLE_MARK; case ax::mojom::Role::kMarquee: - return optimization_guide::proto::AXRole::AX_ROLE_MARQUEE; + return optimization_guide::proto::features::AXRole::AX_ROLE_MARQUEE; case ax::mojom::Role::kMath: - return optimization_guide::proto::AXRole::AX_ROLE_MATH; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATH; case ax::mojom::Role::kMathMLFraction: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLFRACTION; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLFRACTION; case ax::mojom::Role::kMathMLIdentifier: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLIDENTIFIER; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLIDENTIFIER; case ax::mojom::Role::kMathMLMath: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLMATH; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLMATH; case ax::mojom::Role::kMathMLMultiscripts: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLMULTISCRIPTS; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLMULTISCRIPTS; case ax::mojom::Role::kMathMLNoneScript: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLNONESCRIPT; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLNONESCRIPT; case ax::mojom::Role::kMathMLNumber: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLNUMBER; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLNUMBER; case ax::mojom::Role::kMathMLOperator: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLOPERATOR; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLOPERATOR; case ax::mojom::Role::kMathMLOver: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLOVER; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLOVER; case ax::mojom::Role::kMathMLPrescriptDelimiter: - return optimization_guide::proto::AXRole:: + return optimization_guide::proto::features::AXRole:: AX_ROLE_MATHMLPRESCRIPTDELIMITER; case ax::mojom::Role::kMathMLRoot: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLROOT; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLROOT; case ax::mojom::Role::kMathMLRow: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLROW; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLROW; case ax::mojom::Role::kMathMLSquareRoot: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLSQUAREROOT; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLSQUAREROOT; case ax::mojom::Role::kMathMLStringLiteral: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLSTRINGLITERAL; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLSTRINGLITERAL; case ax::mojom::Role::kMathMLSub: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLSUB; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLSUB; case ax::mojom::Role::kMathMLSubSup: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLSUBSUP; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLSUBSUP; case ax::mojom::Role::kMathMLSup: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLSUP; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLSUP; case ax::mojom::Role::kMathMLTable: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLTABLE; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLTABLE; case ax::mojom::Role::kMathMLTableCell: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLTABLECELL; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLTABLECELL; case ax::mojom::Role::kMathMLTableRow: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLTABLEROW; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLTABLEROW; case ax::mojom::Role::kMathMLText: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLTEXT; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLTEXT; case ax::mojom::Role::kMathMLUnder: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLUNDER; + return optimization_guide::proto::features::AXRole::AX_ROLE_MATHMLUNDER; case ax::mojom::Role::kMathMLUnderOver: - return optimization_guide::proto::AXRole::AX_ROLE_MATHMLUNDEROVER; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MATHMLUNDEROVER; case ax::mojom::Role::kMenu: - return optimization_guide::proto::AXRole::AX_ROLE_MENU; + return optimization_guide::proto::features::AXRole::AX_ROLE_MENU; case ax::mojom::Role::kMenuBar: - return optimization_guide::proto::AXRole::AX_ROLE_MENUBAR; + return optimization_guide::proto::features::AXRole::AX_ROLE_MENUBAR; case ax::mojom::Role::kMenuItem: - return optimization_guide::proto::AXRole::AX_ROLE_MENUITEM; + return optimization_guide::proto::features::AXRole::AX_ROLE_MENUITEM; case ax::mojom::Role::kMenuItemCheckBox: - return optimization_guide::proto::AXRole::AX_ROLE_MENUITEMCHECKBOX; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MENUITEMCHECKBOX; case ax::mojom::Role::kMenuItemRadio: - return optimization_guide::proto::AXRole::AX_ROLE_MENUITEMRADIO; + return optimization_guide::proto::features::AXRole::AX_ROLE_MENUITEMRADIO; case ax::mojom::Role::kMenuListOption: - return optimization_guide::proto::AXRole::AX_ROLE_MENULISTOPTION; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_MENULISTOPTION; case ax::mojom::Role::kMenuListPopup: - return optimization_guide::proto::AXRole::AX_ROLE_MENULISTPOPUP; + return optimization_guide::proto::features::AXRole::AX_ROLE_MENULISTPOPUP; case ax::mojom::Role::kMeter: - return optimization_guide::proto::AXRole::AX_ROLE_METER; + return optimization_guide::proto::features::AXRole::AX_ROLE_METER; case ax::mojom::Role::kNavigation: - return optimization_guide::proto::AXRole::AX_ROLE_NAVIGATION; + return optimization_guide::proto::features::AXRole::AX_ROLE_NAVIGATION; case ax::mojom::Role::kNone: - return optimization_guide::proto::AXRole::AX_ROLE_NONE; + return optimization_guide::proto::features::AXRole::AX_ROLE_NONE; case ax::mojom::Role::kNote: - return optimization_guide::proto::AXRole::AX_ROLE_NOTE; + return optimization_guide::proto::features::AXRole::AX_ROLE_NOTE; case ax::mojom::Role::kPane: - return optimization_guide::proto::AXRole::AX_ROLE_PANE; + return optimization_guide::proto::features::AXRole::AX_ROLE_PANE; case ax::mojom::Role::kParagraph: - return optimization_guide::proto::AXRole::AX_ROLE_PARAGRAPH; + return optimization_guide::proto::features::AXRole::AX_ROLE_PARAGRAPH; case ax::mojom::Role::kPdfActionableHighlight: - return optimization_guide::proto::AXRole::AX_ROLE_PDFACTIONABLEHIGHLIGHT; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_PDFACTIONABLEHIGHLIGHT; case ax::mojom::Role::kPdfRoot: - return optimization_guide::proto::AXRole::AX_ROLE_PDFROOT; + return optimization_guide::proto::features::AXRole::AX_ROLE_PDFROOT; case ax::mojom::Role::kPluginObject: - return optimization_guide::proto::AXRole::AX_ROLE_PLUGINOBJECT; + return optimization_guide::proto::features::AXRole::AX_ROLE_PLUGINOBJECT; case ax::mojom::Role::kPopUpButton: - return optimization_guide::proto::AXRole::AX_ROLE_POPUPBUTTON; + return optimization_guide::proto::features::AXRole::AX_ROLE_POPUPBUTTON; case ax::mojom::Role::kPortalDeprecated: - return optimization_guide::proto::AXRole::AX_ROLE_PORTALDEPRECATED; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_PORTALDEPRECATED; case ax::mojom::Role::kPreDeprecated: - return optimization_guide::proto::AXRole::AX_ROLE_PREDEPRECATED; + return optimization_guide::proto::features::AXRole::AX_ROLE_PREDEPRECATED; case ax::mojom::Role::kProgressIndicator: - return optimization_guide::proto::AXRole::AX_ROLE_PROGRESSINDICATOR; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_PROGRESSINDICATOR; case ax::mojom::Role::kRadioButton: - return optimization_guide::proto::AXRole::AX_ROLE_RADIOBUTTON; + return optimization_guide::proto::features::AXRole::AX_ROLE_RADIOBUTTON; case ax::mojom::Role::kRadioGroup: - return optimization_guide::proto::AXRole::AX_ROLE_RADIOGROUP; + return optimization_guide::proto::features::AXRole::AX_ROLE_RADIOGROUP; case ax::mojom::Role::kRegion: - return optimization_guide::proto::AXRole::AX_ROLE_REGION; + return optimization_guide::proto::features::AXRole::AX_ROLE_REGION; case ax::mojom::Role::kRootWebArea: - return optimization_guide::proto::AXRole::AX_ROLE_ROOTWEBAREA; + return optimization_guide::proto::features::AXRole::AX_ROLE_ROOTWEBAREA; case ax::mojom::Role::kRow: - return optimization_guide::proto::AXRole::AX_ROLE_ROW; + return optimization_guide::proto::features::AXRole::AX_ROLE_ROW; case ax::mojom::Role::kRowGroup: - return optimization_guide::proto::AXRole::AX_ROLE_ROWGROUP; + return optimization_guide::proto::features::AXRole::AX_ROLE_ROWGROUP; case ax::mojom::Role::kRowHeader: - return optimization_guide::proto::AXRole::AX_ROLE_ROWHEADER; + return optimization_guide::proto::features::AXRole::AX_ROLE_ROWHEADER; case ax::mojom::Role::kRuby: - return optimization_guide::proto::AXRole::AX_ROLE_RUBY; + return optimization_guide::proto::features::AXRole::AX_ROLE_RUBY; case ax::mojom::Role::kRubyAnnotation: - return optimization_guide::proto::AXRole::AX_ROLE_RUBYANNOTATION; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_RUBYANNOTATION; case ax::mojom::Role::kScrollBar: - return optimization_guide::proto::AXRole::AX_ROLE_SCROLLBAR; + return optimization_guide::proto::features::AXRole::AX_ROLE_SCROLLBAR; case ax::mojom::Role::kScrollView: - return optimization_guide::proto::AXRole::AX_ROLE_SCROLLVIEW; + return optimization_guide::proto::features::AXRole::AX_ROLE_SCROLLVIEW; case ax::mojom::Role::kSearch: - return optimization_guide::proto::AXRole::AX_ROLE_SEARCH; + return optimization_guide::proto::features::AXRole::AX_ROLE_SEARCH; case ax::mojom::Role::kSearchBox: - return optimization_guide::proto::AXRole::AX_ROLE_SEARCHBOX; + return optimization_guide::proto::features::AXRole::AX_ROLE_SEARCHBOX; case ax::mojom::Role::kSection: - return optimization_guide::proto::AXRole::AX_ROLE_SECTION; + return optimization_guide::proto::features::AXRole::AX_ROLE_SECTION; case ax::mojom::Role::kSectionFooter: - return optimization_guide::proto::AXRole::AX_ROLE_SECTIONFOOTER; + return optimization_guide::proto::features::AXRole::AX_ROLE_SECTIONFOOTER; case ax::mojom::Role::kSectionHeader: - return optimization_guide::proto::AXRole::AX_ROLE_SECTIONHEADER; + return optimization_guide::proto::features::AXRole::AX_ROLE_SECTIONHEADER; case ax::mojom::Role::kSectionWithoutName: - return optimization_guide::proto::AXRole::AX_ROLE_SECTIONWITHOUTNAME; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_SECTIONWITHOUTNAME; case ax::mojom::Role::kSlider: - return optimization_guide::proto::AXRole::AX_ROLE_SLIDER; + return optimization_guide::proto::features::AXRole::AX_ROLE_SLIDER; case ax::mojom::Role::kSpinButton: - return optimization_guide::proto::AXRole::AX_ROLE_SPINBUTTON; + return optimization_guide::proto::features::AXRole::AX_ROLE_SPINBUTTON; case ax::mojom::Role::kSplitter: - return optimization_guide::proto::AXRole::AX_ROLE_SPLITTER; + return optimization_guide::proto::features::AXRole::AX_ROLE_SPLITTER; case ax::mojom::Role::kStaticText: - return optimization_guide::proto::AXRole::AX_ROLE_STATICTEXT; + return optimization_guide::proto::features::AXRole::AX_ROLE_STATICTEXT; case ax::mojom::Role::kStatus: - return optimization_guide::proto::AXRole::AX_ROLE_STATUS; + return optimization_guide::proto::features::AXRole::AX_ROLE_STATUS; case ax::mojom::Role::kStrong: - return optimization_guide::proto::AXRole::AX_ROLE_STRONG; + return optimization_guide::proto::features::AXRole::AX_ROLE_STRONG; case ax::mojom::Role::kSubscript: - return optimization_guide::proto::AXRole::AX_ROLE_SUBSCRIPT; + return optimization_guide::proto::features::AXRole::AX_ROLE_SUBSCRIPT; case ax::mojom::Role::kSuggestion: - return optimization_guide::proto::AXRole::AX_ROLE_SUGGESTION; + return optimization_guide::proto::features::AXRole::AX_ROLE_SUGGESTION; case ax::mojom::Role::kSuperscript: - return optimization_guide::proto::AXRole::AX_ROLE_SUPERSCRIPT; + return optimization_guide::proto::features::AXRole::AX_ROLE_SUPERSCRIPT; case ax::mojom::Role::kSvgRoot: - return optimization_guide::proto::AXRole::AX_ROLE_SVGROOT; + return optimization_guide::proto::features::AXRole::AX_ROLE_SVGROOT; case ax::mojom::Role::kSwitch: - return optimization_guide::proto::AXRole::AX_ROLE_SWITCH; + return optimization_guide::proto::features::AXRole::AX_ROLE_SWITCH; case ax::mojom::Role::kTab: - return optimization_guide::proto::AXRole::AX_ROLE_TAB; + return optimization_guide::proto::features::AXRole::AX_ROLE_TAB; case ax::mojom::Role::kTabList: - return optimization_guide::proto::AXRole::AX_ROLE_TABLIST; + return optimization_guide::proto::features::AXRole::AX_ROLE_TABLIST; case ax::mojom::Role::kTabPanel: - return optimization_guide::proto::AXRole::AX_ROLE_TABPANEL; + return optimization_guide::proto::features::AXRole::AX_ROLE_TABPANEL; case ax::mojom::Role::kTable: - return optimization_guide::proto::AXRole::AX_ROLE_TABLE; + return optimization_guide::proto::features::AXRole::AX_ROLE_TABLE; case ax::mojom::Role::kTableHeaderContainer: - return optimization_guide::proto::AXRole::AX_ROLE_TABLEHEADERCONTAINER; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_TABLEHEADERCONTAINER; case ax::mojom::Role::kTerm: - return optimization_guide::proto::AXRole::AX_ROLE_TERM; + return optimization_guide::proto::features::AXRole::AX_ROLE_TERM; case ax::mojom::Role::kTextField: - return optimization_guide::proto::AXRole::AX_ROLE_TEXTFIELD; + return optimization_guide::proto::features::AXRole::AX_ROLE_TEXTFIELD; case ax::mojom::Role::kTextFieldWithComboBox: - return optimization_guide::proto::AXRole::AX_ROLE_TEXTFIELDWITHCOMBOBOX; + return optimization_guide::proto::features::AXRole:: + AX_ROLE_TEXTFIELDWITHCOMBOBOX; case ax::mojom::Role::kTime: - return optimization_guide::proto::AXRole::AX_ROLE_TIME; + return optimization_guide::proto::features::AXRole::AX_ROLE_TIME; case ax::mojom::Role::kTimer: - return optimization_guide::proto::AXRole::AX_ROLE_TIMER; + return optimization_guide::proto::features::AXRole::AX_ROLE_TIMER; case ax::mojom::Role::kTitleBar: - return optimization_guide::proto::AXRole::AX_ROLE_TITLEBAR; + return optimization_guide::proto::features::AXRole::AX_ROLE_TITLEBAR; case ax::mojom::Role::kToggleButton: - return optimization_guide::proto::AXRole::AX_ROLE_TOGGLEBUTTON; + return optimization_guide::proto::features::AXRole::AX_ROLE_TOGGLEBUTTON; case ax::mojom::Role::kToolbar: - return optimization_guide::proto::AXRole::AX_ROLE_TOOLBAR; + return optimization_guide::proto::features::AXRole::AX_ROLE_TOOLBAR; case ax::mojom::Role::kTooltip: - return optimization_guide::proto::AXRole::AX_ROLE_TOOLTIP; + return optimization_guide::proto::features::AXRole::AX_ROLE_TOOLTIP; case ax::mojom::Role::kTree: - return optimization_guide::proto::AXRole::AX_ROLE_TREE; + return optimization_guide::proto::features::AXRole::AX_ROLE_TREE; case ax::mojom::Role::kTreeGrid: - return optimization_guide::proto::AXRole::AX_ROLE_TREEGRID; + return optimization_guide::proto::features::AXRole::AX_ROLE_TREEGRID; case ax::mojom::Role::kTreeItem: - return optimization_guide::proto::AXRole::AX_ROLE_TREEITEM; + return optimization_guide::proto::features::AXRole::AX_ROLE_TREEITEM; case ax::mojom::Role::kVideo: - return optimization_guide::proto::AXRole::AX_ROLE_VIDEO; + return optimization_guide::proto::features::AXRole::AX_ROLE_VIDEO; case ax::mojom::Role::kWebView: - return optimization_guide::proto::AXRole::AX_ROLE_WEBVIEW; + return optimization_guide::proto::features::AXRole::AX_ROLE_WEBVIEW; case ax::mojom::Role::kWindow: - return optimization_guide::proto::AXRole::AX_ROLE_WINDOW; + return optimization_guide::proto::features::AXRole::AX_ROLE_WINDOW; } } -optimization_guide::proto::AXStringAttribute StringAttributeToProto( +optimization_guide::proto::features::AXStringAttribute StringAttributeToProto( ax::mojom::StringAttribute attribute) { switch (attribute) { case ax::mojom::StringAttribute::kNone: - return optimization_guide::proto::AXStringAttribute::AX_SA_NONE; + return optimization_guide::proto::features::AXStringAttribute::AX_SA_NONE; case ax::mojom::StringAttribute::kAccessKey: - return optimization_guide::proto::AXStringAttribute::AX_SA_ACCESSKEY; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_ACCESSKEY; case ax::mojom::StringAttribute::kAppId: - return optimization_guide::proto::AXStringAttribute::AX_SA_APPID; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_APPID; case ax::mojom::StringAttribute::kAriaInvalidValueDeprecated: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_ARIAINVALIDVALUEDEPRECATED; case ax::mojom::StringAttribute::kAutoComplete: - return optimization_guide::proto::AXStringAttribute::AX_SA_AUTOCOMPLETE; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_AUTOCOMPLETE; case ax::mojom::StringAttribute::kAriaBrailleLabel: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_ARIABRAILLELABEL; case ax::mojom::StringAttribute::kAriaBrailleRoleDescription: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_ARIABRAILLEROLEDESCRIPTION; case ax::mojom::StringAttribute::kAriaCellColumnIndexText: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_ARIACELLCOLUMNINDEXTEXT; case ax::mojom::StringAttribute::kAriaCellRowIndexText: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_ARIACELLROWINDEXTEXT; case ax::mojom::StringAttribute::kAriaNotificationAnnouncementDeprecated: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_ARIANOTIFICATIONANNOUNCEMENTDEPRECATED; case ax::mojom::StringAttribute::kAriaNotificationIdDeprecated: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_ARIANOTIFICATIONIDDEPRECATED; case ax::mojom::StringAttribute::kCheckedStateDescription: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_CHECKEDSTATEDESCRIPTION; case ax::mojom::StringAttribute::kChildTreeId: - return optimization_guide::proto::AXStringAttribute::AX_SA_CHILDTREEID; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_CHILDTREEID; case ax::mojom::StringAttribute::kChildTreeNodeAppId: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_CHILDTREENODEAPPID; case ax::mojom::StringAttribute::kClassName: - return optimization_guide::proto::AXStringAttribute::AX_SA_CLASSNAME; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_CLASSNAME; case ax::mojom::StringAttribute::kContainerLiveRelevant: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_CONTAINERLIVERELEVANT; case ax::mojom::StringAttribute::kContainerLiveStatus: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_CONTAINERLIVESTATUS; case ax::mojom::StringAttribute::kDateTime: - return optimization_guide::proto::AXStringAttribute::AX_SA_DATETIME; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_DATETIME; case ax::mojom::StringAttribute::kDescription: - return optimization_guide::proto::AXStringAttribute::AX_SA_DESCRIPTION; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_DESCRIPTION; case ax::mojom::StringAttribute::kDisplay: - return optimization_guide::proto::AXStringAttribute::AX_SA_DISPLAY; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_DISPLAY; case ax::mojom::StringAttribute::kDoDefaultLabel: - return optimization_guide::proto::AXStringAttribute::AX_SA_DODEFAULTLABEL; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_DODEFAULTLABEL; case ax::mojom::StringAttribute::kFontFamily: - return optimization_guide::proto::AXStringAttribute::AX_SA_FONTFAMILY; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_FONTFAMILY; case ax::mojom::StringAttribute::kHtmlId: - return optimization_guide::proto::AXStringAttribute::AX_SA_HTMLID; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_HTMLID; case ax::mojom::StringAttribute::kHtmlInputName: - return optimization_guide::proto::AXStringAttribute::AX_SA_HTMLINPUTNAME; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_HTMLINPUTNAME; case ax::mojom::StringAttribute::kHtmlTag: - return optimization_guide::proto::AXStringAttribute::AX_SA_HTMLTAG; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_HTMLTAG; case ax::mojom::StringAttribute::kImageAnnotation: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_IMAGEANNOTATION; case ax::mojom::StringAttribute::kImageDataUrl: - return optimization_guide::proto::AXStringAttribute::AX_SA_IMAGEDATAURL; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_IMAGEDATAURL; case ax::mojom::StringAttribute::kMathContent: - return optimization_guide::proto::AXStringAttribute::AX_SA_MATHCONTENT; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_MATHCONTENT; case ax::mojom::StringAttribute::kInputType: - return optimization_guide::proto::AXStringAttribute::AX_SA_INPUTTYPE; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_INPUTTYPE; case ax::mojom::StringAttribute::kKeyShortcuts: - return optimization_guide::proto::AXStringAttribute::AX_SA_KEYSHORTCUTS; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_KEYSHORTCUTS; case ax::mojom::StringAttribute::kLanguage: - return optimization_guide::proto::AXStringAttribute::AX_SA_LANGUAGE; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_LANGUAGE; case ax::mojom::StringAttribute::kLinkTarget: - return optimization_guide::proto::AXStringAttribute::AX_SA_LINKTARGET; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_LINKTARGET; case ax::mojom::StringAttribute::kLongClickLabel: - return optimization_guide::proto::AXStringAttribute::AX_SA_LONGCLICKLABEL; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_LONGCLICKLABEL; case ax::mojom::StringAttribute::kName: - return optimization_guide::proto::AXStringAttribute::AX_SA_NAME; + return optimization_guide::proto::features::AXStringAttribute::AX_SA_NAME; case ax::mojom::StringAttribute::kLiveRelevant: - return optimization_guide::proto::AXStringAttribute::AX_SA_LIVERELEVANT; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_LIVERELEVANT; case ax::mojom::StringAttribute::kLiveStatus: - return optimization_guide::proto::AXStringAttribute::AX_SA_LIVESTATUS; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_LIVESTATUS; case ax::mojom::StringAttribute::kPlaceholder: - return optimization_guide::proto::AXStringAttribute::AX_SA_PLACEHOLDER; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_PLACEHOLDER; case ax::mojom::StringAttribute::kRole: - return optimization_guide::proto::AXStringAttribute::AX_SA_ROLE; + return optimization_guide::proto::features::AXStringAttribute::AX_SA_ROLE; case ax::mojom::StringAttribute::kRoleDescription: - return optimization_guide::proto::AXStringAttribute:: + return optimization_guide::proto::features::AXStringAttribute:: AX_SA_ROLEDESCRIPTION; case ax::mojom::StringAttribute::kTooltip: - return optimization_guide::proto::AXStringAttribute::AX_SA_TOOLTIP; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_TOOLTIP; case ax::mojom::StringAttribute::kUrl: - return optimization_guide::proto::AXStringAttribute::AX_SA_URL; + return optimization_guide::proto::features::AXStringAttribute::AX_SA_URL; case ax::mojom::StringAttribute::kValue: - return optimization_guide::proto::AXStringAttribute::AX_SA_VALUE; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_VALUE; case ax::mojom::StringAttribute::kVirtualContent: - return optimization_guide::proto::AXStringAttribute::AX_SA_VIRTUALCONTENT; + return optimization_guide::proto::features::AXStringAttribute:: + AX_SA_VIRTUALCONTENT; } } -optimization_guide::proto::AXIntAttribute IntAttributeToProto( +optimization_guide::proto::features::AXIntAttribute IntAttributeToProto( ax::mojom::IntAttribute attribute) { switch (attribute) { case ax::mojom::IntAttribute::kNone: - return optimization_guide::proto::AXIntAttribute::AX_IA_NONE; + return optimization_guide::proto::features::AXIntAttribute::AX_IA_NONE; case ax::mojom::IntAttribute::kDefaultActionVerb: - return optimization_guide::proto::AXIntAttribute::AX_IA_DEFAULTACTIONVERB; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_DEFAULTACTIONVERB; case ax::mojom::IntAttribute::kScrollX: - return optimization_guide::proto::AXIntAttribute::AX_IA_SCROLLX; + return optimization_guide::proto::features::AXIntAttribute::AX_IA_SCROLLX; case ax::mojom::IntAttribute::kScrollXMin: - return optimization_guide::proto::AXIntAttribute::AX_IA_SCROLLXMIN; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_SCROLLXMIN; case ax::mojom::IntAttribute::kScrollXMax: - return optimization_guide::proto::AXIntAttribute::AX_IA_SCROLLXMAX; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_SCROLLXMAX; case ax::mojom::IntAttribute::kScrollY: - return optimization_guide::proto::AXIntAttribute::AX_IA_SCROLLY; + return optimization_guide::proto::features::AXIntAttribute::AX_IA_SCROLLY; case ax::mojom::IntAttribute::kScrollYMin: - return optimization_guide::proto::AXIntAttribute::AX_IA_SCROLLYMIN; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_SCROLLYMIN; case ax::mojom::IntAttribute::kScrollYMax: - return optimization_guide::proto::AXIntAttribute::AX_IA_SCROLLYMAX; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_SCROLLYMAX; case ax::mojom::IntAttribute::kTextSelStart: - return optimization_guide::proto::AXIntAttribute::AX_IA_TEXTSELSTART; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TEXTSELSTART; case ax::mojom::IntAttribute::kTextSelEnd: - return optimization_guide::proto::AXIntAttribute::AX_IA_TEXTSELEND; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TEXTSELEND; case ax::mojom::IntAttribute::kAriaColumnCount: - return optimization_guide::proto::AXIntAttribute::AX_IA_ARIACOLUMNCOUNT; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_ARIACOLUMNCOUNT; case ax::mojom::IntAttribute::kAriaCellColumnIndex: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_ARIACELLCOLUMNINDEX; case ax::mojom::IntAttribute::kAriaCellColumnSpan: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_ARIACELLCOLUMNSPAN; case ax::mojom::IntAttribute::kAriaRowCount: - return optimization_guide::proto::AXIntAttribute::AX_IA_ARIAROWCOUNT; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_ARIAROWCOUNT; case ax::mojom::IntAttribute::kAriaCellRowIndex: - return optimization_guide::proto::AXIntAttribute::AX_IA_ARIACELLROWINDEX; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_ARIACELLROWINDEX; case ax::mojom::IntAttribute::kAriaCellRowSpan: - return optimization_guide::proto::AXIntAttribute::AX_IA_ARIACELLROWSPAN; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_ARIACELLROWSPAN; case ax::mojom::IntAttribute::kTableRowCount: - return optimization_guide::proto::AXIntAttribute::AX_IA_TABLEROWCOUNT; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TABLEROWCOUNT; case ax::mojom::IntAttribute::kTableColumnCount: - return optimization_guide::proto::AXIntAttribute::AX_IA_TABLECOLUMNCOUNT; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TABLECOLUMNCOUNT; case ax::mojom::IntAttribute::kTableHeaderId: - return optimization_guide::proto::AXIntAttribute::AX_IA_TABLEHEADERID; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TABLEHEADERID; case ax::mojom::IntAttribute::kTableRowIndex: - return optimization_guide::proto::AXIntAttribute::AX_IA_TABLEROWINDEX; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TABLEROWINDEX; case ax::mojom::IntAttribute::kTableRowHeaderId: - return optimization_guide::proto::AXIntAttribute::AX_IA_TABLEROWHEADERID; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TABLEROWHEADERID; case ax::mojom::IntAttribute::kTableColumnIndex: - return optimization_guide::proto::AXIntAttribute::AX_IA_TABLECOLUMNINDEX; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TABLECOLUMNINDEX; case ax::mojom::IntAttribute::kTableColumnHeaderId: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_TABLECOLUMNHEADERID; case ax::mojom::IntAttribute::kTableCellColumnIndex: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_TABLECELLCOLUMNINDEX; case ax::mojom::IntAttribute::kTableCellColumnSpan: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_TABLECELLCOLUMNSPAN; case ax::mojom::IntAttribute::kTableCellRowIndex: - return optimization_guide::proto::AXIntAttribute::AX_IA_TABLECELLROWINDEX; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TABLECELLROWINDEX; case ax::mojom::IntAttribute::kTableCellRowSpan: - return optimization_guide::proto::AXIntAttribute::AX_IA_TABLECELLROWSPAN; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TABLECELLROWSPAN; case ax::mojom::IntAttribute::kSortDirection: - return optimization_guide::proto::AXIntAttribute::AX_IA_SORTDIRECTION; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_SORTDIRECTION; case ax::mojom::IntAttribute::kHierarchicalLevel: - return optimization_guide::proto::AXIntAttribute::AX_IA_HIERARCHICALLEVEL; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_HIERARCHICALLEVEL; case ax::mojom::IntAttribute::kNameFrom: - return optimization_guide::proto::AXIntAttribute::AX_IA_NAMEFROM; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_NAMEFROM; case ax::mojom::IntAttribute::kDescriptionFrom: - return optimization_guide::proto::AXIntAttribute::AX_IA_DESCRIPTIONFROM; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_DESCRIPTIONFROM; case ax::mojom::IntAttribute::kDetailsFrom: - return optimization_guide::proto::AXIntAttribute::AX_IA_DETAILSFROM; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_DETAILSFROM; case ax::mojom::IntAttribute::kActivedescendantId: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_ACTIVEDESCENDANTID; case ax::mojom::IntAttribute::kErrormessageIdDeprecated: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_ERRORMESSAGEIDDEPRECATED; case ax::mojom::IntAttribute::kInPageLinkTargetId: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_INPAGELINKTARGETID; case ax::mojom::IntAttribute::kMemberOfId: - return optimization_guide::proto::AXIntAttribute::AX_IA_MEMBEROFID; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_MEMBEROFID; case ax::mojom::IntAttribute::kNextOnLineId: - return optimization_guide::proto::AXIntAttribute::AX_IA_NEXTONLINEID; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_NEXTONLINEID; case ax::mojom::IntAttribute::kPopupForId: - return optimization_guide::proto::AXIntAttribute::AX_IA_POPUPFORID; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_POPUPFORID; case ax::mojom::IntAttribute::kPreviousOnLineId: - return optimization_guide::proto::AXIntAttribute::AX_IA_PREVIOUSONLINEID; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_PREVIOUSONLINEID; case ax::mojom::IntAttribute::kRestriction: - return optimization_guide::proto::AXIntAttribute::AX_IA_RESTRICTION; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_RESTRICTION; case ax::mojom::IntAttribute::kSetSize: - return optimization_guide::proto::AXIntAttribute::AX_IA_SETSIZE; + return optimization_guide::proto::features::AXIntAttribute::AX_IA_SETSIZE; case ax::mojom::IntAttribute::kPosInSet: - return optimization_guide::proto::AXIntAttribute::AX_IA_POSINSET; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_POSINSET; case ax::mojom::IntAttribute::kColorValue: - return optimization_guide::proto::AXIntAttribute::AX_IA_COLORVALUE; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_COLORVALUE; case ax::mojom::IntAttribute::kAriaCurrentState: - return optimization_guide::proto::AXIntAttribute::AX_IA_ARIACURRENTSTATE; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_ARIACURRENTSTATE; case ax::mojom::IntAttribute::kBackgroundColor: - return optimization_guide::proto::AXIntAttribute::AX_IA_BACKGROUNDCOLOR; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_BACKGROUNDCOLOR; case ax::mojom::IntAttribute::kColor: - return optimization_guide::proto::AXIntAttribute::AX_IA_COLOR; + return optimization_guide::proto::features::AXIntAttribute::AX_IA_COLOR; case ax::mojom::IntAttribute::kHasPopup: - return optimization_guide::proto::AXIntAttribute::AX_IA_HASPOPUP; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_HASPOPUP; case ax::mojom::IntAttribute::kImageAnnotationStatus: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_IMAGEANNOTATIONSTATUS; case ax::mojom::IntAttribute::kInvalidState: - return optimization_guide::proto::AXIntAttribute::AX_IA_INVALIDSTATE; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_INVALIDSTATE; case ax::mojom::IntAttribute::kCheckedState: - return optimization_guide::proto::AXIntAttribute::AX_IA_CHECKEDSTATE; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_CHECKEDSTATE; case ax::mojom::IntAttribute::kListStyle: - return optimization_guide::proto::AXIntAttribute::AX_IA_LISTSTYLE; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_LISTSTYLE; case ax::mojom::IntAttribute::kTextAlign: - return optimization_guide::proto::AXIntAttribute::AX_IA_TEXTALIGN; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TEXTALIGN; case ax::mojom::IntAttribute::kTextDirection: - return optimization_guide::proto::AXIntAttribute::AX_IA_TEXTDIRECTION; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TEXTDIRECTION; case ax::mojom::IntAttribute::kTextPosition: - return optimization_guide::proto::AXIntAttribute::AX_IA_TEXTPOSITION; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TEXTPOSITION; case ax::mojom::IntAttribute::kTextStyle: - return optimization_guide::proto::AXIntAttribute::AX_IA_TEXTSTYLE; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TEXTSTYLE; case ax::mojom::IntAttribute::kTextOverlineStyle: - return optimization_guide::proto::AXIntAttribute::AX_IA_TEXTOVERLINESTYLE; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_TEXTOVERLINESTYLE; case ax::mojom::IntAttribute::kTextStrikethroughStyle: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_TEXTSTRIKETHROUGHSTYLE; case ax::mojom::IntAttribute::kTextUnderlineStyle: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_TEXTUNDERLINESTYLE; case ax::mojom::IntAttribute::kPreviousFocusId: - return optimization_guide::proto::AXIntAttribute::AX_IA_PREVIOUSFOCUSID; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_PREVIOUSFOCUSID; case ax::mojom::IntAttribute::kNextFocusId: - return optimization_guide::proto::AXIntAttribute::AX_IA_NEXTFOCUSID; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_NEXTFOCUSID; case ax::mojom::IntAttribute::kDropeffectDeprecated: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_DROPEFFECTDEPRECATED; case ax::mojom::IntAttribute::kDOMNodeIdDeprecated: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_DOMNODEIDDEPRECATED; case ax::mojom::IntAttribute::kIsPopup: - return optimization_guide::proto::AXIntAttribute::AX_IA_ISPOPUP; + return optimization_guide::proto::features::AXIntAttribute::AX_IA_ISPOPUP; case ax::mojom::IntAttribute::kNextWindowFocusId: - return optimization_guide::proto::AXIntAttribute::AX_IA_NEXTWINDOWFOCUSID; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_NEXTWINDOWFOCUSID; case ax::mojom::IntAttribute::kPreviousWindowFocusId: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_PREVIOUSWINDOWFOCUSID; case ax::mojom::IntAttribute::kAriaNotificationInterruptDeprecated: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_ARIANOTIFICATIONINTERRUPTDEPRECATED; case ax::mojom::IntAttribute::kAriaNotificationPriorityDeprecated: - return optimization_guide::proto::AXIntAttribute:: + return optimization_guide::proto::features::AXIntAttribute:: AX_IA_ARIANOTIFICATIONPRIORITYDEPRECATED; case ax::mojom::IntAttribute::kMaxLength: - return optimization_guide::proto::AXIntAttribute::AX_IA_MAXLENGTH; + return optimization_guide::proto::features::AXIntAttribute:: + AX_IA_MAXLENGTH; } } -optimization_guide::proto::AXFloatAttribute FloatAttributeToProto( +optimization_guide::proto::features::AXFloatAttribute FloatAttributeToProto( ax::mojom::FloatAttribute attribute) { switch (attribute) { case ax::mojom::FloatAttribute::kNone: - return optimization_guide::proto::AXFloatAttribute::AX_FA_NONE; + return optimization_guide::proto::features::AXFloatAttribute::AX_FA_NONE; case ax::mojom::FloatAttribute::kValueForRange: - return optimization_guide::proto::AXFloatAttribute::AX_FA_VALUEFORRANGE; + return optimization_guide::proto::features::AXFloatAttribute:: + AX_FA_VALUEFORRANGE; case ax::mojom::FloatAttribute::kMinValueForRange: - return optimization_guide::proto::AXFloatAttribute:: + return optimization_guide::proto::features::AXFloatAttribute:: AX_FA_MINVALUEFORRANGE; case ax::mojom::FloatAttribute::kMaxValueForRange: - return optimization_guide::proto::AXFloatAttribute:: + return optimization_guide::proto::features::AXFloatAttribute:: AX_FA_MAXVALUEFORRANGE; case ax::mojom::FloatAttribute::kStepValueForRange: - return optimization_guide::proto::AXFloatAttribute:: + return optimization_guide::proto::features::AXFloatAttribute:: AX_FA_STEPVALUEFORRANGE; case ax::mojom::FloatAttribute::kFontSize: - return optimization_guide::proto::AXFloatAttribute::AX_FA_FONTSIZE; + return optimization_guide::proto::features::AXFloatAttribute:: + AX_FA_FONTSIZE; case ax::mojom::FloatAttribute::kFontWeight: - return optimization_guide::proto::AXFloatAttribute::AX_FA_FONTWEIGHT; + return optimization_guide::proto::features::AXFloatAttribute:: + AX_FA_FONTWEIGHT; case ax::mojom::FloatAttribute::kTextIndent: - return optimization_guide::proto::AXFloatAttribute::AX_FA_TEXTINDENT; + return optimization_guide::proto::features::AXFloatAttribute:: + AX_FA_TEXTINDENT; case ax::mojom::FloatAttribute::kChildTreeScale: - return optimization_guide::proto::AXFloatAttribute::AX_FA_CHILDTREESCALE; + return optimization_guide::proto::features::AXFloatAttribute:: + AX_FA_CHILDTREESCALE; } } -optimization_guide::proto::AXBoolAttribute BoolAttributeToProto( +optimization_guide::proto::features::AXBoolAttribute BoolAttributeToProto( ax::mojom::BoolAttribute attribute) { switch (attribute) { case ax::mojom::BoolAttribute::kNone: - return optimization_guide::proto::AXBoolAttribute::AX_BA_NONE; + return optimization_guide::proto::features::AXBoolAttribute::AX_BA_NONE; case ax::mojom::BoolAttribute::kBusy: - return optimization_guide::proto::AXBoolAttribute::AX_BA_BUSY; + return optimization_guide::proto::features::AXBoolAttribute::AX_BA_BUSY; case ax::mojom::BoolAttribute::kNonAtomicTextFieldRoot: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_NONATOMICTEXTFIELDROOT; case ax::mojom::BoolAttribute::kContainerLiveAtomic: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_CONTAINERLIVEATOMIC; case ax::mojom::BoolAttribute::kContainerLiveBusy: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_CONTAINERLIVEBUSY; case ax::mojom::BoolAttribute::kLiveAtomic: - return optimization_guide::proto::AXBoolAttribute::AX_BA_LIVEATOMIC; + return optimization_guide::proto::features::AXBoolAttribute:: + AX_BA_LIVEATOMIC; case ax::mojom::BoolAttribute::kModal: - return optimization_guide::proto::AXBoolAttribute::AX_BA_MODAL; + return optimization_guide::proto::features::AXBoolAttribute::AX_BA_MODAL; case ax::mojom::BoolAttribute::kUpdateLocationOnly: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_UPDATELOCATIONONLY; case ax::mojom::BoolAttribute::kCanvasHasFallback: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_CANVASHASFALLBACK; case ax::mojom::BoolAttribute::kScrollable: - return optimization_guide::proto::AXBoolAttribute::AX_BA_SCROLLABLE; + return optimization_guide::proto::features::AXBoolAttribute:: + AX_BA_SCROLLABLE; case ax::mojom::BoolAttribute::kClickable: - return optimization_guide::proto::AXBoolAttribute::AX_BA_CLICKABLE; + return optimization_guide::proto::features::AXBoolAttribute:: + AX_BA_CLICKABLE; case ax::mojom::BoolAttribute::kClipsChildren: - return optimization_guide::proto::AXBoolAttribute::AX_BA_CLIPSCHILDREN; + return optimization_guide::proto::features::AXBoolAttribute:: + AX_BA_CLIPSCHILDREN; case ax::mojom::BoolAttribute::kNotUserSelectableStyle: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_NOTUSERSELECTABLESTYLE; case ax::mojom::BoolAttribute::kSelected: - return optimization_guide::proto::AXBoolAttribute::AX_BA_SELECTED; + return optimization_guide::proto::features::AXBoolAttribute:: + AX_BA_SELECTED; case ax::mojom::BoolAttribute::kSelectedFromFocus: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_SELECTEDFROMFOCUS; case ax::mojom::BoolAttribute::kSupportsTextLocation: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_SUPPORTSTEXTLOCATION; case ax::mojom::BoolAttribute::kGrabbedDeprecated: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_GRABBEDDEPRECATED; case ax::mojom::BoolAttribute::kIsLineBreakingObject: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_ISLINEBREAKINGOBJECT; case ax::mojom::BoolAttribute::kIsPageBreakingObject: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_ISPAGEBREAKINGOBJECT; case ax::mojom::BoolAttribute::kHasAriaAttribute: - return optimization_guide::proto::AXBoolAttribute::AX_BA_HASARIAATTRIBUTE; + return optimization_guide::proto::features::AXBoolAttribute:: + AX_BA_HASARIAATTRIBUTE; case ax::mojom::BoolAttribute::kTouchPassthroughDeprecated: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_TOUCHPASSTHROUGHDEPRECATED; case ax::mojom::BoolAttribute::kLongClickable: - return optimization_guide::proto::AXBoolAttribute::AX_BA_LONGCLICKABLE; + return optimization_guide::proto::features::AXBoolAttribute:: + AX_BA_LONGCLICKABLE; case ax::mojom::BoolAttribute::kHasHiddenOffscreenNodes: - return optimization_guide::proto::AXBoolAttribute:: + return optimization_guide::proto::features::AXBoolAttribute:: AX_BA_HASHIDDENOFFSCREENNODES; } } -optimization_guide::proto::AXIntListAttribute IntListAttributeToProto( +optimization_guide::proto::features::AXIntListAttribute IntListAttributeToProto( ax::mojom::IntListAttribute attribute) { switch (attribute) { case ax::mojom::IntListAttribute::kNone: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_NONE; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_NONE; case ax::mojom::IntListAttribute::kIndirectChildIds: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_INDIRECTCHILDIDS; case ax::mojom::IntListAttribute::kActionsIds: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_ACTIONSIDS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_ACTIONSIDS; case ax::mojom::IntListAttribute::kControlsIds: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_CONTROLSIDS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_CONTROLSIDS; case ax::mojom::IntListAttribute::kDetailsIds: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_DETAILSIDS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_DETAILSIDS; case ax::mojom::IntListAttribute::kDescribedbyIds: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_DESCRIBEDBYIDS; case ax::mojom::IntListAttribute::kErrormessageIds: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_ERRORMESSAGEIDS; case ax::mojom::IntListAttribute::kFlowtoIds: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_FLOWTOIDS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_FLOWTOIDS; case ax::mojom::IntListAttribute::kLabelledbyIds: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_LABELLEDBYIDS; case ax::mojom::IntListAttribute::kRadioGroupIds: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_RADIOGROUPIDS; case ax::mojom::IntListAttribute::kMarkerTypes: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_MARKERTYPES; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_MARKERTYPES; case ax::mojom::IntListAttribute::kMarkerStarts: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_MARKERSTARTS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_MARKERSTARTS; case ax::mojom::IntListAttribute::kMarkerEnds: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_MARKERENDS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_MARKERENDS; case ax::mojom::IntListAttribute::kHighlightTypes: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_HIGHLIGHTTYPES; case ax::mojom::IntListAttribute::kCaretBounds: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_CARETBOUNDS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_CARETBOUNDS; case ax::mojom::IntListAttribute::kCharacterOffsets: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_CHARACTEROFFSETS; case ax::mojom::IntListAttribute::kLineStarts: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_LINESTARTS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_LINESTARTS; case ax::mojom::IntListAttribute::kLineEnds: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_LINEENDS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_LINEENDS; case ax::mojom::IntListAttribute::kSentenceStarts: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_SENTENCESTARTS; case ax::mojom::IntListAttribute::kSentenceEnds: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_SENTENCEENDS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_SENTENCEENDS; case ax::mojom::IntListAttribute::kWordStarts: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_WORDSTARTS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_WORDSTARTS; case ax::mojom::IntListAttribute::kWordEnds: - return optimization_guide::proto::AXIntListAttribute::AX_ILA_WORDENDS; + return optimization_guide::proto::features::AXIntListAttribute:: + AX_ILA_WORDENDS; case ax::mojom::IntListAttribute::kCustomActionIds: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_CUSTOMACTIONIDS; case ax::mojom::IntListAttribute::kTextOperationStartAnchorIds: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_TEXTOPERATIONSTARTANCHORIDS; case ax::mojom::IntListAttribute::kTextOperationStartOffsets: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_TEXTOPERATIONSTARTOFFSETS; case ax::mojom::IntListAttribute::kTextOperationEndAnchorIds: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_TEXTOPERATIONENDANCHORIDS; case ax::mojom::IntListAttribute::kTextOperationEndOffsets: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_TEXTOPERATIONENDOFFSETS; case ax::mojom::IntListAttribute::kTextOperations: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_TEXTOPERATIONS; case ax::mojom::IntListAttribute::kAriaNotificationInterruptProperties: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_ARIANOTIFICATIONINTERRUPTPROPERTIES; case ax::mojom::IntListAttribute::kAriaNotificationPriorityProperties: - return optimization_guide::proto::AXIntListAttribute:: + return optimization_guide::proto::features::AXIntListAttribute:: AX_ILA_ARIANOTIFICATIONPRIORITYPROPERTIES; } } -optimization_guide::proto::AXStringListAttribute StringListAttributeToProto( - ax::mojom::StringListAttribute attribute) { +optimization_guide::proto::features::AXStringListAttribute +StringListAttributeToProto(ax::mojom::StringListAttribute attribute) { switch (attribute) { case ax::mojom::StringListAttribute::kNone: - return optimization_guide::proto::AXStringListAttribute::AX_SLA_NONE; + return optimization_guide::proto::features::AXStringListAttribute:: + AX_SLA_NONE; case ax::mojom::StringListAttribute::kAriaNotificationAnnouncements: - return optimization_guide::proto::AXStringListAttribute:: + return optimization_guide::proto::features::AXStringListAttribute:: AX_SLA_ARIANOTIFICATIONANNOUNCEMENTS; case ax::mojom::StringListAttribute::kAriaNotificationIds: - return optimization_guide::proto::AXStringListAttribute:: + return optimization_guide::proto::features::AXStringListAttribute:: AX_SLA_ARIANOTIFICATIONIDS; case ax::mojom::StringListAttribute::kCustomActionDescriptions: - return optimization_guide::proto::AXStringListAttribute:: + return optimization_guide::proto::features::AXStringListAttribute:: AX_SLA_CUSTOMACTIONDESCRIPTIONS; } } -void PopulateAXTreeData(const ui::AXTreeData& source, - optimization_guide::proto::AXTreeData* destination) { +void PopulateAXTreeData( + const ui::AXTreeData& source, + optimization_guide::proto::features::AXTreeData* destination) { destination->set_doctype(source.doctype); destination->set_loaded(source.loaded); destination->set_loading_progress(source.loading_progress); @@ -945,7 +1085,7 @@ void PopulateAXRelativeBounds( const ui::AXRelativeBounds& source, - optimization_guide::proto::AXRelativeBounds* destination) { + optimization_guide::proto::features::AXRelativeBounds* destination) { destination->set_offset_container_id(source.offset_container_id); destination->set_x(source.bounds.x()); destination->set_y(source.bounds.y()); @@ -960,8 +1100,9 @@ } } -void PopulateAXNode(const ui::AXNodeData& source, - optimization_guide::proto::AXNodeData* destination) { +void PopulateAXNode( + const ui::AXNodeData& source, + optimization_guide::proto::features::AXNodeData* destination) { destination->set_id(source.id); destination->set_role(RoleToProto(source.role)); destination->set_state(source.state); @@ -1039,7 +1180,7 @@ void PopulateAXTreeUpdateProto( const ui::AXTreeUpdate& source, - optimization_guide::proto::AXTreeUpdate* destination) { + optimization_guide::proto::features::AXTreeUpdate* destination) { destination->set_root_id(source.root_id); if (source.has_tree_data) { PopulateAXTreeData(source.tree_data, destination->mutable_tree_data());
diff --git a/components/optimization_guide/core/optimization_guide_proto_util.h b/components/optimization_guide/core/optimization_guide_proto_util.h index 991d96e..5079658a 100644 --- a/components/optimization_guide/core/optimization_guide_proto_util.h +++ b/components/optimization_guide/core/optimization_guide_proto_util.h
@@ -9,7 +9,9 @@ namespace optimization_guide::proto { class Any; +namespace features { class AXTreeUpdate; +} // namespace features } // namespace optimization_guide::proto namespace ui { @@ -24,7 +26,7 @@ // Populate the AXTreeUpdate proto structure from the ui structure. void PopulateAXTreeUpdateProto( const ui::AXTreeUpdate& source, - optimization_guide::proto::AXTreeUpdate* destination); + optimization_guide::proto::features::AXTreeUpdate* destination); } // namespace optimization_guide
diff --git a/components/optimization_guide/proto/features/bling_prototyping.proto b/components/optimization_guide/proto/features/bling_prototyping.proto index 0a2e2b38..5ad9376 100644 --- a/components/optimization_guide/proto/features/bling_prototyping.proto +++ b/components/optimization_guide/proto/features/bling_prototyping.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; option optimize_for = LITE_RUNTIME; option java_package = "org.chromium.components.optimization_guide.features.proto";
diff --git a/components/optimization_guide/proto/features/common_quality_data.proto b/components/optimization_guide/proto/features/common_quality_data.proto index d87d85ab..5b929b5d 100644 --- a/components/optimization_guide/proto/features/common_quality_data.proto +++ b/components/optimization_guide/proto/features/common_quality_data.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; option java_outer_classname = "CommonFeatureDataProto";
diff --git a/components/optimization_guide/proto/features/compose.proto b/components/optimization_guide/proto/features/compose.proto index 7bf4649..bc7a014 100644 --- a/components/optimization_guide/proto/features/compose.proto +++ b/components/optimization_guide/proto/features/compose.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/features/common_quality_data.proto";
diff --git a/components/optimization_guide/proto/features/feature_proto_registry.proto b/components/optimization_guide/proto/features/feature_proto_registry.proto index 8f2b791a..8fcda1e 100644 --- a/components/optimization_guide/proto/features/feature_proto_registry.proto +++ b/components/optimization_guide/proto/features/feature_proto_registry.proto
@@ -29,18 +29,18 @@ // TODO(holte): Move this to summarize.proto message SummarizeLoggingData { optimization_guide.proto.SummarizeRequest request = 1; - optimization_guide.proto.ComposeResponse response = 2; + optimization_guide.proto.features.ComposeResponse response = 2; } // This message is never instantiated, it just enumerates the message types that // will be supported as requests/responses by on-device code. message OnDeviceFeatureProtoRegistry { - optimization_guide.proto.ComposeLoggingData a = 1; - optimization_guide.proto.HistoryAnswerLoggingData b = 2; - optimization_guide.proto.HistoryQueryIntentLoggingData c = 3; + optimization_guide.proto.features.ComposeLoggingData a = 1; + optimization_guide.proto.features.HistoryAnswerLoggingData b = 2; + optimization_guide.proto.features.HistoryQueryIntentLoggingData c = 3; optimization_guide.proto.PromptApiLoggingData d = 4; TestLoggingData e = 5; SummarizeLoggingData f = 6; - optimization_guide.proto.TabOrganizationLoggingData g = 7; - optimization_guide.proto.ScamDetectionLoggingData h = 8; + optimization_guide.proto.features.TabOrganizationLoggingData g = 7; + optimization_guide.proto.features.ScamDetectionLoggingData h = 8; }
diff --git a/components/optimization_guide/proto/features/forms_annotations.proto b/components/optimization_guide/proto/features/forms_annotations.proto index 9d85f82..66c84d5 100644 --- a/components/optimization_guide/proto/features/forms_annotations.proto +++ b/components/optimization_guide/proto/features/forms_annotations.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/features/common_quality_data.proto";
diff --git a/components/optimization_guide/proto/features/forms_predictions.proto b/components/optimization_guide/proto/features/forms_predictions.proto index f5b1271..659c184 100644 --- a/components/optimization_guide/proto/features/forms_predictions.proto +++ b/components/optimization_guide/proto/features/forms_predictions.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/features/common_quality_data.proto";
diff --git a/components/optimization_guide/proto/features/history_answer.proto b/components/optimization_guide/proto/features/history_answer.proto index 5faa583b..7e6fca9 100644 --- a/components/optimization_guide/proto/features/history_answer.proto +++ b/components/optimization_guide/proto/features/history_answer.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/model_quality_metadata.proto";
diff --git a/components/optimization_guide/proto/features/history_query.proto b/components/optimization_guide/proto/features/history_query.proto index bf0b1441..342c2cc 100644 --- a/components/optimization_guide/proto/features/history_query.proto +++ b/components/optimization_guide/proto/features/history_query.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/features/common_quality_data.proto";
diff --git a/components/optimization_guide/proto/features/history_query_intent.proto b/components/optimization_guide/proto/features/history_query_intent.proto index 15fd2b3d..22d4e39 100644 --- a/components/optimization_guide/proto/features/history_query_intent.proto +++ b/components/optimization_guide/proto/features/history_query_intent.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/model_quality_metadata.proto";
diff --git a/components/optimization_guide/proto/features/model_prototyping.proto b/components/optimization_guide/proto/features/model_prototyping.proto index 495d95b..b865bc9c 100644 --- a/components/optimization_guide/proto/features/model_prototyping.proto +++ b/components/optimization_guide/proto/features/model_prototyping.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/features/forms_predictions.proto";
diff --git a/components/optimization_guide/proto/features/password_change_submission.proto b/components/optimization_guide/proto/features/password_change_submission.proto index 0fc8b13..8e8d5a9 100644 --- a/components/optimization_guide/proto/features/password_change_submission.proto +++ b/components/optimization_guide/proto/features/password_change_submission.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/features/common_quality_data.proto";
diff --git a/components/optimization_guide/proto/features/product_specifications.proto b/components/optimization_guide/proto/features/product_specifications.proto index 288372d..ebc2db2 100644 --- a/components/optimization_guide/proto/features/product_specifications.proto +++ b/components/optimization_guide/proto/features/product_specifications.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/features/common_quality_data.proto";
diff --git a/components/optimization_guide/proto/features/scam_detection.proto b/components/optimization_guide/proto/features/scam_detection.proto index 7064d76..eaa50339 100644 --- a/components/optimization_guide/proto/features/scam_detection.proto +++ b/components/optimization_guide/proto/features/scam_detection.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/model_quality_metadata.proto";
diff --git a/components/optimization_guide/proto/features/tab_organization.proto b/components/optimization_guide/proto/features/tab_organization.proto index 26fa474..8e8242e 100644 --- a/components/optimization_guide/proto/features/tab_organization.proto +++ b/components/optimization_guide/proto/features/tab_organization.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/features/common_quality_data.proto";
diff --git a/components/optimization_guide/proto/features/wallpaper_search.proto b/components/optimization_guide/proto/features/wallpaper_search.proto index 8bff90a..d628bc02 100644 --- a/components/optimization_guide/proto/features/wallpaper_search.proto +++ b/components/optimization_guide/proto/features/wallpaper_search.proto
@@ -4,7 +4,7 @@ syntax = "proto3"; -package optimization_guide.proto; +package optimization_guide.proto.features; import "components/optimization_guide/proto/features/common_quality_data.proto";
diff --git a/components/optimization_guide/proto/model_quality_service.proto b/components/optimization_guide/proto/model_quality_service.proto index 1d73200..65729df 100644 --- a/components/optimization_guide/proto/model_quality_service.proto +++ b/components/optimization_guide/proto/model_quality_service.proto
@@ -37,29 +37,39 @@ oneof feature { // Add feature specific LoggingData here. - ComposeLoggingData compose = 3; + optimization_guide.proto.features.ComposeLoggingData compose = 3; - TabOrganizationLoggingData tab_organization = 4; + optimization_guide.proto.features.TabOrganizationLoggingData + tab_organization = 4; - WallpaperSearchLoggingData wallpaper_search = 5; + optimization_guide.proto.features.WallpaperSearchLoggingData + wallpaper_search = 5; - HistoryQueryLoggingData history_query = 7; + optimization_guide.proto.features.HistoryQueryLoggingData history_query = 7; - HistoryAnswerLoggingData history_answer = 8; + optimization_guide.proto.features.HistoryAnswerLoggingData history_answer = + 8; - HistoryQueryIntentLoggingData history_query_intent = 13; + optimization_guide.proto.features.HistoryQueryIntentLoggingData + history_query_intent = 13; - ProductSpecificationsLoggingData product_specifications = 9; + optimization_guide.proto.features.ProductSpecificationsLoggingData + product_specifications = 9; - FormsAnnotationsLoggingData forms_annotations = 10; + optimization_guide.proto.features.FormsAnnotationsLoggingData + forms_annotations = 10; - FormsPredictionsLoggingData forms_predictions = 11; + optimization_guide.proto.features.FormsPredictionsLoggingData + forms_predictions = 11; - ModelPrototypingLoggingData model_prototyping = 12; + optimization_guide.proto.features.ModelPrototypingLoggingData + model_prototyping = 12; - BlingPrototypingLoggingData bling_prototyping = 14; + optimization_guide.proto.features.BlingPrototypingLoggingData + bling_prototyping = 14; - PasswordChangeSubmissionLoggingData password_change_submission = 16; + optimization_guide.proto.features.PasswordChangeSubmissionLoggingData + password_change_submission = 16; DefaultLoggingData default = 1000; }
diff --git a/components/payments/content/BUILD.gn b/components/payments/content/BUILD.gn index ab1ead14..f4ed0f97 100644 --- a/components/payments/content/BUILD.gn +++ b/components/payments/content/BUILD.gn
@@ -123,7 +123,10 @@ "secure_payment_confirmation_no_creds_view_stub.cc", "secure_payment_confirmation_view_stub.cc", ] - deps += [ "//components/payments/content/android:browser_binding_jni" ] + deps += [ + "//components/payments/content/android:browser_binding_jni", + "//components/webauthn/android", + ] } else { sources += [ "content_payment_request_delegate.cc", @@ -241,6 +244,10 @@ "web_app_manifest_section_table_unittest.cc", ] + if (is_android) { + sources += [ "payment_credential_unittest.cc" ] + } + if (!is_android) { sources += [ "mock_content_payment_request_delegate.cc", @@ -269,6 +276,7 @@ "//components/autofill/core/browser", "//components/autofill/core/browser:test_support", "//components/os_crypt/async/browser:test_support", + "//components/payments/content/browser_binding:fake_browser_bound_key_store", "//components/payments/content/browser_binding:interface", "//components/payments/core", "//components/payments/core:error_strings",
diff --git a/components/payments/content/browser_binding/BUILD.gn b/components/payments/content/browser_binding/BUILD.gn index 67c2611..f8b084f 100644 --- a/components/payments/content/browser_binding/BUILD.gn +++ b/components/payments/content/browser_binding/BUILD.gn
@@ -30,3 +30,17 @@ ] } } + +source_set("fake_browser_bound_key_store") { + testonly = true + sources = [ + "fake_browser_bound_key.cc", + "fake_browser_bound_key.h", + "fake_browser_bound_key_store.cc", + "fake_browser_bound_key_store.h", + ] + deps = [ + ":interface", + "//base", + ] +}
diff --git a/components/payments/content/browser_binding/fake_browser_bound_key.cc b/components/payments/content/browser_binding/fake_browser_bound_key.cc new file mode 100644 index 0000000..8b9cad4 --- /dev/null +++ b/components/payments/content/browser_binding/fake_browser_bound_key.cc
@@ -0,0 +1,47 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/payments/content/browser_binding/fake_browser_bound_key.h" + +#include <cstdint> +#include <vector> + +namespace payments { + +FakeBrowserBoundKey::FakeBrowserBoundKey( + std::vector<uint8_t> public_key_as_cose_key, + std::vector<uint8_t> signature, + std::vector<uint8_t> expected_client_data) + : public_key_as_cose_key_(std::move(public_key_as_cose_key)), + signature_(std::move(signature)), + expected_client_data_(std::move(expected_client_data)) {} + +FakeBrowserBoundKey::FakeBrowserBoundKey(const FakeBrowserBoundKey& other) + : public_key_as_cose_key_(other.public_key_as_cose_key_), + signature_(other.signature_), + expected_client_data_(other.expected_client_data_) {} + +FakeBrowserBoundKey& FakeBrowserBoundKey::operator=( + const FakeBrowserBoundKey& other) { + public_key_as_cose_key_ = other.public_key_as_cose_key_; + signature_ = other.signature_; + expected_client_data_ = other.expected_client_data_; + return *this; +} + +FakeBrowserBoundKey::~FakeBrowserBoundKey() = default; + +std::vector<uint8_t> FakeBrowserBoundKey::Sign( + const std::vector<uint8_t>& client_data) { + if (client_data == expected_client_data_) { + return signature_; + } + return {}; +} + +std::vector<uint8_t> FakeBrowserBoundKey::GetPublicKeyAsCoseKey() { + return public_key_as_cose_key_; +} + +} // namespace payments
diff --git a/components/payments/content/browser_binding/fake_browser_bound_key.h b/components/payments/content/browser_binding/fake_browser_bound_key.h new file mode 100644 index 0000000..cd82092d --- /dev/null +++ b/components/payments/content/browser_binding/fake_browser_bound_key.h
@@ -0,0 +1,40 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_PAYMENTS_CONTENT_BROWSER_BINDING_FAKE_BROWSER_BOUND_KEY_H_ +#define COMPONENTS_PAYMENTS_CONTENT_BROWSER_BINDING_FAKE_BROWSER_BOUND_KEY_H_ + +#include <cstdint> +#include <vector> + +#include "components/payments/content/browser_binding/browser_bound_key.h" + +namespace payments { + +// A fake used in tests to provide instances of BrowserBoundKey. +class FakeBrowserBoundKey : public BrowserBoundKey { + public: + // Constructs a fake browser bound key that returns `public_key_as_cose_key`, + // and `signature` from the respective calls. `Sign()` will compare its input, + // against `expected_client_data`, returning an empty signature when these do + // not match. + FakeBrowserBoundKey(std::vector<uint8_t> public_key_as_cose_key, + std::vector<uint8_t> signature, + std::vector<uint8_t> expected_client_data); + FakeBrowserBoundKey(const FakeBrowserBoundKey& other); + FakeBrowserBoundKey& operator=(const FakeBrowserBoundKey& other); + ~FakeBrowserBoundKey() override; + + std::vector<uint8_t> Sign(const std::vector<uint8_t>& client_data) override; + std::vector<uint8_t> GetPublicKeyAsCoseKey() override; + + private: + std::vector<uint8_t> public_key_as_cose_key_; + std::vector<uint8_t> signature_; + std::vector<uint8_t> expected_client_data_; +}; + +} // namespace payments + +#endif // COMPONENTS_PAYMENTS_CONTENT_BROWSER_BINDING_FAKE_BROWSER_BOUND_KEY_H_
diff --git a/components/payments/content/browser_binding/fake_browser_bound_key_store.cc b/components/payments/content/browser_binding/fake_browser_bound_key_store.cc new file mode 100644 index 0000000..bb67cd9 --- /dev/null +++ b/components/payments/content/browser_binding/fake_browser_bound_key_store.cc
@@ -0,0 +1,35 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/payments/content/browser_binding/fake_browser_bound_key_store.h" + +#include "base/memory/weak_ptr.h" +#include "components/payments/content/browser_binding/browser_bound_key.h" + +namespace payments { + +FakeBrowserBoundKeyStore::FakeBrowserBoundKeyStore() = default; +FakeBrowserBoundKeyStore::~FakeBrowserBoundKeyStore() = default; + +std::unique_ptr<BrowserBoundKey> +FakeBrowserBoundKeyStore::GetOrCreateBrowserBoundKeyForCredentialId( + const std::vector<uint8_t>& credential_id) { + auto it = key_map_.find(credential_id); + if (it == key_map_.end()) { + return nullptr; + } + return std::unique_ptr<BrowserBoundKey>(new FakeBrowserBoundKey(it->second)); +} + +void FakeBrowserBoundKeyStore::PutFakeKey( + const std::vector<uint8_t>& credential_id, + FakeBrowserBoundKey bbk) { + key_map_.insert(std::make_pair(credential_id, std::move(bbk))); +} + +base::WeakPtr<FakeBrowserBoundKeyStore> FakeBrowserBoundKeyStore::GetWeakPtr() { + return weak_ptr_factory_.GetWeakPtr(); +} + +} // namespace payments
diff --git a/components/payments/content/browser_binding/fake_browser_bound_key_store.h b/components/payments/content/browser_binding/fake_browser_bound_key_store.h new file mode 100644 index 0000000..25012ff8 --- /dev/null +++ b/components/payments/content/browser_binding/fake_browser_bound_key_store.h
@@ -0,0 +1,52 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_PAYMENTS_CONTENT_BROWSER_BINDING_FAKE_BROWSER_BOUND_KEY_STORE_H_ +#define COMPONENTS_PAYMENTS_CONTENT_BROWSER_BINDING_FAKE_BROWSER_BOUND_KEY_STORE_H_ + +#include <cstdint> +#include <map> +#include <vector> + +#include "base/memory/weak_ptr.h" +#include "components/payments/content/browser_binding/browser_bound_key_store.h" +#include "components/payments/content/browser_binding/fake_browser_bound_key.h" + +namespace payments { + +class BrowserBoundKey; + +// A fake used in tests to provide BrowserBoundKeyStore. +// +// // SetUp +// auto fake_key_store = std::make_unique<FakeBrowserBoundKeyStore>(); +// fake_key_store_weak_ptr_ = fake_key_store.GetWeakPtr(); +// instance_under_test.SetKeyStoreForTesting( +// base::WrapUnique<BrowserBoundKeyStore*>(fake_key_store.release())); +// ... +// // Test +// fake_key_store_weak_ptr_.PutFakeKey(credential_id, +// FakeBrowserBoundKey(/*public_key=*/..., +// /*signature=*/..., expected_client_data=*/...); +class FakeBrowserBoundKeyStore : public BrowserBoundKeyStore { + public: + FakeBrowserBoundKeyStore(); + ~FakeBrowserBoundKeyStore() override; + + std::unique_ptr<BrowserBoundKey> GetOrCreateBrowserBoundKeyForCredentialId( + const std::vector<uint8_t>& credential_id) override; + + void PutFakeKey(const std::vector<uint8_t>& credential_id, + FakeBrowserBoundKey bbk); + + base::WeakPtr<FakeBrowserBoundKeyStore> GetWeakPtr(); + + private: + std::map<std::vector<uint8_t>, FakeBrowserBoundKey> key_map_; + base::WeakPtrFactory<FakeBrowserBoundKeyStore> weak_ptr_factory_{this}; +}; + +} // namespace payments + +#endif // COMPONENTS_PAYMENTS_CONTENT_BROWSER_BINDING_FAKE_BROWSER_BOUND_KEY_STORE_H_
diff --git a/components/payments/content/payment_credential.cc b/components/payments/content/payment_credential.cc index fbdd0c2..967e5a60 100644 --- a/components/payments/content/payment_credential.cc +++ b/components/payments/content/payment_credential.cc
@@ -9,13 +9,21 @@ #include "base/compiler_specific.h" #include "base/feature_list.h" #include "base/memory/ref_counted_memory.h" +#if BUILDFLAG(IS_ANDROID) +#include "components/payments/content/browser_binding/browser_bound_key.h" +#include "components/payments/content/browser_binding/browser_bound_key_store.h" +#endif #include "components/payments/content/payment_manifest_web_data_service.h" #include "components/payments/core/features.h" #include "components/payments/core/secure_payment_confirmation_credential.h" +#include "components/webauthn/core/browser/internal_authenticator.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/secure_payment_confirmation_utils.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_features.h" +#if BUILDFLAG(IS_ANDROID) +#include "third_party/blink/public/common/features.h" +#endif #include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-shared.h" namespace payments { @@ -23,9 +31,11 @@ PaymentCredential::PaymentCredential( content::RenderFrameHost& render_frame_host, mojo::PendingReceiver<mojom::PaymentCredential> receiver, - scoped_refptr<PaymentManifestWebDataService> web_data_service) + scoped_refptr<PaymentManifestWebDataService> web_data_service, + std::unique_ptr<webauthn::InternalAuthenticator> authenticator) : DocumentService(render_frame_host, std::move(receiver)), - web_data_service_(web_data_service) {} + web_data_service_(web_data_service), + authenticator_(std::move(authenticator)) {} PaymentCredential::~PaymentCredential() { Reset(); @@ -65,6 +75,18 @@ /*consumer=*/this); } +void PaymentCredential::MakePaymentCredential( + blink::mojom::PublicKeyCredentialCreationOptionsPtr options, + MakePaymentCredentialCallback callback) { + // TODO(crbug.com/377278827): Include a browser bound key in the client data + // JSON by creating the browser bound key then provide it to the authenticator + // (via SetPaymentOptions() or similar). + authenticator_->MakeCredential( + std::move(options), + base::BindOnce(&PaymentCredential::OnAuthenticatorMakeCredential, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); +} + void PaymentCredential::OnWebDataServiceRequestDone( WebDataServiceBase::Handle h, std::unique_ptr<WDTypedResult> result) { @@ -83,6 +105,39 @@ : mojom::PaymentCredentialStorageStatus::FAILED_TO_STORE_CREDENTIAL); } +// Handles the authenticator make credential callback by adding the browser +// bound signature, then running the callback. +void PaymentCredential::OnAuthenticatorMakeCredential( + PaymentCredential::MakePaymentCredentialCallback callback, + ::blink::mojom::AuthenticatorStatus authenticator_status, + ::blink::mojom::MakeCredentialAuthenticatorResponsePtr response, + ::blink::mojom::WebAuthnDOMExceptionDetailsPtr maybe_exception_details) { +#if BUILDFLAG(IS_ANDROID) + if (response && + base::FeatureList::IsEnabled( + blink::features::kSecurePaymentConfirmationBrowserBoundKeys)) { + if (!browser_bound_key_store_) { + browser_bound_key_store_ = GetBrowserBoundKeyStoreInstance(); + } + if (browser_bound_key_store_) { + std::unique_ptr<BrowserBoundKey> browser_bound_key = + browser_bound_key_store_->GetOrCreateBrowserBoundKeyForCredentialId( + response->info->raw_id); + if (browser_bound_key) { + std::vector<uint8_t> signature_output = + browser_bound_key->Sign(response->info->client_data_json); + response->payment = + blink::mojom::AuthenticationExtensionsPaymentResponse::New(); + response->payment->browser_bound_signatures.push_back( + std::move(signature_output)); + } + } + } +#endif + std::move(callback).Run(authenticator_status, std::move(response), + std::move(maybe_exception_details)); +} + bool PaymentCredential::IsCurrentStateValid() const { if (!content::IsFrameAllowedToUseSecurePaymentConfirmation( &render_frame_host()) ||
diff --git a/components/payments/content/payment_credential.h b/components/payments/content/payment_credential.h index 0bf11b8c6..f1d6eed 100644 --- a/components/payments/content/payment_credential.h +++ b/components/payments/content/payment_credential.h
@@ -12,6 +12,7 @@ #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" +#include "components/payments/content/browser_binding/browser_bound_key_store.h" #include "components/payments/core/secure_payment_confirmation_metrics.h" #include "components/webdata/common/web_data_service_base.h" #include "components/webdata/common/web_data_service_consumer.h" @@ -21,6 +22,12 @@ #include "mojo/public/cpp/bindings/receiver.h" #include "third_party/blink/public/mojom/payments/payment_credential.mojom.h" +namespace webauthn { + +class InternalAuthenticator; + +} // namespace webauthn + namespace payments { class PaymentManifestWebDataService; @@ -36,7 +43,8 @@ PaymentCredential( content::RenderFrameHost& render_frame_host, mojo::PendingReceiver<mojom::PaymentCredential> receiver, - scoped_refptr<PaymentManifestWebDataService> web_data_service); + scoped_refptr<PaymentManifestWebDataService> web_data_service, + std::unique_ptr<webauthn::InternalAuthenticator> authenticator); ~PaymentCredential() override; PaymentCredential(const PaymentCredential&) = delete; @@ -48,6 +56,18 @@ const std::vector<uint8_t>& user_id, StorePaymentCredentialCallback callback) override; + // mojom::PaymentCredential: + void MakePaymentCredential( + blink::mojom::PublicKeyCredentialCreationOptionsPtr options, + MakePaymentCredentialCallback callback) override; + +#if BUILDFLAG(IS_ANDROID) + void SetBrowserBoundKeyStoreForTesting( + std::unique_ptr<BrowserBoundKeyStore> browser_bound_key_store) { + browser_bound_key_store_ = std::move(browser_bound_key_store); + } +#endif // BUILDFLAG(IS_ANDROID) + private: // States of the enrollment flow, necessary to ensure correctness with // round-trips to the renderer process. Methods that perform async @@ -73,6 +93,13 @@ WebDataServiceBase::Handle h, std::unique_ptr<WDTypedResult> result) override; + // MakeCredentialCallback: + void OnAuthenticatorMakeCredential( + PaymentCredential::MakePaymentCredentialCallback callback, + ::blink::mojom::AuthenticatorStatus authenticator_status, + ::blink::mojom::MakeCredentialAuthenticatorResponsePtr response, + ::blink::mojom::WebAuthnDOMExceptionDetailsPtr maybe_exception_details); + bool IsCurrentStateValid() const; void RecordFirstSystemPromptResult( SecurePaymentConfirmationEnrollSystemPromptResult result); @@ -80,10 +107,15 @@ State state_ = State::kIdle; scoped_refptr<PaymentManifestWebDataService> web_data_service_; + std::unique_ptr<webauthn::InternalAuthenticator> authenticator_; std::optional<WebDataServiceBase::Handle> data_service_request_handle_; StorePaymentCredentialCallback storage_callback_; bool is_system_prompt_result_recorded_ = false; +#if BUILDFLAG(IS_ANDROID) + std::unique_ptr<BrowserBoundKeyStore> browser_bound_key_store_; +#endif + base::WeakPtrFactory<PaymentCredential> weak_ptr_factory_{this}; };
diff --git a/components/payments/content/payment_credential_factory.cc b/components/payments/content/payment_credential_factory.cc index 0fee1fd..d7cbfe6 100644 --- a/components/payments/content/payment_credential_factory.cc +++ b/components/payments/content/payment_credential_factory.cc
@@ -7,6 +7,10 @@ #include "components/keyed_service/core/service_access_type.h" #include "components/payments/content/payment_credential.h" #include "components/payments/content/payment_manifest_web_data_service.h" +#if BUILDFLAG(IS_ANDROID) +#include "components/webauthn/android/internal_authenticator_android.h" +#endif +#include "components/webauthn/core/browser/internal_authenticator.h" #include "components/webdata_services/web_data_service_wrapper_factory.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" @@ -32,13 +36,23 @@ CHECK(web_contents); CHECK(render_frame_host); + std::unique_ptr<webauthn::InternalAuthenticator> maybe_authenticator; +#if BUILDFLAG(IS_ANDROID) + maybe_authenticator = + render_frame_host->IsActive() && render_frame_host->IsRenderFrameLive() + ? std::make_unique<webauthn::InternalAuthenticatorAndroid>( + render_frame_host) + : nullptr; +#endif + // The object is bound to the lifetime of |render_frame_host| and the mojo // connection. See DocumentService for details. new PaymentCredential(*render_frame_host, std::move(receiver), webdata_services::WebDataServiceWrapperFactory:: GetPaymentManifestWebDataServiceForBrowserContext( web_contents->GetBrowserContext(), - ServiceAccessType::EXPLICIT_ACCESS)); + ServiceAccessType::EXPLICIT_ACCESS), + std::move(maybe_authenticator)); } } // namespace payments
diff --git a/components/payments/content/payment_credential_unittest.cc b/components/payments/content/payment_credential_unittest.cc new file mode 100644 index 0000000..454607bd --- /dev/null +++ b/components/payments/content/payment_credential_unittest.cc
@@ -0,0 +1,145 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/payments/content/payment_credential.h" + +#include "base/memory/raw_ptr.h" +#include "base/test/bind.h" +#include "base/test/mock_callback.h" +#include "base/test/scoped_feature_list.h" +#include "components/payments/content/browser_binding/browser_bound_key_store.h" +#include "components/payments/content/browser_binding/fake_browser_bound_key.h" +#include "components/payments/content/browser_binding/fake_browser_bound_key_store.h" +#include "components/payments/content/payment_manifest_web_data_service.h" +#include "components/webauthn/core/browser/internal_authenticator.h" +#include "components/webauthn/core/browser/mock_internal_authenticator.h" +#include "content/public/test/browser_task_environment.h" +#include "content/public/test/test_browser_context.h" +#include "content/public/test/test_web_contents_factory.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" + +namespace payments { + +using ::testing::_; +using ::testing::ElementsAre; +using ::testing::Eq; +using ::testing::Field; +using ::testing::Pointee; + +namespace { + +struct PaymentCredentialDeleter { + void operator()(PaymentCredential* payment_credential) { + payment_credential->ResetAndDeleteThis(); + } +}; + +} // namespace + +class PaymentCredentialTest : public ::testing::Test { + public: + PaymentCredentialTest() = default; + + void SetUp() override { + web_contents_ = web_contents_factory_.CreateWebContents(&context_); + } + + protected: + std::unique_ptr<webauthn::InternalAuthenticator> + CreateMockInternalAuthenticator() { + mock_internal_authenticator_ = + new webauthn::MockInternalAuthenticator(web_contents_); + return base::WrapUnique(static_cast<webauthn::InternalAuthenticator*>( + &*mock_internal_authenticator_)); + } + + std::unique_ptr<BrowserBoundKeyStore> CreateFakeBrowserBoundKeyStore() { + auto key_store = std::make_unique<FakeBrowserBoundKeyStore>(); + fake_browser_bound_key_store_ = key_store->GetWeakPtr(); + return base::WrapUnique<BrowserBoundKeyStore>(key_store.release()); + } + + std::unique_ptr<PaymentCredential, PaymentCredentialDeleter> + CreatePaymentCredential() { + mojo::PendingRemote<mojom::PaymentCredential> remote; + mojo::PendingReceiver<mojom::PaymentCredential> receiver = + remote.InitWithNewPipeAndPassReceiver(); + auto payment_credential = + std::unique_ptr<PaymentCredential, PaymentCredentialDeleter>( + new PaymentCredential(*web_contents_->GetPrimaryMainFrame(), + /*receiver=*/std::move(receiver), + /*web_data_service=*/nullptr, + CreateMockInternalAuthenticator())); + payment_credential->SetBrowserBoundKeyStoreForTesting( + CreateFakeBrowserBoundKeyStore()); + return payment_credential; + } + + const std::vector<uint8_t> fake_challenge_ = {0x01, 0x02, 0x03, 0x04}; + const std::vector<uint8_t> fake_credential_id_ = {0x10, 0x11, 0x12, 0x13}; + const std::vector<uint8_t> fake_signature_ = {0x20, 0x21, 0x22, 0x23}; + const std::vector<uint8_t> fake_client_data_json_ = {0x30, 0x31, 0x32, 0x33}; + content::BrowserTaskEnvironment task_environment_; + content::TestBrowserContext context_; + content::TestWebContentsFactory web_contents_factory_; + raw_ptr<content::WebContents> web_contents_; + raw_ptr<webauthn::MockInternalAuthenticator> mock_internal_authenticator_; + base::WeakPtr<FakeBrowserBoundKeyStore> fake_browser_bound_key_store_; + base::MockCallback<mojom::PaymentCredential::MakePaymentCredentialCallback> + mock_payment_credential_callback_; +}; + +static testing::Matcher<::blink::mojom::MakeCredentialAuthenticatorResponsePtr> +AuthenticatorResponseWithBrowserBoundSignature(std::vector<uint8_t> signature) { + return Pointee(Field( + "payment", &::blink::mojom::MakeCredentialAuthenticatorResponse::payment, + Pointee(Field("browser_bound_signatures", + &::blink::mojom::AuthenticationExtensionsPaymentResponse:: + browser_bound_signatures, + ElementsAre(signature))))); +} + +TEST_F(PaymentCredentialTest, MakePaymentCredentialAddsBrowserBoundKey) { + base::test::ScopedFeatureList features( + blink::features::kSecurePaymentConfirmationBrowserBoundKeys); + std::unique_ptr<PaymentCredential, PaymentCredentialDeleter> + payment_credential = CreatePaymentCredential(); + fake_browser_bound_key_store_->PutFakeKey( + fake_credential_id_, FakeBrowserBoundKey( + /*public_key_as_cose_key=*/{}, fake_signature_, + fake_client_data_json_)); + auto creation_options = + blink::mojom::PublicKeyCredentialCreationOptions::New(); + creation_options->is_payment_credential_creation = true; + creation_options->challenge = fake_challenge_; + auto fake_authenticator_response = + ::blink::mojom::MakeCredentialAuthenticatorResponse::New(); + fake_authenticator_response->info = + ::blink::mojom::CommonCredentialInfo::New(); + fake_authenticator_response->info->raw_id = fake_credential_id_; + fake_authenticator_response->info->client_data_json = fake_client_data_json_; + + EXPECT_CALL(*mock_internal_authenticator_, + MakeCredential(Eq(std::ref(creation_options)), _)) + .WillRepeatedly( + [&fake_authenticator_response]( + ::blink::mojom::PublicKeyCredentialCreationOptionsPtr options, + ::blink::mojom::Authenticator::MakeCredentialCallback callback) { + std::move(callback).Run( + ::blink::mojom::AuthenticatorStatus::SUCCESS, + fake_authenticator_response.Clone(), + /*exception_details=*/nullptr); + }); + EXPECT_CALL( + mock_payment_credential_callback_, + Run(Eq(::blink::mojom::AuthenticatorStatus::SUCCESS), + AuthenticatorResponseWithBrowserBoundSignature(fake_signature_), _)); + + payment_credential->MakePaymentCredential( + creation_options.Clone(), mock_payment_credential_callback_.Get()); +} + +} // namespace payments
diff --git a/components/payments/content/secure_payment_confirmation_app_unittest.cc b/components/payments/content/secure_payment_confirmation_app_unittest.cc index 72ce148..f77c9f4 100644 --- a/components/payments/content/secure_payment_confirmation_app_unittest.cc +++ b/components/payments/content/secure_payment_confirmation_app_unittest.cc
@@ -16,6 +16,8 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/gmock_callback_support.h" #include "base/test/scoped_feature_list.h" +#include "components/payments/content/browser_binding/fake_browser_bound_key.h" +#include "components/payments/content/browser_binding/fake_browser_bound_key_store.h" #include "components/payments/content/payment_request_spec.h" #include "components/payments/core/method_strings.h" #include "components/webauthn/core/browser/mock_internal_authenticator.h" @@ -47,71 +49,6 @@ static constexpr char kChallengeBase64[] = "aaaa"; static constexpr char kCredentialIdBase64[] = "cccc"; -class FakeBrowserBoundKey : public BrowserBoundKey { - public: - FakeBrowserBoundKey() = default; - FakeBrowserBoundKey(std::vector<uint8_t> public_key_as_cose_key, - std::vector<uint8_t> signature, - std::vector<uint8_t> expected_client_data) - : public_key_as_cose_key_(public_key_as_cose_key), - signature_(signature), - expected_client_data_(expected_client_data) {} - FakeBrowserBoundKey(const FakeBrowserBoundKey& other) - : public_key_as_cose_key_(other.public_key_as_cose_key_), - signature_(other.signature_), - expected_client_data_(other.expected_client_data_) {} - FakeBrowserBoundKey& operator=(const FakeBrowserBoundKey& other) { - public_key_as_cose_key_ = other.public_key_as_cose_key_; - signature_ = other.signature_; - expected_client_data_ = other.expected_client_data_; - return *this; - } - ~FakeBrowserBoundKey() override = default; - - std::vector<uint8_t> Sign(const std::vector<uint8_t>& client_data) override { - if (client_data == expected_client_data_) { - return signature_; - } - return {}; - } - std::vector<uint8_t> GetPublicKeyAsCoseKey() override { - return public_key_as_cose_key_; - } - - private: - std::vector<uint8_t> public_key_as_cose_key_; - std::vector<uint8_t> signature_; - std::vector<uint8_t> expected_client_data_; -}; - -class FakeBrowserBoundKeyStore : public BrowserBoundKeyStore { - public: - FakeBrowserBoundKeyStore() = default; - ~FakeBrowserBoundKeyStore() override = default; - - std::unique_ptr<BrowserBoundKey> GetOrCreateBrowserBoundKeyForCredentialId( - const std::vector<uint8_t>& credential_id) override { - if (key_map_.find(credential_id) == key_map_.end()) { - key_map_[credential_id] = FakeBrowserBoundKey(); - } - return std::unique_ptr<BrowserBoundKey>( - new FakeBrowserBoundKey(key_map_[credential_id])); - } - - void PutFakeKey(const std::vector<uint8_t>& credential_id, - FakeBrowserBoundKey bbk) { - key_map_[credential_id] = bbk; - } - - base::WeakPtr<FakeBrowserBoundKeyStore> GetWeakPtr() { - return weak_ptr_factory_.GetWeakPtr(); - } - - private: - std::map<std::vector<uint8_t>, FakeBrowserBoundKey> key_map_; - base::WeakPtrFactory<FakeBrowserBoundKeyStore> weak_ptr_factory_{this}; -}; - class SecurePaymentConfirmationAppTest : public testing::Test, public PaymentApp::Delegate { protected:
diff --git a/components/performance_manager/graph/frame_node_impl.cc b/components/performance_manager/graph/frame_node_impl.cc index 10a6e8b..29f9358 100644 --- a/components/performance_manager/graph/frame_node_impl.cc +++ b/components/performance_manager/graph/frame_node_impl.cc
@@ -794,16 +794,13 @@ process_node_->RemoveFrame(this); } -void FrameNodeImpl::OnUninitializingProperties() { +void FrameNodeImpl::CleanUpNodeState() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Disable querying this node using process and frame routing ids. graph()->UnregisterFrameNodeForId(process_node_->GetRenderProcessHostId(), render_frame_id_, this); -} -void FrameNodeImpl::RemoveNodeAttachedData() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DestroyNodeInlineDataStorage(); }
diff --git a/components/performance_manager/graph/frame_node_impl.h b/components/performance_manager/graph/frame_node_impl.h index 49724c2f..eea06af 100644 --- a/components/performance_manager/graph/frame_node_impl.h +++ b/components/performance_manager/graph/frame_node_impl.h
@@ -260,8 +260,7 @@ void OnInitializingEdges() override; void OnBeforeLeavingGraph() override; void OnUninitializingEdges() override; - void OnUninitializingProperties() override; - void RemoveNodeAttachedData() override; + void CleanUpNodeState() override; // Helper function to sever all opened/embedded page relationships. This is // called before destroying the frame node in "OnBeforeLeavingGraph". Note
diff --git a/components/performance_manager/graph/frame_node_impl_unittest.cc b/components/performance_manager/graph/frame_node_impl_unittest.cc index 8a91b768..647e5cf 100644 --- a/components/performance_manager/graph/frame_node_impl_unittest.cc +++ b/components/performance_manager/graph/frame_node_impl_unittest.cc
@@ -200,6 +200,49 @@ using ::testing::InSequence; using ::testing::Invoke; using ::testing::InvokeWithoutArgs; +using ::testing::WithArg; + +// Called repeatedly from a mock FrameNodeObserver. At each call it tries to set +// a property on the node depending on the last action set with `set_action()`, +// unless the action is kDoNothing. +class NodePropertySetter { + public: + NodePropertySetter() = default; + ~NodePropertySetter() = default; + + NodePropertySetter(const NodePropertySetter&) = delete; + NodePropertySetter& operator=(const NodePropertySetter&) = delete; + + enum class Action { + kUndefined, + kSetAndNotify, + kSetWithoutNotify, + kDoNothing, + }; + + void set_action(Action action) { action_ = action; } + + void MaybeSetProperty(const FrameNode* frame_node) { + auto* impl = FrameNodeImpl::FromNode(frame_node); + switch (action_) { + case Action::kSetAndNotify: + // Property that notifies. + impl->SetIsAdFrame(true); + break; + case Action::kSetWithoutNotify: + // Property that doesn't notify. + impl->SetInitialVisibility(FrameNode::Visibility::kVisible); + break; + case Action::kDoNothing: + break; + case Action::kUndefined: + FAIL() << "NodePropertySetter::set_action() wasn't called"; + } + } + + private: + Action action_ = Action::kUndefined; +}; } // namespace @@ -368,53 +411,44 @@ auto process = CreateNode<ProcessNodeImpl>(); auto page = CreateNode<PageNodeImpl>(); - // Modifying a property that notifies during node addition should explode. - bool notify = true; + // Modifying a property during node addition should explode, whether or not + // it notifies. + NodePropertySetter property_setter; { InSequence seq; EXPECT_CALL(obs, OnBeforeFrameNodeAdded(_, _, _, _, _)); EXPECT_CALL(obs, OnFrameNodeAdded(_)) - .WillOnce(Invoke([&](const FrameNode* frame_node) { - auto* impl = FrameNodeImpl::FromNode(frame_node); - if (notify) { - // Property that notifies. - impl->SetIsAdFrame(true); - } else { - // Property that doesn't notify. - impl->SetInitialVisibility(FrameNode::Visibility::kVisible); - } - })); + .WillOnce( + Invoke(&property_setter, &NodePropertySetter::MaybeSetProperty)); } + + // Every EXPECT_DCHECK_DEATH forks the test, with one branch executing the + // expectation and dying, and the other continuing. So the mock expectation + // is installed once and invoked multiple times (once in each fork). The last + // invocation must satisfy the expectation without crashing. + property_setter.set_action(NodePropertySetter::Action::kSetAndNotify); EXPECT_DCHECK_DEATH(auto frame = CreateFrameNodeAutoId(process.get(), page.get())); - - // Now create the node but don't notify so that the mock expectation is - // satisfied. - notify = false; + property_setter.set_action(NodePropertySetter::Action::kSetWithoutNotify); + EXPECT_DCHECK_DEATH(auto frame = + CreateFrameNodeAutoId(process.get(), page.get())); + property_setter.set_action(NodePropertySetter::Action::kDoNothing); auto frame = CreateFrameNodeAutoId(process.get(), page.get()); - // Modifying a property that notifies during node removal should explode. - notify = true; + // Modifying a property during node removal should also explode. { InSequence seq; EXPECT_CALL(obs, OnBeforeFrameNodeRemoved(_)) - .WillOnce(Invoke([&](const FrameNode* frame_node) { - auto* impl = FrameNodeImpl::FromNode(frame_node); - if (notify) { - // Property that notifies. - impl->SetIsAdFrame(true); - } else { - // Property that doesn't notify. - impl->SetInitialVisibility(FrameNode::Visibility::kVisible); - } - })); + .WillOnce( + Invoke(&property_setter, &NodePropertySetter::MaybeSetProperty)); EXPECT_CALL(obs, OnFrameNodeRemoved(_, _, _, _, _)); } - EXPECT_DCHECK_DEATH(frame.reset()); - // Now remove the node but don't notify so that the mock expectation is - // satisfied. - notify = false; + property_setter.set_action(NodePropertySetter::Action::kSetAndNotify); + EXPECT_DCHECK_DEATH(frame.reset()); + property_setter.set_action(NodePropertySetter::Action::kSetWithoutNotify); + EXPECT_DCHECK_DEATH(frame.reset()); + property_setter.set_action(NodePropertySetter::Action::kDoNothing); frame.reset(); graph()->RemoveFrameNodeObserver(&obs); @@ -428,63 +462,39 @@ auto page = CreateNode<PageNodeImpl>(); // Modifying a property that notifies before node addition should explode. - bool notify = true; + NodePropertySetter property_setter; { InSequence seq; EXPECT_CALL(obs, OnBeforeFrameNodeAdded(_, _, _, _, _)) - .WillOnce(Invoke( - [&](const FrameNode* frame_node, - const FrameNode* pending_parent_frame_node, - const PageNode* pending_page_node, - const ProcessNode* pending_process_node, - const FrameNode* pending_parent_or_outer_document_or_embedder) { - auto* impl = FrameNodeImpl::FromNode(frame_node); - if (notify) { - // Property that notifies. - impl->SetIsAdFrame(true); - } else { - // Property that doesn't notify. - impl->SetInitialVisibility(FrameNode::Visibility::kVisible); - } - })); + .WillOnce(WithArg<0>( + Invoke(&property_setter, &NodePropertySetter::MaybeSetProperty))); EXPECT_CALL(obs, OnFrameNodeAdded(_)); } + + // Every EXPECT_DCHECK_DEATH forks the test, with one branch executing the + // expectation and dying, and the other continuing. So the mock expectation + // is installed once and invoked multiple times (once in each fork). The last + // invocation must satisfy the expectation without crashing. + property_setter.set_action(NodePropertySetter::Action::kSetAndNotify); EXPECT_DCHECK_DEATH(auto frame = CreateFrameNodeAutoId(process.get(), page.get())); - - // Now create the node but don't notify so that the mock expectation is - // satisfied. - notify = false; + property_setter.set_action(NodePropertySetter::Action::kSetWithoutNotify); auto frame = CreateFrameNodeAutoId(process.get(), page.get()); - // Modifying a property that notifies after node removal should explode. - notify = true; + // Modifying a property after node removal should explode, whether or not it + // notifies. { InSequence seq; EXPECT_CALL(obs, OnBeforeFrameNodeRemoved(_)); EXPECT_CALL(obs, OnFrameNodeRemoved(_, _, _, _, _)) - .WillOnce( - Invoke([&](const FrameNode* frame_node, - const FrameNode* previous_parent_frame_node, - const PageNode* previous_page_node, - const ProcessNode* previous_process_node, - const FrameNode* - previous_parent_or_outer_document_or_embedder) { - auto* impl = FrameNodeImpl::FromNode(frame_node); - if (notify) { - // Property that notifies. - impl->SetIsAdFrame(true); - } else { - // Property that doesn't notify. - impl->SetInitialVisibility(FrameNode::Visibility::kVisible); - } - })); + .WillOnce(WithArg<0>( + Invoke(&property_setter, &NodePropertySetter::MaybeSetProperty))); } + property_setter.set_action(NodePropertySetter::Action::kSetAndNotify); EXPECT_DCHECK_DEATH(frame.reset()); - - // Now remove the node but don't notify so that the mock expectation is - // satisfied. - notify = false; + property_setter.set_action(NodePropertySetter::Action::kSetWithoutNotify); + EXPECT_DCHECK_DEATH(frame.reset()); + property_setter.set_action(NodePropertySetter::Action::kDoNothing); frame.reset(); graph()->RemoveFrameNodeObserver(&obs);
diff --git a/components/performance_manager/graph/graph_impl.cc b/components/performance_manager/graph/graph_impl.cc index e13f71a..0d5617f 100644 --- a/components/performance_manager/graph/graph_impl.cc +++ b/components/performance_manager/graph/graph_impl.cc
@@ -420,8 +420,7 @@ node->OnUninitializingEdges(); node_in_transition_state_ = NodeState::kLeftGraph; DispatchNodeRemovedNotifications(node); - node->OnUninitializingProperties(); - node->RemoveNodeAttachedData(); + node->CleanUpNodeState(); node->ClearGraphPointer(); node_in_transition_ = nullptr; node_in_transition_state_ = NodeState::kNotInGraph;
diff --git a/components/performance_manager/graph/node_base.cc b/components/performance_manager/graph/node_base.cc index 4b107998..b9d2d887 100644 --- a/components/performance_manager/graph/node_base.cc +++ b/components/performance_manager/graph/node_base.cc
@@ -41,13 +41,13 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); switch (GetNodeState()) { case NodeState::kNotInGraph: + case NodeState::kJoiningGraph: + case NodeState::kLeavingGraph: + case NodeState::kLeftGraph: return false; case NodeState::kInitializingNotInGraph: case NodeState::kInitializingEdges: - case NodeState::kJoiningGraph: - case NodeState::kLeavingGraph: case NodeState::kUninitializingEdges: - case NodeState::kLeftGraph: return true; case NodeState::kActiveInGraph: // Can set properties, but must notify. See CanSetAndNotifyProperty(). @@ -111,12 +111,6 @@ // This is overridden by node impls. } -void NodeBase::OnUninitializingProperties() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK_EQ(NodeState::kLeftGraph, GetNodeState()); - // This is overridden by node impls. -} - void NodeBase::ClearGraphPointer() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(graph_);
diff --git a/components/performance_manager/graph/node_base.h b/components/performance_manager/graph/node_base.h index ed93d3e..7bff168 100644 --- a/components/performance_manager/graph/node_base.h +++ b/components/performance_manager/graph/node_base.h
@@ -121,14 +121,14 @@ virtual void OnInitializingEdges(); // Step 5: - // Node enters kJoiningGraph state. Nodes may modify their properties but - // *not* cause any notifications to be emitted that refer to the node, to - // avoid re-entrant notifications. + // Node enters kJoiningGraph state: the node must not be modified, since + // observers will now be notified of its initial state in the graph, and each + // observer should see the same state. // OnNodeAdded notifications are dispatched. // Step 6: - // Node enters kActiveInGraph state. The node may make property changes, and + // Node enters kActiveInGraph state: the node may make property changes, and // these changes may cause notifications to be dispatched. // Called just after sending OnNodeAdded notifications, for nodes to perform @@ -154,9 +154,9 @@ virtual void OnBeforeLeavingGraph(); // Step 8: - // Node enters kLeavingGraph state. Nodes may modify their properties but - // *not* cause any notifications to be emitted that refer to the node, to - // avoid re-entrant notifications. + // Node enters kLeavingGraph state: the node must not be modified, since it's + // about to be deleted. Observers will commonly use OnBeforeNodeRemoved + // notifications to clean up, and each observer should see the same state. // OnBeforeNodeRemoved notifications are dispatched. @@ -171,27 +171,22 @@ virtual void OnUninitializingEdges(); // Step 10: + // Node enters kLeftGraph state: the node must not be modified, since it's + // about to be deleted. Any property changes would only be visible to other + // OnNodeRemoved observers, and their effects shouldn't depend on the order + // that observers are triggered. + // OnNodeRemoved notifications are dispatched. The public observer method sees // the node's final properties but no incoming or outgoing edges. The graph is // in a consistent state that doesn't include this node. // Step 11: - // Node enters kLeftGraph state: nodes may modify their properties that don't - // affect the graph topology but *not* cause any notifications to be emitted - // that refer to the node, since public observers have already been notified - // that the node was removed from the graph via OnBeforeNodeRemoved and - // OnNodeRemoved. - // Called after the node's edges have been severed from the graph, a good - // opportunity to uninitialize node state. - virtual void OnUninitializingProperties(); + // opportunity to uninitialize node state. This is a pure virtual since almost + // all node classes must implement it to destroy private node-attached data. + virtual void CleanUpNodeState() = 0; // Step 12: - // Called as this node is leaving `graph_`. Any private node-attached data - // should be destroyed at this point. - virtual void RemoveNodeAttachedData() = 0; - - // Step 13: // Resets the graph pointer. The node is in the kLeftGraph state during this // call, and will be in the kNotInGraph state immediately afterwards. void ClearGraphPointer();
diff --git a/components/performance_manager/graph/page_node_impl.cc b/components/performance_manager/graph/page_node_impl.cc index 96f6d421..8d0e32a 100644 --- a/components/performance_manager/graph/page_node_impl.cc +++ b/components/performance_manager/graph/page_node_impl.cc
@@ -523,7 +523,7 @@ DCHECK_EQ(0u, frame_node_count_); } -void PageNodeImpl::RemoveNodeAttachedData() { +void PageNodeImpl::CleanUpNodeState() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DestroyNodeInlineDataStorage(); }
diff --git a/components/performance_manager/graph/page_node_impl.h b/components/performance_manager/graph/page_node_impl.h index 062ddc73..1cc0268 100644 --- a/components/performance_manager/graph/page_node_impl.h +++ b/components/performance_manager/graph/page_node_impl.h
@@ -231,7 +231,7 @@ // NodeBase: void OnInitializingProperties() override; void OnBeforeLeavingGraph() override; - void RemoveNodeAttachedData() override; + void CleanUpNodeState() override; void SetLifecycleState(LifecycleState lifecycle_state); void SetIsHoldingWebLock(bool is_holding_weblock);
diff --git a/components/performance_manager/graph/process_node_impl.cc b/components/performance_manager/graph/process_node_impl.cc index 32dd5c5..2415964 100644 --- a/components/performance_manager/graph/process_node_impl.cc +++ b/components/performance_manager/graph/process_node_impl.cc
@@ -465,17 +465,14 @@ DCHECK(frame_nodes_.empty()); } -void ProcessNodeImpl::OnUninitializingProperties() { +void ProcessNodeImpl::CleanUpNodeState() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Make as if we're transitioning to the null PID before we die to clear this // instance from the PID map. if (process_id_ != base::kNullProcessId) { graph()->BeforeProcessPidChange(this, base::kNullProcessId); } -} -void ProcessNodeImpl::RemoveNodeAttachedData() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DestroyNodeInlineDataStorage(); }
diff --git a/components/performance_manager/graph/process_node_impl.h b/components/performance_manager/graph/process_node_impl.h index aa847bb..3090b8a5 100644 --- a/components/performance_manager/graph/process_node_impl.h +++ b/components/performance_manager/graph/process_node_impl.h
@@ -210,8 +210,7 @@ // NodeBase: void OnInitializingProperties() override; void OnUninitializingEdges() override; - void OnUninitializingProperties() override; - void RemoveNodeAttachedData() override; + void CleanUpNodeState() override; // Receiver for renderer-only messages. mojo::Receiver<mojom::ProcessCoordinationUnit> render_process_receiver_
diff --git a/components/performance_manager/graph/system_node_impl.cc b/components/performance_manager/graph/system_node_impl.cc index 292272b5..b2acf9a 100644 --- a/components/performance_manager/graph/system_node_impl.cc +++ b/components/performance_manager/graph/system_node_impl.cc
@@ -27,7 +27,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } -void SystemNodeImpl::RemoveNodeAttachedData() {} +void SystemNodeImpl::CleanUpNodeState() {} void SystemNodeImpl::OnProcessMemoryMetricsAvailable() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/components/performance_manager/graph/system_node_impl.h b/components/performance_manager/graph/system_node_impl.h index 17f9362..a02ea13a 100644 --- a/components/performance_manager/graph/system_node_impl.h +++ b/components/performance_manager/graph/system_node_impl.h
@@ -31,7 +31,7 @@ ~SystemNodeImpl() override; // Implements NodeBase: - void RemoveNodeAttachedData() override; + void CleanUpNodeState() override; // This should be called after refreshing the memory usage data of the process // nodes.
diff --git a/components/performance_manager/graph/worker_node_impl.cc b/components/performance_manager/graph/worker_node_impl.cc index 6f0e5344..4433ff2b 100644 --- a/components/performance_manager/graph/worker_node_impl.cc +++ b/components/performance_manager/graph/worker_node_impl.cc
@@ -243,7 +243,7 @@ process_node_->RemoveWorker(this); } -void WorkerNodeImpl::RemoveNodeAttachedData() { +void WorkerNodeImpl::CleanUpNodeState() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DestroyNodeInlineDataStorage(); }
diff --git a/components/performance_manager/graph/worker_node_impl.h b/components/performance_manager/graph/worker_node_impl.h index 4d7d671..b691a60 100644 --- a/components/performance_manager/graph/worker_node_impl.h +++ b/components/performance_manager/graph/worker_node_impl.h
@@ -93,7 +93,7 @@ void OnInitializingProperties() override; void OnInitializingEdges() override; void OnUninitializingEdges() override; - void RemoveNodeAttachedData() override; + void CleanUpNodeState() override; // Rest of WorkerNode implementation. These are private so that users of the // impl use the private getters rather than the public interface.
diff --git a/components/performance_manager/public/graph/frame_node.h b/components/performance_manager/public/graph/frame_node.h index 7dfda0d8..df86128 100644 --- a/components/performance_manager/public/graph/frame_node.h +++ b/components/performance_manager/public/graph/frame_node.h
@@ -295,24 +295,14 @@ const ProcessNode* pending_process_node, const FrameNode* pending_parent_or_outer_document_or_embedder) {} - // Called after a `frame_node` is added to the graph. Observers may make - // property changes during the scope of this call, as long as they don't cause - // notifications to be sent. To change a property that causes notifications, - // post a task. - // - // Note that observers are notified in an arbitrary order, so property changes - // made here may or may not be visible to other observers in - // OnFrameNodeAdded(). + // Called after a `frame_node` is added to the graph. Observers may *not* make + // property changes during the scope of this call. To change a property, post + // a task which will run after all observers. virtual void OnFrameNodeAdded(const FrameNode* frame_node) {} - // Called before a `frame_node` is removed from the graph. Observers may make - // property changes during the scope of this call, as long as they don't cause - // notifications to be sent. This can be useful to set final properties on the - // node that should be visible to other observers in OnFrameNodeRemoved(). - // - // Note that observers are notified in an arbitrary order, so property changes - // made here may or may not be visible to other observers in - // OnBeforeFrameNodeRemoved(). + // Called before a `frame_node` is removed from the graph. Observers may *not* + // make property changes during the scope of this call. The node will be + // deleted before any task posted from this scope runs. virtual void OnBeforeFrameNodeRemoved(const FrameNode* frame_node) {} // Called after a `frame_node` is removed from the graph. @@ -327,11 +317,8 @@ // GetParentOrOuterDocumentOrEmbedder() before `frame_node` was removed from // the graph. // - // Observers may make property changes during the scope of this call (although - // `frame_node` will be deleted immediately after so there's not much point), - // as long as they don't cause notifications to be sent and don't modify - // pointers to/from other nodes, since the node is now isolated from the - // graph. + // Observers may *not* make property changes during the scope of this call. + // The node will be deleted before any task posted from this scope runs. virtual void OnFrameNodeRemoved( const FrameNode* frame_node, const FrameNode* previous_parent_frame_node,
diff --git a/components/performance_manager/public/graph/node_state.h b/components/performance_manager/public/graph/node_state.h index c7d58264..bfd19bef 100644 --- a/components/performance_manager/public/graph/node_state.h +++ b/components/performance_manager/public/graph/node_state.h
@@ -51,7 +51,6 @@ // methods. // // Edges visible. - // Property changes allowed. kJoiningGraph, // The node is active in the graph. Nodes will be in this state during most @@ -68,7 +67,6 @@ // observer methods. // // Edges visible. - // Property changes allowed. kLeavingGraph, // The node is uninitializing edges. Nodes will not be in this state during @@ -83,7 +81,8 @@ // for those that point to other graph nodes, which are all null. Nodes will // be in this state during public OnNodeRemoved observer methods. // - // Property changes allowed. + // Unlike kInitializingNotInGraph, property changes are not allowed, because + // the node is about to be deleted so they would have no effect. kLeftGraph, };
diff --git a/components/performance_manager/public/graph/page_node.h b/components/performance_manager/public/graph/page_node.h index 8aba064..f789a12 100644 --- a/components/performance_manager/public/graph/page_node.h +++ b/components/performance_manager/public/graph/page_node.h
@@ -258,24 +258,14 @@ // OnBeforePageNodeAdded(). virtual void OnBeforePageNodeAdded(const PageNode* page_node) {} - // Called after a `page_node` is added to the graph. Observers may make - // property changes during the scope of this call, as long as they don't cause - // notifications to be sent. To change a property that causes notifications, - // post a task. - // - // Note that observers are notified in an arbitrary order, so property changes - // made here may or may not be visible to other observers in - // OnPageNodeAdded(). + // Called after a `page_node` is added to the graph. Observers may *not* make + // property changes during the scope of this call. To change a property, post + // a task which will run after all observers. virtual void OnPageNodeAdded(const PageNode* page_node) {} - // Called before a `page_node` is removed from the graph. Observers may make - // property changes during the scope of this call, as long as they don't cause - // notifications to be sent. This can be useful to set final properties on the - // node that should be visible to other observers in OnPageNodeRemoved(). - // - // Note that observers are notified in an arbitrary order, so property changes - // made here may or may not be visible to other observers in - // OnBeforePageNodeRemoved(). + // Called before a `page_node` is removed from the graph. Observers may *not* + // make property changes during the scope of this call. The node will be + // deleted before any task posted from this scope runs. virtual void OnBeforePageNodeRemoved(const PageNode* page_node) {} // Called after a `page_node` is removed from the graph. @@ -283,11 +273,8 @@ // useful if an observer needs to check the state of the graph without // including `page_node`. // - // Observers may make property changes during the scope of this call (although - // `page_node` will be deleted immediately after so there's not much point), - // as long as they don't cause notifications to be sent and don't modify - // pointers to/from other nodes, since the node is now isolated from the - // graph. + // Observers may *not* make property changes during the scope of this call. + // The node will be deleted before any task posted from this scope runs. virtual void OnPageNodeRemoved(const PageNode* page_node) {} // Notifications of property changes.
diff --git a/components/performance_manager/public/graph/process_node.h b/components/performance_manager/public/graph/process_node.h index c309536..5e79669 100644 --- a/components/performance_manager/public/graph/process_node.h +++ b/components/performance_manager/public/graph/process_node.h
@@ -186,14 +186,9 @@ // OnBeforeProcessNodeAdded(). virtual void OnBeforeProcessNodeAdded(const ProcessNode* process_node) {} - // Called after a `process_node` is added to the graph. Observers may make - // property changes during the scope of this call, as long as they don't cause - // notifications to be sent. To change a property that causes notifications, - // post a task. - // - // Note that observers are notified in an arbitrary order, so property changes - // made here may or may not be visible to other observers in - // OnProcessNodeAdded(). + // Called after a `process_node` is added to the graph. Observers may *not* + // make property changes during the scope of this call. To change a property, + // post a task which will run after all observers. virtual void OnProcessNodeAdded(const ProcessNode* process_node) {} // The process associated with `process_node` has been started or has exited. @@ -202,14 +197,8 @@ virtual void OnProcessLifetimeChange(const ProcessNode* process_node) {} // Called before a `process_node` is removed from the graph. Observers may - // make property changes during the scope of this call, as long as they don't - // cause notifications to be sent. This can be useful to set final properties - // on the node that should be visible to other observers in - // OnProcessNodeRemoved(). - // - // Note that observers are notified in an arbitrary order, so property changes - // made here may or may not be visible to other observers in - // OnBeforeProcessNodeRemoved(). + // *not* make property changes during the scope of this call. The node will be + // deleted before any task posted from this scope runs. virtual void OnBeforeProcessNodeRemoved(const ProcessNode* process_node) {} // Called after a `process_node` is removed from the graph. @@ -217,11 +206,8 @@ // useful if an observer needs to check the state of the graph without // including `process_node`. // - // Observers may make property changes during the scope of this call (although - // `process_node` will be deleted immediately after so there's not much - // point), as long as they don't cause notifications to be sent and don't - // modify pointers to/from other nodes, since the node is now isolated from - // the graph. + // Observers may *not* make property changes during the scope of this call. + // The node will be deleted before any task posted from this scope runs. virtual void OnProcessNodeRemoved(const ProcessNode* process_node) {} // Notifications of property changes.
diff --git a/components/performance_manager/public/graph/worker_node.h b/components/performance_manager/public/graph/worker_node.h index 810de65..c8eb3bf 100644 --- a/components/performance_manager/public/graph/worker_node.h +++ b/components/performance_manager/public/graph/worker_node.h
@@ -173,24 +173,14 @@ const WorkerNode* worker_node, const ProcessNode* pending_process_node) {} - // Called after a `worker_node` is added to the graph. Observers may make - // property changes during the scope of this call, as long as they don't cause - // notifications to be sent. To change a property that causes notifications, - // post a task. - // - // Note that observers are notified in an arbitrary order, so property changes - // made here may or may not be visible to other observers in - // OnWorkerNodeAdded(). + // Called after a `worker_node` is added to the graph. Observers may *not* + // make property changes during the scope of this call. To change a property, + // post a task which will run after all observers. virtual void OnWorkerNodeAdded(const WorkerNode* worker_node) {} - // Called before a `worker_node` is removed from the graph. Observers may make - // property changes during the scope of this call, as long as they don't cause - // notifications to be sent. This can be useful to set final properties on the - // node that should be visible to other observers in OnWorkerNodeRemoved(). - // - // Note that observers are notified in an arbitrary order, so property changes - // made here may or may not be visible to other observers in - // OnBeforeWorkerNodeRemoved(). + // Called before a `worker_node` is removed from the graph. Observers may + // *not* make property changes during the scope of this call. The node will be + // deleted before any task posted from this scope runs. virtual void OnBeforeWorkerNodeRemoved(const WorkerNode* worker_node) {} // Called after a `worker_node` is removed from the graph. @@ -201,11 +191,8 @@ // `previous_process_node` is the node that was returned from GetProcessNode() // before `worker_node` was removed from the graph. // - // Observers may make property changes during the scope of this call (although - // `worker_node` will be deleted immediately after so there's not much point), - // as long as they don't cause notifications to be sent and don't modify - // pointers to/from other nodes, since the node is now isolated from the - // graph. + // Observers may *not* make property changes during the scope of this call. + // The node will be deleted before any task posted from this scope runs. virtual void OnWorkerNodeRemoved(const WorkerNode* worker_node, const ProcessNode* previous_process_node) {}
diff --git a/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/FingerprintingProtectionSettingsFragment.java b/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/FingerprintingProtectionSettingsFragment.java index 5b08472..d62e3ff 100644 --- a/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/FingerprintingProtectionSettingsFragment.java +++ b/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/FingerprintingProtectionSettingsFragment.java
@@ -5,8 +5,6 @@ package org.chromium.components.privacy_sandbox; import android.os.Bundle; -import android.text.style.ClickableSpan; -import android.view.View; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.supplier.ObservableSupplier; @@ -14,6 +12,7 @@ import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.SettingsUtils; import org.chromium.components.browser_ui.settings.TextMessagePreference; +import org.chromium.ui.text.ChromeClickableSpan; import org.chromium.ui.text.SpanApplier; /** @@ -84,12 +83,8 @@ new SpanApplier.SpanInfo( "<link>", "</link>", - new ClickableSpan() { - @Override - public void onClick(View view) { - onLearnMoreClicked(); - } - }))); + new ChromeClickableSpan( + getContext(), (view) -> onLearnMoreClicked())))); } private void onLearnMoreClicked() {
diff --git a/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/IpProtectionSettingsFragment.java b/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/IpProtectionSettingsFragment.java index 2d3ce7ab..b36cea7 100644 --- a/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/IpProtectionSettingsFragment.java +++ b/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/IpProtectionSettingsFragment.java
@@ -5,8 +5,6 @@ package org.chromium.components.privacy_sandbox; import android.os.Bundle; -import android.text.style.ClickableSpan; -import android.view.View; import androidx.annotation.VisibleForTesting; @@ -16,6 +14,7 @@ import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.SettingsUtils; import org.chromium.components.browser_ui.settings.TextMessagePreference; +import org.chromium.ui.text.ChromeClickableSpan; import org.chromium.ui.text.SpanApplier; /** Fragment to manage settings for ip protection. */ @@ -78,12 +77,8 @@ new SpanApplier.SpanInfo( "<link>", "</link>", - new ClickableSpan() { - @Override - public void onClick(View view) { - onLearnMoreClicked(); - } - }))); + new ChromeClickableSpan( + getContext(), (view) -> onLearnMoreClicked())))); } private void onLearnMoreClicked() {
diff --git a/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/TrackingProtectionSettings.java b/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/TrackingProtectionSettings.java index d775ad8..ae04928f 100644 --- a/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/TrackingProtectionSettings.java +++ b/components/privacy_sandbox/android/java/src/org/chromium/components/privacy_sandbox/TrackingProtectionSettings.java
@@ -10,12 +10,10 @@ import android.os.Bundle; import android.text.Spannable; import android.text.SpannableStringBuilder; -import android.text.style.ClickableSpan; import android.text.style.ForegroundColorSpan; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; -import android.view.View; import androidx.annotation.ColorInt; import androidx.annotation.VisibleForTesting; @@ -40,6 +38,7 @@ import org.chromium.components.browser_ui.util.TraceEventVectorDrawableCompat; import org.chromium.components.content_settings.ContentSettingValues; import org.chromium.components.content_settings.ContentSettingsType; +import org.chromium.ui.text.ChromeClickableSpan; import org.chromium.ui.text.SpanApplier; import org.chromium.ui.widget.Toast; @@ -100,12 +99,8 @@ new SpanApplier.SpanInfo( "<link>", "</link>", - new ClickableSpan() { - @Override - public void onClick(View view) { - onLearnMoreClicked(); - } - }))); + new ChromeClickableSpan( + getContext(), (view) -> onLearnMoreClicked())))); ChromeSwitchPreference blockAll3pCookiesSwitch = (ChromeSwitchPreference) findPreference(PREF_BLOCK_ALL_TOGGLE); @@ -136,7 +131,6 @@ return true; }); ipProtectionLearnMore.setVisible(true); - // TODO(b/330745124): Update the learn more action. ipProtectionLearnMore.setSummary( SpanApplier.applySpans( getResources() @@ -145,12 +139,8 @@ new SpanApplier.SpanInfo( "<link>", "</link>", - new ClickableSpan() { - @Override - public void onClick(View view) { - onLearnMoreClicked(); - } - }))); + new ChromeClickableSpan( + getContext(), (view) -> onLearnMoreClicked())))); } // Fingerprinting protection switch. @@ -164,7 +154,6 @@ return true; }); fingerprintingProtectionLearnMore.setVisible(true); - // TODO(b/330745124): Update the learn more action. fingerprintingProtectionLearnMore.setSummary( SpanApplier.applySpans( getResources() @@ -174,12 +163,8 @@ new SpanApplier.SpanInfo( "<link>", "</link>", - new ClickableSpan() { - @Override - public void onClick(View view) { - onLearnMoreClicked(); - } - }))); + new ChromeClickableSpan( + getContext(), (view) -> onLearnMoreClicked())))); } mAllowListExpanded = true; mAllowedSiteCount = 0;
diff --git a/components/privacy_sandbox/tracking_protection_settings.cc b/components/privacy_sandbox/tracking_protection_settings.cc index c43f5ee..10f3255 100644 --- a/components/privacy_sandbox/tracking_protection_settings.cc +++ b/components/privacy_sandbox/tracking_protection_settings.cc
@@ -141,11 +141,12 @@ ContentSettingsType::TRACKING_PROTECTION, CONTENT_SETTING_DEFAULT); } -ContentSetting TrackingProtectionSettings::GetTrackingProtectionSetting( +bool TrackingProtectionSettings::HasTrackingProtectionException( const GURL& first_party_url, content_settings::SettingInfo* info) const { return host_content_settings_map_->GetContentSetting( - GURL(), first_party_url, ContentSettingsType::TRACKING_PROTECTION, info); + GURL(), first_party_url, ContentSettingsType::TRACKING_PROTECTION, + info) == CONTENT_SETTING_ALLOW; } void TrackingProtectionSettings::MaybeInitializeIppPref() {
diff --git a/components/privacy_sandbox/tracking_protection_settings.h b/components/privacy_sandbox/tracking_protection_settings.h index e96678b..f20e55dd 100644 --- a/components/privacy_sandbox/tracking_protection_settings.h +++ b/components/privacy_sandbox/tracking_protection_settings.h
@@ -48,16 +48,21 @@ // Returns whether IP protection is enabled. bool IsIpProtectionEnabled() const; - // Adds a Tracking Protection site-scoped exception for `first_party_url`. + // Adds a site-scoped TRACKING_PROTECTION content setting equal to ALLOW for + // `first_party_url`. void AddTrackingProtectionException(const GURL& first_party_url); - // Removes a Tracking Protection exception for `first_party_url`. - // Can remove both site-scoped (wildcarded) and origin-scoped exceptions. + // Resets the TRACKING_PROTECTION content setting for `first_party_url`. + // Can reset both site-scoped (wildcarded) and origin-scoped exceptions. void RemoveTrackingProtectionException(const GURL& first_party_url); - // Returns the tracking protection setting for `first_party_url`. This will be - // BLOCK unless the user has made an explicit exception for `first_party_url`. - ContentSetting GetTrackingProtectionSetting( + // Returns true if the user has a TRACKING_PROTECTION content setting equal to + // ALLOW, indicating ACT features should be disabled on `first_party_url`. + // NOTE: the default for TRACKING_PROTECTION is BLOCK and cannot be changed, + // meaning this function will only return true for site-level content settings + // (i.e. exceptions). To check whether individual ACT features are + // enabled/disabled please use the functions specific to those features. + bool HasTrackingProtectionException( const GURL& first_party_url, content_settings::SettingInfo* info = nullptr) const;
diff --git a/components/privacy_sandbox/tracking_protection_settings_unittest.cc b/components/privacy_sandbox/tracking_protection_settings_unittest.cc index e03c8ad..32ba98c 100644 --- a/components/privacy_sandbox/tracking_protection_settings_unittest.cc +++ b/components/privacy_sandbox/tracking_protection_settings_unittest.cc
@@ -127,27 +127,27 @@ tracking_protection_settings()->AreAllThirdPartyCookiesBlocked()); } -TEST_F(TrackingProtectionSettingsTest, - GetTrackingProtectionSettingReturnsAllow) { +// Content settings + +using HasTrackingProtectionExceptionTest = TrackingProtectionSettingsTest; + +TEST_F(HasTrackingProtectionExceptionTest, + ReturnsTrueWhenTrackingProtectionContentSettingForUrlIsAllow) { host_content_settings_map()->SetContentSettingCustomScope( ContentSettingsPattern::Wildcard(), ContentSettingsPattern::FromURL(GetTestUrl()), ContentSettingsType::TRACKING_PROTECTION, ContentSetting::CONTENT_SETTING_ALLOW); - EXPECT_EQ(tracking_protection_settings()->GetTrackingProtectionSetting( - GetTestUrl()), - CONTENT_SETTING_ALLOW); + EXPECT_TRUE(tracking_protection_settings()->HasTrackingProtectionException( + GetTestUrl())); } -TEST_F(TrackingProtectionSettingsTest, - GetTrackingProtectionSettingReturnsBlockByDefault) { - EXPECT_EQ(tracking_protection_settings()->GetTrackingProtectionSetting( - GetTestUrl()), - CONTENT_SETTING_BLOCK); +TEST_F(HasTrackingProtectionExceptionTest, ReturnsFalseByDefault) { + EXPECT_FALSE(tracking_protection_settings()->HasTrackingProtectionException( + GetTestUrl())); } -TEST_F(TrackingProtectionSettingsTest, - GetTrackingProtectionSettingFillsSettingInfo) { +TEST_F(HasTrackingProtectionExceptionTest, FillsSettingInfo) { content_settings::TestUtils::OverrideProvider( host_content_settings_map(), std::make_unique<content_settings::MockProvider>(), @@ -159,9 +159,8 @@ ContentSetting::CONTENT_SETTING_ALLOW); content_settings::SettingInfo info; - EXPECT_EQ(tracking_protection_settings()->GetTrackingProtectionSetting( - GetTestUrl(), &info), - CONTENT_SETTING_ALLOW); + EXPECT_TRUE(tracking_protection_settings()->HasTrackingProtectionException( + GetTestUrl(), &info)); EXPECT_EQ(info.primary_pattern, ContentSettingsPattern::Wildcard()); EXPECT_EQ(info.secondary_pattern, ContentSettingsPattern::FromURL(GetTestUrl())); @@ -249,6 +248,8 @@ testing::Mock::VerifyAndClearExpectations(&observer); } +// IPP + class TrackingProtectionSettingsTestWithIppDogfood : public TrackingProtectionSettingsTest { public:
diff --git a/components/reporting/util/rate_limiter_slide_window.cc b/components/reporting/util/rate_limiter_slide_window.cc index 5d390a5..b35c51cd 100644 --- a/components/reporting/util/rate_limiter_slide_window.cc +++ b/components/reporting/util/rate_limiter_slide_window.cc
@@ -47,10 +47,9 @@ void RateLimiterSlideWindow::BucketsShift() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - CHECK(!bucket_events_size_.empty()); - // Drop all obsolete buckets. + // Drop all obsolete buckets, if any. TrimBuckets(/*now=*/base::Time::Now()); - // If more buckets are there, repeat once the earliest bucket becomes + // If any buckets are still there, repeat once the earliest bucket becomes // obsolete. if (!bucket_events_size_.empty()) { base::SequencedTaskRunner::GetCurrentDefault()->PostDelayedTask(
diff --git a/components/resources/BUILD.gn b/components/resources/BUILD.gn index 190f83a6..99eb89c 100644 --- a/components/resources/BUILD.gn +++ b/components/resources/BUILD.gn
@@ -32,6 +32,7 @@ ":components_scaled_resources", ":dev_ui_components_resources", "../chrome_urls_ui/resources:resources", + "../crash/core/browser/resources:resources", "../flags_ui/resources:resources", "../signin/core/browser/resources", "../version_ui/resources:resources", @@ -96,10 +97,7 @@ "dev_ui_components_resources.pak", ] - deps = [ - "//components/crash/core/browser/resources:build_ts", - "//components/local_state:build", - ] + deps = [ "//components/local_state:build" ] output_dir = "$root_gen_dir/components" }
diff --git a/components/resources/crash_resources.grdp b/components/resources/crash_resources.grdp deleted file mode 100644 index e6fcc2e2..0000000 --- a/components/resources/crash_resources.grdp +++ /dev/null
@@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<grit-part> - <include name="IDR_CRASH_CRASHES_HTML" file="../crash/core/browser/resources/crashes.html" preprocess="true" type="BINDATA" /> - <include name="IDR_CRASH_CRASHES_JS" file="${root_gen_dir}/components/crash/core/browser/resources/tsc/crashes.js" use_base_dir="false" type="BINDATA" /> - <include name="IDR_CRASH_CRASHES_CSS" file="../crash/core/browser/resources/crashes.css" type="BINDATA" /> - <include name="IDR_CRASH_SADTAB_SVG" file="sadtab.svg" type="BINDATA" /> -</grit-part>
diff --git a/components/resources/dev_ui_components_resources.grd b/components/resources/dev_ui_components_resources.grd index a1179f5..c41207ad 100644 --- a/components/resources/dev_ui_components_resources.grd +++ b/components/resources/dev_ui_components_resources.grd
@@ -17,7 +17,6 @@ <release seq="1"> <includes> <part file="autofill_and_password_manager_internals_resources.grdp" /> - <part file="crash_resources.grdp" /> <part file="gcm_driver_resources.grdp" /> <part file="local_state.grdp" /> <part file="net_log_resources.grdp" />
diff --git a/components/safe_browsing/content/browser/client_side_detection_host.cc b/components/safe_browsing/content/browser/client_side_detection_host.cc index efa1691..305c1eb 100644 --- a/components/safe_browsing/content/browser/client_side_detection_host.cc +++ b/components/safe_browsing/content/browser/client_side_detection_host.cc
@@ -1104,7 +1104,8 @@ void ClientSideDetectionHost::OnInquireOnDeviceModelDone( std::unique_ptr<ClientPhishingRequest> verdict, std::optional<bool> did_match_high_confidence_allowlist, - std::optional<optimization_guide::proto::ScamDetectionResponse> response) { + std::optional<optimization_guide::proto::features::ScamDetectionResponse> + response) { if (response.has_value()) { IntelligentScanInfo intelligent_scan_info; intelligent_scan_info.set_brand(response->brand());
diff --git a/components/safe_browsing/content/browser/client_side_detection_host.h b/components/safe_browsing/content/browser/client_side_detection_host.h index 7ba9e598..c15a4b6 100644 --- a/components/safe_browsing/content/browser/client_side_detection_host.h +++ b/components/safe_browsing/content/browser/client_side_detection_host.h
@@ -323,7 +323,8 @@ void OnInquireOnDeviceModelDone( std::unique_ptr<ClientPhishingRequest> verdict, std::optional<bool> did_match_high_confidence_allowlist, - std::optional<optimization_guide::proto::ScamDetectionResponse> response); + std::optional<optimization_guide::proto::features::ScamDetectionResponse> + response); // This pointer may be nullptr if client-side phishing detection is // disabled.
diff --git a/components/safe_browsing/content/browser/client_side_detection_service.cc b/components/safe_browsing/content/browser/client_side_detection_service.cc index 9f7d06c45..ec2c8be 100644 --- a/components/safe_browsing/content/browser/client_side_detection_service.cc +++ b/components/safe_browsing/content/browser/client_side_detection_service.cc
@@ -805,7 +805,8 @@ ClientPhishingRequest* verdict, std::string rendered_texts, base::OnceCallback< - void(std::optional<optimization_guide::proto::ScamDetectionResponse>)> + void(std::optional< + optimization_guide::proto::features::ScamDetectionResponse>)> callback) { if (!IsOnDeviceModelAvailable()) { std::move(callback).Run(std::nullopt); @@ -866,7 +867,7 @@ session_execution_start_time_); auto scam_detection_response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::ScamDetectionResponse>( + optimization_guide::proto::features::ScamDetectionResponse>( result.response->response); if (!scam_detection_response) {
diff --git a/components/safe_browsing/content/browser/client_side_detection_service.h b/components/safe_browsing/content/browser/client_side_detection_service.h index c2e677b..c6beacc 100644 --- a/components/safe_browsing/content/browser/client_side_detection_service.h +++ b/components/safe_browsing/content/browser/client_side_detection_service.h
@@ -65,8 +65,10 @@ kMaxValue = kModelLabelNotFound, }; -using ScamDetectionRequest = optimization_guide::proto::ScamDetectionRequest; -using ScamDetectionResponse = optimization_guide::proto::ScamDetectionResponse; +using ScamDetectionRequest = + optimization_guide::proto::features::ScamDetectionRequest; +using ScamDetectionResponse = + optimization_guide::proto::features::ScamDetectionResponse; // Main service which pushes models to the renderers, responds to classification // requests. This owns two ModelLoader objects. @@ -239,7 +241,8 @@ ClientPhishingRequest* verdict, std::string rendered_texts, base::OnceCallback< - void(std::optional<optimization_guide::proto::ScamDetectionResponse>)> + void(std::optional< + optimization_guide::proto::features::ScamDetectionResponse>)> callback); // For testing the on-device model flow in unit test. @@ -403,7 +406,8 @@ std::unique_ptr<optimization_guide::OptimizationGuideModelExecutor::Session> session_; base::OnceCallback<void( - std::optional<optimization_guide::proto::ScamDetectionResponse>)> + std::optional< + optimization_guide::proto::features::ScamDetectionResponse>)> inquire_on_device_model_callback_; SEQUENCE_CHECKER(sequence_checker_);
diff --git a/components/safe_browsing/core/browser/db/v4_database.cc b/components/safe_browsing/core/browser/db/v4_database.cc index 49c2a8d4..b2f59be 100644 --- a/components/safe_browsing/core/browser/db/v4_database.cc +++ b/components/safe_browsing/core/browser/db/v4_database.cc
@@ -66,6 +66,7 @@ std::vector<std::pair<ListIdentifier, V4Store*>> stores) { FullHashToStoreAndHashPrefixesMap results; for (const auto& store : stores) { + base::TimeTicks start = base::TimeTicks::Now(); for (const auto& full_hash : full_hashes) { HashPrefixStr hash_prefix = store.second->GetMatchingHashPrefix(full_hash); @@ -73,6 +74,12 @@ results[full_hash].emplace_back(store.first, hash_prefix); } } + if (store.first.threat_type() == ThreatType::HIGH_CONFIDENCE_ALLOWLIST) { + base::UmaHistogramTimes( + "SafeBrowsing.V4Store.DbThread." + "CheckHighConfidenceAllowlistStoreDuration", + base::TimeTicks::Now() - start); + } } return results; }
diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json index f8fe3e63..f14653e 100644 --- a/components/search_engines/prepopulated_engines.json +++ b/components/search_engines/prepopulated_engines.json
@@ -10,8 +10,6 @@ // // Chrome engineers will review, verify, and apply the proposed changes // to ensure obligations and compliance with regulatory requirements. -// -// Do not modify this file directly without following the above process. // This file is used during build to generate prepopulated_engines.h/cc. // For more details see tools/json_to_struct/json_to_struct.py.
diff --git a/components/search_engines/template_url.cc b/components/search_engines/template_url.cc index e3ee2b5f..99077fa4 100644 --- a/components/search_engines/template_url.cc +++ b/components/search_engines/template_url.cc
@@ -1605,7 +1605,13 @@ } TemplateURL::TemplateURL(const TemplateURLData& data, Type type) - : data_(data), + : TemplateURL(data, std::nullopt, type) {} + +TemplateURL::TemplateURL(const std::optional<TemplateURLData>& local_data, + const std::optional<TemplateURLData>& account_data, + Type type) + : local_data_(local_data), + account_data_(account_data), suggestions_url_ref_(this, TemplateURLRef::SUGGEST), image_url_ref_(this, TemplateURLRef::IMAGE), image_translate_url_ref_(this, TemplateURLRef::IMAGE_TRANSLATE), @@ -1614,7 +1620,7 @@ type_(type), engine_type_(SEARCH_ENGINE_UNKNOWN) { ResizeURLRefVector(); - SetPrepopulateId(data_.prepopulate_id); + SetPrepopulateId(active_data().prepopulate_id); } TemplateURL::TemplateURL(const TemplateURLData& data, @@ -1803,7 +1809,7 @@ std::string TemplateURL::GetExtensionId() const { DCHECK(extension_info_); - return extension_info_->extension_id; + return GetExtensionInfo()->extension_id; } SearchEngineType TemplateURL::GetEngineType( @@ -2070,20 +2076,22 @@ if (this == &other) return; - data_ = other.data_; + local_data_ = other.local_data_; + account_data_ = other.account_data_; ResizeURLRefVector(); InvalidateCachedValues(); SetPrepopulateId(other.data().prepopulate_id); } void TemplateURL::SetURL(const std::string& url) { - const_cast<TemplateURLData&>(data()).SetURL(url); + active_data().SetURL(url); + engine_type_ = SEARCH_ENGINE_UNKNOWN; url_ref().InvalidateCachedValues(); } void TemplateURL::SetPrepopulateId(int id) { - const_cast<TemplateURLData&>(data()).prepopulate_id = id; + active_data().prepopulate_id = id; const bool prepopulated = id > 0; for (TemplateURLRef& ref : url_refs_) ref.prepopulated_ = prepopulated; @@ -2101,7 +2109,7 @@ DCHECK_NE(OMNIBOX_API_EXTENSION, type_); GURL url(GenerateSearchURL(search_terms_data)); if (url.is_valid()) - const_cast<TemplateURLData&>(data()).SetKeyword(GenerateKeyword(url)); + active_data().SetKeyword(GenerateKeyword(url)); } } @@ -2118,7 +2126,12 @@ size_t TemplateURL::EstimateMemoryUsage() const { size_t res = 0; - res += base::trace_event::EstimateMemoryUsage(data_); + if (local_data_) { + res += base::trace_event::EstimateMemoryUsage(*local_data_); + } + if (account_data_) { + res += base::trace_event::EstimateMemoryUsage(*account_data_); + } res += base::trace_event::EstimateMemoryUsage(url_refs_); res += base::trace_event::EstimateMemoryUsage(suggestions_url_ref_); res += base::trace_event::EstimateMemoryUsage(image_url_ref_); @@ -2131,13 +2144,13 @@ } void TemplateURL::ResizeURLRefVector() { - const size_t new_size = data().alternate_urls.size() + 1; + const size_t new_size = active_data().alternate_urls.size() + 1; if (url_refs_.size() == new_size) return; url_refs_.clear(); url_refs_.reserve(new_size); - for (size_t i = 0; i != data().alternate_urls.size(); ++i) { + for (size_t i = 0; i != active_data().alternate_urls.size(); ++i) { url_refs_.emplace_back(this, i); } url_refs_.emplace_back(this, TemplateURLRef::SEARCH); @@ -2188,5 +2201,46 @@ } const TemplateURLData& TemplateURL::data() const { - return data_; + return const_cast<TemplateURL*>(this)->active_data(); +} + +TemplateURLData& TemplateURL::active_data() { + CHECK(local_data_); + return *local_data_; +} + +void TemplateURL::set_short_name(const std::u16string& short_name) { + active_data().SetShortName(short_name); +} + +void TemplateURL::set_keyword(const std::u16string& keyword) { + active_data().SetKeyword(keyword); +} + +void TemplateURL::set_safe_for_autoreplace(bool safe_for_autoreplace) { + active_data().safe_for_autoreplace = safe_for_autoreplace; +} + +void TemplateURL::set_id(TemplateURLID id) { + active_data().id = id; +} + +void TemplateURL::IncrementUsageCount() { + active_data().usage_count++; +} + +void TemplateURL::GenerateSyncGUID() { + active_data().GenerateSyncGUID(); +} + +void TemplateURL::set_is_active(TemplateURLData::ActiveStatus active_status) { + active_data().is_active = active_status; +} + +const std::optional<TemplateURLData>& TemplateURL::GetLocalData() const { + return local_data_; +} + +const std::optional<TemplateURLData>& TemplateURL::GetAccountData() const { + return account_data_; }
diff --git a/components/search_engines/template_url.h b/components/search_engines/template_url.h index c766b5be..0ea3f24 100644 --- a/components/search_engines/template_url.h +++ b/components/search_engines/template_url.h
@@ -680,6 +680,9 @@ }; explicit TemplateURL(const TemplateURLData& data, Type type = NORMAL); + TemplateURL(const std::optional<TemplateURLData>& local_data, + const std::optional<TemplateURLData>& account_data, + Type type = NORMAL); // Constructor for extension controlled engine. |type| must be // NORMAL_CONTROLLED_BY_EXTENSION or OMNIBOX_API_EXTENSION. @@ -730,11 +733,13 @@ const TemplateURLData& data() const; const std::u16string& short_name() const { return data().short_name(); } + void set_short_name(const std::u16string& short_name); // An accessor for the short_name, but adjusted so it can be appropriately // displayed even if it is LTR and the UI is RTL. std::u16string AdjustedShortNameForLocaleDirection() const; const std::u16string& keyword() const { return data().keyword(); } + void set_keyword(const std::u16string& keyword); const std::string& url() const { return data().url(); } const std::string& suggestions_url() const { return data().suggestions_url; } @@ -787,12 +792,14 @@ const GURL& originating_url() const { return data().originating_url; } bool safe_for_autoreplace() const { return data().safe_for_autoreplace; } + void set_safe_for_autoreplace(bool safe_for_autoreplace); const std::vector<std::string>& input_encodings() const { return data().input_encodings; } TemplateURLID id() const { return data().id; } + void set_id(TemplateURLID id); base::Time date_created() const { return data().date_created; } base::Time last_modified() const { return data().last_modified; } @@ -806,12 +813,15 @@ bool featured_by_policy() const { return data().featured_by_policy; } int usage_count() const { return data().usage_count; } + void IncrementUsageCount(); int prepopulate_id() const { return data().prepopulate_id; } const std::string& sync_guid() const { return data().sync_guid; } + void GenerateSyncGUID(); TemplateURLData::ActiveStatus is_active() const { return data().is_active; } + void set_is_active(TemplateURLData::ActiveStatus active_status); int starter_pack_id() const { return data().starter_pack_id; } @@ -835,7 +845,7 @@ Type type() const { return type_; } - const AssociatedExtensionInfo* GetExtensionInfoForTesting() const { + const AssociatedExtensionInfo* GetExtensionInfo() const { return extension_info_.get(); } @@ -984,11 +994,6 @@ const TemplateURLData::RegulatoryExtension* GetRegulatoryExtension( RegulatoryExtensionType type) const; - private: - friend class TemplateURLService; - - void CopyFrom(const TemplateURL& other); - void SetURL(const std::string& url); void SetPrepopulateId(int id); @@ -999,6 +1004,12 @@ void ResetKeywordIfNecessary(const SearchTermsData& search_terms_data, bool force); + void CopyFrom(const TemplateURL& other); + + const std::optional<TemplateURLData>& GetLocalData() const; + const std::optional<TemplateURLData>& GetAccountData() const; + + private: // Resizes the |url_refs_| vector, which always holds the search URL as the // last item. void ResizeURLRefVector(); @@ -1013,7 +1024,10 @@ url::Parsed::ComponentType* search_terms_component, url::Component* search_terms_position) const; - TemplateURLData data_; + TemplateURLData& active_data(); + + std::optional<TemplateURLData> local_data_; + std::optional<TemplateURLData> account_data_; // Contains TemplateURLRefs corresponding to the alternate URLs and the search // URL, in priority order: the URL at index 0 is treated as the highest
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc index a2b2afb..0051a9a46 100644 --- a/components/search_engines/template_url_service.cc +++ b/components/search_engines/template_url_service.cc
@@ -664,11 +664,11 @@ TemplateURL* TemplateURLService::Add( std::unique_ptr<TemplateURL> template_url) { DCHECK(template_url); - DCHECK( - !IsCreatedByExtension(template_url.get()) || - (!FindTemplateURLForExtension(template_url->extension_info_->extension_id, - template_url->type()) && - template_url->id() == kInvalidTemplateURLID)); + DCHECK(!IsCreatedByExtension(template_url.get()) || + (!FindTemplateURLForExtension( + template_url->GetExtensionInfo()->extension_id, + template_url->type()) && + template_url->id() == kInvalidTemplateURLID)); return Add(std::move(template_url), true); } @@ -681,8 +681,8 @@ DCHECK(!short_name.empty()); DCHECK(!keyword.empty()); DCHECK(!url.empty()); - template_url->data_.SetShortName(short_name); - template_url->data_.SetKeyword(keyword); + template_url->set_short_name(short_name); + template_url->set_keyword(keyword); template_url->SetURL(url); return Add(std::move(template_url)); } @@ -889,7 +889,7 @@ if (!Contains(&template_urls_, url)) { return; } - ++url->data_.usage_count; + url->IncrementUsageCount(); if (web_data_service_) { web_data_service_->UpdateKeyword(url->data()); @@ -1116,7 +1116,7 @@ // aren't persisted. DCHECK(!url || !IsCreatedByExtension(url)); if (url) { - url->data_.is_active = TemplateURLData::ActiveStatus::kTrue; + url->set_is_active(TemplateURLData::ActiveStatus::kTrue); } bool selection_added = false; @@ -2064,7 +2064,7 @@ // pick that up separately at the appropriate time. Otherwise, changing // the keyword here could result in having the wrong keyword for the local // environment. - turl->data_.SetKeyword(existing_turl->keyword()); + turl->set_keyword(existing_turl->keyword()); } } @@ -2299,7 +2299,7 @@ // will be culled during next startup's Add() loop. We did this to keep // Update() simple: it never fails, and never deletes |existing_engine|. existing_turl->CopyFrom(new_values); - existing_turl->data_.id = previous_id; + existing_turl->set_id(previous_id); AddToMaps(existing_turl); @@ -2685,7 +2685,7 @@ if (newly_adding) { DCHECK_EQ(kInvalidTemplateURLID, template_url->id()); DCHECK(!Contains(&template_urls_, template_url.get())); - template_url->data_.id = ++next_id_; + template_url->set_id(++next_id_); } template_url->ResetKeywordIfNecessary(search_terms_data(), false); @@ -2948,7 +2948,7 @@ DCHECK(template_url); if (template_url->sync_guid().empty() && (template_url->type() == TemplateURL::NORMAL)) { - template_url->data_.GenerateSyncGUID(); + template_url->GenerateSyncGUID(); if (web_data_service_) { web_data_service_->UpdateKeyword(template_url->data()); } @@ -2981,8 +2981,8 @@ // |safe_for_autoreplace| is false if the entry has been modified. if (turl->is_active() == TemplateURLData::ActiveStatus::kUnspecified && (!turl->safe_for_autoreplace() || turl->usage_count() > 0)) { - turl->data_.is_active = TemplateURLData::ActiveStatus::kTrue; - turl->data_.safe_for_autoreplace = false; + turl->set_is_active(TemplateURLData::ActiveStatus::kTrue); + turl->set_safe_for_autoreplace(false); if (web_data_service_) { web_data_service_->UpdateKeyword(turl->data()); } @@ -3057,7 +3057,7 @@ const TemplateURLData& data) { for (const auto& turl : template_urls_) { if (turl->type() == TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION && - turl->extension_info_->wants_to_be_default_engine && + turl->GetExtensionInfo()->wants_to_be_default_engine && TemplateURL::MatchesData(turl.get(), &data, search_terms_data())) { return turl.get(); }
diff --git a/components/tracing/test/trace_event_perftest.cc b/components/tracing/test/trace_event_perftest.cc index a183fce0..da29290 100644 --- a/components/tracing/test/trace_event_perftest.cc +++ b/components/tracing/test/trace_event_perftest.cc
@@ -44,7 +44,7 @@ void BeginTrace() { TraceConfig config("*", ""); config.SetTraceRecordMode(TraceRecordMode::RECORD_CONTINUOUSLY); - TraceLog::GetInstance()->SetEnabled(config, TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(config); } void EndTraceAndFlush() {
diff --git a/components/user_annotations/form_submission_handler.cc b/components/user_annotations/form_submission_handler.cc index 3c1c804..09c18d9 100644 --- a/components/user_annotations/form_submission_handler.cc +++ b/components/user_annotations/form_submission_handler.cc
@@ -19,7 +19,7 @@ UserAnnotationsService* user_annotations_service, const GURL& url, const std::string& title, - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, std::unique_ptr<autofill::FormStructure> form, ImportFormCallback callback) : url_(url), @@ -48,8 +48,8 @@ void FormSubmissionHandler::ExecuteModelWithEntries( UserAnnotationsEntries entries) { // Construct request. - optimization_guide::proto::FormsAnnotationsRequest request; - optimization_guide::proto::PageContext* page_context = + optimization_guide::proto::features::FormsAnnotationsRequest request; + optimization_guide::proto::features::PageContext* page_context = request.mutable_page_context(); page_context->set_url(url_.spec()); page_context->set_title(title_); @@ -74,9 +74,9 @@ return; } - std::optional<optimization_guide::proto::FormsAnnotationsResponse> + std::optional<optimization_guide::proto::features::FormsAnnotationsResponse> maybe_response = optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::FormsAnnotationsResponse>( + optimization_guide::proto::features::FormsAnnotationsResponse>( result.response.value()); if (!maybe_response) { SendFormSubmissionResult( @@ -152,17 +152,21 @@ optimization_guide::FormsAnnotationsFeatureTypeMap>(); if (prompt_acceptance_result.did_thumbs_down_triggered) { quality_entry->set_user_feedback( - optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_DOWN); + optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_DOWN); } else if (prompt_acceptance_result.did_thumbs_up_triggered) { quality_entry->set_user_feedback( - optimization_guide::proto::UserFeedback::USER_FEEDBACK_THUMBS_UP); + optimization_guide::proto::features::UserFeedback:: + USER_FEEDBACK_THUMBS_UP); } quality_entry->set_save_prompt_action( prompt_acceptance_result.prompt_was_accepted - ? optimization_guide::proto::FormsAnnotationsSavePromptAction:: - FORMS_ANNOTATIONS_SAVE_PROMPT_ACTION_ACCEPTED - : optimization_guide::proto::FormsAnnotationsSavePromptAction:: - FORMS_ANNOTATIONS_SAVE_PROMPT_ACTION_REJECTED); + ? optimization_guide::proto::features:: + FormsAnnotationsSavePromptAction:: + FORMS_ANNOTATIONS_SAVE_PROMPT_ACTION_ACCEPTED + : optimization_guide::proto::features:: + FormsAnnotationsSavePromptAction:: + FORMS_ANNOTATIONS_SAVE_PROMPT_ACTION_REJECTED); optimization_guide::ModelQualityLogEntry::Upload(std::move(log_entry)); }
diff --git a/components/user_annotations/form_submission_handler.h b/components/user_annotations/form_submission_handler.h index 43f63deb..4a71a0e 100644 --- a/components/user_annotations/form_submission_handler.h +++ b/components/user_annotations/form_submission_handler.h
@@ -20,9 +20,9 @@ namespace optimization_guide { class OptimizationGuideDecider; -namespace proto { +namespace proto::features { class AXTreeUpdate; -} // namespace proto +} // namespace proto::features } // namespace optimization_guide namespace user_annotations { @@ -33,12 +33,13 @@ // sent for user confirmation, before they are persisted to the database. class FormSubmissionHandler { public: - FormSubmissionHandler(UserAnnotationsService* user_annotations_service, - const GURL& url, - const std::string& title, - optimization_guide::proto::AXTreeUpdate ax_tree_update, - std::unique_ptr<autofill::FormStructure> form, - ImportFormCallback callback); + FormSubmissionHandler( + UserAnnotationsService* user_annotations_service, + const GURL& url, + const std::string& title, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, + std::unique_ptr<autofill::FormStructure> form, + ImportFormCallback callback); ~FormSubmissionHandler(); FormSubmissionHandler(const FormSubmissionHandler&) = delete; @@ -48,9 +49,9 @@ void Start(); private: - using FormSubmissionResult = - base::expected<optimization_guide::proto::FormsAnnotationsResponse, - UserAnnotationsExecutionResult>; + using FormSubmissionResult = base::expected< + optimization_guide::proto::features::FormsAnnotationsResponse, + UserAnnotationsExecutionResult>; void ExecuteModelWithEntries(UserAnnotationsEntries entries); @@ -81,7 +82,7 @@ GURL url_; std::string title_; - optimization_guide::proto::AXTreeUpdate ax_tree_update_; + optimization_guide::proto::features::AXTreeUpdate ax_tree_update_; std::unique_ptr<autofill::FormStructure> form_; ImportFormCallback callback_;
diff --git a/components/user_annotations/test_user_annotations_service.cc b/components/user_annotations/test_user_annotations_service.cc index 930b251..e6a25a1e 100644 --- a/components/user_annotations/test_user_annotations_service.cc +++ b/components/user_annotations/test_user_annotations_service.cc
@@ -25,7 +25,7 @@ void TestUserAnnotationsService::RemoveEntry(EntryID entry_id, base::OnceClosure callback) { size_t count = 0; - for (const optimization_guide::proto::UserAnnotationsEntry& entry : + for (const optimization_guide::proto::features::UserAnnotationsEntry& entry : entries_) { if (entry_id == entry.entry_id()) { entries_.erase(entries_.begin() + count); @@ -44,14 +44,14 @@ void TestUserAnnotationsService::AddFormSubmission( const GURL& url, const std::string& title, - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, std::unique_ptr<autofill::FormStructure> form, ImportFormCallback callback) { if (should_import_form_data_) { int64_t entry_id = 0; for (const std::unique_ptr<autofill::AutofillField>& field : form->fields()) { - optimization_guide::proto::UserAnnotationsEntry entry; + optimization_guide::proto::features::UserAnnotationsEntry entry; entry.set_entry_id(entry_id++); entry.set_key(base::UTF16ToUTF8(field->label())); entry.set_value(
diff --git a/components/user_annotations/test_user_annotations_service.h b/components/user_annotations/test_user_annotations_service.h index 876e1eb8..439416a 100644 --- a/components/user_annotations/test_user_annotations_service.h +++ b/components/user_annotations/test_user_annotations_service.h
@@ -15,9 +15,9 @@ class FormStructure; } -namespace optimization_guide::proto { +namespace optimization_guide::proto::features { class UserAnnotationsEntry; -} // namespace optimization_guide::proto +} // namespace optimization_guide::proto::features namespace user_annotations { @@ -43,11 +43,12 @@ // UserAnnotationsService: bool ShouldAddFormSubmissionForURL(const GURL& url) override; - void AddFormSubmission(const GURL& url, - const std::string& title, - optimization_guide::proto::AXTreeUpdate ax_tree_update, - std::unique_ptr<autofill::FormStructure> form, - ImportFormCallback callback) override; + void AddFormSubmission( + const GURL& url, + const std::string& title, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, + std::unique_ptr<autofill::FormStructure> form, + ImportFormCallback callback) override; void RetrieveAllEntries( base::OnceCallback<void(UserAnnotationsEntries)> callback) override; void RemoveEntry(EntryID entry_id, base::OnceClosure callback) override; @@ -75,7 +76,8 @@ private: // An in-memory representation of the "database" of user annotation entries. - std::vector<optimization_guide::proto::UserAnnotationsEntry> entries_; + std::vector<optimization_guide::proto::features::UserAnnotationsEntry> + entries_; // Used in `AddFormSubmission()` to decide if form data should be imported. bool should_import_form_data_ = true;
diff --git a/components/user_annotations/user_annotations_database.cc b/components/user_annotations/user_annotations_database.cc index a20fd1d..db54b6c 100644 --- a/components/user_annotations/user_annotations_database.cc +++ b/components/user_annotations/user_annotations_database.cc
@@ -174,7 +174,7 @@ sql::Statement statement( db_.GetCachedStatement(SQL_FROM_HERE, kSqlSelectAllEntries)); while (statement.Step()) { - optimization_guide::proto::UserAnnotationsEntry entry; + optimization_guide::proto::features::UserAnnotationsEntry entry; entry.set_entry_id(statement.ColumnInt64(0)); entry.set_key(statement.ColumnString(1)); auto decrypted_value = encryptor_.DecryptData(statement.ColumnBlob(2));
diff --git a/components/user_annotations/user_annotations_database_unittest.cc b/components/user_annotations/user_annotations_database_unittest.cc index 8808573..15b61975 100644 --- a/components/user_annotations/user_annotations_database_unittest.cc +++ b/components/user_annotations/user_annotations_database_unittest.cc
@@ -17,7 +17,7 @@ namespace user_annotations { using ::base::test::EqualsProto; -using ::optimization_guide::proto::UserAnnotationsEntry; +using ::optimization_guide::proto::features::UserAnnotationsEntry; using ::testing::UnorderedElementsAre; UserAnnotationsEntry CreateUserAnnotationsEntry(const std::string& key,
diff --git a/components/user_annotations/user_annotations_service.cc b/components/user_annotations/user_annotations_service.cc index ba9ccd7b..ab59a08d7 100644 --- a/components/user_annotations/user_annotations_service.cc +++ b/components/user_annotations/user_annotations_service.cc
@@ -109,7 +109,7 @@ if (entry_value.empty()) { continue; } - optimization_guide::proto::UserAnnotationsEntry entry_proto; + optimization_guide::proto::features::UserAnnotationsEntry entry_proto; entry_proto.set_key(entry_key); entry_proto.set_value(std::move(entry_value)); entries.emplace_back(std::move(entry_proto)); @@ -173,7 +173,7 @@ void UserAnnotationsService::AddFormSubmission( const GURL& url, const std::string& title, - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, std::unique_ptr<autofill::FormStructure> form, ImportFormCallback callback) { // `form` is assumed to never be `nullptr`. @@ -220,7 +220,8 @@ } void UserAnnotationsService::InitializeFormsAnnotationsFromCommandLine( - const optimization_guide::proto::FormsAnnotationsResponse& manual_entries) { + const optimization_guide::proto::features::FormsAnnotationsResponse& + manual_entries) { SaveEntries(manual_entries); } @@ -231,7 +232,8 @@ } void UserAnnotationsService::SaveEntries( - const optimization_guide::proto::FormsAnnotationsResponse& entries) { + const optimization_guide::proto::features::FormsAnnotationsResponse& + entries) { DCHECK(user_annotations_database_); UserAnnotationsEntries upserted_entries = UserAnnotationsEntries(
diff --git a/components/user_annotations/user_annotations_service.h b/components/user_annotations/user_annotations_service.h index 44f1596..8b54c3a 100644 --- a/components/user_annotations/user_annotations_service.h +++ b/components/user_annotations/user_annotations_service.h
@@ -69,7 +69,7 @@ virtual void AddFormSubmission( const GURL& url, const std::string& title, - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, std::unique_ptr<autofill::FormStructure> form, ImportFormCallback callback); @@ -123,7 +123,7 @@ bool success); void InitializeFormsAnnotationsFromCommandLine( - const optimization_guide::proto::FormsAnnotationsResponse& + const optimization_guide::proto::features::FormsAnnotationsResponse& manual_entries); // Returns whether the database initialization is complete. @@ -134,7 +134,8 @@ // Saves the entries to database. void SaveEntries( - const optimization_guide::proto::FormsAnnotationsResponse& entries); + const optimization_guide::proto::features::FormsAnnotationsResponse& + entries); // Called when the form submission is fully complete. void OnFormSubmissionComplete();
diff --git a/components/user_annotations/user_annotations_service_unittest.cc b/components/user_annotations/user_annotations_service_unittest.cc index 3ae4200..21cda56 100644 --- a/components/user_annotations/user_annotations_service_unittest.cc +++ b/components/user_annotations/user_annotations_service_unittest.cc
@@ -84,7 +84,7 @@ } UserAnnotationsEntries AddAndImportFormSubmission( - optimization_guide::proto::AXTreeUpdate ax_tree_update, + optimization_guide::proto::features::AXTreeUpdate ax_tree_update, const autofill::FormData& form_data) { UserAnnotationsEntries entries; std::unique_ptr<autofill::FormStructure> form = @@ -172,7 +172,7 @@ struct FormsAnnotationsTestRequest { optimization_guide::proto::Any forms_annotations_response; - optimization_guide::proto::AXTreeUpdate ax_tree; + optimization_guide::proto::features::AXTreeUpdate ax_tree; autofill::FormData form_data; GURL url; std::string title; @@ -195,9 +195,9 @@ {0, "label", "whatever"}, {0, "nolabel", "value"}, }) { - optimization_guide::proto::FormsAnnotationsResponse response; + optimization_guide::proto::features::FormsAnnotationsResponse response; for (const auto& entry : response_upserted_entries) { - optimization_guide::proto::UserAnnotationsEntry* new_entry = + optimization_guide::proto::features::UserAnnotationsEntry* new_entry = response.add_upserted_entries(); new_entry->set_entry_id(entry.entry_id); new_entry->set_key(entry.key); @@ -214,7 +214,7 @@ } autofill::FormData form_data; form_data.set_fields(form_fields); - optimization_guide::proto::AXTreeUpdate ax_tree; + optimization_guide::proto::features::AXTreeUpdate ax_tree; ax_tree.mutable_tree_data()->set_title("title"); return {optimization_guide::AnyWrapProto(response), ax_tree, form_data, @@ -225,30 +225,31 @@ { base::HistogramTester histogram_tester; - optimization_guide::proto::FormsAnnotationsRequest expected_request; + optimization_guide::proto::features::FormsAnnotationsRequest + expected_request; expected_request.mutable_page_context() ->mutable_ax_tree_data() ->mutable_tree_data() ->set_title("title"); expected_request.mutable_page_context()->set_title("title"); - optimization_guide::proto::FormData* form_proto = + optimization_guide::proto::features::FormData* form_proto = expected_request.mutable_form_data(); - optimization_guide::proto::FormFieldData* field_proto1 = + optimization_guide::proto::features::FormFieldData* field_proto1 = form_proto->add_fields(); field_proto1->set_field_label("label"); field_proto1->set_field_value("whatever"); field_proto1->set_is_visible(true); field_proto1->set_is_focusable(true); field_proto1->set_form_control_type( - optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_TEXT); - optimization_guide::proto::FormFieldData* field_proto2 = + optimization_guide::proto::features::FORM_CONTROL_TYPE_INPUT_TEXT); + optimization_guide::proto::features::FormFieldData* field_proto2 = form_proto->add_fields(); field_proto2->set_field_name("nolabel"); field_proto2->set_field_value("value"); field_proto2->set_is_visible(true); field_proto2->set_is_focusable(true); field_proto2->set_form_control_type( - optimization_guide::proto::FORM_CONTROL_TYPE_INPUT_TEXT); + optimization_guide::proto::features::FORM_CONTROL_TYPE_INPUT_TEXT); auto test_request = CreateSampleFormsAnnotationsTestRequest(); EXPECT_CALL( @@ -283,7 +284,7 @@ { base::HistogramTester histogram_tester; - optimization_guide::proto::FormsAnnotationsResponse response; + optimization_guide::proto::features::FormsAnnotationsResponse response; EXPECT_CALL( *model_executor(), ExecuteModel( @@ -297,7 +298,7 @@ CreateLogEntry())); autofill::FormData empty_form_data; - optimization_guide::proto::AXTreeUpdate ax_tree; + optimization_guide::proto::features::AXTreeUpdate ax_tree; EXPECT_TRUE(AddAndImportFormSubmission(ax_tree, empty_form_data).empty()); @@ -344,7 +345,7 @@ form_field_data2.set_value(u"value"); autofill::FormData form_data; form_data.set_fields({form_field_data, form_field_data2}); - optimization_guide::proto::AXTreeUpdate ax_tree; + optimization_guide::proto::features::AXTreeUpdate ax_tree; EXPECT_TRUE(AddAndImportFormSubmission(ax_tree, form_data).empty()); @@ -378,7 +379,7 @@ form_field_data2.set_value(u"value"); autofill::FormData form_data; form_data.set_fields({form_field_data, form_field_data2}); - optimization_guide::proto::AXTreeUpdate ax_tree; + optimization_guide::proto::features::AXTreeUpdate ax_tree; EXPECT_TRUE(AddAndImportFormSubmission(ax_tree, form_data).empty()); histogram_tester.ExpectUniqueSample( @@ -631,9 +632,9 @@ {0, "label", "whatever"}, {0, "nolabel", "value"}, }; - optimization_guide::proto::FormsAnnotationsResponse response; + optimization_guide::proto::features::FormsAnnotationsResponse response; for (const auto& entry : response_upserted_entries) { - optimization_guide::proto::UserAnnotationsEntry* new_entry = + optimization_guide::proto::features::UserAnnotationsEntry* new_entry = response.add_upserted_entries(); new_entry->set_entry_id(entry.entry_id); new_entry->set_key(entry.key);
diff --git a/components/user_annotations/user_annotations_switches.cc b/components/user_annotations/user_annotations_switches.cc index e8e17bbc..91d9fec 100644 --- a/components/user_annotations/user_annotations_switches.cc +++ b/components/user_annotations/user_annotations_switches.cc
@@ -16,7 +16,7 @@ const char kFormsAnnotationsOverride[] = "user-annotations-forms-annotation-override"; -std::optional<optimization_guide::proto::FormsAnnotationsResponse> +std::optional<optimization_guide::proto::features::FormsAnnotationsResponse> ParseFormsAnnotationsFromCommandLine() { base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); if (!cmd_line->HasSwitch(kFormsAnnotationsOverride)) { @@ -31,8 +31,9 @@ return std::nullopt; } - optimization_guide::proto::FormsAnnotationsResponse forms_annotations = - optimization_guide::proto::FormsAnnotationsResponse(); + optimization_guide::proto::features::FormsAnnotationsResponse + forms_annotations = + optimization_guide::proto::features::FormsAnnotationsResponse(); if (!forms_annotations.ParseFromString(binary_pb)) { LOG(ERROR) << "Invalid proto provided to the Forms Annotation Override";
diff --git a/components/user_annotations/user_annotations_switches.h b/components/user_annotations/user_annotations_switches.h index 3e2e624..cef8629 100644 --- a/components/user_annotations/user_annotations_switches.h +++ b/components/user_annotations/user_annotations_switches.h
@@ -10,7 +10,7 @@ extern const char kFormsAnnotationsOverride[]; -std::optional<optimization_guide::proto::FormsAnnotationsResponse> +std::optional<optimization_guide::proto::features::FormsAnnotationsResponse> ParseFormsAnnotationsFromCommandLine(); } // namespace switches
diff --git a/components/user_annotations/user_annotations_switches_unittest.cc b/components/user_annotations/user_annotations_switches_unittest.cc index f6341b8..dafbdef 100644 --- a/components/user_annotations/user_annotations_switches_unittest.cc +++ b/components/user_annotations/user_annotations_switches_unittest.cc
@@ -31,9 +31,9 @@ {0, "label", "whatever"}, {0, "nolabel", "value"}, }; - optimization_guide::proto::FormsAnnotationsResponse response; + optimization_guide::proto::features::FormsAnnotationsResponse response; for (const auto& entry : response_upserted_entries) { - optimization_guide::proto::UserAnnotationsEntry* new_entry = + optimization_guide::proto::features::UserAnnotationsEntry* new_entry = response.add_upserted_entries(); new_entry->set_entry_id(entry.entry_id); new_entry->set_key(entry.key);
diff --git a/components/user_annotations/user_annotations_types.cc b/components/user_annotations/user_annotations_types.cc index 70f432a5..b160628 100644 --- a/components/user_annotations/user_annotations_types.cc +++ b/components/user_annotations/user_annotations_types.cc
@@ -7,7 +7,8 @@ namespace user_annotations { FormAnnotationResponse::FormAnnotationResponse( - const std::vector<optimization_guide::proto::UserAnnotationsEntry>& + const std::vector< + optimization_guide::proto::features::UserAnnotationsEntry>& to_be_upserted_entries, const std::string& model_execution_id) : to_be_upserted_entries(to_be_upserted_entries),
diff --git a/components/user_annotations/user_annotations_types.h b/components/user_annotations/user_annotations_types.h index 80c4a6d..88565c1 100644 --- a/components/user_annotations/user_annotations_types.h +++ b/components/user_annotations/user_annotations_types.h
@@ -11,7 +11,7 @@ #include "base/types/expected.h" #include "components/optimization_guide/proto/features/common_quality_data.pb.h" -namespace optimization_guide::proto { +namespace optimization_guide::proto::features { class UserAnnotationsEntry; } @@ -23,7 +23,7 @@ typedef int64_t EntryID; -typedef std::vector<optimization_guide::proto::UserAnnotationsEntry> +typedef std::vector<optimization_guide::proto::features::UserAnnotationsEntry> UserAnnotationsEntries; struct Entry { @@ -32,7 +32,7 @@ EntryID entry_id; // The proto for this entry. - optimization_guide::proto::UserAnnotationsEntry entry_proto; + optimization_guide::proto::features::UserAnnotationsEntry entry_proto; }; // Encapsulates the result of various operations with user annotations entries. @@ -50,9 +50,9 @@ kMaxValue = kResponseTimedOut }; -using UserAnnotationsEntryRetrievalResult = - base::expected<std::vector<optimization_guide::proto::UserAnnotationsEntry>, - UserAnnotationsExecutionResult>; +using UserAnnotationsEntryRetrievalResult = base::expected< + std::vector<optimization_guide::proto::features::UserAnnotationsEntry>, + UserAnnotationsExecutionResult>; // Encapsulates the result of user interaction with the prediction improvements // prompt. @@ -68,12 +68,13 @@ // Autofill prediction improvements prompt. `model_execution_id` is the server // log id for model execution, and can be sent in any user submitted feedback. struct FormAnnotationResponse { - std::vector<optimization_guide::proto::UserAnnotationsEntry> + std::vector<optimization_guide::proto::features::UserAnnotationsEntry> to_be_upserted_entries; std::string model_execution_id; FormAnnotationResponse( - const std::vector<optimization_guide::proto::UserAnnotationsEntry>& + const std::vector< + optimization_guide::proto::features::UserAnnotationsEntry>& to_be_upserted_entries, const std::string& model_execution_id); ~FormAnnotationResponse();
diff --git a/components/viz/common/quads/shared_quad_state.h b/components/viz/common/quads/shared_quad_state.h index 67136d5..89dc1102 100644 --- a/components/viz/common/quads/shared_quad_state.h +++ b/components/viz/common/quads/shared_quad_state.h
@@ -74,10 +74,10 @@ float opacity = 1.0f; SkBlendMode blend_mode = SkBlendMode::kSrcOver; int sorting_context_id = 0; - // Optionally set by the client with a stable ID for the layer that produced - // the DrawQuad(s). This is used to help identify that DrawQuad(s) in one - // frame came from the same layer as DrawQuads() from a previous frame, even - // if they changed position or other attributes. + // Optionally set by the client as a performance hint for viz with a stable ID + // for the layer that produced the DrawQuad(s). This is used to help identify + // that DrawQuad(s) in one frame came from the same layer as DrawQuads() from + // a previous frame, even if they changed position or other attributes. uint32_t layer_id = 0; // Used by SurfaceAggregator to namespace layer_ids from different clients. uint32_t layer_namespace_id = 0;
diff --git a/components/viz/common/yuv_readback_unittest.cc b/components/viz/common/yuv_readback_unittest.cc index b52f175..5cc53c23 100644 --- a/components/viz/common/yuv_readback_unittest.cc +++ b/components/viz/common/yuv_readback_unittest.cc
@@ -59,8 +59,7 @@ void StartTracing(const std::string& filter) { base::trace_event::TraceLog::GetInstance()->SetEnabled( base::trace_event::TraceConfig(filter, - base::trace_event::RECORD_UNTIL_FULL), - base::trace_event::TraceLog::RECORDING_MODE); + base::trace_event::RECORD_UNTIL_FULL)); } static void TraceDataCB(
diff --git a/components/viz/service/display/overlay_candidate_factory.cc b/components/viz/service/display/overlay_candidate_factory.cc index b9e7c1f0..983b88c 100644 --- a/components/viz/service/display/overlay_candidate_factory.cc +++ b/components/viz/service/display/overlay_candidate_factory.cc
@@ -173,15 +173,13 @@ candidate.overlay_damage_index = sqs->overlay_damage_index.value_or(OverlayCandidate::kInvalidDamageIndex); - if (sqs->layer_id != 0) { - static_assert( - std::is_same<decltype(SharedQuadState::layer_id), uint32_t>::value); - static_assert(std::is_same<decltype(SharedQuadState::layer_namespace_id), - uint32_t>::value); - candidate.aggregated_layer_id = - static_cast<uint64_t>(sqs->layer_id) | - (static_cast<uint64_t>(sqs->layer_namespace_id) << 32); - } + static_assert( + std::is_same<decltype(SharedQuadState::layer_id), uint32_t>::value); + static_assert(std::is_same<decltype(SharedQuadState::layer_namespace_id), + uint32_t>::value); + candidate.aggregated_layer_id = + static_cast<uint64_t>(sqs->layer_id) | + (static_cast<uint64_t>(sqs->layer_namespace_id) << 32); auto status = CandidateStatus::kFailQuadNotSupported; switch (quad->material) {
diff --git a/components/viz/service/surfaces/surface.cc b/components/viz/service/surfaces/surface.cc index b665088b..98eadabd 100644 --- a/components/viz/service/surfaces/surface.cc +++ b/components/viz/service/surfaces/surface.cc
@@ -366,6 +366,10 @@ blocking_allocation_groups_.erase(group); if (!activation_dependencies_.empty()) return; + + TRACE_EVENT_NESTABLE_ASYNC_END0("viz", "SurfaceQueuedPending", + TRACE_ID_LOCAL(this)); + // All blockers have been cleared. The surface can be activated now. ActivatePendingFrame(); }
diff --git a/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2ApiTestHelper.java b/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2ApiTestHelper.java index 9e4ddc7d..d303bf70 100644 --- a/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2ApiTestHelper.java +++ b/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2ApiTestHelper.java
@@ -357,47 +357,47 @@ // API. private static final byte[] TEST_SERIALIZED_CREDMAN_MAKE_CREDENTIAL_RESPONSE = new byte[] { - 72, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 7, 0, 0, 80, 1, 0, - 0, 0, 0, 0, 0, 24, 2, 0, 0, 0, 0, 0, 0, 32, 2, 0, 0, 0, 0, 0, 0, -120, 2, 0, 0, 0, - 0, 0, 0, -7, -1, -1, -1, 0, 0, 0, 0, -32, 2, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 10, 0, 0, 0, 100, 71, 86, 122, 100, 67, 66, 112, 90, - 65, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 7, 0, 0, 0, 116, 101, 115, 116, 32, 105, 100, 0, - 29, 0, 0, 0, 21, 0, 0, 0, 116, 101, 115, 116, 32, 99, 108, 105, 101, 110, 116, 32, - 100, 97, 116, 97, 32, 106, 115, 111, 110, 0, 0, 0, -84, 0, 0, 0, -92, 0, 0, 0, 38, - -67, 114, 120, -66, 70, 55, 97, -15, -6, -95, -79, 10, -76, -60, -8, 38, 112, 38, - -100, 65, 12, 114, 106, 31, -42, -32, 88, 85, -31, -101, 70, 93, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 4, 39, -87, 1, 40, -18, -125, -48, - -113, 47, -87, -70, -109, -77, 47, 127, -101, -88, 33, 99, -79, 9, 37, -60, 106, 84, - 45, -13, -85, -100, 110, -106, -91, 1, 2, 3, 38, 32, 1, 33, 88, 32, -106, 69, -16, - 93, -31, 55, -104, -40, 99, 78, 82, -106, -67, 23, -9, -81, -77, 94, -60, -12, 101, - -83, 126, 101, 120, -24, 68, -18, -67, -71, 18, -11, 34, 88, 32, -15, -109, -116, - 37, 54, -96, 60, 39, -27, -13, 54, 117, -97, 126, -86, -60, 15, 37, 32, -29, -122, - -67, -102, -25, -44, 38, -95, 7, -47, -66, 12, 2, 0, 0, 0, 0, -54, 0, 0, 0, -62, 0, - 0, 0, -93, 99, 102, 109, 116, 100, 110, 111, 110, 101, 103, 97, 116, 116, 83, 116, - 109, 116, -96, 104, 97, 117, 116, 104, 68, 97, 116, 97, 88, -92, 38, -67, 114, 120, - -66, 70, 55, 97, -15, -6, -95, -79, 10, -76, -60, -8, 38, 112, 38, -100, 65, 12, - 114, 106, 31, -42, -32, 88, 85, -31, -101, 70, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 4, 39, -87, 1, 40, -18, -125, -48, -113, 47, -87, - -70, -109, -77, 47, 127, -101, -88, 33, 99, -79, 9, 37, -60, 106, 84, 45, -13, -85, - -100, 110, -106, -91, 1, 2, 3, 38, 32, 1, 33, 88, 32, -106, 69, -16, 93, -31, 55, - -104, -40, 99, 78, 82, -106, -67, 23, -9, -81, -77, 94, -60, -12, 101, -83, 126, - 101, 120, -24, 68, -18, -67, -71, 18, -11, 34, 88, 32, -15, -109, -116, 37, 54, -96, - 60, 39, -27, -13, 54, 117, -97, 126, -86, -60, 15, 37, 32, -29, -122, -67, -102, - -25, -44, 38, -95, 7, -47, -66, 12, 2, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, - 0, 32, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 99, 0, 0, 0, 91, 0, 0, 0, 48, 89, 48, 19, 6, 7, 42, -122, - 72, -50, 61, 2, 1, 6, 8, 42, -122, 72, -50, 61, 3, 1, 7, 3, 66, 0, 4, -106, 69, -16, - 93, -31, 55, -104, -40, 99, 78, 82, -106, -67, 23, -9, -81, -77, 94, -60, -12, 101, - -83, 126, 101, 120, -24, 68, -18, -67, -71, 18, -11, -15, -109, -116, 37, 54, -96, - 60, 39, -27, -13, 54, 117, -97, 126, -86, -60, 15, 37, 32, -29, -122, -67, -102, - -25, -44, 38, -95, 7, -47, -66, 12, 2, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 8, 0, - 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, - 0, 0, 0, 11, 0, 0, 0, 3, 0, 0, 0, 0, 16, -125, 0, 0, 0, 0, 0, 11, 0, 0, 0, 3, 0, 0, - 0, 16, 81, -121, 0, 0, 0, 0, 0 + 80, 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 7, 0, 0, 88, 1, 0, + 0, 0, 0, 0, 0, 32, 2, 0, 0, 0, 0, 0, 0, 40, 2, 0, 0, 0, 0, 0, 0, -112, 2, 0, 0, 0, + 0, 0, 0, -7, -1, -1, -1, 0, 0, 0, 0, -24, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 40, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 10, 0, 0, 0, 100, 71, 86, + 122, 100, 67, 66, 112, 90, 65, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 7, 0, 0, 0, 116, 101, + 115, 116, 32, 105, 100, 0, 29, 0, 0, 0, 21, 0, 0, 0, 116, 101, 115, 116, 32, 99, + 108, 105, 101, 110, 116, 32, 100, 97, 116, 97, 32, 106, 115, 111, 110, 0, 0, 0, -84, + 0, 0, 0, -92, 0, 0, 0, 38, -67, 114, 120, -66, 70, 55, 97, -15, -6, -95, -79, 10, + -76, -60, -8, 38, 112, 38, -100, 65, 12, 114, 106, 31, -42, -32, 88, 85, -31, -101, + 70, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 4, 39, + -87, 1, 40, -18, -125, -48, -113, 47, -87, -70, -109, -77, 47, 127, -101, -88, 33, + 99, -79, 9, 37, -60, 106, 84, 45, -13, -85, -100, 110, -106, -91, 1, 2, 3, 38, 32, + 1, 33, 88, 32, -106, 69, -16, 93, -31, 55, -104, -40, 99, 78, 82, -106, -67, 23, -9, + -81, -77, 94, -60, -12, 101, -83, 126, 101, 120, -24, 68, -18, -67, -71, 18, -11, + 34, 88, 32, -15, -109, -116, 37, 54, -96, 60, 39, -27, -13, 54, 117, -97, 126, -86, + -60, 15, 37, 32, -29, -122, -67, -102, -25, -44, 38, -95, 7, -47, -66, 12, 2, 0, 0, + 0, 0, -54, 0, 0, 0, -62, 0, 0, 0, -93, 99, 102, 109, 116, 100, 110, 111, 110, 101, + 103, 97, 116, 116, 83, 116, 109, 116, -96, 104, 97, 117, 116, 104, 68, 97, 116, 97, + 88, -92, 38, -67, 114, 120, -66, 70, 55, 97, -15, -6, -95, -79, 10, -76, -60, -8, + 38, 112, 38, -100, 65, 12, 114, 106, 31, -42, -32, 88, 85, -31, -101, 70, 93, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 4, 39, -87, 1, 40, -18, + -125, -48, -113, 47, -87, -70, -109, -77, 47, 127, -101, -88, 33, 99, -79, 9, 37, + -60, 106, 84, 45, -13, -85, -100, 110, -106, -91, 1, 2, 3, 38, 32, 1, 33, 88, 32, + -106, 69, -16, 93, -31, 55, -104, -40, 99, 78, 82, -106, -67, 23, -9, -81, -77, 94, + -60, -12, 101, -83, 126, 101, 120, -24, 68, -18, -67, -71, 18, -11, 34, 88, 32, -15, + -109, -116, 37, 54, -96, 60, 39, -27, -13, 54, 117, -97, 126, -86, -60, 15, 37, 32, + -29, -122, -67, -102, -25, -44, 38, -95, 7, -47, -66, 12, 2, 0, 0, 0, 0, 0, 0, 12, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 40, 0, 0, 0, 32, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 99, 0, 0, 0, 91, 0, 0, 0, 48, 89, + 48, 19, 6, 7, 42, -122, 72, -50, 61, 2, 1, 6, 8, 42, -122, 72, -50, 61, 3, 1, 7, 3, + 66, 0, 4, -106, 69, -16, 93, -31, 55, -104, -40, 99, 78, 82, -106, -67, 23, -9, -81, + -77, 94, -60, -12, 101, -83, 126, 101, 120, -24, 68, -18, -67, -71, 18, -11, -15, + -109, -116, 37, 54, -96, 60, 39, -27, -13, 54, 117, -97, 126, -86, -60, 15, 37, 32, + -29, -122, -67, -102, -25, -44, 38, -95, 7, -47, -66, 12, 2, 0, 0, 0, 0, 0, 16, 0, + 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, + 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 3, 0, 0, 0, 0, 16, -125, 0, 0, 0, 0, + 0, 11, 0, 0, 0, 3, 0, 0, 0, 16, 81, -121, 0, 0, 0, 0, 0 }; // Serialized assertion response converted from JSON received from the Credential Manager API.
diff --git a/components/webauthn/json/value_conversions_unittest.cc b/components/webauthn/json/value_conversions_unittest.cc index 2ba72fa0..f22a6a3e 100644 --- a/components/webauthn/json/value_conversions_unittest.cc +++ b/components/webauthn/json/value_conversions_unittest.cc
@@ -334,7 +334,8 @@ /*supports_large_blob=*/true, /*supplemental_pub_keys=*/ blink::mojom::SupplementalPubKeysResponse::New( - std::vector<std::vector<uint8_t>>({{0, 16, 131}, {16, 81, 135}}))); + std::vector<std::vector<uint8_t>>({{0, 16, 131}, {16, 81, 135}})), + /*payment=*/nullptr); EXPECT_EQ(response->info, expected->info); EXPECT_EQ(response->authenticator_attachment,
diff --git a/content/app/content_main.cc b/content/app/content_main.cc index bcd78e5..919bd47f 100644 --- a/content/app/content_main.cc +++ b/content/app/content_main.cc
@@ -345,8 +345,7 @@ ::switches::kTraceToConsole)) { base::trace_event::TraceConfig trace_config = tracing::GetConfigForTraceToConsole(); - base::trace_event::TraceLog::GetInstance()->SetEnabled( - trace_config, base::trace_event::TraceLog::RECORDING_MODE); + base::trace_event::TraceLog::GetInstance()->SetEnabled(trace_config); } }
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 6edd9c52..bc02d82 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -427,8 +427,6 @@ "aggregation_service/aggregatable_report_sender.h", "aggregation_service/aggregation_service.cc", "aggregation_service/aggregation_service.h", - "aggregation_service/aggregation_service_features.cc", - "aggregation_service/aggregation_service_features.h", "aggregation_service/aggregation_service_impl.cc", "aggregation_service/aggregation_service_impl.h", "aggregation_service/aggregation_service_key_fetcher.cc",
diff --git a/content/browser/aggregation_service/aggregation_service_features.cc b/content/browser/aggregation_service/aggregation_service_features.cc deleted file mode 100644 index 8a9a44d..0000000 --- a/content/browser/aggregation_service/aggregation_service_features.cc +++ /dev/null
@@ -1,13 +0,0 @@ -// Copyright 2022 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/aggregation_service/aggregation_service_features.h" - -namespace content { - -BASE_FEATURE(kPrivacySandboxAggregationService, - "PrivacySandboxAggregationService", - base::FEATURE_ENABLED_BY_DEFAULT); - -} // namespace content
diff --git a/content/browser/aggregation_service/aggregation_service_features.h b/content/browser/aggregation_service/aggregation_service_features.h deleted file mode 100644 index d171639..0000000 --- a/content/browser/aggregation_service/aggregation_service_features.h +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright 2022 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_AGGREGATION_SERVICE_AGGREGATION_SERVICE_FEATURES_H_ -#define CONTENT_BROWSER_AGGREGATION_SERVICE_AGGREGATION_SERVICE_FEATURES_H_ - -#include "base/feature_list.h" -#include "base/metrics/field_trial_params.h" -#include "content/common/content_export.h" - -namespace content { - -// Enables the Aggregation Service. See crbug.com/1207974. -CONTENT_EXPORT BASE_DECLARE_FEATURE(kPrivacySandboxAggregationService); - -} // namespace content - -#endif // CONTENT_BROWSER_AGGREGATION_SERVICE_AGGREGATION_SERVICE_FEATURES_H_
diff --git a/content/browser/attribution_reporting/attribution_aggregatable_report_golden_unittest.cc b/content/browser/attribution_reporting/attribution_aggregatable_report_golden_unittest.cc index c31fa84..8f9e4ce5 100644 --- a/content/browser/attribution_reporting/attribution_aggregatable_report_golden_unittest.cc +++ b/content/browser/attribution_reporting/attribution_aggregatable_report_golden_unittest.cc
@@ -30,7 +30,6 @@ #include "components/attribution_reporting/suitable_origin.h" #include "content/browser/aggregation_service/aggregatable_report.h" #include "content/browser/aggregation_service/aggregation_service.h" -#include "content/browser/aggregation_service/aggregation_service_features.h" #include "content/browser/aggregation_service/aggregation_service_impl.h" #include "content/browser/aggregation_service/aggregation_service_test_utils.h" #include "content/browser/aggregation_service/public_key.h"
diff --git a/content/browser/attribution_reporting/attribution_host.cc b/content/browser/attribution_reporting/attribution_host.cc index 02ae634..67be56445 100644 --- a/content/browser/attribution_reporting/attribution_host.cc +++ b/content/browser/attribution_reporting/attribution_host.cc
@@ -17,6 +17,7 @@ #include "base/feature_list.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/strings/strcat.h" #include "base/time/time.h" #include "build/build_config.h" #include "build/buildflag.h" @@ -97,6 +98,15 @@ }; NAVIGATION_HANDLE_USER_DATA_KEY_IMPL(InsecureTaintTracker); +void ClientBounceHistogram(std::string_view user_interaction_type, + std::string_view timeout, + int value) { + base::UmaHistogramCounts100( + base::StrCat({"Conversions.NumDataHostsRegisteredOnClientBounce.", + user_interaction_type, ".", timeout}), + value); +} + } // namespace AttributionHost::AttributionHost(WebContents* web_contents) @@ -148,40 +158,7 @@ return; } - if (primary_main_frame_data_.has_value()) { - // Note that `NavigationHandle::HasUserGesture()` does not capture - // browser-initiated navigations. The negation of - // `NavigationHandle::IsRendererInitiated()` tells us whether the navigation - // is browser-initiated. - bool has_user_gesture = navigation_handle->HasUserGesture() || - !navigation_handle->IsRendererInitiated(); - - // A user gesture indicates no client-redirect. And, we don't consider a - // client-redirect to be a bounce if there was user interaction on the page - // or if we timed out on the client bounce detection timers. - if (!has_user_gesture && !primary_main_frame_data_->has_user_interaction && - primary_main_frame_data_->num_data_hosts_registered > 0) { - CHECK(last_navigation_time_.has_value()); - base::TimeDelta time_since_last_navigation = - base::Time::Now() - *last_navigation_time_; - - if (time_since_last_navigation < base::Seconds(1)) { - base::UmaHistogramCounts100( - "Conversions.NumDataHostsRegisteredOnClientBounce.1s", - primary_main_frame_data_->num_data_hosts_registered); - } - if (time_since_last_navigation < base::Seconds(5)) { - base::UmaHistogramCounts100( - "Conversions.NumDataHostsRegisteredOnClientBounce.5s", - primary_main_frame_data_->num_data_hosts_registered); - } - if (time_since_last_navigation < base::Seconds(10)) { - base::UmaHistogramCounts100( - "Conversions.NumDataHostsRegisteredOnClientBounce.10s", - primary_main_frame_data_->num_data_hosts_registered); - } - } - } + MaybeLogClientBounce(navigation_handle); const auto& impression = navigation_handle->GetImpression(); @@ -273,7 +250,17 @@ void AttributionHost::FrameReceivedUserActivation( RenderFrameHost* render_frame_host) { - // We consider user activation from all frames in the page. + // We consider user activation from all frames in the page. This event tracks + // clicks, taps, types, but not scrolls. + // https://html.spec.whatwg.org/multipage/interaction.html#tracking-user-activation + if (primary_main_frame_data_.has_value()) { + primary_main_frame_data_->has_user_activation = true; + } +} + +void AttributionHost::DidGetUserInteraction(const blink::WebInputEvent& event) { + // This event tracks clicks, taps, types, and scrolls, see + // `IsUserInteractionInputType()`. if (primary_main_frame_data_.has_value()) { primary_main_frame_data_->has_user_interaction = true; } @@ -398,6 +385,74 @@ } } +void AttributionHost::MaybeLogClientBounce( + NavigationHandle* navigation_handle) const { + if (!primary_main_frame_data_.has_value()) { + return; + } + + // Note that `NavigationHandle::HasUserGesture()` does not capture + // browser-initiated navigations. The negation of + // `NavigationHandle::IsRendererInitiated()` tells us whether the navigation + // is browser-initiated. + // + // A user gesture indicates no client-redirect. + if (navigation_handle->HasUserGesture() || + !navigation_handle->IsRendererInitiated()) { + return; + } + + int num_data_hosts_registered = + primary_main_frame_data_->num_data_hosts_registered; + if (num_data_hosts_registered == 0) { + return; + } + + static constexpr std::string_view kUserActivationStr = "UserActivation"; + static constexpr std::string_view kUserInteractionStr = "UserInteraction"; + + static constexpr std::string_view k1sStr = "1s"; + static constexpr std::string_view k5sStr = "5s"; + static constexpr std::string_view k10sStr = "10s"; + + // We don't consider a client-redirect to be a bounce if there was user + // activation/interaction on the page or if we timed out on the client bounce + // detection timers. + CHECK(last_navigation_time_.has_value()); + base::TimeDelta time_since_last_navigation = + base::Time::Now() - *last_navigation_time_; + + if (!primary_main_frame_data_->has_user_activation) { + if (time_since_last_navigation < base::Seconds(1)) { + ClientBounceHistogram(kUserActivationStr, k1sStr, + num_data_hosts_registered); + } + if (time_since_last_navigation < base::Seconds(5)) { + ClientBounceHistogram(kUserActivationStr, k5sStr, + num_data_hosts_registered); + } + if (time_since_last_navigation < base::Seconds(10)) { + ClientBounceHistogram(kUserActivationStr, k10sStr, + num_data_hosts_registered); + } + } + + if (!primary_main_frame_data_->has_user_interaction) { + if (time_since_last_navigation < base::Seconds(1)) { + ClientBounceHistogram(kUserInteractionStr, k1sStr, + num_data_hosts_registered); + } + if (time_since_last_navigation < base::Seconds(5)) { + ClientBounceHistogram(kUserInteractionStr, k5sStr, + num_data_hosts_registered); + } + if (time_since_last_navigation < base::Seconds(10)) { + ClientBounceHistogram(kUserInteractionStr, k10sStr, + num_data_hosts_registered); + } + } +} + // static void AttributionHost::BindReceiver( mojo::PendingAssociatedReceiver<blink::mojom::AttributionHost> receiver,
diff --git a/content/browser/attribution_reporting/attribution_host.h b/content/browser/attribution_reporting/attribution_host.h index 0849960e..993208c92 100644 --- a/content/browser/attribution_reporting/attribution_host.h +++ b/content/browser/attribution_reporting/attribution_host.h
@@ -67,6 +67,7 @@ struct PrimaryMainFrameData { int num_data_hosts_registered = 0; + bool has_user_activation = false; bool has_user_interaction = false; }; @@ -87,9 +88,12 @@ void DidRedirectNavigation(NavigationHandle* navigation_handle) override; void DidFinishNavigation(NavigationHandle* navigation_handle) override; void FrameReceivedUserActivation(RenderFrameHost* render_frame_host) override; + void DidGetUserInteraction(const blink::WebInputEvent& event) override; void NotifyNavigationRegistrationData(NavigationHandle* navigation_handle); + void MaybeLogClientBounce(NavigationHandle* navigation_handle) const; + // Keeps track of navigations for which we can register sources (i.e. All // conditions were met in `DidStartNavigation` and // `DataHostManager::NotifyNavigationRegistrationStarted` was called). This
diff --git a/content/browser/attribution_reporting/attribution_src_browsertest.cc b/content/browser/attribution_reporting/attribution_src_browsertest.cc index 78a2b9ba..9e83a03cd 100644 --- a/content/browser/attribution_reporting/attribution_src_browsertest.cc +++ b/content/browser/attribution_reporting/attribution_src_browsertest.cc
@@ -1530,8 +1530,13 @@ namespace { -constexpr char kNumDataHostsRegisteredOnClientBounce5sMetricName[] = - "Conversions.NumDataHostsRegisteredOnClientBounce.5s"; +constexpr char + kNumDataHostsRegisteredOnClientBounceUserActivation5sMetricName[] = + "Conversions.NumDataHostsRegisteredOnClientBounce.UserActivation.5s"; + +constexpr char + kNumDataHostsRegisteredOnClientBounceUserInteraction5sMetricName[] = + "Conversions.NumDataHostsRegisteredOnClientBounce.UserInteraction.5s"; } // namespace @@ -1562,7 +1567,9 @@ redirected_url)); histograms.ExpectBucketCount( - kNumDataHostsRegisteredOnClientBounce5sMetricName, 1, 1); + kNumDataHostsRegisteredOnClientBounceUserActivation5sMetricName, 1, 1); + histograms.ExpectBucketCount( + kNumDataHostsRegisteredOnClientBounceUserInteraction5sMetricName, 1, 1); } IN_PROC_BROWSER_TEST_P( @@ -1591,8 +1598,10 @@ EXPECT_TRUE(NavigateToURLFromRendererWithoutUserGesture(web_contents(), redirected_url)); - histograms.ExpectTotalCount(kNumDataHostsRegisteredOnClientBounce5sMetricName, - 0); + histograms.ExpectTotalCount( + kNumDataHostsRegisteredOnClientBounceUserActivation5sMetricName, 0); + histograms.ExpectTotalCount( + kNumDataHostsRegisteredOnClientBounceUserInteraction5sMetricName, 0); } IN_PROC_BROWSER_TEST_P( @@ -1620,8 +1629,10 @@ GURL redirected_url(https_server()->GetURL("a.test", "/title2.html")); EXPECT_TRUE(NavigateToURLFromRenderer(web_contents(), redirected_url)); - histograms.ExpectTotalCount(kNumDataHostsRegisteredOnClientBounce5sMetricName, - 0); + histograms.ExpectTotalCount( + kNumDataHostsRegisteredOnClientBounceUserActivation5sMetricName, 0); + histograms.ExpectTotalCount( + kNumDataHostsRegisteredOnClientBounceUserInteraction5sMetricName, 0); } IN_PROC_BROWSER_TEST_P( @@ -1649,8 +1660,10 @@ GURL redirected_url(https_server()->GetURL("a.test", "/title2.html")); EXPECT_TRUE(NavigateToURL(web_contents(), redirected_url)); - histograms.ExpectTotalCount(kNumDataHostsRegisteredOnClientBounce5sMetricName, - 0); + histograms.ExpectTotalCount( + kNumDataHostsRegisteredOnClientBounceUserActivation5sMetricName, 0); + histograms.ExpectTotalCount( + kNumDataHostsRegisteredOnClientBounceUserInteraction5sMetricName, 0); } IN_PROC_BROWSER_TEST_P( @@ -1685,12 +1698,58 @@ redirected_url)); histograms.ExpectTotalCount( - "Conversions.NumDataHostsRegisteredOnClientBounce.1s", 0); + "Conversions.NumDataHostsRegisteredOnClientBounce.UserActivation.1s", 0); + histograms.ExpectTotalCount( + "Conversions.NumDataHostsRegisteredOnClientBounce.UserInteraction.1s", 0); + // Not timed out yet for 5s and 10s. histograms.ExpectBucketCount( - kNumDataHostsRegisteredOnClientBounce5sMetricName, 1, 1); + kNumDataHostsRegisteredOnClientBounceUserActivation5sMetricName, 1, 1); histograms.ExpectBucketCount( - "Conversions.NumDataHostsRegisteredOnClientBounce.10s", 1, 1); + "Conversions.NumDataHostsRegisteredOnClientBounce.UserActivation.10s", 1, + 1); + + histograms.ExpectBucketCount( + kNumDataHostsRegisteredOnClientBounceUserInteraction5sMetricName, 1, 1); + histograms.ExpectBucketCount( + "Conversions.NumDataHostsRegisteredOnClientBounce.UserInteraction.10s", 1, + 1); +} + +IN_PROC_BROWSER_TEST_P( + AttributionSrcBrowserTest, + ScrollAndNavigatedWithoutUserGesture_ClientBounceMetricRecorded) { + base::HistogramTester histograms; + + GURL page_url = + https_server()->GetURL("b.test", "/page_with_impression_creator.html"); + EXPECT_TRUE(NavigateToURL(web_contents(), page_url)); + + GURL register_url = + https_server()->GetURL("c.test", "/register_source_headers.html"); + + base::RunLoop run_loop; + EXPECT_CALL(mock_attribution_manager(), HandleSource) + .Times(1) + .WillOnce([&run_loop]() { run_loop.Quit(); }); + + ExecuteScriptAsyncWithoutUserGesture( + web_contents(), JsReplace("createAttributionSrcImg($1);", register_url)); + + run_loop.Run(); + + SimulateGestureScrollSequence(web_contents(), gfx::Point(100, 100), + gfx::Vector2dF(0, 15)); + + GURL redirected_url(https_server()->GetURL("a.test", "/title2.html")); + EXPECT_TRUE(NavigateToURLFromRendererWithoutUserGesture(web_contents(), + redirected_url)); + + // Scroll is considered as an user interaction, but not user activation. + histograms.ExpectBucketCount( + kNumDataHostsRegisteredOnClientBounceUserActivation5sMetricName, 1, 1); + histograms.ExpectTotalCount( + kNumDataHostsRegisteredOnClientBounceUserInteraction5sMetricName, 0); } } // namespace content
diff --git a/content/browser/payments/stub_payment_credential.cc b/content/browser/payments/stub_payment_credential.cc index 4d9a8ab1d..03d05ab 100644 --- a/content/browser/payments/stub_payment_credential.cc +++ b/content/browser/payments/stub_payment_credential.cc
@@ -4,6 +4,8 @@ #include "content/browser/payments/stub_payment_credential.h" +#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h" + namespace content { void StubPaymentCredential::Create( @@ -34,4 +36,14 @@ payments::mojom::PaymentCredentialStorageStatus::SUCCESS); } +void StubPaymentCredential::MakePaymentCredential( + blink::mojom::PublicKeyCredentialCreationOptionsPtr options, + MakePaymentCredentialCallback callback) { + // This method on this stub is not implemented. + std::move(callback).Run( + blink::mojom::AuthenticatorStatus::UNKNOWN_ERROR, + /*make_credential_authenticator_response_ptr=*/nullptr, + /*webauthn_dom_exception_details_ptr=*/nullptr); +} + } // namespace content
diff --git a/content/browser/payments/stub_payment_credential.h b/content/browser/payments/stub_payment_credential.h index aa7efb9..5f9718a 100644 --- a/content/browser/payments/stub_payment_credential.h +++ b/content/browser/payments/stub_payment_credential.h
@@ -36,6 +36,11 @@ const std::vector<uint8_t>& user_id, StorePaymentCredentialCallback callback) override; + // mojom::PaymentCredential: + void MakePaymentCredential( + blink::mojom::PublicKeyCredentialCreationOptionsPtr options, + MakePaymentCredentialCallback callback) override; + private: StubPaymentCredential( RenderFrameHost& render_frame_host,
diff --git a/content/browser/renderer_host/frame_tree_node.cc b/content/browser/renderer_host/frame_tree_node.cc index 4d5a76c..378b78e 100644 --- a/content/browser/renderer_host/frame_tree_node.cc +++ b/content/browser/renderer_host/frame_tree_node.cc
@@ -811,32 +811,29 @@ // See the "Same-origin Visibility" section in |UserActivationState| class // doc. - if (base::FeatureList::IsEnabled( - features::kUserActivationSameOriginVisibility)) { - const url::Origin& current_origin = - this->current_frame_host()->GetLastCommittedOrigin(); - for (FrameTreeNode* node : frame_tree().Nodes()) { - if (node->current_frame_host()->GetLastCommittedOrigin().IsSameOriginWith( - current_origin)) { - node->current_frame_host()->ActivateUserActivation(notification_type, - sticky_only); - } + const url::Origin& current_origin = + this->current_frame_host()->GetLastCommittedOrigin(); + for (FrameTreeNode* node : frame_tree().Nodes()) { + if (node->current_frame_host()->GetLastCommittedOrigin().IsSameOriginWith( + current_origin)) { + node->current_frame_host()->ActivateUserActivation(notification_type, + sticky_only); } + } - if (base::FeatureList::IsEnabled( - blink::features::kDocumentPictureInPictureUserActivation)) { - // If we own a picture-in-picture window, then also activate same-origin - // frames within the picture-in-picture window. - FrameTree* picture_in_picture_frame_tree = - frame_tree().delegate()->GetOwnedPictureInPictureFrameTree(); - if (picture_in_picture_frame_tree) { - for (FrameTreeNode* node : picture_in_picture_frame_tree->Nodes()) { - if (node->current_frame_host() - ->GetLastCommittedOrigin() - .IsSameOriginWith(current_origin)) { - node->current_frame_host()->ActivateUserActivation( - notification_type, sticky_only); - } + if (base::FeatureList::IsEnabled( + blink::features::kDocumentPictureInPictureUserActivation)) { + // If we own a picture-in-picture window, then also activate same-origin + // frames within the picture-in-picture window. + FrameTree* picture_in_picture_frame_tree = + frame_tree().delegate()->GetOwnedPictureInPictureFrameTree(); + if (picture_in_picture_frame_tree) { + for (FrameTreeNode* node : picture_in_picture_frame_tree->Nodes()) { + if (node->current_frame_host() + ->GetLastCommittedOrigin() + .IsSameOriginWith(current_origin)) { + node->current_frame_host()->ActivateUserActivation(notification_type, + sticky_only); } } }
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index f87d198..5ba7d5f 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -6538,6 +6538,9 @@ this, IsPrerenderedPageActivation() ? MakeDidCommitProvisionalLoadParamsForPrerenderActivation() : MakeDidCommitProvisionalLoadParamsForBFCacheRestore()); + + // DO NOT ADD CODE AFTER THIS, as the NavigationRequest might have been + // deleted by the previous call. } void NavigationRequest::SetExpectedProcess(
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc index 97004bc..aa6c306 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc
@@ -1764,6 +1764,10 @@ // is safe. if (ShouldQueueNavigationsWhenPendingCommitRFHExists() && request->ShouldQueueDueToExistingPendingCommitRFH()) { + AppendReason(reason, "GetFrameHostForNavigation / navigation-queuing"); + TRACE_EVENT_INSTANT("navigation", + "RenderFrameHostManager::GetFrameHostForNavigation", + "reason", reason); return base::unexpected( GetFrameHostForNavigationFailed::kBlockedByPendingCommit); } @@ -1792,6 +1796,9 @@ } if (defer_action != DeferSpeculativeRFHAction::kNotDeferred) { AppendReason(reason, "GetFrameHostForNavigation / intentional-defer"); + TRACE_EVENT_INSTANT("navigation", + "RenderFrameHostManager::GetFrameHostForNavigation", + "reason", reason); return base::unexpected( GetFrameHostForNavigationFailed::kIntentionalDefer); } @@ -1961,6 +1968,11 @@ navigation_rfh->lifecycle_state())); if (!ReinitializeMainRenderFrame(navigation_rfh)) { + AppendReason(reason, + "GetFrameHostForNavigation / main-frame-not-reinitialized"); + TRACE_EVENT_INSTANT("navigation", + "RenderFrameHostManager::GetFrameHostForNavigation", + "reason", reason); return base::unexpected( GetFrameHostForNavigationFailed::kCouldNotReinitializeMainFrame); } @@ -2063,6 +2075,9 @@ } } + TRACE_EVENT_INSTANT("navigation", + "RenderFrameHostManager::GetFrameHostForNavigation", + "reason", reason); return navigation_rfh; } @@ -2936,6 +2951,9 @@ dest_url_info, source_instance, current_instance, dest_instance, transition, error_page_process, is_same_site, *should_swap_result, was_server_redirect, reason); + TRACE_EVENT_INSTANT("navigation", + "RenderFrameHostManager::GetSiteInstanceForNavigation", + "DetermineSiteInstanceForURL_reason", reason); scoped_refptr<SiteInstanceImpl> new_instance = ConvertToSiteInstance( new_instance_descriptor, candidate_instance, source_instance);
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index a9be416..c8c0c2c 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -333,8 +333,9 @@ #endif // the global list of all renderer processes -base::IDMap<RenderProcessHost*>& GetAllHosts() { - static base::NoDestructor<base::IDMap<RenderProcessHost*>> s_all_hosts; +base::IDMap<RenderProcessHost*, ChildProcessId>& GetAllHosts() { + static base::NoDestructor<base::IDMap<RenderProcessHost*, ChildProcessId>> + s_all_hosts; return *s_all_hosts; } @@ -675,8 +676,8 @@ } void IncrementSiteProcessCount(const SiteInfo& site_info, - int render_process_host_id) { - std::map<ProcessID, Count>& counts_per_process = map_[site_info]; + ChildProcessId render_process_host_id) { + ChildProcessIdCountMap& counts_per_process = map_[site_info]; ++counts_per_process[render_process_host_id]; #ifndef NDEBUG @@ -689,10 +690,10 @@ } void DecrementSiteProcessCount(const SiteInfo& site_info, - int render_process_host_id) { + ChildProcessId render_process_host_id) { auto result = map_.find(site_info); CHECK(result != map_.end(), base::NotFatalUntil::M130); - std::map<ProcessID, Count>& counts_per_process = result->second; + ChildProcessIdCountMap& counts_per_process = result->second; --counts_per_process[render_process_host_id]; DCHECK_GE(counts_per_process[render_process_host_id], 0); @@ -713,7 +714,7 @@ if (result == map_.end()) return; - std::map<ProcessID, Count>& counts_per_process = result->second; + ChildProcessIdCountMap& counts_per_process = result->second; for (auto iter : counts_per_process) { auto* host = RenderProcessHost::FromID(iter.first); if (!host) { @@ -768,7 +769,7 @@ // "about:" in that case. This looks like a bug that needs to be fixed! if (!SiteInstance::ShouldAssignSiteForURL(iter.first.site_url()) && !iter.first.site_url().IsAboutBlank() && - base::Contains(iter.second, host->GetDeprecatedID())) { + base::Contains(iter.second, host->GetID())) { return true; } } @@ -776,9 +777,9 @@ } // Removes |render_process_host_id| from all sites in |map_|. - void ClearProcessForAllSites(int render_process_host_id) { + void ClearProcessForAllSites(ChildProcessId render_process_host_id) { for (auto iter = map_.begin(); iter != map_.end();) { - std::map<ProcessID, Count>& counts_per_process = iter->second; + ChildProcessIdCountMap& counts_per_process = iter->second; counts_per_process.erase(render_process_host_id); // If the site is mapped to no more processes, remove it. iter = counts_per_process.empty() ? map_.erase(iter) : ++iter; @@ -797,7 +798,7 @@ bool is_locked_to_site = host->GetProcessLock().is_locked_to_site(); output += base::StringPrintf("\tProcess Host ID %d (PID %s, %s):\n", - host_info.first, + host_info.first.GetUnsafeValue(), GetRendererPidAsString(host).c_str(), is_locked_to_site ? "locked" : "not locked"); @@ -811,7 +812,8 @@ // Returns true if |site_info| is present in |map_| and has // |render_process_host_id| in its map of processes that it is hosted by. - bool Contains(const SiteInfo& site_info, int render_process_host_id) { + bool Contains(const SiteInfo& site_info, + ChildProcessId render_process_host_id) { auto site_info_found = map_.find(site_info); if (site_info_found == map_.end()) return false; @@ -821,7 +823,7 @@ } // Returns true if |render_process_host_id| is present for any site in |map_|. - bool ContainsHost(int render_process_host_id) { + bool ContainsHost(ChildProcessId render_process_host_id) { for (auto iter : map_) { const auto& counts_per_process = iter.second; if (counts_per_process.find(render_process_host_id) != @@ -833,9 +835,10 @@ } private: - using ProcessID = int; using Count = int; - using HostIdToSiteMap = base::flat_map<ProcessID, std::vector<std::string>>; + using HostIdToSiteMap = + base::flat_map<ChildProcessId, std::vector<std::string>>; + using ChildProcessIdCountMap = std::map<ChildProcessId, Count>; // Creates a new mapping of the ProcessID to sites and their count based on // the current map_. @@ -847,14 +850,14 @@ rph_to_sites_map.reserve(RenderProcessHostImpl::GetProcessCount()); for (auto iter(RenderProcessHost::AllHostsIterator()); !iter.IsAtEnd(); iter.Advance()) { - rph_to_sites_map[iter.GetCurrentValue()->GetDeprecatedID()]; + rph_to_sites_map[iter.GetCurrentValue()->GetID()]; } for (auto iter : map_) { std::string site = iter.first.GetDebugString(); - std::map<ProcessID, Count>& counts_per_process = iter.second; + ChildProcessIdCountMap& counts_per_process = iter.second; for (auto iter_process : counts_per_process) { - ProcessID id = iter_process.first; + ChildProcessId id = iter_process.first; Count count = iter_process.second; rph_to_sites_map[id].push_back( @@ -877,9 +880,9 @@ // map after they've been destroyed. bool HasProcess(RenderProcessHost* process) { for (auto iter : map_) { - std::map<ProcessID, Count>& counts_per_process = iter.second; + ChildProcessIdCountMap& counts_per_process = iter.second; for (auto iter_process : counts_per_process) { - if (iter_process.first == process->GetDeprecatedID()) { + if (iter_process.first == process->GetID()) { return true; } } @@ -888,8 +891,7 @@ } #endif - using CountPerProcessPerSiteMap = - std::map<SiteInfo, std::map<ProcessID, Count>>; + using CountPerProcessPerSiteMap = std::map<SiteInfo, ChildProcessIdCountMap>; CountPerProcessPerSiteMap map_; }; @@ -976,7 +978,7 @@ // Implementation of RenderProcessHostObserver. void RenderProcessHostDestroyed(RenderProcessHost* host) override { DCHECK(HasProcess(host)); - int process_id = host->GetDeprecatedID(); + ChildProcessId process_id = host->GetID(); for (auto it = site_process_set_.begin(); it != site_process_set_.end();) { if (it->second == process_id) { it = site_process_set_.erase(it); @@ -988,16 +990,16 @@ } private: - using ProcessID = int; - using SiteProcessIDPair = std::pair<SiteInfo, ProcessID>; + using SiteProcessIDPair = std::pair<SiteInfo, ChildProcessId>; using SiteProcessIDPairSet = std::set<SiteProcessIDPair>; void RegisterProcessForSite(RenderProcessHost* host, SiteInstanceImpl* site_instance) { if (!HasProcess(host)) host->AddObserver(this); - site_process_set_.insert(SiteProcessIDPair(site_instance->GetSiteInfo(), - host->GetDeprecatedID())); + + site_process_set_.insert( + SiteProcessIDPair(site_instance->GetSiteInfo(), host->GetID())); } RenderProcessHost* TakeFreshestProcessForSite( @@ -1048,10 +1050,9 @@ return std::nullopt; } - // Returns true if this tracker contains the process ID - // |host->GetDeprecatedID()|. + // Returns true if this tracker contains the process ID |host->GetID()|. bool HasProcess(RenderProcessHost* host) const { - int process_id = host->GetDeprecatedID(); + ChildProcessId process_id = host->GetID(); for (const auto& site_process_id : site_process_set_) { if (site_process_id.second == process_id) return true; @@ -1490,7 +1491,7 @@ browser_context); CHECK(!BrowserMainRunner::ExitedMainMessageLoop()); - RegisterHost(GetDeprecatedID(), this); + RegisterHost(GetID(), this); GetAllHosts().set_check_on_null_data(true); // Initialize |child_process_activity_time_| to a reasonable value. mark_child_process_activity_time(); @@ -1594,7 +1595,7 @@ is_dead_ = true; - UnregisterHost(GetDeprecatedID()); + UnregisterHost(GetID()); // Remove the cache handles for the client at teardown if relevant. if (!base::CommandLine::ForCurrentProcess()->HasSwitch( @@ -2272,8 +2273,8 @@ SiteProcessCountTracker::GetInstance( GetBrowserContext(), content::kDelayedShutdownSiteProcessCountTrackerKey); - delayed_shutdown_tracker->IncrementSiteProcessCount(site_info, - GetDeprecatedID()); + + delayed_shutdown_tracker->IncrementSiteProcessCount(site_info, GetID()); } // Don't delay shutdown longer than the maximum delay for renderer process, @@ -2293,7 +2294,8 @@ SiteProcessCountTracker::GetInstance( GetBrowserContext(), content::kDelayedShutdownSiteProcessCountTrackerKey); - return delayed_shutdown_tracker->ContainsHost(GetDeprecatedID()); + + return delayed_shutdown_tracker->ContainsHost(GetID()); } std::string @@ -2978,12 +2980,11 @@ SiteProcessCountTracker* tracker = SiteProcessCountTracker::GetInstance( browser_context, kCommittedSiteProcessCountTrackerKey); - tracker->IncrementSiteProcessCount(site_info, - render_process_host->GetDeprecatedID()); + tracker->IncrementSiteProcessCount(site_info, render_process_host->GetID()); MAYBEVLOG(2) << __func__ << "(" << site_info << "): Site added to process host " - << render_process_host->GetDeprecatedID() << "." << std::endl + << render_process_host->GetID() << "." << std::endl << GetCurrentHostMapDebugString(tracker); } @@ -2997,8 +2998,7 @@ SiteProcessCountTracker* tracker = SiteProcessCountTracker::GetInstance( browser_context, kCommittedSiteProcessCountTrackerKey); - tracker->DecrementSiteProcessCount(site_info, - render_process_host->GetDeprecatedID()); + tracker->DecrementSiteProcessCount(site_info, render_process_host->GetID()); } // static @@ -3011,8 +3011,7 @@ SiteProcessCountTracker* tracker = SiteProcessCountTracker::GetInstance( browser_context, kPendingSiteProcessCountTrackerKey); - tracker->IncrementSiteProcessCount(site_info, - render_process_host->GetDeprecatedID()); + tracker->IncrementSiteProcessCount(site_info, render_process_host->GetID()); } // static @@ -3025,8 +3024,7 @@ SiteProcessCountTracker* tracker = SiteProcessCountTracker::GetInstance( browser_context, kPendingSiteProcessCountTrackerKey); - tracker->DecrementSiteProcessCount(site_info, - render_process_host->GetDeprecatedID()); + tracker->DecrementSiteProcessCount(site_info, render_process_host->GetID()); } // static @@ -4083,7 +4081,7 @@ // Remove ourself from the list of renderer processes so that we can't be // reused in between now and when the Delete task runs. - UnregisterHost(GetDeprecatedID()); + UnregisterHost(GetID()); browser_context_ = nullptr; storage_partition_impl_ = nullptr; } @@ -4202,25 +4200,38 @@ // static void RenderProcessHostImpl::RegisterHost(int host_id, RenderProcessHost* host) { + RenderProcessHostImpl::RegisterHost(ChildProcessId(host_id), host); +} + +// static +void RenderProcessHostImpl::RegisterHost(ChildProcessId host_id, + RenderProcessHost* host) { TRACE_EVENT( "shutdown", "RenderProcessHostImpl::RegisterHost", [&](perfetto::EventContext ctx) { + // TODO(crbug.com/379869738): Refactor to remove GetUnsafeValue. ctx.event<ChromeTrackEvent>()->set_render_process_host()->set_id( - host_id); + host_id.GetUnsafeValue()); }); GetAllHosts().AddWithID(host, host_id); } // static void RenderProcessHostImpl::UnregisterHost(int host_id) { + return UnregisterHost(ChildProcessId(host_id)); +} + +// static +void RenderProcessHostImpl::UnregisterHost(ChildProcessId host_id) { RenderProcessHost* host = GetAllHosts().Lookup(host_id); if (!host) return; TRACE_EVENT( "shutdown", "RenderProcessHostImpl::UnregisterHost", [&](perfetto::EventContext ctx) { + // TODO(crbug.com/379869738): Refactor to remove GetUnsafeValue. ctx.event<ChromeTrackEvent>()->set_render_process_host()->set_id( - host_id); + host_id.GetUnsafeValue()); }); GetAllHosts().Remove(host_id); @@ -4520,12 +4531,12 @@ // static RenderProcessHost* RenderProcessHost::FromID(int render_process_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - return GetAllHosts().Lookup(render_process_id); + return GetAllHosts().Lookup(ChildProcessId(render_process_id)); } RenderProcessHost* RenderProcessHost::FromID(ChildProcessId render_process_id) { CHECK_CURRENTLY_ON(BrowserThread::UI); - return RenderProcessHost::FromID(render_process_id.GetUnsafeValue()); + return GetAllHosts().Lookup(render_process_id); } // static @@ -5559,9 +5570,8 @@ SiteProcessCountTracker::GetInstance( GetBrowserContext(), content::kDelayedShutdownSiteProcessCountTrackerKey); - if (delayed_shutdown_tracker->Contains(site_info, GetDeprecatedID())) { - delayed_shutdown_tracker->DecrementSiteProcessCount(site_info, - GetDeprecatedID()); + if (delayed_shutdown_tracker->Contains(site_info, GetID())) { + delayed_shutdown_tracker->DecrementSiteProcessCount(site_info, GetID()); } } @@ -5581,7 +5591,8 @@ SiteProcessCountTracker::GetInstance( GetBrowserContext(), content::kDelayedShutdownSiteProcessCountTrackerKey); - delayed_shutdown_tracker->ClearProcessForAllSites(GetDeprecatedID()); + + delayed_shutdown_tracker->ClearProcessForAllSites(GetID()); } void RenderProcessHostImpl::BindTracedProcess(
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index 4653d5b..98f2fea 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -51,7 +51,6 @@ #include "components/services/storage/storage_service_impl.h" #include "components/variations/net/variations_http_headers.h" #include "content/browser/aggregation_service/aggregation_service.h" -#include "content/browser/aggregation_service/aggregation_service_features.h" #include "content/browser/aggregation_service/aggregation_service_impl.h" #include "content/browser/attribution_reporting/attribution_manager_impl.h" #include "content/browser/background_fetch/background_fetch_context.h" @@ -1543,10 +1542,8 @@ font_access_manager_ = FontAccessManager::Create(); - if (base::FeatureList::IsEnabled(kPrivacySandboxAggregationService)) { - aggregation_service_ = - std::make_unique<AggregationServiceImpl>(is_in_memory(), path, this); - } + aggregation_service_ = + std::make_unique<AggregationServiceImpl>(is_in_memory(), path, this); #if BUILDFLAG(ENABLE_LIBRARY_CDMS) if (is_in_memory()) {
diff --git a/content/browser/url_loader_factory_params_helper.cc b/content/browser/url_loader_factory_params_helper.cc index 8ac4d341..3a5f6e452 100644 --- a/content/browser/url_loader_factory_params_helper.cc +++ b/content/browser/url_loader_factory_params_helper.cc
@@ -37,21 +37,6 @@ namespace { -// Whether loading state updates to the -// network::mojom::URLLoaderNetworkServiceObserver are inhibited for URLLoaders -// created via URLLoaderFactoryParamsHelper. -// -// network::mojom::URLLoaderNetworkServiceObserver::OnLoadingStateUpdate is -// among the most frequent Mojo messages in traces from the field -// (go/mojos-in-field-traces-2022). Inhibiting the messages has been tested all -// the way to stable with no ill effect and performance gains. -// -// Remove when evaluation of combined performance gains is complete -// crbug.com/1487544. -BASE_FEATURE(kInhibitLoadingStateUpdate, - "InhibitLoadingStateUpdate", - base::FEATURE_ENABLED_BY_DEFAULT); - // Helper used by the public URLLoaderFactoryParamsHelper::Create... methods. // // |origin| is the origin that will use the URLLoaderFactory. @@ -124,12 +109,6 @@ params->trust_token_issuance_policy = trust_token_issuance_policy; params->trust_token_redemption_policy = trust_token_redemption_policy; - // If we have a URLLoaderNetworkObserver, request loading state updates. - if (url_loader_network_observer && - !base::FeatureList::IsEnabled(kInhibitLoadingStateUpdate)) { - params->provide_loading_state_updates = true; - } - GetContentClient()->browser()->OverrideURLLoaderFactoryParams( process->GetBrowserContext(), origin, is_for_isolated_world, params.get());
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 3804a67..9e3129f3 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -275,8 +275,6 @@ #endif {wf::EnableTouchDragAndContextMenu, raw_ref(features::kTouchDragAndContextMenu)}, - {wf::EnableUserActivationSameOriginVisibility, - raw_ref(features::kUserActivationSameOriginVisibility)}, {wf::EnableWebAuthenticationAmbient, raw_ref(device::kWebAuthnAmbientSignin)}, {wf::EnableWebAuthenticationConditionalCreate,
diff --git a/content/public/browser/render_process_host.h b/content/public/browser/render_process_host.h index 58bc7cf8..c26b648 100644 --- a/content/public/browser/render_process_host.h +++ b/content/public/browser/render_process_host.h
@@ -133,7 +133,7 @@ ADVANCED_MEMORY_SAFETY_CHECKS(); public: - using iterator = base::IDMap<RenderProcessHost*>::iterator; + using iterator = base::IDMap<RenderProcessHost*, ChildProcessId>::iterator; // Crash reporting mode for ShutdownForBadMessage. enum class CrashReportMode {
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 62097e9..8a001f5 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -1192,14 +1192,6 @@ base::FEATURE_DISABLED_BY_DEFAULT); #endif -// Allows user activation propagation to all frames having the same origin as -// the activation notifier frame. This is an intermediate measure before we -// have an iframe attribute to declaratively allow user activation propagation -// to subframes. -BASE_FEATURE(kUserActivationSameOriginVisibility, - "UserActivationSameOriginVisibility", - base::FEATURE_ENABLED_BY_DEFAULT); - // Enables comparing browser and renderer's DidCommitProvisionalLoadParams in // RenderFrameHostImpl::VerifyThatBrowserAndRendererCalculatedDidCommitParamsMatch. BASE_FEATURE(kVerifyDidCommitParams,
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index e6315be..36365eab 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -269,7 +269,6 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kUseContextSnapshot); #endif CONTENT_EXPORT BASE_DECLARE_FEATURE(kUnrestrictedSharedArrayBuffer); -CONTENT_EXPORT BASE_DECLARE_FEATURE(kUserActivationSameOriginVisibility); CONTENT_EXPORT BASE_DECLARE_FEATURE(kVerifyDidCommitParams); CONTENT_EXPORT BASE_DECLARE_FEATURE(kV8VmFuture); CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebAppSystemMediaControls);
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java index 462cf91..5615137 100644 --- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java +++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
@@ -177,6 +177,14 @@ } @Override + protected void onStop() { + super.onStop(); + + WebContents webContents = getActiveWebContents(); + if (webContents != null) webContents.updateWebContentsVisibility(Visibility.HIDDEN); + } + + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); mIntentRequestTracker.onActivityResult(requestCode, resultCode, data);
diff --git a/docs/android_build_instructions.md b/docs/android_build_instructions.md index 5d5ce4f..479795cc 100644 --- a/docs/android_build_instructions.md +++ b/docs/android_build_instructions.md
@@ -408,63 +408,31 @@ * Disables non-public code, which exists even when building public targets. * Use this is you do not need to test internal-only things. -### Running Static Analysis Asynchronously +### Asynchronous Static Analysis Normally analysis build steps like Lint and Error Prone will run as normal build steps. The build will then wait for all analysis steps to complete successfully. By offloading analysis build steps to a separate build server to be run lazily at -a low priority when the machine is idle, the actual build can complete much faster. +a low priority, the actual build can complete much faster. **Note**: Since the build completes before the analysis checks finish, the build -will not fail if an analysis check fails. Make sure to check the server's output -at regular intervals to fix outstanding issues caught by these analysis checks. +will not fail if an analysis check fails. -#### First way (by running it manually) +To enable this mode, add the gn args: -There are **two** steps to using the build server. -1. Add the gn arg `android_static_analysis = "build_server"` -2. Run the script at -[//build/android/fast_local_dev_server.py][fast_local_dev] - -All your local builds will now forward analysis steps to this server, including -android lint, errorprone, bytecode processor. - -If you run (2) in a terminal, the output of the checks will be displayed there. - -#### Second way (using systemd) - -Alternatively, you can set up the server as a Linux service, so it runs on the -background and starts on boot. If you're using systemd: - -Save the following as /etc/systemd/user/fast-local-dev-server.service. -``` -[Unit] -Description=Chrome server for android build static analysis - -[Service] -Type=simple -ExecStart=<path to fast_local_dev_server.py> -Restart=always - -[Install] -WantedBy=default.target +```gn +android_static_analysis = "build_server" ``` -Then -```bash -systemctl --user daemon-reload -systemctl --user enable fast-local-dev-server -systemctl --user start fast-local-dev-server +Command output will show up on the terminal that ran the build, as well as in +`out/Debug/buildserver.log.0`. + +See the status of the server at any time via: +``` +build/android/fast_local_dev_server.py --print-status-all ``` -The output can be inspected with -``` -journalctl --user -e -u fast-local-dev-server -``` - -[fast_local_dev]: https://source.chromium.org/chromium/chromium/src/+/main:build/android/fast_local_dev_server.py - -#### Incremental Install +### Incremental Install [Incremental Install](/build/android/incremental_install/README.md) uses reflection and sideloading to speed up the edit & deploy cycle (normally < 10 seconds). The initial launch of the apk will be a lot slower on older Android
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index 73d55af..d563772 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1975,6 +1975,7 @@ ODFSCONFIGPRIVATE_OPENINOFFICEAPP = 1913, COOKIES_GETPARTITIONKEY = 1914, CONTROLLEDFRAMEINTERNAL_SETCLIENTHINTSENABLED = 1915, + DEVELOPERPRIVATE_UPLOADEXTENSIONTOACCOUNT = 1916, // Last entry: Add new entries above, then run: // tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/browser/guest_view/extensions_guest_view.cc b/extensions/browser/guest_view/extensions_guest_view.cc index 9f5e74e..373d375 100644 --- a/extensions/browser/guest_view/extensions_guest_view.cc +++ b/extensions/browser/guest_view/extensions_guest_view.cc
@@ -64,7 +64,8 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); WebViewRendererState::WebViewInfo info; const bool success = WebViewRendererState::GetInstance()->GetInfo( - render_process_id(), frame_id_.frame_routing_id, &info); + // TODO(crbug.com/379869738): Remove GetUnsafeValue + render_process_id().GetUnsafeValue(), frame_id_.frame_routing_id, &info); // GetInfo can fail if the process id does not correspond to a WebView. Those // cases are just defaulted to false. if (!success) {
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index 5f82e467..6fc3e34 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -242,7 +242,7 @@ return zoom_factor; } -using WebViewKey = std::pair<int, int>; +using WebViewKey = std::pair<content::ChildProcessId, int>; using WebViewKeyToIDMap = std::map<WebViewKey, int>; static base::LazyInstance<WebViewKeyToIDMap>::DestructorAtExit web_view_key_to_id_map = LAZY_INSTANCE_INITIALIZER; @@ -260,7 +260,7 @@ // static void WebViewGuest::CleanUp(content::BrowserContext* browser_context, - int embedder_process_id, + content::ChildProcessId embedder_process_id, int view_instance_id) { // Clean up rules registries for the WebView. WebViewKey key(embedder_process_id, view_instance_id); @@ -276,16 +276,21 @@ // Clean up web request event listeners for the WebView. WebRequestEventRouter::Get(browser_context) - ->RemoveWebViewEventListeners(browser_context, embedder_process_id, + // TODO(crbug.com/379869738): remove GetUnsafeValue + ->RemoveWebViewEventListeners(browser_context, + embedder_process_id.GetUnsafeValue(), view_instance_id); // Clean up content scripts for the WebView. auto* csm = WebViewContentScriptManager::Get(browser_context); - csm->RemoveAllContentScriptsForWebView(embedder_process_id, view_instance_id); + // TODO(crbug.com/379869738): remove GetUnsafeValue + csm->RemoveAllContentScriptsForWebView(embedder_process_id.GetUnsafeValue(), + view_instance_id); // Allow an extensions browser client to potentially perform more cleanup. ExtensionsBrowserClient::Get()->CleanUpWebView( - browser_context, embedder_process_id, view_instance_id); + // TODO(crbug.com/379869738): remove GetUnsafeValue + browser_context, embedder_process_id.GetUnsafeValue(), view_instance_id); } // static @@ -318,7 +323,8 @@ if (!is_web_view) return RulesRegistryService::kDefaultRulesRegistryID; - WebViewKey key = std::make_pair(embedder_process_id, webview_instance_id); + WebViewKey key = std::make_pair(content::ChildProcessId(embedder_process_id), + webview_instance_id); auto it = web_view_key_to_id_map.Get().find(key); if (it != web_view_key_to_id_map.Get().end()) return it->second;
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.h b/extensions/browser/guest_view/web_view/web_view_guest.h index 7589572b..47b908b8 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.h +++ b/extensions/browser/guest_view/web_view/web_view_guest.h
@@ -52,7 +52,7 @@ // potentially be created and destroyed in JavaScript before getting a // GuestViewBase instance. static void CleanUp(content::BrowserContext* browser_context, - int embedder_process_id, + content::ChildProcessId embedder_process_id, int view_instance_id); static const char Type[];
diff --git a/extensions/common/api/_api_features.json b/extensions/common/api/_api_features.json index 0abcfcbb..0ea06473 100644 --- a/extensions/common/api/_api_features.json +++ b/extensions/common/api/_api_features.json
@@ -362,6 +362,7 @@ "chrome://help-app/*", "chrome://history/*", "chrome://new-tab-page/*", + "chrome://oobe/*", "chrome://os-settings/*", "chrome://password-manager/*", "chrome://personalization/*",
diff --git a/extensions/common/api/runtime.json b/extensions/common/api/runtime.json index c9db746..723850ef 100644 --- a/extensions/common/api/runtime.json +++ b/extensions/common/api/runtime.json
@@ -298,6 +298,7 @@ "type": "function", "description": "Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.", "parameters": [], + "deprecated": "Background pages do not exist in MV3 extensions.", "returns_async": { "name": "callback", "parameters": [
diff --git a/gin/v8_isolate_memory_dump_provider_unittest.cc b/gin/v8_isolate_memory_dump_provider_unittest.cc index b11eac87..a7eb102 100644 --- a/gin/v8_isolate_memory_dump_provider_unittest.cc +++ b/gin/v8_isolate_memory_dump_provider_unittest.cc
@@ -147,8 +147,7 @@ // Code stats are disabled unless this category is enabled. base::trace_event::TraceLog::GetInstance()->SetEnabled( base::trace_event::TraceConfig( - TRACE_DISABLED_BY_DEFAULT("memory-infra.v8.code_stats"), ""), - base::trace_event::TraceLog::RECORDING_MODE); + TRACE_DISABLED_BY_DEFAULT("memory-infra.v8.code_stats"), "")); base::trace_event::MemoryDumpArgs dump_args = { base::trace_event::MemoryDumpLevelOfDetail::kLight};
diff --git a/gpu/command_buffer/common/shared_image_pool_id.h b/gpu/command_buffer/common/shared_image_pool_id.h index eb00cae..6acab68 100644 --- a/gpu/command_buffer/common/shared_image_pool_id.h +++ b/gpu/command_buffer/common/shared_image_pool_id.h
@@ -16,6 +16,7 @@ class GPU_EXPORT SharedImagePoolId { public: SharedImagePoolId(); + explicit SharedImagePoolId(const base::UnguessableToken& token); // Creates a new SharedImagePoolId with a cryptographically random value. static SharedImagePoolId Create(); @@ -36,8 +37,6 @@ const base::UnguessableToken& GetToken() const { return token_; } private: - explicit SharedImagePoolId(const base::UnguessableToken& token); - // The underlying unguessable token. base::UnguessableToken token_; };
diff --git a/gpu/ipc/common/BUILD.gn b/gpu/ipc/common/BUILD.gn index f00042e5..d3f2d2d 100644 --- a/gpu/ipc/common/BUILD.gn +++ b/gpu/ipc/common/BUILD.gn
@@ -340,6 +340,7 @@ "memory_stats.mojom", "shared_image_capabilities.mojom", "shared_image_metadata.mojom", + "shared_image_pool_id.mojom", "sync_token.mojom", "vulkan_ycbcr_info.mojom", ] @@ -541,6 +542,17 @@ { types = [ { + mojom = "gpu.mojom.SharedImagePoolId" + cpp = "::gpu::SharedImagePoolId" + }, + ] + traits_sources = [ "shared_image_pool_id_mojom_traits.cc" ] + traits_headers = [ "shared_image_pool_id_mojom_traits.h" ] + traits_public_deps = [ ":mojom_traits" ] + }, + { + types = [ + { mojom = "gpu.mojom.SyncToken" cpp = "::gpu::SyncToken" },
diff --git a/gpu/ipc/common/shared_image_pool_id.mojom b/gpu/ipc/common/shared_image_pool_id.mojom new file mode 100644 index 0000000..e7ed050 --- /dev/null +++ b/gpu/ipc/common/shared_image_pool_id.mojom
@@ -0,0 +1,13 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module gpu.mojom; + +import "mojo/public/mojom/base/unguessable_token.mojom"; + +// A Mojom representation of the SharedImagePoolId for IPC serialization. +// see gpu/command_buffer/common/shared_image_pool_id.h. +struct SharedImagePoolId { + mojo_base.mojom.UnguessableToken value; +};
diff --git a/gpu/ipc/common/shared_image_pool_id_mojom_traits.cc b/gpu/ipc/common/shared_image_pool_id_mojom_traits.cc new file mode 100644 index 0000000..b2f6848 --- /dev/null +++ b/gpu/ipc/common/shared_image_pool_id_mojom_traits.cc
@@ -0,0 +1,21 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gpu/ipc/common/shared_image_pool_id_mojom_traits.h" + +namespace mojo { + +bool StructTraits< + gpu::mojom::SharedImagePoolIdDataView, + gpu::SharedImagePoolId>::Read(gpu::mojom::SharedImagePoolIdDataView& input, + gpu::SharedImagePoolId* output) { + base::UnguessableToken token; + if (!input.ReadValue(&token)) { + return false; + } + *output = gpu::SharedImagePoolId(token); + return true; +} + +} // namespace mojo
diff --git a/gpu/ipc/common/shared_image_pool_id_mojom_traits.h b/gpu/ipc/common/shared_image_pool_id_mojom_traits.h new file mode 100644 index 0000000..5251457a --- /dev/null +++ b/gpu/ipc/common/shared_image_pool_id_mojom_traits.h
@@ -0,0 +1,30 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef GPU_IPC_COMMON_SHARED_IMAGE_POOL_ID_MOJOM_TRAITS_H_ +#define GPU_IPC_COMMON_SHARED_IMAGE_POOL_ID_MOJOM_TRAITS_H_ + +#include "gpu/command_buffer/common/shared_image_pool_id.h" +#include "gpu/gpu_export.h" +#include "gpu/ipc/common/shared_image_pool_id.mojom.h" +#include "mojo/public/cpp/base/unguessable_token_mojom_traits.h" +#include "mojo/public/cpp/bindings/struct_traits.h" + +namespace mojo { + +template <> +struct GPU_EXPORT StructTraits<gpu::mojom::SharedImagePoolIdDataView, + gpu::SharedImagePoolId> { + static const base::UnguessableToken& value( + const gpu::SharedImagePoolId& input) { + return input.GetToken(); + } + + static bool Read(gpu::mojom::SharedImagePoolIdDataView& input, + gpu::SharedImagePoolId* output); +}; + +} // namespace mojo + +#endif // GPU_IPC_COMMON_SHARED_IMAGE_POOL_ID_MOJOM_TRAITS_H_
diff --git a/gpu/ipc/service/gpu_init.cc b/gpu/ipc/service/gpu_init.cc index 14e9cb7..ff3655c 100644 --- a/gpu/ipc/service/gpu_init.cc +++ b/gpu/ipc/service/gpu_init.cc
@@ -11,6 +11,7 @@ #include "base/base_paths.h" #include "base/command_line.h" +#include "base/debug/dump_without_crashing.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/memory/raw_ptr.h" @@ -1242,6 +1243,13 @@ LOG(ERROR) << "Failed to create and initialize Vulkan implementation."; vulkan_implementation_ = nullptr; CHECK(!gpu_preferences_.disable_vulkan_fallback_to_gl_for_testing); +#if BUILDFLAG(IS_ANDROID) + if (VulkanInstance::CheckMinVersion()) { + // TODO(crbug.com/381535049): Remove after collecting crash reports + // to see what devices Vulkan initialization is failing on. + base::debug::DumpWithoutCrashing(); + } +#endif } // Vulkan info is no longer collected in gpu/config/gpu_info_collector_win.cc
diff --git a/gpu/vulkan/vulkan_instance.cc b/gpu/vulkan/vulkan_instance.cc index 4979f27e..b405961f 100644 --- a/gpu/vulkan/vulkan_instance.cc +++ b/gpu/vulkan/vulkan_instance.cc
@@ -85,6 +85,16 @@ } // namespace +// TODO(crbug.com/381535049): Remove after collecting crash reports +// to see what devices Vulkan initialization is failing on. +bool VulkanInstance::CheckMinVersion() { + uint32_t vulkan_version = 0; + if (vkEnumerateInstanceVersion(&vulkan_version) != VK_SUCCESS) { + return false; + } + return vulkan_version >= kVulkanRequiredApiVersion; +} + VulkanInstance::VulkanInstance() : is_from_angle_(base::FeatureList::IsEnabled(features::kVulkanFromANGLE)) { }
diff --git a/gpu/vulkan/vulkan_instance.h b/gpu/vulkan/vulkan_instance.h index 6fd8f5c..26d765d9 100644 --- a/gpu/vulkan/vulkan_instance.h +++ b/gpu/vulkan/vulkan_instance.h
@@ -19,6 +19,8 @@ class COMPONENT_EXPORT(VULKAN) VulkanInstance { public: + static bool CheckMinVersion(); + VulkanInstance(); VulkanInstance(const VulkanInstance&) = delete;
diff --git a/infra/config/generated/builders/ci/win-arm64-dbg/targets/chromium.win.json b/infra/config/generated/builders/ci/win-arm64-dbg/targets/chromium.win.json index d65c8df..fc19afd 100644 --- a/infra/config/generated/builders/ci/win-arm64-dbg/targets/chromium.win.json +++ b/infra/config/generated/builders/ci/win-arm64-dbg/targets/chromium.win.json
@@ -17,6 +17,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "absl_hardening_tests", @@ -33,6 +34,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "accessibility_unittests", @@ -49,6 +51,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "angle_unittests", @@ -66,6 +69,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "app_shell_unittests", @@ -82,6 +86,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "aura_unittests", @@ -98,6 +103,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "base_unittests", @@ -114,6 +120,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_common_unittests", @@ -130,6 +137,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_fuzzer_unittests", @@ -146,6 +154,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_heap_unittests", @@ -170,6 +179,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_platform_unittests", @@ -186,6 +196,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_crypto_tests", @@ -202,6 +213,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_ssl_tests", @@ -221,6 +233,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "capture_unittests", @@ -237,6 +250,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cast_unittests", @@ -253,6 +267,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cc_unittests", @@ -269,6 +284,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_app_unittests", @@ -285,6 +301,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_elf_unittests", @@ -301,6 +318,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_unittests", @@ -317,6 +335,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_browsertests", @@ -333,6 +352,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -350,6 +370,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "compositor_unittests", @@ -366,6 +387,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 16 }, @@ -383,6 +405,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_unittests", @@ -399,6 +422,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crashpad_tests", @@ -415,6 +439,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_tests", @@ -431,6 +456,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_unittests", @@ -447,6 +473,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crypto_unittests", @@ -463,6 +490,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "delayloads_unittests", @@ -479,6 +507,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "device_unittests", @@ -495,6 +524,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "display_unittests", @@ -511,6 +541,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevated_tracing_service_unittests", @@ -527,6 +558,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevation_service_unittests", @@ -544,6 +576,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "env_chromium_unittests", @@ -560,6 +593,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "events_unittests", @@ -576,6 +610,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_browsertests", @@ -592,6 +627,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_unittests", @@ -608,6 +644,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "filesystem_service_unittests", @@ -624,6 +661,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "fuzzing_unittests", @@ -640,6 +678,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcm_unit_tests", @@ -656,6 +695,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcp_unittests", @@ -672,6 +712,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gfx_unittests", @@ -688,6 +729,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gin_unittests", @@ -704,6 +746,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "google_apis_unittests", @@ -720,6 +763,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gpu_unittests", @@ -736,6 +780,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gwp_asan_unittests", @@ -752,6 +797,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_browsertests", @@ -768,6 +814,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_unittests", @@ -784,6 +831,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "install_static_unittests", @@ -801,6 +849,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "installer_util_unittests", @@ -817,6 +866,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 9 }, @@ -834,6 +884,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ipc_tests", @@ -850,6 +901,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "latency_unittests", @@ -870,6 +922,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "leveldb_unittests", @@ -886,6 +939,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "libjingle_xmpp_unittests", @@ -902,6 +956,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "liburlpattern_unittests", @@ -918,6 +973,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "media_unittests", @@ -934,6 +990,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "message_center_unittests", @@ -950,6 +1007,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "midi_unittests", @@ -966,6 +1024,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_unittests", @@ -982,6 +1041,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "native_theme_unittests", @@ -998,6 +1058,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "net_unittests", @@ -1014,6 +1075,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "notification_helper_unittests", @@ -1030,6 +1092,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pdf_unittests", @@ -1046,6 +1109,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "perfetto_unittests", @@ -1062,6 +1126,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "printing_unittests", @@ -1079,6 +1144,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pthreadpool_unittests", @@ -1095,6 +1161,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "remoting_unittests", @@ -1112,6 +1179,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_integration_tests", @@ -1128,6 +1196,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_unittests", @@ -1144,6 +1213,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_validation_tests", @@ -1160,6 +1230,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "services_unittests", @@ -1177,6 +1248,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "setup_unittests", @@ -1193,6 +1265,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "shell_dialogs_unittests", @@ -1209,6 +1282,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "skia_unittests", @@ -1225,6 +1299,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "snapshot_unittests", @@ -1241,6 +1316,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sql_unittests", @@ -1257,6 +1333,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "storage_unittests", @@ -1273,6 +1350,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -1290,6 +1368,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_base_unittests", @@ -1306,6 +1385,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_touch_selection_unittests", @@ -1322,6 +1402,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_unittests", @@ -1338,6 +1419,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "unit_tests", @@ -1354,6 +1436,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "updater_tests", @@ -1370,6 +1453,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1388,6 +1472,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "url_unittests", @@ -1404,6 +1489,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_unittests", @@ -1420,6 +1506,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "viz_unittests", @@ -1436,6 +1523,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "vr_common_unittests", @@ -1452,6 +1540,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_unittests", @@ -1468,6 +1557,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wm_unittests", @@ -1484,6 +1574,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wtf_unittests", @@ -1500,6 +1591,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zlib_unittests", @@ -1516,6 +1608,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zucchini_unittests", @@ -1537,6 +1630,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_python_tests", @@ -1559,6 +1653,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests", @@ -1581,6 +1676,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests_headless_shell", @@ -1597,6 +1693,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_replay_unittests", @@ -1619,6 +1716,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_perftests", @@ -1639,6 +1737,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_shell_crash_test", @@ -1659,6 +1758,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "flatbuffers_unittests", @@ -1678,6 +1778,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "grit_python_unittests", @@ -1704,6 +1805,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 960, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1725,6 +1827,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -1748,6 +1851,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_perftests",
diff --git a/infra/config/generated/builders/ci/win-arm64-rel/targets/chromium.win.json b/infra/config/generated/builders/ci/win-arm64-rel/targets/chromium.win.json index 198c359..485f3cb 100644 --- a/infra/config/generated/builders/ci/win-arm64-rel/targets/chromium.win.json +++ b/infra/config/generated/builders/ci/win-arm64-rel/targets/chromium.win.json
@@ -18,6 +18,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "absl_hardening_tests", @@ -34,6 +35,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "accessibility_unittests", @@ -50,6 +52,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "angle_unittests", @@ -67,6 +70,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "app_shell_unittests", @@ -83,6 +87,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "aura_unittests", @@ -99,6 +104,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "base_unittests", @@ -115,6 +121,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_common_unittests", @@ -131,6 +138,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_fuzzer_unittests", @@ -147,6 +155,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_heap_unittests", @@ -171,6 +180,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_platform_unittests", @@ -187,6 +197,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_crypto_tests", @@ -203,6 +214,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_ssl_tests", @@ -219,6 +231,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 15 }, @@ -239,6 +252,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "capture_unittests", @@ -255,6 +269,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cast_unittests", @@ -271,6 +286,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cc_unittests", @@ -287,6 +303,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_app_unittests", @@ -303,6 +320,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_elf_unittests", @@ -319,6 +337,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_unittests", @@ -335,6 +354,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_browsertests", @@ -351,6 +371,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -368,6 +389,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "compositor_unittests", @@ -384,6 +406,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 8 }, @@ -401,6 +424,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_unittests", @@ -417,6 +441,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crashpad_tests", @@ -433,6 +458,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_tests", @@ -449,6 +475,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_unittests", @@ -465,6 +492,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crypto_unittests", @@ -481,6 +509,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "delayloads_unittests", @@ -497,6 +526,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "device_unittests", @@ -513,6 +543,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "display_unittests", @@ -529,6 +560,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevated_tracing_service_unittests", @@ -545,6 +577,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevation_service_unittests", @@ -562,6 +595,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "env_chromium_unittests", @@ -578,6 +612,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "events_unittests", @@ -594,6 +629,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_browsertests", @@ -610,6 +646,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_unittests", @@ -626,6 +663,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "filesystem_service_unittests", @@ -642,6 +680,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "fuzzing_unittests", @@ -658,6 +697,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcm_unit_tests", @@ -674,6 +714,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcp_unittests", @@ -690,6 +731,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gfx_unittests", @@ -706,6 +748,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gin_unittests", @@ -722,6 +765,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "google_apis_unittests", @@ -738,6 +782,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gpu_unittests", @@ -754,6 +799,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gwp_asan_unittests", @@ -770,6 +816,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_browsertests", @@ -786,6 +833,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_unittests", @@ -802,6 +850,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "install_static_unittests", @@ -819,6 +868,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "installer_util_unittests", @@ -835,6 +885,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -852,6 +903,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ipc_tests", @@ -868,6 +920,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "latency_unittests", @@ -885,6 +938,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "leveldb_unittests", @@ -901,6 +955,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "libjingle_xmpp_unittests", @@ -917,6 +972,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "liburlpattern_unittests", @@ -933,6 +989,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "media_unittests", @@ -949,6 +1006,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "message_center_unittests", @@ -965,6 +1023,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "midi_unittests", @@ -981,6 +1040,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_unittests", @@ -997,6 +1057,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "native_theme_unittests", @@ -1013,6 +1074,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "net_unittests", @@ -1029,6 +1091,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "notification_helper_unittests", @@ -1045,6 +1108,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pdf_unittests", @@ -1061,6 +1125,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "perfetto_unittests", @@ -1077,6 +1142,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "printing_unittests", @@ -1094,6 +1160,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pthreadpool_unittests", @@ -1110,6 +1177,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "remoting_unittests", @@ -1127,6 +1195,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_integration_tests", @@ -1143,6 +1212,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_unittests", @@ -1159,6 +1229,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_validation_tests", @@ -1175,6 +1246,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "services_unittests", @@ -1192,6 +1264,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "setup_unittests", @@ -1208,6 +1281,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "shell_dialogs_unittests", @@ -1224,6 +1298,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "skia_unittests", @@ -1240,6 +1315,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "snapshot_unittests", @@ -1256,6 +1332,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sql_unittests", @@ -1272,6 +1349,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "storage_unittests", @@ -1288,6 +1366,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -1305,6 +1384,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_base_unittests", @@ -1321,6 +1401,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_touch_selection_unittests", @@ -1337,6 +1418,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_unittests", @@ -1353,6 +1435,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "unit_tests", @@ -1369,6 +1452,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "updater_tests", @@ -1385,6 +1469,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1403,6 +1488,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "url_unittests", @@ -1427,6 +1513,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_examples_unittests", @@ -1443,6 +1530,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_unittests", @@ -1459,6 +1547,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "viz_unittests", @@ -1475,6 +1564,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "vr_common_unittests", @@ -1491,6 +1581,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_unittests", @@ -1507,6 +1598,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wm_unittests", @@ -1523,6 +1615,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wtf_unittests", @@ -1539,6 +1632,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zlib_unittests", @@ -1555,6 +1649,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zucchini_unittests", @@ -1576,6 +1671,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_python_tests", @@ -1604,6 +1700,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 5 }, @@ -1633,6 +1730,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 18 }, @@ -1661,6 +1759,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_wpt_tests", @@ -1683,6 +1782,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests", @@ -1705,6 +1805,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests_headless_shell", @@ -1721,6 +1822,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_replay_unittests", @@ -1743,6 +1845,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_perftests", @@ -1763,6 +1866,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_shell_crash_test", @@ -1783,6 +1887,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "flatbuffers_unittests", @@ -1802,6 +1907,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "grit_python_unittests", @@ -1835,6 +1941,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 18 }, @@ -1853,6 +1960,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mini_installer_tests", @@ -1872,6 +1980,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_python_unittests", @@ -1889,6 +1998,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "polymer_tools_python_unittests", @@ -1914,6 +2024,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "telemetry_perf_unittests", @@ -1933,6 +2044,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -1953,6 +2065,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "test_env_py_unittests", @@ -1975,6 +2088,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_perftests", @@ -1994,6 +2108,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "xvfb_py_unittests",
diff --git a/infra/config/generated/builders/ci/win11-arm64-dbg-tests/targets/chromium.win.json b/infra/config/generated/builders/ci/win11-arm64-dbg-tests/targets/chromium.win.json index febffc0..d5bf3c2 100644 --- a/infra/config/generated/builders/ci/win11-arm64-dbg-tests/targets/chromium.win.json +++ b/infra/config/generated/builders/ci/win11-arm64-dbg-tests/targets/chromium.win.json
@@ -12,6 +12,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "absl_hardening_tests", @@ -28,6 +29,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "accessibility_unittests", @@ -44,6 +46,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "angle_unittests", @@ -61,6 +64,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "app_shell_unittests", @@ -77,6 +81,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "aura_unittests", @@ -93,6 +98,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "base_unittests", @@ -109,6 +115,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_common_unittests", @@ -125,6 +132,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_fuzzer_unittests", @@ -141,6 +149,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_heap_unittests", @@ -165,6 +174,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_platform_unittests", @@ -181,6 +191,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_crypto_tests", @@ -197,6 +208,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_ssl_tests", @@ -216,6 +228,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "capture_unittests", @@ -232,6 +245,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cast_unittests", @@ -248,6 +262,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cc_unittests", @@ -264,6 +279,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_app_unittests", @@ -280,6 +296,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_elf_unittests", @@ -296,6 +313,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_unittests", @@ -312,6 +330,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_browsertests", @@ -328,6 +347,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -345,6 +365,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "compositor_unittests", @@ -361,6 +382,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 16 }, @@ -378,6 +400,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_unittests", @@ -394,6 +417,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crashpad_tests", @@ -410,6 +434,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_tests", @@ -426,6 +451,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_unittests", @@ -442,6 +468,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crypto_unittests", @@ -458,6 +485,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "delayloads_unittests", @@ -474,6 +502,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "device_unittests", @@ -490,6 +519,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "display_unittests", @@ -506,6 +536,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevated_tracing_service_unittests", @@ -522,6 +553,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevation_service_unittests", @@ -539,6 +571,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "env_chromium_unittests", @@ -555,6 +588,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "events_unittests", @@ -571,6 +605,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_browsertests", @@ -587,6 +622,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_unittests", @@ -603,6 +639,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "filesystem_service_unittests", @@ -619,6 +656,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "fuzzing_unittests", @@ -635,6 +673,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcm_unit_tests", @@ -651,6 +690,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcp_unittests", @@ -667,6 +707,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gfx_unittests", @@ -683,6 +724,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gin_unittests", @@ -699,6 +741,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "google_apis_unittests", @@ -715,6 +758,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gpu_unittests", @@ -731,6 +775,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gwp_asan_unittests", @@ -747,6 +792,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_browsertests", @@ -763,6 +809,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_unittests", @@ -779,6 +826,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "install_static_unittests", @@ -796,6 +844,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "installer_util_unittests", @@ -812,6 +861,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 9 }, @@ -829,6 +879,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ipc_tests", @@ -845,6 +896,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "latency_unittests", @@ -865,6 +917,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "leveldb_unittests", @@ -881,6 +934,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "libjingle_xmpp_unittests", @@ -897,6 +951,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "liburlpattern_unittests", @@ -913,6 +968,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "media_unittests", @@ -929,6 +985,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "message_center_unittests", @@ -945,6 +1002,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "midi_unittests", @@ -961,6 +1019,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_unittests", @@ -977,6 +1036,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "native_theme_unittests", @@ -993,6 +1053,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "net_unittests", @@ -1009,6 +1070,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "notification_helper_unittests", @@ -1025,6 +1087,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pdf_unittests", @@ -1041,6 +1104,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "perfetto_unittests", @@ -1057,6 +1121,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "printing_unittests", @@ -1074,6 +1139,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pthreadpool_unittests", @@ -1090,6 +1156,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "remoting_unittests", @@ -1107,6 +1174,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_integration_tests", @@ -1123,6 +1191,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_unittests", @@ -1139,6 +1208,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_validation_tests", @@ -1155,6 +1225,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "services_unittests", @@ -1172,6 +1243,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "setup_unittests", @@ -1188,6 +1260,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "shell_dialogs_unittests", @@ -1204,6 +1277,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "skia_unittests", @@ -1220,6 +1294,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "snapshot_unittests", @@ -1236,6 +1311,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sql_unittests", @@ -1252,6 +1328,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "storage_unittests", @@ -1268,6 +1345,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -1285,6 +1363,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_base_unittests", @@ -1301,6 +1380,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_touch_selection_unittests", @@ -1317,6 +1397,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_unittests", @@ -1333,6 +1414,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "unit_tests", @@ -1349,6 +1431,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "updater_tests", @@ -1365,6 +1448,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1383,6 +1467,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "url_unittests", @@ -1399,6 +1484,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_unittests", @@ -1415,6 +1501,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "viz_unittests", @@ -1431,6 +1518,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "vr_common_unittests", @@ -1447,6 +1535,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_unittests", @@ -1463,6 +1552,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wm_unittests", @@ -1479,6 +1569,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wtf_unittests", @@ -1495,6 +1586,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zlib_unittests", @@ -1511,6 +1603,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zucchini_unittests", @@ -1532,6 +1625,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_python_tests", @@ -1554,6 +1648,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests", @@ -1576,6 +1671,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests_headless_shell", @@ -1592,6 +1688,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_replay_unittests", @@ -1614,6 +1711,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_perftests", @@ -1634,6 +1732,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_shell_crash_test", @@ -1654,6 +1753,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "flatbuffers_unittests", @@ -1673,6 +1773,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "grit_python_unittests", @@ -1699,6 +1800,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 960, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1720,6 +1822,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -1743,6 +1846,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_perftests",
diff --git a/infra/config/generated/builders/ci/win11-arm64-rel-tests/targets/chromium.win.json b/infra/config/generated/builders/ci/win11-arm64-rel-tests/targets/chromium.win.json index 45d6677..3b9e677 100644 --- a/infra/config/generated/builders/ci/win11-arm64-rel-tests/targets/chromium.win.json +++ b/infra/config/generated/builders/ci/win11-arm64-rel-tests/targets/chromium.win.json
@@ -12,6 +12,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "absl_hardening_tests", @@ -28,6 +29,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "accessibility_unittests", @@ -44,6 +46,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "angle_unittests", @@ -61,6 +64,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "app_shell_unittests", @@ -77,6 +81,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "aura_unittests", @@ -93,6 +98,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "base_unittests", @@ -109,6 +115,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_common_unittests", @@ -125,6 +132,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_fuzzer_unittests", @@ -141,6 +149,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_heap_unittests", @@ -165,6 +174,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_platform_unittests", @@ -181,6 +191,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_crypto_tests", @@ -197,6 +208,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_ssl_tests", @@ -213,6 +225,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 15 }, @@ -233,6 +246,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "capture_unittests", @@ -249,6 +263,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cast_unittests", @@ -265,6 +280,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cc_unittests", @@ -281,6 +297,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_app_unittests", @@ -297,6 +314,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_elf_unittests", @@ -313,6 +331,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_unittests", @@ -329,6 +348,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_browsertests", @@ -345,6 +365,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -362,6 +383,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "compositor_unittests", @@ -378,6 +400,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 8 }, @@ -395,6 +418,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_unittests", @@ -411,6 +435,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crashpad_tests", @@ -427,6 +452,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_tests", @@ -443,6 +469,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_unittests", @@ -459,6 +486,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crypto_unittests", @@ -475,6 +503,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "delayloads_unittests", @@ -491,6 +520,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "device_unittests", @@ -507,6 +537,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "display_unittests", @@ -523,6 +554,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevated_tracing_service_unittests", @@ -539,6 +571,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevation_service_unittests", @@ -556,6 +589,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "env_chromium_unittests", @@ -572,6 +606,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "events_unittests", @@ -588,6 +623,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_browsertests", @@ -604,6 +640,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_unittests", @@ -620,6 +657,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "filesystem_service_unittests", @@ -636,6 +674,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "fuzzing_unittests", @@ -652,6 +691,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcm_unit_tests", @@ -668,6 +708,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcp_unittests", @@ -684,6 +725,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gfx_unittests", @@ -700,6 +742,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gin_unittests", @@ -716,6 +759,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "google_apis_unittests", @@ -732,6 +776,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gpu_unittests", @@ -748,6 +793,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gwp_asan_unittests", @@ -764,6 +810,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_browsertests", @@ -780,6 +827,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_unittests", @@ -796,6 +844,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "install_static_unittests", @@ -813,6 +862,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "installer_util_unittests", @@ -829,6 +879,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -846,6 +897,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ipc_tests", @@ -862,6 +914,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "latency_unittests", @@ -879,6 +932,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "leveldb_unittests", @@ -895,6 +949,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "libjingle_xmpp_unittests", @@ -911,6 +966,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "liburlpattern_unittests", @@ -927,6 +983,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "media_unittests", @@ -943,6 +1000,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "message_center_unittests", @@ -959,6 +1017,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "midi_unittests", @@ -975,6 +1034,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_unittests", @@ -991,6 +1051,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "native_theme_unittests", @@ -1007,6 +1068,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "net_unittests", @@ -1023,6 +1085,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "notification_helper_unittests", @@ -1039,6 +1102,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pdf_unittests", @@ -1055,6 +1119,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "perfetto_unittests", @@ -1071,6 +1136,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "printing_unittests", @@ -1088,6 +1154,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pthreadpool_unittests", @@ -1104,6 +1171,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "remoting_unittests", @@ -1121,6 +1189,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_integration_tests", @@ -1137,6 +1206,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_unittests", @@ -1153,6 +1223,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_validation_tests", @@ -1169,6 +1240,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "services_unittests", @@ -1186,6 +1258,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "setup_unittests", @@ -1202,6 +1275,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "shell_dialogs_unittests", @@ -1218,6 +1292,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "skia_unittests", @@ -1234,6 +1309,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "snapshot_unittests", @@ -1250,6 +1326,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sql_unittests", @@ -1266,6 +1343,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "storage_unittests", @@ -1282,6 +1360,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -1299,6 +1378,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_base_unittests", @@ -1315,6 +1395,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_touch_selection_unittests", @@ -1331,6 +1412,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_unittests", @@ -1347,6 +1429,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "unit_tests", @@ -1363,6 +1446,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "updater_tests", @@ -1379,6 +1463,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1397,6 +1482,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "url_unittests", @@ -1421,6 +1507,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_examples_unittests", @@ -1437,6 +1524,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_unittests", @@ -1453,6 +1541,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "viz_unittests", @@ -1469,6 +1558,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "vr_common_unittests", @@ -1485,6 +1575,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_unittests", @@ -1501,6 +1592,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wm_unittests", @@ -1517,6 +1609,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wtf_unittests", @@ -1533,6 +1626,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zlib_unittests", @@ -1549,6 +1643,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zucchini_unittests", @@ -1570,6 +1665,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_python_tests", @@ -1598,6 +1694,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 5 }, @@ -1627,6 +1724,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 18 }, @@ -1655,6 +1753,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_wpt_tests", @@ -1677,6 +1776,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests", @@ -1699,6 +1799,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests_headless_shell", @@ -1715,6 +1816,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_replay_unittests", @@ -1737,6 +1839,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_perftests", @@ -1757,6 +1860,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_shell_crash_test", @@ -1777,6 +1881,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "flatbuffers_unittests", @@ -1796,6 +1901,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "grit_python_unittests", @@ -1829,6 +1935,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 18 }, @@ -1847,6 +1954,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mini_installer_tests", @@ -1866,6 +1974,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_python_unittests", @@ -1883,6 +1992,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "polymer_tools_python_unittests", @@ -1908,6 +2018,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "telemetry_perf_unittests", @@ -1927,6 +2038,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -1947,6 +2059,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "test_env_py_unittests", @@ -1969,6 +2082,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_perftests", @@ -1988,6 +2102,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "xvfb_py_unittests",
diff --git a/infra/config/generated/builders/try/win-arm64-compile-dbg/targets/chromium.win.json b/infra/config/generated/builders/try/win-arm64-compile-dbg/targets/chromium.win.json index d65c8df..fc19afd 100644 --- a/infra/config/generated/builders/try/win-arm64-compile-dbg/targets/chromium.win.json +++ b/infra/config/generated/builders/try/win-arm64-compile-dbg/targets/chromium.win.json
@@ -17,6 +17,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "absl_hardening_tests", @@ -33,6 +34,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "accessibility_unittests", @@ -49,6 +51,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "angle_unittests", @@ -66,6 +69,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "app_shell_unittests", @@ -82,6 +86,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "aura_unittests", @@ -98,6 +103,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "base_unittests", @@ -114,6 +120,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_common_unittests", @@ -130,6 +137,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_fuzzer_unittests", @@ -146,6 +154,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_heap_unittests", @@ -170,6 +179,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_platform_unittests", @@ -186,6 +196,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_crypto_tests", @@ -202,6 +213,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_ssl_tests", @@ -221,6 +233,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "capture_unittests", @@ -237,6 +250,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cast_unittests", @@ -253,6 +267,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cc_unittests", @@ -269,6 +284,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_app_unittests", @@ -285,6 +301,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_elf_unittests", @@ -301,6 +318,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_unittests", @@ -317,6 +335,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_browsertests", @@ -333,6 +352,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -350,6 +370,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "compositor_unittests", @@ -366,6 +387,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 16 }, @@ -383,6 +405,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_unittests", @@ -399,6 +422,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crashpad_tests", @@ -415,6 +439,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_tests", @@ -431,6 +456,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_unittests", @@ -447,6 +473,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crypto_unittests", @@ -463,6 +490,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "delayloads_unittests", @@ -479,6 +507,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "device_unittests", @@ -495,6 +524,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "display_unittests", @@ -511,6 +541,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevated_tracing_service_unittests", @@ -527,6 +558,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevation_service_unittests", @@ -544,6 +576,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "env_chromium_unittests", @@ -560,6 +593,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "events_unittests", @@ -576,6 +610,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_browsertests", @@ -592,6 +627,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_unittests", @@ -608,6 +644,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "filesystem_service_unittests", @@ -624,6 +661,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "fuzzing_unittests", @@ -640,6 +678,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcm_unit_tests", @@ -656,6 +695,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcp_unittests", @@ -672,6 +712,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gfx_unittests", @@ -688,6 +729,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gin_unittests", @@ -704,6 +746,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "google_apis_unittests", @@ -720,6 +763,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gpu_unittests", @@ -736,6 +780,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gwp_asan_unittests", @@ -752,6 +797,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_browsertests", @@ -768,6 +814,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_unittests", @@ -784,6 +831,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "install_static_unittests", @@ -801,6 +849,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "installer_util_unittests", @@ -817,6 +866,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 9 }, @@ -834,6 +884,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ipc_tests", @@ -850,6 +901,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "latency_unittests", @@ -870,6 +922,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "leveldb_unittests", @@ -886,6 +939,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "libjingle_xmpp_unittests", @@ -902,6 +956,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "liburlpattern_unittests", @@ -918,6 +973,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "media_unittests", @@ -934,6 +990,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "message_center_unittests", @@ -950,6 +1007,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "midi_unittests", @@ -966,6 +1024,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_unittests", @@ -982,6 +1041,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "native_theme_unittests", @@ -998,6 +1058,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "net_unittests", @@ -1014,6 +1075,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "notification_helper_unittests", @@ -1030,6 +1092,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pdf_unittests", @@ -1046,6 +1109,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "perfetto_unittests", @@ -1062,6 +1126,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "printing_unittests", @@ -1079,6 +1144,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pthreadpool_unittests", @@ -1095,6 +1161,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "remoting_unittests", @@ -1112,6 +1179,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_integration_tests", @@ -1128,6 +1196,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_unittests", @@ -1144,6 +1213,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_validation_tests", @@ -1160,6 +1230,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "services_unittests", @@ -1177,6 +1248,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "setup_unittests", @@ -1193,6 +1265,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "shell_dialogs_unittests", @@ -1209,6 +1282,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "skia_unittests", @@ -1225,6 +1299,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "snapshot_unittests", @@ -1241,6 +1316,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sql_unittests", @@ -1257,6 +1333,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "storage_unittests", @@ -1273,6 +1350,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -1290,6 +1368,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_base_unittests", @@ -1306,6 +1385,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_touch_selection_unittests", @@ -1322,6 +1402,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_unittests", @@ -1338,6 +1419,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "unit_tests", @@ -1354,6 +1436,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "updater_tests", @@ -1370,6 +1453,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1388,6 +1472,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "url_unittests", @@ -1404,6 +1489,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_unittests", @@ -1420,6 +1506,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "viz_unittests", @@ -1436,6 +1523,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "vr_common_unittests", @@ -1452,6 +1540,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_unittests", @@ -1468,6 +1557,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wm_unittests", @@ -1484,6 +1574,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wtf_unittests", @@ -1500,6 +1591,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zlib_unittests", @@ -1516,6 +1608,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zucchini_unittests", @@ -1537,6 +1630,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_python_tests", @@ -1559,6 +1653,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests", @@ -1581,6 +1676,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests_headless_shell", @@ -1597,6 +1693,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_replay_unittests", @@ -1619,6 +1716,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_perftests", @@ -1639,6 +1737,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_shell_crash_test", @@ -1659,6 +1758,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "flatbuffers_unittests", @@ -1678,6 +1778,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "grit_python_unittests", @@ -1704,6 +1805,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 960, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1725,6 +1827,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -1748,6 +1851,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_perftests",
diff --git a/infra/config/generated/builders/try/win-arm64-dbg/targets/chromium.win.json b/infra/config/generated/builders/try/win-arm64-dbg/targets/chromium.win.json index d65c8df..fc19afd 100644 --- a/infra/config/generated/builders/try/win-arm64-dbg/targets/chromium.win.json +++ b/infra/config/generated/builders/try/win-arm64-dbg/targets/chromium.win.json
@@ -17,6 +17,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "absl_hardening_tests", @@ -33,6 +34,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "accessibility_unittests", @@ -49,6 +51,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "angle_unittests", @@ -66,6 +69,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "app_shell_unittests", @@ -82,6 +86,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "aura_unittests", @@ -98,6 +103,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "base_unittests", @@ -114,6 +120,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_common_unittests", @@ -130,6 +137,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_fuzzer_unittests", @@ -146,6 +154,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_heap_unittests", @@ -170,6 +179,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_platform_unittests", @@ -186,6 +196,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_crypto_tests", @@ -202,6 +213,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_ssl_tests", @@ -221,6 +233,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "capture_unittests", @@ -237,6 +250,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cast_unittests", @@ -253,6 +267,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cc_unittests", @@ -269,6 +284,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_app_unittests", @@ -285,6 +301,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_elf_unittests", @@ -301,6 +318,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_unittests", @@ -317,6 +335,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_browsertests", @@ -333,6 +352,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -350,6 +370,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "compositor_unittests", @@ -366,6 +387,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 16 }, @@ -383,6 +405,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_unittests", @@ -399,6 +422,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crashpad_tests", @@ -415,6 +439,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_tests", @@ -431,6 +456,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_unittests", @@ -447,6 +473,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crypto_unittests", @@ -463,6 +490,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "delayloads_unittests", @@ -479,6 +507,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "device_unittests", @@ -495,6 +524,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "display_unittests", @@ -511,6 +541,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevated_tracing_service_unittests", @@ -527,6 +558,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevation_service_unittests", @@ -544,6 +576,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "env_chromium_unittests", @@ -560,6 +593,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "events_unittests", @@ -576,6 +610,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_browsertests", @@ -592,6 +627,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_unittests", @@ -608,6 +644,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "filesystem_service_unittests", @@ -624,6 +661,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "fuzzing_unittests", @@ -640,6 +678,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcm_unit_tests", @@ -656,6 +695,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcp_unittests", @@ -672,6 +712,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gfx_unittests", @@ -688,6 +729,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gin_unittests", @@ -704,6 +746,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "google_apis_unittests", @@ -720,6 +763,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gpu_unittests", @@ -736,6 +780,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gwp_asan_unittests", @@ -752,6 +797,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_browsertests", @@ -768,6 +814,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_unittests", @@ -784,6 +831,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "install_static_unittests", @@ -801,6 +849,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "installer_util_unittests", @@ -817,6 +866,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 9 }, @@ -834,6 +884,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ipc_tests", @@ -850,6 +901,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "latency_unittests", @@ -870,6 +922,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "leveldb_unittests", @@ -886,6 +939,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "libjingle_xmpp_unittests", @@ -902,6 +956,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "liburlpattern_unittests", @@ -918,6 +973,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "media_unittests", @@ -934,6 +990,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "message_center_unittests", @@ -950,6 +1007,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "midi_unittests", @@ -966,6 +1024,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_unittests", @@ -982,6 +1041,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "native_theme_unittests", @@ -998,6 +1058,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "net_unittests", @@ -1014,6 +1075,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "notification_helper_unittests", @@ -1030,6 +1092,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pdf_unittests", @@ -1046,6 +1109,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "perfetto_unittests", @@ -1062,6 +1126,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "printing_unittests", @@ -1079,6 +1144,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pthreadpool_unittests", @@ -1095,6 +1161,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "remoting_unittests", @@ -1112,6 +1179,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_integration_tests", @@ -1128,6 +1196,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_unittests", @@ -1144,6 +1213,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_validation_tests", @@ -1160,6 +1230,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "services_unittests", @@ -1177,6 +1248,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "setup_unittests", @@ -1193,6 +1265,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "shell_dialogs_unittests", @@ -1209,6 +1282,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "skia_unittests", @@ -1225,6 +1299,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "snapshot_unittests", @@ -1241,6 +1316,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sql_unittests", @@ -1257,6 +1333,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "storage_unittests", @@ -1273,6 +1350,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -1290,6 +1368,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_base_unittests", @@ -1306,6 +1385,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_touch_selection_unittests", @@ -1322,6 +1402,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_unittests", @@ -1338,6 +1419,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "unit_tests", @@ -1354,6 +1436,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "updater_tests", @@ -1370,6 +1453,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1388,6 +1472,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "url_unittests", @@ -1404,6 +1489,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_unittests", @@ -1420,6 +1506,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "viz_unittests", @@ -1436,6 +1523,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "vr_common_unittests", @@ -1452,6 +1540,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_unittests", @@ -1468,6 +1557,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wm_unittests", @@ -1484,6 +1574,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wtf_unittests", @@ -1500,6 +1591,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zlib_unittests", @@ -1516,6 +1608,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zucchini_unittests", @@ -1537,6 +1630,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_python_tests", @@ -1559,6 +1653,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests", @@ -1581,6 +1676,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests_headless_shell", @@ -1597,6 +1693,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_replay_unittests", @@ -1619,6 +1716,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_perftests", @@ -1639,6 +1737,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_shell_crash_test", @@ -1659,6 +1758,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "flatbuffers_unittests", @@ -1678,6 +1778,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "grit_python_unittests", @@ -1704,6 +1805,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 960, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1725,6 +1827,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -1748,6 +1851,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_perftests",
diff --git a/infra/config/generated/builders/try/win-arm64-rel/targets/chromium.win.json b/infra/config/generated/builders/try/win-arm64-rel/targets/chromium.win.json index 198c359..485f3cb 100644 --- a/infra/config/generated/builders/try/win-arm64-rel/targets/chromium.win.json +++ b/infra/config/generated/builders/try/win-arm64-rel/targets/chromium.win.json
@@ -18,6 +18,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "absl_hardening_tests", @@ -34,6 +35,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "accessibility_unittests", @@ -50,6 +52,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "angle_unittests", @@ -67,6 +70,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "app_shell_unittests", @@ -83,6 +87,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "aura_unittests", @@ -99,6 +104,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "base_unittests", @@ -115,6 +121,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_common_unittests", @@ -131,6 +138,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_fuzzer_unittests", @@ -147,6 +155,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_heap_unittests", @@ -171,6 +180,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_platform_unittests", @@ -187,6 +197,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_crypto_tests", @@ -203,6 +214,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "boringssl_ssl_tests", @@ -219,6 +231,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 15 }, @@ -239,6 +252,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "capture_unittests", @@ -255,6 +269,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cast_unittests", @@ -271,6 +286,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cc_unittests", @@ -287,6 +303,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_app_unittests", @@ -303,6 +320,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_elf_unittests", @@ -319,6 +337,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_unittests", @@ -335,6 +354,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_browsertests", @@ -351,6 +371,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -368,6 +389,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "compositor_unittests", @@ -384,6 +406,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 8 }, @@ -401,6 +424,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_unittests", @@ -417,6 +441,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crashpad_tests", @@ -433,6 +458,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_tests", @@ -449,6 +475,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "cronet_unittests", @@ -465,6 +492,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "crypto_unittests", @@ -481,6 +509,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "delayloads_unittests", @@ -497,6 +526,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "device_unittests", @@ -513,6 +543,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "display_unittests", @@ -529,6 +560,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevated_tracing_service_unittests", @@ -545,6 +577,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "elevation_service_unittests", @@ -562,6 +595,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "env_chromium_unittests", @@ -578,6 +612,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "events_unittests", @@ -594,6 +629,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_browsertests", @@ -610,6 +646,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "extensions_unittests", @@ -626,6 +663,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "filesystem_service_unittests", @@ -642,6 +680,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "fuzzing_unittests", @@ -658,6 +697,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcm_unit_tests", @@ -674,6 +714,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gcp_unittests", @@ -690,6 +731,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gfx_unittests", @@ -706,6 +748,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gin_unittests", @@ -722,6 +765,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "google_apis_unittests", @@ -738,6 +782,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gpu_unittests", @@ -754,6 +799,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "gwp_asan_unittests", @@ -770,6 +816,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_browsertests", @@ -786,6 +833,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "headless_unittests", @@ -802,6 +850,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "install_static_unittests", @@ -819,6 +868,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "installer_util_unittests", @@ -835,6 +885,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -852,6 +903,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ipc_tests", @@ -868,6 +920,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "latency_unittests", @@ -885,6 +938,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "leveldb_unittests", @@ -901,6 +955,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "libjingle_xmpp_unittests", @@ -917,6 +972,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "liburlpattern_unittests", @@ -933,6 +989,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "media_unittests", @@ -949,6 +1006,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "message_center_unittests", @@ -965,6 +1023,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "midi_unittests", @@ -981,6 +1040,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_unittests", @@ -997,6 +1057,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "native_theme_unittests", @@ -1013,6 +1074,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "net_unittests", @@ -1029,6 +1091,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "notification_helper_unittests", @@ -1045,6 +1108,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pdf_unittests", @@ -1061,6 +1125,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "perfetto_unittests", @@ -1077,6 +1142,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "printing_unittests", @@ -1094,6 +1160,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "pthreadpool_unittests", @@ -1110,6 +1177,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "remoting_unittests", @@ -1127,6 +1195,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_integration_tests", @@ -1143,6 +1212,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_unittests", @@ -1159,6 +1229,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sbox_validation_tests", @@ -1175,6 +1246,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "services_unittests", @@ -1192,6 +1264,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "setup_unittests", @@ -1208,6 +1281,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "shell_dialogs_unittests", @@ -1224,6 +1298,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "skia_unittests", @@ -1240,6 +1315,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "snapshot_unittests", @@ -1256,6 +1332,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "sql_unittests", @@ -1272,6 +1349,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "storage_unittests", @@ -1288,6 +1366,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 3 }, @@ -1305,6 +1384,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_base_unittests", @@ -1321,6 +1401,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_touch_selection_unittests", @@ -1337,6 +1418,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ui_unittests", @@ -1353,6 +1435,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "unit_tests", @@ -1369,6 +1452,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "updater_tests", @@ -1385,6 +1469,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "hard_timeout": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 2 @@ -1403,6 +1488,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "url_unittests", @@ -1427,6 +1513,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_examples_unittests", @@ -1443,6 +1530,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_unittests", @@ -1459,6 +1547,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "viz_unittests", @@ -1475,6 +1564,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "vr_common_unittests", @@ -1491,6 +1581,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_unittests", @@ -1507,6 +1598,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wm_unittests", @@ -1523,6 +1615,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "wtf_unittests", @@ -1539,6 +1632,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zlib_unittests", @@ -1555,6 +1649,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "zucchini_unittests", @@ -1576,6 +1671,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "blink_python_tests", @@ -1604,6 +1700,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 5 }, @@ -1633,6 +1730,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 18 }, @@ -1661,6 +1759,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_wpt_tests", @@ -1683,6 +1782,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests", @@ -1705,6 +1805,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_py_tests_headless_shell", @@ -1721,6 +1822,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chromedriver_replay_unittests", @@ -1743,6 +1845,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_perftests", @@ -1763,6 +1866,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "content_shell_crash_test", @@ -1783,6 +1887,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "flatbuffers_unittests", @@ -1802,6 +1907,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "grit_python_unittests", @@ -1835,6 +1941,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", "shards": 18 }, @@ -1853,6 +1960,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mini_installer_tests", @@ -1872,6 +1980,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "mojo_python_unittests", @@ -1889,6 +1998,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "polymer_tools_python_unittests", @@ -1914,6 +2024,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "telemetry_perf_unittests", @@ -1933,6 +2044,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, @@ -1953,6 +2065,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "test_env_py_unittests", @@ -1975,6 +2088,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "views_perftests", @@ -1994,6 +2108,7 @@ "os": "Windows-11", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "xvfb_py_unittests",
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index cc36ac1..5cf1a9d 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -124957,6 +124957,7 @@ predicates: "has(build.output.properties.is_cached)" predicates: "string(build.output.properties.is_cached) == \"false\"" } + max_concurrent_builds: 2 } builders { name: "win-arm64-rel" @@ -125069,7 +125070,7 @@ predicates: "has(build.output.properties.is_cached)" predicates: "string(build.output.properties.is_cached) == \"false\"" } - max_concurrent_builds: 3 + max_concurrent_builds: 2 } builders { name: "win-asan"
diff --git a/infra/config/generated/testing/mixins.pyl b/infra/config/generated/testing/mixins.pyl index a5998a670..02b2245 100644 --- a/infra/config/generated/testing/mixins.pyl +++ b/infra/config/generated/testing/mixins.pyl
@@ -678,6 +678,7 @@ 'cpu': 'arm64', 'os': 'Windows-11', }, + 'expiration': 7200, }, }, 'win10': {
diff --git a/infra/config/subprojects/chromium/try/tryserver.chromium.win.star b/infra/config/subprojects/chromium/try/tryserver.chromium.win.star index 38a92c6..8b0da5d4 100644 --- a/infra/config/subprojects/chromium/try/tryserver.chromium.win.star +++ b/infra/config/subprojects/chromium/try/tryserver.chromium.win.star
@@ -341,7 +341,7 @@ coverage_test_types = ["unit", "overall"], main_list_view = "try", # The size of the testing pool is limited. - max_concurrent_builds = 3, + max_concurrent_builds = 2, # TODO (crbug.com/1372179): Use orchestrator pool once overloaded test pools # are addressed #use_orchestrator_pool = True, @@ -401,6 +401,8 @@ os = os.WINDOWS_10, ssd = True, contact_team_email = "chrome-desktop-engprod@google.com", + # The size of the testing pool is limited. + max_concurrent_builds = 2, # Enable when stable. # main_list_view = "try", siso_remote_jobs = siso.remote_jobs.HIGH_JOBS_FOR_CQ,
diff --git a/infra/config/targets/mixins.star b/infra/config/targets/mixins.star index 61682f8..9ab8af9 100644 --- a/infra/config/targets/mixins.star +++ b/infra/config/targets/mixins.star
@@ -2240,6 +2240,10 @@ "cpu": "arm64", "os": "Windows-11", }, + # win-arm64 is a limited pool with ~100 bots that can be easily + # overloaded by few builds. Increase the expiration_sec to 2h to prevent + # shards from timing out. + expiration_sec = 7200, ), )
diff --git a/internal b/internal index 1fd670a..38652b8 160000 --- a/internal +++ b/internal
@@ -1 +1 @@ -Subproject commit 1fd670ae00548d02b7be137d992ec52db29f3f4c +Subproject commit 38652b8866d84df9ea9e44365faee1954eba333a
diff --git a/ios/chrome/app/resources/BUILD.gn b/ios/chrome/app/resources/BUILD.gn index 7571551..433bd7b 100644 --- a/ios/chrome/app/resources/BUILD.gn +++ b/ios/chrome/app/resources/BUILD.gn
@@ -61,6 +61,7 @@ sources = [ "$root_gen_dir/components/commerce_internals_resources.pak", "$root_gen_dir/components/components_resources.pak", + "$root_gen_dir/components/crashes_resources.pak", "$root_gen_dir/components/dev_ui_components_resources.pak", "$root_gen_dir/components/download_internals_resources.pak", "$root_gen_dir/components/flags_ui_resources.pak",
diff --git a/ios/chrome/browser/ui/content_suggestions/magic_stack/magic_stack_module_contents_factory.mm b/ios/chrome/browser/ui/content_suggestions/magic_stack/magic_stack_module_contents_factory.mm index 98f8b0f7..8d1ae28 100644 --- a/ios/chrome/browser/ui/content_suggestions/magic_stack/magic_stack_module_contents_factory.mm +++ b/ios/chrome/browser/ui/content_suggestions/magic_stack/magic_stack_module_contents_factory.mm
@@ -17,6 +17,7 @@ #import "ios/chrome/browser/ui/content_suggestions/magic_stack/magic_stack_module_content_view_delegate.h" #import "ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_item.h" #import "ios/chrome/browser/ui/content_suggestions/parcel_tracking/parcel_tracking_view.h" +#import "ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_favicon_consumer_source.h" #import "ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_item.h" #import "ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_view.h" #import "ios/chrome/browser/ui/content_suggestions/safety_check/safety_check_consumer_source.h" @@ -159,6 +160,8 @@ (PriceTrackingPromoItem*)priceTrackingPromoItem { PriceTrackingPromoModuleView* view = [[PriceTrackingPromoModuleView alloc] initWithFrame:CGRectZero]; + [priceTrackingPromoItem.priceTrackingPromoFaviconConsumerSource + addConsumer:view]; view.commandHandler = priceTrackingPromoItem.commandHandler; [view configureView:priceTrackingPromoItem]; return view;
diff --git a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/BUILD.gn b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/BUILD.gn index 720fbe6..713c30f00 100644 --- a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/BUILD.gn +++ b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/BUILD.gn
@@ -6,6 +6,7 @@ sources = [ "price_tracking_promo_action_delegate.h", "price_tracking_promo_commands.h", + "price_tracking_promo_favicon_consumer_source.h", "price_tracking_promo_item.h", "price_tracking_promo_item.mm", "price_tracking_promo_mediator.h",
diff --git a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_favicon_consumer_source.h b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_favicon_consumer_source.h new file mode 100644 index 0000000..500d963 --- /dev/null +++ b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_favicon_consumer_source.h
@@ -0,0 +1,14 @@ +// Copyright 2024 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_PRICE_TRACKING_PROMO_PRICE_TRACKING_PROMO_FAVICON_CONSUMER_SOURCE_H_ +#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_PRICE_TRACKING_PROMO_PRICE_TRACKING_PROMO_FAVICON_CONSUMER_SOURCE_H_ + +@protocol PriceTrackingPromoFaviconConsumer; + +@protocol PriceTrackingPromoFaviconConsumerSource +- (void)addConsumer:(id<PriceTrackingPromoFaviconConsumer>)consumer; +@end + +#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_PRICE_TRACKING_PROMO_PRICE_TRACKING_PROMO_FAVICON_CONSUMER_SOURCE_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_item.h b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_item.h index d0028517..96c5c8f 100644 --- a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_item.h +++ b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_item.h
@@ -8,6 +8,7 @@ #import "ios/chrome/browser/ui/content_suggestions/magic_stack/magic_stack_module.h" @protocol PriceTrackingPromoCommands; +@protocol PriceTrackingPromoFaviconConsumerSource; // Item containing the configurations for the Price Tracking Promo Module view. @interface PriceTrackingPromoItem : MagicStackModule @@ -21,6 +22,10 @@ // The favicon image of the product if any. @property(nonatomic, strong) UIImage* faviconImage; +// The consumer source of the favicon image for the product. +@property(nonatomic, strong) id<PriceTrackingPromoFaviconConsumerSource> + priceTrackingPromoFaviconConsumerSource; + @end #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_PRICE_TRACKING_PROMO_PRICE_TRACKING_PROMO_ITEM_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_mediator.h b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_mediator.h index 060b8ae..22f7a97 100644 --- a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_mediator.h +++ b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_mediator.h
@@ -28,6 +28,10 @@ @protocol SnackbarCommands; @protocol SystemIdentity; +@protocol PriceTrackingPromoFaviconConsumer +- (void)priceTrackingPromoFaviconCompleted:(UIImage*)faviconImage; +@end + class AuthenticationService; // Delegate used to communicate events back to the owner of
diff --git a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_mediator.mm b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_mediator.mm index 308d218..0289817a 100644 --- a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_mediator.mm
@@ -40,6 +40,7 @@ #import "ios/chrome/browser/signin/model/system_identity.h" #import "ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_action_delegate.h" #import "ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_constants.h" +#import "ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_favicon_consumer_source.h" #import "ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_item.h" #import "ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_prefs.h" #import "ios/chrome/common/ui/favicon/favicon_attributes.h" @@ -71,8 +72,10 @@ } // namespace -@interface PriceTrackingPromoMediator () <NotificationsSettingsObserverDelegate, - PrefObserverDelegate> +@interface PriceTrackingPromoMediator () < + NotificationsSettingsObserverDelegate, + PrefObserverDelegate, + PriceTrackingPromoFaviconConsumerSource> @end @implementation PriceTrackingPromoMediator { @@ -89,6 +92,7 @@ raw_ptr<FaviconLoader> _faviconLoader; bool _faviconCallbackCalledOnce; bool _subscriptionDataFound; + id<PriceTrackingPromoFaviconConsumer> _faviconConsumer; } - (instancetype) @@ -144,6 +148,10 @@ _priceTrackingPromoItem = nil; } +- (void)addConsumer:(id<PriceTrackingPromoFaviconConsumer>)consumer { + _faviconConsumer = consumer; +} + - (void)fetchLatestSubscription { if (self->_priceTrackingPromoItem) { return; @@ -327,6 +335,7 @@ if (most_recent_subscription_product_image_url.is_empty()) { _priceTrackingPromoItem = [[PriceTrackingPromoItem alloc] init]; _priceTrackingPromoItem.commandHandler = self; + _priceTrackingPromoItem.priceTrackingPromoFaviconConsumerSource = self; [self onNewSubscriptionAvailable]; } else { // If we have an image, fetch it and display the price tracking promo @@ -375,6 +384,7 @@ - (void)onImageFetchedResult:(const std::string&)imageData productUrl:(const GURL&)productUrl { self->_priceTrackingPromoItem = [[PriceTrackingPromoItem alloc] init]; + self->_priceTrackingPromoItem.priceTrackingPromoFaviconConsumerSource = self; self->_priceTrackingPromoItem.commandHandler = self; NSData* data = [NSData dataWithBytes:imageData.data() length:imageData.size()]; @@ -393,15 +403,19 @@ } - (void)onFaviconReceived:(FaviconAttributes*)attributes { + if (attributes.faviconImage && !attributes.usesDefaultImage) { + self->_priceTrackingPromoItem.faviconImage = attributes.faviconImage; + if (_faviconCallbackCalledOnce) { + [_faviconConsumer + priceTrackingPromoFaviconCompleted:attributes.faviconImage]; + } + } // Return early without calling the delegate, if callback already called. // Can't condition on faviconImage, because it may be null. if (_faviconCallbackCalledOnce) { return; } _faviconCallbackCalledOnce = true; - if (attributes.faviconImage && !attributes.usesDefaultImage) { - self->_priceTrackingPromoItem.faviconImage = attributes.faviconImage; - } [self onNewSubscriptionAvailable]; }
diff --git a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_view.h b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_view.h index 9593aeb..106cba8 100644 --- a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_view.h +++ b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_view.h
@@ -7,11 +7,14 @@ #import <UIKit/UIKit.h> +#import "ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_mediator.h" + @protocol PriceTrackingPromoCommands; @class PriceTrackingPromoItem; // View for the Price Tracking Promo module. -@interface PriceTrackingPromoModuleView : UIView +@interface PriceTrackingPromoModuleView + : UIView <PriceTrackingPromoFaviconConsumer> // Configures this view with `config`. - (void)configureView:(PriceTrackingPromoItem*)config;
diff --git a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_view.mm b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_view.mm index 328ead5..6856409 100644 --- a/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_view.mm +++ b/ios/chrome/browser/ui/content_suggestions/price_tracking_promo/price_tracking_promo_view.mm
@@ -100,6 +100,84 @@ return mask; } +- (void)populateFaviconImageContainerAndView:(UIImage*)faviconImage { + if (_faviconImageView) { + _faviconImageView.image = faviconImage; + return; + } + + _faviconImageContainer = [[UIView alloc] init]; + _faviconImageContainer.translatesAutoresizingMaskIntoConstraints = NO; + _faviconImageContainer.layer.borderWidth = 0; + _faviconImageContainer.backgroundColor = + [UIColor colorNamed:kBackgroundColor]; + _faviconImageContainer.layer.cornerRadius = + kFaviconImageContainerCornerRadius; + _faviconImageContainer.layer.masksToBounds = YES; + // Apply bottom right radius mask + _faviconImageContainer.layer.mask = + [self faviconMaskWithRadius:kFaviconImageContainerTrailingCornerRadius + imageHeightWidth:kFaviconImageContainerHeightWidth]; + + _faviconImageView = [[UIImageView alloc] init]; + _faviconImageView.image = faviconImage; + _faviconImageView.contentMode = UIViewContentModeScaleAspectFill; + _faviconImageView.translatesAutoresizingMaskIntoConstraints = NO; + _faviconImageView.layer.borderWidth = 0; + _faviconImageView.layer.cornerRadius = kFaviconImageViewCornerRadius; + _faviconImageView.layer.masksToBounds = YES; + _faviconImageView.backgroundColor = [UIColor colorNamed:kBackgroundColor]; + // Apply bottom right radius mask + _faviconImageView.layer.mask = + [self faviconMaskWithRadius:kFaviconImageViewTrailingCornerRadius + imageHeightWidth:kFaviconImageViewHeightWidth]; +} + +- (void)addFaviconToProductImage { + [_productImage addSubview:_faviconImageContainer]; + [_faviconImageContainer addSubview:_faviconImageView]; +} + +- (void)addConstraintsForProductImage { + [NSLayoutConstraint activateConstraints:@[ + [_productImage.heightAnchor + constraintEqualToConstant:kProductImageWidthHeight], + [_productImage.widthAnchor + constraintEqualToAnchor:_productImage.heightAnchor], + [_productImageView.heightAnchor + constraintEqualToConstant:kProductImageWidthHeight], + [_productImageView.widthAnchor + constraintEqualToAnchor:_productImageView.heightAnchor], + [_gradientOverlay.heightAnchor + constraintEqualToConstant:kProductImageWidthHeight], + [_gradientOverlay.widthAnchor + constraintEqualToAnchor:_gradientOverlay.heightAnchor], + ]]; +} + +- (void)addConstraintsForFavicon { + [NSLayoutConstraint activateConstraints:@[ + [_faviconImageContainer.heightAnchor + constraintEqualToConstant:kFaviconImageContainerHeightWidth], + [_faviconImageContainer.widthAnchor + constraintEqualToAnchor:_faviconImageContainer.heightAnchor], + [_faviconImageContainer.trailingAnchor + constraintEqualToAnchor:_productImage.trailingAnchor + constant:kFaviconImageContainerTrailingMargin], + [_faviconImageContainer.bottomAnchor + constraintEqualToAnchor:_productImage.bottomAnchor + constant:kFaviconImageContainerTrailingMargin], + [_faviconImageView.heightAnchor + constraintEqualToConstant:kFaviconImageViewHeightWidth], + [_faviconImageView.widthAnchor + constraintEqualToAnchor:_faviconImageView.heightAnchor], + [_faviconImageView.centerXAnchor + constraintEqualToAnchor:_faviconImageContainer.centerXAnchor], + [_faviconImageView.centerYAnchor + constraintEqualToAnchor:_faviconImageContainer.centerYAnchor], + ]]; +} + - (void)configureView:(PriceTrackingPromoItem*)config { if (!config) { return; @@ -163,80 +241,20 @@ _gradientOverlay.layer.zPosition = 1; if (config.faviconImage) { - _faviconImageContainer = [[UIView alloc] init]; - _faviconImageContainer.translatesAutoresizingMaskIntoConstraints = NO; - _faviconImageContainer.layer.borderWidth = 0; - _faviconImageContainer.backgroundColor = - [UIColor colorNamed:kBackgroundColor]; - _faviconImageContainer.layer.cornerRadius = - kFaviconImageContainerCornerRadius; - _faviconImageContainer.layer.masksToBounds = YES; - // Apply bottom right radius mask - _faviconImageContainer.layer.mask = - [self faviconMaskWithRadius:kFaviconImageContainerTrailingCornerRadius - imageHeightWidth:kFaviconImageContainerHeightWidth]; - - _faviconImageView = [[UIImageView alloc] init]; - _faviconImageView.image = config.faviconImage; - _faviconImageView.contentMode = UIViewContentModeScaleAspectFill; - _faviconImageView.translatesAutoresizingMaskIntoConstraints = NO; - _faviconImageView.layer.borderWidth = 0; - _faviconImageView.layer.cornerRadius = kFaviconImageViewCornerRadius; - _faviconImageView.layer.masksToBounds = YES; - _faviconImageView.backgroundColor = [UIColor colorNamed:kBackgroundColor]; - // Apply bottom right radius mask - _faviconImageView.layer.mask = - [self faviconMaskWithRadius:kFaviconImageViewTrailingCornerRadius - imageHeightWidth:kFaviconImageViewHeightWidth]; + [self populateFaviconImageContainerAndView:config.faviconImage]; } [_productImage addSubview:_productImageView]; [_productImageView addSubview:_gradientOverlay]; if (_faviconImageContainer) { - [_productImage addSubview:_faviconImageContainer]; - [_faviconImageContainer addSubview:_faviconImageView]; + [self addFaviconToProductImage]; } - NSMutableArray* constraints = [[NSMutableArray alloc] init]; - [constraints addObjectsFromArray:@[ - [_productImage.heightAnchor - constraintEqualToConstant:kProductImageWidthHeight], - [_productImage.widthAnchor - constraintEqualToAnchor:_productImage.heightAnchor], - [_productImageView.heightAnchor - constraintEqualToConstant:kProductImageWidthHeight], - [_productImageView.widthAnchor - constraintEqualToAnchor:_productImageView.heightAnchor], - [_gradientOverlay.heightAnchor - constraintEqualToConstant:kProductImageWidthHeight], - [_gradientOverlay.widthAnchor - constraintEqualToAnchor:_gradientOverlay.heightAnchor], - ]]; + [self addConstraintsForProductImage]; if (_faviconImageContainer) { - [constraints addObjectsFromArray:@[ - [_faviconImageContainer.heightAnchor - constraintEqualToConstant:kFaviconImageContainerHeightWidth], - [_faviconImageContainer.widthAnchor - constraintEqualToAnchor:_faviconImageContainer.heightAnchor], - [_faviconImageContainer.trailingAnchor - constraintEqualToAnchor:_productImage.trailingAnchor - constant:kFaviconImageContainerTrailingMargin], - [_faviconImageContainer.bottomAnchor - constraintEqualToAnchor:_productImage.bottomAnchor - constant:kFaviconImageContainerTrailingMargin], - [_faviconImageView.heightAnchor - constraintEqualToConstant:kFaviconImageViewHeightWidth], - [_faviconImageView.widthAnchor - constraintEqualToAnchor:_faviconImageView.heightAnchor], - [_faviconImageView.centerXAnchor - constraintEqualToAnchor:_faviconImageContainer.centerXAnchor], - [_faviconImageView.centerYAnchor - constraintEqualToAnchor:_faviconImageContainer.centerYAnchor], - ]]; + [self addConstraintsForFavicon]; } - [NSLayoutConstraint activateConstraints:constraints]; - } else { _fallbackProductImageView = [[UIImageView alloc] init]; UIImageSymbolConfiguration* fallbackImageConfig = @@ -338,6 +356,14 @@ UIContentSizeCategoryExtraExtraLarge; } +#pragma mark - PriceTrackingPromoFaviconConsumer +- (void)priceTrackingPromoFaviconCompleted:(UIImage*)faviconImage { + [self populateFaviconImageContainerAndView:faviconImage]; + [self addFaviconToProductImage]; + [self addConstraintsForProductImage]; + [self addConstraintsForFavicon]; +} + #pragma mark - Testing category methods - (NSString*)titleLabelTextForTesting {
diff --git a/ios/chrome/browser/webui/ui_bundled/crashes_ui.cc b/ios/chrome/browser/webui/ui_bundled/crashes_ui.cc index 77de9aa..ddd0221c 100644 --- a/ios/chrome/browser/webui/ui_bundled/crashes_ui.cc +++ b/ios/chrome/browser/webui/ui_bundled/crashes_ui.cc
@@ -16,7 +16,8 @@ #include "base/values.h" #include "components/crash/core/browser/crashes_ui_util.h" #include "components/crash/core/common/reporter_running_ios.h" -#include "components/grit/dev_ui_components_resources.h" +#include "components/grit/crashes_resources.h" +#include "components/grit/crashes_resources_map.h" #include "components/strings/grit/components_branded_strings.h" #include "components/strings/grit/components_strings.h" #include "components/version_info/version_info.h" @@ -44,13 +45,8 @@ IDS_IOS_SHORT_PRODUCT_NAME); source->UseStringsJs(); - source->AddResourcePath(crash_reporter::kCrashesUICrashesJS, - IDR_CRASH_CRASHES_JS); - source->AddResourcePath(crash_reporter::kCrashesUICrashesCSS, - IDR_CRASH_CRASHES_CSS); - source->AddResourcePath(crash_reporter::kCrashesUISadTabSVG, - IDR_CRASH_SADTAB_SVG); - source->SetDefaultResource(IDR_CRASH_CRASHES_HTML); + source->AddResourcePaths(kCrashesResources); + source->AddResourcePath("", IDR_CRASHES_CRASHES_HTML); return source; }
diff --git a/ios_internal b/ios_internal index 3af99a5..99e655d 160000 --- a/ios_internal +++ b/ios_internal
@@ -1 +1 @@ -Subproject commit 3af99a5d7926566c96dc05b1f661b3d0b11b321b +Subproject commit 99e655dc13dd8c7c26118c100796228339923c65
diff --git a/media/base/mac/videotoolbox_helpers.cc b/media/base/mac/videotoolbox_helpers.cc index e9dc9be..dedf46d 100644 --- a/media/base/mac/videotoolbox_helpers.cc +++ b/media/base/mac/videotoolbox_helpers.cc
@@ -84,21 +84,17 @@ void CopyNalsToAnnexB(base::span<const char> buffer, AnnexBBuffer* annexb_buffer) { while (!buffer.empty()) { + const auto nal_size_be = + base::as_bytes(buffer.take_first<sizeof(NalSizeType)>()); NalSizeType nal_size; if constexpr (sizeof(NalSizeType) == 1u) { - nal_size = - base::U8FromBigEndian(base::as_bytes(buffer).template first<1u>()); + nal_size = base::U8FromBigEndian(nal_size_be); } else if constexpr (sizeof(NalSizeType) == 2u) { - nal_size = - base::U16FromBigEndian(base::as_bytes(buffer).template first<2u>()); + nal_size = base::U16FromBigEndian(nal_size_be); } else { - nal_size = - base::U32FromBigEndian(base::as_bytes(buffer).template first<4u>()); + nal_size = base::U32FromBigEndian(nal_size_be); } - - auto [nals_buf, remain] = - buffer.subspan(sizeof(NalSizeType)).split_at(nal_size); - buffer = remain; + auto nals_buf = buffer.take_first(nal_size); annexb_buffer->Append(kAnnexBHeaderBytes, sizeof(kAnnexBHeaderBytes)); annexb_buffer->Append(nals_buf.data(), nals_buf.size());
diff --git a/media/cast/sender/performance_metrics_overlay.cc b/media/cast/sender/performance_metrics_overlay.cc index a288d2f7..0d6dedf 100644 --- a/media/cast/sender/performance_metrics_overlay.cc +++ b/media/cast/sender/performance_metrics_overlay.cc
@@ -271,9 +271,9 @@ base::span<uint8_t> dst = frame->GetWritableVisiblePlaneData(plane); const size_t dst_stride = frame->stride(plane); for (size_t row = 0; row < row_count; ++row) { - dst.copy_prefix_from(src.first(bytes_per_row)); - src = src.subspan(src_stride); - dst = dst.subspan(dst_stride); + auto dst_row = dst.take_first(dst_stride); + auto src_row = src.take_first(src_stride); + dst_row.copy_prefix_from(src_row.first(bytes_per_row)); } } frame->metadata().MergeMetadataFrom(source->metadata());
diff --git a/media/formats/mp4/box_reader.cc b/media/formats/mp4/box_reader.cc index f408914..8bd0875d 100644 --- a/media/formats/mp4/box_reader.cc +++ b/media/formats/mp4/box_reader.cc
@@ -35,13 +35,13 @@ bool BufferReader::Read1(uint8_t* v) { RCHECK(HasBytes(1)); - *v = base::U8FromBigEndian(buf_.subspan(pos_).first<1u>()); + *v = base::U8FromBigEndian(buf_.subspan(pos_).first<1>()); pos_ += 1u; return true; } bool BufferReader::Read2(uint16_t* v) { RCHECK(HasBytes(2)); - *v = base::U16FromBigEndian(buf_.subspan(pos_).first<2u>()); + *v = base::U16FromBigEndian(buf_.subspan(pos_).first<2>()); pos_ += 2u; return true; } @@ -53,7 +53,7 @@ } bool BufferReader::Read4(uint32_t* v) { RCHECK(HasBytes(4)); - *v = base::U32FromBigEndian(buf_.subspan(pos_).first<4u>()); + *v = base::U32FromBigEndian(buf_.subspan(pos_).first<4>()); pos_ += 4u; return true; } @@ -65,7 +65,7 @@ } bool BufferReader::Read8(uint64_t* v) { RCHECK(HasBytes(8)); - *v = base::U64FromBigEndian(buf_.subspan(pos_).first<8u>()); + *v = base::U64FromBigEndian(buf_.subspan(pos_).first<8>()); pos_ += 8u; return true; }
diff --git a/media/formats/mp4/mp4_stream_parser_unittest.cc b/media/formats/mp4/mp4_stream_parser_unittest.cc index 3289ba85..6a0aa9c 100644 --- a/media/formats/mp4/mp4_stream_parser_unittest.cc +++ b/media/formats/mp4/mp4_stream_parser_unittest.cc
@@ -321,7 +321,7 @@ scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile("bear-1280x720-av_frag.mp4"); EXPECT_TRUE( - AppendAllDataThenParseInPieces(buffer->AsSpan().first(65536u), 512)); + AppendAllDataThenParseInPieces(buffer->AsSpan().first<65536>(), 512)); parser_->Flush(); EXPECT_TRUE(AppendAllDataThenParseInPieces(buffer->AsSpan(), 512)); }
diff --git a/media/formats/webm/webm_crypto_helpers.cc b/media/formats/webm/webm_crypto_helpers.cc index b4591444a..8c55042 100644 --- a/media/formats/webm/webm_crypto_helpers.cc +++ b/media/formats/webm/webm_crypto_helpers.cc
@@ -55,8 +55,7 @@ if (i < num_partitions) { // For each partition, the offset is read from the partition offset data. partition_offset = base::U32FromBigEndian( - buf.subspan(kWebMEncryptedFramePartitionOffsetSize * i) - .first<kWebMEncryptedFramePartitionOffsetSize>()); + buf.take_first<kWebMEncryptedFramePartitionOffsetSize>()); } else { // On the last iteration, we're past the last partition offset in `buf`, // and the offset is the remaining bytes in the frame.
diff --git a/media/gpu/v4l2/v4l2_stateful_video_decoder.cc b/media/gpu/v4l2/v4l2_stateful_video_decoder.cc index e5069a3a..fcf017b1 100644 --- a/media/gpu/v4l2/v4l2_stateful_video_decoder.cc +++ b/media/gpu/v4l2/v4l2_stateful_video_decoder.cc
@@ -1236,20 +1236,16 @@ if (nalu_info->is_whole_frame) { VLOGF(3) << "Found a whole frame, size=" << found_nalu_size << " bytes"; frames.emplace_back( - DecoderBuffer::CopyFrom(remaining.first(found_nalu_size)), + DecoderBuffer::CopyFrom(remaining.take_first(found_nalu_size)), base::DoNothing()); frames.back().first->set_timestamp(buffer->timestamp()); - - remaining = remaining.subspan(found_nalu_size); continue; } VLOGF(4) << "This was a frame fragment; storing it for later reassembly."; frame_fragments_.emplace_back( - DecoderBuffer::CopyFrom(remaining.first(found_nalu_size))); + DecoderBuffer::CopyFrom(remaining.take_first(found_nalu_size))); frame_fragments_.back()->set_timestamp(buffer->timestamp()); - - remaining = remaining.subspan(found_nalu_size); } while (!remaining.empty()); // |decode_cb| is used to signal to our client that encoded chunks have been
diff --git a/media/mojo/mojom/video_frame_mojom_traits_unittest.cc b/media/mojo/mojom/video_frame_mojom_traits_unittest.cc index b037c306..5de6664 100644 --- a/media/mojo/mojom/video_frame_mojom_traits_unittest.cc +++ b/media/mojo/mojom/video_frame_mojom_traits_unittest.cc
@@ -187,28 +187,27 @@ ASSERT_TRUE(region.IsValid()); auto mapping = region.MapAt(0, aggregate_size); - auto region_span = mapping.GetMemoryAsSpan<uint8_t>(); - auto y_plane = region_span.first(sizes[0]); - std::fill(y_plane.begin(), y_plane.end(), 1); + auto [y_plane, uv_plane] = + mapping.GetMemoryAsSpan<uint8_t>().split_at(sizes[0]); + std::ranges::fill(y_plane, 1); // Setup memory layout where U and V planes occupy the same space, but have - // interleaving Y and V rows. This is achieved by doubling the stride. - auto u_plane = region_span.subspan(sizes[0]); + // interleaving U and V rows. This is achieved by doubling the stride. size_t normal_stride = strides[1]; - auto v_plane = u_plane.subspan(normal_stride); - strides[1] = strides[2] = normal_stride * 2; + size_t uv_stride = normal_stride * 2; int yu_rows = media::VideoFrame::Rows(1, format, kCodedSize.height()); + auto uv_plane2 = uv_plane; // Loop below is destructive. for (int i = 0; i < yu_rows; ++i) { - auto u_row = u_plane.subspan(i * strides[1], normal_stride); - std::fill(u_row.begin(), u_row.end(), 2); - auto v_row = v_plane.subspan(i * strides[2], normal_stride); - std::fill(v_row.begin(), v_row.end(), 3); + const auto [u, v] = uv_plane2.take_first(uv_stride).split_at(normal_stride); + std::ranges::fill(u, 2); + std::ranges::fill(v, 3); } frame = media::VideoFrame::WrapExternalYuvData( - format, kCodedSize, kVisibleRect, kNaturalSize, strides[0], strides[1], - strides[2], y_plane.data(), u_plane.data(), v_plane.data(), kTimestamp); + format, kCodedSize, kVisibleRect, kNaturalSize, strides[0], uv_stride, + uv_stride, y_plane.data(), uv_plane.data(), + uv_plane.subspan(normal_stride).data(), kTimestamp); auto ro_region = base::WritableSharedMemoryRegion::ConvertToReadOnly(std::move(region)); frame->BackWithSharedMemory(&ro_region); @@ -220,17 +219,20 @@ EXPECT_EQ(frame->format(), format); EXPECT_EQ(frame->coded_size(), kCodedSize); + auto plane_1 = frame->GetVisiblePlaneData(1); + auto plane_2 = frame->GetVisiblePlaneData(2); // Bytes between the visible edge and the full stride are not considered part - // of the visible plane. + // of the visible plane, and may not be accessible through the above spans. const size_t row_bytes_1 = VideoFrame::RowBytes(1, format, kCodedSize.width()); const size_t row_bytes_2 = VideoFrame::RowBytes(2, format, kCodedSize.width()); for (int i = 0; i < yu_rows; ++i) { - EXPECT_EQ(0, memcmp(frame->visible_data(1) + i * frame->stride(1), - u_plane.data() + i * strides[1], row_bytes_1)); - EXPECT_EQ(0, memcmp(frame->visible_data(2) + i * frame->stride(2), - v_plane.data() + i * strides[2], row_bytes_2)); + const auto [u, v] = uv_plane.take_first(uv_stride).split_at(normal_stride); + EXPECT_EQ(plane_1.subspan(i * frame->stride(1), row_bytes_1), + u.first(row_bytes_1)); + EXPECT_EQ(plane_2.subspan(i * frame->stride(2), row_bytes_2), + v.first(row_bytes_2)); } }
diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni index 57bf310..d3694c1 100644 --- a/mojo/public/tools/bindings/mojom.gni +++ b/mojo/public/tools/bindings/mojom.gni
@@ -63,10 +63,6 @@ if (is_chromeos_ash) { enable_mojom_closure_compile = enable_js_type_check && optimize_webui } - - # Temporary option to allow testonly=true mojom to include .mojom files. - # TODO(crbug.com/383380971): Remove once migration is complete. - allow_dot_mojom_in_testonly_mojom = true } # Closure libraries are needed for mojom_closure_compile, and when @@ -682,16 +678,14 @@ [ string_replace(path, rebase_path(root_gen_dir, "//") + "/", "") ] } - # Sanity check that either all input files have a .mojom extension, or - # all input files have a .test-mojom extension AND |testonly| is |true|. + # Sanity check that either all input files have a .mojom extension, or, for + # testonly targets, that all input files have a .test-mojom extension. sources_list_filenames = process_file_template(sources_list, "{{source_file_part}}") sources_list_filenames_with_mojom_extension = process_file_template(sources_list, "{{source_name_part}}.mojom") if (sources_list_filenames == sources_list_filenames_with_mojom_extension) { - # Force testonly mojom() to use .test-mojom only using transitional option. - # See crbug.com/383380971 for migration details. - if (!allow_dot_mojom_in_testonly_mojom && defined(invoker.sources)) { + if (defined(invoker.sources)) { assert(!defined(invoker.testonly) || !invoker.testonly, "testonly mojom target has non- .test-mojom files") }
diff --git a/net/BUILD.gn b/net/BUILD.gn index f9903053..9a975f1 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -3403,6 +3403,7 @@ ] deps += [ ":device_bound_sessions_storage_proto", + "//components/unexportable_keys:test_support", "//components/unexportable_keys:unexportable_keys", ] }
diff --git a/net/device_bound_sessions/registration_fetcher.cc b/net/device_bound_sessions/registration_fetcher.cc index 5520a54..d3456b6 100644 --- a/net/device_bound_sessions/registration_fetcher.cc +++ b/net/device_bound_sessions/registration_fetcher.cc
@@ -8,6 +8,7 @@ #include <utility> #include <vector> +#include "base/debug/stack_trace.h" #include "components/unexportable_keys/background_task_priority.h" #include "components/unexportable_keys/unexportable_key_service.h" #include "net/base/io_buffer.h" @@ -223,12 +224,11 @@ void Start(std::optional<std::string> challenge, std::optional<std::string> authorization) { - if (challenge.has_value()) { - SignChallengeWithKey( - *key_service_, key_id_, fetcher_endpoint_, *challenge, - std::move(authorization), - base::BindOnce(&RegistrationFetcherImpl::OnRegistrationTokenCreated, - base::Unretained(this))); + current_challenge_ = std::move(challenge); + current_authorization_ = std::move(authorization); + + if (current_challenge_.has_value()) { + AttemptChallengeSigning(); return; } @@ -242,11 +242,33 @@ } private: + static constexpr size_t kMaxSigningFailures = 2; + + void AttemptChallengeSigning() { + SignChallengeWithKey( + *key_service_, key_id_, fetcher_endpoint_, *current_challenge_, + current_authorization_, + base::BindOnce(&RegistrationFetcherImpl::OnRegistrationTokenCreated, + base::Unretained(this))); + } + void OnRegistrationTokenCreated( std::optional<RegistrationFetcher::RegistrationTokenResult> result) { if (!result) { - RunCallbackAndDeleteSelf(std::nullopt); - return; + number_of_signing_failures_++; + if (number_of_signing_failures_ < kMaxSigningFailures) { + AttemptChallengeSigning(); + return; + } else if (session_identifier_.has_value()) { + SessionTerminationParams params{*session_identifier_}; + RunCallbackAndDeleteSelf( + std::make_optional<RegistrationFetcher::RegistrationCompleteParams>( + std::move(params), key_id_, fetcher_endpoint_)); + return; + } else { + RunCallbackAndDeleteSelf(std::nullopt); + return; + } } request_ = CreateBaseRequest(); @@ -324,6 +346,10 @@ std::unique_ptr<URLRequest> request_; scoped_refptr<IOBuffer> buf_; std::string data_received_; + + std::optional<std::string> current_challenge_; + std::optional<std::string> current_authorization_; + size_t number_of_signing_failures_ = 0; }; RegistrationFetcher::FetcherType g_mock_fetcher = nullptr;
diff --git a/net/device_bound_sessions/registration_fetcher_unittest.cc b/net/device_bound_sessions/registration_fetcher_unittest.cc index f9542c97..75fb0d9 100644 --- a/net/device_bound_sessions/registration_fetcher_unittest.cc +++ b/net/device_bound_sessions/registration_fetcher_unittest.cc
@@ -11,8 +11,10 @@ #include "base/functional/bind.h" #include "base/functional/callback.h" #include "base/run_loop.h" +#include "base/test/gmock_callback_support.h" #include "base/test/scoped_feature_list.h" #include "base/test/test_future.h" +#include "components/unexportable_keys/mock_unexportable_key_service.h" #include "components/unexportable_keys/unexportable_key_service.h" #include "components/unexportable_keys/unexportable_key_service_impl.h" #include "components/unexportable_keys/unexportable_key_task_manager.h" @@ -44,7 +46,11 @@ namespace { +using ::testing::_; using ::testing::ElementsAre; +using ::testing::Invoke; +using ::testing::Return; +using ::testing::WithArg; constexpr char kBasicValidJson[] = R"({ @@ -77,6 +83,8 @@ crypto::SignatureVerifier::SignatureAlgorithm::RSA_PKCS1_SHA256}; } +struct InvokeCallbackArgumentAction {}; + class RegistrationTest : public TestWithTaskEnvironment { protected: RegistrationTest() @@ -988,6 +996,85 @@ EXPECT_EQ(session_params->session_id, "session_id"); } +TEST_F(RegistrationTest, RetriesOnKeyFailure) { + crypto::ScopedMockUnexportableKeyProvider scoped_mock_key_provider_; + server_.RegisterRequestHandler( + base::BindRepeating(&ReturnResponse, HTTP_OK, kBasicValidJson)); + ASSERT_TRUE(server_.Start()); + + unexportable_keys::MockUnexportableKeyService mock_service; + + // We only want to mock the first call to SignSlowlyAsync, so proxy + // other required calls to `unexportable_key_service()`. + EXPECT_CALL(mock_service, GetAlgorithm(_)) + .WillRepeatedly( + Invoke(&unexportable_key_service(), + &unexportable_keys::UnexportableKeyService::GetAlgorithm)); + EXPECT_CALL(mock_service, GetSubjectPublicKeyInfo(_)) + .WillRepeatedly(Invoke( + &unexportable_key_service(), + &unexportable_keys::UnexportableKeyService::GetSubjectPublicKeyInfo)); + EXPECT_CALL(mock_service, SignSlowlyAsync(_, _, _, _)) + .WillOnce(base::test::RunOnceCallback<3>( + base::unexpected(unexportable_keys::ServiceError::kCryptoApiFailed))) + .WillOnce( + Invoke(&unexportable_key_service(), + &unexportable_keys::UnexportableKeyService::SignSlowlyAsync)); + + TestRegistrationCallback callback; + auto isolation_info = IsolationInfo::CreateTransient(); + auto request_param = RegistrationRequestParam::CreateForTesting( + server_.base_url(), kSessionIdentifier, kChallenge); + CreateKeyAndRunCallback(base::BindOnce( + &RegistrationFetcher::StartFetchWithExistingKey, std::move(request_param), + std::ref(mock_service), context_.get(), std::ref(isolation_info), + callback.callback())); + callback.WaitForCall(); + std::optional<RegistrationFetcher::RegistrationCompleteParams> out_params = + callback.outcome(); + ASSERT_TRUE(out_params); + const SessionParams* session_params = + std::get_if<SessionParams>(&out_params->params); + EXPECT_TRUE(session_params); +} + +TEST_F(RegistrationTest, TerminateSessionOnRepeatedFailure) { + crypto::ScopedMockUnexportableKeyProvider scoped_mock_key_provider_; + server_.RegisterRequestHandler( + base::BindRepeating(&ReturnResponse, HTTP_OK, kBasicValidJson)); + ASSERT_TRUE(server_.Start()); + + unexportable_keys::MockUnexportableKeyService mock_service; + + EXPECT_CALL(mock_service, GetAlgorithm(_)) + .WillRepeatedly( + Invoke(&unexportable_key_service(), + &unexportable_keys::UnexportableKeyService::GetAlgorithm)); + EXPECT_CALL(mock_service, GetSubjectPublicKeyInfo(_)) + .WillRepeatedly(Invoke( + &unexportable_key_service(), + &unexportable_keys::UnexportableKeyService::GetSubjectPublicKeyInfo)); + EXPECT_CALL(mock_service, SignSlowlyAsync(_, _, _, _)) + .WillRepeatedly(base::test::RunOnceCallbackRepeatedly<3>( + base::unexpected(unexportable_keys::ServiceError::kCryptoApiFailed))); + + TestRegistrationCallback callback; + auto request_param = RegistrationRequestParam::CreateForTesting( + server_.base_url(), kSessionIdentifier, kChallenge); + CreateKeyAndRunCallback(base::BindOnce( + &RegistrationFetcher::StartFetchWithExistingKey, std::move(request_param), + std::ref(mock_service), context_.get(), IsolationInfo::CreateTransient(), + callback.callback())); + callback.WaitForCall(); + + std::optional<RegistrationFetcher::RegistrationCompleteParams> out_params = + callback.outcome(); + ASSERT_TRUE(out_params); + const SessionTerminationParams* session_params = + std::get_if<SessionTerminationParams>(&out_params->params); + EXPECT_TRUE(session_params); +} + class RegistrationTokenHelperTest : public testing::Test { public: RegistrationTokenHelperTest() : unexportable_key_service_(task_manager_) {}
diff --git a/net/log/trace_net_log_observer_unittest.cc b/net/log/trace_net_log_observer_unittest.cc index dea05759..051a610 100644 --- a/net/log/trace_net_log_observer_unittest.cc +++ b/net/log/trace_net_log_observer_unittest.cc
@@ -81,7 +81,7 @@ void EnableTraceLog(std::string_view category) { TraceLog::GetInstance()->SetEnabled( - base::trace_event::TraceConfig(category, ""), TraceLog::RECORDING_MODE); + base::trace_event::TraceConfig(category, "")); // AsyncEnabledStateObserver will receive enabled notification one message // loop iteration later. base::RunLoop().RunUntilIdle();
diff --git a/sandbox/policy/features.cc b/sandbox/policy/features.cc index a19dd78..2c7d416 100644 --- a/sandbox/policy/features.cc +++ b/sandbox/policy/features.cc
@@ -107,10 +107,11 @@ "WinSboxRestrictCoreSharingOnRenderer", base::FEATURE_DISABLED_BY_DEFAULT); -// Enables parallel process launching using the thread pool. +// Enables parallel process launching using the thread pool. Flag retained +// as a kill-switch. BASE_FEATURE(kWinSboxParallelProcessLaunch, "WinSboxParallelProcessLaunch", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); // Enables Csrss lockdown in supported processes by closing all ALPC // ports before sandbox lockdown. See crbug.com/40408399 for details.
diff --git a/services/network/network_service.cc b/services/network/network_service.cc index 008f3eec..db28bb19 100644 --- a/services/network/network_service.cc +++ b/services/network/network_service.cc
@@ -85,7 +85,6 @@ #include "services/network/public/cpp/crash_keys.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/initiator_lock_compatibility.h" -#include "services/network/public/cpp/load_info_util.h" #include "services/network/public/cpp/network_switches.h" #include "services/network/public/cpp/parsed_headers.h" #include "services/network/public/mojom/key_pinning.mojom.h"
diff --git a/services/network/public/cpp/BUILD.gn b/services/network/public/cpp/BUILD.gn index 6021427..515f8b1 100644 --- a/services/network/public/cpp/BUILD.gn +++ b/services/network/public/cpp/BUILD.gn
@@ -88,8 +88,6 @@ "is_potentially_trustworthy.h", "link_header_parser.cc", "link_header_parser.h", - "load_info_util.cc", - "load_info_util.h", "loading_params.cc", "loading_params.h", "net_adapters.cc",
diff --git a/services/network/public/cpp/load_info_util.cc b/services/network/public/cpp/load_info_util.cc deleted file mode 100644 index be83fbda..0000000 --- a/services/network/public/cpp/load_info_util.cc +++ /dev/null
@@ -1,31 +0,0 @@ -// Copyright 2019 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "services/network/public/cpp/load_info_util.h" - -#include "net/base/load_states.h" -#include "services/network/public/mojom/url_loader_network_service_observer.mojom.h" - -namespace network { - -bool LoadInfoIsMoreInteresting(const mojom::LoadInfo& a, - const mojom::LoadInfo& b) { - // Set |*_uploading_size| to be the size of the corresponding upload body if - // it's currently being uploaded. - - uint64_t a_uploading_size = 0; - if (a.load_state == net::LOAD_STATE_SENDING_REQUEST) - a_uploading_size = a.upload_size; - - uint64_t b_uploading_size = 0; - if (b.load_state == net::LOAD_STATE_SENDING_REQUEST) - b_uploading_size = b.upload_size; - - if (a_uploading_size != b_uploading_size) - return a_uploading_size > b_uploading_size; - - return a.load_state > b.load_state; -} - -} // namespace network
diff --git a/services/network/public/cpp/load_info_util.h b/services/network/public/cpp/load_info_util.h deleted file mode 100644 index ea2e82b..0000000 --- a/services/network/public/cpp/load_info_util.h +++ /dev/null
@@ -1,38 +0,0 @@ -// Copyright 2019 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SERVICES_NETWORK_PUBLIC_CPP_LOAD_INFO_UTIL_H_ -#define SERVICES_NETWORK_PUBLIC_CPP_LOAD_INFO_UTIL_H_ - -#include "base/component_export.h" - -namespace network { - -namespace mojom { -class LoadInfo; -} - -// This function returns true if the LoadInfo of |a| is "more interesting" -// than the LoadInfo of |b|. The load that is currently sending the larger -// request body is considered more interesting. If neither request is -// sending a body (Neither request has a body, or any request that has a body -// is not currently sending the body), the request that is further along is -// considered more interesting. -// -// This takes advantage of the fact that the load states are an enumeration -// listed in the order in which they usually occur during the lifetime of a -// request, so states with larger numeric values are generally further along -// toward completion. -// -// For example, by this measure "tranferring data" is a more interesting state -// than "resolving host" because when transferring data something is being -// done that corresponds to changes that the user might observe, whereas -// waiting for a host name to resolve implies being stuck. -COMPONENT_EXPORT(NETWORK_CPP) -bool LoadInfoIsMoreInteresting(const mojom::LoadInfo& a, - const mojom::LoadInfo& b); - -} // namespace network - -#endif // SERVICES_NETWORK_PUBLIC_CPP_LOAD_INFO_UTIL_H_ \ No newline at end of file
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom index 8fd16239..cd41d9f 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom
@@ -838,10 +838,6 @@ // take precedence over automatically assigning an IsolationInfo. bool automatically_assign_isolation_info = false; - // Whether URLLoaders created by this factory need to call - // URLLoaderNetworkServiceObserver::OnLoadingStateUpdate. - bool provide_loading_state_updates = false; - // An identifier for toplevel frame. This is used for resource accounting // for keepalive requests. When this factory is for a dedicated worker, // the identifier for the toplevel frame of the ancestor's frame is given.
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc index 40139cd7..9fc2e09 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc
@@ -581,11 +581,6 @@ return nullptr; } -URLLoader::PartialLoadInfo::PartialLoadInfo(net::LoadStateWithParam load_state, - net::UploadProgress upload_progress) - : load_state(std::move(load_state)), - upload_progress(std::move(upload_progress)) {} - URLLoader::URLLoader( URLLoaderContext& context, DeleteCallback delete_callback, @@ -2415,20 +2410,6 @@ return net::OK; } -URLLoader::PartialLoadInfo URLLoader::GetPartialLoadInfo() const { - return PartialLoadInfo(url_request_->GetLoadState(), - url_request_->GetUploadProgress()); -} - -mojom::LoadInfoPtr URLLoader::CreateLoadInfo( - const PartialLoadInfo& partial_load_info) { - return mojom::LoadInfo::New( - base::TimeTicks::Now(), url_request_->url().host(), - partial_load_info.load_state.state, partial_load_info.load_state.param, - partial_load_info.upload_progress.position(), - partial_load_info.upload_progress.size()); -} - net::LoadState URLLoader::GetLoadState() const { return url_request_->GetLoadState().state; }
diff --git a/services/network/url_loader.h b/services/network/url_loader.h index b350754..7f0026dc 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h
@@ -136,24 +136,6 @@ base::WeakPtr<mojom::URLLoaderClient> sync_client_; }; - // A subset of the fields in mojom::LoadInfo. - struct PartialLoadInfo final { - PartialLoadInfo() = default; - PartialLoadInfo(net::LoadStateWithParam load_state, - net::UploadProgress upload_progress); - - // Avoid accidentally copying this object as `load_state` contains a string. - PartialLoadInfo(const PartialLoadInfo&) = delete; - PartialLoadInfo& operator=(const PartialLoadInfo&) = delete; - - // Moving it is good. - PartialLoadInfo(PartialLoadInfo&&) = default; - PartialLoadInfo& operator=(PartialLoadInfo&&) = default; - - net::LoadStateWithParam load_state; - net::UploadProgress upload_progress; - }; - // `delete_callback` tells the URLLoader's owner to destroy the URLLoader. // // `trust_token_helper_factory` must be non-null exactly when the request has @@ -319,14 +301,6 @@ void SetEnableReportingRawHeaders(bool enable); - // Returns a subset of the info in mojom::LoadInfo. This is sufficient to make - // a decision on whether to call CreateLoadInfo() for this loader. - PartialLoadInfo GetPartialLoadInfo() const; - - // Returns a mojom::LoadInfo, reusing the data returned by - // GetPartialLoadInfo(). - mojom::LoadInfoPtr CreateLoadInfo(const PartialLoadInfo& partial_load_info); - // Gets the URLLoader associated with this request. static URLLoader* ForRequest(const net::URLRequest& request);
diff --git a/services/network/url_loader_factory.cc b/services/network/url_loader_factory.cc index 771cba9f..86b41c4 100644 --- a/services/network/url_loader_factory.cc +++ b/services/network/url_loader_factory.cc
@@ -28,7 +28,6 @@ #include "services/network/network_service.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/is_potentially_trustworthy.h" -#include "services/network/public/cpp/load_info_util.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/devtools_observer.mojom.h" #include "services/network/public/mojom/network_context.mojom.h" @@ -42,35 +41,6 @@ namespace network { -namespace { - -// The interval to send load updates. -constexpr auto kUpdateLoadStatesInterval = base::Milliseconds(250); - -bool LoadInfoIsMoreInteresting(const URLLoader::PartialLoadInfo& a, - const URLLoader::PartialLoadInfo& b) { - // Set |*_uploading_size| to be the size of the corresponding upload body if - // it's currently being uploaded. - - uint64_t a_uploading_size = 0; - if (a.load_state.state == net::LOAD_STATE_SENDING_REQUEST) { - a_uploading_size = a.upload_progress.size(); - } - - uint64_t b_uploading_size = 0; - if (b.load_state.state == net::LOAD_STATE_SENDING_REQUEST) { - b_uploading_size = b.upload_progress.size(); - } - - if (a_uploading_size != b_uploading_size) { - return a_uploading_size > b_uploading_size; - } - - return a.load_state.state > b.load_state.state; -} - -} // namespace - constexpr int URLLoaderFactory::kMaxKeepaliveConnections; constexpr int URLLoaderFactory::kMaxKeepaliveConnectionsPerTopLevelFrame; constexpr int URLLoaderFactory::kMaxTotalKeepaliveRequestSize; @@ -265,8 +235,6 @@ return; } - MaybeStartUpdateLoadInfoTimer(); - std::unique_ptr<TrustTokenRequestHelperFactory> trust_token_factory; if (resource_request.trust_token_params) { trust_token_factory = std::make_unique<TrustTokenRequestHelperFactory>( @@ -444,49 +412,4 @@ ->GetDefaultURLLoaderNetworkServiceObserver(); } -void URLLoaderFactory::AckUpdateLoadInfo() { - DCHECK(waiting_on_load_state_ack_); - waiting_on_load_state_ack_ = false; - MaybeStartUpdateLoadInfoTimer(); -} - -void URLLoaderFactory::MaybeStartUpdateLoadInfoTimer() { - if (!params_->provide_loading_state_updates || - !GetURLLoaderNetworkServiceObserver() || waiting_on_load_state_ack_ || - update_load_info_timer_.IsRunning()) { - return; - } - update_load_info_timer_.Start(FROM_HERE, kUpdateLoadStatesInterval, this, - &URLLoaderFactory::UpdateLoadInfo); -} - -void URLLoaderFactory::UpdateLoadInfo() { - DCHECK(!waiting_on_load_state_ack_); - - URLLoader* most_interesting_url_loader = nullptr; - URLLoader::PartialLoadInfo most_interesting_load_info; - - SCOPED_UMA_HISTOGRAM_TIMER("NetworkService.URLLoaderFactory.UpdateLoadInfo"); - - for (auto& loader : cors_url_loader_factory_->url_loaders()) { - URLLoader::PartialLoadInfo load_info = loader->GetPartialLoadInfo(); - - if (!most_interesting_url_loader || - LoadInfoIsMoreInteresting(load_info, most_interesting_load_info)) { - most_interesting_url_loader = loader.get(); - most_interesting_load_info = std::move(load_info); - } - } - - if (most_interesting_url_loader) { - most_interesting_url_loader->GetURLLoaderNetworkServiceObserver() - ->OnLoadingStateUpdate( - most_interesting_url_loader->CreateLoadInfo( - most_interesting_load_info), - base::BindOnce(&URLLoaderFactory::AckUpdateLoadInfo, - base::Unretained(this))); - waiting_on_load_state_ack_ = true; - } -} - } // namespace network
diff --git a/services/network/url_loader_factory.h b/services/network/url_loader_factory.h index fb84619..b8b892c 100644 --- a/services/network/url_loader_factory.h +++ b/services/network/url_loader_factory.h
@@ -115,20 +115,6 @@ static constexpr int kMaxTotalKeepaliveRequestSize = 512 * 1024; private: - // Starts the timer to call - // URLLoaderNetworkServiceObserver::OnLoadingStateUpdate(), if - // needed. - void MaybeStartUpdateLoadInfoTimer(); - - // Invoked once the browser has acknowledged receiving the previous LoadInfo. - // Sets |waiting_on_load_state_ack_| to false, and calls - // MaybeStartUpdateLoadeInfoTimer. - void AckUpdateLoadInfo(); - - // Finds the most relevant URLLoader that is outstanding and asks it to - // send an update. - void UpdateLoadInfo(); - // The NetworkContext that indirectly owns |this|. const raw_ptr<NetworkContext> context_; mojom::URLLoaderFactoryParamsPtr params_; @@ -152,9 +138,6 @@ mojo::Remote<mojom::DevToolsObserver> devtools_observer_; mojo::Remote<mojom::DeviceBoundSessionAccessObserver> device_bound_session_observer_; - - base::OneShotTimer update_load_info_timer_; - bool waiting_on_load_state_ack_ = false; }; } // namespace network
diff --git a/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_integration_unittest.cc b/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_integration_unittest.cc index f7004ea..1486b8d 100644 --- a/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_integration_unittest.cc +++ b/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_integration_unittest.cc
@@ -222,14 +222,12 @@ protected: void EnableMemoryInfraTracing() { TraceLog::GetInstance()->SetEnabled( - TraceConfig(MemoryDumpManager::kTraceCategory, ""), - TraceLog::RECORDING_MODE); + TraceConfig(MemoryDumpManager::kTraceCategory, "")); } void EnableMemoryInfraTracingWithTraceConfig( const std::string& trace_config) { - TraceLog::GetInstance()->SetEnabled(TraceConfig(trace_config), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(TraceConfig(trace_config)); } void DisableTracing() { TraceLog::GetInstance()->SetDisabled(); } @@ -492,10 +490,8 @@ auto thread = std::make_unique<base::TestIOThread>(base::TestIOThread::kAutoStart); - TraceLog::GetInstance()->SetEnabled( - TraceConfig(kMemoryInfraTracingOnly, - base::trace_event::RECORD_UNTIL_FULL), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(TraceConfig( + kMemoryInfraTracingOnly, base::trace_event::RECORD_UNTIL_FULL)); // Creating a new thread after tracing has started causes the posted // TRACE_EVENT0 to initialize and register a new ThreadLocalEventBuffer. @@ -523,10 +519,8 @@ // The bug here conisted in MemoryDumpManager::InvokeOnMemoryDump() to hit // that (which in turn causes an invalidation of the ThreadLocalEventBuffer) // after having checked that the MDP is valid and having decided to invoke it. - TraceLog::GetInstance()->SetEnabled( - TraceConfig(kMemoryInfraTracingOnly, - base::trace_event::RECORD_CONTINUOUSLY), - TraceLog::RECORDING_MODE); + TraceLog::GetInstance()->SetEnabled(TraceConfig( + kMemoryInfraTracingOnly, base::trace_event::RECORD_CONTINUOUSLY)); EXPECT_TRUE(RequestChromeDumpAndWait(MemoryDumpType::kExplicitlyTriggered, MemoryDumpLevelOfDetail::kDetailed)); DisableTracing();
diff --git a/services/tracing/perfetto/consumer_host_unittest.cc b/services/tracing/perfetto/consumer_host_unittest.cc index 29a5a19d..e4c4584 100644 --- a/services/tracing/perfetto/consumer_host_unittest.cc +++ b/services/tracing/perfetto/consumer_host_unittest.cc
@@ -557,7 +557,13 @@ no_more_data.Run(); } -TEST_F(TracingConsumerTest, FlushProducers) { +#if BUILDFLAG(IS_APPLE) +// TODO(crbug.com/383878432): Re-enable this test +#define MAYBE_FlushProducers DISABLED_FlushProducers +#else +#define MAYBE_FlushProducers FlushProducers +#endif +TEST_F(TracingConsumerTest, MAYBE_FlushProducers) { EnableTracingWithDataSourceName(kDataSourceName); threaded_perfetto_service()->CreateProducer();
diff --git a/testing/PRESUBMIT.py b/testing/PRESUBMIT.py index ff08f0a25..1c2a6b0 100644 --- a/testing/PRESUBMIT.py +++ b/testing/PRESUBMIT.py
@@ -9,6 +9,27 @@ PRESUBMIT_VERSION = '2.0.0' +PYLINT_PATHS_COMPONENTS = [ + ('build', ), + ('build', 'android'), + ('build', 'util'), + ('content', 'test', 'gpu'), + ('testing', ), + ('testing', 'buildbot'), + ('testing', 'scripts'), + ('testing', 'variations', 'presubmit'), + ('third_party', ), + ('third_party', 'blink', 'renderer', 'bindings', 'scripts'), + ('third_party', 'blink', 'tools'), + ('third_party', 'catapult', 'telemetry'), + ('third_party', 'catapult', 'third_party', 'typ'), + ('third_party', 'catapult', 'tracing'), + ('third_party', 'domato', 'src'), + ('third_party', 'js_code_coverage'), + ('third_party', 'webdriver', 'pylib'), + ('tools', 'perf'), +] + def _GetChromiumSrcPath(input_api): """Returns the path to the Chromium src directory.""" @@ -59,10 +80,9 @@ """Runs pylint on all directory content and subdirectories.""" files_to_skip = input_api.DEFAULT_FILES_TO_SKIP chromium_src_path = _GetChromiumSrcPath(input_api) - extra_path_components = [('testing', )] pylint_extra_paths = [ input_api.os_path.join(chromium_src_path, *component) - for component in extra_path_components + for component in PYLINT_PATHS_COMPONENTS ] if input_api.is_windows: # These scripts don't run on Windows and should not be linted on Windows -
diff --git a/testing/buildbot/buildbot_json_magic_substitutions_unittest.py b/testing/buildbot/buildbot_json_magic_substitutions_unittest.py index 3426494..e07e6d9 100755 --- a/testing/buildbot/buildbot_json_magic_substitutions_unittest.py +++ b/testing/buildbot/buildbot_json_magic_substitutions_unittest.py
@@ -5,6 +5,7 @@ import unittest +# //testing/buildbot imports. import buildbot_json_magic_substitutions as magic_substitutions
diff --git a/testing/buildbot/generate_buildbot_json.py b/testing/buildbot/generate_buildbot_json.py index ebf16a8..512bf75 100755 --- a/testing/buildbot/generate_buildbot_json.py +++ b/testing/buildbot/generate_buildbot_json.py
@@ -20,6 +20,7 @@ import string import sys +# //testing/buildbot imports. import buildbot_json_magic_substitutions as magic_substitutions # pylint: disable=super-with-arguments,useless-super-delegation
diff --git a/testing/buildbot/generate_buildbot_json_coveragetest.py b/testing/buildbot/generate_buildbot_json_coveragetest.py index 6bfc062..9dd4cc4 100755 --- a/testing/buildbot/generate_buildbot_json_coveragetest.py +++ b/testing/buildbot/generate_buildbot_json_coveragetest.py
@@ -7,7 +7,8 @@ import sys import unittest -import coverage +# vpython-provided modules. +import coverage # pylint: disable=import-error class FakeStream(object): # pylint: disable=useless-object-inheritance @@ -20,6 +21,7 @@ def main(): cov = coverage.coverage(include='*generate_buildbot_json.py') cov.start() + # //testing/buildbot imports. # pylint: disable=import-outside-toplevel import generate_buildbot_json_unittest # pylint: enable=import-outside-toplevel
diff --git a/testing/buildbot/generate_buildbot_json_unittest.py b/testing/buildbot/generate_buildbot_json_unittest.py index 81d19c5..11116acf 100755 --- a/testing/buildbot/generate_buildbot_json_unittest.py +++ b/testing/buildbot/generate_buildbot_json_unittest.py
@@ -11,8 +11,11 @@ import re import unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error + +# //testing/buildbot imports. import generate_buildbot_json -from pyfakefs import fake_filesystem_unittest # pylint: disable=super-with-arguments
diff --git a/testing/buildbot/internal.optimization_guide.json b/testing/buildbot/internal.optimization_guide.json index 0fa58c95..d319de5 100644 --- a/testing/buildbot/internal.optimization_guide.json +++ b/testing/buildbot/internal.optimization_guide.json
@@ -488,6 +488,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "model_validation_tests_light", @@ -514,6 +515,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "model_validation_tests_light", @@ -540,6 +542,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "model_validation_tests_light", @@ -565,6 +568,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ondevice_stability_tests_light", @@ -590,6 +594,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ondevice_stability_tests_light", @@ -615,6 +620,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ondevice_stability_tests_light", @@ -1889,6 +1895,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "chrome_ml_unittests", @@ -1909,6 +1916,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "browser_tests", @@ -1929,6 +1937,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "components_unittests", @@ -1949,6 +1958,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "optimization_guide_gpu_unittests", @@ -1966,6 +1976,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "optimization_guide_unittests", @@ -1996,6 +2007,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "model_validation_tests", @@ -2020,6 +2032,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "model_validation_tests_light", @@ -2047,6 +2060,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ondevice_stability_tests", @@ -2068,6 +2082,7 @@ "pool": "chrome.tests", "screen_scaling_percent": "100" }, + "expiration": 7200, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "ondevice_stability_tests_light",
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl index a5998a670..02b2245 100644 --- a/testing/buildbot/mixins.pyl +++ b/testing/buildbot/mixins.pyl
@@ -678,6 +678,7 @@ 'cpu': 'arm64', 'os': 'Windows-11', }, + 'expiration': 7200, }, }, 'win10': {
diff --git a/testing/buildbot/query_optimal_shard_counts_unittest.py b/testing/buildbot/query_optimal_shard_counts_unittest.py index e0c78ae..5256f99 100755 --- a/testing/buildbot/query_optimal_shard_counts_unittest.py +++ b/testing/buildbot/query_optimal_shard_counts_unittest.py
@@ -13,6 +13,7 @@ import unittest from unittest import mock +# //testing/buildbot imports. import query_optimal_shard_counts # Protected access is allowed for unittests.
diff --git a/testing/buildbot/scripts/upload_test_result_artifacts_unittest.py b/testing/buildbot/scripts/upload_test_result_artifacts_unittest.py index add0d5e..19f05b9 100644 --- a/testing/buildbot/scripts/upload_test_result_artifacts_unittest.py +++ b/testing/buildbot/scripts/upload_test_result_artifacts_unittest.py
@@ -8,7 +8,7 @@ import string import tempfile import unittest -from unitttest import mock +from unittest import mock import upload_test_result_artifacts
diff --git a/testing/chromoting/chromoting_test_utilities.py b/testing/chromoting/chromoting_test_utilities.py index 73719bf..3a27aee 100644 --- a/testing/chromoting/chromoting_test_utilities.py +++ b/testing/chromoting/chromoting_test_utilities.py
@@ -13,7 +13,8 @@ import socket import subprocess -import psutil +# vpython-provided modules. +import psutil # pylint: disable=import-error PROD_DIR_ID = '#PROD_DIR#' CRD_ID = 'chrome-remote-desktop' # Used in a few file/folder names
diff --git a/testing/flake_suppressor_common/data_types.py b/testing/flake_suppressor_common/data_types.py index b458af3cb..576e05b 100644 --- a/testing/flake_suppressor_common/data_types.py +++ b/testing/flake_suppressor_common/data_types.py
@@ -6,6 +6,7 @@ import datetime from typing import Any, List, Optional +# //testing imports. from flake_suppressor_common import common_typing as ct from unexpected_passes_common import data_types as unexpected_dt
diff --git a/testing/flake_suppressor_common/data_types_unittest.py b/testing/flake_suppressor_common/data_types_unittest.py index 9a8f1283..c09640e 100755 --- a/testing/flake_suppressor_common/data_types_unittest.py +++ b/testing/flake_suppressor_common/data_types_unittest.py
@@ -7,6 +7,7 @@ import typing import unittest +# //testing imports. from flake_suppressor_common import data_types
diff --git a/testing/flake_suppressor_common/expectations.py b/testing/flake_suppressor_common/expectations.py index eff7f55..d7d6d39 100644 --- a/testing/flake_suppressor_common/expectations.py +++ b/testing/flake_suppressor_common/expectations.py
@@ -13,8 +13,10 @@ from typing import Dict, List, Set, Tuple, Union import urllib.request +# //testing imports. from flake_suppressor_common import common_typing as ct +# //third_party/catapult/third_party/typ imports. from typ import expectations_parser # Disabled instead of fixing to avoid a large amount of churn.
diff --git a/testing/flake_suppressor_common/expectations_unittest.py b/testing/flake_suppressor_common/expectations_unittest.py index ad58c57f..3386161b 100755 --- a/testing/flake_suppressor_common/expectations_unittest.py +++ b/testing/flake_suppressor_common/expectations_unittest.py
@@ -12,8 +12,10 @@ import unittest import unittest.mock as mock +# vpython-provided modules. from pyfakefs import fake_filesystem_unittest # pylint:disable=import-error +# //testing imports. from flake_suppressor_common import common_typing as ct from flake_suppressor_common import expectations from flake_suppressor_common import unittest_utils as uu
diff --git a/testing/flake_suppressor_common/queries.py b/testing/flake_suppressor_common/queries.py index 02a506a..b78cefc 100644 --- a/testing/flake_suppressor_common/queries.py +++ b/testing/flake_suppressor_common/queries.py
@@ -9,6 +9,7 @@ import subprocess from typing import Any, Dict, List +# //testing imports. from flake_suppressor_common import common_typing as ct from flake_suppressor_common import results as results_module from flake_suppressor_common import tag_utils
diff --git a/testing/flake_suppressor_common/queries_unittest.py b/testing/flake_suppressor_common/queries_unittest.py index 175a2c1..8c07da99 100755 --- a/testing/flake_suppressor_common/queries_unittest.py +++ b/testing/flake_suppressor_common/queries_unittest.py
@@ -9,6 +9,7 @@ import unittest import unittest.mock as mock +# //testing imports. from flake_suppressor_common import queries from flake_suppressor_common import unittest_utils as uu
diff --git a/testing/flake_suppressor_common/result_output.py b/testing/flake_suppressor_common/result_output.py index 5ac0593..05cbd2e 100644 --- a/testing/flake_suppressor_common/result_output.py +++ b/testing/flake_suppressor_common/result_output.py
@@ -6,6 +6,7 @@ import tempfile from typing import Dict, IO, List, Optional, Union +# //testing imports. from flake_suppressor_common import common_typing as ct UrlListType = List[str]
diff --git a/testing/flake_suppressor_common/result_output_unittest.py b/testing/flake_suppressor_common/result_output_unittest.py index a18993b..dee162b 100755 --- a/testing/flake_suppressor_common/result_output_unittest.py +++ b/testing/flake_suppressor_common/result_output_unittest.py
@@ -9,8 +9,10 @@ import typing import unittest +# vpython-provided modules. from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error +# //testing imports. from flake_suppressor_common import result_output
diff --git a/testing/flake_suppressor_common/results.py b/testing/flake_suppressor_common/results.py index 962445e..35e88d6 100644 --- a/testing/flake_suppressor_common/results.py +++ b/testing/flake_suppressor_common/results.py
@@ -9,11 +9,13 @@ from collections import defaultdict from typing import List, Tuple +# //testing imports. from flake_suppressor_common import common_typing as ct from flake_suppressor_common import data_types from flake_suppressor_common import expectations from flake_suppressor_common import tag_utils +# //third_party/catapult/third_party/typ imports. from typ import expectations_parser
diff --git a/testing/flake_suppressor_common/results_unittest.py b/testing/flake_suppressor_common/results_unittest.py index 1b9e078..6c71791 100755 --- a/testing/flake_suppressor_common/results_unittest.py +++ b/testing/flake_suppressor_common/results_unittest.py
@@ -10,6 +10,7 @@ import unittest import unittest.mock as mock +# //testing imports. from flake_suppressor_common import common_typing as ct from flake_suppressor_common import data_types from flake_suppressor_common import tag_utils as common_tag_utils
diff --git a/testing/flake_suppressor_common/tag_utils.py b/testing/flake_suppressor_common/tag_utils.py index 72e49255..def3d1ae 100644 --- a/testing/flake_suppressor_common/tag_utils.py +++ b/testing/flake_suppressor_common/tag_utils.py
@@ -5,6 +5,7 @@ from typing import Iterable, Type +# //testing imports. from flake_suppressor_common import common_typing as ct TagUtils = None
diff --git a/testing/flake_suppressor_common/unittest_utils.py b/testing/flake_suppressor_common/unittest_utils.py index b231829..5ada280 100644 --- a/testing/flake_suppressor_common/unittest_utils.py +++ b/testing/flake_suppressor_common/unittest_utils.py
@@ -3,11 +3,12 @@ # found in the LICENSE file. import os - from typing import List, Tuple, Iterable -from pyfakefs import fake_filesystem_unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error +# //testing imports. from flake_suppressor_common import common_typing as ct from flake_suppressor_common import expectations as expectations_module from flake_suppressor_common import queries
diff --git a/testing/libfuzzer/dictionary_generator.py b/testing/libfuzzer/dictionary_generator.py index 8cdaec3..f26758ce 100755 --- a/testing/libfuzzer/dictionary_generator.py +++ b/testing/libfuzzer/dictionary_generator.py
@@ -10,7 +10,10 @@ """ import argparse -import HTMLParser +# This is a Python 2-only import despite the file using a Python 3 shebang. This +# implies that this file has been unused for years and has not been properly +# converted to Python 3. +import HTMLParser # pylint: disable=import-error import logging import os import re
diff --git a/testing/libfuzzer/gen_fuzzer_config.py b/testing/libfuzzer/gen_fuzzer_config.py index c2a082c6..4d1659cb 100755 --- a/testing/libfuzzer/gen_fuzzer_config.py +++ b/testing/libfuzzer/gen_fuzzer_config.py
@@ -10,12 +10,8 @@ import argparse import os -import sys -if sys.version_info.major == 2: - from ConfigParser import ConfigParser -else: - from configparser import ConfigParser +from configparser import ConfigParser def AddSectionOptions(config, section_name, options):
diff --git a/testing/libfuzzer/research/domatolpm/fuzzer_generator.py b/testing/libfuzzer/research/domatolpm/fuzzer_generator.py index f4e10c5..ac93c97a 100755 --- a/testing/libfuzzer/research/domatolpm/fuzzer_generator.py +++ b/testing/libfuzzer/research/domatolpm/fuzzer_generator.py
@@ -26,10 +26,12 @@ SOURCE_DIR = _GetDirAbove('testing') -sys.path.insert(1, os.path.join(SOURCE_DIR, 'third_party')) +# //build imports. sys.path.append(os.path.join(SOURCE_DIR, 'build')) - import action_helpers + +# //third_party imports. +sys.path.insert(1, os.path.join(SOURCE_DIR, 'third_party')) import jinja2 _C_STR_TRANS = str.maketrans({
diff --git a/testing/libfuzzer/research/domatolpm/generator.py b/testing/libfuzzer/research/domatolpm/generator.py index 260d312c..0a6adb3 100755 --- a/testing/libfuzzer/research/domatolpm/generator.py +++ b/testing/libfuzzer/research/domatolpm/generator.py
@@ -30,12 +30,16 @@ SOURCE_DIR = _GetDirAbove('testing') -sys.path.insert(1, os.path.join(SOURCE_DIR, 'third_party')) -sys.path.insert(1, os.path.join(SOURCE_DIR, 'third_party/domato/src')) +# //build imports. sys.path.append(os.path.join(SOURCE_DIR, 'build')) - import action_helpers + +# //third_party imports. +sys.path.insert(1, os.path.join(SOURCE_DIR, 'third_party')) import jinja2 + +# //third_party/domato/src imports. +sys.path.insert(1, os.path.join(SOURCE_DIR, 'third_party/domato/src')) import grammar # TODO(crbug.com/361369290): Remove this disable once DomatoLPM development is
diff --git a/testing/libfuzzer/research/fuzzilli_idl_fuzzing/generator.py b/testing/libfuzzer/research/fuzzilli_idl_fuzzing/generator.py index cb9fdab..bf681b3 100755 --- a/testing/libfuzzer/research/fuzzilli_idl_fuzzing/generator.py +++ b/testing/libfuzzer/research/fuzzilli_idl_fuzzing/generator.py
@@ -51,12 +51,13 @@ SOURCE_DIR = _GetDirAbove('testing') +# //third_party imports. sys.path.insert(1, os.path.join(SOURCE_DIR, 'third_party')) -sys.path.append(os.path.join(SOURCE_DIR, 'build')) +import jinja2 + +# //third_party/blink/renderer/bindings/scripts imports. sys.path.append( os.path.join(SOURCE_DIR, 'third_party/blink/renderer/bindings/scripts/')) - -import jinja2 import web_idl
diff --git a/testing/libfuzzer/tests/check_fuzzer_config.py b/testing/libfuzzer/tests/check_fuzzer_config.py index a7214dcd..e36210ed 100755 --- a/testing/libfuzzer/tests/check_fuzzer_config.py +++ b/testing/libfuzzer/tests/check_fuzzer_config.py
@@ -8,10 +8,7 @@ import os import sys -if sys.version_info.major == 2: - from ConfigParser import ConfigParser -else: - from configparser import ConfigParser +from configparser import ConfigParser OPTIONS_SECTION_LIBFUZZER = 'libfuzzer'
diff --git a/testing/merge_scripts/code_coverage/convert_to_istanbul_test.py b/testing/merge_scripts/code_coverage/convert_to_istanbul_test.py index 29e46882..604f069 100755 --- a/testing/merge_scripts/code_coverage/convert_to_istanbul_test.py +++ b/testing/merge_scripts/code_coverage/convert_to_istanbul_test.py
@@ -11,6 +11,8 @@ import unittest import merge_js_lib as merger + +# //third_party imports. import node _HERE_DIR = Path(__file__).parent.resolve()
diff --git a/testing/merge_scripts/code_coverage/merge_js_lib_test.py b/testing/merge_scripts/code_coverage/merge_js_lib_test.py index 46efbc12..9d98881 100755 --- a/testing/merge_scripts/code_coverage/merge_js_lib_test.py +++ b/testing/merge_scripts/code_coverage/merge_js_lib_test.py
@@ -10,8 +10,10 @@ import tempfile import unittest +# vpython-provided modules. +from parameterized import parameterized # pylint: disable=import-error + import merge_js_lib as merger -from parameterized import parameterized class MergeJSLibTest(unittest.TestCase):
diff --git a/testing/merge_scripts/perf_results.py b/testing/merge_scripts/perf_results.py index 43c8740c..6e56aae 100755 --- a/testing/merge_scripts/perf_results.py +++ b/testing/merge_scripts/perf_results.py
@@ -8,8 +8,9 @@ SRC_DIR = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -sys.path.append(os.path.join(SRC_DIR, 'tools', 'perf')) +# //tools/perf imports. +sys.path.append(os.path.join(SRC_DIR, 'tools', 'perf')) import process_perf_results if __name__ == '__main__':
diff --git a/testing/pylintrc b/testing/pylintrc index 21868d3..9dcd530 100644 --- a/testing/pylintrc +++ b/testing/pylintrc
@@ -31,7 +31,6 @@ disable=bad-indentation, duplicate-code, fixme, - import-error, invalid-name, missing-docstring, no-member,
diff --git a/testing/pytype_common/pytype_runner.py b/testing/pytype_common/pytype_runner.py index 38a24e6..41eeaaf 100644 --- a/testing/pytype_common/pytype_runner.py +++ b/testing/pytype_common/pytype_runner.py
@@ -13,8 +13,8 @@ CHROMIUM_SRC_DIR = os.path.realpath( os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', '..')) +# //build/util imports. sys.path.append(os.path.join(CHROMIUM_SRC_DIR, 'build', 'util')) - from lib.results import result_sink from lib.results import result_types
diff --git a/testing/run_pytype.py b/testing/run_pytype.py index 0f20545..db406d4 100755 --- a/testing/run_pytype.py +++ b/testing/run_pytype.py
@@ -7,6 +7,7 @@ import os import sys +# //testing imports. from pytype_common import pytype_runner TESTING_DIR = os.path.abspath(os.path.dirname(__file__))
diff --git a/testing/scripts/check_static_initializers.py b/testing/scripts/check_static_initializers.py index d25a137..462cba35 100755 --- a/testing/scripts/check_static_initializers.py +++ b/testing/scripts/check_static_initializers.py
@@ -14,6 +14,7 @@ CHROMIUM_ROOT = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) BUILD_DIR = os.path.join(CHROMIUM_ROOT, 'build') +# //build imports. if BUILD_DIR not in sys.path: sys.path.insert(0, BUILD_DIR) import gn_helpers
diff --git a/testing/scripts/run_gpu_integration_test_as_googletest.py b/testing/scripts/run_gpu_integration_test_as_googletest.py index acddb18..4e44740 100755 --- a/testing/scripts/run_gpu_integration_test_as_googletest.py +++ b/testing/scripts/run_gpu_integration_test_as_googletest.py
@@ -20,6 +20,7 @@ import json import sys +# //testing/scripts imports. import common import gpu_integration_test_adapter
diff --git a/testing/scripts/run_performance_tests.py b/testing/scripts/run_performance_tests.py index 2c759b2c..77dc93ab 100755 --- a/testing/scripts/run_performance_tests.py +++ b/testing/scripts/run_performance_tests.py
@@ -50,9 +50,11 @@ import tempfile import traceback +# vpython-provided modules. +# pylint: disable=import-error import six - import requests +# pylint: enable=import-error import common @@ -69,11 +71,7 @@ print('Optional crossbench_result_converter not available.') import generate_legacy_perf_dashboard_json from core import path_util - -PERF_CORE_DIR = PERF_DIR / 'core' -sys.path.append(str(PERF_CORE_DIR)) -# //tools/perf/core imports. -import results_merger +from core import results_merger sys.path.append(str(CHROMIUM_SRC_DIR / 'testing')) # //testing imports. @@ -405,6 +403,7 @@ # the actual executable name. executable_name = executable_name[8:] if executable_name in GTEST_CONVERSION_WHITELIST: + # //third_party/catapult/tracing imports. with path_util.SysPath(path_util.GetTracingDir()): # pylint: disable=no-name-in-module,import-outside-toplevel from tracing.value import gtest_json_converter
diff --git a/testing/scripts/run_performance_tests_unittest.py b/testing/scripts/run_performance_tests_unittest.py index 0b125fc..42ca2fa0a 100644 --- a/testing/scripts/run_performance_tests_unittest.py +++ b/testing/scripts/run_performance_tests_unittest.py
@@ -12,8 +12,11 @@ import unittest from unittest import mock +# //testing/scripts imports. import run_performance_tests from run_performance_tests import TelemetryCommandGenerator + +# //third_party/catapult/telemetry imports. from telemetry.internal.util import binary_manager # Protected access is allowed for unittests.
diff --git a/testing/scripts/run_variations_smoke_tests.py b/testing/scripts/run_variations_smoke_tests.py index ba18821..7152bd0 100755 --- a/testing/scripts/run_variations_smoke_tests.py +++ b/testing/scripts/run_variations_smoke_tests.py
@@ -20,13 +20,16 @@ from http.server import SimpleHTTPRequestHandler from threading import Thread -import packaging.version +# vpython-provided modules. +import packaging.version # pylint: disable=import-error +# //third_party/webdriver/pylib imports. from selenium import webdriver from selenium.webdriver import ChromeOptions from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import WebDriverException +# //testing/scripts imports. import common import variations_seed_access_helper as seed_helper from skia_gold_infra import finch_skia_gold_utils @@ -35,7 +38,7 @@ _CHROMIUM_SRC_DIR = os.path.realpath(os.path.join(_THIS_DIR, '..', '..')) sys.path.append(os.path.join(_CHROMIUM_SRC_DIR, 'build')) -# //build/skia_gold_common imports. +# //build imports. from skia_gold_common.skia_gold_properties import SkiaGoldProperties _VARIATIONS_TEST_DATA = 'variations_smoke_test_data'
diff --git a/testing/scripts/rust/exe_util_unittests.py b/testing/scripts/rust/exe_util_unittests.py index 6ceeef5..8b3c439c 100755 --- a/testing/scripts/rust/exe_util_unittests.py +++ b/testing/scripts/rust/exe_util_unittests.py
@@ -6,7 +6,8 @@ import sys -from pyfakefs import fake_filesystem_unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error import exe_util
diff --git a/testing/scripts/rust/generate_script_unittests.py b/testing/scripts/rust/generate_script_unittests.py index 059e75a..a2cd302 100755 --- a/testing/scripts/rust/generate_script_unittests.py +++ b/testing/scripts/rust/generate_script_unittests.py
@@ -8,7 +8,8 @@ import tempfile import unittest -from pyfakefs import fake_filesystem_unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error from generate_script import _parse_args from generate_script import _generate_script
diff --git a/testing/scripts/rust/main_program_unittests.py b/testing/scripts/rust/main_program_unittests.py index 89e8f8f..c72e8bd8 100755 --- a/testing/scripts/rust/main_program_unittests.py +++ b/testing/scripts/rust/main_program_unittests.py
@@ -10,7 +10,8 @@ import tempfile import unittest -from pyfakefs import fake_filesystem_unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error from test_results import TestResult
diff --git a/testing/scripts/rust/rust_main_program_unittests.py b/testing/scripts/rust/rust_main_program_unittests.py index 5d10507..e4bd838c 100755 --- a/testing/scripts/rust/rust_main_program_unittests.py +++ b/testing/scripts/rust/rust_main_program_unittests.py
@@ -8,7 +8,8 @@ import tempfile import unittest -from pyfakefs import fake_filesystem_unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error from test_results import TestResult
diff --git a/testing/scripts/rust/test_filtering_unittests.py b/testing/scripts/rust/test_filtering_unittests.py index bc70cb3d..6d66051 100755 --- a/testing/scripts/rust/test_filtering_unittests.py +++ b/testing/scripts/rust/test_filtering_unittests.py
@@ -9,7 +9,8 @@ import tempfile import unittest -from pyfakefs import fake_filesystem_unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error import test_filtering from test_filtering import _TestFilter
diff --git a/testing/test_env.py b/testing/test_env.py index 67f6cc24..52109c6 100755 --- a/testing/test_env.py +++ b/testing/test_env.py
@@ -399,6 +399,7 @@ # pylint: disable=import-outside-toplevel if '--skip-set-lpac-acls=1' not in cmd and sys.platform == 'win32': + # //testing imports. sys.path.insert( 0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts')) from scripts import common # pylint: disable=cyclic-import
diff --git a/testing/test_env_user_script.py b/testing/test_env_user_script.py index 46b7655..fa41103 100755 --- a/testing/test_env_user_script.py +++ b/testing/test_env_user_script.py
@@ -7,6 +7,7 @@ import os import sys +# //testing imports. import test_env HERE = os.path.dirname(os.path.abspath(__file__))
diff --git a/testing/trigger_scripts/base_test_triggerer_unittest.py b/testing/trigger_scripts/base_test_triggerer_unittest.py index 0dffecc4..edba113 100755 --- a/testing/trigger_scripts/base_test_triggerer_unittest.py +++ b/testing/trigger_scripts/base_test_triggerer_unittest.py
@@ -10,7 +10,8 @@ import unittest from unittest import mock -from pyfakefs import fake_filesystem_unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error import base_test_triggerer
diff --git a/testing/unexpected_passes_common/argument_parsing.py b/testing/unexpected_passes_common/argument_parsing.py index 435d31e..0bf0531 100644 --- a/testing/unexpected_passes_common/argument_parsing.py +++ b/testing/unexpected_passes_common/argument_parsing.py
@@ -7,6 +7,7 @@ import logging import os +# //testing imports. from unexpected_passes_common import constants
diff --git a/testing/unexpected_passes_common/builders.py b/testing/unexpected_passes_common/builders.py index 1146e6cf..c659735 100644 --- a/testing/unexpected_passes_common/builders.py +++ b/testing/unexpected_passes_common/builders.py
@@ -10,8 +10,10 @@ import subprocess from typing import Any, Dict, Iterable, List, Optional, Set, Tuple +# vpython-provided modules. import six +# //testing imports. from unexpected_passes_common import constants from unexpected_passes_common import data_types
diff --git a/testing/unexpected_passes_common/builders_unittest.py b/testing/unexpected_passes_common/builders_unittest.py index a191155..2b49bc27 100755 --- a/testing/unexpected_passes_common/builders_unittest.py +++ b/testing/unexpected_passes_common/builders_unittest.py
@@ -9,8 +9,10 @@ import unittest from unittest import mock -from pyfakefs import fake_filesystem_unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error +# //testing imports. from unexpected_passes_common import builders from unexpected_passes_common import constants from unexpected_passes_common import data_types
diff --git a/testing/unexpected_passes_common/data_types.py b/testing/unexpected_passes_common/data_types.py index 6aabbb34..924f52af 100644 --- a/testing/unexpected_passes_common/data_types.py +++ b/testing/unexpected_passes_common/data_types.py
@@ -11,8 +11,10 @@ from typing import (Any, Dict, FrozenSet, Generator, Iterable, List, Optional, Set, Tuple, Type, Union) +# vpython-provided modules. import six +# //third_party/catapult/third_party/typ imports. from typ import expectations_parser FULL_PASS = 1
diff --git a/testing/unexpected_passes_common/data_types_unittest.py b/testing/unexpected_passes_common/data_types_unittest.py index 9febbd64..71fbea6 100755 --- a/testing/unexpected_passes_common/data_types_unittest.py +++ b/testing/unexpected_passes_common/data_types_unittest.py
@@ -9,6 +9,7 @@ import unittest from unittest import mock +# //testing imports. from unexpected_passes_common import constants from unexpected_passes_common import data_types from unexpected_passes_common import unittest_utils as uu
diff --git a/testing/unexpected_passes_common/expectations.py b/testing/unexpected_passes_common/expectations.py index bf6a501f..a563514 100644 --- a/testing/unexpected_passes_common/expectations.py +++ b/testing/unexpected_passes_common/expectations.py
@@ -12,9 +12,13 @@ import subprocess from typing import Dict, FrozenSet, Iterable, List, Optional, Set, Tuple, Union +# vpython-provided modules. import six +# //third_party/catapult/third_party/typ imports. from typ import expectations_parser + +# //testing imports. from unexpected_passes_common import data_types FINDER_DISABLE_COMMENT_BASE = 'finder:disable'
diff --git a/testing/unexpected_passes_common/expectations_unittest.py b/testing/unexpected_passes_common/expectations_unittest.py index 19b8a76c..d095eb42 100755 --- a/testing/unexpected_passes_common/expectations_unittest.py +++ b/testing/unexpected_passes_common/expectations_unittest.py
@@ -9,8 +9,10 @@ import unittest from unittest import mock -from pyfakefs import fake_filesystem_unittest +# vpython-provided modules. +from pyfakefs import fake_filesystem_unittest # pylint: disable=import-error +# //testing imports. from unexpected_passes_common import data_types from unexpected_passes_common import expectations from unexpected_passes_common import unittest_utils as uu
diff --git a/testing/unexpected_passes_common/queries.py b/testing/unexpected_passes_common/queries.py index 512cdc4..b772ec6 100644 --- a/testing/unexpected_passes_common/queries.py +++ b/testing/unexpected_passes_common/queries.py
@@ -7,12 +7,18 @@ import time from typing import Collection, Dict, Generator, Iterable, List, Optional, Tuple +# vpython-provided modules. +# pylint: disable=import-error from google.cloud import bigquery from google.cloud import bigquery_storage import pandas +# pylint: enable=import-error +# //third_party/catapult/third_party/typ imports. from typ import expectations_parser from typ import json_results + +# //testing imports. from unexpected_passes_common import constants from unexpected_passes_common import data_types from unexpected_passes_common import expectations
diff --git a/testing/unexpected_passes_common/queries_unittest.py b/testing/unexpected_passes_common/queries_unittest.py index 22811da3..33d4c8d 100755 --- a/testing/unexpected_passes_common/queries_unittest.py +++ b/testing/unexpected_passes_common/queries_unittest.py
@@ -7,6 +7,7 @@ import unittest from unittest import mock +# //testing imports. from unexpected_passes_common import builders from unexpected_passes_common import constants from unexpected_passes_common import data_types
diff --git a/testing/unexpected_passes_common/result_output.py b/testing/unexpected_passes_common/result_output.py index b0bfcf6..f9c7585 100644 --- a/testing/unexpected_passes_common/result_output.py +++ b/testing/unexpected_passes_common/result_output.py
@@ -12,10 +12,13 @@ import tempfile from typing import Any, Dict, IO, List, Optional, Set, Union +# vpython-provided modules. import six +# //testing imports. from unexpected_passes_common import data_types +# //third_party/blink/tools imports. # Used for posting Buganizer comments. from blinkpy.w3c import buganizer
diff --git a/testing/unexpected_passes_common/result_output_unittest.py b/testing/unexpected_passes_common/result_output_unittest.py index 446339c..56db911 100755 --- a/testing/unexpected_passes_common/result_output_unittest.py +++ b/testing/unexpected_passes_common/result_output_unittest.py
@@ -9,14 +9,18 @@ import unittest from unittest import mock +# vpython-provided modules. +# pylint: disable=import-error import six - from pyfakefs import fake_filesystem_unittest +# pylint: enable=import-error +# //testing imports. from unexpected_passes_common import data_types from unexpected_passes_common import result_output from unexpected_passes_common import unittest_utils as uu +# //third_party/blink/tools imports. from blinkpy.w3c import buganizer # Protected access is allowed for unittests.
diff --git a/testing/unexpected_passes_common/unittest_utils.py b/testing/unexpected_passes_common/unittest_utils.py index 4d6e093..f2c9092 100644 --- a/testing/unexpected_passes_common/unittest_utils.py +++ b/testing/unexpected_passes_common/unittest_utils.py
@@ -5,8 +5,10 @@ from typing import Generator, Iterable, List, Optional, Set, Tuple, Type -import pandas +# vpython-provided modules. +import pandas # pylint: disable=import-error +# //testing imports. from unexpected_passes_common import builders from unexpected_passes_common import expectations from unexpected_passes_common import data_types
diff --git a/testing/variations/PRESUBMIT.py b/testing/variations/PRESUBMIT.py index 784ba49..7927077d 100644 --- a/testing/variations/PRESUBMIT.py +++ b/testing/variations/PRESUBMIT.py
@@ -368,6 +368,7 @@ # know how. old_sys_path = sys.path[:] try: + # //testing/variations/presubmit imports. sys.path.append( input_api.os_path.join(input_api.PresubmitLocalPath(), 'presubmit')) # pylint: disable=import-outside-toplevel
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 01e99f34..81c24a0 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -3951,7 +3951,6 @@ "enable_features": [ "DelayFirstPeriodicPAPurgeOrReclaim", "DelayFirstWorkerWake", - "InhibitLoadingStateUpdate", "MainThreadCompositingPriority", "QuickIntensiveWakeUpThrottlingAfterLoading", "ReduceCookieIPCs", @@ -3974,7 +3973,6 @@ "enable_features": [ "DelayFirstPeriodicPAPurgeOrReclaim", "DelayFirstWorkerWake", - "InhibitLoadingStateUpdate", "QuickIntensiveWakeUpThrottlingAfterLoading", "ReduceCookieIPCs", "RunTasksByBatches", @@ -3998,7 +3996,6 @@ "CacheMacSandboxProfiles", "DelayFirstPeriodicPAPurgeOrReclaim", "DelayFirstWorkerWake", - "InhibitLoadingStateUpdate", "MacSetDefaultTaskRole", "MainThreadCompositingPriority", "QuickIntensiveWakeUpThrottlingAfterLoading", @@ -4025,7 +4022,6 @@ "DelayFirstPeriodicPAPurgeOrReclaim", "DelayFirstWorkerWake", "ExplicitHighResolutionTimerWin", - "InhibitLoadingStateUpdate", "MainThreadCompositingPriority", "QuickIntensiveWakeUpThrottlingAfterLoading", "ReduceCookieIPCs", @@ -16214,8 +16210,7 @@ "android_webview", "chromeos", "fuchsia", - "linux", - "windows" + "linux" ], "experiments": [ { @@ -16694,7 +16689,6 @@ { "name": "Enabled", "enable_features": [ - "AvoidScheduleWorkDuringNativeEventProcessing", "ConditionallySkipGpuChannelFlush", "EarlyEstablishGpuChannel", "EstablishGpuChannelAsync", @@ -16703,7 +16697,6 @@ "LevelDBProtoAsyncWrite", "MojoBindingsInlineSLS", "ReduceCpuUtilization2", - "RunTasksByBatches", "SharedStorageAPIEnableWALForDatabase", "SqlWALModeOnDipsDatabase", "SqlWALModeOnSegmentationDatabase" @@ -16718,17 +16711,12 @@ "experiments": [ { "name": "Enabled", - "params": { - "MacEfficientFileFlushUseBarrier": "true" - }, "enable_features": [ - "AvoidScheduleWorkDuringNativeEventProcessing", "ConditionallySkipGpuChannelFlush", "EarlyEstablishGpuChannel", "EstablishGpuChannelAsync", "FledgeEnableWALForInterestGroupStorage", "LevelDBProtoAsyncWrite", - "MacEfficientFileFlush", "MojoBindingsInlineSLS", "NumberOfCoresWithCpuSecurityMitigation", "ReduceCpuUtilization2", @@ -16749,7 +16737,6 @@ { "name": "Enabled", "enable_features": [ - "AvoidScheduleWorkDuringNativeEventProcessing", "ConditionallySkipGpuChannelFlush", "EarlyEstablishGpuChannel", "EstablishGpuChannelAsync", @@ -16772,7 +16759,6 @@ { "name": "Enabled", "enable_features": [ - "AvoidScheduleWorkDuringNativeEventProcessing", "ConditionallySkipGpuChannelFlush", "DirectCompositorThreadIpc", "FledgeEnableWALForInterestGroupStorage", @@ -16794,7 +16780,6 @@ { "name": "Enabled", "enable_features": [ - "AvoidScheduleWorkDuringNativeEventProcessing", "ConditionallySkipGpuChannelFlush", "DirectCompositorThreadIpc", "FledgeEnableWALForInterestGroupStorage", @@ -22479,6 +22464,26 @@ ] } ], + "StorageAccessHeaders": [ + { + "platforms": [ + "android", + "chromeos", + "fuchsia", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "StorageAccessHeaders" + ] + } + ] + } + ], "StorageBuckets": [ { "platforms": [ @@ -22520,27 +22525,6 @@ ] } ], - "SubSampleWindowProxyUsageMetrics": [ - { - "platforms": [ - "android_webview", - "android", - "chromeos", - "ios", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "SubSampleWindowProxyUsageMetrics" - ] - } - ] - } - ], "SubframeProcessReuseThresholds": [ { "platforms": [ @@ -26004,21 +25988,6 @@ ] } ], - "WinSboxParallelProcessLaunch": [ - { - "platforms": [ - "windows" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "WinSboxParallelProcessLaunch" - ] - } - ] - } - ], "WinSystemLocationPermission": [ { "platforms": [
diff --git a/testing/xvfb.py b/testing/xvfb.py index fb782c65..abf0a6f 100755 --- a/testing/xvfb.py +++ b/testing/xvfb.py
@@ -21,8 +21,10 @@ import time import uuid -import psutil +# vpython-provided modules. +import psutil # pylint: disable=import-error +# //testing imports. import test_env DEFAULT_XVFB_WHD = '1280x800x24'
diff --git a/third_party/androidx/build.gradle.template b/third_party/androidx/build.gradle.template index bef62013b..64234ce 100644 --- a/third_party/androidx/build.gradle.template +++ b/third_party/androidx/build.gradle.template
@@ -94,8 +94,8 @@ compile 'androidx.pdf:pdf-viewer-fragment:1.0.0-alpha05' compile 'androidx.preference:preference:{{androidx_dependency_version}}' // Privacy Sandbox is less stable than others. Use only release versions. - compile 'androidx.privacysandbox.ads:ads-adservices:1.1.0-beta07' - compile 'androidx.privacysandbox.ads:ads-adservices-java:1.1.0-beta07' + compile 'androidx.privacysandbox.ads:ads-adservices:1.1.0-beta11' + compile 'androidx.privacysandbox.ads:ads-adservices-java:1.1.0-beta11' compile 'androidx.recyclerview:recyclerview:{{androidx_dependency_version}}' compile 'androidx.room:room-guava:{{androidx_dependency_version}}' // TODO(https://crbug.com/359896493): Remove the following dep once rolls
diff --git a/third_party/angle b/third_party/angle index 09f3bc3..1287e19 160000 --- a/third_party/angle +++ b/third_party/angle
@@ -1 +1 @@ -Subproject commit 09f3bc3a72ce14d8cb6bd149e35e92750fa388c5 +Subproject commit 1287e19e802ae2af651cd74ff1adaf9efe453146
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index ebc1203..7f8646a 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -2135,9 +2135,7 @@ false); #endif -// Enables the Private Aggregation API. Note that this API also requires the -// `kPrivacySandboxAggregationService` to be enabled to successfully send -// reports. +// Enables the Private Aggregation API. BASE_FEATURE(kPrivateAggregationApi, "PrivateAggregationApi", base::FEATURE_ENABLED_BY_DEFAULT); @@ -2579,7 +2577,7 @@ BASE_FEATURE(kSubSampleWindowProxyUsageMetrics, "SubSampleWindowProxyUsageMetrics", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kStylusRichGestures, "StylusRichGestures",
diff --git a/third_party/blink/public/mojom/payments/payment_credential.mojom b/third_party/blink/public/mojom/payments/payment_credential.mojom index 1401b16..ab8484a 100644 --- a/third_party/blink/public/mojom/payments/payment_credential.mojom +++ b/third_party/blink/public/mojom/payments/payment_credential.mojom
@@ -4,6 +4,8 @@ module payments.mojom; +import "third_party/blink/public/mojom/webauthn/authenticator.mojom"; + enum PaymentCredentialStorageStatus { SUCCESS, FAILED_TO_STORE_CREDENTIAL, @@ -19,4 +21,15 @@ // later used for PaymentRequests. StorePaymentCredential(array<uint8> credential_id, string rp_id, array<uint8> user_id) => (PaymentCredentialStorageStatus status); + + // Creates a browser bound key before getting the credential info for a new + // public key credential created by an authenticator for the given + // |PublicKeyCredentialCreationOptions|. + // [MakeCredentialAuthenticatorResponse] will be set if and only if status == + // SUCCESS. [WebAuthnDOMExceptionDetails] will be set if and only if status + // == ERROR_WITH_DOM_EXCEPTION_DETAILS. + MakePaymentCredential(blink.mojom.PublicKeyCredentialCreationOptions options) + => (blink.mojom.AuthenticatorStatus status, + blink.mojom.MakeCredentialAuthenticatorResponse? credential, + blink.mojom.WebAuthnDOMExceptionDetails? dom_exception_details); };
diff --git a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom index 423d369..5432fda 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
@@ -4604,6 +4604,7 @@ kCSSEnvironmentVariable_SafeAreaInsetBottom_FastPath = 5218, kSrcSetUsedHigherDensityImageFromCache = 5219, kHTMLElementWritingSuggestions = 5220, + kCSSPseudoOpen = 5221, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots. Also don't add extra
diff --git a/third_party/blink/public/mojom/webauthn/authenticator.mojom b/third_party/blink/public/mojom/webauthn/authenticator.mojom index 41f5264..35195c80 100644 --- a/third_party/blink/public/mojom/webauthn/authenticator.mojom +++ b/third_party/blink/public/mojom/webauthn/authenticator.mojom
@@ -6,7 +6,6 @@ import "components/payments/mojom/payment_request_data.mojom"; import "mojo/public/mojom/base/time.mojom"; -import "third_party/blink/public/mojom/payments/payment_credential.mojom"; import "url/mojom/origin.mojom"; import "url/mojom/url.mojom"; @@ -172,6 +171,9 @@ bool supports_large_blob; SupplementalPubKeysResponse? supplemental_pub_keys; + + // The response for the payment extension. + AuthenticationExtensionsPaymentResponse? payment; }; struct GetAssertionAuthenticatorResponse {
diff --git a/third_party/blink/renderer/core/css/parser/css_selector_parser.cc b/third_party/blink/renderer/core/css/parser/css_selector_parser.cc index fd0a9e4a..5fb4366 100644 --- a/third_party/blink/renderer/core/css/parser/css_selector_parser.cc +++ b/third_party/blink/renderer/core/css/parser/css_selector_parser.cc
@@ -2542,6 +2542,9 @@ case CSSSelector::kPseudoActiveViewTransition: feature = WebFeature::kActiveViewTransitionPseudo; break; + case CSSSelector::kPseudoOpen: + feature = WebFeature::kCSSPseudoOpen; + break; default: break; }
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc index dbbc1d9..87b566a 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
@@ -2294,7 +2294,7 @@ // The CSS Gap Decorations API accepts a space separated list of values. // These values can be an auto repeater, an integer repeater, or a single // value. - // See: https://kbabbitt.github.io/css-gap-decorations/#column-row-rule-color + // See: https://drafts.csswg.org/css-gaps-1/#lists-repeat const auto& values = To<CSSValueList>(value); typename GapDataList<T>::GapDataVector gap_data_list; gap_data_list.ReserveInitialCapacity(values.length());
diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc index 737cdf41..e662d4d 100644 --- a/third_party/blink/renderer/core/frame/frame.cc +++ b/third_party/blink/renderer/core/frame/frame.cc
@@ -328,8 +328,7 @@ // See the "Same-origin Visibility" section in |UserActivationState| class // doc. auto* local_frame = DynamicTo<LocalFrame>(this); - if (local_frame && - RuntimeEnabledFeatures::UserActivationSameOriginVisibilityEnabled()) { + if (local_frame) { const SecurityOrigin* security_origin = local_frame->GetSecurityContext()->GetSecurityOrigin();
diff --git a/third_party/blink/renderer/core/html/forms/html_option_element.cc b/third_party/blink/renderer/core/html/forms/html_option_element.cc index 24affd62..c39a488c 100644 --- a/third_party/blink/renderer/core/html/forms/html_option_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_option_element.cc
@@ -662,15 +662,10 @@ } if (select) { - // This logic to determine if we should select the option is copied from - // ListBoxSelectType::DefaultEventHandler. It will likely change when we try - // to spec it. const auto* mouse_event = DynamicTo<MouseEvent>(event); - const auto* gesture_event = DynamicTo<GestureEvent>(event); - if ((event.type() == event_type_names::kGesturetap && gesture_event) || - (event.type() == event_type_names::kMousedown && mouse_event && - mouse_event->button() == - static_cast<int16_t>(WebPointerProperties::Button::kLeft))) { + if (mouse_event && event.type() == event_type_names::kMouseup && + mouse_event->button() == + static_cast<int16_t>(WebPointerProperties::Button::kLeft)) { select->SelectOptionByPopup(this); select->HidePopup(); event.SetDefaultHandled();
diff --git a/third_party/blink/renderer/core/style/gap_data_list.h b/third_party/blink/renderer/core/style/gap_data_list.h index 73f63dc8..b10ca01 100644 --- a/third_party/blink/renderer/core/style/gap_data_list.h +++ b/third_party/blink/renderer/core/style/gap_data_list.h
@@ -12,7 +12,7 @@ // These are used to store gap decorations values in the order they are // specified. These values can be an auto repeater, an integer repeater, or a // single value. The value could be a color, style or width. See: -// https://kbabbitt.github.io/css-gap-decorations/#color-style-width +// https://drafts.csswg.org/css-gaps-1/#color-style-width template <typename T> class CORE_EXPORT GapDataList { DISALLOW_NEW();
diff --git a/third_party/blink/renderer/modules/credentialmanagement/authentication_credentials_container.cc b/third_party/blink/renderer/modules/credentialmanagement/authentication_credentials_container.cc index 5a38a78..b09f1d52 100644 --- a/third_party/blink/renderer/modules/credentialmanagement/authentication_credentials_container.cc +++ b/third_party/blink/renderer/modules/credentialmanagement/authentication_credentials_container.cc
@@ -12,6 +12,7 @@ #include "base/notreached.h" #include "build/build_config.h" #include "services/network/public/cpp/is_potentially_trustworthy.h" +#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/sms/webotp_constants.h" #include "third_party/blink/public/mojom/credentialmanagement/credential_manager.mojom-blink.h" #include "third_party/blink/public/mojom/credentialmanagement/credential_type_flags.mojom-blink.h" @@ -653,6 +654,13 @@ ConvertTo<AuthenticationExtensionsSupplementalPubKeysOutputs*>( credential->supplemental_pub_keys)); } + if (credential->payment) { + CHECK(base::FeatureList::IsEnabled( + blink::features::kSecurePaymentConfirmationBrowserBoundKeys)); + extension_outputs->setPayment( + ConvertTo<blink::AuthenticationExtensionsPaymentOutputs*>( + credential->payment)); + } if (credential->echo_prf) { auto* prf_outputs = AuthenticationExtensionsPRFOutputs::Create(); prf_outputs->setEnabled(credential->prf); @@ -1945,13 +1953,27 @@ if (mojo_options->is_payment_credential_creation) { String rp_id_for_payment_extension = mojo_options->relying_party->id; WTF::Vector<uint8_t> user_id_for_payment_extension = mojo_options->user->id; - authenticator->MakeCredential( - std::move(mojo_options), - WTF::BindOnce(&OnMakePublicKeyCredentialWithPaymentExtensionComplete, - std::make_unique<ScopedPromiseResolver>(resolver), - std::move(scoped_abort_state), - rp_id_for_payment_extension, - std::move(user_id_for_payment_extension))); + if (base::FeatureList::IsEnabled( + blink::features::kSecurePaymentConfirmationBrowserBoundKeys)) { + auto* payment_credential_remote = + CredentialManagerProxy::From(resolver->GetScriptState()) + ->PaymentCredential(); + payment_credential_remote->MakePaymentCredential( + std::move(mojo_options), + WTF::BindOnce(&OnMakePublicKeyCredentialWithPaymentExtensionComplete, + std::make_unique<ScopedPromiseResolver>(resolver), + std::move(scoped_abort_state), + rp_id_for_payment_extension, + std::move(user_id_for_payment_extension))); + } else { + authenticator->MakeCredential( + std::move(mojo_options), + WTF::BindOnce(&OnMakePublicKeyCredentialWithPaymentExtensionComplete, + std::make_unique<ScopedPromiseResolver>(resolver), + std::move(scoped_abort_state), + rp_id_for_payment_extension, + std::move(user_id_for_payment_extension))); + } } else { if (RuntimeEnabledFeatures::WebAuthenticationConditionalCreateEnabled()) { mojo_options->is_conditional = options->mediation() == "conditional";
diff --git a/third_party/blink/renderer/modules/mediastream/BUILD.gn b/third_party/blink/renderer/modules/mediastream/BUILD.gn index c1e5610..9cd83406 100644 --- a/third_party/blink/renderer/modules/mediastream/BUILD.gn +++ b/third_party/blink/renderer/modules/mediastream/BUILD.gn
@@ -99,6 +99,8 @@ "scoped_media_stream_tracer.h", "screen_capture_media_stream_track.cc", "screen_capture_media_stream_track.h", + "speech_recognition_media_stream_audio_sink.cc", + "speech_recognition_media_stream_audio_sink.h", "sub_capture_target.cc", "sub_capture_target.h", "track_audio_renderer.cc",
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_track.h b/third_party/blink/renderer/modules/mediastream/media_stream_track.h index d2ecef8..d42e3d3 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_track.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_track.h
@@ -40,6 +40,7 @@ class MediaStream; class MediaTrackSettings; class ScriptState; +class SpeechRecognitionMediaStreamAudioSink; class V8MediaStreamTrackState; class V8UnionMediaStreamTrackAudioStatsOrMediaStreamTrackVideoStats; @@ -131,6 +132,7 @@ virtual void RegisterMediaStream(MediaStream*) = 0; virtual void UnregisterMediaStream(MediaStream*) = 0; + virtual void RegisterSink(SpeechRecognitionMediaStreamAudioSink* sink) = 0; // EventTarget const AtomicString& InterfaceName() const override = 0;
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.cc b/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.cc index 72ac165..75ab4aa 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.cc
@@ -1033,6 +1033,11 @@ registered_media_streams_.erase(iter); } +void MediaStreamTrackImpl::RegisterSink( + SpeechRecognitionMediaStreamAudioSink* sink) { + registered_sinks_.insert(sink); +} + const AtomicString& MediaStreamTrackImpl::InterfaceName() const { return event_target_names::kMediaStreamTrack; } @@ -1051,6 +1056,7 @@ void MediaStreamTrackImpl::Trace(Visitor* visitor) const { visitor->Trace(registered_media_streams_); + visitor->Trace(registered_sinks_); visitor->Trace(component_); visitor->Trace(image_capture_); visitor->Trace(execution_context_);
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.h b/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.h index bc36483e..69bc717 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.h
@@ -35,6 +35,7 @@ #include "third_party/blink/renderer/modules/event_target_modules.h" #include "third_party/blink/renderer/modules/mediastream/media_constraints.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_track.h" +#include "third_party/blink/renderer/modules/mediastream/speech_recognition_media_stream_audio_sink.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_set.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_descriptor.h" @@ -121,6 +122,8 @@ void RegisterMediaStream(MediaStream*) override; void UnregisterMediaStream(MediaStream*) override; + void RegisterSink(SpeechRecognitionMediaStreamAudioSink*) override; + // EventTarget const AtomicString& InterfaceName() const override; ExecutionContext* GetExecutionContext() const override; @@ -208,6 +211,7 @@ MediaStreamSource::ReadyState ready_state_; HeapHashSet<Member<MediaStream>> registered_media_streams_; + HeapHashSet<Member<SpeechRecognitionMediaStreamAudioSink>> registered_sinks_; bool is_iterating_registered_media_streams_ = false; const Member<MediaStreamComponent> component_; Member<ImageCapture> image_capture_;
diff --git a/third_party/blink/renderer/modules/mediastream/mock_media_stream_track.h b/third_party/blink/renderer/modules/mediastream/mock_media_stream_track.h index 6987005..7ffbecb7 100644 --- a/third_party/blink/renderer/modules/mediastream/mock_media_stream_track.h +++ b/third_party/blink/renderer/modules/mediastream/mock_media_stream_track.h
@@ -126,6 +126,7 @@ MOCK_METHOD1(SetConstraints, void(const MediaConstraints&)); MOCK_METHOD1(RegisterMediaStream, void(MediaStream*)); MOCK_METHOD1(UnregisterMediaStream, void(MediaStream*)); + MOCK_METHOD1(RegisterSink, void(SpeechRecognitionMediaStreamAudioSink*)); MOCK_METHOD2(AddedEventListener, void(const AtomicString&, RegisteredEventListener&)); MOCK_METHOD1(BeingTransferred, void(const base::UnguessableToken&));
diff --git a/third_party/blink/renderer/modules/speech/speech_recognition_media_stream_audio_sink.cc b/third_party/blink/renderer/modules/mediastream/speech_recognition_media_stream_audio_sink.cc similarity index 98% rename from third_party/blink/renderer/modules/speech/speech_recognition_media_stream_audio_sink.cc rename to third_party/blink/renderer/modules/mediastream/speech_recognition_media_stream_audio_sink.cc index 1678f01..f7197e2 100644 --- a/third_party/blink/renderer/modules/speech/speech_recognition_media_stream_audio_sink.cc +++ b/third_party/blink/renderer/modules/mediastream/speech_recognition_media_stream_audio_sink.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/renderer/modules/speech/speech_recognition_media_stream_audio_sink.h" +#include "third_party/blink/renderer/modules/mediastream/speech_recognition_media_stream_audio_sink.h" #include <memory>
diff --git a/third_party/blink/renderer/modules/speech/speech_recognition_media_stream_audio_sink.h b/third_party/blink/renderer/modules/mediastream/speech_recognition_media_stream_audio_sink.h similarity index 93% rename from third_party/blink/renderer/modules/speech/speech_recognition_media_stream_audio_sink.h rename to third_party/blink/renderer/modules/mediastream/speech_recognition_media_stream_audio_sink.h index 3dd2dca..aae7d41c 100644 --- a/third_party/blink/renderer/modules/speech/speech_recognition_media_stream_audio_sink.h +++ b/third_party/blink/renderer/modules/mediastream/speech_recognition_media_stream_audio_sink.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_SPEECH_SPEECH_RECOGNITION_MEDIA_STREAM_AUDIO_SINK_H_ -#define THIRD_PARTY_BLINK_RENDERER_MODULES_SPEECH_SPEECH_RECOGNITION_MEDIA_STREAM_AUDIO_SINK_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASTREAM_SPEECH_RECOGNITION_MEDIA_STREAM_AUDIO_SINK_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASTREAM_SPEECH_RECOGNITION_MEDIA_STREAM_AUDIO_SINK_H_ #include <memory> @@ -118,4 +118,4 @@ } // namespace blink -#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_SPEECH_SPEECH_RECOGNITION_MEDIA_STREAM_AUDIO_SINK_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASTREAM_SPEECH_RECOGNITION_MEDIA_STREAM_AUDIO_SINK_H_
diff --git a/third_party/blink/renderer/modules/mediastream/transferred_media_stream_track.cc b/third_party/blink/renderer/modules/mediastream/transferred_media_stream_track.cc index 9d17cddd..fc56abe7 100644 --- a/third_party/blink/renderer/modules/mediastream/transferred_media_stream_track.cc +++ b/third_party/blink/renderer/modules/mediastream/transferred_media_stream_track.cc
@@ -317,6 +317,15 @@ // initialized. } +void TransferredMediaStreamTrack::RegisterSink( + SpeechRecognitionMediaStreamAudioSink* sink) { + if (track_) { + track_->RegisterSink(sink); + } + // TODO(https://crbug.com/1288839): Save and forward to track_ once it's + // initialized. +} + // EventTarget const AtomicString& TransferredMediaStreamTrack::InterfaceName() const { // TODO(https://crbug.com/1288839): Should TMST have its own interface name?
diff --git a/third_party/blink/renderer/modules/mediastream/transferred_media_stream_track.h b/third_party/blink/renderer/modules/mediastream/transferred_media_stream_track.h index bfec67f..fb0f0e1 100644 --- a/third_party/blink/renderer/modules/mediastream/transferred_media_stream_track.h +++ b/third_party/blink/renderer/modules/mediastream/transferred_media_stream_track.h
@@ -84,6 +84,7 @@ void RegisterMediaStream(MediaStream*) override; void UnregisterMediaStream(MediaStream*) override; + void RegisterSink(SpeechRecognitionMediaStreamAudioSink*) override; // EventTarget const AtomicString& InterfaceName() const override;
diff --git a/third_party/blink/renderer/modules/ml/ml_trace_unittest.cc b/third_party/blink/renderer/modules/ml/ml_trace_unittest.cc index ff99f8dc..b25e2189 100644 --- a/third_party/blink/renderer/modules/ml/ml_trace_unittest.cc +++ b/third_party/blink/renderer/modules/ml/ml_trace_unittest.cc
@@ -41,8 +41,7 @@ void StartTracing(const std::string& filter) { base::trace_event::TraceLog::GetInstance()->SetEnabled( base::trace_event::TraceConfig(filter, - base::trace_event::RECORD_UNTIL_FULL), - base::trace_event::TraceLog::RECORDING_MODE); + base::trace_event::RECORD_UNTIL_FULL)); } static void TraceDataCb(
diff --git a/third_party/blink/renderer/modules/speech/BUILD.gn b/third_party/blink/renderer/modules/speech/BUILD.gn index dcc69c8..5989bb3 100644 --- a/third_party/blink/renderer/modules/speech/BUILD.gn +++ b/third_party/blink/renderer/modules/speech/BUILD.gn
@@ -21,8 +21,6 @@ "speech_recognition_error_event.h", "speech_recognition_event.cc", "speech_recognition_event.h", - "speech_recognition_media_stream_audio_sink.cc", - "speech_recognition_media_stream_audio_sink.h", "speech_recognition_result.cc", "speech_recognition_result.h", "speech_recognition_result_list.cc",
diff --git a/third_party/blink/renderer/modules/speech/speech_recognition.cc b/third_party/blink/renderer/modules/speech/speech_recognition.cc index c4a08bb9..0653448 100644 --- a/third_party/blink/renderer/modules/speech/speech_recognition.cc +++ b/third_party/blink/renderer/modules/speech/speech_recognition.cc
@@ -53,10 +53,10 @@ #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_track.h" +#include "third_party/blink/renderer/modules/mediastream/speech_recognition_media_stream_audio_sink.h" #include "third_party/blink/renderer/modules/speech/speech_recognition_controller.h" #include "third_party/blink/renderer/modules/speech/speech_recognition_error_event.h" #include "third_party/blink/renderer/modules/speech/speech_recognition_event.h" -#include "third_party/blink/renderer/modules/speech/speech_recognition_media_stream_audio_sink.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" @@ -299,20 +299,28 @@ if (base::FeatureList::IsEnabled( blink::features::kMediaStreamTrackWebSpeech) && stream_track_) { - sink_ = MakeGarbageCollected<SpeechRecognitionMediaStreamAudioSink>( - GetExecutionContext(), - WTF::BindOnce(&SpeechRecognition::StartController, - WrapPersistent(this))); + SpeechRecognitionMediaStreamAudioSink* sink = + MakeGarbageCollected<SpeechRecognitionMediaStreamAudioSink>( + GetExecutionContext(), + WTF::BindOnce(&SpeechRecognition::StartController, + WrapPersistent(this), + session_.BindNewPipeAndPassReceiver( + GetExecutionContext()->GetTaskRunner( + TaskType::kMiscPlatformAPI)))); WebMediaStreamAudioSink::AddToAudioTrack( - sink_, WebMediaStreamTrack(stream_track_->Component())); + sink, WebMediaStreamTrack(stream_track_->Component())); + stream_track_->RegisterSink(sink); } else { - StartController(); + StartController(session_.BindNewPipeAndPassReceiver( + GetExecutionContext()->GetTaskRunner(TaskType::kMiscPlatformAPI))); } started_ = true; } void SpeechRecognition::StartController( + mojo::PendingReceiver<media::mojom::blink::SpeechRecognitionSession> + session_receiver, std::optional<media::AudioParameters> audio_parameters, mojo::PendingReceiver<media::mojom::blink::SpeechRecognitionAudioForwarder> audio_forwarder_receiver) { @@ -324,13 +332,11 @@ GetExecutionContext()->GetTaskRunner(TaskType::kMiscPlatformAPI)); receiver_.set_disconnect_handler(WTF::BindOnce( &SpeechRecognition::OnConnectionError, WrapWeakPersistent(this))); - controller_->Start( - session_.BindNewPipeAndPassReceiver( - GetExecutionContext()->GetTaskRunner(TaskType::kMiscPlatformAPI)), - std::move(session_client), *grammars_, lang_, continuous_, - interim_results_, max_alternatives_, local_service_, - allow_cloud_fallback_, std::move(audio_forwarder_receiver), - std::move(audio_parameters)); + controller_->Start(std::move(session_receiver), std::move(session_client), + *grammars_, lang_, continuous_, interim_results_, + max_alternatives_, local_service_, allow_cloud_fallback_, + std::move(audio_forwarder_receiver), + std::move(audio_parameters)); } SpeechRecognition::SpeechRecognition(LocalDOMWindow* window) @@ -350,7 +356,6 @@ void SpeechRecognition::Trace(Visitor* visitor) const { visitor->Trace(stream_track_); visitor->Trace(grammars_); - visitor->Trace(sink_); visitor->Trace(controller_); visitor->Trace(final_results_); visitor->Trace(receiver_);
diff --git a/third_party/blink/renderer/modules/speech/speech_recognition.h b/third_party/blink/renderer/modules/speech/speech_recognition.h index b5b9754..8fc11b6 100644 --- a/third_party/blink/renderer/modules/speech/speech_recognition.h +++ b/third_party/blink/renderer/modules/speech/speech_recognition.h
@@ -55,7 +55,6 @@ class LocalDOMWindow; class MediaStreamTrack; class SpeechRecognitionController; -class SpeechRecognitionMediaStreamAudioSink; class MODULES_EXPORT SpeechRecognition final : public EventTarget, @@ -151,6 +150,8 @@ void OnConnectionError(); void StartInternal(ExceptionState* exception_state); void StartController( + mojo::PendingReceiver<media::mojom::blink::SpeechRecognitionSession> + session_receiver, std::optional<media::AudioParameters> audio_parameters = std::nullopt, mojo::PendingReceiver< media::mojom::blink::SpeechRecognitionAudioForwarder> @@ -165,7 +166,6 @@ bool local_service_ = true; bool allow_cloud_fallback_ = true; - Member<SpeechRecognitionMediaStreamAudioSink> sink_; Member<SpeechRecognitionController> controller_; bool started_ = false; bool stopping_ = false;
diff --git a/third_party/blink/renderer/platform/instrumentation/tracing/trace_event.cc b/third_party/blink/renderer/platform/instrumentation/tracing/trace_event.cc index 4de4505..3dd1ff7 100644 --- a/third_party/blink/renderer/platform/instrumentation/tracing/trace_event.cc +++ b/third_party/blink/renderer/platform/instrumentation/tracing/trace_event.cc
@@ -11,8 +11,7 @@ void EnableTracing(const String& category_filter) { base::trace_event::TraceLog::GetInstance()->SetEnabled( - base::trace_event::TraceConfig(category_filter.Utf8(), ""), - base::trace_event::TraceLog::RECORDING_MODE); + base::trace_event::TraceConfig(category_filter.Utf8(), "")); } void DisableTracing() {
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 62b7d42..062e7091 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -4406,11 +4406,6 @@ }, }, { - name: "UserActivationSameOriginVisibility", - base_feature: "none", - public: true, - }, - { name: "UserDefinedEntryPointTiming", status: "experimental", },
diff --git a/third_party/blink/renderer/platform/wtf/allocator/partitions.cc b/third_party/blink/renderer/platform/wtf/allocator/partitions.cc index 2f360187..d9ca92a 100644 --- a/third_party/blink/renderer/platform/wtf/allocator/partitions.cc +++ b/third_party/blink/renderer/platform/wtf/allocator/partitions.cc
@@ -55,7 +55,7 @@ BASE_FEATURE(kBlinkUseLargeEmptySlotSpanRingForBufferRoot, "BlinkUseLargeEmptySlotSpanRingForBufferRoot", -#if BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) base::FEATURE_ENABLED_BY_DEFAULT); #else base::FEATURE_DISABLED_BY_DEFAULT);
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 a07e647..d8b9d9e 100644 --- a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials +++ b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials
@@ -37,7 +37,7 @@ # These tests rely on site isolation to measure different OOPIF scenarios external/wpt/long-animation-frame/* [ Skip ] -# The following tests fail with UserActivationSameOriginVisibility plus UAv2. +# The following tests fail with UAv2. crbug.com/922725 http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html [ Failure ] crbug.com/922725 http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html [ Failure ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 1a6ba5d..6c1cfee 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -85,9 +85,6 @@ crbug.com/807686 crbug.com/24182 jquery/manipulation.html [ Pass Timeout ] -# Temporarily disable these tests, due to an API change -crbug.com/377577806 external/wpt/wasm/jsapi/jspi/* [ Failure Pass ] - # The following tests need to remove the assumption that user activation is # available in child/sibling frames. This assumption doesn't hold with User # Activation v2 (UAv2). @@ -2690,6 +2687,9 @@ crbug.com/343720396 external/wpt/html/cross-origin-opener-policy/iframe-popup-same-origin-allow-popups-to-unsafe-none.https.html?1-2 [ Crash Failure Timeout ] # ====== New tests from wpt-importer added here ====== +external/wpt/css/css-overflow/line-clamp/webkit-line-clamp-abspos-001.html [ Failure ] +[ Mac ] external/wpt/editing/run/forwarddelete-chars-following-collapsible-white-space.html [ Failure ] +[ Win11-arm64 ] external/wpt/css/css-paint-api/geometry-background-image-tiled-003.https.html [ Failure ] [ Mac13 ] external/wpt/webrtc/protocol/video-codecs.https.html [ Timeout ] [ Mac14 ] external/wpt/webrtc/protocol/video-codecs.https.html [ Timeout ] crbug.com/383609766 [ Mac15 ] external/wpt/webrtc/receiver-track-live.https.html [ Timeout ] @@ -6148,7 +6148,7 @@ # Several behavior differences between <selectlist> and <select style="appearance:base-select">. (These tests # were migrated from the old `the-selectlist-element` test suite.) -crbug.com/366394195 external/wpt/html/semantics/forms/the-select-element/select-events.tentative.html [ Timeout ] +crbug.com/366394195 external/wpt/html/semantics/forms/the-select-element/select-events.tentative.html [ Failure ] crbug.com/366394195 wpt_internal/html/semantics/forms/the-select-element/customizable-select/select-explicit-size.tentative.html [ Failure ] crbug.com/366394195 wpt_internal/html/semantics/forms/the-select-element/customizable-select/select-font-size.tentative.html [ Failure ] crbug.com/366394195 external/wpt/html/semantics/forms/the-select-element/select-keyboard.tentative.html [ Failure ] @@ -8826,3 +8826,5 @@ crbug.com/378549335 [ Mac ] wpt_internal/ai/language-model-api-context-overflow.https.any.html [ Pass Timeout ] crbug.com/378549335 [ Mac ] wpt_internal/ai/language-model-api-context-overflow.https.any.worker.html [ Pass Timeout ] + +crbug.com/383855460 inspector-protocol/css/css-get-animated-styles.js [ Failure Pass ]
diff --git a/third_party/blink/web_tests/TestLists/headless_shell.filter b/third_party/blink/web_tests/TestLists/headless_shell.filter index ec7a240..c6ce6d5 100644 --- a/third_party/blink/web_tests/TestLists/headless_shell.filter +++ b/third_party/blink/web_tests/TestLists/headless_shell.filter
@@ -409,7 +409,7 @@ -external/wpt/css/css-scrollbars/* -external/wpt/css/css-scroll-snap-2/scrollsnapchanging/scrollsnapchanging-on-* -external/wpt/css/css-scroll-snap-2/scroll-start/scroll-start-fieldset.tentative.html --external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-rtl.tentative.html +-external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-rtl.tentative.html -external/wpt/css/css-scroll-snap/input/snap-area-overflow-boundary-viewport-covering.tentative.html -external/wpt/css/css-scroll-snap/selection-target.html -external/wpt/css/css-scroll-snap/snap-after-relayout/changing-scroll-snap-align-nested.tentative.html
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 14f2efe..bfe7fb53 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
@@ -25610,6 +25610,19 @@ } ] ], + "webkit-box-align-001.html": [ + "83f095ddd242416c382aca99b7d7b4c03444bfcd", + [ + null, + [ + [ + "/compat/green-ref.html", + "==" + ] + ], + {} + ] + ], "webkit-box-clamp-bottom-border.html": [ "f133335e79683d5808324e4b2f3559480312f644", [ @@ -115682,6 +115695,19 @@ {} ] ], + "aspect-ratio-intrinsic-size-010.html": [ + "7afc53e751e4950d5ebda56ccee30004ece0e38a", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], "aspect-ratio-transferred-max-size.html": [ "3331e5fabef369880f0b5e074fecb6464926ffb8", [ @@ -134862,6 +134888,32 @@ ] ], "grid-definition": { + "flex-item-grid-container-auto-repeat-001.html": [ + "06f87974731af3cf1cf425e8b61cab67a67df024", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], + "flex-item-grid-container-auto-repeat-002.html": [ + "e199190be6a545a6ab20d79178b538288ae6ef79", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], "flex-item-grid-container-percentage-rows-001.html": [ "ba655ce8a17d6482071d39e66684b50ebe749822", [ @@ -168506,6 +168558,19 @@ {} ] ], + "webkit-line-clamp-abspos-001.html": [ + "be7798c21195ad6fba0ac543e37d2d7c6d56b995", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], "webkit-line-clamp-block-in-inline-001.html": [ "75d1de3bf5bcf5d00d6980de4a70845e9f7ae8e4", [ @@ -267276,6 +267341,19 @@ {} ] ], + "fecolormatrix-negative.html": [ + "eddec862154fc9929a9f7ad8f9cbb0a7d182ef18", + [ + null, + [ + [ + "/css/filter-effects/fecolormatrix-negative-ref.html", + "==" + ] + ], + {} + ] + ], "fecolormatrix-type.html": [ "990225d0113c39f1f3ccd249dfbb11ed28989c47", [ @@ -347989,15 +348067,15 @@ }, "scroll-start-target": { "scroll-start-target-with-anchor-navigation-inner-frame.html": [ - "de02dcf00f68ee13ee00e31877d62199d22922f7", + "c363961add7aaba5c3320b31589706eb8757083b", [] ], "scroll-start-target-with-hash-fragment-navigation-inner-frame.html": [ - "90629c4990f6753dd770e00ad7da7a6b21a984bf", + "1c81212e216a81220e658fabe67c9645eab0fe09", [] ], "scroll-start-target-with-text-fragment-navigation-target.html": [ - "80cbb55fb2730d8dc5cc3edd880e8e890281ef05", + "bbedb011328036987c64a6f172d72aaa4143164c", [] ], "stash.py": [ @@ -364179,6 +364257,10 @@ "21c33ea1cd44fa23f6f92c3881e6ef22d33587d2", [] ], + "fecolormatrix-negative-ref.html": [ + "95a0051c18a1219012e48ad91e58ecc213ba24b6", + [] + ], "fecolormatrix-type-ref.html": [ "182b4b547c0d8f45c0b55a290d7d5b83e297364c", [] @@ -367974,7 +368056,7 @@ [] ], "delete.js": [ - "c4d1225ef35bad1638afe112b2741582e3b5ac47", + "dcb3a6a28dfe7ecb5b33749f176a195287b77b52", [] ], "fontname.js": [ @@ -367994,7 +368076,7 @@ [] ], "forwarddelete.js": [ - "a881fb6ccf4618c16c3ac782bd5de1d1fb5a7aa9", + "66d978c73de916b039007035b9263f038bdada6b", [] ], "hilitecolor.js": [ @@ -368034,7 +368116,7 @@ [] ], "inserttext.js": [ - "568b467f153c486b3792ca16947920b14d0a0859", + "7e9dd05fe460bd853491830ea25986825e51d6d4", [] ], "insertunorderedlist.js": [ @@ -368066,7 +368148,7 @@ [] ], "multitest.js": [ - "e85f54addfc80919bed813b8a9236ee3fd508360", + "2d5404ba8989035a99d097f3322e65c7804c0af4", [] ], "outdent.js": [ @@ -368110,7 +368192,7 @@ ], "include": { "editor-test-utils.js": [ - "b302d19a117503c3ed5bd0d71f4feee1d3d21f26", + "b2e53515e0f794fab0900cd7ec3b26a953bcf640", [] ], "implementation.js": [ @@ -368748,7 +368830,7 @@ [] ], "delete_7001-last-expected.txt": [ - "9423a9150f49647368ba713af5f8196c38460a22", + "325a83486f5615a5d838191e697365abd4dfc53f", [] ], "fontname_1-1000-expected.txt": [ @@ -368836,7 +368918,7 @@ [] ], "forwarddelete_7001-last-expected.txt": [ - "50b5b3ddd83707c490ec12f283d4c3f5d135339b", + "58a4e8792e7fa83d2a81b156b041e88b45762ed2", [] ], "hilitecolor-expected.txt": [ @@ -369008,7 +369090,7 @@ [] ], "multitest_9001-last-expected.txt": [ - "652836f49584867daeea9abe10b211a93629f1ed", + "1299121ad56d1472088d1a9f919fb67eb2945ab1", [] ], "outdent_1-1000-expected.txt": [ @@ -488867,21 +488949,21 @@ ] ], "scroll-start-target-computed.html": [ - "1ebb5e786541d365ec6df3da3becbd9c8d10957c", + "50dbcff2397dd2524f791e06ae988b74a881ba28", [ null, {} ] ], "scroll-start-target-invalid.html": [ - "f2a60836d1d9289e20476fff57d3c610cf2d4186", + "dfcaaabdeeddc73f995ce691615d8eb2005c6fac", [ null, {} ] ], "scroll-start-target-valid.html": [ - "9ff7055a81cc95a33e04e4fbcda05ff5dab5b473", + "3397f19e50c9eee37a94901ee648a1d4eef77d74", [ null, {} @@ -488987,21 +489069,21 @@ }, "scroll-start-target": { "scroll-start-target-aligns-with-snap-align.tentative.html": [ - "3203e1e1a61593a84d8c1f6a6893768322387da4", + "8dc76a657d7a105cd915a3ddd33ebca68487dfb1", [ null, {} ] ], "scroll-start-target-display-toggled.tentative.html": [ - "a0224a568e5658abaef76e6dd0bb67f77fcd70c2", + "2f58e2393c75db67442eedec6c40706718ee41a4", [ null, {} ] ], "scroll-start-target-nested-container.tentative.html": [ - "e3a1df6e6a1b6a27dea2ffe4f768ea167c7962ce", + "cd2717ed88cc975db9acb61519882a9c735db84b", [ null, { @@ -489010,28 +489092,28 @@ ] ], "scroll-start-target-root.tentative.html": [ - "860a592bb106a50482b18437b3d8a7186e33a03e", + "5cb9e7447333e09544f04f7cd30c95a27d671fea", [ null, {} ] ], "scroll-start-target-rtl.tentative.html": [ - "e7766cc07a2c8632030b462c44f550c312137135", + "7cb0f93c495825123be2fe5941421202f62deea0", [ null, {} ] ], "scroll-start-target-span.tentative.html": [ - "0985dcc2ee91f00032f3b0561a98082da09f4b0d", + "e7fe0479089cec0548194772ccc7ccf624811d12", [ null, {} ] ], "scroll-start-target-with-anchor-navigation.tentative.html": [ - "bc5b75f75f1c32d34b5e5033c25b49d0d5882447", + "bb3380e3ab65106d159a10d0deaa552cab108368", [ null, { @@ -489040,35 +489122,35 @@ ] ], "scroll-start-target-with-hash-fragment-navigation.tentative.html": [ - "2d291c2ef9ff92e5fdd530dfafb357297243bc72", + "6eb1737b39f557a5e1f9b1377b10e38777de6f2a", [ null, {} ] ], "scroll-start-target-with-scroll-snap.tentative.html": [ - "28bea40d7a04481d3426429dd89f697e061b08c3", + "dfdb8b0277249fb023a79823d6f4582579c333cd", [ null, {} ] ], "scroll-start-target-with-scroll-start-root.tentative.html": [ - "daf664aa7fbdf75b88cf16b544b76f5060c6a6a6", + "2405334540faaa6b02de4a31284714b036179f80", [ null, {} ] ], "scroll-start-target-with-scroll-start.tentative.html": [ - "a08daad76db6ddc9a3997fa7f612298ab7f47e91", + "9c0f58ddbfbfbe283fd764fd081db55b11e50c15", [ null, {} ] ], "scroll-start-target-with-text-fragment-navigation.tentative.html": [ - "f83ea1a036aee2f8e26796df1c27193e9493b052", + "dc8c332270c84c7776a7278befb5d3308da31d62", [ null, { @@ -489077,7 +489159,7 @@ ] ], "scroll-start-target-with-user-programmatic-scroll.tentative.html": [ - "6bcf103253d6c54060a6e07eb370961fea20ad64", + "20d6763034f6dad0297ec0b6d470d028485f59bb", [ null, { @@ -489086,7 +489168,7 @@ ] ], "scroll-start-target.tentative.html": [ - "1fcb3cbbe40ae91298945a15274f1d4a143a5f43", + "13e9e20e3e2bad72aaf2f43b6b3c1227df287ced", [ null, {} @@ -519150,6 +519232,16 @@ } ] ], + "delete-chars-following-collapsible-white-space.html": [ + "7340a9ebf72e776c2d291f626fd6a9b0a87d984e", + [ + null, + { + "testdriver": true, + "timeout": "long" + } + ] + ], "delete-list-items-in-table-cell.html": [ "88f4458987244cf8714ed425c361023070238e86", [ @@ -519159,6 +519251,15 @@ } ] ], + "delete-to-make-editing-host-empty.html": [ + "d16bb88d6b0e1a4ecda0e4e81b202dea950caa3c", + [ + null, + { + "testdriver": true + } + ] + ], "delete.html": [ "6a01ffd0441c88d7b89ef1f78b562a6fad9f7a20", [ @@ -519312,6 +519413,16 @@ } ] ], + "forwarddelete-chars-following-collapsible-white-space.html": [ + "9cfdd9879ec25a209c6b43269c3e4cbc68054763", + [ + null, + { + "testdriver": true, + "timeout": "long" + } + ] + ], "forwarddelete.html": [ "177cee7c1fe77518c567ac96b7486d6006fa4daa", [
diff --git a/third_party/blink/web_tests/external/wpt/compat/webkit-box-align-001.html b/third_party/blink/web_tests/external/wpt/compat/webkit-box-align-001.html new file mode 100644 index 0000000..83f095d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/compat/webkit-box-align-001.html
@@ -0,0 +1,26 @@ +<!DOCTYPE html> +<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> +<link rel="author" title="Mozilla" href="https://www.mozilla.org/"> +<link rel="help" href="https://compat.spec.whatwg.org/#propdef--webkit-box-align"> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1936370"> +<link rel="match" href="green-ref.html"> +<meta name="assert" content="This test checks that a legacy flex container with -webkit-box-align:start doesn't stretch the cross-axis of its items."> + +<style> +.container { + display: -webkit-inline-box; + -webkit-box-align: start; /* Map to align-items: flex-start */ + height: 100px; + background: green; +} +.item { + padding: 15px; + border-inline: 25px solid green; + margin: 10px; + aspect-ratio: 1/1; +} +</style> + +<div class="container"> + <div class="item"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-flexbox/aspect-ratio-intrinsic-size-010.html b/third_party/blink/web_tests/external/wpt/css/css-flexbox/aspect-ratio-intrinsic-size-010.html new file mode 100644 index 0000000..7afc53e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-flexbox/aspect-ratio-intrinsic-size-010.html
@@ -0,0 +1,14 @@ +<!DOCTYPE html> +<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> +<link rel="author" title="Mozilla" href="https://www.mozilla.org/"> +<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#valdef-align-items-stretch"> +<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes"> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1936370"> +<link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="This checks that a flex item with an aspect-ratio transfers its size when it also has stretch alignment."> + +<p>Test passes if there is a filled green square.</p> +<div style="display: inline-flex; height: 100px; background: green;"> + <div style="box-sizing: border-box; padding: 3px; border: 7px solid green; margin: 10px; + aspect-ratio: 1/1;"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-color-invalid.html b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-color-invalid.html index a1e6769a..36f26ce 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-color-invalid.html +++ b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-color-invalid.html
@@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <title>CSS Gap Decorations: column-rule-color parsing</title> -<link rel="help" href="https://kbabbitt.github.io/css-gap-decorations/#column-row-rule-color"> +<link rel="help" href="https://drafts.csswg.org/css-gaps-1/#column-row-rule-color"> <link rel="author" title="Sam Davis Omekara Jr." href="mailto:samomekarajr@microsoft.com"> <meta name="assert" content="column-rule-color supports only the grammar '[ <line-color-list> | <auto-line-color-list> ]'."> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-color-valid.html b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-color-valid.html index e8fd4df..d4cb5b1 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-color-valid.html +++ b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-color-valid.html
@@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <title>CSS Gap Decorations: parsing column-rule-color with valid values</title> -<link rel="help" href="https://kbabbitt.github.io/css-gap-decorations/#column-row-rule-color"> +<link rel="help" href="https://drafts.csswg.org/css-gaps-1/#column-row-rule-color"> <link rel="author" title="Sam Davis Omekara Jr." href="mailto:samomekarajr@microsoft.com"> <meta name="assert" content="column-rule-color supports the full grammar '[ <line-color-list> | <auto-line-color-list> ]'."> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-computed.html b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-computed.html index 60600bd..3d55aed 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-computed.html +++ b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-computed.html
@@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <title>CSS Gap Decoration: column-rule-style getComputedStyle()</title> -<link rel="help" href="https://kbabbitt.github.io/css-gap-decorations/pr-11115/Overview.html#column-row-rule-style"> +<link rel="help" href="https://drafts.csswg.org/css-gaps-1/#column-row-rule-style"> <link rel="author" title="Sam Davis Omekara Jr." href="mailto:samomekarajr@microsoft.com"> <meta name="assert" content="column-rule-style computed value is as specified."> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-invalid.html b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-invalid.html index d2a11f6c..1ea5331 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-invalid.html +++ b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-invalid.html
@@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <title>CSS Gap Decorations: column-rule-style parsing</title> -<link rel="help" href="https://kbabbitt.github.io/css-gap-decorations/pr-11115/Overview.html#column-row-rule-style"> +<link rel="help" href="https://drafts.csswg.org/css-gaps-1/#column-row-rule-style"> <link rel="author" title="Sam Davis Omekara Jr." href="mailto:samomekarajr@microsoft.com"> <meta name="assert" content="column-rule-style supports only the grammar '[ <line-style-list> | <auto-line-style-list> ]'."> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-valid.html b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-valid.html index 74d243b..d90a9f8 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-valid.html +++ b/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/parsing/gap-decorations-style-valid.html
@@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <title>CSS Gap Decorations: parsing column-rule-style with valid values</title> -<link rel="help" href="https://kbabbitt.github.io/css-gap-decorations/pr-11115/Overview.html#column-row-rule-style"> +<link rel="help" href="https://drafts.csswg.org/css-gaps-1/#column-row-rule-style"> <link rel="author" title="Sam Davis Omekara Jr." href="mailto:samomekarajr@microsoft.com"> <meta name="assert" content="column-rule-style supports the full grammar '[ <line-style-list> | <auto-line-style-list> ]'."> <script src="/resources/testharness.js"></script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/grid-definition/flex-item-grid-container-auto-repeat-001.html b/third_party/blink/web_tests/external/wpt/css/css-grid/grid-definition/flex-item-grid-container-auto-repeat-001.html new file mode 100644 index 0000000..06f8797 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-grid/grid-definition/flex-item-grid-container-auto-repeat-001.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> +<link rel="author" title="Mozilla" href="https://www.mozilla.org/"> +<link rel="help" href="https://drafts.csswg.org/css-grid-1/#auto-repeat"> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1936276"> +<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="This test verifies that the grid container's content size suggestion (min-content size) is 50px, which is contributed by only one repeat column."> + +<style> +.flex { + display: flex; + width: 100px; + height: 100px; +} +.item-flex-none { + width: 50px; + flex: none; + background: green; +} +.item-grid-container { + display: grid; + width: 200%; + grid-template-columns: repeat(auto-fill, 50px); + background: green; +} +</style> + +<p>Test passes if there is a filled green square.</p> +<div class="flex"> + <div class="item-flex-none"></div> + <div class="item-grid-container"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-grid/grid-definition/flex-item-grid-container-auto-repeat-002.html b/third_party/blink/web_tests/external/wpt/css/css-grid/grid-definition/flex-item-grid-container-auto-repeat-002.html new file mode 100644 index 0000000..e199190 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-grid/grid-definition/flex-item-grid-container-auto-repeat-002.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> +<link rel="author" title="Mozilla" href="https://www.mozilla.org/"> +<link rel="help" href="https://drafts.csswg.org/css-grid-1/#auto-repeat"> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1936276"> +<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html"> +<meta name="assert" content="This test verifies that the grid container's content size suggestion (min-content size) is 50px, which is contributed by only one repeat column."> + +<style> +.flex { + display: flex; + width: 100px; + height: 100px; +} +.item-flex-none { + width: 50px; + flex: none; + background: green; +} +.item-grid-container { + display: grid; + width: 200px; + grid-template-columns: repeat(auto-fill, 50px); + background: green; +} +</style> + +<p>Test passes if there is a filled green square.</p> +<div class="flex"> + <div class="item-flex-none"></div> + <div class="item-grid-container"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-overflow/line-clamp/webkit-line-clamp-abspos-001.html b/third_party/blink/web_tests/external/wpt/css/css-overflow/line-clamp/webkit-line-clamp-abspos-001.html new file mode 100644 index 0000000..be7798c2 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-overflow/line-clamp/webkit-line-clamp-abspos-001.html
@@ -0,0 +1,35 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>line-clamping shouldn't prevent abspos content from painting</title> +<link rel="author" href="mailto:dholbert@mozilla.com" title="Daniel Holbert"> +<link rel="author" href="https://mozilla.org" title="Mozilla"> +<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html"> +<link rel="help" href="https://drafts.csswg.org/css-overflow-4/#propdef--webkit-line-clamp"> +<link rel="help" href="https://bugzil.la/1934547"> +<style> +.line-clamp { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + position: relative; + overflow: hidden; + height: 100px; + width: 100px; +} +.abspos { + position: absolute; + top: 0; + left: 0; + height: 100px; + width: 100px; + background: green; +} +</style> +<p>Test passes if there is a filled green square.</p> + +<div class="line-clamp"> + FAIL<br> + FAIL<br> + FAIL<br> + <div class="abspos"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-aligns-with-snap-align.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-aligns-with-snap-align.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-aligns-with-snap-align.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-aligns-with-snap-align.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-display-toggled.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-display-toggled.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-display-toggled.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-display-toggled.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-nested-container.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-nested-container.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-nested-container.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-nested-container.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-root.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-root.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-root.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-root.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-rtl.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-rtl.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-rtl.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-rtl.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-span.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-span.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-span.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-span.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-anchor-navigation-inner-frame.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-anchor-navigation-inner-frame.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-anchor-navigation-inner-frame.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-anchor-navigation-inner-frame.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-anchor-navigation.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-anchor-navigation.tentative.html similarity index 95% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-anchor-navigation.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-anchor-navigation.tentative.html index bb3380e3..8c6d02a 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-anchor-navigation.tentative.html +++ b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-anchor-navigation.tentative.html
@@ -15,7 +15,7 @@ </head> <body> - <iframe id="frame" src="scroll-start-target-with-anchor-navigation-inner-frame.html" onload="runTest()"></iframe> + <iframe id="frame" src="scroll-initial-target-with-anchor-navigation-inner-frame.html" onload="runTest()"></iframe> <script> function runTest() { promise_test(async (t) => {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-hash-fragment-navigation-inner-frame.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-hash-fragment-navigation-inner-frame.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-hash-fragment-navigation-inner-frame.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-hash-fragment-navigation-inner-frame.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-hash-fragment-navigation.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-hash-fragment-navigation.tentative.html similarity index 92% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-hash-fragment-navigation.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-hash-fragment-navigation.tentative.html index 6eb1737..80b3a0a 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-hash-fragment-navigation.tentative.html +++ b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-hash-fragment-navigation.tentative.html
@@ -10,7 +10,7 @@ </head> <body> - <iframe id="frame" src="scroll-start-target-with-fragment-navigation-inner-frame.html#fragment_target" + <iframe id="frame" src="scroll-initial-target-with-fragment-navigation-inner-frame.html#fragment_target" onload="runTest()"></iframe> <script> function runTest() {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-scroll-snap.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-scroll-snap.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-scroll-snap.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-scroll-snap.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-scroll-start-root.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-scroll-start-root.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-scroll-start-root.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-scroll-start-root.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-scroll-start.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-scroll-start.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-scroll-start.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-scroll-start.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-text-fragment-navigation-target.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-text-fragment-navigation-target.html similarity index 95% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-text-fragment-navigation-target.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-text-fragment-navigation-target.html index bbedb01..4cad10e 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-text-fragment-navigation-target.html +++ b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-text-fragment-navigation-target.html
@@ -42,7 +42,7 @@ <div id="fragment_target">Target</div> <script> function stashResult(key, results) { - fetch(`/css/css-scroll-snap-2/scroll-start-target/stash.py?key=${key}`, { + fetch(`/css/css-scroll-snap-2/scroll-initial-target/stash.py?key=${key}`, { method: "POST", body: JSON.stringify(results) }).then(() => {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-text-fragment-navigation.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-text-fragment-navigation.tentative.html similarity index 85% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-text-fragment-navigation.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-text-fragment-navigation.tentative.html index dc8c332..a83b36c2 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-text-fragment-navigation.tentative.html +++ b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-text-fragment-navigation.tentative.html
@@ -16,7 +16,7 @@ <body onload="runTest()"> <script> function fetchResult(key, resolve, reject) { - fetch(`/css/css-scroll-snap-2/scroll-start-target/stash.py?key=${key}`).then(response => { + fetch(`/css/css-scroll-snap-2/scroll-initial-target/stash.py?key=${key}`).then(response => { return response.text(); }).then(text => { if (text) { @@ -37,7 +37,7 @@ let key = token(); test_driver.bless("Open a URL with a text fragment directive", () => { - window.open(`scroll-start-target-with-text-fragment-navigation-target.html?key=${key}#:~:text=Target`, "_blank", "noopener"); + window.open(`scroll-initial-target-with-text-fragment-navigation-target.html?key=${key}#:~:text=Target`, "_blank", "noopener"); }); fetchResult(key, resolve, reject);
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-user-programmatic-scroll.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-user-programmatic-scroll.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target-with-user-programmatic-scroll.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target-with-user-programmatic-scroll.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target.tentative.html similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/scroll-start-target.tentative.html rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/scroll-initial-target.tentative.html
diff --git a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/stash.py b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/stash.py similarity index 68% rename from third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/stash.py rename to third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/stash.py index 3c65e2b..1b1800d 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-start-target/stash.py +++ b/third_party/blink/web_tests/external/wpt/css/css-scroll-snap-2/scroll-initial-target/stash.py
@@ -3,11 +3,11 @@ # found in the LICENSE file. """ This file allows the different windows created by -css/css-scroll-snap-2/scroll-start-target-with-text-fragment-navigation.html +css/css-scroll-snap-2/scroll-initial-target-with-text-fragment-navigation.html to store and retrieve data. -scroll-start-target-with-text-fragment-navigation.html (test file) opens a window to -scroll-start-target-with-text-fragment-navigation-target.html which writes some data +scroll-initial-target-with-text-fragment-navigation.html (test file) opens a window to +scroll-initial-target-with-text-fragment-navigation-target.html which writes some data which the test file will eventually read. This file handles the requests from both windows. """ @@ -19,9 +19,9 @@ if request.method == u"POST": # Received result data from target page - request.server.stash.put(key, request.body, u'/css/css-scroll-snap-2/scroll-start-target/') + request.server.stash.put(key, request.body, u'/css/css-scroll-snap-2/scroll-initial-target/') return u"ok" else: # Request for result data from test page - value = request.server.stash.take(key, u'/css/css-scroll-snap-2/scroll-start-target/') + value = request.server.stash.take(key, u'/css/css-scroll-snap-2/scroll-initial-target/') return value
diff --git a/third_party/blink/web_tests/external/wpt/css/css-view-transitions/navigation/chromium-paint-holding-timeout.html b/third_party/blink/web_tests/external/wpt/css/css-view-transitions/navigation/chromium-paint-holding-timeout.html index 8359694..cb398469 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-view-transitions/navigation/chromium-paint-holding-timeout.html +++ b/third_party/blink/web_tests/external/wpt/css/css-view-transitions/navigation/chromium-paint-holding-timeout.html
@@ -6,6 +6,7 @@ <link rel="match" href="chromium-paint-holding-timeout-ref.html"> <link rel="assert" content="Ensures paint holding timeout cancels transition. Note that this is a Chromium only test"> <script src="/common/reftest-wait.js"></script> +<script src="/web-animations/testcommon.js"></script> <style> @view-transition { navigation: auto; @@ -24,6 +25,9 @@ const url = "resources/chromium-paint-holding-timeout.html"; window.location.replace(new URL(url, window.location)); } -onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest)); +onload = async () => { + await waitForCompositorReady(); + runTest(); +} </script> </html>
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/fecolormatrix-negative-ref.html b/third_party/blink/web_tests/external/wpt/css/filter-effects/fecolormatrix-negative-ref.html new file mode 100644 index 0000000..95a0051c1 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/fecolormatrix-negative-ref.html
@@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> + <title>Filter Effects: Test feColorMatrix with negative matrix entries</title> + <link rel="author" title="Toby Cathcart Burn" href="mailto:tcathcartburn@gmail.com"> +</head> + +<body> + + <p>You should see a cyan colored rectangle.</p> + + <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'> + <rect x='0' y='0' width='100' height='100' fill="#00ffff"></rect> + </svg> + +</body> + +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/filter-effects/fecolormatrix-negative.html b/third_party/blink/web_tests/external/wpt/css/filter-effects/fecolormatrix-negative.html new file mode 100644 index 0000000..eddec862 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/filter-effects/fecolormatrix-negative.html
@@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> + <title>Filter Effects: Test feColorMatrix with negative matrix entries</title> + <link rel="author" title="Toby Cathcart Burn" href="mailto:tcathcartburn@gmail.com"> + <link rel="help" href="http://www.w3.org/TR/filter-effects-1/#feColorMatrixElement"> + <link rel="help" href="http://www.w3.org/TR/filter-effects-1/#element-attrdef-fecolormatrix-type"> + <link rel="match" href="fecolormatrix-negative-ref.html"> + <meta name="assert" content="If the test runs, you should see a cyan(#00ffff) colored rectangle."> +</head> + +<body> + + <p>You should see a cyan colored rectangle.</p> + + <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'> + <defs> + <filter id='invert' color-interpolation-filters='sRGB'> + <feColorMatrix in='SourceGraphic' + values='-1 0 0 0 1 + 0 -1 0 0 1 + 0 0 -1 0 1 + 0 0 0 1 0' result='ef0'> + </feColorMatrix> + <feComposite in='ef0' in2='ef0' operator='arithmetic' k2='255'> + </feComposite> + </filter> + </defs> + + <rect x='0' y='0' width='100' height='100' fill="#ffaa00" filter="url(#invert)"></rect> + </svg> + +</body> + +</html>
diff --git a/third_party/blink/web_tests/external/wpt/editing/data/delete.js b/third_party/blink/web_tests/external/wpt/editing/data/delete.js index c4d1225..dcb3a6a 100644 --- a/third_party/blink/web_tests/external/wpt/editing/data/delete.js +++ b/third_party/blink/web_tests/external/wpt/editing/data/delete.js
@@ -3101,4 +3101,26 @@ "<p><span contenteditable=\"false\">ab</span></p>", [true], {}], +// Delete only first <br> to make 2 empty lines to only one line. +["<div>abc</div><br>{}<br><div>def</div>", + [["delete",""]], + "<div>abc</div><br><div>def</div>", + [true], + {}], +["<div><font><table><td>a</table><br>{}<br><table><td>b</table></font></div>", + [["delete",""]], + "<div><font><table><tbody><tr><td>a</td></tr></tbody></table><br><table><tbody><tr><td>b</td></tr></tbody></table></font></div>", + [true], + {}], +// Cells shouldn't be joined, but new empty inline ancestors should be deleted. +["<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>", + [["delete",""]], + "<table><tbody><tr><td>a</td><td><br></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>", + [true], + {}], +["<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>", + [["delete",""]], + "<table><tbody><tr><th>a</th><th><br></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>", + [true], + {}], ]
diff --git a/third_party/blink/web_tests/external/wpt/editing/data/forwarddelete.js b/third_party/blink/web_tests/external/wpt/editing/data/forwarddelete.js index a881fb6..66d978c 100644 --- a/third_party/blink/web_tests/external/wpt/editing/data/forwarddelete.js +++ b/third_party/blink/web_tests/external/wpt/editing/data/forwarddelete.js
@@ -2981,4 +2981,26 @@ "<p><span contenteditable=\"false\">ab</span></p>", [true], {}], +// Delete only first <br> to make 2 empty lines to only one line. +["<div>abc</div>{}<br><br><div>def</div>", + [["forwarddelete",""]], + "<div>abc</div><br><div>def</div>", + [true], + {}], +["<div><font><table><td>a</table>{}<br><br><table><td>b</table></font></div>", + [["forwarddelete",""]], + "<div><font><table><tbody><tr><td>a</td></tr></tbody></table><br><table><tbody><tr><td>b</td></tr></tbody></table></font></div>", + [true], + {}], +// Cells shouldn't be joined, but new empty inline ancestors should be deleted. +["<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>", + [["forwarddelete",""]], + "<table><tbody><tr><td>a</td><td><br></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>", + [true], + {}], +["<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>", + [["forwarddelete",""]], + "<table><tbody><tr><th>a</th><th><br></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>", + [true], + {}], ]
diff --git a/third_party/blink/web_tests/external/wpt/editing/data/inserttext.js b/third_party/blink/web_tests/external/wpt/editing/data/inserttext.js index 568b467..7e9dd05 100644 --- a/third_party/blink/web_tests/external/wpt/editing/data/inserttext.js +++ b/third_party/blink/web_tests/external/wpt/editing/data/inserttext.js
@@ -1527,4 +1527,15 @@ "<div style=\"display:grid\"><span>abc</span><span><b>gh</b></span></div>", [true,true], {}], + +["<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>", + [["inserttext","B"]], + "<table><tbody><tr><td>a</td><td><b>B</b></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>", + [true], + {}], +["<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>", + [["inserttext","B"]], + "<table><tbody><tr><th>a</th><th><b>B</b></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>", + [true], + {}], ]
diff --git a/third_party/blink/web_tests/external/wpt/editing/data/multitest.js b/third_party/blink/web_tests/external/wpt/editing/data/multitest.js index e85f54a..2d5404b 100644 --- a/third_party/blink/web_tests/external/wpt/editing/data/multitest.js +++ b/third_party/blink/web_tests/external/wpt/editing/data/multitest.js
@@ -2417,8 +2417,7 @@ {"delete":[false,false,"",false,false,""],"inserttext":[false,false,"",false,false,""]}], ["<div><b>[abc]</b></div>", [["styleWithCSS", "false"],["delete",""],["inserttext","a"]], - ["<b>a</b>", - "<b>a</b><br>"], // The <div> should be deleted by "delete" + "<b>a</b>", // The <div> should be deleted by "delete" [true,true,true], {"bold":[false,true,"",false,true,""]}], ["<div>abc<b>[def]</b></div>", @@ -2429,30 +2428,22 @@ {"bold":[false,true,"",false,true,""]}], ["<div><b>[abc]</b></div>", [["styleWithCSS", "false"],["delete",""],["insertparagraph",""],["inserttext","a"]], - ["<br><div><b>a</b></div>", - "<br><div><b>a</b><br></div>"], // The <div> should be deleted by "delete", but new text should be in new <div> + "<br><div><b>a</b></div>", // The <div> should be deleted by "delete", but new text should be in new <div> [true,true,true,true], {"bold":[false,true,"",false,true,""]}], ["<div>abc<b>[def]</b></div>", [["styleWithCSS", "false"], ["delete",""],["insertparagraph",""],["inserttext","d"]], - ["<div>abc</div><div><b>d</b></div>", - "<div>abc</div><div><b>d</b><br></div>", - "<div>abc<br></div><div><b>d</b></div>", - "<div>abc<br></div><div><b>d</b><br></div>"], + "<div>abc</div><div><b>d</b></div>", [true,true,true,true], {"bold":[false,true,"",false,true,""]}], ["<div><b>[abc]</b></div>", [["styleWithCSS", "false"],["insertparagraph",""],["inserttext","a"]], - ["<br><div><b>a</b></div>", - "<br><div><b>a</b><br></div>"], // The <div> should be deleted by "insertparagraph", but new text should be in new <div> + "<br><div><b>a</b></div>", // The <div> should be deleted by "insertparagraph", but new text should be in new <div> [true,true,true], {"bold":[false,true,"",false,true,""]}], ["<div>abc<b>[def]</b></div>", [["styleWithCSS", "false"],["insertparagraph",""],["inserttext","d"]], - ["<div>abc</div><div><b>d</b></div>", - "<div>abc</div><div><b>d</b><br></div>", - "<div>abc<br></div><div><b>d</b></div>", - "<div>abc<br></div><div><b>d</b><br></div>"], + "<div>abc</div><div><b>d</b></div>", [true,true,true], {"bold":[false,true,"",false,true,""]}], @@ -2466,29 +2457,22 @@ {"bold":[false,true,"",false,false,""]}], ["<div><i><b>abc[]<br></b></i></div>", [["styleWithCSS", "false"],["bold",""],["inserttext","d"]], - ["<div><i><b>abc</b>d</i></div>", - "<div><i><b>abc</b>d<br></i></div>", - "<div><i><b>abc</b>d</i><br></div>"], + "<div><i><b>abc</b>d</i></div>", [true,true,true], {"bold":[false,true,"",false,false,""]}], ["<div><i><b>abc[]</b><br></i></div>", [["styleWithCSS", "false"],["bold",""],["inserttext","d"]], - ["<div><i><b>abc</b>d</i></div>", - "<div><i><b>abc</b>d<br></i></div>"], + "<div><i><b>abc</b>d</i></div>", [true,true,true], {"bold":[false,true,"",false,false,""]}], ["<div><b><i>abc[]<br></i></b></div>", [["styleWithCSS", "false"],["bold",""],["inserttext","d"]], - ["<div><b><i>abc</i></b><i>d</i></div>", - "<div><b><i>abc</i></b><i>d<br></i></div>", - "<div><b><i>abc</i></b><i>d</i><br></div>"], + "<div><b><i>abc</i></b><i>d</i></div>", [true,true,true], {"bold":[false,true,"",false,false,""]}], ["<div><b><i>abc[]</i><br></b></div>", [["styleWithCSS", "false"],["bold",""],["inserttext","d"]], - ["<div><b><i>abc</i></b><i>d</i></div>", - "<div><b><i>abc</i></b><i>d<br></i></div>", - "<div><b><i>abc</i></b><i>d</i><br></div>"], + "<div><b><i>abc</i></b><i>d</i></div>", [true,true,true], {"bold":[false,true,"",false,false,""]}], // In this case, second line text should be keep bold style. @@ -2862,8 +2846,7 @@ {"fontsize":[false,false,"7",false,false,"4"]}], ["<span style=font-weight:bold>{}<br></span></b>", [["stylewithcss","true"],["italic",""],["insertText","a"]], - ["<span style=\"font-weight:bold; font-style:italic\">a[]<br></span>", - "<span style=\"font-weight:bold; font-style:italic\">a[]</span>"], + "<span style=\"font-weight:bold; font-style:italic\">a[]</span>", [true,true,true], {}], @@ -3244,4 +3227,27 @@ "<b><span contenteditable=\"false\">abc</span></b><b>Y</b><i>def</i>"], [true,true], {}], + +["<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>", + [["delete",""],["inserttext","B"]], + "<table><tbody><tr><td>a</td><td><b>B</b></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>", + [true,true], + {}], +["<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>", + [["delete",""],["inserttext","B"]], + "<table><tbody><tr><th>a</th><th><b>B</b></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>", + [true,true], + {}], +["<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>", + [["forwarddelete",""],["inserttext","B"]], + ["<table><tbody><tr><td>a</td><td><b>B</b></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>", + "<table><tbody><tr><td>a</td><td><br></td><td><br></td><td><b>B</b></td><td>e</td></tr></tbody></table>"], + [true,true], + {}], +["<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>", + [["forwarddelete",""],["inserttext","B"]], + ["<table><tbody><tr><th>a</th><th><b>B</b></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>", + "<table><tbody><tr><th>a</th><th><br></th><th><br></th><th><b>B</b></th><th>e</th></tr></tbody></table>"], + [true,true], + {}], ]
diff --git a/third_party/blink/web_tests/external/wpt/editing/include/editor-test-utils.js b/third_party/blink/web_tests/external/wpt/editing/include/editor-test-utils.js index b302d19..b2e5351 100644 --- a/third_party/blink/web_tests/external/wpt/editing/include/editor-test-utils.js +++ b/third_party/blink/web_tests/external/wpt/editing/include/editor-test-utils.js
@@ -109,6 +109,15 @@ ); } + sendCutShortcutKey() { + return this.sendKey( + "x", + this.window.navigator.platform.includes("Mac") + ? this.kMeta + : this.kControl + ); + } + sendPasteShortcutKey() { return this.sendKey( "v",
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/delete-chars-following-collapsible-white-space.html b/third_party/blink/web_tests/external/wpt/editing/run/delete-chars-following-collapsible-white-space.html new file mode 100644 index 0000000..7340a9e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/editing/run/delete-chars-following-collapsible-white-space.html
@@ -0,0 +1,284 @@ +<!doctype html> +<html> +<head> +<meta charset="utf-8"> +<meta name="timeout" content="long"> +<title>Test Backspace to delete following character(s) of collapsible white-space</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="../include/editor-test-utils.js"></script> +<script> +"use strict"; + +addEventListener("load", () => { + const editingHost = document.querySelector("div[contenteditable]"); + editingHost.focus(); + const utils = new EditorTestUtils(editingHost); + for (const data of [ + { + init: "<p> a[]</p>", + // The white-space before "a" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p><br></p>", + "<p> <br></p>", + ], + }, + { + init: "<p><b> a[]</b></p>", + // The white-space before "a" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p><br></p>", + "<p><b><br></b></p>", + "<p><b> <br></b></p>", + ], + }, + { + init: "<p>abc d[]</p>", + expected: [ + "<p>abc <br></p>", + "<p>abc </p>", + ], + }, + { + init: "<p><b>abc d[]</b></p>", + expected: [ + "<p><b>abc <br></b></p>", + "<p><b>abc </b></p>", + ], + }, + { + init: "<p>abc d[]<br></p>", + expected: [ + "<p>abc <br></p>", + "<p>abc </p>", + ], + }, + { + init: " a[]<p>bc</p>", + // The white-space before "a" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<br><p>bc</p>", + " <br><p>bc</p>", + ], + }, + { + init: "abc d[]<p>ef</p>", + expected: [ + "abc <br><p>ef</p>", + "abc <p>ef</p>", + ], + }, + { + init: "<b>abc d[]</b><p>ef</p>", + expected: [ + "<b>abc <br></b><p>ef</p>", + "<b>abc </b><p>ef</p>", + ], + }, + { + init: "<p>abc</p> d[]", + // The white-space before "d" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br>", + "<p>abc</p> <br>", + ], + }, + { + init: "<p>abc</p>def g[]", + expected: [ + "<p>abc</p>def <br>", + "<p>abc</p>def ", + ], + }, + { + init: "<p>abc</p><b> d[]</b>", + // The white-space before "d" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br>", + "<p>abc</p><b><br></b>", + "<p>abc</p><b> <br></b>", + ], + }, + { + init: "<p>abc</p>def g[]<p>hij</p>", + expected: [ + "<p>abc</p>def <br><p>hij</p>", + "<p>abc</p>def <br><p>hij</p>", + ], + }, + { + init: "<p>abc</p> d[]<p>efg</p>", + // The white-space before "d" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br><p>efg</p>", + "<p>abc</p> <br><p>efg</p>", + ], + }, + { + init: "<p>abc</p><b> d[]</b><p>efg</p>", + // The white-space before "d" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br><p>efg</p>", + "<p>abc</p><b><br></b><p>efg</p>", + "<p>abc</p><b> <br></b><p>efg</p>", + ], + }, + ]) { + promise_test(async () => { + utils.setupEditingHost(data.init); + await utils.sendBackspaceKey(); + if (Array.isArray(data.expected)) { + assert_in_array(editingHost.innerHTML, data.expected); + } else { + assert_equals(editingHost.innerHTML, data.expected); + } + }, `Backspace when ${data.init}`); + promise_test(async () => { + utils.setupEditingHost(data.init); + getSelection().modify("extend", "left", "character"); + await utils.sendBackspaceKey(); + if (Array.isArray(data.expected)) { + assert_in_array(editingHost.innerHTML, data.expected); + } else { + assert_equals(editingHost.innerHTML, data.expected); + } + }, `Backspace when ${data.init} after extending selection backward`); + } + const deleteWordModifier = + this.window.navigator.platform.includes("Mac") ? utils.kAlt : utils.kControl; + for (const data of [ + { + init: "<p> abc[]</p>", + // The white-space before "abc" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p><br></p>", + "<p> <br></p>", + ], + }, + { + init: "<p>abc def[]</p>", + expected: [ + "<p>abc <br></p>", + "<p>abc </p>", + ], + }, + { + init: "<p><b>abc def[]</b></p>", + expected: [ + "<p><b>abc <br></b></p>", + "<p><b>abc </b></p>", + ], + }, + { + init: "<p>abc def[]<br></p>", + expected: [ + "<p>abc <br></p>", + "<p>abc </p>", + ], + }, + { + init: " abc[]<p>def</p>", + // The white-space before "abc" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<br><p>def</p>", + " <br><p>def</p>", + ], + }, + { + init: "abc def[]<p>ghi</p>", + expected: [ + "abc <br><p>ghi</p>", + "abc <p>ghi</p>", + ], + }, + { + init: "<b>abc def[]</b><p>ghi</p>", + expected: [ + "<b>abc <br></b><p>ghi</p>", + "<b>abc </b><p>ghi</p>", + ], + }, + { + init: "<p>abc</p> def[]", + // The white-space before "def" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br>", + "<p>abc</p> <br>", + ], + }, + { + init: "<p>abc</p>def ghi[]", + expected: [ + "<p>abc</p>def <br>", + "<p>abc</p>def ", + ], + }, + { + init: "<p>abc</p><b> def[]</b>", + // The white-space before "def" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br>", + "<p>abc</p><b><br></b>", + "<p>abc</p><b> <br></b>", + ], + }, + { + init: "<p>abc</p>def ghi[]<p>jkl</p>", + expected: [ + "<p>abc</p>def <br><p>jkl</p>", + "<p>abc</p>def <br><p>jkl</p>", + ], + }, + { + init: "<p>abc</p> def[]<p>ghi</p>", + // The white-space before "def" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br><p>ghi</p>", + "<p>abc</p> <br><p>ghi</p>", + ], + }, + { + init: "<p>abc</p><b> def[]</b><p>ghi</p>", + // The white-space before "def" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br><p>ghi</p>", + "<p>abc</p><b><br></b><p>ghi</p>", + "<p>abc</p><b> <br></b><p>ghi</p>", + ], + }, + ]) { + promise_test(async () => { + utils.setupEditingHost(data.init); + await utils.sendBackspaceKey(deleteWordModifier); + if (Array.isArray(data.expected)) { + assert_in_array(editingHost.innerHTML, data.expected); + } else { + assert_equals(editingHost.innerHTML, data.expected); + } + }, `${ + deleteWordModifier == utils.kControl ? "Ctrl" : "Alt" + }+Backspace when "${data.init}"`); + } +}, {once: true}); +</script> +</head> +<body> + <div contenteditable></div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/delete-to-make-editing-host-empty.html b/third_party/blink/web_tests/external/wpt/editing/run/delete-to-make-editing-host-empty.html new file mode 100644 index 0000000..d16bb88d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/editing/run/delete-to-make-editing-host-empty.html
@@ -0,0 +1,111 @@ +<!doctype html> +<html> +<head> +<meta charset="utf-8"> +<title></title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="../include/editor-test-utils.js"></script> +<script> +"use strict"; + +addEventListener("load", () => { + const editingHost = document.querySelector("div[contenteditable]"); + const editingHostHeightWhenEmpty = editingHost.getBoundingClientRect().height; + editingHost.innerHTML = "<br>"; + const editingHostHeightWhenHasBR = editingHost.getBoundingClientRect().height; + test(() => { + assert_true( + Math.abs(editingHostHeightWhenHasBR - editingHostHeightWhenEmpty) <= 1, + `"<div contenteditable></div>" height: ${ + editingHostHeightWhenEmpty + }, "<div contenteditable><br></div>" height: ${editingHostHeightWhenHasBR}` + ); + }, `"<div contenteditable></div>" and "<div contenteditable><br></div>" should have almost same height`); + test(() => { + const editingHostHeightWhenHasChar = editingHost.getBoundingClientRect().height; + assert_true( + Math.abs(editingHostHeightWhenHasBR - editingHostHeightWhenHasChar) <= 1, + `"<div contenteditable><br></div>" height: ${ + editingHostHeightWhenHasBR + }, "<div contenteditable>a</div>" height: ${editingHostHeightWhenHasChar}` + ); + }, `"<div contenteditable><br></div>" and "<div contenteditable>a</div>" should have almost same height`); + editingHost.focus(); + const utils = new EditorTestUtils(editingHost); + promise_test(async () => { + utils.setupEditingHost("a[]"); + await utils.sendBackspaceKey(); + assert_equals(editingHost.innerHTML, "<br>", "Comparing innerHTML"); + const editingHostHeight = editingHost.getBoundingClientRect().height; + assert_equals(editingHostHeightWhenHasBR, editingHostHeight, "Comparing editing host height"); + }, `Backspace when "a[]"`); + promise_test(async () => { + utils.setupEditingHost("[]a"); + await utils.sendDeleteKey(); + assert_equals(editingHost.innerHTML, "<br>", "Comparing innerHTML"); + const editingHostHeight = editingHost.getBoundingClientRect().height; + assert_equals(editingHostHeightWhenHasBR, editingHostHeight, "Comparing editing host height"); + }, `Delete when "[]a"`); + promise_test(async () => { + utils.setupEditingHost("{a}"); + await utils.sendBackspaceKey(); + assert_equals(editingHost.innerHTML, "<br>", "Comparing innerHTML"); + const editingHostHeight = editingHost.getBoundingClientRect().height; + assert_equals(editingHostHeightWhenHasBR, editingHostHeight, "Comparing editing host height"); + }, `Backspace when "{a}"`); + promise_test(async () => { + utils.setupEditingHost("{a}"); + await utils.sendDeleteKey(); + assert_equals(editingHost.innerHTML, "<br>", "Comparing innerHTML"); + const editingHostHeight = editingHost.getBoundingClientRect().height; + assert_equals(editingHostHeightWhenHasBR, editingHostHeight, "Comparing editing host height"); + }, `Delete when "{a}"`); + promise_test(async () => { + utils.setupEditingHost("{a}"); + await utils.sendCutShortcutKey(); + assert_equals(editingHost.innerHTML, "<br>", "Comparing innerHTML"); + const editingHostHeight = editingHost.getBoundingClientRect().height; + assert_equals(editingHostHeightWhenHasBR, editingHostHeight, "Comparing editing host height"); + }, `Accel - x when "{a}"`); + promise_test(async () => { + utils.setupEditingHost("<span>a[]</span>"); + await utils.sendBackspaceKey(); + assert_equals(editingHost.innerHTML, "<br>", "Comparing innerHTML"); + const editingHostHeight = editingHost.getBoundingClientRect().height; + assert_equals(editingHostHeightWhenHasBR, editingHostHeight, "Comparing editing host height"); + }, `Backspace when "<span>a[]</span>"`); + promise_test(async () => { + utils.setupEditingHost("<span>[]a</span>"); + await utils.sendDeleteKey(); + assert_equals(editingHost.innerHTML, "<br>", "Comparing innerHTML"); + const editingHostHeight = editingHost.getBoundingClientRect().height; + assert_equals(editingHostHeightWhenHasBR, editingHostHeight, "Comparing editing host height"); + }, `Delete when "<span>[]a</span>"`); + promise_test(async () => { + utils.setupEditingHost("<span>{a}</span>"); + await utils.sendBackspaceKey(); + assert_equals(editingHost.innerHTML, "<br>", "Comparing innerHTML"); + const editingHostHeight = editingHost.getBoundingClientRect().height; + assert_equals(editingHostHeightWhenHasBR, editingHostHeight, "Comparing editing host height"); + }, `Backspace when "<span>{a}</span>"`); + promise_test(async () => { + utils.setupEditingHost("{}"); + await utils.sendBackspaceKey(); + assert_equals(editingHost.innerHTML, "", "Comparing innerHTML"); + }, `Backspace when "{}"`); + promise_test(async () => { + utils.setupEditingHost("{}"); + await utils.sendDeleteKey(); + assert_equals(editingHost.innerHTML, "", "Comparing innerHTML"); + }, `Delete when "{}"`); +}, {once: true}); +</script> +</head> +<body> + <div contenteditable></div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/delete_7001-last-expected.txt b/third_party/blink/web_tests/external/wpt/editing/run/delete_7001-last-expected.txt index 9423a915..325a834 100644 --- a/third_party/blink/web_tests/external/wpt/editing/run/delete_7001-last-expected.txt +++ b/third_party/blink/web_tests/external/wpt/editing/run/delete_7001-last-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 15 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 17 FAIL, 0 TIMEOUT, 0 NOTRUN. [FAIL] [["delete",""]] "<div style=white-space:nowrap>foo\\nb[]</div>" compare innerHTML assert_in_array: Unexpected innerHTML (after normalizing inline style) value "<div style=\\"white-space:nowrap\\">foo </div>" not in array ["<div style=\\"white-space:nowrap\\">foo\\n</div>", "<div style=\\"white-space:nowrap\\">foo<br></div>"] [FAIL] [["styleWithCSS","false"],["defaultparagraphseparator","div"],["delete",""]] "<p><font color=blue>foo</font><p><font color=brown>[]bar</font>" compare innerHTML @@ -30,5 +30,8 @@ assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<div><span style=\\"display:list-item\\">abcdef</span></div>" but got "<span style=\\"display:list-item\\">abcdef</span>" [FAIL] [["delete",""]] "<div>{abc</div><div>def</div>}" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<div><br></div>" but got "<br>" +[FAIL] [["delete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTML + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<table><tbody><tr><td>a</td><td><br></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>" but got "<table><tbody><tr><td>a</td><td><br></td><td></td><td></td><td>e</td></tr></tbody></table>" +[FAIL] [["delete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTML + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<table><tbody><tr><th>a</th><th><br></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>" but got "<table><tbody><tr><th>a</th><th><br></th><th></th><th></th><th>e</th></tr></tbody></table>" Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/forwarddelete-chars-following-collapsible-white-space.html b/third_party/blink/web_tests/external/wpt/editing/run/forwarddelete-chars-following-collapsible-white-space.html new file mode 100644 index 0000000..9cfdd98 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/editing/run/forwarddelete-chars-following-collapsible-white-space.html
@@ -0,0 +1,284 @@ +<!doctype html> +<html> +<head> +<meta charset="utf-8"> +<meta name="timeout" content="long"> +<title>Test (forward) Delete to delete following character(s) of collapsible white-space</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="../include/editor-test-utils.js"></script> +<script> +"use strict"; + +addEventListener("load", () => { + const editingHost = document.querySelector("div[contenteditable]"); + editingHost.focus(); + const utils = new EditorTestUtils(editingHost); + for (const data of [ + { + init: "<p> []a</p>", + // The white-space before "a" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p><br></p>", + "<p> <br></p>", + ], + }, + { + init: "<p><b> []a</b></p>", + // The white-space before "a" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p><br></p>", + "<p><b><br></b></p>", + "<p><b> <br></b></p>", + ], + }, + { + init: "<p>abc []d</p>", + expected: [ + "<p>abc <br></p>", + "<p>abc </p>", + ], + }, + { + init: "<p><b>abc []d</b></p>", + expected: [ + "<p><b>abc <br></b></p>", + "<p><b>abc </b></p>", + ], + }, + { + init: "<p>abc []d<br></p>", + expected: [ + "<p>abc <br></p>", + "<p>abc </p>", + ], + }, + { + init: " []a<p>bc</p>", + // The white-space before "a" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<br><p>bc</p>", + " <br><p>bc</p>", + ], + }, + { + init: "abc []d<p>ef</p>", + expected: [ + "abc <br><p>ef</p>", + "abc <p>ef</p>", + ], + }, + { + init: "<b>abc []d</b><p>ef</p>", + expected: [ + "<b>abc <br></b><p>ef</p>", + "<b>abc </b><p>ef</p>", + ], + }, + { + init: "<p>abc</p> []d", + // The white-space before "d" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br>", + "<p>abc</p> <br>", + ], + }, + { + init: "<p>abc</p>def []g", + expected: [ + "<p>abc</p>def <br>", + "<p>abc</p>def ", + ], + }, + { + init: "<p>abc</p><b> []d</b>", + // The white-space before "d" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br>", + "<p>abc</p><b><br></b>", + "<p>abc</p><b> <br></b>", + ], + }, + { + init: "<p>abc</p>def []g<p>hij</p>", + expected: [ + "<p>abc</p>def <br><p>hij</p>", + "<p>abc</p>def <br><p>hij</p>", + ], + }, + { + init: "<p>abc</p> []d<p>efg</p>", + // The white-space before "d" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br><p>efg</p>", + "<p>abc</p> <br><p>efg</p>", + ], + }, + { + init: "<p>abc</p><b> []d</b><p>efg</p>", + // The white-space before "d" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br><p>efg</p>", + "<p>abc</p><b><br></b><p>efg</p>", + "<p>abc</p><b> <br></b><p>efg</p>", + ], + }, + ]) { + promise_test(async () => { + utils.setupEditingHost(data.init); + await utils.sendDeleteKey(); + if (Array.isArray(data.expected)) { + assert_in_array(editingHost.innerHTML, data.expected); + } else { + assert_equals(editingHost.innerHTML, data.expected); + } + }, `Backspace when ${data.init}`); + promise_test(async () => { + utils.setupEditingHost(data.init); + getSelection().modify("extend", "right", "character"); + await utils.sendDeleteKey(); + if (Array.isArray(data.expected)) { + assert_in_array(editingHost.innerHTML, data.expected); + } else { + assert_equals(editingHost.innerHTML, data.expected); + } + }, `Delete when ${data.init} after extending selection forward`); + } + const deleteWordModifier = + this.window.navigator.platform.includes("Mac") ? utils.kAlt : utils.kControl; + for (const data of [ + { + init: "<p> []abc</p>", + // The white-space before "abc" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p><br></p>", + "<p> <br></p>", + ], + }, + { + init: "<p>abc []def</p>", + expected: [ + "<p>abc <br></p>", + "<p>abc </p>", + ], + }, + { + init: "<p><b>abc []def</b></p>", + expected: [ + "<p><b>abc <br></b></p>", + "<p><b>abc </b></p>", + ], + }, + { + init: "<p>abc []def<br></p>", + expected: [ + "<p>abc <br></p>", + "<p>abc </p>", + ], + }, + { + init: " []abc<p>def</p>", + // The white-space before "abc" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<br><p>def</p>", + " <br><p>def</p>", + ], + }, + { + init: "abc []def<p>ghi</p>", + expected: [ + "abc <br><p>ghi</p>", + "abc <p>ghi</p>", + ], + }, + { + init: "<b>abc []def</b><p>ghi</p>", + expected: [ + "<b>abc <br></b><p>ghi</p>", + "<b>abc </b><p>ghi</p>", + ], + }, + { + init: "<p>abc</p> []def", + // The white-space before "def" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br>", + "<p>abc</p> <br>", + ], + }, + { + init: "<p>abc</p>def []ghi", + expected: [ + "<p>abc</p>def <br>", + "<p>abc</p>def ", + ], + }, + { + init: "<p>abc</p><b> []def</b>", + // The white-space before "def" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br>", + "<p>abc</p><b><br></b>", + "<p>abc</p><b> <br></b>", + ], + }, + { + init: "<p>abc</p>def []ghi<p>jkl</p>", + expected: [ + "<p>abc</p>def <br><p>jkl</p>", + "<p>abc</p>def <br><p>jkl</p>", + ], + }, + { + init: "<p>abc</p> []def<p>ghi</p>", + // The white-space before "def" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br><p>ghi</p>", + "<p>abc</p> <br><p>ghi</p>", + ], + }, + { + init: "<p>abc</p><b> []def</b><p>ghi</p>", + // The white-space before "def" is invisible due to immediately after the + // block boundary. Therefore, it may be deleted. + expected: [ + "<p>abc</p><br><p>ghi</p>", + "<p>abc</p><b><br></b><p>ghi</p>", + "<p>abc</p><b> <br></b><p>ghi</p>", + ], + }, + ]) { + promise_test(async () => { + utils.setupEditingHost(data.init); + await utils.sendDeleteKey(deleteWordModifier); + if (Array.isArray(data.expected)) { + assert_in_array(editingHost.innerHTML, data.expected); + } else { + assert_equals(editingHost.innerHTML, data.expected); + } + }, `${ + deleteWordModifier == utils.kControl ? "Ctrl" : "Alt" + }+Delete when "${data.init}"`); + } +}, {once: true}); +</script> +</head> +<body> + <div contenteditable></div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/forwarddelete_7001-last-expected.txt b/third_party/blink/web_tests/external/wpt/editing/run/forwarddelete_7001-last-expected.txt index 50b5b3dd..58a4e879 100644 --- a/third_party/blink/web_tests/external/wpt/editing/run/forwarddelete_7001-last-expected.txt +++ b/third_party/blink/web_tests/external/wpt/editing/run/forwarddelete_7001-last-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 11 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 13 FAIL, 0 TIMEOUT, 0 NOTRUN. [FAIL] [["styleWithCSS","false"],["defaultparagraphseparator","p"],["forwarddelete",""]] "<p><font size=3>foo[]</font><p><font size=5>bar</font>" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<p><font size=\\"3\\">foo</font><font size=\\"5\\">bar</font></p>" but got "<p><font size=\\"3\\">foo</font><span style=\\"font-size:x-large\\">bar</span></p>" [FAIL] [["styleWithCSS","false"],["defaultparagraphseparator","div"],["forwarddelete",""]] "<p><font size=4>foo[]</font><p><font size=5>bar</font>" compare innerHTML @@ -22,5 +22,8 @@ assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<div><span style=\\"display:list-item\\">abcdef</span></div>" but got "<span style=\\"display:list-item\\">abcdef</span>" [FAIL] [["forwarddelete",""]] "<div>{abc</div><div>def</div>}" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<div><br></div>" but got "<br>" +[FAIL] [["forwarddelete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTML + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<table><tbody><tr><td>a</td><td><br></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>" but got "<table><tbody><tr><td>a</td><td><br></td><td></td><td></td><td>e</td></tr></tbody></table>" +[FAIL] [["forwarddelete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTML + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<table><tbody><tr><th>a</th><th><br></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>" but got "<table><tbody><tr><th>a</th><th><br></th><th></th><th></th><th>e</th></tr></tbody></table>" Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/editing/run/multitest_9001-last-expected.txt b/third_party/blink/web_tests/external/wpt/editing/run/multitest_9001-last-expected.txt index 652836f4..1299121 100644 --- a/third_party/blink/web_tests/external/wpt/editing/run/multitest_9001-last-expected.txt +++ b/third_party/blink/web_tests/external/wpt/editing/run/multitest_9001-last-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 46 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 52 FAIL, 0 TIMEOUT, 0 NOTRUN. [FAIL] [["delete",""],["inserttext","a"]] "foo<a href=http://www.google.com><font color=blue>[bar</font></a>baz]" compare innerHTML assert_equals: Unexpected innerHTML (after normalizing inline style) expected "foo<a href=\\"http://www.google.com\\">a</a>" but got "fooa" [FAIL] [["delete",""],["inserttext","a"]] "foo<font color=blue><a href=http://www.google.com>[bar</a></font>baz]" compare innerHTML @@ -52,22 +52,26 @@ assert_equals: Wrong result returned expected "" but got "true" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><b>abc[]<br></b></div>" queryCommandValue("bold") after assert_equals: Wrong result returned expected "" but got "false" +[FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><i><b>abc[]<br></b></i></div>" compare innerHTML + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<div><i><b>abc</b>d</i></div>" but got "<div><i><b>abc</b>d<br></i></div>" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><i><b>abc[]<br></b></i></div>" queryCommandValue("bold") before assert_equals: Wrong result returned expected "" but got "true" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><i><b>abc[]<br></b></i></div>" queryCommandValue("bold") after assert_equals: Wrong result returned expected "" but got "false" +[FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><i><b>abc[]</b><br></i></div>" compare innerHTML + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<div><i><b>abc</b>d</i></div>" but got "<div><i><b>abc</b>d<br></i></div>" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><i><b>abc[]</b><br></i></div>" queryCommandValue("bold") before assert_equals: Wrong result returned expected "" but got "true" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><i><b>abc[]</b><br></i></div>" queryCommandValue("bold") after assert_equals: Wrong result returned expected "" but got "false" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><b><i>abc[]<br></i></b></div>" compare innerHTML - assert_in_array: Unexpected innerHTML (after normalizing inline style) value "<div><i style=\\"\\"><b>abc</b>d<br></i></div>" not in array ["<div><b><i>abc</i></b><i>d</i></div>", "<div><b><i>abc</i></b><i>d<br></i></div>", "<div><b><i>abc</i></b><i>d</i><br></div>"] + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<div><b><i>abc</i></b><i>d</i></div>" but got "<div><i style=\\"\\"><b>abc</b>d<br></i></div>" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><b><i>abc[]<br></i></b></div>" queryCommandValue("bold") before assert_equals: Wrong result returned expected "" but got "true" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><b><i>abc[]<br></i></b></div>" queryCommandValue("bold") after assert_equals: Wrong result returned expected "" but got "false" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><b><i>abc[]</i><br></b></div>" compare innerHTML - assert_in_array: Unexpected innerHTML (after normalizing inline style) value "<div><i style=\\"\\"><b>abc</b>d</i><br></div>" not in array ["<div><b><i>abc</i></b><i>d</i></div>", "<div><b><i>abc</i></b><i>d<br></i></div>", "<div><b><i>abc</i></b><i>d</i><br></div>"] + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<div><b><i>abc</i></b><i>d</i></div>" but got "<div><i style=\\"\\"><b>abc</b>d</i><br></div>" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><b><i>abc[]</i><br></b></div>" queryCommandValue("bold") before assert_equals: Wrong result returned expected "" but got "true" [FAIL] [["styleWithCSS","false"],["bold",""],["inserttext","d"]] "<div><b><i>abc[]</i><br></b></div>" queryCommandValue("bold") after @@ -92,5 +96,12 @@ assert_in_array: Unexpected innerHTML (after normalizing inline style) value "Y<b><span contenteditable=\\"false\\">abc</span></b><i>def</i>" not in array ["<b>Y<span contenteditable=\\"false\\">abc</span></b><i>def</i>", "<b>Y</b><b><span contenteditable=\\"false\\">abc</span></b><i>def</i>"] [FAIL] [["forwarddelete",""],["inserttext","Y"]] "<b>[]X<span contenteditable=false>abc</span></b><i>def</i>" compare innerHTML assert_in_array: Unexpected innerHTML (after normalizing inline style) value "Y<b><span contenteditable=\\"false\\">abc</span></b><i>def</i>" not in array ["<b>Y<span contenteditable=\\"false\\">abc</span></b><i>def</i>", "<b>Y</b><b><span contenteditable=\\"false\\">abc</span></b><i>def</i>"] +[FAIL] [["delete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTML + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<table><tbody><tr><td>a</td><td><b>B</b></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>" but got "<table><tbody><tr><td>a</td><td><b>B</b></td><td></td><td></td><td>e</td></tr></tbody></table>" +[FAIL] [["delete",""],["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTML + assert_equals: Unexpected innerHTML (after normalizing inline style) expected "<table><tbody><tr><th>a</th><th><b>B</b></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>" but got "<table><tbody><tr><th>a</th><th>B</th><th></th><th></th><th>e</th></tr></tbody></table>" +[FAIL] [["forwarddelete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTML + assert_in_array: Unexpected innerHTML (after normalizing inline style) value "<table><tbody><tr><td>a</td><td><b>B</b></td><td></td><td></td><td>e</td></tr></tbody></table>" not in array ["<table><tbody><tr><td>a</td><td><b>B</b></td><td><br></td><td><br></td><td>e</td></tr></tbody></table>", "<table><tbody><tr><td>a</td><td><br></td><td><br></td><td><b>B</b></td><td>e</td></tr></tbody></table>"] +[FAIL] [["forwarddelete",""],["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTML + assert_in_array: Unexpected innerHTML (after normalizing inline style) value "<table><tbody><tr><th>a</th><th>B</th><th></th><th></th><th>e</th></tr></tbody></table>" not in array ["<table><tbody><tr><th>a</th><th><b>B</b></th><th><br></th><th><br></th><th>e</th></tr></tbody></table>", "<table><tbody><tr><th>a</th><th><br></th><th><br></th><th><b>B</b></th><th>e</th></tr></tbody></table>"] Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/the-select-element/customizable-select/select-events.tentative-expected.txt b/third_party/blink/web_tests/external/wpt/html/semantics/forms/the-select-element/customizable-select/select-events.tentative-expected.txt deleted file mode 100644 index 8faf6b7..0000000 --- a/third_party/blink/web_tests/external/wpt/html/semantics/forms/the-select-element/customizable-select/select-events.tentative-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -This is a testharness.js-based test. -[FAIL] Events, implicit button - assert_true: click should be cancelled expected true got false -[FAIL] Events, explicit button - assert_true: click should be cancelled expected true got false -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/forms/the-select-element/customizable-select/select-events.tentative.html b/third_party/blink/web_tests/external/wpt/html/semantics/forms/the-select-element/customizable-select/select-events.tentative.html index fcf5323..a1f98bc0 100644 --- a/third_party/blink/web_tests/external/wpt/html/semantics/forms/the-select-element/customizable-select/select-events.tentative.html +++ b/third_party/blink/web_tests/external/wpt/html/semantics/forms/the-select-element/customizable-select/select-events.tentative.html
@@ -142,14 +142,18 @@ eventList = []; // Click on an option, with preventDefault - wrapper.addEventListener('click',(e) => e.preventDefault(),{once:true}); + wrapper.addEventListener('mouseup',(e) => e.preventDefault(),{once:true}); assert_equals(select.selectedOptions[0].innerText,'two'); await test_driver.click(option1); assert_true(select.matches(':open'),'click should be cancelled'); assert_events([ 'pointerdown on option1 at select', 'pointerdown on option1 at wrapper', 'mousedown on option1 at select', 'mousedown on option1 at wrapper', - 'click on option1 at select', 'click on option1 at wrapper', + 'focusout on option2 at select', 'focusout on option2 at wrapper', + 'focusin on select at select', 'focusin on select at wrapper', + 'pointerup on option1 at select', 'pointerup on option1 at wrapper', + 'mouseup on option1 at select', 'mouseup on option1 at wrapper', + 'click on option1 at select', 'click on option1 at wrapper' ],'click option, with preventDefault'); // Click on an option, no preventDefault @@ -159,11 +163,11 @@ assert_events([ 'pointerdown on option1 at select', 'pointerdown on option1 at wrapper', 'mousedown on option1 at select', 'mousedown on option1 at wrapper', - 'click on option1 at select', 'click on option1 at wrapper', + 'pointerup on option1 at select', 'pointerup on option1 at wrapper', + 'mouseup on option1 at select', 'mouseup on option1 at wrapper', 'input on select at select', 'input on select at wrapper', 'change on select at select', 'change on select at wrapper', - 'focusout on option2 at select', 'focusout on option2 at wrapper', - 'focusin on select at select', 'focusin on select at wrapper' + 'click on option1 at select', 'click on option1 at wrapper' ],'click option, no preventDefault'); },`Events, ${wrapper.dataset.description}`); });
diff --git a/third_party/blink/web_tests/external/wpt/wasm/jsapi/jspi/notraps.any.js b/third_party/blink/web_tests/external/wpt/wasm/jsapi/jspi/notraps.any.js new file mode 100644 index 0000000..4060885f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/wasm/jsapi/jspi/notraps.any.js
@@ -0,0 +1,82 @@ +// META: global=window,dedicatedworker,jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js +// META: script=/wasm/jsapi/jspi/testharness-additions.js + +test(() => { + let builder = new WasmModuleBuilder(); + let js_tag = builder.addImportedTag("", "tag", kSig_v_r); + let try_sig_index = builder.addType(kSig_i_v); + + let promise42 = new WebAssembly.Suspending(() => Promise.resolve(42)); + let kPromise42Ref = builder.addImport("", "promise42", kSig_i_v); + + builder.addFunction("test", kSig_i_v) + .addBody([ + kExprTry, try_sig_index, + kExprCallFunction, kPromise42Ref, + kExprReturn, // If there was no trap or exception, return + kExprCatch, js_tag, + kExprI32Const, 43, + kExprReturn, + kExprEnd, + ]) + .exportFunc(); + + let instance = builder.instantiate({"": { + promise42: promise42, + tag: WebAssembly.JSTag, + }}); + + assert_equals(43, instance.exports.test()); + },"catch SuspendError"); + +promise_test(async t=>{ + let builder = new WasmModuleBuilder(); + let js_tag = builder.addImportedTag("", "tag", kSig_v_r); + let try_sig_index = builder.addType(kSig_i_v); + + let promise42 = new WebAssembly.Suspending(() => Promise.resolve(42)); + let kPromise42Ref = builder.addImport("", "promise42", kSig_i_v); + let backChnnlRef = builder.addImport("","backChnnl",kSig_i_v); + + builder.addFunction("main", kSig_i_v) + .addBody([ + kExprTry, try_sig_index, + kExprCallFunction, backChnnlRef, + kExprReturn, // If there was no trap or exception, return + kExprCatch, js_tag, + kExprI32Const, 43, + kExprReturn, + kExprEnd, + ]) + .exportFunc(); + + builder.addFunction("inner", kSig_i_v) + .addBody([ + kExprCallFunction, kPromise42Ref, + ]) + .exportFunc(); + + let backChnnl = ()=>instance.exports.inner(); + let instance = builder.instantiate({"": { + promise42: promise42, + backChnnl: backChnnl, + tag: WebAssembly.JSTag, + }}); + + wrapped_export = WebAssembly.promising(instance.exports.main); + + assert_equals(await wrapped_export(), 43); + },"throw on reentrance"); + +test(() => { + let builder = new WasmModuleBuilder(); + import_index = builder.addImport('m', 'import', kSig_v_v); + builder.addFunction("test", kSig_v_v) + .addBody([ + kExprCallFunction, import_index, + ]).exportFunc(); + let js_import = new WebAssembly.Suspending(() => Promise.resolve()); + let instance = builder.instantiate({m: {import: js_import}}); + assert_throws_js(WebAssembly.SuspendError, instance.exports.test); +},"unwrapped export");
diff --git a/third_party/blink/web_tests/external/wpt/wasm/jsapi/jspi/rejects.any.js b/third_party/blink/web_tests/external/wpt/wasm/jsapi/jspi/rejects.any.js index 44315319..55c5abc9 100644 --- a/third_party/blink/web_tests/external/wpt/wasm/jsapi/jspi/rejects.any.js +++ b/third_party/blink/web_tests/external/wpt/wasm/jsapi/jspi/rejects.any.js
@@ -145,6 +145,6 @@ }); // export1 (promising) let wrapper = WebAssembly.promising(instance.exports.export1); - promise_rejects_js(t, WebAssembly.RuntimeError, wrapper(), + promise_rejects_js(t, WebAssembly.SuspendError, wrapper(), "trying to suspend JS frames"); }, "Try to suspend JS"); \ No newline at end of file
diff --git a/third_party/blink/web_tests/platform/mac/external/wpt/editing/run/delete-chars-following-collapsible-white-space-expected.txt b/third_party/blink/web_tests/platform/mac/external/wpt/editing/run/delete-chars-following-collapsible-white-space-expected.txt new file mode 100644 index 0000000..57e0daaa --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/external/wpt/editing/run/delete-chars-following-collapsible-white-space-expected.txt
@@ -0,0 +1,14 @@ +This is a testharness.js-based test. +[FAIL] Backspace when <p>abc d[]<br></p> + assert_in_array: value "<p>abc <br></p>" not in array ["<p>abc <br></p>", "<p>abc </p>"] +[FAIL] Backspace when <p>abc d[]<br></p> after extending selection backward + assert_in_array: value "<p>abc <br></p>" not in array ["<p>abc <br></p>", "<p>abc </p>"] +[FAIL] Backspace when <p>abc</p>def g[]<p>hij</p> + assert_in_array: value "<p>abc</p>def <p>hij</p>" not in array ["<p>abc</p>def <br><p>hij</p>", "<p>abc</p>def <br><p>hij</p>"] +[FAIL] Backspace when <p>abc</p>def g[]<p>hij</p> after extending selection backward + assert_in_array: value "<p>abc</p>def <p>hij</p>" not in array ["<p>abc</p>def <br><p>hij</p>", "<p>abc</p>def <br><p>hij</p>"] +[FAIL] Alt+Backspace when "<p>abc def[]<br></p>" + assert_in_array: value "<p>abc <br></p>" not in array ["<p>abc <br></p>", "<p>abc </p>"] +[FAIL] Alt+Backspace when "<p>abc</p>def ghi[]<p>jkl</p>" + assert_in_array: value "<p>abc</p>def <p>jkl</p>" not in array ["<p>abc</p>def <br><p>jkl</p>", "<p>abc</p>def <br><p>jkl</p>"] +Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/platform/win/external/wpt/editing/run/delete-chars-following-collapsible-white-space-expected.txt b/third_party/blink/web_tests/platform/win/external/wpt/editing/run/delete-chars-following-collapsible-white-space-expected.txt new file mode 100644 index 0000000..cb0d17b --- /dev/null +++ b/third_party/blink/web_tests/platform/win/external/wpt/editing/run/delete-chars-following-collapsible-white-space-expected.txt
@@ -0,0 +1,14 @@ +This is a testharness.js-based test. +[FAIL] Backspace when <p>abc d[]<br></p> + assert_in_array: value "<p>abc <br></p>" not in array ["<p>abc <br></p>", "<p>abc </p>"] +[FAIL] Backspace when <p>abc d[]<br></p> after extending selection backward + assert_in_array: value "<p>abc <br></p>" not in array ["<p>abc <br></p>", "<p>abc </p>"] +[FAIL] Backspace when <p>abc</p>def g[]<p>hij</p> + assert_in_array: value "<p>abc</p>def <p>hij</p>" not in array ["<p>abc</p>def <br><p>hij</p>", "<p>abc</p>def <br><p>hij</p>"] +[FAIL] Backspace when <p>abc</p>def g[]<p>hij</p> after extending selection backward + assert_in_array: value "<p>abc</p>def <p>hij</p>" not in array ["<p>abc</p>def <br><p>hij</p>", "<p>abc</p>def <br><p>hij</p>"] +[FAIL] Ctrl+Backspace when "<p>abc def[]<br></p>" + assert_in_array: value "<p>abc <br></p>" not in array ["<p>abc <br></p>", "<p>abc </p>"] +[FAIL] Ctrl+Backspace when "<p>abc</p>def ghi[]<p>jkl</p>" + assert_in_array: value "<p>abc</p>def <p>jkl</p>" not in array ["<p>abc</p>def <br><p>jkl</p>", "<p>abc</p>def <br><p>jkl</p>"] +Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/platform/win/external/wpt/editing/run/forwarddelete-chars-following-collapsible-white-space-expected.txt b/third_party/blink/web_tests/platform/win/external/wpt/editing/run/forwarddelete-chars-following-collapsible-white-space-expected.txt new file mode 100644 index 0000000..81d4b9d --- /dev/null +++ b/third_party/blink/web_tests/platform/win/external/wpt/editing/run/forwarddelete-chars-following-collapsible-white-space-expected.txt
@@ -0,0 +1,14 @@ +This is a testharness.js-based test. +[FAIL] Backspace when <p>abc []d<br></p> + assert_in_array: value "<p>abc <br></p>" not in array ["<p>abc <br></p>", "<p>abc </p>"] +[FAIL] Delete when <p>abc []d<br></p> after extending selection forward + assert_in_array: value "<p>abc <br></p>" not in array ["<p>abc <br></p>", "<p>abc </p>"] +[FAIL] Backspace when <p>abc</p>def []g<p>hij</p> + assert_in_array: value "<p>abc</p>def <p>hij</p>" not in array ["<p>abc</p>def <br><p>hij</p>", "<p>abc</p>def <br><p>hij</p>"] +[FAIL] Delete when <p>abc</p>def []g<p>hij</p> after extending selection forward + assert_in_array: value "<p>abc</p>def <p>hij</p>" not in array ["<p>abc</p>def <br><p>hij</p>", "<p>abc</p>def <br><p>hij</p>"] +[FAIL] Ctrl+Delete when "<p>abc []def<br></p>" + assert_in_array: value "<p>abc <br></p>" not in array ["<p>abc <br></p>", "<p>abc </p>"] +[FAIL] Ctrl+Delete when "<p>abc</p>def []ghi<p>jkl</p>" + assert_in_array: value "<p>abc</p>def <p>jkl</p>" not in array ["<p>abc</p>def <br><p>jkl</p>", "<p>abc</p>def <br><p>jkl</p>"] +Harness: the test ran to completion.
diff --git a/third_party/boringssl/src b/third_party/boringssl/src index aefa5d2..0436a33 160000 --- a/third_party/boringssl/src +++ b/third_party/boringssl/src
@@ -1 +1 @@ -Subproject commit aefa5d24da34ef77ac797bdbe684734e5bd870f4 +Subproject commit 0436a33c875ead926d821b12075fd20d47b6bc77
diff --git a/third_party/catapult b/third_party/catapult index 60c1966..452b85e 160000 --- a/third_party/catapult +++ b/third_party/catapult
@@ -1 +1 @@ -Subproject commit 60c19667867ffdfc5af22da1b1d4822894a9b7e4 +Subproject commit 452b85ea51998d34386f3b7f8bd711ba12e5d4b7
diff --git a/third_party/dawn b/third_party/dawn index 505a2d7..2312bfa 160000 --- a/third_party/dawn +++ b/third_party/dawn
@@ -1 +1 @@ -Subproject commit 505a2d78c9a0be556aeff5f22a02f0950de86074 +Subproject commit 2312bfa66cd1437612fd16a98620c51ff6224345
diff --git a/third_party/depot_tools b/third_party/depot_tools index 9b4d1e4..bf32de3 160000 --- a/third_party/depot_tools +++ b/third_party/depot_tools
@@ -1 +1 @@ -Subproject commit 9b4d1e485d37a44e3ebe73a06d21fc79c527ec96 +Subproject commit bf32de3167aa5d172223b50b13758f2fb0bce5e5
diff --git a/third_party/devtools-frontend/src b/third_party/devtools-frontend/src index e4ab20d..62438899 160000 --- a/third_party/devtools-frontend/src +++ b/third_party/devtools-frontend/src
@@ -1 +1 @@ -Subproject commit e4ab20de944fb512b1f9fd4c576c2958997616f2 +Subproject commit 6243889956c0e82870c014587050fcec9bb453e5
diff --git a/third_party/libva-fake-driver/README.chromium b/third_party/libva-fake-driver/README.chromium index e9dc88be..0abbe3b 100644 --- a/third_party/libva-fake-driver/README.chromium +++ b/third_party/libva-fake-driver/README.chromium
@@ -1,7 +1,7 @@ Name: libva-fake-driver URL: https://chromium.googlesource.com/chromiumos/platform/libva-fake-driver/ Version: N/A -Revision: 6cc0a9bf51b520aae3cedc86c6b3c8892c38dac3 +Revision: a9bcab9cd6b15d4e3634ca44d5e5f7652c612194 License: BSD 3-Clause License File: LICENSE Shipped: no
diff --git a/third_party/libva-fake-driver/src b/third_party/libva-fake-driver/src index 6cc0a9b..a9bcab9 160000 --- a/third_party/libva-fake-driver/src +++ b/third_party/libva-fake-driver/src
@@ -1 +1 @@ -Subproject commit 6cc0a9bf51b520aae3cedc86c6b3c8892c38dac3 +Subproject commit a9bcab9cd6b15d4e3634ca44d5e5f7652c612194
diff --git a/third_party/libyuv b/third_party/libyuv index 192b8c2..86b09b2 160000 --- a/third_party/libyuv +++ b/third_party/libyuv
@@ -1 +1 @@ -Subproject commit 192b8c2238cae1c26774962eb5b61ba90cd45210 +Subproject commit 86b09b24506650f226e5f270275a01f8e7498f62
diff --git a/third_party/llvm-libc/src b/third_party/llvm-libc/src index cee48b92..a4d792e 160000 --- a/third_party/llvm-libc/src +++ b/third_party/llvm-libc/src
@@ -1 +1 @@ -Subproject commit cee48b92a7f38a42d92b0e2949c23e27a4772845 +Subproject commit a4d792ed7bbbf7380a284f8660a8a31b3bfa5585
diff --git a/third_party/openscreen/src b/third_party/openscreen/src index 5b3472f..945f58d 160000 --- a/third_party/openscreen/src +++ b/third_party/openscreen/src
@@ -1 +1 @@ -Subproject commit 5b3472f9168aa539c041e329c502627924d94f60 +Subproject commit 945f58d81079de7cbc424b0368df88d4ef018a47
diff --git a/third_party/perfetto b/third_party/perfetto index 46bab18..e463a6f 160000 --- a/third_party/perfetto +++ b/third_party/perfetto
@@ -1 +1 @@ -Subproject commit 46bab18c5264682dff25a2bd1caac99eb1dc4737 +Subproject commit e463a6f141d1f836eccecf2b63bafd1d5c1d936f
diff --git a/third_party/swiftshader b/third_party/swiftshader index c0fe4d4..23b93c7 160000 --- a/third_party/swiftshader +++ b/third_party/swiftshader
@@ -1 +1 @@ -Subproject commit c0fe4d40475b709a42d78315d3929d41d44838c8 +Subproject commit 23b93c7cfe27e205e178a135a6ea24d1dcba1068
diff --git a/third_party/webgpu-cts/src b/third_party/webgpu-cts/src index 726f4dd..be3dea4 160000 --- a/third_party/webgpu-cts/src +++ b/third_party/webgpu-cts/src
@@ -1 +1 @@ -Subproject commit 726f4dd24eac0296f4ae39f11ad28d42635b5e55 +Subproject commit be3dea4be98a7a6017259837af6a6a1a127414f2
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec index edb3e24..a1b826b 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec
@@ -1003,6 +1003,10 @@ "META": {"sizes": {"includes": [10]}}, "includes": [7320], }, + "<(SHARED_INTERMEDIATE_DIR)/components/crash/core/browser/resources/resources.grd": { + "META": {"sizes": {"includes": [5]}}, + "includes": [7330], + }, "<(SHARED_INTERMEDIATE_DIR)/components/flags_ui/resources/resources.grd": { "META": {"sizes": {"includes": [10]}}, "includes": [7340],
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index c9bf487..da69b2f 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -10937,6 +10937,7 @@ label="CSSEnvironmentVariable_SafeAreaInsetBottom_FastPath"/> <int value="5219" label="SrcSetUsedHigherDensityImageFromCache"/> <int value="5220" label="HTMLElementWritingSuggestions"/> + <int value="5221" label="CSSPseudoOpen"/> </enum> <!-- LINT.ThenChange(//third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom:WebFeature) --> @@ -16073,6 +16074,7 @@ label="IncrementLocalSurfaceIdForMainframeSameDocNavigation:disabled"/> <int value="-1724238554" label="AutofillEnableLogFormEventsToAllParsedFormTypes:enabled"/> + <int value="-1723847451" label="EnableChromeRefreshTokenBinding:enabled"/> <int value="-1723086446" label="AccessibilityMagnifyAcceleratorDialog:enabled"/> <int value="-1722208902" label="CCTModuleCustomRequestHeader:disabled"/> @@ -16229,6 +16231,7 @@ <int value="-1658154886" label="CompressionDictionaryTransportRequireKnownRootCert:disabled"/> <int value="-1657056532" label="FilesNewDirectoryTree:disabled"/> + <int value="-1656748301" label="EnableCertManagementUIV2EditCerts:disabled"/> <int value="-1656667928" label="UseSyncInvalidationsForWalletAndOffer:disabled"/> <int value="-1656179450" label="EnableOmniboxRichEntities:enabled"/> @@ -18960,6 +18963,7 @@ <int value="-569256428" label="MacAddressRandomization:enabled"/> <int value="-569208004" label="VcSegmentationInferenceBackend:disabled"/> <int value="-568448085" label="SharedClipboardReceiver:disabled"/> + <int value="-568352816" label="EnableCertManagementUIV2EditCerts:enabled"/> <int value="-567920515" label="disable-experimental-hotwording"/> <int value="-567743697" label="EnableInputNoiseCancellationUi:enabled"/> <int value="-567309305" label="FontationsFontBackend:disabled"/> @@ -25419,6 +25423,7 @@ label="enable-experimental-accessibility-switch-access-multistep-automation"/> <int value="1993258379" label="enable-icon-ntp"/> <int value="1994431722" label="MaterialDesignUserMenu:disabled"/> + <int value="1994844571" label="EnableChromeRefreshTokenBinding:disabled"/> <int value="1995045836" label="AutofillUpstreamAllowAllEmailDomains:disabled"/> <int value="1995322219" label="EmojiHandwritingVoiceInput:enabled"/>
diff --git a/tools/metrics/histograms/metadata/android/histograms.xml b/tools/metrics/histograms/metadata/android/histograms.xml index 9438f5e..a13ca76 100644 --- a/tools/metrics/histograms/metadata/android/histograms.xml +++ b/tools/metrics/histograms/metadata/android/histograms.xml
@@ -3796,6 +3796,28 @@ </summary> </histogram> +<histogram name="Android.Pdf.AssistContent.IsEnterpriseInfoCached" + enum="Boolean" expires_after="2025-05-04"> + <owner>shuyng@google.com</owner> + <owner>clank-large-form-factors@google.com</owner> + <summary> + Records whether the device enterprise info has been cached when getting it + synchronously for pdf pages. + </summary> +</histogram> + +<histogram name="Android.Pdf.AssistContent.IsWorkProfile" enum="Boolean" + expires_after="2025-05-04"> + <owner>shuyng@google.com</owner> + <owner>clank-large-form-factors@google.com</owner> + <summary> + Records whether we are running in a work profile. Recorded when + AssistContent is generated successfully for pdf pages. Used to determine the + frequency of AssistContent preparation on pdf pages; and how often the work + profile is on while preparing AssistContent for pdf pages. + </summary> +</histogram> + <histogram name="Android.Pdf.DocumentLoad" enum="Boolean" expires_after="2025-05-04"> <owner>shuyng@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/attribution_reporting/histograms.xml b/tools/metrics/histograms/metadata/attribution_reporting/histograms.xml index b635d29f..feb9d620 100644 --- a/tools/metrics/histograms/metadata/attribution_reporting/histograms.xml +++ b/tools/metrics/histograms/metadata/attribution_reporting/histograms.xml
@@ -877,13 +877,14 @@ </summary> </histogram> -<histogram name="Conversions.NumDataHostsRegisteredOnClientBounce.{Duration}" +<histogram + name="Conversions.NumDataHostsRegisteredOnClientBounce.{Interaction}.{Duration}" units="data hosts" expires_after="2025-05-11"> <owner>linnan@chromium.org</owner> <owner>measurement-api-dev+metrics@google.com</owner> <summary> We consider a non-user-initiated navigation to be a client bounce if it - navigates the page away within {Duration} without any user interaction. + navigates the page away within {Duration} without any {Interaction}. Measures how many non-navigation data hosts were registered on the page when client bounce occurred. Recorded when a primary main frame and non-same-document navigation happens and is determined to be a client @@ -895,6 +896,10 @@ <variant name="5s"/> <variant name="10s"/> </token> + <token key="Interaction"> + <variant name="UserActivation"/> + <variant name="UserInteraction"/> + </token> </histogram> <histogram name="Conversions.NumTriggerStates" units="states"
diff --git a/tools/metrics/histograms/metadata/extensions/enums.xml b/tools/metrics/histograms/metadata/extensions/enums.xml index 7823e384..ae6f830 100644 --- a/tools/metrics/histograms/metadata/extensions/enums.xml +++ b/tools/metrics/histograms/metadata/extensions/enums.xml
@@ -2783,6 +2783,7 @@ <int value="1913" label="ODFSCONFIGPRIVATE_OPENINOFFICEAPP"/> <int value="1914" label="COOKIES_GETPARTITIONKEY"/> <int value="1915" label="CONTROLLEDFRAMEINTERNAL_SETCLIENTHINTSENABLED"/> + <int value="1916" label="DEVELOPERPRIVATE_UPLOADEXTENSIONTOACCOUNT"/> </enum> <enum name="ExtensionInstallationCrxInstallError">
diff --git a/tools/metrics/histograms/metadata/facilitated_payments/histograms.xml b/tools/metrics/histograms/metadata/facilitated_payments/histograms.xml index 78b2ca5..5c28aa37 100644 --- a/tools/metrics/histograms/metadata/facilitated_payments/histograms.xml +++ b/tools/metrics/histograms/metadata/facilitated_payments/histograms.xml
@@ -256,20 +256,6 @@ </summary> </histogram> -<histogram name="FacilitatedPayments.SettingsPage.Pix.ToggleUpdated" - enum="Boolean" expires_after="2025-07-01"> - <owner>siashah@google.com</owner> - <owner>vishwasuppoor@google.com</owner> - <owner>rouslan@google.com</owner> - <owner>payments-autofill-team@google.com</owner> - <summary> - Logs true when the toggle for Pix is enabled and false otherwise. Does not - log if the toggle is not updated. [Trigger] User updates the toggle for Pix - from the facilitated payments settings page. [Frequency] Logged once per - toggle update. - </summary> -</histogram> - <histogram name="FacilitatedPayments.SettingsPage.Shown" enum="BooleanShown" expires_after="2025-07-01"> <owner>siashah@google.com</owner> @@ -285,6 +271,22 @@ </histogram> <histogram + name="FacilitatedPayments.SettingsPage.{FacilitatedPaymentsType}.ToggleUpdated" + enum="Boolean" expires_after="2025-07-01"> + <owner>siashah@google.com</owner> + <owner>vishwasuppoor@google.com</owner> + <owner>rouslan@google.com</owner> + <owner>payments-autofill-team@google.com</owner> + <summary> + Logs true when the toggle for {FacilitatedPaymentsType} is enabled and false + otherwise. Does not log if the toggle is not updated. [Trigger] User updates + the toggle for {FacilitatedPaymentsType} from the facilitated payments + settings page. [Frequency] Logged once per toggle update. + </summary> + <token key="FacilitatedPaymentsType" variants="FacilitatedPaymentsTypes"/> +</histogram> + +<histogram name="FacilitatedPayments.{FacilitatedPaymentsType}.IsApiAvailable.{Result}.Latency" units="ms" expires_after="2025-07-01"> <owner>siashah@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/network/histograms.xml b/tools/metrics/histograms/metadata/network/histograms.xml index 9a8c607..736d2ea 100644 --- a/tools/metrics/histograms/metadata/network/histograms.xml +++ b/tools/metrics/histograms/metadata/network/histograms.xml
@@ -5528,18 +5528,6 @@ </summary> </histogram> -<histogram name="NetworkService.URLLoaderFactory.UpdateLoadInfo" units="ms" - expires_after="2025-05-04"> - <owner>jam@chromium.org</owner> - <owner>cduvall@chromium.org</owner> - <summary> - The time it takes for each invocation of URLLoaderFactory.UpdateLoadInfo. - - Warning: this histogram was expired from 2023-04-30 to 2024-01-02; data may - be missing. - </summary> -</histogram> - </histograms> </histogram-configuration>
diff --git a/tools/metrics/histograms/metadata/profile/enums.xml b/tools/metrics/histograms/metadata/profile/enums.xml index c3826445..b9ce2057 100644 --- a/tools/metrics/histograms/metadata/profile/enums.xml +++ b/tools/metrics/histograms/metadata/profile/enums.xml
@@ -68,13 +68,6 @@ <int value="4" label="SuccessfullySetAsDefaultBrowser"/> </enum> -<enum name="FirstRunEntryPoint"> - <int value="0" label="Other"/> - <int value="1" label="Process startup"/> - <int value="2" label="Web app launch"/> - <int value="3" label="Web app context menu command"/> -</enum> - <enum name="FirstRunExitStatus"> <summary> Status code indicating how the first run experience was exited.
diff --git a/tools/metrics/histograms/metadata/profile/histograms.xml b/tools/metrics/histograms/metadata/profile/histograms.xml index ef859048..bfaa43d 100644 --- a/tools/metrics/histograms/metadata/profile/histograms.xml +++ b/tools/metrics/histograms/metadata/profile/histograms.xml
@@ -708,20 +708,6 @@ </summary> </histogram> -<histogram name="ProfilePicker.FirstRun.EntryPoint" enum="FirstRunEntryPoint" - expires_after="2025-04-13"> - <owner>dgn@chromium.org</owner> - <owner>for-you-fre@google.com</owner> - <summary> - Records the entry point that triggered the first run experience. This is - recorded right before the first run is shown. If the FRE is skipped, this is - never recorded. If the FRE is exited early and needs to be shown again - (relevant only on Lacros where we support showing the FRE more than once), - or if the user re-triggers the FRE while it is already shown, there would be - more than one record for that install. - </summary> -</histogram> - <histogram name="ProfilePicker.FirstRun.ExitStatus" enum="FirstRunExitStatus" expires_after="2025-06-08"> <owner>dgn@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/safe_browsing/histograms.xml b/tools/metrics/histograms/metadata/safe_browsing/histograms.xml index 73c3c40..58bf26b 100644 --- a/tools/metrics/histograms/metadata/safe_browsing/histograms.xml +++ b/tools/metrics/histograms/metadata/safe_browsing/histograms.xml
@@ -3365,6 +3365,18 @@ </summary> </histogram> +<histogram + name="SafeBrowsing.V4Store.DbThread.CheckHighConfidenceAllowlistStoreDuration" + units="ms" expires_after="2025-09-01"> + <owner>pkotwicz@chromium.org</owner> + <owner>chrome-counter-abuse-alerts@google.com</owner> + <summary> + Records how long it takes to check for matching prefixes in the high + confidence allowlist v4 store. This metric counts only the time spent on the + database thread and excludes any thread hopping time. + </summary> +</histogram> + <histogram name="SafeBrowsing.V4Store.IsStoreValid" enum="BooleanValid" expires_after="2025-06-08"> <owner>xinghuilu@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/toasts/enums.xml b/tools/metrics/histograms/metadata/toasts/enums.xml index 6ab4acfc..e8647d5 100644 --- a/tools/metrics/histograms/metadata/toasts/enums.xml +++ b/tools/metrics/histograms/metadata/toasts/enums.xml
@@ -36,6 +36,15 @@ <int value="6" label="Aborted"/> </enum> +<!-- LINT.IfChange(ToastDismissMenuEntries) --> + +<enum name="ToastDismissMenuEntries"> + <int value="0" label="Dismiss"/> + <int value="1" label="Don't show again"/> +</enum> + +<!-- LINT.ThenChange(/chrome/browser/ui/toasts/toast_metrics.h:ToastDismissMenuEntries) --> + <!-- LINT.IfChange(ToastId) --> <enum name="ToastId">
diff --git a/tools/metrics/histograms/metadata/toasts/histograms.xml b/tools/metrics/histograms/metadata/toasts/histograms.xml index a5a9a9c1..bdcf0588 100644 --- a/tools/metrics/histograms/metadata/toasts/histograms.xml +++ b/tools/metrics/histograms/metadata/toasts/histograms.xml
@@ -8,6 +8,17 @@ <histograms> +<histogram name="Toast.FailedToShow" enum="ToastId" expires_after="2025-04-13"> + <owner>agale@chromium.org</owner> + <owner>stluong@chromium.org</owner> + <owner>chrome-performance-ui-sea@google.com</owner> + <summary> + Logs the ToastId of the toast that fails to show to users. This is logged + each time a feature attempts to trigger the toast and a toast does not + appear. + </summary> +</histogram> + <histogram name="Toast.TriggeredToShow" enum="ToastId" expires_after="2025-04-13"> <owner>agale@chromium.org</owner> @@ -15,8 +26,8 @@ <owner>chrome-performance-ui-sea@google.com</owner> <summary> Logs the ToastId of the toast that is triggered to shown to users. This is - logged each time a feature attempts to trigger the toast and is used to - learn how often users see a particular toast. + logged each time a feature triggers the toast and is used to learn how often + users see a particular toast. </summary> </histogram> @@ -39,6 +50,22 @@ </token> </histogram> +<histogram name="Toast.{ToastName}.DismissMenuClicked" + enum="ToastDismissMenuEntries" expires_after="2025-04-13"> + <owner>agale@chromium.org</owner> + <owner>stluong@chromium.org</owner> + <owner>chrome-performance-ui-sea@google.com</owner> + <summary> + Logs the dismiss menu item a user clicked to dismiss the {ToastName} toast. + This is used to gain insight on which toasts a user dismisses. + </summary> + <token key="ToastName"> + <variant name="ImageCopied" summary="image copied"/> + <variant name="LinkCopied" summary="link copied"/> + <variant name="LinkToHighlightCopied" summary="link to highlight"/> + </token> +</histogram> + </histograms> </histogram-configuration>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 577db26..b1d2d66 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,8 +5,8 @@ "full_remote_path": "perfetto-luci-artifacts/76778cdf92dd1795698ce9d4742484645e06074b/linux-arm64/trace_processor_shell" }, "win": { - "hash": "8a69c509c37da2a8e74292a2c428f187fb9f8aab", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/1db82f2bcc44f15d94f4059333fa6aa662d0f12c/trace_processor_shell.exe" + "hash": "18b9333e4cceb04d207658de5897bef55837fdef", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/e463a6f141d1f836eccecf2b63bafd1d5c1d936f/trace_processor_shell.exe" }, "linux_arm": { "hash": "296798e193cbca9d79cbe293f93ab8acf194bec1", @@ -22,7 +22,7 @@ }, "linux": { "hash": "9340318998eecb80cedb4a2c3bc9da7937cfe5f2", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/46bab18c5264682dff25a2bd1caac99eb1dc4737/trace_processor_shell" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/e463a6f141d1f836eccecf2b63bafd1d5c1d936f/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/typescript/definitions/developer_private.d.ts b/tools/typescript/definitions/developer_private.d.ts index c331644..97bd567 100644 --- a/tools/typescript/definitions/developer_private.d.ts +++ b/tools/typescript/definitions/developer_private.d.ts
@@ -510,6 +510,8 @@ export function dismissMv2DeprecationPanel(): void; export function dismissMv2DeprecationNoticeForExtension( extensionId: string): Promise<void>; + export function uploadExtensionToAccount(extensionId: string): + Promise<void>; export const onItemStateChanged: ChromeEvent<(data: EventData) => void>; export const onProfileStateChanged:
diff --git a/ui/ozone/demo/ozone_demo.cc b/ui/ozone/demo/ozone_demo.cc index 437ea9c..2893017 100644 --- a/ui/ozone/demo/ozone_demo.cc +++ b/ui/ozone/demo/ozone_demo.cc
@@ -61,8 +61,7 @@ switches::kTraceToConsole)) { base::trace_event::TraceConfig trace_config = tracing::GetConfigForTraceToConsole(); - base::trace_event::TraceLog::GetInstance()->SetEnabled( - trace_config, base::trace_event::TraceLog::RECORDING_MODE); + base::trace_event::TraceLog::GetInstance()->SetEnabled(trace_config); } mojo::core::Init();
diff --git a/ui/ozone/demo/skia/skia_demo.cc b/ui/ozone/demo/skia/skia_demo.cc index 7c61596..243df12 100644 --- a/ui/ozone/demo/skia/skia_demo.cc +++ b/ui/ozone/demo/skia/skia_demo.cc
@@ -39,8 +39,7 @@ switches::kTraceToConsole)) { base::trace_event::TraceConfig trace_config = tracing::GetConfigForTraceToConsole(); - base::trace_event::TraceLog::GetInstance()->SetEnabled( - trace_config, base::trace_event::TraceLog::RECORDING_MODE); + base::trace_event::TraceLog::GetInstance()->SetEnabled(trace_config); } mojo::core::Init();
diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc index da9939fe..4bd3bbf4 100644 --- a/ui/views/controls/button/image_button.cc +++ b/ui/views/controls/button/image_button.cc
@@ -298,6 +298,7 @@ ToggleImageButton::ToggleImageButton(PressedCallback callback) : ImageButton(std::move(callback)) { UpdateAccessibleCheckedState(); + UpdateTooltipText(); } ToggleImageButton::~ToggleImageButton() = default; @@ -332,6 +333,7 @@ OnPropertyChanged(&toggled_, kPropertyEffectsPaint); UpdateAccessibleRoleIfNeeded(); UpdateAccessibleName(); + UpdateTooltipText(); } void ToggleImageButton::SetToggledImage(ButtonState image_state, @@ -368,6 +370,7 @@ return; toggled_tooltip_text_ = tooltip; UpdateAccessibleName(); + UpdateTooltipText(); OnPropertyChanged(&toggled_tooltip_text_, kPropertyEffectsNone); } @@ -418,10 +421,9 @@ //////////////////////////////////////////////////////////////////////////////// // ToggleImageButton, View overrides: -std::u16string ToggleImageButton::GetTooltipText(const gfx::Point& p) const { - return (!toggled_ || toggled_tooltip_text_.empty()) - ? Button::GetTooltipText(p) - : toggled_tooltip_text_; +void ToggleImageButton::OnSetTooltipText(const std::u16string& tooltip_text) { + ImageButton::OnSetTooltipText(tooltip_text); + untoggled_tooltip_text_ = GetCachedTooltipText(); } void ToggleImageButton::UpdateAccessibleName() { @@ -436,6 +438,23 @@ } } +void ToggleImageButton::UpdateTooltipText() { + if (toggled_ && !toggled_tooltip_text_.empty()) { + untoggled_tooltip_text_ = GetCachedTooltipText(); + SetCachedTooltipText(toggled_tooltip_text_); + } else { + SetCachedTooltipText(untoggled_tooltip_text_); + } + + UpdateAccessibleName(); + + // This corner case was needed to be handled separately. + if (GetViewAccessibility().GetCachedName() == GetCachedTooltipText() && + GetViewAccessibility().GetCachedDescription() == GetCachedTooltipText()) { + GetViewAccessibility().RemoveDescription(); + } +} + BEGIN_METADATA(ImageButton) ADD_PROPERTY_METADATA(HorizontalAlignment, ImageHorizontalAlignment) ADD_PROPERTY_METADATA(VerticalAlignment, ImageVerticalAlignment)
diff --git a/ui/views/controls/button/image_button.h b/ui/views/controls/button/image_button.h index 9a6aa94..fd84dfb 100644 --- a/ui/views/controls/button/image_button.h +++ b/ui/views/controls/button/image_button.h
@@ -177,13 +177,17 @@ const ui::ImageModel& image_model) override; // Overridden from View: - std::u16string GetTooltipText(const gfx::Point& p) const override; void OnPaintBackground(gfx::Canvas* canvas) override; + // Overridden from ImageButton: + void OnSetTooltipText(const std::u16string& tooltip_text) override; + void UpdateAccessibleRoleIfNeeded(); private: void UpdateAccessibleName(); + void UpdateTooltipText(); + // The parent class's images_ member is used for the current images, // and this array is used to hold the alternative images. // We swap between the two when toggling. @@ -201,6 +205,9 @@ // The parent class's accessibility data is used when not toggled, and this // one is used when toggled. std::u16string toggled_accessible_name_; + + // The original tooltip text before toggling. + std::u16string untoggled_tooltip_text_; }; BEGIN_VIEW_BUILDER(VIEWS_EXPORT, ToggleImageButton, ImageButton)
diff --git a/ui/views/controls/button/image_button_factory_unittest.cc b/ui/views/controls/button/image_button_factory_unittest.cc index d24abaf5..8b4eed8 100644 --- a/ui/views/controls/button/image_button_factory_unittest.cc +++ b/ui/views/controls/button/image_button_factory_unittest.cc
@@ -155,4 +155,114 @@ untoggled_text); } +TEST_F(ImageButtonFactoryWidgetTest, ToggleImageButtonTooltiptext) { + const std::u16string untoggled_text(u"untoggled_text"); + const std::u16string toggled_tooltip_text(u"toggled_tooltip_text"); + const std::u16string toggled_tooltip_empty_text(u""); + + std::unique_ptr<ToggleImageButton> toggle_image_button = + CreateVectorToggleImageButton(Button::PressedCallback()); + + toggle_image_button->SetTooltipText(untoggled_text); + toggle_image_button->SetToggledTooltipText(toggled_tooltip_text); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), untoggled_text); + + toggle_image_button->SetToggled(true); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), + toggled_tooltip_text); + + toggle_image_button->SetToggled(false); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), untoggled_text); + + toggle_image_button->SetToggled(true); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), + toggled_tooltip_text); + + toggle_image_button->SetToggledTooltipText(toggled_tooltip_empty_text); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), untoggled_text); + + toggle_image_button->SetToggledTooltipText(u"New Tooltip Text"); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), + u"New Tooltip Text"); +} + +TEST_F(ImageButtonFactoryWidgetTest, + ToggleImageButtonTooltiptextAccessibility) { + const std::u16string untoggled_text(u"untoggled_text"); + const std::u16string toggled_tooltip_text(u"toggled_tooltip_text"); + const std::u16string toggled_tooltip_empty_text(u""); + + std::unique_ptr<ToggleImageButton> toggle_image_button = + CreateVectorToggleImageButton(Button::PressedCallback()); + + toggle_image_button->SetTooltipText(untoggled_text); + toggle_image_button->SetToggledTooltipText(toggled_tooltip_text); + + ui::AXNodeData node_data; + toggle_image_button->GetViewAccessibility().GetAccessibleNodeData(&node_data); + EXPECT_EQ(node_data.GetString16Attribute(ax::mojom::StringAttribute::kName), + toggle_image_button->GetTooltipText(gfx::Point())); + EXPECT_NE( + node_data.GetString16Attribute(ax::mojom::StringAttribute::kDescription), + toggle_image_button->GetTooltipText(gfx::Point())); + + toggle_image_button->SetToggled(true); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), + toggled_tooltip_text); + + node_data = ui::AXNodeData(); + toggle_image_button->GetViewAccessibility().GetAccessibleNodeData(&node_data); + EXPECT_EQ(node_data.GetString16Attribute(ax::mojom::StringAttribute::kName), + toggle_image_button->GetTooltipText(gfx::Point())); + EXPECT_NE( + node_data.GetString16Attribute(ax::mojom::StringAttribute::kDescription), + toggle_image_button->GetTooltipText(gfx::Point())); + + toggle_image_button->SetToggled(false); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), untoggled_text); + + node_data = ui::AXNodeData(); + toggle_image_button->GetViewAccessibility().GetAccessibleNodeData(&node_data); + EXPECT_EQ(node_data.GetString16Attribute(ax::mojom::StringAttribute::kName), + toggle_image_button->GetTooltipText(gfx::Point())); + EXPECT_NE( + node_data.GetString16Attribute(ax::mojom::StringAttribute::kDescription), + toggle_image_button->GetTooltipText(gfx::Point())); + + toggle_image_button->SetToggled(true); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), + toggled_tooltip_text); + + node_data = ui::AXNodeData(); + toggle_image_button->GetViewAccessibility().GetAccessibleNodeData(&node_data); + EXPECT_EQ(node_data.GetString16Attribute(ax::mojom::StringAttribute::kName), + toggle_image_button->GetTooltipText(gfx::Point())); + EXPECT_NE( + node_data.GetString16Attribute(ax::mojom::StringAttribute::kDescription), + toggle_image_button->GetTooltipText(gfx::Point())); + + toggle_image_button->SetToggledTooltipText(toggled_tooltip_empty_text); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), untoggled_text); + + node_data = ui::AXNodeData(); + toggle_image_button->GetViewAccessibility().GetAccessibleNodeData(&node_data); + EXPECT_NE(node_data.GetString16Attribute(ax::mojom::StringAttribute::kName), + toggle_image_button->GetTooltipText(gfx::Point())); + EXPECT_EQ( + node_data.GetString16Attribute(ax::mojom::StringAttribute::kDescription), + toggle_image_button->GetTooltipText(gfx::Point())); + + toggle_image_button->SetToggledTooltipText(u"New Tooltip Text"); + EXPECT_EQ(toggle_image_button->GetTooltipText(gfx::Point()), + u"New Tooltip Text"); + + node_data = ui::AXNodeData(); + toggle_image_button->GetViewAccessibility().GetAccessibleNodeData(&node_data); + EXPECT_EQ(node_data.GetString16Attribute(ax::mojom::StringAttribute::kName), + toggle_image_button->GetTooltipText(gfx::Point())); + EXPECT_NE( + node_data.GetString16Attribute(ax::mojom::StringAttribute::kDescription), + toggle_image_button->GetTooltipText(gfx::Point())); +} + } // namespace views
diff --git a/v8 b/v8 index f4a2825..9e416be 160000 --- a/v8 +++ b/v8
@@ -1 +1 @@ -Subproject commit f4a2825cd7d8d81a9f6eeb49d22f51982b2dfee7 +Subproject commit 9e416be0f26ee77553bf4468023ebeb1aaed6773