diff --git a/DEPS b/DEPS index db1eea8fce595b..a971e152428814 100644 --- a/DEPS +++ b/DEPS @@ -247,7 +247,7 @@ vars = { # 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': '36fcf80b1f2a99fdaa46d044994dfe96a08d7362', + 'angle_revision': '8419f4fcd1ec05ffac0ac51a1ac73f343dab00f4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -314,7 +314,7 @@ vars = { # 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': '8b004bd567919de941703655d5f312465428fc0a', + 'devtools_frontend_revision': 'd692cac31ffea822377407e775750d9f6a042eba', # 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. @@ -716,7 +716,7 @@ deps = { 'packages': [ { 'package': 'chromium/rts/model/linux-amd64', - 'version': 'h4OErwvGMzWmTzk59jLdAUp9o00HkQ6vKZlwtDCstocC', + 'version': 'pOC_fgXF3UQ176xy8dq5Ue_0mDiLot4PGslfbyWcVZsC', }, ], 'dep_type': 'cipd', @@ -738,7 +738,7 @@ deps = { 'packages': [ { 'package': 'chromium/rts/model/windows-amd64', - 'version': 'K9BP5YhVbtP-iXTbJU0dbwRi9gaMI_w2x0OtulD3R_oC', + 'version': 'c47NwE87KkjD2MrTSkYBCdjdqtM-53Q3x4D55ICz5HgC', }, ], 'dep_type': 'cipd', @@ -799,7 +799,7 @@ deps = { 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': '51KZuMRReilT3sNyF1-vaB_9ciuTsRJxv8kUH1eLbDgC', + 'version': 'rjqESjGVnqj61OsILGz2zAx9aZu_63YrdoiwrUlJrHoC', }, ], 'condition': 'checkout_android', @@ -1018,7 +1018,7 @@ deps = { # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '7f13e5c5ff2def048f60931a4f09bdcc0c7c3965', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '1cad40c1e7201ae3c1273066c335771590bdce2b', 'condition': 'checkout_chromeos', }, @@ -1038,7 +1038,7 @@ deps = { }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '9e5809e98f33a5f9f9d3b69a5bd826ce8a7a5a81', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '48b35e123dff26b1ede11104316cbb7f462db4e8', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1421,7 +1421,7 @@ deps = { }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'f9abf9948a180a56a3595ec54ff9f2f5c2c9947c', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '22467673a50f5599e7d8b1f49982faf7c1bc30d9', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1582,7 +1582,7 @@ deps = { }, 'src/third_party/tflite/src': - Var('chromium_git') + '/external/github.com/tensorflow/tensorflow.git' + '@' + 'aa79adb41c2f60c81d5d46d994c061abab686bb1', + Var('chromium_git') + '/external/github.com/tensorflow/tensorflow.git' + '@' + 'dd57f5328f37a81197b0dadd052e05c9d9461b16', 'src/third_party/turbine': { 'packages': [ @@ -1642,7 +1642,7 @@ deps = { Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'c843f8d63c8c17acfbb7d48e09059a581ba779b9', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '63b97de330fe3d4775b9b4df8ad15c7593d58fc0', + Var('webrtc_git') + '/src.git' + '@' + 'd525e2d9f71f02832a8c8d2d63d47b96c16a00fe', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1700,7 +1700,7 @@ deps = { Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@3772b4e1977a26513f2da475016bd6912a1c9c65', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@b52ee54b2a18637068d39e2aa0f4d94588076891', 'condition': 'checkout_src_internal', }, @@ -1719,7 +1719,7 @@ deps = { 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': 'RcDM8Mq_LrCGiuxfQto-gkDVFbqCRy6FE8lzPeHsNEwC', + 'version': '27KUeowb-avScJevs9PyckybR1s34lIOg_CMEaolREQC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -1741,7 +1741,7 @@ deps = { 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'FchxTKMvfxSkGTLMU23cSyqvexH52wHP-zPlLYF6QqUC', + 'version': 'jZ1wDChducDMF-MWFvXLkLZpk_AWan76x5hDRvEhqLoC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', diff --git a/android_webview/browser/aw_pac_processor.cc b/android_webview/browser/aw_pac_processor.cc index 6d9708591a24f4..c9a07ff5b08f01 100644 --- a/android_webview/browser/aw_pac_processor.cc +++ b/android_webview/browser/aw_pac_processor.cc @@ -20,7 +20,6 @@ #include "base/bind.h" #include "base/logging.h" #include "base/memory/raw_ptr.h" -#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/task/thread_pool/thread_pool_instance.h" #include "base/threading/thread_restrictions.h" diff --git a/android_webview/browser/gfx/task_queue_webview.cc b/android_webview/browser/gfx/task_queue_webview.cc index e5cb6dc7040ed5..424cd9e9cc6512 100644 --- a/android_webview/browser/gfx/task_queue_webview.cc +++ b/android_webview/browser/gfx/task_queue_webview.cc @@ -12,7 +12,6 @@ #include "base/bind.h" #include "base/containers/queue.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h" #include "base/thread_annotations.h" diff --git a/android_webview/browser/metrics/aw_metrics_service_client.cc b/android_webview/browser/metrics/aw_metrics_service_client.cc index 4b174be8114189..00318a96d48722 100644 --- a/android_webview/browser/metrics/aw_metrics_service_client.cc +++ b/android_webview/browser/metrics/aw_metrics_service_client.cc @@ -17,7 +17,6 @@ #include "base/files/file_path.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/persistent_histogram_allocator.h" -#include "base/no_destructor.h" #include "base/time/time.h" #include "components/metrics/metrics_pref_names.h" #include "components/metrics/metrics_service.h" diff --git a/android_webview/nonembedded/component_updater/aw_component_update_service.cc b/android_webview/nonembedded/component_updater/aw_component_update_service.cc index 38c1e8e0f8abdb..579f4254a1fe49 100644 --- a/android_webview/nonembedded/component_updater/aw_component_update_service.cc +++ b/android_webview/nonembedded/component_updater/aw_component_update_service.cc @@ -16,6 +16,7 @@ #include "base/callback_helpers.h" #include "base/check.h" #include "base/command_line.h" +#include "base/no_destructor.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "components/component_updater/component_installer.h" diff --git a/android_webview/test/shell/src/draw_fn/allocator.cc b/android_webview/test/shell/src/draw_fn/allocator.cc index 1081d7aac518aa..4dab180b04eef8 100644 --- a/android_webview/test/shell/src/draw_fn/allocator.cc +++ b/android_webview/test/shell/src/draw_fn/allocator.cc @@ -6,6 +6,7 @@ #include "android_webview/public/browser/draw_fn.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/notreached.h" namespace draw_fn { diff --git a/ash/app_list/views/continue_section_view_unittest.cc b/ash/app_list/views/continue_section_view_unittest.cc index ff50472ae3ffbe..3d9ddba1ea119b 100644 --- a/ash/app_list/views/continue_section_view_unittest.cc +++ b/ash/app_list/views/continue_section_view_unittest.cc @@ -29,6 +29,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/events/event.h" #include "ui/events/keycodes/keyboard_codes.h" +#include "ui/views/animation/ink_drop.h" #include "ui/views/controls/textfield/textfield.h" namespace ash { @@ -726,5 +727,57 @@ TEST_P(ContinueSectionViewTest, ShowContinueSectionWhithMinimumFiles) { EXPECT_TRUE(GetContinueSectionView()->GetVisible()); } +TEST_P(ContinueSectionViewTest, TaskViewHasRippleWithMenuOpen) { + AddSearchResult("id1", AppListSearchResultType::kFileChip); + AddSearchResult("id2", AppListSearchResultType::kDriveChip); + AddSearchResult("id3", AppListSearchResultType::kDriveChip); + + EnsureLauncherShown(); + VerifyResultViewsUpdated(); + + ContinueTaskView* continue_task_view = GetResultViewAt(0); + EXPECT_EQ(continue_task_view->result()->id(), "id1"); + + GetContinueSectionView()->GetWidget()->LayoutRootViewIfNecessary(); + SimulateRightClickOrLongPressAt( + continue_task_view->GetBoundsInScreen().CenterPoint()); + EXPECT_TRUE(continue_task_view->IsMenuShowing()); + + EXPECT_EQ(views::InkDropState::ACTIVATED, + views::InkDrop::Get(continue_task_view) + ->GetInkDrop() + ->GetTargetInkDropState()); +} + +TEST_P(ContinueSectionViewTest, TaskViewHidesRippleAfterMenuCloses) { + AddSearchResult("id1", AppListSearchResultType::kFileChip); + AddSearchResult("id2", AppListSearchResultType::kDriveChip); + AddSearchResult("id3", AppListSearchResultType::kDriveChip); + + EnsureLauncherShown(); + VerifyResultViewsUpdated(); + + ContinueTaskView* continue_task_view = GetResultViewAt(0); + EXPECT_EQ(continue_task_view->result()->id(), "id1"); + + GetContinueSectionView()->GetWidget()->LayoutRootViewIfNecessary(); + SimulateRightClickOrLongPressAt( + continue_task_view->GetBoundsInScreen().CenterPoint()); + EXPECT_TRUE(continue_task_view->IsMenuShowing()); + + // Click on other task view to hide context menu. + GetContinueSectionView()->GetWidget()->LayoutRootViewIfNecessary(); + SimulateRightClickOrLongPressAt( + GetResultViewAt(2)->GetBoundsInScreen().CenterPoint()); + EXPECT_FALSE(continue_task_view->IsMenuShowing()); + + // Wait for the view to update the ink drop. + base::RunLoop().RunUntilIdle(); + + EXPECT_EQ(views::InkDropState::HIDDEN, views::InkDrop::Get(continue_task_view) + ->GetInkDrop() + ->GetTargetInkDropState()); +} + } // namespace } // namespace ash diff --git a/ash/app_list/views/continue_task_view.cc b/ash/app_list/views/continue_task_view.cc index a42e814dcc7330..48a044bbb625c9 100644 --- a/ash/app_list/views/continue_task_view.cc +++ b/ash/app_list/views/continue_task_view.cc @@ -152,6 +152,8 @@ gfx::Size ContinueTaskView::CalculatePreferredSize() const { } void ContinueTaskView::OnButtonPressed(const ui::Event& event) { + views::InkDrop::Get(this)->GetInkDrop()->AnimateToState( + views::InkDropState::ACTION_TRIGGERED); OpenResult(event.flags()); } @@ -173,12 +175,15 @@ void ContinueTaskView::OnMetadataChanged() { void ContinueTaskView::UpdateResult() { SetVisible(!!result()); + views::InkDrop::Get(this)->GetInkDrop()->AnimateToState( + views::InkDropState::HIDDEN); + CloseContextMenu(); + if (!result()) { SetIcon(gfx::ImageSkia()); title_->SetText(std::u16string()); subtitle_->SetText(std::u16string()); GetViewAccessibility().OverrideName(std::u16string()); - CloseContextMenu(); return; } @@ -195,6 +200,9 @@ void ContinueTaskView::OnResultDestroying() { } void ContinueTaskView::SetResult(SearchResult* result) { + if (result_ == result) + return; + search_result_observation_.Reset(); result_ = result; @@ -222,6 +230,8 @@ void ContinueTaskView::ShowContextMenuForViewImpl( source->GetWidget(), nullptr /*button_controller*/, source->GetBoundsInScreen(), views::MenuAnchorPosition::kBubbleTopRight, source_type); + views::InkDrop::Get(this)->GetInkDrop()->AnimateToState( + views::InkDropState::ACTIVATED); } void ContinueTaskView::ExecuteCommand(int command_id, int event_flags) { @@ -254,6 +264,11 @@ ui::SimpleMenuModel* ContinueTaskView::BuildMenuModel() { return context_menu_model_.get(); } +void ContinueTaskView::MenuClosed(ui::SimpleMenuModel* menu) { + views::InkDrop::Get(this)->GetInkDrop()->AnimateToState( + views::InkDropState::HIDDEN); +} + void ContinueTaskView::OpenResult(int event_flags) { DCHECK(result()); view_delegate_->OpenSearchResult( diff --git a/ash/app_list/views/continue_task_view.h b/ash/app_list/views/continue_task_view.h index 749255f24ffb07..737e98788e58bb 100644 --- a/ash/app_list/views/continue_task_view.h +++ b/ash/app_list/views/continue_task_view.h @@ -64,6 +64,7 @@ class ASH_EXPORT ContinueTaskView : public views::Button, // SimpleMenuModel::Delegate: void ExecuteCommand(int command_id, int event_flags) override; + void MenuClosed(ui::SimpleMenuModel* source) override; private: void SetIcon(const gfx::ImageSkia& icon); diff --git a/ash/clipboard/clipboard_nudge_controller.cc b/ash/clipboard/clipboard_nudge_controller.cc index 21a5b162c793f2..63236967c96c7b 100644 --- a/ash/clipboard/clipboard_nudge_controller.cc +++ b/ash/clipboard/clipboard_nudge_controller.cc @@ -16,7 +16,6 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" diff --git a/ash/components/arc/session/arc_vm_client_adapter.cc b/ash/components/arc/session/arc_vm_client_adapter.cc index b1ae4b46adb0d9..6f04f3ba8d02ce 100644 --- a/ash/components/arc/session/arc_vm_client_adapter.cc +++ b/ash/components/arc/session/arc_vm_client_adapter.cc @@ -37,7 +37,6 @@ #include "base/logging.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/posix/eintr_wrapper.h" #include "base/process/launch.h" #include "base/process/process_metrics.h" diff --git a/ash/components/drivefs/fake_drivefs_launcher_client.cc b/ash/components/drivefs/fake_drivefs_launcher_client.cc index 5ae590086d603f..76546cff55c86b 100644 --- a/ash/components/drivefs/fake_drivefs_launcher_client.cc +++ b/ash/components/drivefs/fake_drivefs_launcher_client.cc @@ -8,6 +8,7 @@ #include #include "base/bind.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_util.h" #include "base/system/sys_info.h" diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index ac590398e987dd..2cf5855025288e 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc @@ -1154,14 +1154,6 @@ const base::Feature kSmartLockUIRevamp{"SmartLockUIRevamp", const base::Feature kSyncSettingsCategorization{ "SyncSettingsCategorization", base::FEATURE_DISABLED_BY_DEFAULT}; -// Updates the OOBE sync consent screen -// -// NOTE: The feature will be rolled out via a client-side Finch trial, so the -// actual state will vary. TODO(https://crbug.com/1227417): Migrate config in -// chrome/browser/ash/sync/sync_consent_optional_field_trial.cc -const base::Feature kSyncConsentOptional{"SyncConsentOptional", - base::FEATURE_DISABLED_BY_DEFAULT}; - // Enables battery indicator for styluses in the palette tray const base::Feature kStylusBatteryStatus{"StylusBatteryStatus", base::FEATURE_ENABLED_BY_DEFAULT}; @@ -1822,10 +1814,6 @@ bool IsSyncSettingsCategorizationEnabled() { return base::FeatureList::IsEnabled(kSyncSettingsCategorization); } -bool IsSyncConsentOptionalEnabled() { - return base::FeatureList::IsEnabled(kSyncConsentOptional); -} - bool IsStylusBatteryStatusEnabled() { return base::FeatureList::IsEnabled(kStylusBatteryStatus); } diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index 7292e5c24a496f..b34e0828dd32f1 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h @@ -438,7 +438,6 @@ extern const base::Feature kSmartLockUIRevamp; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kSnoopingProtection; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kStylusBatteryStatus; -COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kSyncConsentOptional; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kSyncSettingsCategorization; COMPONENT_EXPORT(ASH_CONSTANTS) @@ -629,7 +628,6 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsShelfLauncherNudgeEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsShimlessRMAFlowEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSnoopingProtectionEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSyncSettingsCategorizationEnabled(); -COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSyncConsentOptionalEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsStylusBatteryStatusEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSystemChinesePhysicalTypingEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsSystemJapanesePhysicalTypingEnabled(); diff --git a/ash/drag_drop/tab_drag_drop_delegate.cc b/ash/drag_drop/tab_drag_drop_delegate.cc index 011926f1adfb4e..72a4399a67fa66 100644 --- a/ash/drag_drop/tab_drag_drop_delegate.cc +++ b/ash/drag_drop/tab_drag_drop_delegate.cc @@ -16,7 +16,6 @@ #include "ash/wm/splitview/split_view_drag_indicators.h" #include "ash/wm/splitview/split_view_utils.h" #include "ash/wm/tablet_mode/tablet_mode_browser_window_drag_session_windows_hider.h" -#include "base/no_destructor.h" #include "base/pickle.h" #include "base/strings/utf_string_conversions.h" #include "ui/base/clipboard/clipboard_format_type.h" diff --git a/ash/drag_drop/tab_drag_drop_delegate_unittest.cc b/ash/drag_drop/tab_drag_drop_delegate_unittest.cc index ad2b7ff26f3660..232e0a54182a1f 100644 --- a/ash/drag_drop/tab_drag_drop_delegate_unittest.cc +++ b/ash/drag_drop/tab_drag_drop_delegate_unittest.cc @@ -20,7 +20,6 @@ #include "ash/wm/splitview/split_view_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h" #include "base/containers/flat_map.h" -#include "base/no_destructor.h" #include "base/pickle.h" #include "base/strings/utf_string_conversions.h" #include "base/test/gmock_callback_support.h" diff --git a/ash/hud_display/ash_tracing_handler.cc b/ash/hud_display/ash_tracing_handler.cc index 06fe6d8b22131f..d865b2c132c12e 100644 --- a/ash/hud_display/ash_tracing_handler.cc +++ b/ash/hud_display/ash_tracing_handler.cc @@ -14,7 +14,6 @@ #include "base/files/file.h" #include "base/files/platform_file.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "base/threading/sequenced_task_runner_handle.h" diff --git a/ash/quick_pair/common/fast_pair/fast_pair_metrics.cc b/ash/quick_pair/common/fast_pair/fast_pair_metrics.cc index 5d67876eeeec24..ac63776b533b6f 100644 --- a/ash/quick_pair/common/fast_pair/fast_pair_metrics.cc +++ b/ash/quick_pair/common/fast_pair/fast_pair_metrics.cc @@ -25,6 +25,8 @@ const char kRetroactiveEngagementFlowMetric[] = const char kPairingMethodMetric[] = "Bluetooth.ChromeOS.FastPair.PairingMethod"; const char kRetroactivePairingResultMetric[] = "Bluetooth.ChromeOS.FastPair.RetroactivePairing.Result"; +const char kTotalGattConnectionTimeMetric[] = + "Bluetooth.ChromeOS.FastPair.TotalGattConnectionTime"; } // namespace @@ -84,5 +86,10 @@ void RecordRetroactivePairingResult(bool success) { base::UmaHistogramBoolean(kRetroactivePairingResultMetric, success); } +void RecordTotalGattConnectionTime(base::TimeDelta total_gatt_connection_time) { + base::UmaHistogramTimes(kTotalGattConnectionTimeMetric, + total_gatt_connection_time); +} + } // namespace quick_pair } // namespace ash diff --git a/ash/quick_pair/common/fast_pair/fast_pair_metrics.h b/ash/quick_pair/common/fast_pair/fast_pair_metrics.h index f59ab1ce612594..36ee1b3448a10f 100644 --- a/ash/quick_pair/common/fast_pair/fast_pair_metrics.h +++ b/ash/quick_pair/common/fast_pair/fast_pair_metrics.h @@ -73,6 +73,9 @@ void RecordPairingMethod(PairingMethod method); COMPONENT_EXPORT(QUICK_PAIR_COMMON) void RecordRetroactivePairingResult(bool success); +COMPONENT_EXPORT(QUICK_PAIR_COMMON) +void RecordTotalGattConnectionTime(base::TimeDelta total_gatt_connection_time); + } // namespace quick_pair } // namespace ash diff --git a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.cc b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.cc index 1711657ffc1a1b..d68674c8f91435 100644 --- a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.cc +++ b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.cc @@ -5,6 +5,7 @@ #include "ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.h" #include "ash/quick_pair/common/constants.h" +#include "ash/quick_pair/common/fast_pair/fast_pair_metrics.h" #include "ash/quick_pair/common/logging.h" #include "ash/quick_pair/fast_pair_handshake/fast_pair_data_encryptor.h" #include "base/memory/ptr_util.h" @@ -111,6 +112,7 @@ FastPairGattServiceClientImpl::FastPairGattServiceClientImpl( base::BindOnce(&FastPairGattServiceClientImpl::OnGattConnection, weak_ptr_factory_.GetWeakPtr()), kFastPairBluetoothUuid); + gatt_connection_start_time_ = base::TimeTicks::Now(); gatt_service_discovery_timer_.Start( FROM_HERE, kGattOperationTimeout, base::BindOnce(&FastPairGattServiceClientImpl::NotifyInitializedError, @@ -131,6 +133,8 @@ void FastPairGattServiceClientImpl::OnGattConnection( QP_LOG(VERBOSE) << "Successful creation of GATT connection to device at address:[" << device_address_ << "]."; + RecordTotalGattConnectionTime(base::TimeTicks::Now() - + gatt_connection_start_time_); gatt_connection_ = std::move(gatt_connection); } } diff --git a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.h b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.h index d739a7faf9fc9c..52d32c7692b4df 100644 --- a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.h +++ b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_impl.h @@ -16,6 +16,7 @@ #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" +#include "base/time/time.h" #include "base/timer/timer.h" #include "device/bluetooth/bluetooth_adapter.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -175,6 +176,8 @@ class FastPairGattServiceClientImpl : public FastPairGattServiceClient { std::string device_address_; bool is_initialized_ = false; + base::TimeTicks gatt_connection_start_time_; + device::BluetoothRemoteGattCharacteristic* key_based_characteristic_ = nullptr; device::BluetoothRemoteGattCharacteristic* passkey_characteristic_ = nullptr; diff --git a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_unittest.cc b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_unittest.cc index 46ee1659b1af7d..81842b062cc28d 100644 --- a/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_unittest.cc +++ b/ash/quick_pair/fast_pair_handshake/fast_pair_gatt_service_client_unittest.cc @@ -16,6 +16,7 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/test/bind.h" +#include "base/test/metrics/histogram_tester.h" #include "base/test/task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" @@ -37,6 +38,9 @@ using NotifySessionCallback = base::OnceCallback; +const char kTotalGattConnectionTime[] = + "Bluetooth.ChromeOS.FastPair.TotalGattConnectionTime"; + constexpr base::TimeDelta kConnectingTestTimeout = base::Seconds(5); // Below constants are used to construct MockBluetoothDevice for testing. @@ -490,9 +494,12 @@ class FastPairGattServiceClientTest : public testing::Test { void SetWritePasskeyTimeout() { passkey_write_timeout_ = true; } + base::HistogramTester& histogram_tester() { return histogram_tester_; } + protected: base::test::TaskEnvironment task_environment_{ base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + base::HistogramTester histogram_tester_; private: // We need temporary pointers to use for write/ready requests because we @@ -529,18 +536,29 @@ class FastPairGattServiceClientTest : public testing::Test { }; TEST_F(FastPairGattServiceClientTest, GattServiceDiscoveryTimeout) { + histogram_tester().ExpectTotalCount(kTotalGattConnectionTime, 0); SuccessfulGattConnectionSetUp(); FastForwardTimeByConnetingTimeout(); NotifyGattDiscoveryCompleteForService(); EXPECT_EQ(GetInitializedCallbackResult(), PairFailure::kGattServiceDiscoveryTimeout); EXPECT_FALSE(ServiceIsSet()); + histogram_tester().ExpectTotalCount(kTotalGattConnectionTime, 1); } TEST_F(FastPairGattServiceClientTest, FailedGattConnection) { + histogram_tester().ExpectTotalCount(kTotalGattConnectionTime, 0); FailedGattConnectionSetUp(); EXPECT_EQ(GetInitializedCallbackResult(), PairFailure::kCreateGattConnection); EXPECT_FALSE(ServiceIsSet()); + histogram_tester().ExpectTotalCount(kTotalGattConnectionTime, 0); +} + +TEST_F(FastPairGattServiceClientTest, GattConnectionSuccess) { + histogram_tester().ExpectTotalCount(kTotalGattConnectionTime, 0); + SuccessfulGattConnectionSetUp(); + NotifyGattDiscoveryCompleteForService(); + histogram_tester().ExpectTotalCount(kTotalGattConnectionTime, 1); } TEST_F(FastPairGattServiceClientTest, IgnoreNonFastPairServices) { diff --git a/ash/rotator/screen_rotation_animator.h b/ash/rotator/screen_rotation_animator.h index 57dd8d9fa0e8b0..97a8954202a2c7 100644 --- a/ash/rotator/screen_rotation_animator.h +++ b/ash/rotator/screen_rotation_animator.h @@ -18,7 +18,7 @@ namespace aura { class Window; -} // namesapce aura +} // namespace aura namespace ui { class LayerTreeOwner; diff --git a/ash/services/ime/ime_decoder.cc b/ash/services/ime/ime_decoder.cc index 777f078af397f5..2414b6bb584c62 100644 --- a/ash/services/ime/ime_decoder.cc +++ b/ash/services/ime/ime_decoder.cc @@ -9,6 +9,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/no_destructor.h" namespace chromeos { namespace ime { diff --git a/ash/webui/camera_app_ui/document_scanner_service_client.cc b/ash/webui/camera_app_ui/document_scanner_service_client.cc index 92c69a11de1702..4df61ccdecd4ed 100644 --- a/ash/webui/camera_app_ui/document_scanner_service_client.cc +++ b/ash/webui/camera_app_ui/document_scanner_service_client.cc @@ -20,25 +20,30 @@ using chromeos::machine_learning::mojom::LoadModelResult; using chromeos::machine_learning::mojom::Rotation; constexpr char kOndeviceDocumentScanner[] = "ondevice_document_scanner"; +constexpr char kMLService[] = "ml_service"; // Returns whether the `value` is set for command line switch // kOndeviceDocumentScanner. -bool DocumentScannerSwitchHasValue(const std::string& value) { +bool HasCommandLineSwitch(const std::string& key, const std::string& value) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - return command_line->HasSwitch(kOndeviceDocumentScanner) && - command_line->GetSwitchValueASCII(kOndeviceDocumentScanner) == value; + return command_line->HasSwitch(key) && + command_line->GetSwitchValueASCII(key) == value; } // Returns true if switch kOndeviceDocumentScanner is set to use_rootfs. bool IsEnabledOnRootfs() { - return DocumentScannerSwitchHasValue("use_rootfs"); + return HasCommandLineSwitch(kOndeviceDocumentScanner, "use_rootfs"); +} + +bool IsMachineLearningServiceAvailable() { + return HasCommandLineSwitch(kMLService, "enabled"); } } // namespace // static bool DocumentScannerServiceClient::IsSupported() { - return IsEnabledOnRootfs(); + return IsMachineLearningServiceAvailable() && IsEnabledOnRootfs(); } // static diff --git a/ash/webui/camera_app_ui/resources/js/animation.js b/ash/webui/camera_app_ui/resources/js/animation.ts similarity index 52% rename from ash/webui/camera_app_ui/resources/js/animation.js rename to ash/webui/camera_app_ui/resources/js/animation.ts index 509be57bbd5c69..a4f3a52f150fce 100644 --- a/ash/webui/camera_app_ui/resources/js/animation.js +++ b/ash/webui/camera_app_ui/resources/js/animation.ts @@ -5,17 +5,12 @@ import {assertInstanceof} from './assert.js'; import {AsyncJobQueue} from './async_job_queue.js'; -/** - * @type {!Map} - */ -const jobQueueMap = new Map(); +const jobQueueMap = new Map(); /** * Gets the animation job queue for the element. - * @param {!HTMLElement} el - * @return {!AsyncJobQueue} */ -function getQueueFor(el) { +function getQueueFor(el: HTMLElement): AsyncJobQueue { if (!jobQueueMap.has(el)) { jobQueueMap.set(el, new AsyncJobQueue()); } @@ -25,13 +20,9 @@ function getQueueFor(el) { /** * Gets all the animations running or pending on the element and its * pseudo-elements. - * TODO(b/176879728): Remove @suppress once we fix the getAnimations() extern - * in upstream Closure compiler. - * @suppress {checkTypes} - * @param {{el: !HTMLElement, onChild: boolean}} param - * @return {!Array} */ -function getAnimations({el, onChild}) { +function getAnimations({el, onChild}: {el: HTMLElement, onChild: boolean}): + Animation[] { return el.getAnimations({subtree: true}) .filter( (a) => onChild || @@ -39,49 +30,47 @@ function getAnimations({el, onChild}) { } /** - * @param {{el: !HTMLElement, onChild: boolean}} param |el| is the - * target element to cancel animation. |onChild| specifies whether the - * cancelled animation is applied to all subtree children, false by default. - * @return {!Promise} Promise resolved when the animation is cancelled. + * @param param |el| is the target element to cancel animation. |onChild| + * specifies whether the cancelled animation is applied to all subtree + * children, false by default. + * @return Promise resolved when the animation is cancelled. */ -async function doCancel({el, onChild}) { +async function doCancel({el, onChild}: {el: HTMLElement, onChild: boolean}): + Promise { getAnimations({el, onChild}).forEach((a) => a.cancel()); await getQueueFor(el).flush(); } /** * Cancels the running animation on the element, if any. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when the animation is cancelled. + * @return Promise resolved when the animation is cancelled. */ -export async function cancel(el) { +export async function cancel(el: HTMLElement): Promise { return doCancel({el, onChild: false}); } /** * Cancels all running animation on children of the element, if any. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when all animation is cancelled. + * @return Promise resolved when all animation is cancelled. */ -export async function cancelOnChild(el) { +export async function cancelOnChild(el: HTMLElement): Promise { return doCancel({el, onChild: true}); } /** * Animates the target element once by applying the "animate" class. If the * animation is already running, the previous one would be cancelled first. - * @param {{el: !HTMLElement, onChild: boolean}} param |el| is the - * target element to apply "animate" class. |onChild| specifies whether the - * animation is applied to all subtree children. - * @return {!Promise} Promise resolved when the animation is settled. + * @param param |el| is the target element to apply "animate" class. |onChild| + * specifies whether the animation is applied to all subtree children. + * @return Promise resolved when the animation is settled. */ -function doPlay({el, onChild}) { +function doPlay({el, onChild}: {el: HTMLElement, onChild: boolean}): + Promise { doCancel({el, onChild}); const queue = getQueueFor(el); const job = async () => { /** * Force repaint before applying the animation. - * @suppress {suspiciousCode} */ el.offsetWidth; el.classList.add('animate'); @@ -94,19 +83,17 @@ function doPlay({el, onChild}) { /** * Sets "animate" class on the element and waits for its animation settled. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when the animation is settled. + * @return Promise resolved when the animation is settled. */ -export function play(el) { +export function play(el: HTMLElement): Promise { return doPlay({el, onChild: false}); } /** * Sets "animate" class on the element and waits for its child's animation * settled. - * @param {!HTMLElement} el - * @return {!Promise} Promise resolved when the child's animation is settled. + * @return Promise resolved when the child's animation is settled. */ -export function playOnChild(el) { +export function playOnChild(el: HTMLElement): Promise { return doPlay({el, onChild: true}); } diff --git a/ash/webui/camera_app_ui/resources/js/js.gni b/ash/webui/camera_app_ui/resources/js/js.gni index c8971943ae1859..29372572234b9a 100644 --- a/ash/webui/camera_app_ui/resources/js/js.gni +++ b/ash/webui/camera_app_ui/resources/js/js.gni @@ -3,7 +3,7 @@ # found in the LICENSE file. compile_js_files = [ - "animation.js", + "animation.ts", "app_window.ts", "assert.ts", "async_job_queue.ts", @@ -56,7 +56,7 @@ compile_js_files = [ "nav.js", "new_feature_toast.js", "perf.js", - "snackbar.js", + "snackbar.ts", "sound.js", "state.js", "test_bridge.ts", diff --git a/ash/webui/camera_app_ui/resources/js/snackbar.js b/ash/webui/camera_app_ui/resources/js/snackbar.ts similarity index 73% rename from ash/webui/camera_app_ui/resources/js/snackbar.js rename to ash/webui/camera_app_ui/resources/js/snackbar.ts index 77a3872957cf9b..395baea65d4f82 100644 --- a/ash/webui/camera_app_ui/resources/js/snackbar.js +++ b/ash/webui/camera_app_ui/resources/js/snackbar.ts @@ -4,16 +4,15 @@ import * as animate from './animation.js'; import * as dom from './dom.js'; -// eslint-disable-next-line no-unused-vars import {I18nString} from './i18n_string.js'; import * as loadTimeData from './models/load_time_data.js'; /** * Shows a snackbar message. - * @param {!I18nString} label The label of the message to show. - * @param {...string} substitutions The substitutions for the label. + * @param label The label of the message to show. + * @param substitutions The substitutions for the label. */ -export function show(label, ...substitutions) { +export function show(label: I18nString, ...substitutions: string[]): void { const message = loadTimeData.getI18nMessage(label, ...substitutions); const el = dom.get('.snackbar', HTMLElement); el.textContent = ''; // Force reiterate the same message for a11y. diff --git a/ash/webui/diagnostics_ui/resources/input_list.html b/ash/webui/diagnostics_ui/resources/input_list.html index 826b0c5cc31998..d0c4740a32a41d 100644 --- a/ash/webui/diagnostics_ui/resources/input_list.html +++ b/ash/webui/diagnostics_ui/resources/input_list.html @@ -9,16 +9,22 @@
- -
[[i18n('inputCategoryKeyboard')]]
-
- -
[[i18n('inputCategoryTouchpad')]]
-
- -
[[i18n('inputCategoryTouchscreen')]]
-
+ + +
diff --git a/ash/wm/haptics_util.cc b/ash/wm/haptics_util.cc index b70c41feaa9906..df7ce04c5f1568 100644 --- a/ash/wm/haptics_util.cc +++ b/ash/wm/haptics_util.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "ash/wm/haptics_util.h" -#include "base/no_destructor.h" #include "ui/events/devices/haptic_touchpad_effects.h" #include "ui/ozone/public/input_controller.h" #include "ui/ozone/public/ozone_platform.h" diff --git a/ash/wm/overview/overview_utils.cc b/ash/wm/overview/overview_utils.cc index ecfd725d3e9f78..f56cab940aa52d 100644 --- a/ash/wm/overview/overview_utils.cc +++ b/ash/wm/overview/overview_utils.cc @@ -29,7 +29,6 @@ #include "ash/wm/window_util.h" #include "ash/wm/wm_event.h" #include "ash/wm/work_area_insets.h" -#include "base/no_destructor.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/compositor/layer.h" diff --git a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc index a05582b9078b63..a0e313c26be42d 100644 --- a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc +++ b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc @@ -21,7 +21,6 @@ #include "base/compiler_specific.h" #include "base/ignore_result.h" #include "base/memory/nonscannable_memory.h" -#include "base/no_destructor.h" #include "base/numerics/checked_math.h" #include "build/build_config.h" #include "build/chromecast_buildflags.h" diff --git a/base/allocator/partition_alloc_support.cc b/base/allocator/partition_alloc_support.cc index b111c833a414e4..74337419dfd47a 100644 --- a/base/allocator/partition_alloc_support.cc +++ b/base/allocator/partition_alloc_support.cc @@ -14,6 +14,7 @@ #include "base/check.h" #include "base/ignore_result.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "base/threading/platform_thread.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" diff --git a/base/allocator/partition_allocator/memory_reclaimer.cc b/base/allocator/partition_allocator/memory_reclaimer.cc index cc4c5bad93175e..5b609b5848df91 100644 --- a/base/allocator/partition_allocator/memory_reclaimer.cc +++ b/base/allocator/partition_allocator/memory_reclaimer.cc @@ -8,6 +8,7 @@ #include "base/allocator/partition_allocator/partition_alloc_check.h" #include "base/allocator/partition_allocator/partition_alloc_config.h" #include "base/allocator/partition_allocator/starscan/pcscan.h" +#include "base/no_destructor.h" // TODO(bikineev): Temporarily disable *Scan in MemoryReclaimer as it seems to // cause significant jank. diff --git a/base/android/task_scheduler/post_task_android.cc b/base/android/task_scheduler/post_task_android.cc index 2adcbe594499b2..0c5ecd2898e86b 100644 --- a/base/android/task_scheduler/post_task_android.cc +++ b/base/android/task_scheduler/post_task_android.cc @@ -7,7 +7,6 @@ #include "base/android/jni_string.h" #include "base/android_runtime_jni_headers/Runnable_jni.h" #include "base/base_jni_headers/PostTask_jni.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/strings/strcat.h" #include "base/task/post_task.h" diff --git a/base/debug/stack_trace_fuchsia.cc b/base/debug/stack_trace_fuchsia.cc index 7bef573845377c..a2ad5404984442 100644 --- a/base/debug/stack_trace_fuchsia.cc +++ b/base/debug/stack_trace_fuchsia.cc @@ -24,7 +24,6 @@ #include "base/cxx17_backports.h" #include "base/debug/elf_reader.h" #include "base/logging.h" -#include "base/no_destructor.h" namespace base { namespace debug { diff --git a/base/files/important_file_writer_cleaner.cc b/base/files/important_file_writer_cleaner.cc index e465e020057455..ad47e15db1c042 100644 --- a/base/files/important_file_writer_cleaner.cc +++ b/base/files/important_file_writer_cleaner.cc @@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" +#include "base/no_destructor.h" #include "base/process/process.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" diff --git a/base/metrics/dummy_histogram.cc b/base/metrics/dummy_histogram.cc index e1b89256121940..fb0da27991908b 100644 --- a/base/metrics/dummy_histogram.cc +++ b/base/metrics/dummy_histogram.cc @@ -8,6 +8,7 @@ #include "base/metrics/histogram_samples.h" #include "base/metrics/metrics_hashes.h" +#include "base/no_destructor.h" #include "base/notreached.h" #include "base/values.h" diff --git a/base/power_monitor/power_monitor.cc b/base/power_monitor/power_monitor.cc index 52b153accd6d12..658edce25e9b19 100644 --- a/base/power_monitor/power_monitor.cc +++ b/base/power_monitor/power_monitor.cc @@ -7,6 +7,7 @@ #include #include "base/logging.h" +#include "base/no_destructor.h" #include "base/power_monitor/power_monitor_source.h" #include "base/trace_event/base_tracing.h" #include "build/build_config.h" diff --git a/base/task/current_thread.cc b/base/task/current_thread.cc index 718ba706b977cd..9e033bdc45a91a 100644 --- a/base/task/current_thread.cc +++ b/base/task/current_thread.cc @@ -9,7 +9,6 @@ #include "base/message_loop/message_pump_for_io.h" #include "base/message_loop/message_pump_for_ui.h" #include "base/message_loop/message_pump_type.h" -#include "base/no_destructor.h" #include "base/task/sequence_manager/sequence_manager_impl.h" #include "base/threading/thread_local.h" #include "base/threading/thread_task_runner_handle.h" diff --git a/base/task/thread_pool/thread_pool_impl.cc b/base/task/thread_pool/thread_pool_impl.cc index 08ed8a334c11b6..44e3c7f2099e9a 100644 --- a/base/task/thread_pool/thread_pool_impl.cc +++ b/base/task/thread_pool/thread_pool_impl.cc @@ -17,7 +17,6 @@ #include "base/feature_list.h" #include "base/message_loop/message_pump_type.h" #include "base/metrics/field_trial_params.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/task/scoped_set_task_priority_for_current_thread.h" #include "base/task/task_features.h" diff --git a/base/threading/thread_local_storage.cc b/base/threading/thread_local_storage.cc index 11cee0c7f482d0..1655f04f3bde12 100644 --- a/base/threading/thread_local_storage.cc +++ b/base/threading/thread_local_storage.cc @@ -8,7 +8,6 @@ #include "base/check_op.h" #include "base/compiler_specific.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/synchronization/lock.h" #include "build/build_config.h" diff --git a/base/tracing/perfetto_task_runner.cc b/base/tracing/perfetto_task_runner.cc index 7efa4e30c85448..e952731bed2486 100644 --- a/base/tracing/perfetto_task_runner.cc +++ b/base/tracing/perfetto_task_runner.cc @@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/containers/contains.h" -#include "base/no_destructor.h" #include "base/task/common/checked_lock_impl.h" #include "base/task/common/scoped_defer_task_posting.h" #include "base/task/post_task.h" diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 7a1825e1db1db4..e45fa2c80b97c1 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -129,8 +129,8 @@ declare_args() { # TODO(gbiv): We disable optimizations by default on most platforms because # the space overhead is too great. We should use some mixture of profiles and # optimization settings to better tune the size increase. - thin_lto_enable_optimizations = - (is_chromeos_ash || is_android || is_win || is_linux) && is_official_build + thin_lto_enable_optimizations = (is_chromeos_ash || is_android || is_win || + is_linux || is_mac) && is_official_build # Initialize all local variables with a pattern. This flag will fill # uninitialized floating-point types (and 32-bit pointers) with 0xFF and the @@ -654,10 +654,11 @@ config("compiler") { if (!is_debug && use_thin_lto && is_a_target_toolchain) { assert(use_lld, "LTO is only supported with lld") - cflags += [ - "-flto=thin", - "-fsplit-lto-unit", - ] + cflags += [ "-flto=thin" ] + if (!is_mac) { + # TODO(lgrey): Enable unit splitting for Mac when supported. + cflags += [ "-fsplit-lto-unit" ] + } # Limit the size of the ThinLTO cache to the lesser of 10% of # available disk space, 40GB and 100000 files. diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index a41df193c6a2c4..3520e4288b40d3 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni @@ -74,7 +74,8 @@ declare_args() { use_thin_lto = is_cfi || (is_clang && is_official_build && chrome_pgo_phase != 1 && - (is_linux || is_win || (is_android && target_os != "chromeos") || + (is_linux || is_win || is_mac || + (is_android && target_os != "chromeos") || ((is_chromeos_ash || is_chromeos_lacros) && is_chromeos_device))) # If true, use Goma for ThinLTO code generation where applicable. diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 3aaf1d2de922c9..7ab9e4879c1f15 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1 @@ -1 +1 @@ -7.20211215.0.1 +7.20211215.1.1 diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index 1a80232775a8af..7ab9e4879c1f15 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1 @@ -1 +1 @@ -7.20211214.3.1 +7.20211215.1.1 diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 3aaf1d2de922c9..7ab9e4879c1f15 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1 @@ -1 +1 @@ -7.20211215.0.1 +7.20211215.1.1 diff --git a/cc/input/threaded_input_handler.cc b/cc/input/threaded_input_handler.cc index 9cf134a8304cb1..06b79d447e10ea 100644 --- a/cc/input/threaded_input_handler.cc +++ b/cc/input/threaded_input_handler.cc @@ -1237,6 +1237,13 @@ bool ThreadedInputHandler::IsMainThreadScrolling( return false; } +float ThreadedInputHandler::LineStep() const { + return kPixelsPerLineStep; +} + +// TODO(mehdika): There is some redundancy between this function and +// ScrollbarController::GetScrollDistanceForScrollbarPart, these two need to be +// kept in sync. gfx::Vector2dF ThreadedInputHandler::ResolveScrollGranularityToPixels( const ScrollNode& scroll_node, const gfx::Vector2dF& scroll_delta, @@ -1266,6 +1273,10 @@ gfx::Vector2dF ThreadedInputHandler::ResolveScrollGranularityToPixels( pixel_delta, scroller_size, viewport_size); } + if (granularity == ui::ScrollGranularity::kScrollByLine) { + pixel_delta.Scale(LineStep(), LineStep()); + } + return pixel_delta; } diff --git a/cc/input/threaded_input_handler.h b/cc/input/threaded_input_handler.h index e8c9d8573e8d2f..d3d9e83cc536e9 100644 --- a/cc/input/threaded_input_handler.h +++ b/cc/input/threaded_input_handler.h @@ -138,6 +138,8 @@ class CC_EXPORT ThreadedInputHandler : public InputHandler, const gfx::Point& viewport_point, bool is_direct_manipulation); + float LineStep() const; + // Resolves a delta in the given granularity for the |scroll_node| into // physical pixels to scroll. gfx::Vector2dF ResolveScrollGranularityToPixels( diff --git a/cc/paint/paint_cache.cc b/cc/paint/paint_cache.cc index b75a938d19a300..8da1afa8452f5b 100644 --- a/cc/paint/paint_cache.cc +++ b/cc/paint/paint_cache.cc @@ -6,7 +6,6 @@ #include "base/check_op.h" #include "base/containers/flat_set.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/synchronization/lock.h" diff --git a/chrome/VERSION b/chrome/VERSION index da106233dfea60..fc51c366ba7f55 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=99 MINOR=0 -BUILD=4768 +BUILD=4769 PATCH=0 diff --git a/chrome/android/features/autofill_assistant/BUILD.gn b/chrome/android/features/autofill_assistant/BUILD.gn index 47ad37d7c73bcf..714d5d6528b599 100644 --- a/chrome/android/features/autofill_assistant/BUILD.gn +++ b/chrome/android/features/autofill_assistant/BUILD.gn @@ -89,6 +89,7 @@ android_library("java") { "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantRootViewContainer.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantSnackbarFactoryChrome.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java", + "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtilChrome.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTagsForTesting.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTextUtils.java", "java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java", diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java index 2fb11e68ea268f..3ccc891dd6c689 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java @@ -35,7 +35,6 @@ import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollectUserDataCoordinator; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollectUserDataModel; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; -import org.chromium.chrome.browser.ui.TabObscuringHandler; import org.chromium.components.browser_ui.bottomsheet.BottomSheetContent; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; @@ -48,7 +47,6 @@ import org.chromium.content_public.browser.WebContents; import org.chromium.ui.base.ApplicationViewportInsetSupplier; import org.chromium.ui.util.AccessibilityUtil; -import org.chromium.ui.util.TokenHolder; /** * Coordinator responsible for the Autofill Assistant bottom bar. @@ -62,7 +60,8 @@ class AssistantBottomBarCoordinator implements AssistantPeekHeightCoordinator.De private final AssistantModel mModel; private final AssistantOverlayCoordinator mOverlayCoordinator; private final BottomSheetController mBottomSheetController; - private final TabObscuringHandler mTabObscuringHandler; + @Nullable + private final AssistantTabObscuringUtil mTabObscuringUtil; private final AssistantBottomSheetContent mContent; private final ScrollView mScrollableContent; private final AssistantRootViewContainer mRootViewContainer; @@ -101,20 +100,17 @@ class AssistantBottomBarCoordinator implements AssistantPeekHeightCoordinator.De @AssistantViewportMode private int mTargetViewportMode = AssistantViewportMode.NO_RESIZE; - /** A token held while the assistant is obscuring all tabs. */ - private int mObscuringToken; - AssistantBottomBarCoordinator(Activity activity, AssistantModel model, AssistantOverlayCoordinator overlayCoordinator, BottomSheetController controller, ApplicationViewportInsetSupplier applicationViewportInsetSupplier, - TabObscuringHandler tabObscuringHandler, + @Nullable AssistantTabObscuringUtil tabObscuringUtil, @NonNull BrowserControlsStateProvider browserControlsStateProvider, AccessibilityUtil accessibilityUtil) { mAccessibilityUtil = accessibilityUtil; mModel = model; mOverlayCoordinator = overlayCoordinator; mBottomSheetController = controller; - mTabObscuringHandler = tabObscuringHandler; + mTabObscuringUtil = tabObscuringUtil; mWindowApplicationInsetSupplier = applicationViewportInsetSupplier; mWindowApplicationInsetSupplier.addSupplier(mInsetSupplier); @@ -263,10 +259,9 @@ public void onSheetClosed(@StateChangeReason int reason) { } } else if (AssistantModel.ALLOW_TALKBACK_ON_WEBSITE == propertyKey) { if (!model.get(AssistantModel.ALLOW_TALKBACK_ON_WEBSITE)) { - mObscuringToken = tabObscuringHandler.obscureAllTabs(); + maybeObscureAllTabs(); } else { - tabObscuringHandler.unobscureAllTabs(mObscuringToken); - mObscuringToken = TokenHolder.INVALID_TOKEN; + maybeUnobscureAllTabs(); } } else if (AssistantModel.WEB_CONTENTS == propertyKey) { mWebContents = model.get(AssistantModel.WEB_CONTENTS); @@ -365,9 +360,7 @@ public void destroy() { mAccessibilityUtil.removeObserver(mAccessibilityObserver); mBottomSheetController.removeObserver(mBottomSheetObserver); - if (mObscuringToken != TokenHolder.INVALID_TOKEN) { - mTabObscuringHandler.unobscureAllTabs(mObscuringToken); - } + maybeUnobscureAllTabs(); mInfoBoxCoordinator.destroy(); mInfoBoxCoordinator = null; @@ -507,4 +500,20 @@ private void freezeBottomSheetAnimation() { } offsetController.onResult(mBottomSheetController.getCurrentOffset()); } + + private void maybeObscureAllTabs() { + if (mTabObscuringUtil == null) { + return; + } + + mTabObscuringUtil.obscureAllTabs(); + } + + private void maybeUnobscureAllTabs() { + if (mTabObscuringUtil == null) { + return; + } + + mTabObscuringUtil.unobscureAllTabs(); + } } diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java index b5868d2598e62b..b3d102d2e99917 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java @@ -17,7 +17,6 @@ import org.chromium.chrome.browser.fullscreen.BrowserControlsManager; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.browser.ui.TabObscuringHandler; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; import org.chromium.ui.base.ActivityKeyboardVisibilityDelegate; @@ -41,7 +40,7 @@ public class AssistantCoordinator { private final Supplier mCurrentTabSupplier; AssistantCoordinator(Activity activity, BottomSheetController controller, - TabObscuringHandler tabObscuringHandler, + @Nullable AssistantTabObscuringUtil tabObscuringUtil, @Nullable AssistantOverlayCoordinator overlayCoordinator, AssistantKeyboardCoordinator.Delegate keyboardCoordinatorDelegate, @NonNull ActivityKeyboardVisibilityDelegate keyboardDelegate, @NonNull View rootView, @@ -63,8 +62,8 @@ public class AssistantCoordinator { } mBottomBarCoordinator = new AssistantBottomBarCoordinator(activity, mModel, - mOverlayCoordinator, controller, applicationBottomInsetProvider, - tabObscuringHandler, browserControlsManager, accessibilityUtil); + mOverlayCoordinator, controller, applicationBottomInsetProvider, tabObscuringUtil, + browserControlsManager, accessibilityUtil); mKeyboardCoordinator = new AssistantKeyboardCoordinator(activity, keyboardDelegate, rootView, mModel, keyboardCoordinatorDelegate, controller); } diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java index 4901c649969e56..3dd4afc6353240 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java @@ -4,15 +4,33 @@ package org.chromium.chrome.browser.autofill_assistant; +import androidx.annotation.Nullable; + +import org.chromium.chrome.browser.ui.TabObscuringHandler; +import org.chromium.chrome.browser.ui.TabObscuringHandlerSupplier; import org.chromium.chrome.browser.util.ChromeAccessibilityUtil; +import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.util.AccessibilityUtil; /** - * Provides default implemtations of {@link AssistantStaticDependencies} for Chrome. + * Provides default implementations of {@link AssistantStaticDependencies} for Chrome. */ public interface AssistantStaticDependenciesChrome extends AssistantStaticDependencies { @Override default AccessibilityUtil getAccessibilityUtil() { return ChromeAccessibilityUtil.get(); } + + @Override + @Nullable + default AssistantTabObscuringUtil getTabObscuringUtilOrNull(WindowAndroid windowAndroid) { + TabObscuringHandler tabObscuringHandler = + TabObscuringHandlerSupplier.getValueOrNullFrom(windowAndroid); + assert tabObscuringHandler != null; + if (tabObscuringHandler == null) { + return null; + } + + return new AssistantTabObscuringUtilChrome(tabObscuringHandler); + } } diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtilChrome.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtilChrome.java new file mode 100644 index 00000000000000..f66f09c9d62205 --- /dev/null +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtilChrome.java @@ -0,0 +1,36 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.autofill_assistant; + +import org.chromium.chrome.browser.ui.TabObscuringHandler; +import org.chromium.ui.util.TokenHolder; +/** + * Implementation of {@link AssistantTabObscuringUtil} for Chrome. + */ +public class AssistantTabObscuringUtilChrome implements AssistantTabObscuringUtil { + private final TabObscuringHandler mTabObscuringHandler; + + /** A token held while the Autofill Assistant is obscuring all tabs. */ + private int mObscuringToken = TokenHolder.INVALID_TOKEN; + + public AssistantTabObscuringUtilChrome(TabObscuringHandler tabObscuringHandler) { + mTabObscuringHandler = tabObscuringHandler; + } + + @Override + public void obscureAllTabs() { + if (mObscuringToken == TokenHolder.INVALID_TOKEN) { + mTabObscuringHandler.obscureAllTabs(); + } + } + + @Override + public void unobscureAllTabs() { + if (mObscuringToken != TokenHolder.INVALID_TOKEN) { + mTabObscuringHandler.unobscureAllTabs(mObscuringToken); + mObscuringToken = TokenHolder.INVALID_TOKEN; + } + } +} diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java index 4af96f8a1e0635..43931e71c9d206 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java @@ -28,7 +28,6 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabUtils; -import org.chromium.chrome.browser.ui.TabObscuringHandler; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; import org.chromium.components.browser_ui.bottomsheet.BottomSheetControllerProvider; @@ -128,22 +127,24 @@ private static AutofillAssistantUiController create(ChromeActivity activity, // TODO(crbug.com/1048983): Have the params be passed in to the constructor directly rather // than obtaining them from ChromeActivity getters. - return new AutofillAssistantUiController(activity, sheetController, - activity.getTabObscuringHandler(), allowTabSwitching, nativeUiController, - dependencies, overlayCoordinator); + return new AutofillAssistantUiController(activity, sheetController, allowTabSwitching, + nativeUiController, dependencies, overlayCoordinator); } private AutofillAssistantUiController(ChromeActivity activity, BottomSheetController controller, - TabObscuringHandler tabObscuringHandler, boolean allowTabSwitching, - long nativeUiController, AssistantDependencies dependencies, + boolean allowTabSwitching, long nativeUiController, AssistantDependencies dependencies, @Nullable AssistantOverlayCoordinator overlayCoordinator) { mNativeUiController = nativeUiController; mActivity = activity; mDependencies = dependencies; Supplier rootView = activity.getCompositorViewHolderSupplier(); mSnackbarFactory = dependencies.getSnackbarFactory(); + // NOTE: Only create one instance of this unless you know what you are doing. + @Nullable + AssistantTabObscuringUtil tabObscuringUtil = + dependencies.getTabObscuringUtilOrNull(activity.getWindowAndroid()); - mCoordinator = new AssistantCoordinator(activity, controller, tabObscuringHandler, + mCoordinator = new AssistantCoordinator(activity, controller, tabObscuringUtil, overlayCoordinator, this::safeNativeOnKeyboardVisibilityChanged, activity.getWindowAndroid().getKeyboardDelegate(), rootView.get(), activity.getActivityTabProvider(), activity.getBrowserControlsManager(), diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java index a9e9d1b0ae639d..e9890ee3f1fd0d 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantAutostartTest.java @@ -28,7 +28,6 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.Collections; @@ -40,14 +39,10 @@ public class AutofillAssistantAutostartTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); /** * Launches autofill assistant with a single autostartable script. diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBackButtonIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBackButtonIntegrationTest.java index 47a74ff25e55cf..f298d368c15767 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBackButtonIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBackButtonIntegrationTest.java @@ -59,7 +59,6 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Arrays; @@ -77,13 +76,8 @@ public class AutofillAssistantBackButtonIntegrationTest { private final AutofillAssistantChromeTabTestRule mTabTestRule = new AutofillAssistantChromeTabTestRule(mTestRule, TEST_PAGE_A); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(mTabTestRule); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around(mTabTestRule); private String getURL(String page) { return mTabTestRule.getURL(page); diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java index 4ab121ec067e62..d5800fbde0e578 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantBottomsheetTest.java @@ -81,7 +81,6 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -95,14 +94,10 @@ public class AutofillAssistantBottomsheetTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule( - mTestRule, "bottomsheet_behaviour_target_website.html")); + RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( + mTestRule, "bottomsheet_behaviour_target_website.html")); private AutofillAssistantTestScript makeScriptWithActionArray( ArrayList actionsList) { diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantChromeTabIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantChromeTabIntegrationTest.java index 3033855a26c99f..f1e4d676c54f4e 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantChromeTabIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantChromeTabIntegrationTest.java @@ -66,7 +66,6 @@ import org.chromium.components.browser_ui.widget.scrim.ScrimCoordinator; import org.chromium.content_public.browser.test.util.KeyUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import org.chromium.ui.test.util.UiRestriction; import java.util.ArrayList; @@ -85,13 +84,8 @@ public class AutofillAssistantChromeTabIntegrationTest { private final AutofillAssistantChromeTabTestRule mTabTestRule = new AutofillAssistantChromeTabTestRule(mTestRule, TEST_PAGE_A); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(mTabTestRule); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around(mTabTestRule); private ScrimCoordinator mScrimCoordinator; diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java index be1b831b0b9107..cc593c9ea5aae4 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataIntegrationTest.java @@ -112,7 +112,6 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.WebContents; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -131,14 +130,9 @@ public class AutofillAssistantCollectUserDataIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule( - mTestRule, "form_target_website.html")); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( + new AutofillAssistantCustomTabTestRule(mTestRule, "form_target_website.html")); private AutofillAssistantCollectUserDataTestHelper mHelper; diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java index 855238d1376de2..eb6861dc96d21e 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java @@ -39,8 +39,6 @@ import org.chromium.chrome.browser.directactions.DirectActionReporter.Type; import org.chromium.chrome.browser.directactions.FakeDirectActionReporter; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; @@ -57,8 +55,6 @@ public class AutofillAssistantDirectActionHandlerTest { private BottomSheetController mBottomSheetController; private DirectActionHandler mHandler; private TestingAutofillAssistantModuleEntryProvider mModuleEntryProvider; - private final SharedPreferencesManager mSharedPreferencesManager = - SharedPreferencesManager.getInstance(); @Before public void setUp() throws Exception { @@ -75,10 +71,8 @@ public void setUp() throws Exception { mActivity.getCompositorViewHolderForTesting(), mActivity.getActivityTabProvider(), mModuleEntryProvider); - mSharedPreferencesManager.removeKey( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED); - mSharedPreferencesManager.removeKey( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN); + AutofillAssistantPreferencesUtil.removeOnboardingAcceptedPreference(); + AutofillAssistantPreferencesUtil.removeSkipInitScreenPreference(); } @Test diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java index 8e5fbd03eddea5..326f58d4f52da2 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacadeTest.java @@ -18,8 +18,6 @@ import org.chromium.base.Function; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -67,20 +65,16 @@ public void testEnabled() { public void proactiveHelpConditions() { Assert.assertTrue(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(false); Assert.assertFalse(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, false); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(false); Assert.assertFalse(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); Assert.assertTrue(AutofillAssistantPreferencesUtil.isProactiveHelpOn()); } diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFormActionTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFormActionTest.java index cfae9276167b3c..0b1b99daad130b 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFormActionTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFormActionTest.java @@ -81,7 +81,6 @@ import org.chromium.chrome.browser.util.ChromeAccessibilityUtil; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.test.util.TestThreadUtils; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -95,14 +94,10 @@ public class AutofillAssistantFormActionTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); /** * Creates a close-to-real example of a form action with multiple counters and choices, diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java index cafb4df948de03..779859a4788cec 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java @@ -164,7 +164,6 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Arrays; @@ -179,14 +178,10 @@ public class AutofillAssistantGenericUiTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); private AutofillAssistantCollectUserDataTestHelper mHelper; diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java index c3c02d02b280f0..609a910b85f744 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserverTest.java @@ -40,7 +40,7 @@ public void setUp() { @Test @SmallTest public void clearFirstTimeUserFlagOnAllTimeHistoryDeletion() { - AutofillAssistantPreferencesUtil.setAutofillAssistantFirstTimeTriggerScriptUser(false); + AutofillAssistantPreferencesUtil.setFirstTimeTriggerScriptUserPreference(false); when(mHistoryDeletionInfo.isTimeRangeForAllTime()).thenReturn(true); mHistoryDeletionObserver.onURLsDeleted(mHistoryDeletionInfo); @@ -51,7 +51,7 @@ public void clearFirstTimeUserFlagOnAllTimeHistoryDeletion() { @Test @SmallTest public void doesNotClearFirstTimeUserFlagOnPartialHistoryDeletion() { - AutofillAssistantPreferencesUtil.setAutofillAssistantFirstTimeTriggerScriptUser(false); + AutofillAssistantPreferencesUtil.setFirstTimeTriggerScriptUserPreference(false); when(mHistoryDeletionInfo.isTimeRangeForAllTime()).thenReturn(false); mHistoryDeletionObserver.onURLsDeleted(mHistoryDeletionInfo); diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInputActionIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInputActionIntegrationTest.java index ed35e3e0734067..ea49cec9d18613 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInputActionIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInputActionIntegrationTest.java @@ -63,7 +63,6 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.test.util.TestCallbackHelperContainer; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -84,13 +83,9 @@ public class AutofillAssistantInputActionIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( + new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); @Test @MediumTest diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInterruptIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInterruptIntegrationTest.java index 77a4fc8c6090fc..cf95f512fa876b 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInterruptIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantInterruptIntegrationTest.java @@ -82,7 +82,6 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.List; @@ -95,14 +94,10 @@ public class AutofillAssistantInterruptIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); private static final String MAIN_SCRIPT_PATH = "main_script"; private static final String INTERRUPT_SCRIPT_PATH = "interrupt_script"; diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantKeyboardIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantKeyboardIntegrationTest.java index 32b1f4df20dc4c..2d1895a6448a0d 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantKeyboardIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantKeyboardIntegrationTest.java @@ -54,7 +54,6 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -69,13 +68,9 @@ public class AutofillAssistantKeyboardIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( + new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); private void runAutofillAssistant(AutofillAssistantTestScript script) { AutofillAssistantTestService testService = diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantNavigationIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantNavigationIntegrationTest.java index 3f8a5ed867e430..d6a7ae47875114 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantNavigationIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantNavigationIntegrationTest.java @@ -47,7 +47,6 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Arrays; @@ -65,13 +64,8 @@ public class AutofillAssistantNavigationIntegrationTest { private final AutofillAssistantChromeTabTestRule mTabTestRule = new AutofillAssistantChromeTabTestRule(mTestRule, TEST_PAGE_A); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(mTabTestRule); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around(mTabTestRule); private String getURL(String page) { return mTabTestRule.getURL(page); diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayIntegrationTest.java index f5729664f6f8c5..06df15ecdd6d2c 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayIntegrationTest.java @@ -64,7 +64,6 @@ import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -77,14 +76,10 @@ public class AutofillAssistantOverlayIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule( - mTestRule, "autofill_assistant_target_website.html")); + RuleChain.outerRule(mTestRule).around(new AutofillAssistantCustomTabTestRule( + mTestRule, "autofill_assistant_target_website.html")); /** * Tests that clicking on a document element works with a showcast. diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPasswordManagerIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPasswordManagerIntegrationTest.java index 2c7f7edd5f3fe2..68cca041044d01 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPasswordManagerIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPasswordManagerIntegrationTest.java @@ -41,7 +41,6 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.TestThreadUtils; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -54,14 +53,9 @@ public class AutofillAssistantPasswordManagerIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule( - mTestRule, "form_target_website.html")); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( + new AutofillAssistantCustomTabTestRule(mTestRule, "form_target_website.html")); private WebContents getWebContents() { return mTestRule.getWebContents(); diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java index ecc2f1f2325a6b..b23d7287185059 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java @@ -84,7 +84,6 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.TestThreadUtils; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Calendar; @@ -98,14 +97,9 @@ public class AutofillAssistantPersonalDataManagerTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule( - mTestRule, "form_target_website.html")); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( + new AutofillAssistantCustomTabTestRule(mTestRule, "form_target_website.html")); private AutofillAssistantCollectUserDataTestHelper mHelper; private AutofillTestHelper mAutofillHelper; diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPromptNavigationIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPromptNavigationIntegrationTest.java index 86e2229dad650c..a08a573fcb650b 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPromptNavigationIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPromptNavigationIntegrationTest.java @@ -33,7 +33,6 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.test.util.TestThreadUtils; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -48,13 +47,9 @@ public class AutofillAssistantPromptNavigationIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( + new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); /** * Integration test for ending a prompt action when a render side navigation occurs. diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java index 9dc63badd51c30..7cfb380796c527 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTriggerScriptIntegrationTest.java @@ -62,8 +62,6 @@ import org.chromium.chrome.browser.autofill_assistant.proto.TriggerScriptConditionsProto; import org.chromium.chrome.browser.autofill_assistant.proto.TriggerScriptProto; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.signin.services.UnifiedConsentServiceBridge; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; @@ -75,7 +73,6 @@ import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TouchCommon; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Arrays; @@ -93,13 +90,8 @@ public class AutofillAssistantTriggerScriptIntegrationTest { private final AutofillAssistantChromeTabTestRule mTabTestRule = new AutofillAssistantChromeTabTestRule(mTestRule, TEST_PAGE_A); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(mTabTestRule); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around(mTabTestRule); private String getURL(String page) { return mTabTestRule.getURL(page); @@ -279,8 +271,7 @@ public void elementCondition() throws Exception { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); @@ -330,8 +321,7 @@ public void transitionToRegularScriptWithoutOnboarding() throws Exception { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, true); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(true); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); @@ -404,15 +394,13 @@ public void dontShowOnboardingIfAcceptedInDifferentTab() { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); // Simulate the user accepting the onboarding in a different tab. - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, true); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(true); ArrayList list = new ArrayList<>(); list.add(ActionProto.newBuilder() @@ -613,8 +601,7 @@ public void onScrollEnded(int scrollOffsetY, int scrollExtentY) { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); @@ -675,8 +662,7 @@ public void onScrollEnded(int scrollOffsetY, int scrollExtentY) { .build(); setupTriggerScripts(triggerScripts); AutofillAssistantPreferencesUtil.setInitialPreferences(true); - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false); + AutofillAssistantPreferencesUtil.setOnboardingAcceptedPreference(false); startAutofillAssistantOnTab(TEST_PAGE_A); waitUntilViewMatchesCondition(withText("Trigger script"), isCompletelyDisplayed()); diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTtsIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTtsIntegrationTest.java index f8f786e02cb248..d54436d8ba24a9 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTtsIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTtsIntegrationTest.java @@ -58,7 +58,6 @@ import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content.browser.accessibility.BrowserAccessibilityState; import org.chromium.content_public.browser.test.util.TestThreadUtils; -import org.chromium.ui.test.util.DisableAnimationsTestRule; import java.util.ArrayList; import java.util.Collections; @@ -74,13 +73,9 @@ public class AutofillAssistantTtsIntegrationTest { private final CustomTabActivityTestRule mTestRule = new CustomTabActivityTestRule(); - // TODO(crbug/1272997): Find out why the DisableAnimationsTestRule is necessary and remove it - // again. @Rule - public final TestRule mRulesChain = - RuleChain.outerRule(mTestRule) - .around(new DisableAnimationsTestRule(/* enableAnimation= */ true)) - .around(new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); + public final TestRule mRulesChain = RuleChain.outerRule(mTestRule).around( + new AutofillAssistantCustomTabTestRule(mTestRule, TEST_PAGE)); @Rule public MockitoRule mMockitoRule = MockitoJUnit.rule(); diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java index 971988c2984bbe..f80d580cff3c47 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java @@ -106,7 +106,8 @@ protected BottomSheetController initializeBottomSheet() { private AssistantCoordinator createAndShowAssistantCoordinator() { return TestThreadUtils.runOnUiThreadBlockingNoException(() -> { AssistantCoordinator coordinator = new AssistantCoordinator(getActivity(), - initializeBottomSheet(), getActivity().getTabObscuringHandler(), + initializeBottomSheet(), + new AssistantTabObscuringUtilChrome(getActivity().getTabObscuringHandler()), /* overlayCoordinator= */ null, /* keyboardCoordinatorDelegate= */ null, getActivity().getWindowAndroid().getKeyboardDelegate(), diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java index 9ff57c016929a2..4ce25deb9406b4 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromGsaTest.java @@ -72,7 +72,7 @@ public void setUp() { .putExtra(Browser.EXTRA_APPLICATION_ID, IntentHandler.PACKAGE_GSA)); // Enable MSBB. - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); TestThreadUtils.runOnUiThreadBlocking(() -> { UnifiedConsentServiceBridge.setUrlKeyedAnonymizedDataCollectionEnabled( AutofillAssistantUiController.getProfile(), true); @@ -135,7 +135,7 @@ private GeneratedMessageLite createDefaultTriggerScriptResponse(String statusMes withText("TriggerScript"), isDisplayed(), 2 * DEFAULT_MAX_TIME_TO_POLL); // Disabling the proactive help setting should stop the trigger script. - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(false); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(false); TestThreadUtils.runOnUiThreadBlocking( () -> AutofillAssistantTabHelper @@ -149,7 +149,7 @@ private GeneratedMessageLite createDefaultTriggerScriptResponse(String statusMes // still on a supported URL. testServiceRequestSender.setNextResponse( /* httpStatus = */ 200, createDefaultTriggerScriptResponse("TriggerScript")); - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); TestThreadUtils.runOnUiThreadBlocking( () -> AutofillAssistantTabHelper diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java index d9bba1bed65815..fa09b3c3894c48 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/InCctTriggeringFromNonGsaTest.java @@ -51,7 +51,7 @@ private void setupTriggerScripts(GetTriggerScriptsResponseProto triggerScripts) } private void enableMsbb() { - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(true); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(true); TestThreadUtils.runOnUiThreadBlocking(() -> { UnifiedConsentServiceBridge.setUrlKeyedAnonymizedDataCollectionEnabled( AutofillAssistantUiController.getProfile(), true); diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java index c02bac2dad4b2d..787d4b9b28a474 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java @@ -4,6 +4,9 @@ package org.chromium.chrome.browser.autofill_assistant; +import androidx.annotation.Nullable; + +import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.util.AccessibilityUtil; /** @@ -12,4 +15,11 @@ */ public interface AssistantStaticDependencies { AccessibilityUtil getAccessibilityUtil(); + + /** + * Returns a utility for obscuring all tabs. NOTE: Each call returns a new instance that can + * only unobscure what it obscured! + */ + @Nullable + AssistantTabObscuringUtil getTabObscuringUtilOrNull(WindowAndroid windowAndroid); } diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtil.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtil.java new file mode 100644 index 00000000000000..ab5865a29716a6 --- /dev/null +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtil.java @@ -0,0 +1,21 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.autofill_assistant; + +/** + * Interface for obscuring tabs hiding them from the accessibility tree. + */ +public interface AssistantTabObscuringUtil { + /** + * Notify the system that there is a feature obscuring all visible tabs for accessibility. Hides + * all tabs from the accessibility tree. + */ + void obscureAllTabs(); + /** + * Unobscures the content of all tabs. Note that other parts of the system might still hold the + * tabs obscured. + */ + void unobscureAllTabs(); +} diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java index baf0255fb3157a..60ff30a4427ada 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantHistoryDeletionObserver.java @@ -6,8 +6,6 @@ import org.chromium.chrome.browser.history.HistoryDeletionBridge; import org.chromium.chrome.browser.history.HistoryDeletionInfo; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; /** History deletion observer that clears autofill-assistant flags when necessary. */ public class AutofillAssistantHistoryDeletionObserver implements HistoryDeletionBridge.Observer { @@ -16,7 +14,6 @@ public void onURLsDeleted(HistoryDeletionInfo historyDeletionInfo) { if (!historyDeletionInfo.isTimeRangeForAllTime()) { return; } - SharedPreferencesManager.getInstance().removeKey( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER); + AutofillAssistantPreferencesUtil.onClearBrowserHistory(); } } diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java index 7c9f2c305a7d5b..4a59b0bf75e1ef 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferencesUtil.java @@ -4,25 +4,35 @@ package org.chromium.chrome.browser.autofill_assistant; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; +import android.content.SharedPreferences; + +import org.chromium.base.ContextUtils; /** Autofill Assistant related preferences util class. */ +// TODO(crbug.com/1069897): Use SharedPreferencesManager again. public class AutofillAssistantPreferencesUtil { + /** Whether Autofill Assistant is enabled */ + private static final String ENABLED_PREFERENCE_KEY = "autofill_assistant_switch"; + /** Whether the Autofill Assistant onboarding has been accepted. */ + private static final String ONBOARDING_ACCEPTED_PREFERENCE_KEY = + "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED"; + /** Whether the user has seen a lite-script before or is a first-time user. */ + private static final String FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY = + "Chrome.AutofillAssistant.LiteScriptFirstTimeUser"; + /** Whether proactive help is enabled. */ + private static final String PROACTIVE_HELP_PREFERENCE_KEY = + "Chrome.AutofillAssistant.ProactiveHelp"; /** - * If a user explicitly cancels a lite script >= this number, they will implicitly opt-out of - * this experience and never see a lite script again. Note: this is only temporarily in place - * until we have a better and more user-friendly solution, see crbug.com/1110887. + * @Deprecated preference indicating whether "do not show again" was checked in the autofill + * assistant onboarding */ - private static final int LITE_SCRIPT_MAX_NUM_CANCELED_TO_OPT_OUT = 2; - - // Avoid instantiation by accident. - private AutofillAssistantPreferencesUtil() {} + @Deprecated + private static final String SKIP_INIT_SCREEN_PREFERENCE_KEY = + "AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN"; /** Checks whether the Autofill Assistant switch preference in settings is on. */ static boolean isAutofillAssistantSwitchOn() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true); + return getAssistantEnabledPreference(true); } /** Checks whether proactive help is enabled. */ @@ -40,70 +50,15 @@ private static boolean isProactiveHelpSwitchOn() { return false; } - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, true); - } - - /** Enables or disables the proactive help setting. */ - public static void setProactiveHelpSwitch(boolean enabled) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, enabled); - } - - /** Returns whether the user has seen a trigger script before or not. */ - public static boolean isAutofillAssistantFirstTimeTriggerScriptUser() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER, true); - } - - /** Marks a user as having seen a trigger script at least once before. */ - public static void setAutofillAssistantFirstTimeTriggerScriptUser(boolean firstTimeUser) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER, firstTimeUser); - } - - /** Returns the number of times a user has explicitly canceled a lite script. */ - private static int getAutofillAssistantNumberOfLiteScriptsCanceled() { - return SharedPreferencesManager.getInstance().readInt( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED, 0); - } - - /** - * Returns whether the user has explicitly canceled the lite script at least {@code - * LITE_SCRIPT_MAX_NUM_CANCELED_TO_OPT_OUT} times. - */ - public static boolean isAutofillAssistantLiteScriptCancelThresholdReached() { - return getAutofillAssistantNumberOfLiteScriptsCanceled() - >= LITE_SCRIPT_MAX_NUM_CANCELED_TO_OPT_OUT; - } - - /** Increments the number of times a user has explicitly canceled a lite script. */ - public static void incrementAutofillAssistantNumberOfLiteScriptsCanceled() { - int numCanceled = getAutofillAssistantNumberOfLiteScriptsCanceled() + 1; - SharedPreferencesManager sharedPreferencesManager = SharedPreferencesManager.getInstance(); - sharedPreferencesManager.writeInt( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED, - numCanceled); - if (isAutofillAssistantLiteScriptCancelThresholdReached() - && !sharedPreferencesManager.contains( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED)) { - // Disable the flag, such that users will not see the lite script again. This will also - // create the setting in the Chrome settings, if it was not present before, which will - // allow users to opt back in. - sharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); - } + return getProactiveHelpPreference(true); } /** Checks whether the Autofill Assistant onboarding has been accepted. */ public static boolean isAutofillOnboardingAccepted() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, false) - || + return getOnboardingAcceptedPreference(false) || /* Legacy treatment: users of earlier versions should not have to see the onboarding again if they checked the `do not show again' checkbox*/ - SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN, false); + getSkipInitScreenPreference(false); } /** Checks whether the Autofill Assistant onboarding screen should be shown. */ @@ -121,10 +76,86 @@ public static boolean getShowOnboarding() { */ public static void setInitialPreferences(boolean accept) { if (accept) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, accept); + setAssistantEnabledPreference(accept); } - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, accept); + setOnboardingAcceptedPreference(accept); + } + + public static boolean getAssistantEnabledPreference(boolean defaultValue) { + return readBoolean(ENABLED_PREFERENCE_KEY, defaultValue); + } + + public static void setAssistantEnabledPreference(boolean value) { + writeBoolean(ENABLED_PREFERENCE_KEY, value); + } + + public static boolean containsAssistantEnabledPreference() { + return contains(ENABLED_PREFERENCE_KEY); + } + + /* package */ static boolean getOnboardingAcceptedPreference(boolean defaultValue) { + return readBoolean(ONBOARDING_ACCEPTED_PREFERENCE_KEY, defaultValue); + } + + /* package */ static void setOnboardingAcceptedPreference(boolean value) { + writeBoolean(ONBOARDING_ACCEPTED_PREFERENCE_KEY, value); } + + /* package */ static void removeOnboardingAcceptedPreference() { + remove(ONBOARDING_ACCEPTED_PREFERENCE_KEY); + } + + /** Returns whether the user has seen a trigger script before or not. */ + /* package */ static boolean isAutofillAssistantFirstTimeTriggerScriptUser() { + return readBoolean(FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY, true); + } + + /** Marks a user as having seen a trigger script at least once before. */ + /* package */ static void setFirstTimeTriggerScriptUserPreference(boolean firstTimeUser) { + writeBoolean(FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY, firstTimeUser); + } + + /* package */ static void onClearBrowserHistory() { + remove(FIRST_TIME_LITE_SCRIPT_USER_PREFERENCE_KEY); + } + + /* package */ static boolean getProactiveHelpPreference(boolean defaultValue) { + return readBoolean(PROACTIVE_HELP_PREFERENCE_KEY, defaultValue); + } + + /** Enables or disables the proactive help setting. */ + /* package */ static void setProactiveHelpPreference(boolean enabled) { + writeBoolean(PROACTIVE_HELP_PREFERENCE_KEY, enabled); + } + + /* package */ static boolean getSkipInitScreenPreference(boolean defaultValue) { + return readBoolean(SKIP_INIT_SCREEN_PREFERENCE_KEY, defaultValue); + } + + /* package */ static void removeSkipInitScreenPreference() { + remove(SKIP_INIT_SCREEN_PREFERENCE_KEY); + } + + private static boolean readBoolean(String key, boolean defaultValue) { + return ContextUtils.getAppSharedPreferences().getBoolean(key, defaultValue); + } + + private static void writeBoolean(String key, boolean value) { + SharedPreferences.Editor ed = ContextUtils.getAppSharedPreferences().edit(); + ed.putBoolean(key, value); + ed.apply(); + } + + private static boolean contains(String key) { + return ContextUtils.getAppSharedPreferences().contains(key); + } + + private static void remove(String key) { + SharedPreferences.Editor ed = ContextUtils.getAppSharedPreferences().edit(); + ed.remove(key); + ed.apply(); + } + + // Avoid instantiation by accident. + private AutofillAssistantPreferencesUtil() {} } diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java index df189628b5c614..096fbe699d6316 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java @@ -218,8 +218,7 @@ private static boolean getIsFirstTimeUser() { @CalledByNative private static void setIsFirstTimeUser(boolean firstTimeUser) { - AutofillAssistantPreferencesUtil.setAutofillAssistantFirstTimeTriggerScriptUser( - firstTimeUser); + AutofillAssistantPreferencesUtil.setFirstTimeTriggerScriptUserPreference(firstTimeUser); } @CalledByNative @@ -270,7 +269,7 @@ static boolean getProactiveHelpSettingEnabled() { @CalledByNative private static void setProactiveHelpSettingEnabled(boolean enabled) { - AutofillAssistantPreferencesUtil.setProactiveHelpSwitch(enabled); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference(enabled); } @CalledByNative diff --git a/chrome/android/features/autofill_assistant/public/java_sources.gni b/chrome/android/features/autofill_assistant/public/java_sources.gni index 86b5c0bb31e422..0b5f53ccf189b6 100644 --- a/chrome/android/features/autofill_assistant/public/java_sources.gni +++ b/chrome/android/features/autofill_assistant/public/java_sources.gni @@ -12,6 +12,7 @@ public_autofill_assistant_java_sources = [ "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantSnackbar.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantSnackbarFactory.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java", + "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantTabObscuringUtil.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectAction.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java", diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSuggestionMessageCardTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSuggestionMessageCardTest.java index 3c18d771c880be..1a3a136a15d776 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSuggestionMessageCardTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/TabSuggestionMessageCardTest.java @@ -182,6 +182,7 @@ public void closeTabSuggestionReviewedAndAccepted() { @Test @MediumTest @CommandLineFlags.Add({BASE_PARAMS + ENABLE_CLOSE_SUGGESTION_PARAM}) + @DisableIf.Build(sdk_is_less_than = VERSION_CODES.N, message = "https://crbug.com/1280257") public void closeTabSuggestionReviewedAndDismissed() { CriteriaHelper.pollUiThread(TabSuggestionMessageService::isSuggestionAvailableForTesting); @@ -195,6 +196,7 @@ public void closeTabSuggestionReviewedAndDismissed() { @Test @MediumTest @CommandLineFlags.Add({BASE_PARAMS + ENABLE_GROUP_SUGGESTION_PARAM}) + @DisableIf.Build(sdk_is_less_than = VERSION_CODES.N, message = "https://crbug.com/1273142") public void groupTabSuggestionReviewedAndAccepted() { CriteriaHelper.pollUiThread(TabSuggestionMessageService::isSuggestionAvailableForTesting); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java index 12874e1bf19ba3..5d7575d440a136 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java @@ -67,8 +67,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { (ChromeSwitchPreference) findPreference(PREF_AUTOFILL_ASSISTANT); if (shouldShowAutofillAssistantPreference()) { mAutofillAssistantPreference.setOnPreferenceChangeListener((preference, newValue) -> { - mSharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, (boolean) newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference((boolean) newValue); updatePreferencesState(); return true; }); @@ -80,8 +79,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { (ChromeSwitchPreference) findPreference(PREF_ASSISTANT_PROACTIVE_HELP_SWITCH); if (shouldShowAutofillAssistantProactiveHelpPreference()) { mProactiveHelpPreference.setOnPreferenceChangeListener((preference, newValue) -> { - mSharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, (boolean) newValue); + AutofillAssistantPreferencesUtil.setProactiveHelpPreference((boolean) newValue); updatePreferencesState(); return true; }); @@ -126,8 +124,7 @@ public void onResume() { private boolean shouldShowAutofillAssistantPreference() { return AssistantFeatures.AUTOFILL_ASSISTANT.isEnabled() - && mSharedPreferencesManager.contains( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED); + && AutofillAssistantPreferencesUtil.containsAssistantEnabledPreference(); } private boolean shouldShowAutofillAssistantProactiveHelpPreference() { @@ -140,8 +137,8 @@ private boolean shouldShowWebAssistanceCategory() { } private void updatePreferencesState() { - boolean autofill_assistant_enabled = SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true); + boolean autofill_assistant_enabled = + AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(true); mAutofillAssistantPreference.setChecked(autofill_assistant_enabled); boolean assistant_switch_on_or_missing = @@ -150,8 +147,8 @@ private void updatePreferencesState() { UnifiedConsentServiceBridge.isUrlKeyedAnonymizedDataCollectionEnabled( Profile.getLastUsedRegularProfile()); - boolean proactive_help_on = SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, true); + boolean proactive_help_on = + AutofillAssistantPreferencesUtil.getProactiveHelpPreference(true); boolean proactive_toggle_enabled; boolean show_disclaimer; if (AssistantFeatures.AUTOFILL_ASSISTANT_DISABLE_PROACTIVE_HELP_TIED_TO_MSBB.isEnabled()) { diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java index 8e8f6b246a73f0..40f8e75642da96 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/GoogleServicesSettings.java @@ -18,14 +18,13 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.autofill_assistant.AssistantFeatures; +import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPreferencesUtil; import org.chromium.chrome.browser.contextualsearch.ContextualSearchFieldTrial; import org.chromium.chrome.browser.contextualsearch.ContextualSearchManager; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncherImpl; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.metrics.UmaSessionStats; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.Pref; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate; @@ -71,8 +70,6 @@ public class GoogleServicesSettings PrivacyPreferencesManagerImpl.getInstance(); private final ManagedPreferenceDelegate mManagedPreferenceDelegate = createManagedPreferenceDelegate(); - private final SharedPreferencesManager mSharedPreferencesManager = - SharedPreferencesManager.getInstance(); private ChromeSwitchPreference mAllowSignin; private ChromeSwitchPreference mSearchSuggestions; @@ -267,18 +264,16 @@ private ChromeManagedPreferenceDelegate createManagedPreferenceDelegate() { */ private boolean shouldShowAutofillAssistantPreference() { return AssistantFeatures.AUTOFILL_ASSISTANT.isEnabled() - && mSharedPreferencesManager.contains( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED); + && AutofillAssistantPreferencesUtil.containsAssistantEnabledPreference(); } public boolean isAutofillAssistantSwitchOn() { - return mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); + return AutofillAssistantPreferencesUtil.getAssistantEnabledPreference( + /* defaultValue= */ false); } public void setAutofillAssistantSwitchValue(boolean newValue) { - mSharedPreferencesManager.writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(newValue); } // SignOutDialogListener implementation: diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java index e76aeab7f3ff1f..1ea93d6c2a1315 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragmentTest.java @@ -117,11 +117,9 @@ public void testAutofillAssistantSwitchOn() { assertTrue(autofillAssistantSwitch.isChecked()); autofillAssistantSwitch.performClick(); - assertFalse(mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true)); + assertFalse(AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(true)); autofillAssistantSwitch.performClick(); - assertTrue(mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false)); + assertTrue(AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(false)); }); } @@ -288,8 +286,7 @@ public void testEnhancedVoiceSearch_Disabled() { } private void setAutofillAssistantSwitchValue(boolean newValue) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(newValue); } private AutofillAssistantPreferenceFragment startAutofillAssistantPreferenceFragment() { @@ -298,7 +295,6 @@ private AutofillAssistantPreferenceFragment startAutofillAssistantPreferenceFrag } public boolean isAutofillAssistantSwitchOn() { - return mSharedPreferencesManager.readBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, false); + return AutofillAssistantPreferencesUtil.getAssistantEnabledPreference(false); } } diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/content/TabObserverRegistrarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/content/TabObserverRegistrarTest.java index 9e7e3ddd34311a..8a18cbc6bc1e19 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/content/TabObserverRegistrarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/content/TabObserverRegistrarTest.java @@ -16,6 +16,7 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.FlakyTest; import org.chromium.chrome.browser.customtabs.CustomTabActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils; @@ -63,6 +64,7 @@ public void onLoadUrl(Tab tab, LoadUrlParams params, int loadType) { */ @Test @MediumTest + @FlakyTest(message = "crbug.com/1269017") public void testObserveActiveTab() throws Throwable { EmbeddedTestServer testServer = mCustomTabActivityTestRule.getTestServer(); final String windowOpenUrl = diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java index 74374c6bbe05bb..00acf05b86ac8e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java @@ -428,6 +428,7 @@ public void onGlobalLayout() { @Test @LargeTest @Features.DisableFeatures({ChromeFeatureList.OFFLINE_INDICATOR}) + @DisabledTest(message = "Disabled while investigating. crbug.com/1280192") public void testHidingBrowserControlsPreservesScrollOffset() throws TimeoutException { FullscreenManagerTestUtils.disableBrowserOverrides(); mActivityTestRule.startMainActivityWithURL(SCROLL_OFFSET_TEST_PAGE); diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java index 3e6e593f603c18..e719a68aeee664 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/settings/PasswordSettingsTest.java @@ -385,6 +385,7 @@ private void overrideSyncService( final boolean usingPassphrase, final boolean syncingPasswords) { TestThreadUtils.runOnUiThreadBlocking(() -> { when(mMockSyncService.hasSyncConsent()).thenReturn(syncingPasswords); + when(mMockSyncService.isEngineInitialized()).thenReturn(true); when(mMockSyncService.isUsingExplicitPassphrase()).thenReturn(usingPassphrase); when(mMockSyncService.getActiveDataTypes()) .thenReturn(CollectionUtil.newHashSet( diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java index 56a49ab4d31114..4eef470a6baba5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java @@ -24,11 +24,10 @@ import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; import org.chromium.chrome.browser.autofill_assistant.AssistantFeatures; +import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantPreferencesUtil; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.Pref; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; @@ -331,8 +330,7 @@ public void testMetricsSettingsShownFlagOn() { } private void setAutofillAssistantSwitchValue(boolean newValue) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue); + AutofillAssistantPreferencesUtil.setAssistantEnabledPreference(newValue); } private GoogleServicesSettings startGoogleServicesSettings() { diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index a4a494ffe34ef8..bade16ec4ed98a 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt @@ -1 +1 @@ -chromeos-chrome-amd64-98.0.4758.7_rc-r1-merged.afdo.bz2 +chromeos-chrome-amd64-98.0.4758.8_rc-r1-merged.afdo.bz2 diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client.cc index b34ad0db6e6ee2..59d292c58aa5e6 100644 --- a/chrome/app/chrome_crash_reporter_client.cc +++ b/chrome/app/chrome_crash_reporter_client.cc @@ -8,6 +8,7 @@ #include "base/environment.h" #include "base/files/file_path.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/string_split.h" #include "base/strings/utf_string_conversions.h" diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 7675eb1215d0b4..9848090c954e4d 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -8330,6 +8330,9 @@ Keep your key file in a safe place. You will need it to create new versions of y Reload + + Partitioned + diff --git a/chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 b/chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 new file mode 100644 index 00000000000000..649873ef137e48 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_COLLECTED_COOKIES_PARTITIONED_COOKIE.png.sha1 @@ -0,0 +1 @@ +07d6d20a03040837c86612cc5fc57f339e14349b \ No newline at end of file diff --git a/chrome/app/os_settings_strings.grdp b/chrome/app/os_settings_strings.grdp index 305341c6c96bb1..8d92a318689fe6 100644 --- a/chrome/app/os_settings_strings.grdp +++ b/chrome/app/os_settings_strings.grdp @@ -3327,7 +3327,7 @@ Press an assigned switch or key to remove assignment. Set up PIN - Screen lock + Lock screen Security and sign-in diff --git a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 new file mode 100644 index 00000000000000..8cfe1e2485b338 --- /dev/null +++ b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE_LOCK.png.sha1 @@ -0,0 +1 @@ +c849ef6602b8548be8461dc9da0f8d86ea51e0f5 \ No newline at end of file diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 32106707386949..27d216dd98b1c4 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -4422,8 +4422,6 @@ static_library("browser") { "usb/web_usb_chooser_desktop.h", "usb/web_usb_detector.cc", "usb/web_usb_detector.h", - "web_launch/web_launch_files_helper.cc", - "web_launch/web_launch_files_helper.h", "webauthn/authenticator_list_observer.h", "webauthn/authenticator_reference.cc", "webauthn/authenticator_reference.h", diff --git a/chrome/browser/accessibility/live_caption_controller_factory.cc b/chrome/browser/accessibility/live_caption_controller_factory.cc index 2b9ee793fa652e..760ba16431e2d2 100644 --- a/chrome/browser/accessibility/live_caption_controller_factory.cc +++ b/chrome/browser/accessibility/live_caption_controller_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/accessibility/live_caption_controller_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/accessibility/soda_installer_impl.cc b/chrome/browser/accessibility/soda_installer_impl.cc index aa83be3127e881..f88b1ba86a9f66 100644 --- a/chrome/browser/accessibility/soda_installer_impl.cc +++ b/chrome/browser/accessibility/soda_installer_impl.cc @@ -14,7 +14,6 @@ #include "base/cxx17_backports.h" #include "base/feature_list.h" #include "base/files/file_util.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/component_updater/soda_component_installer.h" diff --git a/chrome/browser/android/autofill_assistant/annotate_dom_model_service_factory.cc b/chrome/browser/android/autofill_assistant/annotate_dom_model_service_factory.cc index 56b6725ca8d862..f2b5e3885f94db 100644 --- a/chrome/browser/android/autofill_assistant/annotate_dom_model_service_factory.cc +++ b/chrome/browser/android/autofill_assistant/annotate_dom_model_service_factory.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/feature_list.h" #include "base/memory/scoped_refptr.h" +#include "base/no_destructor.h" #include "base/task/sequenced_task_runner.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" diff --git a/chrome/browser/android/customtabs/detached_resource_request.cc b/chrome/browser/android/customtabs/detached_resource_request.cc index e1071c3afb3037..72af983ea8a4ce 100644 --- a/chrome/browser/android/customtabs/detached_resource_request.cc +++ b/chrome/browser/android/customtabs/detached_resource_request.cc @@ -199,29 +199,13 @@ void DetachedResourceRequest::OnResponseCallback( DCHECK_CURRENTLY_ON(content::BrowserThread::UI); int net_error = url_loader_->NetError(); net_error = std::abs(net_error); - auto duration = base::TimeTicks::Now() - start_time_; - - switch (motivation_) { - case Motivation::kParallelRequest: { - RecordParallelRequestHistograms("", redirects_, duration, net_error); - if (is_from_aga_) { - RecordParallelRequestHistograms(".FromAga", redirects_, duration, - net_error); - } - break; - } - case Motivation::kResourcePrefetch: { - if (net_error == net::OK) { - UMA_HISTOGRAM_MEDIUM_TIMES( - "CustomTabs.ResourcePrefetch.Duration.Success", duration); - } else { - UMA_HISTOGRAM_MEDIUM_TIMES( - "CustomTabs.ResourcePrefetch.Duration.Failure", duration); - } - - base::UmaHistogramSparse("CustomTabs.ResourcePrefetch.FinalStatus", - net_error); - break; + + if (motivation_ == Motivation::kParallelRequest) { + auto duration = base::TimeTicks::Now() - start_time_; + RecordParallelRequestHistograms("", redirects_, duration, net_error); + if (is_from_aga_) { + RecordParallelRequestHistograms(".FromAga", redirects_, duration, + net_error); } } diff --git a/chrome/browser/android/metrics/android_session_durations_service_factory.cc b/chrome/browser/android/metrics/android_session_durations_service_factory.cc index 29f3c66c5317d3..2705d269e34a88 100644 --- a/chrome/browser/android/metrics/android_session_durations_service_factory.cc +++ b/chrome/browser/android/metrics/android_session_durations_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/android/metrics/android_session_durations_service_factory.h" +#include "base/no_destructor.h" #include "base/time/time.h" #include "build/build_config.h" #include "chrome/browser/android/metrics/android_session_durations_service.h" diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc index ac232853f53551..eb51082577a5b7 100644 --- a/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc +++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics.cc @@ -8,6 +8,7 @@ #include "base/json/values_util.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" diff --git a/chrome/browser/apps/digital_goods/util.cc b/chrome/browser/apps/digital_goods/util.cc index 36ae84ae523bda..fe9abaa323120e 100644 --- a/chrome/browser/apps/digital_goods/util.cc +++ b/chrome/browser/apps/digital_goods/util.cc @@ -20,50 +20,48 @@ std::string GetTwaPackageName(content::RenderFrameHost* render_frame_host) { auto* web_contents = content::WebContents::FromRenderFrameHost(render_frame_host); if (!web_contents) - return ""; + return std::string(); Browser* browser = chrome::FindBrowserWithWebContents(web_contents); if (!web_app::AppBrowserController::IsWebApp(browser)) { - return ""; + return std::string(); } auto* profile = Profile::FromBrowserContext(render_frame_host->GetBrowserContext()); if (profile->IsIncognitoProfile()) { - return ""; + return std::string(); } auto* apk_web_app_service = ash::ApkWebAppService::Get(profile); if (!apk_web_app_service) { - return ""; + return std::string(); } absl::optional twa_package_name = apk_web_app_service->GetPackageNameForWebApp( - content::WebContents::FromRenderFrameHost(render_frame_host) - ->GetLastCommittedURL()); + render_frame_host->GetMainFrame()->GetLastCommittedURL()); - return twa_package_name.value_or(""); + return twa_package_name.value_or(std::string()); } std::string GetScope(content::RenderFrameHost* render_frame_host) { web_app::WebAppProvider* provider = web_app::WebAppProvider::GetForWebApps( Profile::FromBrowserContext(render_frame_host->GetBrowserContext())); if (!provider) { - return ""; + return std::string(); } const web_app::WebAppRegistrar& registrar = provider->registrar(); absl::optional app_id = registrar.FindAppWithUrlInScope( - content::WebContents::FromRenderFrameHost(render_frame_host) - ->GetLastCommittedURL()); + render_frame_host->GetMainFrame()->GetLastCommittedURL()); if (!app_id) { - return ""; + return std::string(); } GURL scope = registrar.GetAppScope(app_id.value()); if (!scope.is_valid()) { - return ""; + return std::string(); } return scope.spec(); diff --git a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc index e5a2a991a643d0..1f43bcfc8a87fc 100644 --- a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc +++ b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc @@ -1614,10 +1614,7 @@ IN_PROC_BROWSER_TEST_F(SigninToUserProfileSwitchTest, DISABLED_LoginAsNewUser) { nullptr, ui::VKEY_ESCAPE, false, false, false, false)); }); - std::string button_title = features::IsSyncConsentOptionalEnabled() - ? "Got it" - : "Accept and continue"; - sm_.ExpectSpeech(button_title); + sm_.ExpectSpeech("Accept and continue"); // Check that profile switched to the active user. sm_.Call([]() { diff --git a/chrome/browser/ash/account_manager/account_apps_availability.cc b/chrome/browser/ash/account_manager/account_apps_availability.cc index 7c2eb94a2a124a..93795eaad20661 100644 --- a/chrome/browser/ash/account_manager/account_apps_availability.cc +++ b/chrome/browser/ash/account_manager/account_apps_availability.cc @@ -286,6 +286,11 @@ void AccountAppsAvailability::GetAccountsAvailableInArc( GetGaiaIdsAvailableInArc(prefs_), std::move(callback))); } +void AccountAppsAvailability::Shutdown() { + identity_manager_observation_.Reset(); + account_manager_facade_observation_.Reset(); +} + void AccountAppsAvailability::OnRefreshTokenUpdatedForAccount( const CoreAccountInfo& account_info) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); diff --git a/chrome/browser/ash/account_manager/account_apps_availability.h b/chrome/browser/ash/account_manager/account_apps_availability.h index 4907befa00f0b6..13b5e5233476dc 100644 --- a/chrome/browser/ash/account_manager/account_apps_availability.h +++ b/chrome/browser/ash/account_manager/account_apps_availability.h @@ -90,6 +90,9 @@ class AccountAppsAvailability bool IsInitialized() const; private: + // `KeyedService`: + void Shutdown() override; + // `IdentityManager::Observer`: void OnRefreshTokenUpdatedForAccount( const CoreAccountInfo& account_info) override; diff --git a/chrome/browser/ash/account_manager/account_apps_availability_factory.cc b/chrome/browser/ash/account_manager/account_apps_availability_factory.cc index a7618e970997b2..16274314a21fc4 100644 --- a/chrome/browser/ash/account_manager/account_apps_availability_factory.cc +++ b/chrome/browser/ash/account_manager/account_apps_availability_factory.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ash/account_manager/account_apps_availability_factory.h" #include "base/files/file_path.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/account_manager/account_apps_availability.h" #include "chrome/browser/ash/account_manager/account_manager_util.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/ash/android_sms/android_sms_service_factory.cc b/chrome/browser/ash/android_sms/android_sms_service_factory.cc index d486369a20afa1..e2ffa2d1406c18 100644 --- a/chrome/browser/ash/android_sms/android_sms_service_factory.cc +++ b/chrome/browser/ash/android_sms/android_sms_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/android_sms/android_sms_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/multidevice_setup/multidevice_setup_client_factory.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" diff --git a/chrome/browser/ash/app_restore/full_restore_service_factory.cc b/chrome/browser/ash/app_restore/full_restore_service_factory.cc index 2ef28b8e71ac4b..90598dd529900f 100644 --- a/chrome/browser/ash/app_restore/full_restore_service_factory.cc +++ b/chrome/browser/ash/app_restore/full_restore_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/app_restore/full_restore_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/app_restore/full_restore_prefs.h" diff --git a/chrome/browser/ash/arc/input_overlay/display_overlay_controller.cc b/chrome/browser/ash/arc/input_overlay/display_overlay_controller.cc index 4f7603230a1218..dda0ad4ed63a12 100644 --- a/chrome/browser/ash/arc/input_overlay/display_overlay_controller.cc +++ b/chrome/browser/ash/arc/input_overlay/display_overlay_controller.cc @@ -98,7 +98,7 @@ void DisplayOverlayController::RemoveInputMappingView() { DCHECK(overlay_widget); if (!overlay_widget) return; - overlay_widget->GetContentsView()->RemoveChildView(input_mapping_view_); + overlay_widget->GetContentsView()->RemoveChildViewT(input_mapping_view_); input_mapping_view_ = nullptr; } diff --git a/chrome/browser/ash/arc/input_overlay/touch_id_manager.cc b/chrome/browser/ash/arc/input_overlay/touch_id_manager.cc index 19cc9ff6c5bb20..3024c4044ee5ee 100644 --- a/chrome/browser/ash/arc/input_overlay/touch_id_manager.cc +++ b/chrome/browser/ash/arc/input_overlay/touch_id_manager.cc @@ -8,6 +8,7 @@ #include "base/check.h" #include "base/logging.h" +#include "base/no_destructor.h" namespace arc { namespace { diff --git a/chrome/browser/ash/arc/process/arc_process.cc b/chrome/browser/ash/arc/process/arc_process.cc index 664d9fd36f2423..ba79fca4ec82f5 100644 --- a/chrome/browser/ash/arc/process/arc_process.cc +++ b/chrome/browser/ash/arc/process/arc_process.cc @@ -7,7 +7,6 @@ #include #include "ash/components/arc/mojom/process.mojom.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" namespace arc { diff --git a/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc b/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc index 14e8c82962d319..e31c6af0c2d9ff 100644 --- a/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc +++ b/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc @@ -18,6 +18,7 @@ #include "base/bind.h" #include "base/check_op.h" #include "base/location.h" +#include "base/no_destructor.h" #include "base/rand_util.h" #include "base/strings/string_number_conversions.h" #include "base/threading/thread_checker.h" diff --git a/chrome/browser/ash/borealis/borealis_service_factory.cc b/chrome/browser/ash/borealis/borealis_service_factory.cc index 4cd204eb47b275..6979a4e7af68a3 100644 --- a/chrome/browser/ash/borealis/borealis_service_factory.cc +++ b/chrome/browser/ash/borealis/borealis_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/borealis/borealis_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/borealis/borealis_service_impl.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/ash/borealis/borealis_window_manager.cc b/chrome/browser/ash/borealis/borealis_window_manager.cc index c780d44417d97c..c45fccecfbe502 100644 --- a/chrome/browser/ash/borealis/borealis_window_manager.cc +++ b/chrome/browser/ash/borealis/borealis_window_manager.cc @@ -54,7 +54,7 @@ std::string BorealisIdToAppId(Profile* profile, unsigned borealis_id) { ->GetRegisteredApps(guest_os::GuestOsRegistryService::VmType:: ApplicationList_VmType_BOREALIS)) { absl::optional app_id = GetBorealisAppId(item.second.Exec()); - if (app_id && app_id.value() == borealis_id) { + if (app_id && app_id.value() == static_cast(borealis_id)) { return item.first; } } diff --git a/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc b/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc index f96930fc459499..fa4974b59f5dac 100644 --- a/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc +++ b/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc @@ -40,6 +40,10 @@ void PinDialogManager::RemoveSignRequest(const std::string& extension_id, sign_requests_.erase(key); } +int PinDialogManager::StoredSignRequestsForTesting() const { + return sign_requests_.size(); +} + PinDialogManager::RequestPinResult PinDialogManager::RequestPin( const std::string& extension_id, const std::string& extension_name, diff --git a/chrome/browser/ash/certificate_provider/pin_dialog_manager.h b/chrome/browser/ash/certificate_provider/pin_dialog_manager.h index 9b857309b964b7..22a0ae68d1c417 100644 --- a/chrome/browser/ash/certificate_provider/pin_dialog_manager.h +++ b/chrome/browser/ash/certificate_provider/pin_dialog_manager.h @@ -59,6 +59,9 @@ class PinDialogManager final { // future PIN dialogs related to it. void RemoveSignRequest(const std::string& extension_id, int sign_request_id); + // Returns the number of pending sign requests stored in sign_requests_ + int StoredSignRequestsForTesting() const; + // Creates and displays a new PIN dialog, or reuses the old dialog with just // updating the parameters if active one exists. // |extension_id| - the ID of the extension requesting the dialog. diff --git a/chrome/browser/ash/child_accounts/child_status_reporting_service_factory.cc b/chrome/browser/ash/child_accounts/child_status_reporting_service_factory.cc index 410b1d478ea198..a47a0e87af3ae5 100644 --- a/chrome/browser/ash/child_accounts/child_status_reporting_service_factory.cc +++ b/chrome/browser/ash/child_accounts/child_status_reporting_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/child_status_reporting_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/child_accounts/child_status_reporting_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/ash/child_accounts/child_user_service_factory.cc b/chrome/browser/ash/child_accounts/child_user_service_factory.cc index c23098e225d597..2bfbd98f0f3a8b 100644 --- a/chrome/browser/ash/child_accounts/child_user_service_factory.cc +++ b/chrome/browser/ash/child_accounts/child_user_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/child_user_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/child_accounts/child_user_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.cc b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.cc index c2c4c4a4fc957f..0c787415559a7e 100644 --- a/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.cc +++ b/chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/child_accounts/child_status_reporting_service_factory.h" #include "chrome/browser/ash/child_accounts/event_based_status_reporting_service.h" #include "chrome/browser/ash/child_accounts/screen_time_controller_factory.h" diff --git a/chrome/browser/ash/child_accounts/family_user_metrics_service_factory.cc b/chrome/browser/ash/child_accounts/family_user_metrics_service_factory.cc index e3fe1dc28374bc..907f0b3218cc02 100644 --- a/chrome/browser/ash/child_accounts/family_user_metrics_service_factory.cc +++ b/chrome/browser/ash/child_accounts/family_user_metrics_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/family_user_metrics_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ash/child_accounts/child_user_service_factory.h" #include "chrome/browser/ash/child_accounts/family_user_metrics_service.h" diff --git a/chrome/browser/ash/child_accounts/screen_time_controller_factory.cc b/chrome/browser/ash/child_accounts/screen_time_controller_factory.cc index 6dbb2283429357..d4045d38ff3124 100644 --- a/chrome/browser/ash/child_accounts/screen_time_controller_factory.cc +++ b/chrome/browser/ash/child_accounts/screen_time_controller_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/child_accounts/screen_time_controller_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/child_accounts/child_status_reporting_service_factory.h" #include "chrome/browser/ash/child_accounts/screen_time_controller.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/ash/child_accounts/usage_time_state_notifier.cc b/chrome/browser/ash/child_accounts/usage_time_state_notifier.cc index 478296339e8a3e..9b1c71f6f93635 100644 --- a/chrome/browser/ash/child_accounts/usage_time_state_notifier.cc +++ b/chrome/browser/ash/child_accounts/usage_time_state_notifier.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ash/child_accounts/usage_time_state_notifier.h" #include "base/check.h" +#include "base/no_destructor.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "components/session_manager/core/session_manager.h" diff --git a/chrome/browser/ash/chrome_browser_main_parts_ash.cc b/chrome/browser/ash/chrome_browser_main_parts_ash.cc index f749ec9788ea43..50a52340c90eb3 100644 --- a/chrome/browser/ash/chrome_browser_main_parts_ash.cc +++ b/chrome/browser/ash/chrome_browser_main_parts_ash.cc @@ -926,7 +926,10 @@ void ChromeBrowserMainPartsAsh::PreProfileInit() { std::string user_id_hash = parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); - BrowserDataMigrator::MaybeRestartToMigrate(account_id, user_id_hash); + if (BrowserDataMigrator::MaybeRestartToMigrate(account_id, user_id_hash)) { + LOG(WARNING) << "Restarting chrome to run profile migration."; + return; + } session_manager::SessionManager::Get()->CreateSessionForRestart( account_id, user_id_hash); diff --git a/chrome/browser/ash/concierge_helper_service.cc b/chrome/browser/ash/concierge_helper_service.cc index 9d479b0758d6e6..479097e8aa41a0 100644 --- a/chrome/browser/ash/concierge_helper_service.cc +++ b/chrome/browser/ash/concierge_helper_service.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "chromeos/dbus/concierge/concierge_client.h" #include "chromeos/dbus/concierge/concierge_service.pb.h" #include "chromeos/dbus/debug_daemon/debug_daemon_client.h" diff --git a/chrome/browser/ash/crosapi/browser_data_migrator.cc b/chrome/browser/ash/crosapi/browser_data_migrator.cc index 76d4060c53f836..425ed13b8c3df8 100644 --- a/chrome/browser/ash/crosapi/browser_data_migrator.cc +++ b/chrome/browser/ash/crosapi/browser_data_migrator.cc @@ -51,6 +51,7 @@ constexpr const char* const kNoCopyPaths[] = { kTmpDir, "Cache", "Code Cache", + "crash", "blob_storage", "GCache", "data_reduction_proxy_leveldb", @@ -160,20 +161,6 @@ static_assert(HasNoOverlapBetweenPathsSets(), "There must be no overlap between kNoCopyPaths, kAshDataPaths " "and kLacrosDataPaths"); -void OnRestartRequestResponse(bool result) { - if (!result) { - LOG(ERROR) << "SessionManagerClient::RequestBrowserDataMigration() failed."; - return; - } - - // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove this - // log message. - LOG(WARNING) - << "SessionManagerClient::RequestBrowserDataMigration() succeeded " - "and now attempting a restart."; - chrome::AttemptRestart(); -} - base::span GetNoCopyDataPaths() { if (base::FeatureList::IsEnabled( kLacrosProfileMigrationUseDeprecatedNoCopyPaths)) { @@ -230,7 +217,7 @@ int64_t BrowserDataMigrator::TargetInfo::TotalDirSize() const { } // static -void BrowserDataMigrator::MaybeRestartToMigrate( +bool BrowserDataMigrator::MaybeRestartToMigrate( const AccountId& account_id, const std::string& user_id_hash) { // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove this @@ -265,7 +252,7 @@ void BrowserDataMigrator::MaybeRestartToMigrate( break; } - return; + return false; } // Check if the switch for testing is present. @@ -273,18 +260,17 @@ void BrowserDataMigrator::MaybeRestartToMigrate( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kForceBrowserDataMigrationForTesting); if (force_migration_switch == kBrowserDataMigrationForceSkip) - return; + return false; if (force_migration_switch == kBrowserDataMigrationForceMigration) { LOG(WARNING) << "`kBrowserDataMigrationForceMigration` switch is present."; - RestartToMigrate(account_id, user_id_hash); - return; + return RestartToMigrate(account_id, user_id_hash); } const user_manager::User* user = user_manager::UserManager::Get()->FindUser(account_id); // Check if user exists i.e. not a guest session. if (!user) - return; + return false; // Check if lacros is enabled. If not immediately return. if (!crosapi::browser_util::IsLacrosEnabledForMigration(user)) { // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove @@ -302,7 +288,7 @@ void BrowserDataMigrator::MaybeRestartToMigrate( user_id_hash); crosapi::browser_util::ClearProfileMigrationCompletedForUser( g_browser_process->local_state(), user_id_hash); - return; + return false; } // Currently we turn on profile migration only for Googlers. To test profile @@ -314,7 +300,7 @@ void BrowserDataMigrator::MaybeRestartToMigrate( // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove // this log message. LOG(WARNING) << "Profile migration is disabled."; - return; + return false; } // If the user is a new user, then there shouldn't be anything to migrate. @@ -325,7 +311,7 @@ void BrowserDataMigrator::MaybeRestartToMigrate( // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove // this log message. LOG(WARNING) << "Setting migration as completed since it is a new user."; - return; + return false; } int attempts = GetMigrationAttemptCountForUser( @@ -338,7 +324,7 @@ void BrowserDataMigrator::MaybeRestartToMigrate( // this log message. LOG(WARNING) << "Skipping profile migration since migration attemp count = " << attempts << " has exceeded " << kMaxMigrationAttemptCount; - return; + return false; } if (crosapi::browser_util::IsDataWipeRequired(user_id_hash)) { @@ -348,8 +334,7 @@ void BrowserDataMigrator::MaybeRestartToMigrate( << "Restarting to run profile migration since data wipe is required."; // If data wipe is required, no need for a further check to determine if // lacros data dir exists or not. - RestartToMigrate(account_id, user_id_hash); - return; + return RestartToMigrate(account_id, user_id_hash); } if (crosapi::browser_util::IsProfileMigrationCompletedForUser( @@ -357,16 +342,15 @@ void BrowserDataMigrator::MaybeRestartToMigrate( // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, // remove this log message. LOG(WARNING) << "Profile migration has been completed already."; - return; + return false; } - RestartToMigrate(account_id, user_id_hash); + return RestartToMigrate(account_id, user_id_hash); } // static -void BrowserDataMigrator::RestartToMigrate(const AccountId& account_id, +bool BrowserDataMigrator::RestartToMigrate(const AccountId& account_id, const std::string& user_id_hash) { - LOG(WARNING) << "Restarting to start profile migration."; SetMigrationStep(g_browser_process->local_state(), MigrationStep::kRestartCalled); @@ -378,9 +362,17 @@ void BrowserDataMigrator::RestartToMigrate(const AccountId& account_id, g_browser_process->local_state()->CommitPendingWrite(); - SessionManagerClient::Get()->RequestBrowserDataMigration( - cryptohome::CreateAccountIdentifierFromAccountId(account_id), - base::BindOnce(&OnRestartRequestResponse)); + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this log message. + LOG(WARNING) << "Making a dbus method call to session_manager"; + bool success = SessionManagerClient::Get()->RequestBrowserDataMigration( + cryptohome::CreateAccountIdentifierFromAccountId(account_id)); + + if (!success) + return false; + + chrome::AttemptRestart(); + return true; } // static diff --git a/chrome/browser/ash/crosapi/browser_data_migrator.h b/chrome/browser/ash/crosapi/browser_data_migrator.h index 7b29b2f95df4ce..1b8cc16e94b503 100644 --- a/chrome/browser/ash/crosapi/browser_data_migrator.h +++ b/chrome/browser/ash/crosapi/browser_data_migrator.h @@ -205,9 +205,11 @@ class BrowserDataMigrator { }; // Checks if migration is required for the user identified by `user_id_hash` - // and if it is required, calls a DBus method to session_manager and - // terminates ash-chrome. - static void MaybeRestartToMigrate(const AccountId& account_id, + // and if it is required, calls a D-Bus method to session_manager and + // terminates ash-chrome. It returns true if the D-Bus call to the + // session_manager is made and successful. The return value of true means that + // `chrome::AttemptRestart()` has been called. + static bool MaybeRestartToMigrate(const AccountId& account_id, const std::string& user_id_hash); // The method needs to be called on UI thread. It posts `MigrateInternal()` on @@ -274,8 +276,8 @@ class BrowserDataMigrator { scoped_refptr cancel_flag); // Called from `MaybeRestartToMigrate()` to proceed with restarting to start - // the migration. - static void RestartToMigrate(const AccountId& account_id, + // the migration. It returns true if D-Bus call was successful. + static bool RestartToMigrate(const AccountId& account_id, const std::string& user_id_hash); // Called on UI thread once migration is finished. diff --git a/chrome/browser/ash/crosapi/crosapi_util.cc b/chrome/browser/ash/crosapi/crosapi_util.cc index d8d89818c428ac..fd2906cb3f4121 100644 --- a/chrome/browser/ash/crosapi/crosapi_util.cc +++ b/chrome/browser/ash/crosapi/crosapi_util.cc @@ -300,12 +300,6 @@ mojom::BrowserInitParamsPtr GetBrowserInitParams( params->idle_info = IdleServiceAsh::ReadIdleInfoFromSystem(); params->native_theme_info = NativeThemeServiceAsh::GetNativeThemeInfo(); - params->is_incognito_deprecated = - initial_browser_action.action == - crosapi::mojom::InitialBrowserAction::kOpenIncognitoWindow; - params->restore_last_session_deprecated = - initial_browser_action.action == - crosapi::mojom::InitialBrowserAction::kRestoreLastSession; params->initial_browser_action = initial_browser_action.action; if (initial_browser_action.action == crosapi::mojom::InitialBrowserAction::kOpenWindowWithUrls) { diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service.cc b/chrome/browser/ash/crostini/ansible/ansible_management_service.cc index 14e44486f41e15..a2762a3045ed3f 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_service.cc +++ b/chrome/browser/ash/crostini/ansible/ansible_management_service.cc @@ -6,7 +6,6 @@ #include "base/files/file_util.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.cc b/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.cc index 64e4c1b20009ee..858d366bfe5eee 100644 --- a/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.cc +++ b/chrome/browser/ash/crostini/ansible/ansible_management_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/crostini/ansible/ansible_management_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/crostini/ansible/ansible_management_service.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc index fd68da034815af..fa36062c7555e9 100644 --- a/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc +++ b/chrome/browser/ash/crostini/crostini_engagement_metrics_service.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/crostini/crostini_engagement_metrics_service.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/crostini/crostini_util.h" diff --git a/chrome/browser/ash/crostini/crostini_export_import.cc b/chrome/browser/ash/crostini/crostini_export_import.cc index d852f4f14d7c1b..df071d962df394 100644 --- a/chrome/browser/ash/crostini/crostini_export_import.cc +++ b/chrome/browser/ash/crostini/crostini_export_import.cc @@ -11,6 +11,7 @@ #include "base/files/file_util.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" diff --git a/chrome/browser/ash/crostini/crostini_manager.cc b/chrome/browser/ash/crostini/crostini_manager.cc index cc3ed66977eda6..9676e2ca5c0df1 100644 --- a/chrome/browser/ash/crostini/crostini_manager.cc +++ b/chrome/browser/ash/crostini/crostini_manager.cc @@ -18,7 +18,6 @@ #include "base/feature_list.h" #include "base/files/file_util.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/string_split.h" #include "base/strings/stringprintf.h" diff --git a/chrome/browser/ash/crostini/crostini_manager_factory.cc b/chrome/browser/ash/crostini/crostini_manager_factory.cc index d670a17419182d..7afa97fcd8f0b0 100644 --- a/chrome/browser/ash/crostini/crostini_manager_factory.cc +++ b/chrome/browser/ash/crostini/crostini_manager_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/crostini/crostini_manager_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/ash/crostini/crostini_terminal.cc b/chrome/browser/ash/crostini/crostini_terminal.cc index 951c7d1a61162b..15bd49d61b320e 100644 --- a/chrome/browser/ash/crostini/crostini_terminal.cc +++ b/chrome/browser/ash/crostini/crostini_terminal.cc @@ -12,7 +12,6 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" diff --git a/chrome/browser/ash/crostini/crostini_upgrader.cc b/chrome/browser/ash/crostini/crostini_upgrader.cc index 1a68ad37cb406f..3a8891bde856dc 100644 --- a/chrome/browser/ash/crostini/crostini_upgrader.cc +++ b/chrome/browser/ash/crostini/crostini_upgrader.cc @@ -9,6 +9,7 @@ #include "base/feature_list.h" #include "base/files/file_util.h" #include "base/location.h" +#include "base/no_destructor.h" #include "base/system/sys_info.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" diff --git a/chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.cc b/chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.cc index 75e7fbff9effef..0dd5e6747aa65a 100644 --- a/chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.cc +++ b/chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ash/cryptauth/cryptauth_device_id_provider_impl.h" #include "base/guid.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/common/pref_names.h" #include "components/prefs/pref_registry_simple.h" diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc index 02b868dfead5db..526603421255b9 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc @@ -36,6 +36,7 @@ #include "base/json/json_reader.h" #include "base/json/json_value_converter.h" #include "base/json/json_writer.h" +#include "base/no_destructor.h" #include "base/path_service.h" #include "base/ranges/algorithm.h" #include "base/run_loop.h" diff --git a/chrome/browser/ash/file_manager/open_with_browser.cc b/chrome/browser/ash/file_manager/open_with_browser.cc index 3c67e676f30018..2be0c3ee6ba38c 100644 --- a/chrome/browser/ash/file_manager/open_with_browser.cc +++ b/chrome/browser/ash/file_manager/open_with_browser.cc @@ -12,7 +12,6 @@ #include "base/command_line.h" #include "base/cxx17_backports.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" diff --git a/chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.cc b/chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.cc index e56497f5f6895b..17bb0e9cf315c3 100644 --- a/chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.cc +++ b/chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/guest_os/guest_os_mime_types_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/guest_os/guest_os_mime_types_service.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service_factory.cc b/chrome/browser/ash/guest_os/guest_os_registry_service_factory.cc index 85f74971ad6392..10e178efab66e4 100644 --- a/chrome/browser/ash/guest_os/guest_os_registry_service_factory.cc +++ b/chrome/browser/ash/guest_os/guest_os_registry_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/guest_os/guest_os_registry_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/guest_os/guest_os_registry_service.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc b/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc index 5a33af9b7f9e55..b31741df8d832d 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc +++ b/chrome/browser/ash/guest_os/guest_os_share_path_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/guest_os/guest_os_share_path_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/crostini/crostini_manager_factory.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc index 60ed4ce3e90a45..f290597b4b20ed 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc @@ -15,7 +15,6 @@ #include "ash/components/proximity_auth/screenlock_bridge.h" #include "base/bind.h" #include "base/memory/ptr_util.h" -#include "base/no_destructor.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" #include "base/values.h" diff --git a/chrome/browser/ash/login/oobe_interactive_ui_test.cc b/chrome/browser/ash/login/oobe_interactive_ui_test.cc index 8df0e4674d2f52..93b2651cce9f18 100644 --- a/chrome/browser/ash/login/oobe_interactive_ui_test.cc +++ b/chrome/browser/ash/login/oobe_interactive_ui_test.cc @@ -173,9 +173,8 @@ void RunSyncConsentScreenChecks() { screen->SetProfileSyncEngineInitializedForTesting(true); screen->OnStateChanged(nullptr); - const std::string button_name = features::IsSyncConsentOptionalEnabled() - ? "acceptButton" - : "nonSplitSettingsAcceptButton"; + // TODO(TBD): Rename the button to remove SplitSettings from its name. + const std::string button_name = "nonSplitSettingsAcceptButton"; test::OobeJS().ExpectEnabledPath({"sync-consent", button_name}); test::OobeJS().CreateFocusWaiter({"sync-consent", button_name})->Wait(); diff --git a/chrome/browser/ash/login/saml/password_expiry_notification.cc b/chrome/browser/ash/login/saml/password_expiry_notification.cc index 59518fe17b52aa..57eed67ebf47a9 100644 --- a/chrome/browser/ash/login/saml/password_expiry_notification.cc +++ b/chrome/browser/ash/login/saml/password_expiry_notification.cc @@ -12,6 +12,7 @@ #include "ash/public/cpp/session/session_activation_observer.h" #include "ash/public/cpp/session/session_controller.h" #include "base/bind.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/task/post_task.h" #include "base/task/task_traits.h" diff --git a/chrome/browser/ash/login/screens/guest_tos_screen.cc b/chrome/browser/ash/login/screens/guest_tos_screen.cc index 49ac7d52720e42..aa4571af5b2032 100644 --- a/chrome/browser/ash/login/screens/guest_tos_screen.cc +++ b/chrome/browser/ash/login/screens/guest_tos_screen.cc @@ -4,6 +4,8 @@ #include "chrome/browser/ash/login/screens/guest_tos_screen.h" +#include "ash/constants/ash_switches.h" +#include "base/command_line.h" #include "base/strings/stringprintf.h" #include "chrome/browser/ash/login/startup_utils.h" #include "chrome/browser/browser_process.h" @@ -17,11 +19,23 @@ constexpr const char kUserActionBackClicked[] = "back-button"; constexpr const char kUserActionCancelClicked[] = "cancel"; std::string GetGoogleEulaOnlineUrl() { + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kOobeEulaUrlForTests)) { + return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kOobeEulaUrlForTests); + } + return base::StringPrintf(chrome::kGoogleEulaOnlineURLPath, g_browser_process->GetApplicationLocale().c_str()); } std::string GetCrosEulaOnlineUrl() { + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kOobeEulaUrlForTests)) { + return base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kOobeEulaUrlForTests); + } + return base::StringPrintf(chrome::kCrosEulaOnlineURLPath, g_browser_process->GetApplicationLocale().c_str()); } diff --git a/chrome/browser/ash/login/screens/guest_tos_screen_browsertest.cc b/chrome/browser/ash/login/screens/guest_tos_screen_browsertest.cc new file mode 100644 index 00000000000000..f07c45081bb60e --- /dev/null +++ b/chrome/browser/ash/login/screens/guest_tos_screen_browsertest.cc @@ -0,0 +1,110 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/constants/ash_features.h" +#include "ash/constants/ash_switches.h" +#include "base/containers/contains.h" +#include "chrome/browser/ash/login/oobe_screen.h" +#include "chrome/browser/ash/login/screens/guest_tos_screen.h" +#include "chrome/browser/ash/login/test/fake_eula_mixin.h" +#include "chrome/browser/ash/login/test/js_checker.h" +#include "chrome/browser/ash/login/test/oobe_base_test.h" +#include "chrome/browser/ash/login/test/oobe_screen_waiter.h" +#include "chrome/browser/ash/login/test/webview_content_extractor.h" +#include "chrome/browser/ash/login/ui/login_display_host.h" +#include "chrome/browser/ash/login/ui/webui_login_view.h" +#include "chrome/browser/ash/login/wizard_controller.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/webui/chromeos/login/guest_tos_screen_handler.h" +#include "content/public/test/browser_test.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace ash { +namespace { + +constexpr char kGuestTostId[] = "guest-tos"; + +// Loaded Dialog +const test::UIPath kLoadedDialog = {kGuestTostId, "loaded"}; +const test::UIPath kGoogleEulaLink = {kGuestTostId, "googleEulaLink"}; +const test::UIPath kCrosEulaLink = {kGuestTostId, "crosEulaLink"}; + +const test::UIPath kUsageStats = {kGuestTostId, "usageStats"}; +const test::UIPath kUsageLearnMoreLink = {kGuestTostId, "usageLearnMore"}; +const test::UIPath kUsageLearnMorePopUp = {kGuestTostId, "usageLearnMorePopUp"}; +const test::UIPath kUsageLearnMorePopUpClose = { + kGuestTostId, "usageLearnMorePopUp", "closeButton"}; + +// Google EUlA Dialog +const test::UIPath kGoogleEulaDialog = {kGuestTostId, "googleEulaDialog"}; +const test::UIPath kGoogleEulaWebview = {kGuestTostId, "googleEulaWebview"}; +const test::UIPath kGoogleEulaOkButton = {kGuestTostId, "googleEulaOkButton"}; + +// CROS EULA Dialog +const test::UIPath kCrosEulaDialog = {kGuestTostId, "crosEulaDialog"}; +const test::UIPath kCrosEulaWebview = {kGuestTostId, "crosEulaWebview"}; +const test::UIPath kCrosEulaOkButton = {kGuestTostId, "crosEulaOkButton"}; + +} // namespace + +class GuestTosScreenTest : public OobeBaseTest { + public: + GuestTosScreenTest() { + feature_list_.InitAndEnableFeature(features::kOobeConsolidatedConsent); + } + + void SetUpOnMainThread() override { + LoginDisplayHost::default_host()->GetWizardContext()->is_branded_build = + true; + OobeBaseTest::SetUpOnMainThread(); + } + + void ShowGuestTosScreen() { + WizardController::default_controller()->AdvanceToScreen( + GuestTosScreenView::kScreenId); + OobeScreenWaiter(GuestTosScreenView::kScreenId).Wait(); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); + } + + protected: + base::test::ScopedFeatureList feature_list_; + + FakeEulaMixin fake_eula_{&mixin_host_, embedded_test_server()}; +}; + +IN_PROC_BROWSER_TEST_F(GuestTosScreenTest, GoogleEula) { + ShowGuestTosScreen(); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); + test::OobeJS().ClickOnPath(kGoogleEulaLink); + test::OobeJS().CreateVisibilityWaiter(true, kGoogleEulaDialog)->Wait(); + const std::string webview_contents = + test::GetWebViewContents(kGoogleEulaWebview); + EXPECT_TRUE(base::Contains(webview_contents, FakeEulaMixin::kFakeOnlineEula)); + test::OobeJS().ClickOnPath(kGoogleEulaOkButton); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); +} + +IN_PROC_BROWSER_TEST_F(GuestTosScreenTest, CrosEula) { + ShowGuestTosScreen(); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); + test::OobeJS().ClickOnPath(kCrosEulaLink); + test::OobeJS().CreateVisibilityWaiter(true, kCrosEulaDialog)->Wait(); + const std::string webview_contents = + test::GetWebViewContents(kCrosEulaWebview); + EXPECT_TRUE(base::Contains(webview_contents, FakeEulaMixin::kFakeOnlineEula)); + test::OobeJS().ClickOnPath(kCrosEulaOkButton); + test::OobeJS().CreateVisibilityWaiter(true, kLoadedDialog)->Wait(); +} + +IN_PROC_BROWSER_TEST_F(GuestTosScreenTest, UsageStatsOptin) { + ShowGuestTosScreen(); + test::OobeJS().ExpectVisiblePath(kUsageStats); + test::OobeJS().ClickOnPath(kUsageLearnMoreLink); + test::OobeJS().ExpectAttributeEQ("open", kUsageLearnMorePopUp, true); + test::OobeJS().ClickOnPath(kUsageLearnMorePopUpClose); + test::OobeJS().ExpectAttributeEQ("open", kUsageLearnMorePopUp, false); +} + +} // namespace ash diff --git a/chrome/browser/ash/login/screens/hid_detection_screen.cc b/chrome/browser/ash/login/screens/hid_detection_screen.cc index bba2782f0b882c..ad794ab2580fca 100644 --- a/chrome/browser/ash/login/screens/hid_detection_screen.cc +++ b/chrome/browser/ash/login/screens/hid_detection_screen.cc @@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/command_line.h" +#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/time/default_tick_clock.h" diff --git a/chrome/browser/ash/login/screens/sync_consent_browsertest.cc b/chrome/browser/ash/login/screens/sync_consent_browsertest.cc index 21c6f4179f11a3..8dca28c23478a8 100644 --- a/chrome/browser/ash/login/screens/sync_consent_browsertest.cc +++ b/chrome/browser/ash/login/screens/sync_consent_browsertest.cc @@ -63,16 +63,12 @@ constexpr char kSyncConsent[] = "sync-consent"; const test::UIPath kOverviewDialog = {kSyncConsent, "syncConsentOverviewDialog"}; -const test::UIPath kSplitSettingsDialog = {kSyncConsent, - "splitSettingsSyncConsentDialog"}; const test::UIPath kReviewSettingsCheckBox = {kSyncConsent, "reviewSettingsBox"}; const test::UIPath kNonSplitSettingsAcceptButton = { kSyncConsent, "nonSplitSettingsAcceptButton"}; const test::UIPath kNonSplitSettingsDeclineButton = { kSyncConsent, "nonSplitSettingsDeclineButton"}; -const test::UIPath kAcceptButton = {kSyncConsent, "acceptButton"}; -const test::UIPath kDeclineButton = {kSyncConsent, "declineButton"}; syncer::SyncUserSettings* GetSyncUserSettings() { Profile* profile = ProfileManager::GetPrimaryUserProfile(); @@ -147,41 +143,27 @@ class SyncConsentTest OobeBaseTest::SetUpOnMainThread(); LoginDisplayHost::default_host()->GetWizardContext()->is_branded_build = true; - if (features::IsSyncConsentOptionalEnabled()) { + + if (features::IsMinorModeRestrictionEnabled() && is_minor_user_) { expected_consent_ids_ = { - IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_DESCRIPTION, + IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE_WITH_DEVICE, + IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_DESCRIPTION, IDS_LOGIN_SYNC_CONSENT_SCREEN_DECLINE2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_TURN_ON_SYNC, }; } else { - if (features::IsMinorModeRestrictionEnabled() && is_minor_user_) { - expected_consent_ids_ = { - IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE_WITH_DEVICE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_DECLINE2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_TURN_ON_SYNC, - }; - } else { - expected_consent_ids_ = { - IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE_WITH_DEVICE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME_2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_REVIEW_SYNC_OPTIONS_LATER, - IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT_AND_CONTINUE, - }; - } + expected_consent_ids_ = { + IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE_WITH_DEVICE, + IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME_2, + IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_DESCRIPTION, + IDS_LOGIN_SYNC_CONSENT_SCREEN_REVIEW_SYNC_OPTIONS_LATER, + IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT_AND_CONTINUE, + }; } SyncConsentScreen::SetSyncConsentScreenExitTestDelegate(this); @@ -362,14 +344,10 @@ IN_PROC_BROWSER_TEST_F(SyncConsentTest, AbortedSetup) { EXPECT_TRUE(settings->IsSyncEverythingEnabled()); } -// Tests of the consent recorder with SyncConsentOptional disabled. The -// SyncConsentOptional suite below has its own consent recorder tests. class SyncConsentRecorderTest : public SyncConsentTest { public: SyncConsentRecorderTest() { - features_.InitWithFeatures( - /*enabled_features=*/{features::kSyncSettingsCategorization}, - /*disabled_features=*/{features::kSyncConsentOptional}); + features_.InitAndEnableFeature(features::kSyncSettingsCategorization); } ~SyncConsentRecorderTest() override = default; @@ -485,262 +463,13 @@ INSTANTIATE_TEST_SUITE_P(All, SyncConsentPolicyDisabledTest, testing::Bool()); -// Additional tests of the consent dialog that are only applicable when the -// SyncConsentOptional flag enabled. -class SyncConsentOptionalTest : public SyncConsentTest { - public: - SyncConsentOptionalTest() { - sync_feature_list_.InitWithFeatures( - { - features::kSyncSettingsCategorization, - features::kSyncConsentOptional, - }, - {}); - } - ~SyncConsentOptionalTest() override = default; - - private: - base::test::ScopedFeatureList sync_feature_list_; -}; - -// Flaky failures on sanitizer builds. https://crbug.com/1054377 -#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) -#define MAYBE_DefaultFlow DISABLED_DefaultFlow -#else -#define MAYBE_DefaultFlow DefaultFlow -#endif -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, MAYBE_DefaultFlow) { - LoginToSyncConsentScreen(); - WaitForScreenShown(); - - // OS sync is disabled by default. - Profile* profile = ProfileManager::GetPrimaryUserProfile(); - PrefService* prefs = profile->GetPrefs(); - EXPECT_FALSE(prefs->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled)); - - // Dialog not completed yet. - EXPECT_FALSE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); - - // Wait for content to load. - SyncConsentScreen* screen = GetSyncConsentScreen(); - ConsentRecordedWaiter consent_recorded_waiter; - screen->SetDelegateForTesting(&consent_recorded_waiter); - screen->SetProfileSyncDisabledByPolicyForTesting(false); - screen->SetProfileSyncEngineInitializedForTesting(true); - screen->OnStateChanged(nullptr); - test::OobeJS().CreateVisibilityWaiter(true, {kSyncConsent})->Wait(); - - // Dialog is visible. - test::OobeJS().ExpectVisiblePath(kSplitSettingsDialog); - - // Click the accept button and wait for the JS to C++ callback. - test::OobeJS().ClickOnPath(kAcceptButton); - consent_recorded_waiter.Wait(); - screen->SetDelegateForTesting(nullptr); - - // Consent was recorded for the confirmation button. - EXPECT_EQ(SyncConsentScreen::CONSENT_GIVEN, - consent_recorded_waiter.consent_given_); - EXPECT_EQ("Got it", consent_recorded_waiter.consent_confirmation_string_); - EXPECT_EQ(IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2, - consent_recorded_waiter.consent_confirmation_id_); - - // Consent was recorded for all descriptions, including the confirmation - // button label. - std::vector expected_ids = { - IDS_LOGIN_SYNC_CONSENT_SCREEN_TITLE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_SUBTITLE, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_OS_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_BROWSER_SYNC_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_CHROME_SYNC_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_NAME, - IDS_LOGIN_SYNC_CONSENT_SCREEN_PERSONALIZE_GOOGLE_SERVICES_DESCRIPTION, - IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2, - IDS_LOGIN_SYNC_CONSENT_SCREEN_DECLINE2, - }; - EXPECT_THAT(consent_recorded_waiter.consent_description_ids_, - testing::UnorderedElementsAreArray(expected_ids)); - - // OS sync should be on. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - - // Browser sync is on. - auto* identity_manager = IdentityManagerFactory::GetForProfile(profile); - EXPECT_TRUE(identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSync)); - EXPECT_TRUE(settings->IsSyncRequested()); - EXPECT_TRUE(settings->IsFirstSetupComplete()); - EXPECT_TRUE(settings->IsSyncEverythingEnabled()); - - WaitForScreenExit(); - EXPECT_EQ(screen_result_.value(), SyncConsentScreen::Result::NEXT); - histogram_tester_.ExpectTotalCount( - "OOBE.StepCompletionTimeByExitReason.Sync-consent.Next", 1); - histogram_tester_.ExpectTotalCount("OOBE.StepCompletionTime.Sync-consent", 1); - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.Behavior", - SyncConsentScreen::SyncScreenBehavior::kShow, 1); - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.UserChoice", - SyncConsentScreenHandler::UserChoice::kAccepted, 1); - histogram_tester_.ExpectUniqueSample("OOBE.SyncConsentScreen.SyncEnabled", - true, 1); - - // Dialog is completed. - EXPECT_TRUE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); -} - -// Flaky failures on sanitizer builds. https://crbug.com/1054377 -#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) -#define MAYBE_DisableSync DISABLED_DisableSync -#else -#define MAYBE_DisableSync DisableSync -#endif -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, MAYBE_DisableSync) { - LoginToSyncConsentScreen(); - - // Wait for content to load. - SyncConsentScreen* screen = GetSyncConsentScreen(); - ConsentRecordedWaiter consent_recorded_waiter; - screen->SetDelegateForTesting(&consent_recorded_waiter); - screen->SetProfileSyncDisabledByPolicyForTesting(false); - screen->SetProfileSyncEngineInitializedForTesting(true); - screen->OnStateChanged(nullptr); - test::OobeJS().CreateVisibilityWaiter(true, {kSyncConsent})->Wait(); - - // Click the decline button and wait for the JS to C++ callback. - test::OobeJS().ClickOnPath(kDeclineButton); - consent_recorded_waiter.Wait(); - screen->SetDelegateForTesting(nullptr); - - // OS sync is off. - PrefService* prefs = ProfileManager::GetPrimaryUserProfile()->GetPrefs(); - EXPECT_FALSE(prefs->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled)); - - // For historical reasons, browser sync is still on. However, all data types - // are disabled. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_TRUE(settings->IsSyncRequested()); - EXPECT_TRUE(settings->IsFirstSetupComplete()); - EXPECT_FALSE(settings->IsSyncEverythingEnabled()); - EXPECT_TRUE(settings->GetSelectedTypes().Empty()); - - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.Behavior", - SyncConsentScreen::SyncScreenBehavior::kShow, 1); - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.UserChoice", - SyncConsentScreenHandler::UserChoice::kDeclined, 1); - histogram_tester_.ExpectUniqueSample("OOBE.SyncConsentScreen.SyncEnabled", - false, 1); - - // Dialog is completed. - EXPECT_TRUE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); -} - -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, LanguageSwitch) { - SwitchLanguage("es"); - LoginToSyncConsentScreen(); - - SyncConsentScreen* screen = GetSyncConsentScreen(); - ConsentRecordedWaiter consent_recorded_waiter; - screen->SetDelegateForTesting(&consent_recorded_waiter); - - test::OobeJS().CreateVisibilityWaiter(true, {kSyncConsent})->Wait(); - test::OobeJS().TapOnPath(kAcceptButton); - consent_recorded_waiter.Wait(); - screen->SetDelegateForTesting(nullptr); - - EXPECT_THAT(consent_recorded_waiter.consent_description_strings_, - UnorderedElementsAreArray(GetLocalizedExpectedConsentStrings())); - EXPECT_THAT( - consent_recorded_waiter.consent_confirmation_string_, - Eq(GetLocalizedConsentString(IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2))); -} - -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, LanguageVariant) { - SwitchLanguage("en-GB"); - LoginToSyncConsentScreen(); - - SyncConsentScreen* screen = GetSyncConsentScreen(); - ConsentRecordedWaiter consent_recorded_waiter; - screen->SetDelegateForTesting(&consent_recorded_waiter); - - test::OobeJS().CreateVisibilityWaiter(true, {kSyncConsent})->Wait(); - test::OobeJS().TapOnPath(kAcceptButton); - consent_recorded_waiter.Wait(); - screen->SetDelegateForTesting(nullptr); - - EXPECT_THAT(consent_recorded_waiter.consent_description_strings_, - UnorderedElementsAreArray(GetLocalizedExpectedConsentStrings())); - EXPECT_THAT( - consent_recorded_waiter.consent_confirmation_string_, - Eq(GetLocalizedConsentString(IDS_LOGIN_SYNC_CONSENT_SCREEN_ACCEPT2))); -} - -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, SkippedNotBrandedBuild) { - LoginDisplayHost::default_host()->GetWizardContext()->is_branded_build = - false; - LoginToSyncConsentScreen(); - WaitForScreenExit(); - EXPECT_EQ(screen_result_.value(), SyncConsentScreen::Result::NOT_APPLICABLE); - - // OS sync should be on. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_TRUE(settings->IsOsSyncFeatureEnabled()); - - // Browser sync is on. - EXPECT_TRUE(settings->IsSyncRequested()); - EXPECT_TRUE(settings->IsFirstSetupComplete()); - - // Dialog is completed. - PrefService* prefs = ProfileManager::GetPrimaryUserProfile()->GetPrefs(); - EXPECT_TRUE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); - - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.Behavior", - SyncConsentScreen::SyncScreenBehavior::kSkipAndEnableNonBrandedBuild, 1); - histogram_tester_.ExpectUniqueSample("OOBE.SyncConsentScreen.SyncEnabled", - true, 1); -} - -IN_PROC_BROWSER_TEST_F(SyncConsentOptionalTest, SkippedSyncDisabledByPolicy) { - SyncConsentScreen::SetProfileSyncDisabledByPolicyForTesting(true); - LoginToSyncConsentScreen(); - WaitForScreenExit(); - EXPECT_EQ(screen_result_.value(), SyncConsentScreen::Result::NOT_APPLICABLE); - - // OS sync should be off. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - - // Browser sync is off. - EXPECT_FALSE(settings->IsSyncRequested()); - EXPECT_FALSE(settings->IsFirstSetupComplete()); - - // Dialog is completed. - PrefService* prefs = ProfileManager::GetPrimaryUserProfile()->GetPrefs(); - EXPECT_TRUE(prefs->GetBoolean(prefs::kSyncOobeCompleted)); - - histogram_tester_.ExpectUniqueSample( - "OOBE.SyncConsentScreen.Behavior", - SyncConsentScreen::SyncScreenBehavior::kSkipPermissionsPolicy, 1); - // We don't test SyncEnabled because this test fakes the policy disable and - // the sync engine is still enabled. -} - // Tests for Active Directory accounts, which skip the dialog because they do // not use sync. class SyncConsentActiveDirectoryTest : public OobeBaseTest { public: SyncConsentActiveDirectoryTest() { - sync_feature_list_.InitWithFeatures( - { - features::kSyncSettingsCategorization, - features::kSyncConsentOptional, - }, - {}); + sync_feature_list_.InitWithFeatures({features::kSyncSettingsCategorization}, + {}); } ~SyncConsentActiveDirectoryTest() override = default; @@ -760,11 +489,8 @@ IN_PROC_BROWSER_TEST_F(SyncConsentActiveDirectoryTest, LoginDoesNotStartSync) { "test-user@locally-managed.localhost", "password"); test::WaitForPrimaryUserSessionStart(); - // OS sync is off. - syncer::SyncUserSettings* settings = GetSyncUserSettings(); - EXPECT_FALSE(settings->IsOsSyncFeatureEnabled()); - // Browser sync is off. + syncer::SyncUserSettings* settings = GetSyncUserSettings(); EXPECT_FALSE(settings->IsSyncRequested()); EXPECT_FALSE(settings->IsFirstSetupComplete()); diff --git a/chrome/browser/ash/login/screens/sync_consent_screen.cc b/chrome/browser/ash/login/screens/sync_consent_screen.cc index e22228406cb42a..e32ceb35b83162 100644 --- a/chrome/browser/ash/login/screens/sync_consent_screen.cc +++ b/chrome/browser/ash/login/screens/sync_consent_screen.cc @@ -215,8 +215,7 @@ void SyncConsentScreen::OnStateChanged(syncer::SyncService* sync) { UpdateScreen(*context()); } -// TODO(https://crbug.com/1229582) Break SplitSettings names into -// SyncConsentOptional and SyncSettingsCategorization in the whole file. +// TODO(https://crbug.com/1229582) Remove SplitSettings from names in this file. void SyncConsentScreen::OnNonSplitSettingsContinue( const bool opted_in, const bool review_sync, @@ -237,64 +236,6 @@ void SyncConsentScreen::OnNonSplitSettingsContinue( Finish(Result::NEXT); } -void SyncConsentScreen::OnContinue( - const std::vector& consent_description, - int consent_confirmation, - SyncConsentScreenHandler::UserChoice choice) { - DCHECK(features::IsSyncConsentOptionalEnabled()); - if (is_hidden()) - return; - base::UmaHistogramEnumeration("OOBE.SyncConsentScreen.UserChoice", choice); - // Record that the user saw the consent text, regardless of which features - // they chose to enable. - RecordConsent(CONSENT_GIVEN, consent_description, consent_confirmation); - bool enable_sync = choice == SyncConsentScreenHandler::UserChoice::kAccepted; - UpdateSyncSettings(enable_sync); - Finish(Result::NEXT); -} - -void SyncConsentScreen::UpdateSyncSettings(bool enable_sync) { - DCHECK(features::IsSyncConsentOptionalEnabled()); - DCHECK(features::IsSyncSettingsCategorizationEnabled()); - // For historical reasons, Chrome OS always has a "sync-consented" primary - // account in IdentityManager and always has browser sync "enabled". If the - // user disables the browser sync toggle we disable all browser data types, - // as if the user had opened browser sync settings and turned off all the - // toggles. - // TODO(crbug.com/1046746, crbug.com/1050677): Once all Chrome OS code is - // converted to the "consent aware" IdentityManager API, and the browser sync - // settings WebUI is converted to allow browser sync to be turned on/off, then - // this workaround can be removed. - syncer::SyncService* sync_service = GetSyncService(profile_); - if (sync_service) { - syncer::SyncUserSettings* sync_settings = sync_service->GetUserSettings(); - sync_settings->SetOsSyncFeatureEnabled(enable_sync); - if (!enable_sync) { - syncer::UserSelectableTypeSet empty_set; - sync_settings->SetSelectedTypes(/*sync_everything=*/false, empty_set); - } - // TODO(crbug.com/1229582) Revisit the logic in case !enable_sync. - sync_settings->SetSyncRequested(true); - sync_settings->SetFirstSetupComplete( - syncer::SyncFirstSetupCompleteSource::BASIC_FLOW); - } - // Set a "sync-consented" primary account. See comment above. - auto* identity_manager = IdentityManagerFactory::GetForProfile(profile_); - CoreAccountId account_id = - identity_manager->GetPrimaryAccountId(signin::ConsentLevel::kSignin); - DCHECK(!account_id.empty()); - identity_manager->GetPrimaryAccountMutator()->SetPrimaryAccount( - account_id, signin::ConsentLevel::kSync); - - // Only enable URL-keyed metrics if the user turned on browser sync. - if (enable_sync) { - unified_consent::UnifiedConsentService* consent_service = - UnifiedConsentServiceFactory::GetForProfile(profile_); - if (consent_service) - consent_service->SetUrlKeyedAnonymizedDataCollectionEnabled(true); - } -} - void SyncConsentScreen::MaybeEnableSyncForSkip() { // "sync everything" toggle is disabled during SyncService creation. We need // to turn it on if sync service needs to be enabled. @@ -311,15 +252,9 @@ void SyncConsentScreen::MaybeEnableSyncForSkip() { case SyncScreenBehavior::kSkipAndEnableNonBrandedBuild: case SyncScreenBehavior::kSkipAndEnableEmphemeralUser: case SyncScreenBehavior::kSkipAndEnableScreenPolicy: - // Prior to SyncConsentOptional, sync is autostarted during SyncService + // Sync is autostarted during SyncService // creation with "sync everything" toggle off. We need to turn it on here. - // For SyncConsentOptional, we also need to update other sync-related - // flags. - if (features::IsSyncConsentOptionalEnabled()) { - UpdateSyncSettings(/*enable_sync=*/true); - } else { - SetSyncEverythingEnabled(/*enabled=*/true); - } + SetSyncEverythingEnabled(/*enabled=*/true); return; } } diff --git a/chrome/browser/ash/login/screens/sync_consent_screen.h b/chrome/browser/ash/login/screens/sync_consent_screen.h index 2fb49521249e50..ce0ee1db0be02f 100644 --- a/chrome/browser/ash/login/screens/sync_consent_screen.h +++ b/chrome/browser/ash/login/screens/sync_consent_screen.h @@ -107,14 +107,6 @@ class SyncConsentScreen : public BaseScreen, const std::vector& consent_description, const int consent_confirmation); - // Reacts to "Yes, I'm in" and "No, thanks". - void OnContinue(const std::vector& consent_description, - int consent_confirmation, - SyncConsentScreenHandler::UserChoice choice); - - // Configures OS sync and browser sync. - void UpdateSyncSettings(bool enable_sync); - // Enables sync if required when skipping the dialog. void MaybeEnableSyncForSkip(); diff --git a/chrome/browser/ash/login/screens/terms_of_service_screen.cc b/chrome/browser/ash/login/screens/terms_of_service_screen.cc index f694cfe1eeb0fc..627cd9b4e9f833 100644 --- a/chrome/browser/ash/login/screens/terms_of_service_screen.cc +++ b/chrome/browser/ash/login/screens/terms_of_service_screen.cc @@ -13,6 +13,7 @@ #include "base/files/file_util.h" #include "base/files/important_file_writer.h" #include "base/location.h" +#include "base/no_destructor.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "base/time/time.h" diff --git a/chrome/browser/ash/login/session/user_session_manager.cc b/chrome/browser/ash/login/session/user_session_manager.cc index 07b58b21bce48c..de97b0507ac15e 100644 --- a/chrome/browser/ash/login/session/user_session_manager.cc +++ b/chrome/browser/ash/login/session/user_session_manager.cc @@ -1420,33 +1420,12 @@ void UserSessionManager::InitProfilePreferences( accounts_mutator->SeedAccountInfo(gaia_id, user->GetDisplayEmail()); // 3. Set it as the Primary Account. - if (features::IsSyncConsentOptionalEnabled()) { - // In theory this should only be done for new profiles. However, if user - // profile prefs failed to save or the prefs are corrupted by a crash then - // the IdentityManager will start up without a primary account. See test - // CrashRestoreComplexTest.RestoreSessionForThreeUsers. - if (!identity_manager->HasPrimaryAccount(ConsentLevel::kSignin)) { - // Set the account without recording browser sync consent. - identity_manager->GetPrimaryAccountMutator()->SetPrimaryAccount( - account_id, ConsentLevel::kSignin); - } + identity_manager->GetPrimaryAccountMutator()->SetPrimaryAccount( + account_id, ConsentLevel::kSync); - CHECK(identity_manager->HasPrimaryAccount(ConsentLevel::kSignin)); - CHECK_EQ( - identity_manager->GetPrimaryAccountInfo(ConsentLevel::kSignin).gaia, - gaia_id); - } else { - // Set a primary account here because the profile might have been - // created with the feature SyncConsentOptional enabled. Then the - // profile might only have an unconsented primary account. - identity_manager->GetPrimaryAccountMutator()->SetPrimaryAccount( - account_id, ConsentLevel::kSync); - - CHECK(identity_manager->HasPrimaryAccount(ConsentLevel::kSync)); - CHECK_EQ( - identity_manager->GetPrimaryAccountInfo(ConsentLevel::kSync).gaia, - gaia_id); - } + CHECK(identity_manager->HasPrimaryAccount(ConsentLevel::kSync)); + CHECK_EQ(identity_manager->GetPrimaryAccountInfo(ConsentLevel::kSync).gaia, + gaia_id); DCHECK_EQ(account_id, identity_manager->GetPrimaryAccountId(ConsentLevel::kSignin)); @@ -1505,10 +1484,7 @@ void UserSessionManager::UserProfileInitialized(Profile* profile, return; user_profile_initialized_called_.insert(profile); - // OOBE doesn't set kOsSyncFeatureEnabled yet, call MigrateOsSyncPreferences - // to make sure it is correctly set. - // TODO(https://crbug.com/1229582): Revise when SyncConsentOptional changes - // for OOBE are implemented. + // MigrateOsSyncPreferences migrates prefs for SyncSettingsCategorization. os_sync_util::MigrateOsSyncPreferences(profile->GetPrefs()); BootTimesRecorder* btl = BootTimesRecorder::Get(); @@ -2213,8 +2189,11 @@ void UserSessionManager::DoBrowserLaunchInternal(Profile* profile, const user_manager::User* user = chromeos::ProfileHelper::Get()->GetUserByProfile(profile); - ash::BrowserDataMigrator::MaybeRestartToMigrate(user->GetAccountId(), - user->username_hash()); + if (ash::BrowserDataMigrator::MaybeRestartToMigrate(user->GetAccountId(), + user->username_hash())) { + LOG(WARNING) << "Restarting chrome to run profile migration."; + return; + } if (login_host) { login_host->SetStatusAreaVisible(true); diff --git a/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.cc b/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.cc new file mode 100644 index 00000000000000..9adc63d67f0bc7 --- /dev/null +++ b/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.cc @@ -0,0 +1,83 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h" + +#include +#include + +#include "base/guid.h" +#include "base/json/values_util.h" +#include "base/values.h" +#include "chrome/browser/ash/login/test/fake_gaia_mixin.h" +#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" +#include "chrome/browser/ash/policy/enrollment/device_cloud_policy_initializer.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_process_platform_part.h" +#include "chromeos/system/fake_statistics_provider.h" +#include "components/policy/core/common/cloud/cloud_policy_constants.h" +#include "components/policy/core/common/cloud/test/policy_builder.h" +#include "components/policy/core/common/policy_switches.h" +#include "components/policy/test_support/client_storage.h" +#include "components/policy/test_support/embedded_policy_test_server.h" +#include "components/policy/test_support/policy_storage.h" +#include "components/policy/test_support/signature_provider.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace ash { + +EmbeddedPolicyTestServerMixin::EmbeddedPolicyTestServerMixin( + InProcessBrowserTestMixinHost* host) + : InProcessBrowserTestMixin(host) {} + +EmbeddedPolicyTestServerMixin::~EmbeddedPolicyTestServerMixin() = default; + +void EmbeddedPolicyTestServerMixin::SetUp() { + InProcessBrowserTestMixin::SetUp(); + policy_test_server_ = std::make_unique(); + policy_test_server_->policy_storage()->set_robot_api_auth_code( + FakeGaiaMixin::kFakeAuthCode); + policy_test_server_->policy_storage()->add_managed_user("*"); + + // Create universal signing keys that can sign any domain. + std::vector universal_signing_keys; + universal_signing_keys.push_back(policy::SignatureProvider::SigningKey( + policy::PolicyBuilder::CreateTestSigningKey(), + {{"*", policy::PolicyBuilder::GetTestSigningKeySignature()}})); + policy_test_server_->policy_storage()->signature_provider()->set_signing_keys( + std::move(universal_signing_keys)); + + // Register default user used in many tests. + policy::ClientStorage::ClientInfo client_info; + client_info.device_id = policy::PolicyBuilder::kFakeDeviceId; + client_info.device_token = policy::PolicyBuilder::kFakeToken; + client_info.allowed_policy_types = { + policy::dm_protocol::kChromeDevicePolicyType, + policy::dm_protocol::kChromeUserPolicyType, + policy::dm_protocol::kChromePublicAccountPolicyType, + policy::dm_protocol::kChromeExtensionPolicyType, + policy::dm_protocol::kChromeSigninExtensionPolicyType, + policy::dm_protocol::kChromeMachineLevelUserCloudPolicyType, + policy::dm_protocol::kChromeMachineLevelExtensionCloudPolicyType}; + policy_test_server_->client_storage()->RegisterClient(client_info); + + CHECK(policy_test_server_->Start()); +} + +void EmbeddedPolicyTestServerMixin::SetUpCommandLine( + base::CommandLine* command_line) { + // Specify device management server URL. + command_line->AppendSwitchASCII(policy::switches::kDeviceManagementUrl, + policy_test_server_->GetServiceURL().spec()); +} + +void EmbeddedPolicyTestServerMixin::UpdateUserPolicy( + const enterprise_management::CloudPolicySettings& policy, + const std::string& policy_user) { + policy_test_server_->policy_storage()->set_policy_user(policy_user); + policy_test_server_->policy_storage()->SetPolicyPayload( + policy::dm_protocol::kChromeUserPolicyType, policy.SerializeAsString()); +} + +} // namespace ash diff --git a/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h b/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h new file mode 100644 index 00000000000000..3a217f50d7272c --- /dev/null +++ b/chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h @@ -0,0 +1,52 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_LOGIN_TEST_EMBEDDED_POLICY_TEST_SERVER_MIXIN_H_ +#define CHROME_BROWSER_ASH_LOGIN_TEST_EMBEDDED_POLICY_TEST_SERVER_MIXIN_H_ + +#include +#include + +#include "base/command_line.h" +#include "chrome/test/base/mixin_based_in_process_browser_test.h" +#include "components/policy/proto/cloud_policy.pb.h" +#include "components/policy/test_support/embedded_policy_test_server.h" + +namespace ash { + +// This test mixin covers setting up EmbeddedPolicyTestServer and adding a +// command-line flag to use it. Please see SetUp function for default settings. +// Server is started after SetUp execution. +class EmbeddedPolicyTestServerMixin : public InProcessBrowserTestMixin { + public: + explicit EmbeddedPolicyTestServerMixin(InProcessBrowserTestMixinHost* host); + + EmbeddedPolicyTestServerMixin(const EmbeddedPolicyTestServerMixin&) = delete; + EmbeddedPolicyTestServerMixin& operator=( + const EmbeddedPolicyTestServerMixin&) = delete; + + ~EmbeddedPolicyTestServerMixin() override; + + policy::EmbeddedPolicyTestServer* server() { + return policy_test_server_.get(); + } + + // InProcessBrowserTestMixin: + void SetUp() override; + void SetUpCommandLine(base::CommandLine* command_line) override; + + // Updates user policy blob served by the embedded policy test server. + // `policy_user` - the policy user's email. + void UpdateUserPolicy( + const enterprise_management::CloudPolicySettings& policy, + const std::string& policy_user); + + private: + std::unique_ptr policy_test_server_; + base::Value server_config_; +}; + +} // namespace ash + +#endif // CHROME_BROWSER_ASH_LOGIN_TEST_EMBEDDED_POLICY_TEST_SERVER_MIXIN_H_ diff --git a/chrome/browser/ash/login/test/logged_in_user_mixin.cc b/chrome/browser/ash/login/test/logged_in_user_mixin.cc index 4fd2f86e639317..73aa8c7fb855cd 100644 --- a/chrome/browser/ash/login/test/logged_in_user_mixin.cc +++ b/chrome/browser/ash/login/test/logged_in_user_mixin.cc @@ -42,7 +42,7 @@ LoggedInUserMixin::LoggedInUserMixin( bool should_launch_browser, absl::optional account_id, bool include_initial_user, - bool use_local_policy_server) + bool use_embedded_policy_server) : InProcessBrowserTestMixin(mixin_host), user_(account_id.value_or( AccountId::FromUserEmailGaiaId(FakeGaiaMixin::kFakeUserEmail, @@ -51,12 +51,13 @@ LoggedInUserMixin::LoggedInUserMixin( login_manager_(mixin_host, GetInitialUsers(user_, include_initial_user), &fake_gaia_), - local_policy_server_(mixin_host), - user_policy_(mixin_host, - user_.account_id, - use_local_policy_server ? &local_policy_server_ : nullptr), + embedded_policy_server_(mixin_host), + user_policy_( + mixin_host, + user_.account_id, + use_embedded_policy_server ? &embedded_policy_server_ : nullptr), user_policy_helper_(user_.account_id.GetUserEmail(), - &local_policy_server_), + &embedded_policy_server_), embedded_test_server_setup_(mixin_host, embedded_test_server), fake_gaia_(mixin_host), test_base_(test_base) { diff --git a/chrome/browser/ash/login/test/logged_in_user_mixin.h b/chrome/browser/ash/login/test/logged_in_user_mixin.h index d6bbcc718caf99..28bb9446a1ebd9 100644 --- a/chrome/browser/ash/login/test/logged_in_user_mixin.h +++ b/chrome/browser/ash/login/test/logged_in_user_mixin.h @@ -5,9 +5,9 @@ #ifndef CHROME_BROWSER_ASH_LOGIN_TEST_LOGGED_IN_USER_MIXIN_H_ #define CHROME_BROWSER_ASH_LOGIN_TEST_LOGGED_IN_USER_MIXIN_H_ +#include "chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h" #include "chrome/browser/ash/login/test/embedded_test_server_setup_mixin.h" #include "chrome/browser/ash/login/test/fake_gaia_mixin.h" -#include "chrome/browser/ash/login/test/local_policy_test_server_mixin.h" #include "chrome/browser/ash/login/test/login_manager_mixin.h" #include "chrome/browser/ash/login/test/user_policy_mixin.h" #include "chrome/browser/ash/policy/core/user_policy_test_helper.h" @@ -66,8 +66,8 @@ class LoggedInUserMixin : public InProcessBrowserTestMixin { // |include_initial_user| if true, then the user already exists on the login // screen. Otherwise, the user is newly added to the device and the OOBE Gaia // screen will show on start-up. - // |use_local_policy_server| determines if the LocalPolicyTestServerMixin - // should be passed into the UserPolicyMixin. + // |use_embedded_policy_server| determines if the + // EmbeddedPolicyTestServerMixin should be passed into the UserPolicyMixin. LoggedInUserMixin(InProcessBrowserTestMixinHost* mixin_host, LogInType type, net::EmbeddedTestServer* embedded_test_server, @@ -76,7 +76,7 @@ class LoggedInUserMixin : public InProcessBrowserTestMixin { absl::optional account_id = absl::nullopt, bool include_initial_user = true, // TODO(crbug/1112885): Remove this parameter. - bool use_local_policy_server = true); + bool use_embedded_policy_server = true); LoggedInUserMixin(const LoggedInUserMixin&) = delete; LoggedInUserMixin& operator=(const LoggedInUserMixin&) = delete; ~LoggedInUserMixin() override; @@ -99,8 +99,8 @@ class LoggedInUserMixin : public InProcessBrowserTestMixin { UserPolicyMixin* GetUserPolicyMixin() { return &user_policy_; } - LocalPolicyTestServerMixin* GetLocalPolicyTestServerMixin() { - return &local_policy_server_; + EmbeddedPolicyTestServerMixin* GetEmbeddedPolicyTestServerMixin() { + return &embedded_policy_server_; } policy::UserPolicyTestHelper* GetUserPolicyTestHelper() { @@ -115,7 +115,7 @@ class LoggedInUserMixin : public InProcessBrowserTestMixin { LoginManagerMixin::TestUserInfo user_; LoginManagerMixin login_manager_; - LocalPolicyTestServerMixin local_policy_server_; + EmbeddedPolicyTestServerMixin embedded_policy_server_; UserPolicyMixin user_policy_; policy::UserPolicyTestHelper user_policy_helper_; diff --git a/chrome/browser/ash/login/test/user_policy_mixin.cc b/chrome/browser/ash/login/test/user_policy_mixin.cc index a7bde11545de85..05ca27957b7d82 100644 --- a/chrome/browser/ash/login/test/user_policy_mixin.cc +++ b/chrome/browser/ash/login/test/user_policy_mixin.cc @@ -11,6 +11,7 @@ #include "base/files/file_path.h" #include "base/path_service.h" #include "base/threading/thread_restrictions.h" +#include "chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h" #include "chrome/browser/ash/login/test/local_policy_test_server_mixin.h" #include "chrome/common/chrome_paths.h" #include "chromeos/cryptohome/cryptohome_parameters.h" @@ -32,7 +33,14 @@ UserPolicyMixin::UserPolicyMixin(InProcessBrowserTestMixinHost* mixin_host, LocalPolicyTestServerMixin* policy_server) : InProcessBrowserTestMixin(mixin_host), account_id_(account_id), - policy_server_(policy_server) {} + local_policy_server_(policy_server) {} + +UserPolicyMixin::UserPolicyMixin(InProcessBrowserTestMixinHost* mixin_host, + const AccountId& account_id, + EmbeddedPolicyTestServerMixin* policy_server) + : InProcessBrowserTestMixin(mixin_host), + account_id_(account_id), + embedded_policy_server_(policy_server) {} UserPolicyMixin::~UserPolicyMixin() = default; @@ -103,9 +111,12 @@ void UserPolicyMixin::SetUpPolicy() { cryptohome::CreateAccountIdentifierFromAccountId(account_id_); FakeSessionManagerClient::Get()->set_user_policy(cryptohome_id, policy_blob); - if (policy_server_) { - policy_server_->UpdateUserPolicy(user_policy_builder_.payload(), - account_id_.GetUserEmail()); + if (local_policy_server_) { + local_policy_server_->UpdateUserPolicy(user_policy_builder_.payload(), + account_id_.GetUserEmail()); + } else if (embedded_policy_server_) { + embedded_policy_server_->UpdateUserPolicy(user_policy_builder_.payload(), + account_id_.GetUserEmail()); } } diff --git a/chrome/browser/ash/login/test/user_policy_mixin.h b/chrome/browser/ash/login/test/user_policy_mixin.h index ed91556308ca79..d74cba6f9c7efa 100644 --- a/chrome/browser/ash/login/test/user_policy_mixin.h +++ b/chrome/browser/ash/login/test/user_policy_mixin.h @@ -16,10 +16,11 @@ namespace ash { class LocalPolicyTestServerMixin; +class EmbeddedPolicyTestServerMixin; // Mixin for setting up user policy for a test user. // Currently supports setting cached user policy and optionally user policy -// served by local policy test server.. +// served by local or embedded policy test server.. // NOTE: This mixin will set up in-memory FakeSessionManagerClient during setup. class UserPolicyMixin : public InProcessBrowserTestMixin { public: @@ -28,6 +29,9 @@ class UserPolicyMixin : public InProcessBrowserTestMixin { UserPolicyMixin(InProcessBrowserTestMixinHost* mixin_host, const AccountId& account_id, LocalPolicyTestServerMixin* policy_server); + UserPolicyMixin(InProcessBrowserTestMixinHost* mixin_host, + const AccountId& account_id, + EmbeddedPolicyTestServerMixin* policy_server); UserPolicyMixin(const UserPolicyMixin&) = delete; UserPolicyMixin& operator=(const UserPolicyMixin&) = delete; @@ -69,7 +73,8 @@ class UserPolicyMixin : public InProcessBrowserTestMixin { // Policy server that can optionally be passed into UserPolicyMixin. If set // user policy changes done by RequestPolicyUpdate() will also be forwarded // to the policy server. - LocalPolicyTestServerMixin* policy_server_ = nullptr; + LocalPolicyTestServerMixin* local_policy_server_ = nullptr; + EmbeddedPolicyTestServerMixin* embedded_policy_server_ = nullptr; policy::UserPolicyBuilder user_policy_builder_; diff --git a/chrome/browser/ash/net/rollback_network_config/rollback_network_config_service.cc b/chrome/browser/ash/net/rollback_network_config/rollback_network_config_service.cc index ab28374de4ba56..dfc5f75e1e8a19 100644 --- a/chrome/browser/ash/net/rollback_network_config/rollback_network_config_service.cc +++ b/chrome/browser/ash/net/rollback_network_config/rollback_network_config_service.cc @@ -6,7 +6,6 @@ #include "base/check.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "chrome/browser/ash/net/rollback_network_config/rollback_network_config.h" #include "chromeos/network/network_handler.h" #include "chromeos/services/rollback_network_config/public/mojom/rollback_network_config.mojom.h" diff --git a/chrome/browser/ash/platform_keys/chaps_slot_session.cc b/chrome/browser/ash/platform_keys/chaps_slot_session.cc index f322178bf838bd..9684da5c18bc56 100644 --- a/chrome/browser/ash/platform_keys/chaps_slot_session.cc +++ b/chrome/browser/ash/platform_keys/chaps_slot_session.cc @@ -12,7 +12,6 @@ #include "base/location.h" #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "base/no_destructor.h" #include "base/threading/scoped_blocking_call.h" #include "third_party/abseil-cpp/absl/types/optional.h" diff --git a/chrome/browser/ash/platform_keys/chaps_util_impl.cc b/chrome/browser/ash/platform_keys/chaps_util_impl.cc index 9f9e289499ff66..8a01410b25fd61 100644 --- a/chrome/browser/ash/platform_keys/chaps_util_impl.cc +++ b/chrome/browser/ash/platform_keys/chaps_util_impl.cc @@ -19,7 +19,6 @@ #include "base/check.h" #include "base/cxx17_backports.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "chrome/browser/ash/platform_keys/chaps_slot_session.h" #include "crypto/chaps_support.h" diff --git a/chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.cc b/chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.cc index b1d9bbef2a878e..83ae70008b22c1 100644 --- a/chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.cc +++ b/chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_manager_impl.h" #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_service.h" #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_service_impl.h" diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.cc b/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.cc index bc0a578f5af5b1..46383e08ed509f 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_pref_names.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.cc b/chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.cc index 44971f8af9ba23..148568619ce760 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/plugin_vm/plugin_vm_manager_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_util.cc b/chrome/browser/ash/plugin_vm/plugin_vm_util.cc index 50e0fde03117d2..5ca38c4957234e 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_util.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_util.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/files/file_util.h" +#include "base/no_destructor.h" #include "base/observer_list.h" #include "base/strings/pattern.h" #include "base/strings/string_util.h" diff --git a/chrome/browser/ash/policy/core/user_policy_test_helper.cc b/chrome/browser/ash/policy/core/user_policy_test_helper.cc index 4ed1fe50e342c9..768e1ebc8bf668 100644 --- a/chrome/browser/ash/policy/core/user_policy_test_helper.cc +++ b/chrome/browser/ash/policy/core/user_policy_test_helper.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/run_loop.h" #include "base/values.h" +#include "chrome/browser/ash/login/test/embedded_policy_test_server_mixin.h" #include "chrome/browser/ash/login/test/local_policy_test_server_mixin.h" #include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/browser_process.h" @@ -21,6 +22,7 @@ #include "components/policy/core/common/cloud/cloud_policy_core.h" #include "components/policy/core/common/policy_service.h" #include "components/policy/core/common/policy_switches.h" +#include "components/policy/proto/cloud_policy.pb.h" #include "components/policy/proto/device_management_backend.pb.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -32,14 +34,27 @@ UserPolicyTestHelper::UserPolicyTestHelper( ash::LocalPolicyTestServerMixin* local_policy_server) : account_id_(account_id), local_policy_server_(local_policy_server) {} +UserPolicyTestHelper::UserPolicyTestHelper( + const std::string& account_id, + ash::EmbeddedPolicyTestServerMixin* embedded_policy_server) + : account_id_(account_id), + embedded_policy_server_(embedded_policy_server) {} + UserPolicyTestHelper::~UserPolicyTestHelper() {} void UserPolicyTestHelper::SetPolicy(const base::Value& mandatory, const base::Value& recommended) { + DCHECK(local_policy_server_); ASSERT_TRUE(local_policy_server_->UpdateUserPolicy(mandatory, recommended, account_id_)); } +void UserPolicyTestHelper::SetPolicy( + const enterprise_management::CloudPolicySettings& policy) { + DCHECK(embedded_policy_server_); + embedded_policy_server_->UpdateUserPolicy(policy, account_id_); +} + void UserPolicyTestHelper::WaitForInitialPolicy(Profile* profile) { BrowserPolicyConnector* const connector = g_browser_process->browser_policy_connector(); @@ -77,6 +92,13 @@ void UserPolicyTestHelper::SetPolicyAndWait( RefreshPolicyAndWait(profile); } +void UserPolicyTestHelper::SetPolicyAndWait( + const enterprise_management::CloudPolicySettings& policy, + Profile* profile) { + SetPolicy(policy); + RefreshPolicyAndWait(profile); +} + void UserPolicyTestHelper::RefreshPolicyAndWait(Profile* profile) { policy::ProfilePolicyConnector* const profile_connector = profile->GetProfilePolicyConnector(); diff --git a/chrome/browser/ash/policy/core/user_policy_test_helper.h b/chrome/browser/ash/policy/core/user_policy_test_helper.h index 8f7c9acf66fd76..c706f0e56bc36f 100644 --- a/chrome/browser/ash/policy/core/user_policy_test_helper.h +++ b/chrome/browser/ash/policy/core/user_policy_test_helper.h @@ -13,13 +13,18 @@ class Profile; namespace ash { +class EmbeddedPolicyTestServerMixin; class LocalPolicyTestServerMixin; -} +} // namespace ash namespace base { class Value; } +namespace enterprise_management { +class CloudPolicySettings; +} + namespace policy { // This class can be used to apply a user policy to the profile in a @@ -28,13 +33,19 @@ class UserPolicyTestHelper { public: UserPolicyTestHelper(const std::string& account_id, ash::LocalPolicyTestServerMixin* local_policy_server); + UserPolicyTestHelper( + const std::string& account_id, + ash::EmbeddedPolicyTestServerMixin* embedded_policy_server); UserPolicyTestHelper(const UserPolicyTestHelper&) = delete; UserPolicyTestHelper& operator=(const UserPolicyTestHelper&) = delete; virtual ~UserPolicyTestHelper(); + // Can only be used when constructed with LocalPolicyTestServerMixin. void SetPolicy(const base::Value& mandatory, const base::Value& recommended); + // Can only be used when constructed with EmbeddedPolicyTestServerMixin. + void SetPolicy(const enterprise_management::CloudPolicySettings& policy); // Can be optionally used to wait for the initial policy to be applied to the // profile. Alternatively, a login can be simulated, which makes it @@ -42,17 +53,26 @@ class UserPolicyTestHelper { void WaitForInitialPolicy(Profile* profile); // Updates the policy test server with the given policy. Then calls - // RefreshPolicyAndWait(). + // RefreshPolicyAndWait(). Can only be used when constructed with + // LocalPolicyTestServerMixin. void SetPolicyAndWait(const base::Value& mandatory_policy, const base::Value& recommended_policy, Profile* profile); + // Updates the policy test server with the given policy. Then calls + // RefreshPolicyAndWait(). Can only be used when constructed with + // EmbeddedPolicyTestServerMixin. + void SetPolicyAndWait( + const enterprise_management::CloudPolicySettings& policy, + Profile* profile); + // Refreshes and waits for the new policy being applied to |profile|. void RefreshPolicyAndWait(Profile* profile); private: const std::string account_id_; - ash::LocalPolicyTestServerMixin* local_policy_server_; + ash::LocalPolicyTestServerMixin* local_policy_server_ = nullptr; + ash::EmbeddedPolicyTestServerMixin* embedded_policy_server_ = nullptr; }; } // namespace policy diff --git a/chrome/browser/ash/power/ml/smart_dim/ml_agent.cc b/chrome/browser/ash/power/ml/smart_dim/ml_agent.cc index 7d1bcad6541e5d..553bc9ca78f98b 100644 --- a/chrome/browser/ash/power/ml/smart_dim/ml_agent.cc +++ b/chrome/browser/ash/power/ml/smart_dim/ml_agent.cc @@ -10,6 +10,7 @@ #include "ash/constants/ash_features.h" #include "base/containers/flat_map.h" #include "base/metrics/field_trial_params.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/power/ml/smart_dim/metrics.h" #include "chrome/browser/ash/power/ml/smart_dim/ml_agent_util.h" #include "chrome/browser/ash/power/ml/user_activity_ukm_logger_helpers.h" diff --git a/chrome/browser/ash/preferences.cc b/chrome/browser/ash/preferences.cc index f1d4709ffa0f1d..fb8f10f52af7d4 100644 --- a/chrome/browser/ash/preferences.cc +++ b/chrome/browser/ash/preferences.cc @@ -37,7 +37,6 @@ #include "chrome/browser/ash/login/session/user_session_manager.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/cros_settings.h" -#include "chrome/browser/ash/sync/sync_consent_optional_field_trial.h" #include "chrome/browser/ash/system/input_device_settings.h" #include "chrome/browser/ash/system/timezone_resolver_manager.h" #include "chrome/browser/ash/system/timezone_util.h" @@ -145,7 +144,6 @@ void Preferences::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(prefs::kLoginScreenWebUILazyLoading, false); RegisterLocalStatePrefs(registry); - sync_consent_optional_field_trial::RegisterLocalStatePrefs(registry); } // static diff --git a/chrome/browser/ash/printing/bulk_printers_calculator_factory.cc b/chrome/browser/ash/printing/bulk_printers_calculator_factory.cc index cfb82ebc921d6c..483d898800bc6b 100644 --- a/chrome/browser/ash/printing/bulk_printers_calculator_factory.cc +++ b/chrome/browser/ash/printing/bulk_printers_calculator_factory.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ash/printing/bulk_printers_calculator_factory.h" -#include "base/no_destructor.h" #include "chrome/browser/ash/printing/bulk_printers_calculator.h" #include "components/account_id/account_id.h" #include "components/user_manager/user.h" diff --git a/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc b/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc index a537ce3d98c043..ae4a2828788491 100644 --- a/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc +++ b/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/secure_channel/secure_channel_client_provider.h" +#include "base/no_destructor.h" #include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" #include "chromeos/services/secure_channel/secure_channel_base.h" #include "chromeos/services/secure_channel/secure_channel_initializer.h" diff --git a/chrome/browser/ash/sync/app_settings_model_type_controller.cc b/chrome/browser/ash/sync/app_settings_model_type_controller.cc index 90c59cf5cac256..b6e692fe3fd440 100644 --- a/chrome/browser/ash/sync/app_settings_model_type_controller.cc +++ b/chrome/browser/ash/sync/app_settings_model_type_controller.cc @@ -33,11 +33,6 @@ AppSettingsModelTypeController::AppSettingsModelTypeController( DCHECK(chromeos::features::IsSyncSettingsCategorizationEnabled()); DCHECK(profile_); DCHECK(sync_service_); - pref_registrar_.Init(profile_->GetPrefs()); - pref_registrar_.Add( - syncer::prefs::kOsSyncFeatureEnabled, - base::BindRepeating(&AppSettingsModelTypeController::OnUserPrefChanged, - base::Unretained(this))); } AppSettingsModelTypeController::~AppSettingsModelTypeController() = default; @@ -51,16 +46,3 @@ void AppSettingsModelTypeController::LoadModels( NonUiSyncableServiceBasedModelTypeController::LoadModels(configure_context, model_load_callback); } - -syncer::DataTypeController::PreconditionState -AppSettingsModelTypeController::GetPreconditionState() const { - DCHECK(CalledOnValidThread()); - return profile_->GetPrefs()->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled) - ? PreconditionState::kPreconditionsMet - : PreconditionState::kMustStopAndClearData; -} - -void AppSettingsModelTypeController::OnUserPrefChanged() { - DCHECK(CalledOnValidThread()); - sync_service_->DataTypePreconditionChanged(type()); -} diff --git a/chrome/browser/ash/sync/app_settings_model_type_controller.h b/chrome/browser/ash/sync/app_settings_model_type_controller.h index 9df24a0bcae940..652be105c1e030 100644 --- a/chrome/browser/ash/sync/app_settings_model_type_controller.h +++ b/chrome/browser/ash/sync/app_settings_model_type_controller.h @@ -39,15 +39,10 @@ class AppSettingsModelTypeController // DataTypeController: void LoadModels(const syncer::ConfigureContext& configure_context, const ModelLoadCallback& model_load_callback) override; - PreconditionState GetPreconditionState() const override; private: - // Callback for changes to the OS sync feature enabled pref. - void OnUserPrefChanged(); - Profile* const profile_; syncer::SyncService* const sync_service_; - PrefChangeRegistrar pref_registrar_; }; #endif // CHROME_BROWSER_ASH_SYNC_APP_SETTINGS_MODEL_TYPE_CONTROLLER_H_ diff --git a/chrome/browser/ash/sync/os_sync_model_type_controller.cc b/chrome/browser/ash/sync/os_sync_model_type_controller.cc index 9564c29e2a3fe8..fc1b79ff8f17e6 100644 --- a/chrome/browser/ash/sync/os_sync_model_type_controller.cc +++ b/chrome/browser/ash/sync/os_sync_model_type_controller.cc @@ -32,24 +32,6 @@ OsSyncModelTypeController::OsSyncModelTypeController( DCHECK(chromeos::features::IsSyncSettingsCategorizationEnabled()); DCHECK(pref_service_); DCHECK(sync_service_); - pref_registrar_.Init(pref_service_); - pref_registrar_.Add( - syncer::prefs::kOsSyncFeatureEnabled, - base::BindRepeating(&OsSyncModelTypeController::OnUserPrefChanged, - base::Unretained(this))); } OsSyncModelTypeController::~OsSyncModelTypeController() = default; - -syncer::DataTypeController::PreconditionState -OsSyncModelTypeController::GetPreconditionState() const { - DCHECK(CalledOnValidThread()); - return pref_service_->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled) - ? PreconditionState::kPreconditionsMet - : PreconditionState::kMustStopAndClearData; -} - -void OsSyncModelTypeController::OnUserPrefChanged() { - DCHECK(CalledOnValidThread()); - sync_service_->DataTypePreconditionChanged(type()); -} diff --git a/chrome/browser/ash/sync/os_sync_model_type_controller.h b/chrome/browser/ash/sync/os_sync_model_type_controller.h index 3307acc8cff008..7dfdf6059d8104 100644 --- a/chrome/browser/ash/sync/os_sync_model_type_controller.h +++ b/chrome/browser/ash/sync/os_sync_model_type_controller.h @@ -17,8 +17,8 @@ class ModelTypeControllerDelegate; class SyncService; } // namespace syncer -// Controls sync of Chrome OS ModelTypes that can run in transport-mode and -// depend on the system-wide kOsSyncFeatureEnabled preference. +// Controls sync of Chrome OS ModelTypes that can run in transport-mode. +// TODO(https://crbug.com/1274802): Remove this. class OsSyncModelTypeController : public syncer::ModelTypeController { public: OsSyncModelTypeController(syncer::ModelType type, @@ -34,17 +34,12 @@ class OsSyncModelTypeController : public syncer::ModelTypeController { OsSyncModelTypeController& operator=(const OsSyncModelTypeController&) = delete; - // DataTypeController: - PreconditionState GetPreconditionState() const override; - private: // Callback for changes to the OS sync feature enabled pref. void OnUserPrefChanged(); PrefService* const pref_service_; syncer::SyncService* const sync_service_; - - PrefChangeRegistrar pref_registrar_; }; #endif // CHROME_BROWSER_ASH_SYNC_OS_SYNC_MODEL_TYPE_CONTROLLER_H_ diff --git a/chrome/browser/ash/sync/os_sync_util.cc b/chrome/browser/ash/sync/os_sync_util.cc index 97cc2b09541f8e..ccc59426591b3e 100644 --- a/chrome/browser/ash/sync/os_sync_util.cc +++ b/chrome/browser/ash/sync/os_sync_util.cc @@ -13,36 +13,14 @@ namespace os_sync_util { namespace { -void MaybeMigratePreferencesForSyncConsentOptional(PrefService* prefs) { - DCHECK(chromeos::features::IsSyncSettingsCategorizationEnabled()); - - if (!ash::features::IsSyncConsentOptionalEnabled()) { - // Always enable the OS sync if SyncConsentOptional is disabled. Before the - // SyncConsentOptional launch it's impossible to disable/enable the OS sync - // from the UI. - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, true); - return; - } - - // TODO(https://crbug.com/1246357) Add a migration code here. To handle switch - // between SyncConsentOptional being disabled and enabled - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, false); -} - // Returns true if the prefs were migrated. bool MaybeMigratePreferencesForSyncSettingsCategorization(PrefService* prefs) { // Migration code can be removed when SyncSettingsCategorization has been // fully deployed to stable channel for a couple milestones. if (!chromeos::features::IsSyncSettingsCategorizationEnabled()) { - // SyncSettingsCategorization should be launched before SyncConsentOptional. - DCHECK(!chromeos::features::IsSyncConsentOptionalEnabled()); - // Reset the migration flag because this might be a rollback of the feature. // We want migration to happen again when the feature is enabled. prefs->SetBoolean(syncer::prefs::kOsSyncPrefsMigrated, false); - // Reset the OS sync pref to its default state, such that we get the same - // migration behavior next time SyncSettingsCategorization is enabled. - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, false); prefs->ClearPref(syncer::prefs::kSyncAllOsTypes); prefs->ClearPref(syncer::prefs::kSyncOsApps); @@ -78,8 +56,6 @@ bool MaybeMigratePreferencesForSyncSettingsCategorization(PrefService* prefs) { migrated_this_time = true; } - MaybeMigratePreferencesForSyncConsentOptional(prefs); - return migrated_this_time; } diff --git a/chrome/browser/ash/sync/os_sync_util_unittest.cc b/chrome/browser/ash/sync/os_sync_util_unittest.cc index 329fddd15fd5ee..cf147652cae2f5 100644 --- a/chrome/browser/ash/sync/os_sync_util_unittest.cc +++ b/chrome/browser/ash/sync/os_sync_util_unittest.cc @@ -33,7 +33,6 @@ class OsSyncUtilTest : public testing::Test { TEST_F(OsSyncUtilTest, SimpleMigration) { os_sync_util::MigrateOsSyncPreferences(&prefs_); EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncPrefsMigrated)); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); EXPECT_TRUE(prefs_.GetBoolean(sp::kSyncAllOsTypes)); } @@ -61,36 +60,6 @@ TEST_F(OsSyncUtilTest, MigrationForWallpaperRequiresApps) { EXPECT_FALSE(prefs_.GetBoolean(csp::kSyncOsWallpaper)); } -TEST_F(OsSyncUtilTest, SyncAppsEnablesOsSyncFeature) { - prefs_.SetBoolean(sp::kSyncKeepEverythingSynced, false); - prefs_.SetBoolean(sp::kSyncApps, true); - os_sync_util::MigrateOsSyncPreferences(&prefs_); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); -} - -TEST_F(OsSyncUtilTest, SyncPreferencesEnablesOsSyncFeature) { - prefs_.SetBoolean(sp::kSyncKeepEverythingSynced, false); - prefs_.SetBoolean(sp::kSyncPreferences, true); - os_sync_util::MigrateOsSyncPreferences(&prefs_); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); -} - -TEST_F(OsSyncUtilTest, SyncWallpaperEnablesOsSyncFeature) { - prefs_.SetBoolean(sp::kSyncKeepEverythingSynced, false); - prefs_.SetBoolean(sp::kSyncApps, true); - prefs_.SetBoolean(sp::kSyncThemes, true); - os_sync_util::MigrateOsSyncPreferences(&prefs_); - ASSERT_TRUE(prefs_.GetBoolean(csp::kSyncOsWallpaper)); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); -} - -TEST_F(OsSyncUtilTest, SyncWifiEnablesOsSyncFeature) { - prefs_.SetBoolean(sp::kSyncKeepEverythingSynced, false); - prefs_.SetBoolean(sp::kSyncWifiConfigurations, true); - os_sync_util::MigrateOsSyncPreferences(&prefs_); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); -} - TEST_F(OsSyncUtilTest, MigrationOnlyHappensOnce) { // Do initial migration. os_sync_util::MigrateOsSyncPreferences(&prefs_); @@ -118,7 +87,6 @@ TEST_F(OsSyncUtilTest, Rollback) { // Do initial migration. os_sync_util::MigrateOsSyncPreferences(&prefs_); EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncPrefsMigrated)); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); { // Simulate disabling the feature (e.g. disabling via Finch). @@ -129,7 +97,6 @@ TEST_F(OsSyncUtilTest, Rollback) { // OS sync is marked as not migrated. EXPECT_FALSE(prefs_.GetBoolean(sp::kOsSyncPrefsMigrated)); - EXPECT_FALSE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); } // Simulate re-enabling the feature. @@ -141,7 +108,6 @@ TEST_F(OsSyncUtilTest, Rollback) { // OS sync is marked as migrated. EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncPrefsMigrated)); - EXPECT_TRUE(prefs_.GetBoolean(sp::kOsSyncFeatureEnabled)); } } diff --git a/chrome/browser/ash/sync/os_syncable_service_model_type_controller.cc b/chrome/browser/ash/sync/os_syncable_service_model_type_controller.cc index 2a2d1dc8f9d176..30e3a2a63c0cf0 100644 --- a/chrome/browser/ash/sync/os_syncable_service_model_type_controller.cc +++ b/chrome/browser/ash/sync/os_syncable_service_model_type_controller.cc @@ -39,27 +39,7 @@ OsSyncableServiceModelTypeController::OsSyncableServiceModelTypeController( type == syncer::OS_PRIORITY_PREFERENCES); DCHECK(pref_service_); DCHECK(sync_service_); - - pref_registrar_.Init(pref_service_); - pref_registrar_.Add( - syncer::prefs::kOsSyncFeatureEnabled, - base::BindRepeating( - &OsSyncableServiceModelTypeController::OnUserPrefChanged, - base::Unretained(this))); } OsSyncableServiceModelTypeController::~OsSyncableServiceModelTypeController() = default; - -syncer::DataTypeController::PreconditionState -OsSyncableServiceModelTypeController::GetPreconditionState() const { - DCHECK(CalledOnValidThread()); - return pref_service_->GetBoolean(syncer::prefs::kOsSyncFeatureEnabled) - ? PreconditionState::kPreconditionsMet - : PreconditionState::kMustStopAndClearData; -} - -void OsSyncableServiceModelTypeController::OnUserPrefChanged() { - DCHECK(CalledOnValidThread()); - sync_service_->DataTypePreconditionChanged(type()); -} diff --git a/chrome/browser/ash/sync/os_syncable_service_model_type_controller.h b/chrome/browser/ash/sync/os_syncable_service_model_type_controller.h index 9eb77bd4d76aa1..efac89607c1cb3 100644 --- a/chrome/browser/ash/sync/os_syncable_service_model_type_controller.h +++ b/chrome/browser/ash/sync/os_syncable_service_model_type_controller.h @@ -21,6 +21,7 @@ class SyncService; // Controls syncing of Chrome OS ModelTypes that run in sync transport-only // mode and are tied to the OS sync feature consent (APP_LIST, OS_PREFERENCES, // and OS_PRIORITY_PREFERENCES). +// TODO(https://crbug.com/1274802): Remove this. class OsSyncableServiceModelTypeController : public syncer::SyncableServiceBasedModelTypeController { public: @@ -39,17 +40,9 @@ class OsSyncableServiceModelTypeController OsSyncableServiceModelTypeController& operator=( const OsSyncableServiceModelTypeController&) = delete; - // DataTypeController: - PreconditionState GetPreconditionState() const override; - private: - // Callback for changes to the OS sync feature enabled pref. - void OnUserPrefChanged(); - PrefService* const pref_service_; syncer::SyncService* const sync_service_; - - PrefChangeRegistrar pref_registrar_; }; #endif // CHROME_BROWSER_ASH_SYNC_OS_SYNCABLE_SERVICE_MODEL_TYPE_CONTROLLER_H_ diff --git a/chrome/browser/ash/sync/sync_consent_optional_field_trial.cc b/chrome/browser/ash/sync/sync_consent_optional_field_trial.cc deleted file mode 100644 index 7aff1815866e70..00000000000000 --- a/chrome/browser/ash/sync/sync_consent_optional_field_trial.cc +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ash/sync/sync_consent_optional_field_trial.h" - -#include "ash/constants/ash_features.h" -#include "base/feature_list.h" -#include "base/metrics/field_trial.h" -#include "base/strings/string_number_conversions.h" -#include "chrome/common/channel_info.h" -#include "components/prefs/pref_registry_simple.h" -#include "components/prefs/pref_service.h" -#include "components/variations/variations_associated_data.h" -#include "components/version_info/version_info.h" - -namespace sync_consent_optional_field_trial { -namespace { - -// String local state preference with the name of the assigned trial group. -// Empty if no group has been assigned yet. -const char kTrialGroupPrefName[] = "sync_consent_optional.trial_group"; - -// The field trial name. -const char kTrialName[] = "SyncConsentOptional"; - -// Group names for the trial. -const char kEnabledGroup[] = "Enabled"; -const char kDisabledGroup[] = "Disabled"; -const char kDefaultGroup[] = "Default"; - -// Probabilities for all field trial groups add up to kTotalProbability. -const base::FieldTrial::Probability kTotalProbability = 100; - -// Creates the field trial. -scoped_refptr CreateFieldTrial() { - return base::FieldTrialList::FactoryGetFieldTrial( - kTrialName, kTotalProbability, kDefaultGroup, - base::FieldTrial::ONE_TIME_RANDOMIZED, - /*default_group_number=*/nullptr); -} - -// Sets the feature state based on the trial group. Defaults to disabled. -void SetFeatureState(base::FeatureList* feature_list, - base::FieldTrial* trial, - const std::string& group_name) { - base::FeatureList::OverrideState feature_state = - group_name == kEnabledGroup ? base::FeatureList::OVERRIDE_ENABLE_FEATURE - : base::FeatureList::OVERRIDE_DISABLE_FEATURE; - feature_list->RegisterFieldTrialOverride( - chromeos::features::kSyncConsentOptional.name, feature_state, trial); -} - -// Creates a trial for the first run (when there is no variations seed) and -// enables the feature based on the randomly selected trial group. Returns the -// group name. -std::string CreateFirstRunTrial(base::FeatureList* feature_list) { - int enabled_percent; - int disabled_percent; - int default_percent; - switch (chrome::GetChannel()) { - case version_info::Channel::UNKNOWN: - case version_info::Channel::CANARY: - case version_info::Channel::DEV: - case version_info::Channel::BETA: - // Field trial is disabled due to b/171471530. - // TODO(khorimoto): Re-enable the trial once the underlying issue is - // fixed. - enabled_percent = 0; - disabled_percent = 0; - default_percent = 100; - break; - case version_info::Channel::STABLE: - // Disabled on Stable pending approval (see https://crbug.com/1020731). - // Note that this code is not currently accessed on Stable channel due to - // the early return in Create() below. - enabled_percent = 0; - disabled_percent = 0; - default_percent = 100; - break; - } - DCHECK_EQ(kTotalProbability, - enabled_percent + disabled_percent + default_percent); - - // Set up the trial and groups. - scoped_refptr trial = CreateFieldTrial(); - trial->AppendGroup(kEnabledGroup, enabled_percent); - trial->AppendGroup(kDisabledGroup, disabled_percent); - trial->AppendGroup(kDefaultGroup, default_percent); - - // Finalize the group choice and set the feature state. - const std::string& group_name = trial->GetGroupNameWithoutActivation(); - SetFeatureState(feature_list, trial.get(), group_name); - return group_name; -} - -// Creates a trial with a single group and sets the feature flag to the state -// for that group. -void CreateSubsequentRunTrial(base::FeatureList* feature_list, - const std::string& group_name) { - scoped_refptr trial = CreateFieldTrial(); - trial->AppendGroup(group_name, kTotalProbability); - SetFeatureState(feature_list, trial.get(), group_name); -} - -} // namespace - -void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { - registry->RegisterStringPref(kTrialGroupPrefName, std::string()); -} - -void Create(base::FeatureList* feature_list, PrefService* local_state) { - // TODO(https://crbug.com/1246357): Uncomment the function body for the - // SyncConsentOptional launch. - /* - // This field trial is only intended to be run on Canary/Dev/Beta channels. - // If the user is on Stable channel, return early so that they are not opted - // into this experiment. Without this return, users who were opted into the - // experiment on Canary/Dev/Beta, then changed to Stable, could still be in - // the experiment. See https://crbug.com/1147325. - if (chrome::GetChannel() == version_info::Channel::STABLE) - return; - - std::string trial_group = local_state->GetString(kTrialGroupPrefName); - if (trial_group.empty()) { - // No group assigned, this is the first run. - trial_group = CreateFirstRunTrial(feature_list); - // Persist the assigned group for subsequent runs. - local_state->SetString(kTrialGroupPrefName, trial_group); - } else { - // Group already assigned. - - // Field trial is disabled due to b/171471530. Override the existing trial - // and use kDefaultGroup instead. - // TODO(khorimoto): Remove the line below once the underlying issue from - // b/171471530 is fixed. - trial_group = kDefaultGroup; - - CreateSubsequentRunTrial(feature_list, trial_group); - } - */ -} - -} // namespace sync_consent_optional_field_trial diff --git a/chrome/browser/ash/sync/sync_consent_optional_field_trial.h b/chrome/browser/ash/sync/sync_consent_optional_field_trial.h deleted file mode 100644 index af242e47bf4add..00000000000000 --- a/chrome/browser/ash/sync/sync_consent_optional_field_trial.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_ASH_SYNC_SYNC_CONSENT_OPTIONAL_FIELD_TRIAL_H_ -#define CHROME_BROWSER_ASH_SYNC_SYNC_CONSENT_OPTIONAL_FIELD_TRIAL_H_ - -class PrefRegistrySimple; -class PrefService; - -namespace base { -class FeatureList; -} // namespace base - -namespace sync_consent_optional_field_trial { - -// Registers preferences. -void RegisterLocalStatePrefs(PrefRegistrySimple* registry); - -// Creates a field trial to control the SyncConsentOptional feature. The trial -// is client controlled because SyncConsentOptional controls the out-of-box -// experience (OOBE) sync consent dialog, which shows up before a variations -// seed is available. -// -// The trial group chosen on first run is persisted to local state prefs and -// reused on subsequent runs. This keeps the in-session sync settings UI stable -// between runs. Local state prefs can be reset via powerwash, which will result -// in re-randomization, but this also sends the user through the first-run flow -// again and they will see the appropriate consent flow. -// -// Persisting the group also avoids a subtle corner case: A user could be -// randomized to SyncConsentOptional, opt-in to sync during OOBE, then turn off -// OS sync in OS settings but leave "Sync everything" enabled in browser -// settings. If they were re-randomized to non-SyncConsentOptional on a future -// login, then the OS sync data types would go back to being controlled by -// browser sync settings, and those OS types would be re-enabled even though the -// user had them disabled. -// -// Launch bug for the SyncConsentOptional feature: https://crbug.com/1020731 -void Create(base::FeatureList* feature_list, PrefService* local_state); - -} // namespace sync_consent_optional_field_trial - -#endif // CHROME_BROWSER_ASH_SYNC_SYNC_CONSENT_OPTIONAL_FIELD_TRIAL_H_ diff --git a/chrome/browser/ash/system_logs/debug_daemon_log_source.cc b/chrome/browser/ash/system_logs/debug_daemon_log_source.cc index e94c88a2400fc4..ad5f632a23f2c8 100644 --- a/chrome/browser/ash/system_logs/debug_daemon_log_source.cc +++ b/chrome/browser/ash/system_logs/debug_daemon_log_source.cc @@ -14,7 +14,6 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/memory/weak_ptr.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/task/post_task.h" diff --git a/chrome/browser/ash/system_logs/shill_log_source.cc b/chrome/browser/ash/system_logs/shill_log_source.cc index 40432ea67e336c..f42f2e6f7cb401 100644 --- a/chrome/browser/ash/system_logs/shill_log_source.cc +++ b/chrome/browser/ash/system_logs/shill_log_source.cc @@ -8,7 +8,6 @@ #include "base/containers/contains.h" #include "base/json/json_writer.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "chromeos/components/onc/onc_utils.h" #include "chromeos/dbus/shill/shill_device_client.h" diff --git a/chrome/browser/ash/web_applications/crosh_loader_factory.cc b/chrome/browser/ash/web_applications/crosh_loader_factory.cc index 928d14abd471f4..ac76f4a57c0723 100644 --- a/chrome/browser/ash/web_applications/crosh_loader_factory.cc +++ b/chrome/browser/ash/web_applications/crosh_loader_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ash/web_applications/crosh_loader_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/web_applications/crosh_loader.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/autofill/autofill_image_fetcher_factory.cc b/chrome/browser/autofill/autofill_image_fetcher_factory.cc index 3c83828d0c8c33..50f7ebcb745d68 100644 --- a/chrome/browser/autofill/autofill_image_fetcher_factory.cc +++ b/chrome/browser/autofill/autofill_image_fetcher_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/autofill/autofill_image_fetcher_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/image_fetcher/image_decoder_impl.h" #include "chrome/browser/profiles/incognito_helpers.h" diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc index 3a84a5761ad356..3d02cc36032e40 100644 --- a/chrome/browser/autofill/autofill_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_interactive_uitest.cc @@ -2151,8 +2151,16 @@ IN_PROC_BROWSER_TEST_F(AutofillCompanyInteractiveTest, } // Test that Autofill does not fill in Company Name if disabled +// TODO(crbug.com/1279102): Flaky on Win and Mac. +#if defined(OS_WIN) || defined(OS_MAC) +#define MAYBE_NoAutofillSugggestionForCompanyName \ + DISABLED_NoAutofillSugggestionForCompanyName +#else +#define MAYBE_NoAutofillSugggestionForCompanyName \ + NoAutofillSugggestionForCompanyName +#endif IN_PROC_BROWSER_TEST_F(AutofillCompanyInteractiveTest, - NoAutofillSugggestionForCompanyName) { + MAYBE_NoAutofillSugggestionForCompanyName) { CreateTestProfile(); std::string company_name("Initech"); diff --git a/chrome/browser/bluetooth/bluetooth_chooser_context_factory.cc b/chrome/browser/bluetooth/bluetooth_chooser_context_factory.cc index dfebefef5e1dcf..87089c7457fada 100644 --- a/chrome/browser/bluetooth/bluetooth_chooser_context_factory.cc +++ b/chrome/browser/bluetooth/bluetooth_chooser_context_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/bluetooth/bluetooth_chooser_context_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc b/chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc index c6e2caacd8cfb3..02d7148cc7bf17 100644 --- a/chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc +++ b/chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/breadcrumbs/breadcrumb_manager_keyed_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "components/breadcrumbs/core/breadcrumb_manager_keyed_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/cart/fetch_discount_worker.cc b/chrome/browser/cart/fetch_discount_worker.cc index 40ecf10051eeaf..30bde5fc5abdf9 100644 --- a/chrome/browser/cart/fetch_discount_worker.cc +++ b/chrome/browser/cart/fetch_discount_worker.cc @@ -6,7 +6,6 @@ #include "base/memory/scoped_refptr.h" #include "base/metrics/field_trial_params.h" -#include "base/no_destructor.h" #include "base/task/thread_pool.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/cart/cart_discount_fetcher.h" diff --git a/chrome/browser/chrome_browser_field_trials.cc b/chrome/browser/chrome_browser_field_trials.cc index a06e7467613c99..7ba99d527fb379 100644 --- a/chrome/browser/chrome_browser_field_trials.cc +++ b/chrome/browser/chrome_browser_field_trials.cc @@ -38,7 +38,6 @@ #endif #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/sync/sync_consent_optional_field_trial.h" #include "chromeos/services/multidevice_setup/public/cpp/first_run_field_trial.h" #endif @@ -95,11 +94,6 @@ void ChromeBrowserFieldTrials::SetUpFeatureControllingFieldTrials( chromeos::multidevice_setup::CreateFirstRunFieldTrial(feature_list); #endif } -#if BUILDFLAG(IS_CHROMEOS_ASH) - // This trial is fully client controlled and must be configured whether or - // not a seed is available. - sync_consent_optional_field_trial::Create(feature_list, local_state_); -#endif } void ChromeBrowserFieldTrials::RegisterSyntheticTrials() { diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index dfd710b8435c8b..90760c852fd5a2 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -1932,11 +1932,6 @@ size_t ChromeContentBrowserClient::GetProcessCountToIgnoreForLimit() { bool ChromeContentBrowserClient::ShouldTryToUseExistingProcessHost( content::BrowserContext* browser_context, const GURL& url) { - // Only proceed for valid URLs. - // TODO(creis): This may no longer be needed. - if (!url.is_valid()) - return false; - // Top Chrome WebUI should try to share a RenderProcessHost with other // existing Top Chrome WebUI. if (IsTopChromeWebUIURL(url)) diff --git a/chrome/browser/chrome_content_browser_client_browsertest.cc b/chrome/browser/chrome_content_browser_client_browsertest.cc index 464c5e51c72a6f..68ec4312406639 100644 --- a/chrome/browser/chrome_content_browser_client_browsertest.cc +++ b/chrome/browser/chrome_content_browser_client_browsertest.cc @@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/memory/raw_ptr.h" -#include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_feature_list.h" diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 8473814eb7e27a..95265de86d43d0 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn @@ -3048,8 +3048,6 @@ source_set("chromeos") { "../ash/sync/os_sync_util.h", "../ash/sync/os_syncable_service_model_type_controller.cc", "../ash/sync/os_syncable_service_model_type_controller.h", - "../ash/sync/sync_consent_optional_field_trial.cc", - "../ash/sync/sync_consent_optional_field_trial.h", "../ash/system/automatic_reboot_manager.cc", "../ash/system/automatic_reboot_manager.h", "../ash/system/automatic_reboot_manager_observer.h", @@ -3735,6 +3733,8 @@ static_library("test_support") { "../ash/login/screens/recommend_apps/fake_recommend_apps_fetcher_delegate.h", "../ash/login/test/dialog_window_waiter.cc", "../ash/login/test/dialog_window_waiter.h", + "../ash/login/test/embedded_policy_test_server_mixin.cc", + "../ash/login/test/embedded_policy_test_server_mixin.h", "../ash/login/test/embedded_test_server_setup_mixin.cc", "../ash/login/test/embedded_test_server_setup_mixin.h", "../ash/login/test/fake_gaia_mixin.cc", diff --git a/chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.cc b/chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.cc index 6114640eaed06d..7299ef8a221618 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.cc @@ -9,6 +9,7 @@ #include "base/barrier_closure.h" #include "base/bind.h" #include "base/metrics/histogram_functions.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "chrome/browser/chromeos/extensions/login_screen/login/cleanup/browsing_data_cleanup_handler.h" #include "chrome/browser/chromeos/extensions/login_screen/login/cleanup/clipboard_cleanup_handler.h" diff --git a/chrome/browser/chromeos/extensions/login_screen/login/cleanup/extension_cleanup_handler.h b/chrome/browser/chromeos/extensions/login_screen/login/cleanup/extension_cleanup_handler.h index 4c854d254a4fcc..58c3de7cd0fcf5 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/cleanup/extension_cleanup_handler.h +++ b/chrome/browser/chromeos/extensions/login_screen/login/cleanup/extension_cleanup_handler.h @@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_LOGIN_SCREEN_LOGIN_CLEANUP_EXTENSION_CLEANUP_HANDLER_H_ #include "base/callback.h" -#include "base/no_destructor.h" #include "chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_handler.h" #include "chrome/browser/extensions/extension_service.h" diff --git a/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc b/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc index 9af2d17900c023..948a42b20b9cd8 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc @@ -417,9 +417,8 @@ class LoginApitestWithEnterpriseUser : public LoginApitest { auto registry_observer = GetTestExtensionRegistryObserver(kInSessionExtensionId); - ASSERT_TRUE( - logged_in_user_mixin_.GetLocalPolicyTestServerMixin()->UpdateUserPolicy( - user_policy_builder->payload(), account_id.GetUserEmail())); + logged_in_user_mixin_.GetEmbeddedPolicyTestServerMixin()->UpdateUserPolicy( + user_policy_builder->payload(), account_id.GetUserEmail()); session_manager_client()->set_user_policy( cryptohome::CreateAccountIdentifierFromAccountId(account_id), user_policy_builder->GetBlob()); diff --git a/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc b/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc index f9490b4e9b4926..48c3856e5320b9 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc @@ -8,6 +8,7 @@ #include "ash/components/settings/cros_settings_names.h" #include "base/bind.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/login/existing_user_controller.h" #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/chromeos/extensions/login_screen/login/cleanup/cleanup_manager.h" diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index 22f99e3779b225..98401f0fb4a914 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -265,12 +265,8 @@ void WallpaperPrivateGetSyncSettingFunction::CheckSyncServiceStatus() { // When the sync settings categorization is on, the wallpaper sync status is // stored in the kSyncOsWallpaper pref. The pref value essentially means // "themes sync is on" && "apps sync is on". - // TODO(https://crbug.com/1243218): Figure out if we need to check - // IsOsSyncFeatureEnabled here. - bool os_wallpaper_sync_enabled = - sync_service->GetUserSettings()->IsOsSyncFeatureEnabled() && - profile->GetPrefs()->GetBoolean( - chromeos::settings::prefs::kSyncOsWallpaper); + bool os_wallpaper_sync_enabled = profile->GetPrefs()->GetBoolean( + chromeos::settings::prefs::kSyncOsWallpaper); dict->SetBoolean(kSyncThemes, os_wallpaper_sync_enabled); Respond(OneArgument(base::Value::FromUniquePtrValue(std::move(dict)))); return; diff --git a/chrome/browser/chromeos/fileapi/file_change_service_factory.cc b/chrome/browser/chromeos/fileapi/file_change_service_factory.cc index 9e28207945ff98..d1f034b3f1a6b3 100644 --- a/chrome/browser/chromeos/fileapi/file_change_service_factory.cc +++ b/chrome/browser/chromeos/fileapi/file_change_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/fileapi/file_change_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/chromeos/fileapi/file_change_service.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.cc b/chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.cc index ddcc3630cb2fdb..2df4c16bef0200 100644 --- a/chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.cc +++ b/chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/printing/cups_proxy_service_manager_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/chromeos/printing/cups_proxy_service_manager.h" #include "chrome/browser/profiles/incognito_helpers.h" diff --git a/chrome/browser/chromeos/printing/printer_configurer.cc b/chrome/browser/chromeos/printing/printer_configurer.cc index 9017214bd5ceac..1b59a0566b5368 100644 --- a/chrome/browser/chromeos/printing/printer_configurer.cc +++ b/chrome/browser/chromeos/printing/printer_configurer.cc @@ -18,7 +18,6 @@ #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/metrics/histogram_functions.h" -#include "base/no_destructor.h" #include "chrome/browser/ash/printing/ppd_provider_factory.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" diff --git a/chrome/browser/commerce/coupons/coupon_service_factory.cc b/chrome/browser/commerce/coupons/coupon_service_factory.cc index ead7da1fbb8c0d..a25cdce3486567 100644 --- a/chrome/browser/commerce/coupons/coupon_service_factory.cc +++ b/chrome/browser/commerce/coupons/coupon_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/commerce/coupons/coupon_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/commerce/coupons/coupon_db.h" #include "chrome/browser/commerce/coupons/coupon_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/commerce/merchant_viewer/merchant_signal_db.cc b/chrome/browser/commerce/merchant_viewer/merchant_signal_db.cc index 217772aed37aad..f97ae1b39ec032 100644 --- a/chrome/browser/commerce/merchant_viewer/merchant_signal_db.cc +++ b/chrome/browser/commerce/merchant_viewer/merchant_signal_db.cc @@ -11,7 +11,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/containers/fixed_flat_map.h" -#include "base/no_destructor.h" #include "chrome/browser/commerce/merchant_viewer/android/jni_headers/MerchantTrustSignalsEventStorage_jni.h" #include "chrome/browser/commerce/merchant_viewer/android/jni_headers/MerchantTrustSignalsEvent_jni.h" #include "chrome/browser/commerce/merchant_viewer/merchant_signal_db_content.pb.h" diff --git a/chrome/browser/commerce/subscriptions/commerce_subscription_db.cc b/chrome/browser/commerce/subscriptions/commerce_subscription_db.cc index 8b59c6ed6013a0..adc634511a2972 100644 --- a/chrome/browser/commerce/subscriptions/commerce_subscription_db.cc +++ b/chrome/browser/commerce/subscriptions/commerce_subscription_db.cc @@ -11,7 +11,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/containers/fixed_flat_map.h" -#include "base/no_destructor.h" #include "chrome/browser/commerce/subscriptions/android/jni_headers/CommerceSubscription_jni.h" #include "chrome/browser/commerce/subscriptions/android/jni_headers/CommerceSubscriptionsStorage_jni.h" #include "chrome/browser/commerce/subscriptions/commerce_subscription_db_content.pb.h" diff --git a/chrome/browser/devtools/devtools_browser_context_manager.cc b/chrome/browser/devtools/devtools_browser_context_manager.cc index 466f3c721e3d17..1981efe98478fb 100644 --- a/chrome/browser/devtools/devtools_browser_context_manager.cc +++ b/chrome/browser/devtools/devtools_browser_context_manager.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/no_destructor.h" #include "chrome/browser/profiles/profile_destroyer.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" diff --git a/chrome/browser/devtools/devtools_browsertest.cc b/chrome/browser/devtools/devtools_browsertest.cc index fcf104dd6c26fa..36cfae083b7865 100644 --- a/chrome/browser/devtools/devtools_browsertest.cc +++ b/chrome/browser/devtools/devtools_browsertest.cc @@ -2736,6 +2736,30 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, CloseDevToolsWindow(); } +IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, IsDeveloperModeTrueHistogram) { + browser()->profile()->GetPrefs()->SetBoolean( + prefs::kExtensionsUIDeveloperMode, true); + base::HistogramTester histograms; + const char* histogram_name = "Extensions.DevTools.UserIsInDeveloperMode"; + + LoadExtension("devtools_extension"); + RunTest("waitForTestResultsInConsole", kArbitraryPage); + + histograms.ExpectBucketCount(histogram_name, true, 2); +} + +IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, IsDeveloperModeFalseHistogram) { + browser()->profile()->GetPrefs()->SetBoolean( + prefs::kExtensionsUIDeveloperMode, false); + base::HistogramTester histograms; + const char* histogram_name = "Extensions.DevTools.UserIsInDeveloperMode"; + + LoadExtension("devtools_extension"); + RunTest("waitForTestResultsInConsole", kArbitraryPage); + + histograms.ExpectBucketCount(histogram_name, false, 2); +} + namespace { class DevToolsLocalizationTest : public DevToolsTest { diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc index 8042c954515557..7c611575771617 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.cc +++ b/chrome/browser/devtools/devtools_ui_bindings.cc @@ -1509,6 +1509,7 @@ void DevToolsUIBindings::AddDevToolsExtensionsToClient() { return; base::ListValue results; + bool have_user_installed_devtools_extensions = false; for (const scoped_refptr& extension : registry->enabled_extensions()) { if (extensions::chrome_manifest_urls::GetDevToolsPage(extension.get()) @@ -1537,6 +1538,18 @@ void DevToolsUIBindings::AddDevToolsExtensionsToClient() { extension->permissions_data()->HasAPIPermission( extensions::mojom::APIPermissionID::kExperimental)); results.Append(std::move(extension_info)); + + if (!(extensions::Manifest::IsPolicyLocation(extension->location()) || + extensions::Manifest::IsComponentLocation(extension->location()))) { + have_user_installed_devtools_extensions = true; + } + } + + if (have_user_installed_devtools_extensions) { + bool is_developer_mode = + profile_->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode); + base::UmaHistogramBoolean("Extensions.DevTools.UserIsInDeveloperMode", + is_developer_mode); } CallClientMethod("DevToolsAPI", "addExtensions", std::move(results)); diff --git a/chrome/browser/enterprise/browser_management/management_service_factory.cc b/chrome/browser/enterprise/browser_management/management_service_factory.cc index 4e2a44bfb7f07c..75484198ca280c 100644 --- a/chrome/browser/enterprise/browser_management/management_service_factory.cc +++ b/chrome/browser/enterprise/browser_management/management_service_factory.cc @@ -5,6 +5,7 @@ #include "chrome/browser/enterprise/browser_management/management_service_factory.h" #include "base/memory/singleton.h" +#include "base/no_destructor.h" #include "chrome/browser/enterprise/browser_management/browser_management_service.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/enterprise/connectors/connectors_manager.cc b/chrome/browser/enterprise/connectors/connectors_manager.cc index 039b03285e57e2..6d1450892fd62d 100644 --- a/chrome/browser/enterprise/connectors/connectors_manager.cc +++ b/chrome/browser/enterprise/connectors/connectors_manager.cc @@ -7,7 +7,6 @@ #include #include "base/feature_list.h" -#include "base/no_destructor.h" #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/enterprise/connectors/connectors_prefs.h" diff --git a/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc b/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc index 6d3abaa9ec08e3..586a32184eef6f 100644 --- a/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc +++ b/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc @@ -7,7 +7,6 @@ #include #include "base/json/values_util.h" -#include "base/no_destructor.h" #include "base/time/time.h" #include "base/values.h" #include "build/chromeos_buildflags.h" diff --git a/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc b/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc index 9243460641f405..a5439708bf28eb 100644 --- a/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc +++ b/chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc @@ -402,6 +402,9 @@ class CertificateProviderApiMockedExtensionTest // Wait for the extension to receive the sign request. ASSERT_TRUE(sign_digest_listener.WaitUntilSatisfied()); + EXPECT_GT(cert_provider_service_->pin_dialog_manager() + ->StoredSignRequestsForTesting(), + 0); // Check that the certificate is available. scoped_refptr certificate = GetCertificate(); @@ -445,6 +448,11 @@ class CertificateProviderApiMockedExtensionTest // Wait for the https navigation to finish. navigation_observer.Wait(); + // Make sure that sign request is removed from pin dialog manager. + EXPECT_EQ(cert_provider_service_->pin_dialog_manager() + ->StoredSignRequestsForTesting(), + 0); + // Check whether the server acknowledged that a client certificate was // presented. const std::string client_cert_fingerprint = diff --git a/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc b/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc index a0168484524ac9..4305987fb61083 100644 --- a/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc +++ b/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc @@ -8,6 +8,7 @@ #include "base/base_paths.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/path_service.h" #include "base/rand_util.h" #include "build/build_config.h" diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc index 2fead96cdf27b0..23603d68a9525b 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h" #include "chrome/browser/password_manager/bulk_leak_check_service_factory.h" diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc index e75425bddbb1da..fa061edf2108b2 100644 --- a/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc +++ b/chrome/browser/extensions/api/system_indicator/system_indicator_api.cc @@ -4,7 +4,6 @@ #include "chrome/browser/extensions/api/system_indicator/system_indicator_api.h" -#include "base/no_destructor.h" #include "chrome/browser/extensions/api/system_indicator/system_indicator_manager.h" #include "chrome/browser/extensions/api/system_indicator/system_indicator_manager_factory.h" #include "chrome/common/extensions/api/system_indicator/system_indicator_handler.h" diff --git a/chrome/browser/extensions/api/web_authentication_proxy/web_authentication_proxy_service.cc b/chrome/browser/extensions/api/web_authentication_proxy/web_authentication_proxy_service.cc index 049052be658bad..ca0f0af062410b 100644 --- a/chrome/browser/extensions/api/web_authentication_proxy/web_authentication_proxy_service.cc +++ b/chrome/browser/extensions/api/web_authentication_proxy/web_authentication_proxy_service.cc @@ -6,6 +6,7 @@ #include +#include "base/no_destructor.h" #include "base/rand_util.h" #include "chrome/common/extensions/api/web_authentication_proxy.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc index eff48ee498f603..20a117bd64cfa3 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc @@ -8,7 +8,6 @@ #include -#include "base/no_destructor.h" #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.h" #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.h" #include "chrome/browser/extensions/extension_tab_util.h" diff --git a/chrome/browser/extensions/chrome_content_verifier_delegate.cc b/chrome/browser/extensions/chrome_content_verifier_delegate.cc index a445df3fb939eb..f8cae7bbce9634 100644 --- a/chrome/browser/extensions/chrome_content_verifier_delegate.cc +++ b/chrome/browser/extensions/chrome_content_verifier_delegate.cc @@ -14,7 +14,6 @@ #include "base/containers/contains.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/syslog_logging.h" diff --git a/chrome/browser/extensions/external_pref_loader.cc b/chrome/browser/extensions/external_pref_loader.cc index 1f90565e687aa2..7623d8130c7df6 100644 --- a/chrome/browser/extensions/external_pref_loader.cc +++ b/chrome/browser/extensions/external_pref_loader.cc @@ -136,40 +136,10 @@ class ExternalPrefLoader::PrioritySyncReadyWaiter } DCHECK(!done_closure_); done_closure_ = std::move(done_closure); - if (chromeos::features::IsSyncConsentOptionalEnabled()) { - // SyncConsentOptional lets users opt-out of sync during OOBE. - PrefService* prefs = profile_->GetPrefs(); - if (!prefs->GetBoolean(chromeos::prefs::kSyncOobeCompleted)) { - // Need to wait for OOBE completion before checking if sync is enabled. - pref_change_registrar_ = std::make_unique(); - pref_change_registrar_->Init(prefs); - // base::Unretained is safe because we own |pref_changed_registrar_|. - pref_change_registrar_->Add( - chromeos::prefs::kSyncOobeCompleted, - base::BindRepeating(&PrioritySyncReadyWaiter::OnSyncOobeCompleted, - base::Unretained(this))); - return; - } - } MaybeObserveSyncStart(); } private: - void OnSyncOobeCompleted() { - DCHECK(chromeos::features::IsSyncConsentOptionalEnabled()); - DCHECK( - profile_->GetPrefs()->GetBoolean(chromeos::prefs::kSyncOobeCompleted)); - pref_change_registrar_.reset(); - syncer::SyncService* service = SyncServiceFactory::GetForProfile(profile_); - if (!service->GetUserSettings()->IsOsSyncFeatureEnabled()) { - // User opted-out of OS sync, OS sync will never start, we're done here. - Finish(); - // Note: |this| is deleted. - return; - } - MaybeObserveSyncStart(); - } - void MaybeObserveSyncStart() { syncer::SyncService* service = SyncServiceFactory::GetForProfile(profile_); DCHECK(service); @@ -229,9 +199,6 @@ class ExternalPrefLoader::PrioritySyncReadyWaiter base::OnceClosure done_closure_; - // Used with SyncConsentOptional to wait for OOBE sync dialog completion. - std::unique_ptr pref_change_registrar_; - // Used for registering observer for sync_preferences::PrefServiceSyncable. base::ScopedObservation diff --git a/chrome/browser/extensions/external_pref_loader_unittest.cc b/chrome/browser/extensions/external_pref_loader_unittest.cc index 6eede1aac8fbf8..c9e57dcc059d86 100644 --- a/chrome/browser/extensions/external_pref_loader_unittest.cc +++ b/chrome/browser/extensions/external_pref_loader_unittest.cc @@ -131,16 +131,11 @@ class ExternalPrefLoaderTest : public ExternalPrefLoaderTestBase, public: ExternalPrefLoaderTest() { if (ShouldEnableSyncSettingsCategorization()) { - feature_list_.InitWithFeatures( - /*enabled_features=*/{chromeos::features:: - kSyncSettingsCategorization}, - /*disabled_features=*/{chromeos::features::kSyncConsentOptional}); + feature_list_.InitAndEnableFeature( + chromeos::features::kSyncSettingsCategorization); } else { - feature_list_.InitWithFeatures( - /*enabled_features=*/{}, - /*disabled_features=*/{ - chromeos::features::kSyncSettingsCategorization, - chromeos::features::kSyncConsentOptional}); + feature_list_.InitAndDisableFeature( + chromeos::features::kSyncSettingsCategorization); } } ~ExternalPrefLoaderTest() override = default; @@ -156,7 +151,7 @@ class ExternalPrefLoaderTest : public ExternalPrefLoaderTestBase, // Tests that we fire pref reading correctly after priority sync state // is resolved by ExternalPrefLoader. This test checks that the flow works -// without SyncSettingsCategorization and SyncConsentOptional. +// regardless of the state of SyncSettingsCategorization. TEST_P(ExternalPrefLoaderTest, PrefReadInitiatesCorrectly) { base::RunLoop run_loop; scoped_refptr loader( @@ -179,97 +174,4 @@ INSTANTIATE_TEST_SUITE_P(/* no label */, ExternalPrefLoaderTest, ::testing::Bool()); -class ExternalPrefLoaderSyncConsentOptionalTest - : public ExternalPrefLoaderTestBase { - public: - ExternalPrefLoaderSyncConsentOptionalTest() { - feature_list_.InitWithFeatures( - /*enabled_features=*/{chromeos::features::kSyncSettingsCategorization, - chromeos::features::kSyncConsentOptional}, - /*disabled_features=*/{}); - } - ~ExternalPrefLoaderSyncConsentOptionalTest() override = default; - ExternalPrefLoaderSyncConsentOptionalTest( - ExternalPrefLoaderSyncConsentOptionalTest&) = delete; - ExternalPrefLoaderSyncConsentOptionalTest& operator=( - ExternalPrefLoaderSyncConsentOptionalTest&) = delete; -}; - -TEST_F(ExternalPrefLoaderSyncConsentOptionalTest, OsSyncEnabled) { - base::RunLoop run_loop; - scoped_refptr loader = - base::MakeRefCounted( - profile(), run_loop.QuitWhenIdleClosure()); - ExternalProviderImpl provider( - /*service=*/nullptr, loader, profile(), - ManifestLocation::kInvalidLocation, ManifestLocation::kInvalidLocation, - Extension::NO_FLAGS); - provider.VisitRegisteredExtension(); - - PrefService* prefs = profile()->GetPrefs(); - ASSERT_FALSE(prefs->GetBoolean(chromeos::prefs::kSyncOobeCompleted)); - - // Simulate OOBE screen completion with OS sync enabled. - sync_service()->GetUserSettings()->SetOsSyncFeatureEnabled(true); - prefs->SetBoolean(chromeos::prefs::kSyncOobeCompleted, true); - - // Simulate OS prefs starting to sync. - sync_preferences::PrefServiceSyncable* pref_sync = - profile()->GetTestingPrefService(); - // This is an ugly cast, but it's how other tests do it. - sync_preferences::PrefModelAssociator* pref_sync_service = - static_cast( - pref_sync->GetSyncableService(syncer::OS_PRIORITY_PREFERENCES)); - pref_sync_service->MergeDataAndStartSyncing( - syncer::OS_PRIORITY_PREFERENCES, syncer::SyncDataList(), - std::make_unique(), - std::make_unique()); - - run_loop.Run(); - // |loader| completed loading. -} - -TEST_F(ExternalPrefLoaderSyncConsentOptionalTest, OsSyncDisable) { - base::RunLoop run_loop; - scoped_refptr loader = - base::MakeRefCounted( - profile(), run_loop.QuitWhenIdleClosure()); - ExternalProviderImpl provider( - /*service=*/nullptr, loader, profile(), - ManifestLocation::kInvalidLocation, ManifestLocation::kInvalidLocation, - Extension::NO_FLAGS); - provider.VisitRegisteredExtension(); - - PrefService* prefs = profile()->GetPrefs(); - ASSERT_FALSE(prefs->GetBoolean(chromeos::prefs::kSyncOobeCompleted)); - - // Simulate OOBE screen completion with OS sync disabled. - sync_service()->GetUserSettings()->SetOsSyncFeatureEnabled(false); - prefs->SetBoolean(chromeos::prefs::kSyncOobeCompleted, true); - - // Loader doesn't need to wait, since OS pref sync is disabled. - run_loop.Run(); - // |loader| completed loading. -} - -TEST_F(ExternalPrefLoaderSyncConsentOptionalTest, SyncDisabledByPolicy) { - sync_service()->SetDisableReasons( - syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY); - ASSERT_FALSE(sync_service()->CanSyncFeatureStart()); - - base::RunLoop run_loop; - scoped_refptr loader = - base::MakeRefCounted( - profile(), run_loop.QuitWhenIdleClosure()); - ExternalProviderImpl provider( - /*service=*/nullptr, loader, profile(), - ManifestLocation::kInvalidLocation, ManifestLocation::kInvalidLocation, - Extension::NO_FLAGS); - provider.VisitRegisteredExtension(); - - // Loader doesn't need to wait, because sync will never enable. - run_loop.Run(); - // |loader| completed loading. -} - } // namespace extensions diff --git a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc index 54615df3753744..c863af8512ec06 100644 --- a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc +++ b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc @@ -287,7 +287,6 @@ TEST_P(ExternalProviderImplChromeOSSyncCategorizationTest, // OOBE screen completed with OS sync enabled. PrefService* prefs = profile()->GetPrefs(); - prefs->SetBoolean(syncer::prefs::kOsSyncFeatureEnabled, true); prefs->SetBoolean(chromeos::prefs::kSyncOobeCompleted, true); // App sync will wait for priority sync to complete. diff --git a/chrome/browser/first_party_sets/first_party_sets_util.cc b/chrome/browser/first_party_sets/first_party_sets_util.cc index b6759b73255386..7bdfadc55ae102 100644 --- a/chrome/browser/first_party_sets/first_party_sets_util.cc +++ b/chrome/browser/first_party_sets/first_party_sets_util.cc @@ -8,6 +8,7 @@ #include "base/callback_helpers.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 0babcd6b5b2508..8255dad1929832 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json @@ -3602,6 +3602,11 @@ "owners": [ "cheickcisse@google.com" ], "expiry_milestone": 95 }, + { + "name": "ios-shared-highlighting-v2", + "owners": ["tmartino", "cheickcisse@google.com"], + "expiry_milestone": 100 + }, { "name": "ios-synthetic-crash-reports", "owners": [ "olivierrobin", "justincohen", "bling-flags@google.com" ], diff --git a/chrome/browser/hid/hid_chooser_context_factory.cc b/chrome/browser/hid/hid_chooser_context_factory.cc index 3a43b522764cce..35019f8533a38e 100644 --- a/chrome/browser/hid/hid_chooser_context_factory.cc +++ b/chrome/browser/hid/hid_chooser_context_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/hid/hid_chooser_context_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/hid/hid_chooser_context.h" #include "chrome/browser/profiles/incognito_helpers.h" diff --git a/chrome/browser/history/domain_diversity_reporter_factory.cc b/chrome/browser/history/domain_diversity_reporter_factory.cc index 1f47d0cbbc3c6a..9a52edc21ea093 100644 --- a/chrome/browser/history/domain_diversity_reporter_factory.cc +++ b/chrome/browser/history/domain_diversity_reporter_factory.cc @@ -7,6 +7,7 @@ #include #include "base/bind.h" +#include "base/no_destructor.h" #include "base/time/default_clock.h" #include "build/build_config.h" #include "chrome/browser/history/history_service_factory.h" diff --git a/chrome/browser/history_clusters/history_clusters_service_factory.cc b/chrome/browser/history_clusters/history_clusters_service_factory.cc index c27203f3580d1d..7699066871c6f3 100644 --- a/chrome/browser/history_clusters/history_clusters_service_factory.cc +++ b/chrome/browser/history_clusters/history_clusters_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/history_clusters/history_clusters_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/engagement/site_engagement_service_factory.h" #include "chrome/browser/history/history_service_factory.h" diff --git a/chrome/browser/lacros/account_manager/profile_account_manager_factory.cc b/chrome/browser/lacros/account_manager/profile_account_manager_factory.cc index ef507174227da4..f90b3eb454a87d 100644 --- a/chrome/browser/lacros/account_manager/profile_account_manager_factory.cc +++ b/chrome/browser/lacros/account_manager/profile_account_manager_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/lacros/account_manager/profile_account_manager_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/lacros/account_manager/profile_account_manager.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/lacros/cert_db_initializer_factory.cc b/chrome/browser/lacros/cert_db_initializer_factory.cc index 57bb1a896f64ac..d4088622dbca85 100644 --- a/chrome/browser/lacros/cert_db_initializer_factory.cc +++ b/chrome/browser/lacros/cert_db_initializer_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/lacros/cert_db_initializer_factory.h" +#include "base/no_destructor.h" #include "base/system/sys_info.h" #include "chrome/browser/lacros/cert_db_initializer_impl.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/login_detection/login_detection_keyed_service_factory.cc b/chrome/browser/login_detection/login_detection_keyed_service_factory.cc index 4b6351ceb1038b..7e796fddd3a9aa 100644 --- a/chrome/browser/login_detection/login_detection_keyed_service_factory.cc +++ b/chrome/browser/login_detection/login_detection_keyed_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/login_detection/login_detection_keyed_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/login_detection/login_detection_keyed_service.h" #include "chrome/browser/login_detection/login_detection_util.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" diff --git a/chrome/browser/media/webrtc/webrtc_interactive_uitest.cc b/chrome/browser/media/webrtc/webrtc_interactive_uitest.cc index 16cf5cb36a878e..ab37a849537305 100644 --- a/chrome/browser/media/webrtc/webrtc_interactive_uitest.cc +++ b/chrome/browser/media/webrtc/webrtc_interactive_uitest.cc @@ -318,17 +318,9 @@ IN_PROC_BROWSER_TEST_F( DetectVideoAndHangUp(); } -// Test is flaky on windows. https://crbug.com/1239275 -#if defined(OS_WIN) -#define MAYBE_RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount \ - DISABLED_RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount -#else -#define MAYBE_RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount \ - RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount -#endif IN_PROC_BROWSER_TEST_F( WebRtcBrowserTest, - MAYBE_RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount) { + RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange_ConnectionCount) { EXPECT_EQ(0u, GetPeerToPeerConnectionsCountChangeFromNetworkService()); StartServerAndOpenTabs(); SetupPeerconnectionWithLocalStream(left_tab_); diff --git a/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc b/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc index 8b2634629e0599..3eb5f9b4ed41e5 100644 --- a/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc +++ b/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc @@ -110,10 +110,10 @@ class FamilyUserMetricsProviderTest /*should_launch_browser=*/true, GetPrimaryAccountId(GetFamilyUserLogSegment()), /*include_initial_user=*/true, - // Don't use LocalPolicyTestServer because it does not support customizing - // PolicyData. - // TODO(crbug/1112885): Use LocalPolicyTestServer when this is fixed. - /*use_local_policy_server=*/false}; + // Don't use EmbeddedPolicyTestServer because it does not support + // customizing PolicyData. + // TODO(crbug/1112885): Use EmbeddedPolicyTestServer when this is fixed. + /*use_embedded_policy_server=*/false}; }; IN_PROC_BROWSER_TEST_P(FamilyUserMetricsProviderTest, UserCategory) { diff --git a/chrome/browser/metrics/perf/metric_provider.cc b/chrome/browser/metrics/perf/metric_provider.cc index 0b6f52e43d94b2..bc6b26484a8d42 100644 --- a/chrome/browser/metrics/perf/metric_provider.cc +++ b/chrome/browser/metrics/perf/metric_provider.cc @@ -200,8 +200,6 @@ MetricProvider::RecordAttemptStatus MetricProvider::AppSyncStateForUserProfile( // the OS settings. Otherwise, we read from Chrome settings. We then check if // the sync feature is enabled and the App Sync toggle is on. if (chromeos::features::IsSyncSettingsCategorizationEnabled()) { - if (!sync_settings->IsOsSyncFeatureEnabled()) - return RecordAttemptStatus::kOSSyncFeatureDisabled; if (!sync_settings->GetSelectedOsTypes().Has( syncer::UserSelectableOsType::kOsApps)) return RecordAttemptStatus::kOSAppSyncDisabled; diff --git a/chrome/browser/metrics/perf/metric_provider.h b/chrome/browser/metrics/perf/metric_provider.h index 0143d995fe3f95..0b239d9126adcf 100644 --- a/chrome/browser/metrics/perf/metric_provider.h +++ b/chrome/browser/metrics/perf/metric_provider.h @@ -81,7 +81,7 @@ class MetricProvider { kSyncServiceUnavailable = 5, kChromeSyncFeatureDisabled = 6, kChromeAppSyncDisabled = 7, - kOSSyncFeatureDisabled = 8, + // Deprecated: kOSSyncFeatureDisabled = 8, kOSAppSyncDisabled = 9, kMaxValue = kOSAppSyncDisabled, }; diff --git a/chrome/browser/metrics/perf/metric_provider_unittest.cc b/chrome/browser/metrics/perf/metric_provider_unittest.cc index 774337694797ee..1e12b51838dbe9 100644 --- a/chrome/browser/metrics/perf/metric_provider_unittest.cc +++ b/chrome/browser/metrics/perf/metric_provider_unittest.cc @@ -351,13 +351,11 @@ class MetricProviderSyncSettingsTest : public testing::Test { } void EnableOSAppSync(TestSyncService* sync_service) { - sync_service->GetUserSettings()->SetOsSyncFeatureEnabled(true); sync_service->GetUserSettings()->SetSelectedOsTypes( /*sync_all_os_types=*/false, {syncer::UserSelectableOsType::kOsApps}); } void DisableOSAppSync(TestSyncService* sync_service) { - sync_service->GetUserSettings()->SetOsSyncFeatureEnabled(true); sync_service->GetUserSettings()->SetSelectedOsTypes( /*sync_all_os_types=*/false, {}); } diff --git a/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc b/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc index f4ccf1ec000dd5..389bb443e1093e 100644 --- a/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc +++ b/chrome/browser/metrics/structured/chrome_structured_metrics_recorder.cc @@ -7,6 +7,7 @@ #include #include "base/feature_list.h" +#include "base/no_destructor.h" #include "build/chromeos_buildflags.h" #include "components/metrics/structured/histogram_util.h" #include "components/metrics/structured/structured_metrics_features.h" diff --git a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc index 3d736c519cf58d..70c67c42eb5d9c 100644 --- a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc +++ b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc @@ -378,10 +378,10 @@ class UserTypeByDeviceTypeMetricsProviderTest embedded_test_server(), this, /*should_launch_browser=*/true, GetPrimaryAccountId(), /*include_initial_user=*/true, - // Don't use LocalPolicyTestServer because it does not support customizing - // PolicyData. - // TODO(crbug/1112885): Use LocalPolicyTestServer when this is fixed. - /*use_local_policy_server=*/false}; + // Don't use EmbeddedPolicyTestServer because it does not support + // customizing PolicyData. + // TODO(crbug/1112885): Use EmbeddedPolicyTestServer when this is fixed. + /*use_embedded_policy_server=*/false}; policy::UserPolicyBuilder device_local_account_policy_; ash::LocalPolicyTestServerMixin local_policy_mixin_{&mixin_host_}; diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc index b6e2c401f0c8d4..bf356c976e34c2 100644 --- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc +++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc @@ -10,7 +10,6 @@ #include "base/containers/contains.h" #include "base/containers/flat_set.h" -#include "base/no_destructor.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/nearby_sharing/client/fake_nearby_share_client.h" #include "chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.h" diff --git a/chrome/browser/optimization_guide/model_validator_keyed_service_factory.cc b/chrome/browser/optimization_guide/model_validator_keyed_service_factory.cc index 60491af8f7e3e7..d6636df0536e8b 100644 --- a/chrome/browser/optimization_guide/model_validator_keyed_service_factory.cc +++ b/chrome/browser/optimization_guide/model_validator_keyed_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/optimization_guide/model_validator_keyed_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/optimization_guide/model_validator_keyed_service.h" #include "chrome/browser/optimization_guide/model_validator_keyed_service_factory.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.cc index 7b9425771a6c7a..046225bb8cc4ca 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.cc +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" +#include "base/no_destructor.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h" diff --git a/chrome/browser/optimization_guide/page_content_annotations_service_factory.cc b/chrome/browser/optimization_guide/page_content_annotations_service_factory.cc index 7af73261476b0f..2d0ba01d4619f2 100644 --- a/chrome/browser/optimization_guide/page_content_annotations_service_factory.cc +++ b/chrome/browser/optimization_guide/page_content_annotations_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/optimization_guide/page_content_annotations_service_factory.h" +#include "base/no_destructor.h" #include "base/task/sequenced_task_runner.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" diff --git a/chrome/browser/page_info/about_this_site_service_factory.cc b/chrome/browser/page_info/about_this_site_service_factory.cc index 6e0897fc0825ae..aaf7acfbf6add9 100644 --- a/chrome/browser/page_info/about_this_site_service_factory.cc +++ b/chrome/browser/page_info/about_this_site_service_factory.cc @@ -7,6 +7,7 @@ #include #include "base/feature_list.h" +#include "base/no_destructor.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h" #include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h" diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java index a8317123a12568..0fad594c3b401c 100644 --- a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java @@ -97,7 +97,7 @@ public static boolean hasChosenToSyncPasswords(SyncService syncService) { */ public static boolean hasChosenToSyncPasswordsWithNoCustomPassphrase(SyncService syncService) { return PasswordManagerHelper.hasChosenToSyncPasswords(syncService) - && !syncService.isUsingExplicitPassphrase(); + && syncService.isEngineInitialized() && !syncService.isUsingExplicitPassphrase(); } /** @@ -109,6 +109,7 @@ public static boolean hasChosenToSyncPasswordsWithNoCustomPassphrase(SyncService public static boolean isSyncingPasswordsWithNoCustomPassphrase(SyncService syncService) { if (syncService == null || !syncService.hasSyncConsent()) return false; if (!syncService.getActiveDataTypes().contains(ModelType.PASSWORDS)) return false; + if (!syncService.isEngineInitialized()) return false; if (syncService.isUsingExplicitPassphrase()) return false; return true; } diff --git a/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java b/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java index 35b05a1f9e3a09..67940dc25e68dd 100644 --- a/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java +++ b/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java @@ -131,17 +131,31 @@ public void testSyncEnabledWithCustomPassphrase() { when(mSyncServiceMock.isSyncFeatureEnabled()).thenReturn(true); when(mSyncServiceMock.getChosenDataTypes()) .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(true); when(mSyncServiceMock.isUsingExplicitPassphrase()).thenReturn(true); Assert.assertTrue(PasswordManagerHelper.hasChosenToSyncPasswords(mSyncServiceMock)); Assert.assertFalse(PasswordManagerHelper.hasChosenToSyncPasswordsWithNoCustomPassphrase( mSyncServiceMock)); } + @Test + public void testSyncEnabledButInitializing() { + when(mSyncServiceMock.isSyncFeatureEnabled()).thenReturn(true); + when(mSyncServiceMock.getChosenDataTypes()) + .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(false); + Assert.assertTrue(PasswordManagerHelper.hasChosenToSyncPasswords(mSyncServiceMock)); + Assert.assertFalse(PasswordManagerHelper.hasChosenToSyncPasswordsWithNoCustomPassphrase( + mSyncServiceMock)); + verify(mSyncServiceMock, never()).isUsingExplicitPassphrase(); + } + @Test public void testActivelySyncingPasswordsWithNoCustomPassphrase() { when(mSyncServiceMock.hasSyncConsent()).thenReturn(true); when(mSyncServiceMock.getActiveDataTypes()) .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(true); when(mSyncServiceMock.isUsingExplicitPassphrase()).thenReturn(false); Assert.assertTrue( PasswordManagerHelper.isSyncingPasswordsWithNoCustomPassphrase(mSyncServiceMock)); @@ -152,6 +166,7 @@ public void testActivelySyncingPasswordsWithCustomPassphrase() { when(mSyncServiceMock.hasSyncConsent()).thenReturn(true); when(mSyncServiceMock.getActiveDataTypes()) .thenReturn(CollectionUtil.newHashSet(ModelType.PASSWORDS)); + when(mSyncServiceMock.isEngineInitialized()).thenReturn(true); when(mSyncServiceMock.isUsingExplicitPassphrase()).thenReturn(true); Assert.assertFalse( PasswordManagerHelper.isSyncingPasswordsWithNoCustomPassphrase(mSyncServiceMock)); diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc index abf8fb9584b546..377f8cfdc61d9d 100644 --- a/chrome/browser/password_manager/chrome_password_manager_client.cc +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc @@ -19,7 +19,6 @@ #include "base/metrics/field_trial.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" -#include "base/no_destructor.h" #include "base/stl_util.h" #include "build/branding_buildflags.h" #include "build/build_config.h" diff --git a/chrome/browser/password_manager/credentials_cleaner_runner_factory.cc b/chrome/browser/password_manager/credentials_cleaner_runner_factory.cc index 40641a9f1a564a..1cc860b4144a63 100644 --- a/chrome/browser/password_manager/credentials_cleaner_runner_factory.cc +++ b/chrome/browser/password_manager/credentials_cleaner_runner_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/password_manager/credentials_cleaner_runner_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/password_manager/core/browser/credentials_cleaner_runner.h" diff --git a/chrome/browser/performance_manager/mechanisms/working_set_trimmer_win.h b/chrome/browser/performance_manager/mechanisms/working_set_trimmer_win.h index d3284b7fef573f..bef11049b18873 100644 --- a/chrome/browser/performance_manager/mechanisms/working_set_trimmer_win.h +++ b/chrome/browser/performance_manager/mechanisms/working_set_trimmer_win.h @@ -7,6 +7,8 @@ #include "chrome/browser/performance_manager/mechanisms/working_set_trimmer.h" +#include "base/no_destructor.h" + namespace performance_manager { namespace mechanism { diff --git a/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.cc b/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.cc index c8c7316402ccf2..7a5bed6eb375c4 100644 --- a/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.cc +++ b/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.cc @@ -5,6 +5,7 @@ #include "chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.h" #include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "base/run_loop.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade.h" diff --git a/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.cc b/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.cc index c9600db58e33e0..092cb82ddc0ed1 100644 --- a/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.cc +++ b/chrome/browser/performance_manager/policies/working_set_trimmer_policy_arcvm.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/memory/singleton.h" +#include "base/no_destructor.h" #include "chrome/browser/ash/arc/session/arc_session_manager.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile_manager.h" diff --git a/chrome/browser/permissions/chrome_permissions_client.cc b/chrome/browser/permissions/chrome_permissions_client.cc index 61b77b88c89649..f8e17b2f6c2486 100644 --- a/chrome/browser/permissions/chrome_permissions_client.cc +++ b/chrome/browser/permissions/chrome_permissions_client.cc @@ -7,6 +7,7 @@ #include #include "base/feature_list.h" +#include "base/no_destructor.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/bluetooth/bluetooth_chooser_context_factory.h" diff --git a/chrome/browser/persisted_state_db/profile_proto_db_factory.h b/chrome/browser/persisted_state_db/profile_proto_db_factory.h index c19f900755e2fd..2d3726eadced05 100644 --- a/chrome/browser/persisted_state_db/profile_proto_db_factory.h +++ b/chrome/browser/persisted_state_db/profile_proto_db_factory.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_PERSISTED_STATE_DB_PROFILE_PROTO_DB_FACTORY_H_ #define CHROME_BROWSER_PERSISTED_STATE_DB_PROFILE_PROTO_DB_FACTORY_H_ +#include "base/no_destructor.h" #include "build/build_config.h" #include "chrome/browser/persisted_state_db/profile_proto_db.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/policy/browser_dm_token_storage_linux.cc b/chrome/browser/policy/browser_dm_token_storage_linux.cc index 47d9dabb231451..a67b2b3a0166b5 100644 --- a/chrome/browser/policy/browser_dm_token_storage_linux.cc +++ b/chrome/browser/policy/browser_dm_token_storage_linux.cc @@ -14,7 +14,6 @@ #include "base/files/important_file_writer.h" #include "base/hash/sha1.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" diff --git a/chrome/browser/policy/browser_dm_token_storage_mac.mm b/chrome/browser/policy/browser_dm_token_storage_mac.mm index abf871d79f4179..927cf30ff3a7cc 100644 --- a/chrome/browser/policy/browser_dm_token_storage_mac.mm +++ b/chrome/browser/policy/browser_dm_token_storage_mac.mm @@ -17,7 +17,6 @@ #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_ioobject.h" -#include "base/no_destructor.h" #include "base/notreached.h" #include "base/path_service.h" #include "base/strings/string_util.h" diff --git a/chrome/browser/policy/browser_dm_token_storage_win.cc b/chrome/browser/policy/browser_dm_token_storage_win.cc index bc379d4f4d4782..0aee6270e4be88 100644 --- a/chrome/browser/policy/browser_dm_token_storage_win.cc +++ b/chrome/browser/policy/browser_dm_token_storage_win.cc @@ -25,7 +25,6 @@ #include "base/callback.h" #include "base/callback_helpers.h" #include "base/logging.h" -#include "base/no_destructor.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" diff --git a/chrome/browser/policy/profile_policy_connector_unittest.cc b/chrome/browser/policy/profile_policy_connector_unittest.cc index 79e5823c898316..a9b27d1279a45f 100644 --- a/chrome/browser/policy/profile_policy_connector_unittest.cc +++ b/chrome/browser/policy/profile_policy_connector_unittest.cc @@ -127,6 +127,7 @@ class ProfilePolicyConnectorTest : public testing::Test { } void TearDown() override { + task_environment_.RunUntilIdle(); TestingBrowserProcess::GetGlobal()->ShutdownBrowserPolicyConnector(); cloud_policy_manager_->Shutdown(); } diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java index 0a354a8fd3daea..5d73372b0387ae 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java @@ -95,27 +95,6 @@ public final class ChromePreferenceKeys { public static final String ATTRIBUTION_PROVIDER_LAST_BROWSER_START = "Chrome.Attribution.LastBrowserStart"; - /** Whether Autofill Assistant is enabled */ - public static final String AUTOFILL_ASSISTANT_ENABLED = "autofill_assistant_switch"; - /** Whether the Autofill Assistant onboarding has been accepted. */ - public static final String AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED = - "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED"; - /** Whether the user has seen a lite-script before or is a first-time user. */ - public static final String AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER = - "Chrome.AutofillAssistant.LiteScriptFirstTimeUser"; - /** The number of times a user has explicitly canceled a lite script. */ - public static final String AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED = - "Chrome.AutofillAssistant.NumberOfLiteScriptsCanceled"; - /** Whether proactive help is enabled. */ - public static final String AUTOFILL_ASSISTANT_PROACTIVE_HELP = - "Chrome.AutofillAssistant.ProactiveHelp"; - /** - * LEGACY preference indicating whether "do not show again" was checked in the autofill - * assistant onboarding - */ - public static final String AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN = - "AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN"; - public static final String BACKUP_FIRST_BACKUP_DONE = "first_backup_done"; public static final String BOOKMARKS_LAST_MODIFIED_FOLDER_ID = "last_bookmark_folder_id"; @@ -1044,9 +1023,6 @@ static List getKeysInUse() { ASSISTANT_VOICE_CONSENT_OUTSIDE_TAPS, ASSISTANT_VOICE_SEARCH_ENABLED, ATTRIBUTION_PROVIDER_LAST_BROWSER_START, - AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER, - AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED, - AUTOFILL_ASSISTANT_PROACTIVE_HELP, APP_LAUNCH_LAST_KNOWN_ACTIVE_TAB_STATE, APP_LAUNCH_SEARCH_ENGINE_HAD_LOGO, APPLICATION_OVERRIDE_LANGUAGE, diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java index 94b022005a35ae..ca0d254ac27b08 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/DeprecatedChromePreferenceKeys.java @@ -19,7 +19,12 @@ public class DeprecatedChromePreferenceKeys { static List getKeysForTesting() { // clang-format off return Arrays.asList( + "AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED", + "AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN", "Chrome.AccountPickerBottomSheet.ShownCount", + "Chrome.AutofillAssistant.LiteScriptFirstTimeUser", + "Chrome.AutofillAssistant.NumberOfLiteScriptsCanceled", + "Chrome.AutofillAssistant.ProactiveHelp", "Chrome.Flags.PaintPreviewTestEnabled", "Chrome.Flags.SafeBool.*", "Chrome.Flags.SafeDouble.*", @@ -53,6 +58,7 @@ static List getKeysForTesting() { "allow_low_end_device_ui", "allow_prefetch", "allow_starting_service_manager_only", + "autofill_assistant_switch", "bookmark_search_history", "bottom_toolbar_enabled", "bottom_toolbar_variation", diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java index be841e85d600e8..ba3a98407fc0ae 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java @@ -25,9 +25,6 @@ static List getKeysInUse() { return Arrays.asList( ChromePreferenceKeys.ACCESSIBILITY_TAB_SWITCHER, ChromePreferenceKeys.APP_LOCALE, - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, - ChromePreferenceKeys.AUTOFILL_ASSISTANT_ONBOARDING_ACCEPTED, - ChromePreferenceKeys.AUTOFILL_ASSISTANT_SKIP_INIT_SCREEN, ChromePreferenceKeys.BACKUP_FIRST_BACKUP_DONE, ChromePreferenceKeys.BOOKMARKS_LAST_MODIFIED_FOLDER_ID, ChromePreferenceKeys.BOOKMARKS_LAST_USED_URL, diff --git a/chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.cc b/chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.cc index 5c7c53e1553cfa..51cd210378898e 100644 --- a/chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.cc +++ b/chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/prefetch/search_prefetch/search_prefetch_service_factory.h" +#include "base/no_destructor.h" #include "chrome/browser/prefetch/search_prefetch/field_trial_settings.h" #include "chrome/browser/prefetch/search_prefetch/search_prefetch_service.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 32f9a9b64ffdba..7cde01a9bc3886 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -694,6 +694,9 @@ const char kSyncFirstRunCompleted[] = "sync.first_run_completed"; // Deprecated 12/2021. const char kArcAppReinstallState[] = "arc_app_reinstall_state"; + +// Deprecated 12/2021. +const char kOsSyncFeatureEnabled[] = "sync.os_sync_feature_enabled"; #endif // BUILDFLAG(IS_CHROMEOS_ASH) // Register local state used only for migration (clearing or moving to a new @@ -902,6 +905,8 @@ void RegisterProfilePrefsForMigration( registry->RegisterBooleanPref(kSyncFirstRunCompleted, false); registry->RegisterDictionaryPref(kArcAppReinstallState); + + registry->RegisterBooleanPref(kOsSyncFeatureEnabled, false); #endif // BUILDFLAG(IS_CHROMEOS_ASH) } @@ -1773,6 +1778,8 @@ void MigrateObsoleteProfilePrefs(Profile* profile) { // Added 12/2021. profile_prefs->ClearPref(kArcAppReinstallState); + + profile_prefs->ClearPref(kOsSyncFeatureEnabled); #endif // BUILDFLAG(IS_CHROMEOS_ASH) // Please don't delete the following line. It is used by PRESUBMIT.py. diff --git a/chrome/browser/prefs/incognito_mode_prefs.cc b/chrome/browser/prefs/incognito_mode_prefs.cc index 9e58406d7e3a45..604ac3b918f817 100644 --- a/chrome/browser/prefs/incognito_mode_prefs.cc +++ b/chrome/browser/prefs/incognito_mode_prefs.cc @@ -82,8 +82,6 @@ bool IncognitoModePrefs::ShouldLaunchIncognito( IncognitoModePrefs::Availability::kForced; #if BUILDFLAG(IS_CHROMEOS_LACROS) auto* init_params = chromeos::LacrosService::Get()->init_params(); - // TODO(https://crbug.com/1194304): Remove in M93. - should_use_incognito |= init_params->is_incognito_deprecated; should_use_incognito |= init_params->initial_browser_action == crosapi::mojom::InitialBrowserAction::kOpenIncognitoWindow; diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc index dda6f2869b9569..e8eb6a08fc3e69 100644 --- a/chrome/browser/profiles/profile_browsertest.cc +++ b/chrome/browser/profiles/profile_browsertest.cc @@ -413,7 +413,13 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileSynchronous) { // Test OnProfileCreate is called with is_new_profile set to true when // creating a new profile asynchronously. -IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateNewProfileAsynchronous) { +// TODO(crbug.com/1280223): Flaky on ChromeOS-Ash. +#if BUILDFLAG(IS_CHROMEOS_ASH) +#define MAYBE_CreateNewProfileAsynchronous DISABLED_CreateNewProfileAsynchronous +#else +#define MAYBE_CreateNewProfileAsynchronous CreateNewProfileAsynchronous +#endif +IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, MAYBE_CreateNewProfileAsynchronous) { base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -438,13 +444,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateNewProfileAsynchronous) { // Test OnProfileCreate is called with is_new_profile set to false when // creating a profile asynchronously with an existing prefs file. -// TODO(1232030): Flakily crashes on ChromeOS. -#if defined(OS_CHROMEOS) -#define MAYBE_CreateOldProfileAsynchronous DISABLED_CreateOldProfileAsynchronous -#else -#define MAYBE_CreateOldProfileAsynchronous CreateOldProfileAsynchronous -#endif -IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, MAYBE_CreateOldProfileAsynchronous) { +IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileAsynchronous) { base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); diff --git a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc index 10717e0c1e6dfe..30f679742a9809 100644 --- a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc +++ b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc @@ -6,6 +6,7 @@ #include +#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "chrome/app/chrome_command_ids.h" diff --git a/chrome/browser/resources/chromeos/login/components/dialogs/oobe_adaptive_dialog.html b/chrome/browser/resources/chromeos/login/components/dialogs/oobe_adaptive_dialog.html index 99e4eebd057571..b785970e78eb0d 100644 --- a/chrome/browser/resources/chromeos/login/components/dialogs/oobe_adaptive_dialog.html +++ b/chrome/browser/resources/chromeos/login/components/dialogs/oobe_adaptive_dialog.html @@ -154,6 +154,9 @@

Title

#contentContainer { width: var(--oobe-adaptive-dialog-content-width); } + #contentContainer ::slotted(*) { + max-width: var(--oobe-adaptive-dialog-content-width); + } .vertical-mode-centering { align-items: var(--oobe-adaptive-dialog-item-alignment); diff --git a/chrome/browser/resources/chromeos/login/debug/debug.js b/chrome/browser/resources/chromeos/login/debug/debug.js index 62a1e8d074a374..00e91fa5c35c4d 100644 --- a/chrome/browser/resources/chromeos/login/debug/debug.js +++ b/chrome/browser/resources/chromeos/login/debug/debug.js @@ -907,7 +907,6 @@ cr.define('cr.ui.login.debug', function() { states: [{ id: 'minor-mode', data: { - syncConsentOptionalEnabled: false, isMinorMode: true, }, }] diff --git a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn index 58dcd02de32fa6..a85c95c539518a 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn @@ -235,6 +235,7 @@ js_library("fingerprint_setup.m") { js_library("gesture_navigation.m") { sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/screens/common/gesture_navigation.m.js" ] deps = [ + "../../components:oobe_cr_lottie.m", "../../components/behaviors:login_screen_behavior.m", "../../components/behaviors:multi_step_behavior.m", "../../components/behaviors:oobe_i18n_behavior.m", diff --git a/chrome/browser/resources/chromeos/login/screens/common/gesture_navigation.html b/chrome/browser/resources/chromeos/login/screens/common/gesture_navigation.html index da77926af6e6ef..2ca697d710116e 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/gesture_navigation.html +++ b/chrome/browser/resources/chromeos/login/screens/common/gesture_navigation.html @@ -4,9 +4,9 @@ - + @@ -22,7 +22,8 @@ +
+
+ + + diff --git a/third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html b/third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html deleted file mode 100644 index e9e8cce8ffaeb9..00000000000000 --- a/third_party/blink/web_tests/external/wpt/css/css-conditional/test_group_insertRule.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - CSS Variables Allowed Syntax - - - - - - - - - -
-
- - - diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html new file mode 100644 index 00000000000000..2b0a2f451c59b2 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box-expected.html @@ -0,0 +1,38 @@ + + +Test if percentage height of table's child element with box-sizing: border-box is calculated correctly + + + +
+
+ wrapped content (height: 100%) +
+
+ diff --git a/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html new file mode 100644 index 00000000000000..7700b00dc32392 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-sizing/table-child-percentage-height-with-border-box.html @@ -0,0 +1,39 @@ + + +Test if percentage height of table's child element with box-sizing: border-box is calculated correctly + + + + +
+
+ wrapped content (height: 100%) +
+
+ diff --git a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition-expected.txt index 3cccbb476ae737..032ffaca312593 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition-expected.txt @@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 73 tests; 47 PASS, 26 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 73 tests; 50 PASS, 23 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS no variable PASS variable PASS single char variable @@ -8,7 +8,7 @@ PASS no char variable FAIL white space value (single space) assert_equals: Expected Value should match actual value expected "" but got " " FAIL white space value (double space) assert_equals: Expected Value should match actual value expected "" but got " " PASS overwrite -FAIL can't overwrite with no value assert_equals: Expected Value should match actual value expected "" but got "value" +PASS can overwrite with no value FAIL can overwrite with space value assert_equals: Expected Value should match actual value expected "" but got " " PASS case sensetivity PASS case sensetivity2 @@ -31,7 +31,7 @@ PASS no char variable (Computed Style) FAIL white space value (single space) (Computed Style) assert_equals: Expected Value should match actual value expected "" but got " " FAIL white space value (double space) (Computed Style) assert_equals: Expected Value should match actual value expected "" but got " " PASS overwrite (Computed Style) -FAIL can't overwrite with no value (Computed Style) assert_equals: Expected Value should match actual value expected "" but got "value" +PASS can overwrite with no value (Computed Style) FAIL can overwrite with space value (Computed Style) assert_equals: Expected Value should match actual value expected "" but got " " PASS case sensetivity (Computed Style) PASS case sensetivity2 (Computed Style) @@ -54,7 +54,7 @@ PASS no char variable (Cascading) FAIL white space value (single space) (Cascading) assert_equals: Expected Value should match actual value expected "" but got " " FAIL white space value (double space) (Cascading) assert_equals: Expected Value should match actual value expected "" but got " " PASS overwrite (Cascading) -FAIL can't overwrite with no value (Cascading) assert_equals: Expected Value should match actual value expected "" but got "value" +PASS can overwrite with no value (Cascading) FAIL can overwrite with space value (Cascading) assert_equals: Expected Value should match actual value expected "" but got " " PASS case sensetivity (Cascading) PASS case sensetivity2 (Cascading) diff --git a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition.html b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition.html index 5ad71f7f82a03f..0f9cefc5e93c23 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition.html +++ b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-definition.html @@ -26,7 +26,7 @@ { varName:"--var", expectedValue:"", style:"--var: ", testName:"white space value (single space)"}, { varName:"--var", expectedValue:"", style:"--var: ", testName:"white space value (double space)"}, { varName:"--var", expectedValue:"value2", style:"--var:value1; --var:value2", testName:"overwrite"}, - { varName:"--var", expectedValue:"", style:"--var:value;--var:;", testName:"can't overwrite with no value"}, + { varName:"--var", expectedValue:"", style:"--var:value;--var:;", testName:"can overwrite with no value"}, { varName:"--var", expectedValue:"", style:"--var:value;--var: ;", testName:"can overwrite with space value"}, { varName:"--var", expectedValue:"value1", style:"--var:value1; --Var:value2", testName:"case sensetivity"}, { varName:"--Var", expectedValue:"value2", style:"--var:value1; --Var:value2", testName:"case sensetivity2"}, diff --git a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt deleted file mode 100644 index 904ca589c18a9f..00000000000000 --- a/third_party/blink/web_tests/external/wpt/css/css-variables/variable-reference-expected.txt +++ /dev/null @@ -1,21 +0,0 @@ -This is a testharness.js-based test. -PASS width: var(--prop); -PASS width: var(--prop) !important; -PASS width: var(--prop, ); -PASS width: var(--prop, 20px); -PASS width: var(--prop, blue); -PASS width: var(--prop1, var(--prop2)); -PASS width: var(--prop1, var(--prop2, var(--prop3, auto))); -PASS width: var(--prop1) var(--prop2) -FAIL width: var(--prop,); assert_equals: expected "var(--prop,)" but got "" -PASS width: var(); -PASS width: var(prop); -PASS width: var(-prop); -PASS width: var(--prop 20px); -PASS width: var(--prop, var(prop)); -PASS width: var(--prop, var(-prop)); -PASS width: var(20px); -PASS width: var(var(--prop)); -PASS Variable reference left open at end of stylesheet -Harness: the test ran to completion. - diff --git a/third_party/blink/web_tests/external/wpt/dom/abort/event.any-expected.txt b/third_party/blink/web_tests/external/wpt/dom/abort/event.any-expected.txt index 4d7cd785dcd398..e5730d03ed1eff 100644 --- a/third_party/blink/web_tests/external/wpt/dom/abort/event.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/dom/abort/event.any-expected.txt @@ -13,5 +13,7 @@ PASS static aborting signal with reason should set signal.reason FAIL throwIfAborted() should throw abort.reason if signal aborted assert_throws_exactly: function "() => signal.throwIfAborted()" threw object "TypeError: signal.throwIfAborted is not a function" but we expected it to throw object "Error: boom" FAIL throwIfAborted() should throw primitive abort.reason if signal aborted assert_throws_exactly: function "() => signal.throwIfAborted()" threw object "TypeError: signal.throwIfAborted is not a function" but we expected it to throw "hello" FAIL throwIfAborted() should not throw if signal not aborted controller.signal.throwIfAborted is not a function +PASS AbortSignal.reason returns the same DOMException +PASS AbortController.signal.reason returns the same DOMException Harness: the test ran to completion. diff --git a/third_party/blink/web_tests/external/wpt/dom/abort/event.any.js b/third_party/blink/web_tests/external/wpt/dom/abort/event.any.js index 21c901c9fe9bcd..34af8ee5c560ae 100644 --- a/third_party/blink/web_tests/external/wpt/dom/abort/event.any.js +++ b/third_party/blink/web_tests/external/wpt/dom/abort/event.any.js @@ -158,4 +158,33 @@ test(t => { controller.signal.throwIfAborted(); }, "throwIfAborted() should not throw if signal not aborted"); +test(t => { + const signal = AbortSignal.abort(); + + assert_true( + signal.reason instanceof DOMException, + "signal.reason is a DOMException" + ); + assert_equals( + signal.reason, + signal.reason, + "signal.reason returns the same DOMException" + ); +}, "AbortSignal.reason returns the same DOMException"); + +test(t => { + const controller = new AbortController(); + controller.abort(); + + assert_true( + controller.signal.reason instanceof DOMException, + "signal.reason is a DOMException" + ); + assert_equals( + controller.signal.reason, + controller.signal.reason, + "signal.reason returns the same DOMException" + ); +}, "AbortController.signal.reason returns the same DOMException"); + done(); diff --git a/third_party/blink/web_tests/external/wpt/dom/abort/event.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/dom/abort/event.any.worker-expected.txt index 4d7cd785dcd398..e5730d03ed1eff 100644 --- a/third_party/blink/web_tests/external/wpt/dom/abort/event.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/dom/abort/event.any.worker-expected.txt @@ -13,5 +13,7 @@ PASS static aborting signal with reason should set signal.reason FAIL throwIfAborted() should throw abort.reason if signal aborted assert_throws_exactly: function "() => signal.throwIfAborted()" threw object "TypeError: signal.throwIfAborted is not a function" but we expected it to throw object "Error: boom" FAIL throwIfAborted() should throw primitive abort.reason if signal aborted assert_throws_exactly: function "() => signal.throwIfAborted()" threw object "TypeError: signal.throwIfAborted is not a function" but we expected it to throw "hello" FAIL throwIfAborted() should not throw if signal not aborted controller.signal.throwIfAborted is not a function +PASS AbortSignal.reason returns the same DOMException +PASS AbortController.signal.reason returns the same DOMException Harness: the test ran to completion. diff --git a/third_party/blink/web_tests/external/wpt/dom/abort/reason-constructor.html b/third_party/blink/web_tests/external/wpt/dom/abort/reason-constructor.html new file mode 100644 index 00000000000000..0515165a0f6788 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/abort/reason-constructor.html @@ -0,0 +1,12 @@ + + +AbortSignal.reason constructor + + + + diff --git a/third_party/blink/web_tests/external/wpt/lint.ignore b/third_party/blink/web_tests/external/wpt/lint.ignore index decc202343b5c4..cffb1f1e3fa1e7 100644 --- a/third_party/blink/web_tests/external/wpt/lint.ignore +++ b/third_party/blink/web_tests/external/wpt/lint.ignore @@ -759,6 +759,7 @@ AHEM SYSTEM FONT: infrastructure/assumptions/ahem-ref.html AHEM SYSTEM FONT: infrastructure/assumptions/ahem.html # Existing crashtests using testharness +TESTHARNESS-IN-OTHER-TYPE: accessibility/crashtests/computed-node-checked.html TESTHARNESS-IN-OTHER-TYPE: html/canvas/element/manual/wide-gamut-canvas/imagedata-no-color-settings-crash.html TESTHARNESS-IN-OTHER-TYPE: css/CSS2/floats-clear/adjoining-float-new-fc-crash.html TESTHARNESS-IN-OTHER-TYPE: css/CSS2/floats/floats-saturated-position-crash.html @@ -798,6 +799,9 @@ TESTHARNESS-IN-OTHER-TYPE: svg/extensibility/foreignObject/foreign-object-under- TESTHARNESS-IN-OTHER-TYPE: svg/extensibility/foreignObject/foreign-object-under-defs-crash.html TESTHARNESS-IN-OTHER-TYPE: svg/svg-in-svg/svg-in-svg-circular-filter-reference-crash.html +# Adding the testharnessreport.js script causes the test to never complete. +MISSING-TESTHARNESSREPORT: accessibility/crashtests/computed-node-checked.html + PRINT STATEMENT: webdriver/tests/print/printcmd.py PRINT STATEMENT: webdriver/tests/print/user_prompts.py diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-video.https.html b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-video.https.html index 517a6934e868a5..a6f73f009c6d75 100644 --- a/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-video.https.html +++ b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-video.https.html @@ -18,11 +18,11 @@

Description

function makeVideoFrame(timestamp) { const canvas = new OffscreenCanvas(width, height); - const ctx = canvas.getContext('2d', { alpha: false }); - ctx.fillStyle = `rgba(${pixelColour[0]}, ${pixelColour[1]}, ${pixelColour[2]}, ${pixelColour[3]})`; + const ctx = canvas.getContext('2d', {alpha: false}); + ctx.fillStyle = `rgba(${pixelColour.join()})`; ctx.fillRect(0, 0, width, height); - return new VideoFrame(canvas.transferToImageBitmap(), { timestamp, alpha: 'discard' }); + return new VideoFrame(canvas, {timestamp, alpha: 'discard'}); } async function getVideoFrame() { @@ -35,8 +35,7 @@

Description

return result.value; } - function assertPixel(t, bytes, expected) { - const epsilon = 5; + function assertPixel(t, bytes, expected, epsilon = 5) { for (let i = 0; i < bytes.length; i++) { t.step(() => { assert_less_than(Math.abs(bytes[i] - expected[i]), epsilon, "Mismatched pixel"); @@ -55,7 +54,7 @@

Description

exchangeIceCandidates(caller, callee); // Wait for the first track. const e = await exchangeOfferAndListenToOntrack(t, caller, callee); - output.srcObject = new MediaStream([e.track]) + output.srcObject = new MediaStream([e.track]); // Exchange answer. await exchangeAnswer(caller, callee); await waitForConnectionStateChange(callee, ['connected']); @@ -121,51 +120,134 @@

Description

}, 'Tests that frames are actually rendered correctly in a stream used for a video element.'); promise_test(async t => { - const generator = new MediaStreamTrackGenerator({ kind: 'video' }); + const generator = new MediaStreamTrackGenerator({kind: 'video'}); t.add_cleanup(() => generator.stop()); - const video = document.createElement("video"); + // Write frames for the duration of the test. + const writer = generator.writable.getWriter(); + let timestamp = 0; + const intervalId = setInterval( + t.step_func(async () => { + if (generator.readyState === 'live') { + timestamp++; + await writer.write(makeVideoFrame(timestamp)); + } + }), + 40); + t.add_cleanup(() => clearInterval(intervalId)); + + const video = document.createElement('video'); video.autoplay = true; video.width = width; video.height = height; video.muted = true; - let connectedResolver; - const connectedPromise = new Promise((resolve) => connectedResolver = resolve); - // Wait for the video element to be connected to the generator and - // generate some frames. - video.onloadstart = async () => { - // Ensure the peer connection has connected before injecting frames. - await connectedPromise; - let writer = generator.writable.getWriter(); - for (let i = 0; i < 5; i++) { - await writer.write(makeVideoFrame(i)); - // FIXME: this makes the test non-flaky - // See also https://bugs.chromium.org/p/chromium/issues/detail?id=1232417&q=mediastreamtrackgenerator%20flaky&can=2 - await new Promise(res => t.step_timeout(res, 1)); - } - }; + await initiateSingleTrackCall(t, generator, video); - let videoPlayPromise = new Promise((resolve)=> { + return new Promise(resolve => { video.ontimeupdate = t.step_func(() => { - const canvas = document.createElement("canvas"); + const canvas = document.createElement('canvas'); canvas.width = width; canvas.height = height; const context = canvas.getContext('2d'); context.drawImage(video, 0, 0); - // Pick a pixel in the centre of the video and check that it has the colour of the frame provided. + // Pick a pixel in the centre of the video and check that it has the + // colour of the frame provided. const pixel = context.getImageData(width / 2, height / 2, 1, 1); - assertPixel(t, pixel.data, pixelColour); + // Encoding/decoding can add noise, so increase the threshhold to 8. + assertPixel(t, pixel.data, pixelColour, 8); resolve(); }); }); + }, 'Tests that frames are actually rendered correctly in a stream sent over a peer connection.'); - await initiateSingleTrackCall(t, generator, video); - connectedResolver(); + promise_test(async t => { + const generator = new MediaStreamTrackGenerator({kind: 'video'}); + t.add_cleanup(() => generator.stop()); - return videoPlayPromise; - }, 'Tests that frames are actually rendered correctly in a stream sent over a peer connection.'); + const inputCanvas = new OffscreenCanvas(width, height); + + const inputContext = inputCanvas.getContext('2d', {alpha: false}); + // draw four quadrants + const colorUL = [255, 0, 0, 255]; + inputContext.fillStyle = `rgba(${colorUL.join()})`; + inputContext.fillRect(0, 0, width / 2, height / 2); + const colorUR = [255, 255, 0, 255]; + inputContext.fillStyle = `rgba(${colorUR.join()})`; + inputContext.fillRect(width / 2, 0, width / 2, height / 2); + const colorLL = [0, 255, 0, 255]; + inputContext.fillStyle = `rgba(${colorLL.join()})`; + inputContext.fillRect(0, height / 2, width / 2, height / 2); + const colorLR = [0, 255, 255, 255]; + inputContext.fillStyle = `rgba(${colorLR.join()})`; + inputContext.fillRect(width / 2, height / 2, width / 2, height / 2); + + // Write frames for the duration of the test. + const writer = generator.writable.getWriter(); + let timestamp = 0; + const intervalId = setInterval( + t.step_func(async () => { + if (generator.readyState === 'live') { + timestamp++; + await writer.write(new VideoFrame( + inputCanvas, {timestamp: timestamp, alpha: 'discard'})); + } + }), + 40); + t.add_cleanup(() => clearInterval(intervalId)); + const caller = new RTCPeerConnection(); + t.add_cleanup(() => caller.close()); + const callee = new RTCPeerConnection(); + t.add_cleanup(() => callee.close()); + const sender = caller.addTrack(generator); + + exchangeIceCandidates(caller, callee); + // Wait for the first track. + const e = await exchangeOfferAndListenToOntrack(t, caller, callee); + + // Exchange answer. + await exchangeAnswer(caller, callee); + await waitForConnectionStateChange(callee, ['connected']); + const params = sender.getParameters(); + params.encodings.forEach(e => e.scaleResolutionDownBy = 2); + sender.setParameters(params); + + const processor = new MediaStreamTrackProcessor(e.track); + const reader = processor.readable.getReader(); + + // The first frame may not have had scaleResolutionDownBy applied + const numTries = 5; + for (let i = 1; i <= numTries; i++) { + const {value: outputFrame} = await reader.read(); + if (outputFrame.displayWidth !== width / 2) { + assert_less_than(i, numTries, `First ${numTries} frames were the wrong size.`); + outputFrame.close(); + continue; + } + + assert_equals(outputFrame.displayWidth, width / 2); + assert_equals(outputFrame.displayHeight, height / 2); + + const outputCanvas = new OffscreenCanvas(width / 2, height / 2); + const outputContext = outputCanvas.getContext('2d', {alpha: false}); + outputContext.drawImage(outputFrame, 0, 0); + outputFrame.close(); + // Check the four quadrants + const pixelUL = outputContext.getImageData(width / 8, height / 8, 1, 1); + assertPixel(t, pixelUL.data, colorUL); + const pixelUR = + outputContext.getImageData(width * 3 / 8, height / 8, 1, 1); + assertPixel(t, pixelUR.data, colorUR); + const pixelLL = + outputContext.getImageData(width / 8, height * 3 / 8, 1, 1); + assertPixel(t, pixelLL.data, colorLL); + const pixelLR = + outputContext.getImageData(width * 3 / 8, height * 3 / 8, 1, 1); + assertPixel(t, pixelLR.data, colorLR); + break; + } + }, 'Tests that frames are sent correctly with RTCRtpEncodingParameters.scaleResolutionDownBy.'); promise_test(async t => { const generator = new MediaStreamTrackGenerator("video"); diff --git a/third_party/blink/web_tests/http/tests/devtools/elements/styles/styles-parse-invalid-properties-expected.txt b/third_party/blink/web_tests/http/tests/devtools/elements/styles/styles-parse-invalid-properties-expected.txt index 15086bb0afca39..a4af7659e3e3df 100644 --- a/third_party/blink/web_tests/http/tests/devtools/elements/styles/styles-parse-invalid-properties-expected.txt +++ b/third_party/blink/web_tests/http/tests/devtools/elements/styles/styles-parse-invalid-properties-expected.txt @@ -22,7 +22,7 @@ element.style { () #inspected { (