diff --git a/DEPS b/DEPS index 8dd3ea5c..07f043e9 100644 --- a/DEPS +++ b/DEPS
@@ -213,7 +213,7 @@ # luci-go CIPD package version. # Make sure the revision is uploaded by infra-packagers builder. # https://ci.chromium.org/p/infra-internal/g/infra-packagers/console - 'luci_go': 'git_revision:d1e877e2b3e5a05a5cd34c4a340fedba14a16c2b', + 'luci_go': 'git_revision:5b02a4aaeb5fd78d6fe41d6d54d1cb58da17f192', # This can be overridden, e.g. with custom_vars, to build clang from HEAD # instead of downloading the prebuilt pinned revision. @@ -245,7 +245,7 @@ # 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': 'd0c5af65231841e09eee189e14417530e9a81974', + 'skia_revision': '8bf4a85e30eb02be5197b666217381387c153d2d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -384,7 +384,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libavif # and whatever else without interference from each other. - 'libavif_revision': 'ded15fb7b41b0513e138ba457034a2fb91c1f2c9', + 'libavif_revision': '97306bf64266cf9571dd141f3d04492534a9deea', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling nearby # and whatever else without interference from each other. @@ -1044,7 +1044,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'b674278ce71b2ee683b8b0c98c9a64152988ecdb', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'a657331e90e23e289e85a92af49b64829151f403', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1075,7 +1075,7 @@ Var('chromium_git') + '/external/github.com/google/farmhash.git' + '@' + '816a4ae622e964763ca0862d9dbd19324a1eaf45', 'src/third_party/ffmpeg': - Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '53de560ab9b797efa43c7e2643cde1be5dcc2450', + Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '1edb3eb4914e0545e9775939ead4a5795746f993', 'src/third_party/flac': Var('chromium_git') + '/chromium/deps/flac.git' + '@' + 'af862024c8c8fa0ae07ced05e89013d881b00596', @@ -1427,7 +1427,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '645a5c0de636e50b64ea256da8a722954d3c37ca', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '264b14398411687bf02004c083dc37e57fc5700e', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1648,7 +1648,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'fc207904abbb29864991c71c7156336455a3d892', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '63c458586590330644fa1f0b66a4e5e3a72acf7f', + Var('webrtc_git') + '/src.git' + '@' + '6d56a8cdc7a97bdfc02f45ddc928808e4a2a41e8', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1718,7 +1718,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@c265f4235a719acb3e3e8f57bf55dcb0d7b3c770', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@bccf568ea28ec04995b22393fa8ff04bd06e62c7', 'condition': 'checkout_src_internal', },
diff --git a/WATCHLISTS b/WATCHLISTS index 8875c2a..611df15 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -677,7 +677,9 @@ '|net/cert/sct_status_flags.h'\ '|net/cert/signed_certificate_timestamp'\ '|net/cert/signed_tree_head'\ - '|net/test/ct_', + '|net/services/network/sct_auditing/'\ + '|net/services/network/ct_'\ + '|net/test/ct_' }, 'chrome_camera_app': { 'filepath': # Exclude string translation .xtb files. @@ -2376,7 +2378,7 @@ 'cc-animation': ['gerchiko@microsoft.com'], 'cc-display': ['penghuang+viz@chromium.org'], 'cc-scheduler': ['scheduler-bugs+cc@chromium.org'], - 'certificate_transparency': ['certificate-transparency-chrome@googlegroups.com', + 'certificate_transparency': ['jdeblasio+watch@chromium.org', 'martijn+crwatch@martijnc.be', 'rsleevi+watch@chromium.org'], 'chrome_camera_app': ['chromeos-camera-app-eng@google.com'],
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index cf038d9..9e038a5 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1611,6 +1611,8 @@ "tray_action/tray_action.cc", "tray_action/tray_action.h", "tray_action/tray_action_observer.h", + "utility/haptics_util.cc", + "utility/haptics_util.h", "utility/layer_copy_animator.cc", "utility/layer_copy_animator.h", "utility/layer_util.cc", @@ -1754,8 +1756,6 @@ "wm/gestures/wm_fling_handler.h", "wm/gestures/wm_gesture_handler.cc", "wm/gestures/wm_gesture_handler.h", - "wm/haptics_util.cc", - "wm/haptics_util.h", "wm/immersive_context_ash.cc", "wm/immersive_context_ash.h", "wm/lock_action_handler_layout_manager.cc", @@ -2636,6 +2636,7 @@ "tray_action/test_tray_action_client.cc", "tray_action/test_tray_action_client.h", "tray_action/tray_action_unittest.cc", + "utility/haptics_util_unittest.cc", "utility/layer_copy_animator_unittest.cc", "utility/layer_util_unittest.cc", "utility/occlusion_tracker_pauser_unittest.cc", @@ -2664,7 +2665,6 @@ "wm/gestures/back_gesture/back_gesture_contextual_nudge_controller_impl_unittest.cc", "wm/gestures/back_gesture/back_gesture_event_handler_unittest.cc", "wm/gestures/wm_gesture_handler_unittest.cc", - "wm/haptics_util_unittest.cc", "wm/immersive_fullscreen_controller_unittest.cc", "wm/lock_action_handler_layout_manager_unittest.cc", "wm/lock_layout_manager_unittest.cc",
diff --git a/ash/app_list/app_list_bubble_presenter.cc b/ash/app_list/app_list_bubble_presenter.cc index d927625..1db5752b 100644 --- a/ash/app_list/app_list_bubble_presenter.cc +++ b/ash/app_list/app_list_bubble_presenter.cc
@@ -232,6 +232,8 @@ // The bubble widget is cached, but it may change displays. Update pointers // that are tied to the display. bubble_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); + // Refresh suggestions now that zero-state search data is updated. + bubble_view_->UpdateSuggestions(); bubble_event_filter_->SetButton(home_button); // The observer for the correct display will be added below. aura::client::GetFocusClient(bubble_widget_->GetNativeWindow())
diff --git a/ash/app_list/views/app_list_bubble_apps_page.cc b/ash/app_list/views/app_list_bubble_apps_page.cc index 33d3df4..b5868e2 100644 --- a/ash/app_list/views/app_list_bubble_apps_page.cc +++ b/ash/app_list/views/app_list_bubble_apps_page.cc
@@ -138,12 +138,9 @@ continue_section_->AddObserver(this); // Recent apps row. - SearchModel* const search_model = AppListModelProvider::Get()->search_model(); - AppListModel* const model = AppListModelProvider::Get()->model(); recent_apps_ = scroll_contents->AddChildView( std::make_unique<RecentAppsView>(this, view_delegate)); recent_apps_->UpdateAppListConfig(app_list_config); - recent_apps_->ShowResults(search_model, model); // Observe changes in continue section visibility, to keep separator // visibility in sync. recent_apps_->AddObserver(this); @@ -159,7 +156,8 @@ // `reorder_undo_container_` when the app list starts temporary sorting. if (features::IsLauncherAppSortEnabled()) { reorder_undo_container_ = scroll_contents->AddChildView( - std::make_unique<AppListReorderUndoContainerView>()); + std::make_unique<AppListReorderUndoContainerView>( + /*tablet_mode=*/false)); } // All apps section. @@ -173,6 +171,7 @@ scrollable_apps_grid_view_->Init(); scrollable_apps_grid_view_->UpdateAppListConfig(app_list_config); scrollable_apps_grid_view_->SetMaxColumns(5); + AppListModel* const model = AppListModelProvider::Get()->model(); scrollable_apps_grid_view_->SetModel(model); scrollable_apps_grid_view_->SetItemList(model->top_level_item_list()); scrollable_apps_grid_view_->ResetForShowApps(); @@ -182,8 +181,7 @@ scroll_view_->SetContents(std::move(scroll_contents)); - continue_section_->UpdateSuggestionTasks(); - UpdateSeparatorVisibility(); + UpdateSuggestions(); } AppListBubbleAppsPage::~AppListBubbleAppsPage() { @@ -192,6 +190,13 @@ recent_apps_->RemoveObserver(this); } +void AppListBubbleAppsPage::UpdateSuggestions() { + recent_apps_->ShowResults(AppListModelProvider::Get()->search_model(), + AppListModelProvider::Get()->model()); + continue_section_->UpdateSuggestionTasks(); + UpdateSeparatorVisibility(); +} + void AppListBubbleAppsPage::AnimateShowLauncher() { DCHECK(GetVisible()); @@ -330,6 +335,10 @@ .SetTransform(scroll_contents, translate_down); } +void AppListBubbleAppsPage::ResetScrollPosition() { + scroll_view_->ScrollToPosition(scroll_view_->vertical_scroll_bar(), 0); +} + void AppListBubbleAppsPage::AbortAllAnimations() { auto abort_animations = [](views::View* view) { if (view->layer())
diff --git a/ash/app_list/views/app_list_bubble_apps_page.h b/ash/app_list/views/app_list_bubble_apps_page.h index f5ea41e..9ff106b 100644 --- a/ash/app_list/views/app_list_bubble_apps_page.h +++ b/ash/app_list/views/app_list_bubble_apps_page.h
@@ -60,6 +60,9 @@ AppListBubbleAppsPage& operator=(const AppListBubbleAppsPage&) = delete; ~AppListBubbleAppsPage() override; + // Updates the continue section and recent apps. + void UpdateSuggestions(); + // Starts the launcher show animation. void AnimateShowLauncher(); @@ -73,6 +76,9 @@ // Starts the animation for hiding the apps page, going to another page. void AnimateHidePage(); + // Resets the scroll position to the top. + void ResetScrollPosition(); + // Aborts all layer animations, which invokes their cleanup callbacks. void AbortAllAnimations();
diff --git a/ash/app_list/views/app_list_bubble_apps_page_unittest.cc b/ash/app_list/views/app_list_bubble_apps_page_unittest.cc index 3b3838a..9b94585 100644 --- a/ash/app_list/views/app_list_bubble_apps_page_unittest.cc +++ b/ash/app_list/views/app_list_bubble_apps_page_unittest.cc
@@ -123,5 +123,25 @@ EXPECT_TRUE(apps_page->scroll_view()->layer()->layer_mask_layer()); } +TEST_F(AppListBubbleAppsPageTest, ScrollPositionResetOnShow) { + // Show an app list with enough apps to allow scrolling. + auto* helper = GetAppListTestHelper(); + helper->AddAppItems(50); + helper->ShowAppList(); + + // Press the up arrow, which will scroll the view to select an app in the + // last row. + PressAndReleaseKey(ui::VKEY_UP); + auto* apps_page = helper->GetBubbleAppsPage(); + ASSERT_GT(apps_page->scroll_view()->vertical_scroll_bar()->GetPosition(), 0); + + // Hide the launcher, then show it again. + helper->Dismiss(); + helper->ShowAppList(); + + // Scroll position is reset to top. + EXPECT_EQ(apps_page->scroll_view()->vertical_scroll_bar()->GetPosition(), 0); +} + } // namespace } // namespace ash
diff --git a/ash/app_list/views/app_list_bubble_view.cc b/ash/app_list/views/app_list_bubble_view.cc index f1305614..7641a1ef 100644 --- a/ash/app_list/views/app_list_bubble_view.cc +++ b/ash/app_list/views/app_list_bubble_view.cc
@@ -153,6 +153,10 @@ folder_view_ = nullptr; } +void AppListBubbleView::UpdateSuggestions() { + apps_page_->UpdateSuggestions(); +} + void AppListBubbleView::SetDragAndDropHostOfCurrentAppList( ApplicationDragAndDropHost* drag_and_drop_host) { DCHECK(drag_and_drop_host); @@ -354,6 +358,7 @@ NOTREACHED(); break; case AppListBubblePage::kApps: + apps_page_->ResetScrollPosition(); if (previous_page == AppListBubblePage::kSearch) apps_page_->AnimateShowPage(); else
diff --git a/ash/app_list/views/app_list_bubble_view.h b/ash/app_list/views/app_list_bubble_view.h index c3582a3..74e5635 100644 --- a/ash/app_list/views/app_list_bubble_view.h +++ b/ash/app_list/views/app_list_bubble_view.h
@@ -49,6 +49,9 @@ void SetDragAndDropHostOfCurrentAppList( ApplicationDragAndDropHost* drag_and_drop_host); + // Updates continue tasks and recent apps. + void UpdateSuggestions(); + // Starts the bubble show animation. void StartShowAnimation();
diff --git a/ash/app_list/views/app_list_bubble_view_unittest.cc b/ash/app_list/views/app_list_bubble_view_unittest.cc index f64706d..f0932b31 100644 --- a/ash/app_list/views/app_list_bubble_view_unittest.cc +++ b/ash/app_list/views/app_list_bubble_view_unittest.cc
@@ -226,6 +226,28 @@ EXPECT_EQ(kBorderSize + search_box_view->height(), separator_origin.y()); } +TEST_F(AppListBubbleViewTest, + ShowingBubbleUpdatesContinueSectionAndRecentApps) { + // Show the app list with 3 tasks and 4 recent apps. + AddContinueSuggestionResult(3); + AddRecentApps(4); + AddAppItems(5); + ShowAppList(); + + // Hide the app list. The widget and views are cached. + DismissAppList(); + + // While the app list is hidden, update to have 4 tasks and 5 recent apps. + GetAppListTestHelper()->GetSearchResults()->DeleteAll(); + AddContinueSuggestionResult(4); + AddRecentApps(5); + ShowAppList(); + + // Continue section and recent apps have the updated item counts. + EXPECT_EQ(GetContinueSectionView()->GetTasksSuggestionsCount(), 4u); + EXPECT_EQ(GetRecentAppsView()->GetItemViewCount(), 5); +} + TEST_F(AppListBubbleViewTest, OpeningBubbleTriggersAnimations) { // Enable animations. base::test::ScopedFeatureList feature(
diff --git a/ash/app_list/views/app_list_reorder_undo_container_view.cc b/ash/app_list/views/app_list_reorder_undo_container_view.cc index 7d002011..353b562e 100644 --- a/ash/app_list/views/app_list_reorder_undo_container_view.cc +++ b/ash/app_list/views/app_list_reorder_undo_container_view.cc
@@ -10,6 +10,7 @@ #include "ash/app_list/app_list_view_delegate.h" #include "ash/app_list/views/app_list_toast_view.h" #include "ash/public/cpp/app_list/app_list_model_delegate.h" +#include "ash/resources/vector_icons/vector_icons.h" #include "base/strings/strcat.h" #include "ui/views/layout/flex_layout.h" #include "ui/views/layout/flex_layout_types.h" @@ -32,11 +33,26 @@ constexpr char16_t kToastColorOrderText[] = u"by color"; // The text shown on the toast dismiss button. -constexpr char16_t kToastDismissText[] = u"Redo"; +constexpr char16_t kToastDismissText[] = u"Undo"; + +const gfx::VectorIcon* GetToastIconForOrder(AppListSortOrder order) { + switch (order) { + case AppListSortOrder::kNameAlphabetical: + case AppListSortOrder::kNameReverseAlphabetical: + return &kSortAlphabeticalIcon; + case AppListSortOrder::kColor: + return &kSortColorIcon; + case AppListSortOrder::kCustom: + NOTREACHED(); + return nullptr; + } +} } // namespace -AppListReorderUndoContainerView::AppListReorderUndoContainerView() { +AppListReorderUndoContainerView::AppListReorderUndoContainerView( + bool tablet_mode) + : tablet_mode_(tablet_mode) { SetLayoutManager(std::make_unique<views::FlexLayout>()) ->SetMainAxisAlignment(views::LayoutAlignment::kCenter) .SetCrossAxisAlignment(views::LayoutAlignment::kCenter) @@ -61,14 +77,18 @@ } const std::u16string toast_text = CalculateToastTextFromOrder(*new_order); + const gfx::VectorIcon* toast_icon = GetToastIconForOrder(*new_order); if (toast_view_) { toast_view_->SetTitle(toast_text); + toast_view_->SetIcon(toast_icon); return; } // TODO(crbug.com/1277001): Add icon to the toast. toast_view_ = AddChildView( AppListToastView::Builder(toast_text) + .SetStyleForTabletMode(tablet_mode_) + .SetIcon(toast_icon) .SetButton( kToastDismissText, base::BindRepeating(
diff --git a/ash/app_list/views/app_list_reorder_undo_container_view.h b/ash/app_list/views/app_list_reorder_undo_container_view.h index b7563666..00c363d6 100644 --- a/ash/app_list/views/app_list_reorder_undo_container_view.h +++ b/ash/app_list/views/app_list_reorder_undo_container_view.h
@@ -20,7 +20,7 @@ // sorting order when the toast dismiss button is clicked. class AppListReorderUndoContainerView : public views::View { public: - AppListReorderUndoContainerView(); + explicit AppListReorderUndoContainerView(bool tablet_mode); AppListReorderUndoContainerView(const AppListReorderUndoContainerView&) = delete; AppListReorderUndoContainerView& operator=( @@ -45,6 +45,9 @@ [[nodiscard]] std::u16string CalculateToastTextFromOrder( AppListSortOrder order) const; + // Whether the toast container is part of the tablet mode app list UI. + const bool tablet_mode_; + AppListToastView* toast_view_ = nullptr; };
diff --git a/ash/app_list/views/app_list_toast_view.cc b/ash/app_list/views/app_list_toast_view.cc index 8a54dcd3..86e8d9c 100644 --- a/ash/app_list/views/app_list_toast_view.cc +++ b/ash/app_list/views/app_list_toast_view.cc
@@ -11,18 +11,22 @@ #include "ash/shell.h" #include "ash/style/ash_color_provider.h" #include "ash/style/pill_button.h" +#include "ui/color/color_id.h" +#include "ui/compositor/layer.h" #include "ui/gfx/color_palette.h" #include "ui/views/background.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/layout/box_layout.h" +#include "ui/views/view_class_properties.h" namespace ash { constexpr int kCornerRadius = 16; constexpr gfx::Insets kInteriorMargin(7, 8, 7, 16); +constexpr int kIconMargins = 8; constexpr int kToastHeight = 32; constexpr int kToastMaximumWidth = 512; constexpr int kToastMinimumWidth = 288; @@ -36,6 +40,9 @@ std::unique_ptr<AppListToastView> toast = std::make_unique<AppListToastView>(title_); + if (style_for_tablet_mode_) + toast->StyleForTabletMode(); + if (dark_icon_ && light_icon_) toast->SetThemingIcons(dark_icon_, light_icon_); else if (icon_) @@ -51,21 +58,21 @@ } AppListToastView::Builder& AppListToastView::Builder::SetIcon( - const gfx::VectorIcon& icon) { + const gfx::VectorIcon* icon) { DCHECK(!dark_icon_); DCHECK(!light_icon_); - icon_ = &icon; + icon_ = icon; return *this; } AppListToastView::Builder& AppListToastView::Builder::SetThemingIcons( - const gfx::VectorIcon& dark_icon, - const gfx::VectorIcon& light_icon) { + const gfx::VectorIcon* dark_icon, + const gfx::VectorIcon* light_icon) { DCHECK(!icon_); - dark_icon_ = &dark_icon; - light_icon_ = &light_icon; + dark_icon_ = dark_icon; + light_icon_ = light_icon; return *this; } @@ -86,6 +93,12 @@ return *this; } +AppListToastView::Builder& AppListToastView::Builder::SetStyleForTabletMode( + bool style_for_tablet_mode) { + style_for_tablet_mode_ = style_for_tablet_mode; + return *this; +} + AppListToastView::AppListToastView(const std::u16string title) { views::BoxLayout* layout_manager = SetLayoutManager(std::make_unique<views::BoxLayout>( @@ -106,6 +119,16 @@ AppListToastView::~AppListToastView() = default; +void AppListToastView::StyleForTabletMode() { + style_for_tablet_mode_ = true; + + SetPaintToLayer(); + layer()->SetFillsBoundsOpaquely(false); + layer()->SetBackgroundBlur(ColorProvider::kBackgroundBlurSigma); + layer()->SetBackdropFilterQuality(ColorProvider::kBackgroundBlurQuality); + layer()->SetRoundedCornerRadius(gfx::RoundedCornersF(kCornerRadius)); +} + void AppListToastView::OnThemeChanged() { views::View::OnThemeChanged(); if (title_label_) @@ -114,10 +137,18 @@ bubble_utils::ApplyStyle(subtitle_label_, bubble_utils::LabelStyle::kSubtitle); - SetBackground(views::CreateRoundedRectBackground( - AshColorProvider::Get()->GetControlsLayerColor( - AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive), - kCornerRadius)); + if (style_for_tablet_mode_) { + SetBackground(views::CreateRoundedRectBackground( + ColorProvider::Get()->GetBaseLayerColor( + ColorProvider::BaseLayerType::kTransparent80), + kCornerRadius)); + } else { + SetBackground(views::CreateRoundedRectBackground( + AshColorProvider::Get()->GetControlsLayerColor( + AshColorProvider::ControlsLayerType:: + kControlBackgroundColorInactive), + kCornerRadius)); + } UpdateIconImage(); } @@ -181,7 +212,10 @@ return; if (default_icon_) { - icon_->SetImage(ui::ImageModel::FromVectorIcon(*default_icon_)); + icon_->SetImage(ui::ImageModel::FromVectorIcon( + *default_icon_, + AshColorProvider::Get()->GetContentLayerColor( + AshColorProvider::ContentLayerType::kIconColorPrimary))); return; } @@ -194,11 +228,13 @@ } void AppListToastView::CreateIconView() { - DCHECK(!icon_); + if (icon_) + return; icon_ = AddChildViewAt(std::make_unique<views::ImageView>(), 0); icon_->SetVerticalAlignment(views::ImageView::Alignment::kCenter); icon_->SetHorizontalAlignment(views::ImageView::Alignment::kCenter); + icon_->SetProperty(views::kMarginsKey, gfx::Insets(kIconMargins)); } } // namespace ash
diff --git a/ash/app_list/views/app_list_toast_view.h b/ash/app_list/views/app_list_toast_view.h index 25cc89f..869545d 100644 --- a/ash/app_list/views/app_list_toast_view.h +++ b/ash/app_list/views/app_list_toast_view.h
@@ -43,13 +43,14 @@ // Nevertheless there might be a case when different icons need to be used // with dark/light mode (i.e. non-monochromatic icons) and a single icon is // not enough. For this case, use SetThemingIcons(). - Builder& SetIcon(const gfx::VectorIcon& icon); - Builder& SetThemingIcons(const gfx::VectorIcon& dark_icon, - const gfx::VectorIcon& light_icon); + Builder& SetIcon(const gfx::VectorIcon* icon); + Builder& SetThemingIcons(const gfx::VectorIcon* dark_icon, + const gfx::VectorIcon* light_icon); Builder& SetSubtitle(const std::u16string subtitle); Builder& SetButton(std::u16string button_text, views::Button::PressedCallback button_callback); + Builder& SetStyleForTabletMode(bool style_for_tablet_mode); private: std::u16string title_; @@ -60,6 +61,7 @@ const gfx::VectorIcon* light_icon_ = nullptr; views::Button::PressedCallback button_callback_; bool has_button_ = false; + bool style_for_tablet_mode_ = false; }; explicit AppListToastView(const std::u16string title); @@ -81,6 +83,10 @@ void SetTitle(const std::u16string title); void SetSubtitle(const std::u16string subtitle); + // Styles the toast for display in tablet mode launcher UI - for example, adds + // background blur, and sets rounded corners on the toast layer. + void StyleForTabletMode(); + views::LabelButton* toast_button() const { return toast_button_; } private: @@ -96,6 +102,9 @@ // Vector icon to use if there are not dark or light mode specific icons. const gfx::VectorIcon* default_icon_ = nullptr; + // Whether the toast UI should be style for tablet mode app list UI. + bool style_for_tablet_mode_ = false; + // Toast icon view. views::ImageView* icon_ = nullptr; // Label with the main text for the toast.
diff --git a/ash/app_list/views/apps_container_view.cc b/ash/app_list/views/apps_container_view.cc index 93da44b..87f5696 100644 --- a/ash/app_list/views/apps_container_view.cc +++ b/ash/app_list/views/apps_container_view.cc
@@ -263,7 +263,8 @@ // `reorder_undo_container_` when the app list starts temporary sorting. if (features::IsLauncherAppSortEnabled()) { reorder_undo_container_ = scrollable_container_->AddChildView( - std::make_unique<AppListReorderUndoContainerView>()); + std::make_unique<AppListReorderUndoContainerView>( + /*tablet_mode=*/true)); reorder_undo_container_->SetPaintToLayer(ui::LAYER_NOT_DRAWN); } } else {
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index fd4c2695..2aa909e 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -4306,6 +4306,10 @@ Failed to save screencast </message> + <message name="IDS_ASH_PROJECTOR_FAILURE_MESSAGE_TRANSCRIPTION" desc="The test of the notification when Projector transcription fails."> + Can't generate transcription + </message> + <!-- SODA Download strings --> <message name="IDS_ASH_ACCESSIBILITY_DICTATION_SETTING_SUBTITLE_SODA_DOWNLOAD_COMPLETE" desc="Description explaining that the speech recognition library download has completed."> Speech files downloaded
diff --git a/ash/ash_strings_grd/IDS_ASH_PROJECTOR_FAILURE_MESSAGE_TRANSCRIPTION.png.sha1 b/ash/ash_strings_grd/IDS_ASH_PROJECTOR_FAILURE_MESSAGE_TRANSCRIPTION.png.sha1 new file mode 100644 index 0000000..09108dbe --- /dev/null +++ b/ash/ash_strings_grd/IDS_ASH_PROJECTOR_FAILURE_MESSAGE_TRANSCRIPTION.png.sha1
@@ -0,0 +1 @@ +1be548b1524ae1e3a1c74db0bcf2ce6e0f76f4b4 \ No newline at end of file
diff --git a/ash/components/arc/video_accelerator/protected_buffer_manager.cc b/ash/components/arc/video_accelerator/protected_buffer_manager.cc index 524227ce..d317d06 100644 --- a/ash/components/arc/video_accelerator/protected_buffer_manager.cc +++ b/ash/components/arc/video_accelerator/protected_buffer_manager.cc
@@ -404,6 +404,8 @@ base::ScopedFD dummy_fd) { uint32_t id = 0; auto pixmap = ImportDummyFd(std::move(dummy_fd), &id); + if (!pixmap) + return {}; base::AutoLock lock(buffer_map_lock_); const auto& iter = buffer_map_.find(id); @@ -418,6 +420,8 @@ base::ScopedFD dummy_fd) { uint32_t id = 0; auto pixmap = ImportDummyFd(std::move(dummy_fd), &id); + if (!pixmap) + return gfx::NativePixmapHandle(); base::AutoLock lock(buffer_map_lock_); const auto& iter = buffer_map_.find(id); @@ -451,6 +455,8 @@ base::ScopedFD dummy_fd(HANDLE_EINTR(dup(handle.planes[0].fd.get()))); uint32_t id = 0; auto pixmap = ImportDummyFd(std::move(dummy_fd), &id); + if (!pixmap) + return nullptr; base::AutoLock lock(buffer_map_lock_); const auto& iter = buffer_map_.find(id); @@ -477,6 +483,8 @@ uint32_t* id) const { // 0 is an invalid handle id. *id = 0; + if (!dummy_fd.is_valid()) + return nullptr; // Import dummy_fd to acquire its unique id. // CreateNativePixmapFromHandle() takes ownership and will close the handle
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index 03cdcb4..a347497 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -1052,7 +1052,7 @@ // Controls whether to enable Projector for managed users. const base::Feature kProjectorManagedUser{"ProjectorManagedUser", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Controls whether to enable Projector annotator or marker tools. // The annotator tools are newer and based on the ink library.
diff --git a/ash/frame/snap_controller_impl.cc b/ash/frame/snap_controller_impl.cc index f31e2b57..b21005b 100644 --- a/ash/frame/snap_controller_impl.cc +++ b/ash/frame/snap_controller_impl.cc
@@ -4,7 +4,7 @@ #include "ash/frame/snap_controller_impl.h" -#include "ash/wm/haptics_util.h" +#include "ash/utility/haptics_util.h" #include "ash/wm/window_positioning_utils.h" #include "ash/wm/window_state.h" #include "ash/wm/wm_event.h"
diff --git a/ash/marker/marker_controller_unittest.cc b/ash/marker/marker_controller_unittest.cc index 860cf87..5a64975f 100644 --- a/ash/marker/marker_controller_unittest.cc +++ b/ash/marker/marker_controller_unittest.cc
@@ -9,6 +9,7 @@ #include "ash/public/cpp/stylus_utils.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" +#include "base/test/scoped_feature_list.h" #include "ui/events/test/event_generator.h" namespace ash { @@ -39,18 +40,21 @@ // AshTestBase: void SetUp() override { + scoped_feature_list_.InitWithFeatures( + /*enabled_features=*/{features::kProjector, + features::kProjectorManagedUser}, + /*disabled_features=*/{}); AshTestBase::SetUp(); observer_ = std::make_unique<TestMarkerObserver>(); - controller_ = std::make_unique<MarkerController>(); + controller_ = MarkerController::Get(); controller_test_api_ = - std::make_unique<MarkerControllerTestApi>(controller_.get()); + std::make_unique<MarkerControllerTestApi>(controller_); } void TearDown() override { // This needs to be called first to remove the event handler before the // shell instance gets torn down. controller_test_api_.reset(); - controller_.reset(); AshTestBase::TearDown(); } @@ -166,7 +170,8 @@ TestMarkerObserver* observer() { return observer_.get(); } - std::unique_ptr<MarkerController> controller_; + base::test::ScopedFeatureList scoped_feature_list_; + MarkerController* controller_; std::unique_ptr<MarkerControllerTestApi> controller_test_api_; std::unique_ptr<TestMarkerObserver> observer_; };
diff --git a/ash/projector/model/projector_session_impl_unittest.cc b/ash/projector/model/projector_session_impl_unittest.cc index 9141c19..5596b6a 100644 --- a/ash/projector/model/projector_session_impl_unittest.cc +++ b/ash/projector/model/projector_session_impl_unittest.cc
@@ -4,11 +4,13 @@ #include "ash/projector/model/projector_session_impl.h" +#include "ash/constants/ash_features.h" #include "ash/projector/projector_metrics.h" #include "ash/public/cpp/projector/projector_session.h" #include "ash/test/ash_test_base.h" #include "base/dcheck_is_on.h" #include "base/test/metrics/histogram_tester.h" +#include "base/test/scoped_feature_list.h" namespace ash { @@ -28,12 +30,17 @@ // AshTestBase: void SetUp() override { + scoped_feature_list_.InitWithFeatures( + /*enabled_features=*/{features::kProjector, + features::kProjectorManagedUser}, + /*disabled_features=*/{}); AshTestBase::SetUp(); - session_ = std::make_unique<ProjectorSessionImpl>(); + session_ = static_cast<ProjectorSessionImpl*>(ProjectorSession::Get()); } protected: - std::unique_ptr<ProjectorSessionImpl> session_; + base::test::ScopedFeatureList scoped_feature_list_; + ProjectorSessionImpl* session_; }; TEST_F(ProjectorSessionImplTest, Start) {
diff --git a/ash/projector/projector_controller_impl.cc b/ash/projector/projector_controller_impl.cc index 69c96bc..7f628161 100644 --- a/ash/projector/projector_controller_impl.cc +++ b/ash/projector/projector_controller_impl.cc
@@ -148,6 +148,11 @@ } void ProjectorControllerImpl::OnTranscriptionError() { + is_speech_recognition_on_ = false; + + ProjectorUiController::ShowFailureNotification( + IDS_ASH_PROJECTOR_FAILURE_MESSAGE_TRANSCRIPTION); + CaptureModeController::Get()->EndVideoRecording( EndRecordingReason::kProjectorTranscriptionError); } @@ -159,6 +164,7 @@ SaveScreencast(); } + is_speech_recognition_on_ = false; projector_session_->Stop(); } @@ -279,7 +285,7 @@ if (ui_controller_) ui_controller_->CloseToolbar(); - StopSpeechRecognition(); + MaybeStopSpeechRecognition(); // At this point, the screencast might not synced to Drive yet. Open // Projector App which shows the Gallery view by default. @@ -331,7 +337,9 @@ } void ProjectorControllerImpl::OnNewScreencastPreconditionChanged() { - client_->OnNewScreencastPreconditionChanged(GetNewScreencastPrecondition()); + // `client_` could be not available in unit tests. + if (client_) + client_->OnNewScreencastPreconditionChanged(GetNewScreencastPrecondition()); } void ProjectorControllerImpl::SetProjectorUiControllerForTest( @@ -372,15 +380,15 @@ is_speech_recognition_on_ = true; } -void ProjectorControllerImpl::StopSpeechRecognition() { - if (ProjectorController::AreExtendedProjectorFeaturesDisabled()) { +void ProjectorControllerImpl::MaybeStopSpeechRecognition() { + if (ProjectorController::AreExtendedProjectorFeaturesDisabled() || + !is_speech_recognition_on_) { OnSpeechRecognitionStopped(); return; } DCHECK(speech_recognition_availability_ == SpeechRecognitionAvailability::kAvailable); - DCHECK(is_speech_recognition_on_); DCHECK_NE(client_, nullptr); client_->StopSpeechRecognition(); is_speech_recognition_on_ = false;
diff --git a/ash/projector/projector_controller_impl.h b/ash/projector/projector_controller_impl.h index fc4b8dbc..bb1c7ab 100644 --- a/ash/projector/projector_controller_impl.h +++ b/ash/projector/projector_controller_impl.h
@@ -119,7 +119,7 @@ // Starts or stops the speech recognition session. void StartSpeechRecognition(); - void StopSpeechRecognition(); + void MaybeStopSpeechRecognition(); // Triggered when finish creating the screencast container folder. This method // caches the the container folder path in `ProjectorSession` and triggers the
diff --git a/ash/public/cpp/desk_template.h b/ash/public/cpp/desk_template.h index f1f7372..b42b6dcb 100644 --- a/ash/public/cpp/desk_template.h +++ b/ash/public/cpp/desk_template.h
@@ -90,6 +90,9 @@ // Indicates whether this template has been updated since creation. bool WasUpdatedSinceCreation() const { return !updated_time_.is_null(); } + // Indicates whether this template can be modified by user. + bool IsModifiable() const { return source_ == DeskTemplateSource::kUser; } + private: DeskTemplate();
diff --git a/ash/style/icon_button.cc b/ash/style/icon_button.cc index 67ad924..2792524 100644 --- a/ash/style/icon_button.cc +++ b/ash/style/icon_button.cc
@@ -6,7 +6,7 @@ #include "ash/style/ash_color_provider.h" #include "ash/style/style_util.h" -#include "ash/wm/haptics_util.h" +#include "ash/utility/haptics_util.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/l10n/l10n_util.h"
diff --git a/ash/style/pill_button.cc b/ash/style/pill_button.cc index d1e11f5..b4698c1 100644 --- a/ash/style/pill_button.cc +++ b/ash/style/pill_button.cc
@@ -19,7 +19,6 @@ namespace { constexpr int kPillButtonHeight = 32; -constexpr int kPillButtonHorizontalSpacing = 16; constexpr int kPillButtonMinimumWidth = 56; constexpr int kIconSize = 20; constexpr int kIconPillButtonImageLabelSpacingDp = 8; @@ -54,32 +53,27 @@ return AshColorProvider::Get()->GetControlsLayerColor(color_id); } -int GetPillButtonWidth(bool has_icon) { - int button_width = 2 * kPillButtonHorizontalSpacing; - if (has_icon) - button_width += (kIconSize + kIconPillButtonImageLabelSpacingDp); - return button_width; -} - } // namespace PillButton::PillButton(PressedCallback callback, const std::u16string& text, PillButton::Type type, const gfx::VectorIcon* icon, + int horizontal_spacing, bool use_light_colors, bool rounded_highlight_path) : views::LabelButton(std::move(callback), text), type_(type), icon_(icon), - use_light_colors_(use_light_colors) { + use_light_colors_(use_light_colors), + horizontal_spacing_(horizontal_spacing) { SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); SetHorizontalAlignment(gfx::ALIGN_CENTER); const int vertical_spacing = std::max(kPillButtonHeight - GetPreferredSize().height() / 2, 0); SetBorder(views::CreateEmptyBorder( - gfx::Insets(vertical_spacing, kPillButtonHorizontalSpacing))); + gfx::Insets(vertical_spacing, horizontal_spacing_))); label()->SetSubpixelRenderingEnabled(false); // TODO: Unify the font size, weight under ash/style as well. label()->SetFontList(views::Label::GetDefaultFontList().Derive( @@ -104,9 +98,12 @@ PillButton::~PillButton() = default; gfx::Size PillButton::CalculatePreferredSize() const { - gfx::Size size(label()->GetPreferredSize().width() + - GetPillButtonWidth(type_ == PillButton::Type::kIcon), - kPillButtonHeight); + int button_width = + 2 * horizontal_spacing_ + label()->GetPreferredSize().width(); + if (type_ == PillButton::Type::kIcon) + button_width += (kIconSize + kIconPillButtonImageLabelSpacingDp); + + gfx::Size size(button_width, kPillButtonHeight); size.SetToMax(gfx::Size(kPillButtonMinimumWidth, kPillButtonHeight)); return size; }
diff --git a/ash/style/pill_button.h b/ash/style/pill_button.h index e28d759..4c53086d 100644 --- a/ash/style/pill_button.h +++ b/ash/style/pill_button.h
@@ -18,6 +18,8 @@ public: METADATA_HEADER(PillButton); + static constexpr int kPillButtonHorizontalSpacing = 16; + // Types of the PillButton. enum class Type { // PillButton with an icon, default text and background colors. @@ -48,6 +50,7 @@ const std::u16string& text, Type type, const gfx::VectorIcon* icon, + int horizontal_spacing = kPillButtonHorizontalSpacing, bool use_light_colors = false, bool rounded_highlight_path = true); PillButton(const PillButton&) = delete; @@ -75,6 +78,10 @@ // not enabled. Note, can be removed when D/L mode feature is fully launched. bool use_light_colors_; + // Horizontal spacing of this button. `kPillButtonHorizontalSpacing` will be + // set as the default value. + int horizontal_spacing_; + // Customized value for text's color. absl::optional<SkColor> text_color_; };
diff --git a/ash/system/message_center/ash_notification_view.cc b/ash/system/message_center/ash_notification_view.cc index 9b5f59a..b0483b3 100644 --- a/ash/system/message_center/ash_notification_view.cc +++ b/ash/system/message_center/ash_notification_view.cc
@@ -885,9 +885,9 @@ views::Button::PressedCallback callback, const std::u16string& label) { std::unique_ptr<views::LabelButton> actions_button = - std::make_unique<PillButton>(std::move(callback), label, - PillButton::Type::kIconlessAccentFloating, - /*icon=*/nullptr); + std::make_unique<PillButton>( + std::move(callback), label, PillButton::Type::kIconlessAccentFloating, + /*icon=*/nullptr, kNotificationPillButtonHorizontalSpacing); // Override the inkdrop configuration to make sure it will show up when hover // or focus on the button. StyleUtil::SetUpInkDropForButton(actions_button.get(), gfx::Insets(),
diff --git a/ash/system/message_center/message_center_constants.h b/ash/system/message_center/message_center_constants.h index 094dd00..7d1ebdcc 100644 --- a/ash/system/message_center/message_center_constants.h +++ b/ash/system/message_center/message_center_constants.h
@@ -30,6 +30,9 @@ constexpr int kNotificationBarVerticalPadding = 8; constexpr int kNotificationBarHorizontalPadding = 10; +// Horizontal spacing of the pill buttons inside notification. +constexpr int kNotificationPillButtonHorizontalSpacing = 12; + // Constants for `ash_notification_view`. // The width of notification that displayed inside the message center.
diff --git a/ash/system/message_center/stacked_notification_bar.cc b/ash/system/message_center/stacked_notification_bar.cc index dde6eb06..714afc6f 100644 --- a/ash/system/message_center/stacked_notification_bar.cc +++ b/ash/system/message_center/stacked_notification_bar.cc
@@ -48,6 +48,7 @@ text, PillButton::Type::kIconlessAccentFloating, /*icon=*/nullptr, + kNotificationPillButtonHorizontalSpacing, /*use_light_colors=*/!features::IsNotificationsRefreshEnabled(), /*rounded_highlight_path=*/ features::IsNotificationsRefreshEnabled()),
diff --git a/ash/system/tray/tray_toggle_button.cc b/ash/system/tray/tray_toggle_button.cc index 4e4c6ae..4b4fedfc 100644 --- a/ash/system/tray/tray_toggle_button.cc +++ b/ash/system/tray/tray_toggle_button.cc
@@ -6,7 +6,7 @@ #include "ash/style/ash_color_provider.h" #include "ash/system/tray/tray_constants.h" -#include "ash/wm/haptics_util.h" +#include "ash/utility/haptics_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/events/devices/haptic_touchpad_effects.h" #include "ui/events/event.h"
diff --git a/ash/system/unified/notification_hidden_view.cc b/ash/system/unified/notification_hidden_view.cc index 50eb6a07..f5d56fc 100644 --- a/ash/system/unified/notification_hidden_view.cc +++ b/ash/system/unified/notification_hidden_view.cc
@@ -11,6 +11,7 @@ #include "ash/style/ash_color_provider.h" #include "ash/style/pill_button.h" #include "ash/system/message_center/ash_message_center_lock_screen_controller.h" +#include "ash/system/message_center/message_center_constants.h" #include "ash/system/tray/tray_constants.h" #include "base/bind.h" #include "base/callback_helpers.h" @@ -67,7 +68,8 @@ base::BindRepeating(&NotificationHiddenView::ChangeButtonPressed, base::Unretained(this)), l10n_util::GetStringUTF16(IDS_ASH_MESSAGE_CENTER_LOCKSCREEN_CHANGE), - PillButton::Type::kIconless, /*icon=*/nullptr)); + PillButton::Type::kIconless, /*icon=*/nullptr, + kNotificationPillButtonHorizontalSpacing)); change_button_->SetTooltipText(l10n_util::GetStringUTF16( IDS_ASH_MESSAGE_CENTER_LOCKSCREEN_CHANGE_TOOLTIP)); }
diff --git a/ash/wm/haptics_util.cc b/ash/utility/haptics_util.cc similarity index 96% rename from ash/wm/haptics_util.cc rename to ash/utility/haptics_util.cc index fb21f6e..8ae51e3 100644 --- a/ash/wm/haptics_util.cc +++ b/ash/utility/haptics_util.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/wm/haptics_util.h" +#include "ash/utility/haptics_util.h" #include "ui/events/devices/haptic_touchpad_effects.h" #include "ui/ozone/public/input_controller.h" #include "ui/ozone/public/ozone_platform.h"
diff --git a/ash/wm/haptics_util.h b/ash/utility/haptics_util.h similarity index 80% rename from ash/wm/haptics_util.h rename to ash/utility/haptics_util.h index e23bbf2..d35a4f8 100644 --- a/ash/wm/haptics_util.h +++ b/ash/utility/haptics_util.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_WM_HAPTICS_UTIL_H_ -#define ASH_WM_HAPTICS_UTIL_H_ +#ifndef ASH_UTILITY_HAPTICS_UTIL_H_ +#define ASH_UTILITY_HAPTICS_UTIL_H_ #include "ash/ash_export.h" @@ -15,6 +15,9 @@ namespace ash { +// Utility that provides methods to trigger haptic effects throughout Ash. +// These call InputController functions that will play the effects if a haptic +// touchpad is available. namespace haptics_util { // Sets test input controller for testing. When g_test_input_controller is not @@ -38,4 +41,4 @@ } // namespace haptics_util } // namespace ash -#endif // ASH_WM_HAPTICS_UTIL_H_ +#endif // ASH_UTILITY_HAPTICS_UTIL_H_
diff --git a/ash/wm/haptics_util_unittest.cc b/ash/utility/haptics_util_unittest.cc similarity index 96% rename from ash/wm/haptics_util_unittest.cc rename to ash/utility/haptics_util_unittest.cc index 156f160..61a198e 100644 --- a/ash/wm/haptics_util_unittest.cc +++ b/ash/utility/haptics_util_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/wm/haptics_util.h" +#include "ash/utility/haptics_util.h" #include <vector> @@ -38,8 +38,12 @@ class InputControllerForTesting : public ui::InputController { public: - InputControllerForTesting() = default; - ~InputControllerForTesting() override = default; + InputControllerForTesting() { + haptics_util::SetInputControllerForTesting(this); + } + ~InputControllerForTesting() override { + haptics_util::SetInputControllerForTesting(nullptr); + } InputControllerForTesting(const InputControllerForTesting&) = delete; InputControllerForTesting& operator=(const InputControllerForTesting&) = delete; @@ -134,10 +138,9 @@ using HapticsUtilTest = AshTestBase; -// Test haptic feedback with all effect/strength combination. +// Test haptic feedback with all effect/strength combinations. TEST_F(HapticsUtilTest, HapticFeedbackBasic) { auto input_controller = std::make_unique<InputControllerForTesting>(); - haptics_util::SetInputControllerForTesting(input_controller.get()); std::vector<HapticTouchpadEffect> effects = { HapticTouchpadEffect::kSnap, HapticTouchpadEffect::kKnock, @@ -161,11 +164,10 @@ } } -// Test haptic feedback for nornal window snapping. This covers drag to snap +// Test haptic feedback for normal window snapping. This covers drag to snap // primary/secondary/maximize. TEST_F(HapticsUtilTest, HapticFeedbackForNormalWindowSnap) { auto input_controller = std::make_unique<InputControllerForTesting>(); - haptics_util::SetInputControllerForTesting(input_controller.get()); UpdateDisplay("800x600"); gfx::Rect bounds(200, 200, 300, 300); @@ -222,7 +224,6 @@ // in overview. TEST_F(HapticsUtilTest, HapticFeedbackForOverviewWindowSnap) { auto input_controller = std::make_unique<InputControllerForTesting>(); - haptics_util::SetInputControllerForTesting(input_controller.get()); OverviewController* overview_controller = Shell::Get()->overview_controller(); UpdateDisplay("800x600"); @@ -284,9 +285,8 @@ // Test haptic feedback for off limits desk switching, e.g. swiping left from // the first desk and swiping right from the last desk. TEST_F(HapticsUtilTest, HapticFeedbackForDeskSwitchingOffLimits) { - auto* desk_controller = DesksController::Get(); auto input_controller = std::make_unique<InputControllerForTesting>(); - haptics_util::SetInputControllerForTesting(input_controller.get()); + auto* desk_controller = DesksController::Get(); // Make sure to start with two desks. NewDesk(); @@ -318,7 +318,6 @@ // visible desk changes. TEST_F(HapticsUtilTest, HapticFeedbackForContinuousDesksSwitching) { auto input_controller = std::make_unique<InputControllerForTesting>(); - haptics_util::SetInputControllerForTesting(input_controller.get()); // Add three desks for a total of four. auto* desks_controller = DesksController::Get(); @@ -388,7 +387,6 @@ TEST_F(HapticsUtilTest, HapticFeedbackForDragAndDrop) { auto input_controller = std::make_unique<InputControllerForTesting>(); OverviewController* overview_controller = Shell::Get()->overview_controller(); - haptics_util::SetInputControllerForTesting(input_controller.get()); std::unique_ptr<aura::Window> window = CreateTestWindow(); ui::test::EventGenerator* event_generator = GetEventGenerator();
diff --git a/ash/webui/personalization_app/mojom/personalization_app.mojom b/ash/webui/personalization_app/mojom/personalization_app.mojom index 403501d..d547f1f 100644 --- a/ash/webui/personalization_app/mojom/personalization_app.mojom +++ b/ash/webui/personalization_app/mojom/personalization_app.mojom
@@ -270,4 +270,7 @@ // Returns an array of default user images to choose from. GetDefaultUserImages() => (array<DefaultUserImage> default_user_images); + + // Select one of the default images from the provided default user images. + SelectDefaultImage(int32 index); };
diff --git a/ash/webui/personalization_app/resources/common/utils.ts b/ash/webui/personalization_app/resources/common/utils.ts index dff8596..8f6e022 100644 --- a/ash/webui/personalization_app/resources/common/utils.ts +++ b/ash/webui/personalization_app/resources/common/utils.ts
@@ -65,11 +65,11 @@ } -type WallpaperSelectionEvent = +type PersonalizationAppSelectionEvent = MouseEvent&{type: 'click'}|KeyboardEvent&{key: 'Enter'}; /** Returns true if this event is a user action to select an item. */ export function isSelectionEvent(event: Event): - event is WallpaperSelectionEvent { + event is PersonalizationAppSelectionEvent { return (event instanceof MouseEvent && event.type === 'click') || (event instanceof KeyboardEvent && event.key === 'Enter'); }
diff --git a/ash/webui/personalization_app/resources/trusted/user/avatar_list_element.html b/ash/webui/personalization_app/resources/trusted/user/avatar_list_element.html index 3cd159a..a887cc2 100644 --- a/ash/webui/personalization_app/resources/trusted/user/avatar_list_element.html +++ b/ash/webui/personalization_app/resources/trusted/user/avatar_list_element.html
@@ -2,6 +2,7 @@ <div id="container"> <p>Avatar list</p> <template is="dom-repeat" items="[[defaultUserImages_]]"> - <img src="[[item.url.url]]"> + <img src="[[item.url.url]]" data-id$="[[item.index]]" + on-click="onSelectDefaultImage_" on-keypress="onSelectDefaultImage_"> </template> -</div> \ No newline at end of file +</div>
diff --git a/ash/webui/personalization_app/resources/trusted/user/avatar_list_element.ts b/ash/webui/personalization_app/resources/trusted/user/avatar_list_element.ts index 6d53faa2..e6db0b6 100644 --- a/ash/webui/personalization_app/resources/trusted/user/avatar_list_element.ts +++ b/ash/webui/personalization_app/resources/trusted/user/avatar_list_element.ts
@@ -9,6 +9,7 @@ import {html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {isSelectionEvent} from '../../common/utils.js'; import {DefaultUserImage} from '../personalization_app.mojom-webui.js'; import {WithPersonalizationStore} from '../personalization_store.js'; @@ -39,6 +40,20 @@ this.updateFromStore(); fetchDefaultUserImages(getUserProvider(), this.getStore()); } + + private onSelectDefaultImage_(event: Event) { + if (!isSelectionEvent(event)) { + return; + } + + const id = (event.currentTarget as HTMLElement).dataset['id']; + if (!id) { + return; + } + + const index = parseInt(id, 10); + getUserProvider().selectDefaultImage(index); + } } customElements.define(AvatarList.is, AvatarList);
diff --git a/ash/webui/personalization_app/test/fake_personalization_app_user_provider.cc b/ash/webui/personalization_app/test/fake_personalization_app_user_provider.cc index ae96c92..efe1254 100644 --- a/ash/webui/personalization_app/test/fake_personalization_app_user_provider.cc +++ b/ash/webui/personalization_app/test/fake_personalization_app_user_provider.cc
@@ -40,4 +40,6 @@ void FakePersonalizationAppUserProvider::GetDefaultUserImages( GetDefaultUserImagesCallback callback) {} +void FakePersonalizationAppUserProvider::SelectDefaultImage(int index) {} + } // namespace ash
diff --git a/ash/webui/personalization_app/test/fake_personalization_app_user_provider.h b/ash/webui/personalization_app/test/fake_personalization_app_user_provider.h index d3d9977..dac6665 100644 --- a/ash/webui/personalization_app/test/fake_personalization_app_user_provider.h +++ b/ash/webui/personalization_app/test/fake_personalization_app_user_provider.h
@@ -44,6 +44,7 @@ observer) override; void GetUserInfo(GetUserInfoCallback callback) override; void GetDefaultUserImages(GetDefaultUserImagesCallback callback) override; + void SelectDefaultImage(int index) override; private: mojo::Receiver<ash::personalization_app::mojom::UserProvider> user_receiver_{
diff --git a/ash/webui/print_management/resources/icons.html b/ash/webui/print_management/resources/icons.html index e53db1c..8ed9f91 100644 --- a/ash/webui/print_management/resources/icons.html +++ b/ash/webui/print_management/resources/icons.html
@@ -2,37 +2,37 @@ <svg> <defs> <g id="file-excel" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#16A765" d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zM8.5 7L10 8.8 11.5 7h2L11 10l2.5 3h-2L10 11.2 8.5 13h-2L9 10 6.5 7h2z"/> + <path d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zM8.5 7L10 8.8 11.5 7h2L11 10l2.5 3h-2L10 11.2 8.5 13h-2L9 10 6.5 7h2z"/> </g> <g id="file-generic" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#5f6368" d="M11 2l5 5v10a1 1 0 01-1 1H5a1 1 0 01-1-1V3a1 1 0 011-1h6zm-1 2H6v12h8V8h-4V4z"/> + <path d="M11 2l5 5v10a1 1 0 01-1 1H5a1 1 0 01-1-1V3a1 1 0 011-1h6zm-1 2H6v12h8V8h-4V4z"/> </g> <g id="file-gdoc" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#4285F4" d="M15 3a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zm-4 5v2H7v-2h4zm2-3v2H7V7h6z"/> + <path d="M15 3a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zm-4 5v2H7v-2h4zm2-3v2H7V7h6z"/> </g> <g id="file-gdraw" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#EA4335" d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zm-1.5 5v3.5H10V10h3.5zm-5-3.5a2 2 0 110 4 2 2 0 010-4z"/> + <path d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zm-1.5 5v3.5H10V10h3.5zm-5-3.5a2 2 0 110 4 2 2 0 010-4z"/> </g> <g id="file-gform" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#34A853" d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zm-1 5v2H9v-2h5zm-6 0v2H6v-2h2zm6-3v2H9V7h5zM8 7v2H6V7h2z"/> + <path d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zm-1 5v2H9v-2h5zm-6 0v2H6v-2h2zm6-3v2H9V7h5zM8 7v2H6V7h2z"/> </g> <g id="file-gsheet" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#34A853" d="M15 3a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zm-5 1v2h4v2h-4v4H8v-4H6V8h2V6h2z"/> + <path d="M15 3a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zm-5 1v2h4v2h-4v4H8v-4H6V8h2V6h2z"/> </g> <g id="file-gslide" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#FBBC04" d="M15 3a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zm-1 2v6H6V7h8z"/> + <path d="M15 3a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zm-1 2v6H6V7h8z"/> </g> <g id="file-image" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#EA4335" d="M15 3H5a2 2 0 00-2 2v10c0 1.1.9 2 2 2h10a2 2 0 002-2V5a2 2 0 00-2-2zm0 12H5V5h10v10zm-3.67-6L9.5 12 8 10.6 6 14h8l-2.67-5z"/> + <path d="M15 3H5a2 2 0 00-2 2v10c0 1.1.9 2 2 2h10a2 2 0 002-2V5a2 2 0 00-2-2zm0 12H5V5h10v10zm-3.67-6L9.5 12 8 10.6 6 14h8l-2.67-5z"/> </g> <g id="file-pdf" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#EA4335" d="M15 3c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zM7.9 8a.5.5 0 0 1 .5.5v1.4a.5.5 0 0 1-.5.5H6.8V12H6V8.5a.5.5 0 0 1 .5-.5h1.4zm2.8 0a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5H8.8V8.5a.5.5 0 0 1 .5-.5h1.4zM14 8v.8h-1.601v.799l.801.001v.8h-.801L12.4 12h-.8V8.4A.4.4 0 0 1 12 8h2zm-3.6.8h-.8v2.4h.8V8.8zm-2.8 0h-.8v.8h.8v-.8z"/> + <path d="M15 3c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2zm0 2H5v10h10V5zM7.9 8a.5.5 0 0 1 .5.5v1.4a.5.5 0 0 1-.5.5H6.8V12H6V8.5a.5.5 0 0 1 .5-.5h1.4zm2.8 0a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5H8.8V8.5a.5.5 0 0 1 .5-.5h1.4zM14 8v.8h-1.601v.799l.801.001v.8h-.801L12.4 12h-.8V8.4A.4.4 0 0 1 12 8h2zm-3.6.8h-.8v2.4h.8V8.8zm-2.8 0h-.8v.8h.8v-.8z"/> </g> <g id="file-ppt" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#FF7537" d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zm-4 2a2 2 0 012 2v.5a2 2 0 01-2 2H8.5V13H7V7h4zm0 1.5H8.5V10H11a.5.5 0 00.5-.5V9a.5.5 0 00-.5-.5z"/> + <path d="M5 3h10a2 2 0 012 1.85V15a2 2 0 01-1.85 2H5a2 2 0 01-2-1.85V5a2 2 0 011.85-2H15zm10 2H5v10h10V5zm-4 2a2 2 0 012 2v.5a2 2 0 01-2 2H8.5V13H7V7h4zm0 1.5H8.5V10H11a.5.5 0 00.5-.5V9a.5.5 0 00-.5-.5z"/> </g> <g id="file-word" width="20" height="20" viewBox="0 0 20 20"> - <path fill="#4986E7" d="M5 3h10c1.05 0 1.918.82 1.994 1.851L17 5v10c0 1.05-.82 1.918-1.851 1.994L15 17H5c-1.05 0-1.918-.82-1.994-1.851L3 15V5c0-1.05.82-1.918 1.851-1.994L5 3h10zm10 2H5v10h10V5zM7.75 7l.75 3 .75-3h1.5l.75 3 .75-3h1.5l-1.5 6h-1.5L10 10l-.75 3h-1.5l-1.5-6h1.5z"/> + <path d="M5 3h10c1.05 0 1.918.82 1.994 1.851L17 5v10c0 1.05-.82 1.918-1.851 1.994L15 17H5c-1.05 0-1.918-.82-1.994-1.851L3 15V5c0-1.05.82-1.918 1.851-1.994L5 3h10zm10 2H5v10h10V5zM7.75 7l.75 3 .75-3h1.5l.75 3 .75-3h1.5l-1.5 6h-1.5L10 10l-.75 3h-1.5l-1.5-6h1.5z"/> </g> <g id="cancel" width="16" height="16" viewBox="0 0 16 16"> <path d="M9.65759 5.44L7.99999 7.0976L6.34239 5.44L5.43999 6.3424L7.09759 8L5.43999 9.6576L6.34239 10.56L7.99999 8.9024L9.65759 10.56L10.56 9.6576L8.90239 8L10.56 6.3424L9.65759 5.44ZM8 1.60001C4.4608 1.60001 1.6 4.46081 1.6 8.00001C1.6 11.5392 4.4608 14.4 8 14.4C11.5392 14.4 14.4 11.5392 14.4 8.00001C14.4 4.46081 11.5392 1.60001 8 1.60001ZM8 12.8C5.354 12.8 3.2 10.646 3.2 8.00001C3.2 5.35401 5.354 3.20001 8 3.20001C10.646 3.20001 12.8 5.35401 12.8 8.00001C12.8 10.646 10.646 12.8 8 12.8Z"/>
diff --git a/ash/webui/print_management/resources/print_job_entry.html b/ash/webui/print_management/resources/print_job_entry.html index fb6de82..40660ef 100644 --- a/ash/webui/print_management/resources/print_job_entry.html +++ b/ash/webui/print_management/resources/print_job_entry.html
@@ -57,7 +57,8 @@ <!-- TODO(crbug/1073693): Update the a11y based on expert guidance --> <div class="list-item flex-center" aria-label$="[[jobEntryAriaLabel_]]"> - <iron-icon id="fileIcon" class="flex-center" icon="[[fileIcon_]]" alt=""> + <iron-icon id="fileIcon" class$="[[fileIconClass_]]" icon="[[fileIcon_]]" + alt=""> </iron-icon> <div id="jobTitle" class="file-name-column overflow-ellipsis" aria-hidden="true">
diff --git a/ash/webui/print_management/resources/print_job_entry.js b/ash/webui/print_management/resources/print_job_entry.js index e45d1f3..c88b1a1 100644 --- a/ash/webui/print_management/resources/print_job_entry.js +++ b/ash/webui/print_management/resources/print_job_entry.js
@@ -32,6 +32,24 @@ const GENERIC_FILE_EXTENSION_ICON = 'print-management:file-generic'; /** + * Lookup table maps icons to the correct display class. + * @private {Map<string, string>} + */ +const ICON_CLASS_MAP = new Map([ + ['print-management:file-gdoc', 'file-icon-blue'], + ['print-management:file-word', 'file-icon-blue'], + ['print-management:file-generic', 'file-icon-gray'], + ['print-management:file-excel', 'file-icon-green'], + ['print-management:file-gform', 'file-icon-green'], + ['print-management:file-gsheet', 'file-icon-green'], + ['print-management:file-image', 'file-icon-red'], + ['print-management:file-gdraw', 'file-icon-red'], + ['print-management:file-gslide', 'file-icon-yellow'], + ['print-management:file-pdf', 'file-icon-red'], + ['print-management:file-ppt', 'file-icon-red'], +]); + +/** * Converts a mojo time to a JS time. * @param {!mojoBase.mojom.Time} mojoTime * @return {!Date} @@ -234,6 +252,12 @@ type: String, computed: 'computeFileIcon_(jobTitle_)', }, + + /** @private {string} */ + fileIconClass_: { + type: String, + computed: 'computeFileIconClass_(fileIcon_)', + }, }, observers: [ @@ -472,6 +496,16 @@ }, /** + * Uses file-icon SVG id to determine correct class to apply for file icon. + * @return {string} + * @private + */ + computeFileIconClass_() { + const iconClass = ICON_CLASS_MAP.get(this.fileIcon_); + return `flex-center ${iconClass}`; + }, + + /** * @param {!ash.printing.printingManager.mojom.PrinterErrorCode} * mojoPrinterErrorCode * @return {string}
diff --git a/ash/webui/print_management/resources/print_management_shared_css.html b/ash/webui/print_management/resources/print_management_shared_css.html index a67284d..5c6e4d1 100644 --- a/ash/webui/print_management/resources/print_management_shared_css.html +++ b/ash/webui/print_management/resources/print_management_shared_css.html
@@ -13,6 +13,48 @@ display: flex; } + .file-icon-blue { + --iron-icon-fill-color: var(--google-blue-600); + } + + .file-icon-gray { + --iron-icon-fill-color: var(--google-grey-700); + } + + .file-icon-green { + --iron-icon-fill-color: var(--google-green-600); + } + + .file-icon-red { + --iron-icon-fill-color: var(--google-red-600); + } + + .file-icon-yellow { + --iron-icon-fill-color: var(--google-yellow-600); + } + + @media (prefers-color-scheme: dark) { + .file-icon-blue { + --iron-icon-fill-color: var(--google-blue-300); + } + + .file-icon-gray { + --iron-icon-fill-color: var(--google-grey-300); + } + + .file-icon-green { + --iron-icon-fill-color: var(--google-green-300); + } + + .file-icon-red { + --iron-icon-fill-color: var(--google-red-300); + } + + .file-icon-yellow { + --iron-icon-fill-color: var(--google-yellow-300); + } + } + .overflow-ellipsis { overflow: hidden; text-overflow: ellipsis;
diff --git a/ash/wm/desks/desk_animation_impl.cc b/ash/wm/desks/desk_animation_impl.cc index ca8bace7..395d90a3 100644 --- a/ash/wm/desks/desk_animation_impl.cc +++ b/ash/wm/desks/desk_animation_impl.cc
@@ -7,11 +7,11 @@ #include "ash/public/cpp/presentation_time_recorder.h" #include "ash/root_window_controller.h" #include "ash/shell.h" +#include "ash/utility/haptics_util.h" #include "ash/wm/desks/desk.h" #include "ash/wm/desks/desks_controller.h" #include "ash/wm/desks/desks_histogram_enums.h" #include "ash/wm/desks/desks_util.h" -#include "ash/wm/haptics_util.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/splitview/split_view_utils.h" #include "ash/wm/window_util.h"
diff --git a/ash/wm/desks/desks_bar_view.cc b/ash/wm/desks/desks_bar_view.cc index 5923d36..46011ea 100644 --- a/ash/wm/desks/desks_bar_view.cc +++ b/ash/wm/desks/desks_bar_view.cc
@@ -17,6 +17,7 @@ #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/style/ash_color_provider.h" +#include "ash/utility/haptics_util.h" #include "ash/wm/desks/desk_drag_proxy.h" #include "ash/wm/desks/desk_mini_view.h" #include "ash/wm/desks/desk_mini_view_animations.h" @@ -31,7 +32,6 @@ #include "ash/wm/desks/templates/desks_templates_presenter.h" #include "ash/wm/desks/templates/desks_templates_util.h" #include "ash/wm/desks/zero_state_button.h" -#include "ash/wm/haptics_util.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_highlight_controller.h"
diff --git a/ash/wm/desks/desks_controller.cc b/ash/wm/desks/desks_controller.cc index aecb466..3327e28b 100644 --- a/ash/wm/desks/desks_controller.cc +++ b/ash/wm/desks/desks_controller.cc
@@ -20,6 +20,7 @@ #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/strings/grit/ash_strings.h" +#include "ash/utility/haptics_util.h" #include "ash/wm/desks/desk.h" #include "ash/wm/desks/desk_animation_base.h" #include "ash/wm/desks/desk_animation_impl.h" @@ -27,7 +28,6 @@ #include "ash/wm/desks/desks_restore_util.h" #include "ash/wm/desks/desks_util.h" #include "ash/wm/desks/templates/desks_templates_dialog_controller.h" -#include "ash/wm/haptics_util.h" #include "ash/wm/mru_window_tracker.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h"
diff --git a/ash/wm/desks/templates/desks_templates_icon_view.cc b/ash/wm/desks/templates/desks_templates_icon_view.cc index 25e79b42..0567a12 100644 --- a/ash/wm/desks/templates/desks_templates_icon_view.cc +++ b/ash/wm/desks/templates/desks_templates_icon_view.cc
@@ -152,11 +152,13 @@ // Move `this` to the back of the visible icons, i.e. before any invisible // siblings and before the overflow counter, - size_t i = 0; auto siblings = parent()->children(); - while (i < siblings.size() - 2 && siblings[i]->GetVisible()) - ++i; - parent()->ReorderChildView(this, i); + if (siblings.size() >= 2) { + size_t i = 0; + while (i < siblings.size() - 2 && siblings[i]->GetVisible()) + ++i; + parent()->ReorderChildView(this, i); + } } BEGIN_METADATA(DesksTemplatesIconView, views::View)
diff --git a/ash/wm/desks/templates/desks_templates_item_view.cc b/ash/wm/desks/templates/desks_templates_item_view.cc index 8e3d146..5ca712d7 100644 --- a/ash/wm/desks/templates/desks_templates_item_view.cc +++ b/ash/wm/desks/templates/desks_templates_item_view.cc
@@ -130,7 +130,8 @@ views::Builder<DesksTemplatesNameView>() .CopyAddressTo(&name_view_) .SetText(template_name) - .SetAccessibleName(template_name), + .SetAccessibleName(template_name) + .SetReadOnly(!desk_template_->IsModifiable()), views::Builder<views::ImageView>() .SetPreferredSize( gfx::Size(kManagedStatusIndicatorSize,
diff --git a/ash/wm/overview/overview_session.cc b/ash/wm/overview/overview_session.cc index 4fb8c5a..1f21f7bf 100644 --- a/ash/wm/overview/overview_session.cc +++ b/ash/wm/overview/overview_session.cc
@@ -25,6 +25,7 @@ #include "ash/system/message_center/unified_message_center_bubble.h" #include "ash/system/unified/unified_system_tray.h" #include "ash/system/unified/unified_system_tray_bubble.h" +#include "ash/utility/haptics_util.h" #include "ash/wm/desks/desk.h" #include "ash/wm/desks/desks_bar_view.h" #include "ash/wm/desks/desks_controller.h" @@ -32,7 +33,6 @@ #include "ash/wm/desks/templates/desks_templates_dialog_controller.h" #include "ash/wm/desks/templates/desks_templates_presenter.h" #include "ash/wm/desks/templates/desks_templates_util.h" -#include "ash/wm/haptics_util.h" #include "ash/wm/mru_window_tracker.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_delegate.h"
diff --git a/ash/wm/overview/overview_window_drag_controller.cc b/ash/wm/overview/overview_window_drag_controller.cc index 7415ec7..8904478 100644 --- a/ash/wm/overview/overview_window_drag_controller.cc +++ b/ash/wm/overview/overview_window_drag_controller.cc
@@ -13,10 +13,10 @@ #include "ash/public/cpp/presentation_time_recorder.h" #include "ash/screen_util.h" #include "ash/shell.h" +#include "ash/utility/haptics_util.h" #include "ash/wm/desks/desk_preview_view.h" #include "ash/wm/desks/desks_bar_view.h" #include "ash/wm/desks/desks_util.h" -#include "ash/wm/haptics_util.h" #include "ash/wm/overview/overview_constants.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h"
diff --git a/ash/wm/splitview/split_view_drag_indicators.cc b/ash/wm/splitview/split_view_drag_indicators.cc index d5658602..0647633 100644 --- a/ash/wm/splitview/split_view_drag_indicators.cc +++ b/ash/wm/splitview/split_view_drag_indicators.cc
@@ -17,7 +17,7 @@ #include "ash/style/ash_color_provider.h" #include "ash/style/default_color_constants.h" #include "ash/style/default_colors.h" -#include "ash/wm/haptics_util.h" +#include "ash/utility/haptics_util.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_window_drag_controller.h" #include "ash/wm/splitview/split_view_constants.h"
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index b62d742..4332349f 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -17,10 +17,10 @@ #include "ash/screen_util.h" #include "ash/session/session_controller_impl.h" #include "ash/shell.h" +#include "ash/utility/haptics_util.h" #include "ash/wm/default_window_resizer.h" #include "ash/wm/desks/desks_util.h" #include "ash/wm/drag_window_resizer.h" -#include "ash/wm/haptics_util.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/pip/pip_window_resizer.h" #include "ash/wm/tablet_mode/tablet_mode_browser_window_drag_delegate.h"
diff --git a/base/allocator/partition_allocator/partition_alloc_check.h b/base/allocator/partition_allocator/partition_alloc_check.h index 8450727a..a4aef54 100644 --- a/base/allocator/partition_allocator/partition_alloc_check.h +++ b/base/allocator/partition_allocator/partition_alloc_check.h
@@ -96,7 +96,7 @@ #endif -namespace pa { +namespace partition_alloc::internal { // Used for PA_DEBUG_DATA_ON_STACK, below. struct alignas(16) DebugKv { @@ -120,7 +120,8 @@ v = value; } }; -} // namespace pa + +} // namespace partition_alloc::internal #define PA_CONCAT(x, y) x##y #define PA_CONCAT2(x, y) PA_CONCAT(x, y) @@ -144,8 +145,8 @@ // With gdb, one can use: // x/8g <STACK_POINTER> // to see the data. With lldb, "x <STACK_POINTER> <FRAME_POJNTER>" can be used. -#define PA_DEBUG_DATA_ON_STACK(name, value) \ - pa::DebugKv PA_DEBUG_UNIQUE_NAME{name, value}; \ - base::debug::Alias(&PA_DEBUG_UNIQUE_NAME); +#define PA_DEBUG_DATA_ON_STACK(name, value) \ + ::partition_alloc::internal::DebugKv PA_DEBUG_UNIQUE_NAME{name, value}; \ + ::base::debug::Alias(&PA_DEBUG_UNIQUE_NAME); #endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_CHECK_H_
diff --git a/base/allocator/partition_allocator/spinning_mutex.cc b/base/allocator/partition_allocator/spinning_mutex.cc index e1f8a7ed..e6eca3d 100644 --- a/base/allocator/partition_allocator/spinning_mutex.cc +++ b/base/allocator/partition_allocator/spinning_mutex.cc
@@ -28,12 +28,12 @@ #if BUILDFLAG(IS_POSIX) #include <sched.h> -#define YIELD_THREAD sched_yield() +#define PA_YIELD_THREAD sched_yield() #else // Other OS #warning "Thread yield not supported on this OS." -#define YIELD_THREAD ((void)0) +#define PA_YIELD_THREAD ((void)0) #endif #endif // !defined(PA_HAS_FAST_MUTEX) @@ -140,7 +140,7 @@ int yield_thread_count = 0; do { if (yield_thread_count < 10) { - YIELD_THREAD; + PA_YIELD_THREAD; yield_thread_count++; } else { // At this point, it's likely that the lock is held by a lower priority
diff --git a/base/allocator/partition_allocator/spinning_mutex.h b/base/allocator/partition_allocator/spinning_mutex.h index 73fe33b..89768c7 100644 --- a/base/allocator/partition_allocator/spinning_mutex.h +++ b/base/allocator/partition_allocator/spinning_mutex.h
@@ -102,7 +102,7 @@ private: void LockSlow() EXCLUSIVE_LOCK_FUNCTION(); - // See below, the latency of YIELD_PROCESSOR can be as high as ~150 + // See below, the latency of PA_YIELD_PROCESSOR can be as high as ~150 // cycles. Meanwhile, sleeping costs a few us. Spinning 64 times at 3GHz would // cost 150 * 64 / 3e9 ~= 3.2us. // @@ -172,7 +172,7 @@ // Also, loop several times here, following the guidelines in section 2.3.4 // of the manual, "Pause latency in Skylake Client Microarchitecture". for (int yields = 0; yields < backoff; yields++) { - YIELD_PROCESSOR; + PA_YIELD_PROCESSOR; tries++; } constexpr int kMaxBackoff = 16;
diff --git a/base/allocator/partition_allocator/yield_processor.h b/base/allocator/partition_allocator/yield_processor.h index 8265554..0d987cbf 100644 --- a/base/allocator/partition_allocator/yield_processor.h +++ b/base/allocator/partition_allocator/yield_processor.h
@@ -7,7 +7,7 @@ #include "build/build_config.h" -// The YIELD_PROCESSOR macro wraps an architecture specific-instruction that +// The PA_YIELD_PROCESSOR macro wraps an architecture specific-instruction that // informs the processor we're in a busy wait, so it can handle the branch more // intelligently and e.g. reduce power to our core or give more resources to the // other hyper-thread on this core. See the following for context: @@ -15,31 +15,31 @@ #if BUILDFLAG(IS_NACL) // Inline assembly not allowed. -#define YIELD_PROCESSOR ((void)0) +#define PA_YIELD_PROCESSOR ((void)0) #else #if defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_X86) -#define YIELD_PROCESSOR __asm__ __volatile__("pause") +#define PA_YIELD_PROCESSOR __asm__ __volatile__("pause") #elif (defined(ARCH_CPU_ARMEL) && __ARM_ARCH >= 6) || defined(ARCH_CPU_ARM64) -#define YIELD_PROCESSOR __asm__ __volatile__("yield") +#define PA_YIELD_PROCESSOR __asm__ __volatile__("yield") #elif defined(ARCH_CPU_MIPSEL) // The MIPS32 docs state that the PAUSE instruction is a no-op on older // architectures (first added in MIPS32r2). To avoid assembler errors when // targeting pre-r2, we must encode the instruction manually. -#define YIELD_PROCESSOR __asm__ __volatile__(".word 0x00000140") +#define PA_YIELD_PROCESSOR __asm__ __volatile__(".word 0x00000140") #elif defined(ARCH_CPU_MIPS64EL) && __mips_isa_rev >= 2 // Don't bother doing using .word here since r2 is the lowest supported mips64 // that Chromium supports. -#define YIELD_PROCESSOR __asm__ __volatile__("pause") +#define PA_YIELD_PROCESSOR __asm__ __volatile__("pause") #elif defined(ARCH_CPU_PPC64_FAMILY) -#define YIELD_PROCESSOR __asm__ __volatile__("or 31,31,31") +#define PA_YIELD_PROCESSOR __asm__ __volatile__("or 31,31,31") #elif defined(ARCH_CPU_S390_FAMILY) // just do nothing -#define YIELD_PROCESSOR ((void)0) +#define PA_YIELD_PROCESSOR ((void)0) #endif // ARCH -#ifndef YIELD_PROCESSOR -#define YIELD_PROCESSOR ((void)0) +#ifndef PA_YIELD_PROCESSOR +#define PA_YIELD_PROCESSOR ((void)0) #endif #endif // BUILDFLAG(IS_NACL)
diff --git a/base/time/time.cc b/base/time/time.cc index bb1d658..32c2fc50 100644 --- a/base/time/time.cc +++ b/base/time/time.cc
@@ -28,6 +28,16 @@ namespace base { +namespace { + +const char kWeekdayName[7][4] = {"Sun", "Mon", "Tue", "Wed", + "Thu", "Fri", "Sat"}; + +const char kMonthName[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + +} // namespace + namespace internal { std::atomic<TimeNowFunction> g_time_now_function{ @@ -402,4 +412,13 @@ // clang-format on } +std::string TimeFormatHTTP(base::Time time) { + base::Time::Exploded exploded; + time.UTCExplode(&exploded); + return base::StringPrintf( + "%s, %02d %s %04d %02d:%02d:%02d GMT", kWeekdayName[exploded.day_of_week], + exploded.day_of_month, kMonthName[exploded.month - 1], exploded.year, + exploded.hour, exploded.minute, exploded.second); +} + } // namespace base
diff --git a/base/time/time.h b/base/time/time.h index 9536dad..1ab3746 100644 --- a/base/time/time.h +++ b/base/time/time.h
@@ -1145,6 +1145,10 @@ // For logging use only. BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); +// Returns a string representation of the given time in the IMF-fixdate format +// defined by RFC 7231 (satisfying its HTTP-date format). +BASE_EXPORT std::string TimeFormatHTTP(base::Time time); + } // namespace base #endif // BASE_TIME_TIME_H_
diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc index 9aacfd9e..9fc0501 100644 --- a/base/time/time_unittest.cc +++ b/base/time/time_unittest.cc
@@ -1205,6 +1205,12 @@ #undef MAYBE_NowOverride +TEST_F(TimeTest, TimeFormatHTTP) { + base::Time time; + ASSERT_TRUE(base::Time::FromString("1994-11-06T08:49:37Z", &time)); + EXPECT_EQ("Sun, 06 Nov 1994 08:49:37 GMT", TimeFormatHTTP(time)); +} + #if BUILDFLAG(IS_FUCHSIA) TEST(ZxTimeTest, ToFromConversions) { Time unix_epoch = Time::UnixEpoch();
diff --git a/build/chromeos/test_runner.py b/build/chromeos/test_runner.py index 01c2c8b..c3d18a3 100755 --- a/build/chromeos/test_runner.py +++ b/build/chromeos/test_runner.py
@@ -9,7 +9,6 @@ import json import logging import os -import pipes import re import shutil import signal @@ -132,20 +131,6 @@ if args.public_image: self._test_cmd += ['--public-image'] - # This environment variable is set for tests that have been instrumented - # for code coverage. Its incoming value is expected to be a location - # inside a subdirectory of result_dir above. This is converted to an - # absolute path that the vm is able to write to, and passed in the - # --results-src flag to cros_run_vm_test for copying out of the vm before - # its termination. - self._llvm_profile_var = None - if os.environ.get('LLVM_PROFILE_FILE'): - _, llvm_profile_file = os.path.split(os.environ['LLVM_PROFILE_FILE']) - self._llvm_profile_var = '/tmp/profraw/%s' % llvm_profile_file - - # This should make the vm test runner exfil the profiling data. - self._test_cmd += ['--results-src', '/tmp/profraw'] - self._test_env = setup_env() @property @@ -281,7 +266,7 @@ 'lacros-chrome deployment uses --nostrip by default, so it cannot ' 'be specificed with --deploy-lacros.') - if not self._llvm_profile_var and not self._logs_dir: + if not self._logs_dir: # The host-side Tast bin returns 0 when tests fail, so we need to capture # and parse its json results to reliably determine if tests fail. raise TestFormatError( @@ -323,86 +308,49 @@ os.path.relpath(self._path_to_outdir, CHROMIUM_SRC_PATH) ] + self._additional_args - # Coverage tests require some special pre-test setup, so use an - # on_device_script in that case. For all other tests, use cros_run_test's - # built-in '--tast' option. This gives us much better results reporting. - if self._llvm_profile_var: - # Build the shell script that will be used on the device to invoke the - # test. - device_test_script_contents = self.BASIC_SHELL_SCRIPT[:] - device_test_script_contents += [ - 'echo "LLVM_PROFILE_FILE=%s" >> /etc/chrome_dev.conf' % - (self._llvm_profile_var) - ] - - local_test_runner_cmd = ['local_test_runner', '-waituntilready'] - if self._use_vm: - # If we're running tests in VMs, tell the test runner to skip tests that - # aren't compatible. - local_test_runner_cmd.append('-extrauseflags=tast_vm') - if self._attr_expr: - local_test_runner_cmd.append(pipes.quote(self._attr_expr)) - else: - local_test_runner_cmd.extend(self._tests) - device_test_script_contents.append(' '.join(local_test_runner_cmd)) - - self._on_device_script = self.write_test_script_to_disk( - device_test_script_contents) - + # Capture tast's results in the logs dir as well. + if self._logs_dir: self._test_cmd += [ - '--files', - os.path.relpath(self._on_device_script), '--', - './' + os.path.relpath(self._on_device_script, self._path_to_outdir) + '--results-dir', + self._logs_dir, ] + self._test_cmd += [ + '--tast-total-shards=%d' % self._test_launcher_total_shards, + '--tast-shard-index=%d' % self._test_launcher_shard_index, + ] + # If we're using a test filter, replace the contents of the Tast + # conditional with a long list of "name:test" expressions, one for each + # test in the filter. + if self._gtest_style_filter: + if self._attr_expr or self._tests: + logging.warning( + 'Presence of --gtest_filter will cause the specified Tast expr' + ' or test list to be ignored.') + names = [] + for test in self._gtest_style_filter.split(':'): + names.append('"name:%s"' % test) + self._attr_expr = '(' + ' || '.join(names) + ')' + + if self._attr_expr: + # Don't use pipes.quote() here. Something funky happens with the arg + # as it gets passed down from cros_run_test to tast. (Tast picks up the + # escaping single quotes and complains that the attribute expression + # "must be within parentheses".) + self._test_cmd.append('--tast=%s' % self._attr_expr) else: - # Capture tast's results in the logs dir as well. - if self._logs_dir: - self._test_cmd += [ - '--results-dir', - self._logs_dir, - ] - self._test_cmd += [ - '--tast-total-shards=%d' % self._test_launcher_total_shards, - '--tast-shard-index=%d' % self._test_launcher_shard_index, - ] - # If we're using a test filter, replace the contents of the Tast - # conditional with a long list of "name:test" expressions, one for each - # test in the filter. - if self._gtest_style_filter: - if self._attr_expr or self._tests: - logging.warning( - 'Presence of --gtest_filter will cause the specified Tast expr' - ' or test list to be ignored.') - names = [] - for test in self._gtest_style_filter.split(':'): - names.append('"name:%s"' % test) - self._attr_expr = '(' + ' || '.join(names) + ')' + self._test_cmd.append('--tast') + self._test_cmd.extend(self._tests) - if self._attr_expr: - # Don't use pipes.quote() here. Something funky happens with the arg - # as it gets passed down from cros_run_test to tast. (Tast picks up the - # escaping single quotes and complains that the attribute expression - # "must be within parentheses".) - self._test_cmd.append('--tast=%s' % self._attr_expr) - else: - self._test_cmd.append('--tast') - self._test_cmd.extend(self._tests) + for v in self._tast_vars or []: + self._test_cmd.extend(['--tast-var', v]) - for v in self._tast_vars or []: - self._test_cmd.extend(['--tast-var', v]) - - # Mounting ash-chrome gives it enough disk space to not need stripping, - # but only for one not instrumented with code coverage. - # Lacros uses --nostrip by default, so there is no need to specify. - if not self._deploy_lacros and not self._should_strip: - self._test_cmd.append('--nostrip') + # Mounting ash-chrome gives it enough disk space to not need stripping, + # but only for one not instrumented with code coverage. + # Lacros uses --nostrip by default, so there is no need to specify. + if not self._deploy_lacros and not self._should_strip: + self._test_cmd.append('--nostrip') def post_run(self, return_code): - # If we don't need to parse the host-side Tast tool's results, fall back to - # the parent method's default behavior. - if self._llvm_profile_var: - return super().post_run(return_code) - tast_results_path = os.path.join(self._logs_dir, 'streamed_results.jsonl') if not os.path.exists(tast_results_path): logging.error( @@ -592,11 +540,6 @@ # Build the shell script that will be used on the device to invoke the test. # Stored here as a list of lines. device_test_script_contents = self.BASIC_SHELL_SCRIPT[:] - if self._llvm_profile_var: - device_test_script_contents += [ - 'export LLVM_PROFILE_FILE=%s' % self._llvm_profile_var, - ] - for var_name, var_val in self._env_vars: device_test_script_contents += ['export %s=%s' % (var_name, var_val)]
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index d5bc5224..79f1b1a 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn
@@ -5,7 +5,6 @@ import("//build/config/c++/c++.gni") import("//build/config/chrome_build.gni") import("//build/config/chromecast_build.gni") -import("//build/config/crypto.gni") import("//build/config/dcheck_always_on.gni") import("//build/config/features.gni") @@ -63,9 +62,6 @@ if (use_glib) { defines += [ "USE_GLIB=1" ] } - if (use_nss_certs) { - defines += [ "USE_NSS_CERTS=1" ] - } if (use_ozone && !is_android) { # Note that some Chrome OS builds unconditionally set |use_ozone| to true, # but they also build some targets with the Android toolchain. This ensures
diff --git a/build/config/crypto.gni b/build/config/crypto.gni deleted file mode 100644 index 4d2c011..0000000 --- a/build/config/crypto.gni +++ /dev/null
@@ -1,15 +0,0 @@ -# Copyright (c) 2013 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 declares build flags for the SSL library configuration. -# -# TODO(brettw) this should probably be moved to src/crypto or somewhere, and -# the global build dependency on it should be removed. -# -# PLEASE TRY TO AVOID ADDING FLAGS TO THIS FILE in cases where grit isn't -# required. See the declare_args block of BUILDCONFIG.gn for advice on how -# to set up feature flags. - -# True if NSS is used for certificate handling. -use_nss_certs = is_linux || is_chromeos
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index c9b7a00e..b0a5f77 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -7.20220119.1.1 +7.20220119.3.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index c9b7a00e..b0a5f77 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -7.20220119.1.1 +7.20220119.3.1
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index cf5ccbd..363a920 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn
@@ -20,6 +20,7 @@ import("//components/exo/buildflags.gni") import("//components/gwp_asan/buildflags/buildflags.gni") import("//components/nacl/features.gni") +import("//components/optimization_guide/features.gni") import("//extensions/buildflags/buildflags.gni") import("//media/media_options.gni") import("//ppapi/buildflags/buildflags.gni") @@ -1038,6 +1039,20 @@ } } + if (build_with_internal_optimization_guide) { + # Add the optimization guide .dylib in the MODULE_DIR of Chromium.app + bundle_data("optimization_guide_library") { + sources = [ + "$root_out_dir/og_intermediates/liboptimization_guide_internal.dylib", + ] + outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ] + public_deps = [ "//components/optimization_guide/core:optimization_guide_internal_library_copy" ] + } + } else { + group("optimization_guide_library") { + } + } + tweak_info_plist("chrome_framework_plist") { info_plist = "app/framework-Info.plist" args = [ @@ -1146,6 +1161,7 @@ ":chrome_framework_plugins", ":chrome_framework_resources", ":keystone_registration_framework", + ":optimization_guide_library", ":swiftshader_library", ":widevine_cdm_library", "//chrome/browser/resources/media/mei_preload:component_bundle", @@ -1239,6 +1255,10 @@ "$root_out_dir/libvk_swiftshader.dylib", _framework_binary_path, ] + if (build_with_internal_optimization_guide) { + _chrome_symbols_sources += + [ "$root_out_dir/liboptimization_guide_internal.dylib" ] + } foreach(helper_params, chrome_mac_helpers) { _chrome_symbols_sources += [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.app/Contents/MacOS/${chrome_helper_name}${helper_params[2]}" ] @@ -1273,6 +1293,9 @@ "//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2", "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan", ] + if (build_with_internal_optimization_guide) { + deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ] + } foreach(helper_params, chrome_mac_helpers) { deps += [ ":chrome_helper_app_${helper_params[0]}" ] @@ -1296,6 +1319,9 @@ "$root_out_dir/libswiftshader_libGLESv2.dylib.dSYM", "$root_out_dir/libvk_swiftshader.dylib.dSYM", ] + if (build_with_internal_optimization_guide) { + _dsyms += [ "$root_out_dir/liboptimization_guide_internal.dylib.dSYM" ] + } deps = [ ":chrome_app", @@ -1307,6 +1333,9 @@ "//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2", "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan", ] + if (build_with_internal_optimization_guide) { + deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ] + } foreach(helper_params, chrome_mac_helpers) { _dsyms += @@ -1725,6 +1754,9 @@ if (!is_chromeos) { deps += [ ":angle_libvulkan_symbols" ] } + if (build_with_internal_optimization_guide) { + deps += [ ":optimization_guide_symbols" ] + } } extract_symbols("chrome_symbols") { binary = "$root_out_dir/chrome" @@ -1827,6 +1859,19 @@ deps = [ "//third_party/vulkan-deps/vulkan-loader/src:libvulkan" ] } } + if (build_with_internal_optimization_guide) { + extract_symbols("optimization_guide_symbols") { + binary = "$root_out_dir/liboptimization_guide_internal.so" + if (current_cpu == "x86") { + # GYP used "ia32" so keep that naming for back-compat. + symbol_file = "$root_out_dir/optimization_guide.breakpad.ia32" + } else { + symbol_file = "$root_out_dir/optimization_guide.breakpad.$current_cpu" + } + + deps = [ "//components/optimization_guide/internal:optimization_guide_internal" ] + } + } } # Copies some scripts and resources that are used for desktop integration.
diff --git a/chrome/VERSION b/chrome/VERSION index 0b4fa58..5a019ad 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=99 MINOR=0 -BUILD=4841 +BUILD=4842 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index f2b89b1..86845e0 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -3898,7 +3898,6 @@ "java/src/org/chromium/chrome/browser/infobar/AutofillCreditCardFillingInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/AutofillOfferNotificationInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/AutofillSaveCardInfoBar.java", - "java/src/org/chromium/chrome/browser/infobar/DataReductionPromoInfoBarDelegate.java", "java/src/org/chromium/chrome/browser/infobar/DownloadProgressInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/DuplicateDownloadInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/FramebustBlockInfoBar.java",
diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni index 367579a..9d1f3c94 100644 --- a/chrome/android/chrome_java_resources.gni +++ b/chrome/android/chrome_java_resources.gni
@@ -456,7 +456,6 @@ "java/res/drawable/contextual_search_panel_help_background.xml", "java/res/drawable/custom_tabs_handle_view_shape.xml", "java/res/drawable/data_reduction_big.xml", - "java/res/drawable/data_reduction_illustration.xml", "java/res/drawable/devices_black_24dp.xml", "java/res/drawable/discover_card.xml", "java/res/drawable/distilled_page_pref_background.xml", @@ -632,7 +631,6 @@ "java/res/layout/fake_search_box_layout.xml", "java/res/layout/find_in_page.xml", "java/res/layout/find_toolbar.xml", - "java/res/layout/fre_data_reduction_proxy_lite_mode.xml", "java/res/layout/fre_tos_privacy_disclaimer.xml", "java/res/layout/fre_tosanduma.xml", "java/res/layout/fullscreen_notification.xml",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 5e53c76..aa496d9 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -491,10 +491,7 @@ "java/src/org/chromium/chrome/browser/customtabs/features/toolbar/CustomTabToolbarAnimationDelegate.java", "java/src/org/chromium/chrome/browser/customtabs/features/toolbar/CustomTabToolbarColorController.java", "java/src/org/chromium/chrome/browser/customtabs/features/toolbar/CustomTabToolbarCoordinator.java", - "java/src/org/chromium/chrome/browser/datareduction/DataReductionPromoScreen.java", - "java/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtils.java", "java/src/org/chromium/chrome/browser/datareduction/DataReductionProxyUma.java", - "java/src/org/chromium/chrome/browser/datareduction/DataReductionSavingsMilestonePromo.java", "java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionDataUseItem.java", "java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionPreferenceFragment.java", "java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionSiteBreakdownView.java", @@ -605,7 +602,6 @@ "java/src/org/chromium/chrome/browser/findinpage/FindToolbarObserver.java", "java/src/org/chromium/chrome/browser/findinpage/FindToolbarPhone.java", "java/src/org/chromium/chrome/browser/findinpage/FindToolbarTablet.java", - "java/src/org/chromium/chrome/browser/firstrun/DataReductionProxyFirstRunFragment.java", "java/src/org/chromium/chrome/browser/firstrun/DefaultSearchEngineFirstRunFragment.java", "java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java", "java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java", @@ -618,7 +614,6 @@ "java/src/org/chromium/chrome/browser/firstrun/FirstRunPagerAdapter.java", "java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java", "java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java", - "java/src/org/chromium/chrome/browser/firstrun/FirstRunView.java", "java/src/org/chromium/chrome/browser/firstrun/ForcedSigninProcessor.java", "java/src/org/chromium/chrome/browser/firstrun/FreIntentCreator.java", "java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java", @@ -691,8 +686,6 @@ "java/src/org/chromium/chrome/browser/infobar/AutofillOfferNotificationInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/AutofillSaveCardInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/CardDetail.java", - "java/src/org/chromium/chrome/browser/infobar/DataReductionPromoInfoBar.java", - "java/src/org/chromium/chrome/browser/infobar/DataReductionPromoInfoBarDelegate.java", "java/src/org/chromium/chrome/browser/infobar/DownloadProgressInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/DuplicateDownloadInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/FramebustBlockInfoBar.java",
diff --git a/chrome/android/chrome_test_java_sources.gni b/chrome/android/chrome_test_java_sources.gni index e157b9d..5aed59b 100644 --- a/chrome/android/chrome_test_java_sources.gni +++ b/chrome/android/chrome_test_java_sources.gni
@@ -163,8 +163,6 @@ "javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityTabControllerTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/content/TabObserverRegistrarTest.java", - "javatests/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtilsTest.java", - "javatests/src/org/chromium/chrome/browser/datareduction/DataReductionSavingsMilestonePromoTest.java", "javatests/src/org/chromium/chrome/browser/datareduction/settings/DataReductionStatsPreferenceTest.java", "javatests/src/org/chromium/chrome/browser/dependency_injection/ModuleOverridesRule.java", "javatests/src/org/chromium/chrome/browser/device_dialog/BluetoothChooserDialogTest.java",
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java index 17f5b7d1..e6f6c8a2 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java
@@ -1471,9 +1471,9 @@ // Incognito in both light/dark theme is the same as non-incognito mode in dark theme. // Non-incognito mode and incognito in both light/dark themes in dark theme all look // dark. - ColorStateList checkedDrawableColorList = AppCompatResources.getColorStateList(mContext, - pseudoTab.isIncognito() ? R.color.default_icon_color_dark - : R.color.default_icon_color_inverse); + ColorStateList checkedDrawableColorList = ColorStateList.valueOf(pseudoTab.isIncognito() + ? mContext.getColor(R.color.default_icon_color_dark) + : SemanticColorUtils.getDefaultIconColorInverse(mContext)); ColorStateList actionButtonBackgroundColorList = AppCompatResources.getColorStateList(mContext, pseudoTab.isIncognito() ? R.color.default_icon_color_light
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorToolbar.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorToolbar.java index 2bdb5ad..9d4dc5b 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorToolbar.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabSelectionEditorToolbar.java
@@ -11,9 +11,9 @@ import androidx.annotation.ColorInt; import androidx.annotation.PluralsRes; -import androidx.appcompat.content.res.AppCompatResources; import org.chromium.chrome.tab_ui.R; +import org.chromium.components.browser_ui.styles.SemanticColorUtils; import org.chromium.components.browser_ui.widget.NumberRollView; import org.chromium.components.browser_ui.widget.TintedDrawable; import org.chromium.components.browser_ui.widget.selectable_list.SelectableListToolbar; @@ -48,9 +48,9 @@ private void showNavigationButton() { TintedDrawable navigationIconDrawable = TintedDrawable.constructTintedDrawable( getContext(), org.chromium.chrome.R.drawable.ic_arrow_back_white_24dp); - ColorStateList lightIconColorList = AppCompatResources.getColorStateList( - getContext(), org.chromium.chrome.R.color.default_icon_color_inverse); - navigationIconDrawable.setTint(lightIconColorList); + final @ColorInt int lightIconColor = + SemanticColorUtils.getDefaultIconColorInverse(getContext()); + navigationIconDrawable.setTint(lightIconColor); setNavigationIcon(navigationIconDrawable); setNavigationContentDescription(TabUiFeatureUtilities.isLaunchPolishEnabled()
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabUiThemeProvider.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabUiThemeProvider.java index 4848d79..da8dd5d 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabUiThemeProvider.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabUiThemeProvider.java
@@ -192,11 +192,6 @@ */ public static ColorStateList getToggleActionButtonCheckedDrawableTintList( Context context, boolean isIncognito) { - if (!themeRefactorEnabled()) { - return AppCompatResources.getColorStateList(context, - isIncognito ? R.color.default_icon_color_dark - : R.color.default_icon_color_inverse); - } if (isIncognito) { return AppCompatResources.getColorStateList( context, R.color.incognito_tab_bg_selected_color);
diff --git a/chrome/android/java/res/drawable/data_reduction_illustration.xml b/chrome/android/java/res/drawable/data_reduction_illustration.xml deleted file mode 100644 index 18b4542..0000000 --- a/chrome/android/java/res/drawable/data_reduction_illustration.xml +++ /dev/null
@@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. --> - -<!-- VectorRaster warning is ignored because we intentionally want the width to - be greater than 200. --> -<vector xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - tools:ignore="VectorRaster" - android:width="224dp" - android:height="107dp" - android:viewportWidth="224" - android:viewportHeight="107"> - <path android:fillColor="#F1F3F4" - android:fillType="nonZero" - android:pathData="M156.91,3.733l18.155,31.59l-90.126,-1.508l12.968,-31.662z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#E1741F" - android:fillType="nonZero" - android:pathData="M220.729,52.338L218.928,52.338C217.703,52.338 216.694,51.333 216.694,50.113L216.694,44.369C216.694,43.149 217.703,42.144 218.928,42.144L220.729,42.144C221.954,42.144 222.962,43.149 222.962,44.369L222.962,50.113C223.034,51.333 222.026,52.338 220.729,52.338Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#DADCE0" - android:fillType="nonZero" - android:pathData="M115.125,1.149h2.089v39.056h-2.089z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#F9BB2D" - android:fillType="nonZero" - android:pathData="M48.842,81.128L198.992,81.128C210.228,81.128 219.313,71.723 219.313,60.092L219.313,37.836C219.313,35.467 217.44,33.528 215.152,33.528L32.266,33.528C30.116,33.528 28.313,35.323 28.313,37.621L28.313,59.949C28.313,71.651 37.537,81.128 48.842,81.128Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#494C4F" - android:fillType="nonZero" - android:pathData="M74.764,106.115a25.924,22.906 104.033,1 0,12.573 -50.301a25.924,22.906 104.033,1 0,-12.573 50.301z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#DADCE0" - android:fillType="nonZero" - android:pathData="M78.334,91.832a11.203,9.94 104.033,1 0,5.433 -21.737a11.203,9.94 104.033,1 0,-5.433 21.737z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#494C4F" - android:fillType="nonZero" - android:pathData="M161.629,106.111a25.924,22.906 104.033,1 0,12.573 -50.301a25.924,22.906 104.033,1 0,-12.573 50.301z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#DADCE0" - android:fillType="nonZero" - android:pathData="M165.199,91.828a11.203,9.94 104.033,1 0,5.433 -21.737a11.203,9.94 104.033,1 0,-5.433 21.737z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#BDC1C6" - android:fillType="nonZero" - android:pathData="M219.801,77.682L215.118,77.682C213.101,77.682 211.444,76.031 211.444,74.021L211.444,71.149C211.444,69.138 213.101,67.487 215.118,67.487L219.801,67.487C221.818,67.487 223.475,69.138 223.475,71.149L223.475,74.021C223.475,76.031 221.818,77.682 219.801,77.682Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#BDC1C6" - android:fillType="nonZero" - android:pathData="M38.975,77.682L26.728,77.682C24.567,77.682 22.766,75.887 22.766,73.733L22.766,71.364C22.766,69.21 24.567,67.415 26.728,67.415L38.903,67.415C41.065,67.415 42.866,69.21 42.866,71.364L42.866,73.733C42.938,75.959 41.137,77.682 38.975,77.682Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#DADCE0" - android:fillType="nonZero" - android:pathData="M79.752,12.851L14.697,12.851C12.752,12.851 11.239,11.272 11.239,9.405L11.239,9.405C11.239,7.467 12.824,5.959 14.697,5.959L79.752,5.959C81.697,5.959 83.21,7.538 83.21,9.405L83.21,9.405C83.21,11.272 81.697,12.851 79.752,12.851Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#DADCE0" - android:fillType="nonZero" - android:pathData="M12.608,30.872L3.962,30.872C2.017,30.872 0.504,29.292 0.504,27.426L0.504,27.426C0.504,25.487 2.089,23.979 3.962,23.979L12.608,23.979C14.553,23.979 16.066,25.559 16.066,27.426L16.066,27.426C16.138,29.292 14.553,30.872 12.608,30.872Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#DADCE0" - android:fillType="nonZero" - android:pathData="M37.967,48.821L12.103,48.821C10.158,48.821 8.645,47.241 8.645,45.374L8.645,45.374C8.645,43.436 10.23,41.928 12.103,41.928L37.967,41.928C39.912,41.928 41.425,43.508 41.425,45.374L41.425,45.374C41.497,47.313 39.912,48.821 37.967,48.821Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#DADCE0" - android:fillType="nonZero" - android:pathData="M98.267,48.821L52.664,48.821C50.718,48.821 49.206,47.241 49.206,45.374L49.206,45.374C49.206,43.436 50.791,41.928 52.664,41.928L98.267,41.928C100.212,41.928 101.725,43.508 101.725,45.374L101.725,45.374C101.725,47.313 100.212,48.821 98.267,48.821Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#5B5D5F" - android:fillType="nonZero" - android:pathData="M47.765,35.897C47.188,35.897 46.9,35.395 47.188,34.964L72.115,3.949C74.133,1.436 77.158,-0 80.328,-0L157.198,-0C158.207,-0 159,0.862 159,1.867L159,2.154C159,3.159 158.207,4.021 157.198,4.021L105.039,4.021C102.374,4.021 99.996,5.528 98.771,7.897L84.939,34.892C84.651,35.467 83.93,35.897 83.138,35.897L47.765,35.897L47.765,35.897Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> - <path android:fillColor="#DADCE0" - android:fillType="nonZero" - android:pathData="M96.394,30.872L26.584,30.872C24.639,30.872 23.126,29.292 23.126,27.426L23.126,27.426C23.126,25.487 24.711,23.979 26.584,23.979L96.394,23.979C98.339,23.979 99.852,25.559 99.852,27.426L99.852,27.426C99.924,29.292 98.339,30.872 96.394,30.872Z" - android:strokeColor="#00000000" - android:strokeWidth="1"/> -</vector>
diff --git a/chrome/android/java/res/drawable/signin_header_animation.xml b/chrome/android/java/res/drawable/signin_header_animation.xml index e92868c..c9654b0 100644 --- a/chrome/android/java/res/drawable/signin_header_animation.xml +++ b/chrome/android/java/res/drawable/signin_header_animation.xml
@@ -106,7 +106,7 @@ android:rotation="0"> <path - android:fillColor="?attr/default_icon_color_inverse" + android:fillColor="@color/default_icon_color_inverse_baseline" android:pathData="M297.722,54.149L297.722,51.997L297.981,51.997L297.981,53.479L299.925,51.391L297.981,49.303L297.981,50.785L297.722,50.785L297.722,48.632L300.291,51.391L297.722,54.149ZM297.98,45.667L295.412,42.909L297.98,40.15L297.98,42.303L297.721,42.303L297.721,40.821L295.777,42.909L297.721,44.997L297.721,43.515L297.98,43.515L297.98,45.667ZM301.395,49.392L301.173,49.251C301.521,48.617 301.705,47.89 301.705,47.15C301.705,44.868 299.976,43.011 297.852,43.011L297.852,42.733C300.119,42.733 301.964,44.715 301.964,47.149C301.963,47.939 301.767,48.715 301.395,49.392ZM297.851,51.566C295.584,51.566 293.739,49.585 293.739,47.149C293.739,46.359 293.936,45.583 294.307,44.907L294.529,45.048C294.181,45.682 293.997,46.408 293.997,47.148C293.997,49.431 295.726,51.287 297.851,51.287L297.851,51.566Z"/> </group> <!-- Blue dot -->
diff --git a/chrome/android/java/res/layout/fre_data_reduction_proxy_lite_mode.xml b/chrome/android/java/res/layout/fre_data_reduction_proxy_lite_mode.xml deleted file mode 100644 index e76e949..0000000 --- a/chrome/android/java/res/layout/fre_data_reduction_proxy_lite_mode.xml +++ /dev/null
@@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> -<org.chromium.chrome.browser.firstrun.FirstRunView - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <ScrollView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginBottom="@dimen/fre_button_bar_height" - android:fillViewport="true"> - - <LinearLayout - android:id="@+id/fre_main_layout" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:gravity="center_horizontal"> - - <TextView - android:id="@+id/title" - android:text="@string/data_reduction_promo_title_lite_mode" - style="@style/FreTitle"/> - - <!-- The orientation of this view is changed dynamically to give a nicer layout when in - landscape mode on devices with small screens. --> - <LinearLayout - android:id="@+id/fre_image_and_content" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:gravity="center_horizontal" - android:layout_marginTop="@dimen/fre_vertical_spacing"> - - <ImageView - android:id="@+id/image" - android:layout_width="wrap_content" - android:layout_height="@dimen/fre_image_height" - tools:ignore="ContentDescription" - app:srcCompat="@drawable/data_reduction_illustration" /> - - <LinearLayout - android:id="@+id/fre_content_wrapper" - android:layout_width="0dp" - android:layout_height="0dp" - android:layout_weight="1" - android:layout_marginTop="@dimen/fre_vertical_spacing" - android:layout_marginEnd="@dimen/fre_content_margin" - android:layout_marginStart="@dimen/fre_content_margin" - android:orientation="vertical" > - - <org.chromium.ui.widget.TextViewWithClickableSpans - android:id="@+id/data_reduction_promo_summary_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/fre_vertical_spacing" - android:gravity="start" - android:lineSpacingMultiplier="1.4" - android:textAppearance="@style/TextAppearance.TextMedium.Secondary" /> - - <com.google.android.material.switchmaterial.SwitchMaterial - android:id="@+id/enable_data_saver_switch" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:lineSpacingMultiplier="1.4" - android:showText="false" - android:text="@string/data_reduction_enabled_switch_lite_mode" - style="@style/TextAppearance.TextMediumThick.Primary" /> - - </LinearLayout> - </LinearLayout> - </LinearLayout> - </ScrollView> - - <org.chromium.ui.widget.ButtonCompat - android:id="@+id/next_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="10dp" - android:layout_gravity="bottom|center_horizontal" - android:text="@string/next" - style="@style/FilledButton.Flat" /> -</org.chromium.chrome.browser.firstrun.FirstRunView>
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index 734efbe..f1aea022 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml
@@ -119,7 +119,6 @@ <dimen name="fre_margin">24dp</dimen> <dimen name="fre_image_bottom_margin">36dp</dimen> - <dimen name="fre_image_height">120dp</dimen> <dimen name="fre_tos_image_height">110dp</dimen> <dimen name="fre_tos_checkbox_padding">12dp</dimen> <dimen name="fre_tos_bottom_margin">16dp</dimen> @@ -130,15 +129,13 @@ <dimen name="fre_policy_privacy_disclaimer_top_margin">16dp</dimen> <dimen name="fre_button_vertical_margin">24dp</dimen> - <!-- fre_button_bar_height = 68dp = layout_height (48dp) + 2 * layout_marginBottom(10dp) --> - <dimen name="fre_button_bar_height">68dp</dimen> + <dimen name="fre_button_vertical_margin_small">16dp</dimen> <!-- Account Signin dimensions --> <!-- The Account Signin page appears in the First Run Experience (amongst other places), so uses a lot of the fre_* dimensions for consistency. --> - <dimen name="signin_image_carousel_width">240dp</dimen> <dimen name="signin_chooser_padding">16dp</dimen> <dimen name="signin_screen_top_padding">50dp</dimen>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java index 28d01074..a81c5b1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -102,7 +102,6 @@ import org.chromium.chrome.browser.incognito.IncognitoTabLauncher; import org.chromium.chrome.browser.incognito.IncognitoTabSnapshotController; import org.chromium.chrome.browser.incognito.IncognitoUtils; -import org.chromium.chrome.browser.infobar.DataReductionPromoInfoBar; import org.chromium.chrome.browser.infobar.SyncErrorInfoBar; import org.chromium.chrome.browser.layouts.LayoutStateProvider; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; @@ -1813,9 +1812,6 @@ if (!navigation.hasCommitted() || !navigation.isInPrimaryMainFrame()) { return; } - DataReductionPromoInfoBar.maybeLaunchPromoInfoBar(ChromeTabbedActivity.this, - tab.getWebContents(), navigation.getUrl(), tab.isShowingErrorPage(), - navigation.isFragmentNavigation(), navigation.httpStatusCode()); if (SyncErrorPromptUtils.isMessageUiEnabled()) { SyncErrorMessage.maybeShowMessageUi( getWindowAndroid(), ChromeTabbedActivity.this);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkSaveFlowMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkSaveFlowMediator.java index 975e81a..4eb609f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkSaveFlowMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkSaveFlowMediator.java
@@ -8,7 +8,7 @@ import android.widget.CompoundButton; import androidx.annotation.Nullable; -import androidx.core.content.res.ResourcesCompat; +import androidx.appcompat.content.res.AppCompatResources; import org.chromium.base.Callback; import org.chromium.base.CallbackController; @@ -177,10 +177,9 @@ void setPriceTrackingIconForEnabledState(boolean enabled) { mPropertyModel.set(BookmarkSaveFlowProperties.NOTIFICATION_SWITCH_START_ICON, - ResourcesCompat.getDrawable(mContext.getResources(), + AppCompatResources.getDrawable(mContext, enabled ? R.drawable.price_tracking_enabled_filled - : R.drawable.price_tracking_disabled, - /*theme=*/null)); + : R.drawable.price_tracking_disabled)); } void destroy() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/DataReductionPromoScreen.java b/chrome/android/java/src/org/chromium/chrome/browser/datareduction/DataReductionPromoScreen.java deleted file mode 100644 index ce630a7..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/DataReductionPromoScreen.java +++ /dev/null
@@ -1,130 +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. - -package org.chromium.chrome.browser.datareduction; - -import android.app.Activity; -import android.content.DialogInterface; -import android.content.res.Resources; -import android.view.View; - -import org.chromium.base.CommandLine; -import org.chromium.chrome.R; -import org.chromium.chrome.browser.customtabs.CustomTabActivity; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; -import org.chromium.components.browser_ui.widget.PromoDialog; -import org.chromium.ui.text.NoUnderlineClickableSpan; -import org.chromium.ui.text.SpanApplier; -import org.chromium.ui.text.SpanApplier.SpanInfo; -import org.chromium.ui.widget.Toast; - -/** - * The promo screen encouraging users to enable Data Saver. - */ -public class DataReductionPromoScreen extends PromoDialog { - private static final String FORCE_PROMO_SWITCH = "force-data-reduction-second-run-promo"; - - private int mState; - - private static boolean shouldLaunchDataReductionPromo( - Activity parentActivity, boolean isIncognito) { - // This switch is only used for testing so it is ok to override all the other checking. - if (CommandLine.getInstance().hasSwitch(FORCE_PROMO_SWITCH)) return true; - - // The promo is displayed if Chrome is launched directly (i.e., not with the intent to - // navigate to and view a URL on startup), the instance is part of the field trial, - // and the promo has not been displayed before. - if (isIncognito) return false; - if (!DataReductionPromoUtils.canShowPromos()) return false; - if (DataReductionPromoUtils.getDisplayedFreOrSecondRunPromo()) return false; - - return true; - } - - /** - * Launch the data reduction promo, if it needs to be displayed. - * @return Whether the data reduction promo was displayed. - */ - public static boolean launchDataReductionPromo(Activity parentActivity, boolean isIncognito) { - if (!shouldLaunchDataReductionPromo(parentActivity, isIncognito)) return false; - - DataReductionPromoScreen promoScreen = new DataReductionPromoScreen(parentActivity); - promoScreen.setOnDismissListener(promoScreen); - promoScreen.show(); - - return true; - } - - /** - * DataReductionPromoScreen constructor. - * - * @param activity An Android activity to display the dialog. - */ - public DataReductionPromoScreen(Activity activity) { - super(activity); - mState = DataReductionProxyUma.ACTION_DISMISSED; - } - - @Override - protected DialogParams getDialogParams() { - PromoDialog.DialogParams params = new PromoDialog.DialogParams(); - params.vectorDrawableResource = R.drawable.data_reduction_illustration; - params.headerStringResource = R.string.data_reduction_promo_title_lite_mode; - params.subheaderStringResource = R.string.data_reduction_promo_summary_lite_mode; - params.primaryButtonStringResource = R.string.data_reduction_enable_button_lite_mode; - params.secondaryButtonStringResource = R.string.no_thanks; - - // Make 'Learn more' link clickable in subheader. - Activity activity = getOwnerActivity(); - Resources resources = activity.getResources(); - NoUnderlineClickableSpan clickablePromoLearnMoreSpan = - new NoUnderlineClickableSpan(resources, (view1) -> { - CustomTabActivity.showInfoPage(activity, - resources.getString((R.string.data_reduction_promo_learn_more_url))); - }); - params.subheaderCharSequence = SpanApplier.applySpans( - resources.getString(R.string.data_reduction_promo_summary_lite_mode), - new SpanInfo("<link>", "</link>", clickablePromoLearnMoreSpan)); - params.subheaderIsLink = true; - - return params; - } - - @Override - public void onClick(View v) { - int id = v.getId(); - - if (id == R.id.button_secondary) { - dismiss(); - } else if (id == R.id.button_primary) { - mState = DataReductionProxyUma.ACTION_ENABLED; - handleEnableButtonPressed(); - } else { - assert false : "Unhandled onClick event"; - } - } - - @Override - public void onDismiss(DialogInterface dialog) { - DataReductionPromoUtils.saveFreOrSecondRunPromoDisplayed(); - } - - private void handleEnableButtonPressed() { - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled(getContext(), true); - dismiss(); - Toast.makeText(getContext(), - getContext().getString(R.string.data_reduction_enabled_toast_lite_mode), - Toast.LENGTH_LONG) - .show(); - } - - @Override - public void dismiss() { - if (mState < DataReductionProxyUma.ACTION_INDEX_BOUNDARY) { - DataReductionProxyUma.dataReductionProxyUIAction(mState); - mState = DataReductionProxyUma.ACTION_INDEX_BOUNDARY; - } - super.dismiss(); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtils.java deleted file mode 100644 index dcc8940..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtils.java +++ /dev/null
@@ -1,141 +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. - -package org.chromium.chrome.browser.datareduction; - -import org.chromium.chrome.browser.about_settings.AboutSettingsBridge; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; -import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; -import org.chromium.chrome.browser.preferences.SharedPreferencesManager; - -/** - * Helper functions for displaying the various data reduction proxy promos. The promo screens - * inform users of the benefits of Data Saver. - */ -public class DataReductionPromoUtils { - - /** - * Returns whether any of the data reduction proxy promotions can be displayed. Checks if the - * proxy is allowed by the DataReductionProxyConfig, already on, or if the user is managed. If - * the data reduction proxy is managed by an administrator's policy, the user should not be - * given a promotion to enable it. - * - * @return Whether the any data reduction proxy promotion has been displayed. - */ - public static boolean canShowPromos() { - if (!DataReductionProxySettings.getInstance().isDataReductionProxyPromoAllowed()) { - return false; - } - if (DataReductionProxySettings.getInstance().isDataReductionProxyManaged()) return false; - if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) return false; - return true; - } - - /** - * Saves shared prefs indicating that the data reduction proxy first run experience or second - * run promo screen has been displayed at the current time. - */ - public static void saveFreOrSecondRunPromoDisplayed() { - SharedPreferencesManager prefs = SharedPreferencesManager.getInstance(); - prefs.writeBoolean( - ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_FRE_OR_SECOND_RUN_PROMO, true); - prefs.writeLong(ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_FRE_OR_SECOND_PROMO_TIME_MS, - System.currentTimeMillis()); - prefs.writeString(ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_FRE_OR_SECOND_PROMO_VERSION, - AboutSettingsBridge.getApplicationVersion()); - } - - /** - * Returns whether the data reduction proxy first run experience or second run promo has been - * displayed before. - * - * @return Whether the data reduction proxy promo has been displayed. - */ - public static boolean getDisplayedFreOrSecondRunPromo() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_FRE_OR_SECOND_RUN_PROMO, false); - } - - /** - * Returns the version the data reduction proxy first run experience or second run promo promo - * was displayed on. If one of the promos has not been displayed, returns an empty string. - * - * @return The version the data reduction proxy promo was displayed on. - */ - public static String getDisplayedFreOrSecondRunPromoVersion() { - return SharedPreferencesManager.getInstance().readString( - ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_FRE_OR_SECOND_PROMO_VERSION, ""); - } - - /** - * Saves shared prefs indicating that the data reduction proxy first run experience promo screen - * was displayed and the user opted out. - * - * @param optOut Whether the user opted out of using the data reduction proxy. - */ - public static void saveFrePromoOptOut(boolean optOut) { - SharedPreferencesManager.getInstance().writeBoolean( - ChromePreferenceKeys.DATA_REDUCTION_FRE_PROMO_OPT_OUT, optOut); - } - - /** - * Returns whether the user saw the data reduction proxy first run experience promo and opted - * out. - * - * @return Whether the user opted out of the data reduction proxy first run experience promo. - */ - public static boolean getOptedOutOnFrePromo() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.DATA_REDUCTION_FRE_PROMO_OPT_OUT, false); - } - - /** - * Saves shared prefs indicating that the data reduction proxy infobar promo has been displayed - * at the current time. - */ - public static void saveInfoBarPromoDisplayed() { - SharedPreferencesManager prefs = SharedPreferencesManager.getInstance(); - prefs.writeBoolean(ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_INFOBAR_PROMO, true); - prefs.writeString(ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_INFOBAR_PROMO_VERSION, - AboutSettingsBridge.getApplicationVersion()); - } - - /** - * Returns whether the data reduction proxy infobar promo has been displayed before. - * - * @return Whether the data reduction proxy infobar promo has been displayed. - */ - public static boolean getDisplayedInfoBarPromo() { - return SharedPreferencesManager.getInstance().readBoolean( - ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_INFOBAR_PROMO, false); - } - - /** See {@link ChromePreferenceKeys#DATA_REDUCTION_DISPLAYED_MILESTONE_PROMO_SAVED_BYTES}. */ - public static void saveMilestonePromoDisplayed(long dataSavingsInBytes) { - SharedPreferencesManager.getInstance().writeLong( - ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_MILESTONE_PROMO_SAVED_BYTES, - dataSavingsInBytes); - } - - /** - * Returns the data savings in bytes from when the milestone promo was last displayed. - * - * @return The data savings in bytes, or -1 if the promo has not been displayed before. - */ - public static long getDisplayedMilestonePromoSavedBytes() { - return SharedPreferencesManager.getInstance().readLong( - ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_MILESTONE_PROMO_SAVED_BYTES, -1); - } - - /** - * Returns a boolean indicating that the data savings in bytes on the first upgrade to the - * version that shows the milestone promo has been initialized. - * - * @return Whether that the starting saved bytes have been initialized. - */ - public static boolean hasMilestonePromoBeenInitWithStartingSavedBytes() { - return SharedPreferencesManager.getInstance().contains( - ChromePreferenceKeys.DATA_REDUCTION_DISPLAYED_MILESTONE_PROMO_SAVED_BYTES); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/DataReductionSavingsMilestonePromo.java b/chrome/android/java/src/org/chromium/chrome/browser/datareduction/DataReductionSavingsMilestonePromo.java deleted file mode 100644 index d9219f8..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/DataReductionSavingsMilestonePromo.java +++ /dev/null
@@ -1,153 +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. - -package org.chromium.chrome.browser.datareduction; - -import android.content.Context; - -import org.chromium.base.CommandLine; -import org.chromium.chrome.R; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; -import org.chromium.components.browser_ui.util.ConversionUtils; -import org.chromium.components.variations.VariationsAssociatedData; - -/** - * The controller logic for the Data Reduction Proxy savings milestone promo that lets users of the - * proxy know when Chrome has saved a given amount of data. Each decision to show the promo should - * be made by a separate instance of this class, using the provided getter methods. - */ -public class DataReductionSavingsMilestonePromo { - /** - * A semi-colon delimited list of data savings values in MB that the promo should be shown - * for. - */ - public static final String PROMO_PARAM_NAME = "x_milestone_promo_data_savings_in_megabytes"; - - public static final String PROMO_FIELD_TRIAL_NAME = "DataCompressionProxyPromoVisibility"; - private static final String ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_SWITCH = - "enable-data-reduction-proxy-savings-promo"; - - private final Context mContext; - - /** The current data savings to promote. */ - private final long mDataSavingsInBytes; - - /** If not null, this promo should be shown to the user. */ - private String mPromoText; - - /** - * Constructs a fully initialized DataReductionSavingsMilestonePromo instance. - * - * This' getters are ready immediately after construction. If shouldShowPromo is true and the - * promo text is shown to the user, onPromoTextSeen should be called on the same instance. - * - * @param context The context. - * @param dataSavingsInBytes The amount of data the Data Reduction Proxy has saved in bytes. - */ - public DataReductionSavingsMilestonePromo(Context context, long dataSavingsInBytes) { - mContext = context; - mDataSavingsInBytes = dataSavingsInBytes; - mPromoText = computeDataReductionMilestonePromo(); - } - - /** - * Returns true if the promo can be shown to the user. If shown, onPromoTextSeen should be - * called. - */ - public boolean shouldShowPromo() { - return mPromoText != null; - } - - /** - * Returns the promo text to be shown to the user. Once shown, onPromoTextSeen should be called. - */ - public String getPromoText() { - return mPromoText; - } - - /** - * This should be called after the promo text is shown to the user. - */ - public void onPromoTextSeen() { - assert (shouldShowPromo()); - DataReductionPromoUtils.saveMilestonePromoDisplayed(mDataSavingsInBytes); - } - - /** - * Decides whether the Data Reduction Proxy promo should be shown given the current data savings - * and specific thresholds set by variations. - * - * @return The string to use in the promo. If null or empty, do not show a promo. - */ - private String computeDataReductionMilestonePromo() { - // Skip if Lite mode is not enabled. - if (!DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) { - return null; - } - // Prevents users who upgrade and have already saved more than the threshold from seeing the - // promo. - if (!DataReductionPromoUtils.hasMilestonePromoBeenInitWithStartingSavedBytes()) { - DataReductionPromoUtils.saveMilestonePromoDisplayed(mDataSavingsInBytes); - return null; - } - - String variationParamValue = VariationsAssociatedData.getVariationParamValue( - PROMO_FIELD_TRIAL_NAME, PROMO_PARAM_NAME); - int[] promoDataSavingsMB; - - if (variationParamValue.isEmpty()) { - if (CommandLine.getInstance().hasSwitch( - ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_SWITCH)) { - promoDataSavingsMB = new int[1]; - promoDataSavingsMB[0] = 1; - } else { - promoDataSavingsMB = new int[0]; - } - } else { - variationParamValue = variationParamValue.replace(" ", ""); - String[] promoDataSavingStrings = variationParamValue.split(";"); - - if (CommandLine.getInstance().hasSwitch( - ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_SWITCH)) { - promoDataSavingsMB = new int[promoDataSavingStrings.length + 1]; - promoDataSavingsMB[promoDataSavingStrings.length] = 1; - } else { - promoDataSavingsMB = new int[promoDataSavingStrings.length]; - } - - for (int i = 0; i < promoDataSavingStrings.length; i++) { - try { - promoDataSavingsMB[i] = Integer.parseInt(promoDataSavingStrings[i]); - } catch (NumberFormatException e) { - promoDataSavingsMB[i] = -1; - } - } - } - - for (int threshold : promoDataSavingsMB) { - long promoDataSavingsBytes = threshold * ConversionUtils.BYTES_PER_MEGABYTE; - if (threshold > 0 && mDataSavingsInBytes >= promoDataSavingsBytes - && DataReductionPromoUtils.getDisplayedMilestonePromoSavedBytes() - < promoDataSavingsBytes) { - return getStringForBytes(mContext, promoDataSavingsBytes); - } - } - return null; - } - - private static String getStringForBytes(Context context, long bytes) { - int resourceId; - int bytesInCorrectUnits; - - if (bytes < ConversionUtils.BYTES_PER_GIGABYTE) { - resourceId = R.string.data_reduction_milestone_promo_text_mb; - bytesInCorrectUnits = (int) ConversionUtils.bytesToMegabytes(bytes); - } else { - resourceId = R.string.data_reduction_milestone_promo_text_gb; - bytesInCorrectUnits = (int) ConversionUtils.bytesToGigabytes(bytes); - } - - return context.getResources().getString(resourceId, bytesInCorrectUnits); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionPreferenceFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionPreferenceFragment.java index b9f91be..c1fbb363 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionPreferenceFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionPreferenceFragment.java
@@ -18,7 +18,6 @@ import org.chromium.base.CommandLine; import org.chromium.base.IntentUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.datareduction.DataReductionPromoUtils; import org.chromium.chrome.browser.datareduction.DataReductionProxyUma; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncherImpl; import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; @@ -66,11 +65,6 @@ public void onDestroy() { super.onDestroy(); - if (mWasEnabledAtCreation && !mIsEnabled) { - // If the user manually disables Data Saver, don't show the infobar promo. - DataReductionPromoUtils.saveInfoBarPromoDisplayed(); - } - int statusChange; if (mFromMainMenu) { if (mWasEnabledAtCreation) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/DataReductionProxyFirstRunFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/DataReductionProxyFirstRunFragment.java deleted file mode 100644 index 79a64d18..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/DataReductionProxyFirstRunFragment.java +++ /dev/null
@@ -1,101 +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. - -package org.chromium.chrome.browser.firstrun; - -import android.content.res.Resources; -import android.os.Bundle; -import android.text.method.LinkMovementMethod; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.view.accessibility.AccessibilityEvent; -import android.widget.Button; -import android.widget.TextView; - -import androidx.appcompat.widget.SwitchCompat; -import androidx.fragment.app.Fragment; - -import org.chromium.chrome.R; -import org.chromium.chrome.browser.datareduction.DataReductionPromoUtils; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; -import org.chromium.ui.text.NoUnderlineClickableSpan; -import org.chromium.ui.text.SpanApplier; -import org.chromium.ui.text.SpanApplier.SpanInfo; - -/** - * The First Run Experience fragment that allows the user to opt in to Data Saver. - */ -public class DataReductionProxyFirstRunFragment extends Fragment implements FirstRunFragment { - @Override - public View onCreateView( - LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - return inflater.inflate(R.layout.fre_data_reduction_proxy_lite_mode, container, false); - } - - @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - - final TextView promoSummaryTextView = - (TextView) view.findViewById(R.id.data_reduction_promo_summary_text); - final SwitchCompat enableDataSaverSwitch = (SwitchCompat) view - .findViewById(R.id.enable_data_saver_switch); - Button nextButton = (Button) view.findViewById(R.id.next_button); - - enableDataSaverSwitch.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( - v.getContext(), enableDataSaverSwitch.isChecked()); - if (enableDataSaverSwitch.isChecked()) { - enableDataSaverSwitch.setText(R.string.data_reduction_enabled_switch_lite_mode); - } else { - enableDataSaverSwitch.setText( - R.string.data_reduction_disabled_switch_lite_mode); - } - } - }); - - // Setup Promo Text Learn More Link - Resources resources = getResources(); - NoUnderlineClickableSpan clickablePromoLearnMoreSpan = - new NoUnderlineClickableSpan(resources, (view1) -> { - if (!isAdded()) return; - getPageDelegate().showInfoPage(R.string.data_reduction_promo_learn_more_url); - }); - - promoSummaryTextView.setMovementMethod(LinkMovementMethod.getInstance()); - promoSummaryTextView.setText( - SpanApplier.applySpans(getString(R.string.data_reduction_promo_summary_lite_mode), - new SpanInfo("<link>", "</link>", clickablePromoLearnMoreSpan))); - - nextButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - getPageDelegate().advanceToNextPage(); - } - }); - - enableDataSaverSwitch.setChecked(true); - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( - view.getContext(), enableDataSaverSwitch.isChecked()); - } - - @Override - public void setInitialA11yFocus() { - // Ignore calls before view is created. - if (getView() == null) return; - - final View title = getView().findViewById(R.id.title); - title.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED); - } - - @Override - public void onStart() { - super.onStart(); - DataReductionPromoUtils.saveFreOrSecondRunPromoDisplayed(); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java index 604a4e8..b5872d7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java
@@ -28,11 +28,8 @@ import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.customtabs.CustomTabActivity; -import org.chromium.chrome.browser.datareduction.DataReductionPromoUtils; -import org.chromium.chrome.browser.datareduction.DataReductionProxyUma; import org.chromium.chrome.browser.fonts.FontPreloader; import org.chromium.chrome.browser.metrics.UmaUtils; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.signin.SigninFirstRunFragment; import org.chromium.chrome.browser.signin.services.FREMobileIdentityConsistencyFieldTrial; @@ -177,20 +174,10 @@ assert areNativeAndPoliciesInitialized(); mFirstRunFlowSequencer.updateFirstRunProperties(mFreProperties); - BooleanSupplier showDataReductionPromo = - () -> mFreProperties.getBoolean(SHOW_DATA_REDUCTION_PAGE); BooleanSupplier showSearchEnginePromo = () -> mFreProperties.getBoolean(SHOW_SEARCH_ENGINE_PAGE); BooleanSupplier showSyncConsent = () -> mFreProperties.getBoolean(SHOW_SYNC_CONSENT_PAGE); - // An optional Data Saver page. - if (!FREMobileIdentityConsistencyFieldTrial.isEnabled() - && showDataReductionPromo.getAsBoolean()) { - mPages.add(new FirstRunPage<>( - DataReductionProxyFirstRunFragment.class, showDataReductionPromo)); - mFreProgressStates.add(MobileFreProgress.DATA_SAVER_SHOWN); - } - // An optional page to select a default search engine. if (showSearchEnginePromo.getAsBoolean()) { mPages.add(new FirstRunPage<>( @@ -203,15 +190,6 @@ mPages.add(new FirstRunPage<>(SyncConsentFirstRunFragment.class, showSyncConsent)); mFreProgressStates.add(MobileFreProgress.SYNC_CONSENT_SHOWN); - // An optional Data Saver page, this page will be hidden if users click the |Settings| - // link on the sync consent page. - if (FREMobileIdentityConsistencyFieldTrial.isEnabled() - && showDataReductionPromo.getAsBoolean()) { - mPages.add(new FirstRunPage<>( - DataReductionProxyFirstRunFragment.class, showDataReductionPromo)); - mFreProgressStates.add(MobileFreProgress.DATA_SAVER_SHOWN); - } - if (mPagerAdapter != null) { mPagerAdapter.notifyDataSetChanged(); } @@ -482,18 +460,6 @@ FirstRunFlowSequencer.markFlowAsCompleted(mResultSyncConsentAccountName, mFreProperties.getBoolean(OPEN_ADVANCED_SYNC_SETTINGS)); - if (DataReductionPromoUtils.getDisplayedFreOrSecondRunPromo()) { - if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) { - DataReductionProxyUma - .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_FRE_ENABLED); - DataReductionPromoUtils.saveFrePromoOptOut(false); - } else { - DataReductionProxyUma - .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_FRE_DISABLED); - DataReductionPromoUtils.saveFrePromoOptOut(true); - } - } - if (sObserver != null) sObserver.onUpdateCachedEngineName(this); launchPendingIntentAndFinish();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java index c8b01f9d..c8305da 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
@@ -40,7 +40,6 @@ // received by ChromeLauncherActivity.) public static final String EXTRA_CHROME_LAUNCH_INTENT_EXTRAS = "Extra.FreChromeLaunchIntentExtras"; - static final String SHOW_DATA_REDUCTION_PAGE = "ShowDataReduction"; static final String SHOW_SEARCH_ENGINE_PAGE = "ShowSearchEnginePage"; static final String SHOW_SYNC_CONSENT_PAGE = "ShowSyncConsent";
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java index c767ea2..77b0754 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
@@ -24,7 +24,6 @@ import org.chromium.chrome.browser.LaunchIntentDispatcher; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.locale.LocaleManager; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.search_engines.SearchEnginePromoType; import org.chromium.chrome.browser.signin.services.FREMobileIdentityConsistencyFieldTrial; @@ -85,22 +84,6 @@ } } - /** - * @param openAdvancedSyncSettings Whether the user wants to open the advanced sync - * settings. - * @return true if the Data Reduction promo page should be shown. - */ - boolean shouldShowDataReductionPage(boolean openAdvancedSyncSettings) { - if (FREMobileIdentityConsistencyFieldTrial.isEnabled() && openAdvancedSyncSettings) { - // Skip the data reduction page when the user wants to open the advanced sync - // settings. - return false; - } - return !DataReductionProxySettings.getInstance().isDataReductionProxyManaged() - && DataReductionProxySettings.getInstance() - .isDataReductionProxyFREPromoAllowed(); - } - /** @return true if the Search Engine promo page should be shown. */ @VisibleForTesting public boolean shouldShowSearchEnginePage() { @@ -175,10 +158,6 @@ }); } - private boolean shouldShowDataReductionPage(boolean openAdvancedSyncSettings) { - return mDelegate.shouldShowDataReductionPage(openAdvancedSyncSettings); - } - @VisibleForTesting protected boolean shouldShowSearchEnginePage() { return mDelegate.shouldShowSearchEnginePage(); @@ -217,9 +196,6 @@ public void updateFirstRunProperties(Bundle freProperties) { freProperties.putBoolean( FirstRunActivity.SHOW_SYNC_CONSENT_PAGE, shouldShowSyncConsentPage()); - freProperties.putBoolean(FirstRunActivity.SHOW_DATA_REDUCTION_PAGE, - shouldShowDataReductionPage( - freProperties.getBoolean(FirstRunActivity.OPEN_ADVANCED_SYNC_SETTINGS))); freProperties.putBoolean( FirstRunActivity.SHOW_SEARCH_ENGINE_PAGE, shouldShowSearchEnginePage()); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunView.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunView.java deleted file mode 100644 index 303b087..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunView.java +++ /dev/null
@@ -1,116 +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. - -package org.chromium.chrome.browser.firstrun; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.LinearLayout; - -import androidx.core.view.ViewCompat; - -import org.chromium.chrome.R; - -/** - * A page shown during the First Run Experience. It modifies the layout for a better appearance - * for certain screen dimensions. - */ -public class FirstRunView extends FrameLayout { - private static final String TAG = "FirstRunView"; - - private View mMainLayout; - private LinearLayout mImageAndContent; - private LinearLayout mContentWrapper; - - /** - * Constructor for inflating via XML. - */ - public FirstRunView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - // TODO(peconn): Unify the common parts of the FirstRunView layouts. - // TODO(peconn): Use different layout files for the landscape and horizontal parts - - mMainLayout = findViewById(R.id.fre_main_layout); - mImageAndContent = (LinearLayout) findViewById(R.id.fre_image_and_content); - mContentWrapper = (LinearLayout) findViewById(R.id.fre_content_wrapper); - - - } - - protected boolean isHorizontalModeEnabled() { - return true; - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - // There was a requirement to have the titles and images of all of the first run experience - // pages to be vertically aligned so the transitions between pages look nice. - // The other requirement is for an alternate layout in horizontal mode for screens of a - // certain size. These are why the padding is set manually. - - // This assumes that view's layout_width is set to match_parent. - assert MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY; - - int width = MeasureSpec.getSize(widthMeasureSpec); - int height = MeasureSpec.getSize(heightMeasureSpec); - - MarginLayoutParams contentWrapperLayout = - (MarginLayoutParams) mContentWrapper.getLayoutParams(); - - int imageAndContentPaddingStart = 0; - int halfContentHeight = 0; - // The AccountSigninView is part of the First Run Experience, and it's image carousel is - // the widest of the 'image's to be displayed in the FRE. - if (isHorizontalModeEnabled() - && width >= 2 * getResources().getDimension(R.dimen.signin_image_carousel_width) - && width > height) { - mImageAndContent.setOrientation(LinearLayout.HORIZONTAL); - imageAndContentPaddingStart = getResources().getDimensionPixelSize(R.dimen.fre_margin); - - contentWrapperLayout.width = 0; - contentWrapperLayout.height = LayoutParams.WRAP_CONTENT; - contentWrapperLayout.topMargin = 0; - - halfContentHeight = getResources().getDimensionPixelSize(R.dimen.headline_size) - + getResources().getDimensionPixelSize(R.dimen.fre_vertical_spacing) - + getResources().getDimensionPixelSize(R.dimen.fre_image_height) / 2; - - } else { - mImageAndContent.setOrientation(LinearLayout.VERTICAL); - - contentWrapperLayout.width = LayoutParams.WRAP_CONTENT; - contentWrapperLayout.height = 0; - contentWrapperLayout.topMargin = - getResources().getDimensionPixelSize(R.dimen.fre_vertical_spacing); - - halfContentHeight = getResources().getDimensionPixelSize(R.dimen.headline_size) - + getResources().getDimensionPixelSize(R.dimen.fre_vertical_spacing) - + getResources().getDimensionPixelSize(R.dimen.fre_image_height) - + getResources().getDimensionPixelSize(R.dimen.fre_vertical_spacing); - } - - // Add padding to get it roughly centered. - int topPadding = Math.max(0, (height / 2) - halfContentHeight); - - mMainLayout.setPadding(mMainLayout.getPaddingLeft(), topPadding, - mMainLayout.getPaddingRight(), mMainLayout.getPaddingBottom()); - - ViewCompat.setPaddingRelative(mImageAndContent, imageAndContentPaddingStart, - mImageAndContent.getPaddingTop(), ViewCompat.getPaddingEnd(mImageAndContent), - mImageAndContent.getPaddingBottom()); - - mContentWrapper.setLayoutParams(contentWrapperLayout); - - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - } - -} -
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java index 2f25b1576..f5084ba6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java
@@ -5,6 +5,7 @@ package org.chromium.chrome.browser.history; import android.content.Context; +import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; @@ -22,6 +23,7 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.ui.favicon.FaviconHelper.DefaultFaviconHelper; import org.chromium.chrome.browser.ui.favicon.FaviconUtils; +import org.chromium.components.browser_ui.styles.SemanticColorUtils; import org.chromium.components.browser_ui.widget.RoundedIconGenerator; import org.chromium.components.browser_ui.widget.selectable_list.SelectableItemView; import org.chromium.components.browser_ui.widget.selectable_list.SelectableListUtils; @@ -55,7 +57,7 @@ context.getResources().getDimensionPixelSize(R.dimen.default_list_row_padding); mStartIconSelectedColorList = - AppCompatResources.getColorStateList(context, R.color.default_icon_color_inverse); + ColorStateList.valueOf(SemanticColorUtils.getDefaultIconColorInverse(context)); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionPromoInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionPromoInfoBar.java deleted file mode 100644 index ebe3a139..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionPromoInfoBar.java +++ /dev/null
@@ -1,185 +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. - -package org.chromium.chrome.browser.infobar; - -import android.content.Context; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager.NameNotFoundException; - -import androidx.annotation.DrawableRes; - -import org.chromium.base.CommandLine; -import org.chromium.base.ThreadUtils; -import org.chromium.chrome.R; -import org.chromium.chrome.browser.about_settings.AboutSettingsBridge; -import org.chromium.chrome.browser.datareduction.DataReductionPromoUtils; -import org.chromium.chrome.browser.omaha.VersionNumberGetter; -import org.chromium.components.embedder_support.util.UrlConstants; -import org.chromium.components.infobars.ConfirmInfoBar; -import org.chromium.components.infobars.InfoBarControlLayout; -import org.chromium.components.infobars.InfoBarLayout; -import org.chromium.content_public.browser.WebContents; -import org.chromium.url.GURL; - -import java.net.HttpURLConnection; -import java.sql.Date; -import java.util.Calendar; -import java.util.TimeZone; - -/** - * Generates an infobar to promote the data reduction proxy to non-users of it. The infobar contains - * a message and a button to enable the proxy. The infobar is displayed when it has not been shown - * previously, the page is HTTP pages, and certain milestone restrictions are met. Once the proxy is - * enabled from the infobar a confirmation toast message is shown. - */ -public class DataReductionPromoInfoBar extends ConfirmInfoBar { - private static final String M48_STABLE_RELEASE_DATE = "2016-01-26"; - private static final String FORCE_INFOBAR_SWITCH = "force-data-reduction-promo-infobar"; - private static final int NO_INSTALL_TIME = 0; - - private static @DrawableRes int sIconId; - private static String sTitle; - private static String sText; - private static String sPrimaryButtonText; - private static String sSecondaryButtonText; - - private static boolean shouldLaunchPromoInfoBar(Context context, WebContents webContents, - GURL url, boolean isErrorPage, boolean isFragmentNavigation, int statusCode) { - // This switch is only used for testing so let it override every other check. - if (CommandLine.getInstance().hasSwitch(FORCE_INFOBAR_SWITCH)) return true; - - if (webContents.isIncognito()) return false; - if (isErrorPage) return false; - if (isFragmentNavigation) return false; - if (statusCode != HttpURLConnection.HTTP_OK) return false; - if (!DataReductionPromoUtils.canShowPromos()) return false; - - // Don't show the infobar promo if neither the first run experience or second run promo has - // been shown. - if (!DataReductionPromoUtils.getDisplayedFreOrSecondRunPromo()) return false; - - // Don't show the promo if the user opted out on the first run experience promo. - if (DataReductionPromoUtils.getOptedOutOnFrePromo()) return false; - - // Don't show the promo if the user has seen this infobar promo before. - if (DataReductionPromoUtils.getDisplayedInfoBarPromo()) return false; - - // Only show the promo on HTTP pages. - if (!url.getScheme().equals(UrlConstants.HTTP_SCHEME)) return false; - - int currentMilestone = VersionNumberGetter.getMilestoneFromVersionNumber( - AboutSettingsBridge.getApplicationVersion()); - String freOrSecondRunVersion = - DataReductionPromoUtils.getDisplayedFreOrSecondRunPromoVersion(); - - Calendar releaseDateOfM48Stable = Calendar.getInstance(TimeZone.getTimeZone("UTC")); - - releaseDateOfM48Stable.setTime(Date.valueOf(M48_STABLE_RELEASE_DATE)); - long packageInstallTime = getPackageInstallTime(context); - - // The boolean pref that stores whether user opted out on the first run experience was - // added in M51. If the last promo was shown before M51, then |freOrSecondRunVersion| - // will be empty. If Chrome was installed after the FRE promo was added in M48 and - // beforeM51,assume the user opted out from the FRE and don't show the infobar. - if (freOrSecondRunVersion.isEmpty() - && packageInstallTime > releaseDateOfM48Stable.getTimeInMillis()) { - return false; - } - - // Only show the promo if the current version is at least two milestones after the last - // promo was displayed or the command line switch is on. If the last promo was shown - // before M51 then |freOrSecondRunVersion| will be empty and it is safe to show the - // infobar promo. - if (!freOrSecondRunVersion.isEmpty() - && currentMilestone - < VersionNumberGetter.getMilestoneFromVersionNumber(freOrSecondRunVersion) - + 2) { - return false; - } - - return true; - } - - /** - * Launch the data reduction infobar promo, if it needs to be displayed. - * - * @param context An Android context. - * @param webContents The WebContents of the tab on which the infobar should show. - * @param url The URL of the page on which the infobar should show. - * @param isFragmentNavigation Whether the main frame navigation did not cause changes to the - * document (for example scrolling to a named anchor PopState). - * @param statusCode The HTTP status code of the navigation. - * @return boolean Whether the promo was launched. - */ - public static boolean maybeLaunchPromoInfoBar(Context context, WebContents webContents, - GURL url, boolean isErrorPage, boolean isFragmentNavigation, int statusCode) { - ThreadUtils.assertOnUiThread(); - - if (!shouldLaunchPromoInfoBar( - context, webContents, url, isErrorPage, isFragmentNavigation, statusCode)) { - return false; - } - - DataReductionPromoInfoBar.launch(webContents, R.drawable.infobar_chrome, - context.getString(R.string.data_reduction_promo_infobar_title), - context.getString(R.string.data_reduction_promo_infobar_text), - context.getString(R.string.data_reduction_enable_button_lite_mode), - context.getString(R.string.no_thanks)); - - return true; - } - - /** - * Gets the time at which this app was first installed in milliseconds since January 1, 1970 - * 00:00:00.0 UTC. - * - * @param context An Android context. - * @return The time at which this app was first installed in milliseconds since the epoch or - * zero if the time cannot be retrieved. - */ - private static long getPackageInstallTime(Context context) { - PackageInfo packageInfo; - try { - packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); - } catch (NameNotFoundException e) { - packageInfo = null; - } - return packageInfo == null ? NO_INSTALL_TIME : packageInfo.firstInstallTime; - } - - /** - * Launch a data reduction proxy {@link InfoBar} with the specified title and link - * text. Clicking the link will open the specified settings page. - * - * @param webContents The {@link WebContents} in which to open the {@link InfoBar}. - * @param iconId {@link DrawableRes} to use for the {@link InfoBar} icon. - * @param title The title to display in the {@link InfoBar}. - * @param text The text to display in the {@link InfoBar}. - * @param primaryButtonText The text to display on the primary button. - * @param secondaryButtonText The text to display on the secondary button. - */ - private static void launch(WebContents webContents, @DrawableRes int iconId, String title, - String text, String primaryButtonText, String secondaryButtonText) { - sTitle = title; - sText = text; - sPrimaryButtonText = primaryButtonText; - sSecondaryButtonText = secondaryButtonText; - sIconId = iconId; - DataReductionPromoInfoBarDelegate.launch(webContents); - DataReductionPromoUtils.saveInfoBarPromoDisplayed(); - } - - DataReductionPromoInfoBar() { - super(sIconId, R.color.infobar_icon_drawable_color, null, sTitle, null, sPrimaryButtonText, - sSecondaryButtonText); - } - - @Override - public void createContent(InfoBarLayout layout) { - super.createContent(layout); - InfoBarControlLayout control = layout.addControlLayout(); - control.addDescription(sText); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionPromoInfoBarDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionPromoInfoBarDelegate.java deleted file mode 100644 index b232e32..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionPromoInfoBarDelegate.java +++ /dev/null
@@ -1,76 +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. - -package org.chromium.chrome.browser.infobar; - -import android.content.Context; - -import org.chromium.base.ContextUtils; -import org.chromium.base.annotations.CalledByNative; -import org.chromium.base.annotations.NativeMethods; -import org.chromium.chrome.R; -import org.chromium.chrome.browser.datareduction.DataReductionProxyUma; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; -import org.chromium.components.infobars.InfoBar; -import org.chromium.content_public.browser.WebContents; -import org.chromium.ui.widget.Toast; - -/** - * Provides JNI methods for DataReductionPromoInfoBar. - */ -public class DataReductionPromoInfoBarDelegate { - /** - * Launches the {@link InfoBar}. - * - * @param webContents The {@link WebContents} in which to launch the {@link InfoBar}. - */ - static void launch(WebContents webContents) { - DataReductionPromoInfoBarDelegateJni.get().launch(webContents); - } - - private DataReductionPromoInfoBarDelegate() { - } - - /** - * Creates and begins the process for showing a DataReductionProxyInfoBarDelegate. - */ - @CalledByNative - private static InfoBar showPromoInfoBar() { - return new DataReductionPromoInfoBar(); - } - - /** - * Enables the data reduction proxy, records uma, and shows a confirmation toast. - * - * @param isPrimaryButton Whether the primary infobar button was clicked. - * @param context An Android context. - */ - @CalledByNative - private static void accept() { - Context context = ContextUtils.getApplicationContext(); - DataReductionProxyUma - .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_INFOBAR_ENABLED); - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( - context, true); - Toast.makeText(context, context.getString(R.string.data_reduction_enabled_toast_lite_mode), - Toast.LENGTH_LONG) - .show(); - } - - /** - * When the infobar closes and the data reduction proxy is not enabled, record that the infobar - * was dismissed. - */ - @CalledByNative - private static void onNativeDestroyed() { - if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) return; - DataReductionProxyUma - .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_INFOBAR_DISMISSED); - } - - @NativeMethods - interface Natives { - void launch(WebContents webContents); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/net/spdyproxy/DataReductionProxySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/net/spdyproxy/DataReductionProxySettings.java index 742ebaf..cc84f38 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/net/spdyproxy/DataReductionProxySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/net/spdyproxy/DataReductionProxySettings.java
@@ -12,13 +12,11 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.NativeMethods; -import org.chromium.chrome.browser.datareduction.DataReductionPromoUtils; import org.chromium.chrome.browser.datareduction.settings.DataReductionDataUseItem; import org.chromium.chrome.browser.datareduction.settings.DataReductionStatsPreference; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.settings.datareduction.DataReductionProxySavingsClearedReason; -import org.chromium.components.embedder_support.util.UrlConstants; import java.util.ArrayList; import java.util.HashMap; @@ -124,23 +122,6 @@ DataReductionProxySettingsJni.get().init(DataReductionProxySettings.this); } - /** Returns true if the SPDY proxy promo is allowed to be shown. */ - public boolean isDataReductionProxyPromoAllowed() { - return DataReductionProxySettingsJni.get().isDataReductionProxyPromoAllowed( - mNativeDataReductionProxySettings, DataReductionProxySettings.this); - } - - /** Returns true if the data saver proxy promo is allowed to be shown as part of FRE. */ - public boolean isDataReductionProxyFREPromoAllowed() { - return DataReductionProxySettingsJni.get().isDataReductionProxyFREPromoAllowed( - mNativeDataReductionProxySettings, DataReductionProxySettings.this); - } - - /** Returns true if the snackbar promo is allowed to be shown. */ - public boolean isSnackbarPromoAllowed(String url) { - return url.startsWith(UrlConstants.HTTP_URL_PREFIX) && isDataReductionProxyEnabled(); - } - /** * Sets the preference on whether to enable/disable the SPDY proxy. This will zero out the * data reduction statistics if this is the first time the SPDY proxy has been enabled. @@ -198,7 +179,6 @@ public void clearDataSavingStatistics(@DataReductionProxySavingsClearedReason int reason) { // When the data saving statistics are cleared, reset the milestone promo that tells the // user how much data they have saved using Data Saver so far. - DataReductionPromoUtils.saveMilestonePromoDisplayed(0); SharedPreferencesManager.getInstance().writeLong( ChromePreferenceKeys.DATA_REDUCTION_FIRST_ENABLED_TIME, System.currentTimeMillis()); DataReductionProxySettingsJni.get().clearDataSavingStatistics( @@ -300,10 +280,6 @@ @NativeMethods public interface Natives { long init(DataReductionProxySettings caller); - boolean isDataReductionProxyPromoAllowed( - long nativeDataReductionProxySettingsAndroid, DataReductionProxySettings caller); - boolean isDataReductionProxyFREPromoAllowed( - long nativeDataReductionProxySettingsAndroid, DataReductionProxySettings caller); boolean isDataReductionProxyEnabled( long nativeDataReductionProxySettingsAndroid, DataReductionProxySettings caller); boolean isDataReductionProxyManaged(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2.java index bc09c9e..47896c0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2.java
@@ -21,6 +21,7 @@ import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.status_indicator.StatusIndicatorCoordinator; +import org.chromium.components.browser_ui.styles.SemanticColorUtils; import org.chromium.content_public.common.ContentSwitches; import java.lang.annotation.Retention; @@ -160,8 +161,7 @@ final int textColor = ApiCompatibilityUtils.getColor( mContext.getResources(), R.color.default_text_color_inverse); final Drawable statusIcon = mContext.getDrawable(R.drawable.ic_globe_24dp); - final int iconTint = ApiCompatibilityUtils.getColor( - mContext.getResources(), R.color.default_icon_color_inverse); + final int iconTint = SemanticColorUtils.getDefaultIconColorInverse(mContext); mStatusIndicator.updateContent( mContext.getString(R.string.offline_indicator_v2_back_online_text), statusIcon, backgroundColor, textColor, iconTint, mHideRunnable);
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 8fa181d..d1862eb 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
@@ -41,7 +41,6 @@ import org.chromium.chrome.browser.contextualsearch.ContextualSearchManager; import org.chromium.chrome.browser.continuous_search.ContinuousSearchContainerCoordinator; import org.chromium.chrome.browser.continuous_search.ContinuousSearchContainerCoordinator.HeightObserver; -import org.chromium.chrome.browser.datareduction.DataReductionPromoScreen; import org.chromium.chrome.browser.feed.webfeed.WebFeedFollowIntroController; import org.chromium.chrome.browser.findinpage.FindToolbarObserver; import org.chromium.chrome.browser.firstrun.FirstRunStatus; @@ -901,10 +900,6 @@ SyncConsentActivityLauncherImpl.get(), VersionInfo.getProductMajorVersion())) { return true; } - if (DataReductionPromoScreen.launchDataReductionPromo( - mActivity, mTabModelSelectorSupplier.get().isIncognitoSelected())) { - return true; - } if (DefaultBrowserPromoUtils.prepareLaunchPromoIfNeeded(mActivity, mWindowAndroid)) { return true; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarButtonInProductHelpController.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarButtonInProductHelpController.java index 6a2e622..e4675f9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarButtonInProductHelpController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarButtonInProductHelpController.java
@@ -16,7 +16,6 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.bookmarks.PowerBookmarkUtils; import org.chromium.chrome.browser.commerce.shopping_list.ShoppingFeatures; -import org.chromium.chrome.browser.datareduction.DataReductionSavingsMilestonePromo; import org.chromium.chrome.browser.download.DownloadUtils; import org.chromium.chrome.browser.feature_engagement.ScreenshotMonitor; import org.chromium.chrome.browser.feature_engagement.ScreenshotMonitorDelegate; @@ -134,7 +133,6 @@ if (tab.isUserInteractable()) { showDataSaverDetail(); - if (dataSaved > 0L) showDataSaverMilestonePromo(); } showDownloadPageTextBubble(tab, FeatureConstants.DOWNLOAD_PAGE_FEATURE); @@ -265,30 +263,6 @@ .build()); } - // Attempts to show an IPH text bubble for data saver milestone promo. - private void showDataSaverMilestonePromo() { - final DataReductionSavingsMilestonePromo promo = - new DataReductionSavingsMilestonePromo(mActivity, - DataReductionProxySettings.getInstance().getTotalHttpContentLengthSaved()); - if (!promo.shouldShowPromo()) return; - - final Runnable dismissCallback = () -> { - promo.onPromoTextSeen(); - turnOffHighlightForMenuItem(); - }; - - mUserEducationHelper.requestShowIPH( - new IPHCommandBuilder(mActivity.getResources(), - FeatureConstants.DATA_SAVER_MILESTONE_PROMO_FEATURE, promo.getPromoText(), - promo.getPromoText()) - .setAnchorView(mMenuButtonAnchorView) - .setOnShowCallback(() - -> turnOnHighlightForMenuItem( - getDataReductionMenuItemHighlight())) - .setOnDismissCallback(dismissCallback) - .build()); - } - private void showDownloadHomeIPH() { mUserEducationHelper.requestShowIPH( new IPHCommandBuilder(mActivity.getResources(),
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtilsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtilsTest.java deleted file mode 100644 index 6d67c15..0000000 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionPromoUtilsTest.java +++ /dev/null
@@ -1,140 +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. - -package org.chromium.chrome.browser.datareduction; - -import android.content.Context; -import android.support.test.InstrumentationRegistry; - -import androidx.test.filters.SmallTest; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.chromium.base.ContextUtils; -import org.chromium.base.FieldTrialList; -import org.chromium.base.test.BaseJUnit4ClassRunner; -import org.chromium.base.test.UiThreadTest; -import org.chromium.base.test.util.AdvancedMockContext; -import org.chromium.base.test.util.Batch; -import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.Feature; -import org.chromium.chrome.browser.about_settings.AboutSettingsBridge; -import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; -import org.chromium.chrome.test.ChromeBrowserTestRule; - -/** - * Unit test suite for DataReductionPromoUtils. - */ -@RunWith(BaseJUnit4ClassRunner.class) -@Batch(Batch.PER_CLASS) -public class DataReductionPromoUtilsTest { - @Rule - public final ChromeBrowserTestRule mChromeBrowserTestRule = new ChromeBrowserTestRule(); - - private static final String SHARED_PREF_DISPLAYED_INFOBAR_PROMO_VERSION = - "displayed_data_reduction_infobar_promo_version"; - - private Context mContext; - - @Before - public void setUp() { - // Using an AdvancedMockContext allows us to use a fresh in-memory SharedPreference. - mContext = new AdvancedMockContext(InstrumentationRegistry.getInstrumentation() - .getTargetContext() - .getApplicationContext()); - ContextUtils.initApplicationContextForTests(mContext); - } - - /** - * Tests that promos cannot be shown if the data reduction proxy is enabled. - */ - @Test - @SmallTest - @UiThreadTest - @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, - "force-fieldtrials=DataCompressionProxyPromoVisibility/Enabled"}) - @Feature({"DataReduction"}) - public void - testCanShowPromos() { - if (DataReductionProxySettings.getInstance().isDataReductionProxyManaged()) return; - Assert.assertFalse(DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()); - - // In some unknown cases, the force-fieldtrials flag may not be effective. This may possibly - // be because this test runs on UiThread. - if (!FieldTrialList.findFullName("DataCompressionProxyPromoVisibility").equals("Enabled")) { - return; - } - Assert.assertTrue( - DataReductionProxySettings.getInstance().isDataReductionProxyPromoAllowed()); - Assert.assertTrue(DataReductionPromoUtils.canShowPromos()); - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled(mContext, true); - Assert.assertFalse(DataReductionPromoUtils.canShowPromos()); - } - - /** - * Tests that saving the first run experience and second run promo state updates the pref and - * also stores the application version. Tests that the first run experience opt out pref is - * updated. - */ - @Test - @SmallTest - @UiThreadTest - @Feature({"DataReduction"}) - public void testFreOrSecondRunPromoDisplayed() { - // The first run experience or second run promo should not have been shown yet. - Assert.assertFalse(DataReductionPromoUtils.getDisplayedFreOrSecondRunPromo()); - - // Save that the first run experience or second run promo has been displayed. - DataReductionPromoUtils.saveFreOrSecondRunPromoDisplayed(); - Assert.assertTrue(DataReductionPromoUtils.getDisplayedFreOrSecondRunPromo()); - Assert.assertFalse(DataReductionPromoUtils.getDisplayedInfoBarPromo()); - Assert.assertFalse(DataReductionPromoUtils.getOptedOutOnFrePromo()); - Assert.assertEquals(AboutSettingsBridge.getApplicationVersion(), - DataReductionPromoUtils.getDisplayedFreOrSecondRunPromoVersion()); - } - - /** - * Tests that the first run experience opt out pref is updated. - */ - @Test - @SmallTest - @UiThreadTest - @Feature({"DataReduction"}) - public void testFrePromoOptOut() { - // Save that the user opted out of the first run experience. - DataReductionPromoUtils.saveFrePromoOptOut(true); - Assert.assertTrue(DataReductionPromoUtils.getOptedOutOnFrePromo()); - - // Save that the user did not opt out of the first run experience. - DataReductionPromoUtils.saveFrePromoOptOut(false); - Assert.assertFalse(DataReductionPromoUtils.getOptedOutOnFrePromo()); - } - - /** - * Tests that saving the infobar promo state updates the pref and also stores the application - * version. - */ - @Test - @SmallTest - @UiThreadTest - @Feature({"DataReduction"}) - public void testInfoBarPromoDisplayed() { - // The infobar should not have been shown yet. - Assert.assertFalse(DataReductionPromoUtils.getDisplayedInfoBarPromo()); - - // Save that the infobar promo has been displayed. - DataReductionPromoUtils.saveInfoBarPromoDisplayed(); - Assert.assertFalse(DataReductionPromoUtils.getDisplayedFreOrSecondRunPromo()); - Assert.assertTrue(DataReductionPromoUtils.getDisplayedInfoBarPromo()); - Assert.assertFalse(DataReductionPromoUtils.getOptedOutOnFrePromo()); - Assert.assertEquals(AboutSettingsBridge.getApplicationVersion(), - ContextUtils.getAppSharedPreferences().getString( - SHARED_PREF_DISPLAYED_INFOBAR_PROMO_VERSION, "")); - } -}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionSavingsMilestonePromoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionSavingsMilestonePromoTest.java deleted file mode 100644 index 62ac253..0000000 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/datareduction/DataReductionSavingsMilestonePromoTest.java +++ /dev/null
@@ -1,213 +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. - -package org.chromium.chrome.browser.datareduction; - -import android.content.Context; -import android.support.test.InstrumentationRegistry; - -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; - -import org.chromium.base.test.util.AdvancedMockContext; -import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; -import org.chromium.chrome.test.ChromeJUnit4ClassRunner; -import org.chromium.chrome.test.ChromeTabbedActivityTestRule; - -/** - * Tests the DataReductionSavingsMilestonePromo. Tests that the promo data thresholds are properly - * set from a field trial param. - */ -@RunWith(ChromeJUnit4ClassRunner.class) -@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) -public class DataReductionSavingsMilestonePromoTest { - @Rule - public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); - - private static final int BYTES_IN_MB = 1024 * 1024; - private static final int FIRST_PROMO_SIZE_MB = 100; - private static final int SECOND_PROMO_SIZE_MB = 1024; - private static final int COMMAND_LINE_FLAG_PROMO_SIZE_MB = 1; - private static final String FIRST_PROMO_SIZE_STRING = "100 MB"; - private static final String SECOND_PROMO_SIZE_STRING = "1 GB"; - private static final String COMMAND_LINE_FLAG_PROMO_SIZE_STRING = "1 MB"; - - private Context mContext; - - @Before - public void setUp() throws InterruptedException, Throwable { - // Using an AdvancedMockContext allows us to use a fresh in-memory SharedPreference. - mContext = new AdvancedMockContext(InstrumentationRegistry.getInstrumentation() - .getTargetContext() - .getApplicationContext()); - mActivityTestRule.startMainActivityOnBlankPage(); - } - - @Test - @MediumTest - @CommandLineFlags.Add({"force-fieldtrials=" - + DataReductionSavingsMilestonePromo.PROMO_FIELD_TRIAL_NAME + "/Enabled", - "force-fieldtrial-params=" + DataReductionSavingsMilestonePromo.PROMO_FIELD_TRIAL_NAME - + ".Enabled:" + DataReductionSavingsMilestonePromo.PROMO_PARAM_NAME + "/" - + FIRST_PROMO_SIZE_MB + ";" + SECOND_PROMO_SIZE_MB}) - public void - testDataReductionSavingsMilestonePromo() throws Throwable { - mActivityTestRule.runOnUiThread(new Runnable() { - @Override - public void run() { - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( - mContext, true); - Assert.assertFalse( - DataReductionPromoUtils.hasMilestonePromoBeenInitWithStartingSavedBytes()); - - DataReductionSavingsMilestonePromo promo = - new DataReductionSavingsMilestonePromo(mActivityTestRule.getActivity(), 0); - Assert.assertFalse(promo.shouldShowPromo()); - Assert.assertNull(promo.getPromoText()); - - Assert.assertTrue( - DataReductionPromoUtils.hasMilestonePromoBeenInitWithStartingSavedBytes()); - Assert.assertEquals( - 0, DataReductionPromoUtils.getDisplayedMilestonePromoSavedBytes()); - - promo = new DataReductionSavingsMilestonePromo( - mActivityTestRule.getActivity(), FIRST_PROMO_SIZE_MB * BYTES_IN_MB); - Assert.assertTrue(promo.shouldShowPromo()); - Assert.assertNotNull(promo.getPromoText()); - promo.onPromoTextSeen(); - Assert.assertEquals(FIRST_PROMO_SIZE_MB * BYTES_IN_MB, - DataReductionPromoUtils.getDisplayedMilestonePromoSavedBytes()); - - promo = new DataReductionSavingsMilestonePromo( - mActivityTestRule.getActivity(), SECOND_PROMO_SIZE_MB * BYTES_IN_MB); - Assert.assertTrue(promo.shouldShowPromo()); - Assert.assertNotNull(promo.getPromoText()); - promo.onPromoTextSeen(); - Assert.assertEquals(SECOND_PROMO_SIZE_MB * BYTES_IN_MB, - DataReductionPromoUtils.getDisplayedMilestonePromoSavedBytes()); - } - }); - } - - @Test - @MediumTest - @CommandLineFlags.Add({"force-fieldtrials=" - + DataReductionSavingsMilestonePromo.PROMO_FIELD_TRIAL_NAME + "/Enabled", - "force-fieldtrial-params=" + DataReductionSavingsMilestonePromo.PROMO_FIELD_TRIAL_NAME - + ".Enabled:" + DataReductionSavingsMilestonePromo.PROMO_PARAM_NAME + "/" - + FIRST_PROMO_SIZE_MB + ";" + SECOND_PROMO_SIZE_MB}) - public void - testDataReductionSavingsMilestonePromoExistingUser() throws Throwable { - mActivityTestRule.runOnUiThread(new Runnable() { - @Override - public void run() { - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( - mContext, true); - Assert.assertFalse( - DataReductionPromoUtils.hasMilestonePromoBeenInitWithStartingSavedBytes()); - - DataReductionSavingsMilestonePromo promo = new DataReductionSavingsMilestonePromo( - mActivityTestRule.getActivity(), SECOND_PROMO_SIZE_MB * BYTES_IN_MB); - Assert.assertFalse(promo.shouldShowPromo()); - Assert.assertNull(promo.getPromoText()); - Assert.assertEquals(SECOND_PROMO_SIZE_MB * BYTES_IN_MB, - DataReductionPromoUtils.getDisplayedMilestonePromoSavedBytes()); - Assert.assertTrue( - DataReductionPromoUtils.hasMilestonePromoBeenInitWithStartingSavedBytes()); - - promo = new DataReductionSavingsMilestonePromo( - mActivityTestRule.getActivity(), SECOND_PROMO_SIZE_MB * BYTES_IN_MB + 1); - Assert.assertFalse(promo.shouldShowPromo()); - Assert.assertNull(promo.getPromoText()); - Assert.assertEquals(SECOND_PROMO_SIZE_MB * BYTES_IN_MB, - DataReductionPromoUtils.getDisplayedMilestonePromoSavedBytes()); - } - }); - } - - @Test - @MediumTest - @CommandLineFlags. - Add({"enable-data-reduction-proxy-savings-promo", "disable-field-trial-config"}) - public void testDataReductionSavingsMilestonePromoCommandLineFlag() throws Throwable { - mActivityTestRule.runOnUiThread(new Runnable() { - @Override - public void run() { - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( - mContext, true); - Assert.assertFalse( - DataReductionPromoUtils.hasMilestonePromoBeenInitWithStartingSavedBytes()); - - DataReductionSavingsMilestonePromo promo = - new DataReductionSavingsMilestonePromo(mActivityTestRule.getActivity(), 0); - Assert.assertFalse(promo.shouldShowPromo()); - Assert.assertNull(promo.getPromoText()); - - promo = new DataReductionSavingsMilestonePromo(mActivityTestRule.getActivity(), - COMMAND_LINE_FLAG_PROMO_SIZE_MB * BYTES_IN_MB); - Assert.assertTrue(promo.shouldShowPromo()); - Assert.assertTrue( - promo.getPromoText().endsWith(COMMAND_LINE_FLAG_PROMO_SIZE_STRING)); - promo.onPromoTextSeen(); - Assert.assertEquals(COMMAND_LINE_FLAG_PROMO_SIZE_MB * BYTES_IN_MB, - DataReductionPromoUtils.getDisplayedMilestonePromoSavedBytes()); - - promo = new DataReductionSavingsMilestonePromo( - mActivityTestRule.getActivity(), FIRST_PROMO_SIZE_MB * BYTES_IN_MB); - Assert.assertFalse(promo.shouldShowPromo()); - Assert.assertNull(promo.getPromoText()); - } - }); - } - - @Test - @MediumTest - @CommandLineFlags.Add({"enable-data-reduction-proxy-savings-promo", - "force-fieldtrials=" + DataReductionSavingsMilestonePromo.PROMO_FIELD_TRIAL_NAME - + "/Enabled", - "force-fieldtrial-params=" + DataReductionSavingsMilestonePromo.PROMO_FIELD_TRIAL_NAME - + ".Enabled:" + DataReductionSavingsMilestonePromo.PROMO_PARAM_NAME + "/" - + FIRST_PROMO_SIZE_MB + ";" + SECOND_PROMO_SIZE_MB}) - public void - testDataReductionSavingsMilestonePromoCommandLineFlagWithFieldTrial() throws Throwable { - mActivityTestRule.runOnUiThread(new Runnable() { - @Override - public void run() { - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( - mContext, true); - Assert.assertFalse( - DataReductionPromoUtils.hasMilestonePromoBeenInitWithStartingSavedBytes()); - - DataReductionSavingsMilestonePromo promo = - new DataReductionSavingsMilestonePromo(mActivityTestRule.getActivity(), 0); - Assert.assertFalse(promo.shouldShowPromo()); - Assert.assertNull(promo.getPromoText()); - - promo = new DataReductionSavingsMilestonePromo(mActivityTestRule.getActivity(), - COMMAND_LINE_FLAG_PROMO_SIZE_MB * BYTES_IN_MB); - Assert.assertTrue(promo.shouldShowPromo()); - Assert.assertTrue( - promo.getPromoText().endsWith(COMMAND_LINE_FLAG_PROMO_SIZE_STRING)); - promo.onPromoTextSeen(); - Assert.assertEquals(COMMAND_LINE_FLAG_PROMO_SIZE_MB * BYTES_IN_MB, - DataReductionPromoUtils.getDisplayedMilestonePromoSavedBytes()); - - promo = new DataReductionSavingsMilestonePromo( - mActivityTestRule.getActivity(), FIRST_PROMO_SIZE_MB * BYTES_IN_MB); - Assert.assertTrue(promo.shouldShowPromo()); - Assert.assertTrue(promo.getPromoText().endsWith(FIRST_PROMO_SIZE_STRING)); - promo.onPromoTextSeen(); - Assert.assertEquals(FIRST_PROMO_SIZE_MB * BYTES_IN_MB, - DataReductionPromoUtils.getDisplayedMilestonePromoSavedBytes()); - } - }); - } -}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunActivitySigninAndSyncTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunActivitySigninAndSyncTest.java index 8c4a6bb..62c9634a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunActivitySigninAndSyncTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunActivitySigninAndSyncTest.java
@@ -47,7 +47,6 @@ import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.locale.LocaleManager; import org.chromium.chrome.browser.locale.LocaleManagerDelegate; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.search_engines.SearchEnginePromoType; import org.chromium.chrome.browser.signin.SigninFirstRunFragment; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; @@ -87,17 +86,10 @@ private ExternalAuthUtils mExternalAuthUtilsMock; @Mock - private DataReductionProxySettings mDataReductionProxySettingsMock; - - @Mock private LocaleManagerDelegate mLocalManagerDelegateMock; @Before public void setUp() { - when(mDataReductionProxySettingsMock.isDataReductionProxyManaged()).thenReturn(false); - when(mDataReductionProxySettingsMock.isDataReductionProxyFREPromoAllowed()) - .thenReturn(true); - DataReductionProxySettings.setInstanceForTesting(mDataReductionProxySettingsMock); when(mLocalManagerDelegateMock.getSearchEnginePromoShowType()) .thenReturn(SearchEnginePromoType.DONT_SHOW); TestThreadUtils.runOnUiThreadBlocking(() -> { @@ -115,7 +107,8 @@ clickButton(R.id.signin_fre_dismiss_button); - ensureCurrentPageIs(DataReductionProxyFirstRunFragment.class); + ApplicationTestUtils.waitForActivityState( + mFirstRunActivityRule.getActivity(), Stage.DESTROYED); } @Test @@ -127,7 +120,8 @@ clickButton(R.id.signin_fre_dismiss_button); - ensureCurrentPageIs(DataReductionProxyFirstRunFragment.class); + ApplicationTestUtils.waitForActivityState( + mFirstRunActivityRule.getActivity(), Stage.DESTROYED); } @Test @@ -167,7 +161,8 @@ clickButton(R.id.signin_fre_continue_button); - ensureCurrentPageIs(DataReductionProxyFirstRunFragment.class); + ApplicationTestUtils.waitForActivityState( + mFirstRunActivityRule.getActivity(), Stage.DESTROYED); } @Test @@ -202,7 +197,7 @@ @Test @MediumTest - public void acceptingSyncShowsDataReductionPage() { + public void acceptingSyncEndsFre() { when(mExternalAuthUtilsMock.canUseGooglePlayServices(any())).thenReturn(true); mAccountManagerTestRule.addAccount(TEST_EMAIL); launchFirstRunActivity(); @@ -212,12 +207,13 @@ clickButton(R.id.positive_button); - ensureCurrentPageIs(DataReductionProxyFirstRunFragment.class); + ApplicationTestUtils.waitForActivityState( + mFirstRunActivityRule.getActivity(), Stage.DESTROYED); } @Test @MediumTest - public void refusingSyncShowsDataReductionPage() { + public void refusingSyncEndsFre() { mAccountManagerTestRule.addAccount(TEST_EMAIL); launchFirstRunActivity(); ensureCurrentPageIs(SigninFirstRunFragment.class); @@ -226,7 +222,8 @@ clickButton(R.id.negative_button); - ensureCurrentPageIs(DataReductionProxyFirstRunFragment.class); + ApplicationTestUtils.waitForActivityState( + mFirstRunActivityRule.getActivity(), Stage.DESTROYED); } @Test
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java index 07afa05..226ca05 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java
@@ -285,12 +285,6 @@ FirstRunNavigationHelper navigationHelper = new FirstRunNavigationHelper(firstRunActivity); navigationHelper.ensurePagesCreationSucceeded().acceptTermsOfService(); - if (testCase.showDataSaverPromo()) { - navigationHelper.acknowledgeDataSaverEnabled(); - } else { - navigationHelper.ensureDataSaverPromoNotCurrentPage(); - } - if (testCase.searchPromoType() == SearchEnginePromoType.DONT_SHOW) { navigationHelper.ensureDefaultSearchEnginePromoNotCurrentPage(); } else { @@ -420,34 +414,6 @@ @Test @MediumTest - public void testFirstRunPages_NoCctPolicy_DataSaverPromo() throws Exception { - runFirstRunPagesTest(new FirstRunPagesTestCase().withDataSaverPromo()); - } - - @Test - @MediumTest - public void testFirstRunPages_NoCctPolicy_DataSaverPromo_SearchPromo() throws Exception { - runFirstRunPagesTest(new FirstRunPagesTestCase().withDataSaverPromo().withSearchPromo()); - } - - @Test - @MediumTest - public void testFirstRunPages_NoCctPolicy_DataSaverPromo_SearchPromo_SigninPromo() - throws Exception { - runFirstRunPagesTest(new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo()); - } - - @Test - @MediumTest - public void testFirstRunPages_NoCctPolicy_DataSaverPromo_SigninPromo() throws Exception { - runFirstRunPagesTest(new FirstRunPagesTestCase().withDataSaverPromo().withSigninPromo()); - } - - @Test - @MediumTest public void testFirstRunPages_NoCctPolicy_SearchPromo() throws Exception { runFirstRunPagesTest(new FirstRunPagesTestCase().withSearchPromo()); } @@ -467,10 +433,7 @@ @Test @MediumTest public void testFirstRunPages_NoCctPolicy_OnBackPressed() throws Exception { - initializePreferences(new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo()); + initializePreferences(new FirstRunPagesTestCase().withSearchPromo().withSigninPromo()); FirstRunActivity firstRunActivity = launchFirstRunActivity(); @@ -479,17 +442,13 @@ new FirstRunNavigationHelper(firstRunActivity) .ensurePagesCreationSucceeded() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .ensureSigninPromoIsCurrentPage() .goBackToPreviousPage() .ensureDefaultSearchEnginePromoIsCurrentPage() .goBackToPreviousPage() - .ensureDataSaverPromoIsCurrentPage() - .goBackToPreviousPage() .ensureTermsOfServiceIsCurrentPage() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .skipSigninPromo(); @@ -504,41 +463,6 @@ @Test @MediumTest - public void testFirstRunPages_WithCctPolicy_DataSaverPromo() throws Exception { - runFirstRunPagesTest(new FirstRunPagesTestCase().withCctTosDisabled().withDataSaverPromo()); - } - - @Test - @MediumTest - public void testFirstRunPages_WithCctPolicy_DataSaverPromo_SearchPromo() throws Exception { - runFirstRunPagesTest(new FirstRunPagesTestCase() - .withCctTosDisabled() - .withDataSaverPromo() - .withSearchPromo()); - } - - @Test - @MediumTest - public void testFirstRunPages_WithCctPolicy_DataSaverPromo_SigninPromo() throws Exception { - runFirstRunPagesTest(new FirstRunPagesTestCase() - .withCctTosDisabled() - .withDataSaverPromo() - .withSigninPromo()); - } - - @Test - @MediumTest - public void testFirstRunPages_WithCctPolicy_DataSaverPromo_SearchPromo_SigninPromo() - throws Exception { - runFirstRunPagesTest(new FirstRunPagesTestCase() - .withCctTosDisabled() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo()); - } - - @Test - @MediumTest public void testFirstRunPages_WithCctPolicy_SearchPromo() throws Exception { runFirstRunPagesTest(new FirstRunPagesTestCase().withCctTosDisabled().withSearchPromo()); } @@ -563,7 +487,6 @@ public void testFirstRunPages_WithCctPolicy_OnBackPressed() throws Exception { initializePreferences(new FirstRunPagesTestCase() .withCctTosDisabled() - .withDataSaverPromo() .withSearchPromo() .withSigninPromo()); @@ -574,17 +497,13 @@ new FirstRunNavigationHelper(firstRunActivity) .ensurePagesCreationSucceeded() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .ensureSigninPromoIsCurrentPage() .goBackToPreviousPage() .ensureDefaultSearchEnginePromoIsCurrentPage() .goBackToPreviousPage() - .ensureDataSaverPromoIsCurrentPage() - .goBackToPreviousPage() .ensureTermsOfServiceIsCurrentPage() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .skipSigninPromo(); @@ -653,10 +572,7 @@ @Test @MediumTest public void testFirstRunPages_ProgressHistogramRecordedOnlyOnce() throws Exception { - initializePreferences(new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo()); + initializePreferences(new FirstRunPagesTestCase().withSearchPromo().withSigninPromo()); FirstRunActivity firstRunActivity = launchFirstRunActivity(); @@ -665,25 +581,21 @@ new FirstRunNavigationHelper(firstRunActivity) .ensurePagesCreationSucceeded() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .ensureSigninPromoIsCurrentPage() .goBackToPreviousPage() .ensureDefaultSearchEnginePromoIsCurrentPage() .goBackToPreviousPage() - .ensureDataSaverPromoIsCurrentPage() - .goBackToPreviousPage() .ensureTermsOfServiceIsCurrentPage() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .skipSigninPromo(); waitForActivity(ChromeTabbedActivity.class); checkRecordedProgressSteps(Arrays.asList(new Integer[] {MobileFreProgress.STARTED, - MobileFreProgress.WELCOME_SHOWN, MobileFreProgress.DATA_SAVER_SHOWN, - MobileFreProgress.SYNC_CONSENT_SHOWN, MobileFreProgress.SYNC_CONSENT_DISMISSED, + MobileFreProgress.WELCOME_SHOWN, MobileFreProgress.SYNC_CONSENT_SHOWN, + MobileFreProgress.SYNC_CONSENT_DISMISSED, MobileFreProgress.DEFAULT_SEARCH_ENGINE_SHOWN})); } @@ -1041,10 +953,8 @@ @Test @MediumTest public void testPrefsUpdated_allPagesAlreadyShown() throws Exception { - FirstRunPagesTestCase testCase = new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo(); + FirstRunPagesTestCase testCase = + new FirstRunPagesTestCase().withSearchPromo().withSigninPromo(); initializePreferences(testCase); FirstRunActivity firstRunActivity = launchFirstRunActivity(); @@ -1053,12 +963,10 @@ FirstRunNavigationHelper navigationHelper = new FirstRunNavigationHelper(firstRunActivity) .ensurePagesCreationSucceeded() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .ensureSigninPromoIsCurrentPage(); // Change preferences to disable all promos. - testCase.setDataSaverPromo(false); testCase.setSearchPromoType(SearchEnginePromoType.DONT_SHOW); testCase.setSigninPromo(false); @@ -1074,10 +982,8 @@ @Test @MediumTest public void testPrefsUpdated_noPagesShown() throws Exception { - FirstRunPagesTestCase testCase = new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo(); + FirstRunPagesTestCase testCase = + new FirstRunPagesTestCase().withSearchPromo().withSigninPromo(); initializePreferences(testCase); FirstRunActivity firstRunActivity = launchFirstRunActivity(); @@ -1088,13 +994,11 @@ .ensureTermsOfServiceIsCurrentPage(); // Change preferences before any promo page is shown. - testCase.setDataSaverPromo(false); testCase.setSearchPromoType(SearchEnginePromoType.DONT_SHOW); testCase.setSigninPromo(false); // Accepting terms of services should complete first run, since all the promos are disabled. navigationHelper.acceptTermsOfService() - .ensureDataSaverPromoNotCurrentPage() .ensureDefaultSearchEnginePromoNotCurrentPage() .ensureSigninPromoNotCurrentPage(); @@ -1103,88 +1007,9 @@ @Test @MediumTest - public void testPrefsUpdated_dataReductionPromoDisableAfterPromoShown() throws Exception { - FirstRunPagesTestCase testCase = new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo(); - initializePreferences(testCase); - - FirstRunActivity firstRunActivity = launchFirstRunActivity(); - - // Accept terms of service and pass through data saver prompt. - FirstRunNavigationHelper navigationHelper = new FirstRunNavigationHelper(firstRunActivity) - .ensurePagesCreationSucceeded() - .acceptTermsOfService() - .acknowledgeDataSaverEnabled(); - - // Disable data saver prompt after the next page is shown. - testCase.setDataSaverPromo(false); - - // Go until the last page without skipping the last one, go back until initial page, and - // then complete first run. The data server prompt shouldn't be shown again in either - // direction. - navigationHelper.selectDefaultSearchEngine() - .ensureSigninPromoIsCurrentPage() - .goBackToPreviousPage() - .ensureDefaultSearchEnginePromoIsCurrentPage() - .goBackToPreviousPage() - .ensureDataSaverPromoNotCurrentPage() - .ensureTermsOfServiceIsCurrentPage() - .acceptTermsOfService() - .ensureDataSaverPromoNotCurrentPage() - .selectDefaultSearchEngine() - .skipSigninPromo(); - - waitForActivity(ChromeTabbedActivity.class); - } - - @Test - @MediumTest - public void testPrefsUpdated_dataReductionPromoDisableWhilePromoShown() throws Exception { - FirstRunPagesTestCase testCase = new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo(); - initializePreferences(testCase); - - FirstRunActivity firstRunActivity = launchFirstRunActivity(); - - // Accept terms of service and don't skip the data saver prompt. - FirstRunNavigationHelper navigationHelper = new FirstRunNavigationHelper(firstRunActivity) - .ensurePagesCreationSucceeded() - .acceptTermsOfService() - .ensureDataSaverPromoIsCurrentPage(); - - // Disable data saver prompt while it's shown. This will not hide the page. - testCase.setDataSaverPromo(false); - - // Pass the data saver prompt, and go until the last page without skipping the last one. - // Go back until initial page, and then complete first run. The data server prompt shouldn't - // be shown again in either direction. - navigationHelper.acknowledgeDataSaverEnabled() - .selectDefaultSearchEngine() - .ensureSigninPromoIsCurrentPage() - .goBackToPreviousPage() - .ensureDefaultSearchEnginePromoIsCurrentPage() - .goBackToPreviousPage() - .ensureDataSaverPromoNotCurrentPage() - .ensureTermsOfServiceIsCurrentPage() - .acceptTermsOfService() - .ensureDataSaverPromoNotCurrentPage() - .selectDefaultSearchEngine() - .skipSigninPromo(); - - waitForActivity(ChromeTabbedActivity.class); - } - - @Test - @MediumTest public void testPrefsUpdated_searchEnginePromoDisableAfterPromoShown() throws Exception { - FirstRunPagesTestCase testCase = new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo(); + FirstRunPagesTestCase testCase = + new FirstRunPagesTestCase().withSearchPromo().withSigninPromo(); initializePreferences(testCase); FirstRunActivity firstRunActivity = launchFirstRunActivity(); @@ -1193,7 +1018,6 @@ FirstRunNavigationHelper navigationHelper = new FirstRunNavigationHelper(firstRunActivity) .ensurePagesCreationSucceeded() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .ensureSigninPromoIsCurrentPage(); @@ -1206,10 +1030,7 @@ // direction. navigationHelper.goBackToPreviousPage() .ensureDefaultSearchEnginePromoNotCurrentPage() - .ensureDataSaverPromoIsCurrentPage() - .goBackToPreviousPage() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .ensureDefaultSearchEnginePromoNotCurrentPage() .skipSigninPromo(); @@ -1219,10 +1040,8 @@ @Test @MediumTest public void testPrefsUpdated_searchEnginePromoDisableWhilePromoShown() throws Exception { - FirstRunPagesTestCase testCase = new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo(); + FirstRunPagesTestCase testCase = + new FirstRunPagesTestCase().withSearchPromo().withSigninPromo(); initializePreferences(testCase); FirstRunActivity firstRunActivity = launchFirstRunActivity(); @@ -1232,7 +1051,6 @@ new FirstRunNavigationHelper(firstRunActivity) .ensurePagesCreationSucceeded() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .ensureDefaultSearchEnginePromoIsCurrentPage(); // Disable search engine prompt while it's shown. This will not hide the page. @@ -1246,10 +1064,7 @@ .ensureSigninPromoIsCurrentPage() .goBackToPreviousPage() .ensureDefaultSearchEnginePromoNotCurrentPage() - .ensureDataSaverPromoIsCurrentPage() - .goBackToPreviousPage() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .ensureDefaultSearchEnginePromoNotCurrentPage() .skipSigninPromo(); @@ -1259,10 +1074,8 @@ @Test @MediumTest public void testPrefsUpdated_signinPromoPromoDisableAfterPromoShown() throws Exception { - FirstRunPagesTestCase testCase = new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo(); + FirstRunPagesTestCase testCase = + new FirstRunPagesTestCase().withSearchPromo().withSigninPromo(); initializePreferences(testCase); FirstRunActivity firstRunActivity = launchFirstRunActivity(); @@ -1271,7 +1084,6 @@ FirstRunNavigationHelper navigationHelper = new FirstRunNavigationHelper(firstRunActivity) .ensurePagesCreationSucceeded() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .ensureSigninPromoIsCurrentPage(); @@ -1283,10 +1095,7 @@ navigationHelper.goBackToPreviousPage() .ensureDefaultSearchEnginePromoIsCurrentPage() .goBackToPreviousPage() - .ensureDataSaverPromoIsCurrentPage() - .goBackToPreviousPage() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine(); waitForActivity(ChromeTabbedActivity.class); @@ -1295,10 +1104,8 @@ @Test @MediumTest public void testPrefsUpdated_signinPromoPromoDisableWhilePromoShown() throws Exception { - FirstRunPagesTestCase testCase = new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo(); + FirstRunPagesTestCase testCase = + new FirstRunPagesTestCase().withSearchPromo().withSigninPromo(); initializePreferences(testCase); FirstRunActivity firstRunActivity = launchFirstRunActivity(); @@ -1307,7 +1114,6 @@ FirstRunNavigationHelper navigationHelper = new FirstRunNavigationHelper(firstRunActivity) .ensurePagesCreationSucceeded() .acceptTermsOfService() - .acknowledgeDataSaverEnabled() .selectDefaultSearchEngine() .ensureSigninPromoIsCurrentPage(); @@ -1360,17 +1166,12 @@ static class FirstRunPagesTestCase { private boolean mCctTosDisabled; private @SearchEnginePromoType int mSearchPromoType = SearchEnginePromoType.DONT_SHOW; - private boolean mShowDataSaverPromo; private boolean mShowSigninPromo; boolean cctTosDisabled() { return mCctTosDisabled; } - boolean showDataSaverPromo() { - return mShowDataSaverPromo; - } - @SearchEnginePromoType int searchPromoType() { return mSearchPromoType; @@ -1390,11 +1191,6 @@ return this; } - FirstRunPagesTestCase setDataSaverPromo(boolean showDataSaverPromo) { - mShowDataSaverPromo = showDataSaverPromo; - return this; - } - FirstRunPagesTestCase setSearchPromoType(@SearchEnginePromoType int searchPromoType) { mSearchPromoType = searchPromoType; return this; @@ -1409,10 +1205,6 @@ return setCctTosDisabled(true); } - FirstRunPagesTestCase withDataSaverPromo() { - return setDataSaverPromo(true); - } - FirstRunPagesTestCase withSearchPromo() { return setSearchPromoType(SearchEnginePromoType.SHOW_EXISTING); } @@ -1422,10 +1214,7 @@ } static FirstRunPagesTestCase createWithShowAllPromos() { - return new FirstRunPagesTestCase() - .withDataSaverPromo() - .withSearchPromo() - .withSigninPromo(); + return new FirstRunPagesTestCase().withSearchPromo().withSigninPromo(); } } @@ -1471,17 +1260,6 @@ .or(Matchers.instanceOf(SigninFirstRunFragment.class))); } - protected FirstRunNavigationHelper ensureDataSaverPromoIsCurrentPage() { - return waitForCurrentFragmentToMatch("Data reduction promo should be the current page", - Matchers.instanceOf(DataReductionProxyFirstRunFragment.class)); - } - - protected FirstRunNavigationHelper ensureDataSaverPromoNotCurrentPage() { - return waitForCurrentFragmentToMatch( - "Data reduction promo shouldn't be the current page", - Matchers.not(Matchers.instanceOf(DataReductionProxyFirstRunFragment.class))); - } - protected FirstRunNavigationHelper ensureDefaultSearchEnginePromoIsCurrentPage() { return waitForCurrentFragmentToMatch("Search engine promo should be the current page", Matchers.instanceOf(DefaultSearchEngineFirstRunFragment.class)); @@ -1537,17 +1315,6 @@ return this; } - protected FirstRunNavigationHelper acknowledgeDataSaverEnabled() throws Exception { - ensureDataSaverPromoIsCurrentPage(); - - int jumpCallCount = mScopedObserverData.jumpToPageCallback.getCallCount(); - clickButton(mFirstRunActivity, R.id.next_button, "Failed to skip data saver"); - mScopedObserverData.jumpToPageCallback.waitForCallback( - "Failed try to move past the data saver fragment", jumpCallCount); - - return this; - } - protected FirstRunNavigationHelper selectDefaultSearchEngine() throws Exception { ensureDefaultSearchEnginePromoIsCurrentPage(); @@ -1616,11 +1383,6 @@ } @Override - public boolean shouldShowDataReductionPage(boolean openAdvancedSyncSettings) { - return mTestCase.showDataSaverPromo(); - } - - @Override public boolean shouldShowSearchEnginePage() { return mTestCase.showSearchPromo(); }
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 39e2da35..9d5d2b2 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
@@ -31,10 +31,8 @@ import org.chromium.base.test.util.UrlUtils; import org.chromium.chrome.R; import org.chromium.chrome.browser.WebContentsFactory; -import org.chromium.chrome.browser.datareduction.DataReductionPromoUtils; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.SadTab; import org.chromium.chrome.browser.tab.TabTestUtils; @@ -46,16 +44,13 @@ import org.chromium.chrome.test.util.InfoBarUtil; import org.chromium.chrome.test.util.InfoBarUtil.InfoBarMatcher; import org.chromium.chrome.test.util.browser.Features.DisableFeatures; -import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.chrome.test.util.browser.LocationSettingsTestUtil; import org.chromium.components.infobars.InfoBar; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.test.EmbeddedTestServer; -import org.chromium.url.GURL; -import java.net.HttpURLConnection; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; @@ -123,15 +118,6 @@ } } - private void waitUntilDataReductionPromoInfoBarAppears() { - CriteriaHelper.pollUiThread(() -> { - List<InfoBar> infobars = sActivityTestRule.getInfoBars(); - Criteria.checkThat(infobars.size(), Matchers.is(1)); - Criteria.checkThat( - infobars.get(0), Matchers.instanceOf(DataReductionPromoInfoBar.class)); - }); - } - private TabWebContentsDelegateAndroid getTabWebContentsDelegate() { return TabTestUtils.getTabWebContentsDelegate( sActivityTestRule.getActivity().getActivityTab()); @@ -297,184 +283,6 @@ } /** - * Verify the Data Reduction Promo infobar is shown and clicking the primary button dismisses - * it. - */ - @Test - @MediumTest - @CommandLineFlags.Add("force-fieldtrials=DataCompressionProxyPromoVisibility/Enabled") - @EnableFeatures("DataReductionProxyEnabledWithNetworkService") - @Feature({"Browser", "Main"}) - public void testDataReductionPromoInfoBar() { - GURL gurl = new GURL("http://google.com"); - TestThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertFalse("Data Reduction Proxy enabled", - DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()); - // Fake the FRE or second run promo being shown in M51. - DataReductionPromoUtils.saveFreOrSecondRunPromoDisplayed(); - ContextUtils.getAppSharedPreferences() - .edit() - .putString(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_VERSION, M51_VERSION) - .apply(); - // Add an infobar. - Assert.assertTrue(DataReductionPromoInfoBar.maybeLaunchPromoInfoBar( - sActivityTestRule.getActivity(), sActivityTestRule.getWebContents(), gurl, - false, false, HttpURLConnection.HTTP_OK)); - }); - - waitUntilDataReductionPromoInfoBarAppears(); - final List<InfoBar> infoBars = sActivityTestRule.getInfoBars(); - Assert.assertTrue("InfoBar does not have primary button", - InfoBarUtil.hasPrimaryButton(infoBars.get(0))); - Assert.assertTrue("InfoBar does not have secondary button", - InfoBarUtil.hasSecondaryButton(infoBars.get(0))); - - TestThreadUtils.runOnUiThreadBlocking( - (Runnable) () -> InfoBarUtil.clickPrimaryButton(infoBars.get(0))); - - // The renderer should have been killed and the infobar removed. - InfoBarUtil.waitUntilNoInfoBarsExist(sActivityTestRule.getInfoBars()); - - TestThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertTrue("Data Reduction Proxy not enabled", - DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()); - // Turn Data Saver off so the promo can be reshown. - DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( - sActivityTestRule.getActivity(), false); - // Try to add an infobar. Infobar should not be added since it has already been - // shown. - Assert.assertFalse(DataReductionPromoInfoBar.maybeLaunchPromoInfoBar( - sActivityTestRule.getActivity(), sActivityTestRule.getWebContents(), gurl, - false, false, HttpURLConnection.HTTP_OK)); - }); - } - - /** - * Verify the Data Reduction Promo infobar is shown and clicking the secondary button dismisses - * it. - */ - @Test - @MediumTest - @CommandLineFlags.Add("force-fieldtrials=DataCompressionProxyPromoVisibility/Enabled") - @Feature({"Browser", "Main"}) - public void testDataReductionPromoInfoBarDismissed() { - GURL gurl = new GURL("http://google.com"); - TestThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertFalse("Data Reduction Proxy enabled", - DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()); - // Fake the first run experience or second run promo being shown in M51. - DataReductionPromoUtils.saveFreOrSecondRunPromoDisplayed(); - ContextUtils.getAppSharedPreferences() - .edit() - .putString(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_VERSION, M51_VERSION) - .apply(); - // Add an infobar. - Assert.assertTrue(DataReductionPromoInfoBar.maybeLaunchPromoInfoBar( - sActivityTestRule.getActivity(), sActivityTestRule.getWebContents(), gurl, - false, false, HttpURLConnection.HTTP_OK)); - }); - - waitUntilDataReductionPromoInfoBarAppears(); - final List<InfoBar> infoBars = sActivityTestRule.getInfoBars(); - Assert.assertTrue("InfoBar does not have primary button", - InfoBarUtil.hasPrimaryButton(infoBars.get(0))); - Assert.assertTrue("InfoBar does not have secondary button", - InfoBarUtil.hasSecondaryButton(infoBars.get(0))); - - TestThreadUtils.runOnUiThreadBlocking( - (Runnable) () -> InfoBarUtil.clickSecondaryButton(infoBars.get(0))); - - // The renderer should have been killed and the infobar removed. - InfoBarUtil.waitUntilNoInfoBarsExist(sActivityTestRule.getInfoBars()); - - TestThreadUtils.runOnUiThreadBlocking(() -> { - Assert.assertFalse("Data Reduction Proxy enabled", - DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()); - // Try to add an infobar. Infobar should not be added since the user clicked - // dismiss. - Assert.assertFalse(DataReductionPromoInfoBar.maybeLaunchPromoInfoBar( - sActivityTestRule.getActivity(), sActivityTestRule.getWebContents(), gurl, - false, false, HttpURLConnection.HTTP_OK)); - }); - } - - /** - * Verify the Data Reduction Promo infobar is not shown when the fre or second run promo version - * was not stored and the package was installed after M48. - */ - @Test - @MediumTest - @CommandLineFlags.Add("force-fieldtrials=DataCompressionProxyPromoVisibility/Enabled") - @Feature({"Browser", "Main"}) - public void testDataReductionPromoInfoBarPostM48Install() throws Throwable { - sActivityTestRule.runOnUiThread(new Runnable() { - @Override - public void run() { - Assert.assertFalse("Data Reduction Proxy enabled", - DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()); - // Fake the first run experience or second run promo being shown. - DataReductionPromoUtils.saveFreOrSecondRunPromoDisplayed(); - // Remove the version. Versions prior to M51 will not have the version pref. - ContextUtils.getAppSharedPreferences() - .edit() - .putString(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_VERSION, "") - .apply(); - // Add an infobar. Infobar should not be added since the first run experience - // or second run promo version was not shown and the package was installed - // after M48. - Assert.assertFalse(DataReductionPromoInfoBar.maybeLaunchPromoInfoBar( - sActivityTestRule.getActivity(), sActivityTestRule.getWebContents(), - new GURL("http://google.com"), false, false, HttpURLConnection.HTTP_OK)); - } - }); - } - - /** - * Verify that the Data Reduction Promo infobar is not shown if the first run experience or - * Infobar promo hasn't been shown or if it hasn't been two versions since the promo was shown. - */ - @Test - @MediumTest - @CommandLineFlags.Add("force-fieldtrials=DataCompressionProxyPromoVisibility/Enabled") - @Feature({"Browser", "Main"}) - public void testDataReductionPromoInfoBarFreOptOut() throws Throwable { - GURL gurl = new GURL("http://google.com"); - sActivityTestRule.runOnUiThread(new Runnable() { - @Override - public void run() { - // Try to add an infobar. Infobar should not be added since the first run - // experience or second run promo hasn't been shown. - Assert.assertFalse(DataReductionPromoInfoBar.maybeLaunchPromoInfoBar( - sActivityTestRule.getActivity(), sActivityTestRule.getWebContents(), gurl, - false, false, HttpURLConnection.HTTP_OK)); - - // Fake showing the FRE. - DataReductionPromoUtils.saveFreOrSecondRunPromoDisplayed(); - - // Try to add an infobar. Infobar should not be added since the - // first run experience was just shown. - Assert.assertFalse(DataReductionPromoInfoBar.maybeLaunchPromoInfoBar( - sActivityTestRule.getActivity(), sActivityTestRule.getWebContents(), gurl, - false, false, HttpURLConnection.HTTP_OK)); - - // Fake the first run experience or second run promo being shown in M51. - DataReductionPromoUtils.saveFreOrSecondRunPromoDisplayed(); - ContextUtils.getAppSharedPreferences() - .edit() - .putString(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_VERSION, M51_VERSION) - .apply(); - DataReductionPromoUtils.saveFrePromoOptOut(true); - - // Try to add an infobar. Infobar should not be added since the user opted - // out on the first run experience. - Assert.assertFalse(DataReductionPromoInfoBar.maybeLaunchPromoInfoBar( - sActivityTestRule.getActivity(), sActivityTestRule.getWebContents(), gurl, - false, false, HttpURLConnection.HTTP_OK)); - } - }); - } - - /** * Verifies the unresponsive renderer notification creates an InfoBar. */ @Test
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java index b580146..93e6e7e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java
@@ -19,6 +19,7 @@ import android.widget.TextView; import androidx.annotation.ColorInt; +import androidx.appcompat.content.res.AppCompatResources; import androidx.test.filters.MediumTest; import org.junit.Rule; @@ -34,6 +35,7 @@ import org.chromium.components.browser_ui.modaldialog.ModalDialogTestUtils; import org.chromium.components.browser_ui.modaldialog.ModalDialogView; import org.chromium.components.browser_ui.modaldialog.test.R; +import org.chromium.components.browser_ui.styles.SemanticColorUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.UiUtils; import org.chromium.ui.modaldialog.ModalDialogProperties; @@ -170,8 +172,8 @@ @MediumTest @Feature({"ModalDialog", "RenderTest"}) public void testRender_FilledPrimaryButtonWithIcon() throws IOException { - final Drawable icon = UiUtils.getTintedDrawable(getActivity(), - org.chromium.chrome.R.drawable.ic_add, R.color.default_icon_color_inverse); + final Drawable icon = AppCompatResources.getDrawable(getActivity(), R.drawable.ic_add); + icon.mutate().setTint(SemanticColorUtils.getDefaultIconColorInverse(getActivity())); setUpViews(R.style.Theme_Chromium_ModalDialog_FilledPrimaryButton); createModel(
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 04e5233..41797bd 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
@@ -73,7 +73,7 @@ activity.findViewById(android.R.id.content), activity.getBrowserControlsManager()); PasswordManagerDialogContents contents = new PasswordManagerDialogContents(TITLE, - DETAILS, R.drawable.data_reduction_illustration, OK_BUTTON, 0, CANCEL_BUTTON, + DETAILS, R.drawable.password_checkup_warning, OK_BUTTON, 0, CANCEL_BUTTON, mOnClick); contents.setDialogType(ModalDialogManager.ModalDialogType.TAB); mCoordinator.initialize(activity.getWindowAndroid().getContext().get(), contents);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java index 9e37468..d28ed26 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java
@@ -34,7 +34,6 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.flags.ChromeSwitches; -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.test.util.browser.Features; @@ -114,9 +113,6 @@ } @Mock - private DataReductionProxySettings mDataReductionProxySettingsMock; - - @Mock private UmaRecorder mUmaRecorderMock; @Mock @@ -135,12 +131,6 @@ .thenReturn(mIdentityManagerMock); when(mIdentityManagerMock.hasPrimaryAccount(ConsentLevel.SYNC)).thenReturn(false); - // Show data reduction page by default. - when(mDataReductionProxySettingsMock.isDataReductionProxyManaged()).thenReturn(false); - when(mDataReductionProxySettingsMock.isDataReductionProxyFREPromoAllowed()) - .thenReturn(true); - DataReductionProxySettings.setInstanceForTesting(mDataReductionProxySettingsMock); - mActivityController = Robolectric.buildActivity(Activity.class); Activity activity = mActivityController.setup().get(); mDelegate = new TestFirstRunFlowSequencerDelegate(); @@ -158,8 +148,6 @@ @Test @Feature({"FirstRun"}) public void testStandardFlowTosNotSeen() { - when(mDataReductionProxySettingsMock.isDataReductionProxyFREPromoAllowed()) - .thenReturn(false); mDelegate.isSyncAllowed = true; mDelegate.shouldSkipFirstUseHints = false; @@ -171,19 +159,16 @@ Bundle bundle = mSequencer.returnedBundle; assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_SYNC_CONSENT_PAGE)); - assertFalse(bundle.getBoolean(FirstRunActivityBase.SHOW_DATA_REDUCTION_PAGE)); assertFalse(bundle.getBoolean(FirstRunActivityBase.SHOW_SEARCH_ENGINE_PAGE)); assertEquals(ChildAccountStatus.NOT_CHILD, bundle.getInt(SyncConsentFirstRunFragment.CHILD_ACCOUNT_STATUS)); - assertEquals(4, bundle.size()); + assertEquals(3, bundle.size()); } @Test @Feature({"FirstRun"}) public void testStandardFlowOneChildAccount() { mAccountManagerTestRule.addAccount(CHILD_ACCOUNT_NAME); - when(mDataReductionProxySettingsMock.isDataReductionProxyFREPromoAllowed()) - .thenReturn(false); mDelegate.isSyncAllowed = true; mDelegate.shouldSkipFirstUseHints = false; @@ -195,35 +180,10 @@ Bundle bundle = mSequencer.returnedBundle; assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_SYNC_CONSENT_PAGE)); - assertFalse(bundle.getBoolean(FirstRunActivityBase.SHOW_DATA_REDUCTION_PAGE)); assertFalse(bundle.getBoolean(FirstRunActivityBase.SHOW_SEARCH_ENGINE_PAGE)); assertEquals(ChildAccountStatus.REGULAR_CHILD, bundle.getInt(SyncConsentFirstRunFragment.CHILD_ACCOUNT_STATUS)); - assertEquals(4, bundle.size()); - } - - @Test - @Feature({"FirstRun"}) - public void testStandardFlowShowDataReductionPage() { - mAccountManagerTestRule.addAccount(ADULT_ACCOUNT_NAME); - mAccountManagerTestRule.addAccount("second.test.account@gmail.com"); - mDelegate.isSyncAllowed = true; - mDelegate.shouldSkipFirstUseHints = false; - mDelegate.shouldShowSearchEnginePage = false; - - mSequencer.start(); - - verifyNumberOfAccountsRecorded(2); - assertTrue(mSequencer.calledOnFlowIsKnown); - assertFalse(mSequencer.calledSetFirstRunFlowSignInComplete); - - Bundle bundle = mSequencer.returnedBundle; - assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_SYNC_CONSENT_PAGE)); - assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_DATA_REDUCTION_PAGE)); - assertFalse(bundle.getBoolean(FirstRunActivityBase.SHOW_SEARCH_ENGINE_PAGE)); - assertEquals(ChildAccountStatus.NOT_CHILD, - bundle.getInt(SyncConsentFirstRunFragment.CHILD_ACCOUNT_STATUS)); - assertEquals(4, bundle.size()); + assertEquals(3, bundle.size()); } @Test @@ -241,11 +201,10 @@ Bundle bundle = mSequencer.returnedBundle; assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_SYNC_CONSENT_PAGE)); - assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_DATA_REDUCTION_PAGE)); assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_SEARCH_ENGINE_PAGE)); assertEquals(ChildAccountStatus.NOT_CHILD, bundle.getInt(SyncConsentFirstRunFragment.CHILD_ACCOUNT_STATUS)); - assertEquals(4, bundle.size()); + assertEquals(3, bundle.size()); } @Test @@ -264,11 +223,10 @@ assertFalse(mSequencer.calledSetFirstRunFlowSignInComplete); final Bundle bundle = mSequencer.returnedBundle; assertFalse(bundle.getBoolean(FirstRunActivityBase.SHOW_SYNC_CONSENT_PAGE)); - assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_DATA_REDUCTION_PAGE)); assertFalse(bundle.getBoolean(FirstRunActivityBase.SHOW_SEARCH_ENGINE_PAGE)); assertEquals(ChildAccountStatus.NOT_CHILD, bundle.getInt(SyncConsentFirstRunFragment.CHILD_ACCOUNT_STATUS)); - assertEquals(4, bundle.size()); + assertEquals(3, bundle.size()); } @Test @@ -288,11 +246,10 @@ assertFalse(mSequencer.calledSetFirstRunFlowSignInComplete); final Bundle bundle = mSequencer.returnedBundle; assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_SYNC_CONSENT_PAGE)); - assertTrue(bundle.getBoolean(FirstRunActivityBase.SHOW_DATA_REDUCTION_PAGE)); assertFalse(bundle.getBoolean(FirstRunActivityBase.SHOW_SEARCH_ENGINE_PAGE)); assertEquals(ChildAccountStatus.NOT_CHILD, bundle.getInt(SyncConsentFirstRunFragment.CHILD_ACCOUNT_STATUS)); - assertEquals(4, bundle.size()); + assertEquals(3, bundle.size()); } private void verifyNumberOfAccountsRecorded(int numberOfAccounts) {
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2UnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2UnitTest.java index 52c0d34..49dc5db 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2UnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/indicator/OfflineIndicatorControllerV2UnitTest.java
@@ -16,8 +16,8 @@ import static org.chromium.chrome.browser.offlinepages.indicator.OfflineIndicatorControllerV2.STATUS_INDICATOR_WAIT_BEFORE_HIDE_DURATION_MS; import static org.chromium.chrome.browser.offlinepages.indicator.OfflineIndicatorControllerV2.setMockElapsedTimeSupplier; +import android.app.Activity; import android.content.Context; -import android.content.res.Resources; import android.os.Handler; import org.junit.After; @@ -27,6 +27,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.robolectric.Robolectric; import org.robolectric.annotation.Config; import org.chromium.base.TimeUtils; @@ -46,10 +47,6 @@ @Config(manifest = Config.NONE) public class OfflineIndicatorControllerV2UnitTest { @Mock - private Context mContext; - @Mock - private Resources mResources; - @Mock private StatusIndicatorCoordinator mStatusIndicator; @Mock private ConnectivityDetector mConnectivityDetector; @@ -64,22 +61,23 @@ @Mock private OfflineIndicatorMetricsDelegate mMetricsDelegate; + private Context mContext; private ObservableSupplierImpl<Boolean> mIsUrlBarFocusedSupplier = new ObservableSupplierImpl<>(); private OfflineIndicatorControllerV2 mController; private long mElapsedTimeMs; + private String mOfflineString; + private String mOnlineString; @Before public void setUp() { MockitoAnnotations.initMocks(this); + mContext = Robolectric.buildActivity(Activity.class).get(); + mContext.setTheme(org.chromium.chrome.tab_ui.R.style.Theme_BrowserUI_DayNight); - when(mContext.getResources()).thenReturn(mResources); - when(mContext.getTheme()).thenReturn(null); - when(mContext.getString(R.string.offline_indicator_v2_offline_text)).thenReturn("Offline"); - when(mContext.getString(R.string.offline_indicator_v2_back_online_text)) - .thenReturn("Online"); - when(mContext.getDrawable(anyInt())).thenReturn(null); - when(mResources.getColor(anyInt(), any())).thenReturn(0); + mOfflineString = mContext.getString(R.string.offline_indicator_v2_offline_text); + mOnlineString = mContext.getString(R.string.offline_indicator_v2_back_online_text); + when(mCanAnimateNativeBrowserControls.get()).thenReturn(true); TimeUtilsJni.TEST_HOOKS.setInstanceForTesting(mTimeUtils); when(mTimeUtils.getTimeTicksNowUs()).thenReturn(0L); @@ -109,7 +107,7 @@ public void testShowsStatusIndicatorWhenOffline() { // Show. changeConnectionState(true); - verify(mStatusIndicator).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator).show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); } /** @@ -127,7 +125,7 @@ // after that. First, verify the #updateContent() call. final ArgumentCaptor<Runnable> endAnimationCaptor = ArgumentCaptor.forClass(Runnable.class); verify(mStatusIndicator) - .updateContent(eq("Online"), any(), anyInt(), anyInt(), anyInt(), + .updateContent(eq(mOnlineString), any(), anyInt(), anyInt(), anyInt(), endAnimationCaptor.capture()); // Simulate browser controls animation ending. endAnimationCaptor.getValue().run(); @@ -164,8 +162,8 @@ captor.getValue().run(); // #updateContent() should be called since the cool-down is complete. verify(mStatusIndicator) - .updateContent( - eq("Online"), any(), anyInt(), anyInt(), anyInt(), any(Runnable.class)); + .updateContent(eq(mOnlineString), any(), anyInt(), anyInt(), anyInt(), + any(Runnable.class)); } /** @@ -175,7 +173,8 @@ public void testCoolDown_Show() { // First, show. changeConnectionState(true); - verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, times(1)) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); // Advance time so we can hide. advanceTimeByMs(STATUS_INDICATOR_COOLDOWN_BEFORE_NEXT_ACTION_MS); // Now, hide. @@ -186,7 +185,8 @@ changeConnectionState(true); // Cool-down should prevent it from showing and post a runnable for after the time is up. // times(1) because it's been already called once above, no new calls. - verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, times(1)) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); final ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); verify(mHandler).postDelayed( captor.capture(), eq(STATUS_INDICATOR_COOLDOWN_BEFORE_NEXT_ACTION_MS - 1000L)); @@ -195,7 +195,8 @@ advanceTimeByMs(4000); captor.getValue().run(); // #show() should be called since the cool-down is complete. - verify(mStatusIndicator, times(2)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, times(2)) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); } /** @@ -213,7 +214,8 @@ changeConnectionState(true); // Cool-down should prevent it from showing and post a runnable for after the time is up. // times(1) because it's been already called once above, no new calls. - verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, times(1)) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); final ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); verify(mHandler).postDelayed( captor.capture(), eq(STATUS_INDICATOR_COOLDOWN_BEFORE_NEXT_ACTION_MS - 1000L)); @@ -228,7 +230,8 @@ advanceTimeByMs(2000); captor.getValue().run(); // Still times(1), no new call after the last one. - verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, times(1)) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); } /** @@ -241,11 +244,12 @@ // Now show, at least try. changeConnectionState(true); // Shouldn't show because the omnibox is focused. - verify(mStatusIndicator, never()).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, never()) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); // Should show once unfocused. mIsUrlBarFocusedSupplier.set(false); - verify(mStatusIndicator).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator).show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); } /** @@ -259,13 +263,15 @@ // Now show, at least try. changeConnectionState(true); // Shouldn't show because the omnibox is focused. - verify(mStatusIndicator, never()).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, never()) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); // Now, simulate going back online. changeConnectionState(false); // Unfocusing shouldn't cause a show because we're not offline. mIsUrlBarFocusedSupplier.set(false); - verify(mStatusIndicator, never()).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, never()) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); } /** @@ -282,7 +288,8 @@ advanceTimeByMs(1000); changeConnectionState(true); // times(1) because it's been already called once above, no new calls. - verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, times(1)) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); final ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); verify(mHandler).postDelayed( captor.capture(), eq(STATUS_INDICATOR_COOLDOWN_BEFORE_NEXT_ACTION_MS - 1000L)); @@ -293,10 +300,12 @@ advanceTimeByMs(4000); captor.getValue().run(); // Still times(1), no new calls. The indicator shouldn't show since the omnibox is focused. - verify(mStatusIndicator, times(1)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, times(1)) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); // Should show once unfocused. mIsUrlBarFocusedSupplier.set(false); - verify(mStatusIndicator, times(2)).show(eq("Offline"), any(), anyInt(), anyInt(), anyInt()); + verify(mStatusIndicator, times(2)) + .show(eq(mOfflineString), any(), anyInt(), anyInt(), anyInt()); } /**
diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn index 13141ad..062e671 100644 --- a/chrome/app/BUILD.gn +++ b/chrome/app/BUILD.gn
@@ -10,6 +10,7 @@ import("//chromeos/components/chromebox_for_meetings/buildflags/buildflags.gni") import("//components/gwp_asan/buildflags/buildflags.gni") import("//components/nacl/features.gni") +import("//crypto/features.gni") import("//ppapi/buildflags/buildflags.gni") import("//tools/grit/grit_rule.gni") import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 94ccd66..3f26e07 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -6002,12 +6002,21 @@ <message name="IDS_NTP_MODULES_CUSTOMIZE_BUTTON_TEXT" desc="Text shown on the customize button of an NTP module."> Customize cards </message> - <message name="IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_AGO" desc="Text shown in a tag on a stateful task module item indicating when an item was viewed."> - Viewed <ph name="RELATIVE_TIME">$1<ex>5 days ago</ex></ph> - </message> <message name="IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_TODAY" desc="Text shown in a tag on a stateful task module item indicating when an item was viewed."> Viewed today </message> + <message name="IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_YESTERDAY" desc="Text shown in a tag on a stateful task module item indicating when an item was viewed."> + Viewed yesterday + </message> + <message name="IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_WEEK" desc="Text shown in a tag on a stateful task module item indicating when an item was viewed."> + Viewed in the past week + </message> + <message name="IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_MONTH" desc="Text shown in a tag on a stateful task module item indicating when an item was viewed."> + Viewed in the past month + </message> + <message name="IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PREVIOUSLY" desc="Text shown in a tag on a stateful task module item indicating when an item was viewed."> + Viewed previously + </message> <message name="IDS_NTP_MODULES_SHOPPING_TASKS_SENTENCE" desc="Name of the shopping tasks module in sentence case shown in various UIs."> Shopping suggestions </message>
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_AGO.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_AGO.png.sha1 deleted file mode 100644 index a7e1aa37..0000000 --- a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_AGO.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -1edfdc2b2be200a89e16535208c8e741ee3b8b2b \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_MONTH.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_MONTH.png.sha1 new file mode 100644 index 0000000..4d9f846c --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_MONTH.png.sha1
@@ -0,0 +1 @@ +e7fbe12341d6cdc7a191d60eb0d05d131d5fb93b \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_WEEK.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_WEEK.png.sha1 new file mode 100644 index 0000000..b577b5f --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_WEEK.png.sha1
@@ -0,0 +1 @@ +cb8678dfe884f30f81fbcebe74b85d5c17267c43 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PREVIOUSLY.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PREVIOUSLY.png.sha1 new file mode 100644 index 0000000..1b91791 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PREVIOUSLY.png.sha1
@@ -0,0 +1 @@ +616efef52602035824ef269a4e1c41879ff84546 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_YESTERDAY.png.sha1 b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_YESTERDAY.png.sha1 new file mode 100644 index 0000000..3a2e1ffe --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_YESTERDAY.png.sha1
@@ -0,0 +1 @@ +177bb5a97587305fb26705699f0fddd0fe259dc0 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index ee5597c..4e6738e 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -8,7 +8,6 @@ import("//build/config/chrome_build.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/compiler/pgo/pgo.gni") -import("//build/config/crypto.gni") import("//build/config/features.gni") import("//build/config/linux/gtk/gtk.gni") import("//build/config/python.gni") @@ -26,6 +25,7 @@ import("//components/os_crypt/features.gni") import("//components/signin/features.gni") import("//components/spellcheck/spellcheck_build_features.gni") +import("//crypto/features.gni") import("//device/vr/buildflags/buildflags.gni") import("//extensions/buildflags/buildflags.gni") import("//media/gpu/args.gni") @@ -3042,8 +3042,6 @@ "content_settings/request_desktop_site_web_contents_observer_android.h", "crash_upload_list/crash_upload_list_android.cc", "crash_upload_list/crash_upload_list_android.h", - "data_reduction_proxy/data_reduction_promo_infobar_delegate_android.cc", - "data_reduction_proxy/data_reduction_promo_infobar_delegate_android.h", "data_reduction_proxy/data_reduction_proxy_settings_android.cc", "data_reduction_proxy/data_reduction_proxy_settings_android.h", "device_reauth/android/biometric_authenticator_android.cc", @@ -4019,6 +4017,8 @@ "new_tab_page/modules/task_module/task_module_service.h", "new_tab_page/modules/task_module/task_module_service_factory.cc", "new_tab_page/modules/task_module/task_module_service_factory.h", + "new_tab_page/modules/task_module/time_format_util.cc", + "new_tab_page/modules/task_module/time_format_util.h", "new_tab_page/one_google_bar/one_google_bar_data.cc", "new_tab_page/one_google_bar/one_google_bar_data.h", "new_tab_page/one_google_bar/one_google_bar_loader.h", @@ -5280,6 +5280,8 @@ "apps/intent_helper/chromeos_intent_picker_helpers.h", "apps/intent_helper/metrics/intent_handling_metrics.cc", "apps/intent_helper/metrics/intent_handling_metrics.h", + "chromeos/arc/open_with_menu.cc", + "chromeos/arc/open_with_menu.h", "download/notification/download_item_notification.cc", "download/notification/download_item_notification.h", "download/notification/download_notification_manager.cc", @@ -5308,6 +5310,7 @@ "//chromeos/crosapi/mojom", "//chromeos/dbus/constants", "//chromeos/ui/wm", + "//components/arc/common", ] allow_circular_includes_from += [ "//chrome/browser/policy:onc" ] }
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index da01337..8c91d3c 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -86,7 +86,6 @@ #include "components/component_updater/component_updater_switches.h" #include "components/content_settings/core/common/features.h" #include "components/contextual_search/core/browser/public.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/dom_distiller/core/dom_distiller_features.h" #include "components/dom_distiller/core/dom_distiller_switches.h"
diff --git a/chrome/browser/apps/app_service/publishers/arc_apps.cc b/chrome/browser/apps/app_service/publishers/arc_apps.cc index 19f9acc..e514fd36 100644 --- a/chrome/browser/apps/app_service/publishers/arc_apps.cc +++ b/chrome/browser/apps/app_service/publishers/arc_apps.cc
@@ -51,6 +51,7 @@ #include "components/services/app_service/public/cpp/icon_types.h" #include "components/services/app_service/public/cpp/intent_filter_util.h" #include "components/services/app_service/public/cpp/intent_util.h" +#include "components/services/app_service/public/cpp/permission.h" #include "components/services/app_service/public/cpp/permission_utils.h" #include "components/services/app_service/public/cpp/types_util.h" #include "extensions/grit/extensions_browser_resources.h" @@ -118,6 +119,7 @@ UpdateIconImage(std::move(callback), std::move(iv)); } +// TODO(crbug.com/1253250): Remove and use GetPermissionType apps::mojom::PermissionType GetAppServicePermissionType( arc::mojom::AppPermission arc_permission_type) { switch (arc_permission_type) { @@ -136,6 +138,24 @@ } } +apps::PermissionType GetPermissionType( + arc::mojom::AppPermission arc_permission_type) { + switch (arc_permission_type) { + case arc::mojom::AppPermission::CAMERA: + return apps::PermissionType::kCamera; + case arc::mojom::AppPermission::LOCATION: + return apps::PermissionType::kLocation; + case arc::mojom::AppPermission::MICROPHONE: + return apps::PermissionType::kMicrophone; + case arc::mojom::AppPermission::NOTIFICATIONS: + return apps::PermissionType::kNotifications; + case arc::mojom::AppPermission::CONTACTS: + return apps::PermissionType::kContacts; + case arc::mojom::AppPermission::STORAGE: + return apps::PermissionType::kStorage; + } +} + bool GetArcPermissionType( apps::mojom::PermissionType app_service_permission_type, arc::mojom::AppPermission& arc_permission) { @@ -164,6 +184,7 @@ } } +// TODO(crbug.com/1253250): Remove and use CreatePermissions void UpdateAppPermissions( const base::flat_map<arc::mojom::AppPermission, arc::mojom::PermissionStatePtr>& new_permissions, @@ -180,6 +201,19 @@ } } +apps::Permissions CreatePermissions( + const base::flat_map<arc::mojom::AppPermission, + arc::mojom::PermissionStatePtr>& new_permissions) { + apps::Permissions permissions; + for (const auto& new_permission : new_permissions) { + permissions.push_back(std::make_unique<apps::Permission>( + GetPermissionType(new_permission.first), + std::make_unique<apps::PermissionValue>(new_permission.second->granted), + new_permission.second->managed)); + } + return permissions; +} + absl::optional<arc::UserInteractionType> GetUserInterationType( apps::mojom::LaunchSource launch_source) { auto user_interaction_type = arc::UserInteractionType::NOT_USER_INITIATED; @@ -1503,6 +1537,12 @@ app->last_launch_time = app_info.last_launch_time; app->install_time = app_info.install_time; + std::unique_ptr<ArcAppListPrefs::PackageInfo> package = + prefs->GetPackage(app_info.package_name); + if (package) { + app->permissions = CreatePermissions(package->permissions); + } + // TODO(crbug.com/1253250): Add other fields for the App struct. return app; }
diff --git a/chrome/browser/apps/app_service/publishers/borealis_apps.cc b/chrome/browser/apps/app_service/publishers/borealis_apps.cc index ee120a4..f607a9c 100644 --- a/chrome/browser/apps/app_service/publishers/borealis_apps.cc +++ b/chrome/browser/apps/app_service/publishers/borealis_apps.cc
@@ -25,6 +25,7 @@ #include "chrome/grit/generated_resources.h" #include "components/prefs/pref_service.h" #include "components/services/app_service/public/cpp/app_types.h" +#include "components/services/app_service/public/cpp/permission.h" #include "components/services/app_service/public/cpp/permission_utils.h" #include "components/services/app_service/public/cpp/publisher_base.h" #include "ui/base/l10n/l10n_util.h" @@ -106,6 +107,7 @@ return app; } +// TODO(crbug.com/1253250): Remove and use CreatePermissions. void PopulatePermissions(apps::mojom::App* app, Profile* profile) { for (const PermissionInfo& info : permission_infos) { auto permission = apps::mojom::Permission::New(); @@ -118,6 +120,18 @@ } } +apps::Permissions CreatePermissions(Profile* profile) { + apps::Permissions permissions; + for (const PermissionInfo& info : permission_infos) { + permissions.push_back(std::make_unique<apps::Permission>( + apps::ConvertMojomPermissionTypeToPermissionType(info.permission), + std::make_unique<apps::PermissionValue>( + profile->GetPrefs()->GetBoolean(info.pref_name)), + /*is_managed=*/false)); + } + return permissions; +} + bool IsBorealisLauncherAllowed(Profile* profile) { return borealis::BorealisService::GetForProfile(profile) ->Features() @@ -188,6 +202,10 @@ app->last_launch_time = registration.LastLaunchTime(); app->install_time = registration.InstallTime(); + if (registration.app_id() == borealis::kClientAppId) { + app->permissions = CreatePermissions(profile_); + } + // TODO(crbug.com/1253250): Add other fields for the App struct. return app; }
diff --git a/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc b/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc index 5dc4810..925f62f 100644 --- a/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc +++ b/chrome/browser/apps/app_service/publishers/plugin_vm_apps.cc
@@ -26,6 +26,7 @@ #include "chrome/grit/chrome_unscaled_resources.h" #include "chrome/grit/generated_resources.h" #include "components/prefs/pref_service.h" +#include "components/services/app_service/public/cpp/permission.h" #include "components/services/app_service/public/cpp/permission_utils.h" #include "components/services/app_service/public/mojom/types.mojom.h" #include "ui/base/l10n/l10n_util.h" @@ -79,6 +80,7 @@ : apps::mojom::OptionalBool::kFalse; } +// TODO(crbug.com/1253250): Remove and use CreatePermissions. void PopulatePermissions(apps::mojom::App* app, Profile* profile) { for (const PermissionInfo& info : permission_infos) { auto permission = apps::mojom::Permission::New(); @@ -91,6 +93,18 @@ } } +apps::Permissions CreatePermissions(Profile* profile) { + apps::Permissions permissions; + for (const PermissionInfo& info : permission_infos) { + permissions.push_back(std::make_unique<apps::Permission>( + apps::ConvertMojomPermissionTypeToPermissionType(info.permission), + std::make_unique<apps::PermissionValue>( + profile->GetPrefs()->GetBoolean(info.pref_name)), + /*is_managed=*/false)); + } + return permissions; +} + std::unique_ptr<apps::App> CreatePluginVmApp(Profile* profile, bool allowed) { std::unique_ptr<apps::App> app = apps::AppPublisher::MakeApp( apps::AppType::kPluginVm, plugin_vm::kPluginVmShelfAppId, @@ -102,6 +116,8 @@ apps::IconKey(apps::IconKey::kDoesNotChangeOverTime, IDR_LOGO_PLUGIN_VM_DEFAULT_192, apps::IconEffects::kNone); + app->permissions = CreatePermissions(profile); + // TODO(crbug.com/1253250): Add other fields for the App struct. return app; } @@ -429,11 +445,16 @@ } void PluginVmApps::OnPermissionChanged() { - apps::mojom::AppPtr app = apps::mojom::App::New(); - app->app_type = apps::mojom::AppType::kPluginVm; - app->app_id = plugin_vm::kPluginVmShelfAppId; - PopulatePermissions(app.get(), profile_); - PublisherBase::Publish(std::move(app), subscribers_); + apps::mojom::AppPtr mojom_app = apps::mojom::App::New(); + mojom_app->app_type = apps::mojom::AppType::kPluginVm; + mojom_app->app_id = plugin_vm::kPluginVmShelfAppId; + PopulatePermissions(mojom_app.get(), profile_); + PublisherBase::Publish(std::move(mojom_app), subscribers_); + + std::unique_ptr<App> app = + std::make_unique<App>(AppType::kPluginVm, plugin_vm::kPluginVmShelfAppId); + app->permissions = CreatePermissions(profile_); + AppPublisher::Publish(std::move(app)); } } // namespace apps
diff --git a/chrome/browser/apps/app_service/publishers/publisher_unittest.cc b/chrome/browser/apps/app_service/publishers/publisher_unittest.cc index 9ec6a5c..07c2212 100644 --- a/chrome/browser/apps/app_service/publishers/publisher_unittest.cc +++ b/chrome/browser/apps/app_service/publishers/publisher_unittest.cc
@@ -23,7 +23,9 @@ #include "components/account_id/account_id.h" #include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/icon_types.h" +#include "components/services/app_service/public/cpp/permission.h" #include "components/services/app_service/public/cpp/publisher_base.h" +#include "components/services/app_service/public/mojom/types.mojom.h" #include "ui/base/l10n/l10n_util.h" #if BUILDFLAG(IS_CHROMEOS_ASH) @@ -68,6 +70,28 @@ #endif // BUILDFLAG(IS_CHROMEOS_LACROS) #if BUILDFLAG(IS_CHROMEOS_ASH) +void AddArcPackage(ArcAppTest& arc_test, + std::vector<arc::mojom::AppInfo>& fake_apps) { + for (const auto& fake_app : fake_apps) { + base::flat_map<arc::mojom::AppPermission, arc::mojom::PermissionStatePtr> + permissions; + permissions.emplace(arc::mojom::AppPermission::CAMERA, + arc::mojom::PermissionState::New(/*granted=*/false, + /*managed=*/false)); + permissions.emplace(arc::mojom::AppPermission::LOCATION, + arc::mojom::PermissionState::New(/*granted=*/true, + /*managed=*/false)); + arc::mojom::ArcPackageInfoPtr package = arc::mojom::ArcPackageInfo::New( + fake_app.package_name, /*package_version=*/1, + /*last_backup_android_id=*/1, + /*last_backup_time=*/1, /*sync=*/true, /*system=*/false, + /*vpn_provider=*/false, /*web_app_info=*/nullptr, absl::nullopt, + std::move(permissions)); + arc_test.AddPackage(package->Clone()); + arc_test.app_instance()->SendPackageAdded(package->Clone()); + } +} + apps::mojom::AppPtr MakeMojomApp(apps::mojom::AppType app_type, const std::string& app_id, const std::string& name, @@ -81,8 +105,47 @@ /*icon_effects=*/0); return app; } + +// TODO(crbug.com/1253250): Will be removed when AppService Lacros mojom is +// migrated to non-mojom App struct. +apps::mojom::PermissionPtr MakeFakeMojomPermission( + apps::mojom::PermissionType permission_type, + bool bool_value) { + auto permission = apps::mojom::Permission::New(); + permission->permission_type = permission_type; + permission->value = apps::mojom::PermissionValue::New(); + permission->value->set_bool_value(bool_value); + permission->is_managed = false; + return permission; +} + +apps::Permissions MakeFakePermissions() { + apps::Permissions permissions; + permissions.push_back(std::make_unique<apps::Permission>( + apps::PermissionType::kCamera, + std::make_unique<apps::PermissionValue>(false), + /*is_managed*/ false)); + permissions.push_back(std::make_unique<apps::Permission>( + apps::PermissionType::kLocation, + std::make_unique<apps::PermissionValue>(true), + /*is_managed*/ false)); + return permissions; +} #endif // BUILDFLAG(IS_CHROMEOS_ASH) +bool IsEqual(const apps::Permissions& source, const apps::Permissions& target) { + if (source.size() != target.size()) { + return false; + } + + for (int i = 0; i < static_cast<int>(source.size()); i++) { + if (*source[i] != *target[i]) { + return false; + } + } + return true; +} + } // namespace namespace apps { @@ -148,7 +211,8 @@ InstallSource install_source, const std::vector<std::string>& additional_search_terms, base::Time last_launch_time, - base::Time install_time) { + base::Time install_time, + const apps::Permissions& permissions) { AppRegistryCache& cache = AppServiceProxyFactory::GetForProfile(profile())->AppRegistryCache(); @@ -168,6 +232,9 @@ if (!install_time.is_null()) { EXPECT_EQ(install_time, cache.states_[app_id]->install_time); } + if (!permissions.empty()) { + EXPECT_TRUE(IsEqual(permissions, cache.states_[app_id]->permissions)); + } } void VerifyAppIsRemoved(const std::string& app_id) { @@ -190,6 +257,7 @@ // Install fake apps. std::vector<arc::mojom::AppInfo> fake_apps = arc_test.fake_apps(); arc_test.app_instance()->SendRefreshAppList(fake_apps); + AddArcPackage(arc_test, fake_apps); // Verify ARC apps are added to AppRegistryCache. ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile()); @@ -201,7 +269,8 @@ AppType::kArc, app_id, app_info->name, Readiness::kReady, app_info->sticky ? InstallReason::kSystem : InstallReason::kUser, app_info->sticky ? InstallSource::kSystem : InstallSource::kPlayStore, - {}, app_info->last_launch_time, app_info->install_time); + {}, app_info->last_launch_time, app_info->install_time, + apps::Permissions()); // Simulate the app is removed. RemoveArcApp(app_id); @@ -222,7 +291,8 @@ AppType::kArc, app_id, app_info->name, Readiness::kReady, app_info->sticky ? InstallReason::kSystem : InstallReason::kUser, app_info->sticky ? InstallSource::kSystem : InstallSource::kPlayStore, - {}, app_info->last_launch_time, app_info->install_time); + {}, app_info->last_launch_time, app_info->install_time, + MakeFakePermissions()); // Test OnAppLastLaunchTimeUpdated. const base::Time before_time = base::Time::Now(); @@ -233,7 +303,8 @@ AppType::kArc, app_id, app_info->name, Readiness::kReady, app_info->sticky ? InstallReason::kSystem : InstallReason::kUser, app_info->sticky ? InstallSource::kSystem : InstallSource::kPlayStore, - {}, app_info->last_launch_time, app_info->install_time); + {}, app_info->last_launch_time, app_info->install_time, + MakeFakePermissions()); } } @@ -256,7 +327,8 @@ VerifyApp(AppType::kBuiltIn, internal_app.app_id, l10n_util::GetStringUTF8(internal_app.name_string_resource_id), Readiness::kReady, InstallReason::kSystem, InstallSource::kSystem, - additional_search_terms, base::Time(), base::Time()); + additional_search_terms, base::Time(), base::Time(), + apps::Permissions()); } } @@ -310,6 +382,10 @@ app->additional_search_terms.push_back("TestApp"); app->last_launch_time = kLastLaunchTime; app->install_time = kInstallTime; + app->permissions.push_back(MakeFakeMojomPermission( + apps::mojom::PermissionType::kCamera, /*bool_value=*/false)); + app->permissions.push_back(MakeFakeMojomPermission( + apps::mojom::PermissionType::kLocation, /*bool_value=*/true)); apps.push_back(std::move(app)); web_apps_crosapi->OnApps(std::move(apps)); } @@ -322,21 +398,21 @@ TEST_F(StandaloneBrowserPublisherTest, StandaloneBrowserAppsOnApps) { VerifyApp(AppType::kStandaloneBrowser, extension_misc::kLacrosAppId, "Lacros", Readiness::kReady, InstallReason::kSystem, InstallSource::kSystem, - {"chrome"}, base::Time(), base::Time()); + {"chrome"}, base::Time(), base::Time(), apps::Permissions()); } TEST_F(StandaloneBrowserPublisherTest, StandaloneBrowserExtensionAppsOnApps) { ExtensionAppsOnApps(); VerifyApp(AppType::kStandaloneBrowserChromeApp, "a", "TestApp", Readiness::kReady, InstallReason::kUser, InstallSource::kSync, {}, - base::Time(), base::Time()); + base::Time(), base::Time(), apps::Permissions()); } TEST_F(StandaloneBrowserPublisherTest, WebAppsCrosapiOnApps) { WebAppsCrosapiOnApps(); VerifyApp(AppType::kWeb, "a", "TestApp", Readiness::kReady, InstallReason::kUser, InstallSource::kSync, {"TestApp"}, - kLastLaunchTime, kInstallTime); + kLastLaunchTime, kInstallTime, MakeFakePermissions()); } #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -353,27 +429,28 @@ app_service_test.SetUp(profile()); VerifyApp(AppType::kChromeApp, store->id(), store->name(), Readiness::kReady, InstallReason::kDefault, InstallSource::kChromeWebStore, {}, - base::Time(), base::Time()); + base::Time(), base::Time(), apps::Permissions()); // Uninstall the Chrome app. service_->UninstallExtension( store->id(), extensions::UNINSTALL_REASON_FOR_TESTING, nullptr); VerifyApp(AppType::kChromeApp, store->id(), store->name(), Readiness::kUninstalledByUser, InstallReason::kDefault, - InstallSource::kChromeWebStore, {}, base::Time(), base::Time()); + InstallSource::kChromeWebStore, {}, base::Time(), base::Time(), + apps::Permissions()); // Reinstall the Chrome app. service_->AddExtension(store.get()); VerifyApp(AppType::kChromeApp, store->id(), store->name(), Readiness::kReady, InstallReason::kDefault, InstallSource::kChromeWebStore, {}, - base::Time(), base::Time()); + base::Time(), base::Time(), apps::Permissions()); // Test OnExtensionLastLaunchTimeChanged. extensions::ExtensionPrefs::Get(profile())->SetLastLaunchTime( store->id(), kLastLaunchTime); VerifyApp(AppType::kChromeApp, store->id(), store->name(), Readiness::kReady, InstallReason::kDefault, InstallSource::kChromeWebStore, {}, - kLastLaunchTime, base::Time()); + kLastLaunchTime, base::Time(), apps::Permissions()); } TEST_F(PublisherTest, WebAppsOnApps) { @@ -384,7 +461,7 @@ VerifyApp(AppType::kWeb, app_id, kAppName, Readiness::kReady, InstallReason::kSync, InstallSource::kBrowser, {}, base::Time(), - base::Time()); + base::Time(), apps::Permissions()); } #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/chrome/browser/ash/app_mode/startup_app_launcher.cc b/chrome/browser/ash/app_mode/startup_app_launcher.cc index ba9c71e4..a48f226d 100644 --- a/chrome/browser/ash/app_mode/startup_app_launcher.cc +++ b/chrome/browser/ash/app_mode/startup_app_launcher.cc
@@ -15,9 +15,6 @@ #include "base/time/time.h" #include "base/values.h" #include "chrome/browser/apps/app_service/app_launch_params.h" -#include "chrome/browser/apps/app_service/app_service_proxy.h" -#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" -#include "chrome/browser/apps/app_service/browser_app_launcher.h" #include "chrome/browser/ash/app_mode/chrome_app_kiosk_app_installer.h" #include "chrome/browser/ash/app_mode/kiosk_app_launch_error.h" #include "chrome/browser/ash/app_mode/kiosk_app_manager.h" @@ -27,6 +24,7 @@ #include "chrome/browser/extensions/install_tracker_factory.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/common/chrome_switches.h" #include "components/crx_file/id_util.h" #include "extensions/browser/app_window/app_window.h" @@ -196,9 +194,9 @@ SYSLOG(INFO) << "Attempt to launch app."; // Always open the app in a window. - apps::AppServiceProxyFactory::GetForProfile(profile_) - ->BrowserAppLauncher() - ->LaunchAppWithParams(apps::AppLaunchParams( + ::OpenApplication( + profile_, + apps::AppLaunchParams( extension->id(), apps::mojom::LaunchContainer::kLaunchContainerWindow, WindowOpenDisposition::NEW_WINDOW, apps::mojom::LaunchSource::kFromKiosk));
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action.cc b/chrome/browser/ash/arc/input_overlay/actions/action.cc index de20dd7..9732f83 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action.cc +++ b/chrome/browser/ash/arc/input_overlay/actions/action.cc
@@ -78,9 +78,7 @@ << ui::KeycodeConverter::DomKeyToKeyString(key_event.GetDomKey()) << "}. DomCode{" << ui::KeycodeConverter::DomCodeToCodeString(key_event.code()) - << "}. Type{" << key_event.type() << "}. Flags {" - << key_event.flags() << "}. Time stamp {" << key_event.time_stamp() - << "}."; + << "}. Type{" << key_event.type() << "}. " << key_event.ToString(); } else if (event.IsTouchEvent()) { const ui::TouchEvent& touch_event = static_cast<const ui::TouchEvent&>(event); @@ -107,6 +105,12 @@ auto lower = base::ToLowerASCII(dom_code_string); if (lower == "escape") return "esc"; + if (lower == "shiftleft" || lower == "shiftright") + return "shift"; + if (lower == "controlleft" || lower == "controlright") + return "ctrl"; + if (lower == "altleft" || lower == "altright") + return "alt"; // TODO(cuicuiruan): adjust more display text according to UX design // requirement. return lower;
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action.h b/chrome/browser/ash/arc/input_overlay/actions/action.h index 742fbe5..0a56488 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action.h +++ b/chrome/browser/ash/arc/input_overlay/actions/action.h
@@ -56,7 +56,8 @@ virtual bool RewriteEvent(const ui::Event& origin, const gfx::RectF& content_bounds, const bool is_mouse_locked, - std::list<ui::TouchEvent>& touch_events) = 0; + std::list<ui::TouchEvent>& touch_events, + bool& keep_original_event) = 0; // Get the UI location in the content view. virtual gfx::PointF GetUIPosition(const gfx::RectF& content_bounds) = 0; virtual std::unique_ptr<ActionLabel> CreateView(
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action_move_key.cc b/chrome/browser/ash/arc/input_overlay/actions/action_move_key.cc index 5fa59244..fda29bd 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action_move_key.cc +++ b/chrome/browser/ash/arc/input_overlay/actions/action_move_key.cc
@@ -82,7 +82,8 @@ bool ActionMoveKey::RewriteEvent(const ui::Event& origin, const gfx::RectF& content_bounds, const bool is_mouse_locked, - std::list<ui::TouchEvent>& touch_events) { + std::list<ui::TouchEvent>& touch_events, + bool& keep_original_event) { if (!origin.IsKeyEvent()) return false; LogEvent(origin);
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action_move_key.h b/chrome/browser/ash/arc/input_overlay/actions/action_move_key.h index 0396e259..cbe7684 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action_move_key.h +++ b/chrome/browser/ash/arc/input_overlay/actions/action_move_key.h
@@ -40,7 +40,8 @@ bool RewriteEvent(const ui::Event& origin, const gfx::RectF& content_bounds, const bool is_mouse_locked, - std::list<ui::TouchEvent>& touch_events) override; + std::list<ui::TouchEvent>& touch_events, + bool& keep_original_event) override; gfx::PointF GetUIPosition(const gfx::RectF& content_bounds) override; std::unique_ptr<ActionLabel> CreateView( const gfx::RectF& content_bounds) override;
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action_move_mouse.cc b/chrome/browser/ash/arc/input_overlay/actions/action_move_mouse.cc index 3e2f249..a300b24f 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action_move_mouse.cc +++ b/chrome/browser/ash/arc/input_overlay/actions/action_move_mouse.cc
@@ -105,7 +105,8 @@ bool ActionMoveMouse::RewriteEvent(const ui::Event& origin, const gfx::RectF& content_bounds, const bool is_mouse_locked, - std::list<ui::TouchEvent>& touch_events) { + std::list<ui::TouchEvent>& touch_events, + bool& keep_original_event) { if (!origin.IsMouseEvent() || !is_mouse_locked) return false;
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action_move_mouse.h b/chrome/browser/ash/arc/input_overlay/actions/action_move_mouse.h index 60c413cf..480b8f1 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action_move_mouse.h +++ b/chrome/browser/ash/arc/input_overlay/actions/action_move_mouse.h
@@ -58,7 +58,8 @@ bool RewriteEvent(const ui::Event& origin, const gfx::RectF& content_bounds, const bool is_mouse_locked, - std::list<ui::TouchEvent>& touch_events) override; + std::list<ui::TouchEvent>& touch_events, + bool& keep_original_event) override; gfx::PointF GetUIPosition(const gfx::RectF& content_bounds) override; std::unique_ptr<ActionLabel> CreateView( const gfx::RectF& content_bounds) override;
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action_tap_key.cc b/chrome/browser/ash/arc/input_overlay/actions/action_tap_key.cc index 37c0e514..4112bf9 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action_tap_key.cc +++ b/chrome/browser/ash/arc/input_overlay/actions/action_tap_key.cc
@@ -14,6 +14,31 @@ namespace arc { namespace input_overlay { +namespace { + +bool IsAlt(ui::DomCode code) { + return code == ui::DomCode::ALT_LEFT || code == ui::DomCode::ALT_RIGHT; +} + +bool IsCtrl(ui::DomCode code) { + return code == ui::DomCode::CONTROL_LEFT || + code == ui::DomCode::CONTROL_RIGHT; +} + +bool IsShift(ui::DomCode code) { + return code == ui::DomCode::SHIFT_LEFT || code == ui::DomCode::SHIFT_RIGHT; +} + +bool IsSameKeyCode(ui::DomCode a, ui::DomCode b) { + return a == b || (IsAlt(a) && IsAlt(b)) || (IsCtrl(a) && IsCtrl(b)) || + (IsShift(a) && IsShift(b)); +} + +bool IsModifier(ui::DomCode code) { + return IsAlt(code) || IsCtrl(code) || IsShift(code); +} + +} // namespace ActionTapKey::ActionTapKey(aura::Window* window) : Action(window) {} @@ -32,27 +57,32 @@ return false; } key_ = key->first; + if (IsModifier(key_)) { + is_modifier_key_ = true; + } return true; } bool ActionTapKey::RewriteEvent(const ui::Event& origin, const gfx::RectF& content_bounds, const bool is_mouse_locked, - std::list<ui::TouchEvent>& touch_events) { + std::list<ui::TouchEvent>& touch_events, + bool& keep_original_event) { if (!origin.IsKeyEvent()) return false; LogEvent(origin); const ui::KeyEvent& key_event = static_cast<const ui::KeyEvent&>(origin); - bool rewritten = RewriteKeyEvent(key_event, touch_events, content_bounds); + bool rewritten = RewriteKeyEvent(key_event, touch_events, content_bounds, + keep_original_event); LogTouchEvents(touch_events); return rewritten; } bool ActionTapKey::RewriteKeyEvent(const ui::KeyEvent& key_event, std::list<ui::TouchEvent>& rewritten_events, - const gfx::RectF& content_bounds) { - if (key_event.source_device_id() == ui::ED_UNKNOWN_DEVICE || - key_event.code() != key_) { + const gfx::RectF& content_bounds, + bool& keep_original_event) { + if (!IsSameKeyCode(key_event.code(), key_)) { return false; } @@ -68,6 +98,9 @@ } touch_id_ = TouchIdManager::GetInstance()->ObtainTouchID(); + DCHECK(touch_id_); + if (!touch_id_) + return false; auto pos = CalculateTouchPosition(content_bounds); if (!pos) return false; @@ -79,7 +112,21 @@ ui::PointerDetails(ui::EventPointerType::kTouch, *touch_id_))); ui::Event::DispatcherApi(&(rewritten_events.back())) .set_target(target_window_); - keys_pressed_.emplace(key_event.code()); + if (!is_modifier_key_) { + keys_pressed_.emplace(key_event.code()); + } else { + // For modifier keys, EventRewriterChromeOS skips release event for other + // event rewriters but still keeps the press event, so AcceleratorHistory + // can still receive the release event. To avoid error in + // AcceleratorHistory, original press event is still sent. + keep_original_event = true; + rewritten_events.emplace_back(ui::TouchEvent( + ui::EventType::ET_TOUCH_RELEASED, last_touch_root_location_, + last_touch_root_location_, key_event.time_stamp(), + ui::PointerDetails(ui::EventPointerType::kTouch, *touch_id_))); + ui::Event::DispatcherApi(&(rewritten_events.back())); + OnTouchReleased(); + } } else { if (!touch_id_) { LOG(ERROR) << "There should be a touch ID for the release {"
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action_tap_key.h b/chrome/browser/ash/arc/input_overlay/actions/action_tap_key.h index a59e823..4ada936 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action_tap_key.h +++ b/chrome/browser/ash/arc/input_overlay/actions/action_tap_key.h
@@ -26,15 +26,20 @@ // { // "name": "Fight", // "key": "KeyA", - // "location": { - // "position": [...] - // } + // "location": [ + // { + // "type": "position", + // ... + // }, + // {} + // ] // } bool ParseFromJson(const base::Value& value) override; bool RewriteEvent(const ui::Event& origin, const gfx::RectF& content_bounds, const bool is_mouse_locked, - std::list<ui::TouchEvent>& touch_events) override; + std::list<ui::TouchEvent>& touch_events, + bool& keep_original_event) override; gfx::PointF GetUIPosition(const gfx::RectF& content_bounds) override; std::unique_ptr<ActionLabel> CreateView( const gfx::RectF& content_bounds) override; @@ -44,8 +49,19 @@ private: bool RewriteKeyEvent(const ui::KeyEvent& key_event, std::list<ui::TouchEvent>& rewritten_events, - const gfx::RectF& content_bounds); + const gfx::RectF& content_bounds, + bool& keep_original_event); ui::DomCode key_; + // |is_modifier_key_| == true is especially for modifier keys (Only Ctrl, + // Shift and Alt are supported for now) because EventRewriterChromeOS handles + // specially on modifier key released event by skipping the following event + // rewriters on key released event. If |is_modifier_key_| == true, touch + // release event is sent right after touch pressed event for original key + // pressed event and original modifier key pressed event is also sent as it + // is. This is only suitable for some UI buttons which don't require keeping + // press down and change the status only on each touch pressed event instead + // of changing status on each touch pressed and released event. + bool is_modifier_key_ = false; }; } // namespace input_overlay
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action_tap_mouse.cc b/chrome/browser/ash/arc/input_overlay/actions/action_tap_mouse.cc index 695bd24..81b6de25 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action_tap_mouse.cc +++ b/chrome/browser/ash/arc/input_overlay/actions/action_tap_mouse.cc
@@ -51,7 +51,8 @@ bool ActionTapMouse::RewriteEvent(const ui::Event& origin, const gfx::RectF& content_bounds, const bool is_mouse_locked, - std::list<ui::TouchEvent>& touch_events) { + std::list<ui::TouchEvent>& touch_events, + bool& keep_original_event) { if (!origin.IsMouseEvent() || !is_mouse_locked) return false; LogEvent(origin);
diff --git a/chrome/browser/ash/arc/input_overlay/actions/action_tap_mouse.h b/chrome/browser/ash/arc/input_overlay/actions/action_tap_mouse.h index e9a9669..1b5ec87 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/action_tap_mouse.h +++ b/chrome/browser/ash/arc/input_overlay/actions/action_tap_mouse.h
@@ -35,7 +35,8 @@ bool RewriteEvent(const ui::Event& origin, const gfx::RectF& content_bounds, const bool is_mouse_locked, - std::list<ui::TouchEvent>& touch_events) override; + std::list<ui::TouchEvent>& touch_events, + bool& keep_original_event) override; gfx::PointF GetUIPosition(const gfx::RectF& content_bounds) override; std::unique_ptr<ActionLabel> CreateView( const gfx::RectF& content_bounds) override;
diff --git a/chrome/browser/ash/arc/input_overlay/actions/position.cc b/chrome/browser/ash/arc/input_overlay/actions/position.cc index 681a673..1aec12a4 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/position.cc +++ b/chrome/browser/ash/arc/input_overlay/actions/position.cc
@@ -12,6 +12,8 @@ // Key strings in the Json file. constexpr char kAnchor[] = "anchor"; constexpr char kAnchorToTarget[] = "anchor_to_target"; +constexpr char kMaxX[] = "max_x"; +constexpr char kMaxY[] = "max_y"; absl::optional<gfx::PointF> ParseTwoElementsArray(const base::Value& value, const char* key, @@ -41,6 +43,20 @@ } return absl::make_optional<gfx::PointF>(x, y); } + +absl::optional<int> ParseIntValue(const base::Value& value, std::string key) { + auto val = value.FindIntKey(key); + if (val) { + if (*val <= 0) { + LOG(ERROR) << "Value for {" << key << "} should be positive, but got {" + << *val << "}."; + return absl::nullopt; + } + return val; + } + return absl::nullopt; +} + } // namespace Position::Position() {} @@ -70,12 +86,20 @@ << target.x() << ", " << target.y() << "}."; return false; } + + max_x_ = ParseIntValue(value, kMaxX); + max_y_ = ParseIntValue(value, kMaxY); + return true; } gfx::PointF Position::CalculatePosition(const gfx::RectF& content_bounds) { gfx::PointF res = anchor_ + anchor_to_target_; res.Scale(content_bounds.width(), content_bounds.height()); + if (max_x_) + res.set_x(std::min((int)res.x(), *max_x_)); + if (max_y_) + res.set_y(std::min((int)res.y(), *max_y_)); return res; }
diff --git a/chrome/browser/ash/arc/input_overlay/actions/position.h b/chrome/browser/ash/arc/input_overlay/actions/position.h index 40c95f0c..0d3aee7 100644 --- a/chrome/browser/ash/arc/input_overlay/actions/position.h +++ b/chrome/browser/ash/arc/input_overlay/actions/position.h
@@ -24,10 +24,16 @@ // Json value format: // { // "type": "position", + // "anchor": [ // Optional. + // 0, + // 0 + // ], // "anchor_to_target": [ // 0.1796875, // 0.25 - // ] + // ], + // "max_x": 50, // Optional. + // "max_y": 50 // Optional. // } virtual bool ParseFromJson(const base::Value& value); // Return the position coords in window. |content_bounds| is the window bounds @@ -48,6 +54,8 @@ // position. The value may be negative if the direction is different from // original x and y. gfx::Vector2dF anchor_to_target_; + absl::optional<int> max_x_; + absl::optional<int> max_y_; }; } // namespace input_overlay
diff --git a/chrome/browser/ash/arc/input_overlay/touch_injector.cc b/chrome/browser/ash/arc/input_overlay/touch_injector.cc index 1c9b319..92c38ba 100644 --- a/chrome/browser/ash/arc/input_overlay/touch_injector.cc +++ b/chrome/browser/ash/arc/input_overlay/touch_injector.cc
@@ -192,9 +192,9 @@ } } -void TouchInjector::SendTouchMoveEvent( +void TouchInjector::SendExtraEvent( const ui::EventRewriter::Continuation continuation, - const ui::TouchEvent& event) { + const ui::Event& event) { if (SendEventFinally(continuation, &event).dispatcher_destroyed) { VLOG(0) << "Undispatched event due to destroyed dispatcher for " "touch move event."; @@ -231,25 +231,33 @@ auto bounds = CalculateWindowContentBounds(target_window_); std::list<ui::TouchEvent> touch_events; for (auto& action : actions_) { - bool rewritten = - action->RewriteEvent(event, bounds, is_mouse_locked_, touch_events); + bool keep_original_event = false; + bool rewritten = action->RewriteEvent(event, bounds, is_mouse_locked_, + touch_events, keep_original_event); if (!rewritten) continue; + if (keep_original_event) + SendExtraEvent(continuation, event); if (touch_events.empty()) return DiscardEvent(continuation); if (touch_events.size() == 1) return SendEventFinally(continuation, &touch_events.front()); if (touch_events.size() == 2) { - // Some apps can't process correctly on the touch move event which follows - // touch press event immediately, so send the touch move event delayed - // here. - base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, - base::BindOnce(&TouchInjector::SendTouchMoveEvent, - weak_ptr_factory_.GetWeakPtr(), continuation, - touch_events.back()), - kSendTouchMoveDelay); - return SendEventFinally(continuation, &touch_events.front()); + if (touch_events.back().type() == ui::EventType::ET_TOUCH_MOVED) { + // Some apps can't process correctly on the touch move event which + // follows touch press event immediately, so send the touch move event + // delayed here. + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, + base::BindOnce(&TouchInjector::SendExtraEvent, + weak_ptr_factory_.GetWeakPtr(), continuation, + touch_events.back()), + kSendTouchMoveDelay); + return SendEventFinally(continuation, &touch_events.front()); + } else { + SendExtraEvent(continuation, touch_events.front()); + return SendEventFinally(continuation, &touch_events.back()); + } } }
diff --git a/chrome/browser/ash/arc/input_overlay/touch_injector.h b/chrome/browser/ash/arc/input_overlay/touch_injector.h index b2aaf637..806bbed 100644 --- a/chrome/browser/ash/arc/input_overlay/touch_injector.h +++ b/chrome/browser/ash/arc/input_overlay/touch_injector.h
@@ -77,8 +77,8 @@ // If the window is destroying or focusing out, releasing the active touch // event. void DispatchTouchCancelEvent(); - void SendTouchMoveEvent(const ui::EventRewriter::Continuation continuation, - const ui::TouchEvent& event); + void SendExtraEvent(const ui::EventRewriter::Continuation continuation, + const ui::Event& event); void DispatchTouchReleaseEventOnMouseUnLock(); // Json format: // "mouse_lock": {
diff --git a/chrome/browser/ash/crosapi/arc_ash.cc b/chrome/browser/ash/crosapi/arc_ash.cc index dbfa1a4..568531a7 100644 --- a/chrome/browser/ash/crosapi/arc_ash.cc +++ b/chrome/browser/ash/crosapi/arc_ash.cc
@@ -97,15 +97,15 @@ observers_.Add(std::move(remote)); } -void ArcAsh::OnArcIntentHelperBridgeDestruction() { +void ArcAsh::OnArcIntentHelperBridgeShutdown() { // This method should not be called if profie_ is not set. DCHECK(profile_); // Remove observers here instead of ~ArcAsh() since ArcIntentHelperBridge - // is destroyed before ~ArcAsh() is called. + // is shut down before ~ArcAsh() is called. // Both of them are destroyed in // ChromeBrowserMainPartsAsh::PostMainMessageLoopRun(), but - // ArcIntentHelperBridge is destroyed in + // ArcIntentHelperBridge is shut down and destroyed in // ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() while ArcAsh is // destroyed in crosapi_manager_.reset() which runs later. auto* bridge = arc::ArcIntentHelperBridge::GetForBrowserContext(profile_);
diff --git a/chrome/browser/ash/crosapi/arc_ash.h b/chrome/browser/ash/crosapi/arc_ash.h index 940ee24..db95b49 100644 --- a/chrome/browser/ash/crosapi/arc_ash.h +++ b/chrome/browser/ash/crosapi/arc_ash.h
@@ -49,7 +49,7 @@ // arc::ArcIntentHelperObserver: void OnIconInvalidated(const std::string& package_name) override; - void OnArcIntentHelperBridgeDestruction() override; + void OnArcIntentHelperBridgeShutdown() override; private: // Called when activity icons are sent.
diff --git a/chrome/browser/ash/night_light/night_light_client.cc b/chrome/browser/ash/night_light/night_light_client.cc index d975f462..bbb0861 100644 --- a/chrome/browser/ash/night_light/night_light_client.cc +++ b/chrome/browser/ash/night_light/night_light_client.cc
@@ -11,6 +11,8 @@ #include "base/time/clock.h" #include "services/network/public/cpp/shared_url_loader_factory.h" +namespace ash { + namespace { // Delay to wait for a response to our geolocation request, if we get a response @@ -162,3 +164,5 @@ false /* send_cell_towers */, base::BindOnce(&NightLightClient::OnGeoposition, base::Unretained(this))); } + +} // namespace ash
diff --git a/chrome/browser/ash/night_light/night_light_client.h b/chrome/browser/ash/night_light/night_light_client.h index d8ad131..ae52f37 100644 --- a/chrome/browser/ash/night_light/night_light_client.h +++ b/chrome/browser/ash/night_light/night_light_client.h
@@ -23,6 +23,8 @@ class SharedURLLoaderFactory; } +namespace ash { + // Periodically requests the IP-based geolocation and provides it to the // NightLightController running in ash. class NightLightClient : public ash::NightLightController::Observer, @@ -112,4 +114,6 @@ bool using_geoposition_ = false; }; +} // namespace ash + #endif // CHROME_BROWSER_ASH_NIGHT_LIGHT_NIGHT_LIGHT_CLIENT_H_
diff --git a/chrome/browser/ash/night_light/night_light_client_unittest.cc b/chrome/browser/ash/night_light/night_light_client_unittest.cc index 685041b..683447a 100644 --- a/chrome/browser/ash/night_light/night_light_client_unittest.cc +++ b/chrome/browser/ash/night_light/night_light_client_unittest.cc
@@ -16,6 +16,8 @@ #include "third_party/icu/source/common/unicode/unistr.h" #include "third_party/icu/source/i18n/unicode/timezone.h" +namespace ash { + namespace { using ScheduleType = ash::NightLightController::ScheduleType; @@ -281,3 +283,5 @@ ::testing::Values(ScheduleType::kSunsetToSunrise, ScheduleType::kCustom)); } // namespace + +} // namespace ash
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.cc index 7125dbbc..9ead190 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.h" #include "ash/components/settings/cros_settings_names.h" +#include "base/location.h" #include "base/logging.h" #include "chrome/browser/ash/policy/reporting/metrics_reporting/audio/audio_events_observer.h" #include "chrome/browser/ash/policy/reporting/metrics_reporting/network/https_latency_sampler.h" @@ -32,6 +33,9 @@ constexpr base::TimeDelta kDefaultEventCheckingRateForTesting = base::Minutes(1); +constexpr base::TimeDelta kInitDelay = base::Minutes(1); +constexpr base::TimeDelta kInitialUploadDelay = base::Minutes(3); + constexpr base::TimeDelta kDefaultReportUploadFrequency = base::Hours(3); constexpr base::TimeDelta kDefaultNetworkTelemetryCollectionRate = base::Minutes(60); @@ -185,6 +189,15 @@ std::move(additional_samplers)); } +base::TimeDelta MetricReportingManager::Delegate::GetInitDelay() const { + return kInitDelay; +} + +base::TimeDelta MetricReportingManager::Delegate::GetInitialUploadDelay() + const { + return kInitialUploadDelay; +} + // static std::unique_ptr<MetricReportingManager> MetricReportingManager::Create( policy::ManagedSessionService* managed_session_service) { @@ -208,7 +221,8 @@ if (!delegate_->IsAffiliated(profile)) { return; } - InitOnAffiliatedLogin(); + init_on_login_timer_.Start(FROM_HERE, delegate_->GetInitDelay(), this, + &MetricReportingManager::InitOnAffiliatedLogin); } void MetricReportingManager::DeviceSettingsUpdated() { @@ -224,7 +238,18 @@ if (delegate_->IsDeprovisioned()) { return; } - Init(); + + info_report_queue_ = delegate_->CreateMetricReportQueue( + Destination::INFO_METRIC, Priority::SLOW_BATCH); + telemetry_report_queue_ = delegate_->CreatePeriodicUploadReportQueue( + Destination::TELEMETRY_METRIC, Priority::MANUAL_BATCH, + &reporting_settings_, ::ash::kReportUploadFrequency, + GetDefaultReportUploadFrequency()); + event_report_queue_ = delegate_->CreateMetricReportQueue( + Destination::EVENT_METRIC, Priority::SLOW_BATCH); + init_timer_.Start(FROM_HERE, delegate_->GetInitDelay(), this, + &MetricReportingManager::Init); + if (managed_session_service) { managed_session_observation_.Observe(managed_session_service); } @@ -244,14 +269,9 @@ } void MetricReportingManager::Init() { - info_report_queue_ = delegate_->CreateMetricReportQueue( - Destination::INFO_METRIC, Priority::SLOW_BATCH); - telemetry_report_queue_ = delegate_->CreatePeriodicUploadReportQueue( - Destination::TELEMETRY_METRIC, Priority::MANUAL_BATCH, - &reporting_settings_, ::ash::kReportUploadFrequency, - GetDefaultReportUploadFrequency()); - event_report_queue_ = delegate_->CreateMetricReportQueue( - Destination::EVENT_METRIC, Priority::SLOW_BATCH); + if (delegate_->IsDeprovisioned()) { + return; + } InitCrosHealthdInfoCollector( chromeos::cros_healthd::mojom::ProbeCategoryEnum::kCpu, @@ -272,11 +292,21 @@ /*enable_setting_path=*/::ash::kReportDeviceNetworkConfiguration, /*setting_enabled_default_value=*/true); } + + initial_upload_timer_.Start(FROM_HERE, delegate_->GetInitialUploadDelay(), + this, &MetricReportingManager::UploadTelemetry); } void MetricReportingManager::InitOnAffiliatedLogin() { + if (delegate_->IsDeprovisioned()) { + return; + } + InitNetworkCollectors(); InitAudioCollectors(); + + initial_upload_timer_.Start(FROM_HERE, delegate_->GetInitialUploadDelay(), + this, &MetricReportingManager::UploadTelemetry); } void MetricReportingManager::InitOneShotCollector( @@ -347,6 +377,13 @@ std::move(additional_samplers))); } +void MetricReportingManager::UploadTelemetry() { + if (!telemetry_report_queue_) { + return; + } + telemetry_report_queue_->Upload(); +} + void MetricReportingManager::InitCrosHealthdInfoCollector( chromeos::cros_healthd::mojom::ProbeCategoryEnum probe_category, const std::string& setting_path,
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.h b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.h index 8bdafa4..607747f90 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.h +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager.h
@@ -13,6 +13,7 @@ #include "base/scoped_observation.h" #include "base/task/sequenced_task_runner.h" #include "base/time/time.h" +#include "base/timer/timer.h" #include "chrome/browser/ash/policy/reporting/metrics_reporting/cros_healthd_metric_sampler.h" #include "chrome/browser/ash/policy/reporting/metrics_reporting/cros_reporting_settings.h" #include "chrome/browser/ash/policy/status_collector/managed_session_service.h" @@ -105,6 +106,10 @@ const std::string& enable_setting_path, bool setting_enabled_default_value, std::vector<Sampler*> additional_samplers); + + base::TimeDelta GetInitDelay() const; + + base::TimeDelta GetInitialUploadDelay() const; }; static std::unique_ptr<MetricReportingManager> Create( @@ -160,6 +165,8 @@ bool setting_enabled_default_value, std::vector<Sampler*> additional_samplers = {}); + void UploadTelemetry(); + void InitCrosHealthdInfoCollector( chromeos::cros_healthd::mojom::ProbeCategoryEnum probe_category, const std::string& setting_path, @@ -197,6 +204,12 @@ base::ScopedObservation<::ash::DeviceSettingsService, ::ash::DeviceSettingsService::Observer> device_settings_observation_{this}; + + base::OneShotTimer init_timer_; + + base::OneShotTimer init_on_login_timer_; + + base::OneShotTimer initial_upload_timer_; }; } // namespace reporting
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager_unittest.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager_unittest.cc index 2e83f86..a326c7c 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager_unittest.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_manager_unittest.cc
@@ -208,16 +208,18 @@ event_queue_ = std::make_unique<test::FakeMetricReportQueue>(); } - base::test::SingleThreadTaskEnvironment task_environment_; - std::unique_ptr<MetricReportQueue> info_queue_; - std::unique_ptr<MetricReportQueue> telemetry_queue_; - std::unique_ptr<MetricReportQueue> event_queue_; + base::test::SingleThreadTaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + std::unique_ptr<test::FakeMetricReportQueue> info_queue_; + std::unique_ptr<test::FakeMetricReportQueue> telemetry_queue_; + std::unique_ptr<test::FakeMetricReportQueue> event_queue_; }; TEST_F(MetricReportingManagerTest, InitiallyDeprovisioned) { auto fake_reporting_settings = std::make_unique<test::FakeReportingSettings>(); auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + const auto init_delay = mock_delegate->GetInitDelay(); int one_shot_collector_count = 0; int periodic_collector_count = 0; int periodic_event_collector_count = 0; @@ -254,6 +256,8 @@ auto metric_reporting_manager = MetricReportingManager::CreateForTesting( std::move(mock_delegate), nullptr); + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(one_shot_collector_count, 0); EXPECT_EQ(periodic_collector_count, 0); EXPECT_EQ(periodic_event_collector_count, 0); @@ -261,6 +265,8 @@ metric_reporting_manager->OnLogin(nullptr); + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(one_shot_collector_count, 0); EXPECT_EQ(periodic_collector_count, 0); EXPECT_EQ(periodic_event_collector_count, 0); @@ -277,6 +283,7 @@ test_case.disabled_features); auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + const auto init_delay = mock_delegate->GetInitDelay(); auto* const mock_delegate_ptr = mock_delegate.get(); auto* const info_queue_ptr = info_queue_.get(); int collector_count = 0; @@ -295,10 +302,16 @@ auto metric_reporting_manager = MetricReportingManager::CreateForTesting( std::move(mock_delegate), nullptr); + EXPECT_EQ(collector_count, 0); + + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(collector_count, test_case.expected_count_before_login); metric_reporting_manager->OnLogin(nullptr); + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(collector_count, test_case.expected_count_after_login); ON_CALL(*mock_delegate_ptr, IsDeprovisioned).WillByDefault(Return(true)); @@ -360,6 +373,7 @@ auto fake_reporting_settings = std::make_unique<test::FakeReportingSettings>(); auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + const auto init_delay = mock_delegate->GetInitDelay(); auto* const mock_delegate_ptr = mock_delegate.get(); auto* const event_queue_ptr = event_queue_.get(); int observer_manager_count = 0; @@ -380,10 +394,16 @@ auto metric_reporting_manager = MetricReportingManager::CreateForTesting( std::move(mock_delegate), nullptr); + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(observer_manager_count, test_case.expected_count_before_login); metric_reporting_manager->OnLogin(nullptr); + EXPECT_EQ(observer_manager_count, test_case.expected_count_before_login); + + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(observer_manager_count, test_case.expected_count_after_login); ON_CALL(*mock_delegate_ptr, IsDeprovisioned).WillByDefault(Return(true)); @@ -446,6 +466,8 @@ test_case.disabled_features); auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + const auto init_delay = mock_delegate->GetInitDelay(); + const auto upload_delay = mock_delegate->GetInitialUploadDelay(); auto* const mock_delegate_ptr = mock_delegate.get(); auto* const telemetry_queue_ptr = telemetry_queue_.get(); int collector_count = 0; @@ -469,12 +491,27 @@ auto metric_reporting_manager = MetricReportingManager::CreateForTesting( std::move(mock_delegate), nullptr); + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(collector_count, test_case.expected_count_before_login); + task_environment_.FastForwardBy(upload_delay); + + EXPECT_EQ(telemetry_queue_ptr->GetNumFlush(), 1); + metric_reporting_manager->OnLogin(nullptr); + EXPECT_EQ(collector_count, test_case.expected_count_before_login); + + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(collector_count, test_case.expected_count_after_login); + const int expected_login_flush_count = test_case.is_affiliated ? 1 : 0; + task_environment_.FastForwardBy(upload_delay); + + EXPECT_EQ(telemetry_queue_ptr->GetNumFlush(), 1 + expected_login_flush_count); + ON_CALL(*mock_delegate_ptr, IsDeprovisioned).WillByDefault(Return(true)); metric_reporting_manager->DeviceSettingsUpdated(); @@ -521,6 +558,7 @@ test_case.disabled_features); auto mock_delegate = std::make_unique<::testing::NiceMock<MockDelegate>>(); + const auto init_delay = mock_delegate->GetInitDelay(); auto* const mock_delegate_ptr = mock_delegate.get(); auto* const event_queue_ptr = event_queue_.get(); int collector_count = 0; @@ -542,10 +580,16 @@ auto metric_reporting_manager = MetricReportingManager::CreateForTesting( std::move(mock_delegate), nullptr); + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(collector_count, test_case.expected_count_before_login); metric_reporting_manager->OnLogin(nullptr); + EXPECT_EQ(collector_count, test_case.expected_count_before_login); + + task_environment_.FastForwardBy(init_delay); + EXPECT_EQ(collector_count, test_case.expected_count_after_login); ON_CALL(*mock_delegate_ptr, IsDeprovisioned).WillByDefault(Return(true));
diff --git a/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl.cc b/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl.cc index 9c958f8..e6b2462 100644 --- a/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl.cc +++ b/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl.cc
@@ -8,12 +8,15 @@ #include "ash/webui/personalization_app/mojom/personalization_app.mojom.h" #include "ash/webui/personalization_app/mojom/personalization_app_mojom_traits.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ash/login/users/avatar/user_image_manager.h" +#include "chrome/browser/ash/login/users/chrome_user_manager.h" #include "chrome/browser/ash/login/users/default_user_image/default_user_images.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/profiles/profile.h" #include "components/user_manager/user_info.h" #include "components/user_manager/user_manager.h" #include "content/public/browser/web_ui.h" +#include "mojo/public/cpp/bindings/message.h" #include "ui/base/webui/web_ui_util.h" #include "url/gurl.h" @@ -71,6 +74,20 @@ std::move(callback).Run(std::move(images)); } +void PersonalizationAppUserProviderImpl::SelectDefaultImage(int index) { + if (!ash::default_user_image::IsInCurrentImageSet(index)) { + mojo::ReportBadMessage("Invalid user image selected"); + return; + } + + auto* user_image_manager = ash::ChromeUserManager::Get()->GetUserImageManager( + chromeos::ProfileHelper::Get() + ->GetUserByProfile(profile_) + ->GetAccountId()); + + user_image_manager->SaveUserDefaultImageIndex(index); +} + void PersonalizationAppUserProviderImpl::OnUserImageChanged( const user_manager::User& user) { const user_manager::User* desired_user =
diff --git a/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl.h b/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl.h index 6877d8e..27374f7 100644 --- a/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl.h +++ b/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl.h
@@ -46,6 +46,8 @@ void GetDefaultUserImages(GetDefaultUserImagesCallback callback) override; + void SelectDefaultImage(int index) override; + // user_manager::UserManager::Observer: void OnUserImageChanged(const user_manager::User& user) override;
diff --git a/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl_unittest.cc b/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl_unittest.cc index 15946ff..315d529 100644 --- a/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl_unittest.cc +++ b/chrome/browser/ash/web_applications/personalization_app/personalization_app_user_provider_impl_unittest.cc
@@ -189,3 +189,18 @@ image_index), current_user_image()); } + +TEST_F(PersonalizationAppUserProviderImplTest, SelectDefaultImage) { + SetUserImageObserver(); + + // Select a default image. + int image_index = ash::default_user_image::GetRandomDefaultImageIndex(); + user_provider_remote()->get()->SelectDefaultImage(image_index); + user_provider_remote()->FlushForTesting(); + + // Observer received the updated image url. Because it is a default image, + // receives the chrome://theme url. + EXPECT_EQ(base::StringPrintf("chrome://theme/IDR_LOGIN_DEFAULT_USER_%d", + image_index), + current_user_image()); +}
diff --git a/chrome/browser/ash/web_applications/scanning_app_integration_browsertest.cc b/chrome/browser/ash/web_applications/scanning_app_integration_browsertest.cc index e00d7c52..a19daf0 100644 --- a/chrome/browser/ash/web_applications/scanning_app_integration_browsertest.cc +++ b/chrome/browser/ash/web_applications/scanning_app_integration_browsertest.cc
@@ -33,10 +33,9 @@ // set to be disabled via the SystemFeaturesDisableList policy. IN_PROC_BROWSER_TEST_P(ScanningAppIntegrationTest, ScanningAppDisabled) { { - ListPrefUpdateDeprecated update( - TestingBrowserProcess::GetGlobal()->local_state(), - policy::policy_prefs::kSystemFeaturesDisableList); - base::ListValue* list = update.Get(); + ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(), + policy::policy_prefs::kSystemFeaturesDisableList); + base::Value* list = update.Get(); list->Append(policy::SystemFeature::kScanning); }
diff --git a/chrome/browser/ash/web_applications/settings_app_integration_browsertest.cc b/chrome/browser/ash/web_applications/settings_app_integration_browsertest.cc index 3861e7f..fdd47ff 100644 --- a/chrome/browser/ash/web_applications/settings_app_integration_browsertest.cc +++ b/chrome/browser/ash/web_applications/settings_app_integration_browsertest.cc
@@ -31,10 +31,9 @@ // via SystemFeaturesDisableList policy, but doesn't launch. IN_PROC_BROWSER_TEST_P(SettingsAppIntegrationTest, SettingsAppDisabled) { { - ListPrefUpdateDeprecated update( - TestingBrowserProcess::GetGlobal()->local_state(), - policy::policy_prefs::kSystemFeaturesDisableList); - base::ListValue* list = update.Get(); + ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(), + policy::policy_prefs::kSystemFeaturesDisableList); + base::Value* list = update.Get(); list->Append(policy::SystemFeature::kOsSettings); }
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 7e882ea..70df7be 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -148,6 +148,7 @@ #include "chrome/browser/vr/vr_tab_helper.h" #include "chrome/browser/web_applications/policy/web_app_policy_manager.h" #include "chrome/browser/web_applications/system_web_apps/system_web_app_manager.h" +#include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/common/buildflags.h" @@ -2074,18 +2075,8 @@ content::BrowserContext* browser_context, const GURL& url) { #if BUILDFLAG(ENABLE_EXTENSIONS) - // For short-term testing, also use kDirectSockets to enable isolated - // application level. DirectSocket WPT and browser tests require application - // isolation level. - // - // TODO(crbug.com/1206150): Figure out a better way to enable isolated - // application level in tests. - PrefService* prefs = Profile::FromBrowserContext(browser_context)->GetPrefs(); - bool is_isolated_storage_enabled = base::FeatureList::IsEnabled( - blink::features::kWebAppEnableIsolatedStorage); - return base::FeatureList::IsEnabled(features::kDirectSockets) || - (is_isolated_storage_enabled && - web_app::GetStorageIsolationKey(prefs, url::Origin::Create(url))); + Profile* profile = Profile::FromBrowserContext(browser_context); + return web_app::IsUrlInIsolatedAppScope(profile->GetPrefs(), url); #else return false; #endif
diff --git a/chrome/browser/chrome_content_browser_client_receiver_bindings.cc b/chrome/browser/chrome_content_browser_client_receiver_bindings.cc index d6c7946d..bd175ca5 100644 --- a/chrome/browser/chrome_content_browser_client_receiver_bindings.cc +++ b/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
@@ -31,7 +31,6 @@ #include "components/autofill_assistant/content/common/autofill_assistant_driver.mojom.h" #include "components/content_capture/browser/onscreen_content_provider.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/metrics/call_stack_profile_collector.h" #include "components/offline_pages/buildflags/buildflags.h" #include "components/page_load_metrics/browser/metrics_web_contents_observer.h"
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index aa609f8..d77dec67 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -905,8 +905,6 @@ "../ash/arc/intent_helper/custom_tab_session_impl.h", "../ash/arc/intent_helper/factory_reset_delegate.cc", "../ash/arc/intent_helper/factory_reset_delegate.h", - "../ash/arc/intent_helper/open_with_menu.cc", - "../ash/arc/intent_helper/open_with_menu.h", "../ash/arc/intent_helper/start_smart_selection_action_menu.cc", "../ash/arc/intent_helper/start_smart_selection_action_menu.h", "../ash/arc/keymaster/arc_keymaster_bridge.cc", @@ -3979,7 +3977,6 @@ "../ash/arc/instance_throttle/arc_switch_throttle_observer_unittest.cc", "../ash/arc/intent_helper/arc_external_protocol_dialog_unittest.cc", "../ash/arc/intent_helper/arc_settings_service_unittest.cc", - "../ash/arc/intent_helper/open_with_menu_unittest.cc", "../ash/arc/kiosk/arc_kiosk_bridge_unittest.cc", "../ash/arc/nearby_share/arc_nearby_share_bridge_unittest.cc", "../ash/arc/nearby_share/share_info_file_stream_adapter_unittest.cc",
diff --git a/chrome/browser/ash/arc/intent_helper/open_with_menu.cc b/chrome/browser/chromeos/arc/open_with_menu.cc similarity index 97% rename from chrome/browser/ash/arc/intent_helper/open_with_menu.cc rename to chrome/browser/chromeos/arc/open_with_menu.cc index 8ab2833..4cba9b6 100644 --- a/chrome/browser/ash/arc/intent_helper/open_with_menu.cc +++ b/chrome/browser/chromeos/arc/open_with_menu.cc
@@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ash/arc/intent_helper/open_with_menu.h" +#include "chrome/browser/chromeos/arc/open_with_menu.h" #include <algorithm> #include "base/strings/string_util.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/grit/generated_resources.h" +#include "components/arc/common/intent_helper/link_handler_model_delegate.h" #include "components/renderer_context_menu/render_view_context_menu_proxy.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/context_menu_params.h"
diff --git a/chrome/browser/ash/arc/intent_helper/open_with_menu.h b/chrome/browser/chromeos/arc/open_with_menu.h similarity index 94% rename from chrome/browser/ash/arc/intent_helper/open_with_menu.h rename to chrome/browser/chromeos/arc/open_with_menu.h index 3c6b137..ea5e2a1 100644 --- a/chrome/browser/ash/arc/intent_helper/open_with_menu.h +++ b/chrome/browser/chromeos/arc/open_with_menu.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_ASH_ARC_INTENT_HELPER_OPEN_WITH_MENU_H_ -#define CHROME_BROWSER_ASH_ARC_INTENT_HELPER_OPEN_WITH_MENU_H_ +#ifndef CHROME_BROWSER_CHROMEOS_ARC_OPEN_WITH_MENU_H_ +#define CHROME_BROWSER_CHROMEOS_ARC_OPEN_WITH_MENU_H_ #include <memory> #include <unordered_map> @@ -95,4 +95,4 @@ } // namespace arc -#endif // CHROME_BROWSER_ASH_ARC_INTENT_HELPER_OPEN_WITH_MENU_H_ +#endif // CHROME_BROWSER_CHROMEOS_ARC_OPEN_WITH_MENU_H_
diff --git a/chrome/browser/ash/arc/intent_helper/open_with_menu_unittest.cc b/chrome/browser/chromeos/arc/open_with_menu_unittest.cc similarity index 98% rename from chrome/browser/ash/arc/intent_helper/open_with_menu_unittest.cc rename to chrome/browser/chromeos/arc/open_with_menu_unittest.cc index 1e839d9ce..485b389 100644 --- a/chrome/browser/ash/arc/intent_helper/open_with_menu_unittest.cc +++ b/chrome/browser/chromeos/arc/open_with_menu_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ash/arc/intent_helper/open_with_menu.h" +#include "chrome/browser/chromeos/arc/open_with_menu.h" #include <unordered_map> #include <utility>
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_promo_infobar_delegate_android.cc b/chrome/browser/data_reduction_proxy/data_reduction_promo_infobar_delegate_android.cc deleted file mode 100644 index f4caff8..0000000 --- a/chrome/browser/data_reduction_proxy/data_reduction_promo_infobar_delegate_android.cc +++ /dev/null
@@ -1,72 +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. - -#include "chrome/browser/data_reduction_proxy/data_reduction_promo_infobar_delegate_android.h" - -#include "chrome/android/chrome_jni_headers/DataReductionPromoInfoBarDelegate_jni.h" -#include "components/infobars/content/content_infobar_manager.h" -#include "components/infobars/core/infobar.h" -#include "content/public/browser/web_contents.h" - -using base::android::JavaParamRef; -using base::android::JavaRef; - -// static -void DataReductionPromoInfoBarDelegateAndroid::Create( - content::WebContents* web_contents) { - infobars::ContentInfoBarManager* infobar_manager = - infobars::ContentInfoBarManager::FromWebContents(web_contents); - infobar_manager->AddInfoBar( - DataReductionPromoInfoBarDelegateAndroid::CreateInfoBar( - infobar_manager, - std::make_unique<DataReductionPromoInfoBarDelegateAndroid>())); -} - -DataReductionPromoInfoBarDelegateAndroid:: - DataReductionPromoInfoBarDelegateAndroid() {} - -DataReductionPromoInfoBarDelegateAndroid:: - ~DataReductionPromoInfoBarDelegateAndroid() { - JNIEnv* env = base::android::AttachCurrentThread(); - Java_DataReductionPromoInfoBarDelegate_onNativeDestroyed(env); -} - -// static -void DataReductionPromoInfoBarDelegateAndroid::Launch( - JNIEnv* env, - const JavaRef<jobject>& jweb_contents) { - content::WebContents* web_contents = - content::WebContents::FromJavaWebContents(jweb_contents); - DCHECK(web_contents); - Create(web_contents); -} - -base::android::ScopedJavaLocalRef<jobject> -DataReductionPromoInfoBarDelegateAndroid::CreateRenderInfoBar(JNIEnv* env) { - return Java_DataReductionPromoInfoBarDelegate_showPromoInfoBar(env); -} - -infobars::InfoBarDelegate::InfoBarIdentifier -DataReductionPromoInfoBarDelegateAndroid::GetIdentifier() const { - return DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDROID; -} - -std::u16string DataReductionPromoInfoBarDelegateAndroid::GetMessageText() - const { - // Message is set in DataReductionPromoInfoBar.java. - return std::u16string(); -} - -bool DataReductionPromoInfoBarDelegateAndroid::Accept() { - JNIEnv* env = base::android::AttachCurrentThread(); - Java_DataReductionPromoInfoBarDelegate_accept(env); - return true; -} - -// JNI for DataReductionPromoInfoBarDelegate. -void JNI_DataReductionPromoInfoBarDelegate_Launch( - JNIEnv* env, - const JavaParamRef<jobject>& jweb_contents) { - DataReductionPromoInfoBarDelegateAndroid::Launch(env, jweb_contents); -}
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_promo_infobar_delegate_android.h b/chrome/browser/data_reduction_proxy/data_reduction_promo_infobar_delegate_android.h deleted file mode 100644 index a8998fe..0000000 --- a/chrome/browser/data_reduction_proxy/data_reduction_promo_infobar_delegate_android.h +++ /dev/null
@@ -1,55 +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. - -#ifndef CHROME_BROWSER_DATA_REDUCTION_PROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDROID_H_ -#define CHROME_BROWSER_DATA_REDUCTION_PROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDROID_H_ - -#include <memory> -#include <string> - -#include "base/android/scoped_java_ref.h" -#include "components/infobars/core/confirm_infobar_delegate.h" -#include "components/infobars/core/infobar_delegate.h" - -namespace content { -class WebContents; -} - -namespace infobars { -class InfoBarManager; -} - -// An infobar that prompts the user to enable the data reduction proxy. -class DataReductionPromoInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { - public: - // Creates the infobar and adds it to the provided |web_contents|. - static void Create(content::WebContents* web_contents); - - DataReductionPromoInfoBarDelegateAndroid(); - - DataReductionPromoInfoBarDelegateAndroid( - const DataReductionPromoInfoBarDelegateAndroid&) = delete; - DataReductionPromoInfoBarDelegateAndroid& operator=( - const DataReductionPromoInfoBarDelegateAndroid&) = delete; - - ~DataReductionPromoInfoBarDelegateAndroid() override; - - static void Launch(JNIEnv* env, - const base::android::JavaRef<jobject>& jweb_contents); - - base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar(JNIEnv* env); - - private: - // Returns a Data Reduction Proxy infobar that owns |delegate|. - static std::unique_ptr<infobars::InfoBar> CreateInfoBar( - infobars::InfoBarManager* infobar_manager, - std::unique_ptr<DataReductionPromoInfoBarDelegateAndroid> delegate); - - // ConfirmInfoBarDelegate: - infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; - std::u16string GetMessageText() const override; - bool Accept() override; -}; - -#endif // CHROME_BROWSER_DATA_REDUCTION_PROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDROID_H_
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.cc b/chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.cc index 99a09e7..3146cb5 100644 --- a/chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.cc +++ b/chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.cc
@@ -30,9 +30,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" #include "components/data_reduction_proxy/core/browser/data_store.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "components/embedder_support/user_agent_utils.h" #include "components/prefs/pref_service.h"
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_android.cc b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_android.cc index 8d25e51..a3b364f 100644 --- a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_android.cc +++ b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_android.cc
@@ -25,9 +25,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" #include "components/data_reduction_proxy/core/browser/data_usage_store.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "net/base/url_util.h" #include "url/gurl.h" @@ -59,18 +57,6 @@ DataReductionProxySettingsAndroid::~DataReductionProxySettingsAndroid() {} -jboolean DataReductionProxySettingsAndroid::IsDataReductionProxyPromoAllowed( - JNIEnv* env, - const JavaParamRef<jobject>& obj) { - return data_reduction_proxy::params::IsIncludedInPromoFieldTrial(); -} - -jboolean DataReductionProxySettingsAndroid::IsDataReductionProxyFREPromoAllowed( - JNIEnv* env, - const JavaParamRef<jobject>& obj) { - return data_reduction_proxy::params::IsIncludedInFREPromoFieldTrial(); -} - jboolean DataReductionProxySettingsAndroid::IsDataReductionProxyEnabled( JNIEnv* env, const JavaParamRef<jobject>& obj) {
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_android.h b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_android.h index a56b9df1..18523d2b 100644 --- a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_android.h +++ b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_android.h
@@ -41,12 +41,6 @@ void InitDataReductionProxySettings(Profile* profile); // JNI wrapper interfaces to the indentically-named superclass methods. - jboolean IsDataReductionProxyPromoAllowed( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj); - jboolean IsDataReductionProxyFREPromoAllowed( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj); jboolean IsDataReductionProxyEnabled( JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc index de629441..c7c9801de 100644 --- a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc +++ b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc
@@ -26,7 +26,6 @@ #include "chrome/common/pref_names.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "components/prefs/pref_service.h" #include "components/proxy_config/proxy_prefs.h"
diff --git a/chrome/browser/download/internal/android/java/res/layout/list_selection_handle_view.xml b/chrome/browser/download/internal/android/java/res/layout/list_selection_handle_view.xml index 296df3f..784e7a4 100644 --- a/chrome/browser/download/internal/android/java/res/layout/list_selection_handle_view.xml +++ b/chrome/browser/download/internal/android/java/res/layout/list_selection_handle_view.xml
@@ -16,7 +16,7 @@ android:scaleType="center" android:background="@drawable/list_item_icon_modern_bg" android:visibility="gone" - app:tint="?attr/default_icon_color_inverse" + app:tint="@macro/default_icon_color_inverse" app:layout_gravity="center" tools:ignore="ContentDescription" />
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc index e4cd2bc..1e9c417c 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -21,7 +21,6 @@ #include "base/run_loop.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h" -#include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/task/single_thread_task_runner.h" #include "base/test/metrics/histogram_tester.h" @@ -1107,25 +1106,7 @@ namespace { std::string GetCookieExpirationDate(int delta_secs) { - const char* const kWeekDays[] = { - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" - }; - const char* const kMonthNames[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - - Time::Exploded exploded_time; - (Time::Now() + base::Seconds(delta_secs)).UTCExplode(&exploded_time); - - return base::StringPrintf("%s, %d %s %d %.2d:%.2d:%.2d GMT", - kWeekDays[exploded_time.day_of_week], - exploded_time.day_of_month, - kMonthNames[exploded_time.month - 1], - exploded_time.year, - exploded_time.hour, - exploded_time.minute, - exploded_time.second); + return base::TimeFormatHTTP(Time::Now() + base::Seconds(delta_secs)); } } // namespace
diff --git a/chrome/browser/first_run/android/java/src/org/chromium/chrome/browser/firstrun/MobileFreProgress.java b/chrome/browser/first_run/android/java/src/org/chromium/chrome/browser/firstrun/MobileFreProgress.java index 864ee47..607ede6 100644 --- a/chrome/browser/first_run/android/java/src/org/chromium/chrome/browser/firstrun/MobileFreProgress.java +++ b/chrome/browser/first_run/android/java/src/org/chromium/chrome/browser/firstrun/MobileFreProgress.java
@@ -17,7 +17,7 @@ @IntDef({ MobileFreProgress.STARTED, MobileFreProgress.WELCOME_SHOWN, - MobileFreProgress.DATA_SAVER_SHOWN, + MobileFreProgress.DEPRECATED_DATA_SAVER_SHOWN, MobileFreProgress.SYNC_CONSENT_SHOWN, MobileFreProgress.SYNC_CONSENT_ACCEPTED, MobileFreProgress.SYNC_CONSENT_DISMISSED, @@ -33,7 +33,7 @@ public @interface MobileFreProgress { int STARTED = 0; int WELCOME_SHOWN = 1; - int DATA_SAVER_SHOWN = 2; + int DEPRECATED_DATA_SAVER_SHOWN = 2; int SYNC_CONSENT_SHOWN = 3; /** The user clicked on the continue button to continue with sync consent. */ int SYNC_CONSENT_ACCEPTED = 4;
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index cbd29af..22449cd3 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -31,7 +31,6 @@ #include "components/content_creation/notes/core/note_features.h" #include "components/content_creation/reactions/core/reactions_features.h" #include "components/content_settings/core/common/features.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/download/public/common/download_features.h" #include "components/embedder_support/android/util/cdn_utils.h" #include "components/feature_engagement/public/feature_list.h"
diff --git a/chrome/browser/lacros/arc/arc_icon_cache.cc b/chrome/browser/lacros/arc/arc_icon_cache.cc index 9931e2f..e867ec4 100644 --- a/chrome/browser/lacros/arc/arc_icon_cache.cc +++ b/chrome/browser/lacros/arc/arc_icon_cache.cc
@@ -43,6 +43,7 @@ auto* service = chromeos::LacrosService::Get(); if (!service || !service->IsAvailable<crosapi::mojom::Arc>()) { LOG(WARNING) << "ARC is not supported in Lacros."; + std::move(callback).Run(std::vector<IntentHandlerInfo>()); return false; } @@ -50,6 +51,7 @@ int{crosapi::mojom::Arc::MethodMinVersions:: kRequestUrlHandlerListMinVersion}) { LOG(WARNING) << "RequestUrlHandlerList is not supported in Lacros."; + std::move(callback).Run(std::vector<IntentHandlerInfo>()); return false; }
diff --git a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc index 67e7342..afed319 100644 --- a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc +++ b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
@@ -442,19 +442,21 @@ EncryptedMediaSupportedTypesExternalClearKeyTest& operator=( const EncryptedMediaSupportedTypesExternalClearKeyTest&) = delete; -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) protected: +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) EncryptedMediaSupportedTypesExternalClearKeyTest() { enabled_features_.push_back(media::kExternalClearKeyForTesting); } - ~EncryptedMediaSupportedTypesExternalClearKeyTest() override {} - void SetUpCommandLine(base::CommandLine* command_line) override { EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); RegisterClearKeyCdm(command_line); } +#else + EncryptedMediaSupportedTypesExternalClearKeyTest() = default; #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) + + ~EncryptedMediaSupportedTypesExternalClearKeyTest() override = default; }; // By default, the External Clear Key (ECK) key system is not supported even if
diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc index 04ac573..d89552a 100644 --- a/chrome/browser/net/profile_network_context_service.cc +++ b/chrome/browser/net/profile_network_context_service.cc
@@ -51,6 +51,7 @@ #include "content/public/browser/shared_cors_origin_access_list.h" #include "content/public/browser/storage_partition.h" #include "content/public/common/url_constants.h" +#include "crypto/crypto_buildflags.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "net/base/features.h" #include "net/http/http_auth_preferences.h" @@ -81,10 +82,10 @@ #include "components/user_manager/user_manager.h" #endif -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "chrome/browser/ui/crypto_module_delegate_nss.h" #include "net/ssl/client_cert_store_nss.h" -#endif // defined(USE_NSS_CERTS) +#endif // BUILDFLAG(USE_NSS_CERTS) #if BUILDFLAG(IS_WIN) #include "net/ssl/client_cert_store_win.h" @@ -591,7 +592,7 @@ std::move(certificate_provider), use_system_key_slot, username_hash, base::BindRepeating(&CreateCryptoModuleBlockingPasswordDelegate, kCryptoModulePasswordClientAuth)); -#elif defined(USE_NSS_CERTS) +#elif BUILDFLAG(USE_NSS_CERTS) std::unique_ptr<net::ClientCertStore> store = std::make_unique<net::ClientCertStoreNSS>( base::BindRepeating(&CreateCryptoModuleBlockingPasswordDelegate,
diff --git a/chrome/browser/new_tab_page/modules/task_module/task_module_service.cc b/chrome/browser/new_tab_page/modules/task_module/task_module_service.cc index 6b071b2..3ff24c5 100644 --- a/chrome/browser/new_tab_page/modules/task_module/task_module_service.cc +++ b/chrome/browser/new_tab_page/modules/task_module/task_module_service.cc
@@ -11,6 +11,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/new_tab_page/modules/task_module/time_format_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/webui_url_constants.h" #include "chrome/grit/generated_resources.h" @@ -141,27 +142,6 @@ } } -std::string GetViewedItemText(int viewed_timestamp) { - // GWS timestamps are relative to the Unix Epoch. - auto viewed_time = base::Time::UnixEpoch() + base::Seconds(viewed_timestamp); - auto viewed_delta = base::Time::Now() - viewed_time; - // Viewing items in the future is not supported. Assume the item was viewed - // today to account for small shifts between the local and server clock. - if (viewed_delta.InSeconds() < 0) { - viewed_delta = base::TimeDelta(); - } - if (viewed_delta.InDays() < 1) { - return l10n_util::GetStringUTF8( - IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_TODAY); - } - return base::UTF16ToUTF8(l10n_util::GetStringFUTF16( - IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_AGO, - ui::TimeFormat::SimpleWithMonthAndYear( - ui::TimeFormat::Format::FORMAT_ELAPSED, - ui::TimeFormat::Length::LENGTH_LONG, viewed_delta, - /*use_month_and_year=*/true))); -} - std::string GetRecommendedItemText( task_module::mojom::TaskModuleType task_module_type) { switch (task_module_type) {
diff --git a/chrome/browser/new_tab_page/modules/task_module/task_module_service_unittest.cc b/chrome/browser/new_tab_page/modules/task_module/task_module_service_unittest.cc index 4ef0214..dccd1c8 100644 --- a/chrome/browser/new_tab_page/modules/task_module/task_module_service_unittest.cc +++ b/chrome/browser/new_tab_page/modules/task_module/task_module_service_unittest.cc
@@ -153,12 +153,12 @@ EXPECT_EQ("foo", result->task_items[0]->name); EXPECT_EQ("https://foo.com/", result->task_items[0]->image_url.spec()); EXPECT_EQ("$500", result->task_items[0]->price); - EXPECT_EQ("Viewed 5 months ago", result->task_items[0]->info); + EXPECT_EQ("Viewed previously", result->task_items[0]->info); EXPECT_EQ("https://google.com/foo", result->task_items[0]->target_url.spec()); EXPECT_EQ("bar", result->task_items[1]->name); EXPECT_EQ("https://bar.com/", result->task_items[1]->image_url.spec()); EXPECT_EQ("$400", result->task_items[1]->price); - EXPECT_EQ("Viewed 2 days ago", result->task_items[1]->info); + EXPECT_EQ("Viewed in the past week", result->task_items[1]->info); EXPECT_EQ("https://google.com/bar", result->task_items[1]->target_url.spec()); EXPECT_EQ("baz", result->related_searches[0]->text); EXPECT_EQ("https://google.com/baz",
diff --git a/chrome/browser/new_tab_page/modules/task_module/time_format_util.cc b/chrome/browser/new_tab_page/modules/task_module/time_format_util.cc new file mode 100644 index 0000000..6b381899 --- /dev/null +++ b/chrome/browser/new_tab_page/modules/task_module/time_format_util.cc
@@ -0,0 +1,34 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/new_tab_page/modules/task_module/time_format_util.h" + +#include "base/time/time.h" +#include "chrome/grit/generated_resources.h" +#include "ui/base/l10n/l10n_util.h" + +std::string GetViewedItemText(int viewed_timestamp) { + // GWS timestamps are relative to the Unix Epoch. + auto viewed_time = base::Time::UnixEpoch() + base::Seconds(viewed_timestamp); + auto now = base::Time::Now(); + // Viewing items in the future is not supported. Assume the item was viewed + // today to account for small shifts between the local and server clock. + if (viewed_time > now) { + viewed_time = now; + } + auto viewed_delta = now - viewed_time; + + int message_id = IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PREVIOUSLY; + if (now.LocalMidnight() == viewed_time.LocalMidnight()) { + message_id = IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_TODAY; + } else if ((now - base::Days(1)).LocalMidnight() == + viewed_time.LocalMidnight()) { + message_id = IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_YESTERDAY; + } else if (viewed_delta.InDays() < 7) { + message_id = IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_WEEK; + } else if (viewed_delta.InDays() < 30) { + message_id = IDS_NTP_MODULES_STATEFUL_TASKS_VIEWED_PAST_MONTH; + } + return l10n_util::GetStringUTF8(message_id); +}
diff --git a/chrome/browser/new_tab_page/modules/task_module/time_format_util.h b/chrome/browser/new_tab_page/modules/task_module/time_format_util.h new file mode 100644 index 0000000..221e579 --- /dev/null +++ b/chrome/browser/new_tab_page/modules/task_module/time_format_util.h
@@ -0,0 +1,15 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_NEW_TAB_PAGE_MODULES_TASK_MODULE_TIME_FORMAT_UTIL_H_ +#define CHROME_BROWSER_NEW_TAB_PAGE_MODULES_TASK_MODULE_TIME_FORMAT_UTIL_H_ + +#include <string> + +// Turns the |viewed_timestamp| Unix Epoch timestamp of a task visit into a +// human-readable, localized string indicating when this task was viewed (e.g. +// "Viewed today", "Viewed in the past week"). +std::string GetViewedItemText(int viewed_timestamp); + +#endif // CHROME_BROWSER_NEW_TAB_PAGE_MODULES_TASK_MODULE_TIME_FORMAT_UTIL_H_
diff --git a/chrome/browser/new_tab_page/modules/task_module/time_format_util_unittest.cc b/chrome/browser/new_tab_page/modules/task_module/time_format_util_unittest.cc new file mode 100644 index 0000000..50d86ddf --- /dev/null +++ b/chrome/browser/new_tab_page/modules/task_module/time_format_util_unittest.cc
@@ -0,0 +1,35 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/new_tab_page/modules/task_module/time_format_util.h" + +#include "base/time/time.h" +#include "content/public/test/browser_task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +class TimeFormatUtilTest : public testing::Test { + public: + TimeFormatUtilTest() + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} + + int AsTimestamp(const base::Time& time) { + return (time - base::Time::UnixEpoch()).InSeconds(); + } + + protected: + content::BrowserTaskEnvironment task_environment_; +}; + +TEST_F(TimeFormatUtilTest, GetViewedItemText) { + const auto now = base::Time::Now(); + EXPECT_EQ("Viewed today", GetViewedItemText(AsTimestamp(now))); + EXPECT_EQ("Viewed yesterday", + GetViewedItemText(AsTimestamp(now - base::Days(1)))); + EXPECT_EQ("Viewed in the past week", + GetViewedItemText(AsTimestamp(now - base::Days(2)))); + EXPECT_EQ("Viewed in the past month", + GetViewedItemText(AsTimestamp(now - base::Days(30)))); + EXPECT_EQ("Viewed previously", + GetViewedItemText(AsTimestamp(now - base::Days(100)))); +}
diff --git a/chrome/browser/optimization_guide/hints_fetcher_browsertest.cc b/chrome/browser/optimization_guide/hints_fetcher_browsertest.cc index d8fd60d..5d5c10d 100644 --- a/chrome/browser/optimization_guide/hints_fetcher_browsertest.cc +++ b/chrome/browser/optimization_guide/hints_fetcher_browsertest.cc
@@ -30,7 +30,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/google/core/common/google_switches.h" #include "components/google/core/common/google_util.h" #include "components/metrics/content/subprocess_metrics_provider.h"
diff --git a/chrome/browser/page_load_metrics/observers/data_saver_site_breakdown_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/data_saver_site_breakdown_metrics_observer.cc index 515f0f76..575f5a9 100644 --- a/chrome/browser/page_load_metrics/observers/data_saver_site_breakdown_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/data_saver_site_breakdown_metrics_observer.cc
@@ -10,7 +10,6 @@ #include "chrome/browser/profiles/profile.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/page_load_metrics/observers/data_saver_site_breakdown_metrics_observer_browsertest.cc b/chrome/browser/page_load_metrics/observers/data_saver_site_breakdown_metrics_observer_browsertest.cc index 4dd69767..6d42fde 100644 --- a/chrome/browser/page_load_metrics/observers/data_saver_site_breakdown_metrics_observer_browsertest.cc +++ b/chrome/browser/page_load_metrics/observers/data_saver_site_breakdown_metrics_observer_browsertest.cc
@@ -24,7 +24,6 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/data_reduction_proxy/proto/data_store.pb.h" @@ -319,72 +318,6 @@ *os << " }, is_valid_json=" << test.is_valid_json << " }"; } -// Browser tests with Lite mode not enabled. -class SaveDataSavingsEstimateBrowserTest - : public DataSaverSiteBreakdownMetricsObserverBrowserTest, - public ::testing::WithParamInterface<SaveDataTestCase> { - public: - void SetUp() override { - ASSERT_TRUE(embedded_test_server()->Start()); - const std::string estimates_json = - !GetParam().origin_savings_estimate_raw_json.empty() - ? GetParam().origin_savings_estimate_raw_json - : (!GetParam().origin_savings_estimate_list.empty() - ? ConvertSaveDataSavingsEstimateToJson( - GetParam().origin_savings_estimate_list, - *embedded_test_server()) - : ""); - if (!estimates_json.empty()) { - scoped_feature_list_.InitWithFeaturesAndParameters( - {{data_reduction_proxy::features::kReportSaveDataSavings, - {{"origin_savings_estimate", estimates_json}}}}, - {}); - } - DataSaverSiteBreakdownMetricsObserverBrowserTest::SetUp(); - if (!estimates_json.empty()) { - histogram_tester_.ExpectUniqueSample( - "DataReductionProxy.ReportSaveDataSavings.ParseResult", - GetParam().is_valid_json, 1); - } else { - histogram_tester_.ExpectTotalCount( - "DataReductionProxy.ReportSaveDataSavings.ParseResult", 0); - } - } - - private: - base::test::ScopedFeatureList scoped_feature_list_; - base::HistogramTester histogram_tester_; -}; - -INSTANTIATE_TEST_SUITE_P(SaveDataSavingsEstimateBrowserTest, - SaveDataSavingsEstimateBrowserTest, - ::testing::ValuesIn(kSaveDataTestCases)); - -// Flaky on LINUX. http://crbug.com/1091573 -IN_PROC_BROWSER_TEST_P(SaveDataSavingsEstimateBrowserTest, - DISABLED_NavigateToSimplePage) { - WaitForDBToInitialize(); - - for (const auto& test : GetParam().tests) { - GURL test_url( - embedded_test_server()->GetURL(test.test_host, "/google/google.html")); - std::string host = test_url.HostNoBrackets(); - uint64_t data_usage_before_navigation = GetDataUsage(host); - uint64_t data_savings_before_navigation = GetDataSavings(host); - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_url)); - - base::RunLoop().RunUntilIdle(); - // Navigate away to force the histogram recording. - ASSERT_TRUE( - ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL))); - - double data_savings_percent = - 100.0 * (GetDataSavings(host) - data_savings_before_navigation) / - (GetDataUsage(host) - data_usage_before_navigation); - EXPECT_NEAR(data_savings_percent, test.expected_savings_percent, 0.01); - } -} - IN_PROC_BROWSER_TEST_F(DataSaverSiteBreakdownMetricsObserverBrowserTest, NavigateToSimplePage) { // The test assumes pages gets deleted after navigation, triggering histogram
diff --git a/chrome/browser/password_manager/password_generation_interactive_uitest.cc b/chrome/browser/password_manager/password_generation_interactive_uitest.cc index 955a8e7..3891adc 100644 --- a/chrome/browser/password_manager/password_generation_interactive_uitest.cc +++ b/chrome/browser/password_manager/password_generation_interactive_uitest.cc
@@ -408,16 +408,8 @@ content::test::PrerenderTestHelper prerender_helper_; }; -// TODO(https://crbug.com/1287785): Fails on the linux-wayland-rel bot. -#if defined(OZONE_PLATFORM_WAYLAND) -#define MAYBE_PasswordGenerationPopupControllerInPrerendering \ - DISABLED_PasswordGenerationPopupControllerInPrerendering -#else -#define MAYBE_PasswordGenerationPopupControllerInPrerendering \ - PasswordGenerationPopupControllerInPrerendering -#endif IN_PROC_BROWSER_TEST_F(PasswordGenerationPopupViewPrerenderingTest, - MAYBE_PasswordGenerationPopupControllerInPrerendering) { + PasswordGenerationPopupControllerInPrerendering) { // Open popup. FocusPasswordField(); EXPECT_TRUE(GenerationPopupShowing());
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc index 94611957..fa54a7b 100644 --- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc +++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc
@@ -58,7 +58,6 @@ #include "chrome/test/base/ui_test_utils.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/language/core/browser/pref_names.h" #include "components/no_state_prefetch/browser/no_state_prefetch_handle.h"
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.cc index 0b64f4b..fcef48f 100644 --- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.cc +++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.cc
@@ -16,7 +16,6 @@ #include "base/strings/string_split.h" #include "chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_features.h" #include "chrome/common/chrome_features.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/prefs/pref_service.h" #include "components/unified_consent/url_keyed_data_collection_consent_helper.h"
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.cc index 00e011ba..4f1d5f3 100644 --- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.cc +++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.cc
@@ -9,7 +9,6 @@ #include "base/rand_util.h" #include "base/time/default_clock.h" #include "chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "google_apis/google_api_keys.h" #include "net/base/host_port_pair.h" #include "net/base/proxy_server.h"
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 0e18a26..21de513 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -240,11 +240,14 @@ #include "ui/base/resource/resource_bundle.h" #endif +#if BUILDFLAG(IS_CHROMEOS) +#include "chrome/browser/chromeos/arc/open_with_menu.h" +#endif + #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_features.h" #include "ash/public/cpp/clipboard_history_controller.h" #include "chrome/browser/ash/arc/arc_util.h" -#include "chrome/browser/ash/arc/intent_helper/open_with_menu.h" #include "chrome/browser/ash/arc/intent_helper/start_smart_selection_action_menu.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h" #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_factory.h" @@ -1465,7 +1468,7 @@ } void RenderViewContextMenu::AppendOpenWithLinkItems() { -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) open_with_menu_observer_ = std::make_unique<arc::OpenWithMenu>(browser_context_, this); observers_.AddObserver(open_with_menu_observer_.get());
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.h b/chrome/browser/renderer_context_menu/render_view_context_menu.h index 276703e..9d35bb2 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h
@@ -345,9 +345,12 @@ spelling_options_submenu_observer_; #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) // An observer that handles "Open with <app>" items. std::unique_ptr<RenderViewContextMenuObserver> open_with_menu_observer_; +#endif + +#if BUILDFLAG(IS_CHROMEOS_ASH) // An observer that handles smart text selection action items. std::unique_ptr<RenderViewContextMenuObserver> start_smart_selection_action_menu_observer_;
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc index 60a8cb91..1a816cef 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
@@ -54,7 +54,6 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/search_test_utils.h" #include "chrome/test/base/ui_test_utils.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/guest_view/browser/guest_view_manager_delegate.h" #include "components/guest_view/browser/test_guest_view_manager.h"
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing.js index ca3cfbd..090a2e013 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing.js
@@ -462,7 +462,7 @@ this.handleSpeech_( cur, prev, startLine, endLine, prevStartLine, prevEndLine, baseLineOnStart, intents); - this.handleBraille_(); + this.handleBraille_(baseLineOnStart); } /** @@ -601,27 +601,26 @@ // Speech requires many more states than braille. const curExtent = baseLineOnStart ? startLine : endLine; - let text = ''; let suffixMsg = ''; if (curBase.isBeforeLine(curExtent)) { // Forward selection. if (prev.isBeforeLine(curBase)) { // Wrapped across the baseline. Read out the new selection. suffixMsg = 'selected'; - text = this.getTextSelection_( + this.speakTextSelection_( curBase.startContainer, curBase.localStartOffset, curExtent.endContainer, curExtent.localEndOffset); } else { if (prev.isBeforeLine(curExtent)) { // Grew. suffixMsg = 'selected'; - text = this.getTextSelection_( + this.speakTextSelection_( prev.endContainer, prev.localEndOffset, curExtent.endContainer, curExtent.localEndOffset); } else { // Shrank. suffixMsg = 'unselected'; - text = this.getTextSelection_( + this.speakTextSelection_( curExtent.endContainer, curExtent.localEndOffset, prev.endContainer, prev.localEndOffset); } @@ -631,35 +630,33 @@ if (curBase.isBeforeLine(prev)) { // Wrapped across the baseline. Read out the new selection. suffixMsg = 'selected'; - text = this.getTextSelection_( + this.speakTextSelection_( curExtent.startContainer, curExtent.localStartOffset, curBase.endContainer, curBase.localEndOffset); } else { if (curExtent.isBeforeLine(prev)) { // Grew. suffixMsg = 'selected'; - text = this.getTextSelection_( + this.speakTextSelection_( curExtent.startContainer, curExtent.localStartOffset, prev.startContainer, prev.localStartOffset); } else { // Shrank. suffixMsg = 'unselected'; - text = this.getTextSelection_( + this.speakTextSelection_( prev.startContainer, prev.localStartOffset, curExtent.startContainer, curExtent.localStartOffset); } } } - ChromeVox.tts.speak(text, QueueMode.CATEGORY_FLUSH); ChromeVox.tts.speak(Msgs.getMsg(suffixMsg), QueueMode.QUEUE); } else if (!cur.hasCollapsedSelection()) { // Without any other information, try describing the selection. This state // catches things like select all. - const text = this.getTextSelection_( + this.speakTextSelection_( cur.startContainer, cur.localStartOffset, cur.endContainer, cur.localEndOffset); - ChromeVox.tts.speak(text, QueueMode.CATEGORY_FLUSH); ChromeVox.tts.speak(Msgs.getMsg('selected'), QueueMode.QUEUE); } else { // A catch-all for any other transitions. @@ -673,8 +670,13 @@ this.updateIntraLineState_(cur); } - /** @private */ - handleBraille_() { + /** + * @param {boolean} baseLineOnStart When true, the brailled line will show + * ancestry context based on the start of the selection. When false, it + * will use the end of the selection. + * @private + */ + handleBraille_(baseLineOnStart) { const isFirstLine = this.isSelectionOnFirstLine(); const cur = this.line_; if (cur.value === null) { @@ -713,7 +715,7 @@ }); // Provide context for the current selection. - const context = cur.startContainer; + const context = baseLineOnStart ? cur.startContainer : cur.endContainer; if (context && context.role !== RoleType.TEXT_FIELD) { const output = new Output().suppress('name').withBraille( Range.fromNode(context), Range.fromNode(this.node_), @@ -751,37 +753,19 @@ * @param {number} startOffset * @param {AutomationNode|undefined} endNode * @param {number} endOffset - * @return {string} */ - getTextSelection_(startNode, startOffset, endNode, endOffset) { + speakTextSelection_(startNode, startOffset, endNode, endOffset) { if (!startNode || !endNode) { - return ''; + return; } - if (startNode === endNode) { - return startNode.name ? startNode.name.substring(startOffset, endOffset) : - ''; - } + const selectedRange = new Range( + new Cursor(startNode, startOffset), new Cursor(endNode, endOffset)); - let text = ''; - if (startNode.name) { - text = startNode.name.substring(startOffset); - } - - for (let node = startNode; - (node = AutomationUtil.findNextNode( - node, Dir.FORWARD, AutomationPredicate.leafOrStaticText)) && - node !== endNode;) { - // Padding needs to get added to break up speech utterances. - if (node.name) { - text += ' ' + node.name; - } - } - - if (endNode.name) { - text += ' ' + endNode.name.substring(0, endOffset); - } - return text; + new Output() + .withRichSpeech( + selectedRange, Range.fromNode(this.node_), OutputEventType.NAVIGATE) + .go(); } /**
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing_test.js index ef52b5e..f5a57f3f 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing_test.js
@@ -210,7 +210,7 @@ if (char == 0) { dir = 'forward'; } - if (line == 16) { + if (char == 16) { dir = 'backward'; } }, true); @@ -724,23 +724,19 @@ .expectSpeech('1', 'added to selection') .expectBraille('11111 line\nmled', {startIndex: 0, endIndex: 2}) - // Forward selection. - - // Growing. - - // By line (notice the partial selections from the first and - // second lines). + // Forward selection by line (notice the partial selections from the + // first and second lines). .call(move) - .expectSpeech('111 line \n 22', 'selected') + .expectSpeech('111 line', '22', 'selected') .expectBraille('22222 line\n', {startIndex: 0, endIndex: 2}) .call(move) - .expectSpeech('222 line \n 33', 'selected') + .expectSpeech('222 line', '33', 'selected') .expectBraille('33333 line\n', {startIndex: 0, endIndex: 2}) - // Shrinking. + // Backward selection by line. .call(move) - .expectSpeech('222 line \n 33', 'unselected') + .expectSpeech('222 line', '33', 'unselected') .expectBraille('22222 line\n', {startIndex: 0, endIndex: 2}) .call(move) @@ -749,8 +745,7 @@ // Document boundary. .call(move) - .expectSpeech( - '111 line \n 22222 line \n 33333 line \n \n', 'selected') + .expectSpeech('111 line', '22222 line', '33333 line', 'selected') .expectBraille('33333 line\n', {startIndex: 0, endIndex: 10}) // The script repositions the caret to the 'n' of the third line. @@ -768,22 +763,132 @@ // Growing. .call(move) - .expectSpeech('ne \n 33333 li', 'selected') + .expectSpeech('ne', '33333 li', 'selected') .expectBraille('22222 line\n', {startIndex: 8, endIndex: 11}) .call(move) - .expectSpeech('ne \n 22222 li', 'selected') + .expectSpeech('ne', '22222 li', 'selected') .expectBraille('11111 line\n', {startIndex: 8, endIndex: 11}) // Shrinking. .call(move) - .expectSpeech('ne \n 22222 li', 'unselected') + .expectSpeech('ne', '22222 li', 'unselected') .expectBraille('22222 line\n', {startIndex: 8, endIndex: 11}) .replay(); }); }); +TEST_F('ChromeVoxEditingTest', 'RichTextSelectComplexStructure', function() { + const mockFeedback = this.createMockFeedback(); + this.runWithLoadedTree( + ` + <div> + <button id="go">Go</button> + </div> + <div contenteditable role=textbox> + <h1>11111 line</h1> + <a href=#>22222 line</a> + <ol><li>33333 line</li></ol> + </p> + <script> + let commands = [ + ['extend', 'forward', 'character'], + ['extend', 'forward', 'character'], + + ['extend', 'forward', 'line'], + ['extend', 'forward', 'line'], + + ['extend', 'backward', 'line'], + ['extend', 'backward', 'line'], + + ['extend', 'forward', 'documentBoundary'], + + ['move', 'forward', 'character'], + ['move', 'backward', 'character'], + ['move', 'backward', 'character'], + + ['extend', 'backward', 'line'], + ['extend', 'backward', 'line'], + + ['extend', 'forward', 'line'], + ]; + document.getElementById('go').addEventListener('click', function() { + let sel = getSelection(); + sel.modify.apply(sel, commands.shift()); + }, true); + </script> + `, + async function(root) { + await this.focusFirstTextField(root, {role: RoleType.TEXT_FIELD}); + + const go = root.find({role: RoleType.BUTTON}); + const move = go.doDefault.bind(go); + + // By character. + mockFeedback.call(move) + .expectSpeech('1', 'selected') + .expectBraille('11111 line h1 mled', {startIndex: 0, endIndex: 1}) + .call(move) + .expectSpeech('1', 'added to selection') + .expectBraille('11111 line h1 mled', {startIndex: 0, endIndex: 2}) + + // Forward selection by line (notice the partial selections from the + // first and second lines). + .call(move) + .expectSpeech('111 line', 'Heading 1', '222', 'Link', 'selected') + .expectBraille('22222 line lnk', {startIndex: 0, endIndex: 3}) + + .call(move) + .expectSpeech('22 line', 'Link', 'selected') + .expectBraille( + '33333 line 1. lstitm lst +1', {startIndex: 0, endIndex: 0}) + + // Shrinking. + .call(move) + .expectSpeech('22 line', 'Link', 'unselected') + .expectBraille('22222 line lnk', {startIndex: 0, endIndex: 3}) + + .call(move) + .expectSpeech('11', 'Heading 1', 'selected') + .expectBraille('11111 line h1 mled', {startIndex: 0, endIndex: 2}) + + // Document boundary. + .call(move) + .expectSpeech( + '111 line', 'Heading 1', '22222 line', 'Link', '33333 line', + 'List item', 'selected') + .expectBraille( + '33333 line 1. lstitm lst +1', {startIndex: 0, endIndex: 10}) + + // The script repositions the caret to the end of the last line. + .call(move) + .expectSpeech('End of text') + .expectBraille( + '33333 line 1. lstitm lst +1', {startIndex: 10, endIndex: 10}) + .call(move) + .expectSpeech('e') + .expectBraille( + '33333 line 1. lstitm lst +1', {startIndex: 9, endIndex: 9}) + .call(move) + .expectSpeech('n') + .expectBraille( + '33333 line 1. lstitm lst +1', {startIndex: 8, endIndex: 8}) + + // Backward selection. + // Some bugs exist in Blink where we don't get all selection events + // in this complex structure via extending selection, so we do it + // twice. + .call(move) + .call(move) + .expectSpeech('ine', 'Link') + .expectSpeech('33333 li', 'List item', 'selected') + .expectBraille('11111 line h1', {startIndex: 7, endIndex: 10}) + + .replay(); + }); +}); + TEST_F('ChromeVoxEditingTest', 'EditableLineOneStaticText', function() { this.runWithLoadedTree( ` @@ -1314,15 +1419,15 @@ mockFeedback.call(this.press(KeyCode.END, {ctrl: true})) .expectSpeech('third line') .call(this.press(KeyCode.A, {ctrl: true})) - .expectSpeech('first line second line third line', 'selected') + .expectSpeech('first line', 'second line', 'third line', 'selected') .call(this.press(KeyCode.UP)) .expectSpeech('second line') .call(this.press(KeyCode.A, {ctrl: true})) - .expectSpeech('first line second line third line', 'selected') + .expectSpeech('first line', 'second line', 'third line', 'selected') .call(this.press(KeyCode.HOME, {ctrl: true})) .expectSpeech('first line') .call(this.press(KeyCode.A, {ctrl: true})) - .expectSpeech('first line second line third line', 'selected') + .expectSpeech('first line', 'second line', 'third line', 'selected') .replay(); }); });
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js index 7b69227..1c1cea68 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/output/output.js
@@ -1681,8 +1681,8 @@ (this.contextOrder_ === OutputContextOrder.DIRECTED && !isForward); const preferStartOrEndAncestry = this.contextOrder_ === OutputContextOrder.FIRST_AND_LAST; - let cursor = cursors.Cursor.fromNode(range.start.node); let prevNode = prevRange.start.node; + let node = range.start.node; const formatNodeAndAncestors = function(node, prevNode) { const buff = []; @@ -1714,17 +1714,57 @@ prevNode = lca || prevNode; } - const unit = range.isInlineText() ? cursors.Unit.TEXT : cursors.Unit.NODE; - while (cursor.node && range.end.node && - AutomationUtil.getDirection(cursor.node, range.end.node) === - Dir.FORWARD) { - const node = cursor.node; - rangeBuff.push.apply(rangeBuff, formatNodeAndAncestors(node, prevNode)); + // Do some bookkeeping to see whether this range partially covers node(s) at + // its endpoints. + let hasPartialNodeStart = false; + let hasPartialNodeEnd = false; + if (AutomationPredicate.selectableText(range.start.node) && + range.start.index > 0) { + hasPartialNodeStart = true; + } + + if (AutomationPredicate.selectableText(range.end.node) && + range.end.index >= 0 && range.end.index < range.end.node.name.length) { + hasPartialNodeEnd = true; + } + + let pred; + if (range.isInlineText()) { + pred = AutomationPredicate.leaf; + } else if (hasPartialNodeStart || hasPartialNodeEnd) { + pred = AutomationPredicate.selectableText; + } else { + pred = AutomationPredicate.object; + } + + // Computes output for nodes (including partial subnodes) between endpoints + // of |range|. + while (node && range.end.node && + AutomationUtil.getDirection(node, range.end.node) === Dir.FORWARD) { + if (hasPartialNodeStart && node === range.start.node) { + if (range.start.index !== range.start.node.name.length) { + const partialRange = new cursors.Range( + new cursors.Cursor(node, range.start.index), + new cursors.Cursor( + node, node.name.length, {preferNodeStartEquivalent: true})); + this.subNode_(partialRange, prevRange, type, rangeBuff, ruleStr); + } + } else if (hasPartialNodeEnd && node === range.end.node) { + if (range.end.index !== 0) { + const partialRange = new cursors.Range( + new cursors.Cursor(node, 0), + new cursors.Cursor(node, range.end.index)); + this.subNode_(partialRange, prevRange, type, rangeBuff, ruleStr); + } + } else { + rangeBuff.push.apply(rangeBuff, formatNodeAndAncestors(node, prevNode)); + } + prevNode = node; - cursor = cursor.move(unit, cursors.Movement.DIRECTIONAL, Dir.FORWARD); + node = AutomationUtil.findNextNode(node, Dir.FORWARD, pred) || prevNode; // Reached a boundary. - if (cursor.node === prevNode) { + if (node === prevNode) { break; } }
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/common/editable_text_base.js b/chrome/browser/resources/chromeos/accessibility/chromevox/common/editable_text_base.js index 9b0b091..b13c3a1 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/common/editable_text_base.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/common/editable_text_base.js
@@ -319,8 +319,10 @@ if (evt.start === evt.end) { // It's currently a cursor. if (this.start !== this.end) { - // It was previously a selection, so just announce 'unselected'. - this.speak(Msgs.getMsg('Unselected'), evt.triggeredByUser); + // It was previously a selection. + this.speak( + this.value.substring(this.start, this.end), evt.triggeredByUser); + this.speak(Msgs.getMsg('removed_from_selection')); } else if ( this.getLineIndex(this.start) !== this.getLineIndex(evt.start)) { // Moved to a different line; read it.
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/common/editable_text_base_test.js b/chrome/browser/resources/chromeos/accessibility/chromevox/common/editable_text_base_test.js index 1bbac53..d5d0ff3 100644 --- a/chrome/browser/resources/chromeos/accessibility/chromevox/common/editable_text_base_test.js +++ b/chrome/browser/resources/chromeos/accessibility/chromevox/common/editable_text_base_test.js
@@ -224,7 +224,7 @@ obj.changed(new TextChangeEvent('Hello, world.', 2, 5)); assertEqualStringArrays(['llo', 'selected'], tts.get()); obj.changed(new TextChangeEvent('Hello, world.', 2, 2)); - assertEqualStringArrays(['Unselected'], tts.get()); + assertEqualStringArrays(['llo', 'removed_from_selection'], tts.get()); }); @@ -256,7 +256,7 @@ // The user presses right-arrow, which fully unselects the remaining text. obj.changed(new TextChangeEvent('google.com', 10, 10)); - assertEqualStringArrays(['Unselected'], tts.get()); + assertEqualStringArrays(['le.com', 'removed_from_selection'], tts.get()); // The user types '/' obj.changed(new TextChangeEvent('google.com/', 11, 11)); @@ -276,7 +276,7 @@ // The user presses right-arrow to accept the completion. obj.changed(new TextChangeEvent('google.com/firefox', 18, 18)); - assertEqualStringArrays(['Unselected'], tts.get()); + assertEqualStringArrays(['efox', 'removed_from_selection'], tts.get()); }); @@ -306,7 +306,7 @@ // Click between 'r' and 'i'. obj.changed(new TextChangeEvent('Arizona', 2, 2)); - assertEqualStringArrays(['Unselected'], tts.get()); + assertEqualStringArrays(['Arizona', 'removed_from_selection'], tts.get()); // Next character removed from selection. obj.changed(new TextChangeEvent('Arizona', 2, 7));
diff --git a/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js b/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js index c7ca9206..338b2fc 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js +++ b/chrome/browser/resources/chromeos/accessibility/common/automation_predicate.js
@@ -916,4 +916,14 @@ */ AutomationPredicate.text = AutomationPredicate.roles( [Role.STATIC_TEXT, Role.INLINE_TEXT_BOX, Role.LINE_BREAK]); + +/** + * Matches against selecteable text like nodes. + * @param {!AutomationNode} node + * @return {boolean} + */ +AutomationPredicate.selectableText = AutomationPredicate.roles([ + Role.STATIC_TEXT, Role.INLINE_TEXT_BOX, Role.LINE_BREAK, Role.LIST_MARKER +]); + }); // goog.scope
diff --git a/chrome/browser/resources/chromeos/accessibility/common/cursors/cursor.js b/chrome/browser/resources/chromeos/accessibility/common/cursors/cursor.js index 1b0c52b6..e7d3c03 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/cursors/cursor.js +++ b/chrome/browser/resources/chromeos/accessibility/common/cursors/cursor.js
@@ -83,12 +83,18 @@ * accessible name. An index of |cursors.NODE_INDEX| means the node as a * whole is pointed to and covers the case where the accessible text is * empty. - * @param {{wrapped: (boolean|undefined)}} args + * @param {{wrapped: (boolean|undefined), + * preferNodeStartEquivalent: (boolean|undefined)}} args + * wrapped: determines whether this cursor wraps when moved beyond a + * document boundary. + * preferNodeStartEquivalent: When true,moves this cursor to the start of + * the next node when it points to the end of the current node. */ constructor(node, index, args = {}) { // Compensate for specific issues in Blink. // TODO(dtseng): Pass through affinity; if upstream, skip below. - if (node.role === RoleType.STATIC_TEXT && node.name.length === index) { + if (node.role === RoleType.STATIC_TEXT && node.name.length === index && + !args.preferNodeStartEquivalent) { // Re-interpret this case as the beginning of the next node. const nextNode = AutomationUtil.findNextNode( node, Dir.FORWARD, AutomationPredicate.leafOrStaticText);
diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn index e1a706a8..f3b6a5e 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn
@@ -3,8 +3,8 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") -import("//build/config/crypto.gni") import("//chrome/common/features.gni") +import("//crypto/features.gni") import("//third_party/closure_compiler/compile_js.gni") import("//tools/grit/grit_rule.gni") import("//tools/grit/preprocess_if_expr.gni") @@ -120,12 +120,14 @@ } preprocess_if_expr("preprocess") { + defines = chrome_grit_defines in_folder = "./" out_folder = "$target_gen_dir/$preprocess_folder" in_files = non_webcomponent_files } preprocess_if_expr("preprocess_generated") { + defines = chrome_grit_defines deps = [ ":web_components" ] in_folder = target_gen_dir out_folder = "$target_gen_dir/$preprocess_folder"
diff --git a/chrome/browser/resources/settings/chromeos/internet_page/cellular_networks_list.js b/chrome/browser/resources/settings/chromeos/internet_page/cellular_networks_list.js index 9a616be..d7c06a10 100644 --- a/chrome/browser/resources/settings/chromeos/internet_page/cellular_networks_list.js +++ b/chrome/browser/resources/settings/chromeos/internet_page/cellular_networks_list.js
@@ -232,7 +232,7 @@ created() { this.networkConfig_ = MojoInterfaceProviderImpl.getInstance().getMojoServiceRemote(); - this.fetchESimPendingProfileList_(); + this.fetchEuiccAndESimPendingProfileList_(); }, /** @override */ @@ -258,7 +258,7 @@ * ESimManagerListenerBehavior override */ onAvailableEuiccListChanged() { - this.fetchESimPendingProfileList_(); + this.fetchEuiccAndESimPendingProfileList_(); }, /** @@ -282,12 +282,21 @@ }, /** @private */ - fetchESimPendingProfileList_() { + fetchEuiccAndESimPendingProfileList_() { getEuicc().then(euicc => { if (!euicc) { return; } this.euicc_ = euicc; + + // Restricting managed cellular network should not show pending eSIM + // profiles. + if (this.isESimPolicyEnabled_ && this.globalPolicy && + this.globalPolicy.allowOnlyPolicyCellularNetworks) { + this.eSimPendingProfileItems_ = []; + return; + } + this.fetchESimPendingProfileListForEuicc_(euicc); }); },
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_page.ts b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_page.ts index c58f8e1d..cba5970 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_page.ts +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_page.ts
@@ -28,6 +28,7 @@ import {afterNextRender, html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {HatsBrowserProxyImpl, TrustSafetyInteraction} from '../../hats_browser_proxy.js'; +import {loadTimeData} from '../../i18n_setup.js'; import {MetricsBrowserProxy, MetricsBrowserProxyImpl, PrivacyGuideInteractions} from '../../metrics_browser_proxy.js'; import {SyncBrowserProxy, SyncBrowserProxyImpl, SyncStatus} from '../../people_page/sync_browser_proxy.js'; import {PrefsMixin, PrefsMixinInterface} from '../../prefs/prefs_mixin.js'; @@ -396,8 +397,15 @@ } } else { if (this.animationsEnabled_ && playAnimation) { + // In the LTR mode, the user scrolls LTR, and the animation makes it + // the next page slide in RTL. If the user scrolls back or if + // the display mode is RTL, the animation is inverted. + const ltr = isBackwardNavigation === + (loadTimeData.getString('textdirection') === 'ltr'); this.$.viewManager.switchView( - this.privacyReviewStep_, 'slide-in-fade-in', 'no-animation'); + this.privacyReviewStep_, + ltr ? 'slide-in-fade-in-ltr' : 'slide-in-fade-in-rtl', + 'no-animation'); } else { this.$.viewManager.switchView( this.privacyReviewStep_, 'no-animation', 'no-animation');
diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc index 341958e..8389ee0b 100644 --- a/chrome/browser/ssl/ssl_browsertest.cc +++ b/chrome/browser/ssl/ssl_browsertest.cc
@@ -199,7 +199,7 @@ #include "third_party/blink/public/common/web_preferences/web_preferences.h" #include "ui/base/l10n/l10n_util.h" -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "chrome/browser/certificate_manager_model.h" #include "chrome/browser/net/nss_service.h" #include "chrome/browser/net/nss_service_factory.h" @@ -208,7 +208,7 @@ #include "crypto/scoped_test_nss_db.h" #include "net/cert/nss_cert_database.h" #include "net/cert/x509_util_nss.h" -#endif // defined(USE_NSS_CERTS) +#endif // BUILDFLAG(USE_NSS_CERTS) #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_switches.h" @@ -1961,7 +1961,7 @@ // and is never called from Lacros-Chrome. This should be revisited when there // is a solution for the client certificates settings page on Lacros-Chrome. #if !BUILDFLAG(IS_CHROMEOS_LACROS) -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) class SSLUITestWithClientCert : public SSLUITestBase { public: SSLUITestWithClientCert() : cert_db_(nullptr) {} @@ -2053,7 +2053,7 @@ const std::u16string result = watcher.WaitAndGetTitle(); EXPECT_TRUE(base::LowerCaseEqualsASCII(result, "pass")); } -#endif // defined(USE_NSS_CERTS) +#endif // BUILDFLAG(USE_NSS_CERTS) #endif // !BUILDFLAG(IS_CHROMEOS_LACROS) // A stub ClientCertStore that returns a FakeClientCertIdentity.
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 7602729..df174d7 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -6,7 +6,6 @@ import("//build/config/chromecast_build.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/compiler/compiler.gni") -import("//build/config/crypto.gni") import("//build/config/features.gni") import("//build/config/linux/gtk/gtk.gni") import("//build/config/ozone.gni") @@ -20,6 +19,7 @@ import("//components/nacl/features.gni") import("//components/offline_pages/buildflags/features.gni") import("//components/signin/features.gni") +import("//crypto/features.gni") import("//device/vr/buildflags/buildflags.gni") import("//extensions/buildflags/buildflags.gni") import("//pdf/features.gni") @@ -762,8 +762,6 @@ "android/infobars/autofill_offer_notification_infobar.h", "android/infobars/autofill_save_card_infobar.cc", "android/infobars/autofill_save_card_infobar.h", - "android/infobars/data_reduction_promo_infobar.cc", - "android/infobars/data_reduction_promo_infobar.h", "android/infobars/download_progress_infobar.cc", "android/infobars/download_progress_infobar.h", "android/infobars/duplicate_download_infobar.cc", @@ -1976,6 +1974,8 @@ "app_list/search/os_settings_provider.h", "app_list/search/ranking/answer_ranker.cc", "app_list/search/ranking/answer_ranker.h", + "app_list/search/ranking/best_match_ranker.cc", + "app_list/search/ranking/best_match_ranker.h", "app_list/search/ranking/constants.h", "app_list/search/ranking/filtering_ranker.cc", "app_list/search/ranking/filtering_ranker.h", @@ -1993,8 +1993,6 @@ "app_list/search/ranking/removed_results_ranker.h", "app_list/search/ranking/score_normalizing_ranker.cc", "app_list/search/ranking/score_normalizing_ranker.h", - "app_list/search/ranking/top_match_ranker.cc", - "app_list/search/ranking/top_match_ranker.h", "app_list/search/ranking/types.cc", "app_list/search/ranking/types.h", "app_list/search/ranking/util.cc",
diff --git a/chrome/browser/ui/android/infobars/data_reduction_promo_infobar.cc b/chrome/browser/ui/android/infobars/data_reduction_promo_infobar.cc deleted file mode 100644 index a5273b7..0000000 --- a/chrome/browser/ui/android/infobars/data_reduction_promo_infobar.cc +++ /dev/null
@@ -1,45 +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. - -#include "chrome/browser/ui/android/infobars/data_reduction_promo_infobar.h" - -#include <memory> -#include <utility> - -#include "base/android/jni_android.h" -#include "base/android/jni_string.h" -#include "chrome/browser/android/resource_mapper.h" -#include "chrome/browser/data_reduction_proxy/data_reduction_promo_infobar_delegate_android.h" -#include "content/public/browser/web_contents.h" - -// DataReductionPromoInfoBar -------------------------------------------------- - -DataReductionPromoInfoBar::DataReductionPromoInfoBar( - std::unique_ptr<DataReductionPromoInfoBarDelegateAndroid> delegate) - : infobars::ConfirmInfoBar(std::move(delegate)) {} - -DataReductionPromoInfoBar::~DataReductionPromoInfoBar() { -} - -base::android::ScopedJavaLocalRef<jobject> -DataReductionPromoInfoBar::CreateRenderInfoBar( - JNIEnv* env, - const ResourceIdMapper& resource_id_mapper) { - return GetDelegate()->CreateRenderInfoBar(env); -} - -DataReductionPromoInfoBarDelegateAndroid* -DataReductionPromoInfoBar::GetDelegate() { - return static_cast<DataReductionPromoInfoBarDelegateAndroid*>(delegate()); -} - -// DataReductionPromoInfoBarDelegate ------------------------------------------ - -// static -std::unique_ptr<infobars::InfoBar> -DataReductionPromoInfoBarDelegateAndroid::CreateInfoBar( - infobars::InfoBarManager* infobar_manager, - std::unique_ptr<DataReductionPromoInfoBarDelegateAndroid> delegate) { - return std::make_unique<DataReductionPromoInfoBar>(std::move(delegate)); -}
diff --git a/chrome/browser/ui/android/infobars/data_reduction_promo_infobar.h b/chrome/browser/ui/android/infobars/data_reduction_promo_infobar.h deleted file mode 100644 index 8af86c1..0000000 --- a/chrome/browser/ui/android/infobars/data_reduction_promo_infobar.h +++ /dev/null
@@ -1,31 +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. - -#ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_DATA_REDUCTION_PROMO_INFOBAR_H_ -#define CHROME_BROWSER_UI_ANDROID_INFOBARS_DATA_REDUCTION_PROMO_INFOBAR_H_ - -#include "chrome/browser/data_reduction_proxy/data_reduction_promo_infobar_delegate_android.h" -#include "components/infobars/android/confirm_infobar.h" - -class DataReductionPromoInfoBar : public infobars::ConfirmInfoBar { - public: - explicit DataReductionPromoInfoBar( - std::unique_ptr<DataReductionPromoInfoBarDelegateAndroid> delegate); - - DataReductionPromoInfoBar(const DataReductionPromoInfoBar&) = delete; - DataReductionPromoInfoBar& operator=(const DataReductionPromoInfoBar&) = - delete; - - ~DataReductionPromoInfoBar() override; - - private: - // ConfirmInfoBar: - base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar( - JNIEnv* env, - const ResourceIdMapper& resource_id_mapper) override; - - DataReductionPromoInfoBarDelegateAndroid* GetDelegate(); -}; - -#endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_DATA_REDUCTION_PROMO_INFOBAR_H_
diff --git a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_book_round.xml b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_book_round.xml index 4093b05..60011611 100644 --- a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_book_round.xml +++ b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_book_round.xml
@@ -9,9 +9,8 @@ android:viewportWidth="36" android:width="24dp"> <path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd" android:pathData="M18,1L18,1C27.9411,1 36,9.0589 36,19L36,19C36,28.9411 27.9411,37 18,37L18,37C8.0589,37 0,28.9411 0,19L0,19C-0,9.0589 8.0589,1 18,1Z" /> - <path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero" + <path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero" android:pathData="M24,9L12,9C10.9,9 10,9.9 10,11L10,27C10,28.1 10.9,29 12,29L24,29C25.1,29 26,28.1 26,27L26,11C26,9.9 25.1,9 24,9Z" /> <path android:fillColor="@macro/default_control_color_active" android:fillType="nonZero" android:pathData="M24,27l-12,0l0,-16l2,0l0,8l2.5,-1.5l2.5,1.5l0,-8l5,0z" /> </vector> -
diff --git a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_equals_sign_round.xml b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_equals_sign_round.xml index eda28b35..4e03751 100644 --- a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_equals_sign_round.xml +++ b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_equals_sign_round.xml
@@ -9,6 +9,6 @@ android:viewportWidth="36" android:width="24dp"> <path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd" android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" /> - <path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero" + <path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero" android:pathData="M10,14L26,14L26,17L10,17L10,14ZM10,19L26,19L26,22L10,22L10,19Z" /> </vector>
diff --git a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_event_round.xml b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_event_round.xml index 4c70350..f825033 100644 --- a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_event_round.xml +++ b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_event_round.xml
@@ -8,10 +8,10 @@ android:viewportWidth="36" android:width="24dp"> <path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd" android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" /> - <path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero" + <path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero" android:pathData="M25,10L24,10L24,8L22,8L22,10L14,10L14,8L12,8L12,10L11,10C9.89,10 9.01,10.9 9.01,12L9,26C9,27.1 9.89,28 11,28L25,28C26.1,28 27,27.1 27,26L27,12C27,10.9 26.1,10 25,10Z" /> <path android:fillColor="@macro/default_control_color_active" android:fillType="nonZero" android:pathData="M25,26l-14,0l0,-10l14,0z" /> - <path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero" + <path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero" android:pathData="M20.5,19L20.5,19C19.12,19 18,20.12 18,21.5L18,21.5C18,22.88 19.12,24 20.5,24L20.5,24C21.88,24 23,22.88 23,21.5L23,21.5C23,20.12 21.88,19 20.5,19Z" /> </vector>
diff --git a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_loop_round.xml b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_loop_round.xml index 39ef407..798af8a 100644 --- a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_loop_round.xml +++ b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_loop_round.xml
@@ -9,6 +9,6 @@ android:viewportWidth="36" android:width="24dp"> <path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd" android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" /> - <path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero" + <path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero" android:pathData="M18,12L18,15L22,11L18,7L18,10C13.58,10 10,13.58 10,18C10,19.57 10.46,21.03 11.24,22.26L12.7,20.8C12.25,19.97 12,19.01 12,18C12,14.69 14.69,12 18,12ZM24.76,13.74L23.3,15.2C23.74,16.04 24,16.99 24,18C24,21.31 21.31,24 18,24L18,21L14,25L18,29L18,26C22.42,26 26,22.42 26,18C26,16.43 25.54,14.97 24.76,13.74Z" /> </vector>
diff --git a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_swap_vert_round.xml b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_swap_vert_round.xml index d5fc9944..de4fc68 100644 --- a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_swap_vert_round.xml +++ b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_swap_vert_round.xml
@@ -9,6 +9,6 @@ android:viewportWidth="36" android:width="24dp"> <path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd" android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" /> - <path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero" + <path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero" android:pathData="M22,23.01L22,16L20,16L20,23.01L17,23.01L21,27L25,23.01L22,23.01ZM15,9L11,12.99L14,12.99L14,20L16,20L16,12.99L19,12.99L15,9Z" /> </vector>
diff --git a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_wb_sunny_round.xml b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_wb_sunny_round.xml index 10b94b2..3cb32c3 100644 --- a/chrome/browser/ui/android/omnibox/java/res/drawable/ic_wb_sunny_round.xml +++ b/chrome/browser/ui/android/omnibox/java/res/drawable/ic_wb_sunny_round.xml
@@ -9,6 +9,6 @@ android:viewportWidth="36" android:width="24dp"> <path android:fillColor="@macro/default_control_color_active" android:fillType="evenOdd" android:pathData="M18,0L18,0C27.9411,-0 36,8.0589 36,18L36,18C36,27.9411 27.9411,36 18,36L18,36C8.0589,36 0,27.9411 0,18L0,18C-0,8.0589 8.0589,0 18,0Z" /> - <path android:fillColor="?attr/default_icon_color_inverse" android:fillType="nonZero" + <path android:fillColor="@macro/default_icon_color_inverse" android:fillType="nonZero" android:pathData="M12.76,11.29L10.96,9.5L9.55,10.91L11.34,12.7L12.76,11.29ZM10,16.95L7,16.95L7,18.95L10,18.95L10,16.95ZM19,7L17,7L17,9.95L19,9.95L19,7ZM26.45,10.91L25.04,9.5L23.25,11.29L24.66,12.7L26.45,10.91ZM23.24,24.61L25.03,26.41L26.44,25L24.64,23.21L23.24,24.61ZM26,16.95L26,18.95L29,18.95L29,16.95L26,16.95ZM18,11.95C14.69,11.95 12,14.64 12,17.95C12,21.26 14.69,23.95 18,23.95C21.31,23.95 24,21.26 24,17.95C24,14.64 21.31,11.95 18,11.95ZM17,28.9L19,28.9L19,25.95L17,25.95L17,28.9ZM9.55,24.99L10.96,26.4L12.75,24.6L11.34,23.19L9.55,24.99Z" /> </vector>
diff --git a/chrome/browser/ui/android/omnibox/java/res/drawable/logo_translate_round.xml b/chrome/browser/ui/android/omnibox/java/res/drawable/logo_translate_round.xml index e01e832..a468d1f 100644 --- a/chrome/browser/ui/android/omnibox/java/res/drawable/logo_translate_round.xml +++ b/chrome/browser/ui/android/omnibox/java/res/drawable/logo_translate_round.xml
@@ -15,11 +15,11 @@ /> <path android:pathData="M18.87,21.07L16.33,18.56L16.36,18.53C18.1,16.59 19.34,14.36 20.07,12L23,12L23,10L16,10L16,8L14,8L14,10L7,10L7,11.99L18.17,11.99C17.5,13.92 16.44,15.75 15,17.35C14.07,16.32 13.3,15.19 12.69,14L10.69,14C11.42,15.63 12.42,17.17 13.67,18.56L8.58,23.58L10,25L15,20L18.11,23.11L18.87,21.07Z" - android:fillColor="?attr/default_icon_color_inverse" + android:fillColor="@macro/default_icon_color_inverse" /> <path android:pathData="M24.5,16l-2,0l-4.5,12l2,0l1.12,-3l4.75,0l1.13,3l2,0z" - android:fillColor="?attr/default_icon_color_inverse" + android:fillColor="@macro/default_icon_color_inverse" /> <path android:pathData="M21.88,23l1.62,-4.33l1.62,4.33z"
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index e3560d26..dd6217e1 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -1568,41 +1568,6 @@ Reset </message> - <!-- Lite Mode Promo and FRE card --> - <message name="IDS_DATA_REDUCTION_PROMO_TITLE_LITE_MODE" desc="The title for the promo inviting users to enable Lite mode" > - Browse faster. Use less data. - </message> - <message name="IDS_DATA_REDUCTION_PROMO_SUMMARY_LITE_MODE" desc="Description for the promo inviting users to enable Lite mode. This informs users that their web traffic will sent to Google to optimize data usage. The Learn more link goes to the help center article for Lite mode." meaning="The translation of percent should be spelled out instead of using the percent symbol."> - In Lite mode, Chrome loads pages faster and uses up to 60 percent less data. To optimize the pages that you visit, Chrome sends your web traffic to Google. <ph name="BEGIN_LINK"><link></ph>Learn more<ph name="END_LINK"></link></ph> - </message> - <message name="IDS_DATA_REDUCTION_PROMO_LEARN_MORE_URL" desc="URL for Lite mode help center article" translateable="false"> - https://support.google.com/chrome/?p=lite_mode - </message> - <message name="IDS_DATA_REDUCTION_ENABLE_BUTTON_LITE_MODE" desc="Button the user presses if they want to enable Lite mode" > - Turn on Lite mode - </message> - <message name="IDS_DATA_REDUCTION_ENABLED_SWITCH_LITE_MODE" desc="Message to show when the Lite mode feature is enabled via the switch on the First Run Experience card" > - Lite mode is on - </message> - <message name="IDS_DATA_REDUCTION_DISABLED_SWITCH_LITE_MODE" desc="Message to show when the Lite mode feature is disabled via the switch on the First Run Experience card" > - Lite mode is off - </message> - <message name="IDS_DATA_REDUCTION_ENABLED_TOAST_LITE_MODE" desc="Toast message displayed after the user enables Lite mode from the promo" > - Lite mode is on. Manage it in Settings. - </message> - <message name="IDS_DATA_REDUCTION_PROMO_INFOBAR_TITLE" desc="Text to be displayed in the data reduction promo infobar title"> - Save up to 60% of your data - </message> - <message name="IDS_DATA_REDUCTION_PROMO_INFOBAR_TEXT" desc="Text to be displayed in the data reduction promo infobar"> - Google servers will optimize the pages you visit. - </message> - <message name="IDS_DATA_REDUCTION_MILESTONE_PROMO_TEXT_MB" desc="Text to be displayed in the data reduction promo message that lets the user know they saved a certain amount of data in MB"> - Chrome has saved you <ph name="megabytes">%1$d<ex>100</ex></ph> MB - </message> - <message name="IDS_DATA_REDUCTION_MILESTONE_PROMO_TEXT_GB" desc="Text to be displayed in the data reduction promo message that lets the user know they saved a certain amount of data in GB"> - Chrome has saved you <ph name="gigabytes">%1$d<ex>10</ex></ph> GB - </message> - <!-- Dangerous download --> <message name="IDS_DANGEROUS_DOWNLOAD_DIALOG_CONFIRM_TEXT" desc="Text label for the confirm button on the dangerous download dialog for user to confirm the download."> Download anyway
diff --git a/chrome/browser/ui/app_list/search/chrome_search_result.h b/chrome/browser/ui/app_list/search/chrome_search_result.h index 5caecf4..93b52088 100644 --- a/chrome/browser/ui/app_list/search/chrome_search_result.h +++ b/chrome/browser/ui/app_list/search/chrome_search_result.h
@@ -11,6 +11,7 @@ #include "ash/public/cpp/app_list/app_list_metrics.h" #include "ash/public/cpp/app_list/app_list_types.h" +#include "base/memory/weak_ptr.h" #include "chrome/browser/ui/app_list/app_list_model_updater.h" #include "chrome/browser/ui/app_list/search/ranking/types.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -182,6 +183,10 @@ base::OnceCallback<void(std::unique_ptr<ui::SimpleMenuModel>)>; virtual void GetContextMenuModel(GetMenuModelCallback callback); + base::WeakPtr<ChromeSearchResult> GetWeakPtr() { + return weak_ptr_factory_.GetWeakPtr(); + } + protected: // These id setters should be called in derived class constructors only. void set_id(const std::string& id) { metadata_->id = id; } @@ -222,6 +227,8 @@ std::unique_ptr<ash::SearchResultMetadata> metadata_; AppListModelUpdater* model_updater_ = nullptr; + + base::WeakPtrFactory<ChromeSearchResult> weak_ptr_factory_{this}; }; ::std::ostream& operator<<(::std::ostream& os,
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 d8abfde..7fa7031 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
@@ -4,6 +4,9 @@ #include "chrome/browser/ui/app_list/search/files/item_suggest_cache.h" +#include <algorithm> +#include <string> + #include "ash/public/cpp/app_list/app_list_features.h" #include "base/bind.h" #include "base/metrics/field_trial_params.h" @@ -119,11 +122,14 @@ const base::Value* value) { const auto& item_id = GetString(value, "itemId"); const auto& display_text = GetString(value, "displayText"); + const auto& prediction_reason = GetString(value, "predictionReason"); + // Allow |prediction_reason| to be nullopt. if (!item_id || !display_text) return absl::nullopt; - return ItemSuggestCache::Result(item_id.value(), display_text.value()); + return ItemSuggestCache::Result(item_id.value(), display_text.value(), + prediction_reason); } absl::optional<ItemSuggestCache::Results> ConvertResults( @@ -164,12 +170,16 @@ constexpr base::FeatureParam<int> ItemSuggestCache::kMinMinutesBetweenUpdates; constexpr base::FeatureParam<bool> ItemSuggestCache::kMultipleQueriesPerSession; -ItemSuggestCache::Result::Result(const std::string& id, - const std::string& title) - : id(id), title(title) {} +ItemSuggestCache::Result::Result( + const std::string& id, + const std::string& title, + const absl::optional<std::string>& prediction_reason) + : id(id), title(title), prediction_reason(prediction_reason) {} ItemSuggestCache::Result::Result(const Result& other) - : id(other.id), title(other.title) {} + : id(other.id), + title(other.title), + prediction_reason(other.prediction_reason) {} ItemSuggestCache::Result::~Result() = default; @@ -183,7 +193,8 @@ ItemSuggestCache::ItemSuggestCache( Profile* profile, - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + base::RepeatingCallback<void()> on_results_updated) : made_request_(false), enabled_(kEnabled.Get()), server_url_(kServerUrl.Get()), @@ -191,6 +202,7 @@ multiple_queries_per_session_( app_list_features::IsSuggestedFilesEnabled() || kMultipleQueriesPerSession.Get()), + on_results_updated_(on_results_updated), profile_(profile), url_loader_factory_(std::move(url_loader_factory)) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -357,6 +369,7 @@ LogStatus(Status::kOk); LogLatency(base::TimeTicks::Now() - update_start_time_); results_ = std::move(results.value()); + on_results_updated_.Run(); } }
diff --git a/chrome/browser/ui/app_list/search/files/item_suggest_cache.h b/chrome/browser/ui/app_list/search/files/item_suggest_cache.h index 3a7e9c5..5ba3c75 100644 --- a/chrome/browser/ui/app_list/search/files/item_suggest_cache.h +++ b/chrome/browser/ui/app_list/search/files/item_suggest_cache.h
@@ -28,12 +28,15 @@ public: // Information on a single file suggestion result. struct Result { - Result(const std::string& id, const std::string& title); + Result(const std::string& id, + const std::string& title, + const absl::optional<std::string>& prediction_reason); Result(const Result& other); ~Result(); std::string id; std::string title; + absl::optional<std::string> prediction_reason; }; // Information on all file suggestion results returned from an ItemSuggest @@ -53,7 +56,8 @@ ItemSuggestCache( Profile* profile, - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory); + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + base::RepeatingCallback<void()> on_results_updated); ~ItemSuggestCache(); ItemSuggestCache(const ItemSuggestCache&) = delete; @@ -146,6 +150,8 @@ // Whether we should query item suggest more than once per session. const bool multiple_queries_per_session_; + base::RepeatingCallback<void()> on_results_updated_; + Profile* profile_; std::unique_ptr<signin::PrimaryAccountAccessTokenFetcher> token_fetcher_; scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
diff --git a/chrome/browser/ui/app_list/search/files/item_suggest_cache_unittest.cc b/chrome/browser/ui/app_list/search/files/item_suggest_cache_unittest.cc index dd2d178..632fe7f 100644 --- a/chrome/browser/ui/app_list/search/files/item_suggest_cache_unittest.cc +++ b/chrome/browser/ui/app_list/search/files/item_suggest_cache_unittest.cc
@@ -48,11 +48,12 @@ { "itemId": "item id 2", "displayText": "display text 2", - "predictionReason": "unused field" + "predictionReason": "prediction reason 2" }, { "itemId": "item id 3", - "displayText": "display text 3" + "displayText": "display text 3", + "predictionReason": "prediction reason 3" } ], "suggestionSessionId": "suggestion id 1" @@ -79,21 +80,26 @@ void ResultMatches(const ItemSuggestCache::Result& actual, const std::string& id, - const std::string& title) { + const std::string& title, + const absl::optional<std::string>& prediction_reason) { EXPECT_EQ(actual.id, id); EXPECT_EQ(actual.title, title); + EXPECT_EQ(actual.prediction_reason, prediction_reason); } void ResultsMatch( const absl::optional<ItemSuggestCache::Results>& actual, const std::string& suggestion_id, - const std::vector<std::pair<std::string, std::string>>& results) { + const std::vector< + std::tuple<std::string, std::string, absl::optional<std::string>>>& + results) { EXPECT_TRUE(actual.has_value()); EXPECT_EQ(actual->suggestion_id, suggestion_id); ASSERT_EQ(actual->results.size(), results.size()); for (int i = 0; i < results.size(); ++i) { - ResultMatches(actual->results[i], results[i].first, results[i].second); + ResultMatches(actual->results[i], std::get<0>(results[i]), + std::get<1>(results[i]), std::get<2>(results[i])); } } @@ -143,9 +149,9 @@ TEST_F(ItemSuggestCacheTest, ConvertJsonSuccess) { const base::Value full = Parse(kValidJsonResponse); ResultsMatch(ItemSuggestCache::ConvertJsonForTest(&full), "suggestion id 1", - {{"item id 1", "display text 1"}, - {"item id 2", "display text 2"}, - {"item id 3", "display text 3"}}); + {{"item id 1", "display text 1", absl::nullopt}, + {"item id 2", "display text 2", "prediction reason 2"}, + {"item id 3", "display text 3", "prediction reason 3"}}); const base::Value empty_items = Parse(R"( { @@ -204,7 +210,8 @@ scoped_feature_list_.InitAndEnableFeatureWithParameters( feature_, {{"enabled", "false"}}); std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); itemSuggestCache->UpdateCache(); task_environment_.RunUntilIdle(); histogram_tester_.ExpectUniqueSample( @@ -214,7 +221,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCacheDisabledByPolicy) { profile_->GetPrefs()->SetBoolean(drive::prefs::kDisableDrive, true); std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); itemSuggestCache->UpdateCache(); task_environment_.RunUntilIdle(); histogram_tester_.ExpectUniqueSample( @@ -226,7 +234,8 @@ feature_, {{"server_url", "http://appsitemsuggest-pa.googleapis.com/v1/items"}}); std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); itemSuggestCache->UpdateCache(); task_environment_.RunUntilIdle(); histogram_tester_.ExpectUniqueSample( @@ -237,7 +246,8 @@ scoped_feature_list_.InitAndEnableFeatureWithParameters( feature_, {{"server_url", "https://foo.com"}}); std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); itemSuggestCache->UpdateCache(); task_environment_.RunUntilIdle(); histogram_tester_.ExpectUniqueSample( @@ -246,7 +256,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCacheServerNoAuthToken) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); itemSuggestCache->UpdateCache(); task_environment_.RunUntilIdle(); histogram_tester_.ExpectUniqueSample( @@ -255,7 +266,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCacheInsufficientResourcesError) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -273,7 +285,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCacheNetError) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -291,7 +304,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCache5kkError) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -313,7 +327,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCache4kkError) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -335,7 +350,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCache3kkError) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -357,7 +373,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCacheEmptyResponse) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -373,7 +390,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCacheInvalidResponse) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -391,7 +409,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCacheConversionFailure) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -414,7 +433,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCacheConversionEmptyResults) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -438,7 +458,8 @@ TEST_F(ItemSuggestCacheTest, UpdateCacheSavesResults) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -449,19 +470,20 @@ task_environment_.RunUntilIdle(); histogram_tester_.ExpectUniqueSample(kResponseSizeHistogramName, - /* sample= */ 419, + /* sample= */ 477, /* expected_count= */ 1); ResultsMatch(itemSuggestCache->GetResults(), "suggestion id 1", - {{"item id 1", "display text 1"}, - {"item id 2", "display text 2"}, - {"item id 3", "display text 3"}}); + {{"item id 1", "display text 1", absl::nullopt}, + {"item id 2", "display text 2", "prediction reason 2"}, + {"item id 3", "display text 3", "prediction reason 3"}}); histogram_tester_.ExpectUniqueSample(kStatusHistogramName, ItemSuggestCache::Status::kOk, 1); } TEST_F(ItemSuggestCacheTest, UpdateCacheSmallTimeBetweenUpdates) { std::unique_ptr<ItemSuggestCache> itemSuggestCache = - std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_); + std::make_unique<ItemSuggestCache>(profile_, shared_url_loader_factory_, + base::DoNothing()); identity_test_env_->MakePrimaryAccountAvailable(kEmail, signin::ConsentLevel::kSync); identity_test_env_->SetAutomaticIssueOfAccessTokens(true); @@ -481,7 +503,7 @@ itemSuggestCache->UpdateCache(); task_environment_.RunUntilIdle(); ResultsMatch(itemSuggestCache->GetResults(), "suggestion id 1", - {{"item id 1", "display text 1"}}); + {{"item id 1", "display text 1", absl::nullopt}}); task_environment_.AdvanceClock(base::Minutes(2)); @@ -502,7 +524,7 @@ // The first set of results are in the cache since the second update occurred // before the minimum time between updates. ResultsMatch(itemSuggestCache->GetResults(), "suggestion id 1", - {{"item id 1", "display text 1"}}); + {{"item id 1", "display text 1", absl::nullopt}}); } } // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc index 97c43ed8..8693642 100644 --- a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc +++ b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc
@@ -43,6 +43,10 @@ constexpr char kListSchema[] = "zero_state_drive://"; constexpr char kChipSchema[] = "drive_chip://"; +// How long to wait before making the first request for results from the +// ItemSuggestCache. +constexpr base::TimeDelta kFirstUpdateDelay = base::Seconds(10); + // Outcome of a call to DriverZeroStateProvider::StartZeroState. These values // persist to logs. Entries should not be renumbered and numeric values should // never be reused. @@ -117,8 +121,14 @@ drive_service_( drive::DriveIntegrationServiceFactory::GetForProfile(profile)), session_manager_(session_manager::SessionManager::Get()), - item_suggest_cache_(profile, std::move(url_loader_factory)), - suggested_files_enabled_(app_list_features::IsSuggestedFilesEnabled()) { + construction_time_(base::Time::Now()), + item_suggest_cache_( + profile, + std::move(url_loader_factory), + base::BindRepeating(&ZeroStateDriveProvider::OnCacheUpdated, + base::Unretained(this))), + suggested_files_enabled_(app_list_features::IsSuggestedFilesEnabled() || + ash::features::IsProductivityLauncherEnabled()) { DCHECK(profile_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); task_runner_ = base::ThreadPool::CreateSequencedTaskRunner( @@ -160,13 +170,20 @@ const bool gate_on_use = base::GetFieldTrialParamByFeatureAsBool( app_list_features::kEnableSuggestedFiles, "gate_warm_on_launcher_use", true); - const bool should_warm = !gate_on_use || launcher_used; + const bool productivity_launcher = + ash::features::IsProductivityLauncherEnabled(); + const bool should_warm = + !gate_on_use || launcher_used || productivity_launcher; LogShouldWarm(should_warm); if (have_warmed_up_cache_ || !suggested_files_enabled_ || !should_warm) return; have_warmed_up_cache_ = true; - item_suggest_cache_.UpdateCache(); + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, + base::BindOnce(&ZeroStateDriveProvider::MaybeUpdateCache, + weak_factory_.GetWeakPtr()), + kFirstUpdateDelay); } void ZeroStateDriveProvider::OnSessionStateChanged() { @@ -186,10 +203,10 @@ screen_off_ = proto.off(); } -void ZeroStateDriveProvider::AppListShown() { +void ZeroStateDriveProvider::ViewClosing() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); MaybeLogHypotheticalQuery(); - item_suggest_cache_.UpdateCache(); + MaybeUpdateCache(); } ash::AppListSearchResultType ZeroStateDriveProvider::ResultType() const { @@ -244,6 +261,7 @@ DCHECK(cache_results_); DCHECK_EQ(cache_results_->results.size(), paths->size()); + const auto& cache_results = cache_results_->results; // Assign scores to results by simply using their position in the results // list. The order of results from the ItemSuggest API is significant: @@ -263,11 +281,8 @@ double score = 1.0 - (item_index / total_items); ++item_index; - // TODO(crbug.com/1034842): Use |cache_results_| to attach the session id to - // the result. - - provider_results.emplace_back( - MakeListResult(path_or_error->get_path(), score)); + provider_results.emplace_back(MakeListResult( + path_or_error->get_path(), cache_results[i].prediction_reason, score)); if (suggested_files_enabled_ && IsSuggestedContentEnabled(profile_)) { provider_results.emplace_back( MakeChipResult(path_or_error->get_path(), score)); @@ -292,11 +307,17 @@ std::unique_ptr<FileResult> ZeroStateDriveProvider::MakeListResult( const base::FilePath& filepath, + const absl::optional<std::string>& prediction_reason, const float relevance) { - return std::make_unique<FileResult>( + auto result = std::make_unique<FileResult>( kListSchema, ReparentToDriveMount(filepath, drive_service_), ash::AppListSearchResultType::kZeroStateDrive, GetDisplayType(), relevance, std::u16string(), FileResult::Type::kFile, profile_); + // If it exists, override the details text with the prediction reason in the + // productivity launcher. + if (prediction_reason && ash::features::IsProductivityLauncherEnabled()) + result->SetDetails(base::UTF8ToUTF16(prediction_reason.value())); + return result; } std::unique_ptr<FileResult> ZeroStateDriveProvider::MakeChipResult( @@ -309,6 +330,16 @@ FileResult::Type::kFile, profile_); } +void ZeroStateDriveProvider::OnCacheUpdated() { + StartZeroState(); +} + +void ZeroStateDriveProvider::MaybeUpdateCache() { + if (base::Time::Now() - kFirstUpdateDelay > construction_time_) { + item_suggest_cache_.UpdateCache(); + } +} + void ZeroStateDriveProvider::MaybeLogHypotheticalQuery() { const auto now = base::TimeTicks::Now(); const std::vector<int> throttle_intervals({5, 10, 15, 30});
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h index 6fe9eb7f..22944f1 100644 --- a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h +++ b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h
@@ -54,7 +54,7 @@ // SearchProvider: void StartZeroState() override; - void AppListShown() override; + void ViewClosing() override; ash::AppListSearchResultType ResultType() const override; bool ShouldBlockZeroState() const override; @@ -79,13 +79,24 @@ void OnFilePathsLocated( absl::optional<std::vector<drivefs::mojom::FilePathOrErrorPtr>> paths); - std::unique_ptr<FileResult> MakeListResult(const base::FilePath& filepath, - const float relevance); + std::unique_ptr<FileResult> MakeListResult( + const base::FilePath& filepath, + const absl::optional<std::string>& prediction_reason, + const float relevance); // TODO(crbug.com/1258415): Chip results don't exist in the new launcher. // MakeChipResult can be removed after launch. std::unique_ptr<FileResult> MakeChipResult(const base::FilePath& filepath, const float relevance); + // Callback for when the ItemSuggestCache updates its results. + void OnCacheUpdated(); + + // Requests an update from the ItemSuggestCache, but only if the call is long + // enough after the provider was constructed. This helps ease resource + // contention at login, and prevents the call from failing because Google auth + // tokens haven't been set up yet. + void MaybeUpdateCache(); + // We are intending to change the triggers of queries to ItemSuggest, but // first want to know the QPS impact of the change. This method records // metrics to track how many queries we will send under the proposed new @@ -100,6 +111,8 @@ drive::DriveIntegrationService* const drive_service_; session_manager::SessionManager* session_manager_; + const base::Time construction_time_; + ItemSuggestCache item_suggest_cache_; // The most recent results retrieved from |item_suggested_cache_|. This is
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider_unittest.cc b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider_unittest.cc index 193971de..dbfb0182 100644 --- a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider_unittest.cc
@@ -60,7 +60,7 @@ provider_->OnFileSystemMounted(); ExpectHistogramCountAndWait(1); - provider_->AppListShown(); + provider_->ViewClosing(); ExpectHistogramCountAndWait(2); session_manager_->SetSessionState(session_manager::SessionState::ACTIVE); @@ -79,7 +79,7 @@ histogram_tester_.ExpectTotalCount(kHypotheticalQueryHistogram, 0); provider_->AppListShown(); - provider_->AppListShown(); + provider_->ViewClosing(); histogram_tester_.ExpectBucketCount( kHypotheticalQueryHistogram, ZeroStateDriveProvider::ThrottleInterval::kFiveMinutes, 1); @@ -95,7 +95,7 @@ FastForwardByMinutes(5); provider_->AppListShown(); - provider_->AppListShown(); + provider_->ViewClosing(); histogram_tester_.ExpectBucketCount( kHypotheticalQueryHistogram, ZeroStateDriveProvider::ThrottleInterval::kFiveMinutes, 2); @@ -111,7 +111,7 @@ FastForwardByMinutes(5); provider_->AppListShown(); - provider_->AppListShown(); + provider_->ViewClosing(); histogram_tester_.ExpectBucketCount( kHypotheticalQueryHistogram, ZeroStateDriveProvider::ThrottleInterval::kFiveMinutes, 3); @@ -127,7 +127,7 @@ FastForwardByMinutes(5); provider_->AppListShown(); - provider_->AppListShown(); + provider_->ViewClosing(); histogram_tester_.ExpectBucketCount( kHypotheticalQueryHistogram, ZeroStateDriveProvider::ThrottleInterval::kFiveMinutes, 4); @@ -143,7 +143,7 @@ FastForwardByMinutes(15); provider_->AppListShown(); - provider_->AppListShown(); + provider_->ViewClosing(); histogram_tester_.ExpectBucketCount( kHypotheticalQueryHistogram, ZeroStateDriveProvider::ThrottleInterval::kFiveMinutes, 5);
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_file_provider.cc b/chrome/browser/ui/app_list/search/files/zero_state_file_provider.cc index 11e94ea..273c493 100644 --- a/chrome/browser/ui/app_list/search/files/zero_state_file_provider.cc +++ b/chrome/browser/ui/app_list/search/files/zero_state_file_provider.cc
@@ -24,7 +24,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/search/files/file_result.h" #include "chrome/browser/ui/app_list/search/ranking/util.h" -#include "chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.h" +#include "chrome/browser/ui/app_list/search/util/persistent_proto.h" #include "components/prefs/pref_service.h" using file_manager::file_tasks::FileTasksObserver; @@ -37,10 +37,12 @@ constexpr char kFileChipSchema[] = "file_chip://"; constexpr char kZeroStateFileSchema[] = "zero_state_file://"; -constexpr int kMaxLocalFiles = 10; +constexpr base::TimeDelta kSaveDelay = base::Seconds(3); -// Given the output of RecurrenceRanker::RankTopN, partition files by whether -// they exist or not on disk. Returns a pair of vectors: <valid, invalid>. +constexpr size_t kMaxLocalFiles = 10u; + +// Given the output of MrfuCache::GetAll, partition files by whether or not they +// exist on disk. Returns a pair of vectors: <valid, invalid>. internal::ValidAndInvalidResults ValidateFiles( const std::vector<std::pair<std::string, float>>& ranker_results) { internal::ScoredResults valid; @@ -87,20 +89,28 @@ if (notifier) { file_tasks_observer_.Observe(notifier); - RecurrenceRankerConfigProto config; - config.set_min_seconds_between_saves(3u); - config.set_condition_limit(1u); - config.set_condition_decay(0.5f); - config.set_target_limit(200); - config.set_target_decay(0.9f); - config.mutable_predictor()->mutable_default_predictor(); - files_ranker_ = std::make_unique<RecurrenceRanker>( - "ZeroStateLocalFiles", - profile->GetPath().AppendASCII("zero_state_local_files.pb"), config, - ash::ProfileHelper::IsEphemeralUserProfile(profile)); + MrfuCache::Params params; + // 5 consecutive clicks to get a new file to a score of 2/3, and 10 clicks + // on other files to reduce its score by half. + params.half_life = 10.0f; + params.boost_factor = 5.0f; + MrfuCache::Proto proto( + RankerStateDirectory(profile).AppendASCII("zero_state_local_files.pb"), + kSaveDelay); + proto.RegisterOnRead(base::BindOnce( + &ZeroStateFileProvider::OnProtoInitialized, base::Unretained(this))); + files_ranker_ = std::make_unique<MrfuCache>(std::move(proto), params); } } +void ZeroStateFileProvider::OnProtoInitialized(ReadStatus status) { + base::PostTaskAndReplyWithResult( + task_runner_.get(), FROM_HERE, + base::BindOnce(&ValidateFiles, files_ranker_->GetAll()), + base::BindOnce(&ZeroStateFileProvider::SetSearchResults, + weak_factory_.GetWeakPtr())); +} + ZeroStateFileProvider::~ZeroStateFileProvider() = default; ash::AppListSearchResultType ZeroStateFileProvider::ResultType() const { @@ -114,25 +124,30 @@ void ZeroStateFileProvider::StartZeroState() { query_start_time_ = base::TimeTicks::Now(); ClearResultsSilently(); - if (!files_ranker_) + if (!files_ranker_) { return; + } base::PostTaskAndReplyWithResult( task_runner_.get(), FROM_HERE, - base::BindOnce(&ValidateFiles, files_ranker_->RankTopN(kMaxLocalFiles)), + base::BindOnce(&ValidateFiles, files_ranker_->GetAll()), base::BindOnce(&ZeroStateFileProvider::SetSearchResults, weak_factory_.GetWeakPtr())); } void ZeroStateFileProvider::SetSearchResults( - const internal::ValidAndInvalidResults& results) { - // Delete invalid results from the model. - for (const auto& path : results.second) - files_ranker_->RemoveTarget(path.value()); + internal::ValidAndInvalidResults results) { + // TODO(crbug.com/1258415): Re-add deletion of invalid results from the model. + + // Sort valid results high-to-low by score. + auto& valid_results = results.first; + std::sort(valid_results.begin(), valid_results.end(), + [](const auto& a, const auto& b) { return a.second > b.second; }); // Use valid results for search results. SearchProvider::Results new_results; - for (const auto& filepath_score : results.first) { + for (size_t i = 0; i < std::min(valid_results.size(), kMaxLocalFiles); ++i) { + const auto& filepath_score = valid_results[i]; double score = filepath_score.second; auto result = std::make_unique<FileResult>( kZeroStateFileSchema, filepath_score.first, @@ -146,7 +161,7 @@ } new_results.push_back(std::move(result)); - // Add suggestion chip file results + // Add suggestion chip file results. // TODO(crbug.com/1258415): This can be removed once the new launcher is // launched. if (app_list_features::IsSuggestedLocalFilesEnabled() && @@ -178,7 +193,7 @@ const auto& profile_path = profile_->GetPath(); for (const auto& file_open : file_opens) { if (profile_path.AppendRelativePath(file_open.path, nullptr)) - files_ranker_->Record(file_open.path.value()); + files_ranker_->Use(file_open.path.value()); } }
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_file_provider.h b/chrome/browser/ui/app_list/search/files/zero_state_file_provider.h index c9804eaf..35bcbb0 100644 --- a/chrome/browser/ui/app_list/search/files/zero_state_file_provider.h +++ b/chrome/browser/ui/app_list/search/files/zero_state_file_provider.h
@@ -19,6 +19,8 @@ #include "chrome/browser/ash/file_manager/file_tasks_notifier.h" #include "chrome/browser/ash/file_manager/file_tasks_observer.h" #include "chrome/browser/ui/app_list/search/search_provider.h" +#include "chrome/browser/ui/app_list/search/util/mrfu_cache.h" +#include "chrome/browser/ui/app_list/search/util/persistent_proto.h" #include "chrome/browser/ui/ash/thumbnail_loader.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -33,8 +35,6 @@ } // namespace internal -class RecurrenceRanker; - // ZeroStateFileProvider dispatches queries to extensions and fetches the // results from them via chrome.launcherSearchProvider API. class ZeroStateFileProvider : public SearchProvider, @@ -59,12 +59,14 @@ // Takes a pair of vectors: <valid paths, invalid paths>, and converts the // valid paths to ZeroStatFilesResults and sets them as this provider's // results. The invalid paths are removed from the model. - void SetSearchResults(const internal::ValidAndInvalidResults& results); + void SetSearchResults(internal::ValidAndInvalidResults results); // TODO(crbug.com/1216084): Remove this after finishing developing Continue // Section. Appends mock results to the driver provider. void AppendFakeSearchResults(Results* results); + void OnProtoInitialized(ReadStatus status); + // The reference to profile to get ZeroStateFileProvider service. Profile* const profile_; @@ -72,7 +74,7 @@ // The ranking model used to produce local file results for searches with an // empty query. - std::unique_ptr<RecurrenceRanker> files_ranker_; + std::unique_ptr<MrfuCache> files_ranker_; base::TimeTicks query_start_time_;
diff --git a/chrome/browser/ui/app_list/search/ranking/best_match_ranker.cc b/chrome/browser/ui/app_list/search/ranking/best_match_ranker.cc new file mode 100644 index 0000000..dfcaa6eb --- /dev/null +++ b/chrome/browser/ui/app_list/search/ranking/best_match_ranker.cc
@@ -0,0 +1,156 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/search/ranking/best_match_ranker.h" + +#include <cmath> +#include <vector> + +#include "base/containers/flat_set.h" +#include "base/strings/strcat.h" +#include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ui/app_list/search/chrome_search_result.h" +#include "chrome/browser/ui/app_list/search/ranking/constants.h" +#include "chrome/browser/ui/app_list/search/ranking/types.h" +#include "chrome/browser/ui/app_list/search/ranking/util.h" + +namespace app_list { +namespace { + +// Returns true if the |type| provider's results should never be a best match. +bool ShouldIgnoreProvider(ProviderType type) { + switch (type) { + // Low-intent providers: + case ProviderType::kPlayStoreReinstallApp: + case ProviderType::kPlayStoreApp: + case ProviderType::kAssistantText: + // Deprecated providers: + case ProviderType::kLauncher: + case ProviderType::kAnswerCard: + // Suggestion chip results: + case ProviderType::kFileChip: + case ProviderType::kDriveChip: + case ProviderType::kAssistantChip: + // Internal results: + case ProviderType::kUnknown: + case ProviderType::kInternalPrivacyInfo: + return true; + default: + return false; + } +} + +} // namespace + +BestMatchRanker::BestMatchRanker() {} + +BestMatchRanker::~BestMatchRanker() {} + +void BestMatchRanker::Start(const std::u16string& query, + ResultsMap& results, + CategoriesList& categories) { + is_pre_burnin_ = true; + best_matches_.clear(); +} + +void BestMatchRanker::OnBurnInPeriodElapsed() { + is_pre_burnin_ = false; +} + +void BestMatchRanker::UpdateResultRanks(ResultsMap& results, + ProviderType provider) { + // Skip results from providers that are never included in the top matches. + if (ShouldIgnoreProvider(provider)) + return; + + // Remove invalidated weak pointers from best_matches_ + for (auto iter = best_matches_.begin(); iter != best_matches_.end();) { + if (!(*iter)) { + // C++11: the return value of erase(iter) is an iterator pointing to the + // next element in the container. + iter = best_matches_.erase(iter); + } else { + ++iter; + } + } + + const bool use_relevance_sort_only = is_pre_burnin_ || best_matches_.empty(); + + // Insert into |best_matches_| any new results from this provider that meet + // the best match threshold. + const auto it = results.find(provider); + DCHECK(it != results.end()); + + base::flat_set<std::string> seen_ids; + for (const auto result : best_matches_) { + seen_ids.insert(result->id()); + } + + for (const auto& result : it->second) { + if (seen_ids.find(result->id()) != seen_ids.end()) { + // Omnibox provider can return more than once. Don't add duplicate results + // to best_matches_. + continue; + } + Scoring& scoring = result->scoring(); + if (scoring.normalized_relevance >= kBestMatchThreshold) { + best_matches_.push_back(result->GetWeakPtr()); + } + } + + // If we have no best matches, there is no ranking work to do. Return early. + if (best_matches_.empty()) + return; + + // Sort best_matches_: + if (use_relevance_sort_only) { + // Pre-burn-in, or post-burn-in where we are receiving best matches for the + // first time, simply sort by relevance. + std::sort(best_matches_.begin(), best_matches_.end(), + [](const auto& a, const auto& b) { + return a->scoring().normalized_relevance > + b->scoring().normalized_relevance; + }); + } else { + // Post-burn-in, where best matches exist from previous provider returns, + // sort by result score but stabilize the top-ranked best match result. We + // achieve this by first sorting by best match rank, and then sorting a + // post-fix of the vector by relevance score. This is important because we + // cannot rely on particular numbered ranks (e.g. 0) being present, as + // results can technically be destroyed at any time. + std::sort(best_matches_.begin(), best_matches_.end(), + [](const auto& a, const auto& b) { + const int a_rank = a->scoring().best_match_rank; + const int b_rank = b->scoring().best_match_rank; + // Sort order: 0, 1, 2, 3, ... then -1. + // N.B. (a ^ b) < 0 checks for opposite sign. + return (a_rank ^ b_rank) < 0 ? a_rank > b_rank + : a_rank < b_rank; + }); + std::sort(best_matches_.begin() + kNumBestMatchesToStabilize, + best_matches_.end(), [](const auto& a, const auto& b) { + return a->scoring().normalized_relevance > + b->scoring().normalized_relevance; + }); + } + + // For the first kNumBestMatches of best_matches_, renumber their best match + // rank. + for (size_t i = 0; i < std::min(kNumBestMatches, best_matches_.size()); ++i) { + best_matches_[i]->scoring().best_match_rank = i; + best_matches_[i]->SetBestMatch(true); + } + + // For the excess elements of best_matches_, revoke their best match status, + // and remove them from the vector. + if (best_matches_.size() > kNumBestMatches) { + for (size_t i = kNumBestMatches; i < best_matches_.size(); ++i) { + best_matches_[i]->scoring().best_match_rank = -1; + best_matches_[i]->SetBestMatch(false); + } + best_matches_.resize(kNumBestMatches); + } +} + +} // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/ranking/best_match_ranker.h b/chrome/browser/ui/app_list/search/ranking/best_match_ranker.h new file mode 100644 index 0000000..ab5001a --- /dev/null +++ b/chrome/browser/ui/app_list/search/ranking/best_match_ranker.h
@@ -0,0 +1,56 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_BEST_MATCH_RANKER_H_ +#define CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_BEST_MATCH_RANKER_H_ + +#include "chrome/browser/ui/app_list/search/ranking/ranker.h" + +namespace app_list { + +class BestMatchRankerTest; + +// A ranker that inspects the scores of incoming results and picks out some of +// them to become 'best matches' to be moved to the top of the results list. +// +// Best Match candidates are identified by thresholding the scores of incoming +// results. It is assumed that this runs after scores have been transformed to a +// near-uniform distribution per-provider by the ScoreNormalizingRanker, and so +// a score of 0.95 indicates a 95th percentile result from a provider, for +// example. It is also assumed that this runs before the category ranker, which +// moves the scores out of the normalized range [0,1]. +// +// In the pre-burn-in period, Best Match candidates are simply ranked by +// normalized relevance score. This is the same in the post-burn-n period, with +// the addition that the highest-ranked kNumBestMatches results are stabilized +// in their positions, and cannot be displaced by later arriving best matches. +class BestMatchRanker : public Ranker { + public: + BestMatchRanker(); + ~BestMatchRanker() override; + + BestMatchRanker(const BestMatchRanker&) = delete; + BestMatchRanker& operator=(const BestMatchRanker&) = delete; + + // Ranker: + void Start(const std::u16string& query, + ResultsMap& results, + CategoriesList& categories) override; + void UpdateResultRanks(ResultsMap& results, ProviderType provider) override; + void OnBurnInPeriodElapsed() override; + + private: + friend class BestMatchRankerTest; + + // Whether the overall search session is within the pre-burn-in period. + // Is unset via a callback from SearchControllerImplNew. + bool is_pre_burnin_ = true; + + // Vector to track best matches throughout a given search query. + std::vector<base::WeakPtr<ChromeSearchResult>> best_matches_; +}; + +} // namespace app_list + +#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_BEST_MATCH_RANKER_H_
diff --git a/chrome/browser/ui/app_list/search/ranking/best_match_ranker_unittest.cc b/chrome/browser/ui/app_list/search/ranking/best_match_ranker_unittest.cc new file mode 100644 index 0000000..4e457a87 --- /dev/null +++ b/chrome/browser/ui/app_list/search/ranking/best_match_ranker_unittest.cc
@@ -0,0 +1,268 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/search/ranking/best_match_ranker.h" + +#include "chrome/browser/ui/app_list/search/chrome_search_result.h" +#include "chrome/browser/ui/app_list/search/ranking/types.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace app_list { + +namespace { + +using testing::ElementsAreArray; + +class TestResult : public ChromeSearchResult { + public: + explicit TestResult(const std::string& id, double relevance) { + set_id(id); + scoring().normalized_relevance = relevance; + } + ~TestResult() override {} + + // ChromeSearchResult: + void Open(int event_flags) override {} +}; + +std::unique_ptr<TestResult> MakeResult(const std::string& id, + double relevance) { + return std::make_unique<TestResult>(id, relevance); +} + +Results MakeAnswers( + std::vector<std::pair<std::string, double>> ids_relevances) { + Results results; + for (int i = 0; i < ids_relevances.size(); ++i) { + results.push_back( + MakeResult(ids_relevances[i].first, ids_relevances[i].second)); + } + return results; +} + +} // namespace + +class BestMatchRankerTest : public testing::Test { + public: + void ExpectBestMatchOrderAndRanks( + std::vector<std::pair<std::string, int>> expected_ids_ranks) { + EXPECT_EQ(expected_ids_ranks.size(), ranker_.best_matches_.size()); + std::vector<std::pair<std::string, int>> actual_ids_ranks; + std::transform(ranker_.best_matches_.begin(), ranker_.best_matches_.end(), + std::back_inserter(actual_ids_ranks), + [](auto res) -> const std::pair<std::string, int> { + return {res->id(), res->scoring().best_match_rank}; + }); + EXPECT_THAT(actual_ids_ranks, ElementsAreArray(expected_ids_ranks)); + } + + void ElapseBurnInPeriod() { ranker_.OnBurnInPeriodElapsed(); } + + BestMatchRanker ranker_; +}; + +// Check that: +// - Results below the score threshold are ignored. +// - Some qualifying results are ignored when there are more than +// kNumBestMatches. +// - The sorting of results within |results_map| is unaffected. +TEST_F(BestMatchRankerTest, ResultThresholdingAndSorting) { + ResultsMap results_map; + results_map[ResultType::kOmnibox] = MakeAnswers({{"omni_1", 0.98}, + {"omni_2", 0.3}, + {"omni_3", 0.1}, + {"omni_4", 0.99}, + {"omni_5", 0.96}, + {"omni_6", 0.97}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kOmnibox); + ExpectBestMatchOrderAndRanks({{"omni_4", 0}, {"omni_1", 1}, {"omni_6", 2}}); + + const auto& results = results_map[ResultType::kOmnibox]; + ASSERT_EQ(results.size(), 6); + + std::vector<std::string> result_map_ids; + std::vector<int> result_map_ranks; + std::vector<bool> shared_metadata_best_match_status; + + for (const auto& res : results) { + result_map_ids.push_back(res->id()); + result_map_ranks.push_back(res->scoring().best_match_rank); + shared_metadata_best_match_status.push_back(res->best_match()); + } + + // The ranker should not affect result order within the results map. + EXPECT_THAT(result_map_ids, ElementsAreArray({"omni_1", "omni_2", "omni_3", + "omni_4", "omni_5", "omni_6"})); + // Non-best matches should have a best match rank of -1. + EXPECT_THAT(result_map_ranks, ElementsAreArray({1, -1, -1, 0, -1, 2})); + + // The best match status of all results should be correctly reflected in + // shared result metadata. + EXPECT_THAT(shared_metadata_best_match_status, + ElementsAreArray({true, false, false, true, false, true})); +} + +// Check that ranker handles case where no best results are found. +TEST_F(BestMatchRankerTest, NoBestResults) { + ResultsMap results_map; + + // Simulate one provider returning. + results_map[ResultType::kOmnibox] = + MakeAnswers({{"omni_1", 0.2}, {"omni_2", 0.3}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kOmnibox); + ExpectBestMatchOrderAndRanks({}); +} + +// Check that ranker handles case where a single best result is found. +TEST_F(BestMatchRankerTest, SingleBestResult) { + ResultsMap results_map; + + // Simulate one provider returning. + results_map[ResultType::kOmnibox] = + MakeAnswers({{"omni_1", 0.2}, {"omni_2", 0.99}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kOmnibox); + ExpectBestMatchOrderAndRanks({{"omni_2", 0.99}}); +} + +// A result which gets stored as a best match may later be deleted. Check that +// the corresponding weak pointer stored within the ranker gets removed from the +// the ranker's best matches tracking vector. +TEST_F(BestMatchRankerTest, IgnoreInvalidatedResults) { + ResultsMap results_map; + + // Simulate one provider returning. + results_map[ResultType::kOmnibox] = + MakeAnswers({{"omni_1", 0.92}, {"omni_2", 0.99}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kOmnibox); + ExpectBestMatchOrderAndRanks({{"omni_2", 0}, {"omni_1", 1}}); + + // Simulate a result being destroyed. + results_map[ResultType::kOmnibox][0].reset(); + + // Simulate a second provider returning. This should result in the removal of + // the now invalid result from above. + results_map[ResultType::kFileSearch] = MakeAnswers({{"file_1", 0.98}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kFileSearch); + ExpectBestMatchOrderAndRanks({{"omni_2", 0}, {"file_1", 1}}); +} + +// Some providers should never contribute to the best matches, and thus should +// be ignored by the best match ranker. +TEST_F(BestMatchRankerTest, IgnoreProviders) { + ResultsMap results_map; + results_map[ResultType::kOmnibox] = + MakeAnswers({{"omni_1", 0.92}, {"omni_2", 0.93}}); + results_map[ResultType::kAssistantText] = + MakeAnswers({{"asst_1", 0.98}, {"asst_2", 0.97}}); + + ranker_.UpdateResultRanks(results_map, ProviderType::kOmnibox); + ranker_.UpdateResultRanks(results_map, ProviderType::kAssistantText); + + // kAssistantText is a low-intent provider and should be ignored from best + // match. The other results should be sorted by relevance. + ExpectBestMatchOrderAndRanks({{"omni_2", 0}, {"omni_1", 1}}); +} + +// During the post-burn-in phase, the highest-ranked best match should remain +// stabilized in this position, and any remaining best matches should be sorted +// by relevance score. +TEST_F(BestMatchRankerTest, PostBurnIn_HighestBestMatchIsStabilized) { + ResultsMap results_map; + + // Simulate one provider returning pre-burn-in. + results_map[ResultType::kOmnibox] = + MakeAnswers({{"omni_1", 0.92}, {"omni_2", 0.93}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kOmnibox); + ExpectBestMatchOrderAndRanks({{"omni_2", 0}, {"omni_1", 1}}); + + // Simulate a second provider returning post-burnin. + ElapseBurnInPeriod(); + results_map[ResultType::kFileSearch] = MakeAnswers({{"file_1", 0.98}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kFileSearch); + // The top-ranked from the pre-burn-in period retains its rank. + ExpectBestMatchOrderAndRanks({{"omni_2", 0}, {"file_1", 1}, {"omni_1", 2}}); +} + +// The Omnibox provider may return more than once. This should not cause the +// storage of duplicate best matches. +// +// This test also checks that a result which is demoted out of best match has +// this correctly reflected. +TEST_F(BestMatchRankerTest, ProviderReturnsMoreThanOnce_ResultDemoted) { + ResultsMap results_map; + + // Simulate a provider returning. + results_map[ResultType::kOmnibox] = + MakeAnswers({{"omni_1", 0.96}, {"omni_2", 0.3}, {"omni_3", 0.1}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kOmnibox); + ExpectBestMatchOrderAndRanks({{"omni_1", 0}}); + + // Simulate the same provider returning for a second time. + results_map[ResultType::kOmnibox] = MakeAnswers( + {{"omni_1", 0.96}, {"omni_2", 0.3}, {"omni_3", 0.1}, {"omni_4", 0.97}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kOmnibox); + ExpectBestMatchOrderAndRanks({{"omni_4", 0}, {"omni_1", 1}}); + + results_map[ResultType::kOmnibox] = MakeAnswers({{"omni_1", 0.96}, + {"omni_2", 0.3}, + {"omni_3", 0.1}, + {"omni_4", 0.97}, + {"omni_5", 0.99}, + {"omni_6", 0.98}}); + ranker_.UpdateResultRanks(results_map, ProviderType::kOmnibox); + // "omni_1" has been demoted out of the category. "omni_4" has moved downwards + // in rank. + ExpectBestMatchOrderAndRanks({{"omni_5", 0}, {"omni_6", 1}, {"omni_4", 2}}); + + const auto& results = results_map[ResultType::kOmnibox]; + ASSERT_EQ(results.size(), 6); + + std::vector<std::string> result_map_ids; + std::vector<int> result_map_ranks; + std::vector<bool> shared_metadata_best_match_status; + + for (const auto& res : results) { + result_map_ids.push_back(res->id()); + result_map_ranks.push_back(res->scoring().best_match_rank); + shared_metadata_best_match_status.push_back(res->best_match()); + } + + // The ranker should not affect result order within the results map. + EXPECT_THAT(result_map_ids, ElementsAreArray({"omni_1", "omni_2", "omni_3", + "omni_4", "omni_5", "omni_6"})); + + // Non-best matches should have a best match rank of -1. This includes the + // result which was originally a best match but got demoted out of best match. + EXPECT_THAT(result_map_ranks, ElementsAreArray({-1, -1, -1, 2, 0, 1})); + + // The best match status of all results should be correctly reflected in + // shared result metadata. + EXPECT_THAT(shared_metadata_best_match_status, + ElementsAreArray({false, false, false, true, true, true})); +} + +TEST_F(BestMatchRankerTest, RankerResetBetweenQueries) { + // Simulate a query starting. + ResultsMap results_1; + CategoriesList categories_1; + + ranker_.Start(u"ABC", results_1, categories_1); + results_1[ResultType::kOmnibox] = + MakeAnswers({{"omni_1", 0.92}, {"omni_2", 0.3}}); + ranker_.UpdateResultRanks(results_1, ProviderType::kOmnibox); + ExpectBestMatchOrderAndRanks({{"omni_1", 0}}); + + // Simulate a second query starting. + ResultsMap results_2; + CategoriesList categories_2; + + ranker_.Start(u"ABC", results_2, categories_2); + results_2[ResultType::kFileSearch] = + MakeAnswers({{"files_1", 0.7}, {"files_2", 0.97}}); + ranker_.UpdateResultRanks(results_2, ProviderType::kFileSearch); + ExpectBestMatchOrderAndRanks({{"files_2", 0}}); +} + +} // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/ranking/constants.h b/chrome/browser/ui/app_list/search/ranking/constants.h index 5dc0e06..070125f 100644 --- a/chrome/browser/ui/app_list/search/ranking/constants.h +++ b/chrome/browser/ui/app_list/search/ranking/constants.h
@@ -11,18 +11,16 @@ // can fit in the UI. constexpr int kMaxOmniboxResults = 3; -// The maximum number of top matches to show. -constexpr size_t kNumTopMatches = 3u; +// The maximum number of best matches to show. +constexpr size_t kNumBestMatches = 3u; -// The score threshold before we consider a result a top match. -constexpr double kTopMatchThreshold = 0.8; +// The number of top-ranked best match results to stabilize during the +// post-burn-in period. Stabilized results retain their rank and are not +// displaced by later-arriving results +constexpr size_t kNumBestMatchesToStabilize = 1u; -// String to add to the details text of top match results. Keep the char[] and -// char16_t versions in sync. -// TODO(crbug.com/1199206): Once the UI has support for categories these can be -// removed. -constexpr char kTopMatchDetails[] = "(top match) "; -constexpr char16_t kTopMatchDetailsUTF16[] = u"(top match) "; +// The score threshold before we consider a result a best match. +constexpr double kBestMatchThreshold = 0.8; } // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/ranking/filtering_ranker.cc b/chrome/browser/ui/app_list/search/ranking/filtering_ranker.cc index 5059b21..dda0896 100644 --- a/chrome/browser/ui/app_list/search/ranking/filtering_ranker.cc +++ b/chrome/browser/ui/app_list/search/ranking/filtering_ranker.cc
@@ -56,10 +56,10 @@ }); // Filter all results after the |kMaxOmniboxResults|th one out of the UI, but - // never remove top matches. + // never remove best matches. for (int i = kMaxOmniboxResults; i < omnibox_results.size(); ++i) { auto& scoring = omnibox_results[i]->scoring(); - if (!scoring.top_match) + if (scoring.best_match_rank == -1) scoring.filter = true; } }
diff --git a/chrome/browser/ui/app_list/search/ranking/ranker.cc b/chrome/browser/ui/app_list/search/ranking/ranker.cc index c99f9ae..b24b8e0 100644 --- a/chrome/browser/ui/app_list/search/ranking/ranker.cc +++ b/chrome/browser/ui/app_list/search/ranking/ranker.cc
@@ -51,4 +51,6 @@ void Ranker::Remove(ChromeSearchResult* result) {} +void Ranker::OnBurnInPeriodElapsed() {} + } // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/ranking/ranker.h b/chrome/browser/ui/app_list/search/ranking/ranker.h index 496134e..32686ed7 100644 --- a/chrome/browser/ui/app_list/search/ranking/ranker.h +++ b/chrome/browser/ui/app_list/search/ranking/ranker.h
@@ -55,6 +55,10 @@ // Called each time a user removes a result. virtual void Remove(ChromeSearchResult* result); + + // Called via callback within SearchControllerImplNew when the burn-in period + // has elapsed and before the at-burn-in publish occurs. + virtual void OnBurnInPeriodElapsed(); }; } // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/ranking/ranker_delegate.cc b/chrome/browser/ui/app_list/search/ranking/ranker_delegate.cc index 1fbab59..5e45f47 100644 --- a/chrome/browser/ui/app_list/search/ranking/ranker_delegate.cc +++ b/chrome/browser/ui/app_list/search/ranking/ranker_delegate.cc
@@ -5,13 +5,13 @@ #include "chrome/browser/ui/app_list/search/ranking/ranker_delegate.h" #include "chrome/browser/ui/app_list/search/ranking/answer_ranker.h" +#include "chrome/browser/ui/app_list/search/ranking/best_match_ranker.h" #include "chrome/browser/ui/app_list/search/ranking/filtering_ranker.h" #include "chrome/browser/ui/app_list/search/ranking/ftrl_ranker.h" #include "chrome/browser/ui/app_list/search/ranking/query_highlighter.h" #include "chrome/browser/ui/app_list/search/ranking/removed_results.pb.h" #include "chrome/browser/ui/app_list/search/ranking/removed_results_ranker.h" #include "chrome/browser/ui/app_list/search/ranking/score_normalizing_ranker.h" -#include "chrome/browser/ui/app_list/search/ranking/top_match_ranker.h" #include "chrome/browser/ui/app_list/search/ranking/util.h" #include "chrome/browser/ui/app_list/search/util/score_normalizer.h" #include "chrome/browser/ui/app_list/search/util/score_normalizer.pb.h" @@ -105,7 +105,7 @@ // 5. Result post-processing. // Nb. the top-match ranker relies on score normalization. - AddRanker(std::make_unique<TopMatchRanker>()); + AddRanker(std::make_unique<BestMatchRanker>()); } RankerDelegate::~RankerDelegate() {}
diff --git a/chrome/browser/ui/app_list/search/ranking/removed_results_ranker_unittest.cc b/chrome/browser/ui/app_list/search/ranking/removed_results_ranker_unittest.cc index 03d8eea..7461089 100644 --- a/chrome/browser/ui/app_list/search/ranking/removed_results_ranker_unittest.cc +++ b/chrome/browser/ui/app_list/search/ranking/removed_results_ranker_unittest.cc
@@ -29,14 +29,14 @@ void Open(int event_flags) override {} }; -std::unique_ptr<TestResult> make_result(const std::string& id) { +std::unique_ptr<TestResult> MakeResult(const std::string& id) { return std::make_unique<TestResult>(id); } -Results make_results(std::vector<std::string> ids) { +Results MakeResults(std::vector<std::string> ids) { Results res; for (const std::string& id : ids) { - res.push_back(make_result(id)); + res.push_back(MakeResult(id)); } return res; } @@ -90,7 +90,7 @@ // Request to remove results. std::vector<std::string> ids{"A", "B", "C"}; - auto results = make_results(ids); + auto results = MakeResults(ids); for (const auto& result : results) ranker.Remove(result.get()); Wait(); @@ -111,7 +111,7 @@ // Request to remove results, with a duplicate. std::vector<std::string> ids{"A", "B", "B"}; - auto results = make_results(ids); + auto results = MakeResults(ids); for (const auto& result : results) ranker.Remove(result.get()); Wait(); @@ -131,15 +131,15 @@ Wait(); // Request to remove some results. - ranker.Remove(make_result("A").get()); - ranker.Remove(make_result("C").get()); - ranker.Remove(make_result("E").get()); + ranker.Remove(MakeResult("A").get()); + ranker.Remove(MakeResult("C").get()); + ranker.Remove(MakeResult("E").get()); Wait(); ResultsMap results_map; - results_map[ResultType::kInstalledApp] = make_results({"A", "B"}); - results_map[ResultType::kInternalApp] = make_results({"C", "D"}); - results_map[ResultType::kOmnibox] = make_results({"E"}); + results_map[ResultType::kInstalledApp] = MakeResults({"A", "B"}); + results_map[ResultType::kInternalApp] = MakeResults({"C", "D"}); + results_map[ResultType::kOmnibox] = MakeResults({"E"}); // Installed apps: The 0th result ("A") is marked to be filtered. ranker.UpdateResultRanks(results_map, ResultType::kInstalledApp); @@ -175,7 +175,7 @@ ResultsMap results_map; results_map[ResultType::kInstalledApp] = - make_results(std::vector<std::string>()); + MakeResults(std::vector<std::string>()); ranker.UpdateResultRanks(results_map, ResultType::kInstalledApp); EXPECT_TRUE(results_map[ResultType::kInstalledApp].empty()); @@ -186,14 +186,14 @@ Wait(); // Request to remove some results. - ranker.Remove(make_result("A").get()); - ranker.Remove(make_result("C").get()); + ranker.Remove(MakeResult("A").get()); + ranker.Remove(MakeResult("C").get()); Wait(); ResultsMap results_map; // Include some duplicated results. - results_map[ResultType::kInstalledApp] = make_results({"A", "A", "B"}); - results_map[ResultType::kInternalApp] = make_results({"C", "D"}); + results_map[ResultType::kInstalledApp] = MakeResults({"A", "A", "B"}); + results_map[ResultType::kInternalApp] = MakeResults({"C", "D"}); // Installed apps: The 0th and 1st results ("A") are marked to be filtered. ranker.UpdateResultRanks(results_map, ResultType::kInstalledApp);
diff --git a/chrome/browser/ui/app_list/search/ranking/top_match_ranker.cc b/chrome/browser/ui/app_list/search/ranking/top_match_ranker.cc deleted file mode 100644 index 5b32696e..0000000 --- a/chrome/browser/ui/app_list/search/ranking/top_match_ranker.cc +++ /dev/null
@@ -1,94 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/app_list/search/ranking/top_match_ranker.h" - -#include <cmath> -#include <vector> - -#include "base/strings/strcat.h" -#include "base/strings/utf_string_conversions.h" -#include "chrome/browser/ui/app_list/search/chrome_search_result.h" -#include "chrome/browser/ui/app_list/search/ranking/constants.h" -#include "chrome/browser/ui/app_list/search/ranking/types.h" -#include "chrome/browser/ui/app_list/search/ranking/util.h" - -namespace app_list { -namespace { - -// Returns true if the |type| provider's results should never be a top match. -bool ShouldIgnoreProvider(ProviderType type) { - switch (type) { - // Low-intent providers: - case ProviderType::kPlayStoreReinstallApp: - case ProviderType::kPlayStoreApp: - case ProviderType::kAssistantText: - // Deprecated providers: - case ProviderType::kLauncher: - case ProviderType::kAnswerCard: - // Suggestion chip results: - case ProviderType::kFileChip: - case ProviderType::kDriveChip: - case ProviderType::kAssistantChip: - // Internal results: - case ProviderType::kUnknown: - case ProviderType::kInternalPrivacyInfo: - return true; - default: - return false; - } -} - -} // namespace - -TopMatchRanker::TopMatchRanker() {} - -TopMatchRanker::~TopMatchRanker() {} - -void TopMatchRanker::UpdateResultRanks(ResultsMap& results, - ProviderType provider) { - const auto it = results.find(provider); - DCHECK(it != results.end()); - - // TODO(crbug.com/1199206): This is an inefficient way of setting the top - // matches. Once we have category support built in to the ChromeSearchResult - // type this should be simplified. - - // Build a vector of all current matches. At the same time, reset the top - // match list by removing the score boost from any results that have it - // currently. - std::vector<std::pair<ChromeSearchResult*, double>> top_results; - for (const auto& type_results : results) { - // Skip results from providers that are never included in the top matches. - if (ShouldIgnoreProvider(type_results.first)) - continue; - - for (const auto& result : type_results.second) { - Scoring& scoring = result->scoring(); - - // Reset top match status on each result, as it might have previously been - // set as a top match. - if (scoring.top_match) { - scoring.top_match = false; - if (result->best_match()) - result->SetBestMatch(false); - } - - if (scoring.normalized_relevance >= kTopMatchThreshold) - top_results.push_back({result.get(), scoring.normalized_relevance}); - } - } - - // Sort |top_results| best-to-worst according to normalized relevance. - std::sort(top_results.begin(), top_results.end(), - [](const auto& a, const auto& b) { return a.second > b.second; }); - - for (int i = 0; i < std::min(kNumTopMatches, top_results.size()); ++i) { - auto* result = top_results[i].first; - result->scoring().top_match = true; - result->SetBestMatch(true); - } -} - -} // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/ranking/top_match_ranker.h b/chrome/browser/ui/app_list/search/ranking/top_match_ranker.h deleted file mode 100644 index 350ee792..0000000 --- a/chrome/browser/ui/app_list/search/ranking/top_match_ranker.h +++ /dev/null
@@ -1,35 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_TOP_MATCH_RANKER_H_ -#define CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_TOP_MATCH_RANKER_H_ - -#include "chrome/browser/ui/app_list/search/ranking/ranker.h" - -namespace app_list { - -// A ranker that inspects the scores of incoming results and picks out some of -// them to become 'top matches' to be moved to the top of the results list. -// -// Choosing top matches is done by simply thresholding the scores of incoming -// results. It is assumed that this runs after scores have been transformed to a -// near-uniform distribution per-provider by the ScoreNormalizingRanker, and so -// a score of 0.95 indicates a 95th percentile result from a provider, for -// example. It is also assumed that this runs before the category ranker, which -// moves the scores out of the normalized range [0,1]. -class TopMatchRanker : public Ranker { - public: - TopMatchRanker(); - ~TopMatchRanker() override; - - TopMatchRanker(const TopMatchRanker&) = delete; - TopMatchRanker& operator=(const TopMatchRanker&) = delete; - - // Ranker: - void UpdateResultRanks(ResultsMap& results, ProviderType provider) override; -}; - -} // namespace app_list - -#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_RANKING_TOP_MATCH_RANKER_H_
diff --git a/chrome/browser/ui/app_list/search/ranking/types.cc b/chrome/browser/ui/app_list/search/ranking/types.cc index a5bacc0f..e5a5fe8 100644 --- a/chrome/browser/ui/app_list/search/ranking/types.cc +++ b/chrome/browser/ui/app_list/search/ranking/types.cc
@@ -20,17 +20,17 @@ return normalized_relevance + category_item_score * 10.0 + category_usage_score * 10.0 + usage_score * 10.0 + - (top_match ? 1000.0 : 0.0); + (best_match_rank > -1 ? 1000.0 : 0.0); } ::std::ostream& operator<<(::std::ostream& os, const Scoring& scoring) { if (scoring.filter) return os << "{" << scoring.FinalScore() << " | filtered}"; return os << base::StringPrintf( - "{%.2f | nr:%.2f ci:%.2f cu:%.2f u:%.2f tm:%d}", + "{%.2f | nr:%.2f ci:%.2f cu:%.2f u:%.2f bm:%d}", scoring.FinalScore(), scoring.normalized_relevance, scoring.category_item_score, scoring.category_usage_score, - scoring.usage_score, scoring.top_match); + scoring.usage_score, scoring.best_match_rank); } CategoriesList CreateAllCategories() {
diff --git a/chrome/browser/ui/app_list/search/ranking/types.h b/chrome/browser/ui/app_list/search/ranking/types.h index dd96da6..a20b1263 100644 --- a/chrome/browser/ui/app_list/search/ranking/types.h +++ b/chrome/browser/ui/app_list/search/ranking/types.h
@@ -26,7 +26,9 @@ // TODO(crbug.com/1199206): Remove defunct members from this struct. struct Scoring { bool filter = false; - bool top_match = false; + // The rank (0, 1, 2, ...) of this result within the Best Match collection of + // results, or -1 if this result is not a Best Match. + int best_match_rank = -1; double normalized_relevance = 0.0f; double category_item_score = 0.0f; double category_usage_score = 0.0f;
diff --git a/chrome/browser/ui/app_list/search/search_controller_impl_new.cc b/chrome/browser/ui/app_list/search/search_controller_impl_new.cc index 3cf4c17..070400dd 100644 --- a/chrome/browser/ui/app_list/search/search_controller_impl_new.cc +++ b/chrome/browser/ui/app_list/search/search_controller_impl_new.cc
@@ -75,9 +75,10 @@ void SearchControllerImplNew::StartSearch(const std::u16string& query) { // For query searches, begin the burn-in timer. if (!query.empty()) { - burn_in_timer_.Start(FROM_HERE, burnin_period_, - base::BindOnce(&SearchControllerImplNew::Publish, - base::Unretained(this))); + burn_in_timer_.Start( + FROM_HERE, burnin_period_, + base::BindOnce(&SearchControllerImplNew::OnBurnInPeriodElapsed, + base::Unretained(this))); } // Cancel a pending zero-state publish if it exists. @@ -161,6 +162,11 @@ } } +void SearchControllerImplNew::OnBurnInPeriodElapsed() { + ranker_->OnBurnInPeriodElapsed(); + Publish(); +} + void SearchControllerImplNew::OpenResult(ChromeSearchResult* result, int event_flags) { // This can happen in certain circumstances due to races. See @@ -376,44 +382,50 @@ } } - std::sort(all_results.begin(), all_results.end(), - [&](const ChromeSearchResult* a, const ChromeSearchResult* b) { - if (a->best_match() != b->best_match()) { - // First, sort best matches to the front of the list. - return a->best_match(); - } else if (!a->best_match() && a->category() != b->category()) { - // Next, sort by categories, except for within best match. - // |categories_| has been sorted above so the first category in - // |categories_| should be ranked more highly. - for (const auto& category : categories_) { - if (category.category == a->category()) { - return true; - } else if (category.category == b->category()) { - return false; - } - } - // Any category associated with a result should also be present - // in |categories_|. - NOTREACHED(); - return false; - } else if (a->scoring().burnin_iteration != - b->scoring().burnin_iteration) { - // Next, sort by burn-in iteration number. This has no effect on - // results which arrive pre-burn-in. For post-burn-in results - // for a given category, later-arriving results are placed below - // earlier-arriving results. - // This happens before sorting on display_score, as a trade-off - // between ranking accuracy and UX pop-in mitigation. - // - // TODO(crbug.com/1279686): Special case handling for special - // categories such as Best Match. - return a->scoring().burnin_iteration < - b->scoring().burnin_iteration; - } else { - // Lastly, sort by display score. - return a->display_score() > b->display_score(); - } - }); + std::sort( + all_results.begin(), all_results.end(), + [&](const ChromeSearchResult* a, const ChromeSearchResult* b) { + const int a_best_match_rank = a->scoring().best_match_rank; + const int b_best_match_rank = b->scoring().best_match_rank; + if (a_best_match_rank != b_best_match_rank) { + // First, sort by best match. All best matches are brought to + // the front of the list and ordered by best_match_rank. + // + // The following gives sort order: + // 0, 1, 2, ... (best matches) then -1 (non-best matches). + // N.B. (a ^ b) < 0 checks for opposite sign. + return (a_best_match_rank ^ b_best_match_rank) < 0 + ? a_best_match_rank > b_best_match_rank + : a_best_match_rank < b_best_match_rank; + } else if (a_best_match_rank == -1 && a->category() != b->category()) { + // Next, sort by categories, except for within best match. + // |categories_| has been sorted above so the first category in + // |categories_| should be ranked more highly. + for (const auto& category : categories_) { + if (category.category == a->category()) { + return true; + } else if (category.category == b->category()) { + return false; + } + } + // Any category associated with a result should also be present + // in |categories_|. + NOTREACHED(); + return false; + } else if (a->scoring().burnin_iteration != + b->scoring().burnin_iteration) { + // Next, sort by burn-in iteration number. This has no effect on + // results which arrive pre-burn-in. For post-burn-in results + // for a given category, later-arriving results are placed below + // earlier-arriving results. + // This happens before sorting on display_score, as a trade-off + // between ranking accuracy and UX pop-in mitigation. + return a->scoring().burnin_iteration < b->scoring().burnin_iteration; + } else { + // Lastly, sort by display score. + return a->display_score() > b->display_score(); + } + }); if (!observer_list_.empty()) { std::vector<const ChromeSearchResult*> observer_results;
diff --git a/chrome/browser/ui/app_list/search/search_controller_impl_new.h b/chrome/browser/ui/app_list/search/search_controller_impl_new.h index 5549608..d682d8d 100644 --- a/chrome/browser/ui/app_list/search/search_controller_impl_new.h +++ b/chrome/browser/ui/app_list/search/search_controller_impl_new.h
@@ -105,6 +105,8 @@ void OnZeroStateTimedOut(); + void OnBurnInPeriodElapsed(); + Profile* profile_; // The query associated with the most recent search.
diff --git a/chrome/browser/ui/app_list/search/search_controller_impl_new_unittest.cc b/chrome/browser/ui/app_list/search/search_controller_impl_new_unittest.cc index 1b90a26..27be950 100644 --- a/chrome/browser/ui/app_list/search/search_controller_impl_new_unittest.cc +++ b/chrome/browser/ui/app_list/search/search_controller_impl_new_unittest.cc
@@ -39,11 +39,11 @@ public: TestSearchResult(const std::string& id, Category category, - bool best_match, + int best_match_rank, double relevance) { set_id(id); SetCategory(category); - SetBestMatch(best_match); + scoring().best_match_rank = best_match_rank; set_relevance(relevance); scoring().normalized_relevance = relevance; } @@ -146,12 +146,12 @@ std::vector<std::unique_ptr<ChromeSearchResult>> MakeResults( std::vector<std::string> ids, std::vector<Category> categories, - std::vector<bool> best_matches, + std::vector<int> best_match_ranks, std::vector<double> scores) { std::vector<std::unique_ptr<ChromeSearchResult>> results; for (size_t i = 0; i < ids.size(); ++i) { results.emplace_back(std::make_unique<TestSearchResult>( - ids[i], categories[i], best_matches[i], scores[i])); + ids[i], categories[i], best_match_ranks[i], scores[i])); } return results; } @@ -193,7 +193,7 @@ void ExpectIdOrder(std::vector<std::string> expected_ids) { const auto& actual_results = model_updater_.search_results(); - ASSERT_EQ(actual_results.size(), expected_ids.size()); + EXPECT_EQ(actual_results.size(), expected_ids.size()); std::vector<std::string> actual_ids; std::transform(actual_results.begin(), actual_results.end(), std::back_inserter(actual_ids), @@ -255,22 +255,33 @@ // Tests that best matches are ordered first, and categories are ignored when // ranking within best match. TEST_F(SearchControllerImplNewTest, BestMatchesOrderedAboveOtherResults) { - auto results = MakeResults( + auto results_1 = MakeResults( {"a", "b", "c", "d"}, {Category::kWeb, Category::kWeb, Category::kApps, Category::kWeb}, - {true, false, true, false}, {0.4, 0.8, 0.2, 0.9}); + {0, -1, 1, -1}, {0.4, 0.7, 0.2, 0.8}); ranker_delegate_->SetCategoryRanks( {{Category::kApps, 0.4}, {Category::kWeb, 0.2}}); search_controller_->StartSearch(u"abc"); - ElapseBurnInPeriod(); - // Simulate a provider returning and containing all of the above results. A + // Simulate a provider returning and containing the first set of results. A // single provider wouldn't return many results like this, but that's // unimportant for the test. search_controller_->SetResults(SimpleProvider(Result::kOmnibox), - std::move(results)); - + std::move(results_1)); + ElapseBurnInPeriod(); + // Expect that: + // - best matches are ordered first, + // - best matches are ordered by best match rank, + // - categories are ignored within best match. ExpectIdOrder({"a", "c", "d", "b"}); + + // Simulate the arrival of another result into the best match category. Its + // best match rank takes precedence over its relevance score in determining + // its rank within the best matches. + auto results_2 = MakeResults({"e"}, {Category::kFiles}, {2}, {0.9}); + search_controller_->SetResults(SimpleProvider(Result::kFileSearch), + std::move(results_2)); + ExpectIdOrder({"a", "c", "e", "d", "b"}); } TEST_F(SearchControllerImplNewTest, @@ -282,16 +293,16 @@ ranker_delegate_->SetCategoryRanks({{Category::kFiles, 0.1}}); // Set up some results from two different providers. - auto file_results = MakeResults({"a"}, {Category::kFiles}, {false}, {0.9}); - auto app_results = MakeResults({"b"}, {Category::kApps}, {false}, {0.1}); + auto file_results = MakeResults({"a"}, {Category::kFiles}, {-1}, {0.9}); + auto app_results = MakeResults({"b"}, {Category::kApps}, {-1}, {0.1}); // Set up results from a third different provider. This provider will first // return one set of results, then later return an updated set of results. auto web_results_first_arrival = MakeResults( - {"c", "d"}, {Category::kWeb, Category::kWeb}, {false, false}, {0.2, 0.1}); + {"c", "d"}, {Category::kWeb, Category::kWeb}, {-1, -1}, {0.2, 0.1}); auto web_results_second_arrival = MakeResults( {"c", "d", "e"}, {Category::kWeb, Category::kWeb, Category::kWeb}, - {false, false, false}, {0.2, 0.1, 0.4}); + {-1, -1, -1}, {0.2, 0.1, 0.4}); // Simulate starting a search. search_controller_->StartSearch(u"abc"); @@ -329,17 +340,17 @@ // Set up some results from four different providers. Only their categories // are relevant, and individual result scores are not. - auto file_results = MakeResults({"a"}, {Category::kFiles}, {false}, {0.9}); - auto app_results = MakeResults({"b"}, {Category::kApps}, {false}, {0.1}); + auto file_results = MakeResults({"a"}, {Category::kFiles}, {-1}, {0.9}); + auto app_results = MakeResults({"b"}, {Category::kApps}, {-1}, {0.1}); // This provider will first return one set of results, then later return an // updated set of results. auto web_results_first_arrival = MakeResults( - {"c", "d"}, {Category::kWeb, Category::kWeb}, {false, false}, {0.2, 0.1}); + {"c", "d"}, {Category::kWeb, Category::kWeb}, {-1, -1}, {0.2, 0.1}); auto web_results_second_arrival = MakeResults( {"c", "d", "e"}, {Category::kWeb, Category::kWeb, Category::kWeb}, - {false, false, false}, {0.2, 0.1, 0.4}); + {-1, -1, -1}, {0.2, 0.1, 0.4}); auto settings_results = - MakeResults({"f"}, {Category::kSettings}, {false}, {0.8}); + MakeResults({"f"}, {Category::kSettings}, {-1}, {0.8}); // Simulate starting a search. search_controller_->StartSearch(u"abc"); @@ -382,11 +393,11 @@ TEST_F(SearchControllerImplNewTest, CategoriesOrderedCorrectly_PreBurnIn) { ranker_delegate_->SetCategoryRanks( {{Category::kFiles, 0.3}, {Category::kWeb, 0.2}, {Category::kApps, 0.1}}); - auto file_results = MakeResults({"a"}, {Category::kFiles}, {false}, {0.9}); + auto file_results = MakeResults({"a"}, {Category::kFiles}, {-1}, {0.9}); auto web_results = MakeResults( {"c", "d", "b"}, {Category::kWeb, Category::kWeb, Category::kWeb}, - {false, false, false}, {0.2, 0.1, 0.4}); - auto app_results = MakeResults({"e"}, {Category::kApps}, {false}, {0.1}); + {-1, -1, -1}, {0.2, 0.1, 0.4}); + auto app_results = MakeResults({"e"}, {Category::kApps}, {-1}, {0.1}); // Simulate starting a search. search_controller_->StartSearch(u"abc"); @@ -409,10 +420,10 @@ {{Category::kFiles, 0.3}, {Category::kWeb, 0.2}, {Category::kApps, 0.1}}); auto web_results = MakeResults( {"b", "c", "a"}, {Category::kWeb, Category::kWeb, Category::kWeb}, - {false, false, false}, {0.2, 0.1, 0.4}); + {-1, -1, -1}, {0.2, 0.1, 0.4}); auto app_results = MakeResults({"e", "d"}, {Category::kApps, Category::kApps}, - {false, false}, {0.7, 0.9}); - auto file_results = MakeResults({"f"}, {Category::kFiles}, {false}, {0.8}); + {-1, -1}, {0.7, 0.9}); + auto file_results = MakeResults({"f"}, {Category::kFiles}, {-1}, {0.8}); // Simulate starting a search. search_controller_->StartSearch(u"abc"); @@ -439,9 +450,9 @@ {{Category::kFiles, 0.3}, {Category::kWeb, 0.2}, {Category::kApps, 0.1}}); auto web_results = MakeResults( {"c", "d", "b"}, {Category::kWeb, Category::kWeb, Category::kWeb}, - {false, false, false}, {0.3, 0.2, 0.4}); - auto app_results = MakeResults({"e"}, {Category::kApps}, {false}, {0.1}); - auto file_results = MakeResults({"a"}, {Category::kFiles}, {false}, {0.9}); + {-1, -1, -1}, {0.3, 0.2, 0.4}); + auto app_results = MakeResults({"e"}, {Category::kApps}, {-1}, {0.1}); + auto file_results = MakeResults({"a"}, {Category::kFiles}, {-1}, {0.9}); // Simulate starting a search. search_controller_->StartSearch(u"abc"); @@ -473,18 +484,18 @@ ranker_delegate_->SetCategoryRanks({{Category::kWeb, 0.2}}); auto web_results_1 = MakeResults( {"b", "c", "a"}, {Category::kWeb, Category::kWeb, Category::kWeb}, - {false, false, false}, {0.2, 0.1, 0.3}); + {-1, -1, -1}, {0.2, 0.1, 0.3}); auto web_results_2 = MakeResults( {"b", "c", "a", "d"}, {Category::kWeb, Category::kWeb, Category::kWeb, Category::kWeb}, - {false, false, false}, {0.2, 0.1, 0.3, 0.4}); + {-1, -1, -1, -1}, {0.2, 0.1, 0.3, 0.4}); auto web_results_3 = MakeResults({"b", "c", "a", "d", "e"}, {Category::kWeb, Category::kWeb, Category::kWeb, Category::kWeb, Category::kWeb}, - {false, false, false}, {0.2, 0.1, 0.3, 0.4, 0.5}); + {-1, -1, -1, -1, -1}, {0.2, 0.1, 0.3, 0.4, 0.5}); // Simulate starting a search. search_controller_->StartSearch(u"abc"); @@ -521,14 +532,13 @@ auto installed_app_results = MakeResults( {"b", "c", "a"}, {Category::kApps, Category::kApps, Category::kApps}, - {false, false, false}, {0.3, 0.2, 0.4}); + {-1, -1, -1}, {0.3, 0.2, 0.4}); - auto play_store_app_results = - MakeResults({"e", "d"}, {Category::kApps, Category::kApps}, - {false, false}, {0.1, 0.5}); + auto play_store_app_results = MakeResults( + {"e", "d"}, {Category::kApps, Category::kApps}, {-1, -1}, {0.1, 0.5}); auto internal_app_results = - MakeResults({"f"}, {Category::kApps}, {false}, {0.9}); + MakeResults({"f"}, {Category::kApps}, {-1}, {0.9}); // Simulate starting a search. search_controller_->StartSearch(u"abc"); @@ -564,7 +574,7 @@ // Start the first search. provider_ptr->SetNextResults( - MakeResults({"AAA"}, {Category::kApps}, {false}, {0.1})); + MakeResults({"AAA"}, {Category::kApps}, {-1}, {0.1})); search_controller_->StartSearch(u"A"); ExpectIdOrder({}); @@ -578,7 +588,7 @@ // Start the second search. provider_ptr->SetNextResults( - MakeResults({"BBB"}, {Category::kApps}, {false}, {0.1})); + MakeResults({"BBB"}, {Category::kApps}, {-1}, {0.1})); search_controller_->StartSearch(u"B"); // The B result is not ready yet, and the A result should *not* have been // published. @@ -604,13 +614,13 @@ Result::kOmnibox, false, base::Seconds(4)); provider_a->SetNextResults( - MakeResults({"a"}, {Category::kApps}, {false}, {0.3})); + MakeResults({"a"}, {Category::kApps}, {-1}, {0.3})); provider_b->SetNextResults( - MakeResults({"b"}, {Category::kApps}, {false}, {0.2})); + MakeResults({"b"}, {Category::kApps}, {-1}, {0.2})); provider_c->SetNextResults( - MakeResults({"c"}, {Category::kApps}, {false}, {0.1})); + MakeResults({"c"}, {Category::kApps}, {-1}, {0.1})); provider_d->SetNextResults( - MakeResults({"d"}, {Category::kApps}, {false}, {0.4})); + MakeResults({"d"}, {Category::kApps}, {-1}, {0.4})); search_controller_->AddProvider(0, std::move(provider_a)); search_controller_->AddProvider(0, std::move(provider_b)); @@ -647,9 +657,9 @@ Result::kZeroStateFile, true, base::Seconds(3)); provider_a->SetNextResults( - MakeResults({"a"}, {Category::kApps}, {false}, {0.3})); + MakeResults({"a"}, {Category::kApps}, {-1}, {0.3})); provider_b->SetNextResults( - MakeResults({"b"}, {Category::kFiles}, {false}, {0.2})); + MakeResults({"b"}, {Category::kFiles}, {-1}, {0.2})); search_controller_->AddProvider(0, std::move(provider_a)); search_controller_->AddProvider(0, std::move(provider_b));
diff --git a/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.cc b/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.cc index 08b24f0..faad385 100644 --- a/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.cc +++ b/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.cc
@@ -214,7 +214,7 @@ } #endif - night_light_client_ = std::make_unique<NightLightClient>( + night_light_client_ = std::make_unique<ash::NightLightClient>( g_browser_process->shared_url_loader_factory()); night_light_client_->Start();
diff --git a/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.h b/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.h index 0e5522f6..7063cdca 100644 --- a/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.h +++ b/chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.h
@@ -12,7 +12,8 @@ namespace ash { class NewWindowDelegateProvider; -} +class NightLightClient; +} // namespace ash namespace chromeos { class NetworkPortalNotificationController; @@ -36,7 +37,6 @@ class MicrophoneMuteNotificationDelegateImpl; class MobileDataNotifications; class NetworkConnectDelegateChromeOS; -class NightLightClient; class ScreenOrientationDelegateChromeos; class SessionControllerClientImpl; class SystemTrayClientImpl; @@ -128,7 +128,7 @@ // Initialized in PostBrowserStart in all configs: std::unique_ptr<MobileDataNotifications> mobile_data_notifications_; - std::unique_ptr<NightLightClient> night_light_client_; + std::unique_ptr<ash::NightLightClient> night_light_client_; std::unique_ptr<AmbientClientImpl> ambient_client_; };
diff --git a/chrome/browser/ui/ash/projector/pending_screencast_manager.cc b/chrome/browser/ui/ash/projector/pending_screencast_manager.cc index b940d8d9..fdf19fc 100644 --- a/chrome/browser/ui/ash/projector/pending_screencast_manager.cc +++ b/chrome/browser/ui/ash/projector/pending_screencast_manager.cc
@@ -168,7 +168,7 @@ if (session_manager) { session_manager->RemoveObserver(this); auto* drivefs_host = GetDriveFsHostForActiveProfile(); - if (drivefs_host) + if (observed_drive_fs_host_ && drivefs_host) drivefs_host->RemoveObserver(this); } } @@ -218,14 +218,19 @@ void PendingSreencastManager::OnError(const drivefs::mojom::DriveError& error) { } -void PendingSreencastManager::OnUserSessionStarted(bool is_primary_user) { +void PendingSreencastManager::OnUserProfileLoaded(const AccountId& account_id) { + if (observed_drive_fs_host_) + return; + auto* profile = ProfileManager::GetActiveUserProfile(); if (!IsProjectorAllowedForProfile(profile)) return; auto* drivefs_host = GetDriveFsHostForActiveProfile(); - if (drivefs_host) + if (drivefs_host) { GetDriveFsHostForActiveProfile()->AddObserver(this); + observed_drive_fs_host_ = true; + } } const ash::PendingScreencastSet&
diff --git a/chrome/browser/ui/ash/projector/pending_screencast_manager.h b/chrome/browser/ui/ash/projector/pending_screencast_manager.h index 514aaf9..3ef44630 100644 --- a/chrome/browser/ui/ash/projector/pending_screencast_manager.h +++ b/chrome/browser/ui/ash/projector/pending_screencast_manager.h
@@ -45,7 +45,7 @@ void OnError(const drivefs::mojom::DriveError& error) override; // session_manager::SessionManagerObserver: - void OnUserSessionStarted(bool is_primary_user) override; + void OnUserProfileLoaded(const AccountId& account_id) override; // Returns a list of pending screencast from `pending_screencast_cache_`. const ash::PendingScreencastSet& GetPendingScreencasts() const; @@ -64,6 +64,9 @@ // A blocking task runner for file IO operations. scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; + // True if DriveFS host has been observed. + bool observed_drive_fs_host_ = false; + base::WeakPtrFactory<PendingSreencastManager> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index cfdbd577..83816d01 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc
@@ -75,6 +75,8 @@ using content::GlobalRequestID; using content::NavigationController; using content::WebContents; +using WebExposedIsolationLevel = + content::RenderFrameHost::WebExposedIsolationLevel; class BrowserNavigatorWebContentsAdoption { public: @@ -164,17 +166,40 @@ absl::optional<web_app::AppId> app_id = web_app::FindInstalledAppWithUrlInScope(profile, params.url, /*window_only=*/true); + if (!app_id && params.force_open_pwa_window) { + // In theory |force_open_pwa_window| should only be set if we know a + // matching PWA is installed. However, we can reach here if + // WebAppRegistrary hasn't finished loading yet, which can happen if + // Chrome is launched with the URL of an isolated app as an argument. + // This isn't a supported way to launch isolated apps, so we can cancel + // the navigation, but if we want to support it in the future we'll need + // to block until WebAppRegistrar is loaded. + return {nullptr, -1}; + } if (app_id) { - std::string app_name = web_app::GenerateApplicationNameFromAppId(*app_id); - Browser* browser = nullptr; - if (Browser::GetCreationStatusForProfile(profile) == - Browser::CreationStatus::kOk) { - browser = Browser::Create(Browser::CreateParams::CreateForApp( - app_name, - true, // trusted_source. Installed PWAs are considered trusted. - params.window_bounds, profile, params.user_gesture)); + // Reuse the existing browser for in-app same window navigations. + bool navigating_same_app = + params.browser && + web_app::AppBrowserController::IsForWebApp(params.browser, *app_id); + if (navigating_same_app && + params.disposition == WindowOpenDisposition::CURRENT_TAB) { + return {params.browser, -1}; } - return {browser, -1}; + // App popups are handled in the switch statement below. + if (params.disposition != WindowOpenDisposition::NEW_POPUP) { + // Open a new app window. + std::string app_name = + web_app::GenerateApplicationNameFromAppId(*app_id); + Browser* browser = nullptr; + if (Browser::GetCreationStatusForProfile(profile) == + Browser::CreationStatus::kOk) { + browser = Browser::Create(Browser::CreateParams::CreateForApp( + app_name, + true, // trusted_source. Installed PWAs are considered trusted. + params.window_bounds, profile, params.user_gesture)); + } + return {browser, -1}; + } } } @@ -514,6 +539,13 @@ return nullptr; } +#if !defined(OS_ANDROID) + // Force isolated PWAs to open in an app window. + params->force_open_pwa_window = web_app::IsUrlInIsolatedAppScope( + params->initiating_profile->GetPrefs(), params->url); + params->open_pwa_window_if_possible |= params->force_open_pwa_window; +#endif + if (!AdjustNavigateParamsForURL(params)) return nullptr; @@ -559,6 +591,9 @@ ShowSingletonTabOverwritingNTP(params->browser, params); return nullptr; } + if (params->force_open_pwa_window) { + CHECK(web_app::AppBrowserController::IsWebApp(params->browser)); + } #if BUILDFLAG(IS_CHROMEOS_ASH) if (source_browser && source_browser != params->browser) { // When the newly created browser was spawned by a browser which visits
diff --git a/chrome/browser/ui/browser_navigator_params.h b/chrome/browser/ui/browser_navigator_params.h index 148cfff..28256bea 100644 --- a/chrome/browser/ui/browser_navigator_params.h +++ b/chrome/browser/ui/browser_navigator_params.h
@@ -290,6 +290,10 @@ // possible, i.e. if the is a PWA installed for the target URL. bool open_pwa_window_if_possible = false; + // Indicates that the navigation must happen in a PWA window. If a PWA + // window can't be created, the navigation will be cancelled. + bool force_open_pwa_window = false; + // The time when the input which led to the navigation occurred. Currently // only set when a link is clicked or the navigation takes place from the // desktop omnibox.
diff --git a/chrome/browser/ui/ui_features.cc b/chrome/browser/ui/ui_features.cc index 663e4431..4cc5bbf 100644 --- a/chrome/browser/ui/ui_features.cc +++ b/chrome/browser/ui/ui_features.cc
@@ -252,7 +252,7 @@ // Enables a WebUI Feedback UI, as opposed to the Chrome App UI. See // https://crbug.com/1167223. const base::Feature kWebUIFeedback{"WebUIFeedback", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; #if BUILDFLAG(IS_CHROMEOS) const base::Feature kChromeOSTabSearchCaptionButton{
diff --git a/chrome/browser/ui/views/autofill/payments/local_card_migration_bubble_views.cc b/chrome/browser/ui/views/autofill/payments/local_card_migration_bubble_views.cc index 53d928a..d522f31 100644 --- a/chrome/browser/ui/views/autofill/payments/local_card_migration_bubble_views.cc +++ b/chrome/browser/ui/views/autofill/payments/local_card_migration_bubble_views.cc
@@ -103,20 +103,17 @@ views::BoxLayout::Orientation::kVertical, gfx::Insets(), ChromeLayoutProvider::Get()->GetDistanceMetric( DISTANCE_RELATED_CONTROL_VERTICAL_SMALL))); + const SkColor color = GetColorProvider()->GetColor(ui::kColorIcon); #if BUILDFLAG(GOOGLE_CHROME_BRANDING) // kGooglePayLogoIcon is square, and CreateTiledImage() will clip it whereas // setting the icon size would rescale it incorrectly. gfx::ImageSkia image = gfx::ImageSkiaOperations::CreateTiledImage( - gfx::CreateVectorIcon(kGooglePayLogoIcon, - GetNativeTheme()->ShouldUseDarkColors() - ? gfx::kGoogleGrey200 - : gfx::kGoogleGrey700), + gfx::CreateVectorIcon(kGooglePayLogoIcon, color), /*x=*/0, /*y=*/0, kMigrationBubbleGooglePayLogoWidth, kMigrationBubbleGooglePayLogoHeight); #else gfx::ImageSkia image = gfx::CreateVectorIcon( - kCreditCardIcon, kMigrationBubbleGooglePayLogoHeight, - GetColorProvider()->GetColor(ui::kColorIcon)); + kCreditCardIcon, kMigrationBubbleGooglePayLogoHeight, color); #endif views::ImageView* icon_view = new views::ImageView(); icon_view->SetImage(image);
diff --git a/chrome/browser/ui/views/autofill/payments/payments_view_util.cc b/chrome/browser/ui/views/autofill/payments/payments_view_util.cc index 9d1a560..9f9a0004 100644 --- a/chrome/browser/ui/views/autofill/payments/payments_view_util.cc +++ b/chrome/browser/ui/views/autofill/payments/payments_view_util.cc
@@ -61,6 +61,7 @@ ImageView::OnThemeChanged(); #if BUILDFLAG(GOOGLE_CHROME_BRANDING) gfx::ImageSkia image; + const SkColor color = GetColorProvider()->GetColor(ui::kColorIcon); switch (icon_to_show_) { case TitleWithIconAndSeparatorView::Icon::GOOGLE_PAY: // kGooglePayLogoIcon is square overall, despite the drawn portion being @@ -68,17 +69,11 @@ // it whereas setting the icon size would rescale it incorrectly and // keep the bottom empty portion. image = gfx::ImageSkiaOperations::CreateTiledImage( - gfx::CreateVectorIcon(kGooglePayLogoIcon, - GetNativeTheme()->ShouldUseDarkColors() - ? gfx::kGoogleGrey200 - : gfx::kGoogleGrey700), + gfx::CreateVectorIcon(kGooglePayLogoIcon, color), /*x=*/0, /*y=*/0, kGooglePayLogoWidth, kIconHeight); break; case TitleWithIconAndSeparatorView::Icon::GOOGLE_G: - image = gfx::CreateVectorIcon( - kGoogleGLogoIcon, kIconHeight, - GetNativeTheme()->GetSystemColor( - ui::NativeTheme::kColorId_DefaultIconColor)); + image = gfx::CreateVectorIcon(kGoogleGLogoIcon, kIconHeight, color); break; }
diff --git a/chrome/browser/ui/views/global_media_controls/media_dialog_view.cc b/chrome/browser/ui/views/global_media_controls/media_dialog_view.cc index 66c43218..9a44752 100644 --- a/chrome/browser/ui/views/global_media_controls/media_dialog_view.cc +++ b/chrome/browser/ui/views/global_media_controls/media_dialog_view.cc
@@ -78,26 +78,43 @@ bool MediaDialogView::has_been_opened_ = false; // static -views::Widget* MediaDialogView::ShowDialog( +views::Widget* MediaDialogView::ShowDialogFromToolbar( views::View* anchor_view, MediaNotificationService* service, - Profile* profile, - global_media_controls::GlobalMediaControlsEntryPoint entry_point) { - return ShowDialogForPresentationRequest(anchor_view, service, profile, - nullptr, entry_point); + Profile* profile) { + return ShowDialog( + anchor_view, views::BubbleBorder::TOP_RIGHT, service, profile, nullptr, + global_media_controls::GlobalMediaControlsEntryPoint::kToolbarIcon); } // static -views::Widget* MediaDialogView::ShowDialogForPresentationRequest( +views::Widget* MediaDialogView::ShowDialogCentered( + const gfx::Rect& bounds, + MediaNotificationService* service, + Profile* profile, + content::WebContents* contents, + global_media_controls::GlobalMediaControlsEntryPoint entry_point) { + auto* widget = ShowDialog(nullptr, views::BubbleBorder::TOP_CENTER, service, + profile, contents, entry_point); + instance_->SetAnchorRect(bounds); + return widget; +} + +// static +views::Widget* MediaDialogView::ShowDialog( views::View* anchor_view, + views::BubbleBorder::Arrow anchor_position, MediaNotificationService* service, Profile* profile, content::WebContents* contents, global_media_controls::GlobalMediaControlsEntryPoint entry_point) { DCHECK(!instance_); DCHECK(service); - instance_ = - new MediaDialogView(anchor_view, service, profile, contents, entry_point); + instance_ = new MediaDialogView(anchor_view, anchor_position, service, + profile, contents, entry_point); + if (!anchor_view) { + instance_->set_has_parent(false); + } views::Widget* widget = views::BubbleDialogDelegateView::CreateBubble(instance_); @@ -248,11 +265,12 @@ MediaDialogView::MediaDialogView( views::View* anchor_view, + views::BubbleBorder::Arrow anchor_position, MediaNotificationService* service, Profile* profile, content::WebContents* contents, global_media_controls::GlobalMediaControlsEntryPoint entry_point) - : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), + : BubbleDialogDelegateView(anchor_view, anchor_position), service_(service), profile_(profile->GetOriginalProfile()), active_sessions_view_(AddChildView(
diff --git a/chrome/browser/ui/views/global_media_controls/media_dialog_view.h b/chrome/browser/ui/views/global_media_controls/media_dialog_view.h index 0ed268f7..a46b09a 100644 --- a/chrome/browser/ui/views/global_media_controls/media_dialog_view.h +++ b/chrome/browser/ui/views/global_media_controls/media_dialog_view.h
@@ -48,17 +48,23 @@ MediaDialogView(const MediaDialogView&) = delete; MediaDialogView& operator=(const MediaDialogView&) = delete; - static views::Widget* ShowDialog( - views::View* anchor_view, - MediaNotificationService* service, - Profile* profile, - global_media_controls::GlobalMediaControlsEntryPoint entry_point); - static views::Widget* ShowDialogForPresentationRequest( - views::View* anchor_view, + static views::Widget* ShowDialogFromToolbar(views::View* anchor_view, + MediaNotificationService* service, + Profile* profile); + static views::Widget* ShowDialogCentered( + const gfx::Rect& bounds, MediaNotificationService* service, Profile* profile, content::WebContents* contents, global_media_controls::GlobalMediaControlsEntryPoint entry_point); + static views::Widget* ShowDialog( + views::View* anchor_view, + views::BubbleBorder::Arrow anchor_position, + MediaNotificationService* service, + Profile* profile, + content::WebContents* contents, + global_media_controls::GlobalMediaControlsEntryPoint entry_point); + static void HideDialog(); static bool IsShowing(); @@ -97,6 +103,7 @@ friend class MediaDialogViewBrowserTest; MediaDialogView( views::View* anchor_view, + views::BubbleBorder::Arrow anchor_position, MediaNotificationService* service, Profile* profile, content::WebContents* contents,
diff --git a/chrome/browser/ui/views/global_media_controls/media_toolbar_button_view.cc b/chrome/browser/ui/views/global_media_controls/media_toolbar_button_view.cc index 1332ed0..679e24c 100644 --- a/chrome/browser/ui/views/global_media_controls/media_toolbar_button_view.cc +++ b/chrome/browser/ui/views/global_media_controls/media_toolbar_button_view.cc
@@ -154,9 +154,7 @@ if (MediaDialogView::IsShowing()) { MediaDialogView::HideDialog(); } else { - MediaDialogView::ShowDialog( - this, service_, browser_->profile(), - global_media_controls::GlobalMediaControlsEntryPoint::kToolbarIcon); + MediaDialogView::ShowDialogFromToolbar(this, service_, browser_->profile()); ClosePromoBubble(); for (auto& observer : observers_)
diff --git a/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.cc b/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.cc index fc2fc42..cc311e0 100644 --- a/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.cc +++ b/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.cc
@@ -50,39 +50,7 @@ std::move(context)); } - // Show global media controls instead of the Cast dialog. - Browser* const browser = chrome::FindBrowserWithWebContents(initiator()); - BrowserView* const browser_view = - browser ? BrowserView::GetBrowserViewForBrowser(browser) : nullptr; - ToolbarView* const toolbar_view = - browser_view ? browser_view->toolbar() : nullptr; - MediaToolbarButtonView* const media_button = - toolbar_view ? toolbar_view->media_button() : nullptr; - // Show the |media_button| before opening the dialog so that when the bubble - // dialog is opened, it has an anchor. - if (media_button) { - media_button->media_toolbar_button_controller()->ShowToolbarButton(); - toolbar_view->Layout(); - } - // Show the WebContents requesting a dialog. - initiator()->GetDelegate()->ActivateContents(initiator()); - - Profile* const profile = - Profile::FromBrowserContext(initiator()->GetBrowserContext()); - MediaNotificationService* const service = - MediaNotificationServiceFactory::GetForProfile(profile); - service->OnStartPresentationContextCreated(std::move(context)); - // TODO(crbug/1111120): When |media_button| is null, we want to show the - // global media controls anchored to the top of the web contents. As it is - // now, it shows the dialog in the wrong place with a big blue border around - // it. Fixing the position probably involves doing something similar to the - // computation of |anchor_bounds| in CreateMediaRouterDialog() below, but - // just doing the same thing here doesn't work. I suspect that approach - // will work, though, once the issue causing the blue border is fixed. - scoped_widget_observations_.AddObservation( - MediaDialogView::ShowDialogForPresentationRequest( - media_button, service, profile, initiator(), - global_media_controls::GlobalMediaControlsEntryPoint::kPresentation)); + ShowGlobalMeidaControlsDialog(std::move(context)); return true; } @@ -97,9 +65,10 @@ InitializeMediaRouterUI(); Browser* browser = chrome::FindBrowserWithWebContents(initiator()); - if (browser) { + BrowserView* browser_view = + browser ? BrowserView::GetBrowserViewForBrowser(browser) : nullptr; + if (browser_view) { // Show the Cast dialog anchored to the Cast toolbar button. - BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); if (browser_view->toolbar()->cast_button()) { CastDialogView::ShowDialogWithToolbarAction( ui_.get(), browser, dialog_creation_time, activation_location); @@ -155,6 +124,10 @@ dialog_creation_callback_ = std::move(callback); } +void MediaRouterDialogControllerViews::SetHideMediaButtonForTesting(bool hide) { + hide_media_button_for_testing_ = hide; +} + MediaRouterDialogControllerViews::MediaRouterDialogControllerViews( WebContents* web_contents) : content::WebContentsUserData<MediaRouterDialogControllerViews>( @@ -180,6 +153,59 @@ } } +void MediaRouterDialogControllerViews::ShowGlobalMeidaControlsDialog( + std::unique_ptr<StartPresentationContext> context) { + // Show the WebContents requesting a dialog. + initiator()->GetDelegate()->ActivateContents(initiator()); + + Profile* const profile = + Profile::FromBrowserContext(initiator()->GetBrowserContext()); + MediaNotificationService* const service = + MediaNotificationServiceFactory::GetForProfile(profile); + service->OnStartPresentationContextCreated(std::move(context)); + + MediaToolbarButtonView* const media_button = GetMediaButton(); + if (!media_button) { + // Show the GMC dialog anchored to the top of the web contents. + gfx::Rect anchor_bounds = initiator()->GetContainerBounds(); + anchor_bounds.set_height(0); + scoped_widget_observations_.AddObservation( + MediaDialogView::ShowDialogCentered( + anchor_bounds, service, profile, initiator(), + global_media_controls::GlobalMediaControlsEntryPoint:: + kPresentation)); + return; + } + + scoped_widget_observations_.AddObservation(MediaDialogView::ShowDialog( + media_button, views::BubbleBorder::TOP_RIGHT, service, profile, + initiator(), + global_media_controls::GlobalMediaControlsEntryPoint::kPresentation)); +} + +MediaToolbarButtonView* MediaRouterDialogControllerViews::GetMediaButton() { + if (hide_media_button_for_testing_) + return nullptr; + + Browser* const browser = chrome::FindBrowserWithWebContents(initiator()); + BrowserView* const browser_view = + browser ? BrowserView::GetBrowserViewForBrowser(browser) : nullptr; + ToolbarView* const toolbar_view = + browser_view ? browser_view->toolbar() : nullptr; + MediaToolbarButtonView* media_button = + toolbar_view ? toolbar_view->media_button() : nullptr; + + if (!media_button) + return nullptr; + + // Show the |media_button| before opening the dialog so that when the bubble + // dialog is opened, it has an anchor. + media_button->media_toolbar_button_controller()->ShowToolbarButton(); + toolbar_view->Layout(); + + return media_button; +} + MediaRouterActionController* MediaRouterDialogControllerViews::GetActionController() { return media_router_ui_service_->action_controller();
diff --git a/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.h b/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.h index 87ff70d..c28340cc 100644 --- a/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.h +++ b/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.h
@@ -15,6 +15,8 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_observer.h" +class MediaToolbarButtonView; + namespace media_router { class MediaRouterUI; @@ -49,6 +51,8 @@ // Sets a callback to be called whenever a dialog is created. void SetDialogCreationCallbackForTesting(base::RepeatingClosure callback); + void SetHideMediaButtonForTesting(bool hide); + private: friend class content::WebContentsUserData<MediaRouterDialogControllerViews>; friend class MediaRouterCastUiForTest; @@ -63,6 +67,18 @@ // Initializes |ui_|. void InitializeMediaRouterUI(); + // If there exists a media button, show the GMC dialog anchored to the media + // button. Otherwise, show the dialog anchored to the top center of the web + // contents. + void ShowGlobalMeidaControlsDialog( + std::unique_ptr<StartPresentationContext> context); + + // Returns the media button from the browser that initiates the request to + // open the dialog. Returns nullptr if: + // (1) the browser does not have a media button (i.e. the browser is + // running a PWA.) or (2) |hide_media_button_for_testing_| is true. + MediaToolbarButtonView* GetMediaButton(); + // MediaRouterActionController is responsible for showing and hiding the // toolbar action. It's owned by MediaRouterUIService and it may be nullptr. MediaRouterActionController* GetActionController(); @@ -83,6 +99,8 @@ // Service that provides MediaRouterActionController. It outlives |this|. const raw_ptr<MediaRouterUIService> media_router_ui_service_; + bool hide_media_button_for_testing_ = false; + WEB_CONTENTS_USER_DATA_KEY_DECL(); };
diff --git a/chrome/browser/ui/views/media_router/media_router_dialog_controller_views_browsertest.cc b/chrome/browser/ui/views/media_router/media_router_dialog_controller_views_browsertest.cc index 915021540..2f0218a 100644 --- a/chrome/browser/ui/views/media_router/media_router_dialog_controller_views_browsertest.cc +++ b/chrome/browser/ui/views/media_router/media_router_dialog_controller_views_browsertest.cc
@@ -115,7 +115,30 @@ CreateDialogController(); dialog_controller_->ShowMediaRouterDialogForPresentation( CreateStartPresentationContext(initiator_)); - EXPECT_TRUE(MediaDialogView::IsShowing()); + ASSERT_TRUE(MediaDialogView::IsShowing()); + auto* view = MediaDialogView::GetDialogViewForTesting(); + ASSERT_TRUE(view->GetAnchorView()); +} + +IN_PROC_BROWSER_TEST_F(GlobalMediaControlsDialogTest, OpenGMCDialogInWebApp) { + EXPECT_FALSE(MediaDialogView::IsShowing()); + // Navigate to a page with origin so that the PresentationRequest notification + // created on this page has an origin to be displayed. + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), embedded_test_server()->GetURL("/simple_page.html"))); + CreateDialogController(); + dialog_controller_->SetHideMediaButtonForTesting(true); + dialog_controller_->ShowMediaRouterDialogForPresentation( + CreateStartPresentationContext(initiator_)); + + ASSERT_TRUE(MediaDialogView::IsShowing()); + auto* view = MediaDialogView::GetDialogViewForTesting(); + // If there does not exist a media button, the dialog should not have an + // anchor view. + EXPECT_FALSE(view->GetAnchorView()); + gfx::Rect anchor_bounds = initiator_->GetContainerBounds(); + anchor_bounds.set_height(0); + EXPECT_EQ(anchor_bounds, view->GetAnchorRect()); } IN_PROC_BROWSER_TEST_F(GlobalMediaControlsDialogTest,
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index f31c3a1..d28f9e8a 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -89,6 +89,7 @@ #include "content/public/browser/web_ui.h" #include "content/public/common/content_client.h" #include "content/public/common/url_utils.h" +#include "crypto/crypto_buildflags.h" #include "extensions/buildflags/buildflags.h" #include "media/media_buildflags.h" #include "ppapi/buildflags/buildflags.h" @@ -321,7 +322,7 @@ #include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h" #endif -#if defined(USE_NSS_CERTS) && defined(USE_AURA) +#if BUILDFLAG(USE_NSS_CERTS) && defined(USE_AURA) #include "chrome/browser/ui/webui/certificate_viewer_ui.h" #endif @@ -1066,7 +1067,7 @@ if (url.host_piece() == chrome::kChromeUITabModalConfirmDialogHost) return &NewWebUI<ConstrainedWebDialogUI>; #endif -#if defined(USE_NSS_CERTS) && defined(USE_AURA) +#if BUILDFLAG(USE_NSS_CERTS) && defined(USE_AURA) if (url.host_piece() == chrome::kChromeUICertificateViewerHost) return &NewWebUI<CertificateViewerUI>; #endif // USE_NSS_CERTS && USE_AURA
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 957b297..38f89e11 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -82,6 +82,7 @@ #include "content/public/browser/web_ui_data_source.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" +#include "crypto/crypto_buildflags.h" #include "device/fido/features.h" #include "media/base/media_switches.h" #include "net/base/url_util.h" @@ -132,7 +133,7 @@ #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) #endif // BUILDFLAG(IS_WIN) -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "chrome/browser/ui/webui/certificate_manager_localized_strings_provider.h" #endif @@ -2938,7 +2939,7 @@ AddImportDataStrings(html_source); #endif -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) certificate_manager::AddLocalizedStrings(html_source); #endif
diff --git a/chrome/browser/ui/webui/settings/settings_ui.cc b/chrome/browser/ui/webui/settings/settings_ui.cc index 50fe425..83f17be1 100644 --- a/chrome/browser/ui/webui/settings/settings_ui.cc +++ b/chrome/browser/ui/webui/settings/settings_ui.cc
@@ -76,6 +76,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h" +#include "crypto/crypto_buildflags.h" #include "printing/buildflags/buildflags.h" #include "ui/resources/grit/webui_resources.h" @@ -134,11 +135,11 @@ #include "chrome/browser/ui/webui/settings/system_handler.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "chrome/browser/ui/webui/certificates_handler.h" #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) #include "chrome/browser/ui/webui/settings/native_certificates_handler.h" -#endif // defined(USE_NSS_CERTS) +#endif // BUILDFLAG(USE_NSS_CERTS) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)) @@ -177,12 +178,12 @@ AddSettingsPageUIHandler(std::make_unique<AppearanceHandler>(web_ui)); -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) AddSettingsPageUIHandler( std::make_unique<certificate_manager::CertificatesHandler>()); #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) AddSettingsPageUIHandler(std::make_unique<NativeCertificatesHandler>()); -#endif // defined(USE_NSS_CERTS) +#endif // BUILDFLAG(USE_NSS_CERTS) #if BUILDFLAG(IS_CHROMEOS_ASH) AddSettingsPageUIHandler( chromeos::cert_provisioning::CertificateProvisioningUiHandler::
diff --git a/chrome/browser/usb/usb_browsertest.cc b/chrome/browser/usb/usb_browsertest.cc index 662020f0..559cfc4 100644 --- a/chrome/browser/usb/usb_browsertest.cc +++ b/chrome/browser/usb/usb_browsertest.cc
@@ -9,6 +9,7 @@ #include "base/memory/raw_ptr.h" #include "base/memory/ref_counted.h" #include "base/task/thread_pool/thread_pool_instance.h" +#include "base/test/scoped_feature_list.h" #include "chrome/browser/chrome_content_browser_client.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/profiles/profile.h" @@ -16,10 +17,12 @@ #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/chooser_bubble_testapi.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/web_applications/web_app_controller_browsertest.h" #include "chrome/browser/usb/usb_chooser_context_factory.h" #include "chrome/browser/usb/usb_chooser_controller.h" #include "chrome/browser/usb/web_usb_chooser.h" #include "chrome/browser/usb/web_usb_service_impl.h" +#include "chrome/browser/web_applications/test/web_app_test_utils.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/content_settings/core/browser/host_content_settings_map.h" @@ -32,9 +35,12 @@ #include "extensions/buildflags/buildflags.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "services/device/public/cpp/test/fake_usb_device_info.h" #include "services/device/public/cpp/test/fake_usb_device_manager.h" #include "services/device/public/mojom/usb_device.mojom.h" #include "services/service_manager/public/cpp/binder_registry.h" +#include "third_party/blink/public/common/features.h" #if BUILDFLAG(ENABLE_EXTENSIONS) #include "chrome/browser/extensions/extension_browsertest.h" @@ -148,6 +154,26 @@ std::unique_ptr<WebUsbChooser> usb_chooser_; }; +scoped_refptr<device::FakeUsbDeviceInfo> CreateSmartCardDevice() { + auto alternate_setting = device::mojom::UsbAlternateInterfaceInfo::New(); + alternate_setting->alternate_setting = 0; + alternate_setting->class_code = 0x0B; // Smart Card + + auto interface = device::mojom::UsbInterfaceInfo::New(); + interface->interface_number = 0; + interface->alternates.push_back(std::move(alternate_setting)); + + auto config = device::mojom::UsbConfigurationInfo::New(); + config->configuration_value = 1; + config->interfaces.push_back(std::move(interface)); + + std::vector<device::mojom::UsbConfigurationInfoPtr> configs; + configs.push_back(std::move(config)); + + return base::MakeRefCounted<device::FakeUsbDeviceInfo>( + 0x4321, 0x8765, "ACME", "Frobinator", "ABCDEF", std::move(configs)); +} + class WebUsbTest : public InProcessBrowserTest { public: void SetUpOnMainThread() override { @@ -425,23 +451,7 @@ LoadExtension(dir.UnpackedPath()); // Configure the test device. - auto alternate_setting = device::mojom::UsbAlternateInterfaceInfo::New(); - alternate_setting->alternate_setting = 0; - alternate_setting->class_code = 0x0B; // Smart Card - - auto interface = device::mojom::UsbInterfaceInfo::New(); - interface->interface_number = 0; - interface->alternates.push_back(std::move(alternate_setting)); - - auto config = device::mojom::UsbConfigurationInfo::New(); - config->configuration_value = 1; - config->interfaces.push_back(std::move(interface)); - - std::vector<device::mojom::UsbConfigurationInfoPtr> configs; - configs.push_back(std::move(config)); - - auto fake_device_info = base::MakeRefCounted<device::FakeUsbDeviceInfo>( - 0x4321, 0x8765, "ACME", "Frobinator", "ABCDEF", std::move(configs)); + auto fake_device_info = CreateSmartCardDevice(); auto device_info = device_manager().AddDevice(fake_device_info); GetChooserContext()->GrantDevicePermission(extension->origin(), *device_info); @@ -452,4 +462,75 @@ } #endif // BUILDFLAG(ENABLE_EXTENSIONS) +class IsolatedAppUsbBrowserTest : public web_app::WebAppControllerBrowserTest { + public: + IsolatedAppUsbBrowserTest() = default; + ~IsolatedAppUsbBrowserTest() override = default; + + void SetUpOnMainThread() override { + WebAppControllerBrowserTest::SetUpOnMainThread(); + + mojo::PendingRemote<device::mojom::UsbDeviceManager> remote; + device_manager_.AddReceiver(remote.InitWithNewPipeAndPassReceiver()); + chooser_context()->SetDeviceManagerForTesting(std::move(remote)); + } + + protected: + UsbChooserContext* chooser_context() { + return UsbChooserContextFactory::GetForProfile(profile()); + } + device::FakeUsbDeviceManager& device_manager() { return device_manager_; } + + private: + base::test::ScopedFeatureList scoped_feature_list_{ + blink::features::kWebAppEnableIsolatedStorage}; + device::FakeUsbDeviceManager device_manager_; +}; + +IN_PROC_BROWSER_TEST_F(IsolatedAppUsbBrowserTest, ClaimInterface) { + auto* non_app_frame = ui_test_utils::NavigateToURL( + browser(), https_server()->GetURL("/banners/isolated/simple.html")); + + const char kAppHost[] = "app.com"; + GURL app_url = https_server()->GetURL(kAppHost, + "/banners/manifest_test_page.html" + "?manifest=manifest_isolated.json"); + EXPECT_TRUE(ui_test_utils::NavigateToURLWithDisposition( + browser(), app_url, WindowOpenDisposition::NEW_FOREGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP)); + web_app::test::InstallPwaForCurrentUrl(browser()); + + auto* app_window = NavigateInNewWindowAndAwaitInstallabilityCheck( + https_server()->GetURL(kAppHost, "/banners/isolated/simple.html")); + auto* app_frame = + app_window->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); + + auto fake_device_info = CreateSmartCardDevice(); + auto device_info = device_manager().AddDevice(std::move(fake_device_info)); + chooser_context()->GrantDevicePermission(https_server()->GetOrigin(), + *device_info); + chooser_context()->GrantDevicePermission(url::Origin::Create(app_url), + *device_info); + + EXPECT_EQ("SecurityError", EvalJs(non_app_frame, R"((async () => { + const devices = await navigator.usb.getDevices(); + const device = devices[0]; + await device.open(); + await device.selectConfiguration(1); + try { + await device.claimInterface(0); + } catch (e) { + return e.name; + } + })();)")); + + EXPECT_TRUE(ExecJs(app_frame, R"((async () => { + const devices = await navigator.usb.getDevices(); + const device = devices[0]; + await device.open(); + await device.selectConfiguration(1); + await device.claimInterface(0); + })();)")); +} + } // namespace
diff --git a/chrome/browser/usb/web_usb_service_impl.cc b/chrome/browser/usb/web_usb_service_impl.cc index 0de1baf..210f393 100644 --- a/chrome/browser/usb/web_usb_service_impl.cc +++ b/chrome/browser/usb/web_usb_service_impl.cc
@@ -193,6 +193,15 @@ } #endif + // Isolated Apps have unrestricted access to any USB interface class. + if (render_frame_host_->GetWebExposedIsolationLevel() >= + content::RenderFrameHost::WebExposedIsolationLevel:: + kMaybeIsolatedApplication) { + // TODO(https://crbug.com/1236706): Should the list of interface classes the + // app expects to claim be encoded in the Web App Manifest? + return {}; + } + // Specified in https://wicg.github.io/webusb#protected-interface-classes std::vector<uint8_t> classes = { device::mojom::kUsbAudioClass, device::mojom::kUsbHidClass,
diff --git a/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc b/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc index d97cdd2..73f22a65 100644 --- a/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc +++ b/chrome/browser/web_applications/app_service/web_app_publisher_helper.cc
@@ -380,6 +380,48 @@ } } +apps::Permissions WebAppPublisherHelper::CreatePermissions( + const WebApp* web_app) { + apps::Permissions permissions; + + const GURL url = web_app->start_url(); + auto* host_content_settings_map = + HostContentSettingsMapFactory::GetForProfile(profile()); + DCHECK(host_content_settings_map); + + for (ContentSettingsType type : kSupportedPermissionTypes) { + ContentSetting setting = + host_content_settings_map->GetContentSetting(url, url, type); + + // Map ContentSettingsType to an apps::mojom::TriState value + apps::TriState setting_val; + switch (setting) { + case CONTENT_SETTING_ALLOW: + setting_val = apps::TriState::kAllow; + break; + case CONTENT_SETTING_ASK: + setting_val = apps::TriState::kAsk; + break; + case CONTENT_SETTING_BLOCK: + setting_val = apps::TriState::kBlock; + break; + default: + setting_val = apps::TriState::kAsk; + } + + content_settings::SettingInfo setting_info; + host_content_settings_map->GetWebsiteSetting(url, url, type, &setting_info); + + permissions.push_back(std::make_unique<apps::Permission>( + apps::ConvertMojomPermissionTypeToPermissionType( + GetPermissionType(type)), + std::make_unique<apps::PermissionValue>(setting_val), + /*is_managed=*/setting_info.source == + content_settings::SETTING_SOURCE_POLICY)); + } + return permissions; +} + #if !BUILDFLAG(IS_CHROMEOS_LACROS) std::unique_ptr<apps::App> WebAppPublisherHelper::CreateWebApp( const WebApp* web_app) { @@ -430,6 +472,7 @@ } } app->policy_id = install_url.spec(); + app->permissions = CreatePermissions(web_app); return app; }
diff --git a/chrome/browser/web_applications/app_service/web_app_publisher_helper.h b/chrome/browser/web_applications/app_service/web_app_publisher_helper.h index 11c7ed3..6cc3a29d 100644 --- a/chrome/browser/web_applications/app_service/web_app_publisher_helper.h +++ b/chrome/browser/web_applications/app_service/web_app_publisher_helper.h
@@ -27,6 +27,7 @@ #include "components/content_settings/core/common/content_settings_types.h" #include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/cpp/icon_types.h" +#include "components/services/app_service/public/cpp/permission.h" #include "components/services/app_service/public/mojom/app_service.mojom.h" #include "components/services/app_service/public/mojom/types.mojom.h" #include "components/webapps/browser/installable/installable_metrics.h" @@ -121,10 +122,14 @@ void SetWebAppShowInFields(apps::mojom::AppPtr& app, const WebApp* web_app); // Appends |web_app| permissions to |target|. + // TODO(crbug.com/1253250): Remove and use CreatePermissions. void PopulateWebAppPermissions( const WebApp* web_app, std::vector<apps::mojom::PermissionPtr>* target); + // Creates permissions for `web_app`. + apps::Permissions CreatePermissions(const WebApp* web_app); + #if !BUILDFLAG(IS_CHROMEOS_LACROS) // Creates an |std::unique_ptr<apps::App>| describing |web_app|. std::unique_ptr<apps::App> CreateWebApp(const WebApp* web_app); @@ -226,6 +231,15 @@ const std::string& shortcut_id, int64_t display_id); + // Checks that the user permits the app launch (possibly presenting a blocking + // user choice dialog). Launches the app with read access to the files in + // `params.launch_files` and returns the created WebContents via `callback`, + // or doesn't launch the app and returns null in `callback`. + void LaunchAppWithFilesCheckingUserPermission( + const std::string& app_id, + apps::AppLaunchParams params, + base::OnceCallback<void(content::WebContents*)> callback); + Profile* profile() { return profile_; } apps::mojom::AppType app_type() const { return app_type_; } @@ -327,15 +341,6 @@ apps::mojom::OptionalBool has_notification_indicator); #endif - // Checks that the user permits the app launch (possibly presenting a blocking - // user choice dialog). Launches the app with read access to the files in - // `params.launch_files` and returns the created WebContents via `callback`, - // or doesn't launch the app and returns null in `callback`. - void LaunchAppWithFilesCheckingUserPermission( - const std::string& app_id, - apps::AppLaunchParams params, - base::OnceCallback<void(content::WebContents*)> callback); - // Called after the user has allowed or denied an app launch with files. void OnFileHandlerDialogCompleted( std::string app_id,
diff --git a/chrome/browser/web_applications/app_service/web_apps_publisher_host.cc b/chrome/browser/web_applications/app_service/web_apps_publisher_host.cc index d92b51e5..2c7cbbd0 100644 --- a/chrome/browser/web_applications/app_service/web_apps_publisher_host.cc +++ b/chrome/browser/web_applications/app_service/web_apps_publisher_host.cc
@@ -26,6 +26,7 @@ #include "chrome/common/chrome_features.h" #include "chromeos/lacros/lacros_service.h" #include "components/content_settings/core/common/content_settings_pattern.h" +#include "components/services/app_service/public/cpp/intent_util.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "ui/events/event_constants.h" @@ -33,35 +34,6 @@ using apps::IconEffects; -namespace { - -using LaunchResultCallback = - base::OnceCallback<void(::crosapi::mojom::LaunchResultPtr)>; - -void ReturnLaunchResult(Profile* profile, - content::WebContents* web_contents, - LaunchResultCallback callback) { - // TODO(crbug.com/1144877): Run callback when the window is ready. - auto* app_instance_tracker = - apps::AppServiceProxyFactory::GetForProfile(profile) - ->BrowserAppInstanceTracker(); - auto launch_result = crosapi::mojom::LaunchResult::New(); - if (app_instance_tracker) { - const apps::BrowserAppInstance* app_instance = - app_instance_tracker->GetAppInstance(web_contents); - launch_result->instance_id = - app_instance ? app_instance->id : base::UnguessableToken::Create(); - } else { - // TODO(crbug.com/1144877): This part of code should not be reached - // after the instance tracker flag is turn on. Replaced with DCHECK when - // the app instance tracker flag is turned on. - launch_result->instance_id = base::UnguessableToken::Create(); - } - std::move(callback).Run(std::move(launch_result)); -} - -} // namespace - namespace web_app { WebAppsPublisherHost::WebAppsPublisherHost(Profile* profile) @@ -215,7 +187,7 @@ auto* web_contents = publisher_helper().ExecuteContextMenuCommand( app_id, id, display::kDefaultDisplayId); - ReturnLaunchResult(profile_, web_contents, std::move(callback)); + ReturnLaunchResult(std::move(callback), web_contents); } void WebAppsPublisherHost::StopApp(const std::string& app_id) { @@ -235,29 +207,55 @@ content::WebContents* web_contents = nullptr; if (launch_params->intent) { if (!profile_) { - ReturnLaunchResult(profile_, nullptr, std::move(callback)); + ReturnLaunchResult(std::move(callback), nullptr); return; } web_contents = publisher_helper().MaybeNavigateExistingWindow( launch_params->app_id, launch_params->intent->url); if (web_contents) { - ReturnLaunchResult(profile_, web_contents, std::move(callback)); + ReturnLaunchResult(std::move(callback), web_contents); return; } } auto params = apps::ConvertCrosapiToLaunchParams(launch_params, profile_); - if (!params.launch_files.empty() && !launch_params->intent) { + bool is_file_handling_launch = + !params.launch_files.empty() && !apps_util::IsShareIntent(params.intent); + if (is_file_handling_launch) { // File handling may create the WebContents asynchronously. - // TODO(crbug/1261263): implement. - NOTIMPLEMENTED_LOG_ONCE(); - params.launch_files.clear(); + publisher_helper().LaunchAppWithFilesCheckingUserPermission( + launch_params->app_id, std::move(params), + base::BindOnce(&WebAppsPublisherHost::ReturnLaunchResult, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + return; } web_contents = publisher_helper().LaunchAppWithParams(std::move(params)); - ReturnLaunchResult(profile_, web_contents, std::move(callback)); + ReturnLaunchResult(std::move(callback), web_contents); +} + +void WebAppsPublisherHost::ReturnLaunchResult( + LaunchCallback callback, + content::WebContents* web_contents) { + // TODO(crbug.com/1144877): Run callback when the window is ready. + auto* app_instance_tracker = + apps::AppServiceProxyFactory::GetForProfile(profile_) + ->BrowserAppInstanceTracker(); + auto launch_result = crosapi::mojom::LaunchResult::New(); + if (app_instance_tracker) { + const apps::BrowserAppInstance* app_instance = + app_instance_tracker->GetAppInstance(web_contents); + launch_result->instance_id = + app_instance ? app_instance->id : base::UnguessableToken::Create(); + } else { + // TODO(crbug.com/1144877): This part of code should not be reached + // after the instance tracker flag is turn on. Replaced with DCHECK when + // the app instance tracker flag is turned on. + launch_result->instance_id = base::UnguessableToken::Create(); + } + std::move(callback).Run(std::move(launch_result)); } void WebAppsPublisherHost::OnShortcutsMenuIconsRead(
diff --git a/chrome/browser/web_applications/app_service/web_apps_publisher_host.h b/chrome/browser/web_applications/app_service/web_apps_publisher_host.h index 9ade0c8..45d3556 100644 --- a/chrome/browser/web_applications/app_service/web_apps_publisher_host.h +++ b/chrome/browser/web_applications/app_service/web_apps_publisher_host.h
@@ -64,6 +64,7 @@ FRIEND_TEST_ALL_PREFIXES(WebAppsPublisherHostBrowserTest, OpenNativeSettings); FRIEND_TEST_ALL_PREFIXES(WebAppsPublisherHostBrowserTest, WindowMode); FRIEND_TEST_ALL_PREFIXES(WebAppsPublisherHostBrowserTest, Launch); + FRIEND_TEST_ALL_PREFIXES(WebAppsPublisherHostBrowserTest, LaunchWithFiles); void OnReady(); @@ -102,6 +103,9 @@ absl::optional<bool> accessing_camera, absl::optional<bool> accessing_microphone) override; + void ReturnLaunchResult(LaunchCallback callback, + content::WebContents* web_contents); + const WebApp* GetWebApp(const AppId& app_id) const; void OnShortcutsMenuIconsRead(
diff --git a/chrome/browser/web_applications/app_service/web_apps_publisher_host_browsertest.cc b/chrome/browser/web_applications/app_service/web_apps_publisher_host_browsertest.cc index 5f09015f..98b5c2d6 100644 --- a/chrome/browser/web_applications/app_service/web_apps_publisher_host_browsertest.cc +++ b/chrome/browser/web_applications/app_service/web_apps_publisher_host_browsertest.cc
@@ -45,6 +45,7 @@ #include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_install_utils.h" #include "chrome/browser/web_applications/web_app_provider.h" +#include "chrome/browser/web_applications/web_app_registry_update.h" #include "chrome/browser/web_applications/web_app_sync_bridge.h" #include "chrome/common/webui_url_constants.h" #include "chrome/test/base/ui_test_utils.h" @@ -63,6 +64,7 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_navigation_observer.h" #include "net/test/embedded_test_server/embedded_test_server.h" +#include "third_party/blink/public/common/features.h" #include "ui/display/types/display_constants.h" #include "ui/message_center/public/cpp/notification.h" #include "ui/message_center/public/cpp/notification_types.h" @@ -134,6 +136,10 @@ public: WebAppsPublisherHostBrowserTest() = default; ~WebAppsPublisherHostBrowserTest() override = default; + + private: + base::test::ScopedFeatureList feature_list_{ + blink::features::kFileHandlingAPI}; }; IN_PROC_BROWSER_TEST_F(WebAppsPublisherHostBrowserTest, PublishApps) { @@ -434,6 +440,44 @@ navigation_observer.Wait(); } +IN_PROC_BROWSER_TEST_F(WebAppsPublisherHostBrowserTest, LaunchWithFiles) { + ASSERT_TRUE(embedded_test_server()->Start()); + const GURL app_url = + embedded_test_server()->GetURL("/web_apps/file_handler_index.html"); + AppId app_id = InstallWebAppFromManifest(browser(), app_url); + + MockAppPublisher mock_app_publisher; + WebAppsPublisherHost web_apps_publisher_host(profile()); + web_apps_publisher_host.SetPublisherForTesting(&mock_app_publisher); + web_apps_publisher_host.Init(); + mock_app_publisher.Wait(); + + const GURL launch_url = + embedded_test_server()->GetURL("/web_apps/file_handler_action.html"); + content::TestNavigationObserver navigation_observer(launch_url); + navigation_observer.StartWatchingNewWebContents(); + auto launch_params = crosapi::mojom::LaunchParams::New(); + launch_params->app_id = app_id; + launch_params->launch_source = apps::mojom::LaunchSource::kFromTest; + launch_params->intent = crosapi::mojom::Intent::New(); + launch_params->intent->action = apps_util::kIntentActionView; + + auto intent_file = crosapi::mojom::IntentFile::New(); + intent_file->file_path = base::FilePath("/path/not/actually/used/file.txt"); + std::vector<crosapi::mojom::IntentFilePtr> files; + files.push_back(std::move(intent_file)); + launch_params->intent->files = std::move(files); + + // Skip past the permission dialog. + web_app::ScopedRegistryUpdate( + &web_app::WebAppProvider::GetForTest(profile())->sync_bridge()) + ->UpdateApp(app_id) + ->SetFileHandlerApprovalState(web_app::ApiApprovalState::kAllowed); + + web_apps_publisher_host.Launch(std::move(launch_params), base::DoNothing()); + navigation_observer.Wait(); +} + IN_PROC_BROWSER_TEST_F(WebAppsPublisherHostBrowserTest, PauseUnpause) { ASSERT_TRUE(embedded_test_server()->Start()); const GURL app_url = embedded_test_server()->GetURL("/web_apps/basic.html");
diff --git a/chrome/browser/web_applications/isolated_app_browsertest.cc b/chrome/browser/web_applications/isolated_app_browsertest.cc index 5809187f..1157eed4 100644 --- a/chrome/browser/web_applications/isolated_app_browsertest.cc +++ b/chrome/browser/web_applications/isolated_app_browsertest.cc
@@ -15,11 +15,14 @@ #include "chrome/browser/push_messaging/push_messaging_service_factory.h" #include "chrome/browser/push_messaging/push_messaging_service_impl.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/ui/web_applications/web_app_controller_browsertest.h" #include "chrome/browser/web_applications/test/service_worker_registration_waiter.h" #include "chrome/browser/web_applications/test/web_app_test_utils.h" +#include "chrome/browser/web_applications/web_app_helpers.h" +#include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/test/base/ui_test_utils.h" #include "components/gcm_driver/common/gcm_message.h" #include "components/gcm_driver/fake_gcm_profile_service.h" @@ -190,6 +193,31 @@ return test::InstallPwaForCurrentUrl(browser()); } + content::RenderFrameHost* OpenApp(const AppId& app_id) { + WebAppRegistrar& registrar = + WebAppProvider::GetForWebApps(profile())->registrar(); + const WebApp* app = registrar.GetAppById(app_id); + EXPECT_TRUE(app); + Browser* app_window = Browser::Create(Browser::CreateParams::CreateForApp( + GenerateApplicationNameFromAppId(app->app_id()), + /*trusted_source=*/true, gfx::Rect(), profile(), + /*user_gesture=*/true)); + return NavigateToURLInNewTab(app_window, app->start_url()); + } + + content::RenderFrameHost* NavigateToURLInNewTab( + Browser* window, + const GURL& url, + WindowOpenDisposition disposition = WindowOpenDisposition::CURRENT_TAB) { + auto new_contents = content::WebContents::Create( + content::WebContents::CreateParams(browser()->profile())); + window->tab_strip_model()->AppendWebContents(std::move(new_contents), + /*foreground=*/true); + return ui_test_utils::NavigateToURLWithDisposition( + window, url, disposition, + ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); + } + content::StoragePartition* default_storage_partition() { return browser()->profile()->GetDefaultStoragePartition(); } @@ -198,33 +226,57 @@ return browser->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); } + Browser* GetBrowserFromFrame(content::RenderFrameHost* frame) { + Browser* browser = chrome::FindBrowserWithWebContents( + content::WebContents::FromRenderFrameHost(frame)); + EXPECT_TRUE(browser); + return browser; + } + private: base::test::ScopedFeatureList scoped_feature_list_; }; IN_PROC_BROWSER_TEST_F(IsolatedAppBrowserTest, AppsPartitioned) { - InstallIsolatedApp(kAppHost); - InstallIsolatedApp(kApp2Host); + AppId app1_id = InstallIsolatedApp(kAppHost); + AppId app2_id = InstallIsolatedApp(kApp2Host); auto* non_app_frame = ui_test_utils::NavigateToURL( browser(), https_server()->GetURL("/banners/isolated/simple.html")); EXPECT_TRUE(non_app_frame); EXPECT_EQ(default_storage_partition(), non_app_frame->GetStoragePartition()); - auto* app_window = NavigateInNewWindowAndAwaitInstallabilityCheck( - https_server()->GetURL(kAppHost, "/banners/isolated/simple.html")); - auto* app_frame = GetMainFrame(app_window); + auto* app_frame = OpenApp(app1_id); EXPECT_NE(default_storage_partition(), app_frame->GetStoragePartition()); - auto* app2_window = NavigateInNewWindowAndAwaitInstallabilityCheck( - https_server()->GetURL(kApp2Host, "/banners/isolated/simple.html")); - auto* app2_frame = GetMainFrame(app2_window); + auto* app2_frame = OpenApp(app2_id); EXPECT_NE(default_storage_partition(), app2_frame->GetStoragePartition()); EXPECT_NE(app_frame->GetStoragePartition(), app2_frame->GetStoragePartition()); } +IN_PROC_BROWSER_TEST_F(IsolatedAppBrowserTest, + OmniboxNavigationOpensNewPwaWindow) { + AppId app_id = InstallIsolatedApp(kAppHost); + + GURL app_url = + https_server()->GetURL(kAppHost, "/banners/isolated/simple.html"); + auto* app_frame = + NavigateToURLInNewTab(browser(), app_url, WindowOpenDisposition::UNKNOWN); + + // The browser shouldn't have opened the app's page. + EXPECT_EQ(GetMainFrame(browser())->GetLastCommittedURL(), GURL()); + + // The app's frame should belong to an isolated PWA browser window. + Browser* app_browser = GetBrowserFromFrame(app_frame); + EXPECT_NE(app_browser, browser()); + EXPECT_TRUE(web_app::AppBrowserController::IsForWebApp(app_browser, app_id)); + EXPECT_EQ(content::RenderFrameHost::WebExposedIsolationLevel:: + kMaybeIsolatedApplication, + app_frame->GetWebExposedIsolationLevel()); +} + class IsolatedAppBrowserCookieTest : public IsolatedAppBrowserTest { public: using CookieHeaders = std::vector<std::string>; @@ -258,14 +310,6 @@ iframe_id, url))); } - content::RenderFrameHost* NavigateToURLInNewTab(const GURL& url) { - auto new_contents = content::WebContents::Create( - content::WebContents::CreateParams(browser()->profile())); - browser()->tab_strip_model()->AppendWebContents(std::move(new_contents), - /*foreground=*/true); - return ui_test_utils::NavigateToURL(browser(), url); - } - private: void MonitorRequest(const net::test_server::HttpRequest& request) { // Replace the host in |request.GetURL()| with the value from the Host @@ -290,16 +334,18 @@ }; IN_PROC_BROWSER_TEST_F(IsolatedAppBrowserCookieTest, Cookies) { - InstallIsolatedApp(kAppHost); + AppId app_id = InstallIsolatedApp(kAppHost); + + GURL app_url = + https_server()->GetURL(kAppHost, "/banners/isolated/cookie.html"); + GURL non_app_url = + https_server()->GetURL(kNonAppHost, "/banners/isolated/cookie.html"); // Load a page that sets a cookie, then create a cross-origin iframe that // loads the same page. - GURL app_url = - https_server()->GetURL(kAppHost, "/banners/isolated/cookie.html"); - auto* app_window = NavigateInNewWindowAndAwaitInstallabilityCheck(app_url); - auto* app_frame = GetMainFrame(app_window); - GURL non_app_url = - https_server()->GetURL(kNonAppHost, "/banners/isolated/cookie.html"); + auto* app_frame = OpenApp(app_id); + auto* app_browser = GetBrowserFromFrame(app_frame); + app_frame = ui_test_utils::NavigateToURL(app_browser, app_url); CreateIframe(app_frame, "child", non_app_url); const auto& app_cookies = GetCookieHeadersForUrl(app_url); @@ -310,8 +356,9 @@ EXPECT_TRUE(non_app_cookies[0].empty()); // Load the pages again. Both frames should send the cookie in their requests. - auto* app_window2 = NavigateInNewWindowAndAwaitInstallabilityCheck(app_url); - auto* app_frame2 = GetMainFrame(app_window2); + auto* app_frame2 = OpenApp(app_id); + auto* app_browser2 = GetBrowserFromFrame(app_frame2); + app_frame2 = ui_test_utils::NavigateToURL(app_browser2, app_url); CreateIframe(app_frame2, "child", non_app_url); EXPECT_EQ(2u, app_cookies.size()); @@ -322,7 +369,7 @@ // Load the cross-origin's iframe as a top-level page. Because this page was // previously loaded in an isolated app, it shouldn't have cookies set when // loaded in a main frame here. - ASSERT_TRUE(NavigateToURLInNewTab(non_app_url)); + ASSERT_TRUE(NavigateToURLInNewTab(browser(), non_app_url)); EXPECT_EQ(3u, non_app_cookies.size()); EXPECT_TRUE(non_app_cookies[2].empty()); @@ -338,11 +385,13 @@ } int64_t InstallIsolatedAppAndWaitForServiceWorker() { - InstallIsolatedApp(app_url_); + AppId app_id = InstallIsolatedApp(app_url_); - app_window_ = NavigateInNewWindowAndAwaitInstallabilityCheck(app_url_); - app_web_contents_ = app_window_->tab_strip_model()->GetActiveWebContents(); - app_frame_ = app_web_contents_->GetMainFrame(); + auto* original_frame = OpenApp(app_id); + app_web_contents_ = + content::WebContents::FromRenderFrameHost(original_frame); + app_window_ = chrome::FindBrowserWithWebContents(app_web_contents_); + app_frame_ = ui_test_utils::NavigateToURL(app_window_, app_url_); storage_partition_ = app_frame_->GetStoragePartition(); EXPECT_NE(default_storage_partition(), storage_partition_);
diff --git a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc index f864ecb..b8d92a0 100644 --- a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc +++ b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc
@@ -1432,10 +1432,9 @@ ASSERT_FALSE( GetManager().GetAppIdForSystemApp(SystemAppType::SETTINGS).has_value()); { - ListPrefUpdateDeprecated update( - TestingBrowserProcess::GetGlobal()->local_state(), - policy::policy_prefs::kSystemFeaturesDisableList); - base::ListValue* list = update.Get(); + ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(), + policy::policy_prefs::kSystemFeaturesDisableList); + base::Value* list = update.Get(); list->Append(policy::SystemFeature::kOsSettings); } WaitForTestSystemAppInstall(); @@ -1449,10 +1448,9 @@ GetAppIconKey(*settings_id)->icon_effects); { - ListPrefUpdateDeprecated update( - TestingBrowserProcess::GetGlobal()->local_state(), - policy::policy_prefs::kSystemFeaturesDisableList); - base::ListValue* list = update.Get(); + ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(), + policy::policy_prefs::kSystemFeaturesDisableList); + base::Value* list = update.Get(); list->ClearList(); } GetAppServiceProxy(browser()->profile())->FlushMojoCallsForTesting(); @@ -1472,10 +1470,9 @@ EXPECT_EQ(apps::mojom::Readiness::kReady, GetAppReadiness(*settings_id)); { - ListPrefUpdateDeprecated update( - TestingBrowserProcess::GetGlobal()->local_state(), - policy::policy_prefs::kSystemFeaturesDisableList); - base::ListValue* list = update.Get(); + ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(), + policy::policy_prefs::kSystemFeaturesDisableList); + base::Value* list = update.Get(); list->Append(policy::SystemFeature::kOsSettings); } @@ -1487,10 +1484,9 @@ GetAppIconKey(*settings_id)->icon_effects); { - ListPrefUpdateDeprecated update( - TestingBrowserProcess::GetGlobal()->local_state(), - policy::policy_prefs::kSystemFeaturesDisableList); - base::ListValue* list = update.Get(); + ListPrefUpdate update(TestingBrowserProcess::GetGlobal()->local_state(), + policy::policy_prefs::kSystemFeaturesDisableList); + base::Value* list = update.Get(); list->ClearList(); } proxy->FlushMojoCallsForTesting();
diff --git a/chrome/browser/web_applications/web_app_helpers.cc b/chrome/browser/web_applications/web_app_helpers.cc index 4da29c0..4ab75ff 100644 --- a/chrome/browser/web_applications/web_app_helpers.cc +++ b/chrome/browser/web_applications/web_app_helpers.cc
@@ -5,15 +5,22 @@ #include "chrome/browser/web_applications/web_app_helpers.h" #include "base/base64.h" +#include "base/feature_list.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/web_applications/isolation_prefs_utils.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "components/crx_file/id_util.h" +#include "components/prefs/pref_service.h" +#include "content/public/common/content_features.h" #include "crypto/sha2.h" +#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/manifest/manifest.mojom.h" #include "url/gurl.h" +#include "url/origin.h" #include "url/url_constants.h" namespace web_app { @@ -114,4 +121,18 @@ : absl::nullopt; } +bool IsUrlInIsolatedAppScope(PrefService* prefs, const GURL& url) { + // For short-term testing, also use kDirectSockets to enable isolated + // application level. DirectSocket WPT and browser tests require application + // isolation level. + // + // TODO(https://crbug.com/1206150): Figure out a better way to enable isolated + // application level in tests. + bool is_isolated_storage_enabled = base::FeatureList::IsEnabled( + blink::features::kWebAppEnableIsolatedStorage); + return base::FeatureList::IsEnabled(features::kDirectSockets) || + (is_isolated_storage_enabled && + web_app::GetStorageIsolationKey(prefs, url::Origin::Create(url))); +} + } // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_helpers.h b/chrome/browser/web_applications/web_app_helpers.h index 3278e6f9..bc1774e 100644 --- a/chrome/browser/web_applications/web_app_helpers.h +++ b/chrome/browser/web_applications/web_app_helpers.h
@@ -12,6 +12,7 @@ #include "third_party/blink/public/mojom/manifest/manifest.mojom-forward.h" class GURL; +class PrefService; class Profile; namespace web_app { @@ -70,6 +71,9 @@ const GURL& url, bool window_only = false); +// Returns true if the given URL is in the scope of any installed isolated PWA. +bool IsUrlInIsolatedAppScope(PrefService* prefs, const GURL& url); + } // namespace web_app #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_HELPERS_H_
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 6845189..fac2518 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1642614982-dff44bb688e1cc081733c1753cd2c2a0049bd16c.profdata +chrome-linux-main-1642636750-7bbac48c5f876fc30f123a0e90b3f405fa38f576.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index e42651bb..7e33490d7 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1642614982-dfab581bea14f80f8c7b7e02932dd91ba2487a23.profdata +chrome-mac-main-1642636750-67451fecc49192f28a56507832ef79b965b61b49.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 8787d911..992c898e 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1642614982-716801fd13a2d90c07c5161c10b98dac8b9ca9fb.profdata +chrome-win32-main-1642636750-6df795d8042c9222a9d01c4fd06fdcec09fa0581.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 16a23f62..9584dc1 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1642614982-96db94ad5f3dc4f5fe8a925113fa887d1e1d307e.profdata +chrome-win64-main-1642636750-232e1ec376b1688709588cdf6819ae4397cb467c.profdata
diff --git a/chrome/common/features.gni b/chrome/common/features.gni index 4841899..c453fe0 100644 --- a/chrome/common/features.gni +++ b/chrome/common/features.gni
@@ -10,6 +10,7 @@ import("//build/config/features.gni") import("//components/feed/features.gni") import("//components/safe_browsing/buildflags.gni") +import("//crypto/features.gni") import("//device/vr/buildflags/buildflags.gni") import("//extensions/buildflags/buildflags.gni") import("//media/media_options.gni") @@ -96,4 +97,5 @@ "safe_browsing_mode=$safe_browsing_mode", "optimize_webui=$optimize_webui", "enable_feed_v2=$enable_feed_v2", + "use_nss_certs=$use_nss_certs", ]
diff --git a/chrome/common/net/BUILD.gn b/chrome/common/net/BUILD.gn index d12a062b2..5591b64 100644 --- a/chrome/common/net/BUILD.gn +++ b/chrome/common/net/BUILD.gn
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/crypto.gni") +import("//crypto/features.gni") assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome")
diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn index 4ab8f6b6..4a810bf 100644 --- a/chrome/installer/linux/BUILD.gn +++ b/chrome/installer/linux/BUILD.gn
@@ -13,6 +13,7 @@ import("//build/util/process_version.gni") import("//build/util/version.gni") import("//components/nacl/features.gni") +import("//components/optimization_guide/features.gni") import("//third_party/angle/gni/angle.gni") import("//third_party/widevine/cdm/widevine.gni") import("//ui/gl/features.gni") @@ -79,6 +80,11 @@ ] } +if (build_with_internal_optimization_guide) { + packaging_files_shlibs += + [ "$root_out_dir/liboptimization_guide_internal.so" ] +} + packaging_files_binaries = packaging_files_executables + packaging_files_shlibs copy("swiftshader_libs") { @@ -234,6 +240,15 @@ } } +if (build_with_internal_optimization_guide) { + strip_binary("strip_optimization_guide") { + binary_input = "$root_out_dir/liboptimization_guide_internal.so" + deps = [ + "//components/optimization_guide/internal:optimization_guide_internal", + ] + } +} + # This target builds all "normal" Linux installers. You must set # is_component_build=false before building this target. group("linux") { @@ -420,6 +435,12 @@ if (!is_chromeos_ash) { public_deps += [ ":rpm_packaging_files" ] } + if (build_with_internal_optimization_guide) { + public_deps += [ + ":strip_optimization_guide", + "//components/optimization_guide/internal:optimization_guide_internal", + ] + } } # Creates .deb and .rpm (RPM for non-ChromeOS only) installer packages.
diff --git a/chrome/installer/linux/common/installer.include b/chrome/installer/linux/common/installer.include index 3009df4..f646063e1 100644 --- a/chrome/installer/linux/common/installer.include +++ b/chrome/installer/linux/common/installer.include
@@ -245,6 +245,13 @@ install -m 644 "${OUTPUTDIR}/vk_swiftshader_icd.json" "${STAGEDIR}/${INSTALLDIR}/" fi + # Optimization Guide Internal + if [ -f "${OUTPUTDIR}/liboptimization_guide_internal.so" ]; then + file="liboptimization_guide_internal.so" + strippedfile="${OUTPUTDIR}/${file}.stripped" + install -m ${SHLIB_PERMS} "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/${file}" + fi + # libc++ if [ -f "${OUTPUTDIR}/lib/libc++.so" ]; then install -m 755 -d "${STAGEDIR}/${INSTALLDIR}/lib/"
diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release index ca2528d..9c6346b 100644 --- a/chrome/installer/mini_installer/chrome.release +++ b/chrome/installer/mini_installer/chrome.release
@@ -33,6 +33,7 @@ nacl_irt_x86_32.nexe: %(VersionDir)s\ nacl_irt_x86_64.nexe: %(VersionDir)s\ notification_helper.exe: %(VersionDir)s\ +optimization_guide_internal.dll: %(VersionDir)s\ resources.pak: %(VersionDir)s\ vk_swiftshader.dll: %(VersionDir)s\ vk_swiftshader_icd.json: %(VersionDir)s\
diff --git a/chrome/installer/util/experiment_labels.cc b/chrome/installer/util/experiment_labels.cc index 606a48a..3089eff 100644 --- a/chrome/installer/util/experiment_labels.cc +++ b/chrome/installer/util/experiment_labels.cc
@@ -9,7 +9,7 @@ #include "base/strings/strcat.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" namespace installer { @@ -26,36 +26,11 @@ base::SPLIT_WANT_NONEMPTY); } -// Returns an abbreviated day name for a zero-based |day_of_week|. -const wchar_t* AbbreviatedDayOfWeek(int day_of_week) { - // Matches the abbreviated day names from the ICU "en" locale. - static constexpr const wchar_t* kDays[] = {L"Sun", L"Mon", L"Tue", L"Wed", - L"Thu", L"Fri", L"Sat"}; - return kDays[day_of_week]; -} - -// Returns an abbreviated month name for a one-based |month|. -const wchar_t* AbbreviatedMonth(int month) { - // Matches the abbreviated month names from the ICU "en" locale. - static constexpr const wchar_t* kMonths[] = {L"Jan", L"Feb", L"Mar", L"Apr", - L"May", L"Jun", L"Jul", L"Aug", - L"Sep", L"Oct", L"Nov", L"Dec"}; - return kMonths[month - 1]; -} - // Returns a formatted string given a date that is compatible with Omaha (see // https://github.com/google/omaha/blob/master/omaha/base/time.cc#L132). std::wstring FormatDate(base::Time date) { - base::Time::Exploded exploded_time; - date.UTCExplode(&exploded_time); - // "Fri, 14 Aug 2015 16:13:03 GMT" - return base::StringPrintf(L"%ls, %02d %ls %04d %02d:%02d:%02d GMT", - AbbreviatedDayOfWeek(exploded_time.day_of_week), - exploded_time.day_of_month, - AbbreviatedMonth(exploded_time.month), - exploded_time.year, exploded_time.hour, - exploded_time.minute, exploded_time.second); + return base::UTF8ToWide(base::TimeFormatHTTP(date)); } // Appends "label_name=label_value|expiration" to |label|.
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 12b2935..0e0ab87 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -7,7 +7,6 @@ import("//build/config/chrome_build.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/compiler/compiler.gni") -import("//build/config/crypto.gni") import("//build/config/features.gni") import("//build/config/ui.gni") import("//build/toolchain/toolchain.gni") @@ -35,6 +34,7 @@ import("//components/signin/features.gni") import("//components/soda/buildflags.gni") import("//components/spellcheck/spellcheck_build_features.gni") +import("//crypto/features.gni") import("//extensions/buildflags/buildflags.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//net/features.gni") @@ -6225,6 +6225,7 @@ "../browser/new_tab_page/modules/photos/photos_service_unittest.cc", "../browser/new_tab_page/modules/safe_browsing/safe_browsing_handler_unittest.cc", "../browser/new_tab_page/modules/task_module/task_module_service_unittest.cc", + "../browser/new_tab_page/modules/task_module/time_format_util_unittest.cc", "../browser/search/ntp_features_unittest.cc", # Android uses a different way of showing browser windows. @@ -6478,6 +6479,11 @@ } } + if (is_chromeos) { + sources += [ "../browser/chromeos/arc/open_with_menu_unittest.cc" ] + deps += [ "//components/arc/common" ] + } + if (is_chromeos_lacros) { assert(enable_system_notifications) sources += [ @@ -6637,6 +6643,7 @@ "../browser/ui/app_list/search/mixer_unittest.cc", "../browser/ui/app_list/search/omnibox_result_unittest.cc", "../browser/ui/app_list/search/ranking/answer_ranker_unittest.cc", + "../browser/ui/app_list/search/ranking/best_match_ranker_unittest.cc", "../browser/ui/app_list/search/ranking/ftrl_ranker_unittest.cc", "../browser/ui/app_list/search/ranking/removed_results_ranker_unittest.cc", "../browser/ui/app_list/search/ranking/score_normalizing_ranker_unittest.cc",
diff --git a/chrome/test/android/BUILD.gn b/chrome/test/android/BUILD.gn index 7b23f9f..abfdfcd 100644 --- a/chrome/test/android/BUILD.gn +++ b/chrome/test/android/BUILD.gn
@@ -11,7 +11,6 @@ "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/ElementController.java", "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/PageController.java", "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/android/PermissionDialog.java", - "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/first_run/DataSaverController.java", "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/first_run/SyncConfirmationViewPageController.java", "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/first_run/TOSController.java", "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/notifications/DownloadNotificationController.java",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/README.md b/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/README.md index 64ff8b1b..dab73f8 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/README.md +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/README.md
@@ -41,7 +41,6 @@ "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/android/PermissionDialog.java", + "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/codelab/SearchEngineSelectionControllerForCodelab.java", + "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/codelab/SettingsControllerForCodelab.java", - "javatests/src/org/chromium/chrome/test/pagecontroller/controllers/first_run/DataSaverController.java", ... ] ```
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/controllers/first_run/DataSaverController.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/controllers/first_run/DataSaverController.java deleted file mode 100644 index d1a4a2c..0000000 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/controllers/first_run/DataSaverController.java +++ /dev/null
@@ -1,35 +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. - -package org.chromium.chrome.test.pagecontroller.controllers.first_run; - -import org.chromium.chrome.R; -import org.chromium.chrome.test.pagecontroller.controllers.PageController; -import org.chromium.chrome.test.pagecontroller.utils.IUi2Locator; -import org.chromium.chrome.test.pagecontroller.utils.Ui2Locators; - -/** - * Data Saver Dialog (part of the First Run Experience) Page Controller. - */ -public class DataSaverController extends PageController { - private static final IUi2Locator LOCATOR_DATA_SAVER = - Ui2Locators.withAnyResEntry(R.id.enable_data_saver_switch); - private static final IUi2Locator LOCATOR_NEXT = Ui2Locators.withAnyResEntry(R.id.next_button); - - private static final DataSaverController sInstance = new DataSaverController(); - private DataSaverController() {} - public static DataSaverController getInstance() { - return sInstance; - } - - public void clickNext() { - mUtils.click(LOCATOR_NEXT); - } - - @Override - public DataSaverController verifyActive() { - mLocatorHelper.verifyOnScreen(LOCATOR_DATA_SAVER); - return this; - } -}
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/rules/ChromeUiApplicationTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/rules/ChromeUiApplicationTestRule.java index 147813a..c90c364 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/rules/ChromeUiApplicationTestRule.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/rules/ChromeUiApplicationTestRule.java
@@ -10,7 +10,6 @@ import org.chromium.base.Log; import org.chromium.chrome.test.pagecontroller.controllers.PageController; -import org.chromium.chrome.test.pagecontroller.controllers.first_run.DataSaverController; import org.chromium.chrome.test.pagecontroller.controllers.first_run.SyncConfirmationViewPageController; import org.chromium.chrome.test.pagecontroller.controllers.first_run.TOSController; import org.chromium.chrome.test.pagecontroller.controllers.ntp.NewTabPageController; @@ -60,10 +59,6 @@ ((TOSController) controller).acceptAndContinue(); controller = detectPageOnFirstRun(); } - if (controller instanceof DataSaverController) { - ((DataSaverController) controller).clickNext(); - controller = detectPageOnFirstRun(); - } if (controller instanceof SyncConfirmationViewPageController) { ((SyncConfirmationViewPageController) controller).clickNoThanks(); controller = detectPageOnFirstRun(); @@ -106,7 +101,7 @@ */ private static PageController detectPageOnFirstRun() { return detectPageAmong(TOSController.getInstance(), - SyncConfirmationViewPageController.getInstance(), DataSaverController.getInstance(), + SyncConfirmationViewPageController.getInstance(), NewTabPageController.getInstance()); } }
diff --git a/chrome/test/data/web_apps/file_handler.json b/chrome/test/data/web_apps/file_handler.json new file mode 100644 index 0000000..75097e9 --- /dev/null +++ b/chrome/test/data/web_apps/file_handler.json
@@ -0,0 +1,14 @@ +{ + "name": "Web app with file handlers", + "start_url": "file_handler_start.html", + "display": "standalone", + "file_handlers": [ + { + "action": "file_handler_action.html", + "name": "Plain Text", + "accept": { + "text/plain": [".txt"] + } + } + ] +} \ No newline at end of file
diff --git a/chrome/test/data/web_apps/file_handler_action.html b/chrome/test/data/web_apps/file_handler_action.html new file mode 100644 index 0000000..88817244 --- /dev/null +++ b/chrome/test/data/web_apps/file_handler_action.html
@@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head> + <link rel="icon" href="basic-48.png"> +</head> +<body> + <h1>Web app with file handlers - Handle launch</h1> + <script> + if ("launchQueue" in window) { + window.launchQueue.setConsumer(launchParams => { + console.log("Launched with: ", launchParams); + }); + } + </script> +</body> +</html>
diff --git a/chrome/test/data/web_apps/file_handler_index.html b/chrome/test/data/web_apps/file_handler_index.html new file mode 100644 index 0000000..e8d780e --- /dev/null +++ b/chrome/test/data/web_apps/file_handler_index.html
@@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> +<head> + <link rel="manifest" href="file_handler.json"> + <link rel="icon" href="basic-48.png"> +</head> +<body> + <h1>Web app with file handlers</h1> + <script> + navigator.serviceWorker.register('/web_apps/service_worker.js'); + </script> +</body> +</html>
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index 4420ff7..5beecd6 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -3,12 +3,12 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") -import("//build/config/crypto.gni") import("//chrome/common/features.gni") import("//chrome/test/base/js2gtest.gni") import("//chrome/test/include_js_tests.gni") import("//chromeos/components/chromebox_for_meetings/buildflags/buildflags.gni") import("//components/signin/features.gni") +import("//crypto/features.gni") import("//extensions/buildflags/buildflags.gni") import("//printing/buildflags/buildflags.gni") import("//third_party/closure_compiler/compile_js.gni") @@ -124,6 +124,7 @@ "net_internals:preprocess", "//build:branding_buildflags", "//chrome/browser/ui", + "//crypto:buildflags", "//services/network/public/cpp", "//skia", "//ui/webui/resources/js:unmodulize",
diff --git a/chrome/test/data/webui/chromeos/personalization_app/avatar_list_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/avatar_list_element_test.ts index cf8e3ee..42e5040 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/avatar_list_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/avatar_list_element_test.ts
@@ -4,7 +4,7 @@ import {AvatarList} from 'chrome://personalization/trusted/user/avatar_list_element.js'; import {UserActionName} from 'chrome://personalization/trusted/user/user_actions.js'; -import {assertDeepEquals} from 'chrome://webui-test/chai_assert.js'; +import {assertDeepEquals, assertEquals} from 'chrome://webui-test/chai_assert.js'; import {baseSetup, initElement, teardownElement} from './personalization_app_test_utils.js'; import {TestPersonalizationStore} from './test_personalization_store.js'; @@ -43,4 +43,19 @@ action, ); }); + + test('calls selectDefaultImage with correct index on click', async () => { + testPersonalizationStore.data.user.defaultUserImages = + testUserProvider.defaultUserImages; + avatarListElement = initElement(AvatarList); + + const image = + avatarListElement!.shadowRoot!.querySelector( + `img[data-id="${testUserProvider.defaultUserImages[0]!.index}"]`) as + HTMLImageElement; + + image.click(); + const index = await testUserProvider.whenCalled('selectDefaultImage'); + assertEquals(testUserProvider.defaultUserImages[0]!.index, index); + }); }
diff --git a/chrome/test/data/webui/chromeos/personalization_app/test_user_interface_provider.ts b/chrome/test/data/webui/chromeos/personalization_app/test_user_interface_provider.ts index e8f0e282..c2e08a1b 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/test_user_interface_provider.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/test_user_interface_provider.ts
@@ -28,6 +28,7 @@ 'setUserImageObserver', 'getDefaultUserImages', 'getUserInfo', + 'selectDefaultImage', ]); } @@ -45,4 +46,8 @@ this.methodCalled('getDefaultUserImages'); return Promise.resolve({defaultUserImages: this.defaultUserImages}); } + + selectDefaultImage(index: number) { + this.methodCalled('selectDefaultImage', index); + } }
diff --git a/chrome/test/data/webui/chromeos/print_management/print_management_test.js b/chrome/test/data/webui/chromeos/print_management/print_management_test.js index d712462..45b560e 100644 --- a/chrome/test/data/webui/chromeos/print_management/print_management_test.js +++ b/chrome/test/data/webui/chromeos/print_management/print_management_test.js
@@ -1178,4 +1178,61 @@ 'print-management:file-generic', jobEntryTestElement.$$('#fileIcon').icon); }); + + test('ensureFileIconClassMatchesFileIcon', () => { + jobEntryTestElement.jobEntry = createJobEntry( + /*id=*/ '1', /*fileName=*/ '.test', + /*date=*/ convertToMojoTime(new Date('February 5, 2020 03:24:00')), + PrinterErrorCode.NO_ERROR, /*completedInfo=*/ null, + createOngoingPrintJobInfo( + /*printedPages=*/ 1, + /*printerError=*/ ActivePrintJobState.kStarted)); + flush(); + assertEquals( + jobEntryTestElement.fileIconClass_, 'flex-center file-icon-gray'); + + jobEntryTestElement.jobEntry = createJobEntry( + /*id=*/ '1', /*fileName=*/ '.doc', + /*date=*/ convertToMojoTime(new Date('February 5, 2020 03:24:00')), + PrinterErrorCode.NO_ERROR, /*completedInfo=*/ null, + createOngoingPrintJobInfo( + /*printedPages=*/ 1, + /*printerError=*/ ActivePrintJobState.kStarted)); + flush(); + assertEquals( + jobEntryTestElement.fileIconClass_, 'flex-center file-icon-blue'); + + jobEntryTestElement.jobEntry = createJobEntry( + /*id=*/ '1', /*fileName=*/ ' - Google Drawings', + /*date=*/ convertToMojoTime(new Date('February 5, 2020 03:24:00')), + PrinterErrorCode.NO_ERROR, /*completedInfo=*/ null, + createOngoingPrintJobInfo( + /*printedPages=*/ 1, + /*printerError=*/ ActivePrintJobState.kStarted)); + flush(); + assertEquals( + jobEntryTestElement.fileIconClass_, 'flex-center file-icon-red'); + + jobEntryTestElement.jobEntry = createJobEntry( + /*id=*/ '1', /*fileName=*/ '.xlsx', + /*date=*/ convertToMojoTime(new Date('February 5, 2020 03:24:00')), + PrinterErrorCode.NO_ERROR, /*completedInfo=*/ null, + createOngoingPrintJobInfo( + /*printedPages=*/ 1, + /*printerError=*/ ActivePrintJobState.kStarted)); + flush(); + assertEquals( + jobEntryTestElement.fileIconClass_, 'flex-center file-icon-green'); + + jobEntryTestElement.jobEntry = createJobEntry( + /*id=*/ '1', /*fileName=*/ ' - Google Slides', + /*date=*/ convertToMojoTime(new Date('February 5, 2020 03:24:00')), + PrinterErrorCode.NO_ERROR, /*completedInfo=*/ null, + createOngoingPrintJobInfo( + /*printedPages=*/ 1, + /*printerError=*/ ActivePrintJobState.kStarted)); + flush(); + assertEquals( + jobEntryTestElement.fileIconClass_, 'flex-center file-icon-yellow'); + }); });
diff --git a/chrome/test/data/webui/cr_components/BUILD.gn b/chrome/test/data/webui/cr_components/BUILD.gn index 91b65b3..ad4af16 100644 --- a/chrome/test/data/webui/cr_components/BUILD.gn +++ b/chrome/test/data/webui/cr_components/BUILD.gn
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/crypto.gni") +import("//crypto/features.gni") import("//third_party/closure_compiler/compile_js.gni") import("//tools/typescript/ts_library.gni") import("//ui/webui/resources/tools/generate_grd.gni")
diff --git a/chrome/test/data/webui/cr_components/cr_components_browsertest.js b/chrome/test/data/webui/cr_components/cr_components_browsertest.js index 9ef2626d..7d606eec 100644 --- a/chrome/test/data/webui/cr_components/cr_components_browsertest.js +++ b/chrome/test/data/webui/cr_components/cr_components_browsertest.js
@@ -11,6 +11,7 @@ GEN('#include "chrome/browser/ui/ui_features.h"'); GEN('#include "content/public/test/browser_test.h"'); GEN('#include "build/chromeos_buildflags.h"'); +GEN('#include "crypto/crypto_buildflags.h"'); /* eslint-disable no-var */ @@ -50,7 +51,7 @@ mocha.run(); }); -GEN('#if defined(USE_NSS_CERTS)'); +GEN('#if BUILDFLAG(USE_NSS_CERTS)'); /** * Test fixture for chrome://settings/certificates. This tests the @@ -67,10 +68,10 @@ mocha.run(); }); -GEN('#endif // defined(USE_NSS_CERTS)'); +GEN('#endif // BUILDFLAG(USE_NSS_CERTS)'); -GEN('#if defined(USE_NSS_CERTS) && BUILDFLAG(IS_CHROMEOS_ASH)'); +GEN('#if BUILDFLAG(USE_NSS_CERTS) && BUILDFLAG(IS_CHROMEOS_ASH)'); /** * ChromeOS specific test fixture for chrome://settings/certificates, testing @@ -89,7 +90,7 @@ mocha.run(); }); -GEN('#endif // defined(USE_NSS_CERTS) && BUILDFLAG(IS_CHROMEOS_ASH)'); +GEN('#endif // BUILDFLAG(USE_NSS_CERTS) && BUILDFLAG(IS_CHROMEOS_ASH)'); var CrComponentsManagedDialogTest = class extends CrComponentsBrowserTest { /** @override */
diff --git a/chrome/test/data/webui/settings/chromeos/cellular_networks_list_test.js b/chrome/test/data/webui/settings/chromeos/cellular_networks_list_test.js index cb4dad8..dea8405a 100644 --- a/chrome/test/data/webui/settings/chromeos/cellular_networks_list_test.js +++ b/chrome/test/data/webui/settings/chromeos/cellular_networks_list_test.js
@@ -301,6 +301,36 @@ }); test( + 'Allow only managed cellular networks should hide pending eSIM networks', + async () => { + eSimManagerRemote.addEuiccForTest(1); + init(); + addESimSlot(); + cellularNetworkList.globalPolicy = { + allowOnlyPolicyCellularNetworks: false, + }; + await flushAsync(); + let eSimNetworkList = cellularNetworkList.$$('#esimNetworkList'); + assertTrue(!!eSimNetworkList); + + Polymer.dom.flush(); + + const listItem = eSimNetworkList.$$('network-list-item'); + assertTrue(!!listItem); + const installButton = listItem.$$('#installButton'); + assertTrue(!!installButton); + + cellularNetworkList.globalPolicy = { + allowOnlyPolicyCellularNetworks: true, + }; + eSimManagerRemote.addEuiccForTest(1); + addESimSlot(); + await flushAsync(); + eSimNetworkList = cellularNetworkList.$$('#esimNetworkList'); + assertFalse(!!eSimNetworkList); + }); + + test( 'Fire show toast event if download profile clicked without' + 'non-cellular connection.', async () => {
diff --git a/chrome/updater/activity_impl_win.cc b/chrome/updater/activity_impl_win.cc index 38b34b80..3415e8eb 100644 --- a/chrome/updater/activity_impl_win.cc +++ b/chrome/updater/activity_impl_win.cc
@@ -104,7 +104,7 @@ bool ProcessSystemActiveBit(ProcessActiveBitUnderKeyCallback callback, const std::string& id) { // Clear the active bit under each user in HKU\<sid>. - for (base::win::RegistryKeyIterator it(HKEY_USERS, L"", Wow6432(0)); + for (base::win::RegistryKeyIterator it(HKEY_USERS, L"", KEY_WOW64_32KEY); it.Valid(); ++it) { const std::wstring sid = it.Name(); if (ProcessActiveBit(callback, HKEY_USERS, sid, id))
diff --git a/chrome/updater/app/server/win/server.cc b/chrome/updater/app/server/win/server.cc index 55896653..8bc6514 100644 --- a/chrome/updater/app/server/win/server.cc +++ b/chrome/updater/app/server/win/server.cc
@@ -19,12 +19,14 @@ #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/strings/strcat.h" +#include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/system/sys_info.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "base/task/thread_pool/thread_pool_instance.h" #include "base/threading/sequenced_task_runner_handle.h" +#include "base/win/registry.h" #include "chrome/installer/util/work_item_list.h" #include "chrome/updater/app/server/win/com_classes.h" #include "chrome/updater/app/server/win/com_classes_legacy.h" @@ -79,9 +81,9 @@ uninstall_if_unused_command.AppendSwitch(kEnableLoggingSwitch); uninstall_if_unused_command.AppendSwitchASCII(kLoggingModuleSwitch, kLoggingModuleSwitchValue); - list->AddCreateRegKeyWorkItem(root, UPDATER_KEY, Wow6432(0)); + list->AddCreateRegKeyWorkItem(root, UPDATER_KEY, KEY_WOW64_32KEY); list->AddSetRegValueWorkItem( - root, UPDATER_KEY, Wow6432(0), kRegValueUninstallCmdLine, + root, UPDATER_KEY, KEY_WOW64_32KEY, kRegValueUninstallCmdLine, uninstall_if_unused_command.GetCommandLineString(), true); return true; @@ -215,8 +217,41 @@ bool ComServerApp::MigrateLegacyUpdaters( base::RepeatingCallback<void(const RegistrationRequest&)> register_callback) { - // TODO(crbug.com/1250524): Implement. Note we will need both user and system - // scopes here. + HKEY root = (updater_scope() == UpdaterScope::kSystem) ? HKEY_LOCAL_MACHINE + : HKEY_CURRENT_USER; + for (base::win::RegistryKeyIterator it(root, CLIENTS_KEY, KEY_WOW64_32KEY); + it.Valid(); ++it) { + const std::wstring app_id = it.Name(); + + // Skip importing legacy updater. + if (base::EqualsCaseInsensitiveASCII(app_id, kLegacyGoogleUpdaterAppID)) + continue; + + base::win::RegKey key; + if (key.Open(root, base::StrCat({CLIENTS_KEY, app_id}).c_str(), + Wow6432(KEY_READ)) != ERROR_SUCCESS) { + continue; + } + + RegistrationRequest registration; + registration.app_id = base::SysWideToUTF8(app_id); + std::wstring pv; + if (key.ReadValue(kRegValuePV, &pv) == ERROR_SUCCESS) + registration.version = base::Version(base::SysWideToUTF8(pv)); + if (!registration.version.IsValid()) + continue; + + std::wstring brand_code; + if (key.ReadValue(kRegValueBrandCode, &brand_code) == ERROR_SUCCESS) + registration.brand_code = base::SysWideToUTF8(brand_code); + + std::wstring ap; + if (key.ReadValue(kRegValueAP, &ap) == ERROR_SUCCESS) + registration.ap = base::SysWideToUTF8(ap); + + register_callback.Run(registration); + } + return true; }
diff --git a/chrome/updater/win/setup/setup.cc b/chrome/updater/win/setup/setup.cc index 2517636..35fa1ec 100644 --- a/chrome/updater/win/setup/setup.cc +++ b/chrome/updater/win/setup/setup.cc
@@ -159,11 +159,12 @@ for (const auto& key_path : {GetRegistryKeyClientsUpdater(), GetRegistryKeyClientStateUpdater()}) { - install_list->AddCreateRegKeyWorkItem(key, key_path, Wow6432(0)); - install_list->AddSetRegValueWorkItem(key, key_path, Wow6432(0), kRegValuePV, - kUpdaterVersionUtf16, true); + install_list->AddCreateRegKeyWorkItem(key, key_path, KEY_WOW64_32KEY); + install_list->AddSetRegValueWorkItem(key, key_path, KEY_WOW64_32KEY, + kRegValuePV, kUpdaterVersionUtf16, + true); install_list->AddSetRegValueWorkItem( - key, key_path, Wow6432(0), kRegValueName, + key, key_path, KEY_WOW64_32KEY, kRegValueName, base::ASCIIToWide(PRODUCT_FULLNAME_STRING), true); }
diff --git a/chrome/updater/win/setup/uninstall.cc b/chrome/updater/win/setup/uninstall.cc index 72e25f6..a5f18ba 100644 --- a/chrome/updater/win/setup/uninstall.cc +++ b/chrome/updater/win/setup/uninstall.cc
@@ -145,7 +145,7 @@ if (uninstall_all) { std::unique_ptr<WorkItemList> uninstall_list( WorkItem::CreateWorkItemList()); - uninstall_list->AddDeleteRegKeyWorkItem(key, UPDATER_KEY, Wow6432(0)); + uninstall_list->AddDeleteRegKeyWorkItem(key, UPDATER_KEY, KEY_WOW64_32KEY); if (!uninstall_list->Do()) { LOG(ERROR) << "Failed to delete the registry keys."; uninstall_list->Rollback();
diff --git a/chrome/updater/win/win_constants.cc b/chrome/updater/win/win_constants.cc index 08bff61..9b9bc87 100644 --- a/chrome/updater/win/win_constants.cc +++ b/chrome/updater/win/win_constants.cc
@@ -6,6 +6,8 @@ namespace updater { +const wchar_t kLegacyGoogleUpdaterAppID[] = + L"{430FD4D0-B729-4F61-AA34-91526481799D}"; const wchar_t kUpdaterProcessName[] = L"updater.exe"; const wchar_t kGlobalPrefix[] = L"Global\\G"; @@ -14,6 +16,8 @@ const wchar_t kPrefsAccessMutex[] = L"{D8E4A6FE-EA7A-4D20-A8C8-B4628776A101}"; const wchar_t kRegValuePV[] = L"pv"; +const wchar_t kRegValueBrandCode[] = L"brand"; +const wchar_t kRegValueAP[] = L"ap"; const wchar_t kRegValueName[] = L"name"; const wchar_t kRegValueUninstallCmdLine[] = L"UninstallCmdLine";
diff --git a/chrome/updater/win/win_constants.h b/chrome/updater/win/win_constants.h index 06f0244..3bb7874c 100644 --- a/chrome/updater/win/win_constants.h +++ b/chrome/updater/win/win_constants.h
@@ -11,6 +11,8 @@ namespace updater { +extern const wchar_t kLegacyGoogleUpdaterAppID[]; + extern const wchar_t kUpdaterProcessName[]; // The prefix to use for global names in WIN32 API's. The prefix is necessary @@ -43,6 +45,8 @@ #define ENV_GOOGLE_UPDATE_IS_MACHINE COMPANY_SHORTNAME_STRING L"UpdateIsMachine" extern const wchar_t kRegValuePV[]; +extern const wchar_t kRegValueBrandCode[]; +extern const wchar_t kRegValueAP[]; extern const wchar_t kRegValueName[]; extern const wchar_t kRegValueUninstallCmdLine[];
diff --git a/chrome/updater/win/win_util.cc b/chrome/updater/win/win_util.cc index 32cbd07..abd04003 100644 --- a/chrome/updater/win/win_util.cc +++ b/chrome/updater/win/win_util.cc
@@ -581,6 +581,8 @@ } REGSAM Wow6432(REGSAM access) { + CHECK(access); + return KEY_WOW64_32KEY | access; }
diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn index 4d1c6381..3fa49b9 100644 --- a/chrome/utility/BUILD.gn +++ b/chrome/utility/BUILD.gn
@@ -3,11 +3,11 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") -import("//build/config/crypto.gni") import("//build/config/features.gni") import("//build/config/sysroot.gni") import("//chrome/common/features.gni") import("//chromeos/assistant/assistant.gni") +import("//crypto/features.gni") import("//extensions/buildflags/buildflags.gni") import("//printing/buildflags/buildflags.gni") @@ -108,6 +108,8 @@ "importer/nss_decryptor.cc", "importer/nss_decryptor.h", ] + + deps += [ "//crypto:buildflags" ] } if (is_win) { sources += [
diff --git a/chrome/utility/importer/nss_decryptor.cc b/chrome/utility/importer/nss_decryptor.cc index 4c484b7..57ce79f0 100644 --- a/chrome/utility/importer/nss_decryptor.cc +++ b/chrome/utility/importer/nss_decryptor.cc
@@ -18,13 +18,14 @@ #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/common/importer/importer_data_types.h" +#include "crypto/crypto_buildflags.h" #include "sql/database.h" #include "sql/statement.h" -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include <pk11pub.h> #include <pk11sdr.h> -#endif // defined(USE_NSS_CERTS) +#endif // BUILDFLAG(USE_NSS_CERTS) // This method is based on some Firefox code in // security/manager/ssl/src/nsSDR.cpp @@ -126,11 +127,11 @@ SECItem reply; reply.data = nullptr; reply.len = 0; -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) result = PK11SDR_DecryptWithSlot(slot, &request, &reply, NULL); #else result = PK11SDR_Decrypt(&request, &reply, NULL); -#endif // defined(USE_NSS_CERTS) +#endif // BUILDFLAG(USE_NSS_CERTS) if (result == SECSuccess) plain.assign(reinterpret_cast<char*>(reply.data), reply.len);
diff --git a/chrome/utility/importer/nss_decryptor.h b/chrome/utility/importer/nss_decryptor.h index a455154..cc3c7c7 100644 --- a/chrome/utility/importer/nss_decryptor.h +++ b/chrome/utility/importer/nss_decryptor.h
@@ -6,10 +6,11 @@ #define CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_H_ #include "build/build_config.h" +#include "crypto/crypto_buildflags.h" #if BUILDFLAG(IS_WIN) #include "chrome/utility/importer/nss_decryptor_win.h" -#elif defined(USE_NSS_CERTS) +#elif BUILDFLAG(USE_NSS_CERTS) #include "chrome/utility/importer/nss_decryptor_system_nss.h" #else #error NSSDecryptor not implemented.
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 72a2b9dc3..bb7b10e 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -14458.0.0 \ No newline at end of file +14466.0.0 \ No newline at end of file
diff --git a/chromeos/profiles/atom.afdo.newest.txt b/chromeos/profiles/atom.afdo.newest.txt index 8a1af8d8..064aca0 100644 --- a/chromeos/profiles/atom.afdo.newest.txt +++ b/chromeos/profiles/atom.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-atom-99-4815.0-1642417637-benchmark-99.0.4837.0-r1-redacted.afdo.xz +chromeos-chrome-amd64-atom-99-4815.0-1642417637-benchmark-99.0.4838.0-r1-redacted.afdo.xz
diff --git a/chromeos/profiles/bigcore.afdo.newest.txt b/chromeos/profiles/bigcore.afdo.newest.txt index f397e67..69c5df89 100644 --- a/chromeos/profiles/bigcore.afdo.newest.txt +++ b/chromeos/profiles/bigcore.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-bigcore-99-4815.0-1642415760-benchmark-99.0.4837.0-r1-redacted.afdo.xz +chromeos-chrome-amd64-bigcore-99-4815.0-1642415760-benchmark-99.0.4838.0-r1-redacted.afdo.xz
diff --git a/chromeos/tast_control.gni b/chromeos/tast_control.gni index 6011601..d741365 100644 --- a/chromeos/tast_control.gni +++ b/chromeos/tast_control.gni
@@ -45,9 +45,6 @@ # crbug.com/1263234 "quicksettings.ManagedDeviceInfo", - # b/201197372 - "crostini.AppEmacs", - # crbug.com/1273743 "crostini.Launcher.local_wayland_bullseye_stable", "crostini.Launcher.local_wayland_buster_stable",
diff --git a/components/BUILD.gn b/components/BUILD.gn index 59d18e5..0c44ad51 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -372,7 +372,6 @@ "//components/crash/content/browser:unit_tests", "//components/crash/core/app:unit_tests", "//components/data_reduction_proxy/core/browser:unit_tests", - "//components/data_reduction_proxy/core/common:unit_tests", ] }
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.cc b/components/arc/intent_helper/arc_intent_helper_bridge.cc index f23e52b..6a5f398 100644 --- a/components/arc/intent_helper/arc_intent_helper_bridge.cc +++ b/components/arc/intent_helper/arc_intent_helper_bridge.cc
@@ -168,8 +168,11 @@ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); arc_bridge_service_->intent_helper()->SetHost(nullptr); LinkHandlerModel::SetDelegate(nullptr); +} + +void ArcIntentHelperBridge::Shutdown() { for (auto& observer : observer_list_) - observer.OnArcIntentHelperBridgeDestruction(); + observer.OnArcIntentHelperBridgeShutdown(); } void ArcIntentHelperBridge::OnIconInvalidated(const std::string& package_name) { @@ -383,6 +386,7 @@ } if (!instance) { LOG(ERROR) << "Failed to get instance for RequestUrlHandlerList()."; + std::move(callback).Run(std::vector<IntentHandlerInfo>()); return false; }
diff --git a/components/arc/intent_helper/arc_intent_helper_bridge.h b/components/arc/intent_helper/arc_intent_helper_bridge.h index dd0f561..4d522946 100644 --- a/components/arc/intent_helper/arc_intent_helper_bridge.h +++ b/components/arc/intent_helper/arc_intent_helper_bridge.h
@@ -74,6 +74,9 @@ ArcIntentHelperBridge& operator=(const ArcIntentHelperBridge&) = delete; ~ArcIntentHelperBridge() override; + // KeyedService: + void Shutdown() override; + // mojom::IntentHelperHost void OnIconInvalidated(const std::string& package_name) override; void OnIntentFiltersUpdated(
diff --git a/components/arc/intent_helper/arc_intent_helper_observer.h b/components/arc/intent_helper/arc_intent_helper_observer.h index c9ae0f1..59599cf 100644 --- a/components/arc/intent_helper/arc_intent_helper_observer.h +++ b/components/arc/intent_helper/arc_intent_helper_observer.h
@@ -45,8 +45,8 @@ virtual void OnIconInvalidated(const std::string& package_name) {} - // Called when ArcIntentHelperBridge is destroyed. - virtual void OnArcIntentHelperBridgeDestruction() {} + // Called when ArcIntentHelperBridge is shut down. + virtual void OnArcIntentHelperBridgeShutdown() {} }; } // namespace arc
diff --git a/components/autofill/core/browser/payments/payments_client.cc b/components/autofill/core/browser/payments/payments_client.cc index 4a7564bc..8604aee 100644 --- a/components/autofill/core/browser/payments/payments_client.cc +++ b/components/autofill/core/browser/payments/payments_client.cc
@@ -697,6 +697,36 @@ response.FindStringKey("credit_card_id"); upload_card_response_details_.server_id = credit_card_id ? *credit_card_id : std::string(); + + const absl::optional<int> instrument_id = + response.FindIntKey("instrument_id"); + upload_card_response_details_.instrument_id = + instrument_id.has_value() ? static_cast<int64_t>(instrument_id.value()) + : 0; + + const auto* virtual_card_metadata = response.FindKeyOfType( + "virtual_card_metadata", base::Value::Type::DICTIONARY); + if (virtual_card_metadata) { + const std::string* virtual_card_enrollment_status = + virtual_card_metadata->FindStringKey("status"); + if (virtual_card_enrollment_status) { + if (*virtual_card_enrollment_status == "ENROLLED") { + upload_card_response_details_.virtual_card_enrollment_state = + CreditCard::VirtualCardEnrollmentState::ENROLLED; + } else if (*virtual_card_enrollment_status == "ENROLLMENT_ELIGIBLE") { + upload_card_response_details_.virtual_card_enrollment_state = + CreditCard::VirtualCardEnrollmentState::UNENROLLED_AND_ELIGIBLE; + } else { + upload_card_response_details_.virtual_card_enrollment_state = + CreditCard::VirtualCardEnrollmentState:: + UNENROLLED_AND_NOT_ELIGIBLE; + } + } + } + + const std::string* card_art_url = response.FindStringKey("card_art_url"); + upload_card_response_details_.card_art_url = + card_art_url ? GURL(*card_art_url) : GURL(); } bool IsResponseComplete() override { return true; }
diff --git a/components/autofill/core/browser/payments/payments_client.h b/components/autofill/core/browser/payments/payments_client.h index 6c73ae1..45c0904 100644 --- a/components/autofill/core/browser/payments/payments_client.h +++ b/components/autofill/core/browser/payments/payments_client.h
@@ -284,9 +284,26 @@ // UploadCardRequest. struct UploadCardResponseDetails { std::string server_id; - // TODO(crbug.com/1281695): Add |virtual_card_enrollment_state| and - // |card_art_url| data members when integrating all of the logic for the - // virtual-card enrollment flow. + // |instrument_id| is used by the server as an identifier for the card that + // was uploaded. Currently, we have it in the UploadCardResponseDetails so + // that we can send it in the GetDetailsForEnrollRequest in the virtual card + // enrollment flow. + int64_t instrument_id = 0; + // |virtual_card_enrollment_state| is used to determine whether we want to + // pursue further action with the credit card that was uploaded regarding + // virtual card enrollment. For example, if the state is + // UNENROLLED_AND_ELIGIBLE we might offer the user the option to enroll the + // card that was uploaded into virtual card. + CreditCard::VirtualCardEnrollmentState virtual_card_enrollment_state = + CreditCard::VirtualCardEnrollmentState::UNSPECIFIED; + // |card_art_url| is the mapping that would be used by PersonalDataManager + // to try to get the card art for the credit card that was uploaded. It is + // used in flows where after uploading a card we want to display its card + // art. Since chrome sync does not instantly sync the card art with the url, + // the actual card art image might not always be present. Flows that use + // |card_art_url| need to make sure they handle the case where the image has + // not been synced yet. + GURL card_art_url; }; // A collection of information needed for the
diff --git a/components/autofill/core/browser/payments/payments_client_unittest.cc b/components/autofill/core/browser/payments/payments_client_unittest.cc index 750077ba..b6cf9a6 100644 --- a/components/autofill/core/browser/payments/payments_client_unittest.cc +++ b/components/autofill/core/browser/payments/payments_client_unittest.cc
@@ -1141,20 +1141,83 @@ EXPECT_TRUE(HasVariationsHeader()); } -TEST_F(PaymentsClientTest, UploadSuccessWithoutServerId) { +TEST_F(PaymentsClientTest, UploadSuccessEmptyResponse) { StartUploading(/*include_cvc=*/true); IssueOAuthToken(); ReturnResponse(net::HTTP_OK, "{}"); EXPECT_EQ(AutofillClient::PaymentsRpcResult::kSuccess, result_); EXPECT_TRUE(upload_card_response_details_.server_id.empty()); + EXPECT_TRUE(upload_card_response_details_.instrument_id == 0); + EXPECT_TRUE(upload_card_response_details_.virtual_card_enrollment_state == + CreditCard::VirtualCardEnrollmentState::UNSPECIFIED); + EXPECT_TRUE(upload_card_response_details_.card_art_url.is_empty()); } -TEST_F(PaymentsClientTest, UploadSuccessWithServerId) { +TEST_F(PaymentsClientTest, UploadSuccessServerIdPresent) { StartUploading(/*include_cvc=*/true); IssueOAuthToken(); ReturnResponse(net::HTTP_OK, "{ \"credit_card_id\": \"InstrumentData:1\" }"); EXPECT_EQ(AutofillClient::PaymentsRpcResult::kSuccess, result_); - EXPECT_EQ("InstrumentData:1", upload_card_response_details_.server_id); + EXPECT_EQ(upload_card_response_details_.server_id, "InstrumentData:1"); +} + +TEST_F(PaymentsClientTest, UploadSuccessInstrumentIdPresent) { + StartUploading(/*include_cvc=*/true); + IssueOAuthToken(); + ReturnResponse(net::HTTP_OK, "{ \"instrument_id\": 3 }"); + EXPECT_EQ(AutofillClient::PaymentsRpcResult::kSuccess, result_); + EXPECT_EQ(upload_card_response_details_.instrument_id, 3); +} + +TEST_F(PaymentsClientTest, UploadSuccessVirtualCardEnrollmentStatePresent) { + bool oauth_token_issued = false; + for (CreditCard::VirtualCardEnrollmentState virtual_card_enrollment_state : + {CreditCard::VirtualCardEnrollmentState::UNENROLLED_AND_NOT_ELIGIBLE, + CreditCard::VirtualCardEnrollmentState::UNENROLLED_AND_ELIGIBLE, + CreditCard::VirtualCardEnrollmentState::ENROLLED}) { + StartUploading(/*include_cvc=*/true); + // An OAuthToken needs to be issued to initiate the first UploadCard call + // from PaymentsClientTest::StartUploading(), but only for the first call. + // All future calls will use the first OAuthToken. If multiple OAuthTokens + // are issued this test will time out. + if (!oauth_token_issued) { + IssueOAuthToken(); + oauth_token_issued = true; + } + switch (virtual_card_enrollment_state) { + case CreditCard::VirtualCardEnrollmentState::UNENROLLED_AND_NOT_ELIGIBLE: + ReturnResponse(net::HTTP_OK, + "{ \"virtual_card_metadata\": { \"status\": " + "\"ENROLLMENT_STATUS_UNSPECIFIED\" } }"); + break; + case CreditCard::VirtualCardEnrollmentState::UNENROLLED_AND_ELIGIBLE: + ReturnResponse(net::HTTP_OK, + "{ \"virtual_card_metadata\": { \"status\": " + "\"ENROLLMENT_ELIGIBLE\" } }"); + break; + case CreditCard::VirtualCardEnrollmentState::ENROLLED: + ReturnResponse( + net::HTTP_OK, + "{ \"virtual_card_metadata\": { \"status\": \"ENROLLED\" } }"); + break; + case CreditCard::VirtualCardEnrollmentState::UNENROLLED: + case CreditCard::VirtualCardEnrollmentState::UNSPECIFIED: + break; + } + EXPECT_EQ(AutofillClient::PaymentsRpcResult::kSuccess, result_); + EXPECT_EQ(upload_card_response_details_.virtual_card_enrollment_state, + virtual_card_enrollment_state); + } +} + +TEST_F(PaymentsClientTest, UploadSuccessCardArtUrlPresent) { + StartUploading(/*include_cvc=*/true); + IssueOAuthToken(); + ReturnResponse(net::HTTP_OK, + "{ \"card_art_url\": \"https://www.example.com/\" }"); + EXPECT_EQ(AutofillClient::PaymentsRpcResult::kSuccess, result_); + EXPECT_EQ(upload_card_response_details_.card_art_url.spec(), + "https://www.example.com/"); } TEST_F(PaymentsClientTest, UploadIncludesNonLocationData) {
diff --git a/components/browser_ui/styles/android/java/res/drawable/checkmark_blue.xml b/components/browser_ui/styles/android/java/res/drawable/checkmark_blue.xml index 8afc126..11f350c 100644 --- a/components/browser_ui/styles/android/java/res/drawable/checkmark_blue.xml +++ b/components/browser_ui/styles/android/java/res/drawable/checkmark_blue.xml
@@ -9,7 +9,7 @@ android:fillColor="@color/black_alpha_20" android:pathData="M12,14m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"/> <path - android:fillColor="@color/default_icon_color_inverse" + android:fillColor="@macro/default_icon_color_inverse" android:pathData="M4 6H20v12H4z" /> <path android:fillColor="@macro/default_icon_color_accent1"
diff --git a/components/browser_ui/styles/android/java/res/values-night/themes.xml b/components/browser_ui/styles/android/java/res/values-night/themes.xml index 39b8e7c..30657b4 100644 --- a/components/browser_ui/styles/android/java/res/values-night/themes.xml +++ b/components/browser_ui/styles/android/java/res/values-night/themes.xml
@@ -36,7 +36,5 @@ <item name="colorSwitchThumbNormalNonDynamic">@color/baseline_neutral_100</item> <item name="colorSwitchThumbDisabledNonDynamic">@color/baseline_neutral_900_with_neutral_100_alpha_38</item> <item name="colorSwitchTrackNormalNonDynamic">@color/baseline_neutral_variant_400</item> - - <item name="default_icon_color_inverse">@color/default_icon_color_dark</item> </style> </resources>
diff --git a/components/browser_ui/styles/android/java/res/values/semantic_colors_dynamic.xml b/components/browser_ui/styles/android/java/res/values/semantic_colors_dynamic.xml index fcc5672..e7457af9 100644 --- a/components/browser_ui/styles/android/java/res/values/semantic_colors_dynamic.xml +++ b/components/browser_ui/styles/android/java/res/values/semantic_colors_dynamic.xml
@@ -11,6 +11,8 @@ <macro name="default_control_color_normal">?attr/colorOnSurfaceVariant</macro> <macro name="default_icon_color">?attr/colorOnSurface</macro> <macro name="default_icon_color_accent1">?attr/colorPrimary</macro> + <macro name="default_icon_color_inverse">?attr/colorOnSurfaceInverse</macro> + <macro name="default_icon_color_on_accent1">?attr/colorOnPrimary</macro> <macro name="default_icon_color_secondary">?attr/colorOnSurfaceVariant</macro> <macro name="default_text_color">?attr/colorOnSurface</macro> <macro name="default_text_color_accent1">?attr/colorPrimary</macro> @@ -26,6 +28,8 @@ <macro name="default_control_color_normal">@color/default_control_color_normal_baseline</macro> <macro name="default_icon_color">@color/default_icon_color_baseline</macro> <macro name="default_icon_color_accent1">@color/default_icon_color_accent1_baseline</macro> + <macro name="default_icon_color_inverse">@color/default_icon_color_inverse_baseline</macro> + <macro name="default_icon_color_on_accent1">@color/default_icon_color_on_accent1_baseline</macro> <macro name="default_icon_color_secondary">@color/default_icon_color_secondary_baseline</macro> <macro name="default_text_color">@color/default_text_color_baseline</macro> <macro name="default_text_color_accent1">@color/default_text_color_blue_baseline</macro>
diff --git a/components/browser_ui/styles/android/java/res/values/themes.xml b/components/browser_ui/styles/android/java/res/values/themes.xml index feae801..e252c9f 100644 --- a/components/browser_ui/styles/android/java/res/values/themes.xml +++ b/components/browser_ui/styles/android/java/res/values/themes.xml
@@ -58,8 +58,6 @@ <!-- Supports dynamic colors now. --> <item name="default_bg_color_dynamic">?attr/colorSurface</item> <item name="divider_line_bg_color_dynamic">?attr/colorSurfaceVariant</item> - - <item name="default_icon_color_inverse">@color/default_icon_color_light</item> </style> <style name="Base.V31.Theme.BrowserUI" parent="Base.V21.Theme.BrowserUI" /> <style name="Base.Theme.BrowserUI" parent="Base.V31.Theme.BrowserUI" /> @@ -118,8 +116,6 @@ <!-- Supports dynamic colors now. --> <item name="default_bg_color_dynamic">?attr/colorSurface</item> <item name="divider_line_bg_color_dynamic">?attr/colorSurfaceVariant</item> - - <item name="default_icon_color_inverse">@color/default_icon_color_light</item> </style> <style name="Theme.BrowserUI.DialogWhenLarge" parent="Base.Theme.BrowserUI.DialogWhenLarge"/>
diff --git a/components/browser_ui/styles/android/java/src/org/chromium/components/browser_ui/styles/SemanticColorUtils.java b/components/browser_ui/styles/android/java/src/org/chromium/components/browser_ui/styles/SemanticColorUtils.java index 3afd248c..fd715d6 100644 --- a/components/browser_ui/styles/android/java/src/org/chromium/components/browser_ui/styles/SemanticColorUtils.java +++ b/components/browser_ui/styles/android/java/src/org/chromium/components/browser_ui/styles/SemanticColorUtils.java
@@ -61,6 +61,12 @@ return resolve(R.attr.colorOnSurface, R.color.default_icon_color_baseline, context); } + /** Returns the semantic color value that corresponds to default_icon_color_inverse. */ + public static @ColorInt int getDefaultIconColorInverse(Context context) { + return resolve( + R.attr.colorOnSurfaceInverse, R.color.default_icon_color_inverse_baseline, context); + } + /** Returns the semantic color value that corresponds to default_icon_color_accent1. */ public static @ColorInt int getDefaultIconColorAccent1(Context context) { return resolve(R.attr.colorPrimary, R.color.default_icon_color_accent1_baseline, context);
diff --git a/components/browser_ui/widget/android/java/res/drawable/ic_offline_pin_blue_white.xml b/components/browser_ui/widget/android/java/res/drawable/ic_offline_pin_blue_white.xml index bad15c3..7d6c01b 100644 --- a/components/browser_ui/widget/android/java/res/drawable/ic_offline_pin_blue_white.xml +++ b/components/browser_ui/widget/android/java/res/drawable/ic_offline_pin_blue_white.xml
@@ -12,11 +12,11 @@ android:viewportHeight="24"> <path - android:fillColor="@color/default_icon_color_inverse" + android:fillColor="@macro/default_icon_color_on_accent1" android:pathData="M20,12 a8,8 0 1,1 0,-0.0001" /> <path android:fillColor="@macro/default_icon_color_accent1" android:pathData="M12,2 C6.5,2,2,6.5,2,12 C2,17.5,6.5,22,12,22 C17.5,22,22,17.5,22,12 C22,6.5,17.5,2,12,2 Z M17,18 L7,18 L7,16 L17,16 L17,18 Z M10.3,14 L7,10.7 L8.4,9.3 L10.3,11.2 L15.6,5.9 L17,7.3 L10.3,14 Z" /> -</vector> \ No newline at end of file +</vector>
diff --git a/components/browser_ui/widget/android/java/res/layout/textbubble_text_with_image.xml b/components/browser_ui/widget/android/java/res/layout/textbubble_text_with_image.xml index 92301c9c..d6ef450 100644 --- a/components/browser_ui/widget/android/java/res/layout/textbubble_text_with_image.xml +++ b/components/browser_ui/widget/android/java/res/layout/textbubble_text_with_image.xml
@@ -26,7 +26,7 @@ android:layout_marginEnd="8dp" tools:ignore="ContentDescription" android:scaleType="centerInside" - app:tint="@color/default_icon_color_inverse" /> + app:tint="@macro/default_icon_color_inverse" /> <!-- The FrameLayout is to center the smaller LoadingView in the same space as the icon, as well as for providing a contentDescription for the LoadingView. --> @@ -41,7 +41,7 @@ android:layout_width="16sp" android:layout_height="16sp" android:layout_gravity="center" - android:indeterminateTint="@color/default_icon_color_inverse" /> + android:indeterminateTint="@macro/default_icon_color_inverse" /> </FrameLayout> <TextView
diff --git a/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/selectable_list/SelectableItemView.java b/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/selectable_list/SelectableItemView.java index d0049ce..4fa6c8de 100644 --- a/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/selectable_list/SelectableItemView.java +++ b/components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/selectable_list/SelectableItemView.java
@@ -17,11 +17,11 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatImageButton; import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat; import org.chromium.base.ApiCompatibilityUtils; +import org.chromium.components.browser_ui.styles.SemanticColorUtils; import org.chromium.components.browser_ui.widget.R; import org.chromium.components.browser_ui.widget.TintedDrawable; @@ -103,8 +103,8 @@ */ public SelectableItemView(Context context, AttributeSet attrs) { super(context, attrs); - mStartIconSelectedColorList = AppCompatResources.getColorStateList( - getContext(), R.color.default_icon_color_inverse); + mStartIconSelectedColorList = + ColorStateList.valueOf(SemanticColorUtils.getDefaultIconColorInverse(context)); mDefaultLevel = getResources().getInteger(R.integer.list_item_level_default); mSelectedLevel = getResources().getInteger(R.integer.list_item_level_selected); mCheckDrawable = AnimatedVectorDrawableCompat.create( @@ -231,10 +231,15 @@ public static void applyModernIconStyle( ImageView imageView, Drawable defaultIcon, boolean isSelected) { imageView.setBackgroundResource(R.drawable.list_item_icon_modern_bg); - imageView.setImageDrawable( - isSelected ? TintedDrawable.constructTintedDrawable(imageView.getContext(), - R.drawable.ic_check_googblue_24dp, R.color.default_icon_color_inverse) - : defaultIcon); + Drawable drawable; + if (isSelected) { + drawable = TintedDrawable.constructTintedDrawable( + imageView.getContext(), R.drawable.ic_check_googblue_24dp); + drawable.setTint(SemanticColorUtils.getDefaultIconColorInverse(imageView.getContext())); + } else { + drawable = defaultIcon; + } + imageView.setImageDrawable(drawable); imageView.getBackground().setLevel(isSelected ? imageView.getResources().getInteger(R.integer.list_item_level_selected) : imageView.getResources().getInteger(R.integer.list_item_level_default));
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc index 9da17b9..ce830fdc 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
@@ -24,7 +24,6 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metrics.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" #include "components/data_reduction_proxy/core/browser/data_usage_store.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/data_reduction_proxy/proto/data_store.pb.h" @@ -111,13 +110,13 @@ const std::string& pref, int key, int value) { - DictionaryPrefUpdateDeprecated pref_update(pref_service, pref); + DictionaryPrefUpdate pref_update(pref_service, pref); base::Value* pref_dict = pref_update.Get(); const std::string key_str = base::NumberToString(key); base::Value* dict_value = pref_dict->FindKey(key_str); if (dict_value) value += dict_value->GetInt(); - pref_dict->SetKey(key_str, base::Value(value)); + pref_dict->SetIntKey(key_str, value); } // Moves the dictionary stored in preference |pref_src| to |pref_dst|, and @@ -125,13 +124,12 @@ void MoveAndClearDictionaryPrefs(PrefService* pref_service, const std::string& pref_dst, const std::string& pref_src) { - DictionaryPrefUpdateDeprecated pref_update_dst(pref_service, pref_dst); - base::DictionaryValue* pref_dict_dst = pref_update_dst.Get(); - DictionaryPrefUpdateDeprecated pref_update_src(pref_service, pref_src); - base::DictionaryValue* pref_dict_src = pref_update_src.Get(); - pref_dict_dst->DictClear(); - pref_dict_dst->Swap(pref_dict_src); - DCHECK(pref_dict_src->DictEmpty()); + DictionaryPrefUpdate pref_update_dst(pref_service, pref_dst); + base::Value* pref_dict_dst = pref_update_dst.Get(); + DictionaryPrefUpdate pref_update_src(pref_service, pref_src); + base::Value* pref_dict_src = pref_update_src.Get(); + *pref_dict_dst = std::move(*pref_dict_src); + *pref_dict_src = base::Value(base::Value::Type::DICTIONARY); } void MaybeInitWeeklyAggregateDataUsePrefs(const base::Time& now, @@ -428,7 +426,7 @@ base::Value* DataReductionProxyCompressionStats::GetList( const char* pref_path) { if (delay_.is_zero()) - return ListPrefUpdateDeprecated(pref_service_, pref_path).Get(); + return ListPrefUpdate(pref_service_, pref_path).Get(); DelayedWritePrefs(); auto it = list_pref_map_.find(pref_path); @@ -449,7 +447,7 @@ for (auto iter = list_pref_map_.begin(); iter != list_pref_map_.end(); ++iter) { TransferList(iter->second, - ListPrefUpdateDeprecated(pref_service_, iter->first).Get()); + ListPrefUpdate(pref_service_, iter->first).Get()); } }
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc index d4b856d..b749cf6 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc
@@ -37,7 +37,7 @@ void InitializeList(const char* pref_name, int64_t starting_value, PrefService* pref_service) { - ListPrefUpdateDeprecated list(local_state_prefs(), pref_name); + ListPrefUpdate list(local_state_prefs(), pref_name); for (int64_t i = 0; i < 10L; ++i) { list->Append(base::NumberToString(i + starting_value)); }
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc index 81f23c62..7674156 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.cc
@@ -21,9 +21,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" #include "components/data_reduction_proxy/core/browser/data_store.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "components/data_reduction_proxy/proto/data_store.pb.h" #include "components/data_use_measurement/core/data_use_measurement.h" @@ -33,25 +31,6 @@ namespace { -absl::optional<base::Value> GetSaveDataSavingsPercentEstimateFromFieldTrial() { - if (!base::FeatureList::IsEnabled(features::kReportSaveDataSavings)) - return absl::nullopt; - const auto origin_savings_estimate_json = - base::GetFieldTrialParamValueByFeature(features::kReportSaveDataSavings, - "origin_savings_estimate"); - if (origin_savings_estimate_json.empty()) - return absl::nullopt; - - auto origin_savings_estimates = - base::JSONReader::Read(origin_savings_estimate_json); - - UMA_HISTOGRAM_BOOLEAN( - "DataReductionProxy.ReportSaveDataSavings.ParseResult", - origin_savings_estimates && origin_savings_estimates->is_dict()); - - return origin_savings_estimates; -} - // Hostname used for the other bucket which consists of chrome-services traffic. // This should be in sync with the same in DataReductionSiteBreakdownView.java const char kOtherHostName[] = "Other"; @@ -69,9 +48,7 @@ prefs_(prefs), db_data_owner_(new DBDataOwner(std::move(store))), db_task_runner_(db_task_runner), - data_use_measurement_(data_use_measurement), - save_data_savings_estimate_dict_( - GetSaveDataSavingsPercentEstimateFromFieldTrial()) { + data_use_measurement_(data_use_measurement) { DCHECK(data_use_measurement_); DCHECK(settings); @@ -222,15 +199,7 @@ double DataReductionProxyService::GetSaveDataSavingsPercentEstimate( const std::string& origin) const { - if (origin.empty() || !save_data_savings_estimate_dict_ || - !save_data_savings_estimate_dict_->is_dict()) { - return 0; - } - const auto savings_percent = - save_data_savings_estimate_dict_->FindDoubleKey(origin); - if (!savings_percent) - return 0; - return *savings_percent; + return 0; } } // namespace data_reduction_proxy
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h index 503728b..83b9f299 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h
@@ -141,9 +141,6 @@ // lifetime of |this|. raw_ptr<data_use_measurement::DataUseMeasurement> data_use_measurement_; - // Dictionary of save-data savings estimates by origin. - const absl::optional<base::Value> save_data_savings_estimate_dict_; - SEQUENCE_CHECKER(sequence_checker_); base::WeakPtrFactory<DataReductionProxyService> weak_factory_{this};
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc index 01ab42f3..5c027770 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
@@ -14,8 +14,6 @@ #include "base/time/default_clock.h" #include "build/build_config.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/prefs/pref_member.h"
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.cc index 8a18c13..b7943b2 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.cc
@@ -12,7 +12,6 @@ #include "base/strings/string_piece.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/prefs/pref_registry_simple.h" @@ -52,10 +51,10 @@ ResetSettings(nullptr); - ListPrefUpdateDeprecated original_update( - test_context_->pref_service(), prefs::kDailyHttpOriginalContentLength); - ListPrefUpdateDeprecated received_update( - test_context_->pref_service(), prefs::kDailyHttpReceivedContentLength); + ListPrefUpdate original_update(test_context_->pref_service(), + prefs::kDailyHttpOriginalContentLength); + ListPrefUpdate received_update(test_context_->pref_service(), + prefs::kDailyHttpReceivedContentLength); for (int64_t i = 0; i < kNumDaysInHistory; i++) { original_update->Insert(original_update->GetList().begin(), base::Value(base::NumberToString(2 * i)));
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc index 078e0fe8..acb527a 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc
@@ -18,7 +18,6 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" #include "components/data_reduction_proxy/core/browser/data_store.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/prefs/pref_registry_simple.h"
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h index ac87bac..9561ae1 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h
@@ -20,7 +20,6 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h" #include "components/data_reduction_proxy/core/browser/data_store.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/data_use_measurement/core/data_use_measurement.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/testing_pref_service.h"
diff --git a/components/data_reduction_proxy/core/common/BUILD.gn b/components/data_reduction_proxy/core/common/BUILD.gn index 4b87a71..7eb0e541 100644 --- a/components/data_reduction_proxy/core/common/BUILD.gn +++ b/components/data_reduction_proxy/core/common/BUILD.gn
@@ -9,12 +9,8 @@ template("common_tmpl") { static_library(target_name) { sources = [ - "data_reduction_proxy_features.cc", - "data_reduction_proxy_features.h", "data_reduction_proxy_headers.cc", "data_reduction_proxy_headers.h", - "data_reduction_proxy_params.cc", - "data_reduction_proxy_params.h", "data_reduction_proxy_pref_names.cc", "data_reduction_proxy_pref_names.h", "data_reduction_proxy_switches.cc", @@ -44,25 +40,6 @@ ] } -source_set("unit_tests") { - testonly = true - sources = [ "data_reduction_proxy_params_unittest.cc" ] - - deps = [ - ":common", - "//base", - "//base/test:test_support", - "//components/prefs", - "//components/prefs:test_support", - - # TODO this dependency seems wrong, but - "//components/data_reduction_proxy/core/browser", - "//components/data_reduction_proxy/proto:data_reduction_proxy_proto", - "//net:test_support", - "//testing/gtest", - ] -} - process_version("version_header") { template_file = "version.h.in" sources = [ "//chrome/VERSION" ]
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_features.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_features.cc deleted file mode 100644 index 39ebc409..0000000 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_features.cc +++ /dev/null
@@ -1,23 +0,0 @@ -// Copyright 2017 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/data_reduction_proxy/core/common/data_reduction_proxy_features.h" - -#include "build/build_config.h" - -namespace data_reduction_proxy { -namespace features { - -// Enables the data saver promo for low memory Android devices. -const base::Feature kDataReductionProxyLowMemoryDevicePromo{ - "DataReductionProxyLowMemoryDevicePromo", - base::FEATURE_DISABLED_BY_DEFAULT}; - -// Reports estimated data savings due to save-data request header and JS API, as -// savings provided by DataSaver. -const base::Feature kReportSaveDataSavings{"ReportSaveDataSavings", - base::FEATURE_DISABLED_BY_DEFAULT}; - -} // namespace features -} // namespace data_reduction_proxy
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_features.h b/components/data_reduction_proxy/core/common/data_reduction_proxy_features.h deleted file mode 100644 index aa28cfb..0000000 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_features.h +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright 2017 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_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_FEATURES_H_ -#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_FEATURES_H_ - -#include "base/feature_list.h" - -namespace data_reduction_proxy { -namespace features { - -extern const base::Feature kDataReductionProxyLowMemoryDevicePromo; -extern const base::Feature kReportSaveDataSavings; - -} // namespace features -} // namespace data_reduction_proxy -#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_FEATURES_H_
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.cc index 7b67569..06fd8c5a 100644 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.cc +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.cc
@@ -16,8 +16,6 @@ #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/time/time.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "net/http/http_response_headers.h" #include "net/http/http_status_code.h" #include "net/http/http_util.h"
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc deleted file mode 100644 index cc85565..0000000 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc +++ /dev/null
@@ -1,70 +0,0 @@ -// Copyright 2014 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/data_reduction_proxy/core/common/data_reduction_proxy_params.h" - -#include <algorithm> -#include <map> -#include <string> - -#include "base/command_line.h" -#include "base/metrics/field_trial.h" -#include "base/metrics/field_trial_params.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" -#include "build/build_config.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" -#include "net/base/host_port_pair.h" -#include "net/base/proxy_server.h" -#include "net/http/http_status_code.h" -#include "url/url_constants.h" - -#if BUILDFLAG(IS_ANDROID) -#include "base/system/sys_info.h" -#endif - -namespace { - -const char kEnabled[] = "Enabled"; - -bool IsIncludedInFieldTrial(const std::string& name) { - return base::StartsWith(base::FieldTrialList::FindFullName(name), kEnabled, - base::CompareCase::SENSITIVE); -} - -bool CanShowAndroidLowMemoryDevicePromo() { -#if BUILDFLAG(IS_ANDROID) - return base::SysInfo::IsLowEndDevice() && - base::FeatureList::IsEnabled( - data_reduction_proxy::features:: - kDataReductionProxyLowMemoryDevicePromo); -#else - return false; -#endif -} - -} // namespace - -namespace data_reduction_proxy { -namespace params { - -bool IsIncludedInPromoFieldTrial() { - if (IsIncludedInFieldTrial("DataCompressionProxyPromoVisibility")) - return true; - - return CanShowAndroidLowMemoryDevicePromo(); -} - -bool IsIncludedInFREPromoFieldTrial() { - if (IsIncludedInFieldTrial("DataReductionProxyFREPromo")) - return true; - - return CanShowAndroidLowMemoryDevicePromo(); -} - -} // namespace params - -} // namespace data_reduction_proxy
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.h b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.h deleted file mode 100644 index 89395fcb..0000000 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.h +++ /dev/null
@@ -1,29 +0,0 @@ -// Copyright 2014 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_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_PARAMS_H_ -#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_PARAMS_H_ - -#include "url/gurl.h" - -namespace data_reduction_proxy { - -// The data_reduction_proxy::params namespace is a collection of methods to -// determine the operating parameters of the Data Reduction Proxy as specified -// by field trials and command line switches. -namespace params { - -// Returns true if this client is part of a field trial that should display -// a promotion for the data reduction proxy. -bool IsIncludedInPromoFieldTrial(); - -// Returns true if this client is part of a field trial that should display -// a FRE promotion for the data reduction proxy. -bool IsIncludedInFREPromoFieldTrial(); - -} // namespace params - -} // namespace data_reduction_proxy - -#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_PARAMS_H_
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc deleted file mode 100644 index 6da4a6c2..0000000 --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params_unittest.cc +++ /dev/null
@@ -1,108 +0,0 @@ -// Copyright 2014 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/data_reduction_proxy/core/common/data_reduction_proxy_params.h" - -#include <stddef.h> - -#include <map> -#include <string> - -#include "base/command_line.h" -#include "base/metrics/field_trial.h" -#include "base/metrics/field_trial_param_associator.h" -#include "base/metrics/field_trial_params.h" -#include "base/test/scoped_feature_list.h" -#include "build/build_config.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" -#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" -#include "net/base/proxy_server.h" -#include "net/http/http_status_code.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/abseil-cpp/absl/types/optional.h" - -#if BUILDFLAG(IS_ANDROID) -#include "base/system/sys_info.h" -#endif - -namespace data_reduction_proxy { - -class DataReductionProxyParamsTest : public testing::Test {}; - - -TEST_F(DataReductionProxyParamsTest, PromoFieldTrial) { - const struct { - std::string trial_group_name; - bool expected_enabled; - } tests[] = { - {"Enabled", true}, - {"Enabled_Control", true}, - {"Disabled", false}, - {"enabled", false}, - }; - - for (const auto& test : tests) { - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.Init(); - - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "DataCompressionProxyPromoVisibility", test.trial_group_name)); - EXPECT_EQ(test.expected_enabled, params::IsIncludedInPromoFieldTrial()) - << test.trial_group_name; - } -} - -TEST_F(DataReductionProxyParamsTest, FREPromoFieldTrial) { - const struct { - std::string trial_group_name; - bool expected_enabled; - } tests[] = { - {"Enabled", true}, - {"Enabled_Control", true}, - {"Disabled", false}, - {"enabled", false}, - }; - - for (const auto& test : tests) { - base::test::ScopedFeatureList scoped_feature_list; - scoped_feature_list.Init(); - - ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( - "DataReductionProxyFREPromo", test.trial_group_name)); - EXPECT_EQ(test.expected_enabled, params::IsIncludedInFREPromoFieldTrial()) - << test.trial_group_name; - } -} - -TEST_F(DataReductionProxyParamsTest, LowMemoryPromoFeature) { - const struct { - bool expected_in_field_trial; - } tests[] = { - {false}, {true}, - }; - - for (const auto& test : tests) { - base::test::ScopedFeatureList scoped_feature_list; - if (test.expected_in_field_trial) { - scoped_feature_list.InitAndDisableFeature( - features::kDataReductionProxyLowMemoryDevicePromo); - } else { - scoped_feature_list.InitAndEnableFeature( - features::kDataReductionProxyLowMemoryDevicePromo); - } - -#if BUILDFLAG(IS_ANDROID) - EXPECT_EQ(test.expected_in_field_trial && base::SysInfo::IsLowEndDevice(), - params::IsIncludedInPromoFieldTrial()); - EXPECT_EQ(test.expected_in_field_trial && base::SysInfo::IsLowEndDevice(), - params::IsIncludedInFREPromoFieldTrial()); -#else - EXPECT_FALSE(params::IsIncludedInPromoFieldTrial()); - EXPECT_FALSE(params::IsIncludedInFREPromoFieldTrial()); -#endif - } -} - -} // namespace data_reduction_proxy
diff --git a/components/data_use_measurement/core/data_use_tracker_prefs.cc b/components/data_use_measurement/core/data_use_tracker_prefs.cc index 72b8c67..a7fa288 100644 --- a/components/data_use_measurement/core/data_use_tracker_prefs.cc +++ b/components/data_use_measurement/core/data_use_tracker_prefs.cc
@@ -103,12 +103,12 @@ if (!pref_service_) return; - DictionaryPrefUpdateDeprecated pref_updater(pref_service_, pref_name); + DictionaryPrefUpdate pref_updater(pref_service_, pref_name); std::string todays_key = GetCurrentMeasurementDateAsString(); const base::Value* user_pref_dict = pref_service_->GetDictionary(pref_name); double todays_traffic = user_pref_dict->FindDoubleKey(todays_key).value_or(0); - pref_updater->SetDouble( + pref_updater->SetDoubleKey( todays_key, todays_traffic + (static_cast<double>(message_size_bytes) / 1024.0)); }
diff --git a/components/gcm_driver/crypto/BUILD.gn b/components/gcm_driver/crypto/BUILD.gn index e4f6e45..3431911 100644 --- a/components/gcm_driver/crypto/BUILD.gn +++ b/components/gcm_driver/crypto/BUILD.gn
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/crypto.gni") +import("//crypto/features.gni") static_library("crypto") { sources = [
diff --git a/components/infobars/core/infobar_delegate.h b/components/infobars/core/infobar_delegate.h index 079e0f1..ab8370f 100644 --- a/components/infobars/core/infobar_delegate.h +++ b/components/infobars/core/infobar_delegate.h
@@ -132,7 +132,7 @@ DANGEROUS_DOWNLOAD_INFOBAR_DELEGATE_ANDROID = 61, // Removed: DESKTOP_SEARCH_REDIRECTION_INFOBAR_DELEGATE = 62, UPDATE_PASSWORD_INFOBAR_DELEGATE_MOBILE = 63, - DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDROID = 64, + // Removed: DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDROID = 64, AUTOFILL_CREDIT_CARD_FILLING_INFOBAR_DELEGATE_ANDROID = 65, ADS_BLOCKED_INFOBAR_DELEGATE_ANDROID = 66, INSTANT_APPS_INFOBAR_DELEGATE_ANDROID = 67,
diff --git a/components/metrics/clean_exit_beacon.cc b/components/metrics/clean_exit_beacon.cc index 3ab8aec..49cf4e0 100644 --- a/components/metrics/clean_exit_beacon.cc +++ b/components/metrics/clean_exit_beacon.cc
@@ -272,10 +272,13 @@ DidPreviousSessionExitCleanly(beacon_file_contents.get()); #if BUILDFLAG(IS_ANDROID) - // TODO(crbug/1248239): Use the beacon file, if any, to determine the crash - // crash once the Extended Variations Safe Mode experiment is fully enabled - // on Android Chrome. - beacon_file_contents.reset(); + // TODO(crbug/1248239): Use the beacon file, if any, to maybe increment the + // crash streak when the Extended Variations Safe Mode experiment is fully + // enabled on Android Chrome dev, beta, and stable. + if (channel_ != version_info::Channel::UNKNOWN && + channel_ != version_info::Channel::CANARY) { + beacon_file_contents.reset(); + } #endif // BUILDFLAG(IS_ANDROID) MaybeIncrementCrashStreak(did_previous_session_exit_cleanly_, @@ -314,9 +317,12 @@ #if BUILDFLAG(IS_ANDROID) // TODO(crbug/1248239): Fully enable the Extended Variations Safe Mode // experiment on Android Chrome by using the beacon file's beacon value for - // clients in the SignalAndWriteViaFileUtil group. - return local_state_beacon_value.value_or(true); -#else + // clients in the SignalAndWriteViaFileUtil group on dev, beta, and stable. + if (channel_ != version_info::Channel::UNKNOWN && + channel_ != version_info::Channel::CANARY) { + return local_state_beacon_value.value_or(true); + } +#endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_IOS) // For the time being, this is a no-op to avoid interference with the Extended // Variations Safe Mode experiment; i.e., ShouldUseUserDefaultsBeacon() always @@ -327,7 +333,6 @@ return use_beacon_file ? beacon_file_beacon_value.value_or(true) : local_state_beacon_value.value_or(true); -#endif // BUILDFLAG(IS_ANDROID) } void CleanExitBeacon::WriteBeaconValue(bool exited_cleanly,
diff --git a/components/metrics/clean_exit_beacon_unittest.cc b/components/metrics/clean_exit_beacon_unittest.cc index 006567ae..8bdb056 100644 --- a/components/metrics/clean_exit_beacon_unittest.cc +++ b/components/metrics/clean_exit_beacon_unittest.cc
@@ -56,11 +56,12 @@ public: explicit TestCleanExitBeacon( PrefService* local_state, - const base::FilePath& user_data_dir = base::FilePath()) + const base::FilePath& user_data_dir = base::FilePath(), + version_info::Channel channel = version_info::Channel::UNKNOWN) : CleanExitBeacon(kDummyWindowsRegistryKey, user_data_dir, local_state, - version_info::Channel::UNKNOWN) { + channel) { Initialize(); } @@ -83,9 +84,6 @@ base::test::TaskEnvironment task_environment_; }; -class BeaconFileTest : public testing::WithParamInterface<std::string>, - public CleanExitBeaconTest {}; - struct BadBeaconTestParams { const std::string test_name; bool beacon_file_exists; @@ -98,6 +96,12 @@ : public testing::WithParamInterface<BadBeaconTestParams>, public CleanExitBeaconTest {}; +#if BUILDFLAG(IS_ANDROID) +class IgnoredBeaconFileTest + : public testing::WithParamInterface<version_info::Channel>, + public CleanExitBeaconTest {}; +#endif // BUILDFLAG(IS_ANDROID) + struct BeaconConsistencyTestParams { // Inputs: const std::string test_name; @@ -281,9 +285,6 @@ params.beacon_file_state, 1); } -// TODO(crbug/1248239): Enable these tests on Android when the Extended -// Variations Safe Mode experiment is fully enabled on Android Chrome. -#if !BUILDFLAG(IS_ANDROID) // Verify that successfully reading the beacon file's contents results in // correctly (a) setting the |did_previous_session_exit_cleanly_| field and (b) // recording metrics when the last session exited cleanly. @@ -332,7 +333,6 @@ histogram_tester_.ExpectUniqueSample("Variations.SafeMode.Streak.Crashes", updated_num_crashes, 1); } -#endif // !BUILDFLAG(IS_ANDROID) // The below CleanExitBeaconTest.BeaconState*ExtendedSafeMode tests verify that // the logic for recording UMA.CleanExitBeacon.BeaconFileConsistency is correct @@ -419,10 +419,18 @@ #if BUILDFLAG(IS_ANDROID) // TODO(crbug/1248239): Remove this test once the Extended Variations Safe Mode -// experiment is fully enabled on Android Chrome. +// experiment is fully enabled on Android Chrome. Until then, update the +// channels as necessary. +INSTANTIATE_TEST_SUITE_P(All, + IgnoredBeaconFileTest, + ::testing::Values(version_info::Channel::DEV, + version_info::Channel::BETA, + version_info::Channel::STABLE)); // Verify that the beacon file, if any, is ignored on Android. -TEST_F(CleanExitBeaconTest, BeaconFileIgnoredOnAndroid) { +TEST_P(IgnoredBeaconFileTest, FileIgnoredOnAndroid) { + SetUpExtendedSafeModeExperiment(variations::kSignalAndWriteViaFileUtilGroup); + // Set up the beacon file such that the previous session did not exit cleanly // and the running crash streak is 2. The file (and thus these values) are // expected to be ignored. @@ -439,12 +447,14 @@ // Set up the PrefService such that the previous session exited cleanly and // the running crash streak is 0. The PrefService (and thus these values) are // expected to be used. - CleanExitBeacon::SetStabilityExitedCleanlyForTesting(&prefs_, true); + CleanExitBeacon::SetStabilityExitedCleanlyForTesting(&prefs_, + /*exited_cleanly=*/true); const int expected_num_crashes = 0; prefs_.SetInteger(variations::prefs::kVariationsCrashStreak, expected_num_crashes); - TestCleanExitBeacon clean_exit_beacon(&prefs_, user_data_dir_path); + TestCleanExitBeacon clean_exit_beacon(&prefs_, user_data_dir_path, + GetParam()); // Verify that the Local State beacon was used (not the beacon file beacon). EXPECT_TRUE(clean_exit_beacon.exited_cleanly());
diff --git a/components/no_state_prefetch/common/BUILD.gn b/components/no_state_prefetch/common/BUILD.gn index fa2f8360..dc029a83 100644 --- a/components/no_state_prefetch/common/BUILD.gn +++ b/components/no_state_prefetch/common/BUILD.gn
@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//extensions/buildflags/buildflags.gni") import("//mojo/public/tools/bindings/mojom.gni") static_library("common") { @@ -18,7 +19,7 @@ deps = [ ":mojo_bindings", "//content/public/common:common", - "//extensions/common:common_constants", + "//extensions/buildflags", "//ipc", "//ipc:message_support", "//ipc:param_traits", @@ -26,6 +27,10 @@ "//ui/gfx", "//url", ] + + if (enable_extensions) { + deps += [ "//extensions/common:common_constants" ] + } } mojom("mojo_bindings") {
diff --git a/components/no_state_prefetch/common/DEPS b/components/no_state_prefetch/common/DEPS index 2cfa362..88db2d00 100644 --- a/components/no_state_prefetch/common/DEPS +++ b/components/no_state_prefetch/common/DEPS
@@ -1,5 +1,6 @@ include_rules = [ "+content/public/common", + "+extensions/buildflags/buildflags.h", "+extensions/common", "+ipc", "+mojo/public/cpp/bindings",
diff --git a/components/no_state_prefetch/common/no_state_prefetch_utils.cc b/components/no_state_prefetch/common/no_state_prefetch_utils.cc index ccf5e5b..8c5f3560 100644 --- a/components/no_state_prefetch/common/no_state_prefetch_utils.cc +++ b/components/no_state_prefetch/common/no_state_prefetch_utils.cc
@@ -9,10 +9,15 @@ #include "base/metrics/histogram_macros.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "extensions/common/constants.h" +#include "extensions/buildflags/buildflags.h" #include "url/gurl.h" #include "url/url_constants.h" +#if BUILDFLAG(ENABLE_EXTENSIONS) +// GN doesn't understand conditional includes, so we need nogncheck here. +#include "extensions/common/constants.h" // nogncheck +#endif + namespace prerender { namespace { @@ -45,7 +50,9 @@ bool DoesURLHaveValidScheme(const GURL& url) { return (url.SchemeIsHTTPOrHTTPS() || +#if BUILDFLAG(ENABLE_EXTENSIONS) url.SchemeIs(extensions::kExtensionScheme) || +#endif url.SchemeIs(url::kDataScheme)); }
diff --git a/components/ntp_tiles/BUILD.gn b/components/ntp_tiles/BUILD.gn index ed264fa8..08325701 100644 --- a/components/ntp_tiles/BUILD.gn +++ b/components/ntp_tiles/BUILD.gn
@@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//extensions/buildflags/buildflags.gni") + if (is_android) { import("//build/config/android/rules.gni") } @@ -66,7 +68,7 @@ "//components/variations", "//components/variations/service", "//components/webapps/common:common", - "//extensions/common:common_constants", + "//extensions/buildflags", "//services/data_decoder/public/cpp", "//services/network/public/cpp", "//ui/base", @@ -78,6 +80,10 @@ "country_code_ios.mm", ] } + + if (enable_extensions) { + deps += [ "//extensions/common:common_constants" ] + } } source_set("unit_tests") { @@ -105,6 +111,7 @@ "//components/prefs:prefs", "//components/sync_preferences:test_support", "//components/webapps/common:common", + "//extensions/buildflags", "//net:test_support", "//services/data_decoder/public/cpp:test_support", "//services/network:test_support",
diff --git a/components/ntp_tiles/DEPS b/components/ntp_tiles/DEPS index 1740de3d..bc2bbf3 100644 --- a/components/ntp_tiles/DEPS +++ b/components/ntp_tiles/DEPS
@@ -15,6 +15,7 @@ "+components/url_formatter", "+components/variations", "+components/webapps", + "+extensions/buildflags/buildflags.h", "+extensions/common/constants.h", "+jni", "+net",
diff --git a/components/ntp_tiles/custom_links_manager_impl_unittest.cc b/components/ntp_tiles/custom_links_manager_impl_unittest.cc index 4f3bd5cd..51c9af9 100644 --- a/components/ntp_tiles/custom_links_manager_impl_unittest.cc +++ b/components/ntp_tiles/custom_links_manager_impl_unittest.cc
@@ -15,6 +15,7 @@ #include "components/history/core/test/history_service_test_util.h" #include "components/ntp_tiles/pref_names.h" #include "components/sync_preferences/testing_pref_service_syncable.h" +#include "extensions/buildflags/buildflags.h" #include "testing/gtest/include/gtest/gtest.h" using Link = ntp_tiles::CustomLinksManager::Link; @@ -51,9 +52,11 @@ const char16_t kTestTitle16[] = u"Test"; const char kTestUrl[] = "http://test.com/"; +#if BUILDFLAG(ENABLE_EXTENSIONS) const char16_t kTestGmail16[] = u"Gmail"; const char kTestGmailURL[] = "chrome-extension://pjkljhegncpnkpknbcohdijeoejaedia/index.html"; +#endif base::Value::ListStorage FillTestListStorage(const char* url, const char* title, @@ -321,6 +324,9 @@ EXPECT_TRUE(custom_links_->GetLinks().empty()); } +// The following tests include a default chrome app; these tests are only +// relevant if extensions and apps are enabled. +#if BUILDFLAG(ENABLE_EXTENSIONS) TEST_F(CustomLinksManagerImplTest, MigratedDefaultAppDeletedSingle) { NTPTilesVector initial_tiles; AddTile(&initial_tiles, kTestGmailURL, kTestGmail16); @@ -348,6 +354,7 @@ Link{GURL(kTestCase2[1].url), kTestCase2[1].title, true}}), custom_links_test_->GetLinks()); } +#endif // BUILDFLAG(ENABLE_EXTENSIONS) TEST_F(CustomLinksManagerImplTest, DeleteLinkWhenUrlDoesNotExist) { // Initialize.
diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc index 29f2f780..e60c671 100644 --- a/components/ntp_tiles/most_visited_sites.cc +++ b/components/ntp_tiles/most_visited_sites.cc
@@ -31,7 +31,12 @@ #include "components/prefs/pref_service.h" #include "components/search/ntp_features.h" #include "components/webapps/common/constants.h" -#include "extensions/common/constants.h" +#include "extensions/buildflags/buildflags.h" + +#if BUILDFLAG(ENABLE_EXTENSIONS) +// GN doesn't understand conditional includes, so we need nogncheck here. +#include "extensions/common/constants.h" // nogncheck +#endif using history::TopSites; @@ -749,8 +754,12 @@ // static bool MostVisitedSites::IsNtpTileFromPreinstalledApp(GURL url) { +#if BUILDFLAG(ENABLE_EXTENSIONS) return url.is_valid() && url.SchemeIs(extensions::kExtensionScheme) && extension_misc::IsPreinstalledAppId(url.host()); +#else + return false; +#endif } // static
diff --git a/components/ntp_tiles/most_visited_sites_unittest.cc b/components/ntp_tiles/most_visited_sites_unittest.cc index c80722e8..918195d 100644 --- a/components/ntp_tiles/most_visited_sites_unittest.cc +++ b/components/ntp_tiles/most_visited_sites_unittest.cc
@@ -38,6 +38,7 @@ #include "components/ntp_tiles/switches.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "components/webapps/common/constants.h" +#include "extensions/buildflags/buildflags.h" #include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" @@ -658,6 +659,9 @@ EXPECT_THAT(tiles[0], MatchesTile(u"", kHomepageUrl, TileSource::HOMEPAGE)); } +// The following test exercises behavior with a preinstalled chrome app; this +// is only relevant if extensions and apps are enabled. +#if BUILDFLAG(ENABLE_EXTENSIONS) TEST_P(MostVisitedSitesTest, ShouldNotContainDefaultPreinstalledApp) { const char kTestUrl[] = "http://site1/"; const char16_t kTestTitle[] = u"Site 1"; @@ -684,6 +688,7 @@ Contains(MatchesTile(kTestTitle, kTestUrl, TileSource::TOP_SITES)))); } +#endif // BUILDFLAG(ENABLE_EXTENSIONS) TEST_P(MostVisitedSitesTest, ShouldHaveHomepageFirstInListWhenNotFull) { FakeHomepageClient* homepage_client = RegisterNewHomepageClient();
diff --git a/components/optimization_guide/content/browser/BUILD.gn b/components/optimization_guide/content/browser/BUILD.gn index 0d26cc4..09a22e1 100644 --- a/components/optimization_guide/content/browser/BUILD.gn +++ b/components/optimization_guide/content/browser/BUILD.gn
@@ -54,10 +54,6 @@ "//third_party/tflite_support", "//third_party/tflite_support:tflite_support_proto", ] - - if (build_with_internal_optimization_guide) { - deps = [ "//components/optimization_guide/internal" ] - } } } @@ -83,7 +79,9 @@ "page_text_dump_result_unittest.cc", "page_text_observer_unittest.cc", ] - if (build_with_tflite_lib) { + + # crbug.com/1279884 Flaky on CrOS + if (!is_chromeos && build_with_tflite_lib) { sources += [ "page_content_annotations_model_manager_unittest.cc" ] } deps = [
diff --git a/components/optimization_guide/content/browser/page_content_annotations_model_manager.cc b/components/optimization_guide/content/browser/page_content_annotations_model_manager.cc index a126d4e..8e54371c 100644 --- a/components/optimization_guide/content/browser/page_content_annotations_model_manager.cc +++ b/components/optimization_guide/content/browser/page_content_annotations_model_manager.cc
@@ -17,7 +17,7 @@ #include "content/public/browser/browser_thread.h" #if BUILDFLAG(BUILD_WITH_INTERNAL_OPTIMIZATION_GUIDE) -#include "components/optimization_guide/internal/page_entities_model_executor_impl.h" +#include "components/optimization_guide/core/page_entities_model_executor_impl.h" #endif namespace optimization_guide {
diff --git a/components/optimization_guide/core/BUILD.gn b/components/optimization_guide/core/BUILD.gn index e2ac18d..0426edd4 100644 --- a/components/optimization_guide/core/BUILD.gn +++ b/components/optimization_guide/core/BUILD.gn
@@ -173,6 +173,14 @@ "page_visibility_model_executor.cc", "page_visibility_model_executor.h", ] + if (build_with_internal_optimization_guide) { + sources += [ + "entity_annotator_native_library.cc", + "entity_annotator_native_library.h", + "page_entities_model_executor_impl.cc", + "page_entities_model_executor_impl.h", + ] + } } public_deps = [ @@ -209,6 +217,11 @@ "//ui/base:base", "//url:url", ] + if (build_with_tflite_lib && build_with_internal_optimization_guide) { + data_deps = [ + "//components/optimization_guide/internal:optimization_guide_internal", + ] + } } static_library("test_support") { @@ -313,6 +326,12 @@ "page_visibility_model_executor_unittest.cc", "tflite_model_executor_unittest.cc", ] + if (build_with_internal_optimization_guide) { + sources += [ + "entity_annotator_native_library_unittest.cc", + "page_entities_model_executor_impl_unittest.cc", + ] + } } deps = [ @@ -353,3 +372,17 @@ visibility = [ "//chrome/browser/optimization_guide/android:*" ] } } + +if (is_mac && build_with_internal_optimization_guide) { + # We need to copy the optimization guide shared library so that the + # bundle_data dependencies have a "copy" target type. Otherwise for + # "shared_library" target types it will try to link things into + # Chromium Framework when we want to keep it separate instead. + copy("optimization_guide_internal_library_copy") { + sources = [ "$root_out_dir/liboptimization_guide_internal.dylib" ] + outputs = [ "$root_out_dir/og_intermediates/{{source_file_part}}" ] + deps = [ + "//components/optimization_guide/internal:optimization_guide_internal", + ] + } +}
diff --git a/components/optimization_guide/core/entity_annotator_native_library.cc b/components/optimization_guide/core/entity_annotator_native_library.cc new file mode 100644 index 0000000..0c35d269 --- /dev/null +++ b/components/optimization_guide/core/entity_annotator_native_library.cc
@@ -0,0 +1,413 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/optimization_guide/core/entity_annotator_native_library.h" + +#include "base/base_paths.h" +#include "base/logging.h" +#include "base/memory/ptr_util.h" +#include "base/path_service.h" +#include "build/build_config.h" +#include "components/optimization_guide/core/optimization_guide_util.h" +#include "components/optimization_guide/proto/page_entities_model_metadata.pb.h" + +#if BUILDFLAG(IS_MAC) +#include "base/mac/bundle_locations.h" +#include "base/mac/foundation_util.h" +#endif + +namespace optimization_guide { + +namespace { + +const char kModelMetadataBaseName[] = "model_metadata.pb"; +const char kWordEmbeddingsBaseName[] = "word_embeddings"; +const char kNameTableBaseName[] = "entities_names"; +const char kMetadataTableBaseName[] = "entities_metadata"; +const char kNameFilterBaseName[] = "entities_names_filter"; +const char kPrefixFilterBaseName[] = "entities_prefixes_filter"; + +// Sets |field_to_set| with the full file path of |base_name|'s entry in +// |base_to_full_file_path|. Returns whether |base_name| is in +// |base_to_full_file_path|. +absl::optional<std::string> GetFilePathFromMap( + const std::string& base_name, + const base::flat_map<std::string, base::FilePath>& base_to_full_file_path) { + auto it = base_to_full_file_path.find(base_name); + return it == base_to_full_file_path.end() + ? absl::nullopt + : absl::make_optional(FilePathToString(it->second)); +} + +// Returns the expected base name for |slice|. Will be of the form +// |slice|-|base_name|. +std::string GetSliceBaseName(const std::string& slice, + const std::string& base_name) { + return slice + "-" + base_name; +} + +} // namespace + +EntityAnnotatorNativeLibrary::EntityAnnotatorNativeLibrary( + base::NativeLibrary native_library) + : native_library_(std::move(native_library)) { + DCHECK(native_library_.is_valid()); + + LoadFunctions(); +} +EntityAnnotatorNativeLibrary::~EntityAnnotatorNativeLibrary() = default; + +// static +std::unique_ptr<EntityAnnotatorNativeLibrary> +EntityAnnotatorNativeLibrary::Create() { + base::FilePath base_dir; +#if BUILDFLAG(IS_MAC) + if (base::mac::AmIBundled()) { + base_dir = base::mac::FrameworkBundlePath().Append("Libraries"); + } else { +#endif + if (!base::PathService::Get(base::DIR_EXE, &base_dir)) { + LOG(ERROR) << "Error getting app exe dir"; + return nullptr; + } +#if BUILDFLAG(IS_MAC) + } +#endif + + base::NativeLibraryLoadError error; + base::NativeLibrary native_library = base::LoadNativeLibrary( + base_dir.AppendASCII( + base::GetNativeLibraryName("optimization_guide_internal")), + &error); + if (!native_library) { + LOG(ERROR) << "Failed to initialize optimization guide internal: " + << error.ToString(); + return nullptr; + } + + std::unique_ptr<EntityAnnotatorNativeLibrary> + entity_annotator_native_library = + base::WrapUnique<EntityAnnotatorNativeLibrary>( + new EntityAnnotatorNativeLibrary(std::move(native_library))); + if (entity_annotator_native_library->IsValid()) { + return entity_annotator_native_library; + } + LOG(ERROR) << "Could not find all required functions for optimization guide " + "internal library"; + return nullptr; +} + +void EntityAnnotatorNativeLibrary::LoadFunctions() { + get_max_supported_feature_flag_func_ = + reinterpret_cast<GetMaxSupportedFeatureFlagFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorGetMaxSupportedFeatureFlag")); + + create_from_options_func_ = reinterpret_cast<CreateFromOptionsFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorCreateFromOptions")); + get_creation_error_func_ = + reinterpret_cast<GetCreationErrorFunc>(native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorGetCreationError")); + delete_func_ = + reinterpret_cast<DeleteFunc>(native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorDelete")); + + annotate_job_create_func_ = reinterpret_cast<AnnotateJobCreateFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorAnnotateJobCreate")); + annotate_job_delete_func_ = reinterpret_cast<AnnotateJobDeleteFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorAnnotateJobDelete")); + run_annotate_job_func_ = + reinterpret_cast<RunAnnotateJobFunc>(native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorRunAnnotateJob")); + annotate_get_output_metadata_at_index_func_ = reinterpret_cast< + AnnotateGetOutputMetadataAtIndexFunc>(native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorAnnotateGetOutputMetadataAtIndex")); + annotate_get_output_metadata_score_at_index_func_ = + reinterpret_cast<AnnotateGetOutputMetadataScoreAtIndexFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorAnnotateGetOutputMetadataScoreAt" + "Index")); + + entity_metadata_job_create_func_ = + reinterpret_cast<EntityMetadataJobCreateFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorEntityMetadataJobCreate")); + entity_metadata_job_delete_func_ = + reinterpret_cast<EntityMetadataJobDeleteFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorEntityMetadataJobDelete")); + run_entity_metadata_job_func_ = reinterpret_cast<RunEntityMetadataJobFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorRunEntityMetadataJob")); + + options_create_func_ = + reinterpret_cast<OptionsCreateFunc>(native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorOptionsCreate")); + options_set_model_file_path_func_ = + reinterpret_cast<OptionsSetModelFilePathFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorOptionsSetModelFilePath")); + options_set_model_metadata_file_path_func_ = reinterpret_cast< + OptionsSetModelMetadataFilePathFunc>(native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorOptionsSetModelMetadataFilePath")); + options_set_word_embeddings_file_path_func_ = reinterpret_cast< + OptionsSetWordEmbeddingsFilePathFunc>(native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorOptionsSetWordEmbeddingsFilePath")); + options_add_model_slice_func_ = reinterpret_cast<OptionsAddModelSliceFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorOptionsAddModelSlice")); + options_delete_func_ = + reinterpret_cast<OptionsDeleteFunc>(native_library_.GetFunctionPointer( + "OptimizationGuideEntityAnnotatorOptionsDelete")); + + entity_metadata_get_entity_id_func_ = + reinterpret_cast<EntityMetadataGetEntityIdFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityMetadataGetEntityID")); + entity_metadata_get_human_readable_name_func_ = + reinterpret_cast<EntityMetadataGetHumanReadableNameFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityMetadataGetHumanReadableName")); + entity_metadata_get_human_readable_categories_count_func_ = reinterpret_cast< + EntityMetadataGetHumanReadableCategoriesCountFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityMetadataGetHumanReadableCategoriesCount")); + entity_metadata_get_human_readable_category_name_at_index_func_ = + reinterpret_cast<EntityMetadataGetHumanReadableCategoryNameAtIndexFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityMetadataGetHumanReadableCategoryNameAtInd" + "ex")); + entity_metadata_get_human_readable_category_score_at_index_func_ = + reinterpret_cast<EntityMetadataGetHumanReadableCategoryScoreAtIndexFunc>( + native_library_.GetFunctionPointer( + "OptimizationGuideEntityMetadataGetHumanReadableCategoryScoreAtIn" + "dex")); +} + +bool EntityAnnotatorNativeLibrary::IsValid() const { + return get_max_supported_feature_flag_func_ && create_from_options_func_ && + get_creation_error_func_ && delete_func_ && + annotate_job_create_func_ && annotate_job_delete_func_ && + run_annotate_job_func_ && + annotate_get_output_metadata_at_index_func_ && + annotate_get_output_metadata_score_at_index_func_ && + entity_metadata_job_create_func_ && entity_metadata_job_delete_func_ && + run_entity_metadata_job_func_ && options_create_func_ && + options_set_model_file_path_func_ && + options_set_model_metadata_file_path_func_ && + options_set_word_embeddings_file_path_func_ && + options_add_model_slice_func_ && options_delete_func_ && + entity_metadata_get_entity_id_func_ && + entity_metadata_get_human_readable_name_func_ && + entity_metadata_get_human_readable_categories_count_func_ && + entity_metadata_get_human_readable_category_name_at_index_func_ && + entity_metadata_get_human_readable_category_score_at_index_func_; +} + +int32_t EntityAnnotatorNativeLibrary::GetMaxSupportedFeatureFlag() { + DCHECK(IsValid()); + if (!IsValid()) { + return -1; + } + + return get_max_supported_feature_flag_func_(); +} + +void* EntityAnnotatorNativeLibrary::CreateEntityAnnotator( + const ModelInfo& model_info) { + DCHECK(IsValid()); + if (!IsValid()) { + return nullptr; + } + + void* options = options_create_func_(); + if (!PopulateEntityAnnotatorOptionsFromModelInfo(options, model_info)) { + options_delete_func_(options); + return nullptr; + } + + void* entity_annotator = create_from_options_func_(options); + const char* creation_error = get_creation_error_func_(entity_annotator); + if (creation_error) { + LOG(ERROR) << "Failed to create entity annotator: " << creation_error; + DeleteEntityAnnotator(entity_annotator); + entity_annotator = nullptr; + } + options_delete_func_(options); + return entity_annotator; +} + +bool EntityAnnotatorNativeLibrary::PopulateEntityAnnotatorOptionsFromModelInfo( + void* options, + const ModelInfo& model_info) { + // We don't know which files are intended for use if we don't have model + // metadata, so return early. + if (!model_info.GetModelMetadata()) { + return false; + } + + // // Validate the model metadata. + absl::optional<proto::PageEntitiesModelMetadata> entities_model_metadata = + ParsedAnyMetadata<proto::PageEntitiesModelMetadata>( + model_info.GetModelMetadata().value()); + if (!entities_model_metadata) { + return false; + } + if (entities_model_metadata->slice_size() == 0) { + return false; + } + + // Build the entity annotator options. + options_set_model_file_path_func_( + options, FilePathToString(model_info.GetModelFilePath()).c_str()); + + // Attach the additional files required by the model. + base::flat_map<std::string, base::FilePath> base_to_full_file_path; + for (const auto& model_file : model_info.GetAdditionalFiles()) { + base_to_full_file_path.insert( + {FilePathToString(model_file.BaseName()), model_file}); + } + absl::optional<std::string> model_metadata_file_path = + GetFilePathFromMap(kModelMetadataBaseName, base_to_full_file_path); + if (!model_metadata_file_path) { + return false; + } + options_set_model_metadata_file_path_func_(options, + model_metadata_file_path->c_str()); + absl::optional<std::string> word_embeddings_file_path = + GetFilePathFromMap(kWordEmbeddingsBaseName, base_to_full_file_path); + if (!word_embeddings_file_path) { + return false; + } + options_set_word_embeddings_file_path_func_( + options, word_embeddings_file_path->c_str()); + + base::flat_set<std::string> slices(entities_model_metadata->slice().begin(), + entities_model_metadata->slice().end()); + for (const auto& slice_id : slices) { + absl::optional<std::string> name_filter_path = + GetFilePathFromMap(GetSliceBaseName(slice_id, kNameFilterBaseName), + base_to_full_file_path); + if (!name_filter_path) { + return false; + } + absl::optional<std::string> name_table_path = GetFilePathFromMap( + GetSliceBaseName(slice_id, kNameTableBaseName), base_to_full_file_path); + if (!name_table_path) { + return false; + } + absl::optional<std::string> prefix_filter_path = + GetFilePathFromMap(GetSliceBaseName(slice_id, kPrefixFilterBaseName), + base_to_full_file_path); + if (!prefix_filter_path) { + return false; + } + absl::optional<std::string> metadata_table_path = + GetFilePathFromMap(GetSliceBaseName(slice_id, kMetadataTableBaseName), + base_to_full_file_path); + if (!metadata_table_path) { + return false; + } + options_add_model_slice_func_( + options, slice_id.c_str(), name_filter_path->c_str(), + name_table_path->c_str(), prefix_filter_path->c_str(), + metadata_table_path->c_str()); + } + + return true; +} + +void EntityAnnotatorNativeLibrary::DeleteEntityAnnotator( + void* entity_annotator) { + DCHECK(IsValid()); + if (!IsValid()) { + return; + } + + delete_func_(reinterpret_cast<void*>(entity_annotator)); +} + +absl::optional<std::vector<ScoredEntityMetadata>> +EntityAnnotatorNativeLibrary::AnnotateText(void* annotator, + const std::string& text) { + DCHECK(IsValid()); + if (!IsValid()) { + return absl::nullopt; + } + + if (!annotator) { + return absl::nullopt; + } + + void* job = annotate_job_create_func_(reinterpret_cast<void*>(annotator)); + int32_t output_metadata_count = run_annotate_job_func_(job, text.c_str()); + if (output_metadata_count <= 0) { + return absl::nullopt; + } + std::vector<ScoredEntityMetadata> scored_md; + scored_md.reserve(output_metadata_count); + for (int32_t i = 0; i < output_metadata_count; i++) { + ScoredEntityMetadata md; + md.score = annotate_get_output_metadata_score_at_index_func_(job, i); + md.metadata = GetEntityMetadataFromOptimizationGuideEntityMetadata( + annotate_get_output_metadata_at_index_func_(job, i)); + scored_md.emplace_back(md); + } + annotate_job_delete_func_(job); + return scored_md; +} + +absl::optional<EntityMetadata> +EntityAnnotatorNativeLibrary::GetEntityMetadataForEntityId( + void* annotator, + const std::string& entity_id) { + DCHECK(IsValid()); + if (!IsValid()) { + return absl::nullopt; + } + if (!annotator) { + return absl::nullopt; + } + + void* job = + entity_metadata_job_create_func_(reinterpret_cast<void*>(annotator)); + const void* entity_metadata = + run_entity_metadata_job_func_(job, entity_id.c_str()); + if (!entity_metadata) { + return absl::nullopt; + } + EntityMetadata md = + GetEntityMetadataFromOptimizationGuideEntityMetadata(entity_metadata); + entity_metadata_job_delete_func_(job); + return md; +} + +EntityMetadata EntityAnnotatorNativeLibrary:: + GetEntityMetadataFromOptimizationGuideEntityMetadata( + const void* og_entity_metadata) { + EntityMetadata entity_metadata; + entity_metadata.entity_id = + entity_metadata_get_entity_id_func_(og_entity_metadata); + entity_metadata.human_readable_name = + entity_metadata_get_human_readable_name_func_(og_entity_metadata); + + int32_t human_readable_categories_count = + entity_metadata_get_human_readable_categories_count_func_( + og_entity_metadata); + for (int32_t i = 0; i < human_readable_categories_count; i++) { + std::string category_name = + entity_metadata_get_human_readable_category_name_at_index_func_( + og_entity_metadata, i); + float category_score = + entity_metadata_get_human_readable_category_score_at_index_func_( + og_entity_metadata, i); + entity_metadata.human_readable_categories[category_name] = category_score; + } + return entity_metadata; +} + +} // namespace optimization_guide \ No newline at end of file
diff --git a/components/optimization_guide/core/entity_annotator_native_library.h b/components/optimization_guide/core/entity_annotator_native_library.h new file mode 100644 index 0000000..59ad83de --- /dev/null +++ b/components/optimization_guide/core/entity_annotator_native_library.h
@@ -0,0 +1,143 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_ENTITY_ANNOTATOR_NATIVE_LIBRARY_H_ +#define COMPONENTS_OPTIMIZATION_GUIDE_CORE_ENTITY_ANNOTATOR_NATIVE_LIBRARY_H_ + +#include <memory> +#include <vector> + +#include "base/scoped_native_library.h" +#include "components/optimization_guide/core/entity_metadata.h" +#include "components/optimization_guide/core/model_info.h" + +namespace optimization_guide { + +// Handles interactions with the native library that contains logic for the +// entity annotator. +class EntityAnnotatorNativeLibrary { + public: + // Creates an EntityAnnotatorNativeLibrary, which loads a native library and + // relevant functions required. Will return nullptr if fails. + static std::unique_ptr<EntityAnnotatorNativeLibrary> Create(); + + EntityAnnotatorNativeLibrary(const EntityAnnotatorNativeLibrary&) = delete; + EntityAnnotatorNativeLibrary& operator=(const EntityAnnotatorNativeLibrary&) = + delete; + ~EntityAnnotatorNativeLibrary(); + + // Returns whether this instance is valid (i.e. all necessary functions have + // been loaded.) + bool IsValid() const; + + // Gets the max supported feature from this native library. + int32_t GetMaxSupportedFeatureFlag(); + + // Creates an entity annotator from |model_info|. + void* CreateEntityAnnotator(const ModelInfo& model_info); + + // Deletes |entity_annotator|. + void DeleteEntityAnnotator(void* entity_annotator); + + // Uses |annotator| to annotate entities present in |text|. + absl::optional<std::vector<ScoredEntityMetadata>> AnnotateText( + void* annotator, + const std::string& text); + + // Returns entity metadata from |annotator| for |entity_id|. + absl::optional<EntityMetadata> GetEntityMetadataForEntityId( + void* annotator, + const std::string& entity_id); + + private: + EntityAnnotatorNativeLibrary(base::NativeLibrary native_library); + + // Loads the functions exposed by the native library. + void LoadFunctions(); + + // Populates |options| based on |model_info|. Returns false if |model_info| + // cannot construct a valid options object. + bool PopulateEntityAnnotatorOptionsFromModelInfo(void* options, + const ModelInfo& model_info); + + // Returns an entity metadata from the C-API representation. + EntityMetadata GetEntityMetadataFromOptimizationGuideEntityMetadata( + const void* og_entity_metadata); + + base::ScopedNativeLibrary native_library_; + + // Functions exposed by native library. + using GetMaxSupportedFeatureFlagFunc = int32_t (*)(); + GetMaxSupportedFeatureFlagFunc get_max_supported_feature_flag_func_ = nullptr; + + using CreateFromOptionsFunc = void* (*)(const void*); + CreateFromOptionsFunc create_from_options_func_ = nullptr; + using GetCreationErrorFunc = const char* (*)(const void*); + GetCreationErrorFunc get_creation_error_func_ = nullptr; + using DeleteFunc = void (*)(void*); + DeleteFunc delete_func_ = nullptr; + + using AnnotateJobCreateFunc = void* (*)(void*); + AnnotateJobCreateFunc annotate_job_create_func_ = nullptr; + using AnnotateJobDeleteFunc = void (*)(void*); + AnnotateJobDeleteFunc annotate_job_delete_func_ = nullptr; + using RunAnnotateJobFunc = int32_t (*)(void*, const char*); + RunAnnotateJobFunc run_annotate_job_func_ = nullptr; + using AnnotateGetOutputMetadataAtIndexFunc = const void* (*)(void*, int32_t); + AnnotateGetOutputMetadataAtIndexFunc + annotate_get_output_metadata_at_index_func_ = nullptr; + using AnnotateGetOutputMetadataScoreAtIndexFunc = float (*)(void*, int32_t); + AnnotateGetOutputMetadataScoreAtIndexFunc + annotate_get_output_metadata_score_at_index_func_ = nullptr; + + using EntityMetadataJobCreateFunc = void* (*)(void*); + EntityMetadataJobCreateFunc entity_metadata_job_create_func_ = nullptr; + using EntityMetadataJobDeleteFunc = void (*)(void*); + EntityMetadataJobDeleteFunc entity_metadata_job_delete_func_ = nullptr; + using RunEntityMetadataJobFunc = const void* (*)(void*, const char*); + RunEntityMetadataJobFunc run_entity_metadata_job_func_ = nullptr; + + using OptionsCreateFunc = void* (*)(); + OptionsCreateFunc options_create_func_ = nullptr; + using OptionsSetModelFilePathFunc = void (*)(void*, const char*); + OptionsSetModelFilePathFunc options_set_model_file_path_func_ = nullptr; + using OptionsSetModelMetadataFilePathFunc = void (*)(void*, const char*); + OptionsSetModelMetadataFilePathFunc + options_set_model_metadata_file_path_func_ = nullptr; + using OptionsSetWordEmbeddingsFilePathFunc = void (*)(void*, const char*); + OptionsSetWordEmbeddingsFilePathFunc + options_set_word_embeddings_file_path_func_ = nullptr; + using OptionsAddModelSliceFunc = void (*)(void*, + const char*, + const char*, + const char*, + const char*, + const char*); + OptionsAddModelSliceFunc options_add_model_slice_func_ = nullptr; + using OptionsDeleteFunc = void (*)(void*); + OptionsDeleteFunc options_delete_func_ = nullptr; + + using EntityMetadataGetEntityIdFunc = const char* (*)(const void*); + EntityMetadataGetEntityIdFunc entity_metadata_get_entity_id_func_ = nullptr; + using EntityMetadataGetHumanReadableNameFunc = const char* (*)(const void*); + EntityMetadataGetHumanReadableNameFunc + entity_metadata_get_human_readable_name_func_ = nullptr; + using EntityMetadataGetHumanReadableCategoriesCountFunc = + int32_t (*)(const void*); + EntityMetadataGetHumanReadableCategoriesCountFunc + entity_metadata_get_human_readable_categories_count_func_ = nullptr; + using EntityMetadataGetHumanReadableCategoryNameAtIndexFunc = + const char* (*)(const void*, int32_t); + EntityMetadataGetHumanReadableCategoryNameAtIndexFunc + entity_metadata_get_human_readable_category_name_at_index_func_ = nullptr; + using EntityMetadataGetHumanReadableCategoryScoreAtIndexFunc = + float (*)(const void*, int32_t); + EntityMetadataGetHumanReadableCategoryScoreAtIndexFunc + entity_metadata_get_human_readable_category_score_at_index_func_ = + nullptr; +}; + +} // namespace optimization_guide + +#endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_ENTITY_ANNOTATOR_NATIVE_LIBRARY_H_ \ No newline at end of file
diff --git a/components/optimization_guide/core/entity_annotator_native_library_unittest.cc b/components/optimization_guide/core/entity_annotator_native_library_unittest.cc new file mode 100644 index 0000000..3155e9b --- /dev/null +++ b/components/optimization_guide/core/entity_annotator_native_library_unittest.cc
@@ -0,0 +1,22 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/optimization_guide/core/entity_annotator_native_library.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace optimization_guide { +namespace { + +using EntityAnnotatorNativeLibraryTest = ::testing::Test; + +TEST_F(EntityAnnotatorNativeLibraryTest, CanCreateValidLibrary) { + std::unique_ptr<EntityAnnotatorNativeLibrary> lib = + EntityAnnotatorNativeLibrary::Create(); + ASSERT_TRUE(lib); + EXPECT_TRUE(lib->IsValid()); +} + +} // namespace +} // namespace optimization_guide
diff --git a/components/optimization_guide/core/page_entities_model_executor_impl.cc b/components/optimization_guide/core/page_entities_model_executor_impl.cc new file mode 100644 index 0000000..3d89bdc --- /dev/null +++ b/components/optimization_guide/core/page_entities_model_executor_impl.cc
@@ -0,0 +1,212 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/optimization_guide/core/page_entities_model_executor_impl.h" + +#include "base/threading/sequenced_task_runner_handle.h" +#include "components/optimization_guide/core/entity_annotator_native_library.h" +#include "components/optimization_guide/core/optimization_guide_model_provider.h" +#include "components/optimization_guide/proto/page_entities_model_metadata.pb.h" + +namespace optimization_guide { + +namespace { + +const char kPageEntitiesModelMetadataTypeUrl[] = + "type.googleapis.com/" + "google.internal.chrome.optimizationguide.v1.PageEntitiesModelMetadata"; + +} // namespace + +EntityAnnotatorHolder::EntityAnnotatorHolder( + scoped_refptr<base::SequencedTaskRunner> background_task_runner, + scoped_refptr<base::SequencedTaskRunner> reply_task_runner) + : background_task_runner_(background_task_runner), + reply_task_runner_(reply_task_runner) {} + +EntityAnnotatorHolder::~EntityAnnotatorHolder() { + DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); + + ResetEntityAnnotator(); +} + +void EntityAnnotatorHolder:: + InitializeEntityAnnotatorNativeLibraryOnBackgroundThread( + base::OnceCallback<void(int32_t)> init_callback) { + DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); + + DCHECK(!entity_annotator_native_library_); + if (entity_annotator_native_library_) { + // We should only be initialized once but in case someone does something + // wrong in a non-debug build, we invoke the callback anyway. + reply_task_runner_->PostTask( + FROM_HERE, + base::BindOnce( + std::move(init_callback), + entity_annotator_native_library_->GetMaxSupportedFeatureFlag())); + return; + } + + entity_annotator_native_library_ = EntityAnnotatorNativeLibrary::Create(); + if (!entity_annotator_native_library_) { + reply_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(init_callback), -1)); + return; + } + + int32_t max_supported_feature_flag = + entity_annotator_native_library_->GetMaxSupportedFeatureFlag(); + reply_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(std::move(init_callback), max_supported_feature_flag)); +} + +void EntityAnnotatorHolder::ResetEntityAnnotator() { + DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); + + if (entity_annotator_) { + DCHECK(entity_annotator_native_library_); + entity_annotator_native_library_->DeleteEntityAnnotator(entity_annotator_); + + entity_annotator_ = nullptr; + } +} + +void EntityAnnotatorHolder::CreateAndSetEntityAnnotatorOnBackgroundThread( + const ModelInfo& model_info) { + DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); + + if (!entity_annotator_native_library_) { + return; + } + + ResetEntityAnnotator(); + + entity_annotator_ = + entity_annotator_native_library_->CreateEntityAnnotator(model_info); +} + +void EntityAnnotatorHolder::AnnotateEntitiesMetadataModelOnBackgroundThread( + const std::string& text, + PageEntitiesMetadataModelExecutedCallback callback) { + DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); + + absl::optional<std::vector<ScoredEntityMetadata>> scored_md; + if (entity_annotator_) { + DCHECK(entity_annotator_native_library_); + scored_md = + entity_annotator_native_library_->AnnotateText(entity_annotator_, text); + } + reply_task_runner_->PostTask(FROM_HERE, + base::BindOnce(std::move(callback), scored_md)); +} + +void EntityAnnotatorHolder::GetMetadataForEntityIdOnBackgroundThread( + const std::string& entity_id, + PageEntitiesModelExecutor::PageEntitiesModelEntityMetadataRetrievedCallback + callback) { + DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); + + absl::optional<EntityMetadata> entity_metadata; + if (entity_annotator_) { + DCHECK(entity_annotator_native_library_); + entity_metadata = + entity_annotator_native_library_->GetEntityMetadataForEntityId( + entity_annotator_, entity_id); + } + reply_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), std::move(entity_metadata))); +} + +base::WeakPtr<EntityAnnotatorHolder> +EntityAnnotatorHolder::GetBackgroundWeakPtr() { + return background_weak_ptr_factory_.GetWeakPtr(); +} + +PageEntitiesModelExecutorImpl::PageEntitiesModelExecutorImpl( + OptimizationGuideModelProvider* optimization_guide_model_provider, + scoped_refptr<base::SequencedTaskRunner> background_task_runner) + : background_task_runner_(background_task_runner), + entity_annotator_holder_(std::make_unique<EntityAnnotatorHolder>( + background_task_runner_, + base::SequencedTaskRunnerHandle::Get())) { + background_task_runner_->PostTask( + FROM_HERE, + base::BindOnce( + &EntityAnnotatorHolder:: + InitializeEntityAnnotatorNativeLibraryOnBackgroundThread, + entity_annotator_holder_->GetBackgroundWeakPtr(), + base::BindOnce(&PageEntitiesModelExecutorImpl:: + OnEntityAnnotatorLibraryInitialized, + weak_ptr_factory_.GetWeakPtr(), + optimization_guide_model_provider))); +} + +void PageEntitiesModelExecutorImpl::OnEntityAnnotatorLibraryInitialized( + OptimizationGuideModelProvider* optimization_guide_model_provider, + int32_t max_model_format_feature_flag) { + if (max_model_format_feature_flag <= 0) { + return; + } + + proto::Any any_metadata; + any_metadata.set_type_url(kPageEntitiesModelMetadataTypeUrl); + proto::PageEntitiesModelMetadata model_metadata; + model_metadata.set_max_model_format_feature_flag( + max_model_format_feature_flag); + model_metadata.SerializeToString(any_metadata.mutable_value()); + optimization_guide_model_provider->AddObserverForOptimizationTargetModel( + proto::OptimizationTarget::OPTIMIZATION_TARGET_PAGE_ENTITIES, + any_metadata, this); +} + +PageEntitiesModelExecutorImpl::~PageEntitiesModelExecutorImpl() { + // |entity_annotator_holder_|'s WeakPtrs are used on the background thread, + // so that is also where the class must be destroyed. + background_task_runner_->DeleteSoon(FROM_HERE, + std::move(entity_annotator_holder_)); +} + +void PageEntitiesModelExecutorImpl::OnModelUpdated( + proto::OptimizationTarget optimization_target, + const ModelInfo& model_info) { + if (optimization_target != proto::OPTIMIZATION_TARGET_PAGE_ENTITIES) + return; + + background_task_runner_->PostTask( + FROM_HERE, + base::BindOnce( + &EntityAnnotatorHolder::CreateAndSetEntityAnnotatorOnBackgroundThread, + entity_annotator_holder_->GetBackgroundWeakPtr(), model_info)); +} + +void PageEntitiesModelExecutorImpl::HumanReadableExecuteModelWithInput( + const std::string& text, + PageEntitiesMetadataModelExecutedCallback callback) { + if (text.empty()) { + std::move(callback).Run(absl::nullopt); + return; + } + + background_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&EntityAnnotatorHolder:: + AnnotateEntitiesMetadataModelOnBackgroundThread, + entity_annotator_holder_->GetBackgroundWeakPtr(), text, + std::move(callback))); +} + +void PageEntitiesModelExecutorImpl::GetMetadataForEntityId( + const std::string& entity_id, + PageEntitiesModelEntityMetadataRetrievedCallback callback) { + background_task_runner_->PostTask( + FROM_HERE, + base::BindOnce( + &EntityAnnotatorHolder::GetMetadataForEntityIdOnBackgroundThread, + entity_annotator_holder_->GetBackgroundWeakPtr(), entity_id, + std::move(callback))); +} + +} // namespace optimization_guide
diff --git a/components/optimization_guide/core/page_entities_model_executor_impl.h b/components/optimization_guide/core/page_entities_model_executor_impl.h new file mode 100644 index 0000000..d39944fc2 --- /dev/null +++ b/components/optimization_guide/core/page_entities_model_executor_impl.h
@@ -0,0 +1,115 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_PAGE_ENTITIES_MODEL_EXECUTOR_IMPL_H_ +#define COMPONENTS_OPTIMIZATION_GUIDE_CORE_PAGE_ENTITIES_MODEL_EXECUTOR_IMPL_H_ + +#include "base/task/sequenced_task_runner.h" +#include "base/task/task_traits.h" +#include "base/task/thread_pool.h" +#include "components/optimization_guide/core/entity_metadata.h" +#include "components/optimization_guide/core/optimization_target_model_observer.h" +#include "components/optimization_guide/core/page_entities_model_executor.h" + +namespace optimization_guide { + +class EntityAnnotatorNativeLibrary; +class OptimizationGuideModelProvider; + +// An object used to hold an entity annotator on a background thread. +class EntityAnnotatorHolder { + public: + EntityAnnotatorHolder( + scoped_refptr<base::SequencedTaskRunner> background_task_runner, + scoped_refptr<base::SequencedTaskRunner> reply_task_runner); + ~EntityAnnotatorHolder(); + + // Initializes the native library on a background thread. Will invoke + // |init_callback| on |reply_task_runner_| with the max version supported for + // the entity annotator on success. Otherwise, -1. + void InitializeEntityAnnotatorNativeLibraryOnBackgroundThread( + base::OnceCallback<void(int32_t)> init_callback); + + // Creates an entity annotator on the background thread and sets it to + // |entity_annotator_|. Should be invoked on |background_task_runner_|. + void CreateAndSetEntityAnnotatorOnBackgroundThread( + const ModelInfo& model_info); + + // Requests for |entity_annotator_| to execute its model for |text| and map + // the entities back to their metadata. Should be invoked on + // |background_task_runner_|. + using PageEntitiesMetadataModelExecutedCallback = base::OnceCallback<void( + const absl::optional<std::vector<ScoredEntityMetadata>>&)>; + void AnnotateEntitiesMetadataModelOnBackgroundThread( + const std::string& text, + PageEntitiesMetadataModelExecutedCallback callback); + + // Returns entity metadata from |entity_annotator_| for |entity_id|. + // Should be invoked on |background_task_runner_|. + void GetMetadataForEntityIdOnBackgroundThread( + const std::string& entity_id, + PageEntitiesModelExecutor:: + PageEntitiesModelEntityMetadataRetrievedCallback callback); + + // Gets the weak ptr to |this| on the background thread. + base::WeakPtr<EntityAnnotatorHolder> GetBackgroundWeakPtr(); + + private: + void ResetEntityAnnotator(); + + scoped_refptr<base::SequencedTaskRunner> background_task_runner_; + scoped_refptr<base::SequencedTaskRunner> reply_task_runner_; + + std::unique_ptr<EntityAnnotatorNativeLibrary> + entity_annotator_native_library_; + void* entity_annotator_ = nullptr; + + base::WeakPtrFactory<EntityAnnotatorHolder> background_weak_ptr_factory_{ + this}; +}; + +// Manages the loading and execution of the page entities model. +class PageEntitiesModelExecutorImpl : public OptimizationTargetModelObserver, + public PageEntitiesModelExecutor { + public: + PageEntitiesModelExecutorImpl( + OptimizationGuideModelProvider* model_provider, + scoped_refptr<base::SequencedTaskRunner> background_task_runner = + base::ThreadPool::CreateSequencedTaskRunner( + {base::MayBlock(), base::TaskPriority::BEST_EFFORT})); + ~PageEntitiesModelExecutorImpl() override; + PageEntitiesModelExecutorImpl(const PageEntitiesModelExecutorImpl&) = delete; + PageEntitiesModelExecutorImpl& operator=( + const PageEntitiesModelExecutorImpl&) = delete; + + // PageEntitiesModelExecutor: + void GetMetadataForEntityId( + const std::string& entity_id, + PageEntitiesModelEntityMetadataRetrievedCallback callback) override; + void HumanReadableExecuteModelWithInput( + const std::string& text, + PageEntitiesMetadataModelExecutedCallback callback) override; + + // OptimizationTargetModelObserver: + void OnModelUpdated(proto::OptimizationTarget optimization_target, + const ModelInfo& model_info) override; + + private: + // Invoked on the UI thread when entity annotator library has been + // initialized. + void OnEntityAnnotatorLibraryInitialized( + OptimizationGuideModelProvider* model_provider, + int32_t max_model_format_feature_flag); + + scoped_refptr<base::SequencedTaskRunner> background_task_runner_; + + // The holder used to hold the annotator used to annotate entities. + std::unique_ptr<EntityAnnotatorHolder> entity_annotator_holder_; + + base::WeakPtrFactory<PageEntitiesModelExecutorImpl> weak_ptr_factory_{this}; +}; + +} // namespace optimization_guide + +#endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_PAGE_ENTITIES_MODEL_EXECUTOR_IMPL_H_
diff --git a/components/optimization_guide/core/page_entities_model_executor_impl_unittest.cc b/components/optimization_guide/core/page_entities_model_executor_impl_unittest.cc new file mode 100644 index 0000000..7b1de98c9 --- /dev/null +++ b/components/optimization_guide/core/page_entities_model_executor_impl_unittest.cc
@@ -0,0 +1,267 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/optimization_guide/core/page_entities_model_executor_impl.h" + +#include "base/observer_list.h" +#include "base/path_service.h" +#include "base/run_loop.h" +#include "base/test/task_environment.h" +#include "components/optimization_guide/core/optimization_guide_util.h" +#include "components/optimization_guide/core/test_model_info_builder.h" +#include "components/optimization_guide/core/test_optimization_guide_model_provider.h" +#include "components/optimization_guide/proto/page_entities_model_metadata.pb.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace optimization_guide { +namespace { + +using ::testing::ElementsAre; + +class ModelObserverTracker : public TestOptimizationGuideModelProvider { + public: + void AddObserverForOptimizationTargetModel( + proto::OptimizationTarget target, + const absl::optional<proto::Any>& model_metadata, + OptimizationTargetModelObserver* observer) override { + registered_model_metadata_.insert_or_assign(target, model_metadata); + registered_observers_.AddObserver(observer); + } + + void RemoveObserverForOptimizationTargetModel( + proto::OptimizationTarget target, + OptimizationTargetModelObserver* observer) override { + registered_observers_.RemoveObserver(observer); + } + + bool DidRegisterForTarget( + proto::OptimizationTarget target, + absl::optional<proto::Any>* out_model_metadata) const { + auto it = registered_model_metadata_.find(target); + if (it == registered_model_metadata_.end()) + return false; + *out_model_metadata = registered_model_metadata_.at(target); + return true; + } + + void PushModelInfoToObservers(const ModelInfo& model_info) { + for (auto& observer : registered_observers_) { + observer.OnModelUpdated(proto::OPTIMIZATION_TARGET_PAGE_ENTITIES, + model_info); + } + } + + private: + base::flat_map<proto::OptimizationTarget, absl::optional<proto::Any>> + registered_model_metadata_; + base::ObserverList<OptimizationTargetModelObserver> registered_observers_; +}; + +class PageEntitiesModelExecutorImplTest : public testing::Test { + public: + void SetUp() override { + model_observer_tracker_ = std::make_unique<ModelObserverTracker>(); + model_executor_ = std::make_unique<PageEntitiesModelExecutorImpl>( + model_observer_tracker_.get()); + + // Wait for PageEntitiesModelExecutor to set everything up. + task_environment_.RunUntilIdle(); + } + + void TearDown() override { + model_executor_.reset(); + model_observer_tracker_.reset(); + + // Wait for PageEntitiesModelExecutor to clean everything up. + task_environment_.RunUntilIdle(); + } + + absl::optional<std::vector<ScoredEntityMetadata>> ExecuteHumanReadableModel( + const std::string& text) { + absl::optional<std::vector<ScoredEntityMetadata>> entity_metadata; + + base::RunLoop run_loop; + model_executor_->HumanReadableExecuteModelWithInput( + text, base::BindOnce( + [](base::RunLoop* run_loop, + absl::optional<std::vector<ScoredEntityMetadata>>* + out_entity_metadata, + const absl::optional<std::vector<ScoredEntityMetadata>>& + entity_metadata) { + *out_entity_metadata = entity_metadata; + run_loop->Quit(); + }, + &run_loop, &entity_metadata)); + run_loop.Run(); + + // Sort the result by score to make validating the output easier. + if (entity_metadata) { + std::sort( + entity_metadata->begin(), entity_metadata->end(), + [](const ScoredEntityMetadata& a, const ScoredEntityMetadata& b) { + return a.score > b.score; + }); + } + return entity_metadata; + } + + absl::optional<EntityMetadata> GetMetadataForEntityId( + const std::string& entity_id) { + absl::optional<EntityMetadata> entity_metadata; + + base::RunLoop run_loop; + model_executor_->GetMetadataForEntityId( + entity_id, + base::BindOnce( + [](base::RunLoop* run_loop, + absl::optional<EntityMetadata>* out_entity_metadata, + const absl::optional<EntityMetadata>& entity_metadata) { + *out_entity_metadata = entity_metadata; + run_loop->Quit(); + }, + &run_loop, &entity_metadata)); + run_loop.Run(); + + return entity_metadata; + } + + ModelObserverTracker* model_observer_tracker() const { + return model_observer_tracker_.get(); + } + + base::FilePath GetModelTestDataDir() { + base::FilePath source_root_dir; + base::PathService::Get(base::DIR_SOURCE_ROOT, &source_root_dir); + return source_root_dir.AppendASCII("components") + .AppendASCII("optimization_guide") + .AppendASCII("internal") + .AppendASCII("testdata"); + } + + void PushModelInfoToObservers(const ModelInfo& model_info) { + model_observer_tracker_->PushModelInfoToObservers(model_info); + task_environment_.RunUntilIdle(); + } + + private: + base::test::TaskEnvironment task_environment_; + std::unique_ptr<ModelObserverTracker> model_observer_tracker_; + std::unique_ptr<PageEntitiesModelExecutorImpl> model_executor_; +}; + +TEST_F(PageEntitiesModelExecutorImplTest, CreateNoMetadata) { + std::unique_ptr<ModelInfo> model_info = TestModelInfoBuilder().Build(); + ASSERT_TRUE(model_info); + PushModelInfoToObservers(*model_info); + + // We expect that there will be no model to evaluate even for this input that + // has output in the test model. + EXPECT_EQ(ExecuteHumanReadableModel("Taylor Swift singer"), absl::nullopt); +} + +TEST_F(PageEntitiesModelExecutorImplTest, CreateMetadataWrongType) { + proto::Any any; + any.set_type_url(any.GetTypeName()); + proto::FieldTrial garbage; + garbage.SerializeToString(any.mutable_value()); + + proto::PredictionModel model; + model.mutable_model()->set_download_url( + FilePathToString(GetModelTestDataDir().AppendASCII("model.tflite"))); + model.mutable_model_info()->set_version(123); + *model.mutable_model_info()->mutable_model_metadata() = any; + std::unique_ptr<ModelInfo> model_info = ModelInfo::Create(model); + ASSERT_TRUE(model_info); + PushModelInfoToObservers(*model_info); + + // We expect that there will be no model to evaluate even for this input that + // has output in the test model. + EXPECT_EQ(ExecuteHumanReadableModel("Taylor Swift singer"), absl::nullopt); +} + +TEST_F(PageEntitiesModelExecutorImplTest, CreateNoSlices) { + proto::Any any; + proto::PageEntitiesModelMetadata metadata; + any.set_type_url(metadata.GetTypeName()); + metadata.SerializeToString(any.mutable_value()); + + proto::PredictionModel model; + model.mutable_model()->set_download_url( + FilePathToString(GetModelTestDataDir().AppendASCII("model.tflite"))); + model.mutable_model_info()->set_version(123); + *model.mutable_model_info()->mutable_model_metadata() = any; + std::unique_ptr<ModelInfo> model_info = ModelInfo::Create(model); + ASSERT_TRUE(model_info); + PushModelInfoToObservers(*model_info); + + // We expect that there will be no model to evaluate even for this input that + // has output in the test model. + EXPECT_EQ(ExecuteHumanReadableModel("Taylor Swift singer"), absl::nullopt); +} + +TEST_F(PageEntitiesModelExecutorImplTest, CreateMissingFiles) { + proto::Any any; + proto::PageEntitiesModelMetadata metadata; + metadata.add_slice("global"); + any.set_type_url(metadata.GetTypeName()); + metadata.SerializeToString(any.mutable_value()); + + base::FilePath dir_path = GetModelTestDataDir(); + base::flat_set<std::string> expected_additional_files = { + FilePathToString(dir_path.AppendASCII("model_metadata.pb")), + FilePathToString(dir_path.AppendASCII("word_embeddings")), + FilePathToString(dir_path.AppendASCII("global-entities_names")), + FilePathToString(dir_path.AppendASCII("global-entities_metadata")), + FilePathToString(dir_path.AppendASCII("global-entities_names_filter")), + FilePathToString(dir_path.AppendASCII("global-entities_prefixes_filter")), + }; + // Remove one file for each iteration and make sure it fails. + for (const auto& missing_file_name : expected_additional_files) { + // Make a copy of the expected files and remove the one file from the set. + base::flat_set<std::string> additional_files = expected_additional_files; + additional_files.erase(missing_file_name); + + proto::PredictionModel model; + model.mutable_model()->set_download_url( + FilePathToString(dir_path.AppendASCII("model.tflite"))); + model.mutable_model_info()->set_version(123); + *model.mutable_model_info()->mutable_model_metadata() = any; + for (const auto& additional_file : additional_files) { + model.mutable_model_info()->add_additional_files()->set_file_path( + additional_file); + } + std::unique_ptr<ModelInfo> model_info = ModelInfo::Create(model); + ASSERT_TRUE(model_info); + PushModelInfoToObservers(*model_info); + + // We expect that there will be no model to evaluate even for this input + // that has output in the test model. + EXPECT_EQ(ExecuteHumanReadableModel("Taylor Swift singer"), absl::nullopt); + } +} + +TEST_F(PageEntitiesModelExecutorImplTest, GetMetadataForEntityIdNoModel) { + EXPECT_EQ(GetMetadataForEntityId("/m/0dl567"), absl::nullopt); +} + +TEST_F(PageEntitiesModelExecutorImplTest, ExecuteHumanReadableModelNoModel) { + EXPECT_EQ(ExecuteHumanReadableModel("Taylor Swift singer"), absl::nullopt); +} + +TEST_F(PageEntitiesModelExecutorImplTest, + SetsUpModelCorrectlyBasedOnFeatureParams) { + absl::optional<proto::Any> registered_model_metadata; + EXPECT_TRUE(model_observer_tracker()->DidRegisterForTarget( + proto::OPTIMIZATION_TARGET_PAGE_ENTITIES, ®istered_model_metadata)); + EXPECT_TRUE(registered_model_metadata.has_value()); + absl::optional<proto::PageEntitiesModelMetadata> + page_entities_model_metadata = + ParsedAnyMetadata<proto::PageEntitiesModelMetadata>( + *registered_model_metadata); + EXPECT_TRUE(page_entities_model_metadata.has_value()); +} + +} // namespace +} // namespace optimization_guide
diff --git a/components/optimization_guide/features.gni b/components/optimization_guide/features.gni index 1695d00..26d60df 100644 --- a/components/optimization_guide/features.gni +++ b/components/optimization_guide/features.gni
@@ -13,8 +13,6 @@ # You can set the variable 'build_with_internal_optimization_guide' to true # even in a developer build in args.gn. Setting this variable explicitly to true will # cause your build to fail if the internal files are missing. - build_with_internal_optimization_guide = false - - # TODO(crbug/1266935): Add this back when the API boundary is sane again. - # is_chrome_branded && !is_android && !is_ios + build_with_internal_optimization_guide = + is_chrome_branded && !is_android && !is_ios }
diff --git a/components/optimization_guide/proto/BUILD.gn b/components/optimization_guide/proto/BUILD.gn index 288e9fd..2253201 100644 --- a/components/optimization_guide/proto/BUILD.gn +++ b/components/optimization_guide/proto/BUILD.gn
@@ -17,6 +17,7 @@ "loading_predictor_metadata.proto", "models.proto", "page_entities_metadata.proto", + "page_entities_model_metadata.proto", "page_topics_model_metadata.proto", "performance_hints_metadata.proto", "public_image_metadata.proto",
diff --git a/components/optimization_guide/proto/page_entities_model_metadata.proto b/components/optimization_guide/proto/page_entities_model_metadata.proto new file mode 100644 index 0000000..cf239e37 --- /dev/null +++ b/components/optimization_guide/proto/page_entities_model_metadata.proto
@@ -0,0 +1,25 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option java_package = "org.chromium.components.optimization_guide.proto"; +option java_outer_classname = "PageEntitiesModelMetadataProto"; + +package optimization_guide.proto; + +message PageEntitiesModelMetadata { + // The maximum model format feature flag that is supported. + // + // If sent from the server, this is the maximum model format feature flag the + // returned model supports. If sent from the client, this is the maximum + // model format feature flag the client knows how to evaluate. + optional int32 max_model_format_feature_flag = 1; + + // The slices to load into the entity annotator. + // + // Will only be populated by the server. + repeated string slice = 2; +} \ No newline at end of file
diff --git a/components/ownership/BUILD.gn b/components/ownership/BUILD.gn index 3c23b17..1c2d554e 100644 --- a/components/ownership/BUILD.gn +++ b/components/ownership/BUILD.gn
@@ -3,8 +3,8 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") -import("//build/config/crypto.gni") import("//build/config/features.gni") +import("//crypto/features.gni") if (is_chromeos_ash) { component("ownership") {
diff --git a/components/permissions/android/res/color/item_chooser_row_icon_color.xml b/components/permissions/android/res/color/item_chooser_row_icon_color.xml index d29d0b80..d27af039 100644 --- a/components/permissions/android/res/color/item_chooser_row_icon_color.xml +++ b/components/permissions/android/res/color/item_chooser_row_icon_color.xml
@@ -4,7 +4,7 @@ found in the LICENSE file. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:color="@color/default_icon_color_inverse" android:state_selected="true"/> + <item android:color="@macro/default_icon_color_inverse" android:state_selected="true"/> <item android:alpha="@dimen/default_disabled_alpha" android:state_enabled="false" android:color="@macro/default_icon_color" /> <item android:color="@macro/default_icon_color"/>
diff --git a/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service_unittest.cc b/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service_unittest.cc index 8b30236..4b1a670a 100644 --- a/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service_unittest.cc +++ b/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service_unittest.cc
@@ -259,10 +259,6 @@ } // namespace // A test class used for testing the TailoredSecurityService class. -// In order for TailoredSecurityService to be valid, we must have a valid -// ProfileSyncService. Using the ProfileSyncServiceMock class allows to -// assign specific return values as needed to make sure the tailored security -// service is available. class TailoredSecurityServiceTest : public testing::Test { public: TailoredSecurityServiceTest()
diff --git a/components/viz/service/frame_sinks/gmb_video_frame_pool_context_provider_impl.cc b/components/viz/service/frame_sinks/gmb_video_frame_pool_context_provider_impl.cc index 162e4f7d..2312e87 100644 --- a/components/viz/service/frame_sinks/gmb_video_frame_pool_context_provider_impl.cc +++ b/components/viz/service/frame_sinks/gmb_video_frame_pool_context_provider_impl.cc
@@ -33,7 +33,8 @@ DETACH_FROM_SEQUENCE(gpu_sequence_checker_); sequence_ = std::make_unique<gpu::SchedulerSequence>( - gpu_service_->GetGpuScheduler(), gpu_service_->main_runner()); + gpu_service_->GetGpuScheduler(), gpu_service_->main_runner(), + /*target_thread_is_always_available=*/true); base::WaitableEvent event;
diff --git a/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.cc b/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.cc index 2fdd804..86c9bf3 100644 --- a/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.cc +++ b/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.cc
@@ -25,6 +25,7 @@ #include "components/viz/common/frame_sinks/copy_output_util.h" #include "components/viz/common/surfaces/local_surface_id.h" #include "components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_manager.h" +#include "components/viz/service/frame_sinks/video_capture/gpu_memory_buffer_video_frame_pool.h" #include "components/viz/service/frame_sinks/video_capture/shared_memory_video_frame_pool.h" #include "media/base/limits.h" #include "media/base/video_util.h" @@ -55,6 +56,42 @@ std::numeric_limits<int>::max(), std::numeric_limits<int>::max()); +std::unique_ptr<VideoFramePool> GetVideoFramePoolForFormat( + media::VideoPixelFormat format, + int capacity, + GmbVideoFramePoolContextProvider* context_provider) { + DCHECK(format == media::PIXEL_FORMAT_I420 || + format == media::PIXEL_FORMAT_NV12 || + format == media::PIXEL_FORMAT_ARGB); + + switch (format) { + case media::PIXEL_FORMAT_I420: + case media::PIXEL_FORMAT_ARGB: + return std::make_unique<SharedMemoryVideoFramePool>(capacity); + case media::PIXEL_FORMAT_NV12: + return std::make_unique<GpuMemoryBufferVideoFramePool>(capacity, + context_provider); + default: + NOTREACHED(); + return nullptr; + } +} + +CopyOutputRequest::ResultFormat VideoPixelFormatToCopyOutputRequestFormat( + media::VideoPixelFormat format) { + switch (format) { + case media::PIXEL_FORMAT_I420: + return CopyOutputRequest::ResultFormat::I420_PLANES; + case media::PIXEL_FORMAT_NV12: + return CopyOutputRequest::ResultFormat::NV12_PLANES; + case media::PIXEL_FORMAT_ARGB: + return CopyOutputRequest::ResultFormat::RGBA; + default: + NOTREACHED(); + return CopyOutputRequest::ResultFormat::RGBA; + } +} + } // namespace // static @@ -82,7 +119,9 @@ gmb_video_frame_pool_context_provider_( gmb_video_frame_pool_context_provider), frame_pool_( - std::make_unique<SharedMemoryVideoFramePool>(kFramePoolCapacity)), + GetVideoFramePoolForFormat(pixel_format_, + kFramePoolCapacity, + gmb_video_frame_pool_context_provider_)), feedback_weak_factory_(oracle_.get()), log_to_webrtc_(log_to_webrtc) { DCHECK(frame_sink_manager_); @@ -148,18 +187,32 @@ bool format_changed = false; if (format != media::PIXEL_FORMAT_I420 && - format != media::PIXEL_FORMAT_ARGB) { - LOG(DFATAL) << "Invalid pixel format: Only I420 and ARGB are supported."; + format != media::PIXEL_FORMAT_ARGB && + format != media::PIXEL_FORMAT_NV12) { + LOG(DFATAL) << "Invalid pixel format: Only I420, ARGB & NV12 formats are " + "supported."; } else { + // We only support NV12 if we got a context provider for pool creation: + CHECK(format != media::PIXEL_FORMAT_NV12 || + gmb_video_frame_pool_context_provider_); + format_changed |= (pixel_format_ != format); pixel_format_ = format; } if (format_changed) { + // Don't tolerate changing to NV12 mid-capture: + CHECK(format != media::PIXEL_FORMAT_NV12 || !video_capture_started_); + TRACE_EVENT_INSTANT1("gpu.capture", "SetFormat", TRACE_EVENT_SCOPE_THREAD, "format", format); MarkFrame(nullptr); + + frame_pool_ = + GetVideoFramePoolForFormat(pixel_format_, kFramePoolCapacity, + gmb_video_frame_pool_context_provider_); + RefreshEntireSourceSoon(); } } @@ -270,6 +323,12 @@ video_capture_started_ = true; buffer_format_preference_ = buffer_format_preference; + // If we should start capture for NV12 format, we can only hand out GMBs so + // the caller must tolerate them: + CHECK(pixel_format_ != media::PIXEL_FORMAT_NV12 || + buffer_format_preference_ == + mojom::BufferFormatPreference::kPreferGpuMemoryBuffer); + if (resolved_target_) resolved_target_->OnClientCaptureStarted(); @@ -637,7 +696,8 @@ const gfx::Size& source_size = oracle_->source_size(); DCHECK(!source_size.IsEmpty()); gfx::Rect content_rect; - if (pixel_format_ == media::PIXEL_FORMAT_I420) { + if (pixel_format_ == media::PIXEL_FORMAT_I420 || + pixel_format_ == media::PIXEL_FORMAT_NV12) { content_rect = media::ComputeLetterboxRegionForI420(frame->visible_rect(), source_size); } else { @@ -664,7 +724,8 @@ dirty_rect_, gfx::Vector2d(source_size.width(), source_size.height()), gfx::Vector2d(content_rect.width(), content_rect.height())); update_rect.Offset(content_rect.OffsetFromOrigin()); - if (pixel_format_ == media::PIXEL_FORMAT_I420) + if (pixel_format_ == media::PIXEL_FORMAT_I420 || + pixel_format_ == media::PIXEL_FORMAT_NV12) update_rect = ExpandRectToI420SubsampleBoundaries(update_rect); } metadata.capture_update_rect = update_rect; @@ -685,6 +746,11 @@ strides = base::StringPrintf("strideRGBA:%d", frame->stride(VideoFrame::kARGBPlane)); break; + case media::PIXEL_FORMAT_NV12: + strides = base::StringPrintf("strideY:%d StrideUV:%d", + frame->stride(VideoFrame::kYPlane), + frame->stride(VideoFrame::kUVPlane)); + break; default: strides = "strides:???"; } @@ -710,14 +776,16 @@ // Extreme edge-case: If somehow the source size is so tiny that the content // region becomes empty, just deliver a frame filled with black. if (content_rect.IsEmpty()) { - if (pixel_format_ == media::PIXEL_FORMAT_I420) { - media::FillYUV(frame.get(), 0x00, 0x80, 0x80); + media::LetterboxVideoFrame(frame.get(), gfx::Rect()); + + if (pixel_format_ == media::PIXEL_FORMAT_I420 || + pixel_format_ == media::PIXEL_FORMAT_NV12) { frame->set_color_space(gfx::ColorSpace::CreateREC709()); } else { DCHECK_EQ(pixel_format_, media::PIXEL_FORMAT_ARGB); - media::LetterboxVideoFrame(frame.get(), gfx::Rect()); frame->set_color_space(gfx::ColorSpace::CreateSRGB()); } + dirty_rect_ = gfx::Rect(); OnFrameReadyForDelivery(capture_frame_number, oracle_frame_number, gfx::Rect(), std::move(frame)); @@ -739,15 +807,29 @@ resolved_target_->GetCopyOutputRequestRegion(VideoCaptureSubTarget{}), std::move(frame), base::TimeTicks::Now()); + const bool use_nv12_with_textures = + buffer_format_preference_ == + mojom::BufferFormatPreference::kPreferGpuMemoryBuffer && + pixel_format_ == media::PIXEL_FORMAT_NV12; + + absl::optional<BlitRequest> blit_request; + if (use_nv12_with_textures) { + std::array<gpu::MailboxHolder, 3> mailbox_holders = { + request_properties.frame->mailbox_holder(0), + request_properties.frame->mailbox_holder(1), gpu::MailboxHolder{}}; + blit_request = BlitRequest(content_rect.origin(), mailbox_holders); + } + // Request a copy of the next frame from the frame sink. auto request = std::make_unique<CopyOutputRequest>( - pixel_format_ == media::PIXEL_FORMAT_I420 - ? CopyOutputRequest::ResultFormat::I420_PLANES - : CopyOutputRequest::ResultFormat::RGBA, - CopyOutputRequest::ResultDestination::kSystemMemory, + VideoPixelFormatToCopyOutputRequestFormat(pixel_format_), + use_nv12_with_textures + ? CopyOutputRequest::ResultDestination::kNativeTextures + : CopyOutputRequest::ResultDestination::kSystemMemory, base::BindOnce(&FrameSinkVideoCapturerImpl::DidCopyFrame, capture_weak_factory_.GetWeakPtr(), std::move(request_properties))); + request->set_result_task_runner(base::SequencedTaskRunnerHandle::Get()); request->set_source(copy_request_source_); request->set_area(capture_region); @@ -759,6 +841,10 @@ // damage over all the frames that weren't captured. request->set_result_selection(gfx::Rect(content_rect.size())); + if (blit_request) { + request->set_blit_request(*blit_request); + } + // Clear the |dirty_rect_|, to indicate all changes at the source are now // being captured. dirty_rect_ = gfx::Rect(); @@ -872,7 +958,7 @@ } UMA_HISTOGRAM_BOOLEAN("Viz.FrameSinkVideoCapturer.I420.CaptureSucceeded", success); - } else { + } else if (pixel_format_ == media::PIXEL_FORMAT_ARGB) { int stride = frame->stride(VideoFrame::kARGBPlane); DCHECK_EQ(media::PIXEL_FORMAT_ARGB, pixel_format_); uint8_t* const pixels = frame->visible_data(VideoFrame::kARGBPlane) + @@ -887,6 +973,8 @@ } UMA_HISTOGRAM_BOOLEAN("Viz.FrameSinkVideoCapturer.RGBA.CaptureSucceeded", success); + } else { + DCHECK_EQ(pixel_format_, media::PIXEL_FORMAT_NV12); } if (frame) { @@ -894,12 +982,15 @@ // In some cases, the content_rect is smaller than the capture_rect. sub_region.ClampToCenteredSize(content_rect.size()); - auto overlay_renderer = VideoCaptureOverlay::MakeCombinedRenderer( - GetOverlaysInOrder(), - VideoCaptureOverlay::CapturedFrameProperties{ - properties.active_frame_rect, sub_region, frame->format()}); - if (overlay_renderer) { - std::move(overlay_renderer).Run(frame.get()); + if (pixel_format_ != media::PIXEL_FORMAT_NV12) { + // TODO(bialpio): implement overlays for NV12! + auto overlay_renderer = VideoCaptureOverlay::MakeCombinedRenderer( + GetOverlaysInOrder(), + VideoCaptureOverlay::CapturedFrameProperties{ + properties.active_frame_rect, sub_region, frame->format()}); + if (overlay_renderer) { + std::move(overlay_renderer).Run(frame.get()); + } } // The result may be smaller than what was requested, if unforeseen @@ -991,8 +1082,8 @@ // send to the consumer. auto handle = frame_pool_->CloneHandleForDelivery(*frame); DCHECK(handle); - DCHECK(handle->is_read_only_shmem_region()); - DCHECK(handle->get_read_only_shmem_region().IsValid()); + DCHECK(!handle->is_read_only_shmem_region() || + handle->get_read_only_shmem_region().IsValid()); // Assemble frame layout, format, and metadata into a mojo struct to send to // the consumer. @@ -1030,7 +1121,7 @@ } gfx::Size FrameSinkVideoCapturerImpl::AdjustSizeForPixelFormat( - const gfx::Size& raw_size) { + const gfx::Size& raw_size) const { if (pixel_format_ == media::PIXEL_FORMAT_ARGB) { gfx::Size result(raw_size); if (result.width() <= 0) @@ -1039,7 +1130,8 @@ result.set_height(1); return result; } - DCHECK_EQ(media::PIXEL_FORMAT_I420, pixel_format_); + DCHECK(media::PIXEL_FORMAT_I420 == pixel_format_ || + media::PIXEL_FORMAT_NV12 == pixel_format_); gfx::Size result(raw_size.width() & ~1, raw_size.height() & ~1); if (result.width() <= 0) result.set_width(2);
diff --git a/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.h b/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.h index 4f5aa36..96613792 100644 --- a/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.h +++ b/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.h
@@ -287,7 +287,7 @@ // For ARGB format, ensures that every dimension of |size| is positive. For // I420 format, ensures that every dimension is even and at least 2. - gfx::Size AdjustSizeForPixelFormat(const gfx::Size& size); + gfx::Size AdjustSizeForPixelFormat(const gfx::Size& size) const; // Expands |rect| such that its x, y, right, and bottom values are even // numbers.
diff --git a/components/viz/service/frame_sinks/video_capture/gpu_memory_buffer_video_frame_pool.cc b/components/viz/service/frame_sinks/video_capture/gpu_memory_buffer_video_frame_pool.cc index 77994d4..9fd40c44 100644 --- a/components/viz/service/frame_sinks/video_capture/gpu_memory_buffer_video_frame_pool.cc +++ b/components/viz/service/frame_sinks/video_capture/gpu_memory_buffer_video_frame_pool.cc
@@ -51,8 +51,11 @@ const media::VideoFrame& frame) { DCHECK(frame.HasGpuMemoryBuffer()); + gfx::GpuMemoryBufferHandle handle = frame.GetGpuMemoryBuffer()->CloneHandle(); + handle.id = gfx::GpuMemoryBufferId(-1); + return media::mojom::VideoBufferHandle::NewGpuMemoryBufferHandle( - frame.GetGpuMemoryBuffer()->CloneHandle()); + std::move(handle)); } size_t GpuMemoryBufferVideoFramePool::GetNumberOfReservedFrames() const {
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 14230035..6e779e24 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -116,6 +116,7 @@ #include "content/public/common/main_function_params.h" #include "content/public/common/result_codes.h" #include "content/public/common/zygote/zygote_buildflags.h" +#include "crypto/crypto_buildflags.h" #include "device/fido/hid/fido_hid_discovery.h" #include "device/gamepad/gamepad_service.h" #include "media/audio/audio_manager.h" @@ -226,7 +227,7 @@ #include "content/browser/media/cdm_registry_impl.h" #endif -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "crypto/nss_util.h" #endif @@ -599,7 +600,7 @@ net::EnsureWinsockInit(); #endif -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) // We want to be sure to init NSPR on the main thread. crypto::EnsureNSPRInit(); #endif
diff --git a/content/browser/loader/file_url_loader_factory.cc b/content/browser/loader/file_url_loader_factory.cc index d2dd649e..c685ed6f 100644 --- a/content/browser/loader/file_url_loader_factory.cc +++ b/content/browser/loader/file_url_loader_factory.cc
@@ -45,6 +45,7 @@ #include "net/base/mime_util.h" #include "net/base/net_errors.h" #include "net/http/http_byte_range.h" +#include "net/http/http_response_headers.h" #include "net/http/http_util.h" #include "net/url_request/redirect_info.h" #include "services/network/public/cpp/cors/cors.h" @@ -674,10 +675,16 @@ head->mime_type.assign(new_type); head->did_mime_sniff = true; } - if (head->headers) { - head->headers->AddHeader(net::HttpRequestHeaders::kContentType, - head->mime_type); + if (!head->headers) { + head->headers = + base::MakeRefCounted<net::HttpResponseHeaders>("HTTP/1.1 200 OK"); } + head->headers->AddHeader(net::HttpRequestHeaders::kContentType, + head->mime_type); + // We add a Last-Modified header to file responses so that our + // implementation of document.lastModified can access it (crbug.com/875299). + head->headers->AddHeader(net::HttpResponseHeaders::kLastModified, + base::TimeFormatHTTP(info.last_modified)); client_->OnReceiveResponse(std::move(head)); client_->OnStartLoadingResponseBody(std::move(consumer_handle));
diff --git a/content/browser/loader/file_url_loader_factory_browsertest.cc b/content/browser/loader/file_url_loader_factory_browsertest.cc index ebba287..5e57a9d 100644 --- a/content/browser/loader/file_url_loader_factory_browsertest.cc +++ b/content/browser/loader/file_url_loader_factory_browsertest.cc
@@ -524,5 +524,30 @@ img_url))); } +IN_PROC_BROWSER_TEST_F(FileURLLoaderFactoryBrowserTest, LastModified) { + // Create a temporary file with an arbitrary last-modified timestamp. + const char kLastModified[] = "1994-11-15T12:45:26.000Z"; + base::FilePath path; + { + base::ScopedAllowBlockingForTesting allow_blocking; + ASSERT_TRUE(base::CreateTemporaryFile(&path)); + base::Time last_modified_time; + ASSERT_TRUE(base::Time::FromString(kLastModified, &last_modified_time)); + ASSERT_TRUE(base::TouchFile(path, /*last_accessed=*/base::Time::Now(), + last_modified_time)); + } + EXPECT_TRUE(NavigateToURL(shell(), net::FilePathToFileURL(path))); + + // Verify the syntax + EXPECT_THAT(content::EvalJs(shell()->web_contents(), "document.lastModified") + .ExtractString(), + testing::MatchesRegex(R"(\d\d/\d\d/\d\d\d\d \d\d:\d\d:\d\d)")); + // Verify the value (it's in local time, so we parse it and convert it in JS + // to get a representation in UTC). + EXPECT_EQ(kLastModified, + content::EvalJs(shell()->web_contents(), + "new Date(document.lastModified).toISOString()")); +} + } // namespace } // namespace content
diff --git a/content/browser/loader/file_url_loader_factory_unittest.cc b/content/browser/loader/file_url_loader_factory_unittest.cc index f6950ce4..bb2debe 100644 --- a/content/browser/loader/file_url_loader_factory_unittest.cc +++ b/content/browser/loader/file_url_loader_factory_unittest.cc
@@ -7,9 +7,12 @@ #include <memory> #include <string> +#include "base/files/file_util.h" #include "base/path_service.h" +#include "base/test/bind.h" #include "base/test/task_environment.h" #include "base/threading/thread_restrictions.h" +#include "base/time/time.h" #include "content/public/browser/shared_cors_origin_access_list.h" #include "content/public/common/content_paths.h" #include "content/public/test/simple_url_loader_test_helper.h" @@ -101,6 +104,9 @@ network::SimpleURLLoader::kMaxBoundedStringDownloadSize); helper.WaitForCallback(); + if (loader->ResponseInfo()) { + response_info_ = loader->ResponseInfo()->Clone(); + } return loader->NetError(); } @@ -125,13 +131,58 @@ return access_list_->GetPermittedSourceOrigin(); } + network::mojom::URLResponseHead* ResponseInfo() { + return response_info_.get(); + } + private: base::test::TaskEnvironment task_environment_; base::FilePath profile_dummy_path_; scoped_refptr<SharedCorsOriginAccessListForTesting> access_list_; mojo::Remote<network::mojom::URLLoaderFactory> factory_; + network::mojom::URLResponseHeadPtr response_info_; }; +TEST_F(FileURLLoaderFactoryTest, LastModified) { + // The Last-Modified response header should be populated with the file + // modification time. + const char kTimeString[] = "Tue, 15 Nov 1994 12:45:26 GMT"; + + // Create a temporary file with an arbitrary last-modified timestamp. + base::FilePath file; + ASSERT_TRUE(base::CreateTemporaryFile(&file)); + base::Time time; + ASSERT_TRUE(base::Time::FromString(kTimeString, &time)); + ASSERT_TRUE(base::TouchFile(file, /*last_accessed=*/base::Time::Now(), + /*last_modified=*/time)); + + // Request the file and extract the Last-Modified header. + auto request = std::make_unique<network::ResourceRequest>(); + request->url = net::FilePathToFileURL(file); + std::string last_modified; + ASSERT_EQ(net::OK, CreateLoaderAndRun(std::move(request))); + ASSERT_NE(ResponseInfo(), nullptr); + ASSERT_TRUE(ResponseInfo()->headers->EnumerateHeader( + /*iter*/ nullptr, net::HttpResponseHeaders::kLastModified, + &last_modified)); + + // The header matches the file modification time. + ASSERT_EQ(kTimeString, last_modified); +} + +TEST_F(FileURLLoaderFactoryTest, Status) { + base::FilePath file; + ASSERT_TRUE(base::CreateTemporaryFile(&file)); + auto request = std::make_unique<network::ResourceRequest>(); + request->url = net::FilePathToFileURL(file); + ASSERT_EQ(net::OK, CreateLoaderAndRun(std::move(request))); + + ASSERT_NE(ResponseInfo(), nullptr); + ASSERT_NE(ResponseInfo()->headers, nullptr); + ASSERT_EQ(200, ResponseInfo()->headers->response_code()); + ASSERT_EQ("OK", ResponseInfo()->headers->GetStatusText()); +} + TEST_F(FileURLLoaderFactoryTest, MissedRequestInitiator) { // CORS-disabled requests can omit |request.request_initiator| though it is // discouraged not to set |request.request_initiator|.
diff --git a/content/browser/media/capture/frame_sink_video_capture_device.cc b/content/browser/media/capture/frame_sink_video_capture_device.cc index 2080dbb9..923ed80 100644 --- a/content/browser/media/capture/frame_sink_video_capture_device.cc +++ b/content/browser/media/capture/frame_sink_video_capture_device.cc
@@ -353,7 +353,8 @@ return; } - capturer_->Start(this, viz::mojom::BufferFormatPreference::kDefault); + capturer_->Start(this, + viz::mojom::BufferFormatPreference::kPreferGpuMemoryBuffer); } void FrameSinkVideoCaptureDevice::MaybeStopConsuming() {
diff --git a/content/browser/media/capture/frame_sink_video_capture_device_unittest.cc b/content/browser/media/capture/frame_sink_video_capture_device_unittest.cc index e2f893b..1f8ccd5 100644 --- a/content/browser/media/capture/frame_sink_video_capture_device_unittest.cc +++ b/content/browser/media/capture/frame_sink_video_capture_device_unittest.cc
@@ -353,7 +353,8 @@ MockChangeTarget(absl::optional<viz::VideoCaptureTarget>(target))); EXPECT_CALL( capturer_, - MockStart(NotNull(), viz::mojom::BufferFormatPreference::kDefault)); + MockStart(NotNull(), + viz::mojom::BufferFormatPreference::kPreferGpuMemoryBuffer)); EXPECT_FALSE(capturer_.is_bound()); POST_DEVICE_METHOD_CALL(OnTargetChanged, target);
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index 7f889967..3c03ae2 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -60,6 +60,7 @@ #include "content/browser/renderer_host/debug_urls.h" #include "content/browser/renderer_host/frame_tree.h" #include "content/browser/renderer_host/frame_tree_node.h" +#include "content/browser/renderer_host/navigation_controller_delegate.h" #include "content/browser/renderer_host/navigation_entry_impl.h" #include "content/browser/renderer_host/navigation_entry_restore_context_impl.h" #include "content/browser/renderer_host/navigation_request.h" @@ -1138,6 +1139,10 @@ pending_entry_->GetUniqueID() == request->nav_entry_id(); } +bool NavigationControllerImpl::has_post_commit_error_entry() const { + return entry_replaced_by_post_commit_error_ != nullptr; +} + bool NavigationControllerImpl::RendererDidNavigate( RenderFrameHostImpl* rfh, const mojom::DidCommitProvisionalLoadParams& params, @@ -1147,6 +1152,12 @@ bool previous_document_was_activated, NavigationRequest* navigation_request) { DCHECK(navigation_request); + + // Note: validation checks and renderer kills due to invalid commit messages + // must happen before getting here, in + // RenderFrameHostImpl::ValidateDidCommitParams. By the time we get here, some + // effects of the navigation have already occurred. + if (ShouldMaintainTrivialSessionHistory(rfh->frame_tree_node()) && GetLastCommittedEntry()) { // Ensure that this navigation does not add a navigation entry, since @@ -1163,13 +1174,11 @@ bool overriding_user_agent_changed = false; if (GetLastCommittedEntry()) { if (entry_replaced_by_post_commit_error_) { - if (is_same_document_navigation) { - // Same document navigations should not be possible on error pages and - // would leave the controller in a weird state. Kill the renderer if - // that happens. - bad_message::ReceivedBadMessage( - rfh->GetProcess(), bad_message::NC_SAME_DOCUMENT_POST_COMMIT_ERROR); - } + // Same document navigation events with a post-commit error should already + // be blocked by RenderFrameHostImpl::ValidateDidCommitParams() before + // reaching here. + CHECK(!is_same_document_navigation); + // Any commit while a post-commit error page is showing should put the // original entry back, replacing the error page's entry. This includes // reloads, where the original entry was used as the pending entry and
diff --git a/content/browser/renderer_host/navigation_controller_impl.h b/content/browser/renderer_host/navigation_controller_impl.h index d7b2595..537d2f3 100644 --- a/content/browser/renderer_host/navigation_controller_impl.h +++ b/content/browser/renderer_host/navigation_controller_impl.h
@@ -397,6 +397,9 @@ // params. void PopulateAppHistoryEntryVectors(NavigationRequest* request); + // Returns whether the last NavigationEntry encountered a post-commit error. + bool has_post_commit_error_entry() const; + private: friend class RestoreHelper;
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 8297595..60e66540 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -4205,8 +4205,16 @@ } void RenderFrameHostImpl::ResetNavigationRequests() { - navigation_requests_.clear(); - same_document_navigation_requests_.clear(); + // Move the NavigationRequests to new maps first before deleting them. This + // avoids issues if a re-entrant call is made when a NavigationRequest is + // being deleted (e.g., if the process goes away as the tab is closing). + std::map<NavigationRequest*, std::unique_ptr<NavigationRequest>> + navigation_requests; + navigation_requests_.swap(navigation_requests); + + base::flat_map<base::UnguessableToken, std::unique_ptr<NavigationRequest>> + same_document_navigation_requests; + same_document_navigation_requests_.swap(same_document_navigation_requests); } void RenderFrameHostImpl::SetNavigationRequest( @@ -10247,6 +10255,19 @@ return false; } + // Same document navigations should not be possible on post-commit error pages + // and would leave the NavigationController in a weird state. Kill the + // renderer before getting to NavigationController::RendererDidNavigate if + // that happens. + if (is_same_document_navigation && frame_tree_node_->navigator() + .controller() + .has_post_commit_error_entry()) { + bad_message::ReceivedBadMessage( + frame_tree_node_->render_manager()->current_frame_host()->GetProcess(), + bad_message::NC_SAME_DOCUMENT_POST_COMMIT_ERROR); + return false; + } + return true; }
diff --git a/content/browser/webui/web_ui_impl.cc b/content/browser/webui/web_ui_impl.cc index f8f8ca4..9c425d1 100644 --- a/content/browser/webui/web_ui_impl.cc +++ b/content/browser/webui/web_ui_impl.cc
@@ -10,7 +10,6 @@ #include <utility> #include "base/callback_helpers.h" -#include "base/debug/crash_logging.h" #include "base/debug/dump_without_crashing.h" #include "base/json/json_writer.h" #include "base/strings/string_piece.h" @@ -274,10 +273,6 @@ void WebUIImpl::ProcessWebUIMessage(const GURL& source_url, const std::string& message, const base::ListValue& args) { - // Crash keys for https://crbug.com/1275766 - SCOPED_CRASH_KEY_STRING32("WebUI", "URL", source_url.spec()); - SCOPED_CRASH_KEY_STRING64("WebUI", "message", message); - if (controller_->OverrideHandleWebUIMessage(source_url, message, args)) return;
diff --git a/content/common/content_param_traits.h b/content/common/content_param_traits.h index 8a060a3..4a0ef90 100644 --- a/content/common/content_param_traits.h +++ b/content/common/content_param_traits.h
@@ -14,17 +14,18 @@ #ifndef CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_ #define CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_ -#include "base/memory/ref_counted.h" -#include "cc/ipc/cc_param_traits_macros.h" #include "content/common/content_export.h" #include "content/common/content_param_traits_macros.h" #include "ipc/ipc_mojo_param_traits.h" -#include "ui/accessibility/ax_mode.h" namespace blink { -class PolicyValue; class MessagePortChannel; class MessagePortDescriptor; +class PolicyValue; +} // namespace blink + +namespace ui { +class AXMode; } namespace viz {
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index ebfc1f7..367ccf8 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -157,21 +157,14 @@ namespace content { namespace { -// Specifying a prototype so that we can add the WARN_UNUSED_RESULT attribute. +// Executes the passed |script| in the frame specified by |render_frame_host|. +// If |result| is not NULL, stores the value that the evaluation of the script +// in |result|. Returns true on success. [[nodiscard]] bool ExecuteScriptHelper(RenderFrameHost* render_frame_host, const std::string& script, bool user_gesture, int32_t world_id, - std::unique_ptr<base::Value>* result); - -// Executes the passed |script| in the frame specified by |render_frame_host|. -// If |result| is not NULL, stores the value that the evaluation of the script -// in |result|. Returns true on success. -bool ExecuteScriptHelper(RenderFrameHost* render_frame_host, - const std::string& script, - bool user_gesture, - int32_t world_id, - std::unique_ptr<base::Value>* result) { + std::unique_ptr<base::Value>* result) { // TODO(lukasza): Only get messages from the specific |render_frame_host|. DOMMessageQueue dom_message_queue(render_frame_host);
diff --git a/content/public/test/test_utils.h b/content/public/test/test_utils.h index 965b5a32..aa9a6cd 100644 --- a/content/public/test/test_utils.h +++ b/content/public/test/test_utils.h
@@ -354,7 +354,7 @@ // Overridden WebContentsObserver methods. void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; - // TODO(1267073): Add WARN_UNUSED_RESULT + // TODO(1267073): Add [[nodiscard]] // Returns true if the frame was deleted before the timeout. bool WaitUntilDeleted(); bool deleted() const;
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 2a1ed0d..050dff7 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -6,7 +6,6 @@ import("//build/config/chromecast_build.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/compiler/compiler.gni") -import("//build/config/crypto.gni") import("//build/config/features.gni") import("//build/config/ui.gni") import("//build/nocompile.gni")
diff --git a/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt index 36ea117..e0ea1d2 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt
@@ -398,15 +398,9 @@ crbug.com/angleproject/6430 [ mac passthrough angle-metal ] WebglExtension_EXT_disjoint_timer_query_webgl2 [ Failure ] crbug.com/angleproject/6430 [ mac passthrough angle-metal ] WebglExtension_WEBGL_draw_instanced_base_vertex_base_instance [ Failure ] crbug.com/angleproject/6430 [ mac passthrough angle-metal ] WebglExtension_WEBGL_multi_draw_instanced_base_vertex_base_instance [ Failure ] -crbug.com/angleproject/6430 [ mac passthrough angle-metal ] conformance/extensions/s3tc-and-rgtc.html [ Failure ] -crbug.com/angleproject/6430 [ mac passthrough angle-metal ] conformance/extensions/webgl-compressed-texture-s3tc-srgb.html [ Failure ] -crbug.com/angleproject/6430 [ mac passthrough angle-metal ] conformance/extensions/webgl-debug-shaders.html [ Failure ] crbug.com/angleproject/6430 [ mac passthrough angle-metal ] conformance/ogles/GL/build/build_009_to_016.html [ Failure ] crbug.com/angleproject/6430 [ mac passthrough angle-metal ] conformance/ogles/GL/build/build_017_to_024.html [ Failure ] crbug.com/angleproject/6430 [ mac passthrough angle-metal ] conformance2/rendering/fs-color-type-mismatch-color-buffer-type.html [ Failure ] -crbug.com/angleproject/6430 [ mac passthrough angle-metal ] conformance2/transform_feedback/too-small-buffers.html [ Failure ] -crbug.com/angleproject/6430 [ mac passthrough angle-metal ] deqp/functional/gles3/fboinvalidate/sub.html [ Failure ] -crbug.com/angleproject/6430 [ mac passthrough angle-metal ] deqp/functional/gles3/fboinvalidate/whole.html [ Failure ] crbug.com/angleproject/6430 [ mac passthrough angle-metal ] deqp/functional/gles3/occlusionquery_conservative.html [ Failure ] crbug.com/angleproject/6430 [ mac passthrough angle-metal ] deqp/functional/gles3/occlusionquery_strict.html [ Failure ] crbug.com/angleproject/6430 [ mac passthrough angle-metal ] deqp/functional/gles3/fbomultisample.2_samples.html [ Failure ]
diff --git a/crypto/BUILD.gn b/crypto/BUILD.gn index 34fb09a..ca19077 100644 --- a/crypto/BUILD.gn +++ b/crypto/BUILD.gn
@@ -2,10 +2,16 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/buildflag_header.gni") import("//build/config/chromeos/ui_mode.gni") -import("//build/config/crypto.gni") +import("//crypto/features.gni") import("//testing/test.gni") +buildflag_header("buildflags") { + header = "crypto_buildflags.h" + flags = [ "USE_NSS_CERTS=$use_nss_certs" ] +} + component("crypto") { output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto. sources = [ @@ -56,7 +62,10 @@ "//base/third_party/dynamic_annotations", ] - public_deps = [ "//third_party/boringssl" ] + public_deps = [ + ":buildflags", + "//third_party/boringssl", + ] if (is_apple) { sources += [
diff --git a/crypto/features.gni b/crypto/features.gni new file mode 100644 index 0000000..5777938 --- /dev/null +++ b/crypto/features.gni
@@ -0,0 +1,10 @@ +# Copyright 2022 The Chromium Authors.All rights reserved. +# Use of this source code is governed by a BSD - style license that can be +# found in the LICENSE file. + +import("//build/config/features.gni") + +declare_args() { + # True if NSS is used for certificate handling. + use_nss_certs = is_linux || is_chromeos +}
diff --git a/device/gamepad/gamepad_platform_data_fetcher_mac.mm b/device/gamepad/gamepad_platform_data_fetcher_mac.mm index 3a7568c..b7543e5 100644 --- a/device/gamepad/gamepad_platform_data_fetcher_mac.mm +++ b/device/gamepad/gamepad_platform_data_fetcher_mac.mm
@@ -82,8 +82,8 @@ IOHIDManagerScheduleWithRunLoop(hid_manager_ref_, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); - enabled_ = IOHIDManagerOpen(hid_manager_ref_, kIOHIDOptionsTypeNone) == - kIOReturnSuccess; + const auto result = IOHIDManagerOpen(hid_manager_ref_, kIOHIDOptionsTypeNone); + enabled_ = (result == kIOReturnSuccess || result == kIOReturnExclusiveAccess); } void GamepadPlatformDataFetcherMac::UnregisterFromNotifications() {
diff --git a/gpu/config/gpu_control_list_format.txt b/gpu/config/gpu_control_list_format.txt index b767926..45b3854 100644 --- a/gpu/config/gpu_control_list_format.txt +++ b/gpu/config/gpu_control_list_format.txt
@@ -108,6 +108,12 @@ // in that case, major is still numerical, but minor is lexical. // Only "driver_version" supports "(intel|nvidia)_driver" schema. // +// intel_driver schema versions have two forms: AA.BB.CC.DDDD (legacy) and +// AA.BB.CCC.DDDD (new). Of these, the last two fields are most relevant, and +// the first two can be ignored by setting them to 0. The two forms must not be +// mixed e.g. < 0.0.100.0 does not include legacy driver versions - the correct +// constraint is <= 0.0.99.9999. +// // FLOAT includes "op" "value", and "value2". "op" can be any of the // following values: "=", "<", "<=", ">", ">=", "any", "between". "value2" is // only used if "op" is "between". "value" is used for all "op" values except
diff --git a/gpu/config/gpu_control_list_version_unittest.cc b/gpu/config/gpu_control_list_version_unittest.cc index 5c66e7c..e3d8675 100644 --- a/gpu/config/gpu_control_list_version_unittest.cc +++ b/gpu/config/gpu_control_list_version_unittest.cc
@@ -210,6 +210,18 @@ EXPECT_TRUE(info.Contains("10.18.15.4279")); EXPECT_FALSE(info.Contains("15.40.15.4058")); } + { + // Old driver versions cannot be compared against new driver versions. + Version info = {kLT, kNumerical, kIntelDriver, "0.0.100.0", nullptr}; + EXPECT_FALSE(info.Contains("23.20.16.4973")); + EXPECT_FALSE(info.Contains("20.19.15.4364")); + } + { + // Old driver versions can only be compared against old driver versions. + Version info = {kLE, kNumerical, kIntelDriver, "0.0.99.9999", nullptr}; + EXPECT_TRUE(info.Contains("23.20.16.4973")); + EXPECT_TRUE(info.Contains("20.19.15.4364")); + } } TEST_F(VersionTest, NvidiaDriverSchema) {
diff --git a/gpu/config/gpu_driver_bug_list.json b/gpu/config/gpu_driver_bug_list.json index 2c2fc20..f9a260e 100644 --- a/gpu/config/gpu_driver_bug_list.json +++ b/gpu/config/gpu_driver_bug_list.json
@@ -2823,8 +2823,8 @@ "vendor_id": "0x8086", "driver_version": { "schema": "intel_driver", - "op": "<", - "value": "0.0.100.0" + "op": "<=", + "value": "0.0.99.9999" }, "features": [ "disable_nv12_dynamic_textures"
diff --git a/gpu/ipc/scheduler_sequence.cc b/gpu/ipc/scheduler_sequence.cc index 11fedf5..d978bf42b 100644 --- a/gpu/ipc/scheduler_sequence.cc +++ b/gpu/ipc/scheduler_sequence.cc
@@ -46,11 +46,13 @@ SchedulerSequence::SchedulerSequence( Scheduler* scheduler, - scoped_refptr<base::SingleThreadTaskRunner> task_runner) + scoped_refptr<base::SingleThreadTaskRunner> task_runner, + bool target_thread_is_always_available) : SingleTaskSequence(), scheduler_(scheduler), sequence_id_(scheduler->CreateSequence(SchedulingPriority::kHigh, - std::move(task_runner))) {} + std::move(task_runner))), + target_thread_is_always_available_(target_thread_is_always_available) {} // Note: this drops tasks not executed yet. SchedulerSequence::~SchedulerSequence() { @@ -73,14 +75,17 @@ // ScheduleGpuTask at a point that cannot be supported by Android Webview. // Consider using ScheduleOrRetainGpuTask which will delay (not reorder) the // task in Android Webview until the next DrawAndSwap. + if (!target_thread_is_always_available_) { #if DCHECK_IS_ON() - DCHECK(!GetScheduleTaskDisallowed()->Get()) - << "If your CL is failing this DCHECK, then that means you are probably " - "calling ScheduleGpuTask at a point that cannot be supported by " - "Android Webview. Consider using ScheduleOrRetainGpuTask which will " - "delay (not reorder) the task in Android Webview until the next " - "DrawAndSwap."; + DCHECK(!GetScheduleTaskDisallowed()->Get()) + << "If your CL is failing this DCHECK, then that means you are " + "probably calling ScheduleGpuTask at a point that cannot be " + "supported by Android Webview. Consider using " + "ScheduleOrRetainGpuTask, which will delay (not reorder) the task " + "in Android Webview until the next DrawAndSwap."; #endif + } + ScheduleOrRetainTask(std::move(task), std::move(sync_token_fences), std::move(report_callback)); }
diff --git a/gpu/ipc/scheduler_sequence.h b/gpu/ipc/scheduler_sequence.h index 7b18beb..836e1f4 100644 --- a/gpu/ipc/scheduler_sequence.h +++ b/gpu/ipc/scheduler_sequence.h
@@ -64,10 +64,23 @@ // Enable DCHECKs for Android WebView restrictions for ScheduleTask for // current thread. Then use ScopedAllowScheduleGpuTask to selectively // allow ScheduleTask. + // + // Context: in WebView, display compositor tasks are scheduled on thread + // created by Android framework, so we cannot post tasks to it at arbitrary + // times. Calling this function signifies that by default, we should only + // allow |ScheduleTask()| calls during specific moments (namely, when an + // instance of `ScopedAllowScheduleGpuTask` is alive). If you are creating a + // `SchedulerSequence` using a task runner that does not have any posting + // restrictions, you can suppress the DCHECK by setting the + // |target_thread_is_always_available| to `true` in the constructor. static void DefaultDisallowScheduleTaskOnCurrentThread(); + // Set |target_thread_is_always_available| to true to communicate that + // ScheduleTask is always possible. This will suppress the DCHECKs enabled by + // |DefaultDisallowScheduleTaskOnCurrentThread()|. SchedulerSequence(Scheduler* scheduler, - scoped_refptr<base::SingleThreadTaskRunner> task_runner); + scoped_refptr<base::SingleThreadTaskRunner> task_runner, + bool target_thread_is_always_available = false); SchedulerSequence(const SchedulerSequence&) = delete; SchedulerSequence& operator=(const SchedulerSequence&) = delete; @@ -91,6 +104,7 @@ private: const raw_ptr<Scheduler> scheduler_; const SequenceId sequence_id_; + const bool target_thread_is_always_available_; }; } // namespace gpu
diff --git a/infra/config/generated/builders/ci/android-cronet-arm-dbg/properties.textpb b/infra/config/generated/builders/ci/android-cronet-arm-dbg/properties.textpb index 432cf6b..8252801 100644 --- a/infra/config/generated/builders/ci/android-cronet-arm-dbg/properties.textpb +++ b/infra/config/generated/builders/ci/android-cronet-arm-dbg/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/android-cronet-arm-rel/properties.textpb b/infra/config/generated/builders/ci/android-cronet-arm-rel/properties.textpb index 432cf6b..8252801 100644 --- a/infra/config/generated/builders/ci/android-cronet-arm-rel/properties.textpb +++ b/infra/config/generated/builders/ci/android-cronet-arm-rel/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/android-cronet-arm64-dbg/properties.textpb b/infra/config/generated/builders/ci/android-cronet-arm64-dbg/properties.textpb index 432cf6b..8252801 100644 --- a/infra/config/generated/builders/ci/android-cronet-arm64-dbg/properties.textpb +++ b/infra/config/generated/builders/ci/android-cronet-arm64-dbg/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/android-cronet-arm64-rel/properties.textpb b/infra/config/generated/builders/ci/android-cronet-arm64-rel/properties.textpb index 432cf6b..8252801 100644 --- a/infra/config/generated/builders/ci/android-cronet-arm64-rel/properties.textpb +++ b/infra/config/generated/builders/ci/android-cronet-arm64-rel/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/android-cronet-asan-arm-rel/properties.textpb b/infra/config/generated/builders/ci/android-cronet-asan-arm-rel/properties.textpb index 432cf6b..8252801 100644 --- a/infra/config/generated/builders/ci/android-cronet-asan-arm-rel/properties.textpb +++ b/infra/config/generated/builders/ci/android-cronet-asan-arm-rel/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/android-cronet-x86-dbg/properties.textpb b/infra/config/generated/builders/ci/android-cronet-x86-dbg/properties.textpb index 432cf6b..8252801 100644 --- a/infra/config/generated/builders/ci/android-cronet-x86-dbg/properties.textpb +++ b/infra/config/generated/builders/ci/android-cronet-x86-dbg/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/android-cronet-x86-rel/properties.textpb b/infra/config/generated/builders/ci/android-cronet-x86-rel/properties.textpb index 432cf6b..8252801 100644 --- a/infra/config/generated/builders/ci/android-cronet-x86-rel/properties.textpb +++ b/infra/config/generated/builders/ci/android-cronet-x86-rel/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/android-incremental-dbg/properties.textpb b/infra/config/generated/builders/ci/android-incremental-dbg/properties.textpb index 432cf6b..8252801 100644 --- a/infra/config/generated/builders/ci/android-incremental-dbg/properties.textpb +++ b/infra/config/generated/builders/ci/android-incremental-dbg/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/builders/ci/android-pie-arm64-dbg/properties.textpb b/infra/config/generated/builders/ci/android-pie-arm64-dbg/properties.textpb index 432cf6b..8252801 100644 --- a/infra/config/generated/builders/ci/android-pie-arm64-dbg/properties.textpb +++ b/infra/config/generated/builders/ci/android-pie-arm64-dbg/properties.textpb
@@ -1,10 +1,8 @@ { - "$build/goma": { - "enable_ats": true, - "jobs": 150, - "rpc_extra_params": "?prod", - "server_host": "goma.chromium.org", - "use_luci_auth": true + "$build/reclient": { + "instance": "rbe-chromium-trusted", + "jobs": 500, + "metrics_project": "chromium-reclient-metrics" }, "$recipe_engine/resultdb/test_presentation": { "column_keys": [],
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index 57fef22..9b7f7d3 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -12503,7 +12503,11 @@ project: "chrome-luci-data" dataset: "chromium" table: "ci_text_artifacts" - text_artifacts {} + text_artifacts { + predicate { + content_type_regexp: "snippet" + } + } } history_options { use_invocation_timestamp: true
diff --git a/infra/config/subprojects/chromium/ci/chromium.android.star b/infra/config/subprojects/chromium/ci/chromium.android.star index b0aae3aa..5865353 100644 --- a/infra/config/subprojects/chromium/ci/chromium.android.star +++ b/infra/config/subprojects/chromium/ci/chromium.android.star
@@ -287,6 +287,9 @@ ), cq_mirrors_console_view = "mirrors", notifies = ["cronet"], + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, ) ci.builder( @@ -298,6 +301,9 @@ ), cq_mirrors_console_view = "mirrors", notifies = ["cronet"], + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, ) ci.builder( @@ -307,6 +313,9 @@ short_name = "dbg", ), notifies = ["cronet"], + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, ) ci.builder( @@ -316,6 +325,9 @@ short_name = "rel", ), notifies = ["cronet"], + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, ) ci.builder( @@ -324,6 +336,9 @@ category = "cronet|asan", ), notifies = ["cronet"], + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, ) ci.builder( @@ -381,6 +396,9 @@ short_name = "dbg", ), notifies = ["cronet"], + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, ) ci.builder( @@ -430,6 +448,9 @@ short_name = "rel", ), notifies = ["cronet"], + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, ) ci.builder( @@ -437,6 +458,9 @@ console_view_entry = consoles.console_view_entry( category = "tester|incremental", ), + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, ) ci.builder( @@ -482,6 +506,9 @@ ), cq_mirrors_console_view = "mirrors", triggered_by = ["ci/Android arm64 Builder (dbg)"], + goma_backend = None, + reclient_instance = rbe_instance.DEFAULT, + reclient_jobs = rbe_jobs.HIGH_JOBS_FOR_CI, ) # TODO(crbug/1182468) Remove android coverage bots after coverage is
diff --git a/infra/config/subprojects/chromium/ci/chromium.linux.star b/infra/config/subprojects/chromium/ci/chromium.linux.star index c3aa231..a3d2123f 100644 --- a/infra/config/subprojects/chromium/ci/chromium.linux.star +++ b/infra/config/subprojects/chromium/ci/chromium.linux.star
@@ -247,6 +247,11 @@ resultdb_bigquery_exports = [ resultdb.export_text_artifacts( bq_table = "chrome-luci-data.chromium.ci_text_artifacts", + predicate = resultdb.artifact_predicate( + # Only archive output snippets since some tests can generate + # very large supplementary files. + content_type_regexp = "snippet", + ), ), ], )
diff --git a/ios/chrome/browser/ui/content_suggestions/BUILD.gn b/ios/chrome/browser/ui/content_suggestions/BUILD.gn index 4e482c28..5048c3c 100644 --- a/ios/chrome/browser/ui/content_suggestions/BUILD.gn +++ b/ios/chrome/browser/ui/content_suggestions/BUILD.gn
@@ -282,6 +282,7 @@ "//ios/chrome/app/strings", "//ios/chrome/browser:pref_names", "//ios/chrome/browser:utils", + "//ios/chrome/browser/ui/content_suggestions/cells:constants", "//ios/chrome/browser/ui/ntp:constants", "//ios/chrome/browser/ui/ntp:feature_flags", "//ios/chrome/browser/ui/popup_menu:constants",
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/BUILD.gn b/ios/chrome/browser/ui/content_suggestions/cells/BUILD.gn index 28bf9f1..c6d1d5e 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/BUILD.gn +++ b/ios/chrome/browser/ui/content_suggestions/cells/BUILD.gn
@@ -4,6 +4,7 @@ source_set("cells") { sources = [ + "content_suggestions_gesture_commands.h", "content_suggestions_header_item.h", "content_suggestions_header_item.mm", "content_suggestions_most_visited_action_cell.h", @@ -18,10 +19,13 @@ "content_suggestions_most_visited_item.mm", "content_suggestions_most_visited_tile_view.h", "content_suggestions_most_visited_tile_view.mm", + "content_suggestions_parent_item.h", + "content_suggestions_parent_item.mm", "content_suggestions_return_to_recent_tab_item.h", "content_suggestions_return_to_recent_tab_item.mm", "content_suggestions_return_to_recent_tab_view.h", "content_suggestions_return_to_recent_tab_view.mm", + "content_suggestions_selection_actions.h", "content_suggestions_shortcut_tile_view.h", "content_suggestions_shortcut_tile_view.mm", "content_suggestions_text_item.h", @@ -72,6 +76,8 @@ source_set("constants") { configs += [ "//build/config/compiler:enable_arc" ] sources = [ + "content_suggestions_cells_constants.h", + "content_suggestions_cells_constants.mm", "content_suggestions_tile_constants.h", "content_suggestions_tile_constants.mm", ]
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.h b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.h new file mode 100644 index 0000000..e7185450 --- /dev/null +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.h
@@ -0,0 +1,16 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_CELLS_CONSTANTS_H_ +#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_CELLS_CONSTANTS_H_ + +#import <UIKit/UIKit.h> + +// Default size of the Return To Recent Tab tile. +extern const CGSize kReturnToRecentTabSize; + +// Accessibility Identifier for the NTP Promo view. +extern NSString* const kContentSuggestionsWhatsNewIdentifier; + +#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_CELLS_CONSTANTS_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.mm new file mode 100644 index 0000000..688c096d --- /dev/null +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.mm
@@ -0,0 +1,14 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +const CGSize kReturnToRecentTabSize = {/*width=*/343, /*height=*/72}; + +NSString* const kContentSuggestionsWhatsNewIdentifier = + @"ContentSuggestionsWhatsNewIdentifier";
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_parent_item.h b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_parent_item.h new file mode 100644 index 0000000..38fda39 --- /dev/null +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_parent_item.h
@@ -0,0 +1,48 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_PARENT_ITEM_H_ +#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_PARENT_ITEM_H_ + +#import <MaterialComponents/MaterialCollectionCells.h> + +#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_selection_actions.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/suggested_content.h" + +@class ContentSuggestionsMostVisitedActionItem; +@class ContentSuggestionsMostVisitedItem; +@class ContentSuggestionsReturnToRecentTabItem; +@class ContentSuggestionsWhatsNewItem; + +// Item containing all the Content Suggestions content. +@interface ContentSuggestionsParentItem : CollectionViewItem <SuggestedContent> + +// The configuration for the Return To Recent Tab tile. +@property(nonatomic, strong) + ContentSuggestionsReturnToRecentTabItem* returnToRecentItem; +// The configuration for the NTP promo view. +@property(nonatomic, strong) ContentSuggestionsWhatsNewItem* whatsNewItem; +// The list of configurations for the Most Visited Tiles to be shown. +@property(nonatomic, strong) + NSArray<ContentSuggestionsMostVisitedItem*>* mostVisitedItems; +// The list of configurations for the Shortcuts to be shown. +@property(nonatomic, strong) + NSArray<ContentSuggestionsMostVisitedActionItem*>* shortcutsItems; + +// The target for the Most Visited tiles. +@property(nonatomic, weak) id<ContentSuggestionsSelectionActions> tapTarget; + +@end + +// The cell associated with ContentSuggestionsParentItem. +@interface ContentSuggestionsParentCell : MDCCollectionViewCell + +// Adds |view| as a subview. If |spacing| is non-zero, a bottom spacing of +// |spacing| will be added below |view|. +- (void)addUIElement:(UIView*)view withCustomBottomSpacing:(CGFloat)spacing; + +@end + +#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_PARENT_ITEM_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_parent_item.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_parent_item.mm new file mode 100644 index 0000000..f540078 --- /dev/null +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_parent_item.mm
@@ -0,0 +1,227 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_parent_item.h" + +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_action_item.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_tile_view.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_view.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_shortcut_tile_view.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.h" +#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_utils.h" +#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.h" +#import "ios/chrome/common/ui/util/constraints_ui_util.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface ContentSuggestionsParentItem () + +// List of all UITapGestureRecognizers created for the Most Visisted tiles. +@property(nonatomic, strong) + NSMutableArray<UITapGestureRecognizer*>* mostVisitedTapRecognizers; +// The UITapGestureRecognizer for the Return To Recent Tab tile. +@property(nonatomic, strong) + UITapGestureRecognizer* returnToRecentTabTapRecognizer; +// The UITapGestureRecognizer for the NTP promo view. +@property(nonatomic, strong) UITapGestureRecognizer* promoTapRecognizer; + +@end + +@implementation ContentSuggestionsParentItem +@synthesize metricsRecorded; +@synthesize suggestionIdentifier; + +- (instancetype)initWithType:(NSInteger)type { + self = [super initWithType:type]; + if (self) { + self.cellClass = [ContentSuggestionsParentCell class]; + } + return self; +} + +- (void)configureCell:(ContentSuggestionsParentCell*)cell { + [super configureCell:cell]; + + CGFloat horizontalSpacing = + ContentSuggestionsTilesHorizontalSpacing(cell.traitCollection); + if (self.returnToRecentItem) { + ContentSuggestionsReturnToRecentTabView* returnToRecentTabTile = + [[ContentSuggestionsReturnToRecentTabView alloc] + initWithConfiguration:self.returnToRecentItem]; + self.returnToRecentTabTapRecognizer = [[UITapGestureRecognizer alloc] + initWithTarget:self.tapTarget + action:@selector(contentSuggestionsElementTapped:)]; + [returnToRecentTabTile + addGestureRecognizer:self.returnToRecentTabTapRecognizer]; + self.returnToRecentTabTapRecognizer.enabled = YES; + [cell addUIElement:returnToRecentTabTile + withCustomBottomSpacing:content_suggestions:: + kReturnToRecentTabSectionBottomMargin]; + CGFloat cardWidth = content_suggestions::searchFieldWidth( + cell.bounds.size.width, cell.traitCollection); + [NSLayoutConstraint activateConstraints:@[ + [returnToRecentTabTile.widthAnchor constraintEqualToConstant:cardWidth], + [returnToRecentTabTile.heightAnchor + constraintEqualToConstant:kReturnToRecentTabSize.height] + ]]; + } + if (self.whatsNewItem) { + ContentSuggestionsWhatsNewView* whatsNewView = + [[ContentSuggestionsWhatsNewView alloc] + initWithConfiguration:self.whatsNewItem]; + self.promoTapRecognizer = [[UITapGestureRecognizer alloc] + initWithTarget:self.tapTarget + action:@selector(contentSuggestionsElementTapped:)]; + [whatsNewView addGestureRecognizer:self.promoTapRecognizer]; + self.promoTapRecognizer.enabled = YES; + [cell addUIElement:whatsNewView withCustomBottomSpacing:0]; + CGFloat width = + MostVisitedTilesContentHorizontalSpace(cell.traitCollection); + CGSize size = + MostVisitedCellSize(cell.traitCollection.preferredContentSizeCategory); + [NSLayoutConstraint activateConstraints:@[ + [whatsNewView.widthAnchor constraintEqualToConstant:width], + [whatsNewView.heightAnchor constraintEqualToConstant:size.height] + ]]; + } + if (self.mostVisitedItems) { + UIStackView* stackView = [[UIStackView alloc] init]; + stackView.axis = UILayoutConstraintAxisHorizontal; + stackView.alignment = UIStackViewAlignmentTop; + stackView.distribution = UIStackViewDistributionFillEqually; + stackView.spacing = horizontalSpacing; + for (ContentSuggestionsMostVisitedItem* item in self.mostVisitedItems) { + ContentSuggestionsMostVisitedTileView* view = + [[ContentSuggestionsMostVisitedTileView alloc] + initWithConfiguration:item]; + UITapGestureRecognizer* tapRecognizer = [[UITapGestureRecognizer alloc] + initWithTarget:self.tapTarget + action:@selector(contentSuggestionsElementTapped:)]; + [view addGestureRecognizer:tapRecognizer]; + [self.mostVisitedTapRecognizers addObject:tapRecognizer]; + // TODO(crbug.com/1285378): Add custom accsissibility actions and context + // menu configuration. + [stackView addArrangedSubview:view]; + } + [cell addUIElement:stackView + withCustomBottomSpacing:kMostVisitedBottomMargin]; + CGFloat width = + MostVisitedTilesContentHorizontalSpace(cell.traitCollection); + CGSize size = + MostVisitedCellSize(cell.traitCollection.preferredContentSizeCategory); + [NSLayoutConstraint activateConstraints:@[ + [stackView.widthAnchor constraintEqualToConstant:width], + [stackView.heightAnchor constraintEqualToConstant:size.height] + ]]; + } + if (self.shortcutsItems) { + UIStackView* stackView = [[UIStackView alloc] init]; + stackView.axis = UILayoutConstraintAxisHorizontal; + stackView.alignment = UIStackViewAlignmentTop; + stackView.distribution = UIStackViewDistributionFillEqually; + stackView.spacing = horizontalSpacing; + for (ContentSuggestionsMostVisitedActionItem* item in self.shortcutsItems) { + ContentSuggestionsShortcutTileView* view = + [[ContentSuggestionsShortcutTileView alloc] + initWithConfiguration:item]; + UITapGestureRecognizer* tapRecognizer = [[UITapGestureRecognizer alloc] + initWithTarget:self.tapTarget + action:@selector(contentSuggestionsElementTapped:)]; + [view addGestureRecognizer:tapRecognizer]; + [self.mostVisitedTapRecognizers addObject:tapRecognizer]; + [stackView addArrangedSubview:view]; + } + + [cell addUIElement:stackView + withCustomBottomSpacing:kMostVisitedBottomMargin]; + CGFloat width = + MostVisitedTilesContentHorizontalSpace(cell.traitCollection); + CGSize size = + MostVisitedCellSize(cell.traitCollection.preferredContentSizeCategory); + [NSLayoutConstraint activateConstraints:@[ + [stackView.widthAnchor constraintEqualToConstant:width], + [stackView.heightAnchor constraintEqualToConstant:size.height] + ]]; + } +} + +// Returns the default height of the content subviews and the spacing in between +// them. +- (CGFloat)cellHeightForWidth:(CGFloat)width { + CGFloat height = 0; + if (self.mostVisitedItems) { + height += MostVisitedCellSize( + UIApplication.sharedApplication.preferredContentSizeCategory) + .height + + kMostVisitedBottomMargin; + } + if (self.shortcutsItems) { + height += MostVisitedCellSize( + UIApplication.sharedApplication.preferredContentSizeCategory) + .height + + kMostVisitedBottomMargin; + } + if (self.returnToRecentItem) { + height += (kReturnToRecentTabSize.height + + content_suggestions::kReturnToRecentTabSectionBottomMargin); + } + if (self.whatsNewItem) { + height += MostVisitedCellSize( + UIApplication.sharedApplication.preferredContentSizeCategory) + .height; + } + return height; +} + +@end + +#pragma mark - ContentSuggestionsParentCell + +@interface ContentSuggestionsParentCell () + +// StackView holding all subviews. +@property(nonatomic, strong) UIStackView* verticalStackView; + +@end + +@implementation ContentSuggestionsParentCell + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + _verticalStackView = [[UIStackView alloc] init]; + _verticalStackView.translatesAutoresizingMaskIntoConstraints = NO; + _verticalStackView.axis = UILayoutConstraintAxisVertical; + // A centered alignment will ensure the views are centered. + _verticalStackView.alignment = UIStackViewAlignmentCenter; + // A fill distribution allows for the custom spacing between elements and + // height/width configurations for each row. + _verticalStackView.distribution = UIStackViewDistributionFill; + [self.contentView addSubview:_verticalStackView]; + AddSameConstraints(self.contentView, _verticalStackView); + } + return self; +} + +- (void)addUIElement:(UIView*)view withCustomBottomSpacing:(CGFloat)spacing { + [_verticalStackView addArrangedSubview:view]; + if (spacing > 0) { + [_verticalStackView setCustomSpacing:spacing afterView:view]; + } +} + +- (void)prepareForReuse { + [super prepareForReuse]; + for (UIView* view in [self.verticalStackView arrangedSubviews]) { + [view removeFromSuperview]; + } +} + +@end
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.mm index dc86e98..5a8fbf7 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_gesture_commands.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_view.h" #import "ios/chrome/common/ui/util/constraints_ui_util.h" @@ -12,10 +13,6 @@ #error "This file requires ARC support." #endif -namespace { -const CGSize regularCellSize = {/*width=*/343, /*height=*/72}; -} - @implementation ContentSuggestionsReturnToRecentTabItem @synthesize metricsRecorded; @synthesize suggestionIdentifier; @@ -39,7 +36,7 @@ } - (CGFloat)cellHeightForWidth:(CGFloat)width { - return [ContentSuggestionsReturnToRecentTabCell defaultSize].height; + return kReturnToRecentTabSize.height; } @end @@ -78,7 +75,7 @@ } + (CGSize)defaultSize { - return regularCellSize; + return kReturnToRecentTabSize; } - (void)setIconImage:(UIImage*)image {
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_selection_actions.h b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_selection_actions.h new file mode 100644 index 0000000..1bb23bba --- /dev/null +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_selection_actions.h
@@ -0,0 +1,17 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_SELECTION_ACTIONS_H_ +#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_SELECTION_ACTIONS_H_ + +// Protocol notifying the receiver of user tap actions to the Content +// Suggestions content. +@protocol ContentSuggestionsSelectionActions + +// Indicates to the receiver that a Content Suggestion element was tapped. +- (void)contentSuggestionsElementTapped:(UIGestureRecognizer*)sender; + +@end + +#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_SELECTION_ACTIONS_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.h b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.h index 0a27a4a..08d68d5 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.h +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.h
@@ -34,4 +34,8 @@ CGFloat CenteredTilesMarginForWidth(UITraitCollection* trait_collection, CGFloat width); +// Returns horizontal space needed to show the Most Visited tiles. +CGFloat MostVisitedTilesContentHorizontalSpace( + UITraitCollection* trait_collection); + #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CELLS_CONTENT_SUGGESTIONS_TILE_LAYOUT_UTIL_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.mm index 18b8edc..b4e5f7f 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.mm
@@ -65,3 +65,15 @@ NOTREACHED(); return 0; } + +CGFloat MostVisitedTilesContentHorizontalSpace( + UITraitCollection* trait_collection) { + CGFloat horizontalSpace = + ContentSuggestionsTilesHorizontalSpacing(trait_collection); + CGSize cellSize = + MostVisitedCellSize(trait_collection.preferredContentSizeCategory); + // Sum up the space taken up by all the tiles and space between them. + CGFloat width = (kMaxNumberOfTilesPerRow * cellSize.width) + + ((kMaxNumberOfTilesPerRow - 1) * horizontalSpace); + return width; +}
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item.mm index 1d02501b..34917fa 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item.mm
@@ -7,6 +7,7 @@ #import <MaterialComponents/MaterialTypography.h> #include "base/check_op.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" #include "ios/chrome/common/string_util.h" @@ -55,7 +56,7 @@ } + (NSString*)accessibilityIdentifier { - return @"ContentSuggestionsWhatsNewIdentifier"; + return kContentSuggestionsWhatsNewIdentifier; } @end
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.h b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.h index 353c844..332d58f 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.h +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.h
@@ -7,9 +7,16 @@ #import <UIKit/UIKit.h> +@class ContentSuggestionsWhatsNewItem; + // View for Notification Promo. @interface ContentSuggestionsWhatsNewView : UIView +// Initializes and configures the view with |config|. +// TODO(crbug.com/1285378): Make this designated initializer after feature +// launch. +- (instancetype)initWithConfiguration:(ContentSuggestionsWhatsNewItem*)config; + // Image displaying the favicon. @property(nonatomic, strong) UIImageView* iconView;
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.mm index 1ca64095..05ad6eb 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.mm
@@ -4,13 +4,19 @@ #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.h" -#import <MaterialComponents/MaterialCollectionCells.h> +#import <MaterialComponents/MaterialTypography.h> +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item.h" +#include "ios/chrome/common/string_util.h" +#import "ios/chrome/common/ui/colors/semantic_color_names.h" #import "ios/chrome/common/ui/util/constraints_ui_util.h" namespace { const CGFloat kLabelMargin = 14; +const CGFloat kLabelLineSpacing = 4; const CGFloat kLabelIconMargin = 8; +const CGFloat kLabelFontSize = 14; const CGFloat kIconSize = 24; const CGFloat kIconTopMargin = 10; } // namespace @@ -66,4 +72,42 @@ } return self; } + +- (instancetype)initWithConfiguration:(ContentSuggestionsWhatsNewItem*)config { + self = [self initWithFrame:CGRectZero]; + if (self) { + [_iconView setImage:config.icon]; + [self configureLabelWithText:config.text]; + self.accessibilityIdentifier = kContentSuggestionsWhatsNewIdentifier; + } + return self; +} + +// Configures |promoLabel| with |text|. +- (void)configureLabelWithText:(NSString*)text { + _promoLabel.font = + [[MDCTypography fontLoader] regularFontOfSize:kLabelFontSize]; + _promoLabel.textColor = [UIColor colorNamed:kTextPrimaryColor]; + _promoLabel.numberOfLines = 0; + + // Sets the line spacing on the attributed string. + NSMutableParagraphStyle* style = [[NSMutableParagraphStyle alloc] init]; + [style setLineSpacing:kLabelLineSpacing]; + NSDictionary* textAttributes = @{ + NSParagraphStyleAttributeName : style, + }; + + // Sets the styling to mimic a link. + NSDictionary* linkAttributes = @{ + NSForegroundColorAttributeName : [UIColor colorNamed:kBlueColor], + NSUnderlineStyleAttributeName : @(NSUnderlineStyleSingle), + NSUnderlineColorAttributeName : [UIColor colorNamed:kBlueColor], + }; + + NSAttributedString* attributedText = + AttributedStringFromStringWithLink(text, textAttributes, linkAttributes); + + [_promoLabel setAttributedText:attributedText]; +} + @end
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.h index 4c81c42..0e5f61f 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.h +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.h
@@ -5,7 +5,7 @@ #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_CONSTANTS_H_ #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_CONSTANTS_H_ -#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> // Represents the content suggestions collection view. extern NSString* const kContentSuggestionsCollectionIdentifier; @@ -17,4 +17,7 @@ extern NSString* const kContentSuggestionsMostVisitedAccessibilityIdentifierPrefix; +// The bottom margin below the Most Visited section. +extern const CGFloat kMostVisitedBottomMargin; + #endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_CONSTANTS_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.mm index 3eaf4d6..27839fa 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.mm
@@ -15,3 +15,5 @@ NSString* const kContentSuggestionsMostVisitedAccessibilityIdentifierPrefix = @"contentSuggestionsMostVisitedAccessibilityIdentifierPrefix"; + +const CGFloat kMostVisitedBottomMargin = 13;
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm index 490ffb2..daf639ca 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm
@@ -22,6 +22,7 @@ #import "ios/chrome/browser/pref_names.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_action_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_parent_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/suggested_content.h" @@ -98,12 +99,17 @@ // Item for the "Return to Recent Tab" tile. @property(nonatomic, strong) ContentSuggestionsReturnToRecentTabItem* returnToRecentTabItem; +// Parent Item for single cell layout. +@property(nonatomic, strong) ContentSuggestionsParentItem* parentItem; // Section Info for the What's New promo section. @property(nonatomic, strong) ContentSuggestionsSectionInformation* promoSectionInfo; // Section Info for the Most Visited section. @property(nonatomic, strong) ContentSuggestionsSectionInformation* mostVisitedSectionInfo; +// Section Info for the single cell parent item section. +@property(nonatomic, strong) + ContentSuggestionsSectionInformation* singleCellSectionInfo; // Whether the page impression has been recorded. @property(nonatomic, assign) BOOL recordedPageImpression; // Map the section information created to the relevant category. @@ -154,8 +160,12 @@ largeIconCache:largeIconCache]; _logoSectionInfo = LogoSectionInformation(); - _promoSectionInfo = PromoSectionInformation(); - _mostVisitedSectionInfo = MostVisitedSectionInformation(); + if (IsSingleCellContentSuggestionsEnabled()) { + _singleCellSectionInfo = SingleCellSectionInformation(); + } else { + _promoSectionInfo = PromoSectionInformation(); + _mostVisitedSectionInfo = MostVisitedSectionInformation(); + } _notificationPromo = std::make_unique<NotificationPromoWhatsNew>( GetApplicationContext()->GetLocalState()); @@ -274,7 +284,12 @@ - (void)mostRecentTabFaviconUpdatedWithImage:(UIImage*)image { if (self.returnToRecentTabItem) { self.returnToRecentTabItem.icon = image; - [self.consumer itemHasChanged:self.returnToRecentTabItem]; + if (IsSingleCellContentSuggestionsEnabled()) { + self.parentItem.returnToRecentItem = self.returnToRecentTabItem; + [self.consumer itemHasChanged:self.parentItem]; + } else { + [self.consumer itemHasChanged:self.returnToRecentTabItem]; + } } } @@ -354,16 +369,20 @@ [sectionsInfo addObject:self.logoSectionInfo]; - if (self.showMostRecentTabStartSurfaceTile) { - DCHECK(IsStartSurfaceEnabled()); - [sectionsInfo addObject:self.returnToRecentTabSectionInfo]; - } + if (IsSingleCellContentSuggestionsEnabled()) { + [sectionsInfo addObject:self.singleCellSectionInfo]; + } else { + if (self.showMostRecentTabStartSurfaceTile) { + DCHECK(IsStartSurfaceEnabled()); + [sectionsInfo addObject:self.returnToRecentTabSectionInfo]; + } - if (_notificationPromo->CanShow()) { - [sectionsInfo addObject:self.promoSectionInfo]; - } + if (_notificationPromo->CanShow()) { + [sectionsInfo addObject:self.promoSectionInfo]; + } - [sectionsInfo addObject:self.mostVisitedSectionInfo]; + [sectionsInfo addObject:self.mostVisitedSectionInfo]; + } return sectionsInfo; } @@ -391,6 +410,23 @@ if (!ShouldHideShortcutsForStartSurface()) { [convertedSuggestions addObjectsFromArray:self.actionButtonItems]; } + } else if (sectionInfo == self.singleCellSectionInfo) { + self.parentItem = [[ContentSuggestionsParentItem alloc] initWithType:0]; + if (_notificationPromo->CanShow()) { + ContentSuggestionsWhatsNewItem* item = + [[ContentSuggestionsWhatsNewItem alloc] initWithType:0]; + item.icon = _notificationPromo->GetIcon(); + item.text = base::SysUTF8ToNSString(_notificationPromo->promo_text()); + self.parentItem.whatsNewItem = item; + } + if (self.showMostRecentTabStartSurfaceTile) { + self.parentItem.returnToRecentItem = self.returnToRecentTabItem; + } + self.parentItem.mostVisitedItems = self.mostVisitedItems; + if (!ShouldHideShortcutsForStartSurface()) { + self.parentItem.shortcutsItems = self.actionButtonItems; + } + [convertedSuggestions addObject:self.parentItem]; } return convertedSuggestions;
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h index 942a26a6..89530b61 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h
@@ -34,6 +34,7 @@ ItemTypeMostVisited, ItemTypePromo, ItemTypeReturnToRecentTab, + ItemTypeSingleCell, ItemTypeUnknown, }; @@ -44,6 +45,7 @@ SectionIdentifierLogo, SectionIdentifierReturnToRecentTab, SectionIdentifierPromo, + SectionIdentifierSingleCell, SectionIdentifierDefault, };
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm index 79eeb77e..d43b3b9 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -14,12 +14,19 @@ #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_header_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_cell.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_tile_view.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_parent_item.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_return_to_recent_tab_view.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_selection_actions.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_shortcut_tile_view.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_text_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_tile_layout_util.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_view.h" #import "ios/chrome/browser/ui/content_suggestions/cells/suggested_content.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_utils.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.h" +#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_header_controlling.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_header_synchronizing.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_layout.h" @@ -43,11 +50,12 @@ #endif namespace { -const CGFloat kMostVisitedBottomMargin = 13; const CGFloat kCardBorderRadius = 11; } // namespace -@interface ContentSuggestionsViewController () <UIGestureRecognizerDelegate> +@interface ContentSuggestionsViewController () < + UIGestureRecognizerDelegate, + ContentSuggestionsSelectionActions> // The layout of the content suggestions collection view. @property(nonatomic, strong) ContentSuggestionsLayout* layout; @@ -227,7 +235,7 @@ UIEdgeInsets parentInset = [super collectionView:collectionView layout:collectionViewLayout insetForSectionAtIndex:section]; - if ([self isHeaderSection:section]) { + if ([self isHeaderSection:section] || [self isSingleCellSection:section]) { parentInset.top = 0; parentInset.left = 0; parentInset.right = 0; @@ -351,6 +359,14 @@ // collection. [self addSectionsForSectionInfoToModel:sections withItems:items]; for (ContentSuggestionsSectionInformation* sectionInfo in sections) { + if (sectionInfo.sectionID == ContentSuggestionsSectionSingleCell) { + DCHECK(IsSingleCellContentSuggestionsEnabled()); + DCHECK_EQ(1.0, [items[@(sectionInfo.sectionID)] count]); + ContentSuggestionsParentItem* item = + static_cast<ContentSuggestionsParentItem*>( + items[@(sectionInfo.sectionID)][0]); + item.tapTarget = self; + } [self addSuggestionsToModel:items[@(sectionInfo.sectionID)] withSectionInfo:sectionInfo]; } @@ -402,6 +418,11 @@ if (![self.collectionViewModel hasItem:item]) { return; } + if (IsSingleCellContentSuggestionsEnabled()) { + ContentSuggestionsParentItem* parentItem = + static_cast<ContentSuggestionsParentItem*>(item); + parentItem.tapTarget = self; + } [self reconfigureCellsForItems:@[ item ]]; } @@ -434,6 +455,21 @@ return YES; } +#pragma mark - ContentSuggestionsSelectionActions + +- (void)contentSuggestionsElementTapped:(UIGestureRecognizer*)sender { + if ([sender.view + isKindOfClass:[ContentSuggestionsMostVisitedTileView class]]) { + // TODO(crbug.com/1285378): Call command. + } else if ([sender.view isKindOfClass:[ContentSuggestionsReturnToRecentTabView + class]]) { + // TODO(crbug.com/1285378): Call command. + } else if ([sender.view + isKindOfClass:[ContentSuggestionsWhatsNewView class]]) { + // TODO(crbug.com/1285378): Call command. + } +} + #pragma mark - Private // Checks if the |section| is empty and add an empty element if it is the case. @@ -472,6 +508,8 @@ return ItemTypeMostVisited; case ContentSuggestionsSectionPromo: return ItemTypePromo; + case ContentSuggestionsSectionSingleCell: + return ItemTypeSingleCell; case ContentSuggestionsSectionLogo: case ContentSuggestionsSectionUnknown: return ItemTypeUnknown; @@ -490,6 +528,8 @@ return SectionIdentifierReturnToRecentTab; case ContentSuggestionsSectionPromo: return SectionIdentifierPromo; + case ContentSuggestionsSectionSingleCell: + return SectionIdentifierSingleCell; case ContentSuggestionsSectionUnknown: return SectionIdentifierDefault; } @@ -628,6 +668,11 @@ SectionIdentifierPromo; } +- (BOOL)isSingleCellSection:(NSInteger)section { + return [self.collectionViewModel sectionIdentifierForSection:section] == + SectionIdentifierSingleCell; +} + // Adds the header for the first section, containing the logo and the omnibox, // if there is no header for the section. - (void)addLogoHeaderIfNeeded {
diff --git a/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h index d706ab9..94e7469 100644 --- a/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h +++ b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h
@@ -22,6 +22,7 @@ ContentSuggestionsSectionReturnToRecentTab, ContentSuggestionsSectionPromo, ContentSuggestionsSectionMostVisited, + ContentSuggestionsSectionSingleCell, // Do not use this. It will trigger a DCHECK. // Do not add value after this one.
diff --git a/ios/chrome/browser/ui/content_suggestions/mediator_util.h b/ios/chrome/browser/ui/content_suggestions/mediator_util.h index 8650bfd..a3e5176f 100644 --- a/ios/chrome/browser/ui/content_suggestions/mediator_util.h +++ b/ios/chrome/browser/ui/content_suggestions/mediator_util.h
@@ -27,6 +27,9 @@ // Creates and returns a SectionInfo for the Most Visited section. ContentSuggestionsSectionInformation* MostVisitedSectionInformation(); +// Creates and returns a SectionInfo for the single cell parent item. +ContentSuggestionsSectionInformation* SingleCellSectionInformation(); + // Converts a ntp_tiles::NTPTile |tile| to a ContentSuggestionsMostVisitedItem // with a |sectionInfo|. ContentSuggestionsMostVisitedItem* ConvertNTPTile(
diff --git a/ios/chrome/browser/ui/content_suggestions/mediator_util.mm b/ios/chrome/browser/ui/content_suggestions/mediator_util.mm index db269a16..211c23bb 100644 --- a/ios/chrome/browser/ui/content_suggestions/mediator_util.mm +++ b/ios/chrome/browser/ui/content_suggestions/mediator_util.mm
@@ -58,6 +58,10 @@ return EmptySectionInfo(ContentSuggestionsSectionMostVisited); } +ContentSuggestionsSectionInformation* SingleCellSectionInformation() { + return EmptySectionInfo(ContentSuggestionsSectionSingleCell); +} + ContentSuggestionsMostVisitedItem* ConvertNTPTile( const ntp_tiles::NTPTile& tile, ContentSuggestionsSectionInformation* sectionInfo) {
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 79ea06e..1eda4101 100644 --- a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm +++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
@@ -10,6 +10,7 @@ #include "components/strings/grit/components_strings.h" #include "ios/chrome/browser/chrome_switches.h" #import "ios/chrome/browser/pref_names.h" +#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cells_constants.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h" #import "ios/chrome/browser/ui/content_suggestions/new_tab_page_app_interface.h" @@ -442,13 +443,13 @@ // Tap the promo. [[EarlGrey selectElementWithMatcher:grey_accessibilityID( - @"ContentSuggestionsWhatsNewIdentifier")] + kContentSuggestionsWhatsNewIdentifier)] performAction:grey_tap()]; // Promo dismissed. [[EarlGrey selectElementWithMatcher:grey_accessibilityID( - @"ContentSuggestionsWhatsNewIdentifier")] + kContentSuggestionsWhatsNewIdentifier)] assertWithMatcher:grey_not(grey_sufficientlyVisible())]; [NewTabPageAppInterface resetWhatsNewPromo];
diff --git a/media/base/video_util.cc b/media/base/video_util.cc index 0ea27bc..bc1a496 100644 --- a/media/base/video_util.cc +++ b/media/base/video_util.cc
@@ -217,6 +217,87 @@ return true; } +void LetterboxPlane(const gfx::Rect& view_area_in_bytes, + uint8_t* ptr, + int rows, + int row_bytes, + int stride, + int bytes_per_element, + uint8_t fill_byte) { + if (view_area_in_bytes.IsEmpty()) { + libyuv::SetPlane(ptr, stride, row_bytes, rows, fill_byte); + return; + } + + if (view_area_in_bytes.y() > 0) { + libyuv::SetPlane(ptr, stride, row_bytes, view_area_in_bytes.y(), fill_byte); + ptr += stride * view_area_in_bytes.y(); + } + + if (view_area_in_bytes.width() < row_bytes) { + if (view_area_in_bytes.x() > 0) { + libyuv::SetPlane(ptr, stride, view_area_in_bytes.x(), + view_area_in_bytes.height(), fill_byte); + } + if (view_area_in_bytes.right() < row_bytes) { + libyuv::SetPlane(ptr + view_area_in_bytes.right(), stride, + row_bytes - view_area_in_bytes.right(), + view_area_in_bytes.height(), fill_byte); + } + } + + ptr += stride * view_area_in_bytes.height(); + + if (view_area_in_bytes.bottom() < rows) { + libyuv::SetPlane(ptr, stride, row_bytes, rows - view_area_in_bytes.bottom(), + fill_byte); + } +} + +void LetterboxPlane(VideoFrame* frame, + int plane, + uint8_t* ptr, + const gfx::Rect& view_area_in_pixels, + uint8_t fill_byte) { + const int rows = frame->rows(plane); + const int row_bytes = frame->row_bytes(plane); + const int stride = frame->stride(plane); + const int bytes_per_element = + VideoFrame::BytesPerElement(frame->format(), plane); + + gfx::Rect view_area_in_bytes(view_area_in_pixels.x() * bytes_per_element, + view_area_in_pixels.y(), + view_area_in_pixels.width() * bytes_per_element, + view_area_in_pixels.height()); + + CHECK_GE(stride, row_bytes); + CHECK_GE(view_area_in_bytes.x(), 0); + CHECK_GE(view_area_in_bytes.y(), 0); + CHECK_LE(view_area_in_bytes.right(), row_bytes); + CHECK_LE(view_area_in_bytes.bottom(), rows); + + LetterboxPlane(view_area_in_bytes, ptr, rows, row_bytes, stride, + bytes_per_element, fill_byte); +} + +// Helper for `LetterboxVideoFrame()`, assumes that if |frame| is GMB-backed, +// the GpuMemoryBuffer is already mapped (via a call to `Map()`). +void LetterboxPlane(VideoFrame* frame, + int plane, + const gfx::Rect& view_area_in_pixels, + uint8_t fill_byte) { + uint8_t* ptr = nullptr; + if (frame->IsMappable()) { + ptr = frame->data(plane); + } else if (frame->HasGpuMemoryBuffer()) { + ptr = static_cast<uint8_t*>(frame->GetGpuMemoryBuffer()->memory(plane)); + } + + DCHECK(ptr); + + LetterboxPlane(frame, plane, ptr, view_area_in_pixels, fill_byte); +} + } // namespace void FillYUV(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v) { @@ -238,57 +319,13 @@ frame->rows(VideoFrame::kAPlane), a); } -static void LetterboxPlane(VideoFrame* frame, - int plane, - const gfx::Rect& view_area_in_pixels, - uint8_t fill_byte) { - uint8_t* ptr = frame->data(plane); - const int rows = frame->rows(plane); - const int row_bytes = frame->row_bytes(plane); - const int stride = frame->stride(plane); - const int bytes_per_element = - VideoFrame::BytesPerElement(frame->format(), plane); - gfx::Rect view_area(view_area_in_pixels.x() * bytes_per_element, - view_area_in_pixels.y(), - view_area_in_pixels.width() * bytes_per_element, - view_area_in_pixels.height()); - - CHECK_GE(stride, row_bytes); - CHECK_GE(view_area.x(), 0); - CHECK_GE(view_area.y(), 0); - CHECK_LE(view_area.right(), row_bytes); - CHECK_LE(view_area.bottom(), rows); - - if (view_area.IsEmpty()) { - libyuv::SetPlane(ptr, stride, row_bytes, rows, fill_byte); - return; - } - - if (view_area.y() > 0) { - libyuv::SetPlane(ptr, stride, row_bytes, view_area.y(), fill_byte); - ptr += stride * view_area.y(); - } - - if (view_area.width() < row_bytes) { - if (view_area.x() > 0) { - libyuv::SetPlane(ptr, stride, view_area.x(), view_area.height(), - fill_byte); - } - if (view_area.right() < row_bytes) { - libyuv::SetPlane(ptr + view_area.right(), stride, - row_bytes - view_area.right(), view_area.height(), - fill_byte); - } - } - ptr += stride * view_area.height(); - - if (view_area.bottom() < rows) { - libyuv::SetPlane(ptr, stride, row_bytes, rows - view_area.bottom(), - fill_byte); - } -} - void LetterboxVideoFrame(VideoFrame* frame, const gfx::Rect& view_area) { + bool gmb_mapped = false; + if (!frame->IsMappable() && frame->HasGpuMemoryBuffer()) { + gmb_mapped = frame->GetGpuMemoryBuffer()->Map(); + DCHECK(gmb_mapped); + } + switch (frame->format()) { case PIXEL_FORMAT_ARGB: LetterboxPlane(frame, VideoFrame::kARGBPlane, view_area, 0x00); @@ -299,6 +336,7 @@ DCHECK(!(view_area.y() & 1)); DCHECK(!(view_area.width() & 1)); DCHECK(!(view_area.height() & 1)); + LetterboxPlane(frame, VideoFrame::kYPlane, view_area, 0x00); gfx::Rect half_view_area(view_area.x() / 2, view_area.y() / 2, view_area.width() / 2, view_area.height() / 2); @@ -306,9 +344,26 @@ LetterboxPlane(frame, VideoFrame::kVPlane, half_view_area, 0x80); break; } + case PIXEL_FORMAT_NV12: { + DCHECK(!(view_area.x() & 1)); + DCHECK(!(view_area.y() & 1)); + DCHECK(!(view_area.width() & 1)); + DCHECK(!(view_area.height() & 1)); + + LetterboxPlane(frame, VideoFrame::kYPlane, view_area, 0x00); + gfx::Rect half_view_area(view_area.x() / 2, view_area.y() / 2, + view_area.width() / 2, view_area.height() / 2); + + LetterboxPlane(frame, VideoFrame::kUVPlane, half_view_area, 0x80); + break; + } default: NOTREACHED(); } + + if (gmb_mapped) { + frame->GetGpuMemoryBuffer()->Unmap(); + } } void RotatePlaneByPixels(const uint8_t* src,
diff --git a/net/BUILD.gn b/net/BUILD.gn index ddc88aa5..8caf642 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -6,8 +6,8 @@ import("//build/config/chromecast_build.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/compiler/compiler.gni") -import("//build/config/crypto.gni") import("//build/config/features.gni") +import("//crypto/features.gni") import("//net/features.gni") import("//testing/libfuzzer/fuzzer_test.gni") import("//testing/test.gni")
diff --git a/net/base/network_delegate.cc b/net/base/network_delegate.cc index bd7e5df..68e05fc7 100644 --- a/net/base/network_delegate.cc +++ b/net/base/network_delegate.cc
@@ -107,7 +107,6 @@ net::CookieAccessResultList& excluded_cookies, bool allowed_from_caller) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK_EQ(PrivacyMode::PRIVACY_MODE_DISABLED, request.privacy_mode()); bool allowed = OnAnnotateAndMoveUserBlockedCookies( request, maybe_included_cookies, excluded_cookies, allowed_from_caller); cookie_util::DCheckIncludedAndExcludedCookieLists(maybe_included_cookies,
diff --git a/net/cert/cert_verify_proc.cc b/net/cert/cert_verify_proc.cc index 6d2d9e37..05c22dc9 100644 --- a/net/cert/cert_verify_proc.cc +++ b/net/cert/cert_verify_proc.cc
@@ -17,6 +17,7 @@ #include "base/threading/scoped_blocking_call.h" #include "base/time/time.h" #include "build/build_config.h" +#include "crypto/crypto_buildflags.h" #include "crypto/sha2.h" #include "net/base/features.h" #include "net/base/net_errors.h" @@ -48,7 +49,7 @@ #include "third_party/boringssl/src/include/openssl/pool.h" #include "url/url_canon.h" -#if BUILDFLAG(IS_FUCHSIA) || defined(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) #include "net/cert/cert_verify_proc_builtin.h" #endif @@ -487,7 +488,7 @@ } #endif -#if BUILDFLAG(IS_FUCHSIA) || defined(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) // static scoped_refptr<CertVerifyProc> CertVerifyProc::CreateBuiltinVerifyProc( scoped_refptr<CertNetFetcher> cert_net_fetcher) {
diff --git a/net/cert/cert_verify_proc.h b/net/cert/cert_verify_proc.h index c57260f1..29dfe2f 100644 --- a/net/cert/cert_verify_proc.h +++ b/net/cert/cert_verify_proc.h
@@ -12,6 +12,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "build/build_config.h" +#include "crypto/crypto_buildflags.h" #include "net/base/hash_value.h" #include "net/base/net_export.h" @@ -72,7 +73,7 @@ scoped_refptr<CertNetFetcher> cert_net_fetcher); #endif -#if BUILDFLAG(IS_FUCHSIA) || defined(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(USE_NSS_CERTS) || BUILDFLAG(IS_MAC) // Creates and returns a CertVerifyProcBuiltin using the SSL SystemTrustStore. static scoped_refptr<CertVerifyProc> CreateBuiltinVerifyProc( scoped_refptr<CertNetFetcher> cert_net_fetcher);
diff --git a/net/cert/ev_root_ca_metadata.h b/net/cert/ev_root_ca_metadata.h index 6c356f2..9ce78dcb 100644 --- a/net/cert/ev_root_ca_metadata.h +++ b/net/cert/ev_root_ca_metadata.h
@@ -12,10 +12,11 @@ #include <string> #include <vector> +#include "crypto/crypto_buildflags.h" #include "net/base/net_export.h" #include "net/cert/x509_certificate.h" -#if defined(USE_NSS_CERTS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || \ +#if BUILDFLAG(USE_NSS_CERTS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || \ BUILDFLAG(IS_FUCHSIA) // When not defined, the EVRootCAMetadata singleton is a dumb placeholder // implementation that will fail all EV lookup operations.
diff --git a/net/cert/internal/system_trust_store.cc b/net/cert/internal/system_trust_store.cc index 85e92181..3ae4f80 100644 --- a/net/cert/internal/system_trust_store.cc +++ b/net/cert/internal/system_trust_store.cc
@@ -5,13 +5,14 @@ #include "net/cert/internal/system_trust_store.h" #include "build/build_config.h" +#include "crypto/crypto_buildflags.h" #include "net/net_buildflags.h" -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "net/cert/internal/system_trust_store_nss.h" -#endif // defined(USE_NSS_CERTS) +#endif // BUILDFLAG(USE_NSS_CERTS) -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include <cert.h> #include <pk11pub.h> #elif BUILDFLAG(IS_MAC) @@ -34,7 +35,7 @@ #include "net/cert/x509_certificate.h" #include "net/cert/x509_util.h" -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "crypto/nss_util.h" #include "net/cert/internal/trust_store_nss.h" #include "net/cert/known_roots_nss.h" @@ -102,7 +103,7 @@ }; #endif // CHROME_ROOT_STORE_SUPPORTED -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) namespace { class SystemTrustStoreNSS : public SystemTrustStore {
diff --git a/net/cert/multi_threaded_cert_verifier.cc b/net/cert/multi_threaded_cert_verifier.cc index bb7275e..1d1b3d8e 100644 --- a/net/cert/multi_threaded_cert_verifier.cc +++ b/net/cert/multi_threaded_cert_verifier.cc
@@ -13,6 +13,7 @@ #include "base/task/thread_pool.h" #include "base/threading/thread_restrictions.h" #include "base/trace_event/trace_event.h" +#include "crypto/crypto_buildflags.h" #include "net/base/net_errors.h" #include "net/base/trace_constants.h" #include "net/cert/cert_verify_proc.h" @@ -23,7 +24,7 @@ #include "net/log/net_log_source_type.h" #include "net/log/net_log_with_source.h" -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "net/cert/x509_util_nss.h" #endif @@ -243,7 +244,7 @@ // TODO(https://crbug.com/978854): Pass these into the actual CertVerifyProc // rather than relying on global side-effects. -#if !defined(USE_NSS_CERTS) +#if !BUILDFLAG(USE_NSS_CERTS) // Not yet implemented. DCHECK(config.additional_untrusted_authorities.empty()); #else
diff --git a/net/cert/multi_threaded_cert_verifier.h b/net/cert/multi_threaded_cert_verifier.h index 92ca12e..0f1c537 100644 --- a/net/cert/multi_threaded_cert_verifier.h +++ b/net/cert/multi_threaded_cert_verifier.h
@@ -14,10 +14,11 @@ #include "base/containers/linked_list.h" #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" +#include "crypto/crypto_buildflags.h" #include "net/base/net_export.h" #include "net/cert/cert_verifier.h" -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "net/cert/scoped_nss_types.h" #endif @@ -59,7 +60,7 @@ // don't call them later, as required by the CertVerifier contract. base::LinkedList<InternalRequest> request_list_; -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) // Holds NSS temporary certificates that will be exposed as untrusted // authorities by SystemCertStoreNSS. // TODO(https://crbug.com/978854): Pass these into the actual CertVerifyProc
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index 354a31b..4e4cd17 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc
@@ -140,6 +140,7 @@ } // namespace const char HttpResponseHeaders::kContentRange[] = "Content-Range"; +const char HttpResponseHeaders::kLastModified[] = "Last-Modified"; struct HttpResponseHeaders::ParsedHeader { // A header "continuation" contains only a subsequent value for the
diff --git a/net/http/http_response_headers.h b/net/http/http_response_headers.h index 312535df..469d571 100644 --- a/net/http/http_response_headers.h +++ b/net/http/http_response_headers.h
@@ -63,6 +63,7 @@ }; static const char kContentRange[]; + static const char kLastModified[]; HttpResponseHeaders() = delete;
diff --git a/net/log/net_log_event_type_list.h b/net/log/net_log_event_type_list.h index 509d788..78fd93b1 100644 --- a/net/log/net_log_event_type_list.h +++ b/net/log/net_log_event_type_list.h
@@ -888,7 +888,6 @@ // "initiator": <Initiator origin of the request, if any, or else "not an // origin">, // "load_flags": <Numeric value of the combined load flags>, -// "privacy_mode": <Privacy mode associated with the request>, // "network_isolation_key": <NIK associated with the request>, // "request_type": <Type of the request, which is "main frame", "subframe", // or "other">, @@ -4075,3 +4074,10 @@ // "source_dependency": <Source identifier for the attached event> // } EVENT_TYPE(CREATED_BY) + +// This event is logged when a URLRequestHttpJob's privacy mode is computed. It +// contains the following parameter: +// { +// "privacy_mode": <Privacy mode associated with the request>, +// } +EVENT_TYPE(COMPUTED_PRIVACY_MODE) \ No newline at end of file
diff --git a/net/test/cert_test_util.h b/net/test/cert_test_util.h index 5e9fcfee..a9e45b1 100644 --- a/net/test/cert_test_util.h +++ b/net/test/cert_test_util.h
@@ -11,11 +11,12 @@ #include "base/memory/raw_ptr.h" #include "base/memory/ref_counted.h" #include "base/strings/string_piece.h" +#include "crypto/crypto_buildflags.h" #include "net/base/hash_value.h" #include "net/cert/x509_certificate.h" #include "testing/gtest/include/gtest/gtest.h" -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) #include "net/cert/scoped_nss_types.h" // From <pk11pub.h> @@ -32,7 +33,7 @@ class EVRootCAMetadata; -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) // Imports a private key from file |key_filename| in |dir| into |slot|. The file // must contain a PKCS#8 PrivateKeyInfo in DER encoding. Returns true on success // and false on failure.
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 8a2ec5e..d5404b14 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc
@@ -588,7 +588,6 @@ RedirectInfo::FirstPartyURLPolicy::NEVER_CHANGE_URL), load_flags_(LOAD_NORMAL), allow_credentials_(true), - privacy_mode_(PRIVACY_MODE_DISABLED), secure_dns_policy_(SecureDnsPolicy::kAllow), #if BUILDFLAG(ENABLE_REPORTING) reporting_upload_depth_(0), @@ -665,12 +664,11 @@ std::unique_ptr<URLRequestJob> job, FirstPartySetMetadata first_party_set_metadata) { set_first_party_set_metadata(std::move(first_party_set_metadata)); - privacy_mode_ = DeterminePrivacyMode(); net_log_.BeginEvent(NetLogEventType::URL_REQUEST_START_JOB, [&] { return NetLogURLRequestStartParams( - url(), method_, load_flags_, privacy_mode_, isolation_info_, - site_for_cookies_, initiator_, + url(), method_, load_flags_, isolation_info_, site_for_cookies_, + initiator_, upload_data_stream_ ? upload_data_stream_->identifier() : -1); }); @@ -1013,6 +1011,11 @@ Start(); } +// static +bool URLRequest::DefaultCanUseCookies() { + return g_default_can_use_cookies; +} + const URLRequestContext* URLRequest::context() const { return context_; } @@ -1076,21 +1079,6 @@ delegate_->OnSSLCertificateError(this, net_error, ssl_info, fatal); } -void URLRequest::AnnotateAndMoveUserBlockedCookies( - CookieAccessResultList& maybe_included_cookies, - CookieAccessResultList& excluded_cookies) const { - DCHECK_EQ(privacy_mode_, PrivacyMode::PRIVACY_MODE_DISABLED); - bool can_get_cookies = g_default_can_use_cookies; - if (network_delegate()) { - can_get_cookies = network_delegate()->AnnotateAndMoveUserBlockedCookies( - *this, maybe_included_cookies, excluded_cookies, - /*allowed_from_caller=*/true); - } - - if (!can_get_cookies) - net_log_.AddEvent(NetLogEventType::COOKIE_GET_BLOCKED_BY_NETWORK_DELEGATE); -} - bool URLRequest::CanSetCookie(const net::CanonicalCookie& cookie, CookieOptions* options) const { DCHECK(!(load_flags_ & LOAD_DO_NOT_SAVE_COOKIES)); @@ -1105,30 +1093,6 @@ return can_set_cookies; } -PrivacyMode URLRequest::DeterminePrivacyMode() const { - if (!allow_credentials_) { - // |allow_credentials_| implies LOAD_DO_NOT_SAVE_COOKIES. - DCHECK(load_flags_ & LOAD_DO_NOT_SAVE_COOKIES); - - // TODO(https://crbug.com/775438): Client certs should always be - // affirmatively omitted for these requests. - return send_client_certs_ ? PRIVACY_MODE_ENABLED - : PRIVACY_MODE_ENABLED_WITHOUT_CLIENT_CERTS; - } - - // Otherwise, check with the delegate if present, or base it off of - // |g_default_can_use_cookies| if not. - // TODO(mmenke): Looks like |g_default_can_use_cookies| is not too useful, - // with the network service - remove it. - bool enable_privacy_mode = !g_default_can_use_cookies; - if (network_delegate()) { - enable_privacy_mode = network_delegate()->ForcePrivacyMode( - url(), site_for_cookies_, isolation_info_.top_frame_origin(), - first_party_set_metadata().context().context_type()); - } - return enable_privacy_mode ? PRIVACY_MODE_ENABLED : PRIVACY_MODE_DISABLED; -} - void URLRequest::NotifyReadCompleted(int bytes_read) { if (bytes_read > 0) set_status(OK);
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index a3f9ba0f..fd5b9ddb 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h
@@ -28,7 +28,6 @@ #include "net/base/net_errors.h" #include "net/base/net_export.h" #include "net/base/network_delegate.h" -#include "net/base/privacy_mode.h" #include "net/base/proxy_server.h" #include "net/base/request_priority.h" #include "net/base/upload_progress.h" @@ -556,10 +555,6 @@ // Access the LOAD_* flags modifying this request (see load_flags.h). int load_flags() const { return load_flags_; } - // Returns PrivacyMode that should be used for the request. Updated every time - // the request is redirected. - PrivacyMode privacy_mode() const { return privacy_mode_; } - // Returns the Secure DNS Policy for the request. SecureDnsPolicy secure_dns_policy() const { return secure_dns_policy_; } @@ -800,12 +795,15 @@ void set_send_client_certs(bool send_client_certs) { send_client_certs_ = send_client_certs; } + bool send_client_certs() const { return send_client_certs_; } bool is_for_websockets() const { return is_for_websockets_; } void SetIdempotency(Idempotency idempotency) { idempotency_ = idempotency; } Idempotency GetIdempotency() const { return idempotency_; } + static bool DefaultCanUseCookies(); + base::WeakPtr<URLRequest> GetWeakPtr(); protected: @@ -893,15 +891,11 @@ bool fatal); void NotifyReadCompleted(int bytes_read); - // These functions delegate to the NetworkDelegate if it is not nullptr. + // This function delegates to the NetworkDelegate if it is not nullptr. // Otherwise, cookies can be used unless SetDefaultCookiePolicyToBlock() has // been called. - void AnnotateAndMoveUserBlockedCookies( - CookieAccessResultList& maybe_included_cookies, - CookieAccessResultList& excluded_cookies) const; bool CanSetCookie(const net::CanonicalCookie& cookie, CookieOptions* options) const; - PrivacyMode DeterminePrivacyMode() const; // Called just before calling a delegate that may block a request. |type| // should be the delegate's event type, @@ -958,11 +952,6 @@ // Whether the request is allowed to send credentials in general. Set by // caller. bool allow_credentials_; - // Privacy mode for current hop. Based on |allow_credentials_|, |load_flags_|, - // and information provided by the NetworkDelegate. Saving cookies can - // currently be blocked independently of this field by setting the deprecated - // LOAD_DO_NOT_SAVE_COOKIES field in |load_flags_|. - PrivacyMode privacy_mode_; SecureDnsPolicy secure_dns_policy_; CookieAccessResultList maybe_sent_cookies_;
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 72df70d..affbbf4 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc
@@ -39,6 +39,7 @@ #include "net/base/net_errors.h" #include "net/base/network_delegate.h" #include "net/base/network_isolation_key.h" +#include "net/base/privacy_mode.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "net/base/trace_constants.h" #include "net/base/url_util.h" @@ -285,7 +286,10 @@ // Privacy mode could still be disabled in SetCookieHeaderAndStart if we are // going to send previously saved cookies. - request_info_.privacy_mode = request_->privacy_mode(); + request_info_.privacy_mode = DeterminePrivacyMode(); + request()->net_log().AddEventWithStringParams( + NetLogEventType::COMPUTED_PRIVACY_MODE, "privacy_mode", + PrivacyModeToDebugString(request_info_.privacy_mode)); // Strip Referer from request_info_.extra_headers to prevent, e.g., plugins // from overriding headers that are controlled using other means. Otherwise a @@ -334,6 +338,32 @@ return URLRequestJob::NotifyConnected(info, std::move(callback)); } +PrivacyMode URLRequestHttpJob::DeterminePrivacyMode() const { + if (!request()->allow_credentials()) { + // |allow_credentials_| implies LOAD_DO_NOT_SAVE_COOKIES. + DCHECK(request_->load_flags() & LOAD_DO_NOT_SAVE_COOKIES); + + // TODO(https://crbug.com/775438): Client certs should always be + // affirmatively omitted for these requests. + return request()->send_client_certs() + ? PRIVACY_MODE_ENABLED + : PRIVACY_MODE_ENABLED_WITHOUT_CLIENT_CERTS; + } + + // Otherwise, check with the delegate if present, or base it off of + // |URLRequest::DefaultCanUseCookies()| if not. + // TODO(mmenke): Looks like |URLRequest::DefaultCanUseCookies()| is not too + // useful, with the network service - remove it. + bool enable_privacy_mode = !URLRequest::DefaultCanUseCookies(); + if (request()->network_delegate()) { + enable_privacy_mode = request()->network_delegate()->ForcePrivacyMode( + request()->url(), request()->site_for_cookies(), + request()->isolation_info().top_frame_origin(), + request()->first_party_set_metadata().context().context_type()); + } + return enable_privacy_mode ? PRIVACY_MODE_ENABLED : PRIVACY_MODE_DISABLED; +} + void URLRequestHttpJob::NotifyHeadersComplete() { DCHECK(!response_info_); DCHECK_EQ(0, num_cookie_lines_left_); @@ -700,6 +730,24 @@ StartTransaction(); } +void URLRequestHttpJob::AnnotateAndMoveUserBlockedCookies( + CookieAccessResultList& maybe_included_cookies, + CookieAccessResultList& excluded_cookies) const { + DCHECK_EQ(request_info_.privacy_mode, PrivacyMode::PRIVACY_MODE_DISABLED); + bool can_get_cookies = URLRequest::DefaultCanUseCookies(); + if (request()->network_delegate()) { + can_get_cookies = + request()->network_delegate()->AnnotateAndMoveUserBlockedCookies( + *request(), maybe_included_cookies, excluded_cookies, + /*allowed_from_caller=*/true); + } + + if (!can_get_cookies) { + request()->net_log().AddEvent( + NetLogEventType::COOKIE_GET_BLOCKED_BY_NETWORK_DELEGATE); + } +} + void URLRequestHttpJob::SaveCookiesAndNotifyHeadersComplete(int result) { DCHECK(set_cookie_access_result_list_.empty()); // TODO(crbug.com/1186863): Turn this CHECK into DCHECK once the investigation
diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h index 7193baa..0a63c5e 100644 --- a/net/url_request/url_request_http_job.h +++ b/net/url_request/url_request_http_job.h
@@ -21,6 +21,7 @@ #include "net/base/ip_endpoint.h" #include "net/base/net_error_details.h" #include "net/base/net_export.h" +#include "net/base/privacy_mode.h" #include "net/cookies/cookie_inclusion_status.h" #include "net/http/http_request_info.h" #include "net/socket/connection_attempts.h" @@ -110,8 +111,15 @@ void DestroyTransaction(); + // Computes the PrivacyMode that should be associated with this leg of the + // request. Must be recomputed on redirects. + PrivacyMode DeterminePrivacyMode() const; + void AddExtraHeaders(); void AddCookieHeaderAndStart(); + void AnnotateAndMoveUserBlockedCookies( + CookieAccessResultList& maybe_included_cookies, + CookieAccessResultList& excluded_cookies) const; void SaveCookiesAndNotifyHeadersComplete(int result); // Processes the Strict-Transport-Security header, if one exists.
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 8cd6a64..29d39eae 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc
@@ -405,13 +405,6 @@ request_->NotifySSLCertificateError(net_error, ssl_info, fatal); } -void URLRequestJob::AnnotateAndMoveUserBlockedCookies( - CookieAccessResultList& maybe_included_cookies, - CookieAccessResultList& excluded_cookies) const { - request_->AnnotateAndMoveUserBlockedCookies(maybe_included_cookies, - excluded_cookies); -} - bool URLRequestJob::CanSetCookie(const net::CanonicalCookie& cookie, CookieOptions* options) const { return request_->CanSetCookie(cookie, options);
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index 81c6afd6b..bebb103 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h
@@ -283,11 +283,6 @@ bool fatal); // Delegates to URLRequest. - void AnnotateAndMoveUserBlockedCookies( - CookieAccessResultList& maybe_included_cookies, - CookieAccessResultList& excluded_cookies) const; - - // Delegates to URLRequest. bool CanSetCookie(const net::CanonicalCookie& cookie, CookieOptions* options) const;
diff --git a/net/url_request/url_request_netlog_params.cc b/net/url_request/url_request_netlog_params.cc index dd9973a..178663f 100644 --- a/net/url_request/url_request_netlog_params.cc +++ b/net/url_request/url_request_netlog_params.cc
@@ -31,7 +31,6 @@ const GURL& url, const std::string& method, int load_flags, - PrivacyMode privacy_mode, const IsolationInfo& isolation_info, const SiteForCookies& site_for_cookies, const absl::optional<url::Origin>& initiator, @@ -40,7 +39,6 @@ dict.SetStringKey("url", url.possibly_invalid_spec()); dict.SetStringKey("method", method); dict.SetIntKey("load_flags", load_flags); - dict.SetStringKey("privacy_mode", PrivacyModeToDebugString(privacy_mode)); dict.SetStringKey("network_isolation_key", isolation_info.network_isolation_key().ToDebugString()); std::string request_type;
diff --git a/net/url_request/url_request_netlog_params.h b/net/url_request/url_request_netlog_params.h index b5bd0b8b..ae999f74 100644 --- a/net/url_request/url_request_netlog_params.h +++ b/net/url_request/url_request_netlog_params.h
@@ -43,7 +43,6 @@ const GURL& url, const std::string& method, int load_flags, - PrivacyMode privacy_mode, const IsolationInfo& isolation_info, const SiteForCookies& site_for_cookies, const absl::optional<url::Origin>& initiator,
diff --git a/pdf/pdf_view_plugin_base.cc b/pdf/pdf_view_plugin_base.cc index 011d1d2..489efc2 100644 --- a/pdf/pdf_view_plugin_base.cc +++ b/pdf/pdf_view_plugin_base.cc
@@ -522,8 +522,8 @@ void PdfViewPluginBase::SelectionChanged(const gfx::Rect& left, const gfx::Rect& right) { - const gfx::Rect left_with_offset = left + plugin_rect_.OffsetFromOrigin(); - const gfx::Rect right_with_offset = right + plugin_rect_.OffsetFromOrigin(); + const gfx::Rect left_with_offset = left + plugin_offset_in_frame(); + const gfx::Rect right_with_offset = right + plugin_offset_in_frame(); gfx::PointF left_point(left_with_offset.x() + available_area_.x(), left_with_offset.y()); @@ -534,7 +534,6 @@ left_point.Scale(inverse_scale); right_point.Scale(inverse_scale); - // TODO(crbug.com/1270502): Add a unit test for scaling height. NotifySelectionChanged(left_point, left_with_offset.height() * inverse_scale, right_point, right_with_offset.height() * inverse_scale); @@ -1059,8 +1058,9 @@ void PdfViewPluginBase::PrepareAndSetAccessibilityViewportInfo() { AccessibilityViewportInfo viewport_info; - viewport_info.scroll = - gfx::ScaleToFlooredPoint(plugin_rect_.origin(), -1 / device_scale_); + viewport_info.scroll = gfx::ScaleToFlooredPoint( + gfx::PointAtOffsetFromOrigin(plugin_offset_in_frame()), + -1 / device_scale_); viewport_info.offset = gfx::ScaleToFlooredPoint(available_area_.origin(), 1 / (device_scale_ * zoom_)); viewport_info.zoom = zoom_; @@ -1091,6 +1091,10 @@ NotifyFindTickmarks(tickmarks_); } +gfx::Vector2d PdfViewPluginBase::plugin_offset_in_frame() const { + return plugin_rect_.OffsetFromOrigin(); +} + void PdfViewPluginBase::SetZoom(double scale) { double old_zoom = zoom_; zoom_ = scale; @@ -1814,10 +1818,10 @@ gfx::Point PdfViewPluginBase::FrameToPdfCoordinates( const gfx::PointF& frame_coordinates) const { + // TODO(crbug.com/1288847): Use methods on `blink::WebPluginContainer`. return gfx::ToFlooredPoint( gfx::ScalePoint(frame_coordinates, device_scale_)) - - plugin_rect_.OffsetFromOrigin() - - gfx::Vector2d(available_area_.x(), 0); + plugin_offset_in_frame() - gfx::Vector2d(available_area_.x(), 0); } } // namespace chrome_pdf
diff --git a/pdf/pdf_view_plugin_base.h b/pdf/pdf_view_plugin_base.h index 53a484d4..6b1a352 100644 --- a/pdf/pdf_view_plugin_base.h +++ b/pdf/pdf_view_plugin_base.h
@@ -39,6 +39,7 @@ namespace gfx { class PointF; +class Vector2d; } // namespace gfx namespace chrome_pdf { @@ -408,8 +409,13 @@ void set_document_size(const gfx::Size& size) { document_size_ = size; } + // TODO(crbug.com/1288847): Don't provide direct access to the origin of + // `plugin_rect_`, as this exposes the unintuitive "paint offset." const gfx::Rect& plugin_rect() const { return plugin_rect_; } + // Gets the frame-relative offset of the plugin in device pixels. + virtual gfx::Vector2d plugin_offset_in_frame() const; + // Sets the new zoom scale. void SetZoom(double scale);
diff --git a/pdf/pdf_view_plugin_base_unittest.cc b/pdf/pdf_view_plugin_base_unittest.cc index 1788865..be3fcd0 100644 --- a/pdf/pdf_view_plugin_base_unittest.cc +++ b/pdf/pdf_view_plugin_base_unittest.cc
@@ -34,7 +34,9 @@ #include "third_party/blink/public/common/input/web_input_event.h" #include "third_party/blink/public/common/input/web_mouse_event.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point_f.h" +#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" namespace chrome_pdf { @@ -166,6 +168,7 @@ using PdfViewPluginBase::HandleInputEvent; using PdfViewPluginBase::HandleMessage; using PdfViewPluginBase::LoadUrl; + using PdfViewPluginBase::SetCaretPosition; using PdfViewPluginBase::SetZoom; using PdfViewPluginBase::UpdateGeometryOnPluginRectChanged; using PdfViewPluginBase::UpdateScroll; @@ -1178,6 +1181,110 @@ fake_plugin_.UpdateScroll({2, 1}); } +TEST_F(PdfViewPluginBaseWithEngineTest, SetCaretPosition) { + auto* engine = static_cast<TestPDFiumEngine*>(fake_plugin_.engine()); + fake_plugin_.UpdateGeometryOnPluginRectChanged({300, 56, 20, 5}, 1.0f); + EXPECT_CALL(*engine, ApplyDocumentLayout) + .WillRepeatedly(Return(gfx::Size(16, 9))); + SendDefaultViewportMessage(); + + EXPECT_CALL(*engine, SetCaretPosition(gfx::Point(2, 3))); + fake_plugin_.SetCaretPosition({304.0f, 59.0f}); +} + +TEST_F(PdfViewPluginBaseWithEngineTest, SetCaretPositionNegativeOrigin) { + auto* engine = static_cast<TestPDFiumEngine*>(fake_plugin_.engine()); + fake_plugin_.UpdateGeometryOnPluginRectChanged({-300, -56, 20, 5}, 1.0f); + EXPECT_CALL(*engine, ApplyDocumentLayout) + .WillRepeatedly(Return(gfx::Size(16, 9))); + SendDefaultViewportMessage(); + + EXPECT_CALL(*engine, SetCaretPosition(gfx::Point(2, 3))); + fake_plugin_.SetCaretPosition({-296.0f, -53.0f}); +} + +TEST_F(PdfViewPluginBaseWithEngineTest, SetCaretPositionFractional) { + auto* engine = static_cast<TestPDFiumEngine*>(fake_plugin_.engine()); + fake_plugin_.UpdateGeometryOnPluginRectChanged({300, 56, 20, 5}, 1.0f); + EXPECT_CALL(*engine, ApplyDocumentLayout) + .WillRepeatedly(Return(gfx::Size(16, 9))); + SendDefaultViewportMessage(); + + EXPECT_CALL(*engine, SetCaretPosition(gfx::Point(1, 2))); + fake_plugin_.SetCaretPosition({303.9f, 58.9f}); +} + +TEST_F(PdfViewPluginBaseWithEngineTest, SetCaretPositionScaled) { + auto* engine = static_cast<TestPDFiumEngine*>(fake_plugin_.engine()); + fake_plugin_.UpdateGeometryOnPluginRectChanged({600, 112, 40, 10}, 2.0f); + EXPECT_CALL(*engine, ApplyDocumentLayout) + .WillRepeatedly(Return(gfx::Size(16, 9))); + SendDefaultViewportMessage(); + + EXPECT_CALL(*engine, SetCaretPosition(gfx::Point(4, 6))); + fake_plugin_.SetCaretPosition({304.0f, 59.0f}); +} + +TEST_F(PdfViewPluginBaseWithEngineTest, SelectionChanged) { + auto* engine = static_cast<TestPDFiumEngine*>(fake_plugin_.engine()); + fake_plugin_.EnableAccessibility(); + fake_plugin_.DocumentLoadComplete(); + fake_plugin_.UpdateGeometryOnPluginRectChanged({300, 56, 20, 5}, 1.0f); + EXPECT_CALL(*engine, ApplyDocumentLayout) + .WillRepeatedly(Return(gfx::Size(16, 9))); + SendDefaultViewportMessage(); + + AccessibilityViewportInfo viewport_info; + EXPECT_CALL(fake_plugin_, + NotifySelectionChanged(gfx::PointF(292.0f, 36.0f), 40, + gfx::PointF(352.0f, 116.0f), 80)); + EXPECT_CALL(fake_plugin_, SetAccessibilityViewportInfo) + .WillOnce(SaveArg<0>(&viewport_info)); + fake_plugin_.SelectionChanged({-10, -20, 30, 40}, {50, 60, 70, 80}); + + EXPECT_EQ(gfx::Point(-300, -56), viewport_info.scroll); +} + +TEST_F(PdfViewPluginBaseWithEngineTest, SelectionChangedNegativeOrigin) { + auto* engine = static_cast<TestPDFiumEngine*>(fake_plugin_.engine()); + fake_plugin_.EnableAccessibility(); + fake_plugin_.DocumentLoadComplete(); + fake_plugin_.UpdateGeometryOnPluginRectChanged({-300, -56, 20, 5}, 1.0f); + EXPECT_CALL(*engine, ApplyDocumentLayout) + .WillRepeatedly(Return(gfx::Size(16, 9))); + SendDefaultViewportMessage(); + + AccessibilityViewportInfo viewport_info; + EXPECT_CALL(fake_plugin_, + NotifySelectionChanged(gfx::PointF(-308.0f, -76.0f), 40, + gfx::PointF(-248.0f, 4.0f), 80)); + EXPECT_CALL(fake_plugin_, SetAccessibilityViewportInfo) + .WillOnce(SaveArg<0>(&viewport_info)); + fake_plugin_.SelectionChanged({-10, -20, 30, 40}, {50, 60, 70, 80}); + + EXPECT_EQ(gfx::Point(300, 56), viewport_info.scroll); +} + +TEST_F(PdfViewPluginBaseWithEngineTest, SelectionChangedScaled) { + auto* engine = static_cast<TestPDFiumEngine*>(fake_plugin_.engine()); + fake_plugin_.EnableAccessibility(); + fake_plugin_.DocumentLoadComplete(); + fake_plugin_.UpdateGeometryOnPluginRectChanged({600, 112, 40, 10}, 2.0f); + EXPECT_CALL(*engine, ApplyDocumentLayout) + .WillRepeatedly(Return(gfx::Size(16, 9))); + SendDefaultViewportMessage(); + + AccessibilityViewportInfo viewport_info; + EXPECT_CALL(fake_plugin_, + NotifySelectionChanged(gfx::PointF(292.0f, 36.0f), 40, + gfx::PointF(352.0f, 116.0f), 80)); + EXPECT_CALL(fake_plugin_, SetAccessibilityViewportInfo) + .WillOnce(SaveArg<0>(&viewport_info)); + fake_plugin_.SelectionChanged({-20, -40, 60, 80}, {100, 120, 140, 160}); + + EXPECT_EQ(gfx::Point(-300, -56), viewport_info.scroll); +} + TEST_F(PdfViewPluginBaseTest, HandleResetPrintPreviewModeMessage) { EXPECT_CALL(fake_plugin_, IsPrintPreview).WillRepeatedly(Return(true));
diff --git a/pdf/pdf_view_web_plugin.cc b/pdf/pdf_view_web_plugin.cc index c9412312..510d93be 100644 --- a/pdf/pdf_view_web_plugin.cc +++ b/pdf/pdf_view_web_plugin.cc
@@ -85,6 +85,7 @@ #include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/skia_conversions.h" +#include "ui/gfx/geometry/vector2d.h" #include "ui/gfx/geometry/vector2d_f.h" #include "ui/gfx/range/range.h" #include "url/gurl.h" @@ -997,6 +998,10 @@ client_->RecordComputedAction(action); } +gfx::Vector2d PdfViewWebPlugin::plugin_offset_in_frame() const { + return gfx::Vector2d(); +} + void PdfViewWebPlugin::OnViewportChanged( const gfx::Rect& plugin_rect_in_css_pixel, float new_device_scale) {
diff --git a/pdf/pdf_view_web_plugin.h b/pdf/pdf_view_web_plugin.h index e5d5a3b..784327b 100644 --- a/pdf/pdf_view_web_plugin.h +++ b/pdf/pdf_view_web_plugin.h
@@ -319,6 +319,7 @@ int right_height) override; void NotifyUnsupportedFeature() override; void UserMetricsRecordAction(const std::string& action) override; + gfx::Vector2d plugin_offset_in_frame() const override; private: // Call `Destroy()` instead.
diff --git a/pdf/pdf_view_web_plugin_unittest.cc b/pdf/pdf_view_web_plugin_unittest.cc index 2d728d2..8477158e 100644 --- a/pdf/pdf_view_web_plugin_unittest.cc +++ b/pdf/pdf_view_web_plugin_unittest.cc
@@ -43,6 +43,7 @@ #include "ui/events/keycodes/dom/dom_code.h" #include "ui/events/keycodes/dom/dom_key.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" @@ -527,6 +528,14 @@ /*expected_device_scale=*/1.0f, /*expected_plugin_rect=*/gfx::Rect()); } +TEST_P(PdfViewWebPluginTestUseZoomForDSF, SetCaretPositionIgnoresOrigin) { + SetDocumentDimensions({16, 9}); + UpdatePluginGeometryWithoutWaiting(1.0f, {10, 20, 20, 5}); + + EXPECT_CALL(*engine_ptr_, SetCaretPosition(gfx::Point(2, 3))); + plugin_->SetCaretPosition({4.0f, 3.0f}); +} + TEST_P(PdfViewWebPluginTestUseZoomForDSF, PaintEmptySnapshots) { TestPaintEmptySnapshots(/*device_scale=*/4.0f, /*window_rect=*/gfx::Rect(10, 10, 20, 20),
diff --git a/pdf/test/test_pdfium_engine.h b/pdf/test/test_pdfium_engine.h index 89afd9ea..ce5088e1 100644 --- a/pdf/test/test_pdfium_engine.h +++ b/pdf/test/test_pdfium_engine.h
@@ -74,6 +74,8 @@ std::vector<uint8_t> GetSaveData() override; + MOCK_METHOD(void, SetCaretPosition, (const gfx::Point&), (override)); + void SetPermissions(const std::vector<DocumentPermission>& permissions); protected:
diff --git a/remoting/host/token_validator_base.cc b/remoting/host/token_validator_base.cc index 12ca8d764..a8f9a52 100644 --- a/remoting/host/token_validator_base.cc +++ b/remoting/host/token_validator_base.cc
@@ -16,19 +16,13 @@ #include "base/task/single_thread_task_runner.h" #include "base/values.h" #include "build/build_config.h" +#include "crypto/crypto_buildflags.h" #include "net/base/escape.h" #include "net/base/io_buffer.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" #include "net/base/upload_data_stream.h" #include "net/ssl/client_cert_store.h" -#if defined(USE_NSS_CERTS) -#include "net/ssl/client_cert_store_nss.h" -#elif BUILDFLAG(IS_WIN) -#include "net/ssl/client_cert_store_win.h" -#elif BUILDFLAG(IS_APPLE) -#include "net/ssl/client_cert_store_mac.h" -#endif #include "net/ssl/ssl_cert_request_info.h" #include "net/ssl/ssl_private_key.h" #include "net/url_request/redirect_info.h" @@ -38,6 +32,14 @@ #include "remoting/protocol/authenticator.h" #include "url/gurl.h" +#if BUILDFLAG(USE_NSS_CERTS) +#include "net/ssl/client_cert_store_nss.h" +#elif BUILDFLAG(IS_WIN) +#include "net/ssl/client_cert_store_win.h" +#elif BUILDFLAG(IS_APPLE) +#include "net/ssl/client_cert_store_mac.h" +#endif + namespace remoting { namespace { @@ -206,7 +208,7 @@ DCHECK_EQ(request_.get(), source); net::ClientCertStore* client_cert_store; -#if defined(USE_NSS_CERTS) +#if BUILDFLAG(USE_NSS_CERTS) client_cert_store = new net::ClientCertStoreNSS( net::ClientCertStoreNSS::PasswordDelegateFactory()); #elif BUILDFLAG(IS_WIN)
diff --git a/services/cert_verifier/cert_net_url_loader/BUILD.gn b/services/cert_verifier/cert_net_url_loader/BUILD.gn index 3efdc1e8..079db83 100644 --- a/services/cert_verifier/cert_net_url_loader/BUILD.gn +++ b/services/cert_verifier/cert_net_url_loader/BUILD.gn
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/crypto.gni") +import("//crypto/features.gni") import("//testing/test.gni") component("cert_net_url_loader") {
diff --git a/services/device/BUILD.gn b/services/device/BUILD.gn index babcdb9..c99bfbd7 100644 --- a/services/device/BUILD.gn +++ b/services/device/BUILD.gn
@@ -262,6 +262,7 @@ } else { sources += [ "battery/battery_monitor_impl_unittest.cc", + "hid/hid_device_info_unittest.cc", "hid/hid_manager_unittest.cc", "public/cpp/hid/hid_blocklist_unittest.cc", ]
diff --git a/services/device/hid/BUILD.gn b/services/device/hid/BUILD.gn index dbbb307..10d9db1 100644 --- a/services/device/hid/BUILD.gn +++ b/services/device/hid/BUILD.gn
@@ -20,6 +20,7 @@ "hid_device_info.h", "hid_manager_impl.cc", "hid_manager_impl.h", + "hid_report_type.h", "hid_service.cc", "hid_service.h", ]
diff --git a/services/device/hid/hid_connection.cc b/services/device/hid/hid_connection.cc index 2e78c89..30c50ab 100644 --- a/services/device/hid/hid_connection.cc +++ b/services/device/hid/hid_connection.cc
@@ -16,25 +16,6 @@ namespace { -// Functor used to filter collections by report ID. -struct CollectionHasReportId { - explicit CollectionHasReportId(uint8_t report_id) : report_id_(report_id) {} - - bool operator()(const mojom::HidCollectionInfoPtr& info) const { - if (info->report_ids.size() == 0 || - report_id_ == HidConnection::kNullReportId) - return false; - - if (report_id_ == HidConnection::kAnyReportId) - return true; - - return base::Contains(info->report_ids, report_id_); - } - - private: - const uint8_t report_id_; -}; - // Functor returning true if collection has a protected usage. struct CollectionIsAlwaysProtected { bool operator()(const mojom::HidCollectionInfoPtr& info) const { @@ -42,19 +23,6 @@ } }; -const mojom::HidCollectionInfo* FindCollectionByReportId( - const std::vector<mojom::HidCollectionInfoPtr>& collections, - uint8_t report_id) { - auto collection_iter = std::find_if(collections.begin(), collections.end(), - CollectionHasReportId(report_id)); - if (collection_iter != collections.end()) { - DCHECK(collection_iter->get()); - return collection_iter->get(); - } - - return nullptr; -} - bool HasAlwaysProtectedCollection( const std::vector<mojom::HidCollectionInfoPtr>& collections) { return std::find_if(collections.begin(), collections.end(), @@ -130,7 +98,7 @@ std::move(callback).Run(false); return; } - if (IsReportIdProtected(report_id, kOutput)) { + if (IsReportIdProtected(report_id, HidReportType::kOutput)) { HID_LOG(USER) << "Attempt to set a protected output report."; std::move(callback).Run(false); return; @@ -151,7 +119,7 @@ std::move(callback).Run(false, nullptr, 0); return; } - if (IsReportIdProtected(report_id, kFeature)) { + if (IsReportIdProtected(report_id, HidReportType::kFeature)) { HID_LOG(USER) << "Attempt to get a protected feature report."; std::move(callback).Run(false, nullptr, 0); return; @@ -176,7 +144,7 @@ std::move(callback).Run(false); return; } - if (IsReportIdProtected(report_id, kFeature)) { + if (IsReportIdProtected(report_id, HidReportType::kFeature)) { HID_LOG(USER) << "Attempt to set a protected feature report."; std::move(callback).Run(false); return; @@ -193,7 +161,7 @@ // by the HID blocklist. if (allow_fido_reports_) { auto* collection_info = - FindCollectionByReportId(device_info_->collections(), report_id); + device_info_->FindCollectionWithReport(report_id, report_type); if (collection_info && collection_info->usage->usage_page == mojom::kPageFido) { return false; @@ -201,19 +169,19 @@ } // Deny access to reports that match HID blocklist rules. - if (report_type == kInput) { + if (report_type == HidReportType::kInput) { if (device_info_->device()->protected_input_report_ids.has_value() && base::Contains(*device_info_->device()->protected_input_report_ids, report_id)) { return true; } - } else if (report_type == kOutput) { + } else if (report_type == HidReportType::kOutput) { if (device_info_->device()->protected_output_report_ids.has_value() && base::Contains(*device_info_->device()->protected_output_report_ids, report_id)) { return true; } - } else if (report_type == kFeature) { + } else if (report_type == HidReportType::kFeature) { if (device_info_->device()->protected_feature_report_ids.has_value() && base::Contains(*device_info_->device()->protected_feature_report_ids, report_id)) { @@ -225,7 +193,7 @@ // Some types of reports are always blocked regardless of // |allow_protected_reports_|. auto* collection_info = - FindCollectionByReportId(device_info_->collections(), report_id); + device_info_->FindCollectionWithReport(report_id, report_type); if (collection_info) { return IsAlwaysProtected(*collection_info->usage); } @@ -240,7 +208,7 @@ DCHECK_GE(size, 1u); uint8_t report_id = buffer->data()[0]; - if (IsReportIdProtected(report_id, kInput)) + if (IsReportIdProtected(report_id, HidReportType::kInput)) return; if (client_) {
diff --git a/services/device/hid/hid_connection.h b/services/device/hid/hid_connection.h index 0f58eebb..3434b9e 100644 --- a/services/device/hid/hid_connection.h +++ b/services/device/hid/hid_connection.h
@@ -80,12 +80,6 @@ WriteCallback callback); protected: - enum HidReportType { - kInput, - kOutput, - kFeature, - }; - friend class base::RefCountedThreadSafe<HidConnection>; HidConnection(scoped_refptr<HidDeviceInfo> device_info,
diff --git a/services/device/hid/hid_connection_win.cc b/services/device/hid/hid_connection_win.cc index 9e794edd..d9a7339e 100644 --- a/services/device/hid/hid_connection_win.cc +++ b/services/device/hid/hid_connection_win.cc
@@ -14,6 +14,7 @@ #include "base/numerics/safe_conversions.h" #include "base/win/object_watcher.h" #include "components/device_event_log/device_event_log.h" +#include "services/device/hid/hid_report_type.h" #define INITGUID
diff --git a/services/device/hid/hid_device_info.cc b/services/device/hid/hid_device_info.cc index 0b9db45..e9585f2 100644 --- a/services/device/hid/hid_device_info.cc +++ b/services/device/hid/hid_device_info.cc
@@ -4,6 +4,7 @@ #include "services/device/hid/hid_device_info.h" +#include "base/containers/contains.h" #include "base/guid.h" #include "build/build_config.h" #include "services/device/public/cpp/hid/hid_blocklist.h" @@ -11,6 +12,23 @@ namespace device { +namespace { + +const std::vector<mojom::HidReportDescriptionPtr>& ReportsForType( + const mojom::HidCollectionInfoPtr& collection, + HidReportType report_type) { + switch (report_type) { + case HidReportType::kInput: + return collection->input_reports; + case HidReportType::kOutput: + return collection->output_reports; + case HidReportType::kFeature: + return collection->feature_reports; + } +} + +} // namespace + HidDeviceInfo::PlatformDeviceIdEntry::PlatformDeviceIdEntry( base::flat_set<uint8_t> report_ids, HidPlatformDeviceId platform_device_id) @@ -162,4 +180,46 @@ device_->product_id, device_->collections); } +const mojom::HidCollectionInfo* HidDeviceInfo::FindCollectionWithReport( + uint8_t report_id, + HidReportType report_type) { + if (!device_->has_report_id) { + // `report_id` must be zero if the device does not use numbered reports. + if (report_id != 0) + return nullptr; + + // Return the first collection with a report of type `report_type`, or + // nullptr if there is no report of that type. + auto find_it = base::ranges::find_if( + device_->collections, [=](const auto& collection) { + const auto& reports = ReportsForType(collection, report_type); + return !reports.empty(); + }); + if (find_it == device_->collections.end()) + return nullptr; + + DCHECK(find_it->get()); + return find_it->get(); + } + + // `report_id` must be non-zero if the device uses numbered reports. + if (report_id == 0) + return nullptr; + + // Return the collection containing a report with `report_id` and type + // `report_type`, or nullptr if it is not in any collection. + auto find_it = + base::ranges::find_if(device_->collections, [=](const auto& collection) { + const auto& reports = ReportsForType(collection, report_type); + return base::Contains(reports, report_id, [](const auto& report) { + return report->report_id; + }); + }); + if (find_it == device_->collections.end()) + return nullptr; + + DCHECK(find_it->get()); + return find_it->get(); +} + } // namespace device
diff --git a/services/device/hid/hid_device_info.h b/services/device/hid/hid_device_info.h index 6f72dd23..bab2758 100644 --- a/services/device/hid/hid_device_info.h +++ b/services/device/hid/hid_device_info.h
@@ -15,6 +15,7 @@ #include "base/containers/span.h" #include "base/memory/ref_counted.h" #include "build/build_config.h" +#include "services/device/hid/hid_report_type.h" #include "services/device/public/mojom/hid.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -112,6 +113,13 @@ // |device_info| must be part of the same HID interface. void AppendDeviceInfo(scoped_refptr<HidDeviceInfo> device_info); + // Returns the collection in `device_` containing a report with ID `report_id` + // and type `report_type`, or nullptr if no collection contains a matching + // report. + const mojom::HidCollectionInfo* FindCollectionWithReport( + uint8_t report_id, + HidReportType report_type); + protected: virtual ~HidDeviceInfo();
diff --git a/services/device/hid/hid_device_info_unittest.cc b/services/device/hid/hid_device_info_unittest.cc new file mode 100644 index 0000000..49440293 --- /dev/null +++ b/services/device/hid/hid_device_info_unittest.cc
@@ -0,0 +1,208 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "services/device/hid/hid_device_info.h" + +#include "base/containers/flat_map.h" +#include "build/build_config.h" +#include "services/device/hid/hid_report_type.h" +#include "services/device/hid/test_report_descriptors.h" +#include "services/device/public/mojom/hid.mojom.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace device { + +namespace { + +using ::testing::ElementsAre; +using ::testing::UnorderedElementsAre; + +scoped_refptr<HidDeviceInfo> CreateHidDeviceInfo( + base::span<const uint8_t> report_descriptor) { +#if defined(OS_MAC) + const uint64_t kTestDeviceId = 0; +#elif defined(OS_WIN) + const wchar_t* const kTestDeviceId = L"0"; +#else + const char* const kTestDeviceId = "0"; +#endif + return base::MakeRefCounted<HidDeviceInfo>( + kTestDeviceId, "physical-device-id", + /*vendor_id=*/0x1234, + /*product_id=*/0xabcd, "product-name", "serial-number", + mojom::HidBusType::kHIDBusTypeUSB, report_descriptor); +} + +TEST(HidDeviceInfoTest, FindCollectionWithReport_MultipleCollections) { + // The device has 8 reports (4 input, 4 output) spread over 3 top-level + // collections. + auto device = + CreateHidDeviceInfo(TestReportDescriptors::LogitechUnifyingReceiver()); + EXPECT_TRUE(device->has_report_id()); + EXPECT_EQ(3u, device->collections().size()); + base::flat_map<uint16_t, device::mojom::HidCollectionInfo*> collections; + for (const auto& collection : device->collections()) { + ASSERT_TRUE(collection->usage); + EXPECT_EQ(mojom::kPageVendor, collection->usage->usage_page); + collections[collection->usage->usage] = collection.get(); + } + ASSERT_TRUE(collections.contains(1)); + ASSERT_TRUE(collections.contains(2)); + ASSERT_TRUE(collections.contains(4)); + + EXPECT_THAT(collections[1]->report_ids, ElementsAre(0x10)); + ASSERT_EQ(1u, collections[1]->input_reports.size()); + EXPECT_EQ(0x10, collections[1]->input_reports[0]->report_id); + ASSERT_EQ(1u, collections[1]->output_reports.size()); + EXPECT_EQ(0x10, collections[1]->output_reports[0]->report_id); + EXPECT_EQ(0u, collections[1]->feature_reports.size()); + + EXPECT_THAT(collections[2]->report_ids, ElementsAre(0x11)); + ASSERT_EQ(1u, collections[2]->input_reports.size()); + EXPECT_EQ(0x11, collections[2]->input_reports[0]->report_id); + ASSERT_EQ(1u, collections[2]->output_reports.size()); + EXPECT_EQ(0x11, collections[2]->output_reports[0]->report_id); + EXPECT_EQ(0u, collections[2]->feature_reports.size()); + + EXPECT_THAT(collections[4]->report_ids, UnorderedElementsAre(0x20, 0x21)); + std::vector<uint8_t> input_report_ids; + for (const auto& report : collections[4]->input_reports) + input_report_ids.push_back(report->report_id); + EXPECT_THAT(input_report_ids, UnorderedElementsAre(0x20, 0x21)); + std::vector<uint8_t> output_report_ids; + for (const auto& report : collections[4]->output_reports) + output_report_ids.push_back(report->report_id); + EXPECT_THAT(output_report_ids, UnorderedElementsAre(0x20, 0x21)); + EXPECT_EQ(0u, collections[4]->feature_reports.size()); + + // Ensure the correct collection is returned for each report. + EXPECT_EQ(collections[1], + device->FindCollectionWithReport(0x10, HidReportType::kInput)); + EXPECT_EQ(collections[1], + device->FindCollectionWithReport(0x10, HidReportType::kOutput)); + EXPECT_EQ(collections[2], + device->FindCollectionWithReport(0x11, HidReportType::kInput)); + EXPECT_EQ(collections[2], + device->FindCollectionWithReport(0x11, HidReportType::kOutput)); + EXPECT_EQ(collections[4], + device->FindCollectionWithReport(0x20, HidReportType::kInput)); + EXPECT_EQ(collections[4], + device->FindCollectionWithReport(0x20, HidReportType::kOutput)); + EXPECT_EQ(collections[4], + device->FindCollectionWithReport(0x21, HidReportType::kInput)); + EXPECT_EQ(collections[4], + device->FindCollectionWithReport(0x21, HidReportType::kOutput)); + + // Zero is not a valid report ID. Ensure no collection info is returned. + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0, HidReportType::kInput)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0, HidReportType::kOutput)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0, HidReportType::kFeature)); + + // Ensure no collection is returned for reports not supported by the device. + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x10, HidReportType::kFeature)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x11, HidReportType::kFeature)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x20, HidReportType::kFeature)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x21, HidReportType::kFeature)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x30, HidReportType::kInput)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x30, HidReportType::kOutput)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x30, HidReportType::kFeature)); +} + +TEST(HidDeviceInfoTest, FindCollectionWithReport_SameReportId) { + // The device has 6 reports (1 input, 1 output, 4 feature). The input report, + // output report, and first feature report share the same report ID. + auto device = CreateHidDeviceInfo(TestReportDescriptors::SonyDualshock3Usb()); + EXPECT_TRUE(device->has_report_id()); + ASSERT_EQ(1u, device->collections().size()); + const auto* collection = device->collections()[0].get(); + EXPECT_FALSE(collection->report_ids.empty()); + ASSERT_EQ(1u, collection->input_reports.size()); + EXPECT_EQ(0x01, collection->input_reports[0]->report_id); + ASSERT_EQ(1u, collection->output_reports.size()); + EXPECT_EQ(0x01, collection->output_reports[0]->report_id); + ASSERT_EQ(4u, collection->feature_reports.size()); + std::vector<uint8_t> feature_report_ids; + for (const auto& report : collection->feature_reports) + feature_report_ids.push_back(report->report_id); + EXPECT_THAT(feature_report_ids, UnorderedElementsAre(0x01, 0x02, 0xee, 0xef)); + + // Ensure the correct collection is returned for each report. + EXPECT_EQ(collection, + device->FindCollectionWithReport(0x01, HidReportType::kInput)); + EXPECT_EQ(collection, + device->FindCollectionWithReport(0x01, HidReportType::kOutput)); + EXPECT_EQ(collection, + device->FindCollectionWithReport(0x01, HidReportType::kFeature)); + EXPECT_EQ(collection, + device->FindCollectionWithReport(0x02, HidReportType::kFeature)); + EXPECT_EQ(collection, + device->FindCollectionWithReport(0xee, HidReportType::kFeature)); + EXPECT_EQ(collection, + device->FindCollectionWithReport(0xef, HidReportType::kFeature)); + + // Zero is not a valid report ID. Ensure no collection info is returned. + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0, HidReportType::kInput)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0, HidReportType::kOutput)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0, HidReportType::kFeature)); + + // Ensure no collection is returned for reports not supported by the device. + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x02, HidReportType::kInput)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x02, HidReportType::kOutput)); + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0x03, HidReportType::kFeature)); +} + +TEST(HidDeviceInfoTest, FindCollectionWithReport_NoReportIds) { + // The device has 2 reports (1 input, 1 output) and does not use report IDs. + auto device = CreateHidDeviceInfo(TestReportDescriptors::FidoU2fHid()); + EXPECT_FALSE(device->has_report_id()); + ASSERT_EQ(1u, device->collections().size()); + const auto* collection = device->collections()[0].get(); + EXPECT_TRUE(collection->report_ids.empty()); + ASSERT_EQ(1u, collection->input_reports.size()); + EXPECT_EQ(0u, collection->input_reports[0]->report_id); + ASSERT_EQ(1u, collection->output_reports.size()); + EXPECT_EQ(0u, collection->output_reports[0]->report_id); + EXPECT_TRUE(collection->feature_reports.empty()); + + // Ensure the correct collection is returned for each report. + EXPECT_EQ(collection, + device->FindCollectionWithReport(0, HidReportType::kInput)); + EXPECT_EQ(collection, + device->FindCollectionWithReport(0, HidReportType::kOutput)); + + // Ensure no collection is found containing a feature report. + EXPECT_EQ(nullptr, + device->FindCollectionWithReport(0, HidReportType::kFeature)); + + // No collections should be found for any non-zero report ID. + for (uint32_t report_id = 0x01; report_id <= 0xff; ++report_id) { + EXPECT_EQ(nullptr, device->FindCollectionWithReport(report_id, + HidReportType::kInput)); + EXPECT_EQ(nullptr, device->FindCollectionWithReport( + report_id, HidReportType::kOutput)); + EXPECT_EQ(nullptr, device->FindCollectionWithReport( + report_id, HidReportType::kFeature)); + } +} + +} // namespace + +} // namespace device
diff --git a/services/device/hid/hid_report_type.h b/services/device/hid/hid_report_type.h new file mode 100644 index 0000000..eb436bba --- /dev/null +++ b/services/device/hid/hid_report_type.h
@@ -0,0 +1,23 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_DEVICE_HID_HID_REPORT_TYPE_H_ +#define SERVICES_DEVICE_HID_HID_REPORT_TYPE_H_ + +namespace device { + +// A HID report a packet of data meaningful to the device. The report type +// indicates the direction and initiator of the report. +enum class HidReportType { + // Input reports are sent from device to host, initiated by the device. + kInput, + // Output reports are sent from host to device, initiated by the host. + kOutput, + // Feature reports are sent in either direction, initiated by the host. + kFeature, +}; + +} // namespace device + +#endif // SERVICES_DEVICE_HID_HID_REPORT_TYPE_H_
diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json index dd56226..adbf84a 100644 --- a/testing/buildbot/chromium.mac.json +++ b/testing/buildbot/chromium.mac.json
@@ -10948,7 +10948,7 @@ } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", - "shards": 6 + "shards": 7 }, "test": "content_browsertests", "test_id_prefix": "ninja://content/test:content_browsertests/"
diff --git a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/components_unittests.filter b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/components_unittests.filter index 667d608..701624d2 100644 --- a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/components_unittests.filter +++ b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/components_unittests.filter
@@ -12189,55 +12189,55 @@ -ProfileOAuth2TokenServiceTest.SameScopesRequestedForDifferentClients -ProfileOAuth2TokenServiceTest.ServiceShutDownBeforeFetchComplete -ProfileOAuth2TokenServiceTest.StartRequestForMultiloginDesktop --ProfileSyncServiceStartupTest.DisableSync --ProfileSyncServiceStartupTest.FullStartupSequenceNthTime --ProfileSyncServiceStartupTest.ManagedStartup --ProfileSyncServiceStartupTest.StartCrosFirstTime --ProfileSyncServiceStartupTest.StartCrosNoCredentials --ProfileSyncServiceStartupTest.StartDontRecoverDatatypePrefs --ProfileSyncServiceStartupTest.StartDownloadFailed --ProfileSyncServiceStartupTest.StartInvalidCredentials --ProfileSyncServiceStartupTest.StartNoCredentials --ProfileSyncServiceStartupTest.StartNormal --ProfileSyncServiceStartupTest.StartRecoverDatatypePrefs --ProfileSyncServiceStartupTest.StopSync --ProfileSyncServiceStartupTest.SwitchManaged --ProfileSyncServiceStartupTest.WebSignoutAfterInitialization --ProfileSyncServiceStartupTest.WebSignoutBeforeInitialization --ProfileSyncServiceStartupTest.WebSignoutDuringDeferredStartup --ProfileSyncServiceTest.AbortedByShutdown --ProfileSyncServiceTest.ClearTransportDataOnInitializeWhenSignedOut --ProfileSyncServiceTest.ConfigureDataTypeManagerReason --ProfileSyncServiceTest.CredentialErrorClearsOnNewToken --ProfileSyncServiceTest.CredentialErrorReturned --ProfileSyncServiceTest.CredentialsRejectedByClient_StopSync --ProfileSyncServiceTest.DisableAndEnableSyncTemporarily --ProfileSyncServiceTest.DisableSyncFlag --ProfileSyncServiceTest.DisableSyncOnClient --ProfileSyncServiceTest.DisabledByPolicyAfterInit --ProfileSyncServiceTest.DisabledByPolicyBeforeInit --ProfileSyncServiceTest.DisabledByPolicyBeforeInitThenPolicyRemoved --ProfileSyncServiceTest.EarlyRequestStop --ProfileSyncServiceTest.GetSyncTokenStatus --ProfileSyncServiceTest.InitialState --ProfileSyncServiceTest.LocalBackendUnimpactedByPolicy --ProfileSyncServiceTest.ModelTypesForTransportMode --ProfileSyncServiceTest.NeedsConfirmation --ProfileSyncServiceTest.NoDisableSyncFlag --ProfileSyncServiceTest.ResetSyncData --ProfileSyncServiceTest.RevokeAccessTokenFromTokenService --ProfileSyncServiceTest.SetupInProgress --ProfileSyncServiceTest.ShouldDisableSyncFeatureWhenSyncDisallowedByPlatform --ProfileSyncServiceTest.ShouldProvideDisableReasonsAfterShutdown --ProfileSyncServiceTest.StopAndClearWillClearDataAndSwitchToTransportMode --ProfileSyncServiceTest.StopSyncAndClearTwiceDoesNotCrash --ProfileSyncServiceTest.SuccessfulInitialization --ProfileSyncServiceTest.SuccessfulLocalBackendInitialization --ProfileSyncServiceTest.WaitForPoliciesToStart --ProfileSyncServiceTestWithSyncInvalidationsServiceCreated.ShouldActivateSyncInvalidationsServiceOnSignIn --ProfileSyncServiceTestWithSyncInvalidationsServiceCreated.ShouldActivateSyncInvalidationsServiceWhenSyncIsInitialized --ProfileSyncServiceTestWithSyncInvalidationsServiceCreated.ShouldEnableAndDisableInvalidationsForSessions --ProfileSyncServiceTestWithSyncInvalidationsServiceCreated.ShouldSendDataTypesToSyncInvalidationsService +-SyncServiceImplStartupTest.DisableSync +-SyncServiceImplStartupTest.FullStartupSequenceNthTime +-SyncServiceImplStartupTest.ManagedStartup +-SyncServiceImplStartupTest.StartCrosFirstTime +-SyncServiceImplStartupTest.StartCrosNoCredentials +-SyncServiceImplStartupTest.StartDontRecoverDatatypePrefs +-SyncServiceImplStartupTest.StartDownloadFailed +-SyncServiceImplStartupTest.StartInvalidCredentials +-SyncServiceImplStartupTest.StartNoCredentials +-SyncServiceImplStartupTest.StartNormal +-SyncServiceImplStartupTest.StartRecoverDatatypePrefs +-SyncServiceImplStartupTest.StopSync +-SyncServiceImplStartupTest.SwitchManaged +-SyncServiceImplStartupTest.WebSignoutAfterInitialization +-SyncServiceImplStartupTest.WebSignoutBeforeInitialization +-SyncServiceImplStartupTest.WebSignoutDuringDeferredStartup +-SyncServiceImplTest.AbortedByShutdown +-SyncServiceImplTest.ClearTransportDataOnInitializeWhenSignedOut +-SyncServiceImplTest.ConfigureDataTypeManagerReason +-SyncServiceImplTest.CredentialErrorClearsOnNewToken +-SyncServiceImplTest.CredentialErrorReturned +-SyncServiceImplTest.CredentialsRejectedByClient_StopSync +-SyncServiceImplTest.DisableAndEnableSyncTemporarily +-SyncServiceImplTest.DisableSyncFlag +-SyncServiceImplTest.DisableSyncOnClient +-SyncServiceImplTest.DisabledByPolicyAfterInit +-SyncServiceImplTest.DisabledByPolicyBeforeInit +-SyncServiceImplTest.DisabledByPolicyBeforeInitThenPolicyRemoved +-SyncServiceImplTest.EarlyRequestStop +-SyncServiceImplTest.GetSyncTokenStatus +-SyncServiceImplTest.InitialState +-SyncServiceImplTest.LocalBackendUnimpactedByPolicy +-SyncServiceImplTest.ModelTypesForTransportMode +-SyncServiceImplTest.NeedsConfirmation +-SyncServiceImplTest.NoDisableSyncFlag +-SyncServiceImplTest.ResetSyncData +-SyncServiceImplTest.RevokeAccessTokenFromTokenService +-SyncServiceImplTest.SetupInProgress +-SyncServiceImplTest.ShouldDisableSyncFeatureWhenSyncDisallowedByPlatform +-SyncServiceImplTest.ShouldProvideDisableReasonsAfterShutdown +-SyncServiceImplTest.StopAndClearWillClearDataAndSwitchToTransportMode +-SyncServiceImplTest.StopSyncAndClearTwiceDoesNotCrash +-SyncServiceImplTest.SuccessfulInitialization +-SyncServiceImplTest.SuccessfulLocalBackendInitialization +-SyncServiceImplTest.WaitForPoliciesToStart +-SyncServiceImplTestWithSyncInvalidationsServiceCreated.ShouldActivateSyncInvalidationsServiceOnSignIn +-SyncServiceImplTestWithSyncInvalidationsServiceCreated.ShouldActivateSyncInvalidationsServiceWhenSyncIsInitialized +-SyncServiceImplTestWithSyncInvalidationsServiceCreated.ShouldEnableAndDisableInvalidationsForSessions +-SyncServiceImplTestWithSyncInvalidationsServiceCreated.ShouldSendDataTypesToSyncInvalidationsService -ProfilingJsonExporterTest.Context -ProfilingJsonExporterTest.LargeAllocation -ProfilingJsonExporterTest.MemoryMaps
diff --git a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/unit_tests.filter b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/unit_tests.filter index 4b7310e..ea1faed 100644 --- a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/unit_tests.filter +++ b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-combined-rel/unit_tests.filter
@@ -4255,7 +4255,7 @@ -ProfileProtoDBTest.TestMaintenanceNonMatchingDataId -ProfileReportGeneratorTest.PendingRequest_Justification -ProfileReportGeneratorTest.ProfileIdObfuscate --ProfileSyncServiceFactoryTest.DisableSyncFlag +-SyncServiceFactoryTest.DisableSyncFlag -ProfilesState/IsGuestModeRequestedTest.Requested/0 -ProfilesState/IsGuestModeRequestedTest.Requested/1 -ProfilesState/IsGuestModeRequestedTest.Requested/2
diff --git a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/components_unittests.filter b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/components_unittests.filter index 667d608..701624d2 100644 --- a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/components_unittests.filter +++ b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/components_unittests.filter
@@ -12189,55 +12189,55 @@ -ProfileOAuth2TokenServiceTest.SameScopesRequestedForDifferentClients -ProfileOAuth2TokenServiceTest.ServiceShutDownBeforeFetchComplete -ProfileOAuth2TokenServiceTest.StartRequestForMultiloginDesktop --ProfileSyncServiceStartupTest.DisableSync --ProfileSyncServiceStartupTest.FullStartupSequenceNthTime --ProfileSyncServiceStartupTest.ManagedStartup --ProfileSyncServiceStartupTest.StartCrosFirstTime --ProfileSyncServiceStartupTest.StartCrosNoCredentials --ProfileSyncServiceStartupTest.StartDontRecoverDatatypePrefs --ProfileSyncServiceStartupTest.StartDownloadFailed --ProfileSyncServiceStartupTest.StartInvalidCredentials --ProfileSyncServiceStartupTest.StartNoCredentials --ProfileSyncServiceStartupTest.StartNormal --ProfileSyncServiceStartupTest.StartRecoverDatatypePrefs --ProfileSyncServiceStartupTest.StopSync --ProfileSyncServiceStartupTest.SwitchManaged --ProfileSyncServiceStartupTest.WebSignoutAfterInitialization --ProfileSyncServiceStartupTest.WebSignoutBeforeInitialization --ProfileSyncServiceStartupTest.WebSignoutDuringDeferredStartup --ProfileSyncServiceTest.AbortedByShutdown --ProfileSyncServiceTest.ClearTransportDataOnInitializeWhenSignedOut --ProfileSyncServiceTest.ConfigureDataTypeManagerReason --ProfileSyncServiceTest.CredentialErrorClearsOnNewToken --ProfileSyncServiceTest.CredentialErrorReturned --ProfileSyncServiceTest.CredentialsRejectedByClient_StopSync --ProfileSyncServiceTest.DisableAndEnableSyncTemporarily --ProfileSyncServiceTest.DisableSyncFlag --ProfileSyncServiceTest.DisableSyncOnClient --ProfileSyncServiceTest.DisabledByPolicyAfterInit --ProfileSyncServiceTest.DisabledByPolicyBeforeInit --ProfileSyncServiceTest.DisabledByPolicyBeforeInitThenPolicyRemoved --ProfileSyncServiceTest.EarlyRequestStop --ProfileSyncServiceTest.GetSyncTokenStatus --ProfileSyncServiceTest.InitialState --ProfileSyncServiceTest.LocalBackendUnimpactedByPolicy --ProfileSyncServiceTest.ModelTypesForTransportMode --ProfileSyncServiceTest.NeedsConfirmation --ProfileSyncServiceTest.NoDisableSyncFlag --ProfileSyncServiceTest.ResetSyncData --ProfileSyncServiceTest.RevokeAccessTokenFromTokenService --ProfileSyncServiceTest.SetupInProgress --ProfileSyncServiceTest.ShouldDisableSyncFeatureWhenSyncDisallowedByPlatform --ProfileSyncServiceTest.ShouldProvideDisableReasonsAfterShutdown --ProfileSyncServiceTest.StopAndClearWillClearDataAndSwitchToTransportMode --ProfileSyncServiceTest.StopSyncAndClearTwiceDoesNotCrash --ProfileSyncServiceTest.SuccessfulInitialization --ProfileSyncServiceTest.SuccessfulLocalBackendInitialization --ProfileSyncServiceTest.WaitForPoliciesToStart --ProfileSyncServiceTestWithSyncInvalidationsServiceCreated.ShouldActivateSyncInvalidationsServiceOnSignIn --ProfileSyncServiceTestWithSyncInvalidationsServiceCreated.ShouldActivateSyncInvalidationsServiceWhenSyncIsInitialized --ProfileSyncServiceTestWithSyncInvalidationsServiceCreated.ShouldEnableAndDisableInvalidationsForSessions --ProfileSyncServiceTestWithSyncInvalidationsServiceCreated.ShouldSendDataTypesToSyncInvalidationsService +-SyncServiceImplStartupTest.DisableSync +-SyncServiceImplStartupTest.FullStartupSequenceNthTime +-SyncServiceImplStartupTest.ManagedStartup +-SyncServiceImplStartupTest.StartCrosFirstTime +-SyncServiceImplStartupTest.StartCrosNoCredentials +-SyncServiceImplStartupTest.StartDontRecoverDatatypePrefs +-SyncServiceImplStartupTest.StartDownloadFailed +-SyncServiceImplStartupTest.StartInvalidCredentials +-SyncServiceImplStartupTest.StartNoCredentials +-SyncServiceImplStartupTest.StartNormal +-SyncServiceImplStartupTest.StartRecoverDatatypePrefs +-SyncServiceImplStartupTest.StopSync +-SyncServiceImplStartupTest.SwitchManaged +-SyncServiceImplStartupTest.WebSignoutAfterInitialization +-SyncServiceImplStartupTest.WebSignoutBeforeInitialization +-SyncServiceImplStartupTest.WebSignoutDuringDeferredStartup +-SyncServiceImplTest.AbortedByShutdown +-SyncServiceImplTest.ClearTransportDataOnInitializeWhenSignedOut +-SyncServiceImplTest.ConfigureDataTypeManagerReason +-SyncServiceImplTest.CredentialErrorClearsOnNewToken +-SyncServiceImplTest.CredentialErrorReturned +-SyncServiceImplTest.CredentialsRejectedByClient_StopSync +-SyncServiceImplTest.DisableAndEnableSyncTemporarily +-SyncServiceImplTest.DisableSyncFlag +-SyncServiceImplTest.DisableSyncOnClient +-SyncServiceImplTest.DisabledByPolicyAfterInit +-SyncServiceImplTest.DisabledByPolicyBeforeInit +-SyncServiceImplTest.DisabledByPolicyBeforeInitThenPolicyRemoved +-SyncServiceImplTest.EarlyRequestStop +-SyncServiceImplTest.GetSyncTokenStatus +-SyncServiceImplTest.InitialState +-SyncServiceImplTest.LocalBackendUnimpactedByPolicy +-SyncServiceImplTest.ModelTypesForTransportMode +-SyncServiceImplTest.NeedsConfirmation +-SyncServiceImplTest.NoDisableSyncFlag +-SyncServiceImplTest.ResetSyncData +-SyncServiceImplTest.RevokeAccessTokenFromTokenService +-SyncServiceImplTest.SetupInProgress +-SyncServiceImplTest.ShouldDisableSyncFeatureWhenSyncDisallowedByPlatform +-SyncServiceImplTest.ShouldProvideDisableReasonsAfterShutdown +-SyncServiceImplTest.StopAndClearWillClearDataAndSwitchToTransportMode +-SyncServiceImplTest.StopSyncAndClearTwiceDoesNotCrash +-SyncServiceImplTest.SuccessfulInitialization +-SyncServiceImplTest.SuccessfulLocalBackendInitialization +-SyncServiceImplTest.WaitForPoliciesToStart +-SyncServiceImplTestWithSyncInvalidationsServiceCreated.ShouldActivateSyncInvalidationsServiceOnSignIn +-SyncServiceImplTestWithSyncInvalidationsServiceCreated.ShouldActivateSyncInvalidationsServiceWhenSyncIsInitialized +-SyncServiceImplTestWithSyncInvalidationsServiceCreated.ShouldEnableAndDisableInvalidationsForSessions +-SyncServiceImplTestWithSyncInvalidationsServiceCreated.ShouldSendDataTypesToSyncInvalidationsService -ProfilingJsonExporterTest.Context -ProfilingJsonExporterTest.LargeAllocation -ProfilingJsonExporterTest.MemoryMaps
diff --git a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/unit_tests.filter b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/unit_tests.filter index 4b7310e..ea1faed 100644 --- a/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/unit_tests.filter +++ b/testing/buildbot/filters/stable_test_filters/linux-stable-filter-rel/unit_tests.filter
@@ -4255,7 +4255,7 @@ -ProfileProtoDBTest.TestMaintenanceNonMatchingDataId -ProfileReportGeneratorTest.PendingRequest_Justification -ProfileReportGeneratorTest.ProfileIdObfuscate --ProfileSyncServiceFactoryTest.DisableSyncFlag +-SyncServiceFactoryTest.DisableSyncFlag -ProfilesState/IsGuestModeRequestedTest.Requested/0 -ProfilesState/IsGuestModeRequestedTest.Requested/1 -ProfilesState/IsGuestModeRequestedTest.Requested/2
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 81be100..c723dca 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -1203,6 +1203,12 @@ 'Mac ASan 64 Tests (1)': { # https://crbug.com/1200640 'experiment_percentage': 100, }, + 'Mac11 Tests (dbg)': { # https://crbug.com/1279504 + 'swarming': { + 'shards': 7, + }, + }, + 'Marshmallow Tablet Tester': { 'args': [ '--test-launcher-filter-file=../../testing/buildbot/filters/android.marshmallow_tablet_tester.content_browsertests.filter',
diff --git a/testing/scripts/wpt_common.py b/testing/scripts/wpt_common.py index c595654..1181b12c 100644 --- a/testing/scripts/wpt_common.py +++ b/testing/scripts/wpt_common.py
@@ -5,6 +5,7 @@ import base64 import json import os +import subprocess import sys import time @@ -112,13 +113,22 @@ self._process_wpt_report(self.wptreport) def get_wpt_revision(self): - path_to_readme = os.path.join( - common.SRC_DIR, "third_party", "wpt_tools", "README.chromium") - with open(path_to_readme) as f: - for line in f.readlines(): - if line.startswith("Version:"): - rev = line.rstrip()[len("Version:"):].strip() - return rev + """Find upstream commit id from subject of imported CLs + + An example subject as below: + 8fe6ed3939371 Import wpt@5f97bc75226f65d50f57938297a2a86d0c38cdb0 + """ + path_to_base_manifest = os.path.join( + common.SRC_DIR, "third_party", "blink", "web_tests", + "external", "WPT_BASE_MANIFEST_8.json") + command = ['git', 'log', '--oneline', '-1', + '--author=wpt-autoroller', path_to_base_manifest] + output = subprocess.check_output(command) + for line in output.decode('utf-8').splitlines(): + if "Import wpt@" in line: + pos = line.find("Import wpt@") + rev = line[pos + len("Import wpt@"):].strip() + return rev return None def _process_wpt_report(self, wptreport):
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index bad21e72e..da7b493 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -2937,35 +2937,6 @@ ] } ], - "DataReductionProxyFREPromo": [ - { - "platforms": [ - "android", - "android_weblayer" - ], - "experiments": [ - { - "name": "Enabled" - } - ] - } - ], - "DataReductionProxyLowMemoryDevicePromo": [ - { - "platforms": [ - "android", - "android_weblayer" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "DataReductionProxyLowMemoryDevicePromo" - ] - } - ] - } - ], "DefaultEnableGpuRasterization": [ { "platforms": [
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index 604ec8b4..c9f555b 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -906,7 +906,7 @@ // Allow image context menu selections to penetrate through transparent // elements. const base::Feature kEnablePenetratingImageSelection{ - "EnablePenetratingImageSelection", base::FEATURE_DISABLED_BY_DEFAULT}; + "EnablePenetratingImageSelection", base::FEATURE_ENABLED_BY_DEFAULT}; // When enabled, permits shared/root element transitions. See // https://github.com/WICG/shared-element-transitions.
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc index ac3e471..afeb7c74 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc
@@ -1440,7 +1440,7 @@ }; if (auto_repeat_track_sizes.IsEmpty()) { - if (!RuntimeEnabledFeatures::LayoutNGGridEnabled()) { + if (!RuntimeEnabledFeatures::LayoutNGEnabled()) { // If it's legacy grid or there's no repeat(), just add all the line names // and track sizes. PopulateGridTrackList(list, collector, track_sizes, getTrackSize);
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc index dff0d94..34bed06 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
@@ -1127,7 +1127,7 @@ repeated_track_sizes.push_back( ConvertGridTrackSize(state, *auto_repeat_value)); } - if (RuntimeEnabledFeatures::LayoutNGGridEnabled()) { + if (RuntimeEnabledFeatures::LayoutNGEnabled()) { track_sizes.NGTrackList().AddRepeater( repeated_track_sizes, static_cast<NGGridTrackRepeater::RepeatType>(auto_repeat_type)); @@ -1150,7 +1150,7 @@ } } - if (RuntimeEnabledFeatures::LayoutNGGridEnabled() && + if (RuntimeEnabledFeatures::LayoutNGEnabled() && (grid_axis_type == GridAxisType::kStandaloneAxis)) { Vector<GridTrackSize, 1> repeater_track_sizes; for (auto integer_repeat_value : *grid_integer_repeat_value) { @@ -1167,7 +1167,7 @@ } ConvertLineNameOrTrackSize(**curr_value); - if (RuntimeEnabledFeatures::LayoutNGGridEnabled() && + if (RuntimeEnabledFeatures::LayoutNGEnabled() && !curr_value->Get()->IsGridLineNamesValue()) { track_sizes.NGTrackList().AddRepeater( {ConvertGridTrackSize(state, **curr_value)});
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 7c483da..50e5e8d 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -5690,10 +5690,7 @@ } } -// https://html.spec.whatwg.org/C#dom-document-lastmodified -String Document::lastModified() const { - base::Time::Exploded exploded; - bool found_date = false; +absl::optional<base::Time> Document::lastModifiedTime() const { AtomicString http_last_modified = override_last_modified_; if (http_last_modified.IsEmpty()) { if (DocumentLoader* document_loader = Loader()) { @@ -5702,18 +5699,16 @@ } } if (!http_last_modified.IsEmpty()) { - absl::optional<base::Time> date_value = ParseDate(http_last_modified); - if (date_value) { - date_value.value().LocalExplode(&exploded); - found_date = true; - } + return ParseDate(http_last_modified); } - // FIXME: If this document came from the file system, the HTML5 - // specificiation tells us to read the last modification date from the file - // system. - if (!found_date) { - base::Time::Now().LocalExplode(&exploded); - } + return absl::nullopt; +} + +// https://html.spec.whatwg.org/C#dom-document-lastmodified +String Document::lastModified() const { + const base::Time time = lastModifiedTime().value_or(base::Time::Now()); + base::Time::Exploded exploded; + time.LocalExplode(&exploded); return String::Format("%02d/%02d/%04d %02d:%02d:%02d", exploded.month, exploded.day_of_month, exploded.year, exploded.hour, exploded.minute, exploded.second);
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index 061a262..1e4b628 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h
@@ -37,6 +37,7 @@ #include "base/dcheck_is_on.h" #include "base/gtest_prod_util.h" #include "base/memory/scoped_refptr.h" +#include "base/time/time.h" #include "base/timer/elapsed_timer.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "services/network/public/mojom/referrer_policy.mojom-blink-forward.h" @@ -1084,6 +1085,7 @@ void OverrideLastModified(const AtomicString& modified) { override_last_modified_ = modified; } + absl::optional<base::Time> lastModifiedTime() const; String lastModified() const; // The cookieURL is used to query the cookie database for this document's
diff --git a/third_party/blink/renderer/core/dom/document_test.cc b/third_party/blink/renderer/core/dom/document_test.cc index e43c955d..f5b7cc0 100644 --- a/third_party/blink/renderer/core/dom/document_test.cc +++ b/third_party/blink/renderer/core/dom/document_test.cc
@@ -1421,6 +1421,21 @@ } // namespace +TEST_F(DocumentSimTest, LastModified) { + const char kLastModified[] = "Tue, 15 Nov 1994 12:45:26 GMT"; + SimRequest::Params params; + params.response_http_headers = {{"Last-Modified", kLastModified}}; + SimRequest main_resource("https://example.com", "text/html", params); + LoadURL("https://example.com"); + main_resource.Finish(); + + // We test lastModifiedTime() instead of lastModified() because the latter + // returns a string in the local time zone. + base::Time time; + ASSERT_TRUE(base::Time::FromString(kLastModified, &time)); + EXPECT_EQ(time, GetDocument().lastModifiedTime()); +} + TEST_F(DocumentSimTest, DuplicatedDocumentPolicyViolationsAreIgnored) { blink::ScopedDocumentPolicyForTest scoped_document_policy(true); SimRequest::Params params;
diff --git a/third_party/blink/renderer/core/editing/local_caret_rect_test.cc b/third_party/blink/renderer/core/editing/local_caret_rect_test.cc index 991e499..73276ad 100644 --- a/third_party/blink/renderer/core/editing/local_caret_rect_test.cc +++ b/third_party/blink/renderer/core/editing/local_caret_rect_test.cc
@@ -919,7 +919,8 @@ InsertStyleElement("pre{ font: 10px/10px Ahem; width: 300px }"); const Position& caret = SetCaretTextToBody("<pre dir='ltr'>foo\n|<bdo dir='ltr'>abc</bdo></pre>"); - auto [position_rect, visible_position_rect] = GetPhysicalRects(caret); + PhysicalRect position_rect, visible_position_rect; + std::tie(position_rect, visible_position_rect) = GetPhysicalRects(caret); EXPECT_EQ(PhysicalRect(0, 10, 1, 10), position_rect); EXPECT_EQ(PhysicalRect(0, 10, 1, 10), visible_position_rect); } @@ -929,7 +930,8 @@ InsertStyleElement("pre{ font: 10px/10px Ahem; width: 300px }"); const Position& caret = SetCaretTextToBody("<pre dir='ltr'>foo\n|<bdo dir='rtl'>abc</bdo></pre>"); - auto [position_rect, visible_position_rect] = GetPhysicalRects(caret); + PhysicalRect position_rect, visible_position_rect; + std::tie(position_rect, visible_position_rect) = GetPhysicalRects(caret); EXPECT_EQ(PhysicalRect(0, 10, 1, 10), position_rect); EXPECT_EQ(PhysicalRect(0, 10, 1, 10), visible_position_rect); } @@ -939,7 +941,8 @@ InsertStyleElement("pre{ font: 10px/10px Ahem; width: 300px }"); const Position& caret = SetCaretTextToBody("<pre dir='rtl'>foo\n|<bdo dir='ltr'>abc</bdo></pre>"); - auto [position_rect, visible_position_rect] = GetPhysicalRects(caret); + PhysicalRect position_rect, visible_position_rect; + std::tie(position_rect, visible_position_rect) = GetPhysicalRects(caret); EXPECT_EQ(PhysicalRect(299, 10, 1, 10), position_rect); EXPECT_EQ(PhysicalRect(299, 10, 1, 10), visible_position_rect); } @@ -949,7 +952,8 @@ InsertStyleElement("pre{ font: 10px/10px Ahem; width: 300px }"); const Position& caret = SetCaretTextToBody("<pre dir='rtl'>foo\n|<bdo dir='rtl'>abc</bdo></pre>"); - auto [position_rect, visible_position_rect] = GetPhysicalRects(caret); + PhysicalRect position_rect, visible_position_rect; + std::tie(position_rect, visible_position_rect) = GetPhysicalRects(caret); EXPECT_EQ(PhysicalRect(299, 10, 1, 10), position_rect); EXPECT_EQ(PhysicalRect(299, 10, 1, 10), visible_position_rect); } @@ -959,7 +963,8 @@ LoadAhem(); InsertStyleElement("body { font: 10px/10px Ahem; width: 300px }"); const Position& caret = SetCaretTextToBody("<div>foo\n|</div>"); - auto [position_rect, visible_position_rect] = GetPhysicalRects(caret); + PhysicalRect position_rect, visible_position_rect; + std::tie(position_rect, visible_position_rect) = GetPhysicalRects(caret); EXPECT_EQ(PhysicalRect(30, 0, 1, 10), position_rect); EXPECT_EQ(PhysicalRect(30, 0, 1, 10), visible_position_rect); }
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc index dd163e2..4b3d2914 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -2190,7 +2190,9 @@ HTMLPortalElement* portal, mojo::PendingAssociatedReceiver<mojom::blink::Portal> portal_receiver, mojo::PendingAssociatedRemote<mojom::blink::PortalClient> portal_client) { - auto [portal_frame, portal_token] = client_->CreatePortal( + WebRemoteFrame* portal_frame; + PortalToken portal_token; + std::tie(portal_frame, portal_token) = client_->CreatePortal( std::move(portal_receiver), std::move(portal_client), portal); return {To<WebRemoteFrameImpl>(portal_frame)->GetFrame(), portal_token}; }
diff --git a/third_party/blink/renderer/core/layout/layout_object_factory.cc b/third_party/blink/renderer/core/layout/layout_object_factory.cc index dc331e6a..e8303b2 100644 --- a/third_party/blink/renderer/core/layout/layout_object_factory.cc +++ b/third_party/blink/renderer/core/layout/layout_object_factory.cc
@@ -153,11 +153,7 @@ LayoutBlock* LayoutObjectFactory::CreateGrid(Node& node, const ComputedStyle& style, LegacyLayout legacy) { - bool disable_ng_for_type = !RuntimeEnabledFeatures::LayoutNGGridEnabled(); - if (disable_ng_for_type) - UseCounter::Count(node.GetDocument(), WebFeature::kLegacyLayoutByGrid); - return CreateObject<LayoutBlock, LayoutNGGrid, LayoutGrid>( - node, legacy, disable_ng_for_type); + return CreateObject<LayoutBlock, LayoutNGGrid, LayoutGrid>(node, legacy); } LayoutBlock* LayoutObjectFactory::CreateMath(Node& node,
diff --git a/third_party/blink/renderer/core/layout/layout_outside_list_marker.cc b/third_party/blink/renderer/core/layout/layout_outside_list_marker.cc index 05b40ed..3aa27266 100644 --- a/third_party/blink/renderer/core/layout/layout_outside_list_marker.cc +++ b/third_party/blink/renderer/core/layout/layout_outside_list_marker.cc
@@ -37,7 +37,9 @@ void LayoutOutsideListMarker::UpdateMargins() { NOT_DESTROYED(); - auto [margin_start, margin_end] = ListMarker::InlineMarginsForOutside( + LayoutUnit margin_start; + LayoutUnit margin_end; + std::tie(margin_start, margin_end) = ListMarker::InlineMarginsForOutside( GetDocument(), StyleRef(), list_marker_.ListItem(*this)->StyleRef(), PreferredLogicalWidths().min_size); SetMarginStart(margin_start);
diff --git a/third_party/blink/renderer/core/layout/layout_replaced.cc b/third_party/blink/renderer/core/layout/layout_replaced.cc index c2847bed9..cd90d3c 100644 --- a/third_party/blink/renderer/core/layout/layout_replaced.cc +++ b/third_party/blink/renderer/core/layout/layout_replaced.cc
@@ -1018,7 +1018,9 @@ const PhysicalOffset& point) const { NOT_DESTROYED(); - auto [top, bottom] = SelectionTopAndBottom(*this); + LayoutUnit top; + LayoutUnit bottom; + std::tie(top, bottom) = SelectionTopAndBottom(*this); LayoutPoint flipped_point_in_container = LocationContainer()->FlipForWritingMode(point + PhysicalLocation());
diff --git a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_item.cc b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_item.cc index fef2979e..b03dac2 100644 --- a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_item.cc +++ b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_item.cc
@@ -8,65 +8,6 @@ namespace blink { -const TrackSpanProperties& GridItemData::GetTrackSpanProperties( - const GridTrackSizingDirection track_direction) const { - return (track_direction == kForColumns) ? column_span_properties - : row_span_properties; -} - -void GridItemData::SetTrackSpanProperty( - const TrackSpanProperties::PropertyId property, - const GridTrackSizingDirection track_direction) { - if (track_direction == kForColumns) - column_span_properties.SetProperty(property); - else - row_span_properties.SetProperty(property); -} - -bool GridItemData::IsSpanningFlexibleTrack( - const GridTrackSizingDirection track_direction) const { - return GetTrackSpanProperties(track_direction) - .HasProperty(TrackSpanProperties::kHasFlexibleTrack); -} - -bool GridItemData::IsSpanningIntrinsicTrack( - const GridTrackSizingDirection track_direction) const { - return GetTrackSpanProperties(track_direction) - .HasProperty(TrackSpanProperties::kHasIntrinsicTrack); -} - -bool GridItemData::IsSpanningAutoMinimumTrack( - const GridTrackSizingDirection track_direction) const { - return GetTrackSpanProperties(track_direction) - .HasProperty(TrackSpanProperties::kHasAutoMinimumTrack); -} - -bool GridItemData::IsSpanningFixedMinimumTrack( - const GridTrackSizingDirection track_direction) const { - return GetTrackSpanProperties(track_direction) - .HasProperty(TrackSpanProperties::kHasFixedMinimumTrack); -} - -bool GridItemData::IsSpanningFixedMaximumTrack( - const GridTrackSizingDirection track_direction) const { - return GetTrackSpanProperties(track_direction) - .HasProperty(TrackSpanProperties::kHasFixedMaximumTrack); -} - -bool GridItemData::IsBaselineAlignedForDirection( - const GridTrackSizingDirection track_direction) const { - return (track_direction == kForColumns) - ? InlineAxisAlignment() == AxisEdge::kBaseline - : BlockAxisAlignment() == AxisEdge::kBaseline; -} - -bool GridItemData::IsBaselineSpecifiedForDirection( - const GridTrackSizingDirection track_direction) const { - return (track_direction == kForColumns) - ? inline_axis_alignment == AxisEdge::kBaseline - : block_axis_alignment == AxisEdge::kBaseline; -} - void GridItemData::SetAlignmentFallback( const GridTrackSizingDirection track_direction, const ComputedStyle& container_style, @@ -164,18 +105,6 @@ DCHECK_LT(set_indices.begin, set_indices.end); } -const GridItemIndices& GridItemData::SetIndices( - const GridTrackSizingDirection track_direction) const { - return (track_direction == kForColumns) ? column_set_indices - : row_set_indices; -} - -GridItemIndices& GridItemData::RangeIndices( - const GridTrackSizingDirection track_direction) { - return (track_direction == kForColumns) ? column_range_indices - : row_range_indices; -} - void GridItemData::ComputeOutOfFlowItemPlacement( const NGGridLayoutAlgorithmTrackCollection& track_collection, const NGGridPlacement& grid_placement) { @@ -253,14 +182,4 @@ } } -void GridItems::Append(const GridItemData& new_item_data) { - reordered_item_indices.push_back(item_data.size()); - item_data.emplace_back(new_item_data); -} - -void GridItems::ReserveCapacity(wtf_size_t capacity) { - reordered_item_indices.ReserveCapacity(capacity); - item_data.ReserveCapacity(capacity); -} - } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_item.h b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_item.h index 9907deb..d2ce5a9e 100644 --- a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_item.h +++ b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_item.h
@@ -34,42 +34,6 @@ explicit GridItemData(const NGBlockNode node) : node(node), is_sizing_dependent_on_block_size(false) {} - bool IsOutOfFlow() const { return node.IsOutOfFlowPositioned(); } - bool IsGridContainingBlock() const { return node.IsContainingBlockNGGrid(); } - - const GridSpan& Span(GridTrackSizingDirection track_direction) const { - return resolved_position.Span(track_direction); - } - wtf_size_t StartLine(GridTrackSizingDirection track_direction) const { - return resolved_position.StartLine(track_direction); - } - wtf_size_t EndLine(GridTrackSizingDirection track_direction) const { - return resolved_position.EndLine(track_direction); - } - wtf_size_t SpanSize(GridTrackSizingDirection track_direction) const { - return resolved_position.SpanSize(track_direction); - } - - const TrackSpanProperties& GetTrackSpanProperties( - const GridTrackSizingDirection track_direction) const; - void SetTrackSpanProperty(const TrackSpanProperties::PropertyId property, - const GridTrackSizingDirection track_direction); - - bool IsSpanningFlexibleTrack( - const GridTrackSizingDirection track_direction) const; - bool IsSpanningIntrinsicTrack( - const GridTrackSizingDirection track_direction) const; - bool IsSpanningAutoMinimumTrack( - const GridTrackSizingDirection track_direction) const; - bool IsSpanningFixedMinimumTrack( - const GridTrackSizingDirection track_direction) const; - bool IsSpanningFixedMaximumTrack( - const GridTrackSizingDirection track_direction) const; - - bool IsBaselineAlignedForDirection( - const GridTrackSizingDirection track_direction) const; - bool IsBaselineSpecifiedForDirection( - const GridTrackSizingDirection track_direction) const; void SetAlignmentFallback(const GridTrackSizingDirection track_direction, const ComputedStyle& container_style, const bool has_synthesized_baseline); @@ -81,14 +45,24 @@ return block_axis_alignment_fallback.value_or(block_axis_alignment); } + bool IsBaselineAlignedForDirection( + const GridTrackSizingDirection track_direction) const { + return (track_direction == kForColumns) + ? InlineAxisAlignment() == AxisEdge::kBaseline + : BlockAxisAlignment() == AxisEdge::kBaseline; + } + bool IsBaselineSpecifiedForDirection( + const GridTrackSizingDirection track_direction) const { + return (track_direction == kForColumns) + ? inline_axis_alignment == AxisEdge::kBaseline + : block_axis_alignment == AxisEdge::kBaseline; + } + // For this item and track direction, computes the pair of indices |begin| and // |end| such that the item spans every set from the respective collection's // |sets_| with an index in the range [begin, end). void ComputeSetIndices( const NGGridLayoutAlgorithmTrackCollection& track_collection); - const GridItemIndices& SetIndices( - const GridTrackSizingDirection track_direction) const; - GridItemIndices& RangeIndices(const GridTrackSizingDirection track_direction); // For this out of flow item and track collection, computes and stores its // first and last spanned ranges, as well as the start and end track offset. @@ -97,6 +71,72 @@ const NGGridLayoutAlgorithmTrackCollection& track_collection, const NGGridPlacement& grid_placement); + const GridItemIndices& SetIndices( + const GridTrackSizingDirection track_direction) const { + return (track_direction == kForColumns) ? column_set_indices + : row_set_indices; + } + GridItemIndices& RangeIndices( + const GridTrackSizingDirection track_direction) { + return (track_direction == kForColumns) ? column_range_indices + : row_range_indices; + } + + const GridSpan& Span(const GridTrackSizingDirection track_direction) const { + return resolved_position.Span(track_direction); + } + wtf_size_t StartLine(const GridTrackSizingDirection track_direction) const { + return resolved_position.StartLine(track_direction); + } + wtf_size_t EndLine(const GridTrackSizingDirection track_direction) const { + return resolved_position.EndLine(track_direction); + } + wtf_size_t SpanSize(const GridTrackSizingDirection track_direction) const { + return resolved_position.SpanSize(track_direction); + } + + bool IsGridContainingBlock() const { return node.IsContainingBlockNGGrid(); } + bool IsOutOfFlow() const { return node.IsOutOfFlowPositioned(); } + + const TrackSpanProperties& GetTrackSpanProperties( + const GridTrackSizingDirection track_direction) const { + return (track_direction == kForColumns) ? column_span_properties + : row_span_properties; + } + void SetTrackSpanProperty(const TrackSpanProperties::PropertyId property, + const GridTrackSizingDirection track_direction) { + if (track_direction == kForColumns) + column_span_properties.SetProperty(property); + else + row_span_properties.SetProperty(property); + } + + bool IsSpanningFlexibleTrack( + const GridTrackSizingDirection track_direction) const { + return GetTrackSpanProperties(track_direction) + .HasProperty(TrackSpanProperties::kHasFlexibleTrack); + } + bool IsSpanningIntrinsicTrack( + const GridTrackSizingDirection track_direction) const { + return GetTrackSpanProperties(track_direction) + .HasProperty(TrackSpanProperties::kHasIntrinsicTrack); + } + bool IsSpanningAutoMinimumTrack( + const GridTrackSizingDirection track_direction) const { + return GetTrackSpanProperties(track_direction) + .HasProperty(TrackSpanProperties::kHasAutoMinimumTrack); + } + bool IsSpanningFixedMinimumTrack( + const GridTrackSizingDirection track_direction) const { + return GetTrackSpanProperties(track_direction) + .HasProperty(TrackSpanProperties::kHasFixedMinimumTrack); + } + bool IsSpanningFixedMaximumTrack( + const GridTrackSizingDirection track_direction) const { + return GetTrackSpanProperties(track_direction) + .HasProperty(TrackSpanProperties::kHasFixedMaximumTrack); + } + NGBlockNode node; GridArea resolved_position; @@ -175,8 +215,14 @@ } Iterator end() { return Iterator(&item_data, reordered_item_indices.end()); } - void Append(const GridItemData& new_item_data); - void ReserveCapacity(wtf_size_t capacity); + void Append(const GridItemData& new_item_data) { + reordered_item_indices.push_back(item_data.size()); + item_data.emplace_back(new_item_data); + } + void ReserveCapacity(const wtf_size_t capacity) { + reordered_item_indices.ReserveCapacity(capacity); + item_data.ReserveCapacity(capacity); + } wtf_size_t Size() const { return item_data.size(); } bool IsEmpty() const { return item_data.IsEmpty(); }
diff --git a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm_test.cc b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm_test.cc index 6154f50a..fadf381 100644 --- a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm_test.cc +++ b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm_test.cc
@@ -35,13 +35,11 @@ class NGGridLayoutAlgorithmTest : public NGBaseLayoutAlgorithmTest, - private ScopedLayoutNGGridForTest, private ScopedLayoutNGBlockFragmentationForTest, private ScopedLayoutNGSubgridForTest { protected: NGGridLayoutAlgorithmTest() - : ScopedLayoutNGGridForTest(true), - ScopedLayoutNGBlockFragmentationForTest(true), + : ScopedLayoutNGBlockFragmentationForTest(true), ScopedLayoutNGSubgridForTest(true) {} void SetUp() override { NGBaseLayoutAlgorithmTest::SetUp(); }
diff --git a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_node.cc b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_node.cc index 2e130da9..f21df7f3 100644 --- a/third_party/blink/renderer/core/layout/ng/grid/ng_grid_node.cc +++ b/third_party/blink/renderer/core/layout/ng/grid/ng_grid_node.cc
@@ -26,8 +26,7 @@ NGGridPlacement* grid_placement) const { LayoutNGGrid* layout_grid = To<LayoutNGGrid>(box_.Get()); - if (layout_grid->HasCachedPlacementData() && - RuntimeEnabledFeatures::LayoutNGGridCachingEnabled()) { + if (layout_grid->HasCachedPlacementData()) { const auto& cached_data = layout_grid->CachedPlacementData(); if (cached_data.column_auto_repetitions ==
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm_test.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm_test.cc index 9ff050db..9e98b22 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm_test.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm_test.cc
@@ -359,7 +359,9 @@ </div> )HTML"); // ** Run LayoutNG algorithm ** - auto [html_fragment, space] = RunBlockLayoutAlgorithmForElement( + NGConstraintSpace space; + scoped_refptr<const NGPhysicalBoxFragment> html_fragment; + std::tie(html_fragment, space) = RunBlockLayoutAlgorithmForElement( GetDocument().getElementsByTagName("html")->item(0)); auto* body_fragment = To<NGPhysicalBoxFragment>(html_fragment->Children()[0].get());
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.cc index 44f212c2..f68a1ea4 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_ruby_utils.cc
@@ -78,7 +78,8 @@ const LayoutUnit line_height = IsHorizontalWritingMode(writing_mode) ? rect.size.height : rect.size.width; - auto [over, under] = AdjustTextOverUnderOffsetsForEmHeight( + LayoutUnit over, under; + std::tie(over, under) = AdjustTextOverUnderOffsetsForEmHeight( LayoutUnit(), line_height, style, *shape_view); const LayoutUnit over_diff = over; const LayoutUnit under_diff = line_height - under;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm_test.cc index a9d005d..48db647 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm_test.cc
@@ -426,7 +426,9 @@ )HTML"); // ** Run LayoutNG algorithm ** - auto [fragment, space] = RunBlockLayoutAlgorithmForElement( + NGConstraintSpace space; + scoped_refptr<const NGPhysicalBoxFragment> fragment; + std::tie(fragment, space) = RunBlockLayoutAlgorithmForElement( GetDocument().getElementsByTagName("html")->item(0)); ASSERT_EQ(fragment->Children().size(), 1UL); PhysicalOffset body_offset = fragment->Children()[0].Offset(); @@ -506,7 +508,9 @@ )HTML"); // ** Run LayoutNG algorithm ** - auto [fragment, space] = RunBlockLayoutAlgorithmForElement( + NGConstraintSpace space; + scoped_refptr<const NGPhysicalBoxFragment> fragment; + std::tie(fragment, space) = RunBlockLayoutAlgorithmForElement( GetDocument().getElementsByTagName("html")->item(0)); auto* body_fragment = @@ -1206,7 +1210,9 @@ )HTML"); // ** Run LayoutNG algorithm ** - auto [fragment, space] = RunBlockLayoutAlgorithmForElement( + NGConstraintSpace space; + scoped_refptr<const NGPhysicalBoxFragment> fragment; + std::tie(fragment, space) = RunBlockLayoutAlgorithmForElement( GetDocument().getElementsByTagName("html")->item(0)); const auto* body_fragment = @@ -1309,7 +1315,9 @@ )HTML"); // ** Run LayoutNG algorithm ** - auto [fragment, space] = RunBlockLayoutAlgorithmForElement( + NGConstraintSpace space; + scoped_refptr<const NGPhysicalBoxFragment> fragment; + std::tie(fragment, space) = RunBlockLayoutAlgorithmForElement( GetDocument().getElementsByTagName("html")->item(0)); // ** Verify LayoutNG fragments and the list of positioned floats **
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index e4b9748..950c820d 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -179,8 +179,7 @@ CreateAlgorithmAndRun<NGCustomLayoutAlgorithm>(params, callback); } else if (box.IsMathML()) { DetermineMathMLAlgorithmAndRun(box, params, callback); - } else if (box.IsLayoutNGGrid() && - RuntimeEnabledFeatures::LayoutNGGridEnabled()) { + } else if (box.IsLayoutNGGrid()) { CreateAlgorithmAndRun<NGGridLayoutAlgorithm>(params, callback); } else if (box.IsLayoutReplaced()) { CreateAlgorithmAndRun<NGReplacedLayoutAlgorithm>(params, callback);
diff --git a/third_party/blink/renderer/core/layout/ng/ng_layout_result_caching_test.cc b/third_party/blink/renderer/core/layout/ng/ng_layout_result_caching_test.cc index ea5b778f..e90fa08 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_layout_result_caching_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_layout_result_caching_test.cc
@@ -16,10 +16,9 @@ // Both have layout initially performed on them, however the "src" will have a // different |NGConstraintSpace| which is then used to test either a cache hit // or miss. -class NGLayoutResultCachingTest : public NGLayoutTest, - private ScopedLayoutNGGridForTest { +class NGLayoutResultCachingTest : public NGLayoutTest { protected: - NGLayoutResultCachingTest() : ScopedLayoutNGGridForTest(true) {} + NGLayoutResultCachingTest() {} }; TEST_F(NGLayoutResultCachingTest, HitDifferentExclusionSpace) {
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment_test.cc b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment_test.cc index 0e0c604..bfefade3 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment_test.cc
@@ -75,8 +75,6 @@ // A legacy grid with another legacy grid inside, and some NG objects, too. TEST_F(NGPhysicalFragmentTest, DumpFragmentTreeWithGrid) { - if (RuntimeEnabledFeatures::LayoutNGGridEnabled()) - return; SetBodyInnerHTML(R"HTML( <div id="outer-grid" style="display:grid;"> <div id="grid-as-item" style="display:grid;"> @@ -96,13 +94,12 @@ (NG fragment root inside fragment-less or legacy subtree:) Box (block-flow-root block-flow)(self paint) offset:unplaced size:800x16 LayoutNGBlockFlow HTML Box (block-flow) offset:8,8 size:784x0 LayoutNGBlockFlow BODY - Box (block-flow-root legacy-layout-root) offset:0,0 size:784x0 LayoutGrid DIV id='outer-grid' - (NG fragment root inside fragment-less or legacy subtree:) - Box (block-flow-root block-flow) offset:unplaced size:784x0 LayoutNGBlockFlow DIV id='inner-grid-item' + Box (block-flow-root) offset:0,0 size:784x0 LayoutNGGrid DIV id='outer-grid' + Box (block-flow-root) offset:0,0 size:784x0 LayoutNGGrid DIV id='grid-as-item' + Box (block-flow-root block-flow) offset:0,0 size:784x0 LayoutNGBlockFlow DIV id='inner-grid-item' Box (block-flow) offset:0,0 size:784x0 LayoutNGBlockFlow DIV id='foo' - (NG fragment root inside fragment-less or legacy subtree:) - Box (block-flow-root block-flow) offset:unplaced size:784x0 LayoutNGBlockFlow DIV id='block-container-item' - Box (block-flow) offset:0,0 size:784x0 LayoutNGBlockFlow DIV id='bar' + Box (block-flow-root block-flow) offset:0,0 size:784x0 LayoutNGBlockFlow DIV id='block-container-item' + Box (block-flow) offset:0,0 size:784x0 LayoutNGBlockFlow DIV id='bar' )DUMP"; EXPECT_EQ(expectation, dump); }
diff --git a/third_party/blink/renderer/core/layout/ng/svg/ng_svg_text_query.cc b/third_party/blink/renderer/core/layout/ng/svg/ng_svg_text_query.cc index 85eb3a5..1b1c072 100644 --- a/third_party/blink/renderer/core/layout/ng/svg/ng_svg_text_query.cc +++ b/third_party/blink/renderer/core/layout/ng/svg/ng_svg_text_query.cc
@@ -84,7 +84,9 @@ std::tuple<const NGFragmentItem*, StringView, unsigned, unsigned> FindFragmentItemForAddressableCodeUnitIndex(const LayoutObject& query_root, unsigned index) { - auto [item_list, items] = FragmentItemsInLogicalOrder(query_root); + Vector<const NGFragmentItem*> item_list; + const NGFragmentItems* items; + std::tie(item_list, items) = FragmentItemsInLogicalOrder(query_root); unsigned character_index = 0; for (const auto* item : item_list) { @@ -132,7 +134,10 @@ std::tuple<const NGFragmentItem*, gfx::RectF> ScaledCharacterRectInContainer( const LayoutObject& query_root, unsigned code_unit_index) { - auto [item, item_text, start_ifc_offset, end_ifc_offset] = + const NGFragmentItem* item; + unsigned start_ifc_offset, end_ifc_offset; + StringView item_text; + std::tie(item, item_text, start_ifc_offset, end_ifc_offset) = FindFragmentItemForAddressableCodeUnitIndex(query_root, code_unit_index); DCHECK(item); DCHECK_EQ(item->Type(), NGFragmentItem::kSvgText); @@ -148,7 +153,9 @@ gfx::PointF StartOrEndPosition(const LayoutObject& query_root, unsigned index, QueryPosition pos) { - auto [item, char_rect] = ScaledCharacterRectInContainer(query_root, index); + const NGFragmentItem* item; + gfx::RectF char_rect; + std::tie(item, char_rect) = ScaledCharacterRectInContainer(query_root, index); DCHECK_EQ(item->Type(), NGFragmentItem::kSvgText); if (item->IsHiddenForPaint()) return gfx::PointF(); @@ -177,7 +184,9 @@ } // namespace unsigned NGSvgTextQuery::NumberOfCharacters() const { - auto [item_list, items] = FragmentItemsInLogicalOrder(query_root_); + Vector<const NGFragmentItem*> item_list; + const NGFragmentItems* items; + std::tie(item_list, items) = FragmentItemsInLogicalOrder(query_root_); unsigned addressable_code_unit_count = 0; for (const auto* item : item_list) @@ -189,7 +198,9 @@ unsigned length) const { if (length <= 0) return 0.0f; - auto [item_list, items] = FragmentItemsInLogicalOrder(query_root_); + Vector<const NGFragmentItem*> item_list; + const NGFragmentItems* items; + std::tie(item_list, items) = FragmentItemsInLogicalOrder(query_root_); float total_length = 0.0f; // Starting addressable code unit index for the current NGFragmentItem. @@ -223,7 +234,10 @@ } gfx::RectF NGSvgTextQuery::ExtentOfCharacter(unsigned index) const { - auto [item, char_rect] = ScaledCharacterRectInContainer(query_root_, index); + const NGFragmentItem* item; + gfx::RectF char_rect; + std::tie(item, char_rect) = + ScaledCharacterRectInContainer(query_root_, index); DCHECK_EQ(item->Type(), NGFragmentItem::kSvgText); if (item->IsHiddenForPaint()) return gfx::RectF(); @@ -234,7 +248,10 @@ } float NGSvgTextQuery::RotationOfCharacter(unsigned index) const { - auto [item, item_text, start_ifc_offset, end_ifc_offset] = + const NGFragmentItem* item; + unsigned start_ifc_offset, end_ifc_offset; + StringView item_text; + std::tie(item, item_text, start_ifc_offset, end_ifc_offset) = FindFragmentItemForAddressableCodeUnitIndex(query_root_, index); DCHECK(item); DCHECK_EQ(item->Type(), NGFragmentItem::kSvgText); @@ -265,7 +282,9 @@ // The specification says we should do hit-testing in logical order. // However, this does it in visual order in order to match to the legacy SVG // <text> behavior. - auto [item_list, items] = FragmentItemsInVisualOrder(query_root_); + Vector<const NGFragmentItem*> item_list; + const NGFragmentItems* items; + std::tie(item_list, items) = FragmentItemsInVisualOrder(query_root_); const NGFragmentItem* hit_item = nullptr; for (const auto* item : item_list) {
diff --git a/third_party/blink/renderer/core/loader/modulescript/document_module_script_fetcher.cc b/third_party/blink/renderer/core/loader/modulescript/document_module_script_fetcher.cc index 48f1cfb..4b1c65b 100644 --- a/third_party/blink/renderer/core/loader/modulescript/document_module_script_fetcher.cc +++ b/third_party/blink/renderer/core/loader/modulescript/document_module_script_fetcher.cc
@@ -55,7 +55,9 @@ } } // Check if we can use the script streamer. - auto [streamer, not_streamed_reason] = ScriptStreamer::TakeFrom( + ScriptStreamer* streamer; + ScriptStreamer::NotStreamingReason not_streamed_reason; + std::tie(streamer, not_streamed_reason) = ScriptStreamer::TakeFrom( script_resource, mojom::blink::ScriptType::kModule); ScriptStreamer::RecordStreamingHistogram(ScriptSchedulingType::kAsync,
diff --git a/third_party/blink/renderer/core/style/grid_area.h b/third_party/blink/renderer/core/style/grid_area.h index 5688002..8ce6072e 100644 --- a/third_party/blink/renderer/core/style/grid_area.h +++ b/third_party/blink/renderer/core/style/grid_area.h
@@ -171,7 +171,7 @@ } #endif - const int grid_max_tracks = RuntimeEnabledFeatures::LayoutNGGridEnabled() + const int grid_max_tracks = RuntimeEnabledFeatures::LayoutNGEnabled() ? kGridMaxTracks : kLegacyGridMaxTracks;
diff --git a/third_party/blink/renderer/core/style/grid_track_list.cc b/third_party/blink/renderer/core/style/grid_track_list.cc index bf21025f..b64f1fba 100644 --- a/third_party/blink/renderer/core/style/grid_track_list.cc +++ b/third_party/blink/renderer/core/style/grid_track_list.cc
@@ -166,7 +166,7 @@ } GridTrackList::GridTrackList(const GridTrackSize& default_track_size) { - if (RuntimeEnabledFeatures::LayoutNGGridEnabled()) + if (RuntimeEnabledFeatures::LayoutNGEnabled()) ng_track_list_.AddRepeater({default_track_size}); legacy_track_list_.push_back(default_track_size); @@ -174,7 +174,7 @@ GridTrackList::GridTrackList(Vector<GridTrackSize, 1>& legacy_tracks) : legacy_track_list_(std::move(legacy_tracks)) { - if (RuntimeEnabledFeatures::LayoutNGGridEnabled()) + if (RuntimeEnabledFeatures::LayoutNGEnabled()) ng_track_list_.AddRepeater(legacy_track_list_); } @@ -187,11 +187,11 @@ } NGGridTrackList& GridTrackList::NGTrackList() { - DCHECK(RuntimeEnabledFeatures::LayoutNGGridEnabled()); + DCHECK(RuntimeEnabledFeatures::LayoutNGEnabled()); return ng_track_list_; } const NGGridTrackList& GridTrackList::NGTrackList() const { - DCHECK(RuntimeEnabledFeatures::LayoutNGGridEnabled()); + DCHECK(RuntimeEnabledFeatures::LayoutNGEnabled()); return ng_track_list_; } @@ -200,7 +200,7 @@ } bool GridTrackList::operator==(const GridTrackList& other) const { - if (RuntimeEnabledFeatures::LayoutNGGridEnabled()) + if (RuntimeEnabledFeatures::LayoutNGEnabled()) return ng_track_list_ == other.ng_track_list_; return LegacyTrackList() == other.LegacyTrackList(); @@ -211,7 +211,7 @@ } void GridTrackList::AssignFrom(const GridTrackList& other) { - if (RuntimeEnabledFeatures::LayoutNGGridEnabled()) + if (RuntimeEnabledFeatures::LayoutNGEnabled()) ng_track_list_ = other.ng_track_list_; legacy_track_list_ = other.legacy_track_list_;
diff --git a/third_party/blink/renderer/modules/mediasource/media_source.cc b/third_party/blink/renderer/modules/mediasource/media_source.cc index 7ccfa87..d310d65a 100644 --- a/third_party/blink/renderer/modules/mediasource/media_source.cc +++ b/third_party/blink/renderer/modules/mediasource/media_source.cc
@@ -682,7 +682,9 @@ // method directly. bool MediaSource::RunUnlessElementGoneOrClosingUs( MediaSourceAttachmentSupplement::RunExclusivelyCB cb) { - auto [attachment, tracer] = AttachmentAndTracer(); + scoped_refptr<MediaSourceAttachmentSupplement> attachment; + MediaSourceTracer* tracer; + std::tie(attachment, tracer) = AttachmentAndTracer(); DCHECK(IsMainThread() || !tracer); // Cross-thread attachments do not use a tracer. @@ -1058,7 +1060,9 @@ // 6. Update the media controller duration to new duration and run the // HTMLMediaElement duration change algorithm. - auto [attachment, tracer] = AttachmentAndTracer(); + scoped_refptr<MediaSourceAttachmentSupplement> attachment; + MediaSourceTracer* tracer; + std::tie(attachment, tracer) = AttachmentAndTracer(); attachment->NotifyDurationChanged(tracer, new_duration); } @@ -1296,7 +1300,9 @@ // to just mark end of stream, and move the duration reduction logic to here // so we can just run DurationChangeAlgorithm(...) here. double new_duration = GetDuration_Locked(pass_key); - auto [attachment, tracer] = AttachmentAndTracer(); + scoped_refptr<MediaSourceAttachmentSupplement> attachment; + MediaSourceTracer* tracer; + std::tie(attachment, tracer) = AttachmentAndTracer(); attachment->NotifyDurationChanged(tracer, new_duration); } else { // Even though error didn't change duration, the transition to kEnded
diff --git a/third_party/blink/renderer/modules/mediasource/source_buffer.cc b/third_party/blink/renderer/modules/mediasource/source_buffer.cc index 151473f..929f8122 100644 --- a/third_party/blink/renderer/modules/mediasource/source_buffer.cc +++ b/third_party/blink/renderer/modules/mediasource/source_buffer.cc
@@ -219,7 +219,9 @@ DCHECK(web_source_buffer_); DCHECK(source_); - auto [attachment, tracer] = source_->AttachmentAndTracer(); + scoped_refptr<MediaSourceAttachmentSupplement> attachment; + MediaSourceTracer* tracer; + std::tie(attachment, tracer) = source_->AttachmentAndTracer(); DCHECK(attachment); if (GetExecutionContext()->IsWindow()) { @@ -1229,7 +1231,9 @@ DCHECK(HTMLMediaElement::MediaTracksEnabledInternally()); DCHECK(source_); - auto [attachment, tracer] = source_->AttachmentAndTracer(); + scoped_refptr<MediaSourceAttachmentSupplement> attachment; + MediaSourceTracer* tracer; + std::tie(attachment, tracer) = source_->AttachmentAndTracer(); DCHECK(attachment); // One path leading to here is from |source_|'s ContextDestroyed(), so we @@ -1341,7 +1345,9 @@ double SourceBuffer::GetMediaTime() { DCHECK(source_); - auto [attachment, tracer] = source_->AttachmentAndTracer(); + scoped_refptr<MediaSourceAttachmentSupplement> attachment; + MediaSourceTracer* tracer; + std::tie(attachment, tracer) = source_->AttachmentAndTracer(); DCHECK(attachment); return attachment->GetRecentMediaTime(tracer).InSecondsF(); } @@ -1515,7 +1521,9 @@ DCHECK(source_); source_->AssertAttachmentsMutexHeldIfCrossThreadForDebugging(); - auto [attachment, tracer] = source_->AttachmentAndTracer(); + scoped_refptr<MediaSourceAttachmentSupplement> attachment; + MediaSourceTracer* tracer; + std::tie(attachment, tracer) = source_->AttachmentAndTracer(); DCHECK(attachment); DCHECK_EQ(!tracer, !IsMainThread()); @@ -1923,7 +1931,9 @@ // 3. If the HTMLMediaElement.error attribute is not null, then throw an // InvalidStateError exception and abort these steps. DCHECK(source_); - auto [attachment, tracer] = source_->AttachmentAndTracer(); + scoped_refptr<MediaSourceAttachmentSupplement> attachment; + MediaSourceTracer* tracer; + std::tie(attachment, tracer) = source_->AttachmentAndTracer(); DCHECK(attachment); DCHECK_EQ(!tracer, !IsMainThread()); if (attachment->GetElementError(tracer)) {
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.cc b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.cc index 2337161..1b80be4 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.cc
@@ -864,7 +864,8 @@ absl::optional<int> requested_buffer_size; if (processing_type_ == ProcessingType::kUnprocessed && latency && !constraint_set.latency.IsUnconstrained()) { - auto [min_buffer_size, max_buffer_size] = + int min_buffer_size, max_buffer_size; + std::tie(min_buffer_size, max_buffer_size) = GetMinMaxBufferSizesForAudioParameters(parameters); requested_buffer_size = media::AudioLatency::GetExactBufferSize( base::Seconds(*latency), parameters.sample_rate(), @@ -1065,7 +1066,8 @@ case ProcessingType::kNoApmProcessed: return DoubleRangeSet::FromValue(allowed_latency); case ProcessingType::kUnprocessed: - auto [min_latency, max_latency] = + double min_latency, max_latency; + std::tie(min_latency, max_latency) = GetMinMaxLatenciesForAudioParameters(device_parameters); return DoubleRangeSet(min_latency, max_latency); } @@ -1210,9 +1212,12 @@ std::string default_device_id) const { DCHECK(!IsEmpty()); Score score(0.0); + double sub_score = 0.0; - auto [sub_score, device_id] = device_id_container_.SelectSettingsAndScore( - constraint_set.device_id, default_device_id); + std::string device_id; + std::tie(sub_score, device_id) = + device_id_container_.SelectSettingsAndScore(constraint_set.device_id, + default_device_id); score += sub_score; std::tie(sub_score, std::ignore) = @@ -1245,8 +1250,12 @@ if (container.IsEmpty()) continue; - auto [container_score, container_properties, requested_buffer_size, - num_channels] = + Score container_score(0.0); + AudioProcessingProperties container_properties; + absl::optional<int> requested_buffer_size; + int num_channels; + std::tie(container_score, container_properties, requested_buffer_size, + num_channels) = container.SelectSettingsAndScore( constraint_set, should_disable_hardware_noise_suppression, device_parameters_); @@ -1413,7 +1422,9 @@ AudioCaptureSettings best_settings; Score best_score(-1.0); for (const auto& candidate : devices_) { - auto [score, settings] = candidate.SelectSettingsAndScore( + Score score(0.0); + AudioCaptureSettings settings; + std::tie(score, settings) = candidate.SelectSettingsAndScore( constraint_set, is_desktop_source, should_disable_hardware_noise_suppression, default_device_id_); @@ -1607,7 +1618,8 @@ std::tuple<double, double> GetMinMaxLatenciesForAudioParameters( const media::AudioParameters& parameters) { - auto [min_buffer_size, max_buffer_size] = + int min_buffer_size, max_buffer_size; + std::tie(min_buffer_size, max_buffer_size) = GetMinMaxBufferSizesForAudioParameters(parameters); // Doing the microseconds conversion to match what is done in
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_content.cc b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_content.cc index eca856b..9696fe0f 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_content.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_content.cc
@@ -15,6 +15,7 @@ #include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_sets.h" #include "third_party/blink/renderer/platform/mediastream/media_constraints.h" +#include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { @@ -202,7 +203,9 @@ media::VideoCaptureParams params; params.requested_format = media::VideoCaptureFormat( ToGfxSize(requested_resolution), static_cast<float>(requested_frame_rate), - media::PIXEL_FORMAT_I420); + RuntimeEnabledFeatures::ZeroCopyTabCaptureEnabled() + ? media::PIXEL_FORMAT_NV12 + : media::PIXEL_FORMAT_I420); params.resolution_change_policy = SelectResolutionPolicyFromCandidates( candidates.resolution_set(), default_resolution_policy); // Content capture always uses default power-line frequency.
diff --git a/third_party/blink/renderer/modules/native_io/native_io_file.cc b/third_party/blink/renderer/modules/native_io/native_io_file.cc index 8041bb4..16b8eed 100644 --- a/third_party/blink/renderer/modules/native_io/native_io_file.cc +++ b/third_party/blink/renderer/modules/native_io/native_io_file.cc
@@ -621,7 +621,9 @@ << "File I/O operation queued after file closed"; DCHECK(resolver_task_runner); - auto [length, get_length_error] = file_state->GetLength(); + int64_t length; + base::File::Error get_length_error; + std::tie(length, get_length_error) = file_state->GetLength(); PostCrossThreadTask( *resolver_task_runner, FROM_HERE, @@ -678,7 +680,9 @@ DCHECK(resolver_task_runner); DCHECK_GE(expected_length, 0); - auto [actual_length, set_length_error] = + int64_t actual_length; + base::File::Error set_length_error; + std::tie(actual_length, set_length_error) = file_state->SetLength(expected_length); PostCrossThreadTask( @@ -810,7 +814,9 @@ DCHECK_LE(static_cast<size_t>(read_size), result_buffer_data->DataLength()); #endif // DCHECK_IS_ON() - auto [read_bytes, read_error] = + int read_bytes; + base::File::Error read_error; + std::tie(read_bytes, read_error) = file_state->Read(result_buffer_data.get(), file_offset, read_size); PostCrossThreadTask( @@ -873,7 +879,10 @@ DCHECK_LE(static_cast<size_t>(write_size), result_buffer_data->DataLength()); #endif // DCHECK_IS_ON() - auto [actual_file_length_on_failure, written_bytes, write_error] = + int written_bytes; + int64_t actual_file_length_on_failure = 0; + base::File::Error write_error; + std::tie(actual_file_length_on_failure, written_bytes, write_error) = file_state->Write(result_buffer_data.get(), file_offset, write_size); PostCrossThreadTask(
diff --git a/third_party/blink/renderer/modules/webaudio/audio_param.cc b/third_party/blink/renderer/modules/webaudio/audio_param.cc index bd8da8a4..c226481 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_param.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_param.cc
@@ -169,7 +169,9 @@ // Update value for timeline. float v = IntrinsicValue(); if (GetDeferredTaskHandler().IsAudioThread()) { - auto [has_value, timeline_value] = timeline_.ValueForContextTime( + bool has_value; + float timeline_value; + std::tie(has_value, timeline_value) = timeline_.ValueForContextTime( DestinationHandler(), v, MinValue(), MaxValue(), GetDeferredTaskHandler().RenderQuantumFrames()); @@ -198,7 +200,9 @@ bool AudioParamHandler::Smooth() { // If values have been explicitly scheduled on the timeline, then use the // exact value. Smoothing effectively is performed by the timeline. - auto [use_timeline_value, value] = timeline_.ValueForContextTime( + bool use_timeline_value = false; + float value; + std::tie(use_timeline_value, value) = timeline_.ValueForContextTime( DestinationHandler(), IntrinsicValue(), MinValue(), MaxValue(), GetDeferredTaskHandler().RenderQuantumFrames()); @@ -304,8 +308,10 @@ CalculateTimelineValues(values, number_of_values); } else { // Calculate control-rate (k-rate) intrinsic value. + bool has_value; float value = IntrinsicValue(); - auto [has_value, timeline_value] = timeline_.ValueForContextTime( + float timeline_value; + std::tie(has_value, timeline_value) = timeline_.ValueForContextTime( DestinationHandler(), value, MinValue(), MaxValue(), GetDeferredTaskHandler().RenderQuantumFrames());
diff --git a/third_party/blink/renderer/modules/webaudio/audio_param_timeline.cc b/third_party/blink/renderer/modules/webaudio/audio_param_timeline.cc index 7d6f8cae..81e3643 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_param_timeline.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_param_timeline.cc
@@ -970,11 +970,14 @@ } // Maintain a running time (frame) and index for writing the values buffer. + size_t current_frame = start_frame; + unsigned write_index = 0; + // If first event is after startFrame then fill initial part of values buffer // with defaultValue until we reach the first event time. - auto [current_frame, write_index] = + std::tie(current_frame, write_index) = HandleFirstEvent(values, default_value, number_of_values, start_frame, - end_frame, sample_rate, start_frame, 0); + end_frame, sample_rate, current_frame, write_index); float value = default_value; @@ -997,19 +1000,23 @@ } // If there's no next event, set nextEventType to LastType to indicate that. - ProcessSetTargetFollowedByRamp( - i, event, + ParamEvent::Type next_event_type = next_event ? static_cast<ParamEvent::Type>(next_event->GetType()) - : ParamEvent::kLastType, - current_frame, sample_rate, control_rate, value); + : ParamEvent::kLastType; + + ProcessSetTargetFollowedByRamp(i, event, next_event_type, current_frame, + sample_rate, control_rate, value); float value1 = event->Value(); double time1 = event->Time(); + float value2 = next_event ? next_event->Value() : value1; + double time2 = + next_event ? next_event->Time() : end_frame / sample_rate + 1; + // Check to see if an event was cancelled. - auto [value2, time2, next_event_type] = HandleCancelValues( - event, next_event, next_event ? next_event->Value() : value1, - next_event ? next_event->Time() : end_frame / sample_rate + 1); + std::tie(value2, time2, next_event_type) = + HandleCancelValues(event, next_event, value2, time2); DCHECK(!std::isnan(value1)); DCHECK(!std::isnan(value2));
diff --git a/third_party/blink/renderer/modules/webgpu/gpu.idl b/third_party/blink/renderer/modules/webgpu/gpu.idl index 3b67a13..0774177 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu.idl
@@ -21,7 +21,8 @@ typedef (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict) GPUOrigin3D; [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPU { [ RuntimeEnabled=WebGPU,
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_adapter.idl b/third_party/blink/renderer/modules/webgpu/gpu_adapter.idl index 221ee04e..0d2c36c 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_adapter.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_adapter.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUAdapter { [HighEntropy=Direct, MeasureAs=GPUAdapter_Name] readonly attribute DOMString name; [SameObject] readonly attribute GPUSupportedFeatures features;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_bind_group.idl b/third_party/blink/renderer/modules/webgpu/gpu_bind_group.idl index 8f6ea19..bf11131 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_bind_group.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_bind_group.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUBindGroup { }; GPUBindGroup includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_bind_group_layout.idl b/third_party/blink/renderer/modules/webgpu/gpu_bind_group_layout.idl index 470552ff..f58642b8 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_bind_group_layout.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_bind_group_layout.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUBindGroupLayout { }; GPUBindGroupLayout includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_buffer.idl b/third_party/blink/renderer/modules/webgpu/gpu_buffer.idl index 7b949b6..33ad997 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_buffer.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_buffer.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUBuffer { [CallWith=ScriptState, RaisesException] Promise<void> mapAsync( GPUMapModeFlags mode,
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.idl b/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.idl index 9989000..e79a22f 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.idl
@@ -6,7 +6,8 @@ typedef [EnforceRange] unsigned long GPUBufferUsageFlags; [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] namespace GPUBufferUsage { const unsigned long MAP_READ = 1; const unsigned long MAP_WRITE = 2;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.idl b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.idl index 6457611..c22ea1b 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_canvas_context.idl
@@ -5,8 +5,9 @@ // https://gpuweb.github.io/gpuweb/ [ - ActiveScriptWrappable, - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext, + ActiveScriptWrappable ] interface GPUCanvasContext { [ImplementedAs=getHTMLOrOffscreenCanvas] readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_color_write.idl b/third_party/blink/renderer/modules/webgpu/gpu_color_write.idl index 1c11e989..aabcd4ab 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_color_write.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_color_write.idl
@@ -6,7 +6,8 @@ typedef [EnforceRange] unsigned long GPUColorWriteFlags; [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] namespace GPUColorWrite { const unsigned long RED = 1; const unsigned long GREEN = 2;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_command_buffer.idl b/third_party/blink/renderer/modules/webgpu/gpu_command_buffer.idl index 7de4d14d..d95ebed 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_command_buffer.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_command_buffer.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUCommandBuffer { }; GPUCommandBuffer includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_command_encoder.idl b/third_party/blink/renderer/modules/webgpu/gpu_command_encoder.idl index 2bbfd23..95d653a 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_command_encoder.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_command_encoder.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUCommandEncoder { [RaisesException] GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {});
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_compilation_info.idl b/third_party/blink/renderer/modules/webgpu/gpu_compilation_info.idl index fc2da3da..ee21234 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_compilation_info.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_compilation_info.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUCompilationInfo { readonly attribute FrozenArray<GPUCompilationMessage> messages; -}; \ No newline at end of file +};
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_compilation_message.idl b/third_party/blink/renderer/modules/webgpu/gpu_compilation_message.idl index 7578f938..b425602b 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_compilation_message.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_compilation_message.idl
@@ -11,7 +11,8 @@ }; [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUCompilationMessage { readonly attribute DOMString message; readonly attribute GPUCompilationMessageType type; @@ -19,4 +20,4 @@ readonly attribute unsigned long long linePos; readonly attribute unsigned long long offset; readonly attribute unsigned long long length; -}; \ No newline at end of file +};
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_compute_pass_encoder.idl b/third_party/blink/renderer/modules/webgpu/gpu_compute_pass_encoder.idl index 4a0d017b..f722416 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_compute_pass_encoder.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_compute_pass_encoder.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUComputePassEncoder { void setPipeline(GPUComputePipeline pipeline); void dispatch(GPUSize32 x,
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_compute_pipeline.idl b/third_party/blink/renderer/modules/webgpu/gpu_compute_pipeline.idl index 49f28bc6..8e12641 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_compute_pipeline.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_compute_pipeline.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUComputePipeline { }; GPUComputePipeline includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_device.idl b/third_party/blink/renderer/modules/webgpu/gpu_device.idl index 9d17fdf..0f7f075e 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_device.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_device.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUDevice : EventTarget { [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_device_lost_info.idl b/third_party/blink/renderer/modules/webgpu/gpu_device_lost_info.idl index c7957aad..2dde962b 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_device_lost_info.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_device_lost_info.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUDeviceLostInfo { readonly attribute DOMString message; };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_external_texture.idl b/third_party/blink/renderer/modules/webgpu/gpu_external_texture.idl index ad73754..33262786 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_external_texture.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_external_texture.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUExternalTexture { }; -GPUExternalTexture includes GPUObjectBase; \ No newline at end of file +GPUExternalTexture includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_map_mode.idl b/third_party/blink/renderer/modules/webgpu/gpu_map_mode.idl index 8bae3f86..98beea8 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_map_mode.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_map_mode.idl
@@ -6,7 +6,8 @@ typedef [EnforceRange] unsigned long GPUMapModeFlags; [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] namespace GPUMapMode { const unsigned long READ = 0x0001; const unsigned long WRITE = 0x0002;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_out_of_memory_error.idl b/third_party/blink/renderer/modules/webgpu/gpu_out_of_memory_error.idl index 495f4d8..535be5b 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_out_of_memory_error.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_out_of_memory_error.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUOutOfMemoryError { constructor(); };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_pipeline_layout.idl b/third_party/blink/renderer/modules/webgpu/gpu_pipeline_layout.idl index a73fcfd..3687a8c 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_pipeline_layout.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_pipeline_layout.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUPipelineLayout { }; GPUPipelineLayout includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_programmable_pass_encoder.idl b/third_party/blink/renderer/modules/webgpu/gpu_programmable_pass_encoder.idl index 30fba634d..b2f0791 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_programmable_pass_encoder.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_programmable_pass_encoder.idl
@@ -4,9 +4,7 @@ // https://gpuweb.github.io/gpuweb/ -[ - RuntimeEnabled=WebGPU -] interface mixin GPUProgrammablePassEncoder { +interface mixin GPUProgrammablePassEncoder { void setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup, optional sequence<GPUBufferDynamicOffset> dynamicOffsets);
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_query_set.idl b/third_party/blink/renderer/modules/webgpu/gpu_query_set.idl index 97414dd0..c37c47a 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_query_set.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_query_set.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUQuerySet { void destroy(); };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_queue.idl b/third_party/blink/renderer/modules/webgpu/gpu_queue.idl index f5438bd..ca3b535 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_queue.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_queue.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUQueue { void submit(sequence<GPUCommandBuffer> buffers);
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.idl index 9f7a6e1..cbee455 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPURenderBundle { }; GPURenderBundle includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.idl index 4fd9caf..132d4f7 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_bundle_encoder.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPURenderBundleEncoder { GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_encoder_base.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_encoder_base.idl index 3ad2646..0f1c6ce 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_render_encoder_base.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_encoder_base.idl
@@ -4,9 +4,7 @@ // https://gpuweb.github.io/gpuweb/ -[ - RuntimeEnabled=WebGPU -] interface mixin GPURenderEncoderBase { +interface mixin GPURenderEncoderBase { void setPipeline(GPURenderPipeline pipeline); void setIndexBuffer(GPUBuffer buffer,
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.idl index e9252c4..1c21f8e 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_pass_encoder.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPURenderPassEncoder { void setViewport(float x, float y, float width, float height,
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_render_pipeline.idl b/third_party/blink/renderer/modules/webgpu/gpu_render_pipeline.idl index be42ba1..bdba7a7d 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_render_pipeline.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_render_pipeline.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPURenderPipeline { }; GPURenderPipeline includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_sampler.idl b/third_party/blink/renderer/modules/webgpu/gpu_sampler.idl index 25036e8e..f3d701f 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_sampler.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_sampler.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUSampler { }; GPUSampler includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_shader_module.idl b/third_party/blink/renderer/modules/webgpu/gpu_shader_module.idl index b9caa30..ad0e1b4 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_shader_module.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_shader_module.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUShaderModule { [CallWith=ScriptState] Promise<GPUCompilationInfo> compilationInfo(); };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl b/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl index 9259b577..0e7a4b9 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl
@@ -6,7 +6,8 @@ typedef [EnforceRange] unsigned long GPUShaderStageFlags; [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] namespace GPUShaderStage { const unsigned long VERTEX = 1; const unsigned long FRAGMENT = 2;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_supported_features.idl b/third_party/blink/renderer/modules/webgpu/gpu_supported_features.idl index 2c13acb9..6ad242b4 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_supported_features.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_supported_features.idl
@@ -15,7 +15,8 @@ }; [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUSupportedFeatures { readonly setlike<DOMString>; };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_supported_limits.idl b/third_party/blink/renderer/modules/webgpu/gpu_supported_limits.idl index 27108ab..ff64b9a 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_supported_limits.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_supported_limits.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUSupportedLimits { readonly attribute unsigned long maxTextureDimension1D; readonly attribute unsigned long maxTextureDimension2D; @@ -33,4 +34,4 @@ readonly attribute unsigned long maxComputeWorkgroupSizeY; readonly attribute unsigned long maxComputeWorkgroupSizeZ; readonly attribute unsigned long maxComputeWorkgroupsPerDimension; -}; \ No newline at end of file +};
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_texture.idl b/third_party/blink/renderer/modules/webgpu/gpu_texture.idl index b452382..2010b15 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_texture.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_texture.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUTexture { GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); void destroy();
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.idl b/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.idl index 97759db5..7ee7e84 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.idl
@@ -6,7 +6,8 @@ typedef [EnforceRange] unsigned long GPUTextureUsageFlags; [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] namespace GPUTextureUsage { const unsigned long COPY_SRC = 1; const unsigned long COPY_DST = 2;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_texture_view.idl b/third_party/blink/renderer/modules/webgpu/gpu_texture_view.idl index 0b9b79d..43e59b9 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_texture_view.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_texture_view.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUTextureView { }; GPUTextureView includes GPUObjectBase;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_uncaptured_error_event.idl b/third_party/blink/renderer/modules/webgpu/gpu_uncaptured_error_event.idl index 6df8aaf..7f36e6a 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_uncaptured_error_event.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_uncaptured_error_event.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUUncapturedErrorEvent : Event { constructor(DOMString type, GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict); [SameObject] readonly attribute GPUError error;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_validation_error.idl b/third_party/blink/renderer/modules/webgpu/gpu_validation_error.idl index 16fb280..267f79b 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_validation_error.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_validation_error.idl
@@ -5,7 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed(Window WebGPU, Worker WebGPU) + Exposed(Window WebGPU, DedicatedWorker WebGPU), + SecureContext ] interface GPUValidationError { constructor(DOMString message); readonly attribute DOMString message;
diff --git a/third_party/blink/renderer/modules/webgpu/navigator_gpu.idl b/third_party/blink/renderer/modules/webgpu/navigator_gpu.idl index 29a6f57..476cbb8 100644 --- a/third_party/blink/renderer/modules/webgpu/navigator_gpu.idl +++ b/third_party/blink/renderer/modules/webgpu/navigator_gpu.idl
@@ -8,5 +8,5 @@ Exposed=Window, ImplementedAs=GPU ] partial interface Navigator { - [SameObject, RuntimeEnabled=WebGPU] readonly attribute GPU gpu; + [SameObject, SecureContext, RuntimeEnabled=WebGPU] readonly attribute GPU gpu; };
diff --git a/third_party/blink/renderer/modules/webgpu/worker_navigator_gpu.idl b/third_party/blink/renderer/modules/webgpu/worker_navigator_gpu.idl index 28279fc..a26a691 100644 --- a/third_party/blink/renderer/modules/webgpu/worker_navigator_gpu.idl +++ b/third_party/blink/renderer/modules/webgpu/worker_navigator_gpu.idl
@@ -5,8 +5,8 @@ // https://gpuweb.github.io/gpuweb/ [ - Exposed=Worker, + Exposed=DedicatedWorker, ImplementedAs=GPU ] partial interface WorkerNavigator { - [SameObject, RuntimeEnabled=WebGPU] readonly attribute GPU gpu; + [SameObject, SecureContext, RuntimeEnabled=WebGPU] readonly attribute GPU gpu; };
diff --git a/third_party/blink/renderer/platform/fonts/simple_font_data.cc b/third_party/blink/renderer/platform/fonts/simple_font_data.cc index 6af1dae..f4f53d7 100644 --- a/third_party/blink/renderer/platform/fonts/simple_font_data.cc +++ b/third_party/blink/renderer/platform/fonts/simple_font_data.cc
@@ -314,7 +314,8 @@ void SimpleFontData::ComputeNormalizedTypoAscentAndDescent() const { // Compute em height metrics from OS/2 sTypoAscender and sTypoDescender. SkTypeface* typeface = platform_data_.Typeface(); - auto [typo_ascender, typo_descender] = TypoAscenderAndDescender(typeface); + int16_t typo_ascender, typo_descender; + std::tie(typo_ascender, typo_descender) = TypoAscenderAndDescender(typeface); if (typo_ascender > 0 && TrySetNormalizedTypoAscentAndDescent(typo_ascender, typo_descender)) { return;
diff --git a/third_party/blink/renderer/platform/graphics/graphics_context.cc b/third_party/blink/renderer/platform/graphics/graphics_context.cc index 52e4103..3799694 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_context.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_context.cc
@@ -528,7 +528,9 @@ auto stroke_style = GetStrokeStyle(); DCHECK_NE(stroke_style, kWavyStroke); if (ShouldUseStrokeForTextLine(stroke_style)) { - auto [start, end] = GetPointsForTextLine(pt, width, StrokeThickness()); + gfx::Point start; + gfx::Point end; + std::tie(start, end) = GetPointsForTextLine(pt, width, StrokeThickness()); DrawLine(start, end, auto_dark_mode, true, paint_flags); } else { if (paint_flags) { @@ -1226,7 +1228,9 @@ Path path; DCHECK_NE(stroke_style, kWavyStroke); if (ShouldUseStrokeForTextLine(stroke_style)) { - auto [start, end] = GetPointsForTextLine(pt, width, stroke_thickness); + gfx::Point start; + gfx::Point end; + std::tie(start, end) = GetPointsForTextLine(pt, width, stroke_thickness); path.MoveTo(gfx::PointF(start)); path.AddLineTo(gfx::PointF(end)); } else {
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc index b9674a4d..e188b438 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc
@@ -1464,7 +1464,9 @@ const FetchParameters& fetch_params, const Resource& existing_resource, bool is_static_data) const { - auto [policy, reason] = DetermineRevalidationPolicyInternal( + RevalidationPolicy policy; + const char* reason; + std::tie(policy, reason) = DetermineRevalidationPolicyInternal( type, fetch_params, existing_resource, is_static_data); DCHECK(reason);
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc b/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc index 842ca10d..7cbc9362 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc
@@ -1357,11 +1357,14 @@ WebBlobInfo downloaded_blob; if (CanHandleDataURLRequestLocally(request)) { - // We don't have to verify mime type again since it's allowed to handle + ResourceResponse response; + scoped_refptr<SharedBuffer> data; + int result; + // It doesn't have to verify mime type again since it's allowed to handle // the data url with invalid mime type in some cases. // CanHandleDataURLRequestLocally() has already checked if the data url can // be handled here. - auto [result, response, data] = + std::tie(result, response, data) = network_utils::ParseDataURL(resource_->Url(), request.HttpMethod()); if (result != net::OK) { error_out = WebURLError(result, resource_->Url()); @@ -1584,11 +1587,14 @@ } // Extract a ResourceResponse from the data url. - // We don't have to verify mime type again since it's allowed to handle the + ResourceResponse response; + scoped_refptr<SharedBuffer> data; + int result; + // We doesn't have to verify mime type again since it's allowed to handle the // data url with invalid mime type in some cases. // CanHandleDataURLRequestLocally() has already checked if the data url can be // handled here. - auto [result, response, data] = network_utils::ParseDataURL( + std::tie(result, response, data) = network_utils::ParseDataURL( resource_->Url(), resource_->GetResourceRequest().HttpMethod()); if (result != net::OK) { HandleError(ResourceError(result, resource_->Url(), absl::nullopt));
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc b/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc index 1ba0731..09fd868f 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc
@@ -258,7 +258,9 @@ // Read through the bytes consumer passed back from the ResourceLoader. auto* test_reader = MakeGarbageCollected<BytesConsumerTestReader>( raw_resource_client->body()); - auto [result, body] = test_reader->Run(task_runner); + Vector<char> body; + BytesConsumer::Result result; + std::tie(result, body) = test_reader->Run(task_runner); EXPECT_EQ(result, BytesConsumer::Result::kDone); EXPECT_EQ(resource->GetStatus(), ResourceStatus::kCached); EXPECT_EQ(std::string(body.data(), body.size()), "Hello World!");
diff --git a/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer_test.cc b/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer_test.cc index 4fd028c..2cec6cd 100644 --- a/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer_test.cc
@@ -33,7 +33,9 @@ auto task_runner = base::MakeRefCounted<scheduler::FakeTaskRunner>(); auto* test_reader = MakeGarbageCollected<BytesConsumerTestReader>(bytes_consumer); - auto [result, data_from_consumer] = test_reader->Run(task_runner.get()); + Vector<char> data_from_consumer; + BytesConsumer::Result result; + std::tie(result, data_from_consumer) = test_reader->Run(task_runner.get()); EXPECT_EQ(BytesConsumer::Result::kDone, result); EXPECT_EQ(PublicState::kClosed, bytes_consumer->GetPublicState()); EXPECT_EQ(flatten_expected_data,
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index fb8cea2..5d81dd8a 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1302,16 +1302,6 @@ status: "stable", }, { - name: "LayoutNGGrid", - depends_on: ["LayoutNG"], - status: "stable", - }, - { - name: "LayoutNGGridCaching", - depends_on: ["LayoutNGGrid"], - status: "stable" - }, - { // Block fragmentation support in the grid layout algorithm. // https://drafts.csswg.org/css-grid-1/#pagination name: "LayoutNGGridFragmentation", @@ -1322,7 +1312,7 @@ }, { name: "LayoutNGSubgrid", - depends_on: ["LayoutNGGrid"], + depends_on: ["LayoutNG"], status: "test" }, { @@ -2716,5 +2706,8 @@ name: "XSLT", status: "stable", }, + { + name: "ZeroCopyTabCapture", + }, ], }
diff --git a/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller_unittest.cc b/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller_unittest.cc index 3a31764..cfc6d2b 100644 --- a/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller_unittest.cc +++ b/third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller_unittest.cc
@@ -5,6 +5,7 @@ #include "third_party/blink/renderer/platform/scheduler/main_thread/frame_task_queue_controller.h" #include <memory> +#include <tuple> #include <utility> #include "base/bind.h" @@ -191,7 +192,9 @@ frame_task_queue_controller_->GetAllTaskQueuesAndVoters().size()); for (const auto& task_queue_and_voter : frame_task_queue_controller_->GetAllTaskQueuesAndVoters()) { - auto [task_queue_ptr, voter] = task_queue_and_voter; + MainThreadTaskQueue* task_queue_ptr; + TaskQueue::QueueEnabledVoter* voter; + std::tie(task_queue_ptr, voter) = task_queue_and_voter; EXPECT_NE(task_queue_ptr, nullptr); EXPECT_TRUE(all_task_queues.find(task_queue_ptr) != all_task_queues.end());
diff --git a/third_party/blink/renderer/platform/video_capture/video_capture_impl.cc b/third_party/blink/renderer/platform/video_capture/video_capture_impl.cc index d4414ab..dff26fc 100644 --- a/third_party/blink/renderer/platform/video_capture/video_capture_impl.cc +++ b/third_party/blink/renderer/platform/video_capture/video_capture_impl.cc
@@ -1017,7 +1017,13 @@ const auto& cb_iter = client_buffers_.find(buffer_id); if (cb_iter != client_buffers_.end()) { - DCHECK(!cb_iter->second.get() || cb_iter->second->HasOneRef()) + // If the BufferContext is non-null, the GpuMemoryBuffer-backed frames can + // have more than one reference (held by MailboxHolderReleased). Otherwise, + // only one reference should be held. + DCHECK(!cb_iter->second.get() || + cb_iter->second->buffer_type() == + VideoFrameBufferHandleType::GPU_MEMORY_BUFFER_HANDLE || + cb_iter->second->HasOneRef()) << "Instructed to delete buffer we are still using."; client_buffers_.erase(cb_iter); } @@ -1043,9 +1049,9 @@ DCHECK(!buffer_context->HasOneRef()); BufferContext* const buffer_raw_ptr = buffer_context.get(); buffer_context = nullptr; - // Now there should be only one reference, from |client_buffers_|. - // TODO(https://crbug.com/1128853): This DCHECK is invalid for GpuMemoryBuffer - // backed frames, because MailboxHolderReleased may hold on to a reference to + // For non-GMB case, there should be only one reference, from + // |client_buffers_|. This DCHECK is invalid for GpuMemoryBuffer backed + // frames, because MailboxHolderReleased may hold on to a reference to // |buffer_context|. if (buffer_raw_ptr->buffer_type() != VideoFrameBufferHandleType::GPU_MEMORY_BUFFER_HANDLE) {
diff --git a/third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/queries.py b/third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/queries.py index ddfeb39..61c368c 100644 --- a/third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/queries.py +++ b/third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/queries.py
@@ -192,7 +192,7 @@ def _ShouldSkipOverResult(self, result): # WebGPU web tests are currently unsupported for various reasons. - return 'webgpu/cts.html' in result['test_id'] + return 'webgpu/' in result['test_id'] def _GetQueryGeneratorForBuilder(self, builder, builder_type): # Look for all tests.
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 3902374d..4dca0e7 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -3048,11 +3048,6 @@ crbug.com/626703 [ Mac11-arm64 ] external/wpt/css/css-flexbox/flexbox_flow-column-wrap.html [ Crash Failure ] # ====== New tests from wpt-importer added here ====== -crbug.com/626703 external/wpt/css/compositing/background-blending/background-blend-mode-plus-lighter.html [ Failure ] -crbug.com/626703 external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html [ Failure ] -crbug.com/626703 external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html [ Failure ] -crbug.com/626703 external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html [ Failure ] -crbug.com/626703 [ Mac11 ] virtual/off-main-thread-css-paint/external/wpt/css/css-paint-api/parse-input-arguments-002.https.html [ Failure ] crbug.com/626703 [ Mac10.15 ] virtual/off-main-thread-css-paint/external/wpt/css/css-paint-api/registered-property-value-013.https.html [ Failure ] crbug.com/626703 [ Mac10.13 ] external/wpt/wasm/jsapi/constructor/instantiate-bad-imports.any.html [ Timeout ] crbug.com/626703 [ Mac10.13 ] external/wpt/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html [ Timeout ] @@ -5036,8 +5031,8 @@ crbug.com/1179186 virtual/first-party-sets/http/tests/inspector-protocol/network/blocked-setcookie-same-party-cross-party-issue.js [ Pass ] # Temporarily disabled to allow a change to DebuggerModel#scriptsForSourceUrl to land. -crbug.com/1277403 http/tests/devtools/bindings/inline-styles-binding.js [ Failure Pass ] -crbug.com/1277403 http/tests/devtools/sources/debugger-ui/script-snippet-model.js [ Failure Pass ] +crbug.com/1277403 http/tests/devtools/bindings/inline-styles-binding.js [ Pass Failure ] +crbug.com/1277403 http/tests/devtools/sources/debugger-ui/script-snippet-model.js [ Pass Failure ] # Sheriff 2018-04-13 crbug.com/833655 [ Linux ] media/controls/closed-captions-dynamic-update.html [ Skip ] @@ -7597,9 +7592,9 @@ # Sheriff 2022-01-18 crbug.com/1287067 virtual/fenced-frame-mparch/wpt_internal/fenced_frame/embedder-require-corp.https.html [ Failure Pass ] -crbug.com/1288264 [ Win ] http/tests/fetch/serviceworker-proxied/thorough/redirect-loop-base-https-other-https.html [ Pass Skip Timeout ] -crbug.com/1288264 [ Win ] http/tests/fetch/window/thorough/cors-preflight2-base-https-other-https.html [ Pass Skip Timeout ] -crbug.com/1288264 [ Win ] http/tests/fetch/serviceworker/thorough/nocors-base-https-other-https.html [ Pass Skip Timeout ] +crbug.com/1288264 [ Win ] http/tests/fetch/serviceworker-proxied/thorough/redirect-loop-base-https-other-https.html [ Skip Pass Timeout ] +crbug.com/1288264 [ Win ] http/tests/fetch/window/thorough/cors-preflight2-base-https-other-https.html [ Skip Pass Timeout ] +crbug.com/1288264 [ Win ] http/tests/fetch/serviceworker/thorough/nocors-base-https-other-https.html [ Skip Pass Timeout ] crbug.com/1288264 [ Win ] http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write.html [ Pass Timeout ] crbug.com/1227911 [ Linux Release ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomainport.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Mac10.14 ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomainport.sub.https.html [ Failure Pass ] @@ -7609,10 +7604,10 @@ crbug.com/1227911 [ Mac10.14 ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-yes-child1-no-subdomain-child2-no-subdomain2.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Linux Release ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-subdomain-yes-2-subdomain2-no.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Mac10.14 ] virtual/no-auto-wpt-origin-isolation/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-subdomain-yes-2-subdomain2-no.sub.https.html [ Failure Pass ] -crbug.com/1227911 [ Release Win ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomain.sub.https.html [ Failure Pass ] +crbug.com/1227911 [ Win Release ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomain.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Linux Release ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomain.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Mac10.14 ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/2-iframes/parent-no-child1-no-subdomain-child2-yes-subdomain.sub.https.html [ Failure Pass ] -crbug.com/1227911 [ Release Win ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-no-subdomain-2-yes-subdomain.sub.https.html [ Failure Pass ] +crbug.com/1227911 [ Win Release ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-no-subdomain-2-yes-subdomain.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Linux Release ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-no-subdomain-2-yes-subdomain.sub.https.html [ Failure Pass ] crbug.com/1227911 [ Mac10.14 ] virtual/not-site-per-process/external/wpt/html/browsers/origin/origin-keyed-agent-clusters/iframe-navigation/parent-no-1-no-subdomain-2-yes-subdomain.sub.https.html [ Failure Pass ]
diff --git a/third_party/blink/web_tests/W3CImportExpectations b/third_party/blink/web_tests/W3CImportExpectations index f68d602..6c6c8442 100644 --- a/third_party/blink/web_tests/W3CImportExpectations +++ b/third_party/blink/web_tests/W3CImportExpectations
@@ -419,10 +419,6 @@ external/wpt/css/css-page/page-size-011.xht [ Skip ] external/wpt/css/css-page/page-size-012.xht [ Skip ] -# change on files below caused thousands of failures, skip them temprorary. -external/wpt/webdriver/tests/support/defaults.py [ Skip ] -external/wpt/webdriver/tests/support/fixtures.py [ Skip ] - # This test includes arbitrary html in unit test names (via parametrize) which # is currently not well handled in WebDriverExpectations, and causes Lint error # crbug.com/1167318
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json index 0414defe..e8918f3 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
@@ -1021,20 +1021,6 @@ ] }, "css-layout-api": { - "chrome-bug-1287843-000-crash.https.html": [ - "6137eba6dcf1d5fa61abb0b4bd2c437be8b72d36", - [ - null, - {} - ] - ], - "chrome-bug-1287843-001-crash.https.html": [ - "ac8c6ecf1ad77fe2432ba66f69a30b71e46118c5", - [ - null, - {} - ] - ], "input-text-crash.https.html": [ "2d32609040a970fa0b20ec6f0530b91c53a360d4", [ @@ -2966,13 +2952,6 @@ }, "mathml": { "crashtests": { - "chrome-bug-1287843.html": [ - "6fc95fc12e11d28ae69ec05bcd8d935103b5bcb1", - [ - null, - {} - ] - ], "display-and-column-properties.html": [ "c40a2a05497642d076962315b6b90cc3f5987360", [ @@ -69421,19 +69400,6 @@ ], {} ] - ], - "background-blend-mode-plus-lighter.html": [ - "0816dc691b7f812da4962755b8c765a0e5074e99", - [ - null, - [ - [ - "/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html", - "==" - ] - ], - {} - ] ] }, "compositing_simple_div.html": [ @@ -69814,20 +69780,7 @@ {} ] ], - "mix-blend-mode-plus-lighter-basic.html": [ - "fcf2d172afd6b1ebc99f64021a66a548d5b1f1fd", - [ - null, - [ - [ - "/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html", - "==" - ] - ], - {} - ] - ], - "mix-blend-mode-plus-lighter-svg-basic.html": [ + "mix-blend-mode-plus-lighter-svg.html": [ "4762389ca9257440a1297a3e246af0eddd78bf22", [ null, @@ -69840,21 +69793,8 @@ {} ] ], - "mix-blend-mode-plus-lighter-svg.html": [ - "fc5e94e74e90b083b5bf609f19fefbe570190bc0", - [ - null, - [ - [ - "/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html", - "==" - ] - ], - {} - ] - ], "mix-blend-mode-plus-lighter.html": [ - "e6fc4d73a0421e4e1978c3d4875b0f2e85c5917e", + "ae3dff155dce88166be3bb28ac40e2531720e2f3", [ null, [ @@ -131950,45 +131890,6 @@ {} ] ], - "change-fragmentainer-size-000.html": [ - "823506d1c55e23addc2838ee3c92bf19995d8ec5", - [ - null, - [ - [ - "/css/reference/ref-filled-green-100px-square.xht", - "==" - ] - ], - {} - ] - ], - "change-fragmentainer-size-001.html": [ - "d9ae7b1b6628c51e239977e23bf3ec97dc347737", - [ - null, - [ - [ - "/css/reference/ref-filled-green-100px-square.xht", - "==" - ] - ], - {} - ] - ], - "change-fragmentainer-size-002.html": [ - "4b3804361e1cb432962275726fc355fcc5e415f6", - [ - null, - [ - [ - "/css/reference/ref-filled-green-100px-square.xht", - "==" - ] - ], - {} - ] - ], "change-intrinsic-width.html": [ "3df3e1ebc8f9b5780dc858a878bca13dbedcdb35", [ @@ -133303,7 +133204,7 @@ ] ], "multicol-fill-balance-018.html": [ - "fd4f47c591d743ab4cbb6e52c22ee8b7323396db", + "692071c4834bfa64326823ea365db57200dd6605", [ null, [ @@ -168530,32 +168431,6 @@ {} ] ], - "white-space-pre-wrap-trailing-spaces-022.html": [ - "95f4361e8395e28e21d03dce4d9e0d454651bf5c", - [ - null, - [ - [ - "/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html", - "==" - ] - ], - {} - ] - ], - "white-space-pre-wrap-trailing-spaces-023.html": [ - "3986079e62b95a2c64098a62c6cfe8ad44a58e64", - [ - null, - [ - [ - "/css/css-text/white-space/reference/white-space-break-spaces-005-ref.html", - "==" - ] - ], - {} - ] - ], "white-space-wrap-after-nowrap-001.html": [ "5947c289e8752c26a17631f37309de7874d68986", [ @@ -206465,7 +206340,7 @@ ] ], "mq-invalid-media-type-001.html": [ - "a88f18173e0c4f95a92943c0e6ff388827142932", + "24ebd9fd4fcf302a9d695b549098ed7663d18277", [ null, [ @@ -206478,7 +206353,7 @@ ] ], "mq-invalid-media-type-002.html": [ - "763a7f29205757b57395465741b9a2ae65e9dd42", + "71f597e447b346d5115307cb8e174b2b6ebd52c0", [ null, [ @@ -206491,7 +206366,7 @@ ] ], "mq-invalid-media-type-003.html": [ - "acc524ca98a305fe8fad3a871c18e02bbe5c4933", + "b12bd75814a52a7232467bcd724db1b94dc08ee9", [ null, [ @@ -206504,7 +206379,7 @@ ] ], "mq-invalid-media-type-004.html": [ - "689c8d1a78d193225eac5a6b84c19f32b0e94913", + "d039281c0254e2bb794e229baecbe4d39c547baa", [ null, [ @@ -214757,19 +214632,6 @@ {} ] ], - "select-intrinsic-option-font-size.html": [ - "7f36708973d4c01f9af0e3c613ccaddd738ea6e9", - [ - null, - [ - [ - "/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size-ref.html", - "==" - ] - ], - {} - ] - ], "select-intrinsic-text-transform.html": [ "1026e29977bfbc1ccc24bd2597743c40fb7eb4c3", [ @@ -227641,10 +227503,6 @@ [] ], "resources": { - "cross-origin-helper-frame.html": [ - "997c5a2b72bafcad3421ccb48e48e323de6ef6f0", - [] - ], "idbfactory-origin-isolation-iframe.html": [ "d405ea48e15e298241a2c400a6d04adbd054e1e5", [] @@ -233022,10 +232880,6 @@ "b58767080c33af12e82638869ef395346ca509e5", [] ], - "idlharness.https.window-expected.txt": [ - "6e82efe03661492bd611a401f2af2e0a63a0f86d", - [] - ], "passwordcredential-framed-get.sub.https-expected.txt": [ "b58767080c33af12e82638869ef395346ca509e5", [] @@ -240054,10 +239908,6 @@ "background-blend-mode-gradient-image-ref.html": [ "4389960d783c91c414b33e1aaf0466ca91ee5942", [] - ], - "background-blend-mode-plus-lighter-ref.html": [ - "550981986b04746bda8f20ced60c0f9bd7ff3053", - [] ] }, "support": { @@ -240185,20 +240035,12 @@ "275105c5dbb03cf1b82eb058e856d53b129ecbe9", [] ], - "mix-blend-mode-plus-lighter-basic-ref.html": [ + "mix-blend-mode-plus-lighter-ref.html": [ "e5acd26b6fd498d12f2591d4b04aa3c8f748e153", [] ], - "mix-blend-mode-plus-lighter-ref.html": [ - "4709ab8b6882eb5cf33d1d3180ca5a7585f1ddb2", - [] - ], - "mix-blend-mode-plus-lighter-svg-basic-ref.html": [ - "9193bb574b3f9537a26f5ce0c5430f1685058c63", - [] - ], "mix-blend-mode-plus-lighter-svg-ref.html": [ - "8e1cb707599c4f5d2a9b42343076d61253ad22a2", + "9193bb574b3f9537a26f5ce0c5430f1685058c63", [] ], "mix-blend-mode-rotated-clip-ref.html": [ @@ -240311,16 +240153,6 @@ "be2348ab967f2ff4c161f8bbb9999a0bd8523e82", [] ], - "support": { - "plus-lighter.js": [ - "cadefa57282360af0910e9616671f1103c5f4c5d", - [] - ], - "utils.js": [ - "eb369ce2e58f0a25e1ff543b2ed53e2e2ac99b06", - [] - ] - }, "svg": { "reference": { "mix-blend-mode-in-svg-image-ref.html": [ @@ -243714,6 +243546,10 @@ "262fe39522e0e251756616705d700a7ba77b0ca7", [] ], + "container-for-shadow-dom.tentative-expected.txt": [ + "c68cca2e9841c1417971e347182def49812084cb", + [] + ], "container-name-parsing-expected.txt": [ "cda9550e7fa97b050f5aa2d435ad54a015e41fc1", [] @@ -261648,7 +261484,7 @@ [] ], "idlharness-expected.txt": [ - "f76169b892e8b8f5dc8d8c2ce5a1ee1992fe6432", + "46168b29be8578ef30c6b2b2cc71e88883ab6d75", [] ], "marker-and-other-pseudo-elements-ref.html": [ @@ -278231,10 +278067,6 @@ "dfa29a887db747cc5f1d34aa120b8860fa39a552", [] ], - "EventListener-handleEvent-cross-realm-expected.txt": [ - "bbda97de800889e3add4560d075bc140db95a8ed", - [] - ], "EventListener-handleEvent-expected.txt": [ "bb076e74f458f8aa89855d42ef845b55b2ccb354", [] @@ -278264,10 +278096,6 @@ [] ], "resources": { - "empty-document.html": [ - "b9cd130a07f77ee1a54f4bf54df54dc126fec1ee", - [] - ], "event-global-extra-frame.html": [ "241dda8b66f8c8fe128e736bcb073479aee634a9", [] @@ -278300,20 +278128,8 @@ "e31ca4f3c12693d4faa4a336b46edb3df545a09f", [] ], - "idlharness.any.serviceworker-expected.txt": [ - "a67b4ba7731a5e4b1e38685b3e5fba79c84f02a4", - [] - ], - "idlharness.any.sharedworker-expected.txt": [ - "a67b4ba7731a5e4b1e38685b3e5fba79c84f02a4", - [] - ], - "idlharness.any.worker-expected.txt": [ - "a67b4ba7731a5e4b1e38685b3e5fba79c84f02a4", - [] - ], "idlharness.window_exclude=Node-expected.txt": [ - "aa4572f1be7c0b080c99d6cef2d2bb38ebf69dbc", + "12920ef81a8107ddc637b89bf590c64e5a154d74", [] ], "lists": { @@ -278707,17 +278523,25 @@ [] ], "traversal": { + "TreeWalker-acceptNode-filter-cross-realm-expected.txt": [ + "7948b1bf20723649a696ddc36b6a885c1f3a62a7", + [] + ], + "TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-expected.txt": [ + "e9ed6f07909cb4a9ba25de88d5426744236e701f", + [] + ], "support": { "TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-subframe.html": [ "f5e393d0f081728aba806a7155fb8139796b089d", [] ], - "assert-node.js": [ - "0d5d8ad74fce7dcd4d60a1a11525c5134407f8ba", + "TreeWalker-acceptNode-filter-cross-realm-subframe.html": [ + "0c8bda14c0faf2b81fbb7556f9c12a0631bba7ec", [] ], - "empty-document.html": [ - "b9cd130a07f77ee1a54f4bf54df54dc126fec1ee", + "assert-node.js": [ + "0d5d8ad74fce7dcd4d60a1a11525c5134407f8ba", [] ] }, @@ -278864,10 +278688,6 @@ "0805bd682b48461588250a22018a6bd90990d002", [] ], - "resolver-callback-interface-cross-realm-expected.txt": [ - "1e681034783394d9c33b46355bec25169e0dd234", - [] - ], "resolver-callback-interface-expected.txt": [ "a3e74bd621d3cbd370e1c657bc545e0b32474a60", [] @@ -278877,12 +278697,8 @@ [] ], "resources": { - "empty-document.html": [ - "b9cd130a07f77ee1a54f4bf54df54dc126fec1ee", - [] - ], "invalid_namespace_test.js": [ - "8b934eff4e8d14d41ec30caecfcd4a7dcad305bc", + "b985261551e0b7526c205ec85667c4948ed8b681", [] ] }, @@ -281134,10 +280950,6 @@ "9e3a2546556a896943d73233cb647edca73d9dd4", [] ], - "idlharness.any-expected.txt": [ - "c4137e86e3b4245e560d978087e3dfae56422500", - [] - ], "resources": { "crossiframe-childframe.html": [ "6a8bc6b64240636dbc576aaa15b9c86b799dae8e", @@ -283064,24 +282876,40 @@ [] ], "shared-worker-fetch.https.window-expected.txt": [ - "0b54e1fb1a79866ca2e731de446b21f1d79e3a5d", + "31ae173f70264676caf5d4173fd308f9f20acb1b", [] ], "shared-worker-fetch.window-expected.txt": [ "cd62872e656ae0b85bc3257d8e1b789e087b9935", [] ], + "shared-worker.https.window-expected.txt": [ + "c7cd66da3743edf09e60f658824fea067e4da015", + [] + ], + "shared-worker.window-expected.txt": [ + "8718ffde7bc70a2802ec04ecd5c1e3b42e0dca32", + [] + ], "websocket.window-expected.txt": [ "11e2dcac903cb8fb7f68563036c4b8a4a9c1a9e7", [] ], "worker-fetch.https.window-expected.txt": [ - "4ea413e243878208fb41d891d71645b433c64018", + "0b54e1fb1a79866ca2e731de446b21f1d79e3a5d", [] ], "worker-fetch.window-expected.txt": [ "cd62872e656ae0b85bc3257d8e1b789e087b9935", [] + ], + "worker.https.window-expected.txt": [ + "c7cd66da3743edf09e60f658824fea067e4da015", + [] + ], + "worker.window-expected.txt": [ + "8718ffde7bc70a2802ec04ecd5c1e3b42e0dca32", + [] ] }, "range": { @@ -283678,11 +283506,11 @@ [] ], "window-tests-blob.js": [ - "3279849c5e285fc756f2f0620f09e64121d1a24c", + "e21733ce7f1afc8410899d1b5e58d56ec642c43c", [] ], "window-tests-enumeration.js": [ - "be906f6ed3355784d3848891685fb2bc27089920", + "838e5c34346286545fe7aa5cd7faf8bcb2310fe8", [] ] } @@ -288694,6 +288522,10 @@ "133807fb285da0e897d84b688da39281d5b67bfc", [] ], + "drawing-rectangles-to-the-canvas.yaml": [ + "7b042d854fefdedd4691609c0c322b6b0730062b", + [] + ], "drawing-text-to-the-canvas.yaml": [ "686bd0763f214cff22be0fa5bd7a59a5a057fcb3", [] @@ -288760,6 +288592,10 @@ "f2be7b8e07bd648c8fb690750fb894a17cbcc81e", [] ], + "drawing-rectangles-to-the-canvas.yaml": [ + "4903aa2f42818beb0c8f938bb91cd85e4e999df2", + [] + ], "fill-and-stroke-styles.yaml": [ "7a57a4730e096c728010b754c503c753a6972326", [] @@ -288818,10 +288654,6 @@ "conformance_requirements.yaml": [ "89091d6e7c760c192650dbd8994304ceb4586287", [] - ], - "drawing-rectangles-to-the-canvas.yaml": [ - "129fe95530a81b5b9fc5da74d19ba273e5dc28ca", - [] ] } } @@ -289904,7 +289736,7 @@ [] ], "idlharness.worker-expected.txt": [ - "0e04c9174c346bb33240b482245fab61e1eab32c", + "9609f524ee724b2aaf8c2847fbf9c59ca981948d", [] ], "new-harness.js": [ @@ -294409,10 +294241,6 @@ "31ba23a5cf86f161b1204ea3f4c9fef4585af909", [] ], - "select-intrinsic-option-font-size-ref.html": [ - "8b1b422176f8f7dbb080910b71b0b3ae89f876cd", - [] - ], "select-intrinsic-text-transform-ref.html": [ "18e272ba10d3c319c06cdb669e5f7a535946d024", [] @@ -301665,7 +301493,7 @@ [] ], "OES_draw_buffers_indexed.idl": [ - "bf1932c665353800f8a93ec43769b86aa05fc26a", + "25696f12fca77799ddd803483de22c251c75eb82", [] ], "OES_element_index_uint.idl": [ @@ -301793,17 +301621,13 @@ [] ], "app-history.idl": [ - "f5f1b7e4937dd53838f64a0681db652fa4300bf3", + "b87bb582e67e9fbd521a36db433d114944164aa2", [] ], "audio-output.idl": [ "80ceb225308a057d99ce39f575ebcf8eb40ab5fb", [] ], - "autoplay.idl": [ - "f2be5bb3789b123b33a07a8e237a3c48a7ae1cc4", - [] - ], "background-fetch.idl": [ "993bd8bc2fd8db2a52fcc4b703e6b0801ab76ff8", [] @@ -301841,7 +301665,7 @@ [] ], "compute-pressure.idl": [ - "0cf880b4503fede8f40b1c656834d806cd906d5e", + "8ea37bfbb9c47511d6aa8d34484f97527ec9ea29", [] ], "console.idl": [ @@ -301849,7 +301673,7 @@ [] ], "contact-api.idl": [ - "d7f2ba5d959ee316f8045697177c0b052302107a", + "7f67a5d19a84087182469b6f06887a2dafc37073", [] ], "content-index.idl": [ @@ -301869,7 +301693,7 @@ [] ], "credential-management.idl": [ - "bf1adbaffcbe7e6221f8629724e29ac2cf75aa19", + "a07aa0b4447cd3119dc5bd22c5c3d16679e3afe5", [] ], "csp-embedded-enforcement.idl": [ @@ -301892,8 +301716,8 @@ "8185170943281bd1ceb8bb8fd3cd701a60fa290c", [] ], - "css-cascade.idl": [ - "9011dc7fd9e2a3f835e6d6ff565d9854db82e96f", + "css-cascade-5.idl": [ + "4166ae6b9ba780c8cb4108eb98da0647fbef0d1d", [] ], "css-conditional.idl": [ @@ -301917,7 +301741,7 @@ [] ], "css-highlight-api.idl": [ - "f3c6b2e9d21a525e80461a22e511c672ce05ba87", + "56db8c35ac099bbfc79fb40b88a3ba14ab700f43", [] ], "css-images-4.idl": [ @@ -301953,7 +301777,7 @@ [] ], "css-pseudo.idl": [ - "dbe4c5461f6ae2199968bb77c81d32570f55f1c7", + "2c90ff2b3174eea5d1245214b79ac79ac2479ee5", [] ], "css-regions.idl": [ @@ -301973,7 +301797,7 @@ [] ], "css-typed-om.idl": [ - "3a0a6bd064ddf65930c7170c38f3f9b40e694879", + "b3942e6bcf55556978fc244861936a5c21252036", [] ], "cssom-view.idl": [ @@ -302005,11 +301829,7 @@ [] ], "dom.idl": [ - "635072d57346d56f870ba28aa795f785c187da52", - [] - ], - "edit-context.idl": [ - "f5e60bd0d02c45ca8f3145c729edcfd0b240b61e", + "d3255b45e01b302347ab5a3d695963871e1eedba", [] ], "element-timing.idl": [ @@ -302029,7 +301849,7 @@ [] ], "event-timing.idl": [ - "329570e44314278526ecf949ebc1a98e4d4dd840", + "98e8d920fca47b6d0daf87ce88acce442c9da9ab", [] ], "eyedropper-api.idl": [ @@ -302072,12 +301892,12 @@ "157072f6341821aba5403be50ddd5355dbb940d8", [] ], - "geolocation-sensor.idl": [ - "e1d676205fff369c5cdc656f8563e4bb1fca9946", + "geolocation-API.idl": [ + "4b971f097babf71b9ef1b5091d1a8777b4d717ea", [] ], - "geolocation.idl": [ - "4b971f097babf71b9ef1b5091d1a8777b4d717ea", + "geolocation-sensor.idl": [ + "e1d676205fff369c5cdc656f8563e4bb1fca9946", [] ], "geometry.idl": [ @@ -302101,7 +301921,7 @@ [] ], "html.idl": [ - "2eaf5d09e2c882588a3069b51fffa88802e4ed61", + "2b5efa90ba2c3af6df84735bee4c45e1be5b66f8", [] ], "idle-detection.idl": [ @@ -302160,8 +301980,12 @@ "4fb1b70398e7486a0596574b3ef76d361806e0f3", [] ], + "lighting-estimation.idl": [ + "35aa1d746a7466e80a9de9d366935b831da8cc7f", + [] + ], "local-font-access.idl": [ - "e37b2c7d56f028c3bf9fe32352382697f2410f05", + "577cd3621ac327c00d55a346942138c18711fa2a", [] ], "longtasks.idl": [ @@ -302172,10 +301996,6 @@ "45ba9edcfe570c5d1828d089409e8220788c7e94", [] ], - "manifest-incubations.idl": [ - "bab3998dedd1353ba95b824a36500f1ab9a69987", - [] - ], "mathml-core.idl": [ "3989288b3bd14de69f0d9ce9c188825b06836697", [] @@ -302205,11 +302025,7 @@ [] ], "mediacapture-streams.idl": [ - "33511eb24153ab4ac4dd213b932219244ea98d21", - [] - ], - "mediacapture-transform.idl": [ - "5b2c8fa67a6b130d1fe99f962ff85c5cf7a7bc3d", + "7d51a2af8077c4430423701dc5c58fb8dd9847d8", [] ], "mediasession.idl": [ @@ -302293,7 +302109,7 @@ [] ], "permissions.idl": [ - "3a0f159c2b2e330c6d8af9e74952d10879008240", + "3112ef6d20b9ab6f71846a9c8e620f67c80f8684", [] ], "picture-in-picture.idl": [ @@ -302320,10 +302136,6 @@ "4f1e4bee835a23c5b7bcf54b5b05f4ded2b08023", [] ], - "priority-hints.idl": [ - "835b0180d30655ce85298e42442d676bf6bc3f9a", - [] - ], "private-click-measurement.idl": [ "3bed7ccf991f6b8cd4e9a5a237275c4ff5fc6f1f", [] @@ -302361,7 +302173,7 @@ [] ], "sanitizer-api.idl": [ - "8268384affc8c23daadadb79959d4b953c563f1b", + "b98da2a2c671e2e86c113d3ebe904470b82e60ad", [] ], "sanitizer-api.tentative.idl": [ @@ -302397,7 +302209,7 @@ [] ], "secure-payment-confirmation.idl": [ - "1522bff76eac485d8046cbad2634fdfd9fda5e06", + "0a4416ef4b20e1577484a875c511f7a41a936ff2", [] ], "selection-api.idl": [ @@ -302437,7 +302249,7 @@ [] ], "streams.idl": [ - "f7084dd60610420628f6b3468bf071b66e93dc14", + "2ebe5b7491f3757e5df3e3f543fdef48ea296755", [] ], "svg-animations.idl": [ @@ -302505,7 +302317,7 @@ [] ], "wasm-js-api.idl": [ - "141af90fd2d9d9432747277fc7d38ab6f53ea1f5", + "b56c8cf0c7943e746c64b0acab5ea8a2bbbdd75e", [] ], "wasm-web-api.idl": [ @@ -302525,11 +302337,11 @@ [] ], "web-locks.idl": [ - "d79e404b983fb4388028de8b269ee16b652fed0f", + "a0319a00fd208a8bdeecd9700e00fd0d67549a60", [] ], "web-nfc.idl": [ - "ff042b044e1da41ee42c07361a1f814684049f4a", + "3b8be7fd81cf7ca5e8f96c5a36abeb7914614b91", [] ], "web-otp.idl": [ @@ -302545,7 +302357,7 @@ [] ], "webauthn.idl": [ - "2b897608ab4b1118bdaf90ba716b88b2f1b1eaa4", + "92143205d672f08471370498623d71202a6cee84", [] ], "webcodecs.idl": [ @@ -302565,11 +302377,11 @@ [] ], "webgpu.idl": [ - "6ded86e1d6389ab9f864272549d7cbf662043035", + "c23ba7878172556f0db75a45f88bc135489cad1e", [] ], "webhid.idl": [ - "997d82c3986e5e4b908e032475723e8b9348d459", + "d4ce439785d866a9667d2a5e716d139d355a4d12", [] ], "webidl.idl": [ @@ -302609,11 +302421,11 @@ [] ], "webrtc.idl": [ - "aed8fbbedfe5d236a9d85fbfa75fa6c07b51695b", + "ff0a4a9ec5ccfc153dbafa2d2c6fdab7582eb66e", [] ], "webtransport.idl": [ - "95ab9e05d498c9e5bf244e173bf8cd106a0d8c7f", + "f098e47d179b4e02ed3f6c0bde20832c29183acd", [] ], "webusb.idl": [ @@ -302652,10 +302464,6 @@ "fa4fb71c9decd64054669249353a16b3476aae56", [] ], - "webxr-lighting-estimation.idl": [ - "35aa1d746a7466e80a9de9d366935b831da8cc7f", - [] - ], "webxr.idl": [ "004f104c8e23c5200e8ef3d63f6ee85b6ec39365", [] @@ -302665,7 +302473,7 @@ [] ], "window-controls-overlay.idl": [ - "051978d693e3aa5213096e571be66d10cc8d8199", + "de5e67419743fef952bc6e1df09ab77f03c18386", [] ], "xhr.idl": [ @@ -304582,10 +304390,6 @@ "563fa6720ba3a89d6ad8add86cd903465fe456f2", [] ], - "MediaStreamTrackGenerator-in-shared-worker.https-expected.txt": [ - "1bc00727ca33d15f53d9c41f9660d2229e486482", - [] - ], "MediaStreamTrackGenerator-in-worker.https-expected.txt": [ "11ecc9430dc08d3eceb70b8bacc693b955564dc2", [] @@ -304597,10 +304401,6 @@ "MediaStreamTrackProcessor-worker.js": [ "51eaef80a90a6e24fce8cad4fee03e05548e4517", [] - ], - "shared-worker.js": [ - "61ff67bcff03099cbf93fbb594e9b188d85a9f11", - [] ] }, "mediacapture-record": { @@ -304745,7 +304545,7 @@ [] ], "idlharness.https.window-expected.txt": [ - "07cd17de93769ec3e2a05e2e0d0f5be3debeaced", + "35a2f4c8c4e26a49ef72cdefc7e9f826f4dbe7fc", [] ], "iframe-enumerate-cleared.html": [ @@ -316174,7 +315974,7 @@ [] ], "urlpatterntestdata.json": [ - "8cb3fffa2bfe247358e6b1f8291bff3712f98a14", + "671751fd3105b56ca0584553619c73634a971849", [] ], "urlpatterntests.js": [ @@ -316459,16 +316259,6 @@ ] } }, - "global": { - "type.tentative.any-expected.txt": [ - "2aec539c575a8bc88c84d5608d0b74081054966b", - [] - ], - "type.tentative.any.worker-expected.txt": [ - "2aec539c575a8bc88c84d5608d0b74081054966b", - [] - ] - }, "idlharness.any-expected.txt": [ "845370fc1055ff291bf102d65281592f1a3552c1", [] @@ -316515,6 +316305,14 @@ "c5880db327517f6bd5fdf09c4a8f2b291bdecf27", [] ], + "prototypes.any-expected.txt": [ + "4df42608c6b1973327cd517e9e267d1c8acecd8d", + [] + ], + "prototypes.any.worker-expected.txt": [ + "4df42608c6b1973327cd517e9e267d1c8acecd8d", + [] + ], "table": { "assertions.js": [ "19cc5c3b92d6fa6748c3831f3629c92b62ed757f", @@ -316536,6 +316334,22 @@ "dbd6539ea90e6578e0e76234ea555f414a3aeb4f", [] ], + "constructor.any-expected.txt": [ + "49f77337eed4303808b94d77f97b5856f9f4b7af", + [] + ], + "constructor.any.worker-expected.txt": [ + "49f77337eed4303808b94d77f97b5856f9f4b7af", + [] + ], + "get-set.any-expected.txt": [ + "cad5a835b6d9c95500261243889ea88456e94d1b", + [] + ], + "get-set.any.worker-expected.txt": [ + "cad5a835b6d9c95500261243889ea88456e94d1b", + [] + ], "grow-reftypes.tentative.any-expected.txt": [ "5a04fca68f6843a86f7f5e900a26253a9a08dd5b", [] @@ -316544,6 +316358,14 @@ "7d6bf80291cd295caabfe4c09d1f60144101d655", [] ], + "grow.any-expected.txt": [ + "16927db9100e7aee0392d8a36b5d35df6b338416", + [] + ], + "grow.any.worker-expected.txt": [ + "16927db9100e7aee0392d8a36b5d35df6b338416", + [] + ], "set-reftypes.tentative.any-expected.txt": [ "5eb1b117af669e2c21fe01b2e9c370426d5e72a8", [] @@ -316551,14 +316373,6 @@ "set-reftypes.tentative.any.worker-expected.txt": [ "5eb1b117af669e2c21fe01b2e9c370426d5e72a8", [] - ], - "type.tentative.any-expected.txt": [ - "f65819c8872ca3a75623c0eb1b58e80070a9aa23", - [] - ], - "type.tentative.any.worker-expected.txt": [ - "f65819c8872ca3a75623c0eb1b58e80070a9aa23", - [] ] }, "tag": { @@ -317730,6 +317544,10 @@ } }, "the-audiocontext-interface": { + "audiocontext-not-fully-active-expected.txt": [ + "86d99c233ebb1d7ad83ddbb3571b87a5bb9fdc06", + [] + ], "audiocontext-suspend-resume-expected.txt": [ "4b3708bcb872ac53b8e82e6d780745dcb59cafab", [] @@ -318568,6 +318386,14 @@ "9da4bb7be5ffb76835cd33860bf74aa1981695b6", [] ], + "defaults.py": [ + "8dd171aa64c71fa031e0e14ef4344f4335e368cc", + [] + ], + "fixtures.py": [ + "cb98ccb6a754e9cb90687a84491b5f8c7b2d2237", + [] + ], "fixtures_bidi.py": [ "4e900bb55b9b40418e69d97e22d16c0476c3cfd8", [] @@ -318691,7 +318517,7 @@ [] ], "idlharness.https.window-expected.txt": [ - "7b3f1ae73d65e4c10fef92795b0d5a9ad64fefb2", + "6ed0916d004bd748428d92ecb2296fb2790f3eec", [] ] }, @@ -325739,15 +325565,6 @@ {} ] ], - "database-names-by-origin.html": [ - "2224d5b5c371f791a64849f36ace5b830f6e1a65", - [ - null, - { - "timeout": "long" - } - ] - ], "delete-range.any.js": [ "c11c68a609e444cffc9dd9aa1387cfc01be9a9de", [ @@ -359217,13 +359034,6 @@ {} ] ], - "transform-010.html": [ - "8418551cdc8172862d57d8359a732968b3467aba", - [ - null, - {} - ] - ], "widows-orphans-005.html": [ "713849703ce92e062780bd20e0708c8dfcd21f5f", [ @@ -359241,7 +359051,7 @@ ] ], "idlharness.html": [ - "9bde23b946ccf1537c92c6de2301005144bf12a6", + "80d33185561cc1f6708e7e8de967d57288a6827a", [ null, {} @@ -359870,7 +359680,7 @@ ] ], "container-for-shadow-dom.tentative.html": [ - "66e9ea088aaa024a3ae3f15da2e69436e7855383", + "24d52da256a8802e47b4e33f3c3c98f6216537b6", [ null, {} @@ -366940,13 +366750,6 @@ {} ] ], - "grid-template-shorthand-areas-valid.html": [ - "59770ed430bc5cab4c6915cbebe10694012a86d1", - [ - null, - {} - ] - ], "grid-template-shorthand-invalid.html": [ "366cdf4d887aa937875cd5e5a49631d1b3e283b1", [ @@ -384494,13 +384297,6 @@ {} ] ], - "mq-invalid-media-type-005.html": [ - "3e25a248b3f58ad3d3777953d482a81965e6ff81", - [ - null, - {} - ] - ], "navigation-controls.tentative.html": [ "ac1087bb65b9a8fd85d924ad1ae0de797762dac5", [ @@ -385335,13 +385131,6 @@ {} ] ], - "has-specificity.html": [ - "b33e3a0eb3663266d7806ea9d243428684d673fd", - [ - null, - {} - ] - ], "hover-002.html": [ "02cee99bf6cd161eb95806854cb12e39504a359e", [ @@ -385691,7 +385480,7 @@ ] ], "has-complexity.html": [ - "0bdcdec13b97d8a2b3973f86773512474988519c", + "df127bcf1e4e830b32abfe069873a928b9f1d191", [ null, {} @@ -387845,13 +387634,6 @@ {} ] ], - "EventListener-handleEvent-cross-realm.html": [ - "663d04213f82bbcfabe420d3b738a706e0fd86e0", - [ - null, - {} - ] - ], "EventListener-handleEvent.html": [ "06bc1f6e2ab267e36c3d15da9e278db2aced85c0", [ @@ -390417,14 +390199,14 @@ ] ], "TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html": [ - "f8e71bcdf56e155ad704facc8a5a1be981c02e73", + "4d6bb53289f47257a0ae21d451e48ec59529512c", [ null, {} ] ], "TreeWalker-acceptNode-filter-cross-realm.html": [ - "da91cf6cb2379839367d09e48cadaa970b34e42a", + "60a80d31190de6cf394be338bfeecaf3e9699338", [ null, {} @@ -390863,13 +390645,6 @@ {} ] ], - "resolver-callback-interface-cross-realm.html": [ - "55fbb070a3b482b1546a52eef0285f9e7e5483f0", - [ - null, - {} - ] - ], "resolver-callback-interface.html": [ "b43695f4aa56d2e7b8a05d0798657ff1057e3c9b", [ @@ -416679,7 +416454,7 @@ ] ], "worker-fetch.https.window.js": [ - "528b556a2e5af8a765bd820ebd5aacb6730ec965", + "78e51b0f8af848b69a2e6f1b12230bde14b66ebd", [ "fetch/private-network-access/worker-fetch.https.window.html", { @@ -418481,6 +418256,33 @@ } ] ], + "font_access-chooser-multiple.tentative.manual.https.html": [ + "bf70a0a7192a6d7b49d40a653110ccf2d75f0b7e", + [ + null, + { + "testdriver": true + } + ] + ], + "font_access-chooser-selection.tentative.manual.https.html": [ + "e8a1e8d91b21eed5b074f860cedd5f768cec3d8e", + [ + null, + { + "testdriver": true + } + ] + ], + "font_access-chooser.tentative.manual.https.html": [ + "499d8be4a1fcc15367ba5c07e21dd695d17c51f8", + [ + null, + { + "testdriver": true + } + ] + ], "font_access-enumeration.tentative.https.window.js": [ "677fe82c70233de2e1cbeab4beb41437319688b3", [ @@ -418508,7 +418310,7 @@ ] ], "font_metadata.tentative.https.window.js": [ - "672bc082f2d73117eb415dfe785905319e9fd504", + "21d3ea1c1125c7e2ea2674c38a421b3130a357f6", [ "font-access/font_metadata.tentative.https.window.html", { @@ -418950,7 +418752,7 @@ ] ], "idlharness.https.window.js": [ - "176bae86af93745c5b5611a1070f3d9619c4a352", + "7f83eaf52d1d19be3074daf72cf32162d46ea4e6", [ "geolocation-API/idlharness.https.window.html", { @@ -424261,7 +424063,7 @@ ] ], "2d.clearRect.clip.html": [ - "0c6deaaaada1e675882b81cc63e343d3b2f60f2e", + "92d6dd51cd5341494c32fccd55ce02af2625be32", [ null, {} @@ -424289,7 +424091,7 @@ ] ], "2d.clearRect.nonfinite.html": [ - "18ce63081322d29d8365b59c23c8ad0689104c17", + "6f1dacc5a2e90b4cefbfb779c913aea95d7997a1", [ null, {} @@ -424331,7 +424133,7 @@ ] ], "2d.fillRect.clip.html": [ - "ccbe776889ac1849f6770968248b39d8ab1ec7ab", + "96925f1c2e5f020c1b5a95502c4b35d977bd5e19", [ null, {} @@ -424345,7 +424147,7 @@ ] ], "2d.fillRect.nonfinite.html": [ - "98b19cee4fda962aa53555ec847c84d60efef6c2", + "22deef6c81697004797fef0c539ca2cc0203bc4d", [ null, {} @@ -424387,7 +424189,7 @@ ] ], "2d.strokeRect.clip.html": [ - "1da47f43d959d91fa7cfcb784a168cd4fddf772b", + "2b1b3f6d60b0fafca0f5f9b6ae87e0f6b6632f08", [ null, {} @@ -424415,7 +424217,7 @@ ] ], "2d.strokeRect.nonfinite.html": [ - "27829cb31f0bee9906342689a35f6d25d57bd34b", + "8fee577df8d53c434a046af4d7bed2e5bcbe7bab", [ null, {} @@ -427058,7 +426860,7 @@ ] ], "createImageBitmap-sizeOverflow.html": [ - "7239c2e7a1c5983583e04d8bce7ebe028401ffec", + "f58825cc371f04bf186ba23fa869391f3d2d3f6c", [ null, {} @@ -471115,13 +470917,6 @@ } ] ], - "MediaStreamTrackGenerator-in-shared-worker.https.html": [ - "deecfccad16f5df61028b9fc65e0e65e5f825e64", - [ - null, - {} - ] - ], "MediaStreamTrackGenerator-in-worker.https.html": [ "ff3b9459686d6507f89efb502b4d3436fff81f13", [ @@ -516007,13 +515802,6 @@ {} ] ], - "viewport-resize-event-on-iframe-show.html": [ - "688148a88fb21f899a16a710f24dd4836631fd13", - [ - null, - {} - ] - ], "viewport-resize-event-on-iframe-size-change.html": [ "802fee7879200a8e9352a54ba0a5f9719ca5f401", [
diff --git a/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window-expected.txt deleted file mode 100644 index 6e82efe0..0000000 --- a/third_party/blink/web_tests/external/wpt/credential-management/idlharness.https.window-expected.txt +++ /dev/null
@@ -1,99 +0,0 @@ -This is a testharness.js-based test. -Found 95 tests; 94 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS idl_test setup -PASS idl_test validation -PASS Partial interface Navigator: original interface defined -PASS Partial interface Navigator: member names are unique -PASS Partial dictionary CredentialRequestOptions: original dictionary defined -PASS Partial dictionary CredentialRequestOptions: member names are unique -PASS Partial dictionary CredentialCreationOptions: original dictionary defined -PASS Partial dictionary CredentialCreationOptions: member names are unique -PASS Partial dictionary CredentialRequestOptions[2]: original dictionary defined -PASS Partial dictionary CredentialRequestOptions[2]: member names are unique -PASS Partial dictionary CredentialCreationOptions[2]: original dictionary defined -PASS Partial dictionary CredentialCreationOptions[2]: member names are unique -PASS Partial interface mixin NavigatorID: member names are unique -PASS PasswordCredential includes CredentialUserData: member names are unique -PASS FederatedCredential includes CredentialUserData: member names are unique -PASS HTMLElement includes GlobalEventHandlers: member names are unique -PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique -PASS HTMLElement includes ElementContentEditable: member names are unique -PASS HTMLElement includes HTMLOrSVGElement: member names are unique -PASS Navigator includes NavigatorID: member names are unique -PASS Navigator includes NavigatorLanguage: member names are unique -PASS Navigator includes NavigatorOnLine: member names are unique -PASS Navigator includes NavigatorContentUtils: member names are unique -PASS Navigator includes NavigatorCookies: member names are unique -PASS Navigator includes NavigatorPlugins: member names are unique -PASS Navigator includes NavigatorConcurrentHardware: member names are unique -PASS Element includes ParentNode: member names are unique -PASS Element includes NonDocumentTypeChildNode: member names are unique -PASS Element includes ChildNode: member names are unique -PASS Element includes Slottable: member names are unique -PASS Credential interface: existence and properties of interface object -PASS Credential interface object length -PASS Credential interface object name -PASS Credential interface: existence and properties of interface prototype object -PASS Credential interface: existence and properties of interface prototype object's "constructor" property -PASS Credential interface: existence and properties of interface prototype object's @@unscopables property -PASS Credential interface: attribute id -PASS Credential interface: attribute type -FAIL Credential interface: operation isConditionalMediationAvailable() assert_own_property: interface object missing static operation expected property "isConditionalMediationAvailable" missing -PASS CredentialsContainer interface: existence and properties of interface object -PASS CredentialsContainer interface object length -PASS CredentialsContainer interface object name -PASS CredentialsContainer interface: existence and properties of interface prototype object -PASS CredentialsContainer interface: existence and properties of interface prototype object's "constructor" property -PASS CredentialsContainer interface: existence and properties of interface prototype object's @@unscopables property -PASS CredentialsContainer interface: operation get(optional CredentialRequestOptions) -PASS CredentialsContainer interface: operation store(Credential) -PASS CredentialsContainer interface: operation create(optional CredentialCreationOptions) -PASS CredentialsContainer interface: operation preventSilentAccess() -PASS CredentialsContainer must be primary interface of navigator.credentials -PASS Stringification of navigator.credentials -PASS CredentialsContainer interface: navigator.credentials must inherit property "get(optional CredentialRequestOptions)" with the proper type -PASS CredentialsContainer interface: calling get(optional CredentialRequestOptions) on navigator.credentials with too few arguments must throw TypeError -PASS CredentialsContainer interface: navigator.credentials must inherit property "store(Credential)" with the proper type -PASS CredentialsContainer interface: calling store(Credential) on navigator.credentials with too few arguments must throw TypeError -PASS CredentialsContainer interface: navigator.credentials must inherit property "create(optional CredentialCreationOptions)" with the proper type -PASS CredentialsContainer interface: calling create(optional CredentialCreationOptions) on navigator.credentials with too few arguments must throw TypeError -PASS CredentialsContainer interface: navigator.credentials must inherit property "preventSilentAccess()" with the proper type -PASS PasswordCredential interface: existence and properties of interface object -PASS PasswordCredential interface object length -PASS PasswordCredential interface object name -PASS PasswordCredential interface: existence and properties of interface prototype object -PASS PasswordCredential interface: existence and properties of interface prototype object's "constructor" property -PASS PasswordCredential interface: existence and properties of interface prototype object's @@unscopables property -PASS PasswordCredential interface: attribute password -PASS PasswordCredential interface: attribute name -PASS PasswordCredential interface: attribute iconURL -PASS PasswordCredential must be primary interface of passwordCredential -PASS Stringification of passwordCredential -PASS PasswordCredential interface: passwordCredential must inherit property "password" with the proper type -PASS PasswordCredential interface: passwordCredential must inherit property "name" with the proper type -PASS PasswordCredential interface: passwordCredential must inherit property "iconURL" with the proper type -PASS Credential interface: passwordCredential must inherit property "id" with the proper type -PASS Credential interface: passwordCredential must inherit property "type" with the proper type -PASS Credential interface: passwordCredential must inherit property "isConditionalMediationAvailable()" with the proper type -PASS FederatedCredential interface: existence and properties of interface object -PASS FederatedCredential interface object length -PASS FederatedCredential interface object name -PASS FederatedCredential interface: existence and properties of interface prototype object -PASS FederatedCredential interface: existence and properties of interface prototype object's "constructor" property -PASS FederatedCredential interface: existence and properties of interface prototype object's @@unscopables property -PASS FederatedCredential interface: attribute provider -PASS FederatedCredential interface: attribute protocol -PASS FederatedCredential interface: attribute name -PASS FederatedCredential interface: attribute iconURL -PASS FederatedCredential must be primary interface of federatedCredential -PASS Stringification of federatedCredential -PASS FederatedCredential interface: federatedCredential must inherit property "provider" with the proper type -PASS FederatedCredential interface: federatedCredential must inherit property "protocol" with the proper type -PASS FederatedCredential interface: federatedCredential must inherit property "name" with the proper type -PASS FederatedCredential interface: federatedCredential must inherit property "iconURL" with the proper type -PASS Credential interface: federatedCredential must inherit property "id" with the proper type -PASS Credential interface: federatedCredential must inherit property "type" with the proper type -PASS Credential interface: federatedCredential must inherit property "isConditionalMediationAvailable()" with the proper type -PASS Navigator interface: attribute credentials -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/background-blend-mode-plus-lighter.html b/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/background-blend-mode-plus-lighter.html deleted file mode 100644 index 0816dc6..0000000 --- a/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/background-blend-mode-plus-lighter.html +++ /dev/null
@@ -1,32 +0,0 @@ -<!DOCTYPE html> -<title>background-blend-mode: plus-lighter test</title> -<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> -<link rel="help" href="https://drafts.fxtf.org/compositing-2/#background-blend-mode"> -<link rel="match" href="reference/background-blend-mode-plus-lighter-ref.html"> -<style> - .test { - width: 100px; - height: 100px; - background-blend-mode: plus-lighter; - } -</style> -<script type="module"> - import { tests } from '../support/plus-lighter.js'; - import { toCSSColor } from '../support/utils.js'; - - // Create a solid color CSS image. - const colorImage = (pixel) => - `linear-gradient(to right, ${toCSSColor(pixel)}, ${toCSSColor(pixel)})`; - - const createBackgrounds = (colors) => colors - // Backgrounds are top first - .slice().reverse() - .map((color) => colorImage(color)) - .join(', '); - - for (const colors of tests) { - document.body.insertAdjacentHTML('beforeend', ` - <div class="test" style="background-image: ${createBackgrounds(colors)}"></div> - `); - } -</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html deleted file mode 100644 index 55098198..0000000 --- a/third_party/blink/web_tests/external/wpt/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html +++ /dev/null
@@ -1,20 +0,0 @@ -<!DOCTYPE html> -<title>background-blend-mode: plus-lighter test</title> -<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> -<link rel="help" href="https://drafts.fxtf.org/compositing-2/#background-blend-mode"> -<style> - .test { - width: 100px; - height: 100px; - } -</style> -<script type="module"> - import { tests, plusLighter } from '../../support/plus-lighter.js'; - import { toCSSColor } from '../../support/utils.js'; - - for (const colors of tests) { - document.body.insertAdjacentHTML('beforeend', ` - <div class="test" style="background-color: ${toCSSColor(plusLighter(colors))}"></div> - `); - } -</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html deleted file mode 100644 index fcf2d17..0000000 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html +++ /dev/null
@@ -1,42 +0,0 @@ -<!DOCTYPE html> -<title>mix-blend-mode: plus-lighter test</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> -<link rel="match" href="reference/mix-blend-mode-plus-lighter-basic-ref.html"> - -<style> -.container { - position: relative; - isolation: isolate; - width: 500px; - height: 500px; -} -.blue { background: #000064; } -.green { background: #006400; } -.common { - position: absolute; - width: 100px; - height: 100px; - opacity: 0.6; -} -.one { - top: 10px; - left: 10px; -} -.two { - top: 65px; - left: 30px; - mix-blend-mode: plus-lighter; -} -.three { - top: 120px; - left: 50px; - mix-blend-mode: plus-lighter; -} -</style> - -<div class=container> - <div class="one common blue"></div> - <div class="two common blue"></div> - <div class="three common green"></div> -</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html deleted file mode 100644 index 4762389..0000000 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html +++ /dev/null
@@ -1,21 +0,0 @@ -<!DOCTYPE html> -<title>mix-blend-mode: plus-lighter SVG test</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> -<link rel="match" href="reference/mix-blend-mode-plus-lighter-svg-ref.html"> - -<style> -.isolate { isolation: isolate; } -rect { - opacity: 0.6; - mix-blend-mode: plus-lighter; -} -</style> - -<svg width=500 height=500> - <g class="isolate"> - <rect x="10" y="10" width="100" height="100" fill="#000064"></rect> - <rect x="30" y="65" width="100" height="100" fill="#000064"></rect> - <rect x="50" y="120" width="100" height="100" fill="#006400"></rect> - </g> -</svg>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html index fc5e94e..4762389 100644 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html
@@ -1,37 +1,21 @@ <!DOCTYPE html> <title>mix-blend-mode: plus-lighter SVG test</title> -<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> <link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> <link rel="match" href="reference/mix-blend-mode-plus-lighter-svg-ref.html"> + <style> - .blend-group { - isolation: isolate; - } - .layer { - mix-blend-mode: plus-lighter; - } +.isolate { isolation: isolate; } +rect { + opacity: 0.6; + mix-blend-mode: plus-lighter; +} </style> -<script type="module"> - import { tests } from '../support/plus-lighter.js'; - import { toCSSColor } from '../support/utils.js'; - function createRects(colors) { - let html = ''; - - for (const color of colors) { - html += `<rect class="layer" x="0" y="0" width="100%" height="100%" fill="${toCSSColor(color)}" />`; - } - - return html; - } - - for (const colors of tests) { - document.body.insertAdjacentHTML('beforeend', ` - <svg width="100" height="100"> - <g class="blend-group"> - ${createRects(colors)} - </g> - </svg> - `); - } -</script> +<svg width=500 height=500> + <g class="isolate"> + <rect x="10" y="10" width="100" height="100" fill="#000064"></rect> + <rect x="30" y="65" width="100" height="100" fill="#000064"></rect> + <rect x="50" y="120" width="100" height="100" fill="#006400"></rect> + </g> +</svg>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html index e6fc4d7..ae3dff1 100644 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html
@@ -1,38 +1,42 @@ <!DOCTYPE html> <title>mix-blend-mode: plus-lighter test</title> -<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> <link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> <link rel="match" href="reference/mix-blend-mode-plus-lighter-ref.html"> + <style> - .test { - width: 100px; - height: 100px; - position: relative; - isolation: isolate; - } - .layer { - position: absolute; - inset: 0; - mix-blend-mode: plus-lighter; - } +.container { + position: relative; + isolation: isolate; + width: 500px; + height: 500px; +} +.blue { background: #000064; } +.green { background: #006400; } +.common { + position: absolute; + width: 100px; + height: 100px; + opacity: 0.6; +} +.one { + top: 10px; + left: 10px; +} +.two { + top: 65px; + left: 30px; + mix-blend-mode: plus-lighter; +} +.three { + top: 120px; + left: 50px; + mix-blend-mode: plus-lighter; +} </style> -<script type="module"> - import { tests } from '../support/plus-lighter.js'; - import { toCSSColor } from '../support/utils.js'; - function createLayers(colors) { - let html = ''; - - for (const color of colors) { - html += `<div class="layer" style="background-color: ${toCSSColor(color)}"></div>`; - } - - return html; - } - - for (const colors of tests) { - document.body.insertAdjacentHTML('beforeend', ` - <div class="test">${createLayers(colors)}</div> - `); - } -</script> +<div class=container> + <div class="one common blue"></div> + <div class="two common blue"></div> + <div class="three common green"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html deleted file mode 100644 index e5acd26..0000000 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html +++ /dev/null
@@ -1,57 +0,0 @@ -<!DOCTYPE html> -<title>mix-blend-mode: plus-lighter test</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> - -<style> -.container { - isolation: isolate; - position: relative; - width: 500px; - height: 500px; -} -.blue { background: #000064; } -.green { background: #006400; } -.common { - position: absolute; - width: 100px; - height: 100px; - opacity: 0.6; -} -.one { - top: 10px; - left: 10px; -} -.two { - top: 65px; - left: 30px; -} -.three { - top: 120px; - left: 50px; -} -.one_and_two { - position: absolute; - width: 80px; - height: 45px; - top: 65px; - left: 30px; - background: #000078; -} -.two_and_three { - position: absolute; - width: 80px; - height: 45px; - top: 120px; - left: 50px; - background: #003C3C; -} -</style> - -<div class=container> - <div class="one common blue"></div> - <div class="two common blue"></div> - <div class="three common green"></div> - <div class="one_and_two"></div> - <div class="two_and_three"></div> -</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html index 4709ab8..e5acd26 100644 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html
@@ -1,20 +1,57 @@ <!DOCTYPE html> <title>mix-blend-mode: plus-lighter test</title> -<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> <link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> -<style> - .test { - width: 100px; - height: 100px; - } -</style> -<script type="module"> - import { tests, plusLighter } from '../../support/plus-lighter.js'; - import { toCSSColor } from '../../support/utils.js'; - for (const colors of tests) { - document.body.insertAdjacentHTML('beforeend', ` - <div class="test" style="background-color: ${toCSSColor(plusLighter(colors))}"></div> - `); - } -</script> +<style> +.container { + isolation: isolate; + position: relative; + width: 500px; + height: 500px; +} +.blue { background: #000064; } +.green { background: #006400; } +.common { + position: absolute; + width: 100px; + height: 100px; + opacity: 0.6; +} +.one { + top: 10px; + left: 10px; +} +.two { + top: 65px; + left: 30px; +} +.three { + top: 120px; + left: 50px; +} +.one_and_two { + position: absolute; + width: 80px; + height: 45px; + top: 65px; + left: 30px; + background: #000078; +} +.two_and_three { + position: absolute; + width: 80px; + height: 45px; + top: 120px; + left: 50px; + background: #003C3C; +} +</style> + +<div class=container> + <div class="one common blue"></div> + <div class="two common blue"></div> + <div class="three common green"></div> + <div class="one_and_two"></div> + <div class="two_and_three"></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html deleted file mode 100644 index 9193bb5..0000000 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html +++ /dev/null
@@ -1,19 +0,0 @@ -<!DOCTYPE html> -<title>mix-blend-mode: plus-lighter SVG test</title> -<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> -<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> - -<style> -.isolate { isolation: isolate; } -.original { opacity: 0.6; } -</style> - -<svg width=500 height=500> - <g class="isolate"> - <rect class="original" x="10" y="10" width="100" height="100" fill="#000064"></rect> - <rect class="original" x="30" y="65" width="100" height="100" fill="#000064"></rect> - <rect class="original" x="50" y="120" width="100" height="100" fill="#006400"></rect> - <rect x="30" y="65" width="80" height="45" fill="#000078"></rect> - <rect x="50" y="120" width="80" height="45" fill="#003C3C"></rect> - </g> -</svg>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html index 8e1cb70..9193bb5 100644 --- a/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html
@@ -1,14 +1,19 @@ <!DOCTYPE html> <title>mix-blend-mode: plus-lighter SVG test</title> -<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> <link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> -<script type="module"> - import { tests, plusLighter } from '../../support/plus-lighter.js'; - import { toCSSColor } from '../../support/utils.js'; - for (const colors of tests) { - document.body.insertAdjacentHTML('beforeend', ` - <svg width="100" height="100" style="background-color: ${toCSSColor(plusLighter(colors))}"></svg> - `); - } -</script> +<style> +.isolate { isolation: isolate; } +.original { opacity: 0.6; } +</style> + +<svg width=500 height=500> + <g class="isolate"> + <rect class="original" x="10" y="10" width="100" height="100" fill="#000064"></rect> + <rect class="original" x="30" y="65" width="100" height="100" fill="#000064"></rect> + <rect class="original" x="50" y="120" width="100" height="100" fill="#006400"></rect> + <rect x="30" y="65" width="80" height="45" fill="#000078"></rect> + <rect x="50" y="120" width="80" height="45" fill="#003C3C"></rect> + </g> +</svg>
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/support/plus-lighter.js b/third_party/blink/web_tests/external/wpt/css/compositing/support/plus-lighter.js deleted file mode 100644 index cadefa5..0000000 --- a/third_party/blink/web_tests/external/wpt/css/compositing/support/plus-lighter.js +++ /dev/null
@@ -1,47 +0,0 @@ -import { clamp01, multiplyAlpha, unmultiplyAlpha } from "./utils.js"; - -export function plusLighter(pixels) { - if (pixels.length === 1) return pixels[0]; - - return pixels.reduce((destination, source) => { - const premultipliedSource = multiplyAlpha(source); - const premultipliedDestination = multiplyAlpha(destination); - const premultipliedResult = premultipliedDestination.map((channel, i) => - clamp01(channel + premultipliedSource[i]) - ); - return unmultiplyAlpha(premultipliedResult); - }); -} - -export const tests = [ - // Each test is a list of colors to composite. - // Each color is [r, g, b, a], unmultiplied, in the range 0-1. - [ - [1, 0, 0, 0.5], - [0, 0, 1, 0.5], - ], - [ - [1, 0, 0, 0.25], - [0, 0, 1, 0.25], - ], - [ - [0.5, 0, 0, 0.5], - [0, 0, 1, 0.5], - ], - // Test clamping - [ - [1, 0, 0, 1], - [0, 0, 1, 1], - ], - // Test more than two elements - [ - [0.5, 0, 0, 0.25], - [0.25, 0.25, 0, 0.25], - [0.25, 0, 0.1, 0.25], - [0, 0, 0.1, 0.25], - ], - // Test a single element - [ - [0.5, 0, 0, 0.25], - ], -];
diff --git a/third_party/blink/web_tests/external/wpt/css/compositing/support/utils.js b/third_party/blink/web_tests/external/wpt/css/compositing/support/utils.js deleted file mode 100644 index eb369ce..0000000 --- a/third_party/blink/web_tests/external/wpt/css/compositing/support/utils.js +++ /dev/null
@@ -1,31 +0,0 @@ -export function multiplyAlpha(pixel) { - return pixel.map((channel, i) => { - // Pass the alpha channel through unchanged - if (i === 3) return channel; - // Otherwise, multiply by alpha - return channel * pixel[3]; - }); -} - -export function unmultiplyAlpha(pixel) { - return pixel.map((channel, i) => { - // Pass the alpha channel through unchanged - if (i === 3) return channel; - // Avoid divide-by-zero - if (pixel[3] === 0) return channel; - // Divide by alpha - return channel / pixel[3]; - }); -} - -export function clamp01(value) { - if (value < 0) return 0; - if (value > 1) return 1; - return value; -} - -const toPercent = (num) => `${num * 100}%`; -export const toCSSColor = (pixel) => - `rgb(${toPercent(pixel[0])} ${toPercent(pixel[1])} ${toPercent(pixel[2])} / ${ - pixel[3] - })`;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-cascade/idlharness.html b/third_party/blink/web_tests/external/wpt/css/css-cascade/idlharness.html index 9bde23b..80d3318 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-cascade/idlharness.html +++ b/third_party/blink/web_tests/external/wpt/css/css-cascade/idlharness.html
@@ -15,7 +15,7 @@ <script> 'use strict'; idl_test( - ['css-cascade'], + ['css-cascade-5'], ['cssom'], idl_array => { try {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-pseudo/idlharness-expected.txt b/third_party/blink/web_tests/external/wpt/css/css-pseudo/idlharness-expected.txt index f76169b..46168b2 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-pseudo/idlharness-expected.txt +++ b/third_party/blink/web_tests/external/wpt/css/css-pseudo/idlharness-expected.txt
@@ -15,15 +15,10 @@ FAIL CSSPseudoElement interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing FAIL CSSPseudoElement interface: attribute type assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing FAIL CSSPseudoElement interface: attribute element assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface: attribute parent assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface: operation pseudo(CSSOMString) assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing FAIL CSSPseudoElement must be primary interface of beforeElements.item(0) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" FAIL Stringification of beforeElements.item(0) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "element" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "parent" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "pseudo(CSSOMString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL CSSPseudoElement interface: calling pseudo(CSSOMString) on beforeElements.item(0) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" FAIL Element interface: operation pseudo(CSSOMString) assert_own_property: interface prototype object missing non-static operation expected property "pseudo" missing Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-001.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-001.html index a88f181..24ebd9f 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-001.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-001.html
@@ -18,9 +18,6 @@ @media not and { div { background-color: red; } } - @media and { - div { background-color: red; } - } </style> </head> <body>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-002.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-002.html index 763a7f29..71f597e 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-002.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-002.html
@@ -18,9 +18,6 @@ @media not or { div { background-color: red; } } - @media or { - div { background-color: red; } - } </style> </head> <body>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-003.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-003.html index acc524c..b12bd758 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-003.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-003.html
@@ -18,9 +18,6 @@ @media not not { div { background-color: red; } } - @media not { - div { background-color: red; } - } </style> </head> <body>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-004.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-004.html index 689c8d1a78..d039281c 100644 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-004.html +++ b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-004.html
@@ -18,9 +18,6 @@ @media not only { div { background-color: red; } } - @media only { - div { background-color: red; } - } </style> </head> <body>
diff --git a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-005.html b/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-005.html deleted file mode 100644 index 3e25a24..0000000 --- a/third_party/blink/web_tests/external/wpt/css/mediaqueries/mq-invalid-media-type-005.html +++ /dev/null
@@ -1,45 +0,0 @@ -<!DOCTYPE html> -<html> -<meta charset="utf-8"> -<title>Mediaqueries-3 test: parsing hanging-punctuation with invalid values</title> -<link rel="help" href="https://www.w3.org/TR/css3-mediaqueries/#error-handling"> -<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/"> -<meta name="flags" content="invalid"> -<meta name="assert" content="media types ''not'', ''and'', ''only'' and ''or'' must not be treated as unknown media types, but rather trigger the malformed query clause."> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<style> - @media not and { - div { background-color: red; } - } - @media and { - div { background-color: red; } - } - @media not or { - div { background-color: red; } - } - @media or { - div { background-color: red; } - } - @media not not { - div { background-color: red; } - } - @media not { - div { background-color: red; } - } - @media not only { - div { background-color: red; } - } - @media only { - div { background-color: red; } - } -</style> -<script> -var queries = document.styleSheets[0].cssRules; -test(() => { - for (const query of queries) { - assert_equals(query.conditionText, "not all"); - } - assert_equals(queries.length, 8, "invalid rules must be treated as 'not all', not dropped"); - }, "syntactical MQ keywords used as media types are a syntax error"); -</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/has-specificity.html b/third_party/blink/web_tests/external/wpt/css/selectors/has-specificity.html deleted file mode 100644 index b33e3a0e..0000000 --- a/third_party/blink/web_tests/external/wpt/css/selectors/has-specificity.html +++ /dev/null
@@ -1,42 +0,0 @@ -<!DOCTYPE html> -<title>Specificity for complex :has selectors</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<link rel="help" href="https://drafts.csswg.org/selectors/#specificity-rules"> -<style> - main :has(#foo) { --t0:PASS; } - main :has(.foo) { --t0:FAIL; } - - main :has(span#foo) { --t1:PASS; } - main :has(#foo) { --t1:FAIL; } - - main :has(.bar, #foo) { --t2:FAIL; } - main :has(#foo, .bar) { --t2:PASS; } - - main :has(.bar, #foo) { --t3:PASS; } - main :has(.foo, .bar) { --t3:FAIL; } - - main :has(span + span) { --t4:PASS; } - main :has(span) { --t4:FAIL; } - - main :has(span, li, #foo) { --t5:PASS; } - main :has(span, li, p) { --t5:FAIL; } -</style> -<main id=main> - <div id=div><p><span id=foo class=foo></span><span class=bar></span><li></li></p></div> -</main> -<script> - function test_value(name, description) { - test(function() { - let actual = getComputedStyle(div).getPropertyValue(name); - assert_equals(actual, 'PASS'); - }, description); - } - - test_value('--t0', ':has(#foo) wins over :has(.foo)'); - test_value('--t1', ':has(span#foo) wins over :has(#foo)'); - test_value('--t2', ':has(.bar, #foo) has same specificity as :has(#foo, .bar)'); - test_value('--t3', ':has(.bar, #foo) wins over :has(.foo, .bar)'); - test_value('--t4', ':has(span + span) wins over :has(span)'); - test_value('--t5', ':has(span, li, p) wins over :has(span, lo, p)'); -</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-complexity.html b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-complexity.html index 0bdcdec..df127bcf 100644 --- a/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-complexity.html +++ b/third_party/blink/web_tests/external/wpt/css/selectors/invalidation/has-complexity.html
@@ -9,7 +9,7 @@ div, main { color: grey } main:has(span) .subject { color: red } main:has(span + span) .subject { color: green } -main:has(span + final) .subject { color: blue } +main:has(final) .subject { color: blue } main:has(nonexistent + span) .subject { color: black } main:has(span) span { color: black } main:has(nonexistent) span { color: black }
diff --git a/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm-expected.txt b/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm-expected.txt deleted file mode 100644 index bbda97d..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -FAIL EventListener is cross-realm plain object without 'handleEvent' property assert_equals: expected "object" but got "undefined" -FAIL EventListener is cross-realm plain object with non-callable 'handleEvent' property assert_equals: expected "object" but got "undefined" -PASS EventListener is cross-realm plain object with revoked Proxy as 'handleEvent' property -FAIL EventListener is cross-realm non-callable revoked Proxy assert_equals: expected "object" but got "undefined" -PASS EventListener is cross-realm callable revoked Proxy -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm.html b/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm.html deleted file mode 100644 index 663d042..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/events/EventListener-handleEvent-cross-realm.html +++ /dev/null
@@ -1,75 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<title>Cross-realm EventListener throws TypeError of its associated Realm</title> -<link rel="help" href="https://webidl.spec.whatwg.org/#ref-for-prepare-to-run-script"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> - -<iframe name="eventListenerGlobalObject" src="resources/empty-document.html"></iframe> - -<script> -setup({ allow_uncaught_exception: true }); - -test_onload(() => { - const eventTarget = new EventTarget; - const eventListener = new eventListenerGlobalObject.Object; - - eventTarget.addEventListener("foo", eventListener); - assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); -}, "EventListener is cross-realm plain object without 'handleEvent' property"); - -test_onload(() => { - const eventTarget = new EventTarget; - const eventListener = new eventListenerGlobalObject.Object; - eventListener.handleEvent = {}; - - eventTarget.addEventListener("foo", eventListener); - assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); -}, "EventListener is cross-realm plain object with non-callable 'handleEvent' property"); - -test_onload(() => { - const eventTarget = new EventTarget; - const { proxy, revoke } = Proxy.revocable(() => {}, {}); - revoke(); - - const eventListener = new eventListenerGlobalObject.Object; - eventListener.handleEvent = proxy; - - eventTarget.addEventListener("foo", eventListener); - assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); -}, "EventListener is cross-realm plain object with revoked Proxy as 'handleEvent' property"); - -test_onload(() => { - const eventTarget = new EventTarget; - const { proxy, revoke } = eventListenerGlobalObject.Proxy.revocable({}, {}); - revoke(); - - eventTarget.addEventListener("foo", proxy); - assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); -}, "EventListener is cross-realm non-callable revoked Proxy"); - -test_onload(() => { - const eventTarget = new EventTarget; - const { proxy, revoke } = eventListenerGlobalObject.Proxy.revocable(() => {}, {}); - revoke(); - - eventTarget.addEventListener("foo", proxy); - assert_reports_exception(eventListenerGlobalObject.TypeError, () => { eventTarget.dispatchEvent(new Event("foo")); }); -}, "EventListener is cross-realm callable revoked Proxy"); - -function test_onload(fn, desc) { - async_test(t => { window.addEventListener("load", t.step_func_done(fn)); }, desc); -} - -function assert_reports_exception(expectedConstructor, fn) { - let error; - const onErrorHandler = event => { error = event.error; }; - - eventListenerGlobalObject.addEventListener("error", onErrorHandler); - fn(); - eventListenerGlobalObject.removeEventListener("error", onErrorHandler); - - assert_equals(typeof error, "object"); - assert_equals(error.constructor, expectedConstructor); -} -</script>
diff --git a/third_party/blink/web_tests/external/wpt/dom/events/resources/empty-document.html b/third_party/blink/web_tests/external/wpt/dom/events/resources/empty-document.html deleted file mode 100644 index b9cd130..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/events/resources/empty-document.html +++ /dev/null
@@ -1,3 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<body>
diff --git a/third_party/blink/web_tests/external/wpt/dom/idlharness.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/dom/idlharness.any.serviceworker-expected.txt deleted file mode 100644 index a67b4ba7..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/idlharness.any.serviceworker-expected.txt +++ /dev/null
@@ -1,216 +0,0 @@ -This is a testharness.js-based test. -Found 212 tests; 210 PASS, 2 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS idl_test setup -PASS idl_test validation -PASS Partial interface Window: original interface defined -PASS Partial interface Window: member names are unique -PASS Partial interface Document: member names are unique -PASS Partial interface Document[2]: member names are unique -PASS Partial interface Window[2]: member names are unique -PASS Document includes NonElementParentNode: member names are unique -PASS DocumentFragment includes NonElementParentNode: member names are unique -PASS Document includes ParentNode: member names are unique -PASS DocumentFragment includes ParentNode: member names are unique -PASS Element includes ParentNode: member names are unique -PASS Element includes NonDocumentTypeChildNode: member names are unique -PASS CharacterData includes NonDocumentTypeChildNode: member names are unique -PASS DocumentType includes ChildNode: member names are unique -PASS Element includes ChildNode: member names are unique -PASS CharacterData includes ChildNode: member names are unique -PASS Element includes Slottable: member names are unique -PASS Text includes Slottable: member names are unique -PASS Document includes XPathEvaluatorBase: member names are unique -PASS XPathEvaluator includes XPathEvaluatorBase: member names are unique -PASS Document includes GlobalEventHandlers: member names are unique -PASS Document includes DocumentAndElementEventHandlers: member names are unique -PASS HTMLElement includes GlobalEventHandlers: member names are unique -PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique -PASS HTMLElement includes ElementContentEditable: member names are unique -PASS HTMLElement includes HTMLOrSVGElement: member names are unique -PASS Window includes GlobalEventHandlers: member names are unique -PASS Window includes WindowEventHandlers: member names are unique -PASS Window includes WindowOrWorkerGlobalScope: member names are unique -PASS Window includes AnimationFrameProvider: member names are unique -PASS Window includes WindowSessionStorage: member names are unique -PASS Window includes WindowLocalStorage: member names are unique -PASS Event interface: existence and properties of interface object -PASS Event interface object length -PASS Event interface object name -PASS Event interface: existence and properties of interface prototype object -PASS Event interface: existence and properties of interface prototype object's "constructor" property -PASS Event interface: existence and properties of interface prototype object's @@unscopables property -PASS Event interface: attribute type -PASS Event interface: attribute target -PASS Event interface: attribute srcElement -PASS Event interface: attribute currentTarget -PASS Event interface: operation composedPath() -PASS Event interface: constant NONE on interface object -PASS Event interface: constant NONE on interface prototype object -PASS Event interface: constant CAPTURING_PHASE on interface object -PASS Event interface: constant CAPTURING_PHASE on interface prototype object -PASS Event interface: constant AT_TARGET on interface object -PASS Event interface: constant AT_TARGET on interface prototype object -PASS Event interface: constant BUBBLING_PHASE on interface object -PASS Event interface: constant BUBBLING_PHASE on interface prototype object -PASS Event interface: attribute eventPhase -PASS Event interface: operation stopPropagation() -PASS Event interface: attribute cancelBubble -PASS Event interface: operation stopImmediatePropagation() -PASS Event interface: attribute bubbles -PASS Event interface: attribute cancelable -PASS Event interface: attribute returnValue -PASS Event interface: operation preventDefault() -PASS Event interface: attribute defaultPrevented -PASS Event interface: attribute composed -PASS Event interface: attribute timeStamp -PASS Event interface: operation initEvent(DOMString, optional boolean, optional boolean) -PASS Event must be primary interface of new Event("foo") -PASS Stringification of new Event("foo") -PASS Event interface: new Event("foo") must inherit property "type" with the proper type -PASS Event interface: new Event("foo") must inherit property "target" with the proper type -PASS Event interface: new Event("foo") must inherit property "srcElement" with the proper type -PASS Event interface: new Event("foo") must inherit property "currentTarget" with the proper type -PASS Event interface: new Event("foo") must inherit property "composedPath()" with the proper type -PASS Event interface: new Event("foo") must inherit property "NONE" with the proper type -PASS Event interface: new Event("foo") must inherit property "CAPTURING_PHASE" with the proper type -PASS Event interface: new Event("foo") must inherit property "AT_TARGET" with the proper type -PASS Event interface: new Event("foo") must inherit property "BUBBLING_PHASE" with the proper type -PASS Event interface: new Event("foo") must inherit property "eventPhase" with the proper type -PASS Event interface: new Event("foo") must inherit property "stopPropagation()" with the proper type -PASS Event interface: new Event("foo") must inherit property "cancelBubble" with the proper type -PASS Event interface: new Event("foo") must inherit property "stopImmediatePropagation()" with the proper type -PASS Event interface: new Event("foo") must inherit property "bubbles" with the proper type -PASS Event interface: new Event("foo") must inherit property "cancelable" with the proper type -PASS Event interface: new Event("foo") must inherit property "returnValue" with the proper type -PASS Event interface: new Event("foo") must inherit property "preventDefault()" with the proper type -PASS Event interface: new Event("foo") must inherit property "defaultPrevented" with the proper type -PASS Event interface: new Event("foo") must inherit property "composed" with the proper type -PASS Event interface: new Event("foo") must have own property "isTrusted" -PASS Event interface: new Event("foo") must inherit property "timeStamp" with the proper type -PASS Event interface: new Event("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type -PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new Event("foo") with too few arguments must throw TypeError -PASS CustomEvent interface: existence and properties of interface object -PASS CustomEvent interface object length -PASS CustomEvent interface object name -PASS CustomEvent interface: existence and properties of interface prototype object -PASS CustomEvent interface: existence and properties of interface prototype object's "constructor" property -PASS CustomEvent interface: existence and properties of interface prototype object's @@unscopables property -PASS CustomEvent interface: attribute detail -PASS CustomEvent interface: operation initCustomEvent(DOMString, optional boolean, optional boolean, optional any) -PASS CustomEvent must be primary interface of new CustomEvent("foo") -PASS Stringification of new CustomEvent("foo") -PASS CustomEvent interface: new CustomEvent("foo") must inherit property "detail" with the proper type -PASS CustomEvent interface: new CustomEvent("foo") must inherit property "initCustomEvent(DOMString, optional boolean, optional boolean, optional any)" with the proper type -PASS CustomEvent interface: calling initCustomEvent(DOMString, optional boolean, optional boolean, optional any) on new CustomEvent("foo") with too few arguments must throw TypeError -PASS Event interface: new CustomEvent("foo") must inherit property "type" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "target" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "srcElement" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "currentTarget" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "composedPath()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "NONE" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "CAPTURING_PHASE" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "AT_TARGET" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "BUBBLING_PHASE" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "eventPhase" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "stopPropagation()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "cancelBubble" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "stopImmediatePropagation()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "bubbles" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "cancelable" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "preventDefault()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "defaultPrevented" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "composed" with the proper type -PASS Event interface: new CustomEvent("foo") must have own property "isTrusted" -PASS Event interface: new CustomEvent("foo") must inherit property "timeStamp" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type -PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new CustomEvent("foo") with too few arguments must throw TypeError -PASS EventTarget interface: existence and properties of interface object -PASS EventTarget interface object length -PASS EventTarget interface object name -PASS EventTarget interface: existence and properties of interface prototype object -PASS EventTarget interface: existence and properties of interface prototype object's "constructor" property -PASS EventTarget interface: existence and properties of interface prototype object's @@unscopables property -PASS EventTarget interface: operation addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) -PASS EventTarget interface: operation removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) -PASS EventTarget interface: operation dispatchEvent(Event) -PASS EventTarget must be primary interface of new EventTarget() -PASS Stringification of new EventTarget() -PASS EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError -PASS EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError -PASS EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type -PASS EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError -PASS EventListener interface: existence and properties of interface object -PASS AbortController interface: existence and properties of interface object -PASS AbortController interface object length -PASS AbortController interface object name -PASS AbortController interface: existence and properties of interface prototype object -PASS AbortController interface: existence and properties of interface prototype object's "constructor" property -PASS AbortController interface: existence and properties of interface prototype object's @@unscopables property -PASS AbortController interface: attribute signal -PASS AbortController interface: operation abort(optional any) -PASS AbortController must be primary interface of new AbortController() -PASS Stringification of new AbortController() -PASS AbortController interface: new AbortController() must inherit property "signal" with the proper type -PASS AbortController interface: new AbortController() must inherit property "abort(optional any)" with the proper type -PASS AbortController interface: calling abort(optional any) on new AbortController() with too few arguments must throw TypeError -PASS AbortSignal interface: existence and properties of interface object -PASS AbortSignal interface object length -PASS AbortSignal interface object name -PASS AbortSignal interface: existence and properties of interface prototype object -PASS AbortSignal interface: existence and properties of interface prototype object's "constructor" property -PASS AbortSignal interface: existence and properties of interface prototype object's @@unscopables property -PASS AbortSignal interface: operation abort(optional any) -PASS AbortSignal interface: attribute aborted -PASS AbortSignal interface: attribute reason -FAIL AbortSignal interface: operation throwIfAborted() assert_own_property: interface prototype object missing non-static operation expected property "throwIfAborted" missing -PASS AbortSignal interface: attribute onabort -PASS AbortSignal must be primary interface of new AbortController().signal -PASS Stringification of new AbortController().signal -PASS AbortSignal interface: new AbortController().signal must inherit property "abort(optional any)" with the proper type -PASS AbortSignal interface: calling abort(optional any) on new AbortController().signal with too few arguments must throw TypeError -PASS AbortSignal interface: new AbortController().signal must inherit property "aborted" with the proper type -PASS AbortSignal interface: new AbortController().signal must inherit property "reason" with the proper type -FAIL AbortSignal interface: new AbortController().signal must inherit property "throwIfAborted()" with the proper type assert_inherits: property "throwIfAborted" not found in prototype chain -PASS AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type -PASS EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError -PASS EventTarget interface: new AbortController().signal must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError -PASS EventTarget interface: new AbortController().signal must inherit property "dispatchEvent(Event)" with the proper type -PASS EventTarget interface: calling dispatchEvent(Event) on new AbortController().signal with too few arguments must throw TypeError -PASS NodeList interface: existence and properties of interface object -PASS HTMLCollection interface: existence and properties of interface object -PASS MutationObserver interface: existence and properties of interface object -PASS MutationRecord interface: existence and properties of interface object -PASS Node interface: existence and properties of interface object -PASS Document interface: existence and properties of interface object -PASS XMLDocument interface: existence and properties of interface object -PASS DOMImplementation interface: existence and properties of interface object -PASS DocumentType interface: existence and properties of interface object -PASS DocumentFragment interface: existence and properties of interface object -PASS ShadowRoot interface: existence and properties of interface object -PASS Element interface: existence and properties of interface object -PASS NamedNodeMap interface: existence and properties of interface object -PASS Attr interface: existence and properties of interface object -PASS CharacterData interface: existence and properties of interface object -PASS Text interface: existence and properties of interface object -PASS CDATASection interface: existence and properties of interface object -PASS ProcessingInstruction interface: existence and properties of interface object -PASS Comment interface: existence and properties of interface object -PASS AbstractRange interface: existence and properties of interface object -PASS StaticRange interface: existence and properties of interface object -PASS Range interface: existence and properties of interface object -PASS NodeIterator interface: existence and properties of interface object -PASS TreeWalker interface: existence and properties of interface object -PASS NodeFilter interface: existence and properties of interface object -PASS DOMTokenList interface: existence and properties of interface object -PASS XPathResult interface: existence and properties of interface object -PASS XPathExpression interface: existence and properties of interface object -PASS XPathNSResolver interface: existence and properties of interface object -PASS XPathEvaluator interface: existence and properties of interface object -PASS XSLTProcessor interface: existence and properties of interface object -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/dom/idlharness.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/dom/idlharness.any.sharedworker-expected.txt deleted file mode 100644 index a67b4ba7..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/idlharness.any.sharedworker-expected.txt +++ /dev/null
@@ -1,216 +0,0 @@ -This is a testharness.js-based test. -Found 212 tests; 210 PASS, 2 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS idl_test setup -PASS idl_test validation -PASS Partial interface Window: original interface defined -PASS Partial interface Window: member names are unique -PASS Partial interface Document: member names are unique -PASS Partial interface Document[2]: member names are unique -PASS Partial interface Window[2]: member names are unique -PASS Document includes NonElementParentNode: member names are unique -PASS DocumentFragment includes NonElementParentNode: member names are unique -PASS Document includes ParentNode: member names are unique -PASS DocumentFragment includes ParentNode: member names are unique -PASS Element includes ParentNode: member names are unique -PASS Element includes NonDocumentTypeChildNode: member names are unique -PASS CharacterData includes NonDocumentTypeChildNode: member names are unique -PASS DocumentType includes ChildNode: member names are unique -PASS Element includes ChildNode: member names are unique -PASS CharacterData includes ChildNode: member names are unique -PASS Element includes Slottable: member names are unique -PASS Text includes Slottable: member names are unique -PASS Document includes XPathEvaluatorBase: member names are unique -PASS XPathEvaluator includes XPathEvaluatorBase: member names are unique -PASS Document includes GlobalEventHandlers: member names are unique -PASS Document includes DocumentAndElementEventHandlers: member names are unique -PASS HTMLElement includes GlobalEventHandlers: member names are unique -PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique -PASS HTMLElement includes ElementContentEditable: member names are unique -PASS HTMLElement includes HTMLOrSVGElement: member names are unique -PASS Window includes GlobalEventHandlers: member names are unique -PASS Window includes WindowEventHandlers: member names are unique -PASS Window includes WindowOrWorkerGlobalScope: member names are unique -PASS Window includes AnimationFrameProvider: member names are unique -PASS Window includes WindowSessionStorage: member names are unique -PASS Window includes WindowLocalStorage: member names are unique -PASS Event interface: existence and properties of interface object -PASS Event interface object length -PASS Event interface object name -PASS Event interface: existence and properties of interface prototype object -PASS Event interface: existence and properties of interface prototype object's "constructor" property -PASS Event interface: existence and properties of interface prototype object's @@unscopables property -PASS Event interface: attribute type -PASS Event interface: attribute target -PASS Event interface: attribute srcElement -PASS Event interface: attribute currentTarget -PASS Event interface: operation composedPath() -PASS Event interface: constant NONE on interface object -PASS Event interface: constant NONE on interface prototype object -PASS Event interface: constant CAPTURING_PHASE on interface object -PASS Event interface: constant CAPTURING_PHASE on interface prototype object -PASS Event interface: constant AT_TARGET on interface object -PASS Event interface: constant AT_TARGET on interface prototype object -PASS Event interface: constant BUBBLING_PHASE on interface object -PASS Event interface: constant BUBBLING_PHASE on interface prototype object -PASS Event interface: attribute eventPhase -PASS Event interface: operation stopPropagation() -PASS Event interface: attribute cancelBubble -PASS Event interface: operation stopImmediatePropagation() -PASS Event interface: attribute bubbles -PASS Event interface: attribute cancelable -PASS Event interface: attribute returnValue -PASS Event interface: operation preventDefault() -PASS Event interface: attribute defaultPrevented -PASS Event interface: attribute composed -PASS Event interface: attribute timeStamp -PASS Event interface: operation initEvent(DOMString, optional boolean, optional boolean) -PASS Event must be primary interface of new Event("foo") -PASS Stringification of new Event("foo") -PASS Event interface: new Event("foo") must inherit property "type" with the proper type -PASS Event interface: new Event("foo") must inherit property "target" with the proper type -PASS Event interface: new Event("foo") must inherit property "srcElement" with the proper type -PASS Event interface: new Event("foo") must inherit property "currentTarget" with the proper type -PASS Event interface: new Event("foo") must inherit property "composedPath()" with the proper type -PASS Event interface: new Event("foo") must inherit property "NONE" with the proper type -PASS Event interface: new Event("foo") must inherit property "CAPTURING_PHASE" with the proper type -PASS Event interface: new Event("foo") must inherit property "AT_TARGET" with the proper type -PASS Event interface: new Event("foo") must inherit property "BUBBLING_PHASE" with the proper type -PASS Event interface: new Event("foo") must inherit property "eventPhase" with the proper type -PASS Event interface: new Event("foo") must inherit property "stopPropagation()" with the proper type -PASS Event interface: new Event("foo") must inherit property "cancelBubble" with the proper type -PASS Event interface: new Event("foo") must inherit property "stopImmediatePropagation()" with the proper type -PASS Event interface: new Event("foo") must inherit property "bubbles" with the proper type -PASS Event interface: new Event("foo") must inherit property "cancelable" with the proper type -PASS Event interface: new Event("foo") must inherit property "returnValue" with the proper type -PASS Event interface: new Event("foo") must inherit property "preventDefault()" with the proper type -PASS Event interface: new Event("foo") must inherit property "defaultPrevented" with the proper type -PASS Event interface: new Event("foo") must inherit property "composed" with the proper type -PASS Event interface: new Event("foo") must have own property "isTrusted" -PASS Event interface: new Event("foo") must inherit property "timeStamp" with the proper type -PASS Event interface: new Event("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type -PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new Event("foo") with too few arguments must throw TypeError -PASS CustomEvent interface: existence and properties of interface object -PASS CustomEvent interface object length -PASS CustomEvent interface object name -PASS CustomEvent interface: existence and properties of interface prototype object -PASS CustomEvent interface: existence and properties of interface prototype object's "constructor" property -PASS CustomEvent interface: existence and properties of interface prototype object's @@unscopables property -PASS CustomEvent interface: attribute detail -PASS CustomEvent interface: operation initCustomEvent(DOMString, optional boolean, optional boolean, optional any) -PASS CustomEvent must be primary interface of new CustomEvent("foo") -PASS Stringification of new CustomEvent("foo") -PASS CustomEvent interface: new CustomEvent("foo") must inherit property "detail" with the proper type -PASS CustomEvent interface: new CustomEvent("foo") must inherit property "initCustomEvent(DOMString, optional boolean, optional boolean, optional any)" with the proper type -PASS CustomEvent interface: calling initCustomEvent(DOMString, optional boolean, optional boolean, optional any) on new CustomEvent("foo") with too few arguments must throw TypeError -PASS Event interface: new CustomEvent("foo") must inherit property "type" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "target" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "srcElement" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "currentTarget" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "composedPath()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "NONE" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "CAPTURING_PHASE" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "AT_TARGET" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "BUBBLING_PHASE" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "eventPhase" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "stopPropagation()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "cancelBubble" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "stopImmediatePropagation()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "bubbles" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "cancelable" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "preventDefault()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "defaultPrevented" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "composed" with the proper type -PASS Event interface: new CustomEvent("foo") must have own property "isTrusted" -PASS Event interface: new CustomEvent("foo") must inherit property "timeStamp" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type -PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new CustomEvent("foo") with too few arguments must throw TypeError -PASS EventTarget interface: existence and properties of interface object -PASS EventTarget interface object length -PASS EventTarget interface object name -PASS EventTarget interface: existence and properties of interface prototype object -PASS EventTarget interface: existence and properties of interface prototype object's "constructor" property -PASS EventTarget interface: existence and properties of interface prototype object's @@unscopables property -PASS EventTarget interface: operation addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) -PASS EventTarget interface: operation removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) -PASS EventTarget interface: operation dispatchEvent(Event) -PASS EventTarget must be primary interface of new EventTarget() -PASS Stringification of new EventTarget() -PASS EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError -PASS EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError -PASS EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type -PASS EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError -PASS EventListener interface: existence and properties of interface object -PASS AbortController interface: existence and properties of interface object -PASS AbortController interface object length -PASS AbortController interface object name -PASS AbortController interface: existence and properties of interface prototype object -PASS AbortController interface: existence and properties of interface prototype object's "constructor" property -PASS AbortController interface: existence and properties of interface prototype object's @@unscopables property -PASS AbortController interface: attribute signal -PASS AbortController interface: operation abort(optional any) -PASS AbortController must be primary interface of new AbortController() -PASS Stringification of new AbortController() -PASS AbortController interface: new AbortController() must inherit property "signal" with the proper type -PASS AbortController interface: new AbortController() must inherit property "abort(optional any)" with the proper type -PASS AbortController interface: calling abort(optional any) on new AbortController() with too few arguments must throw TypeError -PASS AbortSignal interface: existence and properties of interface object -PASS AbortSignal interface object length -PASS AbortSignal interface object name -PASS AbortSignal interface: existence and properties of interface prototype object -PASS AbortSignal interface: existence and properties of interface prototype object's "constructor" property -PASS AbortSignal interface: existence and properties of interface prototype object's @@unscopables property -PASS AbortSignal interface: operation abort(optional any) -PASS AbortSignal interface: attribute aborted -PASS AbortSignal interface: attribute reason -FAIL AbortSignal interface: operation throwIfAborted() assert_own_property: interface prototype object missing non-static operation expected property "throwIfAborted" missing -PASS AbortSignal interface: attribute onabort -PASS AbortSignal must be primary interface of new AbortController().signal -PASS Stringification of new AbortController().signal -PASS AbortSignal interface: new AbortController().signal must inherit property "abort(optional any)" with the proper type -PASS AbortSignal interface: calling abort(optional any) on new AbortController().signal with too few arguments must throw TypeError -PASS AbortSignal interface: new AbortController().signal must inherit property "aborted" with the proper type -PASS AbortSignal interface: new AbortController().signal must inherit property "reason" with the proper type -FAIL AbortSignal interface: new AbortController().signal must inherit property "throwIfAborted()" with the proper type assert_inherits: property "throwIfAborted" not found in prototype chain -PASS AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type -PASS EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError -PASS EventTarget interface: new AbortController().signal must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError -PASS EventTarget interface: new AbortController().signal must inherit property "dispatchEvent(Event)" with the proper type -PASS EventTarget interface: calling dispatchEvent(Event) on new AbortController().signal with too few arguments must throw TypeError -PASS NodeList interface: existence and properties of interface object -PASS HTMLCollection interface: existence and properties of interface object -PASS MutationObserver interface: existence and properties of interface object -PASS MutationRecord interface: existence and properties of interface object -PASS Node interface: existence and properties of interface object -PASS Document interface: existence and properties of interface object -PASS XMLDocument interface: existence and properties of interface object -PASS DOMImplementation interface: existence and properties of interface object -PASS DocumentType interface: existence and properties of interface object -PASS DocumentFragment interface: existence and properties of interface object -PASS ShadowRoot interface: existence and properties of interface object -PASS Element interface: existence and properties of interface object -PASS NamedNodeMap interface: existence and properties of interface object -PASS Attr interface: existence and properties of interface object -PASS CharacterData interface: existence and properties of interface object -PASS Text interface: existence and properties of interface object -PASS CDATASection interface: existence and properties of interface object -PASS ProcessingInstruction interface: existence and properties of interface object -PASS Comment interface: existence and properties of interface object -PASS AbstractRange interface: existence and properties of interface object -PASS StaticRange interface: existence and properties of interface object -PASS Range interface: existence and properties of interface object -PASS NodeIterator interface: existence and properties of interface object -PASS TreeWalker interface: existence and properties of interface object -PASS NodeFilter interface: existence and properties of interface object -PASS DOMTokenList interface: existence and properties of interface object -PASS XPathResult interface: existence and properties of interface object -PASS XPathExpression interface: existence and properties of interface object -PASS XPathNSResolver interface: existence and properties of interface object -PASS XPathEvaluator interface: existence and properties of interface object -PASS XSLTProcessor interface: existence and properties of interface object -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/dom/idlharness.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/dom/idlharness.any.worker-expected.txt deleted file mode 100644 index a67b4ba7..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/idlharness.any.worker-expected.txt +++ /dev/null
@@ -1,216 +0,0 @@ -This is a testharness.js-based test. -Found 212 tests; 210 PASS, 2 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS idl_test setup -PASS idl_test validation -PASS Partial interface Window: original interface defined -PASS Partial interface Window: member names are unique -PASS Partial interface Document: member names are unique -PASS Partial interface Document[2]: member names are unique -PASS Partial interface Window[2]: member names are unique -PASS Document includes NonElementParentNode: member names are unique -PASS DocumentFragment includes NonElementParentNode: member names are unique -PASS Document includes ParentNode: member names are unique -PASS DocumentFragment includes ParentNode: member names are unique -PASS Element includes ParentNode: member names are unique -PASS Element includes NonDocumentTypeChildNode: member names are unique -PASS CharacterData includes NonDocumentTypeChildNode: member names are unique -PASS DocumentType includes ChildNode: member names are unique -PASS Element includes ChildNode: member names are unique -PASS CharacterData includes ChildNode: member names are unique -PASS Element includes Slottable: member names are unique -PASS Text includes Slottable: member names are unique -PASS Document includes XPathEvaluatorBase: member names are unique -PASS XPathEvaluator includes XPathEvaluatorBase: member names are unique -PASS Document includes GlobalEventHandlers: member names are unique -PASS Document includes DocumentAndElementEventHandlers: member names are unique -PASS HTMLElement includes GlobalEventHandlers: member names are unique -PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique -PASS HTMLElement includes ElementContentEditable: member names are unique -PASS HTMLElement includes HTMLOrSVGElement: member names are unique -PASS Window includes GlobalEventHandlers: member names are unique -PASS Window includes WindowEventHandlers: member names are unique -PASS Window includes WindowOrWorkerGlobalScope: member names are unique -PASS Window includes AnimationFrameProvider: member names are unique -PASS Window includes WindowSessionStorage: member names are unique -PASS Window includes WindowLocalStorage: member names are unique -PASS Event interface: existence and properties of interface object -PASS Event interface object length -PASS Event interface object name -PASS Event interface: existence and properties of interface prototype object -PASS Event interface: existence and properties of interface prototype object's "constructor" property -PASS Event interface: existence and properties of interface prototype object's @@unscopables property -PASS Event interface: attribute type -PASS Event interface: attribute target -PASS Event interface: attribute srcElement -PASS Event interface: attribute currentTarget -PASS Event interface: operation composedPath() -PASS Event interface: constant NONE on interface object -PASS Event interface: constant NONE on interface prototype object -PASS Event interface: constant CAPTURING_PHASE on interface object -PASS Event interface: constant CAPTURING_PHASE on interface prototype object -PASS Event interface: constant AT_TARGET on interface object -PASS Event interface: constant AT_TARGET on interface prototype object -PASS Event interface: constant BUBBLING_PHASE on interface object -PASS Event interface: constant BUBBLING_PHASE on interface prototype object -PASS Event interface: attribute eventPhase -PASS Event interface: operation stopPropagation() -PASS Event interface: attribute cancelBubble -PASS Event interface: operation stopImmediatePropagation() -PASS Event interface: attribute bubbles -PASS Event interface: attribute cancelable -PASS Event interface: attribute returnValue -PASS Event interface: operation preventDefault() -PASS Event interface: attribute defaultPrevented -PASS Event interface: attribute composed -PASS Event interface: attribute timeStamp -PASS Event interface: operation initEvent(DOMString, optional boolean, optional boolean) -PASS Event must be primary interface of new Event("foo") -PASS Stringification of new Event("foo") -PASS Event interface: new Event("foo") must inherit property "type" with the proper type -PASS Event interface: new Event("foo") must inherit property "target" with the proper type -PASS Event interface: new Event("foo") must inherit property "srcElement" with the proper type -PASS Event interface: new Event("foo") must inherit property "currentTarget" with the proper type -PASS Event interface: new Event("foo") must inherit property "composedPath()" with the proper type -PASS Event interface: new Event("foo") must inherit property "NONE" with the proper type -PASS Event interface: new Event("foo") must inherit property "CAPTURING_PHASE" with the proper type -PASS Event interface: new Event("foo") must inherit property "AT_TARGET" with the proper type -PASS Event interface: new Event("foo") must inherit property "BUBBLING_PHASE" with the proper type -PASS Event interface: new Event("foo") must inherit property "eventPhase" with the proper type -PASS Event interface: new Event("foo") must inherit property "stopPropagation()" with the proper type -PASS Event interface: new Event("foo") must inherit property "cancelBubble" with the proper type -PASS Event interface: new Event("foo") must inherit property "stopImmediatePropagation()" with the proper type -PASS Event interface: new Event("foo") must inherit property "bubbles" with the proper type -PASS Event interface: new Event("foo") must inherit property "cancelable" with the proper type -PASS Event interface: new Event("foo") must inherit property "returnValue" with the proper type -PASS Event interface: new Event("foo") must inherit property "preventDefault()" with the proper type -PASS Event interface: new Event("foo") must inherit property "defaultPrevented" with the proper type -PASS Event interface: new Event("foo") must inherit property "composed" with the proper type -PASS Event interface: new Event("foo") must have own property "isTrusted" -PASS Event interface: new Event("foo") must inherit property "timeStamp" with the proper type -PASS Event interface: new Event("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type -PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new Event("foo") with too few arguments must throw TypeError -PASS CustomEvent interface: existence and properties of interface object -PASS CustomEvent interface object length -PASS CustomEvent interface object name -PASS CustomEvent interface: existence and properties of interface prototype object -PASS CustomEvent interface: existence and properties of interface prototype object's "constructor" property -PASS CustomEvent interface: existence and properties of interface prototype object's @@unscopables property -PASS CustomEvent interface: attribute detail -PASS CustomEvent interface: operation initCustomEvent(DOMString, optional boolean, optional boolean, optional any) -PASS CustomEvent must be primary interface of new CustomEvent("foo") -PASS Stringification of new CustomEvent("foo") -PASS CustomEvent interface: new CustomEvent("foo") must inherit property "detail" with the proper type -PASS CustomEvent interface: new CustomEvent("foo") must inherit property "initCustomEvent(DOMString, optional boolean, optional boolean, optional any)" with the proper type -PASS CustomEvent interface: calling initCustomEvent(DOMString, optional boolean, optional boolean, optional any) on new CustomEvent("foo") with too few arguments must throw TypeError -PASS Event interface: new CustomEvent("foo") must inherit property "type" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "target" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "srcElement" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "currentTarget" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "composedPath()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "NONE" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "CAPTURING_PHASE" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "AT_TARGET" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "BUBBLING_PHASE" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "eventPhase" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "stopPropagation()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "cancelBubble" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "stopImmediatePropagation()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "bubbles" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "cancelable" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "preventDefault()" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "defaultPrevented" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "composed" with the proper type -PASS Event interface: new CustomEvent("foo") must have own property "isTrusted" -PASS Event interface: new CustomEvent("foo") must inherit property "timeStamp" with the proper type -PASS Event interface: new CustomEvent("foo") must inherit property "initEvent(DOMString, optional boolean, optional boolean)" with the proper type -PASS Event interface: calling initEvent(DOMString, optional boolean, optional boolean) on new CustomEvent("foo") with too few arguments must throw TypeError -PASS EventTarget interface: existence and properties of interface object -PASS EventTarget interface object length -PASS EventTarget interface object name -PASS EventTarget interface: existence and properties of interface prototype object -PASS EventTarget interface: existence and properties of interface prototype object's "constructor" property -PASS EventTarget interface: existence and properties of interface prototype object's @@unscopables property -PASS EventTarget interface: operation addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) -PASS EventTarget interface: operation removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) -PASS EventTarget interface: operation dispatchEvent(Event) -PASS EventTarget must be primary interface of new EventTarget() -PASS Stringification of new EventTarget() -PASS EventTarget interface: new EventTarget() must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError -PASS EventTarget interface: new EventTarget() must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new EventTarget() with too few arguments must throw TypeError -PASS EventTarget interface: new EventTarget() must inherit property "dispatchEvent(Event)" with the proper type -PASS EventTarget interface: calling dispatchEvent(Event) on new EventTarget() with too few arguments must throw TypeError -PASS EventListener interface: existence and properties of interface object -PASS AbortController interface: existence and properties of interface object -PASS AbortController interface object length -PASS AbortController interface object name -PASS AbortController interface: existence and properties of interface prototype object -PASS AbortController interface: existence and properties of interface prototype object's "constructor" property -PASS AbortController interface: existence and properties of interface prototype object's @@unscopables property -PASS AbortController interface: attribute signal -PASS AbortController interface: operation abort(optional any) -PASS AbortController must be primary interface of new AbortController() -PASS Stringification of new AbortController() -PASS AbortController interface: new AbortController() must inherit property "signal" with the proper type -PASS AbortController interface: new AbortController() must inherit property "abort(optional any)" with the proper type -PASS AbortController interface: calling abort(optional any) on new AbortController() with too few arguments must throw TypeError -PASS AbortSignal interface: existence and properties of interface object -PASS AbortSignal interface object length -PASS AbortSignal interface object name -PASS AbortSignal interface: existence and properties of interface prototype object -PASS AbortSignal interface: existence and properties of interface prototype object's "constructor" property -PASS AbortSignal interface: existence and properties of interface prototype object's @@unscopables property -PASS AbortSignal interface: operation abort(optional any) -PASS AbortSignal interface: attribute aborted -PASS AbortSignal interface: attribute reason -FAIL AbortSignal interface: operation throwIfAborted() assert_own_property: interface prototype object missing non-static operation expected property "throwIfAborted" missing -PASS AbortSignal interface: attribute onabort -PASS AbortSignal must be primary interface of new AbortController().signal -PASS Stringification of new AbortController().signal -PASS AbortSignal interface: new AbortController().signal must inherit property "abort(optional any)" with the proper type -PASS AbortSignal interface: calling abort(optional any) on new AbortController().signal with too few arguments must throw TypeError -PASS AbortSignal interface: new AbortController().signal must inherit property "aborted" with the proper type -PASS AbortSignal interface: new AbortController().signal must inherit property "reason" with the proper type -FAIL AbortSignal interface: new AbortController().signal must inherit property "throwIfAborted()" with the proper type assert_inherits: property "throwIfAborted" not found in prototype chain -PASS AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type -PASS EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError -PASS EventTarget interface: new AbortController().signal must inherit property "removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean))" with the proper type -PASS EventTarget interface: calling removeEventListener(DOMString, EventListener?, optional (EventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError -PASS EventTarget interface: new AbortController().signal must inherit property "dispatchEvent(Event)" with the proper type -PASS EventTarget interface: calling dispatchEvent(Event) on new AbortController().signal with too few arguments must throw TypeError -PASS NodeList interface: existence and properties of interface object -PASS HTMLCollection interface: existence and properties of interface object -PASS MutationObserver interface: existence and properties of interface object -PASS MutationRecord interface: existence and properties of interface object -PASS Node interface: existence and properties of interface object -PASS Document interface: existence and properties of interface object -PASS XMLDocument interface: existence and properties of interface object -PASS DOMImplementation interface: existence and properties of interface object -PASS DocumentType interface: existence and properties of interface object -PASS DocumentFragment interface: existence and properties of interface object -PASS ShadowRoot interface: existence and properties of interface object -PASS Element interface: existence and properties of interface object -PASS NamedNodeMap interface: existence and properties of interface object -PASS Attr interface: existence and properties of interface object -PASS CharacterData interface: existence and properties of interface object -PASS Text interface: existence and properties of interface object -PASS CDATASection interface: existence and properties of interface object -PASS ProcessingInstruction interface: existence and properties of interface object -PASS Comment interface: existence and properties of interface object -PASS AbstractRange interface: existence and properties of interface object -PASS StaticRange interface: existence and properties of interface object -PASS Range interface: existence and properties of interface object -PASS NodeIterator interface: existence and properties of interface object -PASS TreeWalker interface: existence and properties of interface object -PASS NodeFilter interface: existence and properties of interface object -PASS DOMTokenList interface: existence and properties of interface object -PASS XPathResult interface: existence and properties of interface object -PASS XPathExpression interface: existence and properties of interface object -PASS XPathNSResolver interface: existence and properties of interface object -PASS XPathEvaluator interface: existence and properties of interface object -PASS XSLTProcessor interface: existence and properties of interface object -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/dom/idlharness.window_exclude=Node-expected.txt b/third_party/blink/web_tests/external/wpt/dom/idlharness.window_exclude=Node-expected.txt index aa4572f1..12920ef 100644 --- a/third_party/blink/web_tests/external/wpt/dom/idlharness.window_exclude=Node-expected.txt +++ b/third_party/blink/web_tests/external/wpt/dom/idlharness.window_exclude=Node-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 1292 tests; 1287 PASS, 5 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 1290 tests; 1287 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Window: original interface defined @@ -194,7 +194,6 @@ PASS AbortSignal interface: operation abort(optional any) PASS AbortSignal interface: attribute aborted PASS AbortSignal interface: attribute reason -FAIL AbortSignal interface: operation throwIfAborted() assert_own_property: interface prototype object missing non-static operation expected property "throwIfAborted" missing PASS AbortSignal interface: attribute onabort PASS AbortSignal must be primary interface of new AbortController().signal PASS Stringification of new AbortController().signal @@ -202,7 +201,6 @@ PASS AbortSignal interface: calling abort(optional any) on new AbortController().signal with too few arguments must throw TypeError PASS AbortSignal interface: new AbortController().signal must inherit property "aborted" with the proper type PASS AbortSignal interface: new AbortController().signal must inherit property "reason" with the proper type -FAIL AbortSignal interface: new AbortController().signal must inherit property "throwIfAborted()" with the proper type assert_inherits: property "throwIfAborted" not found in prototype chain PASS AbortSignal interface: new AbortController().signal must inherit property "onabort" with the proper type PASS EventTarget interface: new AbortController().signal must inherit property "addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean))" with the proper type PASS EventTarget interface: calling addEventListener(DOMString, EventListener?, optional (AddEventListenerOptions or boolean)) on new AbortController().signal with too few arguments must throw TypeError
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-expected.txt b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-expected.txt new file mode 100644 index 0000000..7948b1b --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-expected.txt
@@ -0,0 +1,7 @@ +This is a testharness.js-based test. +PASS parent's |this|, parent's method, parent's filter, parent's root +PASS parent's |this|, parent's method, parent's filter, iframe's root +FAIL parent's |this|, parent's method, iframe's filter, iframe's root assert_equals: expected function "function TypeError() { [native code] }" but got function "function TypeError() { [native code] }" +PASS parent's |this|, iframes's method, iframe's filter, iframe's root +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-expected.txt b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-expected.txt new file mode 100644 index 0000000..e9ed6f0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL TreeWalker: NodeFilter from detached iframe works as expected Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is no longer runnable. +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html index f8e71bc..4d6bb53 100644 --- a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html +++ b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm-null-browsing-context.html
@@ -1,12 +1,11 @@ <!DOCTYPE html> <meta charset="utf-8"> -<title>TreeWalker: NodeFilter from detached iframe doesn't get called</title> +<title>TreeWalker: NodeFilter from detached iframe works as expected</title> +<link rel="help" href="https://dom.spec.whatwg.org/#ref-for-call-a-user-objects-operation%E2%91%A0"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <body> -<div></div> - <script> const t = async_test(); @@ -17,13 +16,8 @@ iframe.remove(); assert_equals(iframe.contentWindow, null); - - let errorWasThrown = false; - try { nodeIterator.nextNode(); } - catch { errorWasThrown = true; } - - assert_true(errorWasThrown); - assert_false(nodeIterator.dummyFilterCalled); + assert_equals(nodeIterator.nextNode(), document.body); + assert_true(nodeIterator.dummyFilterCalled); }); document.body.append(iframe);
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm.html b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm.html index da91cf6c..60a80d31 100644 --- a/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm.html +++ b/third_party/blink/web_tests/external/wpt/dom/traversal/TreeWalker-acceptNode-filter-cross-realm.html
@@ -1,60 +1,21 @@ <!DOCTYPE html> -<meta charset="utf-8"> -<title>TreeWalker: cross-realm NodeFilter throws TypeError of its associated Realm</title> -<link rel="help" href="https://webidl.spec.whatwg.org/#ref-for-prepare-to-run-script"> +<title>TreeWalker: cross-realm NodeFilter throws TypeError of current realm</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://webidl.spec.whatwg.org/#call-a-user-objects-operation"> -<iframe name="nodeFilterGlobalObject" src="support/empty-document.html"></iframe> - -<div id="treeWalkerRoot"> - <div class="firstChild"></div> -</div> +<body id="treeWalkerRoot"> +<div></div> <script> -test_onload(() => { - const nodeFilter = new nodeFilterGlobalObject.Object; - - const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, nodeFilter); - assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); -}, "NodeFilter is cross-realm plain object without 'acceptNode' property"); - -test_onload(() => { - const nodeFilter = new nodeFilterGlobalObject.Object; - nodeFilter.acceptNode = {}; - - const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, nodeFilter); - assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); -}, "NodeFilter is cross-realm plain object with non-callable 'acceptNode' property"); - -test_onload(() => { - const { proxy, revoke } = Proxy.revocable(() => {}, {}); - revoke(); - - const nodeFilter = new nodeFilterGlobalObject.Object; - nodeFilter.acceptNode = proxy; - - const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, nodeFilter); - assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); -}, "NodeFilter is cross-realm plain object with revoked Proxy as 'acceptNode' property"); - -test_onload(() => { - const { proxy, revoke } = nodeFilterGlobalObject.Proxy.revocable({}, {}); - revoke(); - - const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, proxy); - assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); -}, "NodeFilter is cross-realm non-callable revoked Proxy"); - -test_onload(() => { - const { proxy, revoke } = nodeFilterGlobalObject.Proxy.revocable(() => {}, {}); - revoke(); - - const walker = document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, proxy); - assert_throws_js(nodeFilterGlobalObject.TypeError, () => { walker.firstChild(); }); -}, "NodeFilter is cross-realm callable revoked Proxy"); - -function test_onload(fn, desc) { - async_test(t => { window.addEventListener("load", t.step_func_done(fn)); }, desc); -} +const iframe = document.createElement("iframe"); +iframe.src = "support/TreeWalker-acceptNode-filter-cross-realm-subframe.html"; +iframe.onload = () => { + for (const testCase of iframe.contentWindow.testCases) { + test(t => { + assert_equals(testCase.actual.constructor, testCase.expected); + }, testCase.description); + } +}; +document.body.append(iframe); </script>
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/support/TreeWalker-acceptNode-filter-cross-realm-subframe.html b/third_party/blink/web_tests/external/wpt/dom/traversal/support/TreeWalker-acceptNode-filter-cross-realm-subframe.html new file mode 100644 index 0000000..0c8bda14 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/dom/traversal/support/TreeWalker-acceptNode-filter-cross-realm-subframe.html
@@ -0,0 +1,22 @@ +<!DOCTYPE html> + +<body id="treeWalkerRoot"> +<div></div> + +<script> +window.testCases = []; + +(function() { + let walker = parent.document.createTreeWalker(parent.treeWalkerRoot, NodeFilter.SHOW_ELEMENT, new parent.Object); + try { walker.firstChild(); } catch (err) { testCases.push({ actual: err, expected: parent.TypeError, description: "parent's |this|, parent's method, parent's filter, parent's root" }); } + + walker = parent.document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, new parent.Object); + try { walker.firstChild(); } catch (err) { testCases.push({ actual: err, expected: parent.TypeError, description: "parent's |this|, parent's method, parent's filter, iframe's root" }); } + + walker = parent.document.createTreeWalker(treeWalkerRoot, NodeFilter.SHOW_ELEMENT, {}); + try { walker.firstChild(); } catch (err) { testCases.push({ actual: err, expected: parent.TypeError, description: "parent's |this|, parent's method, iframe's filter, iframe's root" }); } + + walker = document.createTreeWalker.call(parent.document, treeWalkerRoot, NodeFilter.SHOW_ELEMENT, {}); + try { walker.firstChild(); } catch (err) { testCases.push({ actual: err, expected: TypeError, description: "parent's |this|, iframes's method, iframe's filter, iframe's root" }); } +})(); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/dom/traversal/support/empty-document.html b/third_party/blink/web_tests/external/wpt/dom/traversal/support/empty-document.html deleted file mode 100644 index b9cd130..0000000 --- a/third_party/blink/web_tests/external/wpt/dom/traversal/support/empty-document.html +++ /dev/null
@@ -1,3 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<body>
diff --git a/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm-expected.txt b/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm-expected.txt deleted file mode 100644 index 1e681034..0000000 --- a/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This is a testharness.js-based test. -FAIL XPathNSResolver is cross-realm plain object without 'lookupNamespaceURI' property assert_unreached: Should have rejected: undefined Reached unreachable code -FAIL XPathNSResolver is cross-realm plain object with non-callable 'lookupNamespaceURI' property assert_unreached: Should have rejected: undefined Reached unreachable code -FAIL XPathNSResolver is cross-realm plain object with revoked Proxy as 'lookupNamespaceURI' property assert_unreached: Should have rejected: undefined Reached unreachable code -FAIL XPathNSResolver is cross-realm non-callable revoked Proxy assert_unreached: Should have rejected: undefined Reached unreachable code -FAIL XPathNSResolver is cross-realm callable revoked Proxy assert_unreached: Should have rejected: undefined Reached unreachable code -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm.html b/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm.html deleted file mode 100644 index 55fbb07..0000000 --- a/third_party/blink/web_tests/external/wpt/domxpath/resolver-callback-interface-cross-realm.html +++ /dev/null
@@ -1,67 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<title>Cross-realm XPathNSResolver throws TypeError of its associated Realm</title> -<link rel="help" href="https://webidl.spec.whatwg.org/#ref-for-prepare-to-run-script"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/invalid_namespace_test.js"></script> - -<iframe name="resolverGlobalObject" src="resources/empty-document.html"></iframe> - -<script> -setup({ allow_uncaught_exception: true }); - -const iframeLoaded = new Promise(resolve => { window.addEventListener("load", resolve); }); - -promise_test(async t => { - await iframeLoaded; - const resolver = new resolverGlobalObject.Object; - - return promise_rejects_js(t, resolverGlobalObject.TypeError, - invalid_namespace_test(t, resolver, resolverGlobalObject) - ); -}, "XPathNSResolver is cross-realm plain object without 'lookupNamespaceURI' property"); - -promise_test(async t => { - await iframeLoaded; - const resolver = new resolverGlobalObject.Object; - resolver.lookupNamespaceURI = {}; - - return promise_rejects_js(t, resolverGlobalObject.TypeError, - invalid_namespace_test(t, resolver, resolverGlobalObject) - ); -}, "XPathNSResolver is cross-realm plain object with non-callable 'lookupNamespaceURI' property"); - -promise_test(async t => { - await iframeLoaded; - const { proxy, revoke } = Proxy.revocable(() => {}, {}); - revoke(); - - const resolver = new resolverGlobalObject.Object; - resolver.lookupNamespaceURI = proxy; - - return promise_rejects_js(t, resolverGlobalObject.TypeError, - invalid_namespace_test(t, resolver, resolverGlobalObject) - ); -}, "XPathNSResolver is cross-realm plain object with revoked Proxy as 'lookupNamespaceURI' property"); - -promise_test(async t => { - await iframeLoaded; - const { proxy, revoke } = resolverGlobalObject.Proxy.revocable({}, {}); - revoke(); - - return promise_rejects_js(t, resolverGlobalObject.TypeError, - invalid_namespace_test(t, proxy, resolverGlobalObject) - ); -}, "XPathNSResolver is cross-realm non-callable revoked Proxy"); - -promise_test(async t => { - await iframeLoaded; - const { proxy, revoke } = resolverGlobalObject.Proxy.revocable(() => {}, {}); - revoke(); - - return promise_rejects_js(t, resolverGlobalObject.TypeError, - invalid_namespace_test(t, proxy, resolverGlobalObject) - ); -}, "XPathNSResolver is cross-realm callable revoked Proxy"); -</script>
diff --git a/third_party/blink/web_tests/external/wpt/domxpath/resources/empty-document.html b/third_party/blink/web_tests/external/wpt/domxpath/resources/empty-document.html deleted file mode 100644 index b9cd130..0000000 --- a/third_party/blink/web_tests/external/wpt/domxpath/resources/empty-document.html +++ /dev/null
@@ -1,3 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<body>
diff --git a/third_party/blink/web_tests/external/wpt/domxpath/resources/invalid_namespace_test.js b/third_party/blink/web_tests/external/wpt/domxpath/resources/invalid_namespace_test.js index 8b934ef..b985261 100644 --- a/third_party/blink/web_tests/external/wpt/domxpath/resources/invalid_namespace_test.js +++ b/third_party/blink/web_tests/external/wpt/domxpath/resources/invalid_namespace_test.js
@@ -1,15 +1,15 @@ "use strict"; setup({ allow_uncaught_exception: true }); -const invalid_namespace_test = (t, resolver, resolverWindow = window) => { +const invalid_namespace_test = (t, resolver) => { const result = new Promise((resolve, reject) => { const handler = event => { reject(event.error); }; - resolverWindow.addEventListener("error", handler); + window.addEventListener("error", handler); t.add_cleanup(() => { - resolverWindow.removeEventListener("error", handler); + window.removeEventListener("error", handler); }); t.step_timeout(resolve, 0);
diff --git a/third_party/blink/web_tests/external/wpt/event-timing/idlharness.any-expected.txt b/third_party/blink/web_tests/external/wpt/event-timing/idlharness.any-expected.txt deleted file mode 100644 index c4137e86..0000000 --- a/third_party/blink/web_tests/external/wpt/event-timing/idlharness.any-expected.txt +++ /dev/null
@@ -1,39 +0,0 @@ -This is a testharness.js-based test. -PASS idl_test setup -PASS idl_test validation -PASS Partial interface Performance: original interface defined -PASS Partial interface Performance: valid exposure set -PASS Partial interface Performance: member names are unique -PASS Partial dictionary PerformanceObserverInit: original dictionary defined -PASS Partial dictionary PerformanceObserverInit: member names are unique -PASS Partial interface Performance[2]: member names are unique -PASS PerformanceEventTiming interface: existence and properties of interface object -PASS PerformanceEventTiming interface object length -PASS PerformanceEventTiming interface object name -PASS PerformanceEventTiming interface: existence and properties of interface prototype object -PASS PerformanceEventTiming interface: existence and properties of interface prototype object's "constructor" property -PASS PerformanceEventTiming interface: existence and properties of interface prototype object's @@unscopables property -PASS PerformanceEventTiming interface: attribute processingStart -PASS PerformanceEventTiming interface: attribute processingEnd -PASS PerformanceEventTiming interface: attribute cancelable -PASS PerformanceEventTiming interface: attribute target -PASS PerformanceEventTiming interface: attribute interactionId -PASS PerformanceEventTiming interface: operation toJSON() -PASS EventCounts interface: existence and properties of interface object -PASS EventCounts interface object length -PASS EventCounts interface object name -PASS EventCounts interface: existence and properties of interface prototype object -PASS EventCounts interface: existence and properties of interface prototype object's "constructor" property -PASS EventCounts interface: existence and properties of interface prototype object's @@unscopables property -FAIL InteractionCounts interface: existence and properties of interface object assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing -FAIL InteractionCounts interface object length assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing -FAIL InteractionCounts interface object name assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing -FAIL InteractionCounts interface: existence and properties of interface prototype object assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing -FAIL InteractionCounts interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing -FAIL InteractionCounts interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "InteractionCounts" expected property "InteractionCounts" missing -PASS Performance interface: attribute eventCounts -FAIL Performance interface: attribute interactionCounts assert_true: The prototype object must have a property "interactionCounts" expected true got false -PASS Performance interface: performance must inherit property "eventCounts" with the proper type -FAIL Performance interface: performance must inherit property "interactionCounts" with the proper type assert_inherits: property "interactionCounts" not found in prototype chain -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/geolocation-API/idlharness.https.window.js b/third_party/blink/web_tests/external/wpt/geolocation-API/idlharness.https.window.js index 176bae8..7f83eaf 100644 --- a/third_party/blink/web_tests/external/wpt/geolocation-API/idlharness.https.window.js +++ b/third_party/blink/web_tests/external/wpt/geolocation-API/idlharness.https.window.js
@@ -4,7 +4,7 @@ // https://www.w3.org/TR/geolocation-API/ idl_test( - ['geolocation'], + ['geolocation-API'], ['hr-time', 'html'], idl_array => { self.audio = document.createElement('audio');
diff --git a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt index 0e04c917..9609f52 100644 --- a/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/html/dom/idlharness.worker-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 822 tests; 813 PASS, 9 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 816 tests; 808 PASS, 8 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Document: original interface defined @@ -254,12 +254,6 @@ PASS HTMLSlotElement interface: existence and properties of interface object PASS HTMLCanvasElement interface: existence and properties of interface object PASS CanvasRenderingContext2D interface: existence and properties of interface object -PASS CanvasFilter interface: existence and properties of interface object -FAIL CanvasFilter interface object length assert_equals: wrong value for CanvasFilter.length expected 0 but got 1 -PASS CanvasFilter interface object name -PASS CanvasFilter interface: existence and properties of interface prototype object -PASS CanvasFilter interface: existence and properties of interface prototype object's "constructor" property -PASS CanvasFilter interface: existence and properties of interface prototype object's @@unscopables property PASS CanvasGradient interface: existence and properties of interface object PASS CanvasGradient interface object length PASS CanvasGradient interface object name
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size-ref.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size-ref.html deleted file mode 100644 index 8b1b422..0000000 --- a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size-ref.html +++ /dev/null
@@ -1,8 +0,0 @@ -<!doctype html> -<title>CSS Test Reference</title> -<select> - <option>ABC</option> -</select> -<select> - <option>ABC</option> -</select>
diff --git a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size.html b/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size.html deleted file mode 100644 index 7f36708..0000000 --- a/third_party/blink/web_tests/external/wpt/html/rendering/replaced-elements/the-select-element/select-intrinsic-option-font-size.html +++ /dev/null
@@ -1,9 +0,0 @@ -<!doctype html> -<title>Select should be as wide as needed to fit its options regardless of option styles</title> -<link rel=match href=select-intrinsic-option-font-size-ref.html> -<select> - <option style="font-size: 5px">ABC</option> -</select> -<select> - <option style="font-size: 50px">ABC</option> -</select>
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/OES_draw_buffers_indexed.idl b/third_party/blink/web_tests/external/wpt/interfaces/OES_draw_buffers_indexed.idl index bf1932c..25696f12 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/OES_draw_buffers_indexed.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/OES_draw_buffers_indexed.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: WebGL OES_draw_buffers_indexed Extension Specification (https://www.khronos.org/registry/webgl/extensions/OES_draw_buffers_indexed/) +// Source: WebGL OES_draw_buffers_indexed Extension Draft Specification (https://www.khronos.org/registry/webgl/extensions/OES_draw_buffers_indexed/) [Exposed=(Window,Worker), LegacyNoInterfaceObject] interface OES_draw_buffers_indexed {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/app-history.idl b/third_party/blink/web_tests/external/wpt/interfaces/app-history.idl index f5f1b7e..b87bb582 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/app-history.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/app-history.idl
@@ -121,7 +121,7 @@ [Exposed=Window] interface AppHistoryEntry : EventTarget { - readonly attribute USVString? url; + readonly attribute USVString url; readonly attribute DOMString key; readonly attribute DOMString id; readonly attribute long long index;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/autoplay.idl b/third_party/blink/web_tests/external/wpt/interfaces/autoplay.idl deleted file mode 100644 index f2be5bb..0000000 --- a/third_party/blink/web_tests/external/wpt/interfaces/autoplay.idl +++ /dev/null
@@ -1,18 +0,0 @@ -// GENERATED CONTENT - DO NOT EDIT -// Content was automatically extracted by Reffy into webref -// (https://github.com/w3c/webref) -// Source: Autoplay Policy Detection (https://w3c.github.io/autoplay/) - -enum AutoplayPolicy { - "allowed", - "allowed-muted", - "disallowed" -}; - -partial interface Document { - readonly attribute AutoplayPolicy autoplayPolicy; -}; - -partial interface HTMLMediaElement { - readonly attribute AutoplayPolicy autoplayPolicy; -};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/compute-pressure.idl b/third_party/blink/web_tests/external/wpt/interfaces/compute-pressure.idl index 0cf880b..8ea37bf 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/compute-pressure.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/compute-pressure.idl
@@ -4,7 +4,7 @@ // Source: Compute Pressure API (https://wicg.github.io/compute-pressure/) callback ComputePressureUpdateCallback = undefined ( - ComputePressureEntry update, + ComputePressureObserverUpdate update, ComputePressureObserver observer ); @@ -18,7 +18,7 @@ undefined unobserve(); }; -dictionary ComputePressureEntry { +dictionary ComputePressureObserverUpdate { double cpuSpeed; double cpuUtilization; ComputePressureObserverOptions options;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/contact-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/contact-api.idl index d7f2ba5d..7f67a5d 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/contact-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/contact-api.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: Contact Picker API (https://w3c.github.io/contact-api/spec/) +// Source: Contact Picker API (https://wicg.github.io/contact-api/spec/) [Exposed=Window] partial interface Navigator {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/credential-management.idl b/third_party/blink/web_tests/external/wpt/interfaces/credential-management.idl index bf1adba..a07aa0b 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/credential-management.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/credential-management.idl
@@ -7,7 +7,6 @@ interface Credential { readonly attribute USVString id; readonly attribute DOMString type; - static boolean isConditionalMediationAvailable(); }; [SecureContext] @@ -40,7 +39,6 @@ enum CredentialMediationRequirement { "silent", "optional", - "conditional", "required" };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-cascade-5.idl similarity index 75% rename from third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl rename to third_party/blink/web_tests/external/wpt/interfaces/css-cascade-5.idl index 9011dc7..4166ae6 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-cascade.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-cascade-5.idl
@@ -1,8 +1,6 @@ -// GENERATED CONTENT - DO NOT EDIT -// Content was automatically extracted by Reffy into webref -// (https://github.com/w3c/webref) // Source: CSS Cascading and Inheritance Level 5 (https://drafts.csswg.org/css-cascade-5/) +[Exposed=Window] partial interface CSSImportRule { readonly attribute CSSOMString? layerName; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-highlight-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-highlight-api.idl index f3c6b2e9..56db8c35 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-highlight-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-highlight-api.idl
@@ -3,18 +3,11 @@ // (https://github.com/w3c/webref) // Source: CSS Custom Highlight API Module Level 1 (https://drafts.csswg.org/css-highlight-api-1/) -enum HighlightType { - "highlight", - "spelling-error", - "grammar-error" -}; - [Exposed=Window] interface Highlight { constructor(AbstractRange... initialRanges); setlike<AbstractRange>; attribute long priority; - attribute HighlightType type; }; partial namespace CSS {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-pseudo.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-pseudo.idl index dbe4c54..2c90ff2b 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-pseudo.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-pseudo.idl
@@ -7,8 +7,6 @@ interface CSSPseudoElement : EventTarget { readonly attribute CSSOMString type; readonly attribute Element element; - readonly attribute (Element or CSSPseudoElement) parent; - CSSPseudoElement? pseudo(CSSOMString type); }; partial interface Element {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/css-typed-om.idl b/third_party/blink/web_tests/external/wpt/interfaces/css-typed-om.idl index 3a0a6bd..b3942e6b 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/css-typed-om.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/css-typed-om.idl
@@ -323,7 +323,7 @@ interface CSSColorValue : CSSStyleValue { readonly attribute CSSKeywordValue colorSpace; CSSColorValue to(CSSKeywordish colorSpace); - [Exposed=Window] static (CSSColorValue or CSSStyleValue) parse(USVString cssText); + [Exposed=Window] static CSSColorValue parse(USVString cssText); }; [Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/dom.idl b/third_party/blink/web_tests/external/wpt/interfaces/dom.idl index 635072d5..d3255b4 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/dom.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/dom.idl
@@ -97,7 +97,6 @@ readonly attribute boolean aborted; readonly attribute any reason; - undefined throwIfAborted(); attribute EventHandler onabort; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/edit-context.idl b/third_party/blink/web_tests/external/wpt/interfaces/edit-context.idl deleted file mode 100644 index f5e60bd..0000000 --- a/third_party/blink/web_tests/external/wpt/interfaces/edit-context.idl +++ /dev/null
@@ -1,113 +0,0 @@ -// GENERATED CONTENT - DO NOT EDIT -// Content was automatically extracted by Reffy into webref -// (https://github.com/w3c/webref) -// Source: EditContext API (https://w3c.github.io/edit-context/) - -partial interface Element { - attribute EditContext? editContext; -}; - -dictionary EditContextInit { - DOMString text; - unsigned long selectionStart; - unsigned long selectionEnd; -}; - -[Exposed=Window] -interface EditContext : EventTarget { - constructor(optional EditContextInit options = {}); - - undefined updateText(unsigned long rangeStart, unsigned long rangeEnd, - DOMString text); - undefined updateSelection(unsigned long start, unsigned long end); - undefined updateControlBound(DOMRect controlBound); - undefined updateSelectionBound(DOMRect selectionBound); - undefined updateCharacterBounds(unsigned long rangeStart, sequence<DOMRect> characterBounds); - - sequence<Element> attachedElements(); - - readonly attribute DOMString text; - readonly attribute unsigned long selectionStart; - readonly attribute unsigned long selectionEnd; - readonly attribute unsigned long compositionRangeStart; - readonly attribute unsigned long compositionRangeEnd; - readonly attribute boolean isInComposition; - readonly attribute DOMRect controlBound; - readonly attribute DOMRect selectionBound; - readonly attribute unsigned long characterBoundsRangeStart; - sequence<DOMRect> characterBounds(); - - attribute EventHandler ontextupdate; - attribute EventHandler ontextformatupdate; - attribute EventHandler oncharacterboundsupdate; - attribute EventHandler oncompositionstart; - attribute EventHandler oncompositionend; -}; - -dictionary TextUpdateEventInit { - unsigned long updateRangeStart; - unsigned long updateRangeEnd; - DOMString text; - unsigned long selectionStart; - unsigned long selectionEnd; - unsigned long compositionStart; - unsigned long compositionEnd; -}; - -[Exposed=Window] -interface TextUpdateEvent : Event { - constructor(optional TextUpdateEventInit options = {}); - readonly attribute unsigned long updateRangeStart; - readonly attribute unsigned long updateRangeEnd; - readonly attribute DOMString text; - readonly attribute unsigned long selectionStart; - readonly attribute unsigned long selectionEnd; - readonly attribute unsigned long compositionStart; - readonly attribute unsigned long compositionEnd; -}; - -dictionary TextFormatInit { - unsigned long rangeStart; - unsigned long rangeEnd; - DOMString textColor; - DOMString backgroundColor; - DOMString underlineStyle; - DOMString underlineThickness; - DOMString underlineColor; -}; - -[Exposed=Window] -interface TextFormat { - constructor(optional TextFormatInit options = {}); - attribute unsigned long rangeStart; - attribute unsigned long rangeEnd; - attribute DOMString textColor; - attribute DOMString backgroundColor; - attribute DOMString underlineStyle; - attribute DOMString underlineThickness; - attribute DOMString underlineColor; -}; - -dictionary TextFormatUpdateEventInit { - sequence<TextFormat> textFormats; -}; - -[Exposed=Window] -interface TextFormatUpdateEvent : Event { - constructor(optional TextFormatUpdateEventInit options = {}); - - sequence<TextFormat> getTextFormats(); -}; - -dictionary CharacterBoundsUpdateEventInit { - unsigned long rangeStart; - unsigned long rangeEnd; -}; - -[Exposed=Window] -interface CharacterBoundsUpdateEvent : Event { - constructor(optional CharacterBoundsUpdateEventInit options = {}); - - readonly attribute unsigned long rangeStart; - readonly attribute unsigned long rangeEnd; -};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/event-timing.idl b/third_party/blink/web_tests/external/wpt/interfaces/event-timing.idl index 329570e..98e8d920f 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/event-timing.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/event-timing.idl
@@ -19,14 +19,8 @@ }; [Exposed=Window] -interface InteractionCounts { - readonly maplike<DOMString, unsigned long long>; -}; - -[Exposed=Window] partial interface Performance { [SameObject] readonly attribute EventCounts eventCounts; - [SameObject] readonly attribute InteractionCounts interactionCounts; }; partial dictionary PerformanceObserverInit {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/geolocation.idl b/third_party/blink/web_tests/external/wpt/interfaces/geolocation-API.idl similarity index 100% rename from third_party/blink/web_tests/external/wpt/interfaces/geolocation.idl rename to third_party/blink/web_tests/external/wpt/interfaces/geolocation-API.idl
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/html.idl b/third_party/blink/web_tests/external/wpt/interfaces/html.idl index 2eaf5d0..2b5efa90 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/html.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/html.idl
@@ -933,8 +933,6 @@ undefined setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode = "preserve"); undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); - undefined showPicker(); - // also has obsolete members }; @@ -1369,14 +1367,7 @@ interface mixin CanvasFilters { // filters - attribute (DOMString or CanvasFilter) filter; // (default "none") -}; - -typedef record<DOMString, any> CanvasFilterInput; - -[Exposed=(Window,Worker,PaintWorklet)] -interface CanvasFilter { - constructor(optional (CanvasFilterInput or sequence<CanvasFilterInput>) filters); + attribute DOMString filter; // (default "none") }; interface mixin CanvasRect { @@ -2002,9 +1993,9 @@ // timers long setTimeout(TimerHandler handler, optional long timeout = 0, any... arguments); - undefined clearTimeout(optional long id = 0); + undefined clearTimeout(optional long handle = 0); long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments); - undefined clearInterval(optional long id = 0); + undefined clearInterval(optional long handle = 0); // microtask queuing undefined queueMicrotask(VoidFunction callback);
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webxr-lighting-estimation.idl b/third_party/blink/web_tests/external/wpt/interfaces/lighting-estimation.idl similarity index 100% rename from third_party/blink/web_tests/external/wpt/interfaces/webxr-lighting-estimation.idl rename to third_party/blink/web_tests/external/wpt/interfaces/lighting-estimation.idl
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/local-font-access.idl b/third_party/blink/web_tests/external/wpt/interfaces/local-font-access.idl index e37b2c7d..577cd36 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/local-font-access.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/local-font-access.idl
@@ -8,18 +8,20 @@ [SameObject] readonly attribute FontManager fonts; }; Navigator includes NavigatorFonts; +WorkerNavigator includes NavigatorFonts; [SecureContext, - Exposed=Window] + Exposed=(Window,Worker)] interface FontManager { Promise<sequence<FontMetadata>> query(optional QueryOptions options = {}); }; dictionary QueryOptions { + boolean persistentAccess = false; sequence<DOMString> select = []; }; -[Exposed=Window] +[Exposed=(Window,Worker)] interface FontMetadata { Promise<Blob> blob();
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/manifest-incubations.idl b/third_party/blink/web_tests/external/wpt/interfaces/manifest-incubations.idl deleted file mode 100644 index bab3998..0000000 --- a/third_party/blink/web_tests/external/wpt/interfaces/manifest-incubations.idl +++ /dev/null
@@ -1,24 +0,0 @@ -// GENERATED CONTENT - DO NOT EDIT -// Content was automatically extracted by Reffy into webref -// (https://github.com/w3c/webref) -// Source: Manifest Incubations (https://wicg.github.io/manifest-incubations/) - -[Exposed=Window] -interface BeforeInstallPromptEvent : Event { - constructor(DOMString type, optional EventInit eventInitDict = {}); - Promise<PromptResponseObject> prompt(); -}; - -dictionary PromptResponseObject { - AppBannerPromptOutcome userChoice; -}; - -enum AppBannerPromptOutcome { - "accepted", - "dismissed" -}; - -partial interface Window { - attribute EventHandler onappinstalled; - attribute EventHandler onbeforeinstallprompt; -};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-streams.idl b/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-streams.idl index 33511eb..7d51a2a 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-streams.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-streams.idl
@@ -238,11 +238,3 @@ typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) ConstrainDOMString; - -dictionary DevicePermissionDescriptor : PermissionDescriptor { - DOMString deviceId; -}; - -dictionary CameraDevicePermissionDescriptor : DevicePermissionDescriptor { - boolean panTiltZoom = false; -};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-transform.idl b/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-transform.idl deleted file mode 100644 index 5b2c8fa6..0000000 --- a/third_party/blink/web_tests/external/wpt/interfaces/mediacapture-transform.idl +++ /dev/null
@@ -1,23 +0,0 @@ -// GENERATED CONTENT - DO NOT EDIT -// Content was automatically extracted by Reffy into webref -// (https://github.com/w3c/webref) -// Source: MediaStreamTrack Insertable Media Processing using Streams (https://w3c.github.io/mediacapture-transform/) - -[Exposed=DedicatedWorker] -interface MediaStreamTrackProcessor { - constructor(MediaStreamTrackProcessorInit init); - attribute ReadableStream readable; -}; - -dictionary MediaStreamTrackProcessorInit { - required MediaStreamTrack track; - [EnforceRange] unsigned short maxBufferSize; -}; - -[Exposed=DedicatedWorker] -interface VideoTrackGenerator { - constructor(); - readonly attribute WritableStream writable; - attribute boolean muted; - readonly attribute MediaStreamTrack track; -};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl b/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl index 3a0f159..3112ef6 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/permissions.idl
@@ -56,3 +56,11 @@ "speaker-selection", "xr-spatial-tracking", }; + +dictionary DevicePermissionDescriptor : PermissionDescriptor { + DOMString deviceId; +}; + +dictionary CameraDevicePermissionDescriptor : DevicePermissionDescriptor { + boolean panTiltZoom = false; +};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/priority-hints.idl b/third_party/blink/web_tests/external/wpt/interfaces/priority-hints.idl deleted file mode 100644 index 835b0180..0000000 --- a/third_party/blink/web_tests/external/wpt/interfaces/priority-hints.idl +++ /dev/null
@@ -1,30 +0,0 @@ -// GENERATED CONTENT - DO NOT EDIT -// Content was automatically extracted by Reffy into webref -// (https://github.com/w3c/webref) -// Source: Priority Hints (https://wicg.github.io/priority-hints/) - -enum Importance { "high", "low", "auto" }; - -partial interface Request { - readonly attribute Importance importance; -}; - -partial dictionary RequestInit { - Importance importance; -}; - -partial interface HTMLImageElement { - [CEReactions] attribute DOMString importance; -}; - -partial interface HTMLLinkElement { - [CEReactions] attribute DOMString importance; -}; - -partial interface HTMLScriptElement { - [CEReactions] attribute DOMString importance; -}; - -partial interface HTMLIFrameElement { - [CEReactions] attribute DOMString importance; -};
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl index 8268384..b98da2a 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/sanitizer-api.idl
@@ -16,11 +16,8 @@ static SanitizerConfig getDefaultConfiguration(); }; -dictionary SetHTMLOptions { - Sanitizer sanitizer; -}; partial interface Element { - undefined setHTML(DOMString input, optional SetHTMLOptions options = {}); + undefined setHTML(DOMString input, Sanitizer sanitizer); }; dictionary SanitizerConfig {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl b/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl index 1522bff..0a4416e 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/secure-payment-confirmation.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: Secure Payment Confirmation (https://w3c.github.io/secure-payment-confirmation/) +// Source: Secure Payment Confirmation (https://w3c.github.io/secure-payment-confirmation) dictionary SecurePaymentConfirmationRequest { required BufferSource challenge;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/streams.idl b/third_party/blink/web_tests/external/wpt/interfaces/streams.idl index f7084dd..2ebe5b74 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/streams.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/streams.idl
@@ -74,8 +74,8 @@ ReadableStreamDefaultReader includes ReadableStreamGenericReader; dictionary ReadableStreamDefaultReadResult { - any value; - boolean done; + any value; + boolean done; }; [Exposed=(Window,Worker,Worklet)] @@ -88,8 +88,8 @@ ReadableStreamBYOBReader includes ReadableStreamGenericReader; dictionary ReadableStreamBYOBReadResult { - ArrayBufferView value; - boolean done; + ArrayBufferView value; + boolean done; }; [Exposed=(Window,Worker,Worklet)]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/wasm-js-api.idl b/third_party/blink/web_tests/external/wpt/interfaces/wasm-js-api.idl index 141af90..b56c8cf 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/wasm-js-api.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/wasm-js-api.idl
@@ -92,7 +92,6 @@ "i64", "f32", "f64", - "v128", "externref", "anyfunc", };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/web-locks.idl b/third_party/blink/web_tests/external/wpt/interfaces/web-locks.idl index d79e404..a0319a0 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/web-locks.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/web-locks.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: Web Locks API (https://w3c.github.io/web-locks/) +// Source: Web Locks API (https://wicg.github.io/web-locks/) [SecureContext] interface mixin NavigatorLocks {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl b/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl index ff042b0..3b8be7fd 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/web-nfc.idl
@@ -51,7 +51,6 @@ Promise<undefined> scan(optional NDEFScanOptions options={}); Promise<undefined> write(NDEFMessageSource message, optional NDEFWriteOptions options={}); - Promise<undefined> makeReadOnly(optional NDEFMakeReadOnlyOptions options={}); }; [SecureContext, Exposed=Window] @@ -72,10 +71,6 @@ AbortSignal? signal; }; -dictionary NDEFMakeReadOnlyOptions { - AbortSignal? signal; -}; - dictionary NDEFScanOptions { AbortSignal signal; };
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl b/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl index 2b89760..9214320 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webauthn.idl
@@ -1,7 +1,7 @@ // GENERATED CONTENT - DO NOT EDIT // Content was automatically extracted by Reffy into webref // (https://github.com/w3c/webref) -// Source: Web Authentication: An API for accessing Public Key Credentials - Level (https://w3c.github.io/webauthn/) +// Source: Web Authentication: An API for accessing Public Key Credentials - Level 3 (https://w3c.github.io/webauthn/) [SecureContext, Exposed=Window] interface PublicKeyCredential : Credential {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl b/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl index 6ded86e..c23ba78 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webgpu.idl
@@ -277,19 +277,13 @@ "rgba32sint", "rgba32float", - // Depth/stencil formats + // Depth and stencil formats "stencil8", "depth16unorm", "depth24plus", "depth24plus-stencil8", "depth32float", - // "depth24unorm-stencil8" feature - "depth24unorm-stencil8", - - // "depth32float-stencil8" feature - "depth32float-stencil8", - // BC compressed formats usable if "texture-compression-bc" is both // supported by the device/user agent and enabled in requestDevice. "bc1-rgba-unorm", @@ -350,6 +344,12 @@ "astc-12x10-unorm-srgb", "astc-12x12-unorm", "astc-12x12-unorm-srgb", + + // "depth24unorm-stencil8" feature + "depth24unorm-stencil8", + + // "depth32float-stencil8" feature + "depth32float-stencil8", }; [Exposed=(Window, DedicatedWorker), SecureContext] @@ -517,14 +517,9 @@ }; GPUShaderModule includes GPUObjectBase; -dictionary GPUShaderModuleCompilationHint { - required GPUPipelineLayout layout; -}; - dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { required USVString code; object sourceMap; - record<USVString, GPUShaderModuleCompilationHint> hints; }; enum GPUCompilationMessageType { @@ -782,9 +777,6 @@ dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase { }; -interface mixin GPUCommandsMixin { -}; - [Exposed=(Window, DedicatedWorker), SecureContext] interface GPUCommandEncoder { GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); @@ -812,10 +804,14 @@ GPUImageCopyTexture destination, GPUExtent3D copySize); - undefined clearBuffer( - GPUBuffer buffer, - optional GPUSize64 offset = 0, - optional GPUSize64 size); + undefined fillBuffer( + GPUBuffer destination, + GPUSize64 destinationOffset, + GPUSize64 size); + + undefined pushDebugGroup(USVString groupLabel); + undefined popDebugGroup(); + undefined insertDebugMarker(USVString markerLabel); undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex); @@ -829,8 +825,6 @@ GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {}); }; GPUCommandEncoder includes GPUObjectBase; -GPUCommandEncoder includes GPUCommandsMixin; -GPUCommandEncoder includes GPUDebugCommandsMixin; dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { }; @@ -860,7 +854,6 @@ dictionary GPUImageCopyExternalImage { required (ImageBitmap or HTMLCanvasElement or OffscreenCanvas) source; GPUOrigin2D origin = {}; - boolean flipY = false; }; interface mixin GPUProgrammablePassEncoder { @@ -871,9 +864,7 @@ Uint32Array dynamicOffsetsData, GPUSize64 dynamicOffsetsDataStart, GPUSize32 dynamicOffsetsDataLength); -}; -interface mixin GPUDebugCommandsMixin { undefined pushDebugGroup(USVString groupLabel); undefined popDebugGroup(); undefined insertDebugMarker(USVString markerLabel); @@ -888,8 +879,6 @@ undefined endPass(); }; GPUComputePassEncoder includes GPUObjectBase; -GPUComputePassEncoder includes GPUCommandsMixin; -GPUComputePassEncoder includes GPUDebugCommandsMixin; GPUComputePassEncoder includes GPUProgrammablePassEncoder; enum GPUComputePassTimestampLocation { @@ -945,8 +934,6 @@ undefined endPass(); }; GPURenderPassEncoder includes GPUObjectBase; -GPURenderPassEncoder includes GPUCommandsMixin; -GPURenderPassEncoder includes GPUDebugCommandsMixin; GPURenderPassEncoder includes GPUProgrammablePassEncoder; GPURenderPassEncoder includes GPURenderEncoderBase; @@ -1018,8 +1005,6 @@ GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); }; GPURenderBundleEncoder includes GPUObjectBase; -GPURenderBundleEncoder includes GPUCommandsMixin; -GPURenderBundleEncoder includes GPUDebugCommandsMixin; GPURenderBundleEncoder includes GPUProgrammablePassEncoder; GPURenderBundleEncoder includes GPURenderEncoderBase; @@ -1138,7 +1123,7 @@ DOMString type, GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict ); - readonly attribute GPUError error; + [SameObject] readonly attribute GPUError error; }; dictionary GPUUncapturedErrorEventInit : EventInit {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webhid.idl b/third_party/blink/web_tests/external/wpt/interfaces/webhid.idl index 997d82c3..d4ce439 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webhid.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webhid.idl
@@ -37,7 +37,6 @@ readonly attribute FrozenArray<HIDCollectionInfo> collections; Promise<undefined> open(); Promise<undefined> close(); - Promise<undefined> forget(); Promise<undefined> sendReport([EnforceRange] octet reportId, BufferSource data); Promise<undefined> sendFeatureReport( [EnforceRange] octet reportId,
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webrtc.idl b/third_party/blink/web_tests/external/wpt/interfaces/webrtc.idl index aed8fbb..ff0a4a9 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webrtc.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webrtc.idl
@@ -4,11 +4,11 @@ // Source: WebRTC 1.0: Real-Time Communication Between Browsers (https://w3c.github.io/webrtc-pc/) dictionary RTCConfiguration { - sequence<RTCIceServer> iceServers = []; - RTCIceTransportPolicy iceTransportPolicy = "all"; - RTCBundlePolicy bundlePolicy = "balanced"; - RTCRtcpMuxPolicy rtcpMuxPolicy = "require"; - sequence<RTCCertificate> certificates = []; + sequence<RTCIceServer> iceServers; + RTCIceTransportPolicy iceTransportPolicy; + RTCBundlePolicy bundlePolicy; + RTCRtcpMuxPolicy rtcpMuxPolicy; + sequence<RTCCertificate> certificates; [EnforceRange] octet iceCandidatePoolSize = 0; }; @@ -247,7 +247,7 @@ }; dictionary RTCCertificateExpiration { - [EnforceRange] unsigned long long expires; + [EnforceRange] EpochTimeStamp expires; }; [Exposed=Window, Serializable]
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webtransport.idl b/third_party/blink/web_tests/external/wpt/interfaces/webtransport.idl index 95ab9e0..f098e47 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webtransport.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webtransport.idl
@@ -46,8 +46,8 @@ }; dictionary WebTransportCloseInfo { - unsigned long closeCode = 0; - DOMString reason = ""; + unsigned long closeCode; + DOMString reason; }; dictionary WebTransportStats {
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/window-controls-overlay.idl b/third_party/blink/web_tests/external/wpt/interfaces/window-controls-overlay.idl index 051978d6..de5e674 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/window-controls-overlay.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/window-controls-overlay.idl
@@ -11,18 +11,18 @@ [Exposed=Window] interface WindowControlsOverlay : EventTarget { readonly attribute boolean visible; - DOMRect getTitlebarAreaRect(); + DOMRect getBoundingClientRect(); attribute EventHandler ongeometrychange; }; [Exposed=Window] interface WindowControlsOverlayGeometryChangeEvent : Event { constructor(DOMString type, WindowControlsOverlayGeometryChangeEventInit eventInitDict); - [SameObject] readonly attribute DOMRect titlebarAreaRect; + [SameObject] readonly attribute DOMRect boundingRect; readonly attribute boolean visible; }; dictionary WindowControlsOverlayGeometryChangeEventInit : EventInit { - required DOMRect titlebarAreaRect; + required DOMRect boundingRect; boolean visible = false; };
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-streams/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/mediacapture-streams/idlharness.https.window-expected.txt index 07cd17d..35a2f4c 100644 --- a/third_party/blink/web_tests/external/wpt/mediacapture-streams/idlharness.https.window-expected.txt +++ b/third_party/blink/web_tests/external/wpt/mediacapture-streams/idlharness.https.window-expected.txt
@@ -1,5 +1,6 @@ This is a testharness.js-based test. -FAIL idl_test setup promise_test: Unhandled rejection with value: object "DevicePermissionDescriptor inherits PermissionDescriptor, but PermissionDescriptor is undefined." +Found 190 tests; 184 PASS, 6 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup PASS idl_test validation PASS Partial interface Navigator: original interface defined PASS Partial interface Navigator: member names are unique @@ -15,5 +16,179 @@ PASS Navigator includes NavigatorCookies: member names are unique PASS Navigator includes NavigatorPlugins: member names are unique PASS Navigator includes NavigatorConcurrentHardware: member names are unique +PASS MediaStream interface: existence and properties of interface object +PASS MediaStream interface object length +PASS MediaStream interface object name +PASS MediaStream interface: existence and properties of interface prototype object +PASS MediaStream interface: existence and properties of interface prototype object's "constructor" property +PASS MediaStream interface: existence and properties of interface prototype object's @@unscopables property +PASS MediaStream interface: attribute id +PASS MediaStream interface: operation getAudioTracks() +PASS MediaStream interface: operation getVideoTracks() +PASS MediaStream interface: operation getTracks() +PASS MediaStream interface: operation getTrackById(DOMString) +PASS MediaStream interface: operation addTrack(MediaStreamTrack) +PASS MediaStream interface: operation removeTrack(MediaStreamTrack) +PASS MediaStream interface: operation clone() +PASS MediaStream interface: attribute active +PASS MediaStream interface: attribute onaddtrack +PASS MediaStream interface: attribute onremovetrack +PASS MediaStream must be primary interface of stream +PASS Stringification of stream +PASS MediaStream interface: stream must inherit property "id" with the proper type +PASS MediaStream interface: stream must inherit property "getAudioTracks()" with the proper type +PASS MediaStream interface: stream must inherit property "getVideoTracks()" with the proper type +PASS MediaStream interface: stream must inherit property "getTracks()" with the proper type +PASS MediaStream interface: stream must inherit property "getTrackById(DOMString)" with the proper type +PASS MediaStream interface: calling getTrackById(DOMString) on stream with too few arguments must throw TypeError +PASS MediaStream interface: stream must inherit property "addTrack(MediaStreamTrack)" with the proper type +PASS MediaStream interface: calling addTrack(MediaStreamTrack) on stream with too few arguments must throw TypeError +PASS MediaStream interface: stream must inherit property "removeTrack(MediaStreamTrack)" with the proper type +PASS MediaStream interface: calling removeTrack(MediaStreamTrack) on stream with too few arguments must throw TypeError +PASS MediaStream interface: stream must inherit property "clone()" with the proper type +PASS MediaStream interface: stream must inherit property "active" with the proper type +PASS MediaStream interface: stream must inherit property "onaddtrack" with the proper type +PASS MediaStream interface: stream must inherit property "onremovetrack" with the proper type +PASS MediaStream must be primary interface of new MediaStream() +PASS Stringification of new MediaStream() +PASS MediaStream interface: new MediaStream() must inherit property "id" with the proper type +PASS MediaStream interface: new MediaStream() must inherit property "getAudioTracks()" with the proper type +PASS MediaStream interface: new MediaStream() must inherit property "getVideoTracks()" with the proper type +PASS MediaStream interface: new MediaStream() must inherit property "getTracks()" with the proper type +PASS MediaStream interface: new MediaStream() must inherit property "getTrackById(DOMString)" with the proper type +PASS MediaStream interface: calling getTrackById(DOMString) on new MediaStream() with too few arguments must throw TypeError +PASS MediaStream interface: new MediaStream() must inherit property "addTrack(MediaStreamTrack)" with the proper type +PASS MediaStream interface: calling addTrack(MediaStreamTrack) on new MediaStream() with too few arguments must throw TypeError +PASS MediaStream interface: new MediaStream() must inherit property "removeTrack(MediaStreamTrack)" with the proper type +PASS MediaStream interface: calling removeTrack(MediaStreamTrack) on new MediaStream() with too few arguments must throw TypeError +PASS MediaStream interface: new MediaStream() must inherit property "clone()" with the proper type +PASS MediaStream interface: new MediaStream() must inherit property "active" with the proper type +PASS MediaStream interface: new MediaStream() must inherit property "onaddtrack" with the proper type +PASS MediaStream interface: new MediaStream() must inherit property "onremovetrack" with the proper type +PASS MediaStreamTrack interface: existence and properties of interface object +PASS MediaStreamTrack interface object length +PASS MediaStreamTrack interface object name +PASS MediaStreamTrack interface: existence and properties of interface prototype object +PASS MediaStreamTrack interface: existence and properties of interface prototype object's "constructor" property +PASS MediaStreamTrack interface: existence and properties of interface prototype object's @@unscopables property +PASS MediaStreamTrack interface: attribute kind +PASS MediaStreamTrack interface: attribute id +PASS MediaStreamTrack interface: attribute label +PASS MediaStreamTrack interface: attribute enabled +PASS MediaStreamTrack interface: attribute muted +PASS MediaStreamTrack interface: attribute onmute +PASS MediaStreamTrack interface: attribute onunmute +PASS MediaStreamTrack interface: attribute readyState +PASS MediaStreamTrack interface: attribute onended +PASS MediaStreamTrack interface: operation clone() +PASS MediaStreamTrack interface: operation stop() +PASS MediaStreamTrack interface: operation getCapabilities() +PASS MediaStreamTrack interface: operation getConstraints() +PASS MediaStreamTrack interface: operation getSettings() +PASS MediaStreamTrack interface: operation applyConstraints(optional MediaTrackConstraints) +PASS MediaStreamTrack must be primary interface of track +PASS Stringification of track +PASS MediaStreamTrack interface: track must inherit property "kind" with the proper type +PASS MediaStreamTrack interface: track must inherit property "id" with the proper type +PASS MediaStreamTrack interface: track must inherit property "label" with the proper type +PASS MediaStreamTrack interface: track must inherit property "enabled" with the proper type +PASS MediaStreamTrack interface: track must inherit property "muted" with the proper type +PASS MediaStreamTrack interface: track must inherit property "onmute" with the proper type +PASS MediaStreamTrack interface: track must inherit property "onunmute" with the proper type +PASS MediaStreamTrack interface: track must inherit property "readyState" with the proper type +PASS MediaStreamTrack interface: track must inherit property "onended" with the proper type +PASS MediaStreamTrack interface: track must inherit property "clone()" with the proper type +PASS MediaStreamTrack interface: track must inherit property "stop()" with the proper type +PASS MediaStreamTrack interface: track must inherit property "getCapabilities()" with the proper type +PASS MediaStreamTrack interface: track must inherit property "getConstraints()" with the proper type +PASS MediaStreamTrack interface: track must inherit property "getSettings()" with the proper type +PASS MediaStreamTrack interface: track must inherit property "applyConstraints(optional MediaTrackConstraints)" with the proper type +PASS MediaStreamTrack interface: calling applyConstraints(optional MediaTrackConstraints) on track with too few arguments must throw TypeError +PASS MediaStreamTrackEvent interface: existence and properties of interface object +PASS MediaStreamTrackEvent interface object length +PASS MediaStreamTrackEvent interface object name +PASS MediaStreamTrackEvent interface: existence and properties of interface prototype object +PASS MediaStreamTrackEvent interface: existence and properties of interface prototype object's "constructor" property +PASS MediaStreamTrackEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS MediaStreamTrackEvent interface: attribute track +PASS MediaStreamTrackEvent must be primary interface of trackEvent +PASS Stringification of trackEvent +PASS MediaStreamTrackEvent interface: trackEvent must inherit property "track" with the proper type +FAIL OverconstrainedError interface: existence and properties of interface object assert_equals: prototype of OverconstrainedError is not DOMException expected function "function DOMException() { [native code] }" but got function "function () { [native code] }" +FAIL OverconstrainedError interface object length assert_equals: wrong value for OverconstrainedError.length expected 1 but got 2 +PASS OverconstrainedError interface object name +FAIL OverconstrainedError interface: existence and properties of interface prototype object assert_equals: prototype of OverconstrainedError.prototype is not DOMException.prototype expected [stringifying object threw TypeError: Illegal invocation with type object] but got object "[object Object]" +PASS OverconstrainedError interface: existence and properties of interface prototype object's "constructor" property +PASS OverconstrainedError interface: existence and properties of interface prototype object's @@unscopables property +PASS OverconstrainedError interface: attribute constraint +FAIL OverconstrainedError must be primary interface of new OverconstrainedError("constraint") assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Failed to construct 'OverconstrainedError': 2 arguments required, but only 1 present." +FAIL Stringification of new OverconstrainedError("constraint") assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Failed to construct 'OverconstrainedError': 2 arguments required, but only 1 present." +FAIL OverconstrainedError interface: new OverconstrainedError("constraint") must inherit property "constraint" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Failed to construct 'OverconstrainedError': 2 arguments required, but only 1 present." +PASS MediaDevices interface: existence and properties of interface object +PASS MediaDevices interface object length +PASS MediaDevices interface object name +PASS MediaDevices interface: existence and properties of interface prototype object +PASS MediaDevices interface: existence and properties of interface prototype object's "constructor" property +PASS MediaDevices interface: existence and properties of interface prototype object's @@unscopables property +PASS MediaDevices interface: attribute ondevicechange +PASS MediaDevices interface: operation enumerateDevices() +PASS MediaDevices interface: operation getSupportedConstraints() +PASS MediaDevices interface: operation getUserMedia(optional MediaStreamConstraints) +PASS MediaDevices must be primary interface of navigator.mediaDevices +PASS Stringification of navigator.mediaDevices +PASS MediaDevices interface: navigator.mediaDevices must inherit property "ondevicechange" with the proper type +PASS MediaDevices interface: navigator.mediaDevices must inherit property "enumerateDevices()" with the proper type +PASS MediaDevices interface: navigator.mediaDevices must inherit property "getSupportedConstraints()" with the proper type +PASS MediaDevices interface: navigator.mediaDevices must inherit property "getUserMedia(optional MediaStreamConstraints)" with the proper type +PASS MediaDevices interface: calling getUserMedia(optional MediaStreamConstraints) on navigator.mediaDevices with too few arguments must throw TypeError +PASS MediaDeviceInfo interface: existence and properties of interface object +PASS MediaDeviceInfo interface object length +PASS MediaDeviceInfo interface object name +PASS MediaDeviceInfo interface: existence and properties of interface prototype object +PASS MediaDeviceInfo interface: existence and properties of interface prototype object's "constructor" property +PASS MediaDeviceInfo interface: existence and properties of interface prototype object's @@unscopables property +PASS MediaDeviceInfo interface: attribute deviceId +PASS MediaDeviceInfo interface: attribute kind +PASS MediaDeviceInfo interface: attribute label +PASS MediaDeviceInfo interface: attribute groupId +PASS MediaDeviceInfo interface: operation toJSON() +PASS MediaDeviceInfo must be primary interface of audiooutput +PASS Stringification of audiooutput +PASS MediaDeviceInfo interface: audiooutput must inherit property "deviceId" with the proper type +PASS MediaDeviceInfo interface: audiooutput must inherit property "kind" with the proper type +PASS MediaDeviceInfo interface: audiooutput must inherit property "label" with the proper type +PASS MediaDeviceInfo interface: audiooutput must inherit property "groupId" with the proper type +PASS MediaDeviceInfo interface: audiooutput must inherit property "toJSON()" with the proper type +PASS MediaDeviceInfo interface: default toJSON operation on audiooutput +PASS InputDeviceInfo interface: existence and properties of interface object +PASS InputDeviceInfo interface object length +PASS InputDeviceInfo interface object name +PASS InputDeviceInfo interface: existence and properties of interface prototype object +PASS InputDeviceInfo interface: existence and properties of interface prototype object's "constructor" property +PASS InputDeviceInfo interface: existence and properties of interface prototype object's @@unscopables property +PASS InputDeviceInfo interface: operation getCapabilities() +PASS InputDeviceInfo must be primary interface of audioinput +PASS Stringification of audioinput +PASS InputDeviceInfo interface: audioinput must inherit property "getCapabilities()" with the proper type +PASS MediaDeviceInfo interface: audioinput must inherit property "deviceId" with the proper type +PASS MediaDeviceInfo interface: audioinput must inherit property "kind" with the proper type +PASS MediaDeviceInfo interface: audioinput must inherit property "label" with the proper type +PASS MediaDeviceInfo interface: audioinput must inherit property "groupId" with the proper type +PASS MediaDeviceInfo interface: audioinput must inherit property "toJSON()" with the proper type +PASS MediaDeviceInfo interface: default toJSON operation on audioinput +PASS InputDeviceInfo must be primary interface of videoinput +PASS Stringification of videoinput +PASS InputDeviceInfo interface: videoinput must inherit property "getCapabilities()" with the proper type +PASS MediaDeviceInfo interface: videoinput must inherit property "deviceId" with the proper type +PASS MediaDeviceInfo interface: videoinput must inherit property "kind" with the proper type +PASS MediaDeviceInfo interface: videoinput must inherit property "label" with the proper type +PASS MediaDeviceInfo interface: videoinput must inherit property "groupId" with the proper type +PASS MediaDeviceInfo interface: videoinput must inherit property "toJSON()" with the proper type +PASS MediaDeviceInfo interface: default toJSON operation on videoinput +PASS Navigator interface: attribute mediaDevices +PASS Navigator interface: operation getUserMedia(MediaStreamConstraints, NavigatorUserMediaSuccessCallback, NavigatorUserMediaErrorCallback) +PASS Navigator interface: navigator must inherit property "mediaDevices" with the proper type +PASS Navigator interface: navigator must inherit property "getUserMedia(MediaStreamConstraints, NavigatorUserMediaSuccessCallback, NavigatorUserMediaErrorCallback)" with the proper type +PASS Navigator interface: calling getUserMedia(MediaStreamConstraints, NavigatorUserMediaSuccessCallback, NavigatorUserMediaErrorCallback) on navigator with too few arguments must throw TypeError Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/visual-viewport/viewport-resize-event-on-iframe-show.html b/third_party/blink/web_tests/external/wpt/visual-viewport/viewport-resize-event-on-iframe-show.html deleted file mode 100644 index 688148a8..0000000 --- a/third_party/blink/web_tests/external/wpt/visual-viewport/viewport-resize-event-on-iframe-show.html +++ /dev/null
@@ -1,43 +0,0 @@ -<!doctype html> -<html> - <head> - <title>Viewport: Resize Event On Showing Iframe</title> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, minimum-scale=1"> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script> - async_test(t => { - document.addEventListener("DOMContentLoaded", () => { - let iframe = document.querySelector("iframe"); - onload = () => { - requestAnimationFrame(() => { requestAnimationFrame(() => { - // First full rendering update is complete. - let resize_event_count = 0; - iframe.contentWindow.visualViewport.addEventListener("resize", () => { - resize_event_count++; - }); - iframe.style.display = ""; - iframe.clientWidth; - requestAnimationFrame(() => { - t.step(() => { - assert_equals(resize_event_count, 1); - t.done(); - }); - }) }); // 2x requestAnimationFrame - }) - }; - }); - }, "Resize event fired when an iframe is shown."); - </script> - </head> - <body> - <h1>Viewport: Resize Event On Iframe Size Change</h1> - <h4> - Test Description: This test ensures that we fire a resize event when - an iframe is shown. - </h4> - <iframe style="display: none;" srcdoc="<p>Hello, world!</p>"></iframe> - <div id="log"></div> - </body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/defaults.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/defaults.py new file mode 100644 index 0000000..8dd171a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/defaults.py
@@ -0,0 +1,9 @@ +SCRIPT_TIMEOUT = 30 +PAGE_LOAD_TIMEOUT = 300 +IMPLICIT_WAIT_TIMEOUT = 0 + +WINDOW_POSITION = (100, 100) +WINDOW_SIZE = (800, 600) + +DRIVER_HOST = '127.0.0.1' +DRIVER_PORT = 4444
diff --git a/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py new file mode 100644 index 0000000..cb98ccb --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/webdriver/tests/support/fixtures.py
@@ -0,0 +1,226 @@ +import copy +import json +import os + +import asyncio +import pytest +import webdriver + +from urllib.parse import urlunsplit + +from tests.support import defaults +from tests.support.helpers import cleanup_session, deep_update +from tests.support.inline import build_inline +from tests.support.http_request import HTTPRequest + + +# The webdriver session can outlive a pytest session +_current_session = None + +# The event loop needs to outlive the webdriver session +_event_loop = None + +_custom_session = False + + +def pytest_configure(config): + # register the capabilities marker + config.addinivalue_line( + "markers", + "capabilities: mark test to use capabilities" + ) + + +@pytest.fixture +def capabilities(): + """Default capabilities to use for a new WebDriver session.""" + return {} + + +def pytest_generate_tests(metafunc): + if "capabilities" in metafunc.fixturenames: + marker = metafunc.definition.get_closest_marker(name="capabilities") + if marker: + metafunc.parametrize("capabilities", marker.args, ids=None) + + +@pytest.fixture(scope="session") +def event_loop(): + """Change event_loop fixture to global.""" + global _event_loop + + if _event_loop is None: + _event_loop = asyncio.get_event_loop_policy().new_event_loop() + return _event_loop + + +@pytest.fixture +def http(configuration): + return HTTPRequest(configuration["host"], configuration["port"]) + + +@pytest.fixture +def server_config(): + with open(os.environ.get("WD_SERVER_CONFIG_FILE"), "r") as f: + return json.load(f) + + +@pytest.fixture(scope="session") +def configuration(): + host = os.environ.get("WD_HOST", defaults.DRIVER_HOST) + port = int(os.environ.get("WD_PORT", str(defaults.DRIVER_PORT))) + capabilities = json.loads(os.environ.get("WD_CAPABILITIES", "{}")) + + return { + "host": host, + "port": port, + "capabilities": capabilities + } + + +async def reset_current_session_if_necessary(caps): + global _current_session + + # If there is a session with different requested capabilities active than + # the one we would like to create, end it now. + if _current_session is not None: + if not _current_session.match(caps): + is_bidi = isinstance(_current_session, webdriver.BidiSession) + if is_bidi: + await _current_session.end() + else: + _current_session.end() + _current_session = None + + +@pytest.fixture(scope="function") +async def session(capabilities, configuration): + """Create and start a session for a test that does not itself test session creation. + + By default the session will stay open after each test, but we always try to start a + new one and assume that if that fails there is already a valid session. This makes it + possible to recover from some errors that might leave the session in a bad state, but + does not demand that we start a new session per test. + """ + global _current_session + + # Update configuration capabilities with custom ones from the + # capabilities fixture, which can be set by tests + caps = copy.deepcopy(configuration["capabilities"]) + deep_update(caps, capabilities) + caps = {"alwaysMatch": caps} + + await reset_current_session_if_necessary(caps) + + if _current_session is None: + _current_session = webdriver.Session( + configuration["host"], + configuration["port"], + capabilities=caps) + + _current_session.start() + + # Enforce a fixed default window size and position + if _current_session.capabilities.get("setWindowRect"): + _current_session.window.size = defaults.WINDOW_SIZE + _current_session.window.position = defaults.WINDOW_POSITION + + yield _current_session + + cleanup_session(_current_session) + + +@pytest.fixture(scope="function") +async def bidi_session(capabilities, configuration): + """Create and start a bidi session. + + Can be used for a test that does not itself test bidi session creation. + + By default the session will stay open after each test, but we always try to start a + new one and assume that if that fails there is already a valid session. This makes it + possible to recover from some errors that might leave the session in a bad state, but + does not demand that we start a new session per test. + """ + global _current_session + + # Update configuration capabilities with custom ones from the + # capabilities fixture, which can be set by tests + caps = copy.deepcopy(configuration["capabilities"]) + caps.update({"webSocketUrl": True}) + deep_update(caps, capabilities) + caps = {"alwaysMatch": caps} + + await reset_current_session_if_necessary(caps) + + if _current_session is None: + _current_session = webdriver.Session( + configuration["host"], + configuration["port"], + capabilities=caps, + enable_bidi=True) + + _current_session.start() + await _current_session.bidi_session.start() + + # Enforce a fixed default window size and position + if _current_session.capabilities.get("setWindowRect"): + _current_session.window.size = defaults.WINDOW_SIZE + _current_session.window.position = defaults.WINDOW_POSITION + + yield _current_session.bidi_session + + await _current_session.bidi_session.end() + cleanup_session(_current_session) + + +@pytest.fixture(scope="function") +def current_session(): + return _current_session + + +@pytest.fixture +def url(server_config): + def url(path, protocol="http", domain="", subdomain="", query="", fragment=""): + domain = server_config["domains"][domain][subdomain] + port = server_config["ports"][protocol][0] + host = "{0}:{1}".format(domain, port) + return urlunsplit((protocol, host, path, query, fragment)) + + return url + + +@pytest.fixture +def inline(url): + """Take a source extract and produces well-formed documents. + + Based on the desired document type, the extract is embedded with + predefined boilerplate in order to produce well-formed documents. + The media type and character set may also be individually configured. + + This helper function originally used data URLs, but since these + are not universally supported (or indeed standardised!) across + browsers, it now delegates the serving of the document to wptserve. + This file also acts as a wptserve handler (see the main function + below) which configures the HTTP response using query parameters. + + This function returns a URL to the wptserve handler, which in turn + will serve an HTTP response with the requested source extract + inlined in a well-formed document, and the Content-Type header + optionally configured using the desired media type and character set. + + Any additional keyword arguments are passed on to the build_url + function, which comes from the url fixture. + """ + def inline(src, **kwargs): + return build_inline(url, src, **kwargs) + + return inline + + +@pytest.fixture +def iframe(inline): + """Inline document extract as the source document of an <iframe>.""" + def iframe(src, **kwargs): + return "<iframe src='{}'></iframe>".format(inline(src, **kwargs)) + + return iframe
diff --git a/third_party/blink/web_tests/external/wpt/webhid/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/webhid/idlharness.https.window-expected.txt index 7b3f1ae7..6ed0916 100644 --- a/third_party/blink/web_tests/external/wpt/webhid/idlharness.https.window-expected.txt +++ b/third_party/blink/web_tests/external/wpt/webhid/idlharness.https.window-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 65 tests; 64 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 64 tests; 63 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS idl_test validation PASS Partial interface Navigator: original interface defined @@ -43,7 +43,6 @@ PASS HIDDevice interface: attribute collections PASS HIDDevice interface: operation open() PASS HIDDevice interface: operation close() -PASS HIDDevice interface: operation forget() PASS HIDDevice interface: operation sendReport(octet, BufferSource) PASS HIDDevice interface: operation sendFeatureReport(octet, BufferSource) PASS HIDDevice interface: operation receiveFeatureReport(octet)
diff --git a/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-bad-mimetype-expected.txt b/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-bad-mimetype-expected.txt index 6e5a883..12019c9 100644 --- a/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-bad-mimetype-expected.txt +++ b/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-bad-mimetype-expected.txt
@@ -4,6 +4,6 @@ readyState: 4 (number) responseText: <?xml version="1.0" encoding="UTF-8"?>... (string) responseXML: [object XMLDocument] (object) -status: 0 (number) -statusText: (string) +status: 200 (number) +statusText: OK (string)
diff --git a/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt b/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt index 21242a6..4ddfa89 100644 --- a/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt +++ b/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-get-expected.txt
@@ -15,9 +15,13 @@ <d id="id3">Three</d> </doc> getAllResponseHeaders() +content-type: text/xml +last-modified: (date) + status -0 +200 statusText +OK readyState 4 Event information
diff --git a/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-get.xhtml b/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-get.xhtml index 22adaba4..a47ab554 100644 --- a/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-get.xhtml +++ b/third_party/blink/web_tests/fast/xmlhttprequest/xmlhttprequest-get.xhtml
@@ -37,6 +37,7 @@ } </style> <script type="text/javascript"> +//<![CDATA[ var p = new XMLHttpRequest(); if (window.testRunner) { @@ -57,7 +58,9 @@ var str = s.serializeToString(d); document.getElementById("id2").firstChild.nodeValue = str; } - document.getElementById("id3").firstChild.nodeValue = p.getAllResponseHeaders(); + // Delete carriage returns (since the golden file we compare with only has + // newlines) and mask the last modified date, which can vary. + document.getElementById("id3").firstChild.nodeValue = p.getAllResponseHeaders().replace(/\r/g, '').replace(/(?<=^last-modified: ).*$/m, '(date)'); document.getElementById("id4").firstChild.nodeValue = p.status; document.getElementById("id5").firstChild.nodeValue = p.statusText; document.getElementById("id6").firstChild.nodeValue = p.readyState; @@ -90,6 +93,7 @@ { p.send(null); } +//]]> </script> </head> <body onload="mysend();">
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/external/wpt/webhid/idlharness.https.window-expected.txt b/third_party/blink/web_tests/platform/mac-mac10.12/external/wpt/webhid/idlharness.https.window-expected.txt new file mode 100644 index 0000000..0c5ed83 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac10.12/external/wpt/webhid/idlharness.https.window-expected.txt
@@ -0,0 +1,68 @@ +This is a testharness.js-based test. +Found 64 tests; 63 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN. +PASS idl_test setup +PASS idl_test validation +PASS Partial interface Navigator: original interface defined +PASS Partial interface Navigator: member names are unique +PASS Partial interface mixin NavigatorID: member names are unique +PASS Navigator includes NavigatorID: member names are unique +PASS Navigator includes NavigatorLanguage: member names are unique +PASS Navigator includes NavigatorOnLine: member names are unique +PASS Navigator includes NavigatorContentUtils: member names are unique +PASS Navigator includes NavigatorCookies: member names are unique +PASS Navigator includes NavigatorPlugins: member names are unique +PASS Navigator includes NavigatorConcurrentHardware: member names are unique +PASS HID interface: existence and properties of interface object +PASS HID interface object length +PASS HID interface object name +PASS HID interface: existence and properties of interface prototype object +PASS HID interface: existence and properties of interface prototype object's "constructor" property +PASS HID interface: existence and properties of interface prototype object's @@unscopables property +PASS HID interface: attribute onconnect +PASS HID interface: attribute ondisconnect +PASS HID interface: operation getDevices() +PASS HID interface: operation requestDevice(HIDDeviceRequestOptions) +PASS HID must be primary interface of navigator.hid +PASS Stringification of navigator.hid +PASS HID interface: navigator.hid must inherit property "onconnect" with the proper type +PASS HID interface: navigator.hid must inherit property "ondisconnect" with the proper type +PASS HID interface: navigator.hid must inherit property "getDevices()" with the proper type +PASS HID interface: navigator.hid must inherit property "requestDevice(HIDDeviceRequestOptions)" with the proper type +PASS HID interface: calling requestDevice(HIDDeviceRequestOptions) on navigator.hid with too few arguments must throw TypeError +PASS HIDConnectionEvent interface: existence and properties of interface object +PASS HIDConnectionEvent interface object length +PASS HIDConnectionEvent interface object name +PASS HIDConnectionEvent interface: existence and properties of interface prototype object +PASS HIDConnectionEvent interface: existence and properties of interface prototype object's "constructor" property +PASS HIDConnectionEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS HIDConnectionEvent interface: attribute device +PASS HIDInputReportEvent interface: existence and properties of interface object +FAIL HIDInputReportEvent interface object length assert_equals: wrong value for HIDInputReportEvent.length expected 2 but got 0 +PASS HIDInputReportEvent interface object name +PASS HIDInputReportEvent interface: existence and properties of interface prototype object +PASS HIDInputReportEvent interface: existence and properties of interface prototype object's "constructor" property +PASS HIDInputReportEvent interface: existence and properties of interface prototype object's @@unscopables property +PASS HIDInputReportEvent interface: attribute device +PASS HIDInputReportEvent interface: attribute reportId +PASS HIDInputReportEvent interface: attribute data +PASS HIDDevice interface: existence and properties of interface object +PASS HIDDevice interface object length +PASS HIDDevice interface object name +PASS HIDDevice interface: existence and properties of interface prototype object +PASS HIDDevice interface: existence and properties of interface prototype object's "constructor" property +PASS HIDDevice interface: existence and properties of interface prototype object's @@unscopables property +PASS HIDDevice interface: attribute oninputreport +PASS HIDDevice interface: attribute opened +PASS HIDDevice interface: attribute vendorId +PASS HIDDevice interface: attribute productId +PASS HIDDevice interface: attribute productName +PASS HIDDevice interface: attribute collections +PASS HIDDevice interface: operation open() +PASS HIDDevice interface: operation close() +PASS HIDDevice interface: operation sendReport(octet, BufferSource) +PASS HIDDevice interface: operation sendFeatureReport(octet, BufferSource) +PASS HIDDevice interface: operation receiveFeatureReport(octet) +PASS Navigator interface: attribute hid +PASS Navigator interface: navigator must inherit property "hid" with the proper type +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/idlharness-expected.txt b/third_party/blink/web_tests/virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/idlharness-expected.txt deleted file mode 100644 index f76169b..0000000 --- a/third_party/blink/web_tests/virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/idlharness-expected.txt +++ /dev/null
@@ -1,29 +0,0 @@ -This is a testharness.js-based test. -FAIL idl_test setup promise_test: Unhandled rejection with value: object "TypeError: window.getPseudoElements is not a function" -PASS idl_test validation -PASS Partial interface Element: original interface defined -PASS Partial interface Element: member names are unique -PASS Element includes ParentNode: member names are unique -PASS Element includes NonDocumentTypeChildNode: member names are unique -PASS Element includes ChildNode: member names are unique -PASS Element includes Slottable: member names are unique -FAIL CSSPseudoElement interface: existence and properties of interface object assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface object length assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface object name assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface: attribute type assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface: attribute element assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface: attribute parent assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement interface: operation pseudo(CSSOMString) assert_own_property: self does not have own property "CSSPseudoElement" expected property "CSSPseudoElement" missing -FAIL CSSPseudoElement must be primary interface of beforeElements.item(0) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL Stringification of beforeElements.item(0) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "element" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "parent" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL CSSPseudoElement interface: beforeElements.item(0) must inherit property "pseudo(CSSOMString)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL CSSPseudoElement interface: calling pseudo(CSSOMString) on beforeElements.item(0) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: beforeElements is not defined" -FAIL Element interface: operation pseudo(CSSOMString) assert_own_property: interface prototype object missing non-static operation expected property "pseudo" missing -Harness: the test ran to completion. -
diff --git a/third_party/fdlibm/chromium/0001-Import-a-copy-of-V8-s-fdlibm-fork-into-Chromium-thir.patch b/third_party/fdlibm/chromium/0001-Import-a-copy-of-V8-s-fdlibm-fork-into-Chromium-thir.patch index 24d08234..1549ba9 100644 --- a/third_party/fdlibm/chromium/0001-Import-a-copy-of-V8-s-fdlibm-fork-into-Chromium-thir.patch +++ b/third_party/fdlibm/chromium/0001-Import-a-copy-of-V8-s-fdlibm-fork-into-Chromium-thir.patch
@@ -100,7 +100,7 @@ // The following is adapted from fdlibm (http://www.netlib.org/fdlibm). // // ==================================================== -@@ -12,30 +13,22 @@ +@@ -12,30 +13,21 @@ // The original source code covered by the above license above has been // modified significantly by Google Inc. // Copyright 2016 the V8 project authors. All rights reserved. @@ -116,7 +116,6 @@ -#include "src/base/macros.h" -#include "src/base/overflowing-math.h" +#include "base/bit_cast.h" -+#include "base/compiler_specific.h" +#include "build/build_config.h" +#include "third_party/fdlibm/overflowing-math.h" @@ -138,19 +137,24 @@ /* * The original fdlibm code used statements like: * n0 = ((*(int*)&one)>>29)^1; * index of high word * -@@ -104,11 +98,11 @@ namespace { +@@ -104,11 +98,15 @@ namespace { (d) = bit_cast<double>(bits); \ } while (false) -int32_t __ieee754_rem_pio2(double x, double* y) V8_WARN_UNUSED_RESULT; -double __kernel_cos(double x, double y) V8_WARN_UNUSED_RESULT; -+int32_t __ieee754_rem_pio2(double x, double* y) WARN_UNUSED_RESULT; -+double __kernel_cos(double x, double y) WARN_UNUSED_RESULT; - int __kernel_rem_pio2(double* x, double* y, int e0, int nx, int prec, +-int __kernel_rem_pio2(double* x, double* y, int e0, int nx, int prec, - const int32_t* ipio2) V8_WARN_UNUSED_RESULT; -double __kernel_sin(double x, double y, int iy) V8_WARN_UNUSED_RESULT; -+ const int32_t* ipio2) WARN_UNUSED_RESULT; -+double __kernel_sin(double x, double y, int iy) WARN_UNUSED_RESULT; ++[[nodiscard]] int32_t __ieee754_rem_pio2(double x, double* y); ++[[nodiscard]] double __kernel_cos(double x, double y); ++[[nodiscard]] int __kernel_rem_pio2(double* x, ++ double* y, ++ int e0, ++ int nx, ++ int prec, ++ const int32_t* ipio2); ++[[nodiscard]] double __kernel_sin(double x, double y, int iy); /* __ieee754_rem_pio2(x,y) * @@ -235,7 +239,7 @@ #undef EXTRACT_WORDS #undef GET_HIGH_WORD #undef GET_LOW_WORD -@@ -3015,6 +3029,5 @@ double tanh(double x) { +@@ -3015,6 +3029,4 @@ double tanh(double x) { #undef SET_HIGH_WORD #undef SET_LOW_WORD @@ -243,7 +247,6 @@ -} // namespace base -} // namespace v8 +} // namespace fdlibm -+ diff --git a/third_party/fdlibm/ieee754.h b/third_party/fdlibm/ieee754.h index f2b3a3eb5808..27b5013818a2 100644 --- a/third_party/fdlibm/ieee754.h
diff --git a/third_party/fdlibm/ieee754.cc b/third_party/fdlibm/ieee754.cc index 0ece1f1c..d6f68a4 100644 --- a/third_party/fdlibm/ieee754.cc +++ b/third_party/fdlibm/ieee754.cc
@@ -21,7 +21,6 @@ #include <limits> #include "base/bit_cast.h" -#include "base/compiler_specific.h" #include "build/build_config.h" #include "third_party/fdlibm/overflowing-math.h" @@ -97,11 +96,15 @@ (d) = bit_cast<double>(bits); \ } while (false) -int32_t __ieee754_rem_pio2(double x, double* y) WARN_UNUSED_RESULT; -double __kernel_cos(double x, double y) WARN_UNUSED_RESULT; -int __kernel_rem_pio2(double* x, double* y, int e0, int nx, int prec, - const int32_t* ipio2) WARN_UNUSED_RESULT; -double __kernel_sin(double x, double y, int iy) WARN_UNUSED_RESULT; +[[nodiscard]] int32_t __ieee754_rem_pio2(double x, double* y); +[[nodiscard]] double __kernel_cos(double x, double y); +[[nodiscard]] int __kernel_rem_pio2(double* x, + double* y, + int e0, + int nx, + int prec, + const int32_t* ipio2); +[[nodiscard]] double __kernel_sin(double x, double y, int iy); /* __ieee754_rem_pio2(x,y) * @@ -3029,4 +3032,3 @@ #undef SET_LOW_WORD } // namespace fdlibm -
diff --git a/third_party/widevine/cdm/widevine_cdm_common.h b/third_party/widevine/cdm/widevine_cdm_common.h index 50a9e566..c15f092 100644 --- a/third_party/widevine/cdm/widevine_cdm_common.h +++ b/third_party/widevine/cdm/widevine_cdm_common.h
@@ -14,10 +14,10 @@ // "alpha" is a temporary name until a convention is defined. const char kWidevineKeySystem[] = "com.widevine.alpha"; -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // An sub key system of `kWidevineKeySystem` only used in experiments. const char kWidevineExperimentKeySystem[] = "com.widevine.alpha.experiment"; -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) // Widevine CDM files are in a directory with this name. This path is also // hardcoded in some build files and changing it requires changing the build @@ -49,7 +49,7 @@ "application_x-ppapi-widevine-cdm"}; // Constants specific to Windows MediaFoundation-based Widevine CDM library. -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) const char kMediaFoundationWidevineCdmLibraryName[] = "Google.Widevine.CDM"; const char kMediaFoundationWidevineCdmDisplayName[] = "Google Widevine Windows CDM"; @@ -57,6 +57,6 @@ // of the PluginPrivateFileSystem. const media::CdmType kMediaFoundationWidevineCdmType{ base::Token{0x8e73dec793bf5adcull, 0x27e572c9a1fd930eull}, ""}; -#endif // defined(OS_WIN) +#endif // BUILDFLAG(IS_WIN) #endif // WIDEVINE_CDM_WIDEVINE_CDM_COMMON_H_
diff --git a/tools/grit/grit_defines.gni b/tools/grit/grit_defines.gni index e512471..60022cb 100644 --- a/tools/grit/grit_defines.gni +++ b/tools/grit/grit_defines.gni
@@ -4,7 +4,6 @@ import("//build/config/chrome_build.gni") import("//build/config/chromeos/ui_mode.gni") -import("//build/config/crypto.gni") import("//build/config/devtools.gni") import("//build/config/ui.gni") @@ -99,13 +98,6 @@ ] } -if (use_nss_certs) { - grit_defines += [ - "-D", - "use_nss_certs", - ] -} - if (use_ozone) { grit_defines += [ "-D",
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 7162e3ce..6f831b1 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -79,22 +79,22 @@ 'Android arm64 Builder (dbg)': 'android_webview_google_debug_static_bot_arm64_reclient', 'Android x64 Builder (dbg)': 'android_debug_static_bot_x64_reclient', 'Android x86 Builder (dbg)': 'android_debug_static_bot_x86_reclient', - 'Cast Android (dbg)': 'android_cast_debug_static_bot', + 'Cast Android (dbg)': 'android_cast_debug_static_bot_reclient', 'Deterministic Android': 'android_without_codecs_release_bot_minimal_symbols', 'Deterministic Android (dbg)': 'android_debug_bot', 'android-arm64-proguard-rel': 'android_release_bot_minimal_symbols_arm64_webview_google', 'android-bfcache-rel': 'android_release_bot_minimal_symbols', 'android-binary-size-generator': 'android_binary_size', - 'android-cronet-arm-dbg': 'android_cronet_debug_static_bot_arm_no_neon', - 'android-cronet-arm-rel': 'android_cronet_release_bot_minimal_symbols_arm_no_neon', - 'android-cronet-arm64-dbg': 'android_cronet_debug_static_bot_arm64', - 'android-cronet-arm64-rel': 'android_cronet_release_bot_minimal_symbols_arm64', - 'android-cronet-asan-arm-rel': 'android_cronet_release_bot_minimal_symbols_arm_no_neon_clang_asan', + 'android-cronet-arm-dbg': 'android_cronet_debug_static_bot_arm_no_neon_reclient', + 'android-cronet-arm-rel': 'android_cronet_release_bot_minimal_symbols_arm_no_neon_reclient', + 'android-cronet-arm64-dbg': 'android_cronet_debug_static_bot_arm64_reclient', + 'android-cronet-arm64-rel': 'android_cronet_release_bot_minimal_symbols_arm64_reclient', + 'android-cronet-asan-arm-rel': 'android_cronet_release_bot_minimal_symbols_arm_no_neon_clang_asan_reclient', 'android-cronet-marshmallow-arm64-perf-rel': 'android_cronet_release_bot_minimal_symbols_arm64', - 'android-cronet-x86-dbg': 'android_cronet_debug_static_bot_x86', - 'android-cronet-x86-rel': 'android_cronet_release_bot_minimal_symbols_x86', - 'android-incremental-dbg': 'android_incremental_debug_bot', + 'android-cronet-x86-dbg': 'android_cronet_debug_static_bot_x86_reclient', + 'android-cronet-x86-rel': 'android_cronet_release_bot_minimal_symbols_x86_reclient', + 'android-incremental-dbg': 'android_incremental_debug_bot_reclient', # This bot must use the gpu_tests mixin to match 'Android FYI Release (Nexus 5X)' # on the chromium.gpu waterfall, which it mirrors via trybots.pyl. @@ -787,7 +787,7 @@ 'android-asan': 'android_clang_asan_release_trybot', 'android-bfcache-rel': 'android_release_trybot', 'android-opus-arm-rel': 'android_release_trybot', - 'android-cronet-asan-arm-rel': 'android_cronet_release_bot_minimal_symbols_arm_no_neon_clang_asan', + 'android-cronet-asan-arm-rel': 'android_cronet_release_bot_minimal_symbols_arm_no_neon_clang_asan_reclient', # TODO(crbug/597596): Switch this back to debug_trybot when cronet's # shared library loading is fixed. 'android-cronet-arm-dbg': 'android_cronet_debug_static_bot_arm_no_neon', @@ -796,8 +796,8 @@ 'android-cronet-kitkat-arm-rel': 'android_cronet_release_bot_minimal_symbols_arm_no_neon', 'android-cronet-lollipop-arm-rel': 'android_cronet_release_bot_minimal_symbols_arm_no_neon', 'android-cronet-marshmallow-arm64-rel': 'android_cronet_release_trybot_arm64', - 'android-cronet-x86-dbg': 'android_cronet_debug_static_bot_x86', - 'android-cronet-x86-rel': 'android_cronet_release_bot_minimal_symbols_x86', + 'android-cronet-x86-dbg': 'android_cronet_debug_static_bot_x86_reclient', + 'android-cronet-x86-rel': 'android_cronet_release_bot_minimal_symbols_x86_reclient', 'android-cronet-x86-dbg-10-tests': 'android_cronet_debug_static_bot_x86', 'android-cronet-x86-dbg-11-tests': 'android_cronet_debug_static_bot_x86', 'android-cronet-x86-dbg-oreo-tests': 'android_cronet_debug_static_bot_x86', @@ -864,7 +864,7 @@ 'linux_android_dbg_ng': 'android_debug_bot', 'try-nougat-phone-tester': 'android_debug_trybot_arm64', 'android-oreo-arm64-dbg': 'android_debug_trybot_arm64', - 'android-pie-arm64-dbg': 'android_debug_trybot_arm64', + 'android-pie-arm64-dbg': 'android_debug_trybot_arm64_reclient', }, # TODO(jmadill/ynovikov): Migrate these to angle waterfall. http://anglebug.com/4483 @@ -1254,8 +1254,8 @@ 'official_optimize', 'stable_channel', ], - 'android_cast_debug_static_bot': [ - 'android', 'cast', 'clang', 'debug_static_bot', + 'android_cast_debug_static_bot_reclient': [ + 'android', 'cast', 'clang', 'debug_static_bot_reclient', ], 'android_cast_debug_static_bot_compile_only': [ @@ -1324,31 +1324,53 @@ 'android', 'cronet_android', 'debug_static_bot', 'arm_no_neon', 'release_java', ], + 'android_cronet_debug_static_bot_arm_no_neon_reclient': [ + 'android', 'cronet_android', 'debug_static_bot_reclient', 'arm_no_neon', 'release_java', + ], + 'android_cronet_debug_static_bot_x86': [ 'android', 'cronet_android', 'debug_static_bot', 'x86', ], + 'android_cronet_debug_static_bot_x86_reclient': [ + 'android', 'cronet_android', 'debug_static_bot_reclient', 'x86', + ], + 'android_cronet_debug_static_bot_arm64': [ 'android', 'cronet_android', 'debug_static_bot', 'arm64', ], + 'android_cronet_debug_static_bot_arm64_reclient': [ + 'android', 'cronet_android', 'debug_static_bot_reclient', 'arm64', + ], + 'android_cronet_release_bot_minimal_symbols_arm64': [ 'android', 'cronet_android', 'official_optimize', 'release_bot', 'minimal_symbols', 'arm64', 'strip_debug_info', ], + 'android_cronet_release_bot_minimal_symbols_arm64_reclient': [ + 'android', 'cronet_android', 'official_optimize', 'release_bot_reclient', 'minimal_symbols', 'arm64', + 'strip_debug_info', + ], + 'android_cronet_release_bot_minimal_symbols_arm_no_neon': [ 'android', 'cronet_android', 'official_optimize', 'release_bot', 'minimal_symbols', 'arm_no_neon', 'strip_debug_info', ], - 'android_cronet_release_bot_minimal_symbols_arm_no_neon_clang_asan': [ - 'android', 'cronet_android', 'release_bot', 'minimal_symbols', 'arm_no_neon', 'clang', 'asan', + 'android_cronet_release_bot_minimal_symbols_arm_no_neon_reclient': [ + 'android', 'cronet_android', 'official_optimize', 'release_bot_reclient', 'minimal_symbols', 'arm_no_neon', 'strip_debug_info', ], - 'android_cronet_release_bot_minimal_symbols_x86': [ - 'android', 'cronet_android', 'official_optimize', 'release_bot', 'minimal_symbols', 'x86', + 'android_cronet_release_bot_minimal_symbols_arm_no_neon_clang_asan_reclient': [ + 'android', 'cronet_android', 'release_bot_reclient', 'minimal_symbols', 'arm_no_neon', 'clang', 'asan', + 'strip_debug_info', + ], + + 'android_cronet_release_bot_minimal_symbols_x86_reclient': [ + 'android', 'cronet_android', 'official_optimize', 'release_bot_reclient', 'minimal_symbols', 'x86', 'strip_debug_info', ], @@ -1389,6 +1411,10 @@ 'android', 'debug_bot', 'arm64', ], + 'android_debug_trybot_arm64_reclient': [ + 'android', 'debug_bot_reclient', 'arm64', + ], + 'android_debug_trybot_compile_only': [ 'android', 'debug_bot', 'compile_only', ], @@ -1409,8 +1435,8 @@ 'android', 'debug_bot', 'use_java_coverage', 'strip_debug_info', ], - 'android_incremental_debug_bot': [ - 'android', 'incremental', 'debug_bot', + 'android_incremental_debug_bot_reclient': [ + 'android', 'incremental', 'debug_bot_reclient', ], 'android_official_optimize_goma': [
diff --git a/tools/mb/mb_config_expectations/chromium.android.json b/tools/mb/mb_config_expectations/chromium.android.json index b415978..c094e41 100644 --- a/tools/mb/mb_config_expectations/chromium.android.json +++ b/tools/mb/mb_config_expectations/chromium.android.json
@@ -77,7 +77,8 @@ "proprietary_codecs": true, "symbol_level": 1, "target_os": "android", - "use_goma": true + "use_rbe": true, + "use_remoteexec": true } }, "Deterministic Android": { @@ -196,10 +197,11 @@ "target_cpu": "arm", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -226,10 +228,11 @@ "target_cpu": "arm", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -252,10 +255,11 @@ "target_cpu": "arm64", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -281,10 +285,11 @@ "target_cpu": "arm64", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -312,10 +317,11 @@ "target_cpu": "arm", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -367,10 +373,11 @@ "target_cpu": "x86", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -396,10 +403,11 @@ "target_cpu": "x86", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -412,7 +420,8 @@ "proprietary_codecs": true, "symbol_level": 1, "target_os": "android", - "use_goma": true + "use_rbe": true, + "use_remoteexec": true } }, "android-marshmallow-arm64-rel": {
diff --git a/tools/mb/mb_config_expectations/tryserver.chromium.android.json b/tools/mb/mb_config_expectations/tryserver.chromium.android.json index a5718eb7..6e1f9754 100644 --- a/tools/mb/mb_config_expectations/tryserver.chromium.android.json +++ b/tools/mb/mb_config_expectations/tryserver.chromium.android.json
@@ -202,10 +202,11 @@ "target_cpu": "arm", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -318,10 +319,11 @@ "target_cpu": "x86", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -451,10 +453,11 @@ "target_cpu": "x86", "target_os": "android", "use_crash_key_stubs": true, - "use_goma": true, "use_hashed_jni_names": true, "use_partition_alloc": false, "use_platform_icu_alternatives": true, + "use_rbe": true, + "use_remoteexec": true, "use_thin_lto": false } }, @@ -702,7 +705,8 @@ "symbol_level": 1, "target_cpu": "arm64", "target_os": "android", - "use_goma": true + "use_rbe": true, + "use_remoteexec": true } }, "android-pie-arm64-rel": {
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index bf012e59..98b4993c 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -60126,7 +60126,7 @@ <enum name="MobileFreProgress"> <int value="0" label="FRE started"/> <int value="1" label="Welcome shown"/> - <int value="2" label="Data saver shown"/> + <int value="2" label="Data saver shown (Deprecated 01/2022)"/> <int value="3" label="Sync consent shown"/> <int value="4" label="The user clicked on the continue button to continue with sync
diff --git a/tools/metrics/histograms/metadata/apps/histograms.xml b/tools/metrics/histograms/metadata/apps/histograms.xml index 9f4d9c9..f288a01 100644 --- a/tools/metrics/histograms/metadata/apps/histograms.xml +++ b/tools/metrics/histograms/metadata/apps/histograms.xml
@@ -1690,7 +1690,7 @@ <variant name=".FromShelf" summary="From shelf."/> <variant name=".FromSmartTextContextMenu" summary="From Smart text selection context menu."/> - <variant name=".FromUrlHandler" summary="From URL hanlder."/> + <variant name=".FromUrlHandler" summary="From URL handler."/> </token> </histogram>
diff --git a/tools/metrics/histograms/metadata/media/histograms.xml b/tools/metrics/histograms/metadata/media/histograms.xml index 0e15b97..ecbcaa6 100644 --- a/tools/metrics/histograms/metadata/media/histograms.xml +++ b/tools/metrics/histograms/metadata/media/histograms.xml
@@ -2047,7 +2047,7 @@ <histogram name="Media.EME.MediaDrm.PreprovisionedOriginId.NonPerAppProvisioningDevice" - units="units" expires_after="2022-02-01"> + units="units" expires_after="2023-01-03"> <owner>jrummell@chromium.org</owner> <owner>media-dev@chromium.org</owner> <summary> @@ -2058,7 +2058,7 @@ <histogram name="Media.EME.MediaDrm.PreprovisionedOriginId.PerAppProvisioningDevice" - units="units" expires_after="2022-02-01"> + units="units" expires_after="2023-01-03"> <owner>jrummell@chromium.org</owner> <owner>media-dev@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/obsolete_histograms.xml b/tools/metrics/histograms/metadata/obsolete_histograms.xml index 2ece08d8..06a89c1 100644 --- a/tools/metrics/histograms/metadata/obsolete_histograms.xml +++ b/tools/metrics/histograms/metadata/obsolete_histograms.xml
@@ -81959,7 +81959,7 @@ <owner>zea@chromium.org</owner> <summary> Whether OAuth2 refresh token was available at the time when - ProfileSyncService was starting backend. + SyncServiceImpl was starting backend. </summary> </histogram> @@ -82250,7 +82250,7 @@ </obsolete> <owner>zea@chromium.org</owner> <summary> - Time taken from the start of sync shutdown (in ProfileSyncService) until the + Time taken from the start of sync shutdown (in SyncServiceImpl) until the backend (SyncEngine) is fully destroyed. </summary> </histogram> @@ -82302,7 +82302,7 @@ <owner>jeremy@chromium.org</owner> <owner>zea@google.com</owner> <summary> - Time spent after ProfileSyncService *creation* but before SyncEngine + Time spent after SyncServiceImpl *creation* but before SyncEngine initialization. </summary> </histogram>
diff --git a/tools/metrics/histograms/metadata/optimization/histograms.xml b/tools/metrics/histograms/metadata/optimization/histograms.xml index 2ed1bd2..673a701ab 100644 --- a/tools/metrics/histograms/metadata/optimization/histograms.xml +++ b/tools/metrics/histograms/metadata/optimization/histograms.xml
@@ -310,22 +310,7 @@ </summary> </histogram> -<histogram name="OptimizationGuide.HintsFetcher.RequestStatus.BatchUpdate" - enum="OptimizationGuideHintsFetcherRequestStatus" expires_after="M106"> - <obsolete> - Obsolete as of 12/2021. - </obsolete> - <owner>mcrouse@chromium.org</owner> - <owner>sophiechang@chromium.org</owner> - <summary> - The status of making a Batch Update context request of the OptmizationGuide - HintsFetcher. This includes whether a network request was actually sent or - not. - </summary> -</histogram> - -<histogram - name="OptimizationGuide.HintsFetcher.RequestStatus.BatchUpdate.{RequestContext}" +<histogram name="OptimizationGuide.HintsFetcher.RequestStatus.{RequestContext}" enum="OptimizationGuideHintsFetcherRequestStatus" expires_after="M106"> <owner>mcrouse@chromium.org</owner> <owner>sophiechang@chromium.org</owner> @@ -337,20 +322,6 @@ <token key="RequestContext" variants="RequestContext"/> </histogram> -<histogram name="OptimizationGuide.HintsFetcher.RequestStatus.PageNavigation" - enum="OptimizationGuideHintsFetcherRequestStatus" expires_after="M106"> - <obsolete> - Obsolete as of 12/2021. - </obsolete> - <owner>mcrouse@chromium.org</owner> - <owner>sophiechang@chromium.org</owner> - <summary> - The status of making a Page Navigation context request of the - OptmizationGuide HintsFetcher. This includes whether a network request was - actually sent or not. - </summary> -</histogram> - <histogram name="OptimizationGuide.HintsFetcher.TopHostProvider.BlacklistSize.OnInitialize" units="total host count" expires_after="2021-03-31">
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index bf73dcf..1b2cd2f 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -6,7 +6,7 @@ }, "win": { "hash": "d6cb1144b9294741e65294ca97dba70916de332c", - "remote_path": "perfetto_binaries/trace_processor_shell/win/c581dd4f599dc73735f6d006ea1d25ea80ce3165/trace_processor_shell.exe" + "remote_path": "perfetto_binaries/trace_processor_shell/win/645a5c0de636e50b64ea256da8a722954d3c37ca/trace_processor_shell.exe" }, "linux_arm": { "hash": "58893933be305d3bfe0a72ebebcacde2ac3ca893", @@ -22,7 +22,7 @@ }, "linux": { "hash": "9ae761116a94bc1979e1940862dd29fdc32d3a82", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/c581dd4f599dc73735f6d006ea1d25ea80ce3165/trace_processor_shell" + "remote_path": "perfetto_binaries/trace_processor_shell/linux/645a5c0de636e50b64ea256da8a722954d3c37ca/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/android/java/res/values-night/colors.xml b/ui/android/java/res/values-night/colors.xml index 403e097..d877de4 100644 --- a/ui/android/java/res/values-night/colors.xml +++ b/ui/android/java/res/values-night/colors.xml
@@ -17,8 +17,9 @@ <!-- Common icon colors for drawables. --> <color name="default_icon_color_baseline">@color/default_icon_color_light</color> - <color name="default_icon_color_inverse">@color/default_icon_color_inverse_dark</color> + <color name="default_icon_color_inverse_baseline">@color/default_icon_color_inverse_dark</color> <color name="default_icon_color_accent1_baseline">@color/default_icon_color_blue_light</color> + <color name="default_icon_color_on_accent1_baseline">@color/default_icon_color_on_accent1_dark</color> <color name="default_icon_color_secondary_baseline">@color/default_icon_color_secondary_light</color> <color name="hairline_stroke_color_baseline">@color/hairline_stroke_color_light</color> <color name="default_icon_color_disabled_baseline">@color/default_icon_color_disabled_light</color>
diff --git a/ui/android/java/res/values-night/styles.xml b/ui/android/java/res/values-night/styles.xml index f1ab755f..df590ea 100644 --- a/ui/android/java/res/values-night/styles.xml +++ b/ui/android/java/res/values-night/styles.xml
@@ -5,6 +5,5 @@ <resources xmlns:tools="http://schemas.android.com/tools"> <style name="ColorOverlay.Ui" parent="ColorOverlay.Ui.DayNight"> - <item name="default_icon_color_inverse">@color/default_icon_color_dark</item> </style> </resources>
diff --git a/ui/android/java/res/values/attrs.xml b/ui/android/java/res/values/attrs.xml index f0754d1..4cff7a42 100644 --- a/ui/android/java/res/values/attrs.xml +++ b/ui/android/java/res/values/attrs.xml
@@ -27,8 +27,6 @@ <attr name="default_bg_color_dynamic" format="color"/> <attr name="divider_line_bg_color_dynamic" format="color"/> - <attr name="default_icon_color_inverse" format="color" /> - <declare-styleable name="ButtonCompat"> <!-- The color of the button background. --> <attr name="buttonColor" format="color"/>
diff --git a/ui/android/java/res/values/semantic_colors_adaptive.xml b/ui/android/java/res/values/semantic_colors_adaptive.xml index ff5fd201..d9cbae1 100644 --- a/ui/android/java/res/values/semantic_colors_adaptive.xml +++ b/ui/android/java/res/values/semantic_colors_adaptive.xml
@@ -26,8 +26,9 @@ <!-- Common icon colors for drawables. --> <color name="default_icon_color_baseline">@color/default_icon_color_dark</color> - <color name="default_icon_color_inverse" tools:ignore="UnusedResources">@color/default_icon_color_inverse_light</color> + <color name="default_icon_color_inverse_baseline" tools:ignore="UnusedResources">@color/default_icon_color_inverse_light</color> <color name="default_icon_color_accent1_baseline" tools:ignore="UnusedResources">@color/default_icon_color_blue_dark</color> + <color name="default_icon_color_on_accent1_baseline">@color/default_icon_color_on_accent1_light</color> <color name="default_icon_color_secondary_baseline" tools:ignore="UnusedResources">@color/default_icon_color_secondary_dark</color> <color name="hairline_stroke_color_baseline">@color/hairline_stroke_color_dark</color>
diff --git a/ui/android/java/res/values/semantic_colors_non_adaptive.xml b/ui/android/java/res/values/semantic_colors_non_adaptive.xml index 17ea20c8..f96e2d1 100644 --- a/ui/android/java/res/values/semantic_colors_non_adaptive.xml +++ b/ui/android/java/res/values/semantic_colors_non_adaptive.xml
@@ -22,6 +22,9 @@ <!-- Same as ?attr/colorOnSurfaceInverse --> <color name="default_icon_color_inverse_light">@color/baseline_neutral_50</color> <color name="default_icon_color_inverse_dark">@color/baseline_neutral_800</color> + <!-- Same as ?attr/colorOnPrimary. --> + <color name="default_icon_color_on_accent1_light">@color/baseline_neutral_0</color> + <color name="default_icon_color_on_accent1_dark">@color/baseline_primary_800</color> <!-- Common text colors --> <!-- Same as ?attr/colorOnSurface. -->
diff --git a/ui/android/java/res/values/styles.xml b/ui/android/java/res/values/styles.xml index 01834838..373cdd13 100644 --- a/ui/android/java/res/values/styles.xml +++ b/ui/android/java/res/values/styles.xml
@@ -5,7 +5,6 @@ <resources xmlns:tools="http://schemas.android.com/tools"> <style name="ColorOverlay.Ui" parent="ColorOverlay.Ui.DayNight"> - <item name="default_icon_color_inverse">@color/default_icon_color_light</item> </style> <style name="ColorOverlay.Ui.DayNight" parent=""> <!-- TODO(https://crbug.com/1216642): Move color attributes here. -->
diff --git a/ui/message_center/dummy_message_center.cc b/ui/message_center/dummy_message_center.cc index db8d9de..df56b90 100644 --- a/ui/message_center/dummy_message_center.cc +++ b/ui/message_center/dummy_message_center.cc
@@ -9,7 +9,7 @@ // and link with Android implementations of Chrome which do not have // notification systems yet. This is to avoid spreading compile-time flags // everywhere in the code. -#if !(defined(OS_ANDROID) || defined(OS_FUCHSIA)) +#if !(BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)) #error This file should only be used in Android and Fuchsia. #endif
diff --git a/ui/message_center/public/cpp/message_center_constants.h b/ui/message_center/public/cpp/message_center_constants.h index 4e5a6ea..59adee0 100644 --- a/ui/message_center/public/cpp/message_center_constants.h +++ b/ui/message_center/public/cpp/message_center_constants.h
@@ -100,7 +100,7 @@ // Progress bar. const int kProgressBarTopPadding = 16; -#if defined(OS_APPLE) +#if BUILDFLAG(IS_APPLE) const int kProgressBarThickness = 5; const int kProgressBarCornerRadius = 3; #endif
diff --git a/ui/message_center/views/message_popup_view.cc b/ui/message_center/views/message_popup_view.cc index c86a935..171ac0a4 100644 --- a/ui/message_center/views/message_popup_view.cc +++ b/ui/message_center/views/message_popup_view.cc
@@ -19,7 +19,7 @@ #include "ui/views/layout/fill_layout.h" #include "ui/views/widget/widget.h" -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" #endif @@ -90,7 +90,7 @@ } } -#if !defined(OS_APPLE) +#if !BUILDFLAG(IS_APPLE) float MessagePopupView::GetOpacity() const { if (!IsWidgetValid()) return 0.f; @@ -123,7 +123,7 @@ params.z_order = ui::ZOrderLevel::kFloatingWindow; // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) // Make the widget explicitly activatable as TYPE_POPUP is not activatable by // default but we need focus for the inline reply textarea. params.activatable = views::Widget::InitParams::Activatable::kYes; @@ -136,7 +136,7 @@ popup_collection_->ConfigureWidgetInitParamsForContainer(widget, ¶ms); widget->set_focus_on_creation(false); -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // We want to ensure that this toast always goes to the native desktop, // not the Ash desktop (since there is already another toast contents view // there.
diff --git a/ui/message_center/views/message_view.cc b/ui/message_center/views/message_view.cc index 98813e2..6addcba 100644 --- a/ui/message_center/views/message_view.cc +++ b/ui/message_center/views/message_view.cc
@@ -34,7 +34,7 @@ #include "ui/views/focus/focus_manager.h" #include "ui/views/widget/widget.h" -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "ui/base/win/shell.h" #endif @@ -68,7 +68,7 @@ } bool ShouldShowAeroShadowBorder() { -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) return ui::win::IsAeroGlassEnabled(); #else return false;
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc index fd673d76..0dc8d90 100644 --- a/ui/message_center/views/notification_view.cc +++ b/ui/message_center/views/notification_view.cc
@@ -86,7 +86,7 @@ } gfx::Insets CalculateTopPadding(int font_list_height) { -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) // On Windows, the fonts can have slightly different metrics reported, // depending on where the code runs. In Chrome, DirectWrite is on, which means // font metrics are reported from Skia, which rounds from float using ceil.
diff --git a/ui/message_center/views/notification_view_base_unittest.cc b/ui/message_center/views/notification_view_base_unittest.cc index 8ffd6742..3b15007 100644 --- a/ui/message_center/views/notification_view_base_unittest.cc +++ b/ui/message_center/views/notification_view_base_unittest.cc
@@ -664,7 +664,7 @@ // Synthetic scroll events are not supported on Mac in the views // test framework. -#if defined(OS_APPLE) +#if BUILDFLAG(IS_APPLE) #define MAYBE_SlideOut DISABLED_SlideOut #else #define MAYBE_SlideOut SlideOut @@ -691,7 +691,7 @@ EXPECT_TRUE(IsRemovedAfterIdle(kDefaultNotificationId)); } -#if defined(OS_APPLE) +#if BUILDFLAG(IS_APPLE) #define MAYBE_SlideOutNested DISABLED_SlideOutNested #else #define MAYBE_SlideOutNested SlideOutNested @@ -717,7 +717,7 @@ EXPECT_TRUE(IsRemovedAfterIdle(kDefaultNotificationId)); } -#if defined(OS_APPLE) +#if BUILDFLAG(IS_APPLE) #define MAYBE_DisableSlideForcibly DISABLED_DisableSlideForcibly #else #define MAYBE_DisableSlideForcibly DisableSlideForcibly
diff --git a/ui/native_theme/caption_style.cc b/ui/native_theme/caption_style.cc index b3c64068..eae59ce1 100644 --- a/ui/native_theme/caption_style.cc +++ b/ui/native_theme/caption_style.cc
@@ -29,7 +29,7 @@ return style; } -#if !defined(OS_WIN) && !defined(OS_APPLE) +#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_APPLE) absl::optional<CaptionStyle> CaptionStyle::FromSystemSettings() { return absl::nullopt; }
diff --git a/ui/native_theme/native_theme.cc b/ui/native_theme/native_theme.cc index 55b7e24..93879cdb8 100644 --- a/ui/native_theme/native_theme.cc +++ b/ui/native_theme/native_theme.cc
@@ -40,7 +40,7 @@ memcpy(this, &other, sizeof(*this)); } -#if !defined(OS_WIN) && !defined(OS_APPLE) +#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_APPLE) // static bool NativeTheme::SystemDarkModeSupported() { return false;
diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h index 061a8549..5aae3b7 100644 --- a/ui/native_theme/native_theme.h +++ b/ui/native_theme/native_theme.h
@@ -57,13 +57,13 @@ kCheckbox, // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) kFrameTopArea, #endif kInnerSpinButton, kMenuList, kMenuPopupBackground, -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) kMenuCheck, kMenuCheckBackground, kMenuPopupArrow, @@ -257,7 +257,7 @@ ScrollbarOverlayColorTheme scrollbar_theme; }; -#if defined(OS_APPLE) +#if BUILDFLAG(IS_APPLE) enum ScrollbarOrientation { // Vertical scrollbar on the right side of content. kVerticalOnRight, @@ -320,7 +320,7 @@ MenuBackgroundExtraParams menu_background; ProgressBarExtraParams progress_bar; ScrollbarArrowExtraParams scrollbar_arrow; -#if defined(OS_APPLE) +#if BUILDFLAG(IS_APPLE) ScrollbarExtraParams scrollbar_extra; #endif ScrollbarTrackExtraParams scrollbar_track;
diff --git a/ui/native_theme/native_theme_aura.cc b/ui/native_theme/native_theme_aura.cc index 77813d8..635cf56 100644 --- a/ui/native_theme/native_theme_aura.cc +++ b/ui/native_theme/native_theme_aura.cc
@@ -49,13 +49,13 @@ //////////////////////////////////////////////////////////////////////////////// // NativeTheme: -#if !defined(OS_APPLE) +#if !BUILDFLAG(IS_APPLE) // static NativeTheme* NativeTheme::GetInstanceForWeb() { return NativeThemeAura::web_instance(); } -#if !defined(OS_WIN) +#if !BUILDFLAG(IS_WIN) // static NativeTheme* NativeTheme::GetInstanceForNativeUi() { static base::NoDestructor<NativeThemeAura> s_native_theme(false, false); @@ -66,8 +66,8 @@ static base::NoDestructor<NativeThemeAura> s_native_theme(false, true); return s_native_theme.get(); } -#endif // !OS_WIN -#endif // !OS_APPLE +#endif // !BUILDFLAG(IS_WIN) +#endif // !BUILDFLAG(IS_APPLE) //////////////////////////////////////////////////////////////////////////////// // NativeThemeAura: @@ -103,13 +103,13 @@ } SkColor NativeThemeAura::FocusRingColorForBaseColor(SkColor base_color) const { -#if defined(OS_APPLE) +#if BUILDFLAG(IS_APPLE) // On Mac OSX, the system Accent Color setting is darkened a bit // for better contrast. return SkColorSetA(base_color, 166); #else return base_color; -#endif // OS_APPLE +#endif // BUILDFLAG(IS_APPLE) } void NativeThemeAura::PaintMenuPopupBackground(
diff --git a/ui/native_theme/native_theme_base.cc b/ui/native_theme/native_theme_base.cc index 3cc503e..44f0937 100644 --- a/ui/native_theme/native_theme_base.cc +++ b/ui/native_theme/native_theme_base.cc
@@ -267,7 +267,7 @@ break; // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. -#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) case kFrameTopArea: PaintFrameTopArea(canvas, state, rect, extra.frame_top_area, color_scheme);
diff --git a/ui/native_theme/native_theme_features.cc b/ui/native_theme/native_theme_features.cc index 8bd0819..502de5b68 100644 --- a/ui/native_theme/native_theme_features.cc +++ b/ui/native_theme/native_theme_features.cc
@@ -9,8 +9,8 @@ namespace features { -#if defined(OS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH) || \ - defined(OS_FUCHSIA) || BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH) || \ + BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_CHROMEOS_LACROS) constexpr base::FeatureState kOverlayScrollbarFeatureState = base::FEATURE_ENABLED_BY_DEFAULT; #else
diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index aa26979..58b46a5 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn
@@ -3,7 +3,7 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") -import("//build/config/crypto.gni") +import("//crypto/features.gni") import("//third_party/closure_compiler/compile_js.gni") import("//tools/typescript/ts_definitions.gni") import("//tools/typescript/ts_library.gni")
diff --git a/ui/webui/resources/cr_components/certificate_manager/BUILD.gn b/ui/webui/resources/cr_components/certificate_manager/BUILD.gn index 32edf6b..f64545a 100644 --- a/ui/webui/resources/cr_components/certificate_manager/BUILD.gn +++ b/ui/webui/resources/cr_components/certificate_manager/BUILD.gn
@@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/crypto.gni") +import("//crypto/features.gni") import("//tools/grit/preprocess_if_expr.gni") import("//tools/polymer/html_to_js.gni") import("//tools/typescript/ts_library.gni")
diff --git a/ui/webui/resources/cr_elements/cr_view_manager/cr_view_manager.js b/ui/webui/resources/cr_elements/cr_view_manager/cr_view_manager.js index 97cc703..de34866 100644 --- a/ui/webui/resources/cr_elements/cr_view_manager/cr_view_manager.js +++ b/ui/webui/resources/cr_elements/cr_view_manager/cr_view_manager.js
@@ -60,7 +60,22 @@ return whenFinished(animation); }); -viewAnimations.set('slide-in-fade-in', element => { +viewAnimations.set('slide-in-fade-in-ltr', element => { + const animation = element.animate( + [ + {transform: 'translateX(-8px)', opacity: 0}, + {transform: 'translateX(0)', opacity: 1} + ], + /** @type {!KeyframeAnimationOptions} */ ({ + duration: 300, + easing: 'cubic-bezier(0.0, 0.0, 0.2, 1)', + fill: 'forwards', + iterations: 1, + })); + + return whenFinished(animation); +}); +viewAnimations.set('slide-in-fade-in-rtl', element => { const animation = element.animate( [ {transform: 'translateX(8px)', opacity: 0},
diff --git a/url/origin.h b/url/origin.h index 8938e67a..b26cbb0f 100644 --- a/url/origin.h +++ b/url/origin.h
@@ -25,7 +25,7 @@ #include "url/url_canon.h" #include "url/url_constants.h" -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) #include <jni.h> namespace base { @@ -36,7 +36,7 @@ class JavaRef; } // namespace android } // namespace base -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) class GURL; @@ -298,11 +298,11 @@ // and precursor information. std::string GetDebugString(bool include_nonce = true) const; -#if defined(OS_ANDROID) +#if BUILDFLAG(IS_ANDROID) base::android::ScopedJavaLocalRef<jobject> CreateJavaObject() const; static Origin FromJavaObject( const base::android::JavaRef<jobject>& java_origin); -#endif // OS_ANDROID +#endif // BUILDFLAG(IS_ANDROID) void WriteIntoTrace(perfetto::TracedValue context) const;
diff --git a/url/run_all_unittests.cc b/url/run_all_unittests.cc index 0a972111..dd6bdee1 100644 --- a/url/run_all_unittests.cc +++ b/url/run_all_unittests.cc
@@ -10,14 +10,14 @@ #include "base/test/test_suite.h" #include "build/build_config.h" -#if !defined(OS_IOS) +#if !BUILDFLAG(IS_IOS) #include "mojo/core/embedder/embedder.h" // nogncheck #endif int main(int argc, char** argv) { base::TestSuite test_suite(argc, argv); -#if !defined(OS_IOS) +#if !BUILDFLAG(IS_IOS) mojo::core::Init(); #endif
diff --git a/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/BrowserFragmentLifecycleTest.java b/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/BrowserFragmentLifecycleTest.java index bc26b25..e8a46cdb 100644 --- a/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/BrowserFragmentLifecycleTest.java +++ b/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/BrowserFragmentLifecycleTest.java
@@ -4,9 +4,13 @@ package org.chromium.weblayer.test; +import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.support.test.runner.lifecycle.ActivityLifecycleCallback; +import android.support.test.runner.lifecycle.ActivityLifecycleMonitorRegistry; +import android.support.test.runner.lifecycle.Stage; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; @@ -97,6 +101,71 @@ waitForTabToFinishRestore(getTab(), url); } + /** + * Helper class used to ensure that during recreation the following are called: + * . TabListCallback#onTabAdded(). + * . NavigationCallback#onNavigationStarted(). + */ + private static final class RecreateCallbackTracker { + private final ActivityLifecycleCallback mStateListener; + private boolean mGotCreate; + private boolean mGotOnTabAdded; + private boolean mGotOnNavigationStarted; + + RecreateCallbackTracker(Browser browser) { + mStateListener = (Activity newActivity, Stage newStage) -> { + if (newStage == Stage.CREATED && !mGotCreate) { + mGotCreate = true; + Browser newBrowser = ((InstrumentationActivity) newActivity).getBrowser(); + Assert.assertTrue(newBrowser.getTabs().isEmpty()); + Assert.assertNotEquals(newBrowser, browser); + newBrowser.registerTabListCallback(new TabListCallback() { + @Override + public void onTabAdded(@NonNull Tab tab) { + mGotOnTabAdded = true; + tab.getNavigationController().registerNavigationCallback( + new NavigationCallback() { + @Override + public void onNavigationStarted( + @NonNull Navigation navigation) { + mGotOnNavigationStarted = true; + } + }); + } + }); + // This is needed to ensure the callback added above runs first. Without it the + // tab is made active onTabAdded(), resulting in onNavigationStarted() never + // being called (because the navigation starts from setActiveTab(), before the + // callback is added). + ((InstrumentationActivity) newActivity).reregisterTabListCallback(); + } + }; + ActivityLifecycleMonitorRegistry.getInstance().addLifecycleCallback(mStateListener); + } + + public void runAssertsAfterRecreate() { + Assert.assertTrue(mGotCreate); + Assert.assertTrue(mGotOnTabAdded); + Assert.assertTrue(mGotOnNavigationStarted); + ActivityLifecycleMonitorRegistry.getInstance().removeLifecycleCallback(mStateListener); + } + } + + @Test + @SmallTest + @MinWebLayerVersion(99) + public void restoreAfterRecreateCallsTabAndNavigationCallbacks() throws Throwable { + mActivityTestRule.launchShellWithUrl("about:blank"); + String url = "data:text,foo"; + mActivityTestRule.navigateAndWait(getTab(), url, false); + final RecreateCallbackTracker tracker = new RecreateCallbackTracker(getBrowser()); + + mActivityTestRule.recreateActivity(); + + waitForTabToFinishRestore(getTab(), url); + tracker.runAssertsAfterRecreate(); + } + @Test @SmallTest @MinWebLayerVersion(98) @@ -203,6 +272,24 @@ @Test @SmallTest + @MinWebLayerVersion(99) + public void restoresPreviousSessionAndNotifiesCallbacks() throws Throwable { + Bundle extras = new Bundle(); + extras.putString(InstrumentationActivity.EXTRA_PERSISTENCE_ID, "x"); + final String url = mActivityTestRule.getTestDataURL("simple_page.html"); + mActivityTestRule.launchShellWithUrl(url, extras); + final RecreateCallbackTracker tracker = new RecreateCallbackTracker(getBrowser()); + + mActivityTestRule.recreateActivity(); + + Tab tab = getTab(); + Assert.assertNotNull(tab); + waitForTabToFinishRestore(tab, url); + tracker.runAssertsAfterRecreate(); + } + + @Test + @SmallTest public void restoresPreviousSession() throws Throwable { restoresPreviousSession(new Bundle()); }
diff --git a/weblayer/browser/browser_impl.cc b/weblayer/browser/browser_impl.cc index 14910cd..559410c 100644 --- a/weblayer/browser/browser_impl.cc +++ b/weblayer/browser/browser_impl.cc
@@ -168,29 +168,34 @@ void BrowserImpl::RestoreStateIfNecessary( JNIEnv* env, const JavaParamRef<jstring>& j_persistence_id, - const JavaParamRef<jbyteArray>& j_persistence_crypto_key, - const JavaParamRef<jbyteArray>& j_minimal_persistence_state) { - Browser::PersistenceInfo persistence_info; - Browser::PersistenceInfo* persistence_info_ptr = nullptr; + const JavaParamRef<jbyteArray>& j_persistence_crypto_key) { + if (!j_persistence_id.obj()) + return; - if (j_persistence_id.obj()) { - const std::string persistence_id = - base::android::ConvertJavaStringToUTF8(j_persistence_id); - if (!persistence_id.empty()) { - persistence_info.id = persistence_id; - if (j_persistence_crypto_key.obj()) { - base::android::JavaByteArrayToByteVector( - env, j_persistence_crypto_key, &(persistence_info.last_crypto_key)); - } - persistence_info_ptr = &persistence_info; - } - } else if (j_minimal_persistence_state.obj()) { - base::android::JavaByteArrayToByteVector(env, j_minimal_persistence_state, - &(persistence_info.minimal_state)); - persistence_info_ptr = &persistence_info; + Browser::PersistenceInfo persistence_info; + persistence_info.id = + base::android::ConvertJavaStringToUTF8(j_persistence_id); + if (persistence_info.id.empty()) + return; + + if (j_persistence_crypto_key.obj()) { + base::android::JavaByteArrayToByteVector( + env, j_persistence_crypto_key, &(persistence_info.last_crypto_key)); } - if (persistence_info_ptr) - RestoreStateIfNecessary(*persistence_info_ptr); + RestoreStateIfNecessary(persistence_info); +} + +void BrowserImpl::RestoreMinimalState( + JNIEnv* env, + const base::android::JavaParamRef<jbyteArray>& + j_minimal_persistence_state) { + if (!j_minimal_persistence_state.obj()) + return; + + std::vector<uint8_t> minimal_state; + base::android::JavaByteArrayToByteVector(env, j_minimal_persistence_state, + &minimal_state); + RestoreMinimalStateForBrowser(this, minimal_state); } void BrowserImpl::WebPreferencesChanged(JNIEnv* env) { @@ -390,8 +395,6 @@ if (!persistence_id_.empty()) { browser_persister_ = std::make_unique<BrowserPersister>( GetBrowserPersisterDataPath(), this, persistence_info.last_crypto_key); - } else if (!persistence_info.minimal_state.empty()) { - RestoreMinimalState(this, persistence_info.minimal_state); } }
diff --git a/weblayer/browser/browser_impl.h b/weblayer/browser/browser_impl.h index 5debb852..c7f79ed0 100644 --- a/weblayer/browser/browser_impl.h +++ b/weblayer/browser/browser_impl.h
@@ -83,9 +83,10 @@ void RestoreStateIfNecessary( JNIEnv* env, const base::android::JavaParamRef<jstring>& j_persistence_id, - const base::android::JavaParamRef<jbyteArray>& j_persistence_crypto_key, - const base::android::JavaParamRef<jbyteArray>& - j_minimal_persistence_state); + const base::android::JavaParamRef<jbyteArray>& j_persistence_crypto_key); + void RestoreMinimalState(JNIEnv* env, + const base::android::JavaParamRef<jbyteArray>& + j_minimal_persistence_state); void WebPreferencesChanged(JNIEnv* env); void OnFragmentStart(JNIEnv* env); void OnFragmentResume(JNIEnv* env);
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/BrowserImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/BrowserImpl.java index 79ac46f..607d7ce 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/BrowserImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/BrowserImpl.java
@@ -10,6 +10,7 @@ import android.os.Bundle; import android.os.RemoteException; import android.provider.Settings; +import android.text.TextUtils; import android.view.View; import android.webkit.ValueCallback; @@ -98,18 +99,22 @@ private boolean mViewAttachedToWindow; private boolean mNotifyOnBrowserControlsOffsetsChanged; - // Created in the constructor from saved state and used in setClient(). - private PersistenceInfo mPersistenceInfo; + // Created in the constructor from saved state. + private FullPersistenceInfo mFullPersistenceInfo; + private MinimalPersistenceInfo mMinimalPersistenceInfo; private int mMinimumSurfaceWidth; private int mMinimumSurfaceHeight; - private static final class PersistenceInfo { + // This persistence state is saved to disk, and loaded async. + private static final class FullPersistenceInfo { String mPersistenceId; byte[] mCryptoKey; - byte[] mMinimalPersistenceState; }; + // This persistence state is saved to a bundle, and loaded synchronously. + private static final class MinimalPersistenceInfo { byte[] mState; }; + /** * @param windowAndroid a window that was created by a {@link BrowserFragmentImpl}. It's not * valid to call this method with other {@link WindowAndroid} instances. Typically this @@ -140,15 +145,19 @@ profile.checkNotDestroyed(); mProfile = profile; - mPersistenceInfo = new PersistenceInfo(); - mPersistenceInfo.mPersistenceId = persistenceId; - mPersistenceInfo.mCryptoKey = savedInstanceState != null - ? savedInstanceState.getByteArray(SAVED_STATE_SESSION_SERVICE_CRYPTO_KEY) - : null; - mPersistenceInfo.mMinimalPersistenceState = - (savedInstanceState != null && (persistenceId == null || persistenceId.isEmpty())) - ? savedInstanceState.getByteArray(SAVED_STATE_MINIMAL_PERSISTENCE_STATE_KEY) - : null; + if (!TextUtils.isEmpty(persistenceId)) { + mFullPersistenceInfo = new FullPersistenceInfo(); + mFullPersistenceInfo.mPersistenceId = persistenceId; + mFullPersistenceInfo.mCryptoKey = savedInstanceState != null + ? savedInstanceState.getByteArray(SAVED_STATE_SESSION_SERVICE_CRYPTO_KEY) + : null; + } else if (savedInstanceState != null + && savedInstanceState.getByteArray(SAVED_STATE_MINIMAL_PERSISTENCE_STATE_KEY) + != null) { + mMinimalPersistenceInfo = new MinimalPersistenceInfo(); + mMinimalPersistenceInfo.mState = + savedInstanceState.getByteArray(SAVED_STATE_MINIMAL_PERSISTENCE_STATE_KEY); + } IntentRequestTracker tracker = windowAndroid.getIntentRequestTracker(); assert tracker != null : "FragmentWindowAndroid must have an IntentRequestTracker"; @@ -480,25 +489,23 @@ @Override public void setClient(IBrowserClient client) { - StrictModeWorkaround.apply(); - mClient = client; - // This function is called from the client once everything has been setup (meaning all the // client classes have been created and AIDL interfaces established in both directions). // This function is called immediately after the constructor of BrowserImpl from the client. - assert mPersistenceInfo != null; - PersistenceInfo persistenceInfo = mPersistenceInfo; - mPersistenceInfo = null; - BrowserImplJni.get().restoreStateIfNecessary(mNativeBrowser, persistenceInfo.mPersistenceId, - persistenceInfo.mCryptoKey, persistenceInfo.mMinimalPersistenceState); - if (getTabs().size() > 0) { - updateAllTabsAndSetActive(); - } else if (persistenceInfo.mPersistenceId == null - || persistenceInfo.mPersistenceId.isEmpty()) { + StrictModeWorkaround.apply(); + mClient = client; + + if (mFullPersistenceInfo != null) { + FullPersistenceInfo persistenceInfo = mFullPersistenceInfo; + mFullPersistenceInfo = null; + BrowserImplJni.get().restoreStateIfNecessary( + mNativeBrowser, persistenceInfo.mPersistenceId, persistenceInfo.mCryptoKey); + } else if (mMinimalPersistenceInfo == null) { boolean setActiveResult = setActiveTab(createTab()); assert setActiveResult; - } // else case is session restore, which will asynchronously create tabs. + } // else case is minimal state, which is restored in onFragmentStart(). See comment in + // onFragmentStart() for details on this scenario. } @Override @@ -582,8 +589,30 @@ } } + private void restoreMinimalStateIfNecessary() { + if (mMinimalPersistenceInfo == null) return; + + final MinimalPersistenceInfo minimalPersistenceInfo = mMinimalPersistenceInfo; + mMinimalPersistenceInfo = null; + BrowserImplJni.get().restoreMinimalState(mNativeBrowser, minimalPersistenceInfo.mState); + if (getTabs().size() > 0) { + updateAllTabsAndSetActive(); + } else { + boolean setActiveResult = setActiveTab(createTab()); + assert setActiveResult; + } + } + public void onFragmentStart() { mFragmentStarted = true; + + // Minimal state is synchronously restored. To ensure the embedder has a chance to install + // the necessary callbacks restore is started here. OTOH, if this was done from the + // constructor, the embedder would not be able to install callbacks before restore + // completed. This would mean the embedder could not correctly install state when + // navigations are started. + restoreMinimalStateIfNecessary(); + if (mViewAttachedToWindow) { mInConfigurationChangeAndWasAttached = false; mForcedVisible = false; @@ -718,8 +747,9 @@ void saveBrowserPersisterIfNecessary(long nativeBrowserImpl); byte[] getBrowserPersisterCryptoKey(long nativeBrowserImpl); byte[] getMinimalPersistenceState(long nativeBrowserImpl, int maxNavigationsPerTab); - void restoreStateIfNecessary(long nativeBrowserImpl, String persistenceId, - byte[] persistenceCryptoKey, byte[] minimalPersistenceState); + void restoreStateIfNecessary( + long nativeBrowserImpl, String persistenceId, byte[] persistenceCryptoKey); + void restoreMinimalState(long nativeBrowserImpl, byte[] minimalPersistenceState); void webPreferencesChanged(long nativeBrowserImpl); void onFragmentStart(long nativeBrowserImpl); void onFragmentResume(long nativeBrowserImpl);
diff --git a/weblayer/browser/persistence/minimal_browser_persister.cc b/weblayer/browser/persistence/minimal_browser_persister.cc index 8216327f..dbffb8e5 100644 --- a/weblayer/browser/persistence/minimal_browser_persister.cc +++ b/weblayer/browser/persistence/minimal_browser_persister.cc
@@ -360,8 +360,8 @@ return builder.ToByteArray(); } -void RestoreMinimalState(BrowserImpl* browser, - const std::vector<uint8_t>& value) { +void RestoreMinimalStateForBrowser(BrowserImpl* browser, + const std::vector<uint8_t>& value) { MinimalRestorer restorer(value); RestoreBrowserState(browser, restorer.RestoreCommands()); }
diff --git a/weblayer/browser/persistence/minimal_browser_persister.h b/weblayer/browser/persistence/minimal_browser_persister.h index aef0422..a8b0f86 100644 --- a/weblayer/browser/persistence/minimal_browser_persister.h +++ b/weblayer/browser/persistence/minimal_browser_persister.h
@@ -26,8 +26,8 @@ // Restores the state previously created via PersistMinimalState(). When // done this ensures |browser| has at least one tab. -void RestoreMinimalState(BrowserImpl* browser, - const std::vector<uint8_t>& value); +void RestoreMinimalStateForBrowser(BrowserImpl* browser, + const std::vector<uint8_t>& value); } // namespace weblayer
diff --git a/weblayer/browser/persistence/minimal_browser_persister_browsertest.cc b/weblayer/browser/persistence/minimal_browser_persister_browsertest.cc index 1485d7c5..4586a0db7 100644 --- a/weblayer/browser/persistence/minimal_browser_persister_browsertest.cc +++ b/weblayer/browser/persistence/minimal_browser_persister_browsertest.cc
@@ -11,6 +11,7 @@ #include "net/base/filename_util.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "weblayer/browser/browser_impl.h" +#include "weblayer/browser/persistence/minimal_browser_persister.h" #include "weblayer/browser/profile_impl.h" #include "weblayer/browser/tab_impl.h" #include "weblayer/public/navigation.h" @@ -49,14 +50,15 @@ // Persists the current state, then recreates the browser. See // BrowserImpl::GetMinimalPersistenceState() for details on // |max_size_in_bytes|, 0 means use the default value. - void RecreateBrowserFromCurrentState( + void RecreateBrowserUsingMinimalState( int max_number_of_navigations_per_tab = 0, int max_size_in_bytes = 0) { - Browser::PersistenceInfo persistence_info; - persistence_info.minimal_state = browser_impl()->GetMinimalPersistenceState( - max_number_of_navigations_per_tab, max_size_in_bytes); + std::vector<uint8_t> minimal_state = + browser_impl()->GetMinimalPersistenceState( + max_number_of_navigations_per_tab, max_size_in_bytes); tab_ = nullptr; - browser_ = Browser::Create(GetProfile(), &persistence_info); + browser_ = Browser::Create(GetProfile(), nullptr); + RestoreMinimalStateForBrowser(browser_impl(), minimal_state); // There is always at least one tab created (even if restore fails). ASSERT_GE(browser_->GetTabs().size(), 1u); tab_ = static_cast<TabImpl*>(browser_->GetTabs()[0]); @@ -74,7 +76,7 @@ IN_PROC_BROWSER_TEST_F(MinimalBrowserPersisterTest, SingleTab) { NavigateAndWaitForCompletion(url1(), tab_); - ASSERT_NO_FATAL_FAILURE(RecreateBrowserFromCurrentState()); + ASSERT_NO_FATAL_FAILURE(RecreateBrowserUsingMinimalState()); EXPECT_EQ(tab_, browser_->GetActiveTab()); TestNavigationObserver observer( @@ -94,7 +96,7 @@ // Shutdown the service and run the assertions twice to ensure we handle // correctly storing state of tabs that need to be reloaded. for (int i = 0; i < 2; ++i) { - ASSERT_NO_FATAL_FAILURE(RecreateBrowserFromCurrentState()); + ASSERT_NO_FATAL_FAILURE(RecreateBrowserUsingMinimalState()); tab2 = nullptr; ASSERT_EQ(2u, browser_->GetTabs().size()) << "iteration " << i; @@ -115,7 +117,7 @@ tab_->GetNavigationController()->Navigate(url2()); - ASSERT_NO_FATAL_FAILURE(RecreateBrowserFromCurrentState()); + ASSERT_NO_FATAL_FAILURE(RecreateBrowserUsingMinimalState()); EXPECT_EQ(tab_, browser_->GetActiveTab()); TestNavigationObserver observer( @@ -130,7 +132,7 @@ NavigateAndWaitForCompletion(url2(), tab_); - ASSERT_NO_FATAL_FAILURE(RecreateBrowserFromCurrentState()); + ASSERT_NO_FATAL_FAILURE(RecreateBrowserUsingMinimalState()); TabImpl* restored_tab = tab_; EXPECT_EQ(restored_tab, browser_->GetActiveTab()); @@ -155,7 +157,7 @@ const GURL url4 = embedded_test_server()->GetURL("/simple_page4.html"); NavigateAndWaitForCompletion(url4, tab_); - ASSERT_NO_FATAL_FAILURE(RecreateBrowserFromCurrentState(3)); + ASSERT_NO_FATAL_FAILURE(RecreateBrowserUsingMinimalState(3)); // As a max of 3 navigations was specified, only the last three navigations // should be restored. @@ -186,7 +188,7 @@ url_string.replace(0, data.size(), data); NavigateAndWaitForCompletion(GURL(url_string), tab_); - ASSERT_NO_FATAL_FAILURE(RecreateBrowserFromCurrentState(0, 2048)); + ASSERT_NO_FATAL_FAILURE(RecreateBrowserUsingMinimalState(0, 2048)); TabImpl* restored_tab = tab_; EXPECT_EQ(restored_tab, browser_->GetActiveTab());
diff --git a/weblayer/public/browser.h b/weblayer/public/browser.h index 02b1f97e..866994a 100644 --- a/weblayer/public/browser.h +++ b/weblayer/public/browser.h
@@ -33,10 +33,6 @@ // Last key used to encrypt incognito profile. std::vector<uint8_t> last_crypto_key; - - // If non-empty used to restore the state of the browser. This is only used - // if |id| is empty. - std::vector<uint8_t> minimal_state; }; // Creates a new Browser. |persistence_info|, if non-null, is used for saving
diff --git a/weblayer/public/java/org/chromium/weblayer/Browser.java b/weblayer/public/java/org/chromium/weblayer/Browser.java index 0b960a2..10a8f86 100644 --- a/weblayer/public/java/org/chromium/weblayer/Browser.java +++ b/weblayer/public/java/org/chromium/weblayer/Browser.java
@@ -26,7 +26,23 @@ * Browser contains any number of Tabs, with one active Tab. The active Tab is visible to the user, * all other Tabs are hidden. * - * By default Browser has a single active Tab. + * Newly created Browsers have a single active Tab. + * + * Browser provides for two distinct ways to save state, which impacts the state of the Browser at + * various points in the lifecycle. + * + * Asynchronously to the file system. This is used if a {@link persistenceId} was supplied when the + * Browser was created. The {@link persistenceId} uniquely identifies the Browser for saving the + * set of tabs and navigations. This is intended for long term persistence. + * + * For Browsers created with a {@link persistenceId}, restore happens asynchronously. As a result, + * the Browser will not have any tabs until restore completes (which may be after the Fragment has + * started). + * + * If a {@link persistenceId} is not supplied, then a minimal amount of state is saved to the + * fragment (instance state). During recreation, if instance state is available, the state is + * restored in {@link onStart}. Restore happens during start so that callbacks can be attached. As + * a result of this, the Browser has no tabs until the Fragment is started. */ public class Browser { // Set to null once destroyed (or for tests).
diff --git a/weblayer/public/java/org/chromium/weblayer/WebLayer.java b/weblayer/public/java/org/chromium/weblayer/WebLayer.java index 86d5030..ce5a35b6 100644 --- a/weblayer/public/java/org/chromium/weblayer/WebLayer.java +++ b/weblayer/public/java/org/chromium/weblayer/WebLayer.java
@@ -490,16 +490,13 @@ /** * Creates a new WebLayer Fragment. * - * {@link persistenceId} uniquely identifies the Browser for saving the set of tabs and - * navigations. A value of null does not save/restore any state. A non-null value results in - * asynchronously restoring the tabs and navigations. Supplying a non-null value means the - * Browser initially has no tabs (until restore is complete). - * * @param profileName Null to indicate in-memory profile. Otherwise, name cannot be empty * and should contain only alphanumeric and underscore characters since it will be used as * a directory name in the file system. * @param persistenceId If non-null and not empty uniquely identifies the Browser for saving * state. + * + * @see Browser for details on {@link persistenceId} */ @NonNull public static Fragment createBrowserFragment(
diff --git a/weblayer/shell/android/shell_apk/src/org/chromium/weblayer/shell/InstrumentationActivity.java b/weblayer/shell/android/shell_apk/src/org/chromium/weblayer/shell/InstrumentationActivity.java index 7d6a7630..5266d77b 100644 --- a/weblayer/shell/android/shell_apk/src/org/chromium/weblayer/shell/InstrumentationActivity.java +++ b/weblayer/shell/android/shell_apk/src/org/chromium/weblayer/shell/InstrumentationActivity.java
@@ -369,6 +369,15 @@ } } + /** + * Removes and adds back the TabListCallback. This is useful for tests that + * need to ensure their callback is run first. + */ + public void reregisterTabListCallback() { + mBrowser.unregisterTabListCallback(mTabListCallback); + mBrowser.registerTabListCallback(mTabListCallback); + } + private void setTabCallbacks(Tab tab) { tab.registerTabCallback(mRendererCrashListener);