diff --git a/DEPS b/DEPS index e7fc0abb..e1da1c3e 100644 --- a/DEPS +++ b/DEPS
@@ -195,11 +195,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '842805ced156080fd25bfbb6410851dbe6a8b447', + 'skia_revision': 'c73bff39bd21ae9b54b198a6dbf361ea3ceab591', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'fa4bfe45ff53e2c21b96728ef9132c40969b3159', + 'v8_revision': '0d81cd72688512abcbe1601015baee390c484a6a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -211,7 +211,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': '1075baee443cbfd02714d7d3793d194fd227d476', + 'swiftshader_revision': 'ac160bd364cbd014d3fd7bd3d25e1867ec5d4443', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -266,7 +266,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '5c1904772b3655454d1da01210b83e6fa5fbceb2', + 'devtools_frontend_revision': '92e869a637824a506eec4cee09d452dacaad3423', # 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. @@ -1254,7 +1254,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '76404b01d5314c251218a4a34111a1aa8a3803ad', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '68983d39e5ced7b00999a7a74aef68ba2e8f98b4', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1566,7 +1566,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': 'VGNbHOZcwQ-4eGRBpvMYde9m0v8pkT_TboRdiMdOPC4C', + 'version': '5XZ2S6FH1ZMGrvfNVIJhAVxIJ3KGO-5PDM311qNGYwQC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -1577,7 +1577,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'W-Axu-xOAC73R6IETvUzr5ssqwyUgIQVQPtCBDfKISUC', + 'version': 'BJBtNPmOWXzOskdkiFU6S5dpkVPd-1G-Mq2BUPzToSUC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index c522359..84798b1 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py
@@ -328,7 +328,6 @@ '^chrome/browser/devtools/', '^chrome/browser/download/', '^chrome/browser/extensions/', - '^chrome/browser/external_protocol/external_protocol_handler.cc', '^chrome/browser/history/', '^chrome/browser/installable/installable_manager_browsertest.cc', '^chrome/browser/lifetime/',
diff --git a/WATCHLISTS b/WATCHLISTS index d1715fd1..1a0a4494 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -942,6 +942,9 @@ 'devtools': { 'filepath': 'devtools', }, + 'diagnostics_ui': { + 'filepath': 'chromeos/components/diagnostics_ui/', + }, 'disk_cache': { 'filepath': 'net/disk_cache/|http_cache', }, @@ -2451,6 +2454,10 @@ 'mattreynolds+watch@chromium.org', 'odejesush+watch@chromium.org'], 'devtools': ['devtools-reviews@chromium.org'], + 'diagnostics_ui': ['baileyberro+diagnostics-watch@chromium.org', + 'joonbug+diagnostics-watch@chromium.org', + 'michaelcheco+diagnostics-watch@google.com', + 'zentaro+diagnostics-watch@chromium.org'], 'disk_cache': ['gavinp+disk@chromium.org'], 'dom_storage': ['dmurph+watchingdomstorage@chromium.org'], 'download': ['dtrainor+watch@chromium.org'],
diff --git a/android_webview/expectations/system_webview_bundle.AndroidManifest.expected b/android_webview/expectations/system_webview_bundle.AndroidManifest.expected index 662e2c4e..7db6f74 100644 --- a/android_webview/expectations/system_webview_bundle.AndroidManifest.expected +++ b/android_webview/expectations/system_webview_bundle.AndroidManifest.expected
@@ -76,6 +76,18 @@ android:process=":webview_service" android:visibleToInstantApps="true"> </provider> # DIFF-ANCHOR: bfe37944 + <receiver # DIFF-ANCHOR: 1091f66b + android:exported="false" + android:name="com.google.android.gms.cast.framework.media.MediaIntentReceiver"> + </receiver> # DIFF-ANCHOR: 1091f66b + <service # DIFF-ANCHOR: 41539e3c + android:exported="false" + android:name="com.google.android.gms.cast.framework.ReconnectionService"> + </service> # DIFF-ANCHOR: 41539e3c + <service # DIFF-ANCHOR: 7dad1ec5 + android:exported="false" + android:name="com.google.android.gms.cast.framework.media.MediaNotificationService"> + </service> # DIFF-ANCHOR: 7dad1ec5 <service # DIFF-ANCHOR: 3cd6d713 android:exported="true" android:name="org.chromium.android_webview.services.AwMinidumpUploadJobService"
diff --git a/android_webview/expectations/trichrome_webview_bundle.AndroidManifest.expected b/android_webview/expectations/trichrome_webview_bundle.AndroidManifest.expected index 160a42ab..c410529 100644 --- a/android_webview/expectations/trichrome_webview_bundle.AndroidManifest.expected +++ b/android_webview/expectations/trichrome_webview_bundle.AndroidManifest.expected
@@ -76,6 +76,18 @@ android:process=":webview_service" android:visibleToInstantApps="true"> </provider> # DIFF-ANCHOR: bfe37944 + <receiver # DIFF-ANCHOR: 1091f66b + android:exported="false" + android:name="com.google.android.gms.cast.framework.media.MediaIntentReceiver"> + </receiver> # DIFF-ANCHOR: 1091f66b + <service # DIFF-ANCHOR: 41539e3c + android:exported="false" + android:name="com.google.android.gms.cast.framework.ReconnectionService"> + </service> # DIFF-ANCHOR: 41539e3c + <service # DIFF-ANCHOR: 7dad1ec5 + android:exported="false" + android:name="com.google.android.gms.cast.framework.media.MediaNotificationService"> + </service> # DIFF-ANCHOR: 7dad1ec5 <service # DIFF-ANCHOR: 3cd6d713 android:exported="true" android:name="org.chromium.android_webview.services.AwMinidumpUploadJobService"
diff --git a/ash/app_list/app_list_controller_impl.cc b/ash/app_list/app_list_controller_impl.cc index a45734d..35be158 100644 --- a/ash/app_list/app_list_controller_impl.cc +++ b/ash/app_list/app_list_controller_impl.cc
@@ -67,6 +67,7 @@ #include "ui/base/ui_base_features.h" #include "ui/display/manager/display_manager.h" #include "ui/display/screen.h" +#include "ui/message_center/message_center.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/public/activation_client.h" @@ -215,6 +216,7 @@ shell->mru_window_tracker()->AddObserver(this); AssistantController::Get()->AddObserver(this); AssistantUiController::Get()->GetModel()->AddObserver(this); + message_center::MessageCenter::Get()->AddObserver(this); } AppListControllerImpl::~AppListControllerImpl() { @@ -1802,6 +1804,7 @@ is_shutdown_ = true; Shell* shell = Shell::Get(); + message_center::MessageCenter::Get()->RemoveObserver(this); AssistantController::Get()->RemoveObserver(this); AssistantUiController::Get()->GetModel()->RemoveObserver(this); shell->mru_window_tracker()->RemoveObserver(this); @@ -1831,7 +1834,8 @@ void AppListControllerImpl::OnAppUpdate(const apps::AppUpdate& update) { if (update.HasBadgeChanged() && - notification_badging_pref_enabled_.value_or(false)) { + notification_badging_pref_enabled_.value_or(false) && + !quiet_mode_enabled_.value_or(false)) { UpdateItemNotificationBadge(update.AppId(), update.HasBadge()); } } @@ -1841,6 +1845,10 @@ Observe(nullptr); } +void AppListControllerImpl::OnQuietModeChanged(bool in_quiet_mode) { + UpdateAppBadging(); +} + void AppListControllerImpl::UpdateTrackedAppWindow() { aura::Window* top_window = GetTopVisibleWindow(); if (tracked_app_window_ == top_window) @@ -1867,22 +1875,28 @@ } void AppListControllerImpl::UpdateAppBadging() { - DCHECK(pref_change_registrar_); - PrefService* prefs = pref_change_registrar_->prefs(); + bool new_badging_enabled = pref_change_registrar_ + ? pref_change_registrar_->prefs()->GetBoolean( + prefs::kAppNotificationBadgingEnabled) + : false; + bool new_quiet_mode_enabled = + message_center::MessageCenter::Get()->IsQuietMode(); - bool new_badging_enabled = - prefs->GetBoolean(prefs::kAppNotificationBadgingEnabled); if (notification_badging_pref_enabled_.has_value() && - notification_badging_pref_enabled_.value() == new_badging_enabled) { + notification_badging_pref_enabled_.value() == new_badging_enabled && + quiet_mode_enabled_.has_value() && + quiet_mode_enabled_.value() == new_quiet_mode_enabled) { return; } notification_badging_pref_enabled_ = new_badging_enabled; + quiet_mode_enabled_ = new_quiet_mode_enabled; if (cache_) { cache_->ForEachApp([this](const apps::AppUpdate& update) { // Set the app notification badge hidden when the pref is disabled. apps::mojom::OptionalBool has_badge = notification_badging_pref_enabled_.value() && + !quiet_mode_enabled_.value() && (update.HasBadge() == apps::mojom::OptionalBool::kTrue) ? apps::mojom::OptionalBool::kTrue : apps::mojom::OptionalBool::kFalse;
diff --git a/ash/app_list/app_list_controller_impl.h b/ash/app_list/app_list_controller_impl.h index 439d8f6..63a39d7 100644 --- a/ash/app_list/app_list_controller_impl.h +++ b/ash/app_list/app_list_controller_impl.h
@@ -37,6 +37,7 @@ #include "components/sync/model/string_ordinal.h" #include "ui/aura/window_observer.h" #include "ui/display/types/display_constants.h" +#include "ui/message_center/message_center_observer.h" class PrefChangeRegistrar; class PrefRegistrySimple; @@ -69,7 +70,8 @@ public AssistantControllerObserver, public AssistantUiModelObserver, public HomeScreenDelegate, - public apps::AppRegistryCache::Observer { + public apps::AppRegistryCache::Observer, + public message_center::MessageCenterObserver { public: AppListControllerImpl(); ~AppListControllerImpl() override; @@ -306,6 +308,9 @@ void OnAppRegistryCacheWillBeDestroyed( apps::AppRegistryCache* cache) override; + // message_center::MessageCenterObserver: + void OnQuietModeChanged(bool in_quiet_mode) override; + bool onscreen_keyboard_shown() const { return onscreen_keyboard_shown_; } HomeLauncherTransitionState home_launcher_transition_state() const { @@ -494,6 +499,9 @@ // Whether the pref for notification badging is enabled. base::Optional<bool> notification_badging_pref_enabled_; + // Whether quiet mode is currently enabled. + base::Optional<bool> quiet_mode_enabled_; + DISALLOW_COPY_AND_ASSIGN(AppListControllerImpl); };
diff --git a/ash/app_list/views/privacy_info_view.cc b/ash/app_list/views/privacy_info_view.cc index bc7a6a6..ddab3e9 100644 --- a/ash/app_list/views/privacy_info_view.cc +++ b/ash/app_list/views/privacy_info_view.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "ash/public/cpp/app_list/app_list_color_provider.h" #include "base/bind.h" #include "ui/accessibility/ax_action_data.h" #include "ui/accessibility/ax_enums.mojom.h" @@ -285,7 +286,7 @@ ax::mojom::Role::kGenericContainer); views::StyledLabel::RangeStyleInfo style; - style.override_color = gfx::kGoogleGrey900; + style.override_color = AppListColorProvider::Get()->GetSearchBoxTextColor(); text_view_->AddStyleRange(gfx::Range(0, offset), style); // Create a custom view for the link portion of the text. This allows an
diff --git a/ash/clipboard/clipboard_history_controller_impl.cc b/ash/clipboard/clipboard_history_controller_impl.cc index dda17b08..d6955a0 100644 --- a/ash/clipboard/clipboard_history_controller_impl.cc +++ b/ash/clipboard/clipboard_history_controller_impl.cc
@@ -58,6 +58,15 @@ return false; } +void SendSyntheticKeyEvent(ui::KeyboardCode key_code, int flags) { + ui::KeyEvent synthetic_key_event(/*type=*/ui::ET_KEY_PRESSED, key_code, + /*code=*/static_cast<ui::DomCode>(0), flags); + auto* host = GetWindowTreeHostForDisplay( + display::Screen::GetScreen()->GetPrimaryDisplay().id()); + DCHECK(host); + host->DeliverEventToSink(&synthetic_key_event); +} + } // namespace // ClipboardHistoryControllerImpl::AcceleratorTarget --------------------------- @@ -207,6 +216,12 @@ DCHECK(IsMenuShowing()); accelerator_target_->OnMenuShown(); + + // Send the synthetic key event to let the menu controller select the first + // menu item after showing the clipboard history menu. Note that calling + // `MenuItemView::SetSelected()` directly cannot update the menu controller + // so it does not work here. + SendSyntheticKeyEvent(ui::VKEY_DOWN, ui::EF_NONE); } bool ClipboardHistoryControllerImpl::CanShowMenu() const { @@ -266,13 +281,7 @@ original_data = clipboard->WriteClipboardData(std::move(temp_data)); } - ui::KeyEvent synthetic_key_event(ui::ET_KEY_PRESSED, ui::VKEY_V, - static_cast<ui::DomCode>(0), - ui::EF_CONTROL_DOWN); - auto* host = ash::GetWindowTreeHostForDisplay( - display::Screen::GetScreen()->GetPrimaryDisplay().id()); - DCHECK(host); - host->DeliverEventToSink(&synthetic_key_event); + SendSyntheticKeyEvent(ui::VKEY_V, ui::EF_CONTROL_DOWN); if (!original_data) return; @@ -321,7 +330,21 @@ return; } + using SelectionMoveDirection = + ClipboardHistoryMenuModelAdapter::SelectionMoveDirection; + SelectionMoveDirection move_direction = + context_menu_->CalculateSelectionMoveAfterDeletion(*selected_command); + context_menu_->RemoveMenuItemWithCommandId(*selected_command); + + // Select a new menu item. + switch (move_direction) { + case SelectionMoveDirection::kPrevious: + SendSyntheticKeyEvent(ui::VKEY_UP, ui::EF_NONE); + break; + case SelectionMoveDirection::kNext: + SendSyntheticKeyEvent(ui::VKEY_DOWN, ui::EF_NONE); + } } gfx::Rect ClipboardHistoryControllerImpl::CalculateAnchorRect() const {
diff --git a/ash/clipboard/clipboard_history_controller_unittest.cc b/ash/clipboard/clipboard_history_controller_unittest.cc index 28aa947b..06f6a072 100644 --- a/ash/clipboard/clipboard_history_controller_unittest.cc +++ b/ash/clipboard/clipboard_history_controller_unittest.cc
@@ -160,46 +160,6 @@ "Ash.ClipboardHistory.ContextMenu.UserJourneyTime", 2); } -// Tests that backspace deletes an item, and if it is the last item, the menu is -// closed. -TEST_F(ClipboardHistoryControllerTest, BasicShowMenu) { - base::HistogramTester histogram_tester; - WriteToClipboard("test"); - WriteToClipboard("test"); - - ShowMenu(); - - EXPECT_TRUE(GetClipboardHistoryController()->IsMenuShowing()); - - // Press any key to select the first item. - GetEventGenerator()->PressKey(ui::VKEY_RETURN, /*flags=*/0); - GetEventGenerator()->ReleaseKey(ui::VKEY_RETURN, /*flags=*/0); - - // Press backspace to delete the first item, the menu should still be showing. - GetEventGenerator()->PressKey(ui::VKEY_BACK, /*flags=*/0); - GetEventGenerator()->ReleaseKey(ui::VKEY_BACK, /*flags=*/0); - - EXPECT_TRUE(GetClipboardHistoryController()->IsMenuShowing()); - - // Press any key to select the first item. - GetEventGenerator()->PressKey(ui::VKEY_RETURN, /*flags=*/0); - GetEventGenerator()->ReleaseKey(ui::VKEY_RETURN, /*flags=*/0); - - // Delete the final item, the menu should close. - GetEventGenerator()->PressKey(ui::VKEY_BACK, /*flags=*/0); - GetEventGenerator()->ReleaseKey(ui::VKEY_BACK, /*flags=*/0); - - EXPECT_FALSE(GetClipboardHistoryController()->IsMenuShowing()); - - // This histogram is only recorded when the menu is initially built, so this - // should not be recorded more than once in one show, regardless of the menu - // contents changing. - histogram_tester.ExpectBucketCount( - "Ash.ClipboardHistory.ContextMenu.NumberOfItemsShown", 2, 1); - histogram_tester.ExpectTotalCount( - "Ash.ClipboardHistory.ContextMenu.UserJourneyTime", 1); -} - // Verifies that the clipboard history is disabled in some user modes, which // means that the clipboard history should not be recorded and meanwhile the // menu view should not show (https://crbug.com/1100739).
diff --git a/ash/clipboard/clipboard_history_menu_model_adapter.cc b/ash/clipboard/clipboard_history_menu_model_adapter.cc index 9bab87d..c288c38f 100644 --- a/ash/clipboard/clipboard_history_menu_model_adapter.cc +++ b/ash/clipboard/clipboard_history_menu_model_adapter.cc
@@ -117,6 +117,29 @@ model_->RemoveItemAt(model_->GetIndexOfCommandId(command_id)); root_view_->RemoveMenuItem(root_view_->GetMenuItemByID(command_id)); root_view_->ChildrenChanged(); + + auto item_to_delete = item_snapshots_.find(command_id); + DCHECK(item_to_delete != item_snapshots_.end()); + item_snapshots_.erase(item_to_delete); +} + +ClipboardHistoryMenuModelAdapter::SelectionMoveDirection +ClipboardHistoryMenuModelAdapter::CalculateSelectionMoveAfterDeletion( + int command_id) const { + auto item_to_delete = item_snapshots_.find(command_id); + DCHECK(item_to_delete != item_snapshots_.end()); + + // The menu item to be deleted should be selected. + DCHECK(root_view_->GetMenuItemByID(command_id)->IsSelected()); + + // If the menu item view to be deleted is the last one, Cancel() + // should be called so this function should not be hit. + DCHECK_GT(item_snapshots_.size(), 1u); + + // select the next menu item if any or the previous one. + return std::next(item_to_delete, 1) == item_snapshots_.end() + ? SelectionMoveDirection::kPrevious + : SelectionMoveDirection::kNext; } gfx::Rect ClipboardHistoryMenuModelAdapter::GetMenuBoundsInScreenForTest()
diff --git a/ash/clipboard/clipboard_history_menu_model_adapter.h b/ash/clipboard/clipboard_history_menu_model_adapter.h index 279fcb1..29a9bc9 100644 --- a/ash/clipboard/clipboard_history_menu_model_adapter.h +++ b/ash/clipboard/clipboard_history_menu_model_adapter.h
@@ -33,6 +33,15 @@ // copied. class ASH_EXPORT ClipboardHistoryMenuModelAdapter : views::MenuModelAdapter { public: + // Indicates the direction of selection movement. + enum class SelectionMoveDirection { + // Selection moves up to the previous menu item. + kPrevious, + + // Selection moves down to the next menu item. + kNext + }; + static std::unique_ptr<ClipboardHistoryMenuModelAdapter> Create( ui::SimpleMenuModel::Delegate* delegate, base::RepeatingClosure menu_closed_callback, @@ -70,6 +79,11 @@ // Remove the menu item specified by `command_id`. void RemoveMenuItemWithCommandId(int command_id); + // Returns the direction in which the selection state should move if the menu + // item corresponding to `command_id` is deleted. + SelectionMoveDirection CalculateSelectionMoveAfterDeletion( + int command_id) const; + // Returns menu bounds in screen coordinates. gfx::Rect GetMenuBoundsInScreenForTest() const;
diff --git a/ash/login/ui/lock_contents_view.cc b/ash/login/ui/lock_contents_view.cc index b60b6ea..50905a9 100644 --- a/ash/login/ui/lock_contents_view.cc +++ b/ash/login/ui/lock_contents_view.cc
@@ -1467,7 +1467,7 @@ return; keyboard_shown_ = is_visible; - LayoutAuth(CurrentBigUserView(), nullptr /*opt_to_hide*/, false /*animate*/); + LayoutAuth(CurrentBigUserView(), nullptr /*opt_to_hide*/, true /*animate*/); } void LockContentsView::SuspendImminent(
diff --git a/ash/shelf/shelf_controller.cc b/ash/shelf/shelf_controller.cc index aa03d3e..e160f81 100644 --- a/ash/shelf/shelf_controller.cc +++ b/ash/shelf/shelf_controller.cc
@@ -26,6 +26,7 @@ #include "ui/base/ui_base_features.h" #include "ui/display/display.h" #include "ui/display/screen.h" +#include "ui/message_center/message_center.h" namespace ash { @@ -108,6 +109,7 @@ Shell::Get()->tablet_mode_controller()->AddObserver(this); Shell::Get()->window_tree_host_manager()->AddObserver(this); model_.AddObserver(this); + message_center::MessageCenter::Get()->AddObserver(this); } ShelfController::~ShelfController() { @@ -115,6 +117,7 @@ } void ShelfController::Shutdown() { + message_center::MessageCenter::Get()->RemoveObserver(this); model_.RemoveObserver(this); Shell::Get()->window_tree_host_manager()->RemoveObserver(this); Shell::Get()->tablet_mode_controller()->RemoveObserver(this); @@ -222,7 +225,8 @@ void ShelfController::OnAppUpdate(const apps::AppUpdate& update) { if (update.HasBadgeChanged() && - notification_badging_pref_enabled_.value_or(false)) { + notification_badging_pref_enabled_.value_or(false) && + !quiet_mode_enabled_.value_or(false)) { bool has_badge = update.HasBadge() == apps::mojom::OptionalBool::kTrue; model_.UpdateItemNotification(update.AppId(), has_badge); } @@ -247,23 +251,33 @@ }); } -void ShelfController::UpdateAppBadging() { - DCHECK(pref_change_registrar_); - PrefService* prefs = pref_change_registrar_->prefs(); +void ShelfController::OnQuietModeChanged(bool in_quiet_mode) { + UpdateAppBadging(); +} - bool new_badging_enabled = - prefs->GetBoolean(prefs::kAppNotificationBadgingEnabled); +void ShelfController::UpdateAppBadging() { + bool new_badging_enabled = pref_change_registrar_ + ? pref_change_registrar_->prefs()->GetBoolean( + prefs::kAppNotificationBadgingEnabled) + : false; + bool new_quiet_mode_enabled = + message_center::MessageCenter::Get()->IsQuietMode(); + if (notification_badging_pref_enabled_.has_value() && - notification_badging_pref_enabled_.value() == new_badging_enabled) { + notification_badging_pref_enabled_.value() == new_badging_enabled && + quiet_mode_enabled_.has_value() && + quiet_mode_enabled_.value() == new_quiet_mode_enabled) { return; } notification_badging_pref_enabled_ = new_badging_enabled; + quiet_mode_enabled_ = new_quiet_mode_enabled; if (cache_) { cache_->ForEachApp([this](const apps::AppUpdate& update) { // Set the app notification badge hidden when the pref is disabled. bool has_badge = - notification_badging_pref_enabled_.value() + notification_badging_pref_enabled_.value() && + !quiet_mode_enabled_.value() ? (update.HasBadge() == apps::mojom::OptionalBool::kTrue) : false;
diff --git a/ash/shelf/shelf_controller.h b/ash/shelf/shelf_controller.h index 15d20174..1670313 100644 --- a/ash/shelf/shelf_controller.h +++ b/ash/shelf/shelf_controller.h
@@ -17,6 +17,7 @@ #include "base/scoped_observer.h" #include "components/services/app_service/public/cpp/app_registry_cache.h" #include "components/services/app_service/public/cpp/app_update.h" +#include "ui/message_center/message_center_observer.h" class PrefChangeRegistrar; class PrefRegistrySimple; @@ -25,11 +26,13 @@ // ShelfController owns the ShelfModel and manages shelf preferences. // ChromeLauncherController and related classes largely manage the ShelfModel. -class ASH_EXPORT ShelfController : public SessionObserver, - public TabletModeObserver, - public WindowTreeHostManager::Observer, - public apps::AppRegistryCache::Observer, - public ShelfModelObserver { +class ASH_EXPORT ShelfController + : public SessionObserver, + public TabletModeObserver, + public WindowTreeHostManager::Observer, + public apps::AppRegistryCache::Observer, + public ShelfModelObserver, + public message_center::MessageCenterObserver { public: ShelfController(); ~ShelfController() override; @@ -60,6 +63,9 @@ // ShelfModelObserver: void ShelfItemAdded(int index) override; + // message_center::MessageCenterObserver: + void OnQuietModeChanged(bool in_quiet_mode) override; + // Updates whether an app badge is shown for the shelf items in the model. void UpdateAppBadging(); @@ -72,6 +78,9 @@ // Whether the pref for notification badging is enabled. base::Optional<bool> notification_badging_pref_enabled_; + // Whether quiet mode is currently enabled. + base::Optional<bool> quiet_mode_enabled_; + // Observes user profile prefs for the shelf. std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
diff --git a/ash/system/media/media_tray.cc b/ash/system/media/media_tray.cc index 1b49c5c..118b81e 100644 --- a/ash/system/media/media_tray.cc +++ b/ash/system/media/media_tray.cc
@@ -17,7 +17,6 @@ #include "ash/system/tray/tray_bubble_wrapper.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_container.h" -#include "ash/system/tray/tray_popup_item_style.h" #include "ash/system/tray/tray_utils.h" #include "base/strings/string_util.h" #include "components/prefs/pref_change_registrar.h" @@ -37,6 +36,9 @@ namespace { +constexpr int kTitleFontSizeIncrease = 4; +constexpr int kTitleViewHeight = 56; + constexpr gfx::Insets kTitleViewInsets = gfx::Insets(0, 16, 0, 16); // Minimum screen diagonal (in inches) for pinning global media controls @@ -82,7 +84,7 @@ auto* box_layout = SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal, kTitleViewInsets)); - box_layout->set_minimum_cross_axis_size(kTrayPopupItemMinHeight); + box_layout->set_minimum_cross_axis_size(kTitleViewHeight); box_layout->set_cross_axis_alignment( views::BoxLayout::CrossAxisAlignment::kCenter); @@ -90,9 +92,11 @@ title_label->SetText( l10n_util::GetStringUTF16(IDS_ASH_GLOBAL_MEDIA_CONTROLS_TITLE)); title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); - TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SMALL_TITLE, - true /* use_unified_theme */); - style.SetupLabel(title_label); + title_label->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor( + AshColorProvider::ContentLayerType::kTextColorPrimary)); + title_label->SetAutoColorReadabilityEnabled(false); + title_label->SetFontList(views::Label::GetDefaultFontList().Derive( + kTitleFontSizeIncrease, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM)); // Media tray should always be pinned to shelf when we are opening the // dialog.
diff --git a/ash/system/media/unified_media_controls_container.cc b/ash/system/media/unified_media_controls_container.cc index f51248f9..e88c2e1b 100644 --- a/ash/system/media/unified_media_controls_container.cc +++ b/ash/system/media/unified_media_controls_container.cc
@@ -10,7 +10,7 @@ namespace ash { namespace { -constexpr int kContainerHeight = 80; +constexpr int kContainerHeight = 72; constexpr gfx::Insets kContainerInsets = gfx::Insets(0, 16, 16, 16); } // namespace
diff --git a/ash/system/media/unified_media_controls_controller.cc b/ash/system/media/unified_media_controls_controller.cc index 74f8f21..a25bf344 100644 --- a/ash/system/media/unified_media_controls_controller.cc +++ b/ash/system/media/unified_media_controls_controller.cc
@@ -10,6 +10,7 @@ #include "services/media_session/public/cpp/util.h" #include "services/media_session/public/mojom/media_session.mojom.h" #include "services/media_session/public/mojom/media_session_service.mojom.h" +#include "ui/views/controls/image_view.h" #include "ui/views/view.h" namespace ash { @@ -23,6 +24,10 @@ constexpr base::TimeDelta kHideControlsDelay = base::TimeDelta::FromMilliseconds(2000); +// Time to wait for new artwork. +constexpr base::TimeDelta kHideArtworkDelay = + base::TimeDelta::FromMilliseconds(2000); + } // namespace UnifiedMediaControlsController::UnifiedMediaControlsController( @@ -137,10 +142,28 @@ } } - base::Optional<gfx::ImageSkia> session_artwork; - if (!converted_bitmap.empty()) - session_artwork = gfx::ImageSkia::CreateFrom1xBitmap(converted_bitmap); - media_controls_->SetArtwork(session_artwork); + // If we do get an artwork, set the artwork immediately and stop + // |hide_artwork_timer_| if necessary. + if (!converted_bitmap.empty()) { + if (hide_artwork_timer_->IsRunning()) + hide_artwork_timer_->Stop(); + + media_controls_->SetArtwork( + gfx::ImageSkia::CreateFrom1xBitmap(converted_bitmap)); + return; + } + + if (media_controls_->artwork_view()->GetImage().isNull()) + return; + + // Start |hide_artork_timer_} if not already started and wait for + // artwork update. + if (!hide_artwork_timer_->IsRunning()) { + hide_artwork_timer_->Start( + FROM_HERE, kHideArtworkDelay, + base::BindOnce(&UnifiedMediaControlsView::SetArtwork, + base::Unretained(media_controls_), base::nullopt)); + } } void UnifiedMediaControlsController::OnMediaControlsViewClicked() {
diff --git a/ash/system/media/unified_media_controls_controller.h b/ash/system/media/unified_media_controls_controller.h index 23508f9..1944089 100644 --- a/ash/system/media/unified_media_controls_controller.h +++ b/ash/system/media/unified_media_controls_controller.h
@@ -89,6 +89,9 @@ std::unique_ptr<base::OneShotTimer> hide_controls_timer_ = std::make_unique<base::OneShotTimer>(); + std::unique_ptr<base::OneShotTimer> hide_artwork_timer_ = + std::make_unique<base::OneShotTimer>(); + base::Optional<base::UnguessableToken> media_session_id_; base::flat_set<media_session::mojom::MediaSessionAction> enabled_actions_;
diff --git a/ash/system/media/unified_media_controls_controller_unittest.cc b/ash/system/media/unified_media_controls_controller_unittest.cc index 4849bfdb..dd0e5b81 100644 --- a/ash/system/media/unified_media_controls_controller_unittest.cc +++ b/ash/system/media/unified_media_controls_controller_unittest.cc
@@ -25,8 +25,9 @@ namespace { constexpr int kHideControlsDelay = 2000; /* in milliseconds */ +constexpr int kHideArtworkDelay = 2000; /* in milliseconds */ constexpr int kArtworkCornerRadius = 4; -constexpr int kArtworkHeight = 48; +constexpr int kArtworkHeight = 40; class MockMediaControlsDelegate : public UnifiedMediaControlsController::Delegate { @@ -265,7 +266,7 @@ controller()->MediaControllerImageChanged( media_session::mojom::MediaSessionImageType::kArtwork, artwork); { - gfx::Rect expect_bounds(0, 12, 48, 24); + gfx::Rect expect_bounds(0, 10, 40, 20); gfx::Rect artwork_bounds = artwork_view()->GetImageBounds(); EXPECT_EQ(artwork_bounds, expect_bounds); @@ -280,7 +281,7 @@ controller()->MediaControllerImageChanged( media_session::mojom::MediaSessionImageType::kArtwork, artwork); { - gfx::Rect expect_bounds(12, 0, 24, 48); + gfx::Rect expect_bounds(10, 0, 20, 40); gfx::Rect artwork_bounds = artwork_view()->GetImageBounds(); EXPECT_EQ(artwork_bounds, expect_bounds); @@ -295,7 +296,7 @@ controller()->MediaControllerImageChanged( media_session::mojom::MediaSessionImageType::kArtwork, artwork); { - gfx::Rect expect_bounds(14, 0, 20, kArtworkHeight); + gfx::Rect expect_bounds(10, 0, 20, kArtworkHeight); gfx::Rect artwork_bounds = artwork_view()->GetImageBounds(); EXPECT_EQ(artwork_bounds, expect_bounds); @@ -305,10 +306,60 @@ EXPECT_EQ(path, GetArtworkClipPath()); } - // Test that artwork view will be hidden if we get an empty artowrk. + // Test that artwork view will be hidden after |kHideArtworkDelay| ms if + // we get an empty artowrk. artwork.reset(); controller()->MediaControllerImageChanged( media_session::mojom::MediaSessionImageType::kArtwork, artwork); + task_environment()->FastForwardBy( + base::TimeDelta::FromMilliseconds(kHideArtworkDelay)); + EXPECT_FALSE(artwork_view()->GetVisible()); +} + +// Test that artwork views hides after a certain delay +// when received a null artwork image. +TEST_F(UnifiedMediaControlsControllerTest, HideArtwork) { + // Artwork view starts hidden. + EXPECT_FALSE(artwork_view()->GetVisible()); + + // Artwork view should be visible after getting an artowrk image update. + SkBitmap artwork; + artwork.allocN32Pixels(40, 40); + controller()->MediaControllerImageChanged( + media_session::mojom::MediaSessionImageType::kArtwork, artwork); + EXPECT_TRUE(artwork_view()->GetVisible()); + + // Artwork should still be visible after getting an empty artowrk. + artwork.reset(); + controller()->MediaControllerImageChanged( + media_session::mojom::MediaSessionImageType::kArtwork, artwork); + EXPECT_TRUE(artwork_view()->GetVisible()); + + // Artwork should still be visible if we are within hide artwork delay + // time frame. + task_environment()->FastForwardBy( + base::TimeDelta::FromMilliseconds(kHideArtworkDelay - 1)); + EXPECT_TRUE(artwork_view()->GetVisible()); + + // Artwork should be visible after getting an artwork update and the + // timer should be stopped. + artwork.allocN32Pixels(40, 40); + controller()->MediaControllerImageChanged( + media_session::mojom::MediaSessionImageType::kArtwork, artwork); + EXPECT_TRUE(artwork_view()->GetVisible()); + + // Artwork should stay visible. + task_environment()->FastForwardBy( + base::TimeDelta::FromMilliseconds(kHideArtworkDelay)); + EXPECT_TRUE(artwork_view()->GetVisible()); + + // Wait for |kHideartworkDelay| ms after getting an empty artwork, + // artwork view should now be hidden. + artwork.reset(); + controller()->MediaControllerImageChanged( + media_session::mojom::MediaSessionImageType::kArtwork, artwork); + task_environment()->FastForwardBy( + base::TimeDelta::FromMilliseconds(kHideArtworkDelay)); EXPECT_FALSE(artwork_view()->GetVisible()); }
diff --git a/ash/system/media/unified_media_controls_view.cc b/ash/system/media/unified_media_controls_view.cc index 5173fe1..d725157 100644 --- a/ash/system/media/unified_media_controls_view.cc +++ b/ash/system/media/unified_media_controls_view.cc
@@ -4,16 +4,22 @@ #include "ash/system/media/unified_media_controls_view.h" +#include "ash/resources/vector_icons/vector_icons.h" #include "ash/strings/grit/ash_strings.h" #include "ash/style/ash_color_provider.h" #include "ash/system/media/unified_media_controls_controller.h" #include "ash/system/tray/tray_constants.h" +#include "ash/system/tray/tray_popup_utils.h" #include "components/media_message_center/media_notification_util.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/paint_vector_icon.h" +#include "ui/views/animation/flood_fill_ink_drop_ripple.h" +#include "ui/views/animation/ink_drop_highlight.h" +#include "ui/views/animation/ink_drop_impl.h" #include "ui/views/background.h" #include "ui/views/border.h" +#include "ui/views/controls/highlight_path_generator.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/layout/box_layout.h" @@ -25,16 +31,18 @@ namespace { constexpr int kMediaControlsCornerRadius = 8; -constexpr int kMediaControlsViewPadding = 8; -constexpr int kMediaButtonsPadding = 4; -constexpr int kMediaButtonIconSize = 18; +constexpr int kMediaControlsViewPadding = 16; +constexpr int kMediaButtonsPadding = 8; +constexpr int kMediaButtonIconSize = 20; constexpr int kArtworkCornerRadius = 4; +constexpr int kTitleRowHeight = 20; +constexpr int kTrackTitleFontSizeIncrease = 1; -constexpr gfx::Insets kTrackColumnInsets = gfx::Insets(0, 8, 0, 0); -constexpr gfx::Insets kMediaControlsViewInsets = gfx::Insets(8, 8, 8, 8); +constexpr gfx::Insets kTrackColumnInsets = gfx::Insets(1, 0, 1, 0); +constexpr gfx::Insets kMediaControlsViewInsets = gfx::Insets(8, 8, 8, 12); -constexpr gfx::Size kArtworkSize = gfx::Size(48, 48); -constexpr gfx::Size kMediaButtonSize = gfx::Size(36, 36); +constexpr gfx::Size kArtworkSize = gfx::Size(40, 40); +constexpr gfx::Size kMediaButtonSize = gfx::Size(32, 32); gfx::Size ScaleSizeToFitView(const gfx::Size& size, const gfx::Size& view_size) { @@ -93,6 +101,9 @@ SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE); SetPreferredSize(kMediaButtonSize); SetAction(action, accessible_name); + + TrayPopupUtils::ConfigureTrayPopupButton(this); + views::InstallCircleHighlightPathGenerator(this); } void UnifiedMediaControlsView::MediaActionButton::SetAction( @@ -107,6 +118,25 @@ AshColorProvider::ContentLayerType::kIconColorPrimary))); } +std::unique_ptr<views::InkDrop> +UnifiedMediaControlsView::MediaActionButton::CreateInkDrop() { + auto ink_drop = TrayPopupUtils::CreateInkDrop(this); + ink_drop->SetShowHighlightOnHover(true); + return ink_drop; +} + +std::unique_ptr<views::InkDropHighlight> +UnifiedMediaControlsView::MediaActionButton::CreateInkDropHighlight() const { + return TrayPopupUtils::CreateInkDropHighlight(this); +} + +std::unique_ptr<views::InkDropRipple> +UnifiedMediaControlsView::MediaActionButton::CreateInkDropRipple() const { + return TrayPopupUtils::CreateInkDropRipple( + TrayPopupInkDropStyle::FILL_BOUNDS, this, + GetInkDropCenterBasedOnLastEvent()); +} + UnifiedMediaControlsView::UnifiedMediaControlsView( UnifiedMediaControlsController* controller) : views::Button(this), controller_(controller) { @@ -129,6 +159,12 @@ track_column->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kVertical, kTrackColumnInsets)); + auto title_row = std::make_unique<views::View>(); + auto* title_row_layout = + title_row->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::Orientation::kHorizontal, gfx::Insets())); + title_row_layout->set_minimum_cross_axis_size(kTitleRowHeight); + auto config_label = [](views::Label* label) { label->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT); label->SetAutoColorReadabilityEnabled(false); @@ -139,7 +175,21 @@ config_label(title_label.get()); title_label->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor( AshColorProvider::ContentLayerType::kTextColorPrimary)); - title_label_ = track_column->AddChildView(std::move(title_label)); + title_label->SetFontList( + views::Label::GetDefaultFontList().DeriveWithSizeDelta( + kTrackTitleFontSizeIncrease)); + title_label_ = title_row->AddChildView(std::move(title_label)); + + auto drop_down_icon = std::make_unique<views::ImageView>(); + drop_down_icon->SetPreferredSize(gfx::Size(kTitleRowHeight, kTitleRowHeight)); + drop_down_icon->SetImage(CreateVectorIcon( + kUnifiedMenuMoreIcon, + AshColorProvider::Get()->GetContentLayerColor( + AshColorProvider::ContentLayerType::kIconColorPrimary))); + title_row->AddChildView(std::move(drop_down_icon)); + + title_row_layout->SetFlexForView(title_label_, 1); + track_column->AddChildView(std::move(title_row)); auto artist_label = std::make_unique<views::Label>(); config_label(artist_label.get());
diff --git a/ash/system/media/unified_media_controls_view.h b/ash/system/media/unified_media_controls_view.h index 4ca6787..91575e5 100644 --- a/ash/system/media/unified_media_controls_view.h +++ b/ash/system/media/unified_media_controls_view.h
@@ -43,6 +43,8 @@ const base::flat_set<media_session::mojom::MediaSessionAction>& enabled_actions); + views::ImageView* artwork_view() { return artwork_view_; } + private: friend class UnifiedMediaControlsControllerTest; @@ -55,6 +57,12 @@ void SetAction(media_session::mojom::MediaSessionAction action, const base::string16& accessible_name); + + // views::ImageButton: + std::unique_ptr<views::InkDrop> CreateInkDrop() override; + std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() + const override; + std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; }; SkPath GetArtworkClipPath();
diff --git a/ash/system/phonehub/phone_hub_notification_controller_unittest.cc b/ash/system/phonehub/phone_hub_notification_controller_unittest.cc index e7be2fc..85e01eae 100644 --- a/ash/system/phonehub/phone_hub_notification_controller_unittest.cc +++ b/ash/system/phonehub/phone_hub_notification_controller_unittest.cc
@@ -77,7 +77,7 @@ TEST_F(PhoneHubNotificationControllerTest, AddNotifications) { EXPECT_FALSE(message_center_->NotificationCount()); - notification_manager_.SetNotifications(fake_notifications_); + notification_manager_.SetNotificationsInternal(fake_notifications_); EXPECT_EQ(3u, message_center_->NotificationCount()); ASSERT_TRUE( @@ -95,7 +95,7 @@ TEST_F(PhoneHubNotificationControllerTest, UpdateNotifications) { EXPECT_FALSE(message_center_->NotificationCount()); - notification_manager_.SetNotifications(fake_notifications_); + notification_manager_.SetNotificationsInternal(fake_notifications_); EXPECT_EQ(3u, message_center_->NotificationCount()); auto* notification = @@ -124,7 +124,7 @@ TEST_F(PhoneHubNotificationControllerTest, RemoveNotifications) { EXPECT_FALSE(message_center_->NotificationCount()); - notification_manager_.SetNotifications(fake_notifications_); + notification_manager_.SetNotificationsInternal(fake_notifications_); EXPECT_EQ(3u, message_center_->NotificationCount()); notification_manager_.RemoveNotification(kPhoneHubNotificationId0); @@ -132,13 +132,13 @@ EXPECT_FALSE( message_center_->FindVisibleNotificationById(kCrOSNotificationId0)); - notification_manager_.RemoveNotifications(base::flat_set<int64_t>( + notification_manager_.RemoveNotificationsInternal(base::flat_set<int64_t>( {kPhoneHubNotificationId1, kPhoneHubNotificationId2})); EXPECT_FALSE(message_center_->NotificationCount()); } TEST_F(PhoneHubNotificationControllerTest, CloseByUser) { - notification_manager_.SetNotifications(fake_notifications_); + notification_manager_.SetNotificationsInternal(fake_notifications_); EXPECT_EQ(3u, message_center_->NotificationCount()); message_center_->RemoveNotification(kCrOSNotificationId0, /*by_user=*/true); @@ -152,7 +152,7 @@ } TEST_F(PhoneHubNotificationControllerTest, InlineReply) { - notification_manager_.SetNotifications(fake_notifications_); + notification_manager_.SetNotificationsInternal(fake_notifications_); const base::string16 kInlineReply0 = base::UTF8ToUTF16("inline reply 0"); const base::string16 kInlineReply1 = base::UTF8ToUTF16("inline reply 1");
diff --git a/ash/system/phonehub/phone_hub_tray_unittest.cc b/ash/system/phonehub/phone_hub_tray_unittest.cc index 6ae7939..f63a130 100644 --- a/ash/system/phonehub/phone_hub_tray_unittest.cc +++ b/ash/system/phonehub/phone_hub_tray_unittest.cc
@@ -127,7 +127,7 @@ } TEST_F(PhoneHubTrayTest, ShowNotificationOptInViewWhenAccessNotGranted) { - GetNotificationAccessManager()->SetHasAccessBeenGranted(false); + GetNotificationAccessManager()->SetHasAccessBeenGrantedInternal(false); ClickTrayButton(); @@ -142,7 +142,7 @@ } TEST_F(PhoneHubTrayTest, HideNotificationOptInViewWhenAccessHasBeenGranted) { - GetNotificationAccessManager()->SetHasAccessBeenGranted(true); + GetNotificationAccessManager()->SetHasAccessBeenGrantedInternal(true); ClickTrayButton(); @@ -150,7 +150,7 @@ } TEST_F(PhoneHubTrayTest, StartNotificationSetUpFlow) { - GetNotificationAccessManager()->SetHasAccessBeenGranted(false); + GetNotificationAccessManager()->SetHasAccessBeenGrantedInternal(false); ClickTrayButton(); EXPECT_TRUE(notification_opt_in_view());
diff --git a/ash/wm/desks/desk_name_view.cc b/ash/wm/desks/desk_name_view.cc index 74c0f7ce..0b2e15c 100644 --- a/ash/wm/desks/desk_name_view.cc +++ b/ash/wm/desks/desk_name_view.cc
@@ -22,6 +22,8 @@ namespace ash { constexpr int kDeskNameViewBorderRadius = 4; +constexpr int kDeskNameViewMinHeight = 24; +constexpr int kDeskNameViewHorizontalPadding = 6; namespace { @@ -45,7 +47,8 @@ } // namespace DeskNameView::DeskNameView() { - auto border = std::make_unique<WmHighlightItemBorder>(/*corner_radius=*/4); + auto border = std::make_unique<WmHighlightItemBorder>( + /*corner_radius=*/4, gfx::Insets(0, kDeskNameViewHorizontalPadding)); border_ptr_ = border.get(); SetBorder(std::move(border)); @@ -104,6 +107,7 @@ gfx::Size size{width + GetCaretBounds().width(), height}; const auto insets = GetInsets(); size.Enlarge(insets.width(), insets.height()); + size.SetToMax(gfx::Size(0, kDeskNameViewMinHeight)); return size; }
diff --git a/ash/wm/gestures/wm_gesture_handler.cc b/ash/wm/gestures/wm_gesture_handler.cc index 563423f..05af9b8 100644 --- a/ash/wm/gestures/wm_gesture_handler.cc +++ b/ash/wm/gestures/wm_gesture_handler.cc
@@ -120,15 +120,15 @@ auto* overview_controller = Shell::Get()->overview_controller(); const bool in_overview = overview_controller->InOverviewSession(); if (in_overview) { - // If touchpad reverse scroll is off, only swip down can exit overview. If - // touchpad reverse scroll is on, in M87 swip up can also exit overview but + // If touchpad reverse scroll is on, only swip down can exit overview. If + // touchpad reverse scroll is off, in M87 swip up can also exit overview but // show notification; in M88, swip up will only show notification; in M89 // the notification is removed. if (GetOffset(scroll_y) > 0) { - if (!IsNaturalScrollOn()) + if (IsNaturalScrollOn()) return false; - else - ShowOverviewGestureNotification(); + + ShowOverviewGestureNotification(); } base::RecordAction(base::UserMetricsAction("Touchpad_Gesture_Overview")); @@ -136,15 +136,15 @@ return true; overview_controller->EndOverview(); } else { - // If touchpad reverse scroll is off, only swip up can enter overview. If - // touchpad reverse scroll is on, in M87 swip down can also enter overview + // If touchpad reverse scroll is on, only swip up can enter overview. If + // touchpad reverse scroll is off, in M87 swip down can also enter overview // but show notification; in M88, swip down will only show notification; in // M89 the notification is removed. if (GetOffset(scroll_y) < 0) { - if (!IsNaturalScrollOn()) + if (IsNaturalScrollOn()) return false; - else - ShowOverviewGestureNotification(); + + ShowOverviewGestureNotification(); } auto* window_cycle_controller = Shell::Get()->window_cycle_controller();
diff --git a/ash/wm/gestures/wm_gesture_handler_unittest.cc b/ash/wm/gestures/wm_gesture_handler_unittest.cc index a78f38a..de2bed49 100644 --- a/ash/wm/gestures/wm_gesture_handler_unittest.cc +++ b/ash/wm/gestures/wm_gesture_handler_unittest.cc
@@ -106,17 +106,41 @@ Scroll(0, long_scroll, 3); EXPECT_TRUE(InOverviewSession()); - // Swiping up again does nothing. - Scroll(0, long_scroll, 3); - EXPECT_TRUE(InOverviewSession()); - // Swiping down exits. Scroll(0, -long_scroll, 3); EXPECT_FALSE(InOverviewSession()); +} - // Swiping down again does nothing. +// Tests wrong gestures that swiping down to enter and up to exit overview. +TEST_F(WmGestureHandlerTest, WrongVerticalScrolls) { + const float long_scroll = 2 * WmGestureHandler::kVerticalThresholdDp; + + // Swiping down can enter overview but a notification will be shown. Scroll(0, -long_scroll, 3); + EXPECT_TRUE(InOverviewSession()); + // Notification is shown for the first time. + EXPECT_TRUE(IsOverviewReverseGestureNotificationShown()); + CloseOverviewReverseGestureNotification(); + + // Swiping up can exit overview, but a notification will be shown. + Scroll(0, long_scroll, 3); EXPECT_FALSE(InOverviewSession()); + // Notification is shown for the second time. + EXPECT_TRUE(IsOverviewReverseGestureNotificationShown()); + CloseOverviewReverseGestureNotification(); + + // Swiping down triggers the notification for the last time. + Scroll(0, -long_scroll, 3); + EXPECT_TRUE(InOverviewSession()); + // Notification is shown for the third (last) time. + EXPECT_TRUE(IsOverviewReverseGestureNotificationShown()); + CloseOverviewReverseGestureNotification(); + + // Doing wrong gesture again won't trigger notification anymore. + Scroll(0, long_scroll, 3); + EXPECT_FALSE(InOverviewSession()); + // No notification will be shown anymore. + EXPECT_FALSE(IsOverviewReverseGestureNotificationShown()); } // Tests three or four finger horizontal scroll gesture (depending on flags) to @@ -421,41 +445,20 @@ TEST_F(ReverseGestureHandlerTest, Overview) { const float long_scroll = 2 * WmGestureHandler::kVerticalThresholdDp; - // Swipe down with three fingers. - Scroll(0, -long_scroll, 3); - // When keep old overview gesture is on, the old gesture also works. - EXPECT_TRUE(InOverviewSession()); - // Show notification for the first time. - EXPECT_TRUE(IsOverviewReverseGestureNotificationShown()); - // Close the Notification. - CloseOverviewReverseGestureNotification(); - - // Swipe up with three fingers. - Scroll(0, long_scroll, 3); - EXPECT_FALSE(InOverviewSession()); - // Show notification for the second time. - EXPECT_TRUE(IsOverviewReverseGestureNotificationShown()); - // Close the Notification. - CloseOverviewReverseGestureNotification(); - - // Swipe down with three fingers. - Scroll(0, -long_scroll, 3); - EXPECT_TRUE(InOverviewSession()); - // Show notification for the third time. - EXPECT_TRUE(IsOverviewReverseGestureNotificationShown()); - // Close the Notification. - CloseOverviewReverseGestureNotification(); - - // Swipe up with three fingers. - Scroll(0, long_scroll, 3); - EXPECT_FALSE(InOverviewSession()); - // The notification won't show anymore. - EXPECT_FALSE(IsOverviewReverseGestureNotificationShown()); - // Use the new gestures. - // Swipe up with three fingers. + // Swiping up with three fingers enters overview. Scroll(0, long_scroll, 3); EXPECT_TRUE(InOverviewSession()); + + // Swiping up again with three fingers does nothing. + Scroll(0, long_scroll, 3); + EXPECT_TRUE(InOverviewSession()); + + // Swiping down with three fingers exits overview. + Scroll(0, -long_scroll, 3); + EXPECT_FALSE(InOverviewSession()); + + // Swiping down again with three fingers does nothing. Scroll(0, -long_scroll, 3); EXPECT_FALSE(InOverviewSession()); }
diff --git a/ash/wm/wm_highlight_item_border.cc b/ash/wm/wm_highlight_item_border.cc index 626d0d2..a17f5104 100644 --- a/ash/wm/wm_highlight_item_border.cc +++ b/ash/wm/wm_highlight_item_border.cc
@@ -20,8 +20,11 @@ } // namespace -WmHighlightItemBorder::WmHighlightItemBorder(int corner_radius) - : views::Border(SK_ColorTRANSPARENT), corner_radius_(corner_radius) {} +WmHighlightItemBorder::WmHighlightItemBorder(int corner_radius, + gfx::Insets padding) + : views::Border(SK_ColorTRANSPARENT), + corner_radius_(corner_radius), + border_insets_(gfx::Insets(kBorderSize + kBorderPadding) + padding) {} void WmHighlightItemBorder::SetFocused(bool focused) { // Note that all WM features that use this custom border currently have dark @@ -51,7 +54,7 @@ } gfx::Insets WmHighlightItemBorder::GetInsets() const { - return gfx::Insets(kBorderSize + kBorderPadding); + return border_insets_; } gfx::Size WmHighlightItemBorder::GetMinimumSize() const {
diff --git a/ash/wm/wm_highlight_item_border.h b/ash/wm/wm_highlight_item_border.h index 429f523b..78671621 100644 --- a/ash/wm/wm_highlight_item_border.h +++ b/ash/wm/wm_highlight_item_border.h
@@ -19,7 +19,10 @@ // paint nothing. class WmHighlightItemBorder : public views::Border { public: - explicit WmHighlightItemBorder(int corner_radius); + + explicit WmHighlightItemBorder( + int corner_radius, + gfx::Insets padding = gfx::Insets(0)); ~WmHighlightItemBorder() override = default; // This highlight meant to indicate focus. No border will be painted if @@ -34,6 +37,8 @@ private: const int corner_radius_; + gfx::Insets border_insets_; + DISALLOW_COPY_AND_ASSIGN(WmHighlightItemBorder); };
diff --git a/base/android/java/src/org/chromium/base/PathUtils.java b/base/android/java/src/org/chromium/base/PathUtils.java index 29d5154..013572a 100644 --- a/base/android/java/src/org/chromium/base/PathUtils.java +++ b/base/android/java/src/org/chromium/base/PathUtils.java
@@ -108,8 +108,11 @@ if (sCacheSubDirectory == null) { paths[CACHE_DIRECTORY] = appContext.getCacheDir().getPath(); } else { - paths[CACHE_DIRECTORY] = - new File(appContext.getCacheDir(), sCacheSubDirectory).getPath(); + File cacheDir = new File(appContext.getCacheDir(), sCacheSubDirectory); + cacheDir.mkdir(); + paths[CACHE_DIRECTORY] = cacheDir.getPath(); + // Set to rwx--S--- as the Android cache dir has a distinct gid and is setgid. + chmod(paths[CACHE_DIRECTORY], 02700); } } return paths;
diff --git a/base/android/resource_exclusions.gni b/base/android/resource_exclusions.gni index b70bc0ff..21a25b33 100644 --- a/base/android/resource_exclusions.gni +++ b/base/android/resource_exclusions.gni
@@ -9,6 +9,7 @@ common_resource_exclusion_exceptions = [ "*shadow*", # Combination of gradient & transparency cause pixelation. "*.9.*", # Most nine-patches contain shadows. + "*ic_group_*", # Appear only in xxxhdpi. ] # Remove WearOS resources (a couple exist in appcompat).
diff --git a/base/fuchsia/test_component_context_for_process_unittest.cc b/base/fuchsia/test_component_context_for_process_unittest.cc index e83dea9..e75f31f 100644 --- a/base/fuchsia/test_component_context_for_process_unittest.cc +++ b/base/fuchsia/test_component_context_for_process_unittest.cc
@@ -4,7 +4,7 @@ #include "base/fuchsia/test_component_context_for_process.h" -#include <fuchsia/intl/cpp/fidl.h> +#include <fuchsia/sys/cpp/fidl.h> #include <lib/sys/cpp/component_context.h> #include "base/fuchsia/fuchsia_logging.h" @@ -92,29 +92,37 @@ } TEST_F(TestComponentContextForProcessTest, ProvideSystemService) { - // Expose fuchsia.device.NameProvider through the ComponentContext. - const base::StringPiece kServiceNames[] = { - ::fuchsia::intl::PropertyProvider::Name_}; + // Expose fuchsia.sys.Loader through the ComponentContext. + // This service was chosen because it is one of the ambient services in + // Fuchsia's hermetic environment for component tests (see + // https://fuchsia.dev/fuchsia-src/concepts/testing/test_component#ambient_services). + const base::StringPiece kServiceNames[] = {::fuchsia::sys::Loader::Name_}; test_context_.AddServices(kServiceNames); - // Attempt to use the PropertyProvider via the process ComponentContext. + // Connect to the Loader service via the process ComponentContext. RunLoop wait_loop; - auto property_provider = ComponentContextForProcess() - ->svc() - ->Connect<::fuchsia::intl::PropertyProvider>(); - property_provider.set_error_handler( + auto loader = + ComponentContextForProcess()->svc()->Connect<::fuchsia::sys::Loader>(); + loader.set_error_handler( [quit_loop = wait_loop.QuitClosure()](zx_status_t status) { - if (status == ZX_ERR_PEER_CLOSED) { - ADD_FAILURE() << "PropertyProvider disconnected; probably not found."; - } else { - ZX_LOG(FATAL, status); - } + ZX_LOG(ERROR, status); + ADD_FAILURE(); quit_loop.Run(); }); - property_provider->GetProfile( - [quit_loop = wait_loop.QuitClosure()](::fuchsia::intl::Profile profile) { - quit_loop.Run(); - }); + + // Use the Loader to verify that it was the system service that was connected. + // Load the component containing this test since we know it exists. + // TODO(https://fxbug.dev/51490): Use a programmatic mechanism to obtain this. + const char kComponentUrl[] = + "fuchsia-pkg://fuchsia.com/base_unittests#meta/base_unittests.cmx"; + loader->LoadUrl(kComponentUrl, [quit_loop = wait_loop.QuitClosure(), + expected_path = kComponentUrl]( + ::fuchsia::sys::PackagePtr package) { + // |package| would be null on failure. + ASSERT_TRUE(package); + EXPECT_EQ(package->resolved_url, expected_path); + quit_loop.Run(); + }); wait_loop.Run(); }
diff --git a/base/memory/checked_ptr.md b/base/memory/checked_ptr.md index fb373da..f451639 100644 --- a/base/memory/checked_ptr.md +++ b/base/memory/checked_ptr.md
@@ -3,21 +3,66 @@ `CheckedPtr<T>` is a smart pointer that triggers a crash when dereferencing a dangling pointer. It is currently considered **experimental** - please don't use it in production code just yet. +`CheckedPtr<T>` is part of the +[go/miracleptr](https://docs.google.com/document/d/1pnnOAIz_DMWDI4oIOFoMAqLnf_MZ2GsrJNb_dbQ3ZBg/edit?usp=sharing) +project. + + +## Examples of using CheckedPtr instead of raw pointers + +`CheckedPtr<T>` can be used to replace raw pointer fields (aka member +variables). For example, the following struct that uses raw pointers: + +```cpp +struct Example { + int* int_ptr; + void* void_ptr; + SomeClass* object_ptr; + const SomeClass* ptr_to_const; + SomeClass* const const_ptr; +}; +``` + +Would look as follows when using `CheckedPtr<T>`: + +```cpp +#include "base/memory/checked_ptr.h" + +struct Example { + CheckedPtr<int> int_ptr; + CheckedPtr<void> void_ptr; + CheckedPtr<SomeClass> object_ptr; + CheckedPtr<const SomeClass> ptr_to_const; + const CheckedPtr<SomeClass> const_ptr; +}; +``` + +In most cases, only the type in the field declaration needs to change. +In particular, `CheckedPtr<T>` implements +`operator->`, `operator*` and other operators +that one expects from a raw pointer. +A handful of incompatible cases are described in the +"Incompatibilities with raw pointers" section below. + ## Benefits and costs of CheckedPtr TODO: Expand the raw notes below: - Benefit = making UaF bugs non-exploitable - - Protected - - dereference (null not ok): `operator*`, `operator->` - - extraction (null ok): `.get()`, implicit casts - - Not protected: - - comparison: `operator==`, etc. - - maybe middle-of-allocation-pointers - - stack pointers - (and pointers to other non-PartitionAlloc-managed allocations) + - Need to explain how BackupRefPtr implementation + poisons/zaps/quarantines the freed memory + as long as a dangling CheckedPtr exists + - Need to explain the scope of the protection + - non-renderer process only (e.g. browser process, NetworkService process, + GPU process, etc., but *not* renderer processes, utility processes, etc.) + - most platforms (except iOS; and 32-bit might also be out of scope) + - only pointers to PartitionAlloc-managed memory (all heap + allocations via `malloc` or `new` in Chrome, but not + pointers to stack memory, etc.) - Cost = performance hit - (TODO: point to preliminary performance results) + - Point to preliminary performance results and A/B testing results + - Explain how the performance hit affects mostly construction + and destruction (e.g. dereferencing or comparison are not affected). ## Fields should use CheckedPtr rather than raw pointers @@ -28,12 +73,14 @@ TODO: Expand the raw notes below: - Chromium-only (V8, Skia, etc. excluded) +- Renderer-only code excluded for performance reasons (Blink, + any code path with "/renderer/" substring). - Fields-only (okay to use raw pointer variables, params, container elements, etc.) - TODO: Explain how this will be eventually enforced (presubmit? clang plugin?). Explain how to opt-out (e.g. see "Incompatibilities with raw pointers" section below where some scenarios are inherently incompatible - with CheckedPtr. + with CheckedPtr). ## Incompatibilities with raw pointers @@ -49,6 +96,9 @@ where `CheckedPtr<SomeClass>` is not compatible with a raw pointer. Subsections below enumerate such scenarios and offer guidance on how to work with them. +For a more in-depth treatment, please see the +["Limitations of CheckedPtr/BackupRefPtr"](https://docs.google.com/document/d/1HbtenxB_LyxNOFj52Ph9A6Wzb17PhXX2NGlsCZDCfL4/edit?usp=sharing) +document. ### Compile errors @@ -124,53 +174,20 @@ If `constexpr`, non-null initialization is required, then the only solution is avoiding `CheckedPtr`. -### Runtime crashes +#### Unions -#### Special sentinel values - -`CheckedPtr` cannot be assigned special sentinel values like -`reinterpret_cast<void*>(-2)`. -Using such values with `CheckedPtr` will lead to crashes at runtime -(`CheckedPtr` would crash when attempting to read the memory tag from -the "allocation" at the fake sentinel address). - -Example where this happens in practice: -[reinterpret_cast here](https://source.chromium.org/chromium/chromium/src/+/master:base/threading/thread_local_storage.cc;l=153;drc=c3cffa634ce1fd84baaab5ba507e240b8abbd977) -might try to convert `-2` (from -[kPerfFdDisabled](https://source.chromium.org/chromium/chromium/src/+/master:base/trace_event/thread_instruction_count.cc;l=28;drc=9a7c42e7b3ce922f16b308e2b295f109b56b9fa2)) -into `void*`. - -Suggested solution is to use `uintptr_t` instead of `void*` for storing -non-pointer values (e.g. `-2` sentinel value). +If any member of a union has a non-trivial destructor, then the union +will not have a destructor. Because of this `CheckedPtr<T>` usually cannot be +used to replace the type of union members, because `CheckedPtr<T>` has +a non-trivial destructor. -#### Dangling CheckedPtr may crash without a dereference +### Runtime errors -A dangling raw pointer can be passed as an argument -(or assigned to other variables, etc.) without necessarily -triggering an undefined behavior (as long as the dangling -pointer is not actually dereferenced). -OTOH, `CheckedPtr` safety checks will kick in whenever `CheckedPtr` -is converted to a raw pointer (e.g. when passing `CheckedPtr` -to a function that takes a raw pointer as a function argument). +TODO(bartekn): Document runtime errors encountered by BackupRefPtr +(they are more rare than for CheckedPtr2, +but runtime errors still exist for BackupRefPtr). -Example where this happens in practice: -[WaitableEventWatcher::StopWatching](https://source.chromium.org/chromium/chromium/src/+/master:base/synchronization/waitable_event_watcher_posix.cc;l=165;drc=c3cffa634ce1fd84baaab5ba507e240b8abbd977) -may be dealing with a dangling `waiter_` pointer. - -TODO: -- What to do (avoid CheckedPtr? introduce and use `UnsafeGet()` method?) -- Generic guidance (can we say that this is an inherently dangerous situation - and should be avoided in general?) - - -## Other notes - -### Unions mixing raw pointers and CheckedPtr - -C++ standard [says](https://en.cppreference.com/w/cpp/language/union) that -"it's undefined behavior to read from the member of the union that wasn't most -recently written". -As long as only the most recently written union member is used, it should be -okay to use `CheckedPtr` in a union (even in a situation where a mix of raw -pointer fields and `CheckedPtr` fields is present in the same union). +TODO(glazunov): One example is +accessing a class' CheckedPtr fields in its base class' constructor: +https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/wtf/doubly_linked_list.h;drc=cce44dc1cb55c77f63f2ebec5e7015b8dc851c82;l=52
diff --git a/base/power_monitor/power_monitor_device_source_mac.mm b/base/power_monitor/power_monitor_device_source_mac.mm index 8618be15..54a2215 100644 --- a/base/power_monitor/power_monitor_device_source_mac.mm +++ b/base/power_monitor/power_monitor_device_source_mac.mm
@@ -25,9 +25,14 @@ bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() { base::ScopedCFTypeRef<CFTypeRef> info(IOPSCopyPowerSourcesInfo()); + if (!info) + return false; base::ScopedCFTypeRef<CFArrayRef> power_sources_list( IOPSCopyPowerSourcesList(info)); + if (!power_sources_list) + return false; + bool found_battery = false; const CFIndex count = CFArrayGetCount(power_sources_list); for (CFIndex i = 0; i < count; ++i) { const CFDictionaryRef description = IOPSGetPowerSourceDescription( @@ -37,18 +42,29 @@ CFStringRef current_state = base::mac::GetValueFromDictionary<CFStringRef>( description, CFSTR(kIOPSPowerSourceStateKey)); - if (!current_state) continue; // We only report "on battery power" if no source is on AC power. - if (CFStringCompare(current_state, CFSTR(kIOPSBatteryPowerValue), 0) != + if (CFStringCompare(current_state, CFSTR(kIOPSOffLineValue), 0) == kCFCompareEqualTo) { + continue; + } else if (CFStringCompare(current_state, CFSTR(kIOPSACPowerValue), 0) == + kCFCompareEqualTo) { return false; } + + DCHECK_EQ(CFStringCompare(current_state, CFSTR(kIOPSBatteryPowerValue), 0), + kCFCompareEqualTo) + << "Power source state is not one of 3 documented values"; + + found_battery = true; } - return true; + // At this point, either there were no readable batteries found, in which case + // this Mac is not on battery power, or all the readable batteries were on + // battery power, in which case, count this as being on battery power. + return found_battery; } PowerObserver::DeviceThermalState
diff --git a/base/profiler/thread_delegate_posix_unittest.cc b/base/profiler/thread_delegate_posix_unittest.cc index 660b8de..f5b39b6e 100644 --- a/base/profiler/thread_delegate_posix_unittest.cc +++ b/base/profiler/thread_delegate_posix_unittest.cc
@@ -11,7 +11,8 @@ namespace base { // ASAN moves local variables outside of the stack extents. -#if defined(ADDRESS_SANITIZER) +// Test is flaky on ChromeOS. crbug.com/1133434. +#if defined(ADDRESS_SANITIZER) || defined(OS_CHROMEOS) #define MAYBE_CurrentThreadBase DISABLED_CurrentThreadBase #else #define MAYBE_CurrentThreadBase CurrentThreadBase
diff --git a/base/values.cc b/base/values.cc index c234688c..c06458bc 100644 --- a/base/values.cc +++ b/base/values.cc
@@ -717,29 +717,6 @@ return cur->SetKey(*cur_path, std::move(value)); } -bool Value::RemovePath(std::initializer_list<StringPiece> path) { - DCHECK_GE(path.size(), 2u) << "Use RemoveKey() for a path of length 1."; - return RemovePath(make_span(path.begin(), path.size())); -} - -bool Value::RemovePath(span<const StringPiece> path) { - if (!is_dict() || path.empty()) - return false; - - if (path.size() == 1) - return RemoveKey(path[0]); - - auto found = dict().find(path[0]); - if (found == dict().end() || !found->second->is_dict()) - return false; - - bool removed = found->second->RemovePath(path.subspan(1)); - if (removed && found->second->dict().empty()) - dict().erase(found); - - return removed; -} - Value::dict_iterator_proxy Value::DictItems() { return dict_iterator_proxy(&dict()); }
diff --git a/base/values.h b/base/values.h index f66c43e..a7fba47 100644 --- a/base/values.h +++ b/base/values.h
@@ -430,10 +430,6 @@ // bool success = value.RemovePath("foo.bar"); bool RemovePath(StringPiece path); - // Deprecated versions - bool RemovePath(std::initializer_list<StringPiece> path); - bool RemovePath(span<const StringPiece> path); - // Tries to extract a Value at the given path. // // If the current value is not a dictionary or any path component does not
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index 1c24bc8d..af22e3e 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -3555,7 +3555,7 @@ "$target_out_dir/$_output_name.processed.jar" _dex_path = "$target_out_dir/$_main_target_name.dex.jar" _enable_desugar = - !defined(invoker.enable_desugar) || !invoker.enable_desugar + !defined(invoker.enable_desugar) || invoker.enable_desugar } # For static libraries, the javac jar output is created at the intermediate
diff --git a/buildtools/DIR_METADATA b/buildtools/DIR_METADATA new file mode 100644 index 0000000..c914ddc4 --- /dev/null +++ b/buildtools/DIR_METADATA
@@ -0,0 +1,5 @@ +monorail { + component: "Build" +} + +team_email: "build@chromium.org"
diff --git a/buildtools/OWNERS b/buildtools/OWNERS index b056049c..9c56ba9 100644 --- a/buildtools/OWNERS +++ b/buildtools/OWNERS
@@ -1,6 +1,3 @@ dpranke@google.com thakis@chromium.org thomasanderson@chromium.org - -# TEAM: build@chromium.org -# COMPONENT: Build
diff --git a/chrome/VERSION b/chrome/VERSION index 801f8a1..88c54c37 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=87 MINOR=0 -BUILD=4278 +BUILD=4279 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index b6ce2c5..062dfa6 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -161,8 +161,13 @@ # if the enable_chrome_module gn arg is true. android_resources("chrome_base_module_resources") { sources = [ + "java/res_base/anim/no_anim.xml", + "java/res_base/font/google_sans.xml", + "java/res_base/font/google_sans_bold.xml", + "java/res_base/font/google_sans_medium.xml", "java/res_base/values/ic_launcher_alias.xml", "java/res_base/values/ic_launcher_round_alias.xml", + "java/res_base/values/preloaded_fonts.xml", "java/res_base/values/values.xml", "java/res_base/xml/network_security_config.xml", "java/res_chromium_base/mipmap-hdpi/app_icon.png", @@ -272,10 +277,10 @@ android_library("chrome_java") { deps = [ + ":base_module_java", ":chrome_app_java_resources", ":chrome_public_android_manifest", ":chrome_public_apk_template_resources", - ":chrome_version_constants", ":partner_location_descriptor_proto_java", ":update_proto_java", ":usage_stats_proto_java", @@ -526,7 +531,6 @@ srcjar_deps = [ ":chrome_android_java_enums_srcjar", ":chrome_android_java_google_api_keys_srcjar", - ":chrome_product_config", ":chrome_strict_mode_switch", ":resource_id_javagen", ":sync_user_settings_enums_java", @@ -557,10 +561,7 @@ ] # From java_sources.gni. - sources = chrome_java_sources + [ - app_hooks_impl, - _chrome_version_java_file, - ] + sources = chrome_java_sources + [ app_hooks_impl ] # Include sources from feed_java_sources.gni. sources += feed_java_sources @@ -579,10 +580,7 @@ # Add the actual implementation where necessary so that downstream targets # can provide their own implementations. - jar_excluded_patterns = [ - "*/AppHooksImpl.class", - "*/ProductConfig.class", - ] + jar_excluded_patterns = [ "*/AppHooksImpl.class" ] annotation_processor_deps = [ "//base/android/jni_generator:jni_processor", @@ -2039,6 +2037,8 @@ android_library("monochrome_java") { deps = [ + ":base_module_java", + ":base_monochrome_module_java", "//android_webview:android_webview_java", "//base:base_java", "//chrome/android:chrome_java", @@ -2048,6 +2048,50 @@ [ "java/src/org/chromium/chrome/browser/MonochromeApplication.java" ] } +# Monochrome equivalent of :base_module_java. +android_library("base_monochrome_module_java") { + sources = [ + "java/src/org/chromium/chrome/browser/base/SplitMonochromeApplication.java", + ] + deps = [ + ":base_module_java", + "//android_webview:android_webview_java", + "//base:base_java", + "//components/version_info/android:version_constants_java", + ] +} + +# Target for classes which should be in the base module, even when +# enable_chrome_module is true and //chrome code is in a DFM. +android_library("base_module_java") { + sources = [ + "java/src/org/chromium/chrome/browser/base/SplitChromeApplication.java", + "java/src/org/chromium/chrome/browser/base/SplitCompatApplication.java", + _chrome_version_java_file, + ] + deps = [ + ":chrome_base_module_resources", + ":chrome_version_constants", + "//base:base_java", + "//components/embedder_support/android:application_java", + "//components/module_installer/android:module_installer_java", + "//components/version_info/android:version_constants_java", + "//third_party/android_deps:androidx_annotation_annotation_java", + "//ui/android:ui_no_recycler_view_java", + + # Deps needed for child processes. + "//components/viz/service:service_java", + "//content/public/android:content_java", + ] + srcjar_deps = [ ":chrome_product_config" ] + + # Add the actual implementation where necessary so that downstream targets + # can provide their own implementations. + jar_excluded_patterns = [ "*/ProductConfig.class" ] + + resources_package = "org.chromium.chrome.base" +} + # Defines a target that derives from the monochrome public application. This # can be either an APK or an app bundle module. Note that these only work # on Android N+ devices, see chrome_public_apk_or_module_tmpl() for a template
diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni index ee42e6f..dcce6b2 100644 --- a/chrome/android/chrome_java_resources.gni +++ b/chrome/android/chrome_java_resources.gni
@@ -13,7 +13,6 @@ "java/res/anim/activity_open_enter.xml", "java/res/anim/decelerate_quart.xml", "java/res/anim/fast_out_slow_in_interpolator.xml", - "java/res/anim/no_anim.xml", "java/res/anim/slide_in_up.xml", "java/res/anim/slide_out_down.xml", "java/res/anim/stay_hidden.xml", @@ -768,9 +767,6 @@ "java/res/drawable/toolbar_shadow.xml", "java/res/drawable/trending_up_black_24dp.xml", "java/res/drawable/visa_card.xml", - "java/res/font/google_sans.xml", - "java/res/font/google_sans_bold.xml", - "java/res/font/google_sans_medium.xml", "java/res/layout-sw360dp/preference_spinner_single_line.xml", "java/res/layout-sw600dp/find_toolbar.xml", "java/res/layout-sw600dp/location_bar.xml", @@ -1042,7 +1038,6 @@ "java/res/values/dimens.xml", "java/res/values/drawables.xml", "java/res/values/ids.xml", - "java/res/values/preloaded_fonts.xml", "java/res/values/strings.xml", "java/res/values/styles.xml", "java/res/values/values.xml",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 65fa961..77028d9c 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -1548,6 +1548,7 @@ "java/src/org/chromium/chrome/browser/toolbar/LocationBarModel.java", "java/src/org/chromium/chrome/browser/toolbar/NewTabButton.java", "java/src/org/chromium/chrome/browser/toolbar/ProgressAnimationSmooth.java", + "java/src/org/chromium/chrome/browser/toolbar/SettableThemeColorProvider.java", "java/src/org/chromium/chrome/browser/toolbar/TabCountProvider.java", "java/src/org/chromium/chrome/browser/toolbar/TabSwitcherButtonCoordinator.java", "java/src/org/chromium/chrome/browser/toolbar/TabSwitcherButtonProperties.java",
diff --git a/chrome/android/chrome_junit_test_java_sources.gni b/chrome/android/chrome_junit_test_java_sources.gni index 14b0f96c..8147f08 100644 --- a/chrome/android/chrome_junit_test_java_sources.gni +++ b/chrome/android/chrome_junit_test_java_sources.gni
@@ -44,6 +44,7 @@ "junit/src/org/chromium/chrome/browser/compositor/animation/CompositorAnimatorTest.java", "junit/src/org/chromium/chrome/browser/compositor/layouts/CompositorModelChangeProcessorUnitTest.java", "junit/src/org/chromium/chrome/browser/compositor/layouts/MockLayoutUpdateHost.java", + "junit/src/org/chromium/chrome/browser/compositor/layouts/SceneOverlayTest.java", "junit/src/org/chromium/chrome/browser/compositor/layouts/StaticLayoutUnitTest.java", "junit/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperTest.java", "junit/src/org/chromium/chrome/browser/compositor/overlays/toolbar/TopToolbarOverlayMediatorTest.java",
diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni index 40c3e5e..44cbc2fd 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni
@@ -153,7 +153,6 @@ resource_exclusion_exceptions += [ "*ic_file_download_white*", # Bottom edge seems misaligned. "*ic_lock.*", # Bottom edge seems misaligned. - "*ic_group_*", # Appear only in xxxhdpi. ] if (min_sdk_version >= 21) { @@ -535,10 +534,12 @@ # Add all loadable modules and shared libraries from DFMs. if (_enable_chrome_module) { - if (!defined(data_deps)) { - data_deps = [] + if (is_monochrome) { + deps += [ "//chrome/android:base_monochrome_module_java" ] + } else { + deps += [ "//chrome/android:base_module_java" ] } - data_deps += _chrome_module_shared_lib_deps + deps += _chrome_module_shared_lib_deps _loadable_modules_32_bit = [] _loadable_modules_64_bit = [] foreach(_module_desc, _module_descs) { @@ -810,7 +811,7 @@ # definitions_in_split is true. # split_output: Output path for |split_input|. # variables: Variables to pass to the jinja templates. -# definitions_in_split: If true will pass skip_definitions=true in the +# definitions_in_split: If true will pass definitions_in_split=true in the # variables passed to |input| and generate |split_output|. template("split_manifest_template") { _definitions_in_split = @@ -824,7 +825,7 @@ "variables", ]) if (_definitions_in_split) { - variables += [ "skip_definitions=true" ] + variables += [ "definitions_in_split=true" ] } }
diff --git a/chrome/android/chrome_test_java_sources.gni b/chrome/android/chrome_test_java_sources.gni index e94f816..01b8822 100644 --- a/chrome/android/chrome_test_java_sources.gni +++ b/chrome/android/chrome_test_java_sources.gni
@@ -539,7 +539,6 @@ "javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java", "javatests/src/org/chromium/chrome/browser/sync/SyncAndServicesSettingsTest.java", "javatests/src/org/chromium/chrome/browser/sync/SyncAndServicesSettingsWithFakeProfileSyncServiceTest.java", - "javatests/src/org/chromium/chrome/browser/sync/SyncErrorCardPreferenceTest.java", "javatests/src/org/chromium/chrome/browser/sync/SyncTest.java", "javatests/src/org/chromium/chrome/browser/sync/SyncTestRule.java", "javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java",
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 3165ab4..ab8a2f8 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,8 @@ 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.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -49,8 +49,7 @@ @CommandLineFlags.Add(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE) public class AutofillAssistantDirectActionHandlerTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private ChromeActivity mActivity; private BottomSheetController mBottomSheetController;
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 50db7c2..33f8be57 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
@@ -449,7 +449,7 @@ List<InteractionProto> interactionsPrepended = new ArrayList<>(); interactionsPrepended.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "clickableView1"))) .addCallbacks(CallbackProto.newBuilder().setSetValue( @@ -463,7 +463,7 @@ List<InteractionProto> interactionsAppended = new ArrayList<>(); interactionsAppended.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "clickableView2"))) .addCallbacks(CallbackProto.newBuilder().setSetValue( @@ -588,7 +588,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "clickableView"))) .addCallbacks(CallbackProto.newBuilder().setSetValue( @@ -609,7 +609,7 @@ // Whenever output_1 changes, copy the value to output_2. interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "output_1"))) .addCallbacks(CallbackProto.newBuilder().setSetValue( @@ -624,7 +624,7 @@ // is created, because events should only be fired for actual value changes. interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "output_2"))) .addCallbacks(CallbackProto.newBuilder().setSetValue( @@ -745,7 +745,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "clickableView"))) .addCallbacks(CallbackProto.newBuilder().setShowInfoPopup( @@ -795,7 +795,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -804,7 +804,7 @@ "chips")))) .build()); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( + .addTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( OnUserActionCalled.newBuilder().setUserActionIdentifier( "done_chip"))) .addCallbacks(CallbackProto.newBuilder().setEndAction( @@ -813,7 +813,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "clickableView"))) .addCallbacks(CallbackProto.newBuilder().setShowListPopup( @@ -939,7 +939,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "clickableView1"))) .addCallbacks(CallbackProto.newBuilder().setSetValue( @@ -952,7 +952,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "clickableView2"))) .addCallbacks(CallbackProto.newBuilder().setSetValue( @@ -965,23 +965,10 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "output1"))) - .addCallbacks(CallbackProto.newBuilder().setComputeValue( - ComputeValueProto.newBuilder() - .setBooleanAnd(BooleanAndProto.newBuilder().addAllValues( - Arrays.asList(ValueReferenceProto.newBuilder() - .setModelIdentifier("output1") - .build(), - ValueReferenceProto.newBuilder() - .setModelIdentifier("output2") - .build()))) - .setResultModelIdentifier("combined"))) - .build()); - interactions.add( - (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "output2"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -1062,7 +1049,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -1071,7 +1058,7 @@ "chips")))) .build()); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( + .addTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( OnUserActionCalled.newBuilder().setUserActionIdentifier( "done_chip"))) .addCallbacks(CallbackProto.newBuilder().setEndAction( @@ -1173,7 +1160,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -1182,7 +1169,7 @@ "chips")))) .build()); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( + .addTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( OnUserActionCalled.newBuilder().setUserActionIdentifier( "done_chip"))) .addCallbacks(CallbackProto.newBuilder().setEndAction( @@ -1191,7 +1178,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "text_view"))) .addCallbacks(CallbackProto.newBuilder().setShowCalendarPopup( @@ -1214,7 +1201,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "date"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -1376,7 +1363,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -1386,7 +1373,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "enabled"))) .addCallbacks(CallbackProto.newBuilder().setToggleUserAction( @@ -1399,7 +1386,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "text_view"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -1476,7 +1463,7 @@ .build(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "text_view"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -1501,7 +1488,7 @@ .build(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "counter"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -1567,7 +1554,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "toggle_view"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -1579,7 +1566,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "visible"))) .addCallbacks(CallbackProto.newBuilder().setSetViewVisibility( @@ -1676,7 +1663,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -1685,7 +1672,7 @@ "chips")))) .build()); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( + .addTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( OnUserActionCalled.newBuilder().setUserActionIdentifier( "done_chip"))) .addCallbacks(CallbackProto.newBuilder().setEndAction( @@ -1765,7 +1752,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnTextLinkClicked( + .addTriggerEvent(EventProto.newBuilder().setOnTextLinkClicked( OnTextLinkClickedProto.newBuilder().setTextLink(1))) .addCallbacks(CallbackProto.newBuilder().setSetValue( SetModelValueProto.newBuilder() @@ -2008,7 +1995,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -2017,7 +2004,7 @@ "chips")))) .build()); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( + .addTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( OnUserActionCalled.newBuilder().setUserActionIdentifier( "done_chip"))) .addCallbacks(CallbackProto.newBuilder().setEndAction( @@ -2156,7 +2143,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "toggle_view"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -2168,7 +2155,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "enabled"))) .addCallbacks(CallbackProto.newBuilder().setSetViewEnabled( @@ -2248,7 +2235,7 @@ List<InteractionProto> interactionsA = new ArrayList<>(); interactionsA.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -2257,7 +2244,7 @@ "chips")))) .build()); interactionsA.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( + .addTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( OnUserActionCalled.newBuilder().setUserActionIdentifier( "shared_identifier"))) .addCallbacks(CallbackProto.newBuilder().setEndAction( @@ -2291,7 +2278,7 @@ List<InteractionProto> interactionsB = new ArrayList<>(); interactionsB.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -2300,7 +2287,7 @@ "chips")))) .build()); interactionsB.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( + .addTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( OnUserActionCalled.newBuilder().setUserActionIdentifier( "shared_identifier"))) .addCallbacks(CallbackProto.newBuilder().setShowInfoPopup( @@ -2385,7 +2372,7 @@ List<InteractionProto> interactions_nested = new ArrayList<>(); interactions_nested.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "nested_text_view"))) .addCallbacks(incrementCounterCallback) @@ -2400,7 +2387,7 @@ // Clicking |root_text_view| will increment |counter| by 1 and open a nested popup. List<InteractionProto> interactions = new ArrayList<>(); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "root_text_view"))) .addCallbacks(incrementCounterCallback) @@ -2411,7 +2398,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -2420,7 +2407,7 @@ "chips")))) .build()); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( + .addTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( OnUserActionCalled.newBuilder().setUserActionIdentifier( "done_chip"))) .addCallbacks(CallbackProto.newBuilder().setEndAction( @@ -2588,7 +2575,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "text_view_create_nested_on_click"))) .addCallbacks(CallbackProto.newBuilder().setCreateNestedUi( @@ -2605,7 +2592,7 @@ "Hello World")))))) .build()); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "text_view_delete_nested_on_click"))) .addCallbacks(CallbackProto.newBuilder().setClearViewContainer( @@ -2684,7 +2671,7 @@ // When touch_area_one_present becomes false, end the action interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "touch_area_one_present"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -2696,7 +2683,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "end_action"))) .addCallbacks(CallbackProto.newBuilder() @@ -2784,7 +2771,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "clickable_view"))) .addCallbacks(CallbackProto.newBuilder().setForEach( @@ -2915,7 +2902,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnViewClicked( + .addTriggerEvent(EventProto.newBuilder().setOnViewClicked( OnViewClickedEventProto.newBuilder().setViewIdentifier( "clickable_view"))) .addCallbacks(CallbackProto.newBuilder().setForEach( @@ -3017,7 +3004,7 @@ List<InteractionProto> singleCardInteractions = new ArrayList<>(); singleCardInteractions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "credit_card_selected_${i}"))) .addCallbacks( @@ -3068,7 +3055,7 @@ List<InteractionProto> interactions = new ArrayList<>(); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "credit_cards"))) .addCallbacks(CallbackProto.newBuilder().setClearViewContainer( @@ -3119,7 +3106,7 @@ // - enable/disable confirm button interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "selected_credit_card"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -3139,7 +3126,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "confirm_button_disabled"))) .addCallbacks(CallbackProto.newBuilder().setComputeValue( @@ -3151,7 +3138,7 @@ .build()); interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "confirm_button_enabled"))) .addCallbacks(CallbackProto.newBuilder().setToggleUserAction( @@ -3165,7 +3152,7 @@ // A confirm chip interaction that ends the action. interactions.add( (InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnValueChanged( + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "chips"))) .addCallbacks(CallbackProto.newBuilder().setSetUserActions( @@ -3174,7 +3161,7 @@ "chips")))) .build()); interactions.add((InteractionProto) InteractionProto.newBuilder() - .setTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( + .addTriggerEvent(EventProto.newBuilder().setOnUserActionCalled( OnUserActionCalled.newBuilder().setUserActionIdentifier( "done_chip"))) .addCallbacks(CallbackProto.newBuilder().setEndAction(
diff --git a/chrome/android/feed/core/javatests/src/org/chromium/chrome/browser/feed/FeedNewTabPageCardRenderTest.java b/chrome/android/feed/core/javatests/src/org/chromium/chrome/browser/feed/FeedNewTabPageCardRenderTest.java index c1056f72..9443dcd 100644 --- a/chrome/android/feed/core/javatests/src/org/chromium/chrome/browser/feed/FeedNewTabPageCardRenderTest.java +++ b/chrome/android/feed/core/javatests/src/org/chromium/chrome/browser/feed/FeedNewTabPageCardRenderTest.java
@@ -25,7 +25,6 @@ import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.IntegrationTest; import org.chromium.chrome.R; -import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.ntp.NewTabPage; @@ -34,8 +33,8 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.suggestions.SiteSuggestion; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.NewTabPageTestUtils; import org.chromium.chrome.test.util.browser.Features; @@ -65,8 +64,7 @@ private static final String TEST_FEED_DATA_BASE_PATH = "/chrome/test/data/android/feed/"; @Rule - public ChromeActivityTestRule<ChromeTabbedActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public SuggestionsDependenciesRule mSuggestionsDeps = new SuggestionsDependenciesRule();
diff --git a/chrome/android/feed/core/javatests/src/org/chromium/chrome/browser/feed/network_fetch/FeedNewTabPageCardInstrumentationTest.java b/chrome/android/feed/core/javatests/src/org/chromium/chrome/browser/feed/network_fetch/FeedNewTabPageCardInstrumentationTest.java index 40122c0..e874430 100644 --- a/chrome/android/feed/core/javatests/src/org/chromium/chrome/browser/feed/network_fetch/FeedNewTabPageCardInstrumentationTest.java +++ b/chrome/android/feed/core/javatests/src/org/chromium/chrome/browser/feed/network_fetch/FeedNewTabPageCardInstrumentationTest.java
@@ -17,11 +17,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.NewTabPageTestUtils; import org.chromium.chrome.test.util.browser.Features; @@ -40,8 +39,7 @@ @Features.DisableFeatures(ChromeFeatureList.INTEREST_FEED_V2) public final class FeedNewTabPageCardInstrumentationTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public ChromeRenderTestRule mRenderTestRule = ChromeRenderTestRule.Builder.withPublicCorpus()
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml index a18f36f..670d9cf 100644 --- a/chrome/android/java/AndroidManifest.xml +++ b/chrome/android/java/AndroidManifest.xml
@@ -13,6 +13,10 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="{{ manifest_package }}" + {% set definitions_in_split = definitions_in_split|default(0) == 'true' %} + {% if definitions_in_split %} + android:isolatedSplits="true" + {% endif %} tools:ignore="MissingVersion"> <!-- android:versionCode and android:versionName is set through gyp. See build/common.gypi --> @@ -147,7 +151,13 @@ <!-- Set android:largeHeap to "true" to allow more than the default Java heap limit (32Mb on Nexus S, 48Mb on Xoom). --> - <application android:name="{% block application_name %}org.chromium.chrome.browser.ChromeApplication{% endblock %}" + <application android:name="{% block application_name %} + {%- if definitions_in_split -%} + org.chromium.chrome.browser.base.SplitChromeApplication + {%- else -%} + org.chromium.chrome.browser.ChromeApplication + {%- endif -%} + {% endblock %}" android:icon="@drawable/ic_launcher" android:roundIcon="@drawable/ic_launcher_round" android:label="{% block application_label %}@string/app_name{% endblock %}" @@ -207,10 +217,6 @@ "com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" android:value="org.chromium.components.media_router.caf.CastOptionsProvider"/> - <!-- Downloads Google Sans from GMS Core --> - <meta-data android:name="preloaded_fonts" - android:resource="@array/preloaded_google_sans_fonts" /> - <!-- Note: All activities directly or indirectly derived from ChromeActivity must specify android:hardwareAccelerated="false". @@ -1107,44 +1113,6 @@ android:name="org.chromium.components.payments.PaymentDetailsUpdateService" android:exported="true"/> - <!-- The following service entries exist in order to allow us to - start more than one sandboxed process. --> - - <!-- NOTE: If you change the value of "android:process" for the below services, - you also need to update kHelperProcessExecutableName in chrome_constants.cc. --> - {% set num_sandboxed_services = 40 %} - <meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES" - android:value="{{ num_sandboxed_services }}"/> - - {% for i in range(num_sandboxed_services) %} - <service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}" - android:process=":sandboxed_process{{ i }}" - android:permission="{{ manifest_package }}.permission.CHILD_SERVICE" - android:isolatedProcess="true" - android:exported="{{sandboxed_service_exported|default(false)}}" - {% if (i == 0) %} - android:useAppZygote="true" - {% endif %} - {% if (sandboxed_service_exported|default(false)) == 'true' %} - android:externalService="true" - tools:ignore="ExportedService" - android:visibleToInstantApps="true" - {% endif %} /> - {% endfor %} - - {% set num_privileged_services = 5 %} - <meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES" - android:value="{{ num_privileged_services }}"/> - - {% for i in range(num_privileged_services) %} - {% set privileged_process_name = ':privileged_process%d' % i %} - <service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}" - android:process="{{ privileged_process_name }}" - android:permission="{{ manifest_package }}.permission.CHILD_SERVICE" - android:isolatedProcess="false" - android:exported="false" /> - {% endfor %} - <receiver android:name="org.chromium.chrome.browser.announcement.AnnouncementNotificationManager$Receiver" android:exported="false"/> @@ -1228,10 +1196,53 @@ android:value="org.chromium.chrome.browser.media.remote.DefaultMediaRouteController"/> {% endblock %} {% endmacro %} - {% if skip_definitions is not defined or skip_definitions != 'true' %} + {% if not definitions_in_split %} {{ application_definitions() }} {% endif %} + <!-- The following service entries exist in order to allow us to + start more than one sandboxed process. --> + + <!-- NOTE: If you change the value of "android:process" for the below services, + you also need to update kHelperProcessExecutableName in chrome_constants.cc. --> + {% set num_sandboxed_services = 40 %} + <meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES" + android:value="{{ num_sandboxed_services }}"/> + + {% for i in range(num_sandboxed_services) %} + <service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}" + android:process=":sandboxed_process{{ i }}" + android:permission="{{ manifest_package }}.permission.CHILD_SERVICE" + android:isolatedProcess="true" + android:exported="{{sandboxed_service_exported|default(false)}}" + {% if (i == 0) %} + android:useAppZygote="true" + {% endif %} + {% if (sandboxed_service_exported|default(false)) == 'true' %} + android:externalService="true" + tools:ignore="ExportedService" + android:visibleToInstantApps="true" + {% endif %} /> + {% endfor %} + + {% set num_privileged_services = 5 %} + <meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES" + android:value="{{ num_privileged_services }}"/> + + {% for i in range(num_privileged_services) %} + {% set privileged_process_name = ':privileged_process%d' % i %} + <service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}" + android:process="{{ privileged_process_name }}" + android:permission="{{ manifest_package }}.permission.CHILD_SERVICE" + android:isolatedProcess="false" + android:exported="false" /> + + {% endfor %} + + <!-- Downloads Google Sans from GMS Core --> + <meta-data android:name="preloaded_fonts" + android:resource="@array/preloaded_google_sans_fonts" /> + {% block base_application_definitions %} {% endblock %} {% block extra_application_definitions_for_test %}
diff --git a/chrome/android/java/AndroidManifest_monochrome.xml b/chrome/android/java/AndroidManifest_monochrome.xml index 3de29c4..8a847e8 100644 --- a/chrome/android/java/AndroidManifest_monochrome.xml +++ b/chrome/android/java/AndroidManifest_monochrome.xml
@@ -8,7 +8,13 @@ ## Note: This is a jinja2 template, processed at build time into the final manifest. ## -{% block application_name %}org.chromium.chrome.browser.MonochromeApplication{% endblock %} +{% block application_name %} +{%- if definitions_in_split -%} +org.chromium.chrome.browser.base.SplitMonochromeApplication +{%- else -%} +org.chromium.chrome.browser.MonochromeApplication +{%- endif -%} +{% endblock %} ## ## The below is same as internal version, it seems that jinja doesn't have
diff --git a/chrome/android/java/ChromeVersionConstants.java.version b/chrome/android/java/ChromeVersionConstants.java.version index 17b00d12..21b4184a 100644 --- a/chrome/android/java/ChromeVersionConstants.java.version +++ b/chrome/android/java/ChromeVersionConstants.java.version
@@ -7,6 +7,6 @@ import org.chromium.components.version_info.VersionConstants; // Constants specific to Chrome. Common constants are in VersionConstants. -class ChromeVersionConstants extends VersionConstants { +public class ChromeVersionConstants extends VersionConstants { static final String PRODUCT_NAME = "@PRODUCT_FULLNAME@"; }
diff --git a/chrome/android/java/DEPS b/chrome/android/java/DEPS index f1b1586..6200d927 100644 --- a/chrome/android/java/DEPS +++ b/chrome/android/java/DEPS
@@ -63,5 +63,9 @@ "MonochromeApplication\.java": [ "+android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/WebViewApkApplication.java", "+android_webview/glue/java/src/com/android/webview/chromium/MonochromeLibraryPreloader.java", + ], + "SplitMonochromeApplication\.java": [ + "+android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/WebViewApkApplication.java", + "+android_webview/glue/java/src/com/android/webview/chromium/MonochromeLibraryPreloader.java", ] }
diff --git a/chrome/android/java/res/layout/fre_tosanduma.xml b/chrome/android/java/res/layout/fre_tosanduma.xml index 73bf657..d6e0224 100644 --- a/chrome/android/java/res/layout/fre_tosanduma.xml +++ b/chrome/android/java/res/layout/fre_tosanduma.xml
@@ -151,5 +151,10 @@ android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.Headline.Primary" android:visibility="gone"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="@style/TextAppearance.Button.Text.Filled" + android:visibility="gone"/> </org.chromium.chrome.browser.firstrun.TosAndUmaFragmentView>
diff --git a/chrome/android/java/res/anim/no_anim.xml b/chrome/android/java/res_base/anim/no_anim.xml similarity index 100% rename from chrome/android/java/res/anim/no_anim.xml rename to chrome/android/java/res_base/anim/no_anim.xml
diff --git a/chrome/android/java/res/font/google_sans.xml b/chrome/android/java/res_base/font/google_sans.xml similarity index 100% rename from chrome/android/java/res/font/google_sans.xml rename to chrome/android/java/res_base/font/google_sans.xml
diff --git a/chrome/android/java/res/font/google_sans_bold.xml b/chrome/android/java/res_base/font/google_sans_bold.xml similarity index 100% rename from chrome/android/java/res/font/google_sans_bold.xml rename to chrome/android/java/res_base/font/google_sans_bold.xml
diff --git a/chrome/android/java/res/font/google_sans_medium.xml b/chrome/android/java/res_base/font/google_sans_medium.xml similarity index 100% rename from chrome/android/java/res/font/google_sans_medium.xml rename to chrome/android/java/res_base/font/google_sans_medium.xml
diff --git a/chrome/android/java/res/values/preloaded_fonts.xml b/chrome/android/java/res_base/values/preloaded_fonts.xml similarity index 73% rename from chrome/android/java/res/values/preloaded_fonts.xml rename to chrome/android/java/res_base/values/preloaded_fonts.xml index 835af7e..9da9c779 100644 --- a/chrome/android/java/res/values/preloaded_fonts.xml +++ b/chrome/android/java/res_base/values/preloaded_fonts.xml
@@ -6,8 +6,11 @@ <resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="UnusedResources"> <!-- Fonts that are specified to be preloaded by AndroidManifest.xml. --> <array name="preloaded_google_sans_fonts"> + <!-- The following 2 fonts are used in downstream Clank UI. --> <item>@font/google_sans</item> <item>@font/google_sans_medium</item> + <!-- The following font is not used in Clank UI, but may be used by + AndroidFontLookupImpl#matchLocalFontByUniqueName. --> <item>@font/google_sans_bold</item> </array> </resources>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java index cbe487b..6b7e8d6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
@@ -4,7 +4,6 @@ package org.chromium.chrome.browser; -import android.app.Application; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; @@ -16,18 +15,15 @@ import org.chromium.base.ApplicationState; import org.chromium.base.ApplicationStatus; import org.chromium.base.BuildInfo; -import org.chromium.base.BundleUtils; import org.chromium.base.CommandLineInitUtil; import org.chromium.base.ContextUtils; -import org.chromium.base.JNIUtils; import org.chromium.base.PathUtils; import org.chromium.base.TraceEvent; import org.chromium.base.annotations.MainDex; -import org.chromium.base.library_loader.LibraryLoader; -import org.chromium.base.library_loader.LibraryProcessType; +import org.chromium.base.annotations.UsedByReflection; import org.chromium.base.memory.MemoryPressureMonitor; -import org.chromium.base.task.AsyncTask; import org.chromium.chrome.browser.background_task_scheduler.ChromeBackgroundTaskFactory; +import org.chromium.chrome.browser.base.SplitCompatApplication; import org.chromium.chrome.browser.crash.ApplicationStatusTracker; import org.chromium.chrome.browser.crash.FirebaseConfig; import org.chromium.chrome.browser.crash.PureJavaExceptionHandler; @@ -45,18 +41,19 @@ import org.chromium.chrome.browser.vr.OnExitVrRequestListener; import org.chromium.chrome.browser.vr.VrModuleProvider; import org.chromium.components.browser_ui.util.GlobalDiscardableReferencePool; -import org.chromium.components.embedder_support.application.FontPreloadingWorkaround; import org.chromium.components.module_installer.util.ModuleUtil; import org.chromium.components.version_info.Channel; import org.chromium.components.version_info.VersionConstants; -import org.chromium.ui.base.ResourceBundle; import org.chromium.url.GURL; /** * Basic application functionality that should be shared among all browser applications that use * chrome layer. + * + * Note: All application logic should be added to {@link ChromeApplicationImpl}, which will be + * called from the superclass. See {@link SplitCompatApplication} for more info. */ -public class ChromeApplication extends Application { +public class ChromeApplication extends SplitCompatApplication { private static final String COMMAND_LINE_FILE = "chrome-command-line"; // Public to allow use in ChromeBackupAgent public static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome"; @@ -66,166 +63,162 @@ @Nullable private static volatile ChromeAppComponent sComponent; - @Override - public void onCreate() { - super.onCreate(); - // These can't go in attachBaseContext because Context.getApplicationContext() (which they - // use under-the-hood) does not work until after it returns. - FontPreloadingWorkaround.maybeInstallWorkaround(this); - MemoryPressureMonitor.INSTANCE.registerComponentCallbacks(); - } + /** Chrome application logic. */ + @UsedByReflection("SplitChromeApplication.java") + public static class ChromeApplicationImpl extends Impl { + @UsedByReflection("SplitChromeApplication.java") + public ChromeApplicationImpl() {} - // Called by the framework for ALL processes. Runs before ContentProviders are created. - // Quirk: context.getApplicationContext() returns null during this method. - @Override - protected void attachBaseContext(Context context) { - boolean isBrowserProcess = isBrowserProcess(); + // Called by the framework for ALL processes. Runs before ContentProviders are created. + // Quirk: context.getApplicationContext() returns null during this method. + @Override + public void attachBaseContext(Context context) { + boolean isBrowserProcess = isBrowserProcess(); - if (isBrowserProcess) { - UmaUtils.recordMainEntryPointTime(); + if (isBrowserProcess) { + UmaUtils.recordMainEntryPointTime(); - // If the app locale override preference is set, create a new override - // context to use as the base context for the application. - // Must be initialized early to override Application level localizations. - if (GlobalAppLocaleController.getInstance().init(context)) { - context = context.createConfigurationContext( - GlobalAppLocaleController.getInstance().getOverrideConfig(context)); + // If the app locale override preference is set, create a new override + // context to use as the base context for the application. + // Must be initialized early to override Application level localizations. + if (GlobalAppLocaleController.getInstance().init(context)) { + context = context.createConfigurationContext( + GlobalAppLocaleController.getInstance().getOverrideConfig(context)); + } + } + + super.attachBaseContext(context); + if (isBrowserProcess) { + checkAppBeingReplaced(); + + PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); + // Renderer and GPU processes have command line passed to them via IPC + // (see ChildProcessService.java). + CommandLineInitUtil.initCommandLine( + COMMAND_LINE_FILE, ChromeApplicationImpl::shouldUseDebugFlags); + + // Enable ATrace on debug OS or app builds. + int applicationFlags = context.getApplicationInfo().flags; + boolean isAppDebuggable = (applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; + boolean isOsDebuggable = BuildInfo.isDebugAndroid(); + // Requires command-line flags. + TraceEvent.maybeEnableEarlyTracing( + (isAppDebuggable || isOsDebuggable) ? TraceEvent.ATRACE_TAG_APP : 0, + /*readCommandLine=*/true); + TraceEvent.begin("ChromeApplication.attachBaseContext"); + + // Register for activity lifecycle callbacks. Must be done before any activities are + // created and is needed only by processes that use the ApplicationStatus api (which + // for Chrome is just the browser process). + ApplicationStatus.initialize(getApplication()); + + // Register and initialize application status listener for crashes, this needs to be + // done as early as possible so that this value is set before any crashes are + // reported. + ApplicationStatusTracker tracker = new ApplicationStatusTracker(); + tracker.onApplicationStateChange(ApplicationStatus.getStateForApplication()); + ApplicationStatus.registerApplicationStateListener(tracker); + + // Disable MemoryPressureMonitor polling when Chrome goes to the background. + ApplicationStatus.registerApplicationStateListener( + ChromeApplicationImpl::updateMemoryPressurePolling); + + // Initializes the support for dynamic feature modules (browser only). + ModuleUtil.initApplication(); + + // Set Chrome factory for mapping BackgroundTask classes to TaskIds. + ChromeBackgroundTaskFactory.setAsDefault(); + + if (VersionConstants.CHANNEL == Channel.CANARY) { + GURL.setReportDebugThrowableCallback( + PureJavaExceptionReporter::reportJavaException); + } + } + + BuildInfo.setFirebaseAppId(FirebaseConfig.getFirebaseAppId()); + + if (!ContextUtils.isIsolatedProcess()) { + // Incremental install disables process isolation, so things in this block will + // actually be run for incremental apks, but not normal apks. + PureJavaExceptionHandler.installHandler(); + } + + if (isBrowserProcess) { + TraceEvent.end("ChromeApplication.attachBaseContext"); } } - super.attachBaseContext(context); - ContextUtils.initApplicationContext(this); - maybeInitProcessType(isBrowserProcess); - BundleUtils.setIsBundle(ProductConfig.IS_BUNDLE); - if (isBrowserProcess) { - checkAppBeingReplaced(); + private static Boolean shouldUseDebugFlags() { + return CachedFeatureFlags.isEnabled(ChromeFeatureList.COMMAND_LINE_ON_NON_ROOTED); + } - PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); - // Renderer and GPU processes have command line passed to them via IPC - // (see ChildProcessService.java). - CommandLineInitUtil.initCommandLine( - COMMAND_LINE_FILE, ChromeApplication::shouldUseDebugFlags); - - // Enable ATrace on debug OS or app builds. - int applicationFlags = context.getApplicationInfo().flags; - boolean isAppDebuggable = (applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; - boolean isOsDebuggable = BuildInfo.isDebugAndroid(); - // Requires command-line flags. - TraceEvent.maybeEnableEarlyTracing( - (isAppDebuggable || isOsDebuggable) ? TraceEvent.ATRACE_TAG_APP : 0, - /*readCommandLine=*/true); - TraceEvent.begin("ChromeApplication.attachBaseContext"); - - // Register for activity lifecycle callbacks. Must be done before any activities are - // created and is needed only by processes that use the ApplicationStatus api (which for - // Chrome is just the browser process). - ApplicationStatus.initialize(this); - - // Register and initialize application status listener for crashes, this needs to be - // done as early as possible so that this value is set before any crashes are reported. - ApplicationStatusTracker tracker = new ApplicationStatusTracker(); - tracker.onApplicationStateChange(ApplicationStatus.getStateForApplication()); - ApplicationStatus.registerApplicationStateListener(tracker); - - // Disable MemoryPressureMonitor polling when Chrome goes to the background. - ApplicationStatus.registerApplicationStateListener( - ChromeApplication::updateMemoryPressurePolling); - - // Initializes the support for dynamic feature modules (browser only). - ModuleUtil.initApplication(); - - // Set Chrome factory for mapping BackgroundTask classes to TaskIds. - ChromeBackgroundTaskFactory.setAsDefault(); - - if (VersionConstants.CHANNEL == Channel.CANARY) { - GURL.setReportDebugThrowableCallback( - PureJavaExceptionReporter::reportJavaException); + private static void updateMemoryPressurePolling(@ApplicationState int newState) { + if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { + MemoryPressureMonitor.INSTANCE.enablePolling(); + } else if (newState == ApplicationState.HAS_STOPPED_ACTIVITIES) { + MemoryPressureMonitor.INSTANCE.disablePolling(); } } - // Write installed modules to crash keys. This needs to be done as early as possible so that - // these values are set before any crashes are reported. - ModuleUtil.updateCrashKeys(); - - BuildInfo.setFirebaseAppId(FirebaseConfig.getFirebaseAppId()); - - if (!ContextUtils.isIsolatedProcess()) { - // Incremental install disables process isolation, so things in this block will actually - // be run for incremental apks, but not normal apks. - PureJavaExceptionHandler.installHandler(); + /** Ensure this application object is not out-of-date. */ + private static void checkAppBeingReplaced() { + // During app update the old apk can still be triggered by broadcasts and spin up an + // out-of-date application. Kill old applications in this bad state. See + // http://crbug.com/658130 for more context and http://b.android.com/56296 for the bug. + if (ContextUtils.getApplicationAssets() == null) { + throw new RuntimeException("App out of date, getResources() null, closing app."); + } } - AsyncTask.takeOverAndroidThreadPool(); - JNIUtils.setClassLoader(getClassLoader()); - ResourceBundle.setAvailablePakLocales( - ProductConfig.COMPRESSED_LOCALES, ProductConfig.UNCOMPRESSED_LOCALES); - LibraryLoader.getInstance().setLinkerImplementation( - ProductConfig.USE_CHROMIUM_LINKER, ProductConfig.USE_MODERN_LINKER); - LibraryLoader.getInstance().enableJniChecks(); + @MainDex + @Override + public void onTrimMemory(int level) { + super.onTrimMemory(level); + if (isSevereMemorySignal(level) + && GlobalDiscardableReferencePool.getReferencePool() != null) { + GlobalDiscardableReferencePool.getReferencePool().drain(); + } + CustomTabsConnection.onTrimMemory(level); + } - if (isBrowserProcess) { - TraceEvent.end("ChromeApplication.attachBaseContext"); + @Override + public void startActivity(Intent intent, Bundle options) { + if (VrModuleProvider.getDelegate().canLaunch2DIntents() + || VrModuleProvider.getIntentDelegate().isVrIntent(intent)) { + super.startActivity(intent, options); + return; + } + + VrModuleProvider.getDelegate().requestToExitVr(new OnExitVrRequestListener() { + @Override + public void onSucceeded() { + if (!VrModuleProvider.getDelegate().canLaunch2DIntents()) { + throw new IllegalStateException("Still in VR after having exited VR."); + } + startActivity(intent, options); + } + + @Override + public void onDenied() {} + }); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + // TODO(huayinz): Add observer pattern for application configuration changes. + if (isBrowserProcess()) { + SystemNightModeMonitor.getInstance().onApplicationConfigurationChanged(); + } } } - private void maybeInitProcessType(boolean isBrowserProcess) { - if (isBrowserProcess) { - LibraryLoader.getInstance().setLibraryProcessType(LibraryProcessType.PROCESS_BROWSER); - return; - } - // WebView initialization sets the correct process type. - if (isWebViewProcess()) return; - - // Child processes set their own process type when bound. - String processName = ContextUtils.getProcessName(); - if (processName.contains("privileged_process") - || processName.contains("sandboxed_process")) { - return; - } - - // We must be in an isolated service process. - LibraryLoader.getInstance().setLibraryProcessType(LibraryProcessType.PROCESS_CHILD); + public ChromeApplication(Impl impl) { + setImpl(impl); } - protected boolean isWebViewProcess() { - return false; - } - - private static Boolean shouldUseDebugFlags() { - return CachedFeatureFlags.isEnabled(ChromeFeatureList.COMMAND_LINE_ON_NON_ROOTED); - } - - protected static boolean isBrowserProcess() { - return !ContextUtils.getProcessName().contains(":"); - } - - private static void updateMemoryPressurePolling(@ApplicationState int newState) { - if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { - MemoryPressureMonitor.INSTANCE.enablePolling(); - } else if (newState == ApplicationState.HAS_STOPPED_ACTIVITIES) { - MemoryPressureMonitor.INSTANCE.disablePolling(); - } - } - - /** Ensure this application object is not out-of-date. */ - private void checkAppBeingReplaced() { - // During app update the old apk can still be triggered by broadcasts and spin up an - // out-of-date application. Kill old applications in this bad state. See - // http://crbug.com/658130 for more context and http://b.android.com/56296 for the bug. - if (ContextUtils.getApplicationAssets() == null) { - throw new RuntimeException("App out of date, getResources() null, closing app."); - } - } - - @MainDex - @Override - public void onTrimMemory(int level) { - super.onTrimMemory(level); - if (isSevereMemorySignal(level) - && GlobalDiscardableReferencePool.getReferencePool() != null) { - GlobalDiscardableReferencePool.getReferencePool().drain(); - } - CustomTabsConnection.onTrimMemory(level); + public ChromeApplication() { + this(new ChromeApplicationImpl()); } /** @@ -239,42 +232,6 @@ || level >= TRIM_MEMORY_MODERATE; } - @Override - public void startActivity(Intent intent) { - startActivity(intent, null); - } - - @Override - public void startActivity(Intent intent, Bundle options) { - if (VrModuleProvider.getDelegate().canLaunch2DIntents() - || VrModuleProvider.getIntentDelegate().isVrIntent(intent)) { - super.startActivity(intent, options); - return; - } - - VrModuleProvider.getDelegate().requestToExitVr(new OnExitVrRequestListener() { - @Override - public void onSucceeded() { - if (!VrModuleProvider.getDelegate().canLaunch2DIntents()) { - throw new IllegalStateException("Still in VR after having exited VR."); - } - startActivity(intent, options); - } - - @Override - public void onDenied() {} - }); - } - - @Override - public void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - // TODO(huayinz): Add observer pattern for application configuration changes. - if (isBrowserProcess()) { - SystemNightModeMonitor.getInstance().onApplicationConfigurationChanged(); - } - } - /** Returns the application-scoped component. */ public static ChromeAppComponent getComponent() { if (sComponent == null) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/MonochromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/MonochromeApplication.java index 6271ae3..7d233a4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/MonochromeApplication.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/MonochromeApplication.java
@@ -6,13 +6,12 @@ import android.content.Context; -import com.android.webview.chromium.MonochromeLibraryPreloader; - import org.chromium.android_webview.nonembedded.WebViewApkApplication; import org.chromium.base.ActivityState; import org.chromium.base.ApplicationStatus; -import org.chromium.base.library_loader.LibraryLoader; +import org.chromium.base.annotations.UsedByReflection; import org.chromium.base.library_loader.LibraryProcessType; +import org.chromium.chrome.browser.base.SplitMonochromeApplication; import org.chromium.content_public.browser.ChildProcessCreationParams; /** @@ -28,50 +27,59 @@ * things specific to functioning as a WebView implementation. */ public class MonochromeApplication extends ChromeApplication { - @Override - protected void attachBaseContext(Context context) { - super.attachBaseContext(context); - WebViewApkApplication.maybeInitProcessGlobals(); - if (!LibraryLoader.getInstance().isLoadedByZygote()) { - LibraryLoader.getInstance().setNativeLibraryPreloader(new MonochromeLibraryPreloader()); - } - // ChildProcessCreationParams is only needed for browser process, though it is - // created and set in all processes. We must set isExternalService to true for - // Monochrome because Monochrome's renderer services are shared with WebView - // and are external, and will fail to bind otherwise. - boolean bindToCaller = false; - boolean ignoreVisibilityForImportance = false; - ChildProcessCreationParams.set(getPackageName(), null /* privilegedServicesName */, - getPackageName(), null /* sandboxedServicesName */, true /* isExternalService */, - LibraryProcessType.PROCESS_CHILD, bindToCaller, ignoreVisibilityForImportance); + public MonochromeApplication() { + super(new MonochromeApplicationImpl()); } - @Override - public void onCreate() { - super.onCreate(); - if (!ChromeVersionInfo.isStableBuild()) { - // Performing Monochrome WebView DevTools Launcher icon showing/hiding logic in onCreate - // rather than in attachBaseContext() because it depends on application context being - // initiatied. - if (isWebViewProcess()) { - // Whenever a monochrome webview process is launched (WebView service or developer - // UI), post a background task to show/hide the DevTools icon. - WebViewApkApplication.postDeveloperUiLauncherIconTask(); - } else if (isBrowserProcess()) { - // Frequently check current system webview provider and show/hide the icon - // accordingly by listening to Monochrome browser Activities status (whenever a - // browser activity comes to the foreground). - ApplicationStatus.registerStateListenerForAllActivities((activity, state) -> { - if (state == ActivityState.STARTED) { - WebViewApkApplication.postDeveloperUiLauncherIconTask(); - } - }); + /** Monochrome application logic. */ + @UsedByReflection("SplitMonochromeApplication.java") + public static class MonochromeApplicationImpl extends ChromeApplication.ChromeApplicationImpl { + @UsedByReflection("SplitMonochromeApplication.java") + public MonochromeApplicationImpl() {} + + @Override + public void attachBaseContext(Context context) { + super.attachBaseContext(context); + SplitMonochromeApplication.initializeMonochromeProcessCommon(); + // ChildProcessCreationParams is only needed for browser process, though it is + // created and set in all processes. We must set isExternalService to true for + // Monochrome because Monochrome's renderer services are shared with WebView + // and are external, and will fail to bind otherwise. + boolean bindToCaller = false; + boolean ignoreVisibilityForImportance = false; + ChildProcessCreationParams.set(getApplication().getPackageName(), + null /* privilegedServicesName */, getApplication().getPackageName(), + null /* sandboxedServicesName */, true /* isExternalService */, + LibraryProcessType.PROCESS_CHILD, bindToCaller, ignoreVisibilityForImportance); + } + + @Override + public void onCreate() { + super.onCreate(); + if (!ChromeVersionInfo.isStableBuild()) { + // Performing Monochrome WebView DevTools Launcher icon showing/hiding logic in + // onCreate rather than in attachBaseContext() because it depends on application + // context being initiatied. + if (isWebViewProcess()) { + // Whenever a monochrome webview process is launched (WebView service or + // developer UI), post a background task to show/hide the DevTools icon. + WebViewApkApplication.postDeveloperUiLauncherIconTask(); + } else if (isBrowserProcess()) { + // Frequently check current system webview provider and show/hide the icon + // accordingly by listening to Monochrome browser Activities status (whenever a + // browser activity comes to the foreground). + ApplicationStatus.registerStateListenerForAllActivities((activity, state) -> { + if (state == ActivityState.STARTED) { + WebViewApkApplication.postDeveloperUiLauncherIconTask(); + } + }); + } } } - } - @Override - protected boolean isWebViewProcess() { - return WebViewApkApplication.isWebViewProcess(); + @Override + public boolean isWebViewProcess() { + return WebViewApkApplication.isWebViewProcess(); + } } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/base/SplitChromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/base/SplitChromeApplication.java new file mode 100644 index 0000000..cb326b6 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/base/SplitChromeApplication.java
@@ -0,0 +1,69 @@ +// 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. + +package org.chromium.chrome.browser.base; + +import android.content.Context; +import android.content.pm.PackageManager; +import android.os.Build; + +import org.chromium.base.compat.ApiHelperForO; + +/** + * Application class to use for Chrome when //chrome code is in an isolated split. This class will + * perform any necessary initialization for non-browser processes without loading code from the + * chrome split. In the browser process, the necessary logic is loaded from the chrome split using + * reflection. + */ +public class SplitChromeApplication extends SplitCompatApplication { + private String mChromeApplicationClassName; + + public SplitChromeApplication() { + this("org.chromium.chrome.browser.ChromeApplication$ChromeApplicationImpl"); + } + + public SplitChromeApplication(String chromeApplicationClassName) { + mChromeApplicationClassName = chromeApplicationClassName; + } + + @Override + protected void attachBaseContext(Context context) { + if (isBrowserProcess()) { + context = createChromeContext(context); + setImpl(createChromeApplication(context)); + } else { + setImpl(createNonBrowserApplication()); + } + super.attachBaseContext(context); + } + + protected Impl createNonBrowserApplication() { + return new Impl(); + } + + private Impl createChromeApplication(Context context) { + try { + return (Impl) context.getClassLoader() + .loadClass(mChromeApplicationClassName) + .newInstance(); + } catch (ReflectiveOperationException e) { + throw new RuntimeException(e); + } + } + + private Context createChromeContext(Context base) { + assert isBrowserProcess(); + // Isolated splits are only supported in O+, so just return the base context on other + // versions, since this will have access to all splits. + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { + return base; + } + try { + return ApiHelperForO.createContextForSplit(base, "chrome"); + } catch (PackageManager.NameNotFoundException e) { + // This application class should not be used if the chrome split does not exist. + throw new RuntimeException(e); + } + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/base/SplitCompatApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/base/SplitCompatApplication.java new file mode 100644 index 0000000..75e8304 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/base/SplitCompatApplication.java
@@ -0,0 +1,173 @@ +// 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. + +package org.chromium.chrome.browser.base; + +import android.app.Application; +import android.content.Context; +import android.content.Intent; +import android.content.res.Configuration; +import android.os.Bundle; + +import androidx.annotation.CallSuper; + +import org.chromium.base.BundleUtils; +import org.chromium.base.ContextUtils; +import org.chromium.base.JNIUtils; +import org.chromium.base.library_loader.LibraryLoader; +import org.chromium.base.library_loader.LibraryProcessType; +import org.chromium.base.memory.MemoryPressureMonitor; +import org.chromium.base.task.AsyncTask; +import org.chromium.chrome.browser.ProductConfig; +import org.chromium.components.embedder_support.application.FontPreloadingWorkaround; +import org.chromium.components.module_installer.util.ModuleUtil; +import org.chromium.ui.base.ResourceBundle; + +/** + * Application base class which will call through to the given {@link Impl}. Application classes + * which extend this class should also extend {@link Impl}, and call {@link #setImpl(Impl)} before + * calling {@link attachBaseContext(Context)}. + */ +public class SplitCompatApplication extends Application { + private Impl mImpl; + + /** + * Holds the implementation of application logic. Will be called by {@link + * SplitCompatApplication}. + */ + protected static class Impl { + private SplitCompatApplication mApplication; + + private final void setApplication(SplitCompatApplication application) { + mApplication = application; + } + + protected final SplitCompatApplication getApplication() { + return mApplication; + } + + @CallSuper + public void onCreate() { + // These can't go in attachBaseContext because Context.getApplicationContext() (which + // they use under-the-hood) does not work until after it returns. + FontPreloadingWorkaround.maybeInstallWorkaround(getApplication()); + MemoryPressureMonitor.INSTANCE.registerComponentCallbacks(); + } + + @CallSuper + public void attachBaseContext(Context context) { + mApplication.superAttachBaseContext(context); + + // Perform initialization of globals common to all processes. + ContextUtils.initApplicationContext(getApplication()); + maybeInitProcessType(); + BundleUtils.setIsBundle(ProductConfig.IS_BUNDLE); + + // Write installed modules to crash keys. This needs to be done as early as possible so + // that these values are set before any crashes are reported. + ModuleUtil.updateCrashKeys(); + + AsyncTask.takeOverAndroidThreadPool(); + JNIUtils.setClassLoader(getApplication().getClassLoader()); + ResourceBundle.setAvailablePakLocales( + ProductConfig.COMPRESSED_LOCALES, ProductConfig.UNCOMPRESSED_LOCALES); + LibraryLoader.getInstance().setLinkerImplementation( + ProductConfig.USE_CHROMIUM_LINKER, ProductConfig.USE_MODERN_LINKER); + LibraryLoader.getInstance().enableJniChecks(); + } + + public void onTrimMemory(int level) {} + + @CallSuper + public void startActivity(Intent intent, Bundle options) { + mApplication.superStartActivity(intent, options); + } + + public void onConfigurationChanged(Configuration newConfig) {} + + public boolean isWebViewProcess() { + return false; + } + + private void maybeInitProcessType() { + if (isBrowserProcess()) { + LibraryLoader.getInstance().setLibraryProcessType( + LibraryProcessType.PROCESS_BROWSER); + return; + } + // WebView initialization sets the correct process type. + if (isWebViewProcess()) return; + + // Child processes set their own process type when bound. + String processName = ContextUtils.getProcessName(); + if (processName.contains("privileged_process") + || processName.contains("sandboxed_process")) { + return; + } + + // We must be in an isolated service process. + LibraryLoader.getInstance().setLibraryProcessType(LibraryProcessType.PROCESS_CHILD); + } + } + + public final void setImpl(Impl impl) { + assert mImpl == null; + mImpl = impl; + mImpl.setApplication(this); + } + + /** + * This exposes the super method so it can be called inside the Impl class code instead of just + * at the start. + */ + private void superAttachBaseContext(Context context) { + super.attachBaseContext(context); + } + + /** + * This exposes the super method so it can be called inside the Impl class code instead of just + * at the start. + */ + private void superStartActivity(Intent intent, Bundle options) { + super.startActivity(intent, options); + } + + @Override + protected void attachBaseContext(Context context) { + mImpl.attachBaseContext(context); + } + + @Override + public void onCreate() { + super.onCreate(); + mImpl.onCreate(); + } + + @Override + public void onTrimMemory(int level) { + super.onTrimMemory(level); + mImpl.onTrimMemory(level); + } + + /** Forward all startActivity() calls to the two argument version. */ + @Override + public void startActivity(Intent intent) { + startActivity(intent, null); + } + + @Override + public void startActivity(Intent intent, Bundle options) { + mImpl.startActivity(intent, options); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + mImpl.onConfigurationChanged(newConfig); + } + + public static boolean isBrowserProcess() { + return !ContextUtils.getProcessName().contains(":"); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/base/SplitMonochromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/base/SplitMonochromeApplication.java new file mode 100644 index 0000000..aaa23d29 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/base/SplitMonochromeApplication.java
@@ -0,0 +1,59 @@ +// 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. + +package org.chromium.chrome.browser.base; + +import android.content.Context; + +import com.android.webview.chromium.MonochromeLibraryPreloader; + +import org.chromium.android_webview.nonembedded.WebViewApkApplication; +import org.chromium.base.library_loader.LibraryLoader; +import org.chromium.chrome.browser.ChromeVersionConstants; +import org.chromium.components.version_info.Channel; + +/** + * Application class to use for Monochrome when //chrome code is in an isolated split. See {@link + * SplitChromeApplication} for more info. + */ +public class SplitMonochromeApplication extends SplitChromeApplication { + private static class NonBrowserMonochromeApplication extends Impl { + @Override + public void attachBaseContext(Context context) { + super.attachBaseContext(context); + initializeMonochromeProcessCommon(); + } + + @Override + public void onCreate() { + super.onCreate(); + // TODO(crbug.com/1126301): This matches logic in MonochromeApplication.java. + // Deduplicate if chrome split launches. + if (ChromeVersionConstants.CHANNEL != Channel.STABLE && isWebViewProcess()) { + WebViewApkApplication.postDeveloperUiLauncherIconTask(); + } + } + + @Override + public boolean isWebViewProcess() { + return WebViewApkApplication.isWebViewProcess(); + } + } + + public SplitMonochromeApplication() { + super("org.chromium.chrome.browser.MonochromeApplication$MonochromeApplicationImpl"); + } + + @Override + protected Impl createNonBrowserApplication() { + return new NonBrowserMonochromeApplication(); + } + + public static void initializeMonochromeProcessCommon() { + WebViewApkApplication.maybeInitProcessGlobals(); + if (!LibraryLoader.getInstance().isLoadedByZygote()) { + LibraryLoader.getInstance().setNativeLibraryPreloader(new MonochromeLibraryPreloader()); + } + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java index 264426ed..6b35b21 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java
@@ -961,9 +961,4 @@ closePanel(StateChangeReason.BACK_PRESS, true); return true; } - - @Override - public int getPosition() { - return Position.FRONT; - } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java index 14cd07c..e4599b8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManager.java
@@ -36,13 +36,17 @@ import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandler; import org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter; import org.chromium.chrome.browser.compositor.overlays.SceneOverlay; +import org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutHelperManager; import org.chromium.chrome.browser.compositor.overlays.toolbar.TopToolbarOverlayCoordinator; import org.chromium.chrome.browser.compositor.scene_layer.SceneLayer; import org.chromium.chrome.browser.compositor.scene_layer.SceneOverlayLayer; +import org.chromium.chrome.browser.compositor.scene_layer.ScrollingBottomViewSceneLayer; import org.chromium.chrome.browser.contextualsearch.ContextualSearchManagementDelegate; import org.chromium.chrome.browser.device.DeviceClassManager; import org.chromium.chrome.browser.fullscreen.BrowserControlsManager; +import org.chromium.chrome.browser.gesturenav.HistoryNavigationCoordinator; import org.chromium.chrome.browser.native_page.NativePageFactory; +import org.chromium.chrome.browser.status_indicator.StatusIndicatorCoordinator; import org.chromium.chrome.browser.tab.SadTab; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabBrowserControlsConstraintsHelper; @@ -69,7 +73,9 @@ import org.chromium.ui.util.TokenHolder; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * A class that is responsible for managing an active {@link Layout} to show to the screen. This @@ -132,7 +138,6 @@ private ContextualSearchPanel mContextualSearchPanel; private final OverlayPanelManager mOverlayPanelManager; private TopToolbarOverlayCoordinator mToolbarOverlay; - private SceneOverlay mStatusIndicatorSceneOverlay; private SceneOverlay mGestureNavigationOverscrollGlow; /** A delegate for interacting with the Contextual Search manager. */ @@ -166,6 +171,9 @@ /** The overlays that can be drawn on top of the active layout. */ protected final List<SceneOverlay> mSceneOverlays = new ArrayList<>(); + /** A map of {@link SceneOverlay} to its position relative to the others. */ + private Map<Class, Integer> mOverlayOrderMap = new HashMap<>(); + /** * Protected class to handle {@link TabModelObserver} related tasks. Extending classes will * need to override any related calls to add new functionality */ @@ -254,6 +262,19 @@ mContext = host.getContext(); LayoutRenderHost renderHost = host.getLayoutRenderHost(); + // clang-format off + // Overlays are ordered back (closest to the web content) to front. + Class[] overlayOrder = new Class[] { + HistoryNavigationCoordinator.getSceneOverlayClass(), + TopToolbarOverlayCoordinator.class, + ScrollingBottomViewSceneLayer.class, + StripLayoutHelperManager.class, + StatusIndicatorCoordinator.getSceneOverlayClass(), + ContextualSearchPanel.class}; + // clang-format off + + for (int i = 0; i < overlayOrder.length; i++) mOverlayOrderMap.put(overlayOrder[i], i); + assert contentContainer != null; mContentContainer = contentContainer; @@ -449,6 +470,7 @@ mToolbarOverlay = new TopToolbarOverlayCoordinator(mContext, mFrameRequestSupplier, this, controlContainer, tabProvider, getBrowserControlsManager(), mAndroidViewShownSupplier, () -> renderHost.getResourceManager()); + addSceneOverlay(mToolbarOverlay); } // Initialize Layouts @@ -456,9 +478,7 @@ // Contextual Search scene overlay. mContextualSearchPanel = new ContextualSearchPanel(mContext, this, mOverlayPanelManager); - - // Add any SceneOverlays to a layout. - addAllSceneOverlays(); + addSceneOverlay(mContextualSearchPanel); // Save state mContextualSearchDelegate = contextualSearchDelegate; @@ -1008,46 +1028,34 @@ } /** - * Set the status indicator {@link SceneOverlay} to be added to the layout. - * @param overlay The {@link SceneOverlay} to set. + * Add a {@link SceneOverlay} to be drawn on the composited layer of the active layout. + * @param overlay The overlay to add. */ - public void setStatusIndicatorSceneOverlay(SceneOverlay overlay) { - mStatusIndicatorSceneOverlay = overlay; - } + public void addSceneOverlay(SceneOverlay overlay) { + if (mSceneOverlays.contains(overlay)) throw new RuntimeException("Overlay already added!"); - /** - * Add any {@link SceneOverlay}s to the layout. This can be used to add the overlays in a - * particular order. - * Classes that override this method should be careful about the order that - * overlays are added and when super is called (i.e. cases where one overlay needs to be - * on top of another positioned. - */ - protected void addAllSceneOverlays() { - mSceneOverlays.add(mToolbarOverlay); - if (mStatusIndicatorSceneOverlay != null) { - mSceneOverlays.add(mStatusIndicatorSceneOverlay); + if (!mOverlayOrderMap.containsKey(overlay.getClass())) { + throw new RuntimeException("Please add overlay to order list in constructor."); } - mSceneOverlays.add(mContextualSearchPanel); + + int overlayPosition = mOverlayOrderMap.get(overlay.getClass()); + + int index; + for (index = 0; index < mSceneOverlays.size(); index++) { + if (overlayPosition < mOverlayOrderMap.get(mSceneOverlays.get(index).getClass())) break; + } + + mSceneOverlays.add(index, overlay); } - /** - * Add a {@link SceneOverlay} to the front of the list. This means the overlay will be drawn - * last and therefore above all other overlays currently in the list. - * @param overlay The overlay to be added to the back of the list. - */ - public void addSceneOverlayToFront(SceneOverlay overlay) { - assert !mSceneOverlays.contains(overlay); - mSceneOverlays.add(overlay); + @VisibleForTesting + void setSceneOverlayOrderForTesting(Map<Class, Integer> order) { + mOverlayOrderMap = order; } - /** - * Add a {@link SceneOverlay} to the back of the list. This means the overlay will be drawn - * first and therefore behind all other overlays currently in the list. - * @param overlay The overlay to be added to the back of the list. - */ - public void addSceneOverlayToBack(SceneOverlay overlay) { - assert !mSceneOverlays.contains(overlay); - mSceneOverlays.add(0, overlay); + @VisibleForTesting + List<SceneOverlay> getSceneOverlaysForTesting() { + return mSceneOverlays; } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java index 0070bf2..46d3ecc 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java
@@ -45,18 +45,12 @@ mTabStripLayoutHelperManager = new StripLayoutHelperManager( host.getContext(), this, mHost.getLayoutRenderHost(), () -> mTitleCache); + addSceneOverlay(mTabStripLayoutHelperManager); setNextLayout(null); } @Override - protected void addAllSceneOverlays() { - // Add the tab strip overlay before any others. - mSceneOverlays.add(mTabStripLayoutHelperManager); - super.addAllSceneOverlays(); - } - - @Override public void destroy() { super.destroy();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/SceneOverlay.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/SceneOverlay.java index 2c37622..9872ee9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/SceneOverlay.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/SceneOverlay.java
@@ -6,36 +6,18 @@ import android.graphics.RectF; -import androidx.annotation.IntDef; - import org.chromium.chrome.browser.compositor.LayerTitleCache; import org.chromium.chrome.browser.compositor.layouts.components.VirtualView; import org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter; import org.chromium.chrome.browser.compositor.scene_layer.SceneOverlayLayer; import org.chromium.ui.resources.ResourceManager; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.util.List; /** * An interface which positions the actual tabs and adds additional UI to the them. */ public interface SceneOverlay { - /** Positioning information for when overlays are added to the tree. */ - @IntDef({Position.FRONT, Position.DEFAULT, Position.BACK}) - @Retention(RetentionPolicy.SOURCE) - @interface Position { - /** The overlay will be one the of front-most layers. */ - int FRONT = 0; - - /** The overlay will be between the front and back layers in the order it was added. */ - int DEFAULT = 1; - - /** The overlay will be one of the back-most layers. */ - int BACK = 2; - } - /** * Updates and gets a {@link SceneOverlayLayer} that represents an scene overlay. * @@ -99,10 +81,4 @@ * @return True if this overlay handles tab creation. */ boolean handlesTabCreating(); - - /** - * @return Where this overlay should be positioned relative to the other overlays. - */ - @Position - int getPosition(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java index 3147eb65..6a18686c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java
@@ -507,11 +507,6 @@ return false; } - @Override - public int getPosition() { - return Position.BACK; - } - private void tabModelSwitched(boolean incognito) { if (incognito == mIsIncognito) return; mIsIncognito = incognito;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/toolbar/TopToolbarOverlayCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/toolbar/TopToolbarOverlayCoordinator.java index 7bc5ac0..6245e91 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/toolbar/TopToolbarOverlayCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/toolbar/TopToolbarOverlayCoordinator.java
@@ -113,9 +113,4 @@ public boolean handlesTabCreating() { return false; } - - @Override - public int getPosition() { - return Position.BACK; - } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/ScrollingBottomViewSceneLayer.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/ScrollingBottomViewSceneLayer.java index 6164109..2e04b0f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/ScrollingBottomViewSceneLayer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/ScrollingBottomViewSceneLayer.java
@@ -158,11 +158,6 @@ @Override public void getVirtualViews(List<VirtualView> views) {} - @Override - public int getPosition() { - return Position.DEFAULT; - } - @NativeMethods interface Natives { long init(ScrollingBottomViewSceneLayer caller);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/toolbar/CustomTabToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/toolbar/CustomTabToolbar.java index 1be17e15..52c86139 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/toolbar/CustomTabToolbar.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/features/toolbar/CustomTabToolbar.java
@@ -445,8 +445,8 @@ // Using the current background color instead of the final color in case this // animation was cancelled. This ensures the assets are updated to the visible // color. - mUseDarkColors = - !ColorUtils.shouldUseLightForegroundOnBackground(background.getColor()); + int backgroundColor = background.getColor(); + mUseDarkColors = !ColorUtils.shouldUseLightForegroundOnBackground(backgroundColor); mLocationBar.updateVisualsForState(); } });
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java index bc709c09..ec2ad32 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java
@@ -11,6 +11,8 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; +import android.os.Build.VERSION; +import android.os.Build.VERSION_CODES; import android.os.Handler; import android.os.IBinder; @@ -20,6 +22,11 @@ import org.chromium.base.ContextUtils; import org.chromium.base.Log; import org.chromium.chrome.browser.download.DownloadNotificationService.DownloadStatus; +import org.chromium.chrome.browser.notifications.NotificationUmaTracker; +import org.chromium.chrome.browser.notifications.NotificationWrapperBuilderFactory; +import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; +import org.chromium.components.browser_ui.notifications.NotificationMetadata; +import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; import java.util.HashMap; import java.util.Iterator; @@ -29,14 +36,14 @@ * Manager to stop and start the foreground service associated with downloads. */ public class DownloadForegroundServiceManager { - private static class DownloadUpdate { + protected static class DownloadUpdate { int mNotificationId; Notification mNotification; @DownloadNotificationService.DownloadStatus int mDownloadStatus; Context mContext; - DownloadUpdate(int notificationId, Notification notification, + DownloadUpdate(int notificationId, @Nullable Notification notification, @DownloadNotificationService.DownloadStatus int downloadStatus, Context context) { mNotificationId = notificationId; mNotification = notification; @@ -67,6 +74,11 @@ // This is true when context.bindService has been called and before context.unbindService. private boolean mIsServiceBound; + + // Whether startForeground() is called. startForeground() must be called in 5 seconds after the + // service is started. + private boolean mStartForegroundCalled; + // This is non-null when onServiceConnected has been called (aka service is active). private DownloadForegroundService mBoundService; @@ -81,9 +93,19 @@ public DownloadForegroundServiceManager() {} + /** + * Updates download notification status. In progress notification will have a foreground service + * associated. If all notifications are not in progress, foreground service will stop. + * @param context Android {@link Context}. + * @param downloadStatus Download status. In progress notification will have a foreground + * service. + * @param notificationId The notification id. + * @param notification The notification associated with the id. Can be null if {@link + * DownloadNotificationService} tries to cancel a notification. + */ public void updateDownloadStatus(Context context, @DownloadNotificationService.DownloadStatus int downloadStatus, int notificationId, - Notification notification) { + @Nullable Notification notification) { if (downloadStatus != DownloadNotificationService.DownloadStatus.IN_PROGRESS) { Log.w(TAG, "updateDownloadStatus status: " + downloadStatus + ", id: " + notificationId); @@ -123,8 +145,7 @@ // In the pending case, start foreground with specific notificationId and notification. if (isProcessingPending) { Log.w(TAG, "Starting service with type " + downloadUpdate.mDownloadStatus); - startOrUpdateForegroundService( - downloadUpdate.mNotificationId, downloadUpdate.mNotification); + startOrUpdateForegroundService(downloadUpdate); // Post a delayed task to eventually check to see if service needs to be stopped. postMaybeStopServiceRunnable(); @@ -147,8 +168,7 @@ // Make sure the pinned notification is still active, if not, update. if (mDownloadUpdateQueue.get(mPinnedNotificationId) == null || !isActive(mDownloadUpdateQueue.get(mPinnedNotificationId).mDownloadStatus)) { - startOrUpdateForegroundService( - downloadUpdate.mNotificationId, downloadUpdate.mNotification); + startOrUpdateForegroundService(downloadUpdate); } // Clear out inactive download updates in queue if there is at least one active download. @@ -195,6 +215,7 @@ void startAndBindService(Context context) { Log.w(TAG, "startAndBindService"); mIsServiceBound = true; + mStartForegroundCalled = false; startAndBindServiceInternal(context); } @@ -231,8 +252,21 @@ /** Helper code to start or update foreground service. */ @VisibleForTesting - void startOrUpdateForegroundService(int notificationId, Notification notification) { - Log.w(TAG, "startOrUpdateForegroundService id: " + notificationId); + void startOrUpdateForegroundService(DownloadUpdate update) { + Log.w(TAG, "startOrUpdateForegroundService id: " + update.mNotificationId); + + int notificationId = update.mNotificationId; + Notification notification = update.mNotification; + + // On O+, we must call startForeground or Android will crash. If the last update + // is DownloadStatus.CANCELLED, then create an empty notification. See crbug.com/1121096. + // Notices the empty notification will be cancelled immediately in + // DownloadNotificationService afterward. + if (VERSION.SDK_INT >= VERSION_CODES.O && notification == null && !mStartForegroundCalled) { + assert update.mDownloadStatus == DownloadStatus.CANCELLED; + notification = createEmptyNotification(notificationId, update.mContext); + } + if (mBoundService != null && notificationId != INVALID_NOTIFICATION_ID && notification != null) { // If there was an originally pinned notification, get its id and notification. @@ -246,12 +280,25 @@ // Start service and handle notifications. mBoundService.startOrUpdateForegroundService(notificationId, notification, mPinnedNotificationId, oldNotification, killOldNotification); + mStartForegroundCalled = true; // After the service has been started and the notification handled, change stored id. mPinnedNotificationId = notificationId; } } + // Creates an empty notification to feed to startForeground(). + private Notification createEmptyNotification(int notificationId, Context context) { + NotificationWrapperBuilder builder = + NotificationWrapperBuilderFactory.createNotificationWrapperBuilder( + true /* preferCompat */, ChromeChannelDefinitions.ChannelId.DOWNLOADS, + null /* remoteAppPackageName */, + new NotificationMetadata( + NotificationUmaTracker.SystemNotificationType.DOWNLOAD_FILES, null, + notificationId)); + return builder.build(); + } + /** Helper code to stop and unbind service. */ @VisibleForTesting
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java index 1b7f4d4..45d459e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
@@ -286,9 +286,9 @@ mDownloadSharedPreferenceHelper.getDownloadSharedPreferenceEntry(id); if (entry == null) return; - cancelNotification(entry.notificationId, id); mDownloadForegroundServiceManager.updateDownloadStatus(ContextUtils.getApplicationContext(), DownloadStatus.CANCELLED, entry.notificationId, null); + cancelNotification(entry.notificationId, id); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationCoordinator.java index 57c3ef12..0a7067d7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/HistoryNavigationCoordinator.java
@@ -88,6 +88,11 @@ return coordinator; } + /** @return The class of the {@link SceneOverlay} owned by this coordinator. */ + public static Class getSceneOverlayClass() { + return OverscrollGlowOverlay.class; + } + /** * Initializes the navigation layout and internal objects. */ @@ -155,7 +160,7 @@ mInsetObserverView = insetObserverView; insetObserverView.addObserver(this); } - layoutManager.addSceneOverlayToFront(mOverscrollGlowOverlay); + layoutManager.addSceneOverlay(mOverscrollGlowOverlay); } private boolean isNativePage() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/OverscrollGlowOverlay.java b/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/OverscrollGlowOverlay.java index 3cab77d..84e98ce3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/OverscrollGlowOverlay.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/gesturenav/OverscrollGlowOverlay.java
@@ -117,9 +117,4 @@ public boolean handlesTabCreating() { return false; } - - @Override - public int getPosition() { - return Position.BACK; - } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java index fd4a9a5..5f79267 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java
@@ -394,7 +394,7 @@ * afterwards via PostTask. */ public static void maybeShareOfflinePage(Tab tab, final Callback<ShareParams> shareCallback) { - if (tab == null) { + if (tab == null || !tab.isInitialized()) { shareCallback.onResult(null); return; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java index f877926..c7726bb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -631,10 +631,10 @@ } /** - * Click the security icon of the Expandable Payment Handler for testing purpose; return false + * Clicks the security icon of the Expandable Payment Handler for testing purpose; return false * if failed. * - * @return The WebContents of the Expandable Payment Handler. + * @return Whether the click is successful. */ @VisibleForTesting(otherwise = VisibleForTesting.NONE) public static boolean clickPaymentHandlerSecurityIconForTest() { @@ -648,6 +648,23 @@ } /** + * Simulates a click on the close button of the Payment Handler for testing purpose; return + * false if failed. + * + * @return Whether the click is successful. + */ + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + public static boolean clickPaymentHandlerCloseButtonForTest() { + if (sShowingPaymentRequest == null) return false; + return sShowingPaymentRequest.clickPaymentHandlerCloseButtonForTestInternal(); + } + + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + private boolean clickPaymentHandlerCloseButtonForTestInternal() { + return mPaymentUIsManager.clickPaymentHandlerCloseButtonForTest(); + } + + /** * Confirms payment in minimal UI. Used only in test. * * @return Whether the payment was confirmed successfully.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerCoordinator.java index f47e07c..be4cd7a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/PaymentHandlerCoordinator.java
@@ -166,4 +166,9 @@ public void clickSecurityIconForTest() { mToolbarCoordinator.clickSecurityIconForTest(); } + + @VisibleForTesting + public void clickCloseButtonForTest() { + mToolbarCoordinator.clickCloseButtonForTest(); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarCoordinator.java index a819480..d5f719c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarCoordinator.java
@@ -102,12 +102,18 @@ return mToolbarView.getView(); } - /** @return The security icon of the PaymentHandlerToolbar. */ + /** Simulates a click on the security icon of the payment handler toolbar. */ @VisibleForTesting(otherwise = VisibleForTesting.NONE) public void clickSecurityIconForTest() { mToolbarView.mSecurityIconView.performClick(); } + /** Simulates a click on the close button of the payment handler toolbar. */ + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + public void clickCloseButtonForTest() { + mToolbarView.mCloseButton.performClick(); + } + // Implement PaymentHandlerToolbarMediatorDelegate. @Override @ConnectionSecurityLevel
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUIsManager.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUIsManager.java index fc7768b..bacb778 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUIsManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentUIsManager.java
@@ -972,6 +972,13 @@ return true; } + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + public boolean clickPaymentHandlerCloseButtonForTest() { + if (mPaymentHandlerUi == null) return false; + mPaymentHandlerUi.clickCloseButtonForTest(); + return true; + } + /** Provide PaymentInformation to the PaymentRequest UI. */ public void providePaymentInformationToPaymentRequestUI() { // Do not display service worker payment apps summary in single line so as to display its
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/ProfileDataCache.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/ProfileDataCache.java index 0a481ee..1cf4edf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/ProfileDataCache.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/ProfileDataCache.java
@@ -32,6 +32,8 @@ import org.chromium.components.signin.AccountManagerFacadeProvider; import org.chromium.components.signin.ProfileDataSource; import org.chromium.components.signin.base.AccountInfo; +import org.chromium.components.signin.base.CoreAccountInfo; +import org.chromium.components.signin.identitymanager.IdentityManager; import java.util.ArrayList; import java.util.HashMap; @@ -44,7 +46,8 @@ * should be provided by calling {@link #update(List)} */ @MainThread -public class ProfileDataCache implements ProfileDownloader.Observer, ProfileDataSource.Observer { +public class ProfileDataCache implements ProfileDownloader.Observer, ProfileDataSource.Observer, + IdentityManager.Observer { /** * Observer to get notifications about changes in profile data. */ @@ -112,6 +115,7 @@ private final ObserverList<Observer> mObservers = new ObserverList<>(); private final Map<String, DisplayableProfileData> mCachedProfileData = new HashMap<>(); private @Nullable final ProfileDataSource mProfileDataSource; + private final IdentityManager mIdentityManager; public ProfileDataCache(Context context, @Px int imageSize) { this(context, imageSize, null); @@ -130,6 +134,8 @@ mBadgeConfig = badgeConfig; mPlaceholderImage = getScaledPlaceholderImage(context, imageSize); mProfileDataSource = profileDataSource; + mIdentityManager = IdentityServicesProvider.get().getIdentityManager( + Profile.getLastUsedRegularProfile()); } /** @@ -202,6 +208,7 @@ } else { ProfileDownloader.addObserver(this); } + mIdentityManager.addObserver(this); } mObservers.addObserver(observer); } @@ -218,13 +225,14 @@ } else { ProfileDownloader.removeObserver(this); } + mIdentityManager.removeObserver(this); } } private void updateCacheFromProfileDataSource() { for (ProfileDataSource.ProfileData profileData : mProfileDataSource.getProfileDataMap().values()) { - updateCachedProfileData(createDisplayableProfileData(profileData)); + updateCachedProfileDataAndNotifyObservers(createDisplayableProfileData(profileData)); } } @@ -239,7 +247,7 @@ public void onProfileDownloaded(String accountId, String fullName, String givenName, Bitmap bitmap) { ThreadUtils.assertOnUiThread(); - updateCachedProfileData(new DisplayableProfileData( + updateCachedProfileDataAndNotifyObservers(new DisplayableProfileData( accountId, prepareAvatar(bitmap, accountId), fullName, givenName)); } @@ -252,12 +260,39 @@ mCachedProfileData.remove(accountId); notifyObservers(accountId); } else { - updateCachedProfileData(createDisplayableProfileData(profileData)); + updateCachedProfileDataAndNotifyObservers(createDisplayableProfileData(profileData)); } - } /** + * Implements {@link IdentityManager.Observer}. + */ + @Override + public void onExtendedAccountInfoUpdated(AccountInfo accountInfo) { + final String accountEmail = accountInfo.getEmail(); + DisplayableProfileData profileData = mCachedProfileData.get(accountEmail); + // if profileData is null, we will fetch monogram when generating + // the cache so that different sources will be handled in order. + if (profileData != null && profileData.getImage() == mPlaceholderImage) { + updateCachedProfileDataAndNotifyObservers(new DisplayableProfileData(accountEmail, + prepareAvatar(accountInfo.getAccountImage(), accountEmail), + profileData.getFullName(), profileData.getGivenName())); + } + } + + /** + * Implements {@link IdentityManager.Observer}. + */ + @Override + public void onPrimaryAccountSet(CoreAccountInfo account) {} + + /** + * Implements {@link IdentityManager.Observer}. + */ + @Override + public void onPrimaryAccountCleared(CoreAccountInfo account) {} + + /** * Returns a profile data cache object without a badge.The badge is put with respect to * R.dimen.user_picture_size. So this method only works with the user avatar of this size. * @param context Context of the application to extract resources from @@ -315,7 +350,7 @@ return overlayBadgeOnUserPicture(croppedAvatar); } - private void updateCachedProfileData(DisplayableProfileData profileData) { + private void updateCachedProfileDataAndNotifyObservers(DisplayableProfileData profileData) { mCachedProfileData.put(profileData.getAccountName(), profileData); notifyObservers(profileData.getAccountName()); } @@ -379,12 +414,10 @@ * TODO(https://crbug.com/1130545): We should refactor the different sources for getting * the profile image. */ - private static @Nullable Bitmap getAccountImageFromIdentityManager(String accountEmail) { + private @Nullable Bitmap getAccountImageFromIdentityManager(String accountEmail) { AccountInfo accountInfo = - IdentityServicesProvider.get() - .getIdentityManager(Profile.getLastUsedRegularProfile()) - .findExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress( - accountEmail); + mIdentityManager.findExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress( + accountEmail); return accountInfo != null ? accountInfo.getAccountImage() : null; } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java index dab56ce..f7feaab 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java
@@ -23,6 +23,7 @@ import org.chromium.base.task.PostTask; import org.chromium.chrome.browser.AppHooks; import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.sync.AndroidSyncSettings; import org.chromium.components.signin.AccountTrackerService; import org.chromium.components.signin.AccountUtils; @@ -271,6 +272,27 @@ mIdentityManager.addObserver(this); reloadAllAccountsFromSystem(); + + maybeRollbackMobileIdentityConsistency(); + } + + /** + * Temporary code to handle rollback for {@link ChromeFeatureList#MOBILE_IDENTITY_CONSISTENCY}. + * TODO(https://crbug.com/1065029): Remove when the flag is removed. + */ + private void maybeRollbackMobileIdentityConsistency() { + if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) return; + // Nothing to do if there's no primary account. + if (mIdentityManager.getPrimaryAccountInfo(ConsentLevel.NOT_REQUIRED) == null) return; + // Nothing to do if sync is on - this state existed before MobileIdentityConsistency. + if (mIdentityManager.getPrimaryAccountInfo(ConsentLevel.SYNC) != null) return; + + Log.w(TAG, "Rolling back MobileIdentityConsistency: signing out."); + signOut(SignoutReason.MOBILE_IDENTITY_CONSISTENCY_ROLLBACK); + // Since AccountReconcilor currently operates in pre-MICE mode, it doesn't react to + // primary account changes when there's no sync consent. Log-out web accounts manually. + SigninManagerJni.get().logOutAllAccountsForMobileIdentityConsistencyRollback( + mNativeSigninManagerAndroid); } /** @@ -818,6 +840,10 @@ String getManagementDomain(long nativeSigninManagerAndroid); + // Temporary code to handle rollback for MobileIdentityConsistency. + // TODO(https://crbug.com/1065029): Remove when the flag is removed. + void logOutAllAccountsForMobileIdentityConsistencyRollback(long nativeSigninManagerAndroid); + void wipeProfileData(long nativeSigninManagerAndroid, Runnable callback); void wipeGoogleServiceWorkerCaches(long nativeSigninManagerAndroid, Runnable callback);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorCoordinator.java index 5d4434a..e8e07ed9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorCoordinator.java
@@ -155,6 +155,11 @@ return mSceneLayer; } + /** @return The class of the {@link SceneOverlay} owned by this coordinator. */ + public static Class getSceneOverlayClass() { + return StatusIndicatorSceneLayer.class; + } + private void initialize() { final ViewStub stub = mActivity.findViewById(R.id.status_indicator_stub); final ViewResourceFrameLayout root = (ViewResourceFrameLayout) stub.inflate();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorSceneLayer.java b/chrome/android/java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorSceneLayer.java index 856876e..52ac7cf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorSceneLayer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorSceneLayer.java
@@ -41,7 +41,7 @@ * @param browserControlsStateProvider {@link BrowserControlsStateProvider} to access browser * controls offsets. */ - public StatusIndicatorSceneLayer(BrowserControlsStateProvider browserControlsStateProvider) { + StatusIndicatorSceneLayer(BrowserControlsStateProvider browserControlsStateProvider) { mBrowserControlsStateProvider = browserControlsStateProvider; } @@ -121,11 +121,6 @@ @Override public void getVirtualViews(List<VirtualView> views) {} - @Override - public int getPosition() { - return Position.DEFAULT; - } - @NativeMethods interface Natives { long init(StatusIndicatorSceneLayer caller);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java index 76b6b23f..1ebab3ce 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java
@@ -317,7 +317,7 @@ mActivity.getCompositorViewHolder().getResourceManager(), browserControlsSizer, mActivity.getStatusBarColorController()::getStatusBarColorWithoutStatusIndicator, mCanAnimateBrowserControls, layoutManager::requestUpdate); - layoutManager.setStatusIndicatorSceneOverlay(mStatusIndicatorCoordinator.getSceneLayer()); + layoutManager.addSceneOverlay(mStatusIndicatorCoordinator.getSceneLayer()); mStatusIndicatorObserver = new StatusIndicatorCoordinator.StatusIndicatorObserver() { @Override public void onStatusIndicatorHeightChanged(int indicatorHeight) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/SettableThemeColorProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/SettableThemeColorProvider.java new file mode 100644 index 0000000..d3beffcd --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/SettableThemeColorProvider.java
@@ -0,0 +1,31 @@ +// 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. + +package org.chromium.chrome.browser.toolbar; + +import android.content.Context; + +import org.chromium.chrome.browser.ThemeColorProvider; + +/** + * {@link ThemeColorProvider} that blindly tracks whatever primary color it's set to. + * It contains no actual tracking logic; to function properly, setPrimaryColor must be called each + * time the color changes. + */ +@Deprecated +class SettableThemeColorProvider extends ThemeColorProvider { + /** + * @param context The {@link Context} that is used to retrieve color related resources. + */ + public SettableThemeColorProvider(Context context) { + super(context); + } + + /** + * Sets the primary color to the specified value. + */ + public void setPrimaryColor(int color, boolean shouldAnimate) { + updatePrimaryColor(color, shouldAnimate); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java index 1bed46f..e52b89b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java
@@ -121,6 +121,7 @@ private final TabCountProvider mTabCountProvider; private final ThemeColorProvider mTabThemeColorProvider; private AppThemeColorProvider mAppThemeColorProvider; + private SettableThemeColorProvider mCustomTabThemeColorProvider; private final TopToolbarCoordinator mToolbar; private final ToolbarControlContainer mControlContainer; private final BrowserControlsStateProvider.Observer mBrowserControlsObserver; @@ -286,6 +287,7 @@ mAppThemeColorProvider = new AppThemeColorProvider(mActivity); // Observe tint changes to update sub-components that rely on the tint (crbug.com/1077684). mAppThemeColorProvider.addTintObserver(this); + mCustomTabThemeColorProvider = new SettableThemeColorProvider(mActivity); mActivityTabProvider = tabProvider; mToolbarTabController = new ToolbarTabControllerImpl(mLocationBarModel::getTab, @@ -309,7 +311,8 @@ -> setUrlBarFocus(focus, type), mActivity.getCompositorViewHolder()::requestFocus, shouldShowUpdateBadge, mActivity::isInOverviewMode, - mActivity.isCustomTab() ? mAppThemeColorProvider : browsingModeThemeColorProvider, + mActivity.isCustomTab() ? mCustomTabThemeColorProvider + : browsingModeThemeColorProvider, R.id.menu_button_wrapper); MenuButtonCoordinator startSurfaceMenuButtonCoordinator = new MenuButtonCoordinator( appMenuCoordinatorSupplier, mControlsVisibilityDelegate, mActivity, @@ -1038,6 +1041,11 @@ mCurrentThemeColor = color; mLocationBarModel.setPrimaryColor(color); mToolbar.onPrimaryColorChanged(shouldAnimate); + // TODO(https://crbug.com/865801, pnoland): Rationalize theme color logic + // into a set of documented, self-contained providers that we can inject to the appropriate + // sub-components. That will let us have every component handle its own coloring, and remove + // onThemeColorChanged from ToolbarManager. + mCustomTabThemeColorProvider.setPrimaryColor(color, shouldAnimate); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/bottom/BottomControlsViewBinder.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/bottom/BottomControlsViewBinder.java index 2e8ce71..3810ec5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/bottom/BottomControlsViewBinder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/bottom/BottomControlsViewBinder.java
@@ -56,8 +56,7 @@ new ScrollingBottomViewSceneLayer(view.root, view.root.getTopShadowHeight()); view.sceneLayer.setIsVisible( model.get(BottomControlsProperties.COMPOSITED_VIEW_VISIBLE)); - model.get(BottomControlsProperties.LAYOUT_MANAGER) - .addSceneOverlayToBack(view.sceneLayer); + model.get(BottomControlsProperties.LAYOUT_MANAGER).addSceneOverlay(view.sceneLayer); } else if (BottomControlsProperties.RESOURCE_MANAGER == propertyKey) { model.get(BottomControlsProperties.RESOURCE_MANAGER) .getDynamicResourceLoader()
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/menu_button/MenuButton.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/menu_button/MenuButton.java index c647d74..465c3910 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/menu_button/MenuButton.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/menu_button/MenuButton.java
@@ -274,6 +274,11 @@ drawable.draw(canvas); } + @VisibleForTesting + public boolean getUseLightDrawablesForTesting() { + return mUseLightDrawables; + } + @Override public void onTintChanged(ColorStateList tintList, boolean useLight) { ApiCompatibilityUtils.setImageTintList(mMenuImageButton, tintList);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java index 1fe259b..8980626a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java
@@ -15,11 +15,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.FlakyTest; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.TabTitleObserver; import org.chromium.content_public.browser.test.util.DOMUtils; import org.chromium.net.test.EmbeddedTestServer; @@ -33,8 +32,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class AudioTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mTestServer;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewFocusTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewFocusTest.java index dc3d3a7..a09572e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewFocusTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ContentViewFocusTest.java
@@ -22,12 +22,10 @@ import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.UrlUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.compositor.layouts.LayoutManager; import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandler; import org.chromium.chrome.browser.compositor.layouts.eventfilter.ScrollDirection; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; @@ -52,12 +50,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ContentViewFocusTest { @Rule - public ChromeTabbedActivityTestRule mChromeTabbedActivityTestRule = - new ChromeTabbedActivityTestRule(); - - @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final int WAIT_RESPONSE_MS = 2000; @@ -107,14 +100,14 @@ @Test @FlakyTest(message = "http://crbug.com/172473") public void testHideSelectionOnPhoneTabSwiping() throws Exception { - mChromeTabbedActivityTestRule.startMainActivityOnBlankPage(); + mActivityTestRule.startMainActivityOnBlankPage(); // Setup - ChromeTabUtils.newTabsFromMenu(InstrumentationRegistry.getInstrumentation(), - mChromeTabbedActivityTestRule.getActivity(), 2); + ChromeTabUtils.newTabsFromMenu( + InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity(), 2); String url = UrlUtils.getIsolatedTestFileUrl( "chrome/test/data/android/content_view_focus/content_view_focus_long_text.html"); - mChromeTabbedActivityTestRule.loadUrl(url); - View view = mChromeTabbedActivityTestRule.getActivity().getActivityTab().getContentView(); + mActivityTestRule.loadUrl(url); + View view = mActivityTestRule.getActivity().getActivityTab().getContentView(); // Give the content view focus TestTouchUtils.longClickView(InstrumentationRegistry.getInstrumentation(), view, 50, 10); @@ -122,16 +115,15 @@ // Start the swipe addFocusChangedListener(view); - final EdgeSwipeHandler edgeSwipeHandler = mChromeTabbedActivityTestRule.getActivity() - .getLayoutManager() - .getToolbarSwipeHandler(); + final EdgeSwipeHandler edgeSwipeHandler = + mActivityTestRule.getActivity().getLayoutManager().getToolbarSwipeHandler(); PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> { edgeSwipeHandler.swipeStarted(ScrollDirection.RIGHT, 0, 0); edgeSwipeHandler.swipeUpdated(100, 0, 100, 0, 100, 0); }); CriteriaHelper.pollUiThread(() -> { - LayoutManager driver = mChromeTabbedActivityTestRule.getActivity().getLayoutManager(); + LayoutManager driver = mActivityTestRule.getActivity().getLayoutManager(); return !driver.getActiveLayout().shouldDisplayContentOverlay(); }, "Layout still requesting Tab Android view be attached"); @@ -143,7 +135,7 @@ PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> edgeSwipeHandler.swipeFinished()); CriteriaHelper.pollUiThread(() -> { - LayoutManager driver = mChromeTabbedActivityTestRule.getActivity().getLayoutManager(); + LayoutManager driver = mActivityTestRule.getActivity().getLayoutManager(); return driver.getActiveLayout().shouldDisplayContentOverlay(); }, "Layout not requesting Tab Android view be attached"); @@ -163,22 +155,21 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @FlakyTest(message = "http://crbug.com/967128") public void testHideSelectionOnPhoneTabSwitcher() throws Exception { - mChromeTabbedActivityTestRule.startMainActivityOnBlankPage(); + mActivityTestRule.startMainActivityOnBlankPage(); // Setup OverviewModeBehaviorWatcher showWatcher = new OverviewModeBehaviorWatcher( - mChromeTabbedActivityTestRule.getActivity().getLayoutManager(), true, false); + mActivityTestRule.getActivity().getLayoutManager(), true, false); OverviewModeBehaviorWatcher hideWatcher = new OverviewModeBehaviorWatcher( - mChromeTabbedActivityTestRule.getActivity().getLayoutManager(), false, true); - View currentView = - mChromeTabbedActivityTestRule.getActivity().getActivityTab().getContentView(); + mActivityTestRule.getActivity().getLayoutManager(), false, true); + View currentView = mActivityTestRule.getActivity().getActivityTab().getContentView(); addFocusChangedListener(currentView); // Enter the tab switcher View tabSwitcherButton = - mChromeTabbedActivityTestRule.getActivity().findViewById(R.id.tab_switcher_button); + mActivityTestRule.getActivity().findViewById(R.id.tab_switcher_button); Assert.assertNotNull("'tab_switcher_button' view is not found.", tabSwitcherButton); TouchCommon.singleClickView( - mChromeTabbedActivityTestRule.getActivity().findViewById(R.id.tab_switcher_button)); + mActivityTestRule.getActivity().findViewById(R.id.tab_switcher_button)); showWatcher.waitForBehavior(); // Make sure the view loses focus. It is immediately given focus back @@ -186,11 +177,10 @@ Assert.assertFalse("Content view didn't lose focus", blockForFocusChanged()); // Hide the tab switcher - tabSwitcherButton = - mChromeTabbedActivityTestRule.getActivity().findViewById(R.id.tab_switcher_button); + tabSwitcherButton = mActivityTestRule.getActivity().findViewById(R.id.tab_switcher_button); Assert.assertNotNull("'tab_switcher_button' view is not found.", tabSwitcherButton); TouchCommon.singleClickView( - mChromeTabbedActivityTestRule.getActivity().findViewById(R.id.tab_switcher_button)); + mActivityTestRule.getActivity().findViewById(R.id.tab_switcher_button)); hideWatcher.waitForBehavior(); Assert.assertTrue("Content view didn't regain focus", blockForFocusChanged());
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ExampleUiCaptureTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ExampleUiCaptureTest.java index e2afa672..f9d3133 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ExampleUiCaptureTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ExampleUiCaptureTest.java
@@ -14,11 +14,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.test.ScreenShooter; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.ui.test.util.UiRestriction; /** @@ -29,8 +28,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // Tab switcher button only exists on phones. public class ExampleUiCaptureTest { @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public ScreenShooter mScreenShooter = new ScreenShooter();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/FeaturesAnnotationsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/FeaturesAnnotationsTest.java index e910688..d677b698 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/FeaturesAnnotationsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/FeaturesAnnotationsTest.java
@@ -16,10 +16,9 @@ import org.chromium.base.CommandLine; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -35,8 +34,7 @@ @CommandLineFlags.Add(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE) public class FeaturesAnnotationsTest { @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); /** * Tests that {@link EnableFeatures} and {@link DisableFeatures} can alter the flags registered @@ -47,7 +45,7 @@ @EnableFeatures("One") @DisableFeatures("Two") public void testFeaturesSetExistingFlags() throws InterruptedException { - mActivityRule.startMainActivityOnBlankPage(); + mActivityTestRule.startMainActivityOnBlankPage(); List<String> finalEnabledList = getFeatureList(true); assertThat(finalEnabledList, hasItems("One")); @@ -70,7 +68,7 @@ @CommandLineFlags.Add("enable-features=One,Two,Three") @EnableFeatures("Two") public void testFeaturesDoNotRemoveExistingFlags() throws InterruptedException { - mActivityRule.startMainActivityOnBlankPage(); + mActivityTestRule.startMainActivityOnBlankPage(); List<String> finalEnabledList = getFeatureList(true); assertThat(finalEnabledList, hasItems("One", "Two", "Three")); @@ -88,7 +86,7 @@ @CommandLineFlags.Add("enable-features=One,Two,Three") @EnableFeatures({"Three", "Four"}) public void testFeaturesAddToExistingFlags() throws InterruptedException { - mActivityRule.startMainActivityOnBlankPage(); + mActivityTestRule.startMainActivityOnBlankPage(); List<String> finalEnabledList = getFeatureList(true); assertThat(finalEnabledList, hasItems("Four"));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/FocusedEditableTextFieldZoomTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/FocusedEditableTextFieldZoomTest.java index 635cfbd5..f7294552 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/FocusedEditableTextFieldZoomTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/FocusedEditableTextFieldZoomTest.java
@@ -19,11 +19,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.Coordinates; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -40,8 +39,7 @@ }) public class FocusedEditableTextFieldZoomTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final int TEST_TIMEOUT = 5000; private static final String TEXTFIELD_DOM_ID = "textfield";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/HTTPSTabsOpenedFromExternalAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/HTTPSTabsOpenedFromExternalAppTest.java index 2b540bda..a04daf8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/HTTPSTabsOpenedFromExternalAppTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/HTTPSTabsOpenedFromExternalAppTest.java
@@ -17,10 +17,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.net.test.EmbeddedTestServer; import org.chromium.net.test.ServerCertificate; import org.chromium.network.mojom.ReferrerPolicy; @@ -33,8 +32,7 @@ public class HTTPSTabsOpenedFromExternalAppTest { @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mTestServer;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/InstalledAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/InstalledAppTest.java index 1c592d1a..962b88b7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/InstalledAppTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/InstalledAppTest.java
@@ -18,12 +18,11 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.net.test.EmbeddedTestServer; /** Test suite for navigator.getInstalledRelatedApps functionality. */ @@ -34,8 +33,7 @@ }) public class InstalledAppTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_FILE = "/content/test/data/android/installedapp.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/JavaScriptEvalChromeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/JavaScriptEvalChromeTest.java index b613c76..7e79f73 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/JavaScriptEvalChromeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/JavaScriptEvalChromeTest.java
@@ -17,12 +17,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.UrlUtils; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.content_public.browser.test.util.JavaScriptUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -36,8 +35,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class JavaScriptEvalChromeTest { @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/PopularUrlsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/PopularUrlsTest.java index 447b750..a7c81c7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/PopularUrlsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/PopularUrlsTest.java
@@ -19,12 +19,11 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Manual; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.ui.base.PageTransition; @@ -56,8 +55,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class PopularUrlsTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TAG = "PopularUrlsTest"; private static final String NEW_LINE = System.getProperty("line.separator");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java index 0ca97543..d736b98 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/PopupTest.java
@@ -20,13 +20,12 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.infobar.InfoBarContainer; import org.chromium.chrome.browser.infobar.InfoBarIdentifier; import org.chromium.chrome.browser.tabmodel.TabModelSelector; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.infobars.InfoBar; import org.chromium.components.safe_browsing.SafeBrowsingApiBridge; import org.chromium.content_public.browser.UiThreadTaskTraits; @@ -46,8 +45,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class PopupTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String POPUP_HTML_PATH = "/chrome/test/data/android/popup_test.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ProcessIsolationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ProcessIsolationTest.java index b63f28c..509728d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ProcessIsolationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ProcessIsolationTest.java
@@ -18,10 +18,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import java.io.BufferedReader; import java.io.IOException; @@ -36,8 +35,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ProcessIsolationTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); /** * Verifies that process isolation works, i.e., that the browser and
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ReachedCodeProfilerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ReachedCodeProfilerTest.java index d9601da1..51aa325f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ReachedCodeProfilerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ReachedCodeProfilerTest.java
@@ -15,13 +15,12 @@ import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.test.ReachedCodeProfiler; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; 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.SharedPreferencesManager; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -32,8 +31,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public final class ReachedCodeProfilerTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String FAKE_GROUP_NAME = "FakeGroup";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/SafeBrowsingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/SafeBrowsingTest.java index 46ac4b9..aea5774d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/SafeBrowsingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/SafeBrowsingTest.java
@@ -16,12 +16,11 @@ import org.junit.runner.RunWith; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.safe_browsing.SafeBrowsingApiBridge; import org.chromium.content_public.browser.LoadUrlParams; @@ -40,8 +39,7 @@ @Features.DisableFeatures({ChromeFeatureList.SAFE_BROWSING_DELAYED_WARNINGS}) public final class SafeBrowsingTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mTestServer; /**
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java index 3595dca..c3e3225 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/SelectFileDialogTest.java
@@ -23,10 +23,9 @@ import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.UrlUtils; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -42,8 +41,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class SelectFileDialogTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String DATA_URL = UrlUtils.encodeHtmlDataUri( "<html><head><meta name=\"viewport\""
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java index fe91500f5..536cc2a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/SmartClipProviderTest.java
@@ -32,8 +32,8 @@ import org.chromium.base.test.util.UrlUtils; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.Coordinates; import org.chromium.content_public.browser.test.util.DOMUtils; @@ -54,8 +54,7 @@ // interface. @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String MOUNTAIN = "Mountain";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java index 77103a8..74c4bf9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java
@@ -19,15 +19,14 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.SadTab; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tab.TabSelectionType; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ApplicationTestUtils; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -40,8 +39,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class TabTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private Tab mTab; private CallbackHelper mOnTitleUpdatedHelper;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabThemeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabThemeTest.java index 182a5fa9..b5c0262 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabThemeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabThemeTest.java
@@ -18,13 +18,12 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabThemeColorHelper; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.test.EmbeddedTestServer; import org.chromium.ui.test.util.UiRestriction; @@ -39,8 +38,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class TabThemeTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PAGE = "/chrome/test/data/android/simple.html"; private static final String THEMED_TEST_PAGE =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java index d5b6c01..95e1f10 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsOpenedFromExternalAppTest.java
@@ -28,12 +28,12 @@ import org.chromium.base.test.util.FlakyTest; import org.chromium.base.test.util.UrlUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelUtils; import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ApplicationTestUtils; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.browser.contextmenu.RevampedContextMenuUtils; @@ -56,8 +56,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class TabsOpenedFromExternalAppTest { @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); static final String HTTP_REFERRER = "http://chromium.org/";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/UrlSchemeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/UrlSchemeTest.java index ebb943a..360ee75 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/UrlSchemeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/UrlSchemeTest.java
@@ -23,10 +23,9 @@ import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.TestFileUtil; import org.chromium.base.test.util.UrlUtils; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.TestContentProvider; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.content_public.browser.test.util.Criteria; @@ -43,8 +42,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class UrlSchemeTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String SIMPLE_SRC = "simple.html"; private static final String SIMPLE_IMAGE = "google.png";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/app/appmenu/DataSaverAppMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/app/appmenu/DataSaverAppMenuTest.java index 07d571e0..a9c29a2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/app/appmenu/DataSaverAppMenuTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/app/appmenu/DataSaverAppMenuTest.java
@@ -15,12 +15,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.ui.appmenu.AppMenuTestSupport; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; /** @@ -31,8 +30,7 @@ @EnableFeatures("DataReductionProxyEnabledWithNetworkService") public class DataSaverAppMenuTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private TestDataReductionProxySettings mSettings;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java index 346e115..be04418 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java
@@ -38,8 +38,8 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -73,8 +73,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class AutofillPopupTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String FIRST_NAME = "John"; private static final String LAST_NAME = "Smith";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupWithKeyboardTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupWithKeyboardTest.java index ea9e43b..39f09f42 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupWithKeyboardTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupWithKeyboardTest.java
@@ -19,12 +19,11 @@ import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.UrlUtils; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.Criteria; @@ -44,8 +43,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class AutofillPopupWithKeyboardTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java index a44a15936..a43768e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java
@@ -19,8 +19,8 @@ import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.autofill.AutofillDelegate; import org.chromium.components.autofill.AutofillPopup; import org.chromium.components.autofill.AutofillSuggestion; @@ -42,8 +42,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class AutofillTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private AutofillPopup mAutofillPopup; private WindowAndroid mWindowAndroid;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillUpstreamTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillUpstreamTest.java index c327964..12ea6cf0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillUpstreamTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillUpstreamTest.java
@@ -17,12 +17,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Restriction; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.infobar.AutofillSaveCardInfoBar; import org.chromium.chrome.browser.sync.SyncTestRule; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.infobars.InfoBar; import org.chromium.components.infobars.InfoBarLayout; import org.chromium.content_public.browser.WebContents; @@ -52,8 +51,7 @@ public SyncTestRule mSyncTestRule = new SyncTestRule(); @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mServer;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/BackgroundSyncTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/BackgroundSyncTest.java index af998b8..c78c51b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/BackgroundSyncTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/BackgroundSyncTest.java
@@ -20,12 +20,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.AppHooks; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.background_sync.BackgroundSyncBackgroundTaskScheduler.BackgroundSyncTask; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.TabTitleObserver; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; import org.chromium.content_public.browser.test.NativeLibraryTestUtils; @@ -46,8 +45,8 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public final class BackgroundSyncTest { @Rule - public final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); // loadNativeLibraryNoBrowserProcess will access AccountManagerFacade, so we need // to mock AccountManagerFacade
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncTest.java index 15c8634e..1d2f3863 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/background_sync/PeriodicBackgroundSyncTest.java
@@ -20,14 +20,13 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.AppHooks; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.background_sync.BackgroundSyncBackgroundTaskScheduler.BackgroundSyncTask; import org.chromium.chrome.browser.engagement.SiteEngagementService; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.TabTitleObserver; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; import org.chromium.content_public.browser.test.NativeLibraryTestUtils; @@ -54,8 +53,8 @@ + "skip_permissions_check_for_testing/true"}) public final class PeriodicBackgroundSyncTest { @Rule - public final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); // loadNativeLibraryNoBrowserProcess will access AccountManagerFacade, so we need // to mock AccountManagerFacade
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedPromoRenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedPromoRenderTest.java index 6718afd..dd6bdfc9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedPromoRenderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedPromoRenderTest.java
@@ -25,11 +25,10 @@ import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.night_mode.ChromeNightModeTestUtils; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.BookmarkTestRule; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; @@ -54,8 +53,8 @@ private final AccountManagerTestRule mAccountManagerTestRule = new AccountManagerTestRule(mFakeProfileDataSource); - private final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + private final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); private final BookmarkTestRule mBookmarkTestRule = new BookmarkTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java index 665637d..645dc0d9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java
@@ -56,7 +56,6 @@ import org.chromium.base.test.util.Restriction; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeTabbedActivity; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkItem; import org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkModelObserver; import org.chromium.chrome.browser.bookmarks.BookmarkPromoHeader.PromoState; @@ -71,8 +70,8 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.ui.messages.snackbar.Snackbar; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ActivityUtils; import org.chromium.chrome.test.util.ApplicationTestUtils; import org.chromium.chrome.test.util.BookmarkTestUtil; @@ -108,8 +107,7 @@ public class BookmarkTest { // clang-format on @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public ChromeRenderTestRule mRenderTestRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OriginVerifierTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OriginVerifierTest.java index fed5d8e..6d370f2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OriginVerifierTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/OriginVerifierTest.java
@@ -19,15 +19,14 @@ import org.chromium.base.task.PostTask; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.browserservices.OriginVerifier.OriginVerificationListener; import org.chromium.chrome.browser.browsing_data.BrowsingDataBridge; import org.chromium.chrome.browser.browsing_data.BrowsingDataType; import org.chromium.chrome.browser.browsing_data.TimePeriod; import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.embedder_support.util.Origin; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.test.mock.MockWebContents; @@ -46,8 +45,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class OriginVerifierTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final long TIMEOUT_MS = 1000; private static final byte[] BYTE_ARRAY = new byte[] {(byte) 0xaa, (byte) 0xbb, (byte) 0xcc,
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPreferencesUiTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPreferencesUiTest.java index aab131ae..90ee59c3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPreferencesUiTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browserservices/permissiondelegation/TrustedWebActivityPreferencesUiTest.java
@@ -17,12 +17,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ChromeApplication; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.settings.SettingsActivity; import org.chromium.chrome.browser.site_settings.SiteSettingsTestUtils; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.settings.ChromeImageViewPreference; import org.chromium.components.browser_ui.settings.ExpandablePreferenceGroup; import org.chromium.components.browser_ui.site_settings.SingleCategorySettings; @@ -44,8 +43,7 @@ }) public class TrustedWebActivityPreferencesUiTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private String mPackage; private TrustedWebActivityPermissionManager mPermissionMananger;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataBridgeTest.java index 127c242..7db50d0e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataBridgeTest.java
@@ -25,7 +25,6 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.UserActionTester; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; @@ -36,8 +35,8 @@ import org.chromium.chrome.browser.webapps.TestFetchStorageCallback; import org.chromium.chrome.browser.webapps.WebappDataStorage; import org.chromium.chrome.browser.webapps.WebappRegistry; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.webapps.WebappTestHelper; import org.chromium.content_public.browser.NavigationController; @@ -59,8 +58,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class BrowsingDataBridgeTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private CallbackHelper mCallbackHelper; private BrowsingDataBridge.OnClearBrowsingDataListener mListener;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java index 995dd90..aececf56 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java
@@ -14,14 +14,13 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider; import org.chromium.chrome.browser.browsing_data.BrowsingDataBridge.OnClearBrowsingDataListener; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.webapps.TestFetchStorageCallback; import org.chromium.chrome.browser.webapps.WebappRegistry; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.webapps.WebappTestHelper; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -41,8 +40,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class BrowsingDataRemoverIntegrationTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws InterruptedException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataTest.java index 7ab4dc5..92f06d6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataTest.java
@@ -16,10 +16,9 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.JavaScriptUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.test.EmbeddedTestServer; @@ -40,8 +39,7 @@ private String mUrl; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws Exception {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentBasicTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentBasicTest.java index 5dab5d0..6fc157e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentBasicTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentBasicTest.java
@@ -24,14 +24,13 @@ import org.chromium.base.CollectionUtil; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.browsing_data.ClearBrowsingDataFragment.DialogOption; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.browser.sync.AndroidSyncSettings; import org.chromium.chrome.browser.sync.ProfileSyncService; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; import org.chromium.components.sync.ModelType; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -46,8 +45,8 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ClearBrowsingDataFragmentBasicTest { @Rule - public final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final SettingsActivityTestRule<ClearBrowsingDataFragmentBasic> mSettingsActivityTestRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentTest.java index bfa56314..5a8acde9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentTest.java
@@ -44,14 +44,13 @@ import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.browsing_data.ClearBrowsingDataFragment.DialogOption; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager; import org.chromium.chrome.browser.settings.SettingsActivity; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; import org.chromium.components.browser_ui.settings.SpinnerPreference; import org.chromium.content_public.browser.test.util.Criteria; @@ -68,8 +67,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ClearBrowsingDataFragmentTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public SettingsActivityTestRule<ClearBrowsingDataFragmentAdvanced> mSettingsActivityTestRule = new SettingsActivityTestRule<>(ClearBrowsingDataFragmentAdvanced.class);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/CompositorVisibilityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/CompositorVisibilityTest.java index 217fbc7..9181a1c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/CompositorVisibilityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/CompositorVisibilityTest.java
@@ -18,12 +18,10 @@ import org.junit.runner.RunWith; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.ChromeTabbedActivity; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.compositor.layouts.LayoutRenderHost; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.ui.resources.ResourceManager; /** @@ -33,8 +31,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class CompositorVisibilityTest { @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private CompositorView mCompositorView;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java index 7db5c5c..fce0cf4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -90,8 +90,8 @@ import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabModelUtils; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.chrome.test.util.ApplicationTestUtils; import org.chromium.chrome.test.util.ChromeTabUtils; @@ -147,8 +147,8 @@ @Batch(Batch.PER_CLASS) public class ContextualSearchManagerTest { @ClassRule - public static final ChromeActivityTestRule<ChromeActivity> sActivityTestRule = - new ChromeActivityTestRule(ChromeActivity.class); + public static final ChromeTabbedActivityTestRule sActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final BlankCTATabInitialStateRule mInitialStateRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java index f55ddb57..e133cfb6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTapEventTest.java
@@ -29,8 +29,8 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManager; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.embedder_support.view.ContentView; import org.chromium.content_public.browser.SelectionClient; @@ -55,8 +55,7 @@ ChromeFeatureList.CONTEXTUAL_SEARCH_TRANSLATIONS}) public class ContextualSearchTapEventTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public JniMocker mocker = new JniMocker();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java index ad830a0..b8e74e87 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -113,6 +113,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.test.ScreenShooter; +import org.chromium.chrome.browser.toolbar.menu_button.MenuButton; import org.chromium.chrome.browser.ui.appmenu.AppMenuCoordinator; import org.chromium.chrome.browser.ui.appmenu.AppMenuHandler; import org.chromium.chrome.browser.ui.appmenu.AppMenuTestSupport; @@ -808,6 +809,10 @@ assertEquals(ColorUtils.getDarkenedColorForStatusBar(expectedColor), mCustomTabActivityTestRule.getActivity().getWindow().getStatusBarColor()); } + + MenuButton menuButtonView = toolbarView.findViewById(R.id.menu_button_wrapper); + assertEquals(menuButtonView.getUseLightDrawablesForTesting(), + ColorUtils.shouldUseLightForegroundOnBackground(expectedColor)); } /** @@ -2143,6 +2148,9 @@ Assert.assertTrue("Night mode should be enabled on K+ with dark color scheme set.", cctActivity.getNightModeStateProvider().isInNightMode()); + + MenuButton menuButtonView = cctActivity.findViewById(R.id.menu_button_wrapper); + assertTrue(menuButtonView.getUseLightDrawablesForTesting()); } @Test @@ -2157,6 +2165,9 @@ Assert.assertNotNull(cctActivity.getNightModeStateProvider()); Assert.assertFalse(cctActivity.getNightModeStateProvider().isInNightMode()); + + MenuButton menuButtonView = cctActivity.findViewById(R.id.menu_button_wrapper); + assertFalse(menuButtonView.getUseLightDrawablesForTesting()); } private void addColorSchemeToIntent(Intent intent, int colorScheme) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java index 7f33fb1..4da9263 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java
@@ -26,7 +26,6 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.LaunchIntentDispatcher; import org.chromium.chrome.browser.customtabs.CustomTabDelegateFactory.CustomTabNavigationDelegate; import org.chromium.chrome.browser.flags.ChromeSwitches; @@ -34,8 +33,8 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabDelegateFactory; import org.chromium.chrome.browser.tab.TabTestUtils; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.external_intents.ExternalNavigationHandler.OverrideUrlLoadingResult; import org.chromium.components.external_intents.InterceptNavigationDelegateImpl; import org.chromium.content_public.browser.test.util.Criteria; @@ -57,8 +56,8 @@ public CustomTabActivityTestRule mActivityRule = new CustomTabActivityTestRule(); @Rule - public ChromeActivityTestRule mChromeActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mChromeActivityTestRule = + new ChromeTabbedActivityTestRule(); public EmbeddedTestServerRule mServerRule = new EmbeddedTestServerRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothChooserDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothChooserDialogTest.java index 6bca94b1..6b6eb0f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothChooserDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothChooserDialogTest.java
@@ -28,10 +28,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.components.location.LocationUtils; import org.chromium.components.security_state.ConnectionSecurityLevel; @@ -57,8 +56,8 @@ public static final String DEVICE_DIALOG_BATCH_NAME = "device_dialog"; @ClassRule - public static final ChromeActivityTestRule<ChromeActivity> sActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public static final ChromeTabbedActivityTestRule sActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final BlankCTATabInitialStateRule mInitialStateRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothScanningPermissionDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothScanningPermissionDialogTest.java index 29df6323..56434ad 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothScanningPermissionDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothScanningPermissionDialogTest.java
@@ -23,10 +23,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.browser.bluetooth_scanning.Event; @@ -43,8 +42,8 @@ @Batch(BluetoothChooserDialogTest.DEVICE_DIALOG_BATCH_NAME) public class BluetoothScanningPermissionDialogTest { @ClassRule - public static final ChromeActivityTestRule<ChromeActivity> sActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public static final ChromeTabbedActivityTestRule sActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final BlankCTATabInitialStateRule mInitialStateRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/ItemChooserDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/ItemChooserDialogTest.java index f53b866..d76e9104 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/ItemChooserDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/ItemChooserDialogTest.java
@@ -30,10 +30,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -49,8 +48,8 @@ @Batch(BluetoothChooserDialogTest.DEVICE_DIALOG_BATCH_NAME) public class ItemChooserDialogTest implements ItemChooserDialog.ItemSelectedCallback { @ClassRule - public static final ChromeActivityTestRule<ChromeActivity> sActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public static final ChromeTabbedActivityTestRule sActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final BlankCTATabInitialStateRule mInitialStateRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialogTest.java index 0a92bdd2..6183155 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/device_dialog/UsbChooserDialogTest.java
@@ -23,10 +23,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.browser.test.util.Criteria; @@ -43,8 +42,8 @@ @Batch(BluetoothChooserDialogTest.DEVICE_DIALOG_BATCH_NAME) public class UsbChooserDialogTest { @ClassRule - public static final ChromeActivityTestRule<ChromeActivity> sActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public static final ChromeTabbedActivityTestRule sActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final BlankCTATabInitialStateRule mInitialStateRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/CloseTabDirectActionHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/CloseTabDirectActionHandlerTest.java index a320e7c..f7fbcb87 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/CloseTabDirectActionHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/CloseTabDirectActionHandlerTest.java
@@ -22,14 +22,12 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.MinAndroidSdkLevel; -import org.chromium.chrome.browser.ChromeTabbedActivity; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tabmodel.TabModelSelector; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; import java.util.ArrayList; @@ -41,8 +39,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.N) public class CloseTabDirectActionHandlerTest { @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private TabModelSelector mSelector; private CloseTabDirectActionHandler mHandler;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/DirectActionsInActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/DirectActionsInActivityTest.java index 7ecd024..4a70c67 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/DirectActionsInActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/DirectActionsInActivityTest.java
@@ -27,11 +27,10 @@ import org.chromium.base.test.util.MetricsUtils.HistogramDelta; import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.base.test.util.UserActionTester; -import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; /** @@ -45,8 +44,7 @@ @TargetApi(24) // For java.util.function.Consumer. public class DirectActionsInActivityTest { @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public DirectActionTestRule mDirectActionRule = new DirectActionTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/MenuDirectActionHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/MenuDirectActionHandlerTest.java index 7dacc7f0..9d08ba7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/MenuDirectActionHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/directactions/MenuDirectActionHandlerTest.java
@@ -29,8 +29,8 @@ import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tabmodel.TabModelSelector; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -46,8 +46,7 @@ @MinAndroidSdkLevel(Build.VERSION_CODES.N) public class MenuDirectActionHandlerTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private MenuDirectActionHandler mHandler; private ChromeActivity mActivity;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTest.java index 1870f42..af9727f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutTest.java
@@ -13,6 +13,7 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.blink.mojom.ViewportFit; @@ -26,6 +27,7 @@ * Tests the display cutout. */ @RunWith(ChromeJUnit4ClassRunner.class) +@Batch(Batch.PER_CLASS) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) @MinAndroidSdkLevel(Build.VERSION_CODES.P) public class DisplayCutoutTest {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/document/LauncherActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/document/LauncherActivityTest.java index 58d0c83d..f17068b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/document/LauncherActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/document/LauncherActivityTest.java
@@ -28,8 +28,8 @@ import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -43,8 +43,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class LauncherActivityTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private Context mContext; private static final long DEVICE_STARTUP_TIMEOUT_MS = 15000L;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java index 814fa0a..809daa4b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java
@@ -18,13 +18,12 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.infobar.InfoBarContainer; import org.chromium.chrome.browser.infobar.InfoBarContainer.InfoBarContainerObserver; import org.chromium.chrome.browser.infobar.ReaderModeInfoBar; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.infobars.InfoBar; import org.chromium.content_public.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper; import org.chromium.content_public.browser.test.util.TestWebContentsObserver; @@ -40,8 +39,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class DistillabilityServiceTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PAGE = "/chrome/test/data/dom_distiller/simple_article.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ChromeDownloadDelegateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ChromeDownloadDelegateTest.java index e2c3c54..9ed36e1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ChromeDownloadDelegateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ChromeDownloadDelegateTest.java
@@ -14,11 +14,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; import java.util.concurrent.Callable; @@ -30,8 +29,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ChromeDownloadDelegateTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws InterruptedException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java index 77754a3..f3ac086c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java
@@ -79,9 +79,9 @@ } @Override - void startOrUpdateForegroundService(int notificationId, Notification notification) { - mUpdatedNotificationId = notificationId; - super.startOrUpdateForegroundService(notificationId, notification); + void startOrUpdateForegroundService(DownloadUpdate downloadUpdate) { + mUpdatedNotificationId = downloadUpdate.mNotificationId; + super.startOrUpdateForegroundService(downloadUpdate); } // Skip waiting for delayed runnable in tests.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewTest.java index 36dd97d..2071f50 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardViewTest.java
@@ -18,11 +18,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.embedder_support.util.UrlConstants; import java.util.ArrayList; @@ -74,8 +73,7 @@ } @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private Pair<ExploreSitesCategoryCardView, ExploreSitesCategory> initializeCategoryAndView( int numSitesTotal, int numBlocklisted) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java index 8044e19..725c06ac 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java
@@ -32,13 +32,12 @@ import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.night_mode.ChromeNightModeTestUtils; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.embedder_support.util.UrlConstants; @@ -80,8 +79,7 @@ } @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public ChromeRenderTestRule mRenderTestRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java index a2dd4ef..923f07c6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImplTest.java
@@ -17,12 +17,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.IntentHandler; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.instantapps.InstantAppsHandler; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.external_intents.ExternalNavigationHandler; import org.chromium.components.external_intents.ExternalNavigationParams; @@ -97,8 +96,7 @@ } @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Test @SmallTest
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java index 92d614c..0af7a88 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java
@@ -30,7 +30,6 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.document.ChromeLauncherActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.EmptyTabObserver; @@ -38,8 +37,8 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabCreationState; import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.external_intents.ExternalNavigationHandler.OverrideUrlLoadingResult; import org.chromium.components.external_intents.InterceptNavigationDelegateImpl; import org.chromium.content_public.browser.LoadUrlParams; @@ -62,8 +61,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class UrlOverridingTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String BASE_PATH = "/chrome/test/data/android/url_overriding/"; private static final String NAVIGATION_FROM_TIMEOUT_PAGE =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/feature_engagement/ScreenshotTabObserverTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/feature_engagement/ScreenshotTabObserverTest.java index d62a14ae6..accba6c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/feature_engagement/ScreenshotTabObserverTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/feature_engagement/ScreenshotTabObserverTest.java
@@ -16,11 +16,10 @@ import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.MetricsUtils; import org.chromium.base.test.util.UserActionTester; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; import java.util.List; @@ -32,8 +31,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ScreenshotTabObserverTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private Tab mTab; private ScreenshotTabObserver mObserver;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoCookieLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoCookieLeakageTest.java index dadc03e..ac12312 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoCookieLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoCookieLeakageTest.java
@@ -24,15 +24,14 @@ import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.ActivityType; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.TestParams; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -60,8 +59,8 @@ private static final String COOKIES_SETTING_PATH = "/chrome/test/data/android/cookie.html"; @Rule - public ChromeActivityTestRule<ChromeTabbedActivity> mChromeActivityTestRule = - new ChromeActivityTestRule<>(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mChromeActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDownloadLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDownloadLeakageTest.java index 3165a2c..ba82b9d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDownloadLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoDownloadLeakageTest.java
@@ -27,7 +27,6 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; -import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.download.DownloadItem; import org.chromium.chrome.browser.download.DownloadManagerService; @@ -38,8 +37,8 @@ import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.components.offline_items_collection.ContentId; import org.chromium.components.offline_items_collection.OfflineContentProvider; @@ -126,8 +125,8 @@ }; @Rule - public ChromeActivityTestRule<ChromeTabbedActivity> mChromeActivityTestRule = - new ChromeActivityTestRule<>(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mChromeActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); @@ -294,4 +293,4 @@ // No download entries should leak to/from an incognito CCT. assertEquals(0, mRegularDownloadItems.size()); } -} \ No newline at end of file +}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java index dd0cc45..9ea6e4d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoHistoryLeakageTest.java
@@ -24,7 +24,6 @@ import org.chromium.base.test.params.ParameterSet; import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; @@ -35,8 +34,8 @@ import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.TestParams; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.content_public.browser.NavigationEntry; import org.chromium.content_public.browser.NavigationHistory; @@ -66,8 +65,8 @@ private static final String TEST_PAGE_2 = "/chrome/test/data/android/test.html"; @Rule - public ChromeActivityTestRule<ChromeTabbedActivity> mChromeActivityTestRule = - new ChromeActivityTestRule<>(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mChromeActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java index 5569034..c770779 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoPermissionLeakageTest.java
@@ -34,15 +34,14 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.FlakyTest; import org.chromium.chrome.R; -import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.ActivityType; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.TestParams; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.chrome.test.util.browser.LocationSettingsTestUtil; import org.chromium.content_public.browser.test.util.Criteria; @@ -75,8 +74,8 @@ "/content/test/data/android/geolocation.html"; @Rule - public ChromeActivityTestRule<ChromeTabbedActivity> mChromeActivityTestRule = - new ChromeActivityTestRule<>(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mChromeActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule(); @@ -272,4 +271,4 @@ // Dialog is shown again in tab2 and the permission is therefore not leaked. assertDialogIsShown(); } -} \ No newline at end of file +}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java index d0533d4d..0d8452ef 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/incognito/IncognitoStorageLeakageTest.java
@@ -23,15 +23,14 @@ import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; -import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.ActivityType; import org.chromium.chrome.browser.incognito.IncognitoDataTestUtils.TestParams; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -64,8 +63,8 @@ "LocalStorage", "ServiceWorker", "CacheStorage", "IndexedDb", "FileSystem", "WebSql"); @Rule - public ChromeActivityTestRule<ChromeTabbedActivity> mChromeActivityTestRule = - new ChromeActivityTestRule<>(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mChromeActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarAppearanceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarAppearanceTest.java index 050b6a0d..873d4de 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarAppearanceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarAppearanceTest.java
@@ -16,14 +16,13 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabTestUtils; import org.chromium.chrome.browser.test.ScreenShooter; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.InfoBarTestAnimationListener; import org.chromium.components.infobars.InfoBar; import org.chromium.content_public.browser.NavigationHandle; @@ -43,8 +42,7 @@ // clang-format on @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public ScreenShooter mScreenShooter = new ScreenShooter();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarContainerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarContainerTest.java index e1ba8ac..0971418 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarContainerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarContainerTest.java
@@ -26,12 +26,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager; import org.chromium.chrome.browser.ui.messages.infobar.SimpleConfirmInfoBarBuilder; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.InfoBarTestAnimationListener; import org.chromium.chrome.test.util.InfoBarUtil; import org.chromium.components.infobars.InfoBar; @@ -53,8 +52,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class InfoBarContainerTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String MESSAGE_TEXT = "Ding dong. Woof. Translate french? Bears!";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java index ca5839a..e7d4f3a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java
@@ -27,15 +27,14 @@ import org.chromium.base.test.util.UrlUtils; import org.chromium.chrome.R; import org.chromium.chrome.browser.WebContentsFactory; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.datareduction.DataReductionPromoUtils; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.tab.SadTab; import org.chromium.chrome.browser.tab.TabTestUtils; import org.chromium.chrome.browser.tab.TabWebContentsDelegateAndroid; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.InfoBarTestAnimationListener; import org.chromium.chrome.test.util.InfoBarUtil; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -58,8 +57,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class InfoBarTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final long MAX_TIMEOUT = 2000L; private static final int CHECK_INTERVAL = 500;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java index b7f950b..e9218d6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/SearchGeolocationDisclosureInfoBarTest.java
@@ -20,11 +20,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.SearchGeolocationDisclosureTabHelper; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.InfoBarTestAnimationListener; import org.chromium.chrome.test.util.InfoBarUtil; import org.chromium.components.browser_ui.site_settings.PermissionInfo; @@ -44,8 +43,7 @@ private EmbeddedTestServer mTestServer; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws Exception {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectPopupOtherContentViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectPopupOtherContentViewTest.java index 70a0d39..4926b634 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectPopupOtherContentViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectPopupOtherContentViewTest.java
@@ -19,8 +19,8 @@ import org.chromium.chrome.browser.WebContentsFactory; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.embedder_support.view.ContentView; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -38,8 +38,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class SelectPopupOtherContentViewTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String SELECT_URL = UrlUtils.encodeHtmlDataUri( "<html><body>"
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/instantapps/InstantAppsHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/instantapps/InstantAppsHandlerTest.java index 8f13ac7c..a2b7a91 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/instantapps/InstantAppsHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/instantapps/InstantAppsHandlerTest.java
@@ -26,11 +26,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.IntentHandler; import org.chromium.chrome.browser.ShortcutHelper; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; /** @@ -40,8 +39,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class InstantAppsHandlerTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private TestInstantAppsHandler mHandler; private Context mContext;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandlerTest.java index 5b9b498..72c31e9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/login/ChromeHttpAuthHandlerTest.java
@@ -19,15 +19,13 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Restriction; -import org.chromium.chrome.browser.ChromeTabbedActivity; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.SadTab; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabLaunchType; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -44,8 +42,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ChromeHttpAuthHandlerTest { @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public CustomTabActivityTestRule mCustomTabActivityTestRule = new CustomTabActivityTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java index bab03d1..3acbb8a2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/router/MediaRouterIntegrationTest.java
@@ -24,10 +24,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.media_router.BrowserMediaRouter; import org.chromium.components.media_router.MockMediaRouteProvider; import org.chromium.content_public.browser.WebContents; @@ -53,8 +52,7 @@ ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class MediaRouterIntegrationTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PAGE = "/chrome/test/media_router/resources/basic_test.html?__is_android__=true";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/AutoplayMutedNotificationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/AutoplayMutedNotificationTest.java index e5cc6e3..e425632f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/AutoplayMutedNotificationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/AutoplayMutedNotificationTest.java
@@ -24,11 +24,10 @@ import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.media.MediaNotificationManager; import org.chromium.content_public.browser.test.util.DOMUtils; import org.chromium.content_public.browser.test.util.JavaScriptUtils; @@ -41,8 +40,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class AutoplayMutedNotificationTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PATH = "/content/test/data/media/session/autoplay-muted.html"; private static final String VIDEO_ID = "video";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/MediaSessionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/MediaSessionTest.java index 052a9685..fe9d313 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/MediaSessionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/MediaSessionTest.java
@@ -21,12 +21,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.FlakyTest; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.ntp.NewTabPage; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.NewTabPageTestUtils; import org.chromium.chrome.test.util.browser.TabLoadObserver; import org.chromium.components.browser_ui.media.MediaNotificationController; @@ -50,8 +49,7 @@ ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class MediaSessionTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PATH = "/content/test/data/media/session/media-session.html"; private static final String VIDEO_ID = "long-video";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/PageLoadMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/PageLoadMetricsTest.java index 745e257b..05987aca 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/PageLoadMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/PageLoadMetricsTest.java
@@ -17,10 +17,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.FlakyTest; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.test.EmbeddedTestServer; @@ -35,8 +34,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class PageLoadMetricsTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final int PAGE_LOAD_METRICS_TIMEOUT_MS = 3000; private static final String TEST_PAGE = "/chrome/test/data/android/google.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java index ed6189b3..e55d6542 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java
@@ -10,7 +10,6 @@ import androidx.test.filters.LargeTest; -import org.hamcrest.Matchers; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -23,21 +22,18 @@ import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisabledTest; import org.chromium.chrome.browser.ChromeTabbedActivity; -import org.chromium.chrome.browser.ShortcutHelper; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.webapps.WebApkActivityLifecycleUmaTracker; -import org.chromium.chrome.browser.webapps.WebappActivity; +import org.chromium.chrome.browser.webapps.WebApkActivityTestRule; import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ApplicationTestUtils; import org.chromium.chrome.test.util.ChromeTabUtils; -import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.test.EmbeddedTestServer; -import org.chromium.webapk.lib.common.WebApkConstants; /** * Tests for startup timing histograms. @@ -63,8 +59,7 @@ public ChromeTabbedActivityTestRule mTabbedActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule - public ChromeActivityTestRule<WebappActivity> mWebApkActivityTestRule = - new ChromeActivityTestRule<>(WebappActivity.class); + public WebApkActivityTestRule mWebApkActivityTestRule = new WebApkActivityTestRule(); private String mTestPage; private String mTestPage2; @@ -118,34 +113,14 @@ FIRST_CONTENTFUL_PAINT_HISTOGRAM + histogramSuffix)); } - private void startWebApkActivity(final String startUrl) { - Intent intent = - new Intent(InstrumentationRegistry.getTargetContext(), WebappActivity.class); - intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, "org.chromium.webapk.test"); - intent.putExtra(ShortcutHelper.EXTRA_URL, startUrl); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - - WebappActivity webApkActivity = - (WebappActivity) InstrumentationRegistry.getInstrumentation().startActivitySync( - intent); - mWebApkActivityTestRule.setActivity(webApkActivity); - InstrumentationRegistry.getInstrumentation().waitForIdleSync(); - - CriteriaHelper.pollInstrumentationThread(() -> { - Criteria.checkThat(mWebApkActivityTestRule.getActivity().getActivityTab(), - Matchers.notNullValue()); - }, 10000L, CriteriaHelper.DEFAULT_POLLING_INTERVAL); - ChromeTabUtils.waitForTabPageLoaded( - mWebApkActivityTestRule.getActivity().getActivityTab(), startUrl); - } - /** * Tests that the startup loading histograms are recorded only once on startup. */ @Test @LargeTest public void testWebApkStartRecorded() throws Exception { - runAndWaitForPageLoadMetricsRecorded(() -> startWebApkActivity(mTestPage)); + runAndWaitForPageLoadMetricsRecorded( + () -> mWebApkActivityTestRule.startWebApkActivity(mTestPage)); assertHistogramsRecorded(1, WEBAPK_SUFFIX); loadUrlAndWaitForPageLoadMetricsRecorded(mWebApkActivityTestRule, mTestPage2); assertHistogramsRecorded(1, WEBAPK_SUFFIX); @@ -215,7 +190,8 @@ @Test @LargeTest public void testWebApkErrorPageNotRecorded() throws Exception { - runAndWaitForPageLoadMetricsRecorded(() -> startWebApkActivity(mErrorPage)); + runAndWaitForPageLoadMetricsRecorded( + () -> mWebApkActivityTestRule.startWebApkActivity(mErrorPage)); assertHistogramsRecorded(0, WEBAPK_SUFFIX); loadUrlAndWaitForPageLoadMetricsRecorded(mWebApkActivityTestRule, mTestPage2); assertHistogramsRecorded(0, WEBAPK_SUFFIX);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageTest.java index 3194cb44..d1c6bfa 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageTest.java
@@ -28,11 +28,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.content_settings.CookieControlsMode; import org.chromium.components.content_settings.PrefNames; import org.chromium.components.prefs.PrefService; @@ -46,8 +45,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class IncognitoNewTabPageTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws Exception {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridgeTest.java index f09f13f..7c3115e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridgeTest.java
@@ -21,13 +21,12 @@ import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.MinAndroidSdkLevel; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.OfflinePageModelObserver; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.SavePageCallback; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.offlinepages.SavePageResult; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -44,8 +43,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class OfflinePageArchivePublisherBridgeTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PAGE = "/chrome/test/data/android/about.html"; private static final int TIMEOUT_MS = 5000;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageAutoFetchTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageAutoFetchTest.java index 9535592d..e04cd3b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageAutoFetchTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageAutoFetchTest.java
@@ -33,8 +33,8 @@ import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelUtils; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.content_public.browser.LoadUrlParams; @@ -62,8 +62,7 @@ private static final String TAG = "AutoFetchTest"; private static final long WAIT_TIMEOUT_MS = 20000; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public TestWatcher mTestWatcher = new TestWatcher() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeTest.java index 5a5ed5a..918a521 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridgeTest.java
@@ -22,15 +22,14 @@ import org.chromium.base.task.PostTask; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.OfflinePageModelObserver; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.SavePageCallback; import org.chromium.chrome.browser.offlinepages.downloads.OfflinePageDownloadBridge; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileKey; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.offlinepages.DeletePageResult; import org.chromium.components.offlinepages.SavePageResult; import org.chromium.content_public.browser.LoadUrlParams; @@ -60,8 +59,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class OfflinePageBridgeTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PAGE = "/chrome/test/data/android/about.html"; private static final int TIMEOUT_MS = 5000;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageRequestTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageRequestTest.java index 17597835..e60bdbd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageRequestTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageRequestTest.java
@@ -16,12 +16,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.SavePageCallback; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.offlinepages.SavePageResult; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.NetworkChangeNotifier; @@ -35,8 +34,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class OfflinePageRequestTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PAGE = "/chrome/test/data/android/test.html"; private static final String ABOUT_PAGE = "/chrome/test/data/android/about.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java index a22d804..b85c053b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageSavePageLaterEvaluationTest.java
@@ -25,13 +25,12 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Manual; import org.chromium.base.test.util.TimeoutScale; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.offlinepages.evaluation.OfflinePageEvaluationBridge; import org.chromium.chrome.browser.offlinepages.evaluation.OfflinePageEvaluationBridge.OfflinePageEvaluationObserver; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.offlinepages.BackgroundSavePageResult; import org.chromium.content_public.browser.UiThreadTaskTraits; @@ -67,8 +66,7 @@ */ @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); static class TimeDelta { public void setStartTime(Long startTime) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsTest.java index 89ed7ca..c21e78e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtilsTest.java
@@ -29,15 +29,14 @@ import org.chromium.base.test.util.MetricsUtils.HistogramDelta; import org.chromium.base.test.util.UrlUtils; import org.chromium.blink.mojom.MhtmlLoadResult; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.OfflinePageModelObserver; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge.SavePageCallback; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager.SnackbarController; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.share.ShareParams; import org.chromium.components.offlinepages.SavePageResult; import org.chromium.content_public.browser.UiThreadTaskTraits; @@ -57,8 +56,7 @@ Add({"enable-features=OfflinePagesSharing", ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class OfflinePageUtilsTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TAG = "OfflinePageUtilsTest"; private static final String TEST_PAGE = "/chrome/test/data/android/about.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/RequestCoordinatorBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/RequestCoordinatorBridgeTest.java index a4d3a0b..5c32ca75 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/RequestCoordinatorBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/RequestCoordinatorBridgeTest.java
@@ -15,11 +15,10 @@ import org.chromium.base.Callback; import org.chromium.base.task.PostTask; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.offlinepages.background.UpdateRequestResult; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -37,8 +36,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class RequestCoordinatorBridgeTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final int TIMEOUT_MS = 5000;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerTest.java index fd54f30c..249e1b8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerTest.java
@@ -30,8 +30,8 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager.SnackbarManageable; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ActivityUtils; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.MenuUtils; @@ -56,8 +56,7 @@ // TODO(jianli): Add test for disabled feature. public class OfflineIndicatorControllerTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PAGE = "/chrome/test/data/android/test.html"; private static final int TIMEOUT_MS = 5000;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFeedFlowTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFeedFlowTest.java index 1f2d8094..25f83f4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFeedFlowTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchFeedFlowTest.java
@@ -24,7 +24,6 @@ import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.UrlUtils; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.background_task_scheduler.ChromeNativeBackgroundTaskDelegate; import org.chromium.chrome.browser.download.items.OfflineContentAggregatorFactory; import org.chromium.chrome.browser.feed.FeedProcessScopeFactory; @@ -36,8 +35,8 @@ import org.chromium.chrome.browser.offlinepages.OfflinePageItem; import org.chromium.chrome.browser.offlinepages.OfflineTestUtil; import org.chromium.chrome.browser.profiles.ProfileKey; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ReducedModeNativeTestRule; import org.chromium.components.background_task_scheduler.TaskIds; import org.chromium.components.background_task_scheduler.TaskParameters; @@ -114,8 +113,7 @@ private static final int THUMBNAIL_HEIGHT = 4; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public ReducedModeNativeTestRule mReducedModeNativeTestRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/LocationBarLayoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/LocationBarLayoutTest.java index b29e57f6..51d8d02 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/LocationBarLayoutTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/LocationBarLayoutTest.java
@@ -37,13 +37,12 @@ import org.chromium.base.test.util.Matchers; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.toolbar.LocationBarModel; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.OmniboxTestUtils; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.components.embedder_support.util.UrlConstants; @@ -65,8 +64,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class LocationBarLayoutTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String SEARCH_TERMS = "machine learning"; private static final String SEARCH_TERMS_URL = "testing.com";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxTest.java index a0bb915..d9f77ea 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxTest.java
@@ -27,7 +27,6 @@ import org.chromium.base.test.util.EnormousTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.omnibox.status.StatusCoordinator; @@ -37,8 +36,8 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.OmniboxTestUtils; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; @@ -65,8 +64,7 @@ @SuppressLint("SetTextI18n") public class OmniboxTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private void clearUrlBar() { final UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarIntegrationTest.java index fcbd3e8..3ea97bf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarIntegrationTest.java
@@ -26,11 +26,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.OmniboxTestUtils; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.content_public.browser.test.util.Criteria; @@ -58,8 +57,7 @@ "data:text/plain,H" + new String(new char[9000]).replace('\0', 'u') + "ge!"; @Rule - public ChromeActivityTestRule<ChromeTabbedActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private UrlBar getUrlBar() { return (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java index 43d5e225..1bff83e8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderTest.java
@@ -19,12 +19,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.site_settings.PermissionInfo; import org.chromium.components.content_settings.ContentSettingValues; import org.chromium.components.content_settings.ContentSettingsType; @@ -37,8 +36,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class GeolocationHeaderTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String SEARCH_URL_1 = "https://www.google.com/search?q=potatoes"; private static final String SEARCH_URL_2 = "https://www.google.co.jp/webhp?#q=dinosaurs";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/voice/VoiceRecognitionHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/voice/VoiceRecognitionHandlerTest.java index 4dcdf5a..00c86c4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/voice/VoiceRecognitionHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/voice/VoiceRecognitionHandlerTest.java
@@ -32,7 +32,6 @@ import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.ntp.NewTabPage; import org.chromium.chrome.browser.omnibox.UrlBarData; @@ -49,8 +48,8 @@ import org.chromium.chrome.browser.tab.MockTab; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.OmniboxTestUtils.SuggestionsResult; import org.chromium.chrome.test.util.OmniboxTestUtils.TestAutocompleteController; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -75,8 +74,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class VoiceRecognitionHandlerTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Mock Intent mIntent;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/ConnectionInfoViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/ConnectionInfoViewTest.java index 4ff4f28..8691b9a0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/ConnectionInfoViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/ConnectionInfoViewTest.java
@@ -15,8 +15,8 @@ import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.vr.VrModuleProvider; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.page_info.ConnectionInfoView; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -28,8 +28,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ConnectionInfoViewTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); /** * Tests that ConnectionInfoView can be instantiated and shown.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/CookieControlsViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/CookieControlsViewTest.java index 5277116..230a93d4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/CookieControlsViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/CookieControlsViewTest.java
@@ -30,11 +30,10 @@ import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.FlakyTest; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.content_settings.CookieControlsMode; import org.chromium.components.page_info.PageInfoAction; import org.chromium.components.page_info.R; @@ -52,8 +51,7 @@ ContentSwitches.HOST_RESOLVER_RULES + "=MAP * 127.0.0.1"}) public class CookieControlsViewTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @ClassRule public static DisableAnimationsTestRule disableAnimationsRule = new DisableAnimationsTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java index 8878341..78fea73 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoControllerTest.java
@@ -21,8 +21,8 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.components.page_info.PageInfoController; import org.chromium.components.page_info.PageInfoFeatureList; @@ -41,8 +41,7 @@ ContentSwitches.HOST_RESOLVER_RULES + "=MAP * 127.0.0.1"}) public class PageInfoControllerTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mTestServer;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java index 63fa79e1..f5087796 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java
@@ -36,12 +36,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge; import org.chromium.components.content_settings.ContentSettingValues; @@ -77,8 +76,7 @@ "CacheStorage", "IndexedDb", "FileSystem", "WebSql"}; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public EmbeddedTestServerRule mTestServerRule = new EmbeddedTestServerRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/paint_preview/services/PaintPreviewTabServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/paint_preview/services/PaintPreviewTabServiceTest.java index 1d0dfd6..856f862 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/paint_preview/services/PaintPreviewTabServiceTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/paint_preview/services/PaintPreviewTabServiceTest.java
@@ -19,13 +19,12 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.ScalableTimeout; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelSelector; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -42,8 +41,8 @@ private static final long POLLING_INTERVAL_MS = ScalableTimeout.scaleTimeout(500); @Rule - public final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public TemporaryFolder mTemporaryFolder = new TemporaryFolder();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/PasswordGenerationDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/PasswordGenerationDialogTest.java index 6ff28e9..f65e01f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/PasswordGenerationDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/PasswordGenerationDialogTest.java
@@ -26,10 +26,9 @@ import org.chromium.base.Callback; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; @RunWith(ChromeJUnit4ClassRunner.class) @@ -43,8 +42,7 @@ private Callback<Boolean> mOnPasswordAcceptedOrRejectedCallback; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public MockitoRule mMockitoRule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/PasswordManagerDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/PasswordManagerDialogTest.java index de7ff10..790b47b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/PasswordManagerDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/password_manager/PasswordManagerDialogTest.java
@@ -33,8 +33,8 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.modaldialog.DialogDismissalCause; @@ -57,8 +57,7 @@ private Callback<Integer> mOnClick; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public MockitoRule mMockitoRule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFinderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFinderTest.java index 09a28db..8fc88fc 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFinderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFinderTest.java
@@ -18,10 +18,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.payments.PaymentApp; import org.chromium.components.payments.PaymentAppFactoryParams; @@ -57,8 +56,7 @@ public class AndroidPaymentAppFinderTest implements PaymentAppFactoryDelegate, PaymentAppFactoryParams { @Rule - public ChromeActivityTestRule<ChromeActivity> mRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); /** Simulates a package manager in memory. */ private final MockPackageManagerDelegate mPackageManager = new MockPackageManagerDelegate(); @@ -143,7 +141,7 @@ // PaymentAppFactoryParams implementation. @Override public WebContents getWebContents() { - return mRule.getActivity().getCurrentWebContents(); + return mActivityTestRule.getActivity().getCurrentWebContents(); } // PaymentAppFactoryParams implementation. @@ -203,12 +201,12 @@ @Override @Nullable public String getTwaPackageName() { - return mTwaPackageManager.getTwaPackageName(mRule.getActivity()); + return mTwaPackageManager.getTwaPackageName(mActivityTestRule.getActivity()); } @Before public void setUp() throws Throwable { - mRule.startMainActivityOnBlankPage(); + mActivityTestRule.startMainActivityOnBlankPage(); mPackageManager.reset(); mServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); mDownloader.setTestServerUrl(new GURL(mServer.getURL("/components/test/data/payments/"))); @@ -1548,7 +1546,7 @@ private void addAppStoreMethodAndFindApps(String appStorePackageName, GURL appStorePaymentMethod, Set<String> methodNames) throws Throwable { mMethodData = buildMethodData(methodNames); - mRule.runOnUiThread(() -> { + mActivityTestRule.runOnUiThread(() -> { AndroidPaymentAppFinder finder = new AndroidPaymentAppFinder(new PaymentManifestWebDataService(), mDownloader, new PaymentManifestParser(), mPackageManager, mTwaPackageManager,
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/IsReadyToPayServiceHelperTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/IsReadyToPayServiceHelperTest.java index 3040bc2..46b924f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/IsReadyToPayServiceHelperTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/IsReadyToPayServiceHelperTest.java
@@ -30,10 +30,9 @@ import org.chromium.IsReadyToPayServiceCallback; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.payments.intent.IsReadyToPayServiceHelper; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -44,8 +43,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class IsReadyToPayServiceHelperTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public ExpectedException thrown = ExpectedException.none(); @@ -196,7 +194,7 @@ @Feature({"Payments"}) public void onResponseTest() throws Throwable { mResponseReceived = false; - mRule.runOnUiThread(() -> { + mActivityTestRule.runOnUiThread(() -> { Intent intent = new Intent(); intent.setClassName("mock.package.name", "mock.service.name"); Context context = createContext(createAlwaysReadyService()); @@ -221,7 +219,7 @@ @Feature({"Payments"}) public void unresponsiveServiceTest() throws Throwable { mErrorReceived = false; - mRule.runOnUiThread(() -> { + mActivityTestRule.runOnUiThread(() -> { Intent intent = new Intent(); intent.setClassName("mock.package.name", "mock.service.name"); Context context = createContext(createUnresponsiveService()); @@ -246,7 +244,7 @@ @Feature({"Payments"}) public void noServiceTest() throws Throwable { mErrorReceived = false; - mRule.runOnUiThread(() -> { + mActivityTestRule.runOnUiThread(() -> { Intent intent = new Intent(); intent.setClassName("mock.package.name", "mock.service.name"); Context context = createContext(/*serviceBinder=*/null); @@ -271,7 +269,7 @@ @Feature({"Payments"}) public void serviceConnectionTimeoutTest() throws Throwable { mErrorReceived = false; - mRule.runOnUiThread(() -> { + mActivityTestRule.runOnUiThread(() -> { Intent intent = new Intent(); intent.setClassName("mock.package.name", "mock.service.name"); Context context = createContextThatNeverConnectToService();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentDetailsUpdateServiceHelperTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentDetailsUpdateServiceHelperTest.java index a78c2e3f..0ccd624 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentDetailsUpdateServiceHelperTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentDetailsUpdateServiceHelperTest.java
@@ -24,10 +24,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.components.payments.Address; import org.chromium.components.payments.ErrorStrings; @@ -58,8 +57,7 @@ private static final int DECODER_STARTUP_TIMEOUT_IN_MS = 10000; @Rule - public ChromeActivityTestRule<ChromeActivity> mRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public ExpectedException thrown = ExpectedException.none(); @@ -108,8 +106,8 @@ @Before public void setUp() throws Throwable { - mRule.startMainActivityOnBlankPage(); - mContext = mRule.getActivity(); + mActivityTestRule.startMainActivityOnBlankPage(); + mContext = mActivityTestRule.getActivity(); } private void installPaymentApp() { @@ -121,7 +119,7 @@ private void installAndInvokePaymentApp() throws Throwable { installPaymentApp(); - mRule.runOnUiThread(() -> { + mActivityTestRule.runOnUiThread(() -> { PaymentDetailsUpdateServiceHelper.getInstance().initialize( mPackageManager, /*packageName=*/"com.bobpay", mUpdateListener); });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentManifestDownloaderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentManifestDownloaderTest.java index aec04e5c4..154ead19 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentManifestDownloaderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentManifestDownloaderTest.java
@@ -18,10 +18,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.payments.PaymentManifestDownloader; import org.chromium.components.payments.PaymentManifestDownloader.ManifestDownloadCallback; import org.chromium.content_public.browser.test.util.Criteria; @@ -36,8 +35,7 @@ @MediumTest public class PaymentManifestDownloaderTest implements ManifestDownloadCallback { @Rule - public ChromeActivityTestRule<ChromeActivity> mRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String EXPECTED_PAYMENT_METHOD_MANIFEST = "{\n" + " \"default_applications\": [\"https://bobpay.com/app.json\"]\n" @@ -98,10 +96,10 @@ @Before public void setUp() throws Throwable { - mRule.startMainActivityOnBlankPage(); + mActivityTestRule.startMainActivityOnBlankPage(); mServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); - mRule.runOnUiThread((Runnable) () -> { - mDownloader.initialize(mRule.getActivity().getCurrentWebContents()); + mActivityTestRule.runOnUiThread((Runnable) () -> { + mDownloader.initialize(mActivityTestRule.getActivity().getCurrentWebContents()); mTestOrigin = PaymentManifestDownloader.createOpaqueOriginForTest(); }); mDownloadComplete = false; @@ -115,7 +113,7 @@ @After public void tearDown() throws Throwable { - mRule.runOnUiThread((Runnable) () -> mDownloader.destroy()); + mActivityTestRule.runOnUiThread((Runnable) () -> mDownloader.destroy()); mServer.stopAndDestroyServer(); } @@ -124,9 +122,9 @@ public void testDownloadWebAppManifest() throws Throwable { final GURL url = new GURL(mServer.getURL("/components/test/data/payments/bobpay.com/app.json")); - mRule.runOnUiThread((Runnable) () - -> mDownloader.downloadWebAppManifest( - mTestOrigin, url, PaymentManifestDownloaderTest.this)); + mActivityTestRule.runOnUiThread((Runnable) () + -> mDownloader.downloadWebAppManifest(mTestOrigin, + url, PaymentManifestDownloaderTest.this)); CriteriaHelper.pollInstrumentationThread(() -> mDownloadComplete); Assert.assertTrue( @@ -138,9 +136,9 @@ @Feature({"Payments"}) public void testUnableToDownloadWebAppManifest() throws Throwable { final GURL url = new GURL(mServer.getURL("/no-such-app.json")); - mRule.runOnUiThread((Runnable) () - -> mDownloader.downloadWebAppManifest( - mTestOrigin, url, PaymentManifestDownloaderTest.this)); + mActivityTestRule.runOnUiThread((Runnable) () + -> mDownloader.downloadWebAppManifest(mTestOrigin, + url, PaymentManifestDownloaderTest.this)); CriteriaHelper.pollInstrumentationThread(() -> mDownloadComplete); Assert.assertTrue("Web app manifest should not have been downloaded.", mDownloadFailure); @@ -153,9 +151,10 @@ public void testDownloadPaymentMethodManifest() throws Throwable { final GURL url = new GURL(mServer.getURL("/components/test/data/payments/bobpay.com/webpay")); - mRule.runOnUiThread((Runnable) () - -> mDownloader.downloadPaymentMethodManifest( - mTestOrigin, url, PaymentManifestDownloaderTest.this)); + mActivityTestRule.runOnUiThread( + (Runnable) () + -> mDownloader.downloadPaymentMethodManifest( + mTestOrigin, url, PaymentManifestDownloaderTest.this)); CriteriaHelper.pollInstrumentationThread(() -> mDownloadComplete); Assert.assertTrue("Payment method manifest should have been downloaded.", @@ -167,9 +166,10 @@ @Feature({"Payments"}) public void testUnableToDownloadPaymentMethodManifest() throws Throwable { final GURL url = new GURL(mServer.getURL("/no-such-payment-method-name")); - mRule.runOnUiThread((Runnable) () - -> mDownloader.downloadPaymentMethodManifest( - mTestOrigin, url, PaymentManifestDownloaderTest.this)); + mActivityTestRule.runOnUiThread( + (Runnable) () + -> mDownloader.downloadPaymentMethodManifest( + mTestOrigin, url, PaymentManifestDownloaderTest.this)); CriteriaHelper.pollInstrumentationThread(() -> mDownloadComplete); Assert.assertTrue( @@ -187,7 +187,7 @@ final GURL webAppUri1 = new GURL(mServer.getURL("/no-such-app.json")); final GURL webAppUri2 = new GURL(mServer.getURL("/components/test/data/payments/bobpay.com/app.json")); - mRule.runOnUiThread((Runnable) () -> { + mActivityTestRule.runOnUiThread((Runnable) () -> { mDownloader.downloadPaymentMethodManifest( mTestOrigin, paymentMethodUri1, PaymentManifestDownloaderTest.this); mDownloader.downloadPaymentMethodManifest(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentManifestParserTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentManifestParserTest.java index 66bd1104..104c43d6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentManifestParserTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentManifestParserTest.java
@@ -15,10 +15,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.payments.PaymentManifestParser; import org.chromium.components.payments.PaymentManifestParser.ManifestParseCallback; import org.chromium.components.payments.WebAppManifestSection; @@ -30,8 +29,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class PaymentManifestParserTest implements ManifestParseCallback { @Rule - public ChromeActivityTestRule<ChromeActivity> mRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private final PaymentManifestParser mParser = new PaymentManifestParser(); private GURL[] mWebAppManifestUris; @@ -62,8 +60,9 @@ @Before public void setUp() throws Throwable { - mRule.startMainActivityOnBlankPage(); - mRule.runOnUiThread((Runnable) () -> mParser.createNative(mRule.getWebContents())); + mActivityTestRule.startMainActivityOnBlankPage(); + mActivityTestRule.runOnUiThread( + (Runnable) () -> mParser.createNative(mActivityTestRule.getWebContents())); mWebAppManifestUris = null; mSupportedOrigins = null; mWebAppManifest = null; @@ -74,14 +73,14 @@ @After public void tearDown() throws Throwable { - mRule.runOnUiThread((Runnable) () -> mParser.destroyNative()); + mActivityTestRule.runOnUiThread((Runnable) () -> mParser.destroyNative()); } @Test @MediumTest @Feature({"Payments"}) public void testParseInvalidPaymentMethodManifest() throws Throwable { - mRule.runOnUiThread( + mActivityTestRule.runOnUiThread( (Runnable) () -> mParser.parsePaymentMethodManifest( new GURL("https://chromium.org/pmm.json"), @@ -93,20 +92,21 @@ @MediumTest @Feature({"Payments"}) public void testParsePaymentMethodManifest() throws Throwable { - mRule.runOnUiThread((Runnable) () - -> mParser.parsePaymentMethodManifest( - new GURL("https://bobpay.com/pmm.json"), - "{" - + " \"default_applications\": [" - + " \"https://bobpay.com/app.json\"," - + " \"https://alicepay.com/app.json\"" - + " ]," - + " \"supported_origins\": [" - + " \"https://charliepay.com\"," - + " \"https://evepay.com\"" - + " ]" - + "}", - PaymentManifestParserTest.this)); + mActivityTestRule.runOnUiThread( + (Runnable) () + -> mParser.parsePaymentMethodManifest( + new GURL("https://bobpay.com/pmm.json"), + "{" + + " \"default_applications\": [" + + " \"https://bobpay.com/app.json\"," + + " \"https://alicepay.com/app.json\"" + + " ]," + + " \"supported_origins\": [" + + " \"https://charliepay.com\"," + + " \"https://evepay.com\"" + + " ]" + + "}", + PaymentManifestParserTest.this)); CriteriaHelper.pollInstrumentationThread(() -> mParsePaymentMethodManifestSuccess); Assert.assertNotNull(mWebAppManifestUris); Assert.assertEquals(2, mWebAppManifestUris.length); @@ -123,7 +123,7 @@ @Feature({"Payments"}) public void testParsePaymentMethodManifestSupportedOriginsWildcardNotSupported() throws Throwable { - mRule.runOnUiThread( + mActivityTestRule.runOnUiThread( (Runnable) () -> mParser.parsePaymentMethodManifest( new GURL("https://bobpay.com/pmm.json"), @@ -136,8 +136,10 @@ @MediumTest @Feature({"Payments"}) public void testParseInvalidWebAppManifest() throws Throwable { - mRule.runOnUiThread((Runnable) () -> mParser.parseWebAppManifest( - "invalid web app manifest", PaymentManifestParserTest.this)); + mActivityTestRule.runOnUiThread( + (Runnable) () + -> mParser.parseWebAppManifest( + "invalid web app manifest", PaymentManifestParserTest.this)); CriteriaHelper.pollInstrumentationThread(() -> mParseFailure); } @@ -145,21 +147,23 @@ @MediumTest @Feature({"Payments"}) public void testParseWebAppManifest() throws Throwable { - mRule.runOnUiThread((Runnable) () -> mParser.parseWebAppManifest("{" - + " \"related_applications\": [{" - + " \"platform\": \"play\", " - + " \"id\": \"com.bobpay.app\", " - + " \"min_version\": \"1\", " - + " \"fingerprints\": [{" - + " \"type\": \"sha256_cert\", " - + " \"value\": \"" - + "00:01:02:03:04:05:06:07:08:09:" - + "A0:A1:A2:A3:A4:A5:A6:A7:A8:A9:" - + "B0:B1:B2:B3:B4:B5:B6:B7:B8:B9:C0:C1\"" - + " }]" - + " }]" - + "}", - PaymentManifestParserTest.this)); + mActivityTestRule.runOnUiThread( + (Runnable) () + -> mParser.parseWebAppManifest("{" + + " \"related_applications\": [{" + + " \"platform\": \"play\", " + + " \"id\": \"com.bobpay.app\", " + + " \"min_version\": \"1\", " + + " \"fingerprints\": [{" + + " \"type\": \"sha256_cert\", " + + " \"value\": \"" + + "00:01:02:03:04:05:06:07:08:09:" + + "A0:A1:A2:A3:A4:A5:A6:A7:A8:A9:" + + "B0:B1:B2:B3:B4:B5:B6:B7:B8:B9:C0:C1\"" + + " }]" + + " }]" + + "}", + PaymentManifestParserTest.this)); CriteriaHelper.pollInstrumentationThread(() -> mParseWebAppManifestSuccess); Assert.assertNotNull(mWebAppManifest); Assert.assertEquals(1, mWebAppManifest.length);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/SkipToGPayHelperTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/SkipToGPayHelperTest.java index cf840e5..e08a369 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/SkipToGPayHelperTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/SkipToGPayHelperTest.java
@@ -15,13 +15,12 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.autofill.AutofillTestHelper; import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.payments.MethodStrings; import org.chromium.components.payments.PaymentFeatureList; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -36,8 +35,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public final class SkipToGPayHelperTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); // A test PaymentMethodData[] shared by all test instances. private PaymentMethodData[] mTestMethodData; @@ -45,7 +43,7 @@ @Before public void setUp() { - mRule.startMainActivityOnBlankPage(); + mActivityTestRule.startMainActivityOnBlankPage(); mHelper = new AutofillTestHelper(); // Set up a test PaymentMethodData that requests "basic-card". @@ -74,7 +72,7 @@ TestThreadUtils.runOnUiThreadBlocking(() -> { Assert.assertEquals(expected, SkipToGPayHelperUtil.canActivateExperiment( - mRule.getWebContents(), mTestMethodData)); + mActivityTestRule.getWebContents(), mTestMethodData)); }); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/policy/CombinedPolicyProviderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/policy/CombinedPolicyProviderTest.java index 52308a02..f520c2f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/policy/CombinedPolicyProviderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/policy/CombinedPolicyProviderTest.java
@@ -14,11 +14,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tabmodel.TabModel; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.policy.CombinedPolicyProvider; import org.chromium.components.policy.PolicyProvider; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -28,8 +27,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class CombinedPolicyProviderTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String DATA_URI = "data:text/plain;charset=utf-8;base64,dGVzdA==";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java index 9974704..2b7d76b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java
@@ -47,8 +47,8 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.webapps.WebappTestPage; import org.chromium.components.location.LocationUtils; import org.chromium.components.permissions.PermissionDialogController; @@ -74,8 +74,7 @@ "enable-blink-features=OverscrollCustomization"}) public class PortalsTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mTestServer;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java index b002fbf..a9065f8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/printing/PrintingControllerTest.java
@@ -26,12 +26,11 @@ import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.TestFileUtil; import org.chromium.base.test.util.UrlUtils; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelUtils; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.printing.PrintDocumentAdapterWrapper.LayoutResultCallbackWrapper; import org.chromium.printing.PrintDocumentAdapterWrapper.WriteResultCallbackWrapper; @@ -55,8 +54,8 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class PrintingControllerTest { @Rule - public final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); private static final String TEMP_FILE_NAME = "temp_print"; private static final String TEMP_FILE_EXTENSION = ".pdf";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchActivityTest.java index a2160ed8..1fa41368 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/searchwidget/SearchActivityTest.java
@@ -67,8 +67,8 @@ import org.chromium.chrome.browser.searchwidget.SearchActivity.SearchActivityDelegate; import org.chromium.chrome.browser.share.clipboard.ClipboardImageFileProvider; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.MultiActivityTestRule; import org.chromium.chrome.test.util.ActivityUtils; import org.chromium.chrome.test.util.OmniboxTestUtils; @@ -181,8 +181,7 @@ public MultiActivityTestRule mTestRule = new MultiActivityTestRule(); @Rule - public ChromeActivityTestRule<ChromeTabbedActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Mock VoiceRecognitionHandler mHandler;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/shape_detection/ShapeDetectionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/shape_detection/ShapeDetectionTest.java index e0cd103d..eab68ea 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/shape_detection/ShapeDetectionTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/shape_detection/ShapeDetectionTest.java
@@ -17,11 +17,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeRestriction; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.browser.TabTitleObserver; @@ -39,8 +38,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ShapeDetectionTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String BARCODE_TEST_EXPECTED_TAB_TITLE = "https://chromium.org"; private static final String TEXT_TEST_EXPECTED_TAB_TITLE =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareDelegateImplIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareDelegateImplIntegrationTest.java index 176f8f5..c5db0000c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareDelegateImplIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareDelegateImplIntegrationTest.java
@@ -19,13 +19,12 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.MetricsUtils.HistogramDelta; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.share.ShareDelegateImpl.ShareSheetDelegate; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.share.ShareParams; import org.chromium.components.ui_metrics.CanonicalURLResult; @@ -50,8 +49,7 @@ "/chrome/test/data/android/share/link_share_no_canonical.html"; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws InterruptedException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetRenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetRenderTest.java index 710204b..b3f61b6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetRenderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetRenderTest.java
@@ -37,15 +37,14 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.incognito.interstitial.IncognitoInterstitialDelegate; import org.chromium.chrome.browser.night_mode.ChromeNightModeTestUtils; import org.chromium.chrome.browser.signin.account_picker.AccountPickerBottomSheetCoordinator; import org.chromium.chrome.browser.signin.account_picker.AccountPickerDelegate; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ApplicationTestUtils; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; @@ -88,8 +87,8 @@ new AccountManagerTestRule(new FakeProfileDataSource()); @Rule - public final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); @Mock private AccountPickerDelegate mAccountPickerDelegateMock;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetTest.java index 084084e..e8e744f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerBottomSheetTest.java
@@ -46,14 +46,13 @@ import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.incognito.interstitial.IncognitoInterstitialDelegate; import org.chromium.chrome.browser.signin.account_picker.AccountPickerBottomSheetCoordinator; import org.chromium.chrome.browser.signin.account_picker.AccountPickerDelegate; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; @@ -98,8 +97,8 @@ new DisableAnimationsTestRule(); @ClassRule - public static final ChromeActivityTestRule<ChromeActivity> sActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public static final ChromeTabbedActivityTestRule sActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final BlankCTATabInitialStateRule mInitialStateRule =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerDialogFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerDialogFragmentTest.java index e5c5faa..291b54b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerDialogFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/AccountPickerDialogFragmentTest.java
@@ -10,7 +10,6 @@ import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.withText; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; @@ -26,7 +25,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Answers; import org.mockito.Mock; import org.mockito.Spy; @@ -42,6 +40,7 @@ import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; import org.chromium.components.signin.ProfileDataSource; +import org.chromium.components.signin.identitymanager.IdentityManager; import org.chromium.components.signin.test.util.FakeProfileDataSource; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.test.util.DummyUiActivityTestCase; @@ -71,9 +70,12 @@ @Mock private Profile mProfileMock; - @Mock(answer = Answers.RETURNS_DEEP_STUBS) + @Mock private IdentityServicesProvider mIdentityServicesProviderMock; + @Mock + private IdentityManager mIdentityManagerMock; + @Spy private DummyAccountPickerTargetFragment mTargetFragment = new DummyAccountPickerTargetFragment(); @@ -91,10 +93,8 @@ initMocks(this); Profile.setLastUsedProfileForTesting(mProfileMock); IdentityServicesProvider.setInstanceForTests(mIdentityServicesProviderMock); - when(mIdentityServicesProviderMock.getIdentityManager(mProfileMock) - .findExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress( - anyString())) - .thenReturn(null); + when(mIdentityServicesProviderMock.getIdentityManager(mProfileMock)) + .thenReturn(mIdentityManagerMock); addAccount(mAccountName1, mFullName1); addAccount(mAccountName2, "");
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/ProfileDataCacheRenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/ProfileDataCacheRenderTest.java index 5b4b7894..3c1fcc3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/ProfileDataCacheRenderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/ProfileDataCacheRenderTest.java
@@ -6,6 +6,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import static org.mockito.Mockito.when; +import static org.mockito.MockitoAnnotations.initMocks; import android.app.Activity; import android.graphics.Bitmap; @@ -20,9 +22,11 @@ import androidx.annotation.Px; import androidx.test.filters.MediumTest; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; import org.chromium.base.test.params.ParameterAnnotations.ClassParameter; import org.chromium.base.test.params.ParameterAnnotations.UseRunnerDelegate; @@ -30,9 +34,11 @@ import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.Feature; +import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.components.signin.ProfileDataSource; +import org.chromium.components.signin.identitymanager.IdentityManager; import org.chromium.components.signin.test.util.FakeProfileDataSource; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.test.util.DummyUiActivityTestCase; @@ -67,14 +73,27 @@ public ChromeRenderTestRule mRenderTestRule = ChromeRenderTestRule.Builder.withPublicCorpus().build(); + @Mock + private Profile mProfileMock; + + @Mock + private IdentityServicesProvider mIdentityServicesProviderMock; + + private final IdentityManager mIdentityManager = + new IdentityManager(0 /* nativeIdentityManager */, null /* OAuth2TokenService */); + private FrameLayout mContentView; private ImageView mImageView; private FakeProfileDataSource mProfileDataSource; private ProfileDataCache mProfileDataCache; - @Override - public void setUpTest() throws Exception { - super.setUpTest(); + @Before + public void setUp() { + initMocks(this); + Profile.setLastUsedProfileForTesting(mProfileMock); + when(mIdentityServicesProviderMock.getIdentityManager(mProfileMock)) + .thenReturn(mIdentityManager); + IdentityServicesProvider.setInstanceForTests(mIdentityServicesProviderMock); TestThreadUtils.runOnUiThreadBlocking(() -> { Activity activity = getActivity(); mContentView = new FrameLayout(activity);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/ProfileDataCacheWithBadgeRenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/ProfileDataCacheWithBadgeRenderTest.java index 21f1162f..f3743aa 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/ProfileDataCacheWithBadgeRenderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/ProfileDataCacheWithBadgeRenderTest.java
@@ -5,6 +5,7 @@ package org.chromium.chrome.browser.signin; import static org.mockito.Mockito.mockingDetails; +import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; import android.app.Activity; @@ -20,6 +21,7 @@ import androidx.test.filters.MediumTest; import org.junit.Assert; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -28,9 +30,11 @@ import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; +import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.components.signin.ProfileDataSource; +import org.chromium.components.signin.identitymanager.IdentityManager; import org.chromium.components.signin.test.util.FakeProfileDataSource; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.test.util.DummyUiActivityTestCase; @@ -50,19 +54,31 @@ ChromeRenderTestRule.Builder.withPublicCorpus().build(); @Mock + private Profile mProfileMock; + + @Mock + private IdentityServicesProvider mIdentityServicesProviderMock; + + @Mock private ProfileDataCache.Observer mObserver; private static final String TEST_ACCOUNT_NAME = "test@example.com"; + private final IdentityManager mIdentityManager = + new IdentityManager(0 /* nativeIdentityManager */, null /* OAuth2TokenService */); + private FrameLayout mContentView; private ImageView mImageView; private FakeProfileDataSource mProfileDataSource; private ProfileDataCache mProfileDataCache; - @Override - public void setUpTest() throws Exception { - super.setUpTest(); + @Before + public void setUp() { initMocks(this); + Profile.setLastUsedProfileForTesting(mProfileMock); + when(mIdentityServicesProviderMock.getIdentityManager(mProfileMock)) + .thenReturn(mIdentityManager); + IdentityServicesProvider.setInstanceForTests(mIdentityServicesProviderMock); TestThreadUtils.runOnUiThreadBlocking(() -> { Activity activity = getActivity(); mContentView = new FrameLayout(activity);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninSignoutIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninSignoutIntegrationTest.java index bb1de5a19..851492c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninSignoutIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninSignoutIntegrationTest.java
@@ -33,15 +33,14 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.bookmarks.BookmarkModel; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileAccountManagementMetrics; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.browser.sync.settings.AccountManagementFragment; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ActivityUtils; import org.chromium.chrome.test.util.BookmarkTestUtil; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; @@ -65,8 +64,8 @@ public final SettingsActivityTestRule<AccountManagementFragment> mSettingsActivityTestRule = new SettingsActivityTestRule<>(AccountManagementFragment.class); - private final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + private final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); private final AccountManagerTestRule mAccountManagerTestRule = new AccountManagerTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsClientTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsClientTest.java index c88ccbe..4aaa018 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsClientTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsClientTest.java
@@ -18,11 +18,10 @@ import org.chromium.base.task.PostTask; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -35,8 +34,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ChromeSiteSettingsClientTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); ChromeSiteSettingsClient mSiteSettingsClient; @Before
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsBridgeTest.java index 53472f1..4c8524aa 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsBridgeTest.java
@@ -18,12 +18,11 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge; import org.chromium.components.content_settings.ContentSettingsType; import org.chromium.components.content_settings.CookieControlsBridge; @@ -67,8 +66,7 @@ } @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mTestServer; private CallbackHelper mCallbackHelper; private TestCallbackHandler mCallbackHandler;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsServiceBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsServiceBridgeTest.java index 60687a4..ee8096b6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsServiceBridgeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsServiceBridgeTest.java
@@ -17,12 +17,11 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.content_settings.CookieControlsEnforcement; import org.chromium.components.content_settings.CookieControlsMode; import org.chromium.components.content_settings.PrefNames; @@ -55,8 +54,7 @@ } @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mTestServer; private CallbackHelper mCallbackHelper; private TestCallbackHandler mCallbackHandler;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ManageSpaceActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ManageSpaceActivityTest.java index 1a7bbac..c084552 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ManageSpaceActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/ManageSpaceActivityTest.java
@@ -30,11 +30,10 @@ import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.browsing_data.BrowsingDataBridge; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.test.EmbeddedTestServer; @@ -46,8 +45,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ManageSpaceActivityTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mTestServer;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/PermissionInfoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/PermissionInfoTest.java index e4fd54f..d9c8490 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/PermissionInfoTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/PermissionInfoTest.java
@@ -14,12 +14,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.components.browser_ui.site_settings.PermissionInfo; import org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridgeJni; @@ -37,8 +36,7 @@ private static final String OTHER_ORIGIN = "https://www.other.com"; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws Exception {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sms/SmsReceiverInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sms/SmsReceiverInfoBarTest.java index ce3f8ae..b3e4523 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sms/SmsReceiverInfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sms/SmsReceiverInfoBarTest.java
@@ -21,8 +21,8 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.infobar.InfoBarContainer; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.InfoBarUtil; import org.chromium.components.browser_ui.sms.SmsReceiverInfoBar; import org.chromium.components.browser_ui.sms.SmsReceiverUma; @@ -37,8 +37,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class SmsReceiverInfoBarTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private ChromeActivity mActivity; private static final String INFOBAR_HISTOGRAM = "Blink.Sms.Receive.Infobar";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/subresource_filter/SubresourceFilterTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/subresource_filter/SubresourceFilterTest.java index 923eb9c..b70ef47 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/subresource_filter/SubresourceFilterTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/subresource_filter/SubresourceFilterTest.java
@@ -19,7 +19,6 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; import org.chromium.chrome.browser.MockSafeBrowsingApiHandler; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.infobar.AdsBlockedInfoBar; import org.chromium.chrome.browser.infobar.InfoBarContainer; @@ -28,8 +27,8 @@ import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelObserver; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.components.infobars.InfoBar; import org.chromium.components.safe_browsing.SafeBrowsingApiBridge; @@ -46,8 +45,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public final class SubresourceFilterTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private EmbeddedTestServer mTestServer; private static final String PAGE_WITH_JPG =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AccountManagementFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AccountManagementFragmentTest.java index 97fa87c..e303ab8 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AccountManagementFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AccountManagementFragmentTest.java
@@ -13,13 +13,12 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.browser.sync.settings.AccountManagementFragment; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; @@ -32,8 +31,8 @@ new SettingsActivityTestRule<>(AccountManagementFragment.class); @Rule - public final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final AccountManagerTestRule mAccountManagerTestRule = new AccountManagerTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/FakeProfileSyncService.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/FakeProfileSyncService.java index 7077c961..a7b28cc 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/FakeProfileSyncService.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/FakeProfileSyncService.java
@@ -25,7 +25,6 @@ private boolean mTrustedVaultKeyRequired; private boolean mTrustedVaultKeyRequiredForPreferredDataTypes; private boolean mEncryptEverythingEnabled; - private boolean mRequiresClientUpgrade; private Set<Integer> mChosenTypes = new HashSet<>(); private boolean mCanSyncFeatureStart; @GoogleServiceAuthError.State @@ -140,13 +139,4 @@ public void setCanSyncFeatureStart(boolean canSyncFeatureStart) { mCanSyncFeatureStart = canSyncFeatureStart; } - - @Override - public boolean requiresClientUpgrade() { - return mRequiresClientUpgrade; - } - - public void setRequiresClientUpgrade(boolean requiresClientUpgrade) { - mRequiresClientUpgrade = requiresClientUpgrade; - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncErrorCardPreferenceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncErrorCardPreferenceTest.java deleted file mode 100644 index 0fa5809..0000000 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncErrorCardPreferenceTest.java +++ /dev/null
@@ -1,268 +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. - -package org.chromium.chrome.browser.sync; - -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import android.accounts.Account; -import android.view.View; - -import androidx.test.filters.LargeTest; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; - -import org.chromium.base.test.params.ParameterAnnotations; -import org.chromium.base.test.params.ParameterizedRunner; -import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.Feature; -import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; -import org.chromium.chrome.browser.flags.ChromeFeatureList; -import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.night_mode.ChromeNightModeTestUtils; -import org.chromium.chrome.browser.settings.SettingsActivityTestRule; -import org.chromium.chrome.browser.sync.settings.ManageSyncSettings; -import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils; -import org.chromium.chrome.test.ChromeActivityTestRule; -import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; -import org.chromium.chrome.test.util.ChromeRenderTestRule; -import org.chromium.chrome.test.util.browser.Features; -import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; -import org.chromium.components.signin.AccountUtils; -import org.chromium.components.signin.ProfileDataSource; -import org.chromium.components.signin.base.GoogleServiceAuthError; -import org.chromium.components.signin.test.util.FakeProfileDataSource; -import org.chromium.content_public.browser.test.util.TestThreadUtils; -import org.chromium.ui.test.util.NightModeTestUtils; - -/** - * Test suite for SyncErrorCardPreference - */ -@RunWith(ParameterizedRunner.class) -@ParameterAnnotations.UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) -@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) -@Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) -public class SyncErrorCardPreferenceTest { - // FakeProfileDataSource is required to create the ProfileDataCache entry with sync_error badge - // for Sync error card. - private final FakeProfileDataSource mFakeProfileDataSource = new FakeProfileDataSource(); - - @Rule - public final AccountManagerTestRule mAccountManagerTestRule = - new AccountManagerTestRule(mFakeProfileDataSource); - - @Rule - public final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); - - @Rule - public final SettingsActivityTestRule<ManageSyncSettings> mSettingsActivityTestRule = - new SettingsActivityTestRule<>(ManageSyncSettings.class, true); - - @Rule - public final ChromeRenderTestRule mRenderTestRule = - ChromeRenderTestRule.Builder.withPublicCorpus().build(); - - @Mock - private AndroidSyncSettings mAndroidSyncSettingsMock; - - private FakeProfileSyncService mFakeProfileSyncService; - - @ParameterAnnotations.UseMethodParameterBefore(NightModeTestUtils.NightModeParams.class) - public void setupNightMode(boolean nightModeEnabled) { - ChromeNightModeTestUtils.setUpNightModeForChromeActivity(nightModeEnabled); - mRenderTestRule.setNightModeEnabled(nightModeEnabled); - } - - @BeforeClass - public static void setUpBeforeActivityLaunched() { - ChromeNightModeTestUtils.setUpNightModeBeforeChromeActivityLaunched(); - } - - @Before - public void setUp() throws Exception { - initMocks(this); - // Start main activity before because native side needs to be initialized before overriding - // ProfileSyncService. - mActivityTestRule.startMainActivityOnBlankPage(); - - Account account = - AccountUtils.createAccountFromName(AccountManagerTestRule.TEST_ACCOUNT_EMAIL); - TestThreadUtils.runOnUiThreadBlocking(() -> { - mFakeProfileSyncService = new FakeProfileSyncService(); - ProfileSyncService.overrideForTests(mFakeProfileSyncService); - // TODO(https://crbug.com/1125452): Use test resource for profile avatar instead of - // null. - mFakeProfileDataSource.setProfileData(account.name, - new ProfileDataSource.ProfileData( - account.name, null, "Full Name", "Given Name")); - AndroidSyncSettings.overrideForTests(mAndroidSyncSettingsMock); - when(mAndroidSyncSettingsMock.isChromeSyncEnabled()).thenReturn(true); - }); - } - - @After - public void tearDown() { - TestThreadUtils.runOnUiThreadBlocking(() -> { - ProfileSyncService.resetForTests(); - mFakeProfileDataSource.setProfileData(AccountManagerTestRule.TEST_ACCOUNT_EMAIL, null); - }); - } - - @AfterClass - public static void tearDownAfterActivityDestroyed() { - ChromeNightModeTestUtils.tearDownNightModeAfterChromeActivityDestroyed(); - } - - @Test - @LargeTest - @Feature("RenderTest") - @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) - public void testSyncErrorCardForAndroidSyncDisabled(boolean nightModeEnabled) throws Exception { - when(mAndroidSyncSettingsMock.doesMasterSyncSettingAllowChromeSync()).thenReturn(false); - mAccountManagerTestRule.addTestAccountThenSigninAndEnableSync(mFakeProfileSyncService); - TestThreadUtils.runOnUiThreadBlocking( - () - -> Assert.assertEquals("ANDROID_SYNC_DISABLED SyncError should be set", - SyncSettingsUtils.SyncError.ANDROID_SYNC_DISABLED, - SyncSettingsUtils.getSyncError())); - - mSettingsActivityTestRule.startSettingsActivity(); - mRenderTestRule.render( - getPersonalizedSyncPromoView(), "sync_error_card_android_sync_disabled"); - } - - @Test - @LargeTest - @Feature("RenderTest") - @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) - public void testSyncErrorCardForAuthError(boolean nightModeEnabled) throws Exception { - mFakeProfileSyncService.setAuthError(GoogleServiceAuthError.State.INVALID_GAIA_CREDENTIALS); - when(mAndroidSyncSettingsMock.doesMasterSyncSettingAllowChromeSync()).thenReturn(true); - mAccountManagerTestRule.addTestAccountThenSigninAndEnableSync(mFakeProfileSyncService); - TestThreadUtils.runOnUiThreadBlocking( - () - -> Assert.assertEquals("AUTH_ERROR SyncError should be set", - SyncSettingsUtils.SyncError.AUTH_ERROR, - SyncSettingsUtils.getSyncError())); - - mSettingsActivityTestRule.startSettingsActivity(); - mRenderTestRule.render(getPersonalizedSyncPromoView(), "sync_error_card_auth_error"); - } - - @Test - @LargeTest - @Feature("RenderTest") - @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) - public void testSyncErrorCardForClientOutOfDate(boolean nightModeEnabled) throws Exception { - mFakeProfileSyncService.setRequiresClientUpgrade(true); - when(mAndroidSyncSettingsMock.doesMasterSyncSettingAllowChromeSync()).thenReturn(true); - mAccountManagerTestRule.addTestAccountThenSigninAndEnableSync(mFakeProfileSyncService); - TestThreadUtils.runOnUiThreadBlocking( - () - -> Assert.assertEquals("CLIENT_OUT_OF_DATE SyncError should be set", - SyncSettingsUtils.SyncError.CLIENT_OUT_OF_DATE, - SyncSettingsUtils.getSyncError())); - - mSettingsActivityTestRule.startSettingsActivity(); - mRenderTestRule.render( - getPersonalizedSyncPromoView(), "sync_error_card_client_out_of_date"); - } - - @Test - @LargeTest - @Feature("RenderTest") - @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) - public void testSyncErrorCardForOtherErrors(boolean nightModeEnabled) throws Exception { - mFakeProfileSyncService.setAuthError(GoogleServiceAuthError.State.CONNECTION_FAILED); - when(mAndroidSyncSettingsMock.doesMasterSyncSettingAllowChromeSync()).thenReturn(true); - mAccountManagerTestRule.addTestAccountThenSigninAndEnableSync(mFakeProfileSyncService); - TestThreadUtils.runOnUiThreadBlocking( - () - -> Assert.assertEquals("OTHER_ERRORS SyncError should be set", - SyncSettingsUtils.SyncError.OTHER_ERRORS, - SyncSettingsUtils.getSyncError())); - - mSettingsActivityTestRule.startSettingsActivity(); - mRenderTestRule.render(getPersonalizedSyncPromoView(), "sync_error_card_other_errors"); - } - - @Test - @LargeTest - @Feature("RenderTest") - @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) - public void testSyncErrorCardForPassphraseRequired(boolean nightModeEnabled) throws Exception { - mFakeProfileSyncService.setEngineInitialized(true); - mFakeProfileSyncService.setPassphraseRequiredForPreferredDataTypes(true); - when(mAndroidSyncSettingsMock.doesMasterSyncSettingAllowChromeSync()).thenReturn(true); - mAccountManagerTestRule.addTestAccountThenSigninAndEnableSync(mFakeProfileSyncService); - TestThreadUtils.runOnUiThreadBlocking( - () - -> Assert.assertEquals("PASSPHRASE_REQUIRED SyncError should be set", - SyncSettingsUtils.SyncError.PASSPHRASE_REQUIRED, - SyncSettingsUtils.getSyncError())); - - mSettingsActivityTestRule.startSettingsActivity(); - mRenderTestRule.render( - getPersonalizedSyncPromoView(), "sync_error_card_passphrase_required"); - } - - @Test - @LargeTest - @Feature("RenderTest") - @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) - public void testSyncErrorCardForTrustedVaultKey(boolean nightModeEnabled) throws Exception { - mFakeProfileSyncService.setEngineInitialized(true); - mFakeProfileSyncService.setTrustedVaultKeyRequiredForPreferredDataTypes(true); - mFakeProfileSyncService.enableEncryptEverything(); - when(mAndroidSyncSettingsMock.doesMasterSyncSettingAllowChromeSync()).thenReturn(true); - mAccountManagerTestRule.addTestAccountThenSigninAndEnableSync(mFakeProfileSyncService); - TestThreadUtils.runOnUiThreadBlocking( - () - -> Assert.assertEquals("TRUSTED_VAULT_KEY_REQUIRED SyncError should be set", - SyncSettingsUtils.SyncError - .TRUSTED_VAULT_KEY_REQUIRED_FOR_EVERYTHING, - SyncSettingsUtils.getSyncError())); - - mSettingsActivityTestRule.startSettingsActivity(); - mRenderTestRule.render( - getPersonalizedSyncPromoView(), "sync_error_card_trusted_vault_key_required"); - } - - @Test - @LargeTest - @Feature("RenderTest") - @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) - public void testSyncErrorCardForSyncSetupIncomplete(boolean nightModeEnabled) throws Exception { - when(mAndroidSyncSettingsMock.doesMasterSyncSettingAllowChromeSync()).thenReturn(true); - // Passing a null ProfileSyncService instance here would sign-in the user but - // FirstSetupComplete will be unset. - mAccountManagerTestRule.addTestAccountThenSigninAndEnableSync( - /* profileSyncService= */ null); - TestThreadUtils.runOnUiThreadBlocking( - () - -> Assert.assertEquals("SYNC_SETUP_INCOMPLETE SyncError should be set", - SyncSettingsUtils.SyncError.SYNC_SETUP_INCOMPLETE, - SyncSettingsUtils.getSyncError())); - - mSettingsActivityTestRule.startSettingsActivity(); - mRenderTestRule.render( - getPersonalizedSyncPromoView(), "sync_error_card_sync_setup_incomplete"); - } - - private View getPersonalizedSyncPromoView() { - return mSettingsActivityTestRule.getActivity().findViewById( - R.id.signin_promo_view_container); - } -}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateTest.java index a9c627e..025c6d6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateTest.java
@@ -21,8 +21,8 @@ import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.external_intents.ExternalNavigationHandler; import org.chromium.components.external_intents.ExternalNavigationParams; import org.chromium.components.external_intents.InterceptNavigationDelegateImpl; @@ -44,8 +44,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class InterceptNavigationDelegateTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String BASE_PAGE = "/chrome/test/data/navigation_interception/"; private static final String NAVIGATION_FROM_TIMEOUT_PAGE =
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/RepostFormWarningTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/RepostFormWarningTest.java index 71ef81d..52eb7e4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/RepostFormWarningTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/RepostFormWarningTest.java
@@ -20,10 +20,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -45,8 +44,7 @@ // Active tab. @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private Tab mTab; // Callback helper that manages waiting for pageloads to finish.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java index cedd501..52aeb2d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/SadTabTest.java
@@ -18,10 +18,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.test.util.TestWebServer; @@ -35,8 +34,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class SadTabTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws InterruptedException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java index d2a3d15..a145c1a7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabUmaTest.java
@@ -23,11 +23,10 @@ import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.MetricsUtils.HistogramDelta; import org.chromium.chrome.browser.TabbedModeTabDelegateFactory; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.share.ShareDelegate; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.components.browser_ui.util.BrowserControlsVisibilityDelegate; import org.chromium.content_public.browser.LoadUrlParams; @@ -49,8 +48,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class TabUmaTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public TemporaryFolder mTemporaryFolder = new TemporaryFolder();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabViewManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabViewManagerTest.java index 77f04a6..6d54c6d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabViewManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/TabViewManagerTest.java
@@ -20,7 +20,7 @@ import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.fullscreen.BrowserControlsManager; -import org.chromium.chrome.test.ChromeActivityTestRule; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; /** @@ -30,8 +30,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class TabViewManagerTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws InterruptedException {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java index e968f1f..5f735c9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java
@@ -138,6 +138,7 @@ @CommandLineFlags.Add({BASE_PARAMS + "/" + TAB_SWITCHER_ON_RETURN_MS_PARAM + "/100000" + "/start_surface_variation/single/open_ntp_instead_of_start/true"}) @DisableIf.Device(type = {UiDisableIf.TABLET}) // See https://crbug.com/1081754. + @DisabledTest(message="https://crbug.com/1130696") public void testTabSwitcherModeNotTriggeredWithinThreshold() throws Exception { // clang-format on InstantStartTest.createTabStateFile(new int[] {0, 1}); @@ -348,6 +349,7 @@ // clang-format off @CommandLineFlags.Add({BASE_PARAMS + "/" + TAB_SWITCHER_ON_RETURN_MS_PARAM + "/0" + "/start_surface_variation/omniboxonly"}) + @DisabledTest(message = "https://crbug.com/1130696") public void testTabSwitcherModeTriggeredBeyondThreshold() throws Exception { // clang-format on InstantStartTest.createTabStateFile(new int[] {0, 1});
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarIntegrationTest.java index 8ddfb37..ae7a2fbf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarProgressBarIntegrationTest.java
@@ -18,10 +18,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.JavaScriptUtils; import org.chromium.content_public.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper; @@ -43,8 +42,7 @@ private static final String TEST_PAGE = "/chrome/test/data/android/progressbar_test.html"; @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private ToolbarProgressBar mProgressBar;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarTest.java index d5666eb1..afc05a7a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/ToolbarTest.java
@@ -30,8 +30,8 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.omnibox.UrlBar; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.MenuUtils; import org.chromium.chrome.test.util.OmniboxTestUtils; @@ -51,8 +51,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ToolbarTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_PAGE = "/chrome/test/data/android/test.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/BrandColorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/BrandColorTest.java index 54334cd..ea6e06c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/BrandColorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/BrandColorTest.java
@@ -24,14 +24,13 @@ import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.UrlUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tab.TabTestUtils; import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.test.util.Criteria; @@ -47,8 +46,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class BrandColorTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String BRAND_COLOR_1 = "#482329"; private static final String BRAND_COLOR_2 = "#505050";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhoneTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhoneTest.java index 645be52..cdd9aa723 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhoneTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/top/ToolbarPhoneTest.java
@@ -23,12 +23,11 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.toolbar.menu_button.MenuButton; import org.chromium.chrome.browser.toolbar.menu_button.MenuButtonCoordinator; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.test.util.UiRestriction; @@ -40,8 +39,7 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) public class ToolbarPhoneTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Mock private MenuButtonCoordinator mMenuButtonCoordinator;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tracing/settings/TracingSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tracing/settings/TracingSettingsTest.java index 59a2f33d..9df51a6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tracing/settings/TracingSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tracing/settings/TracingSettingsTest.java
@@ -34,7 +34,6 @@ import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.settings.SettingsActivity; import org.chromium.chrome.browser.settings.SettingsActivityTestRule; @@ -42,8 +41,8 @@ import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.tracing.TracingController; import org.chromium.chrome.browser.tracing.TracingNotificationManager; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.notifications.MockNotificationManagerProxy; import org.chromium.components.browser_ui.settings.ButtonPreference; import org.chromium.components.browser_ui.settings.TextMessagePreference; @@ -63,8 +62,8 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class TracingSettingsTest { @Rule - public final ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public final ChromeTabbedActivityTestRule mActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final SettingsActivityTestRule<TracingSettings> mSettingsActivityTestRule = new SettingsActivityTestRule<>(TracingSettings.class);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateCompactInfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateCompactInfoBarTest.java index 9cffeef..87b48d3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateCompactInfoBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/translate/TranslateCompactInfoBarTest.java
@@ -21,12 +21,11 @@ import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.R; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.infobar.InfoBarContainer; import org.chromium.chrome.browser.infobar.TranslateCompactInfoBar; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeRestriction; import org.chromium.chrome.test.util.InfoBarTestAnimationListener; import org.chromium.chrome.test.util.InfoBarUtil; @@ -45,8 +44,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class TranslateCompactInfoBarTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TRANSLATE_PAGE = "/chrome/test/data/translate/fr_test.html"; private static final String NON_TRANSLATE_PAGE = "/chrome/test/data/android/simple.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/video/FullscreenVideoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/video/FullscreenVideoTest.java index f24a74f7..441e0935 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/video/FullscreenVideoTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/video/FullscreenVideoTest.java
@@ -24,8 +24,8 @@ import org.chromium.chrome.browser.fullscreen.FullscreenManager; import org.chromium.chrome.browser.fullscreen.FullscreenOptions; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -45,8 +45,7 @@ MediaSwitches.AUTOPLAY_NO_GESTURE_REQUIRED_POLICY}) public class FullscreenVideoTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public EmbeddedTestServerRule mTestServerRule = new EmbeddedTestServerRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java index 27af2d449..b08cea92 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java
@@ -17,11 +17,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.browser.TabTitleObserver; import org.chromium.content_public.browser.test.util.DOMUtils; @@ -36,8 +35,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class VideoTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Test @DisableIf.Build(sdk_is_less_than = 19, message = "crbug.com/582067")
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTestRule.java index 3042c60..b0c19ac 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTestRule.java
@@ -52,8 +52,26 @@ BrowserServicesIntentDataProvider webApkIntentDataProvider) { WebappInfo webApkInfo = WebappInfo.create(webApkIntentDataProvider); Intent intent = createIntent(webApkInfo); - WebappActivity.setIntentDataProviderForTesting(webApkIntentDataProvider); + + return startWebApkActivity(intent, webApkInfo.url()); + } + + /** + * Launches a WebAPK Activity and waits for the page to have finished loading and for the splash + * screen to be hidden. + */ + public WebappActivity startWebApkActivity(final String startUrl) { + Intent intent = + new Intent(InstrumentationRegistry.getTargetContext(), WebappActivity.class); + intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, "org.chromium.webapk.test"); + intent.putExtra(ShortcutHelper.EXTRA_URL, startUrl); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + + return startWebApkActivity(intent, startUrl); + } + + private WebappActivity startWebApkActivity(final Intent intent, final String startUrl) { final WebappActivity webApkActivity = (WebappActivity) InstrumentationRegistry.getInstrumentation().startActivitySync( intent); @@ -64,9 +82,8 @@ Criteria.checkThat(webApkActivity.getActivityTab(), Matchers.notNullValue()); }, STARTUP_TIMEOUT, CriteriaHelper.DEFAULT_POLLING_INTERVAL); - ChromeTabUtils.waitForTabPageLoaded(webApkActivity.getActivityTab(), webApkInfo.url()); + ChromeTabUtils.waitForTabPageLoaded(webApkActivity.getActivityTab(), startUrl); WebappActivityTestRule.waitUntilSplashHides(webApkActivity); - return webApkActivity; }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenTest.java index 4181b68d..fe79370 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/addtohomescreen/AddToHomescreenTest.java
@@ -33,8 +33,8 @@ import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.webapps.WebappDataStorage; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.TabLoadObserver; import org.chromium.chrome.test.util.browser.TabTitleObserver; import org.chromium.chrome.test.util.browser.webapps.WebappTestPage; @@ -54,8 +54,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class AddToHomescreenTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public EmbeddedTestServerRule mTestServerRule = new EmbeddedTestServerRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/AuthenticatorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/AuthenticatorTest.java index ce8bc6c..8ab48bc 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/AuthenticatorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/AuthenticatorTest.java
@@ -22,12 +22,11 @@ import org.chromium.blink.mojom.AuthenticatorStatus; import org.chromium.blink.mojom.PublicKeyCredentialCreationOptions; import org.chromium.blink.mojom.PublicKeyCredentialRequestOptions; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.RenderFrameHost; import org.chromium.content_public.common.ContentSwitches; import org.chromium.net.test.EmbeddedTestServer; @@ -42,8 +41,7 @@ "ignore-certificate-errors"}) public class AuthenticatorTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_FILE = "/content/test/data/android/authenticator.html"; private EmbeddedTestServer mTestServer;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/Fido2CredentialRequestTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/Fido2CredentialRequestTest.java index 385d14d..2aa6aba 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/Fido2CredentialRequestTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webauth/Fido2CredentialRequestTest.java
@@ -44,8 +44,8 @@ import org.chromium.blink.mojom.PublicKeyCredentialType; import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.content_public.browser.RenderFrameHost; import org.chromium.content_public.browser.test.mock.MockRenderFrameHost; @@ -75,8 +75,8 @@ @Batch(Batch.PER_CLASS) public class Fido2CredentialRequestTest { @ClassRule - public static final ChromeActivityTestRule<ChromeActivity> sActivityTestRule = - new ChromeActivityTestRule(ChromeActivity.class); + public static final ChromeTabbedActivityTestRule sActivityTestRule = + new ChromeTabbedActivityTestRule(); @Rule public final BlankCTATabInitialStateRule mInitialStateRule = new BlankCTATabInitialStateRule(sActivityTestRule, false);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.java index 47ed68b..5c30524 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.java
@@ -24,14 +24,13 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.MinAndroidSdkLevel; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.share.ShareHelper; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.content_public.browser.test.NativeLibraryTestUtils; import org.chromium.content_public.browser.test.util.TouchCommon; @@ -45,8 +44,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class WebShareTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final String TEST_FILE = "/content/test/data/android/webshare.html"; private static final String TEST_FILE_APK = "/content/test/data/android/webshare-apk.html";
diff --git a/chrome/android/javatests/src/org/chromium/chrome/test/crash/IntentionalCrashTest.java b/chrome/android/javatests/src/org/chromium/chrome/test/crash/IntentionalCrashTest.java index ce5a6e1..0ae9c41 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/test/crash/IntentionalCrashTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/test/crash/IntentionalCrashTest.java
@@ -12,10 +12,9 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; /** Tests that intentionally crash in different ways. * @@ -25,8 +24,7 @@ @CommandLineFlags.Add(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE) public class IntentionalCrashTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @DisabledTest @SmallTest
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/compositor/layouts/SceneOverlayTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/compositor/layouts/SceneOverlayTest.java new file mode 100644 index 0000000..efbbd4e9 --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/compositor/layouts/SceneOverlayTest.java
@@ -0,0 +1,130 @@ +// 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. + +package org.chromium.chrome.browser.compositor.layouts; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +import android.content.Context; +import android.content.res.Resources; +import android.util.DisplayMetrics; +import android.view.ViewGroup; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.robolectric.annotation.Config; + +import org.chromium.base.supplier.ObservableSupplier; +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel; +import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; +import org.chromium.chrome.browser.compositor.overlays.SceneOverlay; +import org.chromium.chrome.browser.compositor.overlays.toolbar.TopToolbarOverlayCoordinator; +import org.chromium.chrome.browser.compositor.scene_layer.ScrollingBottomViewSceneLayer; + +import java.util.HashMap; +import java.util.List; + +/** Tests for {@link SceneOverlay} interactions. */ +@RunWith(BaseRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class SceneOverlayTest { + @Mock + private Context mContext; + + @Mock + private Resources mResources; + + @Mock + private DisplayMetrics mDisplayMetrics; + + @Mock + private LayoutManagerHost mLayoutManagerHost; + + @Mock + private ViewGroup mContainerView; + + @Mock + private ObservableSupplier<TabContentManager> mTabContentManagerSupplier; + + private LayoutManager mLayoutManager; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + + when(mLayoutManagerHost.getContext()).thenReturn(mContext); + when(mContext.getResources()).thenReturn(mResources); + when(mResources.getDisplayMetrics()).thenReturn(mDisplayMetrics); + + mLayoutManager = + new LayoutManager(mLayoutManagerHost, mContainerView, mTabContentManagerSupplier); + } + + @Test + public void testSceneOverlayPositions() { + List<SceneOverlay> overlays = mLayoutManager.getSceneOverlaysForTesting(); + assertEquals("The overlay list should be empty.", 0, overlays.size()); + + // Use different class names so the overlays can be uniquely identified. + SceneOverlay overlay1 = Mockito.mock(SceneOverlay.class); + SceneOverlay overlay2 = Mockito.mock(TopToolbarOverlayCoordinator.class); + SceneOverlay overlay3 = Mockito.mock(ScrollingBottomViewSceneLayer.class); + SceneOverlay overlay4 = Mockito.mock(ContextualSearchPanel.class); + + HashMap<Class, Integer> orderMap = new HashMap<>(); + orderMap.put(overlay1.getClass(), 0); + orderMap.put(overlay2.getClass(), 1); + orderMap.put(overlay3.getClass(), 2); + orderMap.put(overlay4.getClass(), 3); + mLayoutManager.setSceneOverlayOrderForTesting(orderMap); + + // Mix up the addition of each overlay. + mLayoutManager.addSceneOverlay(overlay3); + mLayoutManager.addSceneOverlay(overlay1); + mLayoutManager.addSceneOverlay(overlay4); + mLayoutManager.addSceneOverlay(overlay2); + + assertEquals("Overlay is out of order!", overlay1, overlays.get(0)); + assertEquals("Overlay is out of order!", overlay2, overlays.get(1)); + assertEquals("Overlay is out of order!", overlay3, overlays.get(2)); + assertEquals("Overlay is out of order!", overlay4, overlays.get(3)); + + assertEquals("The overlay list should have 4 items.", 4, overlays.size()); + } + + /** + * Ensure the ordering in LayoutManager is order-of-addition for multiple instances of the same + * SceneOverlay. + */ + @Test + public void testSceneOverlayPositions_multipleInstances() { + List<SceneOverlay> overlays = mLayoutManager.getSceneOverlaysForTesting(); + assertEquals("The overlay list should be empty.", 0, overlays.size()); + + SceneOverlay overlay1 = Mockito.mock(SceneOverlay.class); + SceneOverlay overlay2 = Mockito.mock(SceneOverlay.class); + SceneOverlay overlay3 = Mockito.mock(SceneOverlay.class); + + HashMap<Class, Integer> orderMap = new HashMap<>(); + orderMap.put(overlay1.getClass(), 0); + mLayoutManager.setSceneOverlayOrderForTesting(orderMap); + + // Mix up the addition of each overlay. + mLayoutManager.addSceneOverlay(overlay3); + mLayoutManager.addSceneOverlay(overlay1); + mLayoutManager.addSceneOverlay(overlay2); + + assertEquals("Overlay is out of order!", overlay3, overlays.get(0)); + assertEquals("Overlay is out of order!", overlay1, overlays.get(1)); + assertEquals("Overlay is out of order!", overlay2, overlays.get(2)); + + assertEquals("The overlay list should have 3 items.", 3, overlays.size()); + } +}
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/signin/SigninManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/signin/SigninManagerTest.java index 95671c3..6b57e05 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/signin/SigninManagerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/signin/SigninManagerTest.java
@@ -30,7 +30,9 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.browser.externalauth.ExternalAuthUtils; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.sync.AndroidSyncSettings; +import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.signin.AccountTrackerService; import org.chromium.components.signin.base.AccountInfo; import org.chromium.components.signin.base.CoreAccountId; @@ -48,9 +50,12 @@ /** Tests for {@link SigninManager}. */ @RunWith(BaseRobolectricTestRunner.class) @Config(manifest = Config.NONE) +@Features.DisableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) public class SigninManagerTest { @Rule public final JniMocker mocker = new JniMocker(); + @Rule + public final Features.JUnitProcessor processor = new Features.JUnitProcessor(); private static final AccountInfo ACCOUNT_INFO = new AccountInfo( new CoreAccountId("gaia-id-user"), "user@domain.com", "gaia-id-user", null); @@ -251,6 +256,45 @@ } @Test + public void testRollbackForMobileIdentityConsitency() { + doReturn(ACCOUNT_INFO) + .when(mIdentityManager) + .getPrimaryAccountInfo(ConsentLevel.NOT_REQUIRED); + doReturn(null).when(mIdentityManager).getPrimaryAccountInfo(ConsentLevel.SYNC); + mIdentityManager.onAccountsCookieDeletedByUserAction(); + + // SignedIn state (without sync consent) doesn't exist pre-MobileIdentityConsistency. If the + // feature is disabled while in this state, SigninManager ctor should trigger sign-out. + createSigninManager(); + + verify(mIdentityMutator) + .clearPrimaryAccount(ClearAccountsAction.DEFAULT, + SignoutReason.MOBILE_IDENTITY_CONSISTENCY_ROLLBACK, + SignoutDelete.IGNORE_METRIC); + verify(mNativeMock).logOutAllAccountsForMobileIdentityConsistencyRollback(anyLong()); + + // This sign-out shouldn't wipe data. + verify(mNativeMock, never()).wipeProfileData(anyLong(), any()); + verify(mNativeMock, never()).wipeGoogleServiceWorkerCaches(anyLong(), any()); + } + + @Test + @Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) + public void testNoRollbackIfMobileIdentityConsitencyIsEnabled() { + doReturn(ACCOUNT_INFO) + .when(mIdentityManager) + .getPrimaryAccountInfo(ConsentLevel.NOT_REQUIRED); + doReturn(null).when(mIdentityManager).getPrimaryAccountInfo(ConsentLevel.SYNC); + mIdentityManager.onAccountsCookieDeletedByUserAction(); + + createSigninManager(); + + verify(mIdentityMutator, never()).clearPrimaryAccount(anyInt(), anyInt(), anyInt()); + verify(mNativeMock, never()) + .logOutAllAccountsForMobileIdentityConsistencyRollback(anyLong()); + } + + @Test public void callbackNotifiedWhenNoOperationIsInProgress() { createSigninManager(); assertFalse(mSigninManager.isOperationInProgress());
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index bf01cf3..e1240aa 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-87.0.4275.0_rc-r1-merged.afdo.bz2 +chromeos-chrome-amd64-87.0.4277.0_rc-r1-merged.afdo.bz2
diff --git a/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT.png.sha1 b/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT.png.sha1 index 3b4ba28..cc6c607 100644 --- a/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT.png.sha1 +++ b/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT.png.sha1
@@ -1 +1 @@ -99435fd76c26bd149f0f08013257dda49e1cc786 \ No newline at end of file +9b8006352ee8a613755143f706c97678c429c9af \ No newline at end of file
diff --git a/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT_INCOGNITO.png.sha1 b/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT_INCOGNITO.png.sha1 index 3b4ba28..cc6c607 100644 --- a/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT_INCOGNITO.png.sha1 +++ b/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT_INCOGNITO.png.sha1
@@ -1 +1 @@ -99435fd76c26bd149f0f08013257dda49e1cc786 \ No newline at end of file +9b8006352ee8a613755143f706c97678c429c9af \ No newline at end of file
diff --git a/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT_NEW_WINDOW.png.sha1 b/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT_NEW_WINDOW.png.sha1 index 3b4ba28..cc6c607 100644 --- a/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT_NEW_WINDOW.png.sha1 +++ b/chrome/app/bookmarks_strings_grdp/IDS_BOOKMARK_BAR_OPEN_ALL_COUNT_NEW_WINDOW.png.sha1
@@ -1 +1 @@ -99435fd76c26bd149f0f08013257dda49e1cc786 \ No newline at end of file +9b8006352ee8a613755143f706c97678c429c9af \ No newline at end of file
diff --git a/chrome/app/printing_strings.grdp b/chrome/app/printing_strings.grdp index 2af5363..326292b 100644 --- a/chrome/app/printing_strings.grdp +++ b/chrome/app/printing_strings.grdp
@@ -157,16 +157,16 @@ <message name="IDS_PRINT_PREVIEW_MARGINS_LABEL" desc="Margins option label. Provides user the option to change the margins of the printed page."> Margins </message> - <message name="IDS_PRINT_PREVIEW_DEFAULT_MARGINS" desc="Option that specifies the page be printed with default margins."> + <message name="IDS_PRINT_PREVIEW_DEFAULT_MARGINS" desc="Option that specifies the page be printed with default margins." meaning="Default print margins"> Default </message> - <message name="IDS_PRINT_PREVIEW_NO_MARGINS" desc="Option that specifies the page be printed with no margins."> + <message name="IDS_PRINT_PREVIEW_NO_MARGINS" desc="Option that specifies the page be printed with no margins." meaning="No print margins"> None </message> - <message name="IDS_PRINT_PREVIEW_CUSTOM_MARGINS" desc="Option that specifies the page be printed with user-specified custom margins."> + <message name="IDS_PRINT_PREVIEW_CUSTOM_MARGINS" desc="Option that specifies the page be printed with user-specified custom margins." meaning="Custom print margins"> Custom </message> - <message name="IDS_PRINT_PREVIEW_MINIMUM_MARGINS" desc="Option that specifies the page be printed with the minimum allowed margins by the printer."> + <message name="IDS_PRINT_PREVIEW_MINIMUM_MARGINS" desc="Option that specifies the page be printed with the minimum allowed margins by the printer." meaning="Minimum print margins"> Minimum </message> <message name="IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL" desc="ARIA label used by screen reader to explain the purpose of the top margin textbox.">
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index c487b04..dfaa8f7 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -4648,12 +4648,6 @@ FEATURE_VALUE_TYPE(features::kUseAAudioDriver)}, #endif -#if defined(OS_CHROMEOS) - {"smart-text-selection", flag_descriptions::kSmartTextSelectionName, - flag_descriptions::kSmartTextSelectionDescription, kOsCrOS, - FEATURE_VALUE_TYPE(arc::kSmartTextSelectionFeature)}, -#endif // OS_CHROMEOS - {"allow-sxg-certs-without-extension", flag_descriptions::kAllowSignedHTTPExchangeCertsWithoutExtensionName, flag_descriptions:: @@ -5097,10 +5091,6 @@ FEATURE_VALUE_TYPE( autofill::features::kAutofillUseImprovedLabelDisambiguation)}, - {"native-file-system-api", flag_descriptions::kNativeFileSystemAPIName, - flag_descriptions::kNativeFileSystemAPIDescription, kOsDesktop, - FEATURE_VALUE_TYPE(blink::features::kNativeFileSystemAPI)}, - {"file-handling-api", flag_descriptions::kFileHandlingAPIName, flag_descriptions::kFileHandlingAPIDescription, kOsDesktop, FEATURE_VALUE_TYPE(blink::features::kFileHandlingAPI)},
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_events_android.cc b/chrome/browser/android/autofill_assistant/generic_ui_events_android.cc index 78e958d..543352b 100644 --- a/chrome/browser/android/autofill_assistant/generic_ui_events_android.cc +++ b/chrome/browser/android/autofill_assistant/generic_ui_events_android.cc
@@ -30,32 +30,33 @@ base::android::ScopedJavaGlobalRef<jobject> jdelegate, const InteractionsProto& proto) { for (const auto& interaction_proto : proto.interactions()) { - const auto& event_proto = interaction_proto.trigger_event(); - switch (event_proto.kind_case()) { - case EventProto::kOnViewClicked: { - auto jview = view_handler->GetView( - event_proto.on_view_clicked().view_identifier()); - if (!jview.has_value()) { - VLOG(1) << "Invalid click event, no view with id='" - << event_proto.on_view_clicked().view_identifier() - << "' found"; - return false; + for (const auto& event_proto : interaction_proto.trigger_event()) { + switch (event_proto.kind_case()) { + case EventProto::kOnViewClicked: { + auto jview = view_handler->GetView( + event_proto.on_view_clicked().view_identifier()); + if (!jview.has_value()) { + VLOG(1) << "Invalid click event, no view with id='" + << event_proto.on_view_clicked().view_identifier() + << "' found"; + return false; + } + SetOnClickListener(env, *jview, jdelegate, + event_proto.on_view_clicked()); + break; } - SetOnClickListener(env, *jview, jdelegate, - event_proto.on_view_clicked()); - break; + case EventProto::kOnValueChanged: + case EventProto::kOnUserActionCalled: + case EventProto::kOnTextLinkClicked: + case EventProto::kOnPopupDismissed: + case EventProto::kOnViewContainerCleared: + // Skip events that do not require registering java-side listeners. + break; + case EventProto::KIND_NOT_SET: + VLOG(1) + << "Error creating java listener for trigger event: kind not set"; + return false; } - case EventProto::kOnValueChanged: - case EventProto::kOnUserActionCalled: - case EventProto::kOnTextLinkClicked: - case EventProto::kOnPopupDismissed: - case EventProto::kOnViewContainerCleared: - // Skip events that do not require registering java-side listeners. - break; - case EventProto::KIND_NOT_SET: - VLOG(1) - << "Error creating java listener for trigger event: kind not set"; - return false; } } return true;
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_nested_controller_android.cc b/chrome/browser/android/autofill_assistant/generic_ui_nested_controller_android.cc index 89422593..9b6418b 100644 --- a/chrome/browser/android/autofill_assistant/generic_ui_nested_controller_android.cc +++ b/chrome/browser/android/autofill_assistant/generic_ui_nested_controller_android.cc
@@ -315,7 +315,7 @@ // Auto-update the text of the view whenever the corresponding value in // the model changes. InteractionProto implicit_set_text_interaction; - implicit_set_text_interaction.mutable_trigger_event() + implicit_set_text_interaction.add_trigger_event() ->mutable_on_value_changed() ->set_model_identifier(proto.text_input_view().model_identifier()); SetTextProto set_text_callback; @@ -339,7 +339,7 @@ } // Auto-update text view content. InteractionProto implicit_set_text_interaction; - implicit_set_text_interaction.mutable_trigger_event() + implicit_set_text_interaction.add_trigger_event() ->mutable_on_value_changed() ->set_model_identifier(proto.text_view().model_identifier()); SetTextProto set_text_callback;
diff --git a/chrome/browser/android/autofill_assistant/interaction_handler_android.cc b/chrome/browser/android/autofill_assistant/interaction_handler_android.cc index 5eb60a2..19e9370 100644 --- a/chrome/browser/android/autofill_assistant/interaction_handler_android.cc +++ b/chrome/browser/android/autofill_assistant/interaction_handler_android.cc
@@ -131,12 +131,7 @@ NOTREACHED() << "Interactions can not be added while listening to events!"; return false; } - auto key = EventHandler::CreateEventKeyFromProto(proto.trigger_event()); - if (!key) { - VLOG(1) << "Invalid trigger event for interaction"; - return false; - } - + std::vector<InteractionHandlerAndroid::InteractionCallback> callbacks; for (const auto& callback_proto : proto.callbacks()) { auto callback = CreateInteractionCallbackFromProto(callback_proto); if (!callback) { @@ -150,7 +145,19 @@ basic_interactions_->GetWeakPtr(), callback_proto.condition_model_identifier(), *callback)); } - AddInteraction(*key, *callback); + callbacks.push_back(std::move(*callback)); + } + + for (const auto& trigger_event : proto.trigger_event()) { + auto key = EventHandler::CreateEventKeyFromProto(trigger_event); + if (!key) { + VLOG(1) << "Invalid trigger event of type " << trigger_event.kind_case(); + return false; + } + + for (const auto& callback : callbacks) { + AddInteraction(*key, callback); + } } return true; }
diff --git a/chrome/browser/android/compositor/scene_layer/scrolling_bottom_view_scene_layer.cc b/chrome/browser/android/compositor/scene_layer/scrolling_bottom_view_scene_layer.cc index 8317761..ff966dd 100644 --- a/chrome/browser/android/compositor/scene_layer/scrolling_bottom_view_scene_layer.cc +++ b/chrome/browser/android/compositor/scene_layer/scrolling_bottom_view_scene_layer.cc
@@ -19,6 +19,8 @@ JNIEnv* env, const JavaRef<jobject>& jobj) : SceneLayer(env, jobj), + should_show_background_(false), + background_color_(SK_ColorWHITE), view_container_(cc::Layer::Create()), view_layer_(cc::UIResourceLayer::Create()) { layer()->SetIsDrawable(true); @@ -86,6 +88,18 @@ layer_->AddChild(content_tree->layer()); layer_->AddChild(view_container_); } + + // Propagate the background color up from the content layer. + should_show_background_ = content_tree->ShouldShowBackground(); + background_color_ = content_tree->GetBackgroundColor(); +} + +SkColor ScrollingBottomViewSceneLayer::GetBackgroundColor() { + return background_color_; +} + +bool ScrollingBottomViewSceneLayer::ShouldShowBackground() { + return should_show_background_; } static jlong JNI_ScrollingBottomViewSceneLayer_Init(
diff --git a/chrome/browser/android/compositor/scene_layer/scrolling_bottom_view_scene_layer.h b/chrome/browser/android/compositor/scene_layer/scrolling_bottom_view_scene_layer.h index e354c45..ab8bbf3 100644 --- a/chrome/browser/android/compositor/scene_layer/scrolling_bottom_view_scene_layer.h +++ b/chrome/browser/android/compositor/scene_layer/scrolling_bottom_view_scene_layer.h
@@ -44,7 +44,13 @@ const base::android::JavaParamRef<jobject>& jobj, const base::android::JavaParamRef<jobject>& jcontent_tree); + SkColor GetBackgroundColor() override; + + bool ShouldShowBackground() override; + private: + bool should_show_background_; + SkColor background_color_; scoped_refptr<cc::Layer> view_container_; scoped_refptr<cc::UIResourceLayer> view_layer_;
diff --git a/chrome/browser/android/reading_list/reading_list_manager_factory.cc b/chrome/browser/android/reading_list/reading_list_manager_factory.cc index 0711819..7ed4e3d 100644 --- a/chrome/browser/android/reading_list/reading_list_manager_factory.cc +++ b/chrome/browser/android/reading_list/reading_list_manager_factory.cc
@@ -8,8 +8,10 @@ #include "chrome/browser/profiles/profile_key.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/reading_list/android/empty_reading_list_manager.h" #include "chrome/browser/reading_list/android/reading_list_manager.h" #include "chrome/browser/ui/read_later/reading_list_model_factory.h" +#include "chrome/browser/ui/ui_features.h" #include "components/keyed_service/core/simple_dependency_manager.h" // static @@ -35,9 +37,12 @@ std::unique_ptr<KeyedService> ReadingListManagerFactory::BuildServiceInstanceFor( SimpleFactoryKey* key) const { + if (!base::FeatureList::IsEnabled(features::kReadLater)) + return std::make_unique<EmptyReadingListManager>(); + auto* profile = ProfileManager::GetProfileFromProfileKey( ProfileKey::FromSimpleFactoryKey(key)); auto* reading_list_model = ReadingListModelFactory::GetForBrowserContext(profile); - return std::make_unique<ReadingListManager>(reading_list_model); + return ReadingListManager::Create(reading_list_model); }
diff --git a/chrome/browser/android/signin/signin_manager_android.cc b/chrome/browser/android/signin/signin_manager_android.cc index e3613b2..b1935f1 100644 --- a/chrome/browser/android/signin/signin_manager_android.cc +++ b/chrome/browser/android/signin/signin_manager_android.cc
@@ -31,6 +31,7 @@ #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" #include "components/prefs/pref_service.h" #include "components/signin/public/base/signin_pref_names.h" +#include "components/signin/public/identity_manager/accounts_cookie_mutator.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browsing_data_filter_builder.h" @@ -277,6 +278,13 @@ return domain; } +void SigninManagerAndroid:: + LogOutAllAccountsForMobileIdentityConsistencyRollback(JNIEnv* env) { + identity_manager_->GetAccountsCookieMutator()->LogOutAllAccounts( + gaia::GaiaSource::kAccountReconcilorMirror, + signin::AccountsCookieMutator::LogOutFromCookieCompletedCallback()); +} + void SigninManagerAndroid::WipeProfileData( JNIEnv* env, const JavaParamRef<jobject>& j_callback) {
diff --git a/chrome/browser/android/signin/signin_manager_android.h b/chrome/browser/android/signin/signin_manager_android.h index 45119b1..9ac6015 100644 --- a/chrome/browser/android/signin/signin_manager_android.h +++ b/chrome/browser/android/signin/signin_manager_android.h
@@ -74,6 +74,10 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>& j_callback); + // Logs out all Google accounts on the web as a part of the rollback flow. + // TODO(https://crbug.com/1065029): Remove this along with the feature flag. + void LogOutAllAccountsForMobileIdentityConsistencyRollback(JNIEnv* env); + private: friend class SigninManagerAndroidTest; FRIEND_TEST_ALL_PREFIXES(SigninManagerAndroidTest,
diff --git a/chrome/browser/android/vr/arcore_device/ar_image_transport.cc b/chrome/browser/android/vr/arcore_device/ar_image_transport.cc index 1e13833..3fe8fc2 100644 --- a/chrome/browser/android/vr/arcore_device/ar_image_transport.cc +++ b/chrome/browser/android/vr/arcore_device/ar_image_transport.cc
@@ -373,7 +373,7 @@ // Draw the ARCore texture! float uv_transform_floats[16]; uv_transform.matrix().asColMajorf(uv_transform_floats); - ar_renderer_->Draw(texture, uv_transform_floats, 0, 0); + ar_renderer_->Draw(texture, uv_transform_floats); } void ArImageTransport::CopyMailboxToSurfaceAndSwap(
diff --git a/chrome/browser/android/vr/arcore_device/ar_renderer.cc b/chrome/browser/android/vr/arcore_device/ar_renderer.cc index 0052d934..68ab235 100644 --- a/chrome/browser/android/vr/arcore_device/ar_renderer.cc +++ b/chrome/browser/android/vr/arcore_device/ar_renderer.cc
@@ -22,17 +22,12 @@ uniform mat4 u_UvTransform; attribute vec4 a_Position; varying vec2 v_TexCoordinate; - uniform float u_XBorder; - uniform float u_YBorder; void main() { // The quad vertex coordinate range is [-0.5, 0.5]. Transform to [0, 1], - // scale to cause the borders to wrap the texture, then apply the supplied - // affine transform matrix to get the final UV. + // then apply the supplied affine transform matrix to get the final UV. float xposition = a_Position[0] + 0.5; - xposition = xposition * (2.0 * u_XBorder + 1.0) - u_XBorder; float yposition = a_Position[1] + 0.5; - yposition = yposition * (2.0 * u_YBorder + 1.0) - u_YBorder; vec4 uv_in = vec4(xposition, yposition, 0.0, 1.0); vec4 uv_out = u_UvTransform * uv_in; v_TexCoordinate = vec2(uv_out.x, uv_out.y); @@ -77,14 +72,9 @@ clip_rect_handle_ = glGetUniformLocation(program_handle_, "u_ClipRect"); texture_handle_ = glGetUniformLocation(program_handle_, "u_Texture"); uv_transform_ = glGetUniformLocation(program_handle_, "u_UvTransform"); - x_border_handle_ = glGetUniformLocation(program_handle_, "u_XBorder"); - y_border_handle_ = glGetUniformLocation(program_handle_, "u_YBorder"); } -void ArRenderer::Draw(int texture_handle, - const float (&uv_transform)[16], - float xborder, - float yborder) { +void ArRenderer::Draw(int texture_handle, const float (&uv_transform)[16]) { if (!vertex_buffer_ || !index_buffer_) { GLuint buffers[2]; glGenBuffersARB(2, buffers); @@ -118,9 +108,6 @@ vr::SetTexParameters(GL_TEXTURE_EXTERNAL_OES); glUniform1i(texture_handle_, 0); - glUniform1f(x_border_handle_, xborder); - glUniform1f(y_border_handle_, yborder); - glUniformMatrix4fv(uv_transform_, 1, GL_FALSE, &uv_transform[0]); // Blit texture to buffer
diff --git a/chrome/browser/android/vr/arcore_device/ar_renderer.h b/chrome/browser/android/vr/arcore_device/ar_renderer.h index 153eaea8..5fc7d8d 100644 --- a/chrome/browser/android/vr/arcore_device/ar_renderer.h +++ b/chrome/browser/android/vr/arcore_device/ar_renderer.h
@@ -17,10 +17,7 @@ ArRenderer(); ~ArRenderer(); - void Draw(int texture_handle, - const float (&uv_transform)[16], - float xborder, - float yborder); + void Draw(int texture_handle, const float (&uv_transform)[16]); private: GLuint program_handle_ = 0; @@ -28,8 +25,6 @@ GLuint clip_rect_handle_ = 0; GLuint texture_handle_ = 0; GLuint uv_transform_ = 0; - GLuint x_border_handle_ = 0; - GLuint y_border_handle_ = 0; GLuint vertex_buffer_ = 0; GLuint index_buffer_ = 0;
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 55182e17..f60af22 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc
@@ -111,8 +111,6 @@ #include "components/safe_browsing/core/safe_browsing_service_interface.h" #include "components/sessions/core/session_id_generator.h" #include "components/subresource_filter/content/browser/ruleset_service.h" -#include "components/subresource_filter/core/browser/subresource_filter_constants.h" -#include "components/subresource_filter/core/browser/subresource_filter_features.h" #include "components/translate/core/browser/translate_download_manager.h" #include "components/ukm/ukm_service.h" #include "components/update_client/update_query_params.h" @@ -1269,32 +1267,10 @@ DCHECK(!subresource_filter_ruleset_service_); created_subresource_filter_ruleset_service_ = true; - if (!base::FeatureList::IsEnabled( - subresource_filter::kSafeBrowsingSubresourceFilter)) { - return; - } - - // Runner for tasks critical for user experience. - scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( - base::ThreadPool::CreateSequencedTaskRunner( - {base::MayBlock(), base::TaskPriority::USER_BLOCKING, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})); - - // Runner for tasks that do not influence user experience. - scoped_refptr<base::SequencedTaskRunner> background_task_runner( - base::ThreadPool::CreateSequencedTaskRunner( - {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})); - base::FilePath user_data_dir; base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); - base::FilePath indexed_ruleset_base_dir = - user_data_dir.Append(subresource_filter::kTopLevelDirectoryName) - .Append(subresource_filter::kIndexedRulesetBaseDirectoryName); subresource_filter_ruleset_service_ = - std::make_unique<subresource_filter::RulesetService>( - local_state(), background_task_runner, indexed_ruleset_base_dir, - blocking_task_runner); + subresource_filter::RulesetService::Create(local_state(), user_data_dir); } void BrowserProcessImpl::CreateFlocBlocklistService() {
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 983b342..69c4626f 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -3413,6 +3413,8 @@ "net/network_diagnostics/dns_latency_routine_unittest.cc", "net/network_diagnostics/dns_resolution_routine_unittest.cc", "net/network_diagnostics/dns_resolver_present_routine_unittest.cc", + "net/network_diagnostics/fake_host_resolver.cc", + "net/network_diagnostics/fake_host_resolver.h", "net/network_diagnostics/gateway_can_be_pinged_routine_unittest.cc", "net/network_diagnostics/has_secure_wifi_connection_routine_unittest.cc", "net/network_diagnostics/http_firewall_routine_unittest.cc",
diff --git a/chrome/browser/chromeos/arc/intent_helper/start_smart_selection_action_menu.cc b/chrome/browser/chromeos/arc/intent_helper/start_smart_selection_action_menu.cc index cf2282c..4472402 100644 --- a/chrome/browser/chromeos/arc/intent_helper/start_smart_selection_action_menu.cc +++ b/chrome/browser/chromeos/arc/intent_helper/start_smart_selection_action_menu.cc
@@ -17,7 +17,6 @@ #include "chrome/browser/apps/app_service/app_icon_factory.h" #include "chrome/common/chrome_features.h" #include "chrome/grit/generated_resources.h" -#include "components/arc/arc_features.h" #include "components/arc/arc_service_manager.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" #include "components/arc/metrics/arc_metrics_constants.h" @@ -44,9 +43,6 @@ void StartSmartSelectionActionMenu::InitMenu( const content::ContextMenuParams& params) { - if (!base::FeatureList::IsEnabled(kSmartTextSelectionFeature)) - return; - const std::string converted_text = base::UTF16ToUTF8(params.selection_text); if (converted_text.empty()) return;
diff --git a/chrome/browser/chromeos/certificate_provider/certificate_provider_service.h b/chrome/browser/chromeos/certificate_provider/certificate_provider_service.h index 9b24f64..728636f5a 100644 --- a/chrome/browser/chromeos/certificate_provider/certificate_provider_service.h +++ b/chrome/browser/chromeos/certificate_provider/certificate_provider_service.h
@@ -129,12 +129,12 @@ // Must be called when an extension replied to a previous certificate // request, after the new certificates were registered with - // SetCertificatesForExtension(). For each request, it is expected that every - // registered extension replies exactly once. |cert_request_id| must refer to - // a previously broadcast certificate request. Returns false if the request id - // is unknown or it was called before with the same combination of request id - // and extension id. E.g. the request could have timed out before an extension - // replies. + // SetCertificatesProvidedByExtension(). For each request, it is expected that + // every registered extension replies exactly once. |cert_request_id| must + // refer to a previously broadcast certificate request. Returns false if the + // request id is unknown or it was called before with the same combination of + // request id and extension id. E.g. the request could have timed out before + // an extension replies. bool SetExtensionCertificateReplyReceived(const std::string& extension_id, int cert_request_id);
diff --git a/chrome/browser/chromeos/drive/drive_integration_service.cc b/chrome/browser/chromeos/drive/drive_integration_service.cc index 7c36d9d0..089f77e 100644 --- a/chrome/browser/chromeos/drive/drive_integration_service.cc +++ b/chrome/browser/chromeos/drive/drive_integration_service.cc
@@ -566,8 +566,7 @@ drivefs_holder_(std::make_unique<DriveFsHolder>( profile_, this, - std::move(test_drivefs_mojo_listener_factory))), - power_manager_observer_(this) { + std::move(test_drivefs_mojo_listener_factory))) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(profile && !profile->IsOffTheRecord()); @@ -592,10 +591,6 @@ blocking_task_runner_.get())); } - // PowerManagerClient is unset in unit tests. - if (chromeos::PowerManagerClient::Get()) { - power_manager_observer_.Add(chromeos::PowerManagerClient::Get()); - } SetEnabled(drive::util::IsDriveEnabledForProfile(profile)); } @@ -1028,21 +1023,6 @@ profile_->GetPrefs()->SetBoolean(prefs::kDriveFsPinnedMigrated, true); } -void DriveIntegrationService::SuspendImminent( - power_manager::SuspendImminent::Reason reason) { - // This may a bit racy since it doesn't prevent suspend until the unmount is - // completed, instead relying on something else to defer suspending long - // enough. - RemoveDriveMountPoint(); -} - -void DriveIntegrationService::SuspendDone( - const base::TimeDelta& sleep_duration) { - if (is_enabled()) { - AddDriveMountPoint(); - } -} - void DriveIntegrationService::GetQuickAccessItems( int max_number, GetQuickAccessItemsCallback callback) {
diff --git a/chrome/browser/chromeos/drive/drive_integration_service.h b/chrome/browser/chromeos/drive/drive_integration_service.h index b7a826a..e325a95 100644 --- a/chrome/browser/chromeos/drive/drive_integration_service.h +++ b/chrome/browser/chromeos/drive/drive_integration_service.h
@@ -18,7 +18,6 @@ #include "base/observer_list_types.h" #include "base/scoped_observer.h" #include "chromeos/components/drivefs/drivefs_host.h" -#include "chromeos/dbus/power/power_manager_client.h" #include "components/drive/drive_notification_observer.h" #include "components/drive/file_errors.h" #include "components/drive/file_system_core_util.h" @@ -91,8 +90,7 @@ // that are used to integrate Drive to Chrome. The object of this class is // created per-profile. class DriveIntegrationService : public KeyedService, - public drivefs::DriveFsHost::MountObserver, - public chromeos::PowerManagerClient::Observer { + public drivefs::DriveFsHost::MountObserver { public: class PreferenceWatcher; using DriveFsMojoListenerFactory = base::RepeatingCallback< @@ -271,10 +269,6 @@ // Pin all the files in |files_to_pin| with DriveFS. void PinFiles(const std::vector<base::FilePath>& files_to_pin); - // chromeos::PowerManagerClient::Observer overrides: - void SuspendImminent(power_manager::SuspendImminent::Reason reason) override; - void SuspendDone(const base::TimeDelta& sleep_duration) override; - void OnGetQuickAccessItems( GetQuickAccessItemsCallback callback, drive::FileError error, @@ -306,10 +300,6 @@ base::TimeTicks mount_start_; - ScopedObserver<chromeos::PowerManagerClient, - chromeos::PowerManagerClient::Observer> - power_manager_observer_{this}; - // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. base::WeakPtrFactory<DriveIntegrationService> weak_ptr_factory_{this};
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 76979b75..f68fed4 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -999,7 +999,8 @@ TestCase("searchDownloadsClearSearch"), TestCase("searchHidingViaTab"), TestCase("searchHidingTextEntryField"), - TestCase("searchButtonToggles"))); + TestCase("searchButtonToggles"), + TestCase("searchQueryLaunchParam"))); WRAPPED_INSTANTIATE_TEST_SUITE_P( Metrics, /* metrics.js */
diff --git a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc index c09ee76..23282a9 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc
@@ -782,9 +782,7 @@ "text/csv", false); base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatures({blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI}, - {}); + scoped_feature_list.InitWithFeatures({blink::features::kFileHandlingAPI}, {}); FindFileHandlerTasks(&test_profile_, entries, &tasks); EXPECT_EQ(0u, tasks.size()); }
diff --git a/chrome/browser/chromeos/file_manager/web_file_tasks_unittest.cc b/chrome/browser/chromeos/file_manager/web_file_tasks_unittest.cc index 259168fa..e1d135c 100644 --- a/chrome/browser/chromeos/file_manager/web_file_tasks_unittest.cc +++ b/chrome/browser/chromeos/file_manager/web_file_tasks_unittest.cc
@@ -99,23 +99,21 @@ std::vector<FullTaskDescriptor> tasks; { - // Web Apps should not be able to handle files unless - // kNativeFileSystemAPI and kFileHandlingAPI are enabled. + // Web Apps should not be able to handle files unless kFileHandlingAPI is + // enabled. base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitWithFeatures({}, - {blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI}); + {blink::features::kFileHandlingAPI}); FindWebTasks(profile(), entries, &tasks); EXPECT_EQ(0u, tasks.size()); tasks.clear(); } { - // When the flags are enabled, it should be possible to handle files from + // When the flag is enabled, it should be possible to handle files from // bookmark apps. base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatures({blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI}, + scoped_feature_list.InitWithFeatures({blink::features::kFileHandlingAPI}, {}); // Note: FileHandlers aren't enabled while the flag is off. @@ -139,12 +137,10 @@ const char kFooId[] = "foo-app-id"; const char kFooAction[] = "https://foo.tld/csv"; - // Web Apps should not be able to handle files unless - // kNativeFileSystemAPI and kFileHandlingAPI are enabled. + // Web Apps should not be able to handle files unless kFileHandlingAPI is + // enabled. base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatures({blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI}, - {}); + scoped_feature_list.InitWithFeatures({blink::features::kFileHandlingAPI}, {}); InstallFileHandler(kGraphrId, GURL(kGraphrAction), {{"text/csv", {".csv"}}}); InstallFileHandler(kFooId, GURL(kFooAction), {{"text/csv", {".csv"}}}); @@ -171,9 +167,7 @@ TEST_P(WebFileTasksTest, FindWebFileHandlerTasks) { base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatures({blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI}, - {}); + scoped_feature_list.InitWithFeatures({blink::features::kFileHandlingAPI}, {}); const char kFooId[] = "foo-app-id"; const char kFooAction[] = "https://foo.tld/files"; @@ -221,9 +215,7 @@ TEST_P(WebFileTasksTest, FindWebFileHandlerTask_Generic) { base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.InitWithFeatures({blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI}, - {}); + scoped_feature_list.InitWithFeatures({blink::features::kFileHandlingAPI}, {}); const char kBarId[] = "bar-app-id"; const char kBarAction[] = "https://bar.tld/files";
diff --git a/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.cc b/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.cc new file mode 100644 index 0000000..5b53e35 --- /dev/null +++ b/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.cc
@@ -0,0 +1,60 @@ +// 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/chromeos/net/network_diagnostics/fake_host_resolver.h" + +#include <cstdint> +#include <utility> + +#include "base/logging.h" +#include "base/notreached.h" +#include "base/optional.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "net/base/address_list.h" +#include "net/dns/public/resolve_error_info.h" + +namespace chromeos { +namespace network_diagnostics { + +FakeHostResolver::DnsResult::DnsResult( + int32_t result, + net::ResolveErrorInfo resolve_error_info, + base::Optional<net::AddressList> resolved_addresses) + : result_(result), + resolve_error_info_(resolve_error_info), + resolved_addresses_(resolved_addresses) {} + +FakeHostResolver::DnsResult::~DnsResult() = default; + +FakeHostResolver::FakeHostResolver( + mojo::PendingReceiver<network::mojom::HostResolver> receiver) + : receiver_(this, std::move(receiver)) {} + +FakeHostResolver::~FakeHostResolver() = default; + +void FakeHostResolver::ResolveHost( + const net::HostPortPair& host, + const net::NetworkIsolationKey& network_isolation_key, + network::mojom::ResolveHostParametersPtr optional_parameters, + mojo::PendingRemote<network::mojom::ResolveHostClient> + pending_response_client) { + mojo::Remote<network::mojom::ResolveHostClient> response_client( + std::move(pending_response_client)); + DnsResult* result = fake_dns_results_.front(); + DCHECK(result); + fake_dns_results_.pop_front(); + response_client->OnComplete(result->result_, result->resolve_error_info_, + result->resolved_addresses_); +} + +void FakeHostResolver::MdnsListen( + const net::HostPortPair& host, + net::DnsQueryType query_type, + mojo::PendingRemote<network::mojom::MdnsListenClient> response_client, + MdnsListenCallback callback) { + NOTIMPLEMENTED(); +} + +} // namespace network_diagnostics +} // namespace chromeos
diff --git a/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.h b/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.h new file mode 100644 index 0000000..3711b00 --- /dev/null +++ b/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.h
@@ -0,0 +1,67 @@ +// 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_CHROMEOS_NET_NETWORK_DIAGNOSTICS_FAKE_HOST_RESOLVER_H_ +#define CHROME_BROWSER_CHROMEOS_NET_NETWORK_DIAGNOSTICS_FAKE_HOST_RESOLVER_H_ + +#include <deque> + +#include "base/optional.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "net/base/address_list.h" +#include "net/dns/public/resolve_error_info.h" +#include "services/network/public/mojom/host_resolver.mojom.h" + +namespace chromeos { +namespace network_diagnostics { + +// Used in unit tests, the FakeHostResolver class simulates the behavior of a +// host resolver. +class FakeHostResolver : public network::mojom::HostResolver { + public: + struct DnsResult { + public: + DnsResult(int32_t result, + net::ResolveErrorInfo resolve_error_info, + base::Optional<net::AddressList> resolved_addresses); + ~DnsResult(); + + int result_; + net::ResolveErrorInfo resolve_error_info_; + base::Optional<net::AddressList> resolved_addresses_; + }; + + FakeHostResolver( + mojo::PendingReceiver<network::mojom::HostResolver> receiver); + ~FakeHostResolver() override; + + // network::mojom::HostResolver + void ResolveHost(const net::HostPortPair& host, + const net::NetworkIsolationKey& network_isolation_key, + network::mojom::ResolveHostParametersPtr optional_parameters, + mojo::PendingRemote<network::mojom::ResolveHostClient> + pending_response_client) override; + void MdnsListen( + const net::HostPortPair& host, + net::DnsQueryType query_type, + mojo::PendingRemote<network::mojom::MdnsListenClient> response_client, + MdnsListenCallback callback) override; + + // Sets the fake dns results. + void set_fake_dns_results(std::deque<DnsResult*> fake_dns_results) { + fake_dns_results_ = std::move(fake_dns_results); + } + + private: + mojo::Receiver<network::mojom::HostResolver> receiver_; + // Use the list of fake dns results to fake different responses for multiple + // calls to the host_resolver's ResolveHost(). + std::deque<DnsResult*> fake_dns_results_; +}; + +} // namespace network_diagnostics +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_DIAGNOSTICS_FAKE_HOST_RESOLVER_H_
diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc index e5e6696..08f8a74 100644 --- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc +++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
@@ -1352,8 +1352,9 @@ // verify that the underlying policy subsystem will start a fetch // without this request as well, the user_manager::UserManager must be // prevented from seeing the policy change. - reinterpret_cast<chromeos::ChromeUserManagerImpl*>( - user_manager::UserManager::Get())->StopPolicyObserverForTesting(); + static_cast<chromeos::ChromeUserManagerImpl*>( + user_manager::UserManager::Get()) + ->StopPolicyObserverForTesting(); UploadDeviceLocalAccountPolicy(); AddPublicSessionToDevicePolicy(kAccountId1);
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager.cc b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager.cc index 28ad7c0..cc1f51d 100644 --- a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager.cc +++ b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager.cc
@@ -18,7 +18,6 @@ #include "components/policy/core/common/policy_pref_names.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" -#include "components/url_matcher/url_matcher.h" #include "url/gurl.h" #include "url/origin.h" @@ -102,6 +101,36 @@ : level_2; } +// Inserts a mapping between URLs conditions IDs range to `rule_id` in `map`. +void InsertUrlsRulesMapping( + DlpRulesManager::UrlConditionId url_condition_id_start, + DlpRulesManager::UrlConditionId url_condition_id_end, + DlpRulesManager::RuleId rule_id, + std::map<DlpRulesManager::UrlConditionId, DlpRulesManager::RuleId>& map) { + for (auto url_condition_id = url_condition_id_start; + url_condition_id <= url_condition_id_end; ++url_condition_id) { + map[url_condition_id] = rule_id; + } +} + +// Matches `url` against `url_matcher` patterns and returns the rules IDs +// configured with the matched patterns. +std::set<DlpRulesManager::RuleId> MatchUrlAndGetRulesMapping( + const GURL& url, + const url_matcher::URLMatcher* url_matcher, + const std::map<DlpRulesManager::UrlConditionId, DlpRulesManager::RuleId>& + rules_map) { + DCHECK(url_matcher); + const std::set<DlpRulesManager::UrlConditionId> url_conditions_ids = + url_matcher->MatchURL(url); + + std::set<DlpRulesManager::RuleId> rule_ids; + for (const auto& id : url_conditions_ids) { + rule_ids.insert(rules_map.at(id)); + } + return rule_ids; +} + // A singleton instance of DlpRulesManager. Set from DlpRulesManager::Init(). static DlpRulesManager* g_dlp_rules_manager = nullptr; @@ -137,8 +166,8 @@ restriction == Restriction::kPrivacyScreen || restriction == Restriction::kScreenshot); - const std::set<url_matcher::URLMatcherConditionSet::ID> source_rules_ids = - src_url_matcher_->MatchURL(source); + const std::set<RuleId> source_rules_ids = MatchUrlAndGetRulesMapping( + source, src_url_matcher_.get(), src_url_rules_mapping_); return GetMaxJoinRestrictionLevel(restriction, source_rules_ids); } @@ -156,11 +185,11 @@ url::Origin::Create(destination))) return Level::kAllow; - std::set<url_matcher::URLMatcherConditionSet::ID> source_rules_ids = - src_url_matcher_->MatchURL(source); + const std::set<RuleId> source_rules_ids = MatchUrlAndGetRulesMapping( + source, src_url_matcher_.get(), src_url_rules_mapping_); - std::set<url_matcher::URLMatcherConditionSet::ID> destination_rules_ids = - dst_url_matcher_->MatchURL(destination); + const std::set<RuleId> destination_rules_ids = MatchUrlAndGetRulesMapping( + destination, dst_url_matcher_.get(), dst_url_rules_mapping_); return GetMaxJoinRestrictionLevel(restriction, source_rules_ids, destination_rules_ids); @@ -173,8 +202,8 @@ DCHECK(src_url_matcher_); DCHECK(restriction == Restriction::kClipboard); - const std::set<url_matcher::URLMatcherConditionSet::ID> source_rules_ids = - src_url_matcher_->MatchURL(source); + const std::set<RuleId> source_rules_ids = MatchUrlAndGetRulesMapping( + source, src_url_matcher_.get(), src_url_rules_mapping_); auto it = components_rules_.find(destination); if (it == components_rules_.end()) @@ -210,20 +239,24 @@ DlpRulesManager::~DlpRulesManager() = default; void DlpRulesManager::OnPolicyUpdate() { - RuleId rules_counter = 0; + components_rules_.clear(); + restrictions_map_.clear(); + src_url_rules_mapping_.clear(); + dst_url_rules_mapping_.clear(); + src_url_matcher_ = std::make_unique<url_matcher::URLMatcher>(); + dst_url_matcher_ = std::make_unique<url_matcher::URLMatcher>(); const base::ListValue* rules_list = g_browser_process->local_state()->GetList(policy_prefs::kDlpRulesList); - src_url_matcher_ = std::make_unique<url_matcher::URLMatcher>(); - dst_url_matcher_ = std::make_unique<url_matcher::URLMatcher>(); - components_rules_.clear(); - restrictions_map_.clear(); - if (!rules_list) { return; } + RuleId rules_counter = 0; + UrlConditionId src_url_condition_id = 0; + UrlConditionId dst_url_condition_id = 0; + for (const base::Value& rule : *rules_list) { DCHECK(rule.is_dict()); const auto* sources = rule.FindDictKey("sources"); @@ -232,18 +265,24 @@ DCHECK(sources_urls); // This DCHECK should be removed when other types are // supported as sources. + UrlConditionId prev_src_url_condition_id = src_url_condition_id; url_util::AddFilters(src_url_matcher_.get(), /* allowed= */ true, - &rules_counter, + &src_url_condition_id, &base::Value::AsListValue(*sources_urls)); + InsertUrlsRulesMapping(prev_src_url_condition_id + 1, src_url_condition_id, + rules_counter, src_url_rules_mapping_); const auto* destinations = rule.FindDictKey("destinations"); if (destinations) { const auto* destinations_urls = destinations->FindListKey("urls"); if (destinations_urls) { - int destination_rule_id = rules_counter - 1; + UrlConditionId prev_dst_url_condition_id = dst_url_condition_id; url_util::AddFilters(dst_url_matcher_.get(), /* allowed= */ true, - &destination_rule_id, + &dst_url_condition_id, &base::Value::AsListValue(*destinations_urls)); + InsertUrlsRulesMapping(prev_dst_url_condition_id + 1, + dst_url_condition_id, rules_counter, + dst_url_rules_mapping_); } const auto* destinations_components = destinations->FindListKey("components"); @@ -274,6 +313,7 @@ restrictions_map_[rule_restriction].emplace(rules_counter, rule_level); } + ++rules_counter; } } @@ -304,7 +344,7 @@ const Restriction restriction, const std::set<RuleId>& source_rules, const std::set<RuleId>& destination_rules) const { - std::set<url_matcher::URLMatcherConditionSet::ID> intersection; + std::set<UrlConditionId> intersection; std::set_intersection(source_rules.begin(), source_rules.end(), destination_rules.begin(), destination_rules.end(), std::inserter(intersection, intersection.begin()));
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h index 6f2d4bd..e45aed63 100644 --- a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h +++ b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h
@@ -10,10 +10,7 @@ #include <set> #include "components/prefs/pref_change_registrar.h" - -namespace url_matcher { -class URLMatcher; -} +#include "components/url_matcher/url_matcher.h" class GURL; class PrefRegistrySimple; @@ -74,6 +71,7 @@ }; using RuleId = int; + using UrlConditionId = url_matcher::URLMatcherConditionSet::ID; // Creates a singleton instance of the class. static void Init(); @@ -153,6 +151,14 @@ // Map from the restrictions to their configured rules IDs and levels. std::map<Restriction, std::map<RuleId, Level>> restrictions_map_; + + // Map from the URL matching conditions IDs of the sources to their configured + // rules IDs. + std::map<UrlConditionId, RuleId> src_url_rules_mapping_; + + // Map from the URL matching conditions IDs of the destinations to their + // configured rules IDs. + std::map<UrlConditionId, RuleId> dst_url_rules_mapping_; }; } // namespace policy
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_unittest.cc b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_unittest.cc index fb722d07..0610329 100644 --- a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_unittest.cc +++ b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_unittest.cc
@@ -7,6 +7,7 @@ #include <string> #include <vector> +#include "base/strings/strcat.h" #include "base/values.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_test_utils.h" #include "chrome/test/base/scoped_testing_local_state.h" @@ -26,6 +27,14 @@ constexpr char kUrlStr3[] = "*"; constexpr char kUrlStr4[] = "https://www.gmail.com"; +constexpr char kHttpsPrefix[] = "https://www."; + +constexpr char kUrlPattern1[] = "chat.google.com"; +constexpr char kUrlPattern2[] = "salesforce.com"; +constexpr char kUrlPattern3[] = "docs.google.com"; +constexpr char kUrlPattern4[] = "drive.google.com"; +constexpr char kUrlPattern5[] = "*.company.com"; + } // namespace class DlpRulesManagerTest : public testing::Test { @@ -84,7 +93,8 @@ rules.Append(dlp_test_util::CreateRule( "rule #1", "Block", std::move(src_urls_1), std::move(dst_urls_1), - base::Value(base::Value::Type::LIST), std::move(restrictions_1))); + /*dst_components=*/base::Value(base::Value::Type::LIST), + std::move(restrictions_1))); // Second Rule base::Value src_urls_2(base::Value::Type::LIST); @@ -99,7 +109,8 @@ rules.Append(dlp_test_util::CreateRule( "rule #2", "exceptional allow", std::move(src_urls_2), - std::move(dst_urls_2), base::Value(base::Value::Type::LIST), + std::move(dst_urls_2), + /*dst_components=*/base::Value(base::Value::Type::LIST), std::move(restrictions_2))); UpdatePolicyPref(std::move(rules)); @@ -148,8 +159,9 @@ rules_1.Append(dlp_test_util::CreateRule( "rule #1", "Block", std::move(src_urls_1), - base::Value(base::Value::Type::LIST), - base::Value(base::Value::Type::LIST), std::move(restrictions_1))); + /*dst_urls=*/base::Value(base::Value::Type::LIST), + /*dst_components=*/base::Value(base::Value::Type::LIST), + std::move(restrictions_1))); UpdatePolicyPref(std::move(rules_1)); EXPECT_EQ(DlpRulesManager::Level::kBlock, @@ -168,8 +180,9 @@ rules_2.Append(dlp_test_util::CreateRule( "rule #2", "exceptional allow", std::move(src_urls_2), - base::Value(base::Value::Type::LIST), - base::Value(base::Value::Type::LIST), std::move(restrictions_2))); + /*dst_urls=*/base::Value(base::Value::Type::LIST), + /*dst_components=*/base::Value(base::Value::Type::LIST), + std::move(restrictions_2))); UpdatePolicyPref(std::move(rules_2)); EXPECT_EQ(DlpRulesManager::Level::kAllow, @@ -195,8 +208,8 @@ rules.Append(dlp_test_util::CreateRule( "rule #1", "Block", std::move(src_urls), - base::Value(base::Value::Type::LIST), std::move(dst_components), - std::move(restrictions))); + /*dst_urls=*/base::Value(base::Value::Type::LIST), + std::move(dst_components), std::move(restrictions))); UpdatePolicyPref(std::move(rules)); EXPECT_EQ(DlpRulesManager::Level::kBlock, @@ -225,7 +238,8 @@ rules.Append(dlp_test_util::CreateRule( "rule #1", "Block", std::move(src_urls), std::move(dst_urls), - base::Value(base::Value::Type::LIST), std::move(restrictions))); + /*dst_components=*/base::Value(base::Value::Type::LIST), + std::move(restrictions))); UpdatePolicyPref(std::move(rules)); @@ -251,7 +265,8 @@ rules.Append(dlp_test_util::CreateRule( "rule #1", "Block *", std::move(src_urls_1), std::move(dst_urls_1), - base::Value(base::Value::Type::LIST), std::move(restrictions_1))); + /*dst_components=*/base::Value(base::Value::Type::LIST), + std::move(restrictions_1))); // First Rule base::Value src_urls_2(base::Value::Type::LIST); @@ -266,7 +281,8 @@ rules.Append(dlp_test_util::CreateRule( "rule #2", "Block", std::move(src_urls_2), std::move(dst_urls_2), - base::Value(base::Value::Type::LIST), std::move(restrictions_2))); + /*dst_components=*/base::Value(base::Value::Type::LIST), + std::move(restrictions_2))); UpdatePolicyPref(std::move(rules)); @@ -287,8 +303,8 @@ base::Value src_urls(base::Value::Type::LIST); src_urls.Append(kUrlStr1); - base::Value dst_urls(base::Value::Type::LIST); - dst_urls.Append(dlp::kPluginVm); + base::Value dst_components(base::Value::Type::LIST); + dst_components.Append(dlp::kPluginVm); base::Value restrictions(base::Value::Type::LIST); restrictions.Append(dlp_test_util::CreateRestrictionWithLevel( @@ -296,8 +312,8 @@ rules.Append(dlp_test_util::CreateRule( "rule #1", "Block PluginVM", std::move(src_urls), - base::Value(base::Value::Type::LIST), std::move(dst_urls), - std::move(restrictions))); + /*dst_urls=*/base::Value(base::Value::Type::LIST), + std::move(dst_components), std::move(restrictions))); UpdatePolicyPref(std::move(rules)); @@ -317,4 +333,82 @@ DlpRulesManager::Restriction::kClipboard)); } +TEST_F(DlpRulesManagerTest, IsRestricted_MultipleURLs) { + base::Value rules(base::Value::Type::LIST); + + base::Value src_urls_1(base::Value::Type::LIST); + src_urls_1.Append(kUrlPattern1); + src_urls_1.Append(kUrlPattern2); + src_urls_1.Append(kUrlPattern3); + src_urls_1.Append(kUrlPattern4); + src_urls_1.Append(kUrlPattern5); + + base::Value dst_urls_1 = src_urls_1.Clone(); + base::Value src_urls_2 = src_urls_1.Clone(); + + base::Value restrictions_1(base::Value::Type::LIST); + restrictions_1.Append(dlp_test_util::CreateRestrictionWithLevel( + dlp::kClipboardRestriction, dlp::kAllowLevel)); + + rules.Append(dlp_test_util::CreateRule( + "Support agent work flows", "Allow copy and paste for work purposes", + std::move(src_urls_1), std::move(dst_urls_1), + /*dst_components=*/base::Value(base::Value::Type::LIST), + std::move(restrictions_1))); + + base::Value dst_urls_2(base::Value::Type::LIST); + dst_urls_2.Append(kUrlStr3); + + base::Value restrictions_2(base::Value::Type::LIST); + restrictions_2.Append(dlp_test_util::CreateRestrictionWithLevel( + dlp::kClipboardRestriction, dlp::kBlockLevel)); + + rules.Append(dlp_test_util::CreateRule( + "Block non-agent work flows", + "Disallow copy and paste for non-work purposes", std::move(src_urls_2), + std::move(dst_urls_2), + /*dst_components=*/base::Value(base::Value::Type::LIST), + std::move(restrictions_2))); + + UpdatePolicyPref(std::move(rules)); + + EXPECT_EQ(DlpRulesManager::Level::kAllow, + dlp_rules_manager_->IsRestrictedDestination( + GURL(base::StrCat({kHttpsPrefix, kUrlPattern1})), + GURL(base::StrCat({kHttpsPrefix, kUrlPattern2})), + DlpRulesManager::Restriction::kClipboard)); + EXPECT_EQ(DlpRulesManager::Level::kAllow, + dlp_rules_manager_->IsRestrictedDestination( + GURL(base::StrCat({kHttpsPrefix, kUrlPattern3})), + GURL(base::StrCat({kHttpsPrefix, kUrlPattern4})), + DlpRulesManager::Restriction::kClipboard)); + EXPECT_EQ(DlpRulesManager::Level::kAllow, + dlp_rules_manager_->IsRestrictedDestination( + GURL(base::StrCat({kHttpsPrefix, kUrlPattern5})), + GURL(base::StrCat({kHttpsPrefix, kUrlPattern2})), + DlpRulesManager::Restriction::kClipboard)); + EXPECT_EQ(DlpRulesManager::Level::kAllow, + dlp_rules_manager_->IsRestrictedDestination( + GURL(base::StrCat({kHttpsPrefix, kUrlPattern2})), + GURL(base::StrCat({kHttpsPrefix, kUrlPattern3})), + DlpRulesManager::Restriction::kClipboard)); + + EXPECT_EQ(DlpRulesManager::Level::kBlock, + dlp_rules_manager_->IsRestrictedDestination( + GURL(base::StrCat({kHttpsPrefix, kUrlPattern1})), + GURL(kUrlStr2), DlpRulesManager::Restriction::kClipboard)); + EXPECT_EQ(DlpRulesManager::Level::kBlock, + dlp_rules_manager_->IsRestrictedDestination( + GURL(base::StrCat({kHttpsPrefix, kUrlPattern2})), + GURL(kUrlStr1), DlpRulesManager::Restriction::kClipboard)); + EXPECT_EQ(DlpRulesManager::Level::kBlock, + dlp_rules_manager_->IsRestrictedDestination( + GURL(base::StrCat({kHttpsPrefix, kUrlPattern3})), + GURL(kUrlStr2), DlpRulesManager::Restriction::kClipboard)); + EXPECT_EQ(DlpRulesManager::Level::kBlock, + dlp_rules_manager_->IsRestrictedDestination( + GURL(base::StrCat({kHttpsPrefix, kUrlPattern4})), + GURL(kUrlStr1), DlpRulesManager::Restriction::kClipboard)); +} + } // namespace policy
diff --git a/chrome/browser/chromeos/power/freezer_cgroup_process_manager.cc b/chrome/browser/chromeos/power/freezer_cgroup_process_manager.cc index 7eb84e3..212cef5 100644 --- a/chrome/browser/chromeos/power/freezer_cgroup_process_manager.cc +++ b/chrome/browser/chromeos/power/freezer_cgroup_process_manager.cc
@@ -21,7 +21,8 @@ namespace chromeos { namespace { -const char kFreezerPath[] = "/sys/fs/cgroup/freezer/chrome_renderers"; +const char kFreezerPath[] = + "/sys/fs/cgroup/freezer/early_freezer/chrome_renderers"; const char kToBeFrozen[] = "to_be_frozen"; const char kFreezerState[] = "freezer.state"; const char kCgroupProcs[] = "cgroup.procs";
diff --git a/chrome/browser/chromeos/smb_client/smb_service.cc b/chrome/browser/chromeos/smb_client/smb_service.cc index f86c9885a..32a8fa3 100644 --- a/chrome/browser/chromeos/smb_client/smb_service.cc +++ b/chrome/browser/chromeos/smb_client/smb_service.cc
@@ -182,9 +182,6 @@ SmbService::~SmbService() { net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); - if (chromeos::PowerManagerClient::Get()) { - chromeos::PowerManagerClient::Get()->RemoveObserver(this); - } } void SmbService::Shutdown() { @@ -817,9 +814,6 @@ base::Unretained(this)))); RestoreMounts(); net::NetworkChangeNotifier::AddNetworkChangeObserver(this); - if (chromeos::PowerManagerClient::Get()) { - chromeos::PowerManagerClient::Get()->AddObserver(this); - } if (setup_complete_callback_) { std::move(setup_complete_callback_).Run(); @@ -1023,53 +1017,5 @@ file_systems.size() + smbfs_shares_.size()); } -void SmbService::SuspendImminent( - power_manager::SuspendImminent::Reason reason) { - for (auto it = smbfs_shares_.begin(); it != smbfs_shares_.end(); ++it) { - SmbFsShare* share = it->second.get(); - - // For each share, block suspend until the unmount has completed, to ensure - // that no smbfs instances are active when the system goes to sleep. - auto token = base::UnguessableToken::Create(); - chromeos::PowerManagerClient::Get()->BlockSuspend(token, "SmbService"); - share->Unmount( - base::BindOnce(&SmbService::OnSuspendUnmountDone, AsWeakPtr(), token)); - } -} - -void SmbService::OnSuspendUnmountDone( - base::UnguessableToken power_manager_suspend_token, - chromeos::MountError result) { - LOG_IF(ERROR, result != chromeos::MountError::MOUNT_ERROR_NONE) - << "Could not unmount smbfs share during suspension: " - << static_cast<int>(result); - // Regardless of the outcome, unblock suspension for this share. - chromeos::PowerManagerClient::Get()->UnblockSuspend( - power_manager_suspend_token); -} - -void SmbService::SuspendDone(const base::TimeDelta& sleep_duration) { - for (auto it = smbfs_shares_.begin(); it != smbfs_shares_.end(); ++it) { - SmbFsShare* share = it->second.get(); - const std::string mount_id = share->mount_id(); - - // Don't try to reconnect as we race the network stack in getting an IP - // address. - SmbFsShare::MountOptions options = share->options(); - options.skip_connect = true; - // Observing power management changes from SmbService allows us to remove - // the share in OnSmbfsMountDone if remount fails. - share->Remount( - options, base::BindOnce( - &SmbService::OnSmbfsMountDone, AsWeakPtr(), mount_id, - base::BindOnce([](SmbMountResult result, - const base::FilePath& mount_path) { - LOG_IF(ERROR, result != SmbMountResult::kSuccess) - << "Error remounting smbfs share after suspension: " - << static_cast<int>(result); - }))); - } -} - } // namespace smb_client } // namespace chromeos
diff --git a/chrome/browser/chromeos/smb_client/smb_service.h b/chrome/browser/chromeos/smb_client/smb_service.h index acac449..22c0fe62 100644 --- a/chrome/browser/chromeos/smb_client/smb_service.h +++ b/chrome/browser/chromeos/smb_client/smb_service.h
@@ -25,7 +25,6 @@ #include "chrome/browser/chromeos/smb_client/smb_task_queue.h" #include "chrome/browser/chromeos/smb_client/smbfs_share.h" #include "chrome/browser/profiles/profile.h" -#include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/dbus/smb_provider_client.h" #include "components/keyed_service/core/keyed_service.h" #include "net/base/network_change_notifier.h" @@ -49,7 +48,6 @@ // Creates and manages an smb file system. class SmbService : public KeyedService, public net::NetworkChangeNotifier::NetworkChangeObserver, - public chromeos::PowerManagerClient::Observer, public base::SupportsWeakPtr<SmbService> { public: using MountResponse = base::OnceCallback<void(SmbMountResult result)>; @@ -126,10 +124,6 @@ void SetSmbFsMounterCreationCallbackForTesting( SmbFsShare::MounterCreationCallback callback); - // chromeos::PowerManagerClient::Observer overrides - void SuspendImminent(power_manager::SuspendImminent::Reason reason) override; - void SuspendDone(const base::TimeDelta& sleep_duration) override; - private: friend class SmbServiceTest; @@ -170,11 +164,6 @@ MountInternalCallback callback, SmbMountResult result); - // Callback passed to SmbFsShare::Unmount() during a power management - // suspension. Ensures that suspension is blocked until the unmount completes. - void OnSuspendUnmountDone(base::UnguessableToken power_manager_suspend_token, - chromeos::MountError result); - // Retrieves the mount_id for |file_system_info|. int32_t GetMountId(const ProvidedFileSystemInfo& info) const;
diff --git a/chrome/browser/content_settings/page_specific_content_settings_unittest.cc b/chrome/browser/content_settings/page_specific_content_settings_unittest.cc index b288e19..db6fa864 100644 --- a/chrome/browser/content_settings/page_specific_content_settings_unittest.cc +++ b/chrome/browser/content_settings/page_specific_content_settings_unittest.cc
@@ -61,6 +61,10 @@ // Count should stay same even after multiple usage of permission histograms.ExpectTotalCount(kGeolocationHistogramName, 1); + content_settings->OnContentAllowed(ContentSettingsType::NOTIFICATIONS); + // Count should stay same even if a different permission is used + histograms.ExpectTotalCount(kGeolocationHistogramName, 1); + PageSpecificContentSettings::MicrophoneCameraState microphone_accessed = PageSpecificContentSettings::MICROPHONE_ACCESSED | PageSpecificContentSettings::CAMERA_ACCESSED | @@ -90,6 +94,10 @@ // Count should stay same even after multiple usage of permission histograms.ExpectTotalCount(kMicrophoneHistogramName, 1); histograms.ExpectTotalCount(kCameraHistogramName, 1); + + // Count should stay same even if a different permission is used + histograms.ExpectTotalCount(kMicrophoneHistogramName, 1); + histograms.ExpectTotalCount(kCameraHistogramName, 1); } } // namespace content_settings
diff --git a/chrome/browser/engagement/android/java/src/org/chromium/chrome/browser/engagement/SiteEngagementServiceTest.java b/chrome/browser/engagement/android/java/src/org/chromium/chrome/browser/engagement/SiteEngagementServiceTest.java index a8d805d..f2f57fa 100644 --- a/chrome/browser/engagement/android/java/src/org/chromium/chrome/browser/engagement/SiteEngagementServiceTest.java +++ b/chrome/browser/engagement/android/java/src/org/chromium/chrome/browser/engagement/SiteEngagementServiceTest.java
@@ -14,11 +14,10 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; /** * Test for the Site Engagement Service Java binding. @@ -27,8 +26,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class SiteEngagementServiceTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); /** * Verify that setting the engagement score for a URL and reading it back it works.
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index 6157485..d02c734 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -740,10 +740,12 @@ "//chrome/browser/extensions/api:api_registration", "//chrome/common", "//chrome/common/extensions/api", + "//components/omnibox/browser", "//components/safe_browsing/core:csd_proto", "//components/safe_browsing/core:webprotect_proto", "//components/safe_browsing/core/db:util", "//components/signin/core/browser", + "//components/translate/content/browser", "//content/public/browser", "//mojo/public/cpp/bindings", ] @@ -807,7 +809,6 @@ "//components/nacl/common:buildflags", "//components/navigation_interception", "//components/net_log", - "//components/omnibox/browser", "//components/onc", "//components/page_load_metrics/browser:browser", "//components/password_manager/core/browser", @@ -843,7 +844,6 @@ "//components/sync", "//components/sync_preferences", "//components/sync_sessions", - "//components/translate/content/browser", "//components/translate/core/browser", "//components/translate/core/common", "//components/undo",
diff --git a/chrome/browser/extensions/api/BUILD.gn b/chrome/browser/extensions/api/BUILD.gn index 0747838..6e597f4 100644 --- a/chrome/browser/extensions/api/BUILD.gn +++ b/chrome/browser/extensions/api/BUILD.gn
@@ -27,6 +27,7 @@ # Different APIs include headers from these targets. "//chrome/common:mojo_bindings", + "//components/omnibox/browser", "//components/zoom", "//content/public/browser", "//extensions/browser",
diff --git a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc index a3422c5..342859fe 100644 --- a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc +++ b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
@@ -45,10 +45,10 @@ public: static std::unique_ptr<NativeMessageHost> Create( content::BrowserContext* browser_context) { - return std::unique_ptr<NativeMessageHost>(new EchoHost()); + return std::make_unique<EchoHost>(); } - EchoHost() : message_number_(0), client_(NULL) {} + EchoHost() = default; void Start(Client* client) override { client_ = client; } @@ -81,8 +81,8 @@ client_->PostMessageFromNativeHost(response_string); } - int message_number_; - Client* client_; + int message_number_ = 0; + Client* client_ = nullptr; DISALLOW_COPY_AND_ASSIGN(EchoHost); }; @@ -112,24 +112,6 @@ "chrome-extension://inomeogfingihgjfjlpeplalcfajhgai/", "chrome-extension://hpodccmdligbeohchckkeajbfohibipg/"}; -static const BuiltInHost kBuiltInHost[] = { - {"com.google.chrome.test.echo", // ScopedTestNativeMessagingHost::kHostName - kEchoHostOrigins, base::size(kEchoHostOrigins), &EchoHost::Create}, - {"com.google.chrome.remote_assistance", kRemotingIt2MeOrigins, - base::size(kRemotingIt2MeOrigins), &CreateIt2MeHost}, - {arc::ArcSupportMessageHost::kHostName, - arc::ArcSupportMessageHost::kHostOrigin, 1, - &arc::ArcSupportMessageHost::Create}, - {chromeos::kWilcoDtcSupportdUiMessageHost, - chromeos::kWilcoDtcSupportdHostOrigins, - chromeos::kWilcoDtcSupportdHostOriginsSize, - &chromeos::CreateExtensionOwnedWilcoDtcSupportdMessageHost}, - {drive::kDriveFsNativeMessageHostName, - drive::kDriveFsNativeMessageHostOrigins, - drive::kDriveFsNativeMessageHostOriginsSize, - &drive::CreateDriveFsNativeMessageHost}, -}; - bool MatchesSecurityOrigin(const BuiltInHost& host, const std::string& extension_id) { GURL origin(std::string(kExtensionScheme) + "://" + extension_id); @@ -151,10 +133,27 @@ const std::string& native_host_name, bool allow_user_level, std::string* error) { - for (unsigned int i = 0; i < base::size(kBuiltInHost); i++) { - const BuiltInHost& host = kBuiltInHost[i]; - std::string name(host.name); - if (name == native_host_name) { + static const BuiltInHost kBuiltInHosts[] = { + // ScopedTestNativeMessagingHost::kHostName + {"com.google.chrome.test.echo", kEchoHostOrigins, + base::size(kEchoHostOrigins), &EchoHost::Create}, + {"com.google.chrome.remote_assistance", kRemotingIt2MeOrigins, + base::size(kRemotingIt2MeOrigins), &CreateIt2MeHost}, + {arc::ArcSupportMessageHost::kHostName, + arc::ArcSupportMessageHost::kHostOrigin, 1, + &arc::ArcSupportMessageHost::Create}, + {chromeos::kWilcoDtcSupportdUiMessageHost, + chromeos::kWilcoDtcSupportdHostOrigins, + chromeos::kWilcoDtcSupportdHostOriginsSize, + &chromeos::CreateExtensionOwnedWilcoDtcSupportdMessageHost}, + {drive::kDriveFsNativeMessageHostName, + drive::kDriveFsNativeMessageHostOrigins, + drive::kDriveFsNativeMessageHostOriginsSize, + &drive::CreateDriveFsNativeMessageHost}, + }; + + for (const BuiltInHost& host : kBuiltInHosts) { + if (host.name == native_host_name) { if (MatchesSecurityOrigin(host, source_extension_id)) { return (*host.create_function)(browser_context); }
diff --git a/chrome/browser/federated_learning/floc_id_provider_browsertest.cc b/chrome/browser/federated_learning/floc_id_provider_browsertest.cc index f2b4c1d..d3b1523 100644 --- a/chrome/browser/federated_learning/floc_id_provider_browsertest.cc +++ b/chrome/browser/federated_learning/floc_id_provider_browsertest.cc
@@ -332,7 +332,7 @@ EXPECT_EQ(1u, GetHistoryUrls().size()); - EXPECT_EQ(GetFlocId().ToDebugHeaderValue(), FlocId().ToDebugHeaderValue()); + EXPECT_EQ(GetFlocId(), FlocId()); InitializeBlocklist({}); @@ -362,7 +362,7 @@ EXPECT_EQ(1u, GetHistoryUrls().size()); - EXPECT_EQ(GetFlocId().ToDebugHeaderValue(), FlocId().ToDebugHeaderValue()); + EXPECT_EQ(GetFlocId(), FlocId()); InitializeBlocklist({}); @@ -382,7 +382,7 @@ EXPECT_EQ(1u, GetHistoryUrls().size()); - EXPECT_EQ(GetFlocId().ToDebugHeaderValue(), FlocId().ToDebugHeaderValue()); + EXPECT_EQ(GetFlocId(), FlocId()); InitializeBlocklist({}); @@ -419,7 +419,7 @@ EXPECT_EQ(1u, GetHistoryUrls().size()); - EXPECT_EQ(GetFlocId().ToDebugHeaderValue(), FlocId().ToDebugHeaderValue()); + EXPECT_EQ(GetFlocId(), FlocId()); // Load a blocklist that would block the upcoming floc. InitializeBlocklist({FlocId::CreateFromHistory({test_host()}).ToUint64()}); @@ -440,7 +440,7 @@ EXPECT_EQ(1u, GetHistoryUrls().size()); - EXPECT_EQ(GetFlocId().ToDebugHeaderValue(), FlocId().ToDebugHeaderValue()); + EXPECT_EQ(GetFlocId(), FlocId()); // Load a blocklist that would block a floc different from the upcoming floc. InitializeBlocklist({FlocId::CreateFromHistory({"b.test"}).ToUint64()});
diff --git a/chrome/browser/federated_learning/floc_id_provider_impl.cc b/chrome/browser/federated_learning/floc_id_provider_impl.cc index b2257ee7..0d84f33 100644 --- a/chrome/browser/federated_learning/floc_id_provider_impl.cc +++ b/chrome/browser/federated_learning/floc_id_provider_impl.cc
@@ -80,6 +80,33 @@ return floc_id_.ToString(); } +void FlocIdProviderImpl::OnComputeFlocCompleted(ComputeFlocTrigger trigger, + FlocId floc_id) { + DCHECK(floc_computation_in_progress_); + floc_computation_in_progress_ = false; + + // Some recompute event came in when this computation was in progress. Ignore + // this computation completely. Handle the pending one. + if (pending_recompute_event_) { + ComputeFlocTrigger recompute_trigger = pending_recompute_event_.value(); + pending_recompute_event_.reset(); + ComputeFloc(recompute_trigger); + return; + } + + if (floc_id_ != floc_id) { + floc_id_ = floc_id; + NotifyFlocUpdated(trigger); + } + + // Abandon the scheduled task if any, and schedule a new compute-floc task + // that is |kFlocScheduledUpdateInterval| from now. + compute_floc_timer_.Start( + FROM_HERE, kFlocScheduledUpdateInterval, + base::BindOnce(&FlocIdProviderImpl::OnComputeFlocScheduledUpdate, + weak_ptr_factory_.GetWeakPtr())); +} + void FlocIdProviderImpl::NotifyFlocUpdated(ComputeFlocTrigger trigger) { if (!base::FeatureList::IsEnabled(features::kFlocIdComputedEventLogging)) return; @@ -115,6 +142,122 @@ user_event_service_->RecordUserEvent(std::move(specifics)); } +void FlocIdProviderImpl::Shutdown() { + if (sync_service_) + sync_service_->RemoveObserver(this); + sync_service_ = nullptr; + + if (history_service_) + history_service_->RemoveObserver(this); + history_service_ = nullptr; + + g_browser_process->floc_blocklist_service()->RemoveObserver(this); +} + +void FlocIdProviderImpl::OnURLsDeleted( + history::HistoryService* history_service, + const history::DeletionInfo& deletion_info) { + // Set a pending event or override the existing one, that will get run when + // the in-progress computation finishes. + if (floc_computation_in_progress_) { + DCHECK(first_floc_computation_triggered_); + pending_recompute_event_ = ComputeFlocTrigger::kHistoryDelete; + return; + } + + if (!first_floc_computation_triggered_ || !floc_id_.IsValid()) + return; + + ComputeFloc(ComputeFlocTrigger::kHistoryDelete); +} + +void FlocIdProviderImpl::OnBlocklistLoaded() { + if (first_blocklist_loaded_seen_) + return; + + first_blocklist_loaded_seen_ = true; + + MaybeTriggerFirstFlocComputation(); +} + +void FlocIdProviderImpl::OnStateChanged(syncer::SyncService* sync_service) { + if (first_sync_history_enabled_seen_) + return; + + if (!IsSyncHistoryEnabled()) + return; + + first_sync_history_enabled_seen_ = true; + + MaybeTriggerFirstFlocComputation(); +} + +void FlocIdProviderImpl::MaybeTriggerFirstFlocComputation() { + if (first_floc_computation_triggered_) + return; + + if (!first_sync_history_enabled_seen_ || + (base::FeatureList::IsEnabled(features::kFlocIdBlocklistFiltering) && + !first_blocklist_loaded_seen_)) { + return; + } + + ComputeFloc(ComputeFlocTrigger::kBrowserStart); +} + +void FlocIdProviderImpl::OnComputeFlocScheduledUpdate() { + // It's fine to skip the scheduled update as long as there's one in progress. + // We won't be losing the recomputing frequency, as the in-progress one only + // occurs sooner and when it finishes a new compute-floc task will be + // scheduled. + if (floc_computation_in_progress_) + return; + + DCHECK(!pending_recompute_event_); + + ComputeFloc(ComputeFlocTrigger::kScheduledUpdate); +} + +void FlocIdProviderImpl::ComputeFloc(ComputeFlocTrigger trigger) { + DCHECK_NE(trigger == ComputeFlocTrigger::kBrowserStart, + first_floc_computation_triggered_); + DCHECK(!floc_computation_in_progress_); + + floc_computation_in_progress_ = true; + first_floc_computation_triggered_ = true; + + auto compute_floc_completed_callback = + base::BindOnce(&FlocIdProviderImpl::OnComputeFlocCompleted, + weak_ptr_factory_.GetWeakPtr(), trigger); + + CheckCanComputeFloc( + base::BindOnce(&FlocIdProviderImpl::OnCheckCanComputeFlocCompleted, + weak_ptr_factory_.GetWeakPtr(), + std::move(compute_floc_completed_callback))); +} + +void FlocIdProviderImpl::CheckCanComputeFloc(CanComputeFlocCallback callback) { + if (!IsSyncHistoryEnabled() || !AreThirdPartyCookiesAllowed()) { + std::move(callback).Run(false); + return; + } + + IsSwaaNacAccountEnabled(std::move(callback)); +} + +void FlocIdProviderImpl::OnCheckCanComputeFlocCompleted( + ComputeFlocCompletedCallback callback, + bool can_compute_floc) { + if (!can_compute_floc) { + std::move(callback).Run(FlocId()); + return; + } + + GetRecentlyVisitedURLs( + base::BindOnce(&FlocIdProviderImpl::OnGetRecentlyVisitedURLsCompleted, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); +} + bool FlocIdProviderImpl::IsSyncHistoryEnabled() const { syncer::SyncUserSettings* setting = sync_service_->GetUserSettings(); DCHECK(setting); @@ -173,134 +316,6 @@ partial_traffic_annotation); } -void FlocIdProviderImpl::Shutdown() { - if (sync_service_) - sync_service_->RemoveObserver(this); - sync_service_ = nullptr; - - if (history_service_) - history_service_->RemoveObserver(this); - history_service_ = nullptr; - - g_browser_process->floc_blocklist_service()->RemoveObserver(this); -} - -void FlocIdProviderImpl::OnURLsDeleted( - history::HistoryService* history_service, - const history::DeletionInfo& deletion_info) { - if (!first_floc_computation_triggered_ || !floc_id_.IsValid()) - return; - - ComputeFloc(ComputeFlocTrigger::kHistoryDelete); -} - -void FlocIdProviderImpl::OnBlocklistLoaded() { - if (first_blocklist_loaded_seen_) - return; - - first_blocklist_loaded_seen_ = true; - - MaybeTriggerFirstFlocComputation(); -} - -void FlocIdProviderImpl::OnStateChanged(syncer::SyncService* sync_service) { - if (first_sync_history_enabled_seen_) - return; - - if (!IsSyncHistoryEnabled()) - return; - - first_sync_history_enabled_seen_ = true; - - MaybeTriggerFirstFlocComputation(); -} - -void FlocIdProviderImpl::MaybeTriggerFirstFlocComputation() { - if (first_floc_computation_triggered_) - return; - - if (!first_sync_history_enabled_seen_ || - (base::FeatureList::IsEnabled(features::kFlocIdBlocklistFiltering) && - !first_blocklist_loaded_seen_)) { - return; - } - - ComputeFloc(ComputeFlocTrigger::kBrowserStart); -} - -void FlocIdProviderImpl::ComputeFloc(ComputeFlocTrigger trigger) { - DCHECK_NE(trigger == ComputeFlocTrigger::kBrowserStart, - first_floc_computation_triggered_); - - DCHECK(trigger != ComputeFlocTrigger::kBrowserStart || - !floc_computation_in_progress_); - - // It's fine to skip computing as long as there's one in progress: - // 1) If the incoming computation was triggered by history deletion, then the - // in-progress one must haven't got its history query result (if it would - // reach that stage), so the history query result wouldn't contain the - // deleted entries anyway. - // 2) If the incoming computation was triggered by scheduled update and is - // ignored, we won't be losing the recomputing frequency, as the - // in-progress one only occurs sooner and when it finishes a new - // compute-floc task will be scheduled. - if (floc_computation_in_progress_) - return; - - floc_computation_in_progress_ = true; - first_floc_computation_triggered_ = true; - - auto compute_floc_completed_callback = - base::BindOnce(&FlocIdProviderImpl::OnComputeFlocCompleted, - weak_ptr_factory_.GetWeakPtr(), trigger); - - CheckCanComputeFloc( - base::BindOnce(&FlocIdProviderImpl::OnCheckCanComputeFlocCompleted, - weak_ptr_factory_.GetWeakPtr(), - std::move(compute_floc_completed_callback))); -} - -void FlocIdProviderImpl::OnComputeFlocCompleted(ComputeFlocTrigger trigger, - FlocId floc_id) { - DCHECK(floc_computation_in_progress_); - floc_computation_in_progress_ = false; - - if (floc_id_ != floc_id) { - floc_id_ = floc_id; - NotifyFlocUpdated(trigger); - } - - // Abandon the scheduled task if any, and schedule a new compute-floc task - // that is |kFlocScheduledUpdateInterval| from now. - compute_floc_timer_.Start( - FROM_HERE, kFlocScheduledUpdateInterval, - base::BindOnce(&FlocIdProviderImpl::ComputeFloc, - weak_ptr_factory_.GetWeakPtr(), - ComputeFlocTrigger::kScheduledUpdate)); -} - -void FlocIdProviderImpl::CheckCanComputeFloc(CanComputeFlocCallback callback) { - if (!IsSyncHistoryEnabled() || !AreThirdPartyCookiesAllowed()) { - std::move(callback).Run(false); - return; - } - - IsSwaaNacAccountEnabled(std::move(callback)); -} - -void FlocIdProviderImpl::OnCheckCanComputeFlocCompleted( - ComputeFlocCompletedCallback callback, - bool can_compute_floc) { - if (!can_compute_floc) { - std::move(callback).Run(FlocId()); - return; - } - - GetRecentlyVisitedURLs( - base::BindOnce(&FlocIdProviderImpl::OnGetRecentlyVisitedURLsCompleted, - weak_ptr_factory_.GetWeakPtr(), std::move(callback))); -} - void FlocIdProviderImpl::OnCheckSwaaNacAccountEnabledCompleted( CanComputeFlocCallback callback, bool enabled) { @@ -336,11 +351,22 @@ ? FlocId::CreateFromHistory(domains) : FlocId(); - if (floc_id.IsValid() && - base::FeatureList::IsEnabled(features::kFlocIdBlocklistFiltering) && + ApplyAdditionalFiltering(std::move(callback), floc_id); +} + +void FlocIdProviderImpl::ApplyAdditionalFiltering( + ComputeFlocCompletedCallback callback, + const FlocId& floc_id) { + if (!floc_id.IsValid()) { + std::move(callback).Run(floc_id); + return; + } + + if (base::FeatureList::IsEnabled(features::kFlocIdBlocklistFiltering) && g_browser_process->floc_blocklist_service()->ShouldBlockFloc( floc_id.ToUint64())) { - floc_id = FlocId(); + std::move(callback).Run(FlocId()); + return; } std::move(callback).Run(floc_id);
diff --git a/chrome/browser/federated_learning/floc_id_provider_impl.h b/chrome/browser/federated_learning/floc_id_provider_impl.h index c62e879a..b01d55d0 100644 --- a/chrome/browser/federated_learning/floc_id_provider_impl.h +++ b/chrome/browser/federated_learning/floc_id_provider_impl.h
@@ -75,10 +75,9 @@ protected: // protected virtual for testing. + virtual void OnComputeFlocCompleted(ComputeFlocTrigger trigger, + FlocId floc_id); virtual void NotifyFlocUpdated(ComputeFlocTrigger trigger); - virtual bool IsSyncHistoryEnabled() const; - virtual bool AreThirdPartyCookiesAllowed() const; - virtual void IsSwaaNacAccountEnabled(CanComputeFlocCallback callback); private: friend class FlocIdProviderUnitTest; @@ -102,13 +101,18 @@ void MaybeTriggerFirstFlocComputation(); + void OnComputeFlocScheduledUpdate(); + void ComputeFloc(ComputeFlocTrigger trigger); - void OnComputeFlocCompleted(ComputeFlocTrigger trigger, FlocId floc_id); void CheckCanComputeFloc(CanComputeFlocCallback callback); void OnCheckCanComputeFlocCompleted(ComputeFlocCompletedCallback callback, bool can_compute_floc); + bool IsSyncHistoryEnabled() const; + bool AreThirdPartyCookiesAllowed() const; + + void IsSwaaNacAccountEnabled(CanComputeFlocCallback callback); void OnCheckSwaaNacAccountEnabledCompleted(CanComputeFlocCallback callback, bool enabled); @@ -116,10 +120,20 @@ void OnGetRecentlyVisitedURLsCompleted(ComputeFlocCompletedCallback callback, history::QueryResults results); + // Apply any additional filtering or transformation on a floc computed from + // history. For example, invalidate it if it's in the blocklist. + void ApplyAdditionalFiltering(ComputeFlocCompletedCallback callback, + const FlocId& floc_id); + FlocId floc_id_; bool floc_computation_in_progress_ = false; bool first_floc_computation_triggered_ = false; + // We store a pending event if it arrives during an in-progress computation. + // When the in-progress one finishes, we would disregard the result (no + // loggings, updates, etc.), and compute again. + base::Optional<ComputeFlocTrigger> pending_recompute_event_; + bool first_blocklist_loaded_seen_ = false; bool first_sync_history_enabled_seen_ = false;
diff --git a/chrome/browser/federated_learning/floc_id_provider_unittest.cc b/chrome/browser/federated_learning/floc_id_provider_unittest.cc index e4ca857..b0d5cb1 100644 --- a/chrome/browser/federated_learning/floc_id_provider_unittest.cc +++ b/chrome/browser/federated_learning/floc_id_provider_unittest.cc
@@ -30,6 +30,8 @@ namespace { +using ComputeFlocTrigger = FlocIdProviderImpl::ComputeFlocTrigger; + class FakeFlocRemotePermissionService : public FlocRemotePermissionService { public: using FlocRemotePermissionService::FlocRemotePermissionService; @@ -85,18 +87,74 @@ public: using FlocIdProviderImpl::FlocIdProviderImpl; - void NotifyFlocUpdated( - FlocIdProviderImpl::ComputeFlocTrigger trigger) override { + void OnComputeFlocCompleted(ComputeFlocTrigger trigger, + FlocId floc_id) override { + if (should_pause_before_compute_floc_completed_) { + DCHECK(!paused_); + paused_ = true; + paused_trigger_ = trigger; + paused_floc_id_ = floc_id; + return; + } + + ++compute_floc_completed_count_; + FlocIdProviderImpl::OnComputeFlocCompleted(trigger, floc_id); + } + + void ContinueLastOnComputeFlocCompleted() { + DCHECK(paused_); + paused_ = false; + ++compute_floc_completed_count_; + FlocIdProviderImpl::OnComputeFlocCompleted(paused_trigger_, + paused_floc_id_); + } + + void NotifyFlocUpdated(ComputeFlocTrigger trigger) override { ++floc_update_notification_count_; + last_notification_trigger_ = trigger; FlocIdProviderImpl::NotifyFlocUpdated(trigger); } + size_t compute_floc_completed_count() const { + return compute_floc_completed_count_; + } + size_t floc_update_notification_count() const { return floc_update_notification_count_; } + void set_should_pause_before_compute_floc_completed(bool should_pause) { + should_pause_before_compute_floc_completed_ = should_pause; + } + + FlocId paused_floc_id() const { + DCHECK(paused_); + return paused_floc_id_; + } + + ComputeFlocTrigger paused_trigger() const { + DCHECK(paused_); + return paused_trigger_; + } + + ComputeFlocTrigger last_notification_trigger() const { + DCHECK_LT(0u, floc_update_notification_count_); + return last_notification_trigger_; + } + private: + base::OnceCallback<void()> callback_before_compute_floc_completed_; + + // Add the support to be able to pause on the OnComputeFlocCompleted + // execution and let it yield to other tasks posted to the same task runner. + bool should_pause_before_compute_floc_completed_ = false; + bool paused_ = false; + ComputeFlocTrigger paused_trigger_; + FlocId paused_floc_id_; + + size_t compute_floc_completed_count_ = 0u; size_t floc_update_notification_count_ = 0u; + ComputeFlocTrigger last_notification_trigger_; }; } // namespace @@ -109,7 +167,7 @@ ~FlocIdProviderUnitTest() override = default; void SetUp() override { - ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); + EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); content_settings::ContentSettingsRegistry::GetInstance()->ResetForTest(); content_settings::CookieSettings::RegisterProfilePrefs(prefs_.registry()); @@ -166,9 +224,8 @@ floc_id_provider_->OnURLsDeleted(history_service, deletion_info); } - void OnGetRecentlyVisitedURLsCompleted( - FlocIdProviderImpl::ComputeFlocTrigger trigger, - history::QueryResults results) { + void OnGetRecentlyVisitedURLsCompleted(ComputeFlocTrigger trigger, + history::QueryResults results) { auto compute_floc_completed_callback = base::BindOnce(&FlocIdProviderImpl::OnComputeFlocCompleted, base::Unretained(floc_id_provider_.get()), trigger); @@ -178,11 +235,10 @@ } void ExpireHistoryBefore(base::Time end_time) { - base::RunLoop run_loop; base::CancelableTaskTracker tracker; + base::RunLoop run_loop; history_service_->ExpireHistoryBeforeForTesting( - end_time, base::BindLambdaForTesting([&]() { run_loop.Quit(); }), - &tracker); + end_time, run_loop.QuitClosure(), &tracker); run_loop.Run(); } @@ -213,10 +269,18 @@ floc_id_provider_->floc_id_ = floc_id; } + base::Optional<ComputeFlocTrigger> pending_recompute_event() { + return floc_id_provider_->pending_recompute_event_; + } + void SetRemoteSwaaNacAccountEnabled(bool enabled) { fake_floc_remote_permission_service_->set_swaa_nac_account_enabled(enabled); } + void ForceScheduledUpdate() { + floc_id_provider_->OnComputeFlocScheduledUpdate(); + } + void OnBlocklistLoaded(const std::unordered_set<uint64_t>& blocklist) { g_browser_process->floc_blocklist_service()->OnBlocklistLoadResult( blocklist); @@ -255,9 +319,10 @@ // Expect that the floc computation hasn't started, as the floc_id_provider // hasn't been notified about state of the sync_service. - ASSERT_EQ(0u, floc_id_provider_->floc_update_notification_count()); - ASSERT_FALSE(floc_id().IsValid()); - ASSERT_FALSE(first_floc_computation_triggered()); + EXPECT_EQ(0u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(0u, floc_id_provider_->floc_update_notification_count()); + EXPECT_FALSE(floc_id().IsValid()); + EXPECT_FALSE(first_floc_computation_triggered()); // Trigger the 1st floc computation. test_sync_service_->SetTransportState( @@ -267,18 +332,19 @@ task_environment_.RunUntilIdle(); // Expect a floc id update notification. - ASSERT_EQ(1u, floc_id_provider_->floc_update_notification_count()); - ASSERT_TRUE(floc_id().IsValid()); - ASSERT_EQ(FlocId::CreateFromHistory({domain}).ToDebugHeaderValue(), - floc_id().ToDebugHeaderValue()); - ASSERT_TRUE(first_floc_computation_triggered()); + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_TRUE(floc_id().IsValid()); + EXPECT_EQ(FlocId::CreateFromHistory({domain}), floc_id()); + EXPECT_TRUE(first_floc_computation_triggered()); // Advance the clock by 1 day. Expect a floc id update notification, as // there's no history in the last 7 days so the id has been reset to empty. task_environment_.FastForwardBy(base::TimeDelta::FromDays(1)); - ASSERT_EQ(2u, floc_id_provider_->floc_update_notification_count()); - ASSERT_FALSE(floc_id().IsValid()); + EXPECT_EQ(2u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(2u, floc_id_provider_->floc_update_notification_count()); + EXPECT_FALSE(floc_id().IsValid()); } TEST_F(FlocIdProviderUnitTest, UnqualifiedInitialHistory) { @@ -295,9 +361,10 @@ // Expect that the floc computation hasn't started, as the floc_id_provider // hasn't been notified about state of the sync_service. - ASSERT_EQ(0u, floc_id_provider_->floc_update_notification_count()); - ASSERT_FALSE(floc_id().IsValid()); - ASSERT_FALSE(first_floc_computation_triggered()); + EXPECT_EQ(0u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(0u, floc_id_provider_->floc_update_notification_count()); + EXPECT_FALSE(floc_id().IsValid()); + EXPECT_FALSE(first_floc_computation_triggered()); // Trigger the 1st floc computation. test_sync_service_->SetTransportState( @@ -308,8 +375,9 @@ // Expect no floc id update notification, as there is no qualified history // entry. However, the 1st computation should already have started. - ASSERT_EQ(0u, floc_id_provider_->floc_update_notification_count()); - ASSERT_TRUE(first_floc_computation_triggered()); + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(0u, floc_id_provider_->floc_update_notification_count()); + EXPECT_TRUE(first_floc_computation_triggered()); // Add a history entry with a timestamp 6 days back from now. add_page_args.time = base::Time::Now() - base::TimeDelta::FromDays(6); @@ -319,17 +387,18 @@ // as the id refresh interval is 24 hours. task_environment_.FastForwardBy(base::TimeDelta::FromHours(23)); - ASSERT_EQ(0u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(0u, floc_id_provider_->floc_update_notification_count()); // Advance the clock by 1 hour. Expect a floc id update notification, as the // refresh time is reached and there's a valid history entry in the last 7 // days. task_environment_.FastForwardBy(base::TimeDelta::FromHours(1)); - ASSERT_EQ(1u, floc_id_provider_->floc_update_notification_count()); - ASSERT_TRUE(floc_id().IsValid()); - ASSERT_EQ(FlocId::CreateFromHistory({domain}).ToDebugHeaderValue(), - floc_id().ToDebugHeaderValue()); + EXPECT_EQ(2u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_TRUE(floc_id().IsValid()); + EXPECT_EQ(FlocId::CreateFromHistory({domain}), floc_id()); } TEST_F(FlocIdProviderUnitTest, HistoryDeleteAndScheduledUpdate) { @@ -358,14 +427,15 @@ task_environment_.RunUntilIdle(); // Expect a floc id update notification. - ASSERT_EQ(1u, floc_id_provider_->floc_update_notification_count()); - ASSERT_TRUE(floc_id().IsValid()); - ASSERT_EQ(FlocId::CreateFromHistory({domain1, domain2}).ToDebugHeaderValue(), - floc_id().ToDebugHeaderValue()); + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_TRUE(floc_id().IsValid()); + EXPECT_EQ(FlocId::CreateFromHistory({domain1, domain2}), floc_id()); // Advance the clock by 12 hours. Expect no floc id update notification. task_environment_.FastForwardBy(base::TimeDelta::FromHours(12)); - ASSERT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); // Expire the oldest history entry. ExpireHistoryBefore(base::Time::Now() - base::TimeDelta::FromDays(7)); @@ -373,22 +443,24 @@ // Expect a floc id update notification as it was just recomputed due to the // history deletion. - ASSERT_EQ(2u, floc_id_provider_->floc_update_notification_count()); - ASSERT_TRUE(floc_id().IsValid()); - ASSERT_EQ(FlocId::CreateFromHistory({domain2}).ToDebugHeaderValue(), - floc_id().ToDebugHeaderValue()); + EXPECT_EQ(2u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(2u, floc_id_provider_->floc_update_notification_count()); + EXPECT_TRUE(floc_id().IsValid()); + EXPECT_EQ(FlocId::CreateFromHistory({domain2}), floc_id()); // Advance the clock by 23 hours. Expect no floc id update notification as the // timer has been reset due to the recomputation from history deletion. task_environment_.FastForwardBy(base::TimeDelta::FromHours(23)); - ASSERT_EQ(2u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(2u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(2u, floc_id_provider_->floc_update_notification_count()); // Advance the clock by 1 hour. Expect an floc id update notification as the // scheduled time is reached. Expect an invalid floc id as there is no history // in the past 7 days. task_environment_.FastForwardBy(base::TimeDelta::FromHours(1)); - ASSERT_EQ(3u, floc_id_provider_->floc_update_notification_count()); - ASSERT_FALSE(floc_id().IsValid()); + EXPECT_EQ(3u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(3u, floc_id_provider_->floc_update_notification_count()); + EXPECT_FALSE(floc_id().IsValid()); } TEST_F(FlocIdProviderUnitTest, ScheduledUpdateSameFloc_NoNotification) { @@ -411,13 +483,15 @@ task_environment_.RunUntilIdle(); // Expect a floc id update notification. - ASSERT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); // Advance the clock by 1 day. Expect no additional floc id update // notification, as the floc didn't change. task_environment_.FastForwardBy(base::TimeDelta::FromDays(1)); - ASSERT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(2u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); } TEST_F(FlocIdProviderUnitTest, CheckCanComputeFloc_Success) { @@ -425,7 +499,7 @@ syncer::SyncService::TransportState::ACTIVE); base::OnceCallback<void(bool)> cb = base::BindOnce( - [](bool can_compute_floc) { ASSERT_TRUE(can_compute_floc); }); + [](bool can_compute_floc) { EXPECT_TRUE(can_compute_floc); }); CheckCanComputeFloc(std::move(cb)); task_environment_.RunUntilIdle(); @@ -433,7 +507,7 @@ TEST_F(FlocIdProviderUnitTest, CheckCanComputeFloc_Failure_SyncDisabled) { base::OnceCallback<void(bool)> cb = base::BindOnce( - [](bool can_compute_floc) { ASSERT_FALSE(can_compute_floc); }); + [](bool can_compute_floc) { EXPECT_FALSE(can_compute_floc); }); CheckCanComputeFloc(std::move(cb)); task_environment_.RunUntilIdle(); @@ -447,7 +521,7 @@ fake_cookie_settings_->set_should_block_third_party_cookies(true); base::OnceCallback<void(bool)> cb = base::BindOnce( - [](bool can_compute_floc) { ASSERT_FALSE(can_compute_floc); }); + [](bool can_compute_floc) { EXPECT_FALSE(can_compute_floc); }); CheckCanComputeFloc(std::move(cb)); task_environment_.RunUntilIdle(); @@ -461,7 +535,7 @@ SetRemoteSwaaNacAccountEnabled(false); base::OnceCallback<void(bool)> cb = base::BindOnce( - [](bool can_compute_floc) { ASSERT_FALSE(can_compute_floc); }); + [](bool can_compute_floc) { EXPECT_FALSE(can_compute_floc); }); CheckCanComputeFloc(std::move(cb)); task_environment_.RunUntilIdle(); @@ -469,7 +543,7 @@ TEST_F(FlocIdProviderUnitTest, SwaaNacAccountEnabledUseCacheStatus) { base::OnceCallback<void(bool)> assert_enabled_callback_1 = base::BindOnce( - [](bool can_compute_floc) { ASSERT_TRUE(can_compute_floc); }); + [](bool can_compute_floc) { EXPECT_TRUE(can_compute_floc); }); // The permission status in the fake_floc_remote_premission_service_ is by // default enabled. @@ -480,7 +554,7 @@ SetRemoteSwaaNacAccountEnabled(false); base::OnceCallback<void(bool)> assert_enabled_callback_2 = base::BindOnce( - [](bool can_compute_floc) { ASSERT_TRUE(can_compute_floc); }); + [](bool can_compute_floc) { EXPECT_TRUE(can_compute_floc); }); // Fast forward by 11 hours. The cache is still valid. task_environment_.FastForwardBy(base::TimeDelta::FromHours(11)); @@ -494,7 +568,7 @@ task_environment_.FastForwardBy(base::TimeDelta::FromHours(1)); base::OnceCallback<void(bool)> assert_disabled_callback = base::BindOnce( - [](bool can_compute_floc) { ASSERT_FALSE(can_compute_floc); }); + [](bool can_compute_floc) { EXPECT_FALSE(can_compute_floc); }); // The permission status should be obtained from the server again, and it's // now disabled. @@ -507,10 +581,9 @@ feature_list.InitAndEnableFeature(features::kFlocIdComputedEventLogging); set_floc_id(FlocId(12345ULL)); - floc_id_provider_->NotifyFlocUpdated( - FlocIdProviderImpl::ComputeFlocTrigger::kBrowserStart); + floc_id_provider_->NotifyFlocUpdated(ComputeFlocTrigger::kBrowserStart); - ASSERT_EQ(1u, fake_user_event_service_->GetRecordedUserEvents().size()); + EXPECT_EQ(1u, fake_user_event_service_->GetRecordedUserEvents().size()); const sync_pb::UserEventSpecifics& specifics1 = fake_user_event_service_->GetRecordedUserEvents()[0]; EXPECT_EQ(specifics1.event_time_usec(), @@ -528,10 +601,9 @@ task_environment_.FastForwardBy(base::TimeDelta::FromDays(3)); set_floc_id(FlocId(999ULL)); - floc_id_provider_->NotifyFlocUpdated( - FlocIdProviderImpl::ComputeFlocTrigger::kScheduledUpdate); + floc_id_provider_->NotifyFlocUpdated(ComputeFlocTrigger::kScheduledUpdate); - ASSERT_EQ(2u, fake_user_event_service_->GetRecordedUserEvents().size()); + EXPECT_EQ(2u, fake_user_event_service_->GetRecordedUserEvents().size()); const sync_pb::UserEventSpecifics& specifics2 = fake_user_event_service_->GetRecordedUserEvents()[1]; EXPECT_EQ(specifics2.event_time_usec(), @@ -546,10 +618,9 @@ EXPECT_EQ(999ULL, event2.floc_id()); set_floc_id(FlocId()); - floc_id_provider_->NotifyFlocUpdated( - FlocIdProviderImpl::ComputeFlocTrigger::kScheduledUpdate); + floc_id_provider_->NotifyFlocUpdated(ComputeFlocTrigger::kScheduledUpdate); - ASSERT_EQ(3u, fake_user_event_service_->GetRecordedUserEvents().size()); + EXPECT_EQ(3u, fake_user_event_service_->GetRecordedUserEvents().size()); const sync_pb::UserEventSpecifics& specifics3 = fake_user_event_service_->GetRecordedUserEvents()[2]; EXPECT_EQ(specifics3.event_time_usec(), @@ -564,10 +635,9 @@ EXPECT_FALSE(event3.has_floc_id()); set_floc_id(FlocId(555)); - floc_id_provider_->NotifyFlocUpdated( - FlocIdProviderImpl::ComputeFlocTrigger::kHistoryDelete); + floc_id_provider_->NotifyFlocUpdated(ComputeFlocTrigger::kHistoryDelete); - ASSERT_EQ(4u, fake_user_event_service_->GetRecordedUserEvents().size()); + EXPECT_EQ(4u, fake_user_event_service_->GetRecordedUserEvents().size()); const sync_pb::UserEventSpecifics& specifics4 = fake_user_event_service_->GetRecordedUserEvents()[3]; EXPECT_EQ(specifics4.event_time_usec(), @@ -594,13 +664,13 @@ set_first_floc_computation_triggered(true); set_floc_computation_in_progress(true); - OnGetRecentlyVisitedURLsCompleted( - FlocIdProviderImpl::ComputeFlocTrigger::kBrowserStart, - std::move(query_results)); - ASSERT_TRUE(floc_id().IsValid()); + OnGetRecentlyVisitedURLsCompleted(ComputeFlocTrigger::kBrowserStart, + std::move(query_results)); + EXPECT_FALSE(floc_computation_in_progress()); + EXPECT_TRUE(floc_id().IsValid()); OnURLsDeleted(history_service_.get(), history::DeletionInfo::ForAllHistory()); - ASSERT_FALSE(floc_id().IsValid()); + EXPECT_FALSE(floc_id().IsValid()); } TEST_F(FlocIdProviderUnitTest, HistoryDelete_InvalidTimeRange) { @@ -617,16 +687,16 @@ set_first_floc_computation_triggered(true); set_floc_computation_in_progress(true); - OnGetRecentlyVisitedURLsCompleted( - FlocIdProviderImpl::ComputeFlocTrigger::kBrowserStart, - std::move(query_results)); - ASSERT_TRUE(floc_id().IsValid()); + OnGetRecentlyVisitedURLsCompleted(ComputeFlocTrigger::kBrowserStart, + std::move(query_results)); + EXPECT_FALSE(floc_computation_in_progress()); + EXPECT_TRUE(floc_id().IsValid()); OnURLsDeleted(history_service_.get(), history::DeletionInfo::ForUrls( {history::URLResult(url_a, base::Time())}, {})); task_environment_.RunUntilIdle(); - ASSERT_FALSE(floc_id().IsValid()); + EXPECT_FALSE(floc_id().IsValid()); } TEST_F(FlocIdProviderUnitTest, HistoryDelete_TimeRange) { @@ -641,10 +711,10 @@ set_first_floc_computation_triggered(true); set_floc_computation_in_progress(true); - OnGetRecentlyVisitedURLsCompleted( - FlocIdProviderImpl::ComputeFlocTrigger::kBrowserStart, - std::move(query_results)); - ASSERT_TRUE(floc_id().IsValid()); + OnGetRecentlyVisitedURLsCompleted(ComputeFlocTrigger::kBrowserStart, + std::move(query_results)); + EXPECT_FALSE(floc_computation_in_progress()); + EXPECT_TRUE(floc_id().IsValid()); history::DeletionInfo deletion_info(history::DeletionTimeRange(time, time), false, {}, {}, @@ -652,7 +722,7 @@ OnURLsDeleted(history_service_.get(), deletion_info); task_environment_.RunUntilIdle(); - ASSERT_FALSE(floc_id().IsValid()); + EXPECT_FALSE(floc_id().IsValid()); } TEST_F(FlocIdProviderUnitTest, HistoryEntriesWithPrivateIP) { @@ -664,11 +734,10 @@ set_first_floc_computation_triggered(true); set_floc_computation_in_progress(true); - OnGetRecentlyVisitedURLsCompleted( - FlocIdProviderImpl::ComputeFlocTrigger::kBrowserStart, - std::move(query_results)); + OnGetRecentlyVisitedURLsCompleted(ComputeFlocTrigger::kBrowserStart, + std::move(query_results)); - ASSERT_FALSE(floc_id().IsValid()); + EXPECT_FALSE(floc_id().IsValid()); } TEST_F(FlocIdProviderUnitTest, MultipleHistoryEntries) { @@ -691,13 +760,10 @@ set_first_floc_computation_triggered(true); set_floc_computation_in_progress(true); - OnGetRecentlyVisitedURLsCompleted( - FlocIdProviderImpl::ComputeFlocTrigger::kBrowserStart, - std::move(query_results)); + OnGetRecentlyVisitedURLsCompleted(ComputeFlocTrigger::kBrowserStart, + std::move(query_results)); - ASSERT_EQ( - FlocId::CreateFromHistory({"a.test", "b.test"}).ToDebugHeaderValue(), - floc_id().ToDebugHeaderValue()); + EXPECT_EQ(FlocId::CreateFromHistory({"a.test", "b.test"}), floc_id()); } TEST_F(FlocIdProviderUnitTest, @@ -769,9 +835,9 @@ // Expect a floc id update notification. The floc should be equal to the // sim-hash of the history. - ASSERT_EQ(1u, floc_id_provider_->floc_update_notification_count()); - ASSERT_EQ(FlocId::CreateFromHistory({domain}).ToDebugHeaderValue(), - floc_id().ToDebugHeaderValue()); + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(FlocId::CreateFromHistory({domain}), floc_id()); // Insert the current floc to blocklist and reload it. blocklist.insert(FlocId::CreateFromHistory({domain}).ToUint64()); @@ -781,8 +847,9 @@ // Expect a floc id update notification, with an invalid floc because was // blocked. - ASSERT_EQ(2u, floc_id_provider_->floc_update_notification_count()); - ASSERT_EQ(FlocId().ToDebugHeaderValue(), floc_id().ToDebugHeaderValue()); + EXPECT_EQ(2u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(2u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(FlocId(), floc_id()); // Reset and reload the blocklist. blocklist.clear(); @@ -792,9 +859,9 @@ // Expect a floc id update notification. The floc should be equal to the // sim-hash of the history. - ASSERT_EQ(3u, floc_id_provider_->floc_update_notification_count()); - ASSERT_EQ(FlocId::CreateFromHistory({domain}).ToDebugHeaderValue(), - floc_id().ToDebugHeaderValue()); + EXPECT_EQ(3u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(3u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(FlocId::CreateFromHistory({domain}), floc_id()); } TEST_F(FlocIdProviderUnitTest, TurnSyncOffAndOn) { @@ -816,9 +883,9 @@ task_environment_.RunUntilIdle(); // Expect a floc id update notification. - ASSERT_EQ(1u, floc_id_provider_->floc_update_notification_count()); - ASSERT_EQ(FlocId::CreateFromHistory({domain}).ToDebugHeaderValue(), - floc_id().ToDebugHeaderValue()); + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(FlocId::CreateFromHistory({domain}), floc_id()); // Turn off sync. test_sync_service_->SetTransportState( @@ -828,8 +895,9 @@ // the sync was turned off so the id has been reset to empty. task_environment_.FastForwardBy(base::TimeDelta::FromDays(1)); - ASSERT_EQ(2u, floc_id_provider_->floc_update_notification_count()); - ASSERT_FALSE(floc_id().IsValid()); + EXPECT_EQ(2u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(2u, floc_id_provider_->floc_update_notification_count()); + EXPECT_FALSE(floc_id().IsValid()); // Turn on sync. test_sync_service_->SetTransportState( @@ -839,9 +907,9 @@ // valid floc id. task_environment_.FastForwardBy(base::TimeDelta::FromDays(1)); - ASSERT_EQ(3u, floc_id_provider_->floc_update_notification_count()); - ASSERT_EQ(FlocId::CreateFromHistory({domain}).ToDebugHeaderValue(), - floc_id().ToDebugHeaderValue()); + EXPECT_EQ(3u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(3u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(FlocId::CreateFromHistory({domain}), floc_id()); } TEST_F(FlocIdProviderUnitTest, GetInterestCohortForJsApiMethod) { @@ -898,4 +966,114 @@ /*requesting_origin=*/{}, /*site_for_cookies=*/{})); } +TEST_F(FlocIdProviderUnitTest, HistoryDeleteDuringInProgressComputation) { + std::string domain1 = "foo.com"; + std::string domain2 = "bar.com"; + std::string domain3 = "baz.com"; + + // Add a history entry with a timestamp exactly 7 days back from now. + history::HistoryAddPageArgs add_page_args; + add_page_args.url = GURL(base::StrCat({"https://www.", domain1})); + add_page_args.time = base::Time::Now() - base::TimeDelta::FromDays(7); + add_page_args.publicly_routable = true; + history_service_->AddPage(add_page_args); + + // Add a history entry with a timestamp exactly 6 days back from now. + add_page_args.url = GURL(base::StrCat({"https://www.", domain2})); + add_page_args.time = base::Time::Now() - base::TimeDelta::FromDays(6); + history_service_->AddPage(add_page_args); + + // Add a history entry with a timestamp exactly 5 days back from now. + add_page_args.url = GURL(base::StrCat({"https://www.", domain3})); + add_page_args.time = base::Time::Now() - base::TimeDelta::FromDays(5); + history_service_->AddPage(add_page_args); + + // Trigger the 1st floc computation. + test_sync_service_->SetTransportState( + syncer::SyncService::TransportState::ACTIVE); + test_sync_service_->FireStateChanged(); + + task_environment_.RunUntilIdle(); + + // Expect a floc id update notification. + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_TRUE(floc_id().IsValid()); + EXPECT_EQ(FlocId::CreateFromHistory({domain1, domain2, domain3}), floc_id()); + + // Advance the clock by 1 day. The "domain1" should expire. However, we pause + // before the computation completes. + floc_id_provider_->set_should_pause_before_compute_floc_completed(true); + task_environment_.FastForwardBy(base::TimeDelta::FromDays(1)); + + EXPECT_TRUE(floc_computation_in_progress()); + EXPECT_FALSE(pending_recompute_event().has_value()); + EXPECT_EQ(FlocId::CreateFromHistory({domain1, domain2, domain3}), floc_id()); + EXPECT_EQ(FlocId::CreateFromHistory({domain2, domain3}), + floc_id_provider_->paused_floc_id()); + EXPECT_EQ(ComputeFlocTrigger::kScheduledUpdate, + floc_id_provider_->paused_trigger()); + + // Expire the "domain2" history entry right before the floc computation + // completes. Since the computation is still considered to be + // in-progress, a new recompute event due to this delete will be + // scheduled to happen right after this computation completes. + ExpireHistoryBefore(base::Time::Now() - base::TimeDelta::FromDays(7)); + + EXPECT_TRUE(pending_recompute_event().has_value()); + EXPECT_EQ(ComputeFlocTrigger::kHistoryDelete, + pending_recompute_event().value()); + + floc_id_provider_->set_should_pause_before_compute_floc_completed(false); + floc_id_provider_->ContinueLastOnComputeFlocCompleted(); + task_environment_.RunUntilIdle(); + + // Expect 2 more compute completion events and 1 more update notification. + // This is because we won't send update notification if there's a recompute + // event scheduled. + EXPECT_EQ(3u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(2u, floc_id_provider_->floc_update_notification_count()); + EXPECT_EQ(ComputeFlocTrigger::kHistoryDelete, + floc_id_provider_->last_notification_trigger()); + EXPECT_FALSE(pending_recompute_event().has_value()); + + // The final floc should be derived from "domain3". + EXPECT_TRUE(floc_id().IsValid()); + EXPECT_EQ(FlocId::CreateFromHistory({domain3}), floc_id()); +} + +TEST_F(FlocIdProviderUnitTest, ScheduledUpdateDuringInProgressComputation) { + std::string domain1 = "foo.com"; + std::string domain2 = "bar.com"; + std::string domain3 = "baz.com"; + + // Add a history entry with a timestamp exactly 7 days back from now. + history::HistoryAddPageArgs add_page_args; + add_page_args.url = GURL(base::StrCat({"https://www.", domain1})); + add_page_args.time = base::Time::Now() - base::TimeDelta::FromDays(7); + add_page_args.publicly_routable = true; + history_service_->AddPage(add_page_args); + + // Trigger the 1st floc computation. + test_sync_service_->SetTransportState( + syncer::SyncService::TransportState::ACTIVE); + test_sync_service_->FireStateChanged(); + + EXPECT_TRUE(floc_computation_in_progress()); + EXPECT_FALSE(pending_recompute_event().has_value()); + + // Scheduled update during an in-progress computation won't set the pending + // event. + ForceScheduledUpdate(); + EXPECT_FALSE(pending_recompute_event().has_value()); + + task_environment_.RunUntilIdle(); + + // Expect a floc id update notification. + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(1u, floc_id_provider_->floc_update_notification_count()); + EXPECT_TRUE(floc_id().IsValid()); + EXPECT_EQ(FlocId::CreateFromHistory({domain1}), floc_id()); +} + } // namespace federated_learning
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index f3f3d6b..cd6d99d 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -3128,11 +3128,6 @@ "expiry_milestone": 90 }, { - "name": "native-file-system-api", - "owners": [ "mek", "pwnall" ], - "expiry_milestone": 87 - }, - { "name": "nearby-sharing", "owners": [ "vecore@google.com", "cros-system-services@google.com", "cross-device-team@google.com" ], "expiry_milestone": 90
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index ccfdb997..40f224e 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1404,11 +1404,6 @@ const char kMouseSubframeNoImplicitCaptureDescription[] = "When enable, mouse down does not implicit capture for iframe."; -const char kNativeFileSystemAPIName[] = "Native File System API"; -const char kNativeFileSystemAPIDescription[] = - "Enables the experimental Native File System API, giving websites access " - "to the native file system"; - const char kNearbySharingName[] = "Nearby Sharing"; const char kNearbySharingDescription[] = "Enables Nearby Sharing for sharing content between devices."; @@ -4294,11 +4289,6 @@ "Uses a new machine learning agent to switch between builtin and dynamic " "ML models."; -const char kSmartTextSelectionName[] = "Smart Text Selection"; -const char kSmartTextSelectionDescription[] = - "Shows quick actions for text " - "selections in the context menu."; - const char kSmbfsFileSharesName[] = "Smbfs file shares"; const char kSmbfsFileSharesDescription[] = "Use smbfs for accessing network file shares.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index d2699ef..4a40f5fb 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -818,9 +818,6 @@ extern const char kMouseSubframeNoImplicitCaptureName[]; extern const char kMouseSubframeNoImplicitCaptureDescription[]; -extern const char kNativeFileSystemAPIName[]; -extern const char kNativeFileSystemAPIDescription[]; - extern const char kNearbySharingName[]; extern const char kNearbySharingDescription[]; @@ -2501,9 +2498,6 @@ extern const char kSmartDimNewMlAgentName[]; extern const char kSmartDimNewMlAgentDescription[]; -extern const char kSmartTextSelectionName[]; -extern const char kSmartTextSelectionDescription[]; - extern const char kSmbfsFileSharesName[]; extern const char kSmbfsFileSharesDescription[];
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureListInstrumentationTest.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureListInstrumentationTest.java index 579827c..d5fb85de 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureListInstrumentationTest.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureListInstrumentationTest.java
@@ -17,9 +17,8 @@ import org.junit.runner.RunWith; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.app.ChromeActivity; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; @@ -32,8 +31,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ChromeFeatureListInstrumentationTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Before public void setUp() throws Exception {
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/FieldTrialsInstrumentationTest.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/FieldTrialsInstrumentationTest.java index 63cd371..64cbc1f 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/FieldTrialsInstrumentationTest.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/FieldTrialsInstrumentationTest.java
@@ -14,10 +14,8 @@ import org.junit.runner.RunWith; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.ChromeTabbedActivity; -import org.chromium.chrome.browser.app.ChromeActivity; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.FieldTrials; @@ -31,15 +29,14 @@ private static final String sFeature2 = ChromeFeatureList.TEST_DEFAULT_ENABLED; @Rule - public ChromeActivityTestRule<? extends ChromeActivity> mActivityRule = - new ChromeActivityTestRule(ChromeTabbedActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @Rule public TestRule mProcessor = new Features.InstrumentationProcessor(); @Before public void setup() { - mActivityRule.startMainActivityOnBlankPage(); + mActivityTestRule.startMainActivityOnBlankPage(); } @Test
diff --git a/chrome/browser/media/feeds/media_feeds_service.cc b/chrome/browser/media/feeds/media_feeds_service.cc index 1143f0b7..a957b9df 100644 --- a/chrome/browser/media/feeds/media_feeds_service.cc +++ b/chrome/browser/media/feeds/media_feeds_service.cc
@@ -9,6 +9,7 @@ #include "base/feature_list.h" #include "base/metrics/histogram_functions.h" #include "base/optional.h" +#include "base/task/post_task.h" #include "base/task/task_traits.h" #include "base/threading/thread_checker.h" #include "base/time/clock.h" @@ -137,6 +138,9 @@ } // namespace +const char MediaFeedsService::kAggregateWatchtimeHistogramName[] = + "Media.Feeds.AggregateWatchtime"; + const char MediaFeedsService::kSafeSearchResultHistogramName[] = "Media.Feeds.SafeSearch.Result"; @@ -175,6 +179,20 @@ base::BindOnce(&MediaFeedsService::FetchTopMediaFeeds, weak_factory_.GetWeakPtr(), base::OnceClosure())); } + + // Wrapping in PostTask is needed to avoid a crash in the tests. + base::PostTask(FROM_HERE, {content::BrowserThread::UI}, + base::BindOnce(&MediaFeedsService::RecordFeedWatchtimes, + weak_factory_.GetWeakPtr())); +} + +void MediaFeedsService::RecordFeedWatchtimes() { + GetMediaHistoryService()->GetMediaFeeds( + media_history::MediaHistoryKeyedService::GetMediaFeedsRequest:: + CreateTopFeedsForFetch(std::numeric_limits<unsigned>::max(), + base::TimeDelta()), + base::BindOnce(&MediaFeedsService::OnGotFeedsForMetrics, + weak_factory_.GetWeakPtr())); } // static @@ -677,4 +695,13 @@ base::Unretained(this))); } +void MediaFeedsService::OnGotFeedsForMetrics( + std::vector<media_feeds::mojom::MediaFeedPtr> feeds) { + for (const auto& feed : feeds) { + base::UmaHistogramCustomTimes(kAggregateWatchtimeHistogramName, + *feed->aggregate_watchtime, base::TimeDelta(), + base::TimeDelta::FromHours(1), 60); + } +} + } // namespace media_feeds
diff --git a/chrome/browser/media/feeds/media_feeds_service.h b/chrome/browser/media/feeds/media_feeds_service.h index 3c2a150..2ca7ad5 100644 --- a/chrome/browser/media/feeds/media_feeds_service.h +++ b/chrome/browser/media/feeds/media_feeds_service.h
@@ -43,6 +43,7 @@ class MediaFeedsService : public KeyedService { public: + static const char kAggregateWatchtimeHistogramName[]; static const char kSafeSearchResultHistogramName[]; // Time to wait between background fetch delayed tasks. @@ -114,6 +115,8 @@ void EnsureCookieObserver(); + void RecordFeedWatchtimes(); + private: friend class MediaFeedsServiceTest; @@ -170,6 +173,9 @@ void OnDiscoveredFeed(); + void OnGotFeedsForMetrics( + std::vector<media_feeds::mojom::MediaFeedPtr> feeds); + // Settings related to fetching a feed in the background. struct BackgroundFetchFeedSettings { // Whether this feed should be fetched now.
diff --git a/chrome/browser/media/feeds/media_feeds_service_unittest.cc b/chrome/browser/media/feeds/media_feeds_service_unittest.cc index 218db79..698b62f 100644 --- a/chrome/browser/media/feeds/media_feeds_service_unittest.cc +++ b/chrome/browser/media/feeds/media_feeds_service_unittest.cc
@@ -2410,4 +2410,28 @@ MediaFeedsFetcher::kFetchSizeKbHistogramName, 15, 1); } +TEST_F(MediaFeedsServiceTest, AggregateWatchtimeHistogram) { + base::HistogramTester histogram_tester; + + task_environment()->RunUntilIdle(); + + const GURL feed_url("https://www.google.com/feed"); + + GetMediaFeedsService()->DiscoverMediaFeed(feed_url); + WaitForDB(); + + content::MediaPlayerWatchTime watch_time(feed_url, feed_url.GetOrigin(), + base::TimeDelta::FromMinutes(30), + base::TimeDelta(), true, true); + GetMediaHistoryService()->SavePlayback(watch_time); + WaitForDB(); + + GetMediaFeedsService()->RecordFeedWatchtimes(); + WaitForDB(); + + histogram_tester.ExpectUniqueTimeSample( + MediaFeedsService::kAggregateWatchtimeHistogramName, + base::TimeDelta::FromMinutes(30), 1); +} + } // namespace media_feeds
diff --git a/chrome/browser/media/feeds/media_feeds_store.mojom b/chrome/browser/media/feeds/media_feeds_store.mojom index 46f3d3f..e940745 100644 --- a/chrome/browser/media/feeds/media_feeds_store.mojom +++ b/chrome/browser/media/feeds/media_feeds_store.mojom
@@ -83,6 +83,9 @@ // The result of safe search checking this media feed. SafeSearchResult safe_search_result; + + // The aggregate watchtime for the media feed. + mojo_base.mojom.TimeDelta? aggregate_watchtime; }; // Contains details about the user signed into the website.
diff --git a/chrome/browser/media/history/media_history_feeds_table.cc b/chrome/browser/media/history/media_history_feeds_table.cc index 87cdca26..7cc6c56 100644 --- a/chrome/browser/media/history/media_history_feeds_table.cc +++ b/chrome/browser/media/history/media_history_feeds_table.cc
@@ -245,6 +245,7 @@ // LEFT JOIN mediaFeed. This means there should be a row for each origin // and if there is a media feed that will be included. sql.push_back( + ",origin.aggregate_watchtime_audio_video_s " "FROM origin " "LEFT JOIN mediaFeed " "ON origin.id = mediaFeed.origin_id"); @@ -448,6 +449,11 @@ feed->reset_token = ProtoToUnguessableToken(token); } + if (top_feeds) { + feed->aggregate_watchtime = + base::TimeDelta::FromSeconds(statement.ColumnInt64(20)); + } + feeds.push_back(std::move(feed)); // If we are returning top feeds then we should apply a limit here.
diff --git a/chrome/browser/media/kaleidoscope/kaleidoscope_data_provider_impl.cc b/chrome/browser/media/kaleidoscope/kaleidoscope_data_provider_impl.cc index 3415f7a..d5132f4 100644 --- a/chrome/browser/media/kaleidoscope/kaleidoscope_data_provider_impl.cc +++ b/chrome/browser/media/kaleidoscope/kaleidoscope_data_provider_impl.cc
@@ -106,6 +106,14 @@ return; } + // If the administrator has disabled Kaleidoscope then stop. + auto* prefs = profile_->GetPrefs(); + if (!prefs->GetBoolean(kaleidoscope::prefs::kKaleidoscopePolicyEnabled)) { + std::move(cb).Run(nullptr, + media::mojom::CredentialsResult::kDisabledByPolicy); + return; + } + // If the user is not signed in, return the credentials without an access // token. Sync consent is not required to use Kaleidoscope. if (!identity_manager_->HasPrimaryAccount(
diff --git a/chrome/browser/media/kaleidoscope/kaleidoscope_prefs.cc b/chrome/browser/media/kaleidoscope/kaleidoscope_prefs.cc index faf3ee75..d74acfe 100644 --- a/chrome/browser/media/kaleidoscope/kaleidoscope_prefs.cc +++ b/chrome/browser/media/kaleidoscope/kaleidoscope_prefs.cc
@@ -15,9 +15,12 @@ const char kKaleidoscopeAutoSelectMediaFeeds[] = "kaleidoscope.auto_select_media_feeds"; +const char kKaleidoscopePolicyEnabled[] = "kaleidoscope.enabled_by_policy"; + void RegisterProfilePrefs(PrefRegistrySimple* registry) { registry->RegisterIntegerPref(kKaleidoscopeFirstRunCompleted, 0); registry->RegisterBooleanPref(kKaleidoscopeAutoSelectMediaFeeds, false); + registry->RegisterBooleanPref(kKaleidoscopePolicyEnabled, true); } } // namespace prefs
diff --git a/chrome/browser/media/kaleidoscope/kaleidoscope_prefs.h b/chrome/browser/media/kaleidoscope/kaleidoscope_prefs.h index 6ae04c4..60f1a92b 100644 --- a/chrome/browser/media/kaleidoscope/kaleidoscope_prefs.h +++ b/chrome/browser/media/kaleidoscope/kaleidoscope_prefs.h
@@ -18,6 +18,9 @@ // automatically. extern const char kKaleidoscopeAutoSelectMediaFeeds[]; +// Stores true if Kaleidoscope has been enabled/disabled by an administrator. +extern const char kKaleidoscopePolicyEnabled[]; + void RegisterProfilePrefs(PrefRegistrySimple* registry); } // namespace prefs
diff --git a/chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom b/chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom index 01c66bb..dd696bb 100644 --- a/chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom +++ b/chrome/browser/media/kaleidoscope/mojom/kaleidoscope.mojom
@@ -13,6 +13,7 @@ kSuccess, kFailedIncognito, kFailedChild, + kDisabledByPolicy, }; // The credentials required to make Google API calls from JS.
diff --git a/chrome/browser/metrics/power_metrics_provider_mac.mm b/chrome/browser/metrics/power_metrics_provider_mac.mm index 3fbd8be..56b4e1b8 100644 --- a/chrome/browser/metrics/power_metrics_provider_mac.mm +++ b/chrome/browser/metrics/power_metrics_provider_mac.mm
@@ -435,7 +435,7 @@ bool is_on_battery = false; if (base::PowerMonitor::IsInitialized()) is_on_battery = base::PowerMonitor::IsOnBatteryPower(); - UMA_HISTOGRAM_BOOLEAN("Power.Mac.IsOnBattery", is_on_battery); + UMA_HISTOGRAM_BOOLEAN("Power.Mac.IsOnBattery2", is_on_battery); } void RecordThermal() API_AVAILABLE(macos(10.10.3)) {
diff --git a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl_unittest.cc b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl_unittest.cc index e06b66f..4d65628 100644 --- a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl_unittest.cc +++ b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl_unittest.cc
@@ -8,7 +8,6 @@ #include "base/optional.h" #include "base/test/bind_test_util.h" -#include "build/build_config.h" #include "chrome/browser/nearby_sharing/client/fake_nearby_share_client.h" #include "chrome/browser/nearby_sharing/common/nearby_share_prefs.h" #include "chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_device_data_updater.h" @@ -28,7 +27,7 @@ const char kFakeDeviceName[] = "My Cool Chromebook"; const char kFakeEmptyDeviceName[] = ""; const char kFakeTooLongDeviceName[] = "this string is 33 bytes in UTF-8!"; -const char kFakeInvalidDeviceName[] = {0xC0}; +const char kFakeInvalidDeviceName[] = {0xC0, 0x00}; const char kFakeFullName[] = "Barack Obama"; const char kFakeIconUrl[] = "https://www.google.com"; @@ -260,13 +259,7 @@ EXPECT_EQ(id, manager()->GetId()); } -// Test is flaky. crbug.com/1133295. -#if defined(OS_CHROMEOS) -#define MAYBE_ValidateDeviceName DISABLED_ValidateDeviceName -#else -#define MAYBE_ValidateDeviceName ValidateDeviceName -#endif -TEST_F(NearbyShareLocalDeviceDataManagerImplTest, MAYBE_ValidateDeviceName) { +TEST_F(NearbyShareLocalDeviceDataManagerImplTest, ValidateDeviceName) { CreateManager(); EXPECT_EQ(manager()->ValidateDeviceName(kFakeDeviceName), nearby_share::mojom::DeviceNameValidationResult::kValid); @@ -279,13 +272,7 @@ nearby_share::mojom::DeviceNameValidationResult::kErrorNotValidUtf8); } -// Test is flaky. crbug.com/1133295. -#if defined(OS_CHROMEOS) -#define MAYBE_SetDeviceName DISABLED_SetDeviceName -#else -#define MAYBE_SetDeviceName SetDeviceName -#endif -TEST_F(NearbyShareLocalDeviceDataManagerImplTest, MAYBE_SetDeviceName) { +TEST_F(NearbyShareLocalDeviceDataManagerImplTest, SetDeviceName) { CreateManager(); // The default device name is set in the ctor when the device name is empty.
diff --git a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc index 80a03060..c9532c6 100644 --- a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc +++ b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc
@@ -297,6 +297,7 @@ incoming_share_target_info_map_.clear(); StopAdvertising(); + StopFastInitiationAdvertising(); StopScanning(); nearby_connections_manager_->Shutdown(); @@ -310,8 +311,6 @@ power_client_->RemoveObserver(this); - StopFastInitiationAdvertising(); - if (bluetooth_adapter_) bluetooth_adapter_->RemoveObserver(this); @@ -421,8 +420,6 @@ << ": A SendSurface has been registered for state: " << SendSurfaceStateToString(state); InvalidateSendSurfaceState(); - if (state == SendSurfaceState::kForeground) - StartFastInitiationAdvertising(); return StatusCodes::kOk; } @@ -475,7 +472,6 @@ NS_LOG(VERBOSE) << __func__ << ": A SendSurface has been unregistered: " << SendSurfaceStateToString(state); InvalidateSurfaceState(); - StopFastInitiationAdvertising(); return StatusCodes::kOk; } @@ -932,8 +928,6 @@ bool present) { NS_LOG(VERBOSE) << "Bluetooth present changed: " << present; InvalidateSurfaceState(); - if (!present) - StopFastInitiationAdvertising(); } void NearbySharingServiceImpl::AdapterPoweredChanged( @@ -941,8 +935,6 @@ bool powered) { NS_LOG(VERBOSE) << "Bluetooth powered changed: " << powered; InvalidateSurfaceState(); - if (!powered) - StopFastInitiationAdvertising(); } void NearbySharingServiceImpl::SuspendImminent() { @@ -1039,23 +1031,6 @@ } void NearbySharingServiceImpl::StartFastInitiationAdvertising() { - if (!profile_) { - NS_LOG(INFO) - << "Failed to advertise FastInitiation. Profile is shutting down."; - return; - } - - if (!IsBluetoothPowered()) { - NS_LOG(INFO) << "Failed to advertise FastInitiation. Bluetooth is not " - "powered."; - return; - } - - if (fast_initiation_manager_) { - NS_LOG(INFO) << "Failed to advertise FastInitiation. Already advertising."; - return; - } - fast_initiation_manager_ = FastInitiationManager::Factory::Create(bluetooth_adapter_); @@ -1085,7 +1060,8 @@ void NearbySharingServiceImpl::StopFastInitiationAdvertising() { if (!fast_initiation_manager_) { - NS_LOG(INFO) << "Can't stop advertising FastInitiation. Not advertising."; + NS_LOG(VERBOSE) + << "Can't stop advertising FastInitiation. Not advertising."; return; } @@ -1236,7 +1212,7 @@ void NearbySharingServiceImpl::InvalidateSendSurfaceState() { InvalidateScanningState(); - // TODO(b/161889067) InvalidateFastInitAdvertisement(); + InvalidateFastInitiationAdvertising(); } void NearbySharingServiceImpl::InvalidateScanningState() { @@ -1308,6 +1284,73 @@ StartScanning(); } +void NearbySharingServiceImpl::InvalidateFastInitiationAdvertising() { + // Nothing to do if we're shutting down the profile. + if (!profile_) + return; + + if (power_client_->IsSuspended()) { + StopFastInitiationAdvertising(); + NS_LOG(VERBOSE) + << __func__ + << ": Stopping fast init advertising because the system is suspended."; + return; + } + + if (!process_manager_->IsActiveProfile(profile_)) { + StopFastInitiationAdvertising(); + NS_LOG(VERBOSE) + << __func__ + << ": Stopping fast init advertising because profile was not active: " + << profile_->GetProfileUserName(); + return; + } + + // Screen is off. Do no work. + if (is_screen_locked_) { + StopFastInitiationAdvertising(); + NS_LOG(VERBOSE) + << __func__ + << ": Stopping fast init advertising because the screen is locked."; + return; + } + + if (!IsBluetoothPowered()) { + StopFastInitiationAdvertising(); + NS_LOG(VERBOSE) << __func__ + << ": Stopping fast init advertising because both " + "bluetooth is disabled."; + return; + } + + // Nearby Sharing is disabled. Don't fast init advertise. + if (!settings_.GetEnabled()) { + StopFastInitiationAdvertising(); + NS_LOG(VERBOSE) << __func__ + << ": Stopping fast init advertising because Nearby " + "Sharing is disabled."; + return; + } + + if (!foreground_send_transfer_callbacks_.might_have_observers()) { + StopFastInitiationAdvertising(); + NS_LOG(VERBOSE) << __func__ + << ": Stopping fast init advertising because no send " + "surface is registered."; + return; + } + + if (fast_initiation_manager_) { + NS_LOG(VERBOSE) + << "Failed to advertise FastInitiation. Already advertising."; + return; + } + + NS_LOG(VERBOSE) << __func__ << ": Starting fast init advertising."; + + StartFastInitiationAdvertising(); +} + void NearbySharingServiceImpl::InvalidateReceiveSurfaceState() { InvalidateAdvertisingState(); // TODO(b/161889067) InvalidateFastInitScan();
diff --git a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.h b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.h index bf8e5b3..fe315afe 100644 --- a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.h +++ b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.h
@@ -178,6 +178,7 @@ bool ShouldStopNearbyProcess(); void InvalidateSendSurfaceState(); void InvalidateScanningState(); + void InvalidateFastInitiationAdvertising(); void InvalidateReceiveSurfaceState(); void InvalidateAdvertisingState(); void StopAdvertising();
diff --git a/chrome/browser/nearby_sharing/nearby_sharing_service_impl_unittest.cc b/chrome/browser/nearby_sharing/nearby_sharing_service_impl_unittest.cc index 9492878..04cdd52 100644 --- a/chrome/browser/nearby_sharing/nearby_sharing_service_impl_unittest.cc +++ b/chrome/browser/nearby_sharing/nearby_sharing_service_impl_unittest.cc
@@ -1082,8 +1082,7 @@ NearbySharingService::StatusCodes::kOk, service_->RegisterSendSurface(&transfer_callback, &discovery_callback, SendSurfaceState::kForeground)); - adapter_observer_->AdapterPresentChanged(mock_bluetooth_adapter_.get(), - false); + SetBluetoothIsPresent(false); EXPECT_TRUE(fast_initiation_manager_factory_ ->StopAdvertisingCalledAndManagerDestroyed()); } @@ -1097,8 +1096,7 @@ NearbySharingService::StatusCodes::kOk, service_->RegisterSendSurface(&transfer_callback, &discovery_callback, SendSurfaceState::kForeground)); - adapter_observer_->AdapterPoweredChanged(mock_bluetooth_adapter_.get(), - false); + SetBluetoothIsPowered(false); EXPECT_TRUE(fast_initiation_manager_factory_ ->StopAdvertisingCalledAndManagerDestroyed()); }
diff --git a/chrome/browser/net/reporting_browsertest.cc b/chrome/browser/net/reporting_browsertest.cc index 1ac33aeb..249dc412 100644 --- a/chrome/browser/net/reporting_browsertest.cc +++ b/chrome/browser/net/reporting_browsertest.cc
@@ -122,10 +122,10 @@ // Clear out any non-reproducible fields. for (auto& report : parsed_payload->GetList()) { report.RemoveKey("age"); - report.RemovePath({"body", "elapsed_time"}); + report.RemovePath("body.elapsed_time"); auto* user_agent = report.FindKeyOfType("user_agent", base::Value::Type::STRING); - if (user_agent != nullptr) + if (user_agent) *user_agent = base::Value("Mozilla/1.0"); } return parsed_payload;
diff --git a/chrome/browser/paint_preview/android/java/src/org/chromium/chrome/browser/paint_preview/TabbedPaintPreviewPlayer.java b/chrome/browser/paint_preview/android/java/src/org/chromium/chrome/browser/paint_preview/TabbedPaintPreviewPlayer.java index c0771381..73cc445 100644 --- a/chrome/browser/paint_preview/android/java/src/org/chromium/chrome/browser/paint_preview/TabbedPaintPreviewPlayer.java +++ b/chrome/browser/paint_preview/android/java/src/org/chromium/chrome/browser/paint_preview/TabbedPaintPreviewPlayer.java
@@ -243,10 +243,14 @@ .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - mTab.getTabViewManager().removeTabViewProvider( - TabbedPaintPreviewPlayer.this); - mPlayerManager.destroy(); - mPlayerManager = null; + if (mTab != null) { + mTab.getTabViewManager().removeTabViewProvider( + TabbedPaintPreviewPlayer.this); + } + if (mPlayerManager != null) { + mPlayerManager.destroy(); + mPlayerManager = null; + } mFadingOut = false; } });
diff --git a/chrome/browser/password_check/android/BUILD.gn b/chrome/browser/password_check/android/BUILD.gn index 199b309e..6428ad2 100644 --- a/chrome/browser/password_check/android/BUILD.gn +++ b/chrome/browser/password_check/android/BUILD.gn
@@ -54,6 +54,7 @@ "java/src/org/chromium/chrome/browser/password_check/PasswordCheckMetricsRecorder.java", "java/src/org/chromium/chrome/browser/password_check/PasswordCheckPreference.java", "java/src/org/chromium/chrome/browser/password_check/PasswordCheckReferrer.java", + "java/src/org/chromium/chrome/browser/password_check/PasswordCheckResolutionAction.java", "java/src/org/chromium/chrome/browser/password_check/PasswordCheckUserAction.java", ] resources_package = "org.chromium.chrome.browser.password_check"
diff --git a/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/PasswordCheckMediator.java b/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/PasswordCheckMediator.java index 2ce8193f..d4c0f63 100644 --- a/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/PasswordCheckMediator.java +++ b/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/PasswordCheckMediator.java
@@ -90,6 +90,7 @@ } void destroy() { + // TODO(crbug.com/): Report PasswordCheckResolutionAction.DID_NOTHING. getPasswordCheck().removeObserver(this); } @@ -229,6 +230,8 @@ public void onClick(DialogInterface dialog, int which) { PasswordCheckMetricsRecorder.recordUiUserAction( PasswordCheckUserAction.DELETED_PASSWORD); + PasswordCheckMetricsRecorder.recordCheckResolutionAction( + PasswordCheckResolutionAction.DELETED_PASSWORD, credential); if (which != AlertDialog.BUTTON_POSITIVE) return; mDelegate.removeCredential(credential); mModel.set(DELETION_CONFIRMATION_HANDLER, null); @@ -277,6 +280,8 @@ PasswordCheckMetricsRecorder.recordUiUserAction(credential.hasAutoChangeButton() ? PasswordCheckUserAction.CHANGE_PASSWORD_MANUALLY : PasswordCheckUserAction.CHANGE_PASSWORD); + PasswordCheckMetricsRecorder.recordCheckResolutionAction( + PasswordCheckResolutionAction.OPENED_SITE, credential); mChangePasswordDelegate.launchAppOrCctWithChangePasswordUrl(credential); } @@ -285,6 +290,8 @@ assert credential.hasAutoChangeButton(); PasswordCheckMetricsRecorder.recordUiUserAction( PasswordCheckUserAction.CHANGE_PASSWORD_AUTOMATICALLY); + PasswordCheckMetricsRecorder.recordCheckResolutionAction( + PasswordCheckResolutionAction.STARTED_SCRIPT, credential); mChangePasswordDelegate.launchCctWithScript(credential); }
diff --git a/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckEditFragmentView.java b/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckEditFragmentView.java index 07b3eb4a..629886d 100644 --- a/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckEditFragmentView.java +++ b/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckEditFragmentView.java
@@ -153,6 +153,8 @@ if (id == R.id.action_save_edited_password) { PasswordCheckMetricsRecorder.recordUiUserAction( PasswordCheckUserAction.EDITED_PASSWORD); + PasswordCheckMetricsRecorder.recordCheckResolutionAction( + PasswordCheckResolutionAction.EDITED_PASSWORD, mCredential); saveChanges(); return true; }
diff --git a/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckMetricsRecorder.java b/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckMetricsRecorder.java index 0660159..8601bd4 100644 --- a/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckMetricsRecorder.java +++ b/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckMetricsRecorder.java
@@ -22,4 +22,22 @@ RecordHistogram.recordEnumeratedHistogram("PasswordManager.BulkCheck.UserActionAndroid", userAction, PasswordCheckUserAction.COUNT); } + + public static void recordCheckResolutionAction( + @PasswordCheckResolutionAction int action, CompromisedCredential credential) { + if (credential.hasScript()) { + RecordHistogram.recordEnumeratedHistogram( + "PasswordManager.AutomaticChange.ForSitesWithScripts", action, + PasswordCheckResolutionAction.COUNT); + } + if (credential.hasAutoChangeButton()) { + RecordHistogram.recordEnumeratedHistogram( + "PasswordManager.AutomaticChange.AcceptanceWithAutoButton", action, + PasswordCheckResolutionAction.COUNT); + } else { + RecordHistogram.recordEnumeratedHistogram( + "PasswordManager.AutomaticChange.AcceptanceWithoutAutoButton", action, + PasswordCheckResolutionAction.COUNT); + } + } }
diff --git a/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckResolutionAction.java b/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckResolutionAction.java new file mode 100644 index 0000000..7c1f88a --- /dev/null +++ b/chrome/browser/password_check/android/java/src/org/chromium/chrome/browser/password_check/PasswordCheckResolutionAction.java
@@ -0,0 +1,42 @@ +// 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. +package org.chromium.chrome.browser.password_check; + +import androidx.annotation.IntDef; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * These values are persisted to logs. Entries should not be renumbered and + * numeric values should never be reused. To be kept in sync with PasswordCheckReferrerAndroid in + * enums.xml. + */ +@IntDef({PasswordCheckResolutionAction.OPENED_SITE, PasswordCheckResolutionAction.STARTED_SCRIPT, + PasswordCheckResolutionAction.DELETED_PASSWORD, + PasswordCheckResolutionAction.EDITED_PASSWORD, PasswordCheckResolutionAction.DID_NOTHING}) +@Retention(RetentionPolicy.SOURCE) +public @interface PasswordCheckResolutionAction { + /** + * A user opened a site to change a password manually. + */ + int OPENED_SITE = 0; + /** + * A user started an automated password change flow. + */ + int STARTED_SCRIPT = 1; + /** + * A user deleted a password. + */ + int DELETED_PASSWORD = 2; + /** + * A user edited a password. + */ + int EDITED_PASSWORD = 3; + /** + * A user did nothing. + */ + int DID_NOTHING = 4; + int COUNT = 5; +}
diff --git a/chrome/browser/password_check/android/javatests/src/org/chromium/chrome/browser/password_check/PasswordCheckEditViewTest.java b/chrome/browser/password_check/android/javatests/src/org/chromium/chrome/browser/password_check/PasswordCheckEditViewTest.java index 0c1396f..0e339472 100644 --- a/chrome/browser/password_check/android/javatests/src/org/chromium/chrome/browser/password_check/PasswordCheckEditViewTest.java +++ b/chrome/browser/password_check/android/javatests/src/org/chromium/chrome/browser/password_check/PasswordCheckEditViewTest.java
@@ -47,6 +47,7 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; @@ -68,7 +69,15 @@ private static final CompromisedCredential ANA = new CompromisedCredential( "https://some-url.com/signin", new GURL("https://some-url.com/"), "Ana", "some-url.com", "Ana", "password", "https://some-url.com/.well-known/change-password", "", 1, true, - false, false, false); + false, true, true); + private static final String PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITH_AUTO_BUTTON = + "PasswordManager.AutomaticChange.AcceptanceWithAutoButton"; + private static final String PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITHOUT_AUTO_BUTTON = + "PasswordManager.AutomaticChange.AcceptanceWithoutAutoButton"; + private static final String PASSWORD_CHECK_RESOLUTION_HISTOGRAM_FOR_SCRIPTED_SITES = + "PasswordManager.AutomaticChange.ForSitesWithScripts"; + private static final String PASSWORD_CHECK_USER_ACTION_HISTOGRAM = + "PasswordManager.BulkCheck.UserActionAndroid"; private PasswordCheckEditFragmentView mPasswordCheckEditView; @@ -144,6 +153,22 @@ onView(withId(R.id.action_save_edited_password)).perform(click()); verify(mPasswordCheck).updateCredential(eq(ANA), eq(newPassword)); + + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_USER_ACTION_HISTOGRAM, + PasswordCheckUserAction.EDITED_PASSWORD), + is(1)); + assertThat(RecordHistogram.getHistogramTotalCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITHOUT_AUTO_BUTTON), + is(0)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITH_AUTO_BUTTON, + PasswordCheckResolutionAction.EDITED_PASSWORD), + is(1)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_FOR_SCRIPTED_SITES, + PasswordCheckResolutionAction.EDITED_PASSWORD), + is(1)); } @Test
diff --git a/chrome/browser/password_check/android/junit/src/org/chromium/chrome/browser/password_check/PasswordCheckControllerTest.java b/chrome/browser/password_check/android/junit/src/org/chromium/chrome/browser/password_check/PasswordCheckControllerTest.java index 1cbf2dee..51b964e 100644 --- a/chrome/browser/password_check/android/junit/src/org/chromium/chrome/browser/password_check/PasswordCheckControllerTest.java +++ b/chrome/browser/password_check/android/junit/src/org/chromium/chrome/browser/password_check/PasswordCheckControllerTest.java
@@ -89,7 +89,16 @@ new CompromisedCredential("http://www.b.ch/signin", mock(GURL.class), "", "http://www.b.ch", "(No username)", "DoneSth", "http://www.b.ch/.well-known/change-password", "", 1, true, false, true, true); + private static final CompromisedCredential CHARLIE = new CompromisedCredential( + "http://www.c.de/login", mock(GURL.class), "", "http://www.c.de", "user1", "secret", + "http://www.c.de/.well-known/change-password", "", 1, true, false, true, false); private static final Pair<Integer, Integer> PROGRESS_UPDATE = new Pair<>(2, 19); + private static final String PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITH_AUTO_BUTTON = + "PasswordManager.AutomaticChange.AcceptanceWithAutoButton"; + private static final String PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITHOUT_AUTO_BUTTON = + "PasswordManager.AutomaticChange.AcceptanceWithoutAutoButton"; + private static final String PASSWORD_CHECK_RESOLUTION_HISTOGRAM_FOR_SCRIPTED_SITES = + "PasswordManager.AutomaticChange.ForSitesWithScripts"; private static final String PASSWORD_CHECK_REFERRER_HISTOGRAM = "PasswordManager.BulkCheck.PasswordCheckReferrerAndroid"; private static final String PASSWORD_CHECK_USER_ACTION_HISTOGRAM = @@ -541,7 +550,7 @@ @Test public void testRemovingElementRecordsDeletedPassword() { - mMediator.onRemove(ANA); + mMediator.onRemove(BOB); assertNotNull(mModel.get(DELETION_CONFIRMATION_HANDLER)); // When the handler is triggered (because the dialog was confirmed), remove the credential: @@ -552,18 +561,109 @@ PASSWORD_CHECK_USER_ACTION_HISTOGRAM, PasswordCheckUserAction.DELETED_PASSWORD), is(1)); + assertThat(RecordHistogram.getHistogramTotalCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITHOUT_AUTO_BUTTON), + is(0)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITH_AUTO_BUTTON, + PasswordCheckResolutionAction.DELETED_PASSWORD), + is(1)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_FOR_SCRIPTED_SITES, + PasswordCheckResolutionAction.DELETED_PASSWORD), + is(1)); } @Test public void testOnChangePasswordButtonClick() { + // No auto change button. A user clicks "Change password" (manually). mMediator.onChangePasswordButtonClick(ANA); verify(mChangePasswordDelegate).launchAppOrCctWithChangePasswordUrl(eq(ANA)); + + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_USER_ACTION_HISTOGRAM, + PasswordCheckUserAction.CHANGE_PASSWORD), + is(1)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITHOUT_AUTO_BUTTON, + PasswordCheckResolutionAction.OPENED_SITE), + is(1)); + assertThat(RecordHistogram.getHistogramTotalCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITH_AUTO_BUTTON), + is(0)); + assertThat(RecordHistogram.getHistogramTotalCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_FOR_SCRIPTED_SITES), + is(0)); } @Test - public void testOnChangePasswordWithScriptButtonClick() { + public void testOnChangePasswordManuallyButtonClick() { + // There is an auto change button, but a user clicks "Change manually". + mMediator.onChangePasswordButtonClick(BOB); + verify(mChangePasswordDelegate).launchAppOrCctWithChangePasswordUrl(eq(BOB)); + + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_USER_ACTION_HISTOGRAM, + PasswordCheckUserAction.CHANGE_PASSWORD_MANUALLY), + is(1)); + assertThat(RecordHistogram.getHistogramTotalCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITHOUT_AUTO_BUTTON), + is(0)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITH_AUTO_BUTTON, + PasswordCheckResolutionAction.OPENED_SITE), + is(1)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_FOR_SCRIPTED_SITES, + PasswordCheckResolutionAction.OPENED_SITE), + is(1)); + } + + @Test + public void testOnChangePasswordButtonClickScriptOnly() { + // There is a script but auto change button isn't shown. A user clicks "Change password" + // (manually). + mMediator.onChangePasswordButtonClick(CHARLIE); + verify(mChangePasswordDelegate).launchAppOrCctWithChangePasswordUrl(eq(CHARLIE)); + + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_USER_ACTION_HISTOGRAM, + PasswordCheckUserAction.CHANGE_PASSWORD), + is(1)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITHOUT_AUTO_BUTTON, + PasswordCheckResolutionAction.OPENED_SITE), + is(1)); + assertThat(RecordHistogram.getHistogramTotalCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITH_AUTO_BUTTON), + is(0)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_FOR_SCRIPTED_SITES, + PasswordCheckResolutionAction.OPENED_SITE), + is(1)); + } + + @Test + public void testOnAutoChangePasswordButtonClick() { + // There is a auto change button, a user clicks it. mMediator.onChangePasswordWithScriptButtonClick(BOB); verify(mChangePasswordDelegate).launchCctWithScript(eq(BOB)); + + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_USER_ACTION_HISTOGRAM, + PasswordCheckUserAction.CHANGE_PASSWORD_AUTOMATICALLY), + is(1)); + assertThat(RecordHistogram.getHistogramTotalCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITHOUT_AUTO_BUTTON), + is(0)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_WITH_AUTO_BUTTON, + PasswordCheckResolutionAction.STARTED_SCRIPT), + is(1)); + assertThat(RecordHistogram.getHistogramValueCountForTesting( + PASSWORD_CHECK_RESOLUTION_HISTOGRAM_FOR_SCRIPTED_SITES, + PasswordCheckResolutionAction.STARTED_SCRIPT), + is(1)); } @Test
diff --git a/chrome/browser/payments/BUILD.gn b/chrome/browser/payments/BUILD.gn index ff5578a..d362eb0 100644 --- a/chrome/browser/payments/BUILD.gn +++ b/chrome/browser/payments/BUILD.gn
@@ -22,6 +22,7 @@ "payment_handler_enforce_full_delegation_browsertest.cc", "payment_handler_exploit_browsertest.cc", "payment_handler_just_in_time_installation_browsertest.cc", + "payment_handler_ui_browsertest.cc", "payment_handler_uninstall_browsertest.cc", "payment_request_app_store_billing_browsertest.cc", "payment_request_can_make_payment_browsertest.cc",
diff --git a/chrome/browser/payments/payment_handler_ui_browsertest.cc b/chrome/browser/payments/payment_handler_ui_browsertest.cc new file mode 100644 index 0000000..6da4168 --- /dev/null +++ b/chrome/browser/payments/payment_handler_ui_browsertest.cc
@@ -0,0 +1,40 @@ +// 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/test/payments/payment_request_platform_browsertest_base.h" +#include "content/public/test/browser_test.h" +#include "net/test/embedded_test_server/embedded_test_server.h" + +namespace payments { +namespace { + +class PaymentHandlerUiBrowserTest + : public PaymentRequestPlatformBrowserTestBase {}; + +// Make sure a page can open the Payment UI multiple times. +IN_PROC_BROWSER_TEST_F(PaymentHandlerUiBrowserTest, + OpenPaymentTwiceShouldBeSuccessful) { + NavigateTo("/maxpay.com/merchant.html"); + + std::string expected = "success"; + EXPECT_EQ(expected, content::EvalJs(GetActiveWebContents(), "install()")); + EXPECT_EQ("app_is_ready", + content::EvalJs( + GetActiveWebContents(), + "launchAndWaitUntilReady('./payment_handler_window.html')")); + EXPECT_TRUE(test_controller()->ClickPaymentHandlerCloseButton()); + EXPECT_EQ("User closed the Payment Request UI.", + content::EvalJs(GetActiveWebContents(), "getResult()")); + + // The second time should be successful. + EXPECT_EQ("app_is_ready", + content::EvalJs( + GetActiveWebContents(), + "launchAndWaitUntilReady('./payment_handler_window.html')")); + EXPECT_TRUE(test_controller()->ClickPaymentHandlerCloseButton()); + EXPECT_EQ("User closed the Payment Request UI.", + content::EvalJs(GetActiveWebContents(), "getResult()")); +} +} // namespace +} // namespace payments
diff --git a/chrome/browser/performance_manager/chrome_browser_main_extra_parts_performance_manager.cc b/chrome/browser/performance_manager/chrome_browser_main_extra_parts_performance_manager.cc index da40538..7f550df 100644 --- a/chrome/browser/performance_manager/chrome_browser_main_extra_parts_performance_manager.cc +++ b/chrome/browser/performance_manager/chrome_browser_main_extra_parts_performance_manager.cc
@@ -112,11 +112,21 @@ #if !defined(OS_ANDROID) graph->PassToGraph(FormInteractionTabHelper::CreateGraphObserver()); + // The PageDiscardingHelper instance is required by the HighPMFDiscardPolicy + // and by UrgentDiscardingFromPerformanceManager. + if (base::FeatureList::IsEnabled( + performance_manager::features::kHighPMFDiscardPolicy) || + base::FeatureList::IsEnabled( performance_manager::features:: kUrgentDiscardingFromPerformanceManager)) { graph->PassToGraph(std::make_unique< performance_manager::policies::PageDiscardingHelper>()); + } + + if (base::FeatureList::IsEnabled( + performance_manager::features:: + kUrgentDiscardingFromPerformanceManager)) { graph->PassToGraph( std::make_unique< performance_manager::policies::UrgentPageDiscardingPolicy>());
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 8db2e78..4b7ef454 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -107,6 +107,7 @@ #include "chrome/browser/enterprise/connectors/connectors_prefs.h" #include "chrome/browser/enterprise/connectors/enterprise_connectors_policy_handler.h" #include "chrome/browser/enterprise/reporting/extension_request_policy_handler.h" +#include "chrome/browser/media/kaleidoscope/kaleidoscope_prefs.h" #include "chrome/browser/media/router/media_router_feature.h" #include "chrome/browser/policy/local_sync_policy_handler.h" #endif // defined(OS_ANDROID) @@ -712,6 +713,9 @@ { key::kWebRtcAllowLegacyTLSProtocols, prefs::kWebRTCAllowLegacyTLSProtocols, base::Value::Type::BOOLEAN }, + { key::kMediaRecommendationsEnabled, + kaleidoscope::prefs::kKaleidoscopePolicyEnabled, + base::Value::Type::BOOLEAN }, #endif // defined(OS_ANDROID) #if defined(OS_CHROMEOS)
diff --git a/chrome/browser/prerender/isolated/isolated_prerender_browsertest.cc b/chrome/browser/prerender/isolated/isolated_prerender_browsertest.cc index 8fd76a9a..d9f0d8d 100644 --- a/chrome/browser/prerender/isolated/isolated_prerender_browsertest.cc +++ b/chrome/browser/prerender/isolated/isolated_prerender_browsertest.cc
@@ -745,7 +745,8 @@ std::unique_ptr<net::test_server::BasicHttpResponse> resp = std::make_unique<net::test_server::BasicHttpResponse>(); resp->set_code(net::HTTP_OK); - resp->set_content("OK"); + // Make sure whitespace is ok, especially trailing newline. + resp->set_content(" OK\n"); return resp; }
diff --git a/chrome/browser/prerender/isolated/isolated_prerender_origin_prober.cc b/chrome/browser/prerender/isolated/isolated_prerender_origin_prober.cc index f49ded8..da4b98c 100644 --- a/chrome/browser/prerender/isolated/isolated_prerender_origin_prober.cc +++ b/chrome/browser/prerender/isolated/isolated_prerender_origin_prober.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/feature_list.h" #include "base/no_destructor.h" +#include "base/strings/string_util.h" #include "base/task/post_task.h" #include "chrome/browser/availability/availability_prober.h" #include "chrome/browser/prerender/isolated/isolated_prerender_params.h" @@ -189,8 +190,18 @@ bool IsResponseSuccess(net::Error net_error, const network::mojom::URLResponseHead* head, std::unique_ptr<std::string> body) override { - return net_error == net::OK && head && head->headers && - head->headers->response_code() == 200 && body && *body == "OK"; + if (net_error != net::OK) + return false; + if (!head) + return false; + if (!head->headers) + return false; + if (head->headers->response_code() != 200) + return false; + if (!body) + return false; + // Strip any whitespace, especially trailing newlines. + return "OK" == base::TrimWhitespaceASCII(*body, base::TRIM_ALL); } };
diff --git a/chrome/browser/prerender/prerender_unittest.cc b/chrome/browser/prerender/prerender_unittest.cc index 4421af9..e338499 100644 --- a/chrome/browser/prerender/prerender_unittest.cc +++ b/chrome/browser/prerender/prerender_unittest.cc
@@ -95,18 +95,6 @@ const gfx::Rect& bounds, content::SessionStorageNamespace* session_storage_namespace) override; - bool GetChildId(int* child_id) const override { - // Having a default child_id of -1 forces pending prerenders not to fail - // on session storage and cross domain checking. - *child_id = -1; - return true; - } - - bool GetRouteId(int* route_id) const override { - *route_id = route_id_; - return true; - } - FinalStatus expected_final_status() const { return expected_final_status_; } bool prerendering_has_been_cancelled() const {
diff --git a/chrome/browser/reading_list/OWNERS b/chrome/browser/reading_list/OWNERS new file mode 100644 index 0000000..0f5a30f --- /dev/null +++ b/chrome/browser/reading_list/OWNERS
@@ -0,0 +1,9 @@ +dtrainor@chromium.org +xingliu@chromium.org + +# Backup reviewers: +twellington@chromium.org +wylieb@chromium.org + +# COMPONENT: UI>Browser>ReadLater +# OS: Android
diff --git a/chrome/browser/reading_list/android/BUILD.gn b/chrome/browser/reading_list/android/BUILD.gn index d78fd2c..4c52a03 100644 --- a/chrome/browser/reading_list/android/BUILD.gn +++ b/chrome/browser/reading_list/android/BUILD.gn
@@ -12,6 +12,8 @@ source_set("reading_list") { sources = [ + "empty_reading_list_manager.cc", + "empty_reading_list_manager.h", "reading_list_manager.cc", "reading_list_manager.h", ] @@ -19,7 +21,24 @@ # This target should not depend on anything in //chrome/* except the proto library. deps = [ "//base", + "//components/bookmarks/browser", "//components/keyed_service/core", "//components/reading_list/core", + "//url", + ] +} + +source_set("unit_tests") { + testonly = true + sources = [ "reading_list_manager_unittest.cc" ] + deps = [ + ":android", + "//base/test:test_support", + "//components/bookmarks/browser", + "//components/reading_list/core:core", + "//components/sync", + "//components/sync:test_support_model", + "//testing/gmock", + "//testing/gtest", ] }
diff --git a/chrome/browser/reading_list/android/empty_reading_list_manager.cc b/chrome/browser/reading_list/android/empty_reading_list_manager.cc new file mode 100644 index 0000000..49075146 --- /dev/null +++ b/chrome/browser/reading_list/android/empty_reading_list_manager.cc
@@ -0,0 +1,35 @@ +// 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/reading_list/android/empty_reading_list_manager.h" + +EmptyReadingListManager::EmptyReadingListManager() = default; + +EmptyReadingListManager::~EmptyReadingListManager() = default; + +const bookmarks::BookmarkNode* EmptyReadingListManager::Add( + const GURL& url, + const std::string& title) { + return nullptr; +} + +const bookmarks::BookmarkNode* EmptyReadingListManager::Get(const GURL& url) { + return nullptr; +} + +void EmptyReadingListManager::Delete(const GURL& url) {} + +const bookmarks::BookmarkNode* EmptyReadingListManager::GetRoot() const { + return nullptr; +} + +size_t EmptyReadingListManager::size() const { + return 0u; +} + +size_t EmptyReadingListManager::unread_size() const { + return 0u; +} + +void EmptyReadingListManager::SetReadStatus(const GURL& url, bool read) {}
diff --git a/chrome/browser/reading_list/android/empty_reading_list_manager.h b/chrome/browser/reading_list/android/empty_reading_list_manager.h new file mode 100644 index 0000000..0652751 --- /dev/null +++ b/chrome/browser/reading_list/android/empty_reading_list_manager.h
@@ -0,0 +1,29 @@ +// 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_READING_LIST_ANDROID_EMPTY_READING_LIST_MANAGER_H_ +#define CHROME_BROWSER_READING_LIST_ANDROID_EMPTY_READING_LIST_MANAGER_H_ + +#include "chrome/browser/reading_list/android/reading_list_manager.h" + +// Empty implementation of ReadingListManager, used when the read later feature +// is disabled. +class EmptyReadingListManager : public ReadingListManager { + public: + EmptyReadingListManager(); + ~EmptyReadingListManager() override; + + private: + // ReadingListManager implementation. + const bookmarks::BookmarkNode* Add(const GURL& url, + const std::string& title) override; + const bookmarks::BookmarkNode* Get(const GURL& url) override; + void Delete(const GURL& url) override; + const bookmarks::BookmarkNode* GetRoot() const override; + size_t size() const override; + size_t unread_size() const override; + void SetReadStatus(const GURL& url, bool read) override; +}; + +#endif // CHROME_BROWSER_READING_LIST_ANDROID_EMPTY_READING_LIST_MANAGER_H_
diff --git a/chrome/browser/reading_list/android/reading_list_manager.cc b/chrome/browser/reading_list/android/reading_list_manager.cc index f7421d5..c3cef09 100644 --- a/chrome/browser/reading_list/android/reading_list_manager.cc +++ b/chrome/browser/reading_list/android/reading_list_manager.cc
@@ -4,11 +4,173 @@ #include "chrome/browser/reading_list/android/reading_list_manager.h" +#include <utility> + +#include "base/guid.h" +#include "base/logging.h" +#include "base/strings/utf_string_conversions.h" +#include "components/bookmarks/browser/bookmark_node.h" #include "components/reading_list/core/reading_list_model.h" +#include "components/reading_list/core/reading_list_model_observer.h" +#include "url/gurl.h" -ReadingListManager::ReadingListManager(ReadingListModel* reading_list_model) - : reading_list_model_(reading_list_model) { - DCHECK(reading_list_model_); +using BookmarkNode = bookmarks::BookmarkNode; + +constexpr char kReadStatusKey[] = "read_status"; +constexpr char kReadStatusRead[] = "true"; +constexpr char kReadStatusUnread[] = "false"; + +// Implementation of ReadingListManager. +// 1. Holds a in memory bookmark node tree. Contains a folder root and reading +// list nodes as children. Only has one level of children. +// 2. Talk to reading list model, and sync with the in memory bookmark tree. +// 3. TODO(xingliu): Add an observer and broadcast events to caller. +class ReadingListManagerImpl : public ReadingListManager, + public ReadingListModelObserver { + public: + explicit ReadingListManagerImpl(ReadingListModel* reading_list_model) + : reading_list_model_(reading_list_model), maximum_id_(0L) { + DCHECK(reading_list_model_); + root_ = std::make_unique<BookmarkNode>(maximum_id_++, base::GenerateGUID(), + GURL()); + DCHECK(root_->is_folder()); + reading_list_model_->AddObserver(this); + } + + ~ReadingListManagerImpl() override { + reading_list_model_->RemoveObserver(this); + } + + // ReadingListModelObserver overrides. + void ReadingListModelLoaded(const ReadingListModel* model) override { + // Constructs the bookmark tree. + root_->DeleteAll(); + for (const auto& url : model->Keys()) + AddBookmark(model->GetEntryByURL(url)); + } + + // ReadingListManager implementation. + const BookmarkNode* Add(const GURL& url, const std::string& title) override { + DCHECK(reading_list_model_->loaded()); + + // Add or swap the reading list entry. + const auto& new_entry = reading_list_model_->AddEntry( + url, title, reading_list::ADDED_VIA_CURRENT_APP); + return AddBookmark(&new_entry); + } + + const BookmarkNode* Get(const GURL& url) override { + DCHECK(reading_list_model_->loaded()); + return FindBookmarkByURL(url); + } + + void Delete(const GURL& url) override { + DCHECK(reading_list_model_->loaded()); + + RemoveBookmark(url); + reading_list_model_->RemoveEntryByURL(url); + } + + const BookmarkNode* GetRoot() const override { + DCHECK(reading_list_model_->loaded()); + return root_.get(); + } + + size_t size() const override { + DCHECK(reading_list_model_->loaded()); + return reading_list_model_->size(); + } + + size_t unread_size() const override { + DCHECK(reading_list_model_->loaded()); + return reading_list_model_->unread_size(); + } + + void SetReadStatus(const GURL& url, bool read) override { + DCHECK(reading_list_model_->loaded()); + const auto* entry = reading_list_model_->GetEntryByURL(url); + if (!entry) + return; + + reading_list_model_->SetReadStatus(url, read); + auto* node = FindBookmarkByURL(url); + if (node) { + node->SetMetaInfo(kReadStatusKey, + read ? kReadStatusRead : kReadStatusUnread); + } + } + + private: + // Finds the child in the bookmark tree by URL. Returns nullptr if not found. + // Not recursive since the reading list bookmark tree only has a folder root + // node and one level of children. + BookmarkNode* FindBookmarkByURL(const GURL& url) { + for (const auto& child : root_->children()) { + if (url == child->url()) + return child.get(); + } + return nullptr; + } + + // Removes a reading list bookmark node by |url|. + void RemoveBookmark(const GURL& url) { + const BookmarkNode* node = FindBookmarkByURL(url); + if (node) + root_->Remove(root_->GetIndexOf(node)); + } + + // Adds a reading list entry to the bookmark tree. + const BookmarkNode* AddBookmark(const ReadingListEntry* entry) { + if (!entry) + return nullptr; + + // Update the existing bookmark node if possible. + BookmarkNode* node = FindBookmarkByURL(entry->URL()); + if (node) { + bool success = SyncToBookmark(*entry, node); + return success ? node : nullptr; + } + + // Add a new node. + auto new_node = std::make_unique<BookmarkNode>( + maximum_id_++, base::GenerateGUID(), entry->URL()); + bool success = SyncToBookmark(*entry, new_node.get()); + return success ? root_->Add(std::move(new_node)) : nullptr; + } + + // Sync the bookmark node with |entry|. Returns whether the conversion is + // succeeded. + static bool SyncToBookmark(const ReadingListEntry& entry, + BookmarkNode* bookmark) { + DCHECK(bookmark); + base::string16 title; + if (!base::UTF8ToUTF16(entry.Title().c_str(), entry.Title().size(), + &title)) { + LOG(ERROR) << "Failed to convert the title to string16."; + return false; + } + + bookmark->set_url(entry.URL()); + bookmark->set_date_added(base::Time::FromDeltaSinceWindowsEpoch( + base::TimeDelta::FromMicroseconds(entry.CreationTime()))); + bookmark->SetTitle(title); + bookmark->SetMetaInfo(kReadStatusKey, + entry.IsRead() ? kReadStatusRead : kReadStatusUnread); + return true; + } + + // Contains reading list data, outlives this class. + ReadingListModel* reading_list_model_; + + // The bookmark root for reading list articles. + std::unique_ptr<BookmarkNode> root_; + + // Auto increment bookmark id. Will not be persisted and only used in memory. + int64_t maximum_id_; +}; + +// static +std::unique_ptr<ReadingListManager> ReadingListManager::Create( + ReadingListModel* reading_list_model) { + return std::make_unique<ReadingListManagerImpl>(reading_list_model); } - -ReadingListManager::~ReadingListManager() = default;
diff --git a/chrome/browser/reading_list/android/reading_list_manager.h b/chrome/browser/reading_list/android/reading_list_manager.h index 36f0c31b..e7d81be 100644 --- a/chrome/browser/reading_list/android/reading_list_manager.h +++ b/chrome/browser/reading_list/android/reading_list_manager.h
@@ -7,20 +7,59 @@ #include "components/keyed_service/core/keyed_service.h" +#include <memory> +#include <string> + +namespace bookmarks { +class BookmarkNode; +} // namespace bookmarks + +class GURL; class ReadingListModel; // Owns a reading list model and converts reading list data to bookmark nodes. +// The bookmark nodes won't be persisted across sessions. class ReadingListManager : public KeyedService { public: - explicit ReadingListManager(ReadingListModel* reading_list_model); - ~ReadingListManager() override; + static std::unique_ptr<ReadingListManager> Create( + ReadingListModel* reading_list_model); + + ReadingListManager() = default; + ~ReadingListManager() override = default; ReadingListManager(const ReadingListManager&) = delete; ReadingListManager& operator=(const ReadingListManager&) = delete; - private: - // Contains reading list data, outlives this class. - ReadingListModel* reading_list_model_; + // Adds a reading list article to the unread section, and return the bookmark + // node representation. The bookmark node is owned by this class. If there is + // a duplicate URL, swaps the current reading list item. Returns nullptr on + // failure. + virtual const bookmarks::BookmarkNode* Add(const GURL& url, + const std::string& title) = 0; + + // Gets the bookmark node representation of a reading list article. The + // bookmark node is owned by this class. Returns nullptr if no such reading + // list. + virtual const bookmarks::BookmarkNode* Get(const GURL& url) = 0; + + // Deletes a reading list article. + virtual void Delete(const GURL& url) = 0; + + // Returns the root bookmark node for the reading list article. The bookmark + // node tree is owned by this class. All reading list articles are children of + // this root. + virtual const bookmarks::BookmarkNode* GetRoot() const = 0; + + // Returns the total number of reading list articles. This doesn't include the + // bookmark root. + virtual size_t size() const = 0; + + // Returns the total number of unread articles. + virtual size_t unread_size() const = 0; + + // Sets the read status for a reading list article. No op if such reading list + // article doesn't exist. + virtual void SetReadStatus(const GURL& url, bool read) = 0; }; #endif // CHROME_BROWSER_READING_LIST_ANDROID_READING_LIST_MANAGER_H_
diff --git a/chrome/browser/reading_list/android/reading_list_manager_unittest.cc b/chrome/browser/reading_list/android/reading_list_manager_unittest.cc new file mode 100644 index 0000000..292ce26a --- /dev/null +++ b/chrome/browser/reading_list/android/reading_list_manager_unittest.cc
@@ -0,0 +1,143 @@ +// 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/reading_list/android/reading_list_manager.h" + +#include <memory> +#include <string> +#include <utility> + +#include "base/strings/utf_string_conversions.h" +#include "base/test/simple_test_clock.h" +#include "components/bookmarks/browser/bookmark_node.h" +#include "components/reading_list/core/reading_list_model_impl.h" +#include "testing/gtest/include/gtest/gtest.h" + +using BookmarkNode = bookmarks::BookmarkNode; +using ReadingListEntries = ReadingListModelImpl::ReadingListEntries; + +namespace { + +constexpr char kURL[] = "https://www.example.com"; +constexpr char kTitle[] = + "In earlier tellings, the dog had a better reputation than the cat, " + "however the president vetoed it."; +constexpr char kTitle1[] = "boring title."; +constexpr char kReadStatusKey[] = "read_status"; +constexpr char kReadStatusRead[] = "true"; +constexpr char kReadStatusUnread[] = "false"; + +class ReadingListManagerTest : public testing::Test { + public: + ReadingListManagerTest() = default; + ~ReadingListManagerTest() override = default; + + void SetUp() override { + reading_list_model_ = std::make_unique<ReadingListModelImpl>( + /*storage_layer=*/nullptr, /*pref_service=*/nullptr, &clock_); + manager_ = ReadingListManager::Create(reading_list_model_.get()); + } + + protected: + ReadingListManager* manager() { return manager_.get(); } + ReadingListModelImpl* reading_list_model() { + return reading_list_model_.get(); + } + base::SimpleTestClock* clock() { return &clock_; } + + private: + base::SimpleTestClock clock_; + std::unique_ptr<ReadingListModelImpl> reading_list_model_; + std::unique_ptr<ReadingListManager> manager_; +}; + +// Verifies the states without any reading list data. +TEST_F(ReadingListManagerTest, RootWithEmptyReadingList) { + const auto* root = manager()->GetRoot(); + ASSERT_TRUE(root); + EXPECT_TRUE(root->is_folder()); + EXPECT_EQ(0u, manager()->size()); +} + +// Verifies load data into reading list model will update |manager_| as well. +TEST_F(ReadingListManagerTest, Load) { + // Load data into reading list model. + auto entries = std::make_unique<ReadingListEntries>(); + GURL url(kURL); + entries->emplace(url, ReadingListEntry(url, kTitle, clock()->Now())); + reading_list_model()->StoreLoaded(std::move(entries)); + + const auto* node = manager()->Get(url); + EXPECT_TRUE(node); + EXPECT_EQ(url, node->url()); + EXPECT_EQ(1u, manager()->size()); + EXPECT_EQ(1u, manager()->unread_size()); +} + +// Verifes Add(), Get(), Delete() API in reading list manager. +TEST_F(ReadingListManagerTest, AddGetDelete) { + // Adds a node. + GURL url(kURL); + manager()->Add(url, kTitle); + EXPECT_EQ(1u, manager()->size()); + EXPECT_EQ(1u, manager()->unread_size()); + EXPECT_EQ(1u, manager()->GetRoot()->children().size()) + << "The reading list node should be the child of the root."; + + // Gets the node, and verifies its content. + const BookmarkNode* node = manager()->Get(url); + ASSERT_TRUE(node); + EXPECT_EQ(url, node->url()); + EXPECT_EQ(kTitle, base::UTF16ToUTF8(node->GetTitle())); + std::string read_status; + node->GetMetaInfo(kReadStatusKey, &read_status); + EXPECT_EQ(kReadStatusUnread, read_status) + << "By default the reading list node is marked as unread."; + + // Deletes the node. + manager()->Delete(url); + EXPECT_EQ(0u, manager()->size()); + EXPECT_EQ(0u, manager()->unread_size()); + EXPECT_TRUE(manager()->GetRoot()->children().empty()); +} + +// Verifies Add() the same URL twice will not invalidate returned pointers, and +// the content is updated. +TEST_F(ReadingListManagerTest, AddTwice) { + // Adds a node. + GURL url(kURL); + const auto* node = manager()->Add(url, kTitle); + const auto* new_node = manager()->Add(url, kTitle1); + EXPECT_EQ(node, new_node) << "Add same URL shouldn't invalidate pointers."; + EXPECT_EQ(kTitle1, base::UTF16ToUTF8(node->GetTitle())); +} + +// Verifes SetReadStatus() API. +TEST_F(ReadingListManagerTest, SetReadStatus) { + GURL url(kURL); + manager()->SetReadStatus(url, true); + EXPECT_EQ(0u, manager()->size()); + + // Add a node. + manager()->Add(url, kTitle); + manager()->SetReadStatus(url, true); + + // Mark as read. + const BookmarkNode* node = manager()->Get(url); + ASSERT_TRUE(node); + EXPECT_EQ(url, node->url()); + std::string read_status; + node->GetMetaInfo(kReadStatusKey, &read_status); + EXPECT_EQ(kReadStatusRead, read_status); + EXPECT_EQ(0u, manager()->unread_size()); + + // Mark as unread. + manager()->SetReadStatus(url, false); + node = manager()->Get(url); + node->GetMetaInfo(kReadStatusKey, &read_status); + EXPECT_EQ(kReadStatusUnread, read_status); + EXPECT_EQ(1u, manager()->unread_size()); +} + +} // namespace
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index b5bc18f..4842820 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -887,7 +887,6 @@ bool supports_smart_text_selection = false; #if defined(OS_CHROMEOS) supports_smart_text_selection = - base::FeatureList::IsEnabled(arc::kSmartTextSelectionFeature) && content_type_->SupportsGroup( ContextMenuContentType::ITEM_GROUP_SMART_SELECTION) && arc::IsArcPlayStoreEnabledForProfile(GetProfile());
diff --git a/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc b/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc index 199e7eb0..321ba18 100644 --- a/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc +++ b/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc
@@ -36,6 +36,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/memory/pressure/pressure.h" #include "chromeos/memory/pressure/system_memory_pressure_evaluator.h" #include "components/arc/arc_service_manager.h" #include "components/arc/arc_util.h" @@ -234,14 +235,14 @@ // memory back to the margin. int TabManagerDelegate::MemoryStat::TargetMemoryToFreeKB() { uint64_t available_mem_mb; - auto* monitor = chromeos::memory::SystemMemoryPressureEvaluator::Get(); - if (monitor) { - available_mem_mb = monitor->GetAvailableMemoryKB(); + if (chromeos::memory::SystemMemoryPressureEvaluator::Get()) { + available_mem_mb = chromeos::memory::pressure::GetAvailableMemoryKB(); } else { // When TabManager::DiscardTab(LifecycleUnitDiscardReason::EXTERNAL) is // called by a test or an extension, TabManagerDelegate might be used // without chromeos SystemMemoryPressureEvaluator, e.g. the browser test - // DiscardTabsWithMinimizedWindow. + // DiscardTabsWithMinimizedWindow. Set available to 0 to force discarding a + // tab to pass the test. LOG(WARNING) << "SystemMemoryPressureEvaluator is not available"; available_mem_mb = 0; }
diff --git a/chrome/browser/resources/bookmarks/BUILD.gn b/chrome/browser/resources/bookmarks/BUILD.gn index e10bbda..7552c8be 100644 --- a/chrome/browser/resources/bookmarks/BUILD.gn +++ b/chrome/browser/resources/bookmarks/BUILD.gn
@@ -142,8 +142,8 @@ ":store", ":store_client", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/cr_elements:find_shortcut_behavior.m", "//ui/webui/resources/cr_elements/cr_splitter:cr_splitter", - "//ui/webui/resources/js:find_shortcut_behavior.m", "//ui/webui/resources/js:load_time_data.m", ] externs_list = [
diff --git a/chrome/browser/resources/bookmarks/app.js b/chrome/browser/resources/bookmarks/app.js index 3f90d04..456d71a0 100644 --- a/chrome/browser/resources/bookmarks/app.js +++ b/chrome/browser/resources/bookmarks/app.js
@@ -14,7 +14,7 @@ import './strings.m.js'; import './toolbar.js'; -import {FindShortcutBehavior} from 'chrome://resources/js/find_shortcut_behavior.m.js'; +import {FindShortcutBehavior} from 'chrome://resources/cr_elements/find_shortcut_behavior.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/focus_ring_manager.js b/chrome/browser/resources/chromeos/accessibility/switch_access/focus_ring_manager.js index c106618..fca01b2a 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/focus_ring_manager.js +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/focus_ring_manager.js
@@ -49,7 +49,7 @@ } /** - * Sets the primary and next focus rings based on the current primary and + * Sets the primary and preview focus rings based on the current primary and * group nodes used for navigation. * @param {!SAChildNode} node */ @@ -64,12 +64,12 @@ manager.rings_.get(SAConstants.Focus.ID.PRIMARY).rects = []; // Clear the dashed ring between transitions, as the animation is // distracting. - manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = []; + manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects = []; manager.updateFocusRings_(); // The dashed focus ring should not be shown around the menu when exiting. if (!MenuManager.isMenuOpen()) { - manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = + manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects = [backButton.group.location]; manager.updateFocusRings_(); } @@ -83,13 +83,14 @@ true /* shouldRecover */); } - // If the primary node is a group, show its first child as the "next" focus. + // If the primary node is a group, show its first child as the "preview" + // focus. if (node.isGroup()) { const firstChild = node.asRootNode().firstChild; // Clear the dashed ring between transitions, as the animation is // distracting. - manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = []; + manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects = []; manager.updateFocusRings_(); let focusRect = node.location; @@ -99,7 +100,7 @@ // expand to contain the child rect. focusRect = RectUtil.expandToFitWithPadding( SAConstants.Focus.GROUP_BUFFER, focusRect, childRect); - manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = [childRect]; + manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects = [childRect]; } manager.rings_.get(SAConstants.Focus.ID.PRIMARY).rects = [focusRect]; manager.updateFocusRings_(); @@ -107,7 +108,7 @@ } manager.rings_.get(SAConstants.Focus.ID.PRIMARY).rects = [node.location]; - manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = []; + manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects = []; manager.updateFocusRings_(); } @@ -133,8 +134,8 @@ secondaryColor: SAConstants.Focus.SECONDARY_COLOR }; - const nextRing = { - id: SAConstants.Focus.ID.NEXT, + const previewRing = { + id: SAConstants.Focus.ID.PREVIEW, rects: [], type: chrome.accessibilityPrivate.FocusType.DASHED, color: SAConstants.Focus.PRIMARY_COLOR, @@ -143,7 +144,7 @@ return new Map([ [SAConstants.Focus.ID.PRIMARY, primaryRing], - [SAConstants.Focus.ID.NEXT, nextRing] + [SAConstants.Focus.ID.PREVIEW, previewRing] ]); }
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_constants.js b/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_constants.js index c48b8d03..0f2e736 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_constants.js +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_constants.js
@@ -132,8 +132,9 @@ ID: { // The ID for the ring showing the user's current focus. PRIMARY: 'primary', - // The ID for the ring showing the next focus. - NEXT: 'next', + // The ID for the ring showing a preview of the next focus, if the user + // selects the current element. + PREVIEW: 'preview', // The ID for the area where text is being input. TEXT: 'text' },
diff --git a/chrome/browser/resources/downloads/BUILD.gn b/chrome/browser/resources/downloads/BUILD.gn index 2901ea0..210632f 100644 --- a/chrome/browser/resources/downloads/BUILD.gn +++ b/chrome/browser/resources/downloads/BUILD.gn
@@ -117,9 +117,9 @@ ":toolbar", "//third_party/polymer/v3_0/components-chromium/iron-a11y-announcer", "//third_party/polymer/v3_0/components-chromium/iron-list", + "//ui/webui/resources/cr_elements:find_shortcut_behavior.m", "//ui/webui/resources/cr_elements/cr_toast:cr_toast_manager.m", "//ui/webui/resources/js:assert.m", - "//ui/webui/resources/js:find_shortcut_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:promise_resolver.m", "//ui/webui/resources/js:util.m",
diff --git a/chrome/browser/resources/downloads/manager.js b/chrome/browser/resources/downloads/manager.js index 2e1fd11..b918c1b 100644 --- a/chrome/browser/resources/downloads/manager.js +++ b/chrome/browser/resources/downloads/manager.js
@@ -14,8 +14,8 @@ import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import {getToastManager} from 'chrome://resources/cr_elements/cr_toast/cr_toast_manager.m.js'; +import {FindShortcutBehavior} from 'chrome://resources/cr_elements/find_shortcut_behavior.m.js'; import {assert} from 'chrome://resources/js/assert.m.js'; -import {FindShortcutBehavior} from 'chrome://resources/js/find_shortcut_behavior.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js'; import {queryRequiredElement} from 'chrome://resources/js/util.m.js';
diff --git a/chrome/browser/resources/history/BUILD.gn b/chrome/browser/resources/history/BUILD.gn index 5df85c7d..2c7a224 100644 --- a/chrome/browser/resources/history/BUILD.gn +++ b/chrome/browser/resources/history/BUILD.gn
@@ -152,9 +152,9 @@ ":synced_device_card", ":synced_device_manager", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/cr_elements:find_shortcut_behavior.m", "//ui/webui/resources/cr_elements/cr_drawer:cr_drawer.m", "//ui/webui/resources/js:assert.m", - "//ui/webui/resources/js:find_shortcut_behavior.m", "//ui/webui/resources/js:web_ui_listener_behavior.m", ] }
diff --git a/chrome/browser/resources/history/app.js b/chrome/browser/resources/history/app.js index 9fd5e28..204a99c 100644 --- a/chrome/browser/resources/history/app.js +++ b/chrome/browser/resources/history/app.js
@@ -6,7 +6,7 @@ import 'chrome://resources/cr_elements/shared_style_css.m.js'; import 'chrome://resources/cr_elements/shared_vars_css.m.js'; import {assert} from 'chrome://resources/js/assert.m.js'; -import {FindShortcutBehavior} from 'chrome://resources/js/find_shortcut_behavior.m.js'; +import {FindShortcutBehavior} from 'chrome://resources/cr_elements/find_shortcut_behavior.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import 'chrome://resources/polymer/v3_0/iron-media-query/iron-media-query.js';
diff --git a/chrome/browser/resources/pdf/elements/viewer-bookmark.html b/chrome/browser/resources/pdf/elements/viewer-bookmark.html index a648c0b1..f165b13 100644 --- a/chrome/browser/resources/pdf/elements/viewer-bookmark.html +++ b/chrome/browser/resources/pdf/elements/viewer-bookmark.html
@@ -77,6 +77,7 @@ <div id="item" on-click="onClick_"> <div id="expand-container"> <cr-icon-button id="expand" iron-icon="cr:chevron-right" + aria-expanded$="[[getAriaExpanded_(childrenShown_)]]" on-click="toggleChildren_"></cr-icon-button> </div> <span id="title" tabindex="0">[[bookmark.title]]</span>
diff --git a/chrome/browser/resources/pdf/elements/viewer-bookmark.js b/chrome/browser/resources/pdf/elements/viewer-bookmark.js index f08a855..4322515 100644 --- a/chrome/browser/resources/pdf/elements/viewer-bookmark.js +++ b/chrome/browser/resources/pdf/elements/viewer-bookmark.js
@@ -29,7 +29,7 @@ depth: { type: Number, - observer: 'depthChanged_' + observer: 'depthChanged_', }, /** @private */ @@ -122,5 +122,13 @@ toggleChildren_(e) { this.childrenShown_ = !this.childrenShown_; e.stopPropagation(); // Prevent the above onClick_ handler from firing. - } + }, + + /** + * @return {string} + * @private + */ + getAriaExpanded_() { + return this.childrenShown_ ? 'true' : 'false'; + }, });
diff --git a/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.js b/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.js index c18e0591..96edfe74 100644 --- a/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.js +++ b/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar-new.js
@@ -307,6 +307,12 @@ if (Number.isNaN(value)) { return false; } + + // The viewport can have non-integer zoom values. + if (Math.abs(this.viewportZoom * 100 - value) < 0.5) { + return false; + } + this.dispatchEvent(new CustomEvent('zoom-changed', {detail: value})); return true; }
diff --git a/chrome/browser/resources/settings/autofill_page/password_check_list_item.html b/chrome/browser/resources/settings/autofill_page/password_check_list_item.html index 7d9b125..abebed9b 100644 --- a/chrome/browser/resources/settings/autofill_page/password_check_list_item.html +++ b/chrome/browser/resources/settings/autofill_page/password_check_list_item.html
@@ -68,6 +68,10 @@ :host-context([dir='rtl']) #insecureOrigin { justify-content: flex-start; } + + :host-context([dir='rtl']) #change-password-link-icon { + transform: scaleX(-1); + } </style> <div class="list-item" id="insecure-item" focus-row-container> <site-favicon url="[[item.changePasswordUrl]]"></site-favicon>
diff --git a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html index beb2373..bf4c4cd 100644 --- a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html +++ b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html
@@ -12,6 +12,15 @@ margin-inline-start: 2px; margin-top: 16px; } + + cr-input { + --cr-input-error-display: none; + } + + #usernameInput[invalid] { + --cr-input-error-display: block; + } + </style> <cr-dialog id="dialog" close-text="$i18n{close}"> <div slot="title" id="title">[[getTitle_(isEditDialog_)]]</div>
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn index 12a0d76..c21c969 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/BUILD.gn
@@ -154,8 +154,8 @@ deps = [ "../../languages_page:languages", "//ui/webui/resources/cr_elements:cr_scrollable_behavior", + "//ui/webui/resources/cr_elements:find_shortcut_behavior", "//ui/webui/resources/cr_elements/cr_search_field:cr_search_field", - "//ui/webui/resources/js:find_shortcut_behavior", ] } @@ -260,8 +260,8 @@ "../../languages_page:languages.m", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements:cr_scrollable_behavior.m", + "//ui/webui/resources/cr_elements:find_shortcut_behavior.m", "//ui/webui/resources/cr_elements/cr_search_field:cr_search_field.m", - "//ui/webui/resources/js:find_shortcut_behavior.m", ] extra_deps = [ ":os_add_languages_dialog_module" ] } @@ -372,6 +372,7 @@ ":os_languages_page_v2_module", ":os_languages_section_module", ":shared_style_module", + ":shared_vars_module", ":smart_inputs_page_module", "../../languages_page:languages_module", "../../languages_page:modulize", @@ -474,6 +475,12 @@ html_type = "style-module" } +polymer_modulizer("shared_vars") { + js_file = "shared_vars.m.js" + html_file = "shared_vars.html" + html_type = "custom-style" +} + polymer_modulizer("smart_inputs_page") { js_file = "smart_inputs_page.js" html_file = "smart_inputs_page.html"
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/add_input_methods_dialog.html b/chrome/browser/resources/settings/chromeos/os_languages_page/add_input_methods_dialog.html index 86ca8b04..4173e58 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/add_input_methods_dialog.html +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/add_input_methods_dialog.html
@@ -19,7 +19,6 @@ flex-direction: column; height: 336px; overflow: auto; - padding-inline-end: 0; } cr-search-field {
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.html b/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.html index cc897ca..3b632a76 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.html +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.html
@@ -31,7 +31,8 @@ cr-search-field { margin-bottom: 16px; - margin-inline-start: 20px; + margin-inline-end: var(--dialog-horizontal-padding); + margin-inline-start: var(--dialog-horizontal-padding); margin-top: 16px; } @@ -58,8 +59,8 @@ } .padded { - padding-inline-end: 20px; - padding-inline-start: 20px; + padding-inline-end: var(--dialog-horizontal-padding); + padding-inline-start: var(--dialog-horizontal-padding); } paper-ripple {
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.html b/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.html index bf8a462c..8b1cebd04 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.html +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.html
@@ -36,6 +36,12 @@ margin-bottom: var(--cr-section-vertical-margin); } + .explain-selected { + color: var(--cros-success-color); + font-weight: initial; + margin-top: 4px; + } + .icon-external { margin-inline-end: 0; } @@ -131,7 +137,7 @@ <template is="dom-repeat" items="[[languages.inputMethods.enabled]]"> <div class$="list-item [[getInputMethodItemClass_( - item.id, languages.inputMethods.currentId)]]" + item.id, languages.inputMethods.currentId)]] no-outline" actionable on-click="onInputMethodClick_" on-keypress="onInputMethodKeyPress_" tabindex$="[[getInputMethodTabIndex_( @@ -139,6 +145,11 @@ aria-labelledby$="language-[[index]]" role="button"> <div class="start" id="language-[[index]]" aria-hidden="true"> <div class="display-name">[[item.displayName]]</div> + <div class="explain-selected" + hidden="[[!isCurrentInputMethod_( + item.id, languages.inputMethods.currentId)]]"> + $i18n{inputMethodEnabled} + </div> </div> <template is="dom-if" if="[[hasOptionsPageInSettings_(item.id)]]">
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js b/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js index 221a499..06435da 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js
@@ -141,6 +141,9 @@ } this.languageHelper.setCurrentInputMethod(e.model.item.id); + this.languagesMetricsProxy_.recordInteraction( + settings.LanguagesPageInteraction.SWITCH_INPUT_METHOD); + settings.recordSettingChange(); }, /**
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/languages_metrics_proxy.js b/chrome/browser/resources/settings/chromeos/os_languages_page/languages_metrics_proxy.js index 21d7953..8d7437f 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/languages_metrics_proxy.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/languages_metrics_proxy.js
@@ -19,7 +19,7 @@ /* #export */ const LanguagesPageInteraction = { SWITCH_SYSTEM_LANGUAGE: 0, RESTART: 1, - RESTART_NOW: 2, + SWITCH_INPUT_METHOD: 2, RESTART_LATER: 3, OPEN_CUSTOM_SPELL_CHECK: 4, };
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/os_add_languages_dialog.html b/chrome/browser/resources/settings/chromeos/os_languages_page/os_add_languages_dialog.html index 9ad3af03b..ef7c382 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/os_add_languages_dialog.html +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/os_add_languages_dialog.html
@@ -5,8 +5,8 @@ <link rel="import" href="chrome://resources/cr_elements/cr_scrollable_behavior.html"> <link rel="import" href="chrome://resources/cr_elements/cr_search_field/cr_search_field.html"> <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html"> +<link rel="import" href="chrome://resources/cr_elements/find_shortcut_behavior.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> -<link rel="import" href="chrome://resources/html/find_shortcut_behavior.html"> <link rel="import" href="chrome://resources/html/load_time_data.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html"> <link rel="import" href="shared_style.html"> @@ -21,7 +21,6 @@ flex-direction: column; height: 350px; overflow: auto; - padding-inline-end: 0; } cr-search-field {
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/shared_style.html b/chrome/browser/resources/settings/chromeos/os_languages_page/shared_style.html index a8940ac6..8c9e3bb 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/shared_style.html +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/shared_style.html
@@ -1,3 +1,4 @@ +<link rel="import" href="shared_vars.html"> <!-- Common styles for 'Languages and inputs' section. --> <dom-module id="shared-style"> @@ -19,13 +20,23 @@ --cr-search-field-search-icon-inline-margin-start: 6px; background-color: var(--google-grey-100); border-radius: 4px; - margin-inline-end: 20px; + } + + cr-dialog [slot=title] { + padding-inline-end: var(--dialog-horizontal-padding); + padding-inline-start: var(--dialog-horizontal-padding); + padding-top: var(--dialog-horizontal-padding); + } + + cr-dialog [slot=body] { + padding-inline-end: var(--dialog-horizontal-padding); + padding-inline-start: var(--dialog-horizontal-padding); } cr-dialog [slot=button-container] { padding-bottom: 20px; - padding-inline-end: 20px; - padding-inline-start: 20px; + padding-inline-end: var(--dialog-horizontal-padding); + padding-inline-start: var(--dialog-horizontal-padding); padding-top: 20px; } </style>
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/shared_vars.html b/chrome/browser/resources/settings/chromeos/os_languages_page/shared_vars.html new file mode 100644 index 0000000..a3ec82e --- /dev/null +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/shared_vars.html
@@ -0,0 +1,11 @@ +<link rel="import" href="chrome://resources/html/polymer.html"> + +<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> + +<custom-style> +<style> + html { + --dialog-horizontal-padding: 24px; + } +</style> +</custom-style> \ No newline at end of file
diff --git a/chrome/browser/resources/settings/chromeos/os_settings_resources_v3.grdp b/chrome/browser/resources/settings/chromeos/os_settings_resources_v3.grdp index bc2d741..5aff4d3 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings_resources_v3.grdp +++ b/chrome/browser/resources/settings/chromeos/os_settings_resources_v3.grdp
@@ -214,6 +214,11 @@ use_base_dir="false" compress="false" type="BINDATA" /> + <include name="IDR_OS_SETTINGS_LANGUAGES_PAGE_SHARED_VARS_M_JS" + file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_languages_page/shared_vars.m.js" + use_base_dir="false" + compress="false" + type="BINDATA" /> <include name="IDR_OS_SETTINGS_LANGUAGES_PAGE_SMART_INPUTS_PAGE_M_JS" file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/os_languages_page/smart_inputs_page.m.js" use_base_dir="false"
diff --git a/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn index 3a41971..5a3dde0c 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_settings_ui/BUILD.gn
@@ -19,10 +19,10 @@ "../os_settings_main:os_settings_main", "../os_toolbar", "//ui/webui/resources/cr_elements:cr_container_shadow_behavior", + "//ui/webui/resources/cr_elements:find_shortcut_behavior", "//ui/webui/resources/cr_elements/cr_drawer:cr_drawer", "//ui/webui/resources/cr_elements/cr_toolbar:cr_toolbar_search_field", "//ui/webui/resources/cr_elements/policy:cr_policy_indicator_behavior", - "//ui/webui/resources/js:find_shortcut_behavior", ] }
diff --git a/chrome/browser/resources/settings/chromeos/os_settings_ui/os_settings_ui.html b/chrome/browser/resources/settings/chromeos/os_settings_ui/os_settings_ui.html index fd18bba..45b5fbf 100644 --- a/chrome/browser/resources/settings/chromeos/os_settings_ui/os_settings_ui.html +++ b/chrome/browser/resources/settings/chromeos/os_settings_ui/os_settings_ui.html
@@ -5,7 +5,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_page_host_style_css.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> -<link rel="import" href="chrome://resources/html/find_shortcut_behavior.html"> +<link rel="import" href="chrome://resources/cr_elements/find_shortcut_behavior.html"> <link rel="import" href="chrome://resources/html/util.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html"> <link rel="import" href="../metrics_recorder.html">
diff --git a/chrome/browser/resources/settings/languages_page/BUILD.gn b/chrome/browser/resources/settings/languages_page/BUILD.gn index ab11a6f8..5a839669 100644 --- a/chrome/browser/resources/settings/languages_page/BUILD.gn +++ b/chrome/browser/resources/settings/languages_page/BUILD.gn
@@ -73,8 +73,8 @@ ":languages_types", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements:cr_scrollable_behavior.m", + "//ui/webui/resources/cr_elements:find_shortcut_behavior.m", "//ui/webui/resources/cr_elements/cr_search_field:cr_search_field.m", - "//ui/webui/resources/js:find_shortcut_behavior.m", ] }
diff --git a/chrome/browser/resources/settings/languages_page/add_languages_dialog.js b/chrome/browser/resources/settings/languages_page/add_languages_dialog.js index e496c49..21d59968 100644 --- a/chrome/browser/resources/settings/languages_page/add_languages_dialog.js +++ b/chrome/browser/resources/settings/languages_page/add_languages_dialog.js
@@ -16,7 +16,7 @@ import '../settings_shared_css.m.js'; import {CrScrollableBehavior} from 'chrome://resources/cr_elements/cr_scrollable_behavior.m.js'; -import {FindShortcutBehavior} from 'chrome://resources/js/find_shortcut_behavior.m.js'; +import {FindShortcutBehavior} from 'chrome://resources/cr_elements/find_shortcut_behavior.m.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; Polymer({
diff --git a/chrome/browser/resources/settings/os_settings_resources.grd b/chrome/browser/resources/settings/os_settings_resources.grd index f83bf32..14c73af 100644 --- a/chrome/browser/resources/settings/os_settings_resources.grd +++ b/chrome/browser/resources/settings/os_settings_resources.grd
@@ -782,6 +782,9 @@ <structure name="IDR_OS_SETTINGS_LANGUAGES_SHARED_STYLE_HTML" file="chromeos/os_languages_page/shared_style.html" compress="false" type="chrome_html" /> + <structure name="IDR_OS_SETTINGS_LANGUAGES_SHARED_VARS_HTML" + file="chromeos/os_languages_page/shared_vars.html" + compress="false" type="chrome_html" /> <structure name="IDR_OS_SETTINGS_LANGUAGES_SMART_INPUTS_PAGE_HTML" file="chromeos/os_languages_page/smart_inputs_page.html" compress="false" type="chrome_html" />
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html index 94dae1df..58c5fe91 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
@@ -724,40 +724,38 @@ </settings-subpage> </template> </template> - <template is="dom-if" if="[[enableFileSystemWriteContentSetting_]]"> - <template is="dom-if" route-path="/content/filesystem" no-search> - <settings-subpage - page-title="$i18n{siteSettingsFileSystemWrite}"> - <template is="dom-if" if="[[enableContentSettingsRedesign_]]"> - <div class="content-settings-header"> - <h2>$i18n{siteSettingsFileSystemWriteDescription}</h2> - </div> - <settings-category-default-radio-group - category="[[ContentSettingsTypes.FILE_SYSTEM_WRITE]]" - allow-option-label= - "$i18n{siteSettingsFileSystemWriteAllowed}" - allow-option-icon="settings:save-original" - block-option-label= - "$i18n{siteSettingsFileSystemWriteBlocked}" - block-option-icon="settings:block"> - </settings-category-default-radio-group> - </template> - <template is="dom-if" if="[[!enableContentSettingsRedesign_]]"> - <category-default-setting - toggle-off-label="$i18n{siteSettingsFileSystemWriteBlock}" - toggle-on-label= - "$i18n{siteSettingsFileSystemWriteAskRecommended}" - category="[[ContentSettingsTypes.FILE_SYSTEM_WRITE]]"> - </category-default-setting> - </template> - <category-setting-exceptions + <template is="dom-if" route-path="/content/filesystem" no-search> + <settings-subpage + page-title="$i18n{siteSettingsFileSystemWrite}"> + <template is="dom-if" if="[[enableContentSettingsRedesign_]]"> + <div class="content-settings-header"> + <h2>$i18n{siteSettingsFileSystemWriteDescription}</h2> + </div> + <settings-category-default-radio-group category="[[ContentSettingsTypes.FILE_SYSTEM_WRITE]]" - read-only-list - block-header="$i18n{siteSettingsBlock}" - search-filter="[[searchFilter_]]"> - </category-setting-exceptions> - </settings-subpage> - </template> + allow-option-label= + "$i18n{siteSettingsFileSystemWriteAllowed}" + allow-option-icon="settings:save-original" + block-option-label= + "$i18n{siteSettingsFileSystemWriteBlocked}" + block-option-icon="settings:block"> + </settings-category-default-radio-group> + </template> + <template is="dom-if" if="[[!enableContentSettingsRedesign_]]"> + <category-default-setting + toggle-off-label="$i18n{siteSettingsFileSystemWriteBlock}" + toggle-on-label= + "$i18n{siteSettingsFileSystemWriteAskRecommended}" + category="[[ContentSettingsTypes.FILE_SYSTEM_WRITE]]"> + </category-default-setting> + </template> + <category-setting-exceptions + category="[[ContentSettingsTypes.FILE_SYSTEM_WRITE]]" + read-only-list + block-header="$i18n{siteSettingsBlock}" + search-filter="[[searchFilter_]]"> + </category-setting-exceptions> + </settings-subpage> </template> <template is="dom-if" route-path="/content/hidDevices" no-search> <settings-subpage page-title="$i18n{siteSettingsHidDevices}">
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.js b/chrome/browser/resources/settings/privacy_page/privacy_page.js index f3c5ae1..4618929 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.js +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.js
@@ -144,14 +144,6 @@ }, /** @private */ - enableFileSystemWriteContentSetting_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('enableFileSystemWriteContentSetting'); - } - }, - - /** @private */ enableFontAccessContentSetting_: { type: Boolean, value() {
diff --git a/chrome/browser/resources/settings/route.js b/chrome/browser/resources/settings/route.js index f8dbb8bd..1a2e94d 100644 --- a/chrome/browser/resources/settings/route.js +++ b/chrome/browser/resources/settings/route.js
@@ -81,10 +81,7 @@ r.SITE_SETTINGS_WINDOW_PLACEMENT = r.SITE_SETTINGS.createChild('windowPlacement'); } - if (loadTimeData.getBoolean('enableFileSystemWriteContentSetting')) { - r.SITE_SETTINGS_FILE_SYSTEM_WRITE = - r.SITE_SETTINGS.createChild('filesystem'); - } + r.SITE_SETTINGS_FILE_SYSTEM_WRITE = r.SITE_SETTINGS.createChild('filesystem'); if (loadTimeData.getBoolean('enableFontAccessContentSetting')) { r.SITE_SETTINGS_FONT_ACCESS = r.SITE_SETTINGS.createChild('fontAccess'); }
diff --git a/chrome/browser/resources/settings/settings_page/BUILD.gn b/chrome/browser/resources/settings/settings_page/BUILD.gn index 413ff29..c58fd5c 100644 --- a/chrome/browser/resources/settings/settings_page/BUILD.gn +++ b/chrome/browser/resources/settings/settings_page/BUILD.gn
@@ -34,9 +34,9 @@ "..:router", "..:setting_id_param_util", "//third_party/polymer/v1_0/components-chromium/iron-resizable-behavior:iron-resizable-behavior-extracted", + "//ui/webui/resources/cr_elements:find_shortcut_behavior", "//ui/webui/resources/cr_elements/cr_search_field:cr_search_field", "//ui/webui/resources/js:assert", - "//ui/webui/resources/js:find_shortcut_behavior", "//ui/webui/resources/js:i18n_behavior", "//ui/webui/resources/js:load_time_data", "//ui/webui/resources/js:util", @@ -94,9 +94,9 @@ "..:setting_id_param_util.m", "//third_party/polymer/v3_0/components-chromium/iron-resizable-behavior:iron-resizable-behavior", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/cr_elements:find_shortcut_behavior.m", "//ui/webui/resources/cr_elements/cr_search_field:cr_search_field.m", "//ui/webui/resources/js:assert.m", - "//ui/webui/resources/js:find_shortcut_behavior.m", "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:util.m",
diff --git a/chrome/browser/resources/settings/settings_page/settings_subpage.html b/chrome/browser/resources/settings/settings_page/settings_subpage.html index 0556d1d..6a25c02 100644 --- a/chrome/browser/resources/settings/settings_page/settings_subpage.html +++ b/chrome/browser/resources/settings/settings_page/settings_subpage.html
@@ -6,7 +6,7 @@ <link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/cr_elements/shared_style_css.html"> <link rel="import" href="chrome://resources/html/assert.html"> -<link rel="import" href="chrome://resources/html/find_shortcut_behavior.html"> +<link rel="import" href="chrome://resources/cr_elements/find_shortcut_behavior.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/util.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
diff --git a/chrome/browser/resources/settings/settings_ui/BUILD.gn b/chrome/browser/resources/settings/settings_ui/BUILD.gn index a4f02adff..fa5b565 100644 --- a/chrome/browser/resources/settings/settings_ui/BUILD.gn +++ b/chrome/browser/resources/settings/settings_ui/BUILD.gn
@@ -24,13 +24,13 @@ "../settings_menu:settings_menu", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements:cr_container_shadow_behavior.m", + "//ui/webui/resources/cr_elements:find_shortcut_behavior.m", "//ui/webui/resources/cr_elements/cr_drawer:cr_drawer.m", "//ui/webui/resources/cr_elements/cr_toolbar:cr_toolbar.m", "//ui/webui/resources/cr_elements/cr_toolbar:cr_toolbar_search_field.m", "//ui/webui/resources/cr_elements/policy:cr_policy_indicator_behavior.m", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:cr.m", - "//ui/webui/resources/js:find_shortcut_behavior.m", "//ui/webui/resources/js:util.m", ] }
diff --git a/chrome/browser/resources/settings/settings_ui/settings_ui.js b/chrome/browser/resources/settings/settings_ui/settings_ui.js index d9459ba..041bcd6 100644 --- a/chrome/browser/resources/settings/settings_ui/settings_ui.js +++ b/chrome/browser/resources/settings/settings_ui/settings_ui.js
@@ -24,9 +24,9 @@ import '../settings_vars_css.m.js'; import {CrContainerShadowBehavior} from 'chrome://resources/cr_elements/cr_container_shadow_behavior.m.js'; +import {FindShortcutBehavior} from 'chrome://resources/cr_elements/find_shortcut_behavior.m.js'; import {assert} from 'chrome://resources/js/assert.m.js'; import {isChromeOS} from 'chrome://resources/js/cr.m.js'; -import {FindShortcutBehavior} from 'chrome://resources/js/find_shortcut_behavior.m.js'; import {listenOnce} from 'chrome://resources/js/util.m.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html index e22ec5e..41e59a52 100644 --- a/chrome/browser/resources/settings/site_settings/site_details.html +++ b/chrome/browser/resources/settings/site_settings/site_details.html
@@ -181,13 +181,11 @@ label="$i18n{siteSettingsBluetoothDevices}"> </site-details-permission> </template> - <template is="dom-if" if="[[enableFileSystemWriteContentSetting_]]"> - <site-details-permission - category="[[ContentSettingsTypes.FILE_SYSTEM_WRITE]]" - icon="settings:save-original" - label="$i18n{siteSettingsFileSystemWrite}"> - </site-details-permission> - </template> + <site-details-permission + category="[[ContentSettingsTypes.FILE_SYSTEM_WRITE]]" + icon="settings:save-original" + label="$i18n{siteSettingsFileSystemWrite}"> + </site-details-permission> <site-details-permission category="[[ContentSettingsTypes.HID_DEVICES]]" icon="settings:hid-device" label="$i18n{siteSettingsHidDevices}"> </site-details-permission>
diff --git a/chrome/browser/resources/settings/site_settings/site_details.js b/chrome/browser/resources/settings/site_settings/site_details.js index 0482ad33..a3d09b68 100644 --- a/chrome/browser/resources/settings/site_settings/site_details.js +++ b/chrome/browser/resources/settings/site_settings/site_details.js
@@ -95,14 +95,6 @@ }, /** @private */ - enableFileSystemWriteContentSetting_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('enableFileSystemWriteContentSetting'); - } - }, - - /** @private */ enableFontAccessContentSetting_: { type: Boolean, value() {
diff --git a/chrome/browser/resources/settings/site_settings/site_settings_behavior.js b/chrome/browser/resources/settings/site_settings/site_settings_behavior.js index 09b65fd..5ef8dd3 100644 --- a/chrome/browser/resources/settings/site_settings/site_settings_behavior.js +++ b/chrome/browser/resources/settings/site_settings/site_settings_behavior.js
@@ -223,9 +223,6 @@ ContentSettingsTypes.PAYMENT_HANDLER, 'enablePaymentHandlerContentSetting'); addOrRemoveSettingWithFlag( - ContentSettingsTypes.FILE_SYSTEM_WRITE, - 'enableFileSystemWriteContentSetting'); - addOrRemoveSettingWithFlag( ContentSettingsTypes.BLUETOOTH_DEVICES, 'enableWebBluetoothNewPermissionsBackend'); addOrRemoveSettingWithFlag(
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.js b/chrome/browser/resources/settings/site_settings_page/site_settings_page.js index 0d972b6..2d7471a 100644 --- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.js +++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.js
@@ -193,8 +193,6 @@ icon: 'settings:save-original', enabledLabel: 'siteSettingsFileSystemWriteAsk', disabledLabel: 'siteSettingsFileSystemWriteBlock', - shouldShow: () => - loadTimeData.getBoolean('enableFileSystemWriteContentSetting'), }, { route: routes.SITE_SETTINGS_FONT_ACCESS,
diff --git a/chrome/browser/share/android/java/res/values/dimens.xml b/chrome/browser/share/android/java/res/values/dimens.xml index 3424071..ad13c27 100644 --- a/chrome/browser/share/android/java/res/values/dimens.xml +++ b/chrome/browser/share/android/java/res/values/dimens.xml
@@ -17,5 +17,5 @@ <dimen name="qrcode_size">200dp</dimen> <!-- Toast for Link to Text --> - <dimen name="y_offset">250dp</dimen> + <dimen name="y_offset">230dp</dimen> </resources>
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java index 823d950..3ff8b0a5 100644 --- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java +++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java
@@ -106,6 +106,7 @@ */ private static class FirstPartyOption { final Collection<Integer> mContentTypes; + final Collection<Integer> mContentTypesToDisableFor; final PropertyModel mPropertyModel; final boolean mDisableForMultiWindow; @@ -115,12 +116,14 @@ * * @param model Property model for the first party option. * @param contentTypes Content types to trigger for. + * @param contentTypesToDisableFor Content types to disable for. * @param disableForMultiWindow If the feature should be disabled if in multi-window mode. */ FirstPartyOption(PropertyModel model, Collection<Integer> contentTypes, - boolean disableForMultiWindow) { + Collection<Integer> contentTypesToDisableFor, boolean disableForMultiWindow) { mPropertyModel = model; mContentTypes = contentTypes; + mContentTypesToDisableFor = contentTypesToDisableFor; mDisableForMultiWindow = disableForMultiWindow; } } @@ -131,10 +134,12 @@ private String mFeatureNameForMetrics; private Callback<View> mOnClickCallback; private boolean mDisableForMultiWindow; + private Integer[] mContentTypesToDisableFor; private final Integer[] mContentTypesInBuilder; FirstPartyOptionBuilder(Integer... contentTypes) { mContentTypesInBuilder = contentTypes; + mContentTypesToDisableFor = new Integer[] {}; } FirstPartyOptionBuilder setIcon(int icon, int iconLabel) { @@ -153,6 +158,11 @@ return this; } + FirstPartyOptionBuilder setContentTypesToDisableFor(Integer... contentTypesToDisableFor) { + mContentTypesToDisableFor = contentTypesToDisableFor; + return this; + } + FirstPartyOptionBuilder setDisableForMultiWindow(boolean disableForMultiWindow) { mDisableForMultiWindow = disableForMultiWindow; return this; @@ -167,8 +177,8 @@ mBottomSheetController.hideContent(mBottomSheetContent, true); mOnClickCallback.onResult(view); }); - return new FirstPartyOption( - model, Arrays.asList(mContentTypesInBuilder), mDisableForMultiWindow); + return new FirstPartyOption(model, Arrays.asList(mContentTypesInBuilder), + Arrays.asList(mContentTypesToDisableFor), mDisableForMultiWindow); } } @@ -184,6 +194,8 @@ List<PropertyModel> propertyModels = new ArrayList<>(); for (FirstPartyOption firstPartyOption : mOrderedFirstPartyOptions) { if (!Collections.disjoint(contentTypes, firstPartyOption.mContentTypes) + && Collections.disjoint( + contentTypes, firstPartyOption.mContentTypesToDisableFor) && !(isMultiWindow && firstPartyOption.mDisableForMultiWindow)) { propertyModels.add(firstPartyOption.mPropertyModel); } @@ -202,8 +214,7 @@ mOrderedFirstPartyOptions.add(createCopyLinkFirstPartyOption()); if (ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_SHARING_HUB_V15)) { mOrderedFirstPartyOptions.add(createCopyImageFirstPartyOption()); - } - if (ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_SHARING_HUB_V15)) { + mOrderedFirstPartyOptions.add(createCopyFirstPartyOption()); mOrderedFirstPartyOptions.add(createCopyTextFirstPartyOption()); } mOrderedFirstPartyOptions.add(createSendTabToSelfFirstPartyOption()); @@ -252,12 +263,14 @@ return new FirstPartyOption(propertyModel, Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.TEXT, ContentType.HIGHLIGHTED_TEXT, ContentType.IMAGE), + /*contentTypesToDisableFor=*/Collections.emptySet(), /*disableForMultiWindow=*/true); } private FirstPartyOption createCopyLinkFirstPartyOption() { return new FirstPartyOptionBuilder( ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE) + .setContentTypesToDisableFor(ContentType.LINK_AND_TEXT) .setIcon(R.drawable.ic_content_copy_black, R.string.sharing_copy_url) .setFeatureNameForMetrics("SharingHubAndroid.CopyURLSelected") .setOnClickCallback((view) -> { @@ -283,8 +296,23 @@ .build(); } + private FirstPartyOption createCopyFirstPartyOption() { + return new FirstPartyOptionBuilder(ContentType.LINK_AND_TEXT) + .setIcon(R.drawable.ic_content_copy_black, R.string.sharing_copy) + .setFeatureNameForMetrics("SharingHubAndroid.CopySelected") + .setOnClickCallback((view) -> { + ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService( + Context.CLIPBOARD_SERVICE); + clipboard.setPrimaryClip(ClipData.newPlainText( + mShareParams.getTitle(), mShareParams.getTextAndUrl())); + Toast.makeText(mActivity, R.string.sharing_copied, Toast.LENGTH_SHORT).show(); + }) + .build(); + } + private FirstPartyOption createCopyTextFirstPartyOption() { return new FirstPartyOptionBuilder(ContentType.TEXT, ContentType.HIGHLIGHTED_TEXT) + .setContentTypesToDisableFor(ContentType.LINK_AND_TEXT) .setIcon(R.drawable.ic_content_copy_black, R.string.sharing_copy_text) .setFeatureNameForMetrics("SharingHubAndroid.CopyTextSelected") .setOnClickCallback((view) -> {
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetPropertyModelBuilder.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetPropertyModelBuilder.java index b462049..c3d140e 100644 --- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetPropertyModelBuilder.java +++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetPropertyModelBuilder.java
@@ -45,15 +45,17 @@ // TODO(crbug/1022172): Should be package-protected once modularization is complete. public class ShareSheetPropertyModelBuilder { @IntDef({ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE, ContentType.TEXT, - ContentType.IMAGE, ContentType.HIGHLIGHTED_TEXT, ContentType.OTHER_FILE_TYPE}) + ContentType.HIGHLIGHTED_TEXT, ContentType.LINK_AND_TEXT, ContentType.IMAGE, + ContentType.OTHER_FILE_TYPE}) @Retention(RetentionPolicy.SOURCE) @interface ContentType { int LINK_PAGE_VISIBLE = 0; int LINK_PAGE_NOT_VISIBLE = 1; int TEXT = 2; - int IMAGE = 3; - int HIGHLIGHTED_TEXT = 4; - int OTHER_FILE_TYPE = 5; + int HIGHLIGHTED_TEXT = 3; + int LINK_AND_TEXT = 4; + int IMAGE = 5; + int OTHER_FILE_TYPE = 6; } private static final int MAX_NUM_APPS = 7; @@ -61,9 +63,10 @@ // Variations parameter name for the comma-separated list of third-party activity names. private static final String PARAM_SHARING_HUB_THIRD_PARTY_APPS = "sharing-hub-third-party-apps"; - static final HashSet<Integer> ALL_CONTENT_TYPES = new HashSet<>(Arrays.asList( - ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE, ContentType.TEXT, - ContentType.IMAGE, ContentType.HIGHLIGHTED_TEXT, ContentType.OTHER_FILE_TYPE)); + static final HashSet<Integer> ALL_CONTENT_TYPES = new HashSet<>( + Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE, + ContentType.TEXT, ContentType.HIGHLIGHTED_TEXT, ContentType.LINK_AND_TEXT, + ContentType.IMAGE, ContentType.OTHER_FILE_TYPE)); private static final ArrayList<String> FALLBACK_ACTIVITIES = new ArrayList<>(Arrays.asList("com.whatsapp.ContactPicker", "com.facebook.composer.shareintent.ImplicitShareIntentHandlerDefaultAlias", @@ -126,6 +129,9 @@ contentTypes.add(ContentType.TEXT); } } + if (!TextUtils.isEmpty(params.getUrl()) && !TextUtils.isEmpty(params.getText())) { + contentTypes.add(ContentType.LINK_AND_TEXT); + } if (params.getFileUris() != null) { if (!TextUtils.isEmpty(params.getFileContentType()) && params.getFileContentType().startsWith(IMAGE_TYPE)) {
diff --git a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/clipboard/ClipboardImageFileProviderTest.java b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/clipboard/ClipboardImageFileProviderTest.java index 71ee42b3..a109972 100644 --- a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/clipboard/ClipboardImageFileProviderTest.java +++ b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/clipboard/ClipboardImageFileProviderTest.java
@@ -22,10 +22,9 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.FileProviderHelper; -import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.ui.base.Clipboard; @@ -42,8 +41,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ClipboardImageFileProviderTest { @Rule - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = - new ChromeActivityTestRule<>(ChromeActivity.class); + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final long WAIT_TIMEOUT_SECONDS = 30L; private static final String TEST_PNG_IMAGE_FILE_EXTENSION = ".png";
diff --git a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProviderTest.java b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProviderTest.java index 2c3a5fa..e425020 100644 --- a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProviderTest.java +++ b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProviderTest.java
@@ -108,7 +108,7 @@ {ChromeFeatureList.CHROME_SHARE_SCREENSHOT, ChromeFeatureList.CHROME_SHARE_QRCODE}) @Features.DisableFeatures({ChromeFeatureList.CHROME_SHARING_HUB_V15}) public void - createPropertyModels_screenshotQrCodeEnabled_includesBoth() { + getPropertyModels_screenshotQrCodeEnabled_includesBoth() { setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/false); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( @@ -116,7 +116,6 @@ assertCorrectModelsAreInTheRightOrder(propertyModels, ImmutableList.of(mActivity.getResources().getString(R.string.sharing_screenshot), - mActivity.getResources().getString(R.string.sharing_copy_url), mActivity.getResources().getString( R.string.send_tab_to_self_share_activity_title), mActivity.getResources().getString(R.string.qr_code_share_icon_label))); @@ -127,16 +126,15 @@ @Features.DisableFeatures({ChromeFeatureList.CHROME_SHARE_SCREENSHOT, ChromeFeatureList.CHROME_SHARE_QRCODE, ChromeFeatureList.CHROME_SHARING_HUB_V15}) public void - createPropertyModels_screenshotQrCodeDisabled_doesNotIncludeEither() { + getPropertyModels_screenshotQrCodeDisabled_doesNotIncludeEither() { setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/false); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( ShareSheetPropertyModelBuilder.ALL_CONTENT_TYPES, /*isMultiWindow=*/false); assertCorrectModelsAreInTheRightOrder(propertyModels, - ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_url), - mActivity.getResources().getString( - R.string.send_tab_to_self_share_activity_title))); + ImmutableList.of(mActivity.getResources().getString( + R.string.send_tab_to_self_share_activity_title))); } @Test @@ -144,16 +142,15 @@ @Features.DisableFeatures({ChromeFeatureList.CHROME_SHARE_SCREENSHOT, ChromeFeatureList.CHROME_SHARE_QRCODE, ChromeFeatureList.CHROME_SHARING_HUB_V15}) public void - createPropertyModels_printingEnabled_includesPrinting() { + getPropertyModels_printingEnabled_includesPrinting() { setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/true); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( ShareSheetPropertyModelBuilder.ALL_CONTENT_TYPES, /*isMultiWindow=*/false); assertCorrectModelsAreInTheRightOrder(propertyModels, - ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_url), - mActivity.getResources().getString( - R.string.send_tab_to_self_share_activity_title), + ImmutableList.of(mActivity.getResources().getString( + R.string.send_tab_to_self_share_activity_title), mActivity.getResources().getString(R.string.print_share_activity_title))); } @@ -164,7 +161,7 @@ {ChromeFeatureList.CHROME_SHARE_SCREENSHOT, ChromeFeatureList.CHROME_SHARE_QRCODE, ChromeFeatureList.CHROME_SHARE_HIGHLIGHTS_ANDROID}) public void - createPropertyModels_sharingHub15Enabled_includesCopyText() { + getPropertyModels_sharingHub15Enabled_includesCopyText() { setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/false); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( @@ -176,12 +173,74 @@ @Test @MediumTest + @Features.EnableFeatures({ChromeFeatureList.CHROME_SHARING_HUB_V15}) + @Features.DisableFeatures( + {ChromeFeatureList.CHROME_SHARE_QRCODE, ChromeFeatureList.CHROME_SHARE_SCREENSHOT, + ChromeFeatureList.CHROME_SHARE_HIGHLIGHTS_ANDROID}) + public void + getPropertyModels_linkAndTextShare() { + setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/false); + + List<PropertyModel> propertyModels = + mChromeProvidedSharingOptionsProvider.getPropertyModels( + ImmutableSet.of(ContentType.LINK_AND_TEXT, + ContentType.LINK_PAGE_NOT_VISIBLE, ContentType.TEXT), + /*isMultiWindow=*/true); + + assertCorrectModelsAreInTheRightOrder(propertyModels, + ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy), + mActivity.getResources().getString( + R.string.send_tab_to_self_share_activity_title))); + } + + @Test + @MediumTest + @Features.EnableFeatures({ChromeFeatureList.CHROME_SHARING_HUB_V15}) + @Features.DisableFeatures( + {ChromeFeatureList.CHROME_SHARE_QRCODE, ChromeFeatureList.CHROME_SHARE_SCREENSHOT, + ChromeFeatureList.CHROME_SHARE_HIGHLIGHTS_ANDROID}) + public void + getPropertyModels_linkShare() { + setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/false); + + List<PropertyModel> propertyModels = + mChromeProvidedSharingOptionsProvider.getPropertyModels( + ImmutableSet.of(ContentType.LINK_PAGE_NOT_VISIBLE), + /*isMultiWindow=*/true); + + assertCorrectModelsAreInTheRightOrder(propertyModels, + ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_url), + mActivity.getResources().getString( + R.string.send_tab_to_self_share_activity_title))); + } + + @Test + @MediumTest + @Features.EnableFeatures({ChromeFeatureList.CHROME_SHARING_HUB_V15}) + @Features.DisableFeatures( + {ChromeFeatureList.CHROME_SHARE_QRCODE, ChromeFeatureList.CHROME_SHARE_SCREENSHOT, + ChromeFeatureList.CHROME_SHARE_HIGHLIGHTS_ANDROID}) + public void + getPropertyModels_textShare() { + setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/false); + + List<PropertyModel> propertyModels = + mChromeProvidedSharingOptionsProvider.getPropertyModels( + ImmutableSet.of(ContentType.TEXT), + /*isMultiWindow=*/true); + + assertCorrectModelsAreInTheRightOrder(propertyModels, + ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_text))); + } + + @Test + @MediumTest @Features.EnableFeatures({ChromeFeatureList.CHROME_SHARE_SCREENSHOT}) @Features.DisableFeatures({ChromeFeatureList.CHROME_SHARE_QRCODE, ChromeFeatureList.CHROME_SHARE_HIGHLIGHTS_ANDROID, ChromeFeatureList.CHROME_SHARING_HUB_V15}) public void - createPropertyModels_multiWindow_doesNotIncludeScreenshot() { + getPropertyModels_multiWindow_doesNotIncludeScreenshot() { setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/false); List<PropertyModel> propertyModels = @@ -189,9 +248,8 @@ ShareSheetPropertyModelBuilder.ALL_CONTENT_TYPES, /*isMultiWindow=*/true); assertCorrectModelsAreInTheRightOrder(propertyModels, - ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_url), - mActivity.getResources().getString( - R.string.send_tab_to_self_share_activity_title))); + ImmutableList.of(mActivity.getResources().getString( + R.string.send_tab_to_self_share_activity_title))); } @Test @@ -200,7 +258,7 @@ {ChromeFeatureList.CHROME_SHARE_SCREENSHOT, ChromeFeatureList.CHROME_SHARE_QRCODE}) @Features.DisableFeatures({ChromeFeatureList.CHROME_SHARING_HUB_V15}) public void - createPropertyModels_filtersByContentType() { + getPropertyModels_filtersByContentType() { setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/true); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( @@ -220,7 +278,7 @@ {ChromeFeatureList.CHROME_SHARE_SCREENSHOT, ChromeFeatureList.CHROME_SHARE_QRCODE}) @Features.DisableFeatures({ChromeFeatureList.CHROME_SHARING_HUB_V15}) public void - createPropertyModels_multipleTypes_filtersByContentType() { + getPropertyModels_multipleTypes_filtersByContentType() { setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/true); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( @@ -239,7 +297,7 @@ @MediumTest @Features.DisableFeatures({ChromeFeatureList.CHROME_SHARING_HUB_V15}) @Features.EnableFeatures({ChromeFeatureList.CHROME_SHARE_HIGHLIGHTS_ANDROID}) - public void createPropertyModels_sharingHub15Disabled_noHighlights() { + public void getPropertyModels_sharingHub15Disabled_noHighlights() { setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/false); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( @@ -253,7 +311,7 @@ @Features.EnableFeatures({ChromeFeatureList.CHROME_SHARING_HUB_V15, ChromeFeatureList.CHROME_SHARE_HIGHLIGHTS_ANDROID}) public void - createPropertyModels_sharingHub15HighlightsEnabled() { + getPropertyModels_sharingHub15HighlightsEnabled() { setUpChromeProvidedSharingOptionsProviderTest(/*printingEnabled=*/false); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels(
diff --git a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetPropertyModelBuilderTest.java b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetPropertyModelBuilderTest.java index c175bce0e..f6ef96b 100644 --- a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetPropertyModelBuilderTest.java +++ b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetPropertyModelBuilderTest.java
@@ -246,7 +246,7 @@ assertEquals("Should contain correct content types.", ImmutableSet.of(ContentType.LINK_PAGE_NOT_VISIBLE, ContentType.OTHER_FILE_TYPE, - ContentType.TEXT), + ContentType.TEXT, ContentType.LINK_AND_TEXT), ShareSheetPropertyModelBuilder.getContentTypes(shareParams, shareExtras)); }
diff --git a/chrome/browser/signin/account_consistency_mode_manager.cc b/chrome/browser/signin/account_consistency_mode_manager.cc index bee334fb..627d217 100644 --- a/chrome/browser/signin/account_consistency_mode_manager.cc +++ b/chrome/browser/signin/account_consistency_mode_manager.cc
@@ -29,6 +29,10 @@ namespace { +// By default, DICE is not enabled in builds lacking an API key. May be set to +// true for tests. +bool g_ignore_missing_oauth_client_for_testing = false; + #if BUILDFLAG(ENABLE_DICE_SUPPORT) // Preference indicating that the Dice migraton has happened. const char kDiceMigrationCompletePref[] = "signin.DiceMigrationComplete"; @@ -45,13 +49,29 @@ // If the commandline flag is not provided, the default is true. return true; } + +// Returns true if Desktop Identity Consistency can be enabled for this build +// (i.e. if OAuth client ID and client secret are configured). +bool CanEnableDiceForBuild() { + if (g_ignore_missing_oauth_client_for_testing || + google_apis::HasOAuthClientConfigured()) { + return true; + } + + // Only log this once. + static bool logged_warning = []() { + LOG(WARNING) << "Desktop Identity Consistency cannot be enabled as no " + "OAuth client ID and client secret have been configured."; + return true; + }(); + ALLOW_UNUSED_LOCAL(logged_warning); + + return false; +} #endif } // namespace -bool AccountConsistencyModeManager::ignore_missing_oauth_client_for_testing_ = - false; - // static AccountConsistencyModeManager* AccountConsistencyModeManager::GetForProfile( Profile* profile) { @@ -69,8 +89,9 @@ PrefService* prefs = profile->GetPrefs(); // Propagate settings changes from the previous launch to the signin-allowed // pref. - bool signin_allowed = prefs->GetBoolean(prefs::kSigninAllowedOnNextStartup) && - IsBrowserSigninAllowedByCommandLine(); + bool signin_allowed = CanEnableDiceForBuild() && + IsBrowserSigninAllowedByCommandLine() && + prefs->GetBoolean(prefs::kSigninAllowedOnNextStartup); prefs->SetBoolean(prefs::kSigninAllowed, signin_allowed); UMA_HISTOGRAM_BOOLEAN("Signin.SigninAllowed", signin_allowed); @@ -135,7 +156,7 @@ // static void AccountConsistencyModeManager::SetIgnoreMissingOAuthClientForTesting() { - ignore_missing_oauth_client_for_testing_ = true; + g_ignore_missing_oauth_client_for_testing = true; } // static @@ -188,20 +209,6 @@ if (profile->IsLegacySupervised()) return AccountConsistencyMethod::kDisabled; - bool can_enable_dice_for_build = ignore_missing_oauth_client_for_testing_ || - google_apis::HasOAuthClientConfigured(); - if (!can_enable_dice_for_build) { - // Only log this once. - static bool logged_warning = []() { - LOG(WARNING) << "Desktop Identity Consistency cannot be enabled as no " - "OAuth client ID and client secret have been configured."; - return true; - }(); - ALLOW_UNUSED_LOCAL(logged_warning); - - return AccountConsistencyMethod::kDisabled; - } - if (!profile->GetPrefs()->GetBoolean(prefs::kSigninAllowed)) { VLOG(1) << "Desktop Identity Consistency disabled as sign-in to Chrome" "is not allowed";
diff --git a/chrome/browser/signin/account_consistency_mode_manager.h b/chrome/browser/signin/account_consistency_mode_manager.h index 9f3cb34..00348011d5 100644 --- a/chrome/browser/signin/account_consistency_mode_manager.h +++ b/chrome/browser/signin/account_consistency_mode_manager.h
@@ -87,10 +87,6 @@ signin::AccountConsistencyMethod account_consistency_; bool account_consistency_initialized_; - // By default, DICE is not enabled in builds lacking an API key. Set to true - // for tests. - static bool ignore_missing_oauth_client_for_testing_; - DISALLOW_COPY_AND_ASSIGN(AccountConsistencyModeManager); };
diff --git a/chrome/browser/signin/chrome_signin_client_unittest.cc b/chrome/browser/signin/chrome_signin_client_unittest.cc index d90e5e92..577ed30 100644 --- a/chrome/browser/signin/chrome_signin_client_unittest.cc +++ b/chrome/browser/signin/chrome_signin_client_unittest.cc
@@ -3,7 +3,6 @@ // found in the LICENSE file. #include "chrome/browser/signin/chrome_signin_client.h" - #include <memory> #include <utility> @@ -246,8 +245,9 @@ // Allow signout for tests that want to force it. return false; case signin_metrics::ProfileSignout::USER_DELETED_ACCOUNT_COOKIES: - // There's no special-casing for this in ChromeSigninClient, as this only - // happens when there's no sync account and policies aren't enforced. + case signin_metrics::ProfileSignout::MOBILE_IDENTITY_CONSISTENCY_ROLLBACK: + // There's no special-casing for these in ChromeSigninClient, as they only + // happen when there's no sync account and policies aren't enforced. // PrimaryAccountManager won't actually invoke PreSignOut in this case, // thus it is fine for ChromeSigninClient to not have any special-casing. return true; @@ -324,6 +324,7 @@ signin_metrics::ProfileSignout::SIGNIN_NOT_ALLOWED_ON_PROFILE_INIT, signin_metrics::ProfileSignout::FORCE_SIGNOUT_ALWAYS_ALLOWED_FOR_TEST, signin_metrics::ProfileSignout::USER_DELETED_ACCOUNT_COOKIES, + signin_metrics::ProfileSignout::MOBILE_IDENTITY_CONSISTENCY_ROLLBACK, }; static_assert(base::size(kSignoutSources) == signin_metrics::ProfileSignout::NUM_PROFILE_SIGNOUT_METRICS,
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index 0fd91ff..d4a7b0d 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -1100,7 +1100,7 @@ <message name="IDS_APP_LANGUAGE_TITLE" desc="Title of Language settings section to change Chrome’s user interface language. [CHAR-LIMIT=32]"> <ph name="APP_NAME">%1$s<ex>Chrome</ex></ph>’s language </message> - <message name="IDS_DEFAULT_LANG_SUBTITLE" desc="Subtile to use for the device’s default language. [CHAR-LIMIT=32]"> + <message name="IDS_DEFAULT_LANG_SUBTITLE" desc="Subtite to use for the device’s default language. [CHAR-LIMIT=42]"> Default device language </message> <message name="IDS_ADD_LANGUAGE" desc="Title for the screen that allows users to add languages to their preferred language list. [CHAR-LIMIT=32]"> @@ -1115,7 +1115,7 @@ <message name="IDS_LANGUAGES_SELECT_SUGGESTED" desc="Title appearing above list of languages ordered based on what users in that country might select. [CHAR-LIMIT=32]"> Suggested languages </message> - <message name="IDS_LANGUAGES_SELECT_OTHER" desc="Subtile appearing above list of all languages not likely to be selected by users in that country. [CHAR-LIMIT=32]"> + <message name="IDS_LANGUAGES_SELECT_OTHER" desc="Subtite appearing above list of all languages not likely to be selected by users in that country. [CHAR-LIMIT=32]"> Other languages </message> <message name="IDS_LANGUAGES_CONTENT_TITLE" desc="Title of Language settings section to add or remove preferred content languages. Content languages are selected by the user and tell Chrome what language the user prefers webpage content in. [CHAR-LIMIT=32]"> @@ -1130,7 +1130,7 @@ <message name="IDS_LANGUAGES_OFFER_TRANSLATE_SWITCH" desc="Appears next to the 'offer to translate' switch that controls whether or not Chrome will display the Google Translate UI on web pages that are not in the user's preferred language(s)."> Offer to translate pages in other languages </message> - <message name="IDS_LANGUAGES_SEND_TRANSLATE_SWITCH" desc="Appears next to the switch controling whether or not Chrome will display the Google Translate UI on web pages that are not in the user's preferred language(s)."> + <message name="IDS_LANGUAGES_SEND_TRANSLATE_SWITCH" desc="Appears next to the switch controlling whether or not Chrome will offer to translate pages in other languages. When enabled the Google Translate UI will be displayed on web pages that are not in the user's preferred language(s)."> Offer to send pages in other languages to Google Translate </message> <message name="IDS_LANGUAGES_ITEM_OPTION_OFFER_TO_TRANSLATE" desc="Option in language item menu. User can click the 'Offer to translate' option to toggle whether they want Chrome to translate pages in this language. [CHAR-LIMIT=32]"> @@ -1148,7 +1148,7 @@ <message name="IDS_LANGUAGES_SPLIT_DOWNLOADING" desc="Text to display next to a language when it is being downloaded to use as Chrome's UI. [CHAR-LIMIT=32]"> Downloading <ph name="LANG">%1$s<ex>Hindi</ex></ph>… </message> - <message name="IDS_LANGUAGES_SPLIT_READY" desc="Text to display next to a language once it has been downloaded telling user to restart the application."> + <message name="IDS_LANGUAGES_SPLIT_READY" desc="Text to display when a language pack has been downloaded. The user needs to restart Chrome to use the new language as Chrome's UI."> Language ready, restart <ph name="APP_NAME">%1$s<ex>Chrome</ex></ph> </message> <message name="IDS_LANGUAGES_INFOBAR_READY" desc="Infobar text to appear when a new language pack has been downloaded. [CHAR-LIMIT=32]"> @@ -2506,7 +2506,7 @@ Choose an account </message> <message name="IDS_SIGNIN_ACCOUNT_PICKER_BOTTOM_SHEET_SUBTITLE" desc="The subtitle for the account picker bottom sheet that tells the user what happens if the button 'Continue as John Doe' is clicked"> - Sign in to this site, your Google Account, and Chrome. You may turn on sync later. + Sign in to this site and Chrome with your Google Account. You can turn on sync later. </message> <message name="IDS_SIGNIN_ACCOUNT_PICKER_BOTTOM_SHEET_SIGNIN_TITLE" desc="The title of the account picker bottom sheet tells that the user is in the process of signing in with their Google Account"> Signing in... @@ -3978,6 +3978,10 @@ More </message> + <message name="IDS_SHARING_COPY" desc="Label for the Copy button in the sharing hub."> + Copy + </message> + <message name="IDS_SHARING_COPY_URL" desc="Label for the Copy URL button in the sharing hub."> Copy link </message> @@ -3998,6 +4002,10 @@ Link to text </message> + <message name="IDS_SHARING_COPIED" desc="Text shown in the toast notification when Copy is selected in the sharing hub."> + Copied + </message> + <message name="IDS_TEXT_COPIED" desc="Text shown in the toast notification when Copy Text is selected in the sharing hub."> Text Copied </message>
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_COPIED.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_COPIED.png.sha1 new file mode 100644 index 0000000..b4ee91e --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_COPIED.png.sha1
@@ -0,0 +1 @@ +ab18934f0393bc4dfa4f5af5efcd9e5ac764b925 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_COPY.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_COPY.png.sha1 new file mode 100644 index 0000000..0b7303e --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SHARING_COPY.png.sha1
@@ -0,0 +1 @@ +3a225761ad2cb4bc0b102138b69946d67ec6671d \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_ACCOUNT_PICKER_BOTTOM_SHEET_SUBTITLE.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_ACCOUNT_PICKER_BOTTOM_SHEET_SUBTITLE.png.sha1 index 7c46858..be4f6b2 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_ACCOUNT_PICKER_BOTTOM_SHEET_SUBTITLE.png.sha1 +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_SIGNIN_ACCOUNT_PICKER_BOTTOM_SHEET_SUBTITLE.png.sha1
@@ -1 +1 @@ -0caa23ad3d78d11125c4174724f1314c40a15340 \ No newline at end of file +c6cc9bd05afe686d39f96e1fd69fc8ec53f07a52 \ No newline at end of file
diff --git a/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.cc b/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.cc index 6c8991acc..ab903ad 100644 --- a/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.cc +++ b/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.cc
@@ -24,6 +24,7 @@ #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" namespace app_list { namespace { @@ -50,8 +51,6 @@ : profile_(profile), drive_service_( drive::DriveIntegrationServiceFactory::GetForProfile(profile)), - file_tasks_notifier_( - file_manager::file_tasks::FileTasksNotifier::GetForProfile(profile)), item_suggest_cache_(profile, std::move(url_loader_factory)), suggested_files_enabled_(app_list_features::IsSuggestedFilesEnabled()) { DCHECK(profile_); @@ -109,9 +108,8 @@ // Exit in three cases: // - this search has a non-empty query, we only handle zero-state. // - drive fs isn't mounted, as we launch results via drive fs. - // - the |file_tasks_notifier_| is unavailable, as we stat files using it. const bool drive_fs_mounted = drive_service_ && drive_service_->IsMounted(); - if (!query.empty() || !drive_fs_mounted || !file_tasks_notifier_) { + if (!query.empty() || !drive_fs_mounted) { // TODO(crbug.com/1034842): Log error metrics. return; }
diff --git a/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.h b/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.h index fd8bb422..6e00802 100644 --- a/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.h +++ b/chrome/browser/ui/app_list/search/files/drive_zero_state_provider.h
@@ -14,7 +14,6 @@ #include "base/strings/string16.h" #include "base/time/time.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h" -#include "chrome/browser/chromeos/file_manager/file_tasks_notifier.h" #include "chrome/browser/ui/app_list/search/files/file_result.h" #include "chrome/browser/ui/app_list/search/files/item_suggest_cache.h" #include "chrome/browser/ui/app_list/search/search_provider.h" @@ -57,7 +56,6 @@ Profile* const profile_; drive::DriveIntegrationService* const drive_service_; - file_manager::file_tasks::FileTasksNotifier* const file_tasks_notifier_; ItemSuggestCache item_suggest_cache_;
diff --git a/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc b/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc index a5faf46..4ecb5eb7 100644 --- a/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc +++ b/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc
@@ -69,7 +69,8 @@ 'platform_type': 'CHROME_OS', 'scenario_type': 'CHROME_OS_ZSS_FILES' }, - 'max_suggestions': 10 + 'max_suggestions': 10, + 'type_detail_fields': 'drive_item.title,justification.display_text' })"; bool IsDisabledByPolicy(const Profile* profile) {
diff --git a/chrome/browser/ui/ash/clipboard_history_browsertest.cc b/chrome/browser/ui/ash/clipboard_history_browsertest.cc index 50af2f8..2c770c1 100644 --- a/chrome/browser/ui/ash/clipboard_history_browsertest.cc +++ b/chrome/browser/ui/ash/clipboard_history_browsertest.cc
@@ -264,14 +264,8 @@ ASSERT_TRUE(GetClipboardHistoryController()->IsMenuShowing()); ASSERT_EQ(3, GetContextMenu()->GetMenuItemsCount()); - // No item is selected. So pressing the backspace key has no effect. - PressAndRelease(ui::KeyboardCode::VKEY_BACK, ui::EF_NONE); - EXPECT_EQ(3, GetContextMenu()->GetMenuItemsCount()); - EXPECT_TRUE(VerifyClipboardTextData({"C", "B", "A"})); - - // Select the first menu item via key then delete it. Verify the menu and the - // clipboard history. - PressAndRelease(ui::KeyboardCode::VKEY_DOWN, ui::EF_NONE); + // The first item is selected as default. Press the deletion accelerator and + // verify the clipboard history. PressAndRelease(ui::KeyboardCode::VKEY_BACK, ui::EF_NONE); EXPECT_EQ(2, GetContextMenu()->GetMenuItemsCount()); EXPECT_TRUE(VerifyClipboardTextData({"B", "A"})); @@ -279,13 +273,11 @@ // Select the second menu item via key then delete it. Verify the menu and the // clipboard history. PressAndRelease(ui::KeyboardCode::VKEY_DOWN, ui::EF_NONE); - PressAndRelease(ui::KeyboardCode::VKEY_DOWN, ui::EF_NONE); PressAndRelease(ui::KeyboardCode::VKEY_BACK, ui::EF_NONE); EXPECT_EQ(1, GetContextMenu()->GetMenuItemsCount()); EXPECT_TRUE(VerifyClipboardTextData({"B"})); // Delete the last item. Verify that the menu is closed. - PressAndRelease(ui::KeyboardCode::VKEY_DOWN, ui::EF_COMMAND_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_BACK, ui::EF_NONE); EXPECT_FALSE(GetClipboardHistoryController()->IsMenuShowing()); @@ -447,7 +439,6 @@ // Verify we can paste the first history item via the ENTER key. PressAndRelease(ui::KeyboardCode::VKEY_V, ui::EF_COMMAND_DOWN); EXPECT_TRUE(GetClipboardHistoryController()->IsMenuShowing()); - PressAndRelease(ui::KeyboardCode::VKEY_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_RETURN); EXPECT_FALSE(GetClipboardHistoryController()->IsMenuShowing()); EXPECT_EQ("C", base::UTF16ToUTF8(textfield_->GetText())); @@ -458,7 +449,6 @@ // Verify we can paste the first history item via the COMMAND+V shortcut. PressAndRelease(ui::KeyboardCode::VKEY_V, ui::EF_COMMAND_DOWN); EXPECT_TRUE(GetClipboardHistoryController()->IsMenuShowing()); - PressAndRelease(ui::KeyboardCode::VKEY_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_V, ui::EF_COMMAND_DOWN); EXPECT_FALSE(GetClipboardHistoryController()->IsMenuShowing()); EXPECT_EQ("C", base::UTF16ToUTF8(textfield_->GetText())); @@ -471,7 +461,6 @@ EXPECT_TRUE(GetClipboardHistoryController()->IsMenuShowing()); PressAndRelease(ui::KeyboardCode::VKEY_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_DOWN); - PressAndRelease(ui::KeyboardCode::VKEY_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_RETURN); EXPECT_FALSE(GetClipboardHistoryController()->IsMenuShowing()); EXPECT_EQ("A", base::UTF16ToUTF8(textfield_->GetText())); @@ -484,7 +473,6 @@ EXPECT_TRUE(GetClipboardHistoryController()->IsMenuShowing()); PressAndRelease(ui::KeyboardCode::VKEY_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_DOWN); - PressAndRelease(ui::KeyboardCode::VKEY_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_V, ui::EF_COMMAND_DOWN); EXPECT_FALSE(GetClipboardHistoryController()->IsMenuShowing()); EXPECT_EQ("A", base::UTF16ToUTF8(textfield_->GetText())); @@ -502,7 +490,6 @@ Press(ui::KeyboardCode::VKEY_COMMAND); PressAndRelease(ui::KeyboardCode::VKEY_V, ui::EF_COMMAND_DOWN); EXPECT_TRUE(GetClipboardHistoryController()->IsMenuShowing()); - PressAndRelease(ui::KeyboardCode::VKEY_DOWN, ui::EF_COMMAND_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_V, ui::EF_COMMAND_DOWN); EXPECT_FALSE(GetClipboardHistoryController()->IsMenuShowing()); EXPECT_EQ("C", base::UTF16ToUTF8(textfield_->GetText())); @@ -518,7 +505,6 @@ EXPECT_TRUE(GetClipboardHistoryController()->IsMenuShowing()); PressAndRelease(ui::KeyboardCode::VKEY_DOWN, ui::EF_COMMAND_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_DOWN, ui::EF_COMMAND_DOWN); - PressAndRelease(ui::KeyboardCode::VKEY_DOWN, ui::EF_COMMAND_DOWN); PressAndRelease(ui::KeyboardCode::VKEY_V, ui::EF_COMMAND_DOWN); EXPECT_FALSE(GetClipboardHistoryController()->IsMenuShowing()); EXPECT_EQ("A", base::UTF16ToUTF8(textfield_->GetText()));
diff --git a/chrome/browser/ui/ash/clipboard_image_model_request.cc b/chrome/browser/ui/ash/clipboard_image_model_request.cc index 34d0db2..6d991318 100644 --- a/chrome/browser/ui/ash/clipboard_image_model_request.cc +++ b/chrome/browser/ui/ash/clipboard_image_model_request.cc
@@ -73,11 +73,19 @@ timeout_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), this, &ClipboardImageModelRequest::OnTimeout); - std::string encoded_html; + + // Begin the document with the proper charset, this should prevent strange + // looking characters from showing up in the render in some cases. + std::string html_document( + "<html><head><meta charset=\"UTF-8\"></meta></head><body>"); // Hide overflow to prevent scroll bars from showing up, which occurs when the // rendered HTML takes up more space than 'kWebContentsBounds'. - params.html_markup.append("<style>body{overflow:hidden;}</style>"); - base::Base64Encode(params.html_markup, &encoded_html); + html_document.append("<style>body{overflow:hidden;}</style>"); + html_document.append(params.html_markup); + html_document.append("</body></html>"); + + std::string encoded_html; + base::Base64Encode(html_document, &encoded_html); constexpr char kDataURIPrefix[] = "data:text/html;base64,"; web_view_->GetWebContents()->GetController().LoadURLWithParams( content::NavigationController::LoadURLParams(
diff --git a/chrome/browser/ui/cocoa/main_menu_builder.mm b/chrome/browser/ui/cocoa/main_menu_builder.mm index bcef3c7..9659d68c 100644 --- a/chrome/browser/ui/cocoa/main_menu_builder.mm +++ b/chrome/browser/ui/cocoa/main_menu_builder.mm
@@ -9,6 +9,7 @@ #include "chrome/browser/ui/cocoa/accelerators_cocoa.h" #include "chrome/browser/ui/cocoa/history_menu_bridge.h" #include "chrome/browser/ui/ui_features.h" +#include "chrome/common/chrome_features.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "components/dom_distiller/core/dom_distiller_features.h" @@ -362,6 +363,8 @@ id app_delegate, const base::string16& product_name, bool is_pwa) { + const bool window_naming = + base::FeatureList::IsEnabled(features::kWindowNaming); base::scoped_nsobject<NSMenuItem> item = Item(IDS_WINDOW_MENU_MAC) .tag(IDC_WINDOW_MENU) @@ -376,6 +379,9 @@ Item(IDS_SHOW_AS_TAB) .command_id(IDC_SHOW_AS_TAB) .remove_if(is_pwa), + Item(IDS_NAME_WINDOW) + .command_id(IDC_NAME_WINDOW) + .remove_if(is_pwa || !window_naming), Item().is_separator().remove_if(is_pwa), Item(IDS_SHOW_DOWNLOADS_MAC) .command_id(IDC_SHOW_DOWNLOADS)
diff --git a/chrome/browser/ui/in_product_help/feature_promo_snooze_service.cc b/chrome/browser/ui/in_product_help/feature_promo_snooze_service.cc index dfa5673..fbd088f2 100644 --- a/chrome/browser/ui/in_product_help/feature_promo_snooze_service.cc +++ b/chrome/browser/ui/in_product_help/feature_promo_snooze_service.cc
@@ -7,11 +7,14 @@ #include <ostream> #include "base/feature_list.h" +#include "base/metrics/field_trial_params.h" +#include "base/metrics/histogram_functions.h" #include "base/optional.h" #include "base/time/time.h" #include "base/util/values/values_util.h" #include "base/values.h" #include "chrome/browser/profiles/profile.h" +#include "components/feature_engagement/public/feature_constants.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/scoped_user_pref_update.h" @@ -33,8 +36,26 @@ // Path to the count of how many times this IPH has been snoozed. // in_product_help.snoozed_feature.[iph_name].snooze_count constexpr char kIPHSnoozedFeatureCount[] = "snooze_count"; + +// Finch parameter to control the snooze duration. +// If this parameter is not specified or is zero, the default duration at the +// client side will be used. +constexpr base::FeatureParam<base::TimeDelta> kOverriddenDuration{ + &feature_engagement::kIPHDesktopSnoozeFeature, + "x_iph_snooze_overridden_duration ", base::TimeDelta::FromHours(0)}; + +// Used in UMA histogram to track if the user snoozes for once or more. +enum class SnoozeType { + // The user snoozes the IPH for the first time. + kFirstTimeSnooze = 0, + // The user snoozes the IPH for the second time or more. + kRepeatingSnooze = 1, + kMaxValue = kRepeatingSnooze +}; } // namespace +const int FeaturePromoSnoozeService::kUmaMaxSnoozeCount = 10; + FeaturePromoSnoozeService::FeaturePromoSnoozeService(Profile* profile) : profile_(profile) {} @@ -46,6 +67,14 @@ if (!snooze_data) snooze_data = SnoozeData(); + if (!kOverriddenDuration.Get().is_zero()) + snooze_duration = kOverriddenDuration.Get(); + + base::UmaHistogramEnumeration( + "InProductHelp.Promos.Snooze." + std::string(iph_feature.name), + snooze_data->snooze_count == 0 ? SnoozeType::kFirstTimeSnooze + : SnoozeType::kRepeatingSnooze); + snooze_data->last_snooze_time = base::Time::Now(); snooze_data->last_snooze_duration = snooze_duration; snooze_data->snooze_count++; @@ -63,6 +92,13 @@ snooze_data->is_dismissed = true; SaveSnoozeData(iph_feature, *snooze_data); + + // Record count of previous snoozes when the IPH gets dismissed by "Got It" + // button. + base::UmaHistogramExactLinear( + "InProductHelp.Promos.SnoozeCountAtAcknowledge." + + std::string(iph_feature.name), + snooze_data->snooze_count, kUmaMaxSnoozeCount); } bool FeaturePromoSnoozeService::IsBlocked(const base::Feature& iph_feature) { @@ -100,6 +136,12 @@ pref_data->RemovePath(iph_feature.name); } +int FeaturePromoSnoozeService::GetSnoozeCount( + const base::Feature& iph_feature) { + base::Optional<SnoozeData> snooze_data = ReadSnoozeData(iph_feature); + return snooze_data ? snooze_data->snooze_count : 0; +} + base::Optional<FeaturePromoSnoozeService::SnoozeData> FeaturePromoSnoozeService::ReadSnoozeData(const base::Feature& iph_feature) { std::string path_prefix = std::string(iph_feature.name) + ".";
diff --git a/chrome/browser/ui/in_product_help/feature_promo_snooze_service.h b/chrome/browser/ui/in_product_help/feature_promo_snooze_service.h index 3403cc8c..c72fbf4 100644 --- a/chrome/browser/ui/in_product_help/feature_promo_snooze_service.h +++ b/chrome/browser/ui/in_product_help/feature_promo_snooze_service.h
@@ -24,6 +24,10 @@ // If an IPH is dismissed, this service will reject controller's request. class FeaturePromoSnoozeService { public: + // Maximum count of snoozes to track in UMA histogram. + // Snooze counts that are equal or larger than this value will be conflated. + static const int kUmaMaxSnoozeCount; + explicit FeaturePromoSnoozeService(Profile* profile); // Disallow copy and assign. @@ -48,11 +52,14 @@ // snoozing period has timed out. bool IsBlocked(const base::Feature& iph_feature); - static void RegisterProfilePrefs(PrefRegistrySimple* registry); - // Reset the state of |iph_feature|. void Reset(const base::Feature& iph_feature); + // Read the count of previous snoozes for |iph_feature| from profile. + int GetSnoozeCount(const base::Feature& iph_feature); + + static void RegisterProfilePrefs(PrefRegistrySimple* registry); + private: // Snooze information dictionary saved under path // in_product_help.snoozed_feature.[iph_name] in PerfService.
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 453a5fc76..393a018 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -752,10 +752,8 @@ InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents); - if (!google_apis::HasAPIKeyConfigured() || - !google_apis::HasOAuthClientConfigured()) { + if (!google_apis::HasAPIKeyConfigured()) GoogleApiKeysInfoBarDelegate::Create(infobar_service); - } if (ObsoleteSystem::IsObsoleteNowOrSoon()) { PrefService* local_state = g_browser_process->local_state();
diff --git a/chrome/browser/ui/view_ids.h b/chrome/browser/ui/view_ids.h index f8736139..6d6d44e 100644 --- a/chrome/browser/ui/view_ids.h +++ b/chrome/browser/ui/view_ids.h
@@ -102,10 +102,6 @@ // Plus button on location bar. VIEW_ID_ACTION_BOX_BUTTON, - - // IDs for the WebUI-based tab strip. See https://crbug.com/989131. - VIEW_ID_WEBUI_TAB_STRIP_TAB_COUNTER, - VIEW_ID_WEBUI_TAB_STRIP_NEW_TAB_BUTTON, }; #endif // CHROME_BROWSER_UI_VIEW_IDS_H_
diff --git a/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc b/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc index e20093b..201b039 100644 --- a/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc +++ b/chrome/browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc
@@ -1985,6 +1985,75 @@ // TODO(crbug.com/884817): Investigate combining local vs. upload tests using a // boolean to branch local vs. upload logic. +// Tests StrikeDatabase interaction with the local save bubble. Ensures that a +// strike is added if the bubble is ignored. +IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, + StrikeDatabase_Local_AddStrikeIfBubbleIgnored) { + TestAutofillClock test_clock; + test_clock.SetNow(base::Time::Now()); + + // Set up the Payments RPC. + SetUploadDetailsRpcPaymentsDeclines(); + + FillForm(); + SubmitFormAndWaitForCardLocalSaveBubble(); + + // Clicking the [X] close button should dismiss the bubble. + ClickOnCloseButton(); + + // Add an event observer to the controller to detect strike changes. + AddEventObserverToController(); + + base::HistogramTester histogram_tester; + + // Wait long enough to avoid bubble stickiness, then navigate away from the + // page. + test_clock.Advance(kCardBubbleSurviveNavigationTime); + ResetEventWaiterForSequence({DialogEvent::STRIKE_CHANGE_COMPLETE}); + NavigateTo(kCreditCardAndAddressUploadForm); + WaitForObservedEvent(); + + // Ensure that a strike was added due to the bubble being ignored. + histogram_tester.ExpectUniqueSample( + "Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave", + /*sample=*/1, /*count=*/1); +} + +// Tests StrikeDatabase interaction with the upload save bubble. Ensures that a +// strike is added if the bubble is ignored. +IN_PROC_BROWSER_TEST_F( + SaveCardBubbleViewsFullFormBrowserTestWithAutofillUpstream, + StrikeDatabase_Upload_AddStrikeIfBubbleIgnored) { + TestAutofillClock test_clock; + test_clock.SetNow(base::Time::Now()); + + // Start sync. + harness_->SetupSync(); + + FillForm(); + SubmitFormAndWaitForCardUploadSaveBubble(); + + // Clicking the [X] close button should dismiss the bubble. + ClickOnCloseButton(); + + // Add an event observer to the controller to detect strike changes. + AddEventObserverToController(); + + base::HistogramTester histogram_tester; + + // Wait long enough to avoid bubble stickiness, then navigate away from the + // page. + test_clock.Advance(kCardBubbleSurviveNavigationTime); + ResetEventWaiterForSequence({DialogEvent::STRIKE_CHANGE_COMPLETE}); + NavigateTo(kCreditCardAndAddressUploadForm); + WaitForObservedEvent(); + + // Ensure that a strike was added due to the bubble being ignored. + histogram_tester.ExpectUniqueSample( + "Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave", + /*sample=*/1, /*count=*/1); +} + // Tests the local save bubble. Ensures that clicking the [No thanks] button // successfully causes a strike to be added. IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTest, @@ -2681,96 +2750,4 @@ } #endif -// TODO(crbug.com/1070799): Remove the following two tests when the sticky -// bubble feature is launched. -class SaveCardBubbleViewsFullFormBrowserTestForStrikeDatabaseWithoutStickyBubble - : public SaveCardBubbleViewsFullFormBrowserTest { - protected: - ~SaveCardBubbleViewsFullFormBrowserTestForStrikeDatabaseWithoutStickyBubble() - override = default; - - void SetUp() override { - feature_list_.InitWithFeatures( - /*enabled_features=*/{}, - /*disabled_features=*/{ - features::kAutofillEnableStickyPaymentsBubble, - features::kAutofillEnableFixedPaymentsBubbleLogging}); - - SaveCardBubbleViewsFullFormBrowserTest::SetUp(); - } - - private: - base::test::ScopedFeatureList feature_list_; -}; - -// Tests StrikeDatabase interaction with the local save bubble. Ensures that a -// strike is added if the bubble is ignored. -IN_PROC_BROWSER_TEST_F( - SaveCardBubbleViewsFullFormBrowserTestForStrikeDatabaseWithoutStickyBubble, - StrikeDatabase_Local_AddStrikeIfBubbleIgnored) { - TestAutofillClock test_clock; - test_clock.SetNow(base::Time::Now()); - - // Set up the Payments RPC. - SetUploadDetailsRpcPaymentsDeclines(); - - FillForm(); - SubmitFormAndWaitForCardLocalSaveBubble(); - - // Clicking the [X] close button should dismiss the bubble. - ClickOnCloseButton(); - - // Add an event observer to the controller to detect strike changes. - AddEventObserverToController(); - - base::HistogramTester histogram_tester; - - // Wait long enough to avoid bubble stickiness, then navigate away from the - // page. - test_clock.Advance(kCardBubbleSurviveNavigationTime); - ResetEventWaiterForSequence({DialogEvent::STRIKE_CHANGE_COMPLETE}); - NavigateTo(kCreditCardAndAddressUploadForm); - WaitForObservedEvent(); - - // Ensure that a strike was added due to the bubble being ignored. - histogram_tester.ExpectUniqueSample( - "Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave", - /*sample=*/1, /*count=*/1); -} - -// Tests StrikeDatabase interaction with the upload save bubble. Ensures that a -// strike is added if the bubble is ignored. -IN_PROC_BROWSER_TEST_F( - SaveCardBubbleViewsFullFormBrowserTestForStrikeDatabaseWithoutStickyBubble, - StrikeDatabase_Upload_AddStrikeIfBubbleIgnored) { - TestAutofillClock test_clock; - test_clock.SetNow(base::Time::Now()); - - // Start sync. - harness_->SetupSync(); - - FillForm(); - SubmitFormAndWaitForCardUploadSaveBubble(); - - // Clicking the [X] close button should dismiss the bubble. - ClickOnCloseButton(); - - // Add an event observer to the controller to detect strike changes. - AddEventObserverToController(); - - base::HistogramTester histogram_tester; - - // Wait long enough to avoid bubble stickiness, then navigate away from the - // page. - test_clock.Advance(kCardBubbleSurviveNavigationTime); - ResetEventWaiterForSequence({DialogEvent::STRIKE_CHANGE_COMPLETE}); - NavigateTo(kCreditCardAndAddressUploadForm); - WaitForObservedEvent(); - - // Ensure that a strike was added due to the bubble being ignored. - histogram_tester.ExpectUniqueSample( - "Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave", - /*sample=*/1, /*count=*/1); -} - } // namespace autofill
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc index c88f27d3..0899914 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -111,7 +111,7 @@ // Initializing the TabIconView is expensive, so only do it if we need to. if (browser_view()->ShouldShowWindowIcon()) { - window_icon_ = new TabIconView(this, nullptr); + window_icon_ = new TabIconView(this, views::Button::PressedCallback()); window_icon_->set_is_light(true); AddChildView(window_icon_); window_icon_->Update();
diff --git a/chrome/browser/ui/views/frame/glass_browser_caption_button_container.cc b/chrome/browser/ui/views/frame/glass_browser_caption_button_container.cc index d36f62a..c52f555 100644 --- a/chrome/browser/ui/views/frame/glass_browser_caption_button_container.cc +++ b/chrome/browser/ui/views/frame/glass_browser_caption_button_container.cc
@@ -16,11 +16,12 @@ namespace { std::unique_ptr<Windows10CaptionButton> CreateCaptionButton( + views::Button::PressedCallback callback, GlassBrowserFrameView* frame_view, ViewID button_type, int accessible_name_resource_id) { return std::make_unique<Windows10CaptionButton>( - frame_view, button_type, + std::move(callback), frame_view, button_type, l10n_util::GetStringUTF16(accessible_name_resource_id)); } @@ -34,21 +35,31 @@ GlassBrowserCaptionButtonContainer::GlassBrowserCaptionButtonContainer( GlassBrowserFrameView* frame_view) : frame_view_(frame_view), - minimize_button_( - AddChildView(CreateCaptionButton(frame_view, - VIEW_ID_MINIMIZE_BUTTON, - IDS_APP_ACCNAME_MINIMIZE))), - maximize_button_( - AddChildView(CreateCaptionButton(frame_view, - VIEW_ID_MAXIMIZE_BUTTON, - IDS_APP_ACCNAME_MAXIMIZE))), - restore_button_( - AddChildView(CreateCaptionButton(frame_view, - VIEW_ID_RESTORE_BUTTON, - IDS_APP_ACCNAME_RESTORE))), - close_button_(AddChildView(CreateCaptionButton(frame_view, - VIEW_ID_CLOSE_BUTTON, - IDS_APP_ACCNAME_CLOSE))) { + minimize_button_(AddChildView(CreateCaptionButton( + base::BindRepeating(&BrowserFrame::Minimize, + base::Unretained(frame_view_->frame())), + frame_view_, + VIEW_ID_MINIMIZE_BUTTON, + IDS_APP_ACCNAME_MINIMIZE))), + maximize_button_(AddChildView(CreateCaptionButton( + base::BindRepeating(&BrowserFrame::Maximize, + base::Unretained(frame_view_->frame())), + frame_view_, + VIEW_ID_MAXIMIZE_BUTTON, + IDS_APP_ACCNAME_MAXIMIZE))), + restore_button_(AddChildView(CreateCaptionButton( + base::BindRepeating(&BrowserFrame::Restore, + base::Unretained(frame_view_->frame())), + frame_view_, + VIEW_ID_RESTORE_BUTTON, + IDS_APP_ACCNAME_RESTORE))), + close_button_(AddChildView(CreateCaptionButton( + base::BindRepeating(&BrowserFrame::CloseWithReason, + base::Unretained(frame_view_->frame()), + views::Widget::ClosedReason::kCloseButtonClicked), + frame_view_, + VIEW_ID_CLOSE_BUTTON, + IDS_APP_ACCNAME_CLOSE))) { // Layout is horizontal, with buttons placed at the trailing end of the view. // This allows the container to expand to become a faux titlebar/drag handle. auto* const layout = SetLayoutManager(std::make_unique<views::FlexLayout>()); @@ -89,18 +100,6 @@ InvalidateLayout(); } -void GlassBrowserCaptionButtonContainer::ButtonPressed(views::Button* sender) { - if (sender == minimize_button_) - frame_view_->frame()->Minimize(); - else if (sender == maximize_button_) - frame_view_->frame()->Maximize(); - else if (sender == restore_button_) - frame_view_->frame()->Restore(); - else if (sender == close_button_) - frame_view_->frame()->CloseWithReason( - views::Widget::ClosedReason::kCloseButtonClicked); -} - void GlassBrowserCaptionButtonContainer::AddedToWidget() { views::Widget* const widget = GetWidget(); if (!widget_observer_.IsObserving(widget))
diff --git a/chrome/browser/ui/views/frame/glass_browser_caption_button_container.h b/chrome/browser/ui/views/frame/glass_browser_caption_button_container.h index ea14ed5..310fb40 100644 --- a/chrome/browser/ui/views/frame/glass_browser_caption_button_container.h +++ b/chrome/browser/ui/views/frame/glass_browser_caption_button_container.h
@@ -44,7 +44,6 @@ const gfx::Rect& new_bounds) override; void ResetWindowControls(); - void ButtonPressed(views::Button* sender); // Sets caption button visibility and enabled state based on window state. // Only one of maximize or restore button should ever be visible at the same
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc index f5cee2af..bd24cf6e 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -96,7 +96,7 @@ if (browser_view->CanShowWindowIcon()) { InitThrobberIcons(); - window_icon_ = new TabIconView(this, nullptr); + window_icon_ = new TabIconView(this, views::Button::PressedCallback()); window_icon_->set_is_light(true); window_icon_->SetID(VIEW_ID_WINDOW_ICON); // Stop the icon from intercepting clicks intended for the HTSYSMENU region @@ -368,12 +368,6 @@ caption_button_container_->ResetWindowControls(); } -void GlassBrowserFrameView::ButtonPressed(views::Button* sender, - const ui::Event& event) { - if (caption_button_container_) - caption_button_container_->ButtonPressed(sender); -} - bool GlassBrowserFrameView::ShouldTabIconViewAnimate() const { DCHECK(ShouldShowWindowIcon(TitlebarType::kCustom)); content::WebContents* current_tab = browser_view()->GetActiveWebContents();
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.h b/chrome/browser/ui/views/frame/glass_browser_frame_view.h index 20cfb0b7..549a5fe 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.h
@@ -12,13 +12,11 @@ #include "chrome/browser/ui/views/frame/windows_10_caption_button.h" #include "chrome/browser/ui/views/tab_icon_view.h" #include "chrome/browser/ui/views/tab_icon_view_model.h" -#include "ui/views/controls/button/button.h" #include "ui/views/window/non_client_view.h" class BrowserView; class GlassBrowserFrameView : public BrowserNonClientFrameView, - public views::ButtonListener, public TabIconViewModel { public: // Alpha to use for features in the titlebar (the window title and caption @@ -59,9 +57,6 @@ void ResetWindowControls() override; void SizeConstraintsChanged() override {} - // views::ButtonListener: - void ButtonPressed(views::Button* sender, const ui::Event& event) override; - // TabIconViewModel: bool ShouldTabIconViewAnimate() const override; gfx::ImageSkia GetFaviconForTabIconView() override;
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index a63f046..599de30 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -157,18 +157,30 @@ CreateImageButton(IDR_CLOSE, IDR_CLOSE_H, IDR_CLOSE_P, IDR_CLOSE_BUTTON_MASK, VIEW_ID_CLOSE_BUTTON); } - InitWindowCaptionButton(minimize_button_, IDS_ACCNAME_MINIMIZE, - VIEW_ID_MINIMIZE_BUTTON); - InitWindowCaptionButton(maximize_button_, IDS_ACCNAME_MAXIMIZE, - VIEW_ID_MAXIMIZE_BUTTON); - InitWindowCaptionButton(restore_button_, IDS_ACCNAME_RESTORE, - VIEW_ID_RESTORE_BUTTON); - InitWindowCaptionButton(close_button_, IDS_ACCNAME_CLOSE, - VIEW_ID_CLOSE_BUTTON); + InitWindowCaptionButton( + minimize_button_, + base::BindRepeating(&BrowserFrame::Minimize, base::Unretained(frame())), + IDS_ACCNAME_MINIMIZE, VIEW_ID_MINIMIZE_BUTTON); + InitWindowCaptionButton( + maximize_button_, + base::BindRepeating(&BrowserFrame::Maximize, base::Unretained(frame())), + IDS_ACCNAME_MAXIMIZE, VIEW_ID_MAXIMIZE_BUTTON); + InitWindowCaptionButton( + restore_button_, + base::BindRepeating(&BrowserFrame::Restore, base::Unretained(frame())), + IDS_ACCNAME_RESTORE, VIEW_ID_RESTORE_BUTTON); + InitWindowCaptionButton( + close_button_, + base::BindRepeating(&BrowserFrame::CloseWithReason, + base::Unretained(frame()), + views::Widget::ClosedReason::kCloseButtonClicked), + IDS_ACCNAME_CLOSE, VIEW_ID_CLOSE_BUTTON); // Initializing the TabIconView is expensive, so only do it if we need to. if (browser_view()->ShouldShowWindowIcon()) { - window_icon_ = new TabIconView(this, this); + window_icon_ = new TabIconView( + this, base::BindRepeating(&OpaqueBrowserFrameView::WindowIconPressed, + base::Unretained(this))); window_icon_->set_is_light(true); window_icon_->SetID(VIEW_ID_WINDOW_ICON); AddChildView(window_icon_); @@ -333,33 +345,6 @@ } /////////////////////////////////////////////////////////////////////////////// -// OpaqueBrowserFrameView, views::ButtonListener implementation: - -void OpaqueBrowserFrameView::ButtonPressed(views::Button* sender, - const ui::Event& event) { - if (sender == minimize_button_) { - frame()->Minimize(); - } else if (sender == maximize_button_) { - frame()->Maximize(); - } else if (sender == restore_button_) { - frame()->Restore(); - } else if (sender == close_button_) { - frame()->CloseWithReason(views::Widget::ClosedReason::kCloseButtonClicked); - } else if (sender == window_icon_) { -#if defined(OS_LINUX) || defined(OS_CHROMEOS) - // TODO(pbos): Figure out / document why this is Linux only. This needs a - // comment. - views::MenuRunner menu_runner(frame()->GetSystemMenuModel(), - views::MenuRunner::HAS_MNEMONICS); - menu_runner.RunMenuAt( - browser_view()->GetWidget(), window_icon_->button_controller(), - window_icon_->GetBoundsInScreen(), views::MenuAnchorPosition::kTopLeft, - ui::MENU_SOURCE_MOUSE); -#endif - } -} - -/////////////////////////////////////////////////////////////////////////////// // OpaqueBrowserFrameView, TabIconView::TabContentsProvider implementation: bool OpaqueBrowserFrameView::ShouldTabIconViewAnimate() const { @@ -552,7 +537,7 @@ int ht_component, const gfx::VectorIcon& icon_image) { views::FrameCaptionButton* button = - new views::FrameCaptionButton(this, icon_type, ht_component); + new views::FrameCaptionButton(nullptr, icon_type, ht_component); button->SetImage(button->icon(), views::FrameCaptionButton::ANIMATE_NO, icon_image); return button; @@ -563,7 +548,7 @@ int pushed_image_id, int mask_image_id, ViewID view_id) { - views::ImageButton* button = new views::ImageButton(this); + views::ImageButton* button = new views::ImageButton(nullptr); const ui::ThemeProvider* tp = frame()->GetThemeProvider(); button->SetImage(views::Button::STATE_NORMAL, tp->GetImageSkiaNamed(normal_image_id)); @@ -592,8 +577,10 @@ void OpaqueBrowserFrameView::InitWindowCaptionButton( views::Button* button, + views::Button::PressedCallback callback, int accessibility_string_id, ViewID view_id) { + button->set_callback(std::move(callback)); button->SetAccessibleName(l10n_util::GetStringUTF16(accessibility_string_id)); button->SetID(view_id); AddChildView(button); @@ -669,6 +656,19 @@ return layout_->IconBounds(); } +void OpaqueBrowserFrameView::WindowIconPressed() { +#if defined(OS_LINUX) || defined(OS_CHROMEOS) + // TODO(pbos): Figure out / document why this is Linux only. This needs a + // comment. + views::MenuRunner menu_runner(frame()->GetSystemMenuModel(), + views::MenuRunner::HAS_MNEMONICS); + menu_runner.RunMenuAt( + browser_view()->GetWidget(), window_icon_->button_controller(), + window_icon_->GetBoundsInScreen(), views::MenuAnchorPosition::kTopLeft, + ui::MENU_SOURCE_MOUSE); +#endif +} + bool OpaqueBrowserFrameView::ShouldShowWindowTitleBar() const { // Do not show the custom title bar if the system title bar option is enabled. if (!frame()->UseCustomFrame())
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h index c94eb1bf..2cac34ea 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h
@@ -8,6 +8,7 @@ #include <memory> #include "base/macros.h" +#include "build/build_config.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/frame/browser_frame.h" #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" @@ -38,7 +39,6 @@ } class OpaqueBrowserFrameView : public BrowserNonClientFrameView, - public views::ButtonListener, public TabIconViewModel, public OpaqueBrowserFrameViewLayoutDelegate { public: @@ -78,9 +78,6 @@ const char* GetClassName() const override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; - // views::ButtonListener: - void ButtonPressed(views::Button* sender, const ui::Event& event) override; - // TabIconViewModel: bool ShouldTabIconViewAnimate() const override; gfx::ImageSkia GetFaviconForTabIconView() override; @@ -137,6 +134,7 @@ // Initializes state on |button| common to both FrameCaptionButtons and // ImageButtons. void InitWindowCaptionButton(views::Button* button, + views::Button::PressedCallback callback, int accessibility_string_id, ViewID view_id); @@ -173,6 +171,8 @@ // there was one). gfx::Rect IconBounds() const; + void WindowIconPressed(); + // Returns true if the view should draw its own custom title bar. bool ShouldShowWindowTitleBar() const;
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc index 8fb8979..69f85552 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
@@ -151,7 +151,7 @@ } void AddWindowTitleIcons() { - tab_icon_view_ = new TabIconView(nullptr, nullptr); + tab_icon_view_ = new TabIconView(nullptr, views::Button::PressedCallback()); tab_icon_view_->set_is_light(true); tab_icon_view_->SetID(VIEW_ID_WINDOW_ICON); root_view_->AddChildView(tab_icon_view_);
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.cc b/chrome/browser/ui/views/frame/tab_strip_region_view.cc index 1d27848..fa343e2 100644 --- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc +++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -94,13 +94,13 @@ if (tab_strip_container_->HitTestRect(get_target_rect(tab_strip_container_))) return tab_strip_->IsRectInWindowCaption(get_target_rect(tab_strip_)); - // Check to see if the rect intersects the non-button parts of the tab search - // button. The enclosed button has a non-rectangular shape, so if it's not in - // the visual portions of the buttons we treat it as a click to the caption. - if (tab_search_button_ && tab_search_button_->GetLocalBounds().Intersects( - get_target_rect(tab_search_button_))) { - return !tab_search_button_->HitTestRect( - get_target_rect(tab_search_button_)); + // The child could have a non-rectangular shape, so if the rect is not in the + // visual portions of the child view we treat it as a click to the caption. + for (View* const child : children()) { + if (child != tab_strip_container_ && + child->GetLocalBounds().Intersects(get_target_rect(child))) { + return !child->HitTestRect(get_target_rect(child)); + } } return true;
diff --git a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc index e4abb53..c7e9704 100644 --- a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc +++ b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc
@@ -33,7 +33,6 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/ui_features.h" -#include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/chrome_view_class_properties.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" @@ -560,7 +559,10 @@ std::unique_ptr<views::View> WebUITabStripContainerView::CreateTabCounter() { DCHECK_EQ(nullptr, tab_counter_); - auto tab_counter = CreateWebUITabCounterButton(this, browser_view_); + auto tab_counter = CreateWebUITabCounterButton( + base::BindRepeating(&WebUITabStripContainerView::TabCounterPressed, + base::Unretained(this)), + browser_view_); tab_counter_ = tab_counter.get(); view_observer_.Add(tab_counter_); @@ -657,6 +659,30 @@ : WebUITabStripOpenCloseReason::kDragRelease); } +void WebUITabStripContainerView::TabCounterPressed() { + const bool new_visibility = !GetVisible(); + if (new_visibility) { + RecordTabStripUIOpenHistogram(TabStripUIOpenAction::kTapOnTabCounter); + browser_view_->feature_promo_controller() + ->feature_engagement_tracker() + ->NotifyEvent(feature_engagement::events::kWebUITabStripOpened); + } else { + RecordTabStripUICloseHistogram(TabStripUICloseAction::kTapOnTabCounter); + browser_view_->feature_promo_controller() + ->feature_engagement_tracker() + ->NotifyEvent(feature_engagement::events::kWebUITabStripClosed); + } + + SetContainerTargetVisibility(new_visibility, + WebUITabStripOpenCloseReason::kOther); + + if (GetVisible() && tab_counter_->HasFocus()) { + // Automatically move focus to the tab strip WebUI if the focus is + // currently on the toggle button. + SetPaneFocusAndFocusDefault(); + } +} + void WebUITabStripContainerView::SetContainerTargetVisibility( bool target_visible, WebUITabStripOpenCloseReason reason) { @@ -795,32 +821,6 @@ return gfx::Size(width, height); } -void WebUITabStripContainerView::ButtonPressed(views::Button* sender, - const ui::Event& event) { - DCHECK_EQ(sender->GetID(), VIEW_ID_WEBUI_TAB_STRIP_TAB_COUNTER); - const bool new_visibility = !GetVisible(); - if (new_visibility) { - RecordTabStripUIOpenHistogram(TabStripUIOpenAction::kTapOnTabCounter); - browser_view_->feature_promo_controller() - ->feature_engagement_tracker() - ->NotifyEvent(feature_engagement::events::kWebUITabStripOpened); - } else { - RecordTabStripUICloseHistogram(TabStripUICloseAction::kTapOnTabCounter); - browser_view_->feature_promo_controller() - ->feature_engagement_tracker() - ->NotifyEvent(feature_engagement::events::kWebUITabStripClosed); - } - - SetContainerTargetVisibility(new_visibility, - WebUITabStripOpenCloseReason::kOther); - - if (GetVisible() && sender->HasFocus()) { - // Automatically move focus to the tab strip WebUI if the focus is - // currently on the toggle button. - SetPaneFocusAndFocusDefault(); - } -} - void WebUITabStripContainerView::OnViewBoundsChanged(View* observed_view) { if (observed_view == top_container_) { if (old_top_container_width_ != top_container_->width()) {
diff --git a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h index e08b12c..4b5eba3 100644 --- a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h +++ b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h
@@ -11,13 +11,13 @@ #include "base/optional.h" #include "base/scoped_observer.h" #include "base/time/time.h" -#include "chrome/browser/ui/views/toolbar/toolbar_button.h" #include "chrome/browser/ui/webui/tab_strip/tab_strip_ui.h" #include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_embedder.h" #include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_metrics.h" #include "chrome/common/buildflags.h" #include "components/tab_groups/tab_group_id.h" #include "ui/events/event_handler.h" +#include "ui/gfx/animation/animation_delegate.h" #include "ui/gfx/animation/slide_animation.h" #include "ui/views/accessible_pane_view.h" #include "ui/views/view.h" @@ -46,7 +46,6 @@ class WebUITabStripContainerView : public TabStripUIEmbedder, public gfx::AnimationDelegate, public views::AccessiblePaneView, - public views::ButtonListener, public views::ViewObserver { public: WebUITabStripContainerView(BrowserView* browser_view, @@ -97,6 +96,8 @@ void EndDragToOpen(base::Optional<WebUITabStripDragDirection> fling_direction = base::nullopt); + void TabCounterPressed(); + void SetContainerTargetVisibility(bool target_visible, WebUITabStripOpenCloseReason reason); @@ -125,9 +126,6 @@ void AnimationEnded(const gfx::Animation* animation) override; void AnimationProgressed(const gfx::Animation* animation) override; - // views::ButtonListener: - void ButtonPressed(views::Button* sender, const ui::Event& event) override; - // views::ViewObserver: void OnViewBoundsChanged(View* observed_view) override; void OnViewIsDeleting(View* observed_view) override;
diff --git a/chrome/browser/ui/views/frame/windows_10_caption_button.cc b/chrome/browser/ui/views/frame/windows_10_caption_button.cc index c31ca32..0204d0e 100644 --- a/chrome/browser/ui/views/frame/windows_10_caption_button.cc +++ b/chrome/browser/ui/views/frame/windows_10_caption_button.cc
@@ -17,10 +17,11 @@ #include "ui/gfx/scoped_canvas.h" Windows10CaptionButton::Windows10CaptionButton( + PressedCallback callback, GlassBrowserFrameView* frame_view, ViewID button_type, const base::string16& accessible_name) - : views::Button(frame_view), + : views::Button(std::move(callback)), frame_view_(frame_view), button_type_(button_type) { SetAnimateOnStateChange(true);
diff --git a/chrome/browser/ui/views/frame/windows_10_caption_button.h b/chrome/browser/ui/views/frame/windows_10_caption_button.h index ec5301d1..0a87c3fb 100644 --- a/chrome/browser/ui/views/frame/windows_10_caption_button.h +++ b/chrome/browser/ui/views/frame/windows_10_caption_button.h
@@ -13,7 +13,8 @@ class Windows10CaptionButton : public views::Button { public: - Windows10CaptionButton(GlassBrowserFrameView* frame_view, + Windows10CaptionButton(PressedCallback callback, + GlassBrowserFrameView* frame_view, ViewID button_type, const base::string16& accessible_name);
diff --git a/chrome/browser/ui/views/in_product_help/feature_promo_controller_views.cc b/chrome/browser/ui/views/in_product_help/feature_promo_controller_views.cc index d213d2b..8412b88 100644 --- a/chrome/browser/ui/views/in_product_help/feature_promo_controller_views.cc +++ b/chrome/browser/ui/views/in_product_help/feature_promo_controller_views.cc
@@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/memory/weak_ptr.h" +#include "base/metrics/histogram_functions.h" #include "base/optional.h" #include "chrome/browser/feature_engagement/tracker_factory.h" #include "chrome/browser/profiles/profile.h" @@ -75,6 +76,13 @@ base::Unretained(this), iph_feature)); widget_observer_.Add(promo_bubble_->GetWidget()); + // Record count of previous snoozes when an IPH triggers. + int snooze_count = snooze_service_->GetSnoozeCount(iph_feature); + base::UmaHistogramExactLinear("InProductHelp.Promos.SnoozeCountAtTrigger." + + std::string(iph_feature.name), + snooze_count, + snooze_service_->kUmaMaxSnoozeCount); + return true; } @@ -130,6 +138,14 @@ if (anchor_view_tracker_.view()) anchor_view_tracker_.view()->SetProperty(kHasInProductHelpPromoKey, false); + // Record count of previous snoozes when the IPH gets dismissed by user + // following the promo. e.g. clicking on relevant controls. + int snooze_count = snooze_service_->GetSnoozeCount(iph_feature); + base::UmaHistogramExactLinear("InProductHelp.Promos.SnoozeCountAtFollow." + + std::string(iph_feature.name), + snooze_count, + snooze_service_->kUmaMaxSnoozeCount); + return PromoHandle(weak_ptr_factory_.GetWeakPtr()); }
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 2889d7f9..681864f 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -270,10 +270,7 @@ params.types_enabled.push_back(PageActionIconType::kFind); params.types_enabled.push_back(PageActionIconType::kTranslate); params.types_enabled.push_back(PageActionIconType::kZoom); - if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI)) { - params.types_enabled.push_back( - PageActionIconType::kNativeFileSystemAccess); - } + params.types_enabled.push_back(PageActionIconType::kNativeFileSystemAccess); if (dom_distiller::IsDomDistillerEnabled() && browser_->is_type_normal()) { params.types_enabled.push_back(PageActionIconType::kReaderMode);
diff --git a/chrome/browser/ui/views/native_file_system/native_file_system_browsertest.cc b/chrome/browser/ui/views/native_file_system/native_file_system_browsertest.cc index 3daee5d1..378d838f 100644 --- a/chrome/browser/ui/views/native_file_system/native_file_system_browsertest.cc +++ b/chrome/browser/ui/views/native_file_system/native_file_system_browsertest.cc
@@ -7,7 +7,6 @@ #include "base/path_service.h" #include "base/strings/strcat.h" #include "base/test/bind_test_util.h" -#include "base/test/scoped_feature_list.h" #include "base/test/scoped_path_override.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" @@ -20,7 +19,6 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/toolbar_button_provider.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h" -#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -35,7 +33,6 @@ #include "content/public/test/web_ui_browsertest_util.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" -#include "third_party/blink/public/common/features.h" #include "ui/shell_dialogs/select_file_dialog.h" #include "ui/shell_dialogs/select_file_dialog_factory.h" #include "ui/shell_dialogs/select_file_policy.h" @@ -105,9 +102,6 @@ public: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - scoped_feature_list_.InitWithFeatures( - {blink::features::kNativeFileSystemAPI}, {}); - InProcessBrowserTest::SetUp(); } @@ -158,7 +152,6 @@ } protected: - base::test::ScopedFeatureList scoped_feature_list_; base::ScopedTempDir temp_dir_; }; @@ -729,9 +722,6 @@ class NativeFileSystemBrowserTestForWebUI : public InProcessBrowserTest { public: NativeFileSystemBrowserTestForWebUI() { - native_file_system_feature_.InitAndEnableFeature( - blink::features::kNativeFileSystemAPI); - content::WebUIControllerFactory::RegisterFactory(&factory_); base::ScopedAllowBlockingForTesting allow_blocking; @@ -849,7 +839,6 @@ base::ScopedTempDir temp_dir_; private: - base::test::ScopedFeatureList native_file_system_feature_; content::TestWebUIControllerFactory factory_; };
diff --git a/chrome/browser/ui/views/native_file_system/native_file_system_usage_bubble_view_browsertest.cc b/chrome/browser/ui/views/native_file_system/native_file_system_usage_bubble_view_browsertest.cc index d5bc663..f5c6311 100644 --- a/chrome/browser/ui/views/native_file_system/native_file_system_usage_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/native_file_system/native_file_system_usage_bubble_view_browsertest.cc
@@ -5,21 +5,13 @@ #include "chrome/browser/ui/views/native_file_system/native_file_system_usage_bubble_view.h" #include "base/files/file_path.h" -#include "base/test/scoped_feature_list.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/test/test_browser_dialog.h" #include "content/public/test/browser_test.h" -#include "third_party/blink/public/common/features.h" class NativeFileSystemUsageBubbleViewTest : public DialogBrowserTest { public: // DialogBrowserTest: - void SetUp() override { - scoped_feature_list_.InitAndEnableFeature( - blink::features::kNativeFileSystemAPI); - DialogBrowserTest::SetUp(); - } - void ShowUi(const std::string& name) override { NativeFileSystemUsageBubbleView::Usage usage; url::Origin origin = kTestOrigin; @@ -108,7 +100,6 @@ } protected: - base::test::ScopedFeatureList scoped_feature_list_; const url::Origin kTestOrigin = url::Origin::Create(GURL("https://example.com")); };
diff --git a/chrome/browser/ui/views/tab_icon_view.cc b/chrome/browser/ui/views/tab_icon_view.cc index 1ae19ef9..dfe1128 100644 --- a/chrome/browser/ui/views/tab_icon_view.cc +++ b/chrome/browser/ui/views/tab_icon_view.cc
@@ -68,8 +68,8 @@ } // namespace TabIconView::TabIconView(TabIconViewModel* model, - views::ButtonListener* listener) - : views::MenuButton(listener), model_(model), is_light_(false) { + views::Button::PressedCallback callback) + : views::MenuButton(std::move(callback)), model_(model), is_light_(false) { // Inheriting from Button causes this View to be focusable, but it us // purely decorative and should not be exposed as focusable in accessibility. SetFocusBehavior(FocusBehavior::NEVER);
diff --git a/chrome/browser/ui/views/tab_icon_view.h b/chrome/browser/ui/views/tab_icon_view.h index b18f2e1c..302c6ed 100644 --- a/chrome/browser/ui/views/tab_icon_view.h +++ b/chrome/browser/ui/views/tab_icon_view.h
@@ -18,7 +18,7 @@ // A view to display a tab favicon or a throbber. class TabIconView : public views::MenuButton { public: - TabIconView(TabIconViewModel* model, views::ButtonListener* button_listener); + TabIconView(TabIconViewModel* model, views::Button::PressedCallback callback); ~TabIconView() override; // Invoke whenever the tab state changes or the throbber should update.
diff --git a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc index a501ed3..09b6decc 100644 --- a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc +++ b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc
@@ -18,7 +18,6 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" -#include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" #include "chrome/browser/ui/views/chrome_view_class_properties.h" @@ -441,7 +440,7 @@ static constexpr int WEBUI_TAB_COUNTER_CXMENU_CLOSE_TAB = 13; static constexpr int WEBUI_TAB_COUNTER_CXMENU_NEW_TAB = 14; - WebUITabCounterButton(views::ButtonListener* listener, + WebUITabCounterButton(PressedCallback pressed_callback, BrowserView* browser_view); ~WebUITabCounterButton() override; @@ -491,9 +490,9 @@ link_opened_from_gesture_subscription_; }; -WebUITabCounterButton::WebUITabCounterButton(views::ButtonListener* listener, +WebUITabCounterButton::WebUITabCounterButton(PressedCallback pressed_callback, BrowserView* browser_view) - : Button(listener), + : Button(std::move(pressed_callback)), tab_strip_model_(browser_view->browser()->tab_strip_model()), browser_view_(browser_view) {} @@ -532,8 +531,6 @@ } void WebUITabCounterButton::Init() { - SetID(VIEW_ID_WEBUI_TAB_STRIP_TAB_COUNTER); - SetProperty( views::kFlexBehaviorKey, views::FlexSpecification(views::MinimumFlexSizeRule::kScaleToMinimum, @@ -687,10 +684,10 @@ } // namespace std::unique_ptr<views::View> CreateWebUITabCounterButton( - views::ButtonListener* listener, + views::Button::PressedCallback pressed_callback, BrowserView* browser_view) { - auto tab_counter = - std::make_unique<WebUITabCounterButton>(listener, browser_view); + auto tab_counter = std::make_unique<WebUITabCounterButton>( + std::move(pressed_callback), browser_view); tab_counter->Init();
diff --git a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.h b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.h index d5ac291..a3d9585 100644 --- a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.h +++ b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.h
@@ -7,15 +7,16 @@ #include <memory> +#include "ui/views/controls/button/button.h" + namespace views { -class ButtonListener; class View; } // namespace views class BrowserView; std::unique_ptr<views::View> CreateWebUITabCounterButton( - views::ButtonListener* listener, + views::Button::PressedCallback pressed_callback, BrowserView* browser_view); #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WEBUI_TAB_COUNTER_BUTTON_H_
diff --git a/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.cc b/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.cc index 522be4f..75abe44 100644 --- a/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.cc +++ b/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.cc
@@ -11,7 +11,6 @@ #include "base/metrics/user_metrics_action.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/views/touch_selection_menu_chromeos.h" -#include "components/arc/arc_features.h" #include "components/arc/arc_service_manager.h" #include "components/arc/session/arc_bridge_service.h" #include "ui/aura/window.h" @@ -54,9 +53,6 @@ const gfx::Rect& anchor_rect, const gfx::Size& handle_image_size, aura::Window* context) { - if (!base::FeatureList::IsEnabled(arc::kSmartTextSelectionFeature)) - return false; - const std::string converted_text = base::UTF16ToUTF8(client->GetSelectedText()); if (converted_text.empty())
diff --git a/chrome/browser/ui/web_applications/app_browser_controller.cc b/chrome/browser/ui/web_applications/app_browser_controller.cc index 5dea3fec1..8d29d34 100644 --- a/chrome/browser/ui/web_applications/app_browser_controller.cc +++ b/chrome/browser/ui/web_applications/app_browser_controller.cc
@@ -301,8 +301,7 @@ types_enabled.push_back(PageActionIconType::kManagePasswords); types_enabled.push_back(PageActionIconType::kTranslate); types_enabled.push_back(PageActionIconType::kZoom); - if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI)) - types_enabled.push_back(PageActionIconType::kNativeFileSystemAccess); + types_enabled.push_back(PageActionIconType::kNativeFileSystemAccess); types_enabled.push_back(PageActionIconType::kCookieControls); types_enabled.push_back(PageActionIconType::kLocalCardMigration); types_enabled.push_back(PageActionIconType::kSaveCard);
diff --git a/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc b/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc index 7b8db12..ed10ed7d 100644 --- a/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc +++ b/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc
@@ -196,10 +196,8 @@ class WebAppFileHandlingBrowserTest : public WebAppFileHandlingTestBase { public: WebAppFileHandlingBrowserTest() { - scoped_feature_list_.InitWithFeatures( - {blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI}, - {}); + scoped_feature_list_.InitWithFeatures({blink::features::kFileHandlingAPI}, + {}); } content::WebContents* LaunchWithFiles( const std::string& app_id,
diff --git a/chrome/browser/ui/webui/chromeos/multidevice_internals/multidevice_internals_phone_hub_handler.cc b/chrome/browser/ui/webui/chromeos/multidevice_internals/multidevice_internals_phone_hub_handler.cc index 8e03d27..2ebe801 100644 --- a/chrome/browser/ui/webui/chromeos/multidevice_internals/multidevice_internals_phone_hub_handler.cc +++ b/chrome/browser/ui/webui/chromeos/multidevice_internals/multidevice_internals_phone_hub_handler.cc
@@ -266,7 +266,7 @@ CHECK(args->GetBoolean(0, &enabled)); PA_LOG(VERBOSE) << "Setting Do Not Disturb state to " << enabled; fake_phone_hub_manager_->fake_do_not_disturb_controller() - ->SetDoNotDisturbState(enabled); + ->SetDoNotDisturbStateInternal(enabled); } void MultidevicePhoneHubHandler::HandleSetFindMyDeviceStatus( @@ -278,7 +278,7 @@ bool is_ringing = status_as_int == 2; PA_LOG(VERBOSE) << "Setting phone ringing status to " << is_ringing; fake_phone_hub_manager_->fake_find_my_device_controller() - ->SetPhoneRingingState(is_ringing); + ->SetIsPhoneRingingInternal(is_ringing); } void MultidevicePhoneHubHandler::HandleSetTetherStatus(
diff --git a/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc index 451e93d..fab823c3 100644 --- a/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc
@@ -236,7 +236,7 @@ } void CallAttemptNotificationSetup(bool has_access_been_granted) { - fake_notification_access_manager()->SetHasAccessBeenGranted( + fake_notification_access_manager()->SetHasAccessBeenGrantedInternal( has_access_been_granted); base::ListValue empty_args; test_web_ui()->HandleReceivedMessage("attemptNotificationSetup",
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index 1a24e4ed..1bd3dfa 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2169,10 +2169,6 @@ cmd.HasSwitch(::switches::kEnableExperimentalWebPlatformFeatures)); html_source->AddBoolean( - "enableFileSystemWriteContentSetting", - base::FeatureList::IsEnabled(::blink::features::kNativeFileSystemAPI)); - - html_source->AddBoolean( "enableRemovingAllThirdPartyCookies", base::FeatureList::IsEnabled( browsing_data::features::kEnableRemovingAllThirdPartyCookies));
diff --git a/chrome/browser/web_applications/components/web_app_file_handler_registration_linux_browsertest.cc b/chrome/browser/web_applications/components/web_app_file_handler_registration_linux_browsertest.cc index 563ff5f..aca78b1 100644 --- a/chrome/browser/web_applications/components/web_app_file_handler_registration_linux_browsertest.cc +++ b/chrome/browser/web_applications/components/web_app_file_handler_registration_linux_browsertest.cc
@@ -58,14 +58,12 @@ WebAppFileHandlerRegistrationLinuxBrowserTest() { if (GetParam() == ProviderType::kWebApps) { scoped_feature_list_.InitWithFeatures( - {blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI, + {blink::features::kFileHandlingAPI, features::kDesktopPWAsWithoutExtensions}, {}); } else if (GetParam() == ProviderType::kBookmarkApps) { scoped_feature_list_.InitWithFeatures( - {blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI}, + {blink::features::kFileHandlingAPI}, {features::kDesktopPWAsWithoutExtensions}); } }
diff --git a/chrome/browser/web_applications/components/web_app_shortcut_win.cc b/chrome/browser/web_applications/components/web_app_shortcut_win.cc index a352bb7..ea723ef 100644 --- a/chrome/browser/web_applications/components/web_app_shortcut_win.cc +++ b/chrome/browser/web_applications/components/web_app_shortcut_win.cc
@@ -278,7 +278,7 @@ // Any shortcut could have been pinned, either by chrome or the user, so // they are all unpinned. base::win::UnpinShortcutFromTaskbar(*j); - if (base::DeleteFile(*j)) + if (!base::DeleteFile(*j)) result = false; } }
diff --git a/chrome/browser/web_applications/pending_app_manager_impl_browsertest.cc b/chrome/browser/web_applications/pending_app_manager_impl_browsertest.cc index 082aec01..b38750e 100644 --- a/chrome/browser/web_applications/pending_app_manager_impl_browsertest.cc +++ b/chrome/browser/web_applications/pending_app_manager_impl_browsertest.cc
@@ -361,24 +361,26 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, AlreadyRegistered) { ASSERT_TRUE(embedded_test_server()->Start()); + + // Ensure service worker registered for http://embedded_test_server/web_apps/. + // We don't need to be installing a web app here but it's convenient just to + // await the service worker registration. { - // Delay service worker registration to second load to simulate it not - // loading during the initial install pass. - GURL install_url(embedded_test_server()->GetURL( - "/web_apps/service_worker_on_second_load.html")); + GURL install_url(embedded_test_server()->GetURL("/web_apps/basic.html")); ExternalInstallOptions install_options = CreateInstallOptions(install_url); install_options.force_reinstall = true; - install_options.bypass_service_worker_check = true; InstallApp(std::move(install_options)); EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result_code_.value()); WebAppRegistrationWaiter(&pending_app_manager()) - .AwaitNextRegistration(install_url, RegistrationResultCode::kSuccess); + .AwaitNextNonFailedRegistration(install_url); + CheckServiceWorkerStatus( + embedded_test_server()->GetURL("/web_apps/basic.html"), + content::ServiceWorkerCapability::SERVICE_WORKER_WITH_FETCH_HANDLER); } - CheckServiceWorkerStatus( - embedded_test_server()->GetURL("/web_apps/basic.html"), - content::ServiceWorkerCapability::SERVICE_WORKER_WITH_FETCH_HANDLER); - + // With the service worker registered we install a page that doesn't register + // a service worker to check that the existing service worker is seen by our + // service worker registration step. { GURL install_url( embedded_test_server()->GetURL("/web_apps/no_service_worker.html"));
diff --git a/chrome/browser/web_applications/proto/web_app.proto b/chrome/browser/web_applications/proto/web_app.proto index 5d8a5198..bf9d7a1 100644 --- a/chrome/browser/web_applications/proto/web_app.proto +++ b/chrome/browser/web_applications/proto/web_app.proto
@@ -135,8 +135,10 @@ optional uint32 background_color = 21; - // A list of display modes specified in app manifest. - repeated DisplayMode display_mode_override = 22; + // Deprecated 9/28/2020. A list of display modes specified in app manifest. + // TODO (crbug.com/1092667): Replace with RESERVED + repeated DisplayMode deprecated_display_mode_override = 22 + [deprecated = true]; // A list of icon sizes we successfully downloaded to store on disk, for icons // that are designed for masking (ie. IconPurpose::MASKABLE). See also:
diff --git a/chrome/browser/web_applications/system_web_app_manager_browsertest.cc b/chrome/browser/web_applications/system_web_app_manager_browsertest.cc index c9ee880..0c1f12a 100644 --- a/chrome/browser/web_applications/system_web_app_manager_browsertest.cc +++ b/chrome/browser/web_applications/system_web_app_manager_browsertest.cc
@@ -400,9 +400,7 @@ } scoped_feature_blink_api_.InitWithFeatures( - {blink::features::kNativeFileSystemAPI, - blink::features::kFileHandlingAPI}, - {}); + {blink::features::kFileHandlingAPI}, {}); maybe_installation_ = TestSystemWebAppInstallation::SetUpAppThatReceivesLaunchFiles(
diff --git a/chrome/browser/web_applications/test/web_app_registration_waiter.cc b/chrome/browser/web_applications/test/web_app_registration_waiter.cc index 251b4ed..84c0c53 100644 --- a/chrome/browser/web_applications/test/web_app_registration_waiter.cc +++ b/chrome/browser/web_applications/test/web_app_registration_waiter.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/web_applications/test/web_app_registration_waiter.h" #include "base/test/bind_test_util.h" +#include "testing/gtest/include/gtest/gtest.h" namespace web_app { @@ -12,8 +13,11 @@ : manager_(manager) { manager_->SetRegistrationCallbackForTesting(base::BindLambdaForTesting( [this](const GURL& install_url, RegistrationResultCode code) { - CHECK_EQ(install_url_, install_url); - CHECK_EQ(code_, code); + ASSERT_EQ(install_url_, install_url); + if (code_) + ASSERT_EQ(code_, code); + else + ASSERT_NE(code, RegistrationResultCode::kTimeout); run_loop_.Quit(); })); manager_->SetRegistrationsCompleteCallbackForTesting( @@ -32,6 +36,13 @@ run_loop_.Run(); } +void WebAppRegistrationWaiter::AwaitNextNonFailedRegistration( + const GURL& install_url) { + install_url_ = install_url; + code_ = base::nullopt; + run_loop_.Run(); +} + void WebAppRegistrationWaiter::AwaitRegistrationsComplete() { complete_run_loop_.Run(); }
diff --git a/chrome/browser/web_applications/test/web_app_registration_waiter.h b/chrome/browser/web_applications/test/web_app_registration_waiter.h index f22d452..9f6dc14 100644 --- a/chrome/browser/web_applications/test/web_app_registration_waiter.h +++ b/chrome/browser/web_applications/test/web_app_registration_waiter.h
@@ -19,13 +19,16 @@ void AwaitNextRegistration(const GURL& install_url, RegistrationResultCode code); + void AwaitNextNonFailedRegistration(const GURL& install_url); + void AwaitRegistrationsComplete(); private: PendingAppManager* const manager_; base::RunLoop run_loop_; GURL install_url_; - RegistrationResultCode code_; + // If unset then check for any non failure result. + base::Optional<RegistrationResultCode> code_; base::RunLoop complete_run_loop_; };
diff --git a/chrome/browser/web_applications/web_app_database.cc b/chrome/browser/web_applications/web_app_database.cc index 89743aa3..41d59d6 100644 --- a/chrome/browser/web_applications/web_app_database.cc +++ b/chrome/browser/web_applications/web_app_database.cc
@@ -166,7 +166,7 @@ } for (const DisplayMode& display_mode : web_app.display_mode_override()) { - local_data->add_display_mode_override( + local_data->add_deprecated_display_mode_override( ToWebAppProtoDisplayMode(display_mode)); } @@ -404,8 +404,9 @@ web_app->SetDisplayMode(ToMojomDisplayMode(local_data.display_mode())); std::vector<DisplayMode> display_mode_override; - for (int i = 0; i < local_data.display_mode_override_size(); i++) { - WebAppProto::DisplayMode display_mode = local_data.display_mode_override(i); + for (int i = 0; i < local_data.deprecated_display_mode_override_size(); i++) { + WebAppProto::DisplayMode display_mode = + local_data.deprecated_display_mode_override(i); display_mode_override.push_back(ToMojomDisplayMode(display_mode)); } web_app->SetDisplayModeOverride(std::move(display_mode_override));
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 98ceb1d..8b0262cb 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-master-1601380366-03c4c1b9f0c0034a1b47d4510e955a5823e9948c.profdata +chrome-linux-master-1601423519-160c1675b60a0784f3486044879abd6ac9140863.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 1b99a0a0..6c4d3d5f 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-master-1601380366-c2cef07ee462371a6daba327da84ce5730b353c6.profdata +chrome-mac-master-1601423519-0313967a598efe443ce9d62f0d47f5b337e79203.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 5e687d70..34659e12 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-master-1601304808-a0959ded2b2639d64197cdec426ae296818dc3ae.profdata +chrome-win64-master-1601358844-5f86e8497cfc6487ab81eec807b8b1aeda6b4d6d.profdata
diff --git a/chrome/common/profiler/stack_sampling_browsertest.cc b/chrome/common/profiler/thread_profiler_browsertest.cc similarity index 92% rename from chrome/common/profiler/stack_sampling_browsertest.cc rename to chrome/common/profiler/thread_profiler_browsertest.cc index 99b2bfb..0abf97d 100644 --- a/chrome/common/profiler/stack_sampling_browsertest.cc +++ b/chrome/common/profiler/thread_profiler_browsertest.cc
@@ -106,7 +106,7 @@ profile.process() == process && profile.thread() == thread; } -class StackSamplingBrowserTest : public PlatformBrowserTest { +class ThreadProfilerBrowserTest : public PlatformBrowserTest { public: void SetUp() override { // Arrange to intercept the CPU profiles at the time they're provided to the @@ -173,56 +173,56 @@ // processes/threads. We've seen multiple breakages previously where profiles // were dropped as a result of bugs introduced by mojo refactorings. -IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, BrowserProcessMainThread) { +IN_PROC_BROWSER_TEST_F(ThreadProfilerBrowserTest, BrowserProcessMainThread) { if (ShouldSkipTestForMacOS11()) GTEST_SKIP() << "Stack sampler is not supported on macOS 11."; EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP, metrics::BROWSER_PROCESS, metrics::MAIN_THREAD)); } -IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, BrowserProcessIOThread) { +IN_PROC_BROWSER_TEST_F(ThreadProfilerBrowserTest, BrowserProcessIOThread) { if (ShouldSkipTestForMacOS11()) GTEST_SKIP() << "Stack sampler is not supported on macOS 11."; EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP, metrics::BROWSER_PROCESS, metrics::IO_THREAD)); } -IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, GpuProcessMainThread) { +IN_PROC_BROWSER_TEST_F(ThreadProfilerBrowserTest, GpuProcessMainThread) { if (ShouldSkipTestForMacOS11()) GTEST_SKIP() << "Stack sampler is not supported on macOS 11."; EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP, metrics::GPU_PROCESS, metrics::MAIN_THREAD)); } -IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, GpuProcessIOThread) { +IN_PROC_BROWSER_TEST_F(ThreadProfilerBrowserTest, GpuProcessIOThread) { if (ShouldSkipTestForMacOS11()) GTEST_SKIP() << "Stack sampler is not supported on macOS 11."; EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP, metrics::GPU_PROCESS, metrics::IO_THREAD)); } -IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, GpuProcessCompositorThread) { +IN_PROC_BROWSER_TEST_F(ThreadProfilerBrowserTest, GpuProcessCompositorThread) { if (ShouldSkipTestForMacOS11()) GTEST_SKIP() << "Stack sampler is not supported on macOS 11."; EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP, metrics::GPU_PROCESS, metrics::COMPOSITOR_THREAD)); } -IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, RendererProcessMainThread) { +IN_PROC_BROWSER_TEST_F(ThreadProfilerBrowserTest, RendererProcessMainThread) { if (ShouldSkipTestForMacOS11()) GTEST_SKIP() << "Stack sampler is not supported on macOS 11."; EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP, metrics::RENDERER_PROCESS, metrics::MAIN_THREAD)); } -IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, RendererProcessIOThread) { +IN_PROC_BROWSER_TEST_F(ThreadProfilerBrowserTest, RendererProcessIOThread) { if (ShouldSkipTestForMacOS11()) GTEST_SKIP() << "Stack sampler is not supported on macOS 11."; EXPECT_TRUE(WaitForProfile(metrics::SampledProfile::PROCESS_STARTUP, metrics::RENDERER_PROCESS, metrics::IO_THREAD)); } -IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, +IN_PROC_BROWSER_TEST_F(ThreadProfilerBrowserTest, RendererProcessCompositorThread) { if (ShouldSkipTestForMacOS11()) GTEST_SKIP() << "Stack sampler is not supported on macOS 11."; @@ -238,7 +238,7 @@ #else #define MAYBE_NetworkServiceProcessIOThread NetworkServiceProcessIOThread #endif -IN_PROC_BROWSER_TEST_F(StackSamplingBrowserTest, +IN_PROC_BROWSER_TEST_F(ThreadProfilerBrowserTest, MAYBE_NetworkServiceProcessIOThread) { if (ShouldSkipTestForMacOS11()) GTEST_SKIP() << "Stack sampler is not supported on macOS 11.";
diff --git a/chrome/common/profiler/thread_profiler_configuration.cc b/chrome/common/profiler/thread_profiler_configuration.cc index cb4038f..f8c71b69 100644 --- a/chrome/common/profiler/thread_profiler_configuration.cc +++ b/chrome/common/profiler/thread_profiler_configuration.cc
@@ -232,20 +232,18 @@ break; } - switch (chrome::GetChannel()) { - // Enable the profiler unconditionally for development/waterfall builds. - case version_info::Channel::UNKNOWN: - return PROFILE_ENABLED; - -#if (defined(OS_WIN) && defined(ARCH_CPU_X86_64)) || defined(OS_MAC) - case version_info::Channel::CANARY: - case version_info::Channel::DEV: - return ChooseConfiguration({{PROFILE_ENABLED, 80}, - {PROFILE_CONTROL, 10}, - {PROFILE_DISABLED, 10}}); -#endif - - default: - return PROFILE_DISABLED; + ThreadProfilerPlatformConfiguration::RelativePopulations + relative_populations = platform_configuration.GetEnableRates( + BUILDFLAG(GOOGLE_CHROME_BRANDING), channel); + if (relative_populations.enabled == 0 && + relative_populations.experiment == 0) { + return PROFILE_DISABLED; } + + CHECK_EQ(0, relative_populations.experiment % 2); + return ChooseConfiguration({ + {PROFILE_ENABLED, relative_populations.enabled}, + {PROFILE_CONTROL, relative_populations.experiment / 2}, + {PROFILE_DISABLED, relative_populations.experiment / 2}, + }); }
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration.cc b/chrome/common/profiler/thread_profiler_platform_configuration.cc index 8118d2d..0465f0c0af 100644 --- a/chrome/common/profiler/thread_profiler_platform_configuration.cc +++ b/chrome/common/profiler/thread_profiler_platform_configuration.cc
@@ -27,6 +27,10 @@ bool is_chrome_branded, version_info::Channel channel) const override; + RelativePopulations GetEnableRates( + bool is_chrome_branded, + version_info::Channel channel) const override; + protected: bool IsSupportedForChannel(bool is_chrome_branded, version_info::Channel channel) const override; @@ -48,6 +52,26 @@ return RuntimeModuleState::kModuleNotRequired; } +ThreadProfilerPlatformConfiguration::RelativePopulations +DefaultPlatformConfiguration::GetEnableRates( + bool is_chrome_branded, + version_info::Channel channel) const { + // TODO(https://crbug.com/1129939): Make this logic consistent with + // IsSupportedForChannel() for identifying local/CQ builds. + switch (channel) { + // Enable the profiler unconditionally for development/waterfall builds. + case version_info::Channel::UNKNOWN: + return RelativePopulations{100, 0}; + + case version_info::Channel::CANARY: + case version_info::Channel::DEV: + return RelativePopulations{80, 20}; + + default: + return RelativePopulations{0, 0}; + } +} + bool DefaultPlatformConfiguration::IsSupportedForChannel( bool is_chrome_branded, version_info::Channel channel) const {
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration.h b/chrome/common/profiler/thread_profiler_platform_configuration.h index 95479798..d6dba27 100644 --- a/chrome/common/profiler/thread_profiler_platform_configuration.h +++ b/chrome/common/profiler/thread_profiler_platform_configuration.h
@@ -36,6 +36,17 @@ kModuleNotAvailable, // A module is necessary but not available. }; + // The relative populations to use for enabling/disabling the profiler. + // |enabled| + |experiment| is expected to equal 100. Profiling is to be + // enabled with probability |enabled|/100. The fraction |experiment|/100 is to + // be split in to two equal-sized experiment groups with probability + // |experiment|/(2 * 100), one of which will be enabled and one disabled. As a + // special case {0, 0} means always disable. + struct RelativePopulations { + int enabled; + int experiment; + }; + virtual ~ThreadProfilerPlatformConfiguration() = default; // Create the platform configuration. @@ -57,6 +68,13 @@ // GetRuntimeModuleState() returns kModuleAbsentButAvailable. virtual void RequestRuntimeModuleInstall() const {} + // Returns the relative population disposition for the channel/chrome branding + // on the platform. See the documentation on RelativePopulations. Enable rates + // are valid only if IsSupported(). + virtual RelativePopulations GetEnableRates( + bool is_chrome_branded, + version_info::Channel channel) const = 0; + protected: // True if the profiler is to be run for the channel/chrome branding on the // platform. Does not need to check whether the StackSamplingProfiler is
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc b/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc index 1b09af2..515cec7 100644 --- a/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc +++ b/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc
@@ -17,6 +17,14 @@ #define THREAD_PROFILER_SUPPORTED_ON_PLATFORM false #endif +#if THREAD_PROFILER_SUPPORTED_ON_PLATFORM +#define MAYBE_PLATFORM_CONFIG_TEST_F(suite, test) TEST_F(suite, test) +#else +#define MAYBE_PLATFORM_CONFIG_TEST_F(suite, test) TEST_F(suite, DISABLED_##test) +#endif + +namespace { + class ThreadProfilerPlatformConfigurationTest : public ::testing::Test { public: // The browser_test_mode_enabled=true scenario is already covered by the @@ -33,11 +41,22 @@ const std::unique_ptr<ThreadProfilerPlatformConfiguration> config_; }; -#if THREAD_PROFILER_SUPPORTED_ON_PLATFORM -#define MAYBE_PLATFORM_CONFIG_TEST_F(suite, test) TEST_F(suite, test) -#else -#define MAYBE_PLATFORM_CONFIG_TEST_F(suite, test) TEST_F(suite, DISABLED_##test) -#endif +} // namespace + +// Glue functions to make RelativePopulations work with googletest. +std::ostream& operator<<( + std::ostream& strm, + const ThreadProfilerPlatformConfiguration::RelativePopulations& + populations) { + return strm << "{" << populations.enabled << ", " << populations.experiment + << "}"; +} + +bool operator==( + const ThreadProfilerPlatformConfiguration::RelativePopulations& a, + const ThreadProfilerPlatformConfiguration::RelativePopulations& b) { + return a.enabled == b.enabled && a.experiment == b.experiment; +} TEST_F(ThreadProfilerPlatformConfigurationTest, IsSupported) { #if !THREAD_PROFILER_SUPPORTED_ON_PLATFORM @@ -131,3 +150,28 @@ version_info::Channel::UNKNOWN)); #endif } + +MAYBE_PLATFORM_CONFIG_TEST_F(ThreadProfilerPlatformConfigurationTest, + GetEnableRates) { + using RelativePopulations = + ThreadProfilerPlatformConfiguration::RelativePopulations; + EXPECT_EQ((RelativePopulations{100, 0}), + config()->GetEnableRates(/*is_chrome_branded=*/true, + version_info::Channel::UNKNOWN)); + EXPECT_EQ((RelativePopulations{80, 20}), + config()->GetEnableRates(/*is_chrome_branded=*/true, + version_info::Channel::CANARY)); + EXPECT_EQ((RelativePopulations{80, 20}), + config()->GetEnableRates(/*is_chrome_branded=*/true, + version_info::Channel::DEV)); + EXPECT_EQ((RelativePopulations{0, 0}), + config()->GetEnableRates(/*is_chrome_branded=*/true, + version_info::Channel::BETA)); + EXPECT_EQ((RelativePopulations{0, 0}), + config()->GetEnableRates(/*is_chrome_branded=*/true, + version_info::Channel::STABLE)); + + EXPECT_EQ((RelativePopulations{100, 0}), + config()->GetEnableRates(/*is_chrome_branded=*/true, + version_info::Channel::UNKNOWN)); +}
diff --git a/chrome/services/sharing/nearby/platform_v2/condition_variable_unittest.cc b/chrome/services/sharing/nearby/platform_v2/condition_variable_unittest.cc index e729b45..dd813d4 100644 --- a/chrome/services/sharing/nearby/platform_v2/condition_variable_unittest.cc +++ b/chrome/services/sharing/nearby/platform_v2/condition_variable_unittest.cc
@@ -87,7 +87,7 @@ } TEST_F(ConditionVariableTest, - MultipleSequences_BlocksOnWaitAndUnblocksOnNotify) { + DISABLED_MultipleSequences_BlocksOnWaitAndUnblocksOnNotify) { base::RunLoop run_loop_1; base::UnguessableToken attempt_id_1 = base::UnguessableToken::Create(); WaitOnConditionVariableFromParallelSequence(run_loop_1, attempt_id_1);
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 07c059f..e20bfa09 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -556,7 +556,7 @@ # "strip_debug" config that strips the debug info, on android_browsertests # apk. if (enable_arm_cfi_table) { - sources += [ "../common/profiler/stack_sampling_browsertest.cc" ] + sources += [ "../common/profiler/thread_profiler_browsertest.cc" ] deps += [ "//chrome/android/modules/stack_unwinder/internal:java", "//chrome/android/modules/stack_unwinder/internal:stack_unwinder_for_testing", @@ -2840,7 +2840,7 @@ "../browser/ui/cocoa/task_manager_mac_browsertest.mm", "../browser/ui/cocoa/touchbar/browser_window_touch_bar_controller_browsertest.mm", "../browser/ui/views/frame/browser_non_client_frame_view_mac_browsertest.cc", - "../common/profiler/stack_sampling_browsertest.cc", + "../common/profiler/thread_profiler_browsertest.cc", # TODO(crbug/845389): Re-Enable the following, which were temporarily # omitted from the build, but are still in use. @@ -2877,7 +2877,7 @@ ] if (target_cpu == "x64") { - sources += [ "../common/profiler/stack_sampling_browsertest.cc" ] + sources += [ "../common/profiler/thread_profiler_browsertest.cc" ] } configs += [ "//build/config/win:delayloads" ] @@ -4193,6 +4193,7 @@ "//chrome/browser/optimization_guide/android:native_j_unittests_jni_headers", "//chrome/browser/optimization_guide/android:native_java_unittests", "//chrome/browser/password_check/android:unit_tests", + "//chrome/browser/reading_list/android:unit_tests", "//chrome/browser/thumbnail:unit_tests", "//chrome/browser/updates:unit_tests", "//chrome/services/media_gallery_util:unit_tests",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java index 94fc40d..388e8e3 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeActivityTestRule.java
@@ -95,11 +95,11 @@ @Rule private EmbeddedTestServerRule mTestServerRule = new EmbeddedTestServerRule(); - public ChromeActivityTestRule(Class<T> activityClass) { + protected ChromeActivityTestRule(Class<T> activityClass) { this(activityClass, false); } - public ChromeActivityTestRule(Class<T> activityClass, boolean initialTouchMode) { + protected ChromeActivityTestRule(Class<T> activityClass, boolean initialTouchMode) { super(activityClass, initialTouchMode, false); mChromeActivityClass = activityClass; }
diff --git a/chrome/test/android/test_support/src/org/chromium/chrome/test_support/PaymentRequestTestBridge.java b/chrome/test/android/test_support/src/org/chromium/chrome/test_support/PaymentRequestTestBridge.java index b1c99d1..c852251 100644 --- a/chrome/test/android/test_support/src/org/chromium/chrome/test_support/PaymentRequestTestBridge.java +++ b/chrome/test/android/test_support/src/org/chromium/chrome/test_support/PaymentRequestTestBridge.java
@@ -230,6 +230,11 @@ } @CalledByNative + private static boolean clickPaymentHandlerCloseButtonForTest() { + return PaymentRequestImpl.clickPaymentHandlerCloseButtonForTest(); + } + + @CalledByNative private static boolean confirmMinimalUIForTest() { return PaymentRequestImpl.confirmMinimalUIForTest(); }
diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc index 4799982..872b49e 100644 --- a/chrome/test/chromedriver/chrome_launcher.cc +++ b/chrome/test/chromedriver/chrome_launcher.cc
@@ -473,11 +473,11 @@ #if defined(OS_WIN) // EnvironmentMap uses wide string - options.environment[L"CHROME_HEADLESS"] = 1; + options.environment[L"CHROME_HEADLESS"] = L"1"; options.environment[L"BREAKPAD_DUMP_LOCATION"] = base::SysUTF8ToWide(capabilities.minidump_path); #else - options.environment["CHROME_HEADLESS"] = 1; + options.environment["CHROME_HEADLESS"] = "1"; options.environment["BREAKPAD_DUMP_LOCATION"] = capabilities.minidump_path; #endif
diff --git a/chrome/test/data/pdf/bookmarks_test.js b/chrome/test/data/pdf/bookmarks_test.js index ca5d223..d3440fb 100644 --- a/chrome/test/data/pdf/bookmarks_test.js +++ b/chrome/test/data/pdf/bookmarks_test.js
@@ -76,10 +76,13 @@ const rootBookmarks = /** @type {!NodeList<!ViewerBookmarkElement>} */ ( bookmarkContent.shadowRoot.querySelectorAll('viewer-bookmark')); chrome.test.assertEq(3, rootBookmarks.length, 'three root bookmarks'); - rootBookmarks[0].$.expand.click(); + const expandButton = rootBookmarks[0].$.expand; + chrome.test.assertEq('false', expandButton.getAttribute('aria-expanded')); + expandButton.click(); flush(); + chrome.test.assertEq('true', expandButton.getAttribute('aria-expanded')); const subBookmarks = /** @type {!NodeList<!ViewerBookmarkElement>} */ ( rootBookmarks[0].shadowRoot.querySelectorAll('viewer-bookmark')); chrome.test.assertEq(1, subBookmarks.length, 'one sub bookmark');
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index f6e45a1..0fcc53d 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -8208,5 +8208,14 @@ "prefs": { "webrtc.allow_legacy_tls_protocols": {} } } ] + }, + "MediaRecommendationsEnabled": { + "os": ["win", "linux", "mac", "chromeos"], + "policy_pref_mapping_test": [ + { + "policies": { "MediaRecommendationsEnabled": false }, + "prefs": { "kaleidoscope.enabled_by_policy": { } } + } + ] } }
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index bd46696..59171a8 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -82,8 +82,6 @@ "cr_components/cr_components_v3_browsertest.js", "cr_elements/cr_elements_browsertest.js", "cr_elements/cr_elements_v3_browsertest.js", - "find_shortcut_behavior_browsertest.js", - "find_shortcut_behavior_v3_browsertest.js", "histograms/histograms_internals_ui_browsertest.js", "history/history_browsertest.js", "js/webui_resource_module_async_browsertest.js", @@ -218,8 +216,8 @@ "$root_gen_dir/chrome/test/data/webui/cr_elements/cr_toast_test.m.js", "$root_gen_dir/chrome/test/data/webui/cr_elements/cr_toolbar_tests.m.js", "$root_gen_dir/chrome/test/data/webui/cr_elements/cr_view_manager_test.m.js", + "$root_gen_dir/chrome/test/data/webui/cr_elements/find_shortcut_behavior_test.m.js", "$root_gen_dir/chrome/test/data/webui/fake_chrome_event.m.js", - "$root_gen_dir/chrome/test/data/webui/find_shortcut_behavior_test.m.js", "$root_gen_dir/chrome/test/data/webui/mock_controller.m.js", "$root_gen_dir/chrome/test/data/webui/mock_timer.m.js", "$root_gen_dir/chrome/test/data/webui/resources/list_property_update_behavior_tests.m.js", @@ -448,7 +446,6 @@ input_files = [ "cr_focus_row_behavior_test.js", "fake_chrome_event.js", - "find_shortcut_behavior_test.js", "mock_controller.js", "mock_timer.js", "test_browser_proxy.js",
diff --git a/chrome/test/data/webui/cr_elements/BUILD.gn b/chrome/test/data/webui/cr_elements/BUILD.gn index d7ddf40..3354457 100644 --- a/chrome/test/data/webui/cr_elements/BUILD.gn +++ b/chrome/test/data/webui/cr_elements/BUILD.gn
@@ -39,6 +39,7 @@ "cr_toast_manager_test.js", "cr_toggle_test.js", "cr_view_manager_test.js", + "find_shortcut_behavior_test.js", "iron_list_focus_test.js", ] namespace_rewrites = test_namespace_rewrites + [ "Polymer.Base|Base" ]
diff --git a/chrome/test/data/webui/cr_elements/cr_elements_browsertest.js b/chrome/test/data/webui/cr_elements/cr_elements_browsertest.js index 3a56a01..2047cf2ed9 100644 --- a/chrome/test/data/webui/cr_elements/cr_elements_browsertest.js +++ b/chrome/test/data/webui/cr_elements/cr_elements_browsertest.js
@@ -543,6 +543,33 @@ mocha.run(); }); +/** + * @constructor + * @extends {CrElementsBrowserTest} + */ +function CrElementsFindShortcutBehaviorTest() {} + +CrElementsFindShortcutBehaviorTest.prototype = { + __proto__: CrElementsBrowserTest.prototype, + + /** + * Preload a module that depends on both cr-dialog and FindShortcutBehavior. + * cr-dialog is used in the tests. + * @override + */ + browsePreload: 'chrome://resources/cr_elements/find_shortcut_behavior.html', + + /** @override */ + extraLibraries: CrElementsBrowserTest.prototype.extraLibraries.concat([ + '../test_util.js', + 'find_shortcut_behavior_test.js', + ]), +}; + +TEST_F('CrElementsFindShortcutBehaviorTest', 'All', function() { + mocha.run(); +}); + GEN('#if defined(OS_CHROMEOS)'); /** * @constructor
diff --git a/chrome/test/data/webui/cr_elements/cr_elements_v3_browsertest.js b/chrome/test/data/webui/cr_elements/cr_elements_v3_browsertest.js index e0c9228..3f9287c 100644 --- a/chrome/test/data/webui/cr_elements/cr_elements_v3_browsertest.js +++ b/chrome/test/data/webui/cr_elements/cr_elements_v3_browsertest.js
@@ -102,6 +102,19 @@ }); // eslint-disable-next-line no-var +var CrElementsFindShortcutBehaviorV3Test = + class extends CrElementsV3BrowserTest { + /** @override */ + get browsePreload() { + return 'chrome://test?module=cr_elements/find_shortcut_behavior_test.m.js'; + } +}; + +TEST_F('CrElementsFindShortcutBehaviorV3Test', 'All', function() { + mocha.run(); +}); + +// eslint-disable-next-line no-var var CrElementsFingerprintProgressArcV3Test = class extends CrElementsV3BrowserTest { /** @override */
diff --git a/chrome/test/data/webui/find_shortcut_behavior_test.js b/chrome/test/data/webui/cr_elements/find_shortcut_behavior_test.js similarity index 99% rename from chrome/test/data/webui/find_shortcut_behavior_test.js rename to chrome/test/data/webui/cr_elements/find_shortcut_behavior_test.js index 8ce91e9c..69b6beaa 100644 --- a/chrome/test/data/webui/find_shortcut_behavior_test.js +++ b/chrome/test/data/webui/cr_elements/find_shortcut_behavior_test.js
@@ -6,7 +6,7 @@ // #import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; // #import {assert} from 'chrome://resources/js/assert.m.js'; // #import {eventToPromise} from 'chrome://test/test_util.m.js'; -// #import {FindShortcutBehavior, FindShortcutManager} from 'chrome://resources/js/find_shortcut_behavior.m.js'; +// #import {FindShortcutBehavior, FindShortcutManager} from 'chrome://resources/cr_elements/find_shortcut_behavior.m.js'; // #import {isMac} from 'chrome://resources/js/cr.m.js'; // #import {Polymer, html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; // #import {pressAndReleaseKeyOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js';
diff --git a/chrome/test/data/webui/find_shortcut_behavior_browsertest.js b/chrome/test/data/webui/find_shortcut_behavior_browsertest.js deleted file mode 100644 index 2263ee9..0000000 --- a/chrome/test/data/webui/find_shortcut_behavior_browsertest.js +++ /dev/null
@@ -1,38 +0,0 @@ -// Copyright 2018 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. - -// Polymer BrowserTest fixture. -GEN_INCLUDE(['//chrome/test/data/webui/polymer_browser_test_base.js']); - -GEN('#include "content/public/test/browser_test.h"'); - -/** - * Test fixture for FindShortcutBehavior. - * @constructor - * @extends {PolymerTest} - */ -function FindShortcutBehaviorTest() {} - -FindShortcutBehaviorTest.prototype = { - __proto__: PolymerTest.prototype, - - /** - * Preload a module that depends on both cr-dialog and FindShortcutBehavior. - * cr-dialog is used in the tests. - * @override - */ - browsePreload: 'chrome://resources/html/find_shortcut_behavior.html', - - /** @override */ - extraLibraries: [ - ...PolymerTest.prototype.extraLibraries, - '//ui/webui/resources/js/util.js', - 'test_util.js', - 'find_shortcut_behavior_test.js', - ], -}; - -TEST_F('FindShortcutBehaviorTest', 'All', function() { - mocha.run(); -});
diff --git a/chrome/test/data/webui/find_shortcut_behavior_v3_browsertest.js b/chrome/test/data/webui/find_shortcut_behavior_v3_browsertest.js deleted file mode 100644 index 9b435aad..0000000 --- a/chrome/test/data/webui/find_shortcut_behavior_v3_browsertest.js +++ /dev/null
@@ -1,37 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Polymer BrowserTest fixture. -GEN_INCLUDE(['//chrome/test/data/webui/polymer_browser_test_base.js']); - -GEN('#include "content/public/test/browser_test.h"'); - -/** - * Test fixture for FindShortcutBehavior. - * @constructor - * @extends {PolymerTest} - */ -var FindShortcutBehaviorV3Test = class extends PolymerTest { - /** @override */ - get browsePreload() { - return 'chrome://test?module=find_shortcut_behavior_test.m.js'; - } - - /** @override */ - get webuiHost() { - return 'dummyurl'; - } - - /** @override */ - get extraLibraries() { - return [ - '//third_party/mocha/mocha.js', - '//chrome/test/data/webui/mocha_adapter.js', - ]; - } -}; - -TEST_F('FindShortcutBehaviorV3Test', 'All', function() { - mocha.run(); -});
diff --git a/chrome/test/data/webui/settings/chromeos/input_page_test.js b/chrome/test/data/webui/settings/chromeos/input_page_test.js index a615ed4..02dede0 100644 --- a/chrome/test/data/webui/settings/chromeos/input_page_test.js +++ b/chrome/test/data/webui/settings/chromeos/input_page_test.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. // clang-format off -// #import {LanguagesBrowserProxyImpl, LanguagesMetricsProxyImpl} from 'chrome://os-settings/chromeos/lazy_load.js'; +// #import {LanguagesBrowserProxyImpl, LanguagesMetricsProxyImpl, LanguagesPageInteraction} from 'chrome://os-settings/chromeos/lazy_load.js'; // #import {CrSettingsPrefs, Router, routes} from 'chrome://os-settings/chromeos/os_settings.js'; // #import {keyDownOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; // #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -410,6 +410,18 @@ await metricsProxy.whenCalled('recordAddInputMethod'); }); + + test('when switch input method', async () => { + const inputMethodsList = inputPage.$$('#inputMethodsList'); + assertTrue(!!inputMethodsList); + + // The test input methods should appear. + const items = inputMethodsList.querySelectorAll('.list-item'); + items[0].click(); + assertEquals( + settings.LanguagesPageInteraction.SWITCH_INPUT_METHOD, + await metricsProxy.whenCalled('recordInteraction')); + }); }); suite('spell check', () => {
diff --git a/chrome/test/data/webui/settings/fake_input_method_private.js b/chrome/test/data/webui/settings/fake_input_method_private.js index 3b4c3c81..95e09aa 100644 --- a/chrome/test/data/webui/settings/fake_input_method_private.js +++ b/chrome/test/data/webui/settings/fake_input_method_private.js
@@ -20,6 +20,8 @@ callback(null); }, + setCurrentInputMethod: () => {}, + get onChanged() { return { addListener: function() {
diff --git a/chrome/test/data/webui/settings/site_details_tests.js b/chrome/test/data/webui/settings/site_details_tests.js index 8be1020..76e4c3f 100644 --- a/chrome/test/data/webui/settings/site_details_tests.js +++ b/chrome/test/data/webui/settings/site_details_tests.js
@@ -220,9 +220,6 @@ .WINDOW_PLACEMENT] = 'enableExperimentalWebPlatformFeatures'; optionalSiteDetailsContentSettingsTypes[ContentSettingsTypes - .FILE_SYSTEM_WRITE] = - 'enableFileSystemWriteContentSetting'; - optionalSiteDetailsContentSettingsTypes[ContentSettingsTypes .PAYMENT_HANDLER] = 'enablePaymentHandlerContentSetting'; optionalSiteDetailsContentSettingsTypes[ContentSettingsTypes.ADS] = @@ -236,7 +233,6 @@ const controlledSettingsCount = /** @type{string : int } */ ({}); controlledSettingsCount['enableExperimentalWebPlatformFeatures'] = 2; - controlledSettingsCount['enableFileSystemWriteContentSetting'] = 1; controlledSettingsCount['enableFontAccessContentSetting'] = 1; controlledSettingsCount['enablePaymentHandlerContentSetting'] = 1; controlledSettingsCount['enableSafeBrowsingSubresourceFilter'] = 1;
diff --git a/chrome/test/payments/android/payment_request_test_bridge.cc b/chrome/test/payments/android/payment_request_test_bridge.cc index f081f78a..65188083 100644 --- a/chrome/test/payments/android/payment_request_test_bridge.cc +++ b/chrome/test/payments/android/payment_request_test_bridge.cc
@@ -43,6 +43,12 @@ env); } +bool ClickPaymentHandlerCloseButtonForTest() { + JNIEnv* env = base::android::AttachCurrentThread(); + return Java_PaymentRequestTestBridge_clickPaymentHandlerCloseButtonForTest( + env); +} + bool ConfirmMinimalUIForTest() { return Java_PaymentRequestTestBridge_confirmMinimalUIForTest( base::android::AttachCurrentThread());
diff --git a/chrome/test/payments/android/payment_request_test_bridge.h b/chrome/test/payments/android/payment_request_test_bridge.h index 07a28649..2bef9a1c 100644 --- a/chrome/test/payments/android/payment_request_test_bridge.h +++ b/chrome/test/payments/android/payment_request_test_bridge.h
@@ -29,15 +29,20 @@ bool skip_ui_for_basic_card, const std::string& twa_package_name); -// Get the WebContents of the Expandable Payment Handler for testing purpose, or -// null if nonexistent. To guarantee a non-null return, this function should be -// called only if: 1) PaymentRequest UI is opening. 2) +// Gets the WebContents of the Expandable Payment Handler for testing purpose, +// or null if nonexistent. To guarantee a non-null return, this function should +// be called only if: 1) PaymentRequest UI is opening. 2) // ScrollToExpandPaymentHandler feature is enabled. 3) PaymentHandler is // opening. content::WebContents* GetPaymentHandlerWebContentsForTest(); +// Simulates a click on the security icon of the Payment Handler UI. Returns +// true on success. bool ClickPaymentHandlerSecurityIconForTest(); +// Click the close button on the Payment Handler UI. Returns true on success. +bool ClickPaymentHandlerCloseButtonForTest(); + // Confirms payment in minimal UI. Returns true on success. bool ConfirmMinimalUIForTest();
diff --git a/chrome/test/payments/payment_request_test_controller.h b/chrome/test/payments/payment_request_test_controller.h index 4c36569..536e67f 100644 --- a/chrome/test/payments/payment_request_test_controller.h +++ b/chrome/test/payments/payment_request_test_controller.h
@@ -73,18 +73,22 @@ void SetTwaPaymentApp(const std::string& method_name, const std::string& response); - // Get the WebContents of the Payment Handler for testing purpose, or null if + // Gets the WebContents of the Payment Handler for testing purpose, or null if // nonexistent. To guarantee a non-null return, this function should be called // only if: 1) PaymentRequest UI is opening. 2) ScrollToExpandPaymentHandler // feature is enabled (on Android). 3) PaymentHandler is opening. content::WebContents* GetPaymentHandlerWebContents(); #if defined(OS_ANDROID) - // Click the security icon on the Expandable Payment Handler toolbar for - // testing purpose. return whether it's succeeded. + // Clicks the security icon on the Expandable Payment Handler toolbar for + // testing purpose. Return whether it's succeeded. bool ClickPaymentHandlerSecurityIcon(); #endif + // Clicks the close button on the Payment Handler toolbar for testing purpose. + // Return whether it's succeeded. + bool ClickPaymentHandlerCloseButton(); + // Confirms payment in a browser payment sheet, be it either PAYMENT_REQUEST // or SECURE_PAYMENT_CONFIRMATION type. Returns true if the dialog was // available.
diff --git a/chrome/test/payments/payment_request_test_controller_android.cc b/chrome/test/payments/payment_request_test_controller_android.cc index 24ab066..606120cc 100644 --- a/chrome/test/payments/payment_request_test_controller_android.cc +++ b/chrome/test/payments/payment_request_test_controller_android.cc
@@ -24,6 +24,10 @@ return ClickPaymentHandlerSecurityIconForTest(); } +bool PaymentRequestTestController::ClickPaymentHandlerCloseButton() { + return ClickPaymentHandlerCloseButtonForTest(); +} + bool PaymentRequestTestController::ConfirmPayment() { NOTIMPLEMENTED(); return false;
diff --git a/chrome/test/payments/payment_request_test_controller_desktop.cc b/chrome/test/payments/payment_request_test_controller_desktop.cc index 785c45a..adf8b06 100644 --- a/chrome/test/payments/payment_request_test_controller_desktop.cc +++ b/chrome/test/payments/payment_request_test_controller_desktop.cc
@@ -155,6 +155,18 @@ return true; } +bool PaymentRequestTestController::ClickPaymentHandlerCloseButton() { + if (!delegate_) + return false; + + PaymentRequestDialog* dialog = delegate_->GetDialogForTesting(); + if (!dialog) + return false; + + dialog->CloseDialog(); + return true; +} + bool PaymentRequestTestController::ConfirmMinimalUI() { // Desktop does not have a minimal UI. return true;
diff --git a/chrome/updater/BUILD.gn b/chrome/updater/BUILD.gn index 2e2e07b..eaa276a 100644 --- a/chrome/updater/BUILD.gn +++ b/chrome/updater/BUILD.gn
@@ -156,6 +156,7 @@ "prefs_win.cc", "service_factory_win.cc", "setup_win.cc", + "win/wrl_module.h", ] } @@ -199,7 +200,10 @@ if (is_win) { configs -= [ "//build/config/win:winver" ] - configs += [ "//chrome/updater/app/server/win:winver" ] + configs += [ + "//chrome/updater/app/server/win:winver", + "//chrome/updater/win:wrl_strict", + ] } }
diff --git a/chrome/updater/app/server/win/com_classes.cc b/chrome/updater/app/server/win/com_classes.cc index 965f3f7..1bf5be1 100644 --- a/chrome/updater/app/server/win/com_classes.cc +++ b/chrome/updater/app/server/win/com_classes.cc
@@ -2,13 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This macro is used in <wrl/module.h>. Since only the COM functionality is -// used here (while WinRT is not being used), define this macro to optimize -// compilation of <wrl/module.h> for COM-only. -#ifndef __WRL_CLASSIC_COM_STRICT__ -#define __WRL_CLASSIC_COM_STRICT__ -#endif // __WRL_CLASSIC_COM_STRICT__ - #include "chrome/updater/app/server/win/com_classes.h" #include "base/bind.h"
diff --git a/chrome/updater/app/server/win/com_classes.h b/chrome/updater/app/server/win/com_classes.h index ef6657b..7f3de752 100644 --- a/chrome/updater/app/server/win/com_classes.h +++ b/chrome/updater/app/server/win/com_classes.h
@@ -7,7 +7,6 @@ #include <windows.h> #include <wrl/implements.h> -#include <wrl/module.h> #include "base/strings/string16.h" #include "chrome/updater/app/server/win/updater_idl.h"
diff --git a/chrome/updater/app/server/win/com_classes_legacy.cc b/chrome/updater/app/server/win/com_classes_legacy.cc index d86a7ad7..bd854de5 100644 --- a/chrome/updater/app/server/win/com_classes_legacy.cc +++ b/chrome/updater/app/server/win/com_classes_legacy.cc
@@ -2,17 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This macro is used in <wrl/module.h>. Since only the COM functionality is -// used here (while WinRT is not being used), define this macro to optimize -// compilation of <wrl/module.h> for COM-only. -#ifndef __WRL_CLASSIC_COM_STRICT__ -#define __WRL_CLASSIC_COM_STRICT__ -#endif // __WRL_CLASSIC_COM_STRICT__ - #include "chrome/updater/app/server/win/com_classes_legacy.h" -#include <windows.h> - #include "base/bind.h" #include "base/check_op.h" #include "base/sequenced_task_runner.h"
diff --git a/chrome/updater/app/server/win/com_classes_legacy.h b/chrome/updater/app/server/win/com_classes_legacy.h index ef8caf3c..23b75fc 100644 --- a/chrome/updater/app/server/win/com_classes_legacy.h +++ b/chrome/updater/app/server/win/com_classes_legacy.h
@@ -7,7 +7,6 @@ #include <windows.h> #include <wrl/implements.h> -#include <wrl/module.h> #include <string>
diff --git a/chrome/updater/app/server/win/server.cc b/chrome/updater/app/server/win/server.cc index f9dabc74..bc135e0 100644 --- a/chrome/updater/app/server/win/server.cc +++ b/chrome/updater/app/server/win/server.cc
@@ -2,16 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This macro is used in <wrl/module.h>. Since only the COM functionality is -// used here (while WinRT is not being used), define this macro to optimize -// compilation of <wrl/module.h> for COM-only. -#ifndef __WRL_CLASSIC_COM_STRICT__ -#define __WRL_CLASSIC_COM_STRICT__ -#endif // __WRL_CLASSIC_COM_STRICT__ - #include "chrome/updater/app/server/win/server.h" -#include <windows.h> +#include <wrl/implements.h> #include <algorithm> @@ -31,6 +24,7 @@ #include "chrome/updater/prefs.h" #include "chrome/updater/update_service_in_process.h" #include "chrome/updater/win/constants.h" +#include "chrome/updater/win/wrl_module.h" #include "components/prefs/pref_service.h" namespace updater {
diff --git a/chrome/updater/app/server/win/server.h b/chrome/updater/app/server/win/server.h index 69e3169..244ccd9 100644 --- a/chrome/updater/app/server/win/server.h +++ b/chrome/updater/app/server/win/server.h
@@ -5,8 +5,7 @@ #ifndef CHROME_UPDATER_APP_SERVER_WIN_SERVER_H_ #define CHROME_UPDATER_APP_SERVER_WIN_SERVER_H_ -#include <wrl/implements.h> -#include <wrl/module.h> +#include <windows.h> #include <string>
diff --git a/chrome/updater/app/server/win/service_main.cc b/chrome/updater/app/server/win/service_main.cc index 9ea9996..c2851e8 100644 --- a/chrome/updater/app/server/win/service_main.cc +++ b/chrome/updater/app/server/win/service_main.cc
@@ -2,18 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This macro is used in <wrl/module.h>. Since only the COM functionality is -// used here (while WinRT isn't being used), define this macro to optimize -// compilation of <wrl/module.h> for COM-only. -#ifndef __WRL_CLASSIC_COM_STRICT__ -#define __WRL_CLASSIC_COM_STRICT__ -#endif // __WRL_CLASSIC_COM_STRICT__ - #include "chrome/updater/app/server/win/service_main.h" #include <atlsecurity.h> #include <sddl.h> -#include <wrl/module.h> #include <type_traits> @@ -25,6 +17,7 @@ #include "chrome/updater/app/server/win/com_classes_legacy.h" #include "chrome/updater/app/server/win/server.h" #include "chrome/updater/win/constants.h" +#include "chrome/updater/win/wrl_module.h" namespace updater {
diff --git a/chrome/updater/service_factory_win.cc b/chrome/updater/service_factory_win.cc index f8170f7..5be9dbdd 100644 --- a/chrome/updater/service_factory_win.cc +++ b/chrome/updater/service_factory_win.cc
@@ -2,18 +2,41 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/logging.h" #include "base/memory/ref_counted.h" +#include "base/no_destructor.h" #include "chrome/updater/service_scope.h" #include "chrome/updater/win/control_service_out_of_process.h" #include "chrome/updater/win/update_service_out_of_process.h" +#include "chrome/updater/win/wrl_module.h" namespace updater { +namespace { + +// Allows one time creation of the WRL::Module instance. The WRL library +// contains a global instance of a class, which must be created only once. +class WRLModuleInitializer { + public: + WRLModuleInitializer() { + Microsoft::WRL::Module<Microsoft::WRL::OutOfProc>::Create( + []() { DVLOG(2) << "COM client is shutting down."; }); + } + + static const WRLModuleInitializer& Get() { + static const base::NoDestructor<WRLModuleInitializer> module; + return *module; + } +}; + +} // namespace scoped_refptr<UpdateService> CreateUpdateService() { + WRLModuleInitializer::Get(); return base::MakeRefCounted<UpdateServiceOutOfProcess>(GetProcessScope()); } scoped_refptr<ControlService> CreateControlService() { + WRLModuleInitializer::Get(); return base::MakeRefCounted<ControlServiceOutOfProcess>(GetProcessScope()); }
diff --git a/chrome/updater/test/test_app/update_client_win.cc b/chrome/updater/test/test_app/update_client_win.cc index a15f681e9..b900b92 100644 --- a/chrome/updater/test/test_app/update_client_win.cc +++ b/chrome/updater/test/test_app/update_client_win.cc
@@ -2,20 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This macro is used in <wrl/module.h>. Since only the COM functionality is -// used here (while WinRT is not being used), define this macro to optimize -// compilation of <wrl/module.h> for COM-only. -#ifndef __WRL_CLASSIC_COM_STRICT__ -#define __WRL_CLASSIC_COM_STRICT__ -#endif // __WRL_CLASSIC_COM_STRICT__ - #include "chrome/updater/test/test_app/update_client_win.h" #include <atlsecurity.h> #include <sddl.h> -#include <windows.h> #include <wrl/implements.h> -#include <wrl/module.h> #include <memory> #include <utility>
diff --git a/chrome/updater/test/test_app/update_client_win.h b/chrome/updater/test/test_app/update_client_win.h index 456fcbea..a688cbb 100644 --- a/chrome/updater/test/test_app/update_client_win.h +++ b/chrome/updater/test/test_app/update_client_win.h
@@ -7,6 +7,7 @@ #include "chrome/updater/test/test_app/update_client.h" +#include <windows.h> #include <wrl/client.h> #include "chrome/updater/app/server/win/updater_idl.h"
diff --git a/chrome/updater/win/BUILD.gn b/chrome/updater/win/BUILD.gn index f81f91e..0bea867 100644 --- a/chrome/updater/win/BUILD.gn +++ b/chrome/updater/win/BUILD.gn
@@ -17,6 +17,13 @@ ] } +config("wrl_strict") { + # This definition is used in <wrl/module.h> to specify that only COM + # support is provided by WRL, and thus, avoid a dependency on WinRT, which + # is not available in Windows 7. + defines = [ "__WRL_CLASSIC_COM_STRICT__" ] +} + executable("updater") { sources = [ "main.cc",
diff --git a/chrome/updater/win/control_service_out_of_process.cc b/chrome/updater/win/control_service_out_of_process.cc index 7347c0c..f1d32473 100644 --- a/chrome/updater/win/control_service_out_of_process.cc +++ b/chrome/updater/win/control_service_out_of_process.cc
@@ -2,19 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This macro is used in <wrl/module.h>. Since only the COM functionality is -// used here (while WinRT is not being used), define this macro to optimize -// compilation of <wrl/module.h> for COM-only. -#ifndef __WRL_CLASSIC_COM_STRICT__ -#define __WRL_CLASSIC_COM_STRICT__ -#endif // __WRL_CLASSIC_COM_STRICT__ - #include "chrome/updater/win/control_service_out_of_process.h" #include <windows.h> #include <wrl/client.h> #include <wrl/implements.h> -#include <wrl/module.h> #include "base/callback.h" #include "base/check_op.h" @@ -130,19 +122,12 @@ ControlServiceOutOfProcess::ControlServiceOutOfProcess(ServiceScope /*scope*/) : com_task_runner_( - base::ThreadPool::CreateCOMSTATaskRunner(kComClientTraits)) { - Microsoft::WRL::Module<Microsoft::WRL::OutOfProc>::Create( - &ControlServiceOutOfProcess::ModuleStop); -} + base::ThreadPool::CreateCOMSTATaskRunner(kComClientTraits)) {} ControlServiceOutOfProcess::~ControlServiceOutOfProcess() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } -void ControlServiceOutOfProcess::ModuleStop() { - DVLOG(2) << __func__ << ": COM client is shutting down."; -} - void ControlServiceOutOfProcess::Uninitialize() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); }
diff --git a/chrome/updater/win/control_service_out_of_process.h b/chrome/updater/win/control_service_out_of_process.h index 3823bc8..ebfce47 100644 --- a/chrome/updater/win/control_service_out_of_process.h +++ b/chrome/updater/win/control_service_out_of_process.h
@@ -34,8 +34,6 @@ void RunOnSTA(base::OnceClosure callback); void InitializeUpdateServiceOnSTA(base::OnceClosure callback); - static void ModuleStop(); - // Bound to the main sequence. SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/updater/win/update_service_out_of_process.cc b/chrome/updater/win/update_service_out_of_process.cc index 828a4199..278dd72 100644 --- a/chrome/updater/win/update_service_out_of_process.cc +++ b/chrome/updater/win/update_service_out_of_process.cc
@@ -2,19 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This macro is used in <wrl/module.h>. Since only the COM functionality is -// used here (while WinRT is not being used), define this macro to optimize -// compilation of <wrl/module.h> for COM-only. -#ifndef __WRL_CLASSIC_COM_STRICT__ -#define __WRL_CLASSIC_COM_STRICT__ -#endif // __WRL_CLASSIC_COM_STRICT__ - #include "chrome/updater/win/update_service_out_of_process.h" #include <windows.h> #include <wrl/client.h> #include <wrl/implements.h> -#include <wrl/module.h> #include <memory> #include <utility> @@ -288,16 +280,10 @@ com_task_runner_( base::ThreadPool::CreateCOMSTATaskRunner(kComClientTraits)) { DCHECK_EQ(service_scope, ServiceScope::kUser); - Microsoft::WRL::Module<Microsoft::WRL::OutOfProc>::Create( - &UpdateServiceOutOfProcess::ModuleStop); } UpdateServiceOutOfProcess::~UpdateServiceOutOfProcess() = default; -void UpdateServiceOutOfProcess::ModuleStop() { - DVLOG(2) << __func__ << ": COM client is shutting down."; -} - void UpdateServiceOutOfProcess::RegisterApp( const RegistrationRequest& request, base::OnceCallback<void(const RegistrationResponse&)> callback) {
diff --git a/chrome/updater/win/update_service_out_of_process.h b/chrome/updater/win/update_service_out_of_process.h index 1b135450..058d2b5 100644 --- a/chrome/updater/win/update_service_out_of_process.h +++ b/chrome/updater/win/update_service_out_of_process.h
@@ -56,8 +56,6 @@ StateChangeCallback state_update, Callback callback); - static void ModuleStop(); - // Bound to the main sequence. SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/updater/win/wrl_module.h b/chrome/updater/win/wrl_module.h new file mode 100644 index 0000000..a563076 --- /dev/null +++ b/chrome/updater/win/wrl_module.h
@@ -0,0 +1,14 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_UPDATER_WIN_WRL_MODULE_H_ +#define CHROME_UPDATER_WIN_WRL_MODULE_H_ + +#if !defined(__WRL_CLASSIC_COM_STRICT__) +#error "WRL must not depend on WinRT." +#endif + +#include <wrl/module.h> + +#endif // CHROME_UPDATER_WIN_WRL_MODULE_H_
diff --git a/chromecast/browser/accessibility/flutter/ax_tree_source_flutter_unittest.cc b/chromecast/browser/accessibility/flutter/ax_tree_source_flutter_unittest.cc index 168344f0..9ccb96cb 100644 --- a/chromecast/browser/accessibility/flutter/ax_tree_source_flutter_unittest.cc +++ b/chromecast/browser/accessibility/flutter/ax_tree_source_flutter_unittest.cc
@@ -632,5 +632,27 @@ ASSERT_EQ(0, tree_data.focus_id); } +TEST_F(AXTreeSourceFlutterTest, NoClickable) { + OnAccessibilityEventRequest event; + + event.set_source_id(0); + event.set_window_id(1); + event.set_event_type(OnAccessibilityEventRequest_EventType_FOCUSED); + + SemanticsNode* root = event.add_node_data(); + root->set_node_id(0); + ActionProperties* action_properties = root->mutable_action_properties(); + action_properties->set_tap(true); + Rect* bounds = root->mutable_bounds_in_screen(); + SetRect(bounds, 0, 0, 1280, 800); + + CallNotifyAccessibilityEvent(&event); + std::unique_ptr<ui::AXNodeData> data; + CallSerializeNode(root, &data); + + // No node should get the clickable attribute. + ASSERT_FALSE(data->GetBoolAttribute(ax::mojom::BoolAttribute::kClickable)); +} + } // namespace accessibility } // namespace chromecast
diff --git a/chromecast/browser/accessibility/flutter/flutter_semantics_node_wrapper.cc b/chromecast/browser/accessibility/flutter/flutter_semantics_node_wrapper.cc index 31e34ec..9844a55 100644 --- a/chromecast/browser/accessibility/flutter/flutter_semantics_node_wrapper.cc +++ b/chromecast/browser/accessibility/flutter/flutter_semantics_node_wrapper.cc
@@ -301,8 +301,9 @@ out_data->SetValue(GetValue()); } - out_data->AddBoolAttribute(ax::mojom::BoolAttribute::kClickable, - IsActionable()); + if (IsActionable()) { + out_data->SetDefaultActionVerb(ax::mojom::DefaultActionVerb::kClick); + } out_data->AddBoolAttribute(ax::mojom::BoolAttribute::kScrollable, IsScrollable()); @@ -495,18 +496,8 @@ } bool FlutterSemanticsNodeWrapper::IsActionable() const { - // When flutter tells us a generic container is actionable, do not allow this - // unless all children of this node are NOT actionable. Otherwise, the - // tree walker will consider this node a leaf and it will not navigate to - // any actionable children. bool actionable = HasTapOrPress(); - ui::AXNodeData data; - PopulateAXRole(&data); - if (actionable && data.role == ax::mojom::Role::kGenericContainer && - AnyChildIsActionable()) { - actionable = false; - } // If this node is actionable but is also the host for a child tree, // don't make it actionable or else chromevox won't traverse into // any child.
diff --git a/chromecast/browser/accessibility/touch_exploration_controller.cc b/chromecast/browser/accessibility/touch_exploration_controller.cc index b2898fa4..860d44fe 100644 --- a/chromecast/browser/accessibility/touch_exploration_controller.cc +++ b/chromecast/browser/accessibility/touch_exploration_controller.cc
@@ -425,7 +425,7 @@ if (current_touch_ids_.size() != 0) return DiscardEvent(continuation); - SendSimulatedClickOrTap(continuation); + SendSimulatedClick(continuation); SET_STATE(NO_FINGERS_DOWN); return DiscardEvent(continuation); @@ -445,7 +445,7 @@ if (current_touch_ids_.size() != 0) return DiscardEvent(continuation); - SendSimulatedClickOrTap(continuation); + SendSimulatedClick(continuation); SET_STATE(NO_FINGERS_DOWN); return DiscardEvent(continuation); } @@ -590,7 +590,7 @@ return DiscardEvent(continuation); } - SendSimulatedClickOrTap(continuation); + SendSimulatedClick(continuation); SET_STATE(TOUCH_EXPLORATION); EnterTouchToMouseMode(); @@ -608,16 +608,13 @@ return DiscardEvent(continuation); } -void TouchExplorationController::SendSimulatedClickOrTap( +void TouchExplorationController::SendSimulatedClick( const Continuation continuation) { - // If we got an anchor point from ChromeVox, send a double-tap gesture - // and let ChromeVox handle the click. const gfx::Point location; + // For Chromecast, always send a simulated tap. NOTE: This differs + // from chromeos's touch exploration controller which always send an + // accessibility gesture. delegate_->HandleTap(location); - if (anchor_point_state_ == ANCHOR_POINT_EXPLICITLY_SET) { - delegate_->HandleAccessibilityGesture(ax::mojom::Gesture::kClick); - return; - } SendSimulatedTap(continuation); }
diff --git a/chromecast/browser/accessibility/touch_exploration_controller.h b/chromecast/browser/accessibility/touch_exploration_controller.h index 080f375..a5dbfb3 100644 --- a/chromecast/browser/accessibility/touch_exploration_controller.h +++ b/chromecast/browser/accessibility/touch_exploration_controller.h
@@ -265,9 +265,8 @@ void PlaySoundForTimer(); - // Sends a simulated click, if an anchor point was set explicitly. Otherwise, - // sends a simulated tap at anchor point. - void SendSimulatedClickOrTap(const Continuation continuation); + // Sends a simulated click. + void SendSimulatedClick(const Continuation continuation); // Sends a simulated tap at anchor point. void SendSimulatedTap(const Continuation continuation);
diff --git a/chromecast/browser/accessibility/touch_exploration_controller_unittest.cc b/chromecast/browser/accessibility/touch_exploration_controller_unittest.cc index 5c8a809..e20c1a4 100644 --- a/chromecast/browser/accessibility/touch_exploration_controller_unittest.cc +++ b/chromecast/browser/accessibility/touch_exploration_controller_unittest.cc
@@ -722,8 +722,9 @@ generator_->ReleaseTouch(); std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents(); - ASSERT_EQ(0U, captured_events.size()); - EXPECT_EQ(ax::mojom::Gesture::kClick, delegate_.GetLastGesture()); + ASSERT_EQ(2U, captured_events.size()); + EXPECT_EQ(ui::ET_TOUCH_PRESSED, captured_events[0]->type()); + EXPECT_EQ(ui::ET_TOUCH_RELEASED, captured_events[1]->type()); } // If an explicit anchor point is set during touch exploration, double-tapping @@ -760,9 +761,10 @@ generator_->ReleaseTouch(); std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents(); - ASSERT_EQ(0U, captured_events.size()); + ASSERT_EQ(2U, captured_events.size()); EXPECT_TRUE(IsInNoFingersDownState()); - EXPECT_EQ(ax::mojom::Gesture::kClick, delegate_.GetLastGesture()); + EXPECT_EQ(ui::ET_TOUCH_PRESSED, captured_events[0]->type()); + EXPECT_EQ(ui::ET_TOUCH_RELEASED, captured_events[1]->type()); } // Double-tapping where the user holds their finger down for the second time
diff --git a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsIntentUtils.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsIntentUtils.java index 336465754..852fa3e 100644 --- a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsIntentUtils.java +++ b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsIntentUtils.java
@@ -330,7 +330,7 @@ intent.putExtra(INTENT_EXTRA_TURN_ON_SCREEN, turnOnScreen); intent.putExtra(INTENT_EXTRA_REMOTE_CONTROL_MODE, isRemoteControlMode); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP - | Intent.FLAG_ACTIVITY_NO_ANIMATION); + | Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_TASK_ON_HOME); return intent; }
diff --git a/chromeos/components/diagnostics_ui/resources/BUILD.gn b/chromeos/components/diagnostics_ui/resources/BUILD.gn index 68bb1aa..60e3535 100644 --- a/chromeos/components/diagnostics_ui/resources/BUILD.gn +++ b/chromeos/components/diagnostics_ui/resources/BUILD.gn
@@ -23,6 +23,7 @@ ":memory_card", ":mojo_interface_provider", ":overview_card", + ":percent_bar_chart", ] } @@ -105,6 +106,12 @@ ] } +js_library("percent_bar_chart") { + deps = [ + "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + ] +} + html_to_js("web_components") { js_files = [ "battery_status_card.js", @@ -116,5 +123,6 @@ "diagnostics_shared_css.js", "memory_card.js", "overview_card.js", + "percent_bar_chart.js", ] }
diff --git a/chromeos/components/diagnostics_ui/resources/diagnostics_app_resources.grd b/chromeos/components/diagnostics_ui/resources/diagnostics_app_resources.grd index 40ebb33..6c2787da 100644 --- a/chromeos/components/diagnostics_ui/resources/diagnostics_app_resources.grd +++ b/chromeos/components/diagnostics_ui/resources/diagnostics_app_resources.grd
@@ -28,6 +28,7 @@ <include name="IDR_DIAGNOSTICS_MEMORY_CARD_JS" file="${root_gen_dir}/chromeos/components/diagnostics_ui/resources/memory_card.js" use_base_dir="false" type="BINDATA"/> <include name="IDR_DIAGNOSTICS_MOJO_INTERFACE_PROVIDER_JS" file="mojo_interface_provider.js" type="BINDATA"/> <include name="IDR_DIAGNOSTICS_OVERVIEW_CARD_JS" file="${root_gen_dir}/chromeos/components/diagnostics_ui/resources/overview_card.js" use_base_dir="false" type="BINDATA"/> + <include name="IDR_DIAGNOSTICS_PERCENT_BAR_CHART_JS" file="${root_gen_dir}/chromeos/components/diagnostics_ui/resources/percent_bar_chart.js" use_base_dir="false" type="BINDATA"/> <include name="IDR_DIAGNOSTICS_SHARED_CSS_JS" file="${root_gen_dir}/chromeos/components/diagnostics_ui/resources/diagnostics_shared_css.js" use_base_dir="false" type="BINDDATA"/> <include name="IDR_DIAGNOSTICS_TYPES_JS" file="diagnostics_types.js" type="BINDATA"/> </includes>
diff --git a/chromeos/components/diagnostics_ui/resources/percent_bar_chart.html b/chromeos/components/diagnostics_ui/resources/percent_bar_chart.html new file mode 100644 index 0000000..fab7afc --- /dev/null +++ b/chromeos/components/diagnostics_ui/resources/percent_bar_chart.html
@@ -0,0 +1,13 @@ +<style include="diagnostics-shared diagnostics-fonts"> + paper-progress { + --paper-progress-active-color: var(--google-blue-500); + --paper-progress-container-color: var(--google-blue-100); + } +</style> + +<div id="barChartContainer"> + <label id="chartName">[[title]]</label> + <paper-progress id="barChart" value="[[value]]" max="[[max]]"></paper-progress> + <!-- TODO(joonbug): Add i18n string for percent number format --> + <label id="percentageLabel">[[computePercentage_(value, max)]]</label> +</div>
diff --git a/chromeos/components/diagnostics_ui/resources/percent_bar_chart.js b/chromeos/components/diagnostics_ui/resources/percent_bar_chart.js new file mode 100644 index 0000000..d77bce9 --- /dev/null +++ b/chromeos/components/diagnostics_ui/resources/percent_bar_chart.js
@@ -0,0 +1,48 @@ +// 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. + +import './diagnostics_fonts_css.js'; +import './diagnostics_shared_css.js'; +import 'chrome://resources/polymer/v3_0/paper-progress/paper-progress.js'; + +import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +/** + * @fileoverview + * 'percent-bar-chart' is a styling wrapper for paper-progress used to display a + * percentage based bar chart. + */ +Polymer({ + is: 'percent-bar-chart', + + _template: html`{__html_template__}`, + + properties: { + title: { + type: String, + }, + + value: { + type: Number, + value: 0, + }, + + max: { + type: Number, + value: 100, + }, + }, + + /** + * Returns the percentage of the current bar chart, rounded to the nearest + * whole number. + * @param {number} currentValue + * @param {number} maxValue + * @return {number} + * @private + */ + computePercentage_(currentValue, maxValue) { + return Math.round(100 * currentValue / maxValue); + } +});
diff --git a/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js b/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js index f33de38..fb265226 100644 --- a/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js +++ b/chromeos/components/media_app_ui/test/media_app_ui_browsertest.js
@@ -68,15 +68,14 @@ /** @override */ get featureList() { - // NativeFileSystem and FileHandling flags should be automatically set by - // origin trials when the Media App feature is enabled, but this testing - // environment does not seem to recognize origin trials, so they must be - // explicitly set with flags to prevent tests crashing on Media App load due - // to window.launchQueue being undefined. See http://crbug.com/1071320. + // The FileHandling flag should be automatically set by origin trials when + // the Media App feature is enabled, but this testing environment does not + // seem to recognize origin trials, so they must be explicitly set with + // flags to prevent tests crashing on Media App load due to + // window.launchQueue being undefined. See http://crbug.com/1071320. return { enabled: [ 'chromeos::features::kMediaApp', - 'blink::features::kNativeFileSystemAPI', 'blink::features::kFileHandlingAPI' ] };
diff --git a/chromeos/components/phonehub/do_not_disturb_controller.h b/chromeos/components/phonehub/do_not_disturb_controller.h index 91ddb0b..f357e03 100644 --- a/chromeos/components/phonehub/do_not_disturb_controller.h +++ b/chromeos/components/phonehub/do_not_disturb_controller.h
@@ -32,7 +32,7 @@ // Note: Setting DND state is not a synchronous operation, since it requires // sending a message to the connected phone. Use the observer interface to be // notified of when the state changes. - virtual void SetDoNotDisturbState(bool enabled) = 0; + virtual void RequestNewDoNotDisturbState(bool enabled) = 0; void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); @@ -40,6 +40,10 @@ protected: DoNotDisturbController(); + // This only sets the internal state of the DoNotDisturb mode and does not + // send a request to set the state of the remote phone device. + virtual void SetDoNotDisturbStateInternal(bool is_dnd_enabled) = 0; + void NotifyDndStateChanged(); private:
diff --git a/chromeos/components/phonehub/do_not_disturb_controller_impl.cc b/chromeos/components/phonehub/do_not_disturb_controller_impl.cc index 0317d5a..1e4d45bc 100644 --- a/chromeos/components/phonehub/do_not_disturb_controller_impl.cc +++ b/chromeos/components/phonehub/do_not_disturb_controller_impl.cc
@@ -17,7 +17,12 @@ return is_dnd_enabled_; } -void DoNotDisturbControllerImpl::SetDoNotDisturbState(bool enabled) { +void DoNotDisturbControllerImpl::SetDoNotDisturbStateInternal( + bool is_dnd_enabled) { + is_dnd_enabled_ = is_dnd_enabled; +} + +void DoNotDisturbControllerImpl::RequestNewDoNotDisturbState(bool enabled) { PA_LOG(INFO) << "Attempting to set DND state; new value: " << enabled; }
diff --git a/chromeos/components/phonehub/do_not_disturb_controller_impl.h b/chromeos/components/phonehub/do_not_disturb_controller_impl.h index 5a3ef1f..4442add 100644 --- a/chromeos/components/phonehub/do_not_disturb_controller_impl.h +++ b/chromeos/components/phonehub/do_not_disturb_controller_impl.h
@@ -19,7 +19,8 @@ private: // DoNotDisturbController: bool IsDndEnabled() const override; - void SetDoNotDisturbState(bool enabled) override; + void SetDoNotDisturbStateInternal(bool is_dnd_enabled) override; + void RequestNewDoNotDisturbState(bool enabled) override; bool is_dnd_enabled_ = false; };
diff --git a/chromeos/components/phonehub/fake_do_not_disturb_controller.cc b/chromeos/components/phonehub/fake_do_not_disturb_controller.cc index abe45590..bfe586c0 100644 --- a/chromeos/components/phonehub/fake_do_not_disturb_controller.cc +++ b/chromeos/components/phonehub/fake_do_not_disturb_controller.cc
@@ -15,13 +15,18 @@ return is_dnd_enabled_; } -void FakeDoNotDisturbController::SetDoNotDisturbState(bool enabled) { - if (is_dnd_enabled_ == enabled) +void FakeDoNotDisturbController::SetDoNotDisturbStateInternal( + bool is_dnd_enabled) { + if (is_dnd_enabled_ == is_dnd_enabled) return; - is_dnd_enabled_ = enabled; + is_dnd_enabled_ = is_dnd_enabled; NotifyDndStateChanged(); } +void FakeDoNotDisturbController::RequestNewDoNotDisturbState(bool enabled) { + SetDoNotDisturbStateInternal(enabled); +} + } // namespace phonehub } // namespace chromeos
diff --git a/chromeos/components/phonehub/fake_do_not_disturb_controller.h b/chromeos/components/phonehub/fake_do_not_disturb_controller.h index 22afe0f42..6d9de37 100644 --- a/chromeos/components/phonehub/fake_do_not_disturb_controller.h +++ b/chromeos/components/phonehub/fake_do_not_disturb_controller.h
@@ -17,7 +17,8 @@ // DoNotDisturbController: bool IsDndEnabled() const override; - void SetDoNotDisturbState(bool enabled) override; + void SetDoNotDisturbStateInternal(bool is_dnd_enabled) override; + void RequestNewDoNotDisturbState(bool enabled) override; private: bool is_dnd_enabled_ = false;
diff --git a/chromeos/components/phonehub/fake_find_my_device_controller.cc b/chromeos/components/phonehub/fake_find_my_device_controller.cc index 566c610..a85c009a 100644 --- a/chromeos/components/phonehub/fake_find_my_device_controller.cc +++ b/chromeos/components/phonehub/fake_find_my_device_controller.cc
@@ -15,13 +15,18 @@ return is_phone_ringing_; } -void FakeFindMyDeviceController::SetPhoneRingingState(bool ringing) { - if (is_phone_ringing_ == ringing) +void FakeFindMyDeviceController::SetIsPhoneRingingInternal( + bool is_phone_ringing) { + if (is_phone_ringing_ == is_phone_ringing) return; - is_phone_ringing_ = ringing; + is_phone_ringing_ = is_phone_ringing; NotifyPhoneRingingStateChanged(); } +void FakeFindMyDeviceController::RequestNewPhoneRingingState(bool ringing) { + SetIsPhoneRingingInternal(ringing); +} + } // namespace phonehub } // namespace chromeos
diff --git a/chromeos/components/phonehub/fake_find_my_device_controller.h b/chromeos/components/phonehub/fake_find_my_device_controller.h index e2c1a22a..60a57e97 100644 --- a/chromeos/components/phonehub/fake_find_my_device_controller.h +++ b/chromeos/components/phonehub/fake_find_my_device_controller.h
@@ -17,7 +17,8 @@ // FindMyDeviceController: bool IsPhoneRinging() const override; - void SetPhoneRingingState(bool ringing) override; + void SetIsPhoneRingingInternal(bool is_phone_ringing) override; + void RequestNewPhoneRingingState(bool ringing) override; private: bool is_phone_ringing_ = false;
diff --git a/chromeos/components/phonehub/fake_notification_access_manager.cc b/chromeos/components/phonehub/fake_notification_access_manager.cc index 5ae31cda..4e558d2f 100644 --- a/chromeos/components/phonehub/fake_notification_access_manager.cc +++ b/chromeos/components/phonehub/fake_notification_access_manager.cc
@@ -13,7 +13,7 @@ FakeNotificationAccessManager::~FakeNotificationAccessManager() = default; -void FakeNotificationAccessManager::SetHasAccessBeenGranted( +void FakeNotificationAccessManager::SetHasAccessBeenGrantedInternal( bool has_access_been_granted) { if (has_access_been_granted_ == has_access_been_granted) return; @@ -30,7 +30,7 @@ NotificationAccessSetupOperation::Status new_status) { if (new_status == NotificationAccessSetupOperation::Status::kCompletedSuccessfully) { - SetHasAccessBeenGranted(true); + SetHasAccessBeenGrantedInternal(true); } NotificationAccessManager::SetNotificationSetupOperationStatus(new_status);
diff --git a/chromeos/components/phonehub/fake_notification_access_manager.h b/chromeos/components/phonehub/fake_notification_access_manager.h index 826f3cd5..8da2ea76 100644 --- a/chromeos/components/phonehub/fake_notification_access_manager.h +++ b/chromeos/components/phonehub/fake_notification_access_manager.h
@@ -17,7 +17,7 @@ using NotificationAccessManager::IsSetupOperationInProgress; - void SetHasAccessBeenGranted(bool has_access_been_granted); + void SetHasAccessBeenGrantedInternal(bool has_access_been_granted) override; void SetNotificationSetupOperationStatus( NotificationAccessSetupOperation::Status new_status);
diff --git a/chromeos/components/phonehub/fake_notification_manager.cc b/chromeos/components/phonehub/fake_notification_manager.cc index 12491207..2aca3cd 100644 --- a/chromeos/components/phonehub/fake_notification_manager.cc +++ b/chromeos/components/phonehub/fake_notification_manager.cc
@@ -22,10 +22,10 @@ void FakeNotificationManager::SetNotification( const Notification& notification) { - SetNotifications(base::flat_set<Notification>{notification}); + SetNotificationsInternal(base::flat_set<Notification>{notification}); } -void FakeNotificationManager::SetNotifications( +void FakeNotificationManager::SetNotificationsInternal( const base::flat_set<Notification>& notifications) { base::flat_set<int64_t> added_ids; base::flat_set<int64_t> updated_ids; @@ -49,10 +49,10 @@ } void FakeNotificationManager::RemoveNotification(int64_t id) { - RemoveNotifications(base::flat_set<int64_t>{id}); + RemoveNotificationsInternal(base::flat_set<int64_t>{id}); } -void FakeNotificationManager::RemoveNotifications( +void FakeNotificationManager::RemoveNotificationsInternal( const base::flat_set<int64_t>& ids) { for (int64_t id : ids) { auto it = id_to_notification_map_.find(id);
diff --git a/chromeos/components/phonehub/fake_notification_manager.h b/chromeos/components/phonehub/fake_notification_manager.h index 5d2a9ea..41f0505 100644 --- a/chromeos/components/phonehub/fake_notification_manager.h +++ b/chromeos/components/phonehub/fake_notification_manager.h
@@ -21,10 +21,11 @@ ~FakeNotificationManager() override; void SetNotification(const Notification& notification); - void SetNotifications(const base::flat_set<Notification>& notifications); + void SetNotificationsInternal( + const base::flat_set<Notification>& notifications) override; void RemoveNotification(int64_t id); - void RemoveNotifications(const base::flat_set<int64_t>& ids); + void RemoveNotificationsInternal(const base::flat_set<int64_t>& ids) override; const std::vector<int64_t>& dismissed_notification_ids() const { return dismissed_notification_ids_;
diff --git a/chromeos/components/phonehub/find_my_device_controller.h b/chromeos/components/phonehub/find_my_device_controller.h index feab4c8..81bbd3e 100644 --- a/chromeos/components/phonehub/find_my_device_controller.h +++ b/chromeos/components/phonehub/find_my_device_controller.h
@@ -34,7 +34,7 @@ // Note: Ringing the phone via Find My Device is not a synchronous operation, // since it requires sending a message to the connected phone. Use the // observer interface to be notified of when the state changes. - virtual void SetPhoneRingingState(bool ringing) = 0; + virtual void RequestNewPhoneRingingState(bool ringing) = 0; void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); @@ -42,6 +42,9 @@ protected: FindMyDeviceController(); + // This only sets the internal state of the whether the phone is ringin + // and does not send a request to start ringing the the remote phone device. + virtual void SetIsPhoneRingingInternal(bool is_phone_ringing) = 0; void NotifyPhoneRingingStateChanged(); private:
diff --git a/chromeos/components/phonehub/find_my_device_controller_impl.cc b/chromeos/components/phonehub/find_my_device_controller_impl.cc index cd28fa7..28cc5d9 100644 --- a/chromeos/components/phonehub/find_my_device_controller_impl.cc +++ b/chromeos/components/phonehub/find_my_device_controller_impl.cc
@@ -17,7 +17,12 @@ return is_phone_ringing_; } -void FindMyDeviceControllerImpl::SetPhoneRingingState(bool ringing) { +void FindMyDeviceControllerImpl::SetIsPhoneRingingInternal( + bool is_phone_ringing) { + is_phone_ringing_ = is_phone_ringing; +} + +void FindMyDeviceControllerImpl::RequestNewPhoneRingingState(bool ringing) { PA_LOG(INFO) << "Attempting to set Find My Device phone ring state; new " << "value: " << ringing; }
diff --git a/chromeos/components/phonehub/find_my_device_controller_impl.h b/chromeos/components/phonehub/find_my_device_controller_impl.h index 6549ce0..c76b15b 100644 --- a/chromeos/components/phonehub/find_my_device_controller_impl.h +++ b/chromeos/components/phonehub/find_my_device_controller_impl.h
@@ -19,7 +19,8 @@ private: // FindMyDeviceController: bool IsPhoneRinging() const override; - void SetPhoneRingingState(bool ringing) override; + void SetIsPhoneRingingInternal(bool is_phone_ringing) override; + void RequestNewPhoneRingingState(bool ringing) override; bool is_phone_ringing_ = false; };
diff --git a/chromeos/components/phonehub/notification_access_manager.h b/chromeos/components/phonehub/notification_access_manager.h index 5630e02..1724a1a 100644 --- a/chromeos/components/phonehub/notification_access_manager.h +++ b/chromeos/components/phonehub/notification_access_manager.h
@@ -72,6 +72,12 @@ private: friend class NotificationAccessManagerImplTest; + // This only sets the internal state of the whether notification access has + // mode been enabled and does not send a request to set the state of the + // remote phone device. + virtual void SetHasAccessBeenGrantedInternal( + bool has_access_been_granted) = 0; + void OnSetupOperationDeleted(int operation_id); int next_operation_id_ = 0;
diff --git a/chromeos/components/phonehub/notification_access_manager_impl.cc b/chromeos/components/phonehub/notification_access_manager_impl.cc index 3c69bee..73c1ebf 100644 --- a/chromeos/components/phonehub/notification_access_manager_impl.cc +++ b/chromeos/components/phonehub/notification_access_manager_impl.cc
@@ -28,6 +28,13 @@ return pref_service_->GetBoolean(prefs::kNotificationAccessGranted); } +void NotificationAccessManagerImpl::SetHasAccessBeenGrantedInternal( + bool has_access_been_granted) { + PA_LOG(INFO) << "Notification access state has been set to: " + << has_access_been_granted; + // TODO(jimmyxgong): Implement this stub function. +} + void NotificationAccessManagerImpl::OnSetupAttemptStarted() { PA_LOG(INFO) << "Notification access setup flow started."; // TODO(khorimoto): Attempt notification setup flow.
diff --git a/chromeos/components/phonehub/notification_access_manager_impl.h b/chromeos/components/phonehub/notification_access_manager_impl.h index 3c15fb51..04cfc31 100644 --- a/chromeos/components/phonehub/notification_access_manager_impl.h +++ b/chromeos/components/phonehub/notification_access_manager_impl.h
@@ -28,6 +28,7 @@ private: // NotificationAccessManager: bool HasAccessBeenGranted() const override; + void SetHasAccessBeenGrantedInternal(bool has_access_been_granted) override; void OnSetupAttemptStarted() override; void OnSetupAttemptEnded() override;
diff --git a/chromeos/components/phonehub/notification_manager.h b/chromeos/components/phonehub/notification_manager.h index 8b646bf..b9a29d4 100644 --- a/chromeos/components/phonehub/notification_manager.h +++ b/chromeos/components/phonehub/notification_manager.h
@@ -10,6 +10,7 @@ #include "base/containers/flat_set.h" #include "base/observer_list.h" #include "base/observer_list_types.h" +#include "chromeos/components/phonehub/notification.h" namespace chromeos { namespace phonehub { @@ -62,6 +63,17 @@ protected: NotificationManager(); + // Sets the internal collection of notifications. This does not send any + // requests to the remote phone device. + virtual void SetNotificationsInternal( + const base::flat_set<Notification>& notifications) = 0; + + // Removes the dismissed notifications from the internal collection of + // notifications. Does not send a request to remove notifications to the + // remote device. + virtual void RemoveNotificationsInternal( + const base::flat_set<int64_t>& notification_ids) = 0; + void NotifyNotificationsAdded( const base::flat_set<int64_t>& notification_ids); void NotifyNotificationsUpdated(
diff --git a/chromeos/components/phonehub/notification_manager_impl.cc b/chromeos/components/phonehub/notification_manager_impl.cc index a0db288a..df4b1730 100644 --- a/chromeos/components/phonehub/notification_manager_impl.cc +++ b/chromeos/components/phonehub/notification_manager_impl.cc
@@ -5,6 +5,7 @@ #include "chromeos/components/phonehub/notification_manager_impl.h" #include "chromeos/components/multidevice/logging/logging.h" +#include "chromeos/components/phonehub/notification.h" namespace chromeos { namespace phonehub { @@ -18,6 +19,18 @@ return nullptr; } +void NotificationManagerImpl::SetNotificationsInternal( + const base::flat_set<Notification>& notifications) { + PA_LOG(INFO) << "Setting notifications internally."; + // TODO(jimmyxong): Implement this stub function. +} + +void NotificationManagerImpl::RemoveNotificationsInternal( + const base::flat_set<int64_t>& notification_ids) { + PA_LOG(INFO) << "Removing notifications internally."; + // TODO(jimmyxgong): Implement this stub function. +} + void NotificationManagerImpl::DismissNotification(int64_t notification_id) { PA_LOG(INFO) << "Dismissing notification with ID " << notification_id << "."; }
diff --git a/chromeos/components/phonehub/notification_manager_impl.h b/chromeos/components/phonehub/notification_manager_impl.h index e37fe52a2..8e19a0c 100644 --- a/chromeos/components/phonehub/notification_manager_impl.h +++ b/chromeos/components/phonehub/notification_manager_impl.h
@@ -5,6 +5,8 @@ #ifndef CHROMEOS_COMPONENTS_PHONEHUB_NOTIFICATION_MANAGER_IMPL_H_ #define CHROMEOS_COMPONENTS_PHONEHUB_NOTIFICATION_MANAGER_IMPL_H_ +#include "base/containers/flat_set.h" +#include "chromeos/components/phonehub/notification.h" #include "chromeos/components/phonehub/notification_manager.h" namespace chromeos { @@ -19,6 +21,10 @@ private: // NotificationManager: const Notification* GetNotification(int64_t notification_id) const override; + void SetNotificationsInternal( + const base::flat_set<Notification>& notifications) override; + void RemoveNotificationsInternal( + const base::flat_set<int64_t>& notification_ids) override; void DismissNotification(int64_t notification_id) override; void SendInlineReply(int64_t notification_id, const base::string16& inline_reply_text) override;
diff --git a/chromeos/components/quick_answers/BUILD.gn b/chromeos/components/quick_answers/BUILD.gn index e48e5a3..60fcda3 100644 --- a/chromeos/components/quick_answers/BUILD.gn +++ b/chromeos/components/quick_answers/BUILD.gn
@@ -26,6 +26,10 @@ "search_result_parsers/translation_result_parser.h", "search_result_parsers/unit_conversion_result_parser.cc", "search_result_parsers/unit_conversion_result_parser.h", + "translation_response_parser.cc", + "translation_response_parser.h", + "translation_result_loader.cc", + "translation_result_loader.h", "understanding/intent_generator.cc", "understanding/intent_generator.h", "utils/language_detector.cc",
diff --git a/chromeos/components/quick_answers/quick_answers_client.cc b/chromeos/components/quick_answers/quick_answers_client.cc index f67f7b5..1610f88 100644 --- a/chromeos/components/quick_answers/quick_answers_client.cc +++ b/chromeos/components/quick_answers/quick_answers_client.cc
@@ -110,7 +110,7 @@ result_loader_ = CreateResultLoader( preprocessed_request.preprocessed_output.intent_info.intent_type); // Load and parse search result. - result_loader_->Fetch(preprocessed_request.preprocessed_output.query); + result_loader_->Fetch(preprocessed_request.preprocessed_output); } void QuickAnswersClient::SendRequest(
diff --git a/chromeos/components/quick_answers/quick_answers_client_unittest.cc b/chromeos/components/quick_answers/quick_answers_client_unittest.cc index 201d25dc..33b5387 100644 --- a/chromeos/components/quick_answers/quick_answers_client_unittest.cc +++ b/chromeos/components/quick_answers/quick_answers_client_unittest.cc
@@ -16,6 +16,7 @@ #include "chromeos/components/quick_answers/utils/quick_answers_utils.h" #include "chromeos/constants/chromeos_features.h" #include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h" +#include "services/network/public/cpp/resource_request.h" #include "services/network/test/test_url_loader_factory.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -31,8 +32,10 @@ ResultLoaderDelegate* delegate) : ResultLoader(url_loader_factory, delegate) {} // ResultLoader: - GURL BuildRequestUrl(const std::string& selected_text) const override { - return GURL(); + void BuildRequest(const PreprocessedOutput& preprocessed_output, + BuildRequestCallback callback) const override { + return std::move(callback).Run( + std::make_unique<network::ResourceRequest>()); } void ProcessResponse(std::unique_ptr<std::string> response_body, ResponseParserCallback complete_callback) override {} @@ -48,7 +51,7 @@ MockResultLoader& operator=(const MockResultLoader&) = delete; // TestResultLoader: - MOCK_METHOD1(Fetch, void(const std::string&)); + MOCK_METHOD1(Fetch, void(const PreprocessedOutput&)); }; MATCHER_P(QuickAnswersRequestWithOutputEqual, quick_answers_request, "") { @@ -305,7 +308,9 @@ mock_result_loader_ = std::make_unique<MockResultLoader>(&test_url_loader_factory_, nullptr); - EXPECT_CALL(*mock_result_loader_, Fetch(::testing::Eq("Define:sel"))); + EXPECT_CALL(*mock_result_loader_, + Fetch(PreprocessedOutputEqual(PreprocessRequest( + IntentInfo("sel", IntentType::kDictionary))))); QuickAnswersClient::SetResultLoaderFactoryForTesting( &result_loader_factory_callback_); @@ -347,7 +352,9 @@ mock_result_loader_ = std::make_unique<MockResultLoader>(&test_url_loader_factory_, nullptr); - EXPECT_CALL(*mock_result_loader_, Fetch(::testing::Eq("Define:sel"))); + EXPECT_CALL(*mock_result_loader_, + Fetch(PreprocessedOutputEqual( + quick_answers_request->preprocessed_output))); QuickAnswersClient::SetResultLoaderFactoryForTesting( &result_loader_factory_callback_);
diff --git a/chromeos/components/quick_answers/result_loader.cc b/chromeos/components/quick_answers/result_loader.cc index 1837b1a..d598b3ec 100644 --- a/chromeos/components/quick_answers/result_loader.cc +++ b/chromeos/components/quick_answers/result_loader.cc
@@ -6,7 +6,9 @@ #include "base/bind.h" #include "chromeos/components/quick_answers/quick_answers_model.h" #include "chromeos/components/quick_answers/search_result_loader.h" +#include "chromeos/components/quick_answers/translation_result_loader.h" #include "chromeos/components/quick_answers/utils/quick_answers_metrics.h" +#include "chromeos/constants/chromeos_features.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/simple_url_loader.h" @@ -50,17 +52,25 @@ IntentType intent_type, URLLoaderFactory* url_loader_factory, ResultLoader::ResultLoaderDelegate* delegate) { - // TODO(llin): Add TranslationResultLoader if the intent type is translation. + if (features::IsQuickAnswersTranslationCloudAPIEnabled() && + intent_type == IntentType::kTranslation) + return std::make_unique<TranslationResultLoader>(url_loader_factory, + delegate); return std::make_unique<SearchResultLoader>(url_loader_factory, delegate); } -void ResultLoader::Fetch(const std::string& selected_text) { +void ResultLoader::Fetch(const PreprocessedOutput& preprocessed_output) { DCHECK(network_loader_factory_); - DCHECK(!selected_text.empty()); + DCHECK(!preprocessed_output.query.empty()); // Load the resource. - auto resource_request = std::make_unique<network::ResourceRequest>(); - resource_request->url = BuildRequestUrl(selected_text); + BuildRequest(preprocessed_output, + base::BindOnce(&ResultLoader::OnBuildRequestComplete, + weak_factory_.GetWeakPtr())); +} + +void ResultLoader::OnBuildRequestComplete( + std::unique_ptr<network::ResourceRequest> resource_request) { loader_ = network::SimpleURLLoader::Create(std::move(resource_request), kNetworkTrafficAnnotationTag); @@ -68,7 +78,7 @@ loader_->DownloadToStringOfUnboundedSizeUntilCrashAndDie( network_loader_factory_, base::BindOnce(&ResultLoader::OnSimpleURLLoaderComplete, - base::Unretained(this))); + weak_factory_.GetWeakPtr())); } void ResultLoader::OnSimpleURLLoaderComplete( @@ -84,7 +94,7 @@ ProcessResponse(std::move(response_body), base::BindOnce(&ResultLoader::OnResultParserComplete, - base::Unretained(this))); + weak_factory_.GetWeakPtr())); } void ResultLoader::OnResultParserComplete(
diff --git a/chromeos/components/quick_answers/result_loader.h b/chromeos/components/quick_answers/result_loader.h index 6d924b9..14a40e6e 100644 --- a/chromeos/components/quick_answers/result_loader.h +++ b/chromeos/components/quick_answers/result_loader.h
@@ -8,12 +8,12 @@ #include <memory> #include <string> +#include "base/memory/weak_ptr.h" #include "chromeos/components/quick_answers/search_result_parsers/search_response_parser.h" -class GURL; - namespace network { class SimpleURLLoader; +struct ResourceRequest; namespace mojom { class URLLoaderFactory; @@ -24,6 +24,7 @@ namespace quick_answers { enum class IntentType; +struct PreprocessedOutput; class ResultLoader { public: @@ -51,6 +52,9 @@ using ResponseParserCallback = base::OnceCallback<void(std::unique_ptr<QuickAnswer> quick_answer)>; + using BuildRequestCallback = base::OnceCallback<void( + std::unique_ptr<network::ResourceRequest> resource_request)>; + ResultLoader(network::mojom::URLLoaderFactory* url_loader_factory, ResultLoaderDelegate* delegate); @@ -70,11 +74,12 @@ // calling |ResultLoaderDelegate| methods when finished. // Note that delegate methods should be called only once per // ResultLoader instance. Virtual for testing. - virtual void Fetch(const std::string& selected_text); + virtual void Fetch(const PreprocessedOutput& preprocessed_output); protected: // Builds the request URL from |selected_text|. - virtual GURL BuildRequestUrl(const std::string& selected_text) const = 0; + virtual void BuildRequest(const PreprocessedOutput& preprocessed_output, + BuildRequestCallback callback) const = 0; // Process the |response_body| and invoked the callback with |QuickAnswer|. virtual void ProcessResponse(std::unique_ptr<std::string> response_body, @@ -85,11 +90,15 @@ std::unique_ptr<network::SimpleURLLoader> loader_; ResultLoaderDelegate* const delegate_; + void OnBuildRequestComplete( + std::unique_ptr<network::ResourceRequest> resource_request); void OnSimpleURLLoaderComplete(std::unique_ptr<std::string> response_body); void OnResultParserComplete(std::unique_ptr<QuickAnswer> quick_answer); // Time when the query is issued. base::TimeTicks fetch_start_time_; + + base::WeakPtrFactory<ResultLoader> weak_factory_{this}; }; } // namespace quick_answers
diff --git a/chromeos/components/quick_answers/search_result_loader.cc b/chromeos/components/quick_answers/search_result_loader.cc index e496bea..005f294b 100644 --- a/chromeos/components/quick_answers/search_result_loader.cc +++ b/chromeos/components/quick_answers/search_result_loader.cc
@@ -11,6 +11,7 @@ #include "chromeos/services/assistant/public/shared/constants.h" #include "net/base/escape.h" #include "net/base/url_util.h" +#include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/simple_url_loader.h" #include "url/gurl.h" @@ -70,15 +71,19 @@ SearchResultLoader::~SearchResultLoader() = default; -GURL SearchResultLoader::BuildRequestUrl( - const std::string& selected_text) const { - GURL result = GURL(assistant::kKnowledgeApiEndpoint); +void SearchResultLoader::BuildRequest( + const PreprocessedOutput& preprocessed_output, + BuildRequestCallback callback) const { + GURL url = GURL(assistant::kKnowledgeApiEndpoint); // Add encoded request payload. - result = net::AppendOrReplaceQueryParameter( - result, assistant::kPayloadParamName, - BuildSearchRequestPayload(selected_text)); - return result; + url = net::AppendOrReplaceQueryParameter( + url, assistant::kPayloadParamName, + BuildSearchRequestPayload(preprocessed_output.query)); + + auto resource_request = std::make_unique<network::ResourceRequest>(); + resource_request->url = url; + std::move(callback).Run(std::move(resource_request)); } void SearchResultLoader::ProcessResponse(
diff --git a/chromeos/components/quick_answers/search_result_loader.h b/chromeos/components/quick_answers/search_result_loader.h index bfe6b80..9f99ca8 100644 --- a/chromeos/components/quick_answers/search_result_loader.h +++ b/chromeos/components/quick_answers/search_result_loader.h
@@ -31,7 +31,8 @@ ~SearchResultLoader() override; // ResultLoader: - GURL BuildRequestUrl(const std::string& selected_text) const override; + void BuildRequest(const PreprocessedOutput& preprocessed_output, + BuildRequestCallback callback) const override; void ProcessResponse(std::unique_ptr<std::string> response_body, ResponseParserCallback complete_callback) override;
diff --git a/chromeos/components/quick_answers/search_result_loader_unittest.cc b/chromeos/components/quick_answers/search_result_loader_unittest.cc index 54ca4887..e2f29bf 100644 --- a/chromeos/components/quick_answers/search_result_loader_unittest.cc +++ b/chromeos/components/quick_answers/search_result_loader_unittest.cc
@@ -10,6 +10,7 @@ #include "base/test/task_environment.h" #include "chromeos/components/quick_answers/quick_answers_model.h" #include "chromeos/components/quick_answers/test/test_helpers.h" +#include "chromeos/components/quick_answers/utils/quick_answers_utils.h" #include "chromeos/services/assistant/public/shared/constants.h" #include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h" #include "services/network/test/test_url_loader_factory.h" @@ -78,7 +79,7 @@ *mock_delegate_, OnQuickAnswerReceived(QuickAnswerEqual(&(*expected_quick_answer)))); EXPECT_CALL(*mock_delegate_, OnNetworkError()).Times(0); - loader_->Fetch("23cm"); + loader_->Fetch(PreprocessRequest(IntentInfo("23cm", IntentType::kUnknown))); base::RunLoop().RunUntilIdle(); } @@ -89,7 +90,7 @@ network::URLLoaderCompletionStatus(net::HTTP_NOT_FOUND)); EXPECT_CALL(*mock_delegate_, OnNetworkError()); EXPECT_CALL(*mock_delegate_, OnQuickAnswerReceived(testing::_)).Times(0); - loader_->Fetch("23cm"); + loader_->Fetch(PreprocessRequest(IntentInfo("23cm", IntentType::kUnknown))); base::RunLoop().RunUntilIdle(); } @@ -98,7 +99,7 @@ std::string()); EXPECT_CALL(*mock_delegate_, OnQuickAnswerReceived(testing::Eq(nullptr))); EXPECT_CALL(*mock_delegate_, OnNetworkError()).Times(0); - loader_->Fetch("23cm"); + loader_->Fetch(PreprocessRequest(IntentInfo("23cm", IntentType::kUnknown))); base::RunLoop().RunUntilIdle(); }
diff --git a/chromeos/components/quick_answers/test/test_helpers.h b/chromeos/components/quick_answers/test/test_helpers.h index eed9017..61008225 100644 --- a/chromeos/components/quick_answers/test/test_helpers.h +++ b/chromeos/components/quick_answers/test/test_helpers.h
@@ -50,6 +50,10 @@ return (arg.selected_text == quick_answers_request.selected_text); } +MATCHER_P(PreprocessedOutputEqual, preprocessed_output, "") { + return (arg.query == preprocessed_output.query); +} + } // namespace quick_answers } // namespace chromeos
diff --git a/chromeos/components/quick_answers/translation_response_parser.cc b/chromeos/components/quick_answers/translation_response_parser.cc new file mode 100644 index 0000000..5272203 --- /dev/null +++ b/chromeos/components/quick_answers/translation_response_parser.cc
@@ -0,0 +1,70 @@ +// 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 "chromeos/components/quick_answers/translation_response_parser.h" + +#include <utility> + +#include "base/bind.h" +#include "base/values.h" +#include "chromeos/components/quick_answers/search_result_parsers/result_parser.h" + +namespace chromeos { +namespace quick_answers { + +TranslationResponseParser::TranslationResponseParser( + TranslationResponseParserCallback complete_callback) + : complete_callback_(std::move(complete_callback)) {} + +TranslationResponseParser::~TranslationResponseParser() { + if (complete_callback_) + std::move(complete_callback_).Run(/*quick_answer=*/nullptr); +} + +void TranslationResponseParser::ProcessResponse( + std::unique_ptr<std::string> response_body) { + data_decoder::DataDecoder::ParseJsonIsolated( + response_body->c_str(), + base::BindOnce(&TranslationResponseParser::OnJsonParsed, + weak_factory_.GetWeakPtr())); +} + +void TranslationResponseParser::OnJsonParsed( + data_decoder::DataDecoder::ValueOrError result) { + DCHECK(complete_callback_); + + if (!result.value) { + LOG(ERROR) << "JSON parsing failed: " << *result.error; + std::move(complete_callback_).Run(nullptr); + return; + } + + auto* translations = result.value->FindListPath("data.translations"); + if (!translations) { + LOG(ERROR) << "Can't find translations result list."; + std::move(complete_callback_).Run(nullptr); + return; + } + + DCHECK(translations->GetList().size() == 1); + + const std::string* translated_text = + translations->GetList().front().FindStringPath("translatedText"); + if (!translated_text) { + LOG(ERROR) << "Can't find a translated text."; + std::move(complete_callback_).Run(nullptr); + return; + } + + auto quick_answer = std::make_unique<QuickAnswer>(); + quick_answer->result_type = ResultType::kTranslationResult; + quick_answer->primary_answer = *translated_text; + quick_answer->first_answer_row.push_back( + std::make_unique<QuickAnswerResultText>(*translated_text)); + + std::move(complete_callback_).Run(std::move(quick_answer)); +} + +} // namespace quick_answers +} // namespace chromeos
diff --git a/chromeos/components/quick_answers/translation_response_parser.h b/chromeos/components/quick_answers/translation_response_parser.h new file mode 100644 index 0000000..f914bc7d --- /dev/null +++ b/chromeos/components/quick_answers/translation_response_parser.h
@@ -0,0 +1,51 @@ +// 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 CHROMEOS_COMPONENTS_QUICK_ANSWERS_TRANSLATION_RESPONSE_PARSER_H_ +#define CHROMEOS_COMPONENTS_QUICK_ANSWERS_TRANSLATION_RESPONSE_PARSER_H_ + +#include <memory> +#include <string> + +#include "base/callback.h" +#include "base/memory/weak_ptr.h" +#include "services/data_decoder/public/cpp/data_decoder.h" + +namespace chromeos { +namespace quick_answers { + +struct QuickAnswer; + +// Parser for extracting quick answer result out of the cloud translation +// response. +class TranslationResponseParser { + public: + // Callback used when parsing of |quick_answer| is complete. Note that + // |quick_answer| may be |nullptr|. + using TranslationResponseParserCallback = + base::OnceCallback<void(std::unique_ptr<QuickAnswer> quick_answer)>; + + explicit TranslationResponseParser( + TranslationResponseParserCallback complete_callback); + ~TranslationResponseParser(); + + TranslationResponseParser(const TranslationResponseParser&) = delete; + TranslationResponseParser& operator=(const TranslationResponseParser&) = + delete; + + // Starts processing the search response. + void ProcessResponse(std::unique_ptr<std::string> response_body); + + private: + void OnJsonParsed(data_decoder::DataDecoder::ValueOrError result); + + TranslationResponseParserCallback complete_callback_; + + base::WeakPtrFactory<TranslationResponseParser> weak_factory_{this}; +}; + +} // namespace quick_answers +} // namespace chromeos + +#endif // CHROMEOS_COMPONENTS_QUICK_ANSWERS_TRANSLATION_RESPONSE_PARSER_H_
diff --git a/chromeos/components/quick_answers/translation_result_loader.cc b/chromeos/components/quick_answers/translation_result_loader.cc new file mode 100644 index 0000000..7e67af20 --- /dev/null +++ b/chromeos/components/quick_answers/translation_result_loader.cc
@@ -0,0 +1,107 @@ +// 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 "chromeos/components/quick_answers/translation_result_loader.h" + +#include <utility> + +#include "ash/public/cpp/quick_answers/controller/quick_answers_browser_client.h" +#include "base/json/json_writer.h" +#include "chromeos/components/quick_answers/quick_answers_model.h" +#include "chromeos/services/assistant/public/shared/constants.h" +#include "net/base/escape.h" +#include "net/base/url_util.h" +#include "services/network/public/cpp/resource_request.h" +#include "services/network/public/cpp/simple_url_loader.h" +#include "url/gurl.h" + +namespace chromeos { +namespace quick_answers { +namespace { + +using base::Value; +using network::mojom::URLLoaderFactory; + +// The JSON we generate looks like this: +// { +// "q": [ +// "test input" +// ], +// "source": "en", +// "target": "zh" +// } + +constexpr char kTranslationAPIUrl[] = + "https://translation.googleapis.com/language/translate/v2"; +constexpr char kAuthorizationHeaderFormat[] = "Bearer "; + +constexpr base::StringPiece kQueryKey = "q"; +constexpr base::StringPiece kSourceLanguageKey = "source"; +constexpr base::StringPiece kTargetLanguageKey = "target"; + +std::string BuildTranslationRequestBody(const IntentInfo& intent_info) { + Value payload(Value::Type::DICTIONARY); + + Value query(Value::Type::LIST); + query.Append(intent_info.intent_text); + payload.SetKey(kQueryKey, std::move(query)); + + payload.SetKey(kSourceLanguageKey, Value(intent_info.source_language)); + payload.SetKey(kTargetLanguageKey, Value(intent_info.target_language)); + + std::string request_payload_str; + base::JSONWriter::Write(payload, &request_payload_str); + + return request_payload_str; +} + +} // namespace + +TranslationResultLoader::TranslationResultLoader( + URLLoaderFactory* url_loader_factory, + ResultLoaderDelegate* delegate) + : ResultLoader(url_loader_factory, delegate) {} + +TranslationResultLoader::~TranslationResultLoader() = default; + +void TranslationResultLoader::BuildRequest( + const PreprocessedOutput& preprocessed_output, + BuildRequestCallback callback) const { + ash::QuickAnswersBrowserClient::Get()->RequestAccessToken(base::BindOnce( + &TranslationResultLoader::OnRequestAccessTokenComplete, + base::Unretained(this), preprocessed_output, std::move(callback))); +} + +void TranslationResultLoader::ProcessResponse( + std::unique_ptr<std::string> response_body, + ResponseParserCallback complete_callback) { + translation_response_parser_ = + std::make_unique<TranslationResponseParser>(std::move(complete_callback)); + translation_response_parser_->ProcessResponse(std::move(response_body)); +} + +void TranslationResultLoader::OnRequestAccessTokenComplete( + const PreprocessedOutput& preprocessed_output, + BuildRequestCallback callback, + const std::string& access_token) const { + auto resource_request = std::make_unique<network::ResourceRequest>(); + resource_request->url = GURL(kTranslationAPIUrl); + resource_request->method = net::HttpRequestHeaders::kPostMethod; + resource_request->headers.SetHeader( + net::HttpRequestHeaders::kAuthorization, + kAuthorizationHeaderFormat + access_token); + resource_request->headers.SetHeader(net::HttpRequestHeaders::kAccept, + "application/json"); + resource_request->headers.SetHeader(net::HttpRequestHeaders::kContentType, + "application/json"); + + auto body = BuildTranslationRequestBody(preprocessed_output.intent_info); + resource_request->request_body = new network::ResourceRequestBody(); + resource_request->request_body->AppendBytes(body.c_str(), body.length()); + + std::move(callback).Run(std::move(resource_request)); +} + +} // namespace quick_answers +} // namespace chromeos
diff --git a/chromeos/components/quick_answers/translation_result_loader.h b/chromeos/components/quick_answers/translation_result_loader.h new file mode 100644 index 0000000..4cf091e --- /dev/null +++ b/chromeos/components/quick_answers/translation_result_loader.h
@@ -0,0 +1,51 @@ +// 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 CHROMEOS_COMPONENTS_QUICK_ANSWERS_TRANSLATION_RESULT_LOADER_H_ +#define CHROMEOS_COMPONENTS_QUICK_ANSWERS_TRANSLATION_RESULT_LOADER_H_ + +#include <memory> +#include <string> + +#include "chromeos/components/quick_answers/result_loader.h" +#include "chromeos/components/quick_answers/translation_response_parser.h" + +namespace network { +namespace mojom { +class URLLoaderFactory; +} // namespace mojom +} // namespace network + +namespace chromeos { +namespace quick_answers { + +class TranslationResultLoader : public ResultLoader { + public: + TranslationResultLoader(network::mojom::URLLoaderFactory* url_loader_factory, + ResultLoaderDelegate* delegate); + + TranslationResultLoader(const TranslationResultLoader&) = delete; + TranslationResultLoader& operator=(const TranslationResultLoader&) = delete; + + ~TranslationResultLoader() override; + + // ResultLoader: + void BuildRequest(const PreprocessedOutput& preprocessed_output, + BuildRequestCallback callback) const override; + void ProcessResponse(std::unique_ptr<std::string> response_body, + ResponseParserCallback complete_callback) override; + + private: + void OnRequestAccessTokenComplete( + const PreprocessedOutput& preprocessed_output, + BuildRequestCallback callback, + const std::string& access_token) const; + + std::unique_ptr<TranslationResponseParser> translation_response_parser_; +}; + +} // namespace quick_answers +} // namespace chromeos + +#endif // CHROMEOS_COMPONENTS_QUICK_ANSWERS_TRANSLATION_RESULT_LOADER_H_
diff --git a/chromeos/components/quick_answers/understanding/intent_generator.cc b/chromeos/components/quick_answers/understanding/intent_generator.cc index 8387111..0ff68d3 100644 --- a/chromeos/components/quick_answers/understanding/intent_generator.cc +++ b/chromeos/components/quick_answers/understanding/intent_generator.cc
@@ -159,7 +159,7 @@ const QuickAnswersRequest& request, std::vector<machine_learning::mojom::TextLanguagePtr> languages) { auto intent_type = IntentType::kUnknown; - // TODO(b/b/150034512): Take confidence level into consideration. + // TODO(b/150034512): Take confidence level into consideration. if (languages.empty() || languages.front()->locale == request.context.device_properties.language) { std::move(complete_callback_)
diff --git a/chromeos/components/telemetry_extension_ui/diagnostics_service_converters.cc b/chromeos/components/telemetry_extension_ui/diagnostics_service_converters.cc index 999a1a2..38c2f1d 100644 --- a/chromeos/components/telemetry_extension_ui/diagnostics_service_converters.cc +++ b/chromeos/components/telemetry_extension_ui/diagnostics_service_converters.cc
@@ -94,6 +94,8 @@ return health::mojom::DiagnosticRoutineEnum::kPrimeSearch; case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryDischarge: return health::mojom::DiagnosticRoutineEnum::kBatteryDischarge; + case cros_healthd::mojom::DiagnosticRoutineEnum::kBatteryCharge: + return health::mojom::DiagnosticRoutineEnum::kBatteryCharge; default: return base::nullopt; }
diff --git a/chromeos/components/telemetry_extension_ui/mojom/diagnostics_service.mojom b/chromeos/components/telemetry_extension_ui/mojom/diagnostics_service.mojom index 759a5bd6..8a9af61a 100644 --- a/chromeos/components/telemetry_extension_ui/mojom/diagnostics_service.mojom +++ b/chromeos/components/telemetry_extension_ui/mojom/diagnostics_service.mojom
@@ -275,6 +275,7 @@ kDiskRead = 9, kPrimeSearch = 10, kBatteryDischarge = 11, + kBatteryCharge = 12, }; // Enumeration of each of the possible statuses for a diagnostics routine.
diff --git a/chromeos/components/telemetry_extension_ui/resources/trusted.js b/chromeos/components/telemetry_extension_ui/resources/trusted.js index b2837e00d..8e8f401c 100644 --- a/chromeos/components/telemetry_extension_ui/resources/trusted.js +++ b/chromeos/components/telemetry_extension_ui/resources/trusted.js
@@ -62,6 +62,7 @@ [routineEnum.kDiskRead, 'disk-read'], [routineEnum.kPrimeSearch, 'prime-search'], [routineEnum.kBatteryDischarge, 'battery-discharge'], + [routineEnum.kBatteryCharge, 'battery-charge'], ]); if (this.enumToRoutineName_.size !== routineEnum.MAX_VALUE + 1) {
diff --git a/chromeos/components/telemetry_extension_ui/test/telemetry_extension_ui_browsertest.cc b/chromeos/components/telemetry_extension_ui/test/telemetry_extension_ui_browsertest.cc index 4f61827f..c0bc846 100644 --- a/chromeos/components/telemetry_extension_ui/test/telemetry_extension_ui_browsertest.cc +++ b/chromeos/components/telemetry_extension_ui/test/telemetry_extension_ui_browsertest.cc
@@ -79,6 +79,7 @@ cros_diagnostics::DiagnosticRoutineEnum::kDiskRead, cros_diagnostics::DiagnosticRoutineEnum::kPrimeSearch, cros_diagnostics::DiagnosticRoutineEnum::kBatteryDischarge, + cros_diagnostics::DiagnosticRoutineEnum::kBatteryCharge, }; chromeos::cros_healthd::FakeCrosHealthdClient::Get()
diff --git a/chromeos/components/telemetry_extension_ui/test/untrusted_browsertest.js b/chromeos/components/telemetry_extension_ui/test/untrusted_browsertest.js index d9a5512d..465d24ef 100644 --- a/chromeos/components/telemetry_extension_ui/test/untrusted_browsertest.js +++ b/chromeos/components/telemetry_extension_ui/test/untrusted_browsertest.js
@@ -67,6 +67,7 @@ 'disk-read', 'prime-search', 'battery-discharge', + 'battery-charge', ]); });
diff --git a/chromeos/constants/chromeos_features.cc b/chromeos/constants/chromeos_features.cc index 69de49cf..76dbb27 100644 --- a/chromeos/constants/chromeos_features.cc +++ b/chromeos/constants/chromeos_features.cc
@@ -461,6 +461,10 @@ const base::Feature kQuickAnswersTranslation{"QuickAnswersTranslation", base::FEATURE_DISABLED_BY_DEFAULT}; +// Controls whether to enable quick answers translation using Cloud API. +const base::Feature kQuickAnswersTranslationCloudAPI{ + "QuickAnswersTranslationCloudAPI", base::FEATURE_DISABLED_BY_DEFAULT}; + // Controls whether the PIN auto submit feature is enabled. const base::Feature kQuickUnlockPinAutosubmit{"QuickUnlockPinAutosubmit", base::FEATURE_ENABLED_BY_DEFAULT}; @@ -710,6 +714,10 @@ return base::FeatureList::IsEnabled(kQuickAnswersTranslation); } +bool IsQuickAnswersTranslationCloudAPIEnabled() { + return base::FeatureList::IsEnabled(kQuickAnswersTranslationCloudAPI); +} + bool IsSplitSettingsSyncEnabled() { return base::FeatureList::IsEnabled(kSplitSettingsSync); }
diff --git a/chromeos/constants/chromeos_features.h b/chromeos/constants/chromeos_features.h index 68d8ed9..711b364 100644 --- a/chromeos/constants/chromeos_features.h +++ b/chromeos/constants/chromeos_features.h
@@ -210,6 +210,8 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kQuickAnswersTranslation; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) +extern const base::Feature kQuickAnswersTranslationCloudAPI; +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kQuickUnlockPinAutosubmit; // TODO(crbug.com/1104164) - Remove this once most // users have their preferences backfilled. @@ -306,6 +308,8 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsQuickAnswersTextAnnotatorEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsQuickAnswersTranslationEnabled(); +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) +bool IsQuickAnswersTranslationCloudAPIEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsSplitSettingsSyncEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsViewBasedMultiprofileLoginEnabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsWifiSyncAndroidEnabled();
diff --git a/chromeos/memory/pressure/system_memory_pressure_evaluator.cc b/chromeos/memory/pressure/system_memory_pressure_evaluator.cc index 1ce74e50..3a1c0b638 100644 --- a/chromeos/memory/pressure/system_memory_pressure_evaluator.cc +++ b/chromeos/memory/pressure/system_memory_pressure_evaluator.cc
@@ -30,9 +30,6 @@ namespace chromeos { namespace memory { -const base::Feature kCrOSUserSpaceLowMemoryNotification{ - "CrOSUserSpaceLowMemoryNotification", base::FEATURE_ENABLED_BY_DEFAULT}; - namespace { // Pointer to the SystemMemoryPressureEvaluator used by TabManagerDelegate for // chromeos to need to call into ScheduleEarlyCheck. @@ -49,11 +46,6 @@ // memory pressure notifications in chromeos. constexpr char kMarginMemFile[] = "/sys/kernel/mm/chromeos-low_mem/margin"; -// The available memory file contains the available memory as determined -// by the kernel. -constexpr char kAvailableMemFile[] = - "/sys/kernel/mm/chromeos-low_mem/available"; - // Converts an available memory value in MB to a memory pressure level. base::MemoryPressureListener::MemoryPressureLevel GetMemoryPressureLevelFromAvailable(int available_mb, @@ -67,76 +59,20 @@ return base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE; } -uint64_t ReadAvailableMemoryMB(int available_fd) { - // Read the available memory. - char buf[32] = {}; - - // kernfs/file.c: - // "Once poll/select indicates that the value has changed, you - // need to close and re-open the file, or seek to 0 and read again. - ssize_t bytes_read = HANDLE_EINTR(pread(available_fd, buf, sizeof(buf), 0)); - PCHECK(bytes_read != -1); - - std::string mem_str(buf, bytes_read); - uint64_t available = std::numeric_limits<uint64_t>::max(); - CHECK(base::StringToUint64( - base::TrimWhitespaceASCII(mem_str, base::TrimPositions::TRIM_ALL), - &available)); - - return available; -} - -// This function will wait until the /sys/kernel/mm/chromeos-low_mem/available -// file becomes readable and then read the latest value. This file will only -// become readable once the available memory cross through one of the margin -// values specified in /sys/kernel/mm/chromeos-low_mem/margin, for more -// details see https://crrev.com/c/536336. -bool WaitForMemoryPressureChanges(int available_fd) { - base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, - base::BlockingType::WILL_BLOCK); - - pollfd pfd = {available_fd, POLLPRI | POLLERR, 0}; - int res = HANDLE_EINTR(poll(&pfd, 1, -1)); // Wait indefinitely. - PCHECK(res != -1); - - if (pfd.revents != (POLLPRI | POLLERR)) { - // If we didn't receive POLLPRI | POLLERR it means we likely received - // POLLNVAL because the fd has been closed we will only log an error in - // other situations. - LOG_IF(ERROR, pfd.revents != POLLNVAL) - << "WaitForMemoryPressureChanges received unexpected revents: " - << pfd.revents; - - // We no longer want to wait for a kernel notification if the fd has been - // closed. - return false; - } - - return true; -} - } // namespace SystemMemoryPressureEvaluator::SystemMemoryPressureEvaluator( std::unique_ptr<util::MemoryPressureVoter> voter) : SystemMemoryPressureEvaluator( kMarginMemFile, - kAvailableMemFile, - base::BindRepeating(&WaitForMemoryPressureChanges), /*disable_timer_for_testing*/ false, - base::FeatureList::IsEnabled( - chromeos::memory::kCrOSUserSpaceLowMemoryNotification), std::move(voter)) {} SystemMemoryPressureEvaluator::SystemMemoryPressureEvaluator( const std::string& margin_file, - const std::string& available_file, - base::RepeatingCallback<bool(int)> kernel_waiting_callback, bool disable_timer_for_testing, - bool is_user_space_notify, std::unique_ptr<util::MemoryPressureVoter> voter) : util::SystemMemoryPressureEvaluator(std::move(voter)), - is_user_space_notify_(is_user_space_notify), weak_ptr_factory_(this) { DCHECK(g_system_evaluator == nullptr); g_system_evaluator = this; @@ -151,19 +87,7 @@ critical_pressure_threshold_mb_ = margin_parts[0]; moderate_pressure_threshold_mb_ = margin_parts[1]; - if (is_user_space_notify_) { - chromeos::memory::pressure::UpdateMemoryParameters(); - } - - if (!is_user_space_notify_) { - kernel_waiting_callback_ = base::BindRepeating( - std::move(kernel_waiting_callback), available_mem_file_.get()); - available_mem_file_ = - base::ScopedFD(HANDLE_EINTR(open(available_file.c_str(), O_RDONLY))); - CHECK(available_mem_file_.is_valid()); - - ScheduleWaitForKernelNotification(); - } + chromeos::memory::pressure::UpdateMemoryParameters(); if (!disable_timer_for_testing) { // We will check the memory pressure and report the metric @@ -217,16 +141,6 @@ return margin_values; } -uint64_t SystemMemoryPressureEvaluator::GetAvailableMemoryKB() { - if (is_user_space_notify_) { - return chromeos::memory::pressure::GetAvailableMemoryKB(); - } else { - const uint64_t available_mem_mb = - ReadAvailableMemoryMB(available_mem_file_.get()); - return available_mem_mb * 1024; - } -} - bool SystemMemoryPressureEvaluator::SupportsKernelNotifications() { // Unfortunately at the moment the only way to determine if the chromeos // kernel supports polling on the available file is to observe two values @@ -235,15 +149,20 @@ return SystemMemoryPressureEvaluator::GetMarginFileParts().size() >= 2; } -// CheckMemoryPressure will get the current memory pressure level by reading -// the available file. +// CheckMemoryPressure will get the current memory pressure level by checking +// the available memory. void SystemMemoryPressureEvaluator::CheckMemoryPressure() { + uint64_t mem_avail_mb = + chromeos::memory::pressure::GetAvailableMemoryKB() / 1024; + CheckMemoryPressureImpl(mem_avail_mb); +} + +void SystemMemoryPressureEvaluator::CheckMemoryPressureImpl( + uint64_t mem_avail_mb) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto old_vote = current_vote(); - uint64_t mem_avail_mb = GetAvailableMemoryKB() / 1024; - SetCurrentVote(GetMemoryPressureLevelFromAvailable( mem_avail_mb, moderate_pressure_threshold_mb_, critical_pressure_threshold_mb_)); @@ -279,22 +198,6 @@ SendCurrentVote(notify); } -void SystemMemoryPressureEvaluator::HandleKernelNotification(bool result) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - // If WaitForKernelNotification returned false then the FD has been closed and - // we just exit without waiting again. - if (!result) { - return; - } - - CheckMemoryPressure(); - - // Now we need to schedule back our blocking task to wait for more - // kernel notifications. - ScheduleWaitForKernelNotification(); -} - void SystemMemoryPressureEvaluator::CheckMemoryPressureAndRecordStatistics() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -319,16 +222,5 @@ weak_ptr_factory_.GetWeakPtr())); } -void SystemMemoryPressureEvaluator::ScheduleWaitForKernelNotification() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - base::ThreadPool::PostTaskAndReplyWithResult( - FROM_HERE, - {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, - base::BindOnce(kernel_waiting_callback_), - base::BindOnce(&SystemMemoryPressureEvaluator::HandleKernelNotification, - weak_ptr_factory_.GetWeakPtr())); -} - } // namespace memory } // namespace chromeos
diff --git a/chromeos/memory/pressure/system_memory_pressure_evaluator.h b/chromeos/memory/pressure/system_memory_pressure_evaluator.h index 3c40e6f8..33ffc310 100644 --- a/chromeos/memory/pressure/system_memory_pressure_evaluator.h +++ b/chromeos/memory/pressure/system_memory_pressure_evaluator.h
@@ -22,9 +22,6 @@ namespace chromeos { namespace memory { -// A feature which controls user space low memory notification. -extern const base::Feature kCrOSUserSpaceLowMemoryNotification; - //////////////////////////////////////////////////////////////////////////////// // SystemMemoryPressureEvaluator // @@ -50,9 +47,6 @@ // is moderate memory pressure level. static std::vector<int> GetMarginFileParts(); - // GetAvailableMemoryKB returns the available memory in KiB. - uint64_t GetAvailableMemoryKB(); - // SupportsKernelNotifications will return true if the kernel supports and is // configured for notifications on memory availability changes. static bool SupportsKernelNotifications(); @@ -79,19 +73,17 @@ // This constructor is only used for testing. SystemMemoryPressureEvaluator( const std::string& margin_file, - const std::string& available_file, - base::RepeatingCallback<bool(int)> kernel_waiting_callback, bool disable_timer_for_testing, - bool is_user_space_notify, std::unique_ptr<util::MemoryPressureVoter> voter); static std::vector<int> GetMarginFileParts(const std::string& margin_file); void CheckMemoryPressure(); + // Split CheckMemoryPressure and CheckMemoryPressureImpl for testing. + void CheckMemoryPressureImpl(uint64_t mem_avail_mb); + private: - void HandleKernelNotification(bool result); - void ScheduleWaitForKernelNotification(); void CheckMemoryPressureAndRecordStatistics(); int moderate_pressure_threshold_mb_ = 0; int critical_pressure_threshold_mb_ = 0; @@ -104,22 +96,10 @@ // Memory.PressureLevel metric. base::TimeTicks last_pressure_level_report_; - // File descriptor used to read and poll(2) available memory from sysfs, - // In /sys/kernel/mm/chromeos-low_mem/available. - base::ScopedFD available_mem_file_; - // A timer to check the memory pressure and to report an UMA metric // periodically. base::RepeatingTimer checking_timer_; - // Kernel waiting callback which is responsible for blocking on the - // available file until it receives a kernel notification, this is - // configurable to make testing easier. - base::RepeatingCallback<bool()> kernel_waiting_callback_; - - // User space low memory notification mode. - const bool is_user_space_notify_; - SEQUENCE_CHECKER(sequence_checker_); base::WeakPtrFactory<SystemMemoryPressureEvaluator> weak_ptr_factory_;
diff --git a/chromeos/memory/pressure/system_memory_pressure_evaluator_unittest.cc b/chromeos/memory/pressure/system_memory_pressure_evaluator_unittest.cc index c59a64e..189a8ce 100644 --- a/chromeos/memory/pressure/system_memory_pressure_evaluator_unittest.cc +++ b/chromeos/memory/pressure/system_memory_pressure_evaluator_unittest.cc
@@ -27,27 +27,6 @@ namespace { -// Since it would be very hard to mock sysfs instead we will send in our own -// implementation of WaitForKernelNotification which instead will block on a -// pipe that we can trigger for the test to cause a mock kernel notification. -bool WaitForMockKernelNotification(int pipe_read_fd, int available_fd) { - base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, - base::BlockingType::WILL_BLOCK); - - // We just use a pipe to block our kernel notification thread until we have - // a fake kernel notification. - char buf = 0; - int res = HANDLE_EINTR(read(pipe_read_fd, &buf, sizeof(buf))); - - // Fail if we encounter any error. - return res > 0; -} - -void TriggerKernelNotification(int pipe_write_fd) { - char buf = '1'; - HANDLE_EINTR(write(pipe_write_fd, &buf, sizeof(buf))); -} - // Processes OnMemoryPressure calls by just storing the sequence of events so we // can validate that we received the expected pressure levels as the test runs. void OnMemoryPressure( @@ -56,37 +35,26 @@ history->push_back(level); } -void RunLoopRunWithTimeout(base::TimeDelta timeout) { - base::RunLoop run_loop; - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE, - - run_loop.QuitClosure(), - timeout); - run_loop.Run(); -} - } // namespace class TestSystemMemoryPressureEvaluator : public SystemMemoryPressureEvaluator { public: TestSystemMemoryPressureEvaluator( const std::string& mock_margin_file, - const std::string& mock_available_file, - base::RepeatingCallback<bool(int)> kernel_waiting_callback, bool disable_timer_for_testing, - bool is_user_space_notify, std::unique_ptr<util::MemoryPressureVoter> voter) : SystemMemoryPressureEvaluator(mock_margin_file, - mock_available_file, - std::move(kernel_waiting_callback), disable_timer_for_testing, - is_user_space_notify, std::move(voter)) {} static std::vector<int> GetMarginFileParts(const std::string& file) { return SystemMemoryPressureEvaluator::GetMarginFileParts(file); } + void CheckMemoryPressureImpl(uint64_t mem_avail_mb) { + SystemMemoryPressureEvaluator::CheckMemoryPressureImpl(mem_avail_mb); + } + ~TestSystemMemoryPressureEvaluator() override = default; private: @@ -145,16 +113,11 @@ ASSERT_TRUE(tmp_dir.CreateUniqueTempDir()); base::FilePath margin_file = tmp_dir.GetPath().Append("margin"); - base::FilePath available_file = tmp_dir.GetPath().Append("available"); // Set the margin values to 500 (critical) and 1000 (moderate). const std::string kMarginContents = "500 1000"; ASSERT_TRUE(base::WriteFile(margin_file, kMarginContents)); - // Write the initial available contents. - const std::string kInitialAvailableContents = "1500"; - ASSERT_TRUE(base::WriteFile(available_file, kInitialAvailableContents)); - base::test::TaskEnvironment task_environment( base::test::TaskEnvironment::MainThreadType::UI); @@ -170,21 +133,8 @@ util::MultiSourceMemoryPressureMonitor monitor; monitor.ResetSystemEvaluatorForTesting(); - // We use a pipe to notify our blocked kernel notification thread that there - // is a kernel notification we need to use a simple blocking syscall and - // read(2)/write(2) will work. - int fds[2] = {}; - ASSERT_EQ(0, HANDLE_EINTR(pipe(fds))); - - // Make sure the pipe FDs get closed. - base::ScopedFD write_end(fds[1]); - base::ScopedFD read_end(fds[0]); - auto evaluator = std::make_unique<TestSystemMemoryPressureEvaluator>( - margin_file.value(), available_file.value(), - // Bind the read end to WaitForMockKernelNotification. - base::BindRepeating(&WaitForMockKernelNotification, read_end.get()), - /*disable_timer_for_testing=*/true, /*is_user_space_notify*/ false, + margin_file.value(), /*disable_timer_for_testing=*/true, monitor.CreateVoter()); // Validate that our margin levels are as expected after being parsed from our @@ -197,39 +147,32 @@ evaluator->current_vote()); // Moderate Pressure. - ASSERT_TRUE(base::WriteFile(available_file, "900")); - TriggerKernelNotification(write_end.get()); - // TODO(bgeffon): Use RunLoop::QuitClosure() instead of relying on "spin for - // 1 second". - RunLoopRunWithTimeout(base::TimeDelta::FromSeconds(1)); + evaluator->CheckMemoryPressureImpl(900); + base::RunLoop().RunUntilIdle(); ASSERT_EQ(base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE, evaluator->current_vote()); // Critical Pressure. - ASSERT_TRUE(base::WriteFile(available_file, "450")); - TriggerKernelNotification(write_end.get()); - RunLoopRunWithTimeout(base::TimeDelta::FromSeconds(1)); + evaluator->CheckMemoryPressureImpl(450); + base::RunLoop().RunUntilIdle(); ASSERT_EQ(base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL, evaluator->current_vote()); // Moderate Pressure. - ASSERT_TRUE(base::WriteFile(available_file, "550")); - TriggerKernelNotification(write_end.get()); - RunLoopRunWithTimeout(base::TimeDelta::FromSeconds(1)); + evaluator->CheckMemoryPressureImpl(550); + base::RunLoop().RunUntilIdle(); ASSERT_EQ(base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE, evaluator->current_vote()); // No pressure, note: this will not cause any event. - ASSERT_TRUE(base::WriteFile(available_file, "1150")); - TriggerKernelNotification(write_end.get()); - RunLoopRunWithTimeout(base::TimeDelta::FromSeconds(1)); + evaluator->CheckMemoryPressureImpl(1150); + base::RunLoop().RunUntilIdle(); ASSERT_EQ(base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE, evaluator->current_vote()); // Back into moderate. - ASSERT_TRUE(base::WriteFile(available_file, "950")); - TriggerKernelNotification(write_end.get()); - RunLoopRunWithTimeout(base::TimeDelta::FromSeconds(1)); + evaluator->CheckMemoryPressureImpl(950); + base::RunLoop().RunUntilIdle(); ASSERT_EQ(base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE, evaluator->current_vote());
diff --git a/chromeos/profiles/orderfile.newest.txt b/chromeos/profiles/orderfile.newest.txt index 2cf27a6..657917c 100644 --- a/chromeos/profiles/orderfile.newest.txt +++ b/chromeos/profiles/orderfile.newest.txt
@@ -1 +1 @@ -chromeos-chrome-orderfile-field-87-4258.0-1600689257-benchmark-87.0.4274.0-r1.orderfile.xz +chromeos-chrome-orderfile-field-87-4265.0-1601289755-benchmark-87.0.4275.0-r1.orderfile.xz
diff --git a/components/arc/arc_features.cc b/components/arc/arc_features.cc index 0e3b435..5cb36aa3 100644 --- a/components/arc/arc_features.cc +++ b/components/arc/arc_features.cc
@@ -73,12 +73,6 @@ const base::Feature kPictureInPictureFeature{"ArcPictureInPicture", base::FEATURE_ENABLED_BY_DEFAULT}; -// Controls Smart Text Selection for Chrome. -// When enabled, the context menu will show contextual quick actions based on -// the current text selection. -const base::Feature kSmartTextSelectionFeature{ - "ArcSmartTextSelection", base::FEATURE_ENABLED_BY_DEFAULT}; - // Controls ARC USB host integration. // When enabled, Android apps will be able to use usb host features. const base::Feature kUsbHostFeature{"ArcUsbHost",
diff --git a/components/arc/arc_features.h b/components/arc/arc_features.h index bd77e6e..0c935e2 100644 --- a/components/arc/arc_features.h +++ b/components/arc/arc_features.h
@@ -26,7 +26,6 @@ extern const base::Feature kNativeBridge64BitSupportExperimentFeature; extern const base::Feature kNativeBridgeToggleFeature; extern const base::Feature kPictureInPictureFeature; -extern const base::Feature kSmartTextSelectionFeature; extern const base::Feature kUsbHostFeature; extern const base::Feature kUsbStorageUIFeature; extern const base::Feature kVideoDecoder;
diff --git a/components/arc/session/arc_vm_client_adapter.cc b/components/arc/session/arc_vm_client_adapter.cc index 86d80a7..aeca7d62 100644 --- a/components/arc/session/arc_vm_client_adapter.cc +++ b/components/arc/session/arc_vm_client_adapter.cc
@@ -23,6 +23,7 @@ #include "base/logging.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "base/metrics/histogram_functions.h" #include "base/no_destructor.h" #include "base/optional.h" #include "base/posix/eintr_wrapper.h" @@ -78,6 +79,14 @@ constexpr const char kArcVmBootNotificationServerSocketPath[] = "/run/arcvm_boot_notification_server/host.socket"; +constexpr base::TimeDelta kArcBugReportBackupTimeMetricMinTime = + base::TimeDelta::FromMilliseconds(1); +constexpr base::TimeDelta kArcBugReportBackupTimeMetricMaxTime = + base::TimeDelta::FromSeconds(60); +constexpr int kArcBugReportBackupTimeMetricBuckets = 50; +constexpr const char kArcBugReportBackupTimeMetric[] = + "Login.ArcBugReportBackupTime"; + constexpr int64_t kInvalidCid = -1; constexpr base::TimeDelta kConnectTimeoutLimit = @@ -543,7 +552,7 @@ GetDebugDaemonClient()->BackupArcBugReport( cryptohome::CreateAccountIdentifierFromIdentification(cryptohome_id_), base::BindOnce(&ArcVmClientAdapter::OnArcBugReportBackedUp, - weak_factory_.GetWeakPtr())); + weak_factory_.GetWeakPtr(), base::TimeTicks::Now())); } else { StopArcInstanceInternal(); } @@ -577,9 +586,18 @@ void ConciergeServiceStarted() override {} private: - void OnArcBugReportBackedUp(bool result) { - VLOG(1) << "OnArcBugReportBackedUp: back up " - << (result ? "done" : "failed"); + void OnArcBugReportBackedUp(base::TimeTicks arc_bug_report_backup_time, + bool result) { + if (result) { + base::TimeDelta elapsed_time = + base::TimeTicks::Now() - arc_bug_report_backup_time; + base::UmaHistogramCustomTimes(kArcBugReportBackupTimeMetric, elapsed_time, + kArcBugReportBackupTimeMetricMinTime, + kArcBugReportBackupTimeMetricMaxTime, + kArcBugReportBackupTimeMetricBuckets); + } else { + LOG(ERROR) << "Error contacting debugd to back up ARC bug report."; + } StopArcInstanceInternal(); }
diff --git a/components/autofill/ios/browser/autofill_agent.mm b/components/autofill/ios/browser/autofill_agent.mm index 9d00475..34f9617 100644 --- a/components/autofill/ios/browser/autofill_agent.mm +++ b/components/autofill/ios/browser/autofill_agent.mm
@@ -16,6 +16,7 @@ #include "base/memory/weak_ptr.h" #include "base/metrics/field_trial.h" #include "base/strings/string16.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" @@ -62,8 +63,10 @@ #error "This file requires ARC support." #endif +using base::NumberToString; using base::SysNSStringToUTF8; using base::SysNSStringToUTF16; +using base::SysUTF16ToNSString; using autofill::FormRendererId; using autofill::FieldDataManager; using autofill::FieldRendererId; @@ -145,10 +148,11 @@ // Manager for Autofill JavaScripts. JsAutofillManager* _jsAutofillManager; - // The name of the most recent autocomplete field; tracks the currently- - // focused form element in order to force filling of the currently selected - // form element, even if it's non-empty. + // The name and the unique renderer ID of the most recent autocomplete field; + // tracks the currently-focused form element in order to force filling of + // the currently selected form element, even if it's non-empty. base::string16 _pendingAutocompleteField; + FieldRendererId _pendingAutocompleteFieldID; // Suggestions state: // The most recent form suggestions. @@ -428,6 +432,7 @@ if (suggestion.identifier > 0) { _pendingAutocompleteField = SysNSStringToUTF16(fieldIdentifier); + _pendingAutocompleteFieldID = uniqueFieldID; if (_popupDelegate) { // TODO(966411): Replace 0 with the index of the selected suggestion. _popupDelegate->DidAcceptSuggestion(SysNSStringToUTF16(suggestion.value), @@ -482,7 +487,14 @@ auto autofillData = std::make_unique<base::Value>(base::Value::Type::DICTIONARY); autofillData->SetKey("formName", base::Value(base::UTF16ToUTF8(form.name))); + uint32_t formRendererID = form.unique_renderer_id + ? form.unique_renderer_id.value() + : autofill::kNotSetRendererID; + autofillData->SetKey("formRendererID", + base::Value(static_cast<int>(formRendererID))); + bool useRendererIDs = base::FeatureList::IsEnabled( + autofill::features::kAutofillUseUniqueRendererIDsOnIOS); base::Value fieldsData(base::Value::Type::DICTIONARY); for (const auto& field : form.fields) { // Skip empty fields and those that are not autofilled. @@ -492,7 +504,15 @@ base::Value fieldData(base::Value::Type::DICTIONARY); fieldData.SetKey("value", base::Value(field.value)); fieldData.SetKey("section", base::Value(field.section)); - fieldsData.SetKey(base::UTF16ToUTF8(field.unique_id), std::move(fieldData)); + uint32_t fieldRendererID = field.unique_renderer_id + ? field.unique_renderer_id.value() + : autofill::kNotSetRendererID; + if (useRendererIDs) { + fieldsData.SetKey(NumberToString(fieldRendererID), std::move(fieldData)); + } else { + fieldsData.SetKey(base::UTF16ToUTF8(field.unique_id), + std::move(fieldData)); + } } autofillData->SetKey("fields", std::move(fieldsData)); @@ -570,16 +590,16 @@ // Value will contain the text to be filled in the selected element while // displayDescription will contain a summary of the data to be filled in // the other elements. - value = base::SysUTF16ToNSString(popup_suggestion.value); - displayDescription = base::SysUTF16ToNSString(popup_suggestion.label); + value = SysUTF16ToNSString(popup_suggestion.value); + displayDescription = SysUTF16ToNSString(popup_suggestion.label); } else if (popup_suggestion.frontend_id == autofill::POPUP_ITEM_ID_CLEAR_FORM) { // Show the "clear form" button. - value = base::SysUTF16ToNSString(popup_suggestion.value); + value = SysUTF16ToNSString(popup_suggestion.value); } else if (popup_suggestion.frontend_id == autofill::POPUP_ITEM_ID_SHOW_ACCOUNT_CARDS) { // Show opt-in for showing cards from account. - value = base::SysUTF16ToNSString(popup_suggestion.value); + value = SysUTF16ToNSString(popup_suggestion.value); } if (!value) @@ -917,8 +937,8 @@ } copy]; __weak AutofillAgent* weakSelf = self; [_jsAutofillManager fillForm:std::move(data) - forceFillFieldIdentifier:base::SysUTF16ToNSString( - _pendingAutocompleteField) + forceFillFieldIdentifier:SysUTF16ToNSString(_pendingAutocompleteField) + forceFillFieldUniqueID:_pendingAutocompleteFieldID inFrame:frame completionHandler:^(NSString* jsonString) { AutofillAgent* strongSelf = weakSelf;
diff --git a/components/autofill/ios/browser/autofill_agent_unittests.mm b/components/autofill/ios/browser/autofill_agent_unittests.mm index 390b6d9..1dac7eb 100644 --- a/components/autofill/ios/browser/autofill_agent_unittests.mm +++ b/components/autofill/ios/browser/autofill_agent_unittests.mm
@@ -125,7 +125,14 @@ // Tests that form's name and fields' identifiers, values, and whether they are // autofilled are sent to the JS. Fields with empty values and those that are // not autofilled are skipped. +// TODO(crbug/1131038): Remove once using only renderer IDs is launched. TEST_F(AutofillAgentTests, OnFormDataFilledTestWithFrameMessaging) { + base::test::ScopedFeatureList scoped_feature_list; + std::vector<base::Feature> disabled_features; + disabled_features.push_back( + autofill::features::kAutofillUseUniqueRendererIDsOnIOS); + scoped_feature_list.InitWithFeatures({}, disabled_features); + std::string locale("en"); autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate( &test_web_state_, &client_, nil, locale, @@ -135,6 +142,7 @@ form.url = GURL("https://myform.com"); form.action = GURL("https://myform.com/submit"); form.name = base::ASCIIToUTF16("CC form"); + form.unique_renderer_id = FormRendererId(0); autofill::FormFieldData field; field.form_control_type = "text"; @@ -145,6 +153,7 @@ field.unique_id = field.id_attribute; field.value = base::ASCIIToUTF16("number_value"); field.is_autofilled = true; + field.unique_renderer_id = FieldRendererId(1); form.fields.push_back(field); field.label = base::ASCIIToUTF16("Name on Card"); field.name = base::ASCIIToUTF16("name"); @@ -153,6 +162,7 @@ field.unique_id = field.id_attribute; field.value = base::ASCIIToUTF16("name_value"); field.is_autofilled = true; + field.unique_renderer_id = FieldRendererId(2); form.fields.push_back(field); field.label = base::ASCIIToUTF16("Expiry Month"); field.name = base::ASCIIToUTF16("expiry_month"); @@ -161,6 +171,7 @@ field.unique_id = field.id_attribute; field.value = base::ASCIIToUTF16("01"); field.is_autofilled = false; + field.unique_renderer_id = FieldRendererId(3); form.fields.push_back(field); field.label = base::ASCIIToUTF16("Unknown field"); field.name = base::ASCIIToUTF16("unknown"); @@ -169,6 +180,7 @@ field.unique_id = field.id_attribute; field.value = base::ASCIIToUTF16(""); field.is_autofilled = true; + field.unique_renderer_id = FieldRendererId(4); form.fields.push_back(field); [autofill_agent_ fillFormData:form @@ -178,14 +190,21 @@ "__gCrWeb.autofill.fillForm({\"fields\":{\"name\":{\"section\":\"\"," "\"value\":\"name_value\"}," "\"number\":{\"section\":\"\",\"value\":\"number_value\"}}," - "\"formName\":\"CC form\"}, \"\");", + "\"formName\":\"CC form\",\"formRendererID\":0}, \"\", -1, false);", fake_main_frame_->GetLastJavaScriptCall()); } -// Tests that in the case of conflict in fields' identifiers, the last seen -// value of a given field is used. +// Tests that form's name and fields' identifiers, values, and whether they are +// autofilled are sent to the JS. Fields with empty values and those that are +// not autofilled are skipped. Tests logic based on renderer ids usage. TEST_F(AutofillAgentTests, - OnFormDataFilledWithNameCollisionTestFrameMessaging) { + OnFormDataFilledTestWithFrameMessagingUsingRendererIDs) { + base::test::ScopedFeatureList scoped_feature_list; + std::vector<base::Feature> enabled_features; + enabled_features.push_back( + autofill::features::kAutofillUseUniqueRendererIDsOnIOS); + scoped_feature_list.InitWithFeatures(enabled_features, {}); + std::string locale("en"); autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate( &test_web_state_, &client_, nil, locale, @@ -194,6 +213,78 @@ autofill::FormData form; form.url = GURL("https://myform.com"); form.action = GURL("https://myform.com/submit"); + form.name = base::ASCIIToUTF16("CC form"); + form.unique_renderer_id = FormRendererId(0); + + autofill::FormFieldData field; + field.form_control_type = "text"; + field.label = base::ASCIIToUTF16("Card number"); + field.name = base::ASCIIToUTF16("number"); + field.name_attribute = field.name; + field.id_attribute = base::ASCIIToUTF16("number"); + field.unique_id = field.id_attribute; + field.value = base::ASCIIToUTF16("number_value"); + field.is_autofilled = true; + field.unique_renderer_id = FieldRendererId(1); + form.fields.push_back(field); + field.label = base::ASCIIToUTF16("Name on Card"); + field.name = base::ASCIIToUTF16("name"); + field.name_attribute = field.name; + field.id_attribute = base::ASCIIToUTF16("name"); + field.unique_id = field.id_attribute; + field.value = base::ASCIIToUTF16("name_value"); + field.is_autofilled = true; + field.unique_renderer_id = FieldRendererId(2); + form.fields.push_back(field); + field.label = base::ASCIIToUTF16("Expiry Month"); + field.name = base::ASCIIToUTF16("expiry_month"); + field.name_attribute = field.name; + field.id_attribute = base::ASCIIToUTF16("expiry_month"); + field.unique_id = field.id_attribute; + field.value = base::ASCIIToUTF16("01"); + field.is_autofilled = false; + field.unique_renderer_id = FieldRendererId(3); + form.fields.push_back(field); + field.label = base::ASCIIToUTF16("Unknown field"); + field.name = base::ASCIIToUTF16("unknown"); + field.name_attribute = field.name; + field.id_attribute = base::ASCIIToUTF16("unknown"); + field.unique_id = field.id_attribute; + field.value = base::ASCIIToUTF16(""); + field.is_autofilled = true; + field.unique_renderer_id = FieldRendererId(4); + form.fields.push_back(field); + [autofill_agent_ + fillFormData:form + inFrame:test_web_state_.GetWebFramesManager()->GetMainWebFrame()]; + test_web_state_.WasShown(); + EXPECT_EQ("__gCrWeb.autofill.fillForm({\"fields\":{\"1\":{\"section\":\"\"," + "\"value\":\"number_value\"}," + "\"2\":{\"section\":\"\",\"value\":\"name_value\"}}," + "\"formName\":\"CC form\",\"formRendererID\":0}, \"\", -1, true);", + fake_main_frame_->GetLastJavaScriptCall()); +} + +// Tests that in the case of conflict in fields' identifiers, the last seen +// value of a given field is used. +// TODO(crbug/1131038): Remove once using only renderer IDs is launched. +TEST_F(AutofillAgentTests, + OnFormDataFilledWithNameCollisionTestFrameMessaging) { + base::test::ScopedFeatureList scoped_feature_list; + std::vector<base::Feature> disabled_features; + disabled_features.push_back( + autofill::features::kAutofillUseUniqueRendererIDsOnIOS); + scoped_feature_list.InitWithFeatures({}, disabled_features); + + std::string locale("en"); + autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate( + &test_web_state_, &client_, nil, locale, + autofill::AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); + + autofill::FormData form; + form.url = GURL("https://myform.com"); + form.action = GURL("https://myform.com/submit"); + form.unique_renderer_id = FormRendererId(0); autofill::FormFieldData field; field.form_control_type = "text"; @@ -204,6 +295,7 @@ field.unique_id = field.id_attribute; field.value = base::ASCIIToUTF16("California"); field.is_autofilled = true; + field.unique_renderer_id = FieldRendererId(1); form.fields.push_back(field); field.label = base::ASCIIToUTF16("Other field"); field.name = base::ASCIIToUTF16("field1"); @@ -212,6 +304,7 @@ field.unique_id = field.id_attribute; field.value = base::ASCIIToUTF16("value 1"); field.is_autofilled = true; + field.unique_renderer_id = FieldRendererId(2); form.fields.push_back(field); field.label = base::ASCIIToUTF16("Other field"); field.name = base::ASCIIToUTF16("field1"); @@ -220,6 +313,7 @@ field.unique_id = field.id_attribute; field.value = base::ASCIIToUTF16("value 2"); field.is_autofilled = true; + field.unique_renderer_id = FieldRendererId(3); form.fields.push_back(field); // Fields are in alphabetical order. [autofill_agent_ @@ -229,7 +323,7 @@ EXPECT_EQ("__gCrWeb.autofill.fillForm({\"fields\":{\"field1\":{\"section\":" "\"\",\"value\":\"value " "2\"},\"region\":{\"section\":\"\",\"value\":\"California\"}}," - "\"formName\":\"\"}, \"\");", + "\"formName\":\"\",\"formRendererID\":0}, \"\", -1, false);", fake_main_frame_->GetLastJavaScriptCall()); }
diff --git a/components/autofill/ios/browser/js_autofill_manager.h b/components/autofill/ios/browser/js_autofill_manager.h index 8312fc3e..26ff1906 100644 --- a/components/autofill/ios/browser/js_autofill_manager.h +++ b/components/autofill/ios/browser/js_autofill_manager.h
@@ -8,6 +8,7 @@ #include "base/ios/block_types.h" #include "base/values.h" #include "components/autofill/core/common/autofill_constants.h" +#include "components/autofill/core/common/renderer_id.h" namespace web { class WebFrame; @@ -43,6 +44,7 @@ // corresponding filled values. |completionHandler| cannot be nil. - (void)fillForm:(std::unique_ptr<base::Value>)data forceFillFieldIdentifier:(NSString*)forceFillFieldIdentifier + forceFillFieldUniqueID:(autofill::FieldRendererId)forceFillFieldUniqueID inFrame:(web::WebFrame*)frame completionHandler:(void (^)(NSString*))completionHandler;
diff --git a/components/autofill/ios/browser/js_autofill_manager.mm b/components/autofill/ios/browser/js_autofill_manager.mm index 4ac1130..d40cbe8 100644 --- a/components/autofill/ios/browser/js_autofill_manager.mm +++ b/components/autofill/ios/browser/js_autofill_manager.mm
@@ -24,6 +24,8 @@ #error "This file requires ARC support." #endif +using autofill::FieldRendererId; + @implementation JsAutofillManager - (void)addJSDelayInFrame:(web::WebFrame*)frame { @@ -93,17 +95,26 @@ - (void)fillForm:(std::unique_ptr<base::Value>)data forceFillFieldIdentifier:(NSString*)forceFillFieldIdentifier + forceFillFieldUniqueID:(FieldRendererId)forceFillFieldUniqueID inFrame:(web::WebFrame*)frame completionHandler:(void (^)(NSString*))completionHandler { DCHECK(data); DCHECK(completionHandler); - std::string fieldIdentifier = + + bool useRendererIDs = base::FeatureList::IsEnabled( + autofill::features::kAutofillUseUniqueRendererIDsOnIOS); + + std::string fieldStringID = forceFillFieldIdentifier ? base::SysNSStringToUTF8(forceFillFieldIdentifier) : "null"; + int fieldNumericID = forceFillFieldUniqueID ? forceFillFieldUniqueID.value() + : autofill::kNotSetRendererID; std::vector<base::Value> parameters; parameters.push_back(std::move(*data)); - parameters.push_back(base::Value(fieldIdentifier)); + parameters.push_back(base::Value(fieldStringID)); + parameters.push_back(base::Value(fieldNumericID)); + parameters.push_back(base::Value(useRendererIDs)); autofill::ExecuteJavaScriptFunction( "autofill.fillForm", parameters, frame, autofill::CreateStringCallback(completionHandler));
diff --git a/components/autofill/ios/browser/resources/autofill_controller.js b/components/autofill/ios/browser/resources/autofill_controller.js index b568a60..d516aa2 100644 --- a/components/autofill/ios/browser/resources/autofill_controller.js +++ b/components/autofill/ios/browser/resources/autofill_controller.js
@@ -21,6 +21,7 @@ * The autofill data for a form. * @typedef {{ * formName: string, + * formRendererID: number, * fields: !Object<string, !Object<string, string>>, * }} */ @@ -189,11 +190,16 @@ * |forceFillFieldName| will always be filled even if non-empty. * * @param {!FormData} data Autofill data to fill in. - * @param {string} forceFillFieldIdentifier Identified field will always be + * @param {string} forceFillFieldStringID Identified field will always be * filled even if non-empty. May be null. + * @param {number} forceFillFieldNumericID Identified field will always be + * filled even if non-empty. May be kNotSetRendererId. + * @param {bool} useRendererIDs Whether the logic should use numeric renderer + * IDs for form filling. * @return {string} JSON encoded list of renderer IDs of filled elements. */ -__gCrWeb.autofill['fillForm'] = function(data, forceFillFieldIdentifier) { +__gCrWeb.autofill['fillForm'] = function( + data, forceFillFieldStringID, forceFillFieldNumericID, useRendererIDs) { // Inject CSS to style the autofilled elements with a yellow background. if (!__gCrWeb.autofill.styleInjected) { const style = document.createElement('style'); @@ -207,7 +213,10 @@ } const filledElements = {}; - const form = __gCrWeb.form.getFormElementFromIdentifier(data.formName); + const form = useRendererIDs ? + __gCrWeb.form.getFormElementFromUniqueFormId(data.formRendererID) : + __gCrWeb.form.getFormElementFromIdentifier(data.formName); + const controlElements = form ? __gCrWeb.form.getFormControlElements(form) : __gCrWeb.fill.getUnownedAutofillableFormFieldElements( @@ -227,7 +236,9 @@ // Skip fields for which autofill data is missing. const fieldIdentifier = __gCrWeb.form.getFieldIdentifier(element); - const fieldData = data.fields[fieldIdentifier]; + const fieldRendererID = __gCrWeb.fill.getUniqueID(element); + const fieldData = useRendererIDs ? data.fields[fieldRendererID] : + data.fields[fieldIdentifier]; if (!fieldData) { continue; } @@ -238,10 +249,12 @@ // always autofilled; see AutofillManager::FillOrPreviewDataModelForm(). // c) The "value" or "placeholder" attributes match the value, if any; or // d) The value has not been set by the user. + const shouldBeForceFilled = useRendererIDs ? + fieldRendererID === forceFillFieldNumericID : + fieldIdentifier === forceFillFieldStringID; if (element.value && __gCrWeb.form.fieldWasEditedByUser(element) && !__gCrWeb.autofill.sanitizedFieldIsEmpty(element.value) && - fieldIdentifier !== forceFillFieldIdentifier && - !__gCrWeb.fill.isSelectElement(element) && + !shouldBeForceFilled && !__gCrWeb.fill.isSelectElement(element) && !((element.hasAttribute('value') && element.getAttribute('value') === element.value) || (element.hasAttribute('placeholder') &&
diff --git a/components/autofill_assistant/browser/generic_ui.proto b/components/autofill_assistant/browser/generic_ui.proto index f27361b..9334e05 100644 --- a/components/autofill_assistant/browser/generic_ui.proto +++ b/components/autofill_assistant/browser/generic_ui.proto
@@ -26,12 +26,13 @@ repeated InteractionProto interactions = 1; } -// An interaction consists of a trigger event and a series of actions. +// An interaction consists of a set of trigger events and a series of actions. message InteractionProto { - // Functions to call each time the event happens, in the specified order. + // Functions to call each time one of the events happens, in the specified + // order. repeated CallbackProto callbacks = 1; - // The trigger event for |callbacks|. - optional EventProto trigger_event = 2; + // The trigger events for |callbacks|. + repeated EventProto trigger_event = 2; } // UI Actions to invoke.
diff --git a/components/autofill_assistant/browser/generic_ui_replace_placeholders.cc b/components/autofill_assistant/browser/generic_ui_replace_placeholders.cc index e8de56530..e2b7721 100644 --- a/components/autofill_assistant/browser/generic_ui_replace_placeholders.cc +++ b/components/autofill_assistant/browser/generic_ui_replace_placeholders.cc
@@ -157,9 +157,8 @@ void ReplacePlaceholdersInInteraction( InteractionProto* in_out_proto, const std::map<std::string, std::string>& placeholders) { - if (in_out_proto->has_trigger_event()) { - ReplacePlaceholdersInEvent(in_out_proto->mutable_trigger_event(), - placeholders); + for (auto& trigger_event : *in_out_proto->mutable_trigger_event()) { + ReplacePlaceholdersInEvent(&trigger_event, placeholders); } for (auto& callback : *in_out_proto->mutable_callbacks()) {
diff --git a/components/autofill_assistant/browser/generic_ui_replace_placeholders_unittest.cc b/components/autofill_assistant/browser/generic_ui_replace_placeholders_unittest.cc index 6120d02..8cee1bb8 100644 --- a/components/autofill_assistant/browser/generic_ui_replace_placeholders_unittest.cc +++ b/components/autofill_assistant/browser/generic_ui_replace_placeholders_unittest.cc
@@ -82,25 +82,25 @@ GenericUserInterfaceProto input; auto* on_value_changed = input.mutable_interactions() ->add_interactions() - ->mutable_trigger_event() + ->add_trigger_event() ->mutable_on_value_changed(); on_value_changed->set_model_identifier("value_${i}"); auto* on_view_clicked = input.mutable_interactions() ->add_interactions() - ->mutable_trigger_event() + ->add_trigger_event() ->mutable_on_view_clicked(); on_view_clicked->set_view_identifier("view_${i}"); auto* on_view_container_cleared = input.mutable_interactions() ->add_interactions() - ->mutable_trigger_event() + ->add_trigger_event() ->mutable_on_view_container_cleared(); on_view_container_cleared->set_view_identifier("view_${i}"); auto* on_popup_dismissed = input.mutable_interactions() ->add_interactions() - ->mutable_trigger_event() + ->add_trigger_event() ->mutable_on_popup_dismissed(); on_popup_dismissed->set_popup_identifier("popup_${i}");
diff --git a/components/content_settings/browser/page_specific_content_settings.cc b/components/content_settings/browser/page_specific_content_settings.cc index b56f59f6..4570fb4c 100644 --- a/components/content_settings/browser/page_specific_content_settings.cc +++ b/components/content_settings/browser/page_specific_content_settings.cc
@@ -577,7 +577,7 @@ if (!status.allowed) { status.allowed = true; access_changed = true; - delegate_->OnContentAllowed(ContentSettingsType::GEOLOCATION); + delegate_->OnContentAllowed(type); } if (access_changed)
diff --git a/components/content_settings/core/common/content_settings_pattern.cc b/components/content_settings/core/common/content_settings_pattern.cc index 2693e1c..7e13ce9 100644 --- a/components/content_settings/core/common/content_settings_pattern.cc +++ b/components/content_settings/core/common/content_settings_pattern.cc
@@ -15,14 +15,12 @@ #include "base/notreached.h" #include "base/optional.h" #include "base/stl_util.h" -#include "base/strings/strcat.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "components/content_settings/core/common/content_settings_pattern_parser.h" #include "net/base/url_util.h" #include "url/gurl.h" -#include "url/url_constants.h" namespace { @@ -242,18 +240,9 @@ parts->scheme = base::ToLowerASCII(parts->scheme); if (parts->scheme == url::kFileScheme && !parts->is_path_wildcard) { - // TODO(crbug.com/1132957): Remove this loop once GURL canonicalization is - // idempotent (see crbug.com/1128999). - while (true) { - std::string url_spec = base::StrCat( - {url::kFileScheme, url::kStandardSchemeSeparator, parts->path}); - GURL url(url_spec); - if (!url.is_valid()) - return false; - if (parts->path == url.path_piece()) - break; - parts->path = url.path(); - } + GURL url(std::string(url::kFileScheme) + + std::string(url::kStandardSchemeSeparator) + parts->path); + parts->path = url.path(); } // Canonicalize the host part.
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn index 5704e982..88dc82b 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn
@@ -208,6 +208,7 @@ ] public_deps = [ + ":buildflags", ":location_bar", "//base", "//base:i18n", @@ -219,7 +220,6 @@ "//url", ] deps = [ - ":buildflags", ":in_memory_url_index_cache_proto", "//components/bookmarks/browser", "//components/component_updater",
diff --git a/components/page_info/android/java/res/layout/page_info_v2.xml b/components/page_info/android/java/res/layout/page_info_v2.xml index c068351..da41c0e7 100644 --- a/components/page_info/android/java/res/layout/page_info_v2.xml +++ b/components/page_info/android/java/res/layout/page_info_v2.xml
@@ -84,19 +84,6 @@ style="@style/FilledButton" /> <org.chromium.ui.widget.ButtonCompat - android:id="@+id/page_info_site_settings_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="end" - android:layout_marginEnd="@dimen/page_info_popup_padding_sides" - android:layout_marginStart="@dimen/page_info_popup_padding_sides" - android:layout_marginTop="2dp" - android:paddingEnd="@dimen/page_info_popup_button_padding_sides" - android:paddingStart="@dimen/page_info_popup_button_padding_sides" - android:text="@string/page_info_site_settings_button" - style="@style/TextButton" /> - - <org.chromium.ui.widget.ButtonCompat android:id="@+id/page_info_open_online_button" android:layout_width="wrap_content" android:layout_height="wrap_content"
diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoViewV2.java b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoViewV2.java index 05cc280..d260b19 100644 --- a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoViewV2.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoViewV2.java
@@ -64,6 +64,9 @@ // TODO(crbug.com/1077766): Migrate image compression UI. } + @Override + protected void initSiteSettings(PageInfoViewParams params) {} + public PageInfoRowView getConnectionRowView() { return mConnectionRow; }
diff --git a/components/paint_preview/player/player_compositor_delegate_unittest.cc b/components/paint_preview/player/player_compositor_delegate_unittest.cc index e3dccbb..b18bf94 100644 --- a/components/paint_preview/player/player_compositor_delegate_unittest.cc +++ b/components/paint_preview/player/player_compositor_delegate_unittest.cc
@@ -155,12 +155,12 @@ FakePaintPreviewCompositorClient* AsFakeClient( PaintPreviewCompositorClient* client) { - return reinterpret_cast<FakePaintPreviewCompositorClient*>(client); + return static_cast<FakePaintPreviewCompositorClient*>(client); } FakePaintPreviewCompositorService* AsFakeService( PaintPreviewCompositorService* service) { - return reinterpret_cast<FakePaintPreviewCompositorService*>(service); + return static_cast<FakePaintPreviewCompositorService*>(service); } class PlayerCompositorDelegateImpl : public PlayerCompositorDelegate {
diff --git a/components/password_manager/core/browser/BUILD.gn b/components/password_manager/core/browser/BUILD.gn index a5fe206..e3a66b10 100644 --- a/components/password_manager/core/browser/BUILD.gn +++ b/components/password_manager/core/browser/BUILD.gn
@@ -498,6 +498,8 @@ "mock_password_sync_metadata_store.h", "password_manager_test_utils.cc", "password_manager_test_utils.h", + "site_affiliation/mock_affiliation_fetcher_factory.cc", + "site_affiliation/mock_affiliation_fetcher_factory.h", "stub_credentials_filter.cc", "stub_credentials_filter.h", "stub_form_saver.cc",
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc b/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc index c766d6c..1b75ea03 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc
@@ -182,6 +182,7 @@ } void AffiliationBackend::OnFetchSucceeded( + AffiliationFetcherInterface* fetcher, std::unique_ptr<AffiliationFetcherDelegate::Result> result) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -229,7 +230,7 @@ } } -void AffiliationBackend::OnFetchFailed() { +void AffiliationBackend::OnFetchFailed(AffiliationFetcherInterface* fetcher) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); fetcher_.reset(); @@ -244,11 +245,12 @@ } } -void AffiliationBackend::OnMalformedResponse() { +void AffiliationBackend::OnMalformedResponse( + AffiliationFetcherInterface* fetcher) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // TODO(engedy): Potentially handle this case differently. crbug.com/437865. - OnFetchFailed(); + OnFetchFailed(fetcher); } bool AffiliationBackend::OnCanSendNetworkRequest() {
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_backend.h b/components/password_manager/core/browser/android_affiliation/affiliation_backend.h index 1693b04..e69e54a 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_backend.h +++ b/components/password_manager/core/browser/android_affiliation/affiliation_backend.h
@@ -129,9 +129,10 @@ // AffiliationFetcherDelegate: void OnFetchSucceeded( + AffiliationFetcherInterface* fetcher, std::unique_ptr<AffiliationFetcherDelegate::Result> result) override; - void OnFetchFailed() override; - void OnMalformedResponse() override; + void OnFetchFailed(AffiliationFetcherInterface* fetcher) override; + void OnMalformedResponse(AffiliationFetcherInterface* fetcher) override; // AffiliationFetchThrottlerDelegate: bool OnCanSendNetworkRequest() override;
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_delegate.h b/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_delegate.h index f1e4c4d..42902df4 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_delegate.h +++ b/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_delegate.h
@@ -11,6 +11,7 @@ #include "components/password_manager/core/browser/android_affiliation/affiliation_utils.h" namespace password_manager { +class AffiliationFetcherInterface; // Interface that users of AffiliationFetcher should implement to get results of // the fetch. It is safe to destroy the fetcher in any of the event handlers. @@ -33,19 +34,20 @@ // |result| will contain at most as many equivalence class as facet URIs in // the request, and each requested facet URI will appear in exactly one // equivalence class. - virtual void OnFetchSucceeded(std::unique_ptr<Result> result) = 0; + virtual void OnFetchSucceeded(AffiliationFetcherInterface* fetcher, + std::unique_ptr<Result> result) = 0; // Called when affiliation information could not be fetched due to a network // error or a presumably transient server error. The implementor may and will // probably want to retry the request (once network connectivity is // re-established, and/or with exponential back-off). - virtual void OnFetchFailed() = 0; + virtual void OnFetchFailed(AffiliationFetcherInterface* fetcher) = 0; // Called when an affiliation response was received, but it was either gravely // ill-formed or self-inconsistent. It is likely that a repeated fetch would // yield the same, erroneous response, therefore, to avoid overloading the // server, the fetch must not be repeated in the short run. - virtual void OnMalformedResponse() = 0; + virtual void OnMalformedResponse(AffiliationFetcherInterface* fetcher) = 0; protected: virtual ~AffiliationFetcherDelegate() {}
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_unittest.cc b/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_unittest.cc index c70c1c3..a82165f 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_unittest.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_fetcher_unittest.cc
@@ -140,10 +140,11 @@ SetupSuccessfulResponse(test_response.SerializeAsString()); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - std::unique_ptr<AffiliationFetcherDelegate::Result> result; - EXPECT_CALL(mock_delegate, OnFetchSucceeded).WillOnce(MoveArg(&result)); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + std::unique_ptr<AffiliationFetcherDelegate::Result> result; + EXPECT_CALL(mock_delegate, OnFetchSucceeded(fetcher.get(), testing::_)) + .WillOnce(MoveArg<1>(&result)); fetcher->StartRequest(requested_uris, request_info); WaitForResponse(); @@ -181,10 +182,11 @@ SetupSuccessfulResponse(test_response.SerializeAsString()); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - std::unique_ptr<AffiliationFetcherDelegate::Result> result; - EXPECT_CALL(mock_delegate, OnFetchSucceeded).WillOnce(MoveArg(&result)); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + std::unique_ptr<AffiliationFetcherDelegate::Result> result; + EXPECT_CALL(mock_delegate, OnFetchSucceeded(fetcher.get(), testing::_)) + .WillOnce(MoveArg<1>(&result)); fetcher->StartRequest(requested_uris, request_info); WaitForResponse(); @@ -224,10 +226,11 @@ SetupSuccessfulResponse(test_response.SerializeAsString()); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - std::unique_ptr<AffiliationFetcherDelegate::Result> result; - EXPECT_CALL(mock_delegate, OnFetchSucceeded).WillOnce(MoveArg(&result)); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + std::unique_ptr<AffiliationFetcherDelegate::Result> result; + EXPECT_CALL(mock_delegate, OnFetchSucceeded(fetcher.get(), testing::_)) + .WillOnce(MoveArg<1>(&result)); fetcher->StartRequest(requested_uris, request_info); WaitForResponse(); @@ -259,10 +262,11 @@ SetupSuccessfulResponse(empty_test_response.SerializeAsString()); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - std::unique_ptr<AffiliationFetcherDelegate::Result> result; - EXPECT_CALL(mock_delegate, OnFetchSucceeded).WillOnce(MoveArg(&result)); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + std::unique_ptr<AffiliationFetcherDelegate::Result> result; + EXPECT_CALL(mock_delegate, OnFetchSucceeded(fetcher.get(), testing::_)) + .WillOnce(MoveArg<1>(&result)); fetcher->StartRequest(requested_uris, request_info); WaitForResponse(); @@ -291,10 +295,11 @@ SetupSuccessfulResponse(test_response.SerializeAsString()); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - std::unique_ptr<AffiliationFetcherDelegate::Result> result; - EXPECT_CALL(mock_delegate, OnFetchSucceeded).WillOnce(MoveArg(&result)); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + std::unique_ptr<AffiliationFetcherDelegate::Result> result; + EXPECT_CALL(mock_delegate, OnFetchSucceeded(fetcher.get(), testing::_)) + .WillOnce(MoveArg<1>(&result)); fetcher->StartRequest(requested_uris, {}); WaitForResponse(); @@ -320,10 +325,11 @@ SetupSuccessfulResponse(test_response.SerializeAsString()); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - std::unique_ptr<AffiliationFetcherDelegate::Result> result; - EXPECT_CALL(mock_delegate, OnFetchSucceeded).WillOnce(MoveArg(&result)); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + std::unique_ptr<AffiliationFetcherDelegate::Result> result; + EXPECT_CALL(mock_delegate, OnFetchSucceeded(fetcher.get(), testing::_)) + .WillOnce(MoveArg<1>(&result)); fetcher->StartRequest(requested_uris, {}); WaitForResponse(); @@ -353,10 +359,11 @@ SetupSuccessfulResponse(test_response.SerializeAsString()); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - std::unique_ptr<AffiliationFetcherDelegate::Result> result; - EXPECT_CALL(mock_delegate, OnFetchSucceeded).WillOnce(MoveArg(&result)); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + std::unique_ptr<AffiliationFetcherDelegate::Result> result; + EXPECT_CALL(mock_delegate, OnFetchSucceeded(fetcher.get(), testing::_)) + .WillOnce(MoveArg<1>(&result)); fetcher->StartRequest(requested_uris, {}); WaitForResponse(); @@ -378,9 +385,9 @@ SetupSuccessfulResponse(kMalformedResponse); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - EXPECT_CALL(mock_delegate, OnMalformedResponse()); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + EXPECT_CALL(mock_delegate, OnMalformedResponse(fetcher.get())); fetcher->StartRequest(uris, {}); WaitForResponse(); } @@ -402,9 +409,9 @@ SetupSuccessfulResponse(test_response.SerializeAsString()); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - EXPECT_CALL(mock_delegate, OnMalformedResponse()); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + EXPECT_CALL(mock_delegate, OnMalformedResponse(fetcher.get())); fetcher->StartRequest(uris, {}); WaitForResponse(); } @@ -415,9 +422,9 @@ SetupServerErrorResponse(); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - EXPECT_CALL(mock_delegate, OnFetchFailed()); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + EXPECT_CALL(mock_delegate, OnFetchFailed(fetcher.get())); fetcher->StartRequest(uris, {}); WaitForResponse(); } @@ -428,9 +435,9 @@ SetupNetworkErrorResponse(); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - EXPECT_CALL(mock_delegate, OnFetchFailed()); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + EXPECT_CALL(mock_delegate, OnFetchFailed(fetcher.get())); fetcher->StartRequest(uris, {}); WaitForResponse(); } @@ -443,10 +450,11 @@ SetupSuccessfulResponse( affiliation_pb::LookupAffiliationResponse().SerializeAsString()); testing::StrictMock<MockAffiliationFetcherDelegate> mock_delegate; - std::unique_ptr<AffiliationFetcherDelegate::Result> result; - EXPECT_CALL(mock_delegate, OnFetchSucceeded).WillOnce(MoveArg(&result)); auto fetcher = fetcher_factory()->CreateInstance(test_shared_loader_factory(), &mock_delegate); + std::unique_ptr<AffiliationFetcherDelegate::Result> result; + EXPECT_CALL(mock_delegate, OnFetchSucceeded(fetcher.get(), testing::_)) + .WillOnce(MoveArg<1>(&result)); fetcher->StartRequest(requested_uris, {}); WaitForResponse();
diff --git a/components/password_manager/core/browser/android_affiliation/fake_affiliation_fetcher.cc b/components/password_manager/core/browser/android_affiliation/fake_affiliation_fetcher.cc index 66239a9..01f2688 100644 --- a/components/password_manager/core/browser/android_affiliation/fake_affiliation_fetcher.cc +++ b/components/password_manager/core/browser/android_affiliation/fake_affiliation_fetcher.cc
@@ -18,11 +18,11 @@ void password_manager::FakeAffiliationFetcher::SimulateSuccess( std::unique_ptr<AffiliationFetcherDelegate::Result> fake_result) { - delegate()->OnFetchSucceeded(std::move(fake_result)); + delegate()->OnFetchSucceeded(this, std::move(fake_result)); } void password_manager::FakeAffiliationFetcher::SimulateFailure() { - delegate()->OnFetchFailed(); + delegate()->OnFetchFailed(this); } password_manager::FakeAffiliationFetcherFactory::
diff --git a/components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher.h b/components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher.h index d4d897e..8f470f1 100644 --- a/components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher.h +++ b/components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher.h
@@ -5,9 +5,8 @@ #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_ANDROID_AFFILIATION_MOCK_AFFILIATION_FETCHER_H_ #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_ANDROID_AFFILIATION_MOCK_AFFILIATION_FETCHER_H_ -#include <string> - #include "components/password_manager/core/browser/android_affiliation/affiliation_fetcher_interface.h" + #include "testing/gmock/include/gmock/gmock.h" namespace password_manager {
diff --git a/components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher_delegate.h b/components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher_delegate.h index 98c373d4..e172418 100644 --- a/components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher_delegate.h +++ b/components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher_delegate.h
@@ -12,6 +12,7 @@ #include "testing/gmock/include/gmock/gmock.h" namespace password_manager { +class AffiliationFetcherInterface; class MockAffiliationFetcherDelegate : public AffiliationFetcherDelegate { public: @@ -20,10 +21,17 @@ MOCK_METHOD(void, OnFetchSucceeded, - (std::unique_ptr<Result> result), + (AffiliationFetcherInterface * fetcher, + std::unique_ptr<Result> result), (override)); - MOCK_METHOD(void, OnFetchFailed, (), (override)); - MOCK_METHOD(void, OnMalformedResponse, (), (override)); + MOCK_METHOD(void, + OnFetchFailed, + (AffiliationFetcherInterface * fetcher), + (override)); + MOCK_METHOD(void, + OnMalformedResponse, + (AffiliationFetcherInterface * fetcher), + (override)); }; } // namespace password_manager
diff --git a/components/password_manager/core/browser/site_affiliation/affiliation_fetcher_base.cc b/components/password_manager/core/browser/site_affiliation/affiliation_fetcher_base.cc index d59083b..dca028e 100644 --- a/components/password_manager/core/browser/site_affiliation/affiliation_fetcher_base.cc +++ b/components/password_manager/core/browser/site_affiliation/affiliation_fetcher_base.cc
@@ -115,10 +115,10 @@ if (response_body) { if (ParseResponse(*response_body, result_data.get())) { LogFetchResult(AffiliationFetchResult::kSuccess); - delegate_->OnFetchSucceeded(std::move(result_data)); + delegate_->OnFetchSucceeded(this, std::move(result_data)); } else { LogFetchResult(AffiliationFetchResult::kMalformed); - delegate_->OnMalformedResponse(); + delegate_->OnMalformedResponse(this); } } else { LogFetchResult(AffiliationFetchResult::kFailure); @@ -135,7 +135,7 @@ base::UmaHistogramSparse( "PasswordManager.AffiliationFetcher.FetchErrorCode", -simple_url_loader_->NetError()); - delegate_->OnFetchFailed(); + delegate_->OnFetchFailed(this); } }
diff --git a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc index 284f135..ff6243bf 100644 --- a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc +++ b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc
@@ -108,6 +108,7 @@ } void AffiliationServiceImpl::OnFetchSucceeded( + AffiliationFetcherInterface* fetcher, std::unique_ptr<AffiliationFetcherDelegate::Result> result) { fetcher_.reset(); std::map<FacetURI, AffiliationServiceImpl::ChangePasswordUrlMatch> @@ -124,13 +125,15 @@ std::move(result_callback_).Run(); } -void AffiliationServiceImpl::OnFetchFailed() { +void AffiliationServiceImpl::OnFetchFailed( + AffiliationFetcherInterface* fetcher) { fetcher_.reset(); requested_tuple_origins_.clear(); std::move(result_callback_).Run(); } -void AffiliationServiceImpl::OnMalformedResponse() { +void AffiliationServiceImpl::OnMalformedResponse( + AffiliationFetcherInterface* fetcher) { fetcher_.reset(); requested_tuple_origins_.clear(); std::move(result_callback_).Run();
diff --git a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h index e7d7315c..8ba9163 100644 --- a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h +++ b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h
@@ -78,9 +78,10 @@ private: // AffiliationFetcherDelegate: void OnFetchSucceeded( + AffiliationFetcherInterface* fetcher, std::unique_ptr<AffiliationFetcherDelegate::Result> result) override; - void OnFetchFailed() override; - void OnMalformedResponse() override; + void OnFetchFailed(AffiliationFetcherInterface* fetcher) override; + void OnMalformedResponse(AffiliationFetcherInterface* fetcher) override; // Converts new |urls| to facets and inserts them to the // |change_password_urls_|.
diff --git a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl_unittest.cc b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl_unittest.cc index 6fd2290..fd2b668 100644 --- a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl_unittest.cc +++ b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl_unittest.cc
@@ -11,8 +11,8 @@ #include "base/test/task_environment.h" #include "components/password_manager/core/browser/android_affiliation/affiliation_fetcher.h" #include "components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher.h" -#include "components/password_manager/core/browser/site_affiliation/affiliation_fetcher_factory.h" #include "components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h" +#include "components/password_manager/core/browser/site_affiliation/mock_affiliation_fetcher_factory.h" #include "components/sync/driver/test_sync_service.h" #include "services/network/test/test_shared_url_loader_factory.h" @@ -50,19 +50,6 @@ } // namespace -class MockAffiliationFetcherFactory : public AffiliationFetcherFactory { - public: - MockAffiliationFetcherFactory() = default; - ~MockAffiliationFetcherFactory() override = default; - - MOCK_METHOD( - std::unique_ptr<AffiliationFetcherInterface>, - CreateInstance, - (scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, - AffiliationFetcherDelegate* delegate), - (override)); -}; - class AffiliationServiceImplTest : public testing::Test { public: AffiliationServiceImplTest() @@ -123,6 +110,7 @@ OnFetchSuccededInsertsChangePasswordURLOfRequestedSiteIfFound) { const GURL origin(k1ExampleURL); auto mock_fetcher = std::make_unique<MockAffiliationFetcher>(); + auto* raw_mock_fetcher = mock_fetcher.get(); EXPECT_CALL(*mock_fetcher, StartRequest(ToFacetsURIs({origin}), @@ -143,7 +131,7 @@ auto test_result = std::make_unique<AffiliationFetcherDelegate::Result>(); test_result->groupings.push_back(group); static_cast<AffiliationFetcherDelegate*>(service())->OnFetchSucceeded( - std::move(test_result)); + raw_mock_fetcher, std::move(test_result)); // Expect Change Password URL of requested site. EXPECT_EQ(GURL(k1ExampleChangePasswordURL), @@ -154,6 +142,7 @@ OnFetchSuccededInsertsChangePasswordURLOfAnotherSiteFromAGroup) { const GURL origin(kM1ExampleURL); auto mock_fetcher = std::make_unique<MockAffiliationFetcher>(); + auto* raw_mock_fetcher = mock_fetcher.get(); EXPECT_CALL(*mock_fetcher, StartRequest(ToFacetsURIs({origin}), @@ -172,7 +161,7 @@ auto test_result = std::make_unique<AffiliationFetcherDelegate::Result>(); test_result->groupings.push_back(group); static_cast<AffiliationFetcherDelegate*>(service())->OnFetchSucceeded( - std::move(test_result)); + raw_mock_fetcher, std::move(test_result)); // Expect Change Password URL of another site from a grouping. EXPECT_EQ(GURL(k1ExampleChangePasswordURL), @@ -183,6 +172,7 @@ OnFetchSucceedTakesNoActionWhenNoChangePasswordURLsAvailable) { const GURL origin(k1ExampleURL); auto mock_fetcher = std::make_unique<MockAffiliationFetcher>(); + auto* raw_mock_fetcher = mock_fetcher.get(); EXPECT_CALL(*mock_fetcher, StartRequest(ToFacetsURIs({origin}), @@ -203,7 +193,7 @@ auto test_result = std::make_unique<AffiliationFetcherDelegate::Result>(); test_result->groupings.push_back(group); static_cast<AffiliationFetcherDelegate*>(service())->OnFetchSucceeded( - std::move(test_result)); + raw_mock_fetcher, std::move(test_result)); EXPECT_EQ(GURL(), service()->GetChangePasswordURL(origin)); } @@ -211,6 +201,7 @@ TEST_F(AffiliationServiceImplTest, OnFetchFailedResetsFetcher) { std::vector<GURL> origins = {GURL(k1ExampleURL), GURL(k2ExampleURL)}; auto mock_fetcher = std::make_unique<MockAffiliationFetcher>(); + auto* raw_mock_fetcher = mock_fetcher.get(); EXPECT_CALL(*mock_fetcher, StartRequest(ToFacetsURIs(origins), @@ -222,13 +213,15 @@ service()->PrefetchChangePasswordURLs(origins, base::DoNothing()); EXPECT_NE(nullptr, service()->GetFetcherForTesting()); - static_cast<AffiliationFetcherDelegate*>(service())->OnFetchFailed(); + static_cast<AffiliationFetcherDelegate*>(service())->OnFetchFailed( + raw_mock_fetcher); EXPECT_EQ(nullptr, service()->GetFetcherForTesting()); } TEST_F(AffiliationServiceImplTest, OnMalformedResponseResetsFetcher) { std::vector<GURL> origins = {GURL(k1ExampleURL), GURL(k2ExampleURL)}; auto mock_fetcher = std::make_unique<MockAffiliationFetcher>(); + auto* raw_mock_fetcher = mock_fetcher.get(); EXPECT_CALL(*mock_fetcher, StartRequest(ToFacetsURIs(origins), @@ -240,7 +233,8 @@ service()->PrefetchChangePasswordURLs(origins, base::DoNothing()); EXPECT_NE(nullptr, service()->GetFetcherForTesting()); - static_cast<AffiliationFetcherDelegate*>(service())->OnMalformedResponse(); + static_cast<AffiliationFetcherDelegate*>(service())->OnMalformedResponse( + raw_mock_fetcher); EXPECT_EQ(nullptr, service()->GetFetcherForTesting()); } @@ -342,6 +336,7 @@ TEST_F(AffiliationServiceImplTest, FoundForRequestedFacetMetric) { const GURL origin(k1ExampleURL); auto mock_fetcher = std::make_unique<MockAffiliationFetcher>(); + auto* raw_mock_fetcher = mock_fetcher.get(); EXPECT_CALL(*mock_fetcher, StartRequest(ToFacetsURIs({origin}), @@ -361,7 +356,7 @@ test_result->groupings.push_back(group); static_cast<AffiliationFetcherDelegate*>(service())->OnFetchSucceeded( - std::move(test_result)); + raw_mock_fetcher, std::move(test_result)); service()->GetChangePasswordURL(origin); histogram_tester().ExpectUniqueSample( @@ -372,6 +367,7 @@ TEST_F(AffiliationServiceImplTest, FoundForGroupedFacetMetric) { const GURL origin(kM1ExampleURL); auto mock_fetcher = std::make_unique<MockAffiliationFetcher>(); + auto* raw_mock_fetcher = mock_fetcher.get(); EXPECT_CALL(*mock_fetcher, StartRequest(ToFacetsURIs({origin}), @@ -391,7 +387,7 @@ test_result->groupings.push_back(group); static_cast<AffiliationFetcherDelegate*>(service())->OnFetchSucceeded( - std::move(test_result)); + raw_mock_fetcher, std::move(test_result)); service()->GetChangePasswordURL(origin); histogram_tester().ExpectUniqueSample( @@ -402,6 +398,7 @@ TEST_F(AffiliationServiceImplTest, OnFetchSuccedeedRunsCallback) { const GURL origin(k1ExampleURL); auto mock_fetcher = std::make_unique<MockAffiliationFetcher>(); + auto* raw_mock_fetcher = mock_fetcher.get(); EXPECT_CALL(*mock_fetcher, StartRequest(ToFacetsURIs({origin}), @@ -415,7 +412,7 @@ EXPECT_CALL(callback, Run()); static_cast<AffiliationFetcherDelegate*>(service())->OnFetchSucceeded( - std::make_unique<AffiliationFetcherDelegate::Result>()); + raw_mock_fetcher, std::make_unique<AffiliationFetcherDelegate::Result>()); } } // namespace password_manager
diff --git a/components/password_manager/core/browser/site_affiliation/mock_affiliation_fetcher_factory.cc b/components/password_manager/core/browser/site_affiliation/mock_affiliation_fetcher_factory.cc new file mode 100644 index 0000000..05fbf53 --- /dev/null +++ b/components/password_manager/core/browser/site_affiliation/mock_affiliation_fetcher_factory.cc
@@ -0,0 +1,13 @@ +// 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 "components/password_manager/core/browser/site_affiliation/mock_affiliation_fetcher_factory.h" + +namespace password_manager { + +MockAffiliationFetcherFactory::MockAffiliationFetcherFactory() = default; + +MockAffiliationFetcherFactory::~MockAffiliationFetcherFactory() = default; + +} // namespace password_manager
diff --git a/components/password_manager/core/browser/site_affiliation/mock_affiliation_fetcher_factory.h b/components/password_manager/core/browser/site_affiliation/mock_affiliation_fetcher_factory.h new file mode 100644 index 0000000..ab13c42 --- /dev/null +++ b/components/password_manager/core/browser/site_affiliation/mock_affiliation_fetcher_factory.h
@@ -0,0 +1,31 @@ +// 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SITE_AFFILIATION_MOCK_AFFILIATION_FETCHER_FACTORY_H_ +#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SITE_AFFILIATION_MOCK_AFFILIATION_FETCHER_FACTORY_H_ + +#include "components/password_manager/core/browser/android_affiliation/affiliation_fetcher_interface.h" +#include "components/password_manager/core/browser/site_affiliation/affiliation_fetcher_factory.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" + +#include "testing/gmock/include/gmock/gmock.h" + +namespace password_manager { + +class MockAffiliationFetcherFactory : public AffiliationFetcherFactory { + public: + MockAffiliationFetcherFactory(); + ~MockAffiliationFetcherFactory() override; + + MOCK_METHOD( + std::unique_ptr<AffiliationFetcherInterface>, + CreateInstance, + (scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + AffiliationFetcherDelegate* delegate), + (override)); +}; + +} // namespace password_manager + +#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SITE_AFFILIATION_MOCK_AFFILIATION_FETCHER_FACTORY_H_
diff --git a/components/password_manager/core/browser/well_known_change_password_state_unittest.cc b/components/password_manager/core/browser/well_known_change_password_state_unittest.cc index 5c154e308..61d32df 100644 --- a/components/password_manager/core/browser/well_known_change_password_state_unittest.cc +++ b/components/password_manager/core/browser/well_known_change_password_state_unittest.cc
@@ -7,6 +7,7 @@ #include "base/task/post_task.h" #include "base/test/task_environment.h" #include "base/timer/mock_timer.h" +#include "components/password_manager/core/browser/android_affiliation/mock_affiliation_fetcher.h" #include "components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h" #include "components/password_manager/core/browser/well_known_change_password_util.h" #include "components/sync/driver/test_sync_service.h" @@ -232,6 +233,7 @@ syncer::TestSyncService test_sync_service; AffiliationServiceImpl affiliation_service(&test_sync_service, test_shared_loader_factory()); + state()->PrefetchChangePasswordURLs(&affiliation_service, {}); ResponseDelayParams params = GetParam(); @@ -243,8 +245,10 @@ FastForwardBy(base::TimeDelta::FromMilliseconds(ms_to_forward)); EXPECT_CALL(*delegate(), OnProcessingFinished(false)); + auto mock_fetcher = std::make_unique<MockAffiliationFetcher>(); static_cast<AffiliationFetcherDelegate*>(&affiliation_service) ->OnFetchSucceeded( + mock_fetcher.get(), std::make_unique<AffiliationFetcherDelegate::Result>()); }
diff --git a/components/performance_manager/v8_memory/v8_per_frame_memory_decorator.cc b/components/performance_manager/v8_memory/v8_per_frame_memory_decorator.cc index 784707d..4f4d32d 100644 --- a/components/performance_manager/v8_memory/v8_per_frame_memory_decorator.cc +++ b/components/performance_manager/v8_memory/v8_per_frame_memory_decorator.cc
@@ -473,6 +473,7 @@ : min_time_between_requests_(min_time_between_requests), mode_(mode) { #if DCHECK_IS_ON() DCHECK_GT(min_time_between_requests_, base::TimeDelta()); + DCHECK(!min_time_between_requests_.is_inf()); DCHECK(mode != MeasurementMode::kEagerForTesting || g_test_eager_measurement_requests_enabled); #endif
diff --git a/components/performance_manager/v8_memory/v8_per_frame_memory_decorator_unittest.cc b/components/performance_manager/v8_memory/v8_per_frame_memory_decorator_unittest.cc index 5af61b0..9224b0f 100644 --- a/components/performance_manager/v8_memory/v8_per_frame_memory_decorator_unittest.cc +++ b/components/performance_manager/v8_memory/v8_per_frame_memory_decorator_unittest.cc
@@ -37,9 +37,12 @@ namespace v8_memory { -using testing::_; -using testing::Eq; -using testing::Property; +using ::testing::_; +using ::testing::Eq; +using ::testing::InSequence; +using ::testing::Mock; +using ::testing::Property; +using ::testing::StrictMock; constexpr RenderProcessHostId kTestProcessID = RenderProcessHostId(0xFAB); constexpr uint64_t kUnassociatedBytes = 0xABBA; @@ -66,7 +69,7 @@ }; using MockV8DetailedMemoryReporter = - testing::StrictMock<LenientMockV8DetailedMemoryReporter>; + StrictMock<LenientMockV8DetailedMemoryReporter>; class LenientMockV8PerFrameMemoryObserver : public V8PerFrameMemoryObserver { public: @@ -89,7 +92,7 @@ }; using MockV8PerFrameMemoryObserver = - testing::StrictMock<LenientMockV8PerFrameMemoryObserver>; + StrictMock<LenientMockV8PerFrameMemoryObserver>; class LenientMockV8PerFrameMemoryObserverAnySeq : public V8PerFrameMemoryObserverAnySeq { @@ -103,7 +106,7 @@ }; using MockV8PerFrameMemoryObserverAnySeq = - testing::StrictMock<LenientMockV8PerFrameMemoryObserverAnySeq>; + StrictMock<LenientMockV8PerFrameMemoryObserverAnySeq>; // The mode enum used in the API. using MeasurementMode = V8PerFrameMemoryRequest::MeasurementMode; @@ -187,9 +190,7 @@ blink::mojom::PerProcessV8MemoryUsagePtr data, RenderProcessHostId expected_process_id = kTestProcessID, ExpectedMode expected_mode = ExpectedMode::DEFAULT) { - // Wrap the move-only |data| in a callback for the expectation below. - ExpectQueryAndReply(mock_reporter, std::move(data), expected_mode); - + InSequence seq; EXPECT_CALL(*this, BindReceiverWithProxyHost(_, _)) .WillOnce( [mock_reporter, expected_process_id]( @@ -199,6 +200,8 @@ DCHECK_EQ(expected_process_id, proxy.render_process_host_id()); mock_reporter->Bind(std::move(pending_receiver)); }); + + ExpectQueryAndReply(mock_reporter, std::move(data), expected_mode); } MOCK_METHOD(void, @@ -369,7 +372,7 @@ RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().RunUntilIdle(); - testing::Mock::VerifyAndClearExpectations(this); + Mock::VerifyAndClearExpectations(this); } } @@ -397,7 +400,7 @@ // There shouldn't be an additional request this soon. task_env().FastForwardBy(kMinTimeBetweenRequests / 2); - testing::Mock::VerifyAndClearExpectations(&mock_reporter); + Mock::VerifyAndClearExpectations(&mock_reporter); // Set up another request and capture the callback for later invocation. MockV8DetailedMemoryReporter::GetV8MemoryUsageCallback callback; @@ -416,7 +419,7 @@ // Skip forward a long while, and validate that no additional requests are // issued until the pending request has completed. task_env().FastForwardBy(10 * kMinTimeBetweenRequests); - testing::Mock::VerifyAndClearExpectations(&mock_reporter); + Mock::VerifyAndClearExpectations(&mock_reporter); EXPECT_TRUE(V8PerFrameMemoryProcessData::ForProcessNode(process.get())); EXPECT_EQ(1u, V8PerFrameMemoryProcessData::ForProcessNode(process.get()) @@ -448,7 +451,7 @@ // Despite the long delay to respond to request 2, there shouldn't be another // request until kMinTimeBetweenRequests has expired. task_env().FastForwardBy(kMinTimeBetweenRequests / 2); - testing::Mock::VerifyAndClearExpectations(&mock_reporter); + Mock::VerifyAndClearExpectations(&mock_reporter); } TEST_F(V8PerFrameMemoryDecoratorTest, MultipleProcessesHaveDistinctSchedules) { @@ -467,7 +470,7 @@ RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().FastForwardBy(kMinTimeBetweenRequests / 4); - testing::Mock::VerifyAndClearExpectations(&reporter1); + Mock::VerifyAndClearExpectations(&reporter1); // Create a second process node and validate that it gets a request. MockV8DetailedMemoryReporter reporter2; @@ -482,7 +485,7 @@ RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().RunUntilIdle(); - testing::Mock::VerifyAndClearExpectations(&reporter2); + Mock::VerifyAndClearExpectations(&reporter2); EXPECT_TRUE(V8PerFrameMemoryProcessData::ForProcessNode(process1.get())); EXPECT_EQ(1u, V8PerFrameMemoryProcessData::ForProcessNode(process1.get()) @@ -544,7 +547,7 @@ } task_env().RunUntilIdle(); - testing::Mock::VerifyAndClearExpectations(&reporter); + Mock::VerifyAndClearExpectations(&reporter); ASSERT_TRUE(V8PerFrameMemoryFrameData::ForFrameNode(frame1.get())); EXPECT_EQ( @@ -574,7 +577,7 @@ RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().RunUntilIdle(); - testing::Mock::VerifyAndClearExpectations(&reporter); + Mock::VerifyAndClearExpectations(&reporter); // Since the frame was unknown, the usage should have accrued to unassociated. EXPECT_TRUE(V8PerFrameMemoryProcessData::ForProcessNode(process.get())); @@ -599,7 +602,7 @@ } task_env().FastForwardBy(kMinTimeBetweenRequests * 1.5); - testing::Mock::VerifyAndClearExpectations(&reporter); + Mock::VerifyAndClearExpectations(&reporter); ASSERT_TRUE(V8PerFrameMemoryFrameData::ForFrameNode(frame1.get())); EXPECT_EQ( @@ -620,7 +623,7 @@ ExpectQueryAndReply(&reporter, std::move(data)); } task_env().FastForwardBy(kMinTimeBetweenRequests); - testing::Mock::VerifyAndClearExpectations(&reporter); + Mock::VerifyAndClearExpectations(&reporter); ASSERT_TRUE(V8PerFrameMemoryFrameData::ForFrameNode(frame1.get())); EXPECT_EQ( @@ -650,7 +653,7 @@ RenderProcessHostProxy::CreateForTesting(kTestProcessID)); task_env().FastForwardBy(base::TimeDelta::FromSeconds(1)); - testing::Mock::VerifyAndClearExpectations(&reporter); + Mock::VerifyAndClearExpectations(&reporter); // If a lazy request takes too long to respond it should be upgraded to a // bounded request if one is in the queue. @@ -677,7 +680,7 @@ // Wait long enough for the upgraded request to be sent, to verify that it // wasn't sent. task_env().FastForwardBy(kLongBoundedRequestLength); - testing::Mock::VerifyAndClearExpectations(&reporter); + Mock::VerifyAndClearExpectations(&reporter); constexpr base::TimeDelta kUpgradeRequestLength = base::TimeDelta::FromSeconds(40); @@ -689,7 +692,7 @@ EXPECT_EQ(decorator->GetNextRequest()->mode(), MeasurementMode::kLazy); { - ::testing::InSequence seq; + InSequence seq; // Again, 40 sec total until reply arrives. kUpgradeRequestLength <= 40 sec // so a second upgraded request should be sent. @@ -705,7 +708,7 @@ // Wait long enough for the upgraded request to be sent. task_env().FastForwardBy(kUpgradeRequestLength); - testing::Mock::VerifyAndClearExpectations(&reporter); + Mock::VerifyAndClearExpectations(&reporter); EXPECT_TRUE(V8PerFrameMemoryProcessData::ForProcessNode(process.get())); EXPECT_EQ(3u, V8PerFrameMemoryProcessData::ForProcessNode(process.get()) @@ -724,10 +727,10 @@ INSTANTIATE_TEST_SUITE_P( AllBoundedModes, V8PerFrameMemoryDecoratorModeTest, - testing::Values(std::make_pair(MeasurementMode::kBounded, - ExpectedMode::DEFAULT), - std::make_pair(MeasurementMode::kEagerForTesting, - ExpectedMode::EAGER))); + ::testing::Values(std::make_pair(MeasurementMode::kBounded, + ExpectedMode::DEFAULT), + std::make_pair(MeasurementMode::kEagerForTesting, + ExpectedMode::EAGER))); TEST_F(V8PerFrameMemoryDecoratorTest, MeasurementRequestsSorted) { // Create some queries with different sample frequencies. @@ -1119,7 +1122,7 @@ EXPECT_EQ(last_query_time_, measurement_start_time); // No more requests should be sent. - testing::Mock::VerifyAndClearExpectations(this); + Mock::VerifyAndClearExpectations(this); task_env().FastForwardBy(kLongInterval); } @@ -1146,7 +1149,7 @@ graph()->TakeFromGraph(decorator); // No request should be sent, and the decorator destructor should not DCHECK. - testing::Mock::VerifyAndClearExpectations(this); + Mock::VerifyAndClearExpectations(this); task_env().FastForwardBy(kMinTimeBetweenRequests); } @@ -1175,9 +1178,9 @@ observer2.ExpectObservationOnProcess(process1.get(), 1U); task_env().FastForwardBy(kMinTimeBetweenRequests / 2); - testing::Mock::VerifyAndClearExpectations(&reporter1); - testing::Mock::VerifyAndClearExpectations(&observer1); - testing::Mock::VerifyAndClearExpectations(&observer2); + Mock::VerifyAndClearExpectations(&reporter1); + Mock::VerifyAndClearExpectations(&observer1); + Mock::VerifyAndClearExpectations(&observer2); // Create a process node and validate that all observers are notified when // any measurement is available. After fast-forwarding the first measurement @@ -1204,10 +1207,10 @@ observer2.ExpectObservationOnProcess(process1.get(), 3U); task_env().FastForwardBy(kMinTimeBetweenRequests / 2); - testing::Mock::VerifyAndClearExpectations(&reporter1); - testing::Mock::VerifyAndClearExpectations(&reporter2); - testing::Mock::VerifyAndClearExpectations(&observer1); - testing::Mock::VerifyAndClearExpectations(&observer2); + Mock::VerifyAndClearExpectations(&reporter1); + Mock::VerifyAndClearExpectations(&reporter2); + Mock::VerifyAndClearExpectations(&observer1); + Mock::VerifyAndClearExpectations(&observer2); // Remove an observer and make sure the other is still notified after the // next measurement. @@ -1228,10 +1231,10 @@ observer2.ExpectObservationOnProcess(process2.get(), 5U); task_env().FastForwardBy(kMinTimeBetweenRequests); - testing::Mock::VerifyAndClearExpectations(&reporter1); - testing::Mock::VerifyAndClearExpectations(&reporter2); - testing::Mock::VerifyAndClearExpectations(&observer1); - testing::Mock::VerifyAndClearExpectations(&observer2); + Mock::VerifyAndClearExpectations(&reporter1); + Mock::VerifyAndClearExpectations(&reporter2); + Mock::VerifyAndClearExpectations(&observer1); + Mock::VerifyAndClearExpectations(&observer2); // Must remove the observer before destroying the request to avoid a DCHECK // from ObserverList. @@ -1259,8 +1262,8 @@ task_env().FastForwardBy(base::TimeDelta::FromSeconds(1)); - testing::Mock::VerifyAndClearExpectations(&reporter); - testing::Mock::VerifyAndClearExpectations(&observer); + Mock::VerifyAndClearExpectations(&reporter); + Mock::VerifyAndClearExpectations(&observer); // Start the next measurement. { @@ -1315,7 +1318,7 @@ }); } -TEST_F(V8PerFrameMemoryDecoratorDeathTest, EagerModeDisallowed) { +TEST_F(V8PerFrameMemoryDecoratorDeathTest, InvalidParameters) { // Not allowed to use kEagerForTesting mode without calling // SetEagerMemoryMeasurementEnabledForTesting. EXPECT_DCHECK_DEATH({ @@ -1326,6 +1329,20 @@ V8PerFrameMemoryRequestAnySeq memory_request( kMinTimeBetweenRequests, MeasurementMode::kEagerForTesting); }); + // Zero, negative and infinite TimeDelta's are disallowed. + EXPECT_DCHECK_DEATH({ + base::TimeDelta zero; + V8PerFrameMemoryRequestAnySeq memory_request(zero); + }); + EXPECT_DCHECK_DEATH({ + V8PerFrameMemoryRequestAnySeq memory_request(base::TimeDelta::Min()); + }); + EXPECT_DCHECK_DEATH({ + V8PerFrameMemoryRequestAnySeq memory_request(base::TimeDelta::Max()); + }); + EXPECT_DCHECK_DEATH({ + V8PerFrameMemoryRequestAnySeq memory_request(kMinTimeBetweenRequests * -1); + }); } TEST_F(V8PerFrameMemoryRequestAnySeqTest, RequestIsSequenceSafe) { @@ -1416,9 +1433,9 @@ // Now execute all the above tasks. run_loop.Run(); - testing::Mock::VerifyAndClearExpectations(this); - testing::Mock::VerifyAndClearExpectations(&reporter); - testing::Mock::VerifyAndClearExpectations(&observer); + Mock::VerifyAndClearExpectations(this); + Mock::VerifyAndClearExpectations(&reporter); + Mock::VerifyAndClearExpectations(&observer); // Destroying the object on the main sequence should cause the wrapped // V8PerFrameMemoryRequest to be destroyed on the graph sequence after any
diff --git a/components/permissions_strings.grdp b/components/permissions_strings.grdp index 554ff91..af890c0 100644 --- a/components/permissions_strings.grdp +++ b/components/permissions_strings.grdp
@@ -123,7 +123,7 @@ Open and place windows on your screens </message> <message name="IDS_FONT_ACCESS_PERMISSION_FRAGMENT" desc="Permission request shown if the user is visiting a site that wants to access locally installed font data. Follows a prompt: 'This site would like to:'"> - Use the fonts installed on your computer so you can create advanced typography + Use the fonts on your computer so you can create high-fidelity content </message> <message name="IDS_IDLE_DETECTION_PERMISSION_FRAGMENT" desc="Permission request shown if the user is visiting a site that wants to monitor when the user is interacting with their device. Follows a prompt: 'This site would like to:'"> Know when you're present
diff --git a/components/permissions_strings_grdp/IDS_FONT_ACCESS_PERMISSION_FRAGMENT.png.sha1 b/components/permissions_strings_grdp/IDS_FONT_ACCESS_PERMISSION_FRAGMENT.png.sha1 index b8432b9..0a30ee3a 100644 --- a/components/permissions_strings_grdp/IDS_FONT_ACCESS_PERMISSION_FRAGMENT.png.sha1 +++ b/components/permissions_strings_grdp/IDS_FONT_ACCESS_PERMISSION_FRAGMENT.png.sha1
@@ -1 +1 @@ -1acf180e72599e85eaf3dfd47606fc3509bb226e \ No newline at end of file +9a50fdc1c97d6a9f810706c2ae5293e6e35280e7 \ No newline at end of file
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index f8b9ee2..e53aab7 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -23433,6 +23433,22 @@ This policy is temporary and will be removed in a future version of <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>.''', }, + { + 'name': 'MediaRecommendationsEnabled', + 'owners': ['beccahughes@chromium.org', 'steimel@chromium.org', 'mlamouri@chromium.org'], + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['chrome.*:87-', 'chrome_os:87-'], + 'features': { + 'dynamic_refresh': True, + 'per_profile': True, + }, + 'example_value': True, + 'id': 788, + 'caption': 'Enable Media Recommendations', + 'tags': [], + 'desc': '''By default the browser will show media recommendations that are personalized to the user. Setting this policy to Disabled will result in these recommendations being hidden from the user. Setting this policy to Enabled or leaving it unset will result in the media recommendations being shown to the user.''', + }, ], 'messages': { @@ -24357,6 +24373,6 @@ ], 'placeholders': [], 'deleted_policy_ids': [114, 115, 412, 476, 544, 546, 562, 569, 578], - 'highest_id_currently_used': 787, + 'highest_id_currently_used': 788, 'highest_atomic_group_id_currently_used': 40 }
diff --git a/components/prerender/browser/prerender_contents.cc b/components/prerender/browser/prerender_contents.cc index 7b21c53..93cd80f 100644 --- a/components/prerender/browser/prerender_contents.cc +++ b/components/prerender/browser/prerender_contents.cc
@@ -142,8 +142,6 @@ final_status_(FINAL_STATUS_UNKNOWN), prerendering_has_been_cancelled_(false), process_pid_(base::kNullProcessId), - child_id_(-1), - route_id_(-1), origin_(origin), network_bytes_(0) { switch (origin) { @@ -204,16 +202,11 @@ content::WebContentsObserver::Observe(prerender_contents_.get()); delegate_->OnPrerenderContentsCreated(prerender_contents_.get()); - web_contents_delegate_.reset(new WebContentsDelegateImpl(this)); - prerender_contents_.get()->SetDelegate(web_contents_delegate_.get()); + web_contents_delegate_ = std::make_unique<WebContentsDelegateImpl>(this); + prerender_contents_->SetDelegate(web_contents_delegate_.get()); // Set the size of the prerender WebContents. - prerender_contents_.get()->Resize(bounds_); - - // TODO(davidben): This logic assumes each prerender has at most one - // route. https://crbug.com/440544 - child_id_ = GetRenderViewHost()->GetProcess()->GetID(); - route_id_ = GetRenderViewHost()->GetRoutingID(); + prerender_contents_->Resize(bounds_); // TODO(davidben): This logic assumes each prerender has at most one // process. https://crbug.com/440544 @@ -238,21 +231,7 @@ load_url_params.transition_type = ui::PageTransitionFromInt(ui::PAGE_TRANSITION_GENERATED); } - prerender_contents_.get()->GetController().LoadURLWithParams(load_url_params); -} - -bool PrerenderContents::GetChildId(int* child_id) const { - CHECK(child_id); - DCHECK_GE(child_id_, -1); - *child_id = child_id_; - return child_id_ != -1; -} - -bool PrerenderContents::GetRouteId(int* route_id) const { - CHECK(route_id); - DCHECK_GE(route_id_, -1); - *route_id = route_id_; - return route_id_ != -1; + prerender_contents_->GetController().LoadURLWithParams(load_url_params); } void PrerenderContents::SetFinalStatus(FinalStatus final_status) { @@ -295,7 +274,7 @@ const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { - if (prerender_contents_.get()) { + if (prerender_contents_) { DCHECK_EQ(content::Source<WebContents>(source).ptr(), prerender_contents_.get());
diff --git a/components/prerender/browser/prerender_contents.h b/components/prerender/browser/prerender_contents.h index cb07ec2..1c86650 100644 --- a/components/prerender/browser/prerender_contents.h +++ b/components/prerender/browser/prerender_contents.h
@@ -140,14 +140,6 @@ bool has_finished_loading() const { return has_finished_loading_; } bool prerendering_has_started() const { return prerendering_has_started_; } - // Sets the parameter to the value of the associated RenderViewHost's child id - // and returns a boolean indicating the validity of that id. - virtual bool GetChildId(int* child_id) const; - - // Sets the parameter to the value of the associated RenderViewHost's route id - // and returns a boolean indicating the validity of that id. - virtual bool GetRouteId(int* route_id) const; - FinalStatus final_status() const { return final_status_; } Origin origin() const { return origin_; } @@ -292,14 +284,14 @@ std::unique_ptr<PrerenderContentsDelegate> delegate_; // The URL being prerendered. - GURL prerender_url_; + const GURL prerender_url_; // The referrer. - content::Referrer referrer_; + const content::Referrer referrer_; // The origin of the page requesting the prerender. Empty when the prerender // is browser initiated. - base::Optional<url::Origin> initiator_origin_; + const base::Optional<url::Origin> initiator_origin_; // The browser context being used content::BrowserContext* browser_context_; @@ -326,12 +318,8 @@ std::unique_ptr<WebContentsDelegateImpl> web_contents_delegate_; - // These are -1 before a RenderView is created. - int child_id_; - int route_id_; - // Origin for this prerender. - Origin origin_; + const Origin origin_; // The bounds of the WebView from the launching page. gfx::Rect bounds_;
diff --git a/components/safe_browsing/content/password_protection/BUILD.gn b/components/safe_browsing/content/password_protection/BUILD.gn index 2d06ca3..2f35e59 100644 --- a/components/safe_browsing/content/password_protection/BUILD.gn +++ b/components/safe_browsing/content/password_protection/BUILD.gn
@@ -71,7 +71,10 @@ source_set("password_protection_unittest") { testonly = true if (safe_browsing_mode > 0) { - sources = [ "password_protection_service_unittest.cc" ] + sources = [ + "password_protection_navigation_throttle_unittest.cc", + "password_protection_service_unittest.cc", + ] if (safe_browsing_mode == 1) { sources += [ "visual_utils_unittest.cc" ] }
diff --git a/components/safe_browsing/content/password_protection/password_protection_navigation_throttle.cc b/components/safe_browsing/content/password_protection/password_protection_navigation_throttle.cc index 61b548a..36a0332 100644 --- a/components/safe_browsing/content/password_protection/password_protection_navigation_throttle.cc +++ b/components/safe_browsing/content/password_protection/password_protection_navigation_throttle.cc
@@ -29,6 +29,10 @@ content::NavigationThrottle::ThrottleCheckResult PasswordProtectionNavigationThrottle::WillStartRequest() { + // If a modal warning is being shown right now, we don't + // want to continue navigation. Otherwise, we assume that + // the PasswordProtectionRequest is still waiting for a + // verdict and so we defer the navigation. if (is_warning_showing_) return content::NavigationThrottle::CANCEL; return content::NavigationThrottle::DEFER; @@ -36,9 +40,15 @@ content::NavigationThrottle::ThrottleCheckResult PasswordProtectionNavigationThrottle::WillRedirectRequest() { + // If a modal warning is being shown right now, we don't + // want to redirect navigation. Otherwise, if the + // PasswordProtectionRequest still exists, we assume that the + // request is still waiting for a verdict and so we defer the + // navigation, otherwise we proceed navigation. if (is_warning_showing_) return content::NavigationThrottle::CANCEL; - return content::NavigationThrottle::DEFER; + return request_ ? content::NavigationThrottle::DEFER + : content::NavigationThrottle::PROCEED; } const char* PasswordProtectionNavigationThrottle::GetNameForLogging() { @@ -47,11 +57,20 @@ void PasswordProtectionNavigationThrottle::ResumeNavigation() { Resume(); + // When navigation is resumed, we do not need to keep track of the + // PasswordProtectionRequest because this method is only called + // after the request received a verdict and has finished. + request_.reset(); } void PasswordProtectionNavigationThrottle::CancelNavigation( content::NavigationThrottle::ThrottleCheckResult result) { + // When navigation is resumed, we do not need to keep track of the + // PasswordProtectionRequest because this method is only called + // after the request received a verdict, showing a modal warning and has + // finished. CancelDeferredNavigation(result); + request_.reset(); } } // namespace safe_browsing
diff --git a/components/safe_browsing/content/password_protection/password_protection_navigation_throttle.h b/components/safe_browsing/content/password_protection/password_protection_navigation_throttle.h index 98ae045d..cda16988 100644 --- a/components/safe_browsing/content/password_protection/password_protection_navigation_throttle.h +++ b/components/safe_browsing/content/password_protection/password_protection_navigation_throttle.h
@@ -39,7 +39,11 @@ override; const char* GetNameForLogging() override; + // Called to resume a deferred navigation once the PasswordProtectionRequest + // has received a verdict and there is no modal warning shown. void ResumeNavigation(); + // Called when the PasswordProtectionRequest has received a verdict and there + // is a modal warning shown. void CancelNavigation( content::NavigationThrottle::ThrottleCheckResult result);
diff --git a/components/safe_browsing/content/password_protection/password_protection_navigation_throttle_unittest.cc b/components/safe_browsing/content/password_protection/password_protection_navigation_throttle_unittest.cc new file mode 100644 index 0000000..cdf706c --- /dev/null +++ b/components/safe_browsing/content/password_protection/password_protection_navigation_throttle_unittest.cc
@@ -0,0 +1,144 @@ +// 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 "components/safe_browsing/content/password_protection/password_protection_navigation_throttle.h" + +#include <memory> + +#include "base/test/bind_test_util.h" +#include "components/safe_browsing/content/password_protection/mock_password_protection_service.h" +#include "components/safe_browsing/content/password_protection/password_protection_request.h" +#include "content/public/browser/navigation_handle.h" +#include "content/public/browser/navigation_throttle.h" +#include "content/public/browser/web_contents_observer.h" +#include "content/public/test/navigation_simulator.h" +#include "content/public/test/test_renderer_host.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace safe_browsing { + +class PasswordProtectionNavigationThrottleTest + : public content::RenderViewHostTestHarness, + public content::WebContentsObserver { + public: + PasswordProtectionNavigationThrottleTest() = default; + ~PasswordProtectionNavigationThrottleTest() override = default; + + // content::RenderViewHostTestHarness: + void SetUp() override { + content::RenderViewHostTestHarness::SetUp(); + + // Observe the WebContents to add the throttle. + Observe(RenderViewHostTestHarness::web_contents()); + } + + void TearDown() override { + content::RenderViewHostTestHarness::TearDown(); + throttle_.release(); + } + + void SetIsWarningShown(bool is_warning_shown) { + is_warning_shown_ = is_warning_shown; + } + + // content::WebContentsObserver: + void DidStartNavigation( + content::NavigationHandle* navigation_handle) override { + std::vector<password_manager::MatchingReusedCredential> credentials = { + {"http://example.test"}, {"http://2.example.com"}}; + std::unique_ptr<safe_browsing::MockPasswordProtectionService> + password_protection_service = + std::make_unique<safe_browsing::MockPasswordProtectionService>(); + + scoped_refptr<PasswordProtectionRequest> request = + new PasswordProtectionRequest( + RenderViewHostTestHarness::web_contents(), GURL(), GURL(), GURL(), + "username", PasswordType::PASSWORD_TYPE_UNKNOWN, credentials, + LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + /* password_field_exists*/ true, password_protection_service.get(), + /*request_timeout_in_ms=*/0); + std::unique_ptr<PasswordProtectionNavigationThrottle> throttle = + std::make_unique<PasswordProtectionNavigationThrottle>( + navigation_handle, request, is_warning_shown_); + throttle_ = std::move(throttle); + } + + std::unique_ptr<PasswordProtectionNavigationThrottle> throttle() { + return std::move(throttle_); + } + + protected: + std::unique_ptr<content::NavigationSimulator> StartNavigation( + const GURL& first_url) { + auto navigation_simulator = + content::NavigationSimulator::CreateRendererInitiated(first_url, + main_rfh()); + navigation_simulator->SetAutoAdvance(false); + navigation_simulator->Start(); + return navigation_simulator; + } + + bool is_warning_shown_ = false; + std::unique_ptr<PasswordProtectionNavigationThrottle> throttle_; + + private: + DISALLOW_COPY_AND_ASSIGN(PasswordProtectionNavigationThrottleTest); +}; + +TEST_F(PasswordProtectionNavigationThrottleTest, DeferOnNavigation) { + auto navigation_simulator = StartNavigation(GURL("http://www.example.com/")); + EXPECT_EQ(content::NavigationThrottle::DEFER, throttle()->WillStartRequest()); +} + +TEST_F(PasswordProtectionNavigationThrottleTest, + CancelNavigationOnWarningShown) { + SetIsWarningShown(true); + + auto navigation_simulator = StartNavigation(GURL("http://www.example.com/")); + EXPECT_EQ(content::NavigationThrottle::CANCEL, + throttle()->WillStartRequest()); +} + +TEST_F(PasswordProtectionNavigationThrottleTest, WillDeferRedirectRequest) { + auto navigation_simulator = StartNavigation(GURL("http://www.example.com/")); + + std::unique_ptr<PasswordProtectionNavigationThrottle> throttle_copy = + std::move(throttle_); + throttle_copy->set_resume_callback_for_testing( + base::BindLambdaForTesting([&]() {})); + EXPECT_EQ(content::NavigationThrottle::DEFER, + throttle_copy->WillRedirectRequest()); + + // Release request. + throttle_copy->ResumeNavigation(); + EXPECT_EQ(content::NavigationThrottle::PROCEED, + throttle_copy->WillRedirectRequest()); +} + +TEST_F(PasswordProtectionNavigationThrottleTest, WillCancelRedirectRequest) { + auto navigation_simulator = StartNavigation(GURL("http://www.example.com/")); + + // Release request. + std::unique_ptr<PasswordProtectionNavigationThrottle> throttle_copy = + std::move(throttle_); + throttle_copy->set_cancel_deferred_navigation_callback_for_testing( + base::BindRepeating( + [](content::NavigationThrottle::ThrottleCheckResult result) {})); + throttle_copy->CancelNavigation(content::NavigationThrottle::DEFER); + + EXPECT_EQ(content::NavigationThrottle::PROCEED, + throttle_copy->WillRedirectRequest()); +} + +TEST_F(PasswordProtectionNavigationThrottleTest, + WillCancelRedirectRequestOnWarningShown) { + SetIsWarningShown(true); + + auto navigation_simulator = StartNavigation(GURL("http://www.example.com/")); + EXPECT_EQ(content::NavigationThrottle::CANCEL, + throttle()->WillRedirectRequest()); +} + +} // namespace safe_browsing \ No newline at end of file
diff --git a/components/signin/public/android/java/src/org/chromium/components/signin/identitymanager/IdentityManager.java b/components/signin/public/android/java/src/org/chromium/components/signin/identitymanager/IdentityManager.java index 5f99c2c4..845fe1d 100644 --- a/components/signin/public/android/java/src/org/chromium/components/signin/identitymanager/IdentityManager.java +++ b/components/signin/public/android/java/src/org/chromium/components/signin/identitymanager/IdentityManager.java
@@ -46,6 +46,11 @@ * the settings. */ default void onAccountsCookieDeletedByUserAction() {} + + /** + * Called after an account is updated. + */ + default void onExtendedAccountInfoUpdated(AccountInfo accountInfo) {} } /** * A simple callback for getAccessToken. @@ -127,6 +132,16 @@ } /** + * Called after an account is updated. + */ + @CalledByNative + private void onExtendedAccountInfoUpdated(AccountInfo accountInfo) { + for (Observer observer : mObservers) { + observer.onExtendedAccountInfoUpdated(accountInfo); + } + } + + /** * Returns whether the user's primary account is available. */ public boolean hasPrimaryAccount() {
diff --git a/components/signin/public/base/signin_metrics.h b/components/signin/public/base/signin_metrics.h index d3d696b..37c25d6 100644 --- a/components/signin/public/base/signin_metrics.h +++ b/components/signin/public/base/signin_metrics.h
@@ -62,6 +62,8 @@ // User cleared account cookies when there's no sync consent, which has caused // sign out. USER_DELETED_ACCOUNT_COOKIES, + // Signout triggered by MobileIdentityConsistency rollback. + MOBILE_IDENTITY_CONSISTENCY_ROLLBACK, // Keep this as the last enum. NUM_PROFILE_SIGNOUT_METRICS, };
diff --git a/components/signin/public/identity_manager/identity_manager.cc b/components/signin/public/identity_manager/identity_manager.cc index 7221ec7c..b39d993 100644 --- a/components/signin/public/identity_manager/identity_manager.cc +++ b/components/signin/public/identity_manager/identity_manager.cc
@@ -636,6 +636,13 @@ for (auto& observer : observer_list_) { observer.OnExtendedAccountInfoUpdated(info); } +#if defined(OS_ANDROID) + if (java_identity_manager_) { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_IdentityManager_onExtendedAccountInfoUpdated( + env, java_identity_manager_, ConvertToJavaAccountInfo(env, info)); + } +#endif } void IdentityManager::OnAccountRemoved(const AccountInfo& info) {
diff --git a/components/subresource_filter/content/browser/ruleset_service.cc b/components/subresource_filter/content/browser/ruleset_service.cc index dfb799efe..8bda760 100644 --- a/components/subresource_filter/content/browser/ruleset_service.cc +++ b/components/subresource_filter/content/browser/ruleset_service.cc
@@ -29,6 +29,7 @@ #include "components/subresource_filter/content/common/subresource_filter_messages.h" #include "components/subresource_filter/core/browser/copying_file_stream.h" #include "components/subresource_filter/core/browser/subresource_filter_constants.h" +#include "components/subresource_filter/core/browser/subresource_filter_features.h" #include "components/subresource_filter/core/common/common_features.h" #include "components/subresource_filter/core/common/indexed_ruleset.h" #include "components/subresource_filter/core/common/time_measurements.h" @@ -161,6 +162,35 @@ decltype(&base::ReplaceFile) RulesetService::g_replace_file_func = &base::ReplaceFile; +// static +std::unique_ptr<RulesetService> RulesetService::Create( + PrefService* local_state, + const base::FilePath& user_data_dir) { + if (!base::FeatureList::IsEnabled(kSafeBrowsingSubresourceFilter)) { + return nullptr; + } + + // Runner for tasks critical for user experience. + scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( + base::ThreadPool::CreateSequencedTaskRunner( + {base::MayBlock(), base::TaskPriority::USER_BLOCKING, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})); + + // Runner for tasks that do not influence user experience. + scoped_refptr<base::SequencedTaskRunner> background_task_runner( + base::ThreadPool::CreateSequencedTaskRunner( + {base::MayBlock(), base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})); + + base::FilePath indexed_ruleset_base_dir = + user_data_dir.Append(kTopLevelDirectoryName) + .Append(kIndexedRulesetBaseDirectoryName); + + return std::make_unique<RulesetService>(local_state, background_task_runner, + indexed_ruleset_base_dir, + blocking_task_runner); +} + RulesetService::RulesetService( PrefService* local_state, scoped_refptr<base::SequencedTaskRunner> background_task_runner,
diff --git a/components/subresource_filter/content/browser/ruleset_service.h b/components/subresource_filter/content/browser/ruleset_service.h index dcef948..4cc9eab6a 100644 --- a/components/subresource_filter/content/browser/ruleset_service.h +++ b/components/subresource_filter/content/browser/ruleset_service.h
@@ -144,10 +144,18 @@ MAX, }; - // Creates a new instance of a ruleset. This is then assigned to a - // RulesetPublisher that calls Initialize for this ruleset service. - // Starts initialization of the RulesetService, performing tasks that won't - // slow down Chrome startup, then queues the FinishInitialization task. + // Creates a new instance of a ruleset with common configuration for + // production usage in embedders. + static std::unique_ptr<RulesetService> Create( + PrefService* local_state, + const base::FilePath& user_data_dir); + + // Creates a new instance of a ruleset This is then assigned to a + // RulesetPublisher that calls Initialize for this ruleset service. Starts + // initialization of the RulesetService, performing tasks that won't slow down + // Chrome startup, then queues the FinishInitialization task. + // NOTE: This constructor supports specifying various params explicitly for + // tests. Production code should favor RulesetService::Create(). RulesetService( PrefService* local_state, scoped_refptr<base::SequencedTaskRunner> background_task_runner,
diff --git a/components/sync/BUILD.gn b/components/sync/BUILD.gn index d3b3f04..b0454a7 100644 --- a/components/sync/BUILD.gn +++ b/components/sync/BUILD.gn
@@ -523,7 +523,6 @@ "protocol/proto_value_conversions_unittest.cc", "trusted_vault/securebox_unittest.cc", "trusted_vault/standalone_trusted_vault_backend_unittest.cc", - "trusted_vault/standalone_trusted_vault_client_unittest.cc", "trusted_vault/trusted_vault_access_token_fetcher_frontend_unittest.cc", ]
diff --git a/components/sync/driver/glue/sync_engine_impl_unittest.cc b/components/sync/driver/glue/sync_engine_impl_unittest.cc index 9eecc10..7b74e68 100644 --- a/components/sync/driver/glue/sync_engine_impl_unittest.cc +++ b/components/sync/driver/glue/sync_engine_impl_unittest.cc
@@ -56,6 +56,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" +using testing::_; using testing::NiceMock; using testing::NotNull; @@ -196,12 +197,8 @@ sync_prefs_ = std::make_unique<SyncPrefs>(&pref_service_); sync_thread_.StartAndWaitForTesting(); - ON_CALL(invalidator_, UpdateInterestedTopics(testing::_, testing::_)) + ON_CALL(invalidator_, UpdateInterestedTopics(_, _)) .WillByDefault(testing::Return(true)); - backend_ = std::make_unique<SyncEngineImpl>( - "dummyDebugName", &invalidator_, GetSyncInvalidationsService(), - sync_prefs_->AsWeakPtr(), - temp_dir_.GetPath().Append(base::FilePath(kTestSyncDir))); fake_manager_factory_ = std::make_unique<FakeSyncManagerFactory>( &fake_manager_, network::TestNetworkConnectionTracker::GetInstance()); @@ -229,8 +226,19 @@ base::RunLoop().RunUntilIdle(); } + void CreateBackend() { + backend_ = std::make_unique<SyncEngineImpl>( + "dummyDebugName", &invalidator_, GetSyncInvalidationsService(), + sync_prefs_->AsWeakPtr(), + temp_dir_.GetPath().Append(base::FilePath(kTestSyncDir))); + } + // Synchronously initializes the backend. void InitializeBackend(bool expect_success) { + if (!backend_) { + CreateBackend(); + } + host_.SetExpectSuccess(expect_success); SyncEngine::InitParams params; @@ -675,6 +683,7 @@ TEST_F(SyncEngineImplWithSyncInvalidationsTest, ShouldInvalidateDataTypesOnIncomingInvalidation) { + CreateBackend(); EXPECT_CALL(mock_instance_id_driver_, AddListener(backend_.get())); InitializeBackend(/*expect_success=*/true); @@ -713,9 +722,14 @@ DoNotUseOldInvalidationsAtAll) { enabled_types_.PutAll({AUTOFILL_WALLET_DATA, AUTOFILL_WALLET_OFFER}); + // Since the old invalidations system is not being used anymore (based on the + // enabled feature flags), SyncEngine should call the (old) invalidator with + // an empty TopicSet upon construction. + EXPECT_CALL(invalidator_, UpdateInterestedTopics(_, TopicSet())); + CreateBackend(); + + EXPECT_CALL(invalidator_, UpdateInterestedTopics(_, _)).Times(0); InitializeBackend(/*expect_success=*/true); - EXPECT_CALL(invalidator_, UpdateInterestedTopics(testing::_, testing::_)) - .Times(0); ConfigureDataTypes(); }
diff --git a/components/sync/trusted_vault/standalone_trusted_vault_backend_unittest.cc b/components/sync/trusted_vault/standalone_trusted_vault_backend_unittest.cc index d6bc767..5948ed4 100644 --- a/components/sync/trusted_vault/standalone_trusted_vault_backend_unittest.cc +++ b/components/sync/trusted_vault/standalone_trusted_vault_backend_unittest.cc
@@ -12,7 +12,9 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/test/bind_test_util.h" +#include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" +#include "components/os_crypt/os_crypt.h" #include "components/os_crypt/os_crypt_mocker.h" #include "components/sync/driver/sync_driver_switches.h" #include "components/sync/trusted_vault/securebox.h" @@ -25,10 +27,19 @@ namespace { using testing::_; +using testing::ElementsAre; using testing::Eq; using testing::IsEmpty; +using testing::Ne; using testing::NotNull; +MATCHER_P(KeyMaterialEq, expected, "") { + const std::string& key_material = arg.key_material(); + const std::vector<uint8_t> key_material_as_bytes(key_material.begin(), + key_material.end()); + return key_material_as_bytes == expected; +} + base::FilePath CreateUniqueTempDir(base::ScopedTempDir* temp_dir) { EXPECT_TRUE(temp_dir->CreateUniqueTempDir()); return temp_dir->GetPath(); @@ -78,6 +89,8 @@ StandaloneTrustedVaultBackend* backend() { return backend_.get(); } + const base::FilePath& file_path() { return file_path_; } + // Stores |vault_keys| and mimics successful device registration, returns // private device key material. std::vector<uint8_t> StoreKeysAndMimicDeviceRegistration( @@ -123,6 +136,138 @@ scoped_refptr<StandaloneTrustedVaultBackend> backend_; }; +TEST_F(StandaloneTrustedVaultBackendTest, ShouldFetchEmptyKeys) { + CoreAccountInfo account_info; + account_info.gaia = "user"; + // Callback should be called immediately. + base::MockCallback<StandaloneTrustedVaultBackend::FetchKeysCallback> + fetch_keys_callback; + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/IsEmpty())); + backend()->FetchKeys(account_info, fetch_keys_callback.Get()); +} + +TEST_F(StandaloneTrustedVaultBackendTest, ShouldReadAndFetchNonEmptyKeys) { + CoreAccountInfo account_info_1; + account_info_1.gaia = "user1"; + CoreAccountInfo account_info_2; + account_info_2.gaia = "user2"; + + const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; + const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; + const std::vector<uint8_t> kKey3 = {2, 3, 4}; + + sync_pb::LocalTrustedVault initial_data; + sync_pb::LocalTrustedVaultPerUser* user_data1 = initial_data.add_user(); + sync_pb::LocalTrustedVaultPerUser* user_data2 = initial_data.add_user(); + user_data1->set_gaia_id(account_info_1.gaia); + user_data2->set_gaia_id(account_info_2.gaia); + user_data1->add_vault_key()->set_key_material(kKey1.data(), kKey1.size()); + user_data2->add_vault_key()->set_key_material(kKey2.data(), kKey2.size()); + user_data2->add_vault_key()->set_key_material(kKey3.data(), kKey3.size()); + + std::string encrypted_data; + ASSERT_TRUE(OSCrypt::EncryptString(initial_data.SerializeAsString(), + &encrypted_data)); + ASSERT_NE(-1, base::WriteFile(file_path(), encrypted_data.c_str(), + encrypted_data.size())); + + backend()->ReadDataFromDisk(); + + // Keys should be fetched immediately for both accounts. + base::MockCallback<StandaloneTrustedVaultBackend::FetchKeysCallback> + fetch_keys_callback; + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/ElementsAre(kKey1))); + backend()->FetchKeys(account_info_1, fetch_keys_callback.Get()); + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/ElementsAre(kKey2, kKey3))); + backend()->FetchKeys(account_info_2, fetch_keys_callback.Get()); +} + +TEST_F(StandaloneTrustedVaultBackendTest, ShouldStoreKeys) { + const std::string kGaiaId1 = "user1"; + const std::string kGaiaId2 = "user2"; + const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; + const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; + const std::vector<uint8_t> kKey3 = {2, 3, 4}; + const std::vector<uint8_t> kKey4 = {3, 4}; + + backend()->StoreKeys(kGaiaId1, {kKey1}, /*last_key_version=*/7); + backend()->StoreKeys(kGaiaId2, {kKey2}, /*last_key_version=*/8); + // Keys for |kGaiaId2| overridden, so |kKey2| should be lost. + backend()->StoreKeys(kGaiaId2, {kKey3, kKey4}, /*last_key_version=*/9); + + // Read the file from disk. + std::string ciphertext; + std::string decrypted_content; + sync_pb::LocalTrustedVault proto; + EXPECT_TRUE(base::ReadFileToString(file_path(), &ciphertext)); + EXPECT_THAT(ciphertext, Ne("")); + EXPECT_TRUE(OSCrypt::DecryptString(ciphertext, &decrypted_content)); + EXPECT_TRUE(proto.ParseFromString(decrypted_content)); + ASSERT_THAT(proto.user_size(), Eq(2)); + EXPECT_THAT(proto.user(0).vault_key(), ElementsAre(KeyMaterialEq(kKey1))); + EXPECT_THAT(proto.user(0).last_vault_key_version(), Eq(7)); + EXPECT_THAT(proto.user(1).vault_key(), + ElementsAre(KeyMaterialEq(kKey3), KeyMaterialEq(kKey4))); + EXPECT_THAT(proto.user(1).last_vault_key_version(), Eq(9)); +} + +TEST_F(StandaloneTrustedVaultBackendTest, ShouldFetchPreviouslyStoredKeys) { + CoreAccountInfo account_info_1; + account_info_1.gaia = "user1"; + CoreAccountInfo account_info_2; + account_info_2.gaia = "user2"; + + const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; + const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; + const std::vector<uint8_t> kKey3 = {2, 3, 4}; + + backend()->StoreKeys(account_info_1.gaia, {kKey1}, /*last_key_version=*/0); + backend()->StoreKeys(account_info_2.gaia, {kKey2, kKey3}, + /*last_key_version=*/1); + + // Instantiate a second backend to read the file. + auto other_backend = base::MakeRefCounted<StandaloneTrustedVaultBackend>( + file_path(), + std::make_unique<testing::NiceMock<MockTrustedVaultConnection>>()); + other_backend->ReadDataFromDisk(); + + // Keys should be fetched immediately for both accounts. + base::MockCallback<StandaloneTrustedVaultBackend::FetchKeysCallback> + fetch_keys_callback; + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/ElementsAre(kKey1))); + other_backend->FetchKeys(account_info_1, fetch_keys_callback.Get()); + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/ElementsAre(kKey2, kKey3))); + other_backend->FetchKeys(account_info_2, fetch_keys_callback.Get()); +} + +TEST_F(StandaloneTrustedVaultBackendTest, ShouldRemoveAllStoredKeys) { + CoreAccountInfo account_info_1; + account_info_1.gaia = "user1"; + CoreAccountInfo account_info_2; + account_info_2.gaia = "user2"; + + const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; + const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; + const std::vector<uint8_t> kKey3 = {2, 3, 4}; + + backend()->StoreKeys(account_info_1.gaia, {kKey1}, /*last_key_version=*/0); + backend()->StoreKeys(account_info_2.gaia, {kKey2, kKey3}, + /*last_key_version=*/1); + + backend()->RemoveAllStoredKeys(); + + // Keys should be removed from both in-memory and disk storages. + base::MockCallback<StandaloneTrustedVaultBackend::FetchKeysCallback> + fetch_keys_callback; + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/IsEmpty())); + backend()->FetchKeys(account_info_1, fetch_keys_callback.Get()); + + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/IsEmpty())); + backend()->FetchKeys(account_info_2, fetch_keys_callback.Get()); + + EXPECT_FALSE(base::PathExists(file_path())); +} + TEST_F(StandaloneTrustedVaultBackendTest, ShouldRegisterDevice) { CoreAccountInfo account_info; account_info.gaia = "user"; @@ -182,13 +327,10 @@ std::vector<std::vector<uint8_t>> fetched_keys; // Callback should be called immediately. - backend()->FetchKeys(account_info, - base::BindLambdaForTesting( - [&](const std::vector<std::vector<uint8_t>>& keys) { - fetched_keys = keys; - })); - - EXPECT_THAT(fetched_keys, Eq(kVaultKeys)); + base::MockCallback<StandaloneTrustedVaultBackend::FetchKeysCallback> + fetch_keys_callback; + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/Eq(kVaultKeys))); + backend()->FetchKeys(account_info, fetch_keys_callback.Get()); } TEST_F(StandaloneTrustedVaultBackendTest, ShouldDownloadKeys) { @@ -220,28 +362,23 @@ download_keys_callback = std::move(callback); }); - std::vector<std::vector<uint8_t>> fetched_keys; // FetchKeys() should trigger keys downloading. - backend()->FetchKeys(account_info, - base::BindLambdaForTesting( - [&](const std::vector<std::vector<uint8_t>>& keys) { - fetched_keys = keys; - })); + base::MockCallback<StandaloneTrustedVaultBackend::FetchKeysCallback> + fetch_keys_callback; + backend()->FetchKeys(account_info, fetch_keys_callback.Get()); ASSERT_FALSE(download_keys_callback.is_null()); - ASSERT_THAT(fetched_keys, IsEmpty()); // Ensure that the right device key was passed into DonwloadKeys(). ASSERT_THAT(device_key_pair, NotNull()); EXPECT_THAT(device_key_pair->private_key().ExportToBytes(), Eq(private_device_key_material)); - // Mimic successful key downloading. + // Mimic successful key downloading, it should make fetch keys attempt + // completed. + EXPECT_CALL(fetch_keys_callback, Run(/*keys=*/Eq(kNewVaultKeys))); std::move(download_keys_callback) .Run(TrustedVaultRequestStatus::kSuccess, kNewVaultKeys, kNewLastKeyVersion); - - // Now fetch keys attempt should be completed. - EXPECT_THAT(fetched_keys, Eq(kNewVaultKeys)); } } // namespace
diff --git a/components/sync/trusted_vault/standalone_trusted_vault_client_unittest.cc b/components/sync/trusted_vault/standalone_trusted_vault_client_unittest.cc deleted file mode 100644 index 7186581..0000000 --- a/components/sync/trusted_vault/standalone_trusted_vault_client_unittest.cc +++ /dev/null
@@ -1,263 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/sync/trusted_vault/standalone_trusted_vault_client.h" - -#include "base/containers/span.h" -#include "base/files/file_util.h" -#include "base/files/scoped_temp_dir.h" -#include "base/run_loop.h" -#include "base/test/bind_test_util.h" -#include "base/test/scoped_feature_list.h" -#include "base/test/task_environment.h" -#include "components/os_crypt/os_crypt.h" -#include "components/os_crypt/os_crypt_mocker.h" -#include "components/signin/public/identity_manager/account_info.h" -#include "components/signin/public/identity_manager/identity_test_environment.h" -#include "components/sync/engine/sync_engine_switches.h" -#include "components/sync/protocol/local_trusted_vault.pb.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace syncer { - -namespace { - -using testing::ElementsAre; -using testing::Eq; -using testing::IsEmpty; -using testing::Ne; - -MATCHER_P(KeyMaterialEq, expected, "") { - const std::string& key_material = arg.key_material(); - const std::vector<uint8_t> key_material_as_bytes(key_material.begin(), - key_material.end()); - return key_material_as_bytes == expected; -} - -base::FilePath CreateUniqueTempDir(base::ScopedTempDir* temp_dir) { - EXPECT_TRUE(temp_dir->CreateUniqueTempDir()); - return temp_dir->GetPath(); -} - -// Issues a call to FetchKeys() for client |client| and waits until the callback -// completes. |client| must not be null. -std::vector<std::vector<uint8_t>> FetchKeysAndWaitForClient( - const std::string& gaia_id, - StandaloneTrustedVaultClient* client) { - DCHECK(client); - - CoreAccountInfo account_info; - account_info.gaia = gaia_id; - - base::RunLoop loop; - std::vector<std::vector<uint8_t>> fetched_keys; - client->FetchKeys(account_info, - base::BindLambdaForTesting( - [&](const std::vector<std::vector<uint8_t>>& keys) { - fetched_keys = keys; - loop.Quit(); - })); - loop.Run(); - return fetched_keys; -} - -class StandaloneTrustedVaultClientTest : public testing::Test { - protected: - StandaloneTrustedVaultClientTest() - : file_path_(CreateUniqueTempDir(&temp_dir_) - .Append(base::FilePath(FILE_PATH_LITERAL("some_file")))), - client_(file_path_, identity_env_.identity_manager()) { - override_features_.InitAndEnableFeature( - switches::kSyncSupportTrustedVaultPassphrase); - } - - ~StandaloneTrustedVaultClientTest() override = default; - - void SetUp() override { OSCryptMocker::SetUp(); } - - void TearDown() override { OSCryptMocker::TearDown(); } - - std::vector<std::vector<uint8_t>> FetchKeysAndWait( - const std::string& gaia_id) { - return FetchKeysAndWaitForClient(gaia_id, &client_); - } - - void WaitForFlush() { - base::RunLoop loop; - client_.WaitForFlushForTesting(loop.QuitClosure()); - loop.Run(); - } - - base::Optional<CoreAccountInfo> FetchBackendPrimaryAccountAndWait() { - base::RunLoop loop; - base::Optional<CoreAccountInfo> fetched_primary_account; - client_.FetchBackendPrimaryAccountForTesting(base::BindLambdaForTesting( - [&](const base::Optional<CoreAccountInfo>& primary_account) { - fetched_primary_account = primary_account; - loop.Quit(); - })); - loop.Run(); - return fetched_primary_account; - } - - base::test::ScopedFeatureList override_features_; - base::test::TaskEnvironment task_environment_; - base::ScopedTempDir temp_dir_; - const base::FilePath file_path_; - // |identity_env_| should outlive |client_|. - signin::IdentityTestEnvironment identity_env_; - StandaloneTrustedVaultClient client_; -}; - -TEST_F(StandaloneTrustedVaultClientTest, ShouldFetchEmptyKeys) { - const std::string kGaiaId = "user1"; - EXPECT_THAT(FetchKeysAndWait(kGaiaId), IsEmpty()); -} - -TEST_F(StandaloneTrustedVaultClientTest, ShouldFetchNonEmptyKeys) { - const std::string kGaiaId1 = "user1"; - const std::string kGaiaId2 = "user2"; - const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; - const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; - const std::vector<uint8_t> kKey3 = {2, 3, 4}; - - sync_pb::LocalTrustedVault initial_data; - sync_pb::LocalTrustedVaultPerUser* user_data1 = initial_data.add_user(); - sync_pb::LocalTrustedVaultPerUser* user_data2 = initial_data.add_user(); - user_data1->set_gaia_id(kGaiaId1); - user_data2->set_gaia_id(kGaiaId2); - user_data1->add_vault_key()->set_key_material(kKey1.data(), kKey1.size()); - user_data2->add_vault_key()->set_key_material(kKey2.data(), kKey2.size()); - user_data2->add_vault_key()->set_key_material(kKey3.data(), kKey3.size()); - - std::string encrypted_data; - ASSERT_TRUE(OSCrypt::EncryptString(initial_data.SerializeAsString(), - &encrypted_data)); - ASSERT_NE(-1, base::WriteFile(file_path_, encrypted_data.c_str(), - encrypted_data.size())); - - // Initialize new client to read the data from the file. - StandaloneTrustedVaultClient client(file_path_, - identity_env_.identity_manager()); - EXPECT_THAT(FetchKeysAndWaitForClient(kGaiaId1, &client), ElementsAre(kKey1)); - EXPECT_THAT(FetchKeysAndWaitForClient(kGaiaId2, &client), - ElementsAre(kKey2, kKey3)); -} - -TEST_F(StandaloneTrustedVaultClientTest, ShouldStoreKeys) { - const std::string kGaiaId1 = "user1"; - const std::string kGaiaId2 = "user2"; - const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; - const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; - const std::vector<uint8_t> kKey3 = {2, 3, 4}; - const std::vector<uint8_t> kKey4 = {3, 4}; - - client_.StoreKeys(kGaiaId1, {kKey1}, /*last_key_version=*/7); - client_.StoreKeys(kGaiaId2, {kKey2}, /*last_key_version=*/8); - // Keys for |kGaiaId2| overriden, so |kKey2| should be lost. - client_.StoreKeys(kGaiaId2, {kKey3, kKey4}, /*last_key_version=*/9); - - // Wait until the last write completes. - WaitForFlush(); - - // Read the file from disk. - std::string ciphertext; - std::string decrypted_content; - sync_pb::LocalTrustedVault proto; - EXPECT_TRUE(base::ReadFileToString(file_path_, &ciphertext)); - EXPECT_THAT(ciphertext, Ne("")); - EXPECT_TRUE(OSCrypt::DecryptString(ciphertext, &decrypted_content)); - EXPECT_TRUE(proto.ParseFromString(decrypted_content)); - ASSERT_THAT(proto.user_size(), Eq(2)); - EXPECT_THAT(proto.user(0).vault_key(), ElementsAre(KeyMaterialEq(kKey1))); - EXPECT_THAT(proto.user(0).last_vault_key_version(), Eq(7)); - EXPECT_THAT(proto.user(1).vault_key(), - ElementsAre(KeyMaterialEq(kKey3), KeyMaterialEq(kKey4))); - EXPECT_THAT(proto.user(1).last_vault_key_version(), Eq(9)); -} - -TEST_F(StandaloneTrustedVaultClientTest, ShouldFetchPreviouslyStoredKeys) { - const std::string kGaiaId1 = "user1"; - const std::string kGaiaId2 = "user2"; - const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; - const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; - const std::vector<uint8_t> kKey3 = {2, 3, 4}; - - client_.StoreKeys(kGaiaId1, {kKey1}, /*last_key_version=*/0); - client_.StoreKeys(kGaiaId2, {kKey2, kKey3}, /*last_key_version=*/1); - - // Wait until the last write completes. - WaitForFlush(); - - // Instantiate a second client to read the file. - StandaloneTrustedVaultClient other_client(file_path_, - identity_env_.identity_manager()); - EXPECT_THAT(FetchKeysAndWaitForClient(kGaiaId1, &other_client), - ElementsAre(kKey1)); - EXPECT_THAT(FetchKeysAndWaitForClient(kGaiaId2, &other_client), - ElementsAre(kKey2, kKey3)); -} - -TEST_F(StandaloneTrustedVaultClientTest, ShouldRemoveAllStoredKeys) { - const std::string kGaiaId1 = "user1"; - const std::string kGaiaId2 = "user2"; - const std::vector<uint8_t> kKey1 = {0, 1, 2, 3, 4}; - const std::vector<uint8_t> kKey2 = {1, 2, 3, 4}; - const std::vector<uint8_t> kKey3 = {2, 3, 4}; - - client_.StoreKeys(kGaiaId1, {kKey1}, /*last_key_version=*/0); - client_.StoreKeys(kGaiaId2, {kKey2, kKey3}, /*last_key_version=*/1); - - // Wait until the last write completes. - WaitForFlush(); - client_.RemoveAllStoredKeys(); - - // Wait until the last write completes. - WaitForFlush(); - - // Keys should be removed from both in-memory and disk storages. - EXPECT_THAT(FetchKeysAndWait(kGaiaId1), IsEmpty()); - EXPECT_THAT(FetchKeysAndWait(kGaiaId2), IsEmpty()); - EXPECT_FALSE(base::PathExists(file_path_)); -} - -// ChromeOS doesn't support sign-out. -#if !defined(OS_CHROMEOS) -TEST_F(StandaloneTrustedVaultClientTest, ShouldPopulatePrimaryAccountChanges) { - // Set initial primary account before backend initialization. - const std::string email1 = "user1@gmail.com"; - identity_env_.SetPrimaryAccount(email1); - - // Verify that current primary account corresponds to |email1|. - base::Optional<CoreAccountInfo> current_primary_account = - FetchBackendPrimaryAccountAndWait(); - ASSERT_THAT(current_primary_account, Ne(base::nullopt)); - EXPECT_THAT(current_primary_account->email, Eq(email1)); - - // Remove primary account. - identity_env_.ClearPrimaryAccount(); - current_primary_account = FetchBackendPrimaryAccountAndWait(); - EXPECT_THAT(current_primary_account, Eq(base::nullopt)); - - // Set new primary account. - const std::string email2 = "user2@gmail.com"; - identity_env_.SetPrimaryAccount(email2); - current_primary_account = FetchBackendPrimaryAccountAndWait(); - ASSERT_THAT(current_primary_account, Ne(base::nullopt)); - EXPECT_THAT(current_primary_account->email, Eq(email2)); - - // Set unconsented primary account. - const std::string email3 = "user3@gmail.com"; - identity_env_.ClearPrimaryAccount(); - identity_env_.SetUnconsentedPrimaryAccount(email3); - current_primary_account = FetchBackendPrimaryAccountAndWait(); - ASSERT_THAT(current_primary_account, Ne(base::nullopt)); - EXPECT_THAT(current_primary_account->email, Eq(email3)); -} -#endif - -} // namespace - -} // namespace syncer
diff --git a/components/viz/service/display_embedder/skia_output_device_buffer_queue_unittest.cc b/components/viz/service/display_embedder/skia_output_device_buffer_queue_unittest.cc index 981986d9..f8a2e2f 100644 --- a/components/viz/service/display_embedder/skia_output_device_buffer_queue_unittest.cc +++ b/components/viz/service/display_embedder/skia_output_device_buffer_queue_unittest.cc
@@ -242,7 +242,13 @@ output_device_ = std::move(onscreen_device); } - void TearDownOnGpu() override { output_device_.reset(); } + void TearDownOnGpu() override { + output_device_.reset(); + shared_image_representation_factory_.reset(); + shared_image_factory_.reset(); + memory_tracker_.reset(); + gl_surface_.reset(); + } using Image = OutputPresenter::Image;
diff --git a/content/browser/accessibility/accessibility_ipc_error_browsertest.cc b/content/browser/accessibility/accessibility_ipc_error_browsertest.cc index 6bd8984..75ed16d1 100644 --- a/content/browser/accessibility/accessibility_ipc_error_browsertest.cc +++ b/content/browser/accessibility/accessibility_ipc_error_browsertest.cc
@@ -43,12 +43,15 @@ // Failed on Android x86 in crbug.com/1123641. #if defined(OS_ANDROID) && defined(ARCH_CPU_X86) #define MAYBE_ResetBrowserAccessibilityManager \ - DISABLED_WeeklyAggregateDataUseResetBrowserAccessibilityManager + DISABLED_ResetBrowserAccessibilityManager #else -#define MAYBE_ResetBrowserAccessibilityManager WeeklyAggregateDataUse +#define MAYBE_ResetBrowserAccessibilityManager ResetBrowserAccessibilityManager #endif IN_PROC_BROWSER_TEST_F(AccessibilityIpcErrorBrowserTest, MAYBE_ResetBrowserAccessibilityManager) { + // Allow accessibility to reset itself on error, rather than failing. + RenderFrameHostImpl::max_accessibility_resets_ = 99; + // Create a data url and load it. const char url_str[] = "data:text/html," @@ -109,6 +112,7 @@ frame->set_no_create_browser_accessibility_manager_for_testing(false); const ui::AXTree* tree = nullptr; { + // Because we missed one IPC message, AXTree::Unserialize() will fail. AccessibilityNotificationWaiter waiter( shell()->web_contents(), ui::kAXModeComplete, ax::mojom::Event::kFocus); ASSERT_TRUE( @@ -148,6 +152,11 @@ #endif IN_PROC_BROWSER_TEST_F(AccessibilityIpcErrorBrowserTest, MAYBE_MultipleBadAccessibilityIPCsKillsRenderer) { + // We should be able to reset accessibility |max_iterations-1| times + // (see render_frame_host_impl.cc - max_accessibility_resets_), + // but the subsequent time the renderer should be killed. + int max_iterations = RenderFrameHostImpl::max_accessibility_resets_ + 1; + // Create a data url and load it. const char url_str[] = "data:text/html," @@ -179,11 +188,6 @@ bad_accessibility_event.updates[0].nodes[0].id = 1; bad_accessibility_event.updates[0].nodes[0].child_ids.push_back(2); - // We should be able to reset accessibility |max_iterations-1| times - // (see render_frame_host_impl.cc - kMaxAccessibilityResets), - // but the subsequent time the renderer should be killed. - int max_iterations = RenderFrameHostImpl::kMaxAccessibilityResets; - for (int iteration = 0; iteration < max_iterations; iteration++) { // Make sure the manager has been created. frame->GetOrCreateBrowserAccessibilityManager();
diff --git a/content/browser/accessibility/browser_accessibility_android.cc b/content/browser/accessibility/browser_accessibility_android.cc index a54854964..41fdf631 100644 --- a/content/browser/accessibility/browser_accessibility_android.cc +++ b/content/browser/accessibility/browser_accessibility_android.cc
@@ -553,6 +553,10 @@ if (IsMultiselectable()) return GetMultiselectableStateDescription(); + // For Toggle buttons, we will append "on"/"off" in the state description. + if (GetRole() == ax::mojom::Role::kToggleButton) + return GetToggleButtonStateDescription(); + // Otherwise we will not use state description return base::string16(); } @@ -589,6 +593,17 @@ values, nullptr); } +base::string16 BrowserAccessibilityAndroid::GetToggleButtonStateDescription() + const { + content::ContentClient* content_client = content::GetContentClient(); + + // For checked Toggle buttons, we will return "on", otherwise "off". + if (IsChecked()) + return content_client->GetLocalizedString(IDS_AX_TOGGLE_BUTTON_ON); + + return content_client->GetLocalizedString(IDS_AX_TOGGLE_BUTTON_OFF); +} + std::string BrowserAccessibilityAndroid::GetRoleString() const { return ui::ToString(GetRole()); }
diff --git a/content/browser/accessibility/browser_accessibility_android.h b/content/browser/accessibility/browser_accessibility_android.h index 3d9f79f..69a31ddb 100644 --- a/content/browser/accessibility/browser_accessibility_android.h +++ b/content/browser/accessibility/browser_accessibility_android.h
@@ -92,6 +92,7 @@ base::string16 GetStateDescription() const; base::string16 GetMultiselectableStateDescription() const; + base::string16 GetToggleButtonStateDescription() const; base::string16 GetRoleDescription() const;
diff --git a/content/browser/accessibility/browser_accessibility_manager.cc b/content/browser/accessibility/browser_accessibility_manager.cc index e39b6fa..9fda59c75 100644 --- a/content/browser/accessibility/browser_accessibility_manager.cc +++ b/content/browser/accessibility/browser_accessibility_manager.cc
@@ -191,22 +191,32 @@ ui::AXTreeManagerMap::GetInstance().RemoveTreeManager(ax_tree_id_); } +bool BrowserAccessibilityManager::Unserialize( + const ui::AXTreeUpdate& tree_update) { + if (ax_tree()->Unserialize(tree_update)) + return true; + + LOG(ERROR) << ax_tree()->error(); + LOG(ERROR) << tree_update.ToString(); + + static auto* ax_tree_error = base::debug::AllocateCrashKeyString( + "ax_tree_error", base::debug::CrashKeySize::Size256); + static auto* ax_tree_update = base::debug::AllocateCrashKeyString( + "ax_tree_update", base::debug::CrashKeySize::Size256); + // Temporarily log some additional crash keys so we can try to + // figure out why we're getting bad accessibility trees here. + // http://crbug.com/765490, https://crbug.com/1094848. + // Be sure to re-enable BrowserAccessibilityManagerTest.TestFatalError + // when done (or delete it if no longer needed). + base::debug::SetCrashKeyString(ax_tree_error, ax_tree()->error()); + base::debug::SetCrashKeyString(ax_tree_update, tree_update.ToString()); + return false; +} + void BrowserAccessibilityManager::Initialize( const ui::AXTreeUpdate& initial_tree) { - if (!ax_tree()->Unserialize(initial_tree)) { - static auto* ax_tree_error = base::debug::AllocateCrashKeyString( - "ax_tree_error", base::debug::CrashKeySize::Size64); - static auto* ax_tree_update = base::debug::AllocateCrashKeyString( - "ax_tree_update", base::debug::CrashKeySize::Size256); - // Temporarily log some additional crash keys so we can try to - // figure out why we're getting bad accessibility trees here. - // http://crbug.com/765490 - // Be sure to re-enable BrowserAccessibilityManagerTest.TestFatalError - // when done (or delete it if no longer needed). - base::debug::SetCrashKeyString(ax_tree_error, ax_tree()->error()); - base::debug::SetCrashKeyString(ax_tree_update, initial_tree.ToString()); + if (!Unserialize(initial_tree)) LOG(FATAL) << ax_tree()->error(); - } } // A flag for use in tests to ensure events aren't suppressed or delayed. @@ -409,14 +419,12 @@ // Process all changes to the accessibility tree first. for (const ui::AXTreeUpdate& tree_update : *tree_updates) { - if (!ax_tree()->Unserialize(tree_update)) { + if (!Unserialize(tree_update)) { // This is a fatal error, but if there is a delegate, it will handle the - // error result and recover by re-creating the manager. - if (delegate_) { - LOG(ERROR) << ax_tree()->error(); - } else { + // error result and recover by re-creating the manager. After a max + // threshold number of errors is reached, it will crash the browser. + if (!delegate_) CHECK(false) << ax_tree()->error(); - } return false; }
diff --git a/content/browser/accessibility/browser_accessibility_manager.h b/content/browser/accessibility/browser_accessibility_manager.h index 38c9fb06..cd05ef7 100644 --- a/content/browser/accessibility/browser_accessibility_manager.h +++ b/content/browser/accessibility/browser_accessibility_manager.h
@@ -590,6 +590,10 @@ static base::Optional<ui::AXTreeID> last_focused_node_tree_id_; private: + // Helper that calls AXTree::Unserialize(). On failure it populates crash data + // with error information. + bool Unserialize(const ui::AXTreeUpdate& tree_update); + // The underlying tree of accessibility objects. std::unique_ptr<ui::AXSerializableTree> tree_;
diff --git a/content/browser/accessibility/dump_accessibility_events_browsertest.cc b/content/browser/accessibility/dump_accessibility_events_browsertest.cc index 14e6232..84e68ab 100644 --- a/content/browser/accessibility/dump_accessibility_events_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_events_browsertest.cc
@@ -924,7 +924,7 @@ AccessibilityEventsVisibilityHiddenChanged #endif IN_PROC_BROWSER_TEST_P(DumpAccessibilityEventsTest, - AccessibilityEventsVisibilityHiddenChanged) { + MAYBE_AccessibilityEventsVisibilityHiddenChanged) { RunEventTest(FILE_PATH_LITERAL("visibility-hidden-changed.html")); }
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index 7575c91..50d26c6d 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -258,6 +258,10 @@ RunCSSTest(FILE_PATH_LITERAL("font-size.html")); } +IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityCSSDisplayNone) { + RunCSSTest(FILE_PATH_LITERAL("display-none.html")); +} + IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityCSSDisplayToNone) { RunCSSTest(FILE_PATH_LITERAL("display-to-none.html"));
diff --git a/content/browser/browser_interface_binders.cc b/content/browser/browser_interface_binders.cc index 9696cfa..e52da30 100644 --- a/content/browser/browser_interface_binders.cc +++ b/content/browser/browser_interface_binders.cc
@@ -548,11 +548,9 @@ map->Add<blink::mojom::IdleManager>(base::BindRepeating( &RenderFrameHostImpl::BindIdleManager, base::Unretained(host))); - if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI)) { - map->Add<blink::mojom::NativeFileSystemManager>( - base::BindRepeating(&RenderFrameHostImpl::GetNativeFileSystemManager, - base::Unretained(host))); - } + map->Add<blink::mojom::NativeFileSystemManager>( + base::BindRepeating(&RenderFrameHostImpl::GetNativeFileSystemManager, + base::Unretained(host))); // BrowserMainLoop::GetInstance() may be null on unit tests. if (BrowserMainLoop::GetInstance()) { @@ -906,10 +904,8 @@ &RenderProcessHostImpl::CreatePermissionService, host)); map->Add<blink::mojom::FileSystemManager>(BindWorkerReceiverForOrigin( &RenderProcessHostImpl::BindFileSystemManager, host)); - if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI)) { - map->Add<blink::mojom::NativeFileSystemManager>(BindWorkerReceiverForOrigin( - &RenderProcessHostImpl::BindNativeFileSystemManager, host)); - } + map->Add<blink::mojom::NativeFileSystemManager>(BindWorkerReceiverForOrigin( + &RenderProcessHostImpl::BindNativeFileSystemManager, host)); map->Add<blink::mojom::NativeIOHost>(BindWorkerReceiverForOrigin( &RenderProcessHostImpl::BindNativeIOHost, host)); map->Add<blink::mojom::NotificationService>(BindWorkerReceiverForOrigin( @@ -982,10 +978,8 @@ &RenderProcessHostImpl::CreatePaymentManagerForOrigin, host)); map->Add<blink::mojom::PermissionService>(BindWorkerReceiverForOrigin( &RenderProcessHostImpl::CreatePermissionService, host)); - if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI)) { - map->Add<blink::mojom::NativeFileSystemManager>(BindWorkerReceiverForOrigin( - &RenderProcessHostImpl::BindNativeFileSystemManager, host)); - } + map->Add<blink::mojom::NativeFileSystemManager>(BindWorkerReceiverForOrigin( + &RenderProcessHostImpl::BindNativeFileSystemManager, host)); map->Add<blink::mojom::NativeIOHost>(BindWorkerReceiverForOrigin( &RenderProcessHostImpl::BindNativeIOHost, host)); map->Add<blink::mojom::NotificationService>(BindWorkerReceiverForOrigin( @@ -1089,11 +1083,9 @@ &RenderProcessHostImpl::CreatePaymentManagerForOrigin, host)); map->Add<blink::mojom::PermissionService>(BindServiceWorkerReceiverForOrigin( &RenderProcessHostImpl::CreatePermissionService, host)); - if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI)) { - map->Add<blink::mojom::NativeFileSystemManager>( - BindServiceWorkerReceiverForOrigin( - &RenderProcessHostImpl::BindNativeFileSystemManager, host)); - } + map->Add<blink::mojom::NativeFileSystemManager>( + BindServiceWorkerReceiverForOrigin( + &RenderProcessHostImpl::BindNativeFileSystemManager, host)); map->Add<blink::mojom::NativeIOHost>(BindServiceWorkerReceiverForOrigin( &RenderProcessHostImpl::BindNativeIOHost, host)); map->Add<blink::mojom::NotificationService>(
diff --git a/content/browser/launch_as_mojo_client_browsertest.cc b/content/browser/launch_as_mojo_client_browsertest.cc index ccf7fea1..94b17db5 100644 --- a/content/browser/launch_as_mojo_client_browsertest.cc +++ b/content/browser/launch_as_mojo_client_browsertest.cc
@@ -26,6 +26,10 @@ #include "ui/ozone/public/ozone_switches.h" #endif +#if defined(OS_CHROMEOS) +#include "ui/gl/gl_switches.h" +#endif + namespace content { namespace { @@ -79,6 +83,10 @@ const base::CommandLine& cmdline = *base::CommandLine::ForCurrentProcess(); command_line.CopySwitchesFrom(cmdline, kSwitchesToCopy, base::size(kSwitchesToCopy)); + +#if defined(OS_CHROMEOS) + command_line.AppendSwitchASCII(switches::kUseGL, "swiftshader"); +#endif return command_line; }
diff --git a/content/browser/native_file_system/file_system_chooser_browsertest.cc b/content/browser/native_file_system/file_system_chooser_browsertest.cc index 94557932..092071d 100644 --- a/content/browser/native_file_system/file_system_chooser_browsertest.cc +++ b/content/browser/native_file_system/file_system_chooser_browsertest.cc
@@ -6,7 +6,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/strings/utf_string_conversions.h" #include "base/test/gmock_callback_support.h" -#include "base/test/scoped_feature_list.h" #include "base/threading/thread_restrictions.h" #include "content/browser/native_file_system/file_system_chooser_test_helpers.h" #include "content/browser/native_file_system/fixed_native_file_system_permission_grant.h" @@ -26,7 +25,6 @@ #include "content/shell/browser/shell.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "storage/browser/file_system/external_mount_points.h" -#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/frame/fullscreen.mojom.h" #include "ui/shell_dialogs/select_file_dialog.h" #include "ui/shell_dialogs/select_file_dialog_factory.h" @@ -48,8 +46,6 @@ public: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - scoped_feature_list_.InitAndEnableFeature( - blink::features::kNativeFileSystemAPI); // Register an external mount point to test support for virtual paths. // This maps the virtual path a native local path to make these tests work @@ -107,7 +103,6 @@ } protected: - base::test::ScopedFeatureList scoped_feature_list_; base::ScopedTempDir temp_dir_; };
diff --git a/content/browser/native_file_system/native_file_system_drag_drop_browsertest.cc b/content/browser/native_file_system/native_file_system_drag_drop_browsertest.cc index 52834c58..35bb3ab 100644 --- a/content/browser/native_file_system/native_file_system_drag_drop_browsertest.cc +++ b/content/browser/native_file_system/native_file_system_drag_drop_browsertest.cc
@@ -6,7 +6,6 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" -#include "base/test/scoped_feature_list.h" #include "content/browser/native_file_system/native_file_system_manager_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/common/drop_data.h" @@ -28,8 +27,6 @@ public: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - scoped_feature_list_.InitAndEnableFeature( - blink::features::kNativeFileSystemAPI); ASSERT_TRUE(embedded_test_server()->Start()); ContentBrowserTest::SetUp(); } @@ -69,7 +66,6 @@ } protected: - base::test::ScopedFeatureList scoped_feature_list_; base::ScopedTempDir temp_dir_; };
diff --git a/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc b/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc index 1576af0..a1c5eda 100644 --- a/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc +++ b/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc
@@ -15,7 +15,6 @@ #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/test/bind_test_util.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "content/browser/native_file_system/fixed_native_file_system_permission_grant.h" #include "content/public/test/browser_task_environment.h" @@ -28,7 +27,6 @@ #include "storage/browser/test/async_file_test_helper.h" #include "storage/browser/test/test_file_system_context.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/common/features.h" using storage::FileSystemURL; @@ -41,8 +39,6 @@ public: NativeFileSystemFileHandleImplTest() : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { - scoped_feature_list_.InitAndEnableFeature( - blink::features::kNativeFileSystemAPI); } void SetUp() override { @@ -103,7 +99,6 @@ const GURL test_src_url_ = GURL("http://example.com/foo"); const url::Origin test_src_origin_ = url::Origin::Create(test_src_url_); - base::test::ScopedFeatureList scoped_feature_list_; BrowserTaskEnvironment task_environment_; base::ScopedTempDir dir_;
diff --git a/content/browser/native_file_system/native_file_system_file_writer_impl_browsertest.cc b/content/browser/native_file_system/native_file_system_file_writer_impl_browsertest.cc index 04be7cb9..3c224c9 100644 --- a/content/browser/native_file_system/native_file_system_file_writer_impl_browsertest.cc +++ b/content/browser/native_file_system/native_file_system_file_writer_impl_browsertest.cc
@@ -6,7 +6,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" -#include "base/test/scoped_feature_list.h" #include "base/threading/thread_restrictions.h" #include "build/build_config.h" #include "components/services/quarantine/test_support.h" @@ -22,7 +21,6 @@ #include "content/public/test/content_browser_test_utils.h" #include "content/shell/browser/shell.h" #include "net/test/embedded_test_server/embedded_test_server.h" -#include "third_party/blink/public/common/features.h" #include "ui/shell_dialogs/select_file_dialog.h" #include "ui/shell_dialogs/select_file_dialog_factory.h" #include "ui/shell_dialogs/select_file_policy.h" @@ -35,8 +33,6 @@ public: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - scoped_feature_list_.InitAndEnableFeature( - blink::features::kNativeFileSystemAPI); ASSERT_TRUE(embedded_test_server()->Start()); test_url_ = embedded_test_server()->GetURL("/title1.html"); @@ -105,7 +101,6 @@ } protected: - base::test::ScopedFeatureList scoped_feature_list_; base::ScopedTempDir temp_dir_; GURL test_url_; };
diff --git a/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc b/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc index 4217472..fc09dd0 100644 --- a/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc +++ b/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc
@@ -16,7 +16,6 @@ #include "base/strings/string_number_conversions.h" #include "base/test/bind_test_util.h" #include "base/test/gmock_callback_support.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "content/browser/native_file_system/fixed_native_file_system_permission_grant.h" #include "content/browser/native_file_system/mock_native_file_system_permission_context.h" @@ -34,7 +33,6 @@ #include "storage/browser/test/test_file_system_backend.h" #include "storage/browser/test/test_file_system_context.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/common/features.h" using blink::mojom::NativeFileSystemStatus; using storage::FileSystemURL; @@ -103,10 +101,7 @@ class NativeFileSystemFileWriterImplTest : public testing::Test { public: NativeFileSystemFileWriterImplTest() - : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { - scoped_feature_list_.InitAndEnableFeature( - blink::features::kNativeFileSystemAPI); - } + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} virtual NativeFileSystemPermissionContext* permission_context() { return nullptr; @@ -321,7 +316,6 @@ const int kProcessId = 1; const int kFrameRoutingId = 2; const GlobalFrameRoutingId kFrameId{kProcessId, kFrameRoutingId}; - base::test::ScopedFeatureList scoped_feature_list_; BrowserTaskEnvironment task_environment_; base::ScopedTempDir dir_;
diff --git a/content/browser/native_file_system/native_file_system_handle_base_unittest.cc b/content/browser/native_file_system/native_file_system_handle_base_unittest.cc index 5090b6e1..3839e6e 100644 --- a/content/browser/native_file_system/native_file_system_handle_base_unittest.cc +++ b/content/browser/native_file_system/native_file_system_handle_base_unittest.cc
@@ -7,14 +7,12 @@ #include "base/files/scoped_temp_dir.h" #include "base/test/bind_test_util.h" #include "base/test/gmock_callback_support.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "content/browser/native_file_system/mock_native_file_system_permission_grant.h" #include "content/public/test/browser_task_environment.h" #include "storage/browser/blob/blob_storage_context.h" #include "storage/browser/test/test_file_system_context.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/common/features.h" namespace content { @@ -42,10 +40,7 @@ class NativeFileSystemHandleBaseTest : public testing::Test { public: NativeFileSystemHandleBaseTest() - : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { - scoped_feature_list_.InitAndEnableFeature( - blink::features::kNativeFileSystemAPI); - } + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} void SetUp() override { ASSERT_TRUE(dir_.CreateUniqueTempDir()); @@ -65,7 +60,6 @@ protected: const GURL kTestURL = GURL("https://example.com/test"); const url::Origin kTestOrigin = url::Origin::Create(kTestURL); - base::test::ScopedFeatureList scoped_feature_list_; BrowserTaskEnvironment task_environment_; base::ScopedTempDir dir_;
diff --git a/content/browser/native_file_system/native_file_system_manager_impl.cc b/content/browser/native_file_system/native_file_system_manager_impl.cc index 5d33809..0a0d924d 100644 --- a/content/browser/native_file_system/native_file_system_manager_impl.cc +++ b/content/browser/native_file_system/native_file_system_manager_impl.cc
@@ -37,7 +37,6 @@ #include "storage/browser/file_system/file_system_url.h" #include "storage/browser/file_system/isolated_context.h" #include "storage/common/file_system/file_system_util.h" -#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/native_file_system/native_file_system_drag_drop_token.mojom.h" #include "third_party/blink/public/mojom/native_file_system/native_file_system_error.mojom.h" #include "url/origin.h" @@ -196,7 +195,6 @@ void NativeFileSystemManagerImpl::BindReceiver( const BindingContext& binding_context, mojo::PendingReceiver<blink::mojom::NativeFileSystemManager> receiver) { - DCHECK(base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI)); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!network::IsOriginPotentiallyTrustworthy(binding_context.origin)) {
diff --git a/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc b/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc index 9556162..60feaf4 100644 --- a/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc +++ b/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc
@@ -14,7 +14,6 @@ #include "base/run_loop.h" #include "base/test/bind_test_util.h" #include "base/test/gmock_callback_support.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "content/browser/native_file_system/fixed_native_file_system_permission_grant.h" #include "content/browser/native_file_system/mock_native_file_system_permission_context.h" @@ -34,7 +33,6 @@ #include "storage/browser/test/async_file_test_helper.h" #include "storage/browser/test/test_file_system_context.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/blob/serialized_blob.mojom.h" #include "third_party/blink/public/mojom/native_file_system/native_file_system_drag_drop_token.mojom.h" @@ -116,10 +114,7 @@ class NativeFileSystemManagerImplTest : public testing::Test { public: NativeFileSystemManagerImplTest() - : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) { - scoped_feature_list_.InitAndEnableFeature( - blink::features::kNativeFileSystemAPI); - } + : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} void SetUp() override { ASSERT_TRUE(dir_.CreateUniqueTempDir()); @@ -230,7 +225,6 @@ const NativeFileSystemManagerImpl::BindingContext kBindingContext = { kTestOrigin, kTestURL, kFrameId}; - base::test::ScopedFeatureList scoped_feature_list_; BrowserTaskEnvironment task_environment_; base::ScopedTempDir dir_;
diff --git a/content/browser/renderer_host/frame_tree_node.cc b/content/browser/renderer_host/frame_tree_node.cc index c036cc9..827d23e 100644 --- a/content/browser/renderer_host/frame_tree_node.cc +++ b/content/browser/renderer_host/frame_tree_node.cc
@@ -664,7 +664,7 @@ user_activation_verified); if (user_activation_verified) { update_result = NotifyUserActivation( - blink::mojom::UserActivationNotificationType::kNone); + blink::mojom::UserActivationNotificationType::kInteraction); update_type = blink::mojom::UserActivationUpdateType::kNotifyActivation; } else { // TODO(crbug.com/848778): We need to decide what to do when user
diff --git a/content/browser/renderer_host/input/scroll_behavior_browsertest.cc b/content/browser/renderer_host/input/scroll_behavior_browsertest.cc new file mode 100644 index 0000000..9a28d59 --- /dev/null +++ b/content/browser/renderer_host/input/scroll_behavior_browsertest.cc
@@ -0,0 +1,440 @@ +// 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 <memory> + +#include "base/bind.h" +#include "base/run_loop.h" +#include "base/test/scoped_feature_list.h" +#include "build/build_config.h" +#include "cc/base/switches.h" +#include "content/browser/renderer_host/input/synthetic_gesture.h" +#include "content/browser/renderer_host/input/synthetic_gesture_controller.h" +#include "content/browser/renderer_host/input/synthetic_gesture_target.h" +#include "content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h" +#include "content/browser/renderer_host/render_widget_host_impl.h" +#include "content/browser/web_contents/web_contents_impl.h" +#include "content/common/input/synthetic_gesture_params.h" +#include "content/common/input/synthetic_smooth_scroll_gesture_params.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/common/content_switches.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_browser_test.h" +#include "content/public/test/content_browser_test_utils.h" +#include "content/public/test/hit_test_region_observer.h" +#include "content/shell/browser/shell.h" +#include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/common/switches.h" +#include "ui/base/ui_base_features.h" +#include "ui/native_theme/native_theme_features.h" + +namespace { + +constexpr int kIntermediateScrollOffset = 25; + +const std::string kOverflowScrollDataURL = R"HTML( + data:text/html;charset=utf-8, + <!DOCTYPE html> + <meta name='viewport' content='width=device-width, minimum-scale=1'> + <style> + %23container { + width: 200px; + height: 200px; + overflow: scroll; + } + %23content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <div id="container"> + <div id="content"></div> + </div> + <script> + var element = document.getElementById('container'); + window.onload = function() { + document.title='ready'; + } + </script> + )HTML"; + +const std::string kMainFrameScrollDataURL = R"HTML( + data:text/html;charset=utf-8, + <!DOCTYPE html> + <meta name='viewport' content='width=device-width, minimum-scale=1'> + <style> + %23scrollableDiv { + width: 500px; + height: 10000px; + background-color: blue; + } + </style> + <div id='scrollableDiv'></div> + <script> + window.onload = function() { + document.title='ready'; + } + </script> + )HTML"; + +const std::string kSubframeScrollDataURL = R"HTML( + data:text/html;charset=utf-8, + <!DOCTYPE html> + <meta name='viewport' content='width=device-width, minimum-scale=1'> + <style> + %23subframe { + width: 200px; + height: 200px; + } + </style> + <body onload="document.title='ready'"> + <iframe id='subframe' srcdoc=" + <style> + %23content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <div id='content'></div>"> + </iframe> + </body> + <script> + var subframe = document.getElementById('subframe'); + </script> + )HTML"; + +} // namespace + +namespace content { + +// This test is to verify that in-progress smooth scrolls stops when +// interrupted by an instant scroll, another smooth scroll, a touch scroll, or +// a mouse wheel scroll on an overflow:scroll element, main frame and subframe. +class ScrollBehaviorBrowserTest : public ContentBrowserTest, + public testing::WithParamInterface<bool> { + public: + ScrollBehaviorBrowserTest() : disable_threaded_scrolling_(GetParam()) {} + + ~ScrollBehaviorBrowserTest() override = default; + + RenderWidgetHostImpl* GetWidgetHost() { + return RenderWidgetHostImpl::From( + shell()->web_contents()->GetRenderViewHost()->GetWidget()); + } + + void OnSyntheticGestureCompleted(SyntheticGesture::Result result) { + EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result); + run_loop_->Quit(); + } + + protected: + void SetUpCommandLine(base::CommandLine* command_line) override { + ContentBrowserTest::SetUpCommandLine(command_line); + if (disable_threaded_scrolling_) { + command_line->AppendSwitch(blink::switches::kDisableThreadedScrolling); + } + // Set the scroll animation duration to 5 seconds so that we ensure + // the second scroll happens before the scroll animation finishes. + command_line->AppendSwitchASCII( + cc::switches::kCCScrollAnimationDurationForTesting, "5"); + } + + void LoadURL(const std::string page_url) { + const GURL data_url(page_url); + EXPECT_TRUE(NavigateToURL(shell(), data_url)); + + RenderWidgetHostImpl* host = GetWidgetHost(); + host->GetView()->SetSize(gfx::Size(400, 400)); + + base::string16 ready_title(base::ASCIIToUTF16("ready")); + TitleWatcher watcher(shell()->web_contents(), ready_title); + ignore_result(watcher.WaitAndGetTitle()); + + HitTestRegionObserver observer(host->GetFrameSinkId()); + // Wait for the hit test data to be ready + observer.WaitForHitTestData(); + } + + double ExecuteScriptAndExtractDouble(const std::string& script) { + double value = 0; + EXPECT_TRUE(content::ExecuteScriptAndExtractDouble( + shell(), "domAutomationController.send(" + script + ")", &value)); + return value; + } + + WebContentsImpl* web_contents() const { + return static_cast<WebContentsImpl*>(shell()->web_contents()); + } + + // The scroll delta values are in the viewport direction. Positive + // scroll_delta_y means scroll down, positive scroll_delta_x means scroll + // right. + void SimulateScroll( + SyntheticGestureParams::GestureSourceType gesture_source_type, + int scroll_delta_x, + int scroll_delta_y) { + auto scroll_update_watcher = std::make_unique<InputMsgWatcher>( + GetWidgetHost(), blink::WebInputEvent::Type::kGestureScrollEnd); + + // This speed affects only the rate at which the requested scroll delta is + // sent from the synthetic gesture controller, and doesn't affect the speed + // of the animation in the renderer. + constexpr int kSpeedInstant = 400000; + SyntheticSmoothScrollGestureParams params; + params.gesture_source_type = gesture_source_type; + params.anchor = gfx::PointF(50, 50); + params.distances.push_back(gfx::Vector2d(-scroll_delta_x, -scroll_delta_y)); + params.speed_in_pixels_s = kSpeedInstant; + params.granularity = ui::ScrollGranularity::kScrollByPixel; + + run_loop_ = std::make_unique<base::RunLoop>(); + + auto gesture = std::make_unique<SyntheticSmoothScrollGesture>(params); + GetWidgetHost()->QueueSyntheticGesture( + std::move(gesture), + base::BindOnce(&ScrollBehaviorBrowserTest::OnSyntheticGestureCompleted, + base::Unretained(this))); + run_loop_->Run(); + } + + void WaitForScrollToStart(const std::string& script) { + // When the first smooth scroll starts and scroll to 5 pixels, we will + // send the second scroll to interrupt the current smooth scroll. + constexpr int kExpectedScrollTop = 5; + MainThreadFrameObserver frame_observer( + shell()->web_contents()->GetRenderViewHost()->GetWidget()); + while (ExecuteScriptAndExtractDouble(script) < kExpectedScrollTop) + frame_observer.Wait(); + } + + void WaitUntilLessThan(const std::string& script, + double starting_scroll_top) { + // For the scroll interruption, we want to make sure that the first smooth + // scroll animation stops right away, and the second scroll starts. + MainThreadFrameObserver frame_observer( + shell()->web_contents()->GetRenderViewHost()->GetWidget()); + double current = ExecuteScriptAndExtractDouble(script); + + // If the animation doesn't reverse within this number of pixels we fail the + // test. + constexpr int kThreshold = 20; + while (current >= starting_scroll_top) { + ASSERT_LT(current, starting_scroll_top + kThreshold); + frame_observer.Wait(); + current = ExecuteScriptAndExtractDouble(script); + } + } + + void ValueHoldsAt(const std::string& scroll_top_script, double scroll_top) { + // This function checks that the scroll top value holds at the given value + // for 10 frames. + MainThreadFrameObserver frame_observer( + shell()->web_contents()->GetRenderViewHost()->GetWidget()); + int frame_count = 10; + while (frame_count > 0) { + ASSERT_EQ(ExecuteScriptAndExtractDouble(scroll_top_script), scroll_top); + frame_observer.Wait(); + frame_count--; + } + } + + RenderViewHost* GetRenderViewHost() const { + RenderViewHost* const rvh = shell()->web_contents()->GetRenderViewHost(); + CHECK(rvh); + return rvh; + } + + std::unique_ptr<base::RunLoop> run_loop_; + bool disable_threaded_scrolling_ = false; + + DISALLOW_COPY_AND_ASSIGN(ScrollBehaviorBrowserTest); +}; + +INSTANTIATE_TEST_SUITE_P(All, ScrollBehaviorBrowserTest, ::testing::Bool()); + +// This tests that a in-progress smooth scroll on an overflow:scroll element +// stops when interrupted by an instant scroll. +IN_PROC_BROWSER_TEST_P(ScrollBehaviorBrowserTest, + OverflowScrollInterruptedByInstantScroll) { + LoadURL(kOverflowScrollDataURL); + + EXPECT_TRUE( + ExecuteScript(shell()->web_contents(), + "element.scrollTo({top: 100, behavior: 'smooth'});")); + + std::string scroll_top_script = "element.scrollTop"; + WaitForScrollToStart(scroll_top_script); + + double scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + ASSERT_GT(scroll_top, 0); + ASSERT_LT(scroll_top, kIntermediateScrollOffset); + + // When interrupted by an instant scroll, the in-progress smooth scrolls stop. + EXPECT_TRUE(ExecuteScript(shell()->web_contents(), "element.scrollTop = 0;")); + + // Instant scroll does not cause animation, it scroll to 0 right away. + // TODO(crbug.com/1133492): the last animation is committed after we set the + // scrollTop even when we cancel the animation, so the final scrollTop value + // is not 0, we need to fix it. + if (!disable_threaded_scrolling_) + ValueHoldsAt(scroll_top_script, + ExecuteScriptAndExtractDouble(scroll_top_script)); + else + ValueHoldsAt(scroll_top_script, 0); +} + +// This tests that a in-progress smooth scroll on an overflow:scroll element +// stops when interrupted by another smooth scroll. +IN_PROC_BROWSER_TEST_P(ScrollBehaviorBrowserTest, + OverflowScrollInterruptedBySmoothScroll) { + LoadURL(kOverflowScrollDataURL); + + EXPECT_TRUE( + ExecuteScript(shell()->web_contents(), + "element.scrollTo({top: 100, behavior: 'smooth'});")); + + std::string scroll_top_script = "element.scrollTop"; + WaitForScrollToStart(scroll_top_script); + + double scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + ASSERT_GT(scroll_top, 0); + ASSERT_LT(scroll_top, kIntermediateScrollOffset); + + // When interrupted by a smooth scroll, the in-progress smooth scrolls stop. + EXPECT_TRUE(ExecuteScript(shell()->web_contents(), + "element.scrollTo({top: 0, behavior: 'smooth'});")); + + WaitUntilLessThan(scroll_top_script, scroll_top); + double new_scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + EXPECT_LT(new_scroll_top, scroll_top); + EXPECT_GT(new_scroll_top, 0); +} + +// This tests that a in-progress smooth scroll on an overflow:scroll element +// stops when interrupted by a touch scroll. +IN_PROC_BROWSER_TEST_P(ScrollBehaviorBrowserTest, + OverflowScrollInterruptedByTouchScroll) { + // TODO(crbug.com/1116647): compositing scroll should be able to cancel a + // running programmatic scroll. + if (!disable_threaded_scrolling_) + return; + + LoadURL(kOverflowScrollDataURL); + + EXPECT_TRUE( + ExecuteScript(shell()->web_contents(), + "element.scrollTo({top: 100, behavior: 'smooth'});")); + + std::string scroll_top_script = "element.scrollTop"; + WaitForScrollToStart(scroll_top_script); + + double scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + ASSERT_GT(scroll_top, 0); + ASSERT_LT(scroll_top, kIntermediateScrollOffset); + + // When interrupted by a touch scroll, the in-progress smooth scrolls stop. + SimulateScroll(SyntheticGestureParams::TOUCH_INPUT, 0, -100); + + // The touch scroll should cause scroll to 0 and cancel the animation, so + // make sure the value stays at 0. + ValueHoldsAt(scroll_top_script, 0); +} + +// This tests that a in-progress smooth scroll on an overflow:scroll element +// stops when interrupted by a mouse wheel scroll. +IN_PROC_BROWSER_TEST_P(ScrollBehaviorBrowserTest, + OverflowScrollInterruptedByWheelScroll) { + // TODO(crbug.com/1116647): compositing scroll should be able to cancel a + // running programmatic scroll. + if (!disable_threaded_scrolling_) + return; + + LoadURL(kOverflowScrollDataURL); + + EXPECT_TRUE( + ExecuteScript(shell()->web_contents(), + "element.scrollTo({top: 100, behavior: 'smooth'});")); + + std::string scroll_top_script = "element.scrollTop"; + WaitForScrollToStart(scroll_top_script); + + double scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + ASSERT_GT(scroll_top, 0); + ASSERT_LT(scroll_top, kIntermediateScrollOffset); + + // When interrupted by a wheel scroll, the in-progress smooth scrolls stop. + SimulateScroll(SyntheticGestureParams::MOUSE_INPUT, 0, -30); + + // Smooth scrolling is disabled for wheel scroll on Mac. + // https://crbug.com/574283. +#if defined(OS_MAC) + ValueHoldsAt(scroll_top_script, 0); +#else + WaitUntilLessThan(scroll_top_script, scroll_top); + double new_scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + EXPECT_LT(new_scroll_top, scroll_top); + EXPECT_GT(new_scroll_top, 0); +#endif +} + +// This tests that a in-progress smooth scroll on the main frame stops when +// interrupted by another smooth scroll. +IN_PROC_BROWSER_TEST_P(ScrollBehaviorBrowserTest, + MainFrameScrollInterruptedBySmoothScroll) { + LoadURL(kMainFrameScrollDataURL); + + EXPECT_TRUE( + ExecuteScript(shell()->web_contents(), + "window.scrollTo({top: 100, behavior: 'smooth'});")); + + std::string scroll_top_script = "document.scrollingElement.scrollTop"; + WaitForScrollToStart(scroll_top_script); + + double scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + ASSERT_GT(scroll_top, 0); + ASSERT_LT(scroll_top, kIntermediateScrollOffset); + + // When interrupted by a smooth scroll, the in-progress smooth scrolls stop. + EXPECT_TRUE(ExecuteScript(shell()->web_contents(), + "window.scrollTo({top: 0, behavior: 'smooth'});")); + + WaitUntilLessThan(scroll_top_script, scroll_top); + double new_scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + EXPECT_LT(new_scroll_top, scroll_top); + EXPECT_GT(new_scroll_top, 0); +} + +// This tests that a in-progress smooth scroll on a subframe stops when +// interrupted by another smooth scroll. +IN_PROC_BROWSER_TEST_P(ScrollBehaviorBrowserTest, + SubframeScrollInterruptedBySmoothScroll) { + LoadURL(kSubframeScrollDataURL); + + EXPECT_TRUE(ExecuteScript( + shell()->web_contents(), + "subframe.contentWindow.scrollTo({top: 100, behavior: 'smooth'});")); + + std::string scroll_top_script = + "subframe.contentDocument.scrollingElement.scrollTop"; + WaitForScrollToStart(scroll_top_script); + + double scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + ASSERT_GT(scroll_top, 0); + ASSERT_LT(scroll_top, kIntermediateScrollOffset); + + // When interrupted by a smooth scroll, the in-progress smooth scrolls stop. + EXPECT_TRUE(ExecuteScript( + shell()->web_contents(), + "subframe.contentWindow.scrollTo({top: 0, behavior: 'smooth'});")); + + WaitUntilLessThan(scroll_top_script, scroll_top); + double new_scroll_top = ExecuteScriptAndExtractDouble(scroll_top_script); + EXPECT_LT(new_scroll_top, scroll_top); + EXPECT_GT(new_scroll_top, 0); +} + +} // namespace content
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 8678e31..149a275 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -30,6 +30,7 @@ #include "base/numerics/safe_conversions.h" #include "base/process/kill.h" #include "base/stl_util.h" +#include "base/strings/string_number_conversions.h" #include "base/task/current_thread.h" #include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" @@ -265,6 +266,15 @@ namespace content { +#if defined(ADDRESS_SANITIZER) || !defined(NDEBUG) +// Wrapping this in ADDRESS_SANITIZER will enable it to run on +// clusterfuzz, which should help narrow down illegal ax trees more quickly. +// static +int RenderFrameHostImpl::max_accessibility_resets_ = 0; +#else +int RenderFrameHostImpl::max_accessibility_resets_ = 4; +#endif + struct RenderFrameHostOrProxy { RenderFrameHostImpl* const frame; RenderFrameProxyHost* const proxy; @@ -1845,7 +1855,7 @@ return; accessibility_reset_count_++; - if (accessibility_reset_count_ >= kMaxAccessibilityResets) { + if (accessibility_reset_count_ > max_accessibility_resets_) { render_accessibility_->FatalError(); } else { AccessibilityReset(); @@ -6279,23 +6289,81 @@ // TODO(crbug.com/1125106): A same document navigation can not be done // with a provisional frame, and yet it is happening inside a provisional // frame somehow. - DEBUG_ALIAS_FOR_GURL(to_url, common_params->url); - bool browser_initiated = navigation_request->browser_initiated(); - base::debug::Alias(&browser_initiated); - int64_t to_item_sequence_number = - navigation_request->ItemSequenceNumberForDebugging(); - base::debug::Alias(&to_item_sequence_number); - int64_t to_document_sequence_number = - navigation_request->DocumentSequenceNumberForDebugging(); - base::debug::Alias(&to_document_sequence_number); + using base::debug::AllocateCrashKeyString; + using base::debug::CrashKeySize; + using base::debug::CrashKeyString; + using base::debug::ScopedCrashKeyString; - DEBUG_ALIAS_FOR_GURL(from_url, last_committed_url_); + static CrashKeyString* const to_url_key = AllocateCrashKeyString( + "SpecSameDocNav-to-url", CrashKeySize::Size256); + static CrashKeyString* const is_speculative_key = AllocateCrashKeyString( + "SpecSameDocNav-is-speculative", CrashKeySize::Size32); + static CrashKeyString* const dest_rfh_last_committed_url_key = + AllocateCrashKeyString("SpecSameDocNav-dest-rfh-last-committed-url", + CrashKeySize::Size256); + static CrashKeyString* const browser_initiated_key = + AllocateCrashKeyString("SpecSameDocNav-is-browser-initiated", + CrashKeySize::Size32); + static CrashKeyString* const to_item_sequence_number_key = + AllocateCrashKeyString("SpecSameDocNav-to-item-sequence-number", + CrashKeySize::Size32); + static CrashKeyString* const to_document_sequence_number_key = + AllocateCrashKeyString("SpecSameDocNav-to-document-sequence-number", + CrashKeySize::Size32); + static CrashKeyString* const from_url_key = AllocateCrashKeyString( + "SpecSameDocNav-from-url", CrashKeySize::Size256); + static CrashKeyString* from_item_sequence_number_key = + AllocateCrashKeyString("SpecSameDocNav-from-item-sequence-number", + CrashKeySize::Size32); + static CrashKeyString* from_document_sequence_number_key = + AllocateCrashKeyString("SpecSameDocNav-from-document-sequence-number", + CrashKeySize::Size32); + + ScopedCrashKeyString to_url_scoper( + to_url_key, common_params->url.possibly_invalid_spec()); + + const bool is_speculative = + frame_tree_node()->render_manager()->speculative_frame_host() == this; + ScopedCrashKeyString is_speculative_scoper( + is_speculative_key, is_speculative ? "true" : "false"); + + ScopedCrashKeyString dest_rfh_last_committed_url_scoper( + dest_rfh_last_committed_url_key, + GetLastCommittedURL().possibly_invalid_spec()); + + const bool browser_initiated = navigation_request->browser_initiated(); + ScopedCrashKeyString browser_initiated_scoper( + browser_initiated_key, browser_initiated ? "true" : "false"); + + const std::string& to_item_sequence_number_string = base::NumberToString( + navigation_request->ItemSequenceNumberForDebugging()); + ScopedCrashKeyString to_item_sequence_number_scoper( + to_item_sequence_number_key, to_item_sequence_number_string); + + const std::string& to_document_sequence_number_string = + base::NumberToString( + navigation_request->DocumentSequenceNumberForDebugging()); + ScopedCrashKeyString to_document_sequence_number_scoper( + to_document_sequence_number_key, to_document_sequence_number_string); + + ScopedCrashKeyString from_url_reset( + from_url_key, last_committed_url_.possibly_invalid_spec()); + int64_t from_item_sequence_number = -1; int64_t from_document_sequence_number = -1; delegate_->GetFrameSequenceNumbersForDebugging( this, from_item_sequence_number, from_document_sequence_number); - base::debug::Alias(&from_item_sequence_number); - base::debug::Alias(&from_document_sequence_number); + + const std::string& from_item_sequence_number_string = + base::NumberToString(from_item_sequence_number); + ScopedCrashKeyString from_item_sequence_number_scoper( + from_item_sequence_number_key, from_item_sequence_number_string); + + const std::string& from_document_sequence_number_string = + base::NumberToString(from_document_sequence_number); + ScopedCrashKeyString from_document_sequence_number_scoper( + from_document_sequence_number_key, + from_document_sequence_number_string); base::debug::DumpWithoutCrashing(); }
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 057e00e..88dc438 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -265,7 +265,8 @@ // An accessibility reset is only allowed to prevent very rare corner cases // or race conditions where the browser and renderer get out of sync. If // this happens more than this many times, kill the renderer. - static const int kMaxAccessibilityResets = 5; + // Can be set to 0 to fail immediately during tests. + static int max_accessibility_resets_; static RenderFrameHostImpl* FromID(GlobalFrameRoutingId id); static RenderFrameHostImpl* FromID(int process_id, int routing_id);
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index c0a9ce8..8f631c3 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -2453,6 +2453,8 @@ const ui::mojom::TextInputState* state = text_input_manager_->GetTextInputState(); + + // Show the virtual keyboard if needed. if (state && state->type != ui::TEXT_INPUT_TYPE_NONE && state->mode != ui::TEXT_INPUT_MODE_NONE) { bool show_virtual_keyboard = true; @@ -2478,8 +2480,10 @@ virtual_keyboard_controller_win_->UpdateTextInputState(state); } #endif - // Ensure that accessibility events are fired when the selection location - // moves from UI back to content. + } + + // Ensure that selection bounds changes are sent to the IME. + if (state && state->type != ui::TEXT_INPUT_TYPE_NONE) { text_input_manager->NotifySelectionBoundsChanged(updated_view); }
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 8438b4b..6b4f412 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -432,6 +432,8 @@ DiscardDelegatedFramesWithMemoryPressure); FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraInputMethodTest, OnCaretBoundsChanged); + FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraInputMethodTest, + OnCaretBoundsChangedInputModeNone); FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraInputMethodFocusTest, OnFocusLost); FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraKeyboardTest,
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index c80b24e2..272faa8 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -652,6 +652,12 @@ return view_->GetMouseWheelPhaseHandler(); } + TextInputManager* GetTextInputManager(RenderWidgetHostViewBase* view) const { + return static_cast<RenderWidgetHostImpl*>(view->GetRenderWidgetHost()) + ->delegate() + ->GetTextInputManager(); + } + // Sets the |view| active in TextInputManager with the given |type|. |type| // cannot be ui::TEXT_INPUT_TYPE_NONE. // Must not be called in the destruction path of |view|. @@ -664,10 +670,7 @@ render_widget_host_delegate()->set_focused_widget(view->host()); } - TextInputManager* manager = - static_cast<RenderWidgetHostImpl*>(view->GetRenderWidgetHost()) - ->delegate() - ->GetTextInputManager(); + TextInputManager* manager = GetTextInputManager(view); if (manager->GetActiveWidget()) { manager->active_view_for_testing()->TextInputStateChanged( ui::mojom::TextInputState()); @@ -6487,6 +6490,35 @@ input_method->RemoveObserver(this); } +// The input method should still receive caret bounds changes even if inputmode +// is NONE. See crbug.com/1114559. +TEST_F(RenderWidgetHostViewAuraInputMethodTest, + OnCaretBoundsChangedInputModeNone) { + ui::InputMethod* input_method = parent_view_->GetInputMethod(); + if (input_method != input_method_) { + // Some platforms don't support mocking input method. In that case, ignore + // this test. + return; + } + ActivateViewForTextInputManager(parent_view_, ui::TEXT_INPUT_TYPE_TEXT); + input_method->SetFocusedTextInputClient(parent_view_); + input_method->AddObserver(this); + + text_input_client_ = nullptr; + + ui::mojom::TextInputState state; + state.type = ui::TEXT_INPUT_TYPE_TEXT; + state.mode = ui::TEXT_INPUT_MODE_NONE; + state.value = base::ASCIIToUTF16("a"); + state.selection = gfx::Range(1, 1); + + GetTextInputManager(parent_view_)->UpdateTextInputState(parent_view_, state); + + EXPECT_EQ(parent_view_, text_input_client_); + + input_method->RemoveObserver(this); +} + class RenderWidgetHostViewAuraInputMethodFocusTest : public RenderWidgetHostViewAuraInputMethodTest, public testing::WithParamInterface<bool> {
diff --git a/content/browser/speech/tts_controller_impl.cc b/content/browser/speech/tts_controller_impl.cc index 2b7bd10..eee205572 100644 --- a/content/browser/speech/tts_controller_impl.cc +++ b/content/browser/speech/tts_controller_impl.cc
@@ -772,6 +772,12 @@ } return nullptr; } + +void TtsControllerImpl::SetTtsControllerDelegateForTesting( + TtsControllerDelegate* delegate) { + delegate_ = delegate; +} + #endif // defined(OS_CHROMEOS) } // namespace content
diff --git a/content/browser/speech/tts_controller_impl.h b/content/browser/speech/tts_controller_impl.h index 6b1d432..781977e 100644 --- a/content/browser/speech/tts_controller_impl.h +++ b/content/browser/speech/tts_controller_impl.h
@@ -83,13 +83,7 @@ ~TtsControllerImpl() override; private: - friend class TtsControllerTestHelper; - FRIEND_TEST_ALL_PREFIXES(TtsControllerTest, TestTtsControllerShutdown); - FRIEND_TEST_ALL_PREFIXES(TtsControllerTest, TestGetMatchingVoice); - FRIEND_TEST_ALL_PREFIXES(TtsControllerTest, - TestTtsControllerUtteranceDefaults); - FRIEND_TEST_ALL_PREFIXES(TtsControllerTest, TestBrowserContextRemoved); - + friend class TestTtsControllerImpl; friend struct base::DefaultSingletonTraits<TtsControllerImpl>; // Get the platform TTS implementation (or injected mock). @@ -151,7 +145,7 @@ #if defined(OS_CHROMEOS) TtsControllerDelegate* GetTtsControllerDelegate(); - + void SetTtsControllerDelegateForTesting(TtsControllerDelegate* delegate); TtsControllerDelegate* delegate_ = nullptr; #endif
diff --git a/content/browser/speech/tts_controller_unittest.cc b/content/browser/speech/tts_controller_unittest.cc index 593814a..ba22cdf 100644 --- a/content/browser/speech/tts_controller_unittest.cc +++ b/content/browser/speech/tts_controller_unittest.cc
@@ -102,92 +102,139 @@ }; #endif -// Subclass of TtsController with a public ctor and dtor. -class TtsControllerForTesting : public TtsControllerImpl { +class TestTtsControllerImpl : public TtsControllerImpl { public: - TtsControllerForTesting() {} - ~TtsControllerForTesting() override {} -}; + TestTtsControllerImpl() = default; + ~TestTtsControllerImpl() override = default; -TEST(TtsControllerTest, TestTtsControllerShutdown) { - MockTtsPlatformImpl platform_impl; - std::unique_ptr<TtsControllerForTesting> controller = - std::make_unique<TtsControllerForTesting>(); + // Exposed API for testing. + using TtsControllerImpl::FinishCurrentUtterance; + using TtsControllerImpl::GetMatchingVoice; + using TtsControllerImpl::SpeakNextUtterance; + using TtsControllerImpl::UpdateUtteranceDefaults; #if defined(OS_CHROMEOS) - MockTtsControllerDelegate delegate; - controller->delegate_ = &delegate; + using TtsControllerImpl::SetTtsControllerDelegateForTesting; #endif - controller->SetTtsPlatform(&platform_impl); + TtsUtterance* current_utterance() { return current_utterance_.get(); } +}; +class TtsControllerTest : public testing::Test { + public: + TtsControllerTest() = default; + ~TtsControllerTest() override = default; + + void SetUp() override { + controller_ = std::make_unique<TestTtsControllerImpl>(); + browser_context_ = std::make_unique<TestBrowserContext>(); + controller()->SetTtsPlatform(&platform_impl_); +#if defined(OS_CHROMEOS) + controller()->SetTtsControllerDelegateForTesting(&delegate_); +#endif + } + + MockTtsPlatformImpl* platform_impl() { return &platform_impl_; } + TestTtsControllerImpl* controller() { return controller_.get(); } + TestBrowserContext* browser_context() { return browser_context_.get(); } + +#if defined(OS_CHROMEOS) + MockTtsControllerDelegate* delegate() { return &delegate_; } +#endif + + void ReleaseTtsController() { controller_.reset(); } + void ReleaseBrowserContext() { + // BrowserContext::~BrowserContext(...) is calling OnBrowserContextDestroyed + // on the tts controller singleton. That call is simulated here to ensures + // it is called on our test controller instances. + controller()->OnBrowserContextDestroyed(browser_context_.get()); + browser_context_.reset(); + } + + std::unique_ptr<TestWebContents> CreateWebContents() { + return std::unique_ptr<TestWebContents>( + TestWebContents::Create(browser_context_.get(), nullptr)); + } + + std::unique_ptr<TtsUtteranceImpl> CreateUtteranceImpl( + WebContents* web_contents = nullptr) { + return std::make_unique<TtsUtteranceImpl>(browser_context_.get(), + web_contents); + } + + TtsUtterance* TtsControllerCurrentUtterance() { + return controller()->current_utterance(); + } + + bool IsUtteranceListEmpty() { return controller()->QueueSize() == 0; } + + private: + content::BrowserTaskEnvironment task_environment_; + RenderViewHostTestEnabler rvh_enabler_; + + std::unique_ptr<TestTtsControllerImpl> controller_; + MockTtsPlatformImpl platform_impl_; + std::unique_ptr<TestBrowserContext> browser_context_; +#if defined(OS_CHROMEOS) + MockTtsControllerDelegate delegate_; +#endif +}; + +TEST_F(TtsControllerTest, TestTtsControllerShutdown) { std::unique_ptr<TtsUtterance> utterance1 = TtsUtterance::Create(nullptr); utterance1->SetCanEnqueue(true); utterance1->SetSrcId(1); - controller->SpeakOrEnqueue(std::move(utterance1)); + controller()->SpeakOrEnqueue(std::move(utterance1)); std::unique_ptr<TtsUtterance> utterance2 = TtsUtterance::Create(nullptr); utterance2->SetCanEnqueue(true); utterance2->SetSrcId(2); - controller->SpeakOrEnqueue(std::move(utterance2)); + controller()->SpeakOrEnqueue(std::move(utterance2)); // Make sure that deleting the controller when there are pending // utterances doesn't cause a crash. - controller.reset(); + ReleaseTtsController(); } #if defined(OS_CHROMEOS) -TEST(TtsControllerTest, TestBrowserContextRemoved) { - // Create a controller, mock other stuff, and create a test - // browser context. - TtsControllerImpl* controller = TtsControllerImpl::GetInstance(); - MockTtsPlatformImpl platform_impl; - MockTtsControllerDelegate delegate; - controller->delegate_ = &delegate; - controller->SetTtsPlatform(&platform_impl); - content::BrowserTaskEnvironment task_environment; - auto browser_context = std::make_unique<TestBrowserContext>(); - +TEST_F(TtsControllerTest, TestBrowserContextRemoved) { std::vector<VoiceData> voices; VoiceData voice_data; voice_data.engine_id = "x"; voice_data.events.insert(TTS_EVENT_END); voices.push_back(voice_data); - platform_impl.set_voices(voices); + platform_impl()->set_voices(voices); // Speak an utterances associated with this test browser context. std::unique_ptr<TtsUtterance> utterance1 = - TtsUtterance::Create(browser_context.get()); + TtsUtterance::Create(browser_context()); utterance1->SetEngineId("x"); utterance1->SetCanEnqueue(true); utterance1->SetSrcId(1); - controller->SpeakOrEnqueue(std::move(utterance1)); + controller()->SpeakOrEnqueue(std::move(utterance1)); // Assert that the delegate was called and it got our browser context. - ASSERT_EQ(browser_context.get(), delegate.GetLastBrowserContext()); + ASSERT_EQ(browser_context(), delegate()->GetLastBrowserContext()); // Now queue up a second utterance to be spoken, also associated with // this browser context. std::unique_ptr<TtsUtterance> utterance2 = - TtsUtterance::Create(browser_context.get()); + TtsUtterance::Create(browser_context()); utterance2->SetEngineId("x"); utterance2->SetCanEnqueue(true); utterance2->SetSrcId(2); - controller->SpeakOrEnqueue(std::move(utterance2)); + controller()->SpeakOrEnqueue(std::move(utterance2)); // Destroy the browser context before the utterance is spoken. - browser_context.reset(); + ReleaseBrowserContext(); // Now speak the next utterance, and ensure that we don't get the // destroyed browser context. - controller->FinishCurrentUtterance(); - controller->SpeakNextUtterance(); - ASSERT_EQ(nullptr, delegate.GetLastBrowserContext()); + controller()->FinishCurrentUtterance(); + controller()->SpeakNextUtterance(); + ASSERT_EQ(nullptr, delegate()->GetLastBrowserContext()); } #else -TEST(TtsControllerTest, TestTtsControllerUtteranceDefaults) { - std::unique_ptr<TtsControllerForTesting> controller = - std::make_unique<TtsControllerForTesting>(); - +TEST_F(TtsControllerTest, TestTtsControllerUtteranceDefaults) { std::unique_ptr<TtsUtterance> utterance1 = content::TtsUtterance::Create(nullptr); // Initialized to default (unset constant) values. @@ -198,7 +245,7 @@ EXPECT_EQ(blink::mojom::kSpeechSynthesisDoublePrefNotSet, utterance1->GetContinuousParameters().volume); - controller->UpdateUtteranceDefaults(utterance1.get()); + controller()->UpdateUtteranceDefaults(utterance1.get()); // Updated to global defaults. EXPECT_EQ(blink::mojom::kSpeechSynthesisDefaultRate, utterance1->GetContinuousParameters().rate); @@ -209,21 +256,14 @@ } #endif -TEST(TtsControllerTest, TestGetMatchingVoice) { - std::unique_ptr<TtsControllerForTesting> controller = - std::make_unique<TtsControllerForTesting>(); -#if defined(OS_CHROMEOS) - MockTtsControllerDelegate delegate; - controller->delegate_ = &delegate; -#endif - +TEST_F(TtsControllerTest, TestGetMatchingVoice) { TestContentBrowserClient::GetInstance()->set_application_locale("en"); { // Calling GetMatchingVoice with no voices returns -1. std::unique_ptr<TtsUtterance> utterance(TtsUtterance::Create(nullptr)); std::vector<VoiceData> voices; - EXPECT_EQ(-1, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(-1, controller()->GetMatchingVoice(utterance.get(), voices)); } { @@ -231,7 +271,7 @@ // even if there are no criteria that match. std::unique_ptr<TtsUtterance> utterance(TtsUtterance::Create(nullptr)); std::vector<VoiceData> voices(2); - EXPECT_EQ(0, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(0, controller()->GetMatchingVoice(utterance.get(), voices)); } { @@ -248,7 +288,7 @@ VoiceData de_voice; de_voice.lang = "de"; voices.push_back(de_voice); - EXPECT_EQ(1, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(1, controller()->GetMatchingVoice(utterance.get(), voices)); } { @@ -289,53 +329,53 @@ voices.push_back(voice8); std::unique_ptr<TtsUtterance> utterance(TtsUtterance::Create(nullptr)); - EXPECT_EQ(0, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(0, controller()->GetMatchingVoice(utterance.get(), voices)); std::set<TtsEventType> types; types.insert(TTS_EVENT_WORD); utterance->SetRequiredEventTypes(types); - EXPECT_EQ(1, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(1, controller()->GetMatchingVoice(utterance.get(), voices)); utterance->SetLang("de-DE"); - EXPECT_EQ(2, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(2, controller()->GetMatchingVoice(utterance.get(), voices)); utterance->SetLang("fr-FR"); - EXPECT_EQ(3, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(3, controller()->GetMatchingVoice(utterance.get(), voices)); utterance->SetVoiceName("Voice4"); - EXPECT_EQ(4, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(4, controller()->GetMatchingVoice(utterance.get(), voices)); utterance->SetVoiceName(""); utterance->SetEngineId("id5"); - EXPECT_EQ(5, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(5, controller()->GetMatchingVoice(utterance.get(), voices)); #if defined(OS_CHROMEOS) TtsControllerDelegate::PreferredVoiceIds preferred_voice_ids; preferred_voice_ids.locale_voice_id.emplace("Voice7", "id7"); preferred_voice_ids.any_locale_voice_id.emplace("Android", ""); - delegate.SetPreferredVoiceIds(preferred_voice_ids); + delegate()->SetPreferredVoiceIds(preferred_voice_ids); // Voice6 is matched when the utterance locale exactly matches its locale. utterance->SetEngineId(""); utterance->SetLang("es-es"); - EXPECT_EQ(6, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(6, controller()->GetMatchingVoice(utterance.get(), voices)); // The 7th voice is the default for "es", even though the utterance is // "es-ar". |voice6| is not matched because it is not the default. utterance->SetEngineId(""); utterance->SetLang("es-ar"); - EXPECT_EQ(7, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(7, controller()->GetMatchingVoice(utterance.get(), voices)); // The 8th voice is like the built-in "Android" voice, it has no lang // and no extension ID. Make sure it can still be matched. preferred_voice_ids.locale_voice_id.reset(); - delegate.SetPreferredVoiceIds(preferred_voice_ids); + delegate()->SetPreferredVoiceIds(preferred_voice_ids); utterance->SetVoiceName("Android"); utterance->SetEngineId(""); utterance->SetLang(""); - EXPECT_EQ(8, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(8, controller()->GetMatchingVoice(utterance.get(), voices)); - delegate.SetPreferredVoiceIds({}); + delegate()->SetPreferredVoiceIds({}); #endif } @@ -357,187 +397,145 @@ // voice1 is matched against the exact default system language. TestContentBrowserClient::GetInstance()->set_application_locale("en-US"); utterance->SetLang(""); - EXPECT_EQ(1, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(1, controller()->GetMatchingVoice(utterance.get(), voices)); #if defined(OS_CHROMEOS) // voice0 is matched against the system language which has no region piece. TestContentBrowserClient::GetInstance()->set_application_locale("en"); - EXPECT_EQ(0, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(0, controller()->GetMatchingVoice(utterance.get(), voices)); TtsControllerDelegate::PreferredVoiceIds preferred_voice_ids2; preferred_voice_ids2.locale_voice_id.emplace("voice0", "id0"); - delegate.SetPreferredVoiceIds(preferred_voice_ids2); + delegate()->SetPreferredVoiceIds(preferred_voice_ids2); // voice0 is matched against the pref over the system language. TestContentBrowserClient::GetInstance()->set_application_locale("en-US"); - EXPECT_EQ(0, controller->GetMatchingVoice(utterance.get(), voices)); + EXPECT_EQ(0, controller()->GetMatchingVoice(utterance.get(), voices)); #endif } } -class TtsControllerTestHelper { - public: - TtsControllerTestHelper() { - controller_.SetTtsPlatform(&platform_impl_); - // This ensures utterances don't immediately complete. - platform_impl_.set_run_speak_callback(false); - platform_impl_.set_is_speaking(true); - } - - std::unique_ptr<TestWebContents> CreateWebContents() { - return std::unique_ptr<TestWebContents>( - TestWebContents::Create(&browser_context_, nullptr)); - } - - std::unique_ptr<TtsUtteranceImpl> CreateUtterance(WebContents* web_contents) { - return std::make_unique<TtsUtteranceImpl>(&browser_context_, web_contents); - } - - MockTtsPlatformImpl* platform_impl() { return &platform_impl_; } - - TtsControllerForTesting* controller() { return &controller_; } - - TtsUtterance* TtsControllerCurrentUtterance() { - return controller_.current_utterance_.get(); - } - - bool IsUtteranceListEmpty() { return controller_.utterance_list_.empty(); } - - private: - content::BrowserTaskEnvironment task_environment_; - RenderViewHostTestEnabler rvh_enabler_; - TestBrowserContext browser_context_; - MockTtsPlatformImpl platform_impl_; - TtsControllerForTesting controller_; -}; - -TEST(TtsControllerTest, StopsWhenWebContentsDestroyed) { - TtsControllerTestHelper helper; - std::unique_ptr<WebContents> web_contents = helper.CreateWebContents(); +TEST_F(TtsControllerTest, StopsWhenWebContentsDestroyed) { + std::unique_ptr<WebContents> web_contents = CreateWebContents(); std::unique_ptr<TtsUtteranceImpl> utterance = - helper.CreateUtterance(web_contents.get()); + CreateUtteranceImpl(web_contents.get()); - helper.controller()->SpeakOrEnqueue(std::move(utterance)); - EXPECT_TRUE(helper.controller()->IsSpeaking()); - EXPECT_TRUE(helper.TtsControllerCurrentUtterance()); + controller()->SpeakOrEnqueue(std::move(utterance)); + EXPECT_TRUE(controller()->IsSpeaking()); + EXPECT_TRUE(TtsControllerCurrentUtterance()); web_contents.reset(); // Destroying the WebContents should reset // |TtsController::current_utterance_|. - EXPECT_FALSE(helper.TtsControllerCurrentUtterance()); + EXPECT_FALSE(TtsControllerCurrentUtterance()); } -TEST(TtsControllerTest, StartsQueuedUtteranceWhenWebContentsDestroyed) { - TtsControllerTestHelper helper; - std::unique_ptr<WebContents> web_contents1 = helper.CreateWebContents(); - std::unique_ptr<WebContents> web_contents2 = helper.CreateWebContents(); +TEST_F(TtsControllerTest, StartsQueuedUtteranceWhenWebContentsDestroyed) { + std::unique_ptr<WebContents> web_contents1 = CreateWebContents(); + std::unique_ptr<WebContents> web_contents2 = CreateWebContents(); std::unique_ptr<TtsUtteranceImpl> utterance1 = - helper.CreateUtterance(web_contents1.get()); + CreateUtteranceImpl(web_contents1.get()); void* raw_utterance1 = utterance1.get(); std::unique_ptr<TtsUtteranceImpl> utterance2 = - helper.CreateUtterance(web_contents2.get()); + CreateUtteranceImpl(web_contents2.get()); utterance2->SetCanEnqueue(true); void* raw_utterance2 = utterance2.get(); - helper.controller()->SpeakOrEnqueue(std::move(utterance1)); - EXPECT_TRUE(helper.controller()->IsSpeaking()); - EXPECT_TRUE(helper.TtsControllerCurrentUtterance()); - helper.controller()->SpeakOrEnqueue(std::move(utterance2)); - EXPECT_EQ(raw_utterance1, helper.TtsControllerCurrentUtterance()); + controller()->SpeakOrEnqueue(std::move(utterance1)); + EXPECT_TRUE(controller()->IsSpeaking()); + EXPECT_TRUE(TtsControllerCurrentUtterance()); + controller()->SpeakOrEnqueue(std::move(utterance2)); + EXPECT_EQ(raw_utterance1, TtsControllerCurrentUtterance()); web_contents1.reset(); // Destroying |web_contents1| should delete |utterance1| and start // |utterance2|. - EXPECT_TRUE(helper.TtsControllerCurrentUtterance()); - EXPECT_EQ(raw_utterance2, helper.TtsControllerCurrentUtterance()); + EXPECT_TRUE(TtsControllerCurrentUtterance()); + EXPECT_EQ(raw_utterance2, TtsControllerCurrentUtterance()); } -TEST(TtsControllerTest, StartsQueuedUtteranceWhenWebContentsDestroyed2) { - TtsControllerTestHelper helper; - std::unique_ptr<WebContents> web_contents1 = helper.CreateWebContents(); - std::unique_ptr<WebContents> web_contents2 = helper.CreateWebContents(); +TEST_F(TtsControllerTest, StartsQueuedUtteranceWhenWebContentsDestroyed2) { + std::unique_ptr<WebContents> web_contents1 = CreateWebContents(); + std::unique_ptr<WebContents> web_contents2 = CreateWebContents(); std::unique_ptr<TtsUtteranceImpl> utterance1 = - helper.CreateUtterance(web_contents1.get()); + CreateUtteranceImpl(web_contents1.get()); void* raw_utterance1 = utterance1.get(); std::unique_ptr<TtsUtteranceImpl> utterance2 = - helper.CreateUtterance(web_contents1.get()); + CreateUtteranceImpl(web_contents1.get()); std::unique_ptr<TtsUtteranceImpl> utterance3 = - helper.CreateUtterance(web_contents2.get()); + CreateUtteranceImpl(web_contents2.get()); void* raw_utterance3 = utterance3.get(); utterance2->SetCanEnqueue(true); utterance3->SetCanEnqueue(true); - helper.controller()->SpeakOrEnqueue(std::move(utterance1)); - helper.controller()->SpeakOrEnqueue(std::move(utterance2)); - helper.controller()->SpeakOrEnqueue(std::move(utterance3)); - EXPECT_TRUE(helper.controller()->IsSpeaking()); - EXPECT_EQ(raw_utterance1, helper.TtsControllerCurrentUtterance()); + controller()->SpeakOrEnqueue(std::move(utterance1)); + controller()->SpeakOrEnqueue(std::move(utterance2)); + controller()->SpeakOrEnqueue(std::move(utterance3)); + EXPECT_TRUE(controller()->IsSpeaking()); + EXPECT_EQ(raw_utterance1, TtsControllerCurrentUtterance()); web_contents1.reset(); // Deleting |web_contents1| should delete |utterance1| and |utterance2| as // they are both from |web_contents1|. |raw_utterance3| should be made the // current as it's from a different WebContents. - EXPECT_EQ(raw_utterance3, helper.TtsControllerCurrentUtterance()); - EXPECT_TRUE(helper.IsUtteranceListEmpty()); + EXPECT_EQ(raw_utterance3, TtsControllerCurrentUtterance()); + EXPECT_TRUE(IsUtteranceListEmpty()); web_contents2.reset(); // Deleting |web_contents2| should delete |utterance3| as it's from a // different WebContents. - EXPECT_EQ(nullptr, helper.TtsControllerCurrentUtterance()); + EXPECT_EQ(nullptr, TtsControllerCurrentUtterance()); } -TEST(TtsControllerTest, StartsUtteranceWhenWebContentsHidden) { - TtsControllerTestHelper helper; - std::unique_ptr<TestWebContents> web_contents = helper.CreateWebContents(); +TEST_F(TtsControllerTest, StartsUtteranceWhenWebContentsHidden) { + std::unique_ptr<TestWebContents> web_contents = CreateWebContents(); web_contents->SetVisibilityAndNotifyObservers(Visibility::HIDDEN); std::unique_ptr<TtsUtteranceImpl> utterance = - helper.CreateUtterance(web_contents.get()); - helper.controller()->SpeakOrEnqueue(std::move(utterance)); - EXPECT_TRUE(helper.controller()->IsSpeaking()); + CreateUtteranceImpl(web_contents.get()); + controller()->SpeakOrEnqueue(std::move(utterance)); + EXPECT_TRUE(controller()->IsSpeaking()); } -TEST(TtsControllerTest, - DoesNotStartUtteranceWhenWebContentsHiddenAndStopSpeakingWhenHiddenSet) { - TtsControllerTestHelper helper; - std::unique_ptr<TestWebContents> web_contents = helper.CreateWebContents(); +TEST_F(TtsControllerTest, + DoesNotStartUtteranceWhenWebContentsHiddenAndStopSpeakingWhenHiddenSet) { + std::unique_ptr<TestWebContents> web_contents = CreateWebContents(); web_contents->SetVisibilityAndNotifyObservers(Visibility::HIDDEN); std::unique_ptr<TtsUtteranceImpl> utterance = - helper.CreateUtterance(web_contents.get()); - helper.controller()->SetStopSpeakingWhenHidden(true); - helper.controller()->SpeakOrEnqueue(std::move(utterance)); - EXPECT_EQ(nullptr, helper.TtsControllerCurrentUtterance()); - EXPECT_TRUE(helper.IsUtteranceListEmpty()); + CreateUtteranceImpl(web_contents.get()); + controller()->SetStopSpeakingWhenHidden(true); + controller()->SpeakOrEnqueue(std::move(utterance)); + EXPECT_EQ(nullptr, TtsControllerCurrentUtterance()); + EXPECT_TRUE(IsUtteranceListEmpty()); } -TEST(TtsControllerTest, SkipsQueuedUtteranceFromHiddenWebContents) { - TtsControllerTestHelper helper; - helper.controller()->SetStopSpeakingWhenHidden(true); - std::unique_ptr<WebContents> web_contents1 = helper.CreateWebContents(); - std::unique_ptr<TestWebContents> web_contents2 = helper.CreateWebContents(); +TEST_F(TtsControllerTest, SkipsQueuedUtteranceFromHiddenWebContents) { + controller()->SetStopSpeakingWhenHidden(true); + std::unique_ptr<WebContents> web_contents1 = CreateWebContents(); + std::unique_ptr<TestWebContents> web_contents2 = CreateWebContents(); std::unique_ptr<TtsUtteranceImpl> utterance1 = - helper.CreateUtterance(web_contents1.get()); + CreateUtteranceImpl(web_contents1.get()); const int utterance1_id = utterance1->GetId(); std::unique_ptr<TtsUtteranceImpl> utterance2 = - helper.CreateUtterance(web_contents2.get()); + CreateUtteranceImpl(web_contents2.get()); utterance2->SetCanEnqueue(true); - helper.controller()->SpeakOrEnqueue(std::move(utterance1)); - EXPECT_TRUE(helper.TtsControllerCurrentUtterance()); - EXPECT_TRUE(helper.IsUtteranceListEmpty()); + controller()->SpeakOrEnqueue(std::move(utterance1)); + EXPECT_TRUE(TtsControllerCurrentUtterance()); + EXPECT_TRUE(IsUtteranceListEmpty()); // Speak |utterance2|, which should get queued. - helper.controller()->SpeakOrEnqueue(std::move(utterance2)); - EXPECT_FALSE(helper.IsUtteranceListEmpty()); + controller()->SpeakOrEnqueue(std::move(utterance2)); + EXPECT_FALSE(IsUtteranceListEmpty()); // Make the second WebContents hidden, this shouldn't change anything in // TtsController. web_contents2->SetVisibilityAndNotifyObservers(Visibility::HIDDEN); - EXPECT_FALSE(helper.IsUtteranceListEmpty()); + EXPECT_FALSE(IsUtteranceListEmpty()); // Finish |utterance1|, which should skip |utterance2| because |web_contents2| // is hidden. - helper.controller()->OnTtsEvent(utterance1_id, TTS_EVENT_END, 0, 0, {}); - EXPECT_EQ(nullptr, helper.TtsControllerCurrentUtterance()); - EXPECT_TRUE(helper.IsUtteranceListEmpty()); + controller()->OnTtsEvent(utterance1_id, TTS_EVENT_END, 0, 0, {}); + EXPECT_EQ(nullptr, TtsControllerCurrentUtterance()); + EXPECT_TRUE(IsUtteranceListEmpty()); } } // namespace content
diff --git a/content/browser/webrtc/webrtc_browsertest.cc b/content/browser/webrtc/webrtc_browsertest.cc index a182211..a8bf7c3 100644 --- a/content/browser/webrtc/webrtc_browsertest.cc +++ b/content/browser/webrtc/webrtc_browsertest.cc
@@ -264,8 +264,10 @@ #if defined(OS_ANDROID) && BUILDFLAG(USE_PROPRIETARY_CODECS) // This test is to make sure HW H264 work normally on supported devices, since // there is no SW H264 fallback available on Android. +// TODO(crbug.com/1047994): Disabled due to flakiness caused by timing issue +// in blink HW codec factories. IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, - CanSetupH264VideoCallOnSupportedDevice) { + DISABLED_CanSetupH264VideoCallOnSupportedDevice) { MakeTypicalPeerConnectionCall("CanSetupH264VideoCallOnSupportedDevice();"); } #endif
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 06e3dc8..fc7339a 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -532,13 +532,7 @@ // They're moved here to distinguish them from actual base checks WebRuntimeFeatures::EnableOverlayScrollbars(ui::IsOverlayScrollbarEnabled()); - if (base::FeatureList::GetInstance()->IsFeatureOverriddenFromCommandLine( - blink::features::kNativeFileSystemAPI.name, - base::FeatureList::OVERRIDE_ENABLE_FEATURE)) { - WebRuntimeFeatures::EnableFeatureFromString("NativeFileSystem", true); - } - if (base::FeatureList::IsEnabled(blink::features::kNativeFileSystemAPI) && - base::FeatureList::IsEnabled(blink::features::kFileHandlingAPI)) { + if (base::FeatureList::IsEnabled(blink::features::kFileHandlingAPI)) { WebRuntimeFeatures::EnableFeatureFromString("FileHandling", true); }
diff --git a/content/public/android/java/src/org/chromium/content/browser/SpareChildConnection.java b/content/public/android/java/src/org/chromium/content/browser/SpareChildConnection.java index 5ef29789..9a6720f 100644 --- a/content/public/android/java/src/org/chromium/content/browser/SpareChildConnection.java +++ b/content/public/android/java/src/org/chromium/content/browser/SpareChildConnection.java
@@ -58,7 +58,7 @@ @Override public void onChildStartFailed(ChildProcessConnection connection) { assert LauncherThread.runningOnLauncherThread(); - Log.e(TAG, "Failed to warm up the spare sandbox service"); + Log.w(TAG, "Failed to warm up the spare sandbox service"); if (mConnectionServiceCallback != null) { mConnectionServiceCallback.onChildStartFailed(connection); }
diff --git a/content/public/android/java/src/org/chromium/content/browser/font/AndroidFontLookupImpl.java b/content/public/android/java/src/org/chromium/content/browser/font/AndroidFontLookupImpl.java index 5f7395c..c5259fe 100644 --- a/content/public/android/java/src/org/chromium/content/browser/font/AndroidFontLookupImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/font/AndroidFontLookupImpl.java
@@ -12,6 +12,7 @@ import android.os.SystemClock; import androidx.annotation.IntDef; +import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import androidx.core.provider.FontRequest; import androidx.core.provider.FontsContractCompat; @@ -50,13 +51,19 @@ private static final String READ_ONLY_MODE = "r"; @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) - static final String FETCH_FONT_HISTOGRAM = "Android.FontLookup.FetchFontResult"; + static final String FETCH_FONT_NAME_HISTOGRAM = "Android.FontLookup.FetchFontName"; + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + static final String FETCH_FONT_RESULT_HISTOGRAM = "Android.FontLookup.FetchFontResult"; @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) static final String MATCH_LOCAL_FONT_BY_UNIQUE_NAME_HISTOGRAM = "Android.FontLookup.MatchLocalFontByUniqueName.Time"; @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) static final String GMS_FONT_REQUEST_HISTOGRAM = "Android.FontLookup.GmsFontRequest.Time"; + private static final String GOOGLE_SANS_REGULAR = "google sans regular"; + private static final String GOOGLE_SANS_MEDIUM = "google sans medium"; + private static final String GOOGLE_SANS_BOLD = "google sans bold"; + private final Context mAppContext; private final FontsContractWrapper mFontsContract; /** @@ -87,6 +94,19 @@ // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. These values must stay in sync with enums.xml. @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + @IntDef({FetchFontName.GOOGLE_SANS_REGULAR, FetchFontName.GOOGLE_SANS_MEDIUM, + FetchFontName.GOOGLE_SANS_BOLD}) + @interface FetchFontName { + int OTHER = 0; + int GOOGLE_SANS_REGULAR = 1; + int GOOGLE_SANS_MEDIUM = 2; + int GOOGLE_SANS_BOLD = 3; + int COUNT = 4; + } + + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. These values must stay in sync with enums.xml. + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) @IntDef({FetchFontResult.SUCCESS, FetchFontResult.FAILED_UNEXPECTED_NAME, FetchFontResult.FAILED_STATUS_CODE, FetchFontResult.FAILED_NON_UNIQUE_RESULT, FetchFontResult.FAILED_RESULT_CODE, FetchFontResult.FAILED_FILE_OPEN, @@ -132,9 +152,11 @@ */ @Override public void matchLocalFontByUniqueName( - String fontUniqueName, MatchLocalFontByUniqueNameResponse callback) { + @NonNull String fontUniqueName, MatchLocalFontByUniqueNameResponse callback) { long startTimeMs = SystemClock.elapsedRealtime(); + logFetchFontName(fontUniqueName); + // Get executor associated with the current thread for running Mojo callback. Core core = CoreImpl.getInstance(); Executor executor = ExecutorFactory.getExecutorForCurrentThread(core); @@ -239,20 +261,22 @@ * Creates the map from ICU case folded full font name to GMS Core font provider query format, * for a selected subset of Android Downloadable fonts. * - * Note: Because the CaseMap.Fold Java API is only available in Android API 29+, these keys have - * been manually converted from full font name to ICU case folded full font name (i.e. "Google - * Sans Regular" to "google sans regular") using - * `third_party/blink/common/font_unique_name_lookup/icu_fold_case_util.cc`. When further map - * entries are added in future, consider importing ICU4J as a third_party library to do this - * case folding explicitly in Java code instead, or using the native utility via JNI. + * When adding additional fonts to this map: + * 1. Add the font to preloaded_fonts.xml, or consider alternatives to prefetch new fonts + * programmatically at a different time in initialization as this may affect startup + * performance. + * 2. Keys should be ICU case folded full font name. This can be done manually with + * icu_fold_case_util.cc, or in Java by importing the ICU4J third_party library. (The + * CaseMap.Fold Java API is only available in Android API 29+.) + * 3. Update the {@link FetchFontName} enum entries. * * @return The created map from font names to queries. */ private static Map<String, String> createFullFontNameToQueryMap() { Map<String, String> map = new HashMap<>(); - map.put("google sans regular", createFontQuery("Google Sans", 400)); - map.put("google sans medium", createFontQuery("Google Sans", 500)); - map.put("google sans bold", createFontQuery("Google Sans", 700)); + map.put(GOOGLE_SANS_REGULAR, createFontQuery("Google Sans", 400)); + map.put(GOOGLE_SANS_MEDIUM, createFontQuery("Google Sans", 500)); + map.put(GOOGLE_SANS_BOLD, createFontQuery("Google Sans", 700)); return map; } @@ -270,7 +294,27 @@ private static void logFetchFontResult(@FetchFontResult int result) { RecordHistogram.recordEnumeratedHistogram( - FETCH_FONT_HISTOGRAM, result, FetchFontResult.COUNT); + FETCH_FONT_RESULT_HISTOGRAM, result, FetchFontResult.COUNT); + } + + private static void logFetchFontName(String fontName) { + @FetchFontName + int result; + switch (fontName) { + case GOOGLE_SANS_REGULAR: + result = FetchFontName.GOOGLE_SANS_REGULAR; + break; + case GOOGLE_SANS_MEDIUM: + result = FetchFontName.GOOGLE_SANS_MEDIUM; + break; + case GOOGLE_SANS_BOLD: + result = FetchFontName.GOOGLE_SANS_BOLD; + break; + default: + result = FetchFontName.OTHER; + } + RecordHistogram.recordEnumeratedHistogram( + FETCH_FONT_NAME_HISTOGRAM, result, FetchFontName.COUNT); } @Override
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/font/AndroidFontLookupImplTest.java b/content/public/android/javatests/src/org/chromium/content/browser/font/AndroidFontLookupImplTest.java index 7bae4ea..461326f 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/font/AndroidFontLookupImplTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/font/AndroidFontLookupImplTest.java
@@ -47,6 +47,7 @@ import org.chromium.blink.mojom.AndroidFontLookup; import org.chromium.blink.mojom.AndroidFontLookup.GetUniqueNameLookupTableResponse; import org.chromium.blink.mojom.AndroidFontLookup.MatchLocalFontByUniqueNameResponse; +import org.chromium.content.browser.font.AndroidFontLookupImpl.FetchFontName; import org.chromium.content.browser.font.AndroidFontLookupImpl.FetchFontResult; import org.chromium.content_public.browser.test.NativeLibraryTestUtils; import org.chromium.content_public.browser.test.util.CriteriaHelper; @@ -171,7 +172,11 @@ assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( - AndroidFontLookupImpl.FETCH_FONT_HISTOGRAM, + AndroidFontLookupImpl.FETCH_FONT_NAME_HISTOGRAM, FetchFontName.OTHER)); + + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + AndroidFontLookupImpl.FETCH_FONT_RESULT_HISTOGRAM, FetchFontResult.FAILED_UNEXPECTED_NAME)); assertEquals(1, @@ -196,7 +201,11 @@ assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( - AndroidFontLookupImpl.FETCH_FONT_HISTOGRAM, + AndroidFontLookupImpl.FETCH_FONT_NAME_HISTOGRAM, FetchFontName.OTHER)); + + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + AndroidFontLookupImpl.FETCH_FONT_RESULT_HISTOGRAM, FetchFontResult.FAILED_STATUS_CODE)); assertEquals(1, @@ -220,7 +229,11 @@ assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( - AndroidFontLookupImpl.FETCH_FONT_HISTOGRAM, + AndroidFontLookupImpl.FETCH_FONT_NAME_HISTOGRAM, FetchFontName.OTHER)); + + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + AndroidFontLookupImpl.FETCH_FONT_RESULT_HISTOGRAM, FetchFontResult.FAILED_NON_UNIQUE_RESULT)); assertEquals(1, @@ -246,7 +259,11 @@ assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( - AndroidFontLookupImpl.FETCH_FONT_HISTOGRAM, + AndroidFontLookupImpl.FETCH_FONT_NAME_HISTOGRAM, FetchFontName.OTHER)); + + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + AndroidFontLookupImpl.FETCH_FONT_RESULT_HISTOGRAM, FetchFontResult.FAILED_RESULT_CODE)); assertEquals(1, @@ -269,7 +286,11 @@ assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( - AndroidFontLookupImpl.FETCH_FONT_HISTOGRAM, + AndroidFontLookupImpl.FETCH_FONT_NAME_HISTOGRAM, FetchFontName.OTHER)); + + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + AndroidFontLookupImpl.FETCH_FONT_RESULT_HISTOGRAM, FetchFontResult.FAILED_EXCEPTION)); assertEquals(1, @@ -293,7 +314,7 @@ assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( - AndroidFontLookupImpl.FETCH_FONT_HISTOGRAM, + AndroidFontLookupImpl.FETCH_FONT_RESULT_HISTOGRAM, FetchFontResult.FAILED_EXCEPTION)); // Second request should early out with FAILED_AVOID_RETRY. @@ -305,9 +326,13 @@ timeout(CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL).times(2)) .call(isNull()); + assertEquals(2, + RecordHistogram.getHistogramValueCountForTesting( + AndroidFontLookupImpl.FETCH_FONT_NAME_HISTOGRAM, FetchFontName.OTHER)); + assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( - AndroidFontLookupImpl.FETCH_FONT_HISTOGRAM, + AndroidFontLookupImpl.FETCH_FONT_RESULT_HISTOGRAM, FetchFontResult.FAILED_AVOID_RETRY)); assertEquals(2, @@ -333,7 +358,12 @@ assertEquals(1, RecordHistogram.getHistogramValueCountForTesting( - AndroidFontLookupImpl.FETCH_FONT_HISTOGRAM, FetchFontResult.SUCCESS)); + AndroidFontLookupImpl.FETCH_FONT_NAME_HISTOGRAM, FetchFontName.OTHER)); + + assertEquals(1, + RecordHistogram.getHistogramValueCountForTesting( + AndroidFontLookupImpl.FETCH_FONT_RESULT_HISTOGRAM, + FetchFontResult.SUCCESS)); assertEquals(1, RecordHistogram.getHistogramTotalCountForTesting(
diff --git a/content/public/test/content_browser_test.cc b/content/public/test/content_browser_test.cc index 39c67f88e..89441a39 100644 --- a/content/public/test/content_browser_test.cc +++ b/content/public/test/content_browser_test.cc
@@ -10,6 +10,7 @@ #include "base/run_loop.h" #include "base/task/current_thread.h" #include "build/build_config.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" @@ -52,6 +53,10 @@ CHECK(base::PathService::Override(base::FILE_EXE, content_shell_path)); #endif CreateTestServer(GetTestDataFilePath()); + + // Fail as quickly as possible during tests, rather than attempting to reset + // accessibility and continue when unserialization fails. + RenderFrameHostImpl::max_accessibility_resets_ = 0; } ContentBrowserTest::~ContentBrowserTest() {
diff --git a/content/shell/browser/shell_browser_context.cc b/content/shell/browser/shell_browser_context.cc index 23c150a..cb2b374 100644 --- a/content/shell/browser/shell_browser_context.cc +++ b/content/shell/browser/shell_browser_context.cc
@@ -48,10 +48,8 @@ ShellBrowserContext::ShellBrowserContext(bool off_the_record, bool delay_services_creation) - : resource_context_(new ShellResourceContext), - ignore_certificate_errors_(false), - off_the_record_(off_the_record), - guest_manager_(nullptr) { + : resource_context_(std::make_unique<ShellResourceContext>()), + off_the_record_(off_the_record) { InitWhileIOAllowed(); if (!delay_services_creation) { BrowserContextDependencyManager::GetInstance() @@ -167,7 +165,7 @@ } BrowserPluginGuestManager* ShellBrowserContext::GetGuestManager() { - return guest_manager_; + return nullptr; } storage::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() {
diff --git a/content/shell/browser/shell_browser_context.h b/content/shell/browser/shell_browser_context.h index c9942a6..f053279 100644 --- a/content/shell/browser/shell_browser_context.h +++ b/content/shell/browser/shell_browser_context.h
@@ -37,11 +37,6 @@ bool delay_services_creation = false); ~ShellBrowserContext() override; - void set_guest_manager_for_testing( - BrowserPluginGuestManager* guest_manager) { - guest_manager_ = guest_manager; - } - void set_client_hints_controller_delegate( ClientHintsControllerDelegate* delegate) { client_hints_controller_delegate_ = delegate; @@ -93,10 +88,9 @@ void InitWhileIOAllowed(); void FinishInitWhileIOAllowed(); - bool ignore_certificate_errors_; - bool off_the_record_; + const bool off_the_record_; + bool ignore_certificate_errors_ = false; base::FilePath path_; - BrowserPluginGuestManager* guest_manager_; std::unique_ptr<SimpleFactoryKey> key_; ClientHintsControllerDelegate* client_hints_controller_delegate_ = nullptr;
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 8cefd73..9ffb5fc 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -1014,9 +1014,6 @@ "../browser/media/webaudio/audio_context_manager_browsertest.cc", "../browser/message_port_provider_browsertest.cc", "../browser/mojo_sandbox_browsertest.cc", - "../browser/native_file_system/file_system_chooser_browsertest.cc", - "../browser/native_file_system/native_file_system_drag_drop_browsertest.cc", - "../browser/native_file_system/native_file_system_file_writer_impl_browsertest.cc", "../browser/navigation_browsertest.cc", "../browser/navigation_mhtml_browsertest.cc", "../browser/net/accept_header_browsertest.cc", @@ -1052,6 +1049,7 @@ "../browser/renderer_host/input/interaction_mq_dynamic_browsertest.cc", "../browser/renderer_host/input/main_thread_event_queue_browsertest.cc", "../browser/renderer_host/input/mouse_latency_browsertest.cc", + "../browser/renderer_host/input/scroll_behavior_browsertest.cc", "../browser/renderer_host/input/scroll_latency_browsertest.cc", "../browser/renderer_host/input/synthetic_input_browsertest.cc", "../browser/renderer_host/input/touch_action_browsertest.cc", @@ -1464,6 +1462,9 @@ sources += [ "../browser/direct_sockets/direct_sockets_browsertest.cc", "../browser/host_zoom_map_impl_browsertest.cc", + "../browser/native_file_system/file_system_chooser_browsertest.cc", + "../browser/native_file_system/native_file_system_drag_drop_browsertest.cc", + "../browser/native_file_system/native_file_system_file_writer_impl_browsertest.cc", "../browser/serial/serial_browsertest.cc", "../browser/speech/speech_recognition_browsertest.cc", "../browser/speech/tts_ssml_browsertest.cc",
diff --git a/content/test/data/accessibility/aria/aria-button-expected-android.txt b/content/test/data/accessibility/aria/aria-button-expected-android.txt index a2cb3f5..a7f22ec 100644 --- a/content/test/data/accessibility/aria/aria-button-expected-android.txt +++ b/content/test/data/accessibility/aria/aria-button-expected-android.txt
@@ -1,11 +1,11 @@ android.webkit.WebView focusable focused scrollable ++android.widget.Button role_description='button' clickable focusable name='Button1' -++android.widget.ToggleButton role_description='toggle button' checkable checked clickable focusable name='Button2' -++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Button3' +++android.widget.ToggleButton role_description='toggle button' checkable checked clickable focusable name='Button2' state_description='On' +++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Button3' state_description='Off' ++android.widget.Spinner role_description='pop up button' clickable focusable name='Button4' ++android.widget.Button role_description='button' clickable focusable name='Button5' ++android.widget.Button role_description='button' clickable focusable name='Complex button ' -++android.widget.ToggleButton role_description='toggle button' checkable checked clickable focusable name='Complex toggle button ' +++android.widget.ToggleButton role_description='toggle button' checkable checked clickable focusable name='Complex toggle button ' state_description='On' ++++android.widget.TextView name='Complex toggle button ' ++++android.widget.EditText clickable editable_text focusable input_type=1 ++android.widget.Spinner role_description='pop up button' clickable focusable name='Complex pop up button '
diff --git a/content/test/data/accessibility/aria/aria-describedby-expected-blink.txt b/content/test/data/accessibility/aria/aria-describedby-expected-blink.txt index ffab23584..101db00 100644 --- a/content/test/data/accessibility/aria/aria-describedby-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-describedby-expected-blink.txt
@@ -6,6 +6,6 @@ ++++++tooltip name='Your username should be your email id' ++++++++staticText name='Your username should be your email id' ++++++++++inlineTextBox name='Your username should be your email id' -++++++genericContainer ignored invisible name='mmddyy' +++++++genericContainer ignored invisible ++++++textField description='mmddyy' descriptionFrom=relatedElement describedbyIds=genericContainer -++++++++genericContainer +++++++++genericContainer \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-hidden-expected-blink.txt b/content/test/data/accessibility/aria/aria-hidden-expected-blink.txt index 0decad6..e7cfe62 100644 --- a/content/test/data/accessibility/aria/aria-hidden-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-hidden-expected-blink.txt
@@ -4,13 +4,13 @@ ++++++genericContainer isLineBreakingObject=true ++++++++staticText name='blockDisplay' ++++++++++inlineTextBox name='blockDisplay' -++++++genericContainer ignored invisible name='noneDisplay' +++++++genericContainer ignored invisible ++++++genericContainer ignored invisible isLineBreakingObject=true ++++++++staticText ignored invisible name='blockDisplay Hiddentrue' -++++++genericContainer ignored invisible name='noneDisplay Hiddentrue' +++++++genericContainer ignored invisible ++++++genericContainer isLineBreakingObject=true ++++++++staticText name='blockDisplay Hiddenfalse' ++++++++++inlineTextBox name='blockDisplay Hiddenfalse' ++++++genericContainer invisible ++++++genericContainer invisible name='blockDisplay Hiddentruefocusable' isLineBreakingObject=true -++++++++staticText ignored invisible name='blockDisplay Hiddentruefocusable' +++++++++staticText ignored invisible name='blockDisplay Hiddentruefocusable' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-pressed-expected-android.txt b/content/test/data/accessibility/aria/aria-pressed-expected-android.txt index 4a07726..87b308d 100644 --- a/content/test/data/accessibility/aria/aria-pressed-expected-android.txt +++ b/content/test/data/accessibility/aria/aria-pressed-expected-android.txt
@@ -1,5 +1,5 @@ android.webkit.WebView focusable focused scrollable ++android.widget.Button role_description='button' clickable focusable name='Regular button' -++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Toggle button unpressed' -++android.widget.ToggleButton role_description='toggle button' checkable checked clickable focusable name='Toggle button pressed' -++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Toggle button mixed' \ No newline at end of file +++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Toggle button unpressed' state_description='Off' +++android.widget.ToggleButton role_description='toggle button' checkable checked clickable focusable name='Toggle button pressed' state_description='On' +++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Toggle button mixed' state_description='Off' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/aria-togglebutton-expected-android.txt b/content/test/data/accessibility/aria/aria-togglebutton-expected-android.txt index afc9e2e..5989142 100644 --- a/content/test/data/accessibility/aria/aria-togglebutton-expected-android.txt +++ b/content/test/data/accessibility/aria/aria-togglebutton-expected-android.txt
@@ -1,5 +1,5 @@ android.webkit.WebView focusable focused scrollable ++android.widget.Button role_description='button' clickable focusable name='Regular button' -++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Toggle button' -++android.widget.ToggleButton role_description='toggle button' checkable checked clickable focusable name='Toggle button' -++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Toggle button' +++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Toggle button' state_description='Off' +++android.widget.ToggleButton role_description='toggle button' checkable checked clickable focusable name='Toggle button' state_description='On' +++android.widget.ToggleButton role_description='toggle button' checkable clickable focusable name='Toggle button' state_description='Off' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/hidden-described-by-expected-blink.txt b/content/test/data/accessibility/aria/hidden-described-by-expected-blink.txt index 7a919f6..99841d5 100644 --- a/content/test/data/accessibility/aria/hidden-described-by-expected-blink.txt +++ b/content/test/data/accessibility/aria/hidden-described-by-expected-blink.txt
@@ -4,6 +4,6 @@ ++++++genericContainer ignored ++++++++genericContainer ignored invisible name='span-A2' ++++++++genericContainer description='span-A4' name='span-A3' descriptionFrom=relatedElement describedbyIds=genericContainer -++++++++++genericContainer ignored invisible name='span-A4' +++++++++++genericContainer ignored invisible ++++++++genericContainer description='span-A2' name='span-B' descriptionFrom=relatedElement describedbyIds=genericContainer -++++++++genericContainer name='span-C' +++++++++genericContainer name='span-C' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/hidden-described-by-expected-uia-win.txt b/content/test/data/accessibility/aria/hidden-described-by-expected-uia-win.txt index 554aad7..87b945cf 100644 --- a/content/test/data/accessibility/aria/hidden-described-by-expected-uia-win.txt +++ b/content/test/data/accessibility/aria/hidden-described-by-expected-uia-win.txt
@@ -1,4 +1,4 @@ Document -++Group Name='span-A3' DescribedBy='span-A4' +++Group Name='span-A3' DescribedBy='{group}' ++Group Name='span-B' DescribedBy='span-A2' -++Group Name='span-C' +++Group Name='span-C' \ No newline at end of file
diff --git a/content/test/data/accessibility/aria/hidden-labelled-by-expected-blink.txt b/content/test/data/accessibility/aria/hidden-labelled-by-expected-blink.txt index b879b4b..6fb66ed 100644 --- a/content/test/data/accessibility/aria/hidden-labelled-by-expected-blink.txt +++ b/content/test/data/accessibility/aria/hidden-labelled-by-expected-blink.txt
@@ -4,6 +4,6 @@ ++++++genericContainer ignored ++++++++genericContainer ignored invisible name='span-A2' ++++++++genericContainer name='span-A4' labelledbyIds=genericContainer -++++++++++genericContainer ignored invisible name='span-A4' +++++++++++genericContainer ignored invisible ++++++++genericContainer name='span-A2' labelledbyIds=genericContainer -++++++++genericContainer name='span-C' +++++++++genericContainer name='span-C' \ No newline at end of file
diff --git a/content/test/data/accessibility/css/display-none-expected-blink.txt b/content/test/data/accessibility/css/display-none-expected-blink.txt new file mode 100644 index 0000000..2306e8e --- /dev/null +++ b/content/test/data/accessibility/css/display-none-expected-blink.txt
@@ -0,0 +1,4 @@ +rootWebArea +++genericContainer ignored +++++genericContainer ignored +++++++genericContainer ignored invisible
diff --git a/content/test/data/accessibility/css/display-none.html b/content/test/data/accessibility/css/display-none.html new file mode 100644 index 0000000..f1ed840 --- /dev/null +++ b/content/test/data/accessibility/css/display-none.html
@@ -0,0 +1,4 @@ +<div style="display:none;" id="menuitems"> + <a href="#1">One</a> + <a href="#2">Two</a> +</div>
diff --git a/content/test/data/accessibility/css/display-to-none-expected-blink.txt b/content/test/data/accessibility/css/display-to-none-expected-blink.txt index 0aeec4e..4172306 100644 --- a/content/test/data/accessibility/css/display-to-none-expected-blink.txt +++ b/content/test/data/accessibility/css/display-to-none-expected-blink.txt
@@ -5,8 +5,8 @@ ++++++++genericContainer display='block' ++++++++++staticText display='block' name='Cats' ++++++++++++inlineTextBox display='block' name='Cats' -++++++++genericContainer ignored invisible display='none' name='checkbox' +++++++++genericContainer ignored invisible display='none' ++++++++++checkBox ignored invisible display='inline-block' name='checkbox' checkedState=false ++++++++genericContainer display='block' ++++++++++staticText display='inline' name='done' -++++++++++++inlineTextBox display='inline' name='done' +++++++++++++inlineTextBox display='inline' name='done' \ No newline at end of file
diff --git a/content/test/data/accessibility/css/visibility-expected-blink.txt b/content/test/data/accessibility/css/visibility-expected-blink.txt index 391c3340..55fa839 100644 --- a/content/test/data/accessibility/css/visibility-expected-blink.txt +++ b/content/test/data/accessibility/css/visibility-expected-blink.txt
@@ -1,9 +1,9 @@ rootWebArea ++genericContainer ignored ++++genericContainer ignored -++++++paragraph ignored invisible name=' Hidden paragraph with visible link' +++++++paragraph ignored invisible ++++++++staticText name='visible link' ++++++++++inlineTextBox name='visible link' -++++++paragraph ignored invisible name=' Collapsed paragraph with visible link' +++++++paragraph ignored invisible ++++++++staticText name='visible link' -++++++++++inlineTextBox name='visible link' +++++++++++inlineTextBox name='visible link' \ No newline at end of file
diff --git a/content/test/data/accessibility/event/css-visibility-collapse-expected-win.txt b/content/test/data/accessibility/event/css-visibility-collapse-expected-win.txt index 731f6a1..21bc260c 100644 --- a/content/test/data/accessibility/event/css-visibility-collapse-expected-win.txt +++ b/content/test/data/accessibility/event/css-visibility-collapse-expected-win.txt
@@ -1,4 +1,4 @@ -EVENT_OBJECT_HIDE on <div.a> role=ROLE_SYSTEM_GROUPING name="Heading" INVISIBLE level=2 +EVENT_OBJECT_HIDE on <div.a> role=ROLE_SYSTEM_GROUPING INVISIBLE level=2 EVENT_OBJECT_REORDER on <div> role=ROLE_SYSTEM_TOOLBAR IA2_STATE_HORIZONTAL EVENT_OBJECT_SHOW on <div.b> role=ROLE_SYSTEM_GROUPING name="Banner" IA2_EVENT_TEXT_INSERTED on <div> role=ROLE_SYSTEM_TOOLBAR IA2_STATE_HORIZONTAL new_text={'<obj>' start=0 end=1}
diff --git a/content/test/data/accessibility/event/css-visibility-descendants-expected-win.txt b/content/test/data/accessibility/event/css-visibility-descendants-expected-win.txt index 4ae2446b0..2c43a489 100644 --- a/content/test/data/accessibility/event/css-visibility-descendants-expected-win.txt +++ b/content/test/data/accessibility/event/css-visibility-descendants-expected-win.txt
@@ -1,3 +1,3 @@ -EVENT_OBJECT_HIDE on <div#heading-root.a> role=ROLE_SYSTEM_GROUPING name="Heading" INVISIBLE level=2 +EVENT_OBJECT_HIDE on <div#heading-root.a> role=ROLE_SYSTEM_GROUPING INVISIBLE level=2 EVENT_OBJECT_REORDER on <div> role=ROLE_SYSTEM_TOOLBAR IA2_STATE_HORIZONTAL -EVENT_OBJECT_SHOW on <div#banner-root.b> role=ROLE_SYSTEM_GROUPING name="Banner" +EVENT_OBJECT_SHOW on <div#banner-root.b> role=ROLE_SYSTEM_GROUPING name="Banner" \ No newline at end of file
diff --git a/content/test/data/accessibility/event/css-visibility-expected-win.txt b/content/test/data/accessibility/event/css-visibility-expected-win.txt index 731f6a1..21bc260c 100644 --- a/content/test/data/accessibility/event/css-visibility-expected-win.txt +++ b/content/test/data/accessibility/event/css-visibility-expected-win.txt
@@ -1,4 +1,4 @@ -EVENT_OBJECT_HIDE on <div.a> role=ROLE_SYSTEM_GROUPING name="Heading" INVISIBLE level=2 +EVENT_OBJECT_HIDE on <div.a> role=ROLE_SYSTEM_GROUPING INVISIBLE level=2 EVENT_OBJECT_REORDER on <div> role=ROLE_SYSTEM_TOOLBAR IA2_STATE_HORIZONTAL EVENT_OBJECT_SHOW on <div.b> role=ROLE_SYSTEM_GROUPING name="Banner" IA2_EVENT_TEXT_INSERTED on <div> role=ROLE_SYSTEM_TOOLBAR IA2_STATE_HORIZONTAL new_text={'<obj>' start=0 end=1}
diff --git a/content/test/data/accessibility/event/visibility-hidden-changed-expected-uia-win.txt b/content/test/data/accessibility/event/visibility-hidden-changed-expected-uia-win.txt index b9b6f51d1..7ef0c17 100644 --- a/content/test/data/accessibility/event/visibility-hidden-changed-expected-uia-win.txt +++ b/content/test/data/accessibility/event/visibility-hidden-changed-expected-uia-win.txt
@@ -1,4 +1,2 @@ -AriaProperties changed on role=document -AriaProperties changed on role=document AriaProperties changed on role=heading, name=Item2 AriaProperties changed on role=heading, name=Item4
diff --git a/content/test/data/accessibility/event/visibility-hidden-changed.html b/content/test/data/accessibility/event/visibility-hidden-changed.html index 5084bb5..bb3b971e 100644 --- a/content/test/data/accessibility/event/visibility-hidden-changed.html +++ b/content/test/data/accessibility/event/visibility-hidden-changed.html
@@ -1,6 +1,7 @@ <!-- @UIA-WIN-DENY:* @UIA-WIN-ALLOW:AriaProperties* +@UIA-WIN_DENY:AriaProperties changed on role=document --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/html/input-suggestions-source-element-expected-blink.txt b/content/test/data/accessibility/html/input-suggestions-source-element-expected-blink.txt index 00a6277..124530e 100644 --- a/content/test/data/accessibility/html/input-suggestions-source-element-expected-blink.txt +++ b/content/test/data/accessibility/html/input-suggestions-source-element-expected-blink.txt
@@ -3,4 +3,4 @@ ++++genericContainer ++++++textFieldWithComboBox autoComplete='list' inputType='text' haspopup=listbox ++++++++genericContainer -++++++genericContainer ignored invisible name='Option1 Option2' +++++++genericContainer ignored invisible \ No newline at end of file
diff --git a/content/test/data/accessibility/html/modal-dialog-stack-expected-blink.txt b/content/test/data/accessibility/html/modal-dialog-stack-expected-blink.txt index 3ddd1f2e..58da506 100644 --- a/content/test/data/accessibility/html/modal-dialog-stack-expected-blink.txt +++ b/content/test/data/accessibility/html/modal-dialog-stack-expected-blink.txt
@@ -2,14 +2,14 @@ ++genericContainer ignored ++++genericContainer ignored invisible ++++++section ignored invisible -++++++++dialog ignored invisible name=' This was the top dialog and should not be in the tree. ' +++++++++dialog ignored invisible ++++++++popUpButton collapsed ignored invisible value='This should be pruned out of the tree.' ++++++button ignored invisible name='This button should not be in the tree.' -++++++dialog ignored invisible name=' This was the middle dialog and should not be in the tree. ' +++++++dialog ignored invisible ++++++dialog ++++++++staticText name='This is the now active dialog. Of course it should be in the tree. ' ++++++++++inlineTextBox name='This is the now active dialog. Of course it should be in the tree. ' ++++++++button name='This is in the active dialog and should be in the tree.' ++++++++++staticText name='This is in the active dialog and should be in the tree.' ++++++++++++inlineTextBox name='This is in the active dialog and should be in the tree.' -++++++dialog ignored invisible +++++++dialog ignored invisible \ No newline at end of file
diff --git a/content/test/gpu/gpu_tests/gpu_integration_test.py b/content/test/gpu/gpu_tests/gpu_integration_test.py index 1646910f..c59a942 100644 --- a/content/test/gpu/gpu_tests/gpu_integration_test.py +++ b/content/test/gpu/gpu_tests/gpu_integration_test.py
@@ -242,6 +242,11 @@ if len(args) == 1 and isinstance(args[0], tuple): args = args[0] expected_crashes = self.GetExpectedCrashes(args) + os_name = self.browser.platform.GetOSName() + # The GPU tests don't function correctly if the screen is not on, so + # ensure that this is the case. + if os_name == 'android': + self.browser.platform.android_action_runner.TurnScreenOn() self.RunActualGpuTest(url, *args) except Exception: if ResultType.Failure in expected_results or should_retry_on_failure:
diff --git a/content/web_test/renderer/web_ax_object_proxy.cc b/content/web_test/renderer/web_ax_object_proxy.cc index c74fe0b9..8324b58 100644 --- a/content/web_test/renderer/web_ax_object_proxy.cc +++ b/content/web_test/renderer/web_ax_object_proxy.cc
@@ -663,6 +663,16 @@ notification_callback_.Reset(); } +void WebAXObjectProxy::UpdateLayout() { + blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); +} + +ui::AXNodeData WebAXObjectProxy::GetAXNodeData() const { + ui::AXNodeData node_data; + accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + return node_data; +} + gin::ObjectTemplateBuilder WebAXObjectProxy::GetObjectTemplateBuilder( v8::Isolate* isolate) { return gin::Wrappable<WebAXObjectProxy>::GetObjectTemplateBuilder(isolate) @@ -849,7 +859,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::GetChildAtIndex(unsigned index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return factory_->GetOrCreate(accessibility_object_.ChildAt(index)); } @@ -901,42 +911,42 @@ } std::string WebAXObjectProxy::Role() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return GetRole(accessibility_object_); } std::string WebAXObjectProxy::StringValue() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return GetStringValue(accessibility_object_); } std::string WebAXObjectProxy::Language() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return GetLanguage(accessibility_object_); } int WebAXObjectProxy::X() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return BoundsForObject(accessibility_object_).x(); } int WebAXObjectProxy::Y() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return BoundsForObject(accessibility_object_).y(); } int WebAXObjectProxy::Width() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return BoundsForObject(accessibility_object_).width(); } int WebAXObjectProxy::Height() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return BoundsForObject(accessibility_object_).height(); } v8::Local<v8::Value> WebAXObjectProxy::InPageLinkTarget() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject target = accessibility_object_.InPageLinkTarget(); if (target.IsNull()) return v8::Null(blink::MainThreadIsolate()); @@ -944,7 +954,7 @@ } int WebAXObjectProxy::IntValue() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); if (accessibility_object_.SupportsRangeValue()) { float value = 0.0f; @@ -958,37 +968,35 @@ } int WebAXObjectProxy::MinValue() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); float min_value = 0.0f; accessibility_object_.MinValueForRange(&min_value); return min_value; } int WebAXObjectProxy::MaxValue() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); float max_value = 0.0f; accessibility_object_.MaxValueForRange(&max_value); return max_value; } int WebAXObjectProxy::StepValue() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); float step_value = 0.0f; accessibility_object_.StepValueForRange(&step_value); return step_value; } std::string WebAXObjectProxy::ValueDescription() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + UpdateLayout(); std::string value_description = - node_data.GetStringAttribute(ax::mojom::StringAttribute::kValue); + GetAXNodeData().GetStringAttribute(ax::mojom::StringAttribute::kValue); return value_description.insert(0, "AXValueDescription: "); } int WebAXObjectProxy::ChildrenCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); int count = 1; // Root object always has only one child, the WebView. if (!IsRoot()) count = accessibility_object_.ChildCount(); @@ -996,7 +1004,7 @@ } bool WebAXObjectProxy::SelectionIsBackward() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); bool is_selection_backward = false; blink::WebAXObject anchor_object; @@ -1012,7 +1020,7 @@ } v8::Local<v8::Value> WebAXObjectProxy::SelectionAnchorObject() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); bool is_selection_backward = false; blink::WebAXObject anchor_object; @@ -1031,7 +1039,7 @@ } int WebAXObjectProxy::SelectionAnchorOffset() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); bool is_selection_backward = false; blink::WebAXObject anchor_object; @@ -1050,7 +1058,7 @@ } std::string WebAXObjectProxy::SelectionAnchorAffinity() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); bool is_selection_backward = false; blink::WebAXObject anchor_object; @@ -1067,7 +1075,7 @@ } v8::Local<v8::Value> WebAXObjectProxy::SelectionFocusObject() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); bool is_selection_backward = false; blink::WebAXObject anchor_object; @@ -1086,7 +1094,7 @@ } int WebAXObjectProxy::SelectionFocusOffset() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); bool is_selection_backward = false; blink::WebAXObject anchor_object; @@ -1105,7 +1113,7 @@ } std::string WebAXObjectProxy::SelectionFocusAffinity() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); bool is_selection_backward = false; blink::WebAXObject anchor_object; @@ -1122,19 +1130,17 @@ } bool WebAXObjectProxy::IsAtomic() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.LiveRegionAtomic(); } bool WebAXObjectProxy::IsAutofillAvailable() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.HasState(ax::mojom::State::kAutofillAvailable); + UpdateLayout(); + return GetAXNodeData().HasState(ax::mojom::State::kAutofillAvailable); } bool WebAXObjectProxy::IsBusy() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); SparseAttributeAdapter attribute_adapter; accessibility_object_.GetSparseAXAttributes(attribute_adapter); return attribute_adapter @@ -1142,11 +1148,9 @@ } std::string WebAXObjectProxy::Restriction() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + UpdateLayout(); blink::WebAXRestriction web_ax_restriction = - static_cast<blink::WebAXRestriction>(node_data.GetRestriction()); + static_cast<blink::WebAXRestriction>(GetAXNodeData().GetRestriction()); switch (web_ax_restriction) { case blink::kWebAXRestrictionReadOnly: return "readOnly"; @@ -1159,92 +1163,75 @@ } bool WebAXObjectProxy::IsRequired() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.HasState(ax::mojom::State::kRequired); + UpdateLayout(); + return GetAXNodeData().HasState(ax::mojom::State::kRequired); } bool WebAXObjectProxy::IsEditableRoot() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.IsEditableRoot(); } bool WebAXObjectProxy::IsEditable() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.HasState(ax::mojom::State::kEditable); + UpdateLayout(); + return GetAXNodeData().HasState(ax::mojom::State::kEditable); } bool WebAXObjectProxy::IsRichlyEditable() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.HasState(ax::mojom::State::kRichlyEditable); + UpdateLayout(); + return GetAXNodeData().HasState(ax::mojom::State::kRichlyEditable); } bool WebAXObjectProxy::IsFocused() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.IsFocused(); } bool WebAXObjectProxy::IsFocusable() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.HasState(ax::mojom::State::kFocusable); + UpdateLayout(); + return GetAXNodeData().HasState(ax::mojom::State::kFocusable); } bool WebAXObjectProxy::IsModal() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.IsModal(); } bool WebAXObjectProxy::IsSelected() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.GetBoolAttribute(ax::mojom::BoolAttribute::kSelected); + UpdateLayout(); + return GetAXNodeData().GetBoolAttribute(ax::mojom::BoolAttribute::kSelected); } bool WebAXObjectProxy::IsSelectable() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + UpdateLayout(); + ui::AXNodeData node_data = GetAXNodeData(); // It's selectable if it has the attribute, whether it's true or false. return node_data.HasBoolAttribute(ax::mojom::BoolAttribute::kSelected) && node_data.GetRestriction() != ax::mojom::Restriction::kDisabled; } bool WebAXObjectProxy::IsMultiLine() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.HasState(ax::mojom::State::kMultiline); + UpdateLayout(); + return GetAXNodeData().HasState(ax::mojom::State::kMultiline); } bool WebAXObjectProxy::IsMultiSelectable() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.HasState(ax::mojom::State::kMultiselectable); + UpdateLayout(); + return GetAXNodeData().HasState(ax::mojom::State::kMultiselectable); } bool WebAXObjectProxy::IsSelectedOptionActive() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.IsSelectedOptionActive(); } bool WebAXObjectProxy::IsExpanded() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.HasState(ax::mojom::State::kExpanded); + UpdateLayout(); + return GetAXNodeData().HasState(ax::mojom::State::kExpanded); } std::string WebAXObjectProxy::Checked() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); switch (accessibility_object_.CheckedState()) { case ax::mojom::CheckedState::kTrue: return "true"; @@ -1258,59 +1245,53 @@ } bool WebAXObjectProxy::IsCollapsed() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.HasState(ax::mojom::State::kCollapsed); + UpdateLayout(); + return GetAXNodeData().HasState(ax::mojom::State::kCollapsed); } bool WebAXObjectProxy::IsVisible() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return !node_data.HasState(ax::mojom::State::kInvisible); + UpdateLayout(); + return !GetAXNodeData().HasState(ax::mojom::State::kInvisible); } bool WebAXObjectProxy::IsVisited() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.IsVisited(); } bool WebAXObjectProxy::IsOffScreen() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.IsOffScreen(); } bool WebAXObjectProxy::IsValid() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return !accessibility_object_.IsDetached(); } bool WebAXObjectProxy::IsReadOnly() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.GetRestriction() == ax::mojom::Restriction::kReadOnly; + UpdateLayout(); + return GetAXNodeData().GetRestriction() == ax::mojom::Restriction::kReadOnly; } bool WebAXObjectProxy::IsIgnored() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.AccessibilityIsIgnored(); } v8::Local<v8::Object> WebAXObjectProxy::ActiveDescendant() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject element = accessibility_object_.AriaActiveDescendant(); return factory_->GetOrCreate(element); } unsigned int WebAXObjectProxy::BackgroundColor() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.BackgroundColor(); } unsigned int WebAXObjectProxy::Color() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); unsigned int color = accessibility_object_.GetColor(); // Remove the alpha because it's always 1 and thus not informative. return color & 0xFFFFFF; @@ -1318,28 +1299,28 @@ // For input elements of type color. unsigned int WebAXObjectProxy::ColorValue() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.ColorValue(); } std::string WebAXObjectProxy::FontFamily() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); std::string font_family(accessibility_object_.FontFamily().Utf8()); return font_family.insert(0, "AXFontFamily: "); } float WebAXObjectProxy::FontSize() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.FontSize(); } std::string WebAXObjectProxy::Autocomplete() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.AutoComplete().Utf8(); } std::string WebAXObjectProxy::Current() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); switch (accessibility_object_.AriaCurrentState()) { case ax::mojom::AriaCurrentState::kFalse: return "false"; @@ -1361,10 +1342,8 @@ } std::string WebAXObjectProxy::HasPopup() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - switch (node_data.GetHasPopup()) { + UpdateLayout(); + switch (GetAXNodeData().GetHasPopup()) { case ax::mojom::HasPopup::kTrue: return "true"; case ax::mojom::HasPopup::kMenu: @@ -1383,7 +1362,7 @@ } std::string WebAXObjectProxy::Invalid() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); switch (accessibility_object_.InvalidState()) { case ax::mojom::InvalidState::kFalse: return "false"; @@ -1397,7 +1376,7 @@ } std::string WebAXObjectProxy::KeyShortcuts() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); SparseAttributeAdapter attribute_adapter; accessibility_object_.GetSparseAXAttributes(attribute_adapter); return attribute_adapter @@ -1406,58 +1385,49 @@ } int32_t WebAXObjectProxy::AriaColumnCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.GetIntAttribute(ax::mojom::IntAttribute::kAriaColumnCount); + UpdateLayout(); + return GetAXNodeData().GetIntAttribute( + ax::mojom::IntAttribute::kAriaColumnCount); } uint32_t WebAXObjectProxy::AriaColumnIndex() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.GetIntAttribute( + UpdateLayout(); + return GetAXNodeData().GetIntAttribute( ax::mojom::IntAttribute::kAriaCellColumnIndex); } uint32_t WebAXObjectProxy::AriaColumnSpan() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.GetIntAttribute( + UpdateLayout(); + return GetAXNodeData().GetIntAttribute( ax::mojom::IntAttribute::kAriaCellColumnSpan); } int32_t WebAXObjectProxy::AriaRowCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.GetIntAttribute(ax::mojom::IntAttribute::kAriaRowCount); + UpdateLayout(); + return GetAXNodeData().GetIntAttribute( + ax::mojom::IntAttribute::kAriaRowCount); } uint32_t WebAXObjectProxy::AriaRowIndex() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.GetIntAttribute(ax::mojom::IntAttribute::kAriaCellRowIndex); + UpdateLayout(); + return GetAXNodeData().GetIntAttribute( + ax::mojom::IntAttribute::kAriaCellRowIndex); } uint32_t WebAXObjectProxy::AriaRowSpan() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - return node_data.GetIntAttribute(ax::mojom::IntAttribute::kAriaCellRowSpan); + UpdateLayout(); + return GetAXNodeData().GetIntAttribute( + ax::mojom::IntAttribute::kAriaCellRowSpan); } std::string WebAXObjectProxy::Live() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.LiveRegionStatus().Utf8(); } std::string WebAXObjectProxy::Orientation() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); + UpdateLayout(); + ui::AXNodeData node_data = GetAXNodeData(); if (node_data.HasState(ax::mojom::State::kVertical)) return "AXOrientation: AXVerticalOrientation"; else if (node_data.HasState(ax::mojom::State::kHorizontal)) @@ -1466,12 +1436,12 @@ } std::string WebAXObjectProxy::Relevant() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.LiveRegionRelevant().Utf8(); } std::string WebAXObjectProxy::RoleDescription() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); SparseAttributeAdapter attribute_adapter; accessibility_object_.GetSparseAXAttributes(attribute_adapter); return attribute_adapter @@ -1480,7 +1450,7 @@ } std::string WebAXObjectProxy::Sort() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); switch (accessibility_object_.SortDirection()) { case ax::mojom::SortDirection::kAscending: return "ascending"; @@ -1494,68 +1464,68 @@ } std::string WebAXObjectProxy::Url() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.Url().GetString().Utf8(); } int WebAXObjectProxy::HierarchicalLevel() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.HierarchicalLevel(); } int WebAXObjectProxy::PosInSet() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.PosInSet(); } int WebAXObjectProxy::SetSize() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.SetSize(); } int WebAXObjectProxy::ClickPointX() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); gfx::RectF bounds = BoundsForObject(accessibility_object_); return bounds.x() + bounds.width() / 2; } int WebAXObjectProxy::ClickPointY() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); gfx::RectF bounds = BoundsForObject(accessibility_object_); return bounds.y() + bounds.height() / 2; } int32_t WebAXObjectProxy::RowCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return static_cast<int32_t>(accessibility_object_.RowCount()); } int32_t WebAXObjectProxy::RowHeadersCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebVector<blink::WebAXObject> headers; accessibility_object_.RowHeaders(headers); return static_cast<int32_t>(headers.size()); } int32_t WebAXObjectProxy::ColumnCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return static_cast<int32_t>(accessibility_object_.ColumnCount()); } int32_t WebAXObjectProxy::ColumnHeadersCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebVector<blink::WebAXObject> headers; accessibility_object_.ColumnHeaders(headers); return static_cast<int32_t>(headers.size()); } bool WebAXObjectProxy::IsClickable() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.IsClickable(); } v8::Local<v8::Object> WebAXObjectProxy::AriaActiveDescendantElement() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); SparseAttributeAdapter attribute_adapter; accessibility_object_.GetSparseAXAttributes(attribute_adapter); blink::WebAXObject element = @@ -1566,7 +1536,7 @@ v8::Local<v8::Object> WebAXObjectProxy::AriaControlsElementAtIndex( unsigned index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); SparseAttributeAdapter attribute_adapter; accessibility_object_.GetSparseAXAttributes(attribute_adapter); blink::WebVector<blink::WebAXObject> elements = @@ -1581,7 +1551,7 @@ v8::Local<v8::Object> WebAXObjectProxy::AriaDetailsElementAtIndex( unsigned index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); SparseAttributeAdapter attribute_adapter; accessibility_object_.GetSparseAXAttributes(attribute_adapter); blink::WebVector<blink::WebAXObject> elements = @@ -1595,7 +1565,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::AriaErrorMessageElement() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); SparseAttributeAdapter attribute_adapter; accessibility_object_.GetSparseAXAttributes(attribute_adapter); blink::WebAXObject element = @@ -1606,7 +1576,7 @@ v8::Local<v8::Object> WebAXObjectProxy::AriaFlowToElementAtIndex( unsigned index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); SparseAttributeAdapter attribute_adapter; accessibility_object_.GetSparseAXAttributes(attribute_adapter); blink::WebVector<blink::WebAXObject> elements = @@ -1620,7 +1590,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::AriaOwnsElementAtIndex(unsigned index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebVector<blink::WebAXObject> elements; accessibility_object_.AriaOwns(elements); size_t element_count = elements.size(); @@ -1631,12 +1601,12 @@ } std::string WebAXObjectProxy::AllAttributes() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return GetAttributes(accessibility_object_); } std::string WebAXObjectProxy::AttributesOfChildren() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); AttributesCollector collector; unsigned size = accessibility_object_.ChildCount(); for (unsigned i = 0; i < size; ++i) @@ -1645,7 +1615,7 @@ } std::string WebAXObjectProxy::BoundsForRange(int start, int end) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); if (accessibility_object_.Role() != ax::mojom::Role::kStaticText) return std::string(); @@ -1676,7 +1646,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::ElementAtPoint(int x, int y) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); gfx::Point point(x, y); blink::WebAXObject obj = accessibility_object_.HitTest(point); if (obj.IsNull()) @@ -1686,7 +1656,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::RowHeaderAtIndex(unsigned index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebVector<blink::WebAXObject> headers; accessibility_object_.RowHeaders(headers); size_t header_count = headers.size(); @@ -1697,7 +1667,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::ColumnHeaderAtIndex(unsigned index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebVector<blink::WebAXObject> headers; accessibility_object_.ColumnHeaders(headers); size_t header_count = headers.size(); @@ -1708,14 +1678,14 @@ } std::string WebAXObjectProxy::RowIndexRange() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); unsigned row_index = accessibility_object_.CellRowIndex(); unsigned row_span = accessibility_object_.CellRowSpan(); return base::StringPrintf("{%d, %d}", row_index, row_span); } std::string WebAXObjectProxy::ColumnIndexRange() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); unsigned column_index = accessibility_object_.CellColumnIndex(); unsigned column_span = accessibility_object_.CellColumnSpan(); return base::StringPrintf("{%d, %d}", column_index, column_span); @@ -1723,7 +1693,7 @@ v8::Local<v8::Object> WebAXObjectProxy::CellForColumnAndRow(int column, int row) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject obj = accessibility_object_.CellForColumnAndRow(column, row); if (obj.IsNull()) @@ -1733,7 +1703,7 @@ } void WebAXObjectProxy::SetSelectedTextRange(int selection_start, int length) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); accessibility_object_.SetSelection(accessibility_object_, selection_start, accessibility_object_, selection_start + length); @@ -1763,14 +1733,14 @@ } DCHECK(web_ax_focus); - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.SetSelection( web_ax_anchor->accessibility_object_, anchor_offset, web_ax_focus->accessibility_object_, focus_offset); } bool WebAXObjectProxy::IsAttributeSettable(const std::string& attribute) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); bool settable = false; if (attribute == "AXValue") settable = accessibility_object_.CanSetValueAttribute(); @@ -1778,23 +1748,23 @@ } bool WebAXObjectProxy::IsPressActionSupported() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.CanPress(); } v8::Local<v8::Object> WebAXObjectProxy::ParentElement() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject parent_object = accessibility_object_.ParentObject(); return factory_->GetOrCreate(parent_object); } void WebAXObjectProxy::Increment() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); accessibility_object_.Increment(); } void WebAXObjectProxy::Decrement() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); accessibility_object_.Decrement(); } @@ -1803,15 +1773,13 @@ } void WebAXObjectProxy::Press() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); accessibility_object_.Click(); } bool WebAXObjectProxy::SetValue(const std::string& value) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); - ui::AXNodeData node_data; - accessibility_object_.Serialize(&node_data, ui::kAXModeComplete); - if (node_data.GetRestriction() != ax::mojom::Restriction::kNone || + UpdateLayout(); + if (GetAXNodeData().GetRestriction() != ax::mojom::Restriction::kNone || accessibility_object_.StringValue().IsEmpty()) return false; @@ -1837,12 +1805,12 @@ } void WebAXObjectProxy::TakeFocus() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); accessibility_object_.Focus(); } void WebAXObjectProxy::ScrollToMakeVisible() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); accessibility_object_.ScrollToMakeVisible(); } @@ -1850,53 +1818,53 @@ int y, int width, int height) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); accessibility_object_.ScrollToMakeVisibleWithSubFocus( blink::WebRect(x, y, width, height)); } void WebAXObjectProxy::ScrollToGlobalPoint(int x, int y) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); accessibility_object_.ScrollToGlobalPoint(gfx::Point(x, y)); } int WebAXObjectProxy::ScrollX() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.GetScrollOffset().x(); } int WebAXObjectProxy::ScrollY() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.GetScrollOffset().y(); } std::string WebAXObjectProxy::ToString() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.ToString().Utf8(); } float WebAXObjectProxy::BoundsX() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return BoundsForObject(accessibility_object_).x(); } float WebAXObjectProxy::BoundsY() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return BoundsForObject(accessibility_object_).y(); } float WebAXObjectProxy::BoundsWidth() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return BoundsForObject(accessibility_object_).width(); } float WebAXObjectProxy::BoundsHeight() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return BoundsForObject(accessibility_object_).height(); } int WebAXObjectProxy::WordStart(int character_index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); if (accessibility_object_.Role() != ax::mojom::Role::kStaticText) return -1; @@ -1907,7 +1875,7 @@ } int WebAXObjectProxy::WordEnd(int character_index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); if (accessibility_object_.Role() != ax::mojom::Role::kStaticText) return -1; @@ -1918,7 +1886,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::NextOnLine() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject obj = accessibility_object_.NextOnLine(); if (obj.IsNull()) return v8::Local<v8::Object>(); @@ -1927,7 +1895,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::PreviousOnLine() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject obj = accessibility_object_.PreviousOnLine(); if (obj.IsNull()) return v8::Local<v8::Object>(); @@ -1936,19 +1904,19 @@ } std::string WebAXObjectProxy::MisspellingAtIndex(int index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); if (index < 0 || index >= MisspellingsCount()) return std::string(); return GetMisspellings(accessibility_object_)[index]; } std::string WebAXObjectProxy::Name() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return accessibility_object_.GetName().Utf8(); } std::string WebAXObjectProxy::NameFrom() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); ax::mojom::NameFrom name_from = ax::mojom::NameFrom::kUninitialized; blink::WebVector<blink::WebAXObject> name_objects; accessibility_object_.GetName(name_from, name_objects); @@ -1979,7 +1947,7 @@ } int WebAXObjectProxy::NameElementCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); ax::mojom::NameFrom name_from; blink::WebVector<blink::WebAXObject> name_objects; accessibility_object_.GetName(name_from, name_objects); @@ -1987,7 +1955,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::NameElementAtIndex(unsigned index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); ax::mojom::NameFrom name_from; blink::WebVector<blink::WebAXObject> name_objects; accessibility_object_.GetName(name_from, name_objects); @@ -1997,7 +1965,7 @@ } std::string WebAXObjectProxy::Description() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); ax::mojom::NameFrom name_from; blink::WebVector<blink::WebAXObject> name_objects; accessibility_object_.GetName(name_from, name_objects); @@ -2009,7 +1977,7 @@ } std::string WebAXObjectProxy::DescriptionFrom() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); ax::mojom::NameFrom name_from; blink::WebVector<blink::WebAXObject> name_objects; accessibility_object_.GetName(name_from, name_objects); @@ -2037,7 +2005,7 @@ } std::string WebAXObjectProxy::Placeholder() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); ax::mojom::NameFrom name_from; blink::WebVector<blink::WebAXObject> name_objects; accessibility_object_.GetName(name_from, name_objects); @@ -2045,12 +2013,12 @@ } int WebAXObjectProxy::MisspellingsCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); return GetMisspellings(accessibility_object_).size(); } int WebAXObjectProxy::DescriptionElementCount() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); ax::mojom::NameFrom name_from; blink::WebVector<blink::WebAXObject> name_objects; accessibility_object_.GetName(name_from, name_objects); @@ -2063,7 +2031,7 @@ v8::Local<v8::Object> WebAXObjectProxy::DescriptionElementAtIndex( unsigned index) { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); ax::mojom::NameFrom name_from; blink::WebVector<blink::WebAXObject> name_objects; accessibility_object_.GetName(name_from, name_objects); @@ -2077,7 +2045,7 @@ } v8::Local<v8::Object> WebAXObjectProxy::OffsetContainer() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject container; gfx::RectF bounds; SkMatrix44 matrix; @@ -2086,7 +2054,7 @@ } float WebAXObjectProxy::BoundsInContainerX() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject container; gfx::RectF bounds; SkMatrix44 matrix; @@ -2095,7 +2063,7 @@ } float WebAXObjectProxy::BoundsInContainerY() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject container; gfx::RectF bounds; SkMatrix44 matrix; @@ -2104,7 +2072,7 @@ } float WebAXObjectProxy::BoundsInContainerWidth() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject container; gfx::RectF bounds; SkMatrix44 matrix; @@ -2113,7 +2081,7 @@ } float WebAXObjectProxy::BoundsInContainerHeight() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject container; gfx::RectF bounds; SkMatrix44 matrix; @@ -2122,7 +2090,7 @@ } bool WebAXObjectProxy::HasNonIdentityTransform() { - blink::WebAXObject::UpdateLayout(accessibility_object_.GetDocument()); + UpdateLayout(); blink::WebAXObject container; gfx::RectF bounds; SkMatrix44 matrix;
diff --git a/content/web_test/renderer/web_ax_object_proxy.h b/content/web_test/renderer/web_ax_object_proxy.h index 34de135..ba86105 100644 --- a/content/web_test/renderer/web_ax_object_proxy.h +++ b/content/web_test/renderer/web_ax_object_proxy.h
@@ -61,6 +61,9 @@ private: friend class WebAXObjectProxyBindings; + void UpdateLayout(); + ui::AXNodeData GetAXNodeData() const; + // Bound properties. std::string Role(); std::string StringValue();
diff --git a/docs/ozone_overview.md b/docs/ozone_overview.md index 02ad2934..3c0546ea0 100644 --- a/docs/ozone_overview.md +++ b/docs/ozone_overview.md
@@ -155,20 +155,26 @@ --ozone-dump-file=/tmp/ ``` -### Linux Desktop - ([waterfall](https://build.chromium.org/p/chromium.fyi/builders/Ozone%20Linux/)) +### Linux Desktop - ([waterfall](https://ci.chromium.org/p/chromium/builders/try/linux-ozone-rel)) -**Warning: Experimental support for Linux Desktop is available since m57 and still under - development. The work is purely done in the upstream, but you can still find some Ozone/X11 - patches in the the old [ozone-wayland-dev](https://github.com/Igalia/chromium/tree/ozone-wayland-dev) branch.** +**Warning: Experimental Ozone feature is available in the official Chrome distributions since m87. + It is not required to build Ozone for Linux anymore for the purpose of testing. It is enough + to start Chrome with the following flags - ./chrome --enable-features=UseOzonePlatform + --ozone-platform={x11/wayland}.** -To build `chrome`, do this from the `src` directory: +To build `chrome` with Ozone support, it is no longer required to pass any additional +gn arguments. One can just follow the manual about how to build Chromium for Linux as both +(Aura/X11) 'use\_x11=true' and (Linux/Ozone) 'use\_ozone=true' are set by default. + +If you want to disable Aura/X11 in the build, do this from the `src` directory: ``` shell -gn args out/OzoneLinuxDesktop --args="use_ozone=true use_system_minigbm=true use_system_libdrm=true" +gn args out/OzoneLinuxDesktop --args="use_x11=false" ninja -C out/OzoneLinuxDesktop chrome ``` -Then to run for example the X11 platform: +Then to run for example the X11 platform (note that passing --enable-features=UseOzonePlatform +is not required if Aura/X11 is disabled): ``` shell ./out/OzoneLinuxDesktop/chrome --ozone-platform=x11 @@ -180,6 +186,13 @@ ./out/OzoneLinuxDesktop/chrome --ozone-platform=wayland ``` +If you want to disable Linux/Ozone in the build, do this from the `src` directory: + +``` shell +gn args out/LinuxDesktop --args="use_ozone=false" +ninja -C out/LinuxDesktop chrome +``` + ### GN Configuration notes You can turn properly implemented ozone platforms on and off by setting the
diff --git a/docs/static_initializers.md b/docs/static_initializers.md index 0eea3fc..e8ee5e4 100644 --- a/docs/static_initializers.md +++ b/docs/static_initializers.md
@@ -17,9 +17,9 @@ Common fixes include: -* Add constexpr, -* Use LazyInstance<>, -* Move global variable to be a static variable within a function that returns it. +* Add constexpr. +* Move global variable to be a static variable within a function that returns + it, often wrapped in `base::NoDestructor`. ## Listing Static Initializers
diff --git a/extensions/browser/api/lock_screen_data/lock_screen_item_storage.cc b/extensions/browser/api/lock_screen_data/lock_screen_item_storage.cc index 0df643e1..bc37645 100644 --- a/extensions/browser/api/lock_screen_data/lock_screen_item_storage.cc +++ b/extensions/browser/api/lock_screen_data/lock_screen_item_storage.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/guid.h" #include "base/metrics/histogram_macros.h" +#include "base/strings/strcat.h" #include "base/time/default_tick_clock.h" #include "base/values.h" #include "components/prefs/pref_registry_simple.h" @@ -668,7 +669,7 @@ const std::string& id) { { DictionaryPrefUpdate update(local_state_, kLockScreenDataPrefKey); - update->RemovePath({user_id_, id}); + update->RemovePath(base::StrCat({user_id_, ".", id})); } data_item_cache_[id].state = CachedExtensionData::State::kLoaded;
diff --git a/fuchsia/base/feedback_registration.cc b/fuchsia/base/feedback_registration.cc index d8bee5f..7790b8b 100644 --- a/fuchsia/base/feedback_registration.cc +++ b/fuchsia/base/feedback_registration.cc
@@ -13,8 +13,9 @@ namespace cr_fuchsia { -void RegisterCrashReportingFields(base::StringPiece component_url, - base::StringPiece crash_product_name) { +void RegisterProductDataForCrashReporting( + base::StringPiece component_url, + base::StringPiece crash_product_name) { fuchsia::feedback::CrashReportingProduct product_data; product_data.set_name(crash_product_name.as_string()); product_data.set_version(version_info::GetVersionNumber()); @@ -27,4 +28,16 @@ ->Upsert(component_url.as_string(), std::move(product_data)); } +void RegisterProductDataForFeedback(base::StringPiece component_namespace) { + fuchsia::feedback::ComponentData component_data; + component_data.set_namespace_(component_namespace.as_string()); + // TODO(https://crbug.com/1077428): Add release channel to the annotations. + component_data.mutable_annotations()->push_back( + {"version", version_info::GetVersionNumber()}); + base::ComponentContextForProcess() + ->svc() + ->Connect<fuchsia::feedback::ComponentDataRegister>() + ->Upsert(std::move(component_data), []() {}); +} + } // namespace cr_fuchsia
diff --git a/fuchsia/base/feedback_registration.h b/fuchsia/base/feedback_registration.h index 7e983bf..9f32c04 100644 --- a/fuchsia/base/feedback_registration.h +++ b/fuchsia/base/feedback_registration.h
@@ -14,8 +14,15 @@ // the version from version_info, and an appropriate value for the release // channel. |component_url| must match the current component. The calling // process must have access to "fuchsia.feedback.CrashReportingProductRegister". -void RegisterCrashReportingFields(base::StringPiece component_url, - base::StringPiece crash_product_name); +void RegisterProductDataForCrashReporting(base::StringPiece component_url, + base::StringPiece crash_product_name); + +// Registers basic annotations for the component in |component_namespace|. +// Feedback reports will contain a namespace |component_namespace| that contains +// the version from version_info, and an appropriate value for the release +// channel. The calling process must have access to +// "fuchsia.feedback.ComponentDataRegister". +void RegisterProductDataForFeedback(base::StringPiece component_namespace); } // namespace cr_fuchsia
diff --git a/fuchsia/engine/context_provider_main.cc b/fuchsia/engine/context_provider_main.cc index 87cf2530..a01aac7 100644 --- a/fuchsia/engine/context_provider_main.cc +++ b/fuchsia/engine/context_provider_main.cc
@@ -4,7 +4,6 @@ #include "fuchsia/engine/context_provider_main.h" -#include <fuchsia/feedback/cpp/fidl.h> #include <lib/sys/cpp/component_context.h> #include <lib/sys/cpp/outgoing_directory.h> @@ -38,27 +37,13 @@ return version_string; } -// TODO(ddorwin): Move to feedback_registration.h. -// TODO(https://crbug.com/1010222): Add annotations at Context startup, once -// Contexts are moved out to run in their own components. -void RegisterFeedbackAnnotations() { - fuchsia::feedback::ComponentData component_data; - component_data.set_namespace_(kFeedbackAnnotationsNamespace); - // TODO(https://crbug.com/1077428): Add release channel to the annotations. - component_data.mutable_annotations()->push_back( - {"version", version_info::GetVersionNumber()}); - base::ComponentContextForProcess() - ->svc() - ->Connect<fuchsia::feedback::ComponentDataRegister>() - ->Upsert(std::move(component_data), []() {}); -} - } // namespace int ContextProviderMain() { base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); - cr_fuchsia::RegisterCrashReportingFields(kComponentUrl, kCrashProductName); + cr_fuchsia::RegisterProductDataForCrashReporting(kComponentUrl, + kCrashProductName); if (!cr_fuchsia::InitLoggingFromCommandLine( *base::CommandLine::ForCurrentProcess())) { @@ -66,7 +51,9 @@ } // Populate feedback annotations for this component. - RegisterFeedbackAnnotations(); + // TODO(crbug.com/1010222): Add annotations at Context startup, once Contexts + // are moved out to run in their own components. + cr_fuchsia::RegisterProductDataForFeedback(kFeedbackAnnotationsNamespace); LOG(INFO) << "Starting WebEngine " << GetVersionString();
diff --git a/fuchsia/runners/cast/main.cc b/fuchsia/runners/cast/main.cc index 0ae8229..2845fb3 100644 --- a/fuchsia/runners/cast/main.cc +++ b/fuchsia/runners/cast/main.cc
@@ -54,7 +54,8 @@ base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::RunLoop run_loop; - cr_fuchsia::RegisterCrashReportingFields(kComponentUrl, kCrashProductName); + cr_fuchsia::RegisterProductDataForCrashReporting(kComponentUrl, + kCrashProductName); base::CommandLine::Init(argc, argv); CHECK(cr_fuchsia::InitLoggingFromCommandLine(
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index 49c21672..c31161d0 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc
@@ -1823,112 +1823,128 @@ if (may_enable_chromium_color_buffer_float && !had_native_chromium_color_buffer_float_ext) { - static_assert(GL_RGBA32F_ARB == GL_RGBA32F && - GL_RGBA32F_EXT == GL_RGBA32F && - GL_RGB32F_ARB == GL_RGB32F && GL_RGB32F_EXT == GL_RGB32F, - "sized float internal format variations must match"); - // We don't check extension support beyond ARB_texture_float on desktop GL, - // and format support varies between GL configurations. For example, spec - // prior to OpenGL 3.0 mandates framebuffer support only for one - // implementation-chosen format, and ES3.0 EXT_color_buffer_float does not - // support rendering to RGB32F. Check for framebuffer completeness with - // formats that the extensions expose, and only enable an extension when a - // framebuffer created with its texture format is reported as complete. - GLint fb_binding = 0; - GLint tex_binding = 0; - glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fb_binding); - glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex_binding); - - GLuint tex_id = 0; - GLuint fb_id = 0; - GLsizei width = 16; - - glGenTextures(1, &tex_id); - glGenFramebuffersEXT(1, &fb_id); - glBindTexture(GL_TEXTURE_2D, tex_id); - // Nearest filter needed for framebuffer completeness on some drivers. - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, width, 0, GL_RGBA, - GL_FLOAT, nullptr); - glBindFramebufferEXT(GL_FRAMEBUFFER, fb_id); - glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, tex_id, 0); - GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB, GL_FLOAT, - nullptr); - GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); - base::UmaHistogramBoolean("GPU.RenderableFormat.RGBA32F.FLOAT", - status_rgba == GL_FRAMEBUFFER_COMPLETE); - base::UmaHistogramBoolean("GPU.RenderableFormat.RGB32F.FLOAT", - status_rgb == GL_FRAMEBUFFER_COMPLETE); - - // For desktop systems, check to see if we support rendering to the full - // range of formats supported by EXT_color_buffer_float - if (status_rgba == GL_FRAMEBUFFER_COMPLETE && enable_es3) { - bool full_float_support = true; - const GLenum kInternalFormats[] = { - GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_R11F_G11F_B10F, - }; - const GLenum kFormats[] = { - GL_RED, GL_RG, GL_RGBA, GL_RED, GL_RG, GL_RGB, - }; - const char* kInternalFormatHistogramNames[] = { - "GPU.RenderableFormat.R16F.FLOAT", - "GPU.RenderableFormat.RG16F.FLOAT", - "GPU.RenderableFormat.RGBA16F.FLOAT", - "GPU.RenderableFormat.R32F.FLOAT", - "GPU.RenderableFormat.RG32F.FLOAT", - "GPU.RenderableFormat.R11F_G11F_B10F.FLOAT", - }; - DCHECK_EQ(base::size(kInternalFormats), base::size(kFormats)); - for (size_t i = 0; i < base::size(kFormats); ++i) { - glTexImage2D(GL_TEXTURE_2D, 0, kInternalFormats[i], width, width, 0, - kFormats[i], GL_FLOAT, nullptr); - bool supported = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == - GL_FRAMEBUFFER_COMPLETE; - base::UmaHistogramBoolean(kInternalFormatHistogramNames[i], supported); - full_float_support &= supported; + if (workarounds_.force_enable_color_buffer_float) { + if (enable_es3) + enable_ext_color_buffer_float = true; + if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float && + gl_version_info_->IsAtLeastGL(3, 0)) { + enable_ext_color_buffer_half_float = true; } - enable_ext_color_buffer_float = full_float_support; - } - // Likewise for EXT_color_buffer_half_float on ES2 contexts. On desktop, - // require at least GL 3.0, to ensure that all formats are defined. - if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float && - (gl_version_info_->IsAtLeastGLES(3, 0) || - gl_version_info_->IsAtLeastGL(3, 0))) { - // EXT_color_buffer_half_float requires at least one of the formats is - // supported to be color-renderable. WebGL's extension requires RGBA16F - // to be the supported effective format. Here we only expose the extension - // if RGBA16F is color-renderable. - GLenum internal_format = GL_RGBA16F; - GLenum format = GL_RGBA; - GLenum data_type = GL_HALF_FLOAT; - glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, width, 0, format, - data_type, nullptr); - bool supported = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == - GL_FRAMEBUFFER_COMPLETE; - base::UmaHistogramBoolean("GPU.RenderableFormat.RGBA16F.HALF_FLOAT", - supported); - enable_ext_color_buffer_half_float = supported; - } - - glDeleteFramebuffersEXT(1, &fb_id); - glDeleteTextures(1, &tex_id); - - glBindFramebufferEXT(GL_FRAMEBUFFER, static_cast<GLuint>(fb_binding)); - glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(tex_binding)); - - DCHECK_EQ(glGetError(), static_cast<GLuint>(GL_NO_ERROR)); - - if (status_rgba == GL_FRAMEBUFFER_COMPLETE) { feature_flags_.chromium_color_buffer_float_rgba = true; if (!disallowed_features_.chromium_color_buffer_float_rgba) EnableCHROMIUMColorBufferFloatRGBA(); - } - if (status_rgb == GL_FRAMEBUFFER_COMPLETE) { feature_flags_.chromium_color_buffer_float_rgb = true; if (!disallowed_features_.chromium_color_buffer_float_rgb) EnableCHROMIUMColorBufferFloatRGB(); + } else { + static_assert( + GL_RGBA32F_ARB == GL_RGBA32F && GL_RGBA32F_EXT == GL_RGBA32F && + GL_RGB32F_ARB == GL_RGB32F && GL_RGB32F_EXT == GL_RGB32F, + "sized float internal format variations must match"); + // We don't check extension support beyond ARB_texture_float on desktop + // GL, and format support varies between GL configurations. For example, + // spec prior to OpenGL 3.0 mandates framebuffer support only for one + // implementation-chosen format, and ES3.0 EXT_color_buffer_float does not + // support rendering to RGB32F. Check for framebuffer completeness with + // formats that the extensions expose, and only enable an extension when a + // framebuffer created with its texture format is reported as complete. + GLint fb_binding = 0; + GLint tex_binding = 0; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fb_binding); + glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex_binding); + + GLuint tex_id = 0; + GLuint fb_id = 0; + GLsizei width = 16; + + glGenTextures(1, &tex_id); + glGenFramebuffersEXT(1, &fb_id); + glBindTexture(GL_TEXTURE_2D, tex_id); + // Nearest filter needed for framebuffer completeness on some drivers. + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, width, 0, GL_RGBA, + GL_FLOAT, nullptr); + glBindFramebufferEXT(GL_FRAMEBUFFER, fb_id); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, tex_id, 0); + GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB, + GL_FLOAT, nullptr); + GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); + base::UmaHistogramBoolean("GPU.RenderableFormat.RGBA32F.FLOAT", + status_rgba == GL_FRAMEBUFFER_COMPLETE); + base::UmaHistogramBoolean("GPU.RenderableFormat.RGB32F.FLOAT", + status_rgb == GL_FRAMEBUFFER_COMPLETE); + + // For desktop systems, check to see if we support rendering to the full + // range of formats supported by EXT_color_buffer_float + if (status_rgba == GL_FRAMEBUFFER_COMPLETE && enable_es3) { + bool full_float_support = true; + const GLenum kInternalFormats[] = { + GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_R11F_G11F_B10F, + }; + const GLenum kFormats[] = { + GL_RED, GL_RG, GL_RGBA, GL_RED, GL_RG, GL_RGB, + }; + const char* kInternalFormatHistogramNames[] = { + "GPU.RenderableFormat.R16F.FLOAT", + "GPU.RenderableFormat.RG16F.FLOAT", + "GPU.RenderableFormat.RGBA16F.FLOAT", + "GPU.RenderableFormat.R32F.FLOAT", + "GPU.RenderableFormat.RG32F.FLOAT", + "GPU.RenderableFormat.R11F_G11F_B10F.FLOAT", + }; + DCHECK_EQ(base::size(kInternalFormats), base::size(kFormats)); + for (size_t i = 0; i < base::size(kFormats); ++i) { + glTexImage2D(GL_TEXTURE_2D, 0, kInternalFormats[i], width, width, 0, + kFormats[i], GL_FLOAT, nullptr); + bool supported = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == + GL_FRAMEBUFFER_COMPLETE; + base::UmaHistogramBoolean(kInternalFormatHistogramNames[i], + supported); + full_float_support &= supported; + } + enable_ext_color_buffer_float = full_float_support; + } + // Likewise for EXT_color_buffer_half_float on ES2 contexts. On desktop, + // require at least GL 3.0, to ensure that all formats are defined. + if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float && + (gl_version_info_->IsAtLeastGLES(3, 0) || + gl_version_info_->IsAtLeastGL(3, 0))) { + // EXT_color_buffer_half_float requires at least one of the formats is + // supported to be color-renderable. WebGL's extension requires RGBA16F + // to be the supported effective format. Here we only expose the + // extension if RGBA16F is color-renderable. + GLenum internal_format = GL_RGBA16F; + GLenum format = GL_RGBA; + GLenum data_type = GL_HALF_FLOAT; + glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, width, 0, format, + data_type, nullptr); + bool supported = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == + GL_FRAMEBUFFER_COMPLETE; + base::UmaHistogramBoolean("GPU.RenderableFormat.RGBA16F.HALF_FLOAT", + supported); + enable_ext_color_buffer_half_float = supported; + } + + glDeleteFramebuffersEXT(1, &fb_id); + glDeleteTextures(1, &tex_id); + + glBindFramebufferEXT(GL_FRAMEBUFFER, static_cast<GLuint>(fb_binding)); + glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(tex_binding)); + + DCHECK_EQ(glGetError(), static_cast<GLuint>(GL_NO_ERROR)); + + if (status_rgba == GL_FRAMEBUFFER_COMPLETE) { + feature_flags_.chromium_color_buffer_float_rgba = true; + if (!disallowed_features_.chromium_color_buffer_float_rgba) + EnableCHROMIUMColorBufferFloatRGBA(); + } + if (status_rgb == GL_FRAMEBUFFER_COMPLETE) { + feature_flags_.chromium_color_buffer_float_rgb = true; + if (!disallowed_features_.chromium_color_buffer_float_rgb) + EnableCHROMIUMColorBufferFloatRGB(); + } } }
diff --git a/gpu/command_buffer/service/wrapped_sk_image.cc b/gpu/command_buffer/service/wrapped_sk_image.cc index 3db3040..72a75fb44 100644 --- a/gpu/command_buffer/service/wrapped_sk_image.cc +++ b/gpu/command_buffer/service/wrapped_sk_image.cc
@@ -56,7 +56,7 @@ context_state_->EraseCachedSkSurface(this); if (backend_texture_.isValid()) - DeleteGrBackendTexture(context_state_, &backend_texture_); + DeleteGrBackendTexture(context_state_.get(), &backend_texture_); DCHECK(context_state_->context_lost() || context_state_->IsCurrent(nullptr)); @@ -155,7 +155,7 @@ SkAlphaType alpha_type, uint32_t usage, size_t estimated_size, - SharedContextState* context_state) + scoped_refptr<SharedContextState> context_state) : ClearTrackingSharedImageBacking(mailbox, format, size, @@ -165,7 +165,7 @@ usage, estimated_size, false /* is_thread_safe */), - context_state_(context_state) { + context_state_(std::move(context_state)) { DCHECK(!!context_state_); } @@ -283,7 +283,7 @@ return true; } - SharedContextState* const context_state_; + scoped_refptr<SharedContextState> context_state_; GrBackendTexture backend_texture_; sk_sp<SkPromiseImageTexture> promise_texture_; @@ -355,8 +355,9 @@ } // namespace -WrappedSkImageFactory::WrappedSkImageFactory(SharedContextState* context_state) - : context_state_(context_state) {} +WrappedSkImageFactory::WrappedSkImageFactory( + scoped_refptr<SharedContextState> context_state) + : context_state_(std::move(context_state)) {} WrappedSkImageFactory::~WrappedSkImageFactory() = default;
diff --git a/gpu/command_buffer/service/wrapped_sk_image.h b/gpu/command_buffer/service/wrapped_sk_image.h index b0b8bc9..659ce4d1d 100644 --- a/gpu/command_buffer/service/wrapped_sk_image.h +++ b/gpu/command_buffer/service/wrapped_sk_image.h
@@ -24,7 +24,8 @@ class GPU_GLES2_EXPORT WrappedSkImageFactory : public gpu::SharedImageBackingFactory { public: - explicit WrappedSkImageFactory(SharedContextState* context_state); + explicit WrappedSkImageFactory( + scoped_refptr<SharedContextState> context_state); ~WrappedSkImageFactory() override; // SharedImageBackingFactory implementation: @@ -62,7 +63,7 @@ gfx::GpuMemoryBufferType memory_buffer_type) override; private: - SharedContextState* const context_state_; + scoped_refptr<SharedContextState> context_state_; DISALLOW_COPY_AND_ASSIGN(WrappedSkImageFactory); };
diff --git a/gpu/config/gpu_driver_bug_list.json b/gpu/config/gpu_driver_bug_list.json index 2d30149c..39362686 100644 --- a/gpu/config/gpu_driver_bug_list.json +++ b/gpu/config/gpu_driver_bug_list.json
@@ -3592,6 +3592,42 @@ "value": "24", "value2": "27" } + }, + { + "id": 355, + "cr_bugs": [1127387], + "description": "Always assume float formats are renderable on Mac Intel", + "os": { + "type": "macosx" + }, + "vendor_id": "0x8086", + "features": [ + "force_enable_color_buffer_float" + ] + }, + { + "id": 356, + "cr_bugs": [1127387], + "description": "Always assume float formats are renderable on Mac AMD", + "os": { + "type": "macosx" + }, + "vendor_id": "0x1002", + "features": [ + "force_enable_color_buffer_float" + ] + }, + { + "id": 357, + "cr_bugs": [1127387], + "description": "Always assume float formats are renderable on Mac Nvidia", + "os": { + "type": "macosx" + }, + "vendor_id": "0x10de", + "features": [ + "force_enable_color_buffer_float" + ] } ] }
diff --git a/gpu/config/gpu_workaround_list.txt b/gpu/config/gpu_workaround_list.txt index fc52c0ff..92351069 100644 --- a/gpu/config/gpu_workaround_list.txt +++ b/gpu/config/gpu_workaround_list.txt
@@ -68,6 +68,7 @@ flush_on_framebuffer_change force_cube_complete force_cube_map_positive_x_allocation +force_enable_color_buffer_float force_gl_flush_on_swap_buffers force_high_performance_gpu force_int_or_srgb_cube_texture_complete
diff --git a/infra/config/generated/commit-queue.cfg b/infra/config/generated/commit-queue.cfg index 4cb2a714..3a3c2ec 100644 --- a/infra/config/generated/commit-queue.cfg +++ b/infra/config/generated/commit-queue.cfg
@@ -239,10 +239,7 @@ } builders { name: "chromium/try/android-marshmallow-x86-rel" - experiment_percentage: 5 - location_regexp: ".*" - location_regexp_exclude: ".+/[+]/docs/.+" - location_regexp_exclude: ".+/[+]/infra/config/.+" + includable_only: true } builders { name: "chromium/try/android-marshmallow-x86-rel-non-cq" @@ -285,10 +282,7 @@ } builders { name: "chromium/try/android-pie-arm64-rel" - experiment_percentage: 60 - location_regexp: ".*" - location_regexp_exclude: ".+/[+]/docs/.+" - location_regexp_exclude: ".+/[+]/infra/config/.+" + includable_only: true } builders { name: "chromium/try/android-pie-arm64-wpt-rel-non-cq" @@ -578,10 +572,7 @@ } builders { name: "chromium/try/fuchsia-compile-x64-dbg" - experiment_percentage: 50 - location_regexp: ".*" - location_regexp_exclude: ".+/[+]/docs/.+" - location_regexp_exclude: ".+/[+]/infra/config/.+" + includable_only: true } builders { name: "chromium/try/fuchsia-fyi-arm64-dbg" @@ -893,10 +884,7 @@ } builders { name: "chromium/try/ios-simulator-code-coverage" - experiment_percentage: 3 - location_regexp: ".*" - location_regexp_exclude: ".+/[+]/docs/.+" - location_regexp_exclude: ".+/[+]/infra/config/.+" + includable_only: true } builders { name: "chromium/try/ios-simulator-cr-recipe" @@ -1063,14 +1051,7 @@ } builders { name: "chromium/try/linux-perfetto-rel" - experiment_percentage: 100 - location_regexp: ".+/[+]/base/trace_event/.+" - location_regexp: ".+/[+]/base/tracing/.+" - location_regexp: ".+/[+]/components/tracing/.+" - location_regexp: ".+/[+]/content/browser/tracing/.+" - location_regexp: ".+/[+]/services/tracing/.+" - location_regexp_exclude: ".+/[+]/docs/.+" - location_regexp_exclude: ".+/[+]/infra/config/.+" + includable_only: true } builders { name: "chromium/try/linux-rel" @@ -1080,10 +1061,7 @@ } builders { name: "chromium/try/linux-rel-builderful" - experiment_percentage: 10 - location_regexp: ".*" - location_regexp_exclude: ".+/[+]/docs/.+" - location_regexp_exclude: ".+/[+]/infra/config/.+" + includable_only: true } builders { name: "chromium/try/linux-swangle-chromium-try-x64" @@ -1287,10 +1265,7 @@ } builders { name: "chromium/try/mac-coverage-rel" - experiment_percentage: 8 - location_regexp: ".*" - location_regexp_exclude: ".+/[+]/docs/.+" - location_regexp_exclude: ".+/[+]/infra/config/.+" + includable_only: true } builders { name: "chromium/try/mac-dawn-rel" @@ -1869,10 +1844,7 @@ } builders { name: "chromium/try-m85/fuchsia_arm64" - experiment_percentage: 50 - location_regexp: ".*" - location_regexp_exclude: ".+/[+]/docs/.+" - location_regexp_exclude: ".+/[+]/infra/config/.+" + includable_only: true } builders { name: "chromium/try-m85/fuchsia_x64"
diff --git a/infra/config/generated/cq-builders.md b/infra/config/generated/cq-builders.md index e7d42c2..708f4ff 100644 --- a/infra/config/generated/cq-builders.md +++ b/infra/config/generated/cq-builders.md
@@ -347,8 +347,11 @@ by CQ. These are often used to test new configurations before they are added as required builders. +These builders are currently disabled due to the cq_disable_experiments outages +setting. See //infra/config/outages/README.md for more information. + * [android-marshmallow-x86-rel](https://ci.chromium.org/p/chromium/builders/try/android-marshmallow-x86-rel) ([definition](https://cs.chromium.org/search?q=package:%5Echromium$+file:/cq.star$+-file:/beta/+-file:/stable/+android-marshmallow-x86-rel)) ([matching builders](https://cs.chromium.org/search?q=+file:trybots.py+android-marshmallow-x86-rel)) - * Experiment percentage: 5 + * Experiment percentage: 20 * [android-pie-arm64-rel](https://ci.chromium.org/p/chromium/builders/try/android-pie-arm64-rel) ([definition](https://cs.chromium.org/search?q=package:%5Echromium$+file:/cq.star$+-file:/beta/+-file:/stable/+android-pie-arm64-rel)) ([matching builders](https://cs.chromium.org/search?q=+file:trybots.py+android-pie-arm64-rel)) * Experiment percentage: 60
diff --git a/infra/config/generated/cr-buildbucket.cfg b/infra/config/generated/cr-buildbucket.cfg index fc38ff4..44dff49 100644 --- a/infra/config/generated/cr-buildbucket.cfg +++ b/infra/config/generated/cr-buildbucket.cfg
@@ -345,7 +345,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -1418,14 +1418,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1447,14 +1447,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1476,14 +1476,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1505,14 +1505,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1588,14 +1588,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1617,14 +1617,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1646,14 +1646,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1675,14 +1675,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1791,14 +1791,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1820,14 +1820,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1849,14 +1849,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1878,14 +1878,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1965,14 +1965,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -1994,14 +1994,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -2023,14 +2023,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -2052,14 +2052,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -2397,7 +2397,6 @@ swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" dimensions: "builder:GPU FYI Mac Builder" - dimensions: "cores:4" dimensions: "cpu:x86-64" dimensions: "os:Mac" dimensions: "pool:luci.chromium.ci" @@ -2425,7 +2424,6 @@ swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" dimensions: "builder:GPU FYI Mac Builder (dbg)" - dimensions: "cores:4" dimensions: "cpu:x86-64" dimensions: "os:Mac" dimensions: "pool:luci.chromium.ci" @@ -2453,7 +2451,6 @@ swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" dimensions: "builder:GPU FYI Mac dEQP Builder" - dimensions: "cores:4" dimensions: "cpu:x86-64" dimensions: "os:Mac" dimensions: "pool:luci.chromium.ci" @@ -3695,14 +3692,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -3724,7 +3721,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -3753,7 +3750,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -3782,7 +3779,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -3840,7 +3837,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -3869,7 +3866,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -3898,7 +3895,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -3927,7 +3924,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -3956,7 +3953,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -4014,7 +4011,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -4043,7 +4040,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -4072,7 +4069,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -4101,7 +4098,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -4275,14 +4272,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -4814,14 +4811,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -4843,7 +4840,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -4872,7 +4869,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -4901,7 +4898,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -4930,7 +4927,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -4956,7 +4953,6 @@ swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" dimensions: "builder:Mac FYI GPU ASAN Release" - dimensions: "cores:4" dimensions: "cpu:x86-64" dimensions: "os:Mac" dimensions: "pool:luci.chromium.ci" @@ -4987,7 +4983,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -5016,7 +5012,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -5045,7 +5041,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -5074,7 +5070,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -5103,7 +5099,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -5129,7 +5125,6 @@ swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" dimensions: "builder:Mac FYI arm64 Release (Apple DTK)" - dimensions: "cores:8" dimensions: "cpu:x86-64" dimensions: "os:Mac" dimensions: "pool:luci.chromium.ci" @@ -5160,7 +5155,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -5189,7 +5184,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -5218,7 +5213,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -5247,14 +5242,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -5276,14 +5271,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -5305,14 +5300,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -7269,7 +7264,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7298,7 +7293,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7327,7 +7322,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7356,7 +7351,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7385,7 +7380,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7414,7 +7409,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7443,7 +7438,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7472,7 +7467,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7501,7 +7496,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7530,7 +7525,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7559,7 +7554,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7617,7 +7612,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7646,7 +7641,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7675,7 +7670,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7704,7 +7699,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7845,14 +7840,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -7874,14 +7869,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -7931,7 +7926,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7960,7 +7955,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -7989,7 +7984,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -8018,7 +8013,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -8047,7 +8042,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -8076,7 +8071,7 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" @@ -10163,11 +10158,11 @@ cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.fyi\",\"recipe\":\"chromium\",\"xcode_build_version\":\"12a7209\"}" + properties: "{\"$build/goma\":{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.fyi\",\"recipe\":\"chromium\",\"xcode_build_version\":\"12b5018i\"}" execution_timeout_secs: 36000 caches { - name: "xcode_ios_12a7209" - path: "xcode_ios_12a7209.app" + name: "xcode_ios_12b5018i" + path: "xcode_ios_12b5018i.app" } build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -11655,7 +11650,6 @@ swarming_host: "chromium-swarm.appspot.com" swarming_tags: "vpython:native-python-wrapper" dimensions: "builder:mac-swangle-chromium-x64" - dimensions: "cores:4" dimensions: "cpu:x86-64" dimensions: "os:Mac" dimensions: "pool:luci.chromium.ci" @@ -12992,14 +12986,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13021,14 +13015,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13077,14 +13071,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13106,14 +13100,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13164,14 +13158,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13193,14 +13187,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13251,14 +13245,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13280,14 +13274,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.dawn\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13684,14 +13678,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13883,14 +13877,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -13912,14 +13906,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -14372,14 +14366,14 @@ dimensions: "cores:2" dimensions: "cpu:x86-64" dimensions: "os:Ubuntu-16.04" - dimensions: "pool:luci.chromium.ci" + dimensions: "pool:luci.chromium.gpu.ci" dimensions: "ssd:0" exe { cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build" cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"enable_ats\":true,\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" + properties: "{\"$build/chromium_tests\":{\"bucketed_triggers\":true},\"$build/goma\":{\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"chromium.gpu\",\"recipe\":\"chromium\"}" execution_timeout_secs: 10800 build_numbers: YES service_account: "chromium-ci-builder@chops-service-accounts.iam.gserviceaccount.com" @@ -22686,7 +22680,7 @@ cipd_version: "refs/heads/master" cmd: "recipes" } - properties: "{\"$build/goma\":{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"tryserver.chromium.mac\",\"recipe\":\"chromium_trybot\",\"xcode_build_version\":\"12a7209\"}" + properties: "{\"$build/goma\":{\"rpc_extra_params\":\"?prod\",\"server_host\":\"goma.chromium.org\",\"use_luci_auth\":true},\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"$recipe_engine/isolated\":{\"server\":\"https://isolateserver.appspot.com\"},\"builder_group\":\"tryserver.chromium.mac\",\"recipe\":\"chromium_trybot\",\"xcode_build_version\":\"12b5018i\"}" execution_timeout_secs: 14400 expiration_secs: 7200 caches { @@ -22694,8 +22688,8 @@ path: "win_toolchain" } caches { - name: "xcode_ios_12a7209" - path: "xcode_ios_12a7209.app" + name: "xcode_ios_12b5018i" + path: "xcode_ios_12b5018i.app" } build_numbers: YES service_account: "chromium-try-builder@chops-service-accounts.iam.gserviceaccount.com"
diff --git a/infra/config/generated/tricium-prod.cfg b/infra/config/generated/tricium-prod.cfg index daa23d9a..cb38c13 100644 --- a/infra/config/generated/tricium-prod.cfg +++ b/infra/config/generated/tricium-prod.cfg
@@ -65,11 +65,6 @@ # Selections (enabled functions) selections { - function: "ClangTidy" - platform: LINUX -} - -selections { function: "GitFileIsolator" platform: UBUNTU } @@ -80,11 +75,6 @@ } selections { - function: "Metrics" - platform: UBUNTU -} - -selections { function: "MojomCommentator" platform: UBUNTU }
diff --git a/infra/config/lib/builders.star b/infra/config/lib/builders.star index 7777fc5..7271119 100644 --- a/infra/config/lib/builders.star +++ b/infra/config/lib/builders.star
@@ -137,6 +137,8 @@ x11e608cwk = xcode_enum("xcode_ios_11e608cwk", "xcode_ios_11e608cwk.app"), # (current default) xc12 gm seed x12a7209 = xcode_enum("xcode_ios_12a7209", "xcode_ios_12a7209.app"), + # Xcode 12.2 beta 1 + x12b5018i = xcode_enum("xcode_ios_12b5018i", "xcode_ios_12b5018i.app"), ) ################################################################################
diff --git a/infra/config/lib/ci.star b/infra/config/lib/ci.star index 41c02ac..b4a1f0e 100644 --- a/infra/config/lib/ci.star +++ b/infra/config/lib/ci.star
@@ -598,20 +598,58 @@ **kwargs ) -def dawn_builder(*, name, builderless = True, **kwargs): +def dawn_builder(*, name, **kwargs): return ci.builder( name = name, builder_group = "chromium.dawn", - builderless = builderless, - goma_backend = builders.goma.backend.RBE_PROD, service_account = "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com", **kwargs ) +def dawn_linux_builder( + *, + name, + goma_backend = builders.goma.backend.RBE_PROD, + **kwargs): + return dawn_builder( + name = name, + builderless = True, + goma_backend = goma_backend, + os = builders.os.LINUX_DEFAULT, + pool = "luci.chromium.gpu.ci", + **kwargs + ) + +def dawn_mac_builder(*, name, **kwargs): + return dawn_builder( + name = name, + builderless = False, + cores = None, + goma_backend = builders.goma.backend.RBE_PROD, + os = builders.os.MAC_ANY, + **kwargs + ) + +# Many of the GPU testers are thin testers, they use linux VMS regardless of the +# actual OS that the tests are built for +def dawn_thin_tester( + *, + name, + **kwargs): + return dawn_linux_builder( + name = name, + cores = 2, + # Setting goma_backend for testers is a no-op, but better to be explicit + goma_backend = None, + **kwargs + ) + def dawn_windows_builder(*, name, **kwargs): return dawn_builder( name = name, + builderless = True, + goma_backend = builders.goma.backend.RBE_PROD, os = builders.os.WINDOWS_ANY, pool = "luci.chromium.gpu.ci", **kwargs @@ -745,20 +783,21 @@ name, execution_timeout = 6 * time.hour, goma_backend = builders.goma.backend.RBE_PROD, - pool = "luci.chromium.gpu.ci", **kwargs): return gpu_fyi_builder( name = name, execution_timeout = execution_timeout, goma_backend = goma_backend, - pool = pool, + os = builders.os.LINUX_DEFAULT, + pool = "luci.chromium.gpu.ci", **kwargs ) -def gpu_fyi_mac_builder(*, name, cores = 4, **kwargs): +def gpu_fyi_mac_builder(*, name, **kwargs): return gpu_fyi_builder( name = name, - cores = cores, + builderless = False, + cores = None, execution_timeout = 6 * time.hour, goma_backend = builders.goma.backend.RBE_PROD, os = builders.os.MAC_ANY, @@ -779,7 +818,6 @@ # Setting goma_backend for testers is a no-op, but better to be explicit # here and also leave the generated configs unchanged for these testers. goma_backend = None, - pool = "luci.chromium.ci", **kwargs ) @@ -793,28 +831,60 @@ **kwargs ) -def gpu_builder(*, name, tree_closing = True, notifies = None, pool = "luci.chromium.gpu.ci", **kwargs): +def gpu_builder(*, name, tree_closing = True, notifies = None, **kwargs): if tree_closing: notifies = (notifies or []) + ["gpu-tree-closer-email"] return ci.builder( name = name, builder_group = "chromium.gpu", - goma_backend = builders.goma.backend.RBE_PROD, tree_closing = tree_closing, notifies = notifies, - pool = pool, + **kwargs + ) + +def gpu_linux_builder( + *, + name, + goma_backend = builders.goma.backend.RBE_PROD, + **kwargs): + return gpu_builder( + name = name, + builderless = True, + goma_backend = goma_backend, + os = builders.os.LINUX_DEFAULT, + pool = "luci.chromium.gpu.ci", + **kwargs + ) + +def gpu_mac_builder(*, name, **kwargs): + return gpu_builder( + name = name, + builderless = False, + cores = None, + goma_backend = builders.goma.backend.RBE_PROD, + os = builders.os.MAC_ANY, **kwargs ) # Many of the GPU testers are thin testers, they use linux VMS regardless of the # actual OS that the tests are built for def gpu_thin_tester(*, name, tree_closing = True, **kwargs): - return gpu_builder( + return gpu_linux_builder( name = name, cores = 2, - os = builders.os.LINUX_DEFAULT, tree_closing = tree_closing, - pool = "luci.chromium.ci", + # Setting goma_backend for testers is a no-op, but better to be explicit + goma_backend = None, + **kwargs + ) + +def gpu_windows_builder(*, name, **kwargs): + return gpu_builder( + name = name, + builderless = True, + goma_backend = builders.goma.backend.RBE_PROD, + os = builders.os.WINDOWS_ANY, + pool = "luci.chromium.gpu.ci", **kwargs ) @@ -944,7 +1014,7 @@ return swangle_builder( name = name, builderless = False, - cores = 4, + cores = None, goma_backend = builders.goma.backend.RBE_PROD, os = builders.os.MAC_ANY, **kwargs @@ -1005,7 +1075,9 @@ chromiumos_builder = chromiumos_builder, clang_builder = clang_builder, clang_mac_builder = clang_mac_builder, - dawn_builder = dawn_builder, + dawn_linux_builder = dawn_linux_builder, + dawn_mac_builder = dawn_mac_builder, + dawn_thin_tester = dawn_thin_tester, dawn_windows_builder = dawn_windows_builder, fuzz_builder = fuzz_builder, fuzz_libfuzzer_builder = fuzz_libfuzzer_builder, @@ -1019,8 +1091,10 @@ gpu_fyi_mac_builder = gpu_fyi_mac_builder, gpu_fyi_thin_tester = gpu_fyi_thin_tester, gpu_fyi_windows_builder = gpu_fyi_windows_builder, - gpu_builder = gpu_builder, + gpu_linux_builder = gpu_linux_builder, + gpu_mac_builder = gpu_mac_builder, gpu_thin_tester = gpu_thin_tester, + gpu_windows_builder = gpu_windows_builder, linux_builder = linux_builder, mac_builder = mac_builder, mac_ios_builder = mac_ios_builder,
diff --git a/infra/config/outages/config.star b/infra/config/outages/config.star index 423dfc2..3c6802c 100644 --- a/infra/config/outages/config.star +++ b/infra/config/outages/config.star
@@ -9,4 +9,5 @@ # See README.md for documentation on allowable configuration values config = _outages_config( + disable_cq_experiments = True, )
diff --git a/infra/config/subprojects/chromium/ci.star b/infra/config/subprojects/chromium/ci.star index 7ce67c3..d0f3be2c 100644 --- a/infra/config/subprojects/chromium/ci.star +++ b/infra/config/subprojects/chromium/ci.star
@@ -1554,16 +1554,15 @@ executable = "recipe:chromium_clang_coverage_tot", ) -ci.dawn_builder( +ci.dawn_linux_builder( name = "Dawn Linux x64 Builder", console_view_entry = ci.console_view_entry( category = "ToT|Linux|Builder", short_name = "x64", ), - pool = "luci.chromium.gpu.ci", ) -ci.dawn_builder( +ci.dawn_linux_builder( name = "Dawn Linux x64 DEPS Builder", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( @@ -1572,133 +1571,110 @@ ), cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - pool = "luci.chromium.gpu.ci", ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Linux x64 DEPS Release (Intel HD 630)", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( category = "DEPS|Linux|Intel", short_name = "x64", ), - cores = 2, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Linux x64 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Linux x64 DEPS Release (NVIDIA)", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( category = "DEPS|Linux|Nvidia", short_name = "x64", ), - cores = 2, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Linux x64 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Linux x64 Release (Intel HD 630)", console_view_entry = ci.console_view_entry( category = "ToT|Linux|Intel", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = ["Dawn Linux x64 Builder"], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Linux x64 Release (NVIDIA)", console_view_entry = ci.console_view_entry( category = "ToT|Linux|Nvidia", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = ["Dawn Linux x64 Builder"], ) -ci.dawn_builder( +ci.dawn_mac_builder( name = "Dawn Mac x64 Builder", console_view_entry = ci.console_view_entry( category = "ToT|Mac|Builder", short_name = "x64", ), - builderless = False, - cores = None, - os = os.MAC_ANY, ) -ci.dawn_builder( +ci.dawn_mac_builder( name = "Dawn Mac x64 DEPS Builder", branch_selector = branches.STANDARD_RELEASES, - builderless = False, console_view_entry = ci.console_view_entry( category = "DEPS|Mac|Builder", short_name = "x64", ), - cores = None, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.MAC_ANY, ) # Note that the Mac testers are all thin Linux VMs, triggering jobs on the # physical Mac hardware in the Swarming pool which is why they run on linux -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Mac x64 DEPS Release (AMD)", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( category = "DEPS|Mac|AMD", short_name = "x64", ), - cores = 2, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Mac x64 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Mac x64 DEPS Release (Intel)", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( category = "DEPS|Mac|Intel", short_name = "x64", ), - cores = 2, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Mac x64 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Mac x64 Release (AMD)", console_view_entry = ci.console_view_entry( category = "ToT|Mac|AMD", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = ["Dawn Mac x64 Builder"], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Mac x64 Release (Intel)", console_view_entry = ci.console_view_entry( category = "ToT|Mac|Intel", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = ["Dawn Mac x64 Builder"], ) @@ -1729,55 +1705,47 @@ main_console_view = main_console_if_on_branch(), ) -ci.dawn_builder( +# Note that the Win testers are all thin Linux VMs, triggering jobs on the +# physical Win hardware in the Swarming pool, which is why they run on linux +ci.dawn_thin_tester( name = "Dawn Win10 x64 DEPS Release (Intel HD 630)", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( category = "DEPS|Windows|Intel", short_name = "x64", ), - cores = 2, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Win10 x64 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x64 DEPS Release (NVIDIA)", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( category = "DEPS|Windows|Nvidia", short_name = "x64", ), - cores = 2, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Win10 x64 DEPS Builder")], ) -# Note that the Win testers are all thin Linux VMs, triggering jobs on the -# physical Win hardware in the Swarming pool, which is why they run on linux -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x64 Release (Intel HD 630)", console_view_entry = ci.console_view_entry( category = "ToT|Windows|Intel", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = ["Dawn Win10 x64 Builder"], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x64 Release (NVIDIA)", console_view_entry = ci.console_view_entry( category = "ToT|Windows|Nvidia", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = ["Dawn Win10 x64 Builder"], ) @@ -1800,55 +1768,47 @@ main_console_view = main_console_if_on_branch(), ) -ci.dawn_builder( +# Note that the Win testers are all thin Linux VMs, triggering jobs on the +# physical Win hardware in the Swarming pool, which is why they run on linux +ci.dawn_thin_tester( name = "Dawn Win10 x86 DEPS Release (Intel HD 630)", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( category = "DEPS|Windows|Intel", short_name = "x86", ), - cores = 2, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Win10 x86 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x86 DEPS Release (NVIDIA)", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( category = "DEPS|Windows|Nvidia", short_name = "x86", ), - cores = 2, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Win10 x86 DEPS Builder")], ) -# Note that the Win testers are all thin Linux VMs, triggering jobs on the -# physical Win hardware in the Swarming pool, which is why they run on linux -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x86 Release (Intel HD 630)", console_view_entry = ci.console_view_entry( category = "ToT|Windows|Intel", short_name = "x86", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = ["Dawn Win10 x86 Builder"], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x86 Release (NVIDIA)", console_view_entry = ci.console_view_entry( category = "ToT|Windows|Nvidia", short_name = "x86", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = ["Dawn Win10 x86 Builder"], ) @@ -2869,6 +2829,10 @@ category = "iOS|iOS14", short_name = "sdk14", ), + caches = [xcode_cache.x12b5018i], + properties = { + "xcode_build_version": "12b5018i", + }, ) ci.fyi_mac_builder( @@ -2974,7 +2938,7 @@ notifies = ["annotator-rel"], ) -ci.gpu_builder( +ci.gpu_linux_builder( name = "Android Release (Nexus 5X)", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( @@ -2984,7 +2948,7 @@ main_console_view = main_console_if_on_branch(), ) -ci.gpu_builder( +ci.gpu_linux_builder( name = "GPU Linux Builder", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( @@ -2994,7 +2958,7 @@ main_console_view = main_console_if_on_branch(), ) -ci.gpu_builder( +ci.gpu_linux_builder( name = "GPU Linux Builder (dbg)", console_view_entry = ci.console_view_entry( category = "Linux", @@ -3002,49 +2966,39 @@ tree_closing = False, ) -ci.gpu_builder( +ci.gpu_mac_builder( name = "GPU Mac Builder", branch_selector = branches.STANDARD_RELEASES, console_view_entry = ci.console_view_entry( category = "Mac", ), - cores = None, cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.MAC_ANY, - pool = "luci.chromium.ci", ) -ci.gpu_builder( +ci.gpu_mac_builder( name = "GPU Mac Builder (dbg)", console_view_entry = ci.console_view_entry( category = "Mac", ), - cores = None, - os = os.MAC_ANY, - pool = "luci.chromium.ci", tree_closing = False, ) -ci.gpu_builder( +ci.gpu_windows_builder( name = "GPU Win x64 Builder", branch_selector = branches.STANDARD_RELEASES, - builderless = True, console_view_entry = ci.console_view_entry( category = "Windows", ), cq_mirrors_console_view = settings.cq_mirrors_console_name, main_console_view = main_console_if_on_branch(), - os = os.WINDOWS_ANY, ) -ci.gpu_builder( +ci.gpu_windows_builder( name = "GPU Win x64 Builder (dbg)", - builderless = True, console_view_entry = ci.console_view_entry( category = "Windows", ), - os = os.WINDOWS_ANY, tree_closing = False, ) @@ -3328,7 +3282,6 @@ category = "Mac", short_name = "dtk", ), - cores = 8, ) ci.gpu_fyi_mac_builder(
diff --git a/infra/config/subprojects/chromium/try.star b/infra/config/subprojects/chromium/try.star index dabd95c..1b065736 100644 --- a/infra/config/subprojects/chromium/try.star +++ b/infra/config/subprojects/chromium/try.star
@@ -265,7 +265,7 @@ goma_jobs = goma.jobs.J300, ssd = True, tryjob = try_.job( - experiment_percentage = 5, + experiment_percentage = 20, ), ) @@ -1298,6 +1298,10 @@ try_.chromium_mac_ios_builder( name = "ios14-sdk-simulator", + caches = [xcode_cache.x12b5018i], + properties = { + "xcode_build_version": "12b5018i", + }, ) try_.chromium_win_builder(
diff --git a/infra/config/subprojects/chromium/versioned/m85/buckets/ci.star b/infra/config/subprojects/chromium/versioned/m85/buckets/ci.star index ad1b68f..e7dda32 100644 --- a/infra/config/subprojects/chromium/versioned/m85/buckets/ci.star +++ b/infra/config/subprojects/chromium/versioned/m85/buckets/ci.star
@@ -300,69 +300,57 @@ ), ) -ci.dawn_builder( +ci.dawn_linux_builder( name = "Dawn Linux x64 DEPS Builder", console_view_entry = ci.console_view_entry( category = "DEPS|Linux|Builder", short_name = "x64", ), - pool = "luci.chromium.gpu.ci", ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Linux x64 DEPS Release (Intel HD 630)", console_view_entry = ci.console_view_entry( category = "DEPS|Linux|Intel", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Linux x64 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Linux x64 DEPS Release (NVIDIA)", console_view_entry = ci.console_view_entry( category = "DEPS|Linux|Nvidia", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Linux x64 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_mac_builder( name = "Dawn Mac x64 DEPS Builder", - builderless = False, console_view_entry = ci.console_view_entry( category = "DEPS|Mac|Builder", short_name = "x64", ), - cores = None, - os = os.MAC_ANY, ) # Note that the Mac testers are all thin Linux VMs, triggering jobs on the # physical Mac hardware in the Swarming pool which is why they run on linux -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Mac x64 DEPS Release (AMD)", console_view_entry = ci.console_view_entry( category = "DEPS|Mac|AMD", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Mac x64 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Mac x64 DEPS Release (Intel)", console_view_entry = ci.console_view_entry( category = "DEPS|Mac|Intel", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Mac x64 DEPS Builder")], ) @@ -374,25 +362,21 @@ ), ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x64 DEPS Release (Intel HD 630)", console_view_entry = ci.console_view_entry( category = "DEPS|Windows|Intel", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Win10 x64 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x64 DEPS Release (NVIDIA)", console_view_entry = ci.console_view_entry( category = "DEPS|Windows|Nvidia", short_name = "x64", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Win10 x64 DEPS Builder")], ) @@ -404,25 +388,21 @@ ), ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x86 DEPS Release (Intel HD 630)", console_view_entry = ci.console_view_entry( category = "DEPS|Windows|Intel", short_name = "x86", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Win10 x86 DEPS Builder")], ) -ci.dawn_builder( +ci.dawn_thin_tester( name = "Dawn Win10 x86 DEPS Release (NVIDIA)", console_view_entry = ci.console_view_entry( category = "DEPS|Windows|Nvidia", short_name = "x86", ), - cores = 2, - os = os.LINUX_DEFAULT, triggered_by = [builder_name("Dawn Win10 x86 DEPS Builder")], ) @@ -446,37 +426,32 @@ }, ) -ci.gpu_builder( +ci.gpu_linux_builder( name = "Android Release (Nexus 5X)", console_view_entry = ci.console_view_entry( category = "Android", ), ) -ci.gpu_builder( +ci.gpu_linux_builder( name = "GPU Linux Builder", console_view_entry = ci.console_view_entry( category = "Linux", ), ) -ci.gpu_builder( +ci.gpu_mac_builder( name = "GPU Mac Builder", console_view_entry = ci.console_view_entry( category = "Mac", ), - cores = None, - os = os.MAC_ANY, - pool = "luci.chromium.ci", ) -ci.gpu_builder( +ci.gpu_windows_builder( name = "GPU Win x64 Builder", - builderless = True, console_view_entry = ci.console_view_entry( category = "Windows", ), - os = os.WINDOWS_ANY, ) ci.gpu_thin_tester(
diff --git a/infra/config/tricium-prod.cfg b/infra/config/tricium-prod.cfg index daa23d9a..cb38c13 100644 --- a/infra/config/tricium-prod.cfg +++ b/infra/config/tricium-prod.cfg
@@ -65,11 +65,6 @@ # Selections (enabled functions) selections { - function: "ClangTidy" - platform: LINUX -} - -selections { function: "GitFileIsolator" platform: UBUNTU } @@ -80,11 +75,6 @@ } selections { - function: "Metrics" - platform: UBUNTU -} - -selections { function: "MojomCommentator" platform: UBUNTU }
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm index 890a58a..14b2a1d9 100644 --- a/ios/chrome/app/main_controller.mm +++ b/ios/chrome/app/main_controller.mm
@@ -469,8 +469,16 @@ // browser state. BOOL needRestoration = NO; if (isPostCrashLaunch) { - needRestoration = [CrashRestoreHelper - moveAsideSessionInformationForBrowserState:chromeBrowserState]; + if (IsMultiwindowSupported()) { + NSSet<NSString*>* sessions = + [[PreviousSessionInfo sharedInstance] connectedSceneSessionsIDs]; + needRestoration = + [CrashRestoreHelper moveAsideSessions:sessions + forBrowserState:chromeBrowserState]; + } else { + needRestoration = [CrashRestoreHelper + moveAsideSessionInformationForBrowserState:chromeBrowserState]; + } } [[PreviousSessionInfo sharedInstance] resetConnectedSceneSessionIDs];
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index eb370ba..4cba72f2 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -2632,6 +2632,12 @@ <message name="IDS_IOS_UI_BLOCKED_USE_OTHER_WINDOW_SWITCH_WINDOW_ACTION" desc="Button label that appears on a button to switch to some other window, when the user has multiple windows open, and one window is showing a dialog that has to be interacted with before any other window can be used."> Switch to Open Window </message> + <message name="IDS_IOS_APP_SWITCHER_SCENE_TITLE" desc="Shown under the Application title in the OS-level app switcher with the number of tabs in the window"> + {count, plural, + =0 {{domain}} + =1 {{domain} and 1 other} + other {{domain} and {count} others}} + </message> </messages> </release> </grit>
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_APP_SWITCHER_SCENE_TITLE.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_APP_SWITCHER_SCENE_TITLE.png.sha1 new file mode 100644 index 0000000..239aeee --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_APP_SWITCHER_SCENE_TITLE.png.sha1
@@ -0,0 +1 @@ +0d6a392c1f8ef7d04ce5ccfb4d543d84ee5df0d2 \ No newline at end of file
diff --git a/ios/chrome/browser/autofill/automation/automation_egtest.mm b/ios/chrome/browser/autofill/automation/automation_egtest.mm index aa6d16d8..a024dbd7 100644 --- a/ios/chrome/browser/autofill/automation/automation_egtest.mm +++ b/ios/chrome/browser/autofill/automation/automation_egtest.mm
@@ -22,9 +22,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(AutomationAppInterface) -#endif // defined(CHROME_EARL_GREY_2) namespace {
diff --git a/ios/chrome/browser/autofill/js_autofill_manager_unittest.mm b/ios/chrome/browser/autofill/js_autofill_manager_unittest.mm index de6110f..e562f07 100644 --- a/ios/chrome/browser/autofill/js_autofill_manager_unittest.mm +++ b/ios/chrome/browser/autofill/js_autofill_manager_unittest.mm
@@ -24,6 +24,7 @@ #error "This file requires ARC support." #endif +using autofill::FieldRendererId; using base::SysNSStringToUTF8; namespace { @@ -507,9 +508,16 @@ } } -// Tests form filling (fillForm:forceFillIdentifier:inFrame:completionHandler:) -// method. +// Tests form filling (fillForm:forceFillFieldIdentifier:forceFillFieldUniqueID: +// :inFrame:completionHandler:) method. +// TODO(crbug/1131038): Remove once using only renderer IDs is launched. TEST_F(JsAutofillManagerTest, FillForm) { + base::test::ScopedFeatureList scoped_feature_list; + std::vector<base::Feature> disabled_features; + disabled_features.push_back( + autofill::features::kAutofillUseUniqueRendererIDsOnIOS); + scoped_feature_list.InitWithFeatures({}, disabled_features); + LoadHtml(@"<html><body><form name='testform' method='post'>" "<input type='text' id='firstname' name='firstname'/>" "<input type='email' id='email' name='email'/>" @@ -538,6 +546,58 @@ __block BOOL block_was_called = NO; [manager_ fillForm:std::move(autofillData) forceFillFieldIdentifier:@"firstname" + forceFillFieldUniqueID:FieldRendererId(1) + inFrame:main_web_frame() + completionHandler:^(NSString* result) { + filling_result = [result copy]; + block_was_called = YES; + }]; + EXPECT_TRUE(base::test::ios::WaitUntilConditionOrTimeout( + base::test::ios::kWaitForActionTimeout, ^bool() { + return block_was_called; + })); + EXPECT_NSEQ(@"{\"1\":\"Cool User\",\"2\":\"coolemail@com\"}", filling_result); +} + +// Tests form filling (fillForm:forceFillFieldIdentifier:forceFillFieldUniqueID: +// :inFrame:completionHandler:) method. +TEST_F(JsAutofillManagerTest, FillFormUsingRendererIDs) { + base::test::ScopedFeatureList scoped_feature_list; + std::vector<base::Feature> enabled_features; + enabled_features.push_back( + autofill::features::kAutofillUseUniqueRendererIDsOnIOS); + scoped_feature_list.InitWithFeatures(enabled_features, {}); + + LoadHtml(@"<html><body><form name='testform' method='post'>" + "<input type='text' id='firstname' name='firstname'/>" + "<input type='email' id='email' name='email'/>" + "</form></body></html>"); + RunFormsSearch(); + + auto autofillData = std::make_unique<base::DictionaryValue>(); + autofillData->SetKey("formName", base::Value("testform")); + autofillData->SetKey("formRendererID", base::Value(0)); + + base::Value fieldsData(base::Value::Type::DICTIONARY); + base::Value firstFieldData(base::Value::Type::DICTIONARY); + firstFieldData.SetStringKey("name", "firstname"); + firstFieldData.SetStringKey("identifier", "firstname"); + firstFieldData.SetStringKey("value", "Cool User"); + fieldsData.SetKey("1", std::move(firstFieldData)); + + base::Value secondFieldData(base::Value::Type::DICTIONARY); + secondFieldData.SetStringKey("name", "email"); + secondFieldData.SetStringKey("identifier", "email"); + secondFieldData.SetStringKey("value", "coolemail@com"); + fieldsData.SetKey("2", std::move(secondFieldData)); + + autofillData->SetKey("fields", std::move(fieldsData)); + + __block NSString* filling_result = nil; + __block BOOL block_was_called = NO; + [manager_ fillForm:std::move(autofillData) + forceFillFieldIdentifier:@"firstname" + forceFillFieldUniqueID:FieldRendererId(1) inFrame:main_web_frame() completionHandler:^(NSString* result) { filling_result = [result copy];
diff --git a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm index 89b555e6..299679c3 100644 --- a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm +++ b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm
@@ -295,7 +295,11 @@ web::WebThread::IO, base::TaskShutdownBehavior::BLOCK_SHUTDOWN}; if (IsRemoveDataMaskSet(mask, BrowsingDataRemoveMask::REMOVE_COOKIES)) { - base::RecordAction(base::UserMetricsAction("ClearBrowsingData_Cookies")); + if (!browser_state_->IsOffTheRecord()) { + // ClearBrowsingData_Cookies should not be reported when cookies are + // cleared as part of an incognito browser shutdown. + base::RecordAction(base::UserMetricsAction("ClearBrowsingData_Cookies")); + } net::CookieDeletionInfo::TimeRange deletion_time_range = net::CookieDeletionInfo::TimeRange(delete_begin, delete_end); base::PostTask(
diff --git a/ios/chrome/browser/crash_report/BUILD.gn b/ios/chrome/browser/crash_report/BUILD.gn index f358caf..af41753 100644 --- a/ios/chrome/browser/crash_report/BUILD.gn +++ b/ios/chrome/browser/crash_report/BUILD.gn
@@ -75,6 +75,7 @@ "//ios/chrome/browser/sessions:serialisation", "//ios/chrome/browser/sessions:session_service", "//ios/chrome/browser/ui/infobars:feature_flags", + "//ios/chrome/browser/ui/main:scene_state_header", "//ios/chrome/browser/ui/util:multiwindow_util", "//ios/chrome/browser/web:tab_id_tab_helper", "//ios/chrome/browser/web_state_list", @@ -108,6 +109,7 @@ "//ios/chrome/browser/metrics:previous_session_info", "//ios/chrome/browser/sessions:serialisation", "//ios/chrome/browser/sessions:session_service", + "//ios/chrome/browser/ui/util:multiwindow_util", "//ios/chrome/browser/web_state_list:test_support", "//ios/chrome/browser/web_state_list:web_state_list", "//ios/chrome/test/ocmock",
diff --git a/ios/chrome/browser/crash_report/crash_restore_helper.h b/ios/chrome/browser/crash_report/crash_restore_helper.h index 9e61c58..e956de5 100644 --- a/ios/chrome/browser/crash_report/crash_restore_helper.h +++ b/ios/chrome/browser/crash_report/crash_restore_helper.h
@@ -15,12 +15,21 @@ - (instancetype)initWithBrowser:(Browser*)browser; -// Saves the session information stored on disk in temporary files and will -// then delete those from their default location. This will ensure that the -// user will then start from scratch, while allowing restoring their old -// sessions. This method has to be called before the browser is created, or the -// session information will be overwritten. -// Returns |YES| if the deletetion and backup was successful. +// Saves the session information stored on disk for sessions with |sessionIDs| +// in temporary files and will then delete those from their default location. +// This will ensure that the user will then start from scratch, while allowing +// restoring their old sessions. This method has to be called before the browser +// is created, or the session information will be overwritten. +// |sessionIDs| can be nil when multiple windows are not supported, and in that +// case only the default session will be moved. +// Returns |YES| if the at least one session deletion was successful. ++ (BOOL)moveAsideSessions:(NSSet<NSString*>*)sessionIDs + forBrowserState:(ChromeBrowserState*)browserState; + +// Move the session information for Legacy non multiwindow supported OS. +// This method deletes the session from its default location, while +// allowing restoring it back later. +// Returns |YES| if the delettion and backup was successful. + (BOOL)moveAsideSessionInformationForBrowserState: (ChromeBrowserState*)browserState;
diff --git a/ios/chrome/browser/crash_report/crash_restore_helper.mm b/ios/chrome/browser/crash_report/crash_restore_helper.mm index df7e7229..b6ccdef 100644 --- a/ios/chrome/browser/crash_report/crash_restore_helper.mm +++ b/ios/chrome/browser/crash_report/crash_restore_helper.mm
@@ -27,12 +27,17 @@ #include "ios/chrome/browser/infobars/infobar_manager_impl.h" #include "ios/chrome/browser/infobars/infobar_utils.h" #import "ios/chrome/browser/main/browser.h" +#import "ios/chrome/browser/main/browser_list.h" +#import "ios/chrome/browser/main/browser_list_factory.h" #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" #import "ios/chrome/browser/sessions/session_ios.h" #import "ios/chrome/browser/sessions/session_restoration_browser_agent.h" #import "ios/chrome/browser/sessions/session_service_ios.h" #import "ios/chrome/browser/sessions/session_window_ios.h" #import "ios/chrome/browser/ui/infobars/infobar_feature.h" +#import "ios/chrome/browser/ui/main/scene_state.h" +#import "ios/chrome/browser/ui/main/scene_state_browser_agent.h" +#import "ios/chrome/browser/ui/util/multi_window_support.h" #include "ios/chrome/browser/web_state_list/web_state_list.h" #include "ios/chrome/grit/ios_theme_resources.h" #import "ios/web/public/web_state.h" @@ -54,16 +59,32 @@ // case of success, NO otherwise. + (BOOL)deleteSessionForBrowserState:(ChromeBrowserState*)browserState backupFile:(NSString*)file; -// Returns the path where the sessions for the main browser state are backed up. -+ (NSString*)sessionBackupPath; + +// Returns the path where the sessions with |sessionID| for the main browser +// state are backed up. ++ (NSString*)backupPathForSessionID:(NSString*)sessionID; + +// Returns a list of IDs for all backed up sessions. ++ (NSArray<NSString*>*)backedupSessionIDs; + // Restores the sessions after a crash. It should only be called if -// |moveAsideSessionInformation| for the browser state of the current browser -// was successful. +// |moveAsideSessions:forBrowserState| for the browser state of the current +// browser was successful. - (BOOL)restoreSessionsAfterCrash; + +// The Browser instance associated with this crash restore helper. +@property(nonatomic) Browser* browser; + @end namespace { +NSString* const kSessionBackupFileName = + @"session.bak"; // The session file name on disk. +NSString* const kSessionBackupDirectoryName = + @"Sessions"; // The name for directory which contains all session backup + // subdirectories for multiple sessions. + class InfoBarManagerObserverBridge : infobars::InfoBarManager::Observer { public: InfoBarManagerObserverBridge(infobars::InfoBarManager* infoBarManager, @@ -240,6 +261,72 @@ _infoBarBridge.reset(new InfoBarManagerObserverBridge(infoBarManager, self)); } ++ (BOOL)deleteSessions:(NSSet<NSString*>*)sessionIDs + forBrowserState:(ChromeBrowserState*)browserState + shouldBackup:(BOOL)shouldBackup { + BOOL partialSuccess = NO; + NSString* stashPath = + base::SysUTF8ToNSString(browserState->GetStatePath().value()); + NSString* backupPath = nil; + + for (NSString* sessionID in sessionIDs) { + NSString* sessionPath = + [SessionServiceIOS sessionPathForSessionID:sessionID + directory:stashPath]; + if (shouldBackup) + backupPath = [self backupPathForSessionID:sessionID]; + + partialSuccess |= [[self class] deleteSessionFromPath:sessionPath + backupFile:backupPath]; + } + return partialSuccess; +} + ++ (BOOL)deleteSessionFromPath:(NSString*)sessionPath + backupFile:(NSString*)backupPath { + NSFileManager* fileManager = [NSFileManager defaultManager]; + if (![fileManager fileExistsAtPath:sessionPath]) + return NO; + if (backupPath) { + NSError* error = nil; + BOOL fileOperationSuccess = [fileManager removeItemAtPath:backupPath + error:&error]; + NSInteger errorCode = fileOperationSuccess ? 0 : [error code]; + base::UmaHistogramSparse("TabRestore.error_remove_backup_at_path", + errorCode); + if (!fileOperationSuccess && errorCode != NSFileNoSuchFileError) { + return NO; + } + // Create the backup directory, if it doesn't exist. + NSString* directory = [backupPath stringByDeletingLastPathComponent]; + [fileManager createDirectoryAtPath:directory + withIntermediateDirectories:YES + attributes:nil + error:&error]; + + fileOperationSuccess = [fileManager moveItemAtPath:sessionPath + toPath:backupPath + error:&error]; + errorCode = fileOperationSuccess ? 0 : [error code]; + base::UmaHistogramSparse("TabRestore.error_move_session_at_path_to_backup", + errorCode); + if (!fileOperationSuccess) { + return NO; + } + } else { + NSError* error; + BOOL fileOperationSuccess = [fileManager removeItemAtPath:sessionPath + error:&error]; + NSInteger errorCode = fileOperationSuccess ? 0 : [error code]; + base::UmaHistogramSparse("TabRestore.error_remove_session_at_path", + errorCode); + if (!fileOperationSuccess) { + return NO; + } + } + return YES; +} + + (BOOL)deleteSessionForBrowserState:(ChromeBrowserState*)browserState backupFile:(NSString*)file { NSString* stashPath = @@ -258,6 +345,7 @@ if (!fileOperationSuccess && errorCode != NSFileNoSuchFileError) { return NO; } + fileOperationSuccess = [fileManager moveItemAtPath:sessionPath toPath:file error:&error]; errorCode = fileOperationSuccess ? 0 : [error code]; @@ -280,36 +368,133 @@ return YES; } -+ (NSString*)sessionBackupPath { ++ (NSString*)backupPathForSessionID:(NSString*)sessionID { NSString* tmpDirectory = NSTemporaryDirectory(); - return [tmpDirectory stringByAppendingPathComponent:@"session.bak"]; + if (!sessionID || !sessionID.length) + return [tmpDirectory stringByAppendingPathComponent:kSessionBackupFileName]; + return [NSString pathWithComponents:@[ + tmpDirectory, kSessionBackupDirectoryName, sessionID, kSessionBackupFileName + ]]; +} + ++ (NSString*)backupSessionsDirectoryPath { + NSString* tmpDirectory = NSTemporaryDirectory(); + return + [tmpDirectory stringByAppendingPathComponent:kSessionBackupDirectoryName]; +} + ++ (NSArray<NSString*>*)backedupSessionPaths { + if (!IsMultiwindowSupported()) + return @[ [[self class] backupPathForSessionID:nil] ]; + NSString* sessionsDirectoryPath = [[self class] backupSessionsDirectoryPath]; + NSArray<NSString*>* sessionsIDs = [[NSFileManager defaultManager] + contentsOfDirectoryAtPath:sessionsDirectoryPath + error:nil]; + NSMutableArray<NSString*>* sessionFilePaths = + [[NSMutableArray alloc] initWithCapacity:sessionsIDs.count]; + for (NSString* sessionID in sessionsIDs) { + [sessionFilePaths + addObject:[[self class] backupPathForSessionID:sessionID]]; + } + return sessionFilePaths; +} + ++ (NSArray<NSString*>*)backedupSessionIDs { + if (!IsMultiwindowSupported()) + return @[ @"" ]; + NSString* sessionsDirectoryPath = [[self class] backupSessionsDirectoryPath]; + return [[NSFileManager defaultManager] + contentsOfDirectoryAtPath:sessionsDirectoryPath + error:nil]; } + (BOOL)moveAsideSessionInformationForBrowserState: (ChromeBrowserState*)browserState { + DCHECK(!IsMultiwindowSupported()); // This may be the first time that the OTR browser state is being accessed, so // ensure that the OTR ChromeBrowserState is created first. ChromeBrowserState* otrBrowserState = browserState->GetOffTheRecordChromeBrowserState(); + [self deleteSessionForBrowserState:otrBrowserState backupFile:nil]; return [self deleteSessionForBrowserState:browserState - backupFile:[self sessionBackupPath]]; + backupFile:[self backupPathForSessionID:nil]]; +} + ++ (BOOL)moveAsideSessions:(NSSet<NSString*>*)sessionIDs + forBrowserState:(ChromeBrowserState*)browserState { + // This may be the first time that the OTR browser state is being accessed, so + // ensure that the OTR ChromeBrowserState is created first. + ChromeBrowserState* otrBrowserState = + browserState->GetOffTheRecordChromeBrowserState(); + [self deleteSessions:sessionIDs + forBrowserState:otrBrowserState + shouldBackup:NO]; + return [self deleteSessions:sessionIDs + forBrowserState:browserState + shouldBackup:YES]; } - (BOOL)restoreSessionsAfterCrash { + CrashRestoreHelper* strongSelf = self; DCHECK(!_sessionRestored); _sessionRestored = YES; _infoBarBridge.reset(); - - SessionIOS* session = [[SessionServiceIOS sharedService] - loadSessionFromPath:[[self class] sessionBackupPath]]; - if (!session) - return NO; - - DCHECK_EQ(session.sessionWindows.count, 1u); + BrowserList* browserList = BrowserListFactory::GetForBrowserState( + strongSelf.browser->GetBrowserState()); breakpad_helper::WillStartCrashRestoration(); - return SessionRestorationBrowserAgent::FromBrowser(_browser) - ->RestoreSessionWindow(session.sessionWindows[0]); + BOOL success = NO; + // First restore all conected sessions. + NSFileManager* fileManager = [NSFileManager defaultManager]; + NSError* error = nil; + std::set<Browser*> regularBrowsers = browserList->AllRegularBrowsers(); + + for (Browser* browser : regularBrowsers) { + NSString* sessionID = SceneStateBrowserAgent::FromBrowser(browser) + ->GetSceneState() + .sceneSessionID; + NSString* sessionPath = + [[strongSelf class] backupPathForSessionID:sessionID]; + SessionIOS* session = + [[SessionServiceIOS sharedService] loadSessionFromPath:sessionPath]; + + if (!session) + continue; + success |= SessionRestorationBrowserAgent::FromBrowser(browser) + ->RestoreSessionWindow(session.sessionWindows[0]); + // remove the backup directory for this session as it will not be moved + // back to its original browser state direcotry. + if (IsMultiwindowSupported()) { + [fileManager + removeItemAtPath:[sessionPath stringByDeletingLastPathComponent] + error:&error]; + } + } + + // If this is not multiwindow platform, there are no more sessions to deal + // with. + if (!IsMultiwindowSupported()) + return success; + + // Now put non restored sessions files to its original location in the browser + // state directory. + Browser* anyBrowser = *regularBrowsers.begin(); + NSString* stashPath = base::SysUTF8ToNSString( + anyBrowser->GetBrowserState()->GetStatePath().value()); + + NSArray<NSString*>* backedupSessionIDs = + [[strongSelf class] backedupSessionIDs]; + for (NSString* sessionID in backedupSessionIDs) { + NSString* originalSessionPath = + [SessionServiceIOS sessionPathForSessionID:sessionID + directory:stashPath]; + [fileManager + moveItemAtPath:[[strongSelf class] backupPathForSessionID:sessionID] + toPath:originalSessionPath + error:&error]; + } + + return success; } - (void)infoBarRemoved:(infobars::InfoBar*)infobar { @@ -325,25 +510,35 @@ // the recently closed tabs. _sessionRestored = YES; - SessionIOS* session = [[SessionServiceIOS sharedService] - loadSessionFromPath:[[self class] sessionBackupPath]]; - DCHECK_EQ(session.sessionWindows.count, 1u); + NSArray<NSString*>* sessionsIDs = [[self class] backedupSessionIDs]; + NSFileManager* fileManager = [NSFileManager defaultManager]; + NSError* error = nil; + for (NSString* sessionID in sessionsIDs) { + NSString* sessionPath = [[self class] backupPathForSessionID:sessionID]; + SessionIOS* session = + [[SessionServiceIOS sharedService] loadSessionFromPath:sessionPath]; - NSArray<CRWSessionStorage*>* sessions = session.sessionWindows[0].sessions; - if (!sessions.count) - return; + NSArray<CRWSessionStorage*>* sessions = session.sessionWindows[0].sessions; + if (!sessions.count) + continue; - sessions::TabRestoreService* const tabRestoreService = - IOSChromeTabRestoreServiceFactory::GetForBrowserState( - _browser->GetBrowserState()); - tabRestoreService->LoadTabsFromLastSession(); + sessions::TabRestoreService* const tabRestoreService = + IOSChromeTabRestoreServiceFactory::GetForBrowserState( + _browser->GetBrowserState()); + tabRestoreService->LoadTabsFromLastSession(); - web::WebState::CreateParams params(_browser->GetBrowserState()); - for (CRWSessionStorage* session in sessions) { - auto live_tab = std::make_unique<sessions::RestoreIOSLiveTab>(session); - // Add all tabs at the 0 position as the position is relative to an old - // tabModel. - tabRestoreService->CreateHistoricalTab(live_tab.get(), 0); + web::WebState::CreateParams params(_browser->GetBrowserState()); + for (CRWSessionStorage* session in sessions) { + auto live_tab = std::make_unique<sessions::RestoreIOSLiveTab>(session); + // Add all tabs at the 0 position as the position is relative to an old + // tabModel. + tabRestoreService->CreateHistoricalTab(live_tab.get(), 0); + } + if (IsMultiwindowSupported()) { + [fileManager + removeItemAtPath:[sessionPath stringByDeletingLastPathComponent] + error:&error]; + } } return; }
diff --git a/ios/chrome/browser/crash_report/crash_restore_helper_unittest.mm b/ios/chrome/browser/crash_report/crash_restore_helper_unittest.mm index 63bbafd..e6b8018 100644 --- a/ios/chrome/browser/crash_report/crash_restore_helper_unittest.mm +++ b/ios/chrome/browser/crash_report/crash_restore_helper_unittest.mm
@@ -14,6 +14,7 @@ #include "ios/chrome/browser/crash_report/crash_restore_helper.h" #import "ios/chrome/browser/main/test_browser.h" #import "ios/chrome/browser/sessions/session_service_ios.h" +#import "ios/chrome/browser/ui/util/multi_window_support.h" #include "ios/web/public/test/web_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -28,7 +29,7 @@ using testing::Return; @interface CrashRestoreHelper (Test) -+ (NSString*)sessionBackupPath; ++ (NSString*)backupPathForSessionID:(NSString*)sessionID; @end namespace { @@ -45,6 +46,73 @@ } protected: + // Creates the session for |session_id|, if |session_id| is nil a session + // will be created in the default location. + // Returns |true| if the creation was successful. + bool CreateSession(NSString* session_id) { + NSFileManager* file_manager = [NSFileManager defaultManager]; + ChromeBrowserState* browser_states[] = { + chrome_browser_state_.get(), + off_the_record_chrome_browser_state_, + }; + NSString* backup_path = + [CrashRestoreHelper backupPathForSessionID:session_id]; + [file_manager removeItemAtPath:backup_path error:nil]; + NSData* data = [NSData dataWithBytes:"hello" length:5]; + for (size_t index = 0; index < base::size(browser_states); ++index) { + NSString* state_path = base::SysUTF8ToNSString( + browser_states[index]->GetStatePath().value()); + NSString* session_path = + [SessionServiceIOS sessionPathForSessionID:session_id + directory:state_path]; + NSString* directory = [session_path stringByDeletingLastPathComponent]; + if (![file_manager fileExistsAtPath:directory]) { + [file_manager createDirectoryAtPath:directory + withIntermediateDirectories:YES + attributes:nil + error:nil]; + } + [file_manager createFileAtPath:session_path contents:data attributes:nil]; + if (![file_manager fileExistsAtPath:session_path]) + return false; + } + return true; + } + + // Returns |true| if session for |session_id| was erased from its default + // location. if |session_id| is nil, the default session location is used. + bool IsSessionErased(NSString* session_id) { + NSFileManager* file_manager = [NSFileManager defaultManager]; + ChromeBrowserState* browser_states[] = { + chrome_browser_state_.get(), + off_the_record_chrome_browser_state_, + }; + + for (size_t index = 0; index < base::size(browser_states); ++index) { + NSString* state_path = base::SysUTF8ToNSString( + browser_states[index]->GetStatePath().value()); + NSString* session_path = + [SessionServiceIOS sessionPathForSessionID:session_id + directory:state_path]; + if ([file_manager fileExistsAtPath:session_path]) + return false; + } + return true; + } + + // Returns |true| if the session with |session_id| was backed up correctly, + // and deletes the backup file. if |session_id| is nil, the default backup + // session location is used. + bool CheckAndDeleteSessionBackedUp(NSString* session_id) { + NSFileManager* file_manager = [NSFileManager defaultManager]; + NSString* backup_path = + [CrashRestoreHelper backupPathForSessionID:session_id]; + if (![file_manager fileExistsAtPath:backup_path]) + return false; + [file_manager removeItemAtPath:backup_path error:nil]; + return true; + } + web::WebTaskEnvironment task_environment_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; std::unique_ptr<TestBrowser> test_browser_; @@ -52,39 +120,33 @@ CrashRestoreHelper* helper_; }; -TEST_F(CrashRestoreHelperTest, MoveAsideTest) { - NSString* backup_path = [CrashRestoreHelper sessionBackupPath]; - NSFileManager* file_manager = [NSFileManager defaultManager]; - [file_manager removeItemAtPath:backup_path error:NULL]; - - NSData* data = [NSData dataWithBytes:"hello" length:5]; - ChromeBrowserState* browser_states[] = { - chrome_browser_state_.get(), - off_the_record_chrome_browser_state_, - }; - - for (size_t index = 0; index < base::size(browser_states); ++index) { - NSString* state_path = - base::SysUTF8ToNSString(browser_states[index]->GetStatePath().value()); - NSString* session_path = - [SessionServiceIOS sessionPathForDirectory:state_path]; - [file_manager createFileAtPath:session_path contents:data attributes:nil]; - ASSERT_EQ(YES, [file_manager fileExistsAtPath:session_path]); - } - +// Tests that moving session work correctly when multiple windows are not +// supported. +TEST_F(CrashRestoreHelperTest, MoveAsideSingleSession) { + // This test is only enabled when multi-window is disabled. + if (IsMultiwindowSupported()) + return; + ASSERT_TRUE(CreateSession(nil)); [CrashRestoreHelper moveAsideSessionInformationForBrowserState:chrome_browser_state_.get()]; + EXPECT_TRUE(IsSessionErased(nil)); + EXPECT_EQ(YES, CheckAndDeleteSessionBackedUp(nil)); +} - for (size_t index = 0; index < base::size(browser_states); ++index) { - NSString* state_path = - base::SysUTF8ToNSString(browser_states[index]->GetStatePath().value()); - NSString* session_path = - [SessionServiceIOS sessionPathForDirectory:state_path]; - EXPECT_EQ(NO, [file_manager fileExistsAtPath:session_path]); +// Tests that moving session work correctly when multiple windows are supported. +TEST_F(CrashRestoreHelperTest, MoveAsideMultipleSessions) { + NSSet<NSString*>* session_ids = + [NSSet setWithObjects:@"session_1", @"session_2", nil]; + for (NSString* session_id in session_ids) { + ASSERT_TRUE(CreateSession(session_id)); } - EXPECT_EQ(YES, [file_manager fileExistsAtPath:backup_path]); - [file_manager removeItemAtPath:backup_path error:NULL]; + [CrashRestoreHelper moveAsideSessions:session_ids + forBrowserState:chrome_browser_state_.get()]; + for (NSString* session_id in session_ids) { + EXPECT_TRUE(IsSessionErased(session_id)); + EXPECT_EQ(YES, CheckAndDeleteSessionBackedUp(session_id)); + } } } // namespace
diff --git a/ios/chrome/browser/device_sharing/handoff_manager_egtest.mm b/ios/chrome/browser/device_sharing/handoff_manager_egtest.mm index d6cda3db..c1794205 100644 --- a/ios/chrome/browser/device_sharing/handoff_manager_egtest.mm +++ b/ios/chrome/browser/device_sharing/handoff_manager_egtest.mm
@@ -16,12 +16,10 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(HandoffManagerAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) namespace {
diff --git a/ios/chrome/browser/feature_engagement/feature_engagement_egtest.mm b/ios/chrome/browser/feature_engagement/feature_engagement_egtest.mm index 52d415a..0f0cc9c 100644 --- a/ios/chrome/browser/feature_engagement/feature_engagement_egtest.mm +++ b/ios/chrome/browser/feature_engagement/feature_engagement_egtest.mm
@@ -27,14 +27,12 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(FeatureEngagementAppInterface); -#endif // defined(CHROME_EARL_GREY_2) namespace {
diff --git a/ios/chrome/browser/main/BUILD.gn b/ios/chrome/browser/main/BUILD.gn index cf9dd667..fbd480e 100644 --- a/ios/chrome/browser/main/BUILD.gn +++ b/ios/chrome/browser/main/BUILD.gn
@@ -104,6 +104,7 @@ "//base", "//base/test:test_support", "//ios/chrome/browser/browser_state:test_support", + "//ios/chrome/browser/snapshots", "//ios/chrome/browser/tabs", "//ios/chrome/browser/web:tab_id_tab_helper", "//ios/chrome/browser/web_state_list",
diff --git a/ios/chrome/browser/main/browser_util.mm b/ios/chrome/browser/main/browser_util.mm index 409f264..2b1c0b1 100644 --- a/ios/chrome/browser/main/browser_util.mm +++ b/ios/chrome/browser/main/browser_util.mm
@@ -13,6 +13,8 @@ #import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/main/browser_list.h" #import "ios/chrome/browser/main/browser_list_factory.h" +#import "ios/chrome/browser/snapshots/snapshot_browser_agent.h" +#import "ios/chrome/browser/snapshots/snapshot_cache.h" #import "ios/chrome/browser/web/tab_id_tab_helper.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/chrome/browser/web_state_list/web_state_opener.h" @@ -58,6 +60,28 @@ tab_index); } +// Moves snapshot associated with |snapshot_id| from |source_browser| to +// |destination_browser|'s snapshot cache. +void MoveSnapshot(NSString* snapshot_id, + Browser* source_browser, + Browser* destination_browser) { + DCHECK(snapshot_id.length); + SnapshotCache* source_cache = + SnapshotBrowserAgent::FromBrowser(source_browser)->snapshot_cache(); + SnapshotCache* destination_cache = + SnapshotBrowserAgent::FromBrowser(destination_browser)->snapshot_cache(); + [source_cache + retrieveImageForSnapshotID:snapshot_id + callback:^(UIImage* snapshot) { + if (snapshot) { + [destination_cache setImage:snapshot + withSnapshotID:snapshot_id]; + [source_cache + removeImageWithSnapshotID:snapshot_id]; + } + }]; +} + } // namespace void MoveTabToBrowser(NSString* tab_id, @@ -81,6 +105,7 @@ source_tab_index, destination_tab_index); return; } + MoveSnapshot(tab_id, source_browser, destination_browser); std::unique_ptr<web::WebState> web_state = source_browser->GetWebStateList()->DetachWebStateAt(source_tab_index); destination_browser->GetWebStateList()->InsertWebState(
diff --git a/ios/chrome/browser/main/browser_util_unittest.mm b/ios/chrome/browser/main/browser_util_unittest.mm index a1140708..74d7916 100644 --- a/ios/chrome/browser/main/browser_util_unittest.mm +++ b/ios/chrome/browser/main/browser_util_unittest.mm
@@ -10,6 +10,8 @@ #import "ios/chrome/browser/main/browser_list.h" #import "ios/chrome/browser/main/browser_list_factory.h" #include "ios/chrome/browser/main/test_browser.h" +#import "ios/chrome/browser/snapshots/snapshot_browser_agent.h" +#import "ios/chrome/browser/snapshots/snapshot_tab_helper.h" #import "ios/chrome/browser/web/tab_id_tab_helper.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/chrome/browser/web_state_list/web_state_opener.h" @@ -43,6 +45,11 @@ browser_list_->AddIncognitoBrowser(incognito_browser_.get()); browser_list_->AddIncognitoBrowser(other_incognito_browser_.get()); + SnapshotBrowserAgent::CreateForBrowser(browser_.get()); + SnapshotBrowserAgent::CreateForBrowser(other_browser_.get()); + SnapshotBrowserAgent::CreateForBrowser(incognito_browser_.get()); + SnapshotBrowserAgent::CreateForBrowser(other_incognito_browser_.get()); + AppendNewWebState(browser_.get()); AppendNewWebState(browser_.get()); AppendNewWebState(browser_.get()); @@ -53,10 +60,13 @@ web::TestWebState* AppendNewWebState(Browser* browser) { auto test_web_state = std::make_unique<web::TestWebState>(); web::TestWebState* inserted_web_state = test_web_state.get(); + TabIdTabHelper::CreateForWebState(inserted_web_state); + NSString* tab_id = + TabIdTabHelper::FromWebState(inserted_web_state)->tab_id(); + SnapshotTabHelper::CreateForWebState(inserted_web_state, tab_id); browser->GetWebStateList()->InsertWebState( WebStateList::kInvalidIndex, std::move(test_web_state), WebStateList::INSERT_ACTIVATE, WebStateOpener()); - TabIdTabHelper::CreateForWebState(inserted_web_state); return inserted_web_state; }
diff --git a/ios/chrome/browser/metrics/demographics_egtest.mm b/ios/chrome/browser/metrics/demographics_egtest.mm index da2ad7f7..c65d2d96 100644 --- a/ios/chrome/browser/metrics/demographics_egtest.mm +++ b/ios/chrome/browser/metrics/demographics_egtest.mm
@@ -60,7 +60,6 @@ [super tearDown]; } -#if defined(CHROME_EARL_GREY_2) - (AppLaunchConfiguration)appConfigurationForTestCase { AppLaunchConfiguration config; @@ -95,7 +94,6 @@ } return config; } -#endif // defined(CHROME_EARL_GREY_2) #pragma mark - Helpers @@ -182,7 +180,6 @@ // // Corresponds to AddSyncedUserBirthYearAndGenderToProtoData in // //chrome/browser/metrics/ukm_browsertest.cc with features enabled. -#if defined(CHROME_EARL_GREY_2) - (void)testUKMDemographicsReportingWithFeatureEnabled { // See |appConfigurationForTestCase| for feature set-up. The kUkmFeature is // enabled by default. @@ -206,14 +203,12 @@ forHistogram:@"UKM.UserDemographics.Status"], @"Unexpected histogram contents"); } -#endif // defined(CHROME_EARL_GREY_2) // Tests that user demographics are neither recorded by UKM nor logged in // histograms when sync is turned on. // // Corresponds to AddSyncedUserBirthYearAndGenderToProtoData in // //chrome/browser/metrics/ukm_browsertest.cc with features disabled. -#if defined(CHROME_EARL_GREY_2) - (void)testUKMDemographicsReportingWithFeatureDisabled { // See |appConfigurationForTestCase| for feature set-up. The kUkmFeature is // enabled by default. @@ -233,7 +228,6 @@ forHistogram:@"UKM.UserDemographics.Status"], @"Unexpected histogram contents."); } -#endif // defined(CHROME_EARL_GREY_2) // Tests that user demographics are synced, recorded by UMA, and logged in // histograms. @@ -241,7 +235,6 @@ // Corresponds to AddSyncedUserBirthYearAndGenderToProtoData in // //chrome/browser/metrics/metrics_service_user_demographics_browsertest.cc // with features enabled. -#if defined(CHROME_EARL_GREY_2) - (void)testUMADemographicsReportingWithFeatureEnabled { // See |appConfigurationForTestCase| for feature set-up. The kUkmFeature is // enabled by default. @@ -264,7 +257,6 @@ forHistogram:@"UMA.UserDemographics.Status"], @"Unexpected histogram contents"); } -#endif // defined(CHROME_EARL_GREY_2) // Tests that user demographics are neither recorded by UMA nor logged in // histograms when sync is turned on. @@ -272,7 +264,6 @@ // Corresponds to AddSyncedUserBirthYearAndGenderToProtoData in // //chrome/browser/metrics/metrics_service_user_demographics_browsertest.cc // with features disabled. -#if defined(CHROME_EARL_GREY_2) - (void)testUMADemographicsReportingWithFeatureDisabled { // See |appConfigurationForTestCase| for feature set-up. GREYAssertFalse([ChromeEarlGrey isDemographicMetricsReportingEnabled], @@ -286,6 +277,5 @@ forHistogram:@"UMA.UserDemographics.Status"], @"Unexpected histogram contents."); } -#endif // defined(CHROME_EARL_GREY_2) @end
diff --git a/ios/chrome/browser/metrics/metrics_app_interface_stub.mm b/ios/chrome/browser/metrics/metrics_app_interface_stub.mm index 407e123f..8b5306b5d 100644 --- a/ios/chrome/browser/metrics/metrics_app_interface_stub.mm +++ b/ios/chrome/browser/metrics/metrics_app_interface_stub.mm
@@ -9,7 +9,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -17,4 +16,3 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(MetricsAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2)
diff --git a/ios/chrome/browser/metrics/previous_session_info.h b/ios/chrome/browser/metrics/previous_session_info.h index cadb03b..9b68a13e 100644 --- a/ios/chrome/browser/metrics/previous_session_info.h +++ b/ios/chrome/browser/metrics/previous_session_info.h
@@ -112,6 +112,11 @@ // Reset to NO after resetSessionRestorationFlag call. @property(nonatomic, readonly) BOOL terminatedDuringSessionRestoration; +// The list of the session IDs for all the connected scenes, used for crash +// restoration. +@property(nonatomic, readonly) + NSMutableSet<NSString*>* connectedSceneSessionsIDs; + // Singleton PreviousSessionInfo. During the lifetime of the app, the returned // object is the same, and describes the previous session, even after a new // session has started (by calling beginRecordingCurrentSession).
diff --git a/ios/chrome/browser/metrics/previous_session_info.mm b/ios/chrome/browser/metrics/previous_session_info.mm index 18819a77..15a05581 100644 --- a/ios/chrome/browser/metrics/previous_session_info.mm +++ b/ios/chrome/browser/metrics/previous_session_info.mm
@@ -116,10 +116,6 @@ // Can be greater than one if multiple sessions are being restored in parallel. @property(atomic, assign) int numberOfSessionsBeingRestored; -// The list of the session IDs for all the connected scenes, used for crash -// restoration. -@property(nonatomic, strong) NSMutableSet<NSString*>* connectedSceneSessionsIDs; - // Redefined to be read-write. @property(nonatomic, assign) NSInteger availableDeviceStorage; @property(nonatomic, assign) float deviceBatteryLevel; @@ -134,6 +130,7 @@ @property(nonatomic, strong) NSString* OSVersion; @property(nonatomic, strong) NSDate* sessionEndTime; @property(nonatomic, assign) BOOL terminatedDuringSessionRestoration; +@property(nonatomic, strong) NSMutableSet<NSString*>* connectedSceneSessionsIDs; @end
diff --git a/ios/chrome/browser/metrics/ukm_egtest.mm b/ios/chrome/browser/metrics/ukm_egtest.mm index 3162de7..1d3323a 100644 --- a/ios/chrome/browser/metrics/ukm_egtest.mm +++ b/ios/chrome/browser/metrics/ukm_egtest.mm
@@ -28,19 +28,10 @@ @implementation UKMTestCase -#if defined(CHROME_EARL_GREY_2) + (void)setUpForTestCase { [super setUpForTestCase]; [self setUpHelper]; } -#elif defined(CHROME_EARL_GREY_1) -+ (void)setUp { - [super setUp]; - [self setUpHelper]; -} -#else -#error Not an EarlGrey Test -#endif + (void)setUpHelper { if (![ChromeEarlGrey isUKMEnabled]) { @@ -240,12 +231,6 @@ // Corresponds to MetricsConsentCheck in //chrome/browser/metrics/ // ukm_browsertest.cc. - (void)testMetricsConsent { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1033726): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif const uint64_t originalClientID = [MetricsAppInterface UKMClientID]; @@ -290,12 +275,6 @@ // Corresponds to ConsentAddedButNoSyncCheck in //chrome/browser/metrics/ // ukm_browsertest.cc. - (void)testSingleDisableSync { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1033726): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif const uint64_t originalClientID = [MetricsAppInterface UKMClientID]; @@ -336,12 +315,6 @@ // Corresponds to SingleSyncSignoutCheck in //chrome/browser/metrics/ // ukm_browsertest.cc. - (void)testSingleSyncSignout { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1033726): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif const uint64_t clientID1 = [MetricsAppInterface UKMClientID]; [SigninEarlGrey signOut]; @@ -370,7 +343,6 @@ // // Corresponds to HistoryDeleteCheck in //chrome/browser/metrics/ // ukm_browsertest.cc. -#if defined(CHROME_EARL_GREY_2) - (void)testHistoryDelete { const uint64_t originalClientID = [MetricsAppInterface UKMClientID]; @@ -392,6 +364,5 @@ GREYAssert([MetricsAppInterface checkUKMRecordingEnabled:YES], @"Failed to assert that UKM was enabled."); } -#endif // defined(CHROME_EARL_GREY_2) @end
diff --git a/ios/chrome/browser/safe_browsing/fake_safe_browsing_service.mm b/ios/chrome/browser/safe_browsing/fake_safe_browsing_service.mm index e6f462f..23ac2d9 100644 --- a/ios/chrome/browser/safe_browsing/fake_safe_browsing_service.mm +++ b/ios/chrome/browser/safe_browsing/fake_safe_browsing_service.mm
@@ -90,4 +90,5 @@ const net::CookieDeletionInfo::TimeRange& creation_range, base::OnceClosure callback) { DCHECK_CURRENTLY_ON(web::WebThread::UI); + std::move(callback).Run(); }
diff --git a/ios/chrome/browser/sessions/session_service_ios.h b/ios/chrome/browser/sessions/session_service_ios.h index 6a5d42a..9260bd6 100644 --- a/ios/chrome/browser/sessions/session_service_ios.h +++ b/ios/chrome/browser/sessions/session_service_ios.h
@@ -13,6 +13,10 @@ @class SessionIOS; @class SessionIOSFactory; +namespace session_constants { +NSString* const kSessionsDirectory = @"Sessions"; +} + // A singleton service for saving the current session. Can either save on a // delay or immediately. Saving is always performed on a separate thread. @interface SessionServiceIOS : NSObject @@ -52,6 +56,10 @@ - (void)deleteSessions:(NSArray<NSString*>*)sessionIDs fromBrowserStateDirectory:(NSString*)directory; +// Returns the path of the session with |sessionID| within a |directory|. ++ (NSString*)sessionPathForSessionID:(NSString*)sessionID + directory:(NSString*)directory; + // Returns the path of the session file for |directory|. + (NSString*)sessionPathForDirectory:(NSString*)directory;
diff --git a/ios/chrome/browser/sessions/session_service_ios.mm b/ios/chrome/browser/sessions/session_service_ios.mm index 04cd38d..3601f78f 100644 --- a/ios/chrome/browser/sessions/session_service_ios.mm +++ b/ios/chrome/browser/sessions/session_service_ios.mm
@@ -48,6 +48,8 @@ NSString* const kSessionDirectory = @"Sessions"; // The directory name inside BrowserState directory which // contain all sessions directories. +NSString* const kSessionFileName = + @"session.plist"; // The session file name on disk. } @implementation NSKeyedUnarchiver (CrLegacySessionCompatibility) @@ -190,7 +192,16 @@ } + (NSString*)sessionPathForDirectory:(NSString*)directory { - return [directory stringByAppendingPathComponent:@"session.plist"]; + return [directory stringByAppendingPathComponent:kSessionFileName]; +} + ++ (NSString*)sessionPathForSessionID:(NSString*)sessionID + directory:(NSString*)directory { + if (!sessionID) + return [[self class] sessionPathForDirectory:directory]; + return [NSString pathWithComponents:@[ + directory, kSessionDirectory, sessionID, kSessionFileName + ]]; } #pragma mark - Private methods
diff --git a/ios/chrome/browser/translate/translate_app_interface_stub.mm b/ios/chrome/browser/translate/translate_app_interface_stub.mm index 8db90b1..60bd852 100644 --- a/ios/chrome/browser/translate/translate_app_interface_stub.mm +++ b/ios/chrome/browser/translate/translate_app_interface_stub.mm
@@ -9,7 +9,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -17,4 +16,3 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(TranslateAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2)
diff --git a/ios/chrome/browser/ui/autofill/autofill_app_interface_stub.mm b/ios/chrome/browser/ui/autofill/autofill_app_interface_stub.mm index 871227e..5410964 100644 --- a/ios/chrome/browser/ui/autofill/autofill_app_interface_stub.mm +++ b/ios/chrome/browser/ui/autofill/autofill_app_interface_stub.mm
@@ -9,7 +9,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -17,4 +16,3 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(AutofillAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2)
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/keyboard_observer_egtest.mm b/ios/chrome/browser/ui/autofill/manual_fill/keyboard_observer_egtest.mm index 68e2bf7..667ccde 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/keyboard_observer_egtest.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/keyboard_observer_egtest.mm
@@ -20,7 +20,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -28,7 +27,6 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(KeyboardObserverHelperAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) using base::TimeDelta; using base::test::ios::kWaitForUIElementTimeout;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_earl_grey.mm b/ios/chrome/browser/ui/bookmarks/bookmark_earl_grey.mm index b90208120..65f02c4 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_earl_grey.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_earl_grey.mm
@@ -15,7 +15,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -23,7 +22,6 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(BookmarkEarlGreyAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) const GURL GetFirstUrl() { return web::test::HttpServer::MakeUrl(
diff --git a/ios/chrome/browser/ui/bookmarks/bookmarks_accessibility_egtest.mm b/ios/chrome/browser/ui/bookmarks/bookmarks_accessibility_egtest.mm index 7d6ebe7d..7e4f8d51 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmarks_accessibility_egtest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmarks_accessibility_egtest.mm
@@ -95,12 +95,6 @@ // Tests that all elements on the bookmarks Edit page are accessible. - (void)testAccessibilityOnBookmarksEditPage { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -186,12 +180,6 @@ // Tests that all elements on bookmarks Delete and Undo are accessible. - (void)testAccessibilityOnBookmarksDeleteUndo { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks];
diff --git a/ios/chrome/browser/ui/bookmarks/bookmarks_entries_egtest.mm b/ios/chrome/browser/ui/bookmarks/bookmarks_entries_egtest.mm index ae386d9..03b44c6 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmarks_entries_egtest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmarks_entries_egtest.mm
@@ -60,12 +60,6 @@ #pragma mark - BookmarksEntriesTestCase Tests - (void)testUndoDeleteBookmarkFromSwipe { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif // TODO(crbug.com/851227): On Compact Width, the bookmark cell is being // deleted by grey_swipeFastInDirection. // grey_swipeFastInDirectionWithStartPoint doesn't work either and it might @@ -116,12 +110,6 @@ FLAKY_testSwipeToDeleteDisabledInEditMode #endif - (void)testSwipeToDeleteDisabledInEditMode { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif // TODO(crbug.com/851227): On non Compact Width the bookmark cell is being // deleted by grey_swipeFastInDirection. // grey_swipeFastInDirectionWithStartPoint doesn't work either and it might @@ -183,12 +171,6 @@ } - (void)testActionSheetsForSingleURLSelection { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -329,12 +311,6 @@ // Verify Move functionality on single URL selection. - (void)testMoveOnSingleURL { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -443,12 +419,6 @@ } - (void)testContextMenuForMultipleURLSelection { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -579,12 +549,6 @@ // Verify the Open and Open in Incognito functionality on single url. - (void)testOpenSingleBookmarkInNormalAndIncognitoTab { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -741,12 +705,6 @@ } - (void)testLongPressOnSingleURL { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -761,12 +719,6 @@ // Verify Move functionality on mixed folder / url selection. - (void)testMoveFunctionalityOnMixedSelection { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -859,12 +811,6 @@ // Verify Move functionality on multiple url selection. - (void)testMoveFunctionalityOnMultipleUrlSelection { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -930,12 +876,6 @@ // Verify Move is cancelled when all selected folder/url are deleted in // background. - (void)testMoveCancelledWhenAllSelectionDeleted { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -981,12 +921,6 @@ // Try deleting a bookmark from the edit screen, then undoing that delete. - (void)testUndoDeleteBookmarkFromEditScreen { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -1051,12 +985,6 @@ } - (void)testDeleteSingleURLNode { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -1095,12 +1023,6 @@ } - (void)testDeleteMultipleNodes { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks];
diff --git a/ios/chrome/browser/ui/bookmarks/bookmarks_folders_egtest.mm b/ios/chrome/browser/ui/bookmarks/bookmarks_folders_egtest.mm index dd14bbc..986c8bf 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmarks_folders_egtest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmarks_folders_egtest.mm
@@ -63,12 +63,6 @@ // Tests moving bookmarks into a new folder created in the moving process. - (void)testCreateNewFolderWhileMovingBookmarks { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -649,12 +643,6 @@ // Verify Move functionality on multiple folder selection. - (void)testMoveFunctionalityOnMultipleFolder { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -807,12 +795,6 @@ // Tests that the default folder bookmarks are saved in is updated to the last // used folder. - (void)testStickyDefaultFolder { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks]; @@ -888,12 +870,6 @@ // Tests the new folder name is committed when name editing is interrupted by // navigating away. - (void)testNewFolderNameCommittedOnNavigatingAway { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1035764): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif [BookmarkEarlGrey setupStandardBookmarks]; [BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks];
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm index fb76799..6bbf65e7 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm
@@ -32,12 +32,10 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ContentSuggestionsAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) namespace { @@ -104,19 +102,10 @@ return config; } -#if defined(CHROME_EARL_GREY_2) + (void)setUpForTestCase { [super setUpForTestCase]; [self setUpHelper]; } -#elif defined(CHROME_EARL_GREY_1) -+ (void)setUp { - [super setUp]; - [self setUpHelper]; -} -#else -#error Not an EarlGrey Test -#endif + (void)setUpHelper { [self closeAllTabs];
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm index d28f50f6..33624ab 100644 --- a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm +++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
@@ -93,17 +93,10 @@ @implementation NTPHomeTestCase -#if defined(CHROME_EARL_GREY_1) -+ (void)setUp { - [super setUp]; - [NTPHomeTestCase setUpHelper]; -} -#elif defined(CHROME_EARL_GREY_2) + (void)setUpForTestCase { [super setUpForTestCase]; [NTPHomeTestCase setUpHelper]; } -#endif // CHROME_EARL_GREY_2 + (void)setUpHelper { // Clear the pasteboard in case there is a URL copied, triggering an omnibox @@ -133,11 +126,7 @@ - (void)tearDown { [ContentSuggestionsAppInterface disableSuggestions]; [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait -#if defined(CHROME_EARL_GREY_1) - errorOrNil:nil]; -#elif defined(CHROME_EARL_GREY_2) error:nil]; -#endif [ContentSuggestionsAppInterface resetSearchEngineTo:self.defaultSearchEngine]; @@ -251,11 +240,7 @@ assertWithMatcher:OmniboxWidth(fakeOmniboxWidth)]; [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeLeft -#if defined(CHROME_EARL_GREY_1) - errorOrNil:nil]; -#elif defined(CHROME_EARL_GREY_2) error:nil]; -#endif [ChromeEarlGreyUI waitForAppToIdle]; @@ -298,11 +283,7 @@ [ChromeEarlGreyUI openSettingsMenu]; [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeLeft -#if defined(CHROME_EARL_GREY_1) - errorOrNil:nil]; -#elif defined(CHROME_EARL_GREY_2) error:nil]; -#endif [ChromeEarlGreyUI waitForAppToIdle]; @@ -347,11 +328,7 @@ assertWithMatcher:OmniboxWidthBetween(collectionWidth + 1, 2)]; [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeLeft -#if defined(CHROME_EARL_GREY_1) - errorOrNil:nil]; -#elif defined(CHROME_EARL_GREY_2) error:nil]; -#endif [ChromeEarlGreyUI waitForAppToIdle]; CGFloat collectionWidthAfterRotation =
diff --git a/ios/chrome/browser/ui/download/ar_quick_look_egtest.mm b/ios/chrome/browser/ui/download/ar_quick_look_egtest.mm index f2999a0..4a806387 100644 --- a/ios/chrome/browser/ui/download/ar_quick_look_egtest.mm +++ b/ios/chrome/browser/ui/download/ar_quick_look_egtest.mm
@@ -17,15 +17,6 @@ #include "net/test/embedded_test_server/http_response.h" #include "ui/base/l10n/l10n_util_mac.h" -#if defined(CHROME_EARL_GREY_1) -#import <QuickLook/QuickLook.h> - -// EG1 test relies on view controller presentation as the signal that Quick Look -// Dialog is shown. -#import "ios/chrome/app/main_controller.h" // nogncheck -#import "ios/chrome/browser/ui/browser_view/browser_view_controller.h" // nogncheck -#import "ios/chrome/test/app/chrome_test_util.h" // nogncheck -#endif #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -37,10 +28,8 @@ namespace { -#if defined(CHROME_EARL_GREY_2) // Use separate timeout for EG2 tests to accomodate for IPC delays. const NSTimeInterval kWaitForARPresentationTimeout = 30.0; -#endif // CHROME_EARL_GREY_2 // USDZ landing page and download request handler. std::unique_ptr<net::test_server::HttpResponse> GetResponse( @@ -109,19 +98,6 @@ // QLPreviewController UI is rendered out of host process so EarlGrey matcher // can not find QLPreviewController UI. -#if defined(CHROME_EARL_GREY_1) - // EG1 test relies on view controller presentation as the signal that - // QLPreviewController UI is shown. - id<BrowserInterface> interface = - chrome_test_util::GetMainController().interfaceProvider.mainInterface; - UIViewController* viewController = interface.viewController; - bool shown = WaitUntilConditionOrTimeout(kWaitForDownloadTimeout, ^{ - UIViewController* presentedController = - viewController.presentedViewController; - return [presentedController class] == [QLPreviewController class]; - }); - GREYAssert(shown, @"QLPreviewController was not shown."); -#elif defined(CHROME_EARL_GREY_2) // EG2 test uses XCUIApplication API to check for Quick Look dialog UI // presentation. XCUIApplication* app = [[XCUIApplication alloc] init]; @@ -129,9 +105,6 @@ GREYAssert( [goodTitle waitForExistenceWithTimeout:kWaitForARPresentationTimeout], @"AR preview dialog UI was not presented"); -#else -#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2. -#endif } - (void)testDownloadUnauthorized { @@ -151,19 +124,6 @@ // QLPreviewController UI is rendered out of host process so EarlGrey matcher // can not find QLPreviewController UI. -#if defined(CHROME_EARL_GREY_1) - // EG1 test relies on view controller presentation as the signal that - // QLPreviewController UI is shown. - id<BrowserInterface> interface = - chrome_test_util::GetMainController().interfaceProvider.mainInterface; - UIViewController* viewController = interface.viewController; - bool shown = WaitUntilConditionOrTimeout(kWaitForUIElementTimeout, ^{ - UIViewController* presentedController = - viewController.presentedViewController; - return [presentedController class] == [QLPreviewController class]; - }); - GREYAssertFalse(shown, @"QLPreviewController should not have shown."); -#elif defined(CHROME_EARL_GREY_2) // EG2 test uses XCUIApplication API to check for Quick Look dialog UI // presentation. XCUIApplication* app = [[XCUIApplication alloc] init]; @@ -171,9 +131,6 @@ GREYAssertFalse( [goodTitle waitForExistenceWithTimeout:kWaitForARPresentationTimeout], @"AR preview dialog UI was presented"); -#else -#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2. -#endif } - (void)testDownloadForbidden { @@ -193,19 +150,6 @@ // QLPreviewController UI is rendered out of host process so EarlGrey matcher // can not find QLPreviewController UI. -#if defined(CHROME_EARL_GREY_1) - // EG1 test relies on view controller presentation as the signal that - // QLPreviewController UI is shown. - id<BrowserInterface> interface = - chrome_test_util::GetMainController().interfaceProvider.mainInterface; - UIViewController* viewController = interface.viewController; - bool shown = WaitUntilConditionOrTimeout(kWaitForUIElementTimeout, ^{ - UIViewController* presentedController = - viewController.presentedViewController; - return [presentedController class] == [QLPreviewController class]; - }); - GREYAssertFalse(shown, @"QLPreviewController should not have shown."); -#elif defined(CHROME_EARL_GREY_2) // EG2 test uses XCUIApplication API to check for Quick Look dialog UI // presentation. XCUIApplication* app = [[XCUIApplication alloc] init]; @@ -213,9 +157,6 @@ GREYAssertFalse( [goodTitle waitForExistenceWithTimeout:kWaitForARPresentationTimeout], @"AR preview dialog UI was presented"); -#else -#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2. -#endif } - (void)testDownloadChangingMimeType { @@ -235,19 +176,6 @@ // QLPreviewController UI is rendered out of host process so EarlGrey matcher // can not find QLPreviewController UI. -#if defined(CHROME_EARL_GREY_1) - // EG1 test relies on view controller presentation as the signal that - // QLPreviewController UI is shown. - id<BrowserInterface> interface = - chrome_test_util::GetMainController().interfaceProvider.mainInterface; - UIViewController* viewController = interface.viewController; - bool shown = WaitUntilConditionOrTimeout(kWaitForUIElementTimeout, ^{ - UIViewController* presentedController = - viewController.presentedViewController; - return [presentedController class] == [QLPreviewController class]; - }); - GREYAssertFalse(shown, @"QLPreviewController should not have shown."); -#elif defined(CHROME_EARL_GREY_2) // EG2 test uses XCUIApplication API to check for Quick Look dialog UI // presentation. XCUIApplication* app = [[XCUIApplication alloc] init]; @@ -255,9 +183,6 @@ GREYAssertFalse( [goodTitle waitForExistenceWithTimeout:kWaitForARPresentationTimeout], @"AR preview dialog UI was presented"); -#else -#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2. -#endif } @end
diff --git a/ios/chrome/browser/ui/download/download_manager_egtest.mm b/ios/chrome/browser/ui/download/download_manager_egtest.mm index b9886c43..cd96e6f 100644 --- a/ios/chrome/browser/ui/download/download_manager_egtest.mm +++ b/ios/chrome/browser/ui/download/download_manager_egtest.mm
@@ -273,11 +273,6 @@ if ([ChromeEarlGrey isIPadIdiom]) EARL_GREY_TEST_SKIPPED(@"Test skipped on iPad."); -// Earl Grey 1 can't test UI elements out of Chrome process. -#if defined(CHROME_EARL_GREY_1) - EARL_GREY_TEST_SKIPPED(@"Test skipped on Earl Grey 1."); -#endif - [ChromeEarlGrey loadURL:self.testServer->GetURL("/")]; [ChromeEarlGrey waitForWebStateContainingText:"Download"]; [ChromeEarlGrey tapWebStateElementWithID:@"download"];
diff --git a/ios/chrome/browser/ui/download/pass_kit_egtest.mm b/ios/chrome/browser/ui/download/pass_kit_egtest.mm index ce0c8b8..05fd3a09 100644 --- a/ios/chrome/browser/ui/download/pass_kit_egtest.mm +++ b/ios/chrome/browser/ui/download/pass_kit_egtest.mm
@@ -23,14 +23,6 @@ #include "net/test/embedded_test_server/http_response.h" #include "ui/base/l10n/l10n_util_mac.h" -#if defined(CHROME_EARL_GREY_1) -#include "base/test/scoped_feature_list.h" -// EG1 test relies on view controller presentation as the signal that PassKit -// Dialog is shown. -#import "ios/chrome/app/main_controller.h" // nogncheck -#import "ios/chrome/browser/ui/browser_view/browser_view_controller.h" // nogncheck -#import "ios/chrome/test/app/chrome_test_util.h" // nogncheck -#endif #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -77,21 +69,11 @@ @end @implementation PassKitEGTest { -#if defined(CHROME_EARL_GREY_1) - base::test::ScopedFeatureList _featureList; -#endif } - (void)setUp { [super setUp]; -// Turn on Messages UI. -#if defined(CHROME_EARL_GREY_1) - _featureList.InitWithFeatures( - /*enabled_features=*/{kIOSInfobarUIReboot}, - /*disabled_features=*/{kInfobarUIRebootOnlyiOS13}); -#endif - self.testServer->RegisterRequestHandler(base::Bind(&GetResponse)); GREYAssertTrue(self.testServer->Start(), @"Test server failed to start."); } @@ -135,19 +117,6 @@ // PKAddPassesViewController UI is rendered out of host process so EarlGrey // matcher can not find PassKit Dialog UI. -#if defined(CHROME_EARL_GREY_1) - // EG1 test relies on view controller presentation as the signal that PassKit - // Dialog is shown. - id<BrowserInterface> interface = - chrome_test_util::GetMainController().interfaceProvider.mainInterface; - UIViewController* viewController = interface.viewController; - bool dialogShown = WaitUntilConditionOrTimeout(kWaitForDownloadTimeout, ^{ - UIViewController* presentedController = - viewController.presentedViewController; - return [presentedController class] == [PKAddPassesViewController class]; - }); - GREYAssert(dialogShown, @"PassKit dialog was not shown"); -#elif defined(CHROME_EARL_GREY_2) // EG2 test can use XCUIApplication API to check for PassKit dialog UI // presentation. XCUIApplication* app = [[XCUIApplication alloc] init]; @@ -159,9 +128,6 @@ } GREYAssert([title waitForExistenceWithTimeout:kWaitForDownloadTimeout], @"PassKit dialog UI was not presented"); -#else -#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2. -#endif } @end
diff --git a/ios/chrome/browser/ui/find_bar/find_in_page_egtest.mm b/ios/chrome/browser/ui/find_bar/find_in_page_egtest.mm index 4d8a34d..6aecf011 100644 --- a/ios/chrome/browser/ui/find_bar/find_in_page_egtest.mm +++ b/ios/chrome/browser/ui/find_bar/find_in_page_egtest.mm
@@ -25,14 +25,12 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(FindInPageControllerAppInterface); -#endif // defined(CHROME_EARL_GREY_2) namespace {
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_egtest.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_egtest.mm index 7d02160..bfe98e6 100644 --- a/ios/chrome/browser/ui/fullscreen/fullscreen_egtest.mm +++ b/ios/chrome/browser/ui/fullscreen/fullscreen_egtest.mm
@@ -112,20 +112,8 @@ // Verifies that the toolbar is not hidden when scrolling a short pdf, as the // entire document is visible without hiding the toolbar. -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1022029): Enable this test. -#define MAYBE_testSmallWidePDFScroll DISABLED_testSmallWidePDFScroll -#else -#define MAYBE_testSmallWidePDFScroll testSmallWidePDFScroll -#endif -- (void)MAYBE_testSmallWidePDFScroll { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1036221): EG1 Test fails on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 Fails on iOS 12."); - } -#endif - +- (void)DISABLED_testSmallWidePDFScroll { GURL URL = web::test::HttpServer::MakeUrl( "http://ios/testing/data/http_server_files/single_page_wide.pdf"); [ChromeEarlGrey loadURL:URL];
diff --git a/ios/chrome/browser/ui/infobars/infobar_egtest.mm b/ios/chrome/browser/ui/infobars/infobar_egtest.mm index 61c1792f..7f7a9591 100644 --- a/ios/chrome/browser/ui/infobars/infobar_egtest.mm +++ b/ios/chrome/browser/ui/infobars/infobar_egtest.mm
@@ -25,14 +25,12 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(InfobarManagerAppInterface); -#endif // defined(CHROME_EARL_GREY_2) using base::test::ios::WaitUntilConditionOrTimeout; @@ -44,20 +42,6 @@ NSString* condition_name = visible ? @"Waiting for infobar to show" : @"Waiting for infobar to hide"; id<GREYMatcher> expected_visibility = visible ? grey_notNil() : grey_nil(); -#if defined(CHROME_EARL_GREY_1) - CFTimeInterval kTimeout = 4.0; - [[GREYCondition - conditionWithName:condition_name - block:^BOOL { - NSError* error = nil; - [[EarlGrey - selectElementWithMatcher: - chrome_test_util::StaticTextWithAccessibilityLabel( - message)] assertWithMatcher:expected_visibility - error:&error]; - return error == nil; - }] waitWithTimeout:kTimeout]; -#elif defined(CHROME_EARL_GREY_2) BOOL bannerShown = WaitUntilConditionOrTimeout( kInfobarBannerDefaultPresentationDurationInSeconds, ^{ NSError* error = nil; @@ -72,9 +56,6 @@ }); GREYAssertTrue(bannerShown, condition_name); -#else -#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2. -#endif } } // namespace @@ -199,13 +180,6 @@ // Tests adding an Infobar on top of an existing one. - (void)testInfobarTopMostVisible { -// Turn on Messages UI. -#if defined(CHROME_EARL_GREY_1) - _featureList.InitWithFeatures( - /*enabled_features=*/{kIOSInfobarUIReboot}, - /*disabled_features=*/{kInfobarUIRebootOnlyiOS13}); -#endif - // Open a new tab and navigate to the test page. const GURL testURL = self.testServer->GetURL("/pony.html"); [ChromeEarlGrey loadURL:testURL]; @@ -244,13 +218,6 @@ // Tests that a taller Infobar layout is correct and the OK button is tappable. - (void)testInfobarTallerLayout { - // Turn on Messages UI. -#if defined(CHROME_EARL_GREY_1) - _featureList.InitWithFeatures( - /*enabled_features=*/{kIOSInfobarUIReboot}, - /*disabled_features=*/{kInfobarUIRebootOnlyiOS13}); -#endif - // Open a new tab and navigate to the test page. const GURL testURL = self.testServer->GetURL("/pony.html"); [ChromeEarlGrey loadURL:testURL];
diff --git a/ios/chrome/browser/ui/infobars/translate_infobar_egtest.mm b/ios/chrome/browser/ui/infobars/translate_infobar_egtest.mm index 115d3b6..ff9bdac 100644 --- a/ios/chrome/browser/ui/infobars/translate_infobar_egtest.mm +++ b/ios/chrome/browser/ui/infobars/translate_infobar_egtest.mm
@@ -248,19 +248,11 @@ @end @implementation TranslateInfobarTestCase { -#if defined(CHROME_EARL_GREY_1) - base::test::ScopedFeatureList _featureList; -#endif } - (void)setUp { [super setUp]; -#if defined(CHROME_EARL_GREY_1) - _featureList.InitWithFeatures( - /*enabled_features=*/{kIOSInfobarUIReboot}, - /*disabled_features=*/{kInfobarUIRebootOnlyiOS13}); -#endif // Set up the fake URL for the translate script to hit the mock HTTP server. GURL translateScriptURL = web::test::HttpServer::MakeUrl(
diff --git a/ios/chrome/browser/ui/main/BUILD.gn b/ios/chrome/browser/ui/main/BUILD.gn index f473dc2..9812939 100644 --- a/ios/chrome/browser/ui/main/BUILD.gn +++ b/ios/chrome/browser/ui/main/BUILD.gn
@@ -74,6 +74,7 @@ "//ios/chrome/app/application_delegate:app_state_header", "//ios/chrome/app/application_delegate:tab_opening", "//ios/chrome/app/application_delegate:url_opener_params", + "//ios/chrome/app/strings:ios_strings_grit", "//ios/chrome/browser", "//ios/chrome/browser:chrome_url_constants", "//ios/chrome/browser/browser_state", @@ -114,6 +115,7 @@ "//ios/public/provider/chrome/browser/mailto", "//ios/public/provider/chrome/browser/signin", "//ios/public/provider/chrome/browser/user_feedback", + "//ui/base:base", ] public_deps = [ ":scene_state_header", @@ -179,7 +181,7 @@ "//ios/chrome/browser/ui/thumb_strip:feature_flags", "//ios/chrome/browser/ui/translate:legacy_translate", "//ios/chrome/browser/ui/util:multiwindow_util", - "//ios/chrome/browser/url_loading", + "//ios/chrome/browser/url_loading:url_loading_params_header", "//ios/chrome/browser/web", "//ios/chrome/browser/web:tab_helper_delegates", "//ios/chrome/browser/web:web_internal",
diff --git a/ios/chrome/browser/ui/main/scene_controller.mm b/ios/chrome/browser/ui/main/scene_controller.mm index 98e6d693..31cd3e8 100644 --- a/ios/chrome/browser/ui/main/scene_controller.mm +++ b/ios/chrome/browser/ui/main/scene_controller.mm
@@ -5,6 +5,7 @@ #import "ios/chrome/browser/ui/main/scene_controller.h" #include "base/bind_helpers.h" +#include "base/i18n/message_formatter.h" #import "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" @@ -81,6 +82,7 @@ #import "ios/chrome/browser/web_state_list/web_state_list.h" #import "ios/chrome/browser/web_state_list/web_state_list_observer_bridge.h" #import "ios/chrome/browser/window_activities/window_activity_helpers.h" +#include "ios/chrome/grit/ios_strings.h" #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" #include "ios/public/provider/chrome/browser/mailto/mailto_handler_provider.h" #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" @@ -88,6 +90,7 @@ #include "ios/web/public/thread/web_task_traits.h" #import "ios/web/public/web_state.h" #import "net/base/mac/url_conversions.h" +#include "ui/base/l10n/l10n_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -313,6 +316,14 @@ } } + // When the scene transitions to inactive (such as when it's being shown in + // the OS app-switcher), update the title for display on iPadOS. + if (@available(iOS 13, *)) { + if (level == SceneActivationLevelForegroundInactive) { + sceneState.scene.title = [self displayTitleForAppSwitcher]; + } + } + if (level == SceneActivationLevelForegroundActive) { if (![self presentSigninUpgradePromoIfPossible]) { [self presentSignInAccountsViewControllerIfNecessary]; @@ -732,6 +743,35 @@ [self.sceneState.appState removeObserver:self]; } +// Formats string for display on iPadOS application switcher with the +// domain of the foreground tab and the tab count. Assumes the scene is +// visible. Will return nil if there are no tabs. +- (NSString*)displayTitleForAppSwitcher { + DCHECK(self.currentInterface.browser); + web::WebState* webState = + self.currentInterface.browser->GetWebStateList()->GetActiveWebState(); + if (!webState) + return nil; + + // At this point there is at least one tab. + int numberOfTabs = self.currentInterface.browser->GetWebStateList()->count(); + DCHECK(numberOfTabs > 0); + GURL url = webState->GetVisibleURL(); + base::string16 urlText = url_formatter::FormatUrl( + url, + url_formatter::kFormatUrlOmitDefaults | + url_formatter::kFormatUrlOmitTrivialSubdomains | + url_formatter::kFormatUrlOmitHTTPS | + url_formatter::kFormatUrlTrimAfterHost, + net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); + base::string16 pattern = + l10n_util::GetStringUTF16(IDS_IOS_APP_SWITCHER_SCENE_TITLE); + base::string16 formattedTitle = + base::i18n::MessageFormatter::FormatWithNamedArgs( + pattern, "domain", urlText, "count", numberOfTabs - 1); + return base::SysUTF16ToNSString(formattedTitle); +} + #pragma mark - First Run // Initializes the first run UI and presents it to the user.
diff --git a/ios/chrome/browser/ui/main/scene_state.h b/ios/chrome/browser/ui/main/scene_state.h index d689aec..c6c0988 100644 --- a/ios/chrome/browser/ui/main/scene_state.h +++ b/ios/chrome/browser/ui/main/scene_state.h
@@ -76,6 +76,9 @@ @property(nonatomic, strong, readonly) id<BrowserInterfaceProvider> interfaceProvider; +// The persistent identifier for the scene session. +@property(nonatomic, readonly) NSString* sceneSessionID; + // True if First Run UI (terms of service & sync sign-in) is being presented // in a modal dialog. @property(nonatomic, assign) BOOL presentingFirstRunUI;
diff --git a/ios/chrome/browser/ui/main/scene_state.mm b/ios/chrome/browser/ui/main/scene_state.mm index 264b125..c3222ad 100644 --- a/ios/chrome/browser/ui/main/scene_state.mm +++ b/ios/chrome/browser/ui/main/scene_state.mm
@@ -96,6 +96,14 @@ return _window; } +- (NSString*)sceneSessionID { + NSString* sessionID = nil; + if (@available(ios 13, *)) { + sessionID = _scene.session.persistentIdentifier; + } + return sessionID; +} + - (void)setActivationLevel:(SceneActivationLevel)newLevel { if (_activationLevel == newLevel) { return;
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_egtest.mm b/ios/chrome/browser/ui/omnibox/omnibox_egtest.mm index 4955436..bcbd588 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_egtest.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_egtest.mm
@@ -27,7 +27,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113) The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -35,7 +34,6 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(OmniboxAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) using base::test::ios::kWaitForUIElementTimeout; @@ -150,13 +148,7 @@ // Tests that the XClientData header is sent when navigating to // https://google.com through the omnibox. -#if defined(CHROME_EARL_GREY_1) -// Flaky on EG1. -#define MAYBE_testXClientData DISABLED_testXClientData -#else -#define MAYBE_testXClientData testXClientData -#endif -- (void)MAYBE_testXClientData { +- (void)testXClientData { // TODO(crbug.com/1067815): Test doesn't pass on iPad device. #if !TARGET_IPHONE_SIMULATOR if ([ChromeEarlGrey isIPadIdiom]) {
diff --git a/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_egtest.mm b/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_egtest.mm index 6230ba6..aa24979 100644 --- a/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_egtest.mm +++ b/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_egtest.mm
@@ -316,14 +316,12 @@ // Tests that switching to closed tab opens the tab in foreground, except if it // is from NTP without history. - (void)testSwitchToClosedTab { -#if defined(CHROME_EARL_GREY_2) if (@available(iOS 13, *)) { if ([ChromeEarlGrey isIPadIdiom]) { // TODO(crbug.com/992480):test fails on iPad. EARL_GREY_TEST_DISABLED(@"Test disabled on iPad."); } } -#endif // TODO(crbug.com/1067817): Test won't pass on iPad devices. #if !TARGET_IPHONE_SIMULATOR if ([ChromeEarlGrey isIPadIdiom]) {
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_egtest.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_egtest.mm index 95dcebf..468984b 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_egtest.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_egtest.mm
@@ -34,11 +34,7 @@ // in landscape. - (void)tearDown { [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait -#if defined(CHROME_EARL_GREY_1) - errorOrNil:nil]; -#elif defined(CHROME_EARL_GREY_2) error:nil]; -#endif [super tearDown]; } @@ -131,11 +127,7 @@ assertWithMatcher:grey_sufficientlyVisible()]; [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeRight -#if defined(CHROME_EARL_GREY_1) - errorOrNil:nil]; -#elif defined(CHROME_EARL_GREY_2) error:nil]; -#endif // Expect that the tools menu has disappeared. [[EarlGrey selectElementWithMatcher:chrome_test_util::ToolsMenuView()] @@ -159,12 +151,6 @@ // Navigates to a pdf page and verifies that the "Find in Page..." tool // is not enabled - (void)testNoSearchForPDF { -#if defined(CHROME_EARL_GREY_1) - // TODO(crbug.com/1036078): EG1 Test flaky on iOS 12. - if (!base::ios::IsRunningOnIOS13OrLater()) { - EARL_GREY_TEST_DISABLED(@"EG1 flaky on iOS 12."); - } -#endif const GURL URL = web::test::HttpServer::MakeUrl(kPDFURL); // Navigate to a mock pdf and verify that the find button is disabled.
diff --git a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm index 4b4fedd..7269f32 100644 --- a/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm +++ b/ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm
@@ -55,14 +55,12 @@ DISALLOW_COPY_AND_ASSIGN(ScopedQRScannerVoiceSearchOverride); }; -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113) The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(QRScannerAppInterface); -#endif // defined(CHROME_EARL_GREY_2) namespace { @@ -652,15 +650,7 @@ } // Tests that an error dialog is dismissed if the camera becomes available. -// TODO(crbug.com/1036094): Re-enable test on device. -#if defined(CHROME_EARL_GREY_1) && !TARGET_IPHONE_SIMULATOR -#define MAYBE_testDialogDismissedIfCameraBecomesAvailable \ - DISABLED_testDialogDismissedIfCameraBecomesAvailable -#else -#define MAYBE_testDialogDismissedIfCameraBecomesAvailable \ - testDialogDismissedIfCameraBecomesAvailable -#endif -- (void)MAYBE_testDialogDismissedIfCameraBecomesAvailable { +- (void)testDialogDismissedIfCameraBecomesAvailable { id cameraControllerMock = [QRScannerAppInterface cameraControllerMockWithAuthorizationStatus: AVAuthorizationStatusAuthorized];
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_app_interface_stub.mm b/ios/chrome/browser/ui/reading_list/reading_list_app_interface_stub.mm index 6b9b328..4fb811a 100644 --- a/ios/chrome/browser/ui/reading_list/reading_list_app_interface_stub.mm +++ b/ios/chrome/browser/ui/reading_list/reading_list_app_interface_stub.mm
@@ -9,7 +9,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -17,4 +16,3 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ReadingListAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2)
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm b/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm index c188fd8..a82b7f3 100644 --- a/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm +++ b/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm
@@ -664,15 +664,7 @@ // Tests that only the "Cancel", "Delete" and "Mark Unread" buttons are showing // when not editing. -// TODO(crbug.com/1036071): EG1 Test flaky on device. -#if defined(CHROME_EARL_GREY_1) && !TARGET_IPHONE_SIMULATOR -#define MAYBE_testVisibleButtonsOnlyReadEntrySelected \ - DISABLED_testVisibleButtonsOnlyReadEntrySelected -#else -#define MAYBE_testVisibleButtonsOnlyReadEntrySelected \ - testVisibleButtonsOnlyReadEntrySelected -#endif -- (void)MAYBE_testVisibleButtonsOnlyReadEntrySelected { +- (void)testVisibleButtonsOnlyReadEntrySelected { AddEntriesAndEnterEdit(); TapEntry(kReadTitle); @@ -685,15 +677,7 @@ // Tests that the "Cancel", "Edit" and "Mark Unread" buttons are not visible // after delete (using swipe). -// TODO(crbug.com/1036071): EG1 Test flaky on device. -#if defined(CHROME_EARL_GREY_1) && !TARGET_IPHONE_SIMULATOR -#define MAYBE_testVisibleButtonsAfterSwipeDeletion \ - DISABLED_testVisibleButtonsAfterSwipeDeletion -#else -#define MAYBE_testVisibleButtonsAfterSwipeDeletion \ - testVisibleButtonsAfterSwipeDeletion -#endif -- (void)MAYBE_testVisibleButtonsAfterSwipeDeletion { +- (void)testVisibleButtonsAfterSwipeDeletion { // Reading list's view width is narrower on Ipad Air (iOS 12) than on other // devices. The grey_swipeSlowInDirection action deletes the element instead // of displaying the 'Delete' button. @@ -743,15 +727,7 @@ // Tests that only the "Cancel", "Delete" and "Mark…" buttons are showing when // not editing. -// TODO(crbug.com/1036071): EG1 Test flaky on device. -#if defined(CHROME_EARL_GREY_1) && !TARGET_IPHONE_SIMULATOR -#define MAYBE_testVisibleButtonsMixedEntriesSelected \ - DISABLED_testVisibleButtonsMixedEntriesSelected -#else -#define MAYBE_testVisibleButtonsMixedEntriesSelected \ - testVisibleButtonsMixedEntriesSelected -#endif -- (void)MAYBE_testVisibleButtonsMixedEntriesSelected { +- (void)testVisibleButtonsMixedEntriesSelected { AddEntriesAndEnterEdit(); TapEntry(kReadTitle); TapEntry(kUnreadTitle); @@ -893,13 +869,7 @@ } // Selects an read entry and mark it as unread. -// TODO(crbug.com/1036071): EG1 Test flaky on device. -#if defined(CHROME_EARL_GREY_1) && !TARGET_IPHONE_SIMULATOR -#define MAYBE_testMarkEntriesUnread DISABLED_testMarkEntriesUnread -#else -#define MAYBE_testMarkEntriesUnread testMarkEntriesUnread -#endif -- (void)MAYBE_testMarkEntriesUnread { +- (void)testMarkEntriesUnread { AddEntriesAndEnterEdit(); TapEntry(kReadTitle); @@ -914,13 +884,7 @@ } // Selects read and unread entries and mark them as unread. -// TODO(crbug.com/1036071): EG1 Test flaky on device. -#if defined(CHROME_EARL_GREY_1) && !TARGET_IPHONE_SIMULATOR -#define MAYBE_testMarkMixedEntriesUnread DISABLED_testMarkMixedEntriesUnread -#else -#define MAYBE_testMarkMixedEntriesUnread testMarkMixedEntriesUnread -#endif -- (void)MAYBE_testMarkMixedEntriesUnread { +- (void)testMarkMixedEntriesUnread { AddEntriesAndEnterEdit(); TapEntry(kReadTitle); TapEntry(kUnreadTitle);
diff --git a/ios/chrome/browser/ui/safe_mode/safe_mode_egtest.mm b/ios/chrome/browser/ui/safe_mode/safe_mode_egtest.mm index 92fed87..0581204 100644 --- a/ios/chrome/browser/ui/safe_mode/safe_mode_egtest.mm +++ b/ios/chrome/browser/ui/safe_mode/safe_mode_egtest.mm
@@ -20,9 +20,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(SafeModeAppInterface) -#endif // defined(CHROME_EARL_GREY_2) using chrome_test_util::ButtonWithAccessibilityLabel;
diff --git a/ios/chrome/browser/ui/settings/block_popups_egtest.mm b/ios/chrome/browser/ui/settings/block_popups_egtest.mm index 39ffb2c..13bdc867 100644 --- a/ios/chrome/browser/ui/settings/block_popups_egtest.mm +++ b/ios/chrome/browser/ui/settings/block_popups_egtest.mm
@@ -24,14 +24,12 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(BlockPopupsAppInterface); -#endif // defined(CHROME_EARL_GREY_2) using chrome_test_util::ContentSettingsButton; using chrome_test_util::SettingsDoneButton;
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_egtest.mm b/ios/chrome/browser/ui/settings/google_services/google_services_settings_egtest.mm index bdf384a80..626fc1f 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_egtest.mm
@@ -25,12 +25,10 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(GoogleServicesSettingsAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) using l10n_util::GetNSString; using chrome_test_util::AddAccountButton;
diff --git a/ios/chrome/browser/ui/settings/language/language_settings_app_interface_stub.mm b/ios/chrome/browser/ui/settings/language/language_settings_app_interface_stub.mm index c58b4772..8fca96d61 100644 --- a/ios/chrome/browser/ui/settings/language/language_settings_app_interface_stub.mm +++ b/ios/chrome/browser/ui/settings/language/language_settings_app_interface_stub.mm
@@ -9,7 +9,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -17,4 +16,3 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(LanguageSettingsAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2)
diff --git a/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm b/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm index fa06b2a7..6e7af91 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm
@@ -26,15 +26,12 @@ #include "ios/web/public/test/element_selector.h" #include "ui/base/l10n/l10n_util.h" -#if defined(CHROME_EARL_GREY_2) #include "ios/third_party/earl_grey2/src/CommonLib/Matcher/GREYLayoutConstraint.h" // nogncheck -#endif // defined(CHROME_EARL_GREY_2) #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113) The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -42,7 +39,6 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(PasswordSettingsAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) // This test complements // password_details_collection_view_controller_unittest.mm. Very simple @@ -224,7 +220,6 @@ grey_userInteractionEnabled(), nil); } -#if defined(CHROME_EARL_GREY_2) // Matches the pop-up (call-out) menu item with accessibility label equal to the // translated string identified by |label|. id<GREYMatcher> PopUpMenuItemWithLabel(int label) { @@ -251,60 +246,7 @@ nullptr); } } -#endif // defined(CHROME_EARL_GREY_2) -#if defined(CHROME_EARL_GREY_1) -// This is similar to grey_ancestor, but only limited to the immediate parent. -id<GREYMatcher> MatchParentWith(id<GREYMatcher> parentMatcher) { - GREYMatchesBlock matches = ^BOOL(id element) { - id parent = [element isKindOfClass:[UIView class]] - ? [element superview] - : [element accessibilityContainer]; - return (parent && [parentMatcher matches:parent]); - }; - GREYDescribeToBlock describe = ^void(id<GREYDescription> description) { - [description appendText:[NSString stringWithFormat:@"parentThatMatches(%@)", - parentMatcher]]; - }; - return grey_allOf( - grey_anyOf(grey_kindOfClassName(@"UIView"), - grey_respondsToSelector(@selector(accessibilityContainer)), - nil), - [[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches - descriptionBlock:describe], - nil); -} - -// Matches the pop-up (call-out) menu item with accessibility label equal to the -// translated string identified by |label|. -id<GREYMatcher> PopUpMenuItemWithLabel(int label) { - if (@available(iOS 13, *)) { - // iOS13 reworked menu button subviews to no longer be accessibility - // elements. Multiple menu button subviews no longer show up as potential - // matches, which means the matcher logic does not need to be as complex as - // the iOS 11/12 logic. Various table view cells may share the same - // accesibility label, but those can be filtered out by ignoring - // UIAccessibilityTraitButton. - return grey_allOf( - grey_accessibilityLabel(l10n_util::GetNSString(label)), - grey_not(grey_accessibilityTrait(UIAccessibilityTraitButton)), nil); - } else { - // This is a hack relying on UIKit's internal structure. There are multiple - // items with the label the test is looking for, because the menu items - // likely have the same labels as the buttons for the same function. There - // is no easy way to identify elements which are part of the pop-up, because - // the associated classes are internal to UIKit. However, the pop-up items - // are composed of a button-type element (without accessibility traits of a - // button) owning a label, both with the same accessibility labels. This is - // differentiating the pop-up items from the other buttons. - return grey_allOf( - grey_accessibilityLabel(l10n_util::GetNSString(label)), - MatchParentWith(grey_accessibilityLabel(l10n_util::GetNSString(label))), - nullptr); - } -} - -#endif // defined(CHROME_EARL_GREY_1) // Saves an example form in the store. void SaveExamplePasswordForm() {
diff --git a/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm b/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm index 74218e01..79b2d6d 100644 --- a/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm +++ b/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm
@@ -178,7 +178,13 @@ } - (void)showUpdateAtLocation:(NSString*)location { - // TODO(crbug.com/1078782): Add navigation to various app update locations. + if (!location) { + NOTREACHED(); + return; + } + const GURL url(base::SysNSStringToUTF8(location)); + OpenNewTabCommand* command = [OpenNewTabCommand commandWithURLFromChrome:url]; + [self.handler closeSettingsUIAndOpenURL:command]; } - (void)showSafeBrowsingPreferencePage {
diff --git a/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator.mm b/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator.mm index 4ea058f..79aa4dc 100644 --- a/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator.mm +++ b/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator.mm
@@ -39,6 +39,7 @@ #import "ios/chrome/browser/ui/table_view/cells/table_view_text_item.h" #import "ios/chrome/browser/ui/ui_feature_flags.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" +#include "ios/chrome/browser/upgrade/upgrade_constants.h" #include "ios/chrome/browser/upgrade/upgrade_recommended_details.h" #include "ios/chrome/browser/upgrade/upgrade_utils.h" #include "ios/chrome/common/channel_info.h" @@ -94,8 +95,6 @@ UpdateCheckRowStateOmahaError, // When there is a connectivity issue. UpdateCheckRowStateNetError, - // When the device is too old and no longer able to update. - UpdateCheckRowStateUnableUpdate, // When the device is on a non-supported channel. UpdateCheckRowStateChannel, }; @@ -382,10 +381,13 @@ case UpdateCheckRowStateManaged: // i tap: Managed state popover. case UpdateCheckRowStateOmahaError: // i tap: Show error popover. case UpdateCheckRowStateNetError: // i tap: Show error popover. - case UpdateCheckRowStateUnableUpdate: // i tap: Show error popover. break; - case UpdateCheckRowStateOutOfDate: // i tap: Go to app store. + case UpdateCheckRowStateOutOfDate: { // i tap: Go to app store. + NSString* updateLocation = [[NSUserDefaults standardUserDefaults] + stringForKey:kIOSChromeUpgradeURLKey]; + [self.handler showUpdateAtLocation:updateLocation]; break; + } } break; } @@ -542,8 +544,6 @@ message = l10n_util::GetNSString( IDS_IOS_SETTINGS_SAFETY_CHECK_UPDATES_OFFLINE_INFO); break; - case UpdateCheckRowStateUnableUpdate: - return nil; case UpdateCheckRowStateChannel: break; } @@ -683,6 +683,29 @@ // The display should be changed to loading icons before any checks are // started. if (self.checksRemaining) { + // Only perfom update check on supported channels. + switch (::GetChannel()) { + case version_info::Channel::STABLE: + case version_info::Channel::BETA: + case version_info::Channel::DEV: { + [self performUpdateCheck]; + break; + } + case version_info::Channel::CANARY: + case version_info::Channel::UNKNOWN: { + // Want to show the loading wheel momentarily. + dispatch_after( + dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.75 * NSEC_PER_SEC)), + dispatch_get_main_queue(), ^{ + // Check if the check was cancelled while waiting. + if (self.checksRemaining) { + self.updateCheckRowState = UpdateCheckRowStateChannel; + [self reconfigureUpdateCheckItem]; + } + }); + break; + } + } // This handles a discrepancy between password check and safety check. In // password check a user cannot start a check if they have no passwords, but // in safety check they can, but the |passwordCheckManager| won't even start @@ -709,22 +732,10 @@ if (self.checksRemaining) [self checkAndReconfigureSafeBrowsingState]; }); - - [self performUpdateCheck]; } return; } -// Updates |updateCheckItem| to reflect the device being offline if the check -// was running. -- (void)handleUpdateCheckOffline { - if (self.updateCheckRowState == UpdateCheckRowStateRunning) { - self.updateCheckRowState = UpdateCheckRowStateNetError; - - [self reconfigureUpdateCheckItem]; - } -} - // Checks if any of the safety checks are still running, resets |checkStartItem| // if all checks have finished. - (void)resetsCheckStartItemIfNeeded { @@ -760,6 +771,16 @@ return updateCheckRunning || passwordCheckRunning || safeBrowsingCheckRunning; } +// Updates |updateCheckItem| to reflect the device being offline if the check +// was running. +- (void)handleUpdateCheckOffline { + if (self.updateCheckRowState == UpdateCheckRowStateRunning) { + self.updateCheckRowState = UpdateCheckRowStateNetError; + + [self reconfigureUpdateCheckItem]; + } +} + // Verifies if the Omaha service returned an answer, if not sets // |updateCheckItem| to an Omaha error state. - (void)verifyUpdateCheckComplete { @@ -771,11 +792,57 @@ return; } +- (void)handleOmahaResponse:(const UpgradeRecommendedDetails&)details { + // If before the response the check was canceled, or Omaha assumed faulty, + // do nothing. + if (self.updateCheckRowState != UpdateCheckRowStateRunning) { + return; + } + + const GURL& upgradeUrl = details.upgrade_url; + + if (!upgradeUrl.is_valid()) { + self.updateCheckRowState = UpdateCheckRowStateOmahaError; + [self reconfigureUpdateCheckItem]; + return; + } + + if (!details.next_version.size() || + !base::Version(details.next_version).IsValid()) { + self.updateCheckRowState = UpdateCheckRowStateOmahaError; + [self reconfigureUpdateCheckItem]; + return; + } + + // Valid results, update NSUserDefaults. + NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; + + [defaults setValue:base::SysUTF8ToNSString(upgradeUrl.spec()) + forKey:kIOSChromeUpgradeURLKey]; + [defaults setValue:base::SysUTF8ToNSString(details.next_version) + forKey:kIOSChromeNextVersionKey]; + [defaults setBool:details.is_up_to_date forKey:kIOSChromeUpToDateKey]; + + if (details.is_up_to_date) { + self.updateCheckRowState = UpdateCheckRowStateUpToDate; + } else { + self.updateCheckRowState = UpdateCheckRowStateOutOfDate; + // Treat the safety check finding the device out of date as if the update + // infobar was just shown to not overshow the infobar to the user. + [defaults setObject:[NSDate date] forKey:kLastInfobarDisplayTimeKey]; + } + [self reconfigureUpdateCheckItem]; + return; +} + // Performs the update check and triggers the display update to // |updateCheckItem|. - (void)performUpdateCheck { __weak __typeof__(self) weakSelf = self; - // TODO(crbug.com/1078782): Add Omaha support after refactor. + + OmahaService::CheckNow(base::BindOnce(^(UpgradeRecommendedDetails details) { + [weakSelf handleOmahaResponse:details]; + })); // If after 30 seconds the Omaha server has not responded, assume Omaha error. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30 * NSEC_PER_SEC)), @@ -861,12 +928,6 @@ GetNSString(IDS_IOS_SETTINGS_SAFETY_CHECK_UPDATES_OFFLINE_DESC); break; } - case UpdateCheckRowStateUnableUpdate: { - self.updateCheckItem.infoButtonHidden = NO; - self.updateCheckItem.detailText = - GetNSString(IDS_IOS_SETTINGS_SAFETY_CHECK_UPDATES_OUT_OF_DATE_DESC); - break; - } case UpdateCheckRowStateChannel: { switch (::GetChannel()) { case version_info::Channel::STABLE:
diff --git a/ios/chrome/browser/ui/settings/settings_egtest.mm b/ios/chrome/browser/ui/settings/settings_egtest.mm index 38cdbaa..369faee 100644 --- a/ios/chrome/browser/ui/settings/settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/settings_egtest.mm
@@ -30,14 +30,12 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(SettingsAppInterface); -#endif // defined(CHROME_EARL_GREY_2) using chrome_test_util::ButtonWithAccessibilityLabelId; using chrome_test_util::ClearBrowsingDataButton;
diff --git a/ios/chrome/browser/ui/settings/signin_settings_egtest.mm b/ios/chrome/browser/ui/settings/signin_settings_egtest.mm index 835c8d3..4eb24d8 100644 --- a/ios/chrome/browser/ui/settings/signin_settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/signin_settings_egtest.mm
@@ -20,12 +20,10 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(SigninSettingsAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) using chrome_test_util::PrimarySignInButton; using chrome_test_util::SecondarySignInButton;
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_mediator.mm b/ios/chrome/browser/ui/tab_grid/tab_grid_mediator.mm index 90eac23..16e928a 100644 --- a/ios/chrome/browser/ui/tab_grid/tab_grid_mediator.mm +++ b/ios/chrome/browser/ui/tab_grid/tab_grid_mediator.mm
@@ -459,10 +459,9 @@ } // Handle URLs from within Chrome synchronously using a local object. - if ([dragItem.localObject isKindOfClass:[NSURL class]]) { - NSURL* droppedURL = static_cast<NSURL*>(dragItem.localObject); - [self insertNewItemAtIndex:destinationIndex - withURL:net::GURLWithNSURL(droppedURL)]; + if ([dragItem.localObject isKindOfClass:[URLInfo class]]) { + URLInfo* droppedURL = static_cast<URLInfo*>(dragItem.localObject); + [self insertNewItemAtIndex:destinationIndex withURL:droppedURL.URL]; return; } }
diff --git a/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm b/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm index c494cde..3b5ade5f 100644 --- a/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm +++ b/ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.mm
@@ -1158,6 +1158,10 @@ - (void)gridViewController:(GridViewController*)gridViewController didChangeItemCount:(NSUInteger)count { + if (count > 0) { + // Undo is only available when the tab grid is empty. + self.undoCloseAllAvailable = NO; + } [self configureButtonsForActiveAndCurrentPage]; if (gridViewController == self.regularTabsViewController) { self.topToolbar.pageControl.regularTabCount = count; @@ -1247,10 +1251,11 @@ self.regularTabsViewController.gridEmpty); if (self.undoCloseAllAvailable) { [self.regularTabsDelegate undoCloseAllItems]; + self.undoCloseAllAvailable = NO; } else { [self.regularTabsDelegate saveAndCloseAllItems]; + self.undoCloseAllAvailable = YES; } - self.undoCloseAllAvailable = !self.undoCloseAllAvailable; [self configureCloseAllButtonForCurrentPageAndUndoAvailability]; break; case TabGridPageRemoteTabs:
diff --git a/ios/chrome/browser/ui/tab_strip/BUILD.gn b/ios/chrome/browser/ui/tab_strip/BUILD.gn index 42536c5..7d7d7c1 100644 --- a/ios/chrome/browser/ui/tab_strip/BUILD.gn +++ b/ios/chrome/browser/ui/tab_strip/BUILD.gn
@@ -23,6 +23,8 @@ sources = [ "tab_strip_view_controller.h", "tab_strip_view_controller.mm", + "tab_strip_view_layout.h", + "tab_strip_view_layout.mm", ] deps = [ "//ios/chrome/browser/browser_state",
diff --git a/ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.h b/ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.h index d676feb0..2771660 100644 --- a/ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.h +++ b/ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.h
@@ -7,13 +7,20 @@ #import <UIKit/UIKit.h> -@protocol PopupMenuLongPressDelegate; - // ViewController for the TabStrip. This ViewController is contained by // BrowserViewController. This TabStripViewController is responsible for // responding to the different updates in the tabstrip view. @interface TabStripViewController : UICollectionViewController +- (instancetype)init NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithNibName:(NSString*)nibNameOrNil + bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; +- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; + +- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout*)layout + NS_UNAVAILABLE; + @end #endif // IOS_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.mm b/ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.mm index 53fa170..0fb94766 100644 --- a/ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.mm +++ b/ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.mm
@@ -4,10 +4,23 @@ #import "ios/chrome/browser/ui/tab_strip/tab_strip_view_controller.h" +#import "ios/chrome/browser/ui/tab_strip/tab_strip_view_layout.h" + #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @implementation TabStripViewController +- (instancetype)init { + TabStripViewLayout* layout = [[TabStripViewLayout alloc] init]; + self = [super initWithCollectionViewLayout:layout]; + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.translatesAutoresizingMaskIntoConstraints = NO; +} + @end
diff --git a/ios/chrome/browser/ui/tab_strip/tab_strip_view_layout.h b/ios/chrome/browser/ui/tab_strip/tab_strip_view_layout.h new file mode 100644 index 0000000..ae690bb --- /dev/null +++ b/ios/chrome/browser/ui/tab_strip/tab_strip_view_layout.h
@@ -0,0 +1,17 @@ +// 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 IOS_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_VIEW_LAYOUT_H_ +#define IOS_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_VIEW_LAYOUT_H_ + +#import <UIKit/UIKit.h> + +// Layout used for TabStripView. This layout makes sure the tabs collection +// is pinned to the top of view and the sizes of the resizable tabs are +// correct. +@interface TabStripViewLayout : UICollectionViewLayout + +@end + +#endif // IOS_CHROME_BROWSER_UI_TAB_STRIP_TAB_STRIP_VIEW_LAYOUT_H_
diff --git a/ios/chrome/browser/ui/tab_strip/tab_strip_view_layout.mm b/ios/chrome/browser/ui/tab_strip/tab_strip_view_layout.mm new file mode 100644 index 0000000..a0498d1d --- /dev/null +++ b/ios/chrome/browser/ui/tab_strip/tab_strip_view_layout.mm
@@ -0,0 +1,88 @@ +// 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. + +#import "ios/chrome/browser/ui/tab_strip/tab_strip_view_layout.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +// Tab dimensions. +const CGFloat kTabOverlapStacked = 32.0; +const CGFloat kMinTabWidthStacked = 200.0; + +} // namespace + +@implementation TabStripViewLayout + +- (CGSize)collectionViewContentSize { + UICollectionView* collection = self.collectionView; + NSInteger num = [collection numberOfItemsInSection:0]; + + CGFloat width = kMinTabWidthStacked * num; + width -= (num - 1) * kTabOverlapStacked; + width = MAX(width, collection.bounds.size.width); + return CGSizeMake(width, collection.bounds.size.height); +} + +// Retrieves layout information for an item at the specified index path +// with a corresponding cell. +- (UICollectionViewLayoutAttributes*)layoutAttributesForItemAtIndexPath: + (NSIndexPath*)indexPath { + UICollectionView* collection = self.collectionView; + CGRect bounds = collection.bounds; + + // Calculating tab's length size depending on the number of tabs. + CGFloat x = indexPath.row * kMinTabWidthStacked; + if (indexPath.row > 0) { + x -= (kTabOverlapStacked * indexPath.row); + } + + x = MAX(x, bounds.origin.x); + + UICollectionViewLayoutAttributes* attr = [UICollectionViewLayoutAttributes + layoutAttributesForCellWithIndexPath:indexPath]; + attr.frame = + CGRectMake(x, bounds.origin.y, kMinTabWidthStacked, bounds.size.height); + return attr; +} + +- (NSArray<UICollectionViewLayoutAttributes*>*) + layoutAttributesForElementsInRect:(CGRect)rect { + NSInteger count = [self.collectionView numberOfItemsInSection:0]; + + NSMutableArray* result = + [NSMutableArray arrayWithCapacity:CGRectGetWidth(rect) / 190]; + CGFloat x = CGRectGetMinX(rect); + NSInteger i = 0; + while (x < CGRectGetMaxX(rect) && i < count) { + // Modifies Layout attributes. + UICollectionViewLayoutAttributes* attr = [self + layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForRow:i + inSection:0]]; + [result addObject:attr]; + x = CGRectGetMaxX(attr.frame); + i++; + } + return result; +} + +- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { + return YES; +} + +- (UICollectionViewLayoutAttributes*) + initialLayoutAttributesForAppearingItemAtIndexPath: + (NSIndexPath*)itemIndexPath { + UICollectionViewLayoutAttributes* attr = + [self layoutAttributesForItemAtIndexPath:itemIndexPath]; + CGRect frame = attr.frame; + frame.origin.y = CGRectGetMaxY(frame); + attr.frame = frame; + return attr; +} + +@end
diff --git a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_egtest.mm b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_egtest.mm index f5b4265c..727e384 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_egtest.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_egtest.mm
@@ -27,7 +27,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113) The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -35,7 +34,6 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(AdaptiveToolbarAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) namespace { @@ -354,12 +352,8 @@ UIViewController* TopPresentedViewController() { UIViewController* rootViewController = -#if defined(CHROME_EARL_GREY_1) - [[UIApplication sharedApplication] keyWindow].rootViewController; -#else [[GREY_REMOTE_CLASS_IN_APP(UIApplication) sharedApplication] keyWindow] .rootViewController; -#endif return TopPresentedViewControllerFrom(rootViewController); }
diff --git a/ios/chrome/browser/url_loading/BUILD.gn b/ios/chrome/browser/url_loading/BUILD.gn index 86102b08..ce2983f 100644 --- a/ios/chrome/browser/url_loading/BUILD.gn +++ b/ios/chrome/browser/url_loading/BUILD.gn
@@ -48,6 +48,16 @@ ] } +source_set("url_loading_params_header") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ "url_loading_params.h" ] + deps = [ + "//ios/chrome/browser/ui/commands", + "//ios/web/public", + "//ui/base", + ] +} + source_set("test_support") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true
diff --git a/ios/chrome/browser/web/child_window_open_by_dom_egtest.mm b/ios/chrome/browser/web/child_window_open_by_dom_egtest.mm index 4158b71..aa8c2db0 100644 --- a/ios/chrome/browser/web/child_window_open_by_dom_egtest.mm +++ b/ios/chrome/browser/web/child_window_open_by_dom_egtest.mm
@@ -71,19 +71,10 @@ @implementation ChildWindowOpenByDOMTestCase -#if defined(CHROME_EARL_GREY_2) + (void)setUpForTestCase { [super setUpForTestCase]; [self setUpHelper]; } -#elif defined(CHROME_EARL_GREY_1) -+ (void)setUp { - [super setUp]; - [self setUpHelper]; -} -#else -#error Not an EarlGrey Test -#endif + (void)setUpHelper { [ChromeEarlGrey setContentSettings:CONTENT_SETTING_ALLOW];
diff --git a/ios/chrome/browser/web/lookalike_url_egtest.mm b/ios/chrome/browser/web/lookalike_url_egtest.mm index 62d569f..d806f43 100644 --- a/ios/chrome/browser/web/lookalike_url_egtest.mm +++ b/ios/chrome/browser/web/lookalike_url_egtest.mm
@@ -26,12 +26,10 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(LookalikeUrlAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) using chrome_test_util::BackButton; using chrome_test_util::ForwardButton;
diff --git a/ios/chrome/browser/web/progress_indicator_egtest.mm b/ios/chrome/browser/web/progress_indicator_egtest.mm index 7adf36d..23d9bda 100644 --- a/ios/chrome/browser/web/progress_indicator_egtest.mm +++ b/ios/chrome/browser/web/progress_indicator_egtest.mm
@@ -26,7 +26,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113) The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -34,7 +33,6 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ProgressIndicatorAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2) namespace {
diff --git a/ios/chrome/browser/web/restore_egtest.mm b/ios/chrome/browser/web/restore_egtest.mm index 408fd8d..e47210e6 100644 --- a/ios/chrome/browser/web/restore_egtest.mm +++ b/ios/chrome/browser/web/restore_egtest.mm
@@ -149,12 +149,7 @@ // Navigates to a set of cross-domains, chrome URLs and error pages, and then // tests that they are properly restored. -#if defined(CHROME_EARL_GREY_1) -#define MAYBE_testRestoreHistory DISABLED_testRestoreHistory -#else -#define MAYBE_testRestoreHistory testRestoreHistory -#endif -- (void)MAYBE_testRestoreHistory { +- (void)testRestoreHistory { [self setUpRestoreServers]; [self loadTestPages]; [self verifyRestoredTestPages:YES]; @@ -162,12 +157,7 @@ // Navigates to a set of cross-domains, chrome URLs and error pages, and then // tests that they are properly restored in airplane mode. -#if defined(CHROME_EARL_GREY_1) -#define MAYBE_testRestoreNoNetwork DISABLED_testRestoreNoNetwork -#else -#define MAYBE_testRestoreNoNetwork testRestoreNoNetwork -#endif -- (void)MAYBE_testRestoreNoNetwork { +- (void)testRestoreNoNetwork { [self setUpRestoreServers]; [self loadTestPages]; self.serverRespondsWithContent = false; @@ -205,7 +195,6 @@ // TODO(crbug.com/1108433): Session restoration not available yet in MW. EARL_GREY_TEST_DISABLED(@"Disabled in Multiwindow."); } -#if defined(CHROME_EARL_GREY_2) // Visit the background page. int visitCounter = 0; self.testServer->RegisterRequestHandler( @@ -234,7 +223,6 @@ assertWithMatcher:grey_notNil()]; [ChromeEarlGrey waitForWebStateContainingText:"Echo"]; GREYAssertEqual(1, visitCounter, @"The page should not reload"); -#endif } #pragma mark Utility methods @@ -252,15 +240,15 @@ - (void)triggerRestore { // TODO(crbug.com/1067821):|AppLaunchManager| relaunching with -// |ForceRelaunchByCleanShutdown| policy won't work in EG1 or on real device. -#if defined(CHROME_EARL_GREY_1) || !TARGET_IPHONE_SIMULATOR +// |ForceRelaunchByCleanShutdown| policy won't work on real device. +#if !TARGET_IPHONE_SIMULATOR [ChromeEarlGrey triggerRestoreViaTabGridRemoveAllUndo]; -#elif defined(CHROME_EARL_GREY_2) +#else [ChromeEarlGrey saveSessionImmediately]; [[AppLaunchManager sharedManager] ensureAppLaunchedWithFeaturesEnabled:{} disabled:{} relaunchPolicy:ForceRelaunchByCleanShutdown]; -#endif // defined(CHROME_EARL_GREY_2) +#endif } - (void)loadTestPages {
diff --git a/ios/chrome/browser/window_activities/BUILD.gn b/ios/chrome/browser/window_activities/BUILD.gn index 0a578a1b..c478937 100644 --- a/ios/chrome/browser/window_activities/BUILD.gn +++ b/ios/chrome/browser/window_activities/BUILD.gn
@@ -15,7 +15,7 @@ ":ios_move_tab_activity_type_buildflags", "//base", "//ios/chrome/browser:chrome_url_constants", - "//ios/chrome/browser/url_loading", + "//ios/chrome/browser/url_loading:url_loading_params_header", "//ios/web/public/navigation", "//net", "//url",
diff --git a/ios/chrome/test/earl_grey/accessibility_util.mm b/ios/chrome/test/earl_grey/accessibility_util.mm index 5f11c2b..e7179c0 100644 --- a/ios/chrome/test/earl_grey/accessibility_util.mm +++ b/ios/chrome/test/earl_grey/accessibility_util.mm
@@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#if defined(CHROME_EARL_GREY_1) -#import <EarlGrey/EarlGrey.h> -#endif #import <GTXiLib/GTXiLib.h> @@ -34,24 +31,5 @@ return YES; } -#if defined(CHROME_EARL_GREY_1) - -void VerifyAccessibilityForCurrentScreen() { - // TODO(crbug.com/972681): The GTX analytics ping is preventing the app from - // idling, causing EG tests to fail. Disabling analytics will allow tests to - // run, but may not be the correct long-term solution. - [GTXAnalytics setEnabled:NO]; - - GTXToolKit* toolkit = [[GTXToolKit alloc] init]; - NSError* error = nil; - for (UIWindow* window in [[UIApplication sharedApplication] windows]) { - // Run the checks on all elements on the screen. - BOOL success = [toolkit checkAllElementsFromRootElements:@[ window ] - error:&error]; - GREYAssert(success, @"Accessibility checks failed! Error: %@", error); - } -} - -#endif } // namespace chrome_test_util
diff --git a/ios/chrome/test/earl_grey/chrome_actions.mm b/ios/chrome/test/earl_grey/chrome_actions.mm index 0eb20fc..ff4aad4 100644 --- a/ios/chrome/test/earl_grey/chrome_actions.mm +++ b/ios/chrome/test/earl_grey/chrome_actions.mm
@@ -13,9 +13,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeActionsAppInterface) -#endif namespace chrome_test_util {
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey.mm b/ios/chrome/test/earl_grey/chrome_earl_grey.mm index 24aff468..7eb1af25 100644 --- a/ios/chrome/test/earl_grey/chrome_earl_grey.mm +++ b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
@@ -18,20 +18,6 @@ #include "ios/web/public/test/element_selector.h" #include "net/base/mac/url_conversions.h" -#if defined(CHROME_EARL_GREY_1) -#import <WebKit/WebKit.h> - -#import "ios/chrome/test/app/browsing_data_test_util.h" // nogncheck -#import "ios/chrome/test/app/chrome_test_util.h" // nogncheck -#include "ios/chrome/test/app/navigation_test_util.h" // nogncheck -#import "ios/chrome/test/app/sync_test_util.h" // nogncheck -#import "ios/chrome/test/app/tab_test_util.h" // nogncheck -#import "ios/web/public/deprecated/crw_js_injection_receiver.h" // nogncheck -#import "ios/web/public/test/earl_grey/js_test_util.h" // nogncheck -#import "ios/web/public/test/web_view_content_test_util.h" // nogncheck -#import "ios/web/public/test/web_view_interaction_test_util.h" // nogncheck -#import "ios/web/public/web_state.h" // nogncheck -#endif using base::test::ios::kWaitForActionTimeout; using base::test::ios::kWaitForJSCompletionTimeout; @@ -58,9 +44,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface) -#endif // defined(CHROME_EARL_GREY_2) @interface ChromeEarlGreyImpl () @@ -98,62 +82,32 @@ - (void)rotateDeviceToOrientation:(UIDeviceOrientation)deviceOrientation error:(NSError**)error { -#if defined(CHROME_EARL_GREY_1) - NSError* strongErrorReference = nil; - [EarlGrey rotateDeviceToOrientation:deviceOrientation - errorOrNil:&strongErrorReference]; - if (error) - *error = strongErrorReference; -#elif defined(CHROME_EARL_GREY_2) [EarlGrey rotateDeviceToOrientation:deviceOrientation error:error]; -#else -#error Neither CHROME_EARL_GREY_1 nor CHROME_EARL_GREY_2 are defined -#endif } - (BOOL)isKeyboardShownWithError:(NSError**)error { return -#if defined(CHROME_EARL_GREY_1) - [GREYKeyboard isKeyboardShown]; -#elif defined(CHROME_EARL_GREY_2) [EarlGrey isKeyboardShownWithError:error]; -#else -#error Neither CHROME_EARL_GREY_1 nor CHROME_EARL_GREY_2 are defined -#endif } - (BOOL)isIPadIdiom { -#if defined(CHROME_EARL_GREY_1) - UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom]; -#elif defined(CHROME_EARL_GREY_2) UIUserInterfaceIdiom idiom = [[GREY_REMOTE_CLASS_IN_APP(UIDevice) currentDevice] userInterfaceIdiom]; -#endif return idiom == UIUserInterfaceIdiomPad; } - (BOOL)isCompactWidth { UIUserInterfaceSizeClass horizontalSpace = -#if defined(CHROME_EARL_GREY_1) - [[[[UIApplication sharedApplication] keyWindow] traitCollection] - horizontalSizeClass]; -#elif defined(CHROME_EARL_GREY_2) [[[[GREY_REMOTE_CLASS_IN_APP(UIApplication) sharedApplication] keyWindow] traitCollection] horizontalSizeClass]; -#endif return horizontalSpace == UIUserInterfaceSizeClassCompact; } - (BOOL)isCompactHeight { UIUserInterfaceSizeClass verticalSpace = -#if defined(CHROME_EARL_GREY_1) - [[[[UIApplication sharedApplication] keyWindow] traitCollection] - verticalSizeClass]; -#elif defined(CHROME_EARL_GREY_2) [[[[GREY_REMOTE_CLASS_IN_APP(UIApplication) sharedApplication] keyWindow] traitCollection] verticalSizeClass]; -#endif return verticalSpace == UIUserInterfaceSizeClassCompact; } @@ -163,12 +117,8 @@ - (BOOL)isRegularXRegularSizeClass { UITraitCollection* traitCollection = -#if defined(CHROME_EARL_GREY_1) - [[[UIApplication sharedApplication] keyWindow] traitCollection]; -#elif defined(CHROME_EARL_GREY_2) [[[GREY_REMOTE_CLASS_IN_APP(UIApplication) sharedApplication] keyWindow] traitCollection]; -#endif return traitCollection.verticalSizeClass == UIUserInterfaceSizeClassRegular && traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular; } @@ -1112,45 +1062,3 @@ } @end - -// The helpers below only compile under EarlGrey1. -// TODO(crbug.com/922813): Update these helpers to compile under EG2 and move -// them into the main class declaration as they are converted. -#if defined(CHROME_EARL_GREY_1) - -namespace chrome_test_util { - -id ExecuteJavaScript(NSString* javascript, - NSError* __autoreleasing* out_error) { - __block bool did_complete = false; - __block id result = nil; - __block NSError* temp_error = nil; - CRWJSInjectionReceiver* evaluator = - chrome_test_util::GetCurrentWebState()->GetJSInjectionReceiver(); - [evaluator executeJavaScript:javascript - completionHandler:^(id value, NSError* error) { - did_complete = true; - result = [value copy]; - temp_error = [error copy]; - }]; - - bool success = - WaitUntilConditionOrTimeout(kWaitForJSCompletionTimeout, ^bool { - return did_complete; - }); - if (!success) - return nil; - if (out_error) { - NSError* __autoreleasing auto_released_error = temp_error; - *out_error = auto_released_error; - } - return result; -} - -} // namespace chrome_test_util - -@implementation ChromeEarlGreyImpl (EG1) - -@end - -#endif // defined(CHROME_EARL_GREY_1)
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm b/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm index 339ae05d..1bf68e4 100644 --- a/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm +++ b/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm
@@ -53,18 +53,11 @@ } bool IsAppCompactWidth() { -#if defined(CHROME_EARL_GREY_1) - UIApplication* application = [UIApplication sharedApplication]; - UIWindow* keyWindow = application.keyWindow; - UIUserInterfaceSizeClass sizeClass = - keyWindow.traitCollection.horizontalSizeClass; -#elif defined(CHROME_EARL_GREY_2) UIApplication* remoteApplication = [GREY_REMOTE_CLASS_IN_APP(UIApplication) sharedApplication]; UIWindow* remoteKeyWindow = remoteApplication.keyWindow; UIUserInterfaceSizeClass sizeClass = remoteKeyWindow.traitCollection.horizontalSizeClass; -#endif return sizeClass == UIUserInterfaceSizeClassCompact; }
diff --git a/ios/chrome/test/earl_grey/chrome_matchers.mm b/ios/chrome/test/earl_grey/chrome_matchers.mm index 0f17e038e..9ddf0866 100644 --- a/ios/chrome/test/earl_grey/chrome_matchers.mm +++ b/ios/chrome/test/earl_grey/chrome_matchers.mm
@@ -12,9 +12,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeMatchersAppInterface) -#endif namespace chrome_test_util {
diff --git a/ios/chrome/test/earl_grey/chrome_test_case.mm b/ios/chrome/test/earl_grey/chrome_test_case.mm index a890aae..f73cc92 100644 --- a/ios/chrome/test/earl_grey/chrome_test_case.mm +++ b/ios/chrome/test/earl_grey/chrome_test_case.mm
@@ -31,18 +31,10 @@ bool gIsMockAuthenticationDisabled = false; -#if defined(CHROME_EARL_GREY_1) -NSString* const kFlakyEarlGreyTestTargetSuffix = @"_flaky_egtests"; -NSString* const kMultitaskingEarlGreyTestTargetName = - @"ios_chrome_multitasking_egtests"; -#elif defined(CHROME_EARL_GREY_2) NSString* const kFlakyEarlGreyTestTargetSuffix = @"_flaky_eg2tests_module-Runner"; NSString* const kMultitaskingEarlGreyTestTargetName = @"ios_chrome_multitasking_eg2tests_module-Runner"; -#else -#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2. -#endif // Contains a list of test names that run in multitasking test suite. NSArray* multitaskingTests = @[ @@ -121,18 +113,12 @@ } UIDeviceOrientation GetCurrentDeviceOrientation() { -#if defined(CHROME_EARL_GREY_1) - return [[UIDevice currentDevice] orientation]; -#elif defined(CHROME_EARL_GREY_2) return [[GREY_REMOTE_CLASS_IN_APP(UIDevice) currentDevice] orientation]; -#endif } } // namespace -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeTestCaseAppInterface) -#endif @interface ChromeTestCase () <AppLaunchManagerObserver> { // Block to be executed during object tearDown. @@ -167,27 +153,6 @@ // Overrides testInvocations so the set of tests run can be modified, as // necessary. + (NSArray*)testInvocations { -#if defined(CHROME_EARL_GREY_1) - NSError* error = nil; - [[EarlGrey selectElementWithMatcher:grey_systemAlertViewShown()] - assertWithMatcher:grey_nil() - error:&error]; - if (error != nil) { - NSLog(@"System alert view is present, so skipping all tests!"); -#if TARGET_IPHONE_SIMULATOR - return @[]; -#else - // Invoke XCTFail via call to stubbed out test. - NSMethodSignature* signature = - [ChromeTestCase instanceMethodSignatureForSelector:@selector - (failAllTestsDueToSystemAlertVisible)]; - NSInvocation* systemAlertTest = - [NSInvocation invocationWithMethodSignature:signature]; - systemAlertTest.selector = @selector(failAllTestsDueToSystemAlertVisible); - return @[ systemAlertTest ]; -#endif // !TARGET_IPHONE_SIMULATOR - } -#endif // defined(CHROME_EARL_GREY_1) // Return specific list of tests based on the target. NSString* targetName = [NSBundle mainBundle].infoDictionary[@"CFBundleName"]; @@ -202,18 +167,11 @@ } } -#if defined(CHROME_EARL_GREY_1) -+ (void)setUp { - [super setUp]; - [ChromeTestCase setUpHelper]; -} -#elif defined(CHROME_EARL_GREY_2) + (void)setUpForTestCase { [super setUpForTestCase]; [ChromeTestCase setUpHelper]; gExecutedSetUpForTestCase = true; } -#endif // CHROME_EARL_GREY_2 // Tear down called once for the class, to shutdown mock authentication. + (void)tearDown {
diff --git a/ios/chrome/test/earl_grey/earl_grey_scoped_block_swizzler.mm b/ios/chrome/test/earl_grey/earl_grey_scoped_block_swizzler.mm index 791d041..1f5c9410 100644 --- a/ios/chrome/test/earl_grey/earl_grey_scoped_block_swizzler.mm +++ b/ios/chrome/test/earl_grey/earl_grey_scoped_block_swizzler.mm
@@ -11,9 +11,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(EarlGreyScopedBlockSwizzlerAppInterface) -#endif // defined(CHROME_EARL_GREY_2) EarlGreyScopedBlockSwizzler::EarlGreyScopedBlockSwizzler(NSString* target, NSString* selector,
diff --git a/ios/chrome/test/scoped_eg_synchronization_disabler.mm b/ios/chrome/test/scoped_eg_synchronization_disabler.mm index c51afafa..64ce028 100644 --- a/ios/chrome/test/scoped_eg_synchronization_disabler.mm +++ b/ios/chrome/test/scoped_eg_synchronization_disabler.mm
@@ -14,13 +14,7 @@ // EG1 and EG2 have different API to obtain shared GREYConfiguration object. // This function abstracts the API access. GREYConfiguration* GetSharedGREYConfiguration() { -#if defined(CHROME_EARL_GREY_1) - return [GREYConfiguration sharedInstance]; -#elif defined(CHROME_EARL_GREY_2) return [GREYConfiguration sharedConfiguration]; -#else -#error Either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2 must be defined -#endif } } // namespace
diff --git a/ios/showcase/test/showcase_test_case.mm b/ios/showcase/test/showcase_test_case.mm index eb886dd..24185e2 100644 --- a/ios/showcase/test/showcase_test_case.mm +++ b/ios/showcase/test/showcase_test_case.mm
@@ -13,23 +13,14 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ShowcaseTestCaseAppInterface) -#endif // defined(CHROME_EARL_GREY_2) @implementation ShowcaseTestCase -#if defined(CHROME_EARL_GREY_1) -+ (void)setUp { - [super setUp]; - [ShowcaseTestCase setUpHelper]; -} -#elif defined(CHROME_EARL_GREY_2) + (void)setUpForTestCase { [super setUpForTestCase]; [ShowcaseTestCase setUpHelper]; } -#endif // CHROME_EARL_GREY_2 + (void)setUpHelper { [CoverageUtils configureCoverageReportPath];
diff --git a/ios/testing/earl_grey/app_launch_manager.mm b/ios/testing/earl_grey/app_launch_manager.mm index 6183b359..2c9bcae0 100644 --- a/ios/testing/earl_grey/app_launch_manager.mm +++ b/ios/testing/earl_grey/app_launch_manager.mm
@@ -19,11 +19,8 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(AppLaunchManagerAppInterface) -#endif // defined(CHROME_EARL_GREY_2) -#if defined(CHROME_EARL_GREY_2) // avoid unused function warning in EG1 namespace { // Returns the list of extra app launch args from test command line args. NSArray<NSString*>* ExtraAppArgsFromTestSwitch() { @@ -55,7 +52,6 @@ return [args1 isEqualToArray:args2]; } } // namespace -#endif @interface AppLaunchManager () // List of observers to be notified of actions performed by the app launch @@ -97,7 +93,6 @@ // In EG1, this method is a no-op. - (void)ensureAppLaunchedWithArgs:(NSArray<NSString*>*)arguments relaunchPolicy:(RelaunchPolicy)relaunchPolicy { -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1067821): ForceRelaunchByCleanShutdown doesn't compile on // real devices. #if TARGET_IPHONE_SIMULATOR @@ -177,7 +172,6 @@ self.runningApplicationProcessIdentifier = [AppLaunchManagerAppInterface processIdentifier]; self.currentLaunchArgs = arguments; -#endif // defined(CHROME_EARL_GREY_2) } - (void)ensureAppLaunchedWithConfiguration: @@ -247,11 +241,9 @@ } - (void)backgroundAndForegroundApp { -#if defined(CHROME_EARL_GREY_2) GREYAssertTrue([EarlGrey backgroundApplication], @"Failed to background application."); [self.runningApplication activate]; -#endif } - (void)addObserver:(id<AppLaunchManagerObserver>)observer {
diff --git a/ios/testing/earl_grey/base_earl_grey_test_case.mm b/ios/testing/earl_grey/base_earl_grey_test_case.mm index 3d6cc29..fff3d021 100644 --- a/ios/testing/earl_grey/base_earl_grey_test_case.mm +++ b/ios/testing/earl_grey/base_earl_grey_test_case.mm
@@ -20,9 +20,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(BaseEarlGreyTestCaseAppInterface) -#endif // defined(CHROME_EARL_GREY_2) namespace { @@ -43,7 +41,6 @@ - (void)setUp { [super setUp]; -#if defined(CHROME_EARL_GREY_2) [[AppLaunchManager sharedManager] ensureAppLaunchedWithConfiguration:[self appConfigurationForTestCase]]; [self handleSystemAlertIfVisible]; @@ -57,13 +54,9 @@ // here. See +setUp below for details on why overriding +setUp causes a // failure. [self failIfSetUpIsOverridden]; -#endif if (g_needs_set_up_for_test_case) { g_needs_set_up_for_test_case = false; -#if defined(CHROME_EARL_GREY_1) - [CoverageUtils configureCoverageReportPath]; -#endif [[self class] setUpForTestCase]; } } @@ -77,7 +70,6 @@ // Handles system alerts if any are present, closing them to unblock the UI. - (void)handleSystemAlertIfVisible { -#if defined(CHROME_EARL_GREY_2) NSError* systemAlertFoundError = nil; [[EarlGrey selectElementWithMatcher:grey_systemAlertViewShown()] assertWithMatcher:grey_nil() @@ -171,7 +163,6 @@ // Ensures no visible alert after handling. [self grey_waitForAlertVisibility:NO withTimeout:kSystemAlertVisibilityTimeout]; -#endif // CHROME_EARL_GREY_2 } - (AppLaunchConfiguration)appConfigurationForTestCase { @@ -199,7 +190,6 @@ // button doesn't exist, note it in |error| accordingly. In EG1, this method is // no-op. - (void)tapAlertButtonWithText:(NSString*)text error:(NSError**)error { -#if defined(CHROME_EARL_GREY_2) XCUIApplication* springboardApp = [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"]; XCUIElement* alert = [[springboardApp @@ -219,7 +209,6 @@ } [button tap]; -#endif // CHROME_EARL_GREY_2 } @end
diff --git a/ios/testing/earl_grey/earl_grey_app.h b/ios/testing/earl_grey/earl_grey_app.h index 7f453fd7..c178f7f 100644 --- a/ios/testing/earl_grey/earl_grey_app.h +++ b/ios/testing/earl_grey/earl_grey_app.h
@@ -10,22 +10,6 @@ // TODO(crbug.com/917390): Remove this file once all callers have been converted // to EG2. -#if defined(CHROME_EARL_GREY_1) - -#import <EarlGrey/EarlGrey.h> -#import <EarlGrey/GREYAppleInternals.h> -#import <EarlGrey/GREYKeyboard.h> - -typedef DescribeToBlock GREYDescribeToBlock; -typedef MatchesBlock GREYMatchesBlock; - -// Provides a no-op implementation of an EG2 API that doesn't exist in EG1. This -// helper assumes that it is already being called on the main thread and -// synchronously runs the given |block|. -void grey_dispatch_sync_on_main_thread(void (^block)(void)); - -#elif defined(CHROME_EARL_GREY_2) - #import <AppFramework/Action/GREYActionsShorthand.h> #import <AppFramework/Core/GREYElementInteraction.h> #import <AppFramework/EarlGreyApp.h> @@ -34,8 +18,4 @@ #import <CommonLib/Error/GREYErrorConstants.h> #import <CommonLib/GREYAppleInternals.h> -#else -#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2. -#endif - #endif // IOS_TESTING_EARL_GREY_EARL_GREY_APP_H_
diff --git a/ios/testing/earl_grey/earl_grey_app.mm b/ios/testing/earl_grey/earl_grey_app.mm index 08d2fb6..a77990b 100644 --- a/ios/testing/earl_grey/earl_grey_app.mm +++ b/ios/testing/earl_grey/earl_grey_app.mm
@@ -8,8 +8,3 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_1) -void grey_dispatch_sync_on_main_thread(void (^block)(void)) { - block(); -} -#endif
diff --git a/ios/testing/earl_grey/earl_grey_test.h b/ios/testing/earl_grey/earl_grey_test.h index eb140f8..9c06d995 100644 --- a/ios/testing/earl_grey/earl_grey_test.h +++ b/ios/testing/earl_grey/earl_grey_test.h
@@ -8,24 +8,7 @@ // Contains includes and typedefs to allow code to compile under both EarlGrey1 // and EarlGrey2 (Test Process). -#if defined(CHROME_EARL_GREY_1) - -#import <EarlGrey/EarlGrey.h> -#import <EarlGrey/GREYAppleInternals.h> -#import <EarlGrey/GREYKeyboard.h> - -typedef DescribeToBlock GREYDescribeToBlock; -typedef MatchesBlock GREYMatchesBlock; - -id<GREYMatcher> grey_kindOfClassName(NSString* name); - -#elif defined(CHROME_EARL_GREY_2) - #import "ios/third_party/earl_grey2/src/TestLib/EarlGreyImpl/EarlGrey.h" // nogncheck #import "ios/third_party/earl_grey2/src/TestLib/EarlGreyImpl/EarlGreyImpl+XCUIApplication.h" // nogncheck -#else -#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2. -#endif - #endif // IOS_TESTING_EARL_GREY_EARL_GREY_TEST_H_
diff --git a/ios/testing/earl_grey/earl_grey_test.mm b/ios/testing/earl_grey/earl_grey_test.mm index 162dad45..08901f8 100644 --- a/ios/testing/earl_grey/earl_grey_test.mm +++ b/ios/testing/earl_grey/earl_grey_test.mm
@@ -10,12 +10,3 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_1) - -id<GREYMatcher> grey_kindOfClassName(NSString* name) { - Class klass = NSClassFromString(name); - DCHECK(klass); - return grey_kindOfClass(klass); -} - -#endif
diff --git a/ios/testing/earl_grey/keyboard_app_interface_stub.mm b/ios/testing/earl_grey/keyboard_app_interface_stub.mm index 518c933c..195679a 100644 --- a/ios/testing/earl_grey/keyboard_app_interface_stub.mm +++ b/ios/testing/earl_grey/keyboard_app_interface_stub.mm
@@ -9,7 +9,6 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) // TODO(crbug.com/1015113): The EG2 macro is breaking indexing for some reason // without the trailing semicolon. For now, disable the extra semi warning // so Xcode indexing works for the egtest. @@ -17,4 +16,3 @@ #pragma clang diagnostic ignored "-Wc++98-compat-extra-semi" GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(KeyboardAppInterface); #pragma clang diagnostic pop -#endif // defined(CHROME_EARL_GREY_2)
diff --git a/ios/web/shell/test/earl_grey/shell_actions.mm b/ios/web/shell/test/earl_grey/shell_actions.mm index 1f2e2be..a90abb3 100644 --- a/ios/web/shell/test/earl_grey/shell_actions.mm +++ b/ios/web/shell/test/earl_grey/shell_actions.mm
@@ -11,9 +11,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ShellActionsAppInterface) -#endif namespace web {
diff --git a/ios/web/shell/test/earl_grey/shell_earl_grey.mm b/ios/web/shell/test/earl_grey/shell_earl_grey.mm index 30ae45a..48a56a47 100644 --- a/ios/web/shell/test/earl_grey/shell_earl_grey.mm +++ b/ios/web/shell/test/earl_grey/shell_earl_grey.mm
@@ -17,9 +17,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ShellEarlGreyAppInterface) -#endif @implementation ShellEarlGreyImpl
diff --git a/ios/web/shell/test/earl_grey/shell_matchers.mm b/ios/web/shell/test/earl_grey/shell_matchers.mm index 9287c9e1..e363970 100644 --- a/ios/web/shell/test/earl_grey/shell_matchers.mm +++ b/ios/web/shell/test/earl_grey/shell_matchers.mm
@@ -11,9 +11,7 @@ #error "This file requires ARC support." #endif -#if defined(CHROME_EARL_GREY_2) GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ShellMatchersAppInterface) -#endif namespace web {
diff --git a/ios/web/shell/test/earl_grey/web_shell_test_case.mm b/ios/web/shell/test/earl_grey/web_shell_test_case.mm index c179f121..e40ec2f 100644 --- a/ios/web/shell/test/earl_grey/web_shell_test_case.mm +++ b/ios/web/shell/test/earl_grey/web_shell_test_case.mm
@@ -12,24 +12,5 @@ @implementation WebShellTestCase -#if defined(CHROME_EARL_GREY_1) -// Overrides |testInvocations| to skip all tests if a system alert view is -// shown, since this isn't a case a user would encounter (i.e. they would -// dismiss the alert first). -+ (NSArray*)testInvocations { - // TODO(crbug.com/654085): Simply skipping all tests isn't the best way to - // handle this, it would be better to have something that is more obvious - // on the bots that this is wrong, without making it look like test flake. - NSError* error = nil; - [[EarlGrey selectElementWithMatcher:grey_systemAlertViewShown()] - assertWithMatcher:grey_nil() - error:&error]; - if (error != nil) { - NSLog(@"System alert view is present, so skipping all tests!"); - return @[]; - } - return [super testInvocations]; -} -#endif @end
diff --git a/ios/web_view/internal/autofill/cwv_autofill_controller.mm b/ios/web_view/internal/autofill/cwv_autofill_controller.mm index 251ce2c6..631492a3 100644 --- a/ios/web_view/internal/autofill/cwv_autofill_controller.mm +++ b/ios/web_view/internal/autofill/cwv_autofill_controller.mm
@@ -629,18 +629,18 @@ CWVPassword* password = [[CWVPassword alloc] initWithPasswordForm:credentials]; - [self.delegate - autofillController:self - decideSavePolicyForPassword:password - decisionHandler:^(CWVPasswordUserDecision decision) { - // Marking a password update as "never" makes no sense as - // the password has already been saved. - DCHECK_NE(decision, CWVPasswordUserDecisionNever) - << "A password update can only be accepted or ignored."; - if (decision == CWVPasswordUserDecisionYes) { - formPtr->Update(credentials); - } - }]; + [self.delegate autofillController:self + decideUpdatePolicyForPassword:password + decisionHandler:^(CWVPasswordUserDecision decision) { + // Marking a password update as "never" makes no sense as + // the password has already been saved. + DCHECK_NE(decision, CWVPasswordUserDecisionNever) + << "A password update can only be accepted or " + "ignored."; + if (decision == CWVPasswordUserDecisionYes) { + formPtr->Update(credentials); + } + }]; } - (void)removePasswordInfoBarManualFallback:(BOOL)manual {
diff --git a/media/capture/video/video_capture_device_unittest.cc b/media/capture/video/video_capture_device_unittest.cc index ab064ef..a878a553 100644 --- a/media/capture/video/video_capture_device_unittest.cc +++ b/media/capture/video/video_capture_device_unittest.cc
@@ -466,8 +466,7 @@ // Causes a flaky crash on Chrome OS. https://crbug.com/1069608 // Cause hangs on Windows Debug. http://crbug.com/417824 -#if defined(OS_CHROMEOS) || (defined(OS_WIN) && !defined(NDEBUG)) || \ - defined(OS_MAC) +#if defined(OS_CHROMEOS) || (defined(OS_WIN) && !defined(NDEBUG)) #define MAYBE_OpenInvalidDevice DISABLED_OpenInvalidDevice #else #define MAYBE_OpenInvalidDevice OpenInvalidDevice
diff --git a/media/gpu/ipc/service/picture_buffer_manager.cc b/media/gpu/ipc/service/picture_buffer_manager.cc index 92cb6751..8e32c71 100644 --- a/media/gpu/ipc/service/picture_buffer_manager.cc +++ b/media/gpu/ipc/service/picture_buffer_manager.cc
@@ -27,11 +27,6 @@ return value; } -bool UseSharedImage() { - // TODO(https://crbug.com/1108909): Enable shared image use on macOS. - return false; -} - class PictureBufferManagerImpl : public PictureBufferManager { public: explicit PictureBufferManagerImpl( @@ -79,7 +74,8 @@ VideoPixelFormat pixel_format, uint32_t planes, gfx::Size texture_size, - uint32_t texture_target) override { + uint32_t texture_target, + bool use_shared_image) override { DVLOG(2) << __func__; DCHECK(gpu_task_runner_); DCHECK(gpu_task_runner_->BelongsToCurrentThread()); @@ -87,7 +83,7 @@ DCHECK(planes); DCHECK_LE(planes, static_cast<uint32_t>(VideoFrame::kMaxPlanes)); - if (!UseSharedImage()) { + if (!use_shared_image) { // TODO(sandersd): Consider requiring that CreatePictureBuffers() is // called with the context current. if (!command_buffer_helper_->MakeContextCurrent()) { @@ -98,9 +94,10 @@ std::vector<PictureBuffer> picture_buffers; for (uint32_t i = 0; i < count; i++) { - PictureBufferData picture_data = {pixel_format, texture_size}; + PictureBufferData picture_data = {pixel_format, texture_size, + use_shared_image}; - if (!UseSharedImage()) { + if (!use_shared_image) { for (uint32_t j = 0; j < planes; j++) { // Create a texture for this plane. GLuint service_id = command_buffer_helper_->CreateTexture( @@ -219,7 +216,8 @@ // If this |picture| has a SharedImage, then keep a reference to the // SharedImage in |picture_buffer_data| and update the gpu::MailboxHolder. - DCHECK_EQ(UseSharedImage(), !!picture.scoped_shared_image()); + DCHECK_EQ(picture_buffer_data.use_shared_image, + !!picture.scoped_shared_image()); if (auto scoped_shared_image = picture.scoped_shared_image()) { picture_buffer_data.scoped_shared_image = scoped_shared_image; picture_buffer_data.mailbox_holders[0] = @@ -350,6 +348,7 @@ struct PictureBufferData { VideoPixelFormat pixel_format; gfx::Size texture_size; + bool use_shared_image = false; std::vector<GLuint> service_ids; gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes]; scoped_refptr<Picture::ScopedSharedImage> scoped_shared_image;
diff --git a/media/gpu/ipc/service/picture_buffer_manager.h b/media/gpu/ipc/service/picture_buffer_manager.h index fe03190..2c9b76c 100644 --- a/media/gpu/ipc/service/picture_buffer_manager.h +++ b/media/gpu/ipc/service/picture_buffer_manager.h
@@ -62,6 +62,7 @@ // |planes|: Number of image planes (textures) in the picture. // |texture_size|: Size of textures to create. // |texture_target|: Type of textures to create. + // |use_shared_image|: True if the created buffers should use shared images. // // Must be called on the GPU thread. // @@ -77,7 +78,8 @@ VideoPixelFormat pixel_format, uint32_t planes, gfx::Size texture_size, - uint32_t texture_target) = 0; + uint32_t texture_target, + bool use_shared_image) = 0; // Dismisses a picture buffer from the pool. //
diff --git a/media/gpu/ipc/service/picture_buffer_manager_unittest.cc b/media/gpu/ipc/service/picture_buffer_manager_unittest.cc index 38b0482..d74bc708 100644 --- a/media/gpu/ipc/service/picture_buffer_manager_unittest.cc +++ b/media/gpu/ipc/service/picture_buffer_manager_unittest.cc
@@ -41,7 +41,8 @@ std::vector<PictureBuffer> CreateARGBPictureBuffers(uint32_t count) { return pbm_->CreatePictureBuffers(count, PIXEL_FORMAT_ARGB, 1, - gfx::Size(320, 240), GL_TEXTURE_2D); + gfx::Size(320, 240), GL_TEXTURE_2D, + false /* use_shared_image */); } PictureBuffer CreateARGBPictureBuffer() {
diff --git a/media/gpu/ipc/service/vda_video_decoder.cc b/media/gpu/ipc/service/vda_video_decoder.cc index d5cad402..576d1b9 100644 --- a/media/gpu/ipc/service/vda_video_decoder.cc +++ b/media/gpu/ipc/service/vda_video_decoder.cc
@@ -541,7 +541,8 @@ std::vector<PictureBuffer> picture_buffers = picture_buffer_manager_->CreatePictureBuffers( - count, pixel_format, planes, texture_size, texture_target); + count, pixel_format, planes, texture_size, texture_target, + vda_->SupportsSharedImagePictureBuffers()); if (picture_buffers.empty()) { parent_task_runner_->PostTask( FROM_HERE,
diff --git a/media/gpu/mac/vt_video_decode_accelerator_mac.cc b/media/gpu/mac/vt_video_decode_accelerator_mac.cc index 24bcd30..33c5513 100644 --- a/media/gpu/mac/vt_video_decode_accelerator_mac.cc +++ b/media/gpu/mac/vt_video_decode_accelerator_mac.cc
@@ -1690,6 +1690,11 @@ return false; } +bool VTVideoDecodeAccelerator::SupportsSharedImagePictureBuffers() const { + // TODO(https://crbug.com/1108909): Enable shared image use on macOS. + return false; +} + // static VideoDecodeAccelerator::SupportedProfiles VTVideoDecodeAccelerator::GetSupportedProfiles() {
diff --git a/media/gpu/mac/vt_video_decode_accelerator_mac.h b/media/gpu/mac/vt_video_decode_accelerator_mac.h index aada203..5ec5bed 100644 --- a/media/gpu/mac/vt_video_decode_accelerator_mac.h +++ b/media/gpu/mac/vt_video_decode_accelerator_mac.h
@@ -63,6 +63,7 @@ const base::WeakPtr<Client>& decode_client, const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) override; + bool SupportsSharedImagePictureBuffers() const override; // MemoryDumpProvider implementation. bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
diff --git a/media/media_options.gni b/media/media_options.gni index 935e225..81bcf0a4 100644 --- a/media/media_options.gni +++ b/media/media_options.gni
@@ -58,7 +58,7 @@ media_use_libvpx = false } - # Enable usage of libvpx within the media library. Used for software based + # Enable usage of OpenH264 within the media library. Used for software based # encoding of H264 content. media_use_openh264 = true if (is_ios || is_android || !proprietary_codecs) {
diff --git a/media/video/video_decode_accelerator.cc b/media/video/video_decode_accelerator.cc index aee2a763..b15a8aa 100644 --- a/media/video/video_decode_accelerator.cc +++ b/media/video/video_decode_accelerator.cc
@@ -101,6 +101,10 @@ return GL_RGBA; } +bool VideoDecodeAccelerator::SupportsSharedImagePictureBuffers() const { + return false; +} + VideoDecodeAccelerator::SupportedProfile::SupportedProfile() : profile(media::VIDEO_CODEC_PROFILE_UNKNOWN), encrypted_only(false) {}
diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h index c4ad432..22ba252 100644 --- a/media/video/video_decode_accelerator.h +++ b/media/video/video_decode_accelerator.h
@@ -414,6 +414,10 @@ // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 virtual GLenum GetSurfaceInternalFormat() const; + // Returns true if the decoder supports SharedImage backed picture buffers. + // May be called on any thread at any time. + virtual bool SupportsSharedImagePictureBuffers() const; + protected: // Do not delete directly; use Destroy() or own it with a scoped_ptr, which // will Destroy() it properly by default.
diff --git a/remoting/host/installer/linux/Makefile b/remoting/host/installer/linux/Makefile index 3c9a18b..e2e4a9b8d 100644 --- a/remoting/host/installer/linux/Makefile +++ b/remoting/host/installer/linux/Makefile
@@ -41,6 +41,8 @@ "$(INSTALL_DIR)/chrome-remote-desktop" install "$(SRC_DIR)/remoting/host/installer/linux/is-remoting-session" \ "$(INSTALL_DIR)" + install "$(SRC_DIR)/remoting/host/installer/linux/Xsession" \ + "$(INSTALL_DIR)" install -m 0644 \ "$(BUILD_DIR)/remoting/com.google.chrome.remote_desktop.json" \
diff --git a/remoting/host/installer/linux/Xsession b/remoting/host/installer/linux/Xsession new file mode 100755 index 0000000..9ad8a95 --- /dev/null +++ b/remoting/host/installer/linux/Xsession
@@ -0,0 +1,12 @@ +#!/bin/bash + +# 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. + +# This file is used by the session chooser to set up the environment and launch +# the session selected by the user. + +# On Debian-based systems, just delegate to the distro-supplied Xsession script +# to launch the selected session. +exec /etc/X11/Xsession "$@"
diff --git a/remoting/host/xsession_chooser_linux.cc b/remoting/host/xsession_chooser_linux.cc index 7dd3167..83df3dc 100644 --- a/remoting/host/xsession_chooser_linux.cc +++ b/remoting/host/xsession_chooser_linux.cc
@@ -30,6 +30,7 @@ #include "base/logging.h" #include "base/message_loop/message_pump_type.h" #include "base/optional.h" +#include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/string_util.h" #include "base/task/single_thread_task_executor.h" @@ -47,8 +48,6 @@ namespace { -const char XSESSION_SCRIPT[] = "/etc/X11/Xsession"; - struct XSession { std::string name; std::string comment; @@ -326,14 +325,22 @@ } void ExecXSession(base::OnceClosure quit_closure, XSession session) { - LOG(INFO) << "Running " << XSESSION_SCRIPT << " " << session.exec; + base::FilePath xsession_script; + if (!base::PathService::Get(base::DIR_EXE, &xsession_script)) { + PLOG(ERROR) << "Failed to get CRD install path"; + std::move(quit_closure).Run(); + return; + } + xsession_script = xsession_script.Append("Xsession"); + LOG(INFO) << "Running " << xsession_script << " " << session.exec; if (!session.desktop_names.empty()) { std::unique_ptr<base::Environment> environment = base::Environment::Create(); environment->SetVar("XDG_CURRENT_DESKTOP", base::JoinString(session.desktop_names, ":")); } - execl(XSESSION_SCRIPT, XSESSION_SCRIPT, session.exec.c_str(), nullptr); + execl(xsession_script.value().c_str(), xsession_script.value().c_str(), + session.exec.c_str(), nullptr); PLOG(ERROR) << "Failed to exec XSession"; std::move(quit_closure).Run(); }
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h index d04eee1..712ed9b 100644 --- a/remoting/protocol/connection_to_client.h +++ b/remoting/protocol/connection_to_client.h
@@ -30,6 +30,7 @@ class PeerConnectionControls; class Session; class VideoStream; +class WebrtcEventLogData; // This interface represents a remote viewer connection to the chromoting host. // It sets up all protocol channels and connects them to the stubs. @@ -115,6 +116,10 @@ // connection is established. nullptr will be returned if the connection does // not support changing parameters on the fly. virtual PeerConnectionControls* peer_connection_controls() = 0; + + // Returns an object holding the RTC event logs if supported by this + // connection type, or nullptr otherwise. + virtual WebrtcEventLogData* rtc_event_log() = 0; }; } // namespace protocol
diff --git a/remoting/protocol/fake_connection_to_client.cc b/remoting/protocol/fake_connection_to_client.cc index 6fa68e6..be37f0680 100644 --- a/remoting/protocol/fake_connection_to_client.cc +++ b/remoting/protocol/fake_connection_to_client.cc
@@ -105,5 +105,9 @@ return nullptr; } +WebrtcEventLogData* FakeConnectionToClient::rtc_event_log() { + return nullptr; +} + } // namespace protocol } // namespace remoting
diff --git a/remoting/protocol/fake_connection_to_client.h b/remoting/protocol/fake_connection_to_client.h index c7be0de..9181292 100644 --- a/remoting/protocol/fake_connection_to_client.h +++ b/remoting/protocol/fake_connection_to_client.h
@@ -68,6 +68,7 @@ void set_input_stub(InputStub* input_stub) override; PeerConnectionControls* peer_connection_controls() override; + WebrtcEventLogData* rtc_event_log() override; base::WeakPtr<FakeVideoStream> last_video_stream() { return last_video_stream_;
diff --git a/remoting/protocol/ice_connection_to_client.cc b/remoting/protocol/ice_connection_to_client.cc index 928db64..1d47872 100644 --- a/remoting/protocol/ice_connection_to_client.cc +++ b/remoting/protocol/ice_connection_to_client.cc
@@ -147,6 +147,10 @@ return nullptr; } +WebrtcEventLogData* IceConnectionToClient::rtc_event_log() { + return nullptr; +} + void IceConnectionToClient::OnSessionStateChange(Session::State state) { DCHECK(thread_checker_.CalledOnValidThread());
diff --git a/remoting/protocol/ice_connection_to_client.h b/remoting/protocol/ice_connection_to_client.h index 3cadae0..66402f0f 100644 --- a/remoting/protocol/ice_connection_to_client.h +++ b/remoting/protocol/ice_connection_to_client.h
@@ -56,6 +56,7 @@ void set_host_stub(HostStub* host_stub) override; void set_input_stub(InputStub* input_stub) override; PeerConnectionControls* peer_connection_controls() override; + WebrtcEventLogData* rtc_event_log() override; private: // Session::EventHandler interface.
diff --git a/remoting/protocol/webrtc_connection_to_client.cc b/remoting/protocol/webrtc_connection_to_client.cc index 90cb9ac6..fb2a130 100644 --- a/remoting/protocol/webrtc_connection_to_client.cc +++ b/remoting/protocol/webrtc_connection_to_client.cc
@@ -134,6 +134,10 @@ return transport_.get(); } +WebrtcEventLogData* WebrtcConnectionToClient::rtc_event_log() { + return transport_->rtc_event_log(); +} + void WebrtcConnectionToClient::OnSessionStateChange(Session::State state) { DCHECK(thread_checker_.CalledOnValidThread());
diff --git a/remoting/protocol/webrtc_connection_to_client.h b/remoting/protocol/webrtc_connection_to_client.h index 3f9ae01..fa4f716 100644 --- a/remoting/protocol/webrtc_connection_to_client.h +++ b/remoting/protocol/webrtc_connection_to_client.h
@@ -52,6 +52,7 @@ void set_input_stub(InputStub* input_stub) override; void ApplySessionOptions(const SessionOptions& options) override; PeerConnectionControls* peer_connection_controls() override; + WebrtcEventLogData* rtc_event_log() override; // Session::EventHandler interface. void OnSessionStateChange(Session::State state) override;
diff --git a/remoting/protocol/webrtc_transport.h b/remoting/protocol/webrtc_transport.h index 3914b10..f092d69 100644 --- a/remoting/protocol/webrtc_transport.h +++ b/remoting/protocol/webrtc_transport.h
@@ -87,6 +87,7 @@ return video_encoder_factory_; } WebrtcAudioModule* audio_module(); + WebrtcEventLogData* rtc_event_log() { return &rtc_event_log_; } // Creates outgoing data channel. The channel is created in CONNECTING state. // The caller must wait for OnMessagePipeOpen() notification before sending
diff --git a/services/device/geolocation/wifi_data_provider_common_unittest.cc b/services/device/geolocation/wifi_data_provider_common_unittest.cc index ae0a087..cf7bcca 100644 --- a/services/device/geolocation/wifi_data_provider_common_unittest.cc +++ b/services/device/geolocation/wifi_data_provider_common_unittest.cc
@@ -203,7 +203,7 @@ EXPECT_CALL(*polling_policy_, PollingInterval()).Times(AtLeast(1)); AccessPointData single_access_point; single_access_point.channel = 2; - single_access_point.mac_address = 3; + single_access_point.mac_address = base::ASCIIToUTF16("00:11:22:33:44:55"); single_access_point.radio_signal_strength = 4; single_access_point.signal_to_noise = 5; single_access_point.ssid = base::ASCIIToUTF16("foossid");
diff --git a/services/device/public/cpp/device_features.cc b/services/device/public/cpp/device_features.cc index 9de899e..7094d63 100644 --- a/services/device/public/cpp/device_features.cc +++ b/services/device/public/cpp/device_features.cc
@@ -25,10 +25,10 @@ #if defined(OS_WIN) // Switches from enumerating serial ports using GUID_DEVINTERFACE_SERIALPORT to -// GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR. This is an experimental solution to +// GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR. This is an partial solution to // https://crbug.com/1119497. const base::Feature kUseSerialBusEnumerator{"UseSerialBusEnumerator", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; #endif // defined(OS_WIN) } // namespace features
diff --git a/services/device/usb/usb_device_win.cc b/services/device/usb/usb_device_win.cc index f5303bf..5921762 100644 --- a/services/device/usb/usb_device_win.cc +++ b/services/device/usb/usb_device_win.cc
@@ -29,12 +29,12 @@ const base::flat_map<int, FunctionInfo>& functions, uint32_t bus_number, uint32_t port_number, - const std::wstring& driver_name) + bool is_supported) : UsbDevice(bus_number, port_number), device_path_(device_path), hub_path_(hub_path), functions_(functions), - driver_name_(driver_name) {} + is_supported_(is_supported) {} UsbDeviceWin::~UsbDeviceWin() {} @@ -42,16 +42,13 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); scoped_refptr<UsbDeviceHandle> device_handle; - if (base::EqualsCaseInsensitiveASCII(driver_name_, L"winusb") || - base::EqualsCaseInsensitiveASCII(driver_name_, L"usbccgp")) { + if (is_supported_) { device_handle = new UsbDeviceHandleWin(this); + handles().push_back(device_handle.get()); } - if (device_handle) - handles().push_back(device_handle.get()); - base::SequencedTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), device_handle)); + FROM_HERE, base::BindOnce(std::move(callback), std::move(device_handle))); } void UsbDeviceWin::ReadDescriptors(base::OnceCallback<void(bool)> callback) {
diff --git a/services/device/usb/usb_device_win.h b/services/device/usb/usb_device_win.h index 11fcdf53..9514777 100644 --- a/services/device/usb/usb_device_win.h +++ b/services/device/usb/usb_device_win.h
@@ -23,6 +23,7 @@ class UsbDeviceWin : public UsbDevice { public: struct FunctionInfo { + int interface_number; std::wstring driver; std::wstring path; }; @@ -32,7 +33,7 @@ const base::flat_map<int, FunctionInfo>& functions, uint32_t bus_number, uint32_t port_number, - const std::wstring& driver_name); + bool is_supported); // UsbDevice implementation: void Open(OpenCallback callback) override; @@ -47,7 +48,6 @@ const base::flat_map<int, FunctionInfo>& functions() const { return functions_; } - const std::wstring& driver_name() const { return driver_name_; } // Opens the device's parent hub in order to read the device, configuration // and string descriptors. @@ -85,7 +85,7 @@ const std::wstring device_path_; const std::wstring hub_path_; base::flat_map<int, FunctionInfo> functions_; - const std::wstring driver_name_; + const bool is_supported_; DISALLOW_COPY_AND_ASSIGN(UsbDeviceWin); };
diff --git a/services/device/usb/usb_service_win.cc b/services/device/usb/usb_service_win.cc index ff70447..51477ef3 100644 --- a/services/device/usb/usb_service_win.cc +++ b/services/device/usb/usb_service_win.cc
@@ -41,6 +41,13 @@ namespace { +bool IsCompositeDevice(const std::wstring& service_name) { + // Windows built-in composite device driver + return base::EqualsCaseInsensitiveASCII(service_name, L"usbccgp") || + // Samsung Mobile USB Composite device driver + base::EqualsCaseInsensitiveASCII(service_name, L"dg_ssudbus"); +} + base::Optional<uint32_t> GetDeviceUint32Property(HDEVINFO dev_info, SP_DEVINFO_DATA* dev_info_data, const DEVPROPKEY& property) { @@ -138,6 +145,7 @@ std::wstring* instance_id, std::wstring* parent_instance_id, std::vector<std::wstring>* child_instance_ids, + std::vector<std::wstring>* hardware_ids, std::wstring* service_name) { SP_DEVINFO_DATA dev_info_data = {}; dev_info_data.cbSize = sizeof(dev_info_data); @@ -230,6 +238,20 @@ *child_instance_ids = std::move(result.value()); } + if (hardware_ids) { + auto result = GetDeviceStringListProperty(dev_info, &dev_info_data, + DEVPKEY_Device_HardwareIds); + if (!result.has_value()) { + if (GetLastError() == ERROR_NOT_FOUND) { + result.emplace(); + } else { + USB_PLOG(ERROR) << "Failed to get hardware IDs"; + return false; + } + } + *hardware_ids = std::move(result.value()); + } + if (service_name) { *service_name = GetServiceName(dev_info, &dev_info_data); if (service_name->empty()) { @@ -265,34 +287,50 @@ dev_info.get(), &device_interface_data, &device_path, /*bus_number=*/nullptr, /*port_number=*/nullptr, /*instance_id=*/nullptr, /*parent_instance_id=*/nullptr, - /*child_instance_ids=*/nullptr, /*service_name=*/nullptr)) { + /*child_instance_ids=*/nullptr, /*hardware_ids=*/nullptr, + /*service_name=*/nullptr)) { return std::wstring(); } return device_path; } -int GetInterfaceNumber(const std::wstring& instance_id) { +int GetInterfaceNumber(const std::wstring& instance_id, + const std::vector<std::wstring>& hardware_ids) { // According to MSDN the instance IDs for the device nodes created by the // composite driver is in the form "USB\VID_vvvv&PID_dddd&MI_zz" where "zz" // is the interface number. // // https://docs.microsoft.com/en-us/windows-hardware/drivers/install/standard-usb-identifiers#multiple-interface-usb-devices + RE2 pattern("MI_([0-9a-fA-F]{2})"); + std::string instance_id_ascii = base::WideToASCII(instance_id); - std::string interface_number_str; - if (!RE2::PartialMatch(instance_id_ascii, "MI_([0-9a-fA-F]{2})", - &interface_number_str)) { - return -1; + std::string match; + if (!RE2::PartialMatch(instance_id_ascii, pattern, &match)) { + // Alternative composite drivers, such as the one used for Samsung devices, + // don't use the standard format for the instance ID, but one of the + // hardware IDs will still match the expected pattern. + bool found = false; + for (const std::wstring& hardware_id : hardware_ids) { + std::string hardware_id_ascii = base::WideToASCII(hardware_id); + if (RE2::PartialMatch(hardware_id_ascii, pattern, &match)) { + found = true; + break; + } + } + if (!found) + return -1; } int interface_number; - if (!base::HexStringToInt(interface_number_str, &interface_number)) + if (!base::HexStringToInt(match, &interface_number)) return -1; return interface_number; } UsbDeviceWin::FunctionInfo GetFunctionInfo(const std::wstring& instance_id) { UsbDeviceWin::FunctionInfo info; + info.interface_number = -1; base::win::ScopedDevInfo dev_info( SetupDiCreateDeviceInfoList(nullptr, nullptr)); @@ -315,6 +353,16 @@ return info; } + base::Optional<std::vector<std::wstring>> hardware_ids = + GetDeviceStringListProperty(dev_info.get(), &dev_info_data, + DEVPKEY_Device_HardwareIds); + if (!hardware_ids) { + USB_PLOG(ERROR) << "Could not get the child device's hardware IDs"; + return info; + } + + info.interface_number = GetInterfaceNumber(instance_id, *hardware_ids); + if (!base::EqualsCaseInsensitiveASCII(info.driver, L"winusb")) return info; @@ -450,24 +498,27 @@ if (!GetDeviceInterfaceDetails(dev_info, device_interface_data, device_path_ptr, &bus_number, &port_number, /*instance_id=*/nullptr, &parent_instance_id, - &child_instance_ids, &service_name)) { + &child_instance_ids, + /*hardware_ids=*/nullptr, &service_name)) { return; } + bool is_supported = false; std::vector<std::pair<int, UsbDeviceWin::FunctionInfo>> functions; - if (base::EqualsCaseInsensitiveASCII(service_name, L"usbccgp")) { - // For composite devices Windows loads the usbccgp driver, which creates - // child device nodes for each of the device functions. It is these device - // paths for these children which must be opened in order to communicate - // with the WinUSB driver. + if (IsCompositeDevice(service_name)) { + is_supported = true; + // For composite devices Windows a composite device driver (usually the + // built-in usbccgp.sys) creates child device nodes for each device + // function. The device paths for these children must be opened in order + // to communicate with the WinUSB driver. for (const std::wstring& instance_id : child_instance_ids) { - int interface_number = GetInterfaceNumber(instance_id); - if (interface_number != -1) { - functions.emplace_back(interface_number, - GetFunctionInfo(instance_id)); + UsbDeviceWin::FunctionInfo info = GetFunctionInfo(instance_id); + if (info.interface_number != -1) { + functions.emplace_back(info.interface_number, info); } } } else if (base::EqualsCaseInsensitiveASCII(service_name, L"winusb")) { + is_supported = true; // A non-composite device has a single device node for all interfaces as // it only has a single function. UsbDeviceWin::FunctionInfo info; @@ -487,7 +538,7 @@ FROM_HERE, base::BindOnce(&UsbServiceWin::CreateDeviceObject, service_, std::move(device_path), std::move(hub_path), std::move(functions), bus_number, port_number, - std::move(service_name))); + is_supported, service_name)); } void EnumeratePotentialFunction( @@ -496,16 +547,17 @@ const std::wstring& device_path) { std::wstring instance_id; std::wstring parent_instance_id; + std::vector<std::wstring> hardware_ids; std::wstring service_name; if (!GetDeviceInterfaceDetails( dev_info, device_interface_data, /*device_path=*/nullptr, /*bus_number=*/nullptr, /*port_number=*/nullptr, &instance_id, &parent_instance_id, - /*child_instance_ids=*/nullptr, &service_name)) { + /*child_instance_ids=*/nullptr, &hardware_ids, &service_name)) { return; } - int interface_number = GetInterfaceNumber(instance_id); + int interface_number = GetInterfaceNumber(instance_id, hardware_ids); if (interface_number == -1) return; @@ -608,6 +660,7 @@ const base::flat_map<int, UsbDeviceWin::FunctionInfo>& functions, uint32_t bus_number, uint32_t port_number, + bool is_supported, const std::wstring& driver_name) { // Devices that appear during initial enumeration are gathered into the first // result returned by GetDevices() and prevent device add/remove notifications @@ -616,10 +669,11 @@ ++first_enumeration_countdown_; auto device = base::MakeRefCounted<UsbDeviceWin>( - device_path, hub_path, functions, bus_number, port_number, driver_name); + device_path, hub_path, functions, bus_number, port_number, is_supported); devices_by_path_[device->device_path()] = device; device->ReadDescriptors(base::BindOnce(&UsbServiceWin::DeviceReady, - weak_factory_.GetWeakPtr(), device)); + weak_factory_.GetWeakPtr(), device, + driver_name)); } void UsbServiceWin::UpdateFunction( @@ -639,6 +693,7 @@ } void UsbServiceWin::DeviceReady(scoped_refptr<UsbDeviceWin> device, + const std::wstring& driver_name, bool success) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -664,8 +719,8 @@ << device->manufacturer_string() << "\", product=" << device->product_id() << " \"" << device->product_string() << "\", serial=\"" - << device->serial_number() << "\", driver=\"" - << device->driver_name() << "\", guid=" << device->guid(); + << device->serial_number() << "\", driver=\"" << driver_name + << "\", guid=" << device->guid(); } else { devices_by_path_.erase(it); }
diff --git a/services/device/usb/usb_service_win.h b/services/device/usb/usb_service_win.h index 82acab8..f8841d82 100644 --- a/services/device/usb/usb_service_win.h +++ b/services/device/usb/usb_service_win.h
@@ -47,12 +47,15 @@ const base::flat_map<int, UsbDeviceWin::FunctionInfo>& functions, uint32_t bus_number, uint32_t port_number, + bool is_supported, const std::wstring& driver_name); void UpdateFunction(const std::wstring& device_path, int interface_number, const UsbDeviceWin::FunctionInfo& function_info); - void DeviceReady(scoped_refptr<UsbDeviceWin> device, bool success); + void DeviceReady(scoped_refptr<UsbDeviceWin> device, + const std::wstring& driver_name, + bool success); bool enumeration_ready() { return helper_started_ && first_enumeration_countdown_ == 0;
diff --git a/services/network/quic_transport.cc b/services/network/quic_transport.cc index 7ab0e4c4..bf83fa1 100644 --- a/services/network/quic_transport.cc +++ b/services/network/quic_transport.cc
@@ -149,6 +149,9 @@ } ~Stream() { + if (!incoming_ && !outgoing_) { + return; + } transport_->transport_->session()->ResetStream( id_, quic::QuicRstStreamErrorCode::QUIC_STREAM_CANCELLED); }
diff --git a/services/network/quic_transport_unittest.cc b/services/network/quic_transport_unittest.cc index 78cb99a..7884b21 100644 --- a/services/network/quic_transport_unittest.cc +++ b/services/network/quic_transport_unittest.cc
@@ -13,6 +13,7 @@ #include "base/test/task_environment.h" #include "net/cert/mock_cert_verifier.h" #include "net/dns/mock_host_resolver.h" +#include "net/log/test_net_log.h" #include "net/quic/crypto/proof_source_chromium.h" #include "net/test/test_data_directory.h" #include "net/third_party/quiche/src/quic/test_tools/crypto_test_utils.h" @@ -254,6 +255,7 @@ network_context_.url_request_context()->set_cert_verifier(&cert_verifier_); network_context_.url_request_context()->set_host_resolver(&host_resolver_); + network_context_.url_request_context()->set_net_log(&net_log_); auto* quic_context = network_context_.url_request_context()->quic_context(); quic_context->params()->supported_versions.push_back(version_); quic_context->params()->origins_to_force_quic_on.insert( @@ -298,6 +300,7 @@ const url::Origin& origin() const { return origin_; } const NetworkContext& network_context() const { return network_context_; } NetworkContext& mutable_network_context() { return network_context_; } + net::RecordingTestNetLog& net_log() { return net_log_; } void RunPendingTasks() { base::RunLoop run_loop; @@ -316,6 +319,7 @@ net::MockCertVerifier cert_verifier_; net::MockHostResolver host_resolver_; + net::RecordingTestNetLog net_log_; NetworkContext network_context_; @@ -508,6 +512,10 @@ EXPECT_FALSE(client.has_received_fin_for(stream_id)); EXPECT_TRUE(client.has_received_fin_for(incoming_stream_id)); EXPECT_FALSE(client.has_seen_mojo_connection_error()); + + std::vector<net::NetLogEntry> resets_sent = net_log().GetEntriesWithType( + net::NetLogEventType::QUIC_SESSION_RST_STREAM_FRAME_SENT); + EXPECT_EQ(0u, resets_sent.size()); } TEST_F(QuicTransportTest, EchoOnBidirectionalStream) {
diff --git a/services/network/trust_tokens/test/trust_token_test_util.cc b/services/network/trust_tokens/test/trust_token_test_util.cc index d61d77d..ddb48158 100644 --- a/services/network/trust_tokens/test/trust_token_test_util.cc +++ b/services/network/trust_tokens/test/trust_token_test_util.cc
@@ -12,7 +12,9 @@ namespace network { -TestURLRequestMaker::TestURLRequestMaker() = default; +TestURLRequestMaker::TestURLRequestMaker() { + context_.set_net_log(&net_log_); +} TestURLRequestMaker::~TestURLRequestMaker() = default; std::unique_ptr<net::URLRequest> TestURLRequestMaker::MakeURLRequest(
diff --git a/services/network/trust_tokens/test/trust_token_test_util.h b/services/network/trust_tokens/test/trust_token_test_util.h index 6d8a717..39da16d 100644 --- a/services/network/trust_tokens/test/trust_token_test_util.h +++ b/services/network/trust_tokens/test/trust_token_test_util.h
@@ -15,6 +15,9 @@ #include "base/strings/string_piece.h" #include "base/test/task_environment.h" #include "base/values.h" +#include "net/log/net_log.h" +#include "net/log/test_net_log.h" +#include "net/log/test_net_log_util.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "net/url_request/url_request_test_util.h" #include "services/network/public/mojom/trust_tokens.mojom.h" @@ -35,6 +38,8 @@ TestURLRequestMaker(); virtual ~TestURLRequestMaker(); + net::NetLog* net_log() const { return context_.net_log(); } + TestURLRequestMaker(const TestURLRequestMaker&) = delete; TestURLRequestMaker& operator=(const TestURLRequestMaker&) = delete; @@ -42,6 +47,7 @@ std::unique_ptr<net::URLRequest> MakeURLRequest(base::StringPiece spec); protected: + net::RecordingTestNetLog net_log_; net::TestDelegate delegate_; net::TestURLRequestContext context_; };
diff --git a/services/network/trust_tokens/trust_token_request_helper_factory.cc b/services/network/trust_tokens/trust_token_request_helper_factory.cc index 9ba6d9d..a1834de 100644 --- a/services/network/trust_tokens/trust_token_request_helper_factory.cc +++ b/services/network/trust_tokens/trust_token_request_helper_factory.cc
@@ -3,11 +3,13 @@ // found in the LICENSE file. #include "services/network/trust_tokens/trust_token_request_helper_factory.h" -#include <memory> +#include <memory> #include <utility> #include "base/callback_forward.h" +#include "base/metrics/histogram_functions.h" +#include "base/strings/strcat.h" #include "net/base/isolation_info.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_with_source.h" @@ -27,16 +29,46 @@ #include "services/network/trust_tokens/trust_token_request_issuance_helper.h" #include "services/network/trust_tokens/trust_token_request_redemption_helper.h" #include "services/network/trust_tokens/trust_token_request_signing_helper.h" +#include "services/network/trust_tokens/types.h" namespace network { namespace { -void LogOutcome(const net::NetLogWithSource& log, base::StringPiece message) { +using Outcome = internal::TrustTokenRequestHelperFactoryOutcome; + +base::StringPiece OutcomeToString(Outcome outcome) { + switch (outcome) { + case Outcome::kSuccessfullyCreatedAnIssuanceHelper: + return "Successfully created an issuance helper"; + case Outcome::kSuccessfullyCreatedARedemptionHelper: + return "Successfully created a redemption helper"; + case Outcome::kSuccessfullyCreatedASigningHelper: + return "Successfully created a signing helper"; + case Outcome::kEmptyIssuersParameter: + return "Empty 'issuers' parameter"; + case Outcome::kUnsuitableIssuerInIssuersParameter: + return "Unsuitable issuer in 'issuers' parameter"; + case Outcome::kUnsuitableTopFrameOrigin: + return "Unsuitable top frame origin"; + case Outcome::kRequestRejectedDueToBearingAnInternalTrustTokensHeader: + return "Request rejected due to bearing an internal Trust Tokens header"; + case Outcome::kRejectedByAuthorizer: + return "Rejected by authorizer (check cookie settings?)"; + } +} + +void LogOutcome(const net::NetLogWithSource& log, + mojom::TrustTokenOperationType type, + Outcome outcome) { + base::UmaHistogramEnumeration( + base::StrCat({"Net.TrustTokens.RequestHelperFactoryOutcome.", + internal::TrustTokenOperationTypeToString(type)}), + outcome); log.EndEvent(net::NetLogEventType::TRUST_TOKEN_OPERATION_REQUESTED, - [message]() { + [outcome]() { base::Value ret(base::Value::Type::DICTIONARY); - ret.SetStringKey("outcome", message); + ret.SetStringKey("outcome", OutcomeToString(outcome)); return ret; }); } @@ -62,8 +94,7 @@ static_cast<int>(params.type)); if (!authorizer_.Run()) { - LogOutcome(request.net_log(), - "Rejected by authorizer (check cookie settings?)"); + LogOutcome(request.net_log(), params.type, Outcome::kRejectedByAuthorizer); std::move(done).Run(mojom::TrustTokenOperationStatus::kUnavailable); return; } @@ -71,8 +102,8 @@ for (base::StringPiece header : TrustTokensRequestHeaders()) { if (request.extra_request_headers().HasHeader(header)) { LogOutcome( - request.net_log(), - "Request rejected due to bearing an internal Trust Tokens header"); + request.net_log(), params.type, + Outcome::kRequestRejectedDueToBearingAnInternalTrustTokensHeader); std::move(done).Run(mojom::TrustTokenOperationStatus::kInvalidArgument); return; } @@ -84,7 +115,8 @@ *request.isolation_info().top_frame_origin()); } if (!maybe_top_frame_origin) { - LogOutcome(request.net_log(), "Unsuitable top frame origin"); + LogOutcome(request.net_log(), params.type, + Outcome::kUnsuitableTopFrameOrigin); std::move(done).Run(mojom::TrustTokenOperationStatus::kFailedPrecondition); return; } @@ -105,7 +137,8 @@ switch (params->type) { case mojom::TrustTokenOperationType::kIssuance: { - LogOutcome(net_log, "Successfully created an issuance helper"); + LogOutcome(net_log, params->type, + Outcome::kSuccessfullyCreatedAnIssuanceHelper); std::move(done).Run(std::unique_ptr<TrustTokenRequestHelper>( new TrustTokenRequestIssuanceHelper( std::move(top_frame_origin), store, key_commitment_getter_, @@ -115,7 +148,8 @@ } case mojom::TrustTokenOperationType::kRedemption: { - LogOutcome(net_log, "Successfully created a redemption helper"); + LogOutcome(net_log, params->type, + Outcome::kSuccessfullyCreatedARedemptionHelper); std::move(done).Run(std::unique_ptr<TrustTokenRequestHelper>( new TrustTokenRequestRedemptionHelper( std::move(top_frame_origin), params->refresh_policy, store, @@ -128,7 +162,7 @@ case mojom::TrustTokenOperationType::kSigning: { if (params->issuers.empty()) { - LogOutcome(net_log, "Empty 'issuers' parameter"); + LogOutcome(net_log, params->type, Outcome::kEmptyIssuersParameter); std::move(done).Run(mojom::TrustTokenOperationStatus::kInvalidArgument); return; } @@ -139,7 +173,8 @@ SuitableTrustTokenOrigin::Create( std::move(potentially_unsuitable_issuer)); if (!maybe_issuer) { - LogOutcome(net_log, "Unsuitable issuer in 'issuers' parameter"); + LogOutcome(net_log, params->type, + Outcome::kUnsuitableIssuerInIssuersParameter); std::move(done).Run( mojom::TrustTokenOperationStatus::kInvalidArgument); return; @@ -154,7 +189,8 @@ params->include_timestamp_header, params->sign_request_data, params->possibly_unsafe_additional_signing_data); - LogOutcome(net_log, "Success"); + LogOutcome(net_log, params->type, + Outcome::kSuccessfullyCreatedASigningHelper); std::move(done).Run(std::unique_ptr<TrustTokenRequestHelper>( new TrustTokenRequestSigningHelper( store, std::move(signing_params),
diff --git a/services/network/trust_tokens/trust_token_request_helper_factory.h b/services/network/trust_tokens/trust_token_request_helper_factory.h index 02dbfe9..3bbbd47 100644 --- a/services/network/trust_tokens/trust_token_request_helper_factory.h +++ b/services/network/trust_tokens/trust_token_request_helper_factory.h
@@ -20,6 +20,30 @@ namespace network { +namespace internal { + +// These are the possible results of constructing a Trust Tokens request helper; +// exposed in the header file for use in tests. Please do not use them directly +// outside of the class's implementation. +// +// Additionally, since this enum is used in histograms: +// 1. please do not reorder or delete values; +// 2. the values must be kept in sync with the enum of the same name in +// enums.xml. +enum class TrustTokenRequestHelperFactoryOutcome { + kSuccessfullyCreatedAnIssuanceHelper = 0, + kSuccessfullyCreatedARedemptionHelper = 1, + kSuccessfullyCreatedASigningHelper = 2, + kEmptyIssuersParameter = 3, + kUnsuitableIssuerInIssuersParameter = 4, + kUnsuitableTopFrameOrigin = 5, + kRequestRejectedDueToBearingAnInternalTrustTokensHeader = 6, + kRejectedByAuthorizer = 7, + kMaxValue = kRejectedByAuthorizer +}; + +} // namespace internal + class TrustTokenStatusOrRequestHelper; // TrustTokenRequestHelperFactory dispatches a helper capable for executing a
diff --git a/services/network/trust_tokens/trust_token_request_helper_factory_unittest.cc b/services/network/trust_tokens/trust_token_request_helper_factory_unittest.cc index 8fa823a..e5fce76 100644 --- a/services/network/trust_tokens/trust_token_request_helper_factory_unittest.cc +++ b/services/network/trust_tokens/trust_token_request_helper_factory_unittest.cc
@@ -7,6 +7,7 @@ #include "base/optional.h" #include "base/strings/strcat.h" #include "base/test/bind_test_util.h" +#include "base/test/metrics/histogram_tester.h" #include "base/test/task_environment.h" #include "net/base/isolation_info.h" #include "net/url_request/url_request.h" @@ -25,6 +26,8 @@ namespace { +using Outcome = internal::TrustTokenRequestHelperFactoryOutcome; + // These origins are not suitable for keying persistent Trust Tokens state: // - UnsuitableUntrustworthyOrigin is not potentially trustworthy. // - UnsuitableNonHttpNonHttpsOrigin is neither HTTP nor HTTPS. @@ -54,15 +57,17 @@ TrustTokenRequestHelperFactoryTest() { suitable_request_ = CreateSuitableRequest(); suitable_params_ = mojom::TrustTokenParams::New(); + suitable_params_->type = mojom::TrustTokenOperationType::kSigning; suitable_params_->issuers.push_back( url::Origin::Create(GURL("https://issuer.example"))); } protected: const net::URLRequest& suitable_request() const { return *suitable_request_; } - const mojom::TrustTokenParams& suitable_params() const { + const mojom::TrustTokenParams& suitable_signing_params() const { return *suitable_params_; } + const net::NetLog& net_log() const { return *maker_.net_log(); } std::unique_ptr<net::URLRequest> CreateSuitableRequest() { auto ret = maker_.MakeURLRequest("https://destination.example"); @@ -112,65 +117,98 @@ }; TEST_F(TrustTokenRequestHelperFactoryTest, MissingTopFrameOrigin) { + base::HistogramTester histogram_tester; std::unique_ptr<net::URLRequest> request = CreateSuitableRequest(); request->set_isolation_info(net::IsolationInfo()); - EXPECT_EQ(CreateHelperAndWaitForResult(*request, suitable_params()).status(), + EXPECT_EQ(CreateHelperAndWaitForResult(*request, suitable_signing_params()) + .status(), mojom::TrustTokenOperationStatus::kFailedPrecondition); + + histogram_tester.ExpectUniqueSample( + "Net.TrustTokens.RequestHelperFactoryOutcome.Signing", + Outcome::kUnsuitableTopFrameOrigin, 1); } TEST_F(TrustTokenRequestHelperFactoryTest, UnsuitableTopFrameOrigin) { + base::HistogramTester histogram_tester; auto request = CreateSuitableRequest(); request->set_isolation_info( CreateIsolationInfo(UnsuitableUntrustworthyOrigin())); - EXPECT_EQ(CreateHelperAndWaitForResult(*request, suitable_params()).status(), + EXPECT_EQ(CreateHelperAndWaitForResult(*request, suitable_signing_params()) + .status(), mojom::TrustTokenOperationStatus::kFailedPrecondition); request->set_isolation_info( CreateIsolationInfo(UnsuitableNonHttpNonHttpsOrigin())); - EXPECT_EQ(CreateHelperAndWaitForResult(*request, suitable_params()).status(), + EXPECT_EQ(CreateHelperAndWaitForResult(*request, suitable_signing_params()) + .status(), mojom::TrustTokenOperationStatus::kFailedPrecondition); + + histogram_tester.ExpectUniqueSample( + "Net.TrustTokens.RequestHelperFactoryOutcome.Signing", + Outcome::kUnsuitableTopFrameOrigin, 2); } TEST_F(TrustTokenRequestHelperFactoryTest, ForbiddenHeaders) { + base::HistogramTester histogram_tester; for (const base::StringPiece& header : TrustTokensRequestHeaders()) { std::unique_ptr<net::URLRequest> my_request = CreateSuitableRequest(); my_request->SetExtraRequestHeaderByName(std::string(header), " ", /*overwrite=*/true); EXPECT_EQ( - CreateHelperAndWaitForResult(*my_request, suitable_params()).status(), + CreateHelperAndWaitForResult(*my_request, suitable_signing_params()) + .status(), mojom::TrustTokenOperationStatus::kInvalidArgument); } + + histogram_tester.ExpectUniqueSample( + "Net.TrustTokens.RequestHelperFactoryOutcome.Signing", + Outcome::kRequestRejectedDueToBearingAnInternalTrustTokensHeader, + base::size(TrustTokensRequestHeaders())); } TEST_F(TrustTokenRequestHelperFactoryTest, CreatingSigningHelperRequiresSuitableIssuers) { + base::HistogramTester histogram_tester; auto request = CreateSuitableRequest(); - auto params = suitable_params().Clone(); + auto params = suitable_signing_params().Clone(); params->type = mojom::TrustTokenOperationType::kSigning; params->issuers.clear(); EXPECT_EQ(CreateHelperAndWaitForResult(*request, *params).status(), mojom::TrustTokenOperationStatus::kInvalidArgument); + histogram_tester.ExpectUniqueSample( + "Net.TrustTokens.RequestHelperFactoryOutcome.Signing", + Outcome::kEmptyIssuersParameter, 1); + params->issuers.push_back(UnsuitableUntrustworthyOrigin()); EXPECT_EQ(CreateHelperAndWaitForResult(*request, *params).status(), mojom::TrustTokenOperationStatus::kInvalidArgument); + histogram_tester.ExpectBucketCount( + "Net.TrustTokens.RequestHelperFactoryOutcome.Signing", + Outcome::kUnsuitableIssuerInIssuersParameter, 1); + params->issuers.clear(); params->issuers.push_back(UnsuitableNonHttpNonHttpsOrigin()); EXPECT_EQ(CreateHelperAndWaitForResult(*request, *params).status(), mojom::TrustTokenOperationStatus::kInvalidArgument); + + histogram_tester.ExpectBucketCount( + "Net.TrustTokens.RequestHelperFactoryOutcome.Signing", + Outcome::kUnsuitableIssuerInIssuersParameter, 2); } TEST_F(TrustTokenRequestHelperFactoryTest, WillCreateSigningHelperWithAdditionalData) { auto request = CreateSuitableRequest(); - auto params = suitable_params().Clone(); + auto params = suitable_signing_params().Clone(); params->type = mojom::TrustTokenOperationType::kSigning; params->possibly_unsafe_additional_signing_data = std::string(kTrustTokenAdditionalSigningDataMaxSizeBytes, 'a'); @@ -181,33 +219,49 @@ } TEST_F(TrustTokenRequestHelperFactoryTest, CreatesSigningHelper) { - auto params = suitable_params().Clone(); + base::HistogramTester histogram_tester; + auto params = suitable_signing_params().Clone(); params->type = mojom::TrustTokenOperationType::kSigning; auto result = CreateHelperAndWaitForResult(suitable_request(), *params); ASSERT_TRUE(result.ok()); EXPECT_TRUE(result.TakeOrCrash()); + + histogram_tester.ExpectUniqueSample( + "Net.TrustTokens.RequestHelperFactoryOutcome.Signing", + Outcome::kSuccessfullyCreatedASigningHelper, 1); } TEST_F(TrustTokenRequestHelperFactoryTest, CreatesIssuanceHelper) { - auto params = suitable_params().Clone(); + base::HistogramTester histogram_tester; + auto params = suitable_signing_params().Clone(); params->type = mojom::TrustTokenOperationType::kIssuance; auto result = CreateHelperAndWaitForResult(suitable_request(), *params); ASSERT_TRUE(result.ok()); EXPECT_TRUE(result.TakeOrCrash()); + + histogram_tester.ExpectUniqueSample( + "Net.TrustTokens.RequestHelperFactoryOutcome.Issuance", + Outcome::kSuccessfullyCreatedAnIssuanceHelper, 1); } TEST_F(TrustTokenRequestHelperFactoryTest, CreatesRedemptionHelper) { - auto params = suitable_params().Clone(); + base::HistogramTester histogram_tester; + auto params = suitable_signing_params().Clone(); params->type = mojom::TrustTokenOperationType::kRedemption; auto result = CreateHelperAndWaitForResult(suitable_request(), *params); ASSERT_TRUE(result.ok()); EXPECT_TRUE(result.TakeOrCrash()); + + histogram_tester.ExpectUniqueSample( + "Net.TrustTokens.RequestHelperFactoryOutcome.Redemption", + Outcome::kSuccessfullyCreatedARedemptionHelper, 1); } TEST_F(TrustTokenRequestHelperFactoryTest, RespectsAuthorizer) { + base::HistogramTester histogram_tester; base::RunLoop run_loop; TrustTokenStatusOrRequestHelper obtained_result; PendingTrustTokenStore store; @@ -218,7 +272,7 @@ TrustTokenRequestHelperFactory(&store, &getter, base::BindRepeating([]() { return false; })) .CreateTrustTokenHelperForRequest( - suitable_request(), suitable_params(), + suitable_request(), suitable_signing_params(), base::BindLambdaForTesting( [&](TrustTokenStatusOrRequestHelper result) { obtained_result = std::move(result); @@ -229,5 +283,8 @@ EXPECT_EQ(obtained_result.status(), mojom::TrustTokenOperationStatus::kUnavailable); + histogram_tester.ExpectUniqueSample( + "Net.TrustTokens.RequestHelperFactoryOutcome.Signing", + Outcome::kRejectedByAuthorizer, 1); } } // namespace network
diff --git a/services/network/trust_tokens/types.cc b/services/network/trust_tokens/types.cc index 5911600..81e14c9 100644 --- a/services/network/trust_tokens/types.cc +++ b/services/network/trust_tokens/types.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "services/network/trust_tokens/types.h" + #include "base/time/time.h" #include "base/util/values/values_util.h" @@ -16,5 +18,20 @@ return util::TimeToValue(my_time).GetString(); } +base::StringPiece TrustTokenOperationTypeToString( + mojom::TrustTokenOperationType type) { + // WARNING: These values are used to construct histogram names. When making + // changes, please make sure that the Trust Tokens-related histograms + // ("Net.TrustTokens.*") reflect the changes. + switch (type) { + case mojom::TrustTokenOperationType::kIssuance: + return "Issuance"; + case mojom::TrustTokenOperationType::kRedemption: + return "Redemption"; + case mojom::TrustTokenOperationType::kSigning: + return "Signing"; + } +} + } // namespace internal } // namespace network
diff --git a/services/network/trust_tokens/types.h b/services/network/trust_tokens/types.h index 968c3df..46f6e4b 100644 --- a/services/network/trust_tokens/types.h +++ b/services/network/trust_tokens/types.h
@@ -9,6 +9,7 @@ #include "base/strings/string_piece_forward.h" #include "base/time/time.h" +#include "services/network/public/mojom/trust_tokens.mojom-shared.h" #include "url/origin.h" namespace network { @@ -24,6 +25,10 @@ // Serializes a base::Time. std::string TimeToString(base::Time my_time); +// Serializes a TrustTokenOperationType. +base::StringPiece TrustTokenOperationTypeToString( + mojom::TrustTokenOperationType type); + } // namespace internal } // namespace network
diff --git a/storage/browser/blob/blob_data_item.cc b/storage/browser/blob/blob_data_item.cc index 4b118ee..ef05067a 100644 --- a/storage/browser/blob/blob_data_item.cc +++ b/storage/browser/blob/blob_data_item.cc
@@ -193,6 +193,7 @@ DCHECK_EQ(type_, Type::kBytes); length_ = new_length; bytes_.resize(length_); + bytes_.shrink_to_fit(); } void BlobDataItem::PopulateFile(
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index 3f65828e..3ce31491 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -2009,7 +2009,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -5678,7 +5677,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -9038,7 +9036,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -12632,7 +12629,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -17019,7 +17015,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -29791,7 +29786,6 @@ "--recover-devices", "--avd-config=../../tools/android/avd/proto/generic_android23.textpb" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -34097,7 +34091,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -38768,7 +38761,6 @@ "--recover-devices", "--avd-config=../../tools/android/avd/proto/generic_android28.textpb" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket",
diff --git a/testing/buildbot/chromium.ci.json b/testing/buildbot/chromium.ci.json index 025740b2..bd3747c 100644 --- a/testing/buildbot/chromium.ci.json +++ b/testing/buildbot/chromium.ci.json
@@ -2967,7 +2967,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -51415,7 +51414,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -55084,7 +55082,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -85340,7 +85337,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -88934,7 +88930,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -96491,7 +96486,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -99843,7 +99837,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -163729,7 +163722,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -167469,7 +167461,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -170556,7 +170547,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "isolate_profile_data": true, "merge": { "args": [ @@ -174475,7 +174465,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "isolate_profile_data": true, "merge": { "args": [ @@ -185609,7 +185598,6 @@ "--recover-devices", "--avd-config=../../tools/android/avd/proto/generic_android23.textpb" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -190170,7 +190158,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -194934,7 +194921,6 @@ "--recover-devices", "--avd-config=../../tools/android/avd/proto/generic_android28.textpb" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -225265,7 +225251,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "absl_hardening_tests", @@ -225290,7 +225276,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225307,7 +225293,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -225332,7 +225318,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225349,7 +225335,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -225374,7 +225360,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225391,7 +225377,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -225416,7 +225402,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225433,7 +225419,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "boringssl_crypto_tests", @@ -225458,7 +225444,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225475,7 +225461,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "boringssl_ssl_tests", @@ -225500,7 +225486,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225517,7 +225503,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -225542,7 +225528,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225559,7 +225545,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -225584,7 +225570,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225601,7 +225587,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -225626,7 +225612,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225643,7 +225629,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "crypto_unittests", @@ -225668,7 +225654,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225685,7 +225671,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -225710,7 +225696,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225727,7 +225713,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -225752,7 +225738,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225769,7 +225755,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -225794,7 +225780,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225811,7 +225797,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "google_apis_unittests", @@ -225836,7 +225822,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225853,7 +225839,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -225878,7 +225864,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225895,7 +225881,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -225920,7 +225906,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225937,7 +225923,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -225962,7 +225948,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -225979,7 +225965,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -226004,7 +225990,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226021,7 +226007,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -226046,7 +226032,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226064,7 +226050,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -226089,7 +226075,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226107,7 +226093,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -226132,7 +226118,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226150,7 +226136,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -226175,7 +226161,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226193,7 +226179,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -226218,7 +226204,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226236,7 +226222,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -226261,7 +226247,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226279,7 +226265,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -226304,7 +226290,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226322,7 +226308,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -226347,7 +226333,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226365,7 +226351,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -226390,7 +226376,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226407,7 +226393,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -226432,7 +226418,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226449,7 +226435,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -226474,7 +226460,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226491,7 +226477,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -226516,7 +226502,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226533,7 +226519,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -226558,7 +226544,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226575,7 +226561,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -226600,7 +226586,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226617,7 +226603,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -226642,7 +226628,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226659,7 +226645,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -226684,7 +226670,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226701,7 +226687,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -226726,7 +226712,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226744,7 +226730,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -226769,7 +226755,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226787,7 +226773,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -226812,7 +226798,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226830,7 +226816,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -226855,7 +226841,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226873,7 +226859,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -226898,7 +226884,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226915,7 +226901,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -226940,7 +226926,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226957,7 +226943,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -226982,7 +226968,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -226999,7 +226985,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -227024,7 +227010,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227041,7 +227027,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -227066,7 +227052,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227083,7 +227069,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -227108,7 +227094,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227125,7 +227111,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -227150,7 +227136,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227167,7 +227153,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_components_unittests", @@ -227192,7 +227178,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227209,7 +227195,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_net_unittests", @@ -227234,7 +227220,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227251,7 +227237,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_remoting_unittests", @@ -227276,7 +227262,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227293,7 +227279,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -227318,7 +227304,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227335,7 +227321,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -227360,7 +227346,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227377,7 +227363,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -227402,7 +227388,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227419,7 +227405,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -227444,7 +227430,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227461,7 +227447,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_testing_unittests", @@ -227486,7 +227472,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227503,7 +227489,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -227528,7 +227514,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227545,7 +227531,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -227570,7 +227556,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227587,7 +227573,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -227612,7 +227598,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227629,7 +227615,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -227654,7 +227640,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227671,7 +227657,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -227696,7 +227682,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227713,7 +227699,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -227738,7 +227724,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227755,7 +227741,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -227780,7 +227766,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227797,7 +227783,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -227822,7 +227808,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227839,7 +227825,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -227864,7 +227850,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227881,7 +227867,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -227906,7 +227892,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227923,7 +227909,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -227948,7 +227934,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -227965,7 +227951,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -227990,7 +227976,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228007,7 +227993,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -228032,7 +228018,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228049,7 +228035,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -228074,7 +228060,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228091,7 +228077,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -228116,7 +228102,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228133,7 +228119,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -228158,7 +228144,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228175,7 +228161,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "net_unittests", @@ -228200,7 +228186,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228217,7 +228203,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "services_unittests", @@ -228242,7 +228228,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228259,7 +228245,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -228284,7 +228270,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228301,7 +228287,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -228326,7 +228312,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228343,7 +228329,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -228368,7 +228354,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228385,7 +228371,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "sql_unittests", @@ -228410,7 +228396,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228427,7 +228413,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -228452,7 +228438,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228469,7 +228455,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -228494,7 +228480,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228511,7 +228497,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -228536,7 +228522,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228553,7 +228539,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "url_unittests", @@ -228578,7 +228564,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228602,7 +228588,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "absl_hardening_tests", @@ -228627,7 +228613,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228644,7 +228630,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -228669,7 +228655,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228686,7 +228672,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -228711,7 +228697,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228728,7 +228714,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "boringssl_crypto_tests", @@ -228753,7 +228739,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228770,7 +228756,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "boringssl_ssl_tests", @@ -228795,7 +228781,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228812,7 +228798,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -228837,7 +228823,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228854,7 +228840,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -228879,7 +228865,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228896,7 +228882,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "crypto_unittests", @@ -228921,7 +228907,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228938,7 +228924,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -228963,7 +228949,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -228980,7 +228966,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -229005,7 +228991,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229022,7 +229008,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "google_apis_unittests", @@ -229047,7 +229033,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229064,7 +229050,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -229089,7 +229075,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229106,7 +229092,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -229131,7 +229117,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229148,7 +229134,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -229173,7 +229159,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229190,7 +229176,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -229215,7 +229201,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229233,7 +229219,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -229258,7 +229244,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229276,7 +229262,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -229301,7 +229287,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229319,7 +229305,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -229344,7 +229330,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229362,7 +229348,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -229387,7 +229373,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229405,7 +229391,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -229430,7 +229416,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229448,7 +229434,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -229473,7 +229459,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229490,7 +229476,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -229515,7 +229501,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229532,7 +229518,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -229557,7 +229543,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229574,7 +229560,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -229599,7 +229585,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229616,7 +229602,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -229641,7 +229627,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229658,7 +229644,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -229683,7 +229669,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229700,7 +229686,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -229725,7 +229711,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229743,7 +229729,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -229768,7 +229754,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229786,7 +229772,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -229811,7 +229797,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229829,7 +229815,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -229854,7 +229840,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229871,7 +229857,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -229896,7 +229882,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229913,7 +229899,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -229938,7 +229924,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229955,7 +229941,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -229980,7 +229966,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -229997,7 +229983,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -230022,7 +230008,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230039,7 +230025,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_components_unittests", @@ -230064,7 +230050,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230081,7 +230067,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_net_unittests", @@ -230106,7 +230092,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230123,7 +230109,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_remoting_unittests", @@ -230148,7 +230134,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230165,7 +230151,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -230190,7 +230176,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230207,7 +230193,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -230232,7 +230218,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230249,7 +230235,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -230274,7 +230260,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230291,7 +230277,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_testing_unittests", @@ -230316,7 +230302,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230333,7 +230319,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -230358,7 +230344,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230375,7 +230361,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -230400,7 +230386,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230417,7 +230403,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -230442,7 +230428,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230459,7 +230445,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -230484,7 +230470,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230501,7 +230487,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -230526,7 +230512,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230543,7 +230529,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -230568,7 +230554,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230585,7 +230571,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -230610,7 +230596,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230627,7 +230613,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -230652,7 +230638,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230669,7 +230655,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -230694,7 +230680,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230711,7 +230697,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -230736,7 +230722,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230753,7 +230739,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -230778,7 +230764,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230795,7 +230781,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "net_unittests", @@ -230820,7 +230806,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230837,7 +230823,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "services_unittests", @@ -230862,7 +230848,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230879,7 +230865,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -230904,7 +230890,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230921,7 +230907,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -230946,7 +230932,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -230963,7 +230949,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "sql_unittests", @@ -230988,7 +230974,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -231005,7 +230991,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -231030,7 +231016,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -231047,7 +231033,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -231072,7 +231058,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -231089,7 +231075,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "url_unittests", @@ -231114,7 +231100,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ],
diff --git a/testing/buildbot/chromium.clang.json b/testing/buildbot/chromium.clang.json index b6e58781..7997716 100644 --- a/testing/buildbot/chromium.clang.json +++ b/testing/buildbot/chromium.clang.json
@@ -5090,7 +5090,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -8442,7 +8441,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket",
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 170c3adb..da692f4 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -7824,7 +7824,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "isolate_profile_data": true, "merge": { "args": [ @@ -11743,7 +11742,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "isolate_profile_data": true, "merge": { "args": [ @@ -30388,7 +30386,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "absl_hardening_tests", @@ -30413,7 +30411,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30430,7 +30428,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -30455,7 +30453,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30472,7 +30470,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -30497,7 +30495,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30514,7 +30512,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -30539,7 +30537,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30556,7 +30554,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "boringssl_crypto_tests", @@ -30581,7 +30579,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30598,7 +30596,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "boringssl_ssl_tests", @@ -30623,7 +30621,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30640,7 +30638,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -30665,7 +30663,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30682,7 +30680,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -30707,7 +30705,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30724,7 +30722,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -30749,7 +30747,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30766,7 +30764,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "crypto_unittests", @@ -30791,7 +30789,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30808,7 +30806,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -30833,7 +30831,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30850,7 +30848,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -30875,7 +30873,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30892,7 +30890,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -30917,7 +30915,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30934,7 +30932,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "google_apis_unittests", @@ -30959,7 +30957,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -30976,7 +30974,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -31001,7 +30999,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31018,7 +31016,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -31043,7 +31041,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31060,7 +31058,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -31085,7 +31083,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31102,7 +31100,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -31127,7 +31125,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31144,7 +31142,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -31169,7 +31167,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31187,7 +31185,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -31212,7 +31210,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31230,7 +31228,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -31255,7 +31253,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31273,7 +31271,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -31298,7 +31296,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31316,7 +31314,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -31341,7 +31339,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31359,7 +31357,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -31384,7 +31382,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31402,7 +31400,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -31427,7 +31425,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31445,7 +31443,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -31470,7 +31468,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31488,7 +31486,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -31513,7 +31511,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31530,7 +31528,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -31555,7 +31553,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31572,7 +31570,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -31597,7 +31595,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31614,7 +31612,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -31639,7 +31637,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31656,7 +31654,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -31681,7 +31679,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31698,7 +31696,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -31723,7 +31721,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31740,7 +31738,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -31765,7 +31763,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31782,7 +31780,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -31807,7 +31805,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31824,7 +31822,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -31849,7 +31847,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31867,7 +31865,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -31892,7 +31890,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31910,7 +31908,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -31935,7 +31933,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31953,7 +31951,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -31978,7 +31976,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -31996,7 +31994,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -32021,7 +32019,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32038,7 +32036,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -32063,7 +32061,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32080,7 +32078,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -32105,7 +32103,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32122,7 +32120,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -32147,7 +32145,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32164,7 +32162,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -32189,7 +32187,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32206,7 +32204,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -32231,7 +32229,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32248,7 +32246,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -32273,7 +32271,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32290,7 +32288,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_components_unittests", @@ -32315,7 +32313,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32332,7 +32330,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_net_unittests", @@ -32357,7 +32355,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32374,7 +32372,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_remoting_unittests", @@ -32399,7 +32397,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32416,7 +32414,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -32441,7 +32439,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32458,7 +32456,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -32483,7 +32481,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32500,7 +32498,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -32525,7 +32523,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32542,7 +32540,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -32567,7 +32565,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32584,7 +32582,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_testing_unittests", @@ -32609,7 +32607,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32626,7 +32624,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -32651,7 +32649,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32668,7 +32666,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -32693,7 +32691,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32710,7 +32708,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -32735,7 +32733,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32752,7 +32750,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -32777,7 +32775,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32794,7 +32792,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -32819,7 +32817,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32836,7 +32834,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -32861,7 +32859,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32878,7 +32876,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -32903,7 +32901,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32920,7 +32918,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -32945,7 +32943,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -32962,7 +32960,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -32987,7 +32985,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33004,7 +33002,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -33029,7 +33027,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33046,7 +33044,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -33071,7 +33069,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33088,7 +33086,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -33113,7 +33111,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33130,7 +33128,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -33155,7 +33153,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33172,7 +33170,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -33197,7 +33195,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33214,7 +33212,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -33239,7 +33237,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33256,7 +33254,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -33281,7 +33279,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33298,7 +33296,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "net_unittests", @@ -33323,7 +33321,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33340,7 +33338,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "services_unittests", @@ -33365,7 +33363,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33382,7 +33380,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -33407,7 +33405,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33424,7 +33422,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -33449,7 +33447,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33466,7 +33464,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -33491,7 +33489,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33508,7 +33506,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "sql_unittests", @@ -33533,7 +33531,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33550,7 +33548,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -33575,7 +33573,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33592,7 +33590,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -33617,7 +33615,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33634,7 +33632,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -33659,7 +33657,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33676,7 +33674,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "url_unittests", @@ -33701,7 +33699,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33725,7 +33723,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "absl_hardening_tests", @@ -33750,7 +33748,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33767,7 +33765,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -33792,7 +33790,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33809,7 +33807,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "base_unittests", @@ -33834,7 +33832,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33851,7 +33849,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "boringssl_crypto_tests", @@ -33876,7 +33874,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33893,7 +33891,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "boringssl_ssl_tests", @@ -33918,7 +33916,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33935,7 +33933,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -33960,7 +33958,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -33977,7 +33975,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "components_unittests", @@ -34002,7 +34000,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34019,7 +34017,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "crypto_unittests", @@ -34044,7 +34042,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34061,7 +34059,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -34086,7 +34084,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34103,7 +34101,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "gfx_unittests", @@ -34128,7 +34126,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34145,7 +34143,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "google_apis_unittests", @@ -34170,7 +34168,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34187,7 +34185,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -34212,7 +34210,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34229,7 +34227,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -34254,7 +34252,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34271,7 +34269,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_bookmarks_eg2tests_module", @@ -34296,7 +34294,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34313,7 +34311,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -34338,7 +34336,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34356,7 +34354,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -34381,7 +34379,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34399,7 +34397,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_integration_eg2tests_module", @@ -34424,7 +34422,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34442,7 +34440,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -34467,7 +34465,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34485,7 +34483,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -34510,7 +34508,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34528,7 +34526,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_settings_eg2tests_module", @@ -34553,7 +34551,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34571,7 +34569,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -34596,7 +34594,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34613,7 +34611,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -34638,7 +34636,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34655,7 +34653,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_signin_eg2tests_module", @@ -34680,7 +34678,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34697,7 +34695,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -34722,7 +34720,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34739,7 +34737,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -34764,7 +34762,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34781,7 +34779,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_smoke_eg2tests_module", @@ -34806,7 +34804,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34823,7 +34821,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -34848,7 +34846,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34866,7 +34864,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -34891,7 +34889,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34909,7 +34907,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_ui_eg2tests_module", @@ -34934,7 +34932,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34952,7 +34950,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -34977,7 +34975,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -34994,7 +34992,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_chrome_unittests", @@ -35019,7 +35017,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35036,7 +35034,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -35061,7 +35059,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35078,7 +35076,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -35103,7 +35101,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35120,7 +35118,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_chrome_web_eg2tests_module", @@ -35145,7 +35143,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35162,7 +35160,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_components_unittests", @@ -35187,7 +35185,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35204,7 +35202,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_net_unittests", @@ -35229,7 +35227,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35246,7 +35244,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_remoting_unittests", @@ -35271,7 +35269,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35288,7 +35286,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -35313,7 +35311,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35330,7 +35328,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -35355,7 +35353,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35372,7 +35370,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_showcase_eg2tests_module", @@ -35397,7 +35395,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35414,7 +35412,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_testing_unittests", @@ -35439,7 +35437,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35456,7 +35454,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -35481,7 +35479,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35498,7 +35496,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_inttests", @@ -35523,7 +35521,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35540,7 +35538,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -35565,7 +35563,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35582,7 +35580,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -35607,7 +35605,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35624,7 +35622,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xcode-parallelization" ], "isolate_name": "ios_web_shell_eg2tests_module", @@ -35649,7 +35647,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35666,7 +35664,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -35691,7 +35689,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35708,7 +35706,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_unittests", @@ -35733,7 +35731,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35750,7 +35748,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -35775,7 +35773,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35792,7 +35790,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_inttests", @@ -35817,7 +35815,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35834,7 +35832,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -35859,7 +35857,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35876,7 +35874,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ios_web_view_unittests", @@ -35901,7 +35899,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35918,7 +35916,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "net_unittests", @@ -35943,7 +35941,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -35960,7 +35958,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "services_unittests", @@ -35985,7 +35983,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -36002,7 +36000,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -36027,7 +36025,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -36044,7 +36042,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "skia_unittests", @@ -36069,7 +36067,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -36086,7 +36084,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "sql_unittests", @@ -36111,7 +36109,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -36128,7 +36126,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -36153,7 +36151,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -36170,7 +36168,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "ui_base_unittests", @@ -36195,7 +36193,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ], @@ -36212,7 +36210,7 @@ "--out-dir", "${ISOLATED_OUTDIR}", "--xcode-build-version", - "12a7209", + "12b5018i", "--xctest" ], "isolate_name": "url_unittests", @@ -36237,7 +36235,7 @@ ], "named_caches": [ { - "name": "xcode_ios_12a7209", + "name": "xcode_ios_12b5018i", "path": "Xcode.app" } ],
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index 2e4009555..10392bf 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -101,7 +101,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket", @@ -15275,7 +15274,6 @@ "--gs-results-bucket=chromium-result-details", "--recover-devices" ], - "experiment_percentage": 100, "merge": { "args": [ "--bucket",
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl index 45f032b1..fb61b379 100644 --- a/testing/buildbot/mixins.pyl +++ b/testing/buildbot/mixins.pyl
@@ -999,6 +999,23 @@ ], }, }, + # latest Xcode 12 beta version. + 'xcode_12b5018i': { + '$mixin_append': { + 'args': [ + '--xcode-build-version', + '12b5018i' + ], + }, + 'swarming': { + 'named_caches': [ + { + 'name': 'xcode_ios_12b5018i', + 'path': 'Xcode.app', + }, + ], + }, + }, 'xcode_parallelization': { '$mixin_append': { 'args': [
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index b5e6239..c0d97a5 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -186,7 +186,6 @@ 'args': [ '--test-launcher-batch-limit=1', ], - 'experiment_percentage': 100, }, 'android_webview_unittests': {}, 'breakpad_unittests': {},
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 103d421c..3c7f58b 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -2134,7 +2134,7 @@ 'mac_10.15', 'mac_toolchain', 'out_dir_arg', - 'xcode_12a7209', + 'xcode_12b5018i', ], 'test_suites': { 'isolated_scripts': 'ios14_beta_simulator_tests' @@ -2150,7 +2150,7 @@ 'mac_10.15', 'mac_toolchain', 'out_dir_arg', - 'xcode_12a7209', + 'xcode_12b5018i', ], 'test_suites': { 'isolated_scripts': 'ios14_sdk_simulator_tests'
diff --git a/testing/scripts/check_static_initializers.py b/testing/scripts/check_static_initializers.py index c7b15d8..152b0ec 100755 --- a/testing/scripts/check_static_initializers.py +++ b/testing/scripts/check_static_initializers.py
@@ -37,7 +37,6 @@ 'iostream.cpp', # TODO(crbug.com/973554): Remove. 'spinlock.cc', # TODO(crbug.com/973556): Remove. 'int256.cc', # TODO(crbug.com/537099): Remove. - 'native_message_host_chromeos.cc', # TODO(crbug.com/537099): Remove. 'protobuf_http_status.cc', # TODO(crbug.com/537099): Remove. 'rpc.pb.cc', # TODO(crbug.com/537099): Remove. ],
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index d3dd3271..1fade395 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -701,25 +701,6 @@ ] } ], - "AutofillEnableStickyBubbleAndUpdatedLogging": [ - { - "platforms": [ - "chromeos", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "AutofillEnableFixedPaymentsBubbleLogging", - "AutofillEnableStickyPaymentsBubble" - ] - } - ] - } - ], "AutofillFieldMetadata": [ { "platforms": [ @@ -4638,7 +4619,7 @@ ] } ], - "OmniboxAssistantVoiceSearchAndroid": [ + "OmniboxAssistantVoiceSearch": [ { "platforms": [ "android"
diff --git a/third_party/android_deps/fetch_all.py b/third_party/android_deps/fetch_all.py index 08ed7715..0e97ba19 100755 --- a/third_party/android_deps/fetch_all.py +++ b/third_party/android_deps/fetch_all.py
@@ -409,6 +409,9 @@ format='%(levelname).1s %(relativeCreated)6d %(message)s') debug = args.verbose_count >= 2 + if args.android_deps_dir.endswith("/"): + args.android_deps_dir = args.android_deps_dir[:-1] + abs_android_deps_dir = os.path.normpath( os.path.join(_CHROMIUM_SRC, args.android_deps_dir))
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index 4e71d1e9..71303b0e 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -292,10 +292,6 @@ const base::Feature kTextFragmentAnchor{"TextFragmentAnchor", base::FEATURE_ENABLED_BY_DEFAULT}; -// Writable files and native file system access. https://crbug.com/853326 -const base::Feature kNativeFileSystemAPI{"NativeFileSystemAPI", - base::FEATURE_ENABLED_BY_DEFAULT}; - // File handling integration. https://crbug.com/829689 const base::Feature kFileHandlingAPI{"FileHandlingAPI", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h index 61a9a903..0558820 100644 --- a/third_party/blink/public/common/features.h +++ b/third_party/blink/public/common/features.h
@@ -80,7 +80,6 @@ BLINK_COMMON_EXPORT extern const base::Feature kInterestCohortAPI; BLINK_COMMON_EXPORT extern const base::Feature kTextFragmentAnchor; BLINK_COMMON_EXPORT extern const base::Feature kFontAccess; -BLINK_COMMON_EXPORT extern const base::Feature kNativeFileSystemAPI; BLINK_COMMON_EXPORT extern const base::Feature kFileHandlingAPI; BLINK_COMMON_EXPORT extern const base::Feature kAllowSyncXHRInPageDismissal; BLINK_COMMON_EXPORT extern const base::Feature kPrefetchPrivacyChanges;
diff --git a/third_party/blink/public/strings/blink_strings.grd b/third_party/blink/public/strings/blink_strings.grd index 8d05759..7c562e2 100644 --- a/third_party/blink/public/strings/blink_strings.grd +++ b/third_party/blink/public/strings/blink_strings.grd
@@ -784,6 +784,12 @@ <message name="IDS_AX_MULTISELECTABLE_STATE_DESCRIPTION_NONE" desc="Accessibility state description for a multiselectable node when no children are selected"> multiselectable, none selected. </message> + <message name="IDS_AX_TOGGLE_BUTTON_ON" desc="Accessibility state description for a toggle button when it is in the on/checked state"> + On + </message> + <message name="IDS_AX_TOGGLE_BUTTON_OFF" desc="Accessibility state description for a toggle button when it is in the off/unchecked state"> + Off + </message> </if> <!-- Automatic image annotations for accessibility -->
diff --git a/third_party/blink/public/strings/blink_strings_grd/IDS_AX_TOGGLE_BUTTON_OFF.png.sha1 b/third_party/blink/public/strings/blink_strings_grd/IDS_AX_TOGGLE_BUTTON_OFF.png.sha1 new file mode 100644 index 0000000..25fc241 --- /dev/null +++ b/third_party/blink/public/strings/blink_strings_grd/IDS_AX_TOGGLE_BUTTON_OFF.png.sha1
@@ -0,0 +1 @@ +c931549c9cd042e8d3f44a325df3fd9346b26452 \ No newline at end of file
diff --git a/third_party/blink/public/strings/blink_strings_grd/IDS_AX_TOGGLE_BUTTON_ON.png.sha1 b/third_party/blink/public/strings/blink_strings_grd/IDS_AX_TOGGLE_BUTTON_ON.png.sha1 new file mode 100644 index 0000000..5b6e16c9 --- /dev/null +++ b/third_party/blink/public/strings/blink_strings_grd/IDS_AX_TOGGLE_BUTTON_ON.png.sha1
@@ -0,0 +1 @@ +3ac2df284011cb4f293a9c82e97ca32d631212c4 \ No newline at end of file
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc b/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc index 7999dd4..ad6c1ad 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc
@@ -252,6 +252,10 @@ return; v8::OwnedBuffer serialized_module = compiled_module.Serialize(); + // V8 might not be able to serialize the module. + if (serialized_module.size == 0) + return; + TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "v8.wasm.cachedModule", TRACE_EVENT_SCOPE_THREAD, "producedCacheSize", serialized_module.size);
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index 51a5dfa..da1452a60 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -1666,6 +1666,16 @@ return result; } +FloatPoint LayoutBox::PerspectiveOrigin(const PhysicalSize* size) const { + if (!HasTransformRelatedProperty()) + return FloatPoint(); + + // Use the |size| parameter instead of |Size()| if present. + FloatSize float_size = size ? FloatSize(*size) : FloatSize(Size()); + + return FloatPointForLengthPoint(StyleRef().PerspectiveOrigin(), float_size); +} + bool LayoutBox::MapVisualRectToContainer( const LayoutObject* container_object, const PhysicalOffset& container_offset, @@ -1740,8 +1750,9 @@ if (has_perspective) { // Perspective on the container affects us, so we have to factor it in here. DCHECK(container_object->HasLayer()); - FloatPoint perspective_origin = - ToLayoutBoxModelObject(container_object)->Layer()->PerspectiveOrigin(); + FloatPoint perspective_origin; + if (const auto* container_box = ToLayoutBoxOrNull(container_object)) + perspective_origin = container_box->PerspectiveOrigin(); TransformationMatrix perspective_matrix; perspective_matrix.ApplyPerspective(
diff --git a/third_party/blink/renderer/core/layout/layout_box.h b/third_party/blink/renderer/core/layout/layout_box.h index 3904acc..8507f99a 100644 --- a/third_party/blink/renderer/core/layout/layout_box.h +++ b/third_party/blink/renderer/core/layout/layout_box.h
@@ -1793,6 +1793,10 @@ TransformState::TransformAccumulation, VisualRectFlags) const; + // The optional |size| parameter is used if the size of the object isn't + // correct yet. + FloatPoint PerspectiveOrigin(const PhysicalSize* size = nullptr) const; + // Maps the visual rect state |transform_state| from this box into its // container, applying adjustments for the given container offset, // scrolling, container clipping, and transform (including container
diff --git a/third_party/blink/renderer/core/layout/layout_object.cc b/third_party/blink/renderer/core/layout/layout_object.cc index 1b1a738..c164472 100644 --- a/third_party/blink/renderer/core/layout/layout_object.cc +++ b/third_party/blink/renderer/core/layout/layout_object.cc
@@ -3123,7 +3123,8 @@ void LayoutObject::GetTransformFromContainer( const LayoutObject* container_object, const PhysicalOffset& offset_in_container, - TransformationMatrix& transform) const { + TransformationMatrix& transform, + const PhysicalSize* size) const { NOT_DESTROYED(); transform.MakeIdentity(); PaintLayer* layer = @@ -3143,8 +3144,9 @@ if (has_perspective) { // Perspective on the container affects us, so we have to factor it in here. DCHECK(container_object->HasLayer()); - FloatPoint perspective_origin = - ToLayoutBoxModelObject(container_object)->Layer()->PerspectiveOrigin(); + FloatPoint perspective_origin; + if (const auto* container_box = ToLayoutBoxOrNull(container_object)) + perspective_origin = container_box->PerspectiveOrigin(size); TransformationMatrix perspective_matrix; perspective_matrix.ApplyPerspective(
diff --git a/third_party/blink/renderer/core/layout/layout_object.h b/third_party/blink/renderer/core/layout/layout_object.h index 0b8769d0..f09c0411 100644 --- a/third_party/blink/renderer/core/layout/layout_object.h +++ b/third_party/blink/renderer/core/layout/layout_object.h
@@ -2724,9 +2724,13 @@ LayoutGeometryMap&) const; bool ShouldUseTransformFromContainer(const LayoutObject* container) const; + + // The optional |size| parameter is used if the size of the object isn't + // correct yet. void GetTransformFromContainer(const LayoutObject* container, const PhysicalOffset& offset_in_container, - TransformationMatrix&) const; + TransformationMatrix&, + const PhysicalSize* size = nullptr) const; bool CreatesGroup() const { NOT_DESTROYED();
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc index 403ab97..444f7d8 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc
@@ -701,24 +701,33 @@ DCHECK_LT(item.start_offset_, end_offset); DCHECK_LE(end_offset, item.end_offset_); DCHECK_EQ(item.layout_object_, layout_text_); + const unsigned safe_end_offset = GetLastSafeToReuse(item, end_offset); const unsigned start_offset = item.start_offset_; - if (!item.shape_result_ || item.shape_result_->IsAppliedSpacing()) - return NGInlineItem(item, start_offset, end_offset, nullptr); - if (item.end_offset_ == end_offset) - return item; - // TODO(yosin): We should handle |shape_result| doesn't have safe-to-break - // at start and end, because of |ShapeText()| splits |ShapeResult| ignoring - // safe-to-break offset. - item.shape_result_->EnsurePositionData(); - const unsigned safe_end_offset = - item.shape_result_->CachedPreviousSafeToBreakOffset(end_offset); if (start_offset == safe_end_offset) return NGInlineItem(item, start_offset, end_offset, nullptr); + // To handle kerning, e.g. "AV", we should not reuse last glyph. + // See http://crbug.com/1129710 + DCHECK_LT(safe_end_offset, item.end_offset_); return NGInlineItem( item, start_offset, safe_end_offset, item.shape_result_->SubRange(start_offset, safe_end_offset)); } + unsigned GetLastSafeToReuse(const NGInlineItem& item, + unsigned end_offset) const { + DCHECK_LT(item.start_offset_, end_offset); + DCHECK_LE(end_offset, item.end_offset_); + DCHECK_EQ(item.layout_object_, layout_text_); + const unsigned start_offset = item.start_offset_; + if (!item.shape_result_ || item.shape_result_->IsAppliedSpacing() || + end_offset - start_offset <= 1) + return start_offset; + item.shape_result_->EnsurePositionData(); + // Note: Because |CachedPreviousSafeToBreakOffset()| assumes |end_offset| + // is always safe to break offset, we try to search before |end_offset|. + return item.shape_result_->CachedPreviousSafeToBreakOffset(end_offset - 1); + } + static void ShiftItem(NGInlineItem* item, int delta) { if (delta == 0) return;
diff --git a/third_party/blink/renderer/core/page/viewport_description.cc b/third_party/blink/renderer/core/page/viewport_description.cc index 3b4ca939..61645fc 100644 --- a/third_party/blink/renderer/core/page/viewport_description.cc +++ b/third_party/blink/renderer/core/page/viewport_description.cc
@@ -267,21 +267,6 @@ if (max_width.IsFixed()) { meta_tag_type_histogram.Count( static_cast<int>(ViewportUMAType::kConstantWidth)); - - if (main_frame->View()) { - // To get an idea of how "far" the viewport is from the device's ideal - // width, we report the zoom level that we'd need to be at for the - // entire page to be visible. - int viewport_width = max_width.IntValue(); - int window_width = - main_frame->GetPage()->GetVisualViewport().Size().Width(); - int overview_zoom_percent = - 100 * window_width / static_cast<float>(viewport_width); - DEFINE_STATIC_LOCAL(SparseHistogram, overview_zoom_histogram, - ("Viewport.OverviewZoom")); - overview_zoom_histogram.Sample(overview_zoom_percent); - } - } else if (max_width.IsDeviceWidth() || max_width.IsExtendToZoom()) { meta_tag_type_histogram.Count( static_cast<int>(ViewportUMAType::kDeviceWidth));
diff --git a/third_party/blink/renderer/core/page/viewport_test.cc b/third_party/blink/renderer/core/page/viewport_test.cc index 5c0e210..cf24d2a 100644 --- a/third_party/blink/renderer/core/page/viewport_test.cc +++ b/third_party/blink/renderer/core/page/viewport_test.cc
@@ -3304,11 +3304,6 @@ static_cast<int>(type), 1); } - void ExpectOverviewZoom(int sample) { - histogram_tester_.ExpectTotalCount("Viewport.OverviewZoom", 1); - histogram_tester_.ExpectBucketCount("Viewport.OverviewZoom", sample, 1); - } - void ExpectTotalCount(const std::string& histogram, int count) { histogram_tester_.ExpectTotalCount(histogram, 0); } @@ -3331,19 +3326,16 @@ UseMetaTag("<meta name='viewport' content='width=device-width'>"); ExpectTotalCount("Viewport.MetaTagType", 0); - ExpectTotalCount("Viewport.OverviewZoom", 0); } TEST_F(ViewportHistogramsTest, TypeNone) { UseMetaTag(""); ExpectType(ViewportDescription::ViewportUMAType::kNoViewportTag); - ExpectTotalCount("Viewport.OverviewZoom", 0); } TEST_F(ViewportHistogramsTest, TypeDeviceWidth) { UseMetaTag("<meta name='viewport' content='width=device-width'>"); ExpectType(ViewportDescription::ViewportUMAType::kDeviceWidth); - ExpectTotalCount("Viewport.OverviewZoom", 0); } TEST_F(ViewportHistogramsTest, TypeConstant) { @@ -3354,13 +3346,11 @@ TEST_F(ViewportHistogramsTest, TypeHandheldFriendlyMeta) { UseMetaTag("<meta name='HandheldFriendly' content='true'/> "); ExpectType(ViewportDescription::ViewportUMAType::kMetaHandheldFriendly); - ExpectTotalCount("Viewport.OverviewZoom", 0); } TEST_F(ViewportHistogramsTest, TypeMobileOptimizedMeta) { UseMetaTag("<meta name='MobileOptimized' content='320'/> "); ExpectType(ViewportDescription::ViewportUMAType::kMetaMobileOptimized); - ExpectTotalCount("Viewport.OverviewZoom", 0); } TEST_F(ViewportHistogramsTest, TypeXhtml) { @@ -3368,15 +3358,6 @@ "<!DOCTYPE html PUBLIC '-//WAPFORUM//DTD XHTML Mobile 1.1//EN' " "'http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd'"); ExpectType(ViewportDescription::ViewportUMAType::kXhtmlMobileProfile); - ExpectTotalCount("Viewport.OverviewZoom", 0); -} - -TEST_F(ViewportHistogramsTest, OverviewZoom) { - UseMetaTag("<meta name='viewport' content='width=1000'>"); - - // Since the viewport is 500px wide and the layout width is 1000px we expect - // the metric to report 50%. - ExpectOverviewZoom(50); } } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.cc b/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.cc index c6f2d3c..cf0ee516 100644 --- a/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.cc +++ b/third_party/blink/renderer/core/paint/compositing/compositing_inputs_updater.cc
@@ -95,7 +95,7 @@ geometry_map_->PushMappingsToAncestor(layer, layer->Parent()); UpdateAncestorInfo(layer, update_type, info); if (layer != compositing_inputs_root_ && - (layer->IsRootLayer() || layer->GetLayoutObject().IsScrollContainer())) + layer->GetLayoutObject().IsScrollContainer()) info.last_scroll_container_layer = layer; } @@ -151,7 +151,7 @@ geometry_map_->PushMappingsToAncestor(layer, layer->Parent()); UpdateAncestorInfo(layer, update_type, info); } - if (layer->IsRootLayer() || layout_object.IsScrollContainer()) + if (layout_object.IsScrollContainer()) info.last_scroll_container_layer = layer; PaintLayerCompositor* compositor =
diff --git a/third_party/blink/renderer/core/paint/paint_layer.cc b/third_party/blink/renderer/core/paint/paint_layer.cc index 831e5f3c..deb63c30 100644 --- a/third_party/blink/renderer/core/paint/paint_layer.cc +++ b/third_party/blink/renderer/core/paint/paint_layer.cc
@@ -856,17 +856,6 @@ } } -FloatPoint PaintLayer::PerspectiveOrigin() const { - if (!GetLayoutObject().HasTransformRelatedProperty()) - return FloatPoint(); - - const LayoutRect border_box = ToLayoutBox(GetLayoutObject()).BorderBoxRect(); - const ComputedStyle& style = GetLayoutObject().StyleRef(); - - return FloatPointForLengthPoint(style.PerspectiveOrigin(), - FloatSize(border_box.Size())); -} - PaintLayer* PaintLayer::ContainingLayer(const PaintLayer* ancestor, bool* skipped_ancestor) const { // If we have specified an ancestor, surely the caller needs to know whether
diff --git a/third_party/blink/renderer/core/paint/paint_layer.h b/third_party/blink/renderer/core/paint/paint_layer.h index 48e8518..89720d3 100644 --- a/third_party/blink/renderer/core/paint/paint_layer.h +++ b/third_party/blink/renderer/core/paint/paint_layer.h
@@ -532,7 +532,6 @@ TransformationMatrix CurrentTransform() const; TransformationMatrix RenderableTransform(GlobalPaintFlags) const; - FloatPoint PerspectiveOrigin() const; bool Preserves3D() const { return GetLayoutObject().StyleRef().Preserves3D(); }
diff --git a/third_party/blink/renderer/core/paint/pre_paint_tree_walk.cc b/third_party/blink/renderer/core/paint/pre_paint_tree_walk.cc index 1b7e071b..80dd072 100644 --- a/third_party/blink/renderer/core/paint/pre_paint_tree_walk.cc +++ b/third_party/blink/renderer/core/paint/pre_paint_tree_walk.cc
@@ -386,7 +386,7 @@ // update layer position and ancestor inputs updates in the same walk). paint_layer->UpdateLayerPosition(); } - if (paint_layer->IsRootLayer() || object.IsScrollContainer()) + if (object.IsScrollContainer()) context.ancestor_scroll_container_paint_layer = paint_layer; }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc index ca98453..cc644926 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc
@@ -2863,21 +2863,21 @@ bool is_continuation = child->GetLayoutObject() && child->GetLayoutObject()->IsElementContinuation(); - // Don't recurse into children that are explicitly marked as aria-hidden. - // Note that we don't call isInertOrAriaHidden because that would return + // Don't recurse into children that are explicitly hidden. + // Note that we don't call IsInertOrAriaHidden because that would return // true if any ancestor is hidden, but we need to be able to compute the // accessible name of object inside hidden subtrees (for example, if // aria-labelledby points to an object that's hidden). if (!is_continuation && - child->AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kHidden)) + (child->AOMPropertyOrARIAAttributeIsTrue(AOMBooleanProperty::kHidden) || + child->IsHiddenForTextAlternativeCalculation())) continue; ax::mojom::blink::NameFrom child_name_from = ax::mojom::blink::NameFrom::kUninitialized; String result; if (!is_continuation && child->IsPresentational()) { - if (child->IsVisible()) - result = child->TextFromDescendants(visited, true); + result = child->TextFromDescendants(visited, true); } else { result = RecursiveTextAlternative(*child, false, visited, child_name_from); @@ -3113,24 +3113,36 @@ return AXObject::TextOffsetInFormattingContext(offset); // We support calculating the text offset from the start of the formatting - // contexts of the following layout objects: (Note that in the following - // examples, the paragraph is the formatting context. + // contexts of the following layout objects, provided that they are at + // inline-level, (display=inline) or "display=inline-block": + // + // (Note that in the following examples, the paragraph is the formatting + // context. // // Layout replaced, e.g. <p><img></p>. // Layout inline with a layout text child, e.g. <p><a href="#">link</a></p>. // Layout block flow, e.g. <p><b style="display: inline-block;"></b></p>. // Layout text, e.g. <p>Hello</p>. // Layout br (subclass of layout text), e.g. <p><br></p>. + if (layout_obj->IsLayoutInline()) { // The NGOffsetMapping class doesn't map layout inline objects to their text - // mappings. We need to retrieve the first layout text or layout replaced - // child. + // mappings because such an operation could be ambiguous. An inline object + // may have another inline object inside it. For example, + // <span><span>Inner</span outer</span>. We need to recursively retrieve the + // first layout text or layout replaced child so that any potential + // ambiguity would be removed. const AXObject* first_child = FirstChildIncludingIgnored(); return first_child ? first_child->TextOffsetInFormattingContext(offset) : offset; } - if (!layout_obj->IsLayoutReplaced() && !layout_obj->IsLayoutBlockFlow() && - !layout_obj->IsText()) { + + // TODO(crbug.com/567964): LayoutObject::IsAtomicInlineLevel() also includes + // block-level replaced elements. We need to explicitly exclude them via + // LayoutObject::IsInline(). + const bool is_atomic_inline_level = + layout_obj->IsInline() && layout_obj->IsAtomicInlineLevel(); + if (!is_atomic_inline_level && !layout_obj->IsText()) { // Not in a formatting context in which text offsets are meaningful. return AXObject::TextOffsetInFormattingContext(offset); }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_node_object_test.cc b/third_party/blink/renderer/modules/accessibility/ax_node_object_test.cc index 4dd2a4d..44a2703 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_node_object_test.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_node_object_test.cc
@@ -24,6 +24,7 @@ // After white space is compressed, the word "before" plus a single white // space is of length 7. EXPECT_EQ(7, ax_replaced->TextOffsetInFormattingContext(0)); + EXPECT_EQ(8, ax_replaced->TextOffsetInFormattingContext(1)); } TEST_P(ParameterizedAccessibilityTest, @@ -40,10 +41,11 @@ // After white space is compressed, the word "before" plus a single white // space is of length 7. EXPECT_EQ(7, ax_inline->TextOffsetInFormattingContext(0)); + EXPECT_EQ(8, ax_inline->TextOffsetInFormattingContext(1)); } TEST_P(ParameterizedAccessibilityTest, - TextOffsetInFormattingContextWithLayoutBlockFlow) { + TextOffsetInFormattingContextWithLayoutBlockFlowAtInlineLevel) { SetBodyInnerHTML(R"HTML( <p> Before @@ -57,6 +59,28 @@ // After white space is compressed, the word "before" plus a single white // space is of length 7. EXPECT_EQ(7, ax_block_flow->TextOffsetInFormattingContext(0)); + EXPECT_EQ(8, ax_block_flow->TextOffsetInFormattingContext(1)); +} + +TEST_P(ParameterizedAccessibilityTest, + TextOffsetInFormattingContextWithLayoutBlockFlowAtBlockLevel) { + // NGOffsetMapping does not support block flow objects that are at + // block-level, so we do not support them as well. + SetBodyInnerHTML(R"HTML( + <p> + Before + <b id="block-flow" style="display: block;">block flow</b> + after. + </p>)HTML"); + + const AXObject* ax_block_flow = GetAXObjectByElementId("block-flow"); + ASSERT_NE(nullptr, ax_block_flow); + ASSERT_EQ(ax::mojom::Role::kGenericContainer, ax_block_flow->RoleValue()); + // Since block-level elements do not expose a count of the number of + // characters from the beginning of their formatting context, we return the + // same offset that was passed in. + EXPECT_EQ(0, ax_block_flow->TextOffsetInFormattingContext(0)); + EXPECT_EQ(1, ax_block_flow->TextOffsetInFormattingContext(1)); } TEST_P(ParameterizedAccessibilityTest, @@ -74,6 +98,7 @@ // After white space is compressed, the word "before" plus a single white // space is of length 7. EXPECT_EQ(7, ax_text->TextOffsetInFormattingContext(0)); + EXPECT_EQ(8, ax_text->TextOffsetInFormattingContext(1)); } TEST_P(ParameterizedAccessibilityTest, @@ -89,6 +114,7 @@ ASSERT_EQ("\n", ax_br->ComputedName()); // After white space is compressed, the word "before" is of length 6. EXPECT_EQ(6, ax_br->TextOffsetInFormattingContext(0)); + EXPECT_EQ(7, ax_br->TextOffsetInFormattingContext(1)); } TEST_P(ParameterizedAccessibilityTest, @@ -111,6 +137,7 @@ // After white space is compressed, the word "before" plus a single white // space is of length 7. EXPECT_EQ(7, ax_first_letter->TextOffsetInFormattingContext(0)); + EXPECT_EQ(8, ax_first_letter->TextOffsetInFormattingContext(1)); } TEST_P(ParameterizedAccessibilityTest, @@ -136,6 +163,7 @@ // After white space is compressed, the word "before" plus a single white // space is of length 7. EXPECT_EQ(7, ax_css_generated->TextOffsetInFormattingContext(0)); + EXPECT_EQ(8, ax_css_generated->TextOffsetInFormattingContext(1)); } } // namespace test
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index 29f501be..9169a57 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -510,6 +510,17 @@ return node->GetDocument().ActiveModalDialog(); } +bool HasUninheritedHiddenVisibility(const ComputedStyle* style, Node* node) { + // Is this the root of a visibility:hidden or visibility:collapsed subtree? + if (style->Visibility() == EVisibility::kVisible) + return false; + Node* parent = node->parentNode(); + if (!parent) + return true; + return !parent->GetComputedStyle() || + parent->GetComputedStyle()->Visibility() == EVisibility::kVisible; +} + } // namespace unsigned AXObject::number_of_live_ax_objects_ = 0; @@ -1343,6 +1354,19 @@ #endif last_modification_count_ = cache.ModificationCount(); + + if (GetElement() && !GetLayoutObject() && + !DisplayLockUtilities::NearestLockedExclusiveAncestor(*GetNode())) { + // While it's safe to do so, ensure the computed style for display:none + // nodes, so that IsHiddenForTextAlternativeCalculation() can determine + // whether the node is directly styled as display:none vs hidden because + // of display:none on an ancestor. + // If there is no computed style, assume that it may be display:none, + // since we can't prove otherwise. + const ComputedStyle* style = GetElement()->GetComputedStyle(); + if (!style || style->IsEnsuredInDisplayNone()) + GetElement()->EnsureComputedStyle(); + } cached_background_color_ = ComputeBackgroundColor(); cached_is_inert_or_aria_hidden_ = ComputeIsInertOrAriaHidden(); cached_is_descendant_of_leaf_node_ = !!LeafNodeAncestor(); @@ -2081,18 +2105,12 @@ AXObject::AXObjectVector* name_objects) const { HeapHashSet<Member<const AXObject>> visited; AXRelatedObjectVector related_objects; - // For purposes of computing a text alternative, if an ignored node is - // included in the tree, assume that it is the target of aria-labelledby or - // aria-describedby, since we can't tell yet whether that's the case. If it - // isn't exposed, the AT will never see the name anyways. - bool hidden_and_ignored_but_included_in_tree = - IsHiddenForTextAlternativeCalculation() && - AccessibilityIsIgnoredButIncludedInTree(); + // Initialize |name_from|, as TextAlternative() might never set it in some // cases. name_from = ax::mojom::blink::NameFrom::kNone; - String text = TextAlternative(false, hidden_and_ignored_but_included_in_tree, - visited, name_from, &related_objects, nullptr); + String text = TextAlternative(false, false, visited, name_from, + &related_objects, nullptr); ax::mojom::blink::Role role = RoleValue(); if (!GetNode() || (!IsA<HTMLBRElement>(GetNode()) && @@ -2113,16 +2131,8 @@ AXObjectSet visited; ax::mojom::blink::NameFrom tmp_name_from; AXRelatedObjectVector tmp_related_objects; - // For purposes of computing a text alternative, if an ignored node is - // included in the tree, assume that it is the target of aria-labelledby or - // aria-describedby, since we can't tell yet whether that's the case. If it - // isn't exposed, the AT will never see the name anyways. - bool hidden_and_ignored_but_included_in_tree = - IsHiddenForTextAlternativeCalculation() && - AccessibilityIsIgnoredButIncludedInTree(); - String text = - TextAlternative(false, hidden_and_ignored_but_included_in_tree, visited, - tmp_name_from, &tmp_related_objects, name_sources); + String text = TextAlternative(false, false, visited, tmp_name_from, + &tmp_related_objects, name_sources); text = text.SimplifyWhiteSpace(IsHTMLSpace<UChar>); return text; } @@ -2167,6 +2177,15 @@ return false; } +// Return true if this should be removed from accessible name computations, +// unless it is reached by following an aria-labelledby. When that happens, this +// is not checked, because aria-labelledby can use hidden subtrees. +// Because aria-labelledby can use hidden subtrees, when it has entered a hidden +// subtree, it is not enough to check if the element was hidden by an ancestor. +// In this case, return true only if the hiding style targeted the node +// directly, as opposed to having inherited the hiding style. Using inherited +// hiding styles is problematic because it would prevent name contributions from +// deeper nodes in hidden aria-labelledby subtrees. bool AXObject::IsHiddenForTextAlternativeCalculation() const { if (AOMPropertyOrARIAAttributeIsFalse(AOMBooleanProperty::kHidden)) return false; @@ -2179,30 +2198,31 @@ if (DisplayLockUtilities::NearestLockedExclusiveAncestor(*node)) return false; - if (GetLayoutObject()) - return GetLayoutObject()->Style()->Visibility() != EVisibility::kVisible; + Document* document = GetDocument(); + if (!document || !document->GetFrame()) + return false; - if (IsA<HTMLNoScriptElement>(node)) + if (GetLayoutObject()) { + return HasUninheritedHiddenVisibility(GetLayoutObject()->Style(), + GetNode()); + } else if (GetNode() && IsA<HTMLNoScriptElement>(GetNode())) { return true; + } - // This is an obscure corner case: if a node has no LayoutObject, that means + // This is an important corner case: if a node has no LayoutObject, that means // it's not rendered, but we still may be exploring it as part of a text // alternative calculation, for example if it was explicitly referenced by // aria-labelledby. So we need to explicitly call the style resolver to check // whether it's invisible or display:none, rather than relying on the style // cached in the LayoutObject. - Document* document = GetDocument(); - if (!document || !document->GetFrame()) - return false; - auto* element = DynamicTo<Element>(node); if (element && node->isConnected()) { - const ComputedStyle* style = element->EnsureComputedStyle(); + const ComputedStyle* style = element->GetComputedStyle(); if (!style) return false; if (style->Display() == EDisplay::kNone || - style->Visibility() != EVisibility::kVisible) { + HasUninheritedHiddenVisibility(style, GetNode())) { return true; }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.h b/third_party/blink/renderer/modules/accessibility/ax_object.h index 298c3265..3f8798d 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.h +++ b/third_party/blink/renderer/modules/accessibility/ax_object.h
@@ -716,22 +716,26 @@ virtual int TextLength() const { return 0; } - // Supported on layout inline, layout text, layout replaced, layout block flow - // and native text field. For all other object types, returns |offset|. + // Supported on layout inline, layout text, layout replaced, and layout block + // flow, provided that they are at inline-level, i.e. "display=inline" or + // "display=inline-block". Also supported on native text fields. For all other + // object types, returns |offset|. // // For layout inline, text, replaced, and block flow: Translates the given // character offset to the equivalent offset in the object's formatting - // context. This is the deepest block flow ancestor, (excluding the current - // object), e.g. a paragraph. If this object is somehow not a descendant of a - // block flow in the layout tree, returns the given offset. + // context. The formatting context is the deepest block flow ancestor, + // (excluding the current object), e.g. the containing paragraph. If this + // object is somehow not a descendant of a block flow in the layout tree, + // returns |offset|. // - // For example, if the given offset is 0, this would return the number of - // characters, excluding any collapsed white space found in the DOM, from the - // start of the layout inline's deepest block flow ancestor, e.g. the - // beginning of the paragraph in which a span is found. + // For example, if this object is a span, and |offset| is 0, this method would + // return the number of characters, excluding any collapsed white space found + // in the DOM, from the start of the layout inline's deepest block flow + // ancestor, e.g. the beginning of the paragraph in which the span is found. // // For native text fields: Simply returns |offset|, because native text fields - // have no collapsed white space and so no translation is necessary. + // have no collapsed white space and so no translation from a DOM to an + // accessible text offset is necessary. virtual int TextOffsetInFormattingContext(int offset) const; // For all inline text boxes and native text fields. For all other object @@ -747,7 +751,8 @@ // start of the inline text box's static text parent. // // For native text fields: Simply returns |offset|, because native text fields - // have no collapsed white space and so no translation is necessary. + // have no collapsed white space and so no translation from a DOM to an + // accessible text offset is necessary. virtual int TextOffsetInContainer(int offset) const; // Properties of interactive elements. @@ -1220,6 +1225,8 @@ // Blink-internal DOM Node ID. Currently used for PDF exporting. int GetDOMNodeId() const; + bool IsHiddenForTextAlternativeCalculation() const; + // Returns a string representation of this object. String ToString(bool verbose = false) const; @@ -1241,7 +1248,6 @@ bool in_aria_labelled_by_traversal, AXObjectSet& visited, ax::mojom::blink::NameFrom& name_from); - bool IsHiddenForTextAlternativeCalculation() const; String AriaTextAlternative(bool recursive, bool in_aria_labelled_by_traversal, AXObjectSet& visited,
diff --git a/third_party/blink/renderer/modules/accessibility/ax_position.cc b/third_party/blink/renderer/modules/accessibility/ax_position.cc index 9bac32d4..33f82d3 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_position.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_position.cc
@@ -238,9 +238,12 @@ AXPosition ax_position(*container); // Convert from a DOM offset that may have uncompressed white space to a // character offset. + // + // Note that NGOffsetMapping::GetInlineFormattingContextOf will reject DOM + // positions that it does not support, so we don't need to explicitly check + // this before calling the method.) LayoutBlockFlow* formatting_context = - NGOffsetMapping::GetInlineFormattingContextOf( - *container_node->GetLayoutObject()); + NGOffsetMapping::GetInlineFormattingContextOf(parent_anchored_position); const NGOffsetMapping* container_offset_mapping = formatting_context ? NGInlineNode::GetOffsetMapping(formatting_context) : nullptr; @@ -429,8 +432,15 @@ } const LayoutObject* layout_object = container_node->GetLayoutObject(); - if (!layout_object || !layout_object->IsText()) + if (!layout_object) return container_object_->ComputedName().length(); + // TODO(nektar): Remove all this logic once we switch to + // AXObject::TextLength(). + const bool is_atomic_inline_level = + layout_object->IsInline() && layout_object->IsAtomicInlineLevel(); + if (!is_atomic_inline_level && !layout_object->IsText()) + return container_object_->ComputedName().length(); + LayoutBlockFlow* formatting_context = NGOffsetMapping::GetInlineFormattingContextOf(*layout_object); const NGOffsetMapping* container_offset_mapping = @@ -888,14 +898,29 @@ affinity_); } - // Convert from a text offset, which may have white space collapsed, to a DOM - // offset which should have uncompressed white space. - LayoutBlockFlow* formatting_context = - NGOffsetMapping::GetInlineFormattingContextOf( - *container_node->GetLayoutObject()); - const NGOffsetMapping* container_offset_mapping = - formatting_context ? NGInlineNode::GetOffsetMapping(formatting_context) - : nullptr; + // If NGOffsetMapping supports it, convert from a text offset, which may have + // white space collapsed, to a DOM offset which should have uncompressed white + // space. NGOffsetMapping supports layout text, layout replaced, ruby runs, + // list markers, and layout block flow at inline-level, i.e. "display=inline" + // or "display=inline-block". It also supports out-of-flow elements, which + // should not be relevant to text positions in the accessibility tree. + const LayoutObject* layout_object = container_node->GetLayoutObject(); + // TODO(crbug.com/567964): LayoutObject::IsAtomicInlineLevel() also includes + // block-level replaced elements. We need to explicitly exclude them via + // LayoutObject::IsInline(). + const bool supports_ng_offset_mapping = + layout_object && + ((layout_object->IsInline() && layout_object->IsAtomicInlineLevel()) || + layout_object->IsText()); + const NGOffsetMapping* container_offset_mapping = nullptr; + if (supports_ng_offset_mapping) { + LayoutBlockFlow* formatting_context = + NGOffsetMapping::GetInlineFormattingContextOf(*layout_object); + container_offset_mapping = + formatting_context ? NGInlineNode::GetOffsetMapping(formatting_context) + : nullptr; + } + if (!container_offset_mapping) { // We are unable to compute the text offset in the accessibility tree that // corresponds to the DOM offset. We do the next best thing by returning
diff --git a/third_party/blink/renderer/modules/accessibility/ax_selection_test.cc b/third_party/blink/renderer/modules/accessibility/ax_selection_test.cc index 9be5de1..06f217e 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_selection_test.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_selection_test.cc
@@ -83,10 +83,11 @@ EXPECT_EQ( "++<GenericContainer>\n" - "++++<Paragraph>\n" - "++++++<StaticText: Hel^lo.>\n" - "++++<Paragraph>\n" - "++++++<StaticText: How are you?>\n|", + "++++<GenericContainer>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: Hel^lo.>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: How are you?>\n|", GetSelectionText(ax_selection)); } @@ -105,20 +106,24 @@ ASSERT_TRUE(ax_selection.IsValid()); ASSERT_FALSE(ax_selection.Base().IsTextPosition()); - EXPECT_EQ(GetAXRootObject(), ax_selection.Base().ContainerObject()); + + AXObject* html_object = GetAXRootObject()->ChildAtIncludingIgnored(0); + ASSERT_NE(nullptr, html_object); + EXPECT_EQ(html_object, ax_selection.Base().ContainerObject()); EXPECT_EQ(0, ax_selection.Base().ChildIndex()); ASSERT_FALSE(ax_selection.Extent().IsTextPosition()); - EXPECT_EQ(GetAXRootObject(), ax_selection.Extent().ContainerObject()); - EXPECT_EQ(GetAXRootObject()->ChildCountIncludingIgnored(), + EXPECT_EQ(html_object, ax_selection.Extent().ContainerObject()); + EXPECT_EQ(html_object->ChildCountIncludingIgnored(), ax_selection.Extent().ChildIndex()); EXPECT_EQ( - "^++<GenericContainer>\n" - "++++<Paragraph>\n" - "++++++<StaticText: Hello.>\n" - "++++<Paragraph>\n" - "++++++<StaticText: How are you?>\n|", + "++<GenericContainer>\n" + "^++++<GenericContainer>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: Hello.>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: How are you?>\n|", GetSelectionText(ax_selection)); } @@ -200,10 +205,11 @@ EXPECT_FALSE(Selection().GetSelectionInDOMTree().IsNone()); EXPECT_EQ( "++<GenericContainer>\n" - "++++<Paragraph>\n" - "++++++<StaticText: Hel^lo.>\n" - "++++<Paragraph>\n" - "++++++<StaticText: How are you?>\n|", + "++++<GenericContainer>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: Hel^lo.>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: How are you?>\n|", GetSelectionText(AXSelection::FromCurrentSelection(GetDocument()))); } @@ -260,8 +266,9 @@ EXPECT_EQ(5, dom_selection.Extent().OffsetInContainerNode()); EXPECT_EQ( "++<GenericContainer>\n" - "++++<Paragraph>\n" - "++++++<StaticText: Hel^lo|>\n", + "++++<GenericContainer>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: Hel^lo|>\n", GetSelectionText(ax_selection)); } @@ -291,8 +298,9 @@ EXPECT_EQ(10, dom_selection.Extent().OffsetInContainerNode()); EXPECT_EQ( "++<GenericContainer>\n" - "++++<Paragraph>\n" - "++++++<StaticText: Hel^lo|>\n", + "++++<GenericContainer>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: Hel^lo|>\n", GetSelectionText(ax_selection)); } @@ -335,10 +343,11 @@ // selection focus marker '|' should be after it. EXPECT_EQ( "++<GenericContainer>\n" - "++++<Paragraph>\n" - "++++++<StaticText: Hello>\n" - "^++++++<LineBreak: \n>\n" - "|++++++<StaticText: |How are you.>\n", + "++++<GenericContainer>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: Hello>\n" + "^++++++++<LineBreak: \n>\n" + "|++++++++<StaticText: |How are you.>\n", GetSelectionText(ax_selection)); } @@ -383,10 +392,11 @@ // selection focus marker '|' should be after it. EXPECT_EQ( "++<GenericContainer>\n" - "++++<Paragraph>\n" - "++++++<StaticText: Hello>\n" - "^++++++<LineBreak: \n>\n" - "|++++++<StaticText: |How are you.>\n", + "++++<GenericContainer>\n" + "++++++<Paragraph>\n" + "++++++++<StaticText: Hello>\n" + "^++++++++<LineBreak: \n>\n" + "|++++++++<StaticText: |How are you.>\n", GetSelectionText(ax_selection)); } @@ -476,15 +486,16 @@ // to DOM selections. const std::string selection_text( "++<GenericContainer>\n" - "++++<Main>\n" - "++++++<Paragraph>\n" - "++++++++<StaticText: Before display:none.>\n" - "++++++<Paragraph: Display:none 1.>\n" - "^++++++<Paragraph>\n" - "++++++++<StaticText: In between two display:none elements.>\n" - "++++++<Paragraph: Display:none 2.>\n" - "|++++++<Paragraph>\n" - "++++++++<StaticText: After display:none.>\n"); + "++++<GenericContainer>\n" + "++++++<Main>\n" + "++++++++<Paragraph>\n" + "++++++++++<StaticText: Before display:none.>\n" + "++++++++<Paragraph>\n" + "^++++++++<Paragraph>\n" + "++++++++++<StaticText: In between two display:none elements.>\n" + "++++++++<Paragraph>\n" + "|++++++++<Paragraph>\n" + "++++++++++<StaticText: After display:none.>\n"); EXPECT_EQ(selection_text, GetSelectionText(ax_selection_shrink)); EXPECT_EQ(selection_text, GetSelectionText(ax_selection_extend)); } @@ -572,27 +583,29 @@ if (LayoutNGEnabled()) { expectations = "++<GenericContainer>\n" - "++++<Main>\n" - "++++++<List>\n" - "++++++++<ListItem>\n" - "++++++++++<ListMarker: \xE2\x80\xA2 >\n" - "^++++++++++++<StaticText: ^\xE2\x80\xA2 >\n" - "++++++++++<StaticText: Item 1.>\n" - "++++++++<ListItem>\n" - "++++++++++<ListMarker: \xE2\x80\xA2 >\n" - "++++++++++++<StaticText: \xE2\x80\xA2 >\n" - "++++++++++<StaticText: Item 2.|>\n"; + "++++<GenericContainer>\n" + "++++++<Main>\n" + "++++++++<List>\n" + "++++++++++<ListItem>\n" + "++++++++++++<ListMarker: \xE2\x80\xA2 >\n" + "^++++++++++++++<StaticText: ^\xE2\x80\xA2 >\n" + "++++++++++++<StaticText: Item 1.>\n" + "++++++++++<ListItem>\n" + "++++++++++++<ListMarker: \xE2\x80\xA2 >\n" + "++++++++++++++<StaticText: \xE2\x80\xA2 >\n" + "++++++++++++<StaticText: Item 2.|>\n"; } else { expectations = "++<GenericContainer>\n" - "++++<Main>\n" - "++++++<List>\n" - "++++++++<ListItem>\n" - "++++++++++<ListMarker: \xE2\x80\xA2 >\n" - "^++++++++++<StaticText: Item 1.>\n" - "++++++++<ListItem>\n" - "++++++++++<ListMarker: \xE2\x80\xA2 >\n" - "++++++++++<StaticText: Item 2.|>\n"; + "++++<GenericContainer>\n" + "++++++<Main>\n" + "++++++++<List>\n" + "++++++++++<ListItem>\n" + "++++++++++++<ListMarker: \xE2\x80\xA2 >\n" + "^++++++++++++<StaticText: Item 1.>\n" + "++++++++++<ListItem>\n" + "++++++++++++<ListMarker: \xE2\x80\xA2 >\n" + "++++++++++++<StaticText: Item 2.|>\n"; } // The |AXSelection| should remain unaffected by any shrinking and should
diff --git a/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc b/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc index 666729c..4d541ef 100644 --- a/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc +++ b/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc
@@ -8,6 +8,7 @@ #include <iterator> #include "base/memory/scoped_refptr.h" +#include "third_party/blink/public/platform/file_path_conversion.h" #include "third_party/blink/renderer/core/dom/character_data.h" #include "third_party/blink/renderer/core/dom/container_node.h" #include "third_party/blink/renderer/core/dom/node.h" @@ -346,7 +347,7 @@ void AccessibilitySelectionTest::SetUp() { AccessibilityTest::SetUp(); - RuntimeEnabledFeatures::SetAccessibilityExposeHTMLElementEnabled(false); + RuntimeEnabledFeatures::SetAccessibilityExposeHTMLElementEnabled(true); } std::string AccessibilitySelectionTest::GetCurrentSelectionText() const { @@ -442,6 +443,11 @@ } EXPECT_EQ(ax_file_contents, actual_ax_file_contents); + + // Uncomment these lines to write the output to the expectations file. + // TODO(dmazzoni): make this a command-line parameter. + // if (ax_file_contents != actual_ax_file_contents) + // base::WriteFile(WebStringToFilePath(ax_file), actual_ax_file_contents); } ParameterizedAccessibilitySelectionTest::
diff --git a/third_party/blink/renderer/modules/accessibility/testing/data/selection/aria-hidden-ax.txt b/third_party/blink/renderer/modules/accessibility/testing/data/selection/aria-hidden-ax.txt index ec18cac..99cbf9e 100644 --- a/third_party/blink/renderer/modules/accessibility/testing/data/selection/aria-hidden-ax.txt +++ b/third_party/blink/renderer/modules/accessibility/testing/data/selection/aria-hidden-ax.txt
@@ -3,14 +3,15 @@ AXSelection from AX object anchored position in "Main": "", 1 to AX object anchored position in "Main": "", 4 ================================================================================ ++<GenericContainer> -++++<Main> -++++++<Paragraph> -++++++++<StaticText: Before aria-hidden.> -^++++++<Paragraph> -++++++++<StaticText: Aria-hidden 1.> -++++++<Paragraph> -++++++++<StaticText: In the middle of aria-hidden.> -++++++<Paragraph> -++++++++<StaticText: Aria-hidden 2.> -|++++++<Paragraph> -++++++++<StaticText: After aria-hidden.> +++++<GenericContainer> +++++++<Main> +++++++++<Paragraph> +++++++++++<StaticText: Before aria-hidden.> +^++++++++<Paragraph> +++++++++++<StaticText: Aria-hidden 1.> +++++++++<Paragraph> +++++++++++<StaticText: In the middle of aria-hidden.> +++++++++<Paragraph> +++++++++++<StaticText: Aria-hidden 2.> +|++++++++<Paragraph> +++++++++++<StaticText: After aria-hidden.>
diff --git a/third_party/blink/renderer/modules/accessibility/testing/data/selection/list-ax-layout-ng-disabled.txt b/third_party/blink/renderer/modules/accessibility/testing/data/selection/list-ax-layout-ng-disabled.txt index 2d576b50..19e45d1c 100644 --- a/third_party/blink/renderer/modules/accessibility/testing/data/selection/list-ax-layout-ng-disabled.txt +++ b/third_party/blink/renderer/modules/accessibility/testing/data/selection/list-ax-layout-ng-disabled.txt
@@ -3,47 +3,49 @@ AXSelection from AX object anchored position in "List": "", 1 to AX object anchored position in "List": "", 3 ================================================================================ ++<GenericContainer> -++++<List> -++++++<ListItem> -++++++++<ListMarker: 1. > -++++++++<StaticText: tic> -^++++++<ListItem> -++++++++<ListMarker: 2. > -++++++++<StaticText: tac> -++++++<ListItem> -++++++++<ListMarker: 3. > -++++++++<StaticText: toe> -|++++<List> -++++++<ListItem> -++++++++<StaticText: tic> -++++++<StaticText: > -++++++<ListItem> -++++++++<StaticText: tac> -++++++<StaticText: > -++++++<ListItem> -++++++++<StaticText: toe> +++++<GenericContainer> +++++++<List> +++++++++<ListItem> +++++++++++<ListMarker: 1. > +++++++++++<StaticText: tic> +^++++++++<ListItem> +++++++++++<ListMarker: 2. > +++++++++++<StaticText: tac> +++++++++<ListItem> +++++++++++<ListMarker: 3. > +++++++++++<StaticText: toe> +|++++++<List> +++++++++<ListItem> +++++++++++<StaticText: tic> +++++++++<StaticText: > +++++++++<ListItem> +++++++++++<StaticText: tac> +++++++++<StaticText: > +++++++++<ListItem> +++++++++++<StaticText: toe> ================================================================================ AXSelection from AX object anchored position in "GenericContainer": "", 1 to AX object anchored position in "GenericContainer": "", 2 ================================================================================ ++<GenericContainer> -++++<List> -++++++<ListItem> -++++++++<ListMarker: 1. > -++++++++<StaticText: tic> -++++++<ListItem> -++++++++<ListMarker: 2. > -++++++++<StaticText: tac> -++++++<ListItem> -++++++++<ListMarker: 3. > -++++++++<StaticText: toe> -^++++<List> -++++++<ListItem> -++++++++<StaticText: tic> -++++++<StaticText: > -++++++<ListItem> -++++++++<StaticText: tac> -++++++<StaticText: > -++++++<ListItem> -++++++++<StaticText: toe> +++++<GenericContainer> +++++++<List> +++++++++<ListItem> +++++++++++<ListMarker: 1. > +++++++++++<StaticText: tic> +++++++++<ListItem> +++++++++++<ListMarker: 2. > +++++++++++<StaticText: tac> +++++++++<ListItem> +++++++++++<ListMarker: 3. > +++++++++++<StaticText: toe> +^++++++<List> +++++++++<ListItem> +++++++++++<StaticText: tic> +++++++++<StaticText: > +++++++++<ListItem> +++++++++++<StaticText: tac> +++++++++<StaticText: > +++++++++<ListItem> +++++++++++<StaticText: toe> | \ No newline at end of file
diff --git a/third_party/blink/renderer/modules/accessibility/testing/data/selection/list-ax-layout-ng.txt b/third_party/blink/renderer/modules/accessibility/testing/data/selection/list-ax-layout-ng.txt index e8758ea0..768359b 100644 --- a/third_party/blink/renderer/modules/accessibility/testing/data/selection/list-ax-layout-ng.txt +++ b/third_party/blink/renderer/modules/accessibility/testing/data/selection/list-ax-layout-ng.txt
@@ -3,53 +3,55 @@ AXSelection from AX object anchored position in "List": "", 1 to AX object anchored position in "List": "", 3 ================================================================================ ++<GenericContainer> -++++<List> -++++++<ListItem> -++++++++<ListMarker: 1. > -++++++++++<StaticText: 1. > -++++++++<StaticText: tic> -^++++++<ListItem> -++++++++<ListMarker: 2. > -++++++++++<StaticText: 2. > -++++++++<StaticText: tac> -++++++<ListItem> -++++++++<ListMarker: 3. > -++++++++++<StaticText: 3. > -++++++++<StaticText: toe> -|++++<List> -++++++<ListItem> -++++++++<StaticText: tic> -++++++<StaticText: > -++++++<ListItem> -++++++++<StaticText: tac> -++++++<StaticText: > -++++++<ListItem> -++++++++<StaticText: toe> +++++<GenericContainer> +++++++<List> +++++++++<ListItem> +++++++++++<ListMarker: 1. > +++++++++++++<StaticText: 1. > +++++++++++<StaticText: tic> +^++++++++<ListItem> +++++++++++<ListMarker: 2. > +++++++++++++<StaticText: 2. > +++++++++++<StaticText: tac> +++++++++<ListItem> +++++++++++<ListMarker: 3. > +++++++++++++<StaticText: 3. > +++++++++++<StaticText: toe> +|++++++<List> +++++++++<ListItem> +++++++++++<StaticText: tic> +++++++++<StaticText: > +++++++++<ListItem> +++++++++++<StaticText: tac> +++++++++<StaticText: > +++++++++<ListItem> +++++++++++<StaticText: toe> ================================================================================ AXSelection from AX object anchored position in "GenericContainer": "", 1 to AX object anchored position in "GenericContainer": "", 2 ================================================================================ ++<GenericContainer> -++++<List> -++++++<ListItem> -++++++++<ListMarker: 1. > -++++++++++<StaticText: 1. > -++++++++<StaticText: tic> -++++++<ListItem> -++++++++<ListMarker: 2. > -++++++++++<StaticText: 2. > -++++++++<StaticText: tac> -++++++<ListItem> -++++++++<ListMarker: 3. > -++++++++++<StaticText: 3. > -++++++++<StaticText: toe> -^++++<List> -++++++<ListItem> -++++++++<StaticText: tic> -++++++<StaticText: > -++++++<ListItem> -++++++++<StaticText: tac> -++++++<StaticText: > -++++++<ListItem> -++++++++<StaticText: toe> +++++<GenericContainer> +++++++<List> +++++++++<ListItem> +++++++++++<ListMarker: 1. > +++++++++++++<StaticText: 1. > +++++++++++<StaticText: tic> +++++++++<ListItem> +++++++++++<ListMarker: 2. > +++++++++++++<StaticText: 2. > +++++++++++<StaticText: tac> +++++++++<ListItem> +++++++++++<ListMarker: 3. > +++++++++++++<StaticText: 3. > +++++++++++<StaticText: toe> +^++++++<List> +++++++++<ListItem> +++++++++++<StaticText: tic> +++++++++<StaticText: > +++++++++<ListItem> +++++++++++<StaticText: tac> +++++++++<StaticText: > +++++++++<ListItem> +++++++++++<StaticText: toe> | \ No newline at end of file
diff --git a/third_party/blink/renderer/modules/accessibility/testing/data/selection/paragraph-presentational-ax.txt b/third_party/blink/renderer/modules/accessibility/testing/data/selection/paragraph-presentational-ax.txt index 6eff2ce..a272709c 100644 --- a/third_party/blink/renderer/modules/accessibility/testing/data/selection/paragraph-presentational-ax.txt +++ b/third_party/blink/renderer/modules/accessibility/testing/data/selection/paragraph-presentational-ax.txt
@@ -3,10 +3,11 @@ AXSelection from AX text position in "StaticText": "Some text.", 0 to AX object anchored position in "Main": "", 2 ================================================================================ ++<GenericContainer> -++++<Main> -++++++<Presentational> -^++++++++<StaticText: ^Some text.> -++++++<GenericContainer> -|++++++<Paragraph> -++++++<Paragraph> -++++++++<StaticText: After presentational paragraph.> +++++<GenericContainer> +++++++<Main> +++++++++<Presentational> +^++++++++++<StaticText: ^Some text.> +++++++++<GenericContainer> +|++++++++<Paragraph> +++++++++<Paragraph> +++++++++++<StaticText: After presentational paragraph.>
diff --git a/third_party/blink/renderer/modules/accessibility/testing/data/selection/svg-ax.txt b/third_party/blink/renderer/modules/accessibility/testing/data/selection/svg-ax.txt index 1f7d0fd..8187e3fd 100644 --- a/third_party/blink/renderer/modules/accessibility/testing/data/selection/svg-ax.txt +++ b/third_party/blink/renderer/modules/accessibility/testing/data/selection/svg-ax.txt
@@ -4,27 +4,30 @@ ================================================================================ ++<GenericContainer> ++++<GenericContainer> -++++++<Paragraph> -^++++++++<StaticText: ^Some text. > -++++++++<Image: Square> -|++++++++<StaticText: | More text.> +++++++<GenericContainer> +++++++++<Paragraph> +^++++++++++<StaticText: ^Some text. > +++++++++++<Image: Square> +|++++++++++<StaticText: | More text.> ================================================================================ AXSelection from AX text position in "StaticText": "Some text. ", 10 to AX text position in "StaticText": " More text.", 1 ================================================================================ ++<GenericContainer> ++++<GenericContainer> -++++++<Paragraph> -++++++++<StaticText: Some text.^ > -++++++++<Image: Square> -++++++++<StaticText: |More text.> +++++++<GenericContainer> +++++++++<Paragraph> +++++++++++<StaticText: Some text.^ > +++++++++++<Image: Square> +++++++++++<StaticText: |More text.> ================================================================================ AXSelection from AX text position in "StaticText": "Some text. ", 11 to AX text position in "StaticText": " More text.", 11 ================================================================================ ++<GenericContainer> ++++<GenericContainer> -++++++<Paragraph> -++++++++<StaticText: Some text. ^> -++++++++<Image: Square> -++++++++<StaticText: More text.|> +++++++<GenericContainer> +++++++++<Paragraph> +++++++++++<StaticText: Some text. ^> +++++++++++<Image: Square> +++++++++++<StaticText: More text.|>
diff --git a/third_party/blink/renderer/modules/accessibility/testing/data/selection/table-ax.txt b/third_party/blink/renderer/modules/accessibility/testing/data/selection/table-ax.txt index ce4a68b..d37521e6 100644 --- a/third_party/blink/renderer/modules/accessibility/testing/data/selection/table-ax.txt +++ b/third_party/blink/renderer/modules/accessibility/testing/data/selection/table-ax.txt
@@ -3,102 +3,106 @@ AXSelection from AX text position in "StaticText": "Sum", 0 to AX text position in "StaticText": "Subtraction", 11 ================================================================================ ++<GenericContainer> -++++<Table> -++++++<Row> -++++++++<ColumnHeader: Sum> -^++++++++++<StaticText: ^Sum> -++++++++<ColumnHeader: Subtraction> -++++++++++<StaticText: Subtraction|> -++++++<Row> -++++++++<Cell: 10> -++++++++++<StaticText: 10> -++++++++<Cell: 7> -++++++++++<StaticText: 7> -++++++<Row> -++++++++<Cell: 2> -++++++++++<StaticText: 2> -++++++++<Cell: 4> -++++++++++<StaticText: 4> -++++++<Row> -++++++++<Cell: 12> -++++++++++<StaticText: 12> -++++++++<Cell: 3> -++++++++++<StaticText: 3> +++++<GenericContainer> +++++++<Table> +++++++++<Row> +++++++++++<ColumnHeader: Sum> +^++++++++++++<StaticText: ^Sum> +++++++++++<ColumnHeader: Subtraction> +++++++++++++<StaticText: Subtraction|> +++++++++<Row> +++++++++++<Cell: 10> +++++++++++++<StaticText: 10> +++++++++++<Cell: 7> +++++++++++++<StaticText: 7> +++++++++<Row> +++++++++++<Cell: 2> +++++++++++++<StaticText: 2> +++++++++++<Cell: 4> +++++++++++++<StaticText: 4> +++++++++<Row> +++++++++++<Cell: 12> +++++++++++++<StaticText: 12> +++++++++++<Cell: 3> +++++++++++++<StaticText: 3> ================================================================================ AXSelection from AX text position in "StaticText": "7", 1 to AX text position in "StaticText": "10", 0 ================================================================================ ++<GenericContainer> -++++<Table> -++++++<Row> -++++++++<ColumnHeader: Sum> -++++++++++<StaticText: Sum> -++++++++<ColumnHeader: Subtraction> -++++++++++<StaticText: Subtraction> -++++++<Row> -++++++++<Cell: 10> -|++++++++++<StaticText: |10> -++++++++<Cell: 7> -++++++++++<StaticText: 7^> -++++++<Row> -++++++++<Cell: 2> -++++++++++<StaticText: 2> -++++++++<Cell: 4> -++++++++++<StaticText: 4> -++++++<Row> -++++++++<Cell: 12> -++++++++++<StaticText: 12> -++++++++<Cell: 3> -++++++++++<StaticText: 3> +++++<GenericContainer> +++++++<Table> +++++++++<Row> +++++++++++<ColumnHeader: Sum> +++++++++++++<StaticText: Sum> +++++++++++<ColumnHeader: Subtraction> +++++++++++++<StaticText: Subtraction> +++++++++<Row> +++++++++++<Cell: 10> +|++++++++++++<StaticText: |10> +++++++++++<Cell: 7> +++++++++++++<StaticText: 7^> +++++++++<Row> +++++++++++<Cell: 2> +++++++++++++<StaticText: 2> +++++++++++<Cell: 4> +++++++++++++<StaticText: 4> +++++++++<Row> +++++++++++<Cell: 12> +++++++++++++<StaticText: 12> +++++++++++<Cell: 3> +++++++++++++<StaticText: 3> ================================================================================ AXSelection from AX text position in "StaticText": "2", 1 to AX text position in "StaticText": "4", 0 ================================================================================ ++<GenericContainer> -++++<Table> -++++++<Row> -++++++++<ColumnHeader: Sum> -++++++++++<StaticText: Sum> -++++++++<ColumnHeader: Subtraction> -++++++++++<StaticText: Subtraction> -++++++<Row> -++++++++<Cell: 10> -++++++++++<StaticText: 10> -++++++++<Cell: 7> -++++++++++<StaticText: 7> -++++++<Row> -++++++++<Cell: 2> -++++++++++<StaticText: 2^> -++++++++<Cell: 4> -|++++++++++<StaticText: |4> -++++++<Row> -++++++++<Cell: 12> -++++++++++<StaticText: 12> -++++++++<Cell: 3> -++++++++++<StaticText: 3> +++++<GenericContainer> +++++++<Table> +++++++++<Row> +++++++++++<ColumnHeader: Sum> +++++++++++++<StaticText: Sum> +++++++++++<ColumnHeader: Subtraction> +++++++++++++<StaticText: Subtraction> +++++++++<Row> +++++++++++<Cell: 10> +++++++++++++<StaticText: 10> +++++++++++<Cell: 7> +++++++++++++<StaticText: 7> +++++++++<Row> +++++++++++<Cell: 2> +++++++++++++<StaticText: 2^> +++++++++++<Cell: 4> +|++++++++++++<StaticText: |4> +++++++++<Row> +++++++++++<Cell: 12> +++++++++++++<StaticText: 12> +++++++++++<Cell: 3> +++++++++++++<StaticText: 3> ================================================================================ AXSelection from AX text position in "StaticText": "12", 0 to AX text position in "StaticText": "3", 1 ================================================================================ ++<GenericContainer> -++++<Table> -++++++<Row> -++++++++<ColumnHeader: Sum> -++++++++++<StaticText: Sum> -++++++++<ColumnHeader: Subtraction> -++++++++++<StaticText: Subtraction> -++++++<Row> -++++++++<Cell: 10> -++++++++++<StaticText: 10> -++++++++<Cell: 7> -++++++++++<StaticText: 7> -++++++<Row> -++++++++<Cell: 2> -++++++++++<StaticText: 2> -++++++++<Cell: 4> -++++++++++<StaticText: 4> -++++++<Row> -++++++++<Cell: 12> -^++++++++++<StaticText: ^12> -++++++++<Cell: 3> -++++++++++<StaticText: 3|> +++++<GenericContainer> +++++++<Table> +++++++++<Row> +++++++++++<ColumnHeader: Sum> +++++++++++++<StaticText: Sum> +++++++++++<ColumnHeader: Subtraction> +++++++++++++<StaticText: Subtraction> +++++++++<Row> +++++++++++<Cell: 10> +++++++++++++<StaticText: 10> +++++++++++<Cell: 7> +++++++++++++<StaticText: 7> +++++++++<Row> +++++++++++<Cell: 2> +++++++++++++<StaticText: 2> +++++++++++<Cell: 4> +++++++++++++<StaticText: 4> +++++++++<Row> +++++++++++<Cell: 12> +^++++++++++++<StaticText: ^12> +++++++++++<Cell: 3> +++++++++++++<StaticText: 3|>
diff --git a/third_party/blink/renderer/modules/keyboard/keyboard_layout.cc b/third_party/blink/renderer/modules/keyboard/keyboard_layout.cc index d6717d406..2458019 100644 --- a/third_party/blink/renderer/modules/keyboard/keyboard_layout.cc +++ b/third_party/blink/renderer/modules/keyboard/keyboard_layout.cc
@@ -5,6 +5,10 @@ #include "third_party/blink/renderer/modules/keyboard/keyboard_layout.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h" +#include "third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h" +#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h" +#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h" +#include "third_party/blink/public/common/privacy_budget/identifiable_token_builder.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" @@ -14,6 +18,7 @@ #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/heap/heap.h" +#include "third_party/blink/renderer/platform/privacy_budget/identifiability_digest_helpers.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink { @@ -29,6 +34,31 @@ constexpr char kKeyboardMapRequestFailedErrorMsg[] = "getLayoutMap() request could not be completed."; +constexpr IdentifiableSurface kGetKeyboardLayoutMapSurface = + IdentifiableSurface::FromTypeAndToken( + IdentifiableSurface::Type::kWebFeature, + WebFeature::kKeyboardApiGetLayoutMap); + +IdentifiableToken ComputeLayoutValue( + const WTF::HashMap<WTF::String, WTF::String>& layout_map) { + IdentifiableTokenBuilder builder; + for (const auto& kv : layout_map) { + builder.AddToken(IdentifiabilityBenignStringToken(kv.key)); + builder.AddToken(IdentifiabilityBenignStringToken(kv.value)); + } + return builder.GetToken(); +} + +void RecordGetLayoutMapResult(ExecutionContext* context, + IdentifiableToken value) { + if (!context) + return; + + IdentifiabilityMetricBuilder(context->UkmSourceID()) + .Set(kGetKeyboardLayoutMapSurface, value) + .Record(context->UkmRecorder()); +} + } // namespace KeyboardLayout::KeyboardLayout(ExecutionContext* context) @@ -56,6 +86,12 @@ } if (!EnsureServiceConnected()) { + if (IdentifiabilityStudySettings::Get()->IsSurfaceAllowed( + kGetKeyboardLayoutMapSurface)) { + RecordGetLayoutMapResult(ExecutionContext::From(script_state), + IdentifiableToken()); + } + exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError, kKeyboardMapRequestFailedErrorMsg); return ScriptPromise(); @@ -101,12 +137,23 @@ mojom::blink::GetKeyboardLayoutMapResultPtr result) { DCHECK(script_promise_resolver_); + bool instrumentation_on = + IdentifiabilityStudySettings::Get()->IsSurfaceAllowed( + kGetKeyboardLayoutMapSurface); + switch (result->status) { case mojom::blink::GetKeyboardLayoutMapStatus::kSuccess: + if (instrumentation_on) { + RecordGetLayoutMapResult(GetExecutionContext(), + ComputeLayoutValue(result->layout_map)); + } script_promise_resolver_->Resolve( MakeGarbageCollected<KeyboardLayoutMap>(result->layout_map)); break; case mojom::blink::GetKeyboardLayoutMapStatus::kFail: + if (instrumentation_on) + RecordGetLayoutMapResult(GetExecutionContext(), IdentifiableToken()); + script_promise_resolver_->Reject(MakeGarbageCollected<DOMException>( DOMExceptionCode::kInvalidStateError, kKeyboardMapRequestFailedErrorMsg));
diff --git a/third_party/blink/renderer/modules/webcodecs/video_encoder.cc b/third_party/blink/renderer/modules/webcodecs/video_encoder.cc index abc2dcea..488ba741 100644 --- a/third_party/blink/renderer/modules/webcodecs/video_encoder.cc +++ b/third_party/blink/renderer/modules/webcodecs/video_encoder.cc
@@ -50,7 +50,9 @@ namespace blink { namespace { -std::unique_ptr<media::VideoEncoder> CreateAcceleratedVideoEncoder() { +std::unique_ptr<media::VideoEncoder> CreateAcceleratedVideoEncoder( + media::VideoCodecProfile profile, + const media::VideoEncoder::Options& options) { #if defined(OS_MAC) || defined(OS_LINUX) // TODO(https://crbug.com/1110279) Flush() is not implemented on MacOS' // accelerated video encoder, so we can't use it yet. @@ -60,6 +62,36 @@ if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) return nullptr; + auto supported_profiles = + gpu_factories->GetVideoEncodeAcceleratorSupportedProfiles().value_or( + media::VideoEncodeAccelerator::SupportedProfiles()); + + bool found_supported_profile = false; + for (auto& supported_profile : supported_profiles) { + if (supported_profile.profile != profile) + continue; + + if (supported_profile.min_resolution.width() > options.width || + supported_profile.min_resolution.height() > options.height) + continue; + + if (supported_profile.max_resolution.width() < options.width || + supported_profile.max_resolution.height() < options.height) + continue; + + double max_supported_framerate = + double{supported_profile.max_framerate_numerator} / + supported_profile.max_framerate_denominator; + if (options.framerate > max_supported_framerate) + continue; + + found_supported_profile = true; + break; + } + + if (!found_supported_profile) + return nullptr; + auto task_runner = Thread::MainThread()->GetTaskRunner(); return std::make_unique< media::AsyncDestroyVideoEncoder<media::VideoEncodeAcceleratorAdapter>>( @@ -255,19 +287,18 @@ // detecting support of encoder configs. switch (config.acc_pref) { case AccelerationPreference::kRequire: - return CreateAcceleratedVideoEncoder(); + return CreateAcceleratedVideoEncoder(config.profile, config.options); case AccelerationPreference::kAllow: { + auto result = + CreateAcceleratedVideoEncoder(config.profile, config.options); + if (result) + return result; switch (config.codec) { case media::kCodecVP8: case media::kCodecVP9: - /* No acceleration supported yet. */ return CreateVpxVideoEncoder(); - case media::kCodecH264: - if (auto result = CreateAcceleratedVideoEncoder()) - return result; return CreateOpenH264VideoEncoder(); - default: return nullptr; } @@ -277,10 +308,8 @@ case media::kCodecVP8: case media::kCodecVP9: return CreateVpxVideoEncoder(); - case media::kCodecH264: return CreateOpenH264VideoEncoder(); - default: return nullptr; } @@ -357,8 +386,8 @@ return; } - // At this point, we have "consumed" the frame, and will destroy the clone in - // ProcessEncode(). + // At this point, we have "consumed" the frame, and will destroy the clone + // in ProcessEncode(). frame->destroy(); Request* request = MakeGarbageCollected<Request>(); @@ -508,7 +537,8 @@ WTF::Bind(done_callback, WrapWeakPersistent(this), WrapPersistentIfNeeded(request))); - // We passed a copy of frame() above, so this should be safe to destroy here. + // We passed a copy of frame() above, so this should be safe to destroy + // here. request->frame->destroy(); }
diff --git a/third_party/blink/renderer/modules/webusb/usb.cc b/third_party/blink/renderer/modules/webusb/usb.cc index f96fa62..1b36aca0 100644 --- a/third_party/blink/renderer/modules/webusb/usb.cc +++ b/third_party/blink/renderer/modules/webusb/usb.cc
@@ -10,9 +10,6 @@ #include "services/device/public/mojom/usb_device.mojom-blink.h" #include "services/device/public/mojom/usb_enumeration_options.mojom-blink.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h" -#include "third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h" -#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h" -#include "third_party/blink/public/common/privacy_budget/identifiable_token_builder.h" #include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" @@ -27,9 +24,7 @@ #include "third_party/blink/renderer/modules/webusb/usb_device.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/mojo/mojo_helper.h" -#include "third_party/blink/renderer/platform/privacy_budget/identifiability_digest_helpers.h" #include "third_party/blink/renderer/platform/wtf/functional.h" using device::mojom::blink::UsbDevice; @@ -192,31 +187,7 @@ get_permission_requests_.clear(); } -namespace { - -void RecordDevice(LocalFrame* frame, const UsbDeviceInfoPtr& device_info) { - IdentifiableSurface s = IdentifiableSurface::FromTypeAndToken( - IdentifiableSurface::Type::kWebFeature, WebFeature::kUsbGetDevices); - if (!IdentifiabilityStudySettings::Get()->IsSurfaceAllowed(s)) - return; - DCHECK(frame && frame->GetDocument()); - - Document* document = frame->GetDocument(); - IdentifiableTokenBuilder builder; - builder.AddToken(device_info->vendor_id); - builder.AddToken(device_info->product_id); - builder.AddToken( - IdentifiabilitySensitiveStringToken(device_info->serial_number)); - - IdentifiabilityMetricBuilder(document->UkmSourceID()) - .Set(s, builder.GetToken()) - .Record(document->UkmRecorder()); -} - -} // namespace - USBDevice* USB::GetOrCreateDevice(UsbDeviceInfoPtr device_info) { - RecordDevice(GetFrame(), device_info); USBDevice* device = device_cache_.at(device_info->guid); if (!device) { String guid = device_info->guid;
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/worker_main_script_loader.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/worker_main_script_loader.cc index 1921b7b..c8cf4aa5 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/worker_main_script_loader.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/worker_main_script_loader.cc
@@ -72,6 +72,11 @@ resource_response_ = response.ToResourceResponse(); NotifyResponseReceived(std::move(response_head)); + resource_load_observer_->DidReceiveResponse( + initial_request_.InspectorId(), initial_request_, resource_response_, + /*resource=*/nullptr, + ResourceLoadObserver::ResponseSource::kNotFromMemoryCache); + if (resource_response_.IsHTTP() && !cors::IsOkStatus(resource_response_.HttpStatusCode())) { client_->OnFailedLoadingWorkerMainScript(); @@ -85,10 +90,6 @@ return; } - resource_load_observer_->DidReceiveResponse( - initial_request_.InspectorId(), initial_request_, resource_response_, - /*resource=*/nullptr, - ResourceLoadObserver::ResponseSource::kNotFromMemoryCache); script_encoding_ = resource_response_.TextEncodingName().IsEmpty() ? UTF8Encoding()
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/worker_main_script_loader_unittest.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/worker_main_script_loader_unittest.cc index 22c3a19..8419644 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/worker_main_script_loader_unittest.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/worker_main_script_loader_unittest.cc
@@ -40,6 +40,11 @@ scoped_feature_list_.InitWithFeatureState( blink::features::kPlzDedicatedWorker, true); } + ~WorkerMainScriptLoaderTest() override { + // Forced GC in order to finalize objects depending on MockResourceObserver, + // see details https://crbug.com/1132634. + ThreadState::Current()->CollectAllGarbageForTesting(); + } protected: class TestPlatform final : public TestingPlatformSupport {
diff --git a/third_party/blink/renderer/platform/peerconnection/DEPS b/third_party/blink/renderer/platform/peerconnection/DEPS index 3328b8a..d6fd407 100644 --- a/third_party/blink/renderer/platform/peerconnection/DEPS +++ b/third_party/blink/renderer/platform/peerconnection/DEPS
@@ -12,7 +12,6 @@ # Dependencies. "+base/strings/string_number_conversions.h", "+base/strings/string_split.h", - "+base/task/task_traits.h", "+base/threading/thread_restrictions.h", "+media/base", "+media/capture/capture_switches.h", @@ -31,6 +30,7 @@ specific_include_rules = { ".*_test\.cc": [ + "+base/task/task_traits.h", "+base/threading/thread.h", "+gpu/command_buffer/common/mailbox.h", "+media/video/mock_gpu_video_accelerator_factories.h",
diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.cc index bd48060..70ff644 100644 --- a/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.cc +++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.cc
@@ -7,12 +7,8 @@ #include <array> #include <memory> -#include "base/feature_list.h" #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "base/sequenced_task_runner.h" -#include "base/task/task_traits.h" -#include "base/task/thread_pool.h" #include "build/build_config.h" #include "media/base/media_util.h" #include "media/base/video_codecs.h" @@ -31,11 +27,6 @@ // Any reasonable size, will be overridden by the decoder anyway. const gfx::Size kDefaultSize(640, 480); -const base::Feature kRtcDecoderSupportTimeout{"RtcDecoderSupportTimeout", - base::FEATURE_ENABLED_BY_DEFAULT}; - -const uint32_t kDefaultRtcDecoderSupportTimeoutMs = 10000; - struct CodecConfig { media::VideoCodec codec; media::VideoCodecProfile profile; @@ -180,70 +171,16 @@ std::unique_ptr<webrtc::VideoDecoder> decoder_; }; -base::Optional<base::TimeDelta> GetRtcDecoderSupportTimeoutMs() { - if (!base::FeatureList::IsEnabled(kRtcDecoderSupportTimeout)) { - return base::nullopt; - } - int timeout_ms = base::GetFieldTrialParamByFeatureAsInt( - kRtcDecoderSupportTimeout, "timeout", kDefaultRtcDecoderSupportTimeoutMs); - return base::TimeDelta::FromMilliseconds(timeout_ms); -} - } // namespace RTCVideoDecoderFactory::RTCVideoDecoderFactory( media::GpuVideoAcceleratorFactories* gpu_factories) - : gpu_factories_(gpu_factories), - decoder_support_known_(base::WaitableEvent::ResetPolicy::MANUAL, - base::WaitableEvent::InitialState::NOT_SIGNALED), - decoder_support_timeout_ms_(GetRtcDecoderSupportTimeoutMs()) { + : gpu_factories_(gpu_factories) { DVLOG(2) << __func__; } -bool RTCVideoDecoderFactory::IsDecoderSupportKnown() const { - if (gpu_factories_->IsDecoderSupportKnown()) { - return true; - } - - if (!decoder_support_timeout_ms_) { - return false; - } - - // Callback passed to NotifyDecoderSupportKnown is called on caller's - // sequence. To not block the callback while waiting for it, call - // NotifyDecoderSupportKnown on a separate sequence. - scoped_refptr<base::SequencedTaskRunner> task_runner = - base::ThreadPool::CreateSequencedTaskRunner({}); - - bool is_decoder_support_notification_requested = task_runner->PostTask( - FROM_HERE, base::BindOnce( - [](media::GpuVideoAcceleratorFactories* gpu_factories, - base::WaitableEvent* decoder_support_known) { - gpu_factories->NotifyDecoderSupportKnown(base::BindOnce( - [](base::WaitableEvent* decoder_support_known) { - decoder_support_known->Signal(); - }, - decoder_support_known)); - }, - gpu_factories_, &decoder_support_known_)); - - if (!is_decoder_support_notification_requested) { - DLOG(WARNING) << "Failed to request decoder support notification."; - return false; - } - - return decoder_support_known_.TimedWait(*decoder_support_timeout_ms_); -} - std::vector<webrtc::SdpVideoFormat> RTCVideoDecoderFactory::GetSupportedFormats() const { - if (!IsDecoderSupportKnown()) { - DLOG(WARNING) << "Decoder support is unknown. Timeout " - << decoder_support_timeout_ms_.value_or(base::TimeDelta()) - .InMilliseconds() - << "ms. Decoders might not be available."; - } - std::vector<webrtc::SdpVideoFormat> supported_formats; for (auto& codec_config : kCodecConfigs) { media::VideoDecoderConfig config( @@ -276,13 +213,6 @@ RTCVideoDecoderFactory::CreateVideoDecoder( const webrtc::SdpVideoFormat& format) { DVLOG(2) << __func__; - if (!IsDecoderSupportKnown()) { - DLOG(WARNING) << "Decoder support is unknown. Timeout " - << decoder_support_timeout_ms_.value_or(base::TimeDelta()) - .InMilliseconds() - << "ms. Decoders might not be available."; - } - std::unique_ptr<webrtc::VideoDecoder> decoder = RTCVideoDecoderAdapter::Create(gpu_factories_, format); // ScopedVideoDecoder uses the task runner to make sure the decoder is
diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.h b/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.h index 0c473cfa..ff639c4 100644 --- a/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.h +++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_factory.h
@@ -6,9 +6,6 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_VIDEO_DECODER_FACTORY_H_ #include "base/macros.h" -#include "base/optional.h" -#include "base/synchronization/waitable_event.h" -#include "base/time/time.h" #include "third_party/webrtc/api/video_codecs/video_decoder_factory.h" #include "third_party/webrtc/modules/video_coding/include/video_codec_interface.h" @@ -37,13 +34,8 @@ std::vector<webrtc::SdpVideoFormat> GetSupportedFormats() const override; private: - bool IsDecoderSupportKnown() const; - media::GpuVideoAcceleratorFactories* gpu_factories_; - mutable base::WaitableEvent decoder_support_known_; - const base::Optional<base::TimeDelta> decoder_support_timeout_ms_; - DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoderFactory); };
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index a7c6ee3..9c87924 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -6131,7 +6131,7 @@ # crbug.com/1044424 [ Release ] http/tests/devtools/elements/css-rule-hover-highlights-selectors.js [ Pass Timeout ] crbug.com/1044425 [ Release ] http/tests/devtools/elements/shadow/elements-panel-shadow-selection-on-refresh-1.js [ Pass Timeout ] crbug.com/1044429 [ Release ] http/tests/devtools/oopif/oopif-navigator.js [ Pass Timeout ] -crbug.com/1002914 http/tests/devtools/elements/elements-panel-styles.js [ Pass Timeout Failure ] +crbug.com/1002914 http/tests/devtools/elements/elements-panel-styles.js [ Pass Timeout ] crbug.com/1044433 [ Release ] http/tests/devtools/editor/text-editor-search-replace.js [ Pass Timeout ] crbug.com/1044459 [ Release ] http/tests/devtools/elements/edit/set-outer-html-for-xhtml.js [ Pass Timeout ] crbug.com/1044505 http/tests/devtools/tracing-session-id.js [ Pass Failure Timeout ] @@ -6399,10 +6399,7 @@ crbug.com/1069714 [ Mac10.13 ] external/wpt/webrtc/RTCRtpSender-replaceTrack.https.html [ Pass Failure Timeout ] # COOP access reporting: -crbug.com/1090273 external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/property-frames.https.html [ Timeout ] crbug.com/1090273 external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/property-opener-set.https.html [ Timeout ] -crbug.com/1090273 external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/property-self.https.html [ Timeout ] -crbug.com/1090273 external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/property-window.https.html [ Timeout ] # Sheriff 2020-04-17 crbug.com/1071909 external/wpt/html/cross-origin-opener-policy/popup-coop-by-sw.https.html [ Pass Timeout ] @@ -6735,3 +6732,7 @@ crbug.com/1057060 virtual/threaded-prefer-compositing/fast/scrolling/scrollbars/mouse-autoscrolling-on-scrollbar.html [ Pass Failure Timeout ] crbug.com/1057060 virtual/scroll-unification/fast/scrolling/scrollbars/mouse-autoscrolling-on-scrollbar.html [ Pass Failure Timeout ] crbug.com/1045599 fast/css-grid-layout/flex-content-sized-columns-resize.html [ Pass Failure Timeout ] + +# Sheriff 2020-09-29 +crbug.com/1133342 external/wpt/html/cross-origin-opener-policy/reporting/access-reporting/reporting-observer.html [ Pass Failure Timeout ] +crbug.com/1083605 media/controls-styling-strict.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index bb128b29..aacc8f2 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -262,7 +262,8 @@ }, { "prefix": "dark-mode-default", - "bases": ["dark-mode/colors"], + "bases": ["dark-mode/colors", + "dark-mode/images"], "args": ["--blink-settings=forceDarkModeEnabled=true"] }, {
diff --git a/third_party/blink/web_tests/accessibility/name-calc-visibility.html b/third_party/blink/web_tests/accessibility/name-calc-visibility.html index 57dbd31..2d938e65 100644 --- a/third_party/blink/web_tests/accessibility/name-calc-visibility.html +++ b/third_party/blink/web_tests/accessibility/name-calc-visibility.html
@@ -61,7 +61,7 @@ <script> test(function(t) { var axInput3 = accessibilityController.accessibleElementById("input3"); - assert_equals(axInput3.name, "1 2 3 4 6 7"); + assert_equals(axInput3.name, "1 2 3 4 5 6 7"); }, "Visibility: 'hidden' and display: 'none' referenced directly by aria-labelledby"); </script> @@ -89,3 +89,18 @@ assert_equals(axInput4.name, "1 2 7"); }, "Visibility: 'hidden' and display: 'none' inside aria-labelledby label subtree, where entire label subtree is display: 'none'"); </script> + +<div class="container"> + <button id="button1" style="display:none">Hello</button> + <button id="button2" aria-labelledby="button1">X</button> +</div> + +<script> +test(function(t) { + var axButton1 = accessibilityController.accessibleElementById("button1"); + assert_equals(axButton1.name, ""); + var axButton2 = accessibilityController.accessibleElementById("button2"); + assert_equals(axButton2.name, "Hello"); +}, "Visibility: display: 'none' objects have no name, but can label other things."); +</script> +
diff --git a/third_party/blink/web_tests/editing/inserting/typing_kerning2-expected.html b/third_party/blink/web_tests/editing/inserting/typing_kerning2-expected.html new file mode 100644 index 0000000..a4e810e2 --- /dev/null +++ b/third_party/blink/web_tests/editing/inserting/typing_kerning2-expected.html
@@ -0,0 +1,3 @@ +<!doctype html> +<div>XA W AV A W AV A W AV A W AV</div> +<div>XA W AV A W AV A W AV A W AV</div>
diff --git a/third_party/blink/web_tests/editing/inserting/typing_kerning2.html b/third_party/blink/web_tests/editing/inserting/typing_kerning2.html new file mode 100644 index 0000000..d22650b --- /dev/null +++ b/third_party/blink/web_tests/editing/inserting/typing_kerning2.html
@@ -0,0 +1,18 @@ +<!doctype html> +<div id="target">X</div> +<div>XA W AV A W AV A W AV A W AV</div> +<script> +function type(code) { + target.firstChild.appendData(code); + document.body.offsetHeight; +} +for (let i = 0; i < 4; ++i) { + type('A'); + type(' '); + type('W'); + type(' '); + type('A'); + type('V'); + type(' '); +} +</script>
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/resources/test-access-property.js b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/resources/test-access-property.js index 1a28e593..0b804e8 100644 --- a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/resources/test-access-property.js +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/reporting/resources/test-access-property.js
@@ -2,39 +2,52 @@ const executor_path = directory + "/resources/executor.html?pipe="; const coep_header = '|header(Cross-Origin-Embedder-Policy,require-corp)'; +const same_origin = get_host_info().HTTPS_ORIGIN; +const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN; + const origin = [ - ["cross-origin", get_host_info().HTTPS_REMOTE_ORIGIN ] , - ["same-site" , get_host_info().HTTPS_ORIGIN ] , + ["same-origin" , same_origin ], + ["cross-origin", cross_origin], ]; +let escapeComma = url => url.replace(/,/g, '\\,'); let testAccessProperty = (property, op, message) => { origin.forEach(([origin_name, origin]) => { promise_test(async t => { - const report_token = token(); + const this_window_token = token(); + + // The opener window: + const opener_token = token(); + const opener_url = get_host_info().HTTP_ORIGIN + executor_path + + `&uuid=${opener_token}`; + + // The openee window: const openee_token = token(); - const opener_token = token(); // The current test window. - - const reportTo = reportToHeaders(report_token); - const openee_url = origin + executor_path + reportTo.header + - reportTo.coopReportOnlySameOriginHeader + coep_header + + const openee_report_token = token(); + const openee_report_to = reportToHeaders(openee_report_token); + const openee_url = origin + executor_path + openee_report_to.header + + openee_report_to.coopReportOnlySameOriginHeader + coep_header + `&uuid=${openee_token}`; - const openee = window.open(openee_url); - t.add_cleanup(() => send(openee_token, "window.close()")) - // 1. Make sure the new document to be loaded. - send(openee_token, `send("${opener_token}", "Ready");`); - assert_equals(await receive(opener_token), "Ready"); - // TODO(arthursozogni): Figure out why 2 round-trip is sometimes - // necessary to ensure the CoopAccessMonitor are installed. - send(openee_token, `send("${opener_token}", "Ready");`); - assert_equals(await receive(opener_token), "Ready"); + t.add_cleanup(() => { + send(opener_token, "window.close()") + send(openee_token, "window.close()") + }); - // 2. Try to access the openee. This shouldn't work because of COOP+COEP. - try {op(openee)} catch(e) {} + // Open the two windows. Wait for them to be loaded. + window.open(opener_url); + send(opener_token, ` + window.openee = window.open('${escapeComma(openee_url)}'); + `); + send(openee_token, `send("${this_window_token}", "Ready");`); + assert_equals(await receive(this_window_token), "Ready"); + + // 2. Try to access the openee. + send(opener_token, `(${op})(openee);`); // 3. Check a reports is sent to the opener. - let report = await receiveReport(report_token, - "access-to-coop-page-from-opener"); + let report = await receiveReport(openee_report_token, + "access-to-coop-page-from-opener"); assert_equals(report.body.property, property); }, `${origin_name} > ${op}`);
diff --git a/third_party/blink/web_tests/external/wpt/origin-isolation/1-iframe/parent-no-child-yes-subdomain-with-redirect.sub.https.html b/third_party/blink/web_tests/external/wpt/origin-isolation/1-iframe/parent-no-child-yes-subdomain-with-redirect.sub.https.html new file mode 100644 index 0000000..9004500 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/origin-isolation/1-iframe/parent-no-child-yes-subdomain-with-redirect.sub.https.html
@@ -0,0 +1,27 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Parent is not isolated, child is reached via a redirect response with no header, child final response does have the header</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<div id="log"></div> + +<script type="module"> +import { + insertIframe, + testDifferentAgentClusters, + testGetter +} from "../resources/helpers.mjs"; + +promise_setup(async () => { + await insertIframe("{{hosts[][www]}}", "?1", { redirectFirst: true }); +}); + +// Since they're different-origin, the child's isolation request is respected, +// so the parent ends up in the site-keyed agent cluster and the child in the +// origin-keyed one. +testDifferentAgentClusters([self, 0]); + +testGetter(self, false, "parent"); +testGetter(0, true, "child"); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/origin-isolation/resources/helpers.mjs b/third_party/blink/web_tests/external/wpt/origin-isolation/resources/helpers.mjs index 8bd1c8e92..43cfffd5 100644 --- a/third_party/blink/web_tests/external/wpt/origin-isolation/resources/helpers.mjs +++ b/third_party/blink/web_tests/external/wpt/origin-isolation/resources/helpers.mjs
@@ -6,11 +6,15 @@ * @param {string} host - The host used to calculate the iframe's src="" * @param {string=} header - The value of the Origin-Isolation header that the * iframe will set. Omit this to set no header. + * @param {object=} options - Rarely-used options. + * @param {boolean=} options.redirectFirst - Whether to do a 302 redirect first + * before arriving at the isolated page. The redirecting page will not set + * the Origin-Isolation header. * @returns {HTMLIFrameElement} The created iframe element */ -export async function insertIframe(host, header) { +export async function insertIframe(host, header, { redirectFirst = false } = {}) { const iframe = document.createElement("iframe"); - const navigatePromise = navigateIframe(iframe, host, header); + const navigatePromise = navigateIframe(iframe, host, header, { redirectFirst }); document.body.append(iframe); await navigatePromise; await setBothDocumentDomains(iframe.contentWindow); @@ -24,11 +28,15 @@ * @param {string} host - The host to calculate the iframe's new src="" * @param {string=} header - The value of the Origin-Isolation header that the * newly-navigated-to page will set. Omit this to set no header. + * @param {object=} options - Rarely-used options. + * @param {boolean=} options.redirectFirst - Whether to do a 302 redirect first + * before arriving at the isolated page. The redirecting page will not set + * the Origin-Isolation header. * @returns {Promise} a promise fulfilled when the load event fires, or rejected * if the error event fires */ -export function navigateIframe(iframeEl, host, header) { - const url = getSendHeaderURL(host, header); +export function navigateIframe(iframeEl, host, header, { redirectFirst = false } = {}) { + const url = getSendHeaderURL(host, header, { redirectFirst }); const waitPromise = waitForIframe(iframeEl, url); iframeEl.src = url; @@ -324,7 +332,7 @@ return waitForMessage(frameWindow); } -function getSendHeaderURL(host, header, { sendLoadedMessage = false } = {}) { +function getSendHeaderURL(host, header, { sendLoadedMessage = false, redirectFirst = false } = {}) { const url = new URL("send-origin-isolation-header.py", import.meta.url); url.host = host; if (header !== undefined) { @@ -333,6 +341,9 @@ if (sendLoadedMessage) { url.searchParams.set("send-loaded-message", ""); } + if (redirectFirst) { + url.searchParams.set("redirect-first", ""); + } return url.href; }
diff --git a/third_party/blink/web_tests/external/wpt/origin-isolation/resources/send-origin-isolation-header.py b/third_party/blink/web_tests/external/wpt/origin-isolation/resources/send-origin-isolation-header.py index 6a67757..cb37d43 100644 --- a/third_party/blink/web_tests/external/wpt/origin-isolation/resources/send-origin-isolation-header.py +++ b/third_party/blink/web_tests/external/wpt/origin-isolation/resources/send-origin-isolation-header.py
@@ -1,10 +1,32 @@ def main(request, response): """Send a response with the Origin-Isolation header given in the "header" - query parameter, or no header if that is not provided. In either case, the - response will listen for message and messageerror events and echo them back - to the parent. See ./helpers.mjs for how these handlers are used. + query parameter, or no header if that is not provided. Other query + parameters (only their presence/absence matters) are "send-loaded-message" + and "redirect-first", which modify the behavior a bit. + + In either case, the response will listen for various messages posted and + coordinate with the sender. See ./helpers.mjs for how these handlers are + used. """ + if b"redirect-first" in request.GET: + # Create a new query string, which is the same as the one we're given but + # with the redirect-first component stripped out. This allows tests to use + # any value (or no value) for the other query params, in combination with + # redirect-first. + query_string_pieces = [] + if b"header" in request.GET: + query_string_pieces.append(b"header=" + request.GET.first(b"header")) + if b"send-loaded-message" in request.GET: + query_string_pieces.append(b"send-loaded-message") + query_string = "?" + "&".join(query_string_pieces) + + return ( + 302, + [(b"Location", b"/origin-isolation/resources/send-origin-isolation-header.py" + query_string)], + u"" + ) + if b"header" in request.GET: header = request.GET.first(b"header") response.headers.set(b"Origin-Isolation", header)
diff --git a/third_party/blink/web_tests/fast/scroll-behavior/main-frame-interrupted-scroll.html b/third_party/blink/web_tests/fast/scroll-behavior/main-frame-interrupted-scroll.html deleted file mode 100644 index e3cad27..0000000 --- a/third_party/blink/web_tests/fast/scroll-behavior/main-frame-interrupted-scroll.html +++ /dev/null
@@ -1,37 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <style> - #content { - width: 1000px; - height: 10000px; - background-color: blue; - } - </style> - <script src="../../resources/testharness.js"></script> - <script src="../../resources/testharnessreport.js"></script> - <script src="resources/scroll-interruption-test.js"></script> - <script type="text/javascript"> - function jsScroll(y) { - window.scrollTo({top: y, behavior: 'smooth'}); - } - - function doTest() { - const targets = {y_min: 40, y_mid: 3500, y_max: 7000}; - const innerPoint = {x: 100, y: 100}; - var scrollInterruptionTest = new SmoothScrollInterruptionTest(document.scrollingElement, - innerPoint, - targets, - jsScroll); - scrollInterruptionTest.run(); - } - - window.addEventListener('load', doTest, false); - </script> -</head> - -<body> - <p>Test that interrupting a smooth scroll on the main frame works with both scroll behaviors and with input</p> - <div id="content"></div> -</body> -</html>
diff --git a/third_party/blink/web_tests/fast/scroll-behavior/overflow-interrupted-scroll.html b/third_party/blink/web_tests/fast/scroll-behavior/overflow-interrupted-scroll.html deleted file mode 100644 index a5333d8..0000000 --- a/third_party/blink/web_tests/fast/scroll-behavior/overflow-interrupted-scroll.html +++ /dev/null
@@ -1,46 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <style> - #container { - width: 200px; - height: 200px; - overflow: scroll; - } - - #content { - width: 7500px; - height: 7500px; - background-color: blue; - } - </style> - <script src="../../resources/testharness.js"></script> - <script src="../../resources/testharnessreport.js"></script> - <script src="resources/scroll-interruption-test.js"></script> - <script type="text/javascript"> - function jsScroll(y) { - document.getElementById('container').scrollTo({top: y, behavior: 'smooth'}); - } - - function doTest() { - const targets = {y_min: 40, y_mid: 3500, y_max: 7000}; - const innerPoint = {x: 100, y: 100}; - var element = document.getElementById('container'); - var scrollInterruptionTest = new SmoothScrollInterruptionTest(element, - innerPoint, - targets, - jsScroll); - scrollInterruptionTest.run(); - } - - window.addEventListener('load', doTest, false); - </script> -</head> - -<body> - <p>Test that interrupting a smooth scroll on an overflow:scroll element works with both scroll behaviors and with input</p> - <div id="container"> - <div id="content"></div> - </div> -</body> -</html>
diff --git a/third_party/blink/web_tests/fast/scroll-behavior/resources/scroll-interruption-test.js b/third_party/blink/web_tests/fast/scroll-behavior/resources/scroll-interruption-test.js deleted file mode 100644 index d9a3baa..0000000 --- a/third_party/blink/web_tests/fast/scroll-behavior/resources/scroll-interruption-test.js +++ /dev/null
@@ -1,206 +0,0 @@ -// A SmoothScrollInterruptionTest verifies that in-progress smooth scrolls -// stop when interrupted by an instant scroll, another smooth scroll, a -// touch scroll, or a mouse wheel scroll. -// -// The only SmoothScrollInerruptionTest method that should be called by -// outside code is run(). -// -// Creates a SmoothScrollInterruptionTest with arguments: -// scrollElement - Element being scrolled. -// innerPoint - Absolute position (expressed as a dictionary with x and y fields) -// of a point inside |scrollElement|, that can be used as the location -// of input events that trigger scrolls on |scrollElement|. -// targets - A dictionary whose members y_min, y_mid, and y_max should be -// y co-ordinates that are far enough apart from each other that a -// smooth scroll between any pair of them will be non-trivial (that -// is, take multiple frames to finish), and should be such that -// y_min < y_mid < y_max. -// jsScroll - Callback that takes a y co-ordinate and executes a js-driven -// smooth scroll to that y co-ordinate. -function SmoothScrollInterruptionTest(scrollElement, innerPoint, targets, jsScroll) { - this.scrollElement = scrollElement; - this.innerPoint = innerPoint; - this.scrollStartPoint = targets.y_mid; - this.scrollEndPoint = targets.y_max; - this.scrollNewEndpoint = targets.y_min; - this.jsScroll = jsScroll; - - this.testCases = []; - this.testCases.push(new SmoothScrollInterruptionTestCase(interruptWithInstantScroll, verifyScrollInterruptedByInstantScroll, "instant scroll")); - this.testCases.push(new SmoothScrollInterruptionTestCase(interruptWithSmoothScroll, verifyScrollInterruptedBySmoothScroll, "smooth scroll")); - this.testCases.push(new SmoothScrollInterruptionTestCase(interruptWithTouchScroll, verifyScrollInterruptedByInputDrivenScroll, "touch scroll")); - this.testCases.push(new SmoothScrollInterruptionTestCase(interruptWithWheelScroll, verifyScrollInterruptedByInputDrivenScroll, "wheel scroll")); - - this.currentTestCase = 0; -} - -SmoothScrollInterruptionTest.prototype.startNextTestCase = function() { - if (this.currentTestCase >= this.testCases.length) { - this.allTestCasesComplete(); - return; - } - - var testCase = this.testCases[this.currentTestCase]; - this.asyncTest = async_test(testCase.description); - - var scrollElement = this.scrollElement; - var scrollStartPoint = this.scrollStartPoint; - - scrollElement.scrollTop = scrollStartPoint; - window.requestAnimationFrame(this.waitForSyncScroll.bind(this)); -} - -SmoothScrollInterruptionTest.prototype.waitForSyncScroll = function() { - // Wait until cc has received the commit from main with the scrollStartPoint. - if (this.scrollElement.scrollTop != this.scrollStartPoint) { - // TODO(flackr): There seems to be a bug in that we shouldn't have to - // reapply the scroll position when cancelling a smooth scroll. - // https://crbug.com/667477 - this.scrollElement.scrollTop = this.scrollStartPoint; - window.requestAnimationFrame(this.waitForSyncScroll.bind(this)); - return; - } - - this.performSmoothScroll(); -} - -SmoothScrollInterruptionTest.prototype.performSmoothScroll = function() { - var testCase = this.testCases[this.currentTestCase]; - var scrollElement = this.scrollElement; - var scrollStartPoint = this.scrollStartPoint; - - this.jsScroll(this.scrollEndPoint); - this.asyncTest.step(function() { - assert_equals(scrollElement.scrollTop, scrollStartPoint); - }); - - if (scrollElement.scrollTop == this.scrollEndPoint) { - // We've instant-scrolled, and failed the assert above. - this.testCaseComplete(); - return; - } - - window.requestAnimationFrame(this.waitForSmoothScrollStart.bind(this)); -} - -SmoothScrollInterruptionTest.prototype.waitForSmoothScrollStart = function() { - if (this.scrollElement.scrollTop == this.scrollStartPoint) { - window.requestAnimationFrame(this.waitForSmoothScrollStart.bind(this)); - return; - } - - var testCase = this.testCases[this.currentTestCase]; - testCase.interruptSmoothScroll(this); - window.requestAnimationFrame(testCase.verifyScrollInterrupted.bind(testCase, this, this.testCaseComplete.bind(this))); -} - -SmoothScrollInterruptionTest.prototype.testCaseComplete = function() { - this.asyncTest.done(); - - this.currentTestCase++; - this.startNextTestCase(); -} - -SmoothScrollInterruptionTest.prototype.run = function() { - setup({explicit_done: true, explicit_timeout: true}); - this.startNextTestCase(); -} - -SmoothScrollInterruptionTest.prototype.allTestCasesComplete = function() { - done(); -} - -// A SmoothScrollInterruptionTestCase represents a single way of interrupting -// a smooth scroll and verifying that the smooth scroll gets canceled. -// -// Creates a SmoothScrollInterruptionTestCase with arguments: -// interruptSmoothScoll - Callback that takes a SmoothScrollInterruptionTest, -// and interrupts the on-going smooth scroll. -// verifyScrollInterrupted - Callback that takes a SmoothScrollInterruptionTest, -// a |verificationComplete| callback, and a timestamp, -// verifies (possibly asynchronously) that the smooth -// scroll has been superseded by the interruption, and -// then calls |verificationComplete|. -// description - String describing this test case. -function SmoothScrollInterruptionTestCase(interruptSmoothScroll, verifyScrollInterrupted, description) { - this.interruptSmoothScroll = interruptSmoothScroll; - this.verifyScrollInterrupted = verifyScrollInterrupted; - this.description = description; -} - - -function interruptWithInstantScroll(smoothScrollTest) { - smoothScrollTest.scrollElement.scrollTop = smoothScrollTest.scrollNewEndpoint; - smoothScrollTest.asyncTest.step(function() { - assert_equals(smoothScrollTest.scrollElement.scrollTop, smoothScrollTest.scrollNewEndpoint); - }); -} - -function verifyScrollInterruptedByInstantScroll(smoothScrollTest, verificationComplete) { - smoothScrollTest.asyncTest.step(function() { - assert_equals(smoothScrollTest.scrollElement.scrollTop, smoothScrollTest.scrollNewEndpoint); - }); - verificationComplete(); -} - -function interruptWithSmoothScroll(smoothScrollTest) { - smoothScrollTest.jsScroll(smoothScrollTest.scrollNewEndpoint); - smoothScrollTest.asyncTest.step(function() { - assert_not_equals(smoothScrollTest.scrollElement.scrollTop, smoothScrollTest.scrollNewEndpoint); - }); - - this.scrollInterruptionPoint = smoothScrollTest.scrollElement.scrollTop; -} - -function verifyScrollInterruptedBySmoothScroll(smoothScrollTest, verificationComplete) { - var currentPosition = smoothScrollTest.scrollElement.scrollTop; - - if (currentPosition < this.scrollInterruptionPoint && currentPosition >= smoothScrollTest.scrollNewEndpoint) { - verificationComplete(); - } else { - window.requestAnimationFrame(this.verifyScrollInterrupted.bind(this, smoothScrollTest, verificationComplete)); - } -} - -function interruptWithTouchScroll(smoothScrollTest) { - if (window.eventSender) { - eventSender.gestureScrollBegin(smoothScrollTest.innerPoint.x, smoothScrollTest.innerPoint.y); - eventSender.gestureScrollUpdate(0, -10); - eventSender.gestureScrollEnd(0, 0); - } else { - document.write("This test does not work in manual mode."); - } -} - -function verifyScrollInterruptedByInputDrivenScroll(smoothScrollTest, verificationComplete, timestamp) { - var currentPosition = smoothScrollTest.scrollElement.scrollTop; - - if (this.previousPosition && this.previousPosition == currentPosition) { - // Ensure that the animation has really stopped, not that we just have - // two frames that are so close together that the animation only seems to - // have stopped. - if (timestamp - this.previousTimestamp > 16) { - verificationComplete(); - } else { - window.requestAnimationFrame(this.verifyScrollInterrupted.bind(this, smoothScrollTest, verificationComplete)); - } - - return; - } - - this.previousPosition = currentPosition; - this.previousTimestamp = timestamp; - smoothScrollTest.asyncTest.step(function() { - assert_not_equals(currentPosition, smoothScrollTest.scrollEndPoint); - }); - window.requestAnimationFrame(this.verifyScrollInterrupted.bind(this, smoothScrollTest, verificationComplete)); -} - -function interruptWithWheelScroll(smoothScrollTest) { - if (window.eventSender) { - eventSender.mouseMoveTo(smoothScrollTest.innerPoint.x, smoothScrollTest.innerPoint.y); - eventSender.mouseScrollBy(0, -10); - } else { - document.write("This test does not work in manual mode."); - } -}
diff --git a/third_party/blink/web_tests/fast/scroll-behavior/subframe-interrupted-scroll.html b/third_party/blink/web_tests/fast/scroll-behavior/subframe-interrupted-scroll.html deleted file mode 100644 index 74e78d3..0000000 --- a/third_party/blink/web_tests/fast/scroll-behavior/subframe-interrupted-scroll.html +++ /dev/null
@@ -1,39 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <style> - #subframe { - width: 200px; - height: 200px; - } - </style> - <script src="../../resources/testharness.js"></script> - <script src="../../resources/testharnessreport.js"></script> - <script src="resources/scroll-interruption-test.js"></script> - <script type="text/javascript"> - function jsScroll(y) { - var subframe = document.getElementById('subframe'); - subframe.contentWindow.scrollTo({top: y, behavior: 'smooth'}); - } - - function doTest() - { - const targets = {y_min: 40, y_mid: 3500, y_max: 7000}; - const innerPoint = {x: 100, y: 100} - var subframeScrollingElement = document.getElementById('subframe').contentDocument.scrollingElement; - var scrollInterruptionTest = new SmoothScrollInterruptionTest(subframeScrollingElement, - innerPoint, - targets, - jsScroll); - scrollInterruptionTest.run(); - } - - window.addEventListener('load', doTest, false); - </script> -</head> - -<body> - <p>Test that interrupting a smooth scroll on a subframe works with both scroll behaviors and with input</p> - <iframe id="subframe" src="resources/large-subframe.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/http/tests/devtools/elements/elements-panel-styles-expected.txt b/third_party/blink/web_tests/http/tests/devtools/elements/elements-panel-styles-expected.txt index da1e380..df624d7 100644 --- a/third_party/blink/web_tests/http/tests/devtools/elements/elements-panel-styles-expected.txt +++ b/third_party/blink/web_tests/http/tests/devtools/elements/elements-panel-styles-expected.txt
@@ -85,7 +85,7 @@ margin-top: 10px; margin-right: 0px; margin-bottom: 2px; - margin-left: 1px; + /-- overloaded --/ margin-left: 1px; border-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; @@ -96,7 +96,7 @@ /-- overloaded --/ font-weight: bold; padding: 4px; padding-top: 4px; - padding-right: 1px; + /-- overloaded --/ padding-right: 1px; padding-bottom: 4px; padding-left: 4px; padding-right: 1px;
diff --git a/third_party/blink/web_tests/inspector-protocol/accessibility/accessibility-nameSources-visiblity-expected.txt b/third_party/blink/web_tests/inspector-protocol/accessibility/accessibility-nameSources-visiblity-expected.txt index 97642d7..96264bc 100644 --- a/third_party/blink/web_tests/inspector-protocol/accessibility/accessibility-nameSources-visiblity-expected.txt +++ b/third_party/blink/web_tests/inspector-protocol/accessibility/accessibility-nameSources-visiblity-expected.txt
@@ -198,7 +198,7 @@ [4] : { idref : 3e nodeResult : tr#3e - text : + text : 5 } [5] : { idref : 3f @@ -217,7 +217,7 @@ type : relatedElement value : { type : computedString - value : 1 2 3 4 6 7 + value : 1 2 3 4 5 6 7 } } [1] : { @@ -247,7 +247,7 @@ } ] type : computedString - value : 1 2 3 4 6 7 + value : 1 2 3 4 5 6 7 } nodeId : <string> properties : [ @@ -327,7 +327,7 @@ [4] : { idref : 3e nodeResult : tr#3e - text : + text : 5 } [5] : { idref : 3f
diff --git a/third_party/blink/web_tests/inspector-protocol/accessibility/accessibility-query-axtree-expected.txt b/third_party/blink/web_tests/inspector-protocol/accessibility/accessibility-query-axtree-expected.txt index f86438e..40af0d57 100644 --- a/third_party/blink/web_tests/inspector-protocol/accessibility/accessibility-query-axtree-expected.txt +++ b/third_party/blink/web_tests/inspector-protocol/accessibility/accessibility-query-axtree-expected.txt
@@ -130,39 +130,15 @@ value : text } } -{ - backendDOMNodeId : <number> - ignored : true - ignoredReasons : [ - [0] : { - name : notRendered - value : { - type : boolean - value : true - } - } - ] - name : { - type : computedString - value : title - } - nodeId : <string> - role : { - type : role - value : heading - } -} Running test: testGetNodesForSubtreeByAccessibleName find all elements with accessible name "foo" node3 node5 node6 -node7 find all elements with accessible name "foo" inside container node5 node6 -node7 find all elements with accessible name "bar" node1 node2 @@ -206,11 +182,9 @@ find all elements with accessible name "foo" and role "button" node5 node6 -node7 find all elements with accessible name "foo" and role "button" inside container node5 node6 -node7 find all elements with accessible name "text content" and role "heading" node11 node13
diff --git a/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/README.txt b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/README.txt new file mode 100644 index 0000000..ce4d0d5 --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/README.txt
@@ -0,0 +1,3 @@ +# This suite runs the tests in web_tests/dark-mode/images +# with --blink-settings=forceDarkModeEnabled=true +# See the virtual_test_suites() method in tools/blinkpy/web_tests/port/base.py.
diff --git a/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/desaturate-before-inversion-expected.png b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/desaturate-before-inversion-expected.png new file mode 100644 index 0000000..555a471 --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/desaturate-before-inversion-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/gradient-expected.png b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/gradient-expected.png new file mode 100644 index 0000000..da69f70 --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/gradient-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/image-expected.png b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/image-expected.png new file mode 100644 index 0000000..d22720e --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/image-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/svg-as-image-expected.png b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/svg-as-image-expected.png new file mode 100644 index 0000000..c084988 --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/svg-as-image-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/svg-in-html-expected.png b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/svg-in-html-expected.png new file mode 100644 index 0000000..c084988 --- /dev/null +++ b/third_party/blink/web_tests/virtual/dark-mode-default/dark-mode/images/svg-in-html-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/webcodecs/basic_video_encoding.html b/third_party/blink/web_tests/webcodecs/basic_video_encoding.html index b284f53..813fd08 100644 --- a/third_party/blink/web_tests/webcodecs/basic_video_encoding.html +++ b/third_party/blink/web_tests/webcodecs/basic_video_encoding.html
@@ -176,13 +176,8 @@ promise_test(encode_decode_test.bind(null, "vp8", "allow"), "encoding and decoding vp8"); - /* TODO(crbug/1127073): re-enable these tests when they pass. - promise_test(encode_test.bind(null, "avc1.42001E", "allow"), - "encoding avc1.42001E"); - promise_test(encode_decode_test.bind(null, "avc1.42001E", "allow"), "encoding and decoding avc1.42001E"); - */ /* Uncomment this for manual testing, before we have GPU tests for that */ // promise_test(encode_test.bind(null, "avc1.42001E", "require"),
diff --git a/third_party/blink/web_tests/wpt_internal/webgpu/common/runtime/wpt.js b/third_party/blink/web_tests/wpt_internal/webgpu/common/runtime/wpt.js index 5749159..7ea92229 100644 --- a/third_party/blink/web_tests/wpt_internal/webgpu/common/runtime/wpt.js +++ b/third_party/blink/web_tests/wpt_internal/webgpu/common/runtime/wpt.js
@@ -48,7 +48,6 @@ }); running.push(p); - return p; }; async_test(wpt_fn, name);
diff --git a/third_party/libvpx/BUILD.gn b/third_party/libvpx/BUILD.gn index 6d98144d..df54bc90 100644 --- a/third_party/libvpx/BUILD.gn +++ b/third_party/libvpx/BUILD.gn
@@ -29,7 +29,7 @@ cpu_arch_full = "arm" } } else if (current_cpu == "arm64") { - if (is_chromeos || is_win || is_mac) { + if (is_chromeos || is_mac) { cpu_arch_full = "arm64-highbd" } else { cpu_arch_full = current_cpu
diff --git a/tools/android/dependency_analysis/print_class_dependencies.py b/tools/android/dependency_analysis/print_class_dependencies.py index aaa1377..834f8f96 100755 --- a/tools/android/dependency_analysis/print_class_dependencies.py +++ b/tools/android/dependency_analysis/print_class_dependencies.py
@@ -11,6 +11,7 @@ import chrome_names import class_dependency import graph +import package_dependency import print_dependencies_helper import serialization @@ -35,6 +36,7 @@ '//ui/', '//url:', } +IGNORED_CLASSES = {'org.chromium.base.natives.GEN_JNI'} def get_class_name_to_display(fully_qualified_name: str, @@ -53,10 +55,14 @@ return chrome_names.shorten_build_target(build_target) -def is_allowed_dependency(build_target: str) -> bool: +def is_allowed_target_dependency(build_target: str) -> bool: return any(build_target.startswith(p) for p in ALLOWED_PREFIXES) +def is_ignored_class_dependency(class_name: str) -> bool: + return class_name in IGNORED_CLASSES + + def print_class_nodes(class_nodes: List[class_dependency.JavaClass], print_mode: PrintMode, class_name: str, direction: str): ignore_modularized = direction == OUTBOUND and print_mode.ignore_modularized @@ -73,9 +79,11 @@ for class_node in class_nodes: if ignore_modularized: if all( - is_allowed_dependency(target) + is_allowed_target_dependency(target) for target in class_node.build_targets): continue + if is_ignored_class_dependency(class_node.name): + continue else: suspect_dependencies += 1 build_target = str(class_node.build_targets) @@ -93,16 +101,15 @@ # Print header if ignore_modularized: cleared = len(class_nodes) - suspect_dependencies - print( - f'{suspect_dependencies} outbound dependencies from {class_name} ' - f'may need to be broken (omitted {cleared} cleared dependencies):') + print(f'{class_name} has {suspect_dependencies} outbound dependencies ' + f'that may need to be broken (omitted {cleared} cleared ' + f'dependencies):') else: if direction == INBOUND: - print( - f'{len(class_nodes)} inbound dependencies into {class_name}:') + print(f'{class_name} has {len(class_nodes)} inbound dependencies:') else: print( - f'{len(class_nodes)} outbound dependencies from {class_name}:') + f'{class_name} has {len(class_nodes)} outbound dependencies:') # Print build targets and dependencies for indent, message in print_backlog: @@ -126,6 +133,67 @@ print_mode, class_name, OUTBOUND) +def get_valid_classes_from_class_input( + class_graph: class_dependency.JavaClassDependencyGraph, + class_names_input: str) -> List[str]: + """Parses classes given as input into fully qualified, valid classes.""" + result = [] + + class_graph_keys = [node.name for node in class_graph.nodes] + + class_names = class_names_input.split(',') + + for class_name in class_names: + valid_keys = print_dependencies_helper.get_valid_class_keys_matching( + class_graph_keys, class_name) + + check_only_one_valid_key(valid_keys, class_name, 'class') + + result.append(valid_keys[0]) + + return result + + +def get_valid_classes_from_package_input( + package_graph: package_dependency.JavaPackageDependencyGraph, + package_names_input: str) -> List[str]: + """Parses packages given as input into fully qualified, valid classes.""" + result = [] + + package_graph_keys = [node.name for node in package_graph.nodes] + + package_names = package_names_input.split(',') + + for package_name in package_names: + valid_keys = print_dependencies_helper.get_valid_package_keys_matching( + package_graph_keys, package_name) + + check_only_one_valid_key(valid_keys, package_name, 'package') + + package_key: str = valid_keys[0] + package_node: package_dependency.JavaPackage = \ + package_graph.get_node_by_key(package_key) + classes_in_package: List[str] = sorted(package_node.classes.keys()) + result.extend(classes_in_package) + + return result + + +def check_only_one_valid_key(valid_keys: List[str], key_input: str, + entity: str) -> None: + if len(valid_keys) == 0: + raise ValueError(f'No {entity} found by the name {key_input}.') + elif len(valid_keys) > 1: + print(f'Multiple valid keys found for the name {key_input}, ' + 'please disambiguate between one of the following options:') + for valid_key in valid_keys: + print(f'\t{valid_key}') + raise ValueError( + f'Multiple valid keys found for the name {key_input}.') + else: # len(valid_keys) == 1 + return + + def main(): """Prints class-level dependencies for one or more input classes.""" arg_parser = argparse.ArgumentParser( @@ -138,10 +206,11 @@ required=True, help='Path to the JSON file containing the dependency graph. ' 'See the README on how to generate this file.') - required_arg_group.add_argument( + required_arg_group_either = arg_parser.add_argument_group( + 'required arguments (at least one)') + required_arg_group_either.add_argument( '-c', '--classes', - required=True, dest='class_names', help='Case-sensitive name of the classes to print dependencies for. ' 'Matches either the simple class name without package or the fully ' @@ -149,6 +218,13 @@ '`org.chromium.browser.AppHooks`. Specify multiple classes with a ' 'comma-separated list, for example ' '`ChromeActivity,ChromeTabbedActivity`') + required_arg_group_either.add_argument( + '-p', + '--packages', + dest='package_names', + help='Case-sensitive name of the packages to print dependencies for, ' + 'such as `org.chromium.browser`. Specify multiple packages with a ' + 'comma-separated list.`') direction_arg_group = arg_parser.add_mutually_exclusive_group() direction_arg_group.add_argument('--inbound', dest='inbound_only', @@ -169,37 +245,35 @@ 'dependencies.') arguments = arg_parser.parse_args() + if not arguments.class_names and not arguments.package_names: + raise ValueError('Either -c/--classes or -p/--packages need to be ' + 'specified.') + print_mode = PrintMode(inbound=not arguments.outbound_only, outbound=not arguments.inbound_only, ignore_modularized=arguments.ignore_modularized, fully_qualified=arguments.fully_qualified) - class_graph = serialization.load_class_graph_from_file(arguments.file) - class_graph_keys = [node.name for node in class_graph.nodes] + class_graph, package_graph = \ + serialization.load_class_and_package_graphs_from_file(arguments.file) - class_names = arguments.class_names.split(',') + valid_class_names = [] + if arguments.class_names: + valid_class_names.extend( + get_valid_classes_from_class_input(class_graph, + arguments.class_names)) + if arguments.package_names: + valid_class_names.extend( + get_valid_classes_from_package_input(package_graph, + arguments.package_names)) - for i, class_name in enumerate(class_names): - valid_keys = print_dependencies_helper.get_valid_class_keys_matching( - class_graph_keys, class_name) - + for i, fully_qualified_class_name in enumerate(valid_class_names): if i > 0: print() - if len(valid_keys) == 0: - print(f'No class found by the name {class_name}.') - elif len(valid_keys) > 1: - print(f'Multiple valid keys found for the name {class_name}, ' - 'please disambiguate between one of the following options:') - for valid_key in valid_keys: - print(f'\t{valid_key}') - else: # len(valid_keys) == 1 - fully_qualified_class_name = valid_keys[0] - class_name = get_class_name_to_display(fully_qualified_class_name, - print_mode) - print_class_dependencies_for_key(class_graph, - fully_qualified_class_name, - print_mode) + print_class_dependencies_for_key(class_graph, + fully_qualified_class_name, + print_mode) if __name__ == '__main__':
diff --git a/tools/binary_size/libsupersize/file_format.py b/tools/binary_size/libsupersize/file_format.py index 5531922..3c7073b5e 100644 --- a/tools/binary_size/libsupersize/file_format.py +++ b/tools/binary_size/libsupersize/file_format.py
@@ -166,9 +166,18 @@ # detecting duplicate symbols. # (s.full_name, s.object_path) are important for sort stability when called by # _ExpandSparseSymbols(). - raw_symbols.sort( - key=lambda s: (s.IsPak(), s.IsBss(), s.section_name, s.address, s. - size_without_padding > 0, s.full_name, s.object_path)) + def sort_key(s): + return (s.IsPak(), s.IsBss(), s.section_name, s.address, + s.size_without_padding > 0, s.full_name, s.object_path) + + raw_symbols.sort(key=sort_key) + seen_aliases = set() + for s in raw_symbols: + if s.aliases: + if s.aliases[0] not in seen_aliases: + s.aliases.sort(key=sort_key) + seen_aliases.add(s.aliases[0]) + logging.info('Processed %d symbols', len(raw_symbols)) @@ -187,8 +196,11 @@ if (prev_symbol.container.name != symbol.container.name or prev_symbol.section_name != symbol.section_name): container_and_section = (symbol.container.name, symbol.section_name) - assert container_and_section not in seen_container_and_sections, ( - 'Input symbols must be sorted by container, section, then address.') + assert container_and_section not in seen_container_and_sections, """\ +Input symbols must be sorted by container, section, then address. +Found: {} +Then: {} +""".format(prev_symbol, symbol) seen_container_and_sections.add(container_and_section) continue if (symbol.address <= 0 or prev_symbol.address <= 0 @@ -219,20 +231,20 @@ sparse_symbols: A list or SymbolGroup to expand. """ representative_symbols = set() - raw_symbols = set() + raw_symbols = [] logging.debug('Expanding sparse_symbols with aliases of included symbols') for sym in sparse_symbols: if sym.aliases: + num_syms = len(representative_symbols) representative_symbols.add(sym.aliases[0]) + if num_syms < len(representative_symbols): + raw_symbols.extend(sym.aliases) else: - raw_symbols.add(sym) - for sym in representative_symbols: - raw_symbols.update(set(sym.aliases)) - raw_symbols = list(raw_symbols) - SortSymbols(raw_symbols) + raw_symbols.append(sym) logging.debug('Done expanding sparse_symbols') return models.SymbolGroup(raw_symbols) + def _SaveSizeInfoToFile(size_info, file_obj, include_padding=False, @@ -465,6 +477,10 @@ _ReadValuesFromLine(lines, split='\t') for _ in range(num_path_tuples) ] + if num_path_tuples == 0: + logging.warning('File contains no symbols: %s', size_path) + return models.SizeInfo(build_config, containers, [], size_path=size_path) + # Component list. if has_components: num_components = int(_ReadLine(lines)) # Number of components in list.
diff --git a/tools/binary_size/libsupersize/integration_test.py b/tools/binary_size/libsupersize/integration_test.py index 79b61029..398a1a4a 100755 --- a/tools/binary_size/libsupersize/integration_test.py +++ b/tools/binary_size/libsupersize/integration_test.py
@@ -357,6 +357,26 @@ use_aux_elf=True, include_padding=True) + def test_SaveDeltaSizeInfo(self): + # Check that saving & loading is the same as directly parsing. + orig_info1 = self._CloneSizeInfo(use_apk=True, use_aux_elf=True) + orig_info2 = self._CloneSizeInfo(use_elf=True) + orig_delta = diff.Diff(orig_info1, orig_info2) + + with tempfile.NamedTemporaryFile(suffix='.sizediff') as sizediff_file: + file_format.SaveDeltaSizeInfo(orig_delta, sizediff_file.name) + new_info1, new_info2 = archive.LoadAndPostProcessDeltaSizeInfo( + sizediff_file.name) + new_delta = diff.Diff(new_info1, new_info2) + + # File format discards unchanged symbols. + orig_delta.raw_symbols = orig_delta.raw_symbols.WhereDiffStatusIs( + models.DIFF_STATUS_UNCHANGED).Inverted() + + self.assertEqual( + '\n'.join(describe.GenerateLines(orig_delta, verbose=True)), + '\n'.join(describe.GenerateLines(new_delta, verbose=True))) + @_CompareWithGolden() def test_Console(self): with tempfile.NamedTemporaryFile(suffix='.size') as size_file, \
diff --git a/tools/binary_size/libsupersize/models.py b/tools/binary_size/libsupersize/models.py index 61eca0f..f521f8a 100644 --- a/tools/binary_size/libsupersize/models.py +++ b/tools/binary_size/libsupersize/models.py
@@ -10,6 +10,8 @@ May be 0 (e.g. for .bss or for SymbolGroups). * size: The number of bytes this symbol takes up, including padding that comes before |address|. + * aliases: List of symbols that represent the same bytes. The |aliases| of + each symbol in this list points to the same list instance. * num_aliases: The number of symbols with the same address (including self). * pss: size / num_aliases. * padding: The number of bytes of padding before |address| due to this symbol.
diff --git a/tools/clang/rewrite_raw_ptr_fields/manual-fields-to-ignore.txt b/tools/clang/rewrite_raw_ptr_fields/manual-fields-to-ignore.txt index abecde5..0c5bb35 100644 --- a/tools/clang/rewrite_raw_ptr_fields/manual-fields-to-ignore.txt +++ b/tools/clang/rewrite_raw_ptr_fields/manual-fields-to-ignore.txt
@@ -155,8 +155,20 @@ vr::LocationBarState::vector_icon vr::OmniboxSuggestion::icon +# Populated manually - assigned to |auto*| in ranged loop on an array +# initializer literal comprising of those pointers. +DownloadItemView::discard_button_ +DownloadItemView::open_now_button_ +DownloadItemView::save_button_ +DownloadItemView::scan_button_ + # Populated manually - other compile-time reasons logging::CheckOpResult::message_ # cyclic #include +views::internal::ClassPropertySetter::property_ # passed to templated param T* + +####### +# CheckedPtr2/MTECheckedPtr-specific sections +####### # Populated manually - these pointers are assigned invalid address (with top # bits sets), which CheckedPtr is unable to handle, leading to run-time crashes. @@ -166,8 +178,7 @@ performance_manager::frame_priority::BoostingVoteAggregator::Edge::src_ performance_manager::frame_priority::BoostingVoteAggregator::Edge::dst_ -# Populated manually - these pointers crash when converted to CheckedPtr. -# It's mostly mismatching tag, unless otherwise specified. +# Populated manually - these pointers crash due to a mismatching tag. # Under investigation. base::internal::UnretainedWrapper::ptr_ blink::NGPhysicalContainerFragment::buffer_ @@ -179,4 +190,71 @@ mojo::core::WatcherDispatcher::last_watch_to_block_arming_ net::IOBuffer::data_ safe_browsing::RemoteSafeBrowsingDatabaseManager::ClientRequest::client_ -x11::ReadBuffer::fds # Assigned address appears unallocated + +# Populated manually - this pointer crashes, because assigned address appears +# unallocated. +x11::ReadBuffer::fds + +####### +# End of CheckedPtr2/MTECheckedPtr-specific sections +####### + +####### +# BackupRefPtr-specific sections +####### + +# Populated manually - std::is_trivially_destructible static_assert failure +blink::HTMLElementEquivalent::tag_name_ +blink::PrerendererClient::client_ +blink::weakness_marking_test::EphemeronCallbacksCounter::count_holder_ +sql::recover::InnerPageDecoder::db_reader_ +sql::recover::LeafPageDecoder::db_reader_ +WTF::ListHashSet::head_ +WTF::ListHashSet::tail_ + +# Populated manually - exit-time destructor +gpu::GpuControlList::Conditions::devices +gpu::GpuControlList::Conditions::driver_info +gpu::GpuControlList::Conditions::gl_strings +gpu::GpuControlList::Conditions::machine_model_info +gpu::GpuControlList::Conditions::intel_gpu_series_list +gpu::GpuControlList::Conditions::more +gpu::GpuControlList::Entry::features +gpu::GpuControlList::Entry::disabled_extensions +gpu::GpuControlList::Entry::disabled_webgl_extensions +gpu::GpuControlList::Entry::cr_bugs +gpu::GpuControlList::Entry::exceptions +media::ListElementInfo::id_info_ +media::SupportedTypeInfo::codecs +tracing::(anonymous namespace)::AllowlistEntry::arg_name_filter +net::(anonymous namespace)::CTRequiredPolicy::roots +net::(anonymous namespace)::CTRequiredPolicy::exceptions +net::HttpCache::Transaction::SetRequest(const net::NetLogWithSource &)::(anonymous struct)::search +net::TransportSecurityStateSource::Pinset::accepted_pins +net::TransportSecurityStateSource::Pinset::rejected_pins +net::TransportSecurityStateSource::expect_ct_report_uris +net::TransportSecurityStateSource::pinsets +WTF::StaticSingleton::InstanceStorage::pointer_ + +# Populated manually - attempt to use a deleted function (union's destructor is +# deleted, because an inner struct has CheckedPtr field) +flags_ui::FeatureEntry::(anonymous union)::(anonymous struct)::feature +ui::NativeTheme::MenuSeparatorExtraParams::paint_rect + +# Populated manually - flexible array with non-trivial destruction +blink::ShapeResultView::(anonymous struct)::alignment + +# Populated manually - these pointers crash, because a base class ctor accesses +# child class ptr fields before they're initialized. +blink::CacheEntry::next_ +blink::CacheEntry::prev_ +WTF::LruCache::next_ +WTF::LruCache::prev_ + +# Populated manually - these pointers crash, due to use-after-move. +gpu::gles2::PassthroughProgramCache::ProgramCacheValue::program_cache_ +gpu::gles2::ProgramCache::ScopedCacheUse::cache_ + +####### +# End of BackupRefPtr-specific sections +#######
diff --git a/tools/clang/scripts/build.py b/tools/clang/scripts/build.py index 3d009d1..6ad7b539 100755 --- a/tools/clang/scripts/build.py +++ b/tools/clang/scripts/build.py
@@ -176,7 +176,7 @@ Needs to be called from inside the git repository dir.""" return subprocess.check_output( - ['git', 'describe', '--long', '--abbrev=8', commit]).rstrip() + ['git', 'describe', '--long', '--abbrev=8', commit], shell=True).rstrip() def DeleteChromeToolsShim():
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 06414281..8f6c4fc 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -17,8 +17,20 @@ 'chromeos-arm-generic-cfi-thin-lto-chrome': 'chromeos_arm-generic_cfi_thin_lto_official', 'chromeos-betty-pi-arc-cfi-thin-lto-chrome': 'chromeos_betty-pi-arc_cfi_thin_lto_official', 'chromeos-betty-pi-arc-chrome': 'chromeos_betty-pi-arc_include_unwind_tables_official_use_fake_dbus_clients', + 'chromeos-betty-pi-arc-chrome-beta': 'chromeos_betty-pi-arc_include_unwind_tables_official_use_fake_dbus_clients', + 'chromeos-betty-pi-arc-chrome-ltc': 'chromeos_betty-pi-arc_include_unwind_tables_official_use_fake_dbus_clients', + 'chromeos-betty-pi-arc-chrome-lts': 'chromeos_betty-pi-arc_include_unwind_tables_official_use_fake_dbus_clients', + 'chromeos-betty-pi-arc-chrome-stable': 'chromeos_betty-pi-arc_include_unwind_tables_official_use_fake_dbus_clients', 'chromeos-eve-chrome': 'chromeos_eve_include_unwind_tables_official', + 'chromeos-eve-chrome-beta': 'chromeos_eve_include_unwind_tables_official', + 'chromeos-eve-chrome-ltc': 'chromeos_eve_include_unwind_tables_official', + 'chromeos-eve-chrome-lts': 'chromeos_eve_include_unwind_tables_official', + 'chromeos-eve-chrome-stable': 'chromeos_eve_include_unwind_tables_official', 'chromeos-kevin-chrome': 'chromeos_kevin_include_unwind_tables_official', + 'chromeos-kevin-chrome-beta': 'chromeos_kevin_include_unwind_tables_official', + 'chromeos-kevin-chrome-ltc': 'chromeos_kevin_include_unwind_tables_official', + 'chromeos-kevin-chrome-lts': 'chromeos_kevin_include_unwind_tables_official', + 'chromeos-kevin-chrome-stable': 'chromeos_kevin_include_unwind_tables_official', # Don't include unwind tables for the remaining three builders since # they monitor binary size growth, which may be affected by the tables. 'linux-chrome': 'official_goma',
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index c7fc4b17..fc9770e7 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -21830,6 +21830,7 @@ <int value="785" label="AttestationExtensionAllowlist"/> <int value="786" label="DataLeakPreventionRulesList"/> <int value="787" label="WebRtcAllowLegacyTLSProtocols"/> + <int value="788" label="MediaRecommendationsEnabled"/> </enum> <enum name="EnterprisePolicyDeviceIdValidity"> @@ -29774,6 +29775,13 @@ <int value="2" label="CONTENT_DISMISSED"/> </enum> +<enum name="FetchFontName"> + <int value="0" label="Other"/> + <int value="1" label="Google Sans Regular"/> + <int value="2" label="Google Sans Medium"/> + <int value="3" label="Google Sans Bold"/> +</enum> + <enum name="FetchFontResult"> <int value="0" label="Success"/> <int value="1" label="Failed due to unexpected font name"/> @@ -54882,6 +54890,14 @@ <int value="2" label="Password Breach Dialog"/> </enum> +<enum name="PasswordCheckResolutionAction"> + <int value="0" label="Opened a site to change password manually"/> + <int value="1" label="Started an automated password change flow"/> + <int value="2" label="Removed a password"/> + <int value="3" label="Edited a password"/> + <int value="4" label="Did nothing"/> +</enum> + <enum name="PasswordCheckUIUserActionAndroid"> <int value="0" label="Start check automatically"/> <int value="1" label="Start check manually"/> @@ -65049,7 +65065,7 @@ <enum name="SettingsLanguagesPageInteraction"> <int value="0" label="Switch system language"/> <int value="1" label="Restart"/> - <int value="2" label="Restart now"/> + <int value="2" label="Switch input method"/> <int value="3" label="Restart later"/> <int value="4" label="Open custom spell check"/> </enum> @@ -66066,6 +66082,10 @@ User cleared account cookies when there's no sync consent, which has caused sign out. </int> + <int value="13" label="MobileIdentityConsistency rollback"> + Signout was forced because MobileIdentityConsistency feature is disabled + when there's a primary account without sync consent. + </int> </enum> <enum name="SigninSource"> @@ -71713,6 +71733,18 @@ <int value="3" label="Digital assetlinks verification failure"/> </enum> +<enum name="TrustTokenRequestHelperFactoryOutcome"> + <int value="0" label="Successfully created an issuance helper"/> + <int value="1" label="Successfully created a redemption helper"/> + <int value="2" label="Successfully created a signing helper"/> + <int value="3" label="Empty 'issuers' parameter"/> + <int value="4" label="Unsuitable issuer in 'issuers' parameter"/> + <int value="5" label="Unsuitable top frame origin"/> + <int value="6" + label="Request rejected due to bearing an internal Trust Tokens header"/> + <int value="7" label="Rejected by authorizer (check cookie settings?)"/> +</enum> + <enum name="TunnelRedirectHistogramValue"> <obsolete> Removed in Chrome 76.
diff --git a/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml b/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml index 77c749f..3a4bf64 100644 --- a/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml
@@ -306,7 +306,7 @@ </histogram> <histogram name="Accessibility.CrosSelectToSpeak" enum="BooleanEnabled" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>dmazzoni@chromium.org</owner> <owner>katie@chromium.org</owner> <owner>chrome-a11y-core@google.com</owner> @@ -378,7 +378,7 @@ </histogram> <histogram name="Accessibility.CrosSpokenFeedback" enum="BooleanEnabled" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>dmazzoni@chromium.org</owner> <owner>kenjibaheux@google.com</owner> <owner>aleventhal@google.com</owner> @@ -436,7 +436,7 @@ </histogram> <histogram name="Accessibility.ImageLabels.ModalDialogAccepted" - enum="BooleanAccepted" expires_after="2021-01-24"> + enum="BooleanAccepted" expires_after="2021-03-28"> <owner>katie@chromium.org</owner> <owner>dmazzoni@chromium.org</owner> <summary> @@ -459,7 +459,7 @@ </histogram> <histogram name="Accessibility.ImageLabels.RequestLanguage" enum="LanguageCode" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>katie@chromium.org</owner> <owner>dmazzoni@chromium.org</owner> <owner>chrome-a11y-core@google.com</owner> @@ -643,7 +643,7 @@ </histogram> <histogram name="Accessibility.Mac.ReduceTransparency" enum="BooleanEnabled" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>ellyjones@chromium.org</owner> <owner>chrome-a11y-core@google.com</owner> <summary> @@ -679,7 +679,7 @@ </histogram> <histogram name="Accessibility.ModeFlag" enum="AccessibilityModeFlagEnum" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>dmazzoni@chromium.org</owner> <owner>aboxhall@chromium.org</owner> <owner>chrome-a11y-core@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/android/histograms.xml b/tools/metrics/histograms/histograms_xml/android/histograms.xml index b24cf30..ea875d3 100644 --- a/tools/metrics/histograms/histograms_xml/android/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/android/histograms.xml
@@ -576,7 +576,7 @@ </histogram> <histogram name="Android.Download.Rename.Dialog.Action" - enum="Android.Download.Rename.Dialog.Action" expires_after="2021-01-24"> + enum="Android.Download.Rename.Dialog.Action" expires_after="2021-03-28"> <owner>hesen@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary> @@ -586,7 +586,7 @@ </histogram> <histogram name="Android.Download.Rename.Result" - enum="Android.Download.Rename.Result" expires_after="2021-01-24"> + enum="Android.Download.Rename.Result" expires_after="2021-03-28"> <owner>hesen@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary> @@ -708,7 +708,7 @@ </histogram> <histogram name="Android.DownloadManager.OpenSource.Other" - enum="AndroidDownloadOpenSource" expires_after="2021-01-24"> + enum="AndroidDownloadOpenSource" expires_after="2021-03-28"> <owner>xingliu@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary> @@ -718,7 +718,7 @@ </histogram> <histogram name="Android.DownloadManager.OpenSource.Video" - enum="AndroidDownloadOpenSource" expires_after="2021-01-24"> + enum="AndroidDownloadOpenSource" expires_after="2021-03-28"> <owner>xingliu@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary>Records how users open video download files on Android.</summary> @@ -928,6 +928,17 @@ </summary> </histogram> +<histogram name="Android.FontLookup.FetchFontName" enum="FetchFontName" + expires_after="M89"> + <owner>chouinard@chromium.org</owner> + <owner>twellington@chromium.org</owner> + <summary> + Records font fetch requests by font name. These results may be used to + determine whether it remains worthwhile to preload fonts that are available + for renderer font match requests. + </summary> +</histogram> + <histogram name="Android.FontLookup.FetchFontResult" enum="FetchFontResult" expires_after="M89"> <owner>chouinard@chromium.org</owner> @@ -1083,7 +1094,7 @@ </histogram> <histogram name="Android.KernelVersion" enum="AndroidKernelVersion" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>rsesek@chromium.org</owner> <summary> Reports the kernel major and minor version from the utsname.release field. @@ -1217,7 +1228,7 @@ </histogram> <histogram base="true" name="Android.MemoryPressureNotification" - enum="Android.MemoryPressureNotification" expires_after="2021-01-24"> + enum="Android.MemoryPressureNotification" expires_after="2021-03-28"> <owner>ssid@chromium.org</owner> <summary> Memory pressure notifications sent by Android through ComponentCallbacks2. @@ -1906,7 +1917,7 @@ </histogram> <histogram name="Android.StrictMode.OverrideUrlLoadingTime" units="ms" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>yfriedman@chromium.org</owner> <owner>wnwen@chromium.org</owner> <summary> @@ -1916,7 +1927,7 @@ </histogram> <histogram name="Android.StrictMode.TabPersistentStore" units="ms" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wnwen@chromium.org</owner> <owner>yfriedman@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/apps/histograms.xml b/tools/metrics/histograms/histograms_xml/apps/histograms.xml index c389212..1a784af 100644 --- a/tools/metrics/histograms/histograms_xml/apps/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/apps/histograms.xml
@@ -199,7 +199,7 @@ </histogram> <histogram name="Apps.AppList.DriveQuickAccessProvider.CacheWarmed" - units="Boolean" expires_after="2021-01-03"> + units="Boolean" expires_after="2021-03-28"> <owner>tby@chromium.org</owner> <owner>jiameng@chromium.org</owner> <summary> @@ -375,7 +375,7 @@ </histogram> <histogram name="Apps.AppList.SuggestedContent.Enabled" enum="BooleanEnabled" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wrong@chromium.org</owner> <owner>jiameng@chromium.org</owner> <summary> @@ -1231,7 +1231,7 @@ </histogram> <histogram name="Apps.HomeLauncherTransition.AnimationSmoothness" units="%" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <!-- Name completed by histogram suffixes name="AppListTabletModeTransition" -->
diff --git a/tools/metrics/histograms/histograms_xml/arc/histograms.xml b/tools/metrics/histograms/histograms_xml/arc/histograms.xml index 784b6644..3399fb0f 100644 --- a/tools/metrics/histograms/histograms_xml/arc/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/arc/histograms.xml
@@ -102,7 +102,7 @@ </histogram> <histogram name="Arc.AppListRecommendedImp.AllImpression" units="count" - expires_after="2020-12-06"> + expires_after="2021-03-28"> <owner>robsc@chromium.org</owner> <owner>napper@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/ash/histograms.xml b/tools/metrics/histograms/histograms_xml/ash/histograms.xml index 55c358d6..1f0c446b 100644 --- a/tools/metrics/histograms/histograms_xml/ash/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ash/histograms.xml
@@ -201,8 +201,8 @@ <owner>newcomer@chromium.org</owner> <summary> The length of the user journey of the context menu version of clipboard - history. Measured as time before the menu is constructed, to time of the - menu being closed. Recorded every time the menu is closed, regardless of + history. Measured as time from starting to construct the menu, to time of + the menu being closed. Recorded every time the menu is closed, regardless of whether the user selected one of the menu options. </summary> </histogram> @@ -1568,7 +1568,7 @@ </histogram> <histogram name="Ash.Window.AnimationSmoothness.CrossFade" units="%" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wutao@chromium.org</owner> <summary> Relative smoothness of cross fade animation when setting window bounds. 100% @@ -1764,9 +1764,9 @@ </histogram> <histogram name="Ash.WindowSelector.SelectionDepth" units="items" - expires_after="M85"> - <owner>estade@chromium.org</owner> - <owner>tbuckley@chromium.org</owner> + expires_after="2021-09-29"> + <owner>sammiequon@chromium.org</owner> + <owner>tclaiborne@chromium.org</owner> <summary> When a window is selected in overview mode, records that window's position in the global MRU ordering. 1 represents the most-recently used window, 2
diff --git a/tools/metrics/histograms/histograms_xml/assistant/histograms.xml b/tools/metrics/histograms/histograms_xml/assistant/histograms.xml index ae35ce2..e4b8e7f 100644 --- a/tools/metrics/histograms/histograms_xml/assistant/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/assistant/histograms.xml
@@ -50,7 +50,7 @@ </histogram> <histogram name="Assistant.ContextEnabledUserCount" enum="BooleanEnabled" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>updowndota@chromium.org</owner> <owner>xiaohuic@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/autofill/histograms.xml b/tools/metrics/histograms/histograms_xml/autofill/histograms.xml index efee2e64..0789fe5 100644 --- a/tools/metrics/histograms/histograms_xml/autofill/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/autofill/histograms.xml
@@ -1514,25 +1514,15 @@ </summary> </histogram> -<histogram name="Autofill.StrikeDatabase.NthStrikeAdded.CreditCardSave" - units="strikes" expires_after="2021-01-31"> - <owner>jsaul@google.com</owner> - <owner>annelim@google.com</owner> - <summary> - Records the number of "strikes" a given card has, when a user - dismisses a prompt to save a new credit card. The strike count is - incremented each time the user dismisses the prompt. - </summary> -</histogram> +<histogram name="Autofill.StrikeDatabase.NthStrikeAdded" units="strikes" + expires_after="2021-01-31"> +<!-- Name completed by histogram_suffixes name="AutofillStrikeDatabaseProjectType" --> -<histogram name="Autofill.StrikeDatabase.NthStrikeAdded.LocalCardMigration" - units="strikes" expires_after="2021-01-31"> <owner>jsaul@google.com</owner> <owner>annelim@google.com</owner> <summary> - Records the number of "strikes" a user has, when a prompt for - local card migration is dismissed. The strike count is incremented each time - the user dismisses the prompt. + Records the number of "strikes" a particular feature has when a + new strike is added for that feature. </summary> </histogram> @@ -1579,6 +1569,8 @@ <histogram name="Autofill.StrikeDatabase.StrikesPresentWhenStrikeExpired" units="strikes" expires_after="2021-01-31"> +<!-- Name completed by histogram_suffixes name="AutofillStrikeDatabaseProjectType" --> + <owner>jsaul@google.com</owner> <owner>annelim@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/back_forward_cache/histograms.xml b/tools/metrics/histograms/histograms_xml/back_forward_cache/histograms.xml index f9fd5e8..eaee707 100644 --- a/tools/metrics/histograms/histograms_xml/back_forward_cache/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/back_forward_cache/histograms.xml
@@ -150,7 +150,7 @@ <histogram name="BackForwardCache.Experimental.UnexpectedIPCMessagePostedToCachedFrame.MethodHash" - enum="MojoInterfaceName" expires_after="2021-01-01"> + enum="MojoInterfaceName" expires_after="2021-03-28"> <owner>hbolaria@chromium.org</owner> <owner>altimin@chromium.org</owner> <owner>bfcache-dev@chromium.org</owner> @@ -168,7 +168,7 @@ <histogram name="BackForwardCache.Experimental.UnexpectedIPCMessagePostedToCachedFrame.TimeUntilIPCReceived" - units="ms" expires_after="2021-01-01"> + units="ms" expires_after="2021-03-28"> <owner>hbolaria@chromium.org</owner> <owner>altimin@chromium.org</owner> <owner>bfcache-dev@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/blink/histograms.xml b/tools/metrics/histograms/histograms_xml/blink/histograms.xml index 0539a3ee..1a3d282a 100644 --- a/tools/metrics/histograms/histograms_xml/blink/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/blink/histograms.xml
@@ -423,7 +423,7 @@ </histogram> <histogram base="true" name="Blink.Compositing.LayerPromotionCount" - units="units" expires_after="2021-01-24"> + units="units" expires_after="2021-03-28"> <owner>pdr@chromium.org</owner> <owner>paint-dev@chromium.org</owner> <summary> @@ -1939,7 +1939,7 @@ </histogram> <histogram name="Blink.UseCounter.FeaturePolicy.Header" - enum="FeaturePolicyFeature" expires_after="2021-01-10"> + enum="FeaturePolicyFeature" expires_after="2021-03-28"> <owner>iclelland@chromium.org</owner> <summary> Counts the use of a specific feature policy via the
diff --git a/tools/metrics/histograms/histograms_xml/browser/histograms.xml b/tools/metrics/histograms/histograms_xml/browser/histograms.xml index b63d07d3..d1f3cf4 100644 --- a/tools/metrics/histograms/histograms_xml/browser/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/browser/histograms.xml
@@ -435,7 +435,7 @@ </histogram> <histogram name="BrowserDialogs.ExternalProtocol.HandleState" - enum="HandleStateType" expires_after="2020-12-06"> + enum="HandleStateType" expires_after="2021-03-28"> <owner>dominickn@chromium.org</owner> <owner>meacer@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/chrome/histograms.xml b/tools/metrics/histograms/histograms_xml/chrome/histograms.xml index 35600a50..8a99f37 100644 --- a/tools/metrics/histograms/histograms_xml/chrome/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/chrome/histograms.xml
@@ -1117,7 +1117,7 @@ </histogram> <histogram name="ChromeOS.Sync.PreferencesMigrated" enum="BooleanMigrated" - expires_after="2021-01-01"> + expires_after="2021-03-28"> <owner>jamescook@chromium.org</owner> <owner>cros-customization@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/compositing/histograms.xml b/tools/metrics/histograms/histograms_xml/compositing/histograms.xml index 608174b..3fa42df 100644 --- a/tools/metrics/histograms/histograms_xml/compositing/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/compositing/histograms.xml
@@ -223,7 +223,7 @@ </histogram> <histogram name="Compositing.Display.Draw.Occlusion.Calculation.Time" - units="microseconds" expires_after="2020-12-27"> + units="microseconds" expires_after="2021-03-28"> <owner>yiyix@chromium.org</owner> <owner>chromeos-gfx@chromium.org</owner> <summary> @@ -562,7 +562,7 @@ </histogram> <histogram name="Compositing.SurfaceAggregator.FrameContainsVideo" - enum="TypeOfVideoInFrame" expires_after="2021-01-24"> + enum="TypeOfVideoInFrame" expires_after="2021-03-28"> <owner>vikassoni@chromium.org</owner> <owner>khushalsagar@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/cros/histograms.xml b/tools/metrics/histograms/histograms_xml/cros/histograms.xml index 0f9b266..07da023 100644 --- a/tools/metrics/histograms/histograms_xml/cros/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cros/histograms.xml
@@ -102,7 +102,7 @@ </histogram> <histogram name="CrosDisksClient.MountCompletedError" - enum="CrosDisksClientMountError" expires_after="2021-01-24"> + enum="CrosDisksClientMountError" expires_after="2021-03-28"> <owner>amistry@chromium.org</owner> <summary> The error code of disk mount signals received from the Chrome OS cros-disks
diff --git a/tools/metrics/histograms/histograms_xml/dev/histograms.xml b/tools/metrics/histograms/histograms_xml/dev/histograms.xml index 1630d961..dbd18952 100644 --- a/tools/metrics/histograms/histograms_xml/dev/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/dev/histograms.xml
@@ -191,7 +191,7 @@ </histogram> <histogram name="DevTools.IssuesPanelOpenedFrom" - enum="DevToolsIssuesPanelOpenedFrom" expires_after="2021-01-24"> + enum="DevToolsIssuesPanelOpenedFrom" expires_after="2021-03-28"> <owner>yangguo@chromium.org</owner> <owner>bmeurer@chromium.org</owner> <summary> @@ -231,7 +231,7 @@ </summary> </histogram> -<histogram base="true" name="DevTools.Launch" units="ms" expires_after="M85"> +<histogram base="true" name="DevTools.Launch" units="ms" expires_after="M94"> <!-- Name completed by histogram_suffixes name="DevToolsLaunchPanels" --> <owner>yangguo@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/download/histograms.xml b/tools/metrics/histograms/histograms_xml/download/histograms.xml index ac940497..a590442 100644 --- a/tools/metrics/histograms/histograms_xml/download/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/download/histograms.xml
@@ -222,7 +222,7 @@ </histogram> <histogram base="true" name="Download.InsecureBlocking.Extensions" - enum="InsecureDownloadExtensions" expires_after="M87"> + enum="InsecureDownloadExtensions" expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <owner>cthomp@chromium.org</owner> @@ -233,7 +233,7 @@ </histogram> <histogram name="Download.InsecureBlocking.Totals" - enum="InsecureDownloadSecurityStatus" expires_after="M87"> + enum="InsecureDownloadSecurityStatus" expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <owner>cthomp@chromium.org</owner> @@ -244,7 +244,7 @@ </histogram> <histogram base="true" name="Download.InsecureBlocking.Verification" - enum="DownloadContentType" expires_after="M87"> + enum="DownloadContentType" expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <owner>cthomp@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml index 8af3433..6fc61b7 100644 --- a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml
@@ -384,7 +384,7 @@ </histogram> <histogram name="Extensions.ContentVerification.FetchResult" - enum="BooleanSuccess" expires_after="2020-11-30"> + enum="BooleanSuccess" expires_after="2021-03-28"> <owner>lazyboy@chromium.org</owner> <owner>rdevlin.cronin@chromium.org</owner> <owner>extensions-core@chromium.org</owner> @@ -502,7 +502,7 @@ </histogram> <histogram name="Extensions.CorruptPolicyExtensionResolved" units="ms" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>lazyboy@chromium.org</owner> <owner>extensions-core@chromium.org</owner> @@ -1284,7 +1284,7 @@ </histogram> <histogram name="Extensions.ForceInstalledAndBlackListed" units="count" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>swapnilgupta@google.com</owner> <owner>burunduk@chromium.org</owner> <owner>managed-devices@google.com</owner> @@ -1297,7 +1297,7 @@ <histogram name="Extensions.ForceInstalledCacheStatus" enum="ExtensionInstallationDownloadingCacheStatus" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>swapnilgupta@google.com</owner> <owner>burunduk@chromium.org</owner> <owner>poromov@chromium.org</owner> @@ -1323,7 +1323,7 @@ </histogram> <histogram name="Extensions.ForceInstalledDownloadingStage" - enum="ExtensionInstallationDownloadingStage" expires_after="2021-01-24"> + enum="ExtensionInstallationDownloadingStage" expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1339,7 +1339,7 @@ <histogram name="Extensions.ForceInstalledFailureCacheStatus" enum="ExtensionInstallationDownloadingCacheStatus" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1353,7 +1353,7 @@ </histogram> <histogram name="Extensions.ForceInstalledFailureCrxInstallError" - enum="ExtensionInstallationCrxInstallError" expires_after="2021-01-24"> + enum="ExtensionInstallationCrxInstallError" expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1414,7 +1414,7 @@ </histogram> <histogram name="Extensions.ForceInstalledFailureReason3" - enum="ExtensionInstallationFailureReason" expires_after="2021-01-24"> + enum="ExtensionInstallationFailureReason" expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="ExtensionSource" --> <owner>burunduk@chromium.org</owner> @@ -1433,7 +1433,7 @@ </histogram> <histogram name="Extensions.ForceInstalledFailureSandboxUnpackFailureReason" - enum="ExtensionUnpackFailureReason" expires_after="2021-01-24"> + enum="ExtensionUnpackFailureReason" expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1446,7 +1446,7 @@ </histogram> <histogram name="Extensions.ForceInstalledFailureSessionType" - enum="SessionType" expires_after="2021-01-24"> + enum="SessionType" expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1459,7 +1459,7 @@ </histogram> <histogram name="Extensions.ForceInstalledFetchTries" units="retries" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1490,7 +1490,7 @@ </histogram> <histogram name="Extensions.ForceInstalledLoadTime" units="ms" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1501,7 +1501,7 @@ </histogram> <histogram name="Extensions.ForceInstalledManifestFetchFailedFetchTries" - units="retries" expires_after="2021-01-24"> + units="retries" expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1533,7 +1533,7 @@ </histogram> <histogram name="Extensions.ForceInstalledManifestFetchFailedNetworkErrorCode" - enum="NetErrorCodes" expires_after="2021-01-24"> + enum="NetErrorCodes" expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1547,7 +1547,7 @@ </histogram> <histogram name="Extensions.ForceInstalledNetworkErrorCode" - enum="NetErrorCodes" expires_after="2021-01-24"> + enum="NetErrorCodes" expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1561,7 +1561,7 @@ </histogram> <histogram name="Extensions.ForceInstalledNotLoadedDisableReason" - enum="ExtensionDisableReason" expires_after="2021-01-24"> + enum="ExtensionDisableReason" expires_after="2021-03-28"> <owner>swapnilgupta@google.com</owner> <owner>burunduk@chromium.org</owner> <owner>managed-devices@google.com</owner> @@ -1587,7 +1587,7 @@ <histogram name="Extensions.ForceInstalledSessionsWithNonMisconfigurationFailureOccured" - enum="Boolean" expires_after="2021-01-24"> + enum="Boolean" expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1632,7 +1632,7 @@ </histogram> <histogram name="Extensions.ForceInstalledTimedOutAndNotInstalledCount" - units="units" expires_after="2021-01-24"> + units="units" expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1643,7 +1643,7 @@ </histogram> <histogram name="Extensions.ForceInstalledTimedOutCount" units="units" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner> @@ -1654,7 +1654,7 @@ </histogram> <histogram name="Extensions.ForceInstalledTotalCandidateCount" units="units" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>burunduk@chromium.org</owner> <owner>swapnilgupta@google.com</owner> <owner>managed-devices@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/gcm/histograms.xml b/tools/metrics/histograms/histograms_xml/gcm/histograms.xml index 4007f74..470e2fe 100644 --- a/tools/metrics/histograms/histograms_xml/gcm/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/gcm/histograms.xml
@@ -442,7 +442,7 @@ <summary>Status code of the outcome of a GCM unregistration request.</summary> </histogram> -<histogram name="GCM.UserSignedIn" enum="Boolean" expires_after="2021-01-10"> +<histogram name="GCM.UserSignedIn" enum="Boolean" expires_after="2021-03-28"> <owner>jianli@chromium.org</owner> <summary> Indicates whether the user was signed in when GCM started up.
diff --git a/tools/metrics/histograms/histograms_xml/gpu/histograms.xml b/tools/metrics/histograms/histograms_xml/gpu/histograms.xml index 284667d..3b26b772 100644 --- a/tools/metrics/histograms/histograms_xml/gpu/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/gpu/histograms.xml
@@ -262,7 +262,7 @@ </histogram> <histogram name="GPU.ContextLost" enum="ContextLostReason" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>sievers@chromium.org</owner> <summary> The reason a GPU command buffer context of a given type was lost. @@ -587,7 +587,7 @@ </histogram> <histogram name="GPU.GLImplementation" enum="GLImplementation" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>magchen@chromium.org</owner> <owner>zmo@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml b/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml index 408df4b..2cad43fa 100644 --- a/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml +++ b/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml
@@ -1503,9 +1503,12 @@ <affected-histogram name="Autofill.StoredServerCreditCardCount"/> </histogram_suffixes> -<histogram_suffixes name="AutofillStrikesExpiredProjectType" separator="."> +<histogram_suffixes name="AutofillStrikeDatabaseProjectType" separator="."> <suffix name="CreditCardSave" label="Credit card save"/> + <suffix name="FidoAuthentication" + label="Fido authentication (Better Auth Project)"/> <suffix name="LocalCardMigration" label="Local card migration"/> + <affected-histogram name="Autofill.StrikeDatabase.NthStrikeAdded"/> <affected-histogram name="Autofill.StrikeDatabase.StrikesPresentWhenStrikeExpired"/> </histogram_suffixes> @@ -4405,8 +4408,16 @@ <suffix name="DataSaverDisabled" label="Data Saver is disabled"/> <suffix name="DataSaverEnabled" label="Data Saver is enabled"/> <affected-histogram name="Previews.ContentLength"/> - <affected-histogram name="Previews.DataInflation"/> - <affected-histogram name="Previews.DataInflationPercent"/> + <affected-histogram name="Previews.DataInflation"> + <obsolete> + Obsolete as of 09/2020. + </obsolete> + </affected-histogram> + <affected-histogram name="Previews.DataInflationPercent"> + <obsolete> + Obsolete as of 09/2020. + </obsolete> + </affected-histogram> <affected-histogram name="Previews.DataSavings"/> <affected-histogram name="Previews.DataSavingsPercent"/> <affected-histogram name="Previews.OriginalContentLength"/> @@ -7846,6 +7857,10 @@ <suffix name="IPH_WebUITabStrip" label="In product help for opening the WebUI tab strip."/> <affected-histogram name="InProductHelp.NotifyEventReadyState"/> + <affected-histogram name="InProductHelp.Promos.Snooze"/> + <affected-histogram name="InProductHelp.Promos.SnoozeCountAtAcknowledge"/> + <affected-histogram name="InProductHelp.Promos.SnoozeCountAtFollow"/> + <affected-histogram name="InProductHelp.Promos.SnoozeCountAtTrigger"/> <affected-histogram name="InProductHelp.ShouldTriggerHelpUI"/> </histogram_suffixes> @@ -19214,6 +19229,7 @@ <affected-histogram name="Net.TrustTokens.OperationServerTime.Success"/> <affected-histogram name="Net.TrustTokens.OperationTotalTime.Failure"/> <affected-histogram name="Net.TrustTokens.OperationTotalTime.Success"/> + <affected-histogram name="Net.TrustTokens.RequestHelperFactoryOutcome"/> </histogram_suffixes> <histogram_suffixes name="UkmSourceIdTypes" separator=".">
diff --git a/tools/metrics/histograms/histograms_xml/history/histograms.xml b/tools/metrics/histograms/histograms_xml/history/histograms.xml index 3f8e244..bb71fc9c 100644 --- a/tools/metrics/histograms/histograms_xml/history/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/history/histograms.xml
@@ -301,7 +301,7 @@ </histogram> <histogram name="History.ClearBrowsingData.UserDeletedFromTab" - enum="ClearBrowsingDataTab" expires_after="2021-01-26"> + enum="ClearBrowsingDataTab" expires_after="2021-03-28"> <owner>dullweber@chromium.org</owner> <owner>msramek@chromium.org</owner> <summary> @@ -631,7 +631,7 @@ </histogram> <histogram name="History.MonthlyURLCount" units="urls" - expires_after="2020-11-30"> + expires_after="2021-03-28"> <owner>mpearson@chromium.org</owner> <owner>sky@chromium.org</owner> <summary> @@ -642,7 +642,7 @@ </histogram> <histogram name="History.MonthlyVisitCount" units="visits" - expires_after="2020-11-30"> + expires_after="2021-03-28"> <owner>mpearson@chromium.org</owner> <owner>sky@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/image/histograms.xml b/tools/metrics/histograms/histograms_xml/image/histograms.xml index 5cc1c04..03c81dc0 100644 --- a/tools/metrics/histograms/histograms_xml/image/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/image/histograms.xml
@@ -42,7 +42,7 @@ </histogram> <histogram name="ImageAnnotationService.AccessibilityV1.ClientResult" - enum="ImageAnnotationServiceClientResult" expires_after="2021-01-24"> + enum="ImageAnnotationServiceClientResult" expires_after="2021-03-28"> <owner>dmazzoni@chromium.org</owner> <owner>amoylan@chromium.org</owner> <owner>martis@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/input/histograms.xml b/tools/metrics/histograms/histograms_xml/input/histograms.xml index 1dcfd79c..a324086 100644 --- a/tools/metrics/histograms/histograms_xml/input/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/input/histograms.xml
@@ -606,7 +606,7 @@ </histogram> <histogram name="InputMethod.VirtualKeyboard.InitLatency.KeyboardShownLongTail" - units="ms" expires_after="2021-01-24"> + units="ms" expires_after="2021-03-28"> <owner>jopalmer@chromium.org</owner> <owner>essential-inputs-team@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/ios/histograms.xml b/tools/metrics/histograms/histograms_xml/ios/histograms.xml index 65db2a1..8ca504d 100644 --- a/tools/metrics/histograms/histograms_xml/ios/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ios/histograms.xml
@@ -233,7 +233,7 @@ </histogram> <histogram name="IOS.CriticalActionBackgroundTimeRemaining" units="ms" - expires_after="2020-11-30"> + expires_after="2021-03-28"> <owner>justincohen@chromium.org</owner> <owner>eugenebut@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/media/histograms.xml b/tools/metrics/histograms/histograms_xml/media/histograms.xml index 6ea5808..8362a8f 100644 --- a/tools/metrics/histograms/histograms_xml/media/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/media/histograms.xml
@@ -339,7 +339,7 @@ </histogram> <histogram name="Media.Audio.Capture.Win.Open" enum="AudioStreamOpenResult" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>gudiou@chromium.org</owner> <owner>olka@chromium.org</owner> <summary> @@ -1198,7 +1198,7 @@ </histogram> <histogram name="Media.Controls.Show.Audio" enum="MediaControlsShowReason" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>mlamouri@chromium.org</owner> <summary> Record whether the default media controls of an audio element were shown and @@ -1209,7 +1209,7 @@ </histogram> <histogram name="Media.Controls.Show.Video" enum="MediaControlsShowReason" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>mlamouri@chromium.org</owner> <summary> Record whether the default media controls of a video element were shown and @@ -1751,6 +1751,17 @@ </summary> </histogram> +<histogram name="Media.Feeds.AggregateWatchtime" units="ms" + expires_after="2021-06-07"> + <owner>beccahughes@chromium.org</owner> + <owner>media-dev@chromium.org</owner> + <summary> + Records the aggregate watchtime for all Media Feeds on startup. The + aggregate watchtime is the total watchtime for a website recorded across + sessions. It is also cleared every 90 days. + </summary> +</histogram> + <histogram name="Media.Feeds.Feed.ReadResult" enum="MediaFeedReadResult" expires_after="2021-03-07"> <owner>beccahughes@chromium.org</owner> @@ -1860,7 +1871,7 @@ </histogram> <histogram name="Media.GlobalMediaControls.UserActionFocus" - enum="BooleanFocused" expires_after="2021-01-24"> + enum="BooleanFocused" expires_after="2021-03-28"> <owner>steimel@chromium.org</owner> <owner>media-dev@chromium.org</owner> <summary> @@ -1956,7 +1967,7 @@ </histogram> <histogram name="Media.HighLatencyAudioCaptureStartupSuccess" - enum="AudioCaptureStartupResult" expires_after="2021-01-24"> + enum="AudioCaptureStartupResult" expires_after="2021-03-28"> <owner>armax@chromium.org</owner> <owner>guidou@chromium.org</owner> <owner>olka@chromium.org</owner> @@ -2228,7 +2239,7 @@ </histogram> <histogram name="Media.LowLatencyAudioCaptureStartupSuccess" - enum="AudioCaptureStartupResult" expires_after="2021-01-24"> + enum="AudioCaptureStartupResult" expires_after="2021-03-28"> <owner>armax@chromium.org</owner> <owner>guidou@chromium.org</owner> <owner>olka@chromium.org</owner> @@ -2406,7 +2417,7 @@ </histogram> <histogram base="true" name="Media.MSE.CodecChangeTime" units="ms" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wolenetz@chromium.org</owner> <owner>sandersd@chromium.org</owner> <owner>media-dev@chromium.org</owner> @@ -2449,7 +2460,7 @@ </histogram> <histogram name="Media.MSE.Mp4ConsecutiveEmptySamples" units="samples" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wolenetz@chromium.org</owner> <owner>sandersd@chromium.org</owner> <summary> @@ -2462,7 +2473,7 @@ </histogram> <histogram name="Media.MSE.Mp4EmptySamplesInTRun" units="samples" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wolenetz@chromium.org</owner> <owner>sandersd@chromium.org</owner> <summary> @@ -2473,7 +2484,7 @@ </histogram> <histogram name="Media.MSE.Mp4SampleSize" units="bytes" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wolenetz@chromium.org</owner> <owner>sandersd@chromium.org</owner> <summary> @@ -2484,7 +2495,7 @@ </histogram> <histogram name="Media.MSE.Mp4TrunSampleCount" units="samples" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wolenetz@chromium.org</owner> <owner>sandersd@chromium.org</owner> <summary> @@ -4098,7 +4109,7 @@ </histogram> <histogram name="MediaLauncherActivity.MediaType" - enum="MediaLauncherActivityMediaType" expires_after="2021-01-24"> + enum="MediaLauncherActivityMediaType" expires_after="2021-03-28"> <owner>steimel@chromium.org</owner> <owner>media-dev@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/memory/histograms.xml b/tools/metrics/histograms/histograms_xml/memory/histograms.xml index f294da49..4a5c27f 100644 --- a/tools/metrics/histograms/histograms_xml/memory/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/memory/histograms.xml
@@ -82,7 +82,7 @@ <histogram base="true" name="Memory.BackgroundTask.Browser.PrivateMemoryFootprint" units="MiB" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="BrowserRunningMode" --> <owner>hanxi@chromium.org</owner> @@ -111,7 +111,7 @@ </histogram> <histogram base="true" name="Memory.BackgroundTask.Browser.ResidentSet" - units="MiB" expires_after="2021-01-24"> + units="MiB" expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="BrowserRunningMode" --> <owner>hanxi@chromium.org</owner> @@ -139,7 +139,7 @@ <histogram base="true" name="Memory.BackgroundTask.OfflinePrefetch.Browser.PrivateMemoryFootprint" - units="MiB" expires_after="2021-01-24"> + units="MiB" expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="BrowserRunningMode" --> <owner>hanxi@chromium.org</owner> @@ -389,7 +389,7 @@ </histogram> <histogram name="Memory.Discardable.FreelistSize.Foreground" units="KiB" - expires_after="2021-01-01"> + expires_after="2021-03-28"> <owner>thiabaud@google.com</owner> <owner>lizeb@chromium.org</owner> <summary> @@ -409,7 +409,7 @@ </histogram> <histogram name="Memory.Discardable.Size.Foreground" units="KiB" - expires_after="2021-01-01"> + expires_after="2021-03-28"> <owner>thiabaud@google.com</owner> <owner>lizeb@chromium.org</owner> <summary> @@ -419,7 +419,7 @@ </histogram> <histogram name="Memory.Discardable.VirtualSize.Foreground" units="KiB" - expires_after="2021-01-01"> + expires_after="2021-03-28"> <owner>thiabaud@google.com</owner> <owner>lizeb@chromium.org</owner> <summary> @@ -1432,7 +1432,7 @@ </histogram> <histogram name="Memory.NativeLibrary.NotResidentOrderedCodeMemoryFootprint" - units="KB" expires_after="2020-12-13"> + units="KB" expires_after="2021-03-28"> <owner>lizeb@chromium.org</owner> <summary> The size of the native library code which was ordered, yet is not resident
diff --git a/tools/metrics/histograms/histograms_xml/net/histograms.xml b/tools/metrics/histograms/histograms_xml/net/histograms.xml index 7fff8f8..c68c1b1e 100644 --- a/tools/metrics/histograms/histograms_xml/net/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/net/histograms.xml
@@ -4637,6 +4637,20 @@ </summary> </histogram> +<histogram base="true" name="Net.TrustTokens.RequestHelperFactoryOutcome" + enum="TrustTokenRequestHelperFactoryOutcome" expires_after="2021-03-30"> +<!-- Name completed by histogram_suffixes name="TrustTokenOperationType" --> + + <owner>davidvc@chromium.org</owner> + <owner>privacy-sandbox-dev@chromium.org</owner> + <summary> + For resource requests that bear Trust Tokens parameters, the results of + running TrustTokenRequestHelperFactory to initialize Trust Tokens handling + logic. This might help debug a surfeit of failed Trust Tokens issuance + operations observed in live testing. + </summary> +</histogram> + <histogram name="Net.TrustTokens.SubresourceOperationRequiringFeaturePolicy.PolicyIsConsistentWithBrowserOpinion" enum="BooleanConsistent" expires_after="2021-03-30">
diff --git a/tools/metrics/histograms/histograms_xml/obsolete_histograms.xml b/tools/metrics/histograms/histograms_xml/obsolete_histograms.xml index 21dab915..bcc0f5651b 100644 --- a/tools/metrics/histograms/histograms_xml/obsolete_histograms.xml +++ b/tools/metrics/histograms/histograms_xml/obsolete_histograms.xml
@@ -5,8 +5,16 @@ --> <!-- -This file is used to generate a comprehensive list of obsolete histograms -along with a detailed description for each histogram. +This file is used to generate a list of obsolete histograms along with a +detailed description for each histogram. + +This was auto-generated from the split_xml.py script which splits out previously +obsolete histograms. Users don't need to move newly marked obsolete histograms +into this file. + +In other words, when marking an existing histogram as <obsolete>, it's fine +to leave the histogram in its existing file in one of the histograms_xml + subdirectories. For best practices on writing histogram descriptions, see https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md
diff --git a/tools/metrics/histograms/histograms_xml/others/histograms.xml b/tools/metrics/histograms/histograms_xml/others/histograms.xml index d90974c..a653f82 100644 --- a/tools/metrics/histograms/histograms_xml/others/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/others/histograms.xml
@@ -22,7 +22,7 @@ <histograms> <histogram name="AccountManager.AccountAdditionSource" - enum="AccountManagerAccountAdditionSource" expires_after="2021-01-24"> + enum="AccountManagerAccountAdditionSource" expires_after="2021-03-28"> <owner>sinhak@chromium.org</owner> <owner>anastasiian@chromium.org</owner> <summary> @@ -96,7 +96,7 @@ </histogram> <histogram name="AccountManager.Migrations.Result" enum="BooleanSuccess" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>sinhak@chromium.org</owner> <summary> Tracks the final result of migrating accounts to Chrome OS Account Manager. @@ -118,7 +118,7 @@ </histogram> <histogram name="AccountManager.MirrorReauthenticationRequest" - enum="BooleanHit" expires_after="2021-01-24"> + enum="BooleanHit" expires_after="2021-03-28"> <owner>sinhak@chromium.org</owner> <owner>anastasiian@chromium.org</owner> <summary> @@ -129,7 +129,7 @@ </histogram> <histogram name="AccountManager.NumAccounts" units="count" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>sinhak@chromium.org</owner> <summary> Tracks the number of accounts stored in Chrome OS Account Manager by a given @@ -290,7 +290,7 @@ </summary> </histogram> -<histogram name="Ads.Media.Duration" units="ms" expires_after="2021-01-24"> +<histogram name="Ads.Media.Duration" units="ms" expires_after="2021-03-28"> <owner>johnidel@chromium.org</owner> <owner>dalecurtis@chromium.org</owner> <summary> @@ -386,7 +386,7 @@ </histogram> <histogram name="AnimatedImage.NumOfFramesSkipped" units="count" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>khushalsagar@chromium.org</owner> <summary> If the frame rate for the image animation can not be reached, frames in the @@ -1555,7 +1555,7 @@ </histogram> <histogram name="Bookmarks.OpenBookmarkType" enum="BookmarkType" - expires_after="2020-12-06"> + expires_after="2021-03-28"> <owner>wychen@chromium.org</owner> <summary> Logs whether the bookmark entry is a user bookmark or a partner bookmark @@ -2752,7 +2752,7 @@ </histogram> <histogram name="ContextMenu.TimeToTakeAction.Abandoned" units="ms" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>twellington@chromium.org</owner> <owner>chrome-android-app@chromium.org</owner> <summary> @@ -2765,7 +2765,7 @@ </histogram> <histogram name="ContextMenu.TimeToTakeAction.SelectedItem" units="ms" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>twellington@chromium.org</owner> <owner>chrome-android-app@chromium.org</owner> <summary> @@ -5260,7 +5260,7 @@ </histogram> <histogram name="GestureNavigation.Activated" enum="GestureNavigationDirection" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>jinsukkim@chromium.org</owner> <owner>chrome-android-app@chromium.org</owner> <summary> @@ -5272,7 +5272,7 @@ </histogram> <histogram name="GestureNavigation.Cancelled" enum="GestureNavigationDirection" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>jinsukkim@chromium.org</owner> <owner>chrome-android-app@chromium.org</owner> <summary> @@ -5283,7 +5283,7 @@ </histogram> <histogram name="GestureNavigation.Completed" enum="GestureNavigationDirection" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>jinsukkim@chromium.org</owner> <owner>chrome-android-app@chromium.org</owner> <summary> @@ -5293,7 +5293,7 @@ </histogram> <histogram name="GestureNavigation.Reversed" enum="GestureNavigationDirection" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>jinsukkim@chromium.org</owner> <owner>chrome-android-app@chromium.org</owner> <summary> @@ -5638,7 +5638,7 @@ </histogram> <histogram name="Graphics.Smoothness.PercentMissedDeadlineFrames.AllSequences" - units="%" expires_after="2020-12-31"> + units="%" expires_after="2021-03-28"> <owner>sadrul@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> <summary> @@ -6498,6 +6498,56 @@ </summary> </histogram> +<histogram name="InProductHelp.Promos.Snooze" units="SnoozeType" + expires_after="M88"> +<!-- Name completed by histogram_suffixes name="IPHFeatures" --> + + <owner>kerenzhu@chromium.org</owner> + <owner>collinbaker@chromium.org</owner> + <summary> + Record the number of first-time snoozes and repeating snoozes of an + in-product help bubble when the user clicks the snooze button. An snooze of + an IPH that has been snoozed before is a repeating snooze. + </summary> +</histogram> + +<histogram name="InProductHelp.Promos.SnoozeCountAtAcknowledge" units="times" + expires_after="M88"> +<!-- Name completed by histogram_suffixes name="IPHFeatures" --> + + <owner>kerenzhu@chromium.org</owner> + <owner>collinbaker@chromium.org</owner> + <summary> + Record the number of previous snoozes when an in-product help bubble is + dismissed because the acknowledge button is clicked. + </summary> +</histogram> + +<histogram name="InProductHelp.Promos.SnoozeCountAtFollow" units="times" + expires_after="M88"> +<!-- Name completed by histogram_suffixes name="IPHFeatures" --> + + <owner>kerenzhu@chromium.org</owner> + <owner>collinbaker@chromium.org</owner> + <summary> + Record the number of previous snoozes when an in-product help bubble is + dismissed because the user follows the promo, e.g. a relevant control is + clicked. + </summary> +</histogram> + +<histogram name="InProductHelp.Promos.SnoozeCountAtTrigger" units="times" + expires_after="M88"> +<!-- Name completed by histogram_suffixes name="IPHFeatures" --> + + <owner>kerenzhu@chromium.org</owner> + <owner>collinbaker@chromium.org</owner> + <summary> + Record the number of previous snoozes when an in-product help bubble is + triggered. + </summary> +</histogram> + <histogram name="InProductHelp.ShouldTriggerHelpUI" enum="TriggerHelpUIResult" expires_after="M85"> <owner>nyquist@chromium.org</owner> @@ -6757,9 +6807,10 @@ </histogram> <histogram base="true" name="JSDialogs.OriginRelationship" - enum="DialogOriginRelationship" expires_after="2020-11-01"> + enum="DialogOriginRelationship" expires_after="2021-06-01"> <owner>avi@chromium.org</owner> <owner>carlosil@chromium.org</owner> + <owner>ericmill@google.com</owner> <owner>meacer@chromium.org</owner> <summary> For dialogs, the relationship of the origins of the main frame vs the @@ -7836,7 +7887,7 @@ </histogram> <histogram name="MachineLearningService.MojoConnectionEvent" - enum="MachineLearningServiceMojoConnectionEvent" expires_after="2021-01-24"> + enum="MachineLearningServiceMojoConnectionEvent" expires_after="2021-03-28"> <owner>alanlxl@chromium.org</owner> <owner>amoylan@chromium.org</owner> <summary> @@ -9623,7 +9674,7 @@ </histogram> <histogram name="PerformanceHints.Observer.HintForURLResult" - enum="PerformanceHintsObserverHintForURLResult" expires_after="2021-01-24"> + enum="PerformanceHintsObserverHintForURLResult" expires_after="2021-03-28"> <owner>jds@chromium.org</owner> <owner>src/chrome/browser/performance_hints/OWNERS</owner> <summary> @@ -9646,7 +9697,7 @@ <histogram base="true" name="PerformanceHints.Observer.SourceLookupStatus" enum="PerformanceHintsObserverSourceLookupStatus" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>jds@chromium.org</owner> <owner>src/chrome/browser/performance_hints/OWNERS</owner> <summary> @@ -9940,7 +9991,7 @@ </histogram> <histogram name="PrefetchedSignedExchangeCache.BodySize" units="bytes" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>horo@chromium.org</owner> <owner>webpackage-dev@chromium.org</owner> <summary> @@ -9951,7 +10002,7 @@ </histogram> <histogram name="PrefetchedSignedExchangeCache.BodySizeTotal" units="bytes" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>horo@chromium.org</owner> <owner>webpackage-dev@chromium.org</owner> <summary> @@ -9963,7 +10014,7 @@ </histogram> <histogram name="PrefetchedSignedExchangeCache.Count" units="count" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>horo@chromium.org</owner> <owner>webpackage-dev@chromium.org</owner> <summary> @@ -10164,6 +10215,9 @@ </histogram> <histogram name="Previews.DataInflation" units="KB" expires_after="M85"> + <obsolete> + Not even logged by code. Obsolete in 09/2020. + </obsolete> <owner>ryansturm@chromium.org</owner> <summary> The estimated amount that the content was inflated for a page load using a @@ -10173,6 +10227,9 @@ </histogram> <histogram name="Previews.DataInflationPercent" units="%" expires_after="M85"> + <obsolete> + Not even logged by code. Obsolete in 09/2020. + </obsolete> <owner>ryansturm@chromium.org</owner> <summary> The estimated percent of data used that a page load would have otherwise @@ -10235,7 +10292,7 @@ </histogram> <histogram name="Previews.LitePageNotificationInfoBar" - enum="PreviewsLitePageInfoBarAction" expires_after="2020-12-25"> + enum="PreviewsLitePageInfoBarAction" expires_after="2021-03-28"> <owner>robertogden@chromium.org</owner> <owner>src/components/data_reduction_proxy/OWNERS</owner> <summary> @@ -10250,8 +10307,8 @@ </histogram> <histogram name="Previews.OptOut.UserOptedOut" enum="PreviewsUserOptedOut" - expires_after="2020-09-27"> - <owner>ryansturm@chromium.org</owner> + expires_after="2020-01-31"> + <owner>sophiechang@chromium.org</owner> <summary> Whether the user chose to reload the original page when shown a preview. </summary> @@ -12276,7 +12333,7 @@ </histogram> <histogram name="ScreenLocker.AuthenticationFailure" enum="UnlockType" - expires_after="2021-01-06"> + expires_after="2021-03-28"> <owner>antrim@chromium.org</owner> <owner>jessejames@chromium.org</owner> <owner>rsorokin@chromium.org</owner> @@ -12297,7 +12354,7 @@ </histogram> <histogram name="ScreenLocker.AuthenticationSuccess" enum="UnlockType" - expires_after="2021-01-06"> + expires_after="2021-03-28"> <owner>antrim@chromium.org</owner> <owner>jessejames@chromium.org</owner> <owner>rsorokin@chromium.org</owner> @@ -14896,7 +14953,7 @@ </histogram> <histogram name="Tracing.Background.FinalizingTraceSizeInKB" units="KB" - expires_after="2021-01-17"> + expires_after="2021-03-28"> <owner>oysteine@chromium.org</owner> <summary> The size, in kilobytes, of a finalized trace ready to be uploaded. @@ -15399,6 +15456,7 @@ <histogram name="Viewport.DidScalePage" enum="BooleanDidScalePage" expires_after="M90"> <owner>bokan@chromium.org</owner> + <owner>input-dev@chromium.org</owner> <summary> Tracks the proportion of non-mobile optimized (i.e. zoom disabled or layout width matches viewport) page views that had a user-initiated page scale @@ -15410,6 +15468,7 @@ <histogram name="Viewport.MaxPageScale" enum="PageScaleFactorRange" expires_after="M90"> <owner>bokan@chromium.org</owner> + <owner>input-dev@chromium.org</owner> <summary> Tracks the maximum scale factor that a user has scaled to over the lifetime of the page. The scale is counted at pinch end (e.g. zooming to 300% and @@ -15421,15 +15480,20 @@ </histogram> <histogram name="Viewport.MetaTagType" enum="MetaTagTypeEnum" - expires_after="M85"> + expires_after="M95"> <owner>bokan@chromium.org</owner> + <owner>input-dev@chromium.org</owner> <summary> The viewport meta tag type seen on each page load. Only recorded on Android. </summary> </histogram> <histogram name="Viewport.OverviewZoom" units="%" expires_after="M85"> + <obsolete> + Expired in M85. + </obsolete> <owner>bokan@chromium.org</owner> + <owner>input-dev@chromium.org</owner> <summary> The screen width as a percentage of viewport width (i.e. zoom at which we can see the whole page). Only recorded on Android and for viewport meta tags @@ -15554,7 +15618,7 @@ </histogram> <histogram name="VoiceInteraction.DismissedEventSource" - enum="VoiceInteractionEventSource" expires_after="2021-01-24"> + enum="VoiceInteractionEventSource" expires_after="2021-03-28"> <owner>wylieb@chromium.org</owner> <owner>tedchoc@chromium.org</owner> <owner>yusufo@chromium.org</owner> @@ -15574,7 +15638,7 @@ </histogram> <histogram name="VoiceInteraction.FinishEventSource" - enum="VoiceInteractionEventSource" expires_after="2021-01-24"> + enum="VoiceInteractionEventSource" expires_after="2021-03-28"> <owner>wylieb@chromium.org</owner> <owner>tedchoc@chromium.org</owner> <owner>yusufo@chromium.org</owner> @@ -15603,7 +15667,7 @@ </histogram> <histogram name="VoiceInteraction.StartEventSource" - enum="VoiceInteractionEventSource" expires_after="2021-01-24"> + enum="VoiceInteractionEventSource" expires_after="2021-03-28"> <owner>wylieb@chromium.org</owner> <owner>tedchoc@chromium.org</owner> <owner>yusufo@chromium.org</owner> @@ -15631,7 +15695,7 @@ </histogram> <histogram name="VoiceInteraction.VoiceResultConfidenceValue" units="%" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wylieb@chromium.org</owner> <owner>tedchoc@chromium.org</owner> <owner>yusufo@chromium.org</owner> @@ -15642,7 +15706,7 @@ </histogram> <histogram name="VoiceInteraction.VoiceSearchResult" enum="BooleanSuccess" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>wylieb@chromium.org</owner> <owner>tedchoc@chromium.org</owner> <owner>yusufo@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/page/histograms.xml b/tools/metrics/histograms/histograms_xml/page/histograms.xml index 2feab92c..b5693360 100644 --- a/tools/metrics/histograms/histograms_xml/page/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/page/histograms.xml
@@ -74,7 +74,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.AdDensity.MaxPercentByArea" units="%" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>justinmron@chromium.org</owner> <owner>johnidel@chromium.org</owner> <summary> @@ -87,7 +87,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.AdDensity.MaxPercentByHeight" units="%" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>justinmron@chromium.org</owner> <owner>johnidel@chromium.org</owner> <summary> @@ -100,7 +100,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.AdDensity.Recorded" units="Boolean" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>justinmron@chromium.org</owner> <owner>johnidel@chromium.org</owner> <summary> @@ -123,7 +123,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.AllPages.PercentNetworkBytesAds" - units="%" expires_after="2021-01-27"> + units="%" expires_after="2021-03-28"> <owner>alexmt@chromium.org</owner> <owner>johnidel@chromium.org</owner> <summary> @@ -136,7 +136,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.AllPages.PercentTotalBytesAds" units="%" - expires_after="2021-01-27"> + expires_after="2021-03-28"> <owner>alexmt@chromium.org</owner> <owner>johnidel@chromium.org</owner> <summary> @@ -165,7 +165,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.HeavyAds.DisallowedByBlocklist" - enum="BooleanBlocked" expires_after="2021-01-24"> + enum="BooleanBlocked" expires_after="2021-03-28"> <owner>johnidel@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <summary> @@ -176,7 +176,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.HeavyAds.FrameRemovedPriorToPageEnd" - enum="BooleanRemoved" expires_after="2021-01-24"> + enum="BooleanRemoved" expires_after="2021-03-28"> <owner>johnidel@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <summary> @@ -189,7 +189,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.HeavyAds.IgnoredByReload" - enum="BooleanIgnored" expires_after="2021-01-24"> + enum="BooleanIgnored" expires_after="2021-03-28"> <owner>johnidel@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <summary> @@ -215,7 +215,7 @@ </histogram> <histogram name="PageLoad.Clients.Ads.HeavyAds.UserDidReload" - enum="BooleanReloaded" expires_after="2021-01-24"> + enum="BooleanReloaded" expires_after="2021-03-28"> <owner>johnidel@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <summary> @@ -585,7 +585,7 @@ </histogram> <histogram name="PageLoad.Clients.ThirdParty.Origins.CookieRead2" units="Count" - expires_after="2021-01-22"> + expires_after="2021-03-28"> <owner>jkarlin@chromium.org</owner> <owner>yaoxia@chromium.org</owner> <summary> @@ -595,7 +595,7 @@ </histogram> <histogram name="PageLoad.Clients.ThirdParty.Origins.CookieWrite2" - units="Count" expires_after="2021-01-22"> + units="Count" expires_after="2021-03-28"> <owner>jkarlin@chromium.org</owner> <owner>yaoxia@chromium.org</owner> <summary> @@ -803,7 +803,7 @@ </histogram> <histogram name="PageLoad.Experimental.Bytes.Total2" units="KB" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>jkarlin@chromium.org</owner> <owner>johnidel@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/password/histograms.xml b/tools/metrics/histograms/histograms_xml/password/histograms.xml index e65cf0d6..bc762e9 100644 --- a/tools/metrics/histograms/histograms_xml/password/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/password/histograms.xml
@@ -120,7 +120,7 @@ </histogram> <histogram name="PasswordGeneration.UserDecision" - enum="PasswordGenerationUserEvent" expires_after="2021-01-24"> + enum="PasswordGenerationUserEvent" expires_after="2021-03-28"> <owner>ioanap@chromium.org</owner> <owner>vasilii@chromium.org</owner> <summary> @@ -611,6 +611,37 @@ </summary> </histogram> +<histogram name="PasswordManager.AutomaticChange.AcceptanceWithAutoButton" + enum="PasswordCheckResolutionAction" expires_after="M90"> + <owner>kolos@chromium.org</owner> + <owner>battre@chromium.org</owner> + <summary> + Resolution action to fix a compromised credential when there is a + "Change password automatically" button. + </summary> +</histogram> + +<histogram name="PasswordManager.AutomaticChange.AcceptanceWithoutAutoButton" + enum="PasswordCheckResolutionAction" expires_after="M90"> + <owner>kolos@chromium.org</owner> + <owner>battre@chromium.org</owner> + <summary> + Resolution action to fix a compromised credential when there is no + "Change password automatically" button. + </summary> +</histogram> + +<histogram name="PasswordManager.AutomaticChange.ForSitesWithScripts" + enum="PasswordCheckResolutionAction" expires_after="M90"> + <owner>kolos@chromium.org</owner> + <owner>battre@chromium.org</owner> + <summary> + Resolution action to fix a compromised credential when there is a password + change script for the credential's domain. The metric is reported also if + the automated password change feature is disabled. + </summary> +</histogram> + <histogram name="PasswordManager.AutoSigninFirstRunDialog" enum="AutoSigninFirstRun" expires_after="2021-02-14"> <owner>vasilii@chromium.org</owner> @@ -808,7 +839,7 @@ </histogram> <histogram name="PasswordManager.CompromisedCredentials.CountLeaked" - units="credentials" expires_after="2021-01-24"> + units="credentials" expires_after="2021-03-28"> <owner>vasilii@chromium.org</owner> <owner>jdoerrie@chromium.org</owner> <summary> @@ -818,7 +849,7 @@ <histogram name="PasswordManager.CompromisedCredentials.CountLeakedAfterBulkCheck" - units="credentials" expires_after="2021-01-24"> + units="credentials" expires_after="2021-03-28"> <owner>vasilii@chromium.org</owner> <owner>jdoerrie@chromium.org</owner> <summary> @@ -828,7 +859,7 @@ </histogram> <histogram name="PasswordManager.CompromisedCredentials.CountPhished" - units="credentials" expires_after="2021-01-24"> + units="credentials" expires_after="2021-03-28"> <owner>vasilii@chromium.org</owner> <owner>jdoerrie@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/platform/histograms.xml b/tools/metrics/histograms/histograms_xml/platform/histograms.xml index cca72f5e..a6614076 100644 --- a/tools/metrics/histograms/histograms_xml/platform/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/platform/histograms.xml
@@ -286,9 +286,13 @@ </summary> </histogram> -<histogram name="Platform.DailyUseTime" units="seconds" expires_after="M85"> +<histogram name="Platform.DailyUseTime" units="seconds" expires_after="M90"> +<!-- TODO(mutexlox): See if this is still in use and find owners --> + <owner>semenzato@chromium.org</owner> <owner>bsimonnet@chromium.org</owner> + <owner>mutexlox@chromium.org</owner> + <owner>cros-telemetry@google.com</owner> <summary> Total use time (device ON and not asleep) in the previous day, or the most recent day the device was in use. Reported at most once a day. @@ -587,7 +591,7 @@ </summary> </histogram> -<histogram name="Platform.Memory.ARC" units="MiB" expires_after="2021-01-24"> +<histogram name="Platform.Memory.ARC" units="MiB" expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="ProcessMemoryType" --> <owner>sonnyrao@chromium.org</owner> @@ -598,7 +602,7 @@ </histogram> <histogram name="Platform.Memory.Browser" units="MiB" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="ProcessMemoryType" --> <owner>sonnyrao@chromium.org</owner> @@ -610,7 +614,7 @@ </histogram> <histogram name="Platform.Memory.Daemons" units="MiB" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="ProcessMemoryType" --> <owner>sonnyrao@chromium.org</owner> @@ -631,7 +635,7 @@ </histogram> <histogram name="Platform.Memory.Renderers" units="MiB" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="ProcessMemoryType" --> <owner>sonnyrao@chromium.org</owner> @@ -1151,7 +1155,7 @@ </histogram> <histogram name="Platform.TPM.DictionaryAttackCounter" units="units" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>cylai@chromium.org</owner> <owner>cros-hwsec-userland-eng+uma@chromium.org</owner> <summary> @@ -1161,7 +1165,7 @@ </histogram> <histogram name="Platform.TPM.DictionaryAttackResetStatus" - enum="CrosTPMDictionaryAttackResetStatusEnum" expires_after="2021-01-24"> + enum="CrosTPMDictionaryAttackResetStatusEnum" expires_after="2021-03-28"> <owner>cylai@chromium.org</owner> <owner>cros-hwsec-userland-eng+uma@chromium.org</owner> <summary> @@ -1240,9 +1244,14 @@ </histogram> <histogram name="Platform.UncleanShutdownsDaily" units="count per day" - expires_after="M85"> + expires_after="never"> +<!-- expires-never: Used to assess Chrome OS platform stability. --> + <owner>semenzato@chromium.org</owner> <owner>bsimonnet@chromium.org</owner> + <owner>iby@chromium.org</owner> + <owner>mutexlox@chromium.org</owner> + <owner>cros-telemetry@google.com</owner> <summary> Count of crashes (unclean shutdown) during the previous day, or the most recent day the device was in use. Reported at most once a day. @@ -1250,9 +1259,14 @@ </histogram> <histogram name="Platform.UserCrashesDaily" units="count per day" - expires_after="M85"> + expires_after="never"> +<!-- expires-never: Used to assess Chrome OS platform stability. --> + <owner>semenzato@chromium.org</owner> <owner>bsimonnet@chromium.org</owner> + <owner>iby@chromium.org</owner> + <owner>mutexlox@chromium.org</owner> + <owner>cros-telemetry@google.com</owner> <summary> Count of crashes (user) during the previous day, or the most recent day the device was in use. Reported at most once a day.
diff --git a/tools/metrics/histograms/histograms_xml/power/histograms.xml b/tools/metrics/histograms/histograms_xml/power/histograms.xml index f3ffd78d..d0a10e2c 100644 --- a/tools/metrics/histograms/histograms_xml/power/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/power/histograms.xml
@@ -357,7 +357,7 @@ </histogram> <histogram name="Power.ExternalDisplayOpenResult" - enum="ExternalDisplayOpenResult" expires_after="2021-01-24"> + enum="ExternalDisplayOpenResult" expires_after="2021-03-28"> <owner>tbroch@chromium.org</owner> <summary> The result of attempting to open an I2C device to control an external @@ -708,9 +708,25 @@ <histogram name="Power.Mac.IsOnBattery" enum="BooleanOnBattery" expires_after="2021-02-21"> + <obsolete> + Replaced with Power.Mac.IsOnBattery2 09/2020 as it was broken. + </obsolete> <owner>lgrey@chromium.org</owner> <summary> Whether the user's machine is on battery power. Sampled once per minute. + Warning: This incorrectly logs desktop Macs as being on battery power. + Replaced by Power.Mac.IsOnBattery2. + </summary> +</histogram> + +<histogram name="Power.Mac.IsOnBattery2" enum="BooleanOnBattery" + expires_after="2021-02-21"> + <owner>avi@chromium.org</owner> + <owner>lgrey@chromium.org</owner> + <summary> + Whether the user's machine is on battery power. Sampled once per minute. + Unlike Power.Mac.IsOnBattery, this correctly logs desktop Macs as not being + on battery. </summary> </histogram>
diff --git a/tools/metrics/histograms/histograms_xml/printing/histograms.xml b/tools/metrics/histograms/histograms_xml/printing/histograms.xml index 9a5f84e..ba9b1b2 100644 --- a/tools/metrics/histograms/histograms_xml/printing/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/printing/histograms.xml
@@ -101,7 +101,7 @@ </histogram> <histogram name="Printing.CUPS.HighestIppVersion" enum="IppVersion" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>skau@chromium.org</owner> <owner>pawliczek@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/renderer/histograms.xml b/tools/metrics/histograms/histograms_xml/renderer/histograms.xml index 05fdb33..63e579f0 100644 --- a/tools/metrics/histograms/histograms_xml/renderer/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/renderer/histograms.xml
@@ -69,7 +69,7 @@ </histogram> <histogram name="Renderer.PaintPreview.Capture.MainFrameBlinkCaptureDuration" - units="ms" expires_after="2021-01-24"> + units="ms" expires_after="2021-03-28"> <owner>ckitagawa@chromium.org</owner> <owner>mahmoudi@chromium.org</owner> <owner>fredmello@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/renderer4/histograms.xml b/tools/metrics/histograms/histograms_xml/renderer4/histograms.xml index 742b3c7..fdd9451 100644 --- a/tools/metrics/histograms/histograms_xml/renderer4/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/renderer4/histograms.xml
@@ -152,7 +152,7 @@ </histogram> <histogram base="true" name="Renderer4.ImageUploadTaskDurationUs" - units="microseconds" expires_after="2021-01-24"> + units="microseconds" expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="DecodedImageType" --> <owner>sashamcintosh@chromium.org</owner> @@ -262,7 +262,7 @@ </histogram> <histogram name="Renderer4.ScrollingThread" enum="ScrollingThreadStatus" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="ScrollSourceDevice" --> <owner>bokan@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml b/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml index e589dfb..441214f 100644 --- a/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml
@@ -191,6 +191,9 @@ <histogram name="SBClientMalware.IPBlacklistRequestNetError" enum="NetErrorCodes" expires_after="M85"> + <obsolete> + Removed in 09-2020 since the SBClientMalware feature was removed. + </obsolete> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -200,6 +203,9 @@ <histogram name="SBClientMalware.IPBlacklistRequestPayloadSize" units="bytes" expires_after="M85"> + <obsolete> + Removed in 09-2020 since the SBClientMalware feature was removed. + </obsolete> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -209,6 +215,9 @@ <histogram name="SBClientMalware.IPBlacklistRequestResponseCode" enum="HttpResponseCode" expires_after="M85"> + <obsolete> + Removed in 09-2020 since the SBClientMalware feature was removed. + </obsolete> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -219,6 +228,9 @@ <histogram name="SBClientMalware.SentReports" enum="SBClientMalwareSentReports" expires_after="M85"> + <obsolete> + Removed in 09-2020 since the SBClientMalware feature was removed. + </obsolete> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -230,6 +242,9 @@ <histogram name="SBClientMalware.ServerDeterminesMalware" enum="BooleanIsMalware" expires_after="M85"> + <obsolete> + Removed in 09-2020 since the SBClientMalware feature was removed. + </obsolete> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary>The counts for malware verdicts given by server side model.</summary> @@ -259,7 +274,7 @@ </histogram> <histogram name="SBClientPhishing.Classifier.Event" - enum="SBPhishingClassifierEvent" expires_after="2021-01-24"> + enum="SBPhishingClassifierEvent" expires_after="2021-03-28"> <owner>bdea@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -281,8 +296,9 @@ </histogram> <histogram name="SBClientPhishing.ClientModelDownloadResponseOrErrorCode" - enum="CombinedHttpResponseAndNetErrorCode" expires_after="M85"> - <owner>vakh@google.com</owner> + enum="CombinedHttpResponseAndNetErrorCode" expires_after="M90"> + <owner>drubery@google.com</owner> + <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> Response or error codes from the SafeBrowsing service. Logged after a request for the client side model finishes to capture the response code or @@ -291,7 +307,7 @@ </histogram> <histogram name="SBClientPhishing.ClientModelStatus" - enum="SBClientPhishingClientModelStatus" expires_after="2021-01-24"> + enum="SBClientPhishingClientModelStatus" expires_after="2021-03-28"> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -319,8 +335,9 @@ </histogram> <histogram name="SBClientPhishing.DOMFeatureFrameRemoved" units="units" - expires_after="M85"> - <owner>gab@chromium.org</owner> + expires_after="M90"> + <owner>drubery@chromium.org</owner> + <owner>chrome-safebrowsing-alerts@chromium.org</owner> <summary> The number of times that DOM feature extraction finished early because the active WebDocument's frame was removed during traversal. @@ -347,8 +364,9 @@ </histogram> <histogram name="SBClientPhishing.DOMFeatureTimeout" units="units" - expires_after="M85"> - <owner>gab@chromium.org</owner> + expires_after="M90"> + <owner>drubery@chromium.org</owner> + <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> The number of phishing classifications that were aborted because DOM feature extraction took too long. @@ -365,8 +383,8 @@ </histogram> <histogram name="SBClientPhishing.IllegalFeatureValue" units="units" - expires_after="M85"> - <owner>vakh@chromium.org</owner> + expires_after="M90"> + <owner>drubery@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> The number of features which were omitted from phishing classification @@ -434,8 +452,8 @@ </histogram> <histogram name="SBClientPhishing.RequestNotSerialized" units="units" - expires_after="M85"> - <owner>vakh@chromium.org</owner> + expires_after="M90"> + <owner>drubery@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> The number of phishing classifier pingbacks that were skipped because @@ -444,8 +462,8 @@ </histogram> <histogram name="SBClientPhishing.RequestSatisfiedFromCache" enum="BooleanHit" - expires_after="M85"> - <owner>vakh@chromium.org</owner> + expires_after="M90"> + <owner>drubery@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> The number of times that a cached phishing classification result was used, @@ -454,8 +472,8 @@ </histogram> <histogram name="SBClientPhishing.ScorerCreationStatus" - enum="SBClientPhishingScorerCreationStatus" expires_after="M85"> - <owner>vakh@chromium.org</owner> + enum="SBClientPhishingScorerCreationStatus" expires_after="M90"> + <owner>drubery@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> Records the status when we create a scorer object for the client-side @@ -475,8 +493,8 @@ </histogram> <histogram name="SBClientPhishing.TermFeatureBreakIterError" units="units" - expires_after="M85"> - <owner>vakh@chromium.org</owner> + expires_after="M90"> + <owner>drubery@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> The number of phishing classifications that were aborted because the term @@ -553,7 +571,7 @@ </histogram> <histogram name="SBClientPhishing.VisualFeatureTime" units="ms" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>drubery@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/security/histograms.xml b/tools/metrics/histograms/histograms_xml/security/histograms.xml index 42a0957..e293aac 100644 --- a/tools/metrics/histograms/histograms_xml/security/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/security/histograms.xml
@@ -226,7 +226,7 @@ </histogram> <histogram name="Security.SafetyTips.DownloadStarted" enum="SafetyTipStatus" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <summary> @@ -239,7 +239,7 @@ </histogram> <histogram name="Security.SafetyTips.FormSubmission" enum="SafetyTipStatus" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <summary> @@ -252,7 +252,7 @@ </histogram> <histogram name="Security.SafetyTips.Interaction" enum="SafetyTipInteraction" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <summary> @@ -264,7 +264,7 @@ </histogram> <histogram name="Security.SafetyTips.OpenTime.Dismiss" units="ms" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <summary> @@ -275,7 +275,7 @@ </histogram> <histogram name="Security.SafetyTips.OpenTime.DismissWithClose" units="ms" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <owner>livvielin@chromium.org</owner> @@ -287,7 +287,7 @@ </histogram> <histogram name="Security.SafetyTips.OpenTime.DismissWithEsc" units="ms" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <owner>livvielin@chromium.org</owner> @@ -299,7 +299,7 @@ </histogram> <histogram name="Security.SafetyTips.OpenTime.DismissWithIgnore" units="ms" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <owner>livvielin@chromium.org</owner> @@ -311,7 +311,7 @@ </histogram> <histogram name="Security.SafetyTips.OpenTime.LeaveSite" units="ms" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <summary> @@ -321,7 +321,7 @@ </histogram> <histogram name="Security.SafetyTips.OpenTime.NoActionTaken" units="ms" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>estark@chromium.org</owner> <summary> @@ -331,7 +331,7 @@ </histogram> <histogram name="Security.SafetyTips.PageInfo.Action" - enum="WebsiteSettingsAction" expires_after="M87"> + enum="WebsiteSettingsAction" expires_after="M90"> <owner>estark@chromium.org</owner> <owner>jdeblasio@chromium.org</owner> <summary> @@ -341,7 +341,7 @@ </histogram> <histogram base="true" name="Security.SafetyTips.ReputationCheckComplete" - enum="SafetyTipStatus" expires_after="M87"> + enum="SafetyTipStatus" expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>src/chrome/browser/reputation/OWNERS</owner> <summary> @@ -352,7 +352,7 @@ </histogram> <histogram name="Security.SafetyTips.SafetyTipIgnoredPageLoad" - enum="SafetyTipStatus" expires_after="M87"> + enum="SafetyTipStatus" expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>livvielin@chromium.org</owner> <summary> @@ -362,7 +362,7 @@ </histogram> <histogram name="Security.SafetyTips.SafetyTipShown" enum="SafetyTipStatus" - expires_after="M87"> + expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>livvielin@chromium.org</owner> <summary> @@ -372,7 +372,7 @@ </histogram> <histogram base="true" name="Security.SafetyTips.SafetyTipShown_AfterFlag" - enum="SafetyTipStatus" expires_after="M87"> + enum="SafetyTipStatus" expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>src/chrome/browser/reputation/OWNERS</owner> <summary> @@ -384,7 +384,7 @@ </histogram> <histogram name="Security.SafetyTips.StatusWithInitiator.{SafetyTipInitiator}" - enum="SafetyTipStatus" expires_after="M87"> + enum="SafetyTipStatus" expires_after="M90"> <owner>jdeblasio@chromium.org</owner> <owner>meacer@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/service/histograms.xml b/tools/metrics/histograms/histograms_xml/service/histograms.xml index 336ee7f..799de5b 100644 --- a/tools/metrics/histograms/histograms_xml/service/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/service/histograms.xml
@@ -1144,7 +1144,7 @@ </histogram> <histogram name="ServiceWorkerCache.Cache.Browser.Match.RelatedFetchEvent" - units="ms" expires_after="2021-01-24"> + units="ms" expires_after="2021-03-28"> <owner>wanderview@chromium.org</owner> <owner>chrome-owp-storage@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/signin/histograms.xml b/tools/metrics/histograms/histograms_xml/signin/histograms.xml index d2ea7fd..c1c0efbc 100644 --- a/tools/metrics/histograms/histograms_xml/signin/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/signin/histograms.xml
@@ -115,7 +115,7 @@ </histogram> <histogram name="Signin.AndroidGetAccountIdsTime" units="ms" - expires_after="M85"> + expires_after="M89"> <owner>alexilin@chromium.org</owner> <owner>bsazonov@chromium.org</owner> <summary> @@ -123,7 +123,7 @@ </summary> </histogram> -<histogram name="Signin.AndroidGetAccountsTime" units="ms" expires_after="M85"> +<histogram name="Signin.AndroidGetAccountsTime" units="ms" expires_after="M89"> <owner>alexilin@chromium.org</owner> <owner>bsazonov@chromium.org</owner> <summary> @@ -132,7 +132,7 @@ </histogram> <histogram name="Signin.AndroidGetAccountsTimeUiThread" units="ms" - expires_after="M85"> + expires_after="M89"> <owner>alexilin@chromium.org</owner> <owner>bsazonov@chromium.org</owner> <summary> @@ -264,7 +264,7 @@ </histogram> <histogram name="Signin.Extensions.GaiaRemoteConsentFlowResult" - enum="GaiaRemoteConsentFlowResult" expires_after="2021-01-24"> + enum="GaiaRemoteConsentFlowResult" expires_after="2021-03-28"> <owner>alexilin@chromium.org</owner> <owner>droger@chromium.org</owner> <summary> @@ -274,7 +274,7 @@ </histogram> <histogram name="Signin.Extensions.GetAuthTokenResult" - enum="GetAuthTokenResult" expires_after="2021-01-24"> + enum="GetAuthTokenResult" expires_after="2021-03-28"> <!-- Name completed by histogram_suffixes name="GetAuthTokenType" --> <owner>alexilin@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/stability/histograms.xml b/tools/metrics/histograms/histograms_xml/stability/histograms.xml index 9431c26..f55f1fe 100644 --- a/tools/metrics/histograms/histograms_xml/stability/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/stability/histograms.xml
@@ -333,7 +333,7 @@ </histogram> <histogram name="Stability.iOS.UTE.BatteryCharge" units="%" - expires_after="2020-12-01"> + expires_after="2021-03-28"> <owner>michaeldo@chromium.org</owner> <owner>olivierrobin@chromium.org</owner> <summary> @@ -367,7 +367,7 @@ </histogram> <histogram name="Stability.iOS.UTE.LowPowerModeEnabled" enum="BooleanEnabled" - expires_after="2020-12-01"> + expires_after="2021-03-28"> <owner>michaeldo@chromium.org</owner> <owner>olivierrobin@chromium.org</owner> <summary> @@ -377,7 +377,7 @@ </histogram> <histogram name="Stability.iOS.UTE.MobileSessionAppState" enum="IOSAppState" - expires_after="2020-12-01"> + expires_after="2021-03-28"> <owner>eugenebut@chromium.org</owner> <owner>olivierrobin@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/tab/histograms.xml b/tools/metrics/histograms/histograms_xml/tab/histograms.xml index e2aee72..5c4cd27 100644 --- a/tools/metrics/histograms/histograms_xml/tab/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/tab/histograms.xml
@@ -1817,6 +1817,19 @@ </summary> </histogram> +<histogram name="Tabs.TabSearch.WebUI.TabListDataReceived" units="ms" + expires_after="M90"> + <owner>tluk@chromium.org</owner> + <owner>robliao@chromium.org</owner> + <owner>yuhengh@chromium.org</owner> + <summary> + The time taken for the WebUI in the renderer to receive the full list of + tabs for the current user profile. This is measured as the time from when + the data was first requested by the WebUI to when the data was received by + the WebUI. + </summary> +</histogram> + <histogram name="Tabs.TabSearch.WebUI.TabSwitchAction" enum="TabSearchTabSwitchAction" expires_after="M90"> <owner>tluk@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/ukm/histograms.xml b/tools/metrics/histograms/histograms_xml/ukm/histograms.xml index 57b9876..925785c 100644 --- a/tools/metrics/histograms/histograms_xml/ukm/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ukm/histograms.xml
@@ -140,6 +140,9 @@ <summary> Size in kilobytes (after compression) of an uploaded UKM log. Recorded after a successful UKM upload. + + Note: A related metric (UKM.ProtoCompressionRatio) logs the compression + ratio. </summary> </histogram> @@ -182,6 +185,17 @@ <summary>The status when loading UKM PersistedLogs from Prefs.</summary> </histogram> +<histogram name="UKM.ProtoCompressionRatio" units="%" + expires_after="2021-02-07"> + <owner>rkaplow@chromium.org</owner> + <owner>src/base/metrics/OWNERS</owner> + <summary> + Compression ratio of the serialized protobuf that will be uploaded to the + UKM server. This serialized protobuf is compressed using gzip. See also + UKM.LogSize.OnSuccess. + </summary> +</histogram> + <histogram name="UKM.ResetReason" enum="UkmResetReason" expires_after="2021-07-01"> <owner>rkaplow@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/uma/histograms.xml b/tools/metrics/histograms/histograms_xml/uma/histograms.xml index d678c5f3..0e8a31b 100644 --- a/tools/metrics/histograms/histograms_xml/uma/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/uma/histograms.xml
@@ -522,7 +522,7 @@ </histogram> <histogram name="UMA.TruncatedEvents.UserAction" units="events" - expires_after="2021-03-21"> + expires_after="2021-03-28"> <owner>rkaplow@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/variations/histograms.xml b/tools/metrics/histograms/histograms_xml/variations/histograms.xml index 16d796e..d1f3ce2 100644 --- a/tools/metrics/histograms/histograms_xml/variations/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/variations/histograms.xml
@@ -22,7 +22,7 @@ <histograms> <histogram name="Variations.AppSeedFreshness" units="minutes" - expires_after="2021-01-24"> + expires_after="2021-03-28"> <owner>rmcelrath@chromium.org</owner> <owner>ntfschr@chromium.org</owner> <owner>src/android_webview/OWNERS</owner>
diff --git a/tools/polymer/polymer.gni b/tools/polymer/polymer.gni index 61c7cdb..65f3434 100644 --- a/tools/polymer/polymer.gni +++ b/tools/polymer/polymer.gni
@@ -9,11 +9,11 @@ "third_party/polymer/v1_0/components-chromium/paper-behaviors/paper-ripple-behavior.html|PaperRippleBehavior", "ui/webui/resources/cr_elements/cr_scrollable_behavior.html|CrScrollableBehavior", "ui/webui/resources/cr_elements/cr_radio_button/cr_radio_button_behavior.html|CrRadioButtonBehavior", + "ui/webui/resources/cr_elements/find_shortcut_behavior.html|FindShortcutBehavior", "ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.html|CrPolicyPrefBehavior", "ui/webui/resources/html/cr/ui/focus_outline_manager.html|FocusOutlineManager", "ui/webui/resources/html/cr/ui/focus_row_behavior.html|FocusRowBehavior", "ui/webui/resources/html/cr/ui/focus_without_ink.html|focusWithoutInk", - "ui/webui/resources/html/find_shortcut_behavior.html|FindShortcutBehavior", "ui/webui/resources/html/i18n_behavior.html|I18nBehavior", "ui/webui/resources/html/list_property_update_behavior.html|ListPropertyUpdateBehavior", "ui/webui/resources/html/load_time_data.html|loadTimeData",
diff --git a/ui/accessibility/ax_tree.cc b/ui/accessibility/ax_tree.cc index 81ecc9c..28e1a7a5 100644 --- a/ui/accessibility/ax_tree.cc +++ b/ui/accessibility/ax_tree.cc
@@ -1033,7 +1033,7 @@ } if (!root_) { - error_ = "Tree has no root."; + RecordError("Tree has no root."); return false; } @@ -1304,8 +1304,8 @@ // is the new root and it can be created. if (!update_state->ShouldPendingNodeExistInTree(new_data.id)) { if (!is_new_root) { - error_ = base::StringPrintf( - "%d will not be in the tree and is not the new root", new_data.id); + RecordError(base::StringPrintf( + "%d will not be in the tree and is not the new root", new_data.id)); return false; } @@ -1313,9 +1313,9 @@ // pending for creation, then it must be a duplicate entry in the tree. if (!update_state->IncrementPendingCreateNodeCount(new_data.id, base::nullopt)) { - error_ = base::StringPrintf( + RecordError(base::StringPrintf( "Node %d is already pending for creation, cannot be the new root", - new_data.id); + new_data.id)); return false; } if (update_state->pending_root_id) { @@ -1329,8 +1329,8 @@ std::set<AXNode::AXID> new_child_id_set; for (AXNode::AXID new_child_id : new_data.child_ids) { if (base::Contains(new_child_id_set, new_child_id)) { - error_ = base::StringPrintf("Node %d has duplicate child id %d", - new_data.id, new_child_id); + RecordError(base::StringPrintf("Node %d has duplicate child id %d", + new_data.id, new_child_id)); return false; } new_child_id_set.insert(new_child_id); @@ -1352,9 +1352,9 @@ update_state->invalidate_unignored_cached_values_ids.insert(child_id); if (!update_state->IncrementPendingCreateNodeCount(child_id, new_data.id)) { - error_ = base::StringPrintf( + RecordError(base::StringPrintf( "Node %d is already pending for creation, cannot be a new child", - child_id); + child_id)); return false; } } @@ -1394,9 +1394,9 @@ // then adding it to a new parent would mean stealing the node from its // old parent which hadn't been updated to reflect the change. if (update_state->ShouldPendingNodeExistInTree(child_id)) { - error_ = base::StringPrintf( + RecordError(base::StringPrintf( "Node %d is not marked for destruction, would be reparented to %d", - child_id, new_data.id); + child_id, new_data.id)); return false; } @@ -1405,9 +1405,9 @@ update_state->invalidate_unignored_cached_values_ids.insert(child_id); if (!update_state->IncrementPendingCreateNodeCount(child_id, new_data.id)) { - error_ = base::StringPrintf( + RecordError(base::StringPrintf( "Node %d is already pending for creation, cannot be a new child", - child_id); + child_id)); return false; } } else { @@ -1444,8 +1444,8 @@ node->SetData(src); } else { if (!is_new_root) { - error_ = base::StringPrintf( - "%d is not in the tree and not the new root", src.id); + RecordError(base::StringPrintf( + "%d is not in the tree and not the new root", src.id)); return false; } @@ -1737,9 +1737,10 @@ bool AXTree::ValidatePendingChangesComplete( const AXTreeUpdateState& update_state) { if (!update_state.pending_nodes.empty()) { - error_ = "Nodes left pending by the update:"; + std::string error = "Nodes left pending by the update:"; for (const AXNode::AXID pending_id : update_state.pending_nodes) - error_ += base::StringPrintf(" %d", pending_id); + error += base::StringPrintf(" %d", pending_id); + RecordError(error); return false; } @@ -1763,11 +1764,11 @@ } } if (has_pending_changes) { - error_ = base::StringPrintf( + RecordError(base::StringPrintf( "Changes left pending by the update; " "destroy subtrees: %s, destroy nodes: %s, create nodes: %s", destroy_subtree_ids.c_str(), destroy_node_ids.c_str(), - create_node_ids.c_str()); + create_node_ids.c_str())); } return !has_pending_changes; } @@ -1871,11 +1872,9 @@ // This is a serious error - nodes should never be reparented. // If this case occurs, continue so this node isn't left in an // inconsistent state, but return failure at the end. - error_ = base::StringPrintf( - "Node %d reparented from %d to %d", - child->id(), - child->parent() ? child->parent()->id() : 0, - node->id()); + RecordError(base::StringPrintf( + "Node %d reparented from %d to %d", child->id(), + child->parent() ? child->parent()->id() : 0, node->id())); success = false; continue; } @@ -2432,4 +2431,10 @@ return has_pagination_support_; } +void AXTree::RecordError(std::string new_error) { + if (!error_.empty()) + error_ = error_ + "\n"; // Add visual separation between errors. + error_ = error_ + new_error; +} + } // namespace ui
diff --git a/ui/accessibility/ax_tree.h b/ui/accessibility/ax_tree.h index c47d1c2..ae4e4b2 100644 --- a/ui/accessibility/ax_tree.h +++ b/ui/accessibility/ax_tree.h
@@ -178,6 +178,10 @@ private: friend class AXTableInfoTest; + // Accumulate errors as there can be more than one before Chrome is crashed + // via AccessibilityFatalError(); + void RecordError(std::string new_error); + // AXNode::OwnerTree override. // // Given a node in this accessibility tree that corresponds to a table
diff --git a/ui/base/ime/chromeos/input_method_util.cc b/ui/base/ime/chromeos/input_method_util.cc index 6277435..49d02f43 100644 --- a/ui/base/ime/chromeos/input_method_util.cc +++ b/ui/base/ime/chromeos/input_method_util.cc
@@ -474,28 +474,6 @@ extension_ime_util::IsKeyboardLayoutExtension(input_method_id); } -std::string InputMethodUtil::GetKeyboardLayoutName( - const std::string& input_method_id) const { - auto iter = id_to_descriptor_.find(input_method_id); - return (iter == id_to_descriptor_.end()) ? - "" : iter->second.GetPreferredKeyboardLayout(); -} - -std::string InputMethodUtil::GetInputMethodDisplayNameFromId( - const std::string& input_method_id) const { - base::string16 display_name; - if (!extension_ime_util::IsExtensionIME(input_method_id) && - TranslateStringInternal(input_method_id, &display_name)) { - return base::UTF16ToUTF8(display_name); - } - const InputMethodDescriptor* descriptor = - GetInputMethodDescriptorFromId(input_method_id); - if (descriptor) - return GetLocalizedDisplayName(*descriptor); - // Return an empty string if the input method is not found. - return ""; -} - base::string16 InputMethodUtil::GetInputMethodShortName( const InputMethodDescriptor& input_method) const { // TODO(shuchen): remove this method, as the client can directly use @@ -806,7 +784,7 @@ } const InputMethodUtil::InputMethodIdToDescriptorMap& -InputMethodUtil::GetIdToDesciptorMapForTesting() { +InputMethodUtil::GetIdToDescriptorMapForTesting() { return id_to_descriptor_; }
diff --git a/ui/base/ime/chromeos/input_method_util.h b/ui/base/ime/chromeos/input_method_util.h index dbae206..f46e097e 100644 --- a/ui/base/ime/chromeos/input_method_util.h +++ b/ui/base/ime/chromeos/input_method_util.h
@@ -34,21 +34,6 @@ explicit InputMethodUtil(InputMethodDelegate* delegate); ~InputMethodUtil(); - // Converts a string sent from IBus IME engines, which is written in English, - // into Chrome's string ID, then pulls internationalized resource string from - // the resource bundle and returns it. These functions are not thread-safe. - // Non-UI threads are not allowed to call them. - // The english_string to should be a xkb id with "xkb:...:...:..." format. - // TODO(shuchen): this method should be removed when finish the wrapping of - // xkb to extension. - base::string16 TranslateString(const std::string& english_string) const; - - // Converts an input method ID to a language code of the IME. Returns "Eng" - // when |input_method_id| is unknown. - // Example: "hangul" => "ko" - std::string GetLanguageCodeFromInputMethodId( - const std::string& input_method_id) const; - // Converts an input method ID to a display name of the IME. Returns // an empty strng when |input_method_id| is unknown. // Examples: "pinyin" => "Pinyin" @@ -162,9 +147,6 @@ typedef std::map< std::string, InputMethodDescriptor> InputMethodIdToDescriptorMap; - // Gets the id to desctiptor map for testing. - const InputMethodIdToDescriptorMap& GetIdToDesciptorMapForTesting(); - // Returns the fallback input method descriptor (the very basic US // keyboard). This function is mostly used for testing, but may be used // as the fallback, when there is no other choice. @@ -178,19 +160,19 @@ InputMethodType type, std::vector<std::string>* out_input_method_ids) const; - // Gets the keyboard layout name from the given input method ID. - // If the ID is invalid, an empty string will be returned. - // This function only supports xkb layouts. - // - // Examples: - // - // "xkb:us::eng" => "us" - // "xkb:us:dvorak:eng" => "us(dvorak)" - // "xkb:gb::eng" => "gb" - // "pinyin" => "us" (because Pinyin uses US keyboard layout) - std::string GetKeyboardLayoutName(const std::string& input_method_id) const; + // Gets the id to descriptor map for testing. + const InputMethodIdToDescriptorMap& GetIdToDescriptorMapForTesting(); private: + // Converts a string sent from IBus IME engines, which is written in English, + // into Chrome's string ID, then pulls internationalized resource string from + // the resource bundle and returns it. These functions are not thread-safe. + // Non-UI threads are not allowed to call them. + // The english_string to should be a xkb id with "xkb:...:...:..." format. + // TODO(shuchen): this method should be removed when finish the wrapping of + // xkb to extension. + base::string16 TranslateString(const std::string& english_string) const; + bool TranslateStringInternal(const std::string& english_string, base::string16 *out_string) const;
diff --git a/ui/base/ime/chromeos/input_method_util_unittest.cc b/ui/base/ime/chromeos/input_method_util_unittest.cc index b51c1df..26a9b0e 100644 --- a/ui/base/ime/chromeos/input_method_util_unittest.cc +++ b/ui/base/ime/chromeos/input_method_util_unittest.cc
@@ -40,7 +40,7 @@ } // Change access rights. using InputMethodUtil::GetInputMethodIdsFromLanguageCodeInternal; - using InputMethodUtil::GetKeyboardLayoutName; + using InputMethodUtil::GetIdToDescriptorMapForTesting; }; } // namespace @@ -239,27 +239,6 @@ EXPECT_FALSE(InputMethodUtil::IsKeyboardLayout(Id(pinyin_ime_id))); } -TEST_F(InputMethodUtilTest, TestGetKeyboardLayoutName) { - // Unsupported case. - EXPECT_EQ("", util_.GetKeyboardLayoutName("UNSUPPORTED_ID")); - - // Supported cases (samples). - EXPECT_EQ("us", util_.GetKeyboardLayoutName(Id(pinyin_ime_id))); - EXPECT_EQ("es", util_.GetKeyboardLayoutName(Id("xkb:es::spa"))); - EXPECT_EQ("es(cat)", util_.GetKeyboardLayoutName(Id("xkb:es:cat:cat"))); - EXPECT_EQ("gb(extd)", util_.GetKeyboardLayoutName(Id("xkb:gb:extd:eng"))); - EXPECT_EQ("us", util_.GetKeyboardLayoutName(Id("xkb:us::eng"))); - EXPECT_EQ("us(dvorak)", util_.GetKeyboardLayoutName(Id("xkb:us:dvorak:eng"))); - EXPECT_EQ("us(colemak)", - util_.GetKeyboardLayoutName(Id("xkb:us:colemak:eng"))); - EXPECT_EQ("de(neo)", util_.GetKeyboardLayoutName(Id("xkb:de:neo:ger"))); -} - -TEST_F(InputMethodUtilTest, TestGetInputMethodDisplayNameFromId) { - EXPECT_EQ("US", util_.GetInputMethodDisplayNameFromId("xkb:us::eng")); - EXPECT_EQ("", util_.GetInputMethodDisplayNameFromId("nonexistent")); -} - TEST_F(InputMethodUtilTest, TestGetInputMethodDescriptorFromId) { EXPECT_EQ(nullptr, util_.GetInputMethodDescriptorFromId("non_existent")); @@ -429,7 +408,7 @@ // Test all supported descriptors to detect a typo in input_methods.txt. TEST_F(InputMethodUtilTest, TestIBusInputMethodText) { const std::map<std::string, InputMethodDescriptor>& id_to_descriptor = - util_.GetIdToDesciptorMapForTesting(); + util_.GetIdToDescriptorMapForTesting(); for (const auto& it : id_to_descriptor) { const std::string language_code = it.second.language_codes().at(0); const base::string16 display_name =
diff --git a/ui/chromeos/ui_chromeos_strings.grd b/ui/chromeos/ui_chromeos_strings.grd index 8834625..666c52c 100644 --- a/ui/chromeos/ui_chromeos_strings.grd +++ b/ui/chromeos/ui_chromeos_strings.grd
@@ -1134,7 +1134,7 @@ Transliteration (mausam → ਮੌਸਮ) </message> <message name="IDS_IME_NAME_TRANSLITERATION_SA" desc="The input method name shows in system tray menu and settings page."> - Sankrit + Sanskrit </message> <message name="IDS_IME_NAME_TRANSLITERATION_SR" desc="The input method name shows in system tray menu. Please translate only for 'transliteration'."> Transliteration (zdravo → здраво)
diff --git a/ui/chromeos/ui_chromeos_strings_grd/IDS_IME_NAME_TRANSLITERATION_SA.png.sha1 b/ui/chromeos/ui_chromeos_strings_grd/IDS_IME_NAME_TRANSLITERATION_SA.png.sha1 index 6898a37..4bc28d6e 100644 --- a/ui/chromeos/ui_chromeos_strings_grd/IDS_IME_NAME_TRANSLITERATION_SA.png.sha1 +++ b/ui/chromeos/ui_chromeos_strings_grd/IDS_IME_NAME_TRANSLITERATION_SA.png.sha1
@@ -1 +1 @@ -4c147e58b50d6d8fcd44ab8fcbb9082bc644c236 \ No newline at end of file +2ed58432c9d1e7762290d1389a7e8b3649df363c \ No newline at end of file
diff --git a/ui/file_manager/image_loader/piex/README.md b/ui/file_manager/image_loader/piex/README.md index 1802abf..a117315 100644 --- a/ui/file_manager/image_loader/piex/README.md +++ b/ui/file_manager/image_loader/piex/README.md
@@ -3,8 +3,8 @@ ```shell git clone https://github.com/emscripten-core/emsdk.git cd emsdk - ./emsdk install latest - ./emsdk activate latest + ./emsdk install 1.38.27 + ./emsdk activate 1.38.27 source ./emsdk_env.sh ``` @@ -30,7 +30,7 @@ Release: submit piex.js.wasm piex.out.wasm to the Chromium repository ```shell - git commit -a -m "Release piexwasm ..." + git commit -a -m "Release piexwasm at emscripten <version> ..." git cl upload ```
diff --git a/ui/file_manager/image_loader/piex_loader.js b/ui/file_manager/image_loader/piex_loader.js index aa815c5..afe6bd37 100644 --- a/ui/file_manager/image_loader/piex_loader.js +++ b/ui/file_manager/image_loader/piex_loader.js
@@ -114,10 +114,9 @@ * Returns the source data. * * If the source is an ArrayBuffer, return it. Otherwise assume the source is - * is DOM file system URL: resolve the associated file system entry, and read - * and return its content in an ArrayBuffer. + * is a File or DOM fileSystemURL and return its content in an ArrayBuffer. * - * @param {string|!ArrayBuffer} source + * @param {!ArrayBuffer|!File|string} source * @return {!Promise<!ArrayBuffer>} */ function readSourceData(source) { @@ -130,11 +129,11 @@ * Reject the Promise on fileEntry URL resolve or file read failures. */ function failure(error) { - reject(new Error('Reading file system: ' + error)); + reject(new Error('Reading file system: ' + (error.message || error))); } /** - * Returns true if the fileEntry file size is within sensible limits. + * Returns true if the file size is within sensible limits. * @param {number} size - file size. * @return {boolean} */ @@ -143,25 +142,39 @@ } /** - * Reads the fileEntry's content into an ArrayBuffer: resolve Promise - * with the ArrayBuffer result or reject the Promise on failure. - * @param {!Entry} entry - file system entry of |url|. + * Reads the file content to an ArrayBuffer. Resolve the Promise with + * the ArrayBuffer result, or reject the Promise on failure. + * @param {!File} file - file to read. + */ + function readFile(file) { + if (valid(file.size)) { + const reader = new FileReader(); + reader.onerror = failure; + reader.onload = (_) => resolve(reader.result); + reader.readAsArrayBuffer(file); + } else { + failure('invalid file size: ' + file.size); + } + } + + /** + * Resolve the fileEntry's file then read it with readFile, or reject + * the Promise on failure. + * @param {!Entry} entry - file system entry. */ function readEntry(entry) { const fileEntry = /** @type {!FileEntry} */ (entry); fileEntry.file((file) => { - if (valid(file.size)) { - const reader = new FileReader(); - reader.onerror = failure; - reader.onload = (_) => resolve(reader.result); - reader.readAsArrayBuffer(file); - } else { - failure('invalid file size: ' + file.size); - } + readFile(file); }, failure); } - const url = /** @type {string} */ (source); + if (source instanceof File) { + readFile(/** @type {!File} */ (source)); + return; + } + + const url = /** @type {string} fileSystemURL */ (source); globalThis.webkitResolveLocalFileSystemURL(url, readEntry, failure); }); } @@ -237,8 +250,8 @@ /** * Calls Module.image() to process |this.source| and return the result. * + * @throws {!Error} Memory allocation error. * @return {!PiexWasmImageResult} - * @throws {!Error} */ process() { this.memory = PiexModule._malloc(this.length); @@ -461,14 +474,17 @@ * Release resources. */ close() { - PiexModule._free(this.memory); + const memory = this.memory; + if (memory) { + PiexModule._free(memory); + this.memory = 0; + } } } /** * Creates a PiexLoader. * @constructor - * @struct */ function PiexLoader() {} @@ -481,7 +497,7 @@ * to reload the page. Callback |onPiexModuleFailed| is used to indicate that * the caller should initiate failure recovery steps. * - * @param {string|!ArrayBuffer} source + * @param {!ArrayBuffer|!File|string} source * @param {!function()} onPiexModuleFailed * @return {!Promise<!PiexLoaderResponse>} */
diff --git a/ui/file_manager/integration_tests/file_manager/search.js b/ui/file_manager/integration_tests/file_manager/search.js index 646016b..c03e90b 100644 --- a/ui/file_manager/integration_tests/file_manager/search.js +++ b/ui/file_manager/integration_tests/file_manager/search.js
@@ -244,4 +244,47 @@ } }); }; + + /** + * Tests that Files app performs a search at app start up when + * LaunchParam.searchQuery is specified. + */ + testcase.searchQueryLaunchParam = async () => { + addEntries(['local'], BASIC_LOCAL_ENTRY_SET); + addEntries(['drive'], BASIC_DRIVE_ENTRY_SET); + + // Open Files app with LaunchParam.searchQuery='gdoc'. + const query = 'gdoc'; + const appState = {searchQuery: query}; + const appId = + await remoteCall.callRemoteTestUtil('openMainWindow', null, [appState]); + + // Check: search box should be filled with the query. + const caller = getCaller(); + await repeatUntil(async () => { + const searchBoxInput = + await remoteCall.waitForElement(appId, '#search-box cr-input'); + if (searchBoxInput.value !== query) { + return pending( + caller, 'Waiting search box to be filled with the query.'); + } + }); + + // Check: "My Drive" directory should be selected because it is the sole + // directory that contains query-matched files (*.gdoc). + const selectedTreeRow = await remoteCall.waitForElement( + appId, '#directory-tree .tree-row[selected][active]'); + chrome.test.assertTrue(selectedTreeRow.text.includes('My Drive')); + + // Check: Query-matched files should be shown in the files list. + await repeatUntil(async () => { + const filenameLabel = + await remoteCall.waitForElement(appId, '#file-list .filename-label'); + if (!filenameLabel.text.includes(query)) { + // Pre-search results might be shown only for a moment before the search + // spinner is shown. + return pending(caller, 'Waiting files list to be updated.'); + } + }); + }; })();
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn index 769d5573..dae7f9d 100644 --- a/ui/gl/BUILD.gn +++ b/ui/gl/BUILD.gn
@@ -307,18 +307,10 @@ "direct_composition_surface_win.h", "gl_angle_util_win.cc", "gl_angle_util_win.h", - "gl_bindings_autogen_wgl.cc", - "gl_bindings_autogen_wgl.h", - "gl_context_wgl.cc", - "gl_context_wgl.h", "gl_image_d3d.cc", "gl_image_d3d.h", "gl_image_dxgi.cc", "gl_image_dxgi.h", - "gl_surface_wgl.cc", - "gl_surface_wgl.h", - "gl_wgl_api_implementation.cc", - "gl_wgl_api_implementation.h", "hdr_metadata_helper_win.cc", "hdr_metadata_helper_win.h", "swap_chain_presenter.cc", @@ -576,7 +568,6 @@ "gl_image_d3d_unittest.cc", "gl_image_dxgi_unittest.cc", "hdr_metadata_helper_win_unittest.cc", - "wgl_api_unittest.cc", ] }
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py index 9d0ee03..bfec8b6 100755 --- a/ui/gl/generate_bindings.py +++ b/ui/gl/generate_bindings.py
@@ -22,8 +22,6 @@ ] UNCONDITIONALLY_BOUND_EXTENSIONS = set([ - 'WGL_ARB_extensions_string', - 'WGL_EXT_extensions_string', 'GL_CHROMIUM_gles_depth_binding_hack', # crbug.com/448206 'GL_CHROMIUM_glgetstringi_hack', # crbug.com/470396 'GL_CHROMIUM_egl_khr_fence_sync_hack', # crbug.com/504758 @@ -2744,69 +2742,6 @@ 'arguments': 'EGLDisplay dpy, EGLSyncKHR sync, EGLint flags' }, ] -WGL_FUNCTIONS = [ -{ 'return_type': 'BOOL', - 'names': ['wglChoosePixelFormatARB'], - 'arguments': - 'HDC dc, const int* int_attrib_list, const float* float_attrib_list, ' - 'UINT max_formats, int* formats, UINT* num_formats', }, -{ 'return_type': 'BOOL', - 'names': ['wglCopyContext'], - 'arguments': 'HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask', }, -{ 'return_type': 'HGLRC', - 'names': ['wglCreateContext'], - 'arguments': 'HDC hdc', }, -{ 'return_type': 'HGLRC', - 'names': ['wglCreateContextAttribsARB'], - 'arguments': 'HDC hDC, HGLRC hShareContext, const int* attribList', }, -{ 'return_type': 'HGLRC', - 'names': ['wglCreateLayerContext'], - 'arguments': 'HDC hdc, int iLayerPlane', }, -{ 'return_type': 'HPBUFFERARB', - 'names': ['wglCreatePbufferARB'], - 'arguments': 'HDC hDC, int iPixelFormat, int iWidth, int iHeight, ' - 'const int* piAttribList', }, -{ 'return_type': 'BOOL', - 'names': ['wglDeleteContext'], - 'arguments': 'HGLRC hglrc', }, -{ 'return_type': 'BOOL', - 'names': ['wglDestroyPbufferARB'], - 'arguments': 'HPBUFFERARB hPbuffer', }, -{ 'return_type': 'HGLRC', - 'names': ['wglGetCurrentContext'], - 'arguments': '', }, -{ 'return_type': 'HDC', - 'names': ['wglGetCurrentDC'], - 'arguments': '', }, -{ 'return_type': 'const char*', - 'names': ['wglGetExtensionsStringARB'], - 'arguments': 'HDC hDC', }, -{ 'return_type': 'const char*', - 'names': ['wglGetExtensionsStringEXT'], - 'arguments': '', }, -{ 'return_type': 'HDC', - 'names': ['wglGetPbufferDCARB'], - 'arguments': 'HPBUFFERARB hPbuffer', }, -{ 'return_type': 'BOOL', - 'names': ['wglMakeCurrent'], - 'arguments': 'HDC hdc, HGLRC hglrc', }, -{ 'return_type': 'BOOL', - 'names': ['wglQueryPbufferARB'], - 'arguments': 'HPBUFFERARB hPbuffer, int iAttribute, int* piValue', }, -{ 'return_type': 'int', - 'names': ['wglReleasePbufferDCARB'], - 'arguments': 'HPBUFFERARB hPbuffer, HDC hDC', }, -{ 'return_type': 'BOOL', - 'names': ['wglShareLists'], - 'arguments': 'HGLRC hglrc1, HGLRC hglrc2', }, -{ 'return_type': 'BOOL', - 'names': ['wglSwapIntervalEXT'], - 'arguments': 'int interval', }, -{ 'return_type': 'BOOL', - 'names': ['wglSwapLayerBuffers'], - 'arguments': 'HDC hdc, UINT fuPlanes', }, -] - GLX_FUNCTIONS = [ { 'return_type': 'void', 'names': ['glXBindTexImageEXT'], @@ -2999,7 +2934,6 @@ 'EGL_ANGLE_surface_d3d_texture_2d_share_handle', ], ], - [WGL_FUNCTIONS, 'wgl', ['noninclude/GL/wglext.h'], []], [GLX_FUNCTIONS, 'glx', ['GL/glx.h', 'noninclude/GL/glxext.h'], []], ] @@ -3800,7 +3734,7 @@ version_start = re.compile( r'#ifndef GL_(ES_|)VERSION((?:_[0-9])+)$') extension_start = re.compile( - r'#ifndef ((?:GL|EGL|WGL|GLX)_[A-Z]+_[a-zA-Z]\w+)') + r'#ifndef ((?:GL|EGL|GLX)_[A-Z]+_[a-zA-Z]\w+)') extension_function = re.compile(r'.+\s+([a-z]+\w+)\s*\(') typedef = re.compile(r'typedef .*') macro_start = re.compile(r'^#(if|ifdef|ifndef).*')
diff --git a/ui/gl/gl_bindings.cc b/ui/gl/gl_bindings.cc index a55dac8a..a68568fa 100644 --- a/ui/gl/gl_bindings.cc +++ b/ui/gl/gl_bindings.cc
@@ -14,26 +14,12 @@ #include "ui/gfx/x/x11_types.h" #endif -#if defined(OS_WIN) -#include "ui/gl/gl_surface_wgl.h" -#endif - #if defined(USE_EGL) #include "ui/gl/gl_surface_egl.h" #endif namespace gl { -#if defined(OS_WIN) -std::string DriverWGL::GetPlatformExtensions() { - const char* str = nullptr; - str = wglGetExtensionsStringARB(GLSurfaceWGL::GetDisplayDC()); - if (str) - return str; - return wglGetExtensionsStringEXT(); -} -#endif - #if defined(USE_EGL) std::string DriverEGL::GetPlatformExtensions() { EGLDisplay display = GLSurfaceEGL::GetHardwareDisplay();
diff --git a/ui/gl/gl_bindings.h b/ui/gl/gl_bindings.h index 3b985196..55c59e3 100644 --- a/ui/gl/gl_bindings.h +++ b/ui/gl/gl_bindings.h
@@ -504,10 +504,6 @@ #include "gl_bindings_autogen_egl.h" #endif -#if defined(OS_WIN) -#include "gl_bindings_autogen_wgl.h" -#endif - #if defined(USE_GLX) #include "gl_bindings_autogen_glx.h" #endif @@ -537,20 +533,6 @@ const GLVersionInfo* Version = nullptr; }; -#if defined(OS_WIN) -struct GL_EXPORT DriverWGL { - void InitializeStaticBindings(); - void InitializeExtensionBindings(); - void ClearBindings(); - - ProcsWGL fn; - ExtensionsWGL ext; - - private: - static std::string GetPlatformExtensions(); -}; -#endif - #if defined(USE_EGL) struct GL_EXPORT DriverEGL { void InitializeStaticBindings(); @@ -592,11 +574,6 @@ GL_EXPORT extern DriverEGL g_driver_egl; #endif -#if defined(OS_WIN) -GL_EXPORT extern WGLApi* g_current_wgl_context; -GL_EXPORT extern DriverWGL g_driver_wgl; -#endif - #if defined(USE_GLX) GL_EXPORT extern GLXApi* g_current_glx_context; GL_EXPORT extern DriverGLX g_driver_glx;
diff --git a/ui/gl/gl_bindings_autogen_wgl.cc b/ui/gl/gl_bindings_autogen_wgl.cc deleted file mode 100644 index d76f0f4..0000000 --- a/ui/gl/gl_bindings_autogen_wgl.cc +++ /dev/null
@@ -1,506 +0,0 @@ -// Copyright 2016 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. -// -// This file is auto-generated from -// ui/gl/generate_bindings.py -// It's formatted by clang-format using chromium coding style: -// clang-format -i -style=chromium filename -// DO NOT EDIT! - -#include <string> - -#include "base/trace_event/trace_event.h" -#include "ui/gl/gl_bindings.h" -#include "ui/gl/gl_context.h" -#include "ui/gl/gl_enums.h" -#include "ui/gl/gl_implementation.h" -#include "ui/gl/gl_version_info.h" -#include "ui/gl/gl_wgl_api_implementation.h" - -namespace gl { - -DriverWGL g_driver_wgl; // Exists in .bss - -void DriverWGL::InitializeStaticBindings() { - // Ensure struct has been zero-initialized. - char* this_bytes = reinterpret_cast<char*>(this); - DCHECK(this_bytes[0] == 0); - DCHECK(memcmp(this_bytes, this_bytes + 1, sizeof(*this) - 1) == 0); - - fn.wglCopyContextFn = - reinterpret_cast<wglCopyContextProc>(GetGLProcAddress("wglCopyContext")); - fn.wglCreateContextFn = reinterpret_cast<wglCreateContextProc>( - GetGLProcAddress("wglCreateContext")); - fn.wglCreateLayerContextFn = reinterpret_cast<wglCreateLayerContextProc>( - GetGLProcAddress("wglCreateLayerContext")); - fn.wglDeleteContextFn = reinterpret_cast<wglDeleteContextProc>( - GetGLProcAddress("wglDeleteContext")); - fn.wglGetCurrentContextFn = reinterpret_cast<wglGetCurrentContextProc>( - GetGLProcAddress("wglGetCurrentContext")); - fn.wglGetCurrentDCFn = reinterpret_cast<wglGetCurrentDCProc>( - GetGLProcAddress("wglGetCurrentDC")); - fn.wglGetExtensionsStringARBFn = - reinterpret_cast<wglGetExtensionsStringARBProc>( - GetGLProcAddress("wglGetExtensionsStringARB")); - fn.wglGetExtensionsStringEXTFn = - reinterpret_cast<wglGetExtensionsStringEXTProc>( - GetGLProcAddress("wglGetExtensionsStringEXT")); - fn.wglMakeCurrentFn = - reinterpret_cast<wglMakeCurrentProc>(GetGLProcAddress("wglMakeCurrent")); - fn.wglShareListsFn = - reinterpret_cast<wglShareListsProc>(GetGLProcAddress("wglShareLists")); - fn.wglSwapLayerBuffersFn = reinterpret_cast<wglSwapLayerBuffersProc>( - GetGLProcAddress("wglSwapLayerBuffers")); -} - -void DriverWGL::InitializeExtensionBindings() { - std::string platform_extensions(GetPlatformExtensions()); - gfx::ExtensionSet extensions(gfx::MakeExtensionSet(platform_extensions)); - ALLOW_UNUSED_LOCAL(extensions); - - ext.b_WGL_ARB_create_context = - gfx::HasExtension(extensions, "WGL_ARB_create_context"); - ext.b_WGL_ARB_extensions_string = - gfx::HasExtension(extensions, "WGL_ARB_extensions_string"); - ext.b_WGL_ARB_pbuffer = gfx::HasExtension(extensions, "WGL_ARB_pbuffer"); - ext.b_WGL_ARB_pixel_format = - gfx::HasExtension(extensions, "WGL_ARB_pixel_format"); - ext.b_WGL_EXT_extensions_string = - gfx::HasExtension(extensions, "WGL_EXT_extensions_string"); - ext.b_WGL_EXT_swap_control = - gfx::HasExtension(extensions, "WGL_EXT_swap_control"); - - if (ext.b_WGL_ARB_pixel_format) { - fn.wglChoosePixelFormatARBFn = - reinterpret_cast<wglChoosePixelFormatARBProc>( - GetGLProcAddress("wglChoosePixelFormatARB")); - } - - if (ext.b_WGL_ARB_create_context) { - fn.wglCreateContextAttribsARBFn = - reinterpret_cast<wglCreateContextAttribsARBProc>( - GetGLProcAddress("wglCreateContextAttribsARB")); - } - - if (ext.b_WGL_ARB_pbuffer) { - fn.wglCreatePbufferARBFn = reinterpret_cast<wglCreatePbufferARBProc>( - GetGLProcAddress("wglCreatePbufferARB")); - } - - if (ext.b_WGL_ARB_pbuffer) { - fn.wglDestroyPbufferARBFn = reinterpret_cast<wglDestroyPbufferARBProc>( - GetGLProcAddress("wglDestroyPbufferARB")); - } - - if (ext.b_WGL_ARB_pbuffer) { - fn.wglGetPbufferDCARBFn = reinterpret_cast<wglGetPbufferDCARBProc>( - GetGLProcAddress("wglGetPbufferDCARB")); - } - - if (ext.b_WGL_ARB_pbuffer) { - fn.wglQueryPbufferARBFn = reinterpret_cast<wglQueryPbufferARBProc>( - GetGLProcAddress("wglQueryPbufferARB")); - } - - if (ext.b_WGL_ARB_pbuffer) { - fn.wglReleasePbufferDCARBFn = reinterpret_cast<wglReleasePbufferDCARBProc>( - GetGLProcAddress("wglReleasePbufferDCARB")); - } - - if (ext.b_WGL_EXT_swap_control) { - fn.wglSwapIntervalEXTFn = reinterpret_cast<wglSwapIntervalEXTProc>( - GetGLProcAddress("wglSwapIntervalEXT")); - } -} - -void DriverWGL::ClearBindings() { - memset(this, 0, sizeof(*this)); -} - -BOOL WGLApiBase::wglChoosePixelFormatARBFn(HDC dc, - const int* int_attrib_list, - const float* float_attrib_list, - UINT max_formats, - int* formats, - UINT* num_formats) { - return driver_->fn.wglChoosePixelFormatARBFn(dc, int_attrib_list, - float_attrib_list, max_formats, - formats, num_formats); -} - -BOOL WGLApiBase::wglCopyContextFn(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) { - return driver_->fn.wglCopyContextFn(hglrcSrc, hglrcDst, mask); -} - -HGLRC WGLApiBase::wglCreateContextFn(HDC hdc) { - return driver_->fn.wglCreateContextFn(hdc); -} - -HGLRC WGLApiBase::wglCreateContextAttribsARBFn(HDC hDC, - HGLRC hShareContext, - const int* attribList) { - return driver_->fn.wglCreateContextAttribsARBFn(hDC, hShareContext, - attribList); -} - -HGLRC WGLApiBase::wglCreateLayerContextFn(HDC hdc, int iLayerPlane) { - return driver_->fn.wglCreateLayerContextFn(hdc, iLayerPlane); -} - -HPBUFFERARB WGLApiBase::wglCreatePbufferARBFn(HDC hDC, - int iPixelFormat, - int iWidth, - int iHeight, - const int* piAttribList) { - return driver_->fn.wglCreatePbufferARBFn(hDC, iPixelFormat, iWidth, iHeight, - piAttribList); -} - -BOOL WGLApiBase::wglDeleteContextFn(HGLRC hglrc) { - return driver_->fn.wglDeleteContextFn(hglrc); -} - -BOOL WGLApiBase::wglDestroyPbufferARBFn(HPBUFFERARB hPbuffer) { - return driver_->fn.wglDestroyPbufferARBFn(hPbuffer); -} - -HGLRC WGLApiBase::wglGetCurrentContextFn() { - return driver_->fn.wglGetCurrentContextFn(); -} - -HDC WGLApiBase::wglGetCurrentDCFn() { - return driver_->fn.wglGetCurrentDCFn(); -} - -const char* WGLApiBase::wglGetExtensionsStringARBFn(HDC hDC) { - return driver_->fn.wglGetExtensionsStringARBFn(hDC); -} - -const char* WGLApiBase::wglGetExtensionsStringEXTFn() { - return driver_->fn.wglGetExtensionsStringEXTFn(); -} - -HDC WGLApiBase::wglGetPbufferDCARBFn(HPBUFFERARB hPbuffer) { - return driver_->fn.wglGetPbufferDCARBFn(hPbuffer); -} - -BOOL WGLApiBase::wglMakeCurrentFn(HDC hdc, HGLRC hglrc) { - return driver_->fn.wglMakeCurrentFn(hdc, hglrc); -} - -BOOL WGLApiBase::wglQueryPbufferARBFn(HPBUFFERARB hPbuffer, - int iAttribute, - int* piValue) { - return driver_->fn.wglQueryPbufferARBFn(hPbuffer, iAttribute, piValue); -} - -int WGLApiBase::wglReleasePbufferDCARBFn(HPBUFFERARB hPbuffer, HDC hDC) { - return driver_->fn.wglReleasePbufferDCARBFn(hPbuffer, hDC); -} - -BOOL WGLApiBase::wglShareListsFn(HGLRC hglrc1, HGLRC hglrc2) { - return driver_->fn.wglShareListsFn(hglrc1, hglrc2); -} - -BOOL WGLApiBase::wglSwapIntervalEXTFn(int interval) { - return driver_->fn.wglSwapIntervalEXTFn(interval); -} - -BOOL WGLApiBase::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { - return driver_->fn.wglSwapLayerBuffersFn(hdc, fuPlanes); -} - -BOOL TraceWGLApi::wglChoosePixelFormatARBFn(HDC dc, - const int* int_attrib_list, - const float* float_attrib_list, - UINT max_formats, - int* formats, - UINT* num_formats) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglChoosePixelFormatARB") - return wgl_api_->wglChoosePixelFormatARBFn(dc, int_attrib_list, - float_attrib_list, max_formats, - formats, num_formats); -} - -BOOL TraceWGLApi::wglCopyContextFn(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglCopyContext") - return wgl_api_->wglCopyContextFn(hglrcSrc, hglrcDst, mask); -} - -HGLRC TraceWGLApi::wglCreateContextFn(HDC hdc) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglCreateContext") - return wgl_api_->wglCreateContextFn(hdc); -} - -HGLRC TraceWGLApi::wglCreateContextAttribsARBFn(HDC hDC, - HGLRC hShareContext, - const int* attribList) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", - "TraceWGLAPI::wglCreateContextAttribsARB") - return wgl_api_->wglCreateContextAttribsARBFn(hDC, hShareContext, attribList); -} - -HGLRC TraceWGLApi::wglCreateLayerContextFn(HDC hdc, int iLayerPlane) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglCreateLayerContext") - return wgl_api_->wglCreateLayerContextFn(hdc, iLayerPlane); -} - -HPBUFFERARB TraceWGLApi::wglCreatePbufferARBFn(HDC hDC, - int iPixelFormat, - int iWidth, - int iHeight, - const int* piAttribList) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglCreatePbufferARB") - return wgl_api_->wglCreatePbufferARBFn(hDC, iPixelFormat, iWidth, iHeight, - piAttribList); -} - -BOOL TraceWGLApi::wglDeleteContextFn(HGLRC hglrc) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglDeleteContext") - return wgl_api_->wglDeleteContextFn(hglrc); -} - -BOOL TraceWGLApi::wglDestroyPbufferARBFn(HPBUFFERARB hPbuffer) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglDestroyPbufferARB") - return wgl_api_->wglDestroyPbufferARBFn(hPbuffer); -} - -HGLRC TraceWGLApi::wglGetCurrentContextFn() { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglGetCurrentContext") - return wgl_api_->wglGetCurrentContextFn(); -} - -HDC TraceWGLApi::wglGetCurrentDCFn() { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglGetCurrentDC") - return wgl_api_->wglGetCurrentDCFn(); -} - -const char* TraceWGLApi::wglGetExtensionsStringARBFn(HDC hDC) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglGetExtensionsStringARB") - return wgl_api_->wglGetExtensionsStringARBFn(hDC); -} - -const char* TraceWGLApi::wglGetExtensionsStringEXTFn() { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglGetExtensionsStringEXT") - return wgl_api_->wglGetExtensionsStringEXTFn(); -} - -HDC TraceWGLApi::wglGetPbufferDCARBFn(HPBUFFERARB hPbuffer) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglGetPbufferDCARB") - return wgl_api_->wglGetPbufferDCARBFn(hPbuffer); -} - -BOOL TraceWGLApi::wglMakeCurrentFn(HDC hdc, HGLRC hglrc) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglMakeCurrent") - return wgl_api_->wglMakeCurrentFn(hdc, hglrc); -} - -BOOL TraceWGLApi::wglQueryPbufferARBFn(HPBUFFERARB hPbuffer, - int iAttribute, - int* piValue) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglQueryPbufferARB") - return wgl_api_->wglQueryPbufferARBFn(hPbuffer, iAttribute, piValue); -} - -int TraceWGLApi::wglReleasePbufferDCARBFn(HPBUFFERARB hPbuffer, HDC hDC) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglReleasePbufferDCARB") - return wgl_api_->wglReleasePbufferDCARBFn(hPbuffer, hDC); -} - -BOOL TraceWGLApi::wglShareListsFn(HGLRC hglrc1, HGLRC hglrc2) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglShareLists") - return wgl_api_->wglShareListsFn(hglrc1, hglrc2); -} - -BOOL TraceWGLApi::wglSwapIntervalEXTFn(int interval) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglSwapIntervalEXT") - return wgl_api_->wglSwapIntervalEXTFn(interval); -} - -BOOL TraceWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceWGLAPI::wglSwapLayerBuffers") - return wgl_api_->wglSwapLayerBuffersFn(hdc, fuPlanes); -} - -BOOL LogWGLApi::wglChoosePixelFormatARBFn(HDC dc, - const int* int_attrib_list, - const float* float_attrib_list, - UINT max_formats, - int* formats, - UINT* num_formats) { - GL_SERVICE_LOG("wglChoosePixelFormatARB" - << "(" << dc << ", " - << static_cast<const void*>(int_attrib_list) << ", " - << static_cast<const void*>(float_attrib_list) << ", " - << max_formats << ", " << static_cast<const void*>(formats) - << ", " << static_cast<const void*>(num_formats) << ")"); - BOOL result = wgl_api_->wglChoosePixelFormatARBFn( - dc, int_attrib_list, float_attrib_list, max_formats, formats, - num_formats); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -BOOL LogWGLApi::wglCopyContextFn(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) { - GL_SERVICE_LOG("wglCopyContext" - << "(" << hglrcSrc << ", " << hglrcDst << ", " << mask << ")"); - BOOL result = wgl_api_->wglCopyContextFn(hglrcSrc, hglrcDst, mask); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -HGLRC LogWGLApi::wglCreateContextFn(HDC hdc) { - GL_SERVICE_LOG("wglCreateContext" - << "(" << hdc << ")"); - HGLRC result = wgl_api_->wglCreateContextFn(hdc); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -HGLRC LogWGLApi::wglCreateContextAttribsARBFn(HDC hDC, - HGLRC hShareContext, - const int* attribList) { - GL_SERVICE_LOG("wglCreateContextAttribsARB" - << "(" << hDC << ", " << hShareContext << ", " - << static_cast<const void*>(attribList) << ")"); - HGLRC result = - wgl_api_->wglCreateContextAttribsARBFn(hDC, hShareContext, attribList); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -HGLRC LogWGLApi::wglCreateLayerContextFn(HDC hdc, int iLayerPlane) { - GL_SERVICE_LOG("wglCreateLayerContext" - << "(" << hdc << ", " << iLayerPlane << ")"); - HGLRC result = wgl_api_->wglCreateLayerContextFn(hdc, iLayerPlane); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -HPBUFFERARB LogWGLApi::wglCreatePbufferARBFn(HDC hDC, - int iPixelFormat, - int iWidth, - int iHeight, - const int* piAttribList) { - GL_SERVICE_LOG("wglCreatePbufferARB" - << "(" << hDC << ", " << iPixelFormat << ", " << iWidth << ", " - << iHeight << ", " << static_cast<const void*>(piAttribList) - << ")"); - HPBUFFERARB result = wgl_api_->wglCreatePbufferARBFn( - hDC, iPixelFormat, iWidth, iHeight, piAttribList); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -BOOL LogWGLApi::wglDeleteContextFn(HGLRC hglrc) { - GL_SERVICE_LOG("wglDeleteContext" - << "(" << hglrc << ")"); - BOOL result = wgl_api_->wglDeleteContextFn(hglrc); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -BOOL LogWGLApi::wglDestroyPbufferARBFn(HPBUFFERARB hPbuffer) { - GL_SERVICE_LOG("wglDestroyPbufferARB" - << "(" << hPbuffer << ")"); - BOOL result = wgl_api_->wglDestroyPbufferARBFn(hPbuffer); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -HGLRC LogWGLApi::wglGetCurrentContextFn() { - GL_SERVICE_LOG("wglGetCurrentContext" - << "(" - << ")"); - HGLRC result = wgl_api_->wglGetCurrentContextFn(); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -HDC LogWGLApi::wglGetCurrentDCFn() { - GL_SERVICE_LOG("wglGetCurrentDC" - << "(" - << ")"); - HDC result = wgl_api_->wglGetCurrentDCFn(); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -const char* LogWGLApi::wglGetExtensionsStringARBFn(HDC hDC) { - GL_SERVICE_LOG("wglGetExtensionsStringARB" - << "(" << hDC << ")"); - const char* result = wgl_api_->wglGetExtensionsStringARBFn(hDC); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -const char* LogWGLApi::wglGetExtensionsStringEXTFn() { - GL_SERVICE_LOG("wglGetExtensionsStringEXT" - << "(" - << ")"); - const char* result = wgl_api_->wglGetExtensionsStringEXTFn(); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -HDC LogWGLApi::wglGetPbufferDCARBFn(HPBUFFERARB hPbuffer) { - GL_SERVICE_LOG("wglGetPbufferDCARB" - << "(" << hPbuffer << ")"); - HDC result = wgl_api_->wglGetPbufferDCARBFn(hPbuffer); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -BOOL LogWGLApi::wglMakeCurrentFn(HDC hdc, HGLRC hglrc) { - GL_SERVICE_LOG("wglMakeCurrent" - << "(" << hdc << ", " << hglrc << ")"); - BOOL result = wgl_api_->wglMakeCurrentFn(hdc, hglrc); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -BOOL LogWGLApi::wglQueryPbufferARBFn(HPBUFFERARB hPbuffer, - int iAttribute, - int* piValue) { - GL_SERVICE_LOG("wglQueryPbufferARB" - << "(" << hPbuffer << ", " << iAttribute << ", " - << static_cast<const void*>(piValue) << ")"); - BOOL result = wgl_api_->wglQueryPbufferARBFn(hPbuffer, iAttribute, piValue); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -int LogWGLApi::wglReleasePbufferDCARBFn(HPBUFFERARB hPbuffer, HDC hDC) { - GL_SERVICE_LOG("wglReleasePbufferDCARB" - << "(" << hPbuffer << ", " << hDC << ")"); - int result = wgl_api_->wglReleasePbufferDCARBFn(hPbuffer, hDC); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -BOOL LogWGLApi::wglShareListsFn(HGLRC hglrc1, HGLRC hglrc2) { - GL_SERVICE_LOG("wglShareLists" - << "(" << hglrc1 << ", " << hglrc2 << ")"); - BOOL result = wgl_api_->wglShareListsFn(hglrc1, hglrc2); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -BOOL LogWGLApi::wglSwapIntervalEXTFn(int interval) { - GL_SERVICE_LOG("wglSwapIntervalEXT" - << "(" << interval << ")"); - BOOL result = wgl_api_->wglSwapIntervalEXTFn(interval); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -BOOL LogWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { - GL_SERVICE_LOG("wglSwapLayerBuffers" - << "(" << hdc << ", " << fuPlanes << ")"); - BOOL result = wgl_api_->wglSwapLayerBuffersFn(hdc, fuPlanes); - GL_SERVICE_LOG("GL_RESULT: " << result); - return result; -} - -} // namespace gl
diff --git a/ui/gl/gl_bindings_autogen_wgl.h b/ui/gl/gl_bindings_autogen_wgl.h deleted file mode 100644 index c6b787d..0000000 --- a/ui/gl/gl_bindings_autogen_wgl.h +++ /dev/null
@@ -1,160 +0,0 @@ -// Copyright 2016 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. -// -// This file is auto-generated from -// ui/gl/generate_bindings.py -// It's formatted by clang-format using chromium coding style: -// clang-format -i -style=chromium filename -// DO NOT EDIT! - -#ifndef UI_GL_GL_BINDINGS_AUTOGEN_WGL_H_ -#define UI_GL_GL_BINDINGS_AUTOGEN_WGL_H_ - -#include <string> - -namespace gl { - -class GLContext; - -typedef BOOL(GL_BINDING_CALL* wglChoosePixelFormatARBProc)( - HDC dc, - const int* int_attrib_list, - const float* float_attrib_list, - UINT max_formats, - int* formats, - UINT* num_formats); -typedef BOOL(GL_BINDING_CALL* wglCopyContextProc)(HGLRC hglrcSrc, - HGLRC hglrcDst, - UINT mask); -typedef HGLRC(GL_BINDING_CALL* wglCreateContextProc)(HDC hdc); -typedef HGLRC(GL_BINDING_CALL* wglCreateContextAttribsARBProc)( - HDC hDC, - HGLRC hShareContext, - const int* attribList); -typedef HGLRC(GL_BINDING_CALL* wglCreateLayerContextProc)(HDC hdc, - int iLayerPlane); -typedef HPBUFFERARB(GL_BINDING_CALL* wglCreatePbufferARBProc)( - HDC hDC, - int iPixelFormat, - int iWidth, - int iHeight, - const int* piAttribList); -typedef BOOL(GL_BINDING_CALL* wglDeleteContextProc)(HGLRC hglrc); -typedef BOOL(GL_BINDING_CALL* wglDestroyPbufferARBProc)(HPBUFFERARB hPbuffer); -typedef HGLRC(GL_BINDING_CALL* wglGetCurrentContextProc)(); -typedef HDC(GL_BINDING_CALL* wglGetCurrentDCProc)(); -typedef const char*(GL_BINDING_CALL* wglGetExtensionsStringARBProc)(HDC hDC); -typedef const char*(GL_BINDING_CALL* wglGetExtensionsStringEXTProc)(); -typedef HDC(GL_BINDING_CALL* wglGetPbufferDCARBProc)(HPBUFFERARB hPbuffer); -typedef BOOL(GL_BINDING_CALL* wglMakeCurrentProc)(HDC hdc, HGLRC hglrc); -typedef BOOL(GL_BINDING_CALL* wglQueryPbufferARBProc)(HPBUFFERARB hPbuffer, - int iAttribute, - int* piValue); -typedef int(GL_BINDING_CALL* wglReleasePbufferDCARBProc)(HPBUFFERARB hPbuffer, - HDC hDC); -typedef BOOL(GL_BINDING_CALL* wglShareListsProc)(HGLRC hglrc1, HGLRC hglrc2); -typedef BOOL(GL_BINDING_CALL* wglSwapIntervalEXTProc)(int interval); -typedef BOOL(GL_BINDING_CALL* wglSwapLayerBuffersProc)(HDC hdc, UINT fuPlanes); - -struct ExtensionsWGL { - bool b_WGL_ARB_create_context; - bool b_WGL_ARB_extensions_string; - bool b_WGL_ARB_pbuffer; - bool b_WGL_ARB_pixel_format; - bool b_WGL_EXT_extensions_string; - bool b_WGL_EXT_swap_control; -}; - -struct ProcsWGL { - wglChoosePixelFormatARBProc wglChoosePixelFormatARBFn; - wglCopyContextProc wglCopyContextFn; - wglCreateContextProc wglCreateContextFn; - wglCreateContextAttribsARBProc wglCreateContextAttribsARBFn; - wglCreateLayerContextProc wglCreateLayerContextFn; - wglCreatePbufferARBProc wglCreatePbufferARBFn; - wglDeleteContextProc wglDeleteContextFn; - wglDestroyPbufferARBProc wglDestroyPbufferARBFn; - wglGetCurrentContextProc wglGetCurrentContextFn; - wglGetCurrentDCProc wglGetCurrentDCFn; - wglGetExtensionsStringARBProc wglGetExtensionsStringARBFn; - wglGetExtensionsStringEXTProc wglGetExtensionsStringEXTFn; - wglGetPbufferDCARBProc wglGetPbufferDCARBFn; - wglMakeCurrentProc wglMakeCurrentFn; - wglQueryPbufferARBProc wglQueryPbufferARBFn; - wglReleasePbufferDCARBProc wglReleasePbufferDCARBFn; - wglShareListsProc wglShareListsFn; - wglSwapIntervalEXTProc wglSwapIntervalEXTFn; - wglSwapLayerBuffersProc wglSwapLayerBuffersFn; -}; - -class GL_EXPORT WGLApi { - public: - WGLApi(); - virtual ~WGLApi(); - - virtual void SetDisabledExtensions(const std::string& disabled_extensions) {} - - virtual BOOL wglChoosePixelFormatARBFn(HDC dc, - const int* int_attrib_list, - const float* float_attrib_list, - UINT max_formats, - int* formats, - UINT* num_formats) = 0; - virtual BOOL wglCopyContextFn(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) = 0; - virtual HGLRC wglCreateContextFn(HDC hdc) = 0; - virtual HGLRC wglCreateContextAttribsARBFn(HDC hDC, - HGLRC hShareContext, - const int* attribList) = 0; - virtual HGLRC wglCreateLayerContextFn(HDC hdc, int iLayerPlane) = 0; - virtual HPBUFFERARB wglCreatePbufferARBFn(HDC hDC, - int iPixelFormat, - int iWidth, - int iHeight, - const int* piAttribList) = 0; - virtual BOOL wglDeleteContextFn(HGLRC hglrc) = 0; - virtual BOOL wglDestroyPbufferARBFn(HPBUFFERARB hPbuffer) = 0; - virtual HGLRC wglGetCurrentContextFn() = 0; - virtual HDC wglGetCurrentDCFn() = 0; - virtual const char* wglGetExtensionsStringARBFn(HDC hDC) = 0; - virtual const char* wglGetExtensionsStringEXTFn() = 0; - virtual HDC wglGetPbufferDCARBFn(HPBUFFERARB hPbuffer) = 0; - virtual BOOL wglMakeCurrentFn(HDC hdc, HGLRC hglrc) = 0; - virtual BOOL wglQueryPbufferARBFn(HPBUFFERARB hPbuffer, - int iAttribute, - int* piValue) = 0; - virtual int wglReleasePbufferDCARBFn(HPBUFFERARB hPbuffer, HDC hDC) = 0; - virtual BOOL wglShareListsFn(HGLRC hglrc1, HGLRC hglrc2) = 0; - virtual BOOL wglSwapIntervalEXTFn(int interval) = 0; - virtual BOOL wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) = 0; -}; - -} // namespace gl - -#define wglChoosePixelFormatARB \ - ::gl::g_current_wgl_context->wglChoosePixelFormatARBFn -#define wglCopyContext ::gl::g_current_wgl_context->wglCopyContextFn -#define wglCreateContext ::gl::g_current_wgl_context->wglCreateContextFn -#define wglCreateContextAttribsARB \ - ::gl::g_current_wgl_context->wglCreateContextAttribsARBFn -#define wglCreateLayerContext \ - ::gl::g_current_wgl_context->wglCreateLayerContextFn -#define wglCreatePbufferARB ::gl::g_current_wgl_context->wglCreatePbufferARBFn -#define wglDeleteContext ::gl::g_current_wgl_context->wglDeleteContextFn -#define wglDestroyPbufferARB ::gl::g_current_wgl_context->wglDestroyPbufferARBFn -#define wglGetCurrentContext ::gl::g_current_wgl_context->wglGetCurrentContextFn -#define wglGetCurrentDC ::gl::g_current_wgl_context->wglGetCurrentDCFn -#define wglGetExtensionsStringARB \ - ::gl::g_current_wgl_context->wglGetExtensionsStringARBFn -#define wglGetExtensionsStringEXT \ - ::gl::g_current_wgl_context->wglGetExtensionsStringEXTFn -#define wglGetPbufferDCARB ::gl::g_current_wgl_context->wglGetPbufferDCARBFn -#define wglMakeCurrent ::gl::g_current_wgl_context->wglMakeCurrentFn -#define wglQueryPbufferARB ::gl::g_current_wgl_context->wglQueryPbufferARBFn -#define wglReleasePbufferDCARB \ - ::gl::g_current_wgl_context->wglReleasePbufferDCARBFn -#define wglShareLists ::gl::g_current_wgl_context->wglShareListsFn -#define wglSwapIntervalEXT ::gl::g_current_wgl_context->wglSwapIntervalEXTFn -#define wglSwapLayerBuffers ::gl::g_current_wgl_context->wglSwapLayerBuffersFn - -#endif // UI_GL_GL_BINDINGS_AUTOGEN_WGL_H_
diff --git a/ui/gl/gl_context_wgl.cc b/ui/gl/gl_context_wgl.cc deleted file mode 100644 index 9e9633a..0000000 --- a/ui/gl/gl_context_wgl.cc +++ /dev/null
@@ -1,158 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file implements the GLContextWGL and PbufferGLContext classes. - -#include "ui/gl/gl_context_wgl.h" - -#include "base/command_line.h" -#include "base/logging.h" -#include "base/trace_event/trace_event.h" -#include "ui/gl/gl_bindings.h" -#include "ui/gl/gl_implementation.h" -#include "ui/gl/gl_surface_wgl.h" - -namespace gl { - -GLContextWGL::GLContextWGL(GLShareGroup* share_group) - : GLContextReal(share_group), context_(nullptr) { -} - -bool GLContextWGL::Initialize(GLSurface* compatible_surface, - const GLContextAttribs& attribs) { - // webgl_compatibility_context and disabling bind_generates_resource are not - // supported. - DCHECK(!attribs.webgl_compatibility_context && - attribs.bind_generates_resource); - - // Get the handle of another initialized context in the share group _before_ - // setting context_. Otherwise this context will be considered initialized - // and could potentially be returned by GetHandle. - HGLRC share_handle = static_cast<HGLRC>(share_group()->GetHandle()); - - HDC device_context = static_cast<HDC>(compatible_surface->GetHandle()); - bool has_wgl_create_context_arb = - strstr(wglGetExtensionsStringARB(device_context), - "WGL_ARB_create_context") != nullptr; - bool create_core_profile = has_wgl_create_context_arb && - !base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableES3GLContext); - - if (create_core_profile) { - std::pair<int, int> attempt_versions[] = { - {4, 5}, {4, 4}, {4, 3}, {4, 2}, {4, 1}, {4, 0}, {3, 3}, {3, 2}, - }; - - for (const auto& version : attempt_versions) { - const int attribs[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, - version.first, - WGL_CONTEXT_MINOR_VERSION_ARB, - version.second, - WGL_CONTEXT_PROFILE_MASK_ARB, - WGL_CONTEXT_CORE_PROFILE_BIT_ARB, - 0, - 0, - }; - - context_ = - wglCreateContextAttribsARB(device_context, share_handle, attribs); - if (context_) { - break; - } - } - } - - if (!context_) { - context_ = wglCreateContext(device_context); - } - if (!context_) { - LOG(ERROR) << "Failed to create GL context."; - Destroy(); - return false; - } - - if (share_handle) { - if (!wglShareLists(share_handle, context_)) { - LOG(ERROR) << "Could not share GL contexts."; - Destroy(); - return false; - } - } - - return true; -} - -void GLContextWGL::Destroy() { - if (context_) { - wglDeleteContext(context_); - context_ = nullptr; - } -} - -bool GLContextWGL::MakeCurrentImpl(GLSurface* surface) { - DCHECK(context_); - if (IsCurrent(surface)) - return true; - - ScopedReleaseCurrent release_current; - TRACE_EVENT0("gpu", "GLContextWGL::MakeCurrent"); - - if (!wglMakeCurrent(static_cast<HDC>(surface->GetHandle()), context_)) { - LOG(ERROR) << "Unable to make gl context current."; - return false; - } - - // Set this as soon as the context is current, since we might call into GL. - BindGLApi(); - - SetCurrent(surface); - InitializeDynamicBindings(); - - if (!surface->OnMakeCurrent(this)) { - LOG(ERROR) << "Could not make current."; - return false; - } - - release_current.Cancel(); - return true; -} - -void GLContextWGL::ReleaseCurrent(GLSurface* surface) { - if (!IsCurrent(surface)) - return; - - SetCurrent(nullptr); - wglMakeCurrent(nullptr, nullptr); -} - -bool GLContextWGL::IsCurrent(GLSurface* surface) { - bool native_context_is_current = - wglGetCurrentContext() == context_; - - // If our context is current then our notion of which GLContext is - // current must be correct. On the other hand, third-party code - // using OpenGL might change the current context. - DCHECK(!native_context_is_current || (GetRealCurrent() == this)); - - if (!native_context_is_current) - return false; - - if (surface) { - if (wglGetCurrentDC() != surface->GetHandle()) - return false; - } - - return true; -} - -void* GLContextWGL::GetHandle() { - return context_; -} - -GLContextWGL::~GLContextWGL() { - Destroy(); -} - -} // namespace gl
diff --git a/ui/gl/gl_context_wgl.h b/ui/gl/gl_context_wgl.h deleted file mode 100644 index c792580..0000000 --- a/ui/gl/gl_context_wgl.h +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_GL_GL_CONTEXT_WGL_H_ -#define UI_GL_GL_CONTEXT_WGL_H_ - -#include <string> - -#include "base/macros.h" -#include "ui/gfx/native_widget_types.h" -#include "ui/gl/gl_context.h" -#include "ui/gl/gl_export.h" - -namespace gl { - -class GLSurface; - -// This class is a wrapper around a GL context. -class GL_EXPORT GLContextWGL : public GLContextReal { - public: - explicit GLContextWGL(GLShareGroup* share_group); - - // Implement GLContext. - bool Initialize(GLSurface* compatible_surface, - const GLContextAttribs& attribs) override; - bool MakeCurrentImpl(GLSurface* surface) override; - void ReleaseCurrent(GLSurface* surface) override; - bool IsCurrent(GLSurface* surface) override; - void* GetHandle() override; - - private: - ~GLContextWGL() override; - void Destroy(); - - HGLRC context_; - - DISALLOW_COPY_AND_ASSIGN(GLContextWGL); -}; - -} // namespace gl - -#endif // UI_GL_GL_CONTEXT_WGL_H_
diff --git a/ui/gl/gl_implementation.cc b/ui/gl/gl_implementation.cc index 18192ce..433cbe8d9 100644 --- a/ui/gl/gl_implementation.cc +++ b/ui/gl/gl_implementation.cc
@@ -100,10 +100,6 @@ EGLApi* g_current_egl_context; #endif -#if defined(OS_WIN) -WGLApi* g_current_wgl_context; -#endif - #if defined(USE_GLX) GLXApi* g_current_glx_context; #endif
diff --git a/ui/gl/gl_surface_wgl.cc b/ui/gl/gl_surface_wgl.cc deleted file mode 100644 index 0bce93b5..0000000 --- a/ui/gl/gl_surface_wgl.cc +++ /dev/null
@@ -1,433 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/gl/gl_surface_wgl.h" - -#include <memory> -#include <utility> - -#include "base/logging.h" -#include "base/trace_event/trace_event.h" -#include "ui/gl/gl_bindings.h" -#include "ui/gl/gl_context.h" -#include "ui/gl/gl_gl_api_implementation.h" -#include "ui/gl/gl_wgl_api_implementation.h" - -namespace gl { - -namespace { -const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = { - sizeof(kPixelFormatDescriptor), // Size of structure. - 1, // Default version. - PFD_DRAW_TO_WINDOW | // Window drawing support. - PFD_SUPPORT_OPENGL | // OpenGL support. - PFD_DOUBLEBUFFER, // Double buffering support (not stereo). - PFD_TYPE_RGBA, // RGBA color mode (not indexed). - 24, // 24 bit color mode. - 0, 0, 0, 0, 0, 0, // Don't set RGB bits & shifts. - 8, 0, // 8 bit alpha - 0, // No accumulation buffer. - 0, 0, 0, 0, // Ignore accumulation bits. - 0, // no z-buffer. - 0, // no stencil buffer. - 0, // No aux buffer. - PFD_MAIN_PLANE, // Main drawing plane (not overlay). - 0, // Reserved. - 0, 0, 0, // Layer masks ignored. -}; - -LRESULT CALLBACK IntermediateWindowProc(HWND window, - UINT message, - WPARAM w_param, - LPARAM l_param) { - switch (message) { - case WM_ERASEBKGND: - // Prevent windows from erasing the background. - return 1; - case WM_PAINT: - // Do not paint anything. - PAINTSTRUCT paint; - if (BeginPaint(window, &paint)) - EndPaint(window, &paint); - return 0; - default: - return DefWindowProc(window, message, w_param, l_param); - } -} - -class DisplayWGL { - public: - DisplayWGL() - : module_handle_(0), - window_class_(0), - window_handle_(0), - device_context_(0), - pixel_format_(0) { - } - - ~DisplayWGL() { - if (window_handle_) - DestroyWindow(window_handle_); - if (window_class_) - UnregisterClass(reinterpret_cast<wchar_t*>(window_class_), - module_handle_); - } - - bool Init() { - // We must initialize a GL context before we can bind to extension entry - // points. This requires the device context for a window. - if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | - GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - reinterpret_cast<wchar_t*>(IntermediateWindowProc), - &module_handle_)) { - LOG(ERROR) << "GetModuleHandleEx failed."; - return false; - } - - WNDCLASS intermediate_class; - intermediate_class.style = CS_OWNDC; - intermediate_class.lpfnWndProc = IntermediateWindowProc; - intermediate_class.cbClsExtra = 0; - intermediate_class.cbWndExtra = 0; - intermediate_class.hInstance = module_handle_; - intermediate_class.hIcon = LoadIcon(NULL, IDI_APPLICATION); - intermediate_class.hCursor = LoadCursor(NULL, IDC_ARROW); - intermediate_class.hbrBackground = NULL; - intermediate_class.lpszMenuName = NULL; - intermediate_class.lpszClassName = L"Intermediate GL Window"; - window_class_ = RegisterClass(&intermediate_class); - if (!window_class_) { - LOG(ERROR) << "RegisterClass failed."; - return false; - } - - window_handle_ = CreateWindowEx(WS_EX_NOPARENTNOTIFY, - reinterpret_cast<wchar_t*>(window_class_), - L"", - WS_OVERLAPPEDWINDOW, - 0, - 0, - 100, - 100, - NULL, - NULL, - NULL, - NULL); - if (!window_handle_) { - LOG(ERROR) << "CreateWindow failed."; - return false; - } - - device_context_ = GetDC(window_handle_); - pixel_format_ = ChoosePixelFormat(device_context_, - &kPixelFormatDescriptor); - if (pixel_format_ == 0) { - LOG(ERROR) << "Unable to get the pixel format for GL context."; - return false; - } - if (!SetPixelFormat(device_context_, - pixel_format_, - &kPixelFormatDescriptor)) { - LOG(ERROR) << "Unable to set the pixel format for temporary GL context."; - return false; - } - - return true; - } - - ATOM window_class() const { return window_class_; } - HDC device_context() const { return device_context_; } - int pixel_format() const { return pixel_format_; } - - private: - HINSTANCE module_handle_; - ATOM window_class_; - HWND window_handle_; - HDC device_context_; - int pixel_format_; -}; -DisplayWGL* g_wgl_display; -} // namespace - -// static -bool GLSurfaceWGL::initialized_ = false; - -GLSurfaceWGL::GLSurfaceWGL() { -} - -GLSurfaceWGL::~GLSurfaceWGL() { -} - -void* GLSurfaceWGL::GetDisplay() { - return GetDisplayDC(); -} - -// static -bool GLSurfaceWGL::InitializeOneOff() { - if (initialized_) - return true; - - DCHECK(g_wgl_display == NULL); - std::unique_ptr<DisplayWGL> wgl_display(new DisplayWGL); - if (!wgl_display->Init()) - return false; - - g_wgl_display = wgl_display.release(); - initialized_ = true; - return true; -} - -// static -bool GLSurfaceWGL::InitializeExtensionSettingsOneOff() { - if (!initialized_) - return false; - g_driver_wgl.InitializeExtensionBindings(); - return true; -} - -void GLSurfaceWGL::InitializeOneOffForTesting() { - if (g_wgl_display == NULL) { - g_wgl_display = new DisplayWGL; - } -} - -HDC GLSurfaceWGL::GetDisplayDC() { - return g_wgl_display->device_context(); -} - -NativeViewGLSurfaceWGL::NativeViewGLSurfaceWGL(gfx::AcceleratedWidget window) - : window_(window), child_window_(NULL), device_context_(NULL) { - DCHECK(window); -} - -NativeViewGLSurfaceWGL::~NativeViewGLSurfaceWGL() { - Destroy(); -} - -bool NativeViewGLSurfaceWGL::Initialize(GLSurfaceFormat format) { - DCHECK(!device_context_); - - RECT rect; - if (!GetClientRect(window_, &rect)) { - LOG(ERROR) << "GetClientRect failed.\n"; - Destroy(); - return false; - } - - // Create a child window. WGL has problems using a window handle owned by - // another process. - child_window_ = CreateWindowEx( - WS_EX_NOPARENTNOTIFY, - reinterpret_cast<wchar_t*>(g_wgl_display->window_class()), L"", - WS_CHILDWINDOW | WS_DISABLED | WS_VISIBLE, 0, 0, rect.right - rect.left, - rect.bottom - rect.top, window_, NULL, NULL, NULL); - if (!child_window_) { - LOG(ERROR) << "CreateWindow failed.\n"; - Destroy(); - return false; - } - - // The GL context will render to this window. - device_context_ = GetDC(child_window_); - if (!device_context_) { - LOG(ERROR) << "Unable to get device context for window."; - Destroy(); - return false; - } - - if (!SetPixelFormat(device_context_, g_wgl_display->pixel_format(), - &kPixelFormatDescriptor)) { - LOG(ERROR) << "Unable to set the pixel format for GL context."; - Destroy(); - return false; - } - - format_ = format; - - return true; -} - -void NativeViewGLSurfaceWGL::Destroy() { - if (child_window_ && device_context_) - ReleaseDC(child_window_, device_context_); - - if (child_window_) - DestroyWindow(child_window_); - - child_window_ = NULL; - device_context_ = NULL; -} - -bool NativeViewGLSurfaceWGL::Resize(const gfx::Size& size, - float scale_factor, - const gfx::ColorSpace& color_space, - bool has_alpha) { - RECT rect; - if (!GetClientRect(window_, &rect)) { - LOG(ERROR) << "Failed to get parent window size."; - return false; - } - DCHECK(size.width() == (rect.right - rect.left) && - size.height() == (rect.bottom - rect.top)); - if (!MoveWindow(child_window_, 0, 0, size.width(), size.height(), FALSE)) { - LOG(ERROR) << "Failed to resize child window."; - return false; - } - return true; -} - -bool NativeViewGLSurfaceWGL::Recreate() { - Destroy(); - if (!Initialize(format_)) { - LOG(ERROR) << "Failed to create surface."; - return false; - } - return true; -} - -bool NativeViewGLSurfaceWGL::IsOffscreen() { - return false; -} - -gfx::SwapResult NativeViewGLSurfaceWGL::SwapBuffers( - PresentationCallback callback) { - // TODO(penghuang): Provide presentation feedback. https://crbug.com/776877 - TRACE_EVENT2("gpu", "NativeViewGLSurfaceWGL:RealSwapBuffers", - "width", GetSize().width(), - "height", GetSize().height()); - - // Resize the child window to match the parent before swapping. Do not repaint - // it as it moves. - RECT rect; - if (!GetClientRect(window_, &rect)) - return gfx::SwapResult::SWAP_FAILED; - if (!MoveWindow(child_window_, - 0, - 0, - rect.right - rect.left, - rect.bottom - rect.top, - FALSE)) { - return gfx::SwapResult::SWAP_FAILED; - } - - DCHECK(device_context_); - if (::SwapBuffers(device_context_) == TRUE) { - // TODO(penghuang): Provide more accurate values for presentation feedback. - constexpr int64_t kRefreshIntervalInMicroseconds = - base::Time::kMicrosecondsPerSecond / 60; - std::move(callback).Run(gfx::PresentationFeedback( - base::TimeTicks::Now(), - base::TimeDelta::FromMicroseconds(kRefreshIntervalInMicroseconds), - 0 /* flags */)); - return gfx::SwapResult::SWAP_ACK; - } else { - std::move(callback).Run(gfx::PresentationFeedback::Failure()); - return gfx::SwapResult::SWAP_FAILED; - } -} - -gfx::Size NativeViewGLSurfaceWGL::GetSize() { - RECT rect; - BOOL result = GetClientRect(child_window_, &rect); - DCHECK(result); - return gfx::Size(rect.right - rect.left, rect.bottom - rect.top); -} - -void* NativeViewGLSurfaceWGL::GetHandle() { - return device_context_; -} - -GLSurfaceFormat NativeViewGLSurfaceWGL::GetFormat() { - return GLSurfaceFormat(); -} - -void NativeViewGLSurfaceWGL::SetVSyncEnabled(bool enabled) { - DCHECK(GLContext::GetCurrent() && GLContext::GetCurrent()->IsCurrent(this)); - if (g_driver_wgl.ext.b_WGL_EXT_swap_control) { - wglSwapIntervalEXT(enabled ? 1 : 0); - } else { - LOG(WARNING) << "Could not disable vsync: driver does not " - "support WGL_EXT_swap_control"; - } -} - -PbufferGLSurfaceWGL::PbufferGLSurfaceWGL(const gfx::Size& size) - : size_(size), - device_context_(NULL), - pbuffer_(NULL) { - // Some implementations of Pbuffer do not support having a 0 size. For such - // cases use a (1, 1) surface. - if (size_.GetArea() == 0) - size_.SetSize(1, 1); -} - -PbufferGLSurfaceWGL::~PbufferGLSurfaceWGL() { - Destroy(); -} - -bool PbufferGLSurfaceWGL::Initialize(GLSurfaceFormat format) { - DCHECK(!device_context_); - - if (!g_driver_wgl.fn.wglCreatePbufferARBFn) { - LOG(ERROR) << "wglCreatePbufferARB not available."; - Destroy(); - return false; - } - - const int kNoAttributes[] = { 0 }; - pbuffer_ = wglCreatePbufferARB(g_wgl_display->device_context(), - g_wgl_display->pixel_format(), size_.width(), - size_.height(), kNoAttributes); - - if (!pbuffer_) { - LOG(ERROR) << "Unable to create pbuffer."; - Destroy(); - return false; - } - - device_context_ = wglGetPbufferDCARB(static_cast<HPBUFFERARB>(pbuffer_)); - if (!device_context_) { - LOG(ERROR) << "Unable to get pbuffer device context."; - Destroy(); - return false; - } - - return true; -} - -void PbufferGLSurfaceWGL::Destroy() { - if (pbuffer_ && device_context_) - wglReleasePbufferDCARB(static_cast<HPBUFFERARB>(pbuffer_), device_context_); - - device_context_ = NULL; - - if (pbuffer_) { - wglDestroyPbufferARB(static_cast<HPBUFFERARB>(pbuffer_)); - pbuffer_ = NULL; - } -} - -bool PbufferGLSurfaceWGL::IsOffscreen() { - return true; -} - -gfx::SwapResult PbufferGLSurfaceWGL::SwapBuffers( - PresentationCallback callback) { - NOTREACHED() << "Attempted to call SwapBuffers on a pbuffer."; - return gfx::SwapResult::SWAP_FAILED; -} - -gfx::Size PbufferGLSurfaceWGL::GetSize() { - return size_; -} - -void* PbufferGLSurfaceWGL::GetHandle() { - return device_context_; -} - -GLSurfaceFormat PbufferGLSurfaceWGL::GetFormat() { - return GLSurfaceFormat(); -} - -} // namespace gl
diff --git a/ui/gl/gl_surface_wgl.h b/ui/gl/gl_surface_wgl.h deleted file mode 100644 index 628b356a..0000000 --- a/ui/gl/gl_surface_wgl.h +++ /dev/null
@@ -1,95 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_GL_GL_SURFACE_WGL_H_ -#define UI_GL_GL_SURFACE_WGL_H_ - -#include "base/macros.h" -#include "ui/gfx/native_widget_types.h" -#include "ui/gl/gl_export.h" -#include "ui/gl/gl_surface.h" - -namespace gl { - -// Base interface for WGL surfaces. -class GL_EXPORT GLSurfaceWGL : public GLSurface { - public: - GLSurfaceWGL(); - - // Implement GLSurface. - void* GetDisplay() override; - - static bool InitializeOneOff(); - static bool InitializeExtensionSettingsOneOff(); - static void InitializeOneOffForTesting(); - static HDC GetDisplayDC(); - - protected: - ~GLSurfaceWGL() override; - - private: - DISALLOW_COPY_AND_ASSIGN(GLSurfaceWGL); - static bool initialized_; -}; - -// A surface used to render to a view. -class GL_EXPORT NativeViewGLSurfaceWGL : public GLSurfaceWGL { - public: - explicit NativeViewGLSurfaceWGL(gfx::AcceleratedWidget window); - - // Implement GLSurface. - bool Initialize(GLSurfaceFormat format) override; - void Destroy() override; - bool Resize(const gfx::Size& size, - float scale_factor, - const gfx::ColorSpace& color_space, - bool has_alpha) override; - bool Recreate() override; - bool IsOffscreen() override; - gfx::SwapResult SwapBuffers(PresentationCallback callback) override; - gfx::Size GetSize() override; - void* GetHandle() override; - GLSurfaceFormat GetFormat() override; - void SetVSyncEnabled(bool enabled) override; - - private: - ~NativeViewGLSurfaceWGL() override; - - GLSurfaceFormat format_; - - gfx::AcceleratedWidget window_; - gfx::AcceleratedWidget child_window_; - HDC device_context_; - - DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceWGL); -}; - - -// A surface used to render to an offscreen pbuffer. -class GL_EXPORT PbufferGLSurfaceWGL : public GLSurfaceWGL { - public: - explicit PbufferGLSurfaceWGL(const gfx::Size& size); - - // Implement GLSurface. - bool Initialize(GLSurfaceFormat format) override; - void Destroy() override; - bool IsOffscreen() override; - gfx::SwapResult SwapBuffers(PresentationCallback callback) override; - gfx::Size GetSize() override; - void* GetHandle() override; - GLSurfaceFormat GetFormat() override; - - private: - ~PbufferGLSurfaceWGL() override; - - gfx::Size size_; - HDC device_context_; - void* pbuffer_; - - DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceWGL); -}; - -} // namespace gl - -#endif // UI_GL_GL_SURFACE_WGL_H_
diff --git a/ui/gl/gl_wgl_api_implementation.cc b/ui/gl/gl_wgl_api_implementation.cc deleted file mode 100644 index 1633109..0000000 --- a/ui/gl/gl_wgl_api_implementation.cc +++ /dev/null
@@ -1,145 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/gl/gl_wgl_api_implementation.h" - -#include "base/command_line.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" -#include "ui/gl/gl_context.h" -#include "ui/gl/gl_implementation.h" -#include "ui/gl/gl_implementation_wrapper.h" -#include "ui/gl/gl_surface_wgl.h" - -namespace gl { - -RealWGLApi* g_real_wgl = nullptr; - -GL_IMPL_WRAPPER_TYPE(WGL) * g_wgl_wrapper = nullptr; - -void InitializeStaticGLBindingsWGL() { - g_driver_wgl.InitializeStaticBindings(); - if (!g_wgl_wrapper) { - auto real_api = std::make_unique<RealWGLApi>(); - real_api->Initialize(&g_driver_wgl); - g_wgl_wrapper = new GL_IMPL_WRAPPER_TYPE(WGL)(std::move(real_api)); - } - - g_current_wgl_context = g_wgl_wrapper->api(); -} - -void ClearBindingsWGL() { - delete g_wgl_wrapper; - g_wgl_wrapper = nullptr; - - g_current_wgl_context = nullptr; - g_driver_wgl.ClearBindings(); -} - -WGLApi::WGLApi() { -} - -WGLApi::~WGLApi() { -} - -WGLApiBase::WGLApiBase() : driver_(nullptr) {} - -WGLApiBase::~WGLApiBase() { -} - -void WGLApiBase::InitializeBase(DriverWGL* driver) { - driver_ = driver; -} - -RealWGLApi::RealWGLApi() { -} - -RealWGLApi::~RealWGLApi() { -} - -void RealWGLApi::Initialize(DriverWGL* driver) { - InitializeBase(driver); -} - -void RealWGLApi::SetDisabledExtensions(const std::string& disabled_extensions) { - disabled_exts_.clear(); - filtered_ext_exts_ = ""; - filtered_arb_exts_ = ""; - if (!disabled_extensions.empty()) { - disabled_exts_ = - base::SplitString(disabled_extensions, ", ;", - base::KEEP_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); - } -} - -const char* RealWGLApi::wglGetExtensionsStringARBFn(HDC hDC) { - if (filtered_arb_exts_.size()) - return filtered_arb_exts_.c_str(); - - if (!driver_->fn.wglGetExtensionsStringARBFn) - return nullptr; - - const char* str = WGLApiBase::wglGetExtensionsStringARBFn(hDC); - if (!str) - return nullptr; - - filtered_arb_exts_ = FilterGLExtensionList(str, disabled_exts_); - return filtered_arb_exts_.c_str(); -} - -const char* RealWGLApi::wglGetExtensionsStringEXTFn() { - if (filtered_ext_exts_.size()) - return filtered_ext_exts_.c_str(); - - if (!driver_->fn.wglGetExtensionsStringEXTFn) - return nullptr; - - const char* str = WGLApiBase::wglGetExtensionsStringEXTFn(); - if (!str) - return nullptr; - - filtered_ext_exts_ = FilterGLExtensionList(str, disabled_exts_); - return filtered_ext_exts_.c_str(); -} - -LogWGLApi::LogWGLApi(WGLApi* wgl_api) : wgl_api_(wgl_api) {} - -LogWGLApi::~LogWGLApi() {} - -void LogWGLApi::SetDisabledExtensions(const std::string& disabled_extensions) { - if (wgl_api_) { - wgl_api_->SetDisabledExtensions(disabled_extensions); - } -} - -TraceWGLApi::~TraceWGLApi() { -} - -void TraceWGLApi::SetDisabledExtensions( - const std::string& disabled_extensions) { - if (wgl_api_) { - wgl_api_->SetDisabledExtensions(disabled_extensions); - } -} - -bool GetGLWindowSystemBindingInfoWGL(GLWindowSystemBindingInfo* info) { - const char* extensions = wglGetExtensionsStringEXT(); - *info = GLWindowSystemBindingInfo(); - if (extensions) - info->extensions = extensions; - return true; -} - -void SetDisabledExtensionsWGL(const std::string& disabled_extensions) { - DCHECK(g_current_wgl_context); - DCHECK(GLContext::TotalGLContexts() == 0); - g_current_wgl_context->SetDisabledExtensions(disabled_extensions); -} - -bool InitializeExtensionSettingsOneOffWGL() { - return GLSurfaceWGL::InitializeExtensionSettingsOneOff(); -} - -} // namespace gl
diff --git a/ui/gl/gl_wgl_api_implementation.h b/ui/gl/gl_wgl_api_implementation.h deleted file mode 100644 index 3bc8d65..0000000 --- a/ui/gl/gl_wgl_api_implementation.h +++ /dev/null
@@ -1,90 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_GL_GL_WGL_API_IMPLEMENTATION_H_ -#define UI_GL_GL_WGL_API_IMPLEMENTATION_H_ - -#include <string> -#include <vector> - -#include "base/compiler_specific.h" -#include "ui/gl/gl_bindings.h" -#include "ui/gl/gl_export.h" - -namespace gl { - -struct GLWindowSystemBindingInfo; - -GL_EXPORT void InitializeStaticGLBindingsWGL(); -GL_EXPORT void ClearBindingsWGL(); -GL_EXPORT bool GetGLWindowSystemBindingInfoWGL(GLWindowSystemBindingInfo* info); -GL_EXPORT void SetDisabledExtensionsWGL(const std::string& disabled_extensions); -GL_EXPORT bool InitializeExtensionSettingsOneOffWGL(); - -class GL_EXPORT WGLApiBase : public WGLApi { - public: - // Include the auto-generated part of this class. We split this because - // it means we can easily edit the non-auto generated parts right here in - // this file instead of having to edit some template or the code generator. - #include "gl_bindings_api_autogen_wgl.h" - - protected: - WGLApiBase(); - ~WGLApiBase() override; - void InitializeBase(DriverWGL* driver); - - DriverWGL* driver_; -}; - -class GL_EXPORT RealWGLApi : public WGLApiBase { - public: - RealWGLApi(); - ~RealWGLApi() override; - void Initialize(DriverWGL* driver); - void SetDisabledExtensions(const std::string& disabled_extensions) override; - - const char* wglGetExtensionsStringARBFn(HDC hDC) override; - const char* wglGetExtensionsStringEXTFn() override; - private: - - std::vector<std::string> disabled_exts_; - std::string filtered_arb_exts_; - std::string filtered_ext_exts_; -}; - -// Logs debug information for every WGL call. -class GL_EXPORT LogWGLApi : public WGLApi { - public: - LogWGLApi(WGLApi* wgl_api); - ~LogWGLApi() override; - void SetDisabledExtensions(const std::string& disabled_extensions) override; - - // Include the auto-generated part of this class. We split this because - // it means we can easily edit the non-auto generated parts right here in - // this file instead of having to edit some template or the code generator. - #include "gl_bindings_api_autogen_wgl.h" - - private: - WGLApi* wgl_api_; -}; - -// Inserts a TRACE for every WGL call. -class GL_EXPORT TraceWGLApi : public WGLApi { - public: - TraceWGLApi(WGLApi* wgl_api) : wgl_api_(wgl_api) { } - ~TraceWGLApi() override; - void SetDisabledExtensions(const std::string& disabled_extensions) override; - - // Include the auto-generated part of this class. We split this because - // it means we can easily edit the non-auto generated parts right here in - // this file instead of having to edit some template or the code generator. - #include "gl_bindings_api_autogen_wgl.h" - - private: - WGLApi* wgl_api_; -}; - -} // namespace gl - -#endif // UI_GL_GL_WGL_API_IMPLEMENTATION_H_
diff --git a/ui/gl/init/gl_factory_win.cc b/ui/gl/init/gl_factory_win.cc index 6b65ba3..6e58b3e 100644 --- a/ui/gl/init/gl_factory_win.cc +++ b/ui/gl/init/gl_factory_win.cc
@@ -10,15 +10,12 @@ #include "ui/gl/gl_context.h" #include "ui/gl/gl_context_egl.h" #include "ui/gl/gl_context_stub.h" -#include "ui/gl/gl_context_wgl.h" #include "ui/gl/gl_egl_api_implementation.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_share_group.h" #include "ui/gl/gl_surface.h" #include "ui/gl/gl_surface_egl.h" #include "ui/gl/gl_surface_stub.h" -#include "ui/gl/gl_surface_wgl.h" -#include "ui/gl/gl_wgl_api_implementation.h" #include "ui/gl/vsync_provider_win.h" namespace gl { @@ -27,7 +24,6 @@ std::vector<GLImplementation> GetAllowedGLImplementations() { std::vector<GLImplementation> impls; impls.push_back(kGLImplementationEGLANGLE); - impls.push_back(kGLImplementationDesktopGL); impls.push_back(kGLImplementationSwiftShaderGL); return impls; } @@ -35,8 +31,6 @@ bool GetGLWindowSystemBindingInfo(const GLVersionInfo& gl_info, GLWindowSystemBindingInfo* info) { switch (GetGLImplementation()) { - case kGLImplementationDesktopGL: - return GetGLWindowSystemBindingInfoWGL(info); case kGLImplementationEGLANGLE: return GetGLWindowSystemBindingInfoEGL(info); default: @@ -53,9 +47,6 @@ case kGLImplementationEGLANGLE: return InitializeGLContext(new GLContextEGL(share_group), compatible_surface, attribs); - case kGLImplementationDesktopGL: - return InitializeGLContext(new GLContextWGL(share_group), - compatible_surface, attribs); case kGLImplementationMockGL: return new GLContextStub(share_group); case kGLImplementationStubGL: { @@ -79,9 +70,6 @@ return InitializeGLSurface(base::MakeRefCounted<NativeViewGLSurfaceEGL>( window, std::make_unique<VSyncProviderWin>(window))); } - case kGLImplementationDesktopGL: - return InitializeGLSurface( - base::MakeRefCounted<NativeViewGLSurfaceWGL>(window)); case kGLImplementationMockGL: case kGLImplementationStubGL: return new GLSurfaceStub; @@ -104,9 +92,6 @@ return InitializeGLSurfaceWithFormat(new PbufferGLSurfaceEGL(size), format); } - case kGLImplementationDesktopGL: - return InitializeGLSurfaceWithFormat( - new PbufferGLSurfaceWGL(size), format); case kGLImplementationMockGL: case kGLImplementationStubGL: return new GLSurfaceStub; @@ -120,9 +105,6 @@ GLImplementation implementation = GetGLImplementation(); DCHECK_NE(kGLImplementationNone, implementation); switch (implementation) { - case kGLImplementationDesktopGL: - SetDisabledExtensionsWGL(disabled_extensions); - break; case kGLImplementationEGLANGLE: SetDisabledExtensionsEGL(disabled_extensions); break; @@ -139,8 +121,6 @@ GLImplementation implementation = GetGLImplementation(); DCHECK_NE(kGLImplementationNone, implementation); switch (implementation) { - case kGLImplementationDesktopGL: - return InitializeExtensionSettingsOneOffWGL(); case kGLImplementationEGLANGLE: return InitializeExtensionSettingsOneOffEGL(); case kGLImplementationSwiftShaderGL:
diff --git a/ui/gl/init/gl_initializer_win.cc b/ui/gl/init/gl_initializer_win.cc index c62800c..b369eb2 100644 --- a/ui/gl/init/gl_initializer_win.cc +++ b/ui/gl/init/gl_initializer_win.cc
@@ -22,8 +22,6 @@ #include "ui/gl/gl_egl_api_implementation.h" #include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_surface_egl.h" -#include "ui/gl/gl_surface_wgl.h" -#include "ui/gl/gl_wgl_api_implementation.h" #include "ui/gl/vsync_provider_win.h" namespace gl { @@ -113,83 +111,12 @@ return true; } -bool InitializeStaticWGLInternal() { - base::NativeLibrary library = - base::LoadNativeLibrary(base::FilePath(L"opengl32.dll"), nullptr); - if (!library) { - DVLOG(1) << "opengl32.dll not found"; - return false; - } - - GLGetProcAddressProc get_proc_address = - reinterpret_cast<GLGetProcAddressProc>( - base::GetFunctionPointerFromNativeLibrary(library, - "wglGetProcAddress")); - if (!get_proc_address) { - LOG(ERROR) << "wglGetProcAddress not found."; - base::UnloadNativeLibrary(library); - return false; - } - - SetGLGetProcAddressProc(get_proc_address); - AddGLNativeLibrary(library); - SetGLImplementation(kGLImplementationDesktopGL); - - // Initialize GL surface and get some functions needed for the context - // creation below. - if (!GLSurfaceWGL::InitializeOneOff()) { - LOG(ERROR) << "GLSurfaceWGL::InitializeOneOff failed."; - return false; - } - wglCreateContextProc wglCreateContextFn = - reinterpret_cast<wglCreateContextProc>( - GetGLProcAddress("wglCreateContext")); - wglDeleteContextProc wglDeleteContextFn = - reinterpret_cast<wglDeleteContextProc>( - GetGLProcAddress("wglDeleteContext")); - wglMakeCurrentProc wglMakeCurrentFn = - reinterpret_cast<wglMakeCurrentProc>(GetGLProcAddress("wglMakeCurrent")); - - // Create a temporary GL context to bind to entry points. This is needed - // because wglGetProcAddress is specified to return nullptr for all queries - // if a context is not current in MSDN documentation, and the static - // bindings may contain functions that need to be queried with - // wglGetProcAddress. OpenGL wiki further warns that other error values - // than nullptr could also be returned from wglGetProcAddress on some - // implementations, so we need to clear the WGL bindings and reinitialize - // them after the context creation. - HGLRC gl_context = wglCreateContextFn(GLSurfaceWGL::GetDisplayDC()); - if (!gl_context) { - LOG(ERROR) << "Failed to create temporary context."; - return false; - } - if (!wglMakeCurrentFn(GLSurfaceWGL::GetDisplayDC(), gl_context)) { - LOG(ERROR) << "Failed to make temporary GL context current."; - wglDeleteContextFn(gl_context); - return false; - } - - InitializeStaticGLBindingsGL(); - InitializeStaticGLBindingsWGL(); - - wglMakeCurrent(nullptr, nullptr); - wglDeleteContext(gl_context); - - return true; -} - } // namespace bool InitializeGLOneOffPlatform() { VSyncProviderWin::InitializeOneOff(); switch (GetGLImplementation()) { - case kGLImplementationDesktopGL: - if (!GLSurfaceWGL::InitializeOneOff()) { - LOG(ERROR) << "GLSurfaceWGL::InitializeOneOff failed."; - return false; - } - break; case kGLImplementationSwiftShaderGL: case kGLImplementationEGLANGLE: if (!GLSurfaceEGL::InitializeOneOff(EGLDisplayPlatform(GetDC(nullptr)))) { @@ -222,8 +149,6 @@ case kGLImplementationSwiftShaderGL: case kGLImplementationEGLANGLE: return InitializeStaticEGLInternal(implementation); - case kGLImplementationDesktopGL: - return InitializeStaticWGLInternal(); case kGLImplementationMockGL: case kGLImplementationStubGL: SetGLImplementation(implementation); @@ -240,7 +165,6 @@ GLSurfaceEGL::ShutdownOneOff(); ClearBindingsEGL(); ClearBindingsGL(); - ClearBindingsWGL(); } } // namespace init
diff --git a/ui/gl/wgl_api_unittest.cc b/ui/gl/wgl_api_unittest.cc deleted file mode 100644 index 40b22c6..0000000 --- a/ui/gl/wgl_api_unittest.cc +++ /dev/null
@@ -1,145 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <memory> - -#include "base/command_line.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "ui/gl/gl_implementation.h" -#include "ui/gl/gl_surface_wgl.h" -#include "ui/gl/gl_wgl_api_implementation.h" - -typedef std::pair<std::string, std::string> stringpair; - -namespace gl { - -class WGLApiTest : public testing::Test { - public: - void SetUp() override { - GLSurfaceWGL::InitializeOneOffForTesting(); - fake_arb_extension_string_ = ""; - fake_ext_extension_string_ = ""; - - g_driver_wgl.ClearBindings(); - g_driver_wgl.fn.wglGetExtensionsStringARBFn = &FakeGetExtensionsStringARB; - g_driver_wgl.fn.wglGetExtensionsStringEXTFn = &FakeGetExtensionsStringEXT; - SetGLImplementation(kGLImplementationDesktopGL); - SetGLGetProcAddressProc(&FakeGLGetProcAddress); - } - - void TearDown() override { - g_current_wgl_context = nullptr; - api_.reset(nullptr); - g_driver_wgl.ClearBindings(); - - fake_ext_extension_string_ = ""; - fake_arb_extension_string_ = ""; - } - - void InitializeAPI(const char* disabled_extensions) { - api_ = std::make_unique<RealWGLApi>(); - g_current_wgl_context = api_.get(); - api_->Initialize(&g_driver_wgl); - if (disabled_extensions) { - SetDisabledExtensionsWGL(disabled_extensions); - } - g_driver_wgl.InitializeExtensionBindings(); - } - - void SetFakeEXTExtensionString(const char* fake_string) { - fake_ext_extension_string_ = fake_string; - } - - void SetFakeARBExtensionString(const char* fake_string) { - fake_arb_extension_string_ = fake_string; - } - - stringpair GetExtensions() { - auto stringify = [](const char* str) -> std::string { - return str ? str : ""; - }; - return stringpair( - stringify(wglGetExtensionsStringARB(NULL)), - stringify(wglGetExtensionsStringEXT())); - } - - static GLFunctionPointerType WINAPI FakeGLGetProcAddress(const char* proc) { - return NULL; - } - - static const char* GL_BINDING_CALL FakeGetExtensionsStringARB(HDC dc) { - return fake_arb_extension_string_; - } - - static const char* GL_BINDING_CALL FakeGetExtensionsStringEXT() { - return fake_ext_extension_string_; - } - - protected: - static const char* fake_ext_extension_string_; - static const char* fake_arb_extension_string_; - - std::unique_ptr<RealWGLApi> api_; -}; - -const char* WGLApiTest::fake_ext_extension_string_ = ""; -const char* WGLApiTest::fake_arb_extension_string_ = ""; - -TEST_F(WGLApiTest, DisabledExtensionBitTest) { - static const char* kFakeExtensions = "WGL_ARB_extensions_string"; - static const char* kFakeDisabledExtensions = "WGL_ARB_extensions_string"; - - InitializeAPI(nullptr); - - EXPECT_FALSE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); - - // NULL simulates not being able to resolve wglGetExtensionsStringARB - SetFakeARBExtensionString(nullptr); - SetFakeEXTExtensionString(kFakeExtensions); - - InitializeAPI(nullptr); - EXPECT_TRUE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); - - InitializeAPI(kFakeExtensions); - EXPECT_FALSE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); - - SetFakeARBExtensionString(""); - SetFakeEXTExtensionString(kFakeExtensions); - - InitializeAPI(nullptr); - // We expect false here, because wglGetExtensionsStringARB - // always takes precedence over wglGetExtensionsStringEXT - // if it is available. - EXPECT_FALSE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); - - SetFakeARBExtensionString(kFakeExtensions); - SetFakeEXTExtensionString(""); - - InitializeAPI(nullptr); - EXPECT_TRUE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); - - InitializeAPI(kFakeDisabledExtensions); - EXPECT_FALSE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); -} - -TEST_F(WGLApiTest, DisabledExtensionStringTest) { - static const char* kFakeExtensions = "EGL_EXT_1 EGL_EXT_2" - " EGL_EXT_3 EGL_EXT_4"; - static const char* kFakeDisabledExtensions = - "EGL_EXT_1,EGL_EXT_2,EGL_FAKE"; - static const char* kFilteredExtensions = "EGL_EXT_3 EGL_EXT_4"; - - SetFakeARBExtensionString(kFakeExtensions); - SetFakeEXTExtensionString(kFakeExtensions); - - InitializeAPI(nullptr); - EXPECT_EQ(stringpair(kFakeExtensions, kFakeExtensions), - GetExtensions()); - - InitializeAPI(kFakeDisabledExtensions); - EXPECT_EQ(stringpair(kFilteredExtensions, kFilteredExtensions), - GetExtensions()); -} - -} // namespace gl
diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index 1dfe491..e5c0bf67 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn
@@ -121,12 +121,12 @@ "cr_elements/cr_checkbox/cr_checkbox.m.js", "cr_elements/cr_button/cr_button.m.js", "cr_elements/cr_action_menu/cr_action_menu.m.js", + "cr_elements/find_shortcut_behavior.m.js", "cr_elements/policy/cr_policy_indicator_behavior.m.js", "cr_elements/policy/cr_policy_indicator.m.js", "cr_elements/policy/cr_policy_pref_behavior.m.js", "cr_elements/policy/cr_policy_pref_indicator.m.js", "cr_elements/policy/cr_tooltip_icon.m.js", - "js/find_shortcut_behavior.m.js", "js/i18n_behavior.m.js", "js/list_property_update_behavior.m.js", "js/search_highlight_utils.m.js",
diff --git a/ui/webui/resources/cr_elements/BUILD.gn b/ui/webui/resources/cr_elements/BUILD.gn index a858d4c..7115350 100644 --- a/ui/webui/resources/cr_elements/BUILD.gn +++ b/ui/webui/resources/cr_elements/BUILD.gn
@@ -77,6 +77,7 @@ deps = [ ":cr_container_shadow_behavior", ":cr_scrollable_behavior", + ":find_shortcut_behavior", ] } @@ -88,6 +89,15 @@ deps = [ "//ui/webui/resources/js:assert" ] } +js_library("find_shortcut_behavior") { + deps = [ + "//ui/webui/resources/js:assert", + "//ui/webui/resources/js:cr", + "//ui/webui/resources/js:util", + "//ui/webui/resources/js/cr/ui:keyboard_shortcut_list", + ] +} + # Targets for auto-generating Polymer 3 JS Modules. polymer_modulizer("action_link_css") { @@ -148,8 +158,8 @@ input_files = [ "cr_container_shadow_behavior.js", "cr_scrollable_behavior.js", + "find_shortcut_behavior.js", ] - deps = [] } group("polymer3_elements") { @@ -207,6 +217,7 @@ deps = [ ":cr_container_shadow_behavior.m", ":cr_scrollable_behavior.m", + ":find_shortcut_behavior.m", ] } @@ -227,6 +238,19 @@ extra_deps = [ ":modulize" ] } +js_library("find_shortcut_behavior.m") { + sources = [ + "$root_gen_dir/ui/webui/resources/cr_elements/find_shortcut_behavior.m.js", + ] + deps = [ + "//ui/webui/resources/js:assert.m", + "//ui/webui/resources/js:cr.m", + "//ui/webui/resources/js:util.m", + "//ui/webui/resources/js/cr/ui:keyboard_shortcut_list.m", + ] + extra_deps = [ ":modulize" ] +} + html_to_js("web_components") { js_files = [ "mwb_shared_style.js",
diff --git a/ui/webui/resources/html/find_shortcut_behavior.html b/ui/webui/resources/cr_elements/find_shortcut_behavior.html similarity index 78% rename from ui/webui/resources/html/find_shortcut_behavior.html rename to ui/webui/resources/cr_elements/find_shortcut_behavior.html index 509fedd..175e467 100644 --- a/ui/webui/resources/html/find_shortcut_behavior.html +++ b/ui/webui/resources/cr_elements/find_shortcut_behavior.html
@@ -2,4 +2,4 @@ <link rel="import" href="../html/cr.html"> <link rel="import" href="../html/cr/ui/keyboard_shortcut_list.html"> <link rel="import" href="../html/util.html"> -<script src="../js/find_shortcut_behavior.js"></script> +<script src="find_shortcut_behavior.js"></script>
diff --git a/ui/webui/resources/js/find_shortcut_behavior.js b/ui/webui/resources/cr_elements/find_shortcut_behavior.js similarity index 93% rename from ui/webui/resources/js/find_shortcut_behavior.js rename to ui/webui/resources/cr_elements/find_shortcut_behavior.js index 5a70dd4..cee42c6 100644 --- a/ui/webui/resources/js/find_shortcut_behavior.js +++ b/ui/webui/resources/cr_elements/find_shortcut_behavior.js
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// #import {assert, assertNotReached} from './assert.m.js'; -// #import {isMac} from './cr.m.js'; -// #import {isTextInputElement} from './util.m.js'; -// #import {KeyboardShortcutList} from './cr/ui/keyboard_shortcut_list.m.js'; +// #import {assert, assertNotReached} from '../js/assert.m.js'; +// #import {isMac} from '../js/cr.m.js'; +// #import {isTextInputElement} from '../js/util.m.js'; +// #import {KeyboardShortcutList} from '../js/cr/ui/keyboard_shortcut_list.m.js'; /** * @fileoverview Listens for a find keyboard shortcut (i.e. Ctrl/Cmd+f or /)
diff --git a/ui/webui/resources/cr_elements_resources.grdp b/ui/webui/resources/cr_elements_resources.grdp index b2f7c58..ded4e7e62 100644 --- a/ui/webui/resources/cr_elements_resources.grdp +++ b/ui/webui/resources/cr_elements_resources.grdp
@@ -301,4 +301,8 @@ <structure name="IDR_CR_ELEMENTS_CR_TOAST_MANAGER_JS" file="cr_elements/cr_toast/cr_toast_manager.js" type="chrome_html" /> + <structure name="IDR_CR_ELEMENTS_FIND_SHORTCUT_BEHAVIOR_HTML" + file="cr_elements/find_shortcut_behavior.html" type="chrome_html" /> + <structure name="IDR_CR_ELEMENTS_FIND_SHORTCUT_BEHAVIOR_JS" + file="cr_elements/find_shortcut_behavior.js" type="chrome_html" /> </grit-part>
diff --git a/ui/webui/resources/cr_elements_resources_v3.grdp b/ui/webui/resources/cr_elements_resources_v3.grdp index bf6b0d3..d078c70 100644 --- a/ui/webui/resources/cr_elements_resources_v3.grdp +++ b/ui/webui/resources/cr_elements_resources_v3.grdp
@@ -156,6 +156,9 @@ file="${root_gen_dir}/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_selection_overlay.m.js" use_base_dir="false" type="BINDATA" /> + <include name="IDR_CR_ELEMENTS_FIND_SHORTCUT_BEHAVIOR_M_JS" + file="${root_gen_dir}/ui/webui/resources/cr_elements/find_shortcut_behavior.m.js" + use_base_dir="false" type="BINDATA" /> <include name="IDR_CR_ELEMENTS_POLICY_CR_TOOLTIP_ICON_M_JS" file="${root_gen_dir}/ui/webui/resources/cr_elements/policy/cr_tooltip_icon.m.js" use_base_dir="false"
diff --git a/ui/webui/resources/cr_polymer_resources.grdp b/ui/webui/resources/cr_polymer_resources.grdp index ac76a42..4ed463ad 100644 --- a/ui/webui/resources/cr_polymer_resources.grdp +++ b/ui/webui/resources/cr_polymer_resources.grdp
@@ -7,8 +7,6 @@ file="html/cr/ui/focus_row_behavior.html" type="chrome_html" /> <structure name="IDR_WEBUI_HTML_CR_UI_FOCUS_WITHOUT_INK" file="html/cr/ui/focus_without_ink.html" type="chrome_html" /> - <structure name="IDR_WEBUI_HTML_FIND_SHORTCUT_BEHAVIOR" - file="html/find_shortcut_behavior.html" type="chrome_html" /> <structure name="IDR_WEBUI_HTML_I18N_BEHAVIOR" file="html/i18n_behavior.html" type="chrome_html" /> <structure name="IDR_WEBUI_HTML_LIST_PROPERTY_UPDATE_BEHAVIOR" @@ -31,8 +29,6 @@ file="js/cr/ui/focus_row_behavior.js" type="chrome_html" /> <structure name="IDR_WEBUI_JS_CR_UI_FOCUS_WITHOUT_INK" file="js/cr/ui/focus_without_ink.js" type="chrome_html" /> - <structure name="IDR_WEBUI_JS_FIND_SHORTCUT_BEHAVIOR" - file="js/find_shortcut_behavior.js" type="chrome_html" /> <structure name="IDR_WEBUI_JS_LIST_PROPERTY_UPDATE_BEHAVIOR" file="js/list_property_update_behavior.js" type="chrome_html" /> <structure name="IDR_WEBUI_JS_POLYMER_CONFIG"
diff --git a/ui/webui/resources/cr_polymer_resources_v3.grdp b/ui/webui/resources/cr_polymer_resources_v3.grdp index 174ad76..2b3c979 100644 --- a/ui/webui/resources/cr_polymer_resources_v3.grdp +++ b/ui/webui/resources/cr_polymer_resources_v3.grdp
@@ -3,9 +3,6 @@ <include name="IDR_WEBUI_JS_CR_UI_FOCUS_ROW_BEHAVIOR_M_JS" file="${root_gen_dir}/ui/webui/resources/js/cr/ui/focus_row_behavior.m.js" use_base_dir="false" type="BINDATA" /> - <include name="IDR_WEBUI_JS_FIND_SHORTCUT_BEHAVIOR_M_JS" - file="${root_gen_dir}/ui/webui/resources/js/find_shortcut_behavior.m.js" - use_base_dir="false" type="BINDATA" /> <include name="IDR_WEBUI_JS_I18N_BEHAVIOR_M_JS" file="${root_gen_dir}/ui/webui/resources/js/i18n_behavior.m.js" use_base_dir="false" type="BINDATA"
diff --git a/ui/webui/resources/js/BUILD.gn b/ui/webui/resources/js/BUILD.gn index f7fa072..a74ecbc 100644 --- a/ui/webui/resources/js/BUILD.gn +++ b/ui/webui/resources/js/BUILD.gn
@@ -19,7 +19,6 @@ ":assert", ":cr", ":event_tracker", - ":find_shortcut_behavior", ":i18n_behavior", ":i18n_template_no_process", ":icon", @@ -114,22 +113,12 @@ externs_list = [ "dom_automation_controller.js" ] } -js_library("find_shortcut_behavior") { - deps = [ - ":assert", - ":cr", - ":util", - "cr/ui:keyboard_shortcut_list", - ] -} - # Targets for auto-generating and type-checking JS Modules js_modulizer("modulize") { input_files = [ "assert.js", "event_tracker.js", - "find_shortcut_behavior.js", "icon.js", "i18n_behavior.js", "list_property_update_behavior.js", @@ -142,7 +131,6 @@ ] namespace_rewrites = [ "cr.search_highlight_utils.Range|Range", - "cr.ui.KeyboardShortcutList|KeyboardShortcutList", "Polymer.ArraySplice.calculateSplices|calculateSplices", ] deps = [ "cr:modulize" ] @@ -161,7 +149,6 @@ ":assert.m", ":cr.m", ":event_tracker.m", - ":find_shortcut_behavior.m", ":i18n_behavior.m", ":icon.m", ":list_property_update_behavior.m", @@ -193,18 +180,6 @@ extra_deps = [ ":modulize" ] } -js_library("find_shortcut_behavior.m") { - sources = - [ "$root_gen_dir/ui/webui/resources/js/find_shortcut_behavior.m.js" ] - deps = [ - ":assert.m", - ":cr.m", - ":util.m", - "cr/ui:keyboard_shortcut_list.m", - ] - extra_deps = [ ":modulize" ] -} - js_library("icon.m") { sources = [ "$root_gen_dir/ui/webui/resources/js/icon.m.js" ] deps = [ ":cr.m" ]
diff --git a/ui/webui/resources/tools/js_modulizer.gni b/ui/webui/resources/tools/js_modulizer.gni index d6f29873..169566d 100644 --- a/ui/webui/resources/tools/js_modulizer.gni +++ b/ui/webui/resources/tools/js_modulizer.gni
@@ -23,6 +23,7 @@ "cr.ui.FocusOutlineManager|FocusOutlineManager", "cr.ui.FocusRowBehavior|FocusRowBehavior", "cr.ui.focusWithoutInk|focusWithoutInk", + "cr.ui.KeyboardShortcutList|KeyboardShortcutList", "cr.ui.Store|Store", "Polymer.dom.flush|flush", "Polymer.IronA11yAnnouncer|IronA11yAnnouncer",
diff --git a/weblayer/BUILD.gn b/weblayer/BUILD.gn index c56ceb2f..641e9be 100644 --- a/weblayer/BUILD.gn +++ b/weblayer/BUILD.gn
@@ -426,6 +426,8 @@ "//components/ssl_errors", "//components/startup_metric_utils/browser", "//components/strings", + "//components/subresource_filter/content/browser", + "//components/subresource_filter/core/browser", "//components/translate/content/browser", "//components/translate/content/renderer", "//components/translate/core/browser", @@ -543,6 +545,10 @@ "browser/js_communication/web_message_host_factory_proxy.h", "browser/js_communication/web_message_reply_proxy_impl.cc", "browser/js_communication/web_message_reply_proxy_impl.h", + "browser/media/local_presentation_manager_factory.cc", + "browser/media/local_presentation_manager_factory.h", + "browser/media/media_router_factory.cc", + "browser/media/media_router_factory.h", "browser/new_tab_callback_proxy.cc", "browser/new_tab_callback_proxy.h", "browser/safe_browsing/real_time_url_lookup_service_factory.cc", @@ -604,6 +610,7 @@ "//components/infobars/content", "//components/javascript_dialogs", "//components/location/android:settings", + "//components/media_router/browser", "//components/metrics", "//components/minidump_uploader", "//components/navigation_interception",
diff --git a/weblayer/browser/DEPS b/weblayer/browser/DEPS index f1a963c..fe3b8f3b 100644 --- a/weblayer/browser/DEPS +++ b/weblayer/browser/DEPS
@@ -30,6 +30,7 @@ "+components/keyed_service/content", "+components/keyed_service/core", "+components/language/core/browser", + "+components/media_router", "+components/metrics", "+components/navigation_interception", "+components/network_session_configurator", @@ -56,6 +57,8 @@ "+components/ssl_errors", "+components/startup_metric_utils", "+components/strings", + "+components/subresource_filter/content/browser", + "+components/subresource_filter/core/browser", "+components/translate/content/android", "+components/translate/content/browser", "+components/translate/core/browser",
diff --git a/weblayer/browser/browser_main_parts_impl.cc b/weblayer/browser/browser_main_parts_impl.cc index c738afc..eb9b363 100644 --- a/weblayer/browser/browser_main_parts_impl.cc +++ b/weblayer/browser/browser_main_parts_impl.cc
@@ -50,7 +50,10 @@ #include "net/base/network_change_notifier.h" #include "weblayer/browser/android/metrics/uma_utils.h" #include "weblayer/browser/java/jni/MojoInterfaceRegistrar_jni.h" +#include "weblayer/browser/media/local_presentation_manager_factory.h" +#include "weblayer/browser/media/media_router_factory.h" #include "weblayer/browser/weblayer_factory_impl_android.h" +#include "weblayer/common/features.h" #endif #if defined(USE_X11) @@ -86,6 +89,12 @@ TranslateRankerFactory::GetInstance(); PrerenderLinkManagerFactory::GetInstance(); PrerenderManagerFactory::GetInstance(); +#if defined(OS_ANDROID) + if (base::FeatureList::IsEnabled(features::kMediaRouter)) { + LocalPresentationManagerFactory::GetInstance(); + MediaRouterFactory::GetInstance(); + } +#endif } void StopMessageLoop(base::OnceClosure quit_closure) {
diff --git a/weblayer/browser/browser_process.cc b/weblayer/browser/browser_process.cc index ac39291..dc94fa2 100644 --- a/weblayer/browser/browser_process.cc +++ b/weblayer/browser/browser_process.cc
@@ -6,15 +6,18 @@ #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" +#include "base/path_service.h" #include "base/time/default_clock.h" #include "base/time/default_tick_clock.h" #include "components/network_time/network_time_tracker.h" #include "components/prefs/pref_service.h" +#include "components/subresource_filter/content/browser/ruleset_service.h" #include "content/public/browser/network_quality_observer_factory.h" #include "content/public/browser/network_service_instance.h" #include "services/network/public/cpp/network_quality_tracker.h" #include "weblayer/browser/system_network_context_manager.h" #include "weblayer/browser/user_agent.h" +#include "weblayer/common/weblayer_paths.h" #if defined(OS_ANDROID) #include "weblayer/browser/safe_browsing/safe_browsing_service.h" @@ -92,6 +95,14 @@ return network_quality_tracker_.get(); } +subresource_filter::RulesetService* +BrowserProcess::subresource_filter_ruleset_service() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (!subresource_filter_ruleset_service_) + CreateSubresourceFilterRulesetService(); + return subresource_filter_ruleset_service_.get(); +} + void BrowserProcess::CreateNetworkQualityObserver() { DCHECK(!network_quality_observer_); network_quality_observer_ = @@ -99,6 +110,16 @@ DCHECK(network_quality_observer_); } +void BrowserProcess::CreateSubresourceFilterRulesetService() { + DCHECK(!subresource_filter_ruleset_service_); + + base::FilePath user_data_dir; + CHECK(base::PathService::Get(DIR_USER_DATA, &user_data_dir)); + subresource_filter_ruleset_service_ = + subresource_filter::RulesetService::Create(GetLocalState(), + user_data_dir); +} + #if defined(OS_ANDROID) SafeBrowsingService* BrowserProcess::GetSafeBrowsingService() { if (!safe_browsing_service_) {
diff --git a/weblayer/browser/browser_process.h b/weblayer/browser/browser_process.h index 08540a6..1d8e77a 100644 --- a/weblayer/browser/browser_process.h +++ b/weblayer/browser/browser_process.h
@@ -23,6 +23,10 @@ class SharedURLLoaderFactory; } +namespace subresource_filter { +class RulesetService; +} + namespace weblayer { class SafeBrowsingService; @@ -48,6 +52,10 @@ network_time::NetworkTimeTracker* GetNetworkTimeTracker(); network::NetworkQualityTracker* GetNetworkQualityTracker(); + // Returns the service providing versioned storage for rules used by the Safe + // Browsing subresource filter. May be null. + subresource_filter::RulesetService* subresource_filter_ruleset_service(); + #if defined(OS_ANDROID) SafeBrowsingService* GetSafeBrowsingService(); void StopSafeBrowsingService(); @@ -55,6 +63,7 @@ private: void CreateNetworkQualityObserver(); + void CreateSubresourceFilterRulesetService(); std::unique_ptr<PrefService> local_state_; std::unique_ptr<network_time::NetworkTimeTracker> network_time_tracker_; @@ -66,6 +75,9 @@ network::NetworkQualityTracker::RTTAndThroughputEstimatesObserver> network_quality_observer_; + std::unique_ptr<subresource_filter::RulesetService> + subresource_filter_ruleset_service_; + #if defined(OS_ANDROID) std::unique_ptr<SafeBrowsingService> safe_browsing_service_; #endif
diff --git a/weblayer/browser/content_browser_client_impl.cc b/weblayer/browser/content_browser_client_impl.cc index 0e4b6dcd..d85397a 100644 --- a/weblayer/browser/content_browser_client_impl.cc +++ b/weblayer/browser/content_browser_client_impl.cc
@@ -39,6 +39,7 @@ #include "components/site_isolation/preloaded_isolated_origins.h" #include "components/site_isolation/site_isolation_policy.h" #include "components/strings/grit/components_locale_settings.h" +#include "components/subresource_filter/content/browser/ruleset_version.h" #include "components/user_prefs/user_prefs.h" #include "components/variations/service/variations_service.h" #include "content/public/browser/browser_context.h" @@ -113,6 +114,7 @@ #include "components/cdm/browser/media_drm_storage_impl.h" // nogncheck #include "components/crash/content/browser/crash_handler_host_linux.h" #include "components/embedder_support/android/metrics/android_metrics_service_client.h" +#include "components/media_router/browser/presentation/presentation_service_delegate_impl.h" // nogncheck #include "components/navigation_interception/intercept_navigation_delegate.h" #include "components/safe_browsing/core/realtime/policy_engine.h" // nogncheck #include "components/safe_browsing/core/realtime/url_lookup_service.h" // nogncheck @@ -125,6 +127,7 @@ #include "weblayer/browser/android_descriptors.h" #include "weblayer/browser/browser_context_impl.h" #include "weblayer/browser/devtools_manager_delegate_android.h" +#include "weblayer/browser/media/media_router_factory.h" #include "weblayer/browser/safe_browsing/real_time_url_lookup_service_factory.h" #include "weblayer/browser/safe_browsing/safe_browsing_service.h" #include "weblayer/browser/tts_environment_android_impl.h" @@ -245,6 +248,7 @@ metrics::AndroidMetricsServiceClient::RegisterPrefs(pref_registry); #endif variations::VariationsService::RegisterPrefs(pref_registry); + subresource_filter::IndexedRulesetVersion::RegisterPrefs(pref_registry); } mojo::PendingRemote<prerender::mojom::PrerenderCanceler> GetPrerenderCanceler( @@ -629,6 +633,20 @@ web_contents->GetBrowserContext())) != nullptr; } +content::ControllerPresentationServiceDelegate* +ContentBrowserClientImpl::GetControllerPresentationServiceDelegate( + content::WebContents* web_contents) { +#if defined(OS_ANDROID) + if (base::FeatureList::IsEnabled(features::kMediaRouter)) { + MediaRouterFactory::DoPlatformInitIfNeeded(); + return media_router::PresentationServiceDelegateImpl:: + GetOrCreateForWebContents(web_contents); + } +#endif + + return nullptr; +} + std::vector<std::unique_ptr<content::NavigationThrottle>> ContentBrowserClientImpl::CreateThrottlesForNavigation( content::NavigationHandle* handle) {
diff --git a/weblayer/browser/content_browser_client_impl.h b/weblayer/browser/content_browser_client_impl.h index 967ff92..158febe 100644 --- a/weblayer/browser/content_browser_client_impl.h +++ b/weblayer/browser/content_browser_client_impl.h
@@ -90,6 +90,9 @@ bool user_gesture, bool opener_suppressed, bool* no_javascript_access) override; + content::ControllerPresentationServiceDelegate* + GetControllerPresentationServiceDelegate( + content::WebContents* web_contents) override; std::vector<std::unique_ptr<content::NavigationThrottle>> CreateThrottlesForNavigation(content::NavigationHandle* handle) override; content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
diff --git a/weblayer/browser/java/BUILD.gn b/weblayer/browser/java/BUILD.gn index 6e4733b..f09b2f0 100644 --- a/weblayer/browser/java/BUILD.gn +++ b/weblayer/browser/java/BUILD.gn
@@ -114,8 +114,6 @@ "org/chromium/weblayer_private/IntentUtils.java", "org/chromium/weblayer_private/InterceptNavigationDelegateClientImpl.java", "org/chromium/weblayer_private/LocaleChangedBroadcastReceiver.java", - "org/chromium/weblayer_private/MediaSessionManager.java", - "org/chromium/weblayer_private/MediaStreamManager.java", "org/chromium/weblayer_private/MojoInterfaceRegistrar.java", "org/chromium/weblayer_private/NavigationControllerImpl.java", "org/chromium/weblayer_private/NavigationImpl.java", @@ -140,6 +138,9 @@ "org/chromium/weblayer_private/WebLayerTabModalPresenter.java", "org/chromium/weblayer_private/WebMessageReplyProxyImpl.java", "org/chromium/weblayer_private/WebShareServiceFactory.java", + "org/chromium/weblayer_private/media/MediaRouterClientImpl.java", + "org/chromium/weblayer_private/media/MediaSessionManager.java", + "org/chromium/weblayer_private/media/MediaStreamManager.java", "org/chromium/weblayer_private/metrics/MetricsServiceClient.java", "org/chromium/weblayer_private/metrics/UmaUtils.java", "org/chromium/weblayer_private/permissions/PermissionRequestUtils.java", @@ -193,6 +194,7 @@ "//components/infobars/core:infobar_enums_java", "//components/javascript_dialogs/android:java", "//components/location/android:settings_java", + "//components/media_router/browser/android:java", "//components/metrics:metrics_java", "//components/minidump_uploader:minidump_uploader_java", "//components/navigation_interception/android:navigation_interception_java", @@ -312,7 +314,6 @@ "org/chromium/weblayer_private/GoogleAccountsCallbackProxy.java", "org/chromium/weblayer_private/InfoBarContainer.java", "org/chromium/weblayer_private/LocaleChangedBroadcastReceiver.java", - "org/chromium/weblayer_private/MediaStreamManager.java", "org/chromium/weblayer_private/MojoInterfaceRegistrar.java", "org/chromium/weblayer_private/NavigationControllerImpl.java", "org/chromium/weblayer_private/NavigationImpl.java", @@ -327,6 +328,8 @@ "org/chromium/weblayer_private/WebLayerImpl.java", "org/chromium/weblayer_private/WebMessageReplyProxyImpl.java", "org/chromium/weblayer_private/WebViewCompatibilityHelperImpl.java", + "org/chromium/weblayer_private/media/MediaRouterClientImpl.java", + "org/chromium/weblayer_private/media/MediaStreamManager.java", "org/chromium/weblayer_private/metrics/MetricsServiceClient.java", "org/chromium/weblayer_private/metrics/UmaUtils.java", "org/chromium/weblayer_private/permissions/PermissionRequestUtils.java",
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/CrashReporterControllerImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/CrashReporterControllerImpl.java index 5318bcc..244b369 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/CrashReporterControllerImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/CrashReporterControllerImpl.java
@@ -15,6 +15,7 @@ import org.chromium.base.Log; import org.chromium.base.PathUtils; +import org.chromium.base.TraceEvent; import org.chromium.base.task.AsyncTask; import org.chromium.components.crash.browser.ChildProcessCrashObserver; import org.chromium.components.minidump_uploader.CrashFileManager; @@ -79,6 +80,7 @@ public void uploadCrash(String localId) { StrictModeWorkaround.apply(); AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> { + TraceEvent.instant(TAG, "CrashReporterController: Begin uploading crash"); File minidumpFile = getCrashFileManager().getCrashFileWithLocalId(localId); MinidumpUploader.Result result = new MinidumpUploader().upload(minidumpFile); if (result.isSuccess()) { @@ -88,8 +90,10 @@ } try { if (result.isSuccess()) { + TraceEvent.instant(TAG, "CrashReporterController: Crash upload succeeded."); mClient.onCrashUploadSucceeded(localId, result.message()); } else { + TraceEvent.instant(TAG, "CrashReporterController: Crash upload failed."); mClient.onCrashUploadFailed(localId, result.message()); } } catch (RemoteException e) { @@ -139,10 +143,12 @@ } // Now that there is a client, register to observe child process crashes. + TraceEvent.instant(TAG, "Start observing child process crashes"); ChildProcessCrashObserver.registerCrashCallback( new ChildProcessCrashObserver.ChildCrashedCallback() { @Override public void childCrashed(int pid) { + TraceEvent.instant(TAG, "Child process crashed. Process new minidumps."); processNewMinidumps(); } }); @@ -183,6 +189,8 @@ * @return An array of local IDs for crashes that are ready to be uploaded. */ private String[] getPendingMinidumpsOnBackgroundThread() { + TraceEvent.instant( + TAG, "CrashReporterController: Start determining crashes ready to be uploaded."); getCrashFileManager().cleanOutAllNonFreshMinidumpFiles(); File[] pendingMinidumps = getCrashFileManager().getMinidumpsReadyForUpload(MAX_UPLOAD_RETRIES); @@ -190,6 +198,8 @@ for (File minidump : pendingMinidumps) { localIds.add(CrashFileManager.getCrashLocalIdFromFileName(minidump.getName())); } + TraceEvent.instant( + TAG, "CrashReporterController: Finish determinining crashes ready to be uploaded."); return localIds.toArray(new String[0]); } @@ -202,6 +212,8 @@ * @return An array of local IDs of the new crashes (may be empty). */ private String[] processNewMinidumpsOnBackgroundThread() { + TraceEvent.instant( + TAG, "CrashReporterController: Start processing minidumps in the background."); Map<String, Map<String, String>> crashesInfoMap = getCrashFileManager().importMinidumpsCrashKeys(); if (crashesInfoMap == null) return new String[0]; @@ -217,6 +229,8 @@ for (File minidump : getCrashFileManager().getMinidumpsSansLogcat()) { CrashFileManager.trySetReadyForUpload(minidump); } + TraceEvent.instant( + TAG, "CrashReporterController: Finish processing minidumps in the background."); return localIds.toArray(new String[0]); }
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java index 612cef9..acfbee1 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java
@@ -72,6 +72,8 @@ import org.chromium.weblayer_private.interfaces.ObjectWrapper; import org.chromium.weblayer_private.interfaces.ScrollNotificationType; import org.chromium.weblayer_private.interfaces.StrictModeWorkaround; +import org.chromium.weblayer_private.media.MediaSessionManager; +import org.chromium.weblayer_private.media.MediaStreamManager; import java.util.ArrayList; import java.util.HashMap;
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerFactoryImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerFactoryImpl.java index 07c937b..7c85555 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerFactoryImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerFactoryImpl.java
@@ -74,7 +74,7 @@ } @CalledByNative - static int getClientMajorVersion() { + public static int getClientMajorVersion() { if (sClientMajorVersion == 0) { throw new IllegalStateException( "This should only be called once WebLayer is initialized");
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerImpl.java index 90fce8a..2a7d808 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerImpl.java
@@ -74,6 +74,8 @@ import org.chromium.weblayer_private.interfaces.IWebLayerClient; import org.chromium.weblayer_private.interfaces.ObjectWrapper; import org.chromium.weblayer_private.interfaces.StrictModeWorkaround; +import org.chromium.weblayer_private.media.MediaSessionManager; +import org.chromium.weblayer_private.media.MediaStreamManager; import org.chromium.weblayer_private.metrics.MetricsServiceClient; import org.chromium.weblayer_private.metrics.UmaUtils;
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationChannels.java b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationChannels.java index 5967d90d6..725b58c 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationChannels.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationChannels.java
@@ -25,8 +25,9 @@ import java.util.Map; import java.util.Set; +/** Defines notification channels for WebLayer. */ @TargetApi(Build.VERSION_CODES.O) -class WebLayerNotificationChannels extends ChannelDefinitions { +public class WebLayerNotificationChannels extends ChannelDefinitions { /** * Version number identifying the current set of channels. This must be incremented whenever the * set of channels returned by {@link #getStartupChannelIds()} or {@link #getLegacyChannelIds()}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationWrapperBuilder.java b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationWrapperBuilder.java index fac8a47..6869702 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationWrapperBuilder.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/WebLayerNotificationWrapperBuilder.java
@@ -22,7 +22,7 @@ import org.chromium.components.browser_ui.notifications.channels.ChannelsInitializer; /** A notification builder for WebLayer which has extra logic to make icons work correctly. */ -final class WebLayerNotificationWrapperBuilder extends NotificationWrapperStandardBuilder { +public final class WebLayerNotificationWrapperBuilder extends NotificationWrapperStandardBuilder { /** Creates a notification builder. */ public static WebLayerNotificationWrapperBuilder create( @WebLayerNotificationChannels.ChannelId String channelId,
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/media/MediaRouterClientImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/media/MediaRouterClientImpl.java new file mode 100644 index 0000000..bfe048c --- /dev/null +++ b/weblayer/browser/java/org/chromium/weblayer_private/media/MediaRouterClientImpl.java
@@ -0,0 +1,51 @@ +// 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. + +package org.chromium.weblayer_private.media; + +import android.content.Intent; + +import androidx.fragment.app.FragmentManager; + +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.JNINamespace; +import org.chromium.components.browser_ui.media.MediaNotificationInfo; +import org.chromium.components.media_router.MediaRouterClient; +import org.chromium.content_public.browser.WebContents; +import org.chromium.weblayer_private.IntentUtils; +import org.chromium.weblayer_private.TabImpl; + +/** Provides WebLayer-specific behavior for Media Router. */ +@JNINamespace("weblayer") +public class MediaRouterClientImpl extends MediaRouterClient { + private MediaRouterClientImpl() {} + + @Override + public int getTabId(WebContents webContents) { + TabImpl tab = TabImpl.fromWebContents(webContents); + return tab == null ? -1 : tab.getId(); + } + + @Override + public Intent createBringTabToFrontIntent(int tabId) { + return IntentUtils.createBringTabToFrontIntent(tabId); + } + + @Override + public void showNotification(MediaNotificationInfo notificationInfo) { + // TODO: implement. + } + + @Override + public FragmentManager getSupportFragmentManager(WebContents initiator) { + return null; + } + + @CalledByNative + public static void initialize() { + if (MediaRouterClient.getInstance() != null) return; + + MediaRouterClient.setInstance(new MediaRouterClientImpl()); + } +}
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/MediaSessionManager.java b/weblayer/browser/java/org/chromium/weblayer_private/media/MediaSessionManager.java similarity index 91% rename from weblayer/browser/java/org/chromium/weblayer_private/MediaSessionManager.java rename to weblayer/browser/java/org/chromium/weblayer_private/media/MediaSessionManager.java index de8af9cc..3311c77 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/MediaSessionManager.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/media/MediaSessionManager.java
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.weblayer_private; +package org.chromium.weblayer_private.media; import android.app.Service; import android.content.Intent; @@ -16,6 +16,10 @@ import org.chromium.components.browser_ui.notifications.NotificationMetadata; import org.chromium.components.browser_ui.notifications.NotificationWrapper; import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder; +import org.chromium.weblayer_private.IntentUtils; +import org.chromium.weblayer_private.WebLayerImpl; +import org.chromium.weblayer_private.WebLayerNotificationChannels; +import org.chromium.weblayer_private.WebLayerNotificationWrapperBuilder; /** * A glue class for MediaSession. @@ -23,10 +27,10 @@ * It also manages the lifetime of {@link MediaNotificationController} and the {@link Service} * associated with the notification. */ -class MediaSessionManager { +public class MediaSessionManager { private static int sNotificationId; - static void serviceStarted(Service service, Intent intent) { + public static void serviceStarted(Service service, Intent intent) { MediaNotificationController controller = getController(); if (controller != null && controller.processIntent(service, intent)) return; @@ -41,13 +45,13 @@ service.stopSelf(); } - static void serviceDestroyed() { + public static void serviceDestroyed() { MediaNotificationController controller = getController(); if (controller != null) controller.onServiceDestroyed(); MediaNotificationManager.clear(getNotificationId()); } - static MediaSessionHelper.Delegate createMediaSessionHelperDelegate(int tabId) { + public static MediaSessionHelper.Delegate createMediaSessionHelperDelegate(int tabId) { return new MediaSessionHelper.Delegate() { @Override public Intent createBringTabToFrontIntent() {
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/MediaStreamManager.java b/weblayer/browser/java/org/chromium/weblayer_private/media/MediaStreamManager.java similarity index 96% rename from weblayer/browser/java/org/chromium/weblayer_private/MediaStreamManager.java rename to weblayer/browser/java/org/chromium/weblayer_private/media/MediaStreamManager.java index 99232d8..3208aea 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/MediaStreamManager.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/media/MediaStreamManager.java
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.weblayer_private; +package org.chromium.weblayer_private.media; import android.app.NotificationManager; import android.content.Context; @@ -25,6 +25,12 @@ import org.chromium.components.webrtc.MediaCaptureNotificationUtil; import org.chromium.components.webrtc.MediaCaptureNotificationUtil.MediaType; import org.chromium.content_public.browser.WebContents; +import org.chromium.weblayer_private.IntentUtils; +import org.chromium.weblayer_private.TabImpl; +import org.chromium.weblayer_private.WebLayerFactoryImpl; +import org.chromium.weblayer_private.WebLayerImpl; +import org.chromium.weblayer_private.WebLayerNotificationChannels; +import org.chromium.weblayer_private.WebLayerNotificationWrapperBuilder; import org.chromium.weblayer_private.interfaces.IMediaCaptureCallbackClient; import org.chromium.weblayer_private.interfaces.ObjectWrapper;
diff --git a/weblayer/browser/media/local_presentation_manager_factory.cc b/weblayer/browser/media/local_presentation_manager_factory.cc new file mode 100644 index 0000000..84d183b6 --- /dev/null +++ b/weblayer/browser/media/local_presentation_manager_factory.cc
@@ -0,0 +1,27 @@ +// 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 "weblayer/browser/media/local_presentation_manager_factory.h" + +#include "base/no_destructor.h" + +namespace weblayer { + +// static +LocalPresentationManagerFactory* +LocalPresentationManagerFactory::GetInstance() { + static base::NoDestructor<LocalPresentationManagerFactory> instance; + return instance.get(); +} + +LocalPresentationManagerFactory::LocalPresentationManagerFactory() = default; +LocalPresentationManagerFactory::~LocalPresentationManagerFactory() = default; + +content::BrowserContext* +LocalPresentationManagerFactory::GetBrowserContextToUse( + content::BrowserContext* context) const { + return context; +} + +} // namespace weblayer
diff --git a/weblayer/browser/media/local_presentation_manager_factory.h b/weblayer/browser/media/local_presentation_manager_factory.h new file mode 100644 index 0000000..6002bb3 --- /dev/null +++ b/weblayer/browser/media/local_presentation_manager_factory.h
@@ -0,0 +1,46 @@ +// 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 WEBLAYER_BROWSER_MEDIA_LOCAL_PRESENTATION_MANAGER_FACTORY_H_ +#define WEBLAYER_BROWSER_MEDIA_LOCAL_PRESENTATION_MANAGER_FACTORY_H_ + +#include "components/media_router/browser/presentation/local_presentation_manager_factory.h" + +namespace base { +template <typename T> +class NoDestructor; +} + +namespace content { +class BrowserContext; +} + +namespace weblayer { + +// A version of LocalPresentationManagerFactory that does not redirect from +// incognito to normal context. +class LocalPresentationManagerFactory + : public media_router::LocalPresentationManagerFactory { + public: + LocalPresentationManagerFactory(const LocalPresentationManagerFactory&) = + delete; + LocalPresentationManagerFactory& operator=( + const LocalPresentationManagerFactory&) = delete; + + static LocalPresentationManagerFactory* GetInstance(); + + private: + friend base::NoDestructor<LocalPresentationManagerFactory>; + + LocalPresentationManagerFactory(); + ~LocalPresentationManagerFactory() override; + + // BrowserContextKeyedServiceFactory interface. + content::BrowserContext* GetBrowserContextToUse( + content::BrowserContext* context) const override; +}; + +} // namespace weblayer + +#endif // WEBLAYER_BROWSER_MEDIA_LOCAL_PRESENTATION_MANAGER_FACTORY_H_
diff --git a/weblayer/browser/media/media_router_factory.cc b/weblayer/browser/media/media_router_factory.cc new file mode 100644 index 0000000..be8e600 --- /dev/null +++ b/weblayer/browser/media/media_router_factory.cc
@@ -0,0 +1,60 @@ +// 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 "weblayer/browser/media/media_router_factory.h" + +#include "base/android/jni_android.h" +#include "base/no_destructor.h" +#include "components/media_router/browser/android/media_router_android.h" +#include "components/media_router/browser/android/media_router_dialog_controller_android.h" +#include "components/media_router/browser/media_router_dialog_controller.h" +#include "content/public/browser/browser_context.h" +#include "weblayer/browser/java/jni/MediaRouterClientImpl_jni.h" + +namespace weblayer { + +// static +MediaRouterFactory* MediaRouterFactory::GetInstance() { + static base::NoDestructor<MediaRouterFactory> instance; + return instance.get(); +} + +// static +void MediaRouterFactory::DoPlatformInitIfNeeded() { + static bool init_done = false; + if (init_done) + return; + + Java_MediaRouterClientImpl_initialize(base::android::AttachCurrentThread()); + + media_router::MediaRouterDialogController::SetGetOrCreate( + base::BindRepeating([](content::WebContents* web_contents) { + DCHECK(web_contents); + // This call does nothing if the controller already exists. + media_router::MediaRouterDialogControllerAndroid::CreateForWebContents( + web_contents); + return static_cast<media_router::MediaRouterDialogController*>( + media_router::MediaRouterDialogControllerAndroid::FromWebContents( + web_contents)); + })); + init_done = true; +} + +MediaRouterFactory::MediaRouterFactory() = default; +MediaRouterFactory::~MediaRouterFactory() = default; + +content::BrowserContext* MediaRouterFactory::GetBrowserContextToUse( + content::BrowserContext* context) const { + return context; +} + +KeyedService* MediaRouterFactory::BuildServiceInstanceFor( + content::BrowserContext* context) const { + media_router::MediaRouterBase* media_router = + new media_router::MediaRouterAndroid(); + media_router->Initialize(); + return media_router; +} + +} // namespace weblayer
diff --git a/weblayer/browser/media/media_router_factory.h b/weblayer/browser/media/media_router_factory.h new file mode 100644 index 0000000..947e750 --- /dev/null +++ b/weblayer/browser/media/media_router_factory.h
@@ -0,0 +1,46 @@ +// 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 WEBLAYER_BROWSER_MEDIA_MEDIA_ROUTER_FACTORY_H_ +#define WEBLAYER_BROWSER_MEDIA_MEDIA_ROUTER_FACTORY_H_ + +#include "components/media_router/browser/media_router_factory.h" + +namespace base { +template <typename T> +class NoDestructor; +} + +namespace content { +class BrowserContext; +} + +namespace weblayer { + +class MediaRouterFactory : public media_router::MediaRouterFactory { + public: + MediaRouterFactory(const MediaRouterFactory&) = delete; + MediaRouterFactory& operator=(const MediaRouterFactory&) = delete; + + static MediaRouterFactory* GetInstance(); + + // Performs platform and WebLayer-specific initialization for media_router. + static void DoPlatformInitIfNeeded(); + + private: + friend base::NoDestructor<MediaRouterFactory>; + + MediaRouterFactory(); + ~MediaRouterFactory() override; + + // MediaRouterFactory: + content::BrowserContext* GetBrowserContextToUse( + content::BrowserContext* context) const override; + KeyedService* BuildServiceInstanceFor( + content::BrowserContext* context) const override; +}; + +} // namespace weblayer + +#endif // WEBLAYER_BROWSER_MEDIA_MEDIA_ROUTER_FACTORY_H_
diff --git a/weblayer/browser/subresource_filter_browsertest.cc b/weblayer/browser/subresource_filter_browsertest.cc new file mode 100644 index 0000000..8f5435e --- /dev/null +++ b/weblayer/browser/subresource_filter_browsertest.cc
@@ -0,0 +1,26 @@ +// 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 "testing/gtest/include/gtest/gtest.h" +#include "weblayer/browser/browser_process.h" +#include "weblayer/test/weblayer_browser_test.h" + +namespace weblayer { + +class SubresourceFilterBrowserTest : public WebLayerBrowserTest { + public: + SubresourceFilterBrowserTest() = default; + ~SubresourceFilterBrowserTest() override = default; + SubresourceFilterBrowserTest(const SubresourceFilterBrowserTest&) = delete; + SubresourceFilterBrowserTest& operator=(const SubresourceFilterBrowserTest&) = + delete; +}; + +// Tests that the ruleset service is available. +IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, RulesetService) { + EXPECT_NE(BrowserProcess::GetInstance()->subresource_filter_ruleset_service(), + nullptr); +} + +} // namespace weblayer
diff --git a/weblayer/common/features.cc b/weblayer/common/features.cc index 69ac12b..162e5cec 100644 --- a/weblayer/common/features.cc +++ b/weblayer/common/features.cc
@@ -9,6 +9,11 @@ // Weblayer features in alphabetical order. +// Covers all media router features, i.e. Presentation API, Remote Playback API, +// and Media Fling (automatic casting of html5 videos). +const base::Feature kMediaRouter{"WebLayerMediaRouter", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Safebrowsing support for weblayer. const base::Feature kWebLayerSafeBrowsing{"WebLayerSafeBrowsing", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/weblayer/common/features.h b/weblayer/common/features.h index cf083ad..295ca6d 100644 --- a/weblayer/common/features.h +++ b/weblayer/common/features.h
@@ -12,6 +12,8 @@ // Weblayer features in alphabetical order. +extern const base::Feature kMediaRouter; + extern const base::Feature kWebLayerSafeBrowsing; } // namespace features
diff --git a/weblayer/test/BUILD.gn b/weblayer/test/BUILD.gn index 94d98ea..60f7b96 100644 --- a/weblayer/test/BUILD.gn +++ b/weblayer/test/BUILD.gn
@@ -149,6 +149,7 @@ "../browser/profile_browsertest.cc", "../browser/site_isolation_browsertest.cc", "../browser/ssl_browsertest.cc", + "../browser/subresource_filter_browsertest.cc", "../browser/translate_browsertest.cc", "../browser/url_bar/url_bar_browsertest.cc", "../browser/weblayer_variations_http_browsertest.cc",